OLD | NEW |
---|---|
1 // output.h -- manage the output file for gold -*- C++ -*- | 1 // output.h -- manage the output file 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 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1769 gold_assert(addend == 0); | 1769 gold_assert(addend == 0); |
1770 Sized_relobj<size, big_endian>* sized_relobj = | 1770 Sized_relobj<size, big_endian>* sized_relobj = |
1771 static_cast<Sized_relobj<size, big_endian>*>(relobj); | 1771 static_cast<Sized_relobj<size, big_endian>*>(relobj); |
1772 this->add(od, Output_reloc_type(os, type, sized_relobj, shndx, | 1772 this->add(od, Output_reloc_type(os, type, sized_relobj, shndx, |
1773 convert_types<Address, uint64_t>(address))); | 1773 convert_types<Address, uint64_t>(address))); |
1774 } | 1774 } |
1775 | 1775 |
1776 // Add an absolute relocation. | 1776 // Add an absolute relocation. |
1777 | 1777 |
1778 void | 1778 void |
1779 add_absolute_null(unsigned int type, Output_data* od, Address address) | |
robertm
2012/04/27 19:46:15
in the spirit of keeping the deltas small - can th
Aleksandar Simeonov
2012/05/08 15:21:42
Since R_MIPS_NONE entry with address 0 has to be f
| |
1780 { this->add(od, Output_reloc_type(type, NULL, address)); } | |
1781 | |
1782 void | |
1779 add_absolute(unsigned int type, Output_data* od, Address address) | 1783 add_absolute(unsigned int type, Output_data* od, Address address) |
1780 { this->add(od, Output_reloc_type(type, od, address)); } | 1784 { this->add(od, Output_reloc_type(type, od, address)); } |
1781 | 1785 |
1782 void | 1786 void |
1783 add_absolute(unsigned int type, Output_data* od, | 1787 add_absolute(unsigned int type, Output_data* od, |
1784 Sized_relobj<size, big_endian>* relobj, | 1788 Sized_relobj<size, big_endian>* relobj, |
1785 unsigned int shndx, Address address) | 1789 unsigned int shndx, Address address) |
1786 { this->add(od, Output_reloc_type(type, relobj, shndx, address)); } | 1790 { this->add(od, Output_reloc_type(type, relobj, shndx, address)); } |
1787 | 1791 |
1788 // Add a target specific relocation. A target which calls this must | 1792 // Add a target specific relocation. A target which calls this must |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2417 | 2421 |
2418 // Add a new dynamic entry with a string. | 2422 // Add a new dynamic entry with a string. |
2419 void | 2423 void |
2420 add_string(elfcpp::DT tag, const char* str) | 2424 add_string(elfcpp::DT tag, const char* str) |
2421 { this->add_entry(Dynamic_entry(tag, this->pool_->add(str, true, NULL))); } | 2425 { this->add_entry(Dynamic_entry(tag, this->pool_->add(str, true, NULL))); } |
2422 | 2426 |
2423 void | 2427 void |
2424 add_string(elfcpp::DT tag, const std::string& str) | 2428 add_string(elfcpp::DT tag, const std::string& str) |
2425 { this->add_string(tag, str.c_str()); } | 2429 { this->add_string(tag, str.c_str()); } |
2426 | 2430 |
2431 // Add a new dynamic entry with target specific value. | |
2432 void | |
2433 add_target_specific(elfcpp::DT tag) | |
2434 { this->add_entry(Dynamic_entry(tag)); } | |
2435 | |
2427 protected: | 2436 protected: |
2428 // Adjust the output section to set the entry size. | 2437 // Adjust the output section to set the entry size. |
2429 void | 2438 void |
2430 do_adjust_output_section(Output_section*); | 2439 do_adjust_output_section(Output_section*); |
2431 | 2440 |
2432 // Set the final data size. | 2441 // Set the final data size. |
2433 void | 2442 void |
2434 set_final_data_size(); | 2443 set_final_data_size(); |
2435 | 2444 |
2436 // Write out the dynamic entries. | 2445 // Write out the dynamic entries. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2481 // Create an entry with the address of a symbol. | 2490 // Create an entry with the address of a symbol. |
2482 Dynamic_entry(elfcpp::DT tag, const Symbol* sym) | 2491 Dynamic_entry(elfcpp::DT tag, const Symbol* sym) |
2483 : tag_(tag), offset_(DYNAMIC_SYMBOL) | 2492 : tag_(tag), offset_(DYNAMIC_SYMBOL) |
2484 { this->u_.sym = sym; } | 2493 { this->u_.sym = sym; } |
2485 | 2494 |
2486 // Create an entry with a string. | 2495 // Create an entry with a string. |
2487 Dynamic_entry(elfcpp::DT tag, const char* str) | 2496 Dynamic_entry(elfcpp::DT tag, const char* str) |
2488 : tag_(tag), offset_(DYNAMIC_STRING) | 2497 : tag_(tag), offset_(DYNAMIC_STRING) |
2489 { this->u_.str = str; } | 2498 { this->u_.str = str; } |
2490 | 2499 |
2500 // Create an entry with a target specific value. | |
2501 Dynamic_entry(elfcpp::DT tag) | |
2502 : tag_(tag), offset_(DYNAMIC_TARGET) | |
2503 { }; | |
2504 | |
2491 // Return the tag of this entry. | 2505 // Return the tag of this entry. |
2492 elfcpp::DT | 2506 elfcpp::DT |
2493 tag() const | 2507 tag() const |
2494 { return this->tag_; } | 2508 { return this->tag_; } |
2495 | 2509 |
2496 // Write the dynamic entry to an output view. | 2510 // Write the dynamic entry to an output view. |
2497 template<int size, bool big_endian> | 2511 template<int size, bool big_endian> |
2498 void | 2512 void |
2499 write(unsigned char* pov, const Stringpool*) const; | 2513 write(unsigned char* pov, const Stringpool*) const; |
2500 | 2514 |
2501 private: | 2515 private: |
2502 // Classification is encoded in the OFFSET field. | 2516 // Classification is encoded in the OFFSET field. |
2503 enum Classification | 2517 enum Classification |
2504 { | 2518 { |
2505 // Section address. | 2519 // Section address. |
2506 DYNAMIC_SECTION_ADDRESS = 0, | 2520 DYNAMIC_SECTION_ADDRESS = 0, |
2507 // Number. | 2521 // Number. |
2508 DYNAMIC_NUMBER = -1U, | 2522 DYNAMIC_NUMBER = -1U, |
2509 // Section size. | 2523 // Section size. |
2510 DYNAMIC_SECTION_SIZE = -2U, | 2524 DYNAMIC_SECTION_SIZE = -2U, |
2511 // Symbol adress. | 2525 // Symbol adress. |
2512 DYNAMIC_SYMBOL = -3U, | 2526 DYNAMIC_SYMBOL = -3U, |
2513 // String. | 2527 // String. |
2514 DYNAMIC_STRING = -4U | 2528 DYNAMIC_STRING = -4U, |
2529 // Target specific value. | |
2530 DYNAMIC_TARGET = -5U | |
2515 // Any other value indicates a section address plus OFFSET. | 2531 // Any other value indicates a section address plus OFFSET. |
2516 }; | 2532 }; |
2517 | 2533 |
2518 union | 2534 union |
2519 { | 2535 { |
2520 // For DYNAMIC_NUMBER. | 2536 // For DYNAMIC_NUMBER. |
2521 unsigned int val; | 2537 unsigned int val; |
2522 // For DYNAMIC_SECTION_SIZE and section address plus OFFSET. | 2538 // For DYNAMIC_SECTION_SIZE and section address plus OFFSET. |
2523 const Output_data* od; | 2539 const Output_data* od; |
2524 // For DYNAMIC_SYMBOL. | 2540 // For DYNAMIC_SYMBOL. |
(...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4603 bool map_is_anonymous_; | 4619 bool map_is_anonymous_; |
4604 // True if base_ was allocated using new rather than mmap. | 4620 // True if base_ was allocated using new rather than mmap. |
4605 bool map_is_allocated_; | 4621 bool map_is_allocated_; |
4606 // True if this is a temporary file which should not be output. | 4622 // True if this is a temporary file which should not be output. |
4607 bool is_temporary_; | 4623 bool is_temporary_; |
4608 }; | 4624 }; |
4609 | 4625 |
4610 } // End namespace gold. | 4626 } // End namespace gold. |
4611 | 4627 |
4612 #endif // !defined(GOLD_OUTPUT_H) | 4628 #endif // !defined(GOLD_OUTPUT_H) |
OLD | NEW |