From Andrew Chatham: add signedrel<>, rel32s and friends.
[deliverable/binutils-gdb.git] / gold / reloc.cc
CommitLineData
61ba1cf9
ILT
1// reloc.cc -- relocate input files for gold.
2
6cb15b7f
ILT
3// Copyright 2006, 2007 Free Software Foundation, Inc.
4// Written by Ian Lance Taylor <iant@google.com>.
5
6// This file is part of gold.
7
8// This program is free software; you can redistribute it and/or modify
9// it under the terms of the GNU General Public License as published by
10// the Free Software Foundation; either version 3 of the License, or
11// (at your option) any later version.
12
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21// MA 02110-1301, USA.
22
61ba1cf9
ILT
23#include "gold.h"
24
25#include "workqueue.h"
26#include "object.h"
5a6f7e2d 27#include "symtab.h"
61ba1cf9
ILT
28#include "output.h"
29#include "reloc.h"
30
31namespace gold
32{
33
92e059d8
ILT
34// Read_relocs methods.
35
36// These tasks just read the relocation information from the file.
37// After reading it, the start another task to process the
38// information. These tasks requires access to the file.
39
40Task::Is_runnable_type
41Read_relocs::is_runnable(Workqueue*)
42{
43 return this->object_->is_locked() ? IS_LOCKED : IS_RUNNABLE;
44}
45
46// Lock the file.
47
48Task_locker*
49Read_relocs::locks(Workqueue*)
50{
51 return new Task_locker_obj<Object>(*this->object_);
52}
53
54// Read the relocations and then start a Scan_relocs_task.
55
56void
57Read_relocs::run(Workqueue* workqueue)
58{
59 Read_relocs_data *rd = new Read_relocs_data;
60 this->object_->read_relocs(rd);
61 workqueue->queue_front(new Scan_relocs(this->options_, this->symtab_,
ead1e424
ILT
62 this->layout_, this->object_, rd,
63 this->symtab_lock_, this->blocker_));
92e059d8
ILT
64}
65
66// Scan_relocs methods.
67
68// These tasks scan the relocations read by Read_relocs and mark up
69// the symbol table to indicate which relocations are required. We
70// use a lock on the symbol table to keep them from interfering with
71// each other.
72
73Task::Is_runnable_type
74Scan_relocs::is_runnable(Workqueue*)
75{
ead1e424
ILT
76 if (!this->symtab_lock_->is_writable() || this->object_->is_locked())
77 return IS_LOCKED;
78 return IS_RUNNABLE;
92e059d8
ILT
79}
80
81// Return the locks we hold: one on the file, one on the symbol table
82// and one blocker.
83
84class Scan_relocs::Scan_relocs_locker : public Task_locker
85{
86 public:
87 Scan_relocs_locker(Object* object, Task_token& symtab_lock, Task* task,
88 Task_token& blocker, Workqueue* workqueue)
89 : objlock_(*object), symtab_locker_(symtab_lock, task),
90 blocker_(blocker, workqueue)
91 { }
92
93 private:
94 Task_locker_obj<Object> objlock_;
95 Task_locker_write symtab_locker_;
96 Task_locker_block blocker_;
97};
98
99Task_locker*
100Scan_relocs::locks(Workqueue* workqueue)
101{
102 return new Scan_relocs_locker(this->object_, *this->symtab_lock_, this,
103 *this->blocker_, workqueue);
104}
105
106// Scan the relocs.
107
108void
109Scan_relocs::run(Workqueue*)
110{
ead1e424
ILT
111 this->object_->scan_relocs(this->options_, this->symtab_, this->layout_,
112 this->rd_);
92e059d8
ILT
113 delete this->rd_;
114 this->rd_ = NULL;
115}
116
61ba1cf9
ILT
117// Relocate_task methods.
118
119// These tasks are always runnable.
120
121Task::Is_runnable_type
122Relocate_task::is_runnable(Workqueue*)
123{
124 return IS_RUNNABLE;
125}
126
127// We want to lock the file while we run. We want to unblock
128// FINAL_BLOCKER when we are done.
129
130class Relocate_task::Relocate_locker : public Task_locker
131{
132 public:
133 Relocate_locker(Task_token& token, Workqueue* workqueue,
134 Object* object)
135 : blocker_(token, workqueue), objlock_(*object)
136 { }
137
138 private:
139 Task_locker_block blocker_;
140 Task_locker_obj<Object> objlock_;
141};
142
143Task_locker*
144Relocate_task::locks(Workqueue* workqueue)
145{
146 return new Relocate_locker(*this->final_blocker_, workqueue,
147 this->object_);
148}
149
150// Run the task.
151
152void
153Relocate_task::run(Workqueue*)
154{
92e059d8 155 this->object_->relocate(this->options_, this->symtab_, this->layout_,
61ba1cf9
ILT
156 this->of_);
157}
158
92e059d8
ILT
159// Read the relocs and local symbols from the object file and store
160// the information in RD.
161
162template<int size, bool big_endian>
163void
f6ce93d6 164Sized_relobj<size, big_endian>::do_read_relocs(Read_relocs_data* rd)
92e059d8
ILT
165{
166 rd->relocs.clear();
167
168 unsigned int shnum = this->shnum();
169 if (shnum == 0)
170 return;
171
172 rd->relocs.reserve(shnum / 2);
173
645f8123 174 const unsigned char *pshdrs = this->get_view(this->elf_file_.shoff(),
9eb9fa57
ILT
175 shnum * This::shdr_size,
176 true);
92e059d8
ILT
177 // Skip the first, dummy, section.
178 const unsigned char *ps = pshdrs + This::shdr_size;
179 for (unsigned int i = 1; i < shnum; ++i, ps += This::shdr_size)
180 {
181 typename This::Shdr shdr(ps);
182
183 unsigned int sh_type = shdr.get_sh_type();
184 if (sh_type != elfcpp::SHT_REL && sh_type != elfcpp::SHT_RELA)
185 continue;
186
187 unsigned int shndx = shdr.get_sh_info();
188 if (shndx >= shnum)
189 {
190 fprintf(stderr, _("%s: %s: relocation section %u has bad info %u\n"),
191 program_name, this->name().c_str(), i, shndx);
192 gold_exit(false);
193 }
194
195 if (!this->is_section_included(shndx))
196 continue;
197
ead1e424
ILT
198 // We are scanning relocations in order to fill out the GOT and
199 // PLT sections. Relocations for sections which are not
200 // allocated (typically debugging sections) should not add new
201 // GOT and PLT entries. So we skip them.
202 typename This::Shdr secshdr(pshdrs + shndx * This::shdr_size);
203 if ((secshdr.get_sh_flags() & elfcpp::SHF_ALLOC) == 0)
204 continue;
205
645f8123 206 if (shdr.get_sh_link() != this->symtab_shndx_)
92e059d8
ILT
207 {
208 fprintf(stderr,
209 _("%s: %s: relocation section %u uses unexpected "
210 "symbol table %u\n"),
211 program_name, this->name().c_str(), i, shdr.get_sh_link());
212 gold_exit(false);
213 }
214
215 off_t sh_size = shdr.get_sh_size();
216
217 unsigned int reloc_size;
218 if (sh_type == elfcpp::SHT_REL)
219 reloc_size = elfcpp::Elf_sizes<size>::rel_size;
220 else
221 reloc_size = elfcpp::Elf_sizes<size>::rela_size;
222 if (reloc_size != shdr.get_sh_entsize())
223 {
224 fprintf(stderr,
225 _("%s: %s: unexpected entsize for reloc section %u: "
226 "%lu != %u"),
227 program_name, this->name().c_str(), i,
228 static_cast<unsigned long>(shdr.get_sh_entsize()),
229 reloc_size);
230 gold_exit(false);
231 }
232
233 size_t reloc_count = sh_size / reloc_size;
234 if (reloc_count * reloc_size != sh_size)
235 {
236 fprintf(stderr, _("%s: %s: reloc section %u size %lu uneven"),
237 program_name, this->name().c_str(), i,
238 static_cast<unsigned long>(sh_size));
239 gold_exit(false);
240 }
241
242 rd->relocs.push_back(Section_relocs());
243 Section_relocs& sr(rd->relocs.back());
244 sr.reloc_shndx = i;
245 sr.data_shndx = shndx;
9eb9fa57
ILT
246 sr.contents = this->get_lasting_view(shdr.get_sh_offset(), sh_size,
247 true);
92e059d8
ILT
248 sr.sh_type = sh_type;
249 sr.reloc_count = reloc_count;
250 }
251
252 // Read the local symbols.
a3ad94ed 253 gold_assert(this->symtab_shndx_ != -1U);
645f8123 254 if (this->symtab_shndx_ == 0 || this->local_symbol_count_ == 0)
92e059d8
ILT
255 rd->local_symbols = NULL;
256 else
257 {
258 typename This::Shdr symtabshdr(pshdrs
645f8123 259 + this->symtab_shndx_ * This::shdr_size);
a3ad94ed 260 gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB);
92e059d8
ILT
261 const int sym_size = This::sym_size;
262 const unsigned int loccount = this->local_symbol_count_;
a3ad94ed 263 gold_assert(loccount == symtabshdr.get_sh_info());
92e059d8
ILT
264 off_t locsize = loccount * sym_size;
265 rd->local_symbols = this->get_lasting_view(symtabshdr.get_sh_offset(),
9eb9fa57 266 locsize, true);
92e059d8
ILT
267 }
268}
269
270// Scan the relocs and adjust the symbol table. This looks for
271// relocations which require GOT/PLT/COPY relocations.
272
273template<int size, bool big_endian>
274void
f6ce93d6 275Sized_relobj<size, big_endian>::do_scan_relocs(const General_options& options,
92e059d8 276 Symbol_table* symtab,
ead1e424 277 Layout* layout,
92e059d8
ILT
278 Read_relocs_data* rd)
279{
280 Sized_target<size, big_endian>* target = this->sized_target();
281
282 const unsigned char* local_symbols;
283 if (rd->local_symbols == NULL)
284 local_symbols = NULL;
285 else
286 local_symbols = rd->local_symbols->data();
287
288 for (Read_relocs_data::Relocs_list::iterator p = rd->relocs.begin();
289 p != rd->relocs.end();
290 ++p)
291 {
a3ad94ed
ILT
292 target->scan_relocs(options, symtab, layout, this, p->data_shndx,
293 p->sh_type, p->contents->data(), p->reloc_count,
92e059d8
ILT
294 this->local_symbol_count_,
295 local_symbols,
296 this->symbols_);
297 delete p->contents;
298 p->contents = NULL;
299 }
300
301 if (rd->local_symbols != NULL)
302 {
303 delete rd->local_symbols;
304 rd->local_symbols = NULL;
305 }
306}
307
61ba1cf9
ILT
308// Relocate the input sections and write out the local symbols.
309
310template<int size, bool big_endian>
311void
f6ce93d6 312Sized_relobj<size, big_endian>::do_relocate(const General_options& options,
61ba1cf9 313 const Symbol_table* symtab,
92e059d8 314 const Layout* layout,
61ba1cf9
ILT
315 Output_file* of)
316{
317 unsigned int shnum = this->shnum();
318
319 // Read the section headers.
645f8123 320 const unsigned char* pshdrs = this->get_view(this->elf_file_.shoff(),
9eb9fa57
ILT
321 shnum * This::shdr_size,
322 true);
61ba1cf9
ILT
323
324 Views views;
325 views.resize(shnum);
326
327 // Make two passes over the sections. The first one copies the
328 // section data to the output file. The second one applies
329 // relocations.
330
331 this->write_sections(pshdrs, of, &views);
332
333 // Apply relocations.
334
92e059d8 335 this->relocate_sections(options, symtab, layout, pshdrs, &views);
61ba1cf9
ILT
336
337 // Write out the accumulated views.
338 for (unsigned int i = 1; i < shnum; ++i)
339 {
340 if (views[i].view != NULL)
341 of->write_output_view(views[i].offset, views[i].view_size,
342 views[i].view);
343 }
344
345 // Write out the local symbols.
92e059d8 346 this->write_local_symbols(of, layout->sympool());
61ba1cf9
ILT
347}
348
349// Write section data to the output file. PSHDRS points to the
350// section headers. Record the views in *PVIEWS for use when
351// relocating.
352
353template<int size, bool big_endian>
354void
f6ce93d6 355Sized_relobj<size, big_endian>::write_sections(const unsigned char* pshdrs,
61ba1cf9
ILT
356 Output_file* of,
357 Views* pviews)
358{
359 unsigned int shnum = this->shnum();
360 std::vector<Map_to_output>& map_sections(this->map_to_output());
361
362 const unsigned char* p = pshdrs + This::shdr_size;
363 for (unsigned int i = 1; i < shnum; ++i, p += This::shdr_size)
364 {
365 View_size* pvs = &(*pviews)[i];
366
367 pvs->view = NULL;
368
b8e6aad9
ILT
369 if (map_sections[i].offset == -1)
370 continue;
371
61ba1cf9
ILT
372 const Output_section* os = map_sections[i].output_section;
373 if (os == NULL)
374 continue;
375
376 typename This::Shdr shdr(p);
377
378 if (shdr.get_sh_type() == elfcpp::SHT_NOBITS)
379 continue;
380
61ba1cf9
ILT
381 off_t start = os->offset() + map_sections[i].offset;
382 off_t sh_size = shdr.get_sh_size();
383
ead1e424
ILT
384 if (sh_size == 0)
385 continue;
386
a3ad94ed
ILT
387 gold_assert(map_sections[i].offset >= 0
388 && map_sections[i].offset + sh_size <= os->data_size());
ead1e424 389
61ba1cf9 390 unsigned char* view = of->get_output_view(start, sh_size);
92e059d8
ILT
391 this->read(shdr.get_sh_offset(), sh_size, view);
392
61ba1cf9
ILT
393 pvs->view = view;
394 pvs->address = os->address() + map_sections[i].offset;
395 pvs->offset = start;
396 pvs->view_size = sh_size;
397 }
398}
399
400// Relocate section data. VIEWS points to the section data as views
401// in the output file.
402
403template<int size, bool big_endian>
404void
f6ce93d6 405Sized_relobj<size, big_endian>::relocate_sections(
92e059d8
ILT
406 const General_options& options,
407 const Symbol_table* symtab,
408 const Layout* layout,
409 const unsigned char* pshdrs,
410 Views* pviews)
61ba1cf9
ILT
411{
412 unsigned int shnum = this->shnum();
61ba1cf9
ILT
413 Sized_target<size, big_endian>* target = this->sized_target();
414
92e059d8
ILT
415 Relocate_info<size, big_endian> relinfo;
416 relinfo.options = &options;
417 relinfo.symtab = symtab;
418 relinfo.layout = layout;
419 relinfo.object = this;
420 relinfo.local_symbol_count = this->local_symbol_count_;
c06b7b0b 421 relinfo.local_values = &this->local_values_;
92e059d8
ILT
422 relinfo.symbols = this->symbols_;
423
61ba1cf9
ILT
424 const unsigned char* p = pshdrs + This::shdr_size;
425 for (unsigned int i = 1; i < shnum; ++i, p += This::shdr_size)
426 {
427 typename This::Shdr shdr(p);
428
429 unsigned int sh_type = shdr.get_sh_type();
430 if (sh_type != elfcpp::SHT_REL && sh_type != elfcpp::SHT_RELA)
431 continue;
432
433 unsigned int index = shdr.get_sh_info();
434 if (index >= this->shnum())
435 {
436 fprintf(stderr, _("%s: %s: relocation section %u has bad info %u\n"),
437 program_name, this->name().c_str(), i, index);
438 gold_exit(false);
439 }
440
92e059d8 441 if (!this->is_section_included(index))
61ba1cf9
ILT
442 {
443 // This relocation section is against a section which we
444 // discarded.
445 continue;
446 }
447
a3ad94ed 448 gold_assert((*pviews)[index].view != NULL);
61ba1cf9 449
645f8123 450 if (shdr.get_sh_link() != this->symtab_shndx_)
61ba1cf9
ILT
451 {
452 fprintf(stderr,
453 _("%s: %s: relocation section %u uses unexpected "
454 "symbol table %u\n"),
455 program_name, this->name().c_str(), i, shdr.get_sh_link());
456 gold_exit(false);
457 }
458
459 off_t sh_size = shdr.get_sh_size();
460 const unsigned char* prelocs = this->get_view(shdr.get_sh_offset(),
9eb9fa57 461 sh_size, false);
61ba1cf9
ILT
462
463 unsigned int reloc_size;
464 if (sh_type == elfcpp::SHT_REL)
465 reloc_size = elfcpp::Elf_sizes<size>::rel_size;
466 else
467 reloc_size = elfcpp::Elf_sizes<size>::rela_size;
468
469 if (reloc_size != shdr.get_sh_entsize())
470 {
471 fprintf(stderr,
472 _("%s: %s: unexpected entsize for reloc section %u: "
473 "%lu != %u"),
474 program_name, this->name().c_str(), i,
475 static_cast<unsigned long>(shdr.get_sh_entsize()),
476 reloc_size);
477 gold_exit(false);
478 }
479
480 size_t reloc_count = sh_size / reloc_size;
481 if (reloc_count * reloc_size != sh_size)
482 {
483 fprintf(stderr, _("%s: %s: reloc section %u size %lu uneven"),
484 program_name, this->name().c_str(), i,
485 static_cast<unsigned long>(sh_size));
486 gold_exit(false);
487 }
488
92e059d8
ILT
489 relinfo.reloc_shndx = i;
490 relinfo.data_shndx = index;
491 target->relocate_section(&relinfo,
492 sh_type,
493 prelocs,
494 reloc_count,
61ba1cf9
ILT
495 (*pviews)[index].view,
496 (*pviews)[index].address,
497 (*pviews)[index].view_size);
498 }
499}
500
5a6f7e2d
ILT
501// Copy_relocs::Copy_reloc_entry methods.
502
503// Return whether we should emit this reloc. We should emit it if the
504// symbol is still defined in a dynamic object. If we should not emit
505// it, we clear it, to save ourselves the test next time.
506
507template<int size, bool big_endian>
508bool
509Copy_relocs<size, big_endian>::Copy_reloc_entry::should_emit()
510{
511 if (this->sym_ == NULL)
512 return false;
14b31740 513 if (this->sym_->is_from_dynobj())
5a6f7e2d
ILT
514 return true;
515 this->sym_ = NULL;
516 return false;
517}
518
519// Emit a reloc into a SHT_REL section.
520
521template<int size, bool big_endian>
522void
523Copy_relocs<size, big_endian>::Copy_reloc_entry::emit(
524 Output_data_reloc<elfcpp::SHT_REL, true, size, big_endian>* reloc_data)
525{
16649710 526 this->sym_->set_needs_dynsym_entry();
5a6f7e2d
ILT
527 reloc_data->add_global(this->sym_, this->reloc_type_, this->relobj_,
528 this->shndx_, this->address_);
529}
530
531// Emit a reloc into a SHT_RELA section.
532
533template<int size, bool big_endian>
534void
535Copy_relocs<size, big_endian>::Copy_reloc_entry::emit(
536 Output_data_reloc<elfcpp::SHT_RELA, true, size, big_endian>* reloc_data)
537{
16649710 538 this->sym_->set_needs_dynsym_entry();
5a6f7e2d
ILT
539 reloc_data->add_global(this->sym_, this->reloc_type_, this->relobj_,
540 this->shndx_, this->address_, this->addend_);
541}
542
543// Copy_relocs methods.
a3ad94ed
ILT
544
545// Return whether we need a COPY reloc for a relocation against GSYM.
546// The relocation is being applied to section SHNDX in OBJECT.
547
548template<int size, bool big_endian>
549bool
5a6f7e2d 550Copy_relocs<size, big_endian>::need_copy_reloc(
a3ad94ed
ILT
551 const General_options*,
552 Relobj* object,
553 unsigned int shndx,
5a6f7e2d 554 Sized_symbol<size>* sym)
a3ad94ed
ILT
555{
556 // FIXME: Handle -z nocopyrelocs.
557
5a6f7e2d
ILT
558 if (sym->symsize() == 0)
559 return false;
560
a3ad94ed
ILT
561 // If this is a readonly section, then we need a COPY reloc.
562 // Otherwise we can use a dynamic reloc.
563 if ((object->section_flags(shndx) & elfcpp::SHF_WRITE) == 0)
564 return true;
565
566 return false;
567}
568
5a6f7e2d
ILT
569// Save a Rel reloc.
570
571template<int size, bool big_endian>
572void
573Copy_relocs<size, big_endian>::save(
574 Symbol* sym,
575 Relobj* relobj,
576 unsigned int shndx,
577 const elfcpp::Rel<size, big_endian>& rel)
578{
579 unsigned int reloc_type = elfcpp::elf_r_type<size>(rel.get_r_info());
580 this->entries_.push_back(Copy_reloc_entry(sym, reloc_type, relobj, shndx,
581 rel.get_r_offset(), 0));
582}
583
584// Save a Rela reloc.
585
586template<int size, bool big_endian>
587void
588Copy_relocs<size, big_endian>::save(
589 Symbol* sym,
590 Relobj* relobj,
591 unsigned int shndx,
592 const elfcpp::Rela<size, big_endian>& rela)
593{
594 unsigned int reloc_type = elfcpp::elf_r_type<size>(rela.get_r_info());
595 this->entries_.push_back(Copy_reloc_entry(sym, reloc_type, relobj, shndx,
596 rela.get_r_offset(),
597 rela.get_r_addend()));
598}
599
600// Return whether there are any relocs to emit. We don't want to emit
601// a reloc if the symbol is no longer defined in a dynamic object.
602
603template<int size, bool big_endian>
604bool
605Copy_relocs<size, big_endian>::any_to_emit()
606{
607 for (typename Copy_reloc_entries::iterator p = this->entries_.begin();
608 p != this->entries_.end();
609 ++p)
610 {
611 if (p->should_emit())
612 return true;
613 }
614 return false;
615}
616
617// Emit relocs.
618
619template<int size, bool big_endian>
620template<int sh_type>
621void
622Copy_relocs<size, big_endian>::emit(
623 Output_data_reloc<sh_type, true, size, big_endian>* reloc_data)
624{
625 for (typename Copy_reloc_entries::iterator p = this->entries_.begin();
626 p != this->entries_.end();
627 ++p)
628 {
629 if (p->should_emit())
630 p->emit(reloc_data);
631 }
632}
633
61ba1cf9
ILT
634// Instantiate the templates we need. We could use the configure
635// script to restrict this to only the ones for implemented targets.
636
193a53d9 637#ifdef HAVE_TARGET_32_LITTLE
92e059d8
ILT
638template
639void
f6ce93d6 640Sized_relobj<32, false>::do_read_relocs(Read_relocs_data* rd);
193a53d9 641#endif
92e059d8 642
193a53d9 643#ifdef HAVE_TARGET_32_BIG
92e059d8
ILT
644template
645void
f6ce93d6 646Sized_relobj<32, true>::do_read_relocs(Read_relocs_data* rd);
193a53d9 647#endif
92e059d8 648
193a53d9 649#ifdef HAVE_TARGET_64_LITTLE
92e059d8
ILT
650template
651void
f6ce93d6 652Sized_relobj<64, false>::do_read_relocs(Read_relocs_data* rd);
193a53d9 653#endif
92e059d8 654
193a53d9 655#ifdef HAVE_TARGET_64_BIG
92e059d8
ILT
656template
657void
f6ce93d6 658Sized_relobj<64, true>::do_read_relocs(Read_relocs_data* rd);
193a53d9 659#endif
92e059d8 660
193a53d9 661#ifdef HAVE_TARGET_32_LITTLE
92e059d8
ILT
662template
663void
f6ce93d6 664Sized_relobj<32, false>::do_scan_relocs(const General_options& options,
92e059d8 665 Symbol_table* symtab,
ead1e424 666 Layout* layout,
92e059d8 667 Read_relocs_data* rd);
193a53d9 668#endif
92e059d8 669
193a53d9 670#ifdef HAVE_TARGET_32_BIG
92e059d8
ILT
671template
672void
f6ce93d6 673Sized_relobj<32, true>::do_scan_relocs(const General_options& options,
92e059d8 674 Symbol_table* symtab,
ead1e424 675 Layout* layout,
92e059d8 676 Read_relocs_data* rd);
193a53d9 677#endif
92e059d8 678
193a53d9 679#ifdef HAVE_TARGET_64_LITTLE
92e059d8
ILT
680template
681void
f6ce93d6 682Sized_relobj<64, false>::do_scan_relocs(const General_options& options,
92e059d8 683 Symbol_table* symtab,
ead1e424 684 Layout* layout,
92e059d8 685 Read_relocs_data* rd);
193a53d9 686#endif
92e059d8 687
193a53d9 688#ifdef HAVE_TARGET_64_BIG
92e059d8
ILT
689template
690void
f6ce93d6 691Sized_relobj<64, true>::do_scan_relocs(const General_options& options,
92e059d8 692 Symbol_table* symtab,
ead1e424 693 Layout* layout,
92e059d8 694 Read_relocs_data* rd);
193a53d9 695#endif
92e059d8 696
193a53d9 697#ifdef HAVE_TARGET_32_LITTLE
61ba1cf9
ILT
698template
699void
f6ce93d6 700Sized_relobj<32, false>::do_relocate(const General_options& options,
61ba1cf9 701 const Symbol_table* symtab,
92e059d8 702 const Layout* layout,
61ba1cf9 703 Output_file* of);
193a53d9 704#endif
61ba1cf9 705
193a53d9 706#ifdef HAVE_TARGET_32_BIG
61ba1cf9
ILT
707template
708void
f6ce93d6 709Sized_relobj<32, true>::do_relocate(const General_options& options,
61ba1cf9 710 const Symbol_table* symtab,
92e059d8 711 const Layout* layout,
61ba1cf9 712 Output_file* of);
193a53d9 713#endif
61ba1cf9 714
193a53d9 715#ifdef HAVE_TARGET_64_LITTLE
61ba1cf9
ILT
716template
717void
f6ce93d6 718Sized_relobj<64, false>::do_relocate(const General_options& options,
61ba1cf9 719 const Symbol_table* symtab,
92e059d8 720 const Layout* layout,
61ba1cf9 721 Output_file* of);
193a53d9 722#endif
61ba1cf9 723
193a53d9 724#ifdef HAVE_TARGET_64_BIG
61ba1cf9
ILT
725template
726void
f6ce93d6 727Sized_relobj<64, true>::do_relocate(const General_options& options,
61ba1cf9 728 const Symbol_table* symtab,
92e059d8 729 const Layout* layout,
61ba1cf9 730 Output_file* of);
193a53d9 731#endif
61ba1cf9 732
193a53d9 733#ifdef HAVE_TARGET_32_LITTLE
a3ad94ed 734template
5a6f7e2d 735class Copy_relocs<32, false>;
193a53d9 736#endif
a3ad94ed 737
193a53d9 738#ifdef HAVE_TARGET_32_BIG
a3ad94ed 739template
5a6f7e2d 740class Copy_relocs<32, true>;
193a53d9 741#endif
a3ad94ed 742
193a53d9 743#ifdef HAVE_TARGET_64_LITTLE
a3ad94ed 744template
5a6f7e2d 745class Copy_relocs<64, false>;
193a53d9 746#endif
a3ad94ed 747
193a53d9 748#ifdef HAVE_TARGET_64_BIG
a3ad94ed 749template
5a6f7e2d 750class Copy_relocs<64, true>;
193a53d9 751#endif
5a6f7e2d 752
193a53d9 753#ifdef HAVE_TARGET_32_LITTLE
5a6f7e2d
ILT
754template
755void
756Copy_relocs<32, false>::emit<elfcpp::SHT_REL>(
757 Output_data_reloc<elfcpp::SHT_REL, true, 32, false>*);
193a53d9 758#endif
5a6f7e2d 759
193a53d9 760#ifdef HAVE_TARGET_32_BIG
5a6f7e2d
ILT
761template
762void
763Copy_relocs<32, true>::emit<elfcpp::SHT_REL>(
764 Output_data_reloc<elfcpp::SHT_REL, true, 32, true>*);
193a53d9 765#endif
5a6f7e2d 766
193a53d9 767#ifdef HAVE_TARGET_64_LITTLE
5a6f7e2d
ILT
768template
769void
770Copy_relocs<64, false>::emit<elfcpp::SHT_REL>(
771 Output_data_reloc<elfcpp::SHT_REL, true, 64, false>*);
193a53d9 772#endif
5a6f7e2d 773
193a53d9 774#ifdef HAVE_TARGET_64_BIG
5a6f7e2d
ILT
775template
776void
777Copy_relocs<64, true>::emit<elfcpp::SHT_REL>(
778 Output_data_reloc<elfcpp::SHT_REL, true, 64, true>*);
193a53d9 779#endif
5a6f7e2d 780
193a53d9 781#ifdef HAVE_TARGET_32_LITTLE
5a6f7e2d
ILT
782template
783void
784Copy_relocs<32, false>::emit<elfcpp::SHT_RELA>(
785 Output_data_reloc<elfcpp::SHT_RELA , true, 32, false>*);
193a53d9 786#endif
5a6f7e2d 787
193a53d9 788#ifdef HAVE_TARGET_32_BIG
5a6f7e2d
ILT
789template
790void
791Copy_relocs<32, true>::emit<elfcpp::SHT_RELA>(
792 Output_data_reloc<elfcpp::SHT_RELA, true, 32, true>*);
193a53d9 793#endif
5a6f7e2d 794
193a53d9 795#ifdef HAVE_TARGET_64_LITTLE
5a6f7e2d
ILT
796template
797void
798Copy_relocs<64, false>::emit<elfcpp::SHT_RELA>(
799 Output_data_reloc<elfcpp::SHT_RELA, true, 64, false>*);
193a53d9 800#endif
5a6f7e2d 801
193a53d9 802#ifdef HAVE_TARGET_64_BIG
5a6f7e2d
ILT
803template
804void
805Copy_relocs<64, true>::emit<elfcpp::SHT_RELA>(
806 Output_data_reloc<elfcpp::SHT_RELA, true, 64, true>*);
193a53d9 807#endif
61ba1cf9
ILT
808
809} // End namespace gold.
This page took 0.088969 seconds and 4 git commands to generate.