[clang] 9abeb80 - [Driver][OpenBSD] Disable unwind tables on Arm

Brad Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 9 17:33:36 PST 2022


Author: Brad Smith
Date: 2022-03-09T20:33:16-05:00
New Revision: 9abeb80e80d0f2e9dd7603491d33fa0683a33ac1

URL: https://github.com/llvm/llvm-project/commit/9abeb80e80d0f2e9dd7603491d33fa0683a33ac1
DIFF: https://github.com/llvm/llvm-project/commit/9abeb80e80d0f2e9dd7603491d33fa0683a33ac1.diff

LOG: [Driver][OpenBSD] Disable unwind tables on Arm

Arm is not quite ready for unwinding yet.

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/OpenBSD.cpp
    clang/lib/Driver/ToolChains/OpenBSD.h
    clang/test/Driver/openbsd.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp b/clang/lib/Driver/ToolChains/OpenBSD.cpp
index 7f19587f5f824..249a00ebb003a 100644
--- a/clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -345,3 +345,12 @@ Tool *OpenBSD::buildAssembler() const {
 Tool *OpenBSD::buildLinker() const { return new tools::openbsd::Linker(*this); }
 
 bool OpenBSD::HasNativeLLVMSupport() const { return true; }
+
+bool OpenBSD::IsUnwindTablesDefault(const ArgList &Args) const {
+    switch (getArch()) {
+      case llvm::Triple::arm:
+        return false;
+      default:
+        return true;
+    }
+}

diff  --git a/clang/lib/Driver/ToolChains/OpenBSD.h b/clang/lib/Driver/ToolChains/OpenBSD.h
index 9d668711b91b3..2d4c4e34520b7 100644
--- a/clang/lib/Driver/ToolChains/OpenBSD.h
+++ b/clang/lib/Driver/ToolChains/OpenBSD.h
@@ -82,9 +82,7 @@ class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic_ELF {
   std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
                             FileType Type = ToolChain::FT_Static) const override;
 
-  bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override {
-    return true;
-  }
+  bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override;
 
   LangOptions::StackProtectorMode
   GetDefaultStackProtectorLevel(bool KernelOrKext) const override {

diff  --git a/clang/test/Driver/openbsd.c b/clang/test/Driver/openbsd.c
index 9a811c1932329..594f90ab3a386 100644
--- a/clang/test/Driver/openbsd.c
+++ b/clang/test/Driver/openbsd.c
@@ -121,7 +121,8 @@
 
 // Check that unwind tables are enabled
 // RUN: %clang -target arm-unknown-openbsd -### -S %s 2>&1 | \
-// RUN: FileCheck -check-prefix=UNWIND-TABLES %s
+// RUN: FileCheck -check-prefix=NO-UNWIND-TABLES %s
 // RUN: %clang -target mips64-unknown-openbsd -### -S %s 2>&1 | \
 // RUN: FileCheck -check-prefix=UNWIND-TABLES %s
 // UNWIND-TABLES: "-funwind-tables=2"
+// NO-UNWIND-TABLES-NOT: "-funwind-tables=2"


        


More information about the cfe-commits mailing list