Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Ensure target gcc headers can be included |
| 2 | |
| 3 | There are a few headers installed as part of the OpenEmbedded |
| 4 | gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe |
| 5 | built for the target architecture, these are within the target |
| 6 | sysroot and not cross/nativesdk; thus they weren't able to be |
| 7 | found by gcc with the existing search paths. Add support for |
| 8 | picking up these headers under the sysroot supplied on the gcc |
| 9 | command line in order to resolve this. |
| 10 | |
| 11 | Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> |
| 12 | |
| 13 | Upstream-Status: Pending |
| 14 | |
| 15 | --- a/gcc/Makefile.in 2014-12-23 11:57:33.327873331 +0000 |
| 16 | +++ b/gcc/Makefile.in 2015-01-21 11:32:35.447305394 +0000 |
| 17 | @@ -587,6 +587,7 @@ |
| 18 | |
| 19 | # Directory in which the compiler finds libraries etc. |
| 20 | libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(version) |
| 21 | +libsubdir_target = gcc/$(target_noncanonical)/$(version) |
| 22 | # Directory in which the compiler finds executables |
| 23 | libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(version) |
| 24 | # Directory in which all plugin resources are installed |
| 25 | @@ -2534,6 +2535,7 @@ |
| 26 | |
| 27 | PREPROCESSOR_DEFINES = \ |
| 28 | -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \ |
| 29 | + -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \ |
| 30 | -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \ |
| 31 | -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \ |
| 32 | -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \ |
| 33 | --- a/gcc/cppdefault.c 2015-01-13 17:40:26.131012725 +0000 |
| 34 | +++ b/gcc/cppdefault.c 2015-01-21 11:30:08.928426492 +0000 |
| 35 | @@ -59,6 +59,10 @@ |
| 36 | /* This is the dir for gcc's private headers. */ |
| 37 | { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 }, |
| 38 | #endif |
| 39 | +#ifdef GCC_INCLUDE_SUBDIR_TARGET |
| 40 | + /* This is the dir for gcc's private headers under the specified sysroot. */ |
| 41 | + { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 }, |
| 42 | +#endif |
| 43 | #ifdef LOCAL_INCLUDE_DIR |
| 44 | /* /usr/local/include comes before the fixincluded header files. */ |
| 45 | { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, |
| 46 | diff --git a/gcc/defaults.h b/gcc/defaults.h |
| 47 | index f94ae17..d98b40b 100644 |
| 48 | --- a/gcc/defaults.h |
| 49 | +++ b/gcc/defaults.h |
| 50 | @@ -1390,4 +1390,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 51 | |
| 52 | #endif /* GCC_INSN_FLAGS_H */ |
| 53 | |
| 54 | +/* Default prefixes to attach to command names. */ |
| 55 | + |
| 56 | +#ifndef STANDARD_STARTFILE_PREFIX_1 |
| 57 | +#define STANDARD_STARTFILE_PREFIX_1 "/lib/" |
| 58 | +#endif |
| 59 | +#ifndef STANDARD_STARTFILE_PREFIX_2 |
| 60 | +#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/" |
| 61 | +#endif |
| 62 | + |
| 63 | #endif /* ! GCC_DEFAULTS_H */ |
| 64 | diff --git a/gcc/gcc.c b/gcc/gcc.c |
| 65 | index 9f0b781..174fca8 100644 |
| 66 | --- a/gcc/gcc.c |
| 67 | +++ b/gcc/gcc.c |
| 68 | @@ -1189,13 +1189,6 @@ static const char *gcc_libexec_prefix; |
| 69 | |
| 70 | /* Default prefixes to attach to command names. */ |
| 71 | |
| 72 | -#ifndef STANDARD_STARTFILE_PREFIX_1 |
| 73 | -#define STANDARD_STARTFILE_PREFIX_1 "/lib/" |
| 74 | -#endif |
| 75 | -#ifndef STANDARD_STARTFILE_PREFIX_2 |
| 76 | -#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/" |
| 77 | -#endif |
| 78 | - |
| 79 | #ifdef CROSS_DIRECTORY_STRUCTURE /* Don't use these prefixes for a cross compiler. */ |
| 80 | #undef MD_EXEC_PREFIX |
| 81 | #undef MD_STARTFILE_PREFIX |