Package: musl-tools
Version: 1.2.2-1
Severity: normal
X-Debbugs-Cc: t...@mirbsd.de

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?

-- System Information:
Debian Release: 11.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 
'stable-debug'), (500, 'oldstable-updates'), (500, 'oldoldstable'), (500, 
'stable'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-8-amd64 (SMP w/2 CPU threads)
Kernel taint flags: TAINT_WARN
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/lksh
Init: sysvinit (via /sbin/init)

Versions of packages musl-tools depends on:
ii  gcc       4:10.2.1-1
ii  musl-dev  1.2.2-1

musl-tools recommends no packages.

musl-tools suggests no packages.

-- no debconf information

Reply via email to