Skip to content

Preloading BOLT instrumented shared objects cause segfault #147569

Open
@kwk

Description

@kwk

I build LLVM and clang with -DCLANG_BOLT=INSTRUMENT and run into a problem during the test phase that is supposed to generate the instrumentation profile which is later used to optimize the binary. Here are the steps to reproduce this in a mock environment.

$ git clone -b bolt https://src.fedoraproject.org/forks/kkleine/rpms/llvm.git
$ cd llvm
$ make mockbuild-snapshot YYYYMMDD=20250707

Once that runs into the error further down and you want to debug and inspect or re-run commands you can do that like so:

$ make mock-install-debugging-tools
$ make mock-shell
bash-5.2# 

Here's the error:

Patching execution environment for dynamic libraries: /builddir/build/BUILD/llvm-21.0.0_pre20250707.g408e87184f8274-build/llvm-project-408e87184f8274e30d188a2fe198facf5
5243733/llvm/redhat-linux-build/./bin/clang-cxx-bolt.inst /builddir/build/BUILD/llvm-21.0.0_pre20250707.g408e87184f8274-build/llvm-project-408e87184f8274e30d188a2fe198f
acf55243733/llvm/redhat-linux-build/./bin/LLVM-bolt.inst                                                                                                                
Running: /usr/bin/python3 /builddir/build/BUILD/llvm-21.0.0_pre20250707.g408e87184f8274-build/llvm-project-408e87184f8274e30d188a2fe198facf55243733/llvm/redhat-linux-bu
ild/./bin/llvm-lit -v /builddir/build/BUILD/llvm-21.0.0_pre20250707.g408e87184f8274-build/llvm-project-408e87184f8274e30d188a2fe198facf55243733/llvm/redhat-linux-build/
tools/clang/tools/driver/../../utils/perf-training/bolt-fdata                                                                                                           
Traceback (most recent call last):                                                                                                                                      
  File "/builddir/build/BUILD/llvm-21.0.0_pre20250707.g408e87184f8274-build/llvm-project-408e87184f8274e30d188a2fe198facf55243733/clang/tools/driver/../../utils/perf-tr
aining/perf-helper.py", line 718, in <module>                                                                                                                           
    main()                                                                                                                                                              
    ~~~~^^                                                                                                                                                              
  File "/builddir/build/BUILD/llvm-21.0.0_pre20250707.g408e87184f8274-build/llvm-project-408e87184f8274e30d188a2fe198facf55243733/clang/tools/driver/../../utils/perf-tr
aining/perf-helper.py", line 714, in main                                                                                                                               
    sys.exit(f(sys.argv[2:]))                                                       
             ~^^^^^^^^^^^^^^                                                        
  File "/builddir/build/BUILD/llvm-21.0.0_pre20250707.g408e87184f8274-build/llvm-project-408e87184f8274e30d188a2fe198facf55243733/clang/tools/driver/../../utils/perf-tr
aining/perf-helper.py", line 659, in bolt_optimize
    process.check_returncode()                                                      
    ~~~~~~~~~~~~~~~~~~~~~~~~^^                                                      
  File "/usr/lib64/python3.14/subprocess.py", line 508, in check_returncode                                                                                             
    raise CalledProcessError(self.returncode, self.args, self.stdout,                                                                                                   
                             self.stderr)                                           
subprocess.CalledProcessError: Command '['/usr/bin/python3', '/builddir/build/BUILD/llvm-21.0.0_pre20250707.g408e87184f8274-build/llvm-project-408e87184f8274e30d188a2fe
198facf55243733/llvm/redhat-linux-build/./bin/llvm-lit', '-v', '/builddir/build/BUILD/llvm-21.0.0_pre20250707.g408e87184f8274-build/llvm-project-408e87184f8274e30d188a2
fe198facf55243733/llvm/redhat-linux-build/tools/clang/tools/driver/../../utils/perf-training/bolt-fdata']' died with <Signals.SIGSEGV: 11>.

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