PE/COFF: raise normal PE section limit safely

Project / Subsystem

binutils / pe/coff

Date

2026-07-14

Proposer

Oleg Tolmatcev <oleg.tolmatcev@gmail.com>

Source type

public_inbox

Consensus

Proposed

Sentiment

/10

Technical tradeoffs

  • Increasing the section limit improves compatibility with modern toolchains but requires careful handling of existing code and special section values to avoid breaking existing functionality.

All attributes

project
binutils
subsystem
pe/coff
patch_id
discussion_id
20260714202348.1105-2-oleg.tolmatcev@gmail.com
source_type
public_inbox
title
PE/COFF: raise normal PE section limit safely
headline
PE/COFF: raise normal PE section limit safely
tldr
Increases the maximum number of sections in PE/COFF objects from 32767 to 65279 by using unsigned 16-bit integers for section numbers.
proposer
Oleg Tolmatcev <oleg.tolmatcev@gmail.com>
consensus
Proposed
outcome
proposed
sentiment_score
technical_tradeoffs
  • Increasing the section limit improves compatibility with modern toolchains but requires careful handling of existing code and special section values to avoid breaking existing functionality.
series_id
series_role
cover
series_parts
[]
tags
  • binutils
  • pe/coff
  • elf
  • linker
  • sections
bugzilla_url
date
2026-07-14T00:00:00.000Z

PE/COFF: raise normal PE section limit safely

Oleg Tolmatcev proposes raising the section limit in PE/COFF objects from 32,767 to 65,279. This change is necessary because binutils currently uses signed 16-bit integers for symbol section numbers, whereas modern compilers like MSVC and Clang support a larger unsigned range. The patch modifies BFD to handle section numbers as unsigned values while preserving special constants, and includes a new gas test case to verify the functionality.