This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: A Qn on GCC generated ARM asm code
Binesh writes:
> Hi,
>
> I have a question on the contents of a library compiled using gcc (V
> 3.4.3) for an ARM11 target.
> When I disassemble code in the .text section of a library a.so, I find
> some data beyond what appears to be the end of the a function's
> assembly code.
>
> for eg a function abc (prelinked & stripped) seems to have the
> following assembly:
>
> 414afb68: e92d4420 stmdb sp!, {r5, sl, lr}
> 414afb6c: e59fa03c ldr sl, [pc, #60] ; 414afbb0
> 414afb70: e59f303c ldr r3, [pc, #60] ; 414afbb4
> 414afb74: e08fa00a add sl, pc, sl
> 414afb78: e79a2003 ldr r2, [sl, r3]
> 414afb7c: e1a03001 mov r3, r1
> 414afb80: e1a05000 mov r5, r0
> 414afb84: e592c000 ldr ip, [r2]
> 414afb88: e59f2028 ldr r2, [pc, #40] ; 414afbb8
> 414afb8c: e24dd00c sub sp, sp, #12 ; 0xc
> 414afb90: e1a0100c mov r1, ip
> 414afb94: e08a2002 add r2, sl, r2
> 414afb98: e3a0c000 mov ip, #0 ; 0x0
> 414afb9c: e58dc000 str ip, [sp]
> 414afba0: ebfff6bb bl 414ad694
> 414afba4: e1a00005 mov r0, r5
> 414afba8: e28dd00c add sp, sp, #12 ; 0xc
> 414afbac: e8bd8420 ldmia sp!, {r5, sl, pc}
> 414afbb0: 002b3574 eoreq r3, fp, r4, ror r5
> 414afbb4: 00004ab8 streqh r4, [r0], -r8
> 414afbb8: fff77f18 swinv 0x00f77f18
>
> The function appears to have ended at address 0x414afbac. However the
> next function starts only at 0x414afbbc. The bytes at 0x414afbb0
> through 0x414afbb8 seem to represent some data (the unstripped elf
> tags them with a $d) and the function code seems to make a reference
> to these addresses. What exactly are these data parameters? As none of
> these data values are present in the C-code of the function abc, it
> appears to have been inserted by the compiler.
> It would be of great help if someone could help me locate the
> source/logic behind these extra bytes.
You are much better advised to use -save-temps and look at the
generated assembly code.
Andrew.