blob: f48c66dcac44da8c18aa60bd5ae8f879a4895738 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001Ensure target gcc headers can be included
2
3There are a few headers installed as part of the OpenEmbedded
4gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe
5built for the target architecture, these are within the target
6sysroot and not cross/nativesdk; thus they weren't able to be
7found by gcc with the existing search paths. Add support for
8picking up these headers under the sysroot supplied on the gcc
9command line in order to resolve this.
10
11Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
12
13Upstream-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 },
46diff --git a/gcc/defaults.h b/gcc/defaults.h
47index 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 */
64diff --git a/gcc/gcc.c b/gcc/gcc.c
65index 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