aboutsummaryrefslogtreecommitdiff
path: root/gold/i386.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/i386.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/i386.cc')
-rw-r--r--gold/i386.cc54
1 files changed, 45 insertions, 9 deletions
diff --git a/gold/i386.cc b/gold/i386.cc
index 6c6c4b4..21d008c 100644
--- a/gold/i386.cc
+++ b/gold/i386.cc
@@ -2638,7 +2638,11 @@ Target_i386::Relocate::relocate_tls(const Relocate_info<32, false>* relinfo,
case elfcpp::R_386_TLS_GD: // Global-dynamic
if (optimized_type == tls::TLSOPT_TO_LE)
{
- gold_assert(tls_segment != NULL);
+ if (tls_segment == NULL)
+ {
+ gold_assert(parameters->errors()->error_count() > 0);
+ return;
+ }
this->tls_gd_to_le(relinfo, relnum, tls_segment,
rel, r_type, value, view,
view_size);
@@ -2664,7 +2668,11 @@ Target_i386::Relocate::relocate_tls(const Relocate_info<32, false>* relinfo,
}
if (optimized_type == tls::TLSOPT_TO_IE)
{
- gold_assert(tls_segment != NULL);
+ if (tls_segment == NULL)
+ {
+ gold_assert(parameters->errors()->error_count() > 0);
+ return;
+ }
this->tls_gd_to_ie(relinfo, relnum, tls_segment, rel, r_type,
got_offset, view, view_size);
break;
@@ -2687,7 +2695,11 @@ Target_i386::Relocate::relocate_tls(const Relocate_info<32, false>* relinfo,
this->local_dynamic_type_ = LOCAL_DYNAMIC_GNU;
if (optimized_type == tls::TLSOPT_TO_LE)
{
- gold_assert(tls_segment != NULL);
+ if (tls_segment == NULL)
+ {
+ gold_assert(parameters->errors()->error_count() > 0);
+ return;
+ }
this->tls_desc_gd_to_le(relinfo, relnum, tls_segment,
rel, r_type, value, view,
view_size);
@@ -2722,7 +2734,11 @@ Target_i386::Relocate::relocate_tls(const Relocate_info<32, false>* relinfo,
}
if (optimized_type == tls::TLSOPT_TO_IE)
{
- gold_assert(tls_segment != NULL);
+ if (tls_segment == NULL)
+ {
+ gold_assert(parameters->errors()->error_count() > 0);
+ return;
+ }
this->tls_desc_gd_to_ie(relinfo, relnum, tls_segment, rel, r_type,
got_offset, view, view_size);
break;
@@ -2754,7 +2770,11 @@ Target_i386::Relocate::relocate_tls(const Relocate_info<32, false>* relinfo,
this->local_dynamic_type_ = LOCAL_DYNAMIC_GNU;
if (optimized_type == tls::TLSOPT_TO_LE)
{
- gold_assert(tls_segment != NULL);
+ if (tls_segment == NULL)
+ {
+ gold_assert(parameters->errors()->error_count() > 0);
+ return;
+ }
this->tls_ld_to_le(relinfo, relnum, tls_segment, rel, r_type,
value, view, view_size);
break;
@@ -2785,7 +2805,11 @@ Target_i386::Relocate::relocate_tls(const Relocate_info<32, false>* relinfo,
elfcpp::Shdr<32, false> shdr(relinfo->data_shdr);
if ((shdr.get_sh_flags() & elfcpp::SHF_EXECINSTR) != 0)
{
- gold_assert(tls_segment != NULL);
+ if (tls_segment == NULL)
+ {
+ gold_assert(parameters->errors()->error_count() > 0);
+ return;
+ }
value -= tls_segment->memsz();
}
}
@@ -2797,7 +2821,11 @@ Target_i386::Relocate::relocate_tls(const Relocate_info<32, false>* relinfo,
case elfcpp::R_386_TLS_IE_32:
if (optimized_type == tls::TLSOPT_TO_LE)
{
- gold_assert(tls_segment != NULL);
+ if (tls_segment == NULL)
+ {
+ gold_assert(parameters->errors()->error_count() > 0);
+ return;
+ }
Target_i386::Relocate::tls_ie_to_le(relinfo, relnum, tls_segment,
rel, r_type, value, view,
view_size);
@@ -2841,7 +2869,11 @@ Target_i386::Relocate::relocate_tls(const Relocate_info<32, false>* relinfo,
// have been created for this location, so do not apply it now.
if (!parameters->options().shared())
{
- gold_assert(tls_segment != NULL);
+ if (tls_segment == NULL)
+ {
+ gold_assert(parameters->errors()->error_count() > 0);
+ return;
+ }
value -= tls_segment->memsz();
Relocate_functions<32, false>::rel32(view, value);
}
@@ -2852,7 +2884,11 @@ Target_i386::Relocate::relocate_tls(const Relocate_info<32, false>* relinfo,
// have been created for this location, so do not apply it now.
if (!parameters->options().shared())
{
- gold_assert(tls_segment != NULL);
+ if (tls_segment == NULL)
+ {
+ gold_assert(parameters->errors()->error_count() > 0);
+ return;
+ }
value = tls_segment->memsz() - value;
Relocate_functions<32, false>::rel32(view, value);
}