Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/compiler_rt Add compiler-rt build rules for LLV...



details:   https://anonhg.NetBSD.org/src/rev/3a7363efbc73
branches:  trunk
changeset: 458743:3a7363efbc73
user:      kamil <kamil%NetBSD.org@localhost>
date:      Thu Aug 08 14:00:27 2019 +0000

description:
Add compiler-rt build rules for LLVM sanitizers &co

Add build rules for LLVM in all the supported variations for NetBSD/amd64:

 - asan
 - xray
 - tsan, dd
 - libfuzzer
 - msan
 - safestack
 - ubsan

These build rules compile functional sanitizers.

The build rules are still not hooked into the distribution build, as there
is pending work on backporting improvements for the llvm-8 branch needed
for netbsd-9 and newer.

diffstat:

 external/bsd/compiler_rt/Makefile                                                        |    5 +
 external/bsd/compiler_rt/lib/Makefile                                                    |    5 +
 external/bsd/compiler_rt/lib/clang/Makefile                                              |   11 +
 external/bsd/compiler_rt/lib/clang/include/Makefile                                      |    5 +
 external/bsd/compiler_rt/lib/clang/include/sanitizer/Makefile                            |   27 +
 external/bsd/compiler_rt/lib/clang/include/xray/Makefile                                 |   17 +
 external/bsd/compiler_rt/lib/clang/lib/Makefile                                          |    5 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/Makefile                                   |   36 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-dynamic-m32/Makefile                  |   52 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-dynamic-m32/shlib_version             |    2 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-dynamic-m64/Makefile                  |   52 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-dynamic-m64/shlib_version             |    2 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-m32/Makefile                          |   55 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-m64/Makefile                          |   61 ++
 external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-preinit-m32/Makefile                  |   35 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-preinit-m64/Makefile                  |   35 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/asan_cxx-m32/Makefile                      |   40 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/asan_cxx-m64/Makefile                      |   44 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/common.mk                                  |    1 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/dd-m64/Makefile                            |   45 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/dyndd-m64/Makefile                         |   42 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/dyndd-m64/shlib_version                    |    2 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/fuzzer-m64/Makefile                        |   37 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/fuzzer_no_main-m64/Makefile                |   36 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/gen_dynamic_list.sh                        |  218 +++++++
 external/bsd/compiler_rt/lib/clang/lib/netbsd/m32.mk                                     |    7 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/m64.mk                                     |    5 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/msan-m64/Makefile                          |   56 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/msan_cxx-m64/Makefile                      |   45 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/safestack-m32/Makefile                     |   44 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/safestack-m64/Makefile                     |   44 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/shared_deps.mk                             |    6 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/sources.mk                                 |  303 ++++++++++
 external/bsd/compiler_rt/lib/clang/lib/netbsd/syms.mk                                    |    9 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/tsan-m64/Makefile                          |   56 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/tsan_cxx-m64/Makefile                      |   44 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/ubsan_minimal-dynamic-m32/Makefile         |   30 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/ubsan_minimal-dynamic-m32/shlib_version    |    2 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/ubsan_minimal-dynamic-m64/Makefile         |   30 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/ubsan_minimal-dynamic-m64/shlib_version    |    2 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/ubsan_minimal-m32/Makefile                 |   35 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/ubsan_minimal-m64/Makefile                 |   40 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/ubsan_standalone-dynamic-m32/Makefile      |   42 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/ubsan_standalone-dynamic-m32/shlib_version |    2 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/ubsan_standalone-dynamic-m64/Makefile      |   42 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/ubsan_standalone-dynamic-m64/shlib_version |    2 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/ubsan_standalone-m32/Makefile              |   47 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/ubsan_standalone-m64/Makefile              |   54 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/ubsan_standalone_cxx-m32/Makefile          |   35 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/ubsan_standalone_cxx-m64/Makefile          |   40 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/xray-basic-m64/Makefile                    |   37 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/xray-fdr-m64/Makefile                      |   37 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/xray-m64/Makefile                          |   46 +
 external/bsd/compiler_rt/lib/clang/lib/netbsd/xray-profiling-m64/Makefile                |   39 +
 external/bsd/compiler_rt/lib/clang/share/Makefile                                        |   17 +
 55 files changed, 2068 insertions(+), 0 deletions(-)

