|
Message-ID: <CAH8yC8niDs4aTXa-gtWyGhHi1t7zXgBYHrFnddJoYJ0CJY2jUw@mail.gmail.com> Date: Sun, 23 Jun 2024 23:05:45 -0400 From: Jeffrey Walton <noloader@...il.com> To: musl@...ts.openwall.com, Nickolai Belakovski <nbelakovski@...il.com> Subject: Re: Fortran nested function causes a segfault when linked from a shared library. On Sun, Jun 23, 2024 at 5:01 PM Szabolcs Nagy <nsz@...t70.net> wrote: > > * Nickolai Belakovski <nbelakovski@...il.com> [2024-06-23 14:33:32 -0400]: > > Hello all, > > > > I'm having some trouble running a particular Fortran program I'm working on. > > I've reduced it down to just a few lines of code and it seems that this > > issue only occurs on musl. > > > > As the title indicates, when a Fortran subroutine has a nested subroutine, > > and it passes > > that subroutine to another subroutine, that second subroutine will segfault > > when it tries > > to call the passed nested subroutine. I know, it's quite a mouthful, it's > > probably easier > > if you look at the code: > > https://github.com/nbelakovski/fortran_nested_func_musl > > > > I tried a handful of different compiler flags but I'm mostly just pulling > > at straws here. > > > > I'd appreciate any help anyone could provide in terms of either > > investigating this issue > > further or hopefully fixing it. > > > readelf -lW libalgorithm.so > ... > GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RWE 0x10 > > musl does not support executable stack, but gcc implements > nested functions via an on-stack trampolines that requires > executable stack. > > i don't think there is a compiler flag to fix this, you > have to change the code. Also see <https://gcc.gnu.org/onlinedocs/gccint/Trampolines.html>, and the -fno-trampolines option. Jeff
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.