Bug 1685599 - Build llvm-symbolizer separately. r=firefox-build-system-reviewers,mhentges

Only sanitizer builds require a native llvm-symbolizer executable.
Ideally, we'd build llvm-symbolizer from scratch, which would be faster,
but for now, let's go the easy route and just extract it from the
corresponding native clang builds.

We don't actually do anything with the llvm-symbolizer executable on
android builds, so we don't install it in $FINAL_TARGET, avoilding
the dependency on android builds (plus, we actually don't have an
android-native llvm-symbolizer, so even if it were already shipped, it
would be the wrong file).

Differential Revision: https://phabricator.services.mozilla.com/D101076
This commit is contained in:
Mike Hommey 2021-01-07 23:53:19 +00:00
parent e831069d3a
commit 3128330c17
15 changed files with 85 additions and 9 deletions

View File

@ -3,7 +3,7 @@ ac_add_options --enable-debug
. $topsrcdir/build/mozconfig.wasm-sandboxing
. $topsrcdir/build/unix/mozconfig.linux
export LLVM_SYMBOLIZER="$MOZ_FETCHES_DIR/clang/bin/llvm-symbolizer"
export LLVM_SYMBOLIZER="$MOZ_FETCHES_DIR/llvm-symbolizer/llvm-symbolizer"
# Package js shell.
export MOZ_PACKAGE_JSSHELL=1

View File

@ -52,7 +52,7 @@ if CONFIG["MOZ_ASAN"] and CONFIG["CC_TYPE"] == "clang-cl":
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android" and CONFIG["MOZ_ASAN"]:
FINAL_TARGET_FILES += ["%" + CONFIG["MOZ_CLANG_RT_ASAN_LIB_PATH"]]
if CONFIG["LLVM_SYMBOLIZER"]:
if CONFIG["MOZ_WIDGET_TOOLKIT"] != "android" and CONFIG["LLVM_SYMBOLIZER"]:
FINAL_TARGET_FILES += ["/" + CONFIG["LLVM_SYMBOLIZER"]]
if CONFIG["MOZ_APP_BASENAME"]:

View File

@ -1,6 +1,6 @@
. "$topsrcdir/build/unix/mozconfig.unix"
export LLVM_SYMBOLIZER="$MOZ_FETCHES_DIR/clang/bin/llvm-symbolizer"
export LLVM_SYMBOLIZER="$MOZ_FETCHES_DIR/llvm-symbolizer/llvm-symbolizer"
#
# Enable ASan specific code and build workarounds
ac_add_options --enable-address-sanitizer

View File

@ -1,6 +1,6 @@
. "$topsrcdir/build/unix/mozconfig.unix"
export LLVM_SYMBOLIZER="$MOZ_FETCHES_DIR/clang/bin/llvm-symbolizer"
export LLVM_SYMBOLIZER="$MOZ_FETCHES_DIR/llvm-symbolizer/llvm-symbolizer"
# Enable TSan specific code and build workarounds
ac_add_options --enable-thread-sanitizer

View File

@ -7,7 +7,7 @@ if [ -d "$MOZ_FETCHES_DIR/clang" ]; then
export LDFLAGS="clang_rt.asan_dynamic-x86_64.lib clang_rt.asan_dynamic_runtime_thunk-x86_64.lib"
export MOZ_COPY_PDBS=1
export LLVM_SYMBOLIZER="$MOZ_FETCHES_DIR/clang/bin/llvm-symbolizer.exe"
export LLVM_SYMBOLIZER="$MOZ_FETCHES_DIR/llvm-symbolizer/llvm-symbolizer.exe"
export MOZ_CLANG_RT_ASAN_LIB_PATH="${CLANG_LIB_DIR}/clang_rt.asan_dynamic-x86_64.dll"
fi

View File