diffs (truncated from 2288 to 300 lines):

diff -r 2912d9fd5cf6 -r 3a7363efbc73 external/bsd/compiler_rt/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/compiler_rt/Makefile Thu Aug 08 14:00:27 2019 +0000
@@ -0,0 +1,5 @@
+#      $NetBSD: Makefile,v 1.1 2019/08/08 14:00:27 kamil Exp $
+
+SUBDIR+=       lib
+
+.include <bsd.subdir.mk>
diff -r 2912d9fd5cf6 -r 3a7363efbc73 external/bsd/compiler_rt/lib/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/compiler_rt/lib/Makefile     Thu Aug 08 14:00:27 2019 +0000
@@ -0,0 +1,5 @@
+#      $NetBSD: Makefile,v 1.1 2019/08/08 14:00:28 kamil Exp $
+
+SUBDIR+=       clang
+
+.include <bsd.subdir.mk>
diff -r 2912d9fd5cf6 -r 3a7363efbc73 external/bsd/compiler_rt/lib/clang/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/compiler_rt/lib/clang/Makefile       Thu Aug 08 14:00:27 2019 +0000
@@ -0,0 +1,11 @@
+#      $NetBSD: Makefile,v 1.1 2019/08/08 14:00:28 kamil Exp $
+
+.include <bsd.own.mk>
+
+SUBDIR+=       include share
+
+.if ${MACHINE_ARCH} == "x86_64"
+SUBDIR+=       lib
+.endif
+
+.include <bsd.subdir.mk>
diff -r 2912d9fd5cf6 -r 3a7363efbc73 external/bsd/compiler_rt/lib/clang/include/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/compiler_rt/lib/clang/include/Makefile       Thu Aug 08 14:00:27 2019 +0000
@@ -0,0 +1,5 @@
+#      $NetBSD: Makefile,v 1.1 2019/08/08 14:00:28 kamil Exp $
+
+SUBDIR+=       sanitizer xray
+
+.include <bsd.subdir.mk>
diff -r 2912d9fd5cf6 -r 3a7363efbc73 external/bsd/compiler_rt/lib/clang/include/sanitizer/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/compiler_rt/lib/clang/include/sanitizer/Makefile     Thu Aug 08 14:00:27 2019 +0000
@@ -0,0 +1,27 @@
+#      $NetBSD: Makefile,v 1.1 2019/08/08 14:00:28 kamil Exp $
+
+TOPDIR=        ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
+
+NOOBJ= # defined
+
+.PATH: ${TOPDIR}/include/sanitizer
+
+INCS+= allocator_interface.h
+INCS+= asan_interface.h
+INCS+= common_interface_defs.h
+INCS+= coverage_interface.h
+#INCS+=        dfsan_interface.h # not supported
+#INCS+=        esan_interface.h # not supported
+#INCS+=        hwasan_interface.h # not supported
+#INCS+=        lsan_interface.h # not supported
+INCS+= msan_interface.h
+INCS+= netbsd_syscall_hooks.h
+#INCS+=        scudo_interface.h # not ready
+INCS+= tsan_interface.h
+INCS+= tsan_interface_atomic.h
+
+.include <bsd.own.mk>
+
+INCSDIR=       /usr/lib/clang/7.0.0/include/sanitizer
+
+.include <bsd.prog.mk>
diff -r 2912d9fd5cf6 -r 3a7363efbc73 external/bsd/compiler_rt/lib/clang/include/xray/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/compiler_rt/lib/clang/include/xray/Makefile  Thu Aug 08 14:00:27 2019 +0000
@@ -0,0 +1,17 @@
+#      $NetBSD: Makefile,v 1.1 2019/08/08 14:00:28 kamil Exp $
+
+TOPDIR= ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
+
+NOOBJ= # defined
+
+.PATH: ${TOPDIR}/include/xray
+
+INCS+= xray_interface.h
+INCS+= xray_log_interface.h
+INCS+= xray_records.h
+
+.include <bsd.own.mk>
+
+INCSDIR=       /usr/lib/clang/7.0.0/include/xray
+
+.include <bsd.prog.mk>
diff -r 2912d9fd5cf6 -r 3a7363efbc73 external/bsd/compiler_rt/lib/clang/lib/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/compiler_rt/lib/clang/lib/Makefile   Thu Aug 08 14:00:27 2019 +0000
@@ -0,0 +1,5 @@
+#      $NetBSD: Makefile,v 1.1 2019/08/08 14:00:28 kamil Exp $
+
+SUBDIR+=       netbsd
+
+.include <bsd.subdir.mk>
diff -r 2912d9fd5cf6 -r 3a7363efbc73 external/bsd/compiler_rt/lib/clang/lib/netbsd/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/compiler_rt/lib/clang/lib/netbsd/Makefile    Thu Aug 08 14:00:27 2019 +0000
@@ -0,0 +1,36 @@
+#      $NetBSD: Makefile,v 1.1 2019/08/08 14:00:28 kamil Exp $
+
+SUBDIR+=       asan-m32
+SUBDIR+=       asan-m64
+SUBDIR+=       asan-preinit-m32
+SUBDIR+=       asan-preinit-m64
+SUBDIR+=       asan_cxx-m32
+SUBDIR+=       asan_cxx-m64
+SUBDIR+=       asan-dynamic-m32
+SUBDIR+=       asan-dynamic-m64
+SUBDIR+=       dd-m64
+SUBDIR+=       dyndd-m64
+SUBDIR+=       fuzzer-m64
+SUBDIR+=       fuzzer_no_main-m64
+SUBDIR+=       msan-m64
+SUBDIR+=       msan_cxx-m64
+SUBDIR+=       safestack-m32
+SUBDIR+=       safestack-m64
+SUBDIR+=       tsan-m64
+SUBDIR+=       tsan_cxx-m64
+SUBDIR+=       ubsan_minimal-m32
+SUBDIR+=       ubsan_minimal-m64
+SUBDIR+=       ubsan_minimal-dynamic-m32
+SUBDIR+=       ubsan_minimal-dynamic-m64
+SUBDIR+=       ubsan_standalone-m32
+SUBDIR+=       ubsan_standalone-m64
+SUBDIR+=       ubsan_standalone-dynamic-m32
+SUBDIR+=       ubsan_standalone-dynamic-m64
+SUBDIR+=       ubsan_standalone_cxx-m32
+SUBDIR+=       ubsan_standalone_cxx-m64
+SUBDIR+=       xray-m64
+SUBDIR+=       xray-basic-m64
+SUBDIR+=       xray-fdr-m64
+SUBDIR+=       xray-profiling-m64
+
+.include <bsd.subdir.mk>
diff -r 2912d9fd5cf6 -r 3a7363efbc73 external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-dynamic-m32/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-dynamic-m32/Makefile   Thu Aug 08 14:00:27 2019 +0000
@@ -0,0 +1,52 @@
+#      $NetBSD: Makefile,v 1.1 2019/08/08 14:00:28 kamil Exp $
+
+NOSANITIZER=    # defined
+
+.include "../common.mk"
+.include "../sources.mk"
+
+.include <bsd.own.mk>
+
+TOPDIR=        ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
+
+LIB=   libclang_rt.asan-i386
+
+.PATH: ${TOPDIR}/lib/interception
+
+SRCS+= ${INTERCEPTION_SOURCES}
+
+.PATH: ${TOPDIR}/lib/asan
+
+SRCS+= ${ASAN_SOURCES}
+SRCS+= ${ASAN_CXX_SOURCES}
+
+.PATH: ${TOPDIR}/lib/lsan
+
+SRCS+= ${LSAN_COMMON_SOURCES}
+
+.PATH: ${TOPDIR}/lib/ubsan
+
+SRCS+= ${UBSAN_SOURCES}
+
+.PATH: ${TOPDIR}/lib/sanitizer_common
+
+SRCS+= ${SANITIZER_LIBCDEP_SOURCES}
+SRCS+= ${SANITIZER_COVERAGE_SOURCES}
+SRCS+= ${SANITIZER_SOURCES}
+SRCS+= ${SANITIZER_SYMBOLIZER_SOURCES}
+
+CPPFLAGS+=     -DASAN_DYNAMIC=1
+
+CXXFLAGS+=     -fno-rtti -fno-exceptions -fno-builtin -fno-stack-protector -ftls-model=initial-exec
+
+LIBDIR=                /usr/lib/clang/${CLANG_VER}/lib/netbsd
+LIBISCXX=      yes
+
+LIBISMODULE=   yes
+
+CPPFLAGS+=     -I${TOPDIR}/lib
+
+.include "../m32.mk"
+.include "../shared_deps.mk"
+
+.include <bsd.lib.mk>
diff -r 2912d9fd5cf6 -r 3a7363efbc73 external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-dynamic-m32/shlib_version
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-dynamic-m32/shlib_version      Thu Aug 08 14:00:27 2019 +0000
@@ -0,0 +1,2 @@
+major=0
+minor=0
diff -r 2912d9fd5cf6 -r 3a7363efbc73 external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-dynamic-m64/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-dynamic-m64/Makefile   Thu Aug 08 14:00:27 2019 +0000
@@ -0,0 +1,52 @@
+#      $NetBSD: Makefile,v 1.1 2019/08/08 14:00:29 kamil Exp $
+
+NOSANITIZER=    # defined
+
+.include "../common.mk"
+.include "../sources.mk"
+
+.include <bsd.own.mk>
+
+TOPDIR=        ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
+
+LIB=   libclang_rt.asan-x86_64
+
+.PATH: ${TOPDIR}/lib/interception
+
+SRCS+= ${INTERCEPTION_SOURCES}
+
+.PATH: ${TOPDIR}/lib/asan
+
+SRCS+= ${ASAN_SOURCES}
+SRCS+= ${ASAN_CXX_SOURCES}
+
+.PATH: ${TOPDIR}/lib/lsan
+
+SRCS+= ${LSAN_COMMON_SOURCES}
+
+.PATH: ${TOPDIR}/lib/ubsan
+
+SRCS+= ${UBSAN_SOURCES}
+
+.PATH: ${TOPDIR}/lib/sanitizer_common
+
+SRCS+= ${SANITIZER_LIBCDEP_SOURCES}
+SRCS+= ${SANITIZER_COVERAGE_SOURCES}
+SRCS+= ${SANITIZER_SOURCES}
+SRCS+= ${SANITIZER_SYMBOLIZER_SOURCES}
+
+CPPFLAGS+=     -DASAN_DYNAMIC=1
+
+CXXFLAGS+=     -fno-rtti -fno-exceptions -fno-builtin -fno-stack-protector -ftls-model=initial-exec
+
+LIBDIR=                /usr/lib/clang/${CLANG_VER}/lib/netbsd
+LIBISCXX=      yes
+
+LIBISMODULE=   yes
+
+CPPFLAGS+=     -I${TOPDIR}/lib
+
+.include "../m64.mk"
+.include "../shared_deps.mk"
+
+.include <bsd.lib.mk>
diff -r 2912d9fd5cf6 -r 3a7363efbc73 external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-dynamic-m64/shlib_version
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-dynamic-m64/shlib_version      Thu Aug 08 14:00:27 2019 +0000
@@ -0,0 +1,2 @@
+major=0
+minor=0
diff -r 2912d9fd5cf6 -r 3a7363efbc73 external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-m32/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/compiler_rt/lib/clang/lib/netbsd/asan-m32/Makefile   Thu Aug 08 14:00:27 2019 +0000
@@ -0,0 +1,55 @@
+#      $NetBSD: Makefile,v 1.1 2019/08/08 14:00:29 kamil Exp $
+
+NOSANITIZER=    # defined
+
+.include "../common.mk"
+.include "../sources.mk"
+
+.include <bsd.own.mk>
+
+TOPDIR=        ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
+
+LIB=   libclang_rt.asan-i386
+
+.PATH: ${TOPDIR}/lib/interception
+
+SRCS+= ${INTERCEPTION_SOURCES}
+
+.PATH: ${TOPDIR}/lib/asan
+
+SRCS+= ${ASAN_PREINIT_SOURCES}
+SRCS+= ${ASAN_SOURCES}
+
+.PATH: ${TOPDIR}/lib/lsan
+
+SRCS+= ${LSAN_COMMON_SOURCES}
+
+.PATH: ${TOPDIR}/lib/ubsan
+
+SRCS+= ${UBSAN_SOURCES}



Home | Main Index | Thread Index | Old Index