summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2015-03-15 20:46:36 -0400
committermidipix <writeonce@midipix.org>2015-03-15 20:46:36 -0400
commit607827292053aa25d0f0300add0798dd085a9131 (patch)
treee73ffbc6e610091dcc7dc9a5f0379f996d98025c
parent4cdf4f4f006da014238394af84268dad91f6a79d (diff)
downloadcbb-gcc-4.6.4-607827292053aa25d0f0300add0798dd085a9131.tar.bz2
cbb-gcc-4.6.4-607827292053aa25d0f0300add0798dd085a9131.tar.xz
compiler building blocks: add support for custom build variables.
feature detection: set a fallback value of 'yes' to modern assembler presence, PE dward support, libc-provided stack protector, and dynamic-loader header iteration. signed-off by Z. Gilboa; see copying.midipix (9cd0746c) for additional information.
-rw-r--r--Makefile.in34
-rw-r--r--Makefile.tpl24
-rwxr-xr-xconfigure18
-rw-r--r--configure.ac18
-rw-r--r--gcc/Makefile.in20
-rwxr-xr-xgcc/configure14
-rw-r--r--gcc/configure.ac6
-rw-r--r--libgcc/Makefile.in11
-rw-r--r--libgcc/configure7
-rw-r--r--libgcc/configure.ac7
-rw-r--r--libgfortran/Makefile.am7
-rw-r--r--libgfortran/Makefile.in8
-rwxr-xr-xlibgfortran/configure7
-rw-r--r--libgfortran/configure.ac7
-rw-r--r--libgo/Makefile.in2
-rw-r--r--libgomp/Makefile.am8
-rw-r--r--libgomp/Makefile.in8
-rwxr-xr-xlibgomp/configure7
-rw-r--r--libgomp/configure.ac7
-rw-r--r--libjava/Makefile.am8
-rw-r--r--libjava/Makefile.in8
-rwxr-xr-xlibjava/configure7
-rw-r--r--libjava/configure.ac7
-rw-r--r--libobjc/Makefile.in15
-rwxr-xr-xlibobjc/configure7
-rw-r--r--libobjc/configure.ac7
-rw-r--r--libssp/Makefile.am6
-rw-r--r--libssp/Makefile.in10
-rwxr-xr-xlibssp/configure7
-rw-r--r--libssp/configure.ac7
-rw-r--r--libstdc++-v3/Makefile.am6
-rw-r--r--libstdc++-v3/Makefile.in6
-rwxr-xr-xlibstdc++-v3/configure7
-rw-r--r--libstdc++-v3/configure.ac7
-rw-r--r--libstdc++-v3/include/Makefile.in2
-rw-r--r--libstdc++-v3/libsupc++/Makefile.am2
-rw-r--r--libstdc++-v3/libsupc++/Makefile.in2
-rw-r--r--libstdc++-v3/src/Makefile.am2
-rw-r--r--libstdc++-v3/src/Makefile.in8
39 files changed, 310 insertions, 41 deletions
diff --git a/Makefile.in b/Makefile.in
index 51edbdf02..6a3d4a728 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -90,6 +90,21 @@ MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+# ----------------------------------
+# Compiler Building Blocks variables
+# ----------------------------------
+cbb_xgcc_for_specs = @cbb_xgcc_for_specs@
+cbb_ldflags_for_target = @cbb_ldflags_for_target@
+cbb_sysroot_for_libgcc = @cbb_sysroot_for_libgcc@
+
+cbb_cflags_for_stage1 = @cbb_cflags_for_stage1@
+cbb_cflags_for_stage2 = @cbb_cflags_for_stage2@
+cbb_cflags_for_stage3 = @cbb_cflags_for_stage3@
+cbb_cflags_for_stage4 = @cbb_cflags_for_stage4@
+
+cbb_cflags_for_stageprofile = @cbb_cflags_for_stageprofile@
+cbb_cflags_for_stagefeedback = @cbb_cflags_for_stagefeedback@
+
# -------------------------------------------------
# Miscellaneous non-standard autoconf-set variables
# -------------------------------------------------
@@ -142,7 +157,10 @@ BASE_EXPORTS = \
M4="$(M4)"; export M4; \
SED="$(SED)"; export SED; \
AWK="$(AWK)"; export AWK; \
- MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
+ MAKEINFO="$(MAKEINFO)"; export MAKEINFO; \
+ cbb_xgcc_for_specs="$(cbb_xgcc_for_specs)"; export cbb_xgcc_for_specs; \
+ cbb_ldflags_for_target="$(cbb_ldflags_for_target)" ; export cbb_ldflags_for_target; \
+ cbb_sysroot_for_libgcc="$(cbb_sysroot_for_libgcc)" ; export cbb_sysroot_for_libgcc;
# This is the list of variables to export in the environment when
# configuring subdirectories for the build system.
@@ -418,7 +436,7 @@ STAGE_CONFIGURE_FLAGS=@stage2_werror_flag@
# Defaults for stage 1; some are overridden below.
-STAGE1_CFLAGS = $(STAGE_CFLAGS)
+STAGE1_CFLAGS = $(STAGE_CFLAGS) $(cbb_cflags_for_stage1)
STAGE1_CXXFLAGS = $(CXXFLAGS)
@if target-libstdc++-v3-bootstrap
# Override the above if we're bootstrapping C++.
@@ -428,7 +446,7 @@ STAGE1_TFLAGS = $(STAGE_TFLAGS)
STAGE1_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
# Defaults for stage 2; some are overridden below.
-STAGE2_CFLAGS = $(STAGE_CFLAGS)
+STAGE2_CFLAGS = $(STAGE_CFLAGS) $(cbb_cflags_for_stage2)
STAGE2_CXXFLAGS = $(CXXFLAGS)
@if target-libstdc++-v3-bootstrap
# Override the above if we're bootstrapping C++.
@@ -438,7 +456,7 @@ STAGE2_TFLAGS = $(STAGE_TFLAGS)
STAGE2_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
# Defaults for stage 3; some are overridden below.
-STAGE3_CFLAGS = $(STAGE_CFLAGS)
+STAGE3_CFLAGS = $(STAGE_CFLAGS) $(cbb_cflags_for_stage3)
STAGE3_CXXFLAGS = $(CXXFLAGS)
@if target-libstdc++-v3-bootstrap
# Override the above if we're bootstrapping C++.
@@ -448,7 +466,7 @@ STAGE3_TFLAGS = $(STAGE_TFLAGS)
STAGE3_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
# Defaults for stage 4; some are overridden below.
-STAGE4_CFLAGS = $(STAGE_CFLAGS)
+STAGE4_CFLAGS = $(STAGE_CFLAGS) $(cbb_cflags_for_stage4)
STAGE4_CXXFLAGS = $(CXXFLAGS)
@if target-libstdc++-v3-bootstrap
# Override the above if we're bootstrapping C++.
@@ -458,7 +476,7 @@ STAGE4_TFLAGS = $(STAGE_TFLAGS)
STAGE4_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
# Defaults for stage profile; some are overridden below.
-STAGEprofile_CFLAGS = $(STAGE_CFLAGS)
+STAGEprofile_CFLAGS = $(STAGE_CFLAGS) $(cbb_cflags_for_stageprofile)
STAGEprofile_CXXFLAGS = $(CXXFLAGS)
@if target-libstdc++-v3-bootstrap
# Override the above if we're bootstrapping C++.
@@ -468,7 +486,7 @@ STAGEprofile_TFLAGS = $(STAGE_TFLAGS)
STAGEprofile_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
# Defaults for stage feedback; some are overridden below.
-STAGEfeedback_CFLAGS = $(STAGE_CFLAGS)
+STAGEfeedback_CFLAGS = $(STAGE_CFLAGS) $(cbb_cflags_for_stagefeedback)
STAGEfeedback_CXXFLAGS = $(CXXFLAGS)
@if target-libstdc++-v3-bootstrap
# Override the above if we're bootstrapping C++.
@@ -484,7 +502,7 @@ STAGEfeedback_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
# overrideable (for a bootstrap build stage1 also builds gcc.info).
-STAGE1_CFLAGS = @stage1_cflags@
+STAGE1_CFLAGS = @stage1_cflags@ $(cbb_cflags_for_stage1)
STAGE1_CHECKING = @stage1_checking@
STAGE1_LANGUAGES = @stage1_languages@
# * We force-disable intermodule optimizations, even if
diff --git a/Makefile.tpl b/Makefile.tpl
index 7ad089616..cec01e053 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -93,6 +93,21 @@ MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+# ----------------------------------
+# Compiler Building Blocks variables
+# ----------------------------------
+cbb_xgcc_for_specs = @cbb_xgcc_for_specs@
+cbb_ldflags_for_target = @cbb_ldflags_for_target@
+cbb_sysroot_for_libgcc = @cbb_sysroot_for_libgcc@
+
+cbb_cflags_for_stage1 = @cbb_cflags_for_stage1@
+cbb_cflags_for_stage2 = @cbb_cflags_for_stage2@
+cbb_cflags_for_stage3 = @cbb_cflags_for_stage3@
+cbb_cflags_for_stage4 = @cbb_cflags_for_stage4@
+
+cbb_cflags_for_stageprofile = @cbb_cflags_for_stageprofile@
+cbb_cflags_for_stagefeedback = @cbb_cflags_for_stagefeedback@
+
# -------------------------------------------------
# Miscellaneous non-standard autoconf-set variables
# -------------------------------------------------
@@ -145,7 +160,10 @@ BASE_EXPORTS = \
M4="$(M4)"; export M4; \
SED="$(SED)"; export SED; \
AWK="$(AWK)"; export AWK; \
- MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
+ MAKEINFO="$(MAKEINFO)"; export MAKEINFO; \
+ cbb_xgcc_for_specs="$(cbb_xgcc_for_specs)"; export cbb_xgcc_for_specs; \
+ cbb_ldflags_for_target="$(cbb_ldflags_for_target)" ; export cbb_ldflags_for_target; \
+ cbb_sysroot_for_libgcc="$(cbb_sysroot_for_libgcc)" ; export cbb_sysroot_for_libgcc;
# This is the list of variables to export in the environment when
# configuring subdirectories for the build system.
@@ -421,7 +439,7 @@ STAGE_CONFIGURE_FLAGS=@stage2_werror_flag@
[+ FOR bootstrap-stage +]
# Defaults for stage [+id+]; some are overridden below.
-STAGE[+id+]_CFLAGS = $(STAGE_CFLAGS)
+STAGE[+id+]_CFLAGS = $(STAGE_CFLAGS) $(cbb_cflags_for_stage[+id+])
STAGE[+id+]_CXXFLAGS = $(CXXFLAGS)
@if target-libstdc++-v3-bootstrap
# Override the above if we're bootstrapping C++.
@@ -437,7 +455,7 @@ STAGE[+id+]_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
# overrideable (for a bootstrap build stage1 also builds gcc.info).
-STAGE1_CFLAGS = @stage1_cflags@
+STAGE1_CFLAGS = @stage1_cflags@ $(cbb_cflags_for_stage1)
STAGE1_CHECKING = @stage1_checking@
STAGE1_LANGUAGES = @stage1_languages@
# * We force-disable intermodule optimizations, even if
diff --git a/configure b/configure
index 6be5e9d2b..266b29dfa 100755
--- a/configure
+++ b/configure
@@ -15448,3 +15448,21 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
+
+# Compiler Building Blocks top-level-only variables
+sed -i -e 's#@cbb_cflags_for_stage1@#'"$cbb_cflags_for_stage1"'#g' \
+ -e 's#@cbb_cflags_for_stage2@#'"$cbb_cflags_for_stage2"'#g' \
+ -e 's#@cbb_cflags_for_stage3@#'"$cbb_cflags_for_stage3"'#g' \
+ -e 's#@cbb_cflags_for_stage4@#'"$cbb_cflags_for_stage4"'#g' \
+ -e 's#@cbb_cflags_for_stageprofile@#'"$cbb_cflags_for_stageprofile"'#g' \
+ -e 's#@cbb_cflags_for_stagefeedback@#'"$cbb_cflags_for_stagefeedback"'#g' \
+ Makefile || exit 2
+
+
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ -e 's#@cbb_cflags_for_bootstrap@#'"$cbb_cflags_for_bootstrap"'#g' \
+ Makefile || exit 2
+
diff --git a/configure.ac b/configure.ac
index ba6d84da4..9a29e0cc0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3479,3 +3479,21 @@ AC_CONFIG_FILES([Makefile],
extrasub_host="$extrasub_host"
extrasub_target="$extrasub_target"])
AC_OUTPUT
+
+
+# Compiler Building Blocks top-level-only variables
+sed -i -e 's#@cbb_cflags_for_stage1@#'"$cbb_cflags_for_stage1"'#g' \
+ -e 's#@cbb_cflags_for_stage2@#'"$cbb_cflags_for_stage2"'#g' \
+ -e 's#@cbb_cflags_for_stage3@#'"$cbb_cflags_for_stage3"'#g' \
+ -e 's#@cbb_cflags_for_stage4@#'"$cbb_cflags_for_stage4"'#g' \
+ -e 's#@cbb_cflags_for_stageprofile@#'"$cbb_cflags_for_stageprofile"'#g' \
+ -e 's#@cbb_cflags_for_stagefeedback@#'"$cbb_cflags_for_stagefeedback"'#g' \
+ Makefile || exit 2
+
+
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ -e 's#@cbb_cflags_for_bootstrap@#'"$cbb_cflags_for_bootstrap"'#g' \
+ Makefile || exit 2
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index e0b952ffd..c5ac57225 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -373,6 +373,22 @@ UNWIND_H = $(srcdir)/unwind-generic.h
# Don't use this as a dependency--use $(GCC_PASSES).
GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) ./xgcc -B./ -B$(build_tooldir)/bin/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include -L$(objdir)/../ld
+# cbb: cbb_xgcc_for_specs (aka the key to paradise)
+# if the CC compiler or its flags involve a custom specs file,
+# then that specs file will become part of STAGE_CC_WRAPPER,
+# which will then interfere with the bootstrapping process.
+# we sidestep the problem by using a designated variable for
+# the -dumpspecs step. this variable (cbb_xgcc_for_specs)
+# is optional; to use it, set it prior to calling the
+# top-level configure.
+
+cbb_xgcc_for_specs = @cbb_xgcc_for_specs@
+
+ifeq ($(cbb_xgcc_for_specs),)
+cbb_xgcc_for_specs = $(STAGE_CC_WRAPPER)
+endif
+
+
# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
# It specifies -B./.
# It also specifies -isystem ./include to find, e.g., stddef.h.
@@ -1083,7 +1099,7 @@ BUILD_ERRORS = build/errors.o
# libintl.h will be found in ../intl if we are using the included libintl.
INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
-I$(srcdir)/../include @INCINTL@ \
- $(CPPINC) $(GMPINC) $(DECNUMINC) \
+ $(CPPINC) $(DECNUMINC) \
$(PPLINC) $(CLOOGINC)
.c.o:
@@ -1843,7 +1859,7 @@ cpp$(exeext): $(GCC_OBJS) cppspec.o version.o intl.o prefix.o \
# Dump a specs file to make -B./ read these specs over installed ones.
$(SPECS): xgcc$(exeext)
- $(GCC_FOR_TARGET) -dumpspecs > tmp-specs
+ $(cbb_xgcc_for_specs) -dumpspecs > tmp-specs
mv tmp-specs $(SPECS)
# We do want to create an executable named `xgcc', so we can use it to
diff --git a/gcc/configure b/gcc/configure
index c8caff252..278554119 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -22101,7 +22101,7 @@ $as_echo_n "checking assembler for cfi sections directive... " >&6; }
if test "${gcc_cv_as_cfi_sections_directive+set}" = set; then :
$as_echo_n "(cached) " >&6
else
- gcc_cv_as_cfi_sections_directive=no
+ gcc_cv_as_cfi_sections_directive=yes
if test x$gcc_cv_as != x; then
echo ' .text
.cfi_sections .debug_frame, .eh_frame
@@ -23609,7 +23609,7 @@ $as_echo_n "checking assembler for .secrel32 relocs... " >&6; }
if test "${gcc_cv_as_ix86_pe_secrel32+set}" = set; then :
$as_echo_n "(cached) " >&6
else
- gcc_cv_as_ix86_pe_secrel32=no
+ gcc_cv_as_ix86_pe_secrel32=yes
if test $in_tree_gas = yes; then
if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 15 \) \* 1000 + 91`
then gcc_cv_as_ix86_pe_secrel32=yes
@@ -25774,7 +25774,7 @@ $as_echo_n "checking __stack_chk_fail in target C library... " >&6; }
if test "${gcc_cv_libc_provides_ssp+set}" = set; then :
$as_echo_n "(cached) " >&6
else
- gcc_cv_libc_provides_ssp=no
+ gcc_cv_libc_provides_ssp=yes
case "$target" in
*-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
# glibc 2.4 and later provides __stack_chk_fail and
@@ -25857,7 +25857,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dl_iterate_phdr in target C library" >&5
$as_echo_n "checking dl_iterate_phdr in target C library... " >&6; }
-gcc_cv_target_dl_iterate_phdr=unknown
+if [ "$gcc_cv_target_dl_iterate_phdr"x = x ]; then gcc_cv_target_dl_iterate_phdr=yes; fi
case "$target" in
*-*-solaris2*)
# <link.h> needs both a dl_iterate_phdr declaration and support for
@@ -27792,3 +27792,9 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ Makefile || exit 2
+
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 48605c851..07a0c7837 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2465,7 +2465,7 @@ gcc_GAS_CHECK_FEATURE([cfi sections directive],
win32 | pe | cygwin* | mingw32* | uwin*)
# Need to check that we generated the correct relocation for the
# .debug_frame section. This was fixed for binutils 2.21.
- gcc_cv_as_cfi_sections_directive=no
+ gcc_cv_as_cfi_sections_directive=yes
if test "x$gcc_cv_objdump" != x; then
if $gcc_cv_objdump -j .debug_frame -r conftest.o 2>/dev/null | \
grep secrel > /dev/null; then
@@ -4362,7 +4362,7 @@ fi
# Test for stack protector support in target C library.
AC_CACHE_CHECK(__stack_chk_fail in target C library,
gcc_cv_libc_provides_ssp,
- [gcc_cv_libc_provides_ssp=no
+ [gcc_cv_libc_provides_ssp=yes
case "$target" in
*-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
[# glibc 2.4 and later provides __stack_chk_fail and
@@ -4430,7 +4430,7 @@ if test x$gcc_cv_target_ldbl128 = xyes; then
fi
AC_MSG_CHECKING(dl_iterate_phdr in target C library)
-gcc_cv_target_dl_iterate_phdr=unknown
+gcc_cv_target_dl_iterate_phdr=yes
case "$target" in
*-*-solaris2*)
# <link.h> needs both a dl_iterate_phdr declaration and support for
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index b57aeb657..f3b21309d 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -172,7 +172,14 @@ RANLIB_FOR_TARGET = $(RANLIB)
STRIP = @STRIP@
STRIP_FOR_TARGET = $(STRIP)
+
+# Compiler Building Blocks variables
+cbb_xgcc_for_specs = @cbb_xgcc_for_specs@
+cbb_ldflags_for_target = @cbb_ldflags_for_target@
+
+
# Directory in which the compiler finds libraries etc.
+version := $(shell $(cbb_xgcc_for_specs) -dumpversion)
libsubdir = $(libdir)/gcc/$(host_noncanonical)/$(version)
# Used to install the shared libgcc.
slibdir = @slibdir@
@@ -201,7 +208,7 @@ export slibdir
export toolexecdir
export toolexeclibdir
-version := $(shell $(CC) -dumpversion)
+
ifeq ($(decimal_float),yes)
ifeq ($(enable_decimal_float),bid)
@@ -773,7 +780,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
endif
ifeq ($(enable_shared),yes)
-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
+all: libgcc_eh.a libgcc_s$(SHLIB_EXT) $(libgcc-crt-objects)
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
endif
diff --git a/libgcc/configure b/libgcc/configure
index 8a27aab18..70290a2a4 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5116,3 +5116,10 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
+
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ Makefile || exit 2
+
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index 7dbe114e3..282cacac9 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -290,3 +290,10 @@ libgcc_topdir=${libgcc_topdir}
CC="${CC}"
]])
AC_OUTPUT
+
+
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ Makefile || exit 2
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index d1e6d4f94..69b03dcc5 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -1,6 +1,11 @@
## Process this file with automake to produce Makefile.in
+# Compiler Building Blocks variables
+cbb_xgcc_for_specs = @cbb_xgcc_for_specs@
+cbb_ldflags_for_target = @cbb_ldflags_for_target@
+
+
ACLOCAL_AMFLAGS = -I .. -I ../config
## May be used by toolexeclibdir.
@@ -31,7 +36,7 @@ version_dep =
endif
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
- $(lt_host_flags)
+ $(lt_host_flags) $(cbb_ldflags_for_target)
toolexeclib_LTLIBRARIES = libgfortran.la
toolexeclib_DATA = libgfortran.spec
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index dac8bb84c..7cb632706 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -13,6 +13,12 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
+
+# Compiler Building Blocks variables
+cbb_xgcc_for_specs = @cbb_xgcc_for_specs@
+cbb_ldflags_for_target = @cbb_ldflags_for_target@
+
+
@SET_MAKE@
@@ -480,7 +486,7 @@ gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
@LIBGFOR_USE_SYMVER_GNU_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_dep = $(srcdir)/gfortran.map
@LIBGFOR_USE_SYMVER_SUN_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_dep = gfortran.map-sun
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
- $(lt_host_flags)
+ $(lt_host_flags) $(cbb_ldflags_for_target)
toolexeclib_LTLIBRARIES = libgfortran.la
toolexeclib_DATA = libgfortran.spec
diff --git a/libgfortran/configure b/libgfortran/configure
index 1e61aeb49..ad0c8aa0c 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -28962,3 +28962,10 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
+
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ Makefile || exit 2
+
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 86d716130..2d123c5b3 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -575,3 +575,10 @@ Makefile
libgfortran.spec
])
AC_OUTPUT
+
+
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ Makefile || exit 2
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index 2fa67318d..dca449257 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -1651,7 +1651,7 @@ libgo_la_LIBADD = \
libgobegin_a_SOURCES = \
runtime/go-main.c
-LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) $(LDFLAGS_FOR_TARGET)
AM_GOCFLAGS = $(STRINGOPS_FLAG)
GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
diff --git a/libgomp/Makefile.am b/libgomp/Makefile.am
index c0c91678b..e02db181c 100644
--- a/libgomp/Makefile.am
+++ b/libgomp/Makefile.am
@@ -1,5 +1,11 @@
## Process this file with automake to produce Makefile.in
+
+# Compiler Building Blocks variables
+cbb_xgcc_for_specs = @cbb_xgcc_for_specs@
+cbb_ldflags_for_target = @cbb_ldflags_for_target@
+
+
ACLOCAL_AMFLAGS = -I .. -I ../config
SUBDIRS = testsuite
@@ -68,7 +74,7 @@ if USE_FORTRAN
nodist_finclude_HEADERS = omp_lib.h omp_lib.f90 omp_lib.mod omp_lib_kinds.mod
endif
-LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) $(cbb_ldflags_for_target)
LINK = $(LIBTOOL) --tag CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LTLDFLAGS) -o $@
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index b81936ac5..839905cc5 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -13,6 +13,12 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
+
+# Compiler Building Blocks variables
+cbb_xgcc_for_specs = @cbb_xgcc_for_specs@
+cbb_ldflags_for_target = @cbb_ldflags_for_target@
+
+
@SET_MAKE@
@@ -320,7 +326,7 @@ libgomp_la_SOURCES = alloc.c barrier.c critical.c env.c error.c iter.c \
nodist_noinst_HEADERS = libgomp_f.h
nodist_libsubinclude_HEADERS = omp.h
@USE_FORTRAN_TRUE@nodist_finclude_HEADERS = omp_lib.h omp_lib.f90 omp_lib.mod omp_lib_kinds.mod
-LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) $(cbb_ldflags_for_target)
LINK = $(LIBTOOL) --tag CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LTLDFLAGS) -o $@
diff --git a/libgomp/configure b/libgomp/configure
index 6f25c6f5e..fe90917d3 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -19318,3 +19318,10 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
+
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ Makefile || exit 2
+
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index d87ed2932..db0ff8ccc 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -348,3 +348,10 @@ CFLAGS="$save_CFLAGS"
AC_CONFIG_FILES(omp.h omp_lib.h omp_lib.f90 libgomp_f.h)
AC_CONFIG_FILES(Makefile testsuite/Makefile libgomp.spec)
AC_OUTPUT
+
+
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ Makefile || exit 2
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index 52d099556..5f37b408a 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -1,5 +1,11 @@
## Process this file with automake to produce Makefile.in.
+
+# Compiler Building Blocks variables
+cbb_xgcc_for_specs = @cbb_xgcc_for_specs@
+cbb_ldflags_for_target = @cbb_ldflags_for_target@
+
+
AUTOMAKE_OPTIONS = foreign subdir-objects
ACLOCAL_AMFLAGS = -I . -I .. -I ../config -I libltdl
@@ -332,7 +338,7 @@ lib_gnu_awt_xlib_la_version_dep = $(version_dep)
libgcj_bc_la_version_dep = $(version_dep)
endif
-LTLDFLAGS = $(shell $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+LTLDFLAGS = $(shell $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) $(cbb_ldflags_for_target)
GCJLINK = $(LIBTOOL) --tag=GCJ $(LIBTOOLFLAGS) --mode=link $(GCJ) -L$(here) \
$(JC1FLAGS) $(LTLDFLAGS) -o $@
GCJ_FOR_ECJX = @GCJ_FOR_ECJX@
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index bf5ab9dcd..a87eb7e5a 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -13,6 +13,12 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
+
+# Compiler Building Blocks variables
+cbb_xgcc_for_specs = @cbb_xgcc_for_specs@
+cbb_ldflags_for_target = @cbb_ldflags_for_target@
+
+
@SET_MAKE@
@@ -985,7 +991,7 @@ GCJ_WITH_FLAGS = $(GCJ) --encoding=UTF-8 -Wno-deprecated
@ANONVERSCRIPT_FALSE@libgcj_bc_la_version_dep = $(version_dep)
@ANONVERSCRIPT_GNU_TRUE@@ANONVERSCRIPT_TRUE@libgcj_bc_la_version_dep = $(version_dep)
@ANONVERSCRIPT_SUN_TRUE@@ANONVERSCRIPT_TRUE@libgcj_bc_la_version_dep = libgcj_bc.ver-sun
-LTLDFLAGS = $(shell $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+LTLDFLAGS = $(shell $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) $(cbb_ldflags_for_target)
GCJLINK = $(LIBTOOL) --tag=GCJ $(LIBTOOLFLAGS) --mode=link $(GCJ) -L$(here) \
$(JC1FLAGS) $(LTLDFLAGS) -o $@
diff --git a/libjava/configure b/libjava/configure
index d66056180..9d5c49dfc 100755
--- a/libjava/configure
+++ b/libjava/configure
@@ -28151,3 +28151,10 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
+
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ Makefile || exit 2
+
diff --git a/libjava/configure.ac b/libjava/configure.ac
index 20dbe9695..22829f232 100644
--- a/libjava/configure.ac
+++ b/libjava/configure.ac
@@ -2079,3 +2079,10 @@ fi
AC_CONFIG_FILES([scripts/jar], [chmod +x scripts/jar])
AC_OUTPUT
+
+
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ Makefile || exit 2
diff --git a/libobjc/Makefile.in b/libobjc/Makefile.in
index b33c989e6..592dd7ded 100644
--- a/libobjc/Makefile.in
+++ b/libobjc/Makefile.in
@@ -22,6 +22,12 @@
#Makefile.in files. Some of this stuff may be unnecessary and
#worthless.
+
+# Compiler Building Blocks variables
+cbb_xgcc_for_specs = @cbb_xgcc_for_specs@
+cbb_ldflags_for_target = @cbb_ldflags_for_target@
+
+
SHELL = @SHELL@
MAKEOVERRIDES=
@@ -207,11 +213,16 @@ OBJS_GC = \
## The rules to build
##
+# cbb: allow using a target-specific compiler
+ifeq ($(GCC_FOR_TARGET),)
+GCC_FOR_TARGET = $(CC)
+endif
+
# Flags to pass to a recursive make.
FLAGS_TO_PASS = \
"AR=$(AR)" \
"AR_FLAGS=$(AR_FLAGS)" \
- "CC=$(CC)" \
+ "CC=$(GCC_FOR_TARGET)" \
"CFLAGS=$(CFLAGS)" \
"DESTDIR=$(DESTDIR)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
@@ -321,7 +332,7 @@ install-html:
install-pdf:
install-info:
-LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) $(cbb_ldflags_for_target)
libobjc$(libsuffix).la: $(OBJS)
$(LIBTOOL_LINK) $(CC) -o $@ $(OBJS) \
diff --git a/libobjc/configure b/libobjc/configure
index e6f0afdfa..fd5b7549c 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -13745,3 +13745,10 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
+
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ Makefile || exit 2
+
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
index 494a289ec..c101fad51 100644
--- a/libobjc/configure.ac
+++ b/libobjc/configure.ac
@@ -285,3 +285,10 @@ fi
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
+
+
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ Makefile || exit 2
diff --git a/libssp/Makefile.am b/libssp/Makefile.am
index 5a2ecac1f..999f7aa2b 100644
--- a/libssp/Makefile.am
+++ b/libssp/Makefile.am
@@ -4,6 +4,12 @@
## Free Software Foundation, Inc.
##
+
+# Compiler Building Blocks variables
+cbb_xgcc_for_specs = @cbb_xgcc_for_specs@
+cbb_ldflags_for_target = @cbb_ldflags_for_target@
+
+
AUTOMAKE_OPTIONS = 1.9.5 foreign
ACLOCAL_AMFLAGS = -I .. -I ../config
MAINT_CHARSET = latin1
diff --git a/libssp/Makefile.in b/libssp/Makefile.in
index a7db7a9c0..f7c184548 100644
--- a/libssp/Makefile.in
+++ b/libssp/Makefile.in
@@ -13,6 +13,12 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
+
+# Compiler Building Blocks variables
+cbb_xgcc_for_specs = @cbb_xgcc_for_specs@
+cbb_ldflags_for_target = @cbb_ldflags_for_target@
+
+
@SET_MAKE@
@@ -92,7 +98,7 @@ am_libssp_la_OBJECTS = ssp.lo gets-chk.lo memcpy-chk.lo memmove-chk.lo \
libssp_la_OBJECTS = $(am_libssp_la_OBJECTS)
libssp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(libssp_la_LDFLAGS) $(LDFLAGS) -o $@
+ $(libssp_la_LDFLAGS) $(LDFLAGS) $(cbb_ldflags_for_target) -o $@
am_libssp_nonshared_la_OBJECTS = libssp_nonshared_la-ssp-local.lo
libssp_nonshared_la_OBJECTS = $(am_libssp_nonshared_la_OBJECTS)
libssp_nonshared_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -111,7 +117,7 @@ LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+ $(LDFLAGS) $(cbb_ldflags_for_target) -o $@
SOURCES = $(libssp_la_SOURCES) $(libssp_nonshared_la_SOURCES)
MULTISRCTOP =
MULTIBUILDTOP =
diff --git a/libssp/configure b/libssp/configure
index bd3f5662c..3e827e810 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -13422,3 +13422,10 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
+
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ Makefile || exit 2
+
diff --git a/libssp/configure.ac b/libssp/configure.ac
index 0eee36ce0..c16aa84f8 100644
--- a/libssp/configure.ac
+++ b/libssp/configure.ac
@@ -197,3 +197,10 @@ fi
AC_CONFIG_FILES([Makefile ssp/ssp.h])
AC_OUTPUT
+
+
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ Makefile || exit 2
diff --git a/libstdc++-v3/Makefile.am b/libstdc++-v3/Makefile.am
index f1b5b0787..816af9f26 100644
--- a/libstdc++-v3/Makefile.am
+++ b/libstdc++-v3/Makefile.am
@@ -21,6 +21,12 @@
## with this library; see the file COPYING3. If not see
## <http://www.gnu.org/licenses/>.
+
+# Compiler Building Blocks variables
+cbb_xgcc_for_specs = @cbb_xgcc_for_specs@
+cbb_ldflags_for_target = @cbb_ldflags_for_target@
+
+
include $(top_srcdir)/fragment.am
if GLIBCXX_HOSTED
diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in
index af62df5a6..a421ae0c0 100644
--- a/libstdc++-v3/Makefile.in
+++ b/libstdc++-v3/Makefile.in
@@ -13,6 +13,12 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
+
+# Compiler Building Blocks variables
+cbb_xgcc_for_specs = @cbb_xgcc_for_specs@
+cbb_ldflags_for_target = @cbb_ldflags_for_target@
+
+
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 84b6ea94a..caea30bcf 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -68893,3 +68893,10 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
+
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ Makefile || exit 2
+
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 427cf0b88..c67b92354 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -458,3 +458,10 @@ AC_CONFIG_COMMANDS([generate-headers],
dnl And this actually makes things happen:
AC_OUTPUT
+
+
+# Compiler Building Blocks variables
+sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \
+ -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \
+ -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \
+ Makefile || exit 2
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 3f1abd3e1..f6747445b 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -1127,7 +1127,7 @@ pch_output_dirs = \
pch_output_anchors = \
${pch1_output_anchor} ${pch2_output_anchor} ${pch3_output_anchor}
-PCHFLAGS = -x c++-header -nostdinc++ $(CXXFLAGS)
+PCHFLAGS = -x c++-header -nostdinc++ $(CXXFLAGS) -D_GNU_SOURCE
@GLIBCXX_BUILD_PCH_FALSE@pch_build =
@GLIBCXX_BUILD_PCH_TRUE@pch_build = ${pch_output}
diff --git a/libstdc++-v3/libsupc++/Makefile.am b/libstdc++-v3/libsupc++/Makefile.am
index 701c2d9a7..9c0214373 100644
--- a/libstdc++-v3/libsupc++/Makefile.am
+++ b/libstdc++-v3/libsupc++/Makefile.am
@@ -165,7 +165,7 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared $(LIBTOOLFLAGS) \
--mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) $(cbb_ldflags_for_target)
# 3) We'd have a problem when building the shared libstdc++ object if
# the rules automake generates would be used. We cannot allow g++ to
diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in
index 18ba84018..7f487597d 100644
--- a/libstdc++-v3/libsupc++/Makefile.in
+++ b/libstdc++-v3/libsupc++/Makefile.in
@@ -459,7 +459,7 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared $(LIBTOOLFLAGS) \
--mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) $(cbb_ldflags_for_target)
# 3) We'd have a problem when building the shared libstdc++ object if
# the rules automake generates would be used. We cannot allow g++ to
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 9a3568551..c0f3c94cb 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -433,7 +433,7 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX \
$(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
-LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) $(cbb_ldflags_for_target)
# 3) We'd have a problem when building the shared libstdc++ object if
# the rules automake generates would be used. We cannot allow g++ to
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index b454f66dc..d85734bc6 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -125,7 +125,7 @@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp =
am__depfiles_maybe =
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(script_xgcc_path_flags)
CXXLD = $(CXX)
SOURCES = $(libstdc___la_SOURCES)
ETAGS = etags
@@ -509,10 +509,10 @@ AM_CXXFLAGS = \
# attempt to infer which configuration to use
LTCXXCOMPILE = $(LIBTOOL) --tag CXX \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \
- $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
- $(AM_CXXFLAGS) $(CXXFLAGS)
+ $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) -D_GNU_SOURCE=1 \
+ $(AM_CXXFLAGS) $(CXXFLAGS) $(script_xgcc_path_flags)
-LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) $(cbb_ldflags_for_target)
# 3) We'd have a problem when building the shared libstdc++ object if
# the rules automake generates would be used. We cannot allow g++ to