blob: 61e61ecc6edd9de77456ae7e10a9badaa4e0580e [file] [log] [blame]
Andrew Geisslerd5838332022-05-27 11:33:10 -05001From 612801d426e75ff997cfabda380dbe52c2cbc532 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
William A. Kennington IIIac69b482021-06-02 12:28:27 -070014Extend target gcc headers search to musl too
15
Andrew Geissler82c905d2020-04-13 13:39:40 -050016Upstream-Status: Pending
17
18Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20---
William A. Kennington IIIac69b482021-06-02 12:28:27 -070021 gcc/Makefile.in | 2 ++
22 gcc/config/linux.h | 8 ++++++++
23 gcc/config/rs6000/sysv4.h | 8 ++++++++
Andrew Geisslerd5838332022-05-27 11:33:10 -050024 gcc/cppdefault.cc | 4 ++++
William A. Kennington IIIac69b482021-06-02 12:28:27 -070025 4 files changed, 22 insertions(+)
Andrew Geissler82c905d2020-04-13 13:39:40 -050026
27diff --git a/gcc/Makefile.in b/gcc/Makefile.in
Andrew Geisslerd5838332022-05-27 11:33:10 -050028index a8277254696..07fa63b6640 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050029--- a/gcc/Makefile.in
30+++ b/gcc/Makefile.in
Andrew Geisslerd5838332022-05-27 11:33:10 -050031@@ -632,6 +632,7 @@ libexecdir = @libexecdir@
Andrew Geissler82c905d2020-04-13 13:39:40 -050032
33 # Directory in which the compiler finds libraries etc.
34 libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
35+libsubdir_target = $(target_noncanonical)/$(version)
36 # Directory in which the compiler finds executables
37 libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
38 # Directory in which all plugin resources are installed
Andrew Geisslerd5838332022-05-27 11:33:10 -050039@@ -3024,6 +3025,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
Andrew Geissler82c905d2020-04-13 13:39:40 -050040
41 PREPROCESSOR_DEFINES = \
42 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
43+ -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
44 -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
45 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
46 -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
William A. Kennington IIIac69b482021-06-02 12:28:27 -070047diff --git a/gcc/config/linux.h b/gcc/config/linux.h
Andrew Geisslerd5838332022-05-27 11:33:10 -050048index 4ce173384ef..8a3cd4f2d34 100644
William A. Kennington IIIac69b482021-06-02 12:28:27 -070049--- a/gcc/config/linux.h
50+++ b/gcc/config/linux.h
Andrew Geisslerd5838332022-05-27 11:33:10 -050051@@ -170,6 +170,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
William A. Kennington IIIac69b482021-06-02 12:28:27 -070052 #define INCLUDE_DEFAULTS_MUSL_TOOL
53 #endif
54
55+#ifdef GCC_INCLUDE_SUBDIR_TARGET
56+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
57+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
58+#else
59+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
60+#endif
61+
62 #ifdef NATIVE_SYSTEM_HEADER_DIR
63 #define INCLUDE_DEFAULTS_MUSL_NATIVE \
64 { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
Andrew Geisslerd5838332022-05-27 11:33:10 -050065@@ -196,6 +203,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
William A. Kennington IIIac69b482021-06-02 12:28:27 -070066 INCLUDE_DEFAULTS_MUSL_PREFIX \
67 INCLUDE_DEFAULTS_MUSL_CROSS \
68 INCLUDE_DEFAULTS_MUSL_TOOL \
69+ INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
70 INCLUDE_DEFAULTS_MUSL_NATIVE \
71 { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
72 { 0, 0, 0, 0, 0, 0 } \
73diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
Andrew Geisslerd5838332022-05-27 11:33:10 -050074index a73954d9de5..e5dd6538358 100644
William A. Kennington IIIac69b482021-06-02 12:28:27 -070075--- a/gcc/config/rs6000/sysv4.h
76+++ b/gcc/config/rs6000/sysv4.h
Andrew Geisslerd5838332022-05-27 11:33:10 -050077@@ -994,6 +994,13 @@ ncrtn.o%s"
William A. Kennington IIIac69b482021-06-02 12:28:27 -070078 #define INCLUDE_DEFAULTS_MUSL_TOOL
79 #endif
80
81+#ifdef GCC_INCLUDE_SUBDIR_TARGET
82+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
83+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
84+#else
85+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
86+#endif
87+
88 #ifdef NATIVE_SYSTEM_HEADER_DIR
89 #define INCLUDE_DEFAULTS_MUSL_NATIVE \
90 { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
Andrew Geisslerd5838332022-05-27 11:33:10 -050091@@ -1020,6 +1027,7 @@ ncrtn.o%s"
William A. Kennington IIIac69b482021-06-02 12:28:27 -070092 INCLUDE_DEFAULTS_MUSL_PREFIX \
93 INCLUDE_DEFAULTS_MUSL_CROSS \
94 INCLUDE_DEFAULTS_MUSL_TOOL \
95+ INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
96 INCLUDE_DEFAULTS_MUSL_NATIVE \
97 { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
98 { 0, 0, 0, 0, 0, 0 } \
Andrew Geisslerd5838332022-05-27 11:33:10 -050099diff --git a/gcc/cppdefault.cc b/gcc/cppdefault.cc
100index 7888300f277..52cf14e92f8 100644
101--- a/gcc/cppdefault.cc
102+++ b/gcc/cppdefault.cc
Andrew Geisslerc926e172021-05-07 16:11:35 -0500103@@ -64,6 +64,10 @@ const struct default_include cpp_include_defaults[]
Andrew Geissler82c905d2020-04-13 13:39:40 -0500104 /* This is the dir for gcc's private headers. */
105 { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
106 #endif
107+#ifdef GCC_INCLUDE_SUBDIR_TARGET
108+ /* This is the dir for gcc's private headers under the specified sysroot. */
109+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
110+#endif
111 #ifdef LOCAL_INCLUDE_DIR
112 /* /usr/local/include comes before the fixincluded header files. */
113 { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },