This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Provide the GNU hash function in libObject
ClosedPublic

Authored by jhuber6 on Aug 25 2022, 12:02 PM.

Details

Summary

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.

Diff Detail

Event Timeline

jhuber6 created this revision.Aug 25 2022, 12:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2022, 12:02 PM
jhuber6 requested review of this revision.Aug 25 2022, 12:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2022, 12:02 PM

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.

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?

jhenderson accepted this revision.Aug 26 2022, 12:26 AM

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.

This revision is now accepted and ready to land.Aug 26 2022, 12:26 AM
MaskRay accepted this revision.Aug 30 2022, 9:03 PM
This revision was landed with ongoing or failed builds.Sep 5 2022, 9:05 AM
This revision was automatically updated to reflect the committed changes.