mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-16 13:18:12 +01:00
Fix init-local-signal test (#50)
* Add `SA_SIGINFO` flag This is needed to guarantee the availability of the `ucontext` argument * Mark the `NULL` pointer load as `volatile` Further prevent any compiler optimization on the load.
This commit is contained in:
parent
b9fe811de9
commit
26c99a3a3e
2 changed files with 3 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
#include <stdio.h>
|
||||
|
||||
/* To prevent inlining and optimizing away */
|
||||
int foo(int* f) {
|
||||
int foo(volatile int* f) {
|
||||
return *f;
|
||||
}
|
||||
|
|
|
@ -46,12 +46,13 @@ void handler(int num, siginfo_t* info, void* ucontext) {
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
int foo(int* f);
|
||||
int foo(volatile int* f);
|
||||
|
||||
int main(){
|
||||
struct sigaction a;
|
||||
memset(&a, 0, sizeof(struct sigaction));
|
||||
a.sa_sigaction = &handler;
|
||||
a.sa_flags = SA_SIGINFO;
|
||||
sigaction(SIGSEGV, &a, NULL);
|
||||
|
||||
foo(NULL);
|
||||
|
|
Loading…
Reference in a new issue