Author: Ed Maste Date: 2019-11-15T10:37:45-05:00 New Revision: cb1761465a0d4c904f4fca489afe97478382b553
URL: https://github.com/llvm/llvm-project/commit/cb1761465a0d4c904f4fca489afe97478382b553 DIFF: https://github.com/llvm/llvm-project/commit/cb1761465a0d4c904f4fca489afe97478382b553.diff LOG: clang: enable unwind tables on FreeBSD !amd64 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[1]. 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. [1] https://bugs.freebsd.org/241562 Patch by cem (Conrad Meyer). Reviewed By: dim Differential Revision: https://reviews.llvm.org/D70110 Added: Modified: clang/lib/Driver/ToolChains/FreeBSD.cpp clang/lib/Driver/ToolChains/FreeBSD.h clang/test/Driver/freebsd.c Removed: ################################################################################ diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp b/clang/lib/Driver/ToolChains/FreeBSD.cpp index 7c891a24ba30..5e2c4883290f 100644 --- a/clang/lib/Driver/ToolChains/FreeBSD.cpp +++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp @@ -420,6 +420,8 @@ llvm::ExceptionHandling FreeBSD::GetExceptionModel(const ArgList &Args) const { 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 { diff --git a/clang/lib/Driver/ToolChains/FreeBSD.h b/clang/lib/Driver/ToolChains/FreeBSD.h index d17b3808ffac..1d503a621d0e 100644 --- a/clang/lib/Driver/ToolChains/FreeBSD.h +++ b/clang/lib/Driver/ToolChains/FreeBSD.h @@ -67,6 +67,7 @@ class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic_ELF { 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; diff --git a/clang/test/Driver/freebsd.c b/clang/test/Driver/freebsd.c index 4a0a6bf5f39c..dc209704d7ab 100644 --- a/clang/test/Driver/freebsd.c +++ b/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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits