(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-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.
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;
}
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
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;
}