Skip to content

Commit 3cec71e

Browse files
committed
Triple::normalize: Use none as OS for XX-none-ABI
When parsing a 3-component triple, after we determine Arch and Env, if the middle component is "none", treat it as OS instead of Vendor. Fixes: #89582.
1 parent e04df69 commit 3cec71e

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

clang/docs/Multilib.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ For a more comprehensive example see
188188
- Dir: thumb/v6-m
189189
# List of one or more normalized command line options, as generated by Clang
190190
# from the command line options or from Mappings below.
191-
# Here, if the flags are a superset of {target=thumbv6m-none-unknown-eabi}
191+
# Here, if the flags are a superset of {target=thumbv6m-unknown-none-eabi}
192192
# then this multilib variant will be considered a match.
193-
Flags: [--target=thumbv6m-none-unknown-eabi]
193+
Flags: [--target=thumbv6m-unknown-none-eabi]
194194
195195
# Similarly, a multilib variant targeting Arm v7-M with an FPU (floating
196196
# point unit).

libcxx/utils/ci/run-buildbot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ function test-armv7m-picolibc() {
217217
"${@}"
218218

219219
${NINJA} -vC "${BUILD_DIR}/compiler-rt" install
220-
mv "${BUILD_DIR}/install/lib/armv7m-none-unknown-eabi"/* "${BUILD_DIR}/install/lib"
220+
mv "${BUILD_DIR}/install/lib/armv7m-unknown-none-eabi"/* "${BUILD_DIR}/install/lib"
221221

222222
check-runtimes
223223
}

llvm/lib/TargetParser/Triple.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,12 @@ std::string Triple::normalize(StringRef Str) {
11511151
}
11521152
}
11531153

1154+
// If "none" is in the middle component in a three-component triple, treat it
1155+
// as the OS (Components[2]) instead of the vendor (Components[1]).
1156+
if (Found[0] && !Found[1] && !Found[2] && Found[3] &&
1157+
Components[1] == "none" && Components[2].empty())
1158+
std::swap(Components[1], Components[2]);
1159+
11541160
// Replace empty components with "unknown" value.
11551161
for (StringRef &C : Components)
11561162
if (C.empty())

0 commit comments

Comments
 (0)