Don’t hardcode paths to as and ld into gcc
Apertis toolchain needs to be co-installable with distribution-provided
toolchain or any other toolchain installed into /usr/bin
. It should not
attempt to call the assembler or linker from /usr/bin
, but instead
should only use its own binutils.
The default Debian packaging of gcc sets --with-as=
and --with-ld=
which override the built in path prefix handling of GCC. Without
those settings, GCC attempts to find as and ld as follows:
For each subprogram to be run, the compiler driver first tries the
-B
prefix, if any. If that name is not found, or if-B
is not specified, the driver tries two standard prefixes,/usr/lib/gcc/
and/usr/local/lib/gcc/
. If neither of those results in a file name that is found, the unmodified program name is searched for using the directories specified in yourPATH
environment variable.
--with-as
and --with-ld
configure internal settings, DEFAULT_COMPILER
and
DEFAULT_LINKER
, which lead to the following:
#ifdef DEFAULT_ASSEMBLER
if (! strcmp (name, "as") && access (DEFAULT_ASSEMBLER, mode) == 0)
return xstrdup (DEFAULT_ASSEMBLER);
#endif
#ifdef DEFAULT_LINKER
if (! strcmp (name, "ld") && access (DEFAULT_LINKER, mode) == 0)
return xstrdup (DEFAULT_LINKER);
#endif
The rest of the logic gets short-circuited and never runs.
We remove those configuration options and let GCC decide at the runtime.
Now, since we don’t use Ada, Fortran 95, GCC Go or ObjC, we can safely disable those.
See Phabricator task: https://phabricator.apertis.org/T6347