1 // dynobj.cc -- dynamic object support for gold
3 // Copyright 2006, 2007 Free Software Foundation, Inc.
4 // Written by Ian Lance Taylor <iant@google.com>.
6 // This file is part of gold.
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 3 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 // MA 02110-1301, USA.
29 #include "parameters.h"
38 // Return the string to use in a DT_NEEDED entry.
41 Dynobj::soname() const
43 if (!this->soname_
.empty())
44 return this->soname_
.c_str();
45 return this->name().c_str();
48 // Class Sized_dynobj.
50 template<int size
, bool big_endian
>
51 Sized_dynobj
<size
, big_endian
>::Sized_dynobj(
52 const std::string
& name
,
53 Input_file
* input_file
,
55 const elfcpp::Ehdr
<size
, big_endian
>& ehdr
)
56 : Dynobj(name
, input_file
, offset
),
63 template<int size
, bool big_endian
>
65 Sized_dynobj
<size
, big_endian
>::setup(
66 const elfcpp::Ehdr
<size
, big_endian
>& ehdr
)
68 this->set_target(ehdr
.get_e_machine(), size
, big_endian
,
69 ehdr
.get_e_ident()[elfcpp::EI_OSABI
],
70 ehdr
.get_e_ident()[elfcpp::EI_ABIVERSION
]);
72 const unsigned int shnum
= this->elf_file_
.shnum();
73 this->set_shnum(shnum
);
76 // Find the SHT_DYNSYM section and the various version sections, and
77 // the dynamic section, given the section headers.
79 template<int size
, bool big_endian
>
81 Sized_dynobj
<size
, big_endian
>::find_dynsym_sections(
82 const unsigned char* pshdrs
,
83 unsigned int* pdynsym_shndx
,
84 unsigned int* pversym_shndx
,
85 unsigned int* pverdef_shndx
,
86 unsigned int* pverneed_shndx
,
87 unsigned int* pdynamic_shndx
)
92 *pverneed_shndx
= -1U;
93 *pdynamic_shndx
= -1U;
95 const unsigned int shnum
= this->shnum();
96 const unsigned char* p
= pshdrs
;
97 for (unsigned int i
= 0; i
< shnum
; ++i
, p
+= This::shdr_size
)
99 typename
This::Shdr
shdr(p
);
102 switch (shdr
.get_sh_type())
104 case elfcpp::SHT_DYNSYM
:
107 case elfcpp::SHT_GNU_versym
:
110 case elfcpp::SHT_GNU_verdef
:
113 case elfcpp::SHT_GNU_verneed
:
116 case elfcpp::SHT_DYNAMIC
:
130 _("%s: %s: unexpected duplicate type %u section: %u, %u\n"),
131 program_name
, this->name().c_str(), shdr
.get_sh_type(),
140 // Read the contents of section SHNDX. PSHDRS points to the section
141 // headers. TYPE is the expected section type. LINK is the expected
142 // section link. Store the data in *VIEW and *VIEW_SIZE. The
143 // section's sh_info field is stored in *VIEW_INFO.
145 template<int size
, bool big_endian
>
147 Sized_dynobj
<size
, big_endian
>::read_dynsym_section(
148 const unsigned char* pshdrs
,
154 unsigned int* view_info
)
164 typename
This::Shdr
shdr(pshdrs
+ shndx
* This::shdr_size
);
166 gold_assert(shdr
.get_sh_type() == type
);
168 if (shdr
.get_sh_link() != link
)
171 _("%s: %s: unexpected link in section %u header: %u != %u\n"),
172 program_name
, this->name().c_str(), shndx
,
173 shdr
.get_sh_link(), link
);
177 *view
= this->get_lasting_view(shdr
.get_sh_offset(), shdr
.get_sh_size());
178 *view_size
= shdr
.get_sh_size();
179 *view_info
= shdr
.get_sh_info();
182 // Set the soname field if this shared object has a DT_SONAME tag.
183 // PSHDRS points to the section headers. DYNAMIC_SHNDX is the section
184 // index of the SHT_DYNAMIC section. STRTAB_SHNDX, STRTAB, and
185 // STRTAB_SIZE are the section index and contents of a string table
186 // which may be the one associated with the SHT_DYNAMIC section.
188 template<int size
, bool big_endian
>
190 Sized_dynobj
<size
, big_endian
>::set_soname(const unsigned char* pshdrs
,
191 unsigned int dynamic_shndx
,
192 unsigned int strtab_shndx
,
193 const unsigned char* strtabu
,
196 typename
This::Shdr
dynamicshdr(pshdrs
+ dynamic_shndx
* This::shdr_size
);
197 gold_assert(dynamicshdr
.get_sh_type() == elfcpp::SHT_DYNAMIC
);
199 const off_t dynamic_size
= dynamicshdr
.get_sh_size();
200 const unsigned char* pdynamic
= this->get_view(dynamicshdr
.get_sh_offset(),
203 const unsigned int link
= dynamicshdr
.get_sh_link();
204 if (link
!= strtab_shndx
)
206 if (link
>= this->shnum())
209 _("%s: %s: DYNAMIC section %u link out of range: %u\n"),
210 program_name
, this->name().c_str(),
211 dynamic_shndx
, link
);
215 typename
This::Shdr
strtabshdr(pshdrs
+ link
* This::shdr_size
);
216 if (strtabshdr
.get_sh_type() != elfcpp::SHT_STRTAB
)
219 _("%s: %s: DYNAMIC section %u link %u is not a strtab\n"),
220 program_name
, this->name().c_str(),
221 dynamic_shndx
, link
);
225 strtab_size
= strtabshdr
.get_sh_size();
226 strtabu
= this->get_view(strtabshdr
.get_sh_offset(), strtab_size
);
229 for (const unsigned char* p
= pdynamic
;
230 p
< pdynamic
+ dynamic_size
;
233 typename
This::Dyn
dyn(p
);
235 if (dyn
.get_d_tag() == elfcpp::DT_SONAME
)
237 off_t val
= dyn
.get_d_val();
238 if (val
>= strtab_size
)
241 _("%s: %s: DT_SONAME value out of range: "
243 program_name
, this->name().c_str(),
244 static_cast<long long>(val
),
245 static_cast<long long>(strtab_size
));
249 const char* strtab
= reinterpret_cast<const char*>(strtabu
);
250 this->set_soname_string(strtab
+ val
);
254 if (dyn
.get_d_tag() == elfcpp::DT_NULL
)
258 fprintf(stderr
, _("%s: %s: missing DT_NULL in dynamic segment\n"),
259 program_name
, this->name().c_str());
263 // Read the symbols and sections from a dynamic object. We read the
264 // dynamic symbols, not the normal symbols.
266 template<int size
, bool big_endian
>
268 Sized_dynobj
<size
, big_endian
>::do_read_symbols(Read_symbols_data
* sd
)
270 this->read_section_data(&this->elf_file_
, sd
);
272 const unsigned char* const pshdrs
= sd
->section_headers
->data();
274 unsigned int dynsym_shndx
;
275 unsigned int versym_shndx
;
276 unsigned int verdef_shndx
;
277 unsigned int verneed_shndx
;
278 unsigned int dynamic_shndx
;
279 this->find_dynsym_sections(pshdrs
, &dynsym_shndx
, &versym_shndx
,
280 &verdef_shndx
, &verneed_shndx
, &dynamic_shndx
);
282 unsigned int strtab_shndx
= -1U;
284 if (dynsym_shndx
== -1U)
287 sd
->symbols_size
= 0;
288 sd
->symbol_names
= NULL
;
289 sd
->symbol_names_size
= 0;
293 // Get the dynamic symbols.
294 typename
This::Shdr
dynsymshdr(pshdrs
+ dynsym_shndx
* This::shdr_size
);
295 gold_assert(dynsymshdr
.get_sh_type() == elfcpp::SHT_DYNSYM
);
297 sd
->symbols
= this->get_lasting_view(dynsymshdr
.get_sh_offset(),
298 dynsymshdr
.get_sh_size());
299 sd
->symbols_size
= dynsymshdr
.get_sh_size();
301 // Get the symbol names.
302 strtab_shndx
= dynsymshdr
.get_sh_link();
303 if (strtab_shndx
>= this->shnum())
306 _("%s: %s: invalid dynamic symbol table name index: %u\n"),
307 program_name
, this->name().c_str(), strtab_shndx
);
310 typename
This::Shdr
strtabshdr(pshdrs
+ strtab_shndx
* This::shdr_size
);
311 if (strtabshdr
.get_sh_type() != elfcpp::SHT_STRTAB
)
314 _("%s: %s: dynamic symbol table name section "
315 "has wrong type: %u\n"),
316 program_name
, this->name().c_str(),
317 static_cast<unsigned int>(strtabshdr
.get_sh_type()));
321 sd
->symbol_names
= this->get_lasting_view(strtabshdr
.get_sh_offset(),
322 strtabshdr
.get_sh_size());
323 sd
->symbol_names_size
= strtabshdr
.get_sh_size();
325 // Get the version information.
328 this->read_dynsym_section(pshdrs
, versym_shndx
, elfcpp::SHT_GNU_versym
,
329 dynsym_shndx
, &sd
->versym
, &sd
->versym_size
,
332 // We require that the version definition and need section link
333 // to the same string table as the dynamic symbol table. This
334 // is not a technical requirement, but it always happens in
335 // practice. We could change this if necessary.
337 this->read_dynsym_section(pshdrs
, verdef_shndx
, elfcpp::SHT_GNU_verdef
,
338 strtab_shndx
, &sd
->verdef
, &sd
->verdef_size
,
341 this->read_dynsym_section(pshdrs
, verneed_shndx
, elfcpp::SHT_GNU_verneed
,
342 strtab_shndx
, &sd
->verneed
, &sd
->verneed_size
,
346 // Read the SHT_DYNAMIC section to find whether this shared object
347 // has a DT_SONAME tag. This doesn't really have anything to do
348 // with reading the symbols, but this is a convenient place to do
350 if (dynamic_shndx
!= -1U)
351 this->set_soname(pshdrs
, dynamic_shndx
, strtab_shndx
,
352 (sd
->symbol_names
== NULL
354 : sd
->symbol_names
->data()),
355 sd
->symbol_names_size
);
358 // Lay out the input sections for a dynamic object. We don't want to
359 // include sections from a dynamic object, so all that we actually do
360 // here is check for .gnu.warning sections.
362 template<int size
, bool big_endian
>
364 Sized_dynobj
<size
, big_endian
>::do_layout(Symbol_table
* symtab
,
366 Read_symbols_data
* sd
)
368 const unsigned int shnum
= this->shnum();
372 // Get the section headers.
373 const unsigned char* pshdrs
= sd
->section_headers
->data();
375 // Get the section names.
376 const unsigned char* pnamesu
= sd
->section_names
->data();
377 const char* pnames
= reinterpret_cast<const char*>(pnamesu
);
379 // Skip the first, dummy, section.
380 pshdrs
+= This::shdr_size
;
381 for (unsigned int i
= 1; i
< shnum
; ++i
, pshdrs
+= This::shdr_size
)
383 typename
This::Shdr
shdr(pshdrs
);
385 if (shdr
.get_sh_name() >= sd
->section_names_size
)
388 _("%s: %s: bad section name offset for section %u: %lu\n"),
389 program_name
, this->name().c_str(), i
,
390 static_cast<unsigned long>(shdr
.get_sh_name()));
394 const char* name
= pnames
+ shdr
.get_sh_name();
396 this->handle_gnu_warning_section(name
, i
, symtab
);
399 delete sd
->section_headers
;
400 sd
->section_headers
= NULL
;
401 delete sd
->section_names
;
402 sd
->section_names
= NULL
;
405 // Add an entry to the vector mapping version numbers to version
408 template<int size
, bool big_endian
>
410 Sized_dynobj
<size
, big_endian
>::set_version_map(
411 Version_map
* version_map
,
413 const char* name
) const
415 if (ndx
>= version_map
->size())
416 version_map
->resize(ndx
+ 1);
417 if ((*version_map
)[ndx
] != NULL
)
419 fprintf(stderr
, _("%s: %s: duplicate definition for version %u\n"),
420 program_name
, this->name().c_str(), ndx
);
423 (*version_map
)[ndx
] = name
;
426 // Add mappings for the version definitions to VERSION_MAP.
428 template<int size
, bool big_endian
>
430 Sized_dynobj
<size
, big_endian
>::make_verdef_map(
431 Read_symbols_data
* sd
,
432 Version_map
* version_map
) const
434 if (sd
->verdef
== NULL
)
437 const char* names
= reinterpret_cast<const char*>(sd
->symbol_names
->data());
438 off_t names_size
= sd
->symbol_names_size
;
440 const unsigned char* pverdef
= sd
->verdef
->data();
441 off_t verdef_size
= sd
->verdef_size
;
442 const unsigned int count
= sd
->verdef_info
;
444 const unsigned char* p
= pverdef
;
445 for (unsigned int i
= 0; i
< count
; ++i
)
447 elfcpp::Verdef
<size
, big_endian
> verdef(p
);
449 if (verdef
.get_vd_version() != elfcpp::VER_DEF_CURRENT
)
451 fprintf(stderr
, _("%s: %s: unexpected verdef version %u\n"),
452 program_name
, this->name().c_str(), verdef
.get_vd_version());
456 const unsigned int vd_ndx
= verdef
.get_vd_ndx();
458 // The GNU linker clears the VERSYM_HIDDEN bit. I'm not
461 // The first Verdaux holds the name of this version. Subsequent
462 // ones are versions that this one depends upon, which we don't
464 const unsigned int vd_cnt
= verdef
.get_vd_cnt();
467 fprintf(stderr
, _("%s: %s: verdef vd_cnt field too small: %u\n"),
468 program_name
, this->name().c_str(), vd_cnt
);
472 const unsigned int vd_aux
= verdef
.get_vd_aux();
473 if ((p
- pverdef
) + vd_aux
>= verdef_size
)
476 _("%s: %s: verdef vd_aux field out of range: %u\n"),
477 program_name
, this->name().c_str(), vd_aux
);
481 const unsigned char* pvda
= p
+ vd_aux
;
482 elfcpp::Verdaux
<size
, big_endian
> verdaux(pvda
);
484 const unsigned int vda_name
= verdaux
.get_vda_name();
485 if (vda_name
>= names_size
)
488 _("%s: %s: verdaux vda_name field out of range: %u\n"),
489 program_name
, this->name().c_str(), vda_name
);
493 this->set_version_map(version_map
, vd_ndx
, names
+ vda_name
);
495 const unsigned int vd_next
= verdef
.get_vd_next();
496 if ((p
- pverdef
) + vd_next
>= verdef_size
)
499 _("%s: %s: verdef vd_next field out of range: %u\n"),
500 program_name
, this->name().c_str(), vd_next
);
508 // Add mappings for the required versions to VERSION_MAP.
510 template<int size
, bool big_endian
>
512 Sized_dynobj
<size
, big_endian
>::make_verneed_map(
513 Read_symbols_data
* sd
,
514 Version_map
* version_map
) const
516 if (sd
->verneed
== NULL
)
519 const char* names
= reinterpret_cast<const char*>(sd
->symbol_names
->data());
520 off_t names_size
= sd
->symbol_names_size
;
522 const unsigned char* pverneed
= sd
->verneed
->data();
523 const off_t verneed_size
= sd
->verneed_size
;
524 const unsigned int count
= sd
->verneed_info
;
526 const unsigned char* p
= pverneed
;
527 for (unsigned int i
= 0; i
< count
; ++i
)
529 elfcpp::Verneed
<size
, big_endian
> verneed(p
);
531 if (verneed
.get_vn_version() != elfcpp::VER_NEED_CURRENT
)
533 fprintf(stderr
, _("%s: %s: unexpected verneed version %u\n"),
534 program_name
, this->name().c_str(),
535 verneed
.get_vn_version());
539 const unsigned int vn_aux
= verneed
.get_vn_aux();
541 if ((p
- pverneed
) + vn_aux
>= verneed_size
)
544 _("%s: %s: verneed vn_aux field out of range: %u\n"),
545 program_name
, this->name().c_str(), vn_aux
);
549 const unsigned int vn_cnt
= verneed
.get_vn_cnt();
550 const unsigned char* pvna
= p
+ vn_aux
;
551 for (unsigned int j
= 0; j
< vn_cnt
; ++j
)
553 elfcpp::Vernaux
<size
, big_endian
> vernaux(pvna
);
555 const unsigned int vna_name
= vernaux
.get_vna_name();
556 if (vna_name
>= names_size
)
559 _("%s: %s: vernaux vna_name field "
560 "out of range: %u\n"),
561 program_name
, this->name().c_str(), vna_name
);
565 this->set_version_map(version_map
, vernaux
.get_vna_other(),
568 const unsigned int vna_next
= vernaux
.get_vna_next();
569 if ((pvna
- pverneed
) + vna_next
>= verneed_size
)
572 _("%s: %s: verneed vna_next field "
573 "out of range: %u\n"),
574 program_name
, this->name().c_str(), vna_next
);
581 const unsigned int vn_next
= verneed
.get_vn_next();
582 if ((p
- pverneed
) + vn_next
>= verneed_size
)
585 _("%s: %s: verneed vn_next field out of range: %u\n"),
586 program_name
, this->name().c_str(), vn_next
);
594 // Create a vector mapping version numbers to version strings.
596 template<int size
, bool big_endian
>
598 Sized_dynobj
<size
, big_endian
>::make_version_map(
599 Read_symbols_data
* sd
,
600 Version_map
* version_map
) const
602 if (sd
->verdef
== NULL
&& sd
->verneed
== NULL
)
605 // A guess at the maximum version number we will see. If this is
606 // wrong we will be less efficient but still correct.
607 version_map
->reserve(sd
->verdef_info
+ sd
->verneed_info
* 10);
609 this->make_verdef_map(sd
, version_map
);
610 this->make_verneed_map(sd
, version_map
);
613 // Add the dynamic symbols to the symbol table.
615 template<int size
, bool big_endian
>
617 Sized_dynobj
<size
, big_endian
>::do_add_symbols(Symbol_table
* symtab
,
618 Read_symbols_data
* sd
)
620 if (sd
->symbols
== NULL
)
622 gold_assert(sd
->symbol_names
== NULL
);
623 gold_assert(sd
->versym
== NULL
&& sd
->verdef
== NULL
624 && sd
->verneed
== NULL
);
628 const int sym_size
= This::sym_size
;
629 const size_t symcount
= sd
->symbols_size
/ sym_size
;
630 if (symcount
* sym_size
!= sd
->symbols_size
)
633 _("%s: %s: size of dynamic symbols is not "
634 "multiple of symbol size\n"),
635 program_name
, this->name().c_str());
639 Version_map version_map
;
640 this->make_version_map(sd
, &version_map
);
642 const char* sym_names
=
643 reinterpret_cast<const char*>(sd
->symbol_names
->data());
644 symtab
->add_from_dynobj(this, sd
->symbols
->data(), symcount
,
645 sym_names
, sd
->symbol_names_size
,
648 : sd
->versym
->data()),
654 delete sd
->symbol_names
;
655 sd
->symbol_names
= NULL
;
656 if (sd
->versym
!= NULL
)
661 if (sd
->verdef
!= NULL
)
666 if (sd
->verneed
!= NULL
)
673 // Given a vector of hash codes, compute the number of hash buckets to
677 Dynobj::compute_bucket_count(const std::vector
<uint32_t>& hashcodes
,
678 bool for_gnu_hash_table
)
680 // FIXME: Implement optional hash table optimization.
682 // Array used to determine the number of hash table buckets to use
683 // based on the number of symbols there are. If there are fewer
684 // than 3 symbols we use 1 bucket, fewer than 17 symbols we use 3
685 // buckets, fewer than 37 we use 17 buckets, and so forth. We never
686 // use more than 32771 buckets. This is straight from the old GNU
688 static const unsigned int buckets
[] =
690 1, 3, 17, 37, 67, 97, 131, 197, 263, 521, 1031, 2053, 4099, 8209,
693 const int buckets_count
= sizeof buckets
/ sizeof buckets
[0];
695 unsigned int symcount
= hashcodes
.size();
696 unsigned int ret
= 1;
697 for (int i
= 0; i
< buckets_count
; ++i
)
699 if (symcount
< buckets
[i
])
704 if (for_gnu_hash_table
&& ret
< 2)
710 // The standard ELF hash function. This hash function must not
711 // change, as the dynamic linker uses it also.
714 Dynobj::elf_hash(const char* name
)
716 const unsigned char* nameu
= reinterpret_cast<const unsigned char*>(name
);
719 while ((c
= *nameu
++) != '\0')
722 uint32_t g
= h
& 0xf0000000;
726 // The ELF ABI says h &= ~g, but using xor is equivalent in
727 // this case (since g was set from h) and may save one
735 // Create a standard ELF hash table, setting *PPHASH and *PHASHLEN.
736 // DYNSYMS is a vector with all the global dynamic symbols.
737 // LOCAL_DYNSYM_COUNT is the number of local symbols in the dynamic
741 Dynobj::create_elf_hash_table(const Target
* target
,
742 const std::vector
<Symbol
*>& dynsyms
,
743 unsigned int local_dynsym_count
,
744 unsigned char** pphash
,
745 unsigned int* phashlen
)
747 unsigned int dynsym_count
= dynsyms
.size();
749 // Get the hash values for all the symbols.
750 std::vector
<uint32_t> dynsym_hashvals(dynsym_count
);
751 for (unsigned int i
= 0; i
< dynsym_count
; ++i
)
752 dynsym_hashvals
[i
] = Dynobj::elf_hash(dynsyms
[i
]->name());
754 const unsigned int bucketcount
=
755 Dynobj::compute_bucket_count(dynsym_hashvals
, false);
757 std::vector
<uint32_t> bucket(bucketcount
);
758 std::vector
<uint32_t> chain(local_dynsym_count
+ dynsym_count
);
760 for (unsigned int i
= 0; i
< dynsym_count
; ++i
)
762 unsigned int dynsym_index
= dynsyms
[i
]->dynsym_index();
763 unsigned int bucketpos
= dynsym_hashvals
[i
] % bucketcount
;
764 chain
[dynsym_index
] = bucket
[bucketpos
];
765 bucket
[bucketpos
] = dynsym_index
;
768 unsigned int hashlen
= ((2
773 unsigned char* phash
= new unsigned char[hashlen
];
775 if (target
->is_big_endian())
776 Dynobj::sized_create_elf_hash_table
<true>(bucket
, chain
, phash
, hashlen
);
778 Dynobj::sized_create_elf_hash_table
<false>(bucket
, chain
, phash
, hashlen
);
784 // Fill in an ELF hash table.
786 template<bool big_endian
>
788 Dynobj::sized_create_elf_hash_table(const std::vector
<uint32_t>& bucket
,
789 const std::vector
<uint32_t>& chain
,
790 unsigned char* phash
,
791 unsigned int hashlen
)
793 unsigned char* p
= phash
;
795 const unsigned int bucketcount
= bucket
.size();
796 const unsigned int chaincount
= chain
.size();
798 elfcpp::Swap
<32, big_endian
>::writeval(p
, bucketcount
);
800 elfcpp::Swap
<32, big_endian
>::writeval(p
, chaincount
);
803 for (unsigned int i
= 0; i
< bucketcount
; ++i
)
805 elfcpp::Swap
<32, big_endian
>::writeval(p
, bucket
[i
]);
809 for (unsigned int i
= 0; i
< chaincount
; ++i
)
811 elfcpp::Swap
<32, big_endian
>::writeval(p
, chain
[i
]);
815 gold_assert(static_cast<unsigned int>(p
- phash
) == hashlen
);
818 // The hash function used for the GNU hash table. This hash function
819 // must not change, as the dynamic linker uses it also.
822 Dynobj::gnu_hash(const char* name
)
824 const unsigned char* nameu
= reinterpret_cast<const unsigned char*>(name
);
827 while ((c
= *nameu
++) != '\0')
828 h
= (h
<< 5) + h
+ c
;
832 // Create a GNU hash table, setting *PPHASH and *PHASHLEN. GNU hash
833 // tables are an extension to ELF which are recognized by the GNU
834 // dynamic linker. They are referenced using dynamic tag DT_GNU_HASH.
835 // TARGET is the target. DYNSYMS is a vector with all the global
836 // symbols which will be going into the dynamic symbol table.
837 // LOCAL_DYNSYM_COUNT is the number of local symbols in the dynamic
841 Dynobj::create_gnu_hash_table(const Target
* target
,
842 const std::vector
<Symbol
*>& dynsyms
,
843 unsigned int local_dynsym_count
,
844 unsigned char** pphash
,
845 unsigned int* phashlen
)
847 const unsigned int count
= dynsyms
.size();
849 // Sort the dynamic symbols into two vectors. Symbols which we do
850 // not want to put into the hash table we store into
851 // UNHASHED_DYNSYMS. Symbols which we do want to store we put into
852 // HASHED_DYNSYMS. DYNSYM_HASHVALS is parallel to HASHED_DYNSYMS,
853 // and records the hash codes.
855 std::vector
<Symbol
*> unhashed_dynsyms
;
856 unhashed_dynsyms
.reserve(count
);
858 std::vector
<Symbol
*> hashed_dynsyms
;
859 hashed_dynsyms
.reserve(count
);
861 std::vector
<uint32_t> dynsym_hashvals
;
862 dynsym_hashvals
.reserve(count
);
864 for (unsigned int i
= 0; i
< count
; ++i
)
866 Symbol
* sym
= dynsyms
[i
];
868 // FIXME: Should put on unhashed_dynsyms if the symbol is
870 if (sym
->is_undefined())
871 unhashed_dynsyms
.push_back(sym
);
874 hashed_dynsyms
.push_back(sym
);
875 dynsym_hashvals
.push_back(Dynobj::gnu_hash(sym
->name()));
879 // Put the unhashed symbols at the start of the global portion of
880 // the dynamic symbol table.
881 const unsigned int unhashed_count
= unhashed_dynsyms
.size();
882 unsigned int unhashed_dynsym_index
= local_dynsym_count
;
883 for (unsigned int i
= 0; i
< unhashed_count
; ++i
)
885 unhashed_dynsyms
[i
]->set_dynsym_index(unhashed_dynsym_index
);
886 ++unhashed_dynsym_index
;
889 // For the actual data generation we call out to a templatized
891 int size
= target
->get_size();
892 bool big_endian
= target
->is_big_endian();
896 Dynobj::sized_create_gnu_hash_table
<32, true>(hashed_dynsyms
,
898 unhashed_dynsym_index
,
902 Dynobj::sized_create_gnu_hash_table
<32, false>(hashed_dynsyms
,
904 unhashed_dynsym_index
,
911 Dynobj::sized_create_gnu_hash_table
<64, true>(hashed_dynsyms
,
913 unhashed_dynsym_index
,
917 Dynobj::sized_create_gnu_hash_table
<64, false>(hashed_dynsyms
,
919 unhashed_dynsym_index
,
927 // Create the actual data for a GNU hash table. This is just a copy
928 // of the code from the old GNU linker.
930 template<int size
, bool big_endian
>
932 Dynobj::sized_create_gnu_hash_table(
933 const std::vector
<Symbol
*>& hashed_dynsyms
,
934 const std::vector
<uint32_t>& dynsym_hashvals
,
935 unsigned int unhashed_dynsym_count
,
936 unsigned char** pphash
,
937 unsigned int* phashlen
)
939 if (hashed_dynsyms
.empty())
941 // Special case for the empty hash table.
942 unsigned int hashlen
= 5 * 4 + size
/ 8;
943 unsigned char* phash
= new unsigned char[hashlen
];
945 elfcpp::Swap
<32, big_endian
>::writeval(phash
, 1);
946 // Symbol index above unhashed symbols.
947 elfcpp::Swap
<32, big_endian
>::writeval(phash
+ 4, unhashed_dynsym_count
);
948 // One word for bitmask.
949 elfcpp::Swap
<32, big_endian
>::writeval(phash
+ 8, 1);
950 // Only bloom filter.
951 elfcpp::Swap
<32, big_endian
>::writeval(phash
+ 12, 0);
953 elfcpp::Swap
<size
, big_endian
>::writeval(phash
+ 16, 0);
954 // No hashes in only bucket.
955 elfcpp::Swap
<32, big_endian
>::writeval(phash
+ 16 + size
/ 8, 0);
963 const unsigned int bucketcount
=
964 Dynobj::compute_bucket_count(dynsym_hashvals
, true);
966 const unsigned int nsyms
= hashed_dynsyms
.size();
968 uint32_t maskbitslog2
= 1;
969 uint32_t x
= nsyms
>> 1;
975 if (maskbitslog2
< 3)
977 else if (((1U << (maskbitslog2
- 2)) & nsyms
) != 0)
987 if (maskbitslog2
== 5)
991 uint32_t mask
= (1U << shift1
) - 1U;
992 uint32_t shift2
= maskbitslog2
;
993 uint32_t maskbits
= 1U << maskbitslog2
;
994 uint32_t maskwords
= 1U << (maskbitslog2
- shift1
);
996 typedef typename
elfcpp::Elf_types
<size
>::Elf_WXword Word
;
997 std::vector
<Word
> bitmask(maskwords
);
998 std::vector
<uint32_t> counts(bucketcount
);
999 std::vector
<uint32_t> indx(bucketcount
);
1000 uint32_t symindx
= unhashed_dynsym_count
;
1002 // Count the number of times each hash bucket is used.
1003 for (unsigned int i
= 0; i
< nsyms
; ++i
)
1004 ++counts
[dynsym_hashvals
[i
] % bucketcount
];
1006 unsigned int cnt
= symindx
;
1007 for (unsigned int i
= 0; i
< bucketcount
; ++i
)
1013 unsigned int hashlen
= (4 + bucketcount
+ nsyms
) * 4;
1014 hashlen
+= maskbits
/ 8;
1015 unsigned char* phash
= new unsigned char[hashlen
];
1017 elfcpp::Swap
<32, big_endian
>::writeval(phash
, bucketcount
);
1018 elfcpp::Swap
<32, big_endian
>::writeval(phash
+ 4, symindx
);
1019 elfcpp::Swap
<32, big_endian
>::writeval(phash
+ 8, maskwords
);
1020 elfcpp::Swap
<32, big_endian
>::writeval(phash
+ 12, shift2
);
1022 unsigned char* p
= phash
+ 16 + maskbits
/ 8;
1023 for (unsigned int i
= 0; i
< bucketcount
; ++i
)
1026 elfcpp::Swap
<32, big_endian
>::writeval(p
, 0);
1028 elfcpp::Swap
<32, big_endian
>::writeval(p
, indx
[i
]);
1032 for (unsigned int i
= 0; i
< nsyms
; ++i
)
1034 Symbol
* sym
= hashed_dynsyms
[i
];
1035 uint32_t hashval
= dynsym_hashvals
[i
];
1037 unsigned int bucket
= hashval
% bucketcount
;
1038 unsigned int val
= ((hashval
>> shift1
)
1039 & ((maskbits
>> shift1
) - 1));
1040 bitmask
[val
] |= (static_cast<Word
>(1U)) << (hashval
& mask
);
1041 bitmask
[val
] |= (static_cast<Word
>(1U)) << ((hashval
>> shift2
) & mask
);
1042 val
= hashval
& ~ 1U;
1043 if (counts
[bucket
] == 1)
1045 // Last element terminates the chain.
1048 elfcpp::Swap
<32, big_endian
>::writeval(p
+ (indx
[bucket
] - symindx
) * 4,
1052 sym
->set_dynsym_index(indx
[bucket
]);
1057 for (unsigned int i
= 0; i
< maskwords
; ++i
)
1059 elfcpp::Swap
<size
, big_endian
>::writeval(p
, bitmask
[i
]);
1063 *phashlen
= hashlen
;
1069 // Write this definition to a buffer for the output section.
1071 template<int size
, bool big_endian
>
1073 Verdef::write(const Stringpool
* dynpool
, bool is_last
, unsigned char* pb
1074 ACCEPT_SIZE_ENDIAN
) const
1076 const int verdef_size
= elfcpp::Elf_sizes
<size
>::verdef_size
;
1077 const int verdaux_size
= elfcpp::Elf_sizes
<size
>::verdaux_size
;
1079 elfcpp::Verdef_write
<size
, big_endian
> vd(pb
);
1080 vd
.set_vd_version(elfcpp::VER_DEF_CURRENT
);
1081 vd
.set_vd_flags((this->is_base_
? elfcpp::VER_FLG_BASE
: 0)
1082 | (this->is_weak_
? elfcpp::VER_FLG_WEAK
: 0));
1083 vd
.set_vd_ndx(this->index());
1084 vd
.set_vd_cnt(1 + this->deps_
.size());
1085 vd
.set_vd_hash(Dynobj::elf_hash(this->name()));
1086 vd
.set_vd_aux(verdef_size
);
1087 vd
.set_vd_next(is_last
1089 : verdef_size
+ (1 + this->deps_
.size()) * verdaux_size
);
1092 elfcpp::Verdaux_write
<size
, big_endian
> vda(pb
);
1093 vda
.set_vda_name(dynpool
->get_offset(this->name()));
1094 vda
.set_vda_next(this->deps_
.empty() ? 0 : verdaux_size
);
1097 Deps::const_iterator p
;
1099 for (p
= this->deps_
.begin(), i
= 0;
1100 p
!= this->deps_
.end();
1103 elfcpp::Verdaux_write
<size
, big_endian
> vda(pb
);
1104 vda
.set_vda_name(dynpool
->get_offset(*p
));
1105 vda
.set_vda_next(i
+ 1 >= this->deps_
.size() ? 0 : verdaux_size
);
1116 for (Need_versions::iterator p
= this->need_versions_
.begin();
1117 p
!= this->need_versions_
.end();
1122 // Add a new version to this file reference.
1125 Verneed::add_name(const char* name
)
1127 Verneed_version
* vv
= new Verneed_version(name
);
1128 this->need_versions_
.push_back(vv
);
1132 // Set the version indexes starting at INDEX.
1135 Verneed::finalize(unsigned int index
)
1137 for (Need_versions::iterator p
= this->need_versions_
.begin();
1138 p
!= this->need_versions_
.end();
1141 (*p
)->set_index(index
);
1147 // Write this list of referenced versions to a buffer for the output
1150 template<int size
, bool big_endian
>
1152 Verneed::write(const Stringpool
* dynpool
, bool is_last
,
1153 unsigned char* pb ACCEPT_SIZE_ENDIAN
) const
1155 const int verneed_size
= elfcpp::Elf_sizes
<size
>::verneed_size
;
1156 const int vernaux_size
= elfcpp::Elf_sizes
<size
>::vernaux_size
;
1158 elfcpp::Verneed_write
<size
, big_endian
> vn(pb
);
1159 vn
.set_vn_version(elfcpp::VER_NEED_CURRENT
);
1160 vn
.set_vn_cnt(this->need_versions_
.size());
1161 vn
.set_vn_file(dynpool
->get_offset(this->filename()));
1162 vn
.set_vn_aux(verneed_size
);
1163 vn
.set_vn_next(is_last
1165 : verneed_size
+ this->need_versions_
.size() * vernaux_size
);
1168 Need_versions::const_iterator p
;
1170 for (p
= this->need_versions_
.begin(), i
= 0;
1171 p
!= this->need_versions_
.end();
1174 elfcpp::Vernaux_write
<size
, big_endian
> vna(pb
);
1175 vna
.set_vna_hash(Dynobj::elf_hash((*p
)->version()));
1176 // FIXME: We need to sometimes set VER_FLG_WEAK here.
1177 vna
.set_vna_flags(0);
1178 vna
.set_vna_other((*p
)->index());
1179 vna
.set_vna_name(dynpool
->get_offset((*p
)->version()));
1180 vna
.set_vna_next(i
+ 1 >= this->need_versions_
.size()
1189 // Versions methods.
1191 Versions::~Versions()
1193 for (Defs::iterator p
= this->defs_
.begin();
1194 p
!= this->defs_
.end();
1198 for (Needs::iterator p
= this->needs_
.begin();
1199 p
!= this->needs_
.end();
1204 // Record version information for a symbol going into the dynamic
1208 Versions::record_version(const General_options
* options
,
1209 Stringpool
* dynpool
, const Symbol
* sym
)
1211 gold_assert(!this->is_finalized_
);
1212 gold_assert(sym
->version() != NULL
);
1214 Stringpool::Key version_key
;
1215 const char* version
= dynpool
->add(sym
->version(), &version_key
);
1217 if (!sym
->is_from_dynobj())
1219 if (parameters
->output_is_shared())
1220 this->add_def(options
, sym
, version
, version_key
);
1224 // This is a version reference.
1226 Object
* object
= sym
->object();
1227 gold_assert(object
->is_dynamic());
1228 Dynobj
* dynobj
= static_cast<Dynobj
*>(object
);
1230 this->add_need(dynpool
, dynobj
->soname(), version
, version_key
);
1234 // We've found a symbol SYM defined in version VERSION.
1237 Versions::add_def(const General_options
* options
, const Symbol
* sym
,
1238 const char* version
, Stringpool::Key version_key
)
1240 Key
k(version_key
, 0);
1241 Version_base
* const vbnull
= NULL
;
1242 std::pair
<Version_table::iterator
, bool> ins
=
1243 this->version_table_
.insert(std::make_pair(k
, vbnull
));
1247 // We already have an entry for this version.
1248 Version_base
* vb
= ins
.first
->second
;
1250 // We have now seen a symbol in this version, so it is not
1254 // FIXME: When we support version scripts, we will need to
1255 // check whether this symbol should be forced local.
1259 // If we are creating a shared object, it is an error to
1260 // find a definition of a symbol with a version which is not
1261 // in the version script.
1262 if (parameters
->output_is_shared())
1264 fprintf(stderr
, _("%s: symbol %s has undefined version %s\n"),
1265 program_name
, sym
->name(), version
);
1269 // If this is the first version we are defining, first define
1270 // the base version. FIXME: Should use soname here when
1271 // creating a shared object.
1272 Verdef
* vdbase
= new Verdef(options
->output_file_name(), true, false,
1274 this->defs_
.push_back(vdbase
);
1276 // When creating a regular executable, automatically define
1278 Verdef
* vd
= new Verdef(version
, false, false, false);
1279 this->defs_
.push_back(vd
);
1280 ins
.first
->second
= vd
;
1284 // Add a reference to version NAME in file FILENAME.
1287 Versions::add_need(Stringpool
* dynpool
, const char* filename
, const char* name
,
1288 Stringpool::Key name_key
)
1290 Stringpool::Key filename_key
;
1291 filename
= dynpool
->add(filename
, &filename_key
);
1293 Key
k(name_key
, filename_key
);
1294 Version_base
* const vbnull
= NULL
;
1295 std::pair
<Version_table::iterator
, bool> ins
=
1296 this->version_table_
.insert(std::make_pair(k
, vbnull
));
1300 // We already have an entry for this filename/version.
1304 // See whether we already have this filename. We don't expect many
1305 // version references, so we just do a linear search. This could be
1306 // replaced by a hash table.
1308 for (Needs::iterator p
= this->needs_
.begin();
1309 p
!= this->needs_
.end();
1312 if ((*p
)->filename() == filename
)
1321 // We have a new filename.
1322 vn
= new Verneed(filename
);
1323 this->needs_
.push_back(vn
);
1326 ins
.first
->second
= vn
->add_name(name
);
1329 // Set the version indexes. Create a new dynamic version symbol for
1330 // each new version definition.
1333 Versions::finalize(const Target
* target
, Symbol_table
* symtab
,
1334 unsigned int dynsym_index
, std::vector
<Symbol
*>* syms
)
1336 gold_assert(!this->is_finalized_
);
1338 unsigned int vi
= 1;
1340 for (Defs::iterator p
= this->defs_
.begin();
1341 p
!= this->defs_
.end();
1344 (*p
)->set_index(vi
);
1347 // Create a version symbol if necessary.
1348 if (!(*p
)->is_symbol_created())
1350 Symbol
* vsym
= symtab
->define_as_constant(target
, (*p
)->name(),
1354 elfcpp::STV_DEFAULT
, 0,
1356 vsym
->set_needs_dynsym_entry();
1357 vsym
->set_dynsym_index(dynsym_index
);
1359 syms
->push_back(vsym
);
1360 // The name is already in the dynamic pool.
1364 // Index 1 is used for global symbols.
1367 gold_assert(this->defs_
.empty());
1371 for (Needs::iterator p
= this->needs_
.begin();
1372 p
!= this->needs_
.end();
1374 vi
= (*p
)->finalize(vi
);
1376 this->is_finalized_
= true;
1378 return dynsym_index
;
1381 // Return the version index to use for a symbol. This does two hash
1382 // table lookups: one in DYNPOOL and one in this->version_table_.
1383 // Another approach alternative would be store a pointer in SYM, which
1384 // would increase the size of the symbol table. Or perhaps we could
1385 // use a hash table from dynamic symbol pointer values to Version_base
1389 Versions::version_index(const Stringpool
* dynpool
, const Symbol
* sym
) const
1391 Stringpool::Key version_key
;
1392 const char* version
= dynpool
->find(sym
->version(), &version_key
);
1393 gold_assert(version
!= NULL
);
1396 if (!sym
->is_from_dynobj())
1398 if (!parameters
->output_is_shared())
1399 return elfcpp::VER_NDX_GLOBAL
;
1400 k
= Key(version_key
, 0);
1404 Object
* object
= sym
->object();
1405 gold_assert(object
->is_dynamic());
1406 Dynobj
* dynobj
= static_cast<Dynobj
*>(object
);
1408 Stringpool::Key filename_key
;
1409 const char* filename
= dynpool
->find(dynobj
->soname(), &filename_key
);
1410 gold_assert(filename
!= NULL
);
1412 k
= Key(version_key
, filename_key
);
1415 Version_table::const_iterator p
= this->version_table_
.find(k
);
1416 gold_assert(p
!= this->version_table_
.end());
1418 return p
->second
->index();
1421 // Return an allocated buffer holding the contents of the symbol
1424 template<int size
, bool big_endian
>
1426 Versions::symbol_section_contents(const Stringpool
* dynpool
,
1427 unsigned int local_symcount
,
1428 const std::vector
<Symbol
*>& syms
,
1431 ACCEPT_SIZE_ENDIAN
) const
1433 gold_assert(this->is_finalized_
);
1435 unsigned int sz
= (local_symcount
+ syms
.size()) * 2;
1436 unsigned char* pbuf
= new unsigned char[sz
];
1438 for (unsigned int i
= 0; i
< local_symcount
; ++i
)
1439 elfcpp::Swap
<16, big_endian
>::writeval(pbuf
+ i
* 2,
1440 elfcpp::VER_NDX_LOCAL
);
1442 for (std::vector
<Symbol
*>::const_iterator p
= syms
.begin();
1446 unsigned int version_index
;
1447 const char* version
= (*p
)->version();
1448 if (version
== NULL
)
1449 version_index
= elfcpp::VER_NDX_GLOBAL
;
1451 version_index
= this->version_index(dynpool
, *p
);
1452 elfcpp::Swap
<16, big_endian
>::writeval(pbuf
+ (*p
)->dynsym_index() * 2,
1460 // Return an allocated buffer holding the contents of the version
1461 // definition section.
1463 template<int size
, bool big_endian
>
1465 Versions::def_section_contents(const Stringpool
* dynpool
,
1466 unsigned char** pp
, unsigned int* psize
,
1467 unsigned int* pentries
1468 ACCEPT_SIZE_ENDIAN
) const
1470 gold_assert(this->is_finalized_
);
1471 gold_assert(!this->defs_
.empty());
1473 const int verdef_size
= elfcpp::Elf_sizes
<size
>::verdef_size
;
1474 const int verdaux_size
= elfcpp::Elf_sizes
<size
>::verdaux_size
;
1476 unsigned int sz
= 0;
1477 for (Defs::const_iterator p
= this->defs_
.begin();
1478 p
!= this->defs_
.end();
1481 sz
+= verdef_size
+ verdaux_size
;
1482 sz
+= (*p
)->count_dependencies() * verdaux_size
;
1485 unsigned char* pbuf
= new unsigned char[sz
];
1487 unsigned char* pb
= pbuf
;
1488 Defs::const_iterator p
;
1490 for (p
= this->defs_
.begin(), i
= 0;
1491 p
!= this->defs_
.end();
1493 pb
= (*p
)->write
SELECT_SIZE_ENDIAN_NAME(size
, big_endian
)(
1494 dynpool
, i
+ 1 >= this->defs_
.size(), pb
1495 SELECT_SIZE_ENDIAN(size
, big_endian
));
1497 gold_assert(static_cast<unsigned int>(pb
- pbuf
) == sz
);
1501 *pentries
= this->defs_
.size();
1504 // Return an allocated buffer holding the contents of the version
1505 // reference section.
1507 template<int size
, bool big_endian
>
1509 Versions::need_section_contents(const Stringpool
* dynpool
,
1510 unsigned char** pp
, unsigned int *psize
,
1511 unsigned int *pentries
1512 ACCEPT_SIZE_ENDIAN
) const
1514 gold_assert(this->is_finalized_
);
1515 gold_assert(!this->needs_
.empty());
1517 const int verneed_size
= elfcpp::Elf_sizes
<size
>::verneed_size
;
1518 const int vernaux_size
= elfcpp::Elf_sizes
<size
>::vernaux_size
;
1520 unsigned int sz
= 0;
1521 for (Needs::const_iterator p
= this->needs_
.begin();
1522 p
!= this->needs_
.end();
1526 sz
+= (*p
)->count_versions() * vernaux_size
;
1529 unsigned char* pbuf
= new unsigned char[sz
];
1531 unsigned char* pb
= pbuf
;
1532 Needs::const_iterator p
;
1534 for (p
= this->needs_
.begin(), i
= 0;
1535 p
!= this->needs_
.end();
1537 pb
= (*p
)->write
SELECT_SIZE_ENDIAN_NAME(size
, big_endian
)(
1538 dynpool
, i
+ 1 >= this->needs_
.size(), pb
1539 SELECT_SIZE_ENDIAN(size
, big_endian
));
1541 gold_assert(static_cast<unsigned int>(pb
- pbuf
) == sz
);
1545 *pentries
= this->needs_
.size();
1548 // Instantiate the templates we need. We could use the configure
1549 // script to restrict this to only the ones for implemented targets.
1551 #ifdef HAVE_TARGET_32_LITTLE
1553 class Sized_dynobj
<32, false>;
1556 #ifdef HAVE_TARGET_32_BIG
1558 class Sized_dynobj
<32, true>;
1561 #ifdef HAVE_TARGET_64_LITTLE
1563 class Sized_dynobj
<64, false>;
1566 #ifdef HAVE_TARGET_64_BIG
1568 class Sized_dynobj
<64, true>;
1571 #ifdef HAVE_TARGET_32_LITTLE
1574 Versions::symbol_section_contents
<32, false>(
1577 const std::vector
<Symbol
*>&,
1580 ACCEPT_SIZE_ENDIAN_EXPLICIT(32, false)) const;
1583 #ifdef HAVE_TARGET_32_BIG
1586 Versions::symbol_section_contents
<32, true>(
1589 const std::vector
<Symbol
*>&,
1592 ACCEPT_SIZE_ENDIAN_EXPLICIT(32, true)) const;
1595 #ifdef HAVE_TARGET_64_LITTLE
1598 Versions::symbol_section_contents
<64, false>(
1601 const std::vector
<Symbol
*>&,
1604 ACCEPT_SIZE_ENDIAN_EXPLICIT(64, false)) const;
1607 #ifdef HAVE_TARGET_64_BIG
1610 Versions::symbol_section_contents
<64, true>(
1613 const std::vector
<Symbol
*>&,
1616 ACCEPT_SIZE_ENDIAN_EXPLICIT(64, true)) const;
1619 #ifdef HAVE_TARGET_32_LITTLE
1622 Versions::def_section_contents
<32, false>(
1627 ACCEPT_SIZE_ENDIAN_EXPLICIT(32, false)) const;
1630 #ifdef HAVE_TARGET_32_BIG
1633 Versions::def_section_contents
<32, true>(
1638 ACCEPT_SIZE_ENDIAN_EXPLICIT(32, true)) const;
1641 #ifdef HAVE_TARGET_64_LITTLE
1644 Versions::def_section_contents
<64, false>(
1649 ACCEPT_SIZE_ENDIAN_EXPLICIT(64, false)) const;
1652 #ifdef HAVE_TARGET_64_BIG
1655 Versions::def_section_contents
<64, true>(
1660 ACCEPT_SIZE_ENDIAN_EXPLICIT(64, true)) const;
1663 #ifdef HAVE_TARGET_32_LITTLE
1666 Versions::need_section_contents
<32, false>(
1671 ACCEPT_SIZE_ENDIAN_EXPLICIT(32, false)) const;
1674 #ifdef HAVE_TARGET_32_BIG
1677 Versions::need_section_contents
<32, true>(
1682 ACCEPT_SIZE_ENDIAN_EXPLICIT(32, true)) const;
1685 #ifdef HAVE_TARGET_64_LITTLE
1688 Versions::need_section_contents
<64, false>(
1693 ACCEPT_SIZE_ENDIAN_EXPLICIT(64, false)) const;
1696 #ifdef HAVE_TARGET_64_BIG
1699 Versions::need_section_contents
<64, true>(
1704 ACCEPT_SIZE_ENDIAN_EXPLICIT(64, true)) const;
1707 } // End namespace gold.