summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/clang/clang
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2018-12-27 10:47:14 -0800
committerKhem Raj <raj.khem@gmail.com>2018-12-27 17:29:06 -0800
commit3d4c48bd0afb67396aacbc444fa7f6698724860e (patch)
treec6baddd7ea8c73f781a9f691585108d228684d30 /recipes-devtools/clang/clang
parent463509e8b983a0e999d01c803a1a999b76d70411 (diff)
downloadmeta-clang-3d4c48bd0afb67396aacbc444fa7f6698724860e.tar.gz
recipes: Rework llvm/clang/compiler-rt/libcxx/lldb recipes
This is an overhaul of clang/llvm project related recipes * switch to using a flat mono repo for all clang/llvm projects * Add llvm-project-source recipe which will prepare source tree in work-shared for all recipes much like kernel and gcc * build lld as part of clang recipes, its much easier and saves build time and hopefully nativesdk version will be built now for free * switch to official git repos at git://github.com/llvm-project * Adjust all recipes to use shared sources Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'recipes-devtools/clang/clang')
-rw-r--r--recipes-devtools/clang/clang/0001-compiler-rt-support-a-new-embedded-linux-target.patch326
-rw-r--r--recipes-devtools/clang/clang/0001-lldb-Include-limits.h-for-PATH_MAX-definition.patch28
-rw-r--r--recipes-devtools/clang/clang/0002-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch46
-rw-r--r--recipes-devtools/clang/clang/0002-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch40
-rw-r--r--recipes-devtools/clang/clang/0003-compiler-rt-Disable-tsan-on-OE-glibc.patch42
-rw-r--r--recipes-devtools/clang/clang/0004-compiler-rt-cmake-mips-Do-not-specify-target-with-OE.patch44
6 files changed, 526 insertions, 0 deletions
diff --git a/recipes-devtools/clang/clang/0001-compiler-rt-support-a-new-embedded-linux-target.patch b/recipes-devtools/clang/clang/0001-compiler-rt-support-a-new-embedded-linux-target.patch
new file mode 100644
index 0000000..8b0c9fe
--- /dev/null
+++ b/recipes-devtools/clang/clang/0001-compiler-rt-support-a-new-embedded-linux-target.patch
@@ -0,0 +1,326 @@
1From 8b0d5d19e8ebec9b6508b51701cb0c64069091cb 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 1/4] compiler-rt: support a new embedded linux target
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 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 make/platform/clang_linux_embedded.mk
13 create mode 100644 make/platform/clang_linux_embedded_test_input.c
14
15diff --git a/lib/builtins/int_util.c b/lib/builtins/int_util.c
16index de87410db..0d5b56fe1 100644
17--- a/lib/builtins/int_util.c
18+++ b/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")))
29diff --git a/make/platform/clang_linux_embedded.mk b/make/platform/clang_linux_embedded.mk
30new file mode 100644
31index 000000000..d0a890075
32--- /dev/null
33+++ b/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)
321diff --git a/make/platform/clang_linux_embedded_test_input.c b/make/platform/clang_linux_embedded_test_input.c
322new file mode 100644
323index 000000000..e69de29bb
324--
3252.20.1
326
diff --git a/recipes-devtools/clang/clang/0001-lldb-Include-limits.h-for-PATH_MAX-definition.patch b/recipes-devtools/clang/clang/0001-lldb-Include-limits.h-for-PATH_MAX-definition.patch
new file mode 100644
index 0000000..1c42931
--- /dev/null
+++ b/recipes-devtools/clang/clang/0001-lldb-Include-limits.h-for-PATH_MAX-definition.patch
@@ -0,0 +1,28 @@
1From ff8d7137ed4d62e9db6d31581822a2ce06d5cbc6 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 18 May 2017 23:12:34 -0700
4Subject: [PATCH 1/2] lldb: Include limits.h for PATH_MAX definition
5
6Helps compiling on musl targets
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 source/Utility/FileSpec.cpp | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/source/Utility/FileSpec.cpp b/source/Utility/FileSpec.cpp
14index b6952f7e3..2cedf5d90 100644
15--- a/source/Utility/FileSpec.cpp
16+++ b/source/Utility/FileSpec.cpp
17@@ -29,7 +29,7 @@
18 #include <assert.h> // for assert
19 #include <stdio.h> // for size_t, NULL, snpr...
20 #include <string.h> // for strcmp
21-
22+#include <limits.h> // for PATH_MAX
23 using namespace lldb;
24 using namespace lldb_private;
25
26--
272.20.1
28
diff --git a/recipes-devtools/clang/clang/0002-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch b/recipes-devtools/clang/clang/0002-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch
new file mode 100644
index 0000000..2ff903b
--- /dev/null
+++ b/recipes-devtools/clang/clang/0002-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch
@@ -0,0 +1,46 @@
1From 5ee148af76169aa327bfa0bfc1c2618a68e873fb Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 19 May 2016 23:11:45 -0700
4Subject: [PATCH 2/4] compiler-rt: Simplify cross-compilation. Don't use
5 native-compiled llvm-config.
6
7 Note: AddLLVM.cmake does not expose the LLVM source directory.
8 So if you want to run the test suite, you need to either:
9
10 1) set LLVM_MAIN_SRC_DIR explicitly (to find lit.py)
11 2) change AddLLVM.cmake to point to an installed 'lit'.
12 3) add_subdirectory(compiler-rt/test) from clang instead of compiler-rt.
13
14https://us.codeaurora.org/patches/quic/llvm/50683/compiler-rt-cross-compilation.patch
15
16Signed-off-by: Greg Fitzgerald <gregf@codeaurora.org>
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18---
19 CMakeLists.txt | 11 ++++++++++-
20 1 file changed, 10 insertions(+), 1 deletion(-)
21
22diff --git a/CMakeLists.txt b/CMakeLists.txt
23index 86ca2b3ef..07d894c8a 100644
24--- a/CMakeLists.txt
25+++ b/CMakeLists.txt
26@@ -63,7 +63,16 @@ set(COMPILER_RT_BAREMETAL_BUILD OFF CACHE BOOLEAN
27 "Build for a bare-metal target.")
28
29 if (COMPILER_RT_STANDALONE_BUILD)
30- load_llvm_config()
31+ find_package(LLVM REQUIRED)
32+ list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
33+
34+ # Variables that AddLLVM.cmake depends on (included by AddCompilerRT)
35+ set(LLVM_TOOLS_BINARY_DIR "${LLVM_INSTALL_PREFIX}/bin")
36+ set(LLVM_LIBRARY_DIR "${LLVM_INSTALL_PREFIX}/lib")
37+
38+ set(LLVM_LIBRARY_OUTPUT_INTDIR
39+ ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
40+
41 if (TARGET intrinsics_gen)
42 # Loading the llvm config causes this target to be imported so place it
43 # under the appropriate folder in an IDE.
44--
452.20.1
46
diff --git a/recipes-devtools/clang/clang/0002-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch b/recipes-devtools/clang/clang/0002-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch
new file mode 100644
index 0000000..c331e7a
--- /dev/null
+++ b/recipes-devtools/clang/clang/0002-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch
@@ -0,0 +1,40 @@
1From fa140ec90e72da40d49301e674c84854fdac804b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 22 May 2017 17:36:16 -0700
4Subject: [PATCH 2/2] lldb: Add -lxml2 to linker cmdline of xml is found
5
6When cross compiling for systems where static libs
7for libxml are not available cmake's detection mechanism
8resort to linking with libxml.so but doesnt use -lxml2
9liblldbHost.a however requires libxml on linker
10cmdline _after_ itself so its use of symbols from libxml2
11can be resolved. Here check for libxml2 being detected and
12add it if its found.
13
14Fixes
15
16| ../../../../lib/liblldbHost.a(XML.cpp.o): In function `lldb_private::XMLDocument::Clear()':
17| /usr/src/debug/lldb/5.0.0+gitAUTOINC+69edad7913_08d6b47db9_cf6c5b3386-r0/git/tools/lldb/source/Host/common/XML.cpp:29: undefined reference to `xmlFreeDoc'
18| /usr/src/debug/lldb/5.0.0+gitAUTOINC+69edad7913_08d6b47db9_cf6c5b3386-r0/git/tools/lldb/source/Host/common/XML.cpp:29: undefined reference to `xmlFreeDoc'
19
20Signed-off-by: Khem Raj <raj.khem@gmail.com>
21---
22 source/Host/CMakeLists.txt | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25diff --git a/source/Host/CMakeLists.txt b/source/Host/CMakeLists.txt
26index 5a92447ed..22ce6eee4 100644
27--- a/source/Host/CMakeLists.txt
28+++ b/source/Host/CMakeLists.txt
29@@ -149,7 +149,7 @@ if (APPLE)
30 list(APPEND EXTRA_LIBS xml2)
31 else ()
32 if (LIBXML2_FOUND)
33- list(APPEND EXTRA_LIBS ${LIBXML2_LIBRARIES})
34+ list(APPEND EXTRA_LIBS xml2)
35 endif()
36 endif ()
37 if (HAVE_LIBDL)
38--
392.20.1
40
diff --git a/recipes-devtools/clang/clang/0003-compiler-rt-Disable-tsan-on-OE-glibc.patch b/recipes-devtools/clang/clang/0003-compiler-rt-Disable-tsan-on-OE-glibc.patch
new file mode 100644
index 0000000..8f45c2b
--- /dev/null
+++ b/recipes-devtools/clang/clang/0003-compiler-rt-Disable-tsan-on-OE-glibc.patch
@@ -0,0 +1,42 @@
1From c7d41a6e4dd61733530d2f44c377b91e13004b71 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 18 Jul 2016 08:05:02 +0000
4Subject: [PATCH 3/4] compiler-rt: Disable tsan on OE/glibc
5
6It does not build see
7http://lists.llvm.org/pipermail/llvm-dev/2016-July/102235.html
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 cmake/config-ix.cmake | 2 +-
12 test/sanitizer_common/CMakeLists.txt | 1 -
13 2 files changed, 1 insertion(+), 2 deletions(-)
14
15diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
16index f3935ffd6..2c651b756 100644
17--- a/cmake/config-ix.cmake
18+++ b/cmake/config-ix.cmake
19@@ -564,7 +564,7 @@ else()
20 endif()
21
22 if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND
23- OS_NAME MATCHES "Darwin|Linux|FreeBSD|Android|NetBSD")
24+ OS_NAME MATCHES "Darwin|FreeBSD|Android|NetBSD")
25 set(COMPILER_RT_HAS_TSAN TRUE)
26 else()
27 set(COMPILER_RT_HAS_TSAN FALSE)
28diff --git a/test/sanitizer_common/CMakeLists.txt b/test/sanitizer_common/CMakeLists.txt
29index 4e2c80390..990315f11 100644
30--- a/test/sanitizer_common/CMakeLists.txt
31+++ b/test/sanitizer_common/CMakeLists.txt
32@@ -8,7 +8,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD|SunOS")
33 list(APPEND SUPPORTED_TOOLS asan)
34 endif()
35 if(CMAKE_SYSTEM_NAME MATCHES "NetBSD" OR (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT ANDROID))
36- list(APPEND SUPPORTED_TOOLS tsan)
37 list(APPEND SUPPORTED_TOOLS msan)
38 list(APPEND SUPPORTED_TOOLS ubsan)
39 endif()
40--
412.20.1
42
diff --git a/recipes-devtools/clang/clang/0004-compiler-rt-cmake-mips-Do-not-specify-target-with-OE.patch b/recipes-devtools/clang/clang/0004-compiler-rt-cmake-mips-Do-not-specify-target-with-OE.patch
new file mode 100644
index 0000000..0356e2a
--- /dev/null
+++ b/recipes-devtools/clang/clang/0004-compiler-rt-cmake-mips-Do-not-specify-target-with-OE.patch
@@ -0,0 +1,44 @@
1From b29deaeb42a8f56bb5dd72b5a8c3e2c755a6bb9e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 11 Feb 2017 17:54:33 +0000
4Subject: [PATCH 4/4] compiler-rt: cmake/mips: Do not specify --target with OE
5
6OE already specifies cross compiler correctly, adding this additional
7--target confuses the clang driver and it resorts to invoke host assembler
8when using -no-integrated-as
9
10Fixes errors e.g.
11| Assembler messages:
12|
13| Fatal error: invalid -march= option: `mips32r2'
14|
15| clang-4.0: error: assembler command failed with exit code 1
16
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18---
19 cmake/base-config-ix.cmake | 8 ++++----
20 1 file changed, 4 insertions(+), 4 deletions(-)
21
22diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
23index 91fe2494b..789b80628 100644
24--- a/cmake/base-config-ix.cmake
25+++ b/cmake/base-config-ix.cmake
26@@ -191,11 +191,11 @@ macro(test_targets)
27 # clang's default CPU's. In the 64-bit case, we must also specify the ABI
28 # since the default ABI differs between gcc and clang.
29 # FIXME: Ideally, we would build the N32 library too.
30- test_target_arch(mipsel "" "-mips32r2" "--target=mipsel-linux-gnu")
31- test_target_arch(mips64el "" "-mips64r2" "--target=mips64el-linux-gnu" "-mabi=64")
32+ test_target_arch(mipsel "" "-mips32r2")
33+ test_target_arch(mips64el "" "-mips64r2" "-mabi=64")
34 elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mips")
35- test_target_arch(mips "" "-mips32r2" "--target=mips-linux-gnu")
36- test_target_arch(mips64 "" "-mips64r2" "--target=mips64-linux-gnu" "-mabi=64")
37+ test_target_arch(mips "" "-mips32r2")
38+ test_target_arch(mips64 "" "-mips64r2" "-mabi=64")
39 elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "arm")
40 if(WIN32)
41 test_target_arch(arm "" "" "")
42--
432.20.1
44