blob: 98472dd2b5eb7bf6a562e4b2c7d0ef61b1a77240 [file] [log] [blame]
Andrew Geisslerc926e172021-05-07 16:11:35 -05001From 9b4eb0e18a953d79d20c78d3ba741af6d71ab9ca Mon Sep 17 00:00:00 2001
Andrew Geissler82c905d2020-04-13 13:39:40 -05002From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 10:25:11 +0000
Andrew Geisslerc182c622020-05-15 14:13:32 -05004Subject: [PATCH] Ensure target gcc headers can be included
Andrew Geissler82c905d2020-04-13 13:39:40 -05005
6There are a few headers installed as part of the OpenEmbedded
7gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe
8built for the target architecture, these are within the target
9sysroot and not cross/nativesdk; thus they weren't able to be
10found by gcc with the existing search paths. Add support for
11picking up these headers under the sysroot supplied on the gcc
12command line in order to resolve this.
13
14Upstream-Status: Pending
15
16Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18---
19 gcc/Makefile.in | 2 ++
20 gcc/cppdefault.c | 4 ++++
21 2 files changed, 6 insertions(+)
22
23diff --git a/gcc/Makefile.in b/gcc/Makefile.in
Andrew Geisslerc926e172021-05-07 16:11:35 -050024index 59c45c81393..9b17d120aa1 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050025--- a/gcc/Makefile.in
26+++ b/gcc/Makefile.in
Andrew Geisslerc926e172021-05-07 16:11:35 -050027@@ -630,6 +630,7 @@ libexecdir = @libexecdir@
Andrew Geissler82c905d2020-04-13 13:39:40 -050028
29 # Directory in which the compiler finds libraries etc.
30 libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
31+libsubdir_target = $(target_noncanonical)/$(version)
32 # Directory in which the compiler finds executables
33 libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
34 # Directory in which all plugin resources are installed
Andrew Geisslerc926e172021-05-07 16:11:35 -050035@@ -3016,6 +3017,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
Andrew Geissler82c905d2020-04-13 13:39:40 -050036
37 PREPROCESSOR_DEFINES = \
38 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
39+ -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
40 -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
41 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
42 -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
43diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
Andrew Geisslerc926e172021-05-07 16:11:35 -050044index c503d14fc3f..d54d6ce0076 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050045--- a/gcc/cppdefault.c
46+++ b/gcc/cppdefault.c
Andrew Geisslerc926e172021-05-07 16:11:35 -050047@@ -64,6 +64,10 @@ const struct default_include cpp_include_defaults[]
Andrew Geissler82c905d2020-04-13 13:39:40 -050048 /* This is the dir for gcc's private headers. */
49 { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
50 #endif
51+#ifdef GCC_INCLUDE_SUBDIR_TARGET
52+ /* This is the dir for gcc's private headers under the specified sysroot. */
53+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
54+#endif
55 #ifdef LOCAL_INCLUDE_DIR
56 /* /usr/local/include comes before the fixincluded header files. */
57 { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },