re PR target/80090 (Incorrect assembler - output_addr_const may generate visibility...
[gcc.git] / libsanitizer / configure.ac
index ece15ed13dcbbc369600b833845b4056aae1f2c2..b0c485b0f7bcf98dcffa98a98ec5eeee884f3e26 100644 (file)
@@ -96,7 +96,17 @@ AM_CONDITIONAL(LSAN_SUPPORTED, [test "x$LSAN_SUPPORTED" = "xyes"])
 AC_CHECK_FUNCS(clock_getres clock_gettime clock_settime)
 
 # Common libraries that we need to link against for all sanitizer libs.
-link_sanitizer_common='-lrt -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
+# test is copied from libgomp.
+AC_CHECK_LIB(rt, shm_open,
+  [link_sanitizer_common="-lrt $link_sanitizer_common"])
+
+# Do a configure time check for -ldl
+AC_CHECK_LIB(dl, dlsym,
+  [link_sanitizer_common="-ldl $link_sanitizer_common"])
 
 # Set up the set of additional libraries that we need to link against for libasan.
 link_libasan=$link_sanitizer_common
@@ -114,12 +124,21 @@ AC_SUBST(link_libubsan)
 link_liblsan=$link_sanitizer_common
 AC_SUBST(link_liblsan)
 
+
+# At least for glibc, clock_gettime is in librt.  But don't pull that
+# in if it still doesn't give us the function we want.  This
+# test is copied from libgomp.
+AC_CHECK_LIB(rt, clock_gettime,
+  [link_libasan="-lrt $link_libasan"
+link_libtsan="-lrt $link_libtsan"
+# Other sanitizers do not override clock_* API
+])
+
 case "$host" in
-  *-*-darwin*) MAC_INTERPOSE=true ; enable_static=no ; CXX_ABI_NEEDED=true ;;
-  *) MAC_INTERPOSE=false ; CXX_ABI_NEEDED=false ;;
+  *-*-darwin*) MAC_INTERPOSE=true ; enable_static=no ;;
+  *) MAC_INTERPOSE=false ;;
 esac
 AM_CONDITIONAL(USING_MAC_INTERPOSE, $MAC_INTERPOSE)
-AM_CONDITIONAL(USE_CXX_ABI_FLAG, $CXX_ABI_NEEDED)
 
 backtrace_supported=yes
 
@@ -356,5 +375,9 @@ _EOF
 fi
 
 AC_SUBST([TSAN_TARGET_DEPENDENT_OBJECTS])
+AC_SUBST([SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS])
+
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
 
 AC_OUTPUT