kumquat-buildroot/package/compiler-rt/compiler-rt.mk
Matt Weber b1fcb596fe package/compiler-rt: new package
This patch adds support for the compiler-rt (CLANG runtime) library.
It builds a set of static libraries and installs them into the
CLANG/LLVM toolchain resource folder. These libraries can then be
used by developers in the SDK for building target applications for
analysis.

What is fuzzing and why libfuzzer?
https://www.moritz.systems/blog/an-introduction-to-llvm-libfuzzer/

The compiler-rt fuzzer and address sanitizer tools require additional
LLVM binary tools installed to allow stack trace decoding actively during
executable analysis.  This patch conditionally enables these tools.
https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack

Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Cc: Romain Naour <romain.naour@smile.fr>
Cc: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Cc: Valentin Korenblit <valentinkorenblit@gmail.com>
Cc: Michael Drake <michael.drake@codethink.co.uk>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-06-20 21:11:01 +02:00

38 lines
1.7 KiB
Makefile

################################################################################
#
# compiler-rt
#
################################################################################
# Compiler-RT should be bumped together with LLVM and Clang as the run-time is
# tied to the version of those tools
COMPILER_RT_VERSION = 11.1.0
COMPILER_RT_SOURCE = compiler-rt-$(COMPILER_RT_VERSION).src.tar.xz
COMPILER_RT_SITE = https://github.com/llvm/llvm-project/releases/download/llvmorg-$(COMPILER_RT_VERSION)
COMPILER_RT_LICENSE = NCSA MIT
COMPILER_RT_LICENSE_FILES = LICENSE.TXT
COMPILER_RT_DEPENDENCIES = host-clang llvm
COMPILER_RT_INSTALL_STAGING = YES
COMPILER_RT_INSTALL_TARGET = NO
COMPILER_RT_CONF_OPTS=-DCOMPILER_RT_STANDALONE_BUILD=OFF \
-DCOMPILER_RT_STANDALONE_BUILD=ON \
-DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=$(GNU_TARGET_NAME) \
-DLLVM_CONFIG_PATH=$(HOST_DIR)/usr/bin/llvm-config
# The installation of the target runtime libraries defaults to DESTDIR, however
# host-clang resources directory needs a link so Clang can find the runtime
# libraries in the same location they would be if built as part of the Clang
# build. The "resources" directory is loosely documented and seems to be
# assumed, as compiler-rt is usually build at the same time as Clang and not
# standalone.
define COMPILER_RT_SETUP_RUNTIME_LIBS
mkdir -p $(HOST_DIR)/lib/clang/$(HOST_CLANG_VERSION)/lib
ln -sf ../../../../$(GNU_TARGET_NAME)/sysroot/usr/lib/linux $(HOST_DIR)/lib/clang/$(HOST_CLANG_VERSION)/lib/linux
ln -sf ../../../../$(GNU_TARGET_NAME)/sysroot/usr/share $(HOST_DIR)/lib/clang/$(HOST_CLANG_VERSION)/share
endef
COMPILER_RT_POST_INSTALL_STAGING_HOOKS += COMPILER_RT_SETUP_RUNTIME_LIBS
$(eval $(cmake-package))