https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88088
--- Comment #5 from Segher Boessenkool <segher at gcc dot gnu.org> ---
The documentation currently says
'-Wtrampolines'
Warn about trampolines generated for pointers to nested functions.
A trampoline is a small piece of data or code that is created at
run time on the stack when the address of a nested function is
taken, and is used to call the nested function indirectly. For
some targets, it is made up of data only and thus requires no
special treatment. But, for most targets, it is made up of code
and thus requires the stack to be made executable in order for the
program to work properly.
This isn't true if the trampoline is just data, if your reading in comment 2
is correct.
This isn't something to warn about (or at least not in -Wall or -W) if
executable code on the stack does not open up security concerns.
For how to detect it, you can start at varasm.c:file_end_indicate_exec_stack ,
which isn't exactly what is needed, but you can start there. Or perhaps
builtins,c:expand_builtin_init_trampoline is better.