[clang] 9e831d5 - [AArch64] Pass -mabi option through to multilib (#110874)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 4 01:38:15 PDT 2024


Author: Oliver Stannard
Date: 2024-10-04T09:38:11+01:00
New Revision: 9e831d50a0d67c6779048742657edb437818b681

URL: https://github.com/llvm/llvm-project/commit/9e831d50a0d67c6779048742657edb437818b681
DIFF: https://github.com/llvm/llvm-project/commit/9e831d50a0d67c6779048742657edb437818b681.diff

LOG: [AArch64] Pass -mabi option through to multilib (#110874)

Pass the -mabi option through to multilib, so that it can be used for
library selection.

Added: 
    

Modified: 
    clang/lib/Driver/ToolChain.cpp
    clang/test/Driver/print-multi-selection-flags.c

Removed: 
    


################################################################################
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


        


More information about the cfe-commits mailing list