[LLD][COFF] Improve symbol table info for import thunk
authorAlvin Wong <alvin@alvinhc.com>
Tue, 20 Sep 2022 07:44:45 +0000 (10:44 +0300)
committerMartin Storsjö <martin@martin.st>
Tue, 20 Sep 2022 07:44:45 +0000 (10:44 +0300)
commit9509f4e6578b78b6380a07c0b1c846b9c0d1682a
tree37166098fbe37c6b2c10f0be21a2ea14743a1cdf
parent9a2b69764e115501785b498e0c1e871f2600c908
[LLD][COFF] Improve symbol table info for import thunk

Import thunks themselves contain a jump or branch, which is code by
nature. Therefore the import thunk symbol should be marked as function
type in the symbol table to help with debugging.

The `__imp_` import symbol associated to the import thunk is also useful
for debugging. However, when the import symbol isn't directly referenced
outside of the import thunk, it doesn't normally get added to the symbol
table. This change teaches LLD to add the import symbol explicitly.

Reviewed By: mstorsjo

Differential Revision: https://reviews.llvm.org/D134169
lld/COFF/Writer.cpp
lld/test/COFF/symtab.test