mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: Fangrui Song <i@maskray.me>
Cc: Rui Ueyama <rui314@gmail.com>, Rich Felker <dalias@libc.org>,
	musl@lists.openwall.com
Subject: Re: [musl] `musl-gcc -static` and lld/mold
Date: Sun, 13 Nov 2022 16:51:26 +0100	[thread overview]
Message-ID: <20221113155126.GF98588@port70.net> (raw)
In-Reply-To: <20221113032653.6qz4hqh3nfm25tpt@gmail.com>

* Fangrui Song <i@maskray.me> [2022-11-12 19:26:53 -0800]:
> On 2022-11-13, Rui Ueyama wrote:
> > diff --git a/tools/musl-gcc.specs.sh b/tools/musl-gcc.specs.sh
> > index 30492574..ffb46d70 100644
> > --- a/tools/musl-gcc.specs.sh
> > +++ b/tools/musl-gcc.specs.sh
> > @@ -23,7 +23,7 @@ libgcc.a%s %:if-exists(libgcc_eh.a%s)
> > crtendS.o%s $libdir/crtn.o
> > 
> > *link:
> > --dynamic-linker $ldso -nostdlib %{shared:-shared} %{static:-static}
> > %{rdynamic:-export-dynamic}
> > +%{!static:-dynamic-linker $ldso} -nostdlib %{shared:-shared}
> > %{static:-static} %{rdynamic:-export-dynamic}
> > 
> > *esp_link:
> 
> I use this patch which handles -static-pie as well: https://github.com/MaskRay/musl/tree/musl-gcc

i guess you meant
https://github.com/MaskRay/musl/commit/e8a9c5489b9be78a4532712045df6f7cd45c4de6
(would be nice if it was submitted to the list)

> 
> In addition, I use `*libdir: $libdir` to avoid absolute path references
> so that the spec file can be easily fixed after moving the build directory.

i think that should only affect the paths used at compile/link time
but not paths at runtime:

%{static|static-pie:; :-dynamic-linker %(libdir)/libc.so}

different runtime path should be a separate option.
(just like --syslibdir is separate from --libdir, e.g. syslibdir
could be a variable too)

there is also interference with the -static-pie handling of gcc's
driver which might cause trouble when -static and -static-pie is mixed:

%{static-pie:-static -pie --no-dynamic-linker -z text}

  reply	other threads:[~2022-11-13 15:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-13  0:11 Rui Ueyama
2022-11-13  0:38 ` Rich Felker
2022-11-13  0:46   ` Rui Ueyama
2022-11-13  0:55     ` Rui Ueyama
2022-11-13  3:26       ` Fangrui Song
2022-11-13 15:51         ` Szabolcs Nagy [this message]
2022-11-13 17:09           ` Rich Felker
2022-11-13 18:30             ` Fangrui Song

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=20221113155126.GF98588@port70.net \
    --to=nsz@port70.net \
    --cc=dalias@libc.org \
    --cc=i@maskray.me \
    --cc=musl@lists.openwall.com \
    --cc=rui314@gmail.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).