[PATCH] ld: Check bfd_gc_sections return

Project / Subsystem

binutils / ld

Date

2026-08-05

Proposer

H.J. Lu

Source type

public_inbox

Consensus

Proposed

Sentiment

5/10

All attributes

project
binutils
subsystem
ld
patch_id
—
discussion_id
CAMe9rOo4GC_Lkw6PYA78CnR5gWsy6T1nYGW+hvdq9DXMeA2YLg@mail.gmail.com
source_type
public_inbox
title
[PATCH] ld: Check bfd_gc_sections return
headline
ld: Check bfd_gc_sections return
tldr
Ensures the linker (`ld`) properly handles errors returned by `bfd_gc_sections`, specifically when `bfd_error_bad_value` is set.
proposer
H.J. Lu
consensus
Proposed
outcome
proposed
sentiment_score
5
technical_tradeoffs
[]
series_id
—
series_role
standalone
series_parts
[]
tags
  • • linker
  • • error-handling
  • • BFD
bugzilla_url
—
date
2026-08-05T00:00:00.000Z

[PATCH] ld: Check bfd_gc_sections return

This patch for the GNU linker (ld) improves error handling by checking the return value of bfd_gc_sections. This function can return false and set bfd_error_bad_value on invalid input, as seen in a reloc symbol index error. The change ensures that ld reports a fatal error in such cases, preventing potentially misleading or incomplete diagnostics. This addresses a specific bug report (PR ld/34448).