[gdb] Fix `add-symbol-file -o ... -s ...` address mapping bug

Project / Subsystem

binutils / gdb

Date

2026-09-01

Proposer

Dragorn421 <dragorn421@gmail.com>

Source type

public_inbox

Consensus

Proposed

Sentiment

—/10

Technical tradeoffs

  • • Ensuring correct handling of section offsets when multiple mapping options are used.
  • • Maintaining the integrity of symbol address information during debugging.

All attributes

project
binutils
subsystem
gdb
patch_id
—
discussion_id
CA+_Su2J4YNEx3Ox+Nt8Z_nqcuKEjHMQZp9D3S8YB8BU-9JHjFQ@mail.gmail.com
source_type
public_inbox
title
[gdb] Fix `add-symbol-file -o ... -s ...` address mapping bug
headline
Fix `add-symbol-file -o ... -s ...` address mapping bug
tldr
Fixes a bug in GDB's `add-symbol-file` command where section addresses are incorrectly mapped when using both `-o` and `-s` options.
proposer
Dragorn421 <dragorn421@gmail.com>
consensus
Proposed
outcome
proposed
sentiment_score
—
technical_tradeoffs
  • • Ensuring correct handling of section offsets when multiple mapping options are used.
  • • Maintaining the integrity of symbol address information during debugging.
series_id
—
series_role
standalone
series_parts
[]
tags
  • • gdb
  • • binutils
  • • debugging
  • • elf
  • • address mapping
bugzilla_url
—
date
2026-09-01T00:00:00.000Z

[gdb] Fix `add-symbol-file -o ... -s ...` address mapping bug

Dragorn421 reports a bug in GDB’s add-symbol-file command where the -o (offset) option interferes with specific section mappings provided by the -s option. The issue arises because set_objfile_default_section_offset incorrectly passes 0 to objfile_relocate for sections that should not be modified by the global offset. The proposed fix modifies this function to pass the current offset instead.