diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2008-09-16 04:23:29 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@redhat.com> | 2008-09-16 04:23:29 +0000 |
commit | 183fd0e3ed5f9229379cb3e75f64939ba123c9b8 (patch) | |
tree | 62ee5c331ee593d80a181c86aa293ecd1049a6f5 | |
parent | b7f9e084d27da4ebfb4b8d2531738e4bcb57e28a (diff) | |
download | gdb-183fd0e3ed5f9229379cb3e75f64939ba123c9b8.zip gdb-183fd0e3ed5f9229379cb3e75f64939ba123c9b8.tar.gz gdb-183fd0e3ed5f9229379cb3e75f64939ba123c9b8.tar.bz2 |
* options.h (General_options::output_is_executable): New.
(General_options::output_is_pie): New.
* i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
for shared libraries.
* x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
-rw-r--r-- | gold/ChangeLog | 8 | ||||
-rw-r--r-- | gold/i386.cc | 6 | ||||
-rw-r--r-- | gold/options.h | 14 | ||||
-rw-r--r-- | gold/x86_64.cc | 6 |
4 files changed, 32 insertions, 2 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index 8829e0a..7235cd9 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,11 @@ +2008-09-16 Alexandre Oliva <aoliva@redhat.com> + + * options.h (General_options::output_is_executable): New. + (General_options::output_is_pie): New. + * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START + for shared libraries. + * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise. + 2008-09-11 Chris Demetriou <cgd@google.com> * options.h (origin): New -z option. diff --git a/gold/i386.cc b/gold/i386.cc index 54f1233..8889a68 100644 --- a/gold/i386.cc +++ b/gold/i386.cc @@ -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; } diff --git a/gold/options.h b/gold/options.h index 8614ce6..2926730 100644 --- a/gold/options.h +++ b/gold/options.h @@ -865,6 +865,20 @@ class General_options output_is_position_independent() const { return this->shared(); } + // Return true if the output is something that can be exec()ed, such + // as a static executable, or a position-dependent or + // position-independent executable, but not a dynamic library or an + // object file. + bool + output_is_executable() const + { return !this->shared() || this->output_is_pie(); } + + // Return true if the output is a position-independent executable. + // This is currently not supported. + bool + output_is_pie() const + { return false; } + // This would normally be static(), and defined automatically, but // since static is a keyword, we need to come up with our own name. bool diff --git a/gold/x86_64.cc b/gold/x86_64.cc index 2daa9bf..dda3297 100644 --- a/gold/x86_64.cc +++ b/gold/x86_64.cc @@ -807,12 +807,16 @@ Target_x86_64::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; } |