tree-wide: add support for asan!
What if you could find memory bugs in Lix without really trying very hard? I've had variously scuffed patches to do this, but this is blocked on boost coroutines removal at this point tbh. Change-Id: Id762af076aa06ad51e77a6c17ed10275929ed578
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/// @file This is very bothersome code that has to be included in every
|
||||
/// executable to get the correct default ASan options. I am so sorry.
|
||||
|
||||
extern "C" [[gnu::retain]] const char *__asan_default_options()
|
||||
{
|
||||
// We leak a bunch of memory knowingly on purpose. It's not worthwhile to
|
||||
// diagnose that memory being leaked for now.
|
||||
//
|
||||
// Instruction bytes are useful for finding the actual code that
|
||||
// corresponds to an ASan report.
|
||||
//
|
||||
// TODO: setting log_path=asan.log or not: neither works, since you can't
|
||||
// write to the fs in certain places in the testsuite, but you also cannot
|
||||
// write arbitrarily to stderr in other places so the reports get eaten.
|
||||
// pain 🥖
|
||||
return "halt_on_error=1:abort_on_error=1:detect_leaks=0:print_summary=1:dump_instruction_bytes=1";
|
||||
}
|
||||
+10
-1
@@ -12,10 +12,19 @@ subdir('libmain')
|
||||
# libcmd depends on everything
|
||||
subdir('libcmd')
|
||||
|
||||
|
||||
# The rest of the subdirectories aren't separate components,
|
||||
# just source files in another directory, so we process them here.
|
||||
|
||||
# Static library that just sets default ASan options. It needs to be included
|
||||
# in every executable.
|
||||
asanoptions = static_library(
|
||||
'libasanoptions',
|
||||
files('asan-options/asan-options.cc'),
|
||||
)
|
||||
libasanoptions = declare_dependency(
|
||||
link_whole: asanoptions
|
||||
)
|
||||
|
||||
build_remote_sources = files(
|
||||
'build-remote/build-remote.cc',
|
||||
)
|
||||
|
||||
@@ -80,6 +80,7 @@ nix = executable(
|
||||
profiles_md_gen,
|
||||
nix2_commands_sources,
|
||||
dependencies : [
|
||||
libasanoptions,
|
||||
liblixcmd,
|
||||
liblixutil_mstatic,
|
||||
liblixstore_mstatic,
|
||||
|
||||
Reference in New Issue
Block a user