summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2021-03-23 09:19:06 -0700
committerKhem Raj <raj.khem@gmail.com>2021-03-24 07:51:52 -0700
commit539e8d85f4eb359d24b052efc6d4f7a9858fdbce (patch)
tree715d7175b602d02cec0c880e08e4675b76a08314
parente8a0bada69637ff7a767d387b803a42123aead0b (diff)
downloadmeta-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>
-rw-r--r--README.md34
-rw-r--r--recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch7
-rw-r--r--recipes-devtools/clang/clang/0029-llvm-Recognize-yoe-and-poky-as-OE-distro.patch13
-rw-r--r--recipes-devtools/clang/llvm-project-source.inc17
4 files changed, 65 insertions, 6 deletions
diff --git a/README.md b/README.md
index 1ee28ae..826b8b3 100644
--- a/README.md
+++ b/README.md
@@ -130,6 +130,40 @@ if a component does not build with libc++, you can add it to `conf/nonclangable.
130CXX_remove_pn-<recipe>_toolchain-clang = " -stdlib=libc++ " 130CXX_remove_pn-<recipe>_toolchain-clang = " -stdlib=libc++ "
131``` 131```
132 132
133# compiler-rt failing in do_configure with custom TARGET_VENDOR
134
135If your DISTRO sets own value of TARGET_VENDOR, then it's need to be added in
136CLANG_EXTRA_OE_VENDORS, it should be done automatically, but if compiler-rt fails
137like bellow, then check the end of work-shared/llvm-project-source-12.0.0-r0/temp/log.do_patch
138is should have line like:
139NOTE: 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
142and check these files if //CLANG_EXTRA_OE_VENDORS* strings were replaced correctly.
143Read add_more_target_vendors function in recipes-devtools/clang/llvm-project-source.inc for more details.
144
145http://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
152CMake 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
44is different between clang and clang-native 44is different between clang and clang-native
45 45
46The //CLANG_EXTRA_OE_VENDORS_TRIPLES string is replaced with list of
47additional triples based on CLANG_EXTRA_OE_VENDORS variable in
48recipes-devtools/clang/llvm-project-source.inc:add_more_target_vendors()
49
46Upstream-Status: Inappropriate [oe specific] 50Upstream-Status: Inappropriate [oe specific]
47 51
52Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
48Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> 53Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
49Signed-off-by: Khem Raj <raj.khem@gmail.com> 54Signed-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
6This helps in making right detection for OE built gcc toolchains 6This helps in making right detection for OE built gcc toolchains
7 7
8The //CLANG_EXTRA_OE_VENDORS_CASES string is replaced with list of
9additional Ceses based on CLANG_EXTRA_OE_VENDORS variable in
10recipes-devtools/clang/llvm-project-source.inc:add_more_target_vendors()
11
8Signed-off-by: Khem Raj <raj.khem@gmail.com> 12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
9 14
10Add wrs 15Add wrs
11Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com> 16Signed-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
17index 4f483c965282..abd181759786 100644 22index 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}-*"
18INHIBIT_DEFAULT_DEPS = "1" 18INHIBIT_DEFAULT_DEPS = "1"
19DEPENDS = "" 19DEPENDS = ""
20PACKAGES = "" 20PACKAGES = ""
21
22# additional TARGET_VENDOR values we want to support
23CLANG_EXTRA_OE_VENDORS ?= "${TARGET_VENDOR}"
24
25add_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
37do_patch[postfuncs] += "add_more_target_vendors"