1 // resolve.cc -- symbol resolution 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.
33 // Symbol methods used in this file.
35 // Override the fields in Symbol.
37 template<int size
, bool big_endian
>
39 Symbol::override_base(const elfcpp::Sym
<size
, big_endian
>& sym
,
40 Object
* object
, const char* version
)
42 gold_assert(this->source_
== FROM_OBJECT
);
43 this->u_
.from_object
.object
= object
;
44 if (version
!= NULL
&& this->version() != version
)
46 gold_assert(this->version() == NULL
);
47 this->version_
= version
;
49 // FIXME: Handle SHN_XINDEX.
50 this->u_
.from_object
.shndx
= sym
.get_st_shndx();
51 this->type_
= sym
.get_st_type();
52 this->binding_
= sym
.get_st_bind();
53 this->visibility_
= sym
.get_st_visibility();
54 this->nonvis_
= sym
.get_st_nonvis();
55 if (object
->is_dynamic())
61 // Override the fields in Sized_symbol.
64 template<bool big_endian
>
66 Sized_symbol
<size
>::override(const elfcpp::Sym
<size
, big_endian
>& sym
,
67 Object
* object
, const char* version
)
69 this->override_base(sym
, object
, version
);
70 this->value_
= sym
.get_st_value();
71 this->symsize_
= sym
.get_st_size();
74 // Override TOSYM with symbol FROMSYM, defined in OBJECT, with version
75 // VERSION. This handles all aliases of TOSYM.
77 template<int size
, bool big_endian
>
79 Symbol_table::override(Sized_symbol
<size
>* tosym
,
80 const elfcpp::Sym
<size
, big_endian
>& fromsym
,
81 Object
* object
, const char* version
)
83 tosym
->override(fromsym
, object
, version
);
84 if (tosym
->has_alias())
86 Symbol
* sym
= this->weak_aliases_
[tosym
];
87 gold_assert(sym
!= NULL
);
88 Sized_symbol
<size
>* ssym
;
89 ssym
= this->get_sized_symbol
SELECT_SIZE_NAME(size
) (sym
93 ssym
->override(fromsym
, object
, version
);
94 sym
= this->weak_aliases_
[ssym
];
95 gold_assert(sym
!= NULL
);
96 ssym
= this->get_sized_symbol
SELECT_SIZE_NAME(size
) (
97 sym
SELECT_SIZE(size
));
99 while (ssym
!= tosym
);
103 // The resolve functions build a little code for each symbol.
104 // Bit 0: 0 for global, 1 for weak.
105 // Bit 1: 0 for regular object, 1 for shared object
106 // Bits 2-3: 0 for normal, 1 for undefined, 2 for common
107 // This gives us values from 0 to 11.
109 static const int global_or_weak_shift
= 0;
110 static const unsigned int global_flag
= 0 << global_or_weak_shift
;
111 static const unsigned int weak_flag
= 1 << global_or_weak_shift
;
113 static const int regular_or_dynamic_shift
= 1;
114 static const unsigned int regular_flag
= 0 << regular_or_dynamic_shift
;
115 static const unsigned int dynamic_flag
= 1 << regular_or_dynamic_shift
;
117 static const int def_undef_or_common_shift
= 2;
118 static const unsigned int def_flag
= 0 << def_undef_or_common_shift
;
119 static const unsigned int undef_flag
= 1 << def_undef_or_common_shift
;
120 static const unsigned int common_flag
= 2 << def_undef_or_common_shift
;
122 // Resolve a symbol. This is called the second and subsequent times
123 // we see a symbol. TO is the pre-existing symbol. SYM is the new
124 // symbol, seen in OBJECT. VERSION of the version of SYM.
126 template<int size
, bool big_endian
>
128 Symbol_table::resolve(Sized_symbol
<size
>* to
,
129 const elfcpp::Sym
<size
, big_endian
>& sym
,
130 Object
* object
, const char* version
)
132 if (object
->target()->has_resolve())
134 Sized_target
<size
, big_endian
>* sized_target
;
135 sized_target
= object
->sized_target
136 SELECT_SIZE_ENDIAN_NAME(size
, big_endian
) (
137 SELECT_SIZE_ENDIAN_ONLY(size
, big_endian
));
138 sized_target
->resolve(to
, sym
, object
, version
);
142 if (!object
->is_dynamic())
144 // Record that we've seen this symbol in a regular object.
149 // Record that we've seen this symbol in a dynamic object.
153 unsigned int frombits
;
154 switch (sym
.get_st_bind())
156 case elfcpp::STB_GLOBAL
:
157 frombits
= global_flag
;
160 case elfcpp::STB_WEAK
:
161 frombits
= weak_flag
;
164 case elfcpp::STB_LOCAL
:
165 gold_error(_("%s: invalid STB_LOCAL symbol %s in external symbols"),
166 object
->name().c_str(), to
->name());
167 frombits
= global_flag
;
171 gold_error(_("%s: unsupported symbol binding %d for symbol %s"),
172 object
->name().c_str(),
173 static_cast<int>(sym
.get_st_bind()), to
->name());
174 frombits
= global_flag
;
178 if (!object
->is_dynamic())
179 frombits
|= regular_flag
;
181 frombits
|= dynamic_flag
;
183 switch (sym
.get_st_shndx())
185 case elfcpp::SHN_UNDEF
:
186 frombits
|= undef_flag
;
189 case elfcpp::SHN_COMMON
:
190 frombits
|= common_flag
;
194 if (sym
.get_st_type() == elfcpp::STT_COMMON
)
195 frombits
|= common_flag
;
197 frombits
|= def_flag
;
201 bool adjust_common_sizes
;
202 if (Symbol_table::should_override(to
, frombits
, object
,
203 &adjust_common_sizes
))
205 typename Sized_symbol
<size
>::Size_type tosize
= to
->symsize();
207 this->override(to
, sym
, object
, version
);
209 if (adjust_common_sizes
&& tosize
> to
->symsize())
210 to
->set_symsize(tosize
);
214 if (adjust_common_sizes
&& sym
.get_st_size() > to
->symsize())
215 to
->set_symsize(sym
.get_st_size());
219 // Handle the core of symbol resolution. This is called with the
220 // existing symbol, TO, and a bitflag describing the new symbol. This
221 // returns true if we should override the existing symbol with the new
222 // one, and returns false otherwise. It sets *ADJUST_COMMON_SIZES to
223 // true if we should set the symbol size to the maximum of the TO and
224 // FROM sizes. It handles error conditions.
227 Symbol_table::should_override(const Symbol
* to
, unsigned int frombits
,
228 Object
* object
, bool* adjust_common_sizes
)
230 *adjust_common_sizes
= false;
233 switch (to
->binding())
235 case elfcpp::STB_GLOBAL
:
236 tobits
= global_flag
;
239 case elfcpp::STB_WEAK
:
243 case elfcpp::STB_LOCAL
:
244 // We should only see externally visible symbols in the symbol
249 // Any target which wants to handle STB_LOOS, etc., needs to
250 // define a resolve method.
254 if (to
->source() == Symbol::FROM_OBJECT
255 && to
->object()->is_dynamic())
256 tobits
|= dynamic_flag
;
258 tobits
|= regular_flag
;
262 case elfcpp::SHN_UNDEF
:
263 tobits
|= undef_flag
;
266 case elfcpp::SHN_COMMON
:
267 tobits
|= common_flag
;
271 if (to
->type() == elfcpp::STT_COMMON
)
272 tobits
|= common_flag
;
278 // FIXME: Warn if either but not both of TO and SYM are STT_TLS.
280 // We use a giant switch table for symbol resolution. This code is
281 // unwieldy, but: 1) it is efficient; 2) we definitely handle all
282 // cases; 3) it is easy to change the handling of a particular case.
283 // The alternative would be a series of conditionals, but it is easy
284 // to get the ordering wrong. This could also be done as a table,
285 // but that is no easier to understand than this large switch
288 // These are the values generated by the bit codes.
291 DEF
= global_flag
| regular_flag
| def_flag
,
292 WEAK_DEF
= weak_flag
| regular_flag
| def_flag
,
293 DYN_DEF
= global_flag
| dynamic_flag
| def_flag
,
294 DYN_WEAK_DEF
= weak_flag
| dynamic_flag
| def_flag
,
295 UNDEF
= global_flag
| regular_flag
| undef_flag
,
296 WEAK_UNDEF
= weak_flag
| regular_flag
| undef_flag
,
297 DYN_UNDEF
= global_flag
| dynamic_flag
| undef_flag
,
298 DYN_WEAK_UNDEF
= weak_flag
| dynamic_flag
| undef_flag
,
299 COMMON
= global_flag
| regular_flag
| common_flag
,
300 WEAK_COMMON
= weak_flag
| regular_flag
| common_flag
,
301 DYN_COMMON
= global_flag
| dynamic_flag
| common_flag
,
302 DYN_WEAK_COMMON
= weak_flag
| dynamic_flag
| common_flag
305 switch (tobits
* 16 + frombits
)
308 // Two definitions of the same symbol.
309 // FIXME: Do a better job of reporting locations.
310 gold_error(_("%s: multiple definition of %s"),
311 object
!= NULL
? object
->name().c_str() : _("command line"),
313 gold_error(_("%s: previous definition here"),
314 (to
->source() == Symbol::FROM_OBJECT
315 ? to
->object()->name().c_str()
316 : _("command line")));
319 case WEAK_DEF
* 16 + DEF
:
320 // We've seen a weak definition, and now we see a strong
321 // definition. In the original SVR4 linker, this was treated as
322 // a multiple definition error. In the Solaris linker and the
323 // GNU linker, a weak definition followed by a regular
324 // definition causes the weak definition to be overridden. We
325 // are currently compatible with the GNU linker. In the future
326 // we should add a target specific option to change this.
330 case DYN_DEF
* 16 + DEF
:
331 case DYN_WEAK_DEF
* 16 + DEF
:
332 // We've seen a definition in a dynamic object, and now we see a
333 // definition in a regular object. The definition in the
334 // regular object overrides the definition in the dynamic
338 case UNDEF
* 16 + DEF
:
339 case WEAK_UNDEF
* 16 + DEF
:
340 case DYN_UNDEF
* 16 + DEF
:
341 case DYN_WEAK_UNDEF
* 16 + DEF
:
342 // We've seen an undefined reference, and now we see a
343 // definition. We use the definition.
346 case COMMON
* 16 + DEF
:
347 case WEAK_COMMON
* 16 + DEF
:
348 case DYN_COMMON
* 16 + DEF
:
349 case DYN_WEAK_COMMON
* 16 + DEF
:
350 // We've seen a common symbol and now we see a definition. The
351 // definition overrides. FIXME: We should optionally issue, version a
355 case DEF
* 16 + WEAK_DEF
:
356 case WEAK_DEF
* 16 + WEAK_DEF
:
357 // We've seen a definition and now we see a weak definition. We
358 // ignore the new weak definition.
361 case DYN_DEF
* 16 + WEAK_DEF
:
362 case DYN_WEAK_DEF
* 16 + WEAK_DEF
:
363 // We've seen a dynamic definition and now we see a regular weak
364 // definition. The regular weak definition overrides.
367 case UNDEF
* 16 + WEAK_DEF
:
368 case WEAK_UNDEF
* 16 + WEAK_DEF
:
369 case DYN_UNDEF
* 16 + WEAK_DEF
:
370 case DYN_WEAK_UNDEF
* 16 + WEAK_DEF
:
371 // A weak definition of a currently undefined symbol.
374 case COMMON
* 16 + WEAK_DEF
:
375 case WEAK_COMMON
* 16 + WEAK_DEF
:
376 // A weak definition does not override a common definition.
379 case DYN_COMMON
* 16 + WEAK_DEF
:
380 case DYN_WEAK_COMMON
* 16 + WEAK_DEF
:
381 // A weak definition does override a definition in a dynamic
382 // object. FIXME: We should optionally issue a warning.
385 case DEF
* 16 + DYN_DEF
:
386 case WEAK_DEF
* 16 + DYN_DEF
:
387 case DYN_DEF
* 16 + DYN_DEF
:
388 case DYN_WEAK_DEF
* 16 + DYN_DEF
:
389 // Ignore a dynamic definition if we already have a definition.
392 case UNDEF
* 16 + DYN_DEF
:
393 case WEAK_UNDEF
* 16 + DYN_DEF
:
394 case DYN_UNDEF
* 16 + DYN_DEF
:
395 case DYN_WEAK_UNDEF
* 16 + DYN_DEF
:
396 // Use a dynamic definition if we have a reference.
399 case COMMON
* 16 + DYN_DEF
:
400 case WEAK_COMMON
* 16 + DYN_DEF
:
401 case DYN_COMMON
* 16 + DYN_DEF
:
402 case DYN_WEAK_COMMON
* 16 + DYN_DEF
:
403 // Ignore a dynamic definition if we already have a common
407 case DEF
* 16 + DYN_WEAK_DEF
:
408 case WEAK_DEF
* 16 + DYN_WEAK_DEF
:
409 case DYN_DEF
* 16 + DYN_WEAK_DEF
:
410 case DYN_WEAK_DEF
* 16 + DYN_WEAK_DEF
:
411 // Ignore a weak dynamic definition if we already have a
415 case UNDEF
* 16 + DYN_WEAK_DEF
:
416 case WEAK_UNDEF
* 16 + DYN_WEAK_DEF
:
417 case DYN_UNDEF
* 16 + DYN_WEAK_DEF
:
418 case DYN_WEAK_UNDEF
* 16 + DYN_WEAK_DEF
:
419 // Use a weak dynamic definition if we have a reference.
422 case COMMON
* 16 + DYN_WEAK_DEF
:
423 case WEAK_COMMON
* 16 + DYN_WEAK_DEF
:
424 case DYN_COMMON
* 16 + DYN_WEAK_DEF
:
425 case DYN_WEAK_COMMON
* 16 + DYN_WEAK_DEF
:
426 // Ignore a weak dynamic definition if we already have a common
430 case DEF
* 16 + UNDEF
:
431 case WEAK_DEF
* 16 + UNDEF
:
432 case DYN_DEF
* 16 + UNDEF
:
433 case DYN_WEAK_DEF
* 16 + UNDEF
:
434 case UNDEF
* 16 + UNDEF
:
435 // A new undefined reference tells us nothing.
438 case WEAK_UNDEF
* 16 + UNDEF
:
439 case DYN_UNDEF
* 16 + UNDEF
:
440 case DYN_WEAK_UNDEF
* 16 + UNDEF
:
441 // A strong undef overrides a dynamic or weak undef.
444 case COMMON
* 16 + UNDEF
:
445 case WEAK_COMMON
* 16 + UNDEF
:
446 case DYN_COMMON
* 16 + UNDEF
:
447 case DYN_WEAK_COMMON
* 16 + UNDEF
:
448 // A new undefined reference tells us nothing.
451 case DEF
* 16 + WEAK_UNDEF
:
452 case WEAK_DEF
* 16 + WEAK_UNDEF
:
453 case DYN_DEF
* 16 + WEAK_UNDEF
:
454 case DYN_WEAK_DEF
* 16 + WEAK_UNDEF
:
455 case UNDEF
* 16 + WEAK_UNDEF
:
456 case WEAK_UNDEF
* 16 + WEAK_UNDEF
:
457 case DYN_UNDEF
* 16 + WEAK_UNDEF
:
458 case DYN_WEAK_UNDEF
* 16 + WEAK_UNDEF
:
459 case COMMON
* 16 + WEAK_UNDEF
:
460 case WEAK_COMMON
* 16 + WEAK_UNDEF
:
461 case DYN_COMMON
* 16 + WEAK_UNDEF
:
462 case DYN_WEAK_COMMON
* 16 + WEAK_UNDEF
:
463 // A new weak undefined reference tells us nothing.
466 case DEF
* 16 + DYN_UNDEF
:
467 case WEAK_DEF
* 16 + DYN_UNDEF
:
468 case DYN_DEF
* 16 + DYN_UNDEF
:
469 case DYN_WEAK_DEF
* 16 + DYN_UNDEF
:
470 case UNDEF
* 16 + DYN_UNDEF
:
471 case WEAK_UNDEF
* 16 + DYN_UNDEF
:
472 case DYN_UNDEF
* 16 + DYN_UNDEF
:
473 case DYN_WEAK_UNDEF
* 16 + DYN_UNDEF
:
474 case COMMON
* 16 + DYN_UNDEF
:
475 case WEAK_COMMON
* 16 + DYN_UNDEF
:
476 case DYN_COMMON
* 16 + DYN_UNDEF
:
477 case DYN_WEAK_COMMON
* 16 + DYN_UNDEF
:
478 // A new dynamic undefined reference tells us nothing.
481 case DEF
* 16 + DYN_WEAK_UNDEF
:
482 case WEAK_DEF
* 16 + DYN_WEAK_UNDEF
:
483 case DYN_DEF
* 16 + DYN_WEAK_UNDEF
:
484 case DYN_WEAK_DEF
* 16 + DYN_WEAK_UNDEF
:
485 case UNDEF
* 16 + DYN_WEAK_UNDEF
:
486 case WEAK_UNDEF
* 16 + DYN_WEAK_UNDEF
:
487 case DYN_UNDEF
* 16 + DYN_WEAK_UNDEF
:
488 case DYN_WEAK_UNDEF
* 16 + DYN_WEAK_UNDEF
:
489 case COMMON
* 16 + DYN_WEAK_UNDEF
:
490 case WEAK_COMMON
* 16 + DYN_WEAK_UNDEF
:
491 case DYN_COMMON
* 16 + DYN_WEAK_UNDEF
:
492 case DYN_WEAK_COMMON
* 16 + DYN_WEAK_UNDEF
:
493 // A new weak dynamic undefined reference tells us nothing.
496 case DEF
* 16 + COMMON
:
497 // A common symbol does not override a definition.
500 case WEAK_DEF
* 16 + COMMON
:
501 case DYN_DEF
* 16 + COMMON
:
502 case DYN_WEAK_DEF
* 16 + COMMON
:
503 // A common symbol does override a weak definition or a dynamic
507 case UNDEF
* 16 + COMMON
:
508 case WEAK_UNDEF
* 16 + COMMON
:
509 case DYN_UNDEF
* 16 + COMMON
:
510 case DYN_WEAK_UNDEF
* 16 + COMMON
:
511 // A common symbol is a definition for a reference.
514 case COMMON
* 16 + COMMON
:
515 // Set the size to the maximum.
516 *adjust_common_sizes
= true;
519 case WEAK_COMMON
* 16 + COMMON
:
520 // I'm not sure just what a weak common symbol means, but
521 // presumably it can be overridden by a regular common symbol.
524 case DYN_COMMON
* 16 + COMMON
:
525 case DYN_WEAK_COMMON
* 16 + COMMON
:
526 // Use the real common symbol, but adjust the size if necessary.
527 *adjust_common_sizes
= true;
530 case DEF
* 16 + WEAK_COMMON
:
531 case WEAK_DEF
* 16 + WEAK_COMMON
:
532 case DYN_DEF
* 16 + WEAK_COMMON
:
533 case DYN_WEAK_DEF
* 16 + WEAK_COMMON
:
534 // Whatever a weak common symbol is, it won't override a
538 case UNDEF
* 16 + WEAK_COMMON
:
539 case WEAK_UNDEF
* 16 + WEAK_COMMON
:
540 case DYN_UNDEF
* 16 + WEAK_COMMON
:
541 case DYN_WEAK_UNDEF
* 16 + WEAK_COMMON
:
542 // A weak common symbol is better than an undefined symbol.
545 case COMMON
* 16 + WEAK_COMMON
:
546 case WEAK_COMMON
* 16 + WEAK_COMMON
:
547 case DYN_COMMON
* 16 + WEAK_COMMON
:
548 case DYN_WEAK_COMMON
* 16 + WEAK_COMMON
:
549 // Ignore a weak common symbol in the presence of a real common
553 case DEF
* 16 + DYN_COMMON
:
554 case WEAK_DEF
* 16 + DYN_COMMON
:
555 case DYN_DEF
* 16 + DYN_COMMON
:
556 case DYN_WEAK_DEF
* 16 + DYN_COMMON
:
557 // Ignore a dynamic common symbol in the presence of a
561 case UNDEF
* 16 + DYN_COMMON
:
562 case WEAK_UNDEF
* 16 + DYN_COMMON
:
563 case DYN_UNDEF
* 16 + DYN_COMMON
:
564 case DYN_WEAK_UNDEF
* 16 + DYN_COMMON
:
565 // A dynamic common symbol is a definition of sorts.
568 case COMMON
* 16 + DYN_COMMON
:
569 case WEAK_COMMON
* 16 + DYN_COMMON
:
570 case DYN_COMMON
* 16 + DYN_COMMON
:
571 case DYN_WEAK_COMMON
* 16 + DYN_COMMON
:
572 // Set the size to the maximum.
573 *adjust_common_sizes
= true;
576 case DEF
* 16 + DYN_WEAK_COMMON
:
577 case WEAK_DEF
* 16 + DYN_WEAK_COMMON
:
578 case DYN_DEF
* 16 + DYN_WEAK_COMMON
:
579 case DYN_WEAK_DEF
* 16 + DYN_WEAK_COMMON
:
580 // A common symbol is ignored in the face of a definition.
583 case UNDEF
* 16 + DYN_WEAK_COMMON
:
584 case WEAK_UNDEF
* 16 + DYN_WEAK_COMMON
:
585 case DYN_UNDEF
* 16 + DYN_WEAK_COMMON
:
586 case DYN_WEAK_UNDEF
* 16 + DYN_WEAK_COMMON
:
587 // I guess a weak common symbol is better than a definition.
590 case COMMON
* 16 + DYN_WEAK_COMMON
:
591 case WEAK_COMMON
* 16 + DYN_WEAK_COMMON
:
592 case DYN_COMMON
* 16 + DYN_WEAK_COMMON
:
593 case DYN_WEAK_COMMON
* 16 + DYN_WEAK_COMMON
:
594 // Set the size to the maximum.
595 *adjust_common_sizes
= true;
603 // A special case of should_override which is only called for a strong
604 // defined symbol from a regular object file. This is used when
605 // defining special symbols.
608 Symbol_table::should_override_with_special(const Symbol
* to
)
610 bool adjust_common_sizes
;
611 unsigned int frombits
= global_flag
| regular_flag
| def_flag
;
612 bool ret
= Symbol_table::should_override(to
, frombits
, NULL
,
613 &adjust_common_sizes
);
614 gold_assert(!adjust_common_sizes
);
618 // Override symbol base with a special symbol.
621 Symbol::override_base_with_special(const Symbol
* from
)
623 gold_assert(this->name_
== from
->name_
|| this->has_alias());
625 this->source_
= from
->source_
;
626 switch (from
->source_
)
629 this->u_
.from_object
= from
->u_
.from_object
;
632 this->u_
.in_output_data
= from
->u_
.in_output_data
;
634 case IN_OUTPUT_SEGMENT
:
635 this->u_
.in_output_segment
= from
->u_
.in_output_segment
;
644 if (from
->version_
!= NULL
&& this->version_
!= from
->version_
)
646 gold_assert(this->version_
== NULL
);
647 this->version_
= from
->version_
;
650 this->type_
= from
->type_
;
651 this->binding_
= from
->binding_
;
652 this->visibility_
= from
->visibility_
;
653 this->nonvis_
= from
->nonvis_
;
655 // Special symbols are always considered to be regular symbols.
656 this->in_reg_
= true;
658 if (from
->needs_dynsym_entry_
)
659 this->needs_dynsym_entry_
= true;
660 if (from
->needs_dynsym_value_
)
661 this->needs_dynsym_value_
= true;
663 // We shouldn't see these flags. If we do, we need to handle them
665 gold_assert(!from
->is_target_special_
|| this->is_target_special_
);
666 gold_assert(!from
->is_forwarder_
);
667 gold_assert(!from
->has_got_offset_
);
668 gold_assert(!from
->has_plt_offset_
);
669 gold_assert(!from
->has_warning_
);
670 gold_assert(!from
->is_copied_from_dynobj_
);
673 // Override a symbol with a special symbol.
677 Sized_symbol
<size
>::override_with_special(const Sized_symbol
<size
>* from
)
679 this->override_base_with_special(from
);
680 this->value_
= from
->value_
;
681 this->symsize_
= from
->symsize_
;
684 // Override TOSYM with the special symbol FROMSYM. This handles all
689 Symbol_table::override_with_special(Sized_symbol
<size
>* tosym
,
690 const Sized_symbol
<size
>* fromsym
)
692 tosym
->override_with_special(fromsym
);
693 if (tosym
->has_alias())
695 Symbol
* sym
= this->weak_aliases_
[tosym
];
696 gold_assert(sym
!= NULL
);
697 Sized_symbol
<size
>* ssym
;
698 ssym
= this->get_sized_symbol
SELECT_SIZE_NAME(size
) (sym
702 ssym
->override_with_special(fromsym
);
703 sym
= this->weak_aliases_
[ssym
];
704 gold_assert(sym
!= NULL
);
705 ssym
= this->get_sized_symbol
SELECT_SIZE_NAME(size
) (
706 sym
SELECT_SIZE(size
));
708 while (ssym
!= tosym
);
712 // Instantiate the templates we need. We could use the configure
713 // script to restrict this to only the ones needed for implemented
716 #ifdef HAVE_TARGET_32_LITTLE
719 Symbol_table::resolve
<32, false>(
720 Sized_symbol
<32>* to
,
721 const elfcpp::Sym
<32, false>& sym
,
723 const char* version
);
726 #ifdef HAVE_TARGET_32_BIG
729 Symbol_table::resolve
<32, true>(
730 Sized_symbol
<32>* to
,
731 const elfcpp::Sym
<32, true>& sym
,
733 const char* version
);
736 #ifdef HAVE_TARGET_64_LITTLE
739 Symbol_table::resolve
<64, false>(
740 Sized_symbol
<64>* to
,
741 const elfcpp::Sym
<64, false>& sym
,
743 const char* version
);
746 #ifdef HAVE_TARGET_64_BIG
749 Symbol_table::resolve
<64, true>(
750 Sized_symbol
<64>* to
,
751 const elfcpp::Sym
<64, true>& sym
,
753 const char* version
);
756 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
759 Symbol_table::override_with_special
<32>(Sized_symbol
<32>*,
760 const Sized_symbol
<32>*);
763 #if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
766 Symbol_table::override_with_special
<64>(Sized_symbol
<64>*,
767 const Sized_symbol
<64>*);
770 } // End namespace gold.