So it turns out that ld hanging on the backtrace is actually glibc bug https://sourceware.org/bugzilla/show_bug.cgi?id=16159 getting tickled. Setting the MALLOC_CHECK_ environment variable causes it not to hang, by not trying to emit the back trace and deadlocking on reacquiring the malloc lock:
$ MALLOC_CHECK_=2 gcc -o /tmp/conftest -fPIE -pie -static conftest.c collect2: error: ld terminated with signal 6 [Aborted], core dumped /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.24 assertion fail ../../bfd/elflink.c:13053 /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.24 assertion fail ../../bfd/elflink.c:13053 /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.24 assertion fail ../../bfd/elflink.c:13053 /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.24 assertion fail ../../bfd/elflink.c:13053 /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.24 assertion fail ../../bfd/elflink.c:13053 ** Also affects: eglibc (Ubuntu) Importance: Undecided Status: New ** Bug watch added: Sourceware.org Bugzilla #16159 http://sourceware.org/bugzilla/show_bug.cgi?id=16159 ** Also affects: eglibc via http://sourceware.org/bugzilla/show_bug.cgi?id=16159 Importance: Unknown Status: Unknown -- You received this bug notification because you are a member of Ubuntu-X, which is subscribed to xorg-server in Ubuntu. https://bugs.launchpad.net/bugs/1266492 Title: ld:i386 crashes with -static -fPIE -pie To manage notifications about this bug go to: https://bugs.launchpad.net/eglibc/+bug/1266492/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~ubuntu-x-swat Post to : ubuntu-x-swat@lists.launchpad.net Unsubscribe : https://launchpad.net/~ubuntu-x-swat More help : https://help.launchpad.net/ListHelp