This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [ Patch mach-o/gas] adjust more x86_64 relocs for GOT case.
- From: Tristan Gingold <gingold at adacore dot com>
- To: Iain Sandoe <developer at sandoe-acoustics dot co dot uk>
- Cc: binutils Development <binutils at sourceware dot org>
- Date: Fri, 6 Jan 2012 13:39:48 +0100
- Subject: Re: [ Patch mach-o/gas] adjust more x86_64 relocs for GOT case.
- References: <519F21E7-9807-4A96-B0A7-6BCD1C413DB9@sandoe-acoustics.co.uk>
On Jan 6, 2012, at 1:37 PM, Iain Sandoe wrote:
> this allows me a step closer to building libgcc...
>
> OK, or a different solution in mind?
Looks ok to me.
> Iain
>
> diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
> index 4b57d6d..97bab20 100644
> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -9039,17 +9039,26 @@ i386_validate_fix (fixS *fixp)
> {
> if (fixp->fx_subsy && fixp->fx_subsy == GOT_symbol)
> {
> - if (fixp->fx_r_type == BFD_RELOC_32_PCREL)
> +#ifdef OBJ_MACH_O
> + if (fixp->fx_r_type == BFD_RELOC_32_PCREL
> + || fixp->fx_r_type == BFD_RELOC_MACH_O_X86_64_PCREL32_1
> + || fixp->fx_r_type == BFD_RELOC_MACH_O_X86_64_PCREL32_2
> + || fixp->fx_r_type == BFD_RELOC_MACH_O_X86_64_PCREL32_4)
> {
> if (!object_64bit)
> abort ();
> -#ifdef OBJ_MACH_O
> + /* If the instruction is a mov regmem -> reg and operands can be words
> + or dwords, we do a got load. */
> if (fixp->fx_where > 1
> && fixp->fx_frag->fr_literal[fixp->fx_where - 2] == (char)0x8b)
> fixp->fx_r_type = BFD_RELOC_MACH_O_X86_64_GOT_LOAD;
> else
> fixp->fx_r_type = BFD_RELOC_MACH_O_X86_64_GOT;
> #else
> + if (fixp->fx_r_type == BFD_RELOC_32_PCREL)
> + {
> + if (!object_64bit)
> + abort ();
> fixp->fx_r_type = BFD_RELOC_X86_64_GOTPCREL;
> #endif
> }
>