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 : 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 gold_assert(size
== relobj
->target()->get_size());
471 gold_assert(size
== parameters
->get_size());
473 const int sym_size
= elfcpp::Elf_sizes
<size
>::sym_size
;
475 const unsigned char* p
= syms
;
476 for (size_t i
= 0; i
< count
; ++i
, p
+= sym_size
)
478 elfcpp::Sym
<size
, big_endian
> sym(p
);
479 elfcpp::Sym
<size
, big_endian
>* psym
= &sym
;
481 unsigned int st_name
= psym
->get_st_name();
482 if (st_name
>= sym_name_size
)
485 _("%s: %s: bad global symbol name offset %u at %lu\n"),
486 program_name
, relobj
->name().c_str(), st_name
,
487 static_cast<unsigned long>(i
));
491 const char* name
= sym_names
+ st_name
;
493 // A symbol defined in a section which we are not including must
494 // be treated as an undefined symbol.
495 unsigned char symbuf
[sym_size
];
496 elfcpp::Sym
<size
, big_endian
> sym2(symbuf
);
497 unsigned int st_shndx
= psym
->get_st_shndx();
498 if (st_shndx
!= elfcpp::SHN_UNDEF
499 && st_shndx
< elfcpp::SHN_LORESERVE
500 && !relobj
->is_section_included(st_shndx
))
502 memcpy(symbuf
, p
, sym_size
);
503 elfcpp::Sym_write
<size
, big_endian
> sw(symbuf
);
504 sw
.put_st_shndx(elfcpp::SHN_UNDEF
);
508 // In an object file, an '@' in the name separates the symbol
509 // name from the version name. If there are two '@' characters,
510 // this is the default version.
511 const char* ver
= strchr(name
, '@');
516 Stringpool::Key name_key
;
517 name
= this->namepool_
.add(name
, &name_key
);
518 res
= this->add_from_object(relobj
, name
, name_key
, NULL
, 0,
523 Stringpool::Key name_key
;
524 name
= this->namepool_
.add(name
, ver
- name
, &name_key
);
534 Stringpool::Key ver_key
;
535 ver
= this->namepool_
.add(ver
, &ver_key
);
537 res
= this->add_from_object(relobj
, name
, name_key
, ver
, ver_key
,
541 *sympointers
++ = res
;
545 // Add all the symbols in a dynamic object to the hash table.
547 template<int size
, bool big_endian
>
549 Symbol_table::add_from_dynobj(
550 Sized_dynobj
<size
, big_endian
>* dynobj
,
551 const unsigned char* syms
,
553 const char* sym_names
,
554 size_t sym_name_size
,
555 const unsigned char* versym
,
557 const std::vector
<const char*>* version_map
)
559 gold_assert(size
== dynobj
->target()->get_size());
560 gold_assert(size
== parameters
->get_size());
562 if (versym
!= NULL
&& versym_size
/ 2 < count
)
564 fprintf(stderr
, _("%s: %s: too few symbol versions\n"),
565 program_name
, dynobj
->name().c_str());
569 const int sym_size
= elfcpp::Elf_sizes
<size
>::sym_size
;
571 const unsigned char* p
= syms
;
572 const unsigned char* vs
= versym
;
573 for (size_t i
= 0; i
< count
; ++i
, p
+= sym_size
, vs
+= 2)
575 elfcpp::Sym
<size
, big_endian
> sym(p
);
577 // Ignore symbols with local binding.
578 if (sym
.get_st_bind() == elfcpp::STB_LOCAL
)
581 unsigned int st_name
= sym
.get_st_name();
582 if (st_name
>= sym_name_size
)
584 fprintf(stderr
, _("%s: %s: bad symbol name offset %u at %lu\n"),
585 program_name
, dynobj
->name().c_str(), st_name
,
586 static_cast<unsigned long>(i
));
590 const char* name
= sym_names
+ st_name
;
594 Stringpool::Key name_key
;
595 name
= this->namepool_
.add(name
, &name_key
);
596 this->add_from_object(dynobj
, name
, name_key
, NULL
, 0,
601 // Read the version information.
603 unsigned int v
= elfcpp::Swap
<16, big_endian
>::readval(vs
);
605 bool hidden
= (v
& elfcpp::VERSYM_HIDDEN
) != 0;
606 v
&= elfcpp::VERSYM_VERSION
;
608 // The Sun documentation says that V can be VER_NDX_LOCAL, or
609 // VER_NDX_GLOBAL, or a version index. The meaning of
610 // VER_NDX_LOCAL is defined as "Symbol has local scope." The
611 // old GNU linker will happily generate VER_NDX_LOCAL for an
612 // undefined symbol. I don't know what the Sun linker will
615 if (v
== static_cast<unsigned int>(elfcpp::VER_NDX_LOCAL
)
616 && sym
.get_st_shndx() != elfcpp::SHN_UNDEF
)
618 // This symbol should not be visible outside the object.
622 // At this point we are definitely going to add this symbol.
623 Stringpool::Key name_key
;
624 name
= this->namepool_
.add(name
, &name_key
);
626 if (v
== static_cast<unsigned int>(elfcpp::VER_NDX_LOCAL
)
627 || v
== static_cast<unsigned int>(elfcpp::VER_NDX_GLOBAL
))
629 // This symbol does not have a version.
630 this->add_from_object(dynobj
, name
, name_key
, NULL
, 0, false, sym
);
634 if (v
>= version_map
->size())
637 _("%s: %s: versym for symbol %zu out of range: %u\n"),
638 program_name
, dynobj
->name().c_str(), i
, v
);
642 const char* version
= (*version_map
)[v
];
645 fprintf(stderr
, _("%s: %s: versym for symbol %zu has no name: %u\n"),
646 program_name
, dynobj
->name().c_str(), i
, v
);
650 Stringpool::Key version_key
;
651 version
= this->namepool_
.add(version
, &version_key
);
653 // If this is an absolute symbol, and the version name and
654 // symbol name are the same, then this is the version definition
655 // symbol. These symbols exist to support using -u to pull in
656 // particular versions. We do not want to record a version for
658 if (sym
.get_st_shndx() == elfcpp::SHN_ABS
&& name_key
== version_key
)
660 this->add_from_object(dynobj
, name
, name_key
, NULL
, 0, false, sym
);
664 const bool def
= !hidden
&& sym
.get_st_shndx() != elfcpp::SHN_UNDEF
;
666 this->add_from_object(dynobj
, name
, name_key
, version
, version_key
,
671 // Create and return a specially defined symbol. If ONLY_IF_REF is
672 // true, then only create the symbol if there is a reference to it.
673 // If this does not return NULL, it sets *POLDSYM to the existing
674 // symbol if there is one. This canonicalizes *PNAME and *PVERSION.
676 template<int size
, bool big_endian
>
678 Symbol_table::define_special_symbol(const Target
* target
, const char** pname
,
679 const char** pversion
, bool only_if_ref
,
680 Sized_symbol
<size
>** poldsym
684 Sized_symbol
<size
>* sym
;
685 bool add_to_table
= false;
686 typename
Symbol_table_type::iterator add_loc
= this->table_
.end();
690 oldsym
= this->lookup(*pname
, *pversion
);
691 if (oldsym
== NULL
|| !oldsym
->is_undefined())
694 *pname
= oldsym
->name();
695 *pversion
= oldsym
->version();
699 // Canonicalize NAME and VERSION.
700 Stringpool::Key name_key
;
701 *pname
= this->namepool_
.add(*pname
, &name_key
);
703 Stringpool::Key version_key
= 0;
704 if (*pversion
!= NULL
)
705 *pversion
= this->namepool_
.add(*pversion
, &version_key
);
707 Symbol
* const snull
= NULL
;
708 std::pair
<typename
Symbol_table_type::iterator
, bool> ins
=
709 this->table_
.insert(std::make_pair(std::make_pair(name_key
,
715 // We already have a symbol table entry for NAME/VERSION.
716 oldsym
= ins
.first
->second
;
717 gold_assert(oldsym
!= NULL
);
721 // We haven't seen this symbol before.
722 gold_assert(ins
.first
->second
== NULL
);
729 if (!target
->has_make_symbol())
730 sym
= new Sized_symbol
<size
>();
733 gold_assert(target
->get_size() == size
);
734 gold_assert(target
->is_big_endian() ? big_endian
: !big_endian
);
735 typedef Sized_target
<size
, big_endian
> My_target
;
736 const My_target
* sized_target
=
737 static_cast<const My_target
*>(target
);
738 sym
= sized_target
->make_symbol();
744 add_loc
->second
= sym
;
746 gold_assert(oldsym
!= NULL
);
748 *poldsym
= this->get_sized_symbol
SELECT_SIZE_NAME(size
) (oldsym
754 // Define a symbol based on an Output_data.
757 Symbol_table::define_in_output_data(const Target
* target
, const char* name
,
758 const char* version
, Output_data
* od
,
759 uint64_t value
, uint64_t symsize
,
760 elfcpp::STT type
, elfcpp::STB binding
,
761 elfcpp::STV visibility
,
762 unsigned char nonvis
,
763 bool offset_is_from_end
,
766 if (parameters
->get_size() == 32)
768 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
769 return this->do_define_in_output_data
<32>(target
, name
, version
, od
,
770 value
, symsize
, type
, binding
,
778 else if (parameters
->get_size() == 64)
780 #if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
781 return this->do_define_in_output_data
<64>(target
, name
, version
, od
,
782 value
, symsize
, type
, binding
,
794 // Define a symbol in an Output_data, sized version.
798 Symbol_table::do_define_in_output_data(
799 const Target
* target
,
803 typename
elfcpp::Elf_types
<size
>::Elf_Addr value
,
804 typename
elfcpp::Elf_types
<size
>::Elf_WXword symsize
,
807 elfcpp::STV visibility
,
808 unsigned char nonvis
,
809 bool offset_is_from_end
,
812 Sized_symbol
<size
>* sym
;
813 Sized_symbol
<size
>* oldsym
;
815 if (parameters
->is_big_endian())
817 #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
818 sym
= this->define_special_symbol
SELECT_SIZE_ENDIAN_NAME(size
, true) (
819 target
, &name
, &version
, only_if_ref
, &oldsym
820 SELECT_SIZE_ENDIAN(size
, true));
827 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
828 sym
= this->define_special_symbol
SELECT_SIZE_ENDIAN_NAME(size
, false) (
829 target
, &name
, &version
, only_if_ref
, &oldsym
830 SELECT_SIZE_ENDIAN(size
, false));
839 gold_assert(version
== NULL
|| oldsym
!= NULL
);
840 sym
->init(name
, od
, value
, symsize
, type
, binding
, visibility
, nonvis
,
844 && Symbol_table::should_override_with_special(oldsym
))
845 oldsym
->override_with_special(sym
);
850 // Define a symbol based on an Output_segment.
853 Symbol_table::define_in_output_segment(const Target
* target
, const char* name
,
854 const char* version
, Output_segment
* os
,
855 uint64_t value
, uint64_t symsize
,
856 elfcpp::STT type
, elfcpp::STB binding
,
857 elfcpp::STV visibility
,
858 unsigned char nonvis
,
859 Symbol::Segment_offset_base offset_base
,
862 if (parameters
->get_size() == 32)
864 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
865 return this->do_define_in_output_segment
<32>(target
, name
, version
, os
,
866 value
, symsize
, type
,
867 binding
, visibility
, nonvis
,
868 offset_base
, only_if_ref
);
873 else if (parameters
->get_size() == 64)
875 #if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
876 return this->do_define_in_output_segment
<64>(target
, name
, version
, os
,
877 value
, symsize
, type
,
878 binding
, visibility
, nonvis
,
879 offset_base
, only_if_ref
);
888 // Define a symbol in an Output_segment, sized version.
892 Symbol_table::do_define_in_output_segment(
893 const Target
* target
,
897 typename
elfcpp::Elf_types
<size
>::Elf_Addr value
,
898 typename
elfcpp::Elf_types
<size
>::Elf_WXword symsize
,
901 elfcpp::STV visibility
,
902 unsigned char nonvis
,
903 Symbol::Segment_offset_base offset_base
,
906 Sized_symbol
<size
>* sym
;
907 Sized_symbol
<size
>* oldsym
;
909 if (parameters
->is_big_endian())
911 #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
912 sym
= this->define_special_symbol
SELECT_SIZE_ENDIAN_NAME(size
, true) (
913 target
, &name
, &version
, only_if_ref
, &oldsym
914 SELECT_SIZE_ENDIAN(size
, true));
921 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
922 sym
= this->define_special_symbol
SELECT_SIZE_ENDIAN_NAME(size
, false) (
923 target
, &name
, &version
, only_if_ref
, &oldsym
924 SELECT_SIZE_ENDIAN(size
, false));
933 gold_assert(version
== NULL
|| oldsym
!= NULL
);
934 sym
->init(name
, os
, value
, symsize
, type
, binding
, visibility
, nonvis
,
938 && Symbol_table::should_override_with_special(oldsym
))
939 oldsym
->override_with_special(sym
);
944 // Define a special symbol with a constant value. It is a multiple
945 // definition error if this symbol is already defined.
948 Symbol_table::define_as_constant(const Target
* target
, const char* name
,
949 const char* version
, uint64_t value
,
950 uint64_t symsize
, elfcpp::STT type
,
951 elfcpp::STB binding
, elfcpp::STV visibility
,
952 unsigned char nonvis
, bool only_if_ref
)
954 if (parameters
->get_size() == 32)
956 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
957 return this->do_define_as_constant
<32>(target
, name
, version
, value
,
958 symsize
, type
, binding
,
959 visibility
, nonvis
, only_if_ref
);
964 else if (parameters
->get_size() == 64)
966 #if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
967 return this->do_define_as_constant
<64>(target
, name
, version
, value
,
968 symsize
, type
, binding
,
969 visibility
, nonvis
, only_if_ref
);
978 // Define a symbol as a constant, sized version.
982 Symbol_table::do_define_as_constant(
983 const Target
* target
,
986 typename
elfcpp::Elf_types
<size
>::Elf_Addr value
,
987 typename
elfcpp::Elf_types
<size
>::Elf_WXword symsize
,
990 elfcpp::STV visibility
,
991 unsigned char nonvis
,
994 Sized_symbol
<size
>* sym
;
995 Sized_symbol
<size
>* oldsym
;
997 if (parameters
->is_big_endian())
999 #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
1000 sym
= this->define_special_symbol
SELECT_SIZE_ENDIAN_NAME(size
, true) (
1001 target
, &name
, &version
, only_if_ref
, &oldsym
1002 SELECT_SIZE_ENDIAN(size
, true));
1009 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
1010 sym
= this->define_special_symbol
SELECT_SIZE_ENDIAN_NAME(size
, false) (
1011 target
, &name
, &version
, only_if_ref
, &oldsym
1012 SELECT_SIZE_ENDIAN(size
, false));
1021 gold_assert(version
== NULL
|| oldsym
!= NULL
);
1022 sym
->init(name
, value
, symsize
, type
, binding
, visibility
, nonvis
);
1025 && Symbol_table::should_override_with_special(oldsym
))
1026 oldsym
->override_with_special(sym
);
1031 // Define a set of symbols in output sections.
1034 Symbol_table::define_symbols(const Layout
* layout
, const Target
* target
,
1035 int count
, const Define_symbol_in_section
* p
)
1037 for (int i
= 0; i
< count
; ++i
, ++p
)
1039 Output_section
* os
= layout
->find_output_section(p
->output_section
);
1041 this->define_in_output_data(target
, p
->name
, NULL
, os
, p
->value
,
1042 p
->size
, p
->type
, p
->binding
,
1043 p
->visibility
, p
->nonvis
,
1044 p
->offset_is_from_end
, p
->only_if_ref
);
1046 this->define_as_constant(target
, p
->name
, NULL
, 0, p
->size
, p
->type
,
1047 p
->binding
, p
->visibility
, p
->nonvis
,
1052 // Define a set of symbols in output segments.
1055 Symbol_table::define_symbols(const Layout
* layout
, const Target
* target
,
1056 int count
, const Define_symbol_in_segment
* p
)
1058 for (int i
= 0; i
< count
; ++i
, ++p
)
1060 Output_segment
* os
= layout
->find_output_segment(p
->segment_type
,
1061 p
->segment_flags_set
,
1062 p
->segment_flags_clear
);
1064 this->define_in_output_segment(target
, p
->name
, NULL
, os
, p
->value
,
1065 p
->size
, p
->type
, p
->binding
,
1066 p
->visibility
, p
->nonvis
,
1067 p
->offset_base
, p
->only_if_ref
);
1069 this->define_as_constant(target
, p
->name
, NULL
, 0, p
->size
, p
->type
,
1070 p
->binding
, p
->visibility
, p
->nonvis
,
1075 // Set the dynamic symbol indexes. INDEX is the index of the first
1076 // global dynamic symbol. Pointers to the symbols are stored into the
1077 // vector SYMS. The names are added to DYNPOOL. This returns an
1078 // updated dynamic symbol index.
1081 Symbol_table::set_dynsym_indexes(const General_options
* options
,
1082 const Target
* target
,
1084 std::vector
<Symbol
*>* syms
,
1085 Stringpool
* dynpool
,
1088 for (Symbol_table_type::iterator p
= this->table_
.begin();
1089 p
!= this->table_
.end();
1092 Symbol
* sym
= p
->second
;
1094 // Note that SYM may already have a dynamic symbol index, since
1095 // some symbols appear more than once in the symbol table, with
1096 // and without a version.
1098 if (!sym
->needs_dynsym_entry()
1099 && (!options
->export_dynamic()
1101 || !sym
->is_externally_visible()))
1102 sym
->set_dynsym_index(-1U);
1103 else if (!sym
->has_dynsym_index())
1105 sym
->set_dynsym_index(index
);
1107 syms
->push_back(sym
);
1108 dynpool
->add(sym
->name(), NULL
);
1110 // Record any version information.
1111 if (sym
->version() != NULL
)
1112 versions
->record_version(options
, dynpool
, sym
);
1116 // Finish up the versions. In some cases this may add new dynamic
1118 index
= versions
->finalize(target
, this, index
, syms
);
1123 // Set the final values for all the symbols. The index of the first
1124 // global symbol in the output file is INDEX. Record the file offset
1125 // OFF. Add their names to POOL. Return the new file offset.
1128 Symbol_table::finalize(unsigned int index
, off_t off
, off_t dynoff
,
1129 size_t dyn_global_index
, size_t dyncount
,
1134 gold_assert(index
!= 0);
1135 this->first_global_index_
= index
;
1137 this->dynamic_offset_
= dynoff
;
1138 this->first_dynamic_global_index_
= dyn_global_index
;
1139 this->dynamic_count_
= dyncount
;
1141 if (parameters
->get_size() == 32)
1143 #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_32_LITTLE)
1144 ret
= this->sized_finalize
<32>(index
, off
, pool
);
1149 else if (parameters
->get_size() == 64)
1151 #if defined(HAVE_TARGET_64_BIG) || defined(HAVE_TARGET_64_LITTLE)
1152 ret
= this->sized_finalize
<64>(index
, off
, pool
);
1160 // Now that we have the final symbol table, we can reliably note
1161 // which symbols should get warnings.
1162 this->warnings_
.note_warnings(this);
1167 // Set the final value for all the symbols. This is called after
1168 // Layout::finalize, so all the output sections have their final
1173 Symbol_table::sized_finalize(unsigned index
, off_t off
, Stringpool
* pool
)
1175 off
= align_address(off
, size
>> 3);
1176 this->offset_
= off
;
1178 size_t orig_index
= index
;
1180 const int sym_size
= elfcpp::Elf_sizes
<size
>::sym_size
;
1181 for (Symbol_table_type::iterator p
= this->table_
.begin();
1182 p
!= this->table_
.end();
1185 Sized_symbol
<size
>* sym
= static_cast<Sized_symbol
<size
>*>(p
->second
);
1187 // FIXME: Here we need to decide which symbols should go into
1188 // the output file, based on --strip.
1190 // The default version of a symbol may appear twice in the
1191 // symbol table. We only need to finalize it once.
1192 if (sym
->has_symtab_index())
1197 gold_assert(!sym
->has_symtab_index());
1198 sym
->set_symtab_index(-1U);
1199 gold_assert(sym
->dynsym_index() == -1U);
1203 typename Sized_symbol
<size
>::Value_type value
;
1205 switch (sym
->source())
1207 case Symbol::FROM_OBJECT
:
1209 unsigned int shndx
= sym
->shndx();
1211 // FIXME: We need some target specific support here.
1212 if (shndx
>= elfcpp::SHN_LORESERVE
1213 && shndx
!= elfcpp::SHN_ABS
)
1215 fprintf(stderr
, _("%s: %s: unsupported symbol section 0x%x\n"),
1216 program_name
, sym
->name(), shndx
);
1220 Object
* symobj
= sym
->object();
1221 if (symobj
->is_dynamic())
1224 shndx
= elfcpp::SHN_UNDEF
;
1226 else if (shndx
== elfcpp::SHN_UNDEF
)
1228 else if (shndx
== elfcpp::SHN_ABS
)
1229 value
= sym
->value();
1232 Relobj
* relobj
= static_cast<Relobj
*>(symobj
);
1234 Output_section
* os
= relobj
->output_section(shndx
, &secoff
);
1238 sym
->set_symtab_index(-1U);
1239 gold_assert(sym
->dynsym_index() == -1U);
1243 value
= sym
->value() + os
->address() + secoff
;
1248 case Symbol::IN_OUTPUT_DATA
:
1250 Output_data
* od
= sym
->output_data();
1251 value
= sym
->value() + od
->address();
1252 if (sym
->offset_is_from_end())
1253 value
+= od
->data_size();
1257 case Symbol::IN_OUTPUT_SEGMENT
:
1259 Output_segment
* os
= sym
->output_segment();
1260 value
= sym
->value() + os
->vaddr();
1261 switch (sym
->offset_base())
1263 case Symbol::SEGMENT_START
:
1265 case Symbol::SEGMENT_END
:
1266 value
+= os
->memsz();
1268 case Symbol::SEGMENT_BSS
:
1269 value
+= os
->filesz();
1277 case Symbol::CONSTANT
:
1278 value
= sym
->value();
1285 sym
->set_value(value
);
1286 sym
->set_symtab_index(index
);
1287 pool
->add(sym
->name(), NULL
);
1292 this->output_count_
= index
- orig_index
;
1297 // Write out the global symbols.
1300 Symbol_table::write_globals(const Target
* target
, const Stringpool
* sympool
,
1301 const Stringpool
* dynpool
, Output_file
* of
) const
1303 if (parameters
->get_size() == 32)
1305 if (parameters
->is_big_endian())
1307 #ifdef HAVE_TARGET_32_BIG
1308 this->sized_write_globals
<32, true>(target
, sympool
, dynpool
, of
);
1315 #ifdef HAVE_TARGET_32_LITTLE
1316 this->sized_write_globals
<32, false>(target
, sympool
, dynpool
, of
);
1322 else if (parameters
->get_size() == 64)
1324 if (parameters
->is_big_endian())
1326 #ifdef HAVE_TARGET_64_BIG
1327 this->sized_write_globals
<64, true>(target
, sympool
, dynpool
, of
);
1334 #ifdef HAVE_TARGET_64_LITTLE
1335 this->sized_write_globals
<64, false>(target
, sympool
, dynpool
, of
);
1345 // Write out the global symbols.
1347 template<int size
, bool big_endian
>
1349 Symbol_table::sized_write_globals(const Target
* target
,
1350 const Stringpool
* sympool
,
1351 const Stringpool
* dynpool
,
1352 Output_file
* of
) const
1354 const int sym_size
= elfcpp::Elf_sizes
<size
>::sym_size
;
1355 unsigned int index
= this->first_global_index_
;
1356 const off_t oview_size
= this->output_count_
* sym_size
;
1357 unsigned char* const psyms
= of
->get_output_view(this->offset_
, oview_size
);
1359 unsigned int dynamic_count
= this->dynamic_count_
;
1360 off_t dynamic_size
= dynamic_count
* sym_size
;
1361 unsigned int first_dynamic_global_index
= this->first_dynamic_global_index_
;
1362 unsigned char* dynamic_view
;
1363 if (this->dynamic_offset_
== 0)
1364 dynamic_view
= NULL
;
1366 dynamic_view
= of
->get_output_view(this->dynamic_offset_
, dynamic_size
);
1368 unsigned char* ps
= psyms
;
1369 for (Symbol_table_type::const_iterator p
= this->table_
.begin();
1370 p
!= this->table_
.end();
1373 Sized_symbol
<size
>* sym
= static_cast<Sized_symbol
<size
>*>(p
->second
);
1375 unsigned int sym_index
= sym
->symtab_index();
1376 unsigned int dynsym_index
;
1377 if (dynamic_view
== NULL
)
1380 dynsym_index
= sym
->dynsym_index();
1382 if (sym_index
== -1U && dynsym_index
== -1U)
1384 // This symbol is not included in the output file.
1388 if (sym_index
== index
)
1390 else if (sym_index
!= -1U)
1392 // We have already seen this symbol, because it has a
1394 gold_assert(sym_index
< index
);
1395 if (dynsym_index
== -1U)
1401 typename
elfcpp::Elf_types
<32>::Elf_Addr value
= sym
->value();
1402 switch (sym
->source())
1404 case Symbol::FROM_OBJECT
:
1406 unsigned int in_shndx
= sym
->shndx();
1408 // FIXME: We need some target specific support here.
1409 if (in_shndx
>= elfcpp::SHN_LORESERVE
1410 && in_shndx
!= elfcpp::SHN_ABS
)
1412 fprintf(stderr
, _("%s: %s: unsupported symbol section 0x%x\n"),
1413 program_name
, sym
->name(), in_shndx
);
1417 Object
* symobj
= sym
->object();
1418 if (symobj
->is_dynamic())
1420 if (sym
->needs_dynsym_value())
1421 value
= target
->dynsym_value(sym
);
1422 shndx
= elfcpp::SHN_UNDEF
;
1424 else if (in_shndx
== elfcpp::SHN_UNDEF
1425 || in_shndx
== elfcpp::SHN_ABS
)
1429 Relobj
* relobj
= static_cast<Relobj
*>(symobj
);
1431 Output_section
* os
= relobj
->output_section(in_shndx
, &secoff
);
1432 gold_assert(os
!= NULL
);
1433 shndx
= os
->out_shndx();
1438 case Symbol::IN_OUTPUT_DATA
:
1439 shndx
= sym
->output_data()->out_shndx();
1442 case Symbol::IN_OUTPUT_SEGMENT
:
1443 shndx
= elfcpp::SHN_ABS
;
1446 case Symbol::CONSTANT
:
1447 shndx
= elfcpp::SHN_ABS
;
1454 if (sym_index
!= -1U)
1456 this->sized_write_symbol
SELECT_SIZE_ENDIAN_NAME(size
, big_endian
) (
1457 sym
, sym
->value(), shndx
, sympool
, ps
1458 SELECT_SIZE_ENDIAN(size
, big_endian
));
1462 if (dynsym_index
!= -1U)
1464 dynsym_index
-= first_dynamic_global_index
;
1465 gold_assert(dynsym_index
< dynamic_count
);
1466 unsigned char* pd
= dynamic_view
+ (dynsym_index
* sym_size
);
1467 this->sized_write_symbol
SELECT_SIZE_ENDIAN_NAME(size
, big_endian
) (
1468 sym
, value
, shndx
, dynpool
, pd
1469 SELECT_SIZE_ENDIAN(size
, big_endian
));
1473 gold_assert(ps
- psyms
== oview_size
);
1475 of
->write_output_view(this->offset_
, oview_size
, psyms
);
1476 if (dynamic_view
!= NULL
)
1477 of
->write_output_view(this->dynamic_offset_
, dynamic_size
, dynamic_view
);
1480 // Write out the symbol SYM, in section SHNDX, to P. POOL is the
1481 // strtab holding the name.
1483 template<int size
, bool big_endian
>
1485 Symbol_table::sized_write_symbol(
1486 Sized_symbol
<size
>* sym
,
1487 typename
elfcpp::Elf_types
<size
>::Elf_Addr value
,
1489 const Stringpool
* pool
,
1491 ACCEPT_SIZE_ENDIAN
) const
1493 elfcpp::Sym_write
<size
, big_endian
> osym(p
);
1494 osym
.put_st_name(pool
->get_offset(sym
->name()));
1495 osym
.put_st_value(value
);
1496 osym
.put_st_size(sym
->symsize());
1497 osym
.put_st_info(elfcpp::elf_st_info(sym
->binding(), sym
->type()));
1498 osym
.put_st_other(elfcpp::elf_st_other(sym
->visibility(), sym
->nonvis()));
1499 osym
.put_st_shndx(shndx
);
1502 // Write out a section symbol. Return the update offset.
1505 Symbol_table::write_section_symbol(const Output_section
*os
,
1509 if (parameters
->get_size() == 32)
1511 if (parameters
->is_big_endian())
1513 #ifdef HAVE_TARGET_32_BIG
1514 this->sized_write_section_symbol
<32, true>(os
, of
, offset
);
1521 #ifdef HAVE_TARGET_32_LITTLE
1522 this->sized_write_section_symbol
<32, false>(os
, of
, offset
);
1528 else if (parameters
->get_size() == 64)
1530 if (parameters
->is_big_endian())
1532 #ifdef HAVE_TARGET_64_BIG
1533 this->sized_write_section_symbol
<64, true>(os
, of
, offset
);
1540 #ifdef HAVE_TARGET_64_LITTLE
1541 this->sized_write_section_symbol
<64, false>(os
, of
, offset
);
1551 // Write out a section symbol, specialized for size and endianness.
1553 template<int size
, bool big_endian
>
1555 Symbol_table::sized_write_section_symbol(const Output_section
* os
,
1559 const int sym_size
= elfcpp::Elf_sizes
<size
>::sym_size
;
1561 unsigned char* pov
= of
->get_output_view(offset
, sym_size
);
1563 elfcpp::Sym_write
<size
, big_endian
> osym(pov
);
1564 osym
.put_st_name(0);
1565 osym
.put_st_value(os
->address());
1566 osym
.put_st_size(0);
1567 osym
.put_st_info(elfcpp::elf_st_info(elfcpp::STB_LOCAL
,
1568 elfcpp::STT_SECTION
));
1569 osym
.put_st_other(elfcpp::elf_st_other(elfcpp::STV_DEFAULT
, 0));
1570 osym
.put_st_shndx(os
->out_shndx());
1572 of
->write_output_view(offset
, sym_size
, pov
);
1575 // Warnings functions.
1577 // Add a new warning.
1580 Warnings::add_warning(Symbol_table
* symtab
, const char* name
, Object
* obj
,
1583 name
= symtab
->canonicalize_name(name
);
1584 this->warnings_
[name
].set(obj
, shndx
);
1587 // Look through the warnings and mark the symbols for which we should
1588 // warn. This is called during Layout::finalize when we know the
1589 // sources for all the symbols.
1592 Warnings::note_warnings(Symbol_table
* symtab
)
1594 for (Warning_table::iterator p
= this->warnings_
.begin();
1595 p
!= this->warnings_
.end();
1598 Symbol
* sym
= symtab
->lookup(p
->first
, NULL
);
1600 && sym
->source() == Symbol::FROM_OBJECT
1601 && sym
->object() == p
->second
.object
)
1603 sym
->set_has_warning();
1605 // Read the section contents to get the warning text. It
1606 // would be nicer if we only did this if we have to actually
1607 // issue a warning. Unfortunately, warnings are issued as
1608 // we relocate sections. That means that we can not lock
1609 // the object then, as we might try to issue the same
1610 // warning multiple times simultaneously.
1612 Task_locker_obj
<Object
> tl(*p
->second
.object
);
1613 const unsigned char* c
;
1615 c
= p
->second
.object
->section_contents(p
->second
.shndx
, &len
,
1617 p
->second
.set_text(reinterpret_cast<const char*>(c
), len
);
1623 // Issue a warning. This is called when we see a relocation against a
1624 // symbol for which has a warning.
1627 Warnings::issue_warning(const Symbol
* sym
, const std::string
& location
) const
1629 gold_assert(sym
->has_warning());
1630 Warning_table::const_iterator p
= this->warnings_
.find(sym
->name());
1631 gold_assert(p
!= this->warnings_
.end());
1632 fprintf(stderr
, _("%s: %s: warning: %s\n"), program_name
, location
.c_str(),
1633 p
->second
.text
.c_str());
1636 // Instantiate the templates we need. We could use the configure
1637 // script to restrict this to only the ones needed for implemented
1640 #ifdef HAVE_TARGET_32_LITTLE
1643 Symbol_table::add_from_relobj
<32, false>(
1644 Sized_relobj
<32, false>* relobj
,
1645 const unsigned char* syms
,
1647 const char* sym_names
,
1648 size_t sym_name_size
,
1649 Symbol
** sympointers
);
1652 #ifdef HAVE_TARGET_32_BIG
1655 Symbol_table::add_from_relobj
<32, true>(
1656 Sized_relobj
<32, true>* relobj
,
1657 const unsigned char* syms
,
1659 const char* sym_names
,
1660 size_t sym_name_size
,
1661 Symbol
** sympointers
);
1664 #ifdef HAVE_TARGET_64_LITTLE
1667 Symbol_table::add_from_relobj
<64, false>(
1668 Sized_relobj
<64, false>* relobj
,
1669 const unsigned char* syms
,
1671 const char* sym_names
,
1672 size_t sym_name_size
,
1673 Symbol
** sympointers
);
1676 #ifdef HAVE_TARGET_64_BIG
1679 Symbol_table::add_from_relobj
<64, true>(
1680 Sized_relobj
<64, true>* relobj
,
1681 const unsigned char* syms
,
1683 const char* sym_names
,
1684 size_t sym_name_size
,
1685 Symbol
** sympointers
);
1688 #ifdef HAVE_TARGET_32_LITTLE
1691 Symbol_table::add_from_dynobj
<32, false>(
1692 Sized_dynobj
<32, false>* dynobj
,
1693 const unsigned char* syms
,
1695 const char* sym_names
,
1696 size_t sym_name_size
,
1697 const unsigned char* versym
,
1699 const std::vector
<const char*>* version_map
);
1702 #ifdef HAVE_TARGET_32_BIG
1705 Symbol_table::add_from_dynobj
<32, true>(
1706 Sized_dynobj
<32, true>* dynobj
,
1707 const unsigned char* syms
,
1709 const char* sym_names
,
1710 size_t sym_name_size
,
1711 const unsigned char* versym
,
1713 const std::vector
<const char*>* version_map
);
1716 #ifdef HAVE_TARGET_64_LITTLE
1719 Symbol_table::add_from_dynobj
<64, false>(
1720 Sized_dynobj
<64, false>* dynobj
,
1721 const unsigned char* syms
,
1723 const char* sym_names
,
1724 size_t sym_name_size
,
1725 const unsigned char* versym
,
1727 const std::vector
<const char*>* version_map
);
1730 #ifdef HAVE_TARGET_64_BIG
1733 Symbol_table::add_from_dynobj
<64, true>(
1734 Sized_dynobj
<64, true>* dynobj
,
1735 const unsigned char* syms
,
1737 const char* sym_names
,
1738 size_t sym_name_size
,
1739 const unsigned char* versym
,
1741 const std::vector
<const char*>* version_map
);
1744 } // End namespace gold.