tech-toolchain archive

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

.debug objects build rule need some care



Hi,

After some closer examination to the debug objects build rule, i do
see the following problems :

1) The generated .debug objects needs to have a newer timestamp than
   the sources. Which currently cannot be guaranteed due to source
   being modified after target generation.

2) The second objcopy call, if failing, will mostly remains unnoticed
   because of the rm call which will return a `good' status.

Do the attached patch, which aims at fixing both, look acceptable ?

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.
Index: share/mk/bsd.prog.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.prog.mk,v
retrieving revision 1.248
diff -u -p -r1.248 bsd.prog.mk
--- share/mk/bsd.prog.mk        24 Apr 2010 07:57:04 -0000      1.248
+++ share/mk/bsd.prog.mk        26 May 2010 15:12:09 -0000
@@ -324,8 +324,10 @@ ${_P}.ro: ${OBJS.${_P}} ${DPADD}
 ${_PROGDEBUG.${_P}}: ${_P}
        ${_MKTARGET_CREATE}
        ${OBJCOPY} --only-keep-debug ${_P} ${_PROGDEBUG.${_P}}
-       ${OBJCOPY} --strip-debug -R .gnu_debuglink 
--add-gnu-debuglink=${_PROGDEBUG.${_P}} ${_P} \
-           || rm -f ${_PROGDEBUG.${_P}}
+       ${OBJCOPY} --strip-debug \
+           -R .gnu_debuglink --add-gnu-debuglink=${_PROGDEBUG.${_P}} ${_P} \
+           || (rm -f ${_PROGDEBUG.${_P}} && false)
+       touch ${_PROGDEBUG.${_P}}
 .endif
 
 .endif # defined(OBJS.${_P}) && !empty(OBJS.${_P})                     # }
Index: share/mk/bsd.lib.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.lib.mk,v
retrieving revision 1.307
diff -u -p -r1.307 bsd.lib.mk
--- share/mk/bsd.lib.mk 27 Apr 2010 14:32:14 -0000      1.307
+++ share/mk/bsd.lib.mk 26 May 2010 15:12:09 -0000
@@ -598,7 +598,8 @@ ${_LIB.debug}: ${_LIB.so}
        ${OBJCOPY} --only-keep-debug ${_LIB.so} ${_LIB.debug}
        ${OBJCOPY} --strip-debug \
            -R .gnu_debuglink --add-gnu-debuglink=${_LIB.debug} ${_LIB.so} \
-           || rm -f ${_LIB.debug}
+           || (rm -f ${_LIB.debug} && false)
+       touch ${_LIB.debug}
 .endif
 
 .if !empty(LOBJS)                                                      # {


Home | Main Index | Thread Index | Old Index