tags 996326 + patch
thanks

On Wed, 13 Oct 2021 03:07:50 +0200 Thorsten Glaser <t...@mirbsd.de> wrote:
> Supposedly, all versions since stretch/bionic should be able
> to do static PIE, at least as far as my research shows me, but
> I either can’t seem to figure it out, or it’s plain broken.
> 
> Both of…
>  musl-gcc -fPIE -static-pie -o foo foo.c -v -fno-lto
>  musl-gcc -fPIE -static -static-pie -o foo foo.c -v -fno-lto
> … fail, as the -v shows, it passes -dynamic-linker and doesn’t
> pick rcrt0. (The -fno-lto makes the output marginally more
> legible so I included it in an otherwise minimal example.)
> 
> The first generates a dynamically linked(?) PIE executable that
> lintian detects as a shared library not linked against (g)libc,
> the second is… I don’t even know; file says static but it doesn’t
> have the right crt objects but *has* -dynamic-linker…
> 
> So how can we get static PIE with musl on Debian, and in which
> releases?

There's a patch available at
https://src.fedoraproject.org/rpms/musl/blob/rawhide/f/musl-1.2.0-Support-static-pie-with-musl-gcc-specs.patch
that should make static-pie work.

Reply via email to