@ -4,7 +4,7 @@
"debug": false,
"compiler": "clang",
"env": {
"LLVM_SYMBOLIZER": "{MOZ_FETCHES_DIR}/clang/bin/llvm-symbolizer"
"LLVM_SYMBOLIZER": "{MOZ_FETCHES_DIR}/llvm-symbolizer/llvm-symbolizer"
},
"use_minidump": false
}

View File

@ -6,8 +6,8 @@
"env": {
"JITTEST_EXTRA_ARGS": "--jitflags=none",
"JSTESTS_EXTRA_ARGS": "--jitflags=none",
"LLVM_SYMBOLIZER": "{MOZ_FETCHES_DIR}/clang/bin/llvm-symbolizer",
"ASAN_SYMBOLIZER_PATH": "{MOZ_FETCHES_DIR}/clang/bin/llvm-symbolizer"
"LLVM_SYMBOLIZER": "{MOZ_FETCHES_DIR}/llvm-symbolizer/llvm-symbolizer",
"ASAN_SYMBOLIZER_PATH": "{MOZ_FETCHES_DIR}/llvm-symbolizer/llvm-symbolizer"
},
"use_minidump": false
}

View File

@ -4,7 +4,7 @@
"debug": false,
"compiler": "clang",
"env": {
"LLVM_SYMBOLIZER": "{MOZ_FETCHES_DIR}/clang/bin/llvm-symbolizer",
"LLVM_SYMBOLIZER": "{MOZ_FETCHES_DIR}/llvm-symbolizer/llvm-symbolizer",
"JITTEST_EXTRA_ARGS": "--jitflags=tsan --ignore-timeouts={DIR}/cgc-jittest-timeouts.txt --unusable-error-status --exclude-from={DIR}/tsan-slow.txt",
"JSTESTS_EXTRA_ARGS": "--exclude-file={DIR}/cgc-jstests-slow.txt"
},

View File

@ -120,6 +120,7 @@ linux64-fuzzing/debug:
- linux64-clang
- linux64-cbindgen
- linux64-dump-syms
- linux64-llvm-symbolizer
- linux64-sccache
- linux64-rust
- linux64-rust-size
@ -682,6 +683,7 @@ linux64-asan/opt:
- linux64-rust-size
- linux64-cbindgen
- linux64-dump-syms
- linux64-llvm-symbolizer
- linux64-sccache
- linux64-nasm
- linux64-node
@ -723,6 +725,7 @@ linux64-tsan/opt:
- linux64-rust-size
- linux64-cbindgen
- linux64-dump-syms
- linux64-llvm-symbolizer
- linux64-sccache
- linux64-nasm
- linux64-node
@ -767,6 +770,7 @@ linux64-tsan-fuzzing/opt:
- linux64-rust-size
- linux64-cbindgen
- linux64-dump-syms
- linux64-llvm-symbolizer
- linux64-sccache
- linux64-nasm
- linux64-node
@ -814,6 +818,7 @@ linux64-asan-fuzzing/opt:
- linux64-rust-size
- linux64-cbindgen
- linux64-dump-syms
- linux64-llvm-symbolizer
- linux64-sccache
- linux64-nasm
- linux64-node
@ -861,6 +866,7 @@ linux64-asan-fuzzing-ccov/opt:
- linux64-rust-size
- linux64-cbindgen
- linux64-dump-syms
- linux64-llvm-symbolizer
- linux64-sccache
- linux64-nasm
- linux64-node
@ -962,6 +968,7 @@ linux64-asan-reporter-shippable/opt:
- linux64-rust-size
- linux64-cbindgen
- linux64-dump-syms
- linux64-llvm-symbolizer
- linux64-nasm
- linux64-node
- linux64-lucetc
@ -1002,6 +1009,7 @@ linux64-asan/debug:
- linux64-rust-size
- linux64-cbindgen
- linux64-dump-syms
- linux64-llvm-symbolizer
- linux64-sccache
- linux64-nasm
- linux64-node

View File

