[PATCH] D114023: [Driver] Pass --fix-cortex-a53-843419 automatically on Fuchsia

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 16 12:56:26 PST 2021


phosek created this revision.
phosek added reviewers: mcgrathr, leonardchan.
Herald added a subscriber: abrachet.
phosek requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

When targeting cortex-a53, set this linker flag rather than relying
on the toolchain users to do it in their build.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114023

Files:
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/test/Driver/fuchsia.c


Index: clang/test/Driver/fuchsia.c
===================================================================
--- clang/test/Driver/fuchsia.c
+++ clang/test/Driver/fuchsia.c
@@ -40,6 +40,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
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -37,6 +37,8 @@
       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 @@
     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))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114023.387738.patch
Type: text/x-patch
Size: 1243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211116/beb6340d/attachment.bin>


More information about the cfe-commits mailing list