OLD | NEW |
1 // target.h -- target support for gold -*- C++ -*- | 1 // target.h -- target support for gold -*- C++ -*- |
2 | 2 |
3 // Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. | 3 // Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
4 // Written by Ian Lance Taylor <iant@google.com>. | 4 // Written by Ian Lance Taylor <iant@google.com>. |
5 | 5 |
6 // This file is part of gold. | 6 // This file is part of gold. |
7 | 7 |
8 // This program is free software; you can redistribute it and/or modify | 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 | 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 | 10 // the Free Software Foundation; either version 3 of the License, or |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 class Reloc_symbol_changes; | 53 class Reloc_symbol_changes; |
54 class Symbol; | 54 class Symbol; |
55 template<int size> | 55 template<int size> |
56 class Sized_symbol; | 56 class Sized_symbol; |
57 class Symbol_table; | 57 class Symbol_table; |
58 class Output_data; | 58 class Output_data; |
59 class Output_data_got_base; | 59 class Output_data_got_base; |
60 class Output_section; | 60 class Output_section; |
61 class Input_objects; | 61 class Input_objects; |
62 class Task; | 62 class Task; |
| 63 class Output_data_dynamic; |
63 | 64 |
64 // The abstract class for target specific handling. | 65 // The abstract class for target specific handling. |
65 | 66 |
66 class Target | 67 class Target |
67 { | 68 { |
68 public: | 69 public: |
69 virtual ~Target() | 70 virtual ~Target() |
70 { } | 71 { } |
71 | 72 |
72 // Return the bit size that this target implements. This should | 73 // Return the bit size that this target implements. This should |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 new_output_section(Output_section* os) const | 197 new_output_section(Output_section* os) const |
197 { this->do_new_output_section(os); } | 198 { this->do_new_output_section(os); } |
198 | 199 |
199 // This is called to tell the target to complete any sections it is | 200 // This is called to tell the target to complete any sections it is |
200 // handling. After this all sections must have their final size. | 201 // handling. After this all sections must have their final size. |
201 void | 202 void |
202 finalize_sections(Layout* layout, const Input_objects* input_objects, | 203 finalize_sections(Layout* layout, const Input_objects* input_objects, |
203 Symbol_table* symtab) | 204 Symbol_table* symtab) |
204 { return this->do_finalize_sections(layout, input_objects, symtab); } | 205 { return this->do_finalize_sections(layout, input_objects, symtab); } |
205 | 206 |
| 207 // Fix data that are known after finalize_sections for MIPS (and possible |
| 208 // some other architectures). |
| 209 void fix_sections(Layout* layout, Symbol_table* symtab) |
| 210 { return this->do_fix_sections(layout, symtab); } |
| 211 |
206 // Return the value to use for a global symbol which needs a special | 212 // Return the value to use for a global symbol which needs a special |
207 // value in the dynamic symbol table. This will only be called if | 213 // value in the dynamic symbol table. This will only be called if |
208 // the backend first calls symbol->set_needs_dynsym_value(). | 214 // the backend first calls symbol->set_needs_dynsym_value(). |
209 uint64_t | 215 uint64_t |
210 dynsym_value(const Symbol* sym) const | 216 dynsym_value(const Symbol* sym) const |
211 { return this->do_dynsym_value(sym); } | 217 { return this->do_dynsym_value(sym); } |
212 | 218 |
213 // Return a string to use to fill out a code section. This is | 219 // Return a string to use to fill out a code section. This is |
214 // basically one or more NOPS which must fill out the specified | 220 // basically one or more NOPS which must fill out the specified |
215 // length in bytes. | 221 // length in bytes. |
(...skipping 12 matching lines...) Expand all Loading... |
228 void | 234 void |
229 adjust_elf_header(unsigned char* view, int len) const | 235 adjust_elf_header(unsigned char* view, int len) const |
230 { return this->do_adjust_elf_header(view, len); } | 236 { return this->do_adjust_elf_header(view, len); } |
231 | 237 |
232 // Return whether NAME is a local label name. This is used to implement the | 238 // Return whether NAME is a local label name. This is used to implement the |
233 // --discard-locals options. | 239 // --discard-locals options. |
234 bool | 240 bool |
235 is_local_label_name(const char* name) const | 241 is_local_label_name(const char* name) const |
236 { return this->do_is_local_label_name(name); } | 242 { return this->do_is_local_label_name(name); } |
237 | 243 |
| 244 // Get the value for target specific dynamic tags. |
| 245 unsigned int |
| 246 dynamic_tag_value(elfcpp::DT tag) const |
| 247 { return this->do_dynamic_tag_value(tag); } |
| 248 |
238 // Get the symbol index to use for a target specific reloc. | 249 // Get the symbol index to use for a target specific reloc. |
239 unsigned int | 250 unsigned int |
240 reloc_symbol_index(void* arg, unsigned int type) const | 251 reloc_symbol_index(void* arg, unsigned int type) const |
241 { return this->do_reloc_symbol_index(arg, type); } | 252 { return this->do_reloc_symbol_index(arg, type); } |
242 | 253 |
243 // Get the addend to use for a target specific reloc. | 254 // Get the addend to use for a target specific reloc. |
244 uint64_t | 255 uint64_t |
245 reloc_addend(void* arg, unsigned int type, uint64_t addend) const | 256 reloc_addend(void* arg, unsigned int type, uint64_t addend) const |
246 { return this->do_reloc_addend(arg, type, addend); } | 257 { return this->do_reloc_addend(arg, type, addend); } |
247 | 258 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 virtual void | 471 virtual void |
461 do_new_output_section(Output_section*) const | 472 do_new_output_section(Output_section*) const |
462 { } | 473 { } |
463 | 474 |
464 // Virtual function which may be implemented by the child class. | 475 // Virtual function which may be implemented by the child class. |
465 virtual void | 476 virtual void |
466 do_finalize_sections(Layout*, const Input_objects*, Symbol_table*) | 477 do_finalize_sections(Layout*, const Input_objects*, Symbol_table*) |
467 { } | 478 { } |
468 | 479 |
469 // Virtual function which may be implemented by the child class. | 480 // Virtual function which may be implemented by the child class. |
| 481 virtual void |
| 482 do_fix_sections(Layout*, Symbol_table*) |
| 483 { } |
| 484 |
| 485 // Virtual function which may be implemented by the child class. |
470 virtual uint64_t | 486 virtual uint64_t |
471 do_dynsym_value(const Symbol*) const | 487 do_dynsym_value(const Symbol*) const |
472 { gold_unreachable(); } | 488 { gold_unreachable(); } |
473 | 489 |
474 // Virtual function which must be implemented by the child class if | 490 // Virtual function which must be implemented by the child class if |
475 // needed. | 491 // needed. |
476 virtual std::string | 492 virtual std::string |
477 do_code_fill(section_size_type) const | 493 do_code_fill(section_size_type) const |
478 { gold_unreachable(); } | 494 { gold_unreachable(); } |
479 | 495 |
480 // Virtual function which may be implemented by the child class. | 496 // Virtual function which may be implemented by the child class. |
481 virtual bool | 497 virtual bool |
482 do_is_defined_by_abi(const Symbol*) const | 498 do_is_defined_by_abi(const Symbol*) const |
483 { return false; } | 499 { return false; } |
484 | 500 |
485 // Adjust the output file header before it is written out. VIEW | 501 // Adjust the output file header before it is written out. VIEW |
486 // points to the header in external form. LEN is the length, and | 502 // points to the header in external form. LEN is the length, and |
487 // will be one of the values of elfcpp::Elf_sizes<size>::ehdr_size. | 503 // will be one of the values of elfcpp::Elf_sizes<size>::ehdr_size. |
488 // By default, we set the EI_OSABI field if requested (in | 504 // By default, we set the EI_OSABI field if requested (in |
489 // Sized_target). | 505 // Sized_target). |
490 virtual void | 506 virtual void |
491 do_adjust_elf_header(unsigned char*, int) const = 0; | 507 do_adjust_elf_header(unsigned char*, int) const = 0; |
492 | 508 |
493 // Virtual function which may be overridden by the child class. | 509 // Virtual function which may be overridden by the child class. |
494 virtual bool | 510 virtual bool |
495 do_is_local_label_name(const char*) const; | 511 do_is_local_label_name(const char*) const; |
496 | 512 |
497 // Virtual function that must be overridden by a target which uses | 513 // Virtual function that must be overridden by a target which uses |
| 514 // target specific dynamic tags. |
| 515 virtual unsigned int |
| 516 do_dynamic_tag_value(elfcpp::DT) const |
| 517 { gold_unreachable(); } |
| 518 |
| 519 // Virtual function that must be overridden by a target which uses |
498 // target specific relocations. | 520 // target specific relocations. |
499 virtual unsigned int | 521 virtual unsigned int |
500 do_reloc_symbol_index(void*, unsigned int) const | 522 do_reloc_symbol_index(void*, unsigned int) const |
501 { gold_unreachable(); } | 523 { gold_unreachable(); } |
502 | 524 |
503 // Virtual function that must be overridden by a target which uses | 525 // Virtual function that must be overridden by a target which uses |
504 // target specific relocations. | 526 // target specific relocations. |
505 virtual uint64_t | 527 virtual uint64_t |
506 do_reloc_addend(void*, unsigned int, uint64_t) const | 528 do_reloc_addend(void*, unsigned int, uint64_t) const |
507 { gold_unreachable(); } | 529 { gold_unreachable(); } |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 } | 937 } |
916 | 938 |
917 // Set the EI_OSABI field if requested. | 939 // Set the EI_OSABI field if requested. |
918 virtual void | 940 virtual void |
919 do_adjust_elf_header(unsigned char*, int) const; | 941 do_adjust_elf_header(unsigned char*, int) const; |
920 }; | 942 }; |
921 | 943 |
922 } // End namespace gold. | 944 } // End namespace gold. |
923 | 945 |
924 #endif // !defined(GOLD_TARGET_H) | 946 #endif // !defined(GOLD_TARGET_H) |
OLD | NEW |