diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-03-12 15:59:10 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-03-12 15:59:25 +0100 |
commit | 36cd9913ced4817aaf832d0402422d1c222e9b78 (patch) | |
tree | dc4f188d85c69dc0a2f6769763aefccce22aecfc /tools | |
parent | Rename scripts/oss-fuzz.sh to tools/oss-fuzz.sh (diff) | |
download | systemd-36cd9913ced4817aaf832d0402422d1c222e9b78.tar.xz systemd-36cd9913ced4817aaf832d0402422d1c222e9b78.zip |
tools/oss-fuzz: add clang library dir using -L
I have no idea why clang doesn't do this on its own, and why clang
makes it so hard to query this path (-dumpversion returns something
unrelated...).
I know this is an ugly hack, but this is a very specialized script,
so it should be OK to make it a bit hacky.
Tested to work on Fedora (27) and Debian (unstable).
Fixes #8428.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/oss-fuzz.sh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/oss-fuzz.sh b/tools/oss-fuzz.sh index 2c4e58e29d..117b3d1aa4 100755 --- a/tools/oss-fuzz.sh +++ b/tools/oss-fuzz.sh @@ -20,13 +20,20 @@ set -ex export LC_CTYPE=C.UTF-8 +export CC=${CC:-clang} +export CXX=${CXX:-clang++} +clang_version="$($CC --version | sed -nr 's/.*version ([^ ]+?) .*/\1/p' | sed -r 's/-$//')" + SANITIZER=${SANITIZER:-address -fsanitize-address-use-after-scope} flags="-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=$SANITIZER -fsanitize-coverage=trace-pc-guard,trace-cmp" +clang_lib="/usr/lib64/clang/${clang_version}/lib/linux" +[ -d "$clang_lib" ] || clang_lib="/usr/lib/clang/${clang_version}/lib/linux" + export CFLAGS=${CFLAGS:-$flags} export CXXFLAGS=${CXXFLAGS:-$flags} -export CC=${CC:-clang} -export CXX=${CXX:-clang++} +export LDFLAGS=${LDFLAGS:--L${clang_lib}} + export WORK=${WORK:-$(pwd)} export OUT=${OUT:-$(pwd)/out} mkdir -p $OUT |