GNU Binutils with patches for OS216
Révision | 6de2ae4a2a0020a827f05f30dedf8dcec7e77ee0 (tree) |
---|---|
l'heure | 2009-06-16 22:41:10 |
Auteur | H.J. Lu <hjl.tools@gmai...> |
Commiter | H.J. Lu |
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".
@@ -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 | + | |
1 | 48 | 2009-06-16 Doug Kwan <dougkwan@google.com> |
2 | 49 | |
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. | |
6 | 53 | |
7 | 54 | 2009-06-16 Maciej W. Rozycki <macro@linux-mips.org> |
8 | 55 |
@@ -250,6 +250,7 @@ BFD32_BACKENDS = \ | ||
250 | 250 | ecofflink.lo \ |
251 | 251 | elf-attrs.lo \ |
252 | 252 | elf-eh-frame.lo \ |
253 | + elf-ifunc.lo \ | |
253 | 254 | elf-m10200.lo \ |
254 | 255 | elf-m10300.lo \ |
255 | 256 | elf-strtab.lo \ |
@@ -432,6 +433,7 @@ BFD32_BACKENDS_CFILES = \ | ||
432 | 433 | ecofflink.c \ |
433 | 434 | elf-attrs.c \ |
434 | 435 | elf-eh-frame.c \ |
436 | + elf-ifunc.c \ | |
435 | 437 | elf-m10200.c \ |
436 | 438 | elf-m10300.c \ |
437 | 439 | elf-strtab.c \ |
@@ -2046,6 +2048,18 @@ elf-eh-frame.lo: \ | ||
2046 | 2048 | $(INCDIR)/filenames.h \ |
2047 | 2049 | $(INCDIR)/hashtab.h \ |
2048 | 2050 | 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 | |
2049 | 2063 | elf-m10200.lo: \ |
2050 | 2064 | elf-m10200.c \ |
2051 | 2065 | $(INCDIR)/bfdlink.h \ |
@@ -521,6 +521,7 @@ BFD32_BACKENDS = \ | ||
521 | 521 | ecofflink.lo \ |
522 | 522 | elf-attrs.lo \ |
523 | 523 | elf-eh-frame.lo \ |
524 | + elf-ifunc.lo \ | |
524 | 525 | elf-m10200.lo \ |
525 | 526 | elf-m10300.lo \ |
526 | 527 | elf-strtab.lo \ |
@@ -703,6 +704,7 @@ BFD32_BACKENDS_CFILES = \ | ||
703 | 704 | ecofflink.c \ |
704 | 705 | elf-attrs.c \ |
705 | 706 | elf-eh-frame.c \ |
707 | + elf-ifunc.c \ | |
706 | 708 | elf-m10200.c \ |
707 | 709 | elf-m10300.c \ |
708 | 710 | elf-strtab.c \ |
@@ -2647,6 +2649,18 @@ elf-eh-frame.lo: \ | ||
2647 | 2649 | $(INCDIR)/filenames.h \ |
2648 | 2650 | $(INCDIR)/hashtab.h \ |
2649 | 2651 | 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 | |
2650 | 2664 | elf-m10200.lo: \ |
2651 | 2665 | elf-m10200.c \ |
2652 | 2666 | $(INCDIR)/bfdlink.h \ |
@@ -20942,7 +20942,8 @@ selarchs="$f" | ||
20942 | 20942 | # Target backend .o files. |
20943 | 20943 | tb= |
20944 | 20944 | |
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" | |
20946 | 20947 | |
20947 | 20948 | for vec in $selvecs |
20948 | 20949 | do |
@@ -639,7 +639,8 @@ selarchs="$f" | ||
639 | 639 | # Target backend .o files. |
640 | 640 | tb= |
641 | 641 | |
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" | |
643 | 644 | |
644 | 645 | for vec in $selvecs |
645 | 646 | do |
@@ -457,6 +457,17 @@ struct elf_link_hash_table | ||
457 | 457 | |
458 | 458 | /* A linked list of BFD's loaded in the link. */ |
459 | 459 | 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; | |
460 | 471 | }; |
461 | 472 | |
462 | 473 | /* Look up an entry in an ELF linker hash table. */ |
@@ -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 | +} |
@@ -670,17 +670,8 @@ struct elf_i386_link_hash_table | ||
670 | 670 | struct elf_link_hash_table elf; |
671 | 671 | |
672 | 672 | /* Short-cuts to get to dynamic linker sections. */ |
673 | - asection *sgot; | |
674 | - asection *sgotplt; | |
675 | - asection *srelgot; | |
676 | - asection *splt; | |
677 | - asection *srelplt; | |
678 | 673 | asection *sdynbss; |
679 | 674 | asection *srelbss; |
680 | - asection *igotplt; | |
681 | - asection *iplt; | |
682 | - asection *irelplt; | |
683 | - asection *irelifunc; | |
684 | 675 | |
685 | 676 | /* The (unloaded but important) .rel.plt.unloaded section on VxWorks. */ |
686 | 677 | asection *srelplt2; |
@@ -850,17 +841,8 @@ elf_i386_link_hash_table_create (bfd *abfd) | ||
850 | 841 | return NULL; |
851 | 842 | } |
852 | 843 | |
853 | - ret->sgot = NULL; | |
854 | - ret->sgotplt = NULL; | |
855 | - ret->srelgot = NULL; | |
856 | - ret->splt = NULL; | |
857 | - ret->srelplt = NULL; | |
858 | 844 | ret->sdynbss = NULL; |
859 | 845 | ret->srelbss = NULL; |
860 | - ret->igotplt= NULL; | |
861 | - ret->iplt = NULL; | |
862 | - ret->irelplt= NULL; | |
863 | - ret->irelifunc = NULL; | |
864 | 846 | ret->tls_ldm_got.refcount = 0; |
865 | 847 | ret->next_tls_desc_index = 0; |
866 | 848 | ret->sgotplt_jump_table_size = 0; |
@@ -899,35 +881,6 @@ elf_i386_link_hash_table_free (struct bfd_link_hash_table *hash) | ||
899 | 881 | _bfd_generic_link_hash_table_free (hash); |
900 | 882 | } |
901 | 883 | |
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 | - | |
931 | 884 | /* Create .plt, .rel.plt, .got, .got.plt, .rel.got, .dynbss, and |
932 | 885 | .rel.bss sections in DYNOBJ, and set up shortcuts to them in our |
933 | 886 | hash table. */ |
@@ -937,25 +890,21 @@ elf_i386_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info) | ||
937 | 890 | { |
938 | 891 | struct elf_i386_link_hash_table *htab; |
939 | 892 | |
940 | - htab = elf_i386_hash_table (info); | |
941 | - if (!htab->sgot && !elf_i386_create_got_section (dynobj, info)) | |
942 | - return FALSE; | |
943 | - | |
944 | 893 | if (!_bfd_elf_create_dynamic_sections (dynobj, info)) |
945 | 894 | return FALSE; |
946 | 895 | |
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); | |
949 | 897 | htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss"); |
950 | 898 | if (!info->shared) |
951 | 899 | htab->srelbss = bfd_get_section_by_name (dynobj, ".rel.bss"); |
952 | 900 | |
953 | - if (!htab->splt || !htab->srelplt || !htab->sdynbss | |
901 | + if (!htab->sdynbss | |
954 | 902 | || (!info->shared && !htab->srelbss)) |
955 | 903 | abort (); |
956 | 904 | |
957 | 905 | 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)) | |
959 | 908 | return FALSE; |
960 | 909 | |
961 | 910 | return TRUE; |
@@ -1427,31 +1376,8 @@ elf_i386_check_relocs (bfd *abfd, | ||
1427 | 1376 | case R_386_PLT32: |
1428 | 1377 | case R_386_GOT32: |
1429 | 1378 | 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; | |
1455 | 1381 | break; |
1456 | 1382 | } |
1457 | 1383 |
@@ -1534,8 +1460,8 @@ elf_i386_check_relocs (bfd *abfd, | ||
1534 | 1460 | case R_386_GOT32: |
1535 | 1461 | case R_386_GOTOFF: |
1536 | 1462 | 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, | |
1539 | 1465 | info)) |
1540 | 1466 | return FALSE; |
1541 | 1467 | break; |
@@ -1678,11 +1604,11 @@ elf_i386_check_relocs (bfd *abfd, | ||
1678 | 1604 | case R_386_GOTOFF: |
1679 | 1605 | case R_386_GOTPC: |
1680 | 1606 | create_got: |
1681 | - if (htab->sgot == NULL) | |
1607 | + if (htab->elf.sgot == NULL) | |
1682 | 1608 | { |
1683 | 1609 | if (htab->elf.dynobj == NULL) |
1684 | 1610 | 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)) | |
1686 | 1612 | return FALSE; |
1687 | 1613 | } |
1688 | 1614 | if (r_type != R_386_TLS_IE) |
@@ -2175,11 +2101,11 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) | ||
2175 | 2101 | |
2176 | 2102 | /* When building a static executable, use .iplt, .igot.plt and |
2177 | 2103 | .rel.iplt sections for STT_GNU_IFUNC symbols. */ |
2178 | - if (htab->splt != NULL) | |
2104 | + if (htab->elf.splt != NULL) | |
2179 | 2105 | { |
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; | |
2183 | 2109 | |
2184 | 2110 | /* If this is the first .plt entry, make room for the special |
2185 | 2111 | first entry. */ |
@@ -2188,9 +2114,9 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) | ||
2188 | 2114 | } |
2189 | 2115 | else |
2190 | 2116 | { |
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; | |
2194 | 2120 | } |
2195 | 2121 | |
2196 | 2122 | /* 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) | ||
2218 | 2144 | |
2219 | 2145 | /* Finally, allocate space. */ |
2220 | 2146 | 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); | |
2222 | 2148 | |
2223 | 2149 | /* For STT_GNU_IFUNC symbol, .got.plt has the real function |
2224 | 2150 | 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) | ||
2239 | 2165 | || (!info->shared |
2240 | 2166 | && !h->pointer_equality_needed) |
2241 | 2167 | || (info->executable && info->shared) |
2242 | - || htab->sgot == NULL) | |
2168 | + || htab->elf.sgot == NULL) | |
2243 | 2169 | { |
2244 | 2170 | /* Use .got.plt. */ |
2245 | 2171 | h->got.offset = (bfd_vma) -1; |
2246 | 2172 | } |
2247 | 2173 | else |
2248 | 2174 | { |
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; | |
2251 | 2177 | if (info->shared) |
2252 | - htab->srelgot->size += sizeof (Elf32_External_Rel); | |
2178 | + htab->elf.srelgot->size += sizeof (Elf32_External_Rel); | |
2253 | 2179 | } |
2254 | 2180 | |
2255 | 2181 | return TRUE; |
@@ -2269,7 +2195,7 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) | ||
2269 | 2195 | if (info->shared |
2270 | 2196 | || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h)) |
2271 | 2197 | { |
2272 | - asection *s = htab->splt; | |
2198 | + asection *s = htab->elf.splt; | |
2273 | 2199 | |
2274 | 2200 | /* If this is the first .plt entry, make room for the special |
2275 | 2201 | first entry. */ |
@@ -2295,10 +2221,10 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) | ||
2295 | 2221 | |
2296 | 2222 | /* We also need to make an entry in the .got.plt section, which |
2297 | 2223 | will be placed in the .got section by the linker script. */ |
2298 | - htab->sgotplt->size += 4; | |
2224 | + htab->elf.sgotplt->size += 4; | |
2299 | 2225 | |
2300 | 2226 | /* 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); | |
2302 | 2228 | htab->next_tls_desc_index++; |
2303 | 2229 | |
2304 | 2230 | if (htab->is_vxworks && !info->shared) |
@@ -2357,12 +2283,12 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) | ||
2357 | 2283 | return FALSE; |
2358 | 2284 | } |
2359 | 2285 | |
2360 | - s = htab->sgot; | |
2286 | + s = htab->elf.sgot; | |
2361 | 2287 | if (GOT_TLS_GDESC_P (tls_type)) |
2362 | 2288 | { |
2363 | - eh->tlsdesc_got = htab->sgotplt->size | |
2289 | + eh->tlsdesc_got = htab->elf.sgotplt->size | |
2364 | 2290 | - elf_i386_compute_jump_table_size (htab); |
2365 | - htab->sgotplt->size += 8; | |
2291 | + htab->elf.sgotplt->size += 8; | |
2366 | 2292 | h->got.offset = (bfd_vma) -2; |
2367 | 2293 | } |
2368 | 2294 | if (! GOT_TLS_GDESC_P (tls_type) |
@@ -2381,20 +2307,20 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) | ||
2381 | 2307 | need two), R_386_TLS_GD needs one if local symbol and two if |
2382 | 2308 | global. */ |
2383 | 2309 | 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); | |
2385 | 2311 | else if ((GOT_TLS_GD_P (tls_type) && h->dynindx == -1) |
2386 | 2312 | || (tls_type & GOT_TLS_IE)) |
2387 | - htab->srelgot->size += sizeof (Elf32_External_Rel); | |
2313 | + htab->elf.srelgot->size += sizeof (Elf32_External_Rel); | |
2388 | 2314 | 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); | |
2390 | 2316 | else if (! GOT_TLS_GDESC_P (tls_type) |
2391 | 2317 | && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT |
2392 | 2318 | || h->root.type != bfd_link_hash_undefweak) |
2393 | 2319 | && (info->shared |
2394 | 2320 | || 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); | |
2396 | 2322 | if (GOT_TLS_GDESC_P (tls_type)) |
2397 | - htab->srelplt->size += sizeof (Elf32_External_Rel); | |
2323 | + htab->elf.srelplt->size += sizeof (Elf32_External_Rel); | |
2398 | 2324 | } |
2399 | 2325 | else |
2400 | 2326 | h->got.offset = (bfd_vma) -1; |
@@ -2644,8 +2570,8 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
2644 | 2570 | end_local_got = local_got + locsymcount; |
2645 | 2571 | local_tls_type = elf_i386_local_got_tls_type (ibfd); |
2646 | 2572 | 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; | |
2649 | 2575 | for (; local_got < end_local_got; |
2650 | 2576 | ++local_got, ++local_tls_type, ++local_tlsdesc_gotent) |
2651 | 2577 | { |
@@ -2654,9 +2580,9 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
2654 | 2580 | { |
2655 | 2581 | if (GOT_TLS_GDESC_P (*local_tls_type)) |
2656 | 2582 | { |
2657 | - *local_tlsdesc_gotent = htab->sgotplt->size | |
2583 | + *local_tlsdesc_gotent = htab->elf.sgotplt->size | |
2658 | 2584 | - elf_i386_compute_jump_table_size (htab); |
2659 | - htab->sgotplt->size += 8; | |
2585 | + htab->elf.sgotplt->size += 8; | |
2660 | 2586 | *local_got = (bfd_vma) -2; |
2661 | 2587 | } |
2662 | 2588 | if (! GOT_TLS_GDESC_P (*local_tls_type) |
@@ -2678,7 +2604,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
2678 | 2604 | || ! GOT_TLS_GDESC_P (*local_tls_type)) |
2679 | 2605 | srel->size += sizeof (Elf32_External_Rel); |
2680 | 2606 | 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); | |
2682 | 2608 | } |
2683 | 2609 | } |
2684 | 2610 | else |
@@ -2690,9 +2616,9 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
2690 | 2616 | { |
2691 | 2617 | /* Allocate 2 got entries and 1 dynamic reloc for R_386_TLS_LDM |
2692 | 2618 | 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); | |
2696 | 2622 | } |
2697 | 2623 | else |
2698 | 2624 | htab->tls_ldm_got.offset = -1; |
@@ -2711,7 +2637,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
2711 | 2637 | it's not incremented, so in order to compute the space reserved |
2712 | 2638 | for them, it suffices to multiply the reloc count by the jump |
2713 | 2639 | slot size. */ |
2714 | - if (htab->srelplt) | |
2640 | + if (htab->elf.srelplt) | |
2715 | 2641 | htab->sgotplt_jump_table_size = htab->next_tls_desc_index * 4; |
2716 | 2642 | |
2717 | 2643 | /* 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, | ||
2724 | 2650 | if ((s->flags & SEC_LINKER_CREATED) == 0) |
2725 | 2651 | continue; |
2726 | 2652 | |
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 | |
2732 | 2658 | || s == htab->sdynbss) |
2733 | 2659 | { |
2734 | 2660 | /* 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, | ||
2742 | 2668 | } |
2743 | 2669 | else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rel")) |
2744 | 2670 | { |
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) | |
2746 | 2674 | relocs = TRUE; |
2747 | 2675 | |
2748 | 2676 | /* 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, | ||
2800 | 2728 | return FALSE; |
2801 | 2729 | } |
2802 | 2730 | |
2803 | - if (htab->splt->size != 0) | |
2731 | + if (htab->elf.splt->size != 0) | |
2804 | 2732 | { |
2805 | 2733 | if (!add_dynamic_entry (DT_PLTGOT, 0) |
2806 | 2734 | || !add_dynamic_entry (DT_PLTRELSZ, 0) |
@@ -3162,15 +3090,15 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3162 | 3090 | abort (); |
3163 | 3091 | |
3164 | 3092 | /* STT_GNU_IFUNC symbol must go through PLT. */ |
3165 | - if (htab->splt != NULL) | |
3093 | + if (htab->elf.splt != NULL) | |
3166 | 3094 | { |
3167 | - plt = htab->splt; | |
3168 | - gotplt = htab->sgotplt; | |
3095 | + plt = htab->elf.splt; | |
3096 | + gotplt = htab->elf.sgotplt; | |
3169 | 3097 | } |
3170 | 3098 | else |
3171 | 3099 | { |
3172 | - plt = htab->iplt; | |
3173 | - gotplt = htab->igotplt; | |
3100 | + plt = htab->elf.iplt; | |
3101 | + gotplt = htab->elf.igotplt; | |
3174 | 3102 | } |
3175 | 3103 | |
3176 | 3104 | relocation = (plt->output_section->vma |
@@ -3228,7 +3156,7 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3228 | 3156 | else |
3229 | 3157 | outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); |
3230 | 3158 | |
3231 | - sreloc = htab->irelifunc; | |
3159 | + sreloc = htab->elf.irelifunc; | |
3232 | 3160 | loc = sreloc->contents; |
3233 | 3161 | loc += (sreloc->reloc_count++ |
3234 | 3162 | * sizeof (Elf32_External_Rel)); |
@@ -3247,7 +3175,7 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3247 | 3175 | goto do_relocation; |
3248 | 3176 | |
3249 | 3177 | case R_386_GOT32: |
3250 | - base_got = htab->sgot; | |
3178 | + base_got = htab->elf.sgot; | |
3251 | 3179 | off = h->got.offset; |
3252 | 3180 | |
3253 | 3181 | if (base_got == NULL) |
@@ -3259,17 +3187,17 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3259 | 3187 | even just remember the offset, as finish_dynamic_symbol |
3260 | 3188 | would use that as offset into .got. */ |
3261 | 3189 | |
3262 | - if (htab->splt != NULL) | |
3190 | + if (htab->elf.splt != NULL) | |
3263 | 3191 | { |
3264 | 3192 | plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; |
3265 | 3193 | off = (plt_index + 3) * 4; |
3266 | - base_got = htab->sgotplt; | |
3194 | + base_got = htab->elf.sgotplt; | |
3267 | 3195 | } |
3268 | 3196 | else |
3269 | 3197 | { |
3270 | 3198 | plt_index = h->plt.offset / PLT_ENTRY_SIZE; |
3271 | 3199 | off = plt_index * 4; |
3272 | - base_got = htab->igotplt; | |
3200 | + base_got = htab->elf.igotplt; | |
3273 | 3201 | } |
3274 | 3202 | |
3275 | 3203 | if (h->dynindx == -1 |
@@ -3298,7 +3226,7 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3298 | 3226 | relocation = off; |
3299 | 3227 | |
3300 | 3228 | /* Adjust for static executables. */ |
3301 | - if (htab->splt == NULL) | |
3229 | + if (htab->elf.splt == NULL) | |
3302 | 3230 | relocation += gotplt->output_offset; |
3303 | 3231 | } |
3304 | 3232 | else |
@@ -3308,7 +3236,7 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3308 | 3236 | - gotplt->output_section->vma |
3309 | 3237 | - gotplt->output_offset); |
3310 | 3238 | /* Adjust for static executables. */ |
3311 | - if (htab->splt == NULL) | |
3239 | + if (htab->elf.splt == NULL) | |
3312 | 3240 | relocation += gotplt->output_offset; |
3313 | 3241 | } |
3314 | 3242 |
@@ -3326,7 +3254,7 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3326 | 3254 | case R_386_GOT32: |
3327 | 3255 | /* Relocation is to the entry for this symbol in the global |
3328 | 3256 | offset table. */ |
3329 | - if (htab->sgot == NULL) | |
3257 | + if (htab->elf.sgot == NULL) | |
3330 | 3258 | abort (); |
3331 | 3259 | |
3332 | 3260 | if (h != NULL) |
@@ -3358,7 +3286,7 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3358 | 3286 | else |
3359 | 3287 | { |
3360 | 3288 | bfd_put_32 (output_bfd, relocation, |
3361 | - htab->sgot->contents + off); | |
3289 | + htab->elf.sgot->contents + off); | |
3362 | 3290 | h->got.offset |= 1; |
3363 | 3291 | } |
3364 | 3292 | } |
@@ -3380,7 +3308,7 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3380 | 3308 | else |
3381 | 3309 | { |
3382 | 3310 | bfd_put_32 (output_bfd, relocation, |
3383 | - htab->sgot->contents + off); | |
3311 | + htab->elf.sgot->contents + off); | |
3384 | 3312 | |
3385 | 3313 | if (info->shared) |
3386 | 3314 | { |
@@ -3388,12 +3316,12 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3388 | 3316 | Elf_Internal_Rela outrel; |
3389 | 3317 | bfd_byte *loc; |
3390 | 3318 | |
3391 | - s = htab->srelgot; | |
3319 | + s = htab->elf.srelgot; | |
3392 | 3320 | if (s == NULL) |
3393 | 3321 | abort (); |
3394 | 3322 | |
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 | |
3397 | 3325 | + off); |
3398 | 3326 | outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE); |
3399 | 3327 | loc = s->contents; |
@@ -3408,10 +3336,10 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3408 | 3336 | if (off >= (bfd_vma) -2) |
3409 | 3337 | abort (); |
3410 | 3338 | |
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; | |
3415 | 3343 | break; |
3416 | 3344 | |
3417 | 3345 | case R_386_GOTOFF: |
@@ -3467,14 +3395,14 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3467 | 3395 | defined _GLOBAL_OFFSET_TABLE_ in a different way, as is |
3468 | 3396 | permitted by the ABI, we might have to change this |
3469 | 3397 | 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; | |
3472 | 3400 | break; |
3473 | 3401 | |
3474 | 3402 | case R_386_GOTPC: |
3475 | 3403 | /* 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; | |
3478 | 3406 | unresolved_reloc = FALSE; |
3479 | 3407 | break; |
3480 | 3408 |
@@ -3488,7 +3416,7 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3488 | 3416 | break; |
3489 | 3417 | |
3490 | 3418 | if (h->plt.offset == (bfd_vma) -1 |
3491 | - || htab->splt == NULL) | |
3419 | + || htab->elf.splt == NULL) | |
3492 | 3420 | { |
3493 | 3421 | /* We didn't make a PLT entry for this symbol. This |
3494 | 3422 | happens when statically linking PIC code, or when |
@@ -3496,8 +3424,8 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3496 | 3424 | break; |
3497 | 3425 | } |
3498 | 3426 | |
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 | |
3501 | 3429 | + h->plt.offset); |
3502 | 3430 | unresolved_reloc = FALSE; |
3503 | 3431 | break; |
@@ -3800,7 +3728,7 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3800 | 3728 | } |
3801 | 3729 | } |
3802 | 3730 | |
3803 | - if (htab->sgot == NULL) | |
3731 | + if (htab->elf.sgot == NULL) | |
3804 | 3732 | abort (); |
3805 | 3733 | |
3806 | 3734 | if (h != NULL) |
@@ -3826,7 +3754,7 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3826 | 3754 | int dr_type, indx; |
3827 | 3755 | asection *sreloc; |
3828 | 3756 | |
3829 | - if (htab->srelgot == NULL) | |
3757 | + if (htab->elf.srelgot == NULL) | |
3830 | 3758 | abort (); |
3831 | 3759 | |
3832 | 3760 | indx = h && h->dynindx != -1 ? h->dynindx : 0; |
@@ -3835,12 +3763,12 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3835 | 3763 | { |
3836 | 3764 | outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_DESC); |
3837 | 3765 | 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 | |
3841 | 3769 | + offplt |
3842 | 3770 | + htab->sgotplt_jump_table_size); |
3843 | - sreloc = htab->srelplt; | |
3771 | + sreloc = htab->elf.srelplt; | |
3844 | 3772 | loc = sreloc->contents; |
3845 | 3773 | loc += (htab->next_tls_desc_index++ |
3846 | 3774 | * sizeof (Elf32_External_Rel)); |
@@ -3852,21 +3780,21 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3852 | 3780 | BFD_ASSERT (! unresolved_reloc); |
3853 | 3781 | bfd_put_32 (output_bfd, |
3854 | 3782 | relocation - elf_i386_dtpoff_base (info), |
3855 | - htab->sgotplt->contents + offplt | |
3783 | + htab->elf.sgotplt->contents + offplt | |
3856 | 3784 | + htab->sgotplt_jump_table_size + 4); |
3857 | 3785 | } |
3858 | 3786 | else |
3859 | 3787 | { |
3860 | 3788 | bfd_put_32 (output_bfd, 0, |
3861 | - htab->sgotplt->contents + offplt | |
3789 | + htab->elf.sgotplt->contents + offplt | |
3862 | 3790 | + htab->sgotplt_jump_table_size + 4); |
3863 | 3791 | } |
3864 | 3792 | } |
3865 | 3793 | |
3866 | - sreloc = htab->srelgot; | |
3794 | + sreloc = htab->elf.srelgot; | |
3867 | 3795 | |
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); | |
3870 | 3798 | |
3871 | 3799 | if (GOT_TLS_GD_P (tls_type)) |
3872 | 3800 | dr_type = R_386_TLS_DTPMOD32; |
@@ -3880,14 +3808,14 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3880 | 3808 | if (dr_type == R_386_TLS_TPOFF && indx == 0) |
3881 | 3809 | bfd_put_32 (output_bfd, |
3882 | 3810 | relocation - elf_i386_dtpoff_base (info), |
3883 | - htab->sgot->contents + off); | |
3811 | + htab->elf.sgot->contents + off); | |
3884 | 3812 | else if (dr_type == R_386_TLS_TPOFF32 && indx == 0) |
3885 | 3813 | bfd_put_32 (output_bfd, |
3886 | 3814 | elf_i386_dtpoff_base (info) - relocation, |
3887 | - htab->sgot->contents + off); | |
3815 | + htab->elf.sgot->contents + off); | |
3888 | 3816 | else if (dr_type != R_386_TLS_DESC) |
3889 | 3817 | bfd_put_32 (output_bfd, 0, |
3890 | - htab->sgot->contents + off); | |
3818 | + htab->elf.sgot->contents + off); | |
3891 | 3819 | outrel.r_info = ELF32_R_INFO (indx, dr_type); |
3892 | 3820 | |
3893 | 3821 | loc = sreloc->contents; |
@@ -3903,12 +3831,12 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3903 | 3831 | BFD_ASSERT (! unresolved_reloc); |
3904 | 3832 | bfd_put_32 (output_bfd, |
3905 | 3833 | relocation - elf_i386_dtpoff_base (info), |
3906 | - htab->sgot->contents + off + 4); | |
3834 | + htab->elf.sgot->contents + off + 4); | |
3907 | 3835 | } |
3908 | 3836 | else |
3909 | 3837 | { |
3910 | 3838 | bfd_put_32 (output_bfd, 0, |
3911 | - htab->sgot->contents + off + 4); | |
3839 | + htab->elf.sgot->contents + off + 4); | |
3912 | 3840 | outrel.r_info = ELF32_R_INFO (indx, |
3913 | 3841 | R_386_TLS_DTPOFF32); |
3914 | 3842 | outrel.r_offset += 4; |
@@ -3925,7 +3853,7 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3925 | 3853 | (indx == 0 |
3926 | 3854 | ? relocation - elf_i386_dtpoff_base (info) |
3927 | 3855 | : 0), |
3928 | - htab->sgot->contents + off + 4); | |
3856 | + htab->elf.sgot->contents + off + 4); | |
3929 | 3857 | outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_TPOFF); |
3930 | 3858 | outrel.r_offset += 4; |
3931 | 3859 | sreloc->reloc_count++; |
@@ -3951,10 +3879,10 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3951 | 3879 | } |
3952 | 3880 | else if (r_type == ELF32_R_TYPE (rel->r_info)) |
3953 | 3881 | { |
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; | |
3958 | 3886 | if ((r_type == R_386_TLS_IE || r_type == R_386_TLS_GOTIE) |
3959 | 3887 | && tls_type == GOT_TLS_IE_BOTH) |
3960 | 3888 | relocation += 4; |
@@ -3996,10 +3924,10 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
3996 | 3924 | if (tls_type == GOT_TLS_IE_POS) |
3997 | 3925 | contents[roff + 6] = 0x03; |
3998 | 3926 | 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, | |
4003 | 3931 | contents + roff + 8); |
4004 | 3932 | /* Skip R_386_PLT32. */ |
4005 | 3933 | rel++; |
@@ -4037,10 +3965,10 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
4037 | 3965 | off += 4; |
4038 | 3966 | |
4039 | 3967 | 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, | |
4044 | 3972 | contents + roff); |
4045 | 3973 | continue; |
4046 | 3974 | } |
@@ -4103,7 +4031,7 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
4103 | 4031 | continue; |
4104 | 4032 | } |
4105 | 4033 | |
4106 | - if (htab->sgot == NULL) | |
4034 | + if (htab->elf.sgot == NULL) | |
4107 | 4035 | abort (); |
4108 | 4036 | |
4109 | 4037 | off = htab->tls_ldm_got.offset; |
@@ -4114,26 +4042,26 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
4114 | 4042 | Elf_Internal_Rela outrel; |
4115 | 4043 | bfd_byte *loc; |
4116 | 4044 | |
4117 | - if (htab->srelgot == NULL) | |
4045 | + if (htab->elf.srelgot == NULL) | |
4118 | 4046 | abort (); |
4119 | 4047 | |
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); | |
4122 | 4050 | |
4123 | 4051 | bfd_put_32 (output_bfd, 0, |
4124 | - htab->sgot->contents + off); | |
4052 | + htab->elf.sgot->contents + off); | |
4125 | 4053 | bfd_put_32 (output_bfd, 0, |
4126 | - htab->sgot->contents + off + 4); | |
4054 | + htab->elf.sgot->contents + off + 4); | |
4127 | 4055 | 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); | |
4130 | 4058 | bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); |
4131 | 4059 | htab->tls_ldm_got.offset |= 1; |
4132 | 4060 | } |
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; | |
4137 | 4065 | unresolved_reloc = FALSE; |
4138 | 4066 | break; |
4139 | 4067 |
@@ -4272,17 +4200,17 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, | ||
4272 | 4200 | |
4273 | 4201 | /* When building a static executable, use .iplt, .igot.plt and |
4274 | 4202 | .rel.iplt sections for STT_GNU_IFUNC symbols. */ |
4275 | - if (htab->splt != NULL) | |
4203 | + if (htab->elf.splt != NULL) | |
4276 | 4204 | { |
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; | |
4280 | 4208 | } |
4281 | 4209 | else |
4282 | 4210 | { |
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; | |
4286 | 4214 | } |
4287 | 4215 | |
4288 | 4216 | /* This symbol has an entry in the procedure linkage table. Set |
@@ -4308,7 +4236,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, | ||
4308 | 4236 | |
4309 | 4237 | For static executables, we don't reserve anything. */ |
4310 | 4238 | |
4311 | - if (plt == htab->splt) | |
4239 | + if (plt == htab->elf.splt) | |
4312 | 4240 | { |
4313 | 4241 | plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; |
4314 | 4242 | got_offset = (plt_index + 3) * 4; |
@@ -4350,16 +4278,16 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, | ||
4350 | 4278 | loc = (htab->srelplt2->contents + reloc_index |
4351 | 4279 | * sizeof (Elf32_External_Rel)); |
4352 | 4280 | |
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 | |
4355 | 4283 | + h->plt.offset + 2), |
4356 | 4284 | rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32); |
4357 | 4285 | bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); |
4358 | 4286 | |
4359 | 4287 | /* Create the R_386_32 relocation referencing the beginning of |
4360 | 4288 | 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 | |
4363 | 4291 | + got_offset); |
4364 | 4292 | rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_386_32); |
4365 | 4293 | bfd_elf32_swap_reloc_out (output_bfd, &rel, |
@@ -4375,7 +4303,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, | ||
4375 | 4303 | } |
4376 | 4304 | |
4377 | 4305 | /* Don't fill PLT entry for static executables. */ |
4378 | - if (plt == htab->splt) | |
4306 | + if (plt == htab->elf.splt) | |
4379 | 4307 | { |
4380 | 4308 | bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rel), |
4381 | 4309 | plt->contents + h->plt.offset + 7); |
@@ -4442,11 +4370,11 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, | ||
4442 | 4370 | /* This symbol has an entry in the global offset table. Set it |
4443 | 4371 | up. */ |
4444 | 4372 | |
4445 | - if (htab->sgot == NULL || htab->srelgot == NULL) | |
4373 | + if (htab->elf.sgot == NULL || htab->elf.srelgot == NULL) | |
4446 | 4374 | abort (); |
4447 | 4375 | |
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 | |
4450 | 4378 | + (h->got.offset & ~(bfd_vma) 1)); |
4451 | 4379 | |
4452 | 4380 | /* 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, | ||
4470 | 4398 | /* For non-shared object, we can't use .got.plt, which |
4471 | 4399 | contains the real function addres if we need pointer |
4472 | 4400 | 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; | |
4474 | 4402 | bfd_put_32 (output_bfd, |
4475 | 4403 | (plt->output_section->vma |
4476 | 4404 | + plt->output_offset + h->plt.offset), |
4477 | - htab->sgot->contents + h->got.offset); | |
4405 | + htab->elf.sgot->contents + h->got.offset); | |
4478 | 4406 | return TRUE; |
4479 | 4407 | } |
4480 | 4408 | } |
@@ -4489,12 +4417,12 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, | ||
4489 | 4417 | BFD_ASSERT((h->got.offset & 1) == 0); |
4490 | 4418 | do_glob_dat: |
4491 | 4419 | bfd_put_32 (output_bfd, (bfd_vma) 0, |
4492 | - htab->sgot->contents + h->got.offset); | |
4420 | + htab->elf.sgot->contents + h->got.offset); | |
4493 | 4421 | rel.r_info = ELF32_R_INFO (h->dynindx, R_386_GLOB_DAT); |
4494 | 4422 | } |
4495 | 4423 | |
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); | |
4498 | 4426 | bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); |
4499 | 4427 | } |
4500 | 4428 |
@@ -4585,7 +4513,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, | ||
4585 | 4513 | { |
4586 | 4514 | Elf32_External_Dyn *dyncon, *dynconend; |
4587 | 4515 | |
4588 | - if (sdyn == NULL || htab->sgot == NULL) | |
4516 | + if (sdyn == NULL || htab->elf.sgot == NULL) | |
4589 | 4517 | abort (); |
4590 | 4518 | |
4591 | 4519 | dyncon = (Elf32_External_Dyn *) sdyn->contents; |
@@ -4606,17 +4534,17 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, | ||
4606 | 4534 | continue; |
4607 | 4535 | |
4608 | 4536 | case DT_PLTGOT: |
4609 | - s = htab->sgotplt; | |
4537 | + s = htab->elf.sgotplt; | |
4610 | 4538 | dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; |
4611 | 4539 | break; |
4612 | 4540 | |
4613 | 4541 | case DT_JMPREL: |
4614 | - s = htab->srelplt; | |
4542 | + s = htab->elf.srelplt; | |
4615 | 4543 | dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; |
4616 | 4544 | break; |
4617 | 4545 | |
4618 | 4546 | case DT_PLTRELSZ: |
4619 | - s = htab->srelplt; | |
4547 | + s = htab->elf.srelplt; | |
4620 | 4548 | dyn.d_un.d_val = s->size; |
4621 | 4549 | break; |
4622 | 4550 |
@@ -4627,7 +4555,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, | ||
4627 | 4555 | what Solaris does. However, UnixWare can not handle |
4628 | 4556 | that case. Therefore, we override the DT_RELSZ entry |
4629 | 4557 | here to make it not include the JMPREL relocs. */ |
4630 | - s = htab->srelplt; | |
4558 | + s = htab->elf.srelplt; | |
4631 | 4559 | if (s == NULL) |
4632 | 4560 | continue; |
4633 | 4561 | dyn.d_un.d_val -= s->size; |
@@ -4637,7 +4565,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, | ||
4637 | 4565 | /* We may not be using the standard ELF linker script. |
4638 | 4566 | If .rel.plt is the first .rel section, we adjust |
4639 | 4567 | DT_REL to not include it. */ |
4640 | - s = htab->srelplt; | |
4568 | + s = htab->elf.srelplt; | |
4641 | 4569 | if (s == NULL) |
4642 | 4570 | continue; |
4643 | 4571 | 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, | ||
4650 | 4578 | } |
4651 | 4579 | |
4652 | 4580 | /* 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) | |
4654 | 4582 | { |
4655 | 4583 | if (info->shared) |
4656 | 4584 | { |
4657 | - memcpy (htab->splt->contents, elf_i386_pic_plt0_entry, | |
4585 | + memcpy (htab->elf.splt->contents, elf_i386_pic_plt0_entry, | |
4658 | 4586 | 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), | |
4660 | 4588 | htab->plt0_pad_byte, |
4661 | 4589 | PLT_ENTRY_SIZE - sizeof (elf_i386_pic_plt0_entry)); |
4662 | 4590 | } |
4663 | 4591 | else |
4664 | 4592 | { |
4665 | - memcpy (htab->splt->contents, elf_i386_plt0_entry, | |
4593 | + memcpy (htab->elf.splt->contents, elf_i386_plt0_entry, | |
4666 | 4594 | 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), | |
4668 | 4596 | htab->plt0_pad_byte, |
4669 | 4597 | PLT_ENTRY_SIZE - sizeof (elf_i386_plt0_entry)); |
4670 | 4598 | 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 | |
4673 | 4601 | + 4), |
4674 | - htab->splt->contents + 2); | |
4602 | + htab->elf.splt->contents + 2); | |
4675 | 4603 | 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 | |
4678 | 4606 | + 8), |
4679 | - htab->splt->contents + 8); | |
4607 | + htab->elf.splt->contents + 8); | |
4680 | 4608 | |
4681 | 4609 | if (htab->is_vxworks) |
4682 | 4610 | { |
@@ -4685,15 +4613,15 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, | ||
4685 | 4613 | /* Generate a relocation for _GLOBAL_OFFSET_TABLE_ + 4. |
4686 | 4614 | On IA32 we use REL relocations so the addend goes in |
4687 | 4615 | 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 | |
4690 | 4618 | + 2); |
4691 | 4619 | rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32); |
4692 | 4620 | bfd_elf32_swap_reloc_out (output_bfd, &rel, |
4693 | 4621 | htab->srelplt2->contents); |
4694 | 4622 | /* 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 | |
4697 | 4625 | + 8); |
4698 | 4626 | rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32); |
4699 | 4627 | bfd_elf32_swap_reloc_out (output_bfd, &rel, |
@@ -4704,13 +4632,13 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, | ||
4704 | 4632 | |
4705 | 4633 | /* UnixWare sets the entsize of .plt to 4, although that doesn't |
4706 | 4634 | really seem like the right value. */ |
4707 | - elf_section_data (htab->splt->output_section) | |
4635 | + elf_section_data (htab->elf.splt->output_section) | |
4708 | 4636 | ->this_hdr.sh_entsize = 4; |
4709 | 4637 | |
4710 | 4638 | /* Correct the .rel.plt.unloaded relocations. */ |
4711 | 4639 | if (htab->is_vxworks && !info->shared) |
4712 | 4640 | { |
4713 | - int num_plts = (htab->splt->size / PLT_ENTRY_SIZE) - 1; | |
4641 | + int num_plts = (htab->elf.splt->size / PLT_ENTRY_SIZE) - 1; | |
4714 | 4642 | unsigned char *p; |
4715 | 4643 | |
4716 | 4644 | p = htab->srelplt2->contents; |
@@ -4736,24 +4664,24 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, | ||
4736 | 4664 | } |
4737 | 4665 | } |
4738 | 4666 | |
4739 | - if (htab->sgotplt) | |
4667 | + if (htab->elf.sgotplt) | |
4740 | 4668 | { |
4741 | 4669 | /* Fill in the first three entries in the global offset table. */ |
4742 | - if (htab->sgotplt->size > 0) | |
4670 | + if (htab->elf.sgotplt->size > 0) | |
4743 | 4671 | { |
4744 | 4672 | bfd_put_32 (output_bfd, |
4745 | 4673 | (sdyn == NULL ? 0 |
4746 | 4674 | : 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); | |
4750 | 4678 | } |
4751 | 4679 | |
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; | |
4753 | 4681 | } |
4754 | 4682 | |
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; | |
4757 | 4685 | |
4758 | 4686 | /* Fill PLT and GOT entries for local STT_GNU_IFUNC symbols. */ |
4759 | 4687 | htab_traverse (htab->loc_hash_table, |
@@ -488,17 +488,8 @@ struct elf64_x86_64_link_hash_table | ||
488 | 488 | struct elf_link_hash_table elf; |
489 | 489 | |
490 | 490 | /* Short-cuts to get to dynamic linker sections. */ |
491 | - asection *sgot; | |
492 | - asection *sgotplt; | |
493 | - asection *srelgot; | |
494 | - asection *splt; | |
495 | - asection *srelplt; | |
496 | 491 | asection *sdynbss; |
497 | 492 | asection *srelbss; |
498 | - asection *igotplt; | |
499 | - asection *iplt; | |
500 | - asection *irelplt; | |
501 | - asection *irelifunc; | |
502 | 493 | |
503 | 494 | /* The offset into splt of the PLT entry for the TLS descriptor |
504 | 495 | resolver. Special values are 0, if not necessary (or not found |
@@ -534,7 +525,7 @@ struct elf64_x86_64_link_hash_table | ||
534 | 525 | ((struct elf64_x86_64_link_hash_table *) ((p)->hash)) |
535 | 526 | |
536 | 527 | #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) | |
538 | 529 | |
539 | 530 | /* Create an entry in an x86-64 ELF linker hash table. */ |
540 | 531 |
@@ -664,17 +655,8 @@ elf64_x86_64_link_hash_table_create (bfd *abfd) | ||
664 | 655 | return NULL; |
665 | 656 | } |
666 | 657 | |
667 | - ret->sgot = NULL; | |
668 | - ret->sgotplt = NULL; | |
669 | - ret->srelgot = NULL; | |
670 | - ret->splt = NULL; | |
671 | - ret->srelplt = NULL; | |
672 | 658 | ret->sdynbss = NULL; |
673 | 659 | ret->srelbss = NULL; |
674 | - ret->igotplt= NULL; | |
675 | - ret->iplt = NULL; | |
676 | - ret->irelplt= NULL; | |
677 | - ret->irelifunc = NULL; | |
678 | 660 | ret->sym_sec.abfd = NULL; |
679 | 661 | ret->tlsdesc_plt = 0; |
680 | 662 | ret->tlsdesc_got = 0; |
@@ -711,35 +693,6 @@ elf64_x86_64_link_hash_table_free (struct bfd_link_hash_table *hash) | ||
711 | 693 | _bfd_generic_link_hash_table_free (hash); |
712 | 694 | } |
713 | 695 | |
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 | - | |
743 | 696 | /* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and |
744 | 697 | .rela.bss sections in DYNOBJ, and set up shortcuts to them in our |
745 | 698 | hash table. */ |
@@ -749,20 +702,15 @@ elf64_x86_64_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info) | ||
749 | 702 | { |
750 | 703 | struct elf64_x86_64_link_hash_table *htab; |
751 | 704 | |
752 | - htab = elf64_x86_64_hash_table (info); | |
753 | - if (!htab->sgot && !elf64_x86_64_create_got_section (dynobj, info)) | |
754 | - return FALSE; | |
755 | - | |
756 | 705 | if (!_bfd_elf_create_dynamic_sections (dynobj, info)) |
757 | 706 | return FALSE; |
758 | 707 | |
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); | |
761 | 709 | htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss"); |
762 | 710 | if (!info->shared) |
763 | 711 | htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss"); |
764 | 712 | |
765 | - if (!htab->splt || !htab->srelplt || !htab->sdynbss | |
713 | + if (!htab->sdynbss | |
766 | 714 | || (!info->shared && !htab->srelbss)) |
767 | 715 | abort (); |
768 | 716 |
@@ -1213,31 +1161,8 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, | ||
1213 | 1161 | case R_X86_64_PLT32: |
1214 | 1162 | case R_X86_64_GOTPCREL: |
1215 | 1163 | 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; | |
1241 | 1166 | break; |
1242 | 1167 | } |
1243 | 1168 |
@@ -1328,9 +1253,9 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, | ||
1328 | 1253 | case R_X86_64_GOTPCREL: |
1329 | 1254 | case R_X86_64_GOTPCREL64: |
1330 | 1255 | 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)) | |
1334 | 1259 | return FALSE; |
1335 | 1260 | break; |
1336 | 1261 | } |
@@ -1466,12 +1391,12 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, | ||
1466 | 1391 | case R_X86_64_GOTPC32: |
1467 | 1392 | case R_X86_64_GOTPC64: |
1468 | 1393 | create_got: |
1469 | - if (htab->sgot == NULL) | |
1394 | + if (htab->elf.sgot == NULL) | |
1470 | 1395 | { |
1471 | 1396 | if (htab->elf.dynobj == NULL) |
1472 | 1397 | 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)) | |
1475 | 1400 | return FALSE; |
1476 | 1401 | } |
1477 | 1402 | break; |
@@ -2017,11 +1942,11 @@ elf64_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) | ||
2017 | 1942 | |
2018 | 1943 | /* When building a static executable, use .iplt, .igot.plt and |
2019 | 1944 | .rela.iplt sections for STT_GNU_IFUNC symbols. */ |
2020 | - if (htab->splt != NULL) | |
1945 | + if (htab->elf.splt != NULL) | |
2021 | 1946 | { |
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; | |
2025 | 1950 | |
2026 | 1951 | /* If this is the first .plt entry, make room for the special |
2027 | 1952 | first entry. */ |
@@ -2030,9 +1955,9 @@ elf64_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) | ||
2030 | 1955 | } |
2031 | 1956 | else |
2032 | 1957 | { |
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; | |
2036 | 1961 | } |
2037 | 1962 | |
2038 | 1963 | /* 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) | ||
2060 | 1985 | |
2061 | 1986 | /* Finally, allocate space. */ |
2062 | 1987 | 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); | |
2064 | 1990 | |
2065 | 1991 | /* For STT_GNU_IFUNC symbol, .got.plt has the real function |
2066 | 1992 | 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) | ||
2081 | 2007 | || (!info->shared |
2082 | 2008 | && !h->pointer_equality_needed) |
2083 | 2009 | || (info->executable && info->shared) |
2084 | - || htab->sgot == NULL) | |
2010 | + || htab->elf.sgot == NULL) | |
2085 | 2011 | { |
2086 | 2012 | /* Use .got.plt. */ |
2087 | 2013 | h->got.offset = (bfd_vma) -1; |
2088 | 2014 | } |
2089 | 2015 | else |
2090 | 2016 | { |
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; | |
2093 | 2019 | if (info->shared) |
2094 | - htab->srelgot->size += sizeof (Elf64_External_Rela); | |
2020 | + htab->elf.srelgot->size += sizeof (Elf64_External_Rela); | |
2095 | 2021 | } |
2096 | 2022 | |
2097 | 2023 | return TRUE; |
@@ -2111,7 +2037,7 @@ elf64_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) | ||
2111 | 2037 | if (info->shared |
2112 | 2038 | || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h)) |
2113 | 2039 | { |
2114 | - asection *s = htab->splt; | |
2040 | + asection *s = htab->elf.splt; | |
2115 | 2041 | |
2116 | 2042 | /* If this is the first .plt entry, make room for the special |
2117 | 2043 | first entry. */ |
@@ -2137,11 +2063,11 @@ elf64_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) | ||
2137 | 2063 | |
2138 | 2064 | /* We also need to make an entry in the .got.plt section, which |
2139 | 2065 | 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; | |
2141 | 2067 | |
2142 | 2068 | /* 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++; | |
2145 | 2071 | } |
2146 | 2072 | else |
2147 | 2073 | { |
@@ -2183,15 +2109,15 @@ elf64_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) | ||
2183 | 2109 | |
2184 | 2110 | if (GOT_TLS_GDESC_P (tls_type)) |
2185 | 2111 | { |
2186 | - eh->tlsdesc_got = htab->sgotplt->size | |
2112 | + eh->tlsdesc_got = htab->elf.sgotplt->size | |
2187 | 2113 | - 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; | |
2189 | 2115 | h->got.offset = (bfd_vma) -2; |
2190 | 2116 | } |
2191 | 2117 | if (! GOT_TLS_GDESC_P (tls_type) |
2192 | 2118 | || GOT_TLS_GD_P (tls_type)) |
2193 | 2119 | { |
2194 | - s = htab->sgot; | |
2120 | + s = htab->elf.sgot; | |
2195 | 2121 | h->got.offset = s->size; |
2196 | 2122 | s->size += GOT_ENTRY_SIZE; |
2197 | 2123 | if (GOT_TLS_GD_P (tls_type)) |
@@ -2203,18 +2129,18 @@ elf64_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) | ||
2203 | 2129 | R_X86_64_GOTTPOFF needs one dynamic relocation. */ |
2204 | 2130 | if ((GOT_TLS_GD_P (tls_type) && h->dynindx == -1) |
2205 | 2131 | || tls_type == GOT_TLS_IE) |
2206 | - htab->srelgot->size += sizeof (Elf64_External_Rela); | |
2132 | + htab->elf.srelgot->size += sizeof (Elf64_External_Rela); | |
2207 | 2133 | 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); | |
2209 | 2135 | else if (! GOT_TLS_GDESC_P (tls_type) |
2210 | 2136 | && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT |
2211 | 2137 | || h->root.type != bfd_link_hash_undefweak) |
2212 | 2138 | && (info->shared |
2213 | 2139 | || 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); | |
2215 | 2141 | if (GOT_TLS_GDESC_P (tls_type)) |
2216 | 2142 | { |
2217 | - htab->srelplt->size += sizeof (Elf64_External_Rela); | |
2143 | + htab->elf.srelplt->size += sizeof (Elf64_External_Rela); | |
2218 | 2144 | htab->tlsdesc_plt = (bfd_vma) -1; |
2219 | 2145 | } |
2220 | 2146 | } |
@@ -2445,8 +2371,8 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
2445 | 2371 | end_local_got = local_got + locsymcount; |
2446 | 2372 | local_tls_type = elf64_x86_64_local_got_tls_type (ibfd); |
2447 | 2373 | 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; | |
2450 | 2376 | for (; local_got < end_local_got; |
2451 | 2377 | ++local_got, ++local_tls_type, ++local_tlsdesc_gotent) |
2452 | 2378 | { |
@@ -2455,9 +2381,9 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
2455 | 2381 | { |
2456 | 2382 | if (GOT_TLS_GDESC_P (*local_tls_type)) |
2457 | 2383 | { |
2458 | - *local_tlsdesc_gotent = htab->sgotplt->size | |
2384 | + *local_tlsdesc_gotent = htab->elf.sgotplt->size | |
2459 | 2385 | - 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; | |
2461 | 2387 | *local_got = (bfd_vma) -2; |
2462 | 2388 | } |
2463 | 2389 | if (! GOT_TLS_GDESC_P (*local_tls_type) |
@@ -2474,7 +2400,8 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
2474 | 2400 | { |
2475 | 2401 | if (GOT_TLS_GDESC_P (*local_tls_type)) |
2476 | 2402 | { |
2477 | - htab->srelplt->size += sizeof (Elf64_External_Rela); | |
2403 | + htab->elf.srelplt->size | |
2404 | + += sizeof (Elf64_External_Rela); | |
2478 | 2405 | htab->tlsdesc_plt = (bfd_vma) -1; |
2479 | 2406 | } |
2480 | 2407 | if (! GOT_TLS_GDESC_P (*local_tls_type) |
@@ -2491,9 +2418,9 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
2491 | 2418 | { |
2492 | 2419 | /* Allocate 2 got entries and 1 dynamic reloc for R_X86_64_TLSLD |
2493 | 2420 | 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); | |
2497 | 2424 | } |
2498 | 2425 | else |
2499 | 2426 | htab->tls_ld_got.offset = -1; |
@@ -2513,7 +2440,7 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
2513 | 2440 | it's not incremented, so in order to compute the space reserved |
2514 | 2441 | for them, it suffices to multiply the reloc count by the jump |
2515 | 2442 | slot size. */ |
2516 | - if (htab->srelplt) | |
2443 | + if (htab->elf.srelplt) | |
2517 | 2444 | htab->sgotplt_jump_table_size |
2518 | 2445 | = elf64_x86_64_compute_jump_table_size (htab); |
2519 | 2446 |
@@ -2525,14 +2452,14 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
2525 | 2452 | htab->tlsdesc_plt = 0; |
2526 | 2453 | else |
2527 | 2454 | { |
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; | |
2530 | 2457 | /* Reserve room for the initial entry. |
2531 | 2458 | 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; | |
2536 | 2463 | } |
2537 | 2464 | } |
2538 | 2465 |
@@ -2544,11 +2471,11 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
2544 | 2471 | if ((s->flags & SEC_LINKER_CREATED) == 0) |
2545 | 2472 | continue; |
2546 | 2473 | |
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 | |
2552 | 2479 | || s == htab->sdynbss) |
2553 | 2480 | { |
2554 | 2481 | /* 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, | ||
2556 | 2483 | } |
2557 | 2484 | else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela")) |
2558 | 2485 | { |
2559 | - if (s->size != 0 && s != htab->srelplt) | |
2486 | + if (s->size != 0 && s != htab->elf.srelplt) | |
2560 | 2487 | relocs = TRUE; |
2561 | 2488 | |
2562 | 2489 | /* We use the reloc_count field as a counter if we need |
2563 | 2490 | to copy relocs into the output file. */ |
2564 | - if (s != htab->srelplt) | |
2491 | + if (s != htab->elf.srelplt) | |
2565 | 2492 | s->reloc_count = 0; |
2566 | 2493 | } |
2567 | 2494 | else |
@@ -2615,7 +2542,7 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
2615 | 2542 | return FALSE; |
2616 | 2543 | } |
2617 | 2544 | |
2618 | - if (htab->splt->size != 0) | |
2545 | + if (htab->elf.splt->size != 0) | |
2619 | 2546 | { |
2620 | 2547 | if (!add_dynamic_entry (DT_PLTGOT, 0) |
2621 | 2548 | || !add_dynamic_entry (DT_PLTRELSZ, 0) |
@@ -2879,7 +2806,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
2879 | 2806 | abort (); |
2880 | 2807 | |
2881 | 2808 | /* 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; | |
2883 | 2810 | relocation = (plt->output_section->vma |
2884 | 2811 | + plt->output_offset + h->plt.offset); |
2885 | 2812 |
@@ -2952,7 +2879,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
2952 | 2879 | outrel.r_addend = 0; |
2953 | 2880 | } |
2954 | 2881 | |
2955 | - sreloc = htab->irelifunc; | |
2882 | + sreloc = htab->elf.irelifunc; | |
2956 | 2883 | loc = sreloc->contents; |
2957 | 2884 | loc += (sreloc->reloc_count++ |
2958 | 2885 | * sizeof (Elf64_External_Rela)); |
@@ -2974,7 +2901,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
2974 | 2901 | |
2975 | 2902 | case R_X86_64_GOTPCREL: |
2976 | 2903 | case R_X86_64_GOTPCREL64: |
2977 | - base_got = htab->sgot; | |
2904 | + base_got = htab->elf.sgot; | |
2978 | 2905 | off = h->got.offset; |
2979 | 2906 | |
2980 | 2907 | if (base_got == NULL) |
@@ -2986,17 +2913,17 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
2986 | 2913 | even just remember the offset, as finish_dynamic_symbol |
2987 | 2914 | would use that as offset into .got. */ |
2988 | 2915 | |
2989 | - if (htab->splt != NULL) | |
2916 | + if (htab->elf.splt != NULL) | |
2990 | 2917 | { |
2991 | 2918 | plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; |
2992 | 2919 | off = (plt_index + 3) * GOT_ENTRY_SIZE; |
2993 | - base_got = htab->sgotplt; | |
2920 | + base_got = htab->elf.sgotplt; | |
2994 | 2921 | } |
2995 | 2922 | else |
2996 | 2923 | { |
2997 | 2924 | plt_index = h->plt.offset / PLT_ENTRY_SIZE; |
2998 | 2925 | off = plt_index * GOT_ENTRY_SIZE; |
2999 | - base_got = htab->igotplt; | |
2926 | + base_got = htab->elf.igotplt; | |
3000 | 2927 | } |
3001 | 2928 | |
3002 | 2929 | if (h->dynindx == -1 |
@@ -3032,10 +2959,10 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3032 | 2959 | && r_type != R_X86_64_GOTPCREL64) |
3033 | 2960 | { |
3034 | 2961 | asection *gotplt; |
3035 | - if (htab->splt != NULL) | |
3036 | - gotplt = htab->sgotplt; | |
2962 | + if (htab->elf.splt != NULL) | |
2963 | + gotplt = htab->elf.sgotplt; | |
3037 | 2964 | else |
3038 | - gotplt = htab->igotplt; | |
2965 | + gotplt = htab->elf.igotplt; | |
3039 | 2966 | relocation -= (gotplt->output_section->vma |
3040 | 2967 | - gotplt->output_offset); |
3041 | 2968 | } |
@@ -3062,9 +2989,9 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3062 | 2989 | offset, if this symbol got a PLT entry (it was global). |
3063 | 2990 | Additionally if it's computed from the PLT entry, then that |
3064 | 2991 | GOT offset is relative to .got.plt, not to .got. */ |
3065 | - base_got = htab->sgot; | |
2992 | + base_got = htab->elf.sgot; | |
3066 | 2993 | |
3067 | - if (htab->sgot == NULL) | |
2994 | + if (htab->elf.sgot == NULL) | |
3068 | 2995 | abort (); |
3069 | 2996 | |
3070 | 2997 | if (h != NULL) |
@@ -3082,7 +3009,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3082 | 3009 | .got. */ |
3083 | 3010 | bfd_vma plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; |
3084 | 3011 | off = (plt_index + 3) * GOT_ENTRY_SIZE; |
3085 | - base_got = htab->sgotplt; | |
3012 | + base_got = htab->elf.sgotplt; | |
3086 | 3013 | } |
3087 | 3014 | |
3088 | 3015 | dyn = htab->elf.dynamic_sections_created; |
@@ -3143,7 +3070,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3143 | 3070 | |
3144 | 3071 | /* We need to generate a R_X86_64_RELATIVE reloc |
3145 | 3072 | for the dynamic linker. */ |
3146 | - s = htab->srelgot; | |
3073 | + s = htab->elf.srelgot; | |
3147 | 3074 | if (s == NULL) |
3148 | 3075 | abort (); |
3149 | 3076 |
@@ -3167,8 +3094,8 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3167 | 3094 | relocation = base_got->output_section->vma |
3168 | 3095 | + base_got->output_offset + off; |
3169 | 3096 | 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; | |
3172 | 3099 | |
3173 | 3100 | break; |
3174 | 3101 |
@@ -3197,15 +3124,15 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3197 | 3124 | defined _GLOBAL_OFFSET_TABLE_ in a different way, as is |
3198 | 3125 | permitted by the ABI, we might have to change this |
3199 | 3126 | 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; | |
3202 | 3129 | break; |
3203 | 3130 | |
3204 | 3131 | case R_X86_64_GOTPC32: |
3205 | 3132 | case R_X86_64_GOTPC64: |
3206 | 3133 | /* 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; | |
3209 | 3136 | unresolved_reloc = FALSE; |
3210 | 3137 | break; |
3211 | 3138 |
@@ -3215,16 +3142,16 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3215 | 3142 | if (h != NULL |
3216 | 3143 | /* See PLT32 handling. */ |
3217 | 3144 | && h->plt.offset != (bfd_vma) -1 |
3218 | - && htab->splt != NULL) | |
3145 | + && htab->elf.splt != NULL) | |
3219 | 3146 | { |
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 | |
3222 | 3149 | + h->plt.offset); |
3223 | 3150 | unresolved_reloc = FALSE; |
3224 | 3151 | } |
3225 | 3152 | |
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; | |
3228 | 3155 | break; |
3229 | 3156 | |
3230 | 3157 | case R_X86_64_PLT32: |
@@ -3237,7 +3164,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3237 | 3164 | break; |
3238 | 3165 | |
3239 | 3166 | if (h->plt.offset == (bfd_vma) -1 |
3240 | - || htab->splt == NULL) | |
3167 | + || htab->elf.splt == NULL) | |
3241 | 3168 | { |
3242 | 3169 | /* We didn't make a PLT entry for this symbol. This |
3243 | 3170 | 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, | ||
3245 | 3172 | break; |
3246 | 3173 | } |
3247 | 3174 | |
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 | |
3250 | 3177 | + h->plt.offset); |
3251 | 3178 | unresolved_reloc = FALSE; |
3252 | 3179 | break; |
@@ -3578,7 +3505,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3578 | 3505 | BFD_ASSERT (FALSE); |
3579 | 3506 | } |
3580 | 3507 | |
3581 | - if (htab->sgot == NULL) | |
3508 | + if (htab->elf.sgot == NULL) | |
3582 | 3509 | abort (); |
3583 | 3510 | |
3584 | 3511 | if (h != NULL) |
@@ -3604,7 +3531,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3604 | 3531 | int dr_type, indx; |
3605 | 3532 | asection *sreloc; |
3606 | 3533 | |
3607 | - if (htab->srelgot == NULL) | |
3534 | + if (htab->elf.srelgot == NULL) | |
3608 | 3535 | abort (); |
3609 | 3536 | |
3610 | 3537 | 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, | ||
3613 | 3540 | { |
3614 | 3541 | outrel.r_info = ELF64_R_INFO (indx, R_X86_64_TLSDESC); |
3615 | 3542 | 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 | |
3619 | 3546 | + offplt |
3620 | 3547 | + htab->sgotplt_jump_table_size); |
3621 | - sreloc = htab->srelplt; | |
3548 | + sreloc = htab->elf.srelplt; | |
3622 | 3549 | loc = sreloc->contents; |
3623 | 3550 | loc += sreloc->reloc_count++ |
3624 | 3551 | * sizeof (Elf64_External_Rela); |
@@ -3631,10 +3558,10 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3631 | 3558 | bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); |
3632 | 3559 | } |
3633 | 3560 | |
3634 | - sreloc = htab->srelgot; | |
3561 | + sreloc = htab->elf.srelgot; | |
3635 | 3562 | |
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); | |
3638 | 3565 | |
3639 | 3566 | if (GOT_TLS_GD_P (tls_type)) |
3640 | 3567 | dr_type = R_X86_64_DTPMOD64; |
@@ -3643,7 +3570,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3643 | 3570 | else |
3644 | 3571 | dr_type = R_X86_64_TPOFF64; |
3645 | 3572 | |
3646 | - bfd_put_64 (output_bfd, 0, htab->sgot->contents + off); | |
3573 | + bfd_put_64 (output_bfd, 0, htab->elf.sgot->contents + off); | |
3647 | 3574 | outrel.r_addend = 0; |
3648 | 3575 | if ((dr_type == R_X86_64_TPOFF64 |
3649 | 3576 | || 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, | ||
3663 | 3590 | BFD_ASSERT (! unresolved_reloc); |
3664 | 3591 | bfd_put_64 (output_bfd, |
3665 | 3592 | relocation - elf64_x86_64_dtpoff_base (info), |
3666 | - htab->sgot->contents + off + GOT_ENTRY_SIZE); | |
3593 | + htab->elf.sgot->contents + off + GOT_ENTRY_SIZE); | |
3667 | 3594 | } |
3668 | 3595 | else |
3669 | 3596 | { |
3670 | 3597 | bfd_put_64 (output_bfd, 0, |
3671 | - htab->sgot->contents + off + GOT_ENTRY_SIZE); | |
3598 | + htab->elf.sgot->contents + off + GOT_ENTRY_SIZE); | |
3672 | 3599 | outrel.r_info = ELF64_R_INFO (indx, |
3673 | 3600 | R_X86_64_DTPOFF64); |
3674 | 3601 | outrel.r_offset += GOT_ENTRY_SIZE; |
@@ -3694,12 +3621,12 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3694 | 3621 | { |
3695 | 3622 | if (r_type == R_X86_64_GOTPC32_TLSDESC |
3696 | 3623 | || 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 | |
3699 | 3626 | + offplt + htab->sgotplt_jump_table_size; |
3700 | 3627 | 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; | |
3703 | 3630 | unresolved_reloc = FALSE; |
3704 | 3631 | } |
3705 | 3632 | else |
@@ -3718,8 +3645,8 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3718 | 3645 | "\x64\x48\x8b\x04\x25\0\0\0\0\x48\x03\x05\0\0\0", |
3719 | 3646 | 16); |
3720 | 3647 | |
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 | |
3723 | 3650 | - roff |
3724 | 3651 | - input_section->output_section->vma |
3725 | 3652 | - input_section->output_offset |
@@ -3753,8 +3680,8 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3753 | 3680 | bfd_put_8 (output_bfd, 0x8b, contents + roff - 2); |
3754 | 3681 | |
3755 | 3682 | 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 | |
3758 | 3685 | - rel->r_offset |
3759 | 3686 | - input_section->output_section->vma |
3760 | 3687 | - input_section->output_offset |
@@ -3807,7 +3734,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3807 | 3734 | continue; |
3808 | 3735 | } |
3809 | 3736 | |
3810 | - if (htab->sgot == NULL) | |
3737 | + if (htab->elf.sgot == NULL) | |
3811 | 3738 | abort (); |
3812 | 3739 | |
3813 | 3740 | off = htab->tls_ld_got.offset; |
@@ -3818,25 +3745,25 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
3818 | 3745 | Elf_Internal_Rela outrel; |
3819 | 3746 | bfd_byte *loc; |
3820 | 3747 | |
3821 | - if (htab->srelgot == NULL) | |
3748 | + if (htab->elf.srelgot == NULL) | |
3822 | 3749 | abort (); |
3823 | 3750 | |
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); | |
3826 | 3753 | |
3827 | 3754 | bfd_put_64 (output_bfd, 0, |
3828 | - htab->sgot->contents + off); | |
3755 | + htab->elf.sgot->contents + off); | |
3829 | 3756 | bfd_put_64 (output_bfd, 0, |
3830 | - htab->sgot->contents + off + GOT_ENTRY_SIZE); | |
3757 | + htab->elf.sgot->contents + off + GOT_ENTRY_SIZE); | |
3831 | 3758 | outrel.r_info = ELF64_R_INFO (0, R_X86_64_DTPMOD64); |
3832 | 3759 | 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); | |
3835 | 3762 | bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); |
3836 | 3763 | htab->tls_ld_got.offset |= 1; |
3837 | 3764 | } |
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; | |
3840 | 3767 | unresolved_reloc = FALSE; |
3841 | 3768 | break; |
3842 | 3769 |
@@ -3937,17 +3864,17 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd, | ||
3937 | 3864 | |
3938 | 3865 | /* When building a static executable, use .iplt, .igot.plt and |
3939 | 3866 | .rela.iplt sections for STT_GNU_IFUNC symbols. */ |
3940 | - if (htab->splt != NULL) | |
3867 | + if (htab->elf.splt != NULL) | |
3941 | 3868 | { |
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; | |
3945 | 3872 | } |
3946 | 3873 | else |
3947 | 3874 | { |
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; | |
3951 | 3878 | } |
3952 | 3879 | |
3953 | 3880 | /* This symbol has an entry in the procedure linkage table. Set |
@@ -3972,7 +3899,7 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd, | ||
3972 | 3899 | |
3973 | 3900 | For static executables, we don't reserve anything. */ |
3974 | 3901 | |
3975 | - if (plt == htab->splt) | |
3902 | + if (plt == htab->elf.splt) | |
3976 | 3903 | { |
3977 | 3904 | plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; |
3978 | 3905 | got_offset = (plt_index + 3) * GOT_ENTRY_SIZE; |
@@ -4003,7 +3930,7 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd, | ||
4003 | 3930 | plt->contents + h->plt.offset + 2); |
4004 | 3931 | |
4005 | 3932 | /* Don't fill PLT entry for static executables. */ |
4006 | - if (plt == htab->splt) | |
3933 | + if (plt == htab->elf.splt) | |
4007 | 3934 | { |
4008 | 3935 | /* Put relocation index. */ |
4009 | 3936 | bfd_put_32 (output_bfd, plt_index, |
@@ -4070,11 +3997,11 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd, | ||
4070 | 3997 | |
4071 | 3998 | /* This symbol has an entry in the global offset table. Set it |
4072 | 3999 | up. */ |
4073 | - if (htab->sgot == NULL || htab->srelgot == NULL) | |
4000 | + if (htab->elf.sgot == NULL || htab->elf.srelgot == NULL) | |
4074 | 4001 | abort (); |
4075 | 4002 | |
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 | |
4078 | 4005 | + (h->got.offset &~ (bfd_vma) 1)); |
4079 | 4006 | |
4080 | 4007 | /* 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, | ||
4098 | 4025 | /* For non-shared object, we can't use .got.plt, which |
4099 | 4026 | contains the real function addres if we need pointer |
4100 | 4027 | 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; | |
4102 | 4029 | bfd_put_64 (output_bfd, (plt->output_section->vma |
4103 | 4030 | + plt->output_offset |
4104 | 4031 | + h->plt.offset), |
4105 | - htab->sgot->contents + h->got.offset); | |
4032 | + htab->elf.sgot->contents + h->got.offset); | |
4106 | 4033 | return TRUE; |
4107 | 4034 | } |
4108 | 4035 | } |
@@ -4122,13 +4049,13 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd, | ||
4122 | 4049 | BFD_ASSERT((h->got.offset & 1) == 0); |
4123 | 4050 | do_glob_dat: |
4124 | 4051 | bfd_put_64 (output_bfd, (bfd_vma) 0, |
4125 | - htab->sgot->contents + h->got.offset); | |
4052 | + htab->elf.sgot->contents + h->got.offset); | |
4126 | 4053 | rela.r_info = ELF64_R_INFO (h->dynindx, R_X86_64_GLOB_DAT); |
4127 | 4054 | rela.r_addend = 0; |
4128 | 4055 | } |
4129 | 4056 | |
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); | |
4132 | 4059 | bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); |
4133 | 4060 | } |
4134 | 4061 |
@@ -4216,7 +4143,7 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf | ||
4216 | 4143 | { |
4217 | 4144 | Elf64_External_Dyn *dyncon, *dynconend; |
4218 | 4145 | |
4219 | - if (sdyn == NULL || htab->sgot == NULL) | |
4146 | + if (sdyn == NULL || htab->elf.sgot == NULL) | |
4220 | 4147 | abort (); |
4221 | 4148 | |
4222 | 4149 | dyncon = (Elf64_External_Dyn *) sdyn->contents; |
@@ -4234,16 +4161,16 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf | ||
4234 | 4161 | continue; |
4235 | 4162 | |
4236 | 4163 | case DT_PLTGOT: |
4237 | - s = htab->sgotplt; | |
4164 | + s = htab->elf.sgotplt; | |
4238 | 4165 | dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; |
4239 | 4166 | break; |
4240 | 4167 | |
4241 | 4168 | 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; | |
4243 | 4170 | break; |
4244 | 4171 | |
4245 | 4172 | case DT_PLTRELSZ: |
4246 | - s = htab->srelplt->output_section; | |
4173 | + s = htab->elf.srelplt->output_section; | |
4247 | 4174 | dyn.d_un.d_val = s->size; |
4248 | 4175 | break; |
4249 | 4176 |
@@ -4255,21 +4182,21 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf | ||
4255 | 4182 | linker script arranges for .rela.plt to follow all |
4256 | 4183 | other relocation sections, we don't have to worry |
4257 | 4184 | about changing the DT_RELA entry. */ |
4258 | - if (htab->srelplt != NULL) | |
4185 | + if (htab->elf.srelplt != NULL) | |
4259 | 4186 | { |
4260 | - s = htab->srelplt->output_section; | |
4187 | + s = htab->elf.srelplt->output_section; | |
4261 | 4188 | dyn.d_un.d_val -= s->size; |
4262 | 4189 | } |
4263 | 4190 | break; |
4264 | 4191 | |
4265 | 4192 | case DT_TLSDESC_PLT: |
4266 | - s = htab->splt; | |
4193 | + s = htab->elf.splt; | |
4267 | 4194 | dyn.d_un.d_ptr = s->output_section->vma + s->output_offset |
4268 | 4195 | + htab->tlsdesc_plt; |
4269 | 4196 | break; |
4270 | 4197 | |
4271 | 4198 | case DT_TLSDESC_GOT: |
4272 | - s = htab->sgot; | |
4199 | + s = htab->elf.sgot; | |
4273 | 4200 | dyn.d_un.d_ptr = s->output_section->vma + s->output_offset |
4274 | 4201 | + htab->tlsdesc_got; |
4275 | 4202 | break; |
@@ -4279,95 +4206,95 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf | ||
4279 | 4206 | } |
4280 | 4207 | |
4281 | 4208 | /* 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) | |
4283 | 4210 | { |
4284 | 4211 | /* 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, | |
4286 | 4213 | PLT_ENTRY_SIZE); |
4287 | 4214 | /* Add offset for pushq GOT+8(%rip), since the instruction |
4288 | 4215 | uses 6 bytes subtract this value. */ |
4289 | 4216 | 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 | |
4292 | 4219 | + 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 | |
4295 | 4222 | - 6), |
4296 | - htab->splt->contents + 2); | |
4223 | + htab->elf.splt->contents + 2); | |
4297 | 4224 | /* Add offset for jmp *GOT+16(%rip). The 12 is the offset to |
4298 | 4225 | the end of the instruction. */ |
4299 | 4226 | 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 | |
4302 | 4229 | + 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 | |
4305 | 4232 | - 12), |
4306 | - htab->splt->contents + 8); | |
4233 | + htab->elf.splt->contents + 8); | |
4307 | 4234 | |
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 = | |
4309 | 4236 | PLT_ENTRY_SIZE; |
4310 | 4237 | |
4311 | 4238 | if (htab->tlsdesc_plt) |
4312 | 4239 | { |
4313 | 4240 | bfd_put_64 (output_bfd, (bfd_vma) 0, |
4314 | - htab->sgot->contents + htab->tlsdesc_got); | |
4241 | + htab->elf.sgot->contents + htab->tlsdesc_got); | |
4315 | 4242 | |
4316 | - memcpy (htab->splt->contents + htab->tlsdesc_plt, | |
4243 | + memcpy (htab->elf.splt->contents + htab->tlsdesc_plt, | |
4317 | 4244 | elf64_x86_64_plt0_entry, |
4318 | 4245 | PLT_ENTRY_SIZE); |
4319 | 4246 | |
4320 | 4247 | /* Add offset for pushq GOT+8(%rip), since the |
4321 | 4248 | instruction uses 6 bytes subtract this value. */ |
4322 | 4249 | 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 | |
4325 | 4252 | + 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 | |
4328 | 4255 | - htab->tlsdesc_plt |
4329 | 4256 | - 6), |
4330 | - htab->splt->contents + htab->tlsdesc_plt + 2); | |
4257 | + htab->elf.splt->contents + htab->tlsdesc_plt + 2); | |
4331 | 4258 | /* Add offset for jmp *GOT+TDG(%rip), where TGD stands for |
4332 | 4259 | htab->tlsdesc_got. The 12 is the offset to the end of |
4333 | 4260 | the instruction. */ |
4334 | 4261 | 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 | |
4337 | 4264 | + 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 | |
4340 | 4267 | - htab->tlsdesc_plt |
4341 | 4268 | - 12), |
4342 | - htab->splt->contents + htab->tlsdesc_plt + 8); | |
4269 | + htab->elf.splt->contents + htab->tlsdesc_plt + 8); | |
4343 | 4270 | } |
4344 | 4271 | } |
4345 | 4272 | } |
4346 | 4273 | |
4347 | - if (htab->sgotplt) | |
4274 | + if (htab->elf.sgotplt) | |
4348 | 4275 | { |
4349 | 4276 | /* Fill in the first three entries in the global offset table. */ |
4350 | - if (htab->sgotplt->size > 0) | |
4277 | + if (htab->elf.sgotplt->size > 0) | |
4351 | 4278 | { |
4352 | 4279 | /* Set the first entry in the global offset table to the address of |
4353 | 4280 | the dynamic section. */ |
4354 | 4281 | 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); | |
4356 | 4283 | else |
4357 | 4284 | bfd_put_64 (output_bfd, |
4358 | 4285 | sdyn->output_section->vma + sdyn->output_offset, |
4359 | - htab->sgotplt->contents); | |
4286 | + htab->elf.sgotplt->contents); | |
4360 | 4287 | /* 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); | |
4363 | 4290 | } |
4364 | 4291 | |
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 = | |
4366 | 4293 | GOT_ENTRY_SIZE; |
4367 | 4294 | } |
4368 | 4295 | |
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 | |
4371 | 4298 | = GOT_ENTRY_SIZE; |
4372 | 4299 | |
4373 | 4300 | /* Fill PLT and GOT entries for local STT_GNU_IFUNC symbols. */ |
@@ -101,41 +101,39 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) | ||
101 | 101 | asection *s; |
102 | 102 | struct elf_link_hash_entry *h; |
103 | 103 | 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); | |
105 | 105 | |
106 | 106 | /* This function may be called more than once. */ |
107 | 107 | s = bfd_get_section_by_name (abfd, ".got"); |
108 | 108 | if (s != NULL && (s->flags & SEC_LINKER_CREATED) != 0) |
109 | 109 | return TRUE; |
110 | 110 | |
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 | - | |
126 | 111 | flags = bed->dynamic_sec_flags; |
127 | 112 | |
128 | 113 | s = bfd_make_section_with_flags (abfd, ".got", flags); |
129 | 114 | if (s == NULL |
130 | - || !bfd_set_section_alignment (abfd, s, ptralign)) | |
115 | + || !bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) | |
131 | 116 | 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; | |
132 | 128 | |
133 | 129 | if (bed->want_got_plt) |
134 | 130 | { |
135 | 131 | s = bfd_make_section_with_flags (abfd, ".got.plt", flags); |
136 | 132 | if (s == NULL |
137 | - || !bfd_set_section_alignment (abfd, s, ptralign)) | |
133 | + || !bfd_set_section_alignment (abfd, s, | |
134 | + bed->s->log_file_align)) | |
138 | 135 | return FALSE; |
136 | + htab->sgotplt = s; | |
139 | 137 | } |
140 | 138 | |
141 | 139 | if (bed->want_got_sym) |
@@ -144,7 +142,8 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) | ||
144 | 142 | (or .got.plt) section. We don't do this in the linker script |
145 | 143 | because we don't want to define the symbol if we are not creating |
146 | 144 | 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_"); | |
148 | 147 | elf_hash_table (info)->hgot = h; |
149 | 148 | if (h == NULL) |
150 | 149 | return FALSE; |
@@ -303,6 +302,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) | ||
303 | 302 | struct elf_link_hash_entry *h; |
304 | 303 | asection *s; |
305 | 304 | const struct elf_backend_data *bed = get_elf_backend_data (abfd); |
305 | + struct elf_link_hash_table *htab = elf_hash_table (info); | |
306 | 306 | |
307 | 307 | /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and |
308 | 308 | .rel[a].bss sections. */ |
@@ -323,6 +323,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) | ||
323 | 323 | if (s == NULL |
324 | 324 | || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) |
325 | 325 | return FALSE; |
326 | + htab->splt = s; | |
326 | 327 | |
327 | 328 | /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the |
328 | 329 | .plt section. */ |
@@ -342,6 +343,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) | ||
342 | 343 | if (s == NULL |
343 | 344 | || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) |
344 | 345 | return FALSE; |
346 | + htab->srelplt = s; | |
345 | 347 | |
346 | 348 | if (! _bfd_elf_create_got_section (abfd, info)) |
347 | 349 | return FALSE; |
@@ -12491,95 +12493,3 @@ _bfd_elf_make_dynamic_reloc_section (asection * sec, | ||
12491 | 12493 | |
12492 | 12494 | return reloc_sec; |
12493 | 12495 | } |
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 | -} |