Skip to content

Commit e831b71

Browse files
committed
Fix DTrace build support on NetBSD
1 parent b13a5df commit e831b71

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
@@ -5104,16 +5104,33 @@ then
51045104
# linked into the binary. Correspondingly, dtrace(1) is missing the ELF
51055105
# generation flag '-G'. We check for presence of this flag, rather than
51065106
# hardcoding support by OS, in the interest of robustness.
5107+
#
5108+
# NetBSD DTrace requires the -x nolibs flag to avoid system library conflicts
5109+
# and uses header generation for testing instead of object generation.
51075110
AC_CACHE_CHECK([whether DTrace probes require linking],
5108-
[ac_cv_dtrace_link], [dnl
5111+
[ac_cv_dtrace_link], [
51095112
ac_cv_dtrace_link=no
51105113
echo 'BEGIN{}' > conftest.d
5111-
"$DTRACE" $DFLAGS -G -s conftest.d -o conftest.o > /dev/null 2>&1 && \
5114+
case $host in
5115+
*netbsd*)
5116+
DTRACE_TEST_FLAGS="-x nolibs -h"
5117+
;;
5118+
*)
5119+
DTRACE_TEST_FLAGS="-G"
5120+
;;
5121+
esac
5122+
"$DTRACE" $DFLAGS $DTRACE_TEST_FLAGS -s conftest.d -o conftest.o > /dev/null 2>&1 && \
51125123
ac_cv_dtrace_link=yes
51135124
])
51145125
if test "$ac_cv_dtrace_link" = "yes"; then
51155126
DTRACE_OBJS="Python/pydtrace.o"
51165127
fi
5128+
# Set NetBSD-specific DTrace flags in DFLAGS
5129+
case $host in
5130+
*netbsd*)
5131+
DFLAGS="$DFLAGS -x nolibs"
5132+
;;
5133+
esac
51175134
fi
51185135

51195136
dnl Platform-specific C and header files.

0 commit comments

Comments
 (0)