llvm-6502/lib/Support/Unix
Ulrich Weigand 3ea50a69d7 [SystemZ] Support System Z as host architecture
The llvm::sys::AddSignalHandler function (as well as related routines) in
lib/Support/Unix/Signals.inc currently registers a signal handler routine
via "sigaction".  When this handler is called due to a SIGSEGV, SIGILL or
similar signal, it will show a stack backtrace, deactivate the handler,
and then simply return to the operating system.  The intent is that the
OS will now retry execution at the same location as before, which ought
to again trigger the same error condition and cause the same signal to be
delivered again.  Since the hander is now deactivated, the OS will take
its default action (usually, terminate the program and possibly create
a core dump).

However, this method doesn't work reliably on System Z:  With certain
signals (namely SIGILL, SIGFPE, and SIGTRAP), the program counter stored
by the kernel on the signal stack frame (which is the location where
execution will resume) is not the instruction that triggered the fault,
but then instruction *after it*.  When the LLVM signal handler simply
returns to the kernel, execution will then resume at *that* address,
which will not trigger the problem again, but simply go on and execute
potentially unrelated code leading to random errors afterwards.

To fix this, the patch simply goes and re-raises the signal in question
directly from the handler instead of returning from it.  This is done
only on System Z and only for those signals that have this particular
problem.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181010 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-03 12:22:11 +00:00
..
Host.inc revert r147542 after comments from Joerg Sonnenberger 2012-01-05 18:28:46 +00:00
Memory.inc Android uses cacheflush(long start, long end, long flags) for MIPS. 2013-03-14 19:01:00 +00:00
Mutex.inc Now to chant the magical incantation that will exorcise the System library 2010-11-29 19:44:50 +00:00
Path.inc The assumption that /proc/self/exe always exists is incorrect. 2012-09-26 08:30:35 +00:00
PathV2.inc <rdar://problem/13551789> Fix yet another race in unique_file. 2013-04-05 20:48:36 +00:00
Process.inc Workaround an MSan false positive. 2013-02-14 12:18:32 +00:00
Program.inc Add a function to check if an argument list is too long. 2013-04-11 14:06:34 +00:00
README.txt
RWMutex.inc Now to chant the magical incantation that will exorcise the System library 2010-11-29 19:44:50 +00:00
Signals.inc [SystemZ] Support System Z as host architecture 2013-05-03 12:22:11 +00:00
system_error.inc Now to chant the magical incantation that will exorcise the System library 2010-11-29 19:44:50 +00:00
ThreadLocal.inc Now to chant the magical incantation that will exorcise the System library 2010-11-29 19:44:50 +00:00
TimeValue.inc Fix initialization-order bug in llvm::Support::TimeValue. TimeValue::now() is explicitly called during module initialization of lib/Support/Process.cpp. It reads the field of global object PosixZeroTime, which is not guaranteed to be initialized at this point. Found by AddressSanitizer with -fsanitize=init-order option. 2013-02-19 11:35:39 +00:00
Unix.h Sort includes for all of the .h files under the 'lib' tree. These were 2012-12-04 07:12:27 +00:00
Watchdog.inc Add a new watchdog timer interface. The interface does not permit handling timeouts, so 2013-03-26 01:27:52 +00:00

llvm/lib/Support/Unix README
===========================

This directory provides implementations of the lib/System classes that
are common to two or more variants of UNIX. For example, the directory
structure underneath this directory could look like this:

Unix           - only code that is truly generic to all UNIX platforms
  Posix        - code that is specific to Posix variants of UNIX
  SUS          - code that is specific to the Single Unix Specification
  SysV         - code that is specific to System V variants of UNIX

As a rule, only those directories actually needing to be created should be
created. Also, further subdirectories could be created to reflect versions of
the various standards. For example, under SUS there could be v1, v2, and v3
subdirectories to reflect the three major versions of SUS.