[PATCH] D68352: [lld] Handle sections without chunks during PDB generation

Stefan Schmidt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 6 23:34:29 PDT 2019


thrimbor added a comment.

Thanks for taking the time to give me some suggestions.

I dug in a bit more, and it seems that the empty section is called ".idata$6". I caught its creation by adding an assert to `createPartialSection()`, and it's created by `addSyntheticIdata()`: `add(".idata$6", idata.hints);`. `idea.hints` is a std::vector of chunks, and its size is zero, so that's where this section originates from.
I then tried to look up where idata.hints is supposed to get populated, and it seems that the only place adding elements to it is `IdataContents::create()` in `COFF/DLL.cpp`. Now, if I'm understanding that method correctly, it's supposed to add chunks to the hints-vector for every function imported by name (as opposed to by ordinal)? If so, then that's probably why our project triggers the problem - we're producing binaries for the original Xbox, which doesn't have real support for dynamic linking, but we're using an import library (which imports by ordinals) for calling into the kernel (the kernel resolves these imports when loading an .xbe-file).
Inspecting that method somewhat further, I noticed that, while "lookups" and "addresses" get a terminating null entry, "hints" doesn't get one - changing the code to add one resolves the assert obviously, but after reading https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#the-idata-section it seems to me that there should not be such an entry for the hints-table. Is it allowed to have an empty hints table? What would the correct behavior for the linker be here?
If I'm correct, we're the only ones triggering the assert because we don't have a single import by name.

Can you give me some further feedback on my theories here?


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68352/new/

https://reviews.llvm.org/D68352





More information about the llvm-commits mailing list