Compiler-rt with soft float support

Hi,

Can the built compiler-rt that is bundled with the released clang+llvm distributions have soft float support (128 bit) enabled? The newer versions of libc6 (e.g. default on Ubuntu 20.04 – libc-2.31), have undefined symbols for soft float support (letf2, unordtf2, etc.) in libc.a. If compiler-rt does not have these symbols, then static linking (with -static flag) with -rtlib=compiler-rt becomes very difficult. It is my understanding, that the symbols have actually been implemented in compiler-rt, but are hidden behind CRT_HAS_128BIT, so are not available in the shipped libclang_rt.a.

To reproduce the issue, on Ubuntu 20.04 (or any OS with libc-2.31 or later):

$ 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)

Thanks.

Sid

1 Like

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