This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [patches] Fix x86-64 GOT table
- To: Andreas Jaeger <aj at suse dot de>
- Subject: Re: [patches] Fix x86-64 GOT table
- From: Bo Thorsen <bo at suse dot co dot uk>
- Date: Mon, 30 Apr 2001 11:23:20 +0100 (BST)
- Cc: patches at x86-64 dot org, binutils at sources dot redhat dot com
On 30 Apr 2001, Andreas Jaeger wrote:
> This patches fixes values in the GOT table for symbols. I'll
> commit it after some more testing.
>
> Andreas
>
> 2001-04-30 Andreas Jaeger <aj@suse.de>, Andreas Schwab <schwab@suse.de>
>
> * elf64-x86-64.c (elf64_x86_64_relocate_section): Correct test for
> R_X86_64_GOTPCREL, don't use assignments instead of comparisons.
>
> ============================================================
> Index: bfd/elf64-x86-64.c
> --- bfd/elf64-x86-64.c 2001/04/29 13:42:45 1.14
> +++ bfd/elf64-x86-64.c 2001/04/30 10:06:24
> @@ -1250,11 +1250,10 @@
> || h->root.type == bfd_link_hash_defweak)
> {
> sec = h->root.u.def.section;
> - if (r_type == R_X86_64_GOTPCREL
> - || (r_type = R_X86_64_PLT32
> - && splt != NULL
> - && h->plt.offset != (bfd_vma) -1)
> - || (r_type = R_X86_64_GOT32
> + if ((r_type == R_X86_64_PLT32
> + && splt != NULL
> + && h->plt.offset != (bfd_vma) -1)
> + || ((r_type == R_X86_64_GOT32 || r_type == R_X86_64_GOTPCREL)
> && elf_hash_table (info)->dynamic_sections_created
> && (!info->shared
> || (! info->symbolic && h->dynindx != -1)
> @@ -1408,6 +1407,7 @@
> else
> relocation = sgot->output_offset + off;
> }
> +
> break;
>
> case R_X86_64_PLT32:
>
>
Confirmed. This fixes the problem showed by Honza's small test case:
int a=1;
_start()
{
return a==1;
}
Contents of section .got:
20c8 00000000 00000000 00000000 00000000 ................
20d8 00000000 00000000 c0200000 00000000 ......... ......
^^^^^^^^
Congratulations, nice work.
Bo.
--
Bo Thorsen | 28 Merton Road
Free software developer | Slough, SL1 1QW
SuSE Labs | England