CVS commit: src/usr.bin/make

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep 11 05:37:40 UTC 2020

Modified Files:
src/usr.bin/make: make.h

Log Message:
make(1): add missing space in source code


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/usr.bin/make/make.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.137 src/usr.bin/make/make.h:1.138
--- src/usr.bin/make/make.h:1.137	Wed Sep  2 23:42:58 2020
+++ src/usr.bin/make/make.h	Fri Sep 11 05:37:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.137 2020/09/02 23:42:58 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.138 2020/09/11 05:37:40 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -144,7 +144,7 @@ typedef unsigned char Boolean;
 #define TRUE ((unsigned char)0xFF)
 #define FALSE ((unsigned char)0x00)
 #elif defined(USE_ENUM_BOOLEAN)
-typedef enum { FALSE, TRUE} Boolean;
+typedef enum { FALSE, TRUE } Boolean;
 #else
 typedef int Boolean;
 #endif



CVS commit: src/usr.bin/make/unit-tests

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep 11 05:29:46 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: cond-op.exp cond-op.mk

Log Message:
make(1): add rationale for evaluating expression after parse error


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-op.exp
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cond-op.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/cond-op.exp
diff -u src/usr.bin/make/unit-tests/cond-op.exp:1.4 src/usr.bin/make/unit-tests/cond-op.exp:1.5
--- src/usr.bin/make/unit-tests/cond-op.exp:1.4	Fri Sep 11 05:14:21 2020
+++ src/usr.bin/make/unit-tests/cond-op.exp	Fri Sep 11 05:29:46 2020
@@ -1,7 +1,7 @@
 make: "cond-op.mk" line 45: Malformed conditional ("!word" == !word)
-make: "cond-op.mk" line 59: Malformed conditional (0 ${ERR::=evaluated})
-make: "cond-op.mk" line 63: warning: After detecting a parse error, the rest is evaluated.
-make: "cond-op.mk" line 67: Parsing continues until here.
+make: "cond-op.mk" line 70: Malformed conditional (0 ${ERR::=evaluated})
+make: "cond-op.mk" line 74: warning: After detecting a parse error, the rest is evaluated.
+make: "cond-op.mk" line 78: Parsing continues until here.
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/cond-op.mk
diff -u src/usr.bin/make/unit-tests/cond-op.mk:1.6 src/usr.bin/make/unit-tests/cond-op.mk:1.7
--- src/usr.bin/make/unit-tests/cond-op.mk:1.6	Fri Sep 11 05:12:08 2020
+++ src/usr.bin/make/unit-tests/cond-op.mk	Fri Sep 11 05:29:46 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-op.mk,v 1.6 2020/09/11 05:12:08 rillig Exp $
+# $NetBSD: cond-op.mk,v 1.7 2020/09/11 05:29:46 rillig Exp $
 #
 # Tests for operators like &&, ||, ! in .if conditions.
 #
@@ -55,7 +55,18 @@
 
 # As soon as the parser sees the '$', it knows that the condition will
 # be malformed.  Therefore there is no point in evaluating it.
-# As of 2020-09-11, that part of the condition is evaluated nevertheless.
+#
+# As of 2020-09-11, that part of the condition is evaluated nevertheless,
+# since CondParser_Expr just requests the next token, without restricting
+# the token to the expected tokens.  If the parser were to restrict the
+# valid follow tokens for the token "0" to those that can actually produce
+# a correct condition (which in this case would be comparison operators,
+# TOK_AND, TOK_OR or TOK_RPAREN), the variable expression would not have
+# to be evaluated.
+#
+# This would add a good deal of complexity to the code though, for almost
+# no benefit, especially since most expressions and conditions are side
+# effect free.
 .if 0 ${ERR::=evaluated}
 .  error
 .endif



CVS commit: src/external/gpl3/gcc

2020-09-10 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Sep 11 05:24:14 UTC 2020

Modified Files:
src/external/gpl3/gcc: README.gcc9

Log Message:
Update table for alpha, m68000, m68k, and powerpc:

- alpha is running and no regression in ATF (tests in lib/libc/sys are
  skipped due to port-alpha/55652).

- m68000 is successfully built and running at a same level as before.

- m68k (amiga, mac68k, sun3) is running and no regression in a tiny
  subset of ATF (kernel, lib/libc/{gen,sys}).

- macppc (oea) and evbppc (booke, ibm4xx) are running and no regression
  in ATF.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/gcc/README.gcc9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/README.gcc9
diff -u src/external/gpl3/gcc/README.gcc9:1.7 src/external/gpl3/gcc/README.gcc9:1.8
--- src/external/gpl3/gcc/README.gcc9:1.7	Mon Sep  7 23:47:02 2020
+++ src/external/gpl3/gcc/README.gcc9	Fri Sep 11 05:24:14 2020
@@ -1,4 +1,4 @@
-$NetBSD: README.gcc9,v 1.7 2020/09/07 23:47:02 mrg Exp $
+$NetBSD: README.gcc9,v 1.8 2020/09/11 05:24:14 rin Exp $
 
 new stuff:
 	cc1objcplus
@@ -31,7 +31,7 @@ architecture	tools	kernels	libgcc	native
 	-	---	--	--			---	
 aarch64		y	y	y	y		y		y	y	n
 aarch64be	y	y	y	y		?		?	?	n
-alpha		y	y	y	y		y		?	?	?
+alpha		y	y	y	y		y		y	y[10]	n
 earmv4		y	y	y	y		y		?	?	?
 earmv4eb	y	n	n	y		n		?	?	?
 earm		y	n	n	y		n		?	?	?
@@ -49,13 +49,13 @@ earmv7hfeb	y	n	n	y		n		?	?	?
 hppa		y	y	y	y		y		?	?	?
 i386		y	y	y	y		y		y	y	n
 ia64		y	y	y	y		y		y	N/A	n
-m68000		y	n	n	y		n[7]		n	?	?
-m68k		y	y	y	y		y		y	?	?
+m68000		y	y	y	y		y		y	?	n
+m68k		y	y	y	y		y		y	y[11]	n
 mipseb		y	y	y	y		y[3]		n	n	?
 mipsel		y	y	y	y		y[3]		y	n	?
 mips64eb	y	y	y	y		y[3]		y	y	n
 mips64el	y	y	y	y		y[3]		n	n	?
-powerpc		y	y	y	y		y[3]		y	n	n
+powerpc		y	y	y	y		y[3]		y	y	n
 powerpc64	y	?	y	y		n[6]		?	n	?
 sh3eb		y	n	y	y		n[1]		n	n	?
 sh3el		y	n	y	y		n		n	n	?
@@ -80,9 +80,10 @@ architecture	tools	kernels	libgcc	native
 [3]: consult cpu/platform table for full data
 [4]: triggers weird xorg-server issue; perhaps related to _XSERVER64 not being present
 [6]: /usr/src/sys/compat/common/compat_util.c:116:1: internal compiler error: in rs6000_pltseq_template, at config/rs6000/rs6000.c:21977
-[7]: libstdc++ does not build
 [8]: prep floppies overflow; need to find if they are size limited
 [9]: evbarmv7-eb has dtb sets issues
+[10]: tests in lib/libc/sys are skipped; see port-alpha/55652
+[11]: at least there's no regression in kernel and lib/libc/{gen,sys}
 
 
 CPU vs platform test table (for CPUs with multiple ports).  this is "make release" or just kernels.
@@ -100,7 +101,7 @@ earmv7:		 		 	 	y[9]		y
 earmv7hf:	 		 	 	y		y
 
 		amiga		atari	cesfic	hp300		luna68k		mac68k		mvme68k		news68k		next68k		sun3	x68k
-m68k:		y		y	y	y		y		y		y		y		y		y 	y
+m68k:		r		y	y	y		y		r		y		y		y		r 	y
 
 		evbmips		emips		ews4800mips	mipsco		newsmips	sgimips
 mipseb:		y		y		y		y		y		y
@@ -113,7 +114,7 @@ mips64eb:	 		y		 
 mips64el:	y		y		y
 
 		amigappc	bebox	evbppc	ibmnws		macppc		mvmeppc		ofppc		prep		rs6000		sandpoint
-powerpc:	y		y	y	y		y		y		y		n[8]		y		y
+powerpc:	y		y	r	y		r		y		y		n[8]		y		y
 
 		evbppc		macppc		ofppc
 powerpc64:	n		?		?



CVS commit: src/usr.bin/make/unit-tests

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep 11 05:14:21 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: cond-op.exp

Log Message:
make(1): fix line numbers from test result of the previous commit


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-op.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/cond-op.exp
diff -u src/usr.bin/make/unit-tests/cond-op.exp:1.3 src/usr.bin/make/unit-tests/cond-op.exp:1.4
--- src/usr.bin/make/unit-tests/cond-op.exp:1.3	Fri Sep 11 05:12:08 2020
+++ src/usr.bin/make/unit-tests/cond-op.exp	Fri Sep 11 05:14:21 2020
@@ -1,7 +1,7 @@
 make: "cond-op.mk" line 45: Malformed conditional ("!word" == !word)
-make: "cond-op.mk" line 56: Malformed conditional (0 ${ERR::=evaluated})
-make: "cond-op.mk" line 60: warning: After detecting a parse error, the rest is evaluated.
-make: "cond-op.mk" line 64: Parsing continues until here.
+make: "cond-op.mk" line 59: Malformed conditional (0 ${ERR::=evaluated})
+make: "cond-op.mk" line 63: warning: After detecting a parse error, the rest is evaluated.
+make: "cond-op.mk" line 67: Parsing continues until here.
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1



CVS commit: src/usr.bin/make/unit-tests

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep 11 05:12:08 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: cond-op.exp cond-op.mk

Log Message:
make(1): add test for evaluation of condition after parse error


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cond-op.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-op.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/cond-op.exp
diff -u src/usr.bin/make/unit-tests/cond-op.exp:1.2 src/usr.bin/make/unit-tests/cond-op.exp:1.3
--- src/usr.bin/make/unit-tests/cond-op.exp:1.2	Fri Aug 28 14:07:51 2020
+++ src/usr.bin/make/unit-tests/cond-op.exp	Fri Sep 11 05:12:08 2020
@@ -1,5 +1,7 @@
 make: "cond-op.mk" line 45: Malformed conditional ("!word" == !word)
-make: "cond-op.mk" line 57: Parsing continues until here.
+make: "cond-op.mk" line 56: Malformed conditional (0 ${ERR::=evaluated})
+make: "cond-op.mk" line 60: warning: After detecting a parse error, the rest is evaluated.
+make: "cond-op.mk" line 64: Parsing continues until here.
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/cond-op.mk
diff -u src/usr.bin/make/unit-tests/cond-op.mk:1.5 src/usr.bin/make/unit-tests/cond-op.mk:1.6
--- src/usr.bin/make/unit-tests/cond-op.mk:1.5	Fri Sep 11 04:40:26 2020
+++ src/usr.bin/make/unit-tests/cond-op.mk	Fri Sep 11 05:12:08 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-op.mk,v 1.5 2020/09/11 04:40:26 rillig Exp $
+# $NetBSD: cond-op.mk,v 1.6 2020/09/11 05:12:08 rillig Exp $
 #
 # Tests for operators like &&, ||, ! in .if conditions.
 #
@@ -41,7 +41,7 @@
 # This condition is malformed because the '!' on the right-hand side must not
 # appear unquoted.  If any, it must be enclosed in quotes.
 # In any case, it is not interpreted as a negation of an unquoted string.
-# See CondGetString.
+# See CondParser_String.
 .if "!word" == !word
 .error
 .endif
@@ -53,6 +53,16 @@
 .error
 .endif
 
+# As soon as the parser sees the '$', it knows that the condition will
+# be malformed.  Therefore there is no point in evaluating it.
+# As of 2020-09-11, that part of the condition is evaluated nevertheless.
+.if 0 ${ERR::=evaluated}
+.  error
+.endif
+.if ${ERR:Uundefined} == evaluated
+.  warning After detecting a parse error, the rest is evaluated.
+.endif
+
 # Just in case that parsing should ever stop on the first error.
 .info Parsing continues until here.
 



CVS commit: src/usr.bin/make

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep 11 05:03:20 UTC 2020

Modified Files:
src/usr.bin/make: cond.c

