ocaml/runtime
Xavier Leroy 3a408ff3e8
Modernize signal handling on Linux i386, PowerPC64, and s390x (#9543)
OCaml's signal handlers need to know the state of the processor when the signal was received. The approach standardized by the Single Unix specification is to use 3-argument signal handing functions and the SA_SIGINFO flag to sigaction. However, as the Linux man page for sigaction says,

Undocumented:
Before the introduction of SA_SIGINFO, it was also possible to get some
additional information, namely by using a sa_handler with a second
argument of type struct sigcontext. See the relevant Linux kernel
sources for details. This use is obsolete now.

For historical reasons, the i386, PowerPC and s390x Linux ports of OCaml still use the undocumented, obsolete approach, while the other Linux ports use the modern SA_SIGINFO approach. 

For consistency and future-proofing, this PR updates the i386, PowerPC64, and s390x Linux ports to use the modern approach to signal handling.  PowerPC32 was left as before because of technical subtleties and lack of hardware to test changes.

The new code for PowerPC 64 bits includes the trick proposed in PR#1795 to support Musl in addition to Glibc on ppc64le.
2020-05-13 11:15:13 +02:00
..
caml Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
Makefile makefiles: move the inclusion of Makefile.build_config in Makefile.common 2020-05-06 12:10:02 +02:00
afl.c Use -Wdeclaration-after-statement 2020-02-11 10:07:04 +00:00
alloc.c Separate caml_check_urgent_gc back into GC actions and async callbacks 2019-10-15 19:24:41 +02:00
amd64.S Micro-optimise allocations on amd64 to save a register (#9280) 2020-03-09 19:52:36 +01:00
amd64nt.asm Implement #9280 for MSVC64 (#9358) 2020-03-10 14:10:27 +01:00
arm.S Per-architecture support for allocation size info in frame tables. 2019-10-23 09:24:13 +01:00
arm64.S Per-architecture support for allocation size info in frame tables. 2019-10-23 09:24:13 +01:00
array.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
backtrace.c Print function names (derived from Lambda.scoped_location) in backtraces 2020-04-27 12:58:53 +01:00
backtrace_byt.c Print function names (derived from Lambda.scoped_location) in backtraces 2020-04-27 12:58:53 +01:00
backtrace_nat.c Print function names (derived from Lambda.scoped_location) in backtraces 2020-04-27 12:58:53 +01:00
bigarray.c Support marshalling of bigarrays with dimensions that don't fit in 4 bytes (#8791) 2020-04-29 18:51:01 +02:00
callback.c [cleanup] Factor "if (Is_exception_result) caml_raise(Extract_exception)" 2019-10-15 14:02:22 +02:00
clambda_checks.c
compact.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
compare.c compare: move Forward/Infix tests outside the hot path 2020-05-06 22:29:01 +02:00
custom.c Added explanation to caml_alloc_custom_mem for major heap size divisor 2019-11-13 18:11:29 -05:00
debugger.c Do not use h_addr to access struct hostent 2019-12-22 17:43:33 +01:00
domain.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
dune fix 'dune build @libs' after #9257 2020-05-06 21:37:08 +02:00
dynlink.c Runtime: hide & rename _T macro (#2075) 2019-04-14 09:13:24 +02:00
dynlink_nat.c
eventlog.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
extern.c Reimplement output_value using a hash table to detect sharing (#9353) 2020-04-16 17:56:28 +02:00
fail_byt.c Replace static inline with Caml_inline 2020-02-11 09:33:55 +00:00
fail_nat.c Fix address sanitizer check on INRIA CI (#9053) 2019-10-19 11:39:30 +02:00
finalise.c Resource-safe C interface for async callbacks 2019-10-17 20:14:19 +02:00
fix_code.c Dynlink support for ocamldebug 2019-07-16 10:52:48 +02:00
floats.c remove caml_init_ieee_floats() (#9506) 2020-04-28 16:19:23 +02:00
freelist.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
gc_ctrl.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
gen_domain_state32_inc.awk Simplify awk scripts, fix comments and signatures. 2019-08-23 09:50:05 +05:30
gen_domain_state64_inc.awk Simplify awk scripts, fix comments and signatures. 2019-08-23 09:50:05 +05:30
gen_primitives.sh Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
globroots.c Fix a bug in [caml_modify_generational_global_root] 2019-05-05 16:40:29 +02:00
hash.c
i386.S microoptimise i386.S 2019-11-04 12:07:22 +00:00
i386nt.asm microoptimise i386.S 2019-11-04 12:07:22 +00:00
instrtrace.c Fix long lines 2019-08-23 09:50:05 +05:30
intern.c Replace static inline with Caml_inline 2020-02-11 09:33:55 +00:00
interp.c Memprof: get precise callstacks when memory is allocated directly in the bytecode interpreter. 2020-01-15 11:59:51 +01:00
ints.c Optimized 3-way comparisons for int and float (#2250) 2019-03-23 15:51:59 +01:00
io.c Add caml_alloc_custom_mem (#1738) 2018-11-06 13:42:48 +01:00
lexing.c
main.c
major_gc.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
md5.c
memory.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
memprof.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
meta.c Resource-safe C interface for async callbacks 2019-10-17 20:14:19 +02:00
minor_gc.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
misc.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
obj.c Initialise in caml_obj_block / Obj.new_block only when necessary (#9513) 2020-05-02 18:47:16 +02:00
parsing.c
power.S PowerPC, System Z: do not reset backtrace_pos in caml_raise_exception (#9428) 2020-04-07 15:47:55 +02:00
printexc.c Move backtrace support global variables to domain state. 2019-08-23 09:50:05 +05:30
riscv.S Add RISC-V native-code backend (#9441) 2020-04-24 16:04:50 +02:00
roots_byt.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
roots_nat.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
s390x.S PowerPC, System Z: do not reset backtrace_pos in caml_raise_exception (#9428) 2020-04-07 15:47:55 +02:00
signals.c Replace static inline with Caml_inline 2020-02-11 09:33:55 +00:00
signals_byt.c Resource-safe C interface for async callbacks 2019-10-17 20:14:19 +02:00
signals_nat.c Modernize signal handling on Linux i386, PowerPC64, and s390x (#9543) 2020-05-13 11:15:13 +02:00
signals_osdep.h Modernize signal handling on Linux i386, PowerPC64, and s390x (#9543) 2020-05-13 11:15:13 +02:00
spacetime_byt.c
spacetime_nat.c Add snprintf_os 2020-04-30 10:31:30 +02:00
spacetime_snapshot.c Fix missing Caml_state (#8940) 2019-10-03 16:27:32 +02:00
stacks.c Fix long lines 2019-08-23 09:50:05 +05:30
startup_aux.c Make sure the atom table and minor heap have their own dedicated pages. 2020-01-06 14:16:12 +01:00
startup_byt.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
startup_nat.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
str.c Fix force-safe-string on Windows 2019-11-14 11:18:43 +00:00
sys.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
unix.c Remove the dl_needs_underscore feature (#2115) 2018-10-25 15:12:22 +02:00
weak.c Rewrite the instrumented runtime to store traces in the CTF format. 2020-04-30 10:32:01 +02:00
win32.c Add snprintf_os 2020-04-30 10:31:30 +02:00