Is their location hardcoded into gcc code or does gcc just call as and we must have as location in our PATH variable?
And in the latter case, how could we create two completely separate gcc toolchains? I mean, how can we make gcc-A invoke as-A and gcc-B invoke as-B if as-A and as-B are both called as?
Some of the paths (e.g., to
cc1) are compiled in. Others (e.g.,as) use normal lookup in $PATH. This can vary depending on the options GCC is configured with.You can tell fairly easily by running with
strace, and grepping forexec|stat.That is a call to cc1 by a compiled-in path, as you can see from the
lack of looking for it. Its also not in $PATH.
That is looking for
asin $PATH. You can tell because its trying eachlocation in $PATH in order.
I’ve omitted a lot of strace output—even with just stat and exec, its
several pages long.
Running
gcc -vwill show you some of the compiled-in paths (as part of the configure line).