[BZ #5186]
[glibc.git] / elf / tst-execstack-mod.c
blob038e6550b55bf9f20046fd9ac5da3dbce88aa36b
1 /* Test module for making nonexecutable stacks executable
2 on load of a DSO that requires executable stacks. */
4 #include <stdbool.h>
5 #include <stdio.h>
6 #include <stdlib.h>
8 void callme (void (*callback) (void));
10 /* This is a function that makes use of executable stack by
11 using a local function trampoline. */
12 void
13 tryme (void)
15 bool ok = false;
16 void callback (void) { ok = true; }
18 callme (&callback);
20 if (ok)
21 printf ("DSO called ok (local %p, trampoline %p)\n", &ok, &callback);
22 else
23 abort ();
26 void
27 callme (void (*callback) (void))
29 (*callback) ();