genode/tool/patches/gcc-4.7.2/cpp_for_target.patch
Christian Prochaska d4bf55a308 tool_chain: use real patches
Issue #1051.
2014-05-14 16:08:00 +02:00

66 lines
2.5 KiB
Diff

cpp_for_target.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
Fix the handling of CPP_FOR_TARGET. Without the fix, the configure script
of libgcc tries to use the normal 'cpp' for executing preprocessor tests,
which produces bogus results.
---
Makefile.def | 1 +
Makefile.tpl | 3 +++
configure.ac | 1 +
3 files changed, 5 insertions(+)
diff --git a/Makefile.def b/Makefile.def
index 1838a21..ae2689d 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -242,6 +242,7 @@ flags_to_pass = { flag= GNATMAKE ; };
// Target tools
flags_to_pass = { flag= AR_FOR_TARGET ; };
flags_to_pass = { flag= AS_FOR_TARGET ; };
+flags_to_pass = { flag= CPP_FOR_TARGET ; };
flags_to_pass = { flag= CC_FOR_TARGET ; };
flags_to_pass = { flag= CFLAGS_FOR_TARGET ; };
flags_to_pass = { flag= CPPFLAGS_FOR_TARGET ; };
diff --git a/Makefile.tpl b/Makefile.tpl
index 5cbd6e6..685756c 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -275,6 +275,7 @@ BASE_TARGET_EXPORTS = \
$(BASE_EXPORTS) \
AR="$(AR_FOR_TARGET)"; export AR; \
AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
+ CPP="$(CPP_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CPP; \
CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
@@ -478,6 +479,7 @@ do-compare3 = $(do-compare)
AR_FOR_TARGET=@AR_FOR_TARGET@
AS_FOR_TARGET=@AS_FOR_TARGET@
+CPP_FOR_TARGET=$(STAGE_CC_WRAPPER) @CPP_FOR_TARGET@
CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@
# If GCC_FOR_TARGET is not overriden on the command line, then this
@@ -643,6 +645,7 @@ POSTSTAGE1_FLAGS_TO_PASS = \
EXTRA_TARGET_FLAGS = \
'AR=$$(AR_FOR_TARGET)' \
'AS=$(COMPILER_AS_FOR_TARGET)' \
+ 'CPP=$$(CPP_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
diff --git a/configure.ac b/configure.ac
index a44a000..b763e18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3114,6 +3114,7 @@ RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
GCC_TARGET_TOOL(ar, AR_FOR_TARGET, AR, [binutils/ar])
GCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [gas/as-new])
+GCC_TARGET_TOOL(cpp, CPP_FOR_TARGET, CPP, [gcc/cpp -B$$r/$(HOST_SUBDIR)/gcc/])
GCC_TARGET_TOOL(cc, CC_FOR_TARGET, CC, [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
dnl see comments for CXX_FOR_TARGET_FLAG_TO_PASS
GCC_TARGET_TOOL(c++, CXX_FOR_TARGET, CXX,