• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

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

GNU Binutils with patches for OS216


Commit MetaInfo

Revision33e44f2eb27d78f57ed83d11f04652691d896a6f (tree)
Time2013-11-05 10:56:28
AuthorAlan Modra <amodra@gmai...>
CommiterAlan Modra

Log Message

Update elf64-ppc.c to use elf_link_hash_table shortcuts.

These shortcuts to dynamic sections in ppc_link_hash_table predated
their geneneric elf hash table equivalents.

* elf64-ppc.c (struct ppc_link_hash_table): Remove got, plt, relplt,
iplt, reliplt. Update all references to use elf.sgot, elf.splt,
elf.srelplt, elf.iplt and elf.irelplt.

Change Summary

Incremental Difference

--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,6 +1,11 @@
1+2013-11-05 Alan Modra <amodra@gmail.com>
2+
3+ * elf64-ppc.c (struct ppc_link_hash_table): Remove got, plt, relplt,
4+ iplt, reliplt. Update all references to use elf.sgot, elf.splt,
5+ elf.srelplt, elf.iplt and elf.irelplt.
6+
17 2013-11-03 Sandra Loosemore <sandra@codesourcery.com>
28
3- bfd/
49 * elf32-niso2.c (nios2_elf32_do_hi16_relocate): Remove incorrect
510 ATTRIBUTE_UNUSED from parameter.
611 (nios2_elf_do_lo16_relocate): Likewise.
@@ -1433,7 +1438,7 @@
14331438 2013-04-09 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
14341439
14351440 PR ld/12494
1436- * bfd/elf32-avr.c: Consider all sections to determine if linker
1441+ * elf32-avr.c: Consider all sections to determine if linker
14371442 relaxation can safely delete a ret after a call/jmp
14381443
14391444 2013-04-09 Mingjie Xing <mingjie.xing@gmail.com>
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -3909,12 +3909,7 @@ struct ppc_link_hash_table
39093909 /* List of input sections for each output section. */
39103910 asection **input_list;
39113911
3912- /* Short-cuts to get to dynamic linker sections. */
3913- asection *got;
3914- asection *plt;
3915- asection *relplt;
3916- asection *iplt;
3917- asection *reliplt;
3912+ /* Shortcuts to get to dynamic linker sections. */
39183913 asection *dynbss;
39193914 asection *relbss;
39203915 asection *glink;
@@ -4257,18 +4252,17 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info)
42574252 }
42584253
42594254 flags = SEC_ALLOC | SEC_LINKER_CREATED;
4260- htab->iplt = bfd_make_section_anyway_with_flags (dynobj, ".iplt", flags);
4261- if (htab->iplt == NULL
4262- || ! bfd_set_section_alignment (dynobj, htab->iplt, 3))
4255+ htab->elf.iplt = bfd_make_section_anyway_with_flags (dynobj, ".iplt", flags);
4256+ if (htab->elf.iplt == NULL
4257+ || ! bfd_set_section_alignment (dynobj, htab->elf.iplt, 3))
42634258 return FALSE;
42644259
42654260 flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
42664261 | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
4267- htab->reliplt = bfd_make_section_anyway_with_flags (dynobj,
4268- ".rela.iplt",
4269- flags);
4270- if (htab->reliplt == NULL
4271- || ! bfd_set_section_alignment (dynobj, htab->reliplt, 3))
4262+ htab->elf.irelplt
4263+ = bfd_make_section_anyway_with_flags (dynobj, ".rela.iplt", flags);
4264+ if (htab->elf.irelplt == NULL
4265+ || ! bfd_set_section_alignment (dynobj, htab->elf.irelplt, 3))
42724266 return FALSE;
42734267
42744268 /* Create branch lookup table for plt_branch stubs. */
@@ -4481,15 +4475,9 @@ create_got_section (bfd *abfd, struct bfd_link_info *info)
44814475 if (htab == NULL)
44824476 return FALSE;
44834477
4484- if (!htab->got)
4485- {
4486- if (! _bfd_elf_create_got_section (htab->elf.dynobj, info))
4487- return FALSE;
4488-
4489- htab->got = bfd_get_linker_section (htab->elf.dynobj, ".got");
4490- if (!htab->got)
4491- abort ();
4492- }
4478+ if (!htab->elf.sgot
4479+ && !_bfd_elf_create_got_section (htab->elf.dynobj, info))
4480+ return FALSE;
44934481
44944482 flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
44954483 | SEC_LINKER_CREATED);
@@ -4524,15 +4512,11 @@ ppc64_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
45244512 if (htab == NULL)
45254513 return FALSE;
45264514
4527- if (!htab->got)
4528- htab->got = bfd_get_linker_section (dynobj, ".got");
4529- htab->plt = bfd_get_linker_section (dynobj, ".plt");
4530- htab->relplt = bfd_get_linker_section (dynobj, ".rela.plt");
45314515 htab->dynbss = bfd_get_linker_section (dynobj, ".dynbss");
45324516 if (!info->shared)
45334517 htab->relbss = bfd_get_linker_section (dynobj, ".rela.bss");
45344518
4535- if (!htab->got || !htab->plt || !htab->relplt || !htab->dynbss
4519+ if (!htab->elf.sgot || !htab->elf.splt || !htab->elf.srelplt || !htab->dynbss
45364520 || (!info->shared && !htab->relbss))
45374521 abort ();
45384522
@@ -9232,7 +9216,7 @@ allocate_got (struct elf_link_hash_entry *h,
92329216 dyn = htab->elf.dynamic_sections_created;
92339217 if (h->type == STT_GNU_IFUNC)
92349218 {
9235- htab->reliplt->size += rentsize;
9219+ htab->elf.irelplt->size += rentsize;
92369220 htab->got_reli_size += rentsize;
92379221 }
92389222 else if ((info->shared
@@ -9299,16 +9283,16 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
92999283 if (!htab->elf.dynamic_sections_created
93009284 || h->dynindx == -1)
93019285 {
9302- s = htab->iplt;
9286+ s = htab->elf.iplt;
93039287 pent->plt.offset = s->size;
93049288 s->size += PLT_ENTRY_SIZE (htab);
9305- s = htab->reliplt;
9289+ s = htab->elf.irelplt;
93069290 }
93079291 else
93089292 {
93099293 /* If this is the first .plt entry, make room for the special
93109294 first entry. */
9311- s = htab->plt;
9295+ s = htab->elf.splt;
93129296 if (s->size == 0)
93139297 s->size += PLT_INITIAL_ENTRY_SIZE (htab);
93149298
@@ -9332,7 +9316,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
93329316 s->size += 4;
93339317
93349318 /* We also need to make an entry in the .rela.plt section. */
9335- s = htab->relplt;
9319+ s = htab->elf.srelplt;
93369320 }
93379321 s->size += sizeof (Elf64_External_Rela);
93389322 doneone = TRUE;
@@ -9512,7 +9496,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
95129496 {
95139497 asection *sreloc = elf_section_data (p->sec)->sreloc;
95149498 if (eh->elf.type == STT_GNU_IFUNC)
9515- sreloc = htab->reliplt;
9499+ sreloc = htab->elf.irelplt;
95169500 sreloc->size += p->count * sizeof (Elf64_External_Rela);
95179501 }
95189502
@@ -9643,7 +9627,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
96439627 {
96449628 asection *srel = elf_section_data (p->sec)->sreloc;
96459629 if (p->ifunc)
9646- srel = htab->reliplt;
9630+ srel = htab->elf.irelplt;
96479631 srel->size += p->count * sizeof (Elf64_External_Rela);
96489632 if ((p->sec->output_section->flags & SEC_READONLY) != 0)
96499633 info->flags |= DF_TEXTREL;
@@ -9689,7 +9673,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
96899673 s->size += ent_size;
96909674 if ((*lgot_masks & PLT_IFUNC) != 0)
96919675 {
9692- htab->reliplt->size += rel_size;
9676+ htab->elf.irelplt->size += rel_size;
96939677 htab->got_reli_size += rel_size;
96949678 }
96959679 else if (info->shared)
@@ -9712,11 +9696,11 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
97129696 for (ent = *local_plt; ent != NULL; ent = ent->next)
97139697 if (ent->plt.refcount > 0)
97149698 {
9715- s = htab->iplt;
9699+ s = htab->elf.iplt;
97169700 ent->plt.offset = s->size;
97179701 s->size += PLT_ENTRY_SIZE (htab);
97189702
9719- htab->reliplt->size += sizeof (Elf64_External_Rela);
9703+ htab->elf.irelplt->size += sizeof (Elf64_External_Rela);
97209704 }
97219705 else
97229706 ent->plt.offset = (bfd_vma) -1;
@@ -9779,9 +9763,9 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
97799763 if (s == htab->brlt || s == htab->relbrlt)
97809764 /* These haven't been allocated yet; don't strip. */
97819765 continue;
9782- else if (s == htab->got
9783- || s == htab->plt
9784- || s == htab->iplt
9766+ else if (s == htab->elf.sgot
9767+ || s == htab->elf.splt
9768+ || s == htab->elf.iplt
97859769 || s == htab->glink
97869770 || s == htab->dynbss)
97879771 {
@@ -9798,7 +9782,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
97989782 {
97999783 if (s->size != 0)
98009784 {
9801- if (s != htab->relplt)
9785+ if (s != htab->elf.srelplt)
98029786 relocs = TRUE;
98039787
98049788 /* We use the reloc_count field as a counter if we need
@@ -9848,7 +9832,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
98489832 continue;
98499833
98509834 s = ppc64_elf_tdata (ibfd)->got;
9851- if (s != NULL && s != htab->got)
9835+ if (s != NULL && s != htab->elf.sgot)
98529836 {
98539837 if (s->size == 0)
98549838 s->flags |= SEC_EXCLUDE;
@@ -9893,7 +9877,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
98939877 return FALSE;
98949878 }
98959879
9896- if (htab->plt != NULL && htab->plt->size != 0)
9880+ if (htab->elf.splt != NULL && htab->elf.splt->size != 0)
98979881 {
98989882 if (!add_dynamic_entry (DT_PLTGOT, 0)
98999883 || !add_dynamic_entry (DT_PLTRELSZ, 0)
@@ -10695,11 +10679,11 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
1069510679 if (dest >= (bfd_vma) -2)
1069610680 abort ();
1069710681
10698- plt = htab->plt;
10682+ plt = htab->elf.splt;
1069910683 if (!htab->elf.dynamic_sections_created
1070010684 || stub_entry->h == NULL
1070110685 || stub_entry->h->elf.dynindx == -1)
10702- plt = htab->iplt;
10686+ plt = htab->elf.iplt;
1070310687
1070410688 dest += plt->output_offset + plt->output_section->vma;
1070510689
@@ -10718,8 +10702,8 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
1071810702 + stub_entry->target_section->output_offset
1071910703 + stub_entry->target_section->output_section->vma);
1072010704
10721- rl = (htab->reliplt->contents
10722- + (htab->reliplt->reloc_count++
10705+ rl = (htab->elf.irelplt->contents
10706+ + (htab->elf.irelplt->reloc_count++
1072310707 * sizeof (Elf64_External_Rela)));
1072410708 bfd_elf64_swap_reloca_out (info->output_bfd, &rela, rl);
1072510709 stub_entry->plt_ent->plt.offset |= 1;
@@ -10849,11 +10833,11 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
1084910833 off = stub_entry->plt_ent->plt.offset & ~(bfd_vma) 1;
1085010834 if (off >= (bfd_vma) -2)
1085110835 abort ();
10852- plt = htab->plt;
10836+ plt = htab->elf.splt;
1085310837 if (!htab->elf.dynamic_sections_created
1085410838 || stub_entry->h == NULL
1085510839 || stub_entry->h->elf.dynindx == -1)
10856- plt = htab->iplt;
10840+ plt = htab->elf.iplt;
1085710841 off += (plt->output_offset
1085810842 + plt->output_section->vma
1085910843 - elf_gp (plt->output_section->owner)
@@ -11220,8 +11204,8 @@ ppc64_elf_layout_multitoc (struct bfd_link_info *info)
1122011204 }
1122111205
1122211206 /* Zap sizes of got sections. */
11223- htab->reliplt->rawsize = htab->reliplt->size;
11224- htab->reliplt->size -= htab->got_reli_size;
11207+ htab->elf.irelplt->rawsize = htab->elf.irelplt->size;
11208+ htab->elf.irelplt->size -= htab->got_reli_size;
1122511209 htab->got_reli_size = 0;
1122611210
1122711211 for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
@@ -11287,7 +11271,7 @@ ppc64_elf_layout_multitoc (struct bfd_link_info *info)
1128711271 s->size += ent_size;
1128811272 if ((*lgot_masks & PLT_IFUNC) != 0)
1128911273 {
11290- htab->reliplt->size += rel_size;
11274+ htab->elf.irelplt->size += rel_size;
1129111275 htab->got_reli_size += rel_size;
1129211276 }
1129311277 else if (info->shared)
@@ -11323,7 +11307,7 @@ ppc64_elf_layout_multitoc (struct bfd_link_info *info)
1132311307 }
1132411308 }
1132511309
11326- done_something = htab->reliplt->rawsize != htab->reliplt->size;
11310+ done_something = htab->elf.irelplt->rawsize != htab->elf.irelplt->size;
1132711311 if (!done_something)
1132811312 for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
1132911313 {
@@ -12396,10 +12380,10 @@ build_global_entry_stubs (struct elf_link_hash_entry *h, void *inf)
1239612380 h->root.u.def.value = s->size;
1239712381 s->size += 16;
1239812382 p = s->contents + h->root.u.def.value;
12399- plt = htab->plt;
12383+ plt = htab->elf.splt;
1240012384 if (!htab->elf.dynamic_sections_created
1240112385 || h->dynindx == -1)
12402- plt = htab->iplt;
12386+ plt = htab->elf.iplt;
1240312387 off = pent->plt.offset + plt->output_offset + plt->output_section->vma;
1240412388 off -= h->root.u.def.value + s->output_offset + s->output_section->vma;
1240512389
@@ -12487,7 +12471,9 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
1248712471 h->non_elf = 0;
1248812472 }
1248912473 }
12490- plt0 = htab->plt->output_section->vma + htab->plt->output_offset - 16;
12474+ plt0 = (htab->elf.splt->output_section->vma
12475+ + htab->elf.splt->output_offset
12476+ - 16);
1249112477 if (info->emitrelocations)
1249212478 {
1249312479 Elf_Internal_Rela *r = get_relocs (htab->glink, 1);
@@ -13916,7 +13902,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
1391613902 ? h->elf.type == STT_GNU_IFUNC
1391713903 : ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC);
1391813904 if (ifunc)
13919- relgot = htab->reliplt;
13905+ relgot = htab->elf.irelplt;
1392013906 else if ((info->shared || indx != 0)
1392113907 && (h == NULL
1392213908 || (tls_type == (TLS_TLS | TLS_LD)
@@ -14030,15 +14016,15 @@ ppc64_elf_relocate_section (bfd *output_bfd,
1403014016 symbol. This happens when statically linking PIC code,
1403114017 or when using -Bsymbolic. Go find a match if there is a
1403214018 PLT entry. */
14033- if (htab->plt != NULL)
14019+ if (htab->elf.splt != NULL)
1403414020 {
1403514021 struct plt_entry *ent;
1403614022 for (ent = h->elf.plt.plist; ent != NULL; ent = ent->next)
1403714023 if (ent->plt.offset != (bfd_vma) -1
1403814024 && ent->addend == orig_rel.r_addend)
1403914025 {
14040- relocation = (htab->plt->output_section->vma
14041- + htab->plt->output_offset
14026+ relocation = (htab->elf.splt->output_section->vma
14027+ + htab->elf.splt->output_offset
1404214028 + ent->plt.offset);
1404314029 unresolved_reloc = FALSE;
1404414030 break;
@@ -14347,7 +14333,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
1434714333 if (h != NULL
1434814334 ? h->elf.type == STT_GNU_IFUNC
1434914335 : ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
14350- sreloc = htab->reliplt;
14336+ sreloc = htab->elf.irelplt;
1435114337 if (sreloc == NULL)
1435214338 abort ();
1435314339
@@ -14724,8 +14710,8 @@ ppc64_elf_finish_dynamic_symbol (bfd *output_bfd,
1472414710 && h->def_regular
1472514711 && (h->root.type == bfd_link_hash_defined
1472614712 || h->root.type == bfd_link_hash_defweak));
14727- rela.r_offset = (htab->iplt->output_section->vma
14728- + htab->iplt->output_offset
14713+ rela.r_offset = (htab->elf.iplt->output_section->vma
14714+ + htab->elf.iplt->output_offset
1472914715 + ent->plt.offset);
1473014716 if (htab->opd_abi)
1473114717 rela.r_info = ELF64_R_INFO (0, R_PPC64_JMP_IREL);
@@ -14735,18 +14721,18 @@ ppc64_elf_finish_dynamic_symbol (bfd *output_bfd,
1473514721 + h->root.u.def.section->output_offset
1473614722 + h->root.u.def.section->output_section->vma
1473714723 + ent->addend);
14738- loc = (htab->reliplt->contents
14739- + (htab->reliplt->reloc_count++
14724+ loc = (htab->elf.irelplt->contents
14725+ + (htab->elf.irelplt->reloc_count++
1474014726 * sizeof (Elf64_External_Rela)));
1474114727 }
1474214728 else
1474314729 {
14744- rela.r_offset = (htab->plt->output_section->vma
14745- + htab->plt->output_offset
14730+ rela.r_offset = (htab->elf.splt->output_section->vma
14731+ + htab->elf.splt->output_offset
1474614732 + ent->plt.offset);
1474714733 rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_JMP_SLOT);
1474814734 rela.r_addend = ent->addend;
14749- loc = (htab->relplt->contents
14735+ loc = (htab->elf.srelplt->contents
1475014736 + ((ent->plt.offset - PLT_INITIAL_ENTRY_SIZE (htab))
1475114737 / PLT_ENTRY_SIZE (htab) * sizeof (Elf64_External_Rela)));
1475214738 }
@@ -14811,7 +14797,7 @@ ppc64_elf_reloc_type_class (const struct bfd_link_info *info,
1481114797 enum elf_ppc64_reloc_type r_type;
1481214798 struct ppc_link_hash_table *htab = ppc_hash_table (info);
1481314799
14814- if (rel_sec == htab->reliplt)
14800+ if (rel_sec == htab->elf.irelplt)
1481514801 return reloc_class_ifunc;
1481614802
1481714803 r_type = ELF64_R_TYPE (rela->r_info);
@@ -14849,7 +14835,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
1484914835 {
1485014836 Elf64_External_Dyn *dyncon, *dynconend;
1485114837
14852- if (sdyn == NULL || htab->got == NULL)
14838+ if (sdyn == NULL || htab->elf.sgot == NULL)
1485314839 abort ();
1485414840
1485514841 dyncon = (Elf64_External_Dyn *) sdyn->contents;
@@ -14896,23 +14882,23 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
1489614882 break;
1489714883
1489814884 case DT_PLTGOT:
14899- s = htab->plt;
14885+ s = htab->elf.splt;
1490014886 dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
1490114887 break;
1490214888
1490314889 case DT_JMPREL:
14904- s = htab->relplt;
14890+ s = htab->elf.srelplt;
1490514891 dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
1490614892 break;
1490714893
1490814894 case DT_PLTRELSZ:
14909- dyn.d_un.d_val = htab->relplt->size;
14895+ dyn.d_un.d_val = htab->elf.srelplt->size;
1491014896 break;
1491114897
1491214898 case DT_RELASZ:
1491314899 /* Don't count procedure linkage table relocs in the
1491414900 overall reloc count. */
14915- s = htab->relplt;
14901+ s = htab->elf.srelplt;
1491614902 if (s == NULL)
1491714903 continue;
1491814904 dyn.d_un.d_val -= s->size;
@@ -14922,7 +14908,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
1492214908 /* We may not be using the standard ELF linker script.
1492314909 If .rela.plt is the first .rela section, we adjust
1492414910 DT_RELA to not include it. */
14925- s = htab->relplt;
14911+ s = htab->elf.srelplt;
1492614912 if (s == NULL)
1492714913 continue;
1492814914 if (dyn.d_un.d_ptr != s->output_section->vma + s->output_offset)
@@ -14935,22 +14921,22 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
1493514921 }
1493614922 }
1493714923
14938- if (htab->got != NULL && htab->got->size != 0)
14924+ if (htab->elf.sgot != NULL && htab->elf.sgot->size != 0)
1493914925 {
1494014926 /* Fill in the first entry in the global offset table.
1494114927 We use it to hold the link-time TOCbase. */
1494214928 bfd_put_64 (output_bfd,
1494314929 elf_gp (output_bfd) + TOC_BASE_OFF,
14944- htab->got->contents);
14930+ htab->elf.sgot->contents);
1494514931
1494614932 /* Set .got entry size. */
14947- elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 8;
14933+ elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 8;
1494814934 }
1494914935
14950- if (htab->plt != NULL && htab->plt->size != 0)
14936+ if (htab->elf.splt != NULL && htab->elf.splt->size != 0)
1495114937 {
1495214938 /* Set .plt entry size. */
14953- elf_section_data (htab->plt->output_section)->this_hdr.sh_entsize
14939+ elf_section_data (htab->elf.splt->output_section)->this_hdr.sh_entsize
1495414940 = PLT_ENTRY_SIZE (htab);
1495514941 }
1495614942