diff options
author | Khem Raj <raj.khem@gmail.com> | 2017-03-16 09:10:54 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2017-03-16 09:10:54 -0700 |
commit | da9df5ff07941351f14b2d406ffcf61b166d2cb5 (patch) | |
tree | 5199e04f23317778bcd8ee4fbfb4120c02005387 | |
parent | 3c289d9ab1bfda19199e5bcacba48256ac34886c (diff) | |
download | meta-clang-da9df5ff07941351f14b2d406ffcf61b166d2cb5.tar.gz |
clang/compiler-rt: Use compiler-rt and libcxx as default runtime for target clang
One can still use -stdlib=libstdc++ and -rtlib=libgcc to use gcc runtime
Signed-off-by: Khem Raj <raj.khem@gmail.com>
5 files changed, 78 insertions, 49 deletions
diff --git a/recipes-devtools/clang/clang/0004-clang-Do-not-search-clang-install-dir-relative-.-lib.patch b/recipes-devtools/clang/clang/0004-clang-Do-not-search-clang-install-dir-relative-.-lib.patch deleted file mode 100644 index 91a3b67..0000000 --- a/recipes-devtools/clang/clang/0004-clang-Do-not-search-clang-install-dir-relative-.-lib.patch +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | From b6080c3e17e348464b025d34d84f5851ac9f3ba3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 27 Jan 2017 11:38:45 -0800 | ||
4 | Subject: [PATCH 4/4] clang: Do not search clang install dir relative ../lib | ||
5 | dir | ||
6 | |||
7 | This in OE is installed in native sysroot and bin/../lib | ||
8 | contains native libraries not target libs | ||
9 | |||
10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
11 | --- | ||
12 | lib/Driver/ToolChains.cpp | 1 - | ||
13 | 1 file changed, 1 deletion(-) | ||
14 | |||
15 | Index: clang/lib/Driver/ToolChains.cpp | ||
16 | =================================================================== | ||
17 | --- clang.orig/lib/Driver/ToolChains.cpp | ||
18 | +++ clang/lib/Driver/ToolChains.cpp | ||
19 | @@ -4221,7 +4221,7 @@ Linux::Linux(const Driver &D, const llvm | ||
20 | // directory ('Dir' below) or the ResourceDir. | ||
21 | if (StringRef(D.Dir).startswith(SysRoot)) { | ||
22 | addPathIfExists(D, D.Dir + "/../lib/" + MultiarchTriple, Paths); | ||
23 | - addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths); | ||
24 | +// addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths); | ||
25 | } | ||
26 | |||
27 | addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths); | ||
28 | @@ -4265,8 +4265,8 @@ Linux::Linux(const Driver &D, const llvm | ||
29 | // searched. | ||
30 | // FIXME: It's not clear whether we should use the driver's installed | ||
31 | // directory ('Dir' below) or the ResourceDir. | ||
32 | - if (StringRef(D.Dir).startswith(SysRoot)) | ||
33 | - addPathIfExists(D, D.Dir + "/../lib", Paths); | ||
34 | + //if (StringRef(D.Dir).startswith(SysRoot)) | ||
35 | + // addPathIfExists(D, D.Dir + "/../lib", Paths); | ||
36 | |||
37 | addPathIfExists(D, SysRoot + "/lib", Paths); | ||
38 | addPathIfExists(D, SysRoot + "/usr/lib", Paths); | ||
diff --git a/recipes-devtools/clang/clang/0004-clang-Prepend-trailing-to-sysroot.patch b/recipes-devtools/clang/clang/0004-clang-Prepend-trailing-to-sysroot.patch new file mode 100644 index 0000000..fbab45e --- /dev/null +++ b/recipes-devtools/clang/clang/0004-clang-Prepend-trailing-to-sysroot.patch | |||
@@ -0,0 +1,41 @@ | |||
1 | From b261f7a113462c8f91e729e4dd090b93ea7528e1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 16 Mar 2017 09:02:13 -0700 | ||
4 | Subject: [PATCH 4/4] clang: Prepend trailing '/' to sysroot | ||
5 | |||
6 | This is needed to handle a case where clang | ||
7 | isntall and target sysroot are perilously same | ||
8 | |||
9 | e.g. | ||
10 | |||
11 | sysroot = /mnt/clang/recipe-sysroot | ||
12 | clang install = /mnt/clang/recipe-sysroot-native | ||
13 | |||
14 | in this case it will mistakenly assume that | ||
15 | clang is installed under the same sysroot dir | ||
16 | and it will try to add relative ../lib paths | ||
17 | to linker steps which would then be wrong | ||
18 | since they will become relative to clang | ||
19 | installation and not sysroot | ||
20 | |||
21 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
22 | --- | ||
23 | lib/Driver/ToolChains.cpp | 2 +- | ||
24 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
25 | |||
26 | diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp | ||
27 | index 9d2e343536..2f3aa0680f 100644 | ||
28 | --- a/lib/Driver/ToolChains.cpp | ||
29 | +++ b/lib/Driver/ToolChains.cpp | ||
30 | @@ -4095,7 +4095,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) | ||
31 | GCCInstallation.init(Triple, Args); | ||
32 | Multilibs = GCCInstallation.getMultilibs(); | ||
33 | llvm::Triple::ArchType Arch = Triple.getArch(); | ||
34 | - std::string SysRoot = computeSysRoot(); | ||
35 | + std::string SysRoot = computeSysRoot() + "/"; | ||
36 | |||
37 | // Cross-compiling binutils and GCC installations (vanilla and openSUSE at | ||
38 | // least) put various tools in a triple-prefixed directory off of the parent | ||
39 | -- | ||
40 | 2.12.0 | ||
41 | |||
diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb index cc0d45e..29e2e8f 100644 --- a/recipes-devtools/clang/clang_git.bb +++ b/recipes-devtools/clang/clang_git.bb | |||
@@ -15,14 +15,21 @@ LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=${LLVMMD5SUM}; \ | |||
15 | " | 15 | " |
16 | SRC_URI = "${LLVM_GIT}/llvm.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};name=llvm \ | 16 | SRC_URI = "${LLVM_GIT}/llvm.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};name=llvm \ |
17 | ${LLVM_GIT}/clang.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};destsuffix=git/tools/clang;name=clang \ | 17 | ${LLVM_GIT}/clang.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};destsuffix=git/tools/clang;name=clang \ |
18 | " | ||
19 | |||
20 | # llvm patches | ||
21 | SRC_URI += "\ | ||
18 | file://0001-llvm-Remove-CMAKE_CROSSCOMPILING-so-it-can-cross-com.patch \ | 22 | file://0001-llvm-Remove-CMAKE_CROSSCOMPILING-so-it-can-cross-com.patch \ |
19 | file://0002-llvm-Do-not-assume-linux-glibc.patch \ | 23 | file://0002-llvm-Do-not-assume-linux-glibc.patch \ |
20 | file://0003-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \ | 24 | file://0003-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \ |
21 | \ | 25 | " |
26 | |||
27 | # Clang patches | ||
28 | SRC_URI += "\ | ||
22 | file://0001-clang-driver-Use-lib-for-ldso-on-OE.patch;patchdir=tools/clang \ | 29 | file://0001-clang-driver-Use-lib-for-ldso-on-OE.patch;patchdir=tools/clang \ |
23 | file://0002-clang-Driver-tools.cpp-Add-lssp-and-lssp_nonshared-o.patch;patchdir=tools/clang \ | 30 | file://0002-clang-Driver-tools.cpp-Add-lssp-and-lssp_nonshared-o.patch;patchdir=tools/clang \ |
24 | file://0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch;patchdir=tools/clang \ | 31 | file://0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch;patchdir=tools/clang \ |
25 | file://0004-clang-Do-not-search-clang-install-dir-relative-.-lib.patch;patchdir=tools/clang \ | 32 | file://0004-clang-Prepend-trailing-to-sysroot.patch;patchdir=tools/clang \ |
26 | " | 33 | " |
27 | 34 | ||
28 | SRCREV_FORMAT = "llvm_clang" | 35 | SRCREV_FORMAT = "llvm_clang" |
@@ -57,6 +64,12 @@ def get_clang_target_arch(bb, d): | |||
57 | #TUNE_CCARGS_append_class-target = " -D__extern_always_inline=inline -I${PKG_CONFIG_SYSROOT_DIR}${includedir}/libxml2 " | 64 | #TUNE_CCARGS_append_class-target = " -D__extern_always_inline=inline -I${PKG_CONFIG_SYSROOT_DIR}${includedir}/libxml2 " |
58 | #LDFLAGS_append_class-target = " -L${PKG_CONFIG_SYSROOT_DIR}${libdir}/libxml2 " | 65 | #LDFLAGS_append_class-target = " -L${PKG_CONFIG_SYSROOT_DIR}${libdir}/libxml2 " |
59 | 66 | ||
67 | PACKAGECONFIG ??= "compiler-rt libcplusplus" | ||
68 | PACKAGECONFIG_class-native = "" | ||
69 | |||
70 | PACKAGECONFIG[compiler-rt] = "-DCLANG_DEFAULT_RTLIB=compiler-rt,,compiler-rt" | ||
71 | PACKAGECONFIG[libcplusplus] = "-DCLANG_DEFAULT_CXX_STDLIB=libc++,,libcxx" | ||
72 | |||
60 | EXTRA_OECMAKE="-DLLVM_ENABLE_RTTI=True \ | 73 | EXTRA_OECMAKE="-DLLVM_ENABLE_RTTI=True \ |
61 | -DLLVM_ENABLE_FFI=False \ | 74 | -DLLVM_ENABLE_FFI=False \ |
62 | -DCMAKE_SYSTEM_NAME=Linux \ | 75 | -DCMAKE_SYSTEM_NAME=Linux \ |
diff --git a/recipes-devtools/clang/compiler-rt/0003-Disable-tsan-on-OE-glibc.patch b/recipes-devtools/clang/compiler-rt/0003-Disable-tsan-on-OE-glibc.patch index 67e660d..045f8ac 100644 --- a/recipes-devtools/clang/compiler-rt/0003-Disable-tsan-on-OE-glibc.patch +++ b/recipes-devtools/clang/compiler-rt/0003-Disable-tsan-on-OE-glibc.patch | |||
@@ -1,21 +1,22 @@ | |||
1 | From 622ef6bbd65f71ebbaf3525d50fb357e62631a08 Mon Sep 17 00:00:00 2001 | 1 | From 00ac81c887f0f6eb31bed1e516374b6aa01b6389 Mon Sep 17 00:00:00 2001 |
2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
3 | Date: Mon, 18 Jul 2016 08:05:02 +0000 | 3 | Date: Mon, 18 Jul 2016 08:05:02 +0000 |
4 | Subject: [PATCH 3/3] Disable tsan on OE/glibc | 4 | Subject: [PATCH 3/4] Disable tsan on OE/glibc |
5 | 5 | ||
6 | It does not build see | 6 | It does not build see |
7 | http://lists.llvm.org/pipermail/llvm-dev/2016-July/102235.html | 7 | http://lists.llvm.org/pipermail/llvm-dev/2016-July/102235.html |
8 | 8 | ||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
10 | --- | 10 | --- |
11 | cmake/config-ix.cmake | 2 +- | 11 | cmake/config-ix.cmake | 2 +- |
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 12 | test/sanitizer_common/CMakeLists.txt | 1 - |
13 | 2 files changed, 1 insertion(+), 2 deletions(-) | ||
13 | 14 | ||
14 | diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake | 15 | diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake |
15 | index cb9f74b..d7e0fba 100644 | 16 | index e0e43552e..bb3c77f6d 100644 |
16 | --- a/cmake/config-ix.cmake | 17 | --- a/cmake/config-ix.cmake |
17 | +++ b/cmake/config-ix.cmake | 18 | +++ b/cmake/config-ix.cmake |
18 | @@ -472,7 +472,7 @@ else() | 19 | @@ -491,7 +491,7 @@ else() |
19 | endif() | 20 | endif() |
20 | 21 | ||
21 | if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND | 22 | if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND |
@@ -24,6 +25,18 @@ index cb9f74b..d7e0fba 100644 | |||
24 | set(COMPILER_RT_HAS_TSAN TRUE) | 25 | set(COMPILER_RT_HAS_TSAN TRUE) |
25 | else() | 26 | else() |
26 | set(COMPILER_RT_HAS_TSAN FALSE) | 27 | set(COMPILER_RT_HAS_TSAN FALSE) |
28 | diff --git a/test/sanitizer_common/CMakeLists.txt b/test/sanitizer_common/CMakeLists.txt | ||
29 | index 9b4070b0f..e76f2680c 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" AND NOT ANDROID) | ||
33 | list(APPEND SUPPORTED_TOOLS asan) | ||
34 | endif() | ||
35 | if(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 lsan) | ||
39 | endif() | ||
27 | -- | 40 | -- |
28 | 2.10.0 | 41 | 2.12.0 |
29 | 42 | ||
diff --git a/recipes-devtools/clang/compiler-rt_git.bb b/recipes-devtools/clang/compiler-rt_git.bb index 9ceaff9..e8da315 100644 --- a/recipes-devtools/clang/compiler-rt_git.bb +++ b/recipes-devtools/clang/compiler-rt_git.bb | |||
@@ -56,7 +56,7 @@ do_install_append () { | |||
56 | } | 56 | } |
57 | 57 | ||
58 | FILES_SOLIBSDEV = "" | 58 | FILES_SOLIBSDEV = "" |
59 | FILES_${PN} += "${libdir}/clang/${BASEPV}/lib/linux/lib*${SOLIBSDEV}" | 59 | FILES_${PN} += "${libdir}/clang/${BASEPV}/lib/linux/lib*${SOLIBSDEV} ${libdir}/clang/${BASEPV}/*.txt" |
60 | FILES_${PN}-staticdev += "${libdir}/clang/${BASEPV}/lib/linux/*.a" | 60 | FILES_${PN}-staticdev += "${libdir}/clang/${BASEPV}/lib/linux/*.a" |
61 | INSANE_SKIP_${PN} = "dev-so" | 61 | INSANE_SKIP_${PN} = "dev-so" |
62 | 62 | ||
@@ -69,7 +69,7 @@ INSANE_SKIP_${PN} = "dev-so" | |||
69 | # " | 69 | # " |
70 | # | 70 | # |
71 | 71 | ||
72 | FILES_${PN}-dev += "${libdir}/clang/${BASEPV}/lib/linux/*.syms ${libdir}/clang/${BASEPV}/lib/linux/*.txt" | 72 | FILES_${PN}-dev += "${libdir}/clang/${BASEPV}/lib/linux/*.syms" |
73 | 73 | ||
74 | BBCLASSEXTEND = "native nativesdk" | 74 | BBCLASSEXTEND = "native nativesdk" |
75 | 75 | ||