blob: 61e61ecc6edd9de77456ae7e10a9badaa4e0580e [file] [log] [blame]
From 612801d426e75ff997cfabda380dbe52c2cbc532 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 20 Feb 2015 10:25:11 +0000
Subject: [PATCH] Ensure target gcc headers can be included
There are a few headers installed as part of the OpenEmbedded
gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe
built for the target architecture, these are within the target
sysroot and not cross/nativesdk; thus they weren't able to be
found by gcc with the existing search paths. Add support for
picking up these headers under the sysroot supplied on the gcc
command line in order to resolve this.
Extend target gcc headers search to musl too
Upstream-Status: Pending
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/Makefile.in | 2 ++
gcc/config/linux.h | 8 ++++++++
gcc/config/rs6000/sysv4.h | 8 ++++++++
gcc/cppdefault.cc | 4 ++++
4 files changed, 22 insertions(+)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index a8277254696..07fa63b6640 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -632,6 +632,7 @@ libexecdir = @libexecdir@
# Directory in which the compiler finds libraries etc.
libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
+libsubdir_target = $(target_noncanonical)/$(version)
# Directory in which the compiler finds executables
libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
# Directory in which all plugin resources are installed
@@ -3024,6 +3025,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
PREPROCESSOR_DEFINES = \
-DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
+ -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
-DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
-DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
-DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
index 4ce173384ef..8a3cd4f2d34 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -170,6 +170,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define INCLUDE_DEFAULTS_MUSL_TOOL
#endif
+#ifdef GCC_INCLUDE_SUBDIR_TARGET
+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
+#else
+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
+#endif
+
#ifdef NATIVE_SYSTEM_HEADER_DIR
#define INCLUDE_DEFAULTS_MUSL_NATIVE \
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
@@ -196,6 +203,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
INCLUDE_DEFAULTS_MUSL_PREFIX \
INCLUDE_DEFAULTS_MUSL_CROSS \
INCLUDE_DEFAULTS_MUSL_TOOL \
+ INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
INCLUDE_DEFAULTS_MUSL_NATIVE \
{ GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
{ 0, 0, 0, 0, 0, 0 } \
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index a73954d9de5..e5dd6538358 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -994,6 +994,13 @@ ncrtn.o%s"
#define INCLUDE_DEFAULTS_MUSL_TOOL
#endif
+#ifdef GCC_INCLUDE_SUBDIR_TARGET
+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
+#else
+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
+#endif
+
#ifdef NATIVE_SYSTEM_HEADER_DIR
#define INCLUDE_DEFAULTS_MUSL_NATIVE \
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
@@ -1020,6 +1027,7 @@ ncrtn.o%s"
INCLUDE_DEFAULTS_MUSL_PREFIX \
INCLUDE_DEFAULTS_MUSL_CROSS \
INCLUDE_DEFAULTS_MUSL_TOOL \
+ INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
INCLUDE_DEFAULTS_MUSL_NATIVE \
{ GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
{ 0, 0, 0, 0, 0, 0 } \
diff --git a/gcc/cppdefault.cc b/gcc/cppdefault.cc
index 7888300f277..52cf14e92f8 100644
--- a/gcc/cppdefault.cc
+++ b/gcc/cppdefault.cc
@@ -64,6 +64,10 @@ const struct default_include cpp_include_defaults[]
/* This is the dir for gcc's private headers. */
{ GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
#endif
+#ifdef GCC_INCLUDE_SUBDIR_TARGET
+ /* This is the dir for gcc's private headers under the specified sysroot. */
+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
+#endif
#ifdef LOCAL_INCLUDE_DIR
/* /usr/local/include comes before the fixincluded header files. */
{ LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },