Skip to content

[BOLT] Crash with -update-debug-sections when optimizing CPython on Fedora 43 with LLVM 21.1.4 #166863

Closed

Description

@stratakis

Hello,

On a Fedora 43 machine with llvm 21.1.4, binutils 2.45 and glibc 2.42, compiling CPython with Bolt produces a crash.

The build was successful on F42 with llvm 20.1.8, binutils 2.44 and glibc 2.41.

Reproducer for Fedora 43:

git clone https://github.com/python/cpython.git
git checkout 3.14
CC=clang ./configure --enable-bolt && make -j

BOLT-INFO: Allocation combiner: 151 empty spaces coalesced (dyn count: 1116607131).
/usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../include/c++/15/bits/stl_vector.h:1282: const_reference std::vector<llvm::DWARFDebugLine::FileNameEntry>::operator[](size_type) const [_Tp = llvm::DWARFDebugLine::FileNameEntry, _Alloc = std::allocator<llvm::DWARFDebugLine::FileNameEntry>]: Assertion '__n < this->size()' failed.
 #0 0x0000555f75fb2cb3 (/usr/bin/llvm-bolt+0x2eb0cb3)
 #1 0x0000555f75fb366c (/usr/bin/llvm-bolt+0x2eb166c)
 #2 0x00007ff65f0262c0 __restore_rt (/lib64/libc.so.6+0x1a2c0)
 #3 0x00007ff65f0803cc __pthread_kill_implementation (/lib64/libc.so.6+0x743cc)
 #4 0x00007ff65f02618e gsignal (/lib64/libc.so.6+0x1a18e)
 #5 0x00007ff65f00d6d0 abort (/lib64/libc.so.6+0x16d0)
 #6 0x00007ff65f20b084 (/lib64/libstdc++.so.6+0xb084)
 #7 0x0000555f76432df3 (/usr/bin/llvm-bolt+0x3330df3)
 #8 0x0000555f7644466a (/usr/bin/llvm-bolt+0x334266a)
 #9 0x0000555f764455ae (/usr/bin/llvm-bolt+0x33435ae)
#10 0x0000555f76444fea (/usr/bin/llvm-bolt+0x3342fea)
#11 0x0000555f76443284 (/usr/bin/llvm-bolt+0x3341284)
#12 0x0000555f76036adb (/usr/bin/llvm-bolt+0x2f34adb)
#13 0x0000555f75687db9 (/usr/bin/llvm-bolt+0x2585db9)
#14 0x00007ff65f00f5b5 __libc_start_call_main (/lib64/libc.so.6+0x35b5)
#15 0x00007ff65f00f668 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3668)
#16 0x0000555f75677885 (/usr/bin/llvm-bolt+0x2575885)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /usr/bin/llvm-bolt python.prebolt -o python.bolt -data=python.fdata -update-debug-sections -skip-funcs=_PyEval_EvalFrameDefault,sre_ucs1_match/1,sre_ucs2_match/1,sre_ucs4_match/1 -reorder-blocks=ext-tsp -reorder-functions=cdsort -split-functions -icf=1 -inline-all -split-eh -reorder-functions-use-hot-size -peepholes=none -jump-tables=aggressive -inline-ap -indirect-call-promotion=all -dyno-stats -use-gnu-stack -frame-opt=hot

The error goes away if I remove the -update-debug-sections from the python's configure:

diff --git a/configure b/configure
index 2c403f4965d..50335e29f05 100755
--- a/configure
+++ b/configure
@@ -9387,7 +9387,7 @@ fi
 printf %s "checking BOLT_COMMON_FLAGS... " >&6; }
 if test -z "${BOLT_COMMON_FLAGS}"
 then
-  BOLT_COMMON_FLAGS=" -update-debug-sections -skip-funcs=_PyEval_EvalFrameDefault,sre_ucs1_match/1,sre_ucs2_match/1,sre_ucs4_match/1 "
+  BOLT_COMMON_FLAGS=" -skip-funcs=_PyEval_EvalFrameDefault,sre_ucs1_match/1,sre_ucs2_match/1,sre_ucs4_match/1 "
 
 fi
 
