diff options
author | Ed Maste <emaste@freebsd.org> | 2019-11-15 09:30:24 -0500 |
---|---|---|
committer | Ed Maste <emaste@freebsd.org> | 2019-11-15 10:37:45 -0500 |
commit | cb1761465a0d4c904f4fca489afe97478382b553 (patch) | |
tree | 74e5825f633800be56ce72922884c82c5bb48e5f | |
parent | b221c9d09dd12bde75f00f3541c8f344925d4d59 (diff) | |
download | bcm5719-llvm-cb1761465a0d4c904f4fca489afe97478382b553.tar.gz bcm5719-llvm-cb1761465a0d4c904f4fca489afe97478382b553.zip |
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
-rw-r--r-- | clang/lib/Driver/ToolChains/FreeBSD.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Driver/ToolChains/FreeBSD.h | 1 | ||||
-rw-r--r-- | clang/test/Driver/freebsd.c | 4 |
3 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp b/clang/lib/Driver/ToolChains/FreeBSD.cpp index 7c891a24ba3..5e2c4883290 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 d17b3808ffa..1d503a621d0 100644 --- a/clang/lib/Driver/ToolChains/FreeBSD.h +++ b/clang/lib/Driver/ToolChains/FreeBSD.h @@ -67,6 +67,7 @@ public: 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 4a0a6bf5f39..dc209704d7a 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 |