]> granicus.if.org Git - llvm/commit
[llvm-readobj] Prefer ILT to IAT for reading COFF imports
authorShoaib Meenai <smeenai@fb.com>
Sun, 26 Mar 2017 17:10:11 +0000 (17:10 +0000)
committerShoaib Meenai <smeenai@fb.com>
Sun, 26 Mar 2017 17:10:11 +0000 (17:10 +0000)
commit87a993d16b69cfa84737efa9310261b6dff1b6c5
tree3d4ca3760406b85e44608ba2b6a147fc644249c2
parent9f6d8acec16251696266ff547815c7941fee901f
[llvm-readobj] Prefer ILT to IAT for reading COFF imports

We're seeing binutils ld produce binaries where the import address
table's NameRVA entry is actually a VA instead (i.e. it's already base
relocated), which llvm-readobj then chokes on. Both dumpbin and the
Windows loader are able to handle these binaries correctly, however, and
we can make llvm-readobj handle them correctly too by iterating the
import lookup table (which doesn't have a relocated NameRVA) rather than
the import address table.

The import lookup table and the import address table are supposed to be
identical on disk, and prior to r277298 the import lookup table would be
used by `llvm-readobj -coff-imports` anyway, so this shouldn't have any
functional change (except in the case of our malformed binaries). The
import lookup table can apparently be missing when using old Borland
linkers, so fall back to the import address table in that case.

Resolves PR31766.

Differential Revision: https://reviews.llvm.org/D31362

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298812 91177308-0d34-0410-b5e6-96231b3b80d8
tools/llvm-readobj/COFFDumper.cpp