summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRahul Chaudhry <rahulchaudhry@google.com>2016-06-28 21:33:51 (GMT)
committerRahul Chaudhry <rahulchaudhry@google.com>2016-06-28 22:03:15 (GMT)
commit6422a80df992e4542dbd4fb70a04f316065674af (patch)
tree641fb37846e0eb33ad84c003979bc5049d2b061f
parent4520d6bee11b130d3f05175db13d3000f7ecf1a8 (diff)
downloadtoolchain_binutils-6422a80df992e4542dbd4fb70a04f316065674af.zip
toolchain_binutils-6422a80df992e4542dbd4fb70a04f316065674af.tar.gz
toolchain_binutils-6422a80df992e4542dbd4fb70a04f316065674af.tar.bz2
Remove warning about references from shared objects to hidden symbols.
Bug: 21502954 This patch is backported from upstream - commit c20ceeb226168ffd84078ef74d890c2b7f69a435 Author: Yiran Wang <yiran@google.com> Date: Mon Jul 20 08:47:57 2015 -0700 Remove warning about references from shared objects to hidden symbols. gold/ PR gold/15574 * resolve.cc (Symbol_table): Remove warning about references from shared objects to hidden symbols. * testsuite/Makefile.am (hidden_test): Add hidden_test.syms. * testsuite/Makefile.in: Regenerate. * testsuite/hidden_test.sh: Check dynamic symbol table; update expected error messages. Change-Id: Ie6fb67071c7f478859069b7b4bf629cd44f91844
-rw-r--r--binutils-2.25/gold/ChangeLog11
-rw-r--r--binutils-2.25/gold/resolve.cc13
-rw-r--r--binutils-2.25/gold/testsuite/Makefile.am4
-rw-r--r--binutils-2.25/gold/testsuite/Makefile.in3
-rwxr-xr-xbinutils-2.25/gold/testsuite/hidden_test.sh24
5 files changed, 35 insertions, 20 deletions
diff --git a/binutils-2.25/gold/ChangeLog b/binutils-2.25/gold/ChangeLog
index cd95752..9e84837 100644
--- a/binutils-2.25/gold/ChangeLog
+++ b/binutils-2.25/gold/ChangeLog
@@ -1,3 +1,14 @@
+2015-07-20 Yiran Wang <yiran@google.com>
+ Cary Coutant <ccoutant@gmail.com>
+
+ PR gold/15574
+ * resolve.cc (Symbol_table): Remove warning about references
+ from shared objects to hidden symbols.
+ * testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
+ * testsuite/Makefile.in: Regenerate.
+ * testsuite/hidden_test.sh: Check dynamic symbol table; update
+ expected error messages.
+
2016-06-28 Rahul Chaudhry <rahulchaudhry@google.com>
Revert patch -- to be replaced by the upstream patch with tests.
diff --git a/binutils-2.25/gold/resolve.cc b/binutils-2.25/gold/resolve.cc
index 07dff4a..b49c45c 100644
--- a/binutils-2.25/gold/resolve.cc
+++ b/binutils-2.25/gold/resolve.cc
@@ -279,15 +279,10 @@ Symbol_table::resolve(Sized_symbol<size>* to,
&& (to->visibility() == elfcpp::STV_HIDDEN
|| to->visibility() == elfcpp::STV_INTERNAL))
{
- // A dynamic object cannot reference a hidden or internal symbol
- // defined in another object.
- gold_warning(_("%s symbol '%s' in %s is referenced by DSO %s"),
- (to->visibility() == elfcpp::STV_HIDDEN
- ? "hidden"
- : "internal"),
- to->demangled_name().c_str(),
- to->object()->name().c_str(),
- object->name().c_str());
+ // The symbol is hidden, so a reference from a shared object
+ // cannot bind to it. We tried issuing a warning in this case,
+ // but that produces false positives when the symbol is
+ // actually resolved in a different shared object (PR 15574).
return;
}
else
diff --git a/binutils-2.25/gold/testsuite/Makefile.am b/binutils-2.25/gold/testsuite/Makefile.am
index a9caa6b..ce1af05 100644
--- a/binutils-2.25/gold/testsuite/Makefile.am
+++ b/binutils-2.25/gold/testsuite/Makefile.am
@@ -1894,11 +1894,13 @@ endif MCMODEL_MEDIUM
# referenced by a shared library.
check_SCRIPTS += hidden_test.sh
check_DATA += hidden_test.err
-MOSTLYCLEANFILES += hidden_test hidden_test.err
+MOSTLYCLEANFILES += hidden_test hidden_test.err hidden_test.syms
libhidden.so: hidden_test_1.c gcctestdir/ld
$(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
$(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
+hidden_test.syms: hidden_test
+ $(TEST_NM) -D hidden_test > $@
hidden_test.err: hidden_test
@touch hidden_test.err
diff --git a/binutils-2.25/gold/testsuite/Makefile.in b/binutils-2.25/gold/testsuite/Makefile.in
index 3cdf45e..17a73fd 100644
--- a/binutils-2.25/gold/testsuite/Makefile.in
+++ b/binutils-2.25/gold/testsuite/Makefile.in
@@ -507,6 +507,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@GCC_TRUE@@TEST_AS_NATIVE_LINKER_TRUE@ discard_locals_relocatable_test2.out \
@GCC_TRUE@@TEST_AS_NATIVE_LINKER_TRUE@ hidden_test \
@GCC_TRUE@@TEST_AS_NATIVE_LINKER_TRUE@ hidden_test.err \
+@GCC_TRUE@@TEST_AS_NATIVE_LINKER_TRUE@ hidden_test.syms \
@GCC_TRUE@@TEST_AS_NATIVE_LINKER_TRUE@ retain_symbols_file_test \
@GCC_TRUE@@TEST_AS_NATIVE_LINKER_TRUE@ retain_symbols_file_test.in \
@GCC_TRUE@@TEST_AS_NATIVE_LINKER_TRUE@ retain_symbols_file_test.stdout \
@@ -5624,6 +5625,8 @@ uninstall-am:
@GCC_TRUE@@TEST_AS_NATIVE_LINKER_TRUE@ $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
@GCC_TRUE@@TEST_AS_NATIVE_LINKER_TRUE@hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
@GCC_TRUE@@TEST_AS_NATIVE_LINKER_TRUE@ $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
+@GCC_TRUE@@TEST_AS_NATIVE_LINKER_TRUE@hidden_test.syms: hidden_test
+@GCC_TRUE@@TEST_AS_NATIVE_LINKER_TRUE@ $(TEST_NM) -D hidden_test > $@
@GCC_TRUE@@TEST_AS_NATIVE_LINKER_TRUE@hidden_test.err: hidden_test
@GCC_TRUE@@TEST_AS_NATIVE_LINKER_TRUE@ @touch hidden_test.err
@GCC_TRUE@@TEST_AS_NATIVE_LINKER_TRUE@retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
diff --git a/binutils-2.25/gold/testsuite/hidden_test.sh b/binutils-2.25/gold/testsuite/hidden_test.sh
index 39ebbf6..05633d0 100755
--- a/binutils-2.25/gold/testsuite/hidden_test.sh
+++ b/binutils-2.25/gold/testsuite/hidden_test.sh
@@ -29,11 +29,11 @@
# error messages are issued for the references to internal and
# hidden symbols. The errors will be found in hidden_test.err.
-check()
+check_missing()
{
- if ! grep -q "$2" "$1"
+ if grep -q "$2" "$1"
then
- echo "Did not find expected error in $1:"
+ echo "Found unexpected error in $1:"
echo " $2"
echo ""
echo "Actual error output below:"
@@ -42,25 +42,29 @@ check()
fi
}
-check_missing()
+check_missing_sym()
{
if grep -q "$2" "$1"
then
- echo "Found unexpected error in $1:"
+ echo "Found unexpected symbol in $1:"
echo " $2"
echo ""
- echo "Actual error output below:"
+ echo "Actual nm output below:"
cat "$1"
exit 1
fi
}
-# We should see errors for hidden and internal symbols.
-check hidden_test.err "hidden symbol 'main_hidden' in hidden_test_main.o is referenced by DSO libhidden.so"
-check hidden_test.err "internal symbol 'main_internal' in hidden_test_main.o is referenced by DSO libhidden.so"
-
# We shouldn't see errors for the default and protected symbols.
check_missing hidden_test.err "main_default"
check_missing hidden_test.err "main_protected"
+# We shouldn't see errors for the hidden and internal symbols either (PR 15574).
+check_missing hidden_test.err "main_hidden"
+check_missing hidden_test.err "main_internal"
+
+# We shouldn't see the hidden or internal symbols in the dynamic symbol table.
+check_missing_sym hidden_test.syms "main_hidden"
+check_missing_sym hidden_test.syms "main_internal"
+
exit 0