This is an archive of the discontinued LLVM Phabricator instance.

[Orc][Coff] Skip registration of voltbl sections
ClosedPublic

Authored by rriddle on Jun 9 2023, 11:50 AM.

Details

Summary

We're getting asserts for duplicate section registration during
linking which stems back to these sections. From previous
discussions, it seems like these are metadata sections that can
be dropped. See the discussion in D116474 and
https://bugs.llvm.org/show_bug.cgi?id=45111.

Diff Detail

Event Timeline

rriddle created this revision.Jun 9 2023, 11:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2023, 11:50 AM
Herald added subscribers: Enna1, bollu. · View Herald Transcript
rriddle requested review of this revision.Jun 9 2023, 11:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2023, 11:50 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
lhames added a reviewer: sunho.Jun 9 2023, 1:27 PM
lhames added a comment.Jun 9 2023, 1:37 PM

If I understand the bug reports / docs correctly (I only had time to skim them) we probably want a principled fix for duplicate and metadata sections in the long term.

If that's right then I'm happy for this fix to land in the short term, but we should probably file a follow-up issue and add a FIXME.

@sunho -- Have you come across these sections before?

sunho added a comment.Jun 9 2023, 2:02 PM

I haven't gotten this before, but it looks safe to skip it looking at the discussion. We wouldn't want to do it inside orc runtime tho. We can skip it around here: https://github.com/llvm/llvm-project/blob/main/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp#L139

I haven't gotten this before, but it looks safe to skip it looking at the discussion. We wouldn't want to do it inside orc runtime tho. We can skip it around here: https://github.com/llvm/llvm-project/blob/main/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp#L139

Nice, thanks for the pointer. I'll move the check to there.

For reference, we can't even load the coff platform right now (running vs2022) because it asserts immediately.

rriddle updated this revision to Diff 530075.Jun 9 2023, 2:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2023, 2:09 PM

@sunho Is there a good reference for using the coff platform? Right now I'm not quite sure what's the best place to look at for usage inspiration. Thanks a lot for the review!

sunho added a comment.Jun 9 2023, 2:22 PM

coff platform just landed last year, so it can be quite cranky. It is stable enough to link basic microsoft STL or capstone disassembler obj files but these are only real world applications I tested out. Please let me know if there's any issue.

Regarding how to use it, llvm-jitlink has some usage of coff platform. https://github.com/llvm/llvm-project/blob/2adf9c9f502acacf3b846cbf64d8a4739c803de6/llvm/tools/llvm-jitlink/llvm-jitlink.cpp#L1011 You can also use ExecutorNativePlatform if you're using LLJIT.

rriddle updated this revision to Diff 530098.Jun 9 2023, 3:30 PM

@sunho I think this should be ready for review again, thanks!

sunho accepted this revision.Jun 12 2023, 10:31 PM

LGTM

This revision is now accepted and ready to land.Jun 12 2023, 10:31 PM
This revision was landed with ongoing or failed builds.Jun 13 2023, 11:09 PM
This revision was automatically updated to reflect the committed changes.