Source-Changes-HG archive

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

[src/trunk]: src Enhance MKSANITIZER support



details:   https://anonhg.NetBSD.org/src/rev/eda739974ca3
branches:  trunk
changeset: 964933:eda739974ca3
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Aug 23 06:38:27 2019 +0000

description:
Enhance MKSANITIZER support

Add i386 support for LLVM sanitizers.

Add new build phases do-sanitizer-* for building LLVM sanitizers after libs
and before other programs. This phase is important as sanitizers need
to link with libs and sanitized programs must link with sanitizer runtimes.

diffstat:

 Makefile                                               |  23 +++++++++++++++++-
 distrib/sets/lists/base/md.i386                        |  18 +++++++++++++-
 external/bsd/Makefile                                  |   5 +---
 external/bsd/compiler_rt/lib/clang/lib/Makefile        |   3 +-
 external/bsd/compiler_rt/lib/clang/lib/netbsd/Makefile |   7 +++-
 5 files changed, 47 insertions(+), 9 deletions(-)

diffs (131 lines):

diff -r 6ea1489d74e7 -r eda739974ca3 Makefile
--- a/Makefile  Fri Aug 23 05:37:05 2019 +0000
+++ b/Makefile  Fri Aug 23 06:38:27 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.327 2019/06/14 09:12:42 martin Exp $
+#      $NetBSD: Makefile,v 1.328 2019/08/23 06:38:27 kamil Exp $
 
 #
 # This is the top-level makefile for building NetBSD. For an outline of
@@ -235,6 +235,13 @@
 .endif
 BUILDTARGETS+= do-lib
 BUILDTARGETS+= do-compat-lib
+.if ${MKLLVM} != "no"
+BUILDTARGETS+= do-sanitizer-includes
+BUILDTARGETS+= do-sanitizer-lib
+.if ${MKSANITIZER:Uno} == "yes"
+BUILDTARGETS+= do-sanitizer-tools
+.endif
+.endif
 .if ${MKX11} != "no"
 BUILDTARGETS+= do-x11
 .endif
