summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.9/0063-nativesdk-gcc-support.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.9/0063-nativesdk-gcc-support.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0063-nativesdk-gcc-support.patch204
1 files changed, 204 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0063-nativesdk-gcc-support.patch b/meta/recipes-devtools/gcc/gcc-4.9/0063-nativesdk-gcc-support.patch
new file mode 100644
index 0000000000..ba7360cc78
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.9/0063-nativesdk-gcc-support.patch
@@ -0,0 +1,204 @@
1Being able to build a nativesdk gcc is useful, particularly in cases
2where the host compiler may be of an incompatible version (or a 32
3bit compiler is needed).
4
5Sadly, building nativesdk-gcc is not straight forward. We install
6nativesdk-gcc into a relocatable location and this means that its
7library locations can change. "Normal" sysroot support doesn't help
8in this case since the values of paths like "libdir" change, not just
9base root directory of the system.
10
11In order to handle this we do two things:
12
13a) Add %r into spec file markup which can be used for injected paths
14 such as SYSTEMLIBS_DIR (see gcc_multilib_setup()).
15b) Add other paths which need relocation into a .gccrelocprefix section
16 which the relocation code will notice and adjust automatically.
17
18
19Upstream-Status: Inappropriate
20RP 2015/7/28
21
22Index: gcc-4.9.2/gcc/gcc.c
23===================================================================
24--- gcc-4.9.2.orig/gcc/gcc.c
25+++ gcc-4.9.2/gcc/gcc.c
26@@ -120,6 +120,8 @@ static const char *target_system_root =
27 #else
28 static const char *target_system_root = 0;
29 #endif
30+
31+static char target_relocatable_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = SYSTEMLIBS_DIR;
32
33 /* Nonzero means pass the updated target_system_root to the compiler. */
34
35@@ -384,6 +386,7 @@ or with constant text in a single argume
36 %G process LIBGCC_SPEC as a spec.
37 %R Output the concatenation of target_system_root and
38 target_sysroot_suffix.
39+ %r Output the base path target_relocatable_prefix
40 %S process STARTFILE_SPEC as a spec. A capital S is actually used here.
41 %E process ENDFILE_SPEC as a spec. A capital E is actually used here.
42 %C process CPP_SPEC as a spec.
43@@ -1218,10 +1221,10 @@ static const char *gcc_libexec_prefix;
44 gcc_exec_prefix is set because, in that case, we know where the
45 compiler has been installed, and use paths relative to that
46 location instead. */
47-static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
48-static const char *const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX;
49-static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
50-static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
51+static char standard_exec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX;
52+static char standard_libexec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_LIBEXEC_PREFIX;
53+static char standard_bindir_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_BINDIR_PREFIX;
54+static char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
55
56 /* For native compilers, these are well-known paths containing
57 components that may be provided by the system. For cross
58@@ -1229,9 +1232,9 @@ static const char *const standard_startf
59 static const char *md_exec_prefix = MD_EXEC_PREFIX;
60 static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
61 static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
62-static const char *const standard_startfile_prefix_1
63+static char standard_startfile_prefix_1[4096] __attribute__ ((section (".gccrelocprefix")))
64 = STANDARD_STARTFILE_PREFIX_1;
65-static const char *const standard_startfile_prefix_2
66+static char standard_startfile_prefix_2[4096] __attribute__ ((section (".gccrelocprefix")))
67 = STANDARD_STARTFILE_PREFIX_2;
68
69 /* A relative path to be used in finding the location of tools
70@@ -5305,6 +5310,11 @@ do_spec_1 (const char *spec, int inswitc
71 }
72 break;
73
74+ case 'r':
75+ obstack_grow (&obstack, target_relocatable_prefix,
76+ strlen (target_relocatable_prefix));
77+ break;
78+
79 case 'S':
80 value = do_spec_1 (startfile_spec, 0, NULL);
81 if (value != 0)
82Index: gcc-4.9.2/gcc/cppdefault.c
83===================================================================
84--- gcc-4.9.2.orig/gcc/cppdefault.c
85+++ gcc-4.9.2/gcc/cppdefault.c
86@@ -35,6 +35,30 @@
87 # undef CROSS_INCLUDE_DIR
88 #endif
89
90+static char GPLUSPLUS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_INCLUDE_DIR;
91+static char GCC_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GCC_INCLUDE_DIR;
92+static char GPLUSPLUS_TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_TOOL_INCLUDE_DIR;
93+static char GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_BACKWARD_INCLUDE_DIR;
94+static char STANDARD_STARTFILE_PREFIX_2VAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET;
95+#ifdef LOCAL_INCLUDE_DIR
96+static char LOCAL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = LOCAL_INCLUDE_DIR;
97+#endif
98+#ifdef PREFIX_INCLUDE_DIR
99+static char PREFIX_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX_INCLUDE_DIR;
100+#endif
101+#ifdef FIXED_INCLUDE_DIR
102+static char FIXED_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = FIXED_INCLUDE_DIR;
103+#endif
104+#ifdef CROSS_INCLUDE_DIR
105+static char CROSS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = CROSS_INCLUDE_DIR;
106+#endif
107+#ifdef TOOL_INCLUDE_DIR
108+static char TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = TOOL_INCLUDE_DIR;
109+#endif
110+#ifdef NATIVE_SYSTEM_HEADER_DIR
111+static char NATIVE_SYSTEM_HEADER_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = NATIVE_SYSTEM_HEADER_DIR;
112+#endif
113+
114 const struct default_include cpp_include_defaults[]
115 #ifdef INCLUDE_DEFAULTS
116 = INCLUDE_DEFAULTS;
117@@ -42,38 +66,38 @@ const struct default_include cpp_include
118 = {
119 #ifdef GPLUSPLUS_INCLUDE_DIR
120 /* Pick up GNU C++ generic include files. */
121- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,
122+ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1,
123 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
124 #endif
125 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
126 /* Pick up GNU C++ target-dependent include files. */
127- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,
128+ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1,
129 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },
130 #endif
131 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
132 /* Pick up GNU C++ backward and deprecated include files. */
133- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,
134+ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1,
135 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
136 #endif
137 #ifdef GCC_INCLUDE_DIR
138 /* This is the dir for gcc's private headers. */
139- { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
140+ { GCC_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
141 #endif
142 #ifdef GCC_INCLUDE_SUBDIR_TARGET
143 /* This is the dir for gcc's private headers under the specified sysroot. */
144- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
145+ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0 },
146 #endif
147 #ifdef LOCAL_INCLUDE_DIR
148 /* /usr/local/include comes before the fixincluded header files. */
149- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
150- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
151+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 },
152+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 },
153 #endif
154 #ifdef PREFIX_INCLUDE_DIR
155- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 },
156+ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0 },
157 #endif
158 #ifdef FIXED_INCLUDE_DIR
159 /* This is the dir for fixincludes. */
160- { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0,
161+ { FIXED_INCLUDE_DIRVAR, "GCC", 0, 0, 0,
162 /* A multilib suffix needs adding if different multilibs use
163 different headers. */
164 #ifdef SYSROOT_HEADERS_SUFFIX_SPEC
165@@ -85,21 +109,21 @@ const struct default_include cpp_include
166 #endif
167 #ifdef CROSS_INCLUDE_DIR
168 /* One place the target system's headers might be. */
169- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
170+ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
171 #endif
172 #ifdef TOOL_INCLUDE_DIR
173 /* Another place the target system's headers might be. */
174- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 },
175+ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0 },
176 #endif
177 #ifdef NATIVE_SYSTEM_HEADER_DIR
178 /* /usr/include comes dead last. */
179- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
180- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
181+ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
182+ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
183 #endif
184 { 0, 0, 0, 0, 0, 0 }
185 };
186 #endif /* no INCLUDE_DEFAULTS */
187
188 #ifdef GCC_INCLUDE_DIR
189 const char cpp_GCC_INCLUDE_DIR[] = GCC_INCLUDE_DIR;
190 const size_t cpp_GCC_INCLUDE_DIR_len = sizeof GCC_INCLUDE_DIR - 8;
191Index: gcc-4.9.2/gcc/cppdefault.h
192===================================================================
193--- gcc-4.9.2.orig/gcc/cppdefault.h
194+++ gcc-4.9.2/gcc/cppdefault.h
195@@ -33,7 +33,8 @@
196
197 struct default_include
198 {
199- const char *const fname; /* The name of the directory. */
200+ const char *fname; /* The name of the directory. */
201+
202 const char *const component; /* The component containing the directory
203 (see update_path in prefix.c) */
204 const char cplusplus; /* Only look here if we're compiling C++. */