[PATCH] D159398: [AArch64][Clang] Disable out-of-line atomics in ffreestanding env
Vladislav Khmelevsky via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 2 01:56:22 PDT 2023
yota9 created this revision.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
yota9 requested review of this revision.
Herald added subscribers: cfe-commits, wangpc, MaskRay.
Herald added a project: clang.
In freestanding environment we don't want extra dependencies on the helpers
that implements atomic operations. So don't enable out-of-line atomics in
this situation.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D159398
Files:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/aarch64-features.c
Index: clang/test/Driver/aarch64-features.c
===================================================================
--- clang/test/Driver/aarch64-features.c
+++ clang/test/Driver/aarch64-features.c
@@ -32,6 +32,12 @@
// RUN: %clang --target=arm64-unknown-linux -rtlib=compiler-rt \
// RUN: -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-OUTLINE-ATOMICS-ON %s
+// RUN: %clang --target=aarch64-linux-gnu -rtlib=compiler-rt -ffreestanding \
+// RUN: -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-OUTLINE-ATOMICS-OFF %s
+
+// RUN: %clang --target=arm64-unknown-linux -rtlib=compiler-rt -ffreestanding \
+// RUN: -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-OUTLINE-ATOMICS-OFF %s
+
// RUN: %clang --target=aarch64 -rtlib=compiler-rt \
// RUN: -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-OUTLINE-ATOMICS-OFF %s
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -7494,7 +7494,7 @@
CmdArgs.push_back("-outline-atomics");
}
}
- } else if (Triple.isAArch64() &&
+ } else if (!Freestanding && Triple.isAArch64() &&
getToolChain().IsAArch64OutlineAtomicsDefault(Args)) {
CmdArgs.push_back("-target-feature");
CmdArgs.push_back("+outline-atomics");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159398.555569.patch
Type: text/x-patch
Size: 1348 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230902/279a8b43/attachment.bin>
More information about the cfe-commits
mailing list