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 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2417 | 2417 |
2418 // Add a new dynamic entry with a string. | 2418 // Add a new dynamic entry with a string. |
2419 void | 2419 void |
2420 add_string(elfcpp::DT tag, const char* str) | 2420 add_string(elfcpp::DT tag, const char* str) |
2421 { this->add_entry(Dynamic_entry(tag, this->pool_->add(str, true, NULL))); } | 2421 { this->add_entry(Dynamic_entry(tag, this->pool_->add(str, true, NULL))); } |
2422 | 2422 |
2423 void | 2423 void |
2424 add_string(elfcpp::DT tag, const std::string& str) | 2424 add_string(elfcpp::DT tag, const std::string& str) |
2425 { this->add_string(tag, str.c_str()); } | 2425 { this->add_string(tag, str.c_str()); } |
2426 | 2426 |
| 2427 // Add a new dynamic entry with target specific value. |
| 2428 void |
| 2429 add_target_specific(elfcpp::DT tag) |
| 2430 { this->add_entry(Dynamic_entry(tag)); } |
| 2431 |
2427 protected: | 2432 protected: |
2428 // Adjust the output section to set the entry size. | 2433 // Adjust the output section to set the entry size. |
2429 void | 2434 void |
2430 do_adjust_output_section(Output_section*); | 2435 do_adjust_output_section(Output_section*); |
2431 | 2436 |
2432 // Set the final data size. | 2437 // Set the final data size. |
2433 void | 2438 void |
2434 set_final_data_size(); | 2439 set_final_data_size(); |
2435 | 2440 |
2436 // Write out the dynamic entries. | 2441 // 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. | 2486 // Create an entry with the address of a symbol. |
2482 Dynamic_entry(elfcpp::DT tag, const Symbol* sym) | 2487 Dynamic_entry(elfcpp::DT tag, const Symbol* sym) |
2483 : tag_(tag), offset_(DYNAMIC_SYMBOL) | 2488 : tag_(tag), offset_(DYNAMIC_SYMBOL) |
2484 { this->u_.sym = sym; } | 2489 { this->u_.sym = sym; } |
2485 | 2490 |
2486 // Create an entry with a string. | 2491 // Create an entry with a string. |
2487 Dynamic_entry(elfcpp::DT tag, const char* str) | 2492 Dynamic_entry(elfcpp::DT tag, const char* str) |
2488 : tag_(tag), offset_(DYNAMIC_STRING) | 2493 : tag_(tag), offset_(DYNAMIC_STRING) |
2489 { this->u_.str = str; } | 2494 { this->u_.str = str; } |
2490 | 2495 |
| 2496 // Create an entry with a target specific value. |
| 2497 Dynamic_entry(elfcpp::DT tag) |
| 2498 : tag_(tag), offset_(DYNAMIC_TARGET) |
| 2499 { }; |
| 2500 |
2491 // Return the tag of this entry. | 2501 // Return the tag of this entry. |
2492 elfcpp::DT | 2502 elfcpp::DT |
2493 tag() const | 2503 tag() const |
2494 { return this->tag_; } | 2504 { return this->tag_; } |
2495 | 2505 |
2496 // Write the dynamic entry to an output view. | 2506 // Write the dynamic entry to an output view. |
2497 template<int size, bool big_endian> | 2507 template<int size, bool big_endian> |
2498 void | 2508 void |
2499 write(unsigned char* pov, const Stringpool*) const; | 2509 write(unsigned char* pov, const Stringpool*) const; |
2500 | 2510 |
2501 private: | 2511 private: |
2502 // Classification is encoded in the OFFSET field. | 2512 // Classification is encoded in the OFFSET field. |
2503 enum Classification | 2513 enum Classification |
2504 { | 2514 { |
2505 // Section address. | 2515 // Section address. |
2506 DYNAMIC_SECTION_ADDRESS = 0, | 2516 DYNAMIC_SECTION_ADDRESS = 0, |
2507 // Number. | 2517 // Number. |
2508 DYNAMIC_NUMBER = -1U, | 2518 DYNAMIC_NUMBER = -1U, |
2509 // Section size. | 2519 // Section size. |
2510 DYNAMIC_SECTION_SIZE = -2U, | 2520 DYNAMIC_SECTION_SIZE = -2U, |
2511 // Symbol adress. | 2521 // Symbol adress. |
2512 DYNAMIC_SYMBOL = -3U, | 2522 DYNAMIC_SYMBOL = -3U, |
2513 // String. | 2523 // String. |
2514 DYNAMIC_STRING = -4U | 2524 DYNAMIC_STRING = -4U, |
| 2525 // Target specific value. |
| 2526 DYNAMIC_TARGET = -5U |
2515 // Any other value indicates a section address plus OFFSET. | 2527 // Any other value indicates a section address plus OFFSET. |
2516 }; | 2528 }; |
2517 | 2529 |
2518 union | 2530 union |
2519 { | 2531 { |
2520 // For DYNAMIC_NUMBER. | 2532 // For DYNAMIC_NUMBER. |
2521 unsigned int val; | 2533 unsigned int val; |
2522 // For DYNAMIC_SECTION_SIZE and section address plus OFFSET. | 2534 // For DYNAMIC_SECTION_SIZE and section address plus OFFSET. |
2523 const Output_data* od; | 2535 const Output_data* od; |
2524 // For DYNAMIC_SYMBOL. | 2536 // For DYNAMIC_SYMBOL. |
(...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4603 bool map_is_anonymous_; | 4615 bool map_is_anonymous_; |
4604 // True if base_ was allocated using new rather than mmap. | 4616 // True if base_ was allocated using new rather than mmap. |
4605 bool map_is_allocated_; | 4617 bool map_is_allocated_; |
4606 // True if this is a temporary file which should not be output. | 4618 // True if this is a temporary file which should not be output. |
4607 bool is_temporary_; | 4619 bool is_temporary_; |
4608 }; | 4620 }; |
4609 | 4621 |
4610 } // End namespace gold. | 4622 } // End namespace gold. |
4611 | 4623 |
4612 #endif // !defined(GOLD_OUTPUT_H) | 4624 #endif // !defined(GOLD_OUTPUT_H) |
OLD | NEW |