[PATCH] D93585: [AArch64][Clang][Linux] Enable out-of-line atomics by default.
Pavel Iliin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 20 05:30:40 PST 2021
ilinpv updated this revision to Diff 317849.
ilinpv retitled this revision from "[AArch64] Enable out-of-line atomics by default." to "[AArch64][Clang][Linux] Enable out-of-line atomics by default.".
ilinpv edited the summary of this revision.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93585/new/
https://reviews.llvm.org/D93585
Files:
clang/include/clang/Driver/ToolChain.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/Linux.cpp
clang/lib/Driver/ToolChains/Linux.h
Index: clang/lib/Driver/ToolChains/Linux.h
===================================================================
--- clang/lib/Driver/ToolChains/Linux.h
+++ clang/lib/Driver/ToolChains/Linux.h
@@ -36,6 +36,8 @@
void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const override;
CXXStdlibType GetDefaultCXXStdlibType() const override;
+ bool
+ IsAArch64OutlineAtomicsDefault(const llvm::opt::ArgList &Args) const override;
bool isPIEDefault() const override;
bool isNoExecStackDefault() const override;
bool IsMathErrnoDefault() const override;
Index: clang/lib/Driver/ToolChains/Linux.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Linux.cpp
+++ clang/lib/Driver/ToolChains/Linux.cpp
@@ -836,6 +836,21 @@
getTriple().isMusl() || getSanitizerArgs().requiresPIE();
}
+bool Linux::IsAArch64OutlineAtomicsDefault(const ArgList &Args) const {
+ if (!getTriple().isAArch64())
+ return false;
+ // Outline atomics for AArch64 are supported by compiler-rt
+ // and libgcc since 9.3.1
+ if (GetRuntimeLibType(Args) == ToolChain::RLT_Libgcc) {
+ const GCCVersion &Ver = GCCInstallation.getVersion();
+ if (Ver.isOlderThan(9, 3, 1))
+ return false;
+ } else if (GetRuntimeLibType(Args) != ToolChain::RLT_CompilerRT) {
+ return false;
+ }
+ return true;
+}
+
bool Linux::isNoExecStackDefault() const {
return getTriple().isAndroid();
}
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -6441,6 +6441,12 @@
CmdArgs.push_back("-target-feature");
CmdArgs.push_back("-outline-atomics");
}
+ } else {
+ if (Triple.isAArch64() &&
+ getToolChain().IsAArch64OutlineAtomicsDefault(Args)) {
+ CmdArgs.push_back("-target-feature");
+ CmdArgs.push_back("+outline-atomics");
+ }
}
if (Args.hasFlag(options::OPT_faddrsig, options::OPT_fno_addrsig,
Index: clang/include/clang/Driver/ToolChain.h
===================================================================
--- clang/include/clang/Driver/ToolChain.h
+++ clang/include/clang/Driver/ToolChain.h
@@ -456,6 +456,12 @@
/// by default.
virtual bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const;
+ /// Test whether this toolchain supports outline atomics by default.
+ virtual bool
+ IsAArch64OutlineAtomicsDefault(const llvm::opt::ArgList &Args) const {
+ return false;
+ }
+
/// Test whether this toolchain defaults to PIC.
virtual bool isPICDefault() const = 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93585.317849.patch
Type: text/x-patch
Size: 2718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210120/b4462ddc/attachment-0001.bin>
More information about the cfe-commits
mailing list