Synchronize <X>SAN_OPTIONS with <x>san_runtime_env variable values 34/195734/2
authorMikhail Kashkarov <m.kashkarov@partner.samsung.com>
Mon, 17 Dec 2018 16:37:43 +0000 (19:37 +0300)
committerMikhail Kashkarov <m.kashkarov@partner.samsung.com>
Thu, 10 Jan 2019 07:28:26 +0000 (10:28 +0300)
Generate XSAN_OPTIONS in %build stage, replace "cp + chmod" with install
commands.

Change-Id: Ie3fed76c658c07ff2e2569b84d070410e298add8

packaging/ASAN_OPTIONS [deleted file]
packaging/ESAN_OPTIONS [deleted file]
packaging/LSAN_OPTIONS [deleted file]
packaging/TSAN_OPTIONS [deleted file]
packaging/UBSAN_OPTIONS [deleted file]
packaging/gcc-contrib.spec

diff --git a/packaging/ASAN_OPTIONS b/packaging/ASAN_OPTIONS
deleted file mode 100644 (file)
index 405d307..0000000
+++ /dev/null
@@ -1 +0,0 @@
-halt_on_error=false:start_deactivated=true:print_cmdline=true:quarantine_size_mb=1:detect_leaks=0:full_address_space=true:handle_segv=0
diff --git a/packaging/ESAN_OPTIONS b/packaging/ESAN_OPTIONS
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/packaging/LSAN_OPTIONS b/packaging/LSAN_OPTIONS
deleted file mode 100644 (file)
index db30ebc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-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
diff --git a/packaging/TSAN_OPTIONS b/packaging/TSAN_OPTIONS
deleted file mode 100644 (file)
index 324d142..0000000
+++ /dev/null
@@ -1 +0,0 @@
-print_cmdline=true:log_path=/tmp/tsan.log:detect_deadlocks=1:second_deadlock_stack=1
diff --git a/packaging/UBSAN_OPTIONS b/packaging/UBSAN_OPTIONS
deleted file mode 100644 (file)
index 0fbf7a7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-print_cmdline=true:log_path=/tmp/ubsan.log
\ No newline at end of file
index 2a58a32..e534890 100644 (file)
@@ -48,7 +48,7 @@
 %define ubsan_force_options -fsanitize=undefined,bounds-strict,float-divide-by-zero,float-cast-overflow
 %define isan_force_options -fsanitize=unsigned-integer-overflow
 %define tsan_force_options -fsanitize=thread -fno-omit-frame-pointer -Wp,-U_FORTIFY_SOURCE -Wl,--as-needed -ldl -lpthread
-%define asan_runtime_options halt_on_error=false:start_deactivated=true:print_cmdline=true:quarantine_size_mb=1:detect_leaks=0:handle_segv=0:log_path=/tmp/asan.log:log_exe_name=1:fast_unwind_on_fatal=1
+%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
 %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
@@ -66,20 +66,15 @@ Version:       6.2.1
 Release:       0
 Source15: gcc-force-options
 Source16: gcc-unforce-options
-Source17: ASAN_OPTIONS
-Source18: asan_symbolize.py
-Source19: LSAN_OPTIONS
-Source20: gcc-contrib.manifest
-Source21: UBSAN_OPTIONS
-Source22: macros.ubsan
-Source23: extract-ubsan-logs
-Source24: lsan.supp
-Source25: TSAN_OPTIONS
-Source26: macros.asan
-Source27: ESAN_OPTIONS
-Source28: cc1
-Source29: macros.gcc_warning
-Source30: extract-gcc-warning-logs
+Source17: asan_symbolize.py
+Source18: gcc-contrib.manifest
+Source19: macros.ubsan
+Source20: extract-ubsan-logs
+Source21: lsan.supp
+Source22: macros.asan
+Source23: cc1
+Source24: macros.gcc_warning
+Source25: extract-gcc-warning-logs
 Group:         Development/Building
 Summary:       GCC related scripts
 License:       MIT
@@ -550,46 +545,47 @@ fi
 %prep
 
 %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
 mkdir -p %buildroot%_prefix
 mkdir -p %buildroot%_prefix/bin
 sed -e 's|GCC_LIBSUBDIR|%{libsubdir}|' -i %{SOURCE15}
 
-cp %{SOURCE15} %{SOURCE16} %{SOURCE18} %{buildroot}%{_prefix}/bin
-chmod a+x %{buildroot}%{_prefix}/bin/gcc-force-options
-chmod a+x %{buildroot}%{_prefix}/bin/gcc-unforce-options
-chmod a+x %{buildroot}%{_prefix}/bin/asan_symbolize.py
+install -m 0755 %{SOURCE15} %{buildroot}%{_prefix}/bin/
+install -m 0755 %{SOURCE16} %{buildroot}%{_prefix}/bin/
+install -m 0755 %{SOURCE17} %{buildroot}%{_prefix}/bin/
 
-cp %{SOURCE17} %{buildroot}
-chmod 644 %{buildroot}/ASAN_OPTIONS
+install -m 0644 ASAN_OPTIONS %{buildroot}
 
 %ifarch %lsan_arch
-cp %{SOURCE19} %{SOURCE24} %{buildroot}
-chmod 644 %{buildroot}/LSAN_OPTIONS
-chmod 644 %{buildroot}/lsan.supp
+install -m 0644 LSAN_OPTIONS %{buildroot}
+install -m 0644 %{SOURCE21} %{buildroot}
 %endif
 
 %ifarch %tsan_arch
-cp %{SOURCE25} %{buildroot}
-chmod 644 %{buildroot}/TSAN_OPTIONS
+install -m 0644 TSAN_OPTIONS %{buildroot}
 %endif
 
 %ifarch %esan_arch
-cp %{SOURCE27} %{buildroot}
-chmod 644 %{buildroot}/ESAN_OPTIONS
+install -m 0644 ESAN_OPTIONS %{buildroot}
 %endif
 
 mkdir -p %{buildroot}/%{_rpmconfigdir}/tizen/
-install -m 0644 %{SOURCE21} %{buildroot}/
+install -m 0644 UBSAN_OPTIONS %{buildroot}/
+install -m 0644 %{SOURCE19} %{buildroot}/%{_rpmconfigdir}/
 install -m 0644 %{SOURCE22} %{buildroot}/%{_rpmconfigdir}/
-install -m 0644 %{SOURCE26} %{buildroot}/%{_rpmconfigdir}/
-install -m 0755 %{SOURCE23} %{buildroot}/%{_rpmconfigdir}/tizen/
+install -m 0755 %{SOURCE20} %{buildroot}/%{_rpmconfigdir}/tizen/
 
 mkdir -p %{buildroot}/usr/lib/gcc-log-wrapper
-install -m 0755 %{SOURCE28} %{buildroot}/usr/lib/gcc-log-wrapper/
-install -m 0644 %{SOURCE29} %{buildroot}/%{_rpmconfigdir}/
-install -m 0755 %{SOURCE30} %{buildroot}/%{_rpmconfigdir}/tizen/
+install -m 0755 %{SOURCE23} %{buildroot}/usr/lib/gcc-log-wrapper/
+install -m 0644 %{SOURCE24} %{buildroot}/%{_rpmconfigdir}/
+install -m 0755 %{SOURCE25} %{buildroot}/%{_rpmconfigdir}/tizen/
 
 %files
 #%manifest gcc-contrib.manifest