summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/conf/distro/include/tcmode-default.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0063-nativesdk-gcc-support.patch204
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.2.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.2/0040-nativesdk-gcc-support.patch204
-rw-r--r--meta/recipes-devtools/gcc/gcc-multilib-config.inc25
-rw-r--r--meta/recipes-devtools/gcc/gcc_4.8.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc_4.9.bb7
-rw-r--r--meta/recipes-devtools/gcc/gcc_5.2.bb2
-rwxr-xr-xscripts/relocate_sdk.py13
10 files changed, 450 insertions, 10 deletions
diff --git a/meta/conf/distro/include/tcmode-default.inc b/meta/conf/distro/include/tcmode-default.inc
index 84ecd72480..0abf80319c 100644
--- a/meta/conf/distro/include/tcmode-default.inc
+++ b/meta/conf/distro/include/tcmode-default.inc
@@ -42,6 +42,7 @@ PREFERRED_VERSION_nativesdk-gcc-runtime ?= "${SDKGCCVERSION}"
42PREFERRED_VERSION_nativesdk-gcc-sanitizers ?= "${SDKGCCVERSION}" 42PREFERRED_VERSION_nativesdk-gcc-sanitizers ?= "${SDKGCCVERSION}"
43PREFERRED_VERSION_libgcc ?= "${GCCVERSION}" 43PREFERRED_VERSION_libgcc ?= "${GCCVERSION}"
44PREFERRED_VERSION_libgcc-initial ?= "${GCCVERSION}" 44PREFERRED_VERSION_libgcc-initial ?= "${GCCVERSION}"
45PREFERRED_VERSION_nativesdk-gcc ?= "${SDKGCCVERSION}"
45PREFERRED_VERSION_nativesdk-libgcc ?= "${SDKGCCVERSION}" 46PREFERRED_VERSION_nativesdk-libgcc ?= "${SDKGCCVERSION}"
46PREFERRED_VERSION_nativesdk-libgcc-initial ?= "${SDKGCCVERSION}" 47PREFERRED_VERSION_nativesdk-libgcc-initial ?= "${SDKGCCVERSION}"
47PREFERRED_VERSION_binutils ?= "${BINUVERSION}" 48PREFERRED_VERSION_binutils ?= "${BINUVERSION}"
diff --git a/meta/recipes-devtools/gcc/gcc-4.9.inc b/meta/recipes-devtools/gcc/gcc-4.9.inc
index f5908b6730..7a3e4ebd6a 100644
--- a/meta/recipes-devtools/gcc/gcc-4.9.inc
+++ b/meta/recipes-devtools/gcc/gcc-4.9.inc
@@ -78,6 +78,7 @@ SRC_URI = "\
78 file://0060-Only-allow-e500-double-in-SPE_SIMD_REGNO_P-registers.patch \ 78 file://0060-Only-allow-e500-double-in-SPE_SIMD_REGNO_P-registers.patch \
79 file://0061-target-gcc-includedir.patch \ 79 file://0061-target-gcc-includedir.patch \
80 file://0062-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch \ 80 file://0062-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch \
81 file://0063-nativesdk-gcc-support.patch \
81" 82"
82SRC_URI[md5sum] = "6f831b4d251872736e8e9cc09746f327" 83SRC_URI[md5sum] = "6f831b4d251872736e8e9cc09746f327"
83SRC_URI[sha256sum] = "2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e" 84SRC_URI[sha256sum] = "2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e"
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++. */
diff --git a/meta/recipes-devtools/gcc/gcc-5.2.inc b/meta/recipes-devtools/gcc/gcc-5.2.inc
index dba8999017..1a1ed4ccdc 100644
--- a/meta/recipes-devtools/gcc/gcc-5.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-5.2.inc
@@ -71,6 +71,7 @@ SRC_URI = "\
71 file://0037-pr65779.patch \ 71 file://0037-pr65779.patch \
72 file://0038-fix-g++-sysroot.patch \ 72 file://0038-fix-g++-sysroot.patch \
73 file://0039-libcc1-fix-libcc1-s-install-path-and-rpath.patch \ 73 file://0039-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
74 file://0040-nativesdk-gcc-support.patch \
74 " 75 "
75 76
76BACKPORTS = "" 77BACKPORTS = ""
diff --git a/meta/recipes-devtools/gcc/gcc-5.2/0040-nativesdk-gcc-support.patch b/meta/recipes-devtools/gcc/gcc-5.2/0040-nativesdk-gcc-support.patch
new file mode 100644
index 0000000000..ba7360cc78
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-5.2/0040-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++. */
diff --git a/meta/recipes-devtools/gcc/gcc-multilib-config.inc b/meta/recipes-devtools/gcc/gcc-multilib-config.inc
index dcd08190b1..8c07c2d5f8 100644
--- a/meta/recipes-devtools/gcc/gcc-multilib-config.inc
+++ b/meta/recipes-devtools/gcc/gcc-multilib-config.inc
@@ -39,13 +39,14 @@ python gcc_multilib_setup() {
39 bb.utils.mkdirhier('%s/%s' % (build_conf_dir, parent_dir)) 39 bb.utils.mkdirhier('%s/%s' % (build_conf_dir, parent_dir))
40 bb.utils.copyfile(fn, '%s/%s' % (build_conf_dir, rel_path)) 40 bb.utils.copyfile(fn, '%s/%s' % (build_conf_dir, rel_path))
41 41
42 pn = d.getVar('PN', True)
42 multilibs = (d.getVar('MULTILIB_VARIANTS', True) or '').split() 43 multilibs = (d.getVar('MULTILIB_VARIANTS', True) or '').split()
43 if not multilibs: 44 if not multilibs and pn != "nativesdk-gcc":
44 return 45 return
45 46
46 mlprefix = d.getVar('MLPREFIX', True) 47 mlprefix = d.getVar('MLPREFIX', True)
47 pn = d.getVar('PN', True) 48
48 if ('%sgcc' % mlprefix) != pn and (not pn.startswith('gcc-cross-canadian')): 49 if ('%sgcc' % mlprefix) != pn and (not pn.startswith('gcc-cross-canadian')) and pn != "nativesdk-gcc":
49 return 50 return
50 51
51 52
@@ -74,7 +75,7 @@ python gcc_multilib_setup() {
74 def write_headers(root, files, libdir32, libdir64, libdirx32, libdirn32): 75 def write_headers(root, files, libdir32, libdir64, libdirx32, libdirn32):
75 def wrap_libdir(libdir): 76 def wrap_libdir(libdir):
76 if libdir.find('SYSTEMLIBS_DIR') != -1: 77 if libdir.find('SYSTEMLIBS_DIR') != -1:
77 return libdir 78 return '"%r"'
78 else: 79 else:
79 return '"/%s/"' % libdir 80 return '"/%s/"' % libdir
80 81
@@ -135,17 +136,23 @@ python gcc_multilib_setup() {
135 'powerpc64' : ['gcc/config/rs6000/linux64.h'], 136 'powerpc64' : ['gcc/config/rs6000/linux64.h'],
136 } 137 }
137 138
139 libdir32 = 'SYSTEMLIBS_DIR'
140 libdir64 = 'SYSTEMLIBS_DIR'
141 libdirx32 = 'SYSTEMLIBS_DIR'
142 libdirn32 = 'SYSTEMLIBS_DIR'
143
144
138 target_arch = (d.getVar('TARGET_ARCH_MULTILIB_ORIGINAL', True) if mlprefix 145 target_arch = (d.getVar('TARGET_ARCH_MULTILIB_ORIGINAL', True) if mlprefix
139 else d.getVar('TARGET_ARCH', True)) 146 else d.getVar('TARGET_ARCH', True))
147 if pn == "nativesdk-gcc":
148 header_config_files = gcc_header_config_files[d.getVar("SDK_ARCH", True)]
149 write_headers(builddir, header_config_files, libdir32, libdir64, libdirx32, libdirn32)
150 return
151
140 if target_arch not in gcc_target_config_files: 152 if target_arch not in gcc_target_config_files:
141 bb.warn('gcc multilib setup is not supported for TARGET_ARCH=' + target_arch) 153 bb.warn('gcc multilib setup is not supported for TARGET_ARCH=' + target_arch)
142 return 154 return
143 155
144 libdir32 = 'SYSTEMLIBS_DIR'
145 libdir64 = 'SYSTEMLIBS_DIR'
146 libdirx32 = 'SYSTEMLIBS_DIR'
147 libdirn32 = 'SYSTEMLIBS_DIR'
148
149 target_config_files = gcc_target_config_files[target_arch] 156 target_config_files = gcc_target_config_files[target_arch]
150 header_config_files = gcc_header_config_files[target_arch] 157 header_config_files = gcc_header_config_files[target_arch]
151 158
diff --git a/meta/recipes-devtools/gcc/gcc_4.8.bb b/meta/recipes-devtools/gcc/gcc_4.8.bb
index c4827c6443..2c618dfb93 100644
--- a/meta/recipes-devtools/gcc/gcc_4.8.bb
+++ b/meta/recipes-devtools/gcc/gcc_4.8.bb
@@ -5,3 +5,5 @@ require gcc-target.inc
5# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7438:(.text.unlikely+0x2fa): relocation truncated to fit: R_ARM_THM_CALL against symbol `fancy_abort(char const*, int, char const*)' defined in .glue_7 section in linker stubs 5# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7438:(.text.unlikely+0x2fa): relocation truncated to fit: R_ARM_THM_CALL against symbol `fancy_abort(char const*, int, char const*)' defined in .glue_7 section in linker stubs
6# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7442:(.text.unlikely+0x318): additional relocation overflows omitted from the output 6# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7442:(.text.unlikely+0x318): additional relocation overflows omitted from the output
7ARM_INSTRUCTION_SET_armv4 = "arm" 7ARM_INSTRUCTION_SET_armv4 = "arm"
8
9BBCLASSEXTEND = "nativesdk"
diff --git a/meta/recipes-devtools/gcc/gcc_4.9.bb b/meta/recipes-devtools/gcc/gcc_4.9.bb
index c4827c6443..b84baae6da 100644
--- a/meta/recipes-devtools/gcc/gcc_4.9.bb
+++ b/meta/recipes-devtools/gcc/gcc_4.9.bb
@@ -5,3 +5,10 @@ require gcc-target.inc
5# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7438:(.text.unlikely+0x2fa): relocation truncated to fit: R_ARM_THM_CALL against symbol `fancy_abort(char const*, int, char const*)' defined in .glue_7 section in linker stubs 5# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7438:(.text.unlikely+0x2fa): relocation truncated to fit: R_ARM_THM_CALL against symbol `fancy_abort(char const*, int, char const*)' defined in .glue_7 section in linker stubs
6# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7442:(.text.unlikely+0x318): additional relocation overflows omitted from the output 6# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7442:(.text.unlikely+0x318): additional relocation overflows omitted from the output
7ARM_INSTRUCTION_SET_armv4 = "arm" 7ARM_INSTRUCTION_SET_armv4 = "arm"
8
9BBCLASSEXTEND = "nativesdk"
10
11#SYSTEMHEADERS_class-nativesdk = "${@'${target_includedir}'.replace(d.getVar('SDKPATH', True),'%r')}"
12#SYSTEMLIBS_class-nativesdk = "${@'${target_base_libdir}'.replace(d.getVar('SDKPATH', True),'%r')}/"
13#SYSTEMLIBS1_class-nativesdk = "${@'${target_libdir}'.replace(d.getVar('SDKPATH', True),'%r')}/"
14
diff --git a/meta/recipes-devtools/gcc/gcc_5.2.bb b/meta/recipes-devtools/gcc/gcc_5.2.bb
index 254cd7f80c..b0a523cae2 100644
--- a/meta/recipes-devtools/gcc/gcc_5.2.bb
+++ b/meta/recipes-devtools/gcc/gcc_5.2.bb
@@ -11,3 +11,5 @@ do_configure_prepend() {
11 # broken libtool here 11 # broken libtool here
12 sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${S}/libcc1/configure 12 sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${S}/libcc1/configure
13} 13}
14
15BBCLASSEXTEND = "nativesdk"
diff --git a/scripts/relocate_sdk.py b/scripts/relocate_sdk.py
index b2dd258c34..992db5c47d 100755
--- a/scripts/relocate_sdk.py
+++ b/scripts/relocate_sdk.py
@@ -161,7 +161,18 @@ def change_dl_sysdirs():
161 # write it back 161 # write it back
162 f.seek(sh_offset) 162 f.seek(sh_offset)
163 f.write(new_ldsocache_path) 163 f.write(new_ldsocache_path)
164 164 elif name == b(".gccrelocprefix"):
165 offset = 0
166 while (offset + 4096) <= sh_size:
167 path = f.read(4096)
168 new_path = old_prefix.sub(new_prefix, path)
169 # pad with zeros
170 new_path += b("\0") * (4096 - len(new_path))
171 #print "Changing %s to %s at %s" % (str(path), str(new_path), str(offset))
172 # write it back
173 f.seek(sh_offset + offset)
174 f.write(new_path)
175 offset = offset + 4096
165 if sysdirs != "" and sysdirslen != "": 176 if sysdirs != "" and sysdirslen != "":
166 paths = sysdirs.split(b("\0")) 177 paths = sysdirs.split(b("\0"))
167 sysdirs = b("") 178 sysdirs = b("")