[llvm-bugs] [Bug 31766] New: llvm-readobj fails to parse DLL import table

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 25 20:01:03 PST 2017


https://llvm.org/bugs/show_bug.cgi?id=31766

            Bug ID: 31766
           Summary: llvm-readobj fails to parse DLL import table
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Object
          Assignee: compnerd at compnerd.org
          Reporter: smeenai at fb.com
                CC: david.majnemer at gmail.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 17897
  --> https://llvm.org/bugs/attachment.cgi?id=17897&action=edit
llvm-readobj -coff-imports fails on this DLL

% cat ro.c
long __stdcall RoGetActivationFactory(void *, void *, void **);
void f() { RoGetActivationFactory(0, 0, 0); }

% clang -target i686-windows -c ro.c
% ld.custom -shared -o ro.dll ro.o
/path/to/WindowsSDK/10/SDK/Lib/10.0.10586.0/um/x86/runtimeobject.lib
% llvm-readobj -coff-imports ro.dll

File: ro.dll
Format: COFF-i386
Arch: i386
AddressSize: 32bit
Import {
  Name: api-ms-win-core-winrt-l1-1-0.dll
  ImportLookupTableRVA: 0x303C
  ImportAddressTableRVA: 0x3044

Error reading file: Invalid data was encountered while parsing the file.

I apologize for this not being a self-contained example. The Windows SDK used
is from a standard installation (I can attach runtimeobject.lib if desired).
ld.custom is a custom internal linker based on mingw ld; unfortunately, I
cannot reproduce the issue with stock mingw ld (or link or lld). However,
dumpbin (from Visual Studio) is able to parse this DLL fine, so llvm-readobj
should be too. I'm attaching the problematic DLL instead.

I bisected the error to r277298; specifically, its changing
imported_symbol_begin and imported_symbol_end to reference the Import Address
Table rather than the Import Lookup Table. I'm guessing there's some mix-up
between the two elsewhere which was exposed by that change.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170126/6bdd47c0/attachment-0001.html>


More information about the llvm-bugs mailing list