Update libsanitizer obstack interceptors
authorAlan Modra <amodra@gmail.com>
Mon, 9 Nov 2015 04:23:25 +0000 (14:53 +1030)
committerAlan Modra <amodra@gcc.gnu.org>
Mon, 9 Nov 2015 04:23:25 +0000 (14:53 +1030)
New obstack uses sensible types, size_t instead of int for length
params.  Since libsanitizer does not use prototypes from obstack.h to
call the real functions, it's necessary to update the libsanitizer
function declarations emitted by the INTERCEPTOR macro.

* sanitizer_common/sanitizer_common_interceptors.inc: Update size
params for _obstack_begin_1, _obstack_begin, _obstack_newchunk
interceptors.
* configure.ac: Substitute OBSTACK_DEFS.
* asan/Makefile.am: Add OBSTACK_DEFS to DEFS.
* tsan/Makefile.am: Likewise.
* configure: Regenerate.
* Makefile.in: Regenerate.
* asan/Makefile.in: Regenerate.
* interception/Makefile.in: Regenerate.
* libbacktrace/Makefile.in: Regenerate.
* lsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.in: Regenerate.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.in: Regenerate.

From-SVN: r229986

14 files changed:
libsanitizer/ChangeLog
libsanitizer/Makefile.in
libsanitizer/asan/Makefile.am
libsanitizer/asan/Makefile.in
libsanitizer/configure
libsanitizer/configure.ac
libsanitizer/interception/Makefile.in
libsanitizer/libbacktrace/Makefile.in
libsanitizer/lsan/Makefile.in
libsanitizer/sanitizer_common/Makefile.in
libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
libsanitizer/tsan/Makefile.am
libsanitizer/tsan/Makefile.in
libsanitizer/ubsan/Makefile.in

index f105e47b9f0537988c28f1d3b187bcf5a0c046e4..7de18c88eaf1e7a1e2e36ef52ed891f0840fc09c 100644 (file)
@@ -1,3 +1,21 @@
+2015-11-09  Alan Modra  <amodra@gmail.com>
+
+       * sanitizer_common/sanitizer_common_interceptors.inc: Update size
+       params for _obstack_begin_1, _obstack_begin, _obstack_newchunk
+       interceptors.
+       * configure.ac: Substitute OBSTACK_DEFS.
+       * asan/Makefile.am: Add OBSTACK_DEFS to DEFS.
+       * tsan/Makefile.am: Likewise.
+       * configure: Regenerate.
+       * Makefile.in: Regenerate.
+       * asan/Makefile.in: Regenerate.
+       * interception/Makefile.in: Regenerate.
+       * libbacktrace/Makefile.in: Regenerate.
+       * lsan/Makefile.in: Regenerate.
+       * sanitizer_common/Makefile.in: Regenerate.
+       * tsan/Makefile.in: Regenerate.
+       * ubsan/Makefile.in: Regenerate.
+
 2015-10-22  Maxim Ostapenko  <m.ostapenko@partner.samsung.com>
 
        PR bootstrap/68041
index 1278900c0d43130227d480c8423cd1b1fa02cccf..b362a897fd101d27e71016cfaf39f601207eca97 100644 (file)
@@ -198,6 +198,7 @@ NM = @NM@
 NMEDIT = @NMEDIT@
 OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OBSTACK_DEFS = @OBSTACK_DEFS@
 OTOOL = @OTOOL@
 OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
