[clang] 7f0e741 - [Driver] Pass --fix-cortex-a53-843419 automatically on Fuchsia
Petr Hosek via cfe-commits
cfe-commits at lists.llvm.org
Fri May 6 13:27:20 PDT 2022
Author: Petr Hosek
Date: 2022-05-06T13:27:10-07:00
New Revision: 7f0e741db97c64b4a566d65b878c2e0fe4dabb38
URL: https://github.com/llvm/llvm-project/commit/7f0e741db97c64b4a566d65b878c2e0fe4dabb38
DIFF: https://github.com/llvm/llvm-project/commit/7f0e741db97c64b4a566d65b878c2e0fe4dabb38.diff
LOG: [Driver] Pass --fix-cortex-a53-843419 automatically on Fuchsia
When targeting cortex-a53, set this linker flag rather than relying
on the toolchain users to do it in their build.
Differential Revision: https://reviews.llvm.org/D114023
Added:
Modified:
clang/lib/Driver/ToolChains/Fuchsia.cpp
clang/test/Driver/fuchsia.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index 6fe6f7f82feb..e81c40c74fdb 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -37,6 +37,8 @@ void fuchsia::Linker::ConstructJob(Compilation &C, const JobAction &JA,
static_cast<const toolchains::Fuchsia &>(getToolChain());
const Driver &D = ToolChain.getDriver();
+ const llvm::Triple &Triple = ToolChain.getEffectiveTriple();
+
ArgStringList CmdArgs;
// Silence warning for "clang -g foo.o -o foo"
@@ -84,6 +86,12 @@ void fuchsia::Linker::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("--hash-style=gnu");
}
+ if (ToolChain.getArch() == llvm::Triple::aarch64) {
+ std::string CPU = getCPUName(D, Args, Triple);
+ if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53")
+ CmdArgs.push_back("--fix-cortex-a53-843419");
+ }
+
CmdArgs.push_back("--eh-frame-hdr");
if (Args.hasArg(options::OPT_static))
diff --git a/clang/test/Driver/fuchsia.c b/clang/test/Driver/fuchsia.c
index 888f6b1a2c4b..024c029e0e0c 100644
--- a/clang/test/Driver/fuchsia.c
+++ b/clang/test/Driver/fuchsia.c
@@ -41,6 +41,7 @@
// CHECK: "-pie"
// CHECK: "--build-id"
// CHECK: "--hash-style=gnu"
+// CHECK-AARCH64: "--fix-cortex-a53-843419"
// CHECK: "-dynamic-linker" "ld.so.1"
// CHECK: Scrt1.o
// CHECK-NOT: crti.o
More information about the cfe-commits
mailing list