Skip to content

Commit cbd532f

Browse files
[3.14] pythongh-137056: Fix DTrace build support on NetBSD (pythonGH-137057) (pythonGH-137444)
(cherry picked from commit 54a5fdf) Co-authored-by: Furkan Onder <[email protected]>
1 parent 7ed5419 commit cbd532f

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

Makefile.pre.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,7 +2230,7 @@ Python/frozen.o: $(FROZEN_FILES_OUT)
22302230
# an include guard, so we can't use a pipeline to transform its output.
22312231
Include/pydtrace_probes.h: $(srcdir)/Include/pydtrace.d
22322232
$(MKDIR_P) Include
2233-
CC="$(CC)" CFLAGS="$(CFLAGS)" $(DTRACE) $(DFLAGS) -o $@ -h -s $<
2233+
CC="$(CC)" CFLAGS="$(CFLAGS)" $(DTRACE) $(DFLAGS) -o $@ -h -s $(srcdir)/Include/pydtrace.d
22342234
: sed in-place edit with POSIX-only tools
22352235
sed 's/PYTHON_/PyDTrace_/' $@ > [email protected]
22362236
@@ -2240,7 +2240,7 @@ Python/gc.o: $(srcdir)/Include/pydtrace.h
22402240
Python/import.o: $(srcdir)/Include/pydtrace.h
22412241

22422242
Python/pydtrace.o: $(srcdir)/Include/pydtrace.d $(DTRACE_DEPS)
2243-
CC="$(CC)" CFLAGS="$(CFLAGS)" $(DTRACE) $(DFLAGS) -o $@ -G -s $< $(DTRACE_DEPS)
2243+
CC="$(CC)" CFLAGS="$(CFLAGS)" $(DTRACE) $(DFLAGS) -o $@ -G -s $(srcdir)/Include/pydtrace.d $(DTRACE_DEPS)
22442244

22452245
Objects/typeobject.o: Objects/typeslots.inc
22462246

configure

Lines changed: 20 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5113,16 +5113,33 @@ then
51135113
# linked into the binary. Correspondingly, dtrace(1) is missing the ELF
51145114
# generation flag '-G'. We check for presence of this flag, rather than
51155115
# hardcoding support by OS, in the interest of robustness.
5116+
#
5117+
# NetBSD DTrace requires the -x nolibs flag to avoid system library conflicts
5118+
# and uses header generation for testing instead of object generation.
51165119
AC_CACHE_CHECK([whether DTrace probes require linking],
5117-
[ac_cv_dtrace_link], [dnl
5120+
[ac_cv_dtrace_link], [
51185121
ac_cv_dtrace_link=no
51195122
echo 'BEGIN{}' > conftest.d
5120-
"$DTRACE" $DFLAGS -G -s conftest.d -o conftest.o > /dev/null 2>&1 && \
5123+
case $host in
5124+
*netbsd*)
5125+
DTRACE_TEST_FLAGS="-x nolibs -h"
5126+
;;
5127+
*)
5128+
DTRACE_TEST_FLAGS="-G"
5129+
;;
5130+
esac
5131+
"$DTRACE" $DFLAGS $DTRACE_TEST_FLAGS -s conftest.d -o conftest.o > /dev/null 2>&1 && \
51215132
ac_cv_dtrace_link=yes
51225133
])
51235134
if test "$ac_cv_dtrace_link" = "yes"; then
51245135
DTRACE_OBJS="Python/pydtrace.o"
51255136
fi
5137+
# Set NetBSD-specific DTrace flags in DFLAGS
5138+
case $host in
5139+
*netbsd*)
5140+
DFLAGS="$DFLAGS -x nolibs"
5141+
;;
5142+
esac
51265143
fi
51275144

51285145
dnl Platform-specific C and header files.

0 commit comments

Comments
 (0)