This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[gold patch] PR gold/13359: fix crash on TLS relocation when no TLS sections in program
- From: Cary Coutant <ccoutant at google dot com>
- To: Ian Lance Taylor <iant at google dot com>, Binutils <binutils at sourceware dot org>
- Date: Fri, 28 Oct 2011 15:46:54 -0700
- Subject: [gold patch] PR gold/13359: fix crash on TLS relocation when no TLS sections in program
PR 13359 as about a gold crash when an input file contains an
R_X86_64_TLSGD to an undefined TLS symbol, and the program contains no
other TLS data, so there is no TLS segment. The code for applying the
relocation asserts that tls_segment != NULL, but for this particular
relocation, there is no dependence on having a tls_segment, so the
assertion is completely unnecessary. This patch removes that
assertion. I elected not to remove the parameter entirely from
tls_gd_to_ie() just to preserve the consistency between the TLS
optimization routines.
Tested on i386 and x86_64. OK to commit?
-cary
2011-10-28 Cary Coutant <ccoutant@google.com>
PR gold/13359
* i386.cc (Target_i386::Relocate::relocate_tls): Remove
unnecessary assertion.
* x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
commit ab9b891bace32faba9f224285eba37174f327bb0
Author: Cary Coutant <ccoutant@google.com>
Date: Fri Oct 28 15:37:09 2011 -0700
Fix PR 13359, remove unnecessary assertion on tls_segment.
diff --git a/gold/i386.cc b/gold/i386.cc
index 445bc68..191a915 100644
--- a/gold/i386.cc
+++ b/gold/i386.cc
@@ -2709,12 +2709,6 @@ Target_i386::Relocate::relocate_tls
}
if (optimized_type == tls::TLSOPT_TO_IE)
{
- if (tls_segment == NULL)
- {
- gold_assert(parameters->errors()->error_count() > 0
- || issue_undefined_symbol_error(gsym));
- return;
- }
this->tls_gd_to_ie(relinfo, relnum, tls_segment, rel, r_type,
got_offset, view, view_size);
break;
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index e61d7d1..0762926 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -3181,12 +3181,6 @@ Target_x86_64::Relocate::relocate_tls
}
if (optimized_type == tls::TLSOPT_TO_IE)
{
- if (tls_segment == NULL)
- {
- gold_assert(parameters->errors()->error_count() > 0
- || issue_undefined_symbol_error(gsym));
- return;
- }
value = target->got_plt_section()->address() + got_offset;
this->tls_gd_to_ie(relinfo, relnum, tls_segment, rela, r_type,
value, view, address, view_size);