![]() |
|
Message-ID: <20240623211655.GP3766212@port70.net> Date: Sun, 23 Jun 2024 23:16:55 +0200 From: Szabolcs Nagy <nsz@...t70.net> To: Nickolai Belakovski <nbelakovski@...il.com>, musl@...ts.openwall.com Subject: Re: Fortran nested function causes a segfault when linked from a shared library. * Szabolcs Nagy <nsz@...t70.net> [2024-06-23 23:00:50 +0200]: > * 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. > sorry, gcc-14 has -ftrampoline-impl=heap that should fix this. > > > > I've used mailing lists only once before so if my formatting or etiquette > > is off please let > > me know so that I may correct it. > > > > Cheers, > > Nickolai
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.