Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src updates for GCC 6.4:



details:   https://anonhg.NetBSD.org/src/rev/2787bbb09cdf
branches:  trunk
changeset: 829513:2787bbb09cdf
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Feb 04 20:22:17 2018 +0000

description:
updates for GCC 6.4:

- remove many _DIAGASSERT() checks against not NULL for functions
  with arguments with nonnull attributes.  (probably more to come,
  the set between x86 and sparc us disjoint.)

- port libsanitizer's GetPcSpBp() to sparc, sparc64 and amd64.

diffstat:

 common/lib/libc/string/bcopy.c                                          |   6 +-
 common/lib/libc/string/memchr.c                                         |   5 +-
 common/lib/libc/string/memcmp.c                                         |   6 +--
 common/lib/libc/string/strcat.c                                         |   5 +-
 common/lib/libc/string/strchr.c                                         |   5 +-
 common/lib/libc/string/strcmp.c                                         |   7 +---
 common/lib/libc/string/strcpy.c                                         |   7 +---
 common/lib/libc/string/strncmp.c                                        |   7 +---
 common/lib/libc/string/strrchr.c                                        |   6 +--
 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc |  16 +++++++++-
 external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h              |   3 +-
 11 files changed, 36 insertions(+), 37 deletions(-)

diffs (289 lines):

