Index: clang/lib/Driver/ToolChains/Arch/AArch64.cpp =================================================================== --- clang/lib/Driver/ToolChains/Arch/AArch64.cpp +++ 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 @@ } 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)) Index: clang/test/Driver/aarch64-fix-cortex-a53-835769.c =================================================================== --- clang/test/Driver/aarch64-fix-cortex-a53-835769.c +++ 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"