mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Sagar Tiwari <fctorial@gmail.com>
Cc: musl@lists.openwall.com
Subject: Re: [musl] printf segfaults on recent musl versions
Date: Mon, 11 Jan 2021 22:29:35 -0500	[thread overview]
Message-ID: <20210112032935.GD23432@brightrain.aerifal.cx> (raw)
In-Reply-To: <CABitn4OQEwVRugNHSHLDjTiMLdyh+KZBO6qSMorC8=CUSv5smg@mail.gmail.com>

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@libc.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.

      parent reply	other threads:[~2021-01-12  3:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-11 17:01 Sagar Tiwari
2021-01-11 18:13 ` Rich Felker
2021-01-11 19:16   ` Sagar Tiwari
2021-01-11 19:24     ` Rich Felker
     [not found]       ` <CABitn4OQEwVRugNHSHLDjTiMLdyh+KZBO6qSMorC8=CUSv5smg@mail.gmail.com>
2021-01-12  3:29         ` Rich Felker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210112032935.GD23432@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=fctorial@gmail.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).