[patch] libsanitizer

Andreas Tobler andreast-list@fgznet.ch
Tue Nov 10 22:01:00 GMT 2015


Hi all,

the attached patch removes the hard-coded requirement for the link 
operation with -ldl. On FreeBSD we do not need that, it breaks compilation.

The patch is tested against CentOS7.1

Ok to apply for trunk?

TIA,
Andreas

2015-11-10  Andreas Tobler  <andreast@gcc.gnu.org>

	* configure.ac: Replace the hard-coded -ldl requirement for
	link_sanitizer_common with a configure time check for -ldl.
	* configure: Regenerate.


Index: configure.ac
===================================================================
--- configure.ac	(revision 230119)
+++ configure.ac	(working copy)
@@ -96,7 +96,7 @@
  AC_CHECK_FUNCS(clock_getres clock_gettime clock_settime)

  # Common libraries that we need to link against for all sanitizer libs.
-link_sanitizer_common='-lpthread -ldl -lm'
+link_sanitizer_common='-lpthread -lm'

  # At least for glibc, shm_open is in librt.  But don't pull that
  # in if it still doesn't give us the function we want.  This
@@ -130,6 +130,12 @@
  # Other sanitizers do not override clock_* API
  ])

+# Do a configure time check for -ldl
+AC_CHECK_LIB(dl, dlsym,
+  [link_libasan="-ldl $link_libasan"
+link_libtsan="-ldl $link_libtsan"
+])
+
  case "$host" in
    *-*-darwin*) MAC_INTERPOSE=true ; enable_static=no ;;
    *) MAC_INTERPOSE=false ;;



More information about the Gcc-patches mailing list