On m68k (ARAnyM Atari TT/Falcon VM):
root@aranym:~ # cat t.c
#include <stdio.h>
int main(void) {
printf("main = 0x%lX\n", (unsigned long)main);
return (0);
}
root@aranym:~ # musl-gcc -fPIE -static -static-pie -fno-lto -o t t.c
root@aranym:~ # file t
t: ELF 32-bit MSB pie executable, Motorola m68k, 68020, version 1 (SYSV), static-pie linked, with debug_info, not stripped
root@aranym:~ # ./t
Segmentation fault
139|root@aranym:~ # musl-gcc -fPIE -static-pie -fno-lto -o t t.c
root@aranym:~ # file t
t: ELF 32-bit MSB pie executable, Motorola m68k, 68020, version 1 (SYSV), static-pie linked, with debug_info, not stripped
root@aranym:~ # ./t
Segmentation fault
The same test program in a qemu-user-based sh4 buildd:
main = 0x400006A4
main = 0x400006A4
main = 0x400006A4
On amd64, arm64, armel, armhf, i386, loong64, mips64el¹, ppc64el,
riscv64 and s390x, it DTRT.
① with a manual hack due to the still-existing musl-gcc wrapper bug:
muslspec=$topdir/xmusl.spec
case $DEB_HOST_ARCH in
(mipsel) cat /usr/lib/mipsel-linux-musl/musl-gcc.specs ;;
(mips64el) cat /usr/lib/mips64el-linux-musl/musl-gcc.specs ;;
esac >"$muslspec" || exit 255
printf '%s\n' 1a '%rename cc1 old_cc1' . \
'/^[*]cc1:/+1s/^/%(old_cc1) /' w q | \
ed -s "$muslspec" || exit 255
test -s "$muslspec" || exit 255
muslgcc="$CC -specs $muslspec"