diff options
author | Martin Jansa <Martin.Jansa@gmail.com> | 2021-03-23 09:19:06 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2021-03-24 07:51:52 -0700 |
commit | 539e8d85f4eb359d24b052efc6d4f7a9858fdbce (patch) | |
tree | 715d7175b602d02cec0c880e08e4675b76a08314 | |
parent | e8a0bada69637ff7a767d387b803a42123aead0b (diff) | |
download | meta-clang-539e8d85f4eb359d24b052efc6d4f7a9858fdbce.tar.gz |
clang: allow to set CLANG_EXTRA_OE_VENDORS to support custom TARGET_VENDOR value
* instead of hardcoding only yoe, poky, wrs in the patch, add just placeholder
string which gets replaced with a list based on CLANG_EXTRA_OE_VENDORS variable
in llvm-project-source.inc:add_more_target_vendors
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
4 files changed, 65 insertions, 6 deletions
@@ -130,6 +130,40 @@ if a component does not build with libc++, you can add it to `conf/nonclangable. | |||
130 | CXX_remove_pn-<recipe>_toolchain-clang = " -stdlib=libc++ " | 130 | CXX_remove_pn-<recipe>_toolchain-clang = " -stdlib=libc++ " |
131 | ``` | 131 | ``` |
132 | 132 | ||
133 | # compiler-rt failing in do_configure with custom TARGET_VENDOR | ||
134 | |||
135 | If your DISTRO sets own value of TARGET_VENDOR, then it's need to be added in | ||
136 | CLANG_EXTRA_OE_VENDORS, it should be done automatically, but if compiler-rt fails | ||
137 | like bellow, then check the end of work-shared/llvm-project-source-12.0.0-r0/temp/log.do_patch | ||
138 | is should have line like: | ||
139 | NOTE: Adding support following TARGET_VENDOR values: foo in | ||
140 | /OE/build/oe-core/tmp-glibc/work-shared/llvm-project-source-12.0.0-r0/git/llvm/lib/Support/Triple.cpp and | ||
141 | /OE/build/oe-core/tmp-glibc/work-shared/llvm-project-source-12.0.0-r0/git/clang/lib/Driver/ToolChains/Gnu.cpp | ||
142 | and check these files if //CLANG_EXTRA_OE_VENDORS* strings were replaced correctly. | ||
143 | Read add_more_target_vendors function in recipes-devtools/clang/llvm-project-source.inc for more details. | ||
144 | |||
145 | http://errors.yoctoproject.org/Errors/Details/574365/ | ||
146 | ```shell | ||
147 | -- Found assembler: TOPDIR/tmp-glibc/work/core2-64-foo-linux/compiler-rt/12.0.0-r0/recipe-sysroot-native/usr/bin/x86_64-foo-linux/x86_64-foo-linux-clang | ||
148 | -- Detecting C compiler ABI info | ||
149 | -- Detecting C compiler ABI info - failed | ||
150 | -- Check for working C compiler: TOPDIR/tmp-glibc/work/core2-64-foo-linux/compiler-rt/12.0.0-r0/recipe-sysroot-native/usr/bin/x86_64-foo-linux/x86_64-foo-linux-clang | ||
151 | -- Check for working C compiler: TOPDIR/tmp-glibc/work/core2-64-foo-linux/compiler-rt/12.0.0-r0/recipe-sysroot-native/usr/bin/x86_64-foo-linux/x86_64-foo-linux-clang - broken | ||
152 | CMake Error at TOPDIR/tmp-glibc/work/core2-64-foo-linux/compiler-rt/12.0.0-r0/recipe-sysroot-native/usr/share/cmake-3.19/Modules/CMakeTestCCompiler.cmake:66 (message): | ||
153 | The C compiler | ||
154 | |||
155 | "TOPDIR/tmp-glibc/work/core2-64-foo-linux/compiler-rt/12.0.0-r0/recipe-sysroot-native/usr/bin/x86_64-foo-linux/x86_64-foo-linux-clang" | ||
156 | |||
157 | is not able to compile a simple test program. | ||
158 | |||
159 | It fails with the following output: | ||
160 | |||
161 | Change Dir: TOPDIR/tmp-glibc/work/core2-64-foo-linux/compiler-rt/12.0.0-r0/build/CMakeFiles/CMakeTmp | ||
162 | |||
163 | Run Build Command(s):ninja cmTC_928f4 && [1/2] Building C object CMakeFiles/cmTC_928f4.dir/testCCompiler.c.o | ||
164 | [2/2] Linking C executable cmTC_928f4 | ||
165 | ``` | ||
166 | |||
133 | # Dependencies | 167 | # Dependencies |
134 | 168 | ||
135 | ```shell | 169 | ```shell |
diff --git a/recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch b/recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch index 03bc290..dd4317f 100644 --- a/recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch +++ b/recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch | |||
@@ -43,8 +43,13 @@ BTW, it is hardly to insert a triple by the replacement of TARGET_SYS | |||
43 | (=${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}), since TARGET_VENDOR | 43 | (=${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}), since TARGET_VENDOR |
44 | is different between clang and clang-native | 44 | is different between clang and clang-native |
45 | 45 | ||
46 | The //CLANG_EXTRA_OE_VENDORS_TRIPLES string is replaced with list of | ||
47 | additional triples based on CLANG_EXTRA_OE_VENDORS variable in | ||
48 | recipes-devtools/clang/llvm-project-source.inc:add_more_target_vendors() | ||
49 | |||
46 | Upstream-Status: Inappropriate [oe specific] | 50 | Upstream-Status: Inappropriate [oe specific] |
47 | 51 | ||
52 | Signed-off-by: Martin Jansa <martin.jansa@gmail.com> | ||
48 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | 53 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> |
49 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 54 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
50 | --- | 55 | --- |
@@ -59,7 +64,7 @@ index 05d1d3003881..e56812145e6d 100644 | |||
59 | "x86_64-redhat-linux", "x86_64-suse-linux", | 64 | "x86_64-redhat-linux", "x86_64-suse-linux", |
60 | "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", | 65 | "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", |
61 | "x86_64-slackware-linux", "x86_64-unknown-linux", | 66 | "x86_64-slackware-linux", "x86_64-unknown-linux", |
62 | + "x86_64-oe-linux", "x86_64-poky-linux", "x86_64-wrs-linux", | 67 | + "x86_64-oe-linux", //CLANG_EXTRA_OE_VENDORS_TRIPLES |
63 | "x86_64-amazon-linux", "x86_64-linux-android"}; | 68 | "x86_64-amazon-linux", "x86_64-linux-android"}; |
64 | static const char *const X32LibDirs[] = {"/libx32"}; | 69 | static const char *const X32LibDirs[] = {"/libx32"}; |
65 | static const char *const X86LibDirs[] = {"/lib32", "/lib"}; | 70 | static const char *const X86LibDirs[] = {"/lib32", "/lib"}; |
diff --git a/recipes-devtools/clang/clang/0029-llvm-Recognize-yoe-and-poky-as-OE-distro.patch b/recipes-devtools/clang/clang/0029-llvm-Recognize-yoe-and-poky-as-OE-distro.patch index 16bc8be..5e4bc95 100644 --- a/recipes-devtools/clang/clang/0029-llvm-Recognize-yoe-and-poky-as-OE-distro.patch +++ b/recipes-devtools/clang/clang/0029-llvm-Recognize-yoe-and-poky-as-OE-distro.patch | |||
@@ -5,7 +5,12 @@ Subject: [PATCH] llvm: Recognize yoe and poky as OE distro | |||
5 | 5 | ||
6 | This helps in making right detection for OE built gcc toolchains | 6 | This helps in making right detection for OE built gcc toolchains |
7 | 7 | ||
8 | The //CLANG_EXTRA_OE_VENDORS_CASES string is replaced with list of | ||
9 | additional Ceses based on CLANG_EXTRA_OE_VENDORS variable in | ||
10 | recipes-devtools/clang/llvm-project-source.inc:add_more_target_vendors() | ||
11 | |||
8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
13 | Signed-off-by: Martin Jansa <martin.jansa@gmail.com> | ||
9 | 14 | ||
10 | Add wrs | 15 | Add wrs |
11 | Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com> | 16 | Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com> |
@@ -17,13 +22,11 @@ diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp | |||
17 | index 4f483c965282..abd181759786 100644 | 22 | index 4f483c965282..abd181759786 100644 |
18 | --- a/llvm/lib/Support/Triple.cpp | 23 | --- a/llvm/lib/Support/Triple.cpp |
19 | +++ b/llvm/lib/Support/Triple.cpp | 24 | +++ b/llvm/lib/Support/Triple.cpp |
20 | @@ -490,6 +490,9 @@ static Triple::VendorType parseVendor(StringRef VendorName) { | 25 | @@ -490,6 +490,6 @@ static Triple::VendorType parseVendor(StringRef VendorName) { |
21 | .Case("mesa", Triple::Mesa) | 26 | .Case("mesa", Triple::Mesa) |
22 | .Case("suse", Triple::SUSE) | 27 | .Case("suse", Triple::SUSE) |
23 | .Case("oe", Triple::OpenEmbedded) | 28 | - .Case("oe", Triple::OpenEmbedded) |
24 | + .Case("yoe", Triple::OpenEmbedded) | 29 | + .Case("oe", Triple::OpenEmbedded)//CLANG_EXTRA_OE_VENDORS_CASES |
25 | + .Case("poky", Triple::OpenEmbedded) | ||
26 | + .Case("wrs", Triple::OpenEmbedded) | ||
27 | .Default(Triple::UnknownVendor); | 30 | .Default(Triple::UnknownVendor); |
28 | } | 31 | } |
29 | 32 | ||
diff --git a/recipes-devtools/clang/llvm-project-source.inc b/recipes-devtools/clang/llvm-project-source.inc index f6c552d..c954f4e 100644 --- a/recipes-devtools/clang/llvm-project-source.inc +++ b/recipes-devtools/clang/llvm-project-source.inc | |||
@@ -18,3 +18,20 @@ STAMPCLEAN = "${STAMPS_DIR}/work-shared/llvm-project-source-${PV}-*" | |||
18 | INHIBIT_DEFAULT_DEPS = "1" | 18 | INHIBIT_DEFAULT_DEPS = "1" |
19 | DEPENDS = "" | 19 | DEPENDS = "" |
20 | PACKAGES = "" | 20 | PACKAGES = "" |
21 | |||
22 | # additional TARGET_VENDOR values we want to support | ||
23 | CLANG_EXTRA_OE_VENDORS ?= "${TARGET_VENDOR}" | ||
24 | |||
25 | add_more_target_vendors() { | ||
26 | local cases="" triples="" | ||
27 | for dash_vendor in ${CLANG_EXTRA_OE_VENDORS}; do | ||
28 | vendor=`echo $dash_vendor | sed 's/^-//g'` | ||
29 | cases="$cases.Case(\"$vendor\", Triple::OpenEmbedded)" | ||
30 | triples="$triples\"x86_64-$vendor-linux\"," | ||
31 | done | ||
32 | bbnote "Adding support following TARGET_VENDOR values: ${CLANG_EXTRA_OE_VENDORS} in ${S}/llvm/lib/Support/Triple.cpp and ${S}/clang/lib/Driver/ToolChains/Gnu.cpp" | ||
33 | sed "s#//CLANG_EXTRA_OE_VENDORS_CASES#$cases#g" -i ${S}/llvm/lib/Support/Triple.cpp | ||
34 | sed "s#//CLANG_EXTRA_OE_VENDORS_TRIPLES#$triples#g" -i ${S}/clang/lib/Driver/ToolChains/Gnu.cpp | ||
35 | } | ||
36 | |||
37 | do_patch[postfuncs] += "add_more_target_vendors" | ||