%define lsan_arch x86_64 %ix86 armv7l aarch64
%define ubsan_arch x86_64 %ix86 ppc ppc64 %arm aarch64
%define cilkrts_arch x86_64 %ix86
-%define esan_arch x86_64 %arm
%ifarch armv7l
%define ARCH armv7l
%define tsan_force_options -fsanitize=thread -fno-omit-frame-pointer -Wp,-U_FORTIFY_SOURCE -Wl,--as-needed -ldl -lpthread
%define gcov_force_options -fprofile-arcs -ftest-coverage
%define asan_runtime_options halt_on_error=false:start_deactivated=true:print_cmdline=true:quarantine_size_mb=1:detect_leaks=0:full_address_space=true:handle_segv=0:log_path=/tmp/asan.log:log_exe_name=1:fast_unwind_on_fatal=1:allocator_may_return_null=1
-%define esan_force_options -fsanitize=efficiency-working-set -fno-omit-frame-pointer -Wp,-U_FORTIFY_SOURCE -Wl,--as-needed -ldl -lpthread
-%define esan_cache_force_options -fsanitize=efficiency-cache-frag -fno-omit-frame-pointer -Wp,-U_FORTIFY_SOURCE -Wl,--as-needed -ldl -lpthread
%define ubsan_runtime_options print_cmdline=true:log_path=/tmp/ubsan.log
%define lsan_runtime_options print_cmdline=true:detect_leaks=1:log_path=/tmp/lsan.log:log_exe_name=1:fast_unwind_on_malloc=false:malloc_context_size=5:suppressions=/lsan.supp:print_suppressions=false
%define tsan_runtime_options print_cmdline=true:log_path=/tmp/tsan.log:detect_deadlocks=1:second_deadlock_stack=1
-%define esan_runtime_options print_cmdline=true:log_path=/tmp/esan.log
Name: gcc-contrib%{?cross:-%{cross}}
# With generated files in src we could drop the following
/usr/bin/gcc-unforce-options
[ -d /emul/ ] && chmod a-w /emul/usr/bin/
-%package -n esan-force-options
-Summary: Scripts to enable automatic package sanitization
-Group: System Environment
-Requires: gcc
-Requires: libesan
-
-%description -n esan-force-options
-Scripts for ESan instrumentation
-
-%post -n esan-force-options
-# Change mode to allow all users to run gcc-force/unforce-options
-chmod a+w /usr/bin
-chmod a+w %{libsubdir}
-[ -d /emul/ ] && chmod a+w /emul/usr/bin/ && chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \
- && find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w
-/usr/bin/gcc-force-options %esan_force_options
-# Add ESan-related macros
-cat >> /usr/lib/rpm/tizen_macros << EOF
-
-%%esan_force_options %{esan_force_options}
-%%gcc_unforce_options /usr/bin/gcc-unforce-options
-%%gcc_force_options /usr/bin/gcc-force-options
-%%gcc_force_default_options %%gcc_force_options %%esan_force_options
-EOF
-
-%preun -n esan-force-options
-# Restore read-only mode
-chmod a-w /usr/bin
-chmod a-w %{libsubdir}
-[ -d /emul/ ] && chmod a-w /emul/usr/bin/ && chmod a-w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \
- && find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a-w
-/usr/bin/gcc-unforce-options
-[ -d /emul/ ] && chmod a-w /emul/usr/bin/
-
-%package -n esan-cache-force-options
-Summary: Scripts to enable automatic package sanitization
-Group: System Environment
-Requires: gcc
-Requires: libesan
-
-%description -n esan-cache-force-options
-Scripts for ESan instrumentation
-
-%post -n esan-cache-force-options
-# Change mode to allow all users to run gcc-force/unforce-options
-chmod a+w /usr/bin
-chmod a+w %{libsubdir}
-[ -d /emul/ ] && chmod a+w /emul/usr/bin/ && chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \
- && find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w
-/usr/bin/gcc-force-options %esan_cache_force_options
-# Add ESan-related macros
-cat >> /usr/lib/rpm/tizen_macros << EOF
-
-%%esan_cache_force_options %{esan_cache_force_options}
-%%gcc_unforce_options /usr/bin/gcc-unforce-options
-%%gcc_force_options /usr/bin/gcc-force-options
-%%gcc_force_default_options %%gcc_force_options %%esan_cache_force_options
-EOF
-
-%preun -n esan-cache-force-options
-# Restore read-only mode
-chmod a-w /usr/bin
-chmod a-w %{libsubdir}
-[ -d /emul/ ] && chmod a-w /emul/usr/bin/ && chmod a-w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \
- && find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a-w
-/usr/bin/gcc-unforce-options
-[ -d /emul/ ] && chmod a-w /emul/usr/bin/
-
-%package -n esan-runtime-env
-Summary: ESan runtime environment
-Group: Development/Libraries
-Requires: libesan
-Requires(post): smack
-
-%description -n esan-runtime-env
-ESan runtime environment
-
-%post -n esan-runtime-env
-echo "%{esan_runtime_options}" > /ESAN_OPTIONS
-chsmack -a "_" /ESAN_OPTIONS
-
-%package -n esan-build-env
-Summary: ESan build environment
-Group: Development/Libraries
-Requires: libesan
-
-%description -n esan-build-env
-ESan build environment
-
-%post -n esan-build-env
-echo "%{esan_runtime_options}" > /ESAN_OPTIONS
-echo ":process_range_access=0" >> /ESAN_OPTIONS
-chsmack -a "_" /ESAN_OPTIONS
-
%package -n tsan-runtime-env
Summary: TSan runtime environment
Group: Development/Libraries
%build
# Generate runtime options for sanitizers
echo "%{asan_runtime_options}" | tee ASAN_OPTIONS
-echo "%{esan_runtime_options}" | tee ESAN_OPTIONS
echo "%{lsan_runtime_options}" | tee LSAN_OPTIONS
echo "%{tsan_runtime_options}" | tee TSAN_OPTIONS
echo "%{ubsan_runtime_options}" | tee UBSAN_OPTIONS
install -m 0644 TSAN_OPTIONS %{buildroot}
%endif
-%ifarch %esan_arch
-install -m 0644 ESAN_OPTIONS %{buildroot}
-%endif
-
mkdir -p %{buildroot}/%{_rpmconfigdir}/tizen/
install -m 0644 UBSAN_OPTIONS %{buildroot}/
install -m 0644 %{SOURCE19} %{buildroot}/%{_rpmconfigdir}/
%{_prefix}/bin/gcc-unforce-options
%endif
-%ifarch %esan_arch
-%files -n esan-force-options
-%defattr(-,root,root,-)
-%{_prefix}/bin/gcc-force-options
-%{_prefix}/bin/gcc-unforce-options
-%endif
-
-%ifarch %esan_arch
-%files -n esan-cache-force-options
-%defattr(-,root,root,-)
-%{_prefix}/bin/gcc-force-options
-%{_prefix}/bin/gcc-unforce-options
-%endif
-
%files -n asan-build-env
%defattr(-,root,root,-)
/ASAN_OPTIONS
%{_rpmconfigdir}/macros.ubsan
%{_rpmconfigdir}/tizen/extract-ubsan-logs
-%ifarch %esan_arch
-%files -n esan-runtime-env
-%defattr(-,root,root,-)
-/ESAN_OPTIONS
-
-%files -n esan-build-env
-%defattr(-,root,root,-)
-/ESAN_OPTIONS
-%endif
-
%files -n ubsan-runtime-env
%defattr(-,root,root,-)
%endif