Hi! If sparc* glibc is built with -fasynchronous-unwind-tables (Fedora does this and perhaps it would be a good idea to do it in upstream glibc too), gij doesn't work. The problem can be shown e.g. on: #include <stdio.h> #include <unwind.h> static _Unwind_Reason_Code backtrace_helper (struct _Unwind_Context *ctx, void *a) { printf ("%p\n", _Unwind_GetIP (ctx)); return _URC_NO_REASON; } int main (void) { _Unwind_Backtrace (backtrace_helper, NULL); return 0; } if built with -fasynchronous-unwind-tables, it prints one address in main, one in __libc_start_main and then forever keeps repeating the same address inside of _start. The problem is in start.S unwind directives (and clone.S as well). On all other arches these two have no unwind info, so unwinding stops there. Alternatively the unwind info needs to be changed so that it will have context->ra == NULL in the next iteration and thus stop unwinding. Something like: _start: cfi_startproc cfi_escape (0x16 /* DW_CFA_val_expression */, 15 /* %o7 */, 2 /* len */, 9 /* DW_OP_const1s */, -8) /* Terminate the stack frame, and reserve space for functions to drop their arguments. */ mov %g0, %fp cfi_def_cfa_register (%fp) sub %sp, 6*4, %sp /* Extract the arguments and environment as encoded on the stack. The argument info starts after one register window (16 words) past the SP. */ ld [%sp+22*4], %o1 (and no cfi_adjust_cfa_offset) should be enough, but 1) uses fairly recently implemented DW_CFA_val_expression, in code that is linked into the binaries rather than linked dynamically 2) in the above testcase prints an annoying NULL at the end So IMHO it is better just to remove cfi_* markup from start.S and the part of clone.S that is executed in the child (well, perhaps even in the clone fn itself there should be cfi_endproc right before the syscall, so that if signal comes in for the child right after the syscall unwinding works too). Do you agree or would you prefer to go the cfi_escape route? 2007-09-18 Jakub Jelinek <jakub@redhat.com> * sysdeps/sparc/sparc32/elf/start.S: Remove cfi_* markup. * sysdeps/sparc/sparc64/elf/start.S: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/clone.S (__thread_start): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/clone.S (__thread_start): Likewise. --- libc/sysdeps/sparc/sparc32/elf/start.S.jj 2006-03-06 02:33:04.000000000 +0100 +++ libc/sysdeps/sparc/sparc32/elf/start.S 2007-09-18 11:55:35.000000000 +0200 @@ -1,5 +1,5 @@ /* Startup code for elf32-sparc - Copyright (C) 1997, 1998, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2002, 2004, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997. @@ -48,8 +48,6 @@ .global _start .type _start,#function _start: - cfi_startproc - #ifdef SHARED sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7 call .LLGETPC0 @@ -60,7 +58,6 @@ _start: drop their arguments. */ mov %g0, %fp sub %sp, 6*4, %sp - cfi_adjust_cfa_offset(6*4) /* Extract the arguments and environment as encoded on the stack. The argument info starts after one register window (16 words) past the SP. */ @@ -93,8 +90,6 @@ _start: /* Die very horribly if exit returns. */ unimp - cfi_endproc - .size _start, .-_start /* Define a symbol for the first piece of initialized data. */ --- libc/sysdeps/sparc/sparc64/elf/start.S.jj 2006-03-06 02:33:03.000000000 +0100 +++ libc/sysdeps/sparc/sparc64/elf/start.S 2007-09-18 11:55:46.000000000 +0200 @@ -1,5 +1,5 @@ /* Startup code for elf64-sparc - Copyright (C) 1997, 1998, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2002, 2004, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997. @@ -48,8 +48,6 @@ .global _start .type _start,#function _start: - cfi_startproc - #ifdef SHARED sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7 call .LLGETPC0 @@ -60,7 +58,6 @@ _start: drop their arguments. */ mov %g0, %fp sub %sp, 6*8, %sp - cfi_adjust_cfa_offset(6*8) /* Extract the arguments and environment as encoded on the stack. The argument info starts after one register window (16 words) past the SP, @@ -94,8 +91,6 @@ _start: /* Die very horribly if exit returns. */ illtrap 0 - cfi_endproc - .size _start, .-_start /* Define a symbol for the first piece of initialized data. */ --- libc/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S.jj 2007-08-16 15:23:31.000000000 +0200 +++ libc/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S 2007-09-18 11:57:34.000000000 +0200 @@ -82,8 +82,6 @@ END(__clone) .type __thread_start,@function __thread_start: - cfi_startproc - #ifdef RESET_PID sethi %hi(CLONE_THREAD), %l0 andcc %g4, %l0, %g0 @@ -104,8 +102,6 @@ __thread_start: call HIDDEN_JUMPTARGET(_exit),0 nop - cfi_endproc - .size __thread_start, .-__thread_start weak_alias (__clone, clone) --- libc/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S.jj 2007-08-16 15:25:30.000000000 +0200 +++ libc/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S 2007-09-18 11:58:06.000000000 +0200 @@ -78,7 +78,6 @@ END(__clone) .type __thread_start,@function __thread_start: - cfi_startproc #ifdef RESET_PID sethi %hi(CLONE_THREAD), %l0 andcc %g4, %l0, %g0 @@ -97,7 +96,6 @@ __thread_start: mov %g3,%o0 call HIDDEN_JUMPTARGET(_exit),0 nop - cfi_endproc .size __thread_start, .-__thread_start Jakub