diff options
author | Khem Raj <raj.khem@gmail.com> | 2019-12-10 16:09:16 -0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2019-12-26 10:59:39 -0800 |
commit | 180d86ec4714b63b661dfc3f21f50076f0cf5082 (patch) | |
tree | 702705068f79f68791c04d4525c7e023a8457127 /recipes-devtools | |
parent | 345cf557f00ddd17d345dd2ce7d49075ec4c2305 (diff) | |
download | meta-clang-180d86ec4714b63b661dfc3f21f50076f0cf5082.tar.gz |
clang: Update tool rename patch to match upstream one
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'recipes-devtools')
-rw-r--r-- | recipes-devtools/clang/clang/0025-llvm-Let-llvm-ar-name-contain-lib.patch | 136 |
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 @@ | |||
1 | From fa44b5037ceac5d201b5ab0395ec9c5b928f79bf Mon Sep 17 00:00:00 2001 | 1 | From e709fa8c221d21bce717b22fa4076c94d51f011e Mon Sep 17 00:00:00 2001 |
2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Fangrui Song <maskray@google.com> |
3 | Date: Wed, 4 Dec 2019 11:50:09 -0800 | 3 | Date: Tue, 10 Dec 2019 15:56:05 -0800 |
4 | Subject: [PATCH] llvm: Let llvm-ar name contain 'lib' | 4 | Subject: [PATCH] llvm: Let llvm-ar name contain 'lib' |
5 | 5 | ||
6 | In cross-compile cases canonical names are created using symlinks but | 6 | In cross-compile cases canonical names are created using symlinks but |
@@ -11,34 +11,140 @@ qc: no such file or directory | |||
11 | 11 | ||
12 | Which is because when the llvm-ar symbol link's name contains "lib", it would be considered as llvm-lib: | 12 | Which is because when the llvm-ar symbol link's name contains "lib", it would be considered as llvm-lib: |
13 | 13 | ||
14 | Signed-off-by: Michael Davis <michael.davis@essvote.com> | 14 | Signed-off-by: Fangrui Song <maskray@google.com> |
15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 15 | Signed-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 | ||
28 | diff --git a/llvm/test/tools/llvm-ar/tool-name.test b/llvm/test/tools/llvm-ar/tool-name.test | ||
29 | new file mode 100644 | ||
30 | index 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 | ||
49 | diff --git a/llvm/test/tools/llvm-dlltool/tool-name.test b/llvm/test/tools/llvm-dlltool/tool-name.test | ||
50 | new file mode 100644 | ||
51 | index 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 | ||
68 | diff --git a/llvm/test/tools/llvm-lib/tool-name.test b/llvm/test/tools/llvm-lib/tool-name.test | ||
69 | new file mode 100644 | ||
70 | index 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 | ||
88 | diff --git a/llvm/test/tools/llvm-ranlib/tool-name.test b/llvm/test/tools/llvm-ranlib/tool-name.test | ||
89 | new file mode 100644 | ||
90 | index 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 | ||
20 | diff --git a/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp | 107 | diff --git a/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp |
21 | index 91746d0fab3..daef39ede79 100644 | 108 | index 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 | } |