[gold patch] PR gold/13245: don't treat refs from .so as refs from outside IR
Cary Coutant
ccoutant@google.com
Mon Oct 17 21:28:00 GMT 2011
This patch fixes PR gold/13245, where a symbol is reported as
PREVAILING_DEF instead of PREVAILING_DEF_IRONLY_EXP when it is
referenced from a shared object, but not from any non-IR .o files.
Tested on x86_64. OK?
-cary
2011-10-17 Cary Coutant <ccoutant@google.com>
PR gold/13245
* gold/plugin.cc (is_visible_from_outside): Check for symbols
referenced from dynamic objects.
* gold/resolve.cc (Symbol_table::resolve): Don't count references
from dynamic objects as references from real ELF files.
* testsuite/plugin_test_2.sh: Adjust expected result.
-------------- next part --------------
2011-10-17 Cary Coutant <ccoutant@google.com>
PR gold/13245
* gold/plugin.cc (is_visible_from_outside): Check for symbols
referenced from dynamic objects.
* gold/resolve.cc (Symbol_table::resolve): Don't count references
from dynamic objects as references from real ELF files.
* testsuite/plugin_test_2.sh: Adjust expected result.
commit 1ed99d43c65380ef973687a24519c80e17d84666
Author: Cary Coutant <ccoutant@google.com>
Date: Mon Oct 3 15:33:18 2011 -0700
Don't count refs from shared libs as refs from outside.
diff --git a/gold/plugin.cc b/gold/plugin.cc
index b5880a1..573db82 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -838,6 +838,8 @@ is_referenced_from_outside(Symbol* lsym)
static inline bool
is_visible_from_outside(Symbol* lsym)
{
+ if (lsym->in_dyn())
+ return true;
if (parameters->options().export_dynamic() || parameters->options().shared())
return lsym->is_externally_visible();
return false;
diff --git a/gold/resolve.cc b/gold/resolve.cc
index 03288ec..2a68876 100644
--- a/gold/resolve.cc
+++ b/gold/resolve.cc
@@ -296,7 +296,7 @@ Symbol_table::resolve(Sized_symbol<size>* to,
// Record if we've seen this symbol in a real ELF object (i.e., the
// symbol is referenced from outside the world known to the plugin).
- if (object->pluginobj() == NULL)
+ if (object->pluginobj() == NULL && !object->is_dynamic())
to->set_in_real_elf();
// If we're processing replacement files, allow new symbols to override
diff --git a/gold/testsuite/plugin_test_2.sh b/gold/testsuite/plugin_test_2.sh
index a47d22a..293b1f0 100755
--- a/gold/testsuite/plugin_test_2.sh
+++ b/gold/testsuite/plugin_test_2.sh
@@ -45,7 +45,7 @@ check plugin_test_2.err "two_file_test_main.o: claim file hook called"
check plugin_test_2.err "two_file_test_1.syms: claim file hook called"
check plugin_test_2.err "two_file_test_1b.syms: claim file hook called"
check plugin_test_2.err "two_file_shared_2.so: claim file hook called"
-check plugin_test_2.err "two_file_test_1.syms: _Z4f13iv: PREVAILING_DEF_REG"
+check plugin_test_2.err "two_file_test_1.syms: _Z4f13iv: PREVAILING_DEF_IRONLY_EXP"
check plugin_test_2.err "two_file_test_1.syms: _Z2t2v: PREVAILING_DEF_REG"
check plugin_test_2.err "two_file_test_1.syms: v2: RESOLVED_DYN"
check plugin_test_2.err "two_file_test_1.syms: t17data: RESOLVED_DYN"
More information about the Binutils
mailing list