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

Project / Subsystem

binutils / pe/coff

Date

2026-07-01

Proposer

Oleg Tolmatcev <oleg.tolmatcev@gmail.com>

Source type

public_inbox

Consensus

Proposed

Sentiment

/10

Technical tradeoffs

  • Enables support for larger PE/COFF files with more sections, improving compatibility with modern toolchains.
  • Adds complexity to section number handling and error checking.

All attributes

project
binutils
subsystem
pe/coff
patch_id
discussion_id
20260701175852.1111-2-oleg.tolmatcev@gmail.com
source_type
public_inbox
title
[PATCH v2] 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
technical_tradeoffs
  • Enables support for larger PE/COFF files with more sections, improving compatibility with modern toolchains.
  • Adds complexity to section number handling and error checking.
series_id
series_role
standalone
series_parts
[]
tags
  • pe/coff
  • windows
  • linker
  • symbols
  • bugfix
bugzilla_url
date
2026-07-01T00:00:00.000Z

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

This patch addresses a limitation in binutils’ handling of PE/COFF files, where symbol section numbers were treated as signed 16-bit integers, restricting normal PE objects to 32,767 sections. The change raises this limit to 65,279 by correctly decoding and encoding section numbers as unsigned values, while preserving special reserved values. It also improves error handling by rejecting invalid reserved section numbers during symbol reading and includes new gas and binutils tests to verify the changes.