diff -r 490fdfd06f3f -r 2787bbb09cdf common/lib/libc/string/bcopy.c
--- a/common/lib/libc/string/bcopy.c    Sun Feb 04 18:32:31 2018 +0000
+++ b/common/lib/libc/string/bcopy.c    Sun Feb 04 20:22:17 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcopy.c,v 1.11 2014/04/16 20:39:55 joerg Exp $ */
+/*     $NetBSD: bcopy.c,v 1.12 2018/02/04 20:22:17 mrg Exp $   */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)bcopy.c    8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: bcopy.c,v 1.11 2014/04/16 20:39:55 joerg Exp $");
+__RCSID("$NetBSD: bcopy.c,v 1.12 2018/02/04 20:22:17 mrg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -89,7 +89,7 @@
        unsigned long u;
 
 #if !defined(_KERNEL)
-       _DIAGASSERT((dst0 && src0) || length == 0);
+       _DIAGASSERT(length == 0);
 #endif
 
        if (length == 0 || dst == src)          /* nothing to do */
diff -r 490fdfd06f3f -r 2787bbb09cdf common/lib/libc/string/memchr.c
--- a/common/lib/libc/string/memchr.c   Sun Feb 04 18:32:31 2018 +0000
+++ b/common/lib/libc/string/memchr.c   Sun Feb 04 20:22:17 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: memchr.c,v 1.3 2008/01/08 21:57:06 martin Exp $        */
+/*     $NetBSD: memchr.c,v 1.4 2018/02/04 20:22:17 mrg Exp $   */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)memchr.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: memchr.c,v 1.3 2008/01/08 21:57:06 martin Exp $");
+__RCSID("$NetBSD: memchr.c,v 1.4 2018/02/04 20:22:17 mrg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -51,7 +51,6 @@
 void *
 memchr(const void *s, int c, size_t n)
 {
-       _DIAGASSERT(s != NULL);
 
        if (n != 0) {
                const unsigned char *p = s;
diff -r 490fdfd06f3f -r 2787bbb09cdf common/lib/libc/string/memcmp.c
--- a/common/lib/libc/string/memcmp.c   Sun Feb 04 18:32:31 2018 +0000
+++ b/common/lib/libc/string/memcmp.c   Sun Feb 04 20:22:17 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: memcmp.c,v 1.4 2013/12/02 21:21:33 joerg Exp $ */
+/*     $NetBSD: memcmp.c,v 1.5 2018/02/04 20:22:17 mrg Exp $   */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)memcmp.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: memcmp.c,v 1.4 2013/12/02 21:21:33 joerg Exp $");
+__RCSID("$NetBSD: memcmp.c,v 1.5 2018/02/04 20:22:17 mrg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -55,8 +55,6 @@
 int
 memcmp(const void *s1, const void *s2, size_t n)
 {
-       _DIAGASSERT(s1 != 0);
-       _DIAGASSERT(s2 != 0);
 
        if (n != 0) {
                const unsigned char *p1 = s1, *p2 = s2;
diff -r 490fdfd06f3f -r 2787bbb09cdf common/lib/libc/string/strcat.c
--- a/common/lib/libc/string/strcat.c   Sun Feb 04 18:32:31 2018 +0000
+++ b/common/lib/libc/string/strcat.c   Sun Feb 04 20:22:17 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: strcat.c,v 1.2 2007/06/04 18:19:27 christos Exp $      */
+/*     $NetBSD: strcat.c,v 1.3 2018/02/04 20:22:17 mrg Exp $   */
 
 /*
  * Copyright (c) 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)strcat.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: strcat.c,v 1.2 2007/06/04 18:19:27 christos Exp $");
+__RCSID("$NetBSD: strcat.c,v 1.3 2018/02/04 20:22:17 mrg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -55,7 +55,6 @@
        char    *t = s;
 
        _DIAGASSERT(t != NULL);
-       _DIAGASSERT(append != NULL);
 
        for (; *t; ++t)
                ;
diff -r 490fdfd06f3f -r 2787bbb09cdf common/lib/libc/string/strchr.c
--- a/common/lib/libc/string/strchr.c   Sun Feb 04 18:32:31 2018 +0000
+++ b/common/lib/libc/string/strchr.c   Sun Feb 04 20:22:17 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: strchr.c,v 1.5 2011/08/31 15:48:32 plunky Exp $        */
+/*     $NetBSD: strchr.c,v 1.6 2018/02/04 20:22:17 mrg Exp $   */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)index.c    8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: strchr.c,v 1.5 2011/08/31 15:48:32 plunky Exp $");
+__RCSID("$NetBSD: strchr.c,v 1.6 2018/02/04 20:22:17 mrg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -51,7 +51,6 @@
 strchr(const char *p, int ch)
 {
        const char cmp = ch;
-       _DIAGASSERT(p != NULL);
 
        for (;; ++p) {
                if (*p == cmp) {
diff -r 490fdfd06f3f -r 2787bbb09cdf common/lib/libc/string/strcmp.c
--- a/common/lib/libc/string/strcmp.c   Sun Feb 04 18:32:31 2018 +0000
+++ b/common/lib/libc/string/strcmp.c   Sun Feb 04 20:22:17 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: strcmp.c,v 1.3 2013/07/01 20:51:59 joerg Exp $ */
+/*     $NetBSD: strcmp.c,v 1.4 2018/02/04 20:22:17 mrg Exp $   */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)strcmp.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: strcmp.c,v 1.3 2013/07/01 20:51:59 joerg Exp $");
+__RCSID("$NetBSD: strcmp.c,v 1.4 2018/02/04 20:22:17 mrg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -57,9 +57,6 @@
 strcmp(const char *s1, const char *s2)
 {
 
-       _DIAGASSERT(s1 != NULL);
-       _DIAGASSERT(s2 != NULL);
-
        while (*s1 == *s2++)
                if (*s1++ == 0)
                        return (0);
diff -r 490fdfd06f3f -r 2787bbb09cdf common/lib/libc/string/strcpy.c
--- a/common/lib/libc/string/strcpy.c   Sun Feb 04 18:32:31 2018 +0000
+++ b/common/lib/libc/string/strcpy.c   Sun Feb 04 20:22:17 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: strcpy.c,v 1.3 2011/11/08 16:52:11 joerg Exp $ */
+/*     $NetBSD: strcpy.c,v 1.4 2018/02/04 20:22:17 mrg Exp $   */
 
 /*
  * Copyright (c) 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)strcpy.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: strcpy.c,v 1.3 2011/11/08 16:52:11 joerg Exp $");
+__RCSID("$NetBSD: strcpy.c,v 1.4 2018/02/04 20:22:17 mrg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -52,9 +52,6 @@
 {
        char *save = to;
 
-       _DIAGASSERT(to != NULL);
-       _DIAGASSERT(from != NULL);
-
        for (; (*to = *from) != '\0'; ++from, ++to);
        return(save);
 }
diff -r 490fdfd06f3f -r 2787bbb09cdf common/lib/libc/string/strncmp.c
--- a/common/lib/libc/string/strncmp.c  Sun Feb 04 18:32:31 2018 +0000
+++ b/common/lib/libc/string/strncmp.c  Sun Feb 04 20:22:17 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: strncmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $     */
+/*     $NetBSD: strncmp.c,v 1.3 2018/02/04 20:22:17 mrg Exp $  */
 
 /*
  * Copyright (c) 1989, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)strncmp.c  8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: strncmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $");
+__RCSID("$NetBSD: strncmp.c,v 1.3 2018/02/04 20:22:17 mrg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -49,9 +49,6 @@
 strncmp(const char *s1, const char *s2, size_t n)
 {
 
-       _DIAGASSERT(s1 != NULL);
-       _DIAGASSERT(s2 != NULL);
-
        if (n == 0)
                return (0);
        do {
diff -r 490fdfd06f3f -r 2787bbb09cdf common/lib/libc/string/strrchr.c
--- a/common/lib/libc/string/strrchr.c  Sun Feb 04 18:32:31 2018 +0000
+++ b/common/lib/libc/string/strrchr.c  Sun Feb 04 20:22:17 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: strrchr.c,v 1.5 2009/07/17 19:37:57 dsl Exp $  */
+/*     $NetBSD: strrchr.c,v 1.6 2018/02/04 20:22:17 mrg Exp $  */
 
 /*
  * Copyright (c) 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)rindex.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: strrchr.c,v 1.5 2009/07/17 19:37:57 dsl Exp $");
+__RCSID("$NetBSD: strrchr.c,v 1.6 2018/02/04 20:22:17 mrg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -52,8 +52,6 @@
        char *save;
        const char c = ch;
 
-       _DIAGASSERT(p != NULL);
-
        for (save = NULL;; ++p) {
                if (*p == c) {
                        /* LINTED const cast-away */
diff -r 490fdfd06f3f -r 2787bbb09cdf external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc
--- a/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc   Sun Feb 04 18:32:31 2018 +0000
+++ b/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc   Sun Feb 04 20:22:17 2018 +0000
@@ -1161,6 +1161,11 @@
   *pc = ucontext->uc_mcontext.mc_rip;
   *bp = ucontext->uc_mcontext.mc_rbp;
   *sp = ucontext->uc_mcontext.mc_rsp;
+# elif SANITIZER_NETBSD
+  ucontext_t *ucontext = (ucontext_t*)context;
+  *pc = ucontext->uc_mcontext.__gregs[_REG_RIP];
+  *bp = ucontext->uc_mcontext.__gregs[_REG_RBP];
+  *sp = ucontext->uc_mcontext.__gregs[_REG_RSP];
 # else
   ucontext_t *ucontext = (ucontext_t*)context;
   *pc = ucontext->uc_mcontext.gregs[REG_RIP];
@@ -1194,7 +1199,16 @@
 #elif defined(__sparc__)
   ucontext_t *ucontext = (ucontext_t*)context;
   uptr *stk_ptr;
-# if defined (__arch64__)
+# if SANITIZER_NETBSD
+  *pc = _UC_MACHINE_PC(ucontext);
+  *sp = _UC_MACHINE_SP(ucontext);
+#  if defined (__arch64__)
+  stk_ptr = (uptr *) (*sp + 2047);
+#  else
+  stk_ptr = (uptr *) *sp;
+#  endif
+  *bp = stk_ptr[15];
+# elif defined (__arch64__)
   *pc = ucontext->uc_mcontext.mc_gregs[MC_PC];
   *sp = ucontext->uc_mcontext.mc_gregs[MC_O6];
   stk_ptr = (uptr *) (*sp + 2047);
diff -r 490fdfd06f3f -r 2787bbb09cdf external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h
--- a/external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h        Sun Feb 04 18:32:31 2018 +0000
+++ b/external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_platform.h        Sun Feb 04 20:22:17 2018 +0000
@@ -16,7 +16,8 @@
 #if (defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
      defined(__APPLE__)) && \
     (defined(__x86_64__) || defined(__i386__) || defined(__arm__) || \
-     defined(__aarch64__) || defined(__mips__) || defined(__powerpc64__))
+     defined(__aarch64__) || defined(__mips__) || defined(__powerpc64__) || \
+     defined(__sparc__))
 # define CAN_SANITIZE_UB 1
 #elif defined(_WIN32)
 # define CAN_SANITIZE_UB 1



Home | Main Index | Thread Index | Old Index