[PATCH] riscv: Ignore attributes in empty input file

Project / Subsystem

binutils / riscv

Date

2026-05-28

Proposer

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

Source type

public_inbox

Consensus

Proposed

Sentiment

/10

Technical tradeoffs

  • Ignoring attributes in empty files might hide genuine errors, but the patch assumes that attributes in empty files are generally not meaningful.

All attributes

project
binutils
subsystem
riscv
patch_id
discussion_id
CAMe9rOpM413U8i5oFK=Um4d3ns3+bAyYWf3EAqq7gSMFaXjHhA@mail.gmail.com
source_type
public_inbox
title
[PATCH] riscv: Ignore attributes in empty input file
headline
riscv: Ignore attributes in empty input file
tldr
This patch fixes multiple RISC-V linker test failures by ignoring attributes in empty input files during attribute merging.
proposer
"H.J. Lu" <hjl.tools@gmail.com>
consensus
Proposed
outcome
proposed
sentiment_score
technical_tradeoffs
  • Ignoring attributes in empty files might hide genuine errors, but the patch assumes that attributes in empty files are generally not meaningful.
series_id
series_role
standalone
series_parts
[]
tags
  • riscv
  • linker
  • attributes
  • elf
  • lto
bugzilla_url
date
2026-05-28T00:00:00.000Z

[PATCH] riscv: Ignore attributes in empty input file

This patch addresses multiple failures in the RISC-V linker tests by ignoring attributes found in empty input files when merging attributes. This change specifically impacts scenarios involving garbage collection of sections (--gc-sections), defined symbols (--defsym), KEEP directives, and LTO (Link-Time Optimization). Ignoring attributes in empty files resolves issues related to incorrect magic number detection and improves the linker’s ability to handle various scenarios, ultimately fixing PR ld/34185.