[clang] 58f9aba - AAArch64: disable asynchronous unwind by default for MachO.

Tim Northover via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 20 02:47:29 PDT 2022


Author: Tim Northover
Date: 2022-09-20T10:47:18+01:00
New Revision: 58f9abaed4aa148566d5f14afdf473e57b20d687

URL: https://github.com/llvm/llvm-project/commit/58f9abaed4aa148566d5f14afdf473e57b20d687
DIFF: https://github.com/llvm/llvm-project/commit/58f9abaed4aa148566d5f14afdf473e57b20d687.diff

LOG: AAArch64: disable asynchronous unwind by default for MachO.

AArch64 MachO has a compact unwind format where most functions' unwind info can
be represented in just 4 bytes. But this cannot represent any asynchronous CFI
function, so it's essentially disabled when that's used. This is a large
code-size hit that we'd rather not take unless explicitly requested.

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Darwin.cpp
    clang/test/Driver/clang-translation.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index e466ce935a68..50572ff04ff8 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -2932,7 +2932,8 @@ ToolChain::UnwindTableLevel MachO::getDefaultUnwindTableLevel(const ArgList &Arg
       (GetExceptionModel(Args) != llvm::ExceptionHandling::SjLj &&
        Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions,
                     true)))
-    return UnwindTableLevel::Asynchronous;
+    return getArch() == llvm::Triple::aarch64 ? UnwindTableLevel::Synchronous
+                                              : UnwindTableLevel::Asynchronous;
 
   return UnwindTableLevel::None;
 }

diff  --git a/clang/test/Driver/clang-translation.c b/clang/test/Driver/clang-translation.c
index c471c6a8f73d..ffa732c8f656 100644
--- a/clang/test/Driver/clang-translation.c
+++ b/clang/test/Driver/clang-translation.c
@@ -77,7 +77,11 @@
 
 // RUN: %clang -target arm64-apple-ios10 -### -S %s -arch arm64 2>&1 | \
 // RUN: FileCheck -check-prefix=ARM64-APPLE %s
-// ARM64-APPLE: -funwind-tables=2
+// ARM64-APPLE: -funwind-tables=1
+
+// RUN: %clang -target arm64-apple-ios10 -funwind-tables -### -S %s -arch arm64 2>&1 | \
+// RUN: FileCheck -check-prefix=ARM64-APPLE-UNWIND %s
+// ARM64-APPLE-UNWIND: -funwind-tables=1
 
 // RUN: %clang -target arm64-apple-ios10 -### -ffreestanding -S %s -arch arm64 2>&1 | \
 // RUN: FileCheck -check-prefix=ARM64-FREESTANDING-APPLE %s


        


More information about the cfe-commits mailing list