cc/gcc: add option to enable/disable libsanitizer

libsaniotizer requires a few headers that are not in uClibc, for
example. Also, it is only available for native threads (NPTL under
glibc.) Finally, it is only available starting with gcc-4.8.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
This commit is contained in:
Yann E. MORIN 2014-08-31 17:30:34 +02:00
parent 15f60baf95
commit a56df802eb
3 changed files with 27 additions and 3 deletions

View File

@ -368,6 +368,7 @@ config CC_GCC_4_8
select CC_GCC_HAS_BUILD_ID
select CC_GCC_HAS_LNK_HASH_STYLE
select CC_GCC_HAS_LIBQUADMATH
select CC_GCC_HAS_LIBSANITIZER
select CC_SUPPORT_GOLANG
config CC_GCC_4_8_or_later
@ -385,6 +386,7 @@ config CC_GCC_4_9
select CC_GCC_HAS_BUILD_ID
select CC_GCC_HAS_LNK_HASH_STYLE
select CC_GCC_HAS_LIBQUADMATH
select CC_GCC_HAS_LIBSANITIZER
select CC_SUPPORT_GOLANG
config CC_GCC_4_9_or_later
@ -402,6 +404,7 @@ config CC_GCC_latest
select CC_GCC_HAS_BUILD_ID
select CC_GCC_HAS_LNK_HASH_STYLE
select CC_GCC_HAS_LIBQUADMATH
select CC_GCC_HAS_LIBSANITIZER
config CC_GCC_HAS_GRAPHITE
bool
@ -482,6 +485,9 @@ config CC_GCC_USE_LIBELF
config CC_GCC_HAS_LIBQUADMATH
bool
config CC_GCC_HAS_LIBSANITIZER
bool
config CC_VERSION
string
# Don't remove next line

View File

@ -143,6 +143,20 @@ config CC_GCC_LIBQUADMATH
The default is 'N'. Say 'Y' if you need it, and report success/failure.
config CC_GCC_LIBSANITIZER
bool
prompt "Compile libsanitizer"
depends on CC_GCC_HAS_LIBSANITIZER
depends on THREADS_NATIVE
depends on ! LIBC_uClibc # Currently lacks required headers (like netrom.h)
help
libsanitizer is a library which provides run-time sanitising of either
or both of:
- memory access patterns (out-of-bonds, use-after-free)
- racy data accesses (in multi-threaded programs)
The default is 'N'. Say 'Y' if you need it, and report success/failure.
#-----------------------------------------------------------------------------
comment "Misc. obscure options."

View File

@ -657,9 +657,6 @@ do_cc_backend() {
if [ "${CT_THREADS}" = "none" ]; then
extra_config+=(--disable-libatomic)
fi
if [ "${CT_THREADS}" != "nptl" ]; then
extra_config+=(--disable-libsanitizer)
fi
fi
if [ "${CT_CC_GCC_LIBMUDFLAP}" = "y" ]; then
extra_config+=(--enable-libmudflap)
@ -685,6 +682,13 @@ do_cc_backend() {
extra_config+=(--disable-libquadmath-support)
fi
fi
if [ "${CT_CC_GCC_HAS_LIBSANITIZER}" = "y" ]; then
if [ "${CT_CC_GCC_LIBSANITIZER}" = "y" ]; then
extra_config+=(--enable-libsanitizer)
else
extra_config+=(--disable-libsanitizer)
fi
fi
final_LDFLAGS+=("${ldflags}")