1 // object.cc -- support for an object file for linking in gold
3 // Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
4 // Written by Ian Lance Taylor <iant@google.com>.
6 // This file is part of gold.
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 3 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 // MA 02110-1301, USA.
29 #include "libiberty.h"
31 #include "target-select.h"
32 #include "dwarf_reader.h"
45 // Set the target based on fields in the ELF file header.
48 Object::set_target(int machine
, int size
, bool big_endian
, int osabi
,
51 Target
* target
= select_target(machine
, size
, big_endian
, osabi
, abiversion
);
53 gold_fatal(_("%s: unsupported ELF machine number %d"),
54 this->name().c_str(), machine
);
55 this->target_
= target
;
58 // Report an error for this object file. This is used by the
59 // elfcpp::Elf_file interface, and also called by the Object code
63 Object::error(const char* format
, ...) const
66 va_start(args
, format
);
68 if (vasprintf(&buf
, format
, args
) < 0)
71 gold_error(_("%s: %s"), this->name().c_str(), buf
);
75 // Return a view of the contents of a section.
78 Object::section_contents(unsigned int shndx
, section_size_type
* plen
,
81 Location
loc(this->do_section_contents(shndx
));
82 *plen
= convert_to_section_size_type(loc
.data_size
);
83 return this->get_view(loc
.file_offset
, *plen
, cache
);
86 // Read the section data into SD. This is code common to Sized_relobj
87 // and Sized_dynobj, so we put it into Object.
89 template<int size
, bool big_endian
>
91 Object::read_section_data(elfcpp::Elf_file
<size
, big_endian
, Object
>* elf_file
,
92 Read_symbols_data
* sd
)
94 const int shdr_size
= elfcpp::Elf_sizes
<size
>::shdr_size
;
96 // Read the section headers.
97 const off_t shoff
= elf_file
->shoff();
98 const unsigned int shnum
= this->shnum();
99 sd
->section_headers
= this->get_lasting_view(shoff
, shnum
* shdr_size
, true);
101 // Read the section names.
102 const unsigned char* pshdrs
= sd
->section_headers
->data();
103 const unsigned char* pshdrnames
= pshdrs
+ elf_file
->shstrndx() * shdr_size
;
104 typename
elfcpp::Shdr
<size
, big_endian
> shdrnames(pshdrnames
);
106 if (shdrnames
.get_sh_type() != elfcpp::SHT_STRTAB
)
107 this->error(_("section name section has wrong type: %u"),
108 static_cast<unsigned int>(shdrnames
.get_sh_type()));
110 sd
->section_names_size
=
111 convert_to_section_size_type(shdrnames
.get_sh_size());
112 sd
->section_names
= this->get_lasting_view(shdrnames
.get_sh_offset(),
113 sd
->section_names_size
, false);
116 // If NAME is the name of a special .gnu.warning section, arrange for
117 // the warning to be issued. SHNDX is the section index. Return
118 // whether it is a warning section.
121 Object::handle_gnu_warning_section(const char* name
, unsigned int shndx
,
122 Symbol_table
* symtab
)
124 const char warn_prefix
[] = ".gnu.warning.";
125 const int warn_prefix_len
= sizeof warn_prefix
- 1;
126 if (strncmp(name
, warn_prefix
, warn_prefix_len
) == 0)
128 // Read the section contents to get the warning text. It would
129 // be nicer if we only did this if we have to actually issue a
130 // warning. Unfortunately, warnings are issued as we relocate
131 // sections. That means that we can not lock the object then,
132 // as we might try to issue the same warning multiple times
134 section_size_type len
;
135 const unsigned char* contents
= this->section_contents(shndx
, &len
,
137 std::string
warning(reinterpret_cast<const char*>(contents
), len
);
138 symtab
->add_warning(name
+ warn_prefix_len
, this, warning
);
144 // Class Sized_relobj.
146 template<int size
, bool big_endian
>
147 Sized_relobj
<size
, big_endian
>::Sized_relobj(
148 const std::string
& name
,
149 Input_file
* input_file
,
151 const elfcpp::Ehdr
<size
, big_endian
>& ehdr
)
152 : Relobj(name
, input_file
, offset
),
153 elf_file_(this, ehdr
),
155 local_symbol_count_(0),
156 output_local_symbol_count_(0),
157 output_local_dynsym_count_(0),
159 local_symbol_offset_(0),
160 local_dynsym_offset_(0),
162 local_got_offsets_(),
167 template<int size
, bool big_endian
>
168 Sized_relobj
<size
, big_endian
>::~Sized_relobj()
172 // Set up an object file based on the file header. This sets up the
173 // target and reads the section information.
175 template<int size
, bool big_endian
>
177 Sized_relobj
<size
, big_endian
>::setup(
178 const elfcpp::Ehdr
<size
, big_endian
>& ehdr
)
180 this->set_target(ehdr
.get_e_machine(), size
, big_endian
,
181 ehdr
.get_e_ident()[elfcpp::EI_OSABI
],
182 ehdr
.get_e_ident()[elfcpp::EI_ABIVERSION
]);
184 const unsigned int shnum
= this->elf_file_
.shnum();
185 this->set_shnum(shnum
);
188 // Find the SHT_SYMTAB section, given the section headers. The ELF
189 // standard says that maybe in the future there can be more than one
190 // SHT_SYMTAB section. Until somebody figures out how that could
191 // work, we assume there is only one.
193 template<int size
, bool big_endian
>
195 Sized_relobj
<size
, big_endian
>::find_symtab(const unsigned char* pshdrs
)
197 const unsigned int shnum
= this->shnum();
198 this->symtab_shndx_
= 0;
201 // Look through the sections in reverse order, since gas tends
202 // to put the symbol table at the end.
203 const unsigned char* p
= pshdrs
+ shnum
* This::shdr_size
;
204 unsigned int i
= shnum
;
208 p
-= This::shdr_size
;
209 typename
This::Shdr
shdr(p
);
210 if (shdr
.get_sh_type() == elfcpp::SHT_SYMTAB
)
212 this->symtab_shndx_
= i
;
219 // Return whether SHDR has the right type and flags to be a GNU
220 // .eh_frame section.
222 template<int size
, bool big_endian
>
224 Sized_relobj
<size
, big_endian
>::check_eh_frame_flags(
225 const elfcpp::Shdr
<size
, big_endian
>* shdr
) const
227 return (shdr
->get_sh_size() > 0
228 && shdr
->get_sh_type() == elfcpp::SHT_PROGBITS
229 && (shdr
->get_sh_flags() & elfcpp::SHF_ALLOC
) != 0);
232 // Return whether there is a GNU .eh_frame section, given the section
233 // headers and the section names.
235 template<int size
, bool big_endian
>
237 Sized_relobj
<size
, big_endian
>::find_eh_frame(
238 const unsigned char* pshdrs
,
240 section_size_type names_size
) const
242 const unsigned int shnum
= this->shnum();
243 const unsigned char* p
= pshdrs
+ This::shdr_size
;
244 for (unsigned int i
= 1; i
< shnum
; ++i
, p
+= This::shdr_size
)
246 typename
This::Shdr
shdr(p
);
247 if (this->check_eh_frame_flags(&shdr
))
249 if (shdr
.get_sh_name() >= names_size
)
251 this->error(_("bad section name offset for section %u: %lu"),
252 i
, static_cast<unsigned long>(shdr
.get_sh_name()));
256 const char* name
= names
+ shdr
.get_sh_name();
257 if (strcmp(name
, ".eh_frame") == 0)
264 // Read the sections and symbols from an object file.
266 template<int size
, bool big_endian
>
268 Sized_relobj
<size
, big_endian
>::do_read_symbols(Read_symbols_data
* sd
)
270 this->read_section_data(&this->elf_file_
, sd
);
272 const unsigned char* const pshdrs
= sd
->section_headers
->data();
274 this->find_symtab(pshdrs
);
276 const unsigned char* namesu
= sd
->section_names
->data();
277 const char* names
= reinterpret_cast<const char*>(namesu
);
278 if (memmem(names
, sd
->section_names_size
, ".eh_frame", 10) != NULL
)
280 if (this->find_eh_frame(pshdrs
, names
, sd
->section_names_size
))
281 this->has_eh_frame_
= true;
285 sd
->symbols_size
= 0;
286 sd
->external_symbols_offset
= 0;
287 sd
->symbol_names
= NULL
;
288 sd
->symbol_names_size
= 0;
290 if (this->symtab_shndx_
== 0)
292 // No symbol table. Weird but legal.
296 // Get the symbol table section header.
297 typename
This::Shdr
symtabshdr(pshdrs
298 + this->symtab_shndx_
* This::shdr_size
);
299 gold_assert(symtabshdr
.get_sh_type() == elfcpp::SHT_SYMTAB
);
301 // If this object has a .eh_frame section, we need all the symbols.
302 // Otherwise we only need the external symbols. While it would be
303 // simpler to just always read all the symbols, I've seen object
304 // files with well over 2000 local symbols, which for a 64-bit
305 // object file format is over 5 pages that we don't need to read
308 const int sym_size
= This::sym_size
;
309 const unsigned int loccount
= symtabshdr
.get_sh_info();
310 this->local_symbol_count_
= loccount
;
311 this->local_values_
.resize(loccount
);
312 section_offset_type locsize
= loccount
* sym_size
;
313 off_t dataoff
= symtabshdr
.get_sh_offset();
314 section_size_type datasize
=
315 convert_to_section_size_type(symtabshdr
.get_sh_size());
316 off_t extoff
= dataoff
+ locsize
;
317 section_size_type extsize
= datasize
- locsize
;
319 off_t readoff
= this->has_eh_frame_
? dataoff
: extoff
;
320 section_size_type readsize
= this->has_eh_frame_
? datasize
: extsize
;
322 File_view
* fvsymtab
= this->get_lasting_view(readoff
, readsize
, false);
324 // Read the section header for the symbol names.
325 unsigned int strtab_shndx
= symtabshdr
.get_sh_link();
326 if (strtab_shndx
>= this->shnum())
328 this->error(_("invalid symbol table name index: %u"), strtab_shndx
);
331 typename
This::Shdr
strtabshdr(pshdrs
+ strtab_shndx
* This::shdr_size
);
332 if (strtabshdr
.get_sh_type() != elfcpp::SHT_STRTAB
)
334 this->error(_("symbol table name section has wrong type: %u"),
335 static_cast<unsigned int>(strtabshdr
.get_sh_type()));
339 // Read the symbol names.
340 File_view
* fvstrtab
= this->get_lasting_view(strtabshdr
.get_sh_offset(),
341 strtabshdr
.get_sh_size(), true);
343 sd
->symbols
= fvsymtab
;
344 sd
->symbols_size
= readsize
;
345 sd
->external_symbols_offset
= this->has_eh_frame_
? locsize
: 0;
346 sd
->symbol_names
= fvstrtab
;
347 sd
->symbol_names_size
=
348 convert_to_section_size_type(strtabshdr
.get_sh_size());
351 // Return the section index of symbol SYM. Set *VALUE to its value in
352 // the object file. Note that for a symbol which is not defined in
353 // this object file, this will set *VALUE to 0 and return SHN_UNDEF;
354 // it will not return the final value of the symbol in the link.
356 template<int size
, bool big_endian
>
358 Sized_relobj
<size
, big_endian
>::symbol_section_and_value(unsigned int sym
,
361 section_size_type symbols_size
;
362 const unsigned char* symbols
= this->section_contents(this->symtab_shndx_
,
366 const size_t count
= symbols_size
/ This::sym_size
;
367 gold_assert(sym
< count
);
369 elfcpp::Sym
<size
, big_endian
> elfsym(symbols
+ sym
* This::sym_size
);
370 *value
= elfsym
.get_st_value();
371 // FIXME: Handle SHN_XINDEX.
372 return elfsym
.get_st_shndx();
375 // Return whether to include a section group in the link. LAYOUT is
376 // used to keep track of which section groups we have already seen.
377 // INDEX is the index of the section group and SHDR is the section
378 // header. If we do not want to include this group, we set bits in
379 // OMIT for each section which should be discarded.
381 template<int size
, bool big_endian
>
383 Sized_relobj
<size
, big_endian
>::include_section_group(
384 Symbol_table
* symtab
,
388 const elfcpp::Shdr
<size
, big_endian
>& shdr
,
389 std::vector
<bool>* omit
)
391 // Read the section contents.
392 const unsigned char* pcon
= this->get_view(shdr
.get_sh_offset(),
393 shdr
.get_sh_size(), false);
394 const elfcpp::Elf_Word
* pword
=
395 reinterpret_cast<const elfcpp::Elf_Word
*>(pcon
);
397 // The first word contains flags. We only care about COMDAT section
398 // groups. Other section groups are always included in the link
399 // just like ordinary sections.
400 elfcpp::Elf_Word flags
= elfcpp::Swap
<32, big_endian
>::readval(pword
);
402 // Look up the group signature, which is the name of a symbol. This
403 // is a lot of effort to go to to read a string. Why didn't they
404 // just have the group signature point into the string table, rather
405 // than indirect through a symbol?
407 // Get the appropriate symbol table header (this will normally be
408 // the single SHT_SYMTAB section, but in principle it need not be).
409 const unsigned int link
= shdr
.get_sh_link();
410 typename
This::Shdr
symshdr(this, this->elf_file_
.section_header(link
));
412 // Read the symbol table entry.
413 if (shdr
.get_sh_info() >= symshdr
.get_sh_size() / This::sym_size
)
415 this->error(_("section group %u info %u out of range"),
416 index
, shdr
.get_sh_info());
419 off_t symoff
= symshdr
.get_sh_offset() + shdr
.get_sh_info() * This::sym_size
;
420 const unsigned char* psym
= this->get_view(symoff
, This::sym_size
, false);
421 elfcpp::Sym
<size
, big_endian
> sym(psym
);
423 // Read the symbol table names.
424 section_size_type symnamelen
;
425 const unsigned char* psymnamesu
;
426 psymnamesu
= this->section_contents(symshdr
.get_sh_link(), &symnamelen
,
428 const char* psymnames
= reinterpret_cast<const char*>(psymnamesu
);
430 // Get the section group signature.
431 if (sym
.get_st_name() >= symnamelen
)
433 this->error(_("symbol %u name offset %u out of range"),
434 shdr
.get_sh_info(), sym
.get_st_name());
438 const char* signature
= psymnames
+ sym
.get_st_name();
440 // It seems that some versions of gas will create a section group
441 // associated with a section symbol, and then fail to give a name to
442 // the section symbol. In such a case, use the name of the section.
445 if (signature
[0] == '\0' && sym
.get_st_type() == elfcpp::STT_SECTION
)
447 secname
= this->section_name(sym
.get_st_shndx());
448 signature
= secname
.c_str();
451 // Record this section group, and see whether we've already seen one
452 // with the same signature.
454 if ((flags
& elfcpp::GRP_COMDAT
) == 0
455 || layout
->add_comdat(signature
, true))
457 if (parameters
->options().relocatable())
458 layout
->layout_group(symtab
, this, index
, name
, signature
, shdr
,
463 // This is a duplicate. We want to discard the sections in this
465 size_t count
= shdr
.get_sh_size() / sizeof(elfcpp::Elf_Word
);
466 for (size_t i
= 1; i
< count
; ++i
)
468 elfcpp::Elf_Word secnum
=
469 elfcpp::Swap
<32, big_endian
>::readval(pword
+ i
);
470 if (secnum
>= this->shnum())
472 this->error(_("section %u in section group %u out of range"),
476 (*omit
)[secnum
] = true;
482 // Whether to include a linkonce section in the link. NAME is the
483 // name of the section and SHDR is the section header.
485 // Linkonce sections are a GNU extension implemented in the original
486 // GNU linker before section groups were defined. The semantics are
487 // that we only include one linkonce section with a given name. The
488 // name of a linkonce section is normally .gnu.linkonce.T.SYMNAME,
489 // where T is the type of section and SYMNAME is the name of a symbol.
490 // In an attempt to make linkonce sections interact well with section
491 // groups, we try to identify SYMNAME and use it like a section group
492 // signature. We want to block section groups with that signature,
493 // but not other linkonce sections with that signature. We also use
494 // the full name of the linkonce section as a normal section group
497 template<int size
, bool big_endian
>
499 Sized_relobj
<size
, big_endian
>::include_linkonce_section(
502 const elfcpp::Shdr
<size
, big_endian
>&)
504 // In general the symbol name we want will be the string following
505 // the last '.'. However, we have to handle the case of
506 // .gnu.linkonce.t.__i686.get_pc_thunk.bx, which was generated by
507 // some versions of gcc. So we use a heuristic: if the name starts
508 // with ".gnu.linkonce.t.", we use everything after that. Otherwise
509 // we look for the last '.'. We can't always simply skip
510 // ".gnu.linkonce.X", because we have to deal with cases like
511 // ".gnu.linkonce.d.rel.ro.local".
512 const char* const linkonce_t
= ".gnu.linkonce.t.";
514 if (strncmp(name
, linkonce_t
, strlen(linkonce_t
)) == 0)
515 symname
= name
+ strlen(linkonce_t
);
517 symname
= strrchr(name
, '.') + 1;
518 bool include1
= layout
->add_comdat(symname
, false);
519 bool include2
= layout
->add_comdat(name
, true);
520 return include1
&& include2
;
523 // Lay out the input sections. We walk through the sections and check
524 // whether they should be included in the link. If they should, we
525 // pass them to the Layout object, which will return an output section
528 template<int size
, bool big_endian
>
530 Sized_relobj
<size
, big_endian
>::do_layout(Symbol_table
* symtab
,
532 Read_symbols_data
* sd
)
534 const unsigned int shnum
= this->shnum();
538 // Get the section headers.
539 const unsigned char* pshdrs
= sd
->section_headers
->data();
541 // Get the section names.
542 const unsigned char* pnamesu
= sd
->section_names
->data();
543 const char* pnames
= reinterpret_cast<const char*>(pnamesu
);
545 // For each section, record the index of the reloc section if any.
546 // Use 0 to mean that there is no reloc section, -1U to mean that
547 // there is more than one.
548 std::vector
<unsigned int> reloc_shndx(shnum
, 0);
549 std::vector
<unsigned int> reloc_type(shnum
, elfcpp::SHT_NULL
);
550 // Skip the first, dummy, section.
551 pshdrs
+= This::shdr_size
;
552 for (unsigned int i
= 1; i
< shnum
; ++i
, pshdrs
+= This::shdr_size
)
554 typename
This::Shdr
shdr(pshdrs
);
556 unsigned int sh_type
= shdr
.get_sh_type();
557 if (sh_type
== elfcpp::SHT_REL
|| sh_type
== elfcpp::SHT_RELA
)
559 unsigned int target_shndx
= shdr
.get_sh_info();
560 if (target_shndx
== 0 || target_shndx
>= shnum
)
562 this->error(_("relocation section %u has bad info %u"),
567 if (reloc_shndx
[target_shndx
] != 0)
568 reloc_shndx
[target_shndx
] = -1U;
571 reloc_shndx
[target_shndx
] = i
;
572 reloc_type
[target_shndx
] = sh_type
;
577 std::vector
<Map_to_output
>& map_sections(this->map_to_output());
578 map_sections
.resize(shnum
);
580 // If we are only linking for symbols, then there is nothing else to
582 if (this->input_file()->just_symbols())
584 delete sd
->section_headers
;
585 sd
->section_headers
= NULL
;
586 delete sd
->section_names
;
587 sd
->section_names
= NULL
;
591 // Whether we've seen a .note.GNU-stack section.
592 bool seen_gnu_stack
= false;
593 // The flags of a .note.GNU-stack section.
594 uint64_t gnu_stack_flags
= 0;
596 // Keep track of which sections to omit.
597 std::vector
<bool> omit(shnum
, false);
599 // Keep track of reloc sections when emitting relocations.
600 const bool relocatable
= parameters
->options().relocatable();
601 const bool emit_relocs
= (relocatable
602 || parameters
->options().emit_relocs());
603 std::vector
<unsigned int> reloc_sections
;
605 // Keep track of .eh_frame sections.
606 std::vector
<unsigned int> eh_frame_sections
;
608 // Skip the first, dummy, section.
609 pshdrs
= sd
->section_headers
->data() + This::shdr_size
;
610 for (unsigned int i
= 1; i
< shnum
; ++i
, pshdrs
+= This::shdr_size
)
612 typename
This::Shdr
shdr(pshdrs
);
614 if (shdr
.get_sh_name() >= sd
->section_names_size
)
616 this->error(_("bad section name offset for section %u: %lu"),
617 i
, static_cast<unsigned long>(shdr
.get_sh_name()));
621 const char* name
= pnames
+ shdr
.get_sh_name();
623 if (this->handle_gnu_warning_section(name
, i
, symtab
))
629 // The .note.GNU-stack section is special. It gives the
630 // protection flags that this object file requires for the stack
632 if (strcmp(name
, ".note.GNU-stack") == 0)
634 seen_gnu_stack
= true;
635 gnu_stack_flags
|= shdr
.get_sh_flags();
639 bool discard
= omit
[i
];
642 if (shdr
.get_sh_type() == elfcpp::SHT_GROUP
)
644 if (!this->include_section_group(symtab
, layout
, i
, name
, shdr
,
648 else if ((shdr
.get_sh_flags() & elfcpp::SHF_GROUP
) == 0
649 && Layout::is_linkonce(name
))
651 if (!this->include_linkonce_section(layout
, name
, shdr
))
658 // Do not include this section in the link.
659 map_sections
[i
].output_section
= NULL
;
663 // When doing a relocatable link we are going to copy input
664 // reloc sections into the output. We only want to copy the
665 // ones associated with sections which are not being discarded.
666 // However, we don't know that yet for all sections. So save
667 // reloc sections and process them later.
669 && (shdr
.get_sh_type() == elfcpp::SHT_REL
670 || shdr
.get_sh_type() == elfcpp::SHT_RELA
))
672 reloc_sections
.push_back(i
);
676 if (relocatable
&& shdr
.get_sh_type() == elfcpp::SHT_GROUP
)
679 // The .eh_frame section is special. It holds exception frame
680 // information that we need to read in order to generate the
681 // exception frame header. We process these after all the other
682 // sections so that the exception frame reader can reliably
683 // determine which sections are being discarded, and discard the
684 // corresponding information.
686 && strcmp(name
, ".eh_frame") == 0
687 && this->check_eh_frame_flags(&shdr
))
689 eh_frame_sections
.push_back(i
);
694 Output_section
* os
= layout
->layout(this, i
, name
, shdr
,
695 reloc_shndx
[i
], reloc_type
[i
],
698 map_sections
[i
].output_section
= os
;
699 map_sections
[i
].offset
= offset
;
701 // If this section requires special handling, and if there are
702 // relocs that apply to it, then we must do the special handling
703 // before we apply the relocs.
704 if (offset
== -1 && reloc_shndx
[i
] != 0)
705 this->set_relocs_must_follow_section_writes();
708 layout
->layout_gnu_stack(seen_gnu_stack
, gnu_stack_flags
);
710 // When doing a relocatable link handle the reloc sections at the
713 this->size_relocatable_relocs();
714 for (std::vector
<unsigned int>::const_iterator p
= reloc_sections
.begin();
715 p
!= reloc_sections
.end();
719 const unsigned char* pshdr
;
720 pshdr
= sd
->section_headers
->data() + i
* This::shdr_size
;
721 typename
This::Shdr
shdr(pshdr
);
723 unsigned int data_shndx
= shdr
.get_sh_info();
724 if (data_shndx
>= shnum
)
726 // We already warned about this above.
730 Output_section
* data_section
= map_sections
[data_shndx
].output_section
;
731 if (data_section
== NULL
)
733 map_sections
[i
].output_section
= NULL
;
737 Relocatable_relocs
* rr
= new Relocatable_relocs();
738 this->set_relocatable_relocs(i
, rr
);
740 Output_section
* os
= layout
->layout_reloc(this, i
, shdr
, data_section
,
742 map_sections
[i
].output_section
= os
;
743 map_sections
[i
].offset
= -1;
746 // Handle the .eh_frame sections at the end.
747 for (std::vector
<unsigned int>::const_iterator p
= eh_frame_sections
.begin();
748 p
!= eh_frame_sections
.end();
751 gold_assert(this->has_eh_frame_
);
752 gold_assert(sd
->external_symbols_offset
!= 0);
755 const unsigned char *pshdr
;
756 pshdr
= sd
->section_headers
->data() + i
* This::shdr_size
;
757 typename
This::Shdr
shdr(pshdr
);
760 Output_section
* os
= layout
->layout_eh_frame(this,
763 sd
->symbol_names
->data(),
764 sd
->symbol_names_size
,
769 map_sections
[i
].output_section
= os
;
770 map_sections
[i
].offset
= offset
;
772 // If this section requires special handling, and if there are
773 // relocs that apply to it, then we must do the special handling
774 // before we apply the relocs.
775 if (offset
== -1 && reloc_shndx
[i
] != 0)
776 this->set_relocs_must_follow_section_writes();
779 delete sd
->section_headers
;
780 sd
->section_headers
= NULL
;
781 delete sd
->section_names
;
782 sd
->section_names
= NULL
;
785 // Add the symbols to the symbol table.
787 template<int size
, bool big_endian
>
789 Sized_relobj
<size
, big_endian
>::do_add_symbols(Symbol_table
* symtab
,
790 Read_symbols_data
* sd
)
792 if (sd
->symbols
== NULL
)
794 gold_assert(sd
->symbol_names
== NULL
);
798 const int sym_size
= This::sym_size
;
799 size_t symcount
= ((sd
->symbols_size
- sd
->external_symbols_offset
)
801 if (symcount
* sym_size
!= sd
->symbols_size
- sd
->external_symbols_offset
)
803 this->error(_("size of symbols is not multiple of symbol size"));
807 this->symbols_
.resize(symcount
);
809 const char* sym_names
=
810 reinterpret_cast<const char*>(sd
->symbol_names
->data());
811 symtab
->add_from_relobj(this,
812 sd
->symbols
->data() + sd
->external_symbols_offset
,
813 symcount
, sym_names
, sd
->symbol_names_size
,
818 delete sd
->symbol_names
;
819 sd
->symbol_names
= NULL
;
822 // First pass over the local symbols. Here we add their names to
823 // *POOL and *DYNPOOL, and we store the symbol value in
824 // THIS->LOCAL_VALUES_. This function is always called from a
825 // singleton thread. This is followed by a call to
826 // finalize_local_symbols.
828 template<int size
, bool big_endian
>
830 Sized_relobj
<size
, big_endian
>::do_count_local_symbols(Stringpool
* pool
,
833 gold_assert(this->symtab_shndx_
!= -1U);
834 if (this->symtab_shndx_
== 0)
836 // This object has no symbols. Weird but legal.
840 // Read the symbol table section header.
841 const unsigned int symtab_shndx
= this->symtab_shndx_
;
842 typename
This::Shdr
symtabshdr(this,
843 this->elf_file_
.section_header(symtab_shndx
));
844 gold_assert(symtabshdr
.get_sh_type() == elfcpp::SHT_SYMTAB
);
846 // Read the local symbols.
847 const int sym_size
= This::sym_size
;
848 const unsigned int loccount
= this->local_symbol_count_
;
849 gold_assert(loccount
== symtabshdr
.get_sh_info());
850 off_t locsize
= loccount
* sym_size
;
851 const unsigned char* psyms
= this->get_view(symtabshdr
.get_sh_offset(),
854 // Read the symbol names.
855 const unsigned int strtab_shndx
= symtabshdr
.get_sh_link();
856 section_size_type strtab_size
;
857 const unsigned char* pnamesu
= this->section_contents(strtab_shndx
,
860 const char* pnames
= reinterpret_cast<const char*>(pnamesu
);
862 // Loop over the local symbols.
864 const std::vector
<Map_to_output
>& mo(this->map_to_output());
865 unsigned int shnum
= this->shnum();
866 unsigned int count
= 0;
867 unsigned int dyncount
= 0;
868 // Skip the first, dummy, symbol.
870 for (unsigned int i
= 1; i
< loccount
; ++i
, psyms
+= sym_size
)
872 elfcpp::Sym
<size
, big_endian
> sym(psyms
);
874 Symbol_value
<size
>& lv(this->local_values_
[i
]);
876 unsigned int shndx
= sym
.get_st_shndx();
877 lv
.set_input_shndx(shndx
);
879 if (sym
.get_st_type() == elfcpp::STT_SECTION
)
880 lv
.set_is_section_symbol();
881 else if (sym
.get_st_type() == elfcpp::STT_TLS
)
882 lv
.set_is_tls_symbol();
884 // Save the input symbol value for use in do_finalize_local_symbols().
885 lv
.set_input_value(sym
.get_st_value());
887 // Decide whether this symbol should go into the output file.
889 if (shndx
< shnum
&& mo
[shndx
].output_section
== NULL
)
891 lv
.set_no_output_symtab_entry();
892 gold_assert(!lv
.needs_output_dynsym_entry());
896 if (sym
.get_st_type() == elfcpp::STT_SECTION
)
898 lv
.set_no_output_symtab_entry();
899 gold_assert(!lv
.needs_output_dynsym_entry());
903 if (sym
.get_st_name() >= strtab_size
)
905 this->error(_("local symbol %u section name out of range: %u >= %u"),
906 i
, sym
.get_st_name(),
907 static_cast<unsigned int>(strtab_size
));
908 lv
.set_no_output_symtab_entry();
912 // Add the symbol to the symbol table string pool.
913 const char* name
= pnames
+ sym
.get_st_name();
914 pool
->add(name
, true, NULL
);
917 // If needed, add the symbol to the dynamic symbol table string pool.
918 if (lv
.needs_output_dynsym_entry())
920 dynpool
->add(name
, true, NULL
);
925 this->output_local_symbol_count_
= count
;
926 this->output_local_dynsym_count_
= dyncount
;
929 // Finalize the local symbols. Here we set the final value in
930 // THIS->LOCAL_VALUES_ and set their output symbol table indexes.
931 // This function is always called from a singleton thread. The actual
932 // output of the local symbols will occur in a separate task.
934 template<int size
, bool big_endian
>
936 Sized_relobj
<size
, big_endian
>::do_finalize_local_symbols(unsigned int index
,
939 gold_assert(off
== static_cast<off_t
>(align_address(off
, size
>> 3)));
941 const unsigned int loccount
= this->local_symbol_count_
;
942 this->local_symbol_offset_
= off
;
944 const std::vector
<Map_to_output
>& mo(this->map_to_output());
945 unsigned int shnum
= this->shnum();
947 for (unsigned int i
= 1; i
< loccount
; ++i
)
949 Symbol_value
<size
>& lv(this->local_values_
[i
]);
951 unsigned int shndx
= lv
.input_shndx();
953 // Set the output symbol value.
955 if (shndx
>= elfcpp::SHN_LORESERVE
)
957 if (shndx
== elfcpp::SHN_ABS
|| shndx
== elfcpp::SHN_COMMON
)
958 lv
.set_output_value(lv
.input_value());
961 // FIXME: Handle SHN_XINDEX.
962 this->error(_("unknown section index %u for local symbol %u"),
964 lv
.set_output_value(0);
971 this->error(_("local symbol %u section index %u out of range"),
976 Output_section
* os
= mo
[shndx
].output_section
;
980 lv
.set_output_value(0);
983 else if (mo
[shndx
].offset
== -1)
985 // This is a SHF_MERGE section or one which otherwise
986 // requires special handling. We get the output address
987 // of the start of the merged section. If this is not a
988 // section symbol, we can then determine the final
989 // value. If it is a section symbol, we can not, as in
990 // that case we have to consider the addend to determine
991 // the value to use in a relocation.
992 if (!lv
.is_section_symbol())
993 lv
.set_output_value(os
->output_address(this, shndx
,
997 section_offset_type start
=
998 os
->starting_output_address(this, shndx
);
999 Merged_symbol_value
<size
>* msv
=
1000 new Merged_symbol_value
<size
>(lv
.input_value(), start
);
1001 lv
.set_merged_symbol_value(msv
);
1004 else if (lv
.is_tls_symbol())
1005 lv
.set_output_value(os
->tls_offset()
1007 + lv
.input_value());
1009 lv
.set_output_value(os
->address()
1011 + lv
.input_value());
1014 if (lv
.needs_output_symtab_entry())
1016 lv
.set_output_symtab_index(index
);
1023 // Set the output dynamic symbol table indexes for the local variables.
1025 template<int size
, bool big_endian
>
1027 Sized_relobj
<size
, big_endian
>::do_set_local_dynsym_indexes(unsigned int index
)
1029 const unsigned int loccount
= this->local_symbol_count_
;
1030 for (unsigned int i
= 1; i
< loccount
; ++i
)
1032 Symbol_value
<size
>& lv(this->local_values_
[i
]);
1033 if (lv
.needs_output_dynsym_entry())
1035 lv
.set_output_dynsym_index(index
);
1042 // Set the offset where local dynamic symbol information will be stored.
1043 // Returns the count of local symbols contributed to the symbol table by
1046 template<int size
, bool big_endian
>
1048 Sized_relobj
<size
, big_endian
>::do_set_local_dynsym_offset(off_t off
)
1050 gold_assert(off
== static_cast<off_t
>(align_address(off
, size
>> 3)));
1051 this->local_dynsym_offset_
= off
;
1052 return this->output_local_dynsym_count_
;
1055 // Write out the local symbols.
1057 template<int size
, bool big_endian
>
1059 Sized_relobj
<size
, big_endian
>::write_local_symbols(
1061 const Stringpool
* sympool
,
1062 const Stringpool
* dynpool
)
1064 if (parameters
->options().strip_all()
1065 && this->output_local_dynsym_count_
== 0)
1068 gold_assert(this->symtab_shndx_
!= -1U);
1069 if (this->symtab_shndx_
== 0)
1071 // This object has no symbols. Weird but legal.
1075 // Read the symbol table section header.
1076 const unsigned int symtab_shndx
= this->symtab_shndx_
;
1077 typename
This::Shdr
symtabshdr(this,
1078 this->elf_file_
.section_header(symtab_shndx
));
1079 gold_assert(symtabshdr
.get_sh_type() == elfcpp::SHT_SYMTAB
);
1080 const unsigned int loccount
= this->local_symbol_count_
;
1081 gold_assert(loccount
== symtabshdr
.get_sh_info());
1083 // Read the local symbols.
1084 const int sym_size
= This::sym_size
;
1085 off_t locsize
= loccount
* sym_size
;
1086 const unsigned char* psyms
= this->get_view(symtabshdr
.get_sh_offset(),
1089 // Read the symbol names.
1090 const unsigned int strtab_shndx
= symtabshdr
.get_sh_link();
1091 section_size_type strtab_size
;
1092 const unsigned char* pnamesu
= this->section_contents(strtab_shndx
,
1095 const char* pnames
= reinterpret_cast<const char*>(pnamesu
);
1097 // Get views into the output file for the portions of the symbol table
1098 // and the dynamic symbol table that we will be writing.
1099 off_t output_size
= this->output_local_symbol_count_
* sym_size
;
1100 unsigned char* oview
= NULL
;
1101 if (output_size
> 0)
1102 oview
= of
->get_output_view(this->local_symbol_offset_
, output_size
);
1104 off_t dyn_output_size
= this->output_local_dynsym_count_
* sym_size
;
1105 unsigned char* dyn_oview
= NULL
;
1106 if (dyn_output_size
> 0)
1107 dyn_oview
= of
->get_output_view(this->local_dynsym_offset_
,
1110 const std::vector
<Map_to_output
>& mo(this->map_to_output());
1112 gold_assert(this->local_values_
.size() == loccount
);
1114 unsigned char* ov
= oview
;
1115 unsigned char* dyn_ov
= dyn_oview
;
1117 for (unsigned int i
= 1; i
< loccount
; ++i
, psyms
+= sym_size
)
1119 elfcpp::Sym
<size
, big_endian
> isym(psyms
);
1121 unsigned int st_shndx
= isym
.get_st_shndx();
1122 if (st_shndx
< elfcpp::SHN_LORESERVE
)
1124 gold_assert(st_shndx
< mo
.size());
1125 if (mo
[st_shndx
].output_section
== NULL
)
1127 st_shndx
= mo
[st_shndx
].output_section
->out_shndx();
1130 // Write the symbol to the output symbol table.
1131 if (!parameters
->options().strip_all()
1132 && this->local_values_
[i
].needs_output_symtab_entry())
1134 elfcpp::Sym_write
<size
, big_endian
> osym(ov
);
1136 gold_assert(isym
.get_st_name() < strtab_size
);
1137 const char* name
= pnames
+ isym
.get_st_name();
1138 osym
.put_st_name(sympool
->get_offset(name
));
1139 osym
.put_st_value(this->local_values_
[i
].value(this, 0));
1140 osym
.put_st_size(isym
.get_st_size());
1141 osym
.put_st_info(isym
.get_st_info());
1142 osym
.put_st_other(isym
.get_st_other());
1143 osym
.put_st_shndx(st_shndx
);
1148 // Write the symbol to the output dynamic symbol table.
1149 if (this->local_values_
[i
].needs_output_dynsym_entry())
1151 gold_assert(dyn_ov
< dyn_oview
+ dyn_output_size
);
1152 elfcpp::Sym_write
<size
, big_endian
> osym(dyn_ov
);
1154 gold_assert(isym
.get_st_name() < strtab_size
);
1155 const char* name
= pnames
+ isym
.get_st_name();
1156 osym
.put_st_name(dynpool
->get_offset(name
));
1157 osym
.put_st_value(this->local_values_
[i
].value(this, 0));
1158 osym
.put_st_size(isym
.get_st_size());
1159 osym
.put_st_info(isym
.get_st_info());
1160 osym
.put_st_other(isym
.get_st_other());
1161 osym
.put_st_shndx(st_shndx
);
1168 if (output_size
> 0)
1170 gold_assert(ov
- oview
== output_size
);
1171 of
->write_output_view(this->local_symbol_offset_
, output_size
, oview
);
1174 if (dyn_output_size
> 0)
1176 gold_assert(dyn_ov
- dyn_oview
== dyn_output_size
);
1177 of
->write_output_view(this->local_dynsym_offset_
, dyn_output_size
,
1182 // Set *INFO to symbolic information about the offset OFFSET in the
1183 // section SHNDX. Return true if we found something, false if we
1186 template<int size
, bool big_endian
>
1188 Sized_relobj
<size
, big_endian
>::get_symbol_location_info(
1191 Symbol_location_info
* info
)
1193 if (this->symtab_shndx_
== 0)
1196 section_size_type symbols_size
;
1197 const unsigned char* symbols
= this->section_contents(this->symtab_shndx_
,
1201 unsigned int symbol_names_shndx
= this->section_link(this->symtab_shndx_
);
1202 section_size_type names_size
;
1203 const unsigned char* symbol_names_u
=
1204 this->section_contents(symbol_names_shndx
, &names_size
, false);
1205 const char* symbol_names
= reinterpret_cast<const char*>(symbol_names_u
);
1207 const int sym_size
= This::sym_size
;
1208 const size_t count
= symbols_size
/ sym_size
;
1210 const unsigned char* p
= symbols
;
1211 for (size_t i
= 0; i
< count
; ++i
, p
+= sym_size
)
1213 elfcpp::Sym
<size
, big_endian
> sym(p
);
1215 if (sym
.get_st_type() == elfcpp::STT_FILE
)
1217 if (sym
.get_st_name() >= names_size
)
1218 info
->source_file
= "(invalid)";
1220 info
->source_file
= symbol_names
+ sym
.get_st_name();
1222 else if (sym
.get_st_shndx() == shndx
1223 && static_cast<off_t
>(sym
.get_st_value()) <= offset
1224 && (static_cast<off_t
>(sym
.get_st_value() + sym
.get_st_size())
1227 if (sym
.get_st_name() > names_size
)
1228 info
->enclosing_symbol_name
= "(invalid)";
1231 info
->enclosing_symbol_name
= symbol_names
+ sym
.get_st_name();
1232 if (parameters
->options().do_demangle())
1234 char* demangled_name
= cplus_demangle(
1235 info
->enclosing_symbol_name
.c_str(),
1236 DMGL_ANSI
| DMGL_PARAMS
);
1237 if (demangled_name
!= NULL
)
1239 info
->enclosing_symbol_name
.assign(demangled_name
);
1240 free(demangled_name
);
1251 // Input_objects methods.
1253 // Add a regular relocatable object to the list. Return false if this
1254 // object should be ignored.
1257 Input_objects::add_object(Object
* obj
)
1259 // Set the global target from the first object file we recognize.
1260 Target
* target
= obj
->target();
1261 if (!parameters
->target_valid())
1262 set_parameters_target(target
);
1263 else if (target
!= ¶meters
->target())
1265 obj
->error(_("incompatible target"));
1269 if (!obj
->is_dynamic())
1270 this->relobj_list_
.push_back(static_cast<Relobj
*>(obj
));
1273 // See if this is a duplicate SONAME.
1274 Dynobj
* dynobj
= static_cast<Dynobj
*>(obj
);
1275 const char* soname
= dynobj
->soname();
1277 std::pair
<Unordered_set
<std::string
>::iterator
, bool> ins
=
1278 this->sonames_
.insert(soname
);
1281 // We have already seen a dynamic object with this soname.
1285 this->dynobj_list_
.push_back(dynobj
);
1287 // If this is -lc, remember the directory in which we found it.
1288 // We use this when issuing warnings about undefined symbols: as
1289 // a heuristic, we don't warn about system libraries found in
1290 // the same directory as -lc.
1291 if (strncmp(soname
, "libc.so", 7) == 0)
1293 const char* object_name
= dynobj
->name().c_str();
1294 const char* base
= lbasename(object_name
);
1295 if (base
!= object_name
)
1296 this->system_library_directory_
.assign(object_name
,
1297 base
- 1 - object_name
);
1304 // Return whether an object was found in the system library directory.
1307 Input_objects::found_in_system_library_directory(const Object
* object
) const
1309 return (!this->system_library_directory_
.empty()
1310 && object
->name().compare(0,
1311 this->system_library_directory_
.size(),
1312 this->system_library_directory_
) == 0);
1315 // For each dynamic object, record whether we've seen all of its
1316 // explicit dependencies.
1319 Input_objects::check_dynamic_dependencies() const
1321 for (Dynobj_list::const_iterator p
= this->dynobj_list_
.begin();
1322 p
!= this->dynobj_list_
.end();
1325 const Dynobj::Needed
& needed((*p
)->needed());
1326 bool found_all
= true;
1327 for (Dynobj::Needed::const_iterator pneeded
= needed
.begin();
1328 pneeded
!= needed
.end();
1331 if (this->sonames_
.find(*pneeded
) == this->sonames_
.end())
1337 (*p
)->set_has_unknown_needed_entries(!found_all
);
1341 // Relocate_info methods.
1343 // Return a string describing the location of a relocation. This is
1344 // only used in error messages.
1346 template<int size
, bool big_endian
>
1348 Relocate_info
<size
, big_endian
>::location(size_t, off_t offset
) const
1350 // See if we can get line-number information from debugging sections.
1351 std::string filename
;
1352 std::string file_and_lineno
; // Better than filename-only, if available.
1354 Sized_dwarf_line_info
<size
, big_endian
> line_info(this->object
);
1355 // This will be "" if we failed to parse the debug info for any reason.
1356 file_and_lineno
= line_info
.addr2line(this->data_shndx
, offset
);
1358 std::string
ret(this->object
->name());
1360 Symbol_location_info info
;
1361 if (this->object
->get_symbol_location_info(this->data_shndx
, offset
, &info
))
1363 ret
+= " in function ";
1364 ret
+= info
.enclosing_symbol_name
;
1366 filename
= info
.source_file
;
1369 if (!file_and_lineno
.empty())
1370 ret
+= file_and_lineno
;
1373 if (!filename
.empty())
1376 ret
+= this->object
->section_name(this->data_shndx
);
1378 // Offsets into sections have to be positive.
1379 snprintf(buf
, sizeof(buf
), "+0x%lx", static_cast<long>(offset
));
1386 } // End namespace gold.
1391 using namespace gold
;
1393 // Read an ELF file with the header and return the appropriate
1394 // instance of Object.
1396 template<int size
, bool big_endian
>
1398 make_elf_sized_object(const std::string
& name
, Input_file
* input_file
,
1399 off_t offset
, const elfcpp::Ehdr
<size
, big_endian
>& ehdr
)
1401 int et
= ehdr
.get_e_type();
1402 if (et
== elfcpp::ET_REL
)
1404 Sized_relobj
<size
, big_endian
>* obj
=
1405 new Sized_relobj
<size
, big_endian
>(name
, input_file
, offset
, ehdr
);
1409 else if (et
== elfcpp::ET_DYN
)
1411 Sized_dynobj
<size
, big_endian
>* obj
=
1412 new Sized_dynobj
<size
, big_endian
>(name
, input_file
, offset
, ehdr
);
1418 gold_error(_("%s: unsupported ELF file type %d"),
1424 } // End anonymous namespace.
1429 // Read an ELF file and return the appropriate instance of Object.
1432 make_elf_object(const std::string
& name
, Input_file
* input_file
, off_t offset
,
1433 const unsigned char* p
, section_offset_type bytes
)
1435 if (bytes
< elfcpp::EI_NIDENT
)
1437 gold_error(_("%s: ELF file too short"), name
.c_str());
1441 int v
= p
[elfcpp::EI_VERSION
];
1442 if (v
!= elfcpp::EV_CURRENT
)
1444 if (v
== elfcpp::EV_NONE
)
1445 gold_error(_("%s: invalid ELF version 0"), name
.c_str());
1447 gold_error(_("%s: unsupported ELF version %d"), name
.c_str(), v
);
1451 int c
= p
[elfcpp::EI_CLASS
];
1452 if (c
== elfcpp::ELFCLASSNONE
)
1454 gold_error(_("%s: invalid ELF class 0"), name
.c_str());
1457 else if (c
!= elfcpp::ELFCLASS32
1458 && c
!= elfcpp::ELFCLASS64
)
1460 gold_error(_("%s: unsupported ELF class %d"), name
.c_str(), c
);
1464 int d
= p
[elfcpp::EI_DATA
];
1465 if (d
== elfcpp::ELFDATANONE
)
1467 gold_error(_("%s: invalid ELF data encoding"), name
.c_str());
1470 else if (d
!= elfcpp::ELFDATA2LSB
1471 && d
!= elfcpp::ELFDATA2MSB
)
1473 gold_error(_("%s: unsupported ELF data encoding %d"), name
.c_str(), d
);
1477 bool big_endian
= d
== elfcpp::ELFDATA2MSB
;
1479 if (c
== elfcpp::ELFCLASS32
)
1481 if (bytes
< elfcpp::Elf_sizes
<32>::ehdr_size
)
1483 gold_error(_("%s: ELF file too short"), name
.c_str());
1488 #ifdef HAVE_TARGET_32_BIG
1489 elfcpp::Ehdr
<32, true> ehdr(p
);
1490 return make_elf_sized_object
<32, true>(name
, input_file
,
1493 gold_error(_("%s: not configured to support "
1494 "32-bit big-endian object"),
1501 #ifdef HAVE_TARGET_32_LITTLE
1502 elfcpp::Ehdr
<32, false> ehdr(p
);
1503 return make_elf_sized_object
<32, false>(name
, input_file
,
1506 gold_error(_("%s: not configured to support "
1507 "32-bit little-endian object"),
1515 if (bytes
< elfcpp::Elf_sizes
<32>::ehdr_size
)
1517 gold_error(_("%s: ELF file too short"), name
.c_str());
1522 #ifdef HAVE_TARGET_64_BIG
1523 elfcpp::Ehdr
<64, true> ehdr(p
);
1524 return make_elf_sized_object
<64, true>(name
, input_file
,
1527 gold_error(_("%s: not configured to support "
1528 "64-bit big-endian object"),
1535 #ifdef HAVE_TARGET_64_LITTLE
1536 elfcpp::Ehdr
<64, false> ehdr(p
);
1537 return make_elf_sized_object
<64, false>(name
, input_file
,
1540 gold_error(_("%s: not configured to support "
1541 "64-bit little-endian object"),
1549 // Instantiate the templates we need. We could use the configure
1550 // script to restrict this to only the ones for implemented targets.
1552 #ifdef HAVE_TARGET_32_LITTLE
1554 class Sized_relobj
<32, false>;
1557 #ifdef HAVE_TARGET_32_BIG
1559 class Sized_relobj
<32, true>;
1562 #ifdef HAVE_TARGET_64_LITTLE
1564 class Sized_relobj
<64, false>;
1567 #ifdef HAVE_TARGET_64_BIG
1569 class Sized_relobj
<64, true>;
1572 #ifdef HAVE_TARGET_32_LITTLE
1574 struct Relocate_info
<32, false>;
1577 #ifdef HAVE_TARGET_32_BIG
1579 struct Relocate_info
<32, true>;
1582 #ifdef HAVE_TARGET_64_LITTLE
1584 struct Relocate_info
<64, false>;
1587 #ifdef HAVE_TARGET_64_BIG
1589 struct Relocate_info
<64, true>;
1592 } // End namespace gold.