1 // symtab.cc -- the gold symbol table
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.
33 #include "workqueue.h"
41 // Initialize fields in Symbol. This initializes everything except u_
45 Symbol::init_fields(const char* name
, const char* version
,
46 elfcpp::STT type
, elfcpp::STB binding
,
47 elfcpp::STV visibility
, unsigned char nonvis
)
50 this->version_
= version
;
51 this->symtab_index_
= 0;
52 this->dynsym_index_
= 0;
53 this->got_offset_
= 0;
54 this->plt_offset_
= 0;
56 this->binding_
= binding
;
57 this->visibility_
= visibility
;
58 this->nonvis_
= nonvis
;
59 this->is_target_special_
= false;
60 this->is_def_
= false;
61 this->is_forwarder_
= false;
62 this->needs_dynsym_entry_
= false;
63 this->in_reg_
= false;
64 this->in_dyn_
= false;
65 this->has_got_offset_
= false;
66 this->has_plt_offset_
= false;
67 this->has_warning_
= false;
70 // Initialize the fields in the base class Symbol for SYM in OBJECT.
72 template<int size
, bool big_endian
>
74 Symbol::init_base(const char* name
, const char* version
, Object
* object
,
75 const elfcpp::Sym
<size
, big_endian
>& sym
)
77 this->init_fields(name
, version
, sym
.get_st_type(), sym
.get_st_bind(),
78 sym
.get_st_visibility(), sym
.get_st_nonvis());
79 this->u_
.from_object
.object
= object
;
80 // FIXME: Handle SHN_XINDEX.
81 this->u_
.from_object
.shndx
= sym
.get_st_shndx();
82 this->source_
= FROM_OBJECT
;
83 this->in_reg_
= !object
->is_dynamic();
84 this->in_dyn_
= object
->is_dynamic();
87 // Initialize the fields in the base class Symbol for a symbol defined
91 Symbol::init_base(const char* name
, Output_data
* od
, elfcpp::STT type
,
92 elfcpp::STB binding
, elfcpp::STV visibility
,
93 unsigned char nonvis
, bool offset_is_from_end
)
95 this->init_fields(name
, NULL
, type
, binding
, visibility
, nonvis
);
96 this->u_
.in_output_data
.output_data
= od
;
97 this->u_
.in_output_data
.offset_is_from_end
= offset_is_from_end
;
98 this->source_
= IN_OUTPUT_DATA
;
102 // Initialize the fields in the base class Symbol for a symbol defined
103 // in an Output_segment.
106 Symbol::init_base(const char* name
, Output_segment
* os
, elfcpp::STT type
,
107 elfcpp::STB binding
, elfcpp::STV visibility
,
108 unsigned char nonvis
, Segment_offset_base offset_base
)
110 this->init_fields(name
, NULL
, type
, binding
, visibility
, nonvis
);
111 this->u_
.in_output_segment
.output_segment
= os
;
112 this->u_
.in_output_segment
.offset_base
= offset_base
;
113 this->source_
= IN_OUTPUT_SEGMENT
;
114 this->in_reg_
= true;
117 // Initialize the fields in the base class Symbol for a symbol defined
121 Symbol::init_base(const char* name
, elfcpp::STT type
,
122 elfcpp::STB binding
, elfcpp::STV visibility
,
123 unsigned char nonvis
)
125 this->init_fields(name
, NULL
, type
, binding
, visibility
, nonvis
);
126 this->source_
= CONSTANT
;
127 this->in_reg_
= true;
130 // Initialize the fields in Sized_symbol for SYM in OBJECT.
133 template<bool big_endian
>
135 Sized_symbol
<size
>::init(const char* name
, const char* version
, Object
* object
,
136 const elfcpp::Sym
<size
, big_endian
>& sym
)
138 this->init_base(name
, version
, object
, sym
);
139 this->value_
= sym
.get_st_value();
140 this->symsize_
= sym
.get_st_size();
143 // Initialize the fields in Sized_symbol for a symbol defined in an
148 Sized_symbol
<size
>::init(const char* name
, Output_data
* od
,
149 Value_type value
, Size_type symsize
,
150 elfcpp::STT type
, elfcpp::STB binding
,
151 elfcpp::STV visibility
, unsigned char nonvis
,
152 bool offset_is_from_end
)
154 this->init_base(name
, od
, type
, binding
, visibility
, nonvis
,
156 this->value_
= value
;
157 this->symsize_
= symsize
;
160 // Initialize the fields in Sized_symbol for a symbol defined in an
165 Sized_symbol
<size
>::init(const char* name
, Output_segment
* os
,
166 Value_type value
, Size_type symsize
,
167 elfcpp::STT type
, elfcpp::STB binding
,
168 elfcpp::STV visibility
, unsigned char nonvis
,
169 Segment_offset_base offset_base
)
171 this->init_base(name
, os
, type
, binding
, visibility
, nonvis
, offset_base
);
172 this->value_
= value
;
173 this->symsize_
= symsize
;
176 // Initialize the fields in Sized_symbol for a symbol defined as a
181 Sized_symbol
<size
>::init(const char* name
, Value_type value
, Size_type symsize
,
182 elfcpp::STT type
, elfcpp::STB binding
,
183 elfcpp::STV visibility
, unsigned char nonvis
)
185 this->init_base(name
, type
, binding
, visibility
, nonvis
);
186 this->value_
= value
;
187 this->symsize_
= symsize
;
190 // Class Symbol_table.
192 Symbol_table::Symbol_table()
193 : size_(0), saw_undefined_(0), offset_(0), table_(), namepool_(),
194 forwarders_(), commons_(), warnings_()
198 Symbol_table::~Symbol_table()
202 // The hash function. The key is always canonicalized, so we use a
203 // simple combination of the pointers.
206 Symbol_table::Symbol_table_hash::operator()(const Symbol_table_key
& key
) const
208 return key
.first
^ key
.second
;
211 // The symbol table key equality function. This is only called with
212 // canonicalized name and version strings, so we can use pointer
216 Symbol_table::Symbol_table_eq::operator()(const Symbol_table_key
& k1
,
217 const Symbol_table_key
& k2
) const
219 return k1
.first
== k2
.first
&& k1
.second
== k2
.second
;
222 // Make TO a symbol which forwards to FROM.
225 Symbol_table::make_forwarder(Symbol
* from
, Symbol
* to
)
227 gold_assert(from
!= to
);
228 gold_assert(!from
->is_forwarder() && !to
->is_forwarder());
229 this->forwarders_
[from
] = to
;
230 from
->set_forwarder();
233 // Resolve the forwards from FROM, returning the real symbol.
236 Symbol_table::resolve_forwards(const Symbol
* from
) const
238 gold_assert(from
->is_forwarder());
239 Unordered_map
<const Symbol
*, Symbol
*>::const_iterator p
=
240 this->forwarders_
.find(from
);
241 gold_assert(p
!= this->forwarders_
.end());
245 // Look up a symbol by name.
248 Symbol_table::lookup(const char* name
, const char* version
) const
250 Stringpool::Key name_key
;
251 name
= this->namepool_
.find(name
, &name_key
);
255 Stringpool::Key version_key
= 0;
258 version
= this->namepool_
.find(version
, &version_key
);
263 Symbol_table_key
key(name_key
, version_key
);
264 Symbol_table::Symbol_table_type::const_iterator p
= this->table_
.find(key
);
265 if (p
== this->table_
.end())
270 // Resolve a Symbol with another Symbol. This is only used in the
271 // unusual case where there are references to both an unversioned
272 // symbol and a symbol with a version, and we then discover that that
273 // version is the default version. Because this is unusual, we do
274 // this the slow way, by converting back to an ELF symbol.
276 template<int size
, bool big_endian
>
278 Symbol_table::resolve(Sized_symbol
<size
>* to
, const Sized_symbol
<size
>* from
,
279 const char* version ACCEPT_SIZE_ENDIAN
)
281 unsigned char buf
[elfcpp::Elf_sizes
<size
>::sym_size
];
282 elfcpp::Sym_write
<size
, big_endian
> esym(buf
);
283 // We don't bother to set the st_name field.
284 esym
.put_st_value(from
->value());
285 esym
.put_st_size(from
->symsize());
286 esym
.put_st_info(from
->binding(), from
->type());
287 esym
.put_st_other(from
->visibility(), from
->nonvis());
288 esym
.put_st_shndx(from
->shndx());
289 Symbol_table::resolve(to
, esym
.sym(), from
->object(), version
);
296 // Add one symbol from OBJECT to the symbol table. NAME is symbol
297 // name and VERSION is the version; both are canonicalized. DEF is
298 // whether this is the default version.
300 // If DEF is true, then this is the definition of a default version of
301 // a symbol. That means that any lookup of NAME/NULL and any lookup
302 // of NAME/VERSION should always return the same symbol. This is
303 // obvious for references, but in particular we want to do this for
304 // definitions: overriding NAME/NULL should also override
305 // NAME/VERSION. If we don't do that, it would be very hard to
306 // override functions in a shared library which uses versioning.
308 // We implement this by simply making both entries in the hash table
309 // point to the same Symbol structure. That is easy enough if this is
310 // the first time we see NAME/NULL or NAME/VERSION, but it is possible
311 // that we have seen both already, in which case they will both have
312 // independent entries in the symbol table. We can't simply change
313 // the symbol table entry, because we have pointers to the entries
314 // attached to the object files. So we mark the entry attached to the
315 // object file as a forwarder, and record it in the forwarders_ map.
316 // Note that entries in the hash table will never be marked as
319 template<int size
, bool big_endian
>
321 Symbol_table::add_from_object(Object
* object
,
323 Stringpool::Key name_key
,
325 Stringpool::Key version_key
,
327 const elfcpp::Sym
<size
, big_endian
>& sym
)
329 Symbol
* const snull
= NULL
;
330 std::pair
<typename
Symbol_table_type::iterator
, bool> ins
=
331 this->table_
.insert(std::make_pair(std::make_pair(name_key
, version_key
),
334 std::pair
<typename
Symbol_table_type::iterator
, bool> insdef
=
335 std::make_pair(this->table_
.end(), false);
338 const Stringpool::Key vnull_key
= 0;
339 insdef
= this->table_
.insert(std::make_pair(std::make_pair(name_key
,
344 // ins.first: an iterator, which is a pointer to a pair.
345 // ins.first->first: the key (a pair of name and version).
346 // ins.first->second: the value (Symbol*).
347 // ins.second: true if new entry was inserted, false if not.
349 Sized_symbol
<size
>* ret
;
354 // We already have an entry for NAME/VERSION.
355 ret
= this->get_sized_symbol
SELECT_SIZE_NAME(size
) (ins
.first
->second
357 gold_assert(ret
!= NULL
);
359 was_undefined
= ret
->is_undefined();
360 was_common
= ret
->is_common();
362 Symbol_table::resolve(ret
, sym
, object
, version
);
368 // This is the first time we have seen NAME/NULL. Make
369 // NAME/NULL point to NAME/VERSION.
370 insdef
.first
->second
= ret
;
372 else if (insdef
.first
->second
!= ret
)
374 // This is the unfortunate case where we already have
375 // entries for both NAME/VERSION and NAME/NULL.
376 const Sized_symbol
<size
>* sym2
;
377 sym2
= this->get_sized_symbol
SELECT_SIZE_NAME(size
) (
380 Symbol_table::resolve
SELECT_SIZE_ENDIAN_NAME(size
, big_endian
) (
381 ret
, sym2
, version
SELECT_SIZE_ENDIAN(size
, big_endian
));
382 this->make_forwarder(insdef
.first
->second
, ret
);
383 insdef
.first
->second
= ret
;
389 // This is the first time we have seen NAME/VERSION.
390 gold_assert(ins
.first
->second
== NULL
);
392 was_undefined
= false;
395 if (def
&& !insdef
.second
)
397 // We already have an entry for NAME/NULL. If we override
398 // it, then change it to NAME/VERSION.
399 ret
= this->get_sized_symbol
SELECT_SIZE_NAME(size
) (
402 Symbol_table::resolve(ret
, sym
, object
, version
);
403 ins
.first
->second
= ret
;
407 Sized_target
<size
, big_endian
>* target
=
408 object
->sized_target
SELECT_SIZE_ENDIAN_NAME(size
, big_endian
) (
409 SELECT_SIZE_ENDIAN_ONLY(size
, big_endian
));
410 if (!target
->has_make_symbol())
411 ret
= new Sized_symbol
<size
>();
414 ret
= target
->make_symbol();
417 // This means that we don't want a symbol table
420 this->table_
.erase(ins
.first
);
423 this->table_
.erase(insdef
.first
);
424 // Inserting insdef invalidated ins.
425 this->table_
.erase(std::make_pair(name_key
,
432 ret
->init(name
, version
, object
, sym
);
434 ins
.first
->second
= ret
;
437 // This is the first time we have seen NAME/NULL. Point
438 // it at the new entry for NAME/VERSION.
439 gold_assert(insdef
.second
);
440 insdef
.first
->second
= ret
;
445 // Record every time we see a new undefined symbol, to speed up
447 if (!was_undefined
&& ret
->is_undefined())
448 ++this->saw_undefined_
;
450 // Keep track of common symbols, to speed up common symbol
452 if (!was_common
&& ret
->is_common())
453 this->commons_
.push_back(ret
);
458 // Add all the symbols in a relocatable object to the hash table.
460 template<int size
, bool big_endian
>
462 Symbol_table::add_from_relobj(
463 Sized_relobj
<size
, big_endian
>* relobj
,
464 const unsigned char* syms
,
466 const char* sym_names
,
467 size_t sym_name_size
,
468 Symbol
** sympointers
)
470 // We take the size from the first object we see.
471 if (this->get_size() == 0)
472 this->set_size(size
);
474 if (size
!= this->get_size() || size
!= relobj
->target()->get_size())
476 fprintf(stderr
, _("%s: %s: mixing 32-bit and 64-bit ELF objects\n"),
477 program_name
, relobj
->name().c_str());
481 const int sym_size
= elfcpp::Elf_sizes
<size
>::sym_size
;
483 const unsigned char* p
= syms
;
484 for (size_t i
= 0; i
< count
; ++i
, p
+= sym_size
)
486 elfcpp::Sym
<size
, big_endian
> sym(p
);
487 elfcpp::Sym
<size
, big_endian
>* psym
= &sym
;
489 unsigned int st_name
= psym
->get_st_name();
490 if (st_name
>= sym_name_size
)
493 _("%s: %s: bad global symbol name offset %u at %lu\n"),
494 program_name
, relobj
->name().c_str(), st_name
,
495 static_cast<unsigned long>(i
));
499 const char* name
= sym_names
+ st_name
;
501 // A symbol defined in a section which we are not including must
502 // be treated as an undefined symbol.
503 unsigned char symbuf
[sym_size
];
504 elfcpp::Sym
<size
, big_endian
> sym2(symbuf
);
505 unsigned int st_shndx
= psym
->get_st_shndx();
506 if (st_shndx
!= elfcpp::SHN_UNDEF
507 && st_shndx
< elfcpp::SHN_LORESERVE
508 && !relobj
->is_section_included(st_shndx
))
510 memcpy(symbuf
, p
, sym_size
);
511 elfcpp::Sym_write
<size
, big_endian
> sw(symbuf
);
512 sw
.put_st_shndx(elfcpp::SHN_UNDEF
);
516 // In an object file, an '@' in the name separates the symbol
517 // name from the version name. If there are two '@' characters,
518 // this is the default version.
519 const char* ver
= strchr(name
, '@');
524 Stringpool::Key name_key
;
525 name
= this->namepool_
.add(name
, &name_key
);
526 res
= this->add_from_object(relobj
, name
, name_key
, NULL
, 0,
531 Stringpool::Key name_key
;
532 name
= this->namepool_
.add(name
, ver
- name
, &name_key
);
542 Stringpool::Key ver_key
;
543 ver
= this->namepool_
.add(ver
, &ver_key
);
545 res
= this->add_from_object(relobj
, name
, name_key
, ver
, ver_key
,
549 *sympointers
++ = res
;
553 // Add all the symbols in a dynamic object to the hash table.
555 template<int size
, bool big_endian
>
557 Symbol_table::add_from_dynobj(
558 Sized_dynobj
<size
, big_endian
>* dynobj
,
559 const unsigned char* syms
,
561 const char* sym_names
,
562 size_t sym_name_size
,
563 const unsigned char* versym
,
565 const std::vector
<const char*>* version_map
)
567 // We take the size from the first object we see.
568 if (this->get_size() == 0)
569 this->set_size(size
);
571 if (size
!= this->get_size() || size
!= dynobj
->target()->get_size())
573 fprintf(stderr
, _("%s: %s: mixing 32-bit and 64-bit ELF objects\n"),
574 program_name
, dynobj
->name().c_str());
578 if (versym
!= NULL
&& versym_size
/ 2 < count
)
580 fprintf(stderr
, _("%s: %s: too few symbol versions\n"),
581 program_name
, dynobj
->name().c_str());
585 const int sym_size
= elfcpp::Elf_sizes
<size
>::sym_size
;
587 const unsigned char* p
= syms
;
588 const unsigned char* vs
= versym
;
589 for (size_t i
= 0; i
< count
; ++i
, p
+= sym_size
, vs
+= 2)
591 elfcpp::Sym
<size
, big_endian
> sym(p
);
593 // Ignore symbols with local binding.
594 if (sym
.get_st_bind() == elfcpp::STB_LOCAL
)
597 unsigned int st_name
= sym
.get_st_name();
598 if (st_name
>= sym_name_size
)
600 fprintf(stderr
, _("%s: %s: bad symbol name offset %u at %lu\n"),
601 program_name
, dynobj
->name().c_str(), st_name
,
602 static_cast<unsigned long>(i
));
606 const char* name
= sym_names
+ st_name
;
610 Stringpool::Key name_key
;
611 name
= this->namepool_
.add(name
, &name_key
);
612 this->add_from_object(dynobj
, name
, name_key
, NULL
, 0,
617 // Read the version information.
619 unsigned int v
= elfcpp::Swap
<16, big_endian
>::readval(vs
);
621 bool hidden
= (v
& elfcpp::VERSYM_HIDDEN
) != 0;
622 v
&= elfcpp::VERSYM_VERSION
;
624 // The Sun documentation says that V can be VER_NDX_LOCAL, or
625 // VER_NDX_GLOBAL, or a version index. The meaning of
626 // VER_NDX_LOCAL is defined as "Symbol has local scope." The
627 // old GNU linker will happily generate VER_NDX_LOCAL for an
628 // undefined symbol. I don't know what the Sun linker will
631 if (v
== static_cast<unsigned int>(elfcpp::VER_NDX_LOCAL
)
632 && sym
.get_st_shndx() != elfcpp::SHN_UNDEF
)
634 // This symbol should not be visible outside the object.
638 // At this point we are definitely going to add this symbol.
639 Stringpool::Key name_key
;
640 name
= this->namepool_
.add(name
, &name_key
);
642 if (v
== static_cast<unsigned int>(elfcpp::VER_NDX_LOCAL
)
643 || v
== static_cast<unsigned int>(elfcpp::VER_NDX_GLOBAL
))
645 // This symbol does not have a version.
646 this->add_from_object(dynobj
, name
, name_key
, NULL
, 0, false, sym
);
650 if (v
>= version_map
->size())
653 _("%s: %s: versym for symbol %zu out of range: %u\n"),
654 program_name
, dynobj
->name().c_str(), i
, v
);
658 const char* version
= (*version_map
)[v
];
661 fprintf(stderr
, _("%s: %s: versym for symbol %zu has no name: %u\n"),
662 program_name
, dynobj
->name().c_str(), i
, v
);
666 Stringpool::Key version_key
;
667 version
= this->namepool_
.add(version
, &version_key
);
669 // If this is an absolute symbol, and the version name and
670 // symbol name are the same, then this is the version definition
671 // symbol. These symbols exist to support using -u to pull in
672 // particular versions. We do not want to record a version for
674 if (sym
.get_st_shndx() == elfcpp::SHN_ABS
&& name_key
== version_key
)
676 this->add_from_object(dynobj
, name
, name_key
, NULL
, 0, false, sym
);
680 const bool def
= !hidden
&& sym
.get_st_shndx() != elfcpp::SHN_UNDEF
;
682 this->add_from_object(dynobj
, name
, name_key
, version
, version_key
,
687 // Create and return a specially defined symbol. If ONLY_IF_REF is
688 // true, then only create the symbol if there is a reference to it.
689 // If this does not return NULL, it sets *POLDSYM to the existing
690 // symbol if there is one. This canonicalizes *PNAME and *PVERSION.
692 template<int size
, bool big_endian
>
694 Symbol_table::define_special_symbol(const Target
* target
, const char** pname
,
695 const char** pversion
, bool only_if_ref
,
696 Sized_symbol
<size
>** poldsym
699 gold_assert(this->size_
== size
);
702 Sized_symbol
<size
>* sym
;
703 bool add_to_table
= false;
704 typename
Symbol_table_type::iterator add_loc
= this->table_
.end();
708 oldsym
= this->lookup(*pname
, *pversion
);
709 if (oldsym
== NULL
|| !oldsym
->is_undefined())
712 *pname
= oldsym
->name();
713 *pversion
= oldsym
->version();
717 // Canonicalize NAME and VERSION.
718 Stringpool::Key name_key
;
719 *pname
= this->namepool_
.add(*pname
, &name_key
);
721 Stringpool::Key version_key
= 0;
722 if (*pversion
!= NULL
)
723 *pversion
= this->namepool_
.add(*pversion
, &version_key
);
725 Symbol
* const snull
= NULL
;
726 std::pair
<typename
Symbol_table_type::iterator
, bool> ins
=
727 this->table_
.insert(std::make_pair(std::make_pair(name_key
,
733 // We already have a symbol table entry for NAME/VERSION.
734 oldsym
= ins
.first
->second
;
735 gold_assert(oldsym
!= NULL
);
739 // We haven't seen this symbol before.
740 gold_assert(ins
.first
->second
== NULL
);
747 if (!target
->has_make_symbol())
748 sym
= new Sized_symbol
<size
>();
751 gold_assert(target
->get_size() == size
);
752 gold_assert(target
->is_big_endian() ? big_endian
: !big_endian
);
753 typedef Sized_target
<size
, big_endian
> My_target
;
754 const My_target
* sized_target
=
755 static_cast<const My_target
*>(target
);
756 sym
= sized_target
->make_symbol();
762 add_loc
->second
= sym
;
764 gold_assert(oldsym
!= NULL
);
766 *poldsym
= this->get_sized_symbol
SELECT_SIZE_NAME(size
) (oldsym
772 // Define a symbol based on an Output_data.
775 Symbol_table::define_in_output_data(const Target
* target
, const char* name
,
776 const char* version
, Output_data
* od
,
777 uint64_t value
, uint64_t symsize
,
778 elfcpp::STT type
, elfcpp::STB binding
,
779 elfcpp::STV visibility
,
780 unsigned char nonvis
,
781 bool offset_is_from_end
,
784 gold_assert(target
->get_size() == this->size_
);
785 if (this->size_
== 32)
787 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
788 return this->do_define_in_output_data
<32>(target
, name
, version
, od
,
789 value
, symsize
, type
, binding
,
797 else if (this->size_
== 64)
799 #if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
800 return this->do_define_in_output_data
<64>(target
, name
, version
, od
,
801 value
, symsize
, type
, binding
,
813 // Define a symbol in an Output_data, sized version.
817 Symbol_table::do_define_in_output_data(
818 const Target
* target
,
822 typename
elfcpp::Elf_types
<size
>::Elf_Addr value
,
823 typename
elfcpp::Elf_types
<size
>::Elf_WXword symsize
,
826 elfcpp::STV visibility
,
827 unsigned char nonvis
,
828 bool offset_is_from_end
,
831 Sized_symbol
<size
>* sym
;
832 Sized_symbol
<size
>* oldsym
;
834 if (target
->is_big_endian())
836 #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
837 sym
= this->define_special_symbol
SELECT_SIZE_ENDIAN_NAME(size
, true) (
838 target
, &name
, &version
, only_if_ref
, &oldsym
839 SELECT_SIZE_ENDIAN(size
, true));
846 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
847 sym
= this->define_special_symbol
SELECT_SIZE_ENDIAN_NAME(size
, false) (
848 target
, &name
, &version
, only_if_ref
, &oldsym
849 SELECT_SIZE_ENDIAN(size
, false));
858 gold_assert(version
== NULL
|| oldsym
!= NULL
);
859 sym
->init(name
, od
, value
, symsize
, type
, binding
, visibility
, nonvis
,
863 && Symbol_table::should_override_with_special(oldsym
))
864 oldsym
->override_with_special(sym
);
869 // Define a symbol based on an Output_segment.
872 Symbol_table::define_in_output_segment(const Target
* target
, const char* name
,
873 const char* version
, Output_segment
* os
,
874 uint64_t value
, uint64_t symsize
,
875 elfcpp::STT type
, elfcpp::STB binding
,
876 elfcpp::STV visibility
,
877 unsigned char nonvis
,
878 Symbol::Segment_offset_base offset_base
,
881 gold_assert(target
->get_size() == this->size_
);
882 if (this->size_
== 32)
884 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
885 return this->do_define_in_output_segment
<32>(target
, name
, version
, os
,
886 value
, symsize
, type
,
887 binding
, visibility
, nonvis
,
888 offset_base
, only_if_ref
);
893 else if (this->size_
== 64)
895 #if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
896 return this->do_define_in_output_segment
<64>(target
, name
, version
, os
,
897 value
, symsize
, type
,
898 binding
, visibility
, nonvis
,
899 offset_base
, only_if_ref
);
908 // Define a symbol in an Output_segment, sized version.
912 Symbol_table::do_define_in_output_segment(
913 const Target
* target
,
917 typename
elfcpp::Elf_types
<size
>::Elf_Addr value
,
918 typename
elfcpp::Elf_types
<size
>::Elf_WXword symsize
,
921 elfcpp::STV visibility
,
922 unsigned char nonvis
,
923 Symbol::Segment_offset_base offset_base
,
926 Sized_symbol
<size
>* sym
;
927 Sized_symbol
<size
>* oldsym
;
929 if (target
->is_big_endian())
930 sym
= this->define_special_symbol
SELECT_SIZE_ENDIAN_NAME(size
, true) (
931 target
, &name
, &version
, only_if_ref
, &oldsym
932 SELECT_SIZE_ENDIAN(size
, true));
934 sym
= this->define_special_symbol
SELECT_SIZE_ENDIAN_NAME(size
, false) (
935 target
, &name
, &version
, only_if_ref
, &oldsym
936 SELECT_SIZE_ENDIAN(size
, false));
941 gold_assert(version
== NULL
|| oldsym
!= NULL
);
942 sym
->init(name
, os
, value
, symsize
, type
, binding
, visibility
, nonvis
,
946 && Symbol_table::should_override_with_special(oldsym
))
947 oldsym
->override_with_special(sym
);
952 // Define a special symbol with a constant value. It is a multiple
953 // definition error if this symbol is already defined.
956 Symbol_table::define_as_constant(const Target
* target
, const char* name
,
957 const char* version
, uint64_t value
,
958 uint64_t symsize
, elfcpp::STT type
,
959 elfcpp::STB binding
, elfcpp::STV visibility
,
960 unsigned char nonvis
, bool only_if_ref
)
962 gold_assert(target
->get_size() == this->size_
);
963 if (this->size_
== 32)
965 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
966 return this->do_define_as_constant
<32>(target
, name
, version
, value
,
967 symsize
, type
, binding
,
968 visibility
, nonvis
, only_if_ref
);
973 else if (this->size_
== 64)
975 #if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
976 return this->do_define_as_constant
<64>(target
, name
, version
, value
,
977 symsize
, type
, binding
,
978 visibility
, nonvis
, only_if_ref
);
987 // Define a symbol as a constant, sized version.
991 Symbol_table::do_define_as_constant(
992 const Target
* target
,
995 typename
elfcpp::Elf_types
<size
>::Elf_Addr value
,
996 typename
elfcpp::Elf_types
<size
>::Elf_WXword symsize
,
999 elfcpp::STV visibility
,
1000 unsigned char nonvis
,
1003 Sized_symbol
<size
>* sym
;
1004 Sized_symbol
<size
>* oldsym
;
1006 if (target
->is_big_endian())
1007 sym
= this->define_special_symbol
SELECT_SIZE_ENDIAN_NAME(size
, true) (
1008 target
, &name
, &version
, only_if_ref
, &oldsym
1009 SELECT_SIZE_ENDIAN(size
, true));
1011 sym
= this->define_special_symbol
SELECT_SIZE_ENDIAN_NAME(size
, false) (
1012 target
, &name
, &version
, only_if_ref
, &oldsym
1013 SELECT_SIZE_ENDIAN(size
, false));
1018 gold_assert(version
== NULL
|| oldsym
!= NULL
);
1019 sym
->init(name
, value
, symsize
, type
, binding
, visibility
, nonvis
);
1022 && Symbol_table::should_override_with_special(oldsym
))
1023 oldsym
->override_with_special(sym
);
1028 // Define a set of symbols in output sections.
1031 Symbol_table::define_symbols(const Layout
* layout
, const Target
* target
,
1032 int count
, const Define_symbol_in_section
* p
)
1034 for (int i
= 0; i
< count
; ++i
, ++p
)
1036 Output_section
* os
= layout
->find_output_section(p
->output_section
);
1038 this->define_in_output_data(target
, p
->name
, NULL
, os
, p
->value
,
1039 p
->size
, p
->type
, p
->binding
,
1040 p
->visibility
, p
->nonvis
,
1041 p
->offset_is_from_end
, p
->only_if_ref
);
1043 this->define_as_constant(target
, p
->name
, NULL
, 0, p
->size
, p
->type
,
1044 p
->binding
, p
->visibility
, p
->nonvis
,
1049 // Define a set of symbols in output segments.
1052 Symbol_table::define_symbols(const Layout
* layout
, const Target
* target
,
1053 int count
, const Define_symbol_in_segment
* p
)
1055 for (int i
= 0; i
< count
; ++i
, ++p
)
1057 Output_segment
* os
= layout
->find_output_segment(p
->segment_type
,
1058 p
->segment_flags_set
,
1059 p
->segment_flags_clear
);
1061 this->define_in_output_segment(target
, p
->name
, NULL
, os
, p
->value
,
1062 p
->size
, p
->type
, p
->binding
,
1063 p
->visibility
, p
->nonvis
,
1064 p
->offset_base
, p
->only_if_ref
);
1066 this->define_as_constant(target
, p
->name
, NULL
, 0, p
->size
, p
->type
,
1067 p
->binding
, p
->visibility
, p
->nonvis
,
1072 // Set the dynamic symbol indexes. INDEX is the index of the first
1073 // global dynamic symbol. Pointers to the symbols are stored into the
1074 // vector SYMS. The names are added to DYNPOOL. This returns an
1075 // updated dynamic symbol index.
1078 Symbol_table::set_dynsym_indexes(const General_options
* options
,
1079 const Target
* target
,
1081 std::vector
<Symbol
*>* syms
,
1082 Stringpool
* dynpool
,
1085 for (Symbol_table_type::iterator p
= this->table_
.begin();
1086 p
!= this->table_
.end();
1089 Symbol
* sym
= p
->second
;
1091 // Note that SYM may already have a dynamic symbol index, since
1092 // some symbols appear more than once in the symbol table, with
1093 // and without a version.
1095 if (!sym
->needs_dynsym_entry()
1096 && (!options
->export_dynamic()
1098 || !sym
->is_externally_visible()))
1099 sym
->set_dynsym_index(-1U);
1100 else if (!sym
->has_dynsym_index())
1102 sym
->set_dynsym_index(index
);
1104 syms
->push_back(sym
);
1105 dynpool
->add(sym
->name(), NULL
);
1107 // Record any version information.
1108 if (sym
->version() != NULL
)
1109 versions
->record_version(options
, dynpool
, sym
);
1113 // Finish up the versions. In some cases this may add new dynamic
1115 index
= versions
->finalize(target
, this, index
, syms
);
1120 // Set the final values for all the symbols. The index of the first
1121 // global symbol in the output file is INDEX. Record the file offset
1122 // OFF. Add their names to POOL. Return the new file offset.
1125 Symbol_table::finalize(unsigned int index
, off_t off
, off_t dynoff
,
1126 size_t dyn_global_index
, size_t dyncount
,
1131 gold_assert(index
!= 0);
1132 this->first_global_index_
= index
;
1134 this->dynamic_offset_
= dynoff
;
1135 this->first_dynamic_global_index_
= dyn_global_index
;
1136 this->dynamic_count_
= dyncount
;
1138 if (this->size_
== 32)
1139 ret
= this->sized_finalize
<32>(index
, off
, pool
);
1140 else if (this->size_
== 64)
1141 ret
= this->sized_finalize
<64>(index
, off
, pool
);
1145 // Now that we have the final symbol table, we can reliably note
1146 // which symbols should get warnings.
1147 this->warnings_
.note_warnings(this);
1152 // Set the final value for all the symbols. This is called after
1153 // Layout::finalize, so all the output sections have their final
1158 Symbol_table::sized_finalize(unsigned index
, off_t off
, Stringpool
* pool
)
1160 off
= align_address(off
, size
>> 3);
1161 this->offset_
= off
;
1163 size_t orig_index
= index
;
1165 const int sym_size
= elfcpp::Elf_sizes
<size
>::sym_size
;
1166 for (Symbol_table_type::iterator p
= this->table_
.begin();
1167 p
!= this->table_
.end();
1170 Sized_symbol
<size
>* sym
= static_cast<Sized_symbol
<size
>*>(p
->second
);
1172 // FIXME: Here we need to decide which symbols should go into
1173 // the output file, based on --strip.
1175 // The default version of a symbol may appear twice in the
1176 // symbol table. We only need to finalize it once.
1177 if (sym
->has_symtab_index())
1182 gold_assert(!sym
->has_symtab_index());
1183 sym
->set_symtab_index(-1U);
1184 gold_assert(sym
->dynsym_index() == -1U);
1188 typename Sized_symbol
<size
>::Value_type value
;
1190 switch (sym
->source())
1192 case Symbol::FROM_OBJECT
:
1194 unsigned int shndx
= sym
->shndx();
1196 // FIXME: We need some target specific support here.
1197 if (shndx
>= elfcpp::SHN_LORESERVE
1198 && shndx
!= elfcpp::SHN_ABS
)
1200 fprintf(stderr
, _("%s: %s: unsupported symbol section 0x%x\n"),
1201 program_name
, sym
->name(), shndx
);
1205 Object
* symobj
= sym
->object();
1206 if (symobj
->is_dynamic())
1209 shndx
= elfcpp::SHN_UNDEF
;
1211 else if (shndx
== elfcpp::SHN_UNDEF
)
1213 else if (shndx
== elfcpp::SHN_ABS
)
1214 value
= sym
->value();
1217 Relobj
* relobj
= static_cast<Relobj
*>(symobj
);
1219 Output_section
* os
= relobj
->output_section(shndx
, &secoff
);
1223 sym
->set_symtab_index(-1U);
1224 gold_assert(sym
->dynsym_index() == -1U);
1228 value
= sym
->value() + os
->address() + secoff
;
1233 case Symbol::IN_OUTPUT_DATA
:
1235 Output_data
* od
= sym
->output_data();
1236 value
= sym
->value() + od
->address();
1237 if (sym
->offset_is_from_end())
1238 value
+= od
->data_size();
1242 case Symbol::IN_OUTPUT_SEGMENT
:
1244 Output_segment
* os
= sym
->output_segment();
1245 value
= sym
->value() + os
->vaddr();
1246 switch (sym
->offset_base())
1248 case Symbol::SEGMENT_START
:
1250 case Symbol::SEGMENT_END
:
1251 value
+= os
->memsz();
1253 case Symbol::SEGMENT_BSS
:
1254 value
+= os
->filesz();
1262 case Symbol::CONSTANT
:
1263 value
= sym
->value();
1270 sym
->set_value(value
);
1271 sym
->set_symtab_index(index
);
1272 pool
->add(sym
->name(), NULL
);
1277 this->output_count_
= index
- orig_index
;
1282 // Write out the global symbols.
1285 Symbol_table::write_globals(const Target
* target
, const Stringpool
* sympool
,
1286 const Stringpool
* dynpool
, Output_file
* of
) const
1288 if (this->size_
== 32)
1290 if (target
->is_big_endian())
1291 this->sized_write_globals
<32, true>(target
, sympool
, dynpool
, of
);
1293 this->sized_write_globals
<32, false>(target
, sympool
, dynpool
, of
);
1295 else if (this->size_
== 64)
1297 if (target
->is_big_endian())
1298 this->sized_write_globals
<64, true>(target
, sympool
, dynpool
, of
);
1300 this->sized_write_globals
<64, false>(target
, sympool
, dynpool
, of
);
1306 // Write out the global symbols.
1308 template<int size
, bool big_endian
>
1310 Symbol_table::sized_write_globals(const Target
* target
,
1311 const Stringpool
* sympool
,
1312 const Stringpool
* dynpool
,
1313 Output_file
* of
) const
1315 const int sym_size
= elfcpp::Elf_sizes
<size
>::sym_size
;
1316 unsigned int index
= this->first_global_index_
;
1317 const off_t oview_size
= this->output_count_
* sym_size
;
1318 unsigned char* const psyms
= of
->get_output_view(this->offset_
, oview_size
);
1320 unsigned int dynamic_count
= this->dynamic_count_
;
1321 off_t dynamic_size
= dynamic_count
* sym_size
;
1322 unsigned int first_dynamic_global_index
= this->first_dynamic_global_index_
;
1323 unsigned char* dynamic_view
;
1324 if (this->dynamic_offset_
== 0)
1325 dynamic_view
= NULL
;
1327 dynamic_view
= of
->get_output_view(this->dynamic_offset_
, dynamic_size
);
1329 unsigned char* ps
= psyms
;
1330 for (Symbol_table_type::const_iterator p
= this->table_
.begin();
1331 p
!= this->table_
.end();
1334 Sized_symbol
<size
>* sym
= static_cast<Sized_symbol
<size
>*>(p
->second
);
1336 unsigned int sym_index
= sym
->symtab_index();
1337 unsigned int dynsym_index
;
1338 if (dynamic_view
== NULL
)
1341 dynsym_index
= sym
->dynsym_index();
1343 if (sym_index
== -1U && dynsym_index
== -1U)
1345 // This symbol is not included in the output file.
1349 if (sym_index
== index
)
1351 else if (sym_index
!= -1U)
1353 // We have already seen this symbol, because it has a
1355 gold_assert(sym_index
< index
);
1356 if (dynsym_index
== -1U)
1362 typename
elfcpp::Elf_types
<32>::Elf_Addr value
= sym
->value();
1363 switch (sym
->source())
1365 case Symbol::FROM_OBJECT
:
1367 unsigned int in_shndx
= sym
->shndx();
1369 // FIXME: We need some target specific support here.
1370 if (in_shndx
>= elfcpp::SHN_LORESERVE
1371 && in_shndx
!= elfcpp::SHN_ABS
)
1373 fprintf(stderr
, _("%s: %s: unsupported symbol section 0x%x\n"),
1374 program_name
, sym
->name(), in_shndx
);
1378 Object
* symobj
= sym
->object();
1379 if (symobj
->is_dynamic())
1381 if (sym
->needs_dynsym_value())
1382 value
= target
->dynsym_value(sym
);
1383 shndx
= elfcpp::SHN_UNDEF
;
1385 else if (in_shndx
== elfcpp::SHN_UNDEF
1386 || in_shndx
== elfcpp::SHN_ABS
)
1390 Relobj
* relobj
= static_cast<Relobj
*>(symobj
);
1392 Output_section
* os
= relobj
->output_section(in_shndx
, &secoff
);
1393 gold_assert(os
!= NULL
);
1394 shndx
= os
->out_shndx();
1399 case Symbol::IN_OUTPUT_DATA
:
1400 shndx
= sym
->output_data()->out_shndx();
1403 case Symbol::IN_OUTPUT_SEGMENT
:
1404 shndx
= elfcpp::SHN_ABS
;
1407 case Symbol::CONSTANT
:
1408 shndx
= elfcpp::SHN_ABS
;
1415 if (sym_index
!= -1U)
1417 this->sized_write_symbol
SELECT_SIZE_ENDIAN_NAME(size
, big_endian
) (
1418 sym
, sym
->value(), shndx
, sympool
, ps
1419 SELECT_SIZE_ENDIAN(size
, big_endian
));
1423 if (dynsym_index
!= -1U)
1425 dynsym_index
-= first_dynamic_global_index
;
1426 gold_assert(dynsym_index
< dynamic_count
);
1427 unsigned char* pd
= dynamic_view
+ (dynsym_index
* sym_size
);
1428 this->sized_write_symbol
SELECT_SIZE_ENDIAN_NAME(size
, big_endian
) (
1429 sym
, value
, shndx
, dynpool
, pd
1430 SELECT_SIZE_ENDIAN(size
, big_endian
));
1434 gold_assert(ps
- psyms
== oview_size
);
1436 of
->write_output_view(this->offset_
, oview_size
, psyms
);
1437 if (dynamic_view
!= NULL
)
1438 of
->write_output_view(this->dynamic_offset_
, dynamic_size
, dynamic_view
);
1441 // Write out the symbol SYM, in section SHNDX, to P. POOL is the
1442 // strtab holding the name.
1444 template<int size
, bool big_endian
>
1446 Symbol_table::sized_write_symbol(
1447 Sized_symbol
<size
>* sym
,
1448 typename
elfcpp::Elf_types
<size
>::Elf_Addr value
,
1450 const Stringpool
* pool
,
1452 ACCEPT_SIZE_ENDIAN
) const
1454 elfcpp::Sym_write
<size
, big_endian
> osym(p
);
1455 osym
.put_st_name(pool
->get_offset(sym
->name()));
1456 osym
.put_st_value(value
);
1457 osym
.put_st_size(sym
->symsize());
1458 osym
.put_st_info(elfcpp::elf_st_info(sym
->binding(), sym
->type()));
1459 osym
.put_st_other(elfcpp::elf_st_other(sym
->visibility(), sym
->nonvis()));
1460 osym
.put_st_shndx(shndx
);
1463 // Write out a section symbol. Return the update offset.
1466 Symbol_table::write_section_symbol(const Target
* target
,
1467 const Output_section
*os
,
1471 if (this->size_
== 32)
1473 if (target
->is_big_endian())
1474 this->sized_write_section_symbol
<32, true>(os
, of
, offset
);
1476 this->sized_write_section_symbol
<32, false>(os
, of
, offset
);
1478 else if (this->size_
== 64)
1480 if (target
->is_big_endian())
1481 this->sized_write_section_symbol
<64, true>(os
, of
, offset
);
1483 this->sized_write_section_symbol
<64, false>(os
, of
, offset
);
1489 // Write out a section symbol, specialized for size and endianness.
1491 template<int size
, bool big_endian
>
1493 Symbol_table::sized_write_section_symbol(const Output_section
* os
,
1497 const int sym_size
= elfcpp::Elf_sizes
<size
>::sym_size
;
1499 unsigned char* pov
= of
->get_output_view(offset
, sym_size
);
1501 elfcpp::Sym_write
<size
, big_endian
> osym(pov
);
1502 osym
.put_st_name(0);
1503 osym
.put_st_value(os
->address());
1504 osym
.put_st_size(0);
1505 osym
.put_st_info(elfcpp::elf_st_info(elfcpp::STB_LOCAL
,
1506 elfcpp::STT_SECTION
));
1507 osym
.put_st_other(elfcpp::elf_st_other(elfcpp::STV_DEFAULT
, 0));
1508 osym
.put_st_shndx(os
->out_shndx());
1510 of
->write_output_view(offset
, sym_size
, pov
);
1513 // Warnings functions.
1515 // Add a new warning.
1518 Warnings::add_warning(Symbol_table
* symtab
, const char* name
, Object
* obj
,
1521 name
= symtab
->canonicalize_name(name
);
1522 this->warnings_
[name
].set(obj
, shndx
);
1525 // Look through the warnings and mark the symbols for which we should
1526 // warn. This is called during Layout::finalize when we know the
1527 // sources for all the symbols.
1530 Warnings::note_warnings(Symbol_table
* symtab
)
1532 for (Warning_table::iterator p
= this->warnings_
.begin();
1533 p
!= this->warnings_
.end();
1536 Symbol
* sym
= symtab
->lookup(p
->first
, NULL
);
1538 && sym
->source() == Symbol::FROM_OBJECT
1539 && sym
->object() == p
->second
.object
)
1541 sym
->set_has_warning();
1543 // Read the section contents to get the warning text. It
1544 // would be nicer if we only did this if we have to actually
1545 // issue a warning. Unfortunately, warnings are issued as
1546 // we relocate sections. That means that we can not lock
1547 // the object then, as we might try to issue the same
1548 // warning multiple times simultaneously.
1550 Task_locker_obj
<Object
> tl(*p
->second
.object
);
1551 const unsigned char* c
;
1553 c
= p
->second
.object
->section_contents(p
->second
.shndx
, &len
,
1555 p
->second
.set_text(reinterpret_cast<const char*>(c
), len
);
1561 // Issue a warning. This is called when we see a relocation against a
1562 // symbol for which has a warning.
1565 Warnings::issue_warning(const Symbol
* sym
, const std::string
& location
) const
1567 gold_assert(sym
->has_warning());
1568 Warning_table::const_iterator p
= this->warnings_
.find(sym
->name());
1569 gold_assert(p
!= this->warnings_
.end());
1570 fprintf(stderr
, _("%s: %s: warning: %s\n"), program_name
, location
.c_str(),
1571 p
->second
.text
.c_str());
1574 // Instantiate the templates we need. We could use the configure
1575 // script to restrict this to only the ones needed for implemented
1578 #ifdef HAVE_TARGET_32_LITTLE
1581 Symbol_table::add_from_relobj
<32, false>(
1582 Sized_relobj
<32, false>* relobj
,
1583 const unsigned char* syms
,
1585 const char* sym_names
,
1586 size_t sym_name_size
,
1587 Symbol
** sympointers
);
1590 #ifdef HAVE_TARGET_32_BIG
1593 Symbol_table::add_from_relobj
<32, true>(
1594 Sized_relobj
<32, true>* relobj
,
1595 const unsigned char* syms
,
1597 const char* sym_names
,
1598 size_t sym_name_size
,
1599 Symbol
** sympointers
);
1602 #ifdef HAVE_TARGET_64_LITTLE
1605 Symbol_table::add_from_relobj
<64, false>(
1606 Sized_relobj
<64, false>* relobj
,
1607 const unsigned char* syms
,
1609 const char* sym_names
,
1610 size_t sym_name_size
,
1611 Symbol
** sympointers
);
1614 #ifdef HAVE_TARGET_64_BIG
1617 Symbol_table::add_from_relobj
<64, true>(
1618 Sized_relobj
<64, true>* relobj
,
1619 const unsigned char* syms
,
1621 const char* sym_names
,
1622 size_t sym_name_size
,
1623 Symbol
** sympointers
);
1626 #ifdef HAVE_TARGET_32_LITTLE
1629 Symbol_table::add_from_dynobj
<32, false>(
1630 Sized_dynobj
<32, false>* dynobj
,
1631 const unsigned char* syms
,
1633 const char* sym_names
,
1634 size_t sym_name_size
,
1635 const unsigned char* versym
,
1637 const std::vector
<const char*>* version_map
);
1640 #ifdef HAVE_TARGET_32_BIG
1643 Symbol_table::add_from_dynobj
<32, true>(
1644 Sized_dynobj
<32, true>* dynobj
,
1645 const unsigned char* syms
,
1647 const char* sym_names
,
1648 size_t sym_name_size
,
1649 const unsigned char* versym
,
1651 const std::vector
<const char*>* version_map
);
1654 #ifdef HAVE_TARGET_64_LITTLE
1657 Symbol_table::add_from_dynobj
<64, false>(
1658 Sized_dynobj
<64, false>* dynobj
,
1659 const unsigned char* syms
,
1661 const char* sym_names
,
1662 size_t sym_name_size
,
1663 const unsigned char* versym
,
1665 const std::vector
<const char*>* version_map
);
1668 #ifdef HAVE_TARGET_64_BIG
1671 Symbol_table::add_from_dynobj
<64, true>(
1672 Sized_dynobj
<64, true>* dynobj
,
1673 const unsigned char* syms
,
1675 const char* sym_names
,
1676 size_t sym_name_size
,
1677 const unsigned char* versym
,
1679 const std::vector
<const char*>* version_map
);
1682 } // End namespace gold.