PE: Add --short-implib to dlltool and ld [PR34527]
Introduces --short-implib option to dlltool and ld for generating compact PE/COFF import libraries.
This series introduces the capability to create PE/COFF short import libraries using the –short-implib option in both dlltool and ld. GNU ld already supports reading these libraries, and this series adds the generation side. The new format is more compact and has been verified for compatibility with MSVC and LLVM. This significantly improves the GNU toolchain’s ability to produce efficient import libraries.
In Details
This is a three-part series that adds support for generating PE/COFF short import libraries. Patch 1/3 adds a shared BFD writer (bfd_pe_write_short_import_library), patch 2/3 integrates this writer into dlltool as the --short-implib option, and patch 3/3 does the same for ld (--out-implib). The default import library format remains unchanged. The generated libraries are compatible with MSVC and LLVM, and tests cover linking and deterministic output verification.
- PE/COFF
- Portable Executable/Common Object File Format, the standard file format for executables, object code, and DLLs in 32-bit and 64-bit Windows operating systems.
- dlltool
- A GNU binutils utility that creates DLL import libraries, or extracts information from them.
- ld
- The GNU linker, responsible for combining object files and libraries into an executable or library.
- Import library
- A library that contains information about functions and variables exported by a DLL. It allows programs to link against DLLs without explicitly calling loading functions.
- BFD
- Binary File Descriptor library, a GNU library that provides a common interface for reading and writing various object file formats.