dslm4515 / CMLFS

Clang-Built Musl Linux From Scratch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stage1 Clang uses GCC

dslm4515 opened this issue · comments

While in chroot and building the final system, I noticed stage1 clang uses GCC:

llvmtools 3.0.0 clang version 15.0.5
Target: x86_64-pc-linux-musl
Thread model: posix
InstalledDir: /llvmtools/bin
Configuration file: /llvmtools/bin/x86_64-pc-linux-musl.cfg
Found candidate GCC installation: /llvmtools/bin/../lib/gcc/x86_64-pc-linux-musl/12.2.0
Selected GCC installation: /llvmtools/bin/../lib/gcc/x86_64-pc-linux-musl/12.2.0

I only built GCC as a backup if a package is hard coded to compile with GCC only.
I have not completely built the final system, so I do not know what specific packages need GCC.

Looks like it might be dependent on the default linker, binutils' ld or LLVM's LLD: Why clang selects a gcc installation?

I can't remember if i saw Found candidate GCC installation posted when GCC was not installed in llvmtools.

But LLVM runtimes are used:

ld.lld: /usr/lib/Scrt1.o
ld.lld: /usr/lib/crti.o
ld.lld: /llvmtools/lib/clang/15.0.5/lib/x86_64-pc-linux-musl/clang_rt.crtbegin.o
ld.lld: /tmp/dummy-87d086.o
ld.lld: /llvmtools/lib/clang/15.0.5/lib/x86_64-pc-linux-musl/libclang_rt.builtins.a
ld.lld: /llvmtools/bin/../lib/x86_64-pc-linux-musl/libunwind.so
ld.lld: /usr/lib/libc.so
ld.lld: /llvmtools/lib/clang/15.0.5/lib/x86_64-pc-linux-musl/libclang_rt.builtins.a
ld.lld: /llvmtools/bin/../lib/x86_64-pc-linux-musl/libunwind.so
ld.lld: /llvmtools/lib/clang/15.0.5/lib/x86_64-pc-linux-musl/clang_rt.crtend.o
ld.lld: /usr/lib/crtn.o

Say, if I rename the "GCC installation" directory:

mv -v /llvmtools/lib/gcc /llvmtools/lib/gcc-BLOCKED

Now stage1 clang doesn't use GCC!

llvmtools 3.0.0 clang version 15.0.5
Target: x86_64-pc-linux-musl
Thread model: posix
InstalledDir: /llvmtools/bin
Configuration file: /llvmtools/bin/x86_64-pc-linux-musl.cfg
"/llvmtools/bin/clang-15" -cc1 -triple x86_64-pc-linux-musl -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disab>
clang -cc1 version 15.0.5 based upon LLVM 15.0.5 default target x86_64-pc-linux-musl

Renaming /llvmtools/lib/gcc and /usr/lib/gcc does not affect clang but forces clang not to use GCC start files or runtime.