[PATCH] elf: Set this_idx to -1 for invalid relocations

Project / Subsystem

binutils / elf

Date

2026-08-01

Proposer

"H.J. Lu" <hjl.tools@gmail.com>

Source type

public_inbox

Consensus

Proposed

Sentiment

5/10

Technical tradeoffs

  • • Correcting the error reporting mechanism to avoid redundant messages.
  • • Ensuring that invalid relocation data does not lead to misinterpretation or repeated errors.
  • • Maintaining the linker's ability to halt on fatal errors.

All attributes

project
binutils
subsystem
elf
patch_id
—
discussion_id
CAMe9rOpWmbqdUHmBWUbUROcNvMY8YJOUUf7CGoBU=AWysx596Q@mail.gmail.com
source_type
public_inbox
title
[PATCH] elf: Set this_idx to -1 for invalid relocations
headline
elf: Set this_idx to -1 for invalid relocations
tldr
Fixes redundant error reporting for invalid relocation symbol indices in the ELF linker.
proposer
"H.J. Lu" <hjl.tools@gmail.com>
consensus
Proposed
outcome
proposed
sentiment_score
5
technical_tradeoffs
  • • Correcting the error reporting mechanism to avoid redundant messages.
  • • Ensuring that invalid relocation data does not lead to misinterpretation or repeated errors.
  • • Maintaining the linker's ability to halt on fatal errors.
series_id
—
series_role
standalone
series_parts
[]
tags
  • • binutils
  • • elf
  • • linker
  • • relocations
  • • bugfix
bugzilla_url
—
date
2026-08-01T00:00:00.000Z

[PATCH] elf: Set this_idx to -1 for invalid relocations

This patch addresses an issue in the binutils ELF linker where invalid relocation symbol indices cause the linker to report the same error twice. The fix modifies elf_link_read_relocs_from_section to set this_idx to -1 for invalid relocations and return false if this_idx is negative, preventing subsequent erroneous checks.