aboutsummaryrefslogtreecommitdiff
path: root/gold/symtab.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2015-04-09 15:47:13 -0700
committerCary Coutant <ccoutant@google.com>2015-04-09 15:47:37 -0700
commita6a177507c8b677e79b3440e36091cb0270c55b8 (patch)
treed4c54714d9b8c17c35580033a468015ce2b88273 /gold/symtab.cc
parent18ece1defb99cf50dc7769444e3394c26329d497 (diff)
downloadgdb-a6a177507c8b677e79b3440e36091cb0270c55b8.zip
gdb-a6a177507c8b677e79b3440e36091cb0270c55b8.tar.gz
gdb-a6a177507c8b677e79b3440e36091cb0270c55b8.tar.bz2
Allow gold to resolve defined TLS symbols in a PIE link.
This patch fixes Symbol::final_value_is_known so that a defined TLS symbol in a PIE link is treated as having a known final value, thus allowing GD->LE TLS optimization, eliminating an unnecessary GOT entry and dynamic relocation. gold/ * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol in a PIE link. * testsuite/Makefile.am (tls_pie_test.sh): New test. * testsuite/Makefile.in: Regenerate. * testsuite/tls_pie_test.sh: New.
Diffstat (limited to 'gold/symtab.cc')
-rw-r--r--gold/symtab.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/gold/symtab.cc b/gold/symtab.cc
index 88e9322..8ec8f73 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -437,9 +437,12 @@ bool
Symbol::final_value_is_known() const
{
// If we are not generating an executable, then no final values are
- // known, since they will change at runtime.
- if (parameters->options().output_is_position_independent()
- || parameters->options().relocatable())
+ // known, since they will change at runtime, with the exception of
+ // TLS symbols in a position-independent executable.
+ if ((parameters->options().output_is_position_independent()
+ || parameters->options().relocatable())
+ && !(this->type() == elfcpp::STT_TLS
+ && parameters->options().pie()))
return false;
// If the symbol is not from an object file, and is not undefined,