https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/232706
>From 723a2f4b0024053a18d96c842efc6461f1208a3c Mon Sep 17 00:00:00 2001 From: prabhukr <[email protected]> Date: Fri, 16 Oct 2026 04:51:56 -0700 Subject: [PATCH] [clang][Driver] Use the Windows ARM64 defaults for aarch64-unknown-uefi Match the Windows ARM64 driver defaults for aarch64-unknown-uefi, which follows the same ABI: * char is signed, so do not pass -fno-signed-char, * the frame chain must stay valid even when frame pointers are omitted, so -fomit-frame-pointer yields -mframe-pointer=reserved rather than none, as the backend reserves the frame pointer for UEFI as well. Assisted-by: Claude --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- clang/lib/Driver/ToolChains/CommonArgs.cpp | 8 ++++---- clang/test/Driver/aarch64-uefi-constructed-args.c | 9 +++++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 45aede75681103..4f2d141696448b 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -1215,7 +1215,7 @@ static bool isSignedCharDefault(const llvm::Triple &Triple) { case llvm::Triple::armeb: case llvm::Triple::thumb: case llvm::Triple::thumbeb: - if (Triple.isOSDarwin() || Triple.isOSWindows()) + if (Triple.isOSDarwin() || Triple.isOSWindowsOrUEFI()) return true; return false; diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 7c832ef405fa51..7d77cd0b916324 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -211,10 +211,10 @@ static bool mustMaintainValidFrameChain(const llvm::opt::ArgList &Args, return false; case llvm::Triple::aarch64: - // Arm64 Windows requires that the frame chain is valid, as there is no - // way to indicate during a stack walk that a frame has used the frame - // pointer as a general purpose register. - return Triple.isOSWindows(); + // Arm64 Windows (and UEFI, which follows the same ABI) requires that the + // frame chain is valid, as there is no way to indicate during a stack walk + // that a frame has used the frame pointer as a general purpose register. + return Triple.isOSWindowsOrUEFI(); } } diff --git a/clang/test/Driver/aarch64-uefi-constructed-args.c b/clang/test/Driver/aarch64-uefi-constructed-args.c index 704bdf6a79db3c..ac84b06856f42b 100644 --- a/clang/test/Driver/aarch64-uefi-constructed-args.c +++ b/clang/test/Driver/aarch64-uefi-constructed-args.c @@ -5,6 +5,7 @@ // CHECK: "-cc1" // CHECK-SAME: "-triple" "aarch64-unknown-uefi" // CHECK-SAME: "-mrelocation-model" "pic" "-pic-level" "2" +// CHECK-SAME: "-mframe-pointer=non-leaf" // CHECK-SAME: "-fms-extensions" // CHECK-NEXT: "/nologo" // CHECK-SAME: "/subsystem:efi_application" @@ -13,6 +14,14 @@ // CHECK-SAME: "/debug" // CHECK-SAME: "/Brepro" +// As on Windows ARM64, the frame chain must stay valid even when frame +// pointers are omitted, and char is signed. +// RUN: %clang -### --target=aarch64-unknown-uefi -fomit-frame-pointer -c -- %s 2>&1 \ +// RUN: | FileCheck -check-prefixes=DEFAULTS %s +// DEFAULTS: "-cc1" +// DEFAULTS-SAME: "-mframe-pointer=reserved" +// DEFAULTS-NOT: "-fno-signed-char" + // RUN: %clang -### --target=aarch64-unknown-uefi -print-search-dirs 2>&1 \ // RUN: | FileCheck -check-prefixes=PROGPATH %s // PROGPATH: InstalledDir: [[DRIVER_INSTALLED_DIR:.*]] _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
