Always set ASAN_SYMBOLIZER_PATH appropriately
Otherwise tools built with ASAN can't symbolize their dumps, as
llvm-symbolizer is not allowed to be used from $PATH.
Fixes: 139825736
Test: cherry-pick https://android-review.googlesource.com/c/platform/system/tools/aidl/+/1106532
mmma ASAN_OPTIONS="" SANITIZE_HOST=address system/tools/aidl
Change-Id: Ib1eeec15ce6694d7bde54c7201b3280e38df3a83
diff --git a/ui/build/config.go b/ui/build/config.go
index 434047b..665d2f0 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -180,6 +180,11 @@
ret.environ.Set("TMPDIR", absPath(ctx, ret.TempDir()))
+ // Always set ASAN_SYMBOLIZER_PATH so that ASAN-based tools can symbolize any crashes
+ symbolizerPath := filepath.Join("prebuilts/clang/host", ret.HostPrebuiltTag(),
+ "llvm-binutils-stable/llvm-symbolizer")
+ ret.environ.Set("ASAN_SYMBOLIZER_PATH", absPath(ctx, symbolizerPath))
+
// Precondition: the current directory is the top of the source tree
checkTopDir(ctx)