# DP: libgcc backports from the trunk: # DP: - Always define USE_PT_GNU_EH_FRAME in crtstuff.c for glibc. # DP: - Build static libgcc with hidden visibility even with --disable-shared. libgcc/ 2012-08-19 Joseph Myers * crtstuff.c (USE_PT_GNU_EH_FRAME): Define for systems using glibc even if inhibit_libc. 2012-08-22 Joseph Myers * Makefile.in (vis_hide, gen-hide-list): Do not make definitions depend on --enable-shared. ($(lib1asmfuncs-o)): Use %.vis files independent of --enable-shared. * static-object.mk ($(base)$(objext), $(base).vis) ($(base)_s$(objext)): Use same rules for visibility handling as in shared-object.mk. Index: b/libgcc/crtstuff.c =================================================================== --- a/libgcc/crtstuff.c +++ b/libgcc/crtstuff.c @@ -1,7 +1,7 @@ /* Specialized bits of code needed to support construction and destruction of file-scope objects in C++ code. Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 - 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 + 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Ron Guilmette (rfg@monkeys.com). @@ -113,6 +113,20 @@ # define USE_PT_GNU_EH_FRAME # endif #endif + +#if defined(OBJECT_FORMAT_ELF) \ + && !defined(OBJECT_FORMAT_FLAT) \ + && defined(HAVE_LD_EH_FRAME_HDR) \ + && !defined(CRTSTUFFT_O) \ + && defined(inhibit_libc) \ + && (defined(__GLIBC__) || defined(__gnu_linux__) || defined(__GNU__)) +/* On systems using glibc, an inhibit_libc build of libgcc is only + part of a bootstrap process. Build the same crt*.o as would be + built with headers present, so that it is not necessary to build + glibc more than once for the bootstrap to converge. */ +# define USE_PT_GNU_EH_FRAME +#endif + #if defined(EH_FRAME_SECTION_NAME) && !defined(USE_PT_GNU_EH_FRAME) # define USE_EH_FRAME_REGISTRY #endif Index: b/libgcc/Makefile.in =================================================================== --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -362,6 +362,7 @@ ifneq ($(LIBUNWIND),) install-libunwind = install-libunwind endif +endif # For -fvisibility=hidden. We need both a -fvisibility=hidden on # the command line, and a #define to prevent libgcc2.h etc from @@ -385,11 +386,8 @@ gen-hide-list = echo > $@ endif -else -# Not enable_shared. +ifneq ($(enable_shared),yes) iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items)) -vis_hide = -gen-hide-list = echo > \$@ endif LIB2ADD += enable-execute-stack.c @@ -438,7 +436,6 @@ $(LIB2_DIVMOD_FUNCS)) # Build "libgcc1" (assembly) components. -ifeq ($(enable_shared),yes) lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS)) $(lib1asmfuncs-o): %$(objext): $(srcdir)/config/$(LIB1ASMSRC) %.vis @@ -450,14 +447,9 @@ lib1asmfuncs-s-o = $(patsubst %,%_s$(objext),$(LIB1ASMFUNCS)) $(lib1asmfuncs-s-o): %_s$(objext): $(srcdir)/config/$(LIB1ASMSRC) $(gcc_s_compile) -DL$* -xassembler-with-cpp -c $< -libgcc-s-objects += $(lib1asmfuncs-s-o) - -else +ifeq ($(enable_shared),yes) -lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS)) -$(lib1asmfuncs-o): %$(objext): $(srcdir)/config/$(LIB1ASMSRC) - $(gcc_compile) -DL$* -xassembler-with-cpp -c $< -libgcc-objects += $(lib1asmfuncs-o) +libgcc-s-objects += $(lib1asmfuncs-s-o) endif Index: b/libgcc/static-object.mk =================================================================== --- a/libgcc/static-object.mk +++ b/libgcc/static-object.mk @@ -24,7 +24,13 @@ endif endif -$(base)$(objext): $o - $(gcc_compile) -c -xassembler-with-cpp $< +$(base)$(objext): $o $(base).vis + $(gcc_compile) -c -xassembler-with-cpp -include $*.vis $< + +$(base).vis: $(base)_s$(objext) + $(gen-hide-list) + +$(base)_s$(objext): $o + $(gcc_s_compile) -c -xassembler-with-cpp $< endif