aboutsummaryrefslogtreecommitdiffstats
path: root/main/gcc/libgcc-backports.patch
blob: af556ed991ec8ccc90287e2199a6023fbc486b6f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# 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  <joseph@codesourcery.com>

	* crtstuff.c (USE_PT_GNU_EH_FRAME): Define for systems using glibc
	even if inhibit_libc.

2012-08-22  Joseph Myers  <joseph@codesourcery.com>

	* 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