binutils (2.20.1-16) 139_gold_pr10916

Summary

 gold/symtab.cc                       |    3 ++-
 gold/testsuite/exclude_libs_test_1.c |    8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

    
download this patch

Patch contents

#!/bin/sh -e
## 139_gold_pr10916.dpatch
##
## DP: Description: PR gold/10916: Fix --exclude-libs with undefined symbol

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi

[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"

case "$1" in
       -patch) patch $patch_opts -p1 < $0;;
       -unpatch) patch $patch_opts -p1 -R < $0;;
        *)
                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
                exit 1;;
esac

exit 0

@DPATCH@
--- ./gold/symtab.cc	29 Dec 2009 00:31:48 -0000	1.134
+++ ./gold/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)
diff -p -u -r1.1 exclude_libs_test_1.c
--- ./gold/testsuite/exclude_libs_test_1.c	19 May 2009 22:14:17 -0000	1.1
+++ ./gold/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 ();
+}