diff options
author | Khem Raj <raj.khem@gmail.com> | 2019-09-17 23:40:43 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2019-09-18 15:24:19 -0700 |
commit | 34296e02491cda2ef3c6e624444f8b25888cbad0 (patch) | |
tree | db736bac4816894366c4998a283608660e746cf2 | |
parent | f1b2bca4f51623b3605468d629dec7508a1db149 (diff) | |
download | meta-clang-34296e02491cda2ef3c6e624444f8b25888cbad0.tar.gz |
clang.bbclass: Do not set LIBCPLUSPLUS and COMPILER_RT when compiler != clang
* Add compiler-rt and libcxx only when these libs are used via cmdline
* libffi still need to disable internal asm on arm <= v6
* Add compiler-rt to linker only when compiler-rt is used in compiler
cmdline
* Set BASE_DEFAULT_DEPS instead of munging BASEEDEPENDS directly
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | classes/clang.bbclass | 17 | ||||
-rw-r--r-- | conf/nonclangable.conf | 7 |
2 files changed, 16 insertions, 8 deletions
diff --git a/classes/clang.bbclass b/classes/clang.bbclass index 75c9d4a..99b80a4 100644 --- a/classes/clang.bbclass +++ b/classes/clang.bbclass | |||
@@ -9,6 +9,7 @@ AR_toolchain-clang = "${HOST_PREFIX}llvm-ar" | |||
9 | NM_toolchain-clang = "${HOST_PREFIX}llvm-nm" | 9 | NM_toolchain-clang = "${HOST_PREFIX}llvm-nm" |
10 | 10 | ||
11 | COMPILER_RT ??= "--rtlib=compiler-rt ${UNWINDLIB}" | 11 | COMPILER_RT ??= "--rtlib=compiler-rt ${UNWINDLIB}" |
12 | COMPILER_RT_toolchain-gcc = "" | ||
12 | COMPILER_RT_powerpc = "--rtlib=libgcc ${UNWINDLIB}" | 13 | COMPILER_RT_powerpc = "--rtlib=libgcc ${UNWINDLIB}" |
13 | 14 | ||
14 | UNWINDLIB ??= "--unwindlib=libunwind" | 15 | UNWINDLIB ??= "--unwindlib=libunwind" |
@@ -17,8 +18,6 @@ UNWINDLIB_riscv32 = "--unwindlib=libgcc" | |||
17 | UNWINDLIB_powerpc = "--unwindlib=libgcc" | 18 | UNWINDLIB_powerpc = "--unwindlib=libgcc" |
18 | 19 | ||
19 | LIBCPLUSPLUS ??= "--stdlib=libc++" | 20 | LIBCPLUSPLUS ??= "--stdlib=libc++" |
20 | |||
21 | COMPILER_RT_toolchain-gcc = "" | ||
22 | LIBCPLUSPLUS_toolchain-gcc = "" | 21 | LIBCPLUSPLUS_toolchain-gcc = "" |
23 | 22 | ||
24 | TARGET_CXXFLAGS_append_toolchain-clang = " ${LIBCPLUSPLUS}" | 23 | TARGET_CXXFLAGS_append_toolchain-clang = " ${LIBCPLUSPLUS}" |
@@ -64,11 +63,19 @@ OVERRIDES[vardepsexclude] += "TOOLCHAIN" | |||
64 | def clang_dep_prepend(d): | 63 | def clang_dep_prepend(d): |
65 | if not d.getVar('INHIBIT_DEFAULT_DEPS', False): | 64 | if not d.getVar('INHIBIT_DEFAULT_DEPS', False): |
66 | if not oe.utils.inherits(d, 'allarch') : | 65 | if not oe.utils.inherits(d, 'allarch') : |
67 | return " clang-cross-${TARGET_ARCH} compiler-rt libcxx" | 66 | ret = " clang-cross-${TARGET_ARCH} virtual/libc " |
67 | if (d.getVar('COMPILER_RT').find('--rtlib=compiler-rt') != -1): | ||
68 | ret += " compiler-rt " | ||
69 | else: | ||
70 | ret += " libgcc " | ||
71 | if (d.getVar('LIBCPLUSPLUS').find('--stdlib=libc++') != -1): | ||
72 | ret += " libcxx " | ||
73 | else: | ||
74 | ret += " virtual/${TARGET_PREFIX}compilerlibs " | ||
75 | return ret | ||
68 | return "" | 76 | return "" |
69 | 77 | ||
70 | BASEDEPENDS_remove_toolchain-clang_class-target = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compilerlibs" | 78 | BASE_DEFAULT_DEPS_toolchain-clang_class-target = "${@clang_dep_prepend(d)}" |
71 | BASEDEPENDS_append_toolchain-clang_class-target = "${@clang_dep_prepend(d)}" | ||
72 | 79 | ||
73 | PREFERRED_PROVIDER_libunwind_toolchain-clang = "libcxx" | 80 | PREFERRED_PROVIDER_libunwind_toolchain-clang = "libcxx" |
74 | PREFERRED_PROVIDER_libunwind ?= "libunwind" | 81 | PREFERRED_PROVIDER_libunwind ?= "libunwind" |
diff --git a/conf/nonclangable.conf b/conf/nonclangable.conf index 0537222..b5ebe3b 100644 --- a/conf/nonclangable.conf +++ b/conf/nonclangable.conf | |||
@@ -137,7 +137,8 @@ CFLAGS_append_pn-mdadm_toolchain-clang = " -Wno-error=unknown-warning-option" | |||
137 | 137 | ||
138 | #../libffi-3.2.1/src/arm/sysv.S:363:2: error: invalid instruction, did you mean: fldmiax? | 138 | #../libffi-3.2.1/src/arm/sysv.S:363:2: error: invalid instruction, did you mean: fldmiax? |
139 | # fldmiadgt ip, {d0-d7} | 139 | # fldmiadgt ip, {d0-d7} |
140 | #CFLAGS_append_pn-libffi_toolchain-clang = " -no-integrated-as" | 140 | CFLAGS_append_pn-libffi_arm_toolchain-clang = " -no-integrated-as" |
141 | CFLAGS_append_pn-libffi_armeb_toolchain-clang = " -no-integrated-as" | ||
141 | # ../db-5.3.28/src/mutex/mut_tas.c:150:34: error: unknown directive | 142 | # ../db-5.3.28/src/mutex/mut_tas.c:150:34: error: unknown directive |
142 | #<inline asm>:9:2: note: instantiated into assembly here | 143 | #<inline asm>:9:2: note: instantiated into assembly here |
143 | # .force_thumb | 144 | # .force_thumb |
@@ -211,8 +212,8 @@ TUNE_CCARGS_remove_pn-omxplayer_toolchain-clang = "-no-integrated-as" | |||
211 | 212 | ||
212 | #| /usr/src/debug/ruby/2.5.1-r0/build/../ruby-2.5.1/process.c:7073: undefined reference to `__mulodi4' | 213 | #| /usr/src/debug/ruby/2.5.1-r0/build/../ruby-2.5.1/process.c:7073: undefined reference to `__mulodi4' |
213 | #| clang-7: error: linker command failed with exit code 1 (use -v to see invocation) | 214 | #| clang-7: error: linker command failed with exit code 1 (use -v to see invocation) |
214 | LDFLAGS_append_pn-ruby_toolchain-clang = " -rtlib=compiler-rt" | 215 | LDFLAGS_append_pn-ruby_toolchain-clang = "${@bb.utils.contains('COMPILER_RT', '--rtlib=compiler-rt', ' -rtlib=compiler-rt', '', d)}" |
215 | LDFLAGS_append_pn-m4_toolchain-clang = " -rtlib=compiler-rt" | 216 | LDFLAGS_append_pn-m4_toolchain-clang = "${@bb.utils.contains('COMPILER_RT', '--rtlib=compiler-rt', ' -rtlib=compiler-rt', '', d)}" |
216 | LDFLAGS_remove_pn-m4_powerpc = "-rtlib=compiler-rt" | 217 | LDFLAGS_remove_pn-m4_powerpc = "-rtlib=compiler-rt" |
217 | 218 | ||
218 | LDFLAGS_append_pn-gnutls_toolchain-clang_riscv64 = " -latomic" | 219 | LDFLAGS_append_pn-gnutls_toolchain-clang_riscv64 = " -latomic" |