binutils Newspaper
JULY 29, 2026
ld/testsuite Proposed

LD/testsuite: Remove $LDFLAGS reference from `run_ld_link_tests'

Patch removes $LDFLAGS from linker test suite invocations, correcting a regression that caused flags to be duplicated.

This discussion confirms and accepts a patch that removes the $LDFLAGS variable reference from the run_ld_link_tests function in binutils’ testsuite. This corrects a regression introduced by a previous commit (740341b9be65) which caused link flags to be unintentionally duplicated, affecting tests on specific architectures like hppa64-hp-hpux. The change ensures test suite consistency and correctness.

In the Thread 3 participants
  1. Maciej W. Rozycki proposer

    Submits a patch to remove `$LDFLAGS` from `run_ld_link_tests` to fix a duplication bug, and has applied it after positive review.

    “Fix commit 24602a75d128 ("ld: Append LDFLAGS to flags variable in default_ld_link") and prevent $LDFLAGS from being included twice in LD invocations made via `run_ld_link_tests', effectively reverting that part of commit 740341b9be65 ("Provide dummy libraries for alpha-vms"). I have pushed this change now, thank you for your review.”
  2. John David Anglin reviewer

    Apologizes for a missed aspect of the change during review, confirming no regressions on hppa64-hp-hpux11.11.

    “Sorry for missing this. I tested on hppa64-hp-hpux11.11 and saw no regressions.”
  3. Alan Modra reviewer

    Requests the patch be applied.

Technical Tradeoffs

  • Test Correctness: Ensuring the test suite accurately reflects linker behavior without unintended side effects from its own configuration.
  • Regression Fix: Reverting an undesirable side effect of a previous commit to maintain expected functionality.
  • Cross-Target Consistency: Maintaining correct test behavior across various architecture targets.

In Details

This patch cleans up the binutils linker test suite by removing an erroneous reference to $LDFLAGS in the run_ld_link_tests script. A previous commit intended to set default linker flags but inadvertently caused $LDFLAGS to be appended twice to test invocations. This change reverts that specific behavior, addressing potential test inaccuracies and ensuring consistency across different target architectures. The issue was validated on hppa64-hp-hpux.

For Context
LD
The GNU linker, responsible for combining object files and libraries into an executable or another object file.
testsuite
A collection of automated tests designed to verify the correct functionality of a software system, in this case, the binutils linker.
LDFLAGS
An environment variable commonly used to pass options to the linker during the build process.
regression
The reintroduction of a bug or defect in a software system that was previously fixed, or the introduction of a new bug caused by a change.
AR
The GNU archiver, used to combine multiple object files into a single archive file.
Filed Under: binutilslinkertestsuiteregressionLDFLAGS