This is an archive of the discontinued LLVM Phabricator instance.

[ORC] Move LinkGraphMaterializationUnit for testing (NFC)
AbandonedPublic

Authored by keith on Dec 2 2022, 12:51 PM.

Details

Reviewers
dblaikie
lhames
Summary

Based on the discussion in https://reviews.llvm.org/D130221

Diff Detail

Event Timeline

keith created this revision.Dec 2 2022, 12:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 2 2022, 12:51 PM
keith requested review of this revision.Dec 2 2022, 12:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 2 2022, 12:51 PM
keith added a comment.Dec 2 2022, 12:52 PM

this isn't exactly what was discussed in https://reviews.llvm.org/D130221 but it seems like making LinkGraphMaterializationUnit accessible is nicer for unit tests where we only care to test its behavior vs the whole system. lmk what you think. Locally I also have a patch to use MachOPlatform::isInitializerSection instead of the local version here but I wanted to prove the tests pass before and after so I didn't include it yet.

Yeah, this is the sort of testing /I/ think would be nice to have, but hope @lhames can take a look/give his perspective.

lhames added a comment.Dec 2 2022, 5:03 PM

I haven't had a chance for a proper read yet -- will do that when I get back from vacation next week.

My first thought is that, following the reasoning in https://reviews.llvm.org/D130221, we should aim to merge MachOPlatform::isInitializerSection and hasMachOInitSection into a new function in ObjectFileInterface.h and use that.

If we do that we may find that this is testable in LinkGraphTests.cpp rather than ObjectLinkingLayer.

I haven't had a chance for a proper read yet -- will do that when I get back from vacation next week.

My first thought is that, following the reasoning in https://reviews.llvm.org/D130221, we should aim to merge MachOPlatform::isInitializerSection and hasMachOInitSection into a new function in ObjectFileInterface.h and use that.

If we do that we may find that this is testable in LinkGraphTests.cpp rather than ObjectLinkingLayer.

Ah, awesome - yeah, that does look like a good thing to deduplicate.

keith abandoned this revision.Dec 5 2022, 10:23 AM

dropping this one and went for the discussed approach in https://reviews.llvm.org/D139347 which has no overlap with this one