summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-9.1/0020-Ensure-target-gcc-headers-can-be-included.patch
blob: f37c6f39aab61cfcab4c4ddc49acb0d684a45093 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
From 89f7a8e5c55b31bff011cd7466d78cd84d1eb307 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 20 Feb 2015 10:25:11 +0000
Subject: [PATCH 20/37] Ensure target gcc headers can be included

There are a few headers installed as part of the OpenEmbedded
gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe
built for the target architecture, these are within the target
sysroot and not cross/nativesdk; thus they weren't able to be
found by gcc with the existing search paths. Add support for
picking up these headers under the sysroot supplied on the gcc
command line in order to resolve this.

Upstream-Status: Pending

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 gcc/Makefile.in  | 2 ++
 gcc/cppdefault.c | 4 ++++
 gcc/defaults.h   | 9 +++++++++
 gcc/gcc.c        | 7 -------
 4 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 88b1aec732b..eb1dc304de2 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -618,6 +618,7 @@ libexecdir = @libexecdir@
 
 # Directory in which the compiler finds libraries etc.
 libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
+libsubdir_target = gcc/$(target_noncanonical)/$(version)
 # Directory in which the compiler finds executables
 libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
 # Directory in which all plugin resources are installed
@@ -2867,6 +2868,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
 
 PREPROCESSOR_DEFINES = \
   -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
+  -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
   -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
   -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
   -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
index c4796385643..980e2bd47a7 100644
--- a/gcc/cppdefault.c
+++ b/gcc/cppdefault.c
@@ -59,6 +59,10 @@ const struct default_include cpp_include_defaults[]
     /* This is the dir for gcc's private headers.  */
     { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
 #endif
+#ifdef GCC_INCLUDE_SUBDIR_TARGET
+    /* This is the dir for gcc's private headers under the specified sysroot.  */
+    { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
+#endif
 #ifdef LOCAL_INCLUDE_DIR
     /* /usr/local/include comes before the fixincluded header files.  */
     { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
diff --git a/gcc/defaults.h b/gcc/defaults.h
index b7534256119..41ca579b267 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1459,4 +1459,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define DWARF_GNAT_ENCODINGS_DEFAULT DWARF_GNAT_ENCODINGS_GDB
 #endif
 
+/* Default prefixes to attach to command names.  */
+
+#ifndef STANDARD_STARTFILE_PREFIX_1
+#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
+#endif
+#ifndef STANDARD_STARTFILE_PREFIX_2
+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
+#endif
+
 #endif  /* ! GCC_DEFAULTS_H */
diff --git a/gcc/gcc.c b/gcc/gcc.c
index cef26c454d7..14b1a6e8c44 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1470,13 +1470,6 @@ static const char *gcc_libexec_prefix;
 
 /* Default prefixes to attach to command names.  */
 
-#ifndef STANDARD_STARTFILE_PREFIX_1
-#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
-#endif
-#ifndef STANDARD_STARTFILE_PREFIX_2
-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
-#endif
-
 #ifdef CROSS_DIRECTORY_STRUCTURE  /* Don't use these prefixes for a cross compiler.  */
 #undef MD_EXEC_PREFIX
 #undef MD_STARTFILE_PREFIX
-- 
2.20.1