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