[PATCH v2] elf: Set text-segment address to the maximum page size

Project / Subsystem

binutils / elf

Date

2026-05-28

Proposer

"H.J. Lu" <hjl.tools@gmail.com>

Source type

public_inbox

Consensus

Proposed

Sentiment

/10

Technical tradeoffs

  • Forcing the text-segment address to the maximum page size might increase the size of the executable file due to padding.
  • This change could potentially break existing applications that rely on the text-segment being loaded at a lower address, although this is unlikely.

All attributes

project
binutils
subsystem
elf
patch_id
discussion_id
CAMe9rOo5sxQ6x0jdD9JPXunmDt3rywckofJjPKgwXwUqsU-=GQ@mail.gmail.com
source_type
public_inbox
title
[PATCH v2] elf: Set text-segment address to the maximum page size
headline
elf: Set text-segment address to the maximum page size
tldr
This patch sets the text-segment address to the maximum page size for ELF Position Dependent Executables (PDEs) when specified via command-line to avoid loadin…
proposer
"H.J. Lu" <hjl.tools@gmail.com>
consensus
Proposed
outcome
proposed
sentiment_score
technical_tradeoffs
  • Forcing the text-segment address to the maximum page size might increase the size of the executable file due to padding.
  • This change could potentially break existing applications that rely on the text-segment being loaded at a lower address, although this is unlikely.
series_id
series_role
standalone
series_parts
[]
tags
  • elf
  • linker
  • page size
  • pde
  • pie
bugzilla_url
date
2026-05-28T00:00:00.000Z

[PATCH v2] elf: Set text-segment address to the maximum page size

This patch (v2) addresses an issue where the text-segment address of an ELF Position Dependent Executable (PDE) could be lower than the maximum page size specified on the command line. The patch modifies the linker to ensure that the text-segment address is set to the maximum page size when generating PDE output with the -z max-page-size=SIZE option. This prevents potential loading issues, particularly with PIE (Position Independent Executable), static PDE, and static PIE binaries, and includes added tests for these scenarios.