aboutsummaryrefslogtreecommitdiff
path: root/gold/resolve.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2011-07-08 23:49:11 +0000
committerIan Lance Taylor <ian@airs.com>2011-07-08 23:49:11 +0000
commit62855347684cda4254e2b8f1f80ed95e18ab5b76 (patch)
treeac7dc032f7360ae5b1af58c18bb26d0495c1dcc7 /gold/resolve.cc
parent67181c72fbaad59e5793cf6bcb8d12d7d211c817 (diff)
downloadgdb-62855347684cda4254e2b8f1f80ed95e18ab5b76.zip
gdb-62855347684cda4254e2b8f1f80ed95e18ab5b76.tar.gz
gdb-62855347684cda4254e2b8f1f80ed95e18ab5b76.tar.bz2
PR gold/12279
* resolve.cc (Symbol_table::should_override): Add fromtype parameter. Change all callers. Give error when linking together TLS and non-TLS symbol. (Symbol_table::should_override_with_special): Add fromtype parameter. Change all callers. * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if there is no TLS segment if we have reported some errors. * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
Diffstat (limited to 'gold/resolve.cc')
-rw-r--r--gold/resolve.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/gold/resolve.cc b/gold/resolve.cc
index 720b350..03288ec 100644
--- a/gold/resolve.cc
+++ b/gold/resolve.cc
@@ -351,8 +351,8 @@ Symbol_table::resolve(Sized_symbol<size>* to,
bool adjust_common_sizes;
bool adjust_dyndef;
typename Sized_symbol<size>::Size_type tosize = to->symsize();
- if (Symbol_table::should_override(to, frombits, OBJECT, object,
- &adjust_common_sizes,
+ if (Symbol_table::should_override(to, frombits, sym.get_st_type(), OBJECT,
+ object, &adjust_common_sizes,
&adjust_dyndef))
{
elfcpp::STB tobinding = to->binding();
@@ -409,8 +409,8 @@ Symbol_table::resolve(Sized_symbol<size>* to,
bool
Symbol_table::should_override(const Symbol* to, unsigned int frombits,
- Defined defined, Object* object,
- bool* adjust_common_sizes,
+ elfcpp::STT fromtype, Defined defined,
+ Object* object, bool* adjust_common_sizes,
bool* adjust_dyndef)
{
*adjust_common_sizes = false;
@@ -434,7 +434,13 @@ Symbol_table::should_override(const Symbol* to, unsigned int frombits,
to->type());
}
- // FIXME: Warn if either but not both of TO and SYM are STT_TLS.
+ if (to->type() == elfcpp::STT_TLS
+ ? fromtype != elfcpp::STT_TLS
+ : fromtype == elfcpp::STT_TLS)
+ Symbol_table::report_resolve_problem(true,
+ _("symbol '%s' used as both __thread "
+ "and non-__thread"),
+ to, defined, object);
// We use a giant switch table for symbol resolution. This code is
// unwieldy, but: 1) it is efficient; 2) we definitely handle all
@@ -870,13 +876,15 @@ Symbol_table::report_resolve_problem(bool is_error, const char* msg,
// defining special symbols.
bool
-Symbol_table::should_override_with_special(const Symbol* to, Defined defined)
+Symbol_table::should_override_with_special(const Symbol* to,
+ elfcpp::STT fromtype,
+ Defined defined)
{
bool adjust_common_sizes;
bool adjust_dyn_def;
unsigned int frombits = global_flag | regular_flag | def_flag;
- bool ret = Symbol_table::should_override(to, frombits, defined, NULL,
- &adjust_common_sizes,
+ bool ret = Symbol_table::should_override(to, frombits, fromtype, defined,
+ NULL, &adjust_common_sizes,
&adjust_dyn_def);
gold_assert(!adjust_common_sizes && !adjust_dyn_def);
return ret;