@@ -470,6 +477,20 @@
 do-compat-lib: .PHONY .MAKE
        ${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../lib"
 
+do-sanitizer-includes: .PHONY .MAKE
+       ${MAKEDIRTARGET} external/bsd/compiler_rt/lib/clang/include includes
+       ${MAKEDIRTARGET} external/bsd/compiler_rt/lib/clang/share includes
+
+do-sanitizer-lib: .PHONY .MAKE
+       ${MAKEDIRTARGET} external/bsd/compiler_rt/lib/clang/lib build_install
+
+do-sanitizer-tools: .PHONY .MAKE
+.if !exists(${TOOLDIR}/lib/clang)
+       mkdir -p ${TOOLDIR}/lib/clang
+       cd ${DESTDIR}/usr/lib/clang && \
+               ${TOOL_PAX} -rw . ${TOOLDIR}/lib/clang
+.endif
+
 do-top-obj: .PHONY .MAKE
        ${MAKEDIRTARGET} . obj NOSUBDIR=
 
diff -r 6ea1489d74e7 -r eda739974ca3 distrib/sets/lists/base/md.i386
--- a/distrib/sets/lists/base/md.i386   Fri Aug 23 05:37:05 2019 +0000
+++ b/distrib/sets/lists/base/md.i386   Fri Aug 23 06:38:27 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.152 2018/09/30 15:56:47 jmcneill Exp $
+# $NetBSD: md.i386,v 1.153 2019/08/23 06:38:27 kamil Exp $
 ./dev/lms0                                     base-obsolete           obsolete
 ./dev/mms0                                     base-obsolete           obsolete
 ./dev/pms0                                     base-obsolete           obsolete
@@ -19,6 +19,22 @@
 ./usr/bin/iasl                                 base-util-bin
 ./usr/bin/pmc                                  base-obsolete           obsolete
 ./usr/bin/vttest                               base-obsolete           obsolete
+./usr/lib/clang/7.0.0/lib/netbsd/libclang_rt.asan-i386.a       comp-cxx-lib    llvm
+./usr/lib/clang/7.0.0/lib/netbsd/libclang_rt.asan-i386.so      comp-cxx-lib    llvm
+./usr/lib/clang/7.0.0/lib/netbsd/libclang_rt.asan-i386.so.0    comp-cxx-lib    llvm
+./usr/lib/clang/7.0.0/lib/netbsd/libclang_rt.asan-i386.so.0.0  comp-cxx-lib    llvm
+./usr/lib/clang/7.0.0/lib/netbsd/libclang_rt.asan-preinit-i386.a       comp-cxx-lib    llvm
+./usr/lib/clang/7.0.0/lib/netbsd/libclang_rt.asan_cxx-i386.a   comp-cxx-lib    llvm
+./usr/lib/clang/7.0.0/lib/netbsd/libclang_rt.safestack-i386.a  comp-cxx-lib    llvm
+./usr/lib/clang/7.0.0/lib/netbsd/libclang_rt.ubsan_minimal-i386.a      comp-cxx-lib    llvm
+./usr/lib/clang/7.0.0/lib/netbsd/libclang_rt.ubsan_minimal-i386.so      comp-cxx-lib   llvm
+./usr/lib/clang/7.0.0/lib/netbsd/libclang_rt.ubsan_minimal-i386.so.0   comp-cxx-lib    llvm
+./usr/lib/clang/7.0.0/lib/netbsd/libclang_rt.ubsan_minimal-i386.so.0.0 comp-cxx-lib    llvm
+./usr/lib/clang/7.0.0/lib/netbsd/libclang_rt.ubsan_standalone-i386.a   comp-cxx-lib    llvm
+./usr/lib/clang/7.0.0/lib/netbsd/libclang_rt.ubsan_standalone-i386.so  comp-cxx-lib    llvm
+./usr/lib/clang/7.0.0/lib/netbsd/libclang_rt.ubsan_standalone-i386.so.0        comp-cxx-lib    llvm
+./usr/lib/clang/7.0.0/lib/netbsd/libclang_rt.ubsan_standalone-i386.so.0.0      comp-cxx-lib    llvm
+./usr/lib/clang/7.0.0/lib/netbsd/libclang_rt.ubsan_standalone_cxx-i386.a       comp-cxx-lib    llvm
 ./usr/lib/libi386.so                           base-sys-shlib          pic
 ./usr/lib/libi386.so.2                         base-sys-shlib          pic
 ./usr/lib/libi386.so.2.0                       base-sys-shlib          pic
diff -r 6ea1489d74e7 -r eda739974ca3 external/bsd/Makefile
--- a/external/bsd/Makefile     Fri Aug 23 05:37:05 2019 +0000
+++ b/external/bsd/Makefile     Fri Aug 23 06:38:27 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.64 2019/08/14 01:42:08 kamil Exp $
+#      $NetBSD: Makefile,v 1.65 2019/08/23 06:38:27 kamil Exp $
 
 .include <bsd.own.mk>
 
@@ -30,9 +30,6 @@
 .if (${MKLLVM} != "no" || ${MKLLVMRT} != "no")
 SUBDIR+= llvm
 .endif
-.if (${MKLLVM} != "no")
-SUBDIR+= compiler_rt
-.endif
 .if (${MKNSD} != "no")
 SUBDIR+= nsd
 .endif
diff -r 6ea1489d74e7 -r eda739974ca3 external/bsd/compiler_rt/lib/clang/lib/Makefile
--- a/external/bsd/compiler_rt/lib/clang/lib/Makefile   Fri Aug 23 05:37:05 2019 +0000
+++ b/external/bsd/compiler_rt/lib/clang/lib/Makefile   Fri Aug 23 06:38:27 2019 +0000
@@ -1,5 +1,6 @@
-#      $NetBSD: Makefile,v 1.1 2019/08/08 14:00:28 kamil Exp $
+#      $NetBSD: Makefile,v 1.2 2019/08/23 06:38:27 kamil Exp $
 
 SUBDIR+=       netbsd
 
+.include <bsd.buildinstall.mk>
 .include <bsd.subdir.mk>
diff -r 6ea1489d74e7 -r eda739974ca3 external/bsd/compiler_rt/lib/clang/lib/netbsd/Makefile
--- a/external/bsd/compiler_rt/lib/clang/lib/netbsd/Makefile    Fri Aug 23 05:37:05 2019 +0000
+++ b/external/bsd/compiler_rt/lib/clang/lib/netbsd/Makefile    Fri Aug 23 06:38:27 2019 +0000
@@ -1,7 +1,8 @@
-#      $NetBSD: Makefile,v 1.2 2019/08/22 18:15:44 adam Exp $
+#      $NetBSD: Makefile,v 1.3 2019/08/23 06:38:27 kamil Exp $
 
 .include <bsd.own.mk>
 
+.if ${MACHINE_ARCH} == "x86_64"
 SUBDIR+=       asan-m64
 SUBDIR+=       asan-preinit-m64
 SUBDIR+=       asan_cxx-m64
@@ -24,8 +25,10 @@
 SUBDIR+=       xray-basic-m64
 SUBDIR+=       xray-fdr-m64
 SUBDIR+=       xray-profiling-m64
+.endif
 
-.if ${MKCOMPAT} != "no"
+.if ${MACHINE_ARCH} == "i386" || \
+        (${MACHINE_ARCH} == "x86_64" && ${MKCOMPAT} != "no")
 SUBDIR+=       asan-m32
 SUBDIR+=       asan-preinit-m32
 SUBDIR+=       asan_cxx-m32



Home | Main Index | Thread Index | Old Index