diff options
Diffstat (limited to 'recipes-devtools/clang/clang/0016-compiler-rt-support-a-new-embedded-linux-target.patch')
-rw-r--r-- | recipes-devtools/clang/clang/0016-compiler-rt-support-a-new-embedded-linux-target.patch | 326 |
1 files changed, 326 insertions, 0 deletions
diff --git a/recipes-devtools/clang/clang/0016-compiler-rt-support-a-new-embedded-linux-target.patch b/recipes-devtools/clang/clang/0016-compiler-rt-support-a-new-embedded-linux-target.patch new file mode 100644 index 0000000..0c93b47 --- /dev/null +++ b/recipes-devtools/clang/clang/0016-compiler-rt-support-a-new-embedded-linux-target.patch | |||
@@ -0,0 +1,326 @@ | |||
1 | From 6c509374a016e149c06d7cf8db6032864197f89c Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sun, 19 Apr 2015 15:16:23 -0700 | ||
4 | Subject: [PATCH 16/18] compiler-rt: support a new embedded linux target | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | compiler-rt/lib/builtins/int_util.c | 3 +- | ||
9 | .../make/platform/clang_linux_embedded.mk | 286 ++++++++++++++++++ | ||
10 | .../clang_linux_embedded_test_input.c | 0 | ||
11 | 3 files changed, 287 insertions(+), 2 deletions(-) | ||
12 | create mode 100644 compiler-rt/make/platform/clang_linux_embedded.mk | ||
13 | create mode 100644 compiler-rt/make/platform/clang_linux_embedded_test_input.c | ||
14 | |||
15 | diff --git a/compiler-rt/lib/builtins/int_util.c b/compiler-rt/lib/builtins/int_util.c | ||
16 | index 752f2015580..494c870b41d 100644 | ||
17 | --- a/compiler-rt/lib/builtins/int_util.c | ||
18 | +++ b/compiler-rt/lib/builtins/int_util.c | ||
19 | @@ -58,8 +58,7 @@ void __compilerrt_abort_impl(const char *file, int line, const char *function) { | ||
20 | #else | ||
21 | |||
22 | /* Get the system definition of abort() */ | ||
23 | -#include <stdlib.h> | ||
24 | - | ||
25 | +extern void abort (void) __attribute__ ((__noreturn__)); | ||
26 | #ifndef _WIN32 | ||
27 | __attribute__((weak)) | ||
28 | __attribute__((visibility("hidden"))) | ||
29 | diff --git a/compiler-rt/make/platform/clang_linux_embedded.mk b/compiler-rt/make/platform/clang_linux_embedded.mk | ||
30 | new file mode 100644 | ||
31 | index 00000000000..d0a890075a1 | ||
32 | --- /dev/null | ||
33 | +++ b/compiler-rt/make/platform/clang_linux_embedded.mk | ||
34 | @@ -0,0 +1,286 @@ | ||
35 | +# These are the functions which clang needs when it is targeting a previous | ||
36 | +# version of the OS. The issue is that the backend may use functions which were | ||
37 | +# not present in the libgcc that shipped on the platform. In such cases, we link | ||
38 | +# with a version of the library which contains private_extern definitions of all | ||
39 | +# the extra functions which might be referenced. | ||
40 | + | ||
41 | +Description := Static runtime libraries for embedded clang/Linux | ||
42 | + | ||
43 | +# A function that ensures we don't try to build for architectures that we | ||
44 | +# don't have working toolchains for. | ||
45 | +CheckArches = \ | ||
46 | + $(shell \ | ||
47 | + result=""; \ | ||
48 | + for arch in $(1); do \ | ||
49 | + if $(CC) -arch $$arch -c \ | ||
50 | + -integrated-as \ | ||
51 | + $(ProjSrcRoot)/make/platform/clang_linux_embedded_test_input.c \ | ||
52 | + -o /dev/null > /dev/null 2> /dev/null; then \ | ||
53 | + result="$$result$$arch "; \ | ||
54 | + else \ | ||
55 | + printf 1>&2 \ | ||
56 | + "warning: clang_linux_embedded.mk: dropping arch '$$arch' from lib '$(2)'\n"; \ | ||
57 | + fi; \ | ||
58 | + done; \ | ||
59 | + echo $$result) | ||
60 | + | ||
61 | +XCRun = \ | ||
62 | + $(shell \ | ||
63 | + result=`xcrun -find $(1) 2> /dev/null`; \ | ||
64 | + if [ "$$?" != "0" ]; then result=$(1); fi; \ | ||
65 | + echo $$result) | ||
66 | + | ||
67 | +### | ||
68 | + | ||
69 | +CC := $(call XCRun,clang) | ||
70 | +AR := $(call XCRun,ar) | ||
71 | +RANLIB := $(call XCRun,ranlib) | ||
72 | +STRIP := $(call XCRun,strip) | ||
73 | +LIPO := $(call XCRun,lipo) | ||
74 | +DSYMUTIL := $(call XCRun,dsymutil) | ||
75 | +Configs := | ||
76 | +UniversalArchs := | ||
77 | + | ||
78 | +# Soft-float version of the runtime. No floating-point instructions will be used | ||
79 | +# and the ABI (out of necessity) passes floating values in normal registers: | ||
80 | +# non-VFP variant of the AAPCS. | ||
81 | +UniversalArchs.soft_static := $(call CheckArches,arm armv7m armv7em armv7,soft_static) | ||
82 | +Configs += $(if $(UniversalArchs.soft_static),soft_static) | ||
83 | + | ||
84 | +# Hard-float version of the runtime. On ARM VFP instructions and registers are | ||
85 | +# allowed, and floating point values get passed in them. VFP variant of the | ||
86 | +# AAPCS. | ||
87 | +UniversalArchs.hard_static := $(call CheckArches,armv7em armv7 i386 x86_64,hard_static) | ||
88 | +Configs += $(if $(UniversalArchs.hard_static),hard_static) | ||
89 | + | ||
90 | +UniversalArchs.soft_pic := $(call CheckArches,armv6m armv7m armv7em armv7,soft_pic) | ||
91 | +Configs += $(if $(UniversalArchs.soft_pic),soft_pic) | ||
92 | + | ||
93 | +UniversalArchs.hard_pic := $(call CheckArches,armv7em armv7 i386 x86_64,hard_pic) | ||
94 | +Configs += $(if $(UniversalArchs.hard_pic),hard_pic) | ||
95 | + | ||
96 | +CFLAGS := -Wall -Werror -Oz -fomit-frame-pointer -ffreestanding | ||
97 | + | ||
98 | +PIC_CFLAGS := -fPIC | ||
99 | +STATIC_CFLAGS := -static | ||
100 | + | ||
101 | +CFLAGS_SOFT := -mfloat-abi=soft | ||
102 | +CFLAGS_HARD := -mfloat-abi=hard | ||
103 | + | ||
104 | +CFLAGS_I386 := -march=pentium | ||
105 | + | ||
106 | +CFLAGS.soft_static := $(CFLAGS) $(STATIC_CFLAGS) $(CFLAGS_SOFT) | ||
107 | +CFLAGS.hard_static := $(CFLAGS) $(STATIC_CFLAGS) $(CFLAGS_HARD) | ||
108 | +CFLAGS.soft_pic := $(CFLAGS) $(PIC_CFLAGS) $(CFLAGS_SOFT) | ||
109 | +CFLAGS.hard_pic := $(CFLAGS) $(PIC_CFLAGS) $(CFLAGS_HARD) | ||
110 | + | ||
111 | +CFLAGS.soft_static.armv7 := $(CFLAGS.soft_static) $(CFLAGS_ARMV7) | ||
112 | +CFLAGS.hard_static.armv7 := $(CFLAGS.hard_static) $(CFLAGS_ARMV7) | ||
113 | +CFLAGS.soft_pic.armv7 := $(CFLAGS.soft_pic) $(CFLAGS_ARMV7) | ||
114 | +CFLAGS.hard_pic.armv7 := $(CFLAGS.hard_pic) $(CFLAGS_ARMV7) | ||
115 | + | ||
116 | +# x86 platforms ignore -mfloat-abi options and complain about doing so. Despite | ||
117 | +# this they're hard-float. | ||
118 | +CFLAGS.hard_static.i386 := $(CFLAGS) $(STATIC_CFLAGS) $(CFLAGS_I386) | ||
119 | +CFLAGS.hard_pic.i386 := $(CFLAGS) $(PIC_CFLAGS) $(CFLAGS_I386) | ||
120 | +CFLAGS.hard_static.x86_64 := $(CFLAGS) $(STATIC_CFLAGS) | ||
121 | +CFLAGS.hard_pic.x86_64 := $(CFLAGS) $(PIC_CFLAGS) | ||
122 | + | ||
123 | +# Functions not wanted: | ||
124 | +# + eprintf is obsolete anyway | ||
125 | +# + *vfp: designed for Thumb1 CPUs with VFPv2 | ||
126 | + | ||
127 | +COMMON_FUNCTIONS := \ | ||
128 | + absvdi2 \ | ||
129 | + absvsi2 \ | ||
130 | + addvdi3 \ | ||
131 | + addvsi3 \ | ||
132 | + ashldi3 \ | ||
133 | + ashrdi3 \ | ||
134 | + bswapdi2 \ | ||
135 | + bswapsi2 \ | ||
136 | + clzdi2 \ | ||
137 | + clzsi2 \ | ||
138 | + cmpdi2 \ | ||
139 | + ctzdi2 \ | ||
140 | + ctzsi2 \ | ||
141 | + divdc3 \ | ||
142 | + divdi3 \ | ||
143 | + divsc3 \ | ||
144 | + divmodsi4 \ | ||
145 | + udivmodsi4 \ | ||
146 | + do_global_dtors \ | ||
147 | + ffsdi2 \ | ||
148 | + fixdfdi \ | ||
149 | + fixsfdi \ | ||
150 | + fixunsdfdi \ | ||
151 | + fixunsdfsi \ | ||
152 | + fixunssfdi \ | ||
153 | + fixunssfsi \ | ||
154 | + floatdidf \ | ||
155 | + floatdisf \ | ||
156 | + floatundidf \ | ||
157 | + floatundisf \ | ||
158 | + gcc_bcmp \ | ||
159 | + lshrdi3 \ | ||
160 | + moddi3 \ | ||
161 | + muldc3 \ | ||
162 | + muldi3 \ | ||
163 | + mulsc3 \ | ||
164 | + mulvdi3 \ | ||
165 | + mulvsi3 \ | ||
166 | + negdi2 \ | ||
167 | + negvdi2 \ | ||
168 | + negvsi2 \ | ||
169 | + paritydi2 \ | ||
170 | + paritysi2 \ | ||
171 | + popcountdi2 \ | ||
172 | + popcountsi2 \ | ||
173 | + powidf2 \ | ||
174 | + powisf2 \ | ||
175 | + subvdi3 \ | ||
176 | + subvsi3 \ | ||
177 | + ucmpdi2 \ | ||
178 | + udiv_w_sdiv \ | ||
179 | + udivdi3 \ | ||
180 | + udivmoddi4 \ | ||
181 | + umoddi3 \ | ||
182 | + adddf3 \ | ||
183 | + addsf3 \ | ||
184 | + cmpdf2 \ | ||
185 | + cmpsf2 \ | ||
186 | + div0 \ | ||
187 | + divdf3 \ | ||
188 | + divsf3 \ | ||
189 | + divsi3 \ | ||
190 | + extendsfdf2 \ | ||
191 | + ffssi2 \ | ||
192 | + fixdfsi \ | ||
193 | + fixsfsi \ | ||
194 | + floatsidf \ | ||
195 | + floatsisf \ | ||
196 | + floatunsidf \ | ||
197 | + floatunsisf \ | ||
198 | + comparedf2 \ | ||
199 | + comparesf2 \ | ||
200 | + modsi3 \ | ||
201 | + muldf3 \ | ||
202 | + mulsf3 \ | ||
203 | + negdf2 \ | ||
204 | + negsf2 \ | ||
205 | + subdf3 \ | ||
206 | + subsf3 \ | ||
207 | + truncdfsf2 \ | ||
208 | + udivsi3 \ | ||
209 | + umodsi3 \ | ||
210 | + unorddf2 \ | ||
211 | + unordsf2 | ||
212 | + | ||
213 | +ARM_FUNCTIONS := \ | ||
214 | + aeabi_cdcmpeq \ | ||
215 | + aeabi_cdrcmple \ | ||
216 | + aeabi_cfcmpeq \ | ||
217 | + aeabi_cfrcmple \ | ||
218 | + aeabi_dcmpeq \ | ||
219 | + aeabi_dcmpge \ | ||
220 | + aeabi_dcmpgt \ | ||
221 | + aeabi_dcmple \ | ||
222 | + aeabi_dcmplt \ | ||
223 | + aeabi_drsub \ | ||
224 | + aeabi_fcmpeq \ | ||
225 | + aeabi_fcmpge \ | ||
226 | + aeabi_fcmpgt \ | ||
227 | + aeabi_fcmple \ | ||
228 | + aeabi_fcmplt \ | ||
229 | + aeabi_frsub \ | ||
230 | + aeabi_idivmod \ | ||
231 | + aeabi_uidivmod \ | ||
232 | + | ||
233 | +# ARM Assembly implementation which requires Thumb2 (i.e. won't work on v6M). | ||
234 | +THUMB2_FUNCTIONS := \ | ||
235 | + switch16 \ | ||
236 | + switch32 \ | ||
237 | + switch8 \ | ||
238 | + switchu8 \ | ||
239 | + sync_fetch_and_add_4 \ | ||
240 | + sync_fetch_and_sub_4 \ | ||
241 | + sync_fetch_and_and_4 \ | ||
242 | + sync_fetch_and_or_4 \ | ||
243 | + sync_fetch_and_xor_4 \ | ||
244 | + sync_fetch_and_nand_4 \ | ||
245 | + sync_fetch_and_max_4 \ | ||
246 | + sync_fetch_and_umax_4 \ | ||
247 | + sync_fetch_and_min_4 \ | ||
248 | + sync_fetch_and_umin_4 \ | ||
249 | + sync_fetch_and_add_8 \ | ||
250 | + sync_fetch_and_sub_8 \ | ||
251 | + sync_fetch_and_and_8 \ | ||
252 | + sync_fetch_and_or_8 \ | ||
253 | + sync_fetch_and_xor_8 \ | ||
254 | + sync_fetch_and_nand_8 \ | ||
255 | + sync_fetch_and_max_8 \ | ||
256 | + sync_fetch_and_umax_8 \ | ||
257 | + sync_fetch_and_min_8 \ | ||
258 | + sync_fetch_and_umin_8 | ||
259 | + | ||
260 | +I386_FUNCTIONS := \ | ||
261 | + i686.get_pc_thunk.eax \ | ||
262 | + i686.get_pc_thunk.ebp \ | ||
263 | + i686.get_pc_thunk.ebx \ | ||
264 | + i686.get_pc_thunk.ecx \ | ||
265 | + i686.get_pc_thunk.edi \ | ||
266 | + i686.get_pc_thunk.edx \ | ||
267 | + i686.get_pc_thunk.esi | ||
268 | + | ||
269 | +# FIXME: Currently, compiler-rt is missing implementations for a number of the | ||
270 | +# functions. Filter them out for now. | ||
271 | +MISSING_FUNCTIONS := \ | ||
272 | + cmpdf2 cmpsf2 div0 \ | ||
273 | + ffssi2 \ | ||
274 | + udiv_w_sdiv unorddf2 unordsf2 bswapdi2 \ | ||
275 | + bswapsi2 \ | ||
276 | + gcc_bcmp \ | ||
277 | + do_global_dtors \ | ||
278 | + i686.get_pc_thunk.eax i686.get_pc_thunk.ebp i686.get_pc_thunk.ebx \ | ||
279 | + i686.get_pc_thunk.ecx i686.get_pc_thunk.edi i686.get_pc_thunk.edx \ | ||
280 | + i686.get_pc_thunk.esi \ | ||
281 | + aeabi_cdcmpeq aeabi_cdrcmple aeabi_cfcmpeq aeabi_cfrcmple aeabi_dcmpeq \ | ||
282 | + aeabi_dcmpge aeabi_dcmpgt aeabi_dcmple aeabi_dcmplt aeabi_drsub \ | ||
283 | + aeabi_fcmpeq \ aeabi_fcmpge aeabi_fcmpgt aeabi_fcmple aeabi_fcmplt \ | ||
284 | + aeabi_frsub aeabi_idivmod aeabi_uidivmod | ||
285 | + | ||
286 | +FUNCTIONS_ARMV6M := $(COMMON_FUNCTIONS) $(ARM_FUNCTIONS) | ||
287 | +FUNCTIONS_ARM_ALL := $(COMMON_FUNCTIONS) $(ARM_FUNCTIONS) $(THUMB2_FUNCTIONS) | ||
288 | +FUNCTIONS_I386 := $(COMMON_FUNCTIONS) $(I386_FUNCTIONS) | ||
289 | +FUNCTIONS_X86_64 := $(COMMON_FUNCTIONS) | ||
290 | + | ||
291 | +FUNCTIONS_ARMV6M := \ | ||
292 | + $(filter-out $(MISSING_FUNCTIONS),$(FUNCTIONS_ARMV6M)) | ||
293 | +FUNCTIONS_ARM_ALL := \ | ||
294 | + $(filter-out $(MISSING_FUNCTIONS),$(FUNCTIONS_ARM_ALL)) | ||
295 | +FUNCTIONS_I386 := \ | ||
296 | + $(filter-out $(MISSING_FUNCTIONS),$(FUNCTIONS_I386)) | ||
297 | +FUNCTIONS_X86_64 := \ | ||
298 | + $(filter-out $(MISSING_FUNCTIONS),$(FUNCTIONS_X86_64)) | ||
299 | + | ||
300 | +FUNCTIONS.soft_static.armv6m := $(FUNCTIONS_ARMV6M) | ||
301 | +FUNCTIONS.soft_pic.armv6m := $(FUNCTIONS_ARMV6M) | ||
302 | + | ||
303 | +FUNCTIONS.soft_static.armv7m := $(FUNCTIONS_ARM_ALL) | ||
304 | +FUNCTIONS.soft_pic.armv7m := $(FUNCTIONS_ARM_ALL) | ||
305 | + | ||
306 | +FUNCTIONS.soft_static.armv7em := $(FUNCTIONS_ARM_ALL) | ||
307 | +FUNCTIONS.hard_static.armv7em := $(FUNCTIONS_ARM_ALL) | ||
308 | +FUNCTIONS.soft_pic.armv7em := $(FUNCTIONS_ARM_ALL) | ||
309 | +FUNCTIONS.hard_pic.armv7em := $(FUNCTIONS_ARM_ALL) | ||
310 | + | ||
311 | +FUNCTIONS.soft_static.armv7 := $(FUNCTIONS_ARM_ALL) | ||
312 | +FUNCTIONS.hard_static.armv7 := $(FUNCTIONS_ARM_ALL) | ||
313 | +FUNCTIONS.soft_pic.armv7 := $(FUNCTIONS_ARM_ALL) | ||
314 | +FUNCTIONS.hard_pic.armv7 := $(FUNCTIONS_ARM_ALL) | ||
315 | + | ||
316 | +FUNCTIONS.hard_static.i386 := $(FUNCTIONS_I386) | ||
317 | +FUNCTIONS.hard_pic.i386 := $(FUNCTIONS_I386) | ||
318 | + | ||
319 | +FUNCTIONS.hard_static.x86_64 := $(FUNCTIONS_X86_64) | ||
320 | +FUNCTIONS.hard_pic.x86_64 := $(FUNCTIONS_X86_64) | ||
321 | diff --git a/compiler-rt/make/platform/clang_linux_embedded_test_input.c b/compiler-rt/make/platform/clang_linux_embedded_test_input.c | ||
322 | new file mode 100644 | ||
323 | index 00000000000..e69de29bb2d | ||
324 | -- | ||
325 | 2.20.1 | ||
326 | |||