*** empty log message ***
[deliverable/binutils-gdb.git] / gold / object.h
CommitLineData
bae7f79e
ILT
1// object.h -- support for an object file for linking in gold -*- C++ -*-
2
b578bd7d 3// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
6cb15b7f
ILT
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
bae7f79e
ILT
23#ifndef GOLD_OBJECT_H
24#define GOLD_OBJECT_H
25
92e059d8 26#include <string>
a2fb1b05 27#include <vector>
14bfc3f5 28
bae7f79e 29#include "elfcpp.h"
645f8123 30#include "elfcpp_file.h"
bae7f79e 31#include "fileread.h"
14bfc3f5 32#include "target.h"
b0193076 33#include "archive.h"
bae7f79e
ILT
34
35namespace gold
36{
37
92e059d8 38class General_options;
17a1d0a9 39class Task;
92de84a6 40class Cref;
a2fb1b05 41class Layout;
7223e9ca 42class Output_data;
61ba1cf9
ILT
43class Output_section;
44class Output_file;
d491d34e 45class Output_symtab_xindex;
89fc3421 46class Pluginobj;
f6ce93d6 47class Dynobj;
4625f782 48class Object_merge_map;
6a74a719 49class Relocatable_relocs;
6d03d481 50class Symbols_data;
a2fb1b05 51
b8e6aad9
ILT
52template<typename Stringpool_char>
53class Stringpool_template;
54
bae7f79e
ILT
55// Data to pass from read_symbols() to add_symbols().
56
57struct Read_symbols_data
58{
00698fc5
CC
59 Read_symbols_data()
60 : section_headers(NULL), section_names(NULL), symbols(NULL),
61 symbol_names(NULL), versym(NULL), verdef(NULL), verneed(NULL)
62 { }
63
64 ~Read_symbols_data();
65
12e14209
ILT
66 // Section headers.
67 File_view* section_headers;
68 // Section names.
69 File_view* section_names;
70 // Size of section name data in bytes.
8383303e 71 section_size_type section_names_size;
bae7f79e
ILT
72 // Symbol data.
73 File_view* symbols;
74 // Size of symbol data in bytes.
8383303e 75 section_size_type symbols_size;
730cdc88
ILT
76 // Offset of external symbols within symbol data. This structure
77 // sometimes contains only external symbols, in which case this will
78 // be zero. Sometimes it contains all symbols.
8383303e 79 section_offset_type external_symbols_offset;
bae7f79e
ILT
80 // Symbol names.
81 File_view* symbol_names;
82 // Size of symbol name data in bytes.
8383303e 83 section_size_type symbol_names_size;
dbe717ef
ILT
84
85 // Version information. This is only used on dynamic objects.
86 // Version symbol data (from SHT_GNU_versym section).
87 File_view* versym;
8383303e 88 section_size_type versym_size;
dbe717ef
ILT
89 // Version definition data (from SHT_GNU_verdef section).
90 File_view* verdef;
8383303e 91 section_size_type verdef_size;
dbe717ef
ILT
92 unsigned int verdef_info;
93 // Needed version data (from SHT_GNU_verneed section).
94 File_view* verneed;
8383303e 95 section_size_type verneed_size;
dbe717ef 96 unsigned int verneed_info;
bae7f79e
ILT
97};
98
f7e2ee48
ILT
99// Information used to print error messages.
100
101struct Symbol_location_info
102{
103 std::string source_file;
104 std::string enclosing_symbol_name;
105 int line_number;
106};
107
92e059d8
ILT
108// Data about a single relocation section. This is read in
109// read_relocs and processed in scan_relocs.
110
111struct Section_relocs
112{
00698fc5
CC
113 Section_relocs()
114 : contents(NULL)
115 { }
116
117 ~Section_relocs()
118 { delete this->contents; }
119
92e059d8
ILT
120 // Index of reloc section.
121 unsigned int reloc_shndx;
122 // Index of section that relocs apply to.
123 unsigned int data_shndx;
124 // Contents of reloc section.
125 File_view* contents;
126 // Reloc section type.
127 unsigned int sh_type;
128 // Number of reloc entries.
129 size_t reloc_count;
730cdc88
ILT
130 // Output section.
131 Output_section* output_section;
132 // Whether this section has special handling for offsets.
133 bool needs_special_offset_handling;
7019cd25
ILT
134 // Whether the data section is allocated (has the SHF_ALLOC flag set).
135 bool is_data_section_allocated;
92e059d8
ILT
136};
137
138// Relocations in an object file. This is read in read_relocs and
139// processed in scan_relocs.
140
141struct Read_relocs_data
142{
00698fc5
CC
143 Read_relocs_data()
144 : local_symbols(NULL)
145 { }
146
147 ~Read_relocs_data()
148 { delete this->local_symbols; }
149
92e059d8
ILT
150 typedef std::vector<Section_relocs> Relocs_list;
151 // The relocations.
152 Relocs_list relocs;
153 // The local symbols.
154 File_view* local_symbols;
155};
156
d491d34e
ILT
157// The Xindex class manages section indexes for objects with more than
158// 0xff00 sections.
159
160class Xindex
161{
162 public:
163 Xindex(int large_shndx_offset)
164 : large_shndx_offset_(large_shndx_offset), symtab_xindex_()
165 { }
166
167 // Initialize the symtab_xindex_ array, given the object and the
168 // section index of the symbol table to use.
169 template<int size, bool big_endian>
170 void
171 initialize_symtab_xindex(Object*, unsigned int symtab_shndx);
172
173 // Read in the symtab_xindex_ array, given its section index.
174 // PSHDRS may optionally point to the section headers.
175 template<int size, bool big_endian>
176 void
177 read_symtab_xindex(Object*, unsigned int xindex_shndx,
178 const unsigned char* pshdrs);
179
180 // Symbol SYMNDX in OBJECT has a section of SHN_XINDEX; return the
181 // real section index.
182 unsigned int
183 sym_xindex_to_shndx(Object* object, unsigned int symndx);
184
185 private:
186 // The type of the array giving the real section index for symbols
187 // whose st_shndx field holds SHN_XINDEX.
188 typedef std::vector<unsigned int> Symtab_xindex;
189
190 // Adjust a section index if necessary. This should only be called
191 // for ordinary section indexes.
192 unsigned int
193 adjust_shndx(unsigned int shndx)
194 {
195 if (shndx >= elfcpp::SHN_LORESERVE)
196 shndx += this->large_shndx_offset_;
197 return shndx;
198 }
199
200 // Adjust to apply to large section indexes.
201 int large_shndx_offset_;
202 // The data from the SHT_SYMTAB_SHNDX section.
203 Symtab_xindex symtab_xindex_;
204};
205
f6ce93d6
ILT
206// Object is an abstract base class which represents either a 32-bit
207// or a 64-bit input object. This can be a regular object file
208// (ET_REL) or a shared object (ET_DYN).
bae7f79e
ILT
209
210class Object
211{
212 public:
dde3f402
ILT
213 typedef std::vector<Symbol*> Symbols;
214
bae7f79e
ILT
215 // NAME is the name of the object as we would report it to the user
216 // (e.g., libfoo.a(bar.o) if this is in an archive. INPUT_FILE is
217 // used to read the file. OFFSET is the offset within the input
218 // file--0 for a .o or .so file, something else for a .a file.
2ea97941
ILT
219 Object(const std::string& name, Input_file* input_file, bool is_dynamic,
220 off_t offset = 0)
221 : name_(name), input_file_(input_file), offset_(offset), shnum_(-1U),
222 is_dynamic_(is_dynamic), is_needed_(false), uses_split_stack_(false),
594c8e5e 223 has_no_split_stack_(false), no_export_(false), xindex_(NULL)
2ea97941 224 { input_file->file().add_object(); }
bae7f79e
ILT
225
226 virtual ~Object()
cb295612 227 { this->input_file_->file().remove_object(); }
bae7f79e 228
14bfc3f5 229 // Return the name of the object as we would report it to the tuser.
bae7f79e
ILT
230 const std::string&
231 name() const
232 { return this->name_; }
233
cec9d2f3
ILT
234 // Get the offset into the file.
235 off_t
236 offset() const
237 { return this->offset_; }
238
14bfc3f5
ILT
239 // Return whether this is a dynamic object.
240 bool
241 is_dynamic() const
242 { return this->is_dynamic_; }
243
594c8e5e
ILT
244 // Return whether this object is needed--true if it is a dynamic
245 // object which defines some symbol referenced by a regular object.
246 // We keep the flag here rather than in Dynobj for convenience when
247 // setting it.
248 bool
249 is_needed() const
250 { return this->is_needed_; }
251
252 // Record that this object is needed.
253 void
254 set_is_needed()
255 { this->is_needed_ = true; }
256
364c7fa5
ILT
257 // Return whether this object was compiled with -fsplit-stack.
258 bool
259 uses_split_stack() const
260 { return this->uses_split_stack_; }
261
262 // Return whether this object contains any functions compiled with
263 // the no_split_stack attribute.
264 bool
265 has_no_split_stack() const
266 { return this->has_no_split_stack_; }
267
89fc3421
CC
268 // Returns NULL for Objects that are not plugin objects. This method
269 // is overridden in the Pluginobj class.
270 Pluginobj*
271 pluginobj()
272 { return this->do_pluginobj(); }
273
15f8229b
ILT
274 // Get the file. We pass on const-ness.
275 Input_file*
276 input_file()
277 { return this->input_file_; }
278
279 const Input_file*
280 input_file() const
281 { return this->input_file_; }
282
a2fb1b05
ILT
283 // Lock the underlying file.
284 void
17a1d0a9
ILT
285 lock(const Task* t)
286 { this->input_file()->file().lock(t); }
a2fb1b05
ILT
287
288 // Unlock the underlying file.
289 void
17a1d0a9
ILT
290 unlock(const Task* t)
291 { this->input_file()->file().unlock(t); }
a2fb1b05
ILT
292
293 // Return whether the underlying file is locked.
294 bool
295 is_locked() const
7004837e 296 { return this->input_file()->file().is_locked(); }
a2fb1b05 297
17a1d0a9
ILT
298 // Return the token, so that the task can be queued.
299 Task_token*
300 token()
301 { return this->input_file()->file().token(); }
302
303 // Release the underlying file.
304 void
305 release()
306 { this->input_file_->file().release(); }
307
88dd47ac
ILT
308 // Return whether we should just read symbols from this file.
309 bool
310 just_symbols() const
311 { return this->input_file()->just_symbols(); }
312
5a6f7e2d
ILT
313 // Get the number of sections.
314 unsigned int
315 shnum() const
316 { return this->shnum_; }
a2fb1b05 317
f6ce93d6 318 // Return a view of the contents of a section. Set *PLEN to the
9eb9fa57 319 // size. CACHE is a hint as in File_read::get_view.
f6ce93d6 320 const unsigned char*
8383303e 321 section_contents(unsigned int shndx, section_size_type* plen, bool cache);
f6ce93d6 322
d491d34e
ILT
323 // Adjust a symbol's section index as needed. SYMNDX is the index
324 // of the symbol and SHNDX is the symbol's section from
325 // get_st_shndx. This returns the section index. It sets
326 // *IS_ORDINARY to indicate whether this is a normal section index,
327 // rather than a special code between SHN_LORESERVE and
328 // SHN_HIRESERVE.
329 unsigned int
330 adjust_sym_shndx(unsigned int symndx, unsigned int shndx, bool* is_ordinary)
331 {
332 if (shndx < elfcpp::SHN_LORESERVE)
333 *is_ordinary = true;
334 else if (shndx == elfcpp::SHN_XINDEX)
335 {
336 if (this->xindex_ == NULL)
337 this->xindex_ = this->do_initialize_xindex();
338 shndx = this->xindex_->sym_xindex_to_shndx(this, symndx);
339 *is_ordinary = true;
340 }
341 else
342 *is_ordinary = false;
343 return shndx;
344 }
345
a445fddf
ILT
346 // Return the size of a section given a section index.
347 uint64_t
348 section_size(unsigned int shndx)
349 { return this->do_section_size(shndx); }
350
351 // Return the name of a section given a section index.
f6ce93d6 352 std::string
a3ad94ed
ILT
353 section_name(unsigned int shndx)
354 { return this->do_section_name(shndx); }
355
356 // Return the section flags given a section index.
357 uint64_t
358 section_flags(unsigned int shndx)
359 { return this->do_section_flags(shndx); }
f6ce93d6 360
ef15dade
ST
361 // Return the section entsize given a section index.
362 uint64_t
363 section_entsize(unsigned int shndx)
364 { return this->do_section_entsize(shndx); }
365
88dd47ac
ILT
366 // Return the section address given a section index.
367 uint64_t
368 section_address(unsigned int shndx)
369 { return this->do_section_address(shndx); }
370
730cdc88
ILT
371 // Return the section type given a section index.
372 unsigned int
373 section_type(unsigned int shndx)
374 { return this->do_section_type(shndx); }
375
f7e2ee48
ILT
376 // Return the section link field given a section index.
377 unsigned int
378 section_link(unsigned int shndx)
379 { return this->do_section_link(shndx); }
380
4c50553d
ILT
381 // Return the section info field given a section index.
382 unsigned int
383 section_info(unsigned int shndx)
384 { return this->do_section_info(shndx); }
385
a445fddf
ILT
386 // Return the required section alignment given a section index.
387 uint64_t
388 section_addralign(unsigned int shndx)
389 { return this->do_section_addralign(shndx); }
390
09ec0418
CC
391 // Return the output section given a section index.
392 Output_section*
393 output_section(unsigned int shndx) const
394 { return this->do_output_section(shndx); }
395
396 // Given a section index, return the offset in the Output_section.
397 // The return value will be -1U if the section is specially mapped,
398 // such as a merge section.
399 uint64_t
400 output_section_offset(unsigned int shndx) const
401 { return this->do_output_section_offset(shndx); }
402
5a6f7e2d
ILT
403 // Read the symbol information.
404 void
405 read_symbols(Read_symbols_data* sd)
406 { return this->do_read_symbols(sd); }
407
408 // Pass sections which should be included in the link to the Layout
409 // object, and record where the sections go in the output file.
410 void
2ea97941
ILT
411 layout(Symbol_table* symtab, Layout* layout, Read_symbols_data* sd)
412 { this->do_layout(symtab, layout, sd); }
5a6f7e2d
ILT
413
414 // Add symbol information to the global symbol table.
415 void
2ea97941
ILT
416 add_symbols(Symbol_table* symtab, Read_symbols_data* sd, Layout *layout)
417 { this->do_add_symbols(symtab, sd, layout); }
5a6f7e2d 418
b0193076
RÁE
419 // Add symbol information to the global symbol table.
420 Archive::Should_include
88a4108b
ILT
421 should_include_member(Symbol_table* symtab, Layout* layout,
422 Read_symbols_data* sd, std::string* why)
423 { return this->do_should_include_member(symtab, layout, sd, why); }
b0193076 424
e0c52780
CC
425 // Iterate over global symbols, calling a visitor class V for each.
426 void
427 for_all_global_symbols(Read_symbols_data* sd,
428 Library_base::Symbol_visitor_base* v)
429 { return this->do_for_all_global_symbols(sd, v); }
430
645f8123
ILT
431 // Functions and types for the elfcpp::Elf_file interface. This
432 // permit us to use Object as the File template parameter for
433 // elfcpp::Elf_file.
434
435 // The View class is returned by view. It must support a single
436 // method, data(). This is trivial, because get_view does what we
437 // need.
438 class View
439 {
440 public:
441 View(const unsigned char* p)
442 : p_(p)
443 { }
444
445 const unsigned char*
446 data() const
447 { return this->p_; }
448
449 private:
450 const unsigned char* p_;
451 };
452
453 // Return a View.
454 View
8383303e 455 view(off_t file_offset, section_size_type data_size)
39d0cb0e 456 { return View(this->get_view(file_offset, data_size, true, true)); }
645f8123
ILT
457
458 // Report an error.
459 void
75f2446e 460 error(const char* format, ...) const ATTRIBUTE_PRINTF_2;
645f8123
ILT
461
462 // A location in the file.
463 struct Location
464 {
465 off_t file_offset;
466 off_t data_size;
467
8383303e 468 Location(off_t fo, section_size_type ds)
645f8123
ILT
469 : file_offset(fo), data_size(ds)
470 { }
471 };
472
473 // Get a View given a Location.
474 View view(Location loc)
39d0cb0e 475 { return View(this->get_view(loc.file_offset, loc.data_size, true, true)); }
645f8123 476
cb295612
ILT
477 // Get a view into the underlying file.
478 const unsigned char*
39d0cb0e 479 get_view(off_t start, section_size_type size, bool aligned, bool cache)
cb295612 480 {
39d0cb0e
ILT
481 return this->input_file()->file().get_view(this->offset_, start, size,
482 aligned, cache);
cb295612
ILT
483 }
484
485 // Get a lasting view into the underlying file.
486 File_view*
39d0cb0e
ILT
487 get_lasting_view(off_t start, section_size_type size, bool aligned,
488 bool cache)
cb295612 489 {
39d0cb0e
ILT
490 return this->input_file()->file().get_lasting_view(this->offset_, start,
491 size, aligned, cache);
cb295612
ILT
492 }
493
494 // Read data from the underlying file.
495 void
2a00e4fb 496 read(off_t start, section_size_type size, void* p)
cb295612
ILT
497 { this->input_file()->file().read(start + this->offset_, size, p); }
498
499 // Read multiple data from the underlying file.
500 void
501 read_multiple(const File_read::Read_multiple& rm)
502 { this->input_file()->file().read_multiple(this->offset_, rm); }
503
504 // Stop caching views in the underlying file.
505 void
506 clear_view_cache_marks()
507 { this->input_file()->file().clear_view_cache_marks(); }
508
92de84a6
ILT
509 // Get the number of global symbols defined by this object, and the
510 // number of the symbols whose final definition came from this
511 // object.
512 void
513 get_global_symbol_counts(const Symbol_table* symtab, size_t* defined,
514 size_t* used) const
515 { this->do_get_global_symbol_counts(symtab, defined, used); }
516
dde3f402
ILT
517 // Get the symbols defined in this object.
518 const Symbols*
519 get_global_symbols() const
520 { return this->do_get_global_symbols(); }
521
fd9d194f
ILT
522 // Return whether this object was found in a system directory.
523 bool
524 is_in_system_directory() const
525 { return this->input_file()->is_in_system_directory(); }
526
15f8229b
ILT
527 // Return whether we found this object by searching a directory.
528 bool
529 searched_for() const
530 { return this->input_file()->will_search_for(); }
531
65514900
CC
532 bool
533 no_export() const
534 { return this->no_export_; }
535
536 void
537 set_no_export(bool value)
538 { this->no_export_ = value; }
539
a2e47362
CC
540 // Return TRUE if the section is a compressed debug section, and set
541 // *UNCOMPRESSED_SIZE to the size of the uncompressed data.
542 bool
543 section_is_compressed(unsigned int shndx,
544 section_size_type* uncompressed_size) const
545 { return this->do_section_is_compressed(shndx, uncompressed_size); }
546
09ec0418
CC
547 // Return the index of the first incremental relocation for symbol SYMNDX.
548 unsigned int
549 get_incremental_reloc_base(unsigned int symndx) const
550 { return this->do_get_incremental_reloc_base(symndx); }
551
552 // Return the number of incremental relocations for symbol SYMNDX.
553 unsigned int
554 get_incremental_reloc_count(unsigned int symndx) const
555 { return this->do_get_incremental_reloc_count(symndx); }
556
f6ce93d6 557 protected:
89fc3421
CC
558 // Returns NULL for Objects that are not plugin objects. This method
559 // is overridden in the Pluginobj class.
560 virtual Pluginobj*
561 do_pluginobj()
562 { return NULL; }
563
f6ce93d6
ILT
564 // Read the symbols--implemented by child class.
565 virtual void
566 do_read_symbols(Read_symbols_data*) = 0;
567
568 // Lay out sections--implemented by child class.
569 virtual void
7e1edb90 570 do_layout(Symbol_table*, Layout*, Read_symbols_data*) = 0;
f6ce93d6
ILT
571
572 // Add symbol information to the global symbol table--implemented by
573 // child class.
574 virtual void
f488e4b0 575 do_add_symbols(Symbol_table*, Read_symbols_data*, Layout*) = 0;
f6ce93d6 576
b0193076 577 virtual Archive::Should_include
88a4108b 578 do_should_include_member(Symbol_table* symtab, Layout*, Read_symbols_data*,
b0193076
RÁE
579 std::string* why) = 0;
580
e0c52780
CC
581 // Iterate over global symbols, calling a visitor class V for each.
582 virtual void
583 do_for_all_global_symbols(Read_symbols_data* sd,
584 Library_base::Symbol_visitor_base* v) = 0;
585
645f8123
ILT
586 // Return the location of the contents of a section. Implemented by
587 // child class.
588 virtual Location
a3ad94ed 589 do_section_contents(unsigned int shndx) = 0;
f6ce93d6 590
a445fddf
ILT
591 // Get the size of a section--implemented by child class.
592 virtual uint64_t
593 do_section_size(unsigned int shndx) = 0;
594
f6ce93d6
ILT
595 // Get the name of a section--implemented by child class.
596 virtual std::string
a3ad94ed
ILT
597 do_section_name(unsigned int shndx) = 0;
598
599 // Get section flags--implemented by child class.
600 virtual uint64_t
601 do_section_flags(unsigned int shndx) = 0;
f6ce93d6 602
ef15dade
ST
603 // Get section entsize--implemented by child class.
604 virtual uint64_t
605 do_section_entsize(unsigned int shndx) = 0;
606
88dd47ac
ILT
607 // Get section address--implemented by child class.
608 virtual uint64_t
609 do_section_address(unsigned int shndx) = 0;
610
730cdc88
ILT
611 // Get section type--implemented by child class.
612 virtual unsigned int
613 do_section_type(unsigned int shndx) = 0;
614
f7e2ee48
ILT
615 // Get section link field--implemented by child class.
616 virtual unsigned int
617 do_section_link(unsigned int shndx) = 0;
618
4c50553d
ILT
619 // Get section info field--implemented by child class.
620 virtual unsigned int
621 do_section_info(unsigned int shndx) = 0;
622
a445fddf
ILT
623 // Get section alignment--implemented by child class.
624 virtual uint64_t
625 do_section_addralign(unsigned int shndx) = 0;
626
09ec0418
CC
627 // Return the output section given a section index--implemented
628 // by child class.
629 virtual Output_section*
630 do_output_section(unsigned int) const
631 { gold_unreachable(); }
632
633 // Get the offset of a section--implemented by child class.
634 virtual uint64_t
635 do_output_section_offset(unsigned int) const
636 { gold_unreachable(); }
637
d491d34e
ILT
638 // Return the Xindex structure to use.
639 virtual Xindex*
640 do_initialize_xindex() = 0;
641
92de84a6
ILT
642 // Implement get_global_symbol_counts--implemented by child class.
643 virtual void
644 do_get_global_symbol_counts(const Symbol_table*, size_t*, size_t*) const = 0;
645
dde3f402
ILT
646 virtual const Symbols*
647 do_get_global_symbols() const = 0;
648
dbe717ef
ILT
649 // Set the number of sections.
650 void
2ea97941
ILT
651 set_shnum(int shnum)
652 { this->shnum_ = shnum; }
dbe717ef
ILT
653
654 // Functions used by both Sized_relobj and Sized_dynobj.
655
656 // Read the section data into a Read_symbols_data object.
657 template<int size, bool big_endian>
658 void
659 read_section_data(elfcpp::Elf_file<size, big_endian, Object>*,
660 Read_symbols_data*);
661
d491d34e
ILT
662 // Let the child class initialize the xindex object directly.
663 void
664 set_xindex(Xindex* xindex)
665 {
666 gold_assert(this->xindex_ == NULL);
667 this->xindex_ = xindex;
668 }
669
dbe717ef
ILT
670 // If NAME is the name of a special .gnu.warning section, arrange
671 // for the warning to be issued. SHNDX is the section index.
672 // Return whether it is a warning section.
673 bool
674 handle_gnu_warning_section(const char* name, unsigned int shndx,
675 Symbol_table*);
f6ce93d6 676
364c7fa5 677 // If NAME is the name of the special section which indicates that
9b547ce6 678 // this object was compiled with -fsplit-stack, mark it accordingly,
364c7fa5
ILT
679 // and return true. Otherwise return false.
680 bool
681 handle_split_stack_section(const char* name);
682
a2e47362
CC
683 // Return TRUE if the section is a compressed debug section, and set
684 // *UNCOMPRESSED_SIZE to the size of the uncompressed data.
685 virtual bool
686 do_section_is_compressed(unsigned int, section_size_type*) const
687 { return false; }
688
09ec0418
CC
689 // Return the index of the first incremental relocation for symbol SYMNDX--
690 // implemented by child class.
691 virtual unsigned int
692 do_get_incremental_reloc_base(unsigned int) const
693 { gold_unreachable(); }
694
695 // Return the number of incremental relocations for symbol SYMNDX--
696 // implemented by child class.
697 virtual unsigned int
698 do_get_incremental_reloc_count(unsigned int) const
699 { gold_unreachable(); }
700
f6ce93d6
ILT
701 private:
702 // This class may not be copied.
703 Object(const Object&);
704 Object& operator=(const Object&);
705
706 // Name of object as printed to user.
707 std::string name_;
708 // For reading the file.
709 Input_file* input_file_;
710 // Offset within the file--0 for an object file, non-0 for an
711 // archive.
712 off_t offset_;
dbe717ef
ILT
713 // Number of input sections.
714 unsigned int shnum_;
f6ce93d6 715 // Whether this is a dynamic object.
594c8e5e
ILT
716 bool is_dynamic_ : 1;
717 // Whether this object is needed. This is only set for dynamic
718 // objects, and means that the object defined a symbol which was
719 // used by a reference from a regular object.
720 bool is_needed_ : 1;
364c7fa5 721 // Whether this object was compiled with -fsplit-stack.
594c8e5e 722 bool uses_split_stack_ : 1;
364c7fa5
ILT
723 // Whether this object contains any functions compiled with the
724 // no_split_stack attribute.
594c8e5e 725 bool has_no_split_stack_ : 1;
65514900
CC
726 // True if exclude this object from automatic symbol export.
727 // This is used only for archive objects.
594c8e5e
ILT
728 bool no_export_ : 1;
729 // Many sections for objects with more than SHN_LORESERVE sections.
730 Xindex* xindex_;
f6ce93d6
ILT
731};
732
f6ce93d6 733// A regular object (ET_REL). This is an abstract base class itself.
b8e6aad9 734// The implementation is the template class Sized_relobj.
f6ce93d6
ILT
735
736class Relobj : public Object
737{
738 public:
2ea97941
ILT
739 Relobj(const std::string& name, Input_file* input_file, off_t offset = 0)
740 : Object(name, input_file, false, offset),
ef9beddf 741 output_sections_(),
6a74a719 742 map_to_relocatable_relocs_(NULL),
4625f782 743 object_merge_map_(NULL),
ef15dade 744 relocs_must_follow_section_writes_(false),
09ec0418
CC
745 sd_(NULL),
746 reloc_counts_(NULL),
747 reloc_bases_(NULL)
f6ce93d6
ILT
748 { }
749
6d03d481
ST
750 // During garbage collection, the Read_symbols_data pass for
751 // each object is stored as layout needs to be done after
752 // reloc processing.
753 Symbols_data*
754 get_symbols_data()
755 { return this->sd_; }
756
757 // Decides which section names have to be included in the worklist
758 // as roots.
759 bool
ca09d69a 760 is_section_name_included(const char* name);
6d03d481
ST
761
762 void
763 copy_symbols_data(Symbols_data* gc_sd, Read_symbols_data* sd,
764 unsigned int section_header_size);
765
766 void
767 set_symbols_data(Symbols_data* sd)
768 { this->sd_ = sd; }
769
770 // During garbage collection, the Read_relocs pass for all objects
771 // is done before scanning the relocs. In that case, this->rd_ is
772 // used to store the information from Read_relocs for each object.
773 // This data is also used to compute the list of relevant sections.
774 Read_relocs_data*
775 get_relocs_data()
776 { return this->rd_; }
777
778 void
779 set_relocs_data(Read_relocs_data* rd)
780 { this->rd_ = rd; }
781
782 virtual bool
783 is_output_section_offset_invalid(unsigned int shndx) const = 0;
784
92e059d8 785 // Read the relocs.
a2fb1b05 786 void
92e059d8
ILT
787 read_relocs(Read_relocs_data* rd)
788 { return this->do_read_relocs(rd); }
789
6d03d481
ST
790 // Process the relocs, during garbage collection only.
791 void
2ea97941
ILT
792 gc_process_relocs(Symbol_table* symtab, Layout* layout, Read_relocs_data* rd)
793 { return this->do_gc_process_relocs(symtab, layout, rd); }
6d03d481 794
92e059d8
ILT
795 // Scan the relocs and adjust the symbol table.
796 void
2ea97941
ILT
797 scan_relocs(Symbol_table* symtab, Layout* layout, Read_relocs_data* rd)
798 { return this->do_scan_relocs(symtab, layout, rd); }
a2fb1b05 799
6d013333
ILT
800 // The number of local symbols in the input symbol table.
801 virtual unsigned int
802 local_symbol_count() const
803 { return this->do_local_symbol_count(); }
804
7bf1f802
ILT
805 // Initial local symbol processing: count the number of local symbols
806 // in the output symbol table and dynamic symbol table; add local symbol
807 // names to *POOL and *DYNPOOL.
808 void
809 count_local_symbols(Stringpool_template<char>* pool,
810 Stringpool_template<char>* dynpool)
811 { return this->do_count_local_symbols(pool, dynpool); }
812
813 // Set the values of the local symbols, set the output symbol table
814 // indexes for the local variables, and set the offset where local
815 // symbol information will be stored. Returns the new local symbol index.
816 unsigned int
ef15dade
ST
817 finalize_local_symbols(unsigned int index, off_t off, Symbol_table* symtab)
818 { return this->do_finalize_local_symbols(index, off, symtab); }
7bf1f802
ILT
819
820 // Set the output dynamic symbol table indexes for the local variables.
c06b7b0b 821 unsigned int
7bf1f802
ILT
822 set_local_dynsym_indexes(unsigned int index)
823 { return this->do_set_local_dynsym_indexes(index); }
824
825 // Set the offset where local dynamic symbol information will be stored.
826 unsigned int
827 set_local_dynsym_offset(off_t off)
828 { return this->do_set_local_dynsym_offset(off); }
75f65a3e 829
61ba1cf9
ILT
830 // Relocate the input sections and write out the local symbols.
831 void
2ea97941
ILT
832 relocate(const Symbol_table* symtab, const Layout* layout, Output_file* of)
833 { return this->do_relocate(symtab, layout, of); }
61ba1cf9 834
a783673b
ILT
835 // Return whether an input section is being included in the link.
836 bool
5a6f7e2d 837 is_section_included(unsigned int shndx) const
a783673b 838 {
ef9beddf
ILT
839 gold_assert(shndx < this->output_sections_.size());
840 return this->output_sections_[shndx] != NULL;
a783673b
ILT
841 }
842
2b328d4e
DK
843 // The the output section of the input section with index SHNDX.
844 // This is only used currently to remove a section from the link in
845 // relaxation.
846 void
847 set_output_section(unsigned int shndx, Output_section* os)
848 {
849 gold_assert(shndx < this->output_sections_.size());
850 this->output_sections_[shndx] = os;
851 }
852
ead1e424 853 // Set the offset of an input section within its output section.
5995b570 854 void
ef9beddf
ILT
855 set_section_offset(unsigned int shndx, uint64_t off)
856 { this->do_set_section_offset(shndx, off); }
e94cf127 857
730cdc88
ILT
858 // Return true if we need to wait for output sections to be written
859 // before we can apply relocations. This is true if the object has
860 // any relocations for sections which require special handling, such
861 // as the exception frame section.
862 bool
17a1d0a9 863 relocs_must_follow_section_writes() const
730cdc88
ILT
864 { return this->relocs_must_follow_section_writes_; }
865
4625f782
ILT
866 // Return the object merge map.
867 Object_merge_map*
868 merge_map() const
869 { return this->object_merge_map_; }
870
871 // Set the object merge map.
872 void
873 set_merge_map(Object_merge_map* object_merge_map)
874 {
875 gold_assert(this->object_merge_map_ == NULL);
876 this->object_merge_map_ = object_merge_map;
877 }
878
6a74a719
ILT
879 // Record the relocatable reloc info for an input reloc section.
880 void
881 set_relocatable_relocs(unsigned int reloc_shndx, Relocatable_relocs* rr)
882 {
883 gold_assert(reloc_shndx < this->shnum());
884 (*this->map_to_relocatable_relocs_)[reloc_shndx] = rr;
885 }
886
887 // Get the relocatable reloc info for an input reloc section.
888 Relocatable_relocs*
889 relocatable_relocs(unsigned int reloc_shndx)
890 {
891 gold_assert(reloc_shndx < this->shnum());
892 return (*this->map_to_relocatable_relocs_)[reloc_shndx];
893 }
894
5995b570
CC
895 // Layout sections whose layout was deferred while waiting for
896 // input files from a plugin.
897 void
2ea97941
ILT
898 layout_deferred_sections(Layout* layout)
899 { this->do_layout_deferred_sections(layout); }
5995b570 900
09ec0418
CC
901 // Return the index of the first incremental relocation for symbol SYMNDX.
902 virtual unsigned int
903 do_get_incremental_reloc_base(unsigned int symndx) const
904 { return this->reloc_bases_[symndx]; }
905
906 // Return the number of incremental relocations for symbol SYMNDX.
907 virtual unsigned int
908 do_get_incremental_reloc_count(unsigned int symndx) const
909 { return this->reloc_counts_[symndx]; }
910
a783673b 911 protected:
ef9beddf
ILT
912 // The output section to be used for each input section, indexed by
913 // the input section number. The output section is NULL if the
914 // input section is to be discarded.
915 typedef std::vector<Output_section*> Output_sections;
e94cf127 916
92e059d8
ILT
917 // Read the relocs--implemented by child class.
918 virtual void
919 do_read_relocs(Read_relocs_data*) = 0;
920
6d03d481
ST
921 // Process the relocs--implemented by child class.
922 virtual void
ad0f2072 923 do_gc_process_relocs(Symbol_table*, Layout*, Read_relocs_data*) = 0;
6d03d481 924
92e059d8
ILT
925 // Scan the relocs--implemented by child class.
926 virtual void
ad0f2072 927 do_scan_relocs(Symbol_table*, Layout*, Read_relocs_data*) = 0;
92e059d8 928
6d013333
ILT
929 // Return the number of local symbols--implemented by child class.
930 virtual unsigned int
931 do_local_symbol_count() const = 0;
932
7bf1f802
ILT
933 // Count local symbols--implemented by child class.
934 virtual void
935 do_count_local_symbols(Stringpool_template<char>*,
6a74a719 936 Stringpool_template<char>*) = 0;
75f65a3e 937
6a74a719
ILT
938 // Finalize the local symbols. Set the output symbol table indexes
939 // for the local variables, and set the offset where local symbol
940 // information will be stored.
7bf1f802 941 virtual unsigned int
ef15dade 942 do_finalize_local_symbols(unsigned int, off_t, Symbol_table*) = 0;
7bf1f802
ILT
943
944 // Set the output dynamic symbol table indexes for the local variables.
945 virtual unsigned int
946 do_set_local_dynsym_indexes(unsigned int) = 0;
947
948 // Set the offset where local dynamic symbol information will be stored.
949 virtual unsigned int
950 do_set_local_dynsym_offset(off_t) = 0;
951
61ba1cf9
ILT
952 // Relocate the input sections and write out the local
953 // symbols--implemented by child class.
954 virtual void
ad0f2072 955 do_relocate(const Symbol_table* symtab, const Layout*, Output_file* of) = 0;
92e059d8 956
ef9beddf
ILT
957 // Set the offset of a section--implemented by child class.
958 virtual void
959 do_set_section_offset(unsigned int shndx, uint64_t off) = 0;
e94cf127 960
5995b570
CC
961 // Layout sections whose layout was deferred while waiting for
962 // input files from a plugin--implemented by child class.
963 virtual void
964 do_layout_deferred_sections(Layout*) = 0;
965
09ec0418
CC
966 // Given a section index, return the corresponding Output_section.
967 // The return value will be NULL if the section is not included in
968 // the link.
969 Output_section*
970 do_output_section(unsigned int shndx) const
971 {
972 gold_assert(shndx < this->output_sections_.size());
973 return this->output_sections_[shndx];
974 }
975
ef9beddf
ILT
976 // Return the vector mapping input sections to output sections.
977 Output_sections&
978 output_sections()
979 { return this->output_sections_; }
e94cf127 980
ef9beddf
ILT
981 const Output_sections&
982 output_sections() const
983 { return this->output_sections_; }
e94cf127 984
6a74a719
ILT
985 // Set the size of the relocatable relocs array.
986 void
987 size_relocatable_relocs()
988 {
989 this->map_to_relocatable_relocs_ =
990 new std::vector<Relocatable_relocs*>(this->shnum());
991 }
992
730cdc88
ILT
993 // Record that we must wait for the output sections to be written
994 // before applying relocations.
995 void
996 set_relocs_must_follow_section_writes()
997 { this->relocs_must_follow_section_writes_ = true; }
998
09ec0418
CC
999 // Allocate the array for counting incremental relocations.
1000 void
1001 allocate_incremental_reloc_counts()
1002 {
1003 unsigned int nsyms = this->do_get_global_symbols()->size();
1004 this->reloc_counts_ = new unsigned int[nsyms];
1005 gold_assert(this->reloc_counts_ != NULL);
1006 memset(this->reloc_counts_, 0, nsyms * sizeof(unsigned int));
1007 }
1008
1009 // Record a relocation in this object referencing global symbol SYMNDX.
1010 // Used for tracking incremental link information.
1011 void
1012 count_incremental_reloc(unsigned int symndx)
1013 {
1014 unsigned int nsyms = this->do_get_global_symbols()->size();
1015 gold_assert(symndx < nsyms);
1016 gold_assert(this->reloc_counts_ != NULL);
1017 ++this->reloc_counts_[symndx];
1018 }
1019
1020 // Finalize the incremental relocation information.
1021 void
1022 finalize_incremental_relocs(Layout* layout);
1023
1024 // Return the index of the next relocation to be written for global symbol
1025 // SYMNDX. Only valid after finalize_incremental_relocs() has been called.
1026 unsigned int
1027 next_incremental_reloc_index(unsigned int symndx)
1028 {
1029 unsigned int nsyms = this->do_get_global_symbols()->size();
1030
1031 gold_assert(this->reloc_counts_ != NULL);
1032 gold_assert(this->reloc_bases_ != NULL);
1033 gold_assert(symndx < nsyms);
1034
1035 unsigned int counter = this->reloc_counts_[symndx]++;
1036 return this->reloc_bases_[symndx] + counter;
1037 }
1038
bae7f79e 1039 private:
a2fb1b05 1040 // Mapping from input sections to output section.
ef9beddf 1041 Output_sections output_sections_;
6a74a719
ILT
1042 // Mapping from input section index to the information recorded for
1043 // the relocations. This is only used for a relocatable link.
1044 std::vector<Relocatable_relocs*>* map_to_relocatable_relocs_;
4625f782
ILT
1045 // Mappings for merge sections. This is managed by the code in the
1046 // Merge_map class.
1047 Object_merge_map* object_merge_map_;
730cdc88
ILT
1048 // Whether we need to wait for output sections to be written before
1049 // we can apply relocations.
1050 bool relocs_must_follow_section_writes_;
6d03d481
ST
1051 // Used to store the relocs data computed by the Read_relocs pass.
1052 // Used during garbage collection of unused sections.
1053 Read_relocs_data* rd_;
1054 // Used to store the symbols data computed by the Read_symbols pass.
1055 // Again used during garbage collection when laying out referenced
1056 // sections.
ca09d69a 1057 gold::Symbols_data* sd_;
09ec0418
CC
1058 // Per-symbol counts of relocations, for incremental links.
1059 unsigned int* reloc_counts_;
1060 // Per-symbol base indexes of relocations, for incremental links.
1061 unsigned int* reloc_bases_;
bae7f79e
ILT
1062};
1063
a9a60db6
ILT
1064// This class is used to handle relocations against a section symbol
1065// in an SHF_MERGE section. For such a symbol, we need to know the
1066// addend of the relocation before we can determine the final value.
1067// The addend gives us the location in the input section, and we can
1068// determine how it is mapped to the output section. For a
1069// non-section symbol, we apply the addend to the final value of the
1070// symbol; that is done in finalize_local_symbols, and does not use
1071// this class.
1072
1073template<int size>
1074class Merged_symbol_value
1075{
1076 public:
1077 typedef typename elfcpp::Elf_types<size>::Elf_Addr Value;
1078
1079 // We use a hash table to map offsets in the input section to output
1080 // addresses.
1081 typedef Unordered_map<section_offset_type, Value> Output_addresses;
1082
1083 Merged_symbol_value(Value input_value, Value output_start_address)
1084 : input_value_(input_value), output_start_address_(output_start_address),
1085 output_addresses_()
1086 { }
1087
1088 // Initialize the hash table.
1089 void
1090 initialize_input_to_output_map(const Relobj*, unsigned int input_shndx);
1091
1092 // Release the hash table to save space.
1093 void
1094 free_input_to_output_map()
1095 { this->output_addresses_.clear(); }
1096
1097 // Get the output value corresponding to an addend. The object and
1098 // input section index are passed in because the caller will have
1099 // them; otherwise we could store them here.
1100 Value
1101 value(const Relobj* object, unsigned int input_shndx, Value addend) const
1102 {
7f649c59
ILT
1103 // This is a relocation against a section symbol. ADDEND is the
1104 // offset in the section. The result should be the start of some
1105 // merge area. If the object file wants something else, it should
1106 // use a regular symbol rather than a section symbol.
1107 // Unfortunately, PR 6658 shows a case in which the object file
1108 // refers to the section symbol, but uses a negative ADDEND to
1109 // compensate for a PC relative reloc. We can't handle the
1110 // general case. However, we can handle the special case of a
1111 // negative addend, by assuming that it refers to the start of the
1112 // section. Of course, that means that we have to guess when
1113 // ADDEND is negative. It is normal to see a 32-bit value here
1114 // even when the template parameter size is 64, as 64-bit object
1115 // file formats have 32-bit relocations. We know this is a merge
1116 // section, so we know it has to fit into memory. So we assume
1117 // that we won't see a value larger than a large 32-bit unsigned
1118 // value. This will break objects with very very large merge
1119 // sections; they probably break in other ways anyhow.
1120 Value input_offset = this->input_value_;
1121 if (addend < 0xffffff00)
1122 {
1123 input_offset += addend;
1124 addend = 0;
1125 }
a9a60db6
ILT
1126 typename Output_addresses::const_iterator p =
1127 this->output_addresses_.find(input_offset);
1128 if (p != this->output_addresses_.end())
7f649c59 1129 return p->second + addend;
a9a60db6 1130
7f649c59
ILT
1131 return (this->value_from_output_section(object, input_shndx, input_offset)
1132 + addend);
a9a60db6
ILT
1133 }
1134
1135 private:
1136 // Get the output value for an input offset if we couldn't find it
1137 // in the hash table.
1138 Value
1139 value_from_output_section(const Relobj*, unsigned int input_shndx,
1140 Value input_offset) const;
1141
1142 // The value of the section symbol in the input file. This is
1143 // normally zero, but could in principle be something else.
1144 Value input_value_;
1145 // The start address of this merged section in the output file.
1146 Value output_start_address_;
1147 // A hash table which maps offsets in the input section to output
1148 // addresses. This only maps specific offsets, not all offsets.
1149 Output_addresses output_addresses_;
1150};
1151
b8e6aad9
ILT
1152// This POD class is holds the value of a symbol. This is used for
1153// local symbols, and for all symbols during relocation processing.
730cdc88
ILT
1154// For special sections, such as SHF_MERGE sections, this calls a
1155// function to get the final symbol value.
b8e6aad9
ILT
1156
1157template<int size>
1158class Symbol_value
1159{
1160 public:
1161 typedef typename elfcpp::Elf_types<size>::Elf_Addr Value;
1162
1163 Symbol_value()
7bf1f802 1164 : output_symtab_index_(0), output_dynsym_index_(-1U), input_shndx_(0),
d491d34e 1165 is_ordinary_shndx_(false), is_section_symbol_(false),
7223e9ca 1166 is_tls_symbol_(false), is_ifunc_symbol_(false), has_output_value_(true)
a9a60db6 1167 { this->u_.value = 0; }
b8e6aad9 1168
aa98ff75
DK
1169 ~Symbol_value()
1170 {
1171 if (!this->has_output_value_)
1172 delete this->u_.merged_symbol_value;
1173 }
1174
b8e6aad9
ILT
1175 // Get the value of this symbol. OBJECT is the object in which this
1176 // symbol is defined, and ADDEND is an addend to add to the value.
1177 template<bool big_endian>
1178 Value
1179 value(const Sized_relobj<size, big_endian>* object, Value addend) const
1180 {
a9a60db6
ILT
1181 if (this->has_output_value_)
1182 return this->u_.value + addend;
1183 else
d491d34e
ILT
1184 {
1185 gold_assert(this->is_ordinary_shndx_);
1186 return this->u_.merged_symbol_value->value(object, this->input_shndx_,
1187 addend);
1188 }
b8e6aad9
ILT
1189 }
1190
1191 // Set the value of this symbol in the output symbol table.
1192 void
2ea97941
ILT
1193 set_output_value(Value value)
1194 { this->u_.value = value; }
a9a60db6
ILT
1195
1196 // For a section symbol in a merged section, we need more
1197 // information.
1198 void
1199 set_merged_symbol_value(Merged_symbol_value<size>* msv)
b8e6aad9 1200 {
a9a60db6
ILT
1201 gold_assert(this->is_section_symbol_);
1202 this->has_output_value_ = false;
1203 this->u_.merged_symbol_value = msv;
b8e6aad9
ILT
1204 }
1205
a9a60db6
ILT
1206 // Initialize the input to output map for a section symbol in a
1207 // merged section. We also initialize the value of a non-section
1208 // symbol in a merged section.
b8e6aad9 1209 void
a9a60db6 1210 initialize_input_to_output_map(const Relobj* object)
b8e6aad9 1211 {
a9a60db6
ILT
1212 if (!this->has_output_value_)
1213 {
d491d34e 1214 gold_assert(this->is_section_symbol_ && this->is_ordinary_shndx_);
a9a60db6
ILT
1215 Merged_symbol_value<size>* msv = this->u_.merged_symbol_value;
1216 msv->initialize_input_to_output_map(object, this->input_shndx_);
1217 }
b8e6aad9
ILT
1218 }
1219
a9a60db6
ILT
1220 // Free the input to output map for a section symbol in a merged
1221 // section.
1222 void
1223 free_input_to_output_map()
7bf1f802 1224 {
a9a60db6
ILT
1225 if (!this->has_output_value_)
1226 this->u_.merged_symbol_value->free_input_to_output_map();
7bf1f802
ILT
1227 }
1228
a9a60db6
ILT
1229 // Set the value of the symbol from the input file. This is only
1230 // called by count_local_symbols, to communicate the value to
1231 // finalize_local_symbols.
1232 void
2ea97941
ILT
1233 set_input_value(Value value)
1234 { this->u_.value = value; }
a9a60db6
ILT
1235
1236 // Return the input value. This is only called by
e94cf127 1237 // finalize_local_symbols and (in special cases) relocate_section.
a9a60db6
ILT
1238 Value
1239 input_value() const
1240 { return this->u_.value; }
1241
d3bbad62
ILT
1242 // Return whether we have set the index in the output symbol table
1243 // yet.
1244 bool
1245 is_output_symtab_index_set() const
1246 {
1247 return (this->output_symtab_index_ != 0
1248 && this->output_symtab_index_ != -2U);
1249 }
1250
1251 // Return whether this symbol may be discarded from the normal
1252 // symbol table.
1253 bool
1254 may_be_discarded_from_output_symtab() const
1255 {
1256 gold_assert(!this->is_output_symtab_index_set());
1257 return this->output_symtab_index_ != -2U;
1258 }
1259
1260 // Return whether this symbol has an entry in the output symbol
b8e6aad9
ILT
1261 // table.
1262 bool
d3bbad62
ILT
1263 has_output_symtab_entry() const
1264 {
1265 gold_assert(this->is_output_symtab_index_set());
1266 return this->output_symtab_index_ != -1U;
1267 }
b8e6aad9
ILT
1268
1269 // Return the index in the output symbol table.
1270 unsigned int
1271 output_symtab_index() const
1272 {
d3bbad62
ILT
1273 gold_assert(this->is_output_symtab_index_set()
1274 && this->output_symtab_index_ != -1U);
b8e6aad9
ILT
1275 return this->output_symtab_index_;
1276 }
1277
1278 // Set the index in the output symbol table.
1279 void
1280 set_output_symtab_index(unsigned int i)
1281 {
d3bbad62
ILT
1282 gold_assert(!this->is_output_symtab_index_set());
1283 gold_assert(i != 0 && i != -1U && i != -2U);
b8e6aad9
ILT
1284 this->output_symtab_index_ = i;
1285 }
1286
1287 // Record that this symbol should not go into the output symbol
1288 // table.
1289 void
1290 set_no_output_symtab_entry()
1291 {
1292 gold_assert(this->output_symtab_index_ == 0);
1293 this->output_symtab_index_ = -1U;
1294 }
1295
d3bbad62
ILT
1296 // Record that this symbol must go into the output symbol table,
1297 // because it there is a relocation that uses it.
1298 void
1299 set_must_have_output_symtab_entry()
1300 {
1301 gold_assert(!this->is_output_symtab_index_set());
1302 this->output_symtab_index_ = -2U;
1303 }
1304
7bf1f802
ILT
1305 // Set the index in the output dynamic symbol table.
1306 void
1307 set_needs_output_dynsym_entry()
1308 {
dceae3c1 1309 gold_assert(!this->is_section_symbol());
7bf1f802
ILT
1310 this->output_dynsym_index_ = 0;
1311 }
1312
d3bbad62 1313 // Return whether this symbol should go into the dynamic symbol
7bf1f802
ILT
1314 // table.
1315 bool
1316 needs_output_dynsym_entry() const
1317 {
1318 return this->output_dynsym_index_ != -1U;
1319 }
1320
d3bbad62
ILT
1321 // Return whether this symbol has an entry in the dynamic symbol
1322 // table.
1323 bool
1324 has_output_dynsym_entry() const
1325 {
1326 gold_assert(this->output_dynsym_index_ != 0);
1327 return this->output_dynsym_index_ != -1U;
1328 }
1329
7bf1f802
ILT
1330 // Record that this symbol should go into the dynamic symbol table.
1331 void
1332 set_output_dynsym_index(unsigned int i)
1333 {
1334 gold_assert(this->output_dynsym_index_ == 0);
d3bbad62 1335 gold_assert(i != 0 && i != -1U);
7bf1f802
ILT
1336 this->output_dynsym_index_ = i;
1337 }
1338
1339 // Return the index in the output dynamic symbol table.
1340 unsigned int
1341 output_dynsym_index() const
1342 {
dceae3c1
ILT
1343 gold_assert(this->output_dynsym_index_ != 0
1344 && this->output_dynsym_index_ != -1U);
7bf1f802
ILT
1345 return this->output_dynsym_index_;
1346 }
1347
b8e6aad9
ILT
1348 // Set the index of the input section in the input file.
1349 void
d491d34e 1350 set_input_shndx(unsigned int i, bool is_ordinary)
730cdc88
ILT
1351 {
1352 this->input_shndx_ = i;
ac1f0c21
ILT
1353 // input_shndx_ field is a bitfield, so make sure that the value
1354 // fits.
730cdc88 1355 gold_assert(this->input_shndx_ == i);
d491d34e 1356 this->is_ordinary_shndx_ = is_ordinary;
730cdc88 1357 }
b8e6aad9 1358
7bf1f802
ILT
1359 // Return the index of the input section in the input file.
1360 unsigned int
d491d34e
ILT
1361 input_shndx(bool* is_ordinary) const
1362 {
1363 *is_ordinary = this->is_ordinary_shndx_;
1364 return this->input_shndx_;
1365 }
7bf1f802 1366
a9a60db6
ILT
1367 // Whether this is a section symbol.
1368 bool
1369 is_section_symbol() const
1370 { return this->is_section_symbol_; }
1371
063f12a8
ILT
1372 // Record that this is a section symbol.
1373 void
1374 set_is_section_symbol()
dceae3c1
ILT
1375 {
1376 gold_assert(!this->needs_output_dynsym_entry());
1377 this->is_section_symbol_ = true;
1378 }
063f12a8 1379
7bf1f802
ILT
1380 // Record that this is a TLS symbol.
1381 void
1382 set_is_tls_symbol()
1383 { this->is_tls_symbol_ = true; }
1384
7223e9ca 1385 // Return true if this is a TLS symbol.
7bf1f802
ILT
1386 bool
1387 is_tls_symbol() const
1388 { return this->is_tls_symbol_; }
1389
7223e9ca
ILT
1390 // Record that this is an IFUNC symbol.
1391 void
1392 set_is_ifunc_symbol()
1393 { this->is_ifunc_symbol_ = true; }
1394
1395 // Return true if this is an IFUNC symbol.
1396 bool
1397 is_ifunc_symbol() const
1398 { return this->is_ifunc_symbol_; }
1399
aa98ff75
DK
1400 // Return true if this has output value.
1401 bool
1402 has_output_value() const
1403 { return this->has_output_value_; }
1404
b8e6aad9
ILT
1405 private:
1406 // The index of this local symbol in the output symbol table. This
d3bbad62
ILT
1407 // will be 0 if no value has been assigned yet, and the symbol may
1408 // be omitted. This will be -1U if the symbol should not go into
1409 // the symbol table. This will be -2U if the symbol must go into
1410 // the symbol table, but no index has been assigned yet.
b8e6aad9 1411 unsigned int output_symtab_index_;
7bf1f802 1412 // The index of this local symbol in the dynamic symbol table. This
d3bbad62 1413 // will be -1U if the symbol should not go into the symbol table.
7bf1f802 1414 unsigned int output_dynsym_index_;
b8e6aad9
ILT
1415 // The section index in the input file in which this symbol is
1416 // defined.
7223e9ca 1417 unsigned int input_shndx_ : 27;
d491d34e
ILT
1418 // Whether the section index is an ordinary index, not a special
1419 // value.
1420 bool is_ordinary_shndx_ : 1;
063f12a8
ILT
1421 // Whether this is a STT_SECTION symbol.
1422 bool is_section_symbol_ : 1;
7bf1f802
ILT
1423 // Whether this is a STT_TLS symbol.
1424 bool is_tls_symbol_ : 1;
7223e9ca
ILT
1425 // Whether this is a STT_GNU_IFUNC symbol.
1426 bool is_ifunc_symbol_ : 1;
a9a60db6
ILT
1427 // Whether this symbol has a value for the output file. This is
1428 // normally set to true during Layout::finalize, by
1429 // finalize_local_symbols. It will be false for a section symbol in
1430 // a merge section, as for such symbols we can not determine the
1431 // value to use in a relocation until we see the addend.
1432 bool has_output_value_ : 1;
1433 union
1434 {
1435 // This is used if has_output_value_ is true. Between
1436 // count_local_symbols and finalize_local_symbols, this is the
1437 // value in the input file. After finalize_local_symbols, it is
1438 // the value in the output file.
1439 Value value;
1440 // This is used if has_output_value_ is false. It points to the
1441 // information we need to get the value for a merge section.
1442 Merged_symbol_value<size>* merged_symbol_value;
1443 } u_;
b8e6aad9
ILT
1444};
1445
0a65a3a7
CC
1446// A GOT offset list. A symbol may have more than one GOT offset
1447// (e.g., when mixing modules compiled with two different TLS models),
1448// but will usually have at most one. GOT_TYPE identifies the type of
1449// GOT entry; its values are specific to each target.
1450
1451class Got_offset_list
1452{
1453 public:
1454 Got_offset_list()
1455 : got_type_(-1U), got_offset_(0), got_next_(NULL)
1456 { }
1457
1458 Got_offset_list(unsigned int got_type, unsigned int got_offset)
1459 : got_type_(got_type), got_offset_(got_offset), got_next_(NULL)
1460 { }
1461
1462 ~Got_offset_list()
1463 {
1464 if (this->got_next_ != NULL)
1465 {
1466 delete this->got_next_;
1467 this->got_next_ = NULL;
1468 }
1469 }
1470
1471 // Initialize the fields to their default values.
1472 void
1473 init()
1474 {
1475 this->got_type_ = -1U;
1476 this->got_offset_ = 0;
1477 this->got_next_ = NULL;
1478 }
1479
1480 // Set the offset for the GOT entry of type GOT_TYPE.
1481 void
1482 set_offset(unsigned int got_type, unsigned int got_offset)
1483 {
1484 if (this->got_type_ == -1U)
1485 {
1486 this->got_type_ = got_type;
1487 this->got_offset_ = got_offset;
1488 }
1489 else
1490 {
1491 for (Got_offset_list* g = this; g != NULL; g = g->got_next_)
1492 {
1493 if (g->got_type_ == got_type)
1494 {
1495 g->got_offset_ = got_offset;
1496 return;
1497 }
1498 }
1499 Got_offset_list* g = new Got_offset_list(got_type, got_offset);
1500 g->got_next_ = this->got_next_;
1501 this->got_next_ = g;
1502 }
1503 }
1504
1505 // Return the offset for a GOT entry of type GOT_TYPE.
1506 unsigned int
1507 get_offset(unsigned int got_type) const
1508 {
1509 for (const Got_offset_list* g = this; g != NULL; g = g->got_next_)
1510 {
1511 if (g->got_type_ == got_type)
1512 return g->got_offset_;
1513 }
1514 return -1U;
1515 }
1516
0e70b911
CC
1517 // Return a pointer to the list, or NULL if the list is empty.
1518 const Got_offset_list*
1519 get_list() const
1520 {
1521 if (this->got_type_ == -1U)
1522 return NULL;
1523 return this;
1524 }
1525
1526 // Loop over all GOT offset entries, applying the function F to each.
1527 template<typename F>
1528 void
1529 for_all_got_offsets(F f) const
1530 {
1531 if (this->got_type_ == -1U)
1532 return;
1533 for (const Got_offset_list* g = this; g != NULL; g = g->got_next_)
1534 f(g->got_type_, g->got_offset_);
1535 }
1536
0a65a3a7
CC
1537 private:
1538 unsigned int got_type_;
1539 unsigned int got_offset_;
1540 Got_offset_list* got_next_;
1541};
1542
364c7fa5
ILT
1543// This type is used to modify relocations for -fsplit-stack. It is
1544// indexed by relocation index, and means that the relocation at that
1545// index should use the symbol from the vector, rather than the one
1546// indicated by the relocation.
1547
1548class Reloc_symbol_changes
1549{
1550 public:
1551 Reloc_symbol_changes(size_t count)
1552 : vec_(count, NULL)
1553 { }
1554
1555 void
1556 set(size_t i, Symbol* sym)
1557 { this->vec_[i] = sym; }
1558
1559 const Symbol*
1560 operator[](size_t i) const
1561 { return this->vec_[i]; }
1562
1563 private:
1564 std::vector<Symbol*> vec_;
1565};
1566
a2e47362
CC
1567// Type for mapping section index to uncompressed size.
1568
1569typedef std::map<unsigned int, section_size_type> Compressed_section_map;
1570
14bfc3f5 1571// A regular object file. This is size and endian specific.
bae7f79e
ILT
1572
1573template<int size, bool big_endian>
f6ce93d6 1574class Sized_relobj : public Relobj
bae7f79e
ILT
1575{
1576 public:
c06b7b0b 1577 typedef typename elfcpp::Elf_types<size>::Elf_Addr Address;
730cdc88 1578 typedef std::vector<Symbol*> Symbols;
b8e6aad9 1579 typedef std::vector<Symbol_value<size> > Local_values;
c06b7b0b 1580
eff45813
CC
1581 static const Address invalid_address = static_cast<Address>(0) - 1;
1582
aa98ff75
DK
1583 enum Compute_final_local_value_status
1584 {
1585 // No error.
1586 CFLV_OK,
1587 // An error occurred.
1588 CFLV_ERROR,
1589 // The local symbol has no output section.
1590 CFLV_DISCARDED
1591 };
1592
f6ce93d6 1593 Sized_relobj(const std::string& name, Input_file* input_file, off_t offset,
bae7f79e
ILT
1594 const typename elfcpp::Ehdr<size, big_endian>&);
1595
f6ce93d6 1596 ~Sized_relobj();
bae7f79e 1597
6d03d481
ST
1598 // Checks if the offset of input section SHNDX within its output
1599 // section is invalid.
1600 bool
1601 is_output_section_offset_invalid(unsigned int shndx) const
1602 { return this->get_output_section_offset(shndx) == invalid_address; }
1603
f733487b 1604 // Set up the object file based on TARGET.
bae7f79e 1605 void
c0a62865
DK
1606 setup()
1607 { this->do_setup(); }
bae7f79e 1608
7d9e3d98
ILT
1609 // Return the number of symbols. This is only valid after
1610 // Object::add_symbols has been called.
1611 unsigned int
1612 symbol_count() const
1613 { return this->local_symbol_count_ + this->symbols_.size(); }
1614
730cdc88
ILT
1615 // If SYM is the index of a global symbol in the object file's
1616 // symbol table, return the Symbol object. Otherwise, return NULL.
1617 Symbol*
1618 global_symbol(unsigned int sym) const
1619 {
1620 if (sym >= this->local_symbol_count_)
1621 {
1622 gold_assert(sym - this->local_symbol_count_ < this->symbols_.size());
1623 return this->symbols_[sym - this->local_symbol_count_];
1624 }
1625 return NULL;
1626 }
1627
1628 // Return the section index of symbol SYM. Set *VALUE to its value
d491d34e
ILT
1629 // in the object file. Set *IS_ORDINARY if this is an ordinary
1630 // section index, not a special code between SHN_LORESERVE and
1631 // SHN_HIRESERVE. Note that for a symbol which is not defined in
1632 // this object file, this will set *VALUE to 0 and return SHN_UNDEF;
1633 // it will not return the final value of the symbol in the link.
730cdc88 1634 unsigned int
d491d34e 1635 symbol_section_and_value(unsigned int sym, Address* value, bool* is_ordinary);
730cdc88
ILT
1636
1637 // Return a pointer to the Symbol_value structure which holds the
1638 // value of a local symbol.
1639 const Symbol_value<size>*
1640 local_symbol(unsigned int sym) const
1641 {
1642 gold_assert(sym < this->local_values_.size());
1643 return &this->local_values_[sym];
1644 }
1645
c06b7b0b
ILT
1646 // Return the index of local symbol SYM in the ordinary symbol
1647 // table. A value of -1U means that the symbol is not being output.
1648 unsigned int
1649 symtab_index(unsigned int sym) const
1650 {
b8e6aad9
ILT
1651 gold_assert(sym < this->local_values_.size());
1652 return this->local_values_[sym].output_symtab_index();
c06b7b0b
ILT
1653 }
1654
7bf1f802
ILT
1655 // Return the index of local symbol SYM in the dynamic symbol
1656 // table. A value of -1U means that the symbol is not being output.
1657 unsigned int
1658 dynsym_index(unsigned int sym) const
1659 {
1660 gold_assert(sym < this->local_values_.size());
1661 return this->local_values_[sym].output_dynsym_index();
1662 }
1663
6a74a719
ILT
1664 // Return the input section index of local symbol SYM.
1665 unsigned int
d491d34e 1666 local_symbol_input_shndx(unsigned int sym, bool* is_ordinary) const
6a74a719
ILT
1667 {
1668 gold_assert(sym < this->local_values_.size());
d491d34e 1669 return this->local_values_[sym].input_shndx(is_ordinary);
6a74a719
ILT
1670 }
1671
d3bbad62
ILT
1672 // Record that local symbol SYM must be in the output symbol table.
1673 void
1674 set_must_have_output_symtab_entry(unsigned int sym)
1675 {
1676 gold_assert(sym < this->local_values_.size());
1677 this->local_values_[sym].set_must_have_output_symtab_entry();
1678 }
1679
d1f003c6 1680 // Record that local symbol SYM needs a dynamic symbol entry.
7bf1f802
ILT
1681 void
1682 set_needs_output_dynsym_entry(unsigned int sym)
1683 {
1684 gold_assert(sym < this->local_values_.size());
1685 this->local_values_[sym].set_needs_output_dynsym_entry();
1686 }
1687
e727fa71 1688 // Return whether the local symbol SYMNDX has a GOT offset.
07f397ab 1689 // For TLS symbols, the GOT entry will hold its tp-relative offset.
e727fa71 1690 bool
0a65a3a7 1691 local_has_got_offset(unsigned int symndx, unsigned int got_type) const
e727fa71 1692 {
0a65a3a7
CC
1693 Local_got_offsets::const_iterator p =
1694 this->local_got_offsets_.find(symndx);
1695 return (p != this->local_got_offsets_.end()
1696 && p->second->get_offset(got_type) != -1U);
e727fa71
ILT
1697 }
1698
1699 // Return the GOT offset of the local symbol SYMNDX.
1700 unsigned int
0a65a3a7 1701 local_got_offset(unsigned int symndx, unsigned int got_type) const
e727fa71
ILT
1702 {
1703 Local_got_offsets::const_iterator p =
1704 this->local_got_offsets_.find(symndx);
1705 gold_assert(p != this->local_got_offsets_.end());
0a65a3a7
CC
1706 unsigned int off = p->second->get_offset(got_type);
1707 gold_assert(off != -1U);
1708 return off;
e727fa71
ILT
1709 }
1710
1711 // Set the GOT offset of the local symbol SYMNDX to GOT_OFFSET.
1712 void
0a65a3a7
CC
1713 set_local_got_offset(unsigned int symndx, unsigned int got_type,
1714 unsigned int got_offset)
07f397ab 1715 {
0a65a3a7
CC
1716 Local_got_offsets::const_iterator p =
1717 this->local_got_offsets_.find(symndx);
1718 if (p != this->local_got_offsets_.end())
1719 p->second->set_offset(got_type, got_offset);
07f397ab
ILT
1720 else
1721 {
0a65a3a7
CC
1722 Got_offset_list* g = new Got_offset_list(got_type, got_offset);
1723 std::pair<Local_got_offsets::iterator, bool> ins =
1724 this->local_got_offsets_.insert(std::make_pair(symndx, g));
07f397ab
ILT
1725 gold_assert(ins.second);
1726 }
1727 }
1728
0e70b911
CC
1729 // Return the GOT offset list for the local symbol SYMNDX.
1730 const Got_offset_list*
1731 local_got_offset_list(unsigned int symndx) const
1732 {
1733 Local_got_offsets::const_iterator p =
1734 this->local_got_offsets_.find(symndx);
1735 if (p == this->local_got_offsets_.end())
1736 return NULL;
1737 return p->second;
1738 }
1739
7223e9ca
ILT
1740 // Return whether the local symbol SYMNDX has a PLT offset.
1741 bool
1742 local_has_plt_offset(unsigned int symndx) const;
1743
1744 // Return the PLT offset for a local symbol. It is an error to call
1745 // this if it doesn't have one.
1746 unsigned int
1747 local_plt_offset(unsigned int symndx) const;
1748
1749 // Set the PLT offset of the local symbol SYMNDX.
1750 void
1751 set_local_plt_offset(unsigned int symndx, unsigned int plt_offset);
1752
ef9beddf
ILT
1753 // Get the offset of input section SHNDX within its output section.
1754 // This is -1 if the input section requires a special mapping, such
1755 // as a merge section. The output section can be found in the
1756 // output_sections_ field of the parent class Relobj.
1757 Address
1758 get_output_section_offset(unsigned int shndx) const
1759 {
1760 gold_assert(shndx < this->section_offsets_.size());
1761 return this->section_offsets_[shndx];
1762 }
1763
f7e2ee48
ILT
1764 // Return the name of the symbol that spans the given offset in the
1765 // specified section in this object. This is used only for error
1766 // messages and is not particularly efficient.
1767 bool
1768 get_symbol_location_info(unsigned int shndx, off_t offset,
1769 Symbol_location_info* info);
1770
e94cf127
CC
1771 // Look for a kept section corresponding to the given discarded section,
1772 // and return its output address. This is used only for relocations in
1773 // debugging sections.
1774 Address
1775 map_to_kept_section(unsigned int shndx, bool* found) const;
1776
aa98ff75
DK
1777 // Compute final local symbol value. R_SYM is the local symbol index.
1778 // LV_IN points to a local symbol value containing the input value.
1779 // LV_OUT points to a local symbol value storing the final output value,
1780 // which must not be a merged symbol value since before calling this
1781 // method to avoid memory leak. SYMTAB points to a symbol table.
1782 //
1783 // The method returns a status code at return. If the return status is
1784 // CFLV_OK, *LV_OUT contains the final value. If the return status is
1785 // CFLV_ERROR, *LV_OUT is 0. If the return status is CFLV_DISCARDED,
1786 // *LV_OUT is not modified.
1787 Compute_final_local_value_status
1788 compute_final_local_value(unsigned int r_sym,
1789 const Symbol_value<size>* lv_in,
1790 Symbol_value<size>* lv_out,
1791 const Symbol_table* symtab);
1792
6d013333 1793 protected:
c0a62865
DK
1794 // Set up.
1795 virtual void
1796 do_setup();
1797
a2fb1b05 1798 // Read the symbols.
bae7f79e 1799 void
12e14209 1800 do_read_symbols(Read_symbols_data*);
14bfc3f5 1801
6d013333
ILT
1802 // Return the number of local symbols.
1803 unsigned int
1804 do_local_symbol_count() const
1805 { return this->local_symbol_count_; }
1806
dbe717ef
ILT
1807 // Lay out the input sections.
1808 void
7e1edb90 1809 do_layout(Symbol_table*, Layout*, Read_symbols_data*);
dbe717ef 1810
5995b570
CC
1811 // Layout sections whose layout was deferred while waiting for
1812 // input files from a plugin.
1813 void
1814 do_layout_deferred_sections(Layout*);
1815
12e14209
ILT
1816 // Add the symbols to the symbol table.
1817 void
f488e4b0 1818 do_add_symbols(Symbol_table*, Read_symbols_data*, Layout*);
b0193076
RÁE
1819
1820 Archive::Should_include
88a4108b 1821 do_should_include_member(Symbol_table* symtab, Layout*, Read_symbols_data*,
b0193076 1822 std::string* why);
a2fb1b05 1823
e0c52780
CC
1824 // Iterate over global symbols, calling a visitor class V for each.
1825 void
1826 do_for_all_global_symbols(Read_symbols_data* sd,
1827 Library_base::Symbol_visitor_base* v);
1828
92e059d8
ILT
1829 // Read the relocs.
1830 void
1831 do_read_relocs(Read_relocs_data*);
1832
6d03d481
ST
1833 // Process the relocs to find list of referenced sections. Used only
1834 // during garbage collection.
1835 void
ad0f2072 1836 do_gc_process_relocs(Symbol_table*, Layout*, Read_relocs_data*);
6d03d481 1837
92e059d8
ILT
1838 // Scan the relocs and adjust the symbol table.
1839 void
ad0f2072 1840 do_scan_relocs(Symbol_table*, Layout*, Read_relocs_data*);
92e059d8 1841
7bf1f802
ILT
1842 // Count the local symbols.
1843 void
1844 do_count_local_symbols(Stringpool_template<char>*,
1845 Stringpool_template<char>*);
1846
75f65a3e 1847 // Finalize the local symbols.
c06b7b0b 1848 unsigned int
ef15dade 1849 do_finalize_local_symbols(unsigned int, off_t, Symbol_table*);
7bf1f802
ILT
1850
1851 // Set the offset where local dynamic symbol information will be stored.
1852 unsigned int
1853 do_set_local_dynsym_indexes(unsigned int);
1854
1855 // Set the offset where local dynamic symbol information will be stored.
1856 unsigned int
1857 do_set_local_dynsym_offset(off_t);
75f65a3e 1858
61ba1cf9
ILT
1859 // Relocate the input sections and write out the local symbols.
1860 void
ad0f2072 1861 do_relocate(const Symbol_table* symtab, const Layout*, Output_file* of);
92e059d8 1862
a445fddf
ILT
1863 // Get the size of a section.
1864 uint64_t
1865 do_section_size(unsigned int shndx)
1866 { return this->elf_file_.section_size(shndx); }
1867
92e059d8
ILT
1868 // Get the name of a section.
1869 std::string
645f8123
ILT
1870 do_section_name(unsigned int shndx)
1871 { return this->elf_file_.section_name(shndx); }
61ba1cf9 1872
645f8123 1873 // Return the location of the contents of a section.
dbe717ef 1874 Object::Location
645f8123
ILT
1875 do_section_contents(unsigned int shndx)
1876 { return this->elf_file_.section_contents(shndx); }
f6ce93d6 1877
a3ad94ed
ILT
1878 // Return section flags.
1879 uint64_t
ef15dade
ST
1880 do_section_flags(unsigned int shndx);
1881
1882 // Return section entsize.
1883 uint64_t
1884 do_section_entsize(unsigned int shndx);
a3ad94ed 1885
88dd47ac
ILT
1886 // Return section address.
1887 uint64_t
1888 do_section_address(unsigned int shndx)
1889 { return this->elf_file_.section_addr(shndx); }
1890
730cdc88
ILT
1891 // Return section type.
1892 unsigned int
1893 do_section_type(unsigned int shndx)
1894 { return this->elf_file_.section_type(shndx); }
1895
f7e2ee48
ILT
1896 // Return the section link field.
1897 unsigned int
1898 do_section_link(unsigned int shndx)
1899 { return this->elf_file_.section_link(shndx); }
1900
4c50553d
ILT
1901 // Return the section info field.
1902 unsigned int
1903 do_section_info(unsigned int shndx)
1904 { return this->elf_file_.section_info(shndx); }
1905
a445fddf
ILT
1906 // Return the section alignment.
1907 uint64_t
1908 do_section_addralign(unsigned int shndx)
1909 { return this->elf_file_.section_addralign(shndx); }
1910
d491d34e
ILT
1911 // Return the Xindex structure to use.
1912 Xindex*
1913 do_initialize_xindex();
1914
92de84a6
ILT
1915 // Get symbol counts.
1916 void
1917 do_get_global_symbol_counts(const Symbol_table*, size_t*, size_t*) const;
1918
dde3f402
ILT
1919 // Get the global symbols.
1920 const Symbols*
1921 do_get_global_symbols() const
1922 { return &this->symbols_; }
1923
ef9beddf
ILT
1924 // Get the offset of a section.
1925 uint64_t
1926 do_output_section_offset(unsigned int shndx) const
eff45813
CC
1927 {
1928 Address off = this->get_output_section_offset(shndx);
1929 if (off == invalid_address)
1930 return -1ULL;
1931 return off;
1932 }
ef9beddf
ILT
1933
1934 // Set the offset of a section.
1935 void
1936 do_set_section_offset(unsigned int shndx, uint64_t off)
1937 {
1938 gold_assert(shndx < this->section_offsets_.size());
2b328d4e
DK
1939 this->section_offsets_[shndx] =
1940 (off == static_cast<uint64_t>(-1)
1941 ? invalid_address
1942 : convert_types<Address, uint64_t>(off));
c0a62865
DK
1943 }
1944
1945 // Adjust a section index if necessary.
1946 unsigned int
1947 adjust_shndx(unsigned int shndx)
1948 {
1949 if (shndx >= elfcpp::SHN_LORESERVE)
1950 shndx += this->elf_file_.large_shndx_offset();
1951 return shndx;
1952 }
1953
1954 // Initialize input to output maps for section symbols in merged
1955 // sections.
1956 void
1957 initialize_input_to_output_maps();
1958
1959 // Free the input to output maps for section symbols in merged
1960 // sections.
1961 void
1962 free_input_to_output_maps();
1963
1964 // Return symbol table section index.
1965 unsigned int
1966 symtab_shndx() const
1967 { return this->symtab_shndx_; }
1968
1969 // Allow a child class to access the ELF file.
1970 elfcpp::Elf_file<size, big_endian, Object>*
1971 elf_file()
1972 { return &this->elf_file_; }
1973
1974 // Allow a child class to access the local values.
1975 Local_values*
1976 local_values()
1977 { return &this->local_values_; }
1978
72adc4fa
DK
1979 // Views and sizes when relocating.
1980 struct View_size
1981 {
1982 unsigned char* view;
1983 typename elfcpp::Elf_types<size>::Elf_Addr address;
1984 off_t offset;
1985 section_size_type view_size;
1986 bool is_input_output_view;
1987 bool is_postprocessing_view;
1988 };
1989
1990 typedef std::vector<View_size> Views;
1991
1992 // This may be overriden by a child class.
1993 virtual void
ad0f2072 1994 do_relocate_sections(const Symbol_table* symtab, const Layout* layout,
09ec0418
CC
1995 const unsigned char* pshdrs, Output_file* of,
1996 Views* pviews);
72adc4fa 1997
e7eca48c
DK
1998 // Allow a child to set output local symbol count.
1999 void
2000 set_output_local_symbol_count(unsigned int value)
2001 { this->output_local_symbol_count_ = value; }
a2e47362
CC
2002
2003 // Return TRUE if the section is a compressed debug section, and set
2004 // *UNCOMPRESSED_SIZE to the size of the uncompressed data.
2005 bool
2006 do_section_is_compressed(unsigned int shndx,
2007 section_size_type* uncompressed_size) const
2008 {
2009 if (this->compressed_sections_ == NULL)
2010 return false;
2011 Compressed_section_map::const_iterator p =
2012 this->compressed_sections_->find(shndx);
2013 if (p != this->compressed_sections_->end())
2014 {
2015 if (uncompressed_size != NULL)
2016 *uncompressed_size = p->second;
2017 return true;
2018 }
2019 return false;
2020 }
2021
bae7f79e 2022 private:
a2fb1b05 2023 // For convenience.
f6ce93d6 2024 typedef Sized_relobj<size, big_endian> This;
a2fb1b05
ILT
2025 static const int ehdr_size = elfcpp::Elf_sizes<size>::ehdr_size;
2026 static const int shdr_size = elfcpp::Elf_sizes<size>::shdr_size;
2027 static const int sym_size = elfcpp::Elf_sizes<size>::sym_size;
75f65a3e
ILT
2028 typedef elfcpp::Shdr<size, big_endian> Shdr;
2029
ef9beddf
ILT
2030 // To keep track of discarded comdat sections, we need to map a member
2031 // section index to the object and section index of the corresponding
2032 // kept section.
2033 struct Kept_comdat_section
2034 {
1ef4d87f
ILT
2035 Kept_comdat_section(Relobj* a_object, unsigned int a_shndx)
2036 : object(a_object), shndx(a_shndx)
ef9beddf 2037 { }
1ef4d87f
ILT
2038 Relobj* object;
2039 unsigned int shndx;
ef9beddf 2040 };
1ef4d87f 2041 typedef std::map<unsigned int, Kept_comdat_section>
ef9beddf
ILT
2042 Kept_comdat_section_table;
2043
dbe717ef
ILT
2044 // Find the SHT_SYMTAB section, given the section headers.
2045 void
2046 find_symtab(const unsigned char* pshdrs);
2047
730cdc88
ILT
2048 // Return whether SHDR has the right flags for a GNU style exception
2049 // frame section.
2050 bool
2051 check_eh_frame_flags(const elfcpp::Shdr<size, big_endian>* shdr) const;
2052
2053 // Return whether there is a section named .eh_frame which might be
2054 // a GNU style exception frame section.
2055 bool
2056 find_eh_frame(const unsigned char* pshdrs, const char* names,
8383303e 2057 section_size_type names_size) const;
730cdc88 2058
a2fb1b05
ILT
2059 // Whether to include a section group in the link.
2060 bool
6a74a719 2061 include_section_group(Symbol_table*, Layout*, unsigned int, const char*,
ca09d69a 2062 const unsigned char*, const char*, section_size_type,
a2fb1b05
ILT
2063 std::vector<bool>*);
2064
2065 // Whether to include a linkonce section in the link.
2066 bool
e94cf127 2067 include_linkonce_section(Layout*, unsigned int, const char*,
a2fb1b05
ILT
2068 const elfcpp::Shdr<size, big_endian>&);
2069
5995b570
CC
2070 // Layout an input section.
2071 void
2072 layout_section(Layout* layout, unsigned int shndx, const char* name,
2073 typename This::Shdr& shdr, unsigned int reloc_shndx,
2074 unsigned int reloc_type);
2075
61ba1cf9
ILT
2076 // Write section data to the output file. Record the views and
2077 // sizes in VIEWS for use when relocating.
2078 void
cb295612 2079 write_sections(const unsigned char* pshdrs, Output_file*, Views*);
61ba1cf9
ILT
2080
2081 // Relocate the sections in the output file.
2082 void
2ea97941 2083 relocate_sections(const Symbol_table* symtab, const Layout* layout,
09ec0418
CC
2084 const unsigned char* pshdrs, Output_file* of,
2085 Views* pviews)
2086 { this->do_relocate_sections(symtab, layout, pshdrs, of, pviews); }
61ba1cf9 2087
7019cd25
ILT
2088 // Scan the input relocations for --emit-relocs.
2089 void
ad0f2072 2090 emit_relocs_scan(Symbol_table*, Layout*, const unsigned char* plocal_syms,
7019cd25
ILT
2091 const Read_relocs_data::Relocs_list::iterator&);
2092
2093 // Scan the input relocations for --emit-relocs, templatized on the
2094 // type of the relocation section.
2095 template<int sh_type>
2096 void
ad0f2072 2097 emit_relocs_scan_reltype(Symbol_table*, Layout*,
7019cd25
ILT
2098 const unsigned char* plocal_syms,
2099 const Read_relocs_data::Relocs_list::iterator&,
2100 Relocatable_relocs*);
2101
2102 // Emit the relocs for --emit-relocs.
2103 void
2104 emit_relocs(const Relocate_info<size, big_endian>*, unsigned int,
2105 unsigned int sh_type, const unsigned char* prelocs,
ef9beddf 2106 size_t reloc_count, Output_section*, Address output_offset,
7019cd25
ILT
2107 unsigned char* view, Address address,
2108 section_size_type view_size,
2109 unsigned char* reloc_view, section_size_type reloc_view_size);
2110
2111 // Emit the relocs for --emit-relocs, templatized on the type of the
2112 // relocation section.
2113 template<int sh_type>
2114 void
2115 emit_relocs_reltype(const Relocate_info<size, big_endian>*, unsigned int,
2116 const unsigned char* prelocs, size_t reloc_count,
ef9beddf 2117 Output_section*, Address output_offset,
7019cd25
ILT
2118 unsigned char* view, Address address,
2119 section_size_type view_size,
2120 unsigned char* reloc_view,
2121 section_size_type reloc_view_size);
2122
09ec0418
CC
2123 // Scan the input relocations for --incremental.
2124 void
2125 incremental_relocs_scan(const Read_relocs_data::Relocs_list::iterator&);
2126
2127 // Scan the input relocations for --incremental, templatized on the
2128 // type of the relocation section.
2129 template<int sh_type>
2130 void
2131 incremental_relocs_scan_reltype(
2132 const Read_relocs_data::Relocs_list::iterator&);
2133
2134 void
2135 incremental_relocs_write(const Relocate_info<size, big_endian>*,
2136 unsigned int sh_type,
2137 const unsigned char* prelocs,
2138 size_t reloc_count,
2139 Output_section*,
2140 Address output_offset,
2141 Output_file*);
2142
2143 template<int sh_type>
2144 void
2145 incremental_relocs_write_reltype(const Relocate_info<size, big_endian>*,
2146 const unsigned char* prelocs,
2147 size_t reloc_count,
2148 Output_section*,
2149 Address output_offset,
2150 Output_file*);
2151
364c7fa5
ILT
2152 // A type shared by split_stack_adjust_reltype and find_functions.
2153 typedef std::map<section_offset_type, section_size_type> Function_offsets;
2154
2155 // Check for -fsplit-stack routines calling non-split-stack routines.
2156 void
2157 split_stack_adjust(const Symbol_table*, const unsigned char* pshdrs,
2158 unsigned int sh_type, unsigned int shndx,
2159 const unsigned char* prelocs, size_t reloc_count,
2160 unsigned char* view, section_size_type view_size,
2161 Reloc_symbol_changes** reloc_map);
2162
2163 template<int sh_type>
2164 void
2165 split_stack_adjust_reltype(const Symbol_table*, const unsigned char* pshdrs,
2166 unsigned int shndx, const unsigned char* prelocs,
2167 size_t reloc_count, unsigned char* view,
2168 section_size_type view_size,
2169 Reloc_symbol_changes** reloc_map);
2170
2171 // Find all functions in a section.
2172 void
2173 find_functions(const unsigned char* pshdrs, unsigned int shndx,
2174 Function_offsets*);
2175
61ba1cf9
ILT
2176 // Write out the local symbols.
2177 void
b8e6aad9 2178 write_local_symbols(Output_file*,
7bf1f802 2179 const Stringpool_template<char>*,
d491d34e
ILT
2180 const Stringpool_template<char>*,
2181 Output_symtab_xindex*,
2182 Output_symtab_xindex*);
61ba1cf9 2183
ef9beddf
ILT
2184 // Record a mapping from discarded section SHNDX to the corresponding
2185 // kept section.
2186 void
1ef4d87f
ILT
2187 set_kept_comdat_section(unsigned int shndx, Relobj* kept_object,
2188 unsigned int kept_shndx)
ef9beddf 2189 {
1ef4d87f
ILT
2190 Kept_comdat_section kept(kept_object, kept_shndx);
2191 this->kept_comdat_sections_.insert(std::make_pair(shndx, kept));
ef9beddf
ILT
2192 }
2193
1ef4d87f
ILT
2194 // Find the kept section corresponding to the discarded section
2195 // SHNDX. Return true if found.
2196 bool
2197 get_kept_comdat_section(unsigned int shndx, Relobj** kept_object,
2198 unsigned int* kept_shndx) const
ef9beddf
ILT
2199 {
2200 typename Kept_comdat_section_table::const_iterator p =
2201 this->kept_comdat_sections_.find(shndx);
2202 if (p == this->kept_comdat_sections_.end())
1ef4d87f
ILT
2203 return false;
2204 *kept_object = p->second.object;
2205 *kept_shndx = p->second.shndx;
2206 return true;
ef9beddf
ILT
2207 }
2208
aa98ff75
DK
2209 // Compute final local symbol value. R_SYM is the local symbol index.
2210 // LV_IN points to a local symbol value containing the input value.
2211 // LV_OUT points to a local symbol value storing the final output value,
2212 // which must not be a merged symbol value since before calling this
2213 // method to avoid memory leak. RELOCATABLE indicates whether we are
2214 // linking a relocatable output. OUT_SECTIONS is an array of output
2215 // sections. OUT_OFFSETS is an array of offsets of the sections. SYMTAB
2216 // points to a symbol table.
2217 //
2218 // The method returns a status code at return. If the return status is
2219 // CFLV_OK, *LV_OUT contains the final value. If the return status is
2220 // CFLV_ERROR, *LV_OUT is 0. If the return status is CFLV_DISCARDED,
2221 // *LV_OUT is not modified.
2222 inline Compute_final_local_value_status
2223 compute_final_local_value_internal(unsigned int r_sym,
2224 const Symbol_value<size>* lv_in,
2225 Symbol_value<size>* lv_out,
2226 bool relocatable,
2227 const Output_sections& out_sections,
2228 const std::vector<Address>& out_offsets,
2229 const Symbol_table* symtab);
2230
07f397ab
ILT
2231 // The GOT offsets of local symbols. This map also stores GOT offsets
2232 // for tp-relative offsets for TLS symbols.
0a65a3a7 2233 typedef Unordered_map<unsigned int, Got_offset_list*> Local_got_offsets;
e727fa71 2234
7223e9ca
ILT
2235 // The PLT offsets of local symbols.
2236 typedef Unordered_map<unsigned int, unsigned int> Local_plt_offsets;
07f397ab 2237
5995b570
CC
2238 // Saved information for sections whose layout was deferred.
2239 struct Deferred_layout
2240 {
2241 static const int shdr_size = elfcpp::Elf_sizes<size>::shdr_size;
2242 Deferred_layout(unsigned int shndx, const char* name,
2243 const unsigned char* pshdr,
2244 unsigned int reloc_shndx, unsigned int reloc_type)
2245 : shndx_(shndx), name_(name), reloc_shndx_(reloc_shndx),
2246 reloc_type_(reloc_type)
2247 {
2248 memcpy(this->shdr_data_, pshdr, shdr_size);
2249 }
2250 unsigned int shndx_;
2251 std::string name_;
2252 unsigned int reloc_shndx_;
2253 unsigned int reloc_type_;
2254 unsigned char shdr_data_[shdr_size];
2255 };
2256
645f8123
ILT
2257 // General access to the ELF file.
2258 elfcpp::Elf_file<size, big_endian, Object> elf_file_;
bae7f79e 2259 // Index of SHT_SYMTAB section.
645f8123 2260 unsigned int symtab_shndx_;
61ba1cf9
ILT
2261 // The number of local symbols.
2262 unsigned int local_symbol_count_;
2263 // The number of local symbols which go into the output file.
2264 unsigned int output_local_symbol_count_;
7bf1f802
ILT
2265 // The number of local symbols which go into the output file's dynamic
2266 // symbol table.
2267 unsigned int output_local_dynsym_count_;
14bfc3f5 2268 // The entries in the symbol table for the external symbols.
730cdc88 2269 Symbols symbols_;
92de84a6
ILT
2270 // Number of symbols defined in object file itself.
2271 size_t defined_count_;
75f65a3e
ILT
2272 // File offset for local symbols.
2273 off_t local_symbol_offset_;
7bf1f802
ILT
2274 // File offset for local dynamic symbols.
2275 off_t local_dynsym_offset_;
61ba1cf9 2276 // Values of local symbols.
c06b7b0b 2277 Local_values local_values_;
07f397ab
ILT
2278 // GOT offsets for local non-TLS symbols, and tp-relative offsets
2279 // for TLS symbols, indexed by symbol number.
e727fa71 2280 Local_got_offsets local_got_offsets_;
7223e9ca
ILT
2281 // PLT offsets for local symbols.
2282 Local_plt_offsets local_plt_offsets_;
ef9beddf 2283 // For each input section, the offset of the input section in its
eff45813 2284 // output section. This is INVALID_ADDRESS if the input section requires a
ef9beddf
ILT
2285 // special mapping.
2286 std::vector<Address> section_offsets_;
2287 // Table mapping discarded comdat sections to corresponding kept sections.
2288 Kept_comdat_section_table kept_comdat_sections_;
730cdc88
ILT
2289 // Whether this object has a GNU style .eh_frame section.
2290 bool has_eh_frame_;
805bb01c
DK
2291 // If this object has a GNU style .eh_frame section that is discarded in
2292 // output, record the index here. Otherwise it is -1U.
2293 unsigned int discarded_eh_frame_shndx_;
5995b570
CC
2294 // The list of sections whose layout was deferred.
2295 std::vector<Deferred_layout> deferred_layout_;
f3a2388f
CC
2296 // The list of relocation sections whose layout was deferred.
2297 std::vector<Deferred_layout> deferred_layout_relocs_;
a2e47362
CC
2298 // For compressed debug sections, map section index to uncompressed size.
2299 Compressed_section_map* compressed_sections_;
bae7f79e
ILT
2300};
2301
54dc6425 2302// A class to manage the list of all objects.
a2fb1b05 2303
54dc6425
ILT
2304class Input_objects
2305{
2306 public:
2307 Input_objects()
fd9d194f 2308 : relobj_list_(), dynobj_list_(), sonames_(), cref_(NULL)
54dc6425
ILT
2309 { }
2310
f6ce93d6
ILT
2311 // The type of the list of input relocateable objects.
2312 typedef std::vector<Relobj*> Relobj_list;
2313 typedef Relobj_list::const_iterator Relobj_iterator;
2314
2315 // The type of the list of input dynamic objects.
2316 typedef std::vector<Dynobj*> Dynobj_list;
2317 typedef Dynobj_list::const_iterator Dynobj_iterator;
54dc6425 2318
008db82e
ILT
2319 // Add an object to the list. Return true if all is well, or false
2320 // if this object should be ignored.
2321 bool
54dc6425
ILT
2322 add_object(Object*);
2323
92de84a6
ILT
2324 // Start processing an archive.
2325 void
2326 archive_start(Archive*);
2327
2328 // Stop processing an archive.
2329 void
2330 archive_stop(Archive*);
2331
e2827e5f
ILT
2332 // For each dynamic object, check whether we've seen all of its
2333 // explicit dependencies.
2334 void
2335 check_dynamic_dependencies() const;
2336
9a2d6984
ILT
2337 // Return whether an object was found in the system library
2338 // directory.
2339 bool
2340 found_in_system_library_directory(const Object*) const;
2341
92de84a6
ILT
2342 // Print symbol counts.
2343 void
2344 print_symbol_counts(const Symbol_table*) const;
2345
dde3f402
ILT
2346 // Print a cross reference table.
2347 void
2348 print_cref(const Symbol_table*, FILE*) const;
2349
f6ce93d6
ILT
2350 // Iterate over all regular objects.
2351
2352 Relobj_iterator
2353 relobj_begin() const
2354 { return this->relobj_list_.begin(); }
2355
2356 Relobj_iterator
2357 relobj_end() const
2358 { return this->relobj_list_.end(); }
2359
2360 // Iterate over all dynamic objects.
2361
2362 Dynobj_iterator
2363 dynobj_begin() const
2364 { return this->dynobj_list_.begin(); }
54dc6425 2365
f6ce93d6
ILT
2366 Dynobj_iterator
2367 dynobj_end() const
2368 { return this->dynobj_list_.end(); }
54dc6425
ILT
2369
2370 // Return whether we have seen any dynamic objects.
2371 bool
2372 any_dynamic() const
f6ce93d6 2373 { return !this->dynobj_list_.empty(); }
54dc6425 2374
fa17a3f4
ILT
2375 // Return the number of non dynamic objects.
2376 int
2377 number_of_relobjs() const
2378 { return this->relobj_list_.size(); }
2379
fe9a4c12
ILT
2380 // Return the number of input objects.
2381 int
2382 number_of_input_objects() const
2383 { return this->relobj_list_.size() + this->dynobj_list_.size(); }
2384
54dc6425
ILT
2385 private:
2386 Input_objects(const Input_objects&);
2387 Input_objects& operator=(const Input_objects&);
2388
008db82e 2389 // The list of ordinary objects included in the link.
f6ce93d6 2390 Relobj_list relobj_list_;
008db82e 2391 // The list of dynamic objects included in the link.
f6ce93d6 2392 Dynobj_list dynobj_list_;
008db82e
ILT
2393 // SONAMEs that we have seen.
2394 Unordered_set<std::string> sonames_;
92de84a6
ILT
2395 // Manage cross-references if requested.
2396 Cref* cref_;
54dc6425 2397};
a2fb1b05 2398
92e059d8
ILT
2399// Some of the information we pass to the relocation routines. We
2400// group this together to avoid passing a dozen different arguments.
2401
2402template<int size, bool big_endian>
2403struct Relocate_info
2404{
92e059d8
ILT
2405 // Symbol table.
2406 const Symbol_table* symtab;
2407 // Layout.
2408 const Layout* layout;
2409 // Object being relocated.
f6ce93d6 2410 Sized_relobj<size, big_endian>* object;
92e059d8
ILT
2411 // Section index of relocation section.
2412 unsigned int reloc_shndx;
82bb573a
ILT
2413 // Section header of relocation section.
2414 const unsigned char* reloc_shdr;
92e059d8
ILT
2415 // Section index of section being relocated.
2416 unsigned int data_shndx;
82bb573a
ILT
2417 // Section header of data section.
2418 const unsigned char* data_shdr;
92e059d8
ILT
2419
2420 // Return a string showing the location of a relocation. This is
2421 // only used for error messages.
2422 std::string
2423 location(size_t relnum, off_t reloffset) const;
2424};
2425
5ac169d4
DK
2426// This is used to represent a section in an object and is used as the
2427// key type for various section maps.
2428typedef std::pair<Object*, unsigned int> Section_id;
2429
2430// This is similar to Section_id but is used when the section
2431// pointers are const.
2432typedef std::pair<const Object*, unsigned int> Const_section_id;
2433
2434// The hash value is based on the address of an object in memory during
2435// linking. It is okay to use this for looking up sections but never use
2436// this in an unordered container that we want to traverse in a repeatable
2437// manner.
2438
2439struct Section_id_hash
2440{
2441 size_t operator()(const Section_id& loc) const
2442 { return reinterpret_cast<uintptr_t>(loc.first) ^ loc.second; }
2443};
2444
2445struct Const_section_id_hash
2446{
2447 size_t operator()(const Const_section_id& loc) const
2448 { return reinterpret_cast<uintptr_t>(loc.first) ^ loc.second; }
2449};
2450
f6060a4d
ILT
2451// Return whether INPUT_FILE contains an ELF object start at file
2452// offset OFFSET. This sets *START to point to a view of the start of
2453// the file. It sets *READ_SIZE to the number of bytes in the view.
2454
2455extern bool
2456is_elf_object(Input_file* input_file, off_t offset,
ca09d69a 2457 const unsigned char** start, int* read_size);
f6060a4d 2458
bae7f79e 2459// Return an Object appropriate for the input file. P is BYTES long,
15f8229b
ILT
2460// and holds the ELF header. If PUNCONFIGURED is not NULL, then if
2461// this sees an object the linker is not configured to support, it
2462// sets *PUNCONFIGURED to true and returns NULL without giving an
2463// error message.
bae7f79e 2464
61ba1cf9
ILT
2465extern Object*
2466make_elf_object(const std::string& name, Input_file*,
2467 off_t offset, const unsigned char* p,
15f8229b 2468 section_offset_type bytes, bool* punconfigured);
bae7f79e
ILT
2469
2470} // end namespace gold
2471
2472#endif // !defined(GOLD_OBJECT_H)
This page took 0.322327 seconds and 4 git commands to generate.