Page MenuHomeFreeBSD

Install the 32-bit compat sanitizer libraries.
ClosedPublic

Authored by jhb on Aug 2 2018, 11:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 16, 3:59 AM
Unknown Object (File)
Apr 11 2024, 6:28 PM
Unknown Object (File)
Apr 9 2024, 11:33 AM
Unknown Object (File)
Apr 9 2024, 6:39 AM
Unknown Object (File)
Mar 22 2024, 5:13 PM
Unknown Object (File)
Mar 22 2024, 5:13 PM
Unknown Object (File)
Mar 22 2024, 5:13 PM
Unknown Object (File)
Mar 9 2024, 9:41 AM
Subscribers

Details

Summary

The lib32 build was already building the i386 version of
the clang sanitizers (libclang_rt) but they were not being
installed. This enables the installation.

MK_TOOLCHAIN=no was originally added to the install make
environment to disable includes so that NO_INCS could be
removed. The MK_TOOLCHAIN in bsd.incs.mk was subsequently
renamed to MK_INCLUDES, but bsd.lib.mk doesn't even include
bsd.incs.mk when LIBRARIES_ONLY is defined which the install
make environment for compat libs now defines. However,
setting MK_TOOLCHAIN=no forced MK_CLANG=no which disabled
libclang_rt during the install32 phase. Remove MK_TOOLCHAIN=no
since LIBRARIES_ONLY is now sufficient.

Since the libcompat environment overrides both LIBDIR and
SHLIBDIR, libclang_rt/Makefile.inc has to set both variables
to force the libraries to be installed to the location
expected by the compiler.

Note: I'm not really certain that the dynamic ASAN library
should be buried under /usr/lib/clang/lib. A simple test
case using -fsanitize=address doesn't use it, so I'm not
sure if we need these libraries in /usr/lib instead where
rtld can find them or if clang sets a suitable rpath when
using them such that the SHLIBDIR change really is required
and correct.

Test Plan
  • compared 'find /usr/lib*' before and after to ensure that enabling MK_TOOLCHAIN didn't turn on other things besides just the i386 sanitizer
  • Trying to build a sample asan test case with 'clang -fsanitize=address -m32' which failed to link before and now suceeds.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

LGTM.

Note that it is upstream which places the .so file in /usr/lib/clang/X.Y.Z, supposedly because it is very version-dependent. I'm unsure as to whether there is in any RPATH magic involved. In fact, I have never properly gotten the dynamic ASan lib working, as far as I remember.

This revision is now accepted and ready to land.Aug 3 2018, 5:50 AM

Oh btw, this might also need lines in OptionalObsoleteFiles.inc?

In D16574#352008, @dim wrote:

Oh btw, this might also need lines in OptionalObsoleteFiles.inc?

That file already lists all of the sanitizers for both amd64 and i386 so I think it should work fine as-is.

For reference MK_TOOLCHAIN=no came in rS264930

For reference MK_TOOLCHAIN=no came in rS264930

*nod* I described what I think was the chain of events, but wanted to check with you that there weren't other reasons to keep MK_TOOLCHAIN=no for the current state.

This revision was automatically updated to reflect the committed changes.