index bd3cd735a982392249619873e3745f46b9983eaa..4500e2130da7685aa62b606211ded946fa252e54 100644 (file)
@@ -3,7 +3,7 @@ AM_CPPFLAGS = -I $(top_srcdir)/include -I $(top_srcdir)
 # May be used by toolexeclibdir.
 gcc_version := $(shell cat $(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
+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 @OBSTACK_DEFS@
 if USING_MAC_INTERPOSE
 DEFS += -DMAC_INTERPOSE_FUNCTIONS -DMISSING_BLOCKS_SUPPORT
 endif
index 229c7b400d1094b85868dc5aedb19a2620d05154..881d1d394d5be0ff93626b4b3a9ba6ed2ff0054a 100644 (file)
@@ -173,7 +173,7 @@ CYGPATH_W = @CYGPATH_W@
 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 $(am__append_1)
+       -DCAN_SANITIZE_UB=0 @OBSTACK_DEFS@ $(am__append_1)
 DEPDIR = @DEPDIR@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
@@ -207,6 +207,7 @@ NM = @NM@
 NMEDIT = @NMEDIT@
 OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OBSTACK_DEFS = @OBSTACK_DEFS@
 OTOOL = @OTOOL@
 OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
index 2701ee7a8ee0a1423810a43c1867b661e5f5f65b..a0fc860bfce86f99c147135c7d3f2355d311cce7 100755 (executable)
@@ -607,6 +607,7 @@ LIBOBJS
 TSAN_TARGET_DEPENDENT_OBJECTS
 LIBBACKTRACE_SUPPORTED_FALSE
 LIBBACKTRACE_SUPPORTED_TRUE
+OBSTACK_DEFS
 RPC_DEFS
 BACKTRACE_SUPPORTS_THREADS
 BACKTRACE_USES_MALLOC
@@ -12027,7 +12028,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12030 "configure"
+#line 12031 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12133,7 +12134,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12136 "configure"
+#line 12137 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
 RPC_DEFS=$rpc_defs
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking obstack params" >&5
+$as_echo_n "checking obstack params... " >&6; }
+if test "${libsanitizer_cv_sys_obstack+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_cppflags=$CPPFLAGS
+CPPFLAGS="-I${srcdir}/../include -o conftest.iii $CPPFLAGS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include "obstack.h"
+#ifdef _OBSTACK_SIZE_T
+_OBSTACK_SIZE_T
+#else
+int
+#endif
+
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  libsanitizer_cv_sys_obstack=`sed -e '/^#/d;/^[        ]*$/d' conftest.iii | sed -e '$!d;s/size_t/SIZE_T/'`
+else
+  libsanitizer_cv_sys_obstack=int
+fi
+rm -f conftest.err conftest.$ac_ext
+CPPFLAGS=$save_cppflags
+rm -f conftest.iii
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libsanitizer_cv_sys_obstack" >&5
+$as_echo "$libsanitizer_cv_sys_obstack" >&6; }
+OBSTACK_DEFS=-D_OBSTACK_SIZE_T=\"$libsanitizer_cv_sys_obstack\"
+
+
  if test "x${BACKTRACE_SUPPORTED}x${BACKTRACE_USES_MALLOC}" = "x1x0"; then
   LIBBACKTRACE_SUPPORTED_TRUE=
   LIBBACKTRACE_SUPPORTED_FALSE='#'
index 81fd46d2980ae41c121051e71c630f2a31951c01..72b13a10367137d500cbfe25f0b4f4557db36c7a 100644 (file)
@@ -335,6 +335,30 @@ fi
 
 AC_SUBST([RPC_DEFS], [$rpc_defs])
 
