This is the mail archive of the binutils@sourceware.org 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]

Re: [PATCH] MIPS support for --hash-style=gnu


Hi, everybody,

On N64, the layout of .gnu.xhash cause unaligned access at bitmask field, so I suggest we remove ngnusyms at the header of the .gnu.xhash to avoid the unaligned access. Since MIPS ELF requires DT_MIPS_SYMTABNO Tag is present with
dynsymcount, so I think ngnusyms can be taken by dynsymcount - symndx

    // Part 0: .gnu.hash header
    Elf32_Word  nbuckets;  // number of hash table buckets
Elf32_Word symndx; // number of initial .dynsym entires skipped in chains[] (and xlat[])
    Elf32_Word  maskwords; // number of ElfW(Addr) words in bitmask
Elf32_Word shift2; // bit shift of hashval for second Bloom filter bit
    // Part 1: .gnu.hash Bloom filter
    ElfW(Addr)  bitmask[maskwords];  // 2 bit Bloom filter on hashval
    // Part 2: .gnu.hash buckets
    Elf32_Word  buckets[nbuckets];  // indices into chains[]
    // Part 3: .gnu.hash chains
Elf32_Word chains[ngnusyms]; // consecutive hashvals in a given bucket; last entry in chain has LSB set
    // Part 4: .gnu.xhash translation table
Elf32_Word xlat[ngnusyms]; // parallel to chains[]; index into .dynsym

below is the patch removing ngnusyms

https://github.com/heiher/binutils-mips/commit/ceefe8ac5f52285d2c98a43a66c2d7d31574b3f4

https://github.com/heiher/glibc-mips/commit/db33de9af675f9851c0941ca186baf87c79d8ab9

any suggestion?
........

In practice, though, the .gnu.xhash section is virtually identical to .gnu.hash. [9]

    // Part 0: .gnu.xhash header
Elf32_Word ngnusyms; // number of entries in chains (and xlat); dynsymcount=symndx+ngnusyms
    // Part 1: .gnu.hash header
    Elf32_Word  nbuckets;  // number of hash table buckets
Elf32_Word symndx; // number of initial .dynsym entires skipped in chains[] (and xlat[])
    Elf32_Word  maskwords; // number of ElfW(Addr) words in bitmask
Elf32_Word shift2; // bit shift of hashval for second Bloom filter bit
    // Part 2: .gnu.hash Bloom filter
    ElfW(Addr)  bitmask[maskwords];  // 2 bit Bloom filter on hashval
    // Part 3: .gnu.hash buckets
    Elf32_Word  buckets[nbuckets];  // indices into chains[]
    // Part 4: .gnu.hash chains
Elf32_Word chains[ngnusyms]; // consecutive hashvals in a given bucket; last entry in chain has LSB set
    // Part 5: .gnu.xhash translation table
Elf32_Word xlat[ngnusyms]; // parallel to chains[]; index into .dynsym
..........


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