bizarre ARM PIC code generation
Philip Blundell
philb@gnu.org
Sun Sep 10 14:31:00 GMT 2000
Recent versions of arm-linux GCC seem to want to call "bar" indirectly through
registers in this code:
void
foo(void)
{
void bar(void) __attribute__((weak));
bar();
asm("xx");
}
Compiling with -fPIC -O2 -fomit-frame-pointer gives:
foo:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, current_function_anonymous_args = 0
stmfd sp!, {sl, lr}
ldr sl, .L4
ldr r3, .L4+4
.L3:
add sl, pc, sl
mov lr, pc
ldr pc, [sl, r3]
xx
ldmfd sp!, {sl, pc}
.L5:
.align 2
.L4:
.word _GLOBAL_OFFSET_TABLE_ - (.L3+8)
.word bar(GOT)
.Lfe1:
whereas one would expect:
foo:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, current_function_anonymous_args = 0
str lr, [sp, #-4]!
bl bar(PLT)
xx
ldr pc, [sp], #4
p.
More information about the Gcc
mailing list