tech-toolchain archive

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

Re: Deterministic C++ files



On Wed, Jul 16, 2008 at 11:17:50AM +1000, matthew green wrote:
> if you want the seeds to be unique across builds with different paths
> then you really need to trim them down like you meantioned i believe.

Attached patch does that. I'm not sure yet it is enough as GCC seems to
do some magic itself, but I will be looking at that separately.

Joerg
Index: sys.mk
===================================================================
RCS file: /data/repo/netbsd/src/share/mk/sys.mk,v
retrieving revision 1.97
diff -u -p -r1.97 sys.mk
--- sys.mk      6 May 2008 22:19:11 -0000       1.97
+++ sys.mk      16 Jul 2008 01:22:58 -0000
@@ -51,7 +51,13 @@ LINK.c?=     ${CC} ${CFLAGS} ${CPPFLAGS} ${L
 CXX?=          c++
 CXXFLAGS?=     
${CFLAGS:N-Wno-traditional:N-Wstrict-prototypes:N-Wmissing-prototypes:N-std=gnu99}
 
-COMPILE.cc?=   ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
+__ALLSRC1=     ${empty(DESTDIR):?${.ALLSRC}:${.ALLSRC:S|^${DESTDIR}|^destdir|}}
+__ALLSRC2=     
${empty(MAKEOBJDIR):?${__ALLSRC1}:${__ALLSRC1:S|^${MAKEOBJDIR}|^obj|}}
+__ALLSRC3=     
${empty(NETBSDSRCDIR):?${__ALLSRC2}:${__ALLSRC2:S|^${NETBSDSRCDIR}|^src|}}
+
+CXXSEED?=      
${BUILD_SEED:D-frandom-seed=${BUILD_SEED:Q}/${__ALLSRC3:O:Q}/${.TARGET:Q}}
+
+COMPILE.cc?=   ${CXX} ${CXXSEED} ${CXXFLAGS} ${CPPFLAGS} -c
 LINK.cc?=      ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
 
 OBJC?=         ${CC}


Home | Main Index | Thread Index | Old Index