GNU uses a different hashing function compared to the sys-V standard
function already provided in libObject. This is already used internally
in LLD for generating synthetic sections. This patch simply extracts
this definition and makes it availible to other users of libObject.
This is done in preparation for supporting symbol name lookups via the
GNU hash table.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This patch may not be needed. You can add it as part of the patch using hashGnu. The duplicate in lld/ELF does not matter. When the openmp patches are proven to be mature, we can consider removing duplicate code in lld/ELF.
I was planning on adding GNU_HASH support on top of the HASH support in the other patch and figured this was an easy part to factor out. I'm not sure what you mean by the OpenMP patches being mature, are you talking about abandoning D131309 and just doing it directly inside of the OpenMP runtime and then merging it back into Elf.h some other time?
LGTM, but don't land this without the other patches in the stack being accepted.
I'm not sure I understand @MaskRay's objection to removing it from LLD at the same time. There doesn't seem to be any benefit from having the code in two places, given that it's not made the rest of the LLD code more complex.