Skip to content

Commit 7f0e741

Browse files
committed
[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
1 parent 6a9c102 commit 7f0e741

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

clang/lib/Driver/ToolChains/Fuchsia.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ void fuchsia::Linker::ConstructJob(Compilation &C, const JobAction &JA,
3737
static_cast<const toolchains::Fuchsia &>(getToolChain());
3838
const Driver &D = ToolChain.getDriver();
3939

40+
const llvm::Triple &Triple = ToolChain.getEffectiveTriple();
41+
4042
ArgStringList CmdArgs;
4143

4244
// Silence warning for "clang -g foo.o -o foo"
@@ -84,6 +86,12 @@ void fuchsia::Linker::ConstructJob(Compilation &C, const JobAction &JA,
8486
CmdArgs.push_back("--hash-style=gnu");
8587
}
8688

89+
if (ToolChain.getArch() == llvm::Triple::aarch64) {
90+
std::string CPU = getCPUName(D, Args, Triple);
91+
if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53")
92+
CmdArgs.push_back("--fix-cortex-a53-843419");
93+
}
94+
8795
CmdArgs.push_back("--eh-frame-hdr");
8896

8997
if (Args.hasArg(options::OPT_static))

clang/test/Driver/fuchsia.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
// CHECK: "-pie"
4242
// CHECK: "--build-id"
4343
// CHECK: "--hash-style=gnu"
44+
// CHECK-AARCH64: "--fix-cortex-a53-843419"
4445
// CHECK: "-dynamic-linker" "ld.so.1"
4546
// CHECK: Scrt1.o
4647
// CHECK-NOT: crti.o

0 commit comments

Comments
 (0)