diff options
author | Cary Coutant <ccoutant@google.com> | 2008-04-11 21:24:30 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2008-04-11 21:24:30 +0000 |
commit | c2b45e22d5570064d11783c46bc392cb8d387db4 (patch) | |
tree | 2bf8e341da1070ab3f6b11b0f06823cc8c5a47d8 /gold/output.h | |
parent | 83bfb6b77648bdee37ca84fe240e8b0a229e8f77 (diff) | |
download | gdb-c2b45e22d5570064d11783c46bc392cb8d387db4.zip gdb-c2b45e22d5570064d11783c46bc392cb8d387db4.tar.gz gdb-c2b45e22d5570064d11783c46bc392cb8d387db4.tar.bz2 |
2008-04-11 Cary Coutant <ccoutant@google.com>
Add support for TLS descriptors for i386 and x86_64.
* i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
(Target_i386::Relocate::tls_desc_gd_to_le): New function.
(Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
GOT_TYPE_TLS_DESC.
(Target_i386::got_mod_index_entry): Remove unnecessary code.
(Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
relocations.
(Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
Fix problem with initial-exec relocations.
(Target_i386::Relocate::relocate_tls): Likewise.
(Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
relaxation.
* output.cc (Output_data_dynamic::Dynamic_entry::write): Add
support for section-plus-offset dynamic table entries.
* output.h (Output_data_dynamic::add_section_plus_offset): New function.
(Output_data_dynamic::Dynamic_entry): Add support for
section-plus-offset dynamic table entries.
(Output_data_dynamic::Classification): Likewise.
(Output_data_dynamic::classification_): Renamed offset_.
* x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
(Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
(Target_x86_64::make_plt_section): New function.
(Target_x86_64::reserve_tlsdesc_entries): New function.
(Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
(Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
(Output_data_plt_x86_64::has_tlsdesc_entry): New function.
(Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
(Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
(Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
(Output_data_plt_x86_64::set_final_data_size): Move out of line;
add extra PLT entry for TLS descriptors.
(Output_data_plt_x86_64::got_): New field.
(Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
(Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
fields.
(Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
descriptors.
(Target_x86_64::make_plt_entry): Factor out make_plt_section.
(Target_x86_64::got_mod_index_entry): Remove unnecessary code.
(Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
R_386_TLS_DESC_CALL relocations.
(Target_x86_64::Scan::global): Likewise.
(Target_x86_64::do_finalize_sections): Add dynamic table entries
for TLS descriptors.
(Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
(Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
GD-to-IE relaxation.
* configure.ac: Export new conditional variables TLS_GNU2_DIALECT
and TLS_DESCRIPTORS.
* Makefile.in: Rebuild.
* configure: Rebuild.
* testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
(tls_test_shared2.so): New target.
(tls_shared_gd_to_ie_test_SOURCES): New variable.
(tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
(tls_shared_gd_to_ie_test_LDFLAGS): New variable.
(tls_shared_gd_to_ie_test_LDADD): New variable.
(tls_shared_gnu2_gd_to_ie_test): New target.
(tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
New targets.
(tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
(ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
(tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
(tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
(tls_shared_gnu2_test): New target.
(tls_test_gnu2_shared.so): New target.
(tls_shared_gnu2_test_SOURCES): New variable.
(tls_shared_gnu2_test_DEPENDENCIES): New variable.
(tls_shared_gnu2_test_LDFLAGS): New variable.
(tls_shared_gnu2_test_LDADD): New variable.
* testsuite/Makefile.in: Rebuild.
* testsuite/Makefile.
Diffstat (limited to 'gold/output.h')
-rw-r--r-- | gold/output.h | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/gold/output.h b/gold/output.h index e697775..126ec71 100644 --- a/gold/output.h +++ b/gold/output.h @@ -1534,6 +1534,13 @@ class Output_data_dynamic : public Output_section_data add_section_address(elfcpp::DT tag, const Output_data* od) { this->add_entry(Dynamic_entry(tag, od, false)); } + // Add a new dynamic entry with the address of output data + // plus a constant offset. + void + add_section_plus_offset(elfcpp::DT tag, const Output_data* od, + unsigned int offset) + { this->add_entry(Dynamic_entry(tag, od, offset)); } + // Add a new dynamic entry with the size of output data. void add_section_size(elfcpp::DT tag, const Output_data* od) @@ -1573,25 +1580,31 @@ class Output_data_dynamic : public Output_section_data public: // Create an entry with a fixed numeric value. Dynamic_entry(elfcpp::DT tag, unsigned int val) - : tag_(tag), classification_(DYNAMIC_NUMBER) + : tag_(tag), offset_(DYNAMIC_NUMBER) { this->u_.val = val; } // Create an entry with the size or address of a section. Dynamic_entry(elfcpp::DT tag, const Output_data* od, bool section_size) : tag_(tag), - classification_(section_size - ? DYNAMIC_SECTION_SIZE - : DYNAMIC_SECTION_ADDRESS) + offset_(section_size + ? DYNAMIC_SECTION_SIZE + : DYNAMIC_SECTION_ADDRESS) + { this->u_.od = od; } + + // Create an entry with the address of a section plus a constant offset. + Dynamic_entry(elfcpp::DT tag, const Output_data* od, unsigned int offset) + : tag_(tag), + offset_(offset) { this->u_.od = od; } // Create an entry with the address of a symbol. Dynamic_entry(elfcpp::DT tag, const Symbol* sym) - : tag_(tag), classification_(DYNAMIC_SYMBOL) + : tag_(tag), offset_(DYNAMIC_SYMBOL) { this->u_.sym = sym; } // Create an entry with a string. Dynamic_entry(elfcpp::DT tag, const char* str) - : tag_(tag), classification_(DYNAMIC_STRING) + : tag_(tag), offset_(DYNAMIC_STRING) { this->u_.str = str; } // Write the dynamic entry to an output view. @@ -1600,25 +1613,27 @@ class Output_data_dynamic : public Output_section_data write(unsigned char* pov, const Stringpool*) const; private: + // Classification is encoded in the OFFSET field. enum Classification { - // Number. - DYNAMIC_NUMBER, // Section address. - DYNAMIC_SECTION_ADDRESS, + DYNAMIC_SECTION_ADDRESS = 0, + // Number. + DYNAMIC_NUMBER = -1U, // Section size. - DYNAMIC_SECTION_SIZE, + DYNAMIC_SECTION_SIZE = -2U, // Symbol adress. - DYNAMIC_SYMBOL, + DYNAMIC_SYMBOL = -3U, // String. - DYNAMIC_STRING + DYNAMIC_STRING = -4U + // Any other value indicates a section address plus OFFSET. }; union { // For DYNAMIC_NUMBER. unsigned int val; - // For DYNAMIC_SECTION_ADDRESS and DYNAMIC_SECTION_SIZE. + // For DYNAMIC_SECTION_SIZE and section address plus OFFSET. const Output_data* od; // For DYNAMIC_SYMBOL. const Symbol* sym; @@ -1627,8 +1642,8 @@ class Output_data_dynamic : public Output_section_data } u_; // The dynamic tag. elfcpp::DT tag_; - // The type of entry. - Classification classification_; + // The type of entry (Classification) or offset within a section. + unsigned int offset_; }; // Add an entry to the list. |