1/* Test module for making nonexecutable stacks executable
2 on load of a DSO that requires executable stacks. */
3
4#include <stdbool.h>
5#include <stdio.h>
6#include <stdlib.h>
7
8void callme (void (*callback) (void));
9
10/* This is a function that makes use of executable stack by
11 using a local function trampoline. */
12void
13tryme (void)
14{
15 bool ok = false;
16 void callback (void) { ok = true; }
17
18 callme (callback: &callback);
19
20 if (ok)
21 printf (format: "DSO called ok (local %p, trampoline %p)\n", &ok, &callback);
22 else
23 abort ();
24}
25
26void
27callme (void (*callback) (void))
28{
29 (*callback) ();
30}
31

source code of glibc/elf/tst-execstack-mod.c