GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-101525: Check whether to skip functions with computed gotos during BOLT runs by stratakis · Pull Request #140250 · python/cpython

Conversation

@stratakis

@stratakis stratakis commented Oct 17, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

With LLVM >= 21.1.0 BOLT can handle computed gotos in PIC compiled code.

However in some cases computed gotos still produce issues.

This PR handles it this way:

For either GCC or Clang, functions with computed gotos are skipped when LLVM < 21.1.0.

With version >= 21.1.0 where llvm/llvm-project#120267 exists we no longer skip these functions except when packed relocations are involved. The logic handles skipping of the various functions created by either GCC or Clang depending on the type of build.

  • Issue: Make BOLT as stable feature #101525

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@stratakis
stratakis requested review from AA-Turner, corona10, emmatyping and erlend-aasland as code owners October 17, 2025 12:19
@bedevere-app bedevere-app Bot added the awaiting review label Oct 17, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Oct 17, 2025
Make BOLT as stable feature #101525
Open
5 of 7 tasks
@stratakis stratakis mentioned this pull request Oct 20, 2025
gh-101525: [BOLT] Add GCC's LTO-generated function clones, with computed gotos, to BOLT skip list #139840
Merged
@stratakis

stratakis commented Oct 20, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

With GCC when the -pack-relative-relocs linker flag is used, BOLT fails again on the same functions.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Nov 13, 2025

Copy link
Copy Markdown
Member

cc @corona10

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stratakis
stratakis force-pushed the llvm_bolt_gotos_2110 branch from 241a541 to 41d3a75 Compare November 20, 2025 02:03
@stratakis stratakis mentioned this pull request Nov 20, 2025
[BOLT] specific build configs with packed rellocations segfault or miscompile with both GCC and Clang #141775
Open
@stratakis
pythongh-101525: Check whether to skip functions with computed gotos …
33effce
…during BOLT runs

With LLVM >= 21.1.0 BOLT can handle computed gotos in PIC compiled code.

However depending on the combination of --with-lto, --enable-shared,
--enable-optmizations and using packed rellocations on the linker
build configs might still need to skip functions containing computed
gotos.
@stratakis
stratakis force-pushed the llvm_bolt_gotos_2110 branch from 41d3a75 to 33effce Compare November 20, 2025 02:38
@stratakis

stratakis commented Nov 20, 2025

Copy link
Copy Markdown
Contributor Author

I've rebased to add various edge cases and combinations.

Initially I just removed the --skip-funcs flag to test what works and what not.

Tested combinations of --with-lto, --enable-optimizations, --enable-shared and packed-relocations which made things weirder.

Overall out of 32 different build configs that I've tested, 8 didn't work, reported here: #141775.

While I think I caught all the edge cases, at least for these combinations, 3 builds configs actually break with this change:

GCC shared build with packed relocs:
CC=gcc LDFLAGS="-Wl,-z,pack-relative-relocs" ./configure --enable-bolt --enable-shared && make -j

Clang shared build with packed relocs:
CC=clang CXX=clang++ CFLAGS="-gdwarf-4" LDFLAGS="-Wl,-z,pack-relative-relocs" ./configure --enable-bolt --enable-shared && make -j

Clang shared build with LTO and packed relocs:
CC=clang CXX=clang++ CFLAGS="-gdwarf-4" LDFLAGS="-Wl,-z,pack-relative-relocs" ./configure --with-lto --enable-bolt --enable-shared && make -j

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@corona10 corona10 self-assigned this Nov 20, 2025
@stratakis stratakis mentioned this pull request Nov 22, 2025
[BOLT] Segfaults and/or miscompilations when using packed relocations with CPython llvm/llvm-project#169136
Open
vstinner
vstinner reviewed Dec 9, 2025
View reviewed changes
Comment thread configure.ac Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread configure.ac Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread configure.ac Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread configure.ac Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Dec 9, 2025

Copy link
Copy Markdown
Member

bedevere/news — No news entry in Misc/NEWS.d/next/ or "skip news" label found

Would you mind to add a NEWS entry in the Build category? You can use blurb-it online service or blurb command line: https://devguide.python.org/.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

stratakis added 3 commits December 17, 2025 01:11
@stratakis
fixup! pythongh-101525: Check whether to skip functions with computed…
944072e
… gotos during BOLT runs

Address review comments
@stratakis
Add news entry
e171bec
@stratakis
fixup! pythongh-101525: Check whether to skip functions with computed…
336f8ed
… gotos during BOLT runs

Regenerate configure
@stratakis

stratakis commented Dec 17, 2025

Copy link
Copy Markdown
Contributor Author

Added some fixups commits. However some builds are breaking by this change as mentioned in #140250 (comment) so I think it would be ideal to have BOLT fixed first before.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner left review comments
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland erlend-aasland is a code owner
@corona10 corona10 Awaiting requested review from corona10 corona10 is a code owner
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner
@emmatyping emmatyping Awaiting requested review from emmatyping emmatyping is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@corona10 corona10

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@stratakis @vstinner @corona10
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.