Optional machine prefix for programs in for -B dirs, matching Clang

John Ericson mail@johnericson.me
Wed Aug 4 07:25:33 GMT 2021


Problem:

It's somewhat annoying to have to tell GCC --with-as=... --with-ld=... just to prefix those commands the same way GCC is prefixed.

In particular, when doing host-only build (skipping all target libraries), one otherwise doesn't need the target-specific binutils to be yet built, but --with-as and --with-ld will complain if the referenced exes cannot be found. This might sound esoteric, but as someone that spends a lot of time optimizing bootstrap dependency graphs for incrementality / parallelism, it is quite a real-world annoyance.

Solution:

I think the solution is to stop making cross compilers rely on these --with-flags to do the obvious things. Executables like `collect2` hidden within a libexesubdir (libexec/gcc/<machine>/<version>) have no need for prefixing, but the assembler and linker are very much public-facing executables in their own right, and usually are prefixed.

Per [1], Clang does in fact look up prefixed exes against -B across the board. Making GCC look up exes that same way seems like a fine solution too.

What do you all think?

John 

[1]: https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-b-prefix


More information about the Gcc mailing list