diff options
author | Yousong Zhou <yszhou4tech@gmail.com> | 2019-10-19 12:00:43 +0000 |
---|---|---|
committer | Yousong Zhou <yszhou4tech@gmail.com> | 2019-10-24 11:40:00 +0000 |
commit | 69b9f0161e147d566b3b9572a0bc39a97c257fc0 (patch) | |
tree | f0ec81c8e62b3b5a58a3502db491f2fe87b56ec9 /package/libs/toolchain/Makefile | |
parent | ed6ba2801c0a97e8b78f96ad71eb0493a0f1823f (diff) | |
download | upstream-69b9f0161e147d566b3b9572a0bc39a97c257fc0.tar.gz upstream-69b9f0161e147d566b3b9572a0bc39a97c257fc0.tar.bz2 upstream-69b9f0161e147d566b3b9572a0bc39a97c257fc0.zip |
toolchain: gcc: enable sanitizers for glibc toolchain
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Diffstat (limited to 'package/libs/toolchain/Makefile')
-rw-r--r-- | package/libs/toolchain/Makefile | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/package/libs/toolchain/Makefile b/package/libs/toolchain/Makefile index a63746c448..c13e9e4928 100644 --- a/package/libs/toolchain/Makefile +++ b/package/libs/toolchain/Makefile @@ -138,6 +138,122 @@ define Package/libstdcpp/config endef +define Package/libasan +$(call Package/gcc/Default) + NAME:=libasan + TITLE:=Runtime library for AddressSanitizer in GCC + DEPENDS:=@USE_GLIBC +librt +libstdcpp + ABI_VERSION:=5 +endef + +define Package/libasan/config + menu "Configuration" + depends on EXTERNAL_TOOLCHAIN && PACKAGE_libasan + + config LIBASAN_ROOT_DIR + string + prompt "libasan shared library base directory" + depends on EXTERNAL_TOOLCHAIN && PACKAGE_libasan + default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN + default "/" if NATIVE_TOOLCHAIN + + config LIBASAN_FILE_SPEC + string + prompt "libasan shared library files (use wildcards)" + depends on EXTERNAL_TOOLCHAIN && PACKAGE_libasan + default "./lib/libasan.so.*" + + endmenu +endef + + +define Package/libtsan +$(call Package/gcc/Default) + NAME:=libtsan + TITLE:=Runtime library for ThreadSanitizer in GCC + DEPENDS:=@USE_GLIBC +librt +libstdcpp + ABI_VERSION:=0 +endef + +define Package/libtsan/config + menu "Configuration" + depends on EXTERNAL_TOOLCHAIN && PACKAGE_libtsan + + config LIBTSAN_ROOT_DIR + string + prompt "libtsan shared library base directory" + depends on EXTERNAL_TOOLCHAIN && PACKAGE_libtsan + default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN + default "/" if NATIVE_TOOLCHAIN + + config LIBTSAN_FILE_SPEC + string + prompt "libtsan shared library files (use wildcards)" + depends on EXTERNAL_TOOLCHAIN && PACKAGE_libtsan + default "./lib/libtsan.so.*" + + endmenu +endef + + +define Package/liblsan +$(call Package/gcc/Default) + NAME:=liblsan + TITLE:=Runtime library for LeakSanitizer in GCC + DEPENDS:=@USE_GLIBC +librt +libstdcpp + ABI_VERSION:=0 +endef + +define Package/liblsan/config + menu "Configuration" + depends on EXTERNAL_TOOLCHAIN && PACKAGE_liblsan + + config LIBLSAN_ROOT_DIR + string + prompt "liblsan shared library base directory" + depends on EXTERNAL_TOOLCHAIN && PACKAGE_liblsan + default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN + default "/" if NATIVE_TOOLCHAIN + + config LIBLSAN_FILE_SPEC + string + prompt "liblsan shared library files (use wildcards)" + depends on EXTERNAL_TOOLCHAIN && PACKAGE_liblsan + default "./lib/liblsan.so.*" + + endmenu +endef + + +define Package/libubsan +$(call Package/gcc/Default) + NAME:=libubsan + TITLE:=Runtime library for UndefinedBehaviorSanitizer in GCC + DEPENDS:=@USE_GLIBC +librt +libstdcpp + ABI_VERSION:=1 +endef + +define Package/libubsan/config + menu "Configuration" + depends on EXTERNAL_TOOLCHAIN && PACKAGE_libubsan + + config LIBUBSAN_ROOT_DIR + string + prompt "libubsan shared library base directory" + depends on EXTERNAL_TOOLCHAIN && PACKAGE_libubsan + default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN + default "/" if NATIVE_TOOLCHAIN + + config LIBUBSAN_FILE_SPEC + string + prompt "libubsan shared library files (use wildcards)" + depends on EXTERNAL_TOOLCHAIN && PACKAGE_libubsan + default "./lib/libubsan.so.*" + + endmenu +endef + + define Package/libc/Default SECTION:=libs CATEGORY:=Base system @@ -413,6 +529,26 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) $(CP) $(TOOLCHAIN_DIR)/lib/libstdc++.so.* $(1)/usr/lib/ endef + define Package/libasan/install + $(INSTALL_DIR) $(1)/lib + $(CP) $(TOOLCHAIN_DIR)/lib/libasan.so.* $(1)/lib/ + endef + + define Package/libtsan/install + $(INSTALL_DIR) $(1)/lib + $(CP) $(TOOLCHAIN_DIR)/lib/libtsan.so.* $(1)/lib/ + endef + + define Package/liblsan/install + $(INSTALL_DIR) $(1)/lib + $(CP) $(TOOLCHAIN_DIR)/lib/liblsan.so.* $(1)/lib/ + endef + + define Package/libubsan/install + $(INSTALL_DIR) $(1)/lib + $(CP) $(TOOLCHAIN_DIR)/lib/libubsan.so.* $(1)/lib/ + endef + define Package/glibc/install $(CP) ./glibc-files/* $(1)/ rm -f $(1)/etc/localtime @@ -550,6 +686,38 @@ else exit 0 endef + define Package/libasan/install + for file in $(call qstrip,$(CONFIG_LIBASAN_FILE_SPEC)); do \ + $(INSTALL_DIR) $(1)/lib ; \ + $(CP) $(call qstrip,$(CONFIG_LIBASAN_ROOT_DIR))/$$$$file $(1)/lib/ ; \ + done ; \ + exit 0 + endef + + define Package/libtsan/install + for file in $(call qstrip,$(CONFIG_LIBTSAN_FILE_SPEC)); do \ + $(INSTALL_DIR) $(1)/lib ; \ + $(CP) $(call qstrip,$(CONFIG_LIBTSAN_ROOT_DIR))/$$$$file $(1)/lib/ ; \ + done ; \ + exit 0 + endef + + define Package/liblsan/install + for file in $(call qstrip,$(CONFIG_LIBLSAN_FILE_SPEC)); do \ + $(INSTALL_DIR) $(1)/lib ; \ + $(CP) $(call qstrip,$(CONFIG_LIBLSAN_ROOT_DIR))/$$$$file $(1)/lib/ ; \ + done ; \ + exit 0 + endef + + define Package/libubsan/install + for file in $(call qstrip,$(CONFIG_LIBUBSAN_FILE_SPEC)); do \ + $(INSTALL_DIR) $(1)/lib ; \ + $(CP) $(call qstrip,$(CONFIG_LIBUBSAN_ROOT_DIR))/$$$$file $(1)/lib/ ; \ + done ; \ + exit 0 + endef + define Package/libc/install for file in $(call qstrip,$(CONFIG_LIBC_FILE_SPEC)); do \ $(INSTALL_DIR) $(1)/lib ; \ @@ -623,6 +791,10 @@ $(eval $(call BuildPackage,libgcc)) $(eval $(call BuildPackage,libatomic)) $(eval $(call BuildPackage,libssp)) $(eval $(call BuildPackage,libstdcpp)) +$(eval $(call BuildPackage,libasan)) +$(eval $(call BuildPackage,libtsan)) +$(eval $(call BuildPackage,liblsan)) +$(eval $(call BuildPackage,libubsan)) $(eval $(call BuildPackage,libpthread)) $(eval $(call BuildPackage,libthread-db)) $(eval $(call BuildPackage,librt)) |