[clang] 4981a18 - [Driver][Fuchsia] Make -mfix-cortex-a53-835769 default when targeting Fuchsia
Alex Brachet via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 25 12:18:22 PDT 2022
Author: Alex Brachet
Date: 2022-10-25T19:17:52Z
New Revision: 4981a186b3aa5fbe207dce4902d4dce504974f3f
URL: https://github.com/llvm/llvm-project/commit/4981a186b3aa5fbe207dce4902d4dce504974f3f
DIFF: https://github.com/llvm/llvm-project/commit/4981a186b3aa5fbe207dce4902d4dce504974f3f.diff
LOG: [Driver][Fuchsia] Make -mfix-cortex-a53-835769 default when targeting Fuchsia
Differential Revision: https://reviews.llvm.org/D136703
Added:
Modified:
clang/lib/Driver/ToolChains/Arch/AArch64.cpp
clang/test/Driver/aarch64-fix-cortex-a53-835769.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index 7956a0be46280..514db4ca4f7e3 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "AArch64.h"
+#include "../CommonArgs.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Driver/Options.h"
@@ -615,6 +616,10 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
} else if (Triple.isAndroid()) {
// Enabled A53 errata (835769) workaround by default on android
Features.push_back("+fix-cortex-a53-835769");
+ } else if (Triple.isOSFuchsia()) {
+ std::string CPU = getCPUName(D, Args, Triple);
+ if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53")
+ Features.push_back("+fix-cortex-a53-835769");
}
if (Args.getLastArg(options::OPT_mno_bti_at_return_twice))
diff --git a/clang/test/Driver/aarch64-fix-cortex-a53-835769.c b/clang/test/Driver/aarch64-fix-cortex-a53-835769.c
index 287d9bcd5797e..7e809866fc502 100644
--- a/clang/test/Driver/aarch64-fix-cortex-a53-835769.c
+++ b/clang/test/Driver/aarch64-fix-cortex-a53-835769.c
@@ -8,6 +8,12 @@
// RUN: %clang -target aarch64-android-eabi %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-YES %s
+// RUN: %clang --target=aarch64-fuchsia %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-YES %s
+
+// RUN: %clang --target=aarch64-fuchsia -mcpu=cortex-a73 %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-DEF %s
+
// CHECK-DEF-NOT: "{[+-]}fix-cortex-a53-835769"
// CHECK-YES: "+fix-cortex-a53-835769"
// CHECK-NO: "-fix-cortex-a53-835769"
More information about the cfe-commits
mailing list