From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 11978 invoked from network); 24 Apr 2020 15:08:18 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with UTF8ESMTPZ; 24 Apr 2020 15:08:18 -0000 Received: (qmail 9584 invoked by uid 550); 24 Apr 2020 15:08:14 -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 9563 invoked from network); 24 Apr 2020 15:08:13 -0000 Date: Fri, 24 Apr 2020 11:08:01 -0400 From: Rich Felker To: harald@redhat.com Cc: musl@lists.openwall.com Message-ID: <20200424150801.GF11469@brightrain.aerifal.cx> References: <20200406220403.3moghw2llo34e6gh@gmail.com> <20200407131707.1220892-1-harald@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200407131707.1220892-1-harald@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] [PATCH] Enable linking to a static position independent executable On Tue, Apr 07, 2020 at 03:17:07PM +0200, harald@redhat.com wrote: > diff --git a/tools/musl-gcc.specs.sh b/tools/musl-gcc.specs.sh > old mode 100644 > new mode 100755 > index 30492574..4d93626a > --- a/tools/musl-gcc.specs.sh > +++ b/tools/musl-gcc.specs.sh > @@ -17,13 +17,13 @@ cat < libgcc.a%s %:if-exists(libgcc_eh.a%s) > > *startfile: > -%{!shared: $libdir/Scrt1.o} $libdir/crti.o crtbeginS.o%s > +%{shared:;static:$libdir/crt1.o%s; static-pie:$libdir/rcrt1.o%s; pie:$libdir/Scrt1.o%s; :$libdir/crt1.o%s} $libdir/crti.o%s %{static:crtbeginT.o%s; shared|static-pie|pie:crtbeginS.o%s; :crtbegin.o%s} > > *endfile: > -crtendS.o%s $libdir/crtn.o > +%{static:crtend.o%s; shared|static-pie|pie:crtendS.o%s; :crtend.o%s} $libdir/crtn.o%s Is there a reason for this change? I think crtendS.o is always preferable and the other ones just exist for weird historical reasons. > *link: > --dynamic-linker $ldso -nostdlib %{shared:-shared} %{static:-static} %{rdynamic:-export-dynamic} > +%{!r:--build-id} --no-add-needed %{!static|static-pie:--eh-frame-hdr} --hash-style=gnu %{shared:-shared} %{!shared:%{!static:%{!static-pie:%{rdynamic:-export-dynamic} -dynamic-linker $ldso}} %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}} There are multiple unrelated and probably unwanted changes here: * --build-id? * --eh-frame-header but only for non-static? * --hash-style=gnu? * Disallowing -rdynamic for static[-pie]? * ... ? I think all that should be done here is ensuring that --no-dynamic-linker is passed whenever -static-pie is. Is there something else that's a wanted change that I'm overlooking? Rich