* object.cc (Sized_relobj::write_local_symbols): Don't write out
[deliverable/binutils-gdb.git] / gold / object.cc
1 // object.cc -- support for an object file for linking in gold
2
3 // Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
4 // Written by Ian Lance Taylor <iant@google.com>.
5
6 // This file is part of gold.
7
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.
12
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.
17
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.
22
23 #include "gold.h"
24
25 #include <cerrno>
26 #include <cstring>
27 #include <cstdarg>
28 #include "demangle.h"
29 #include "libiberty.h"
30
31 #include "target-select.h"
32 #include "dwarf_reader.h"
33 #include "layout.h"
34 #include "output.h"
35 #include "symtab.h"
36 #include "cref.h"
37 #include "reloc.h"
38 #include "object.h"
39 #include "dynobj.h"
40 #include "plugin.h"
41
42 namespace gold
43 {
44
45 // Class Xindex.
46
47 // Initialize the symtab_xindex_ array. Find the SHT_SYMTAB_SHNDX
48 // section and read it in. SYMTAB_SHNDX is the index of the symbol
49 // table we care about.
50
51 template<int size, bool big_endian>
52 void
53 Xindex::initialize_symtab_xindex(Object* object, unsigned int symtab_shndx)
54 {
55 if (!this->symtab_xindex_.empty())
56 return;
57
58 gold_assert(symtab_shndx != 0);
59
60 // Look through the sections in reverse order, on the theory that it
61 // is more likely to be near the end than the beginning.
62 unsigned int i = object->shnum();
63 while (i > 0)
64 {
65 --i;
66 if (object->section_type(i) == elfcpp::SHT_SYMTAB_SHNDX
67 && this->adjust_shndx(object->section_link(i)) == symtab_shndx)
68 {
69 this->read_symtab_xindex<size, big_endian>(object, i, NULL);
70 return;
71 }
72 }
73
74 object->error(_("missing SHT_SYMTAB_SHNDX section"));
75 }
76
77 // Read in the symtab_xindex_ array, given the section index of the
78 // SHT_SYMTAB_SHNDX section. If PSHDRS is not NULL, it points at the
79 // section headers.
80
81 template<int size, bool big_endian>
82 void
83 Xindex::read_symtab_xindex(Object* object, unsigned int xindex_shndx,
84 const unsigned char* pshdrs)
85 {
86 section_size_type bytecount;
87 const unsigned char* contents;
88 if (pshdrs == NULL)
89 contents = object->section_contents(xindex_shndx, &bytecount, false);
90 else
91 {
92 const unsigned char* p = (pshdrs
93 + (xindex_shndx
94 * elfcpp::Elf_sizes<size>::shdr_size));
95 typename elfcpp::Shdr<size, big_endian> shdr(p);
96 bytecount = convert_to_section_size_type(shdr.get_sh_size());
97 contents = object->get_view(shdr.get_sh_offset(), bytecount, true, false);
98 }
99
100 gold_assert(this->symtab_xindex_.empty());
101 this->symtab_xindex_.reserve(bytecount / 4);
102 for (section_size_type i = 0; i < bytecount; i += 4)
103 {
104 unsigned int shndx = elfcpp::Swap<32, big_endian>::readval(contents + i);
105 // We preadjust the section indexes we save.
106 this->symtab_xindex_.push_back(this->adjust_shndx(shndx));
107 }
108 }
109
110 // Symbol symndx has a section of SHN_XINDEX; return the real section
111 // index.
112
113 unsigned int
114 Xindex::sym_xindex_to_shndx(Object* object, unsigned int symndx)
115 {
116 if (symndx >= this->symtab_xindex_.size())
117 {
118 object->error(_("symbol %u out of range for SHT_SYMTAB_SHNDX section"),
119 symndx);
120 return elfcpp::SHN_UNDEF;
121 }
122 unsigned int shndx = this->symtab_xindex_[symndx];
123 if (shndx < elfcpp::SHN_LORESERVE || shndx >= object->shnum())
124 {
125 object->error(_("extended index for symbol %u out of range: %u"),
126 symndx, shndx);
127 return elfcpp::SHN_UNDEF;
128 }
129 return shndx;
130 }
131
132 // Class Object.
133
134 // Set the target based on fields in the ELF file header.
135
136 void
137 Object::set_target(int machine, int size, bool big_endian, int osabi,
138 int abiversion)
139 {
140 Target* target = select_target(machine, size, big_endian, osabi, abiversion);
141 if (target == NULL)
142 gold_fatal(_("%s: unsupported ELF machine number %d"),
143 this->name().c_str(), machine);
144 this->target_ = target;
145 }
146
147 // Report an error for this object file. This is used by the
148 // elfcpp::Elf_file interface, and also called by the Object code
149 // itself.
150
151 void
152 Object::error(const char* format, ...) const
153 {
154 va_list args;
155 va_start(args, format);
156 char* buf = NULL;
157 if (vasprintf(&buf, format, args) < 0)
158 gold_nomem();
159 va_end(args);
160 gold_error(_("%s: %s"), this->name().c_str(), buf);
161 free(buf);
162 }
163
164 // Return a view of the contents of a section.
165
166 const unsigned char*
167 Object::section_contents(unsigned int shndx, section_size_type* plen,
168 bool cache)
169 {
170 Location loc(this->do_section_contents(shndx));
171 *plen = convert_to_section_size_type(loc.data_size);
172 return this->get_view(loc.file_offset, *plen, true, cache);
173 }
174
175 // Read the section data into SD. This is code common to Sized_relobj
176 // and Sized_dynobj, so we put it into Object.
177
178 template<int size, bool big_endian>
179 void
180 Object::read_section_data(elfcpp::Elf_file<size, big_endian, Object>* elf_file,
181 Read_symbols_data* sd)
182 {
183 const int shdr_size = elfcpp::Elf_sizes<size>::shdr_size;
184
185 // Read the section headers.
186 const off_t shoff = elf_file->shoff();
187 const unsigned int shnum = this->shnum();
188 sd->section_headers = this->get_lasting_view(shoff, shnum * shdr_size,
189 true, true);
190
191 // Read the section names.
192 const unsigned char* pshdrs = sd->section_headers->data();
193 const unsigned char* pshdrnames = pshdrs + elf_file->shstrndx() * shdr_size;
194 typename elfcpp::Shdr<size, big_endian> shdrnames(pshdrnames);
195
196 if (shdrnames.get_sh_type() != elfcpp::SHT_STRTAB)
197 this->error(_("section name section has wrong type: %u"),
198 static_cast<unsigned int>(shdrnames.get_sh_type()));
199
200 sd->section_names_size =
201 convert_to_section_size_type(shdrnames.get_sh_size());
202 sd->section_names = this->get_lasting_view(shdrnames.get_sh_offset(),
203 sd->section_names_size, false,
204 false);
205 }
206
207 // If NAME is the name of a special .gnu.warning section, arrange for
208 // the warning to be issued. SHNDX is the section index. Return
209 // whether it is a warning section.
210
211 bool
212 Object::handle_gnu_warning_section(const char* name, unsigned int shndx,
213 Symbol_table* symtab)
214 {
215 const char warn_prefix[] = ".gnu.warning.";
216 const int warn_prefix_len = sizeof warn_prefix - 1;
217 if (strncmp(name, warn_prefix, warn_prefix_len) == 0)
218 {
219 // Read the section contents to get the warning text. It would
220 // be nicer if we only did this if we have to actually issue a
221 // warning. Unfortunately, warnings are issued as we relocate
222 // sections. That means that we can not lock the object then,
223 // as we might try to issue the same warning multiple times
224 // simultaneously.
225 section_size_type len;
226 const unsigned char* contents = this->section_contents(shndx, &len,
227 false);
228 std::string warning(reinterpret_cast<const char*>(contents), len);
229 symtab->add_warning(name + warn_prefix_len, this, warning);
230 return true;
231 }
232 return false;
233 }
234
235 // Class Sized_relobj.
236
237 template<int size, bool big_endian>
238 Sized_relobj<size, big_endian>::Sized_relobj(
239 const std::string& name,
240 Input_file* input_file,
241 off_t offset,
242 const elfcpp::Ehdr<size, big_endian>& ehdr)
243 : Relobj(name, input_file, offset),
244 elf_file_(this, ehdr),
245 symtab_shndx_(-1U),
246 local_symbol_count_(0),
247 output_local_symbol_count_(0),
248 output_local_dynsym_count_(0),
249 symbols_(),
250 defined_count_(0),
251 local_symbol_offset_(0),
252 local_dynsym_offset_(0),
253 local_values_(),
254 local_got_offsets_(),
255 kept_comdat_sections_(),
256 comdat_groups_(),
257 has_eh_frame_(false)
258 {
259 }
260
261 template<int size, bool big_endian>
262 Sized_relobj<size, big_endian>::~Sized_relobj()
263 {
264 }
265
266 // Set up an object file based on the file header. This sets up the
267 // target and reads the section information.
268
269 template<int size, bool big_endian>
270 void
271 Sized_relobj<size, big_endian>::setup(
272 const elfcpp::Ehdr<size, big_endian>& ehdr)
273 {
274 this->set_target(ehdr.get_e_machine(), size, big_endian,
275 ehdr.get_e_ident()[elfcpp::EI_OSABI],
276 ehdr.get_e_ident()[elfcpp::EI_ABIVERSION]);
277
278 const unsigned int shnum = this->elf_file_.shnum();
279 this->set_shnum(shnum);
280 }
281
282 // Find the SHT_SYMTAB section, given the section headers. The ELF
283 // standard says that maybe in the future there can be more than one
284 // SHT_SYMTAB section. Until somebody figures out how that could
285 // work, we assume there is only one.
286
287 template<int size, bool big_endian>
288 void
289 Sized_relobj<size, big_endian>::find_symtab(const unsigned char* pshdrs)
290 {
291 const unsigned int shnum = this->shnum();
292 this->symtab_shndx_ = 0;
293 if (shnum > 0)
294 {
295 // Look through the sections in reverse order, since gas tends
296 // to put the symbol table at the end.
297 const unsigned char* p = pshdrs + shnum * This::shdr_size;
298 unsigned int i = shnum;
299 unsigned int xindex_shndx = 0;
300 unsigned int xindex_link = 0;
301 while (i > 0)
302 {
303 --i;
304 p -= This::shdr_size;
305 typename This::Shdr shdr(p);
306 if (shdr.get_sh_type() == elfcpp::SHT_SYMTAB)
307 {
308 this->symtab_shndx_ = i;
309 if (xindex_shndx > 0 && xindex_link == i)
310 {
311 Xindex* xindex =
312 new Xindex(this->elf_file_.large_shndx_offset());
313 xindex->read_symtab_xindex<size, big_endian>(this,
314 xindex_shndx,
315 pshdrs);
316 this->set_xindex(xindex);
317 }
318 break;
319 }
320
321 // Try to pick up the SHT_SYMTAB_SHNDX section, if there is
322 // one. This will work if it follows the SHT_SYMTAB
323 // section.
324 if (shdr.get_sh_type() == elfcpp::SHT_SYMTAB_SHNDX)
325 {
326 xindex_shndx = i;
327 xindex_link = this->adjust_shndx(shdr.get_sh_link());
328 }
329 }
330 }
331 }
332
333 // Return the Xindex structure to use for object with lots of
334 // sections.
335
336 template<int size, bool big_endian>
337 Xindex*
338 Sized_relobj<size, big_endian>::do_initialize_xindex()
339 {
340 gold_assert(this->symtab_shndx_ != -1U);
341 Xindex* xindex = new Xindex(this->elf_file_.large_shndx_offset());
342 xindex->initialize_symtab_xindex<size, big_endian>(this, this->symtab_shndx_);
343 return xindex;
344 }
345
346 // Return whether SHDR has the right type and flags to be a GNU
347 // .eh_frame section.
348
349 template<int size, bool big_endian>
350 bool
351 Sized_relobj<size, big_endian>::check_eh_frame_flags(
352 const elfcpp::Shdr<size, big_endian>* shdr) const
353 {
354 return (shdr->get_sh_type() == elfcpp::SHT_PROGBITS
355 && (shdr->get_sh_flags() & elfcpp::SHF_ALLOC) != 0);
356 }
357
358 // Return whether there is a GNU .eh_frame section, given the section
359 // headers and the section names.
360
361 template<int size, bool big_endian>
362 bool
363 Sized_relobj<size, big_endian>::find_eh_frame(
364 const unsigned char* pshdrs,
365 const char* names,
366 section_size_type names_size) const
367 {
368 const unsigned int shnum = this->shnum();
369 const unsigned char* p = pshdrs + This::shdr_size;
370 for (unsigned int i = 1; i < shnum; ++i, p += This::shdr_size)
371 {
372 typename This::Shdr shdr(p);
373 if (this->check_eh_frame_flags(&shdr))
374 {
375 if (shdr.get_sh_name() >= names_size)
376 {
377 this->error(_("bad section name offset for section %u: %lu"),
378 i, static_cast<unsigned long>(shdr.get_sh_name()));
379 continue;
380 }
381
382 const char* name = names + shdr.get_sh_name();
383 if (strcmp(name, ".eh_frame") == 0)
384 return true;
385 }
386 }
387 return false;
388 }
389
390 // Read the sections and symbols from an object file.
391
392 template<int size, bool big_endian>
393 void
394 Sized_relobj<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
395 {
396 this->read_section_data(&this->elf_file_, sd);
397
398 const unsigned char* const pshdrs = sd->section_headers->data();
399
400 this->find_symtab(pshdrs);
401
402 const unsigned char* namesu = sd->section_names->data();
403 const char* names = reinterpret_cast<const char*>(namesu);
404 if (memmem(names, sd->section_names_size, ".eh_frame", 10) != NULL)
405 {
406 if (this->find_eh_frame(pshdrs, names, sd->section_names_size))
407 this->has_eh_frame_ = true;
408 }
409
410 sd->symbols = NULL;
411 sd->symbols_size = 0;
412 sd->external_symbols_offset = 0;
413 sd->symbol_names = NULL;
414 sd->symbol_names_size = 0;
415
416 if (this->symtab_shndx_ == 0)
417 {
418 // No symbol table. Weird but legal.
419 return;
420 }
421
422 // Get the symbol table section header.
423 typename This::Shdr symtabshdr(pshdrs
424 + this->symtab_shndx_ * This::shdr_size);
425 gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB);
426
427 // If this object has a .eh_frame section, we need all the symbols.
428 // Otherwise we only need the external symbols. While it would be
429 // simpler to just always read all the symbols, I've seen object
430 // files with well over 2000 local symbols, which for a 64-bit
431 // object file format is over 5 pages that we don't need to read
432 // now.
433
434 const int sym_size = This::sym_size;
435 const unsigned int loccount = symtabshdr.get_sh_info();
436 this->local_symbol_count_ = loccount;
437 this->local_values_.resize(loccount);
438 section_offset_type locsize = loccount * sym_size;
439 off_t dataoff = symtabshdr.get_sh_offset();
440 section_size_type datasize =
441 convert_to_section_size_type(symtabshdr.get_sh_size());
442 off_t extoff = dataoff + locsize;
443 section_size_type extsize = datasize - locsize;
444
445 off_t readoff = this->has_eh_frame_ ? dataoff : extoff;
446 section_size_type readsize = this->has_eh_frame_ ? datasize : extsize;
447
448 if (readsize == 0)
449 {
450 // No external symbols. Also weird but also legal.
451 return;
452 }
453
454 File_view* fvsymtab = this->get_lasting_view(readoff, readsize, true, false);
455
456 // Read the section header for the symbol names.
457 unsigned int strtab_shndx = this->adjust_shndx(symtabshdr.get_sh_link());
458 if (strtab_shndx >= this->shnum())
459 {
460 this->error(_("invalid symbol table name index: %u"), strtab_shndx);
461 return;
462 }
463 typename This::Shdr strtabshdr(pshdrs + strtab_shndx * This::shdr_size);
464 if (strtabshdr.get_sh_type() != elfcpp::SHT_STRTAB)
465 {
466 this->error(_("symbol table name section has wrong type: %u"),
467 static_cast<unsigned int>(strtabshdr.get_sh_type()));
468 return;
469 }
470
471 // Read the symbol names.
472 File_view* fvstrtab = this->get_lasting_view(strtabshdr.get_sh_offset(),
473 strtabshdr.get_sh_size(),
474 false, true);
475
476 sd->symbols = fvsymtab;
477 sd->symbols_size = readsize;
478 sd->external_symbols_offset = this->has_eh_frame_ ? locsize : 0;
479 sd->symbol_names = fvstrtab;
480 sd->symbol_names_size =
481 convert_to_section_size_type(strtabshdr.get_sh_size());
482 }
483
484 // Return the section index of symbol SYM. Set *VALUE to its value in
485 // the object file. Set *IS_ORDINARY if this is an ordinary section
486 // index. not a special cod between SHN_LORESERVE and SHN_HIRESERVE.
487 // Note that for a symbol which is not defined in this object file,
488 // this will set *VALUE to 0 and return SHN_UNDEF; it will not return
489 // the final value of the symbol in the link.
490
491 template<int size, bool big_endian>
492 unsigned int
493 Sized_relobj<size, big_endian>::symbol_section_and_value(unsigned int sym,
494 Address* value,
495 bool* is_ordinary)
496 {
497 section_size_type symbols_size;
498 const unsigned char* symbols = this->section_contents(this->symtab_shndx_,
499 &symbols_size,
500 false);
501
502 const size_t count = symbols_size / This::sym_size;
503 gold_assert(sym < count);
504
505 elfcpp::Sym<size, big_endian> elfsym(symbols + sym * This::sym_size);
506 *value = elfsym.get_st_value();
507
508 return this->adjust_sym_shndx(sym, elfsym.get_st_shndx(), is_ordinary);
509 }
510
511 // Return whether to include a section group in the link. LAYOUT is
512 // used to keep track of which section groups we have already seen.
513 // INDEX is the index of the section group and SHDR is the section
514 // header. If we do not want to include this group, we set bits in
515 // OMIT for each section which should be discarded.
516
517 template<int size, bool big_endian>
518 bool
519 Sized_relobj<size, big_endian>::include_section_group(
520 Symbol_table* symtab,
521 Layout* layout,
522 unsigned int index,
523 const char* name,
524 const unsigned char* shdrs,
525 const char* section_names,
526 section_size_type section_names_size,
527 std::vector<bool>* omit)
528 {
529 // Read the section contents.
530 typename This::Shdr shdr(shdrs + index * This::shdr_size);
531 const unsigned char* pcon = this->get_view(shdr.get_sh_offset(),
532 shdr.get_sh_size(), true, false);
533 const elfcpp::Elf_Word* pword =
534 reinterpret_cast<const elfcpp::Elf_Word*>(pcon);
535
536 // The first word contains flags. We only care about COMDAT section
537 // groups. Other section groups are always included in the link
538 // just like ordinary sections.
539 elfcpp::Elf_Word flags = elfcpp::Swap<32, big_endian>::readval(pword);
540
541 // Look up the group signature, which is the name of a symbol. This
542 // is a lot of effort to go to to read a string. Why didn't they
543 // just have the group signature point into the string table, rather
544 // than indirect through a symbol?
545
546 // Get the appropriate symbol table header (this will normally be
547 // the single SHT_SYMTAB section, but in principle it need not be).
548 const unsigned int link = this->adjust_shndx(shdr.get_sh_link());
549 typename This::Shdr symshdr(this, this->elf_file_.section_header(link));
550
551 // Read the symbol table entry.
552 unsigned int symndx = shdr.get_sh_info();
553 if (symndx >= symshdr.get_sh_size() / This::sym_size)
554 {
555 this->error(_("section group %u info %u out of range"),
556 index, symndx);
557 return false;
558 }
559 off_t symoff = symshdr.get_sh_offset() + symndx * This::sym_size;
560 const unsigned char* psym = this->get_view(symoff, This::sym_size, true,
561 false);
562 elfcpp::Sym<size, big_endian> sym(psym);
563
564 // Read the symbol table names.
565 section_size_type symnamelen;
566 const unsigned char* psymnamesu;
567 psymnamesu = this->section_contents(this->adjust_shndx(symshdr.get_sh_link()),
568 &symnamelen, true);
569 const char* psymnames = reinterpret_cast<const char*>(psymnamesu);
570
571 // Get the section group signature.
572 if (sym.get_st_name() >= symnamelen)
573 {
574 this->error(_("symbol %u name offset %u out of range"),
575 symndx, sym.get_st_name());
576 return false;
577 }
578
579 std::string signature(psymnames + sym.get_st_name());
580
581 // It seems that some versions of gas will create a section group
582 // associated with a section symbol, and then fail to give a name to
583 // the section symbol. In such a case, use the name of the section.
584 if (signature[0] == '\0' && sym.get_st_type() == elfcpp::STT_SECTION)
585 {
586 bool is_ordinary;
587 unsigned int sym_shndx = this->adjust_sym_shndx(symndx,
588 sym.get_st_shndx(),
589 &is_ordinary);
590 if (!is_ordinary || sym_shndx >= this->shnum())
591 {
592 this->error(_("symbol %u invalid section index %u"),
593 symndx, sym_shndx);
594 return false;
595 }
596 typename This::Shdr member_shdr(shdrs + sym_shndx * This::shdr_size);
597 if (member_shdr.get_sh_name() < section_names_size)
598 signature = section_names + member_shdr.get_sh_name();
599 }
600
601 // Record this section group in the layout, and see whether we've already
602 // seen one with the same signature.
603 bool include_group = ((flags & elfcpp::GRP_COMDAT) == 0
604 || layout->add_comdat(this, index, signature, true));
605
606 Sized_relobj<size, big_endian>* kept_object = NULL;
607 Comdat_group* kept_group = NULL;
608
609 if (!include_group)
610 {
611 // This group is being discarded. Find the object and group
612 // that was kept in its place.
613 unsigned int kept_group_index = 0;
614 Relobj* kept_relobj = layout->find_kept_object(signature,
615 &kept_group_index);
616 kept_object = static_cast<Sized_relobj<size, big_endian>*>(kept_relobj);
617 if (kept_object != NULL)
618 kept_group = kept_object->find_comdat_group(kept_group_index);
619 }
620 else if (flags & elfcpp::GRP_COMDAT)
621 {
622 // This group is being kept. Create the table to map section names
623 // to section indexes and add it to the table of groups.
624 kept_group = new Comdat_group();
625 this->add_comdat_group(index, kept_group);
626 }
627
628 size_t count = shdr.get_sh_size() / sizeof(elfcpp::Elf_Word);
629
630 std::vector<unsigned int> shndxes;
631 bool relocate_group = include_group && parameters->options().relocatable();
632 if (relocate_group)
633 shndxes.reserve(count - 1);
634
635 for (size_t i = 1; i < count; ++i)
636 {
637 elfcpp::Elf_Word secnum =
638 this->adjust_shndx(elfcpp::Swap<32, big_endian>::readval(pword + i));
639
640 if (relocate_group)
641 shndxes.push_back(secnum);
642
643 if (secnum >= this->shnum())
644 {
645 this->error(_("section %u in section group %u out of range"),
646 secnum, index);
647 continue;
648 }
649
650 // Check for an earlier section number, since we're going to get
651 // it wrong--we may have already decided to include the section.
652 if (secnum < index)
653 this->error(_("invalid section group %u refers to earlier section %u"),
654 index, secnum);
655
656 // Get the name of the member section.
657 typename This::Shdr member_shdr(shdrs + secnum * This::shdr_size);
658 if (member_shdr.get_sh_name() >= section_names_size)
659 {
660 // This is an error, but it will be diagnosed eventually
661 // in do_layout, so we don't need to do anything here but
662 // ignore it.
663 continue;
664 }
665 std::string mname(section_names + member_shdr.get_sh_name());
666
667 if (!include_group)
668 {
669 (*omit)[secnum] = true;
670 if (kept_group != NULL)
671 {
672 // Find the corresponding kept section, and store that info
673 // in the discarded section table.
674 Comdat_group::const_iterator p = kept_group->find(mname);
675 if (p != kept_group->end())
676 {
677 Kept_comdat_section* kept =
678 new Kept_comdat_section(kept_object, p->second);
679 this->set_kept_comdat_section(secnum, kept);
680 }
681 }
682 }
683 else if (flags & elfcpp::GRP_COMDAT)
684 {
685 // Add the section to the kept group table.
686 gold_assert(kept_group != NULL);
687 kept_group->insert(std::make_pair(mname, secnum));
688 }
689 }
690
691 if (relocate_group)
692 layout->layout_group(symtab, this, index, name, signature.c_str(),
693 shdr, flags, &shndxes);
694
695 return include_group;
696 }
697
698 // Whether to include a linkonce section in the link. NAME is the
699 // name of the section and SHDR is the section header.
700
701 // Linkonce sections are a GNU extension implemented in the original
702 // GNU linker before section groups were defined. The semantics are
703 // that we only include one linkonce section with a given name. The
704 // name of a linkonce section is normally .gnu.linkonce.T.SYMNAME,
705 // where T is the type of section and SYMNAME is the name of a symbol.
706 // In an attempt to make linkonce sections interact well with section
707 // groups, we try to identify SYMNAME and use it like a section group
708 // signature. We want to block section groups with that signature,
709 // but not other linkonce sections with that signature. We also use
710 // the full name of the linkonce section as a normal section group
711 // signature.
712
713 template<int size, bool big_endian>
714 bool
715 Sized_relobj<size, big_endian>::include_linkonce_section(
716 Layout* layout,
717 unsigned int index,
718 const char* name,
719 const elfcpp::Shdr<size, big_endian>&)
720 {
721 // In general the symbol name we want will be the string following
722 // the last '.'. However, we have to handle the case of
723 // .gnu.linkonce.t.__i686.get_pc_thunk.bx, which was generated by
724 // some versions of gcc. So we use a heuristic: if the name starts
725 // with ".gnu.linkonce.t.", we use everything after that. Otherwise
726 // we look for the last '.'. We can't always simply skip
727 // ".gnu.linkonce.X", because we have to deal with cases like
728 // ".gnu.linkonce.d.rel.ro.local".
729 const char* const linkonce_t = ".gnu.linkonce.t.";
730 const char* symname;
731 if (strncmp(name, linkonce_t, strlen(linkonce_t)) == 0)
732 symname = name + strlen(linkonce_t);
733 else
734 symname = strrchr(name, '.') + 1;
735 std::string sig1(symname);
736 std::string sig2(name);
737 bool include1 = layout->add_comdat(this, index, sig1, false);
738 bool include2 = layout->add_comdat(this, index, sig2, true);
739
740 if (!include2)
741 {
742 // The section is being discarded on the basis of its section
743 // name (i.e., the kept section was also a linkonce section).
744 // In this case, the section index stored with the layout object
745 // is the linkonce section that was kept.
746 unsigned int kept_group_index = 0;
747 Relobj* kept_relobj = layout->find_kept_object(sig2, &kept_group_index);
748 if (kept_relobj != NULL)
749 {
750 Sized_relobj<size, big_endian>* kept_object
751 = static_cast<Sized_relobj<size, big_endian>*>(kept_relobj);
752 Kept_comdat_section* kept =
753 new Kept_comdat_section(kept_object, kept_group_index);
754 this->set_kept_comdat_section(index, kept);
755 }
756 }
757 else if (!include1)
758 {
759 // The section is being discarded on the basis of its symbol
760 // name. This means that the corresponding kept section was
761 // part of a comdat group, and it will be difficult to identify
762 // the specific section within that group that corresponds to
763 // this linkonce section. We'll handle the simple case where
764 // the group has only one member section. Otherwise, it's not
765 // worth the effort.
766 unsigned int kept_group_index = 0;
767 Relobj* kept_relobj = layout->find_kept_object(sig1, &kept_group_index);
768 if (kept_relobj != NULL)
769 {
770 Sized_relobj<size, big_endian>* kept_object =
771 static_cast<Sized_relobj<size, big_endian>*>(kept_relobj);
772 Comdat_group* kept_group =
773 kept_object->find_comdat_group(kept_group_index);
774 if (kept_group != NULL && kept_group->size() == 1)
775 {
776 Comdat_group::const_iterator p = kept_group->begin();
777 gold_assert(p != kept_group->end());
778 Kept_comdat_section* kept =
779 new Kept_comdat_section(kept_object, p->second);
780 this->set_kept_comdat_section(index, kept);
781 }
782 }
783 }
784
785 return include1 && include2;
786 }
787
788 // Layout an input section.
789
790 template<int size, bool big_endian>
791 inline void
792 Sized_relobj<size, big_endian>::layout_section(Layout* layout,
793 unsigned int shndx,
794 const char* name,
795 typename This::Shdr& shdr,
796 unsigned int reloc_shndx,
797 unsigned int reloc_type)
798 {
799 off_t offset;
800 Output_section* os = layout->layout(this, shndx, name, shdr,
801 reloc_shndx, reloc_type, &offset);
802
803 this->output_sections()[shndx] = os;
804 if (offset == -1)
805 this->section_offsets_[shndx] = invalid_address;
806 else
807 this->section_offsets_[shndx] = convert_types<Address, off_t>(offset);
808
809 // If this section requires special handling, and if there are
810 // relocs that apply to it, then we must do the special handling
811 // before we apply the relocs.
812 if (offset == -1 && reloc_shndx != 0)
813 this->set_relocs_must_follow_section_writes();
814 }
815
816 // Lay out the input sections. We walk through the sections and check
817 // whether they should be included in the link. If they should, we
818 // pass them to the Layout object, which will return an output section
819 // and an offset.
820
821 template<int size, bool big_endian>
822 void
823 Sized_relobj<size, big_endian>::do_layout(Symbol_table* symtab,
824 Layout* layout,
825 Read_symbols_data* sd)
826 {
827 const unsigned int shnum = this->shnum();
828 if (shnum == 0)
829 return;
830
831 // Get the section headers.
832 const unsigned char* shdrs = sd->section_headers->data();
833 const unsigned char* pshdrs;
834
835 // Get the section names.
836 const unsigned char* pnamesu = sd->section_names->data();
837 const char* pnames = reinterpret_cast<const char*>(pnamesu);
838
839 // If any input files have been claimed by plugins, we need to defer
840 // actual layout until the replacement files have arrived.
841 const bool should_defer_layout =
842 (parameters->options().has_plugins()
843 && parameters->options().plugins()->should_defer_layout());
844 unsigned int num_sections_to_defer = 0;
845
846 // For each section, record the index of the reloc section if any.
847 // Use 0 to mean that there is no reloc section, -1U to mean that
848 // there is more than one.
849 std::vector<unsigned int> reloc_shndx(shnum, 0);
850 std::vector<unsigned int> reloc_type(shnum, elfcpp::SHT_NULL);
851 // Skip the first, dummy, section.
852 pshdrs = shdrs + This::shdr_size;
853 for (unsigned int i = 1; i < shnum; ++i, pshdrs += This::shdr_size)
854 {
855 typename This::Shdr shdr(pshdrs);
856
857 // Count the number of sections whose layout will be deferred.
858 if (should_defer_layout && (shdr.get_sh_flags() & elfcpp::SHF_ALLOC))
859 ++num_sections_to_defer;
860
861 unsigned int sh_type = shdr.get_sh_type();
862 if (sh_type == elfcpp::SHT_REL || sh_type == elfcpp::SHT_RELA)
863 {
864 unsigned int target_shndx = this->adjust_shndx(shdr.get_sh_info());
865 if (target_shndx == 0 || target_shndx >= shnum)
866 {
867 this->error(_("relocation section %u has bad info %u"),
868 i, target_shndx);
869 continue;
870 }
871
872 if (reloc_shndx[target_shndx] != 0)
873 reloc_shndx[target_shndx] = -1U;
874 else
875 {
876 reloc_shndx[target_shndx] = i;
877 reloc_type[target_shndx] = sh_type;
878 }
879 }
880 }
881
882 Output_sections& out_sections(this->output_sections());
883 std::vector<Address>& out_section_offsets(this->section_offsets_);
884
885 out_sections.resize(shnum);
886 out_section_offsets.resize(shnum);
887
888 // If we are only linking for symbols, then there is nothing else to
889 // do here.
890 if (this->input_file()->just_symbols())
891 {
892 delete sd->section_headers;
893 sd->section_headers = NULL;
894 delete sd->section_names;
895 sd->section_names = NULL;
896 return;
897 }
898
899 if (num_sections_to_defer > 0)
900 {
901 parameters->options().plugins()->add_deferred_layout_object(this);
902 this->deferred_layout_.reserve(num_sections_to_defer);
903 }
904
905 // Whether we've seen a .note.GNU-stack section.
906 bool seen_gnu_stack = false;
907 // The flags of a .note.GNU-stack section.
908 uint64_t gnu_stack_flags = 0;
909
910 // Keep track of which sections to omit.
911 std::vector<bool> omit(shnum, false);
912
913 // Keep track of reloc sections when emitting relocations.
914 const bool relocatable = parameters->options().relocatable();
915 const bool emit_relocs = (relocatable
916 || parameters->options().emit_relocs());
917 std::vector<unsigned int> reloc_sections;
918
919 // Keep track of .eh_frame sections.
920 std::vector<unsigned int> eh_frame_sections;
921
922 // Skip the first, dummy, section.
923 pshdrs = shdrs + This::shdr_size;
924 for (unsigned int i = 1; i < shnum; ++i, pshdrs += This::shdr_size)
925 {
926 typename This::Shdr shdr(pshdrs);
927
928 if (shdr.get_sh_name() >= sd->section_names_size)
929 {
930 this->error(_("bad section name offset for section %u: %lu"),
931 i, static_cast<unsigned long>(shdr.get_sh_name()));
932 return;
933 }
934
935 const char* name = pnames + shdr.get_sh_name();
936
937 if (this->handle_gnu_warning_section(name, i, symtab))
938 {
939 if (!relocatable)
940 omit[i] = true;
941 }
942
943 // The .note.GNU-stack section is special. It gives the
944 // protection flags that this object file requires for the stack
945 // in memory.
946 if (strcmp(name, ".note.GNU-stack") == 0)
947 {
948 seen_gnu_stack = true;
949 gnu_stack_flags |= shdr.get_sh_flags();
950 omit[i] = true;
951 }
952
953 bool discard = omit[i];
954 if (!discard)
955 {
956 if (shdr.get_sh_type() == elfcpp::SHT_GROUP)
957 {
958 if (!this->include_section_group(symtab, layout, i, name, shdrs,
959 pnames, sd->section_names_size,
960 &omit))
961 discard = true;
962 }
963 else if ((shdr.get_sh_flags() & elfcpp::SHF_GROUP) == 0
964 && Layout::is_linkonce(name))
965 {
966 if (!this->include_linkonce_section(layout, i, name, shdr))
967 discard = true;
968 }
969 }
970
971 if (discard)
972 {
973 // Do not include this section in the link.
974 out_sections[i] = NULL;
975 out_section_offsets[i] = invalid_address;
976 continue;
977 }
978
979 // When doing a relocatable link we are going to copy input
980 // reloc sections into the output. We only want to copy the
981 // ones associated with sections which are not being discarded.
982 // However, we don't know that yet for all sections. So save
983 // reloc sections and process them later.
984 if (emit_relocs
985 && (shdr.get_sh_type() == elfcpp::SHT_REL
986 || shdr.get_sh_type() == elfcpp::SHT_RELA))
987 {
988 reloc_sections.push_back(i);
989 continue;
990 }
991
992 if (relocatable && shdr.get_sh_type() == elfcpp::SHT_GROUP)
993 continue;
994
995 // The .eh_frame section is special. It holds exception frame
996 // information that we need to read in order to generate the
997 // exception frame header. We process these after all the other
998 // sections so that the exception frame reader can reliably
999 // determine which sections are being discarded, and discard the
1000 // corresponding information.
1001 if (!relocatable
1002 && strcmp(name, ".eh_frame") == 0
1003 && this->check_eh_frame_flags(&shdr))
1004 {
1005 eh_frame_sections.push_back(i);
1006 continue;
1007 }
1008
1009 if (should_defer_layout && (shdr.get_sh_flags() & elfcpp::SHF_ALLOC))
1010 {
1011 this->deferred_layout_.push_back(Deferred_layout(i, name, pshdrs,
1012 reloc_shndx[i],
1013 reloc_type[i]));
1014
1015 // Put dummy values here; real values will be supplied by
1016 // do_layout_deferred_sections.
1017 out_sections[i] = reinterpret_cast<Output_section*>(1);
1018 out_section_offsets[i] = invalid_address;
1019 }
1020 else
1021 {
1022 this->layout_section(layout, i, name, shdr, reloc_shndx[i],
1023 reloc_type[i]);
1024 }
1025 }
1026
1027 layout->layout_gnu_stack(seen_gnu_stack, gnu_stack_flags);
1028
1029 // When doing a relocatable link handle the reloc sections at the
1030 // end.
1031 if (emit_relocs)
1032 this->size_relocatable_relocs();
1033 for (std::vector<unsigned int>::const_iterator p = reloc_sections.begin();
1034 p != reloc_sections.end();
1035 ++p)
1036 {
1037 unsigned int i = *p;
1038 const unsigned char* pshdr;
1039 pshdr = sd->section_headers->data() + i * This::shdr_size;
1040 typename This::Shdr shdr(pshdr);
1041
1042 unsigned int data_shndx = this->adjust_shndx(shdr.get_sh_info());
1043 if (data_shndx >= shnum)
1044 {
1045 // We already warned about this above.
1046 continue;
1047 }
1048
1049 Output_section* data_section = out_sections[data_shndx];
1050 if (data_section == NULL)
1051 {
1052 out_sections[i] = NULL;
1053 out_section_offsets[i] = invalid_address;
1054 continue;
1055 }
1056
1057 Relocatable_relocs* rr = new Relocatable_relocs();
1058 this->set_relocatable_relocs(i, rr);
1059
1060 Output_section* os = layout->layout_reloc(this, i, shdr, data_section,
1061 rr);
1062 out_sections[i] = os;
1063 out_section_offsets[i] = invalid_address;
1064 }
1065
1066 // Handle the .eh_frame sections at the end.
1067 for (std::vector<unsigned int>::const_iterator p = eh_frame_sections.begin();
1068 p != eh_frame_sections.end();
1069 ++p)
1070 {
1071 gold_assert(this->has_eh_frame_);
1072 gold_assert(sd->external_symbols_offset != 0);
1073
1074 unsigned int i = *p;
1075 const unsigned char *pshdr;
1076 pshdr = sd->section_headers->data() + i * This::shdr_size;
1077 typename This::Shdr shdr(pshdr);
1078
1079 off_t offset;
1080 Output_section* os = layout->layout_eh_frame(this,
1081 sd->symbols->data(),
1082 sd->symbols_size,
1083 sd->symbol_names->data(),
1084 sd->symbol_names_size,
1085 i, shdr,
1086 reloc_shndx[i],
1087 reloc_type[i],
1088 &offset);
1089 out_sections[i] = os;
1090 if (offset == -1)
1091 out_section_offsets[i] = invalid_address;
1092 else
1093 out_section_offsets[i] = convert_types<Address, off_t>(offset);
1094
1095 // If this section requires special handling, and if there are
1096 // relocs that apply to it, then we must do the special handling
1097 // before we apply the relocs.
1098 if (offset == -1 && reloc_shndx[i] != 0)
1099 this->set_relocs_must_follow_section_writes();
1100 }
1101
1102 delete sd->section_headers;
1103 sd->section_headers = NULL;
1104 delete sd->section_names;
1105 sd->section_names = NULL;
1106 }
1107
1108 // Layout sections whose layout was deferred while waiting for
1109 // input files from a plugin.
1110
1111 template<int size, bool big_endian>
1112 void
1113 Sized_relobj<size, big_endian>::do_layout_deferred_sections(Layout* layout)
1114 {
1115 typename std::vector<Deferred_layout>::iterator deferred;
1116
1117 for (deferred = this->deferred_layout_.begin();
1118 deferred != this->deferred_layout_.end();
1119 ++deferred)
1120 {
1121 typename This::Shdr shdr(deferred->shdr_data_);
1122 this->layout_section(layout, deferred->shndx_, deferred->name_.c_str(),
1123 shdr, deferred->reloc_shndx_, deferred->reloc_type_);
1124 }
1125
1126 this->deferred_layout_.clear();
1127 }
1128
1129 // Add the symbols to the symbol table.
1130
1131 template<int size, bool big_endian>
1132 void
1133 Sized_relobj<size, big_endian>::do_add_symbols(Symbol_table* symtab,
1134 Read_symbols_data* sd)
1135 {
1136 if (sd->symbols == NULL)
1137 {
1138 gold_assert(sd->symbol_names == NULL);
1139 return;
1140 }
1141
1142 const int sym_size = This::sym_size;
1143 size_t symcount = ((sd->symbols_size - sd->external_symbols_offset)
1144 / sym_size);
1145 if (symcount * sym_size != sd->symbols_size - sd->external_symbols_offset)
1146 {
1147 this->error(_("size of symbols is not multiple of symbol size"));
1148 return;
1149 }
1150
1151 this->symbols_.resize(symcount);
1152
1153 const char* sym_names =
1154 reinterpret_cast<const char*>(sd->symbol_names->data());
1155 symtab->add_from_relobj(this,
1156 sd->symbols->data() + sd->external_symbols_offset,
1157 symcount, this->local_symbol_count_,
1158 sym_names, sd->symbol_names_size,
1159 &this->symbols_,
1160 &this->defined_count_);
1161
1162 delete sd->symbols;
1163 sd->symbols = NULL;
1164 delete sd->symbol_names;
1165 sd->symbol_names = NULL;
1166 }
1167
1168 // First pass over the local symbols. Here we add their names to
1169 // *POOL and *DYNPOOL, and we store the symbol value in
1170 // THIS->LOCAL_VALUES_. This function is always called from a
1171 // singleton thread. This is followed by a call to
1172 // finalize_local_symbols.
1173
1174 template<int size, bool big_endian>
1175 void
1176 Sized_relobj<size, big_endian>::do_count_local_symbols(Stringpool* pool,
1177 Stringpool* dynpool)
1178 {
1179 gold_assert(this->symtab_shndx_ != -1U);
1180 if (this->symtab_shndx_ == 0)
1181 {
1182 // This object has no symbols. Weird but legal.
1183 return;
1184 }
1185
1186 // Read the symbol table section header.
1187 const unsigned int symtab_shndx = this->symtab_shndx_;
1188 typename This::Shdr symtabshdr(this,
1189 this->elf_file_.section_header(symtab_shndx));
1190 gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB);
1191
1192 // Read the local symbols.
1193 const int sym_size = This::sym_size;
1194 const unsigned int loccount = this->local_symbol_count_;
1195 gold_assert(loccount == symtabshdr.get_sh_info());
1196 off_t locsize = loccount * sym_size;
1197 const unsigned char* psyms = this->get_view(symtabshdr.get_sh_offset(),
1198 locsize, true, true);
1199
1200 // Read the symbol names.
1201 const unsigned int strtab_shndx =
1202 this->adjust_shndx(symtabshdr.get_sh_link());
1203 section_size_type strtab_size;
1204 const unsigned char* pnamesu = this->section_contents(strtab_shndx,
1205 &strtab_size,
1206 true);
1207 const char* pnames = reinterpret_cast<const char*>(pnamesu);
1208
1209 // Loop over the local symbols.
1210
1211 const Output_sections& out_sections(this->output_sections());
1212 unsigned int shnum = this->shnum();
1213 unsigned int count = 0;
1214 unsigned int dyncount = 0;
1215 // Skip the first, dummy, symbol.
1216 psyms += sym_size;
1217 for (unsigned int i = 1; i < loccount; ++i, psyms += sym_size)
1218 {
1219 elfcpp::Sym<size, big_endian> sym(psyms);
1220
1221 Symbol_value<size>& lv(this->local_values_[i]);
1222
1223 bool is_ordinary;
1224 unsigned int shndx = this->adjust_sym_shndx(i, sym.get_st_shndx(),
1225 &is_ordinary);
1226 lv.set_input_shndx(shndx, is_ordinary);
1227
1228 if (sym.get_st_type() == elfcpp::STT_SECTION)
1229 lv.set_is_section_symbol();
1230 else if (sym.get_st_type() == elfcpp::STT_TLS)
1231 lv.set_is_tls_symbol();
1232
1233 // Save the input symbol value for use in do_finalize_local_symbols().
1234 lv.set_input_value(sym.get_st_value());
1235
1236 // Decide whether this symbol should go into the output file.
1237
1238 if (shndx < shnum && out_sections[shndx] == NULL)
1239 {
1240 lv.set_no_output_symtab_entry();
1241 gold_assert(!lv.needs_output_dynsym_entry());
1242 continue;
1243 }
1244
1245 if (sym.get_st_type() == elfcpp::STT_SECTION)
1246 {
1247 lv.set_no_output_symtab_entry();
1248 gold_assert(!lv.needs_output_dynsym_entry());
1249 continue;
1250 }
1251
1252 if (sym.get_st_name() >= strtab_size)
1253 {
1254 this->error(_("local symbol %u section name out of range: %u >= %u"),
1255 i, sym.get_st_name(),
1256 static_cast<unsigned int>(strtab_size));
1257 lv.set_no_output_symtab_entry();
1258 continue;
1259 }
1260
1261 // Add the symbol to the symbol table string pool.
1262 const char* name = pnames + sym.get_st_name();
1263 pool->add(name, true, NULL);
1264 ++count;
1265
1266 // If needed, add the symbol to the dynamic symbol table string pool.
1267 if (lv.needs_output_dynsym_entry())
1268 {
1269 dynpool->add(name, true, NULL);
1270 ++dyncount;
1271 }
1272 }
1273
1274 this->output_local_symbol_count_ = count;
1275 this->output_local_dynsym_count_ = dyncount;
1276 }
1277
1278 // Finalize the local symbols. Here we set the final value in
1279 // THIS->LOCAL_VALUES_ and set their output symbol table indexes.
1280 // This function is always called from a singleton thread. The actual
1281 // output of the local symbols will occur in a separate task.
1282
1283 template<int size, bool big_endian>
1284 unsigned int
1285 Sized_relobj<size, big_endian>::do_finalize_local_symbols(unsigned int index,
1286 off_t off)
1287 {
1288 gold_assert(off == static_cast<off_t>(align_address(off, size >> 3)));
1289
1290 const unsigned int loccount = this->local_symbol_count_;
1291 this->local_symbol_offset_ = off;
1292
1293 const Output_sections& out_sections(this->output_sections());
1294 const std::vector<Address>& out_offsets(this->section_offsets_);
1295 unsigned int shnum = this->shnum();
1296
1297 for (unsigned int i = 1; i < loccount; ++i)
1298 {
1299 Symbol_value<size>& lv(this->local_values_[i]);
1300
1301 bool is_ordinary;
1302 unsigned int shndx = lv.input_shndx(&is_ordinary);
1303
1304 // Set the output symbol value.
1305
1306 if (!is_ordinary)
1307 {
1308 if (shndx == elfcpp::SHN_ABS || shndx == elfcpp::SHN_COMMON)
1309 lv.set_output_value(lv.input_value());
1310 else
1311 {
1312 this->error(_("unknown section index %u for local symbol %u"),
1313 shndx, i);
1314 lv.set_output_value(0);
1315 }
1316 }
1317 else
1318 {
1319 if (shndx >= shnum)
1320 {
1321 this->error(_("local symbol %u section index %u out of range"),
1322 i, shndx);
1323 shndx = 0;
1324 }
1325
1326 Output_section* os = out_sections[shndx];
1327
1328 if (os == NULL)
1329 {
1330 // This local symbol belongs to a section we are discarding.
1331 // In some cases when applying relocations later, we will
1332 // attempt to match it to the corresponding kept section,
1333 // so we leave the input value unchanged here.
1334 continue;
1335 }
1336 else if (out_offsets[shndx] == invalid_address)
1337 {
1338 // This is a SHF_MERGE section or one which otherwise
1339 // requires special handling. We get the output address
1340 // of the start of the merged section. If this is not a
1341 // section symbol, we can then determine the final
1342 // value. If it is a section symbol, we can not, as in
1343 // that case we have to consider the addend to determine
1344 // the value to use in a relocation.
1345 if (!lv.is_section_symbol())
1346 lv.set_output_value(os->output_address(this, shndx,
1347 lv.input_value()));
1348 else
1349 {
1350 section_offset_type start =
1351 os->starting_output_address(this, shndx);
1352 Merged_symbol_value<size>* msv =
1353 new Merged_symbol_value<size>(lv.input_value(), start);
1354 lv.set_merged_symbol_value(msv);
1355 }
1356 }
1357 else if (lv.is_tls_symbol())
1358 lv.set_output_value(os->tls_offset()
1359 + out_offsets[shndx]
1360 + lv.input_value());
1361 else
1362 lv.set_output_value(os->address()
1363 + out_offsets[shndx]
1364 + lv.input_value());
1365 }
1366
1367 if (lv.needs_output_symtab_entry())
1368 {
1369 lv.set_output_symtab_index(index);
1370 ++index;
1371 }
1372 }
1373 return index;
1374 }
1375
1376 // Set the output dynamic symbol table indexes for the local variables.
1377
1378 template<int size, bool big_endian>
1379 unsigned int
1380 Sized_relobj<size, big_endian>::do_set_local_dynsym_indexes(unsigned int index)
1381 {
1382 const unsigned int loccount = this->local_symbol_count_;
1383 for (unsigned int i = 1; i < loccount; ++i)
1384 {
1385 Symbol_value<size>& lv(this->local_values_[i]);
1386 if (lv.needs_output_dynsym_entry())
1387 {
1388 lv.set_output_dynsym_index(index);
1389 ++index;
1390 }
1391 }
1392 return index;
1393 }
1394
1395 // Set the offset where local dynamic symbol information will be stored.
1396 // Returns the count of local symbols contributed to the symbol table by
1397 // this object.
1398
1399 template<int size, bool big_endian>
1400 unsigned int
1401 Sized_relobj<size, big_endian>::do_set_local_dynsym_offset(off_t off)
1402 {
1403 gold_assert(off == static_cast<off_t>(align_address(off, size >> 3)));
1404 this->local_dynsym_offset_ = off;
1405 return this->output_local_dynsym_count_;
1406 }
1407
1408 // Write out the local symbols.
1409
1410 template<int size, bool big_endian>
1411 void
1412 Sized_relobj<size, big_endian>::write_local_symbols(
1413 Output_file* of,
1414 const Stringpool* sympool,
1415 const Stringpool* dynpool,
1416 Output_symtab_xindex* symtab_xindex,
1417 Output_symtab_xindex* dynsym_xindex)
1418 {
1419 const bool strip_all = parameters->options().strip_all();
1420 if (strip_all)
1421 {
1422 if (this->output_local_dynsym_count_ == 0)
1423 return;
1424 this->output_local_symbol_count_ = 0;
1425 }
1426
1427 gold_assert(this->symtab_shndx_ != -1U);
1428 if (this->symtab_shndx_ == 0)
1429 {
1430 // This object has no symbols. Weird but legal.
1431 return;
1432 }
1433
1434 // Read the symbol table section header.
1435 const unsigned int symtab_shndx = this->symtab_shndx_;
1436 typename This::Shdr symtabshdr(this,
1437 this->elf_file_.section_header(symtab_shndx));
1438 gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB);
1439 const unsigned int loccount = this->local_symbol_count_;
1440 gold_assert(loccount == symtabshdr.get_sh_info());
1441
1442 // Read the local symbols.
1443 const int sym_size = This::sym_size;
1444 off_t locsize = loccount * sym_size;
1445 const unsigned char* psyms = this->get_view(symtabshdr.get_sh_offset(),
1446 locsize, true, false);
1447
1448 // Read the symbol names.
1449 const unsigned int strtab_shndx =
1450 this->adjust_shndx(symtabshdr.get_sh_link());
1451 section_size_type strtab_size;
1452 const unsigned char* pnamesu = this->section_contents(strtab_shndx,
1453 &strtab_size,
1454 false);
1455 const char* pnames = reinterpret_cast<const char*>(pnamesu);
1456
1457 // Get views into the output file for the portions of the symbol table
1458 // and the dynamic symbol table that we will be writing.
1459 off_t output_size = this->output_local_symbol_count_ * sym_size;
1460 unsigned char* oview = NULL;
1461 if (output_size > 0)
1462 oview = of->get_output_view(this->local_symbol_offset_, output_size);
1463
1464 off_t dyn_output_size = this->output_local_dynsym_count_ * sym_size;
1465 unsigned char* dyn_oview = NULL;
1466 if (dyn_output_size > 0)
1467 dyn_oview = of->get_output_view(this->local_dynsym_offset_,
1468 dyn_output_size);
1469
1470 const Output_sections out_sections(this->output_sections());
1471
1472 gold_assert(this->local_values_.size() == loccount);
1473
1474 unsigned char* ov = oview;
1475 unsigned char* dyn_ov = dyn_oview;
1476 psyms += sym_size;
1477 for (unsigned int i = 1; i < loccount; ++i, psyms += sym_size)
1478 {
1479 elfcpp::Sym<size, big_endian> isym(psyms);
1480
1481 Symbol_value<size>& lv(this->local_values_[i]);
1482
1483 bool is_ordinary;
1484 unsigned int st_shndx = this->adjust_sym_shndx(i, isym.get_st_shndx(),
1485 &is_ordinary);
1486 if (is_ordinary)
1487 {
1488 gold_assert(st_shndx < out_sections.size());
1489 if (out_sections[st_shndx] == NULL)
1490 continue;
1491 st_shndx = out_sections[st_shndx]->out_shndx();
1492 if (st_shndx >= elfcpp::SHN_LORESERVE)
1493 {
1494 if (lv.needs_output_symtab_entry() && !strip_all)
1495 symtab_xindex->add(lv.output_symtab_index(), st_shndx);
1496 if (lv.needs_output_dynsym_entry())
1497 dynsym_xindex->add(lv.output_dynsym_index(), st_shndx);
1498 st_shndx = elfcpp::SHN_XINDEX;
1499 }
1500 }
1501
1502 // Write the symbol to the output symbol table.
1503 if (!strip_all && lv.needs_output_symtab_entry())
1504 {
1505 elfcpp::Sym_write<size, big_endian> osym(ov);
1506
1507 gold_assert(isym.get_st_name() < strtab_size);
1508 const char* name = pnames + isym.get_st_name();
1509 osym.put_st_name(sympool->get_offset(name));
1510 osym.put_st_value(this->local_values_[i].value(this, 0));
1511 osym.put_st_size(isym.get_st_size());
1512 osym.put_st_info(isym.get_st_info());
1513 osym.put_st_other(isym.get_st_other());
1514 osym.put_st_shndx(st_shndx);
1515
1516 ov += sym_size;
1517 }
1518
1519 // Write the symbol to the output dynamic symbol table.
1520 if (lv.needs_output_dynsym_entry())
1521 {
1522 gold_assert(dyn_ov < dyn_oview + dyn_output_size);
1523 elfcpp::Sym_write<size, big_endian> osym(dyn_ov);
1524
1525 gold_assert(isym.get_st_name() < strtab_size);
1526 const char* name = pnames + isym.get_st_name();
1527 osym.put_st_name(dynpool->get_offset(name));
1528 osym.put_st_value(this->local_values_[i].value(this, 0));
1529 osym.put_st_size(isym.get_st_size());
1530 osym.put_st_info(isym.get_st_info());
1531 osym.put_st_other(isym.get_st_other());
1532 osym.put_st_shndx(st_shndx);
1533
1534 dyn_ov += sym_size;
1535 }
1536 }
1537
1538
1539 if (output_size > 0)
1540 {
1541 gold_assert(ov - oview == output_size);
1542 of->write_output_view(this->local_symbol_offset_, output_size, oview);
1543 }
1544
1545 if (dyn_output_size > 0)
1546 {
1547 gold_assert(dyn_ov - dyn_oview == dyn_output_size);
1548 of->write_output_view(this->local_dynsym_offset_, dyn_output_size,
1549 dyn_oview);
1550 }
1551 }
1552
1553 // Set *INFO to symbolic information about the offset OFFSET in the
1554 // section SHNDX. Return true if we found something, false if we
1555 // found nothing.
1556
1557 template<int size, bool big_endian>
1558 bool
1559 Sized_relobj<size, big_endian>::get_symbol_location_info(
1560 unsigned int shndx,
1561 off_t offset,
1562 Symbol_location_info* info)
1563 {
1564 if (this->symtab_shndx_ == 0)
1565 return false;
1566
1567 section_size_type symbols_size;
1568 const unsigned char* symbols = this->section_contents(this->symtab_shndx_,
1569 &symbols_size,
1570 false);
1571
1572 unsigned int symbol_names_shndx =
1573 this->adjust_shndx(this->section_link(this->symtab_shndx_));
1574 section_size_type names_size;
1575 const unsigned char* symbol_names_u =
1576 this->section_contents(symbol_names_shndx, &names_size, false);
1577 const char* symbol_names = reinterpret_cast<const char*>(symbol_names_u);
1578
1579 const int sym_size = This::sym_size;
1580 const size_t count = symbols_size / sym_size;
1581
1582 const unsigned char* p = symbols;
1583 for (size_t i = 0; i < count; ++i, p += sym_size)
1584 {
1585 elfcpp::Sym<size, big_endian> sym(p);
1586
1587 if (sym.get_st_type() == elfcpp::STT_FILE)
1588 {
1589 if (sym.get_st_name() >= names_size)
1590 info->source_file = "(invalid)";
1591 else
1592 info->source_file = symbol_names + sym.get_st_name();
1593 continue;
1594 }
1595
1596 bool is_ordinary;
1597 unsigned int st_shndx = this->adjust_sym_shndx(i, sym.get_st_shndx(),
1598 &is_ordinary);
1599 if (is_ordinary
1600 && st_shndx == shndx
1601 && static_cast<off_t>(sym.get_st_value()) <= offset
1602 && (static_cast<off_t>(sym.get_st_value() + sym.get_st_size())
1603 > offset))
1604 {
1605 if (sym.get_st_name() > names_size)
1606 info->enclosing_symbol_name = "(invalid)";
1607 else
1608 {
1609 info->enclosing_symbol_name = symbol_names + sym.get_st_name();
1610 if (parameters->options().do_demangle())
1611 {
1612 char* demangled_name = cplus_demangle(
1613 info->enclosing_symbol_name.c_str(),
1614 DMGL_ANSI | DMGL_PARAMS);
1615 if (demangled_name != NULL)
1616 {
1617 info->enclosing_symbol_name.assign(demangled_name);
1618 free(demangled_name);
1619 }
1620 }
1621 }
1622 return true;
1623 }
1624 }
1625
1626 return false;
1627 }
1628
1629 // Look for a kept section corresponding to the given discarded section,
1630 // and return its output address. This is used only for relocations in
1631 // debugging sections. If we can't find the kept section, return 0.
1632
1633 template<int size, bool big_endian>
1634 typename Sized_relobj<size, big_endian>::Address
1635 Sized_relobj<size, big_endian>::map_to_kept_section(
1636 unsigned int shndx,
1637 bool* found) const
1638 {
1639 Kept_comdat_section *kept = this->get_kept_comdat_section(shndx);
1640 if (kept != NULL)
1641 {
1642 gold_assert(kept->object_ != NULL);
1643 *found = true;
1644 Output_section* os = kept->object_->output_section(kept->shndx_);
1645 Address offset = kept->object_->get_output_section_offset(kept->shndx_);
1646 gold_assert(os != NULL && offset != invalid_address);
1647 return os->address() + offset;
1648 }
1649 *found = false;
1650 return 0;
1651 }
1652
1653 // Get symbol counts.
1654
1655 template<int size, bool big_endian>
1656 void
1657 Sized_relobj<size, big_endian>::do_get_global_symbol_counts(
1658 const Symbol_table*,
1659 size_t* defined,
1660 size_t* used) const
1661 {
1662 *defined = this->defined_count_;
1663 size_t count = 0;
1664 for (Symbols::const_iterator p = this->symbols_.begin();
1665 p != this->symbols_.end();
1666 ++p)
1667 if (*p != NULL
1668 && (*p)->source() == Symbol::FROM_OBJECT
1669 && (*p)->object() == this
1670 && (*p)->is_defined())
1671 ++count;
1672 *used = count;
1673 }
1674
1675 // Input_objects methods.
1676
1677 // Add a regular relocatable object to the list. Return false if this
1678 // object should be ignored.
1679
1680 bool
1681 Input_objects::add_object(Object* obj)
1682 {
1683 // Set the global target from the first object file we recognize.
1684 Target* target = obj->target();
1685 if (!parameters->target_valid())
1686 set_parameters_target(target);
1687 else if (target != &parameters->target())
1688 {
1689 obj->error(_("incompatible target"));
1690 return false;
1691 }
1692
1693 // Print the filename if the -t/--trace option is selected.
1694 if (parameters->options().trace())
1695 gold_info("%s", obj->name().c_str());
1696
1697 if (!obj->is_dynamic())
1698 this->relobj_list_.push_back(static_cast<Relobj*>(obj));
1699 else
1700 {
1701 // See if this is a duplicate SONAME.
1702 Dynobj* dynobj = static_cast<Dynobj*>(obj);
1703 const char* soname = dynobj->soname();
1704
1705 std::pair<Unordered_set<std::string>::iterator, bool> ins =
1706 this->sonames_.insert(soname);
1707 if (!ins.second)
1708 {
1709 // We have already seen a dynamic object with this soname.
1710 return false;
1711 }
1712
1713 this->dynobj_list_.push_back(dynobj);
1714
1715 // If this is -lc, remember the directory in which we found it.
1716 // We use this when issuing warnings about undefined symbols: as
1717 // a heuristic, we don't warn about system libraries found in
1718 // the same directory as -lc.
1719 if (strncmp(soname, "libc.so", 7) == 0)
1720 {
1721 const char* object_name = dynobj->name().c_str();
1722 const char* base = lbasename(object_name);
1723 if (base != object_name)
1724 this->system_library_directory_.assign(object_name,
1725 base - 1 - object_name);
1726 }
1727 }
1728
1729 // Add this object to the cross-referencer if requested.
1730 if (parameters->options().user_set_print_symbol_counts())
1731 {
1732 if (this->cref_ == NULL)
1733 this->cref_ = new Cref();
1734 this->cref_->add_object(obj);
1735 }
1736
1737 return true;
1738 }
1739
1740 // Return whether an object was found in the system library directory.
1741
1742 bool
1743 Input_objects::found_in_system_library_directory(const Object* object) const
1744 {
1745 return (!this->system_library_directory_.empty()
1746 && object->name().compare(0,
1747 this->system_library_directory_.size(),
1748 this->system_library_directory_) == 0);
1749 }
1750
1751 // For each dynamic object, record whether we've seen all of its
1752 // explicit dependencies.
1753
1754 void
1755 Input_objects::check_dynamic_dependencies() const
1756 {
1757 for (Dynobj_list::const_iterator p = this->dynobj_list_.begin();
1758 p != this->dynobj_list_.end();
1759 ++p)
1760 {
1761 const Dynobj::Needed& needed((*p)->needed());
1762 bool found_all = true;
1763 for (Dynobj::Needed::const_iterator pneeded = needed.begin();
1764 pneeded != needed.end();
1765 ++pneeded)
1766 {
1767 if (this->sonames_.find(*pneeded) == this->sonames_.end())
1768 {
1769 found_all = false;
1770 break;
1771 }
1772 }
1773 (*p)->set_has_unknown_needed_entries(!found_all);
1774 }
1775 }
1776
1777 // Start processing an archive.
1778
1779 void
1780 Input_objects::archive_start(Archive* archive)
1781 {
1782 if (parameters->options().user_set_print_symbol_counts())
1783 {
1784 if (this->cref_ == NULL)
1785 this->cref_ = new Cref();
1786 this->cref_->add_archive_start(archive);
1787 }
1788 }
1789
1790 // Stop processing an archive.
1791
1792 void
1793 Input_objects::archive_stop(Archive* archive)
1794 {
1795 if (parameters->options().user_set_print_symbol_counts())
1796 this->cref_->add_archive_stop(archive);
1797 }
1798
1799 // Print symbol counts
1800
1801 void
1802 Input_objects::print_symbol_counts(const Symbol_table* symtab) const
1803 {
1804 if (parameters->options().user_set_print_symbol_counts()
1805 && this->cref_ != NULL)
1806 this->cref_->print_symbol_counts(symtab);
1807 }
1808
1809 // Relocate_info methods.
1810
1811 // Return a string describing the location of a relocation. This is
1812 // only used in error messages.
1813
1814 template<int size, bool big_endian>
1815 std::string
1816 Relocate_info<size, big_endian>::location(size_t, off_t offset) const
1817 {
1818 // See if we can get line-number information from debugging sections.
1819 std::string filename;
1820 std::string file_and_lineno; // Better than filename-only, if available.
1821
1822 Sized_dwarf_line_info<size, big_endian> line_info(this->object);
1823 // This will be "" if we failed to parse the debug info for any reason.
1824 file_and_lineno = line_info.addr2line(this->data_shndx, offset);
1825
1826 std::string ret(this->object->name());
1827 ret += ':';
1828 Symbol_location_info info;
1829 if (this->object->get_symbol_location_info(this->data_shndx, offset, &info))
1830 {
1831 ret += " in function ";
1832 ret += info.enclosing_symbol_name;
1833 ret += ":";
1834 filename = info.source_file;
1835 }
1836
1837 if (!file_and_lineno.empty())
1838 ret += file_and_lineno;
1839 else
1840 {
1841 if (!filename.empty())
1842 ret += filename;
1843 ret += "(";
1844 ret += this->object->section_name(this->data_shndx);
1845 char buf[100];
1846 // Offsets into sections have to be positive.
1847 snprintf(buf, sizeof(buf), "+0x%lx", static_cast<long>(offset));
1848 ret += buf;
1849 ret += ")";
1850 }
1851 return ret;
1852 }
1853
1854 } // End namespace gold.
1855
1856 namespace
1857 {
1858
1859 using namespace gold;
1860
1861 // Read an ELF file with the header and return the appropriate
1862 // instance of Object.
1863
1864 template<int size, bool big_endian>
1865 Object*
1866 make_elf_sized_object(const std::string& name, Input_file* input_file,
1867 off_t offset, const elfcpp::Ehdr<size, big_endian>& ehdr)
1868 {
1869 int et = ehdr.get_e_type();
1870 if (et == elfcpp::ET_REL)
1871 {
1872 Sized_relobj<size, big_endian>* obj =
1873 new Sized_relobj<size, big_endian>(name, input_file, offset, ehdr);
1874 obj->setup(ehdr);
1875 return obj;
1876 }
1877 else if (et == elfcpp::ET_DYN)
1878 {
1879 Sized_dynobj<size, big_endian>* obj =
1880 new Sized_dynobj<size, big_endian>(name, input_file, offset, ehdr);
1881 obj->setup(ehdr);
1882 return obj;
1883 }
1884 else
1885 {
1886 gold_error(_("%s: unsupported ELF file type %d"),
1887 name.c_str(), et);
1888 return NULL;
1889 }
1890 }
1891
1892 } // End anonymous namespace.
1893
1894 namespace gold
1895 {
1896
1897 // Read an ELF file and return the appropriate instance of Object.
1898
1899 Object*
1900 make_elf_object(const std::string& name, Input_file* input_file, off_t offset,
1901 const unsigned char* p, section_offset_type bytes)
1902 {
1903 if (bytes < elfcpp::EI_NIDENT)
1904 {
1905 gold_error(_("%s: ELF file too short"), name.c_str());
1906 return NULL;
1907 }
1908
1909 int v = p[elfcpp::EI_VERSION];
1910 if (v != elfcpp::EV_CURRENT)
1911 {
1912 if (v == elfcpp::EV_NONE)
1913 gold_error(_("%s: invalid ELF version 0"), name.c_str());
1914 else
1915 gold_error(_("%s: unsupported ELF version %d"), name.c_str(), v);
1916 return NULL;
1917 }
1918
1919 int c = p[elfcpp::EI_CLASS];
1920 if (c == elfcpp::ELFCLASSNONE)
1921 {
1922 gold_error(_("%s: invalid ELF class 0"), name.c_str());
1923 return NULL;
1924 }
1925 else if (c != elfcpp::ELFCLASS32
1926 && c != elfcpp::ELFCLASS64)
1927 {
1928 gold_error(_("%s: unsupported ELF class %d"), name.c_str(), c);
1929 return NULL;
1930 }
1931
1932 int d = p[elfcpp::EI_DATA];
1933 if (d == elfcpp::ELFDATANONE)
1934 {
1935 gold_error(_("%s: invalid ELF data encoding"), name.c_str());
1936 return NULL;
1937 }
1938 else if (d != elfcpp::ELFDATA2LSB
1939 && d != elfcpp::ELFDATA2MSB)
1940 {
1941 gold_error(_("%s: unsupported ELF data encoding %d"), name.c_str(), d);
1942 return NULL;
1943 }
1944
1945 bool big_endian = d == elfcpp::ELFDATA2MSB;
1946
1947 if (c == elfcpp::ELFCLASS32)
1948 {
1949 if (bytes < elfcpp::Elf_sizes<32>::ehdr_size)
1950 {
1951 gold_error(_("%s: ELF file too short"), name.c_str());
1952 return NULL;
1953 }
1954 if (big_endian)
1955 {
1956 #ifdef HAVE_TARGET_32_BIG
1957 elfcpp::Ehdr<32, true> ehdr(p);
1958 return make_elf_sized_object<32, true>(name, input_file,
1959 offset, ehdr);
1960 #else
1961 gold_error(_("%s: not configured to support "
1962 "32-bit big-endian object"),
1963 name.c_str());
1964 return NULL;
1965 #endif
1966 }
1967 else
1968 {
1969 #ifdef HAVE_TARGET_32_LITTLE
1970 elfcpp::Ehdr<32, false> ehdr(p);
1971 return make_elf_sized_object<32, false>(name, input_file,
1972 offset, ehdr);
1973 #else
1974 gold_error(_("%s: not configured to support "
1975 "32-bit little-endian object"),
1976 name.c_str());
1977 return NULL;
1978 #endif
1979 }
1980 }
1981 else
1982 {
1983 if (bytes < elfcpp::Elf_sizes<64>::ehdr_size)
1984 {
1985 gold_error(_("%s: ELF file too short"), name.c_str());
1986 return NULL;
1987 }
1988 if (big_endian)
1989 {
1990 #ifdef HAVE_TARGET_64_BIG
1991 elfcpp::Ehdr<64, true> ehdr(p);
1992 return make_elf_sized_object<64, true>(name, input_file,
1993 offset, ehdr);
1994 #else
1995 gold_error(_("%s: not configured to support "
1996 "64-bit big-endian object"),
1997 name.c_str());
1998 return NULL;
1999 #endif
2000 }
2001 else
2002 {
2003 #ifdef HAVE_TARGET_64_LITTLE
2004 elfcpp::Ehdr<64, false> ehdr(p);
2005 return make_elf_sized_object<64, false>(name, input_file,
2006 offset, ehdr);
2007 #else
2008 gold_error(_("%s: not configured to support "
2009 "64-bit little-endian object"),
2010 name.c_str());
2011 return NULL;
2012 #endif
2013 }
2014 }
2015 }
2016
2017 // Instantiate the templates we need.
2018
2019 #ifdef HAVE_TARGET_32_LITTLE
2020 template
2021 void
2022 Object::read_section_data<32, false>(elfcpp::Elf_file<32, false, Object>*,
2023 Read_symbols_data*);
2024 #endif
2025
2026 #ifdef HAVE_TARGET_32_BIG
2027 template
2028 void
2029 Object::read_section_data<32, true>(elfcpp::Elf_file<32, true, Object>*,
2030 Read_symbols_data*);
2031 #endif
2032
2033 #ifdef HAVE_TARGET_64_LITTLE
2034 template
2035 void
2036 Object::read_section_data<64, false>(elfcpp::Elf_file<64, false, Object>*,
2037 Read_symbols_data*);
2038 #endif
2039
2040 #ifdef HAVE_TARGET_64_BIG
2041 template
2042 void
2043 Object::read_section_data<64, true>(elfcpp::Elf_file<64, true, Object>*,
2044 Read_symbols_data*);
2045 #endif
2046
2047 #ifdef HAVE_TARGET_32_LITTLE
2048 template
2049 class Sized_relobj<32, false>;
2050 #endif
2051
2052 #ifdef HAVE_TARGET_32_BIG
2053 template
2054 class Sized_relobj<32, true>;
2055 #endif
2056
2057 #ifdef HAVE_TARGET_64_LITTLE
2058 template
2059 class Sized_relobj<64, false>;
2060 #endif
2061
2062 #ifdef HAVE_TARGET_64_BIG
2063 template
2064 class Sized_relobj<64, true>;
2065 #endif
2066
2067 #ifdef HAVE_TARGET_32_LITTLE
2068 template
2069 struct Relocate_info<32, false>;
2070 #endif
2071
2072 #ifdef HAVE_TARGET_32_BIG
2073 template
2074 struct Relocate_info<32, true>;
2075 #endif
2076
2077 #ifdef HAVE_TARGET_64_LITTLE
2078 template
2079 struct Relocate_info<64, false>;
2080 #endif
2081
2082 #ifdef HAVE_TARGET_64_BIG
2083 template
2084 struct Relocate_info<64, true>;
2085 #endif
2086
2087 } // End namespace gold.
This page took 0.072116 seconds and 5 git commands to generate.