From: Tim Northover Date: Fri, 9 Sep 2022 09:46:23 +0000 (+0100) Subject: AAArch64: disable asynchronous unwind by default for MachO. X-Git-Tag: upstream/17.0.6~33044 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=58f9abaed4aa148566d5f14afdf473e57b20d687;p=platform%2Fupstream%2Fllvm.git 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. --- diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp index e466ce9..50572ff 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 c471c6a..ffa732c 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