Re: [PATCH 2/2] ld: Fix calls to strchr that discard or use wrong const qualifiers
Project / Subsystem
binutils / ld
Date
2026-05-03
Proposer
Alan Modra <amodra@gmail.com>
Source type
public_inbox
Consensus
Proposed
Sentiment
—/10
Technical tradeoffs
- • Ensures const correctness, potentially preventing unintended modifications of constant strings.
- • Minimal performance impact.
- • Increased code clarity and maintainability.
All attributes
- project
- binutils
- subsystem
- ld
- patch_id
- —
- discussion_id
- afa6D-vklx2LFqS3@squeak.grove.modra.org
- source_type
- public_inbox
- title
- Re: [PATCH 2/2] ld: Fix calls to strchr that discard or use wrong const qualifiers
- headline
- Ld: Fix calls to strchr that discard or use wrong const qualifiers
- tldr
- The linker is updated to avoid discarding const qualifiers when calling strchr in several places.
- proposer
- Alan Modra <amodra@gmail.com>
- consensus
- Proposed
- outcome
- proposed
- sentiment_score
- —
- technical_tradeoffs
-
- • Ensures const correctness, potentially preventing unintended modifications of constant strings.
- • Minimal performance impact.
- • Increased code clarity and maintainability.
- series_id
- binutils:ld: fix calls to strchr that discard or use wrong const qualifiers
- series_role
- reply
- series_parts
-
- • {"title":"ld: Fix calls to strchr that discard or use wrong const qualifiers","url":"https://inbox.sourceware.org/binutils/20260502170132.3303884-3-mark@klomp.org"}
- tags
-
- • ld
- • strchr
- • const correctness
- • linker
- bugzilla_url
- —
- date
- 2026-05-03T00:00:00.000Z
Re: [PATCH 2/2] ld: Fix calls to strchr that discard or use wrong const qualifiers
This patch updates the linker (ld) to ensure that the return values of strchr are correctly assigned to const char * variables, avoiding the discarding of const qualifiers. This change affects multiple files under the ld/emultempl/ directory and ld/ldelf.c. The patch addresses potential issues related to const correctness in the linker code.