Re: [PATCH] elf: Avoid relocating non-allocated code sections

Project / Subsystem

binutils / elf

Date

2026-07-30

Proposer

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

Source type

public_inbox

Consensus

Needs Revision

Sentiment

4/10

Technical tradeoffs

  • • Moving the fix to the backend complicates the overall linker logic.
  • • The initial approach of disallowing non-allocated code sections was a simpler workaround but deemed incorrect.

All attributes

project
binutils
subsystem
elf
patch_id
—
discussion_id
CAMe9rOrbnsbN5dYb17PZdHvoXY+03X5WsuBfHuTmHMATwA53qA@mail.gmail.com
source_type
public_inbox
title
Re: [PATCH] elf: Avoid relocating non-allocated code sections
headline
elf: Avoid relocating non-allocated code sections
tldr
Fixes binutils linker to correctly handle non-allocated code sections, preventing crashes.
proposer
H.J. Lu <hjl.tools@gmail.com>
consensus
Needs Revision
outcome
needs_revision
sentiment_score
4
technical_tradeoffs
  • • Moving the fix to the backend complicates the overall linker logic.
  • • The initial approach of disallowing non-allocated code sections was a simpler workaround but deemed incorrect.
series_id
—
series_role
reply
series_parts
[]
tags
  • • linker
  • • bugfix
  • • x86
  • • ELF
bugzilla_url
—
date
2026-07-30T00:00:00.000Z

Re: [PATCH] elf: Avoid relocating non-allocated code sections

This patch addresses a bug in the binutils linker where it would abort when attempting to relocate non-allocated code sections. The original fix proposed to issue an error, but was deemed insufficient. The discussion clarifies that the issue stems from the x86 backend’s handling of such sections when using GOT or PLT, and the fix is being moved to the backend to properly manage these cases, resolving PR ld/34444.