Alpha: Handle discarded GOT section.
Fixes a bug in the Alpha ELF backend where the linker would attempt to write out a discarded GOT section, leading to errors.
The Alpha ELF backend in BFD could attempt to write out a GOT section that had been discarded by the linker due to linker script changes or other reasons. This commit fixes this issue by checking if the GOT section has been discarded before attempting to write it out in elf64_alpha_final_link, avoiding potential errors during the final linking stage.
In Details
This commit addresses a bug in elf64-alpha.c, specifically in the elf64_alpha_final_link function. The GOT (Global Offset Table) is a crucial part of dynamic linking. The fix ensures that the linker doesn't try to write out a GOT section that has been marked as discarded. This scenario can arise from linker scripts that remove sections, and the change adds a check using bfd_is_abs_section to prevent errors.
For Context
This commit relates to the Alpha architecture support within the Binary File Descriptor (BFD) library. The Global Offset Table (GOT) is a data section used in shared libraries and executables to hold addresses of global variables. The linker may discard a GOT section if it is deemed unnecessary based on the final layout of the program. This patch prevents the linker from trying to write out a discarded GOT section, which would lead to an error.