Passing --with-ld causes problems when injecting a custom linker wrapper (similar to useMoldLinker) because it causes collect2 to check the --with-ld path (which is a hardcoded path to the standard linker wrapper) before $PATH, whereas with custom linker wrappers we want gcc to search $PATH. Because binutils-wrapper is not guaranteed to be present in $PATH, prepend it to $PATH in cc-wrapper. I verified that -print-prog-name=ld still prints an appropriate value. For example, when cross compiling for x86_64 on an aarch64 machine, the following is printed by the util-linux configure script (which uses -print-prog-name=ld [1]): checking for ld used by x86_64-unknown-linux-gnu-gcc... x86_64-unknown-linux-gnu-ld We still pass --with-as because the gcc spec file relies on this to find the assembler. This is probably fine for now as it is less common to want to override the assembler than the linker. [1] https://sources.debian.org/src/util-linux/2.41-4/m4/lib-ld.m4/?hl=59#L59
3.5 KiB
3.5 KiB