This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
bizarre ARM PIC code generation
- To: gcc at gcc dot gnu dot org
- Subject: bizarre ARM PIC code generation
- From: Philip Blundell <philb at gnu dot org>
- Date: Sun, 10 Sep 2000 22:33:39 +0100
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.