blob: af0ea5c60aca282fe0790de6c35460f45070c745 [file] [log] [blame]
Brad Bishopc68388fc2019-08-26 01:33:31 -04001From d27ba49e2e5c608c43265462d6831363cc7f565b Mon Sep 17 00:00:00 2001
Brad Bishopc342db32019-05-15 21:57:59 -04002From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 10:25:11 +0000
Brad Bishopc68388fc2019-08-26 01:33:31 -04004Subject: [PATCH 19/36] Ensure target gcc headers can be included
Brad Bishopc342db32019-05-15 21:57:59 -04005
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 gcc/defaults.h | 9 +++++++++
22 gcc/gcc.c | 7 -------
23 4 files changed, 15 insertions(+), 7 deletions(-)
24
25diff --git a/gcc/Makefile.in b/gcc/Makefile.in
Brad Bishopc68388fc2019-08-26 01:33:31 -040026index 0064a282488..98d1488171f 100644
Brad Bishopc342db32019-05-15 21:57:59 -040027--- a/gcc/Makefile.in
28+++ b/gcc/Makefile.in
29@@ -618,6 +618,7 @@ libexecdir = @libexecdir@
30
31 # Directory in which the compiler finds libraries etc.
32 libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
Brad Bishopc68388fc2019-08-26 01:33:31 -040033+libsubdir_target = $(target_noncanonical)/$(version)
Brad Bishopc342db32019-05-15 21:57:59 -040034 # Directory in which the compiler finds executables
35 libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
36 # Directory in which all plugin resources are installed
Brad Bishopc68388fc2019-08-26 01:33:31 -040037@@ -2866,6 +2867,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
Brad Bishopc342db32019-05-15 21:57:59 -040038
39 PREPROCESSOR_DEFINES = \
40 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
41+ -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
42 -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
43 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
44 -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
45diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
46index c4796385643..980e2bd47a7 100644
47--- a/gcc/cppdefault.c
48+++ b/gcc/cppdefault.c
49@@ -59,6 +59,10 @@ const struct default_include cpp_include_defaults[]
50 /* This is the dir for gcc's private headers. */
51 { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
52 #endif
53+#ifdef GCC_INCLUDE_SUBDIR_TARGET
54+ /* This is the dir for gcc's private headers under the specified sysroot. */
55+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
56+#endif
57 #ifdef LOCAL_INCLUDE_DIR
58 /* /usr/local/include comes before the fixincluded header files. */
59 { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
60diff --git a/gcc/defaults.h b/gcc/defaults.h
61index b7534256119..41ca579b267 100644
62--- a/gcc/defaults.h
63+++ b/gcc/defaults.h
64@@ -1459,4 +1459,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
65 #define DWARF_GNAT_ENCODINGS_DEFAULT DWARF_GNAT_ENCODINGS_GDB
66 #endif
67
68+/* Default prefixes to attach to command names. */
69+
70+#ifndef STANDARD_STARTFILE_PREFIX_1
71+#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
72+#endif
73+#ifndef STANDARD_STARTFILE_PREFIX_2
74+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
75+#endif
76+
77 #endif /* ! GCC_DEFAULTS_H */
78diff --git a/gcc/gcc.c b/gcc/gcc.c
Brad Bishopc68388fc2019-08-26 01:33:31 -040079index 4e7c45b268c..1a3704b2763 100644
Brad Bishopc342db32019-05-15 21:57:59 -040080--- a/gcc/gcc.c
81+++ b/gcc/gcc.c
82@@ -1470,13 +1470,6 @@ static const char *gcc_libexec_prefix;
83
84 /* Default prefixes to attach to command names. */
85
86-#ifndef STANDARD_STARTFILE_PREFIX_1
87-#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
88-#endif
89-#ifndef STANDARD_STARTFILE_PREFIX_2
90-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
91-#endif
92-
93 #ifdef CROSS_DIRECTORY_STRUCTURE /* Don't use these prefixes for a cross compiler. */
94 #undef MD_EXEC_PREFIX
95 #undef MD_STARTFILE_PREFIX
96--
Brad Bishopc68388fc2019-08-26 01:33:31 -0400972.22.1
Brad Bishopc342db32019-05-15 21:57:59 -040098