Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/mk fix another parallel-build race with MKDEBUG=yes by...



details:   https://anonhg.NetBSD.org/src/rev/d9e1da57acbd
branches:  trunk
changeset: 823479:d9e1da57acbd
user:      chs <chs%NetBSD.org@localhost>
date:      Mon Apr 24 17:09:37 2017 +0000

description:
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.

diffstat:

 share/mk/bsd.lib.mk |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (44 lines):

diff -r 8f8241bc6461 -r d9e1da57acbd share/mk/bsd.lib.mk
--- a/share/mk/bsd.lib.mk       Mon Apr 24 17:03:43 2017 +0000
+++ b/share/mk/bsd.lib.mk       Mon Apr 24 17:09:37 2017 +0000
@@ -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 @@
        ${_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 @@
        ${_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 @@
 .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



Home | Main Index | Thread Index | Old Index