Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200424150801.GF11469@brightrain.aerifal.cx>
Date: Fri, 24 Apr 2020 11:08:01 -0400
From: Rich Felker <dalias@...c.org>
To: harald@...hat.com
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH] Enable linking to a static position independent
 executable

On Tue, Apr 07, 2020 at 03:17:07PM +0200, harald@...hat.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 <<EOF
>  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

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.