Module Name: src
Committed By: chs
Date: Mon Apr 24 17:09:37 UTC 2017
Modified Files:
src/share/mk: bsd.lib.mk
Log Message:
fix another parallel-build race with MKDEBUG=yes by creating the .so.link
with a temporary name and renaming to the final name only after
the file is fully written.
To generate a diff of this commit:
cvs rdiff -u -r1.369 -r1.370 src/share/mk/bsd.lib.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/share/mk/bsd.lib.mk
diff -u src/share/mk/bsd.lib.mk:1.369 src/share/mk/bsd.lib.mk:1.370
--- src/share/mk/bsd.lib.mk:1.369 Thu Apr 20 09:29:11 2017
+++ src/share/mk/bsd.lib.mk Mon Apr 24 17:09:37 2017
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.lib.mk,v 1.369 2017/04/20 09:29:11 ozaki-r Exp $
+# $NetBSD: bsd.lib.mk,v 1.370 2017/04/24 17:09:37 chs Exp $
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
.include <bsd.init.mk>
@@ -632,7 +632,8 @@ ${_LIB.so.full}: ${_LIB.so.link} ${_LIB.
${_MKTARGET_CREATE}
( ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
--add-gnu-debuglink=${_LIB.so.debug} \
- ${_LIB.so.link} ${_LIB.so.full} \
+ ${_LIB.so.link} ${_LIB.so.full}.tmp && \
+ mv -f ${_LIB.so.full}.tmp ${_LIB.so.full} \
) || (rm -f ${.TARGET}; false)
${_LIB.so.link}: ${_MAINLIBDEPS}
.else # aka no MKDEBUG
@@ -641,9 +642,13 @@ ${_LIB.so.full}: ${_MAINLIBDEPS}
${_MKTARGET_BUILD}
rm -f ${.TARGET}
${LIBCC} ${LDLIBC} -shared ${SHLIB_SHFLAGS} \
- ${_LDFLAGS.${_LIB}} -o ${.TARGET} ${_LIBLDOPTS} \
+ ${_LDFLAGS.${_LIB}} -o ${.TARGET}.tmp ${_LIBLDOPTS} \
-Wl,--whole-archive ${SOLIB} \
-Wl,--no-whole-archive ${_LDADD.${_LIB}}
+.if ${MKSTRIPIDENT} != "no"
+ ${OBJCOPY} -R .ident ${.TARGET}.tmp
+.endif
+ mv -f ${.TARGET}.tmp ${.TARGET}
# We don't use INSTALL_SYMLINK here because this is just
# happening inside the build directory/objdir. XXX Why does
# this spend so much effort on libraries that aren't live??? XXX
@@ -656,9 +661,6 @@ ${_LIB.so.full}: ${_MAINLIBDEPS}
.endif
${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so}.tmp
mv -f ${_LIB.so}.tmp ${_LIB.so}
-.if ${MKSTRIPIDENT} != "no"
- ${OBJCOPY} -R .ident ${.TARGET}
-.endif
.if !empty(LOBJS) # {
LLIBS?= -lc