aboutsummaryrefslogtreecommitdiff
path: root/libsanitizer
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2023-11-28 14:54:34 +0100
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2023-11-28 14:54:34 +0100
commit088d3cbc5f906444a7dee98bc9a6f4b724ddfc21 (patch)
treeef1a523363cc1a1fe6484ceb4872a98ce7512527 /libsanitizer
parent099b15e2bdb78c21ad3f9001af77072413f4e159 (diff)
downloadgcc-088d3cbc5f906444a7dee98bc9a6f4b724ddfc21.zip
gcc-088d3cbc5f906444a7dee98bc9a6f4b724ddfc21.tar.gz
gcc-088d3cbc5f906444a7dee98bc9a6f4b724ddfc21.tar.bz2
libsanitizer: Check assembler support for symbol assignment [PR112563]
The recent libsanitizer import broke the build on Solaris/SPARC with the native as: /usr/ccs/bin/as: ".libs/sanitizer_errno.s", line 4247: error: symbol "__sanitizer_internal_memset" is used but not defined /usr/ccs/bin/as: ".libs/sanitizer_errno.s", line 4247: error: symbol "__sanitizer_internal_memcpy" is used but not defined /usr/ccs/bin/as: ".libs/sanitizer_errno.s", line 4247: error: symbol "__sanitizer_internal_memmove" is used but not defined Since none of the alternatives considered in the PR worked out, this patch checks if the assembler does support symbol assignment, disabling the code otherwise. This returns the code to the way it was up to LLVM 16. Bootstrapped without regressions on sparc-sun-solaris2.11 (as and gas) and i386-pc-solaris2.11 (as and gas). 2023-11-23 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> libsanitizer: PR sanitizer/112563 * configure.ac (libsanitizer_cv_as_sym_assign): Check for assembler symbol assignment support. * configure: Regenerate. * asan/Makefile.am (DEFS): Add @AS_SYM_ASSIGN_DEFS@. * Makefile.in, asan/Makefile.in, hwasan/Makefile.in, interception/Makefile.in, libbacktrace/Makefile.in, lsan/Makefile.in, sanitizer_common/Makefile.in, tsan/Makefile.in, ubsan/Makefile.in: Regenerate.
Diffstat (limited to 'libsanitizer')
-rw-r--r--libsanitizer/Makefile.in1
-rw-r--r--libsanitizer/asan/Makefile.am2
-rw-r--r--libsanitizer/asan/Makefile.in3
-rwxr-xr-xlibsanitizer/configure37
-rw-r--r--libsanitizer/configure.ac13
-rw-r--r--libsanitizer/hwasan/Makefile.in1
-rw-r--r--libsanitizer/interception/Makefile.in1
-rw-r--r--libsanitizer/libbacktrace/Makefile.in1
-rw-r--r--libsanitizer/lsan/Makefile.in1
-rw-r--r--libsanitizer/sanitizer_common/Makefile.in1
-rw-r--r--libsanitizer/tsan/Makefile.in1
-rw-r--r--libsanitizer/ubsan/Makefile.in1
12 files changed, 59 insertions, 4 deletions
diff --git a/libsanitizer/Makefile.in b/libsanitizer/Makefile.in
index 65e7f2e..f11219ca 100644
--- a/libsanitizer/Makefile.in
+++ b/libsanitizer/Makefile.in
@@ -214,6 +214,7 @@ ALLOC_FILE = @ALLOC_FILE@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
+AS_SYM_ASSIGN_DEFS = @AS_SYM_ASSIGN_DEFS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
diff --git a/libsanitizer/asan/Makefile.am b/libsanitizer/asan/Makefile.am
index 223d3e0..6af250e 100644
--- a/libsanitizer/asan/Makefile.am
+++ b/libsanitizer/asan/Makefile.am
@@ -3,7 +3,7 @@ AM_CPPFLAGS = -I $(top_srcdir)/include -I $(top_srcdir)
# May be used by toolexeclibdir.
gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
-DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DASAN_HAS_EXCEPTIONS=1 -DASAN_NEEDS_SEGV=1 -DCAN_SANITIZE_UB=0 -DASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION=0
+DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DASAN_HAS_EXCEPTIONS=1 -DASAN_NEEDS_SEGV=1 -DCAN_SANITIZE_UB=0 -DASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION=0 @AS_SYM_ASSIGN_DEFS@
if USING_MAC_INTERPOSE
DEFS += -DMAC_INTERPOSE_FUNCTIONS -DMISSING_BLOCKS_SUPPORT
endif
diff --git a/libsanitizer/asan/Makefile.in b/libsanitizer/asan/Makefile.in
index e88e5e0..ac72e13 100644
--- a/libsanitizer/asan/Makefile.in
+++ b/libsanitizer/asan/Makefile.in
@@ -264,6 +264,7 @@ ALLOC_FILE = @ALLOC_FILE@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
+AS_SYM_ASSIGN_DEFS = @AS_SYM_ASSIGN_DEFS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@@ -288,7 +289,7 @@ DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS \
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS \
-DASAN_HAS_EXCEPTIONS=1 -DASAN_NEEDS_SEGV=1 \
-DCAN_SANITIZE_UB=0 -DASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION=0 \
- $(am__append_1)
+ @AS_SYM_ASSIGN_DEFS@ $(am__append_1)
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
diff --git a/libsanitizer/configure b/libsanitizer/configure
index 2edd5c3..6bfd289 100755
--- a/libsanitizer/configure
+++ b/libsanitizer/configure
@@ -651,6 +651,7 @@ ALLOC_FILE
VIEW_FILE
BACKTRACE_SUPPORTED
FORMAT_FILE
+AS_SYM_ASSIGN_DEFS
SANITIZER_SUPPORTED_FALSE
SANITIZER_SUPPORTED_TRUE
USING_MAC_INTERPOSE_FALSE
@@ -12474,7 +12475,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12477 "configure"
+#line 12478 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12580,7 +12581,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12583 "configure"
+#line 12584 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -16333,6 +16334,38 @@ $as_echo "#define HAVE_ATOMIC_FUNCTIONS 1" >>confdefs.h
fi
+# Check if assembler supports symbol assignment.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler symbol assignment" >&5
+$as_echo_n "checking assembler symbol assignment... " >&6; }
+if ${libsanitizer_cv_as_sym_assign+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+asm("a = b");
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ libsanitizer_cv_as_sym_assign=yes
+else
+ libsanitizer_cv_as_sym_assign=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libsanitizer_cv_as_sym_assign" >&5
+$as_echo "$libsanitizer_cv_as_sym_assign" >&6; }
+if test "$libsanitizer_cv_as_sym_assign" = "yes"; then
+ as_sym_assign_defs=-DHAVE_AS_SYM_ASSIGN=1
+fi
+AS_SYM_ASSIGN_DEFS=$as_sym_assign_defs
+
+
# The library needs to be able to read the executable itself. Compile
# a file to determine the executable format. The awk script
# filetype.awk prints out the file type.
diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
index 5906c8d..8037c94 100644
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -214,6 +214,19 @@ if test "$libsanitizer_cv_sys_atomic" = "yes"; then
[Define to 1 if you have the __atomic functions])
fi
+# Check if assembler supports symbol assignment.
+AC_CACHE_CHECK([assembler symbol assignment],
+[libsanitizer_cv_as_sym_assign],
+[AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([],
+ [asm("a = b");])],
+ [libsanitizer_cv_as_sym_assign=yes],
+ [libsanitizer_cv_as_sym_assign=no])])
+if test "$libsanitizer_cv_as_sym_assign" = "yes"; then
+ as_sym_assign_defs=-DHAVE_AS_SYM_ASSIGN=1
+fi
+AC_SUBST(AS_SYM_ASSIGN_DEFS, [$as_sym_assign_defs])
+
# The library needs to be able to read the executable itself. Compile
# a file to determine the executable format. The awk script
# filetype.awk prints out the file type.
diff --git a/libsanitizer/hwasan/Makefile.in b/libsanitizer/hwasan/Makefile.in
index 87971fd..4420bd6 100644
--- a/libsanitizer/hwasan/Makefile.in
+++ b/libsanitizer/hwasan/Makefile.in
@@ -260,6 +260,7 @@ ALLOC_FILE = @ALLOC_FILE@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
+AS_SYM_ASSIGN_DEFS = @AS_SYM_ASSIGN_DEFS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
diff --git a/libsanitizer/interception/Makefile.in b/libsanitizer/interception/Makefile.in
index 85dd386..2d807c9 100644
--- a/libsanitizer/interception/Makefile.in
+++ b/libsanitizer/interception/Makefile.in
@@ -186,6 +186,7 @@ ALLOC_FILE = @ALLOC_FILE@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
+AS_SYM_ASSIGN_DEFS = @AS_SYM_ASSIGN_DEFS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
diff --git a/libsanitizer/libbacktrace/Makefile.in b/libsanitizer/libbacktrace/Makefile.in
index c0243fa..33faa78 100644
--- a/libsanitizer/libbacktrace/Makefile.in
+++ b/libsanitizer/libbacktrace/Makefile.in
@@ -236,6 +236,7 @@ ALLOC_FILE = @ALLOC_FILE@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
+AS_SYM_ASSIGN_DEFS = @AS_SYM_ASSIGN_DEFS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
diff --git a/libsanitizer/lsan/Makefile.in b/libsanitizer/lsan/Makefile.in
index 078edf0..0870f9e7 100644
--- a/libsanitizer/lsan/Makefile.in
+++ b/libsanitizer/lsan/Makefile.in
@@ -231,6 +231,7 @@ ALLOC_FILE = @ALLOC_FILE@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
+AS_SYM_ASSIGN_DEFS = @AS_SYM_ASSIGN_DEFS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
diff --git a/libsanitizer/sanitizer_common/Makefile.in b/libsanitizer/sanitizer_common/Makefile.in
index 881df60..4514193 100644
--- a/libsanitizer/sanitizer_common/Makefile.in
+++ b/libsanitizer/sanitizer_common/Makefile.in
@@ -224,6 +224,7 @@ ALLOC_FILE = @ALLOC_FILE@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
+AS_SYM_ASSIGN_DEFS = @AS_SYM_ASSIGN_DEFS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
diff --git a/libsanitizer/tsan/Makefile.in b/libsanitizer/tsan/Makefile.in
index fc14a42..5cc6f95 100644
--- a/libsanitizer/tsan/Makefile.in
+++ b/libsanitizer/tsan/Makefile.in
@@ -260,6 +260,7 @@ ALLOC_FILE = @ALLOC_FILE@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
+AS_SYM_ASSIGN_DEFS = @AS_SYM_ASSIGN_DEFS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
diff --git a/libsanitizer/ubsan/Makefile.in b/libsanitizer/ubsan/Makefile.in
index 7e51480e..717d157 100644
--- a/libsanitizer/ubsan/Makefile.in
+++ b/libsanitizer/ubsan/Makefile.in
@@ -225,6 +225,7 @@ ALLOC_FILE = @ALLOC_FILE@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
+AS_SYM_ASSIGN_DEFS = @AS_SYM_ASSIGN_DEFS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@