From: Harald Hoyer <harald@redhat.com>
To: Rich Felker <dalias@libc.org>
Cc: musl@lists.openwall.com
Subject: Re: [musl] [PATCH] Enable linking to a static position independent executable
Date: Mon, 27 Apr 2020 14:24:24 +0200 [thread overview]
Message-ID: <aa379bf6-ea86-a5ff-a410-62f2ad3bfee6@redhat.com> (raw)
In-Reply-To: <20200424150801.GF11469@brightrain.aerifal.cx>
Am 24.04.20 um 17:08 schrieb Rich Felker:
> 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 <<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.
I just didn't want to divert too much from the original gcc spec.
>
>> *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}}
>
Same as above. I just didn't want to divert too much from the original gcc spec. But you are right. Small steps.
> 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
>
Will update with a minimal diff.
next prev parent reply other threads:[~2020-04-27 12:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-06 18:07 [musl] [PATCH] V2 " harald
2020-04-06 22:04 ` Fangrui Song
2020-04-07 8:42 ` Szabolcs Nagy
2020-04-07 13:17 ` [musl] [PATCH] " harald
2020-04-23 11:59 ` Harald Hoyer
2020-04-24 15:08 ` Rich Felker
2020-04-27 12:24 ` Harald Hoyer [this message]
2020-04-27 12:32 ` harald
2020-05-08 9:05 ` Harald Hoyer
2020-08-25 10:52 ` Harald Hoyer
-- strict thread matches above, loose matches on Subject: below --
2020-04-06 17:58 harald
2020-04-06 18:35 ` Harald Hoyer
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=aa379bf6-ea86-a5ff-a410-62f2ad3bfee6@redhat.com \
--to=harald@redhat.com \
--cc=dalias@libc.org \
--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).