This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[4.2/4.1 PATCH]: Backport fix for PR25445 to branches
- From: "Kaveh R. GHAZI" <ghazi at caip dot rutgers dot edu>
- To: gcc-patches at gcc dot gnu dot org, froydnj at codesourcery dot com, mark at codesourcery dot com
- Date: Wed, 23 Jan 2008 20:50:06 -0500 (EST)
- Subject: [4.2/4.1 PATCH]: Backport fix for PR25445 to branches
This patch backports Nathan's fix for PR25445 which fixes
gcc.dg/tree-ssa/wholeprogram-1.c when using -fpic/-fPIC.
It was originally posted here:
http://gcc.gnu.org/ml/gcc-patches/2007-07/msg01856.html
and approved by Mark here:
http://gcc.gnu.org/ml/gcc-patches/2007-08/msg00106.html
Tested on 4.2 on x86_64-unknown-linux-gnu and 4.1 on
i686-unknown-linux-gnu, no regressions.
Okay for 4.1/4.2 branches?
Thanks,
--Kaveh
2008-01-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
Backport:
2007-08-02 Nathan Froyd <froydnj@codesourcery.com>
PR middle-end/25445
* varasm.c (default_binds_local_p_1): Consult flag_whole_program
if we are compiling with -fPIC.
diff -rup orig/egcc-4.2-SVN20080123/gcc/varasm.c egcc-4.2-SVN20080123/gcc/varasm.c
--- orig/egcc-4.2-SVN20080123/gcc/varasm.c 2008-01-03 23:38:08.000000000 +0100
+++ egcc-4.2-SVN20080123/gcc/varasm.c 2008-01-23 18:24:21.000000000 +0100
@@ -5872,9 +5872,10 @@ default_binds_local_p_1 (tree exp, int s
else if (DECL_WEAK (exp))
local_p = false;
/* If PIC, then assume that any global name can be overridden by
- symbols resolved from other modules. */
+ symbols resolved from other modules, unless we are compiling with
+ -fwhole-program, which assumes that names are local. */
else if (shlib)
- local_p = false;
+ local_p = flag_whole_program;
/* Uninitialized COMMON variable may be unified with symbols
resolved from other modules. */
else if (DECL_COMMON (exp)