To be submitted to google/integration and merged to google/{main,gcc-4_7}.
Would also like to have this considered for trunk, since this patch has no
impact on non-grtev3 targets.

Disable hiding of symbols in static libgcc libraries when built for GRTE v3.
This allows pthread_cancel to perform stack unwinding when libgcc_eh.a is
linked into dynamic executables.  However, this opens up a hole wherein shared
libraries linked with -static-libgcc cannot be individually modified without
risk of breaking dependent libraries.  That's okay in the GRTE v3 environment
because libgcc is compiled without -fPIC anyway.

See http://gcc.gnu.org/ml/gcc/2012-03/msg00104.html for details.

Google ref 5836136.

2012-03-08   Ollie Wild  <a...@google.com>

        * libgcc/Makefile.in (vis_hide): Move default initialization before
        inclusion of $(tmake_file).
        * libgcc/config.host (*-grtev3-*): Disable hiding of symbols in static
        libraries.
        * libgcc/config/t-static-no-vis-hide: New file.

diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 23b72b9..41fbb96 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -334,6 +334,12 @@ LIBUNWIND =
 SHLIBUNWIND_LINK =
 SHLIBUNWIND_INSTALL =
 
+# For -fvisibility=hidden.  We need both a -fvisibility=hidden on
+# the command line, and a #define to prevent libgcc2.h etc from
+# overriding that with #pragmas.  This is set before including $(tmake_file)
+# so it can be overridden on a host-specific basis.
+vis_hide = @vis_hide@
+
 tmake_file = @tmake_file@
 include $(srcdir)/empty.mk $(tmake_file)
 
@@ -363,11 +369,6 @@ ifeq ($(enable_shared),yes)
     install-libunwind = install-libunwind
   endif
 
-# For -fvisibility=hidden.  We need both a -fvisibility=hidden on
-# the command line, and a #define to prevent libgcc2.h etc from
-# overriding that with #pragmas.
-vis_hide = @vis_hide@
-
 ifneq (,$(vis_hide))
 
 # If we have -fvisibility=hidden, then we need to generate hide
diff --git a/libgcc/config.host b/libgcc/config.host
index 257622a..242fbd5 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -1174,3 +1174,10 @@ i[34567]86-*-linux* | x86_64-*-linux*)
        tm_file="${tm_file} i386/value-unwind.h"
        ;;
 esac
+
+case ${host} in
+*-grtev3-*)
+       # Don't hide symbols in static libraries.
+       tmake_file="${tmake_file} t-static-no-vis-hide"
+       ;;
+esac
diff --git a/libgcc/config/t-static-no-vis-hide 
b/libgcc/config/t-static-no-vis-hide
new file mode 100644
index 0000000..955ff35
--- /dev/null
+++ b/libgcc/config/t-static-no-vis-hide
@@ -0,0 +1,2 @@
+# Don't hide symbols in static libraries.
+vis_hide =

--
This patch is available for review at http://codereview.appspot.com/5792054

Reply via email to