+dnl If this file is processed by autoconf-2.67 or later then the CPPFLAGS
+dnl "-o conftest.iii" can disappear, conftest.iii be replaced with
+dnl conftest.i in the sed command line, and the rm deleted.
+dnl Not all cpp's accept -o, and gcc -E does not accept a second file
+dnl argument as the output file.
+AC_CACHE_CHECK([obstack params],
+[libsanitizer_cv_sys_obstack],
+[save_cppflags=$CPPFLAGS
+CPPFLAGS="-I${srcdir}/../include -o conftest.iii $CPPFLAGS"
+AC_PREPROC_IFELSE([AC_LANG_SOURCE([
+#include "obstack.h"
+#ifdef _OBSTACK_SIZE_T
+_OBSTACK_SIZE_T
+#else
+int
+#endif
+])],
+[libsanitizer_cv_sys_obstack=`sed -e '/^#/d;/^[         ]*$/d' conftest.iii | sed -e '$!d;s/size_t/SIZE_T/'`],
+[libsanitizer_cv_sys_obstack=int])
+CPPFLAGS=$save_cppflags
+rm -f conftest.iii
+])
+AC_SUBST([OBSTACK_DEFS], [-D_OBSTACK_SIZE_T=\"$libsanitizer_cv_sys_obstack\"])
+
 AM_CONDITIONAL(LIBBACKTRACE_SUPPORTED,
               [test "x${BACKTRACE_SUPPORTED}x${BACKTRACE_USES_MALLOC}" = "x1x0"])
 
index 3dfa7746779e76e6af0d8e97e977e62a1cec4a45..c7ccb51a177fa55aa76b932201f9add145ab8ddb 100644 (file)
@@ -157,6 +157,7 @@ NM = @NM@
 NMEDIT = @NMEDIT@
 OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OBSTACK_DEFS = @OBSTACK_DEFS@
 OTOOL = @OTOOL@
 OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
index ff37a81e4eca703f334204df680ead8eb3af9bd5..57eaaf0f3cf287a4999844c37305f2ae7e3bbb36 100644 (file)
@@ -199,6 +199,7 @@ NM = @NM@
 NMEDIT = @NMEDIT@
 OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OBSTACK_DEFS = @OBSTACK_DEFS@
 OTOOL = @OTOOL@
 OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
index b02c3736a4902b9e3c9cb646c1a9cdc81698dd59..4802ed43971ba4f3fafcad172439b5885c6693cd 100644 (file)
@@ -198,6 +198,7 @@ NM = @NM@
 NMEDIT = @NMEDIT@
 OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OBSTACK_DEFS = @OBSTACK_DEFS@
 OTOOL = @OTOOL@
 OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
index 4b008ad7ae6217bae274b2578d5de62df17a7fa6..765efd186d38aeceb448b028bbdaac1983f52214 100644 (file)
@@ -186,6 +186,7 @@ NM = @NM@
 NMEDIT = @NMEDIT@
 OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OBSTACK_DEFS = @OBSTACK_DEFS@
 OTOOL = @OTOOL@
 OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
index 9b8c77e690132f7d3da3efff529722ac6b61241e..92b90278d2dfadb9b601194cebcfb7693286f9f2 100644 (file)
@@ -4874,8 +4874,9 @@ static void initialize_obstack(__sanitizer_obstack *obstack) {
                                         sizeof(*obstack->chunk));
 }
 
-INTERCEPTOR(int, _obstack_begin_1, __sanitizer_obstack *obstack, int sz,
-            int align, void *(*alloc_fn)(uptr arg, uptr sz),
+INTERCEPTOR(int, _obstack_begin_1, __sanitizer_obstack *obstack,
+            _OBSTACK_SIZE_T sz, _OBSTACK_SIZE_T align,
+            void *(*alloc_fn)(uptr arg, SIZE_T sz),
             void (*free_fn)(uptr arg, void *p)) {
   void *ctx;
   COMMON_INTERCEPTOR_ENTER(ctx, _obstack_begin_1, obstack, sz, align, alloc_fn,
@@ -4884,8 +4885,10 @@ INTERCEPTOR(int, _obstack_begin_1, __sanitizer_obstack *obstack, int sz,
   if (res) initialize_obstack(obstack);
   return res;
 }
-INTERCEPTOR(int, _obstack_begin, __sanitizer_obstack *obstack, int sz,
-            int align, void *(*alloc_fn)(uptr sz), void (*free_fn)(void *p)) {
+INTERCEPTOR(int, _obstack_begin, __sanitizer_obstack *obstack,
+            _OBSTACK_SIZE_T sz, _OBSTACK_SIZE_T align,
+            void *(*alloc_fn)(SIZE_T sz),
+            void (*free_fn)(void *p)) {
   void *ctx;
   COMMON_INTERCEPTOR_ENTER(ctx, _obstack_begin, obstack, sz, align, alloc_fn,
                            free_fn);
@@ -4893,7 +4896,8 @@ INTERCEPTOR(int, _obstack_begin, __sanitizer_obstack *obstack, int sz,
   if (res) initialize_obstack(obstack);
   return res;
 }
-INTERCEPTOR(void, _obstack_newchunk, __sanitizer_obstack *obstack, int length) {
+INTERCEPTOR(void, _obstack_newchunk, __sanitizer_obstack *obstack,
+            _OBSTACK_SIZE_T length) {
   void *ctx;
   COMMON_INTERCEPTOR_ENTER(ctx, _obstack_newchunk, obstack, length);
   REAL(_obstack_newchunk)(obstack, length);
index 5c732cb50c314721c664bf6945886fce488c8322..dc22db5d44602ca1475553592b96f5c83b3f2e0f 100644 (file)
@@ -3,7 +3,7 @@ AM_CPPFLAGS = -I $(top_srcdir) -I $(top_srcdir)/include
 # May be used by toolexeclibdir.
 gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
 
-DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DCAN_SANITIZE_UB=0
+DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DCAN_SANITIZE_UB=0 @OBSTACK_DEFS@
 AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long  -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros
 AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
 AM_CXXFLAGS += -std=gnu++11
index bd196073e03fa9c3c79f805777ffb4d93187a447..6d5d2efbf577aaaec6e622fc54b72506e1a40747 100644 (file)
@@ -177,7 +177,7 @@ CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
-DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DCAN_SANITIZE_UB=0
+DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DCAN_SANITIZE_UB=0 @OBSTACK_DEFS@
 DEPDIR = @DEPDIR@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
@@ -211,6 +211,7 @@ NM = @NM@
 NMEDIT = @NMEDIT@
 OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OBSTACK_DEFS = @OBSTACK_DEFS@
 OTOOL = @OTOOL@
 OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
index 51d4da58516bcd4be6bd250df1e609002fec608e..f5b06d06d41b9ab804005eeadda513c1275a9c86 100644 (file)
@@ -196,6 +196,7 @@ NM = @NM@
 NMEDIT = @NMEDIT@
 OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OBSTACK_DEFS = @OBSTACK_DEFS@
 OTOOL = @OTOOL@
 OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@