diff options
author | Sangmin Seo <sangmin7.seo@samsung.com> | 2017-07-12 18:37:50 +0900 |
---|---|---|
committer | Sangmin Seo <sangmin7.seo@samsung.com> | 2017-07-28 09:26:32 +0900 |
commit | 66898b859383e02b24865b7712423dd7e258bcdc (patch) | |
tree | b2bd43a681628434dc70956ceac7e448007a179b | |
parent | c51983b611f888ce51c6c137b50038a0daee45e9 (diff) | |
download | linaro-gcc-66898b859383e02b24865b7712423dd7e258bcdc.tar.gz linaro-gcc-66898b859383e02b24865b7712423dd7e258bcdc.tar.bz2 linaro-gcc-66898b859383e02b24865b7712423dd7e258bcdc.zip |
packaging: append -ldl -lpthread to ASan force options.
When building for address sanitization, some packages complain about
missing symbols due to omitted -ldl or -pthread. This patch appends
-ldl and -lpthread to the ASan force options in order to resolve this
kind of issue. Note that since -ldl and -lpthread are already needed
by libasan, adding them to the ASan force options should not cause any
problems.
This patch also adds -Wl,--as-needed before -ldl -lpthread in the
force options to prevent libdl or libpthread from being linked when
unnecessary.
Change-Id: Ic50059d4684e15773f56c589cfacda0bc944d955
Signed-off-by: Sangmin Seo <sangmin7.seo@samsung.com>
-rw-r--r-- | packaging/gcc-aarch64.spec | 2 | ||||
-rw-r--r-- | packaging/gcc-armv7l.spec | 2 | ||||
-rw-r--r-- | packaging/linaro-gcc.spec | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/packaging/gcc-aarch64.spec b/packaging/gcc-aarch64.spec index ef0e5680090..b10c27c6e1a 100644 --- a/packaging/gcc-aarch64.spec +++ b/packaging/gcc-aarch64.spec @@ -54,7 +54,7 @@ %define libdir %{!?cross:%{_libdir}}%{?cross:%{_prefix}/lib%{?aarch64:64}} %define libsubdir %{libdir}/gcc/%{target_arch}/%{version} -%define asan_force_options -fsanitize-recover=address -fsanitize=address -fno-omit-frame-pointer -Wp,-U_FORTIFY_SOURCE +%define asan_force_options -fsanitize-recover=address -fsanitize=address -fno-omit-frame-pointer -Wp,-U_FORTIFY_SOURCE -Wl,--as-needed -ldl -lpthread %define ubsan_force_options -fsanitize=undefined,bounds-strict,float-divide-by-zero,float-cast-overflow %define lsan_force_options -fsanitize=leak -fno-omit-frame-pointer -Wp,-U_FORTIFY_SOURCE diff --git a/packaging/gcc-armv7l.spec b/packaging/gcc-armv7l.spec index 878d527921f..cf241129234 100644 --- a/packaging/gcc-armv7l.spec +++ b/packaging/gcc-armv7l.spec @@ -54,7 +54,7 @@ %define libdir %{!?cross:%{_libdir}}%{?cross:%{_prefix}/lib%{?aarch64:64}} %define libsubdir %{libdir}/gcc/%{target_arch}/%{version} -%define asan_force_options -fsanitize-recover=address -fsanitize=address -fno-omit-frame-pointer -Wp,-U_FORTIFY_SOURCE +%define asan_force_options -fsanitize-recover=address -fsanitize=address -fno-omit-frame-pointer -Wp,-U_FORTIFY_SOURCE -Wl,--as-needed -ldl -lpthread %define ubsan_force_options -fsanitize=undefined,bounds-strict,float-divide-by-zero,float-cast-overflow %define lsan_force_options -fsanitize=leak -fno-omit-frame-pointer -Wp,-U_FORTIFY_SOURCE diff --git a/packaging/linaro-gcc.spec b/packaging/linaro-gcc.spec index 5058a993a55..34d9221f9d1 100644 --- a/packaging/linaro-gcc.spec +++ b/packaging/linaro-gcc.spec @@ -51,7 +51,7 @@ %define libdir %{!?cross:%{_libdir}}%{?cross:%{_prefix}/lib%{?aarch64:64}} %define libsubdir %{libdir}/gcc/%{target_arch}/%{version} -%define asan_force_options -fsanitize-recover=address -fsanitize=address -fno-omit-frame-pointer -Wp,-U_FORTIFY_SOURCE +%define asan_force_options -fsanitize-recover=address -fsanitize=address -fno-omit-frame-pointer -Wp,-U_FORTIFY_SOURCE -Wl,--as-needed -ldl -lpthread %define ubsan_force_options -fsanitize=undefined,bounds-strict,float-divide-by-zero,float-cast-overflow %define lsan_force_options -fsanitize=leak -fno-omit-frame-pointer -Wp,-U_FORTIFY_SOURCE |