Refactor linker configuration to use ld_flavor instead of gnu_ld variable
Replaces the `gnu_ld` variable with `ld_flavor` in linker configuration for better accuracy and consistency.
This commit refactors GCC’s build system to replace the gnu_ld variable with a more general ld_flavor check. This change affects how various configurations detect and handle linker properties, ensuring more accurate detection of linker types and capabilities, particularly for options like --version-script and -soname by checking ld --help output.
In Details
The gnu_ld variable, a relic from earlier HAVE_GNU_LD checks, has been systematically removed. Its uses in configuration files like config.gcc and configure.ac are replaced by checks against ld_flavor or direct interrogation of ld --help output. This aligns the linker detection logic with modern practices, using a more granular approach than a simple GNU/non-GNU distinction.
- ld_flavor
- A variable or check within the build system that identifies the type or characteristics of the linker being used, allowing for more specific configuration adjustments.
- ld --help output
- The standard output generated when invoking a linker with the
--helpoption, which lists supported command-line flags and options. This is used by the build system to programmatically determine linker capabilities. - version-script
- A linker script that controls the symbols exported by a shared library. It allows fine-grained control over symbol visibility, which is crucial for managing library ABIs.
- soname
- A field in an ELF shared library header that specifies the name of the library as it should be referenced by linked executables. This is crucial for dynamic linking and library versioning.