This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gold patch committed: Fix --exclude-libs with undefined symbol


The support for --exclude-libs did not correctly handle an undefined
symbol in the excluded library.  It gave such a symbol hidden
visibility, which makes no sense.  --exclude-libs should only apply to
symbols actually being defined in the library being excluded.  I
committed this patch to fix it, along with a test case.

Ian


2009-12-30  Ian Lance Taylor  <iant@google.com>

	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.


Index: symtab.cc
===================================================================
RCS file: /cvs/src/src/gold/symtab.cc,v
retrieving revision 1.134
diff -p -u -r1.134 symtab.cc
--- symtab.cc	29 Dec 2009 00:31:48 -0000	1.134
+++ symtab.cc	31 Dec 2009 01:12:48 -0000
@@ -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)
Index: testsuite/exclude_libs_test_1.c
===================================================================
RCS file: /cvs/src/src/gold/testsuite/exclude_libs_test_1.c,v
retrieving revision 1.1
diff -p -u -r1.1 exclude_libs_test_1.c
--- testsuite/exclude_libs_test_1.c	19 May 2009 22:14:17 -0000	1.1
+++ testsuite/exclude_libs_test_1.c	31 Dec 2009 01:12:48 -0000
@@ -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 ("protect
 lib1_protected (void)
 {
 }
+
+void
+lib1_ref (void)
+{
+  lib2_default ();
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]