arc: Ensure that debugger can recognize sigrestorer
commit490b84a72c8eecf03e8befbdcf973e468f2d310c
authorAnton Kolesov <Anton.Kolesov@synopsys.com>
Wed, 28 Jun 2017 17:04:33 +0000 (28 20:04 +0300)
committerWaldemar Brodkorb <wbx@uclibc-ng.org>
Thu, 14 Sep 2017 02:37:54 +0000 (14 04:37 +0200)
tree9e3a3d6067639f0c98f991bfd0d058e91b7f50b8
parent26cc89d99cc9d783859eb9d38e067fad5d6bbb60
arc: Ensure that debugger can recognize sigrestorer

An issue has been found with current implementation of signal restorer
function in uClibc and how GDB handles it. When debugger information is not
present, everything worked fine, because GDB would use a built-in logic to
determine if function is a signal restorer. However when debugging information
is present, debugger would rely solely on it and wouldn't use ARC-specific
functions to detect signal handler frames. Because debug information for signal restorer is generated
completely by the compiler, it lacks a marker, that identifies this as a
signal frame that requires special handling. While it is possible to insert
that marker via inline assembly, that still doesn't solve the whole problem,
because some other expectations are not met by the debug information - there
is no "nop" in front of the function, needed to fool debugger into thinking
that this was a function call, and references to previous frame information
need to be described manually. The simplest way to fix the problem is just
to make sure that signal restorer function will not have any debug function
at all, which can be done by writing it in assembly.

Alternative, more complex, solution, where debug information for signal
frame is manually defined can be found in
glibc/sysdeps/unix/sysv/linux/x86_64/sigaction.c [1].

[1] https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86_64/sigaction.c;hb=HEAD

Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
libc/sysdeps/linux/arc/Makefile.arch
libc/sysdeps/linux/arc/sigaction.c
libc/sysdeps/linux/arc/sigrestorer.S [new file with mode: 0644]