loongarch: Use linksr stubs bfd rather than linker aligns bfd
Loongarch adopts common linker stub code, renaming 'linker aligns' to 'linker stubs'.
This patch refactors the Loongarch target in binutils to use the common code for creating linker stub BFDs, renaming the existing ‘linker aligns’ to ‘linker stubs’. This change allows the stub BFD to be created in all linker modes, not just relocatable linking, making it available for dynamic sections as well. A fix to the testsuite is included to accommodate the change in orphan placement.
- proposer
Proposes using the common linker stub BFD code for Loongarch, renaming 'linker aligns' to 'linker stubs' and enabling stub BFD creation in all linker modes.
“Loongarch may as well use the common code to create its "linker aligns" bfd, which does mean a name change to "linker stubs". Another change made by this patch is that the linker stubs bfd is created in all modes of linker, not just for relocatable linking as was "linker aligns". That makes the bfd available for dynamic sections too, which I think is a good idea, but it does require a fix to the…”
In Details
This patch modifies the Loongarch target support in binutils. Previously, it used a specific mechanism called 'linker aligns' to create a BFD (Binary File Descriptor) for handling certain relocation types. This patch transitions Loongarch to use the more generic 'linker stubs' BFD implementation, which is part of common code shared across targets. This change means the stub BFD will be created in all linker modes (not just relocatable) and will be available for dynamic linking scenarios. The renaming from 'linker aligns' to 'linker stubs' reflects this broader applicability.
- Loongarch
- A 64-bit RISC instruction set architecture.
- BFD
- Binary File Descriptor library, a part of binutils that provides a common interface for reading and writing various executable binary file formats.
- linker stub
- A small piece of code or data generated by the linker to handle specific relocation types or dynamic linking requirements. The term 'linker aligns' was a previous name for this concept in some targets.
- relocatable linking
- The process of creating an object file that can be linked with other object files and later relocated in memory by a dynamic linker or loader.
- dynamic sections
- Sections within an executable or shared library that are processed by the dynamic linker at runtime, such as .dynsym (dynamic symbols) and .rel.dyn (dynamic relocations).
- orphan placement
- Refers to how the linker handles sections or symbols that do not have explicit placement rules in the linker script, potentially affecting their order in the output file.