• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisãoc20ceeb226168ffd84078ef74d890c2b7f69a435 (tree)
Hora2015-07-21 01:19:02
AutorYiran Wang <yiran@goog...>
CommiterCary Coutant

Mensagem de Log

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.

Mudança Sumário

Diff

--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,14 @@
1+2015-07-20 Yiran Wang <yiran@google.com>
2+ Cary Coutant <ccoutant@gmail.com>
3+
4+ PR gold/15574
5+ * resolve.cc (Symbol_table): Remove warning about references
6+ from shared objects to hidden symbols.
7+ * testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
8+ * testsuite/Makefile.in: Regenerate.
9+ * testsuite/hidden_test.sh: Check dynamic symbol table; update
10+ expected error messages.
11+
112 2015-07-14 H.J. Lu <hongjiu.lu@intel.com>
213
314 * compressed_output.cc (Output_compressed_section::set_final_data_size):
--- a/gold/resolve.cc
+++ b/gold/resolve.cc
@@ -286,15 +286,10 @@ Symbol_table::resolve(Sized_symbol<size>* to,
286286 && (to->visibility() == elfcpp::STV_HIDDEN
287287 || to->visibility() == elfcpp::STV_INTERNAL))
288288 {
289- // A dynamic object cannot reference a hidden or internal symbol
290- // defined in another object.
291- gold_warning(_("%s symbol '%s' in %s is referenced by DSO %s"),
292- (to->visibility() == elfcpp::STV_HIDDEN
293- ? "hidden"
294- : "internal"),
295- to->demangled_name().c_str(),
296- to->object()->name().c_str(),
297- object->name().c_str());
289+ // The symbol is hidden, so a reference from a shared object
290+ // cannot bind to it. We tried issuing a warning in this case,
291+ // but that produces false positives when the symbol is
292+ // actually resolved in a different shared object (PR 15574).
298293 return;
299294 }
300295 else
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -2099,11 +2099,13 @@ endif MCMODEL_MEDIUM
20992099 # referenced by a shared library.
21002100 check_SCRIPTS += hidden_test.sh
21012101 check_DATA += hidden_test.err
2102-MOSTLYCLEANFILES += hidden_test hidden_test.err
2102+MOSTLYCLEANFILES += hidden_test hidden_test.err hidden_test.syms
21032103 libhidden.so: hidden_test_1.c gcctestdir/ld
21042104 $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
21052105 hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
21062106 $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
2107+hidden_test.syms: hidden_test
2108+ $(TEST_NM) -D hidden_test > $@
21072109 hidden_test.err: hidden_test
21082110 @touch hidden_test.err
21092111
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -498,6 +498,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
498498 @GCC_TRUE@@NATIVE_LINKER_TRUE@ discard_locals_relocatable_test1.out \
499499 @GCC_TRUE@@NATIVE_LINKER_TRUE@ discard_locals_relocatable_test2.out \
500500 @GCC_TRUE@@NATIVE_LINKER_TRUE@ hidden_test hidden_test.err \
501+@GCC_TRUE@@NATIVE_LINKER_TRUE@ hidden_test.syms \
501502 @GCC_TRUE@@NATIVE_LINKER_TRUE@ retain_symbols_file_test \
502503 @GCC_TRUE@@NATIVE_LINKER_TRUE@ retain_symbols_file_test.in \
503504 @GCC_TRUE@@NATIVE_LINKER_TRUE@ retain_symbols_file_test.stdout \
@@ -6013,6 +6014,8 @@ uninstall-am:
60136014 @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
60146015 @GCC_TRUE@@NATIVE_LINKER_TRUE@hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
60156016 @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
6017+@GCC_TRUE@@NATIVE_LINKER_TRUE@hidden_test.syms: hidden_test
6018+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_NM) -D hidden_test > $@
60166019 @GCC_TRUE@@NATIVE_LINKER_TRUE@hidden_test.err: hidden_test
60176020 @GCC_TRUE@@NATIVE_LINKER_TRUE@ @touch hidden_test.err
60186021 @GCC_TRUE@@NATIVE_LINKER_TRUE@retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
--- a/gold/testsuite/hidden_test.sh
+++ b/gold/testsuite/hidden_test.sh
@@ -29,11 +29,11 @@
2929 # error messages are issued for the references to internal and
3030 # hidden symbols. The errors will be found in hidden_test.err.
3131
32-check()
32+check_missing()
3333 {
34- if ! grep -q "$2" "$1"
34+ if grep -q "$2" "$1"
3535 then
36- echo "Did not find expected error in $1:"
36+ echo "Found unexpected error in $1:"
3737 echo " $2"
3838 echo ""
3939 echo "Actual error output below:"
@@ -42,25 +42,29 @@ check()
4242 fi
4343 }
4444
45-check_missing()
45+check_missing_sym()
4646 {
4747 if grep -q "$2" "$1"
4848 then
49- echo "Found unexpected error in $1:"
49+ echo "Found unexpected symbol in $1:"
5050 echo " $2"
5151 echo ""
52- echo "Actual error output below:"
52+ echo "Actual nm output below:"
5353 cat "$1"
5454 exit 1
5555 fi
5656 }
5757
58-# We should see errors for hidden and internal symbols.
59-check hidden_test.err "hidden symbol 'main_hidden' in hidden_test_main.o is referenced by DSO libhidden.so"
60-check hidden_test.err "internal symbol 'main_internal' in hidden_test_main.o is referenced by DSO libhidden.so"
61-
6258 # We shouldn't see errors for the default and protected symbols.
6359 check_missing hidden_test.err "main_default"
6460 check_missing hidden_test.err "main_protected"
6561
62+# We shouldn't see errors for the hidden and internal symbols either (PR 15574).
63+check_missing hidden_test.err "main_hidden"
64+check_missing hidden_test.err "main_internal"
65+
66+# We shouldn't see the hidden or internal symbols in the dynamic symbol table.
67+check_missing_sym hidden_test.syms "main_hidden"
68+check_missing_sym hidden_test.syms "main_internal"
69+
6670 exit 0