Some packages fail to build with ASan because we force -fno-common compiler
switch in ASan builds. Athough the right thing to do would be fixing failed
packages itselves, sometimes it's not possible due to, say, difficult
package structure.
asan-force-options now makes /emul/ writable to provide possibility of
unforcing ASan related options. That would allow us to run gcc-unforce-options
right in package's spec file and re-force ASan related options without
-fno-common switch.
Change-Id: I285b299883a971eb50d4d3f5d3ca2fb448dcacbd
Signed-off-by: Maxim Ostapenko <m.ostapenko@samsung.com>
%post -n asan-force-options
# Change mode to allow all users to run gcc-force/unforce-options
chmod a+w /usr/bin
+[ -d /emul/ ] && chmod a+w /emul/usr/bin/
/usr/bin/gcc-force-options -fsanitize-recover=address -fsanitize=address -fno-common -fno-omit-frame-pointer -U_FORTIFY_SOURCE
%preun -n asan-force-options
# Restore read-only mode
chmod a-w /usr/bin
+[ -d /emul/ ] && chmod a-w /emul/usr/bin/
/usr/bin/gcc-unforce-options
%package -n ubsan-force-options
%post -n asan-force-options
# Change mode to allow all users to run gcc-force/unforce-options
chmod a+w /usr/bin
+[ -d /emul/ ] && chmod a+w /emul/usr/bin/
/usr/bin/gcc-force-options -fsanitize-recover=address -fsanitize=address -fno-common -fno-omit-frame-pointer -U_FORTIFY_SOURCE
%preun -n asan-force-options
# Restore read-only mode
chmod a-w /usr/bin
+[ -d /emul/ ] && chmod a-w /emul/usr/bin/
/usr/bin/gcc-unforce-options
%package -n ubsan-force-options
%post -n asan-force-options
# Change mode to allow all users to run gcc-force/unforce-options
chmod a+w /usr/bin
+[ -d /emul/ ] && chmod a+w /emul/usr/bin/
/usr/bin/gcc-force-options -fsanitize-recover=address -fsanitize=address -fno-common -fno-omit-frame-pointer -U_FORTIFY_SOURCE
%preun -n asan-force-options
# Restore read-only mode
chmod a-w /usr/bin
+[ -d /emul/ ] && chmod a-w /emul/usr/bin/
/usr/bin/gcc-unforce-options
%package -n ubsan-force-options