*.cover
*.iml
*.o
+*.lto
*.a
*.so
*.so.*
*.dylib
+*.dSYM
*.dll
*.wasm
*.orig
DFLAGS= @DFLAGS@
DTRACE_HEADERS= @DTRACE_HEADERS@
DTRACE_OBJS= @DTRACE_OBJS@
+DSYMUTIL= @DSYMUTIL@
+DSYMUTIL_PATH= @DSYMUTIL_PATH@
GNULD= @GNULD@
# Default target
all: @DEF_MAKE_ALL_RULE@
build_all: check-clean-src $(BUILDPYTHON) platform sharedmods \
- gdbhooks Programs/_testembed scripts checksharedmods
+ gdbhooks Programs/_testembed scripts checksharedmods rundsymutil
build_wasm: check-clean-src $(BUILDPYTHON) platform sharedmods \
python-config checksharedmods
checksharedmods: sharedmods $(PYTHON_FOR_BUILD_DEPS) $(BUILDPYTHON)
@$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/check_extension_modules.py
+rundsymutil: sharedmods $(PYTHON_FOR_BUILD_DEPS) $(BUILDPYTHON)
+ @if [ ! -z $(DSYMUTIL) ] ; then \
+ echo $(DSYMUTIL_PATH) $(BUILDPYTHON); \
+ $(DSYMUTIL_PATH) $(BUILDPYTHON); \
+ if test -f $(LDLIBRARY); then \
+ echo $(DSYMUTIL_PATH) $(LDLIBRARY); \
+ $(DSYMUTIL_PATH) $(LDLIBRARY); \
+ fi; \
+ for mod in X $(SHAREDMODS); do \
+ if test $$mod != X; then \
+ echo $(DSYMUTIL_PATH) $$mod; \
+ $(DSYMUTIL_PATH) $$mod; \
+ fi; \
+ done \
+ fi
+
Modules/Setup.local:
@# Create empty Setup.local when file was deleted by user
echo "# Edit this file for local setup changes" > $@
if test $$i != X; then \
echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
$(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
+ if test -d "$$i.dSYM"; then \
+ echo $(DSYMUTIL_PATH) $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
+ $(DSYMUTIL_PATH) $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
+ fi; \
fi; \
done
+
$(DESTSHARED):
@for i in $(DESTDIRS); \
do \
-output $(DESTDIR)$(BINDIR)/python$(VERSION)-intel64$(EXE) \
$(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
fi
+ # Install macOS debug information (if available)
+ if test -d "$(BUILDPYTHON).dSYM"; then \
+ echo $(DSYMUTIL_PATH) $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \
+ $(DSYMUTIL_PATH) $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \
+ fi
+ if test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \
+ if test -d "$(LDLIBRARY).dSYM"; then \
+ echo $(DSYMUTIL_PATH) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
+ $(DSYMUTIL_PATH) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
+ fi \
+ else \
+ if test -d "$(LDLIBRARY).dSYM"; then \
+ echo $(DSYMUTIL_PATH) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(INSTSONAME); \
+ $(DSYMUTIL_PATH) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(INSTSONAME); \
+ fi \
+ fi
+
bininstall: altbininstall
if test ! -d $(DESTDIR)$(LIBPC); then \
find . -name '*.[oa]' -exec rm -f {} ';'
find . -name '*.s[ol]' -exec rm -f {} ';'
find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
+ find . -name '*.lto' -exec rm -f {} ';'
find . -name '*.wasm' -exec rm -f {} ';'
find . -name '*.lst' -exec rm -f {} ';'
find build -name 'fficonfig.h' -exec rm -f {} ';' || true
# Declare targets that aren't real files
.PHONY: all build_all build_wasm check-clean-src
-.PHONY: sharedmods checksharedmods test quicktest
+.PHONY: sharedmods checksharedmods test quicktest rundsymutil
.PHONY: install altinstall sharedinstall bininstall altbininstall
.PHONY: maninstall libinstall inclinstall libainstall
.PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
--- /dev/null
+Add a new ``--with-dsymutil`` configure option to to link debug information
+in macOS. Patch by Pablo Galindo.
LDCXXSHARED
LDSHARED
SHLIB_SUFFIX
+DSYMUTIL_PATH
+DSYMUTIL
LIBTOOL_CRUFT
OTHER_LIBTOOL_OPT
UNIVERSAL_ARCH_FLAGS
enable_optimizations
with_lto
enable_bolt
+with_dsymutil
with_address_sanitizer
with_memory_sanitizer
with_undefined_behavior_sanitizer
--with-lto=[full|thin|no|yes]
enable Link-Time-Optimization in any build (default
is no)
+ --with-dsymutil link debug information into final executable with
+ dsymutil in macOS (default is no)
--with-address-sanitizer
enable AddressSanitizer memory error detector,
'asan' (default is no)
# Any changes made here should be reflected in the GCC+Darwin case below
if test $Py_LTO_POLICY = default
then
- LTOFLAGS="-flto -Wl,-export_dynamic"
+ LTOFLAGS="-flto -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto"
LTOCFLAGS="-flto"
else
- LTOFLAGS="-flto=${Py_LTO_POLICY} -Wl,-export_dynamic"
+ LTOFLAGS="-flto=${Py_LTO_POLICY} -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto"
LTOCFLAGS="-flto=${Py_LTO_POLICY}"
fi
;;
LDFLAGS_NOLTO="-fno-lto"
case $ac_sys_system in
Darwin*)
- LTOFLAGS="-flto -Wl,-export_dynamic"
+ LTOFLAGS="-flto -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto"
LTOCFLAGS="-flto"
;;
*)
$as_echo "no" >&6; }
fi
+# Check for --with-dsymutil
+
+
+DSYMUTIL=
+DSYMUTIL_PATH=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-dsymutil" >&5
+$as_echo_n "checking for --with-dsymutil... " >&6; }
+
+# Check whether --with-dsymutil was given.
+if test "${with_dsymutil+set}" = set; then :
+ withval=$with_dsymutil;
+if test "$withval" != no
+then
+ if test "$MACHDEP" != "darwin"; then
+ as_fn_error $? "dsymutil debug linking is only available in macOS." "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; };
+ DSYMUTIL='true'
+else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }; DSYMUTIL=
+fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test "$DSYMUTIL"; then
+ # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_DSYMUTIL_PATH+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DSYMUTIL_PATH in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DSYMUTIL_PATH="$DSYMUTIL_PATH" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_DSYMUTIL_PATH="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_DSYMUTIL_PATH" && ac_cv_path_DSYMUTIL_PATH="not found"
+ ;;
+esac
+fi
+DSYMUTIL_PATH=$ac_cv_path_DSYMUTIL_PATH
+if test -n "$DSYMUTIL_PATH"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL_PATH" >&5
+$as_echo "$DSYMUTIL_PATH" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test "$DSYMUTIL_PATH" = "not found"; then
+ as_fn_error $? "dsymutil command not found on \$PATH" "$LINENO" 5
+ fi
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dyld" >&5
$as_echo_n "checking for dyld... " >&6; }
case $ac_sys_system/$ac_sys_release in
# Any changes made here should be reflected in the GCC+Darwin case below
if test $Py_LTO_POLICY = default
then
- LTOFLAGS="-flto -Wl,-export_dynamic"
+ LTOFLAGS="-flto -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto"
LTOCFLAGS="-flto"
else
- LTOFLAGS="-flto=${Py_LTO_POLICY} -Wl,-export_dynamic"
+ LTOFLAGS="-flto=${Py_LTO_POLICY} -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto"
LTOCFLAGS="-flto=${Py_LTO_POLICY}"
fi
;;
LDFLAGS_NOLTO="-fno-lto"
case $ac_sys_system in
Darwin*)
- LTOFLAGS="-flto -Wl,-export_dynamic"
+ LTOFLAGS="-flto -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto"
LTOCFLAGS="-flto"
;;
*)
AC_MSG_RESULT(no)
fi
+# Check for --with-dsymutil
+AC_SUBST(DSYMUTIL)
+AC_SUBST(DSYMUTIL_PATH)
+DSYMUTIL=
+DSYMUTIL_PATH=
+AC_MSG_CHECKING(for --with-dsymutil)
+AC_ARG_WITH(dsymutil,
+ AS_HELP_STRING([--with-dsymutil], [link debug information into final executable with dsymutil in macOS (default is no)]),
+[
+if test "$withval" != no
+then
+ if test "$MACHDEP" != "darwin"; then
+ AC_MSG_ERROR([dsymutil debug linking is only available in macOS.])
+ fi
+ AC_MSG_RESULT(yes);
+ DSYMUTIL='true'
+else AC_MSG_RESULT(no); DSYMUTIL=
+fi],
+[AC_MSG_RESULT(no)])
+
+if test "$DSYMUTIL"; then
+ AC_PATH_PROG(DSYMUTIL_PATH, [dsymutil], [not found])
+ if test "$DSYMUTIL_PATH" = "not found"; then
+ AC_MSG_ERROR([dsymutil command not found on \$PATH])
+ fi
+fi
+
AC_MSG_CHECKING(for dyld)
case $ac_sys_system/$ac_sys_release in
Darwin/*)