[clang] [clang][LoongArch] Enable -fasynchronous-unwind-tables by default on Linux (PR #94711)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 6 18:09:33 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: wanglei (wangleiat)

<details>
<summary>Changes</summary>

This could improve user experience for stack unwinding, and also this is
enabled by default by LoongArch GCC.

Similar to commit be437f3bb8b657f4d2de4603734f24daa624d204


---
Full diff: https://github.com/llvm/llvm-project/pull/94711.diff


2 Files Affected:

- (modified) clang/lib/Driver/ToolChains/Gnu.cpp (+2) 
- (added) clang/test/Driver/loongarch-features.c (+7) 


``````````diff
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index b141e5f2adfab..e8c81ca966801 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -3087,6 +3087,8 @@ Generic_GCC::getDefaultUnwindTableLevel(const ArgList &Args) const {
   switch (getArch()) {
   case llvm::Triple::aarch64:
   case llvm::Triple::aarch64_be:
+  case llvm::Triple::loongarch32:
+  case llvm::Triple::loongarch64:
   case llvm::Triple::ppc:
   case llvm::Triple::ppcle:
   case llvm::Triple::ppc64:
diff --git a/clang/test/Driver/loongarch-features.c b/clang/test/Driver/loongarch-features.c
new file mode 100644
index 0000000000000..6d0db0f3ac6a9
--- /dev/null
+++ b/clang/test/Driver/loongarch-features.c
@@ -0,0 +1,7 @@
+// RUN: %clang --target=loongarch64-linux -### %s -fsyntax-only 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=DEFAULT-LINUX
+
+// DEFAULT-LINUX: "-funwind-tables=2"
+// DEFAULT-LINUX-SAME: "-target-feature" "+f"
+// DEFAULT-LINUX-SAME: "-target-feature" "+d"
+// DEFAULT-LINUX-SAME: "-target-feature" "+ual"

``````````

</details>


https://github.com/llvm/llvm-project/pull/94711


More information about the cfe-commits mailing list