fix musl-gcc wrapper to be compatible with default-pie gcc toolchains

the specfile for the wrapper was written assuming output is pie only
if -pie appears on the command line. recent (and older patched)
versions of gcc can be configured to produce pie output by default,
adn when used with such a toolchain, the wrapper linked the wrong
startfiles (crt*) containing pic-incompatible code.

rather than trying to figure out gcc's default, simply always use the
pic-compatible start files.
This commit is contained in:
Rich Felker 2018-08-02 19:15:48 -04:00
parent 14992d4384
commit 7dad9c2125
1 changed files with 2 additions and 2 deletions

View File

@ -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}