• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Révision6de2ae4a2a0020a827f05f30dedf8dcec7e77ee0 (tree)
l'heure2009-06-16 22:41:10
AuteurH.J. Lu <hjl.tools@gmai...>
CommiterH.J. Lu

Message de Log

2009-06-16 H.J. Lu <hongjiu.lu@intel.com>

* configure.in (elf): Add elf-ifunc.lo.

* configure: Regenerated.
* Makefile.in: Likewise.

* elf-bfd.h (elf_link_hash_table): Add sgot, sgotplt,
srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc.

* elf32-i386.c (elf_i386_link_hash_table): Remove sgot,
sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and
irelifunc.
(elf_i386_link_hash_table_create): Likewise.
(elf_i386_create_dynamic_sections): Likewise.
(elf_i386_check_relocs): Likewise.
(elf_i386_allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(elf_i386_finish_dynamic_sections): Likewise.
(elf_i386_create_got_section): Removed.

* elf64-x86-64.c (elf64_x86_64_link_hash_table): Remove sgot,
sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and
irelifunc.
(elf64_x86_64_compute_jump_table_size): Updated.
(elf64_x86_64_link_hash_table_create): Likewise.
(elf64_x86_64_create_dynamic_sections): Likewise.
(elf64_x86_64_check_relocs): Likewise.
(elf64_x86_64_allocate_dynrelocs): Likewise.
(elf64_x86_64_size_dynamic_sections): Likewise.
(elf64_x86_64_relocate_section): Likewise.
(elf64_x86_64_finish_dynamic_symbol): Likewise.
(elf64_x86_64_finish_dynamic_sections): Likewise.
(elf64_x86_64_create_got_section): Removed.

* elflink.c (_bfd_elf_create_got_section): Use log_file_align
for pointer alignment. Set up section pointers.
(_bfd_elf_create_dynamic_sections): Likewise.
(_bfd_elf_create_ifunc_sections): Moved to ...
* elf-ifunc.c: Here. New.

* Makefile.am (BFD32_BACKENDS): Add elf-ifunc.lo.
(BFD32_BACKENDS_CFILES): Add elf-ifunc.c.
Run "make dep-am".

Change Summary

Modification

--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,8 +1,55 @@
1+2009-06-16 H.J. Lu <hongjiu.lu@intel.com>
2+
3+ * configure.in (elf): Add elf-ifunc.lo.
4+
5+ * configure: Regenerated.
6+ * Makefile.in: Likewise.
7+
8+ * elf-bfd.h (elf_link_hash_table): Add sgot, sgotplt,
9+ srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc.
10+
11+ * elf32-i386.c (elf_i386_link_hash_table): Remove sgot,
12+ sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and
13+ irelifunc.
14+ (elf_i386_link_hash_table_create): Likewise.
15+ (elf_i386_create_dynamic_sections): Likewise.
16+ (elf_i386_check_relocs): Likewise.
17+ (elf_i386_allocate_dynrelocs): Likewise.
18+ (elf_i386_size_dynamic_sections): Likewise.
19+ (elf_i386_relocate_section): Likewise.
20+ (elf_i386_finish_dynamic_symbol): Likewise.
21+ (elf_i386_finish_dynamic_sections): Likewise.
22+ (elf_i386_create_got_section): Removed.
23+
24+ * elf64-x86-64.c (elf64_x86_64_link_hash_table): Remove sgot,
25+ sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and
26+ irelifunc.
27+ (elf64_x86_64_compute_jump_table_size): Updated.
28+ (elf64_x86_64_link_hash_table_create): Likewise.
29+ (elf64_x86_64_create_dynamic_sections): Likewise.
30+ (elf64_x86_64_check_relocs): Likewise.
31+ (elf64_x86_64_allocate_dynrelocs): Likewise.
32+ (elf64_x86_64_size_dynamic_sections): Likewise.
33+ (elf64_x86_64_relocate_section): Likewise.
34+ (elf64_x86_64_finish_dynamic_symbol): Likewise.
35+ (elf64_x86_64_finish_dynamic_sections): Likewise.
36+ (elf64_x86_64_create_got_section): Removed.
37+
38+ * elflink.c (_bfd_elf_create_got_section): Use log_file_align
39+ for pointer alignment. Set up section pointers.
40+ (_bfd_elf_create_dynamic_sections): Likewise.
41+ (_bfd_elf_create_ifunc_sections): Moved to ...
42+ * elf-ifunc.c: Here. New.
43+
44+ * Makefile.am (BFD32_BACKENDS): Add elf-ifunc.lo.
45+ (BFD32_BACKENDS_CFILES): Add elf-ifunc.c.
46+ Run "make dep-am".
47+
148 2009-06-16 Doug Kwan <dougkwan@google.com>
249
3- * elf32-arm.c (cortex_a8_erratum_scan): Change type of offset
4- to bfd_signed_vma. Cast constant operands which are used in
5- offset related expressions to bfd_signed_vma type as appropriate.
50+ * elf32-arm.c (cortex_a8_erratum_scan): Change type of offset
51+ to bfd_signed_vma. Cast constant operands which are used in
52+ offset related expressions to bfd_signed_vma type as appropriate.
653
754 2009-06-16 Maciej W. Rozycki <macro@linux-mips.org>
855
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -250,6 +250,7 @@ BFD32_BACKENDS = \
250250 ecofflink.lo \
251251 elf-attrs.lo \
252252 elf-eh-frame.lo \
253+ elf-ifunc.lo \
253254 elf-m10200.lo \
254255 elf-m10300.lo \
255256 elf-strtab.lo \
@@ -432,6 +433,7 @@ BFD32_BACKENDS_CFILES = \
432433 ecofflink.c \
433434 elf-attrs.c \
434435 elf-eh-frame.c \
436+ elf-ifunc.c \
435437 elf-m10200.c \
436438 elf-m10300.c \
437439 elf-strtab.c \
@@ -2046,6 +2048,18 @@ elf-eh-frame.lo: \
20462048 $(INCDIR)/filenames.h \
20472049 $(INCDIR)/hashtab.h \
20482050 elf-bfd.h
2051+elf-ifunc.lo: \
2052+ elf-ifunc.c \
2053+ $(INCDIR)/bfdlink.h \
2054+ $(INCDIR)/elf/common.h \
2055+ $(INCDIR)/elf/external.h \
2056+ $(INCDIR)/elf/internal.h \
2057+ $(INCDIR)/filenames.h \
2058+ $(INCDIR)/hashtab.h \
2059+ $(INCDIR)/libiberty.h \
2060+ $(INCDIR)/objalloc.h \
2061+ $(INCDIR)/safe-ctype.h \
2062+ elf-bfd.h
20492063 elf-m10200.lo: \
20502064 elf-m10200.c \
20512065 $(INCDIR)/bfdlink.h \
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -521,6 +521,7 @@ BFD32_BACKENDS = \
521521 ecofflink.lo \
522522 elf-attrs.lo \
523523 elf-eh-frame.lo \
524+ elf-ifunc.lo \
524525 elf-m10200.lo \
525526 elf-m10300.lo \
526527 elf-strtab.lo \
@@ -703,6 +704,7 @@ BFD32_BACKENDS_CFILES = \
703704 ecofflink.c \
704705 elf-attrs.c \
705706 elf-eh-frame.c \
707+ elf-ifunc.c \
706708 elf-m10200.c \
707709 elf-m10300.c \
708710 elf-strtab.c \
@@ -2647,6 +2649,18 @@ elf-eh-frame.lo: \
26472649 $(INCDIR)/filenames.h \
26482650 $(INCDIR)/hashtab.h \
26492651 elf-bfd.h
2652+elf-ifunc.lo: \
2653+ elf-ifunc.c \
2654+ $(INCDIR)/bfdlink.h \
2655+ $(INCDIR)/elf/common.h \
2656+ $(INCDIR)/elf/external.h \
2657+ $(INCDIR)/elf/internal.h \
2658+ $(INCDIR)/filenames.h \
2659+ $(INCDIR)/hashtab.h \
2660+ $(INCDIR)/libiberty.h \
2661+ $(INCDIR)/objalloc.h \
2662+ $(INCDIR)/safe-ctype.h \
2663+ elf-bfd.h
26502664 elf-m10200.lo: \
26512665 elf-m10200.c \
26522666 $(INCDIR)/bfdlink.h \
--- a/bfd/configure
+++ b/bfd/configure
@@ -20942,7 +20942,8 @@ selarchs="$f"
2094220942 # Target backend .o files.
2094320943 tb=
2094420944
20945-elf="elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo"
20945+elf="elf.lo elflink.lo elf-attrs.lo elf-ifunc.lo elf-strtab.lo
20946+ elf-eh-frame.lo dwarf1.lo"
2094620947
2094720948 for vec in $selvecs
2094820949 do
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -639,7 +639,8 @@ selarchs="$f"
639639 # Target backend .o files.
640640 tb=
641641
642-elf="elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo"
642+elf="elf.lo elflink.lo elf-attrs.lo elf-ifunc.lo elf-strtab.lo
643+ elf-eh-frame.lo dwarf1.lo"
643644
644645 for vec in $selvecs
645646 do
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -457,6 +457,17 @@ struct elf_link_hash_table
457457
458458 /* A linked list of BFD's loaded in the link. */
459459 struct elf_link_loaded_list *loaded;
460+
461+ /* Short-cuts to get to dynamic linker sections. */
462+ asection *sgot;
463+ asection *sgotplt;
464+ asection *srelgot;
465+ asection *splt;
466+ asection *srelplt;
467+ asection *igotplt;
468+ asection *iplt;
469+ asection *irelplt;
470+ asection *irelifunc;
460471 };
461472
462473 /* Look up an entry in an ELF linker hash table. */
--- /dev/null
+++ b/bfd/elf-ifunc.c
@@ -0,0 +1,105 @@
1+/* ELF STT_GNU_IFUNC support.
2+ Copyright 2009
3+ Free Software Foundation, Inc.
4+
5+ This file is part of BFD, the Binary File Descriptor library.
6+
7+ This program is free software; you can redistribute it and/or modify
8+ it under the terms of the GNU General Public License as published by
9+ the Free Software Foundation; either version 3 of the License, or
10+ (at your option) any later version.
11+
12+ This program is distributed in the hope that it will be useful,
13+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ GNU General Public License for more details.
16+
17+ You should have received a copy of the GNU General Public License
18+ along with this program; if not, write to the Free Software
19+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20+ MA 02110-1301, USA. */
21+
22+#include "sysdep.h"
23+#include "bfd.h"
24+#include "bfdlink.h"
25+#include "libbfd.h"
26+#define ARCH_SIZE 0
27+#include "elf-bfd.h"
28+#include "safe-ctype.h"
29+#include "libiberty.h"
30+#include "objalloc.h"
31+
32+/* Create sections needed by STT_GNU_IFUNC symbol. */
33+
34+bfd_boolean
35+_bfd_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info)
36+{
37+ flagword flags, pltflags;
38+ asection *s;
39+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
40+ struct elf_link_hash_table *htab = elf_hash_table (info);
41+
42+ if (htab->irelifunc != NULL || htab->iplt != NULL)
43+ return TRUE;
44+
45+ flags = bed->dynamic_sec_flags;
46+ pltflags = flags;
47+ if (bed->plt_not_loaded)
48+ /* We do not clear SEC_ALLOC here because we still want the OS to
49+ allocate space for the section; it's just that there's nothing
50+ to read in from the object file. */
51+ pltflags &= ~ (SEC_CODE | SEC_LOAD | SEC_HAS_CONTENTS);
52+ else
53+ pltflags |= SEC_ALLOC | SEC_CODE | SEC_LOAD;
54+ if (bed->plt_readonly)
55+ pltflags |= SEC_READONLY;
56+
57+ if (info->shared)
58+ {
59+ /* We need to create .rel[a].ifunc for shared objects. */
60+ const char *rel_sec = (bed->rela_plts_and_copies_p
61+ ? ".rela.ifunc" : ".rel.ifunc");
62+
63+ s = bfd_make_section_with_flags (abfd, rel_sec,
64+ flags | SEC_READONLY);
65+ if (s == NULL
66+ || ! bfd_set_section_alignment (abfd, s,
67+ bed->s->log_file_align))
68+ return FALSE;
69+ htab->irelifunc = s;
70+ }
71+ else
72+ {
73+ /* We need to create .iplt, .rel[a].iplt, .igot and .igot.plt
74+ for static executables. */
75+ s = bfd_make_section_with_flags (abfd, ".iplt", pltflags);
76+ if (s == NULL
77+ || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment))
78+ return FALSE;
79+ htab->iplt = s;
80+
81+ s = bfd_make_section_with_flags (abfd,
82+ (bed->rela_plts_and_copies_p
83+ ? ".rela.iplt" : ".rel.iplt"),
84+ flags | SEC_READONLY);
85+ if (s == NULL
86+ || ! bfd_set_section_alignment (abfd, s,
87+ bed->s->log_file_align))
88+ return FALSE;
89+ htab->irelplt = s;
90+
91+ /* We don't need the .igot section if we have the .igot.plt
92+ section. */
93+ if (bed->want_got_plt)
94+ s = bfd_make_section_with_flags (abfd, ".igot.plt", flags);
95+ else
96+ s = bfd_make_section_with_flags (abfd, ".igot", flags);
97+ if (s == NULL
98+ || !bfd_set_section_alignment (abfd, s,
99+ bed->s->log_file_align))
100+ return FALSE;
101+ htab->igotplt = s;
102+ }
103+
104+ return TRUE;
105+}
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -670,17 +670,8 @@ struct elf_i386_link_hash_table
670670 struct elf_link_hash_table elf;
671671
672672 /* Short-cuts to get to dynamic linker sections. */
673- asection *sgot;
674- asection *sgotplt;
675- asection *srelgot;
676- asection *splt;
677- asection *srelplt;
678673 asection *sdynbss;
679674 asection *srelbss;
680- asection *igotplt;
681- asection *iplt;
682- asection *irelplt;
683- asection *irelifunc;
684675
685676 /* The (unloaded but important) .rel.plt.unloaded section on VxWorks. */
686677 asection *srelplt2;
@@ -850,17 +841,8 @@ elf_i386_link_hash_table_create (bfd *abfd)
850841 return NULL;
851842 }
852843
853- ret->sgot = NULL;
854- ret->sgotplt = NULL;
855- ret->srelgot = NULL;
856- ret->splt = NULL;
857- ret->srelplt = NULL;
858844 ret->sdynbss = NULL;
859845 ret->srelbss = NULL;
860- ret->igotplt= NULL;
861- ret->iplt = NULL;
862- ret->irelplt= NULL;
863- ret->irelifunc = NULL;
864846 ret->tls_ldm_got.refcount = 0;
865847 ret->next_tls_desc_index = 0;
866848 ret->sgotplt_jump_table_size = 0;
@@ -899,35 +881,6 @@ elf_i386_link_hash_table_free (struct bfd_link_hash_table *hash)
899881 _bfd_generic_link_hash_table_free (hash);
900882 }
901883
902-/* Create .got, .gotplt, and .rel.got sections in DYNOBJ, and set up
903- shortcuts to them in our hash table. */
904-
905-static bfd_boolean
906-elf_i386_create_got_section (bfd *dynobj, struct bfd_link_info *info)
907-{
908- struct elf_i386_link_hash_table *htab;
909-
910- if (! _bfd_elf_create_got_section (dynobj, info))
911- return FALSE;
912-
913- htab = elf_i386_hash_table (info);
914- htab->sgot = bfd_get_section_by_name (dynobj, ".got");
915- htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
916- if (!htab->sgot || !htab->sgotplt)
917- abort ();
918-
919- htab->srelgot = bfd_make_section_with_flags (dynobj, ".rel.got",
920- (SEC_ALLOC | SEC_LOAD
921- | SEC_HAS_CONTENTS
922- | SEC_IN_MEMORY
923- | SEC_LINKER_CREATED
924- | SEC_READONLY));
925- if (htab->srelgot == NULL
926- || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
927- return FALSE;
928- return TRUE;
929-}
930-
931884 /* Create .plt, .rel.plt, .got, .got.plt, .rel.got, .dynbss, and
932885 .rel.bss sections in DYNOBJ, and set up shortcuts to them in our
933886 hash table. */
@@ -937,25 +890,21 @@ elf_i386_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
937890 {
938891 struct elf_i386_link_hash_table *htab;
939892
940- htab = elf_i386_hash_table (info);
941- if (!htab->sgot && !elf_i386_create_got_section (dynobj, info))
942- return FALSE;
943-
944893 if (!_bfd_elf_create_dynamic_sections (dynobj, info))
945894 return FALSE;
946895
947- htab->splt = bfd_get_section_by_name (dynobj, ".plt");
948- htab->srelplt = bfd_get_section_by_name (dynobj, ".rel.plt");
896+ htab = elf_i386_hash_table (info);
949897 htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
950898 if (!info->shared)
951899 htab->srelbss = bfd_get_section_by_name (dynobj, ".rel.bss");
952900
953- if (!htab->splt || !htab->srelplt || !htab->sdynbss
901+ if (!htab->sdynbss
954902 || (!info->shared && !htab->srelbss))
955903 abort ();
956904
957905 if (htab->is_vxworks
958- && !elf_vxworks_create_dynamic_sections (dynobj, info, &htab->srelplt2))
906+ && !elf_vxworks_create_dynamic_sections (dynobj, info,
907+ &htab->srelplt2))
959908 return FALSE;
960909
961910 return TRUE;
@@ -1427,31 +1376,8 @@ elf_i386_check_relocs (bfd *abfd,
14271376 case R_386_PLT32:
14281377 case R_386_GOT32:
14291378 case R_386_GOTOFF:
1430- if (htab->irelifunc == NULL && htab->iplt == NULL)
1431- {
1432- if (!_bfd_elf_create_ifunc_sections (abfd, info))
1433- return FALSE;
1434-
1435- if (info->shared)
1436- {
1437- htab->irelifunc = bfd_get_section_by_name (abfd,
1438- ".rel.ifunc");
1439- if (!htab->irelifunc)
1440- abort ();
1441- }
1442- else
1443- {
1444- htab->iplt = bfd_get_section_by_name (abfd, ".iplt");
1445- htab->irelplt = bfd_get_section_by_name (abfd,
1446- ".rel.iplt");
1447- htab->igotplt = bfd_get_section_by_name (abfd,
1448- ".igot.plt");
1449- if (!htab->iplt
1450- || !htab->irelplt
1451- || !htab->igotplt)
1452- abort ();
1453- }
1454- }
1379+ if (!_bfd_elf_create_ifunc_sections (abfd, info))
1380+ return FALSE;
14551381 break;
14561382 }
14571383
@@ -1534,8 +1460,8 @@ elf_i386_check_relocs (bfd *abfd,
15341460 case R_386_GOT32:
15351461 case R_386_GOTOFF:
15361462 h->got.refcount += 1;
1537- if (htab->sgot == NULL
1538- && !elf_i386_create_got_section (htab->elf.dynobj,
1463+ if (htab->elf.sgot == NULL
1464+ && !_bfd_elf_create_got_section (htab->elf.dynobj,
15391465 info))
15401466 return FALSE;
15411467 break;
@@ -1678,11 +1604,11 @@ elf_i386_check_relocs (bfd *abfd,
16781604 case R_386_GOTOFF:
16791605 case R_386_GOTPC:
16801606 create_got:
1681- if (htab->sgot == NULL)
1607+ if (htab->elf.sgot == NULL)
16821608 {
16831609 if (htab->elf.dynobj == NULL)
16841610 htab->elf.dynobj = abfd;
1685- if (!elf_i386_create_got_section (htab->elf.dynobj, info))
1611+ if (!_bfd_elf_create_got_section (htab->elf.dynobj, info))
16861612 return FALSE;
16871613 }
16881614 if (r_type != R_386_TLS_IE)
@@ -2175,11 +2101,11 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
21752101
21762102 /* When building a static executable, use .iplt, .igot.plt and
21772103 .rel.iplt sections for STT_GNU_IFUNC symbols. */
2178- if (htab->splt != NULL)
2104+ if (htab->elf.splt != NULL)
21792105 {
2180- plt = htab->splt;
2181- gotplt = htab->sgotplt;
2182- relplt = htab->srelplt;
2106+ plt = htab->elf.splt;
2107+ gotplt = htab->elf.sgotplt;
2108+ relplt = htab->elf.srelplt;
21832109
21842110 /* If this is the first .plt entry, make room for the special
21852111 first entry. */
@@ -2188,9 +2114,9 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
21882114 }
21892115 else
21902116 {
2191- plt = htab->iplt;
2192- gotplt = htab->igotplt;
2193- relplt = htab->irelplt;
2117+ plt = htab->elf.iplt;
2118+ gotplt = htab->elf.igotplt;
2119+ relplt = htab->elf.irelplt;
21942120 }
21952121
21962122 /* Don't update value of STT_GNU_IFUNC symbol to PLT. We need
@@ -2218,7 +2144,7 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
22182144
22192145 /* Finally, allocate space. */
22202146 for (p = eh->dyn_relocs; p != NULL; p = p->next)
2221- htab->irelifunc->size += p->count * sizeof (Elf32_External_Rel);
2147+ htab->elf.irelifunc->size += p->count * sizeof (Elf32_External_Rel);
22222148
22232149 /* For STT_GNU_IFUNC symbol, .got.plt has the real function
22242150 addres and .got has the PLT entry adddress. We will load
@@ -2239,17 +2165,17 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
22392165 || (!info->shared
22402166 && !h->pointer_equality_needed)
22412167 || (info->executable && info->shared)
2242- || htab->sgot == NULL)
2168+ || htab->elf.sgot == NULL)
22432169 {
22442170 /* Use .got.plt. */
22452171 h->got.offset = (bfd_vma) -1;
22462172 }
22472173 else
22482174 {
2249- h->got.offset = htab->sgot->size;
2250- htab->sgot->size += 4;
2175+ h->got.offset = htab->elf.sgot->size;
2176+ htab->elf.sgot->size += 4;
22512177 if (info->shared)
2252- htab->srelgot->size += sizeof (Elf32_External_Rel);
2178+ htab->elf.srelgot->size += sizeof (Elf32_External_Rel);
22532179 }
22542180
22552181 return TRUE;
@@ -2269,7 +2195,7 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
22692195 if (info->shared
22702196 || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
22712197 {
2272- asection *s = htab->splt;
2198+ asection *s = htab->elf.splt;
22732199
22742200 /* If this is the first .plt entry, make room for the special
22752201 first entry. */
@@ -2295,10 +2221,10 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
22952221
22962222 /* We also need to make an entry in the .got.plt section, which
22972223 will be placed in the .got section by the linker script. */
2298- htab->sgotplt->size += 4;
2224+ htab->elf.sgotplt->size += 4;
22992225
23002226 /* We also need to make an entry in the .rel.plt section. */
2301- htab->srelplt->size += sizeof (Elf32_External_Rel);
2227+ htab->elf.srelplt->size += sizeof (Elf32_External_Rel);
23022228 htab->next_tls_desc_index++;
23032229
23042230 if (htab->is_vxworks && !info->shared)
@@ -2357,12 +2283,12 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
23572283 return FALSE;
23582284 }
23592285
2360- s = htab->sgot;
2286+ s = htab->elf.sgot;
23612287 if (GOT_TLS_GDESC_P (tls_type))
23622288 {
2363- eh->tlsdesc_got = htab->sgotplt->size
2289+ eh->tlsdesc_got = htab->elf.sgotplt->size
23642290 - elf_i386_compute_jump_table_size (htab);
2365- htab->sgotplt->size += 8;
2291+ htab->elf.sgotplt->size += 8;
23662292 h->got.offset = (bfd_vma) -2;
23672293 }
23682294 if (! GOT_TLS_GDESC_P (tls_type)
@@ -2381,20 +2307,20 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
23812307 need two), R_386_TLS_GD needs one if local symbol and two if
23822308 global. */
23832309 if (tls_type == GOT_TLS_IE_BOTH)
2384- htab->srelgot->size += 2 * sizeof (Elf32_External_Rel);
2310+ htab->elf.srelgot->size += 2 * sizeof (Elf32_External_Rel);
23852311 else if ((GOT_TLS_GD_P (tls_type) && h->dynindx == -1)
23862312 || (tls_type & GOT_TLS_IE))
2387- htab->srelgot->size += sizeof (Elf32_External_Rel);
2313+ htab->elf.srelgot->size += sizeof (Elf32_External_Rel);
23882314 else if (GOT_TLS_GD_P (tls_type))
2389- htab->srelgot->size += 2 * sizeof (Elf32_External_Rel);
2315+ htab->elf.srelgot->size += 2 * sizeof (Elf32_External_Rel);
23902316 else if (! GOT_TLS_GDESC_P (tls_type)
23912317 && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
23922318 || h->root.type != bfd_link_hash_undefweak)
23932319 && (info->shared
23942320 || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
2395- htab->srelgot->size += sizeof (Elf32_External_Rel);
2321+ htab->elf.srelgot->size += sizeof (Elf32_External_Rel);
23962322 if (GOT_TLS_GDESC_P (tls_type))
2397- htab->srelplt->size += sizeof (Elf32_External_Rel);
2323+ htab->elf.srelplt->size += sizeof (Elf32_External_Rel);
23982324 }
23992325 else
24002326 h->got.offset = (bfd_vma) -1;
@@ -2644,8 +2570,8 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
26442570 end_local_got = local_got + locsymcount;
26452571 local_tls_type = elf_i386_local_got_tls_type (ibfd);
26462572 local_tlsdesc_gotent = elf_i386_local_tlsdesc_gotent (ibfd);
2647- s = htab->sgot;
2648- srel = htab->srelgot;
2573+ s = htab->elf.sgot;
2574+ srel = htab->elf.srelgot;
26492575 for (; local_got < end_local_got;
26502576 ++local_got, ++local_tls_type, ++local_tlsdesc_gotent)
26512577 {
@@ -2654,9 +2580,9 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
26542580 {
26552581 if (GOT_TLS_GDESC_P (*local_tls_type))
26562582 {
2657- *local_tlsdesc_gotent = htab->sgotplt->size
2583+ *local_tlsdesc_gotent = htab->elf.sgotplt->size
26582584 - elf_i386_compute_jump_table_size (htab);
2659- htab->sgotplt->size += 8;
2585+ htab->elf.sgotplt->size += 8;
26602586 *local_got = (bfd_vma) -2;
26612587 }
26622588 if (! GOT_TLS_GDESC_P (*local_tls_type)
@@ -2678,7 +2604,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
26782604 || ! GOT_TLS_GDESC_P (*local_tls_type))
26792605 srel->size += sizeof (Elf32_External_Rel);
26802606 if (GOT_TLS_GDESC_P (*local_tls_type))
2681- htab->srelplt->size += sizeof (Elf32_External_Rel);
2607+ htab->elf.srelplt->size += sizeof (Elf32_External_Rel);
26822608 }
26832609 }
26842610 else
@@ -2690,9 +2616,9 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
26902616 {
26912617 /* Allocate 2 got entries and 1 dynamic reloc for R_386_TLS_LDM
26922618 relocs. */
2693- htab->tls_ldm_got.offset = htab->sgot->size;
2694- htab->sgot->size += 8;
2695- htab->srelgot->size += sizeof (Elf32_External_Rel);
2619+ htab->tls_ldm_got.offset = htab->elf.sgot->size;
2620+ htab->elf.sgot->size += 8;
2621+ htab->elf.srelgot->size += sizeof (Elf32_External_Rel);
26962622 }
26972623 else
26982624 htab->tls_ldm_got.offset = -1;
@@ -2711,7 +2637,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
27112637 it's not incremented, so in order to compute the space reserved
27122638 for them, it suffices to multiply the reloc count by the jump
27132639 slot size. */
2714- if (htab->srelplt)
2640+ if (htab->elf.srelplt)
27152641 htab->sgotplt_jump_table_size = htab->next_tls_desc_index * 4;
27162642
27172643 /* We now have determined the sizes of the various dynamic sections.
@@ -2724,11 +2650,11 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
27242650 if ((s->flags & SEC_LINKER_CREATED) == 0)
27252651 continue;
27262652
2727- if (s == htab->splt
2728- || s == htab->sgot
2729- || s == htab->sgotplt
2730- || s == htab->iplt
2731- || s == htab->igotplt
2653+ if (s == htab->elf.splt
2654+ || s == htab->elf.sgot
2655+ || s == htab->elf.sgotplt
2656+ || s == htab->elf.iplt
2657+ || s == htab->elf.igotplt
27322658 || s == htab->sdynbss)
27332659 {
27342660 /* Strip this section if we don't need it; see the
@@ -2742,7 +2668,9 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
27422668 }
27432669 else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rel"))
27442670 {
2745- if (s->size != 0 && s != htab->srelplt && s != htab->srelplt2)
2671+ if (s->size != 0
2672+ && s != htab->elf.srelplt
2673+ && s != htab->srelplt2)
27462674 relocs = TRUE;
27472675
27482676 /* We use the reloc_count field as a counter if we need
@@ -2800,7 +2728,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
28002728 return FALSE;
28012729 }
28022730
2803- if (htab->splt->size != 0)
2731+ if (htab->elf.splt->size != 0)
28042732 {
28052733 if (!add_dynamic_entry (DT_PLTGOT, 0)
28062734 || !add_dynamic_entry (DT_PLTRELSZ, 0)
@@ -3162,15 +3090,15 @@ elf_i386_relocate_section (bfd *output_bfd,
31623090 abort ();
31633091
31643092 /* STT_GNU_IFUNC symbol must go through PLT. */
3165- if (htab->splt != NULL)
3093+ if (htab->elf.splt != NULL)
31663094 {
3167- plt = htab->splt;
3168- gotplt = htab->sgotplt;
3095+ plt = htab->elf.splt;
3096+ gotplt = htab->elf.sgotplt;
31693097 }
31703098 else
31713099 {
3172- plt = htab->iplt;
3173- gotplt = htab->igotplt;
3100+ plt = htab->elf.iplt;
3101+ gotplt = htab->elf.igotplt;
31743102 }
31753103
31763104 relocation = (plt->output_section->vma
@@ -3228,7 +3156,7 @@ elf_i386_relocate_section (bfd *output_bfd,
32283156 else
32293157 outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
32303158
3231- sreloc = htab->irelifunc;
3159+ sreloc = htab->elf.irelifunc;
32323160 loc = sreloc->contents;
32333161 loc += (sreloc->reloc_count++
32343162 * sizeof (Elf32_External_Rel));
@@ -3247,7 +3175,7 @@ elf_i386_relocate_section (bfd *output_bfd,
32473175 goto do_relocation;
32483176
32493177 case R_386_GOT32:
3250- base_got = htab->sgot;
3178+ base_got = htab->elf.sgot;
32513179 off = h->got.offset;
32523180
32533181 if (base_got == NULL)
@@ -3259,17 +3187,17 @@ elf_i386_relocate_section (bfd *output_bfd,
32593187 even just remember the offset, as finish_dynamic_symbol
32603188 would use that as offset into .got. */
32613189
3262- if (htab->splt != NULL)
3190+ if (htab->elf.splt != NULL)
32633191 {
32643192 plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
32653193 off = (plt_index + 3) * 4;
3266- base_got = htab->sgotplt;
3194+ base_got = htab->elf.sgotplt;
32673195 }
32683196 else
32693197 {
32703198 plt_index = h->plt.offset / PLT_ENTRY_SIZE;
32713199 off = plt_index * 4;
3272- base_got = htab->igotplt;
3200+ base_got = htab->elf.igotplt;
32733201 }
32743202
32753203 if (h->dynindx == -1
@@ -3298,7 +3226,7 @@ elf_i386_relocate_section (bfd *output_bfd,
32983226 relocation = off;
32993227
33003228 /* Adjust for static executables. */
3301- if (htab->splt == NULL)
3229+ if (htab->elf.splt == NULL)
33023230 relocation += gotplt->output_offset;
33033231 }
33043232 else
@@ -3308,7 +3236,7 @@ elf_i386_relocate_section (bfd *output_bfd,
33083236 - gotplt->output_section->vma
33093237 - gotplt->output_offset);
33103238 /* Adjust for static executables. */
3311- if (htab->splt == NULL)
3239+ if (htab->elf.splt == NULL)
33123240 relocation += gotplt->output_offset;
33133241 }
33143242
@@ -3326,7 +3254,7 @@ elf_i386_relocate_section (bfd *output_bfd,
33263254 case R_386_GOT32:
33273255 /* Relocation is to the entry for this symbol in the global
33283256 offset table. */
3329- if (htab->sgot == NULL)
3257+ if (htab->elf.sgot == NULL)
33303258 abort ();
33313259
33323260 if (h != NULL)
@@ -3358,7 +3286,7 @@ elf_i386_relocate_section (bfd *output_bfd,
33583286 else
33593287 {
33603288 bfd_put_32 (output_bfd, relocation,
3361- htab->sgot->contents + off);
3289+ htab->elf.sgot->contents + off);
33623290 h->got.offset |= 1;
33633291 }
33643292 }
@@ -3380,7 +3308,7 @@ elf_i386_relocate_section (bfd *output_bfd,
33803308 else
33813309 {
33823310 bfd_put_32 (output_bfd, relocation,
3383- htab->sgot->contents + off);
3311+ htab->elf.sgot->contents + off);
33843312
33853313 if (info->shared)
33863314 {
@@ -3388,12 +3316,12 @@ elf_i386_relocate_section (bfd *output_bfd,
33883316 Elf_Internal_Rela outrel;
33893317 bfd_byte *loc;
33903318
3391- s = htab->srelgot;
3319+ s = htab->elf.srelgot;
33923320 if (s == NULL)
33933321 abort ();
33943322
3395- outrel.r_offset = (htab->sgot->output_section->vma
3396- + htab->sgot->output_offset
3323+ outrel.r_offset = (htab->elf.sgot->output_section->vma
3324+ + htab->elf.sgot->output_offset
33973325 + off);
33983326 outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
33993327 loc = s->contents;
@@ -3408,10 +3336,10 @@ elf_i386_relocate_section (bfd *output_bfd,
34083336 if (off >= (bfd_vma) -2)
34093337 abort ();
34103338
3411- relocation = htab->sgot->output_section->vma
3412- + htab->sgot->output_offset + off
3413- - htab->sgotplt->output_section->vma
3414- - htab->sgotplt->output_offset;
3339+ relocation = htab->elf.sgot->output_section->vma
3340+ + htab->elf.sgot->output_offset + off
3341+ - htab->elf.sgotplt->output_section->vma
3342+ - htab->elf.sgotplt->output_offset;
34153343 break;
34163344
34173345 case R_386_GOTOFF:
@@ -3467,14 +3395,14 @@ elf_i386_relocate_section (bfd *output_bfd,
34673395 defined _GLOBAL_OFFSET_TABLE_ in a different way, as is
34683396 permitted by the ABI, we might have to change this
34693397 calculation. */
3470- relocation -= htab->sgotplt->output_section->vma
3471- + htab->sgotplt->output_offset;
3398+ relocation -= htab->elf.sgotplt->output_section->vma
3399+ + htab->elf.sgotplt->output_offset;
34723400 break;
34733401
34743402 case R_386_GOTPC:
34753403 /* Use global offset table as symbol value. */
3476- relocation = htab->sgotplt->output_section->vma
3477- + htab->sgotplt->output_offset;
3404+ relocation = htab->elf.sgotplt->output_section->vma
3405+ + htab->elf.sgotplt->output_offset;
34783406 unresolved_reloc = FALSE;
34793407 break;
34803408
@@ -3488,7 +3416,7 @@ elf_i386_relocate_section (bfd *output_bfd,
34883416 break;
34893417
34903418 if (h->plt.offset == (bfd_vma) -1
3491- || htab->splt == NULL)
3419+ || htab->elf.splt == NULL)
34923420 {
34933421 /* We didn't make a PLT entry for this symbol. This
34943422 happens when statically linking PIC code, or when
@@ -3496,8 +3424,8 @@ elf_i386_relocate_section (bfd *output_bfd,
34963424 break;
34973425 }
34983426
3499- relocation = (htab->splt->output_section->vma
3500- + htab->splt->output_offset
3427+ relocation = (htab->elf.splt->output_section->vma
3428+ + htab->elf.splt->output_offset
35013429 + h->plt.offset);
35023430 unresolved_reloc = FALSE;
35033431 break;
@@ -3800,7 +3728,7 @@ elf_i386_relocate_section (bfd *output_bfd,
38003728 }
38013729 }
38023730
3803- if (htab->sgot == NULL)
3731+ if (htab->elf.sgot == NULL)
38043732 abort ();
38053733
38063734 if (h != NULL)
@@ -3826,7 +3754,7 @@ elf_i386_relocate_section (bfd *output_bfd,
38263754 int dr_type, indx;
38273755 asection *sreloc;
38283756
3829- if (htab->srelgot == NULL)
3757+ if (htab->elf.srelgot == NULL)
38303758 abort ();
38313759
38323760 indx = h && h->dynindx != -1 ? h->dynindx : 0;
@@ -3835,12 +3763,12 @@ elf_i386_relocate_section (bfd *output_bfd,
38353763 {
38363764 outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_DESC);
38373765 BFD_ASSERT (htab->sgotplt_jump_table_size + offplt + 8
3838- <= htab->sgotplt->size);
3839- outrel.r_offset = (htab->sgotplt->output_section->vma
3840- + htab->sgotplt->output_offset
3766+ <= htab->elf.sgotplt->size);
3767+ outrel.r_offset = (htab->elf.sgotplt->output_section->vma
3768+ + htab->elf.sgotplt->output_offset
38413769 + offplt
38423770 + htab->sgotplt_jump_table_size);
3843- sreloc = htab->srelplt;
3771+ sreloc = htab->elf.srelplt;
38443772 loc = sreloc->contents;
38453773 loc += (htab->next_tls_desc_index++
38463774 * sizeof (Elf32_External_Rel));
@@ -3852,21 +3780,21 @@ elf_i386_relocate_section (bfd *output_bfd,
38523780 BFD_ASSERT (! unresolved_reloc);
38533781 bfd_put_32 (output_bfd,
38543782 relocation - elf_i386_dtpoff_base (info),
3855- htab->sgotplt->contents + offplt
3783+ htab->elf.sgotplt->contents + offplt
38563784 + htab->sgotplt_jump_table_size + 4);
38573785 }
38583786 else
38593787 {
38603788 bfd_put_32 (output_bfd, 0,
3861- htab->sgotplt->contents + offplt
3789+ htab->elf.sgotplt->contents + offplt
38623790 + htab->sgotplt_jump_table_size + 4);
38633791 }
38643792 }
38653793
3866- sreloc = htab->srelgot;
3794+ sreloc = htab->elf.srelgot;
38673795
3868- outrel.r_offset = (htab->sgot->output_section->vma
3869- + htab->sgot->output_offset + off);
3796+ outrel.r_offset = (htab->elf.sgot->output_section->vma
3797+ + htab->elf.sgot->output_offset + off);
38703798
38713799 if (GOT_TLS_GD_P (tls_type))
38723800 dr_type = R_386_TLS_DTPMOD32;
@@ -3880,14 +3808,14 @@ elf_i386_relocate_section (bfd *output_bfd,
38803808 if (dr_type == R_386_TLS_TPOFF && indx == 0)
38813809 bfd_put_32 (output_bfd,
38823810 relocation - elf_i386_dtpoff_base (info),
3883- htab->sgot->contents + off);
3811+ htab->elf.sgot->contents + off);
38843812 else if (dr_type == R_386_TLS_TPOFF32 && indx == 0)
38853813 bfd_put_32 (output_bfd,
38863814 elf_i386_dtpoff_base (info) - relocation,
3887- htab->sgot->contents + off);
3815+ htab->elf.sgot->contents + off);
38883816 else if (dr_type != R_386_TLS_DESC)
38893817 bfd_put_32 (output_bfd, 0,
3890- htab->sgot->contents + off);
3818+ htab->elf.sgot->contents + off);
38913819 outrel.r_info = ELF32_R_INFO (indx, dr_type);
38923820
38933821 loc = sreloc->contents;
@@ -3903,12 +3831,12 @@ elf_i386_relocate_section (bfd *output_bfd,
39033831 BFD_ASSERT (! unresolved_reloc);
39043832 bfd_put_32 (output_bfd,
39053833 relocation - elf_i386_dtpoff_base (info),
3906- htab->sgot->contents + off + 4);
3834+ htab->elf.sgot->contents + off + 4);
39073835 }
39083836 else
39093837 {
39103838 bfd_put_32 (output_bfd, 0,
3911- htab->sgot->contents + off + 4);
3839+ htab->elf.sgot->contents + off + 4);
39123840 outrel.r_info = ELF32_R_INFO (indx,
39133841 R_386_TLS_DTPOFF32);
39143842 outrel.r_offset += 4;
@@ -3925,7 +3853,7 @@ elf_i386_relocate_section (bfd *output_bfd,
39253853 (indx == 0
39263854 ? relocation - elf_i386_dtpoff_base (info)
39273855 : 0),
3928- htab->sgot->contents + off + 4);
3856+ htab->elf.sgot->contents + off + 4);
39293857 outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_TPOFF);
39303858 outrel.r_offset += 4;
39313859 sreloc->reloc_count++;
@@ -3951,10 +3879,10 @@ elf_i386_relocate_section (bfd *output_bfd,
39513879 }
39523880 else if (r_type == ELF32_R_TYPE (rel->r_info))
39533881 {
3954- bfd_vma g_o_t = htab->sgotplt->output_section->vma
3955- + htab->sgotplt->output_offset;
3956- relocation = htab->sgot->output_section->vma
3957- + htab->sgot->output_offset + off - g_o_t;
3882+ bfd_vma g_o_t = htab->elf.sgotplt->output_section->vma
3883+ + htab->elf.sgotplt->output_offset;
3884+ relocation = htab->elf.sgot->output_section->vma
3885+ + htab->elf.sgot->output_offset + off - g_o_t;
39583886 if ((r_type == R_386_TLS_IE || r_type == R_386_TLS_GOTIE)
39593887 && tls_type == GOT_TLS_IE_BOTH)
39603888 relocation += 4;
@@ -3996,10 +3924,10 @@ elf_i386_relocate_section (bfd *output_bfd,
39963924 if (tls_type == GOT_TLS_IE_POS)
39973925 contents[roff + 6] = 0x03;
39983926 bfd_put_32 (output_bfd,
3999- htab->sgot->output_section->vma
4000- + htab->sgot->output_offset + off
4001- - htab->sgotplt->output_section->vma
4002- - htab->sgotplt->output_offset,
3927+ htab->elf.sgot->output_section->vma
3928+ + htab->elf.sgot->output_offset + off
3929+ - htab->elf.sgotplt->output_section->vma
3930+ - htab->elf.sgotplt->output_offset,
40033931 contents + roff + 8);
40043932 /* Skip R_386_PLT32. */
40053933 rel++;
@@ -4037,10 +3965,10 @@ elf_i386_relocate_section (bfd *output_bfd,
40373965 off += 4;
40383966
40393967 bfd_put_32 (output_bfd,
4040- htab->sgot->output_section->vma
4041- + htab->sgot->output_offset + off
4042- - htab->sgotplt->output_section->vma
4043- - htab->sgotplt->output_offset,
3968+ htab->elf.sgot->output_section->vma
3969+ + htab->elf.sgot->output_offset + off
3970+ - htab->elf.sgotplt->output_section->vma
3971+ - htab->elf.sgotplt->output_offset,
40443972 contents + roff);
40453973 continue;
40463974 }
@@ -4103,7 +4031,7 @@ elf_i386_relocate_section (bfd *output_bfd,
41034031 continue;
41044032 }
41054033
4106- if (htab->sgot == NULL)
4034+ if (htab->elf.sgot == NULL)
41074035 abort ();
41084036
41094037 off = htab->tls_ldm_got.offset;
@@ -4114,26 +4042,26 @@ elf_i386_relocate_section (bfd *output_bfd,
41144042 Elf_Internal_Rela outrel;
41154043 bfd_byte *loc;
41164044
4117- if (htab->srelgot == NULL)
4045+ if (htab->elf.srelgot == NULL)
41184046 abort ();
41194047
4120- outrel.r_offset = (htab->sgot->output_section->vma
4121- + htab->sgot->output_offset + off);
4048+ outrel.r_offset = (htab->elf.sgot->output_section->vma
4049+ + htab->elf.sgot->output_offset + off);
41224050
41234051 bfd_put_32 (output_bfd, 0,
4124- htab->sgot->contents + off);
4052+ htab->elf.sgot->contents + off);
41254053 bfd_put_32 (output_bfd, 0,
4126- htab->sgot->contents + off + 4);
4054+ htab->elf.sgot->contents + off + 4);
41274055 outrel.r_info = ELF32_R_INFO (0, R_386_TLS_DTPMOD32);
4128- loc = htab->srelgot->contents;
4129- loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
4056+ loc = htab->elf.srelgot->contents;
4057+ loc += htab->elf.srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
41304058 bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
41314059 htab->tls_ldm_got.offset |= 1;
41324060 }
4133- relocation = htab->sgot->output_section->vma
4134- + htab->sgot->output_offset + off
4135- - htab->sgotplt->output_section->vma
4136- - htab->sgotplt->output_offset;
4061+ relocation = htab->elf.sgot->output_section->vma
4062+ + htab->elf.sgot->output_offset + off
4063+ - htab->elf.sgotplt->output_section->vma
4064+ - htab->elf.sgotplt->output_offset;
41374065 unresolved_reloc = FALSE;
41384066 break;
41394067
@@ -4272,17 +4200,17 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
42724200
42734201 /* When building a static executable, use .iplt, .igot.plt and
42744202 .rel.iplt sections for STT_GNU_IFUNC symbols. */
4275- if (htab->splt != NULL)
4203+ if (htab->elf.splt != NULL)
42764204 {
4277- plt = htab->splt;
4278- gotplt = htab->sgotplt;
4279- relplt = htab->srelplt;
4205+ plt = htab->elf.splt;
4206+ gotplt = htab->elf.sgotplt;
4207+ relplt = htab->elf.srelplt;
42804208 }
42814209 else
42824210 {
4283- plt = htab->iplt;
4284- gotplt = htab->igotplt;
4285- relplt = htab->irelplt;
4211+ plt = htab->elf.iplt;
4212+ gotplt = htab->elf.igotplt;
4213+ relplt = htab->elf.irelplt;
42864214 }
42874215
42884216 /* This symbol has an entry in the procedure linkage table. Set
@@ -4308,7 +4236,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
43084236
43094237 For static executables, we don't reserve anything. */
43104238
4311- if (plt == htab->splt)
4239+ if (plt == htab->elf.splt)
43124240 {
43134241 plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
43144242 got_offset = (plt_index + 3) * 4;
@@ -4350,16 +4278,16 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
43504278 loc = (htab->srelplt2->contents + reloc_index
43514279 * sizeof (Elf32_External_Rel));
43524280
4353- rel.r_offset = (htab->splt->output_section->vma
4354- + htab->splt->output_offset
4281+ rel.r_offset = (htab->elf.splt->output_section->vma
4282+ + htab->elf.splt->output_offset
43554283 + h->plt.offset + 2),
43564284 rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32);
43574285 bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
43584286
43594287 /* Create the R_386_32 relocation referencing the beginning of
43604288 the PLT for this GOT entry. */
4361- rel.r_offset = (htab->sgotplt->output_section->vma
4362- + htab->sgotplt->output_offset
4289+ rel.r_offset = (htab->elf.sgotplt->output_section->vma
4290+ + htab->elf.sgotplt->output_offset
43634291 + got_offset);
43644292 rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_386_32);
43654293 bfd_elf32_swap_reloc_out (output_bfd, &rel,
@@ -4375,7 +4303,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
43754303 }
43764304
43774305 /* Don't fill PLT entry for static executables. */
4378- if (plt == htab->splt)
4306+ if (plt == htab->elf.splt)
43794307 {
43804308 bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rel),
43814309 plt->contents + h->plt.offset + 7);
@@ -4442,11 +4370,11 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
44424370 /* This symbol has an entry in the global offset table. Set it
44434371 up. */
44444372
4445- if (htab->sgot == NULL || htab->srelgot == NULL)
4373+ if (htab->elf.sgot == NULL || htab->elf.srelgot == NULL)
44464374 abort ();
44474375
4448- rel.r_offset = (htab->sgot->output_section->vma
4449- + htab->sgot->output_offset
4376+ rel.r_offset = (htab->elf.sgot->output_section->vma
4377+ + htab->elf.sgot->output_offset
44504378 + (h->got.offset & ~(bfd_vma) 1));
44514379
44524380 /* If this is a static link, or it is a -Bsymbolic link and the
@@ -4470,11 +4398,11 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
44704398 /* For non-shared object, we can't use .got.plt, which
44714399 contains the real function addres if we need pointer
44724400 equality. We load the GOT entry with the PLT entry. */
4473- asection *plt = htab->splt ? htab->splt : htab->iplt;
4401+ asection *plt = htab->elf.splt ? htab->elf.splt : htab->elf.iplt;
44744402 bfd_put_32 (output_bfd,
44754403 (plt->output_section->vma
44764404 + plt->output_offset + h->plt.offset),
4477- htab->sgot->contents + h->got.offset);
4405+ htab->elf.sgot->contents + h->got.offset);
44784406 return TRUE;
44794407 }
44804408 }
@@ -4489,12 +4417,12 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
44894417 BFD_ASSERT((h->got.offset & 1) == 0);
44904418 do_glob_dat:
44914419 bfd_put_32 (output_bfd, (bfd_vma) 0,
4492- htab->sgot->contents + h->got.offset);
4420+ htab->elf.sgot->contents + h->got.offset);
44934421 rel.r_info = ELF32_R_INFO (h->dynindx, R_386_GLOB_DAT);
44944422 }
44954423
4496- loc = htab->srelgot->contents;
4497- loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
4424+ loc = htab->elf.srelgot->contents;
4425+ loc += htab->elf.srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
44984426 bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
44994427 }
45004428
@@ -4585,7 +4513,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
45854513 {
45864514 Elf32_External_Dyn *dyncon, *dynconend;
45874515
4588- if (sdyn == NULL || htab->sgot == NULL)
4516+ if (sdyn == NULL || htab->elf.sgot == NULL)
45894517 abort ();
45904518
45914519 dyncon = (Elf32_External_Dyn *) sdyn->contents;
@@ -4606,17 +4534,17 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
46064534 continue;
46074535
46084536 case DT_PLTGOT:
4609- s = htab->sgotplt;
4537+ s = htab->elf.sgotplt;
46104538 dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
46114539 break;
46124540
46134541 case DT_JMPREL:
4614- s = htab->srelplt;
4542+ s = htab->elf.srelplt;
46154543 dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
46164544 break;
46174545
46184546 case DT_PLTRELSZ:
4619- s = htab->srelplt;
4547+ s = htab->elf.srelplt;
46204548 dyn.d_un.d_val = s->size;
46214549 break;
46224550
@@ -4627,7 +4555,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
46274555 what Solaris does. However, UnixWare can not handle
46284556 that case. Therefore, we override the DT_RELSZ entry
46294557 here to make it not include the JMPREL relocs. */
4630- s = htab->srelplt;
4558+ s = htab->elf.srelplt;
46314559 if (s == NULL)
46324560 continue;
46334561 dyn.d_un.d_val -= s->size;
@@ -4637,7 +4565,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
46374565 /* We may not be using the standard ELF linker script.
46384566 If .rel.plt is the first .rel section, we adjust
46394567 DT_REL to not include it. */
4640- s = htab->srelplt;
4568+ s = htab->elf.srelplt;
46414569 if (s == NULL)
46424570 continue;
46434571 if (dyn.d_un.d_ptr != s->output_section->vma + s->output_offset)
@@ -4650,33 +4578,33 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
46504578 }
46514579
46524580 /* Fill in the first entry in the procedure linkage table. */
4653- if (htab->splt && htab->splt->size > 0)
4581+ if (htab->elf.splt && htab->elf.splt->size > 0)
46544582 {
46554583 if (info->shared)
46564584 {
4657- memcpy (htab->splt->contents, elf_i386_pic_plt0_entry,
4585+ memcpy (htab->elf.splt->contents, elf_i386_pic_plt0_entry,
46584586 sizeof (elf_i386_pic_plt0_entry));
4659- memset (htab->splt->contents + sizeof (elf_i386_pic_plt0_entry),
4587+ memset (htab->elf.splt->contents + sizeof (elf_i386_pic_plt0_entry),
46604588 htab->plt0_pad_byte,
46614589 PLT_ENTRY_SIZE - sizeof (elf_i386_pic_plt0_entry));
46624590 }
46634591 else
46644592 {
4665- memcpy (htab->splt->contents, elf_i386_plt0_entry,
4593+ memcpy (htab->elf.splt->contents, elf_i386_plt0_entry,
46664594 sizeof(elf_i386_plt0_entry));
4667- memset (htab->splt->contents + sizeof (elf_i386_plt0_entry),
4595+ memset (htab->elf.splt->contents + sizeof (elf_i386_plt0_entry),
46684596 htab->plt0_pad_byte,
46694597 PLT_ENTRY_SIZE - sizeof (elf_i386_plt0_entry));
46704598 bfd_put_32 (output_bfd,
4671- (htab->sgotplt->output_section->vma
4672- + htab->sgotplt->output_offset
4599+ (htab->elf.sgotplt->output_section->vma
4600+ + htab->elf.sgotplt->output_offset
46734601 + 4),
4674- htab->splt->contents + 2);
4602+ htab->elf.splt->contents + 2);
46754603 bfd_put_32 (output_bfd,
4676- (htab->sgotplt->output_section->vma
4677- + htab->sgotplt->output_offset
4604+ (htab->elf.sgotplt->output_section->vma
4605+ + htab->elf.sgotplt->output_offset
46784606 + 8),
4679- htab->splt->contents + 8);
4607+ htab->elf.splt->contents + 8);
46804608
46814609 if (htab->is_vxworks)
46824610 {
@@ -4685,15 +4613,15 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
46854613 /* Generate a relocation for _GLOBAL_OFFSET_TABLE_ + 4.
46864614 On IA32 we use REL relocations so the addend goes in
46874615 the PLT directly. */
4688- rel.r_offset = (htab->splt->output_section->vma
4689- + htab->splt->output_offset
4616+ rel.r_offset = (htab->elf.splt->output_section->vma
4617+ + htab->elf.splt->output_offset
46904618 + 2);
46914619 rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32);
46924620 bfd_elf32_swap_reloc_out (output_bfd, &rel,
46934621 htab->srelplt2->contents);
46944622 /* Generate a relocation for _GLOBAL_OFFSET_TABLE_ + 8. */
4695- rel.r_offset = (htab->splt->output_section->vma
4696- + htab->splt->output_offset
4623+ rel.r_offset = (htab->elf.splt->output_section->vma
4624+ + htab->elf.splt->output_offset
46974625 + 8);
46984626 rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32);
46994627 bfd_elf32_swap_reloc_out (output_bfd, &rel,
@@ -4704,13 +4632,13 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
47044632
47054633 /* UnixWare sets the entsize of .plt to 4, although that doesn't
47064634 really seem like the right value. */
4707- elf_section_data (htab->splt->output_section)
4635+ elf_section_data (htab->elf.splt->output_section)
47084636 ->this_hdr.sh_entsize = 4;
47094637
47104638 /* Correct the .rel.plt.unloaded relocations. */
47114639 if (htab->is_vxworks && !info->shared)
47124640 {
4713- int num_plts = (htab->splt->size / PLT_ENTRY_SIZE) - 1;
4641+ int num_plts = (htab->elf.splt->size / PLT_ENTRY_SIZE) - 1;
47144642 unsigned char *p;
47154643
47164644 p = htab->srelplt2->contents;
@@ -4736,24 +4664,24 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
47364664 }
47374665 }
47384666
4739- if (htab->sgotplt)
4667+ if (htab->elf.sgotplt)
47404668 {
47414669 /* Fill in the first three entries in the global offset table. */
4742- if (htab->sgotplt->size > 0)
4670+ if (htab->elf.sgotplt->size > 0)
47434671 {
47444672 bfd_put_32 (output_bfd,
47454673 (sdyn == NULL ? 0
47464674 : sdyn->output_section->vma + sdyn->output_offset),
4747- htab->sgotplt->contents);
4748- bfd_put_32 (output_bfd, 0, htab->sgotplt->contents + 4);
4749- bfd_put_32 (output_bfd, 0, htab->sgotplt->contents + 8);
4675+ htab->elf.sgotplt->contents);
4676+ bfd_put_32 (output_bfd, 0, htab->elf.sgotplt->contents + 4);
4677+ bfd_put_32 (output_bfd, 0, htab->elf.sgotplt->contents + 8);
47504678 }
47514679
4752- elf_section_data (htab->sgotplt->output_section)->this_hdr.sh_entsize = 4;
4680+ elf_section_data (htab->elf.sgotplt->output_section)->this_hdr.sh_entsize = 4;
47534681 }
47544682
4755- if (htab->sgot && htab->sgot->size > 0)
4756- elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize = 4;
4683+ if (htab->elf.sgot && htab->elf.sgot->size > 0)
4684+ elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 4;
47574685
47584686 /* Fill PLT and GOT entries for local STT_GNU_IFUNC symbols. */
47594687 htab_traverse (htab->loc_hash_table,
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -488,17 +488,8 @@ struct elf64_x86_64_link_hash_table
488488 struct elf_link_hash_table elf;
489489
490490 /* Short-cuts to get to dynamic linker sections. */
491- asection *sgot;
492- asection *sgotplt;
493- asection *srelgot;
494- asection *splt;
495- asection *srelplt;
496491 asection *sdynbss;
497492 asection *srelbss;
498- asection *igotplt;
499- asection *iplt;
500- asection *irelplt;
501- asection *irelifunc;
502493
503494 /* The offset into splt of the PLT entry for the TLS descriptor
504495 resolver. Special values are 0, if not necessary (or not found
@@ -534,7 +525,7 @@ struct elf64_x86_64_link_hash_table
534525 ((struct elf64_x86_64_link_hash_table *) ((p)->hash))
535526
536527 #define elf64_x86_64_compute_jump_table_size(htab) \
537- ((htab)->srelplt->reloc_count * GOT_ENTRY_SIZE)
528+ ((htab)->elf.srelplt->reloc_count * GOT_ENTRY_SIZE)
538529
539530 /* Create an entry in an x86-64 ELF linker hash table. */
540531
@@ -664,17 +655,8 @@ elf64_x86_64_link_hash_table_create (bfd *abfd)
664655 return NULL;
665656 }
666657
667- ret->sgot = NULL;
668- ret->sgotplt = NULL;
669- ret->srelgot = NULL;
670- ret->splt = NULL;
671- ret->srelplt = NULL;
672658 ret->sdynbss = NULL;
673659 ret->srelbss = NULL;
674- ret->igotplt= NULL;
675- ret->iplt = NULL;
676- ret->irelplt= NULL;
677- ret->irelifunc = NULL;
678660 ret->sym_sec.abfd = NULL;
679661 ret->tlsdesc_plt = 0;
680662 ret->tlsdesc_got = 0;
@@ -711,35 +693,6 @@ elf64_x86_64_link_hash_table_free (struct bfd_link_hash_table *hash)
711693 _bfd_generic_link_hash_table_free (hash);
712694 }
713695
714-/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
715- shortcuts to them in our hash table. */
716-
717-static bfd_boolean
718-elf64_x86_64_create_got_section (bfd *dynobj, struct bfd_link_info *info)
719-{
720- struct elf64_x86_64_link_hash_table *htab;
721-
722- if (! _bfd_elf_create_got_section (dynobj, info))
723- return FALSE;
724-
725- htab = elf64_x86_64_hash_table (info);
726- htab->sgot = bfd_get_section_by_name (dynobj, ".got");
727- htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
728- if (!htab->sgot || !htab->sgotplt)
729- abort ();
730-
731- htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",
732- (SEC_ALLOC | SEC_LOAD
733- | SEC_HAS_CONTENTS
734- | SEC_IN_MEMORY
735- | SEC_LINKER_CREATED
736- | SEC_READONLY));
737- if (htab->srelgot == NULL
738- || ! bfd_set_section_alignment (dynobj, htab->srelgot, 3))
739- return FALSE;
740- return TRUE;
741-}
742-
743696 /* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and
744697 .rela.bss sections in DYNOBJ, and set up shortcuts to them in our
745698 hash table. */
@@ -749,20 +702,15 @@ elf64_x86_64_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
749702 {
750703 struct elf64_x86_64_link_hash_table *htab;
751704
752- htab = elf64_x86_64_hash_table (info);
753- if (!htab->sgot && !elf64_x86_64_create_got_section (dynobj, info))
754- return FALSE;
755-
756705 if (!_bfd_elf_create_dynamic_sections (dynobj, info))
757706 return FALSE;
758707
759- htab->splt = bfd_get_section_by_name (dynobj, ".plt");
760- htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
708+ htab = elf64_x86_64_hash_table (info);
761709 htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
762710 if (!info->shared)
763711 htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss");
764712
765- if (!htab->splt || !htab->srelplt || !htab->sdynbss
713+ if (!htab->sdynbss
766714 || (!info->shared && !htab->srelbss))
767715 abort ();
768716
@@ -1213,31 +1161,8 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
12131161 case R_X86_64_PLT32:
12141162 case R_X86_64_GOTPCREL:
12151163 case R_X86_64_GOTPCREL64:
1216- if (htab->irelifunc == NULL && htab->iplt == NULL)
1217- {
1218- if (!_bfd_elf_create_ifunc_sections (abfd, info))
1219- return FALSE;
1220-
1221- if (info->shared)
1222- {
1223- htab->irelifunc = bfd_get_section_by_name (abfd,
1224- ".rela.ifunc");
1225- if (!htab->irelifunc)
1226- abort ();
1227- }
1228- else
1229- {
1230- htab->iplt = bfd_get_section_by_name (abfd, ".iplt");
1231- htab->irelplt = bfd_get_section_by_name (abfd,
1232- ".rela.iplt");
1233- htab->igotplt = bfd_get_section_by_name (abfd,
1234- ".igot.plt");
1235- if (!htab->iplt
1236- || !htab->irelplt
1237- || !htab->igotplt)
1238- abort ();
1239- }
1240- }
1164+ if (!_bfd_elf_create_ifunc_sections (abfd, info))
1165+ return FALSE;
12411166 break;
12421167 }
12431168
@@ -1328,9 +1253,9 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
13281253 case R_X86_64_GOTPCREL:
13291254 case R_X86_64_GOTPCREL64:
13301255 h->got.refcount += 1;
1331- if (htab->sgot == NULL
1332- && !elf64_x86_64_create_got_section (htab->elf.dynobj,
1333- info))
1256+ if (htab->elf.sgot == NULL
1257+ && !_bfd_elf_create_got_section (htab->elf.dynobj,
1258+ info))
13341259 return FALSE;
13351260 break;
13361261 }
@@ -1466,12 +1391,12 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
14661391 case R_X86_64_GOTPC32:
14671392 case R_X86_64_GOTPC64:
14681393 create_got:
1469- if (htab->sgot == NULL)
1394+ if (htab->elf.sgot == NULL)
14701395 {
14711396 if (htab->elf.dynobj == NULL)
14721397 htab->elf.dynobj = abfd;
1473- if (!elf64_x86_64_create_got_section (htab->elf.dynobj,
1474- info))
1398+ if (!_bfd_elf_create_got_section (htab->elf.dynobj,
1399+ info))
14751400 return FALSE;
14761401 }
14771402 break;
@@ -2017,11 +1942,11 @@ elf64_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
20171942
20181943 /* When building a static executable, use .iplt, .igot.plt and
20191944 .rela.iplt sections for STT_GNU_IFUNC symbols. */
2020- if (htab->splt != NULL)
1945+ if (htab->elf.splt != NULL)
20211946 {
2022- plt = htab->splt;
2023- gotplt = htab->sgotplt;
2024- relplt = htab->srelplt;
1947+ plt = htab->elf.splt;
1948+ gotplt = htab->elf.sgotplt;
1949+ relplt = htab->elf.srelplt;
20251950
20261951 /* If this is the first .plt entry, make room for the special
20271952 first entry. */
@@ -2030,9 +1955,9 @@ elf64_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
20301955 }
20311956 else
20321957 {
2033- plt = htab->iplt;
2034- gotplt = htab->igotplt;
2035- relplt = htab->irelplt;
1958+ plt = htab->elf.iplt;
1959+ gotplt = htab->elf.igotplt;
1960+ relplt = htab->elf.irelplt;
20361961 }
20371962
20381963 /* Don't update value of STT_GNU_IFUNC symbol to PLT. We need
@@ -2060,7 +1985,8 @@ elf64_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
20601985
20611986 /* Finally, allocate space. */
20621987 for (p = eh->dyn_relocs; p != NULL; p = p->next)
2063- htab->irelifunc->size += p->count * sizeof (Elf64_External_Rela);
1988+ htab->elf.irelifunc->size
1989+ += p->count * sizeof (Elf64_External_Rela);
20641990
20651991 /* For STT_GNU_IFUNC symbol, .got.plt has the real function
20661992 addres and .got has the PLT entry adddress. We will load
@@ -2081,17 +2007,17 @@ elf64_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
20812007 || (!info->shared
20822008 && !h->pointer_equality_needed)
20832009 || (info->executable && info->shared)
2084- || htab->sgot == NULL)
2010+ || htab->elf.sgot == NULL)
20852011 {
20862012 /* Use .got.plt. */
20872013 h->got.offset = (bfd_vma) -1;
20882014 }
20892015 else
20902016 {
2091- h->got.offset = htab->sgot->size;
2092- htab->sgot->size += GOT_ENTRY_SIZE;
2017+ h->got.offset = htab->elf.sgot->size;
2018+ htab->elf.sgot->size += GOT_ENTRY_SIZE;
20932019 if (info->shared)
2094- htab->srelgot->size += sizeof (Elf64_External_Rela);
2020+ htab->elf.srelgot->size += sizeof (Elf64_External_Rela);
20952021 }
20962022
20972023 return TRUE;
@@ -2111,7 +2037,7 @@ elf64_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
21112037 if (info->shared
21122038 || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
21132039 {
2114- asection *s = htab->splt;
2040+ asection *s = htab->elf.splt;
21152041
21162042 /* If this is the first .plt entry, make room for the special
21172043 first entry. */
@@ -2137,11 +2063,11 @@ elf64_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
21372063
21382064 /* We also need to make an entry in the .got.plt section, which
21392065 will be placed in the .got section by the linker script. */
2140- htab->sgotplt->size += GOT_ENTRY_SIZE;
2066+ htab->elf.sgotplt->size += GOT_ENTRY_SIZE;
21412067
21422068 /* We also need to make an entry in the .rela.plt section. */
2143- htab->srelplt->size += sizeof (Elf64_External_Rela);
2144- htab->srelplt->reloc_count++;
2069+ htab->elf.srelplt->size += sizeof (Elf64_External_Rela);
2070+ htab->elf.srelplt->reloc_count++;
21452071 }
21462072 else
21472073 {
@@ -2183,15 +2109,15 @@ elf64_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
21832109
21842110 if (GOT_TLS_GDESC_P (tls_type))
21852111 {
2186- eh->tlsdesc_got = htab->sgotplt->size
2112+ eh->tlsdesc_got = htab->elf.sgotplt->size
21872113 - elf64_x86_64_compute_jump_table_size (htab);
2188- htab->sgotplt->size += 2 * GOT_ENTRY_SIZE;
2114+ htab->elf.sgotplt->size += 2 * GOT_ENTRY_SIZE;
21892115 h->got.offset = (bfd_vma) -2;
21902116 }
21912117 if (! GOT_TLS_GDESC_P (tls_type)
21922118 || GOT_TLS_GD_P (tls_type))
21932119 {
2194- s = htab->sgot;
2120+ s = htab->elf.sgot;
21952121 h->got.offset = s->size;
21962122 s->size += GOT_ENTRY_SIZE;
21972123 if (GOT_TLS_GD_P (tls_type))
@@ -2203,18 +2129,18 @@ elf64_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
22032129 R_X86_64_GOTTPOFF needs one dynamic relocation. */
22042130 if ((GOT_TLS_GD_P (tls_type) && h->dynindx == -1)
22052131 || tls_type == GOT_TLS_IE)
2206- htab->srelgot->size += sizeof (Elf64_External_Rela);
2132+ htab->elf.srelgot->size += sizeof (Elf64_External_Rela);
22072133 else if (GOT_TLS_GD_P (tls_type))
2208- htab->srelgot->size += 2 * sizeof (Elf64_External_Rela);
2134+ htab->elf.srelgot->size += 2 * sizeof (Elf64_External_Rela);
22092135 else if (! GOT_TLS_GDESC_P (tls_type)
22102136 && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
22112137 || h->root.type != bfd_link_hash_undefweak)
22122138 && (info->shared
22132139 || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
2214- htab->srelgot->size += sizeof (Elf64_External_Rela);
2140+ htab->elf.srelgot->size += sizeof (Elf64_External_Rela);
22152141 if (GOT_TLS_GDESC_P (tls_type))
22162142 {
2217- htab->srelplt->size += sizeof (Elf64_External_Rela);
2143+ htab->elf.srelplt->size += sizeof (Elf64_External_Rela);
22182144 htab->tlsdesc_plt = (bfd_vma) -1;
22192145 }
22202146 }
@@ -2445,8 +2371,8 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
24452371 end_local_got = local_got + locsymcount;
24462372 local_tls_type = elf64_x86_64_local_got_tls_type (ibfd);
24472373 local_tlsdesc_gotent = elf64_x86_64_local_tlsdesc_gotent (ibfd);
2448- s = htab->sgot;
2449- srel = htab->srelgot;
2374+ s = htab->elf.sgot;
2375+ srel = htab->elf.srelgot;
24502376 for (; local_got < end_local_got;
24512377 ++local_got, ++local_tls_type, ++local_tlsdesc_gotent)
24522378 {
@@ -2455,9 +2381,9 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
24552381 {
24562382 if (GOT_TLS_GDESC_P (*local_tls_type))
24572383 {
2458- *local_tlsdesc_gotent = htab->sgotplt->size
2384+ *local_tlsdesc_gotent = htab->elf.sgotplt->size
24592385 - elf64_x86_64_compute_jump_table_size (htab);
2460- htab->sgotplt->size += 2 * GOT_ENTRY_SIZE;
2386+ htab->elf.sgotplt->size += 2 * GOT_ENTRY_SIZE;
24612387 *local_got = (bfd_vma) -2;
24622388 }
24632389 if (! GOT_TLS_GDESC_P (*local_tls_type)
@@ -2474,7 +2400,8 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
24742400 {
24752401 if (GOT_TLS_GDESC_P (*local_tls_type))
24762402 {
2477- htab->srelplt->size += sizeof (Elf64_External_Rela);
2403+ htab->elf.srelplt->size
2404+ += sizeof (Elf64_External_Rela);
24782405 htab->tlsdesc_plt = (bfd_vma) -1;
24792406 }
24802407 if (! GOT_TLS_GDESC_P (*local_tls_type)
@@ -2491,9 +2418,9 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
24912418 {
24922419 /* Allocate 2 got entries and 1 dynamic reloc for R_X86_64_TLSLD
24932420 relocs. */
2494- htab->tls_ld_got.offset = htab->sgot->size;
2495- htab->sgot->size += 2 * GOT_ENTRY_SIZE;
2496- htab->srelgot->size += sizeof (Elf64_External_Rela);
2421+ htab->tls_ld_got.offset = htab->elf.sgot->size;
2422+ htab->elf.sgot->size += 2 * GOT_ENTRY_SIZE;
2423+ htab->elf.srelgot->size += sizeof (Elf64_External_Rela);
24972424 }
24982425 else
24992426 htab->tls_ld_got.offset = -1;
@@ -2513,7 +2440,7 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
25132440 it's not incremented, so in order to compute the space reserved
25142441 for them, it suffices to multiply the reloc count by the jump
25152442 slot size. */
2516- if (htab->srelplt)
2443+ if (htab->elf.srelplt)
25172444 htab->sgotplt_jump_table_size
25182445 = elf64_x86_64_compute_jump_table_size (htab);
25192446
@@ -2525,14 +2452,14 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
25252452 htab->tlsdesc_plt = 0;
25262453 else
25272454 {
2528- htab->tlsdesc_got = htab->sgot->size;
2529- htab->sgot->size += GOT_ENTRY_SIZE;
2455+ htab->tlsdesc_got = htab->elf.sgot->size;
2456+ htab->elf.sgot->size += GOT_ENTRY_SIZE;
25302457 /* Reserve room for the initial entry.
25312458 FIXME: we could probably do away with it in this case. */
2532- if (htab->splt->size == 0)
2533- htab->splt->size += PLT_ENTRY_SIZE;
2534- htab->tlsdesc_plt = htab->splt->size;
2535- htab->splt->size += PLT_ENTRY_SIZE;
2459+ if (htab->elf.splt->size == 0)
2460+ htab->elf.splt->size += PLT_ENTRY_SIZE;
2461+ htab->tlsdesc_plt = htab->elf.splt->size;
2462+ htab->elf.splt->size += PLT_ENTRY_SIZE;
25362463 }
25372464 }
25382465
@@ -2544,11 +2471,11 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
25442471 if ((s->flags & SEC_LINKER_CREATED) == 0)
25452472 continue;
25462473
2547- if (s == htab->splt
2548- || s == htab->sgot
2549- || s == htab->sgotplt
2550- || s == htab->iplt
2551- || s == htab->igotplt
2474+ if (s == htab->elf.splt
2475+ || s == htab->elf.sgot
2476+ || s == htab->elf.sgotplt
2477+ || s == htab->elf.iplt
2478+ || s == htab->elf.igotplt
25522479 || s == htab->sdynbss)
25532480 {
25542481 /* Strip this section if we don't need it; see the
@@ -2556,12 +2483,12 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
25562483 }
25572484 else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
25582485 {
2559- if (s->size != 0 && s != htab->srelplt)
2486+ if (s->size != 0 && s != htab->elf.srelplt)
25602487 relocs = TRUE;
25612488
25622489 /* We use the reloc_count field as a counter if we need
25632490 to copy relocs into the output file. */
2564- if (s != htab->srelplt)
2491+ if (s != htab->elf.srelplt)
25652492 s->reloc_count = 0;
25662493 }
25672494 else
@@ -2615,7 +2542,7 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
26152542 return FALSE;
26162543 }
26172544
2618- if (htab->splt->size != 0)
2545+ if (htab->elf.splt->size != 0)
26192546 {
26202547 if (!add_dynamic_entry (DT_PLTGOT, 0)
26212548 || !add_dynamic_entry (DT_PLTRELSZ, 0)
@@ -2879,7 +2806,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
28792806 abort ();
28802807
28812808 /* STT_GNU_IFUNC symbol must go through PLT. */
2882- plt = htab->splt ? htab->splt : htab->iplt;
2809+ plt = htab->elf.splt ? htab->elf.splt : htab->elf.iplt;
28832810 relocation = (plt->output_section->vma
28842811 + plt->output_offset + h->plt.offset);
28852812
@@ -2952,7 +2879,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
29522879 outrel.r_addend = 0;
29532880 }
29542881
2955- sreloc = htab->irelifunc;
2882+ sreloc = htab->elf.irelifunc;
29562883 loc = sreloc->contents;
29572884 loc += (sreloc->reloc_count++
29582885 * sizeof (Elf64_External_Rela));
@@ -2974,7 +2901,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
29742901
29752902 case R_X86_64_GOTPCREL:
29762903 case R_X86_64_GOTPCREL64:
2977- base_got = htab->sgot;
2904+ base_got = htab->elf.sgot;
29782905 off = h->got.offset;
29792906
29802907 if (base_got == NULL)
@@ -2986,17 +2913,17 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
29862913 even just remember the offset, as finish_dynamic_symbol
29872914 would use that as offset into .got. */
29882915
2989- if (htab->splt != NULL)
2916+ if (htab->elf.splt != NULL)
29902917 {
29912918 plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
29922919 off = (plt_index + 3) * GOT_ENTRY_SIZE;
2993- base_got = htab->sgotplt;
2920+ base_got = htab->elf.sgotplt;
29942921 }
29952922 else
29962923 {
29972924 plt_index = h->plt.offset / PLT_ENTRY_SIZE;
29982925 off = plt_index * GOT_ENTRY_SIZE;
2999- base_got = htab->igotplt;
2926+ base_got = htab->elf.igotplt;
30002927 }
30012928
30022929 if (h->dynindx == -1
@@ -3032,10 +2959,10 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
30322959 && r_type != R_X86_64_GOTPCREL64)
30332960 {
30342961 asection *gotplt;
3035- if (htab->splt != NULL)
3036- gotplt = htab->sgotplt;
2962+ if (htab->elf.splt != NULL)
2963+ gotplt = htab->elf.sgotplt;
30372964 else
3038- gotplt = htab->igotplt;
2965+ gotplt = htab->elf.igotplt;
30392966 relocation -= (gotplt->output_section->vma
30402967 - gotplt->output_offset);
30412968 }
@@ -3062,9 +2989,9 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
30622989 offset, if this symbol got a PLT entry (it was global).
30632990 Additionally if it's computed from the PLT entry, then that
30642991 GOT offset is relative to .got.plt, not to .got. */
3065- base_got = htab->sgot;
2992+ base_got = htab->elf.sgot;
30662993
3067- if (htab->sgot == NULL)
2994+ if (htab->elf.sgot == NULL)
30682995 abort ();
30692996
30702997 if (h != NULL)
@@ -3082,7 +3009,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
30823009 .got. */
30833010 bfd_vma plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
30843011 off = (plt_index + 3) * GOT_ENTRY_SIZE;
3085- base_got = htab->sgotplt;
3012+ base_got = htab->elf.sgotplt;
30863013 }
30873014
30883015 dyn = htab->elf.dynamic_sections_created;
@@ -3143,7 +3070,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
31433070
31443071 /* We need to generate a R_X86_64_RELATIVE reloc
31453072 for the dynamic linker. */
3146- s = htab->srelgot;
3073+ s = htab->elf.srelgot;
31473074 if (s == NULL)
31483075 abort ();
31493076
@@ -3167,8 +3094,8 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
31673094 relocation = base_got->output_section->vma
31683095 + base_got->output_offset + off;
31693096 if (r_type != R_X86_64_GOTPCREL && r_type != R_X86_64_GOTPCREL64)
3170- relocation -= htab->sgotplt->output_section->vma
3171- - htab->sgotplt->output_offset;
3097+ relocation -= htab->elf.sgotplt->output_section->vma
3098+ - htab->elf.sgotplt->output_offset;
31723099
31733100 break;
31743101
@@ -3197,15 +3124,15 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
31973124 defined _GLOBAL_OFFSET_TABLE_ in a different way, as is
31983125 permitted by the ABI, we might have to change this
31993126 calculation. */
3200- relocation -= htab->sgotplt->output_section->vma
3201- + htab->sgotplt->output_offset;
3127+ relocation -= htab->elf.sgotplt->output_section->vma
3128+ + htab->elf.sgotplt->output_offset;
32023129 break;
32033130
32043131 case R_X86_64_GOTPC32:
32053132 case R_X86_64_GOTPC64:
32063133 /* Use global offset table as symbol value. */
3207- relocation = htab->sgotplt->output_section->vma
3208- + htab->sgotplt->output_offset;
3134+ relocation = htab->elf.sgotplt->output_section->vma
3135+ + htab->elf.sgotplt->output_offset;
32093136 unresolved_reloc = FALSE;
32103137 break;
32113138
@@ -3215,16 +3142,16 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
32153142 if (h != NULL
32163143 /* See PLT32 handling. */
32173144 && h->plt.offset != (bfd_vma) -1
3218- && htab->splt != NULL)
3145+ && htab->elf.splt != NULL)
32193146 {
3220- relocation = (htab->splt->output_section->vma
3221- + htab->splt->output_offset
3147+ relocation = (htab->elf.splt->output_section->vma
3148+ + htab->elf.splt->output_offset
32223149 + h->plt.offset);
32233150 unresolved_reloc = FALSE;
32243151 }
32253152
3226- relocation -= htab->sgotplt->output_section->vma
3227- + htab->sgotplt->output_offset;
3153+ relocation -= htab->elf.sgotplt->output_section->vma
3154+ + htab->elf.sgotplt->output_offset;
32283155 break;
32293156
32303157 case R_X86_64_PLT32:
@@ -3237,7 +3164,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
32373164 break;
32383165
32393166 if (h->plt.offset == (bfd_vma) -1
3240- || htab->splt == NULL)
3167+ || htab->elf.splt == NULL)
32413168 {
32423169 /* We didn't make a PLT entry for this symbol. This
32433170 happens when statically linking PIC code, or when
@@ -3245,8 +3172,8 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
32453172 break;
32463173 }
32473174
3248- relocation = (htab->splt->output_section->vma
3249- + htab->splt->output_offset
3175+ relocation = (htab->elf.splt->output_section->vma
3176+ + htab->elf.splt->output_offset
32503177 + h->plt.offset);
32513178 unresolved_reloc = FALSE;
32523179 break;
@@ -3578,7 +3505,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
35783505 BFD_ASSERT (FALSE);
35793506 }
35803507
3581- if (htab->sgot == NULL)
3508+ if (htab->elf.sgot == NULL)
35823509 abort ();
35833510
35843511 if (h != NULL)
@@ -3604,7 +3531,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
36043531 int dr_type, indx;
36053532 asection *sreloc;
36063533
3607- if (htab->srelgot == NULL)
3534+ if (htab->elf.srelgot == NULL)
36083535 abort ();
36093536
36103537 indx = h && h->dynindx != -1 ? h->dynindx : 0;
@@ -3613,12 +3540,12 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
36133540 {
36143541 outrel.r_info = ELF64_R_INFO (indx, R_X86_64_TLSDESC);
36153542 BFD_ASSERT (htab->sgotplt_jump_table_size + offplt
3616- + 2 * GOT_ENTRY_SIZE <= htab->sgotplt->size);
3617- outrel.r_offset = (htab->sgotplt->output_section->vma
3618- + htab->sgotplt->output_offset
3543+ + 2 * GOT_ENTRY_SIZE <= htab->elf.sgotplt->size);
3544+ outrel.r_offset = (htab->elf.sgotplt->output_section->vma
3545+ + htab->elf.sgotplt->output_offset
36193546 + offplt
36203547 + htab->sgotplt_jump_table_size);
3621- sreloc = htab->srelplt;
3548+ sreloc = htab->elf.srelplt;
36223549 loc = sreloc->contents;
36233550 loc += sreloc->reloc_count++
36243551 * sizeof (Elf64_External_Rela);
@@ -3631,10 +3558,10 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
36313558 bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
36323559 }
36333560
3634- sreloc = htab->srelgot;
3561+ sreloc = htab->elf.srelgot;
36353562
3636- outrel.r_offset = (htab->sgot->output_section->vma
3637- + htab->sgot->output_offset + off);
3563+ outrel.r_offset = (htab->elf.sgot->output_section->vma
3564+ + htab->elf.sgot->output_offset + off);
36383565
36393566 if (GOT_TLS_GD_P (tls_type))
36403567 dr_type = R_X86_64_DTPMOD64;
@@ -3643,7 +3570,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
36433570 else
36443571 dr_type = R_X86_64_TPOFF64;
36453572
3646- bfd_put_64 (output_bfd, 0, htab->sgot->contents + off);
3573+ bfd_put_64 (output_bfd, 0, htab->elf.sgot->contents + off);
36473574 outrel.r_addend = 0;
36483575 if ((dr_type == R_X86_64_TPOFF64
36493576 || dr_type == R_X86_64_TLSDESC) && indx == 0)
@@ -3663,12 +3590,12 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
36633590 BFD_ASSERT (! unresolved_reloc);
36643591 bfd_put_64 (output_bfd,
36653592 relocation - elf64_x86_64_dtpoff_base (info),
3666- htab->sgot->contents + off + GOT_ENTRY_SIZE);
3593+ htab->elf.sgot->contents + off + GOT_ENTRY_SIZE);
36673594 }
36683595 else
36693596 {
36703597 bfd_put_64 (output_bfd, 0,
3671- htab->sgot->contents + off + GOT_ENTRY_SIZE);
3598+ htab->elf.sgot->contents + off + GOT_ENTRY_SIZE);
36723599 outrel.r_info = ELF64_R_INFO (indx,
36733600 R_X86_64_DTPOFF64);
36743601 outrel.r_offset += GOT_ENTRY_SIZE;
@@ -3694,12 +3621,12 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
36943621 {
36953622 if (r_type == R_X86_64_GOTPC32_TLSDESC
36963623 || r_type == R_X86_64_TLSDESC_CALL)
3697- relocation = htab->sgotplt->output_section->vma
3698- + htab->sgotplt->output_offset
3624+ relocation = htab->elf.sgotplt->output_section->vma
3625+ + htab->elf.sgotplt->output_offset
36993626 + offplt + htab->sgotplt_jump_table_size;
37003627 else
3701- relocation = htab->sgot->output_section->vma
3702- + htab->sgot->output_offset + off;
3628+ relocation = htab->elf.sgot->output_section->vma
3629+ + htab->elf.sgot->output_offset + off;
37033630 unresolved_reloc = FALSE;
37043631 }
37053632 else
@@ -3718,8 +3645,8 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
37183645 "\x64\x48\x8b\x04\x25\0\0\0\0\x48\x03\x05\0\0\0",
37193646 16);
37203647
3721- relocation = (htab->sgot->output_section->vma
3722- + htab->sgot->output_offset + off
3648+ relocation = (htab->elf.sgot->output_section->vma
3649+ + htab->elf.sgot->output_offset + off
37233650 - roff
37243651 - input_section->output_section->vma
37253652 - input_section->output_offset
@@ -3753,8 +3680,8 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
37533680 bfd_put_8 (output_bfd, 0x8b, contents + roff - 2);
37543681
37553682 bfd_put_32 (output_bfd,
3756- htab->sgot->output_section->vma
3757- + htab->sgot->output_offset + off
3683+ htab->elf.sgot->output_section->vma
3684+ + htab->elf.sgot->output_offset + off
37583685 - rel->r_offset
37593686 - input_section->output_section->vma
37603687 - input_section->output_offset
@@ -3807,7 +3734,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
38073734 continue;
38083735 }
38093736
3810- if (htab->sgot == NULL)
3737+ if (htab->elf.sgot == NULL)
38113738 abort ();
38123739
38133740 off = htab->tls_ld_got.offset;
@@ -3818,25 +3745,25 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
38183745 Elf_Internal_Rela outrel;
38193746 bfd_byte *loc;
38203747
3821- if (htab->srelgot == NULL)
3748+ if (htab->elf.srelgot == NULL)
38223749 abort ();
38233750
3824- outrel.r_offset = (htab->sgot->output_section->vma
3825- + htab->sgot->output_offset + off);
3751+ outrel.r_offset = (htab->elf.sgot->output_section->vma
3752+ + htab->elf.sgot->output_offset + off);
38263753
38273754 bfd_put_64 (output_bfd, 0,
3828- htab->sgot->contents + off);
3755+ htab->elf.sgot->contents + off);
38293756 bfd_put_64 (output_bfd, 0,
3830- htab->sgot->contents + off + GOT_ENTRY_SIZE);
3757+ htab->elf.sgot->contents + off + GOT_ENTRY_SIZE);
38313758 outrel.r_info = ELF64_R_INFO (0, R_X86_64_DTPMOD64);
38323759 outrel.r_addend = 0;
3833- loc = htab->srelgot->contents;
3834- loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
3760+ loc = htab->elf.srelgot->contents;
3761+ loc += htab->elf.srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
38353762 bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
38363763 htab->tls_ld_got.offset |= 1;
38373764 }
3838- relocation = htab->sgot->output_section->vma
3839- + htab->sgot->output_offset + off;
3765+ relocation = htab->elf.sgot->output_section->vma
3766+ + htab->elf.sgot->output_offset + off;
38403767 unresolved_reloc = FALSE;
38413768 break;
38423769
@@ -3937,17 +3864,17 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd,
39373864
39383865 /* When building a static executable, use .iplt, .igot.plt and
39393866 .rela.iplt sections for STT_GNU_IFUNC symbols. */
3940- if (htab->splt != NULL)
3867+ if (htab->elf.splt != NULL)
39413868 {
3942- plt = htab->splt;
3943- gotplt = htab->sgotplt;
3944- relplt = htab->srelplt;
3869+ plt = htab->elf.splt;
3870+ gotplt = htab->elf.sgotplt;
3871+ relplt = htab->elf.srelplt;
39453872 }
39463873 else
39473874 {
3948- plt = htab->iplt;
3949- gotplt = htab->igotplt;
3950- relplt = htab->irelplt;
3875+ plt = htab->elf.iplt;
3876+ gotplt = htab->elf.igotplt;
3877+ relplt = htab->elf.irelplt;
39513878 }
39523879
39533880 /* This symbol has an entry in the procedure linkage table. Set
@@ -3972,7 +3899,7 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd,
39723899
39733900 For static executables, we don't reserve anything. */
39743901
3975- if (plt == htab->splt)
3902+ if (plt == htab->elf.splt)
39763903 {
39773904 plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
39783905 got_offset = (plt_index + 3) * GOT_ENTRY_SIZE;
@@ -4003,7 +3930,7 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd,
40033930 plt->contents + h->plt.offset + 2);
40043931
40053932 /* Don't fill PLT entry for static executables. */
4006- if (plt == htab->splt)
3933+ if (plt == htab->elf.splt)
40073934 {
40083935 /* Put relocation index. */
40093936 bfd_put_32 (output_bfd, plt_index,
@@ -4070,11 +3997,11 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd,
40703997
40713998 /* This symbol has an entry in the global offset table. Set it
40723999 up. */
4073- if (htab->sgot == NULL || htab->srelgot == NULL)
4000+ if (htab->elf.sgot == NULL || htab->elf.srelgot == NULL)
40744001 abort ();
40754002
4076- rela.r_offset = (htab->sgot->output_section->vma
4077- + htab->sgot->output_offset
4003+ rela.r_offset = (htab->elf.sgot->output_section->vma
4004+ + htab->elf.sgot->output_offset
40784005 + (h->got.offset &~ (bfd_vma) 1));
40794006
40804007 /* If this is a static link, or it is a -Bsymbolic link and the
@@ -4098,11 +4025,11 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd,
40984025 /* For non-shared object, we can't use .got.plt, which
40994026 contains the real function addres if we need pointer
41004027 equality. We load the GOT entry with the PLT entry. */
4101- asection *plt = htab->splt ? htab->splt : htab->iplt;
4028+ asection *plt = htab->elf.splt ? htab->elf.splt : htab->elf.iplt;
41024029 bfd_put_64 (output_bfd, (plt->output_section->vma
41034030 + plt->output_offset
41044031 + h->plt.offset),
4105- htab->sgot->contents + h->got.offset);
4032+ htab->elf.sgot->contents + h->got.offset);
41064033 return TRUE;
41074034 }
41084035 }
@@ -4122,13 +4049,13 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd,
41224049 BFD_ASSERT((h->got.offset & 1) == 0);
41234050 do_glob_dat:
41244051 bfd_put_64 (output_bfd, (bfd_vma) 0,
4125- htab->sgot->contents + h->got.offset);
4052+ htab->elf.sgot->contents + h->got.offset);
41264053 rela.r_info = ELF64_R_INFO (h->dynindx, R_X86_64_GLOB_DAT);
41274054 rela.r_addend = 0;
41284055 }
41294056
4130- loc = htab->srelgot->contents;
4131- loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
4057+ loc = htab->elf.srelgot->contents;
4058+ loc += htab->elf.srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
41324059 bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
41334060 }
41344061
@@ -4216,7 +4143,7 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf
42164143 {
42174144 Elf64_External_Dyn *dyncon, *dynconend;
42184145
4219- if (sdyn == NULL || htab->sgot == NULL)
4146+ if (sdyn == NULL || htab->elf.sgot == NULL)
42204147 abort ();
42214148
42224149 dyncon = (Elf64_External_Dyn *) sdyn->contents;
@@ -4234,16 +4161,16 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf
42344161 continue;
42354162
42364163 case DT_PLTGOT:
4237- s = htab->sgotplt;
4164+ s = htab->elf.sgotplt;
42384165 dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
42394166 break;
42404167
42414168 case DT_JMPREL:
4242- dyn.d_un.d_ptr = htab->srelplt->output_section->vma;
4169+ dyn.d_un.d_ptr = htab->elf.srelplt->output_section->vma;
42434170 break;
42444171
42454172 case DT_PLTRELSZ:
4246- s = htab->srelplt->output_section;
4173+ s = htab->elf.srelplt->output_section;
42474174 dyn.d_un.d_val = s->size;
42484175 break;
42494176
@@ -4255,21 +4182,21 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf
42554182 linker script arranges for .rela.plt to follow all
42564183 other relocation sections, we don't have to worry
42574184 about changing the DT_RELA entry. */
4258- if (htab->srelplt != NULL)
4185+ if (htab->elf.srelplt != NULL)
42594186 {
4260- s = htab->srelplt->output_section;
4187+ s = htab->elf.srelplt->output_section;
42614188 dyn.d_un.d_val -= s->size;
42624189 }
42634190 break;
42644191
42654192 case DT_TLSDESC_PLT:
4266- s = htab->splt;
4193+ s = htab->elf.splt;
42674194 dyn.d_un.d_ptr = s->output_section->vma + s->output_offset
42684195 + htab->tlsdesc_plt;
42694196 break;
42704197
42714198 case DT_TLSDESC_GOT:
4272- s = htab->sgot;
4199+ s = htab->elf.sgot;
42734200 dyn.d_un.d_ptr = s->output_section->vma + s->output_offset
42744201 + htab->tlsdesc_got;
42754202 break;
@@ -4279,95 +4206,95 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf
42794206 }
42804207
42814208 /* Fill in the special first entry in the procedure linkage table. */
4282- if (htab->splt && htab->splt->size > 0)
4209+ if (htab->elf.splt && htab->elf.splt->size > 0)
42834210 {
42844211 /* Fill in the first entry in the procedure linkage table. */
4285- memcpy (htab->splt->contents, elf64_x86_64_plt0_entry,
4212+ memcpy (htab->elf.splt->contents, elf64_x86_64_plt0_entry,
42864213 PLT_ENTRY_SIZE);
42874214 /* Add offset for pushq GOT+8(%rip), since the instruction
42884215 uses 6 bytes subtract this value. */
42894216 bfd_put_32 (output_bfd,
4290- (htab->sgotplt->output_section->vma
4291- + htab->sgotplt->output_offset
4217+ (htab->elf.sgotplt->output_section->vma
4218+ + htab->elf.sgotplt->output_offset
42924219 + 8
4293- - htab->splt->output_section->vma
4294- - htab->splt->output_offset
4220+ - htab->elf.splt->output_section->vma
4221+ - htab->elf.splt->output_offset
42954222 - 6),
4296- htab->splt->contents + 2);
4223+ htab->elf.splt->contents + 2);
42974224 /* Add offset for jmp *GOT+16(%rip). The 12 is the offset to
42984225 the end of the instruction. */
42994226 bfd_put_32 (output_bfd,
4300- (htab->sgotplt->output_section->vma
4301- + htab->sgotplt->output_offset
4227+ (htab->elf.sgotplt->output_section->vma
4228+ + htab->elf.sgotplt->output_offset
43024229 + 16
4303- - htab->splt->output_section->vma
4304- - htab->splt->output_offset
4230+ - htab->elf.splt->output_section->vma
4231+ - htab->elf.splt->output_offset
43054232 - 12),
4306- htab->splt->contents + 8);
4233+ htab->elf.splt->contents + 8);
43074234
4308- elf_section_data (htab->splt->output_section)->this_hdr.sh_entsize =
4235+ elf_section_data (htab->elf.splt->output_section)->this_hdr.sh_entsize =
43094236 PLT_ENTRY_SIZE;
43104237
43114238 if (htab->tlsdesc_plt)
43124239 {
43134240 bfd_put_64 (output_bfd, (bfd_vma) 0,
4314- htab->sgot->contents + htab->tlsdesc_got);
4241+ htab->elf.sgot->contents + htab->tlsdesc_got);
43154242
4316- memcpy (htab->splt->contents + htab->tlsdesc_plt,
4243+ memcpy (htab->elf.splt->contents + htab->tlsdesc_plt,
43174244 elf64_x86_64_plt0_entry,
43184245 PLT_ENTRY_SIZE);
43194246
43204247 /* Add offset for pushq GOT+8(%rip), since the
43214248 instruction uses 6 bytes subtract this value. */
43224249 bfd_put_32 (output_bfd,
4323- (htab->sgotplt->output_section->vma
4324- + htab->sgotplt->output_offset
4250+ (htab->elf.sgotplt->output_section->vma
4251+ + htab->elf.sgotplt->output_offset
43254252 + 8
4326- - htab->splt->output_section->vma
4327- - htab->splt->output_offset
4253+ - htab->elf.splt->output_section->vma
4254+ - htab->elf.splt->output_offset
43284255 - htab->tlsdesc_plt
43294256 - 6),
4330- htab->splt->contents + htab->tlsdesc_plt + 2);
4257+ htab->elf.splt->contents + htab->tlsdesc_plt + 2);
43314258 /* Add offset for jmp *GOT+TDG(%rip), where TGD stands for
43324259 htab->tlsdesc_got. The 12 is the offset to the end of
43334260 the instruction. */
43344261 bfd_put_32 (output_bfd,
4335- (htab->sgot->output_section->vma
4336- + htab->sgot->output_offset
4262+ (htab->elf.sgot->output_section->vma
4263+ + htab->elf.sgot->output_offset
43374264 + htab->tlsdesc_got
4338- - htab->splt->output_section->vma
4339- - htab->splt->output_offset
4265+ - htab->elf.splt->output_section->vma
4266+ - htab->elf.splt->output_offset
43404267 - htab->tlsdesc_plt
43414268 - 12),
4342- htab->splt->contents + htab->tlsdesc_plt + 8);
4269+ htab->elf.splt->contents + htab->tlsdesc_plt + 8);
43434270 }
43444271 }
43454272 }
43464273
4347- if (htab->sgotplt)
4274+ if (htab->elf.sgotplt)
43484275 {
43494276 /* Fill in the first three entries in the global offset table. */
4350- if (htab->sgotplt->size > 0)
4277+ if (htab->elf.sgotplt->size > 0)
43514278 {
43524279 /* Set the first entry in the global offset table to the address of
43534280 the dynamic section. */
43544281 if (sdyn == NULL)
4355- bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents);
4282+ bfd_put_64 (output_bfd, (bfd_vma) 0, htab->elf.sgotplt->contents);
43564283 else
43574284 bfd_put_64 (output_bfd,
43584285 sdyn->output_section->vma + sdyn->output_offset,
4359- htab->sgotplt->contents);
4286+ htab->elf.sgotplt->contents);
43604287 /* Write GOT[1] and GOT[2], needed for the dynamic linker. */
4361- bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + GOT_ENTRY_SIZE);
4362- bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + GOT_ENTRY_SIZE*2);
4288+ bfd_put_64 (output_bfd, (bfd_vma) 0, htab->elf.sgotplt->contents + GOT_ENTRY_SIZE);
4289+ bfd_put_64 (output_bfd, (bfd_vma) 0, htab->elf.sgotplt->contents + GOT_ENTRY_SIZE*2);
43634290 }
43644291
4365- elf_section_data (htab->sgotplt->output_section)->this_hdr.sh_entsize =
4292+ elf_section_data (htab->elf.sgotplt->output_section)->this_hdr.sh_entsize =
43664293 GOT_ENTRY_SIZE;
43674294 }
43684295
4369- if (htab->sgot && htab->sgot->size > 0)
4370- elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize
4296+ if (htab->elf.sgot && htab->elf.sgot->size > 0)
4297+ elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize
43714298 = GOT_ENTRY_SIZE;
43724299
43734300 /* Fill PLT and GOT entries for local STT_GNU_IFUNC symbols. */
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -101,41 +101,39 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
101101 asection *s;
102102 struct elf_link_hash_entry *h;
103103 const struct elf_backend_data *bed = get_elf_backend_data (abfd);
104- int ptralign;
104+ struct elf_link_hash_table *htab = elf_hash_table (info);
105105
106106 /* This function may be called more than once. */
107107 s = bfd_get_section_by_name (abfd, ".got");
108108 if (s != NULL && (s->flags & SEC_LINKER_CREATED) != 0)
109109 return TRUE;
110110
111- switch (bed->s->arch_size)
112- {
113- case 32:
114- ptralign = 2;
115- break;
116-
117- case 64:
118- ptralign = 3;
119- break;
120-
121- default:
122- bfd_set_error (bfd_error_bad_value);
123- return FALSE;
124- }
125-
126111 flags = bed->dynamic_sec_flags;
127112
128113 s = bfd_make_section_with_flags (abfd, ".got", flags);
129114 if (s == NULL
130- || !bfd_set_section_alignment (abfd, s, ptralign))
115+ || !bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
131116 return FALSE;
117+ htab->sgot = s;
118+
119+ s = bfd_make_section_with_flags (abfd,
120+ (bed->rela_plts_and_copies_p
121+ ? ".rela.got" : ".rel.got"),
122+ (bed->dynamic_sec_flags
123+ | SEC_READONLY));
124+ if (s == NULL
125+ || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
126+ return FALSE;
127+ htab->srelgot = s;
132128
133129 if (bed->want_got_plt)
134130 {
135131 s = bfd_make_section_with_flags (abfd, ".got.plt", flags);
136132 if (s == NULL
137- || !bfd_set_section_alignment (abfd, s, ptralign))
133+ || !bfd_set_section_alignment (abfd, s,
134+ bed->s->log_file_align))
138135 return FALSE;
136+ htab->sgotplt = s;
139137 }
140138
141139 if (bed->want_got_sym)
@@ -144,7 +142,8 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
144142 (or .got.plt) section. We don't do this in the linker script
145143 because we don't want to define the symbol if we are not creating
146144 a global offset table. */
147- h = _bfd_elf_define_linkage_sym (abfd, info, s, "_GLOBAL_OFFSET_TABLE_");
145+ h = _bfd_elf_define_linkage_sym (abfd, info, s,
146+ "_GLOBAL_OFFSET_TABLE_");
148147 elf_hash_table (info)->hgot = h;
149148 if (h == NULL)
150149 return FALSE;
@@ -303,6 +302,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
303302 struct elf_link_hash_entry *h;
304303 asection *s;
305304 const struct elf_backend_data *bed = get_elf_backend_data (abfd);
305+ struct elf_link_hash_table *htab = elf_hash_table (info);
306306
307307 /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and
308308 .rel[a].bss sections. */
@@ -323,6 +323,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
323323 if (s == NULL
324324 || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment))
325325 return FALSE;
326+ htab->splt = s;
326327
327328 /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the
328329 .plt section. */
@@ -342,6 +343,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
342343 if (s == NULL
343344 || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
344345 return FALSE;
346+ htab->srelplt = s;
345347
346348 if (! _bfd_elf_create_got_section (abfd, info))
347349 return FALSE;
@@ -12491,95 +12493,3 @@ _bfd_elf_make_dynamic_reloc_section (asection * sec,
1249112493
1249212494 return reloc_sec;
1249312495 }
12494-
12495-/* Create sections needed by STT_GNU_IFUNC symbol. */
12496-
12497-bfd_boolean
12498-_bfd_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info)
12499-{
12500- flagword flags, pltflags;
12501- int ptralign;
12502- asection *s;
12503- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
12504-
12505- flags = bed->dynamic_sec_flags;
12506- pltflags = flags;
12507- if (bed->plt_not_loaded)
12508- /* We do not clear SEC_ALLOC here because we still want the OS to
12509- allocate space for the section; it's just that there's nothing
12510- to read in from the object file. */
12511- pltflags &= ~ (SEC_CODE | SEC_LOAD | SEC_HAS_CONTENTS);
12512- else
12513- pltflags |= SEC_ALLOC | SEC_CODE | SEC_LOAD;
12514- if (bed->plt_readonly)
12515- pltflags |= SEC_READONLY;
12516-
12517- if (info->shared)
12518- {
12519- /* We need to create .rel[a].ifunc for shared objects. */
12520- const char *rel_sec = (bed->rela_plts_and_copies_p
12521- ? ".rela.ifunc" : ".rel.ifunc");
12522-
12523- /* This function should be called only once. */
12524- s = bfd_get_section_by_name (abfd, rel_sec);
12525- if (s != NULL)
12526- abort ();
12527-
12528- s = bfd_make_section_with_flags (abfd, rel_sec,
12529- flags | SEC_READONLY);
12530- if (s == NULL
12531- || ! bfd_set_section_alignment (abfd, s,
12532- bed->s->log_file_align))
12533- return FALSE;
12534- }
12535- else
12536- {
12537- /* This function should be called only once. */
12538- s = bfd_get_section_by_name (abfd, ".iplt");
12539- if (s != NULL)
12540- abort ();
12541-
12542- /* We need to create .iplt, .rel[a].iplt, .igot and .igot.plt
12543- for static executables. */
12544- s = bfd_make_section_with_flags (abfd, ".iplt", pltflags);
12545- if (s == NULL
12546- || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment))
12547- return FALSE;
12548-
12549- s = bfd_make_section_with_flags (abfd,
12550- (bed->rela_plts_and_copies_p
12551- ? ".rela.iplt" : ".rel.iplt"),
12552- flags | SEC_READONLY);
12553- if (s == NULL
12554- || ! bfd_set_section_alignment (abfd, s,
12555- bed->s->log_file_align))
12556- return FALSE;
12557-
12558- switch (bed->s->arch_size)
12559- {
12560- case 32:
12561- ptralign = 2;
12562- break;
12563-
12564- case 64:
12565- ptralign = 3;
12566- break;
12567-
12568- default:
12569- bfd_set_error (bfd_error_bad_value);
12570- return FALSE;
12571- }
12572-
12573- /* We don't need the .igot section if we have the .igot.plt
12574- section. */
12575- if (bed->want_got_plt)
12576- s = bfd_make_section_with_flags (abfd, ".igot.plt", flags);
12577- else
12578- s = bfd_make_section_with_flags (abfd, ".igot", flags);
12579- if (s == NULL
12580- || !bfd_set_section_alignment (abfd, s, ptralign))
12581- return FALSE;
12582- }
12583-
12584- return TRUE;
12585-}