summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Driver/MSVCToolChain.cpp5
-rw-r--r--clang/test/Driver/win-macho-unwind.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Driver/MSVCToolChain.cpp b/clang/lib/Driver/MSVCToolChain.cpp
index 7f84d1f9d94..acfb507fea5 100644
--- a/clang/lib/Driver/MSVCToolChain.cpp
+++ b/clang/lib/Driver/MSVCToolChain.cpp
@@ -71,6 +71,11 @@ bool MSVCToolChain::IsUnwindTablesDefault() const {
// Emit unwind tables by default on Win64. All non-x86_32 Windows platforms
// such as ARM and PPC actually require unwind tables, but LLVM doesn't know
// how to generate them yet.
+
+ // Don't emit unwind tables by default for MachO targets.
+ if (getTriple().isOSBinFormatMachO())
+ return false;
+
return getArch() == llvm::Triple::x86_64;
}
diff --git a/clang/test/Driver/win-macho-unwind.c b/clang/test/Driver/win-macho-unwind.c
new file mode 100644
index 00000000000..a2895d2fe8c
--- /dev/null
+++ b/clang/test/Driver/win-macho-unwind.c
@@ -0,0 +1,4 @@
+// RUN: %clang -target x86_64-pc-win32-macho -### -S %s -o %t.s 2>&1 | FileCheck %s
+
+// Do not add function attribute "uwtable" for macho targets.
+// CHECK-NOT: -munwind-tables
OpenPOWER on IntegriCloud