[PATCH] D70110: [Driver][FreeBSD] Enable unwind tables on !amd64

Conrad Meyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 11 22:37:13 PST 2019


cem created this revision.
cem added reviewers: dim, emaste.
Herald added subscribers: cfe-commits, krytarowski.
Herald added a project: clang.

There doesn't seem to be much sense in defaulting "on" unwind tables on
amd64 and not on other arches.  It causes surprising differences between
platforms, such as the PR below.

Prior to this change, FreeBSD inherited the default implementation of the
method from the Gnu.h Generic_Elf => Generic_GCC parent class, which
returned true only for amd64 targets.  Override that and opt on always,
similar to, e.g., NetBSD's driver.

A simple test case for a !amd64 architecture is added to the "freebsd.c"
tests.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=241562


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70110

Files:
  clang/lib/Driver/ToolChains/FreeBSD.cpp
  clang/lib/Driver/ToolChains/FreeBSD.h
  clang/test/Driver/freebsd.c


Index: clang/test/Driver/freebsd.c
===================================================================
--- clang/test/Driver/freebsd.c
+++ clang/test/Driver/freebsd.c
@@ -197,3 +197,7 @@
 // RUN: %clang -target sparc64-unknown-freebsd -### -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-IAS %s
 // CHECK-IAS-NOT: "-no-integrated-as"
+
+// RUN: %clang -target ppc64-unknown-freebsd13.0 -### -S %s 2>&1 | \
+// RUN: FileCheck -check-prefix=PPC64-MUNWIND %s
+// PPC64-MUNWIND: -munwind-table
Index: clang/lib/Driver/ToolChains/FreeBSD.h
===================================================================
--- clang/lib/Driver/ToolChains/FreeBSD.h
+++ clang/lib/Driver/ToolChains/FreeBSD.h
@@ -67,6 +67,7 @@
 
   llvm::ExceptionHandling GetExceptionModel(
       const llvm::opt::ArgList &Args) const override;
+  bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override;
   bool isPIEDefault() const override;
   SanitizerMask getSupportedSanitizers() const override;
   unsigned GetDefaultDwarfVersion() const override;
Index: clang/lib/Driver/ToolChains/FreeBSD.cpp
===================================================================
--- clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -420,6 +420,8 @@
 
 bool FreeBSD::HasNativeLLVMSupport() const { return true; }
 
+bool FreeBSD::IsUnwindTablesDefault(const ArgList &Args) const { return true; }
+
 bool FreeBSD::isPIEDefault() const { return getSanitizerArgs().requiresPIE(); }
 
 SanitizerMask FreeBSD::getSupportedSanitizers() const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70110.228814.patch
Type: text/x-patch
Size: 1555 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191112/7f0325d7/attachment.bin>


More information about the cfe-commits mailing list