From 1c74fab0d1fd52933617779be761ce2cc860fa31 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 31 Dec 2009 01:14:34 +0000 Subject: [PATCH] PR 10916 * symtab.cc (Symbol_table::add_from_relobj): When not exporting symbols from this object, don't change the visibility of an undefined symbol. * testsuite/exclude_libs_test_1.c (lib1_ref): New function. --- gold/ChangeLog | 8 ++++++++ gold/symtab.cc | 3 ++- gold/testsuite/exclude_libs_test_1.c | 8 ++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index 05aac4b..f32f46f 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,5 +1,13 @@ 2009-12-30 Ian Lance Taylor + PR 10916 + * symtab.cc (Symbol_table::add_from_relobj): When not exporting + symbols from this object, don't change the visibility of an + undefined symbol. + * testsuite/exclude_libs_test_1.c (lib1_ref): New function. + +2009-12-30 Ian Lance Taylor + PR 10861 * script.h (class Version_script_info): Define Language enum. Update declarations. Define Glob, Exact, and Lookup types. Add diff --git a/gold/symtab.cc b/gold/symtab.cc index d8461a7..79fc4e6 100644 --- a/gold/symtab.cc +++ b/gold/symtab.cc @@ -1151,7 +1151,8 @@ Symbol_table::add_from_relobj( } // Fix up visibility if object has no-export set. - if (relobj->no_export()) + if (relobj->no_export() + && (orig_st_shndx != elfcpp::SHN_UNDEF || !is_ordinary)) { // We may have copied symbol already above. if (psym != &sym2) diff --git a/gold/testsuite/exclude_libs_test_1.c b/gold/testsuite/exclude_libs_test_1.c index ced1aad..48b617b 100644 --- a/gold/testsuite/exclude_libs_test_1.c +++ b/gold/testsuite/exclude_libs_test_1.c @@ -2,6 +2,8 @@ void lib1_default (void); void lib1_hidden (void); void lib1_internal (void); void lib1_protected (void); +void lib1_ref (void); +extern void lib2_default (void); void __attribute__((visibility ("default"))) lib1_default (void) @@ -22,3 +24,9 @@ void __attribute__((visibility ("protected"))) lib1_protected (void) { } + +void +lib1_ref (void) +{ + lib2_default (); +} -- 2.7.4