[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/25374] New: linking to msvc import library results in invalid ID
draymond at foxvalley dot net
[Bug ld/25374] New: linking to msvc import library results in invalid IDT entry
Sun, 12 Jan 2020 21:39:11 +0000
Bug ID: 25374
Summary: linking to msvc import library results in invalid IDT
Assignee: unassigned at sourceware dot org
Reporter: draymond at foxvalley dot net
Target Milestone: ---
I have a DLL that I built and linked with i686-w64-mingw32-gcc. It imports
functions from two other images (an MSVC-built EXE and DLL). I linked against
the import libraries of the MSVC images (foo.lib and bar.lib) using
'-lfoo -lbar' on the command line. No errors were reported. When I loaded
the MinGW DLL and called into it I experienced a crash.
The MinGW DLL was able to call functions in the MSVC DLL but when it tried to
call a function in the MSVC EXE the import library thunk pulled an invalid
address from the IAT (import address table). It appears that the loader did
not fill in the IAT.
Examination of the .idata section in the MinGW DLL revealed that ILT and IAT
tables were present for both the MSVC DLL and EXE. The IDT entry (which
contains pointers to the ILT and IAT) was correct for the MSVC DLL. The IDT
entry for the MSVC EXE, however, was incorrect. The ILT and IAT pointers
pointed to the NULL entries at the end of the tables rather than the first
For this reason 'objdump -p mingw.dll' shows the import table for the MSVC
EXE as empty. This also explains why the loader did not fill in the IAT.
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/25374] New: linking to msvc import library results in invalid IDT entry,
draymond at foxvalley dot net <=