From 48107e9c52b6ef16174280db582b078f687ae99f Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 8 Feb 2019 10:07:54 -0800 Subject: clang: Enable LTO and lld based on distro knobs Add to local.conf or distro config the following to enable lto flavors and lld linker DISTRO_FEATURES += "thin-lto" DISTRO_FEATURES += "full-lto" DISTRO_FEATURES += "lld" Add lto.bbclass To enable LTO is currently per recipe, or globally to enable globally add following to global config meta-data e.g. local.conf INHRIT += "lto" other-wise enable LTO per recipe using inherit lto to recipe via bbappend or in main recipe Signed-off-by: Khem Raj --- recipes-devtools/clang/clang_git.bb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'recipes-devtools/clang/clang_git.bb') 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): def get_clang_experimental_target_arch(bb, d): return get_clang_experimental_arch(bb, d, 'TARGET_ARCH') -PACKAGECONFIG ??= "compiler-rt libcplusplus lto shared-libs" -PACKAGECONFIG_class-native = "lto" -PACKAGECONFIG_class-nativesdk = "compiler-rt libcplusplus lto" +PACKAGECONFIG ??= "compiler-rt libcplusplus shared-libs ${@bb.utils.filter('DISTRO_FEATURES', 'thin-lto full-lto', d)}" +PACKAGECONFIG_class-native = "thin-lto ${@bb.utils.filter('DISTRO_FEATURES', 'full-lto', d)}" +PACKAGECONFIG_class-nativesdk = "compiler-rt libcplusplus thin-lto ${@bb.utils.filter('DISTRO_FEATURES', 'full-lto', d)}" PACKAGECONFIG[compiler-rt] = "-DCLANG_DEFAULT_RTLIB=compiler-rt,,compiler-rt" PACKAGECONFIG[libcplusplus] = "-DCLANG_DEFAULT_CXX_STDLIB=libc++,,libcxx" -PACKAGECONFIG[lto] = "-DLLVM_ENABLE_LTO=Thin -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils," +PACKAGECONFIG[thin-lto] = "-DLLVM_ENABLE_LTO=Thin -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils," +PACKAGECONFIG[full-lto] = "-DLLVM_ENABLE_LTO=Full -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils," PACKAGECONFIG[shared-libs] = "-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON,,," # -- cgit v1.2.3-54-g00ecf