Subject: Re: PR 12312 - madplay dumps core
To: Ignatios Souvatzis <is@netbsd.org>
From: Richard Earnshaw <rearnsha@arm.com>
List: port-arm32
Date: 03/19/2001 09:52:37
> On Mon, Mar 19, 2001 at 02:28:26PM +1100, Simon Burge wrote:
> > Ahh.  That's the arm-specific code in the libmad library (from
> > libmad/imdct_l_arm.S).  That should be easy to fix then (famous
> > last words!).
> 
> So, how does arm PIC code look like?
> 	-is

extern int x;

int foo()
{
  return x;
}

gcc -O -fPIC -S:

_foo:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 1, current_function_anonymous_args = 0
        mov     ip, sp
        stmfd   sp!, {sl, fp, ip, lr, pc}
        sub     fp, ip, #4
        ldr     sl, L3
        add     sl, pc, sl
L2:
        ldr     r3, L3+4
        ldr     r3, [sl, r3]
        ldr     r0, [r3, #0]
        ldmea   fp, {sl, fp, sp, pc}
L4:
        .align  0
L3:
        .word   __GLOBAL_OFFSET_TABLE_+. - (L2+4)
        .word   _x