to another shared object
2. Don't compare ${LIBISPRIVATE} to "yes", because there are 3 places in
Makefiles which set it to empty (this was a bug)
3. For private libraries, don't create .so* files
Define _REENTRANT for MKSANITIZER build. This is needed for at least stdio
code. This caused new build issued with duplicated symbols in few places
and rump kernel code picking different code paths borrowed from libc.
Handle all this in one go.
Add bsd.sanitizer.mk to share common code used by programs and libraries.
Switch from realall to beforeinstall target in .syms files. This is more
reliable in MKSANITIZER.
platforms where PIC is available, so that linking shared objects with
-pg works, without needing to create a shared library version of the
profiled libraries.
Add flags that are required to build a program and a dynamically loaded
library.
Propagade LIBCSANITIZERFLAGS to CFLAGS and CXXFLAGS.
LDFLAGS is not changed on purpose, as a libcsanitizer is inside libc
and no external dependencies are needed.
Register NOLIBCSANITIZER, as certain distribution parts will need to be
skipped.
A new keyword SANITIZER_RENAME_SYMBOL. It's a variable that has specified
a list of symbols to be renamed in a processor in order to remove naming
conflicts with public symbols in libc/m/pthread/rt.
This renaming will occur for libraries and programs.
A symbol with a conflicting 'name', will be renamed to '__mksanitizer_name'.
Based on an idea by <christos>
Introduce a new variable SANITIZERFLAGS that contains all the sanitizer
specific flags. These flags are designed to be passed to CFLAGS, CXXFLAGS
and LDFLAGS.
Pass SANITIZERFLAGS in bsd.prog.mk rules to CFLAGS, CXXFLAGS and LDFLAGS.
Pass SANITIZERFLAGS in bsd.lib.mk rules to *_pic.a build flags. The *_pic.a
libraries are designed to construct .so libraries. All .so libraries with
few exceptions are expected to be prebuilt with a sanitizer. Another
purpuse of *_pic.a files can be constructing static PIE programs, however
they are not supported as of now and there is no sanitization of static
programs either.
Once MKSTATICPIE will be supported, it will be initially incompatible with
MKSANITIZER.
This change also makes it easier to build other targets like kernel and
kernel modules without userland sanitizers.
No functional change intended for MKSANITIZER=no users.
use ${LD} ${LDFLAGS} -r which does not work if we specify MKRELRO since
LDFLAGS is supposed to be passed to LINK.c not LD directly (although some
of the flags work).
If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).
Proposed and discussed on tech-kern and tech-toolchain
.so file from the main link of it, and use the main file as the
input for both the .so output and the .so.debug file. for MKDEBUG
builds we now:
(a) create the (new) .so.full file
(d) create the .so.debug file
(c) create the (installable) .so file
for other builds, we simply use the same rule for (a) to create (c).
this stops the .so.debug rule from modifying the .so rule's target
and leading to mayhem.
see this thread for more details:
http://mail-index.netbsd.org/tech-toolchain/2015/06/03/msg002616.html
It is now past any conditionals where its emptiness or nonemptiness can
influence the decision of what objects get built.
Fixes MKDEBUG=yes build on vax (PR 47700).