Skip to main content
Topic: cannot statically link against musl anymore (Read 1369 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

cannot statically link against musl anymore

After a recent update, binaries statically linked with the musl-gcc wrapper stopped working for me.
Here is a minimal example:
Quote
$ cat test.c
int main(void) { return 0; }
$ musl-gcc -static test.c
$ ./a.out
Segmentation fault
So it links, but all produced binaries crash right away.
gdb shows, upon running a.out:
Quote
Program received signal SIGSEGV, Segmentation fault.
0x000000000040140f in static_init_tls ()

As for dynamic linking (which I don't want/need, but maybe it gives a hint),
Quote
$ musl-gcc -no-pie test.c
works, while
Quote
$ musl-gcc test.c
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/crtbegin.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__'
can not be used when making a PIE object
/usr/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status
I think the latter used to work, but could be wrong. But as stated, it is the static linking that I need to fix.

Re: cannot statically link against musl anymore

Reply #1
And the next evening shows an update for musl (as well as binutils), and now things work again. Thank Y'all, devs, you keep impressing me! (And sorry for any inconvenience caused by my impatient concerns.)