GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc/driver

GCC now searches for machine-prefixed tools in additional locations.

GCC's `find_a_program` function now includes machine-prefixed program names (e.g., `x86_64-linux-gnu-as`) in its search paths for cross-compilation.

The find_a_program utility in GCC now intelligently searches for machine-prefixed programs, such as x86_64-linux-gnu-as, alongside existing search patterns. This enhancement addresses a long-standing issue in cross-compilation environments where GCC’s previous search logic often led to confusion by prioritizing unprefixed tools or platform-specific directory structures. By aligning with common cross-compilation practices and similar behaviors in other toolchains like Clang/LLVM, GCC makes tool discovery more intuitive and reliable for developers working with multiple architectures.

In Details

GCC's find_a_program function, located within the driver component, is responsible for locating external tools like assemblers and linkers. This commit modifies its search algorithm within gcc.cc to insert an additional search path: path/$machine-prog. Previously, the search prioritized path/$machine/$version/prog, path/$machine/prog, and finally path/prog. The change specifically targets scenarios where programs are typically installed with a machine-prefix (e.g., aarch64-linux-gnu-ld) rather than nested in machine-specific directories, improving interoperability with existing…

For Context

When you compile a program, GCC often needs to call other specialized tools like an assembler (to turn assembly code into machine code) or a linker (to combine compiled code into an executable). The find_a_program function inside GCC's driver is like a built-in search engine that locates these external tools based on a set of rules. This change updates those rules. Previously, GCC looked in very specific directories, sometimes checking for tools without any prefix (like as) which could pick up the wrong tool when you're compiling for a different computer architecture (cross-compiling). Now, GCC is smarter: it also explicitly looks for tools with a 'machine prefix' like arm-linux-gnueabi-as. This makes it much easier and less error-prone to compile programs for different systems without manually specifying every tool's path.

Filed Under: cross-compilationtoolchainsearch-pathsdriverusability