binutils Newspaper
NOVEMBER 30, 2026
ld — Proposed

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

Piotr Kubaj adds a Signed-off-by line to a patch that allows the FreeBSD ELF hints file to be read correctly on big-endian systems.

Piotr Kubaj has revised a patch to correctly handle the byte order of FreeBSD’s ELF hints file. Previously, the file was always written in little-endian, causing issues on big-endian architectures like powerpc64. This patch ensures the linker can read the hints file regardless of its byte order. A missing ‘Signed-off-by’ line was also added.

In the Thread 3 participants
  1. Piotr Kubaj <pkubaj@FreeBSD.org> proposer

    Submitted a patch to address an issue where FreeBSD's ELF hints file, written in little-endian, caused problems on big-endian systems.

    “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).”
  2. Jan Beulich reviewer

    Requested clarification on patch submission and noted the need for a 'Signed-off-by' line if a copyright assignment with FSF was not in place.

    “Okay, preferably with ... Oh, also - unless you have a copyright assignment in place with the FSF, this would need a Signed-off-by of yours.”
  3. Piotr Kubaj <pkubaj@anongoth.pl> proposer

    Added the missing Signed-off-by line to the patch.

    “Added missing Signed-off-by.”

Technical Tradeoffs

  • Ensuring cross-endian compatibility for configuration files is important for portability.
  • Default behaviors of utilities like `ldconfig` can create cross-platform compatibility challenges.

In Details

This patch addresses a byte-order issue in how the GNU linker (ld) reads FreeBSD's ldconfig hints file. On big-endian architectures (like powerpc64), ldconfig writes this file in little-endian format by default. The linker now correctly interprets the hints file regardless of its byte order, ensuring compatibility.

For Context
FreeBSD ELF hints file
A file used by FreeBSD's linker (ldconfig) to store information about shared libraries, aiding in faster library loading and resolution.
little-endian
A byte order where the least significant byte is stored at the lowest memory address.
big-endian
A byte order where the most significant byte is stored at the lowest memory address.
powerpc64
A 64-bit version of the PowerPC architecture, typically employing big-endian byte order.
ldconfig
A command-line utility on FreeBSD (and similar systems) that builds the cache ld.so uses to locate shared libraries.
Filed Under: linkerELFbyte-orderFreeBSDpowerpc