From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,URIBL_BLACK autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 31885 invoked from network); 13 Nov 2022 15:51:43 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 13 Nov 2022 15:51:43 -0000 Received: (qmail 9880 invoked by uid 550); 13 Nov 2022 15:51:40 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 9848 invoked from network); 13 Nov 2022 15:51:39 -0000 Date: Sun, 13 Nov 2022 16:51:26 +0100 From: Szabolcs Nagy To: Fangrui Song Cc: Rui Ueyama , Rich Felker , musl@lists.openwall.com Message-ID: <20221113155126.GF98588@port70.net> Mail-Followup-To: Fangrui Song , Rui Ueyama , Rich Felker , musl@lists.openwall.com References: <20221113003813.GL29905@brightrain.aerifal.cx> <20221113032653.6qz4hqh3nfm25tpt@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221113032653.6qz4hqh3nfm25tpt@gmail.com> Subject: Re: [musl] `musl-gcc -static` and lld/mold * Fangrui Song [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}