<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - llvm-readobj fails to parse DLL import table"
href="https://llvm.org/bugs/show_bug.cgi?id=31766">31766</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>llvm-readobj fails to parse DLL import table
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Object
</td>
</tr>
<tr>
<th>Assignee</th>
<td>compnerd@compnerd.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>smeenai@fb.com
</td>
</tr>
<tr>
<th>CC</th>
<td>david.majnemer@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=17897" name="attach_17897" title="llvm-readobj -coff-imports fails on this DLL">attachment 17897</a> <a href="attachment.cgi?id=17897&action=edit" title="llvm-readobj -coff-imports fails on this DLL">[details]</a></span>
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>