summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2019-12-10 16:09:16 -0800
committerKhem Raj <raj.khem@gmail.com>2019-12-11 10:19:17 -0800
commit5883178e0daed5e668857864bfc1fda4f1856b62 (patch)
tree702705068f79f68791c04d4525c7e023a8457127
parentf0ddd47cf19eb97dce9e6eaa7a211fdb2f864082 (diff)
downloadmeta-clang-5883178e0daed5e668857864bfc1fda4f1856b62.tar.gz
clang: Update tool rename patch to match upstream one
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--recipes-devtools/clang/clang/0025-llvm-Let-llvm-ar-name-contain-lib.patch136
1 files changed, 121 insertions, 15 deletions
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
index 5edf8ad..0d5baab 100644
--- 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
@@ -1,6 +1,6 @@
1From fa44b5037ceac5d201b5ab0395ec9c5b928f79bf Mon Sep 17 00:00:00 2001 1From e709fa8c221d21bce717b22fa4076c94d51f011e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Fangrui Song <maskray@google.com>
3Date: Wed, 4 Dec 2019 11:50:09 -0800 3Date: Tue, 10 Dec 2019 15:56:05 -0800
4Subject: [PATCH] llvm: Let llvm-ar name contain 'lib' 4Subject: [PATCH] llvm: Let llvm-ar name contain 'lib'
5 5
6In cross-compile cases canonical names are created using symlinks but 6In cross-compile cases canonical names are created using symlinks but
@@ -11,34 +11,140 @@ qc: no such file or directory
11 11
12Which is because when the llvm-ar symbol link's name contains "lib", it would be considered as llvm-lib: 12Which is because when the llvm-ar symbol link's name contains "lib", it would be considered as llvm-lib:
13 13
14Signed-off-by: Michael Davis <michael.davis@essvote.com> 14Signed-off-by: Fangrui Song <maskray@google.com>
15Signed-off-by: Khem Raj <raj.khem@gmail.com> 15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16--- 16---
17 llvm/tools/llvm-ar/llvm-ar.cpp | 8 ++++---- 17 llvm/test/tools/llvm-ar/tool-name.test | 15 ++++++++++++++
18 1 file changed, 4 insertions(+), 4 deletions(-) 18 llvm/test/tools/llvm-dlltool/tool-name.test | 13 ++++++++++++
19 llvm/test/tools/llvm-lib/tool-name.test | 14 +++++++++++++
20 llvm/test/tools/llvm-ranlib/tool-name.test | 13 ++++++++++++
21 llvm/tools/llvm-ar/llvm-ar.cpp | 23 ++++++++++++++-------
22 5 files changed, 71 insertions(+), 7 deletions(-)
23 create mode 100644 llvm/test/tools/llvm-ar/tool-name.test
24 create mode 100644 llvm/test/tools/llvm-dlltool/tool-name.test
25 create mode 100644 llvm/test/tools/llvm-lib/tool-name.test
26 create mode 100644 llvm/test/tools/llvm-ranlib/tool-name.test
19 27
28diff --git a/llvm/test/tools/llvm-ar/tool-name.test b/llvm/test/tools/llvm-ar/tool-name.test
29new file mode 100644
30index 00000000000..cb656d3b47f
31--- /dev/null
32+++ b/llvm/test/tools/llvm-ar/tool-name.test
33@@ -0,0 +1,15 @@
34+## Don't make symlinks on Windows.
35+# UNSUPPORTED: system-windows
36+
37+# RUN: rm -rf %t
38+# RUN: mkdir %t
39+# RUN: ln -s llvm-ar %t/llvm-ar-9
40+# RUN: ln -s llvm-ar %t/ar.exe
41+# RUN: ln -s llvm-ar %t/arm-pokymllib32-linux-gnueabi-llvm-ar-9
42+
43+# RUN: llvm-ar h | FileCheck %s
44+# RUN: %t/llvm-ar-9 h | FileCheck %s
45+# RUN: %t/ar.exe h | FileCheck %s
46+# RUN: %t/arm-pokymllib32-linux-gnueabi-llvm-ar-9 h | FileCheck %s
47+
48+# CHECK: USAGE: llvm-ar
49diff --git a/llvm/test/tools/llvm-dlltool/tool-name.test b/llvm/test/tools/llvm-dlltool/tool-name.test
50new file mode 100644
51index 00000000000..e9d8680322d
52--- /dev/null
53+++ b/llvm/test/tools/llvm-dlltool/tool-name.test
54@@ -0,0 +1,13 @@
55+## Don't make symlinks on Windows.
56+# UNSUPPORTED: system-windows
57+
58+# RUN: rm -rf %t
59+# RUN: mkdir %t
60+# RUN: ln -s llvm-dlltool %t/dlltool.exe
61+# RUN: ln -s llvm-dlltool %t/dlltool-10
62+
63+# RUN: not llvm-dlltool 2>&1 | FileCheck %s
64+# RUN: not %t/dlltool.exe 2>&1 | FileCheck %s
65+# RUN: not %t/dlltool-10 2>&1 | FileCheck %s
66+
67+# CHECK: USAGE: llvm-dlltool
68diff --git a/llvm/test/tools/llvm-lib/tool-name.test b/llvm/test/tools/llvm-lib/tool-name.test
69new file mode 100644
70index 00000000000..9c0f7b5de73
71--- /dev/null
72+++ b/llvm/test/tools/llvm-lib/tool-name.test
73@@ -0,0 +1,14 @@
74+## Don't make symlinks on Windows.
75+# UNSUPPORTED: system-windows
76+
77+# RUN: rm -rf %t
78+# RUN: mkdir %t
79+## See D44808, MSBuild runs Lib.exe
80+# RUN: ln -s llvm-lib %t/Lib.exe
81+# RUN: ln -s llvm-lib %t/llvm-lib-10
82+
83+# RUN: llvm-lib '/?' | FileCheck %s
84+# RUN: %t/Lib.exe '/?' | FileCheck %s
85+# RUN: %t/llvm-lib-10 '/?' | FileCheck %s
86+
87+# CHECK: USAGE: llvm-lib
88diff --git a/llvm/test/tools/llvm-ranlib/tool-name.test b/llvm/test/tools/llvm-ranlib/tool-name.test
89new file mode 100644
90index 00000000000..bd2b4965331
91--- /dev/null
92+++ b/llvm/test/tools/llvm-ranlib/tool-name.test
93@@ -0,0 +1,13 @@
94+## Don't make symlinks on Windows.
95+# UNSUPPORTED: system-windows
96+
97+# RUN: rm -rf %t
98+# RUN: mkdir %t
99+# RUN: ln -s llvm-ranlib %t/llvm-ranlib-9
100+# RUN: ln -s llvm-ranlib %t/ranlib.exe
101+
102+# RUN: llvm-ranlib -h | FileCheck %s
103+# RUN: %t/llvm-ranlib-9 -h | FileCheck %s
104+# RUN: %t/ranlib.exe -h | FileCheck %s
105+
106+# CHECK: USAGE: llvm-ranlib
20diff --git a/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp 107diff --git a/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp
21index 91746d0fab3..daef39ede79 100644 108index 91746d0fab3..a7118371f1e 100644
22--- a/llvm/tools/llvm-ar/llvm-ar.cpp 109--- a/llvm/tools/llvm-ar/llvm-ar.cpp
23+++ b/llvm/tools/llvm-ar/llvm-ar.cpp 110+++ b/llvm/tools/llvm-ar/llvm-ar.cpp
24@@ -1125,16 +1125,16 @@ int main(int argc, char **argv) { 111@@ -11,6 +11,7 @@
112 //
113 //===----------------------------------------------------------------------===//
114
115+#include "llvm/ADT/StringExtras.h"
116 #include "llvm/ADT/StringSwitch.h"
117 #include "llvm/ADT/Triple.h"
118 #include "llvm/IR/LLVMContext.h"
119@@ -1125,16 +1126,24 @@ int main(int argc, char **argv) {
25 llvm::InitializeAllAsmParsers(); 120 llvm::InitializeAllAsmParsers();
26 121
27 Stem = sys::path::stem(ToolName); 122 Stem = sys::path::stem(ToolName);
28- if (Stem.contains_lower("dlltool")) 123- if (Stem.contains_lower("dlltool"))
29+ if (Stem.endswith("dlltool") || Stem.contains("dlltool-")) 124+ auto Is = [](StringRef Tool) {
125+ // We need to recognize the following filenames.
126+ //
127+ // Lib.exe -> lib (see D44808, MSBuild runs Lib.exe)
128+ // dlltool.exe -> dlltool
129+ // arm-pokymllib32-linux-gnueabi-llvm-ar-10 -> ar
130+ auto I = Stem.rfind_lower(Tool);
131+ return I != StringRef::npos &&
132+ (I + Tool.size() == Stem.size() || !isAlnum(Stem[I + Tool.size()]));
133+ };
134+
135+ if (Is("dlltool"))
30 return dlltoolDriverMain(makeArrayRef(argv, argc)); 136 return dlltoolDriverMain(makeArrayRef(argv, argc));
31 137-
32- if (Stem.contains_lower("ranlib")) 138- if (Stem.contains_lower("ranlib"))
33+ if (Stem.endswith("ranlib") || Stem.contains("ranlib-")) 139+ if (Is("ranlib"))
34 return ranlib_main(argc, argv); 140 return ranlib_main(argc, argv);
35 141-
36- if (Stem.contains_lower("lib")) 142- if (Stem.contains_lower("lib"))
37+ if (Stem.endswith("lib") || Stem.contains("lib-")) 143+ if (Is("lib"))
38 return libDriverMain(makeArrayRef(argv, argc)); 144 return libDriverMain(makeArrayRef(argv, argc));
39 145-
40- if (Stem.contains_lower("ar")) 146- if (Stem.contains_lower("ar"))
41+ if (Stem.endswith("ar") || Stem.contains("ar-")) 147+ if (Is("ar"))
42 return ar_main(argc, argv); 148 return ar_main(argc, argv);
43 fail("Not ranlib, ar, lib or dlltool!"); 149 fail("Not ranlib, ar, lib or dlltool!");
44 } 150 }