* corefile.c (generic_search): Delete disabled code.
[deliverable/binutils-gdb.git] / gold / object.h
CommitLineData
bae7f79e
ILT
1// object.h -- support for an object file for linking in gold -*- C++ -*-
2
ebdbb458 3// Copyright 2006, 2007, 2008 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"
bae7f79e
ILT
33
34namespace gold
35{
36
92e059d8 37class General_options;
17a1d0a9 38class Task;
92de84a6
ILT
39class Cref;
40class Archive;
a2fb1b05 41class Layout;
61ba1cf9
ILT
42class Output_section;
43class Output_file;
d491d34e 44class Output_symtab_xindex;
89fc3421 45class Pluginobj;
f6ce93d6 46class Dynobj;
4625f782 47class Object_merge_map;
6a74a719 48class Relocatable_relocs;
a2fb1b05 49
b8e6aad9
ILT
50template<typename Stringpool_char>
51class Stringpool_template;
52
bae7f79e
ILT
53// Data to pass from read_symbols() to add_symbols().
54
55struct Read_symbols_data
56{
12e14209
ILT
57 // Section headers.
58 File_view* section_headers;
59 // Section names.
60 File_view* section_names;
61 // Size of section name data in bytes.
8383303e 62 section_size_type section_names_size;
bae7f79e
ILT
63 // Symbol data.
64 File_view* symbols;
65 // Size of symbol data in bytes.
8383303e 66 section_size_type symbols_size;
730cdc88
ILT
67 // Offset of external symbols within symbol data. This structure
68 // sometimes contains only external symbols, in which case this will
69 // be zero. Sometimes it contains all symbols.
8383303e 70 section_offset_type external_symbols_offset;
bae7f79e
ILT
71 // Symbol names.
72 File_view* symbol_names;
73 // Size of symbol name data in bytes.
8383303e 74 section_size_type symbol_names_size;
dbe717ef
ILT
75
76 // Version information. This is only used on dynamic objects.
77 // Version symbol data (from SHT_GNU_versym section).
78 File_view* versym;
8383303e 79 section_size_type versym_size;
dbe717ef
ILT
80 // Version definition data (from SHT_GNU_verdef section).
81 File_view* verdef;
8383303e 82 section_size_type verdef_size;
dbe717ef
ILT
83 unsigned int verdef_info;
84 // Needed version data (from SHT_GNU_verneed section).
85 File_view* verneed;
8383303e 86 section_size_type verneed_size;
dbe717ef 87 unsigned int verneed_info;
bae7f79e
ILT
88};
89
f7e2ee48
ILT
90// Information used to print error messages.
91
92struct Symbol_location_info
93{
94 std::string source_file;
95 std::string enclosing_symbol_name;
96 int line_number;
97};
98
92e059d8
ILT
99// Data about a single relocation section. This is read in
100// read_relocs and processed in scan_relocs.
101
102struct Section_relocs
103{
104 // Index of reloc section.
105 unsigned int reloc_shndx;
106 // Index of section that relocs apply to.
107 unsigned int data_shndx;
108 // Contents of reloc section.
109 File_view* contents;
110 // Reloc section type.
111 unsigned int sh_type;
112 // Number of reloc entries.
113 size_t reloc_count;
730cdc88
ILT
114 // Output section.
115 Output_section* output_section;
116 // Whether this section has special handling for offsets.
117 bool needs_special_offset_handling;
7019cd25
ILT
118 // Whether the data section is allocated (has the SHF_ALLOC flag set).
119 bool is_data_section_allocated;
92e059d8
ILT
120};
121
122// Relocations in an object file. This is read in read_relocs and
123// processed in scan_relocs.
124
125struct Read_relocs_data
126{
127 typedef std::vector<Section_relocs> Relocs_list;
128 // The relocations.
129 Relocs_list relocs;
130 // The local symbols.
131 File_view* local_symbols;
132};
133
d491d34e
ILT
134// The Xindex class manages section indexes for objects with more than
135// 0xff00 sections.
136
137class Xindex
138{
139 public:
140 Xindex(int large_shndx_offset)
141 : large_shndx_offset_(large_shndx_offset), symtab_xindex_()
142 { }
143
144 // Initialize the symtab_xindex_ array, given the object and the
145 // section index of the symbol table to use.
146 template<int size, bool big_endian>
147 void
148 initialize_symtab_xindex(Object*, unsigned int symtab_shndx);
149
150 // Read in the symtab_xindex_ array, given its section index.
151 // PSHDRS may optionally point to the section headers.
152 template<int size, bool big_endian>
153 void
154 read_symtab_xindex(Object*, unsigned int xindex_shndx,
155 const unsigned char* pshdrs);
156
157 // Symbol SYMNDX in OBJECT has a section of SHN_XINDEX; return the
158 // real section index.
159 unsigned int
160 sym_xindex_to_shndx(Object* object, unsigned int symndx);
161
162 private:
163 // The type of the array giving the real section index for symbols
164 // whose st_shndx field holds SHN_XINDEX.
165 typedef std::vector<unsigned int> Symtab_xindex;
166
167 // Adjust a section index if necessary. This should only be called
168 // for ordinary section indexes.
169 unsigned int
170 adjust_shndx(unsigned int shndx)
171 {
172 if (shndx >= elfcpp::SHN_LORESERVE)
173 shndx += this->large_shndx_offset_;
174 return shndx;
175 }
176
177 // Adjust to apply to large section indexes.
178 int large_shndx_offset_;
179 // The data from the SHT_SYMTAB_SHNDX section.
180 Symtab_xindex symtab_xindex_;
181};
182
f6ce93d6
ILT
183// Object is an abstract base class which represents either a 32-bit
184// or a 64-bit input object. This can be a regular object file
185// (ET_REL) or a shared object (ET_DYN).
bae7f79e
ILT
186
187class Object
188{
189 public:
190 // NAME is the name of the object as we would report it to the user
191 // (e.g., libfoo.a(bar.o) if this is in an archive. INPUT_FILE is
192 // used to read the file. OFFSET is the offset within the input
193 // file--0 for a .o or .so file, something else for a .a file.
14bfc3f5
ILT
194 Object(const std::string& name, Input_file* input_file, bool is_dynamic,
195 off_t offset = 0)
dbe717ef 196 : name_(name), input_file_(input_file), offset_(offset), shnum_(-1U),
d491d34e 197 is_dynamic_(is_dynamic), target_(NULL), xindex_(NULL)
cb295612 198 { input_file->file().add_object(); }
bae7f79e
ILT
199
200 virtual ~Object()
cb295612 201 { this->input_file_->file().remove_object(); }
bae7f79e 202
14bfc3f5 203 // Return the name of the object as we would report it to the tuser.
bae7f79e
ILT
204 const std::string&
205 name() const
206 { return this->name_; }
207
cec9d2f3
ILT
208 // Get the offset into the file.
209 off_t
210 offset() const
211 { return this->offset_; }
212
14bfc3f5
ILT
213 // Return whether this is a dynamic object.
214 bool
215 is_dynamic() const
216 { return this->is_dynamic_; }
217
89fc3421
CC
218 // Returns NULL for Objects that are not plugin objects. This method
219 // is overridden in the Pluginobj class.
220 Pluginobj*
221 pluginobj()
222 { return this->do_pluginobj(); }
223
14bfc3f5
ILT
224 // Return the target structure associated with this object.
225 Target*
a2fb1b05 226 target() const
14bfc3f5
ILT
227 { return this->target_; }
228
a2fb1b05
ILT
229 // Lock the underlying file.
230 void
17a1d0a9
ILT
231 lock(const Task* t)
232 { this->input_file()->file().lock(t); }
a2fb1b05
ILT
233
234 // Unlock the underlying file.
235 void
17a1d0a9
ILT
236 unlock(const Task* t)
237 { this->input_file()->file().unlock(t); }
a2fb1b05
ILT
238
239 // Return whether the underlying file is locked.
240 bool
241 is_locked() const
7004837e 242 { return this->input_file()->file().is_locked(); }
a2fb1b05 243
17a1d0a9
ILT
244 // Return the token, so that the task can be queued.
245 Task_token*
246 token()
247 { return this->input_file()->file().token(); }
248
249 // Release the underlying file.
250 void
251 release()
252 { this->input_file_->file().release(); }
253
88dd47ac
ILT
254 // Return whether we should just read symbols from this file.
255 bool
256 just_symbols() const
257 { return this->input_file()->just_symbols(); }
258
14bfc3f5
ILT
259 // Return the sized target structure associated with this object.
260 // This is like the target method but it returns a pointer of
261 // appropriate checked type.
262 template<int size, bool big_endian>
263 Sized_target<size, big_endian>*
7d1a9ebb 264 sized_target() const;
bae7f79e 265
5a6f7e2d
ILT
266 // Get the number of sections.
267 unsigned int
268 shnum() const
269 { return this->shnum_; }
a2fb1b05 270
f6ce93d6 271 // Return a view of the contents of a section. Set *PLEN to the
9eb9fa57 272 // size. CACHE is a hint as in File_read::get_view.
f6ce93d6 273 const unsigned char*
8383303e 274 section_contents(unsigned int shndx, section_size_type* plen, bool cache);
f6ce93d6 275
d491d34e
ILT
276 // Adjust a symbol's section index as needed. SYMNDX is the index
277 // of the symbol and SHNDX is the symbol's section from
278 // get_st_shndx. This returns the section index. It sets
279 // *IS_ORDINARY to indicate whether this is a normal section index,
280 // rather than a special code between SHN_LORESERVE and
281 // SHN_HIRESERVE.
282 unsigned int
283 adjust_sym_shndx(unsigned int symndx, unsigned int shndx, bool* is_ordinary)
284 {
285 if (shndx < elfcpp::SHN_LORESERVE)
286 *is_ordinary = true;
287 else if (shndx == elfcpp::SHN_XINDEX)
288 {
289 if (this->xindex_ == NULL)
290 this->xindex_ = this->do_initialize_xindex();
291 shndx = this->xindex_->sym_xindex_to_shndx(this, symndx);
292 *is_ordinary = true;
293 }
294 else
295 *is_ordinary = false;
296 return shndx;
297 }
298
a445fddf
ILT
299 // Return the size of a section given a section index.
300 uint64_t
301 section_size(unsigned int shndx)
302 { return this->do_section_size(shndx); }
303
304 // Return the name of a section given a section index.
f6ce93d6 305 std::string
a3ad94ed
ILT
306 section_name(unsigned int shndx)
307 { return this->do_section_name(shndx); }
308
309 // Return the section flags given a section index.
310 uint64_t
311 section_flags(unsigned int shndx)
312 { return this->do_section_flags(shndx); }
f6ce93d6 313
88dd47ac
ILT
314 // Return the section address given a section index.
315 uint64_t
316 section_address(unsigned int shndx)
317 { return this->do_section_address(shndx); }
318
730cdc88
ILT
319 // Return the section type given a section index.
320 unsigned int
321 section_type(unsigned int shndx)
322 { return this->do_section_type(shndx); }
323
f7e2ee48
ILT
324 // Return the section link field given a section index.
325 unsigned int
326 section_link(unsigned int shndx)
327 { return this->do_section_link(shndx); }
328
4c50553d
ILT
329 // Return the section info field given a section index.
330 unsigned int
331 section_info(unsigned int shndx)
332 { return this->do_section_info(shndx); }
333
a445fddf
ILT
334 // Return the required section alignment given a section index.
335 uint64_t
336 section_addralign(unsigned int shndx)
337 { return this->do_section_addralign(shndx); }
338
5a6f7e2d
ILT
339 // Read the symbol information.
340 void
341 read_symbols(Read_symbols_data* sd)
342 { return this->do_read_symbols(sd); }
343
344 // Pass sections which should be included in the link to the Layout
345 // object, and record where the sections go in the output file.
346 void
7e1edb90
ILT
347 layout(Symbol_table* symtab, Layout* layout, Read_symbols_data* sd)
348 { this->do_layout(symtab, layout, sd); }
5a6f7e2d
ILT
349
350 // Add symbol information to the global symbol table.
351 void
352 add_symbols(Symbol_table* symtab, Read_symbols_data* sd)
353 { this->do_add_symbols(symtab, sd); }
354
645f8123
ILT
355 // Functions and types for the elfcpp::Elf_file interface. This
356 // permit us to use Object as the File template parameter for
357 // elfcpp::Elf_file.
358
359 // The View class is returned by view. It must support a single
360 // method, data(). This is trivial, because get_view does what we
361 // need.
362 class View
363 {
364 public:
365 View(const unsigned char* p)
366 : p_(p)
367 { }
368
369 const unsigned char*
370 data() const
371 { return this->p_; }
372
373 private:
374 const unsigned char* p_;
375 };
376
377 // Return a View.
378 View
8383303e 379 view(off_t file_offset, section_size_type data_size)
39d0cb0e 380 { return View(this->get_view(file_offset, data_size, true, true)); }
645f8123
ILT
381
382 // Report an error.
383 void
75f2446e 384 error(const char* format, ...) const ATTRIBUTE_PRINTF_2;
645f8123
ILT
385
386 // A location in the file.
387 struct Location
388 {
389 off_t file_offset;
390 off_t data_size;
391
8383303e 392 Location(off_t fo, section_size_type ds)
645f8123
ILT
393 : file_offset(fo), data_size(ds)
394 { }
395 };
396
397 // Get a View given a Location.
398 View view(Location loc)
39d0cb0e 399 { return View(this->get_view(loc.file_offset, loc.data_size, true, true)); }
645f8123 400
cb295612
ILT
401 // Get a view into the underlying file.
402 const unsigned char*
39d0cb0e 403 get_view(off_t start, section_size_type size, bool aligned, bool cache)
cb295612 404 {
39d0cb0e
ILT
405 return this->input_file()->file().get_view(this->offset_, start, size,
406 aligned, cache);
cb295612
ILT
407 }
408
409 // Get a lasting view into the underlying file.
410 File_view*
39d0cb0e
ILT
411 get_lasting_view(off_t start, section_size_type size, bool aligned,
412 bool cache)
cb295612 413 {
39d0cb0e
ILT
414 return this->input_file()->file().get_lasting_view(this->offset_, start,
415 size, aligned, cache);
cb295612
ILT
416 }
417
418 // Read data from the underlying file.
419 void
2a00e4fb 420 read(off_t start, section_size_type size, void* p)
cb295612
ILT
421 { this->input_file()->file().read(start + this->offset_, size, p); }
422
423 // Read multiple data from the underlying file.
424 void
425 read_multiple(const File_read::Read_multiple& rm)
426 { this->input_file()->file().read_multiple(this->offset_, rm); }
427
428 // Stop caching views in the underlying file.
429 void
430 clear_view_cache_marks()
431 { this->input_file()->file().clear_view_cache_marks(); }
432
92de84a6
ILT
433 // Get the number of global symbols defined by this object, and the
434 // number of the symbols whose final definition came from this
435 // object.
436 void
437 get_global_symbol_counts(const Symbol_table* symtab, size_t* defined,
438 size_t* used) const
439 { this->do_get_global_symbol_counts(symtab, defined, used); }
440
89fc3421
CC
441 // Set the target.
442 void
443 set_target(Target* target)
444 { this->target_ = target; }
445
f6ce93d6 446 protected:
89fc3421
CC
447 // Returns NULL for Objects that are not plugin objects. This method
448 // is overridden in the Pluginobj class.
449 virtual Pluginobj*
450 do_pluginobj()
451 { return NULL; }
452
f6ce93d6
ILT
453 // Read the symbols--implemented by child class.
454 virtual void
455 do_read_symbols(Read_symbols_data*) = 0;
456
457 // Lay out sections--implemented by child class.
458 virtual void
7e1edb90 459 do_layout(Symbol_table*, Layout*, Read_symbols_data*) = 0;
f6ce93d6
ILT
460
461 // Add symbol information to the global symbol table--implemented by
462 // child class.
463 virtual void
464 do_add_symbols(Symbol_table*, Read_symbols_data*) = 0;
465
645f8123
ILT
466 // Return the location of the contents of a section. Implemented by
467 // child class.
468 virtual Location
a3ad94ed 469 do_section_contents(unsigned int shndx) = 0;
f6ce93d6 470
a445fddf
ILT
471 // Get the size of a section--implemented by child class.
472 virtual uint64_t
473 do_section_size(unsigned int shndx) = 0;
474
f6ce93d6
ILT
475 // Get the name of a section--implemented by child class.
476 virtual std::string
a3ad94ed
ILT
477 do_section_name(unsigned int shndx) = 0;
478
479 // Get section flags--implemented by child class.
480 virtual uint64_t
481 do_section_flags(unsigned int shndx) = 0;
f6ce93d6 482
88dd47ac
ILT
483 // Get section address--implemented by child class.
484 virtual uint64_t
485 do_section_address(unsigned int shndx) = 0;
486
730cdc88
ILT
487 // Get section type--implemented by child class.
488 virtual unsigned int
489 do_section_type(unsigned int shndx) = 0;
490
f7e2ee48
ILT
491 // Get section link field--implemented by child class.
492 virtual unsigned int
493 do_section_link(unsigned int shndx) = 0;
494
4c50553d
ILT
495 // Get section info field--implemented by child class.
496 virtual unsigned int
497 do_section_info(unsigned int shndx) = 0;
498
a445fddf
ILT
499 // Get section alignment--implemented by child class.
500 virtual uint64_t
501 do_section_addralign(unsigned int shndx) = 0;
502
d491d34e
ILT
503 // Return the Xindex structure to use.
504 virtual Xindex*
505 do_initialize_xindex() = 0;
506
92de84a6
ILT
507 // Implement get_global_symbol_counts--implemented by child class.
508 virtual void
509 do_get_global_symbol_counts(const Symbol_table*, size_t*, size_t*) const = 0;
510
17a1d0a9 511 // Get the file. We pass on const-ness.
f6ce93d6 512 Input_file*
7004837e
ILT
513 input_file()
514 { return this->input_file_; }
515
516 const Input_file*
f6ce93d6
ILT
517 input_file() const
518 { return this->input_file_; }
519
f6ce93d6
ILT
520 // Set the target.
521 void
dbe717ef
ILT
522 set_target(int machine, int size, bool big_endian, int osabi,
523 int abiversion);
524
dbe717ef
ILT
525 // Set the number of sections.
526 void
527 set_shnum(int shnum)
528 { this->shnum_ = shnum; }
529
530 // Functions used by both Sized_relobj and Sized_dynobj.
531
532 // Read the section data into a Read_symbols_data object.
533 template<int size, bool big_endian>
534 void
535 read_section_data(elfcpp::Elf_file<size, big_endian, Object>*,
536 Read_symbols_data*);
537
d491d34e
ILT
538 // Let the child class initialize the xindex object directly.
539 void
540 set_xindex(Xindex* xindex)
541 {
542 gold_assert(this->xindex_ == NULL);
543 this->xindex_ = xindex;
544 }
545
dbe717ef
ILT
546 // If NAME is the name of a special .gnu.warning section, arrange
547 // for the warning to be issued. SHNDX is the section index.
548 // Return whether it is a warning section.
549 bool
550 handle_gnu_warning_section(const char* name, unsigned int shndx,
551 Symbol_table*);
f6ce93d6
ILT
552
553 private:
554 // This class may not be copied.
555 Object(const Object&);
556 Object& operator=(const Object&);
557
558 // Name of object as printed to user.
559 std::string name_;
560 // For reading the file.
561 Input_file* input_file_;
562 // Offset within the file--0 for an object file, non-0 for an
563 // archive.
564 off_t offset_;
dbe717ef
ILT
565 // Number of input sections.
566 unsigned int shnum_;
f6ce93d6
ILT
567 // Whether this is a dynamic object.
568 bool is_dynamic_;
569 // Target functions--may be NULL if the target is not known.
570 Target* target_;
d491d34e
ILT
571 // Many sections for objects with more than SHN_LORESERVE sections.
572 Xindex* xindex_;
f6ce93d6
ILT
573};
574
575// Implement sized_target inline for efficiency. This approach breaks
576// static type checking, but is made safe using asserts.
577
578template<int size, bool big_endian>
579inline Sized_target<size, big_endian>*
7d1a9ebb 580Object::sized_target() const
f6ce93d6 581{
a3ad94ed
ILT
582 gold_assert(this->target_->get_size() == size);
583 gold_assert(this->target_->is_big_endian() ? big_endian : !big_endian);
f6ce93d6
ILT
584 return static_cast<Sized_target<size, big_endian>*>(this->target_);
585}
586
587// A regular object (ET_REL). This is an abstract base class itself.
b8e6aad9 588// The implementation is the template class Sized_relobj.
f6ce93d6
ILT
589
590class Relobj : public Object
591{
592 public:
593 Relobj(const std::string& name, Input_file* input_file, off_t offset = 0)
4625f782 594 : Object(name, input_file, false, offset),
ef9beddf 595 output_sections_(),
6a74a719 596 map_to_relocatable_relocs_(NULL),
4625f782
ILT
597 object_merge_map_(NULL),
598 relocs_must_follow_section_writes_(false)
f6ce93d6
ILT
599 { }
600
92e059d8 601 // Read the relocs.
a2fb1b05 602 void
92e059d8
ILT
603 read_relocs(Read_relocs_data* rd)
604 { return this->do_read_relocs(rd); }
605
606 // Scan the relocs and adjust the symbol table.
607 void
608 scan_relocs(const General_options& options, Symbol_table* symtab,
ead1e424
ILT
609 Layout* layout, Read_relocs_data* rd)
610 { return this->do_scan_relocs(options, symtab, layout, rd); }
a2fb1b05 611
6d013333
ILT
612 // The number of local symbols in the input symbol table.
613 virtual unsigned int
614 local_symbol_count() const
615 { return this->do_local_symbol_count(); }
616
7bf1f802
ILT
617 // Initial local symbol processing: count the number of local symbols
618 // in the output symbol table and dynamic symbol table; add local symbol
619 // names to *POOL and *DYNPOOL.
620 void
621 count_local_symbols(Stringpool_template<char>* pool,
622 Stringpool_template<char>* dynpool)
623 { return this->do_count_local_symbols(pool, dynpool); }
624
625 // Set the values of the local symbols, set the output symbol table
626 // indexes for the local variables, and set the offset where local
627 // symbol information will be stored. Returns the new local symbol index.
628 unsigned int
629 finalize_local_symbols(unsigned int index, off_t off)
630 { return this->do_finalize_local_symbols(index, off); }
631
632 // Set the output dynamic symbol table indexes for the local variables.
c06b7b0b 633 unsigned int
7bf1f802
ILT
634 set_local_dynsym_indexes(unsigned int index)
635 { return this->do_set_local_dynsym_indexes(index); }
636
637 // Set the offset where local dynamic symbol information will be stored.
638 unsigned int
639 set_local_dynsym_offset(off_t off)
640 { return this->do_set_local_dynsym_offset(off); }
75f65a3e 641
61ba1cf9
ILT
642 // Relocate the input sections and write out the local symbols.
643 void
644 relocate(const General_options& options, const Symbol_table* symtab,
92e059d8
ILT
645 const Layout* layout, Output_file* of)
646 { return this->do_relocate(options, symtab, layout, of); }
61ba1cf9 647
a783673b
ILT
648 // Return whether an input section is being included in the link.
649 bool
5a6f7e2d 650 is_section_included(unsigned int shndx) const
a783673b 651 {
ef9beddf
ILT
652 gold_assert(shndx < this->output_sections_.size());
653 return this->output_sections_[shndx] != NULL;
a783673b
ILT
654 }
655
ef9beddf
ILT
656 // Given a section index, return the corresponding Output_section.
657 // The return value will be NULL if the section is not included in
658 // the link.
659 Output_section*
660 output_section(unsigned int shndx) const
730cdc88 661 {
ef9beddf
ILT
662 gold_assert(shndx < this->output_sections_.size());
663 return this->output_sections_[shndx];
730cdc88
ILT
664 }
665
ef9beddf
ILT
666 // Given a section index, return the offset in the Output_section.
667 // The return value will be -1U if the section is specially mapped,
668 // such as a merge section.
669 uint64_t
670 output_section_offset(unsigned int shndx) const
671 { return this->do_output_section_offset(shndx); }
a783673b 672
ead1e424 673 // Set the offset of an input section within its output section.
5995b570 674 void
ef9beddf
ILT
675 set_section_offset(unsigned int shndx, uint64_t off)
676 { this->do_set_section_offset(shndx, off); }
e94cf127 677
730cdc88
ILT
678 // Return true if we need to wait for output sections to be written
679 // before we can apply relocations. This is true if the object has
680 // any relocations for sections which require special handling, such
681 // as the exception frame section.
682 bool
17a1d0a9 683 relocs_must_follow_section_writes() const
730cdc88
ILT
684 { return this->relocs_must_follow_section_writes_; }
685
4625f782
ILT
686 // Return the object merge map.
687 Object_merge_map*
688 merge_map() const
689 { return this->object_merge_map_; }
690
691 // Set the object merge map.
692 void
693 set_merge_map(Object_merge_map* object_merge_map)
694 {
695 gold_assert(this->object_merge_map_ == NULL);
696 this->object_merge_map_ = object_merge_map;
697 }
698
6a74a719
ILT
699 // Record the relocatable reloc info for an input reloc section.
700 void
701 set_relocatable_relocs(unsigned int reloc_shndx, Relocatable_relocs* rr)
702 {
703 gold_assert(reloc_shndx < this->shnum());
704 (*this->map_to_relocatable_relocs_)[reloc_shndx] = rr;
705 }
706
707 // Get the relocatable reloc info for an input reloc section.
708 Relocatable_relocs*
709 relocatable_relocs(unsigned int reloc_shndx)
710 {
711 gold_assert(reloc_shndx < this->shnum());
712 return (*this->map_to_relocatable_relocs_)[reloc_shndx];
713 }
714
5995b570
CC
715 // Layout sections whose layout was deferred while waiting for
716 // input files from a plugin.
717 void
718 layout_deferred_sections(Layout* layout)
719 { this->do_layout_deferred_sections(layout); }
720
a783673b 721 protected:
ef9beddf
ILT
722 // The output section to be used for each input section, indexed by
723 // the input section number. The output section is NULL if the
724 // input section is to be discarded.
725 typedef std::vector<Output_section*> Output_sections;
e94cf127 726
92e059d8
ILT
727 // Read the relocs--implemented by child class.
728 virtual void
729 do_read_relocs(Read_relocs_data*) = 0;
730
731 // Scan the relocs--implemented by child class.
732 virtual void
ead1e424
ILT
733 do_scan_relocs(const General_options&, Symbol_table*, Layout*,
734 Read_relocs_data*) = 0;
92e059d8 735
6d013333
ILT
736 // Return the number of local symbols--implemented by child class.
737 virtual unsigned int
738 do_local_symbol_count() const = 0;
739
7bf1f802
ILT
740 // Count local symbols--implemented by child class.
741 virtual void
742 do_count_local_symbols(Stringpool_template<char>*,
6a74a719 743 Stringpool_template<char>*) = 0;
75f65a3e 744
6a74a719
ILT
745 // Finalize the local symbols. Set the output symbol table indexes
746 // for the local variables, and set the offset where local symbol
747 // information will be stored.
7bf1f802
ILT
748 virtual unsigned int
749 do_finalize_local_symbols(unsigned int, off_t) = 0;
750
751 // Set the output dynamic symbol table indexes for the local variables.
752 virtual unsigned int
753 do_set_local_dynsym_indexes(unsigned int) = 0;
754
755 // Set the offset where local dynamic symbol information will be stored.
756 virtual unsigned int
757 do_set_local_dynsym_offset(off_t) = 0;
758
61ba1cf9
ILT
759 // Relocate the input sections and write out the local
760 // symbols--implemented by child class.
761 virtual void
762 do_relocate(const General_options& options, const Symbol_table* symtab,
92e059d8
ILT
763 const Layout*, Output_file* of) = 0;
764
ef9beddf
ILT
765 // Get the offset of a section--implemented by child class.
766 virtual uint64_t
767 do_output_section_offset(unsigned int shndx) const = 0;
b8e6aad9 768
ef9beddf
ILT
769 // Set the offset of a section--implemented by child class.
770 virtual void
771 do_set_section_offset(unsigned int shndx, uint64_t off) = 0;
e94cf127 772
5995b570
CC
773 // Layout sections whose layout was deferred while waiting for
774 // input files from a plugin--implemented by child class.
775 virtual void
776 do_layout_deferred_sections(Layout*) = 0;
777
ef9beddf
ILT
778 // Return the vector mapping input sections to output sections.
779 Output_sections&
780 output_sections()
781 { return this->output_sections_; }
e94cf127 782
ef9beddf
ILT
783 const Output_sections&
784 output_sections() const
785 { return this->output_sections_; }
e94cf127 786
6a74a719
ILT
787 // Set the size of the relocatable relocs array.
788 void
789 size_relocatable_relocs()
790 {
791 this->map_to_relocatable_relocs_ =
792 new std::vector<Relocatable_relocs*>(this->shnum());
793 }
794
730cdc88
ILT
795 // Record that we must wait for the output sections to be written
796 // before applying relocations.
797 void
798 set_relocs_must_follow_section_writes()
799 { this->relocs_must_follow_section_writes_ = true; }
800
bae7f79e 801 private:
a2fb1b05 802 // Mapping from input sections to output section.
ef9beddf 803 Output_sections output_sections_;
6a74a719
ILT
804 // Mapping from input section index to the information recorded for
805 // the relocations. This is only used for a relocatable link.
806 std::vector<Relocatable_relocs*>* map_to_relocatable_relocs_;
4625f782
ILT
807 // Mappings for merge sections. This is managed by the code in the
808 // Merge_map class.
809 Object_merge_map* object_merge_map_;
730cdc88
ILT
810 // Whether we need to wait for output sections to be written before
811 // we can apply relocations.
812 bool relocs_must_follow_section_writes_;
bae7f79e
ILT
813};
814
a9a60db6
ILT
815// This class is used to handle relocations against a section symbol
816// in an SHF_MERGE section. For such a symbol, we need to know the
817// addend of the relocation before we can determine the final value.
818// The addend gives us the location in the input section, and we can
819// determine how it is mapped to the output section. For a
820// non-section symbol, we apply the addend to the final value of the
821// symbol; that is done in finalize_local_symbols, and does not use
822// this class.
823
824template<int size>
825class Merged_symbol_value
826{
827 public:
828 typedef typename elfcpp::Elf_types<size>::Elf_Addr Value;
829
830 // We use a hash table to map offsets in the input section to output
831 // addresses.
832 typedef Unordered_map<section_offset_type, Value> Output_addresses;
833
834 Merged_symbol_value(Value input_value, Value output_start_address)
835 : input_value_(input_value), output_start_address_(output_start_address),
836 output_addresses_()
837 { }
838
839 // Initialize the hash table.
840 void
841 initialize_input_to_output_map(const Relobj*, unsigned int input_shndx);
842
843 // Release the hash table to save space.
844 void
845 free_input_to_output_map()
846 { this->output_addresses_.clear(); }
847
848 // Get the output value corresponding to an addend. The object and
849 // input section index are passed in because the caller will have
850 // them; otherwise we could store them here.
851 Value
852 value(const Relobj* object, unsigned int input_shndx, Value addend) const
853 {
7f649c59
ILT
854 // This is a relocation against a section symbol. ADDEND is the
855 // offset in the section. The result should be the start of some
856 // merge area. If the object file wants something else, it should
857 // use a regular symbol rather than a section symbol.
858 // Unfortunately, PR 6658 shows a case in which the object file
859 // refers to the section symbol, but uses a negative ADDEND to
860 // compensate for a PC relative reloc. We can't handle the
861 // general case. However, we can handle the special case of a
862 // negative addend, by assuming that it refers to the start of the
863 // section. Of course, that means that we have to guess when
864 // ADDEND is negative. It is normal to see a 32-bit value here
865 // even when the template parameter size is 64, as 64-bit object
866 // file formats have 32-bit relocations. We know this is a merge
867 // section, so we know it has to fit into memory. So we assume
868 // that we won't see a value larger than a large 32-bit unsigned
869 // value. This will break objects with very very large merge
870 // sections; they probably break in other ways anyhow.
871 Value input_offset = this->input_value_;
872 if (addend < 0xffffff00)
873 {
874 input_offset += addend;
875 addend = 0;
876 }
a9a60db6
ILT
877 typename Output_addresses::const_iterator p =
878 this->output_addresses_.find(input_offset);
879 if (p != this->output_addresses_.end())
7f649c59 880 return p->second + addend;
a9a60db6 881
7f649c59
ILT
882 return (this->value_from_output_section(object, input_shndx, input_offset)
883 + addend);
a9a60db6
ILT
884 }
885
886 private:
887 // Get the output value for an input offset if we couldn't find it
888 // in the hash table.
889 Value
890 value_from_output_section(const Relobj*, unsigned int input_shndx,
891 Value input_offset) const;
892
893 // The value of the section symbol in the input file. This is
894 // normally zero, but could in principle be something else.
895 Value input_value_;
896 // The start address of this merged section in the output file.
897 Value output_start_address_;
898 // A hash table which maps offsets in the input section to output
899 // addresses. This only maps specific offsets, not all offsets.
900 Output_addresses output_addresses_;
901};
902
b8e6aad9
ILT
903// This POD class is holds the value of a symbol. This is used for
904// local symbols, and for all symbols during relocation processing.
730cdc88
ILT
905// For special sections, such as SHF_MERGE sections, this calls a
906// function to get the final symbol value.
b8e6aad9
ILT
907
908template<int size>
909class Symbol_value
910{
911 public:
912 typedef typename elfcpp::Elf_types<size>::Elf_Addr Value;
913
914 Symbol_value()
7bf1f802 915 : output_symtab_index_(0), output_dynsym_index_(-1U), input_shndx_(0),
d491d34e
ILT
916 is_ordinary_shndx_(false), is_section_symbol_(false),
917 is_tls_symbol_(false), has_output_value_(true)
a9a60db6 918 { this->u_.value = 0; }
b8e6aad9
ILT
919
920 // Get the value of this symbol. OBJECT is the object in which this
921 // symbol is defined, and ADDEND is an addend to add to the value.
922 template<bool big_endian>
923 Value
924 value(const Sized_relobj<size, big_endian>* object, Value addend) const
925 {
a9a60db6
ILT
926 if (this->has_output_value_)
927 return this->u_.value + addend;
928 else
d491d34e
ILT
929 {
930 gold_assert(this->is_ordinary_shndx_);
931 return this->u_.merged_symbol_value->value(object, this->input_shndx_,
932 addend);
933 }
b8e6aad9
ILT
934 }
935
936 // Set the value of this symbol in the output symbol table.
937 void
938 set_output_value(Value value)
a9a60db6
ILT
939 { this->u_.value = value; }
940
941 // For a section symbol in a merged section, we need more
942 // information.
943 void
944 set_merged_symbol_value(Merged_symbol_value<size>* msv)
b8e6aad9 945 {
a9a60db6
ILT
946 gold_assert(this->is_section_symbol_);
947 this->has_output_value_ = false;
948 this->u_.merged_symbol_value = msv;
b8e6aad9
ILT
949 }
950
a9a60db6
ILT
951 // Initialize the input to output map for a section symbol in a
952 // merged section. We also initialize the value of a non-section
953 // symbol in a merged section.
b8e6aad9 954 void
a9a60db6 955 initialize_input_to_output_map(const Relobj* object)
b8e6aad9 956 {
a9a60db6
ILT
957 if (!this->has_output_value_)
958 {
d491d34e 959 gold_assert(this->is_section_symbol_ && this->is_ordinary_shndx_);
a9a60db6
ILT
960 Merged_symbol_value<size>* msv = this->u_.merged_symbol_value;
961 msv->initialize_input_to_output_map(object, this->input_shndx_);
962 }
b8e6aad9
ILT
963 }
964
a9a60db6
ILT
965 // Free the input to output map for a section symbol in a merged
966 // section.
967 void
968 free_input_to_output_map()
7bf1f802 969 {
a9a60db6
ILT
970 if (!this->has_output_value_)
971 this->u_.merged_symbol_value->free_input_to_output_map();
7bf1f802
ILT
972 }
973
a9a60db6
ILT
974 // Set the value of the symbol from the input file. This is only
975 // called by count_local_symbols, to communicate the value to
976 // finalize_local_symbols.
977 void
978 set_input_value(Value value)
979 { this->u_.value = value; }
980
981 // Return the input value. This is only called by
e94cf127 982 // finalize_local_symbols and (in special cases) relocate_section.
a9a60db6
ILT
983 Value
984 input_value() const
985 { return this->u_.value; }
986
b8e6aad9
ILT
987 // Return whether this symbol should go into the output symbol
988 // table.
989 bool
990 needs_output_symtab_entry() const
ac1f0c21 991 { return this->output_symtab_index_ != -1U; }
b8e6aad9
ILT
992
993 // Return the index in the output symbol table.
994 unsigned int
995 output_symtab_index() const
996 {
997 gold_assert(this->output_symtab_index_ != 0);
998 return this->output_symtab_index_;
999 }
1000
1001 // Set the index in the output symbol table.
1002 void
1003 set_output_symtab_index(unsigned int i)
1004 {
1005 gold_assert(this->output_symtab_index_ == 0);
1006 this->output_symtab_index_ = i;
1007 }
1008
1009 // Record that this symbol should not go into the output symbol
1010 // table.
1011 void
1012 set_no_output_symtab_entry()
1013 {
1014 gold_assert(this->output_symtab_index_ == 0);
1015 this->output_symtab_index_ = -1U;
1016 }
1017
7bf1f802
ILT
1018 // Set the index in the output dynamic symbol table.
1019 void
1020 set_needs_output_dynsym_entry()
1021 {
dceae3c1 1022 gold_assert(!this->is_section_symbol());
7bf1f802
ILT
1023 this->output_dynsym_index_ = 0;
1024 }
1025
1026 // Return whether this symbol should go into the output symbol
1027 // table.
1028 bool
1029 needs_output_dynsym_entry() const
1030 {
1031 return this->output_dynsym_index_ != -1U;
1032 }
1033
1034 // Record that this symbol should go into the dynamic symbol table.
1035 void
1036 set_output_dynsym_index(unsigned int i)
1037 {
1038 gold_assert(this->output_dynsym_index_ == 0);
1039 this->output_dynsym_index_ = i;
1040 }
1041
1042 // Return the index in the output dynamic symbol table.
1043 unsigned int
1044 output_dynsym_index() const
1045 {
dceae3c1
ILT
1046 gold_assert(this->output_dynsym_index_ != 0
1047 && this->output_dynsym_index_ != -1U);
7bf1f802
ILT
1048 return this->output_dynsym_index_;
1049 }
1050
b8e6aad9
ILT
1051 // Set the index of the input section in the input file.
1052 void
d491d34e 1053 set_input_shndx(unsigned int i, bool is_ordinary)
730cdc88
ILT
1054 {
1055 this->input_shndx_ = i;
ac1f0c21
ILT
1056 // input_shndx_ field is a bitfield, so make sure that the value
1057 // fits.
730cdc88 1058 gold_assert(this->input_shndx_ == i);
d491d34e 1059 this->is_ordinary_shndx_ = is_ordinary;
730cdc88 1060 }
b8e6aad9 1061
7bf1f802
ILT
1062 // Return the index of the input section in the input file.
1063 unsigned int
d491d34e
ILT
1064 input_shndx(bool* is_ordinary) const
1065 {
1066 *is_ordinary = this->is_ordinary_shndx_;
1067 return this->input_shndx_;
1068 }
7bf1f802 1069
a9a60db6
ILT
1070 // Whether this is a section symbol.
1071 bool
1072 is_section_symbol() const
1073 { return this->is_section_symbol_; }
1074
063f12a8
ILT
1075 // Record that this is a section symbol.
1076 void
1077 set_is_section_symbol()
dceae3c1
ILT
1078 {
1079 gold_assert(!this->needs_output_dynsym_entry());
1080 this->is_section_symbol_ = true;
1081 }
063f12a8 1082
7bf1f802
ILT
1083 // Record that this is a TLS symbol.
1084 void
1085 set_is_tls_symbol()
1086 { this->is_tls_symbol_ = true; }
1087
1088 // Return TRUE if this is a TLS symbol.
1089 bool
1090 is_tls_symbol() const
1091 { return this->is_tls_symbol_; }
1092
b8e6aad9
ILT
1093 private:
1094 // The index of this local symbol in the output symbol table. This
1095 // will be -1 if the symbol should not go into the symbol table.
1096 unsigned int output_symtab_index_;
7bf1f802
ILT
1097 // The index of this local symbol in the dynamic symbol table. This
1098 // will be -1 if the symbol should not go into the symbol table.
1099 unsigned int output_dynsym_index_;
b8e6aad9
ILT
1100 // The section index in the input file in which this symbol is
1101 // defined.
d491d34e
ILT
1102 unsigned int input_shndx_ : 28;
1103 // Whether the section index is an ordinary index, not a special
1104 // value.
1105 bool is_ordinary_shndx_ : 1;
063f12a8
ILT
1106 // Whether this is a STT_SECTION symbol.
1107 bool is_section_symbol_ : 1;
7bf1f802
ILT
1108 // Whether this is a STT_TLS symbol.
1109 bool is_tls_symbol_ : 1;
a9a60db6
ILT
1110 // Whether this symbol has a value for the output file. This is
1111 // normally set to true during Layout::finalize, by
1112 // finalize_local_symbols. It will be false for a section symbol in
1113 // a merge section, as for such symbols we can not determine the
1114 // value to use in a relocation until we see the addend.
1115 bool has_output_value_ : 1;
1116 union
1117 {
1118 // This is used if has_output_value_ is true. Between
1119 // count_local_symbols and finalize_local_symbols, this is the
1120 // value in the input file. After finalize_local_symbols, it is
1121 // the value in the output file.
1122 Value value;
1123 // This is used if has_output_value_ is false. It points to the
1124 // information we need to get the value for a merge section.
1125 Merged_symbol_value<size>* merged_symbol_value;
1126 } u_;
b8e6aad9
ILT
1127};
1128
0a65a3a7
CC
1129// A GOT offset list. A symbol may have more than one GOT offset
1130// (e.g., when mixing modules compiled with two different TLS models),
1131// but will usually have at most one. GOT_TYPE identifies the type of
1132// GOT entry; its values are specific to each target.
1133
1134class Got_offset_list
1135{
1136 public:
1137 Got_offset_list()
1138 : got_type_(-1U), got_offset_(0), got_next_(NULL)
1139 { }
1140
1141 Got_offset_list(unsigned int got_type, unsigned int got_offset)
1142 : got_type_(got_type), got_offset_(got_offset), got_next_(NULL)
1143 { }
1144
1145 ~Got_offset_list()
1146 {
1147 if (this->got_next_ != NULL)
1148 {
1149 delete this->got_next_;
1150 this->got_next_ = NULL;
1151 }
1152 }
1153
1154 // Initialize the fields to their default values.
1155 void
1156 init()
1157 {
1158 this->got_type_ = -1U;
1159 this->got_offset_ = 0;
1160 this->got_next_ = NULL;
1161 }
1162
1163 // Set the offset for the GOT entry of type GOT_TYPE.
1164 void
1165 set_offset(unsigned int got_type, unsigned int got_offset)
1166 {
1167 if (this->got_type_ == -1U)
1168 {
1169 this->got_type_ = got_type;
1170 this->got_offset_ = got_offset;
1171 }
1172 else
1173 {
1174 for (Got_offset_list* g = this; g != NULL; g = g->got_next_)
1175 {
1176 if (g->got_type_ == got_type)
1177 {
1178 g->got_offset_ = got_offset;
1179 return;
1180 }
1181 }
1182 Got_offset_list* g = new Got_offset_list(got_type, got_offset);
1183 g->got_next_ = this->got_next_;
1184 this->got_next_ = g;
1185 }
1186 }
1187
1188 // Return the offset for a GOT entry of type GOT_TYPE.
1189 unsigned int
1190 get_offset(unsigned int got_type) const
1191 {
1192 for (const Got_offset_list* g = this; g != NULL; g = g->got_next_)
1193 {
1194 if (g->got_type_ == got_type)
1195 return g->got_offset_;
1196 }
1197 return -1U;
1198 }
1199
1200 private:
1201 unsigned int got_type_;
1202 unsigned int got_offset_;
1203 Got_offset_list* got_next_;
1204};
1205
14bfc3f5 1206// A regular object file. This is size and endian specific.
bae7f79e
ILT
1207
1208template<int size, bool big_endian>
f6ce93d6 1209class Sized_relobj : public Relobj
bae7f79e
ILT
1210{
1211 public:
c06b7b0b 1212 typedef typename elfcpp::Elf_types<size>::Elf_Addr Address;
730cdc88 1213 typedef std::vector<Symbol*> Symbols;
b8e6aad9 1214 typedef std::vector<Symbol_value<size> > Local_values;
c06b7b0b 1215
eff45813
CC
1216 static const Address invalid_address = static_cast<Address>(0) - 1;
1217
f6ce93d6 1218 Sized_relobj(const std::string& name, Input_file* input_file, off_t offset,
bae7f79e
ILT
1219 const typename elfcpp::Ehdr<size, big_endian>&);
1220
f6ce93d6 1221 ~Sized_relobj();
bae7f79e 1222
a2fb1b05 1223 // Set up the object file based on the ELF header.
bae7f79e
ILT
1224 void
1225 setup(const typename elfcpp::Ehdr<size, big_endian>&);
1226
7d9e3d98
ILT
1227 // Return the number of symbols. This is only valid after
1228 // Object::add_symbols has been called.
1229 unsigned int
1230 symbol_count() const
1231 { return this->local_symbol_count_ + this->symbols_.size(); }
1232
730cdc88
ILT
1233 // If SYM is the index of a global symbol in the object file's
1234 // symbol table, return the Symbol object. Otherwise, return NULL.
1235 Symbol*
1236 global_symbol(unsigned int sym) const
1237 {
1238 if (sym >= this->local_symbol_count_)
1239 {
1240 gold_assert(sym - this->local_symbol_count_ < this->symbols_.size());
1241 return this->symbols_[sym - this->local_symbol_count_];
1242 }
1243 return NULL;
1244 }
1245
1246 // Return the section index of symbol SYM. Set *VALUE to its value
d491d34e
ILT
1247 // in the object file. Set *IS_ORDINARY if this is an ordinary
1248 // section index, not a special code between SHN_LORESERVE and
1249 // SHN_HIRESERVE. Note that for a symbol which is not defined in
1250 // this object file, this will set *VALUE to 0 and return SHN_UNDEF;
1251 // it will not return the final value of the symbol in the link.
730cdc88 1252 unsigned int
d491d34e 1253 symbol_section_and_value(unsigned int sym, Address* value, bool* is_ordinary);
730cdc88
ILT
1254
1255 // Return a pointer to the Symbol_value structure which holds the
1256 // value of a local symbol.
1257 const Symbol_value<size>*
1258 local_symbol(unsigned int sym) const
1259 {
1260 gold_assert(sym < this->local_values_.size());
1261 return &this->local_values_[sym];
1262 }
1263
c06b7b0b
ILT
1264 // Return the index of local symbol SYM in the ordinary symbol
1265 // table. A value of -1U means that the symbol is not being output.
1266 unsigned int
1267 symtab_index(unsigned int sym) const
1268 {
b8e6aad9
ILT
1269 gold_assert(sym < this->local_values_.size());
1270 return this->local_values_[sym].output_symtab_index();
c06b7b0b
ILT
1271 }
1272
7bf1f802
ILT
1273 // Return the index of local symbol SYM in the dynamic symbol
1274 // table. A value of -1U means that the symbol is not being output.
1275 unsigned int
1276 dynsym_index(unsigned int sym) const
1277 {
1278 gold_assert(sym < this->local_values_.size());
1279 return this->local_values_[sym].output_dynsym_index();
1280 }
1281
6a74a719
ILT
1282 // Return the input section index of local symbol SYM.
1283 unsigned int
d491d34e 1284 local_symbol_input_shndx(unsigned int sym, bool* is_ordinary) const
6a74a719
ILT
1285 {
1286 gold_assert(sym < this->local_values_.size());
d491d34e 1287 return this->local_values_[sym].input_shndx(is_ordinary);
6a74a719
ILT
1288 }
1289
e727fa71
ILT
1290 // Return the appropriate Sized_target structure.
1291 Sized_target<size, big_endian>*
1292 sized_target()
7d1a9ebb 1293 { return this->Object::sized_target<size, big_endian>(); }
e727fa71 1294
d1f003c6 1295 // Record that local symbol SYM needs a dynamic symbol entry.
7bf1f802
ILT
1296 void
1297 set_needs_output_dynsym_entry(unsigned int sym)
1298 {
1299 gold_assert(sym < this->local_values_.size());
1300 this->local_values_[sym].set_needs_output_dynsym_entry();
1301 }
1302
e727fa71 1303 // Return whether the local symbol SYMNDX has a GOT offset.
07f397ab 1304 // For TLS symbols, the GOT entry will hold its tp-relative offset.
e727fa71 1305 bool
0a65a3a7 1306 local_has_got_offset(unsigned int symndx, unsigned int got_type) const
e727fa71 1307 {
0a65a3a7
CC
1308 Local_got_offsets::const_iterator p =
1309 this->local_got_offsets_.find(symndx);
1310 return (p != this->local_got_offsets_.end()
1311 && p->second->get_offset(got_type) != -1U);
e727fa71
ILT
1312 }
1313
1314 // Return the GOT offset of the local symbol SYMNDX.
1315 unsigned int
0a65a3a7 1316 local_got_offset(unsigned int symndx, unsigned int got_type) const
e727fa71
ILT
1317 {
1318 Local_got_offsets::const_iterator p =
1319 this->local_got_offsets_.find(symndx);
1320 gold_assert(p != this->local_got_offsets_.end());
0a65a3a7
CC
1321 unsigned int off = p->second->get_offset(got_type);
1322 gold_assert(off != -1U);
1323 return off;
e727fa71
ILT
1324 }
1325
1326 // Set the GOT offset of the local symbol SYMNDX to GOT_OFFSET.
1327 void
0a65a3a7
CC
1328 set_local_got_offset(unsigned int symndx, unsigned int got_type,
1329 unsigned int got_offset)
07f397ab 1330 {
0a65a3a7
CC
1331 Local_got_offsets::const_iterator p =
1332 this->local_got_offsets_.find(symndx);
1333 if (p != this->local_got_offsets_.end())
1334 p->second->set_offset(got_type, got_offset);
07f397ab
ILT
1335 else
1336 {
0a65a3a7
CC
1337 Got_offset_list* g = new Got_offset_list(got_type, got_offset);
1338 std::pair<Local_got_offsets::iterator, bool> ins =
1339 this->local_got_offsets_.insert(std::make_pair(symndx, g));
07f397ab
ILT
1340 gold_assert(ins.second);
1341 }
1342 }
1343
ef9beddf
ILT
1344 // Get the offset of input section SHNDX within its output section.
1345 // This is -1 if the input section requires a special mapping, such
1346 // as a merge section. The output section can be found in the
1347 // output_sections_ field of the parent class Relobj.
1348 Address
1349 get_output_section_offset(unsigned int shndx) const
1350 {
1351 gold_assert(shndx < this->section_offsets_.size());
1352 return this->section_offsets_[shndx];
1353 }
1354
f7e2ee48
ILT
1355 // Return the name of the symbol that spans the given offset in the
1356 // specified section in this object. This is used only for error
1357 // messages and is not particularly efficient.
1358 bool
1359 get_symbol_location_info(unsigned int shndx, off_t offset,
1360 Symbol_location_info* info);
1361
e94cf127
CC
1362 // Look for a kept section corresponding to the given discarded section,
1363 // and return its output address. This is used only for relocations in
1364 // debugging sections.
1365 Address
1366 map_to_kept_section(unsigned int shndx, bool* found) const;
1367
6d013333 1368 protected:
a2fb1b05 1369 // Read the symbols.
bae7f79e 1370 void
12e14209 1371 do_read_symbols(Read_symbols_data*);
14bfc3f5 1372
6d013333
ILT
1373 // Return the number of local symbols.
1374 unsigned int
1375 do_local_symbol_count() const
1376 { return this->local_symbol_count_; }
1377
dbe717ef
ILT
1378 // Lay out the input sections.
1379 void
7e1edb90 1380 do_layout(Symbol_table*, Layout*, Read_symbols_data*);
dbe717ef 1381
5995b570
CC
1382 // Layout sections whose layout was deferred while waiting for
1383 // input files from a plugin.
1384 void
1385 do_layout_deferred_sections(Layout*);
1386
12e14209
ILT
1387 // Add the symbols to the symbol table.
1388 void
1389 do_add_symbols(Symbol_table*, Read_symbols_data*);
a2fb1b05 1390
92e059d8
ILT
1391 // Read the relocs.
1392 void
1393 do_read_relocs(Read_relocs_data*);
1394
1395 // Scan the relocs and adjust the symbol table.
1396 void
ead1e424
ILT
1397 do_scan_relocs(const General_options&, Symbol_table*, Layout*,
1398 Read_relocs_data*);
92e059d8 1399
7bf1f802
ILT
1400 // Count the local symbols.
1401 void
1402 do_count_local_symbols(Stringpool_template<char>*,
1403 Stringpool_template<char>*);
1404
75f65a3e 1405 // Finalize the local symbols.
c06b7b0b 1406 unsigned int
7bf1f802
ILT
1407 do_finalize_local_symbols(unsigned int, off_t);
1408
1409 // Set the offset where local dynamic symbol information will be stored.
1410 unsigned int
1411 do_set_local_dynsym_indexes(unsigned int);
1412
1413 // Set the offset where local dynamic symbol information will be stored.
1414 unsigned int
1415 do_set_local_dynsym_offset(off_t);
75f65a3e 1416
61ba1cf9
ILT
1417 // Relocate the input sections and write out the local symbols.
1418 void
1419 do_relocate(const General_options& options, const Symbol_table* symtab,
92e059d8
ILT
1420 const Layout*, Output_file* of);
1421
a445fddf
ILT
1422 // Get the size of a section.
1423 uint64_t
1424 do_section_size(unsigned int shndx)
1425 { return this->elf_file_.section_size(shndx); }
1426
92e059d8
ILT
1427 // Get the name of a section.
1428 std::string
645f8123
ILT
1429 do_section_name(unsigned int shndx)
1430 { return this->elf_file_.section_name(shndx); }
61ba1cf9 1431
645f8123 1432 // Return the location of the contents of a section.
dbe717ef 1433 Object::Location
645f8123
ILT
1434 do_section_contents(unsigned int shndx)
1435 { return this->elf_file_.section_contents(shndx); }
f6ce93d6 1436
a3ad94ed
ILT
1437 // Return section flags.
1438 uint64_t
1439 do_section_flags(unsigned int shndx)
1440 { return this->elf_file_.section_flags(shndx); }
1441
88dd47ac
ILT
1442 // Return section address.
1443 uint64_t
1444 do_section_address(unsigned int shndx)
1445 { return this->elf_file_.section_addr(shndx); }
1446
730cdc88
ILT
1447 // Return section type.
1448 unsigned int
1449 do_section_type(unsigned int shndx)
1450 { return this->elf_file_.section_type(shndx); }
1451
f7e2ee48
ILT
1452 // Return the section link field.
1453 unsigned int
1454 do_section_link(unsigned int shndx)
1455 { return this->elf_file_.section_link(shndx); }
1456
4c50553d
ILT
1457 // Return the section info field.
1458 unsigned int
1459 do_section_info(unsigned int shndx)
1460 { return this->elf_file_.section_info(shndx); }
1461
a445fddf
ILT
1462 // Return the section alignment.
1463 uint64_t
1464 do_section_addralign(unsigned int shndx)
1465 { return this->elf_file_.section_addralign(shndx); }
1466
d491d34e
ILT
1467 // Return the Xindex structure to use.
1468 Xindex*
1469 do_initialize_xindex();
1470
92de84a6
ILT
1471 // Get symbol counts.
1472 void
1473 do_get_global_symbol_counts(const Symbol_table*, size_t*, size_t*) const;
1474
ef9beddf
ILT
1475 // Get the offset of a section.
1476 uint64_t
1477 do_output_section_offset(unsigned int shndx) const
eff45813
CC
1478 {
1479 Address off = this->get_output_section_offset(shndx);
1480 if (off == invalid_address)
1481 return -1ULL;
1482 return off;
1483 }
ef9beddf
ILT
1484
1485 // Set the offset of a section.
1486 void
1487 do_set_section_offset(unsigned int shndx, uint64_t off)
1488 {
1489 gold_assert(shndx < this->section_offsets_.size());
1490 this->section_offsets_[shndx] = convert_types<Address, uint64_t>(off);
1491 }
1492
bae7f79e 1493 private:
a2fb1b05 1494 // For convenience.
f6ce93d6 1495 typedef Sized_relobj<size, big_endian> This;
a2fb1b05
ILT
1496 static const int ehdr_size = elfcpp::Elf_sizes<size>::ehdr_size;
1497 static const int shdr_size = elfcpp::Elf_sizes<size>::shdr_size;
1498 static const int sym_size = elfcpp::Elf_sizes<size>::sym_size;
75f65a3e
ILT
1499 typedef elfcpp::Shdr<size, big_endian> Shdr;
1500
ef9beddf
ILT
1501 // To keep track of discarded comdat sections, we need to map a member
1502 // section index to the object and section index of the corresponding
1503 // kept section.
1504 struct Kept_comdat_section
1505 {
1506 Kept_comdat_section(Sized_relobj<size, big_endian>* object,
1507 unsigned int shndx)
1508 : object_(object), shndx_(shndx)
1509 { }
1510 Sized_relobj<size, big_endian>* object_;
1511 unsigned int shndx_;
1512 };
1513 typedef std::map<unsigned int, Kept_comdat_section*>
1514 Kept_comdat_section_table;
1515
1516 // Information needed to keep track of kept comdat groups. This is
1517 // simply a map from the section name to its section index. This may
1518 // not be a one-to-one mapping, but we ignore that possibility since
1519 // this is used only to attempt to handle stray relocations from
1520 // non-comdat debug sections that refer to comdat loadable sections.
1521 typedef Unordered_map<std::string, unsigned int> Comdat_group;
1522
1523 // A map from group section index to the table of group members.
1524 typedef std::map<unsigned int, Comdat_group*> Comdat_group_table;
1525
1526 // Find a comdat group table given its group section SHNDX.
1527 Comdat_group*
1528 find_comdat_group(unsigned int shndx) const
1529 {
1530 Comdat_group_table::const_iterator p =
1531 this->comdat_groups_.find(shndx);
1532 if (p != this->comdat_groups_.end())
1533 return p->second;
1534 return NULL;
1535 }
1536
1537 // Record a new comdat group whose group section index is SHNDX.
1538 void
1539 add_comdat_group(unsigned int shndx, Comdat_group* group)
1540 { this->comdat_groups_[shndx] = group; }
1541
d491d34e
ILT
1542 // Adjust a section index if necessary.
1543 unsigned int
1544 adjust_shndx(unsigned int shndx)
1545 {
1546 if (shndx >= elfcpp::SHN_LORESERVE)
1547 shndx += this->elf_file_.large_shndx_offset();
1548 return shndx;
1549 }
1550
dbe717ef
ILT
1551 // Find the SHT_SYMTAB section, given the section headers.
1552 void
1553 find_symtab(const unsigned char* pshdrs);
1554
730cdc88
ILT
1555 // Return whether SHDR has the right flags for a GNU style exception
1556 // frame section.
1557 bool
1558 check_eh_frame_flags(const elfcpp::Shdr<size, big_endian>* shdr) const;
1559
1560 // Return whether there is a section named .eh_frame which might be
1561 // a GNU style exception frame section.
1562 bool
1563 find_eh_frame(const unsigned char* pshdrs, const char* names,
8383303e 1564 section_size_type names_size) const;
730cdc88 1565
a2fb1b05
ILT
1566 // Whether to include a section group in the link.
1567 bool
6a74a719 1568 include_section_group(Symbol_table*, Layout*, unsigned int, const char*,
e94cf127 1569 const unsigned char*, const char *, section_size_type,
a2fb1b05
ILT
1570 std::vector<bool>*);
1571
1572 // Whether to include a linkonce section in the link.
1573 bool
e94cf127 1574 include_linkonce_section(Layout*, unsigned int, const char*,
a2fb1b05
ILT
1575 const elfcpp::Shdr<size, big_endian>&);
1576
5995b570
CC
1577 // Layout an input section.
1578 void
1579 layout_section(Layout* layout, unsigned int shndx, const char* name,
1580 typename This::Shdr& shdr, unsigned int reloc_shndx,
1581 unsigned int reloc_type);
1582
61ba1cf9
ILT
1583 // Views and sizes when relocating.
1584 struct View_size
1585 {
1586 unsigned char* view;
1587 typename elfcpp::Elf_types<size>::Elf_Addr address;
1588 off_t offset;
8383303e 1589 section_size_type view_size;
730cdc88 1590 bool is_input_output_view;
96803768 1591 bool is_postprocessing_view;
61ba1cf9
ILT
1592 };
1593
1594 typedef std::vector<View_size> Views;
1595
1596 // Write section data to the output file. Record the views and
1597 // sizes in VIEWS for use when relocating.
1598 void
cb295612 1599 write_sections(const unsigned char* pshdrs, Output_file*, Views*);
61ba1cf9
ILT
1600
1601 // Relocate the sections in the output file.
1602 void
92e059d8
ILT
1603 relocate_sections(const General_options& options, const Symbol_table*,
1604 const Layout*, const unsigned char* pshdrs, Views*);
61ba1cf9 1605
7019cd25
ILT
1606 // Scan the input relocations for --emit-relocs.
1607 void
1608 emit_relocs_scan(const General_options&, Symbol_table*, Layout*,
1609 const unsigned char* plocal_syms,
1610 const Read_relocs_data::Relocs_list::iterator&);
1611
1612 // Scan the input relocations for --emit-relocs, templatized on the
1613 // type of the relocation section.
1614 template<int sh_type>
1615 void
1616 emit_relocs_scan_reltype(const General_options&, Symbol_table*, Layout*,
1617 const unsigned char* plocal_syms,
1618 const Read_relocs_data::Relocs_list::iterator&,
1619 Relocatable_relocs*);
1620
1621 // Emit the relocs for --emit-relocs.
1622 void
1623 emit_relocs(const Relocate_info<size, big_endian>*, unsigned int,
1624 unsigned int sh_type, const unsigned char* prelocs,
ef9beddf 1625 size_t reloc_count, Output_section*, Address output_offset,
7019cd25
ILT
1626 unsigned char* view, Address address,
1627 section_size_type view_size,
1628 unsigned char* reloc_view, section_size_type reloc_view_size);
1629
1630 // Emit the relocs for --emit-relocs, templatized on the type of the
1631 // relocation section.
1632 template<int sh_type>
1633 void
1634 emit_relocs_reltype(const Relocate_info<size, big_endian>*, unsigned int,
1635 const unsigned char* prelocs, size_t reloc_count,
ef9beddf 1636 Output_section*, Address output_offset,
7019cd25
ILT
1637 unsigned char* view, Address address,
1638 section_size_type view_size,
1639 unsigned char* reloc_view,
1640 section_size_type reloc_view_size);
1641
a9a60db6
ILT
1642 // Initialize input to output maps for section symbols in merged
1643 // sections.
1644 void
1645 initialize_input_to_output_maps();
1646
1647 // Free the input to output maps for section symbols in merged
1648 // sections.
1649 void
1650 free_input_to_output_maps();
1651
61ba1cf9
ILT
1652 // Write out the local symbols.
1653 void
b8e6aad9 1654 write_local_symbols(Output_file*,
7bf1f802 1655 const Stringpool_template<char>*,
d491d34e
ILT
1656 const Stringpool_template<char>*,
1657 Output_symtab_xindex*,
1658 Output_symtab_xindex*);
61ba1cf9 1659
cb295612
ILT
1660 // Clear the local symbol information.
1661 void
1662 clear_local_symbols()
1663 {
1664 this->local_values_.clear();
1665 this->local_got_offsets_.clear();
cb295612
ILT
1666 }
1667
ef9beddf
ILT
1668 // Record a mapping from discarded section SHNDX to the corresponding
1669 // kept section.
1670 void
1671 set_kept_comdat_section(unsigned int shndx, Kept_comdat_section* kept)
1672 {
1673 this->kept_comdat_sections_[shndx] = kept;
1674 }
1675
1676 // Find the kept section corresponding to the discarded section SHNDX.
1677 Kept_comdat_section*
1678 get_kept_comdat_section(unsigned int shndx) const
1679 {
1680 typename Kept_comdat_section_table::const_iterator p =
1681 this->kept_comdat_sections_.find(shndx);
1682 if (p == this->kept_comdat_sections_.end())
1683 return NULL;
1684 return p->second;
1685 }
1686
07f397ab
ILT
1687 // The GOT offsets of local symbols. This map also stores GOT offsets
1688 // for tp-relative offsets for TLS symbols.
0a65a3a7 1689 typedef Unordered_map<unsigned int, Got_offset_list*> Local_got_offsets;
e727fa71 1690
07f397ab
ILT
1691 // The TLS GOT offsets of local symbols. The map stores the offsets
1692 // for either a single GOT entry that holds the module index of a TLS
1693 // symbol, or a pair of GOT entries containing the module index and
1694 // dtv-relative offset.
1695 struct Tls_got_entry
1696 {
1697 Tls_got_entry(int got_offset, bool have_pair)
1698 : got_offset_(got_offset),
1699 have_pair_(have_pair)
1700 { }
1701 int got_offset_;
1702 bool have_pair_;
1703 };
1704 typedef Unordered_map<unsigned int, Tls_got_entry> Local_tls_got_offsets;
1705
5995b570
CC
1706 // Saved information for sections whose layout was deferred.
1707 struct Deferred_layout
1708 {
1709 static const int shdr_size = elfcpp::Elf_sizes<size>::shdr_size;
1710 Deferred_layout(unsigned int shndx, const char* name,
1711 const unsigned char* pshdr,
1712 unsigned int reloc_shndx, unsigned int reloc_type)
1713 : shndx_(shndx), name_(name), reloc_shndx_(reloc_shndx),
1714 reloc_type_(reloc_type)
1715 {
1716 memcpy(this->shdr_data_, pshdr, shdr_size);
1717 }
1718 unsigned int shndx_;
1719 std::string name_;
1720 unsigned int reloc_shndx_;
1721 unsigned int reloc_type_;
1722 unsigned char shdr_data_[shdr_size];
1723 };
1724
645f8123
ILT
1725 // General access to the ELF file.
1726 elfcpp::Elf_file<size, big_endian, Object> elf_file_;
bae7f79e 1727 // Index of SHT_SYMTAB section.
645f8123 1728 unsigned int symtab_shndx_;
61ba1cf9
ILT
1729 // The number of local symbols.
1730 unsigned int local_symbol_count_;
1731 // The number of local symbols which go into the output file.
1732 unsigned int output_local_symbol_count_;
7bf1f802
ILT
1733 // The number of local symbols which go into the output file's dynamic
1734 // symbol table.
1735 unsigned int output_local_dynsym_count_;
14bfc3f5 1736 // The entries in the symbol table for the external symbols.
730cdc88 1737 Symbols symbols_;
92de84a6
ILT
1738 // Number of symbols defined in object file itself.
1739 size_t defined_count_;
75f65a3e
ILT
1740 // File offset for local symbols.
1741 off_t local_symbol_offset_;
7bf1f802
ILT
1742 // File offset for local dynamic symbols.
1743 off_t local_dynsym_offset_;
61ba1cf9 1744 // Values of local symbols.
c06b7b0b 1745 Local_values local_values_;
07f397ab
ILT
1746 // GOT offsets for local non-TLS symbols, and tp-relative offsets
1747 // for TLS symbols, indexed by symbol number.
e727fa71 1748 Local_got_offsets local_got_offsets_;
ef9beddf 1749 // For each input section, the offset of the input section in its
eff45813 1750 // output section. This is INVALID_ADDRESS if the input section requires a
ef9beddf
ILT
1751 // special mapping.
1752 std::vector<Address> section_offsets_;
1753 // Table mapping discarded comdat sections to corresponding kept sections.
1754 Kept_comdat_section_table kept_comdat_sections_;
1755 // Table of kept comdat groups.
1756 Comdat_group_table comdat_groups_;
730cdc88
ILT
1757 // Whether this object has a GNU style .eh_frame section.
1758 bool has_eh_frame_;
5995b570
CC
1759 // The list of sections whose layout was deferred.
1760 std::vector<Deferred_layout> deferred_layout_;
bae7f79e
ILT
1761};
1762
54dc6425 1763// A class to manage the list of all objects.
a2fb1b05 1764
54dc6425
ILT
1765class Input_objects
1766{
1767 public:
1768 Input_objects()
92de84a6
ILT
1769 : relobj_list_(), dynobj_list_(), sonames_(), system_library_directory_(),
1770 cref_(NULL)
54dc6425
ILT
1771 { }
1772
f6ce93d6
ILT
1773 // The type of the list of input relocateable objects.
1774 typedef std::vector<Relobj*> Relobj_list;
1775 typedef Relobj_list::const_iterator Relobj_iterator;
1776
1777 // The type of the list of input dynamic objects.
1778 typedef std::vector<Dynobj*> Dynobj_list;
1779 typedef Dynobj_list::const_iterator Dynobj_iterator;
54dc6425 1780
008db82e
ILT
1781 // Add an object to the list. Return true if all is well, or false
1782 // if this object should be ignored.
1783 bool
54dc6425
ILT
1784 add_object(Object*);
1785
92de84a6
ILT
1786 // Start processing an archive.
1787 void
1788 archive_start(Archive*);
1789
1790 // Stop processing an archive.
1791 void
1792 archive_stop(Archive*);
1793
e2827e5f
ILT
1794 // For each dynamic object, check whether we've seen all of its
1795 // explicit dependencies.
1796 void
1797 check_dynamic_dependencies() const;
1798
9a2d6984
ILT
1799 // Return whether an object was found in the system library
1800 // directory.
1801 bool
1802 found_in_system_library_directory(const Object*) const;
1803
92de84a6
ILT
1804 // Print symbol counts.
1805 void
1806 print_symbol_counts(const Symbol_table*) const;
1807
f6ce93d6
ILT
1808 // Iterate over all regular objects.
1809
1810 Relobj_iterator
1811 relobj_begin() const
1812 { return this->relobj_list_.begin(); }
1813
1814 Relobj_iterator
1815 relobj_end() const
1816 { return this->relobj_list_.end(); }
1817
1818 // Iterate over all dynamic objects.
1819
1820 Dynobj_iterator
1821 dynobj_begin() const
1822 { return this->dynobj_list_.begin(); }
54dc6425 1823
f6ce93d6
ILT
1824 Dynobj_iterator
1825 dynobj_end() const
1826 { return this->dynobj_list_.end(); }
54dc6425
ILT
1827
1828 // Return whether we have seen any dynamic objects.
1829 bool
1830 any_dynamic() const
f6ce93d6 1831 { return !this->dynobj_list_.empty(); }
54dc6425 1832
fe9a4c12
ILT
1833 // Return the number of input objects.
1834 int
1835 number_of_input_objects() const
1836 { return this->relobj_list_.size() + this->dynobj_list_.size(); }
1837
54dc6425
ILT
1838 private:
1839 Input_objects(const Input_objects&);
1840 Input_objects& operator=(const Input_objects&);
1841
008db82e 1842 // The list of ordinary objects included in the link.
f6ce93d6 1843 Relobj_list relobj_list_;
008db82e 1844 // The list of dynamic objects included in the link.
f6ce93d6 1845 Dynobj_list dynobj_list_;
008db82e
ILT
1846 // SONAMEs that we have seen.
1847 Unordered_set<std::string> sonames_;
9a2d6984
ILT
1848 // The directory in which we find the libc.so.
1849 std::string system_library_directory_;
92de84a6
ILT
1850 // Manage cross-references if requested.
1851 Cref* cref_;
54dc6425 1852};
a2fb1b05 1853
92e059d8
ILT
1854// Some of the information we pass to the relocation routines. We
1855// group this together to avoid passing a dozen different arguments.
1856
1857template<int size, bool big_endian>
1858struct Relocate_info
1859{
1860 // Command line options.
1861 const General_options* options;
1862 // Symbol table.
1863 const Symbol_table* symtab;
1864 // Layout.
1865 const Layout* layout;
1866 // Object being relocated.
f6ce93d6 1867 Sized_relobj<size, big_endian>* object;
92e059d8
ILT
1868 // Section index of relocation section.
1869 unsigned int reloc_shndx;
1870 // Section index of section being relocated.
1871 unsigned int data_shndx;
1872
1873 // Return a string showing the location of a relocation. This is
1874 // only used for error messages.
1875 std::string
1876 location(size_t relnum, off_t reloffset) const;
1877};
1878
bae7f79e
ILT
1879// Return an Object appropriate for the input file. P is BYTES long,
1880// and holds the ELF header.
1881
61ba1cf9
ILT
1882extern Object*
1883make_elf_object(const std::string& name, Input_file*,
1884 off_t offset, const unsigned char* p,
8383303e 1885 section_offset_type bytes);
bae7f79e
ILT
1886
1887} // end namespace gold
1888
1889#endif // !defined(GOLD_OBJECT_H)
This page took 0.19472 seconds and 4 git commands to generate.