Clang and -frandom-seed

Dimitry Andric dim at FreeBSD.org
Sun Nov 21 15:25:04 UTC 2010


On 2010-11-19 16:51, Erik Cederstrand wrote:
> Poking around, I decided to add this patch:
>
> # svn diff lib/clang/clang.build.mk
> Index: lib/clang/clang.build.mk
> ===================================================================
> --- lib/clang/clang.build.mk	(revision 215422)
> +++ lib/clang/clang.build.mk	(working copy)
> @@ -28,6 +28,13 @@
>   CXXFLAGS+=-fno-rtti
>   .endif
>
> +.ifdef WITH_DETERMINISTIC
> +CXXFLAGS+=-frandom-seed=0
> +.endif

This will probably not work as expected.  The -frandom-seed option must
be different for each source file.


> and added "WITH_DETERMINISTIC=true" to /etc/src.conf. The "random-seed=0" should ensure that the same random elements are generated every time.
>
> I then ran two buildworlds with the same MAKEOBJDIRPREFIX but two different DESTDIRs, and compared the two clang binaries. The random-seed option does show up un the log, so it's getting picked up, but apparently it was not enough, as the random elements are still different.
>
> Any hints on where in the build infrastructure I should add the flag, or what to grep for in the buildworld log to find out what's wrong?
>
> Also, how can I compile just clang? I tried "cd src/usr.bin/clang; make" but it dies violently:
>
> /usr/home/erik/freebsd/head/src/usr.bin/clang/clang/../../../contrib/llvm/tools/clang/include/clang/Basic/Diagnostic.h: At global scope:
> /usr/home/erik/freebsd/head/src/usr.bin/clang/clang/../../../contrib/llvm/tools/clang/include/clang/Basic/Diagnostic.h:999: error: expected ',' or '...' before '&' token
> /usr/home/erik/freebsd/head/src/usr.bin/clang/clang/../../../contrib/llvm/tools/clang/include/clang/Basic/Diagnostic.h:1000: error: ISO C++ forbids declaration of 'LangOptions' with no type
> /usr/home/erik/freebsd/head/src/usr.bin/clang/clang/../../../contrib/llvm/tools/clang/include/clang/Basic/Diagnostic.h:1019: error: expected declaration before '}' token

I don't see this error if I repeat your commands, but in any case you
must first build in lib/clang, before you can build in usr.bin/clang,
e.g.:

make -C $SRCDIR/lib/clang && make -C $SRCDIR/usr.bin/clang


More information about the freebsd-toolchain mailing list