Split asan-build-env to two packages. 95/79195/3
authorMaxim Ostapenko <m.ostapenko@samsung.com>
Thu, 30 Jun 2016 10:56:01 +0000 (13:56 +0300)
committerMaxim Ostapenko <m.ostapenko@samsung.com>
Tue, 26 Jul 2016 07:29:51 +0000 (10:29 +0300)
It seems that we need different ASan runtime options for OBS build process
and for ASan running on target device. Split asan-build-env package to
asan-build-env and asan-runtime-env packages to install different options for
ASan depending on whether it runs under QEMU or on target device.

Change-Id: I13441a2edc04500d4ce0676c09e0ceeb5bc2901e
Signed-off-by: Maxim Ostapenko <m.ostapenko@samsung.com>
packaging/ASAN_OPTIONS
packaging/gcc-aarch64.spec
packaging/gcc-armv7l.spec
packaging/linaro-gcc.spec

index 24fcaeb..50d644e 100644 (file)
@@ -1 +1 @@
-halt_on_error=false:start_deactivated=true:print_cmdline=true:quarantine_size_mb=1:detect_leaks=0
\ No newline at end of file
+halt_on_error=false:start_deactivated=true:print_cmdline=true:quarantine_size_mb=1:detect_leaks=0:full_address_space=true
index 4d52515..4456f95 100644 (file)
@@ -695,7 +695,26 @@ Requires:   binutils python
 The package contatins platform-independent tools for sanitization:
 - asan_symbolize.py: script for offline symbolization of asan logs
 
+%package -n asan-runtime-env
+Summary:    Asan runtime environment for target device
+Group:      Development/Libraries
+
+%description -n asan-runtime-env
+Asan runtime environment
+
+%post -n asan-runtime-env
+# Add /usr/lib/libasan.so to /etc/ld.so.preload
+[ -f /etc/ld.so.preload ] && mv -v /etc/ld.so.preload /etc/ld.so.preload.orig
+echo "libasan.so" > /etc/ld.so.preload
+[ -f /etc/ld.so.preload.orig ] && cat /etc/ld.so.preload.orig >> /etc/ld.so.preload
+[ -f /etc/ld.so.preload.orig ] && rm -f /etc/ld.so.preload.orig
+echo "halt_on_error=false:start_deactivated=true:print_cmdline=true:quarantine_size_mb=1:detect_leaks=0:log_path=/tmp/asan.log" > /ASAN_OPTIONS
+
+%preun -n asan-runtime-env
+# Restore /etc/ld.so.preload
+[ -f /etc/ld.so.preload.orig ] && mv -v /etc/ld.so.preload.orig /etc/ld.so.preload
 %prep
+
 %setup -q -n gcc-%{version}
 
 tar xf %{SOURCE10}
@@ -1087,6 +1106,9 @@ chmod 644 %{buildroot}/ASAN_OPTIONS
 %defattr(-,root,root,-)
 /ASAN_OPTIONS
 
+%files -n asan-runtime-env
+%defattr(-,root,root,-)
+
 %ifarch %lsan_arch
 %files -n lsan-build-env
 %defattr(-,root,root,-)
index a22dfd2..6243537 100644 (file)
@@ -695,7 +695,26 @@ Requires:   binutils python
 The package contatins platform-independent tools for sanitization:
 - asan_symbolize.py: script for offline symbolization of asan logs
 
+%package -n asan-runtime-env
+Summary:    Asan runtime environment for target device
+Group:      Development/Libraries
+
+%description -n asan-runtime-env
+Asan runtime environment
+
+%post -n asan-runtime-env
+# Add /usr/lib/libasan.so to /etc/ld.so.preload
+[ -f /etc/ld.so.preload ] && mv -v /etc/ld.so.preload /etc/ld.so.preload.orig
+echo "libasan.so" > /etc/ld.so.preload
+[ -f /etc/ld.so.preload.orig ] && cat /etc/ld.so.preload.orig >> /etc/ld.so.preload
+[ -f /etc/ld.so.preload.orig ] && rm -f /etc/ld.so.preload.orig
+echo "halt_on_error=false:start_deactivated=true:print_cmdline=true:quarantine_size_mb=1:detect_leaks=0:log_path=/tmp/asan.log" > /ASAN_OPTIONS
+
+%preun -n asan-runtime-env
+# Restore /etc/ld.so.preload
+[ -f /etc/ld.so.preload.orig ] && mv -v /etc/ld.so.preload.orig /etc/ld.so.preload
 %prep
+
 %setup -q -n gcc-%{version}
 
 tar xf %{SOURCE10}
@@ -1087,6 +1106,9 @@ chmod 644 %{buildroot}/ASAN_OPTIONS
 %defattr(-,root,root,-)
 /ASAN_OPTIONS
 
+%files -n asan-runtime-env
+%defattr(-,root,root,-)
+
 %ifarch %lsan_arch
 %files -n lsan-build-env
 %defattr(-,root,root,-)
index ab37e3c..5cb6f61 100644 (file)
@@ -692,7 +692,26 @@ Requires:   binutils python
 The package contatins platform-independent tools for sanitization:
 - asan_symbolize.py: script for offline symbolization of asan logs
 
+%package -n asan-runtime-env
+Summary:    Asan runtime environment for target device
+Group:      Development/Libraries
+
+%description -n asan-runtime-env
+Asan runtime environment
+
+%post -n asan-runtime-env
+# Add /usr/lib/libasan.so to /etc/ld.so.preload
+[ -f /etc/ld.so.preload ] && mv -v /etc/ld.so.preload /etc/ld.so.preload.orig
+echo "libasan.so" > /etc/ld.so.preload
+[ -f /etc/ld.so.preload.orig ] && cat /etc/ld.so.preload.orig >> /etc/ld.so.preload
+[ -f /etc/ld.so.preload.orig ] && rm -f /etc/ld.so.preload.orig
+echo "halt_on_error=false:start_deactivated=true:print_cmdline=true:quarantine_size_mb=1:detect_leaks=0:log_path=/tmp/asan.log" > /ASAN_OPTIONS
+
+%preun -n asan-runtime-env
+# Restore /etc/ld.so.preload
+[ -f /etc/ld.so.preload.orig ] && mv -v /etc/ld.so.preload.orig /etc/ld.so.preload
 %prep
+
 %setup -q -n gcc-%{version}
 
 tar xf %{SOURCE10}
@@ -1084,6 +1103,9 @@ chmod 644 %{buildroot}/ASAN_OPTIONS
 %defattr(-,root,root,-)
 /ASAN_OPTIONS
 
+%files -n asan-runtime-env
+%defattr(-,root,root,-)
+
 %ifarch %lsan_arch
 %files -n lsan-build-env
 %defattr(-,root,root,-)