Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 1 | From 9427c6cedf88e15f747c48cb4fcf9eda6f5c4555 Mon Sep 17 00:00:00 2001 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 20 Feb 2015 10:25:11 +0000 |
| 4 | Subject: [PATCH] Ensure target gcc headers can be included |
| 5 | |
| 6 | There are a few headers installed as part of the OpenEmbedded |
| 7 | gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe |
| 8 | built for the target architecture, these are within the target |
| 9 | sysroot and not cross/nativesdk; thus they weren't able to be |
| 10 | found by gcc with the existing search paths. Add support for |
| 11 | picking up these headers under the sysroot supplied on the gcc |
| 12 | command line in order to resolve this. |
| 13 | |
| 14 | Extend target gcc headers search to musl too |
| 15 | |
| 16 | Upstream-Status: Pending |
| 17 | |
| 18 | Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> |
| 19 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 20 | --- |
| 21 | gcc/Makefile.in | 2 ++ |
| 22 | gcc/config/linux.h | 8 ++++++++ |
| 23 | gcc/config/rs6000/sysv4.h | 8 ++++++++ |
| 24 | gcc/cppdefault.c | 4 ++++ |
| 25 | 4 files changed, 22 insertions(+) |
| 26 | |
| 27 | diff --git a/gcc/Makefile.in b/gcc/Makefile.in |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 28 | index d1d4512bba3..06eb0d27a28 100644 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 29 | --- a/gcc/Makefile.in |
| 30 | +++ b/gcc/Makefile.in |
| 31 | @@ -630,6 +630,7 @@ libexecdir = @libexecdir@ |
| 32 | |
| 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 |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 39 | @@ -3009,6 +3010,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\" |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 40 | |
| 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) \ |
| 47 | diff --git a/gcc/config/linux.h b/gcc/config/linux.h |
| 48 | index 87efc5f69fe..b525bcd56b3 100644 |
| 49 | --- a/gcc/config/linux.h |
| 50 | +++ b/gcc/config/linux.h |
| 51 | @@ -165,6 +165,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 52 | #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 }, \ |
| 65 | @@ -191,6 +198,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 66 | 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 } \ |
| 73 | diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h |
| 74 | index 510abe169c5..0c2bba5ea32 100644 |
| 75 | --- a/gcc/config/rs6000/sysv4.h |
| 76 | +++ b/gcc/config/rs6000/sysv4.h |
| 77 | @@ -995,6 +995,13 @@ ncrtn.o%s" |
| 78 | #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 }, \ |
| 91 | @@ -1021,6 +1028,7 @@ ncrtn.o%s" |
| 92 | 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 } \ |
| 99 | diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c |
| 100 | index c503d14fc3f..d54d6ce0076 100644 |
| 101 | --- a/gcc/cppdefault.c |
| 102 | +++ b/gcc/cppdefault.c |
| 103 | @@ -64,6 +64,10 @@ const struct default_include cpp_include_defaults[] |
| 104 | /* 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 }, |