python / cpython

The Python programming language
https://www.python.org/
Other
61.16k stars 29.52k forks source link

Build fails when configured with --enable-bolt #111351

Open Monallabs opened 8 months ago

Monallabs commented 8 months ago

Bug report

Bug description:

./configure --prefix=/home/adming/vps_cluster_manager_workdir/Builds/ --enable-optimizations --with-lto --with --computed-gotos --with-openssl-rpath=auto --with-openssl=/usr/local --enable-shared   --enable-bolt --enable-loadable-sqlite-extensions --enable-pystats

error output

Checked 111 modules (31 built-in, 73 shared, 1 n/a on openbsd-7.4-amd64, 0 disabled, 6 missing, 0 failed on import)
opcode[26].specializable : 1
opcode[107].specializable : 1
opcode[27].specializable : 1
opcode[123].specializable : 1
opcode[25].specializable : 1
opcode[60].specializable : 1
opcode[92].specializable : 1
opcode[93].specializable : 1
opcode[95].specializable : 1
opcode[106].specializable : 1
opcode[107].specializable : 1
opcode[116].specializable : 1
opcode[122].specializable : 1
opcode[123].specializable : 1
opcode[141].specializable : 1
opcode[171].specializable : 1
Calls to PyEval_EvalDefault: 0
Calls to Python functions inlined: 0
Frames pushed: 0
Frame objects created: 0
Calls via PyEval_EvalFrame[0] : 0
Calls via PyEval_EvalFrame[1] : 0
Calls via PyEval_EvalFrame[2] : 0
Calls via PyEval_EvalFrame[3] : 0
Calls via PyEval_EvalFrame[4] : 0
Calls via PyEval_EvalFrame[5] : 0
Calls via PyEval_EvalFrame[6] : 0
Calls via PyEval_EvalFrame[7] : 0
Calls via PyEval_EvalFrame[8] : 0
Calls via PyEval_EvalFrame[9] : 0
Object allocations from freelist: 0
Object frees to freelist: 0
Object allocations: 0
Object allocations to 512 bytes: 0
Object allocations to 4 kbytes: 0
Object allocations over 4 kbytes: 0
Object frees: 0
Object new values: 0
Object interpreter increfs: 0
Object interpreter decrefs: 0
Object increfs: 0
Object decrefs: 0
Object materialize dict (on request): 0
Object materialize dict (new key): 0
Object materialize dict (too big): 0
Object materialize dict (str subclass): 0
Object method cache hits: 0
Object method cache hits: 0
Object method cache misses: 0
Object method cache collisions: 0
Object method cache dunder hits: 0
Object method cache dunder misses: 0
gmake[2]: Leaving directory '/home/adming/vps_cluster_manager_workdir/cpython'
gmake[1]: Leaving directory '/home/adming/vps_cluster_manager_workdir/cpython'
gmake[1]: Leaving directory '/home/adming/vps_cluster_manager_workdir/cpython'
gmake[1]: Leaving directory '/home/adming/vps_cluster_manager_workdir/cpython'
gmake profile-bolt-stamp
gmake[1]: Entering directory '/home/adming/vps_cluster_manager_workdir/cpython'
# Ensure a pristine, pre-BOLT copy of the binary and no profile data from last run.
for bin in python libpython3.12.so.1.0; do \
  prebolt="${bin}.prebolt"; \
  if [ -e "${prebolt}" ]; then \
    echo "Restoring pre-BOLT binary ${prebolt}"; \
    mv "${bin}.prebolt" "${bin}"; \
  fi; \
  cp "${bin}" "${prebolt}"; \
  rm -f ${bin}.bolt.*.fdata ${bin}.fdata; \
done
# Instrument each binary.
for bin in python libpython3.12.so.1.0; do \
  /home/adming/vps_cluster_manager_workdir/build/bin/llvm-bolt "${bin}" -instrument -instrumentation-file-append-pid -instrumentation-file=/home/adming/vps_cluster_manager_workdir/cpython/${bin}.bolt -o ${bin}.bolt_inst ; \
  mv "${bin}.bolt_inst" "${bin}"; \
done
BOLT-INFO: Target architecture: x86_64
BOLT-INFO: BOLT version: 2e2011da38f90635bdc10d9941a4bc95937663de
BOLT-INFO: first alloc address is 0x200000
BOLT-INFO: creating new program header table at address 0x400000, offset 0x200000
BOLT-WARNING: debug info will be stripped from the binary. Use -update-debug-sections to keep it.
BOLT-INFO: enabling relocation mode
BOLT-INFO: forcing -jump-tables=move for instrumentation
BOLT-ERROR: input binary lacks DT_FINI entry in the dynamic section but instrumentation currently relies on patching DT_FINI to write the profile
gmake[1]: *** [Makefile:842: profile-bolt-stamp] Error 1
gmake[1]: Leaving directory '/home/adming/vps_cluster_manager_workdir/cpython'
gmake: *** [Makefile:871: bolt-opt] Error 2

CPython versions tested on:

3.12

Operating systems tested on:

Other

corona10 commented 8 months ago

Which LLVM version are you using?

corona10 commented 8 months ago

@Monallabs Looks like you tried this one at the https://github.com/llvm/llvm-project/commits/2e2011da38f90635bdc10d9941a4bc95937663de Did you try the optimization based on LLVM 17.0.3?

sandeep-gh commented 8 months ago

@corona10 , I tried with clang 13.0 which is what my OS was shipped with. Will try with 17.0