From 9e831d50a0d67c6779048742657edb437818b681 Mon Sep 17 00:00:00 2001 From: Oliver Stannard Date: Fri, 4 Oct 2024 10:38:11 +0200 Subject: [PATCH] [AArch64] Pass -mabi option through to multilib (#110874) Pass the -mabi option through to multilib, so that it can be used for library selection. --- clang/lib/Driver/ToolChain.cpp | 5 +++++ clang/test/Driver/print-multi-selection-flags.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index 16f9b629fc538c..de250322b3b34d 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -227,6 +227,11 @@ static void getAArch64MultilibFlags(const Driver &D, if (BranchProtectionArg) { Result.push_back(BranchProtectionArg->getAsString(Args)); } + + const Arg *ABIArg = Args.getLastArgNoClaim(options::OPT_mabi_EQ); + if (ABIArg) { + Result.push_back(ABIArg->getAsString(Args)); + } } static void getARMMultilibFlags(const Driver &D, diff --git a/clang/test/Driver/print-multi-selection-flags.c b/clang/test/Driver/print-multi-selection-flags.c index 0116c7f5a03b9a..b490ff13d30ebe 100644 --- a/clang/test/Driver/print-multi-selection-flags.c +++ b/clang/test/Driver/print-multi-selection-flags.c @@ -19,6 +19,11 @@ // CHECK-HARD: -mfloat-abi=hard // CHECK-HARD: -mfpu=fpv5-d16 +// RUN: %clang -print-multi-flags-experimental --target=aarch64-none-elf -mabi=aapcs | FileCheck --check-prefix=CHECK-ABI-AAPCS %s +// RUN: %clang -print-multi-flags-experimental --target=aarch64-none-elf -mabi=aapcs-soft | FileCheck --check-prefix=CHECK-ABI-AAPCS-SOFT %s +// CHECK-ABI-AAPCS: -mabi=aapcs +// CHECK-ABI-AAPCS-SOFT: -mabi=aapcs-soft + // RUN: %clang -print-multi-flags-experimental --target=arm-none-eabi -mfloat-abi=soft -march=armv8-m.main+nofp | FileCheck --check-prefix=CHECK-V8MMAIN-NOFP %s // CHECK-V8MMAIN-NOFP: --target=thumbv8m.main-unknown-none-eabi // CHECK-V8MMAIN-NOFP: -mfloat-abi=soft