This is a RFC on something I wanted to add to the clang driver a while but not sure if there is something I am missing.
I maintain and distribute an internal toolchain based on clang/llvm. This toolchain is cross compile only, so I ship a sysroot for each target with clang today. But in order for clang to use the correct sysroot per target I have to pass -sysroot to clang in each invocation. To make this easier I have to add a shell script per target that sets the right sysroot and -target arguments.
When this is done clang actually finds the compiler-rt and libc++ by looking in the resource-dir for a directory with the target name.
I propose to expand this to also look for a sysroot under the resource-dir and use that if sysroot argument is not patched. This would allow me to just symlink clang to x86_64-vendor-linux-musl-clang
and not need the wrappers at all.
Can anyone see any downsides to this or something I miss? Would be happy to write this patch if it’s something people would not mind.