This is an archive of the discontinued LLVM Phabricator instance.

[LLD][COFF] Ignore DEBUG_S_XFGHASH_TYPE/VIRTUAL
ClosedPublic

Authored by thieta on Jul 8 2022, 8:51 AM.

Details

Summary

These are new debug types that ships with the latest
Windows SDK and would warn and finally fail lld-link.

The symbols seems to be related to Microsoft's XFG
which is their version of CFG. We can't handle any of
this yet, so for now we can just ignore these types
so that lld doesn't fail with a new version of Windows
SDK.

Fixes: #56285

Diff Detail

Event Timeline

thieta created this revision.Jul 8 2022, 8:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 8 2022, 8:51 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
thieta requested review of this revision.Jul 8 2022, 8:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 8 2022, 8:51 AM

I think this looks mostly good to me.

lld/COFF/PDB.cpp
816

You mentioned elsewhere that there doesn't seem to be any testcases for other similarly ignored ones - I think it's fair to add this without an exact testcase here too.

llvm/lib/DebugInfo/PDB/Native/FormatUtil.cpp
70

Is there any testcase for these ones, where the new types could easily be added?

thieta added inline comments.Jul 10 2022, 7:03 AM
llvm/lib/DebugInfo/PDB/Native/FormatUtil.cpp
70

I grepped for several of them and there doesn't seem to be any tests for this.

rnk added a comment.Jul 11 2022, 4:00 PM

We spent some effort to make clang's assembly output somewhat readable. You should be able to adapt it to manually add one of these subsections and make a test case. In this example, see the subsection labels and .long directives:
https://gcc.godbolt.org/z/9o5Tra9W3

You can add subsections to an existing .debug$S section with these directives:

  .long 0xFF
  .long .Lmyend0-.Lmybeg0 # Subsection size
.Lmybeg0:
  .fill 16 # Some data, just to make it non-empty
.Lmyend0:
  .p2align 2

  .long 0x100
  .long .Lmyend1-.Lmybeg1 # Subsection size
.Lmybeg1:
  .fill 16 # Some data, just to make it non-empty
.Lmyend1:
  .p2align 2
thieta updated this revision to Diff 450618.Aug 7 2022, 6:07 AM

Added tests and fixed pdb-unknown-subsection test

thieta added a comment.Aug 7 2022, 6:09 AM

You can add subsections to an existing .debug$S section with these directives:

  .long 0xFF
  .long .Lmyend0-.Lmybeg0 # Subsection size
.Lmybeg0:
  .fill 16 # Some data, just to make it non-empty
.Lmyend0:
  .p2align 2

  .long 0x100
  .long .Lmyend1-.Lmybeg1 # Subsection size
.Lmybeg1:
  .fill 16 # Some data, just to make it non-empty
.Lmyend1:
  .p2align 2

Thanks - this put me on the right path and I was able to basically copy the pdb-unknown-subsection test and adapt it to check for the XFG subsections.

Have a look at this if you can please - I would like to include this in the 15.x release if possible.

rnk accepted this revision.Aug 8 2022, 6:33 AM

lgtm, thanks again!

This revision is now accepted and ready to land.Aug 8 2022, 6:33 AM
This revision was landed with ongoing or failed builds.Aug 8 2022, 6:54 AM
This revision was automatically updated to reflect the committed changes.