Properly apply exported CFLAGS for dtrace/systemtap builds

Also remove redundant --with-system-ffi configure option

Resolves: RHEL-85727
This commit is contained in:
Charalampos Stratakis 2025-04-01 01:15:52 +02:00
parent 7b176c1385
commit bad8995059
4 changed files with 71 additions and 4 deletions

View File

@ -51,7 +51,7 @@ index aed254ad50..568dbdb945 100644
if os.path.isdir(sitedir): if os.path.isdir(sitedir):
addsitedir(sitedir, known_paths) addsitedir(sitedir, known_paths)
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index 517b13acaf..928d1a0541 100644 index 7dd63b9355..41a151e70e 100644
--- a/Lib/sysconfig.py --- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py +++ b/Lib/sysconfig.py
@@ -104,6 +104,11 @@ @@ -104,6 +104,11 @@

View File

@ -60,7 +60,7 @@ index 75a56f7830..c2509fced1 100644
code = """if 1: code = """if 1:
import _thread import _thread
diff --git a/Lib/threading.py b/Lib/threading.py diff --git a/Lib/threading.py b/Lib/threading.py
index 0bba85d08a..b256e3273f 100644 index 064c74d40f..9e3abacd42 100644
--- a/Lib/threading.py --- a/Lib/threading.py
+++ b/Lib/threading.py +++ b/Lib/threading.py
@@ -1587,29 +1587,20 @@ def _shutdown(): @@ -1587,29 +1587,20 @@ def _shutdown():

View File

@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Miss Islington (bot)"
<31488909+miss-islington@users.noreply.github.com>
Date: Mon, 31 Mar 2025 20:29:04 +0200
Subject: [PATCH] 00452: Properly apply exported CFLAGS for dtrace/systemtap
builds
When using --with-dtrace the resulting object file could be missing
specific CFLAGS exported by the build system due to the systemtap
script using specific defaults.
Exporting the CC and CFLAGS variables before the dtrace invocation
allows us to properly apply CFLAGS exported by the build system
even when cross-compiling.
Co-authored-by: stratakis <cstratak@redhat.com>
---
Makefile.pre.in | 4 ++--
.../next/Build/2025-03-31-19-22-41.gh-issue-131865.PIJy7X.rst | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
create mode 100644 Misc/NEWS.d/next/Build/2025-03-31-19-22-41.gh-issue-131865.PIJy7X.rst
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 689f33d8ff..750559c58d 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -1574,7 +1574,7 @@ Python/frozen.o: $(FROZEN_FILES_OUT)
# an include guard, so we can't use a pipeline to transform its output.
Include/pydtrace_probes.h: $(srcdir)/Include/pydtrace.d
$(MKDIR_P) Include
- $(DTRACE) $(DFLAGS) -o $@ -h -s $<
+ CC="$(CC)" CFLAGS="$(CFLAGS)" $(DTRACE) $(DFLAGS) -o $@ -h -s $<
: sed in-place edit with POSIX-only tools
sed 's/PYTHON_/PyDTrace_/' $@ > $@.tmp
mv $@.tmp $@
@@ -1584,7 +1584,7 @@ Python/import.o: $(srcdir)/Include/pydtrace.h
Modules/gcmodule.o: $(srcdir)/Include/pydtrace.h
Python/pydtrace.o: $(srcdir)/Include/pydtrace.d $(DTRACE_DEPS)
- $(DTRACE) $(DFLAGS) -o $@ -G -s $< $(DTRACE_DEPS)
+ CC="$(CC)" CFLAGS="$(CFLAGS)" $(DTRACE) $(DFLAGS) -o $@ -G -s $< $(DTRACE_DEPS)
Objects/typeobject.o: Objects/typeslots.inc
diff --git a/Misc/NEWS.d/next/Build/2025-03-31-19-22-41.gh-issue-131865.PIJy7X.rst b/Misc/NEWS.d/next/Build/2025-03-31-19-22-41.gh-issue-131865.PIJy7X.rst
new file mode 100644
index 0000000000..a287e0b228
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2025-03-31-19-22-41.gh-issue-131865.PIJy7X.rst
@@ -0,0 +1,2 @@
+The DTrace build now properly passes the ``CC`` and ``CFLAGS`` variables
+to the ``dtrace`` command when utilizing SystemTap on Linux.

View File

@ -17,7 +17,7 @@ URL: https://www.python.org/
#global prerel ... #global prerel ...
%global upstream_version %{general_version}%{?prerel} %global upstream_version %{general_version}%{?prerel}
Version: %{general_version}%{?prerel:~%{prerel}} Version: %{general_version}%{?prerel:~%{prerel}}
Release: 1%{?dist} Release: 2%{?dist}
License: Python-2.0.1 License: Python-2.0.1
@ -401,6 +401,18 @@ Patch371: 00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-g
# - https://access.redhat.com/articles/7004769 # - https://access.redhat.com/articles/7004769
Patch397: 00397-tarfile-filter.patch Patch397: 00397-tarfile-filter.patch
# 00452 # eb11d070c5af7d1b5e47f4e02186152d08eaf793
# Properly apply exported CFLAGS for dtrace/systemtap builds
#
# When using --with-dtrace the resulting object file could be missing
# specific CFLAGS exported by the build system due to the systemtap
# script using specific defaults.
#
# Exporting the CC and CFLAGS variables before the dtrace invocation
# allows us to properly apply CFLAGS exported by the build system
# even when cross-compiling.
Patch452: 00452-properly-apply-exported-cflags-for-dtrace-systemtap-builds.patch
# (New patches go here ^^^) # (New patches go here ^^^)
# #
# When adding new patches to "python" and "python3" in Fedora, EL, etc., # When adding new patches to "python" and "python3" in Fedora, EL, etc.,
@ -850,7 +862,6 @@ BuildPython() {
--with-computed-gotos=%{computed_gotos_flag} \ --with-computed-gotos=%{computed_gotos_flag} \
--with-dbmliborder=gdbm:ndbm:bdb \ --with-dbmliborder=gdbm:ndbm:bdb \
--with-system-expat \ --with-system-expat \
--with-system-ffi \
--with-system-libmpdec \ --with-system-libmpdec \
--enable-loadable-sqlite-extensions \ --enable-loadable-sqlite-extensions \
--with-dtrace \ --with-dtrace \
@ -1766,6 +1777,10 @@ CheckPython optimized
# ====================================================== # ======================================================
%changelog %changelog
* Mon Mar 31 2025 Charalampos Stratakis <cstratak@redhat.com> - 3.12.9-2
- Properly apply exported CFLAGS for dtrace/systemtap builds
Resolves: RHEL-85727
* Tue Feb 04 2025 Charalampos Stratakis <cstratak@redhat.com> - 3.12.9-1 * Tue Feb 04 2025 Charalampos Stratakis <cstratak@redhat.com> - 3.12.9-1
- Update to 3.12.9 - Update to 3.12.9
- Security fix for CVE-2025-0938 - Security fix for CVE-2025-0938