https://gcc.gnu.org/g:31c410d9141f6d1d96541ee5ccbdd1ee73b1f255

commit r17-5534-g31c410d9141f6d1d96541ee5ccbdd1ee73b1f255
Author: Stian Halseth <[email protected]>
Date:   Fri Oct 23 21:50:53 2026 -0600

    [PATCH v2 1/2] sparc: Enable -fasynchronous-unwind-tables by default on 
sparc64 Linux [PR128091]
    
    Without unwind tables, glibc's backtrace() stops at the first frame,
    because it uses the libgcc unwinder on SPARC. This follows the example
    of aarch64 and riscv.
    
    Bootstrapped and regression tested on sparc64-unknown-linux-gnu.
    
    gcc/ChangeLog:
    
            PR target/128091
            * common/config/sparc/sparc-common.cc
            (sparc_option_optimization_table)
            [TARGET_DEFAULT_ASYNC_UNWIND_TABLES]: Enable
            -fasynchronous-unwind-tables and -funwind-tables.
            * config.gcc (sparc64-*-linux*): Define
            TARGET_DEFAULT_ASYNC_UNWIND_TABLES.

Diff:
---
 gcc/common/config/sparc/sparc-common.cc | 4 ++++
 gcc/config.gcc                          | 1 +
 2 files changed, 5 insertions(+)

diff --git a/gcc/common/config/sparc/sparc-common.cc 
b/gcc/common/config/sparc/sparc-common.cc
index daacdeb74b74..52ea31923f7d 100644
--- a/gcc/common/config/sparc/sparc-common.cc
+++ b/gcc/common/config/sparc/sparc-common.cc
@@ -29,6 +29,10 @@ static const struct default_options 
sparc_option_optimization_table[] =
   {
     /* Enable redundant extension instructions removal at -O2 and higher.  */
     { OPT_LEVELS_2_PLUS, OPT_free, NULL, 1 },
+#if TARGET_DEFAULT_ASYNC_UNWIND_TABLES == 1
+    { OPT_LEVELS_ALL, OPT_fasynchronous_unwind_tables, NULL, 1 },
+    { OPT_LEVELS_ALL, OPT_funwind_tables, NULL, 1 },
+#endif
     { OPT_LEVELS_NONE, 0, NULL, 0 }
   };
 
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 13a0757c5a61..13851ac73d73 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3525,6 +3525,7 @@ sparc64-*-linux*)
        tm_file="sparc/biarch64.h ${tm_file} elfos.h sparc/sysv4.h gnu-user.h 
linux.h glibc-stdint.h sparc/default64.h sparc/linux64.h sparc/tso.h"
        extra_options="${extra_options} sparc/long-double-switch.opt"
        tmake_file="${tmake_file} sparc/t-sparc sparc/t-linux64"
+       tm_defines="${tm_defines} TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1"
        ;;
 sparc64-*-freebsd*|ultrasparc-*-freebsd*)
        tm_file="${tm_file} ${fbsd_tm_file} elfos.h sparc/sysv4.h 
sparc/freebsd.h"

Reply via email to