LoongArch tests: Pin hash style for DT_RELR shared objects
Pins the hash style to 'both' for LoongArch DT_RELR shared library tests.
This patch pins the hash style to --hash-style=both for three LoongArch DT_RELR shared library tests. This is necessary because the tests rely on specific symbol indices in the .rela.dyn section, which are dependent on the linker’s hash style (GNU vs. SYSV). The bare-metal default is SYSV, but the tests were written against the GNU hash style. Pinning the style ensures consistent test results and is a prerequisite for the following patch that enables shared library and PIE support for LoongArch.
- proposer
Pins the hash style to `--hash-style=both` for LoongArch DT_RELR shared tests to ensure consistent symbol indexing.
“These three tests match .rela.dyn entries with the symbol index of r_info written out in full, and that index depends on the default hash style. A GNU hash table requires the undefined symbols to precede the defined ones in .dynsym, so an undefined weak in these tests sorts to index 2 with --hash-style=both or gnu, and to the end of the table with sysv. The expectations were written against the…”
In Details
This patch modifies the testsuite for LoongArch bare-metal targets. Specifically, it pins the hash style used by the linker to --hash-style=both for three tests involving DT_RELR relocations in shared objects. This ensures that the symbol indices within the relocation entries are consistent, as the default hash style for bare-metal targets (sysv) differs from the style expected by these tests (gnu/both). This is a preparatory step for enabling PIE and shared library support.
- DT_RELR
- A dynamic tag in an ELF file that indicates the presence and location of RELR relocations, a more compact form of relocation used in some systems.
- hash style
- Refers to the algorithm used by the linker to construct symbol hash tables, which are used for efficient symbol lookup in shared libraries. Common styles include 'sysv', 'gnu', and 'both'.
- symbol index
- An integer identifier for a symbol within an object file's symbol table.
- relocation
- Information in an object file that describes how to modify addresses and other references when the code is linked or loaded into memory.
- bare-metal target
- A system where the software runs directly on the hardware without an underlying operating system.