Skip to content

Commit 7dad9c2

Browse files
committed
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.
1 parent 14992d4 commit 7dad9c2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/musl-gcc.specs.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ cat <<EOF
1717
libgcc.a%s %:if-exists(libgcc_eh.a%s)
1818
1919
*startfile:
20-
%{!shared: $libdir/%{pie:S}crt1.o} $libdir/crti.o %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}
20+
%{!shared: $libdir/Scrt1.o} $libdir/crti.o crtbeginS.o%s
2121
2222
*endfile:
23-
%{shared|pie:crtendS.o%s;:crtend.o%s} $libdir/crtn.o
23+
crtendS.o%s $libdir/crtn.o
2424
2525
*link:
2626
-dynamic-linker $ldso -nostdlib %{shared:-shared} %{static:-static} %{rdynamic:-export-dynamic}

0 commit comments

Comments
 (0)