From aabdeb766b7fa581e7de01f3c953b12792f0736d Mon Sep 17 00:00:00 2001 From: David Carlier Date: Tue, 28 Jan 2020 12:53:32 +0000 Subject: [PATCH] bpo-38960: DTrace build fix for FreeBSD. (GH-17451) DTrace build fix for FreeBSD. - allowing passing an extra flag as it need to define the arch size. - casting some probe's arguments. --- .../2019-12-03-16-41-22.bpo-38960.kvoFM0.rst | 1 + Python/ceval.c | 6 +++--- Python/import.c | 4 ++-- Python/sysmodule.c | 2 +- configure | 3 +-- configure.ac | 3 +-- 6 files changed, 9 insertions(+), 10 deletions(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2019-12-03-16-41-22.bpo-38960.kvoFM0.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-03-16-41-22.bpo-38960.kvoFM0.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-03-16-41-22.bpo-38960.kvoFM0.rst new file mode 100644 index 00000000000..50d4b6c2868 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-03-16-41-22.bpo-38960.kvoFM0.rst @@ -0,0 +1 @@ +Fix DTrace build issues on FreeBSD. Patch by David Carlier. diff --git a/Python/ceval.c b/Python/ceval.c index 2c0a23dfdd2..2770dc6d08d 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -5447,7 +5447,7 @@ dtrace_function_entry(PyFrameObject *f) funcname = PyUnicode_AsUTF8(f->f_code->co_name); lineno = PyCode_Addr2Line(f->f_code, f->f_lasti); - PyDTrace_FUNCTION_ENTRY(filename, funcname, lineno); + PyDTrace_FUNCTION_ENTRY((char *)filename, (char *)funcname, lineno); } static void @@ -5461,7 +5461,7 @@ dtrace_function_return(PyFrameObject *f) funcname = PyUnicode_AsUTF8(f->f_code->co_name); lineno = PyCode_Addr2Line(f->f_code, f->f_lasti); - PyDTrace_FUNCTION_RETURN(filename, funcname, lineno); + PyDTrace_FUNCTION_RETURN((char *)filename, (char *)funcname, lineno); } /* DTrace equivalent of maybe_call_line_trace. */ @@ -5493,7 +5493,7 @@ maybe_dtrace_line(PyFrameObject *frame, co_name = PyUnicode_AsUTF8(frame->f_code->co_name); if (!co_name) co_name = "?"; - PyDTrace_LINE(co_filename, co_name, line); + PyDTrace_LINE((char *)co_filename, (char *)co_name, line); } *instr_prev = frame->f_lasti; } diff --git a/Python/import.c b/Python/import.c index 045b6d0a9bf..2e5f78382ed 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1762,14 +1762,14 @@ import_find_and_load(PyThreadState *tstate, PyObject *abs_name) } if (PyDTrace_IMPORT_FIND_LOAD_START_ENABLED()) - PyDTrace_IMPORT_FIND_LOAD_START(PyUnicode_AsUTF8(abs_name)); + PyDTrace_IMPORT_FIND_LOAD_START((char *)PyUnicode_AsUTF8(abs_name)); mod = _PyObject_CallMethodIdObjArgs(interp->importlib, &PyId__find_and_load, abs_name, interp->import_func, NULL); if (PyDTrace_IMPORT_FIND_LOAD_DONE_ENABLED()) - PyDTrace_IMPORT_FIND_LOAD_DONE(PyUnicode_AsUTF8(abs_name), + PyDTrace_IMPORT_FIND_LOAD_DONE((char *)PyUnicode_AsUTF8(abs_name), mod != NULL); if (import_time) { diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 9f866a2a3d2..17e79603c29 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -204,7 +204,7 @@ PySys_Audit(const char *event, const char *argFormat, ...) /* Dtrace USDT point */ if (dtrace) { - PyDTrace_AUDIT(event, (void *)eventArgs); + PyDTrace_AUDIT((char *)event, (void *)eventArgs); } /* Call interpreter hooks */ diff --git a/configure b/configure index 85120e498d1..595c129814d 100755 --- a/configure +++ b/configure @@ -11386,7 +11386,6 @@ $as_echo "$with_dtrace" >&6; } DTRACE= -DFLAGS= DTRACE_HEADERS= DTRACE_OBJS= @@ -11452,7 +11451,7 @@ if ${ac_cv_dtrace_link+:} false; then : else ac_cv_dtrace_link=no echo 'BEGIN{}' > conftest.d - "$DTRACE" -G -s conftest.d -o conftest.o > /dev/null 2>&1 && \ + "$DTRACE" "$DFLAGS" -G -s conftest.d -o conftest.o > /dev/null 2>&1 && \ ac_cv_dtrace_link=yes fi diff --git a/configure.ac b/configure.ac index ab8e1b7d27a..fee605eec2a 100644 --- a/configure.ac +++ b/configure.ac @@ -3500,7 +3500,6 @@ AC_SUBST(DFLAGS) AC_SUBST(DTRACE_HEADERS) AC_SUBST(DTRACE_OBJS) DTRACE= -DFLAGS= DTRACE_HEADERS= DTRACE_OBJS= @@ -3521,7 +3520,7 @@ then [ac_cv_dtrace_link], [dnl ac_cv_dtrace_link=no echo 'BEGIN{}' > conftest.d - "$DTRACE" -G -s conftest.d -o conftest.o > /dev/null 2>&1 && \ + "$DTRACE" "$DFLAGS" -G -s conftest.d -o conftest.o > /dev/null 2>&1 && \ ac_cv_dtrace_link=yes ]) if test "$ac_cv_dtrace_link" = "yes"; then