binutils Newspaper
OCTOBER 6, 2026
aarch64 — Proposed — Sentiment 8 / 10

aarch64: mingw: Auto-import implementation

Implements auto-import for AArch64 on MinGW/Cygwin by avoiding pseudo-relocations.

This patch series introduces auto-import support for AArch64 on MinGW/Cygwin, specifically targeting 12/21/26 bit size relocations. It avoids the need for pseudo-relocations and runtime handling by leveraging dynamic relocations for adrp instructions with symbol offsets. This change aims to improve linker performance and compatibility with MinGW/Cygwin environments.

In the Thread 4 participants
  1. Evgeny Karpov proposer

    Introduces auto-import support for AArch64 on MinGW/Cygwin, avoiding pseudo-relocations and runtime handling for certain bit-size relocations.

    “v2 implements auto-import support for 12/21/26 bit size relocations without needing pseudo relocations and runtime relocations in MinGW/Cygwin, based on feedback during upstreaming changes to MinGW.”
  2. Evgeny Karpov proposer

    Explains the necessity of auto-import for resolving symbols during dynamic linking, particularly for instructions like `adrp` and `add` when the target symbol is unknown at compile time.

    “Auto-import is needed to resolve symbols during dynamic linking. For example, adrp x0, dyn_v + 2 add x0, x0, :lo12:dyn_v + 2”
  3. Martin Storsjö reviewer

    Acknowledges the updated patch series and its approach to implementing auto-import.

    “Thank you for reviewing v1! v2 implements auto-import support for 12/21/26 bit size relocations without needing pseudo relocations and runtime relocations in MinGW/Cygwin, based on feedback during upstreaming changes to MinGW.”
  4. Martin Storsjö reviewer

    Confirms understanding of the auto-import mechanism for dynamic symbol resolution using `adrp` and `add` instructions.

    “Auto-import is needed to resolve symbols during dynamic linking. For example, adrp x0, dyn_v + 2 add x0, x0, :lo12:dyn_v + 2”

Technical Tradeoffs

  • Eliminates pseudo-relocations and runtime handling for improved performance and simpler code.
  • Adds complexity to the linker's handling of dynamic relocations for AArch64 on Windows.

In Details

This patch series introduces auto-import for AArch64 targets on MinGW/Cygwin platforms. Auto-import is a linker mechanism that automatically resolves symbols from dynamic libraries by creating thunks or stubs. Previously, this often involved pseudo-relocations or runtime handling. This series aims to implement auto-import by directly supporting dynamic relocations for adrp and add instructions with symbol offsets, eliminating the need for those indirect methods for 12/21/26 bit relocations. It also includes tests.

For Context
AArch64
The 64-bit ARM architecture.
MinGW
Minimalist GNU for Windows, a development environment for native Microsoft Windows applications using the GNU Compiler Collection.
Cygwin
A Linux-like environment for Windows that provides a POSIX compatibility layer.
auto-import
A linker feature that automatically resolves symbols from dynamic libraries, often by generating import thunks or stubs.
relocation
The process of updating symbolic references in relocatable object code to absolute symbols, typically done by the linker.
pseudo relocation
A relocation entry that doesn't directly correspond to a standard relocation type but is used to convey additional information or control linker behavior.
dynamic relocation
Relocations that are resolved at runtime by the dynamic linker, used for dynamically linked executables and libraries.
IAT
Import Address Table, a table used by Windows executables and DLLs to store addresses of imported functions.
Filed Under: linkeraarch64windowsABI