From: Maria Guseva Date: Thu, 27 Jul 2017 08:21:23 +0000 (+0300) Subject: Use asan-force-options package from gcc X-Git-Tag: accepted/tizen/4.0/unified/20170816.014806^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F59%2F140959%2F2;p=tools%2FlibFuzzer.git Use asan-force-options package from gcc Avoid gcc-force/unforce-options scripts duplications in linaro-gcc and libFuzzer projects. Change-Id: I983d1375669bff772f294c27b5c3f281a264a0bc --- diff --git a/packaging/gcc-force-options b/packaging/gcc-force-options deleted file mode 100755 index 34f4945..0000000 --- a/packaging/gcc-force-options +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh - -set -e - -if [ $# -eq 0 ]; then - cat << EOF -Syntax: - $(basename $0) OPT1 [OPT2...]" - -Example: - $(basename $0) [prepend|append] -fsanitize=address -fno-common -U_FORTIFY_SOURCE - By default flags are appending. -EOF - exit 1 -fi - -FLAGS="$@" - -if [ $(find $(dirname $0) -name \*-real | wc -l) -gt 0 ]; then - echo >&2 "$(basename $0): directory was already processed, aborting" - exit 1 -fi - -case "$1" in -prepend) - shift - PREFLAGS="$@" - POSTFLAGS= - ;; -append) - shift - PREFLAGS= - POSTFLAGS="$@" - ;; -*) - PREFLAGS= - POSTFLAGS="$@" - ;; -esac - -TMP=$(pwd)/tmp.$$ -cat > $TMP << EOF -#!/bin/sh -if echo "$PREFLAGS "\$@" $POSTFLAGS" | grep -q -- "-fsanitize=undefined" && echo "\$@" | grep -q "\.gch\>"; then - # UBSan doesn't support precompiled headers. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66343 - echo "Precompiled headers currently not supported by UBSan" >&2 - # Don't instrument kernel modules - # Don't instrument with "-nostdlib" linking -elif ! echo "\$@" | grep -q -e __KERNEL__ -e \-nostdlib; then - # Use readlink in order to follow symlinks if any - \$(readlink -f \$0)-real $PREFLAGS "\$@" $POSTFLAGS -else - \$(readlink -f \$0)-real "\$@" -fi -EOF -chmod +x $TMP - -find -L $(dirname $0) -type f -a -perm -a=x | grep -E '(gcc|g\+\+|c\+\+)$' | while read tool; do - mv $tool $tool-real - cp $TMP $tool -done - -if [ -d /emul ]; then - find -L /emul -type f -a -perm -a=x | grep -E '(gcc|g\+\+|c\+\+)$' | while read tool; do - ln -sf $(basename $tool) $tool-real - done -fi - -rm $TMP - diff --git a/packaging/gcc-unforce-options b/packaging/gcc-unforce-options deleted file mode 100755 index cf36d04..0000000 --- a/packaging/gcc-unforce-options +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -set -e - -if [ $# -gt 0 ]; then - echo >&2 "$(basename $0): unexpected arguments" - exit 1 -fi - -find $(dirname $0) -name \*-real | while read tool_real; do - tool=$(echo "$tool_real" | sed -e 's/-real$//') - mv $tool_real $tool -done -if [ -d /emul ]; then - find /emul -name \*-real | while read tool_real; do - rm $tool_real - done -fi - diff --git a/packaging/libFuzzer.spec b/packaging/libFuzzer.spec index 476834d..909fc08 100644 --- a/packaging/libFuzzer.spec +++ b/packaging/libFuzzer.spec @@ -6,8 +6,6 @@ Summary: libFuzzer Url: http://llvm.org/docs/LibFuzzer.html Group: Development/Testing Source0: %{name}-%{version}.tar.xz -Source1: gcc-force-options -Source2: gcc-unforce-options # disable debuginfo stripping %define __strip /bin/true @@ -29,7 +27,6 @@ mkdir -p %{buildroot}%{_prefix}/bin cp scripts/sancov.py %{buildroot}%{_prefix}/bin cp scripts/sancov_symbolize.py %{buildroot}%{_prefix}/bin cp scripts/coverage-report-dump.py %{buildroot}%{_prefix}/bin -cp %{SOURCE1} %{SOURCE2} %{buildroot}%{_prefix}/bin %files %manifest %{name}.manifest @@ -41,25 +38,21 @@ cp %{SOURCE1} %{SOURCE2} %{buildroot}%{_prefix}/bin Summary: Scripts to enable automatic package sanitization for fuzzing Group: System Environment # Need to have gcc installed before running the force-options script -Requires: gcc libasan +Requires: asan-force-options %description -n fuzz-force-options -Scripts for ASan and SanCov instrumentation needed for fuzzing. +Compiler wrappers for ASan and SanCov instrumentation needed for fuzzing. %post -n fuzz-force-options -# Change mode to allow all users to run gcc-force/unforce-options -chmod a+w /usr/bin +/usr/bin/gcc-unforce-options /usr/bin/gcc-force-options -fsanitize-coverage=trace-pc -fsanitize=address -fno-common -fno-omit-frame-pointer -U_FORTIFY_SOURCE -chmod a-w /usr/bin %preun -n fuzz-force-options -chmod a+w /usr/bin /usr/bin/gcc-unforce-options chmod a-w /usr/bin %files -n fuzz-force-options -%{_prefix}/bin/gcc-force-options -%{_prefix}/bin/gcc-unforce-options +# no files %package -n sancov Summary: Scripts to process coverage information