public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* bizarre ARM PIC code generation
@ 2000-09-10 14:31 Philip Blundell
  0 siblings, 0 replies; only message in thread
From: Philip Blundell @ 2000-09-10 14:31 UTC (permalink / raw)
  To: gcc

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-09-10 14:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-10 14:31 bizarre ARM PIC code generation Philip Blundell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).