@ -109,6 +109,7 @@ macosx64-asan-fuzzing/opt:
- linux64-cctools-port
- linux64-clang-macosx-cross
- linux64-sccache
- macosx64-llvm-symbolizer
- wasi-sysroot
optimization:
skip-unless-expanded: null

View File

@ -941,6 +941,7 @@ win64-asan/debug:
- linux64-wine
- linux64-liblowercase
- linux64-winchecksec
- win64-llvm-symbolizer
fetch:
- nsis-3.01-win
- upx-3.95-win
@ -994,6 +995,7 @@ win64-asan/opt:
- linux64-wine
- linux64-liblowercase
- linux64-winchecksec
- win64-llvm-symbolizer
fetch:
- nsis-3.01-win
- upx-3.95-win
@ -1056,6 +1058,7 @@ win64-asan-reporter-shippable/opt:
- linux64-wine
- linux64-liblowercase
- linux64-winchecksec
- win64-llvm-symbolizer
fetch:
- nsis-3.01-win
- upx-3.95-win
@ -1105,6 +1108,7 @@ win64-asan-fuzzing/opt:
- linux64-wine
- linux64-liblowercase
- linux64-winchecksec
- win64-llvm-symbolizer
fetch:
- nsis-3.01-win
- upx-3.95-win

View File

@ -172,6 +172,13 @@ sm-asan-linux64/opt:
MOZ_AUTOMATION_UPLOAD: "1"
run:
spidermonkey-variant: asan
fetches:
toolchain:
- linux64-clang
- linux64-gcc
- linux64-rust
- linux64-dump-syms
- linux64-llvm-symbolizer
sm-compacting-linux64/debug:
description: "Spidermonkey Compacting"
@ -217,6 +224,7 @@ sm-tsan-linux64/opt:
- linux64-clang
- linux64-rust-nightly
- linux64-dump-syms
- linux64-llvm-symbolizer
sm-rootanalysis-linux64/debug:
description: "Spidermonkey Root Analysis"
@ -257,6 +265,13 @@ sm-fuzzing-linux64/opt:
MOZ_AUTOMATION_UPLOAD: "1"
run:
spidermonkey-variant: fuzzing
fetches:
toolchain:
- linux64-clang
- linux64-gcc
- linux64-rust
- linux64-dump-syms
- linux64-llvm-symbolizer
sm-gdb-linux64/debug:
description: "Spidermonkey GDB Pretty-printers"

View File

@ -34,6 +34,7 @@ jobs-from:
- geckodriver.yml
- gn.yml
- grcov.yml
- llvm-symbolizer.yml
- mingw.yml
- minidump_stackwalk.yml
- misc.yml

View File

@ -0,0 +1,35 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
---
job-defaults:
worker-type: b-linux
worker:
max-run-time: 1800
run:
script: repack-llvm-symbolizer.sh
toolchain-artifact: public/build/llvm-symbolizer.tar.zst
linux64-llvm-symbolizer:
description: "llvm-symbolizer for Linux"
treeherder:
symbol: TL(llvm-symbolizer)
fetches:
toolchain:
- linux64-clang
macosx64-llvm-symbolizer:
description: "llvm-symbolizer for Linux"
treeherder:
symbol: TM(llvm-symbolizer)
fetches:
toolchain:
- macosx64-clang
win64-llvm-symbolizer:
description: "llvm-symbolizer for Linux"
treeherder:
symbol: TW64(llvm-symbolizer)
fetches:
toolchain:
- win64-clang-cl

View File

@ -0,0 +1,12 @@
#!/bin/bash
set -x -e -v
# This script is creating an artifact containing llvm-symbolizer.
mkdir llvm-symbolizer
cp $MOZ_FETCHES_DIR/clang/bin/llvm-symbolizer* llvm-symbolizer/
tar -cf - llvm-symbolizer | python3 $GECKO_PATH/taskcluster/scripts/misc/zstdpy > llvm-symbolizer.tar.zst
mkdir -p $UPLOAD_DIR
mv llvm-symbolizer.tar.zst $UPLOAD_DIR