summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2016-04-03 18:11:11 +0000
committerKhem Raj <raj.khem@gmail.com>2016-04-03 18:11:11 +0000
commit35258485141631fd2eff4d668cb5e033b4920ea7 (patch)
tree407f322bb2e3ae9b1ecfcaf475420ed36cce3d5c
parent9b78ead15b8e64db1b3e6316243a81f153491bca (diff)
downloadmeta-clang-35258485141631fd2eff4d668cb5e033b4920ea7.tar.gz
compiler-rt: Fix target build
Switch to using cmake disable sanitizers since it does not yet cross compile Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--recipes-devtools/clang/compiler-rt/0001-Simplify-cross-compilation.-Don-t-use-native-compile.patch67
-rw-r--r--recipes-devtools/clang/compiler-rt/0001-dont-include-stdlib.h-and-limits.h-together.patch65
-rw-r--r--recipes-devtools/clang/compiler-rt_git.bb23
3 files changed, 146 insertions, 9 deletions
diff --git a/recipes-devtools/clang/compiler-rt/0001-Simplify-cross-compilation.-Don-t-use-native-compile.patch b/recipes-devtools/clang/compiler-rt/0001-Simplify-cross-compilation.-Don-t-use-native-compile.patch
new file mode 100644
index 0000000..67b0e73
--- /dev/null
+++ b/recipes-devtools/clang/compiler-rt/0001-Simplify-cross-compilation.-Don-t-use-native-compile.patch
@@ -0,0 +1,67 @@
1From 6ca47f1d7d4f9fd34baeba86af67108ac0eaeffe Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 3 Apr 2016 07:40:06 +0000
4Subject: [PATCH] Simplify cross-compilation. Don't use native-compiled
5 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 | 32 ++++++--------------------------
20 1 file changed, 6 insertions(+), 26 deletions(-)
21
22diff --git a/CMakeLists.txt b/CMakeLists.txt
23index c60c246..6f989bf 100644
24--- a/CMakeLists.txt
25+++ b/CMakeLists.txt
26@@ -85,32 +85,12 @@ else()
27 set(COMPILER_RT_TEST_COMPILER ${CMAKE_C_COMPILER} CACHE PATH "Compiler to use for testing")
28 set(COMPILER_RT_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE PATH "C++ Compiler to use for testing")
29
30- if (NOT LLVM_CONFIG_PATH)
31- find_program(LLVM_CONFIG_PATH "llvm-config"
32- DOC "Path to llvm-config binary")
33- if (NOT LLVM_CONFIG_PATH)
34- message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH")
35- endif()
36- endif()
37- execute_process(
38- COMMAND ${LLVM_CONFIG_PATH} "--obj-root" "--bindir" "--libdir" "--src-root"
39- RESULT_VARIABLE HAD_ERROR
40- OUTPUT_VARIABLE CONFIG_OUTPUT)
41- if (HAD_ERROR)
42- message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
43- endif()
44- string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";" CONFIG_OUTPUT ${CONFIG_OUTPUT})
45- list(GET CONFIG_OUTPUT 0 LLVM_BINARY_DIR)
46- list(GET CONFIG_OUTPUT 1 LLVM_TOOLS_BINARY_DIR)
47- list(GET CONFIG_OUTPUT 2 LLVM_LIBRARY_DIR)
48- list(GET CONFIG_OUTPUT 3 LLVM_MAIN_SRC_DIR)
49-
50- # Make use of LLVM CMake modules.
51- file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE)
52- set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/share/llvm/cmake")
53- list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
54- # Get some LLVM variables from LLVMConfig.
55- include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
56+ find_package(LLVM REQUIRED)
57+ list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
58+
59+ # Variables that AddLLVM.cmake depends on (included by AddCompilerRT)
60+ set(LLVM_TOOLS_BINARY_DIR "${LLVM_INSTALL_PREFIX}/bin")
61+ set(LLVM_LIBRARY_DIR "${LLVM_INSTALL_PREFIX}/lib")
62
63 set(LLVM_LIBRARY_OUTPUT_INTDIR
64 ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
65--
661.9.1
67
diff --git a/recipes-devtools/clang/compiler-rt/0001-dont-include-stdlib.h-and-limits.h-together.patch b/recipes-devtools/clang/compiler-rt/0001-dont-include-stdlib.h-and-limits.h-together.patch
new file mode 100644
index 0000000..166ddf8
--- /dev/null
+++ b/recipes-devtools/clang/compiler-rt/0001-dont-include-stdlib.h-and-limits.h-together.patch
@@ -0,0 +1,65 @@
1From 69e09408a6a8ddb08d3f148c0eeba68714c1891b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 3 Apr 2016 07:59:59 +0000
4Subject: [PATCH] dont include stdlib.h and limits.h together
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 lib/profile/InstrProfiling.c | 2 +-
9 lib/profile/InstrProfilingValue.c | 2 +-
10 lib/sanitizer_common/sanitizer_platform_limits_posix.cc | 2 +-
11 3 files changed, 3 insertions(+), 3 deletions(-)
12
13diff --git a/lib/profile/InstrProfiling.c b/lib/profile/InstrProfiling.c
14index 711f2b6..9028be5 100644
15--- a/lib/profile/InstrProfiling.c
16+++ b/lib/profile/InstrProfiling.c
17@@ -9,9 +9,9 @@
18
19 #include "InstrProfiling.h"
20 #include "InstrProfilingInternal.h"
21+#include <stdlib.h>
22 #include <limits.h>
23 #include <stdio.h>
24-#include <stdlib.h>
25 #include <string.h>
26 #define INSTR_PROF_VALUE_PROF_DATA
27 #include "InstrProfData.inc"
28diff --git a/lib/profile/InstrProfilingValue.c b/lib/profile/InstrProfilingValue.c
29index 68e16cf..d04cc30 100644
30--- a/lib/profile/InstrProfilingValue.c
31+++ b/lib/profile/InstrProfilingValue.c
32@@ -9,9 +9,9 @@
33
34 #include "InstrProfiling.h"
35 #include "InstrProfilingInternal.h"
36-#include <limits.h>
37 #include <stdio.h>
38 #include <stdlib.h>
39+#include <limits.h>
40 #include <string.h>
41 #define INSTR_PROF_VALUE_PROF_DATA
42 #define INSTR_PROF_COMMON_API_IMPL
43diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
44index b642cba..5d7edcb 100644
45--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
46+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
47@@ -32,7 +32,6 @@
48 #include <dirent.h>
49 #include <errno.h>
50 #include <grp.h>
51-#include <limits.h>
52 #include <net/if.h>
53 #include <netdb.h>
54 #include <poll.h>
55@@ -51,6 +50,7 @@
56 #include <termios.h>
57 #include <time.h>
58 #include <wchar.h>
59+//#include <limits.h>
60
61 #if !SANITIZER_IOS
62 #include <net/route.h>
63--
641.9.1
65
diff --git a/recipes-devtools/clang/compiler-rt_git.bb b/recipes-devtools/clang/compiler-rt_git.bb
index 2b2ba45..f07f20d 100644
--- a/recipes-devtools/clang/compiler-rt_git.bb
+++ b/recipes-devtools/clang/compiler-rt_git.bb
@@ -10,30 +10,35 @@ INHIBIT_DEFAULT_DEPS = "1"
10DEPENDS += "clang-cross-${TARGET_ARCH}" 10DEPENDS += "clang-cross-${TARGET_ARCH}"
11 11
12require clang.inc 12require clang.inc
13
13PV .= "+git${SRCPV}" 14PV .= "+git${SRCPV}"
14 15
15LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=27b14ab4ce08d04c3a9a5f0ed7997362; \ 16LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=27b14ab4ce08d04c3a9a5f0ed7997362; \
16 " 17 "
17SRC_URI = "${LLVM_GIT}/compiler-rt.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};name=compiler-rt \ 18SRC_URI = "${LLVM_GIT}/compiler-rt.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};name=compiler-rt \
18 file://0001-support-a-new-embedded-linux-target.patch \ 19 file://0001-support-a-new-embedded-linux-target.patch \
20 file://0001-Simplify-cross-compilation.-Don-t-use-native-compile.patch \
21 file://0001-dont-include-stdlib.h-and-limits.h-together.patch \
19 " 22 "
20 23
21SRCREV_FORMAT = "compiler-rt" 24SRCREV_FORMAT = "compiler-rt"
22 25
23S = "${WORKDIR}/git" 26S = "${WORKDIR}/git"
24 27
25THUMB_TUNE_CCARGS = "" 28inherit cmake pkgconfig pythonnative
26TUNE_CCARGS += "-ffreestanding -nostdlib"
27 29
28EXTRA_OEMAKE += "REQUIRES_RTTI=1 VERBOSE=1" 30THUMB_TUNE_CCARGS = ""
29 31
30do_configure () { 32EXTRA_OECMAKE += "-DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON \
31 : 33 -DCOMPILER_RT_BUILD_SANITIZERS=OFF \
32} 34 -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=${MULTIMACH_HOST_SYS} \
35"
33 36
34do_compile () { 37do_install_append () {
35 cd ${B} 38 install -d ${D}${base_libdir}
36 oe_runmake VERBOSE=1 clang_linux 39 mv ${D}${libdir}/linux/*.a ${D}${base_libdir}
40 rmdir ${D}${libdir}/linux
41 rmdir ${D}${libdir}
37} 42}
38 43
39#PROVIDES_append_class-target = "\ 44#PROVIDES_append_class-target = "\