python / python/cpython

[BOLT] specific build configs with packed rellocations segfault or miscompile with both GCC and Clang

Đang mở
#141,775 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

@corona10 đang làm issue này rồi.

Từ ngày 20/11/2025.

build OS-linux type-bug
Ngôn ngữ chính
Python
Star
77.2k
Fork
35.9k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

Bug report

Bug description:

Tested on Fedora Linux 43, binutils 2.45, clang/llvm/bolt 21.1.4, gcc 15.2.1, glibc 2.42

Specific build configs when using the --enable-bolt flag fail. Found these after doing testing for https://github.com/python/cpython/pull/140250, which doesn't skip the computed gotos containing functions depending on the llvm version.

While this should also ideally be reported to the llvm bug tracker as well, I'm reporting it here first, towards resolving https://github.com/python/cpython/issues/101525

GCC:

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

On 3.14 segfaults, also with https://github.com/python/cpython/pull/140250
On main it passes
On main segfaults with https://github.com/python/cpython/pull/140250 when not skipping computed gotos functions

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

On 3.14 bolt complains about adding sre_ucs2_match.lto_priv.0/1 to --skip-funcs
On 3.14 segfaults with https://github.com/python/cpython/pull/140250
On main segfaults, also with https://github.com/python/cpython/pull/140250

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

On 3.14 passes, also with https://github.com/python/cpython/pull/140250
On main segfaults, also with https://github.com/python/cpython/pull/140250

Shared build with LTO, PGO and packed relocs (the current Fedora built RPM):
CC=gcc LDFLAGS="-Wl,-z,pack-relative-relocs" ./configure --with-lto --enable-optimizations --enable-bolt --enable-shared && make -j

On 3.14 bolt complains about adding sre_ucs1_match.lto_priv.0/1 to --skip-funcs
On 3.14 segfaults with https://github.com/python/cpython/pull/140250
On main segfaults also with https://github.com/python/cpython/pull/140250

Clang:

clang builds might need enforcement of DWARF 4, already reported https://github.com/llvm/llvm-project/issues/121554

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

On 3.14 passes, also with https://github.com/python/cpython/pull/140250
On main passes
On main miscompiles the library with https://github.com/python/cpython/pull/140250 (aka without skipping computed goto functions)

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

On 3.14 segfaults, also with https://github.com/python/cpython/pull/140250
On main passes
On main segfaults with https://github.com/python/cpython/pull/140250

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

On 3.14 it segfaults, also with https://github.com/python/cpython/pull/140250
On main it miscompiles the library, also with https://github.com/python/cpython/pull/140250

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

On 3.14 passes
On 3.14 segfaults with https://github.com/python/cpython/pull/140250
On main miscompiles the library, also with https://github.com/python/cpython/pull/140250

CPython versions tested on:

3.15, 3.14

Operating systems tested on:

Linux

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.