Hello! I'm the current maintainer for the Debian sh4 port. I maintain several buildds as well as port packages for the sh4 architecture.
Recently I discovered qemu for building packages in an emulated chroot environment with qemu-sh4-static. While setting up python, qemu issued an error message about an unimplemented syscall, 186 which is sigaltstack. Looking up the sources, I found that linux-user/syscall.c enables sigaltstack for a limited number of architectures only. In order to fix the problem with the missing sigaltstack syscall, I added TARGET_SH4 to the list of architectures which seems to work. The following sample C program tests the functionality of sigaltstack. Without my patch, the program segfaults on qemu-sh4. With the patch, it works as expected. ===================================================================== #include <setjmp.h> #include <signal.h> #include <stdlib.h> #include <stdio.h> jmp_buf exit_jmp; void handler(int x) { longjmp(exit_jmp, 1); } int f(void) { return f(); } int main(void) { stack_t sigstack; sigstack.ss_sp = malloc(1024*1024); sigstack.ss_size = 1024*1024; sigstack.ss_flags = 0; sigaltstack(&sigstack, NULL); struct sigaction sa; sa.sa_handler = handler; sigemptyset(&sa.sa_mask); sa.sa_flags = SA_ONSTACK; sigaction(SIGSEGV, &sa, NULL); if (setjmp(exit_jmp) == 0) { return f(); } puts("recovered"); return 0; } ===================================================================== Any idea what else I should test to verify my changes? Otherwise, it would be great if my patch could be applied to add sigaltstack for sh4. Thanks, Adrian > [1] https://wiki.debian.org/SH4/sbuildQEMU -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaub...@debian.org `. `' Freie Universitaet Berlin - glaub...@physik.fu-berlin.de `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913