[PATCH] x86: Remove the unused _GLOBAL_OFFSET_TABLE_
H.J. Lu
hjl.tools@gmail.com
Fri Feb 9 03:24:00 GMT 2018
On Thu, Feb 8, 2018 at 4:32 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Feb 8, 2018 at 1:56 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Mon, Feb 5, 2018 at 8:37 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>> On Sun, Feb 4, 2018 at 8:26 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> Since _GLOBAL_OFFSET_TABLE_ may be referenced implicitly on x86,
>>>> checking ref_regular_nonweak leaves the unused _GLOBAL_OFFSET_TABLE_
>>>> in output. This patch checks explicit GOT references instead.
>>>>
>>>> bfd/
>>>>
>>>> PR ld/22782
>>>> * elf32-i386.c (elf_i386_check_relocs): Set got_referenced if
>>>> GOT is referenced.
>>>> * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
>>>> * elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Likewise.
>>>> Check got_referenced instead of ref_regular_nonweak. Remove
>>>> the unused _GLOBAL_OFFSET_TABLE_ from symbol table.
>>>> * elfxx-x86.h (elf_x86_link_hash_table): Add got_referenced.
>>>>
>>>> ld/
>>>>
>>>> PR ld/22782
>>>> * testsuite/ld-i386/discarded1.s: Replace mov with div.
>>>> * testsuite/ld-x86-64/discarded1.s: Likewise.
>>>> * testsuite/ld-i386/i386.exp: Run pr22782.
>>>> * testsuite/ld-i386/load1-nacl.d: Updated for removing
>>>> _GLOBAL_OFFSET_TABLE_ from output.
>>>> * testsuite/ld-i386/load1.d: Likewise.
>>>> * testsuite/ld-x86-64/load1a-nacl.d: Likewise.
>>>> * testsuite/ld-x86-64/load1a.d: Likewise.
>>>> * testsuite/ld-x86-64/load1b-nacl.d: Likewise.
>>>> * testsuite/ld-x86-64/load1b.d: Likewise.
>>>> * testsuite/ld-i386/pr22782.d: New file.
>>>> * testsuite/ld-i386/pr22782.s: Likewise.
>>>> * testsuite/ld-x86-64/pr22782.s: Likewise.
>>>> * testsuite/ld-x86-64/pr22782a.d: Likewise.
>>>> * testsuite/ld-x86-64/pr22782b.d: Likewise.
>>>> * testsuite/ld-x86-64/x86-64.exp: Run pr22782a and pr22782b.
>>>
>>> This is the patch I am checking in.
>>>
>>
>> Solaris requires to keep _GLOBAL_OFFSET_TABLE_ even if it isn't used.
>> I checked in this patch to detect Solaris target and keeps it for Solaris.
>>
>> --
>> H.J.
>
> I checked in this patch to set need_global_offset_table with
> info->output_bfd->xvec.
>
> --
> H.J.
> --
> From 17ef1256f3a93fbcb399f075a9ebb88ae7ef72a3 Mon Sep 17 00:00:00 2001
> From: "H.J. Lu" <hjl.tools@gmail.com>
> Date: Thu, 8 Feb 2018 16:29:19 -0800
> Subject: [PATCH] x86: Set need_global_offset_table with info->output_bfd->xvec
>
> * elf32-i386.c (elf32_i386_copy_solaris_special_section_fields):
> Remove prototype.
> (i386_elf32_sol2_vec): Declared.
> (elf_i386_link_setup_gnu_properties): Set
> need_global_offset_table with info->output_bfd->xvec.
> * elf64-x86-64.c (elf64_x86_64_copy_solaris_special_section_fields):
> Remove prototype.
> (x86_64_elf64_sol2_vec): Declared.
> (elf_x86_64_link_setup_gnu_properties): Set
> need_global_offset_table with info->output_bfd->xvec.
We will need is_solaris for TLS. Rainer, can you test this patch for master
branch on Solaris/x86?
Thanks,
--
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x86-Add-is_solaris-to-elf_x86_target_os.patch
Type: text/x-patch
Size: 7342 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20180209/2667c66b/attachment.bin>
More information about the Binutils
mailing list