https://github.com/python/cpython/commit/b87ea7d4e3659179786713143398dc8e731bb2e4
commit: b87ea7d4e3659179786713143398dc8e731bb2e4
branch: 3.12
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: vstinner <vstin...@python.org>
date: 2025-03-31T18:29:04Z
summary:

[3.12] gh-131865: Properly apply exported CFLAGS for dtrace/systemtap builds 
(GH-131866) (#131951)

gh-131865: Properly apply exported CFLAGS for dtrace/systemtap builds 
(GH-131866)

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.

The fix does not affect the dtrace invocation on Solaris/macOS.
(cherry picked from commit 0cd4befb02df07c0b320cd6246227c13e57b2efb)

Co-authored-by: stratakis <cstra...@redhat.com>

files:
A Misc/NEWS.d/next/Build/2025-03-31-19-22-41.gh-issue-131865.PIJy7X.rst
M Makefile.pre.in

diff --git a/Makefile.pre.in b/Makefile.pre.in
index c6943ea8231c51..7ca3dc62c01555 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 00000000000000..a287e0b22834f3
--- /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.

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to