diff options
-rw-r--r-- | classes/clang.bbclass | 3 | ||||
-rw-r--r-- | classes/lto.bbclass | 7 | ||||
-rw-r--r-- | recipes-devtools/clang/clang_git.bb | 9 |
3 files changed, 15 insertions, 4 deletions
diff --git a/classes/clang.bbclass b/classes/clang.bbclass index 88dd893..2d08c10 100644 --- a/classes/clang.bbclass +++ b/classes/clang.bbclass | |||
@@ -18,6 +18,9 @@ TUNE_CCARGS_append_toolchain-clang = " -Wno-error=unused-command-line-argument - | |||
18 | TOOLCHAIN_OPTIONS_append_toolchain-clang_class-nativesdk_x86-64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-x86-64.so.2" | 18 | TOOLCHAIN_OPTIONS_append_toolchain-clang_class-nativesdk_x86-64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-x86-64.so.2" |
19 | TOOLCHAIN_OPTIONS_append_toolchain-clang_class-nativesdk_x86 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux.so.2" | 19 | TOOLCHAIN_OPTIONS_append_toolchain-clang_class-nativesdk_x86 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux.so.2" |
20 | 20 | ||
21 | # Enable lld globally" | ||
22 | TOOLCHAIN_OPTIONS_append_toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -fuse-ld=lld', '', d)}" | ||
23 | |||
21 | # choose between 'gcc' 'clang' an empty '' can be used as well | 24 | # choose between 'gcc' 'clang' an empty '' can be used as well |
22 | TOOLCHAIN ??= "gcc" | 25 | TOOLCHAIN ??= "gcc" |
23 | 26 | ||
diff --git a/classes/lto.bbclass b/classes/lto.bbclass new file mode 100644 index 0000000..80a3d4d --- /dev/null +++ b/classes/lto.bbclass | |||
@@ -0,0 +1,7 @@ | |||
1 | # Enable LTO based on global distro settings | ||
2 | TOOLCHAIN_OPTIONS_append_toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'thin-lto', ' -flto=thin -fuse-ld=gold', '', d)}" | ||
3 | TOOLCHAIN_OPTIONS_append_toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'full-lto', ' -flto=full -fuse-ld=gold', '', d)}" | ||
4 | RANLIB_toolchain-clang = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib" | ||
5 | AR_toolchain-clang = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar" | ||
6 | NM_toolchain-clang = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm" | ||
7 | |||
diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb index 63709fa..52d013d 100644 --- a/recipes-devtools/clang/clang_git.bb +++ b/recipes-devtools/clang/clang_git.bb | |||
@@ -43,13 +43,14 @@ def get_clang_target_arch(bb, d): | |||
43 | def get_clang_experimental_target_arch(bb, d): | 43 | def get_clang_experimental_target_arch(bb, d): |
44 | return get_clang_experimental_arch(bb, d, 'TARGET_ARCH') | 44 | return get_clang_experimental_arch(bb, d, 'TARGET_ARCH') |
45 | 45 | ||
46 | PACKAGECONFIG ??= "compiler-rt libcplusplus lto shared-libs" | 46 | PACKAGECONFIG ??= "compiler-rt libcplusplus shared-libs ${@bb.utils.filter('DISTRO_FEATURES', 'thin-lto full-lto', d)}" |
47 | PACKAGECONFIG_class-native = "lto" | 47 | PACKAGECONFIG_class-native = "thin-lto ${@bb.utils.filter('DISTRO_FEATURES', 'full-lto', d)}" |
48 | PACKAGECONFIG_class-nativesdk = "compiler-rt libcplusplus lto" | 48 | PACKAGECONFIG_class-nativesdk = "compiler-rt libcplusplus thin-lto ${@bb.utils.filter('DISTRO_FEATURES', 'full-lto', d)}" |
49 | 49 | ||
50 | PACKAGECONFIG[compiler-rt] = "-DCLANG_DEFAULT_RTLIB=compiler-rt,,compiler-rt" | 50 | PACKAGECONFIG[compiler-rt] = "-DCLANG_DEFAULT_RTLIB=compiler-rt,,compiler-rt" |
51 | PACKAGECONFIG[libcplusplus] = "-DCLANG_DEFAULT_CXX_STDLIB=libc++,,libcxx" | 51 | PACKAGECONFIG[libcplusplus] = "-DCLANG_DEFAULT_CXX_STDLIB=libc++,,libcxx" |
52 | PACKAGECONFIG[lto] = "-DLLVM_ENABLE_LTO=Thin -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils," | 52 | PACKAGECONFIG[thin-lto] = "-DLLVM_ENABLE_LTO=Thin -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils," |
53 | PACKAGECONFIG[full-lto] = "-DLLVM_ENABLE_LTO=Full -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils," | ||
53 | PACKAGECONFIG[shared-libs] = "-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON,,," | 54 | PACKAGECONFIG[shared-libs] = "-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON,,," |
54 | 55 | ||
55 | # | 56 | # |