x86: Error out if the TLS relocation section can't be created
Fixes x86 linker to report an error when TLS relocation sections cannot be created.
This patch corrects an issue in the x86 linker where the failure to create or align TLS relocation sections (.rel.tls/.rela.tls) did not result in an error diagnostic. Previously, a false return value masked these failures, causing subsequent TLS-related setup to be skipped. The change ensures that such failures are now reported as fatal errors, preventing silent misconfigurations and improving build robustness, especially with newer C standards and GCC versions.
In Details
In _bfd_x86_elf_link_setup_gnu_properties, a prior return of false on failure to create/align TLS relocation sections (.rel.tls or .rela.tls) masked the issue. This resulted in htab->rel_tls_desc remaining NULL, skipping necessary PLT, .eh_frame, and .sframe setup. This patch replaces the return false with info->callbacks->fatal, ensuring that the linker terminates with an error, similar to other section creation failures in the same function.
- TLS
- Thread-Local Storage, a mechanism that allows each thread in a multithreaded program to have its own copy of a variable.
- Relocation section
- A section in an object file or executable that contains information about how addresses in the code or data need to be adjusted (relocated) after linking.
- ELF
- Executable and Linkable Format, a standard file format for object files, executables, and shared libraries used on many Unix-like systems.
- GNU properties
- Refers to specific extensions or conventions used by GNU tools, such as GNU properties in ELF sections for linker-specific behavior.
- PLT
- Procedure Linkage Table, a table used in ELF executables to resolve indirect function calls, typically to functions in shared libraries.