diff --git a/configure.ac b/configure.ac
index 07b005bacaf..c49f1edb975 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2150,8 +2150,6 @@ then
   AS_VAR_SET(
     [BOLT_COMMON_FLAGS],
     [m4_normalize("
-      [-update-debug-sections]
-
       dnl At least LLVM 19.x doesn't support computed gotos in PIC compiled code.
       dnl Exclude functions containing computed gotos.
       dnl TODO this may be fixed in LLVM 20.x via https://github.com/llvm/llvm-project/pull/120267.

Maybe related issue: #67966

Activity

  1. llvmbot commented on Nov 6, 2025

    @llvmbot
    Member

    @llvm/issue-subscribers-bolt

    Author: None (stratakis)

    Details Hello,

    On a Fedora 43 machine with llvm 21.1.4, binutils 2.45 and glibc 2.42, compiling CPython with Bolt produces a crash.

    The build was successful on F42 with llvm 20.1.8, binutils 2.44 and glibc 2.41.

    Reproducer for Fedora 43:

    git clone https://github.com/python/cpython.git
    git checkout 3.14
    CC=clang ./configure --enable-bolt &amp;&amp; make -j

    BOLT-INFO: Allocation combiner: 151 empty spaces coalesced (dyn count: 1116607131).
    /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../include/c++/15/bits/stl_vector.h:1282: const_reference std::vector&lt;llvm::DWARFDebugLine::FileNameEntry&gt;::operator[](size_type) const [_Tp = llvm::DWARFDebugLine::FileNameEntry, _Alloc = std::allocator&lt;llvm::DWARFDebugLine::FileNameEntry&gt;]: Assertion '__n &lt; this-&gt;size()' failed.
     #<!-- -->0 0x0000555f75fb2cb3 (/usr/bin/llvm-bolt+0x2eb0cb3)
     #<!-- -->1 0x0000555f75fb366c (/usr/bin/llvm-bolt+0x2eb166c)
     #<!-- -->2 0x00007ff65f0262c0 __restore_rt (/lib64/libc.so.6+0x1a2c0)
     #<!-- -->3 0x00007ff65f0803cc __pthread_kill_implementation (/lib64/libc.so.6+0x743cc)
     #<!-- -->4 0x00007ff65f02618e gsignal (/lib64/libc.so.6+0x1a18e)
     #<!-- -->5 0x00007ff65f00d6d0 abort (/lib64/libc.so.6+0x16d0)
     #<!-- -->6 0x00007ff65f20b084 (/lib64/libstdc++.so.6+0xb084)
     #<!-- -->7 0x0000555f76432df3 (/usr/bin/llvm-bolt+0x3330df3)
     #<!-- -->8 0x0000555f7644466a (/usr/bin/llvm-bolt+0x334266a)
     #<!-- -->9 0x0000555f764455ae (/usr/bin/llvm-bolt+0x33435ae)
    #<!-- -->10 0x0000555f76444fea (/usr/bin/llvm-bolt+0x3342fea)
    #<!-- -->11 0x0000555f76443284 (/usr/bin/llvm-bolt+0x3341284)
    #<!-- -->12 0x0000555f76036adb (/usr/bin/llvm-bolt+0x2f34adb)
    #<!-- -->13 0x0000555f75687db9 (/usr/bin/llvm-bolt+0x2585db9)
    #<!-- -->14 0x00007ff65f00f5b5 __libc_start_call_main (/lib64/libc.so.6+0x35b5)
    #<!-- -->15 0x00007ff65f00f668 __libc_start_main@<!-- -->GLIBC_2.2.5 (/lib64/libc.so.6+0x3668)
    #<!-- -->16 0x0000555f75677885 (/usr/bin/llvm-bolt+0x2575885)
    PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
    Stack dump:
    0.	Program arguments: /usr/bin/llvm-bolt python.prebolt -o python.bolt -data=python.fdata -update-debug-sections -skip-funcs=_PyEval_EvalFrameDefault,sre_ucs1_match/1,sre_ucs2_match/1,sre_ucs4_match/1 -reorder-blocks=ext-tsp -reorder-functions=cdsort -split-functions -icf=1 -inline-all -split-eh -reorder-functions-use-hot-size -peepholes=none -jump-tables=aggressive -inline-ap -indirect-call-promotion=all -dyno-stats -use-gnu-stack -frame-opt=hot
    

    The error goes away if I remove the -update-debug-sections from the python's configure:

    diff --git a/configure b/configure
    index 2c403f4965d..50335e29f05 100755
    --- a/configure
    +++ b/configure
    @@ -9387,7 +9387,7 @@ fi
     printf %s "checking BOLT_COMMON_FLAGS... " &gt;&amp;6; }
     if test -z "${BOLT_COMMON_FLAGS}"
     then
    -  BOLT_COMMON_FLAGS=" -update-debug-sections -skip-funcs=_PyEval_EvalFrameDefault,sre_ucs1_match/1,sre_ucs2_match/1,sre_ucs4_match/1 "
    +  BOLT_COMMON_FLAGS=" -skip-funcs=_PyEval_EvalFrameDefault,sre_ucs1_match/1,sre_ucs2_match/1,sre_ucs4_match/1 "
     
     fi
     
    diff --git a/configure.ac b/configure.ac
    index 07b005bacaf..c49f1edb975 100644
    --- a/configure.ac
    +++ b/configure.ac
    @@ -2150,8 +2150,6 @@ then
       AS_VAR_SET(
         [BOLT_COMMON_FLAGS],
         [m4_normalize("
    -      [-update-debug-sections]
    -
           dnl At least LLVM 19.x doesn't support computed gotos in PIC compiled code.
           dnl Exclude functions containing computed gotos.
           dnl TODO this may be fixed in LLVM 20.x via https://github.com/llvm/llvm-project/pull/120267.

    Maybe related issue: #67966

  2. stratakis commented on Nov 7, 2025

    @stratakis
    Author

    I see that is already reported so closing it in favor of the old issue: #121554

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      Sponsor
      SponsoredKunjungi sekarang
      Promo