]> granicus.if.org Git - clang/commitdiff
Merging r311397:
authorHans Wennborg <hans@hanshq.net>
Tue, 22 Aug 2017 22:27:59 +0000 (22:27 +0000)
committerHans Wennborg <hans@hanshq.net>
Tue, 22 Aug 2017 22:27:59 +0000 (22:27 +0000)
------------------------------------------------------------------------
r311397 | ahatanak | 2017-08-21 15:46:46 -0700 (Mon, 21 Aug 2017) | 8 lines

[Driver][Darwin] Do not pass -munwind-table if -fno-excpetions is
supplied.

With this change, -fno-exceptions disables unwind tables unless
-funwind-tables is supplied too or the target is x86-64 (x86-64 requires
emitting unwind tables).

rdar://problem/33934446
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@311505 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 6b7f0c71dfb77bbcc56c6ac3a40814f3270a2420..32103a6120d4070689ba73fb85956f4031c5e2f0 100644 (file)
@@ -1837,7 +1837,12 @@ Darwin::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch,
 }
 
 bool MachO::IsUnwindTablesDefault(const ArgList &Args) const {
-  return !UseSjLjExceptions(Args);
+  // Unwind tables are not emitted if -fno-exceptions is supplied (except when
+  // targeting x86_64).
+  return getArch() == llvm::Triple::x86_64 ||
+         (!UseSjLjExceptions(Args) &&
+          Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions,
+                       true));
 }
 
 bool MachO::UseDwarfDebugFlags() const {
index 545951d5aa119dd418a60f09b06bc2b63e8910e3..3b30f7af76dc5dd57d32e28e772d1d51f9bd71fd 100644 (file)
 // RUN: FileCheck -check-prefix=ARM64-APPLE %s
 // ARM64-APPLE: -munwind-table
 
+// RUN: %clang -target arm64-apple-ios10 -fno-exceptions -### -S %s -arch arm64 2>&1 | \
+// RUN: FileCheck -check-prefix=ARM64-APPLE-EXCEP %s
+// ARM64-APPLE-EXCEP-NOT: -munwind-table
+
 // RUN: %clang -target armv7k-apple-watchos4.0 -### -S %s -arch armv7k 2>&1 | \
 // RUN: FileCheck -check-prefix=ARMV7K-APPLE %s
 // ARMV7K-APPLE: -munwind-table