Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-19521: Fix parallel build race condition on AIX #21997

Merged
merged 3 commits into from
Aug 29, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
bpo-19521: Fix Parallel build race condition on AIX.
   Patch by Michael Haubenwallner.
  • Loading branch information
Stefan Krah committed Aug 29, 2020
commit 51e5f7b332b3afcfec170207d557ff70ae58c361
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Modules/Setup.config
Modules/Setup.local
Modules/config.c
Modules/ld_so_aix
Modules/python.exp
Programs/_freeze_importlib
Programs/_testembed
PC/python_nt*.h
Expand Down
12 changes: 10 additions & 2 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ BLDSHARED= @BLDSHARED@ $(PY_CORE_LDFLAGS)
LDCXXSHARED= @LDCXXSHARED@
DESTSHARED= $(BINLIBDEST)/lib-dynload

# List of exported symbols for AIX
EXPORTSYMS= @EXPORTSYMS@
EXPORTSFROM= @EXPORTSFROM@

# Executable suffix (.exe on Windows and Mac OS X)
EXE= @EXEEXT@
BUILDEXE= @BUILDEXEEXT@
Expand Down Expand Up @@ -571,7 +575,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir)

# Build the interpreter
$(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
$(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) $(EXPORTSYMS)
$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)

platform: $(BUILDPYTHON) pybuilddir.txt
Expand Down Expand Up @@ -643,6 +647,10 @@ libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
libpython$(VERSION).sl: $(LIBRARY_OBJS)
$(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM)

# List of exported symbols for AIX
Modules/python.exp: $(LIBRARY)
$(srcdir)/Modules/makexp_aix $@ "$(EXPORTSFROM)" $?

# Copy up the gdb python hooks into a position where they can be automatically
# loaded by gdb during Lib/test/test_gdb.py
#
Expand Down Expand Up @@ -702,7 +710,7 @@ Makefile Modules/config.c: Makefile.pre \
@echo "The Makefile was updated, you may need to re-run make."


Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) $(EXPORTSYMS)
$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)

############################################################################
Expand Down
31 changes: 22 additions & 9 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,8 @@ ARFLAGS
ac_ct_AR
AR
GNULD
EXPORTSFROM
EXPORTSYMS
LINKCC
LDVERSION
RUNSHARED
Expand Down Expand Up @@ -5799,22 +5801,13 @@ LDVERSION="$VERSION"
# If CXX is set, and if it is needed to link a main function that was
# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
# python might then depend on the C++ runtime
# This is altered for AIX in order to build the export list before
# linking.

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LINKCC" >&5
$as_echo_n "checking LINKCC... " >&6; }
if test -z "$LINKCC"
then
LINKCC='$(PURIFY) $(MAINCC)'
case $ac_sys_system in
AIX*)
exp_extra="\"\""
if test $ac_sys_release -ge 5 -o \
$ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
exp_extra="."
fi
LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
QNX*)
# qcc must be used because the other compilers do not
# support -N.
Expand All @@ -5824,6 +5817,26 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINKCC" >&5
$as_echo "$LINKCC" >&6; }

# EXPORTSYMS holds the list of exported symbols for AIX.
# EXPORTSFROM holds the module name exporting symbols on AIX.


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking EXPORTSYMS" >&5
$as_echo_n "checking EXPORTSYMS... " >&6; }
case $ac_sys_system in
AIX*)
if test -z "$EXPORTSYMS"; then
EXPORTSYMS="Modules/python.exp"
fi
if test $ac_sys_release -ge 5 -o \
$ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
EXPORTSFROM=. # the main executable
fi
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $EXPORTSYMS" >&5
$as_echo "$EXPORTSYMS" >&6; }

# GNULD is set to "yes" if the GNU linker is used. If this goes wrong
# make sure we default having it set to "no": this is used by
# distutils.unixccompiler to know if it should add --enable-new-dtags
Expand Down
27 changes: 18 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1024,21 +1024,12 @@ LDVERSION="$VERSION"
# If CXX is set, and if it is needed to link a main function that was
# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
# python might then depend on the C++ runtime
# This is altered for AIX in order to build the export list before
# linking.
AC_SUBST(LINKCC)
AC_MSG_CHECKING(LINKCC)
if test -z "$LINKCC"
then
LINKCC='$(PURIFY) $(MAINCC)'
case $ac_sys_system in
AIX*)
exp_extra="\"\""
if test $ac_sys_release -ge 5 -o \
$ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
exp_extra="."
fi
LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
QNX*)
# qcc must be used because the other compilers do not
# support -N.
Expand All @@ -1047,6 +1038,24 @@ then
fi
AC_MSG_RESULT($LINKCC)

# EXPORTSYMS holds the list of exported symbols for AIX.
# EXPORTSFROM holds the module name exporting symbols on AIX.
AC_SUBST(EXPORTSYMS)
AC_SUBST(EXPORTSFROM)
AC_MSG_CHECKING(EXPORTSYMS)
case $ac_sys_system in
AIX*)
if test -z "$EXPORTSYMS"; then
EXPORTSYMS="Modules/python.exp"
fi
if test $ac_sys_release -ge 5 -o \
$ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
EXPORTSFROM=. # the main executable
fi
;;
esac
AC_MSG_RESULT($EXPORTSYMS)

# GNULD is set to "yes" if the GNU linker is used. If this goes wrong
# make sure we default having it set to "no": this is used by
# distutils.unixccompiler to know if it should add --enable-new-dtags
Expand Down