llvm-project/clang/test/Driver/android-link.cpp
Bryan Chan d4e2c0b359
[Driver] Add options to control workaround for Cortex-A53 Erratum 843419 (#143915)
Implement the -mfix-cortex-a53-843419 and -mno-fix-cortex-a53-843419 options,
which have been introduced to GCC to allow the user to control the workaround
for the erratum. If the option is enabled (which is the default, unchanged by
this patch), Clang passes --fix-cortex-a53-843419 to the linker when it cannot
ensure that the target is not a Cortex A53, otherwise it doesn't.

See https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html#index-mfix-cortex-a53-843419
for information on the GCC options.
2025-06-16 20:59:18 -04:00

49 lines
1.8 KiB
C++

// Check that we add relevant linker flags for Android ARM/AArch64/i386/x86_64.
// RUN: %clang -### --target=arm-linux-androideabi %s 2>&1 | \
// RUN: FileCheck --check-prefix=MAX-PAGE-SIZE-4KB %s
// RUN: %clang --target=aarch64-none-linux-android \
// RUN: -### -v %s 2> %t
// RUN: FileCheck -check-prefix=GENERIC-ARM < %t %s
// RUN: %clang --target=aarch64-none-linux-android \
// RUN: -mcpu=cortex-a53 -### -v %s 2> %t
// RUN: FileCheck -check-prefix=CORTEX-A53 < %t %s
// RUN: %clang --target=aarch64-none-linux-android \
// RUN: -mcpu=cortex-a57 -### -v %s 2> %t
// RUN: FileCheck -check-prefix=CORTEX-A57 < %t %s
// RUN: %clang --target=aarch64-none-linux-android \
// RUN: -mno-fix-cortex-a53-843419 \
// RUN: -### -v %s 2> %t
// RUN: FileCheck -check-prefix=OVERRIDDEN < %t %s
//
// RUN: %clang -target aarch64-none-linux-android \
// RUN: -mno-fix-cortex-a53-843419 -mfix-cortex-a53-843419 \
// RUN: -### -v %s 2> %t
// RUN: FileCheck -check-prefix=OVERRIDDEN2 < %t %s
//
// RUN: %clang -target aarch64-none-linux-android \
// RUN: -### -v %s 2> %t
// RUN: FileCheck -check-prefix=MAX-PAGE-SIZE-16KB < %t %s
// RUN: %clang -### --target=i386-none-linux-android %s 2>&1 | \
// RUN: FileCheck --check-prefix=NO-MAX-PAGE-SIZE-16KB %s
// RUN: %clang -### --target=x86_64-none-linux-gnu %s 2>&1 | \
// RUN: FileCheck --check-prefix=NO-MAX-PAGE-SIZE-16KB %s
// RUN: %clang -### --target=x86_64-none-linux-android %s 2>&1 | \
// RUN: FileCheck --check-prefix=MAX-PAGE-SIZE-16KB %s
// GENERIC-ARM: --fix-cortex-a53-843419
// CORTEX-A53: --fix-cortex-a53-843419
// CORTEX-A57-NOT: --fix-cortex-a53-843419
// OVERRIDDEN-NOT: --fix-cortex-a53-843419
// OVERRIDDEN2: --fix-cortex-a53-843419
// MAX-PAGE-SIZE-4KB: "-z" "max-page-size=4096"
// MAX-PAGE-SIZE-16KB: "-z" "max-page-size=16384"
// NO-MAX-PAGE-SIZE-16KB-NOT: "-z" "max-page-size=16384"