This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[MIPS] Drop .dynsym symbol ordering requirement and nullify DT_GNU_XHASH

In August 2019, GNU ld gained support for DT_GNU_XHASH [1] (DT_GNU_HASH with an additional symbol index translation table (xlat)).
A gold patch [2] was posted but has not been applied.;a=commit;h=23c1c256ae7b0f010d0fcaff60682b620887b164 added glibc support.

Instead of diverging more from other architectures, I wonder whether we can drop .dynsym symbol ordering requirement, and just use regular DT_GNU_HASH. To this end, DT_MIPS_GOTSYM=DT_MIPS_SYMTABNO and DT_MIPS_LOCAL_GOTNO=0 should be sufficient for musl [3].

As I understand it, the benefits of the symbol ordering requirement come from the following:

1.  DT_MIPS_LOCAL_GOTNO relative relocation entries are saved. Relative relocations are common for -pie, but I really doubt the efficiency of DT_MIPS_LOCAL_GOTNO. Many relative relocations are not associated with a dynamic symbol. Adopting the unofficial SHT_RELR/DT_RELR [4] may be more beneficial.
2.  DT_MIPS_SYMTABNO-DT_MIPS_GOTSYM words are saved for JUMP_SLOT. The saving is also questionable because the number of JUMP_SLOT is usually small.
3. The DT_GNU_XHASH translation table seems to partly defeat the size saving purposes of 2. :)

Other than DT_MIPS_GOTSYM=DT_MIPS_SYMTABNO and DT_MIPS_LOCAL_GOTNO=0, I don't know whether glibc needs more things so that old can refuse new executables/shared objects. There may be multiple ways. I confess I don't understand the matters and MIPS enough, but something that jumped into my mind: bumping EI_ABIVERSION, introducing a new dynamic tag DT_MIPS_DYNSYM (think ppc32 Secure-PLT DT_PPC_GOT), .MIPS.abiflags, etc.

DT_GNU_XHASH may complicate --hash-style=gnu --hash-style=both semantics in clang driver/gcc specs as well.)

PS: I am not a MIPS user. I just don't want to see more ELF hacks invented to further complicate toolchains...

[1]: binutils support;a=commit;h=f16a9783c5f085443d806646074e9c06fdee9a88
[2]: gold patch
[3]: musl
[4]: SHT_RELR/DT_RELR!search/SHT_RELR/generic-abi/bX460iggiKg/w95-EVqFBAAJ supported by llvm-readelf / lld (--pack-dyn-relocs=relr;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]