binutils Newspaper
OCTOBER 6, 2026
lto — Needs Revision — Sentiment 4 / 10

lto: Skip IR dummy file format check

Patch to prevent the linker from checking the format of an IR dummy file during LTO processing, fixing PR ld/34572.

H.J. Lu submits a patch to address PR ld/34572, which involves Link-Time Optimization (LTO). The patch modifies ldlang.c to avoid checking the format of an Intermediate Representation (IR) dummy file within the lang_check function. Additionally, it allows for an empty DESTLIST in lang_list_remove_tail. The changes aim to resolve testsuite failures observed on specific platforms like x86_64-w64-mingw32.

In the Thread 4 participants
  1. H.J. Lu proposer

    Submits a patch to skip format checks on IR dummy files and handle empty DESTLISTs, addressing PR ld/34572.

    “1. Don't check format of IR dummy file in lang_check. 2. Allow empty DESTLIST in lang_list_remove_tail. PR ld/34572 * ldlang.c (lang_check): Don't check format of IR dummy file. (debug_file_chain): New. (debug_input_files): Use debug_file_chain. (lang_list_remove_tail): Also check empty DESTLIST.”
  2. Alan Modra reviewer

    Reports testsuite failures on x86_64-w64-mingw32 after the patch is applied.

    “I see testsuite failures on x86_64-w64-mingw32 with this.”
  3. H.J. Lu proposer

    States that the patch is being checked after testing on the reported failing platform and provides an update on a related PR.

    “I am checking this patch after testing with x86_64-w64-mingw32. Since realdelf is used to check common symbol size in PR ld/34570 tests, run PR ld/34570 tests only for ELF targets. PR ld/34570 * testsuite/ld-plugin/lto.exp: Run PR ld/34570 tests only for ELF targets.”
  4. Alan Modra reviewer

    Confirms that test failures persist despite the proposed fixes and lists specific failing tests.

    “Fails remain. +FAIL: ld-plugin/lto-3r +FAIL: ld-plugin/lto-4r-a +FAIL: ld-plugin/lto-4r-b +FAIL: ld-plugin/lto-4r-c +FAIL: ld-plugin/lto-4r-d +FAIL: ld-plugin/lto-5r +FAIL: ld-plugin/lto-10r +FAIL: PR ld/19317 (2) +FAIL: LTO 3b +FAIL: PR ld/19317 (3) ld-plugin/dummy.s: Assembler messages: ld-plugin/dummy.s:1: Error: junk at end of line, first unrecognized character is `-`”

Technical Tradeoffs

  • Removes a potentially unnecessary format check for LTO IR dummy files.
  • Increases robustness by allowing empty destination lists in internal functions.

In Details

This patch addresses a problem in the GNU linker's handling of Link-Time Optimization (LTO) input, specifically related to intermediate representation (IR) files. The linker normally checks the format of input files. However, for LTO, dummy IR files are used, and their format check can fail erroneously. This patch modifies ldlang.c to skip this format check for dummy IR files. It also relaxes a check in lang_list_remove_tail to handle empty lists. The changes are motivated by a specific bug report (PR ld/34572) and associated test failures on platforms like MinGW.

For Context
LTO
Link-Time Optimization. A compiler optimization technique where the compiler performs optimizations not just within a single source file, but across all source files of a program during the linking stage.
IR
Intermediate Representation. A data structure or code format used internally by a compiler or toolchain to represent source code during various stages of translation and optimization.
dummy file
In this context, a placeholder file used during LTO processing that may not conform to standard object file formats but serves a specific purpose in the toolchain pipeline.
DESTLIST
Likely refers to a destination list or data structure used within the linker's language handling code, possibly for managing output files or symbols.
PR ld/34572
A bug report filed against the GNU linker (ld), identified by number 34572.
Filed Under: ltolinkerbinutilscompiler