[clang] be437f3 - [clang][RISCV] Enable -fasynchronous-unwind-tables by default on Linux

Kito Cheng via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 3 00:13:59 PST 2023


Author: Kito Cheng
Date: 2023-03-03T16:13:53+08:00
New Revision: be437f3bb8b657f4d2de4603734f24daa624d204

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

LOG: [clang][RISCV] Enable -fasynchronous-unwind-tables by default on Linux

This could improve user experience for stack unwinding, and also this is
enabled by default by X86 and AArch64 and RISC-V GCC.

Reviewed By: luismarques, MaskRay

Differential Revision: https://reviews.llvm.org/D145164

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Gnu.cpp
    clang/test/Driver/riscv-features.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 3a69a2967462e..24fbdcffc07ba 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2900,6 +2900,8 @@ Generic_GCC::getDefaultUnwindTableLevel(const ArgList &Args) const {
   case llvm::Triple::ppcle:
   case llvm::Triple::ppc64:
   case llvm::Triple::ppc64le:
+  case llvm::Triple::riscv32:
+  case llvm::Triple::riscv64:
   case llvm::Triple::x86:
   case llvm::Triple::x86_64:
     return UnwindTableLevel::Asynchronous;

diff  --git a/clang/test/Driver/riscv-features.c b/clang/test/Driver/riscv-features.c
index 37b6f8647d49b..98445b1920301 100644
--- a/clang/test/Driver/riscv-features.c
+++ b/clang/test/Driver/riscv-features.c
@@ -26,7 +26,8 @@
 // RUN: %clang --target=riscv64-linux -### %s -fsyntax-only 2>&1 \
 // RUN:   | FileCheck %s -check-prefix=DEFAULT-LINUX
 
-// DEFAULT-LINUX: "-target-feature" "+m"
+// DEFAULT-LINUX: "-funwind-tables=2"
+// DEFAULT-LINUX-SAME: "-target-feature" "+m"
 // DEFAULT-LINUX-SAME: "-target-feature" "+a"
 // DEFAULT-LINUX-SAME: "-target-feature" "+f"
 // DEFAULT-LINUX-SAME: "-target-feature" "+d"


        


More information about the cfe-commits mailing list