Skip to content

gh-119696: Apply BOLT profiles to relocatable install binaries - #56

Draft
zaniebot wants to merge 1 commit into
zb/relocatable-flag-ii-linkerfrom
zb/relocatable-flag-ii-bolt
Draft

zaniebot wants to merge 1 commit into
zb/relocatable-flag-ii-linkerfrom
zb/relocatable-flag-ii-bolt

Conversation

@zaniebot

@zaniebot zaniebot commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

CPython's BOLT rules optimize the build-tree binaries that make install copies into the installation, including shared libpython support from python#104709. The separate installation binaries introduced by #48 would otherwise be installed without BOLT optimization. Those binaries need different runtime library paths because an installed-layout DT_RPATH can override the build tree's intended libpython on glibc.

PBS's build script builds and installs CPython before rewriting the installed ELF library paths with patchelf. When BOLT is enabled, this edits an already optimized binary without relinking it, so no separately linked installation binary needs BOLT optimization. The downstream draft astral-sh/python-build-standalone#861 adopts separate installation binaries and includes the additional BOLT profile application for them.

Allow --enable-bolt with --enable-relocatable by applying the build-tree profiles to the installation counterparts, which are linked from the same object files. Collecting profiles with the build-tree binaries uses their build-time library lookup and avoids a second training run. Optimize installation libraries before the interpreter so their newer timestamps do not cause installation to relink the interpreter and discard its BOLT output. Refresh the shared-library alias only when BOLT optimized that library, and include installation copies in .prebolt cleanup.

This extends BOLT to the additional link outputs required by #48. The #49 alternative uses DT_RUNPATH and shares build and installation binaries, so it uses the ordinary BOLT rules.

Stacked on #48.

@zaniebot
zaniebot force-pushed the zb/relocatable-flag-ii-bolt branch from 822cf72 to bc60b61 Compare October 22, 2026 22:52
@zanieb
zanieb added this pull request to stack #57 October 22, 2026 22:53
@zaniebot
zaniebot removed this pull request from stack #57 October 22, 2026 22:59
@zaniebot
zaniebot added this pull request to stack #58 October 22, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant