8000 bpo-19521: Fix parallel build race condition on AIX (GH-21997) · python/cpython@e6dcd37 · GitHub
[go: up one dir, main page]

Skip to content

Commit e6dcd37

Browse files
author
Stefan Krah
authored
bpo-19521: Fix parallel build race condition on AIX (GH-21997)
Patch by Michael Haubenwallner.
1 parent 8784d33 commit e6dcd37

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@
@@ -571,7 +575,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c
571575
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir)
572576

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

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

650+
# List of exported symbols for AIX
651+
Modules/python.exp: $(LIBRARY)
652+
$(srcdir)/Modules/makexp_aix $@ "$(EXPORTSFROM)" $?
653+
646654
# Copy up the gdb python hooks into a position where they can be automatically
647655
# loaded by gdb during Lib/test/test_gdb.py
648656
#
@@ -702,7 +710,7 @@ Makefile Modules/config.c: Makefile.pre \
702710
@echo "The Makefile was updated, you may need to re-run make."
703711

704712

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

708716
############################################################################

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
@@ -5799,22 +5801,13 @@ LDVERSION="$VERSION"
57995801
# If CXX is set, and if it is needed to link a main function that was
58005802
# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
58015803
# python might then depend on the C++ runtime
5802-
# This is altered for AIX in order to build the export list before
5803-
# linking.
58045804

58055805
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LINKCC" >&5
58065806
$as_echo_n "checking LINKCC... " >&6; }
58075807
if test -z "$LINKCC"
58085808
then
58095809
LINKCC='$(PURIFY) $(MAINCC)'
58105810
case $ac_sys_system in
5811-
AIX*)
5812-
exp_extra="\"\""
5813-
if test $ac_sys_release -ge 5 -o \
5814-
$ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
5815-
exp_extra="."
5816-
fi
5817-
LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
58185811
QNX*)
58195812
# qcc must be used because the other compilers do not
58205813
# support -N.
@@ -5824,6 +5817,26 @@ fi
58245817
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINKCC" >&5
58255818
$as_echo "$LINKCC" >&6; }
58265819

5820+
# EXPORTSYMS holds the list of exported symbols for AIX.
5821+
# EXPORTSFROM holds the module name exporting symbols on AIX.
5822+
EXPORTSYMS=
5823+
EXPORTSFROM=
5824+
5825+
5826+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking EXPORTSYMS" >&5
5827+
$as_echo_n "checking EXPORTSYMS... " >&6; }
5828+
case $ac_sys_system in
5829+
AIX*)
5830+
EXPORTSYMS="Modules/python.exp"
5831+
if test $ac_sys_release -ge 5 -o \
5832+
$ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
5833+
EXPORTSFROM=. # the main executable
5834+
fi
5835+
;;
5836+
esac
5837+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $EXPORTSYMS" >&5
5838+
$as_echo "$EXPORTSYMS" >&6; }
5839+
58275840
# GNULD is set to "yes" if the GNU linker is used. If this goes wrong
58285841
# make sure we default having it set to "no": this is used by
58295842
# 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)
0