Date: Mon, 11 Jan 2021 22:29:35 -0500 From: Rich Felker <dalias@...c.org> To: Sagar Tiwari <fctorial@...il.com> Cc: musl@...ts.openwall.com Subject: Re: printf segfaults on recent musl versions On Tue, Jan 12, 2021 at 06:33:10AM +0530, Sagar Tiwari wrote: > These changes fix the issue. > > Another alternative is to manually call '__init_libc' with two args > pointing to zeroed memory and > '__libc_start_init'. Don't know if it's safe? It's not. __init_libc is not a public function. You can call __libc_start_main (which is the ABI boundary) from your own entry point file if you like though but I don't see any reason to prefer that over just using [S]crt1.o. Rich > On 12/01/2021, Rich Felker <dalias@...c.org> wrote: > > On Tue, Jan 12, 2021 at 12:46:40AM +0530, Sagar Tiwari wrote: > >> I'm assembling a file with clang and linking it to custom compiled > >> musl with ld. This is the project I'm using: > >> > >> https://drive.google.com/file/d/1RiKZTf_nJUak14fz7kSXbh7egJuDthDk/view?usp=sharing > > > > In the future, please send attachments not Google Drive links. > > > >> musl 1.1.8 is the last version that works with this project. I used > >> clang 11.0.0 to compile both musl and this project. > > > > You can't call libc if you didn't enter the program through its entry > > point (or an ABI-compatible one). If you name the mn function main, > > link crt1.o (or the appropriate variant thereof), and drop the linker > > script (which may be omitting other necessary items), it should work > > as expected.
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.