[PATCH 1/3] PE-COFF: Fix weak external symbol resolution when strong undef is seen first

Project / Subsystem

binutils / pe-coff

Date

2026-05-30

Proposer

Peter Damianov <peter0x44@disroot.org>

Source type

public_inbox

Consensus

Proposed

Sentiment

/10

Technical tradeoffs

  • Increased complexity in symbol resolution logic vs. correct handling of weak externals.
  • Potential performance impact due to additional checks during linking.

All attributes

project
binutils
subsystem
pe-coff
patch_id
discussion_id
20260530191522.57144-2-peter0x44@disroot.org
source_type
public_inbox
title
[PATCH 1/3] PE-COFF: Fix weak external symbol resolution when strong undef is seen first
headline
PE-COFF: Fix weak external symbol resolution when strong undef is seen first
tldr
Fixes an issue where weak external symbols in PE COFF are incorrectly resolved when a strong undefined reference is encountered first.
proposer
Peter Damianov <peter0x44@disroot.org>
consensus
Proposed
outcome
proposed
sentiment_score
technical_tradeoffs
  • Increased complexity in symbol resolution logic vs. correct handling of weak externals.
  • Potential performance impact due to additional checks during linking.
series_id
binutils:pe-coff: fix weak external symbol resolution when strong undef is seen first
series_role
reply
series_parts
[]
tags
  • PE-COFF
  • linker
  • weak symbols
  • symbol resolution
  • bfd
bugzilla_url
date
2026-05-30T00:00:00.000Z

[PATCH 1/3] PE-COFF: Fix weak external symbol resolution when strong undef is seen first

When linking PE-COFF objects, a weak external symbol may fail to resolve correctly if a strong undefined reference is encountered first. This patch fixes this issue by ensuring that the COFF-specific symbol class and auxiliary record are stored even when a strong undefined reference is seen first. The patch also extends the relocation handler to resolve the weak alias fallback for undefined symbols with a C_NT_WEAK class and an aux record.