diff options
Diffstat (limited to 'gold/i386.cc')
-rw-r--r-- | gold/i386.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gold/i386.cc b/gold/i386.cc index 54f1233..8a5558e 100644 --- a/gold/i386.cc +++ b/gold/i386.cc @@ -135,7 +135,7 @@ class Target_i386 : public Sized_target<32, false> // Return whether SYM is defined by the ABI. bool - do_is_defined_by_abi(Symbol* sym) const + do_is_defined_by_abi(const Symbol* sym) const { return strcmp(sym->name(), "___tls_get_addr") == 0; } // Return the size of the GOT section. @@ -323,7 +323,7 @@ class Target_i386 : public Sized_target<32, false> void make_plt_entry(Symbol_table*, Layout*, Symbol*); - // Define the _TLS_MODULE_BASE_ symbol at the end of the TLS segment. + // Define the _TLS_MODULE_BASE_ symbol in the TLS segment. void define_tls_base_symbol(Symbol_table*, Layout*); @@ -736,7 +736,7 @@ Target_i386::make_plt_entry(Symbol_table* symtab, Layout* layout, Symbol* gsym) this->plt_->add_entry(gsym); } -// Define the _TLS_MODULE_BASE_ symbol at the end of the TLS segment. +// Define the _TLS_MODULE_BASE_ symbol in the TLS segment. void Target_i386::define_tls_base_symbol(Symbol_table* symtab, Layout* layout) @@ -747,12 +747,16 @@ Target_i386::define_tls_base_symbol(Symbol_table* symtab, Layout* layout) Output_segment* tls_segment = layout->tls_segment(); if (tls_segment != NULL) { + bool is_exec = parameters->options().output_is_executable(); symtab->define_in_output_segment("_TLS_MODULE_BASE_", NULL, tls_segment, 0, 0, elfcpp::STT_TLS, elfcpp::STB_LOCAL, elfcpp::STV_HIDDEN, 0, - Symbol::SEGMENT_END, true); + (is_exec + ? Symbol::SEGMENT_END + : Symbol::SEGMENT_START), + true); } this->tls_base_symbol_defined_ = true; } |