diff mbox series

python3: re-enable profile guided optimisation

Message ID 20231214171806.1934090-1-ross.burton@arm.com
State Accepted, archived
Commit 96a9964d6071dc614cec06a4f0712e257de2bc8b
Headers show
Series python3: re-enable profile guided optimisation | expand

Commit Message

Ross Burton Dec. 14, 2023, 5:18 p.m. UTC
From: Ross Burton <ross.burton@arm.com>

This was accidentally disabled in the 3.7.2 upgrade in 2019[1] where PGO
was made target-only. Change the wrapper script generation so that it
happens in all environments but class-native.

[1] oe-core 02714c105426b0d687620913c1a7401b386428b6

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-devtools/python/python3_3.11.5.bb | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/meta/recipes-devtools/python/python3_3.11.5.bb b/meta/recipes-devtools/python/python3_3.11.5.bb
index d375de4b19c..e7b2b08f7f0 100644
--- a/meta/recipes-devtools/python/python3_3.11.5.bb
+++ b/meta/recipes-devtools/python/python3_3.11.5.bb
@@ -129,18 +129,24 @@  EXTRA_OEMAKE = '\
   LIB=${baselib} \
 '
 
-do_compile:prepend:class-target() {
+# Generate a Profile Guided Optimisation wrapper script that uses qemu-user for
+# all cross builds.
+write_pgo_wrapper:class-native = ":"
+write_pgo_wrapper() {
        if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then
-                qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}"
                 cat >pgo-wrapper <<EOF
 #!/bin/sh
 cd ${B}
-$qemu_binary "\$@"
+${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])} "\$@"
 EOF
                 chmod +x pgo-wrapper
         fi
 }
 
+do_compile:prepend() {
+        write_pgo_wrapper
+}
+
 do_install:prepend() {
         ${WORKDIR}/check_build_completeness.py ${T}/log.do_compile
 }