I am writing bindings to a Fortran library. The bindings work perfectly when launched as “run file in new process”. Conversely, when launched directly from the REPL, a stack overflow error is raised, without further information.
After scratching my head for longer than I would like to admit, I came to the (tentative) conclusion that the problem is due to the fact that the library in question requires an executable stack:
/usr/bin/ld: warning: libodrpack95.so.p/src_odrpack_capi.f90.o: requires executable stack (because the .note.GNU-stack section is executable)
The library source code includes a nested function call (legal in fortran), and GCC uses trampolines to deal with the respective function pointers. Therefore, the executable stack is a legitimate requirement.
Questions:
- Is my diagnose correct? Why is the behavior in the REPL different from the one in a new process?
- Can something be done (some setting, etc.) to allow the code to run in the REPL as well?
- Any practical advice on how to deal with this kind of situation (other than turning the library upside down to remove the nested function call)?