build: Simplify in-tree gld version checks
GCC build system simplifies and unifies checks for in-tree GNU linker versions.
This commit refactors the GCC build system to simplify repetitive checks for the version of the in-tree GNU linker (gld). Two new shell functions, gcc_fn_gld_min_version and gcc_fn_gld_elf_min_version, are introduced in configure.ac. These functions provide a unified and more readable way to ascertain if the bundled linker meets minimum version requirements for specific features, improving maintainability.
In Details
The build system's configure.ac previously contained numerous inline checks to determine if an in-tree GNU linker (gld) was recent enough for certain features. This commit abstracts these checks into two shell functions, gcc_fn_gld_min_version and gcc_fn_gld_elf_min_version. This is a DRY (Don't Repeat Yourself) refactoring that improves maintainability of the build configuration logic without altering its behavior, tested across various build scenarios including different binutils versions.
- in-tree gld
- The GNU linker (ld) that is bundled and built directly from the GCC source tree, as opposed to using a system-installed linker.
- configure.ac
- A file used by the Autoconf tool to generate the
configurescript. It contains logic for checking system features, compiler capabilities, and dependencies. - Autoconf
- A tool that automatically adapts packaged software to the specific needs of a local system. It generates shell scripts that perform numerous checks on the system to adapt the build process.
- shell functions
- Reusable blocks of commands within a shell script. They help in organizing code, avoiding repetition, and improving readability.
- DRY
- Don't Repeat Yourself. A software development principle aiming to reduce repetition of all kinds of artifacts, typically by abstracting common concepts.