Log Message:
make(1): reduce code size in CondParser_Eval


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/usr.bin/make/cond.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.125 src/usr.bin/make/cond.c:1.126
--- src/usr.bin/make/cond.c:1.125	Fri Sep 11 04:57:15 2020
+++ src/usr.bin/make/cond.c	Fri Sep 11 05:03:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.125 2020/09/11 04:57:15 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.126 2020/09/11 05:03:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.125 2020/09/11 04:57:15 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.126 2020/09/11 05:03:20 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.125 2020/09/11 04:57:15 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.126 2020/09/11 05:03:20 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -985,26 +985,15 @@ CondParser_Expr(CondParser *par, Boolean
 static CondEvalResult
 CondParser_Eval(CondParser *par, Boolean *value)
 {
+Token res = CondParser_Expr(par, TRUE);
+if (res != TOK_FALSE && res != TOK_TRUE)
+return COND_INVALID;
 
-switch (CondParser_Expr(par, TRUE)) {
-case TOK_TRUE:
-	if (CondParser_Token(par, TRUE) == TOK_EOF) {
-	*value = TRUE;
-	return COND_PARSE;
-	}
-	break;
-case TOK_FALSE:
-	if (CondParser_Token(par, TRUE) == TOK_EOF) {
-	*value = FALSE;
-	return COND_PARSE;
-	}
-	break;
-default:
-case TOK_ERROR:
-	break;
-}
+if (CondParser_Token(par, TRUE /* XXX: Why TRUE? */) != TOK_EOF)
+return COND_INVALID;
 
-return COND_INVALID;
+*value = res == TOK_TRUE;
+return COND_PARSE;
 }
 
 /* Evaluate the condition in the passed line, including any side effects from



CVS commit: src/usr.bin/make

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep 11 04:57:15 UTC 2020

Modified Files:
src/usr.bin/make: cond.c

Log Message:
make(1): use consistent naming scheme for condition parsing functions


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/usr.bin/make/cond.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.124 src/usr.bin/make/cond.c:1.125
--- src/usr.bin/make/cond.c:1.124	Fri Sep 11 04:40:26 2020
+++ src/usr.bin/make/cond.c	Fri Sep 11 04:57:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.124 2020/09/11 04:40:26 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.125 2020/09/11 04:57:15 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.124 2020/09/11 04:40:26 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.125 2020/09/11 04:57:15 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.124 2020/09/11 04:40:26 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.125 2020/09/11 04:57:15 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -140,8 +140,8 @@ __RCSID("$NetBSD: cond.c,v 1.124 2020/09
  *
  * TOK_FALSE is 0 and TOK_TRUE 1 so we can directly assign C comparisons.
  *
- * All non-terminal functions (CondE, CondF and CondT) return either
- * TOK_FALSE, TOK_TRUE, or TOK_ERROR on error.
+ * All non-terminal functions (CondParser_Expr, CondParser_Factor and
+ * CondParser_Term) return either TOK_FALSE, TOK_TRUE, or TOK_ERROR on error.
  */
 typedef enum {
 TOK_FALSE = 0, TOK_TRUE = 1, TOK_AND, TOK_OR, TOK_NOT,
@@ -154,8 +154,8 @@ typedef struct {
 Token curr;			/* Single push-back token used in parsing */
 } CondParser;
 
-static Token CondE(CondParser *par, Boolean);
-static CondEvalResult do_Cond_EvalExpression(CondParser *par, Boolean *);
+static Token CondParser_Expr(CondParser *par, Boolean);
+static CondEvalResult CondParser_Eval(CondParser *par, Boolean *value);
 
 static unsigned int cond_depth = 0;	/* current .if nesting level */
 static unsigned int cond_min_depth = 0;	/* depth at makefile open */
@@ -173,7 +173,7 @@ static unsigned int cond_min_depth = 0;	
 static Boolean lhsStrict;
 
 static int
-istoken(const char *str, const char *tok, size_t len)
+is_token(const char *str, const char *tok, size_t len)
 {
 return strncmp(str, tok, len) == 0 && !isalpha((unsigned char)str[len]);
 }
@@ -290,7 +290,7 @@ ParseFuncArg(Boolean doEval, const char 
 
 /* Test whether the given variable is defined. */
 static Boolean
-CondDoDefined(int argLen MAKE_ATTR_UNUSED, const char *arg)
+FuncDefined(int argLen MAKE_ATTR_UNUSED, const char *arg)
 {
 char *freeIt;
 Boolean result = Var_Value(arg, VAR_CMD, ) != NULL;
@@ -307,14 +307,14 @@ CondFindStrMatch(const void *string, con
 
 /* See if the given target is being made. */
 static Boolean
-CondDoMake(int argLen MAKE_ATTR_UNUSED, const char *arg)
+FuncMake(int argLen MAKE_ATTR_UNUSED, const char *arg)
 {
 return Lst_Find(create, CondFindStrMatch, arg) != NULL;
 }
 
 /* See if the given file exists. */
 static Boolean
-CondDoExists(int argLen MAKE_ATTR_UNUSED, const char *arg)
+FuncExists(int argLen MAKE_ATTR_UNUSED, const char *arg)
 {
 Boolean result;
 char *path;
@@ -335,7 +335,7 @@ CondDoExists(int argLen MAKE_ATTR_UNUSED
 
 /* See if the given node exists and is an actual target. */
 static Boolean
-CondDoTarget(int argLen MAKE_ATTR_UNUSED, const char *arg)
+FuncTarget(int argLen MAKE_ATTR_UNUSED, const char *arg)
 {
 GNode *gn;
 
@@ -346,7 +346,7 @@ CondDoTarget(int argLen MAKE_ATTR_UNUSED
 /* See if the given node exists and is an actual target with commands
  * associated with it. */
 static Boolean
-CondDoCommands(int argLen MAKE_ATTR_UNUSED, const char *arg)
+FuncCommands(int argLen MAKE_ATTR_UNUSED, const char *arg)
 {
 GNode *gn;
 
@@ -364,7 +364,7 @@ CondDoCommands(int argLen MAKE_ATTR_UNUS
  *	Returns TRUE if the conversion succeeded.
  */
 static Boolean
-CondCvtArg(const char *str, double *value)
+TryParseNumber(const char *str, double *value)
 {
 char *eptr, ech;
 unsigned long l_val;
@@ -515,16 +515,16 @@ static const struct If {
 Boolean doNot;		/* TRUE if default function should be negated */
 Boolean (*defProc)(int, const char *); /* Default function to apply */
 } ifs[] = {
-{ "def",   3, FALSE, CondDoDefined },
-{ "ndef",  4, TRUE,  CondDoDefined },
-{ "make",  4, FALSE, CondDoMake },
-{ "nmake", 5, TRUE,  CondDoMake },
-{ "",  0, FALSE, CondDoDefined },
+{ "def",   3, FALSE, FuncDefined },
+{ "ndef",  4, TRUE,  FuncDefined },
+{ "make",  4, FALSE, FuncMake },
+{ "nmake", 5, TRUE,  FuncMake },
+{ "",  0, 

CVS commit: src/usr.bin/make

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep 11 04:40:26 UTC 2020

Modified Files:
src/usr.bin/make: cond.c
src/usr.bin/make/unit-tests: cond-op.mk

Log Message:
make(1): rename CondGetString to CondParser_String

This describes the function's effect more accurately.  The verb "get" is
not commonly associated to having side effects.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/usr.bin/make/cond.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-op.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.123 src/usr.bin/make/cond.c:1.124
--- src/usr.bin/make/cond.c:1.123	Fri Sep 11 04:22:22 2020
+++ src/usr.bin/make/cond.c	Fri Sep 11 04:40:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.123 2020/09/11 04:22:22 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.124 2020/09/11 04:40:26 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.123 2020/09/11 04:22:22 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.124 2020/09/11 04:40:26 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.123 2020/09/11 04:22:22 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.124 2020/09/11 04:40:26 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -393,7 +393,7 @@ CondCvtArg(const char *str, double *valu
 
 /*-
  * Parse a string from a variable reference or an optionally quoted
- * string.  This is called for the lhs and rhs of string compares.
+ * string.  This is called for the lhs and rhs of string comparisons.
  *
  * Results:
  *	Returns the string, absent any quotes, or NULL on error.
@@ -402,8 +402,8 @@ CondCvtArg(const char *str, double *valu
  */
 /* coverity:[+alloc : arg-*3] */
 static const char *
-CondGetString(CondParser *par, Boolean doEval, Boolean *quoted, void **freeIt,
-	  Boolean strictLHS)
+CondParser_String(CondParser *par, Boolean doEval, Boolean strictLHS,
+		  Boolean *quoted, void **freeIt)
 {
 Buffer buf;
 const char *str;
@@ -545,7 +545,7 @@ compare_expression(CondParser *par, Bool
  * Parse the variable spec and skip over it, saving its
  * value in lhs.
  */
-lhs = CondGetString(par, doEval, , , lhsStrict);
+lhs = CondParser_String(par, doEval, lhsStrict, , );
 if (!lhs)
 	goto done;
 
@@ -601,7 +601,7 @@ compare_expression(CondParser *par, Bool
 	goto done;
 }
 
-rhs = CondGetString(par, doEval, , , FALSE);
+rhs = CondParser_String(par, doEval, FALSE, , );
 if (!rhs)
 	goto done;
 

Index: src/usr.bin/make/unit-tests/cond-op.mk
diff -u src/usr.bin/make/unit-tests/cond-op.mk:1.4 src/usr.bin/make/unit-tests/cond-op.mk:1.5
--- src/usr.bin/make/unit-tests/cond-op.mk:1.4	Fri Aug 28 14:07:51 2020
+++ src/usr.bin/make/unit-tests/cond-op.mk	Fri Sep 11 04:40:26 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-op.mk,v 1.4 2020/08/28 14:07:51 rillig Exp $
+# $NetBSD: cond-op.mk,v 1.5 2020/09/11 04:40:26 rillig Exp $
 #
 # Tests for operators like &&, ||, ! in .if conditions.
 #
@@ -48,7 +48,7 @@
 
 # Surprisingly, the ampersand and pipe are allowed in bare strings.
 # That's another opportunity for writing confusing code.
-# See CondGetString, which only has '!' in the list of stop characters.
+# See CondParser_String, which only has '!' in the list of stop characters.
 .if "a&||c" != a&||c
 .error
 .endif



CVS commit: src/usr.bin/make

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep 11 04:36:12 UTC 2020

Modified Files:
src/usr.bin/make: suff.c

Log Message:
make(1): rename GNodeSuff.gn to gnp

It was confusing to have a field called "gn" that was not a pointer to a
GNode, but a double-pointer to GNode instead.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/usr.bin/make/suff.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.146 src/usr.bin/make/suff.c:1.147
--- src/usr.bin/make/suff.c:1.146	Fri Sep 11 04:32:39 2020
+++ src/usr.bin/make/suff.c	Fri Sep 11 04:36:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.146 2020/09/11 04:32:39 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.147 2020/09/11 04:36:12 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.146 2020/09/11 04:32:39 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.147 2020/09/11 04:36:12 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c	8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.146 2020/09/11 04:32:39 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.147 2020/09/11 04:36:12 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -211,7 +211,7 @@ typedef struct {
 } LstSrc;
 
 typedef struct {
-GNode	  **gn;
+GNode	  **gnp;
 Suff	   *s;
 Boolean	r;
 } GNodeSuff;
@@ -761,8 +761,8 @@ SuffScanTargets(void *targetp, void *gsp
 Suff	*s, *t;
 char 	*ptr;
 
-if (*gs->gn == NULL && gs->r && (target->type & OP_NOTARGET) == 0) {
-	*gs->gn = target;
+if (*gs->gnp == NULL && gs->r && (target->type & OP_NOTARGET) == 0) {
+	*gs->gnp = target;
 	Targ_SetMain(target);
 	return 1;
 }
@@ -775,9 +775,9 @@ SuffScanTargets(void *targetp, void *gsp
 	return 0;
 
 if (SuffParseTransform(target->name, , )) {
-	if (*gs->gn == target) {
+	if (*gs->gnp == target) {
 	gs->r = TRUE;
-	*gs->gn = NULL;
+	*gs->gnp = NULL;
 	Targ_SetMain(NULL);
 	}
 	Lst_Free(target->children);
@@ -806,7 +806,7 @@ SuffScanTargets(void *targetp, void *gsp
  *	name		the name of the suffix to add
  */
 void
-Suff_AddSuffix(const char *name, GNode **gn)
+Suff_AddSuffix(const char *name, GNode **gnp)
 {
 Suff  *s;	/* new suffix descriptor */
 LstNode 	  ln;
@@ -823,7 +823,7 @@ Suff_AddSuffix(const char *name, GNode *
 	 * a suffix rule. This is ugly, but other makes treat all targets
 	 * that start with a . as suffix rules.
 	 */
-	gs.gn = gn;
+	gs.gnp = gnp;
 	gs.s  = s;
 	gs.r  = FALSE;
 	Lst_ForEach(Targ_List(), SuffScanTargets, );



CVS commit: src/usr.bin/make

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep 11 04:32:39 UTC 2020

Modified Files:
src/usr.bin/make: dir.c job.c strlist.c suff.c var.c

Log Message:
make(1): replace *a->b with a->b[0]

This allows the code to be read strictly from left to right.  In most
places this style was already used.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/usr.bin/make/dir.c
cvs rdiff -u -r1.228 -r1.229 src/usr.bin/make/job.c
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/strlist.c
cvs rdiff -u -r1.145 -r1.146 src/usr.bin/make/suff.c
cvs rdiff -u -r1.491 -r1.492 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.137 src/usr.bin/make/dir.c:1.138
--- src/usr.bin/make/dir.c:1.137	Mon Sep  7 19:48:08 2020
+++ src/usr.bin/make/dir.c	Fri Sep 11 04:32:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.137 2020/09/07 19:48:08 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.138 2020/09/11 04:32:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.137 2020/09/07 19:48:08 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.138 2020/09/11 04:32:39 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)dir.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.137 2020/09/07 19:48:08 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.138 2020/09/11 04:32:39 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -579,7 +579,7 @@ DirMatchFiles(const char *pattern, Path 
 Hash_Entry *entry;		/* Current entry in the table */
 Boolean isDot;		/* TRUE if the directory being searched is . */
 
-isDot = (*p->name == '.' && p->name[1] == '\0');
+isDot = (p->name[0] == '.' && p->name[1] == '\0');
 
 for (entry = Hash_EnumFirst(>files, );
 	 entry != NULL;

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.228 src/usr.bin/make/job.c:1.229
--- src/usr.bin/make/job.c:1.228	Mon Sep  7 05:32:12 2020
+++ src/usr.bin/make/job.c	Fri Sep 11 04:32:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.228 2020/09/07 05:32:12 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.229 2020/09/11 04:32:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.228 2020/09/07 05:32:12 rillig Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.229 2020/09/11 04:32:39 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.228 2020/09/07 05:32:12 rillig Exp $");
+__RCSID("$NetBSD: job.c,v 1.229 2020/09/11 04:32:39 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -804,7 +804,7 @@ JobPrintCommand(void *cmdp, void *jobp)
 			DBPRINTF("%s\n", commandShell->ignErr);
 		}
 	} else if (commandShell->ignErr &&
-		  (*commandShell->ignErr != '\0'))
+		   commandShell->ignErr[0] != '\0')
 	{
 		/*
 		 * The shell has no error control, so we need to be
@@ -849,7 +849,7 @@ JobPrintCommand(void *cmdp, void *jobp)
 	 */
 
 	if (!commandShell->hasErrCtl && commandShell->errOut &&
-	(*commandShell->errOut != '\0')) {
+	commandShell->errOut[0] != '\0') {
 		if (!(job->flags & JOB_SILENT) && !shutUp) {
 			if (commandShell->hasEchoCtl) {
 DBPRINTF("%s\n", commandShell->echoOff);
@@ -1474,8 +1474,8 @@ JobMakeArgv(Job *job, char **argv)
 argv[0] = UNCONST(shellName);
 argc = 1;
 
-if ((commandShell->exit && (*commandShell->exit != '-')) ||
-	(commandShell->echo && (*commandShell->echo != '-')))
+if ((commandShell->exit && commandShell->exit[0] != '-') ||
+	(commandShell->echo && commandShell->echo[0] != '-'))
 {
 	/*
 	 * At least one of the flags doesn't have a minus before it, so
@@ -2179,7 +2179,7 @@ Shell_Init(void)
 if (commandShell->echo == NULL) {
 	commandShell->echo = "";
 }
-if (commandShell->hasErrCtl && *commandShell->exit) {
+if (commandShell->hasErrCtl && commandShell->exit[0] != '\0') {
 	if (shellErrFlag &&
 	strcmp(commandShell->exit, [1]) != 0) {
 	free(shellErrFlag);

Index: src/usr.bin/make/strlist.c
diff -u src/usr.bin/make/strlist.c:1.6 src/usr.bin/make/strlist.c:1.7
--- src/usr.bin/make/strlist.c:1.6	Tue Aug 25 17:37:09 2020
+++ src/usr.bin/make/strlist.c	Fri Sep 11 04:32:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: strlist.c,v 1.6 2020/08/25 17:37:09 rillig Exp $	*/
+/*	$NetBSD: strlist.c,v 1.7 2020/09/11 04:32:39 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2008 - 2009 The NetBSD Foundation, Inc.
@@ -33,11 +33,11 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: strlist.c,v 1.6 2020/08/25 17:37:09 rillig Exp $";
+static char rcsid[] = "$NetBSD: strlist.c,v 1.7 

CVS commit: src/usr.bin/make

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep 11 04:22:23 UTC 2020

Modified Files:
src/usr.bin/make: cond.c

Log Message:
make(1): replace *par->p with par->p[0]

It's a few characters more code than before but can be read strictly
from left to right, which was not possible before.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/usr.bin/make/cond.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.122 src/usr.bin/make/cond.c:1.123
--- src/usr.bin/make/cond.c:1.122	Fri Sep 11 04:18:44 2020
+++ src/usr.bin/make/cond.c	Fri Sep 11 04:22:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.122 2020/09/11 04:18:44 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.123 2020/09/11 04:22:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.122 2020/09/11 04:18:44 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.123 2020/09/11 04:22:22 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.122 2020/09/11 04:18:44 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.123 2020/09/11 04:22:22 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -415,15 +415,15 @@ CondGetString(CondParser *par, Boolean d
 Buf_Init(, 0);
 str = NULL;
 *freeIt = NULL;
-*quoted = qt = *par->p == '"' ? 1 : 0;
+*quoted = qt = par->p[0] == '"' ? 1 : 0;
 if (qt)
 	par->p++;
-for (start = par->p; *par->p && str == NULL;) {
-	switch (*par->p) {
+for (start = par->p; par->p[0] && str == NULL;) {
+	switch (par->p[0]) {
 	case '\\':
 	par->p++;
 	if (par->p[0] != '\0') {
-		Buf_AddByte(, *par->p);
+		Buf_AddByte(, par->p[0]);
 		par->p++;
 	}
 	continue;
@@ -432,7 +432,7 @@ CondGetString(CondParser *par, Boolean d
 		par->p++;	/* we don't want the quotes */
 		goto got_str;
 	}
-	Buf_AddByte(, *par->p); /* likely? */
+	Buf_AddByte(, par->p[0]); /* likely? */
 	par->p++;
 	continue;
 	case ')':
@@ -444,7 +444,7 @@ CondGetString(CondParser *par, Boolean d
 	case '\t':
 	if (!qt)
 		goto got_str;
-	Buf_AddByte(, *par->p);
+	Buf_AddByte(, par->p[0]);
 	par->p++;
 	continue;
 	case '$':
@@ -471,9 +471,9 @@ CondGetString(CondParser *par, Boolean d
 	 * we are done.
 	 */
 	if ((par->p == start + len) &&
-		(*par->p == '\0' ||
-		 isspace((unsigned char)*par->p) ||
-		 strchr("!=><)", *par->p))) {
+		(par->p[0] == '\0' ||
+		 isspace((unsigned char)par->p[0]) ||
+		 strchr("!=><)", par->p[0]))) {
 		goto cleanup;
 	}
 
@@ -495,7 +495,7 @@ CondGetString(CondParser *par, Boolean d
 		str = NULL;
 		goto cleanup;
 	}
-	Buf_AddByte(, *par->p);
+	Buf_AddByte(, par->p[0]);
 	par->p++;
 	continue;
 	}
@@ -557,7 +557,7 @@ compare_expression(CondParser *par, Bool
  * != 0 comparison.
  */
 op = par->p;
-switch (*par->p) {
+switch (par->p[0]) {
 case '!':
 case '=':
 case '<':
@@ -595,7 +595,7 @@ compare_expression(CondParser *par, Bool
 
 CondParser_SkipWhitespace(par);
 
-if (*par->p == '\0') {
+if (par->p[0] == '\0') {
 	Parse_Error(PARSE_WARNING,
 		"Missing right-hand-side of operator");
 	goto done;



CVS commit: src/usr.bin/make

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep 11 04:18:45 UTC 2020

Modified Files:
src/usr.bin/make: cond.c

Log Message:
make(1): rename CondParser.condExpr to p

The prefix "cond" was needed when this struct field was a global
variable.  The main name "expr" was not precise enough since this code is
about parsing a condition, not an expression.

During parsing, this variable does not contain the whole expression but
a pointer to the remaining part of the condition, therefore the name
"expr" had been confusing.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/usr.bin/make/cond.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.121 src/usr.bin/make/cond.c:1.122
--- src/usr.bin/make/cond.c:1.121	Fri Sep 11 04:07:44 2020
+++ src/usr.bin/make/cond.c	Fri Sep 11 04:18:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.121 2020/09/11 04:07:44 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.122 2020/09/11 04:18:44 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.121 2020/09/11 04:07:44 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.122 2020/09/11 04:18:44 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.121 2020/09/11 04:07:44 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.122 2020/09/11 04:18:44 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -150,7 +150,7 @@ typedef enum {
 
 typedef struct {
 const struct If *if_info;	/* Info for current statement */
-const char *condExpr;	/* The expression to parse */
+const char *p;		/* The remaining condition to parse */
 Token curr;			/* Single push-back token used in parsing */
 } CondParser;
 
@@ -191,8 +191,8 @@ CondParser_PushBack(CondParser *par, Tok
 static void
 CondParser_SkipWhitespace(CondParser *par)
 {
-while (isspace((unsigned char)par->condExpr[0]))
-	par->condExpr++;
+while (isspace((unsigned char)par->p[0]))
+	par->p++;
 }
 
 /* Parse the argument of a built-in function.
@@ -415,25 +415,25 @@ CondGetString(CondParser *par, Boolean d
 Buf_Init(, 0);
 str = NULL;
 *freeIt = NULL;
-*quoted = qt = *par->condExpr == '"' ? 1 : 0;
+*quoted = qt = *par->p == '"' ? 1 : 0;
 if (qt)
-	par->condExpr++;
-for (start = par->condExpr; *par->condExpr && str == NULL;) {
-	switch (*par->condExpr) {
+	par->p++;
+for (start = par->p; *par->p && str == NULL;) {
+	switch (*par->p) {
 	case '\\':
-	par->condExpr++;
-	if (par->condExpr[0] != '\0') {
-		Buf_AddByte(, *par->condExpr);
-		par->condExpr++;
+	par->p++;
+	if (par->p[0] != '\0') {
+		Buf_AddByte(, *par->p);
+		par->p++;
 	}
 	continue;
 	case '"':
 	if (qt) {
-		par->condExpr++;	/* we don't want the quotes */
+		par->p++;	/* we don't want the quotes */
 		goto got_str;
 	}
-	Buf_AddByte(, *par->condExpr); /* likely? */
-	par->condExpr++;
+	Buf_AddByte(, *par->p); /* likely? */
+	par->p++;
 	continue;
 	case ')':
 	case '!':
@@ -444,14 +444,14 @@ CondGetString(CondParser *par, Boolean d
 	case '\t':
 	if (!qt)
 		goto got_str;
-	Buf_AddByte(, *par->condExpr);
-	par->condExpr++;
+	Buf_AddByte(, *par->p);
+	par->p++;
 	continue;
 	case '$':
 	/* if we are in quotes, then an undefined variable is ok */
 	eflags = ((!qt && doEval) ? VARE_UNDEFERR : 0) |
 		 (doEval ? VARE_WANTRES : 0);
-	str = Var_Parse(par->condExpr, VAR_CMD, eflags, , freeIt);
+	str = Var_Parse(par->p, VAR_CMD, eflags, , freeIt);
 	if (str == var_Error) {
 		if (*freeIt) {
 		free(*freeIt);
@@ -464,16 +464,16 @@ CondGetString(CondParser *par, Boolean d
 		str = NULL;
 		goto cleanup;
 	}
-	par->condExpr += len;
+	par->p += len;
 	/*
 	 * If the '$' was first char (no quotes), and we are
 	 * followed by space, the operator or end of expression,
 	 * we are done.
 	 */
-	if ((par->condExpr == start + len) &&
-		(*par->condExpr == '\0' ||
-		 isspace((unsigned char)*par->condExpr) ||
-		 strchr("!=><)", *par->condExpr))) {
+	if ((par->p == start + len) &&
+		(*par->p == '\0' ||
+		 isspace((unsigned char)*par->p) ||
+		 strchr("!=><)", *par->p))) {
 		goto cleanup;
 	}
 
@@ -495,8 +495,8 @@ CondGetString(CondParser *par, Boolean d
 		str = NULL;
 		goto cleanup;
 	}
-	Buf_AddByte(, *par->condExpr);
-	par->condExpr++;
+	Buf_AddByte(, *par->p);
+	par->p++;
 	continue;
 	}
 }
@@ -556,16 +556,16 @@ compare_expression(CondParser *par, Bool
  * known relational operator, pretend we got a
  * != 0 comparison.
  */
-op = par->condExpr;
-switch (*par->condExpr) {
+op = 

CVS commit: src/usr.bin/make

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep 11 04:07:44 UTC 2020

Modified Files:
src/usr.bin/make: cond.c

Log Message:
make(1): rename CondLexer to CondParser

The name CondLexer was wrong since this type is about parsing conditions
that can be arbitrarily nested.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/usr.bin/make/cond.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.120 src/usr.bin/make/cond.c:1.121
--- src/usr.bin/make/cond.c:1.120	Thu Sep 10 23:37:54 2020
+++ src/usr.bin/make/cond.c	Fri Sep 11 04:07:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.120 2020/09/10 23:37:54 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.121 2020/09/11 04:07:44 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.120 2020/09/10 23:37:54 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.121 2020/09/11 04:07:44 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.120 2020/09/10 23:37:54 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.121 2020/09/11 04:07:44 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -128,17 +128,20 @@ __RCSID("$NetBSD: cond.c,v 1.120 2020/09
  *
  * 'symbol' is some other symbol to which the default function is applied.
  *
- * Tokens are scanned from the lexer. The scanner (CondToken)
- * will return TOK_AND for '&' and '&&', TOK_OR for '|' and '||',
- * TOK_NOT for '!', TOK_LPAREN for '(', TOK_RPAREN for ')' and will evaluate
- * the other terminal symbols, using either the default function or the
- * function given in the terminal, and return the result as either TOK_TRUE
- * or TOK_FALSE.
+ * The tokens are scanned by CondToken, which returns:
+ *	TOK_AND		for '&' or '&&'
+ *	TOK_OR		for '|' or '||'
+ *	TOK_NOT		for '!'
+ *	TOK_LPAREN	for '('
+ *	TOK_RPAREN	for ')'
+ * Other terminal symbols are evaluated using either the default function or
+ * the function given in the terminal, they return either TOK_TRUE or
+ * TOK_FALSE.
  *
  * TOK_FALSE is 0 and TOK_TRUE 1 so we can directly assign C comparisons.
  *
- * All Non-Terminal functions (CondE, CondF and CondT) return TOK_ERROR on
- * error.
+ * All non-terminal functions (CondE, CondF and CondT) return either
+ * TOK_FALSE, TOK_TRUE, or TOK_ERROR on error.
  */
 typedef enum {
 TOK_FALSE = 0, TOK_TRUE = 1, TOK_AND, TOK_OR, TOK_NOT,
@@ -149,10 +152,10 @@ typedef struct {
 const struct If *if_info;	/* Info for current statement */
 const char *condExpr;	/* The expression to parse */
 Token curr;			/* Single push-back token used in parsing */
-} CondLexer;
+} CondParser;
 
-static Token CondE(CondLexer *lex, Boolean);
-static CondEvalResult do_Cond_EvalExpression(CondLexer *lex, Boolean *);
+static Token CondE(CondParser *par, Boolean);
+static CondEvalResult do_Cond_EvalExpression(CondParser *par, Boolean *);
 
 static unsigned int cond_depth = 0;	/* current .if nesting level */
 static unsigned int cond_min_depth = 0;	/* depth at makefile open */
@@ -177,19 +180,19 @@ istoken(const char *str, const char *tok
 
 /* Push back the most recent token read. We only need one level of this. */
 static void
-CondLexer_PushBack(CondLexer *lex, Token t)
+CondParser_PushBack(CondParser *par, Token t)
 {
-assert(lex->curr == TOK_NONE);
+assert(par->curr == TOK_NONE);
 assert(t != TOK_NONE);
 
-lex->curr = t;
+par->curr = t;
 }
 
 static void
-CondLexer_SkipWhitespace(CondLexer *lex)
+CondParser_SkipWhitespace(CondParser *par)
 {
-while (isspace((unsigned char)lex->condExpr[0]))
-	lex->condExpr++;
+while (isspace((unsigned char)par->condExpr[0]))
+	par->condExpr++;
 }
 
 /* Parse the argument of a built-in function.
@@ -399,7 +402,7 @@ CondCvtArg(const char *str, double *valu
  */
 /* coverity:[+alloc : arg-*3] */
 static const char *
-CondGetString(CondLexer *lex, Boolean doEval, Boolean *quoted, void **freeIt,
+CondGetString(CondParser *par, Boolean doEval, Boolean *quoted, void **freeIt,
 	  Boolean strictLHS)
 {
 Buffer buf;
@@ -412,25 +415,25 @@ CondGetString(CondLexer *lex, Boolean do
 Buf_Init(, 0);
 str = NULL;
 *freeIt = NULL;
-*quoted = qt = *lex->condExpr == '"' ? 1 : 0;
+*quoted = qt = *par->condExpr == '"' ? 1 : 0;
 if (qt)
-	lex->condExpr++;
-for (start = lex->condExpr; *lex->condExpr && str == NULL;) {
-	switch (*lex->condExpr) {
+	par->condExpr++;
+for (start = par->condExpr; *par->condExpr && str == NULL;) {
+	switch (*par->condExpr) {
 	case '\\':
-	lex->condExpr++;
-	if (lex->condExpr[0] != '\0') {
-		Buf_AddByte(, *lex->condExpr);
-		lex->condExpr++;
+	par->condExpr++;
+	if (par->condExpr[0] 

CVS commit: src/sys/arch/alpha/alpha

2020-09-10 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Sep 11 03:54:14 UTC 2020

Modified Files:
src/sys/arch/alpha/alpha: pmap.c

Log Message:
Fix shift tyop in a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.272 -r1.273 src/sys/arch/alpha/alpha/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/alpha/alpha/pmap.c
diff -u src/sys/arch/alpha/alpha/pmap.c:1.272 src/sys/arch/alpha/alpha/pmap.c:1.273
--- src/sys/arch/alpha/alpha/pmap.c:1.272	Tue Sep  8 21:41:37 2020
+++ src/sys/arch/alpha/alpha/pmap.c	Fri Sep 11 03:54:14 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.272 2020/09/08 21:41:37 riastradh Exp $ */
+/* $NetBSD: pmap.c,v 1.273 2020/09/11 03:54:14 simonb Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020
@@ -135,7 +135,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.272 2020/09/08 21:41:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.273 2020/09/11 03:54:14 simonb Exp $");
 
 #include 
 #include 
@@ -439,7 +439,7 @@ pmap_activation_lock(pmap_t const pmap)
  * changes.  In order amortize the cost of these operations, we will
  * queue up to 8 addresses to invalidate in a batch.  Any more than
  * that, and we will hit the entire TLB.
- 8
+ *
  * Some things that add complexity:
  *
  * ==> ASNs. A CPU may have valid TLB entries for other than the current



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common

2020-09-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 11 01:45:53 UTC 2020

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
sanitizer_linux.h

Log Message:
Add prototypes of internal_sigdelset() and internal_clone()

Cherry-pick the missing change from:

commit 983d7ddd0b278b45d815cbac9197205b39c4860a
Author: Kamil Rytarowski 
Date:   Thu Jul 11 06:22:35 2019 +

Add NetBSD LSan support

Summary:
Combine few relatively small changes into one:

 - implement internal_ptrace() and internal_clone() for NetBSD
 - add support for stoptheworld based on the ptrace(2) API
 - define COMPILER_RT_HAS_LSAN for NetBSD
 - enable tests for NetBSD/amd64

Inspired by the original implementation by Christos Zoulas in netbsd/src 
for GCC.

The implementation is in theory CPU independent through well defined macros
across all NetBSD ports, however only the x86_64 version was tested.

Reviewers: mgorny, dvyukov, vitalybuka, joerg, jfb

Reviewed By: vitalybuka

Subscribers: dexonsmith, jfb, srhines, kubamracek, llvm-commits, christos

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D64057

llvm-svn: 365735


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.h
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.h:1.10 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.h:1.11
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.h:1.10	Sat Sep  5 13:35:55 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.h	Fri Sep 11 01:45:53 2020
@@ -74,12 +74,8 @@ uptr internal_prctl(int option, uptr arg
 #endif  // SANITIZER_LINUX
 
 #ifdef SANITIZER_NETBSD
-int internal_sigaction_norestorer(int signum, const void *act, void *oldact);
-#define internal_sigdelset(set, signum) \
-__sigdelset(set, signum)
-#define internal_clone(fn, child_stack, flags, arg, \
-parent_tidptr, newtls, child_tidptr) \
-__clone(fn, child_stack, flags, arg)
+void internal_sigdelset(__sanitizer_sigset_t *set, int signum);
+uptr internal_clone(int (*fn)(void *), void *child_stack, int flags, void *arg);
 #endif
 
 // This class reads thread IDs from /proc//task using only syscalls.



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common

2020-09-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 11 01:08:36 UTC 2020

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
sanitizer_getauxval.h

Log Message:
Add getauxval() compat for NetBSD

Cherry-pick and adapt:

commit 02519fc7a6f8c528f67975a9f78ce64dabf402b4
Author: Kamil Rytarowski 
Date:   Thu Sep 12 18:57:58 2019 +

Add getauxval() compat for NetBSD

Summary:
getauxval() is not available on NetBSD and there is no a direct equivalent.

Add a function that implements the same semantics with NetBSD internals.

Reorder the GetPageSize() functions to prefer the sysctl approach for 
NetBSD.
It no longer makes a difference which approach is better. Avoid changing
conditional code path.

Reviewers: vitalybuka, dvyukov, mgorny, joerg

Reviewed By: vitalybuka

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D67329

llvm-svn: 371758


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_getauxval.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_getauxval.h
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_getauxval.h:1.1.1.1 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_getauxval.h:1.2
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_getauxval.h:1.1.1.1	Sat Sep  5 07:52:57 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_getauxval.h	Fri Sep 11 01:08:36 2020
@@ -8,6 +8,7 @@
 // Common getauxval() guards and definitions.
 // getauxval() is not defined until glibc version 2.16, or until API level 21
 // for Android.
+// Implement the getauxval() compat function for NetBSD.
 //
 //===--===//
 
@@ -41,6 +42,23 @@ extern "C" SANITIZER_WEAK_ATTRIBUTE
 unsigned long getauxval(unsigned long type);  // NOLINT
 # endif
 
-#endif // SANITIZER_LINUX || SANITIZER_FUCHSIA
+#elif SANITIZER_NETBSD
+
+#define SANITIZER_USE_GETAUXVAL 1
+
+#include 
+#include 
+
+static inline decltype(AuxInfo::a_v) getauxval(decltype(AuxInfo::a_type) type) {
+  for (const AuxInfo *aux = (const AuxInfo *)_dlauxinfo();
+   aux->a_type != AT_NULL; ++aux) {
+if (type == aux->a_type)
+  return aux->a_v;
+  }
+
+  return 0;
+}
+
+#endif
 
 #endif // SANITIZER_GETAUXVAL_H



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common

2020-09-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 11 01:07:53 UTC 2020

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
sanitizer_linux.cc

Log Message:
Use sysctl to implement GetPageSize()

Cherry-pick code chunk from newer LLVM compiler-rt.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 \
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.36 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.37
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.36	Mon Sep  7 00:22:51 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc	Fri Sep 11 01:07:53 2020
@@ -1139,6 +1139,14 @@ uptr GetPageSize() {
 // Android post-M sysconf(_SC_PAGESIZE) crashes if called from .preinit_array.
 #if SANITIZER_ANDROID
   return 4096;
+#elif SANITIZER_FREEBSD || SANITIZER_NETBSD
+// Use sysctl as sysconf can trigger interceptors internally.
+  int pz = 0;
+  uptr pzl = sizeof(pz);
+  int mib[2] = {CTL_HW, HW_PAGESIZE};
+  int rv = internal_sysctl(mib, 2, , , nullptr, 0);
+  CHECK_EQ(rv, 0);
+  return (uptr)pz;
 #elif SANITIZER_LINUX && (defined(__x86_64__) || defined(__i386__))
   return EXEC_PAGESIZE;
 #elif SANITIZER_USE_GETAUXVAL



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common

2020-09-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 11 01:07:27 UTC 2020

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
sanitizer_internal_defs.h

Log Message:
Enable SANITIZER_CAN_USE_PREINIT_ARRAY on NetBSD

Cherry-pick:

commit 3a189bac9bb111c9a59339015ab0d4e2fed735f4
Author: Kamil Rytarowski 
Date:   Thu Dec 19 03:21:46 2019 +0100

[compiler-rt] Enable SANITIZER_CAN_USE_PREINIT_ARRAY on NetBSD

.preinit_array is supported since 9.0.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \

src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:1.12 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:1.13
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:1.12	Sat Sep  5 09:12:32 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h	Fri Sep 11 01:07:27 2020
@@ -104,7 +104,7 @@
 // FIXME: do we have anything like this on Mac?
 #ifndef SANITIZER_CAN_USE_PREINIT_ARRAY
 #if ((SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_OPENBSD || \
- SANITIZER_FUCHSIA) && !defined(PIC)
+ SANITIZER_FUCHSIA || SANITIZER_NETBSD) && !defined(PIC)
 #define SANITIZER_CAN_USE_PREINIT_ARRAY 1
 // Before Solaris 11.4, .preinit_array is fully supported only with GNU ld.
 // FIXME: Check for those conditions.



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common

2020-09-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 11 01:07:00 UTC 2020

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
sanitizer_stoptheworld_netbsd_libcdep.cc

Log Message:
Adapt stop-the-world for ptrace changes in NetBSD-9.99.30

Cherry-pick and adapt:

commit fc356dcc11c10003ff22acff667b0a9f5e6c1e0f
Author: Kamil Rytarowski 
Date:   Tue Dec 24 20:33:54 2019 +0100

[compiler-rt] Adapt stop-the-world for ptrace changes in NetBSD-9.99.30

Handle PT_LWPNEXT for newer kernels and keep PT_LWPINFO for older ones.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \

src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cc:1.1 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cc:1.2
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cc:1.1	Fri Sep 11 01:05:28 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cc	Fri Sep 11 01:07:00 2020
@@ -120,10 +120,18 @@ bool ThreadSuspender::SuspendAllThreads(
 
   VReport(2, "Attached to process %d.\n", pid_);
 
+#ifdef PT_LWPNEXT
+  struct ptrace_lwpstatus pl;
+  int op = PT_LWPNEXT;
+#else
   struct ptrace_lwpinfo pl;
-  int val;
+  int op = PT_LWPINFO;
+#endif
+
   pl.pl_lwpid = 0;
-  while ((val = ptrace(PT_LWPINFO, pid_, (void *), sizeof(pl))) != -1 &&
+
+  int val;
+  while ((val = ptrace(op, pid_, (void *), sizeof(pl))) != -1 &&
  pl.pl_lwpid != 0) {
 suspended_threads_list_.Append(pl.pl_lwpid);
 VReport(2, "Appended thread %d in process %d.\n", pl.pl_lwpid, pid_);



CVS commit: src/external/gpl3/gcc

2020-09-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 11 01:05:28 UTC 2020

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/lsan: lsan_common.h
lsan_linux.cc
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common: Makefile.am
Makefile.in sanitizer_netbsd.cc sanitizer_posix.h
src/external/gpl3/gcc/lib: Makefile.sanitizer
Added Files:
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
sanitizer_stoptheworld_netbsd_libcdep.cc

Log Message:
Add NetBSD LSan support

Cherry-pick and adapt:

commit 983d7ddd0b278b45d815cbac9197205b39c4860a
Author: Kamil Rytarowski 
Date:   Thu Jul 11 06:22:35 2019 +

Add NetBSD LSan support

Summary:
Combine few relatively small changes into one:

 - implement internal_ptrace() and internal_clone() for NetBSD
 - add support for stoptheworld based on the ptrace(2) API
 - define COMPILER_RT_HAS_LSAN for NetBSD
 - enable tests for NetBSD/amd64

Inspired by the original implementation by Christos Zoulas in netbsd/src 
for GCC.

The implementation is in theory CPU independent through well defined macros
across all NetBSD ports, however only the x86_64 version was tested.

Reviewers: mgorny, dvyukov, vitalybuka, joerg, jfb

Reviewed By: vitalybuka

Subscribers: dexonsmith, jfb, srhines, kubamracek, llvm-commits, christos

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D64057

llvm-svn: 365735


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_common.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_linux.cc
cvs rdiff -u -r1.4 -r1.5 \
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/Makefile.am \
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/Makefile.in
cvs rdiff -u -r1.6 -r1.7 \
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_netbsd.cc
cvs rdiff -u -r1.1.1.6 -r1.2 \
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix.h
cvs rdiff -u -r0 -r1.1 \

src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cc
cvs rdiff -u -r1.13 -r1.14 src/external/gpl3/gcc/lib/Makefile.sanitizer

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_common.h
diff -u src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_common.h:1.7 src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_common.h:1.8
--- src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_common.h:1.7	Sat Sep  5 09:12:31 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_common.h	Fri Sep 11 01:05:28 2020
@@ -20,8 +20,8 @@
 #include "sanitizer_common/sanitizer_stoptheworld.h"
 #include "sanitizer_common/sanitizer_symbolizer.h"
 
-// LeakSanitizer relies on some Glibc's internals (e.g. TLS machinery) thus
-// supported for Linux only. Also, LSan doesn't like 32 bit architectures
+// LeakSanitizer relies on some Glibc's internals (e.g. TLS machinery) on Linux.
+// Also, LSan doesn't like 32 bit architectures
 // because of "small" (4 bytes) pointer size that leads to high false negative
 // ratio on large leaks. But we still want to have it for some 32 bit arches
 // (e.g. x86), see https://github.com/google/sanitizers/issues/403.
@@ -39,6 +39,8 @@
 #elif defined(__arm__) && \
 ((SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_NETBSD)
 #define CAN_SANITIZE_LEAKS 1
+#elif SANITIZER_NETBSD
+#define CAN_SANITIZE_LEAKS 1
 #else
 #define CAN_SANITIZE_LEAKS 0
 #endif

Index: src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_linux.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_linux.cc:1.1.1.1 src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_linux.cc:1.2
--- src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_linux.cc:1.1.1.1	Tue Oct  1 09:36:38 2019
+++ src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_linux.cc	Fri Sep 11 01:05:28 2020
@@ -5,13 +5,13 @@
 //
 //===--===//
 //
-// This file is a part of LeakSanitizer. Linux-specific code.
+// This file is a part of LeakSanitizer. Linux/NetBSD-specific code.
 //
 //===--===//
 
 #include "sanitizer_common/sanitizer_platform.h"
 
-#if SANITIZER_LINUX
+#if SANITIZER_LINUX || SANITIZER_NETBSD
 
 #include "lsan_allocator.h"
 
@@ -28,4 +28,4 @@ void ReplaceSystemMalloc() {}
 
 } // namespace __lsan
 
-#endif // SANITIZER_LINUX
+#endif  // SANITIZER_LINUX || SANITIZER_NETBSD

Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/Makefile.am
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/Makefile.am:1.4 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/Makefile.am:1.5
--- 

CVS commit: src/external/gpl3/gcc/dist/libsanitizer

2020-09-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 11 01:04:34 UTC 2020

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/asan: asan_interceptors.h
src/external/gpl3/gcc/dist/libsanitizer/lsan: lsan_interceptors.cc
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
sanitizer_platform_interceptors.h

Log Message:
Stop tracking atexit/__cxa_atexit/pthread_atfork allocations in LSan/NetBSD

Cherry-pick and adapt:

commit 8827047551570b7ed7088765c3de2a8cce6823b8
Author: Kamil Rytarowski 
Date:   Sat Sep 21 07:30:42 2019 +

Stop tracking atexit/__cxa_atexit/pthread_atfork allocations in LSan/NetBSD

Summary:
The atexit(3) and __cxa_atexit() calls allocate internally memory and free 
on exit,
after executing all callback. This causes false positives as DoLeakCheck() 
is called
from the atexit handler. In the LSan/ASan tests there are strict checks 
triggering
false positives here.

Intercept all atexit(3) and __cxa_atexit() calls and disable LSan when 
calling the
real functions.

Stop tracing allocations in pthread_atfork(3) funtions, as there are 
performed
internal allocations that are not freed for the time of running 
StopTheWorld()
code. This avoids false-positives.

The same changes have to be replicated in the ASan and LSan runtime.

Non-NetBSD OSs are not tested and this code is restricted to NetBSD only.

Reviewers: dvyukov, joerg, mgorny, vitalybuka, eugenis

Reviewed By: vitalybuka

Subscribers: jfb, llvm-commits, #sanitizers

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D67331

llvm-svn: 372459


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.h
cvs rdiff -u -r1.6 -r1.7 \
src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_interceptors.cc
cvs rdiff -u -r1.8 -r1.9 \

src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.h
diff -u src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.h:1.6 src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.h:1.7
--- src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.h:1.6	Sat Sep  5 09:12:31 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.h	Fri Sep 11 01:04:33 2020
@@ -103,12 +103,24 @@ void InitializePlatformInterceptors();
 # define ASAN_INTERCEPT___CXA_ATEXIT 0
 #endif
 
+#if SANITIZER_NETBSD
+# define ASAN_INTERCEPT_ATEXIT 1
+#else
+# define ASAN_INTERCEPT_ATEXIT 0
+#endif
+
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
 # define ASAN_INTERCEPT___STRDUP 1
 #else
 # define ASAN_INTERCEPT___STRDUP 0
 #endif
 
+#if SANITIZER_NETBSD
+# define ASAN_INTERCEPT_PTHREAD_ATFORK 1
+#else
+# define ASAN_INTERCEPT_PTHREAD_ATFORK 0
+#endif
+
 DECLARE_REAL(int, memcmp, const void *a1, const void *a2, uptr size)
 DECLARE_REAL(char*, strchr, const char *str, int c)
 DECLARE_REAL(SIZE_T, strlen, const char *s)

Index: src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_interceptors.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_interceptors.cc:1.6 src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_interceptors.cc:1.7
--- src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_interceptors.cc:1.6	Fri Sep 11 01:03:31 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_interceptors.cc	Fri Sep 11 01:04:34 2020
@@ -348,6 +348,44 @@ INTERCEPTOR(char *, strerror, int errnum
 #define LSAN_MAYBE_INTERCEPT_STRERROR
 #endif
 
+#if SANITIZER_INTERCEPT___CXA_ATEXIT
+INTERCEPTOR(int, __cxa_atexit, void (*func)(void *), void *arg,
+void *dso_handle) {
+  __lsan::ScopedInterceptorDisabler disabler;
+  return REAL(__cxa_atexit)(func, arg, dso_handle);
+}
+#define LSAN_MAYBE_INTERCEPT___CXA_ATEXIT INTERCEPT_FUNCTION(__cxa_atexit)
+#else
+#define LSAN_MAYBE_INTERCEPT___CXA_ATEXIT
+#endif
+
+#if SANITIZER_INTERCEPT_ATEXIT
+INTERCEPTOR(int, atexit, void (*f)()) {
+  __lsan::ScopedInterceptorDisabler disabler;
+  return REAL(__cxa_atexit)((void (*)(void *a))f, 0, 0);
+}
+#define LSAN_MAYBE_INTERCEPT_ATEXIT INTERCEPT_FUNCTION(atexit)
+#else
+#define LSAN_MAYBE_INTERCEPT_ATEXIT
+#endif
+
+#if SANITIZER_INTERCEPT_PTHREAD_ATFORK
+extern "C" {
+extern int _pthread_atfork(void (*prepare)(), void (*parent)(),
+   void (*child)());
+};
+
+INTERCEPTOR(int, pthread_atfork, void (*prepare)(), void (*parent)(),
+void (*child)()) {
+  __lsan::ScopedInterceptorDisabler disabler;
+  // REAL(pthread_atfork) cannot be called due to symbol indirections at least on NetBSD
+  return _pthread_atfork(prepare, parent, child);
+}
+#define LSAN_MAYBE_INTERCEPT_PTHREAD_ATFORK INTERCEPT_FUNCTION(pthread_atfork)
+#else
+#define 

CVS commit: src/external/gpl3/gcc/dist/libsanitizer

2020-09-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 11 01:03:31 UTC 2020

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/asan: asan_interceptors.cc
src/external/gpl3/gcc/dist/libsanitizer/lsan: lsan_interceptors.cc
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
sanitizer_common_interceptors.inc

Log Message:
Add __lsan::ScopedInterceptorDisabler for strerror(3)

Cherry-pick and adapt:

commit 1b58389428ed07a7322ba9c2bcaeec99807f9457
Author: Kamil Rytarowski 
Date:   Sat Sep 21 07:45:02 2019 +

Add __lsan::ScopedInterceptorDisabler for strerror(3)

Summary:
strerror(3) on NetBSD uses internally TSD with a destructor that is never
fired for exit(3). It's correctly called for pthread_exit(3) scenarios.

This is a case when a leak on exit(3) is expected, unavoidable and harmless.

Reviewers: joerg, vitalybuka, dvyukov, mgorny

Reviewed By: vitalybuka

Subscribers: dmgreen, kristof.beyls, jfb, llvm-commits, #sanitizers

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D67337

llvm-svn: 372461


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.cc
cvs rdiff -u -r1.5 -r1.6 \
src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_interceptors.cc
cvs rdiff -u -r1.9 -r1.10 \

src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.cc:1.8 src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.cc:1.9
--- src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.cc:1.8	Sat Sep  5 09:12:31 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/asan/asan_interceptors.cc	Fri Sep 11 01:03:31 2020
@@ -163,6 +163,11 @@ DECLARE_REAL_AND_INTERCEPTOR(void, free,
 ASAN_MEMSET_IMPL(ctx, block, c, size);  \
   } while (false)
 
+#if CAN_SANITIZE_LEAKS
+#define COMMON_INTERCEPTOR_STRERROR()   \
+  __lsan::ScopedInterceptorDisabler disabler
+#endif
+
 #include "sanitizer_common/sanitizer_common_interceptors.inc"
 #include "sanitizer_common/sanitizer_signal_interceptors.inc"
 

Index: src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_interceptors.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_interceptors.cc:1.5 src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_interceptors.cc:1.6
--- src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_interceptors.cc:1.5	Sat Sep  5 09:12:31 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_interceptors.cc	Fri Sep 11 01:03:31 2020
@@ -338,6 +338,16 @@ INTERCEPTOR(void, thr_exit, tid_t *state
 #define LSAN_MAYBE_INTERCEPT_THR_EXIT
 #endif
 
+#if SANITIZER_INTERCEPT_STRERROR
+INTERCEPTOR(char *, strerror, int errnum) {
+  __lsan::ScopedInterceptorDisabler disabler;
+  return REAL(strerror)(errnum);
+}
+#define LSAN_MAYBE_INTERCEPT_STRERROR INTERCEPT_FUNCTION(strerror)
+#else
+#define LSAN_MAYBE_INTERCEPT_STRERROR
+#endif
+
 struct ThreadParam {
   void *(*callback)(void *arg);
   void *param;
@@ -447,6 +457,8 @@ void InitializeInterceptors() {
   LSAN_MAYBE_INTERCEPT__LWP_EXIT;
   LSAN_MAYBE_INTERCEPT_THR_EXIT;
 
+  LSAN_MAYBE_INTERCEPT_STRERROR;
+
 #if !SANITIZER_NETBSD && !SANITIZER_FREEBSD
   if (pthread_key_create(_thread_finalize_key, _finalize)) {
 Report("LeakSanitizer: failed to create thread key.\n");

Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:1.9 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:1.10
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:1.9	Sat Sep  5 09:12:32 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc	Fri Sep 11 01:03:31 2020
@@ -35,6 +35,7 @@
 //   COMMON_INTERCEPTOR_MMAP_IMPL
 //   COMMON_INTERCEPTOR_COPY_STRING
 //   COMMON_INTERCEPTOR_STRNDUP_IMPL
+//   COMMON_INTERCEPTOR_STRERROR
 //===--===//
 
 #include "interception/interception.h"
@@ -290,6 +291,10 @@ bool PlatformHasDifferentMemcpyAndMemmov
   return new_mem;
 #endif
 
+#ifndef COMMON_INTERCEPTOR_STRERROR
+#define COMMON_INTERCEPTOR_STRERROR() {}
+#endif
+
 struct FileMetadata {
   // For open_memstream().
   char **addr;
@@ -3631,6 +3636,7 @@ INTERCEPTOR(int, sched_getparam, int pid
 INTERCEPTOR(char *, strerror, int errnum) {
   void *ctx;
   COMMON_INTERCEPTOR_ENTER(ctx, strerror, errnum);
+  COMMON_INTERCEPTOR_STRERROR();
   char *res = REAL(strerror)(errnum);
 

CVS commit: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common

2020-09-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 11 01:01:14 UTC 2020

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
sanitizer_stoptheworld_linux_libcdep.cc

Log Message:
Disable sanitizer_stoptheworld_linux_libcdep.cc for NetBSD


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \

src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc:1.11 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc:1.12
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc:1.11	Sat Sep  5 09:12:32 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc	Fri Sep 11 01:01:14 2020
@@ -12,7 +12,7 @@
 
 #include "sanitizer_platform.h"
 
-#if (SANITIZER_LINUX || SANITIZER_NETBSD) && \
+#if SANITIZER_LINUX && \
 		   (defined(__x86_64__) || defined(__mips__) || \
 defined(__aarch64__) || defined(__powerpc64__) || \
 defined(__s390__) || defined(__i386__) || \



CVS commit: src/usr.bin/make

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 10 23:37:55 UTC 2020

Modified Files:
src/usr.bin/make: cond.c

Log Message:
make(1): reduce code size in CondGetString

The pattern is now the usual "test the character, then increment the
pointer", throughout the whole function.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/usr.bin/make/cond.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.119 src/usr.bin/make/cond.c:1.120
--- src/usr.bin/make/cond.c:1.119	Thu Sep 10 23:27:27 2020
+++ src/usr.bin/make/cond.c	Thu Sep 10 23:37:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.119 2020/09/10 23:27:27 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.120 2020/09/10 23:37:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.119 2020/09/10 23:27:27 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.120 2020/09/10 23:37:54 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.119 2020/09/10 23:27:27 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.120 2020/09/10 23:37:54 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -418,18 +418,18 @@ CondGetString(CondLexer *lex, Boolean do
 for (start = lex->condExpr; *lex->condExpr && str == NULL;) {
 	switch (*lex->condExpr) {
 	case '\\':
-	if (lex->condExpr[1] != '\0') {
-		lex->condExpr++;
+	lex->condExpr++;
+	if (lex->condExpr[0] != '\0') {
 		Buf_AddByte(, *lex->condExpr);
+		lex->condExpr++;
 	}
-	lex->condExpr++;
 	continue;
 	case '"':
 	if (qt) {
 		lex->condExpr++;	/* we don't want the quotes */
 		goto got_str;
-	} else
-		Buf_AddByte(, *lex->condExpr); /* likely? */
+	}
+	Buf_AddByte(, *lex->condExpr); /* likely? */
 	lex->condExpr++;
 	continue;
 	case ')':
@@ -441,8 +441,7 @@ CondGetString(CondLexer *lex, Boolean do
 	case '\t':
 	if (!qt)
 		goto got_str;
-	else
-		Buf_AddByte(, *lex->condExpr);
+	Buf_AddByte(, *lex->condExpr);
 	lex->condExpr++;
 	continue;
 	case '$':



CVS commit: src/usr.bin/make

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 10 23:27:27 UTC 2020

Modified Files:
src/usr.bin/make: cond.c

Log Message:
make(1): skip redundant condExpr-- in CondGetString


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/usr.bin/make/cond.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.118 src/usr.bin/make/cond.c:1.119
--- src/usr.bin/make/cond.c:1.118	Thu Sep 10 22:47:22 2020
+++ src/usr.bin/make/cond.c	Thu Sep 10 23:27:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.118 2020/09/10 22:47:22 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.119 2020/09/10 23:27:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.118 2020/09/10 22:47:22 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.119 2020/09/10 23:27:27 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.118 2020/09/10 22:47:22 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.119 2020/09/10 23:27:27 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -415,22 +415,23 @@ CondGetString(CondLexer *lex, Boolean do
 *quoted = qt = *lex->condExpr == '"' ? 1 : 0;
 if (qt)
 	lex->condExpr++;
-for (start = lex->condExpr;
-	 *lex->condExpr && str == NULL; lex->condExpr++) {
+for (start = lex->condExpr; *lex->condExpr && str == NULL;) {
 	switch (*lex->condExpr) {
 	case '\\':
 	if (lex->condExpr[1] != '\0') {
 		lex->condExpr++;
 		Buf_AddByte(, *lex->condExpr);
 	}
-	break;
+	lex->condExpr++;
+	continue;
 	case '"':
 	if (qt) {
 		lex->condExpr++;	/* we don't want the quotes */
 		goto got_str;
 	} else
 		Buf_AddByte(, *lex->condExpr); /* likely? */
-	break;
+	lex->condExpr++;
+	continue;
 	case ')':
 	case '!':
 	case '=':
@@ -442,7 +443,8 @@ CondGetString(CondLexer *lex, Boolean do
 		goto got_str;
 	else
 		Buf_AddByte(, *lex->condExpr);
-	break;
+	lex->condExpr++;
+	continue;
 	case '$':
 	/* if we are in quotes, then an undefined variable is ok */
 	eflags = ((!qt && doEval) ? VARE_UNDEFERR : 0) |
@@ -479,8 +481,7 @@ CondGetString(CondLexer *lex, Boolean do
 		*freeIt = NULL;
 	}
 	str = NULL;		/* not finished yet */
-	lex->condExpr--;	/* don't skip over next char */
-	break;
+	continue;
 	default:
 	if (strictLHS && !qt && *start != '$' &&
 		!isdigit((unsigned char)*start)) {
@@ -493,7 +494,8 @@ CondGetString(CondLexer *lex, Boolean do
 		goto cleanup;
 	}
 	Buf_AddByte(, *lex->condExpr);
-	break;
+	lex->condExpr++;
+	continue;
 	}
 }
 got_str:



CVS commit: src/external/bsd/atf/dist/atf-sh

2020-09-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Sep 10 22:51:11 UTC 2020

Modified Files:
src/external/bsd/atf/dist/atf-sh: libatf-sh.subr

Log Message:
Replace a pipe into tr to normalise a var name (convert '.' or '-'
into '_' to meet sh variable name rules) into a shell string processing
loop.

On my test system, this reduces the total elapsed time for the bin/sh ATF
tests from about 109 secs to about 102 (user cpu from 24.5 to 21, sys cpu
from 34 to 30) and the usr.bin/make tests elapsed time from 42.5 to 40
secs (user from a bit over 15 to a bit over 13, and sys from 16+ to 13+).
(Recorded on an AMD64 domU).

These probably exaggerate the effect, as there are a bunch of quite small
tests, which means the ATF overhead (which this change affects) is a greater
proportion of the total test time than for some other tests where most of
the time is spent actually testing.

But I am fairly confident that there will be at least some improvement.

This could be further improved by removing the cmdsub invocation method,
and instead passing the name of a variable containing the string to
normalise (with the result returned in that same var) - but that would
mean altering all the callers as well.   Some other time maybe.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/atf/dist/atf-sh/libatf-sh.subr

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/atf-sh/libatf-sh.subr
diff -u src/external/bsd/atf/dist/atf-sh/libatf-sh.subr:1.4 src/external/bsd/atf/dist/atf-sh/libatf-sh.subr:1.5
--- src/external/bsd/atf/dist/atf-sh/libatf-sh.subr:1.4	Wed Dec 30 22:23:02 2015
+++ src/external/bsd/atf/dist/atf-sh/libatf-sh.subr	Thu Sep 10 22:51:10 2020
@@ -544,7 +544,15 @@ _atf_list_tcs()
 #
 _atf_normalize()
 {
-echo ${1} | tr .- __
+while :
+do
+	case "${1}" in
+	(*.*)	set -- "${1%.*}_${1##*.}";;
+	(*-*)	set -- "${1%-*}_${1##*-}";;
+	(*)	break;;
+	esac
+done
+printf "%s\n" "$1"
 }
 
 #



CVS commit: src/usr.bin/make

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 10 22:47:22 UTC 2020

Modified Files:
src/usr.bin/make: cond.c

Log Message:
make(1): reduce code size for parsing the || or && operators

On x86_64, accessing [0] generates less code than [1].


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/usr.bin/make/cond.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.117 src/usr.bin/make/cond.c:1.118
--- src/usr.bin/make/cond.c:1.117	Tue Sep  8 18:51:23 2020
+++ src/usr.bin/make/cond.c	Thu Sep 10 22:47:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.117 2020/09/08 18:51:23 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.118 2020/09/10 22:47:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.117 2020/09/08 18:51:23 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.118 2020/09/10 22:47:22 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.117 2020/09/08 18:51:23 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.118 2020/09/10 22:47:22 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -809,11 +809,11 @@ CondToken(CondLexer *lex, Boolean doEval
 	return t;
 }
 
-while (*lex->condExpr == ' ' || *lex->condExpr == '\t') {
+while (lex->condExpr[0] == ' ' || lex->condExpr[0] == '\t') {
 	lex->condExpr++;
 }
 
-switch (*lex->condExpr) {
+switch (lex->condExpr[0]) {
 
 case '(':
 	lex->condExpr++;
@@ -824,17 +824,17 @@ CondToken(CondLexer *lex, Boolean doEval
 	return TOK_RPAREN;
 
 case '|':
-	if (lex->condExpr[1] == '|') {
+	lex->condExpr++;
+	if (lex->condExpr[0] == '|') {
 	lex->condExpr++;
 	}
-	lex->condExpr++;
 	return TOK_OR;
 
 case '&':
-	if (lex->condExpr[1] == '&') {
+	lex->condExpr++;
+	if (lex->condExpr[0] == '&') {
 	lex->condExpr++;
 	}
-	lex->condExpr++;
 	return TOK_AND;
 
 case '!':



CVS commit: src/usr.bin/make/unit-tests

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 10 22:44:08 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: cond-op-or.exp cond-op-or.mk

Log Message:
make(1): add tests for the |, ||, ||| operators


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cond-op-or.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-op-or.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/cond-op-or.exp
diff -u src/usr.bin/make/unit-tests/cond-op-or.exp:1.1 src/usr.bin/make/unit-tests/cond-op-or.exp:1.2
--- src/usr.bin/make/unit-tests/cond-op-or.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/cond-op-or.exp	Thu Sep 10 22:44:08 2020
@@ -1 +1,4 @@
-exit status 0
+make: "cond-op-or.mk" line 43: Malformed conditional (0 ||| 0)
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1

Index: src/usr.bin/make/unit-tests/cond-op-or.mk
diff -u src/usr.bin/make/unit-tests/cond-op-or.mk:1.3 src/usr.bin/make/unit-tests/cond-op-or.mk:1.4
--- src/usr.bin/make/unit-tests/cond-op-or.mk:1.3	Fri Aug 28 14:48:37 2020
+++ src/usr.bin/make/unit-tests/cond-op-or.mk	Thu Sep 10 22:44:08 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-op-or.mk,v 1.3 2020/08/28 14:48:37 rillig Exp $
+# $NetBSD: cond-op-or.mk,v 1.4 2020/09/10 22:44:08 rillig Exp $
 #
 # Tests for the || operator in .if conditions.
 
@@ -23,5 +23,26 @@
 .if 1 || ${UNDEF}
 .endif
 
+# The && operator may be abbreviated as &.  This is not widely known though
+# and is also not documented in the manual page.
+
+.if 0 | 0
+.  error
+.endif
+.if !(1 | 0)
+.  error
+.endif
+.if !(0 | 1)
+.  error
+.endif
+.if !(1 | 1)
+.  error
+.endif
+
+# There is no operator |||.
+.if 0 ||| 0
+.  error
+.endif
+
 all:
 	@:;



CVS commit: src/usr.bin/make/unit-tests

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 10 22:38:58 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: cond-op-and.exp cond-op-and.mk

Log Message:
make(1): add test for the &, && and &&& operators


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cond-op-and.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-op-and.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/cond-op-and.exp
diff -u src/usr.bin/make/unit-tests/cond-op-and.exp:1.1 src/usr.bin/make/unit-tests/cond-op-and.exp:1.2
--- src/usr.bin/make/unit-tests/cond-op-and.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/cond-op-and.exp	Thu Sep 10 22:38:57 2020
@@ -1 +1,4 @@
-exit status 0
+make: "cond-op-and.mk" line 43: Malformed conditional (0 &&& 0)
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1

Index: src/usr.bin/make/unit-tests/cond-op-and.mk
diff -u src/usr.bin/make/unit-tests/cond-op-and.mk:1.3 src/usr.bin/make/unit-tests/cond-op-and.mk:1.4
--- src/usr.bin/make/unit-tests/cond-op-and.mk:1.3	Fri Aug 28 14:48:37 2020
+++ src/usr.bin/make/unit-tests/cond-op-and.mk	Thu Sep 10 22:38:57 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-op-and.mk,v 1.3 2020/08/28 14:48:37 rillig Exp $
+# $NetBSD: cond-op-and.mk,v 1.4 2020/09/10 22:38:57 rillig Exp $
 #
 # Tests for the && operator in .if conditions.
 
@@ -23,5 +23,26 @@
 .if 0 && ${UNDEF}
 .endif
 
+# The && operator may be abbreviated as &.  This is not widely known though
+# and is also not documented in the manual page.
+
+.if 0 & 0
+.  error
+.endif
+.if 1 & 0
+.  error
+.endif
+.if 0 & 1
+.  error
+.endif
+.if !(1 & 1)
+.  error
+.endif
+
+# There is no operator &&&.
+.if 0 &&& 0
+.  error
+.endif
+
 all:
 	@:;



CVS commit: src/usr.bin/make/unit-tests

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 10 21:40:50 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: deptgt-silent.exp deptgt-silent.mk

Log Message:
make(1): add test for .SILENT


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/deptgt-silent.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/deptgt-silent.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/deptgt-silent.exp
diff -u src/usr.bin/make/unit-tests/deptgt-silent.exp:1.1 src/usr.bin/make/unit-tests/deptgt-silent.exp:1.2
--- src/usr.bin/make/unit-tests/deptgt-silent.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/deptgt-silent.exp	Thu Sep 10 21:40:50 2020
@@ -1 +1,3 @@
+This is not echoed because of the @.
+This is not echoed because of the .SILENT.
 exit status 0

Index: src/usr.bin/make/unit-tests/deptgt-silent.mk
diff -u src/usr.bin/make/unit-tests/deptgt-silent.mk:1.2 src/usr.bin/make/unit-tests/deptgt-silent.mk:1.3
--- src/usr.bin/make/unit-tests/deptgt-silent.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/deptgt-silent.mk	Thu Sep 10 21:40:50 2020
@@ -1,8 +1,10 @@
-# $NetBSD: deptgt-silent.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: deptgt-silent.mk,v 1.3 2020/09/10 21:40:50 rillig Exp $
 #
 # Tests for the special target .SILENT in dependency declarations.
 
-# TODO: Implementation
+.SILENT: all
 
 all:
-	@:;
+	@echo 'This is not echoed because of the @.'
+	# Without the .SILENT, the following command would be echoed.
+	echo 'This is not echoed because of the .SILENT.'



CVS commit: src/usr.bin/make/unit-tests

2020-09-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 10 21:22:08 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: deptgt-makeflags.mk

Log Message:
make(1): add test for .MAKEFLAGS


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/deptgt-makeflags.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/deptgt-makeflags.mk
diff -u src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.2 src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.3
--- src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/deptgt-makeflags.mk	Thu Sep 10 21:22:07 2020
@@ -1,8 +1,41 @@
-# $NetBSD: deptgt-makeflags.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: deptgt-makeflags.mk,v 1.3 2020/09/10 21:22:07 rillig Exp $
 #
-# Tests for the special target .MAKEFLAGS in dependency declarations.
+# Tests for the special target .MAKEFLAGS in dependency declarations,
+# which adds command line options later, at parse time.
 
-# TODO: Implementation
+# The -D option sets a variable in the "Global" scope and thus can be
+# undefined later.
+.MAKEFLAGS: -D VAR
+
+.if ${VAR} != 1
+.  error
+.endif
+
+.undef VAR
+
+.if defined(VAR)
+.  error
+.endif
+
+.MAKEFLAGS: -D VAR
+
+.if ${VAR} != 1
+.  error
+.endif
+
+.MAKEFLAGS: VAR="value"' with'\ spaces
+
+.if ${VAR} != "value with spaces"
+.  error
+.endif
+
+# Variables set on the command line as VAR=value are placed in the
+# "Command" scope and thus cannot be undefined.
+.undef VAR
+
+.if ${VAR} != "value with spaces"
+.  error
+.endif
 
 all:
 	@:;



CVS commit: src/tests/usr.bin/make

2020-09-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Sep 10 17:40:34 UTC 2020

Modified Files:
src/tests/usr.bin/make: t_make.sh

Log Message:
Whitespace.  NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/make/t_make.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/make/t_make.sh
diff -u src/tests/usr.bin/make/t_make.sh:1.10 src/tests/usr.bin/make/t_make.sh:1.11
--- src/tests/usr.bin/make/t_make.sh:1.10	Thu Sep 10 17:33:16 2020
+++ src/tests/usr.bin/make/t_make.sh	Thu Sep 10 17:40:34 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_make.sh,v 1.10 2020/09/10 17:33:16 kre Exp $
+# $NetBSD: t_make.sh,v 1.11 2020/09/10 17:40:34 kre Exp $
 #
 # Copyright (c) 2008, 2010, 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -90,7 +90,7 @@ atf_init_test_cases()
 		esac
 	done
 	descr='' # XXX
-test_case "${atfname}" "${basename}" "${descr}"
+	test_case "${atfname}" "${basename}" "${descr}"
 	atf_add_test_case "${atfname}"
 	done
 }



CVS commit: src/tests/usr.bin/make

2020-09-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Sep 10 17:33:17 UTC 2020

Modified Files:
src/tests/usr.bin/make: t_make.sh

Log Message:
Replace use of tr to translate '-' in test names into '_' to satisfy ATF
requirements (correct sh variable/function name syntax).  Use a sh
loop instead, and save one fork() one vfork() and one exec of tr for
each test case (many of which don't need anything done to them at all).

This might partially mitigate PR misc/55595


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/make/t_make.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/make/t_make.sh
diff -u src/tests/usr.bin/make/t_make.sh:1.9 src/tests/usr.bin/make/t_make.sh:1.10
--- src/tests/usr.bin/make/t_make.sh:1.9	Sat Aug 15 01:50:54 2020
+++ src/tests/usr.bin/make/t_make.sh	Thu Sep 10 17:33:16 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_make.sh,v 1.9 2020/08/15 01:50:54 rillig Exp $
+# $NetBSD: t_make.sh,v 1.10 2020/09/10 17:33:16 kre Exp $
 #
 # Copyright (c) 2008, 2010, 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -81,7 +81,14 @@ atf_init_test_cases()
 	include-sub*) continue;;
 	esac
 
-	atfname="$(echo "${basename}" | tr "x-" "x_")"
+	atfname=${basename}
+	while :
+	do
+		case "${atfname}" in
+		(*-*)	atfname=${atfname%-*}_${atfname##*-};;
+		(*)	break;;
+		esac
+	done
 	descr='' # XXX
 test_case "${atfname}" "${basename}" "${descr}"
 	atf_add_test_case "${atfname}"



CVS commit: src/sys/arch/mips/mips

2020-09-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 10 17:26:38 UTC 2020

Modified Files:
src/sys/arch/mips/mips: pmap_machdep.c

Log Message:
Typo in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/mips/mips/pmap_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/mips/pmap_machdep.c
diff -u src/sys/arch/mips/mips/pmap_machdep.c:1.29 src/sys/arch/mips/mips/pmap_machdep.c:1.30
--- src/sys/arch/mips/mips/pmap_machdep.c:1.29	Tue Aug 18 11:21:25 2020
+++ src/sys/arch/mips/mips/pmap_machdep.c	Thu Sep 10 17:26:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_machdep.c,v 1.29 2020/08/18 11:21:25 simonb Exp $	*/
+/*	$NetBSD: pmap_machdep.c,v 1.30 2020/09/10 17:26:38 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.29 2020/08/18 11:21:25 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.30 2020/09/10 17:26:38 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -398,7 +398,7 @@ pmap_bootstrap(void)
 	/* XXX: else runs out of space on 256MB sbmips!! */
 	sysmap_size += 2;
 #endif
-	/* Rounup to a even number of pte page tables */
+	/* Roundup to a even number of pte page tables */
 	sysmap_size = (sysmap_size + NPTEPG - 1) & -NPTEPG;
 
 	/*



CVS commit: src/distrib/sets/lists/base

2020-09-10 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Sep 10 15:17:23 UTC 2020

Modified Files:
src/distrib/sets/lists/base: ad.arm

Log Message:
fix earmv7hfeb set list for bootarm.efi

Do this by explicitly marking all the non-earmv7hf* arm archs as not wanted,
because the set lists processor doesn't have a better way to be told.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/distrib/sets/lists/base/ad.arm

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/base/ad.arm
diff -u src/distrib/sets/lists/base/ad.arm:1.82 src/distrib/sets/lists/base/ad.arm:1.83
--- src/distrib/sets/lists/base/ad.arm:1.82	Tue Sep  8 16:39:36 2020
+++ src/distrib/sets/lists/base/ad.arm	Thu Sep 10 15:17:23 2020
@@ -1,4 +1,4 @@
-# $NetBSD: ad.arm,v 1.82 2020/09/08 16:39:36 jmcneill Exp $
+# $NetBSD: ad.arm,v 1.83 2020/09/10 15:17:23 jakllsch Exp $
 ./libexec/ld.elf_so-oabi			base-sysutil-bin	compat,pic
 ./sbin/ldconfig	base-sysutil-root	pic,endian=1234
 ./usr/bin/fdformatbase-util-bin
@@ -17,7 +17,7 @@
 ./usr/mdec/boot26,ffabase-obsolete		obsolete
 ./usr/mdec/boot32base-sysutil-bin	endian=1234
 ./usr/mdec/boot32,ffabase-sysutil-bin	endian=1234
-./usr/mdec/bootarm.efibase-sysutil-bin	machine_arch=earmv7hf
+./usr/mdec/bootarm.efibase-sysutil-bin	!machine_arch=earmv4,!machine_arch=earmv4eb,!machine_arch=earmv5,!machine_arch=earmv5eb,!machine_arch=earmv5hf,!machine_arch=earmv5hfeb,!machine_arch=earmv6,!machine_arch=earmv6eb,!machine_arch=earmv6hf,!machine_arch=earmv6hfeb,!machine_arch=earmv7,!machine_arch=earmv7eb
 ./usr/mdec/bootimx23base-sysutil-bin	endian=1234
 ./usr/mdec/bootmini2440base-sysutil-bin
 ./usr/mdec/gzboot_ADI_BRH_0x0014.bin	base-sysutil-bin



CVS commit: src/sys/stand/efiboot/bootaa64

2020-09-10 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Sep 10 14:30:15 UTC 2020

Modified Files:
src/sys/stand/efiboot/bootaa64: Makefile

Log Message:
bootaa64: explicitly set GNUEFIARCH and LIBGNUEFI_ARCH to aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/stand/efiboot/bootaa64/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/stand/efiboot/bootaa64/Makefile
diff -u src/sys/stand/efiboot/bootaa64/Makefile:1.9 src/sys/stand/efiboot/bootaa64/Makefile:1.10
--- src/sys/stand/efiboot/bootaa64/Makefile:1.9	Tue Sep  8 16:34:43 2020
+++ src/sys/stand/efiboot/bootaa64/Makefile	Thu Sep 10 14:30:14 2020
@@ -1,8 +1,10 @@
-# $NetBSD: Makefile,v 1.9 2020/09/08 16:34:43 jmcneill Exp $
+# $NetBSD: Makefile,v 1.10 2020/09/10 14:30:14 jakllsch Exp $
 
 PROG=		bootaa64.efi
 OBJFMT=		binary
 NEWVERSWHAT=	"efiboot (arm64)"
+GNUEFIARCH=	aarch64
+LIBGNUEFI_ARCH=	aarch64
 
 EXTRA_SOURCES=	efibootaa64.c
 EXTRA_SOURCES+=	cache.S



CVS commit: src/sys

2020-09-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Sep 10 14:10:47 UTC 2020

Modified Files:
src/sys/arch/aarch64/include: asan.h
src/sys/arch/amd64/include: asan.h
src/sys/arch/arm/include: asan.h
src/sys/kern: subr_asan.c
src/sys/sys: asan.h

Log Message:
kasan: fix the copyright notices


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/aarch64/include/asan.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/amd64/include/asan.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/include/asan.h
cvs rdiff -u -r1.25 -r1.26 src/sys/kern/subr_asan.c
cvs rdiff -u -r1.14 -r1.15 src/sys/sys/asan.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/aarch64/include/asan.h
diff -u src/sys/arch/aarch64/include/asan.h:1.10 src/sys/arch/aarch64/include/asan.h:1.11
--- src/sys/arch/aarch64/include/asan.h:1.10	Sat Sep  5 16:30:10 2020
+++ src/sys/arch/aarch64/include/asan.h	Thu Sep 10 14:10:46 2020
@@ -1,11 +1,10 @@
-/*	$NetBSD: asan.h,v 1.10 2020/09/05 16:30:10 riastradh Exp $	*/
+/*	$NetBSD: asan.h,v 1.11 2020/09/10 14:10:46 maxv Exp $	*/
 
 /*
- * Copyright (c) 2018-2020 The NetBSD Foundation, Inc.
+ * Copyright (c) 2018-2020 Maxime Villard, m00nbsd.net
  * All rights reserved.
  *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Maxime Villard.
+ * This code is part of the KASAN subsystem of the NetBSD kernel.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -16,17 +15,17 @@
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
  *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #include 

Index: src/sys/arch/amd64/include/asan.h
diff -u src/sys/arch/amd64/include/asan.h:1.8 src/sys/arch/amd64/include/asan.h:1.9
--- src/sys/arch/amd64/include/asan.h:1.8	Sat Sep  5 16:30:10 2020
+++ src/sys/arch/amd64/include/asan.h	Thu Sep 10 14:10:46 2020
@@ -1,11 +1,10 @@
-/*	$NetBSD: asan.h,v 1.8 2020/09/05 16:30:10 riastradh Exp $	*/
+/*	$NetBSD: asan.h,v 1.9 2020/09/10 14:10:46 maxv Exp $	*/
 
 /*
- * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * Copyright (c) 2018-2020 Maxime Villard, m00nbsd.net
  * All rights reserved.
  *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Maxime Villard.
+ * This code is part of the KASAN subsystem of the NetBSD kernel.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -16,17 +15,17 @@
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
  *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER 

CVS commit: src/sys

2020-09-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Sep 10 14:04:45 UTC 2020

Modified Files:
src/sys/arch/amd64/include: csan.h
src/sys/kern: subr_csan.c
src/sys/sys: csan.h

Log Message:
kcsan: fix the copyright notices


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amd64/include/csan.h
cvs rdiff -u -r1.9 -r1.10 src/sys/kern/subr_csan.c
cvs rdiff -u -r1.1 -r1.2 src/sys/sys/csan.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/include/csan.h
diff -u src/sys/arch/amd64/include/csan.h:1.3 src/sys/arch/amd64/include/csan.h:1.4
--- src/sys/arch/amd64/include/csan.h:1.3	Fri Nov  8 12:36:11 2019
+++ src/sys/arch/amd64/include/csan.h	Thu Sep 10 14:04:45 2020
@@ -1,11 +1,10 @@
-/*	$NetBSD: csan.h,v 1.3 2019/11/08 12:36:11 maxv Exp $	*/
+/*	$NetBSD: csan.h,v 1.4 2020/09/10 14:04:45 maxv Exp $	*/
 
 /*
- * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * Copyright (c) 2019-2020 Maxime Villard, m00nbsd.net
  * All rights reserved.
  *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Maxime Villard.
+ * This code is part of the KCSAN subsystem of the NetBSD kernel.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -16,17 +15,17 @@
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
  *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #include 

Index: src/sys/kern/subr_csan.c
diff -u src/sys/kern/subr_csan.c:1.9 src/sys/kern/subr_csan.c:1.10
--- src/sys/kern/subr_csan.c:1.9	Tue Jun 30 16:20:02 2020
+++ src/sys/kern/subr_csan.c	Thu Sep 10 14:04:45 2020
@@ -1,11 +1,10 @@
-/*	$NetBSD: subr_csan.c,v 1.9 2020/06/30 16:20:02 maxv Exp $	*/
+/*	$NetBSD: subr_csan.c,v 1.10 2020/09/10 14:04:45 maxv Exp $	*/
 
 /*
- * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * Copyright (c) 2019-2020 Maxime Villard, m00nbsd.net
  * All rights reserved.
  *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Maxime Villard.
+ * This code is part of the KCSAN subsystem of the NetBSD kernel.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -16,21 +15,21 @@
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
  *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE 

CVS commit: src/external/gpl3/gcc

2020-09-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Sep 10 12:53:06 UTC 2020

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
sanitizer_linux_libcdep.cc
src/external/gpl3/gcc/lib: Makefile.sanitizer

Log Message:
Avoid using internal RTLD/libpthread/libc symbol in sanitizers

Cherry-pick and adapt:

commit 0da15ff318480f30bbc90b9e8ecb9bb9431c7fd3
Author: Kamil Rytarowski 
Date:   Fri Jan 3 02:35:33 2020 +0100

[compiler-rt] [netbsd] Switch to syscall for ThreadSelfTlsTcb()

This change avoids using internal, namespaced per-CPU calls that
are not a stable interface to read the TSL base value.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 \

src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
cvs rdiff -u -r1.12 -r1.13 src/external/gpl3/gcc/lib/Makefile.sanitizer

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:1.15 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:1.16
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:1.15	Mon Sep  7 07:10:43 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc	Thu Sep 10 12:53:05 2020
@@ -47,6 +47,7 @@
 #if SANITIZER_NETBSD
 #include 
 #include 
+#include 
 #endif
 
 #if SANITIZER_SOLARIS
@@ -417,13 +418,7 @@ uptr ThreadSelf() {
 
 #if SANITIZER_NETBSD
 static struct tls_tcb * ThreadSelfTlsTcb() {
-  struct tls_tcb * tcb = NULL;
-# ifdef __HAVE___LWP_GETTCB_FAST
-  tcb = (struct tls_tcb *)__lwp_gettcb_fast();
-# elif defined(__HAVE___LWP_GETPRIVATE_FAST)
-  tcb = (struct tls_tcb *)__lwp_getprivate_fast();
-# endif
-  return tcb;
+  return (struct tls_tcb *)_lwp_getprivate();
 }
 
 uptr ThreadSelf() {

Index: src/external/gpl3/gcc/lib/Makefile.sanitizer
diff -u src/external/gpl3/gcc/lib/Makefile.sanitizer:1.12 src/external/gpl3/gcc/lib/Makefile.sanitizer:1.13
--- src/external/gpl3/gcc/lib/Makefile.sanitizer:1.12	Sat Sep  5 13:36:49 2020
+++ src/external/gpl3/gcc/lib/Makefile.sanitizer	Thu Sep 10 12:53:05 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.sanitizer,v 1.12 2020/09/05 13:36:49 mrg Exp $
+#	$NetBSD: Makefile.sanitizer,v 1.13 2020/09/10 12:53:05 kamil Exp $
 
 SANITIZER=${GCCDIST}/libsanitizer
 .PATH: ${SANITIZER}/interception ${SANITIZER}/sanitizer_common
@@ -75,8 +75,6 @@ CSHLIBFLAGS+= -DPIC
 SRCS+=	${INTERCEPTION_SRCS} ${SANITIZER_SRCS}
 CPPFLAGS+=-I${SANITIZER}/include -I${SANITIZER}
 CPPFLAGS.sanitizer_netbsd.cc+=-I${GCCDIST}/gcc/ginclude
-# XXX __lwp_getprivate_fast() is hidden normally.
-CPPFLAGS.sanitizer_linux_libcdep.cc+= -D__LIBPTHREAD_SOURCE__
 # XXX wants old lwp info and power ioctl, npf wants nv.h
 CPPFLAGS.sanitizer_platform_limits_netbsd.cc+= -D__LEGACY_PT_LWPINFO -D_KMEMUSER \
 	-I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist



CVS commit: src/sys/crypto/aes/arch/arm

2020-09-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 10 11:31:04 UTC 2020

Modified Files:
src/sys/crypto/aes/arch/arm: aes_neon_32.S

Log Message:
aes neon: Gather mc_forward/backward so we can load 256 bits at once.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/crypto/aes/arch/arm/aes_neon_32.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/crypto/aes/arch/arm/aes_neon_32.S
diff -u src/sys/crypto/aes/arch/arm/aes_neon_32.S:1.10 src/sys/crypto/aes/arch/arm/aes_neon_32.S:1.11
--- src/sys/crypto/aes/arch/arm/aes_neon_32.S:1.10	Thu Sep 10 11:30:28 2020
+++ src/sys/crypto/aes/arch/arm/aes_neon_32.S	Thu Sep 10 11:31:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: aes_neon_32.S,v 1.10 2020/09/10 11:30:28 riastradh Exp $	*/
+/*	$NetBSD: aes_neon_32.S,v 1.11 2020/09/10 11:31:03 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include 
 
-RCSID("$NetBSD: aes_neon_32.S,v 1.10 2020/09/10 11:30:28 riastradh Exp $")
+RCSID("$NetBSD: aes_neon_32.S,v 1.11 2020/09/10 11:31:03 riastradh Exp $")
 
 	.fpu	neon
 
@@ -54,36 +54,26 @@ inva:
 	.byte	0x09,0x08,0x05,0x02,0x0C,0x0E,0x0D,0x03
 END(inva)
 
-	.type	mc_forward,_ASM_TYPE_OBJECT
-mc_forward:
-	.byte	0x01,0x02,0x03,0x00,0x05,0x06,0x07,0x04	/* 0 */
+	.type	mc,_ASM_TYPE_OBJECT
+mc:
+	.byte	0x01,0x02,0x03,0x00,0x05,0x06,0x07,0x04	/* 0 forward */
 	.byte	0x09,0x0A,0x0B,0x08,0x0D,0x0E,0x0F,0x0C
-
-	.byte	0x05,0x06,0x07,0x04,0x09,0x0A,0x0B,0x08	/* 1 */
+	.byte	0x03,0x00,0x01,0x02,0x07,0x04,0x05,0x06	/* 0 backward */
+	.byte	0x0B,0x08,0x09,0x0A,0x0F,0x0C,0x0D,0x0E
+	.byte	0x05,0x06,0x07,0x04,0x09,0x0A,0x0B,0x08	/* 1 forward */
 	.byte	0x0D,0x0E,0x0F,0x0C,0x01,0x02,0x03,0x00
-
-	.byte	0x09,0x0A,0x0B,0x08,0x0D,0x0E,0x0F,0x0C	/* 2 */
+	.byte	0x0F,0x0C,0x0D,0x0E,0x03,0x00,0x01,0x02	/* 1 backward */
+	.byte	0x07,0x04,0x05,0x06,0x0B,0x08,0x09,0x0A
+	.byte	0x09,0x0A,0x0B,0x08,0x0D,0x0E,0x0F,0x0C	/* 2 forward */
 	.byte	0x01,0x02,0x03,0x00,0x05,0x06,0x07,0x04
-
+	.byte	0x0B,0x08,0x09,0x0A,0x0F,0x0C,0x0D,0x0E	/* 2 backward */
+	.byte	0x03,0x00,0x01,0x02,0x07,0x04,0x05,0x06
 .Lmc_forward_3:
-	.byte	0x0D,0x0E,0x0F,0x0C,0x01,0x02,0x03,0x00	/* 3 */
+	.byte	0x0D,0x0E,0x0F,0x0C,0x01,0x02,0x03,0x00	/* 3 forward */
 	.byte	0x05,0x06,0x07,0x04,0x09,0x0A,0x0B,0x08
-END(mc_forward)
-
-	.type	mc_backward,_ASM_TYPE_OBJECT
-mc_backward:
-	.byte	0x03,0x00,0x01,0x02,0x07,0x04,0x05,0x06	/* 0 */
-	.byte	0x0B,0x08,0x09,0x0A,0x0F,0x0C,0x0D,0x0E
-
-	.byte	0x0F,0x0C,0x0D,0x0E,0x03,0x00,0x01,0x02	/* 1 */
-	.byte	0x07,0x04,0x05,0x06,0x0B,0x08,0x09,0x0A
-
-	.byte	0x0B,0x08,0x09,0x0A,0x0F,0x0C,0x0D,0x0E	/* 2 */
-	.byte	0x03,0x00,0x01,0x02,0x07,0x04,0x05,0x06
-
-	.byte	0x07,0x04,0x05,0x06,0x0B,0x08,0x09,0x0A	/* 3 */
+	.byte	0x07,0x04,0x05,0x06,0x0B,0x08,0x09,0x0A	/* 3 backward */
 	.byte	0x0F,0x0C,0x0D,0x0E,0x03,0x00,0x01,0x02
-END(mc_backward)
+END(mc)
 
 	.type	sr,_ASM_TYPE_OBJECT
 sr:
@@ -210,8 +200,7 @@ ENTRY(aes_neon_enc1)
 
 	/*
 	 * r3: rmod4
-	 * r4: mc_forward
-	 * r5: mc_backward
+	 * r4: mc
 	 * r6,r8,r10,ip: temporaries
 	 * q0={d0-d1}: x/ak/A
 	 * q1={d2-d3}: 0x0f0f...
@@ -225,8 +214,8 @@ ENTRY(aes_neon_enc1)
 	 * q9={d18-d19}: sb2[1]
 	 * q10={d20-d21}: inv
 	 * q11={d22-d23}: inva
-	 * q12={d24-d25}: ir/iak/iakr/sb1_0(io)/mc_backward[rmod4]
-	 * q13={d26-d27}: jr/jak/jakr/sb1_1(jo)/mc_forward[rmod4]
+	 * q12={d24-d25}: ir/iak/iakr/sb1_0(io)/mc[rmod4].backward
+	 * q13={d26-d27}: jr/jak/jakr/sb1_1(jo)/mc[rmod4].forward
 	 * q14={d28-d29}: rk/A2/A2_B_D
 	 * q15={d30-d31}: A2_B/sr[rmod4]
 	 */
@@ -254,9 +243,8 @@ ENTRY(aes_neon_enc1)
 	vld1.8	{q8-q9}, [r6 :256]	/* q8 = sb2[0], q9 = sb2[1] */
 	vld1.8	{q10-q11}, [r8 :256]	/* q10 = inv, q11 = inva */
 
-	/* (r4, r5) := (_forward[0], _backward[0]) */
-	add	r4, ip, #(mc_forward - .Lconstants)
-	add	r5, ip, #(mc_backward - .Lconstants)
+	/* r4 := mc */
+	add	r4, ip, #(mc - .Lconstants)
 
 	/* (q2, q3) := (lo, hi) */
 	vshr.u8	q3, q0, #4
@@ -291,13 +279,11 @@ ENTRY(aes_neon_enc1)
 	vtbl.8	d25, {q8}, d5
 	vtbl.8	d26, {q9}, d6
 	vtbl.8	d27, {q9}, d7
+	add	r6, r4, r3, lsl #5	/* r6 := [rmod4] */
 	veor	q14, q12, q13
 
-	/* (q12, q13) := (mc_forward[rmod4], mc_backward[rmod4]) */
-	add	r6, r4, r3, lsl #4
-	add	r8, r5, r3, lsl #4
-	vld1.8	{q12}, [r6 :128]
-	vld1.8	{q13}, [r8 :128]
+	/* (q12, q13) := (mc[rmod4].forward, mc[rmod4].backward) */
+	vld1.8	{q12-q13}, [r6 :256]
 
 	/* q15 := A2_B = A2 + A(mcf) */
 	vtbl.8	d30, {q0}, d24
@@ -474,7 +460,7 @@ ENTRY(aes_neon_dec1)
 	add	r8, ip, #(.Lmc_forward_3 - .Lconstants)
 	vld1.8	{q6-q7}, [r4 :256]	/* q6 := dsbb[0], q7 := dsbb[1] */
 	vld1.8	{q10-q11}, [r6 :256]	/* q10 := inv, q11 := inva */
-	vld1.8	{q15}, [r8 :128]	/* q15 := mc_forward[3] */
+	vld1.8	{q15}, [r8 :128]	/* q15 := mc[3].forward */
 
 	/* (q2, q3) := (lo, hi) */
 	vshr.u8	q3, q0, #4



CVS commit: src/sys/crypto/aes/arch/arm

2020-09-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 10 11:30:28 UTC 2020

Modified Files:
src/sys/crypto/aes/arch/arm: aes_neon_32.S

Log Message:
aes neon: Hoist dsbd/dsbe address calculation out of loop.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/crypto/aes/arch/arm/aes_neon_32.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/crypto/aes/arch/arm/aes_neon_32.S
diff -u src/sys/crypto/aes/arch/arm/aes_neon_32.S:1.9 src/sys/crypto/aes/arch/arm/aes_neon_32.S:1.10
--- src/sys/crypto/aes/arch/arm/aes_neon_32.S:1.9	Thu Sep 10 11:30:08 2020
+++ src/sys/crypto/aes/arch/arm/aes_neon_32.S	Thu Sep 10 11:30:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: aes_neon_32.S,v 1.9 2020/09/10 11:30:08 riastradh Exp $	*/
+/*	$NetBSD: aes_neon_32.S,v 1.10 2020/09/10 11:30:28 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include 
 
-RCSID("$NetBSD: aes_neon_32.S,v 1.9 2020/09/10 11:30:08 riastradh Exp $")
+RCSID("$NetBSD: aes_neon_32.S,v 1.10 2020/09/10 11:30:28 riastradh Exp $")
 
 	.fpu	neon
 
@@ -431,6 +431,9 @@ ENTRY(aes_neon_dec1)
 
 	/*
 	 * r3: 3 & ~(nrounds - 1)
+	 * r4: dsbd
+	 * r5: dsbe
+	 * r6,r8,r10,ip: temporaries
 	 * q0={d0-d1}: x/ak
 	 * q1={d2-d3}: 0x0f0f...
 	 * q2={d4-d5}: lo/k/j/io
@@ -488,6 +491,10 @@ ENTRY(aes_neon_dec1)
 	add	r4, ip, #(dsb9 - .Lconstants)
 	vld1.8	{q4-q5}, [r4 :256]	/* q4 := dsb9[0], q5 := dsb9[1] */
 
+	/* r4 := dsbd, r5 := dsbe */
+	add	r4, ip, #(dsbd - .Lconstants)
+	add	r5, ip, #(dsbe - .Lconstants)
+
 	/* q0 := rk[0] + diptlo(lo) + dipthi(hi) */
 	veor	q0, q14, q2
 	veor	q0, q0, q3
@@ -496,7 +503,6 @@ ENTRY(aes_neon_dec1)
 
 	_ALIGN_TEXT
 1:	/* load dsbd */
-	add	r4, ip, #(dsbd - .Lconstants)
 	vld1.8	{q8-q9}, [r4 :256]	/* q8 := dsbd[0], q9 := dsbd[1] */
 
 	vld1.8	{q14}, [r0 :128]!	/* q14 = *rk++ */
@@ -522,8 +528,7 @@ ENTRY(aes_neon_dec1)
 	veor	q0, q0, q13
 
 	/* load dsbe */
-	add	r4, ip, #(dsbe - .Lconstants)
-	vld1.8	{q8-q9}, [r4 :256]!	/* q8 := dsbe[0], q9 := dsbe[1] */
+	vld1.8	{q8-q9}, [r5 :256]	/* q8 := dsbe[0], q9 := dsbe[1] */
 
 	/* q0 := x(mc) + dsbb_0(io) + dsbb_1(jo) */
 	vtbl.8	d28, {q0}, d30



CVS commit: src/sys/crypto/aes/arch/arm

2020-09-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 10 11:30:08 UTC 2020

Modified Files:
src/sys/crypto/aes/arch/arm: aes_neon_32.S

Log Message:
aes neon: Tweak register usage.

- Call r12 by its usual name, ip.
- No need for r7 or r11=fp at the moment.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/crypto/aes/arch/arm/aes_neon_32.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/crypto/aes/arch/arm/aes_neon_32.S
diff -u src/sys/crypto/aes/arch/arm/aes_neon_32.S:1.8 src/sys/crypto/aes/arch/arm/aes_neon_32.S:1.9
--- src/sys/crypto/aes/arch/arm/aes_neon_32.S:1.8	Thu Sep 10 11:29:43 2020
+++ src/sys/crypto/aes/arch/arm/aes_neon_32.S	Thu Sep 10 11:30:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: aes_neon_32.S,v 1.8 2020/09/10 11:29:43 riastradh Exp $	*/
+/*	$NetBSD: aes_neon_32.S,v 1.9 2020/09/10 11:30:08 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include 
 
-RCSID("$NetBSD: aes_neon_32.S,v 1.8 2020/09/10 11:29:43 riastradh Exp $")
+RCSID("$NetBSD: aes_neon_32.S,v 1.9 2020/09/10 11:30:08 riastradh Exp $")
 
 	.fpu	neon
 
@@ -205,14 +205,14 @@ ENTRY(aes_neon_enc1)
 	vldr	d1, [sp]		/* d1 := x hi */
 	ldr	r1, [sp, #8]		/* r1 := nrounds */
 #endif
-	push	{r4, r5, r6, r7, r8, r10, r11, lr}
+	push	{r4, r5, r6, r8, r10, lr}
 	vpush	{d8-d15}
 
 	/*
 	 * r3: rmod4
 	 * r4: mc_forward
 	 * r5: mc_backward
-	 * r6,r7,r8,r10,r11,r12: temporaries
+	 * r6,r8,r10,ip: temporaries
 	 * q0={d0-d1}: x/ak/A
 	 * q1={d2-d3}: 0x0f0f...
 	 * q2={d4-d5}: lo/k/j/io
@@ -231,32 +231,32 @@ ENTRY(aes_neon_enc1)
 	 * q15={d30-d31}: A2_B/sr[rmod4]
 	 */
 
-	/* r12 := .Lconstants - .Lconstants_addr, r11 := .Lconstants_addr */
-	ldr	r12, .Lconstants_addr
-	adr	r11, .Lconstants_addr
+	/* ip := .Lconstants - .Lconstants_addr, r10 := .Lconstants_addr */
+	ldr	ip, .Lconstants_addr
+	adr	r10, .Lconstants_addr
 
 	vld1.8	{q14}, [r0 :128]!	/* q14 = *rk++ */
 	movw	r3, #0
 	vmov.i8	q1, #0x0f
 
-	/* r12 := .Lconstants */
-	add	r12, r12, r11
+	/* ip := .Lconstants */
+	add	ip, ip, r10
 
 	/* (q4, q5) := (iptlo, ipthi) */
-	add	r6, r12, #(ipt - .Lconstants)
+	add	r6, ip, #(ipt - .Lconstants)
 	vld1.8	{q4-q5}, [r6 :256]
 
 	/* load the rest of the constants */
-	add	r4, r12, #(sb1 - .Lconstants)
-	add	r6, r12, #(sb2 - .Lconstants)
-	add	r8, r12, #(.Linv_inva - .Lconstants)
+	add	r4, ip, #(sb1 - .Lconstants)
+	add	r6, ip, #(sb2 - .Lconstants)
+	add	r8, ip, #(.Linv_inva - .Lconstants)
 	vld1.8	{q6-q7}, [r4 :256]	/* q6 = sb1[0], q7 = sb1[1] */
 	vld1.8	{q8-q9}, [r6 :256]	/* q8 = sb2[0], q9 = sb2[1] */
 	vld1.8	{q10-q11}, [r8 :256]	/* q10 = inv, q11 = inva */
 
 	/* (r4, r5) := (_forward[0], _backward[0]) */
-	add	r4, r12, #(mc_forward - .Lconstants)
-	add	r5, r12, #(mc_backward - .Lconstants)
+	add	r4, ip, #(mc_forward - .Lconstants)
+	add	r5, ip, #(mc_backward - .Lconstants)
 
 	/* (q2, q3) := (lo, hi) */
 	vshr.u8	q3, q0, #4
@@ -295,9 +295,9 @@ ENTRY(aes_neon_enc1)
 
 	/* (q12, q13) := (mc_forward[rmod4], mc_backward[rmod4]) */
 	add	r6, r4, r3, lsl #4
-	add	r7, r5, r3, lsl #4
+	add	r8, r5, r3, lsl #4
 	vld1.8	{q12}, [r6 :128]
-	vld1.8	{q13}, [r7 :128]
+	vld1.8	{q13}, [r8 :128]
 
 	/* q15 := A2_B = A2 + A(mcf) */
 	vtbl.8	d30, {q0}, d24
@@ -365,8 +365,8 @@ ENTRY(aes_neon_enc1)
 	bne	1b
 
 	/* (q6, q7, q15) := (sbo[0], sbo[1], sr[rmod4]) */
-	add	r8, r12, #(sr - .Lconstants)
-	add	r6, r12, #(sbo - .Lconstants)
+	add	r8, ip, #(sr - .Lconstants)
+	add	r6, ip, #(sbo - .Lconstants)
 	add	r8, r8, r3, lsl #4
 	vld1.8	{q6-q7}, [r6 :256]
 	vld1.8	{q15}, [r8 :128]
@@ -388,7 +388,7 @@ ENTRY(aes_neon_enc1)
 	vtbl.8	d1, {q2}, d31
 
 	vpop	{d8-d15}
-	pop	{r4, r5, r6, r7, r8, r10, r11, lr}
+	pop	{r4, r5, r6, r8, r10, lr}
 #ifdef __SOFTFP__
 #ifdef __ARM_BIG_ENDIAN
 	vmov	r1, r0, d0
@@ -426,7 +426,7 @@ ENTRY(aes_neon_dec1)
 	vldr	d1, [sp]		/* d1 := x hi */
 	ldr	r1, [sp, #8]		/* r1 := nrounds */
 #endif
-	push	{r4, r5, r6, r7, r8, r10, r11, lr}
+	push	{r4, r5, r6, r8, r10, lr}
 	vpush	{d8-d15}
 
 	/*
@@ -449,26 +449,26 @@ ENTRY(aes_neon_dec1)
 	 * q15={d30-d31}: mc/sr[3 & ~(nrounds - 1)]
 	 */
 
-	/* r12 := .Lconstants - .Lconstants_addr, r11 := .Lconstants_addr */
-	ldr	r12, .Lconstants_addr
-	adr	r11, .Lconstants_addr
+	/* ip := .Lconstants - .Lconstants_addr, r10 := .Lconstants_addr */
+	ldr	ip, .Lconstants_addr
+	adr	r10, .Lconstants_addr
 
 	vld1.8	{q14}, [r0 :128]!	/* q14 = *rk++ */
 	rsb	r3, r1, #0		/* r3 := ~(x - 1) = -x */
 	vmov.i8	q1, #0x0f
 	and	r3, r3, #3		/* r3 := 3 & ~(x - 1) */
 
-	/* r12 := .Lconstants */
-	add	r12, r12, r11
+	/* ip := .Lconstants */
+	add	ip, ip, r10
 
 	/* (q4, q5) := (diptlo, dipthi) */
-	add	r6, r12, #(dipt - .Lconstants)
+	add	r6, ip, #(dipt - .Lconstants)
 	vld1.8	{q4-q5}, [r6 :256]
 
 	/* load the rest of the constants */
-	add	r4, r12, #(dsbb - .Lconstants)
-	add	r6, r12, #(.Linv_inva - .Lconstants)
-	add	r8, r12, #(.Lmc_forward_3 - 

CVS commit: src/sys/crypto/aes/arch/arm

2020-09-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 10 11:29:43 UTC 2020

Modified Files:
src/sys/crypto/aes/arch/arm: aes_neon_32.S

Log Message:
aes neon: Write vtbl with {qN} rather than {d(2N)-d(2N+1)}.

Cosmetic; no functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/crypto/aes/arch/arm/aes_neon_32.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/crypto/aes/arch/arm/aes_neon_32.S
diff -u src/sys/crypto/aes/arch/arm/aes_neon_32.S:1.7 src/sys/crypto/aes/arch/arm/aes_neon_32.S:1.8
--- src/sys/crypto/aes/arch/arm/aes_neon_32.S:1.7	Thu Sep 10 11:29:02 2020
+++ src/sys/crypto/aes/arch/arm/aes_neon_32.S	Thu Sep 10 11:29:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: aes_neon_32.S,v 1.7 2020/09/10 11:29:02 riastradh Exp $	*/
+/*	$NetBSD: aes_neon_32.S,v 1.8 2020/09/10 11:29:43 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include 
 
-RCSID("$NetBSD: aes_neon_32.S,v 1.7 2020/09/10 11:29:02 riastradh Exp $")
+RCSID("$NetBSD: aes_neon_32.S,v 1.8 2020/09/10 11:29:43 riastradh Exp $")
 
 	.fpu	neon
 
@@ -264,10 +264,10 @@ ENTRY(aes_neon_enc1)
 	vand	q3, q3, q1		/* q3 := (x >> 4) & 0x0f0f... */
 
 	/* (q2, q3) := (iptlo(lo), ipthi(hi)) */
-	vtbl.8	d4, {d8-d9}, d4
-	vtbl.8	d5, {d8-d9}, d5
-	vtbl.8	d6, {d10-d11}, d6
-	vtbl.8	d7, {d10-d11}, d7
+	vtbl.8	d4, {q4}, d4
+	vtbl.8	d5, {q4}, d5
+	vtbl.8	d6, {q5}, d6
+	vtbl.8	d7, {q5}, d7
 
 	/* q0 := rk[0] + iptlo(lo) + ipthi(hi) */
 	veor	q0, q14, q2
@@ -279,18 +279,18 @@ ENTRY(aes_neon_enc1)
 1:	vld1.8	{q14}, [r0 :128]!	/* q14 = *rk++ */
 
 	/* q0 := A = rk[i] + sb1_0(io) + sb1_1(jo) */
-	vtbl.8	d24, {d12-d13}, d4
-	vtbl.8	d25, {d12-d13}, d5
-	vtbl.8	d26, {d14-d15}, d6
-	vtbl.8	d27, {d14-d15}, d7
+	vtbl.8	d24, {q6}, d4
+	vtbl.8	d25, {q6}, d5
+	vtbl.8	d26, {q7}, d6
+	vtbl.8	d27, {q7}, d7
 	veor	q0, q14, q12
 	veor	q0, q0, q13
 
 	/* q14 := A2 = sb2_0[io] + sb2_1[jo] */
-	vtbl.8	d24, {d16-d17}, d4
-	vtbl.8	d25, {d16-d17}, d5
-	vtbl.8	d26, {d18-d19}, d6
-	vtbl.8	d27, {d18-d19}, d7
+	vtbl.8	d24, {q8}, d4
+	vtbl.8	d25, {q8}, d5
+	vtbl.8	d26, {q9}, d6
+	vtbl.8	d27, {q9}, d7
 	veor	q14, q12, q13
 
 	/* (q12, q13) := (mc_forward[rmod4], mc_backward[rmod4]) */
@@ -300,18 +300,18 @@ ENTRY(aes_neon_enc1)
 	vld1.8	{q13}, [r7 :128]
 
 	/* q15 := A2_B = A2 + A(mcf) */
-	vtbl.8	d30, {d0-d1}, d24
-	vtbl.8	d31, {d0-d1}, d25
+	vtbl.8	d30, {q0}, d24
+	vtbl.8	d31, {q0}, d25
 	veor	q15, q15, q14
 
 	/* q14 := A2_B_D = A2_B + A(mcb) */
-	vtbl.8	d28, {d0-d1}, d26
-	vtbl.8	d29, {d0-d1}, d27
+	vtbl.8	d28, {q0}, d26
+	vtbl.8	d29, {q0}, d27
 	veor	q14, q14, q15
 
 	/* q0 := x = A2_B_D + A2_B(mcf) */
-	vtbl.8	d0, {d30-d31}, d24
-	vtbl.8	d1, {d30-d31}, d25
+	vtbl.8	d0, {q15}, d24
+	vtbl.8	d1, {q15}, d25
 	veor	q0, q0, q14
 
 2:	/*
@@ -324,19 +324,19 @@ ENTRY(aes_neon_enc1)
 	vand	q3, q3, q1		/* q3 := (x >> 4) & 0x0f0f... */
 
 	/* q0 := a/k */
-	vtbl.8	d0, {d22-d23}, d4
-	vtbl.8	d1, {d22-d23}, d5
+	vtbl.8	d0, {q11}, d4
+	vtbl.8	d1, {q11}, d5
 
 	/* q2 := j = i + k */
 	veor	q2, q3, q2
 
 	/* q12 := ir = 1/i */
-	vtbl.8	d24, {d20-d21}, d6
-	vtbl.8	d25, {d20-d21}, d7
+	vtbl.8	d24, {q10}, d6
+	vtbl.8	d25, {q10}, d7
 
 	/* q13 := jr = 1/j */
-	vtbl.8	d26, {d20-d21}, d4
-	vtbl.8	d27, {d20-d21}, d5
+	vtbl.8	d26, {q10}, d4
+	vtbl.8	d27, {q10}, d5
 
 	/* q12 := iak = 1/i + a/k */
 	veor	q12, q12, q0
@@ -345,12 +345,12 @@ ENTRY(aes_neon_enc1)
 	veor	q13, q13, q0
 
 	/* q12 := iakr = 1/(1/i + a/k) */
-	vtbl.8	d24, {d20-d21}, d24
-	vtbl.8	d25, {d20-d21}, d25
+	vtbl.8	d24, {q10}, d24
+	vtbl.8	d25, {q10}, d25
 
 	/* q13 := jakr = 1/(1/j + a/k) */
-	vtbl.8	d26, {d20-d21}, d26
-	vtbl.8	d27, {d20-d21}, d27
+	vtbl.8	d26, {q10}, d26
+	vtbl.8	d27, {q10}, d27
 
 	/* q2 := io = j + 1/(1/i + a/k) */
 	veor	q2, q2, q12
@@ -374,18 +374,18 @@ ENTRY(aes_neon_enc1)
 	vld1.8	{q14}, [r0 :128]!	/* q14 = *rk++ */
 
 	/* (q2, q3) := (sbo_0(io), sbo_1(jo)) */
-	vtbl.8	d4, {d12-d13}, d4
-	vtbl.8	d5, {d12-d13}, d5
-	vtbl.8	d6, {d14-d15}, d6
-	vtbl.8	d7, {d14-d15}, d7
+	vtbl.8	d4, {q6}, d4
+	vtbl.8	d5, {q6}, d5
+	vtbl.8	d6, {q7}, d6
+	vtbl.8	d7, {q7}, d7
 
 	/* q2 := x = rk[nr] + sbo_0(io) + sbo_1(jo) */
 	veor	q2, q2, q14
 	veor	q2, q2, q3
 
 	/* q0 := x(sr[rmod4]) */
-	vtbl.8	d0, {d4-d5}, d30
-	vtbl.8	d1, {d4-d5}, d31
+	vtbl.8	d0, {q2}, d30
+	vtbl.8	d1, {q2}, d31
 
 	vpop	{d8-d15}
 	pop	{r4, r5, r6, r7, r8, r10, r11, lr}
@@ -479,10 +479,10 @@ ENTRY(aes_neon_dec1)
 	vand	q3, q3, q1		/* q3 := (x >> 4) & 0x0f0f... */
 
 	/* (q2, q3) := (diptlo(lo), dipthi(hi)) */
-	vtbl.8	d4, {d8-d9}, d4
-	vtbl.8	d5, {d8-d9}, d5
-	vtbl.8	d6, {d10-d11}, d6
-	vtbl.8	d7, {d10-d11}, d7
+	vtbl.8	d4, {q4}, d4
+	vtbl.8	d5, {q4}, d5
+	vtbl.8	d6, {q5}, d6
+	vtbl.8	d7, {q5}, d7
 
 	/* load dsb9 */
 	add	r4, r12, #(dsb9 - .Lconstants)
@@ -502,22 +502,22 @@ ENTRY(aes_neon_dec1)
 	vld1.8	{q14}, [r0 :128]!	/* q14 = *rk++ */
 
 	/* q0 := rk[i] + dsb9_0(io) + dsb9_1(jo) 

CVS commit: src/sys/crypto/aes/arch/arm

2020-09-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 10 11:29:02 UTC 2020

Modified Files:
src/sys/crypto/aes/arch/arm: aes_neon_32.S

Log Message:
aes neon: Issue 256-bit loads rather than pairs of 128-bit loads.

Not sure why I didn't realize you could do this before!

Saves some temporary registers that can now be allocated to shave off
a few cycles.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/crypto/aes/arch/arm/aes_neon_32.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/crypto/aes/arch/arm/aes_neon_32.S
diff -u src/sys/crypto/aes/arch/arm/aes_neon_32.S:1.6 src/sys/crypto/aes/arch/arm/aes_neon_32.S:1.7
--- src/sys/crypto/aes/arch/arm/aes_neon_32.S:1.6	Sun Aug 16 18:02:03 2020
+++ src/sys/crypto/aes/arch/arm/aes_neon_32.S	Thu Sep 10 11:29:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: aes_neon_32.S,v 1.6 2020/08/16 18:02:03 riastradh Exp $	*/
+/*	$NetBSD: aes_neon_32.S,v 1.7 2020/09/10 11:29:02 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include 
 
-RCSID("$NetBSD: aes_neon_32.S,v 1.6 2020/08/16 18:02:03 riastradh Exp $")
+RCSID("$NetBSD: aes_neon_32.S,v 1.7 2020/09/10 11:29:02 riastradh Exp $")
 
 	.fpu	neon
 
@@ -38,9 +38,10 @@ RCSID("$NetBSD: aes_neon_32.S,v 1.6 2020
 	.long	.Lconstants - .
 
 	.section .rodata
-	.p2align 4
+	.p2align 5
 .Lconstants:
 
+.Linv_inva:	/* inv and inva must be consecutive */
 	.type	inv,_ASM_TYPE_OBJECT
 inv:
 	.byte	0x80,0x01,0x08,0x0D,0x0F,0x06,0x05,0x0E
@@ -99,125 +100,85 @@ sr:
 	.byte	0x08,0x05,0x02,0x0F,0x0C,0x09,0x06,0x03
 END(sr)
 
-	.type	iptlo,_ASM_TYPE_OBJECT
-iptlo:
-	.byte	0x00,0x70,0x2A,0x5A,0x98,0xE8,0xB2,0xC2
+	.type	ipt,_ASM_TYPE_OBJECT
+ipt:
+	.byte	0x00,0x70,0x2A,0x5A,0x98,0xE8,0xB2,0xC2	/* lo */
 	.byte	0x08,0x78,0x22,0x52,0x90,0xE0,0xBA,0xCA
-END(iptlo)
-
-	.type	ipthi,_ASM_TYPE_OBJECT
-ipthi:
-	.byte	0x00,0x4D,0x7C,0x31,0x7D,0x30,0x01,0x4C
+	.byte	0x00,0x4D,0x7C,0x31,0x7D,0x30,0x01,0x4C /* hi */
 	.byte	0x81,0xCC,0xFD,0xB0,0xFC,0xB1,0x80,0xCD
-END(ipthi)
+END(ipt)
 
-	.type	sb1_0,_ASM_TYPE_OBJECT
-sb1_0:
-	.byte	0x00,0x3E,0x50,0xCB,0x8F,0xE1,0x9B,0xB1
+	.type	sb1,_ASM_TYPE_OBJECT
+sb1:
+	.byte	0x00,0x3E,0x50,0xCB,0x8F,0xE1,0x9B,0xB1 /* 0 */
 	.byte	0x44,0xF5,0x2A,0x14,0x6E,0x7A,0xDF,0xA5
-END(sb1_0)
-
-	.type	sb1_1,_ASM_TYPE_OBJECT
-sb1_1:
-	.byte	0x00,0x23,0xE2,0xFA,0x15,0xD4,0x18,0x36
+	.byte	0x00,0x23,0xE2,0xFA,0x15,0xD4,0x18,0x36 /* 1 */
 	.byte	0xEF,0xD9,0x2E,0x0D,0xC1,0xCC,0xF7,0x3B
-END(sb1_1)
+END(sb1)
 
-	.type	sb2_0,_ASM_TYPE_OBJECT
-sb2_0:
-	.byte	0x00,0x24,0x71,0x0B,0xC6,0x93,0x7A,0xE2
+	.type	sb2,_ASM_TYPE_OBJECT
+sb2:
+	.byte	0x00,0x24,0x71,0x0B,0xC6,0x93,0x7A,0xE2 /* 0 */
 	.byte	0xCD,0x2F,0x98,0xBC,0x55,0xE9,0xB7,0x5E
-END(sb2_0)
-
-	.type	sb2_1,_ASM_TYPE_OBJECT
-sb2_1:
-	.byte	0x00,0x29,0xE1,0x0A,0x40,0x88,0xEB,0x69
+	.byte	0x00,0x29,0xE1,0x0A,0x40,0x88,0xEB,0x69 /* 1 */
 	.byte	0x4A,0x23,0x82,0xAB,0xC8,0x63,0xA1,0xC2
-END(sb2_1)
+END(sb2)
 
-	.type	sbo_0,_ASM_TYPE_OBJECT
-sbo_0:
-	.byte	0x00,0xC7,0xBD,0x6F,0x17,0x6D,0xD2,0xD0
+	.type	sbo,_ASM_TYPE_OBJECT
+sbo:
+	.byte	0x00,0xC7,0xBD,0x6F,0x17,0x6D,0xD2,0xD0 /* 0 */
 	.byte	0x78,0xA8,0x02,0xC5,0x7A,0xBF,0xAA,0x15
-END(sbo_0)
-
-	.type	sbo_1,_ASM_TYPE_OBJECT
-sbo_1:
-	.byte	0x00,0x6A,0xBB,0x5F,0xA5,0x74,0xE4,0xCF
+	.byte	0x00,0x6A,0xBB,0x5F,0xA5,0x74,0xE4,0xCF /* 1 */
 	.byte	0xFA,0x35,0x2B,0x41,0xD1,0x90,0x1E,0x8E
-END(sbo_1)
+END(sbo)
 
-	.type	diptlo,_ASM_TYPE_OBJECT
-diptlo:
-	.byte	0x00,0x5F,0x54,0x0B,0x04,0x5B,0x50,0x0F
+	.type	dipt,_ASM_TYPE_OBJECT
+dipt:
+	.byte	0x00,0x5F,0x54,0x0B,0x04,0x5B,0x50,0x0F	/* lo */
 	.byte	0x1A,0x45,0x4E,0x11,0x1E,0x41,0x4A,0x15
-END(diptlo)
-
-	.type	dipthi,_ASM_TYPE_OBJECT
-dipthi:
-	.byte	0x00,0x65,0x05,0x60,0xE6,0x83,0xE3,0x86
+	.byte	0x00,0x65,0x05,0x60,0xE6,0x83,0xE3,0x86	/* hi */
 	.byte	0x94,0xF1,0x91,0xF4,0x72,0x17,0x77,0x12
-END(dipthi)
+END(dipt)
 
-	.type	dsb9_0,_ASM_TYPE_OBJECT
-dsb9_0:
-	.byte	0x00,0xD6,0x86,0x9A,0x53,0x03,0x1C,0x85
+	.type	dsb9,_ASM_TYPE_OBJECT
+dsb9:
+	.byte	0x00,0xD6,0x86,0x9A,0x53,0x03,0x1C,0x85	/* 0 */
 	.byte	0xC9,0x4C,0x99,0x4F,0x50,0x1F,0xD5,0xCA
-END(dsb9_0)
-
-	.type	dsb9_1,_ASM_TYPE_OBJECT
-dsb9_1:
-	.byte	0x00,0x49,0xD7,0xEC,0x89,0x17,0x3B,0xC0
+	.byte	0x00,0x49,0xD7,0xEC,0x89,0x17,0x3B,0xC0	/* 1 */
 	.byte	0x65,0xA5,0xFB,0xB2,0x9E,0x2C,0x5E,0x72
-END(dsb9_1)
+END(dsb9)
 
-	.type	dsbd_0,_ASM_TYPE_OBJECT
-dsbd_0:
-	.byte	0x00,0xA2,0xB1,0xE6,0xDF,0xCC,0x57,0x7D
+	.type	dsbd,_ASM_TYPE_OBJECT
+dsbd:
+	.byte	0x00,0xA2,0xB1,0xE6,0xDF,0xCC,0x57,0x7D	/* 0 */
 	.byte	0x39,0x44,0x2A,0x88,0x13,0x9B,0x6E,0xF5
-END(dsbd_0)
-
-	.type	dsbd_1,_ASM_TYPE_OBJECT
-dsbd_1:
-	.byte	0x00,0xCB,0xC6,0x24,0xF7,0xFA,0xE2,0x3C
+	.byte	0x00,0xCB,0xC6,0x24,0xF7,0xFA,0xE2,0x3C	/* 1 */
 	.byte	0xD3,0xEF,0xDE,0x15,0x0D,0x18,0x31,0x29
-END(dsbd_1)
+END(dsbd)
 
-	.type	dsbb_0,_ASM_TYPE_OBJECT
-dsbb_0:
-	.byte	0x00,0x42,0xB4,0x96,0x92,0x64,0x22,0xD0

CVS commit: src/share/mk

2020-09-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Sep 10 06:02:30 UTC 2020

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
switch sparc to binutils 2.34.  tested on an ss20.


To generate a diff of this commit:
cvs rdiff -u -r1.1207 -r1.1208 src/share/mk/bsd.own.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1207 src/share/mk/bsd.own.mk:1.1208
--- src/share/mk/bsd.own.mk:1.1207	Mon Sep  7 10:19:02 2020
+++ src/share/mk/bsd.own.mk	Thu Sep 10 06:02:30 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1207 2020/09/07 10:19:02 mrg Exp $
+#	$NetBSD: bsd.own.mk,v 1.1208 2020/09/10 06:02:30 mrg Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -161,7 +161,7 @@ EXTERNAL_GDB_SUBDIR=		/does/not/exist
 ${MACHINE_CPU} == "aarch64" || ${MACHINE_CPU} == "arm" || \
 ${MACHINE_ARCH} == "hppa" || ${MACHINE_ARCH} == "sparc64" || \
 ${MACHINE} == "sun2" || ${MACHINE} == "alpha" || \
-${MACHINE_CPU} == "mips"
+${MACHINE_CPU} == "mips" || ${MACHINE} == "sparc"
 HAVE_BINUTILS?=	234
 .else
 HAVE_BINUTILS?=	231