Closed
Description
Bug report
Bug description:
The following warning is displayed during BOLT instrumentation
BOLT-WARNING: debug info will be stripped from the binary. Use -update-debug-sections to keep it.
The flag is provided during "apply"
Line 2184 in 81376fe
but not during "instrumentation"
Line 2170 in 81376fe
Reproduced with
make clean
export CC=clang
export CXX=clang++
./configure py_cv_module__openssl=n/a py_cv_module__hashlib=n/a py_cv_module__gdbm=n/a py_cv_module__tkinter=n/a \
--without-ensurepip \
--enable-optimizations --enable-bolt
make -j8
Additional logs
... make profile-bolt-stamp make[1]: Entering directory '/big/workspace/cpython' # Ensure a pristine, pre-BOLT copy of the binary and no profile data from last run. for bin in python; 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; do \ /usr/bin/llvm-bolt "${bin}" -instrument -instrumentation-file-append-pid -instrumentation-file=/big/workspace/cpython/${bin}.bolt -o ${bin}.bolt_inst ; \ mv "${bin}.bolt_inst" "${bin}"; \ done BOLT-INFO: Target architecture: x86_64 BOLT-INFO: BOLT version: 6a0964d75628b15bafd078342120888c0e6d126f BOLT-INFO: first alloc address is 0x400000 BOLT-INFO: creating new program header table at address 0xa00000, offset 0x600000 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-INFO: enabling lite mode BOLT-INFO: 0 out of 7748 functions in the binary (0.0%) have non-empty execution profile BOLT-INFO: validate-mem-refs updated 2 object references BOLT-INSTRUMENTER: Number of indirect call site descriptors: 1995 BOLT-INSTRUMENTER: Number of indirect call target descriptors: 7719 BOLT-INSTRUMENTER: Number of function descriptors: 7719 BOLT-INSTRUMENTER: Number of branch counters: 150867 BOLT-INSTRUMENTER: Number of ST leaf node counters: 47195 BOLT-INSTRUMENTER: Number of direct call counters: 0 BOLT-INSTRUMENTER: Total number of counters: 198062 BOLT-INSTRUMENTER: Total size of counters: 1584496 bytes (static alloc memory) BOLT-INSTRUMENTER: Total size of string table emitted: 166904 bytes in file BOLT-INSTRUMENTER: Total size of descriptors: 10927480 bytes in file BOLT-INSTRUMENTER: Profile will be saved to file /big/workspace/cpython/python.bolt BOLT-INFO: 66759 instructions were shortened BOLT-INFO: removed 84 empty blocks BOLT-INFO: UCE removed 838 blocks and 51008 bytes of code BOLT-INFO: padding code to 0x1600000 to accommodate hot text BOLT-INFO: output linked against instrumentation runtime library, lib entry point is 0x18e0950 BOLT-INFO: clear procedure is 0x18dc390 BOLT-INFO: patched build-id (flipped last bit) BOLT-INFO: setting _end to 0x190247c BOLT-INFO: setting _end to 0x190247c BOLT-INFO: setting __bolt_runtime_start to 0x18e0900 BOLT-INFO: setting __bolt_runtime_fini to 0x18e0950 BOLT-INFO: setting __hot_start to 0xc00000 BOLT-INFO: setting __hot_end to 0x14b3986 # Run instrumented binaries to collect data. ./python -m test --pgo --timeout= ...
This was patched downstream in python-build-standalone
astral-sh/python-build-standalone#463 — I'm interesting in upstreaming that patch.
A simple patch like
diff --git a/configure.ac b/configure.ac
index ee034e5a962..d0245debd5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2167,7 +2167,7 @@ AC_ARG_VAR(
AC_MSG_CHECKING([BOLT_INSTRUMENT_FLAGS])
if test -z "${BOLT_INSTRUMENT_FLAGS}"
then
- BOLT_INSTRUMENT_FLAGS=
+ BOLT_INSTRUMENT_FLAGS="-update-debug-sections"
fi
AC_MSG_RESULT([$BOLT_INSTRUMENT_FLAGS])
is sufficient — but downstream a BOLT_COMMON_FLAGS
variable was added which was useful for subsequent fixes.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux