scons: force libasan to static linking
The asan(enable with --with-asan) sanitizer interpret calls to dlopen(). That replaces the RUNPATH of an executable with RUNPATH of libasan.so after libasan.so is loaded by loader. Then it may cause some shared libraries missing, i.e. the error messages is like "cannot open shared object file: No such file or directory" since the RUNPATH is no longer correct. Force the libasan to static linking can avoid this issue since libasan.a does not have a RUNPATH, thus the replacement will never happen. Change-Id: I8e5ff4d1fbe4644a258054be6e9f6d4db9062e56 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67298 Reviewed-by: Earl Ou <shunhsingou@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Maintainer: Gabe Black <gabe.black@gmail.com>
This commit is contained in:
@@ -526,7 +526,9 @@ for variant_path in variant_paths:
|
||||
if env['GCC'] or env['CLANG']:
|
||||
env.Append(CCFLAGS=['-fsanitize=%s' % sanitizers,
|
||||
'-fno-omit-frame-pointer'],
|
||||
LINKFLAGS='-fsanitize=%s' % sanitizers)
|
||||
LINKFLAGS=['-fsanitize=%s' % sanitizers,
|
||||
'-static-libasan'])
|
||||
|
||||
if main["BIN_TARGET_ARCH"] == "x86_64":
|
||||
# Sanitizers can enlarge binary size drammatically, north of
|
||||
# 2GB. This can prevent successful linkage due to symbol
|
||||
|
||||
Reference in New Issue
Block a user