This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: non local labels in some handcoded assembly


Philip:

I am very new to libc so I will hold back on submitting patches for a while.
I will be more active once I get the arm toolchain stuff to work.
The problem is not dramatic but does pollute the symbol table which is where
I noticed it first.

Here is example for global labels in libc:

sysdeps/arm/strlen.S:

...

Laligned:                               @ here, we have a word in r2.  Does it
        tst     r2, $0x000000ff         @ contain any zeroes?
        tstne   r2, $0x0000ff00         @
        tstne   r2, $0x00ff0000         @
        tstne   r2, $0xff000000         @
        addne   r0, r0, $4              @ if not, the string is 4 bytes longer
        ldrne   r2, [r1], $4            @ and we continue to the next word
        bne     Laligned                @
Llastword:                              @ drop through to here once we find a
        tst     r2, $0x000000ff         @ word that has a zero byte in it
        addne   r0, r0, $1              @
        tstne   r2, $0x0000ff00         @ and add up to 3 bytes on to it
        addne   r0, r0, $1              @
        tstne   r2, $0x00ff0000         @ (if first three all non-zero, 4th
        addne   r0, r0, $1              @  must be zero)
        RETINSTR(mov,pc,lr)
END(strlen)


Others can be found using

>grep -r "^Loop" .
./sysdeps/alpha/mul_1.s:Loop:   mulq    $2,$19,$3       # $3 = prod_low
./sysdeps/i960/addmul_1.s:Loop: ld      (g1)[g2*4],g5
./sysdeps/i960/add_n.s:Loop:    subo    1,g3,g3         # update loop counter
./sysdeps/i960/mul_1.s:Loop:    ld      (g1)[g2*4],g5
./sysdeps/i960/sub_n.s:Loop:    subo    1,g3,g3         # update loop counter
./sysdeps/m88k/m88100/add_n.S:Loop:     addu    r3,r3,64
./sysdeps/m88k/m88100/add_n.s:Loop:     addu    r3,r3,32
./sysdeps/m88k/m88100/mul_1.S:Loop:
./sysdeps/m88k/m88100/mul_1.s:Loop:
./sysdeps/m88k/m88100/sub_n.S:Loop:     addu    r3,r3,64
./sysdeps/m88k/m88100/sub_n.s:Loop:     addu    r3,r3,32
./sysdeps/m88k/add_n.s:Loop:    addu    r3,r3,32
./sysdeps/m88k/mul_1.s:Loop:    ld       r9,r3[r4]
./sysdeps/m88k/sub_n.s:Loop:    addu    r3,r3,32
./sysdeps/m88k/m88110/addmul_1.s:Loop:  ld       r7,r8[r4]
./sysdeps/m88k/m88110/add_n.S:Loop1:    subu     size,size,8
./sysdeps/m88k/m88110/add_n.S:Loope1:   addu.cio r6,r10,r8
./sysdeps/m88k/m88110/add_n.S:Loop2:    subu     size,size,8
./sysdeps/m88k/m88110/add_n.S:Loope2:   ld.d     r8,s1_ptr,0
./sysdeps/m88k/m88110/mul_1.S:Loop:     ld       r6,r3[r4]
./sysdeps/m88k/m88110/mul_1.s:Loop:     ld       r6,r3[r4]
./sysdeps/m88k/m88110/sub_n.S:Loop1:    subu     size,size,8
./sysdeps/m88k/m88110/sub_n.S:Loope1:   subu.cio r6,r10,r8
./sysdeps/m88k/m88110/sub_n.S:Loop1b:   subu     size,size,8
./sysdeps/m88k/m88110/sub_n.S:Loope1b:subu.cio r6,r8,r10
./sysdeps/m88k/m88110/sub_n.S:Loop2:    subu     size,size,8
./sysdeps/m88k/m88110/sub_n.S:Loope2:   ld.d     r8,s1_ptr,0
./sysdeps/rs6000/add_n.s:Loop:  lu      8,4(4)          # load s1 limb and 
update s1_ptr
./sysdeps/rs6000/lshift.s:Loop: lu      0,-4(4)         # load next lower limb
./sysdeps/rs6000/rshift.s:Loop: lu      0,4(4)          # load next higher 
limb
./sysdeps/rs6000/sub_n.s:Loop:  lu      8,4(4)          # load s1 limb and 
update s1_ptr
./sysdeps/vax/add_n.s:Loop:
./sysdeps/vax/addmul_1.s:Loop1: movl    (r8)+,r1
./sysdeps/vax/addmul_1.s:Loop2: movl    (r8)+,r1
./sysdeps/vax/mul_1.s:Loop1:    movl    (r8)+,r1
./sysdeps/vax/mul_1.s:Loop2:    movl    (r8)+,r1
./sysdeps/vax/sub_n.s:Loop:
./sysdeps/vax/submul_1.s:Loop1: movl    (r8)+,r1
./sysdeps/vax/submul_1.s:Loop2: movl    (r8)+,r1
./sysdeps/z8000/add_n.s:Loop:   pop     r0,@r6
./sysdeps/z8000/sub_n.s:Loop:   pop     r0,@r6

Hope that helps,

Robert

On Tuesday 26 August 2003 09:35, Philip Blundell wrote:
> On Tue, 2003-08-26 at 13:58, robert wrote:
> > A lot of the assembly code contains (global) lables like:
> >
> > Lalign,Loop, Llastword,Ldiv0,Loop1,Loop3,Lfixup_dividend,
> > Lbignum,Lgot_result
> >
> > I think those can and should be converted to local labels, i.e labels
> > beginning with a dot.
>
> Most of those symbols sound like they are from libgcc, not libc.  If
> there are particular instances in glibc that are causing you a problem,
> you will need to be more specific about what and where they are.
> Perhaps you'd like to send a patch to correct these.
>
> p.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]