Skip to content

Commit b5833fe

Browse files
furkanondermiss-islington
authored andcommitted
gh-137056: Fix DTrace build support on NetBSD (GH-137057)
(cherry picked from commit 54a5fdf) Co-authored-by: Furkan Onder <[email protected]>
1 parent 3a1e582 commit b5833fe

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
@@ -2226,7 +2226,7 @@ Python/frozen.o: $(FROZEN_FILES_OUT)
22262226
# an include guard, so we can't use a pipeline to transform its output.
22272227
Include/pydtrace_probes.h: $(srcdir)/Include/pydtrace.d
22282228
$(MKDIR_P) Include
2229-
CC="$(CC)" CFLAGS="$(CFLAGS)" $(DTRACE) $(DFLAGS) -o $@ -h -s $<
2229+
CC="$(CC)" CFLAGS="$(CFLAGS)" $(DTRACE) $(DFLAGS) -o $@ -h -s $(srcdir)/Include/pydtrace.d
22302230
: sed in-place edit with POSIX-only tools
22312231
sed 's/PYTHON_/PyDTrace_/' $@ > [email protected]
22322232
@@ -2236,7 +2236,7 @@ Python/gc.o: $(srcdir)/Include/pydtrace.h
22362236
Python/import.o: $(srcdir)/Include/pydtrace.h
22372237

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

22412241
Objects/typeobject.o: Objects/typeslots.inc
22422242

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)