binutils Newspaper
NOVEMBER 30, 2026
ld — Proposed

ld: Add --short-implib for PE targets [PR34527]

Introduces a `--short-implib` option for PE targets to create import libraries with concise member names.

This patch, the third in a series, adds the --short-implib option to the PE target linker. This option allows the creation of import libraries where the members (exported symbols) have shorter, more compact names. It ensures that these short import libraries are deterministic and compatible with existing tools like dlltool. New test cases are included to verify the functionality, including scenarios with decorated names and stdcall fixups.

In the Thread 1 participant
  1. Zhongteng Gui <dragon-archer@outlook.com> proposer

    Submits the final patch in a series to introduce `--short-implib` for PE targets, enabling the generation of import libraries with abbreviated symbol names and ensuring deterministic output.

    “Add an option to write the import library given by --out-implib with short import members, using bfd_pe_write_short_import_library. Name the import symbols as make_one does: with --kill-at or a stdcall fixup the DLL exports the undecorated name, but callers refer to the decorated one.”

In Details

This patch, part of a series addressing PR binutils/34527, introduces the --short-implib option to the PE linker (ld). This option leverages bfd_pe_write_short_import_library to generate import libraries with abbreviated symbol names, improving efficiency and compatibility. The implementation ensures that symbol naming conventions (e.g., handling --kill-at and stdcall decorations) are consistent with dlltool. It also makes the generated archive deterministic when --no-insert-timestamp is used. New tests are added to validate the functionality across various scenarios, including st…

For Context
PE targets
Targets that produce files in the Portable Executable format, primarily used by Windows operating systems for executables and DLLs.
import library
A special library file used by Windows linkers that contains information about exported functions and variables from a DLL. It allows programs to link against DLLs without directly referencing the DLL at compile time.
short import members
Exported symbols within an import library that have been abbreviated or shortened, potentially for space or compatibility reasons.
deterministic archive
An archive file (like a library) that will have the exact same content and layout each time it is generated from the same input, regardless of factors like timestamps or the order of operations.
stdcall
A calling convention commonly used on Windows, where the callee cleans up the stack and arguments are pushed from right to left. It often involves name decoration (mangling).
Filed Under: linkerPEimport libraryWindows