From owner-dev-commits-src-all@freebsd.org Thu Aug 5 09:25:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E633E66049C; Thu, 5 Aug 2021 09:25:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgNWg1T76z4nQk; Thu, 5 Aug 2021 09:25:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF65A17861; Thu, 5 Aug 2021 09:25:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1759Povx006686; Thu, 5 Aug 2021 09:25:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759PoD2006685; Thu, 5 Aug 2021 09:25:50 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:50 GMT Message-Id: <202108050925.1759PoD2006685@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: e0174face9bb - stable/13 - Allow building usr.bin/vi with MK_ASAN MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e0174face9bb3fe83dbc92984c32ad4ff32e6b7c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:52 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=e0174face9bb3fe83dbc92984c32ad4ff32e6b7c commit e0174face9bb3fe83dbc92984c32ad4ff32e6b7c Author: Alex Richardson AuthorDate: 2021-07-19 14:04:19 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 09:00:14 +0000 Allow building usr.bin/vi with MK_ASAN We have to namespace the regex functions to avoid duplicate symbol errors. This also ensures that vi doesn't define the libc reg* functions with mismatched signatures. ld: error: duplicate symbol: regcomp >>> defined at sanitizer_common_interceptors.inc:7519 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7519) >>> asan_interceptors.o:(__interceptor_regcomp) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a >>> defined at regcomp.c >>> .../regex/regcomp.c.o:(.text+0x0) ld: error: duplicate symbol: regerror >>> defined at sanitizer_common_interceptors.inc:7543 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7543) >>> asan_interceptors.o:(__interceptor_regerror) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a >>> defined at regerror.c >>> .../regex/regerror.c.o:(.text+0x0) ld: error: duplicate symbol: regexec >>> defined at sanitizer_common_interceptors.inc:7530 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7530) >>> asan_interceptors.o:(__interceptor_regexec) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a >>> defined at regexec.c >>> .../regex/regexec.c.o:(.text+0x0) ld: error: duplicate symbol: regfree >>> defined at sanitizer_common_interceptors.inc:7553 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7553) >>> asan_interceptors.o:(__interceptor_regfree) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a >>> defined at regfree.c >>> .../regex/regfree.c.o:(.text+0x0) Committed upstream as https://github.com/lichray/nvi2/pull/92 Reviewed By: bapt Differential Revision: https://reviews.freebsd.org/D31050 (cherry picked from commit 8ef98a8045d4623edd75b91ce76eedeaa4ad3f01) --- contrib/nvi/regex/regex.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/contrib/nvi/regex/regex.h b/contrib/nvi/regex/regex.h index 20ea7865c0a0..7d788514a54c 100644 --- a/contrib/nvi/regex/regex.h +++ b/contrib/nvi/regex/regex.h @@ -96,6 +96,16 @@ typedef struct { #define REG_LARGE 01000 /* force large representation */ #define REG_BACKR 02000 /* force use of backref code */ +#ifdef USE_WIDECHAR +/* + * Avoid function name conflicts with the system regex functions. + * This is needed e.g. to build with AddressSanitizer. + */ +#define regcomp nvi_regcomp +#define regerror nvi_regerror +#define regexec nvi_regexec +#define regfree nvi_regfree +#endif int regcomp(regex_t *, const RCHAR_T *, int); size_t regerror(int, const regex_t *, char *, size_t); int regexec(const regex_t *,