Skip to content

Commit 88b86a9

Browse files
miss-islingtonStefan Krah
and
Stefan Krah
authored
bpo-19521: Fix parallel build race condition on AIX (GH-22001)
Patch by Michael Haubenwallner. (cherry picked from commit e6dcd37) Co-authored-by: Stefan Krah <skrah@bytereef.org>
1 parent c01a7ed commit 88b86a9

File tree

3 files changed

+50
-20
lines changed

3 files changed

+50
-20
lines changed

Makefile.pre.in

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ BLDSHARED= @BLDSHARED@ $(PY_CORE_LDFLAGS)
161161
LDCXXSHARED= @LDCXXSHARED@
162162
DESTSHARED= $(BINLIBDEST)/lib-dynload
163163

164+
# List of exported symbols for AIX
165+
EXPORTSYMS= @EXPORTSYMS@
166+
EXPORTSFROM= @EXPORTSFROM@
167+
164168
# Executable suffix (.exe on Windows and Mac OS X)
165169
EXE= @EXEEXT@
166170
BUILDEXE= @BUILDEXEEXT@
@@ -582,7 +586,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c
582586
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir)
583587

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

588592
platform: $(BUILDPYTHON) pybuilddir.txt
@@ -654,6 +658,10 @@ libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
654658
libpython$(VERSION).sl: $(LIBRARY_OBJS)
655659
$(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM)
656660

661+
# List of exported symbols for AIX
662+
Modules/python.exp: $(LIBRARY)
663+
$(srcdir)/Modules/makexp_aix $@ "$(EXPORTSFROM)" $?
664+
657665
# Copy up the gdb python hooks into a position where they can be automatically
658666
# loaded by gdb during Lib/test/test_gdb.py
659667
#
@@ -713,7 +721,7 @@ Makefile Modules/config.c: Makefile.pre \
713721
@echo "The Makefile was updated, you may need to re-run make."
714722

715723

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

719727
############################################################################

configure

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,8 @@ ARFLAGS
700700
ac_ct_AR
701701
AR
702702
GNULD
703+
EXPORTSFROM
704+
EXPORTSYMS
703705
LINKCC
704706
LDVERSION
705707
RUNSHARED
@@ -5795,22 +5797,13 @@ LDVERSION="$VERSION"
57955797
# If CXX is set, and if it is needed to link a main function that was
57965798
# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
57975799
# python might then depend on the C++ runtime
5798-
# This is altered for AIX in order to build the export list before
5799-
# linking.
58005800

58015801
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LINKCC" >&5
58025802
$as_echo_n "checking LINKCC... " >&6; }
58035803
if test -z "$LINKCC"
58045804
then
58055805
LINKCC='$(PURIFY) $(MAINCC)'
58065806
case $ac_sys_system in
5807-
AIX*)
5808-
exp_extra="\"\""
5809-
if test $ac_sys_release -ge 5 -o \
5810-
$ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
5811-
exp_extra="."
5812-
fi
5813-
LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
58145807
QNX*)
58155808
# qcc must be used because the other compilers do not
58165809
# support -N.
@@ -5820,6 +5813,26 @@ fi
58205813
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINKCC" >&5
58215814
$as_echo "$LINKCC" >&6; }
58225815

5816+
# EXPORTSYMS holds the list of exported symbols for AIX.
5817+
# EXPORTSFROM holds the module name exporting symbols on AIX.
5818+
EXPORTSYMS=
5819+
EXPORTSFROM=
5820+
5821+
5822+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking EXPORTSYMS" >&5
5823+
$as_echo_n "checking EXPORTSYMS... " >&6; }
5824+
case $ac_sys_system in
5825+
AIX*)
5826+
EXPORTSYMS="Modules/python.exp"
5827+
if test $ac_sys_release -ge 5 -o \
5828+
$ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
5829+
EXPORTSFROM=. # the main executable
5830+
fi
5831+
;;
5832+
esac
5833+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $EXPORTSYMS" >&5
5834+
$as_echo "$EXPORTSYMS" >&6; }
5835+
58235836
# GNULD is set to "yes" if the GNU linker is used. If this goes wrong
58245837
# make sure we default having it set to "no": this is used by
58255838
# distutils.unixccompiler to know if it should add --enable-new-dtags

configure.ac

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,21 +1024,12 @@ LDVERSION="$VERSION"
10241024
# If CXX is set, and if it is needed to link a main function that was
10251025
# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
10261026
# python might then depend on the C++ runtime
1027-
# This is altered for AIX in order to build the export list before
1028-
# linking.
10291027
AC_SUBST(LINKCC)
10301028
AC_MSG_CHECKING(LINKCC)
10311029
if test -z "$LINKCC"
10321030
then
10331031
LINKCC='$(PURIFY) $(MAINCC)'
10341032
case $ac_sys_system in
1035-
AIX*)
1036-
exp_extra="\"\""
1037-
if test $ac_sys_release -ge 5 -o \
1038-
$ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
1039-
exp_extra="."
1040-
fi
1041-
LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
10421033
QNX*)
10431034
# qcc must be used because the other compilers do not
10441035
# support -N.
@@ -1047,6 +1038,24 @@ then
10471038
fi
10481039
AC_MSG_RESULT($LINKCC)
10491040

1041+
# EXPORTSYMS holds the list of exported symbols for AIX.
1042+
# EXPORTSFROM holds the module name exporting symbols on AIX.
1043+
EXPORTSYMS=
1044+
EXPORTSFROM=
1045+
AC_SUBST(EXPORTSYMS)
1046+
AC_SUBST(EXPORTSFROM)
1047+
AC_MSG_CHECKING(EXPORTSYMS)
1048+
case $ac_sys_system in
1049+
AIX*)
1050+
EXPORTSYMS="Modules/python.exp"
1051+
if test $ac_sys_release -ge 5 -o \
1052+
$ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
1053+
EXPORTSFROM=. # the main executable
1054+
fi
1055+
;;
1056+
esac
1057+
AC_MSG_RESULT($EXPORTSYMS)
1058+
10501059
# GNULD is set to "yes" if the GNU linker is used. If this goes wrong
10511060
# make sure we default having it set to "no": this is used by
10521061
# distutils.unixccompiler to know if it should add --enable-new-dtags

0 commit comments

Comments
 (0)