This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: new ppc32 GOT/PLT support
- From: Richard Henderson <rth at twiddle dot net>
- To: Alan Modra <amodra at bigpond dot net dot au>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Thu, 19 May 2005 23:37:14 -0700
- Subject: Re: new ppc32 GOT/PLT support
- References: <20050517143353.GO27573@bubble.grove.modra.org>
On Wed, May 18, 2005 at 12:03:53AM +0930, Alan Modra wrote:
> /* Get address of the 'b _DYNAMIC@local'... */
> + asm ("bcl 20,31,0f;"
> "b _DYNAMIC@local;"
> "0:"
> + : "=l" (branchaddr));
>
> /* So now work out the difference between where the branch actually points,
> and the offset of that location in memory from the start of the file. */
> + runtime_dynamic = ((Elf32_Addr) branchaddr
> + + ((Elf32_Sword) (*branchaddr << 6 & 0xffffff00) >> 6));
This is simply
asm ("bcl 20,31,0f\n"
"0: mflr %0\n"
" addis %0,%0,_DYNAMIC-0b@ha\n"
" addi %0,%0,_DYNAMIC-0b@l"
: "=b"(runtime_dynamic) : : "lr");
> +# ifdef HAVE_ASM_PPC_REL16
> + bcl 20,31,1f
> +1: mflr r7
> + addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
> + addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
> +# else
> bl _GLOBAL_OFFSET_TABLE_@local-4
> mflr r7
> +# endif
All this ifdefery is so common, perhaps a sysdep.h macro is in order...
r~