From 60ec425458d698e6cbcfd6e0f9f913aaf80dc06a Mon Sep 17 00:00:00 2001 From: aixtools Date: Tue, 28 Apr 2020 11:23:16 -0500 Subject: [PATCH 1/3] Make the build utility `makeaix_exp` able to deal with parallel build option to make (-jNN) Patch by M. Felt. --- Modules/makexp_aix | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Modules/makexp_aix b/Modules/makexp_aix index cb349c28757396..1b22e1201e5ee2 100755 --- a/Modules/makexp_aix +++ b/Modules/makexp_aix @@ -3,7 +3,7 @@ # =========================================================================== # FILE: makexp_aix # TYPE: standalone executable -# SYSTEM: AIX 3.2.5 and AIX 4 +# SYSTEM: AIX # # DESCRIPTION: This script creates an export list of ALL global symbols # from a list of object or archive files. @@ -18,6 +18,9 @@ # is an object (.o) or an archive file (.a). # # HISTORY: +# 15-Apr-2020 -- Do not run in parallel to same expFileName +# Michael Felt +# # 3-Apr-1998 -- remove C++ entries of the form Class::method # Vladimir Marangozov # @@ -33,6 +36,18 @@ expFileName=$1 toAppendStr=$2 shift; shift; inputFiles=$* + +# if lock file exists - file is already being made. +# wait for lock file to be removed, and then exit +if [[ -e ${expFileName}.lck ]]; then + while [[ -e ${expFileName}.lck ]]; do + sleep 3 + done + exit 0 +else + touch ${expFileName}.lck +fi + automsg="Generated automatically by makexp_aix" notemsg="NOTE: lists _all_ global symbols defined in the above file(s)." curwdir=`pwd` @@ -79,3 +94,5 @@ $NM -e $xopt $1 >/dev/null 2>&1 || xopt="" $NM -Bex $xopt $inputFiles \ | sed -e '/ [^BDT] /d' -e '/\./d' -e 's/.* [BDT] //' -e '/::/d' \ | sort | uniq >> $expFileName + +rm ${expFileName}.lck From c0d34c219898539c546dc9255250214a0734b413 Mon Sep 17 00:00:00 2001 From: M Felt aka aixtools Date: Tue, 2 Jun 2020 21:37:36 +0000 Subject: [PATCH 2/3] Add News blurb --- Misc/NEWS.d/next/Build/2020-06-02-21-35-11.bpo-40424.lns33S.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Build/2020-06-02-21-35-11.bpo-40424.lns33S.rst diff --git a/Misc/NEWS.d/next/Build/2020-06-02-21-35-11.bpo-40424.lns33S.rst b/Misc/NEWS.d/next/Build/2020-06-02-21-35-11.bpo-40424.lns33S.rst new file mode 100644 index 00000000000000..4ef3b48d829a7d --- /dev/null +++ b/Misc/NEWS.d/next/Build/2020-06-02-21-35-11.bpo-40424.lns33S.rst @@ -0,0 +1,2 @@ +AIX Build: fix a race condition with `makexp_aix` when calling make with -jNN. +Patch by M. Felt From 39f13614c19585150209f16fb9fce9ecd22dc758 Mon Sep 17 00:00:00 2001 From: M Felt aka aixtools Date: Sun, 5 Jul 2020 15:25:34 +0000 Subject: [PATCH 3/3] Fix intermixed output from makexp_aix when run in multi-job mode. --- .../2020-06-02-21-35-11.bpo-40424.lns33S.rst | 8 ++- Modules/makexp_aix | 60 ++++++------------- 2 files changed, 24 insertions(+), 44 deletions(-) diff --git a/Misc/NEWS.d/next/Build/2020-06-02-21-35-11.bpo-40424.lns33S.rst b/Misc/NEWS.d/next/Build/2020-06-02-21-35-11.bpo-40424.lns33S.rst index 4ef3b48d829a7d..9554dbf79cc1d1 100644 --- a/Misc/NEWS.d/next/Build/2020-06-02-21-35-11.bpo-40424.lns33S.rst +++ b/Misc/NEWS.d/next/Build/2020-06-02-21-35-11.bpo-40424.lns33S.rst @@ -1,2 +1,6 @@ -AIX Build: fix a race condition with `makexp_aix` when calling make with -jNN. -Patch by M. Felt +Fix inter-mixed output when run in a multi-job build caused by the first +job overwriting the file with the first echo and all subsequent echos appending +to the end. This causes the symbol list to be defined twice leading to errant +"ld: 0711-224 WARNING: Duplicate symbol" messages from the linker. + +Patch by M. Felt and Kevin (kadler). diff --git a/Modules/makexp_aix b/Modules/makexp_aix index 1b22e1201e5ee2..0def80ee917f3e 100755 --- a/Modules/makexp_aix +++ b/Modules/makexp_aix @@ -1,9 +1,9 @@ -#!/bin/sh +#!/usr/bin/sh # # =========================================================================== # FILE: makexp_aix # TYPE: standalone executable -# SYSTEM: AIX +# SYSTEM: AIX 3.2.5 and AIX 4 # # DESCRIPTION: This script creates an export list of ALL global symbols # from a list of object or archive files. @@ -18,11 +18,8 @@ # is an object (.o) or an archive file (.a). # # HISTORY: -# 15-Apr-2020 -- Do not run in parallel to same expFileName -# Michael Felt -# -# 3-Apr-1998 -- remove C++ entries of the form Class::method -# Vladimir Marangozov +# 3-Apr-1998 -- remove C++ entries of the form Class::method +# Vladimir Marangozov # # 1-Jul-1996 -- added header information # Vladimir Marangozov @@ -35,33 +32,18 @@ expFileName=$1 toAppendStr=$2 shift; shift; -inputFiles=$* - -# if lock file exists - file is already being made. -# wait for lock file to be removed, and then exit -if [[ -e ${expFileName}.lck ]]; then - while [[ -e ${expFileName}.lck ]]; do - sleep 3 - done - exit 0 -else - touch ${expFileName}.lck -fi - -automsg="Generated automatically by makexp_aix" -notemsg="NOTE: lists _all_ global symbols defined in the above file(s)." -curwdir=`pwd` +# run in a sub-shell so the output is written atomically +( # Create the export file and setup the header info -echo "#!"$toAppendStr > $expFileName -echo "*" >> $expFileName -echo "* $automsg (`date -u`)" >> $expFileName -echo "*" >> $expFileName -echo "* Base Directory: $curwdir" >> $expFileName -echo "* Input File(s) : $inputFiles" >> $expFileName -echo "*" >> $expFileName -echo "* $notemsg" >> $expFileName -echo "*" >> $expFileName +echo "#!"$toAppendStr +echo "*" +echo "* Generated automatically by makexp_aix (`date -u`)" +echo "*" +echo "* Input File(s) : $*" +echo "*" +echo "* NOTE: lists _all_ global symbols defined in the above file(s)." +echo "*" # Extract the symbol list using 'nm' which produces quite # different output under AIX 4 than under AIX 3.2.5. @@ -86,13 +68,7 @@ echo "*" >> $expFileName # 7. Eliminate all entries containing two colons, like Class::method # -# Use -X32_64 if it appears to be implemented in this version of 'nm'. -NM=/usr/ccs/bin/nm -xopt=-X32_64 -$NM -e $xopt $1 >/dev/null 2>&1 || xopt="" - -$NM -Bex $xopt $inputFiles \ -| sed -e '/ [^BDT] /d' -e '/\./d' -e 's/.* [BDT] //' -e '/::/d' \ -| sort | uniq >> $expFileName - -rm ${expFileName}.lck +/usr/bin/nm -Bex -X32_64 $* \ +| sed -e '/ [^BDT] /d' -e '/\./d' -e 's/.* [BDT] //' -e '/::/d' \ +| sort | uniq +) > $expFileName