Re: Optional machine prefix for programs in for -B dirs, matching Clang
> On Aug 4, 2021, at 3:32 AM, Jonathan Wakely via Gcc wrote: > > On Wed, 4 Aug 2021, 08:26 John Ericson wrote: > >> 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. >> > > Doesn't GCC automatically look for those commands in the --prefix directory > that you configure GCC with? Or is that only for native compilers? It does. That's how I configure my cross-builds. paul
Re: Optional machine prefix for programs in for -B dirs, matching Clang
On Wed, 4 Aug 2021 at 08:41, John Ericson wrote: > > On Wed, Aug 4, 2021, at 3:32 AM, Jonathan Wakely via Gcc wrote: > > > > Doesn't GCC automatically look for those commands in the --prefix directory > > that you configure GCC with? Or is that only for native compilers? > > > > It will search only if --with-*=... was not passed, and it will never prefix > the query. So yes in practice for cross compilers people do the --with-* and > no searching happens, and for native compilers no one bothers and searching > does happen. But to be a pedant strictly speaking the behavior is independent > of whether the compiler is host == target or not. I've just checked, and I have a few cross-compilers (for testing purposes) where I configure binutils and gcc with the same --prefix, and don't use --with-as or --with-ld, and GCC finds the right assembler and linker. So do you need to change anything in GCC? Can't you just not use --with-as and --with-ld if they are causing problems?
Re: Optional machine prefix for programs in for -B dirs, matching Clang
On Wed, Aug 4, 2021, at 3:32 AM, Jonathan Wakely via Gcc wrote: > > Doesn't GCC automatically look for those commands in the --prefix directory > that you configure GCC with? Or is that only for native compilers? > It will search only if --with-*=... was not passed, and it will never prefix the query. So yes in practice for cross compilers people do the --with-* and no searching happens, and for native compilers no one bothers and searching does happen. But to be a pedant strictly speaking the behavior is independent of whether the compiler is host == target or not.
Re: Optional machine prefix for programs in for -B dirs, matching Clang
On Wed, 4 Aug 2021, 08:26 John Ericson wrote: > 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. > Doesn't GCC automatically look for those commands in the --prefix directory that you configure GCC with? Or is that only for native compilers?
Optional machine prefix for programs in for -B dirs, matching Clang
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//) 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