[Differential] [Request, 52 lines] D1505: Enable building libclang_rt (asan, ubsan and profile) for selected arches
dim (Dimitry Andric)
phabric-noreply at FreeBSD.org
Mon Jan 12 20:37:43 UTC 2015
dim created this revision.
dim added reviewers: andrew, bapt, emaste, imp.
dim added a subscriber: freebsd-toolchain.
REVISION SUMMARY
I added the libclang_rt libraries (Address Sanitizer, Undefined Behavior
Sanitizer and Profile Guided Optimization) from compiler-rt to the tree
recently, but did not connect them to the build yet.
The requirements for these libraries are:
* Must be built with clang, gcc (not even recent versions) can build them
* Only make sense to build when either the cross-tools stage (e.g. the
stuff installed under ${WORLDTMP}) has clang enabled, or when then
final world has clang enabled.
* The sanitizer libraries can only be built for i386 and amd64.
* The profile library can only be built for i386, amd64 and LE arm.
Apart from the bit of ugliness in lib/Makefile (which Warner does not
like), there is also still a practical problem, which I have not been
able to solve as of yet:
On amd64, the build32 stage will now build the libclang_rt libraries,
but due to ${LIB32IMAKE} containing MK_TOOLCHAIN=no, the install32 stage
will *not* install them. I don't see any easy way around this, excect
maybe partially reverting r264930, but that will get us back to the
situation with NO_INCS, which Warner tried to avoid with that commit.
Note that I also did not introduce yet another WITH_LIBCLANG_RT knob,
since I don't really see the need: WITH_CLANG should basically always
cause these libraries to be built and installed.
However, if the general opinion is that another knob is good to have, I
can implement it, and move the lib/Makefile ugliness to src.opts.mk
instead.
TEST PLAN
Build and install in various situations. Do a bunch of runtime tests to
ascertain the asan, ubsan and profile libraries can be found when
building programs with -fsanitize=address, -fsanitize=undefined and
-fprofile-generate, respectively.
BRANCH
/head
REVISION DETAIL
https://reviews.freebsd.org/D1505
AFFECTED FILES
etc/mtree/BSD.usr.dist
lib/Makefile
lib/libclang_rt/Makefile
tools/build/mk/OptionalObsoleteFiles.inc
To: dim, andrew, bapt, emaste, imp
Cc: freebsd-toolchain
More information about the freebsd-toolchain
mailing list