https://sourceware.org/bugzilla/show_bug.cgi?id=25541
Bug ID: 25541
Summary: linking twice to the same msvc import library produces
an invalid IAT
Product: binutils
Version: 2.30
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: draymond at foxvalley dot net
Target Milestone: ---
It is sometimes necessary to link to the same library twice. For example:
gcc prog.o -lfoo -lbar -lfoo -o prog.exe
In this example foo.lib is an msvc import library for foo.dll and libbar.a is
an msvc static library. When the linker encounters -lfoo the first time it is
used to resolve undefined symbols in prog.o. When the linker encounters -lfoo
the second time it is used to resolve undefined symbols from objects linked
from libbar.a. The IAT for foo.dll therefore gets built in two passes.
The problem is this is not done correctly. During the first pass the IAT is
terminated with a NULL entry. During the second pass the new symbols are
appended after the NULL (rather than being inserted before the NULL). The
loader will be unable to find them there so they won't be fixed up and a crash
will subsequently occur.
--
You are receiving this mail because:
You are on the CC list for the bug.