[PATCH 0/3] PE: Add --short-implib to dlltool and ld [PR34527]
Zhongteng Gui
dragon-archer@outlook.com
Wed Nov 25 10:26:03 GMT 2026
GNU ld can already read PE short import libraries. This series adds
--short-implib to dlltool and ld so they can also write them for i386
and x86-64. The option applies to dlltool --output-lib and ld
--out-implib. The default import library format is unchanged.
The first patch adds a shared BFD writer. It stores each import as a
short record on disk and uses the existing archive map code to index
the symbols. The next two patches connect dlltool and ld to the writer.
The ld tests link against libraries produced by both tools, check the
resulting import tables, and compare the two archives in deterministic
mode.
I've verified that the resulting import libraries are compatible with
MSVC and LLVM.
Zhongteng Gui (3):
bfd: Add a PE short import library writer [PR34527]
dlltool: Add --short-implib [PR34527]
ld: Add --short-implib for PE targets [PR34527]
bfd/coff-bfd.c | 273 ++++++++++++++++++
bfd/coff-bfd.h | 13 +
binutils/NEWS | 3 +
binutils/dlltool.c | 98 ++++++-
binutils/doc/binutils.texi | 7 +
ld/NEWS | 3 +
ld/deffile.h | 1 +
ld/deffilep.y | 1 +
ld/emultempl/pe.em | 5 +
ld/emultempl/pep.em | 5 +
ld/ld.texi | 8 +
ld/ldlex.h | 1 +
ld/pe-dll.c | 86 +++++-
ld/pe-dll.h | 1 +
ld/pep-dll.c | 1 +
ld/pep-dll.h | 1 +
ld/testsuite/ld-pe/pe.exp | 41 +++
.../ld-pe/short-implib-stdcall-user.s | 7 +
ld/testsuite/ld-pe/short-implib-stdcall.d | 14 +
ld/testsuite/ld-pe/short-implib-stdcall.def | 3 +
ld/testsuite/ld-pe/short-implib-stdcall.s | 4 +
21 files changed, 551 insertions(+), 25 deletions(-)
create mode 100644 ld/testsuite/ld-pe/short-implib-stdcall-user.s
create mode 100644 ld/testsuite/ld-pe/short-implib-stdcall.d
create mode 100644 ld/testsuite/ld-pe/short-implib-stdcall.def
create mode 100644 ld/testsuite/ld-pe/short-implib-stdcall.s
--
2.56.1.windows.1
More information about the Binutils
mailing list