[PATCH] PE/COFF: raise normal PE section limit safely

Project / Subsystem

binutils / pe/coff

Date

2026-06-30

Proposer

Oleg Tolmatcev <oleg.tolmatcev@gmail.com>

Source type

public_inbox

Consensus

Proposed

Sentiment

8/10

Technical tradeoffs

  • Improves compatibility with modern toolchains and allows for larger PE/COFF files.
  • Introduces more complex handling of section number encoding/decoding.
  • Adds new test cases to ensure the increased limit is handled correctly.

All attributes

project
binutils
subsystem
pe/coff
patch_id
discussion_id
20260630205916.1179-3-oleg.tolmatcev@gmail.com
source_type
public_inbox
title
[PATCH] PE/COFF: raise normal PE section limit safely
headline
PE/COFF: raise normal PE section limit safely
tldr
Safely increases the maximum number of sections allowed in PE/COFF files processed by binutils.
proposer
Oleg Tolmatcev <oleg.tolmatcev@gmail.com>
consensus
Proposed
outcome
proposed
sentiment_score
8
technical_tradeoffs
  • Improves compatibility with modern toolchains and allows for larger PE/COFF files.
  • Introduces more complex handling of section number encoding/decoding.
  • Adds new test cases to ensure the increased limit is handled correctly.
series_id
series_role
standalone
series_parts
[]
tags
  • pe/coff
  • windows
  • linker
  • symbols
  • bugfix
bugzilla_url
date
2026-06-30T00:00:00.000Z

[PATCH] PE/COFF: raise normal PE section limit safely

This patch increases the limit for the number of sections in PE/COFF files handled by binutils from 32,767 to 65,279. It achieves this by correctly treating symbol section numbers as unsigned 16-bit values, aligning with modern compiler practices, while preserving special reserved section number constants. Additionally, it introduces a new gas test to verify the handling of objects with a high section count and improves input validation for reserved section numbers.