From f96e80ca460004faecb9bdd36f7458799ddf0295 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 4 Dec 2019 11:44:24 -0600 Subject: clang: Fix multilib clang compile failing if lib is in the toolchain path Signed-off-by: Michael Davis Signed-off-by: Khem Raj --- .../0025-llvm-Let-llvm-ar-name-contain-lib.patch | 44 ++++++++++++++++++++++ recipes-devtools/clang/common.inc | 1 + 2 files changed, 45 insertions(+) create mode 100644 recipes-devtools/clang/clang/0025-llvm-Let-llvm-ar-name-contain-lib.patch diff --git a/recipes-devtools/clang/clang/0025-llvm-Let-llvm-ar-name-contain-lib.patch b/recipes-devtools/clang/clang/0025-llvm-Let-llvm-ar-name-contain-lib.patch new file mode 100644 index 0000000..5edf8ad --- /dev/null +++ b/recipes-devtools/clang/clang/0025-llvm-Let-llvm-ar-name-contain-lib.patch @@ -0,0 +1,44 @@ +From fa44b5037ceac5d201b5ab0395ec9c5b928f79bf Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 4 Dec 2019 11:50:09 -0800 +Subject: [PATCH] llvm: Let llvm-ar name contain 'lib' + +In cross-compile cases canonical names are created using symlinks but +they fail to execute because the name confuses 'lib' instead of toolname + +In multilib(lib32) case, the arm-pokymllib32-linux-gnueabi-llvm-ar (${TARGET_PREFIX}llvm-ar) gives: +qc: no such file or directory + +Which is because when the llvm-ar symbol link's name contains "lib", it would be considered as llvm-lib: + +Signed-off-by: Michael Davis +Signed-off-by: Khem Raj +--- + llvm/tools/llvm-ar/llvm-ar.cpp | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp +index 91746d0fab3..daef39ede79 100644 +--- a/llvm/tools/llvm-ar/llvm-ar.cpp ++++ b/llvm/tools/llvm-ar/llvm-ar.cpp +@@ -1125,16 +1125,16 @@ int main(int argc, char **argv) { + llvm::InitializeAllAsmParsers(); + + Stem = sys::path::stem(ToolName); +- if (Stem.contains_lower("dlltool")) ++ if (Stem.endswith("dlltool") || Stem.contains("dlltool-")) + return dlltoolDriverMain(makeArrayRef(argv, argc)); + +- if (Stem.contains_lower("ranlib")) ++ if (Stem.endswith("ranlib") || Stem.contains("ranlib-")) + return ranlib_main(argc, argv); + +- if (Stem.contains_lower("lib")) ++ if (Stem.endswith("lib") || Stem.contains("lib-")) + return libDriverMain(makeArrayRef(argv, argc)); + +- if (Stem.contains_lower("ar")) ++ if (Stem.endswith("ar") || Stem.contains("ar-")) + return ar_main(argc, argv); + fail("Not ranlib, ar, lib or dlltool!"); + } diff --git a/recipes-devtools/clang/common.inc b/recipes-devtools/clang/common.inc index 3f50fd0..c5e8d48 100644 --- a/recipes-devtools/clang/common.inc +++ b/recipes-devtools/clang/common.inc @@ -32,6 +32,7 @@ SRC_URI = "\ file://0022-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch \ file://0023-openmp-Recognise-ARMv7ve-machine-arch.patch \ file://0024-Check-for-atomic-double-intrinsics.patch \ + file://0025-llvm-Let-llvm-ar-name-contain-lib.patch \ " # Fallback to no-PIE if not set -- cgit v1.2.3-54-g00ecf