binutils Newspaper
NOVEMBER 30, 2026
ld — Proposed

ld: read the FreeBSD ELF hints file in either byte order

Reviewer requests specific formatting and author identification for patch versions.

This exchange concerns a patch for the ld linker that aims to handle the FreeBSD ELF hints file, which can be written in little-endian byte order regardless of the host architecture. The reviewer acknowledges a second version of the patch but requests that the author include a “v2” tag in the subject line and provide their Signed-off-by line in the mail, not just a reply. They also advise sending new patch versions as roots of new threads.

In the Thread 2 participants
  1. Jan Beulich reviewer

    Requests that future patch versions be clearly identified with a 'v2' tag in the subject and that the author's Signed-off-by line be included, also suggesting new patch versions start new threads.

    “Albeit still lacking your S-o-b, which you supplied only in a reply on the v1 thread. You also want to tag v2 as v2, to be able to identify from looking at just the mail subject. I'll take the patch from there this time. Another request (for the future): Please send new versions of patches as roots of new threads, not as replies to earlier version threads.”
  2. Piotr Kubaj proposer

    Submitted a patch to handle byte order issues in FreeBSD ELF hints files and provided a second version based on reviewer feedback.

    “FreeBSD's ldconfig writes the hints file in little-endian byte order on all architectures unless it is run with -B, so the header is not necessarily in host byte order. This causes an issue when trying to link some software on powerpc64 (big-endian POWER). --- v2: pass the directory offset straight to fseek() and declare dirlistlen in the innermost scope, as suggested by Jan Beulich.”

Technical Tradeoffs

  • Supporting multiple byte orders for configuration files increases code complexity but improves portability and compatibility across different architectures.
  • Clear communication regarding patch versions and author details is essential for efficient review processes.

In Details

This discussion relates to the GNU linker (ld) and its handling of FreeBSD's ELF hints file (elf.hints). This file stores dynamic linker configuration information and is generated by ldconfig. A key issue is that FreeBSD's ldconfig writes this file in little-endian format irrespective of the host's endianness. This patch addresses a problem on big-endian architectures (like powerpc64) where ld might misinterpret the file's header due to byte order mismatches.

For Context
ld
The GNU linker, responsible for combining object files and libraries into an executable or library.
ELF
Executable and Linkable Format, a standard file format for executables, object code, shared libraries, and core dumps on many Unix-like systems.
ELF hints file
A file used by dynamic linkers (like ld.so) to store information about shared libraries, often specifying search paths or other configuration details. FreeBSD uses elf.hints.
byte order
The order in which bytes are arranged in computer memory for multi-byte data types. Common orders are little-endian (least significant byte first) and big-endian (most significant byte first).
ldconfig
A program that maintains the cache used by the dynamic linker, ld.so, and updates the dynamic linker run-time bindings.
powerpc64
A 64-bit variant of the PowerPC architecture, which is typically big-endian.
Filed Under: binutilsldELFFreeBSDendianness