mailing list of musl libc
 help / color / mirror / code / Atom feed
* musl-gcc with default-pie toolchains
@ 2018-08-01 16:44 Rich Felker
  0 siblings, 0 replies; only message in thread
From: Rich Felker @ 2018-08-01 16:44 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1068 bytes --]

A number of users have hit problems with the musl-gcc wrapper and
underlying gccs built for default-pie, due to the specfile assuming
non-pie is the default. The attached patch should fix that by using
the pic-compatible versions of the crt files regardless of whether the
output is pie or not. There's really no reason for the
non-pic-compatible files to ever be used except saving (likely a
single-digit number of) bytes of text.

For static-pie, where a special rcrt1.o file is needed in place of the
normal crt1, this will not work, but as far as I know all deployed gcc
toolchains with default-pie do not honor the default-pie with -static
and don't even support -static -pie (only -static-pie if anything)
since glibc didn't support it until very recently. We could probably
make -static-pie (and maybe -static -pie?) work with musl-gcc on such
toolchains if we wanted as a separate patch, but right now I just want
to fix the defaults that are breaking things for users..

Let me know if there's anything wrong with this or if it doesn't fix
the problem.

Rich

[-- Attachment #2: gccwrapper.diff --]
[-- Type: text/plain, Size: 590 bytes --]

diff --git a/tools/musl-gcc.specs.sh b/tools/musl-gcc.specs.sh
index 294e24f..3049257 100644
--- a/tools/musl-gcc.specs.sh
+++ b/tools/musl-gcc.specs.sh
@@ -17,10 +17,10 @@ cat <<EOF
 libgcc.a%s %:if-exists(libgcc_eh.a%s)
 
 *startfile:
-%{!shared: $libdir/%{pie:S}crt1.o} $libdir/crti.o %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}
+%{!shared: $libdir/Scrt1.o} $libdir/crti.o crtbeginS.o%s
 
 *endfile:
-%{shared|pie:crtendS.o%s;:crtend.o%s} $libdir/crtn.o
+crtendS.o%s $libdir/crtn.o
 
 *link:
 -dynamic-linker $ldso -nostdlib %{shared:-shared} %{static:-static} %{rdynamic:-export-dynamic}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-08-01 16:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-01 16:44 musl-gcc with default-pie toolchains Rich Felker

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).