summaryrefslogtreecommitdiff
path: root/meta-linaro-toolchain/recipes-devtools/gcc/gcc-4.7/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
blob: ff136e19aa1c68c45973518d2cd3949648788de0 (plain)
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
Upstream-Status: Pending

Before committing, I noticed that PR/32161 was marked as a dup of PR/32009, but my previous patch did not fix it.

This alternative patch is better because it lets you just use CFLAGS_FOR_TARGET to set the compilation flags for libgcc. Since bootstrapped target libraries are never compiled with the native compiler, it makes little sense to use different flags for stage1 and later stages. And it also makes little sense to use a different variable than CFLAGS_FOR_TARGET.

Other changes I had to do include:

- moving the creation of default CFLAGS_FOR_TARGET from Makefile.am to configure.ac, because otherwise the BOOT_CFLAGS are substituted into CFLAGS_FOR_TARGET (which is "-O2 -g $(CFLAGS)") via $(CFLAGS). It is also cleaner this way though.

- passing the right CFLAGS to configure scripts as exported environment variables

I also stopped passing LIBCFLAGS to configure scripts since they are unused in the whole src tree. And I updated the documentation as H-P reminded me to do.

Bootstrapped/regtested i686-pc-linux-gnu, will commit to 4.4 shortly. Ok for 4.3?

Paolo

2008-02-19  Paolo Bonzini  <bonzini@gnu.org>

        PR bootstrap/32009
        PR bootstrap/32161

	* configure.ac (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Compute here.
	* configure: Regenerate.

	* Makefile.def: Define stage_libcflags for all bootstrap stages.
	* Makefile.tpl (BOOT_LIBCFLAGS, STAGE2_LIBCFLAGS, STAGE3_LIBCFLAGS,
	STAGE4_LIBCFLAGS): New.
	(CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Subst from autoconf, without
	$(SYSROOT_CFLAGS_FOR_TARGET) and $(DEBUG_PREFIX_CFLAGS_FOR_TARGET).
	(BASE_TARGET_EXPORTS): Append them here to C{,XX}FLAGS.
	(EXTRA_TARGET_FLAGS): Append them here to {LIB,}C{,XX}FLAGS.
	(configure-stage[+id+]-[+prefix+][+module+]): Pass stage_libcflags
	for target modules.  Don't export LIBCFLAGS.
	(all-stage[+id+]-[+prefix+][+module+]): Pass stage_libcflags; pass
	$(BASE_FLAGS_TO_PASS) where [+args+] was passed, and [+args+] after
	the overridden CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
	(invocations of `all'): Replace $(TARGET_FLAGS_TO_PASS) with
	$(EXTRA_TARGET_FLAGS), $(FLAGS_TO_PASS) with $(EXTRA_HOST_FLAGS).
	* Makefile.in: Regenerate.

config:
2008-02-19  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/32009
	* mh-ppc-darwin (BOOT_CFLAGS): Reenable.

gcc:
2008-02-19  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/32009
	* doc/install.texi: Correct references to CFLAGS, replacing them
	with BOOT_CFLAGS.  Document flags used during bootstrap for
	target libraries.


---
 Makefile.def           |   25 
 Makefile.in            | 1845 ++++++++++++++++++++++++++++++-------------------
 Makefile.tpl           |   91 +-
 config/mh-ppc-darwin   |    3 
 configure              |   36 
 configure.ac           |   32 
 gcc/Makefile.in        |    2 
 gcc/configure          |    6 
 gcc/configure.ac       |    3 
 gcc/doc/install.texi   |   56 -
 libiberty/Makefile.in  |  162 ++--
 libiberty/configure    |   46 -
 libiberty/configure.ac |   43 -
 13 files changed, 1454 insertions(+), 896 deletions(-)

Index: gcc-4_7-branch/configure
===================================================================
--- gcc-4_7-branch.orig/configure	2012-04-10 10:22:05.807343683 -0700
+++ gcc-4_7-branch/configure	2012-04-10 10:37:24.243388086 -0700
@@ -6695,6 +6695,38 @@
 
 
 
+# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
+# might be empty or "-g".  We don't require a C++ compiler, so CXXFLAGS
+# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
+# We want to ensure that TARGET libraries (which we know are built with
+# gcc) are built with "-O2 -g", so include those options when setting
+# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
+if test "x$CFLAGS_FOR_TARGET" = x; then
+  CFLAGS_FOR_TARGET=$CFLAGS
+  case " $CFLAGS " in
+    *" -O2 "*) ;;
+    *) CFLAGS_FOR_TARGET="-O2 $CFLAGS" ;;
+  esac
+  case " $CFLAGS " in
+    *" -g "* | *" -g3 "*) ;;
+    *) CFLAGS_FOR_TARGET="-g $CFLAGS" ;;
+  esac
+fi
+
+
+if test "x$CXXFLAGS_FOR_TARGET" = x; then
+  CXXFLAGS_FOR_TARGET=$CXXFLAGS
+  case " $CXXFLAGS " in
+    *" -O2 "*) ;;
+    *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS" ;;
+  esac
+  case " $CXXFLAGS " in
+    *" -g "* | *" -g3 "*) ;;
+    *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS" ;;
+  esac
+fi
+
+
 # Handle --with-headers=XXX.  If the value is not "yes", the contents of
 # the named directory are copied to $(tooldir)/sys-include.
 if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then