Static linking with compiler-rt and libc-2.31 does not work


This is a partial repost of Compiler-rt with soft float support with a more relevant title to get more attention. My apologies.

If this discourse is the wrong one to post this issue, please do guide me on where I can post instead. I see that Bugzilla is now marked read-only and I do not see a ready alternative.

We have been static linking our binaries with compiler-rt with libc-2.23. But since upgrading our OS to Ubuntu 20.04, which ships with libc-2.31, the static linking does not work anymore. The following can be reproduced with Ubuntu 20.04 (or any OS with libc-2.31 or higher):

$ cat > main.c
int main() { return 0; }

$ clang -fuse-ld=lld -rtlib=compiler-rt -static </path/to/libunwind.a> -o main main.c
ld.lld: error: undefined symbol: __unordtf2
>>> referenced by printf_fphex.o:(__printf_fphex) in archive /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libc.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)

My understanding is that newer versions of libc include declarations for soft-float operations, but those are not compiled (they are hidden by the CRT_HAS_128BIT flag, which is set only in very specific conditions) in the LLVM releases for x86_64 on GitHub.

Any help will be appreciated.

Thank you.


Never mind. Found out that this is a missing feature with an abandoned revision – ⚙ D53608 [builtins] Build float128 soft float builtins for x86_64..