GNU Binutils with patches for OS216
Revisão | c20ceeb226168ffd84078ef74d890c2b7f69a435 (tree) |
---|---|
Hora | 2015-07-21 01:19:02 |
Autor | Yiran Wang <yiran@goog...> |
Commiter | Cary Coutant |
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.
@@ -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 | + | |
1 | 12 | 2015-07-14 H.J. Lu <hongjiu.lu@intel.com> |
2 | 13 | |
3 | 14 | * compressed_output.cc (Output_compressed_section::set_final_data_size): |
@@ -286,15 +286,10 @@ Symbol_table::resolve(Sized_symbol<size>* to, | ||
286 | 286 | && (to->visibility() == elfcpp::STV_HIDDEN |
287 | 287 | || to->visibility() == elfcpp::STV_INTERNAL)) |
288 | 288 | { |
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). | |
298 | 293 | return; |
299 | 294 | } |
300 | 295 | else |
@@ -2099,11 +2099,13 @@ endif MCMODEL_MEDIUM | ||
2099 | 2099 | # referenced by a shared library. |
2100 | 2100 | check_SCRIPTS += hidden_test.sh |
2101 | 2101 | check_DATA += hidden_test.err |
2102 | -MOSTLYCLEANFILES += hidden_test hidden_test.err | |
2102 | +MOSTLYCLEANFILES += hidden_test hidden_test.err hidden_test.syms | |
2103 | 2103 | libhidden.so: hidden_test_1.c gcctestdir/ld |
2104 | 2104 | $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c |
2105 | 2105 | hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld |
2106 | 2106 | $(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 > $@ | |
2107 | 2109 | hidden_test.err: hidden_test |
2108 | 2110 | @touch hidden_test.err |
2109 | 2111 |
@@ -498,6 +498,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ | ||
498 | 498 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ discard_locals_relocatable_test1.out \ |
499 | 499 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ discard_locals_relocatable_test2.out \ |
500 | 500 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ hidden_test hidden_test.err \ |
501 | +@GCC_TRUE@@NATIVE_LINKER_TRUE@ hidden_test.syms \ | |
501 | 502 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ retain_symbols_file_test \ |
502 | 503 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ retain_symbols_file_test.in \ |
503 | 504 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ retain_symbols_file_test.stdout \ |
@@ -6013,6 +6014,8 @@ uninstall-am: | ||
6013 | 6014 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c |
6014 | 6015 | @GCC_TRUE@@NATIVE_LINKER_TRUE@hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld |
6015 | 6016 | @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 > $@ | |
6016 | 6019 | @GCC_TRUE@@NATIVE_LINKER_TRUE@hidden_test.err: hidden_test |
6017 | 6020 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ @touch hidden_test.err |
6018 | 6021 | @GCC_TRUE@@NATIVE_LINKER_TRUE@retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld |
@@ -29,11 +29,11 @@ | ||
29 | 29 | # error messages are issued for the references to internal and |
30 | 30 | # hidden symbols. The errors will be found in hidden_test.err. |
31 | 31 | |
32 | -check() | |
32 | +check_missing() | |
33 | 33 | { |
34 | - if ! grep -q "$2" "$1" | |
34 | + if grep -q "$2" "$1" | |
35 | 35 | then |
36 | - echo "Did not find expected error in $1:" | |
36 | + echo "Found unexpected error in $1:" | |
37 | 37 | echo " $2" |
38 | 38 | echo "" |
39 | 39 | echo "Actual error output below:" |
@@ -42,25 +42,29 @@ check() | ||
42 | 42 | fi |
43 | 43 | } |
44 | 44 | |
45 | -check_missing() | |
45 | +check_missing_sym() | |
46 | 46 | { |
47 | 47 | if grep -q "$2" "$1" |
48 | 48 | then |
49 | - echo "Found unexpected error in $1:" | |
49 | + echo "Found unexpected symbol in $1:" | |
50 | 50 | echo " $2" |
51 | 51 | echo "" |
52 | - echo "Actual error output below:" | |
52 | + echo "Actual nm output below:" | |
53 | 53 | cat "$1" |
54 | 54 | exit 1 |
55 | 55 | fi |
56 | 56 | } |
57 | 57 | |
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 | - | |
62 | 58 | # We shouldn't see errors for the default and protected symbols. |
63 | 59 | check_missing hidden_test.err "main_default" |
64 | 60 | check_missing hidden_test.err "main_protected" |
65 | 61 | |
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 | + | |
66 | 70 | exit 0 |