]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-131865: Properly apply exported CFLAGS for dtrace/systemtap builds (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 31 Mar 2025 18:15:45 +0000 (20:15 +0200)
committerGitHub <noreply@github.com>
Mon, 31 Mar 2025 18:15:45 +0000 (20:15 +0200)
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 <cstratak@redhat.com>
Makefile.pre.in
Misc/NEWS.d/next/Build/2025-03-31-19-22-41.gh-issue-131865.PIJy7X.rst [new file with mode: 0644]

index 2585be280533b469c0e46955f205f68d03a6e955..3bd4495f95b7a9470bb9cd5d9d04ecc713af870e 100644 (file)
@@ -1998,7 +1998,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 $@
@@ -2008,7 +2008,7 @@ Python/gc.o: $(srcdir)/Include/pydtrace.h
 Python/import.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 (file)
index 0000000..a287e0b
--- /dev/null
@@ -0,0 +1,2 @@
+The DTrace build now properly passes the ``CC`` and ``CFLAGS`` variables
+to the ``dtrace`` command when utilizing SystemTap on Linux.