clang requires a few gcc libraries, which supposed to be privided by compiler-rt
Hello, I noticed something strange.
Some of the crt files should come from compiler-crt, but these ones come
with gcc:
crtprec32.o
crtendS.o
crtbeginS.o
crtfastmath.o
crtprec64.o
crtbeginT.o
crtprec80.o
crtbegin.o
crtend.o
Above libs are not usable without gcc libs (Thus I guess GPL is still enforced?).
b17wise@eula47 /tmp % clang Hello.c -o hello -fuse-ld=/usr/bin/ld.lld
ld.lld: error: cannot open crtbeginS.o: No such file or directory
ld.lld: error: unable to find library -lgcc
ld.lld: error: unable to find library -lgcc_s
ld.lld: error: unable to find library -lgcc
ld.lld: error: unable to find library -lgcc_s
ld.lld: error: cannot open crtendS.o: No such file or directory
clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
b17wise@eula47 /tmp % sudo apk add gcc
[sudo] password for b17wise:
(1/8) Installing binutils (2.32-r0)
(2/8) Installing isl (0.18-r0)
(3/8) Installing libgomp (8.3.0-r0)
(4/8) Installing libatomic (8.3.0-r0)
(5/8) Installing mpfr3 (3.1.5-r1)
(6/8) Installing mpc1 (1.1.0-r0)
(7/8) Installing gcc (8.3.0-r0)
(8/8) Installing gcc-zsh-completion (5.7.1-r0)
Executing busybox-1.30.1-r2.trigger
OK: 2012 MiB in 482 packages
b17wise@eula47 /tmp % clang Hello.c -o hello -fuse-ld=/usr/bin/ld.lld
b17wise@eula47 /tmp % ./hello
Hello, Alpine
b17wise@eula47 /tmp % apk info -L gcc | grep -e *crtendS*
b17wise@eula47 /tmp % apk info -L gcc | grep crt
usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/crtbegin.o
usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/crtend.o
usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/crtbeginT.o
usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/crtbeginS.o
usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/crtprec32.o
usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/crtprec80.o
usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/crtprec64.o
usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/crtendS.o
usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/crtfastmath.o
Full log can be found here: http://0x0.st/z2k6.txt
Also there was an issue raised in 2017: https://reviews.llvm.org/D28791
(from redmine: issue id 10627, created on 2019-06-27)