From nobody Mon Dec 04 20:55:30 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SkbXf3Vcyz52pbD; Mon, 4 Dec 2023 20:55:30 +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 4SkbXf332Dz4Fcw; Mon, 4 Dec 2023 20:55:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701723330; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=G5IGdbRIA1xvwH762iC92a6oaA2rKgJdMjDzHwSRT3g=; b=tPjfhsaSFSGz7mUBAXL2KKHSNTCvMfniE6FVMvAGYdxk8c2dDlc6O4Jkv9KJs1PcXjTafv 1TqjAntDHWTc2e8SSKPqGUghvcGDDFsZLaeNvgU3pzFrAVb9i7YSEd2vF3vuUxnZ4NDb+j dBh7GtHj8TxPO0qgIBvDl5dftmcoycAxKaOGbKaAZyU8Q1mS4uyT0ZWoZjjxK0JOU8pf/P WkF+BNGj34s/3YXBvkcEedGvQ8jqJh1VITGlwqCWOgt4QdR87U4bMIloBLp8mJ7n6piLtV alMu8Po33pdOlG07OrDBF0qiVDaVaK7z+WoMosm0z8hwl11uE7EiPzOWTRcTpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701723330; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=G5IGdbRIA1xvwH762iC92a6oaA2rKgJdMjDzHwSRT3g=; b=ZV6QXERauE/4YtzIdJt0UYP12dVJ3Cu4AvSdjUynfYXDXixvskpFfmHAKlUXBokTiD+LVW 1RYnEOYS0/3fpDc8UlDQ8z4VEjj44o7JlowOa+R+Z6Xk3X0cP8iXsBq9oAZJfrbjCzFNBt 99ZDGG9k6tZpMmAwJincELtEf4ksdBUizyXmxMHch8k+KDHOC5jRrv4hk7+/HZlkbE8B9n bVJAQIvFhDhEJ1ivvJ/nGgIhldUS16CLKtZeAPikbo10TDmfY4Lyb4z+otbC5E+hGa/udd T2EHGRi1grRmcaP1pI/9Lrg+KsRo8T70JNSnoc8VFKR5bDb0amOAOazRznoXPQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701723330; a=rsa-sha256; cv=none; b=lnZPBC0vYXdxFUoaRVFM+i79qXESROf0NQwR1XLXpraiSo8/20KOU4txnRUMSpvufUOSCh 3SMTwVaVol3tgOCvGcNJZrriGAHc5D+N4W4SF+IoMnEr3xcdf4YF1eGBZGwHC71rHLfUZ/ HW1/EzSU1jY2hyzjoEcwaWDTVklmQwzJTcMJPq/9oIh7m7XZJyVKotgnVbkyJiuDx6bm7m G+09J54XPX+9iJvLC+5xD1myswBbTjcwTUQP0yIe70CbOjRRt8T708UdvJOViAVv7s3sue qzQA7MwJefx3NLPPr8vcmToaWzjC5NM93L/G2WC0QMrSPZQ0KFTZKXFaQdMf0g== 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 4SkbXf25YGzhkF; Mon, 4 Dec 2023 20:55:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3B4KtULJ044549; Mon, 4 Dec 2023 20:55:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3B4KtUUb044546; Mon, 4 Dec 2023 20:55:30 GMT (envelope-from git) Date: Mon, 4 Dec 2023 20:55:30 GMT Message-Id: <202312042055.3B4KtUUb044546@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Brooks Davis Subject: git: 3db2bfaf72d6 - main - devel/llvm16: merge backports from FreeBSD src List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3db2bfaf72d6bd5dd92f8a0474883f365acbb016 Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/ports/commit/?id=3db2bfaf72d6bd5dd92f8a0474883f365acbb016 commit 3db2bfaf72d6bd5dd92f8a0474883f365acbb016 Author: Brooks Davis AuthorDate: 2023-12-04 20:42:18 +0000 Commit: Brooks Davis CommitDate: 2023-12-04 20:55:18 +0000 devel/llvm16: merge backports from FreeBSD src These upstream LLVM commits have been merged to FreeBSD's source tree post the 17.0.6 release: 7440e4ed85aa [sanitizer] Add re-execution on FreeBSD when ASLR is detected (#73439) 989879f8fded [Clang] Allow C++11 style initialisation of SVE types. 9ca395b5ade1 [clang][AST] Propagate the contains-errors bit to DeclRefExpr from VarDecl's initializer. While here, be consistant about using 12 digits of commit hash. --- devel/llvm16/Makefile | 2 +- ...port-3450272fc2 => patch-backport-3450272fc281} | 0 devel/llvm16/files/patch-backport-7440e4ed85aa | 79 ++++++++++++++++++++++ ...ckport-962c306a1 => patch-backport-962c306a11d} | 0 devel/llvm16/files/patch-backport-989879f8fded | 38 +++++++++++ devel/llvm16/files/patch-backport-9ca395b5ade1 | 63 +++++++++++++++++ 6 files changed, 181 insertions(+), 1 deletion(-) diff --git a/devel/llvm16/Makefile b/devel/llvm16/Makefile index 77288c9bc607..fe47ead79817 100644 --- a/devel/llvm16/Makefile +++ b/devel/llvm16/Makefile @@ -1,6 +1,6 @@ PORTNAME= llvm DISTVERSION= 16.0.6 -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= devel lang MASTER_SITES= https://github.com/llvm/llvm-project/releases/download/llvmorg-${DISTVERSION:S/rc/-rc/}/ \ https://${PRE_}releases.llvm.org/${LLVM_RELEASE}${RCDIR}/ diff --git a/devel/llvm16/files/patch-backport-3450272fc2 b/devel/llvm16/files/patch-backport-3450272fc281 similarity index 100% rename from devel/llvm16/files/patch-backport-3450272fc2 rename to devel/llvm16/files/patch-backport-3450272fc281 diff --git a/devel/llvm16/files/patch-backport-7440e4ed85aa b/devel/llvm16/files/patch-backport-7440e4ed85aa new file mode 100644 index 000000000000..ce6954226d56 --- /dev/null +++ b/devel/llvm16/files/patch-backport-7440e4ed85aa @@ -0,0 +1,79 @@ +commit 7440e4ed85aa992718d4b5ccd1c97724bc3bdd2c +Author: Dimitry Andric +Date: Mon Nov 27 22:43:33 2023 +0100 + + [sanitizer] Add re-execution on FreeBSD when ASLR is detected (#73439) + + In the FreeBSD base system, re-executing the main binary when ASLR is + detected was implemented in the following commits: + + * freebsd/freebsd-src@7cafe89f9ce33 + * freebsd/freebsd-src@96fe7c8ab0f65 + * freebsd/freebsd-src@930a7c2ac67e1 + * freebsd/freebsd-src@0a736f0a6aeb0 + * freebsd/freebsd-src@4c9a0adad1826 + + Squash all these to bring them into upstream compiler-rt. + + When ASLR is detected to be enabled, this first force-disables ASLR for + the current process, then calls ReExec(). The ReExec() function gets a + FreeBSD specific implementation for finding the path of the executed + program, via the ELF auxiliary vector. This is done without calling into + the regular elf_aux_info(3) function, as that makes use of several + already-intercepted functions. + +diff --git compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp +index d2b3b63f3a7a..8759d96609e5 100644 +--- compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp ++++ compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp +@@ -2323,9 +2323,12 @@ void CheckASLR() { + return; + } + if ((aslr_status & PROC_ASLR_ACTIVE) != 0) { +- Printf("This sanitizer is not compatible with enabled ASLR " +- "and binaries compiled with PIE\n"); +- Die(); ++ VReport(1, "This sanitizer is not compatible with enabled ASLR " ++ "and binaries compiled with PIE\n" ++ "ASLR will be disabled and the program re-executed.\n"); ++ int aslr_ctl = PROC_ASLR_FORCE_DISABLE; ++ CHECK_NE(internal_procctl(P_PID, 0, PROC_ASLR_CTL, &aslr_ctl), -1); ++ ReExec(); + } + # elif SANITIZER_PPC64V2 + // Disable ASLR for Linux PPC64LE. +diff --git compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp +index fcfaa0c36c22..b41f778ea94b 100644 +--- compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp ++++ compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp +@@ -48,12 +48,14 @@ + #if SANITIZER_FREEBSD + #include + #include ++#include + #include + #define pthread_getattr_np pthread_attr_get_np + // The MAP_NORESERVE define has been removed in FreeBSD 11.x, and even before + // that, it was never implemented. So just define it to zero. + #undef MAP_NORESERVE + #define MAP_NORESERVE 0 ++extern const Elf_Auxinfo *__elf_aux_vector; + #endif + + #if SANITIZER_NETBSD +@@ -941,7 +943,14 @@ u64 MonotonicNanoTime() { + void ReExec() { + const char *pathname = "/proc/self/exe"; + +-#if SANITIZER_NETBSD ++#if SANITIZER_FREEBSD ++ for (const auto *aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) { ++ if (aux->a_type == AT_EXECPATH) { ++ pathname = static_cast(aux->a_un.a_ptr); ++ break; ++ } ++ } ++#elif SANITIZER_NETBSD + static const int name[] = { + CTL_KERN, + KERN_PROC_ARGS, diff --git a/devel/llvm16/files/patch-backport-962c306a1 b/devel/llvm16/files/patch-backport-962c306a11d similarity index 100% rename from devel/llvm16/files/patch-backport-962c306a1 rename to devel/llvm16/files/patch-backport-962c306a11d diff --git a/devel/llvm16/files/patch-backport-989879f8fded b/devel/llvm16/files/patch-backport-989879f8fded new file mode 100644 index 000000000000..dc53d35953cf --- /dev/null +++ b/devel/llvm16/files/patch-backport-989879f8fded @@ -0,0 +1,38 @@ +commit 989879f8fded41c732db93864461b3a67b9f1501 +Author: Paul Walker +Date: Thu Jun 22 14:03:28 2023 +0000 + + [Clang] Allow C++11 style initialisation of SVE types. + + Fixes https://github.com/llvm/llvm-project/issues/63223 + + Differential Revision: https://reviews.llvm.org/D153560 + +diff --git clang/lib/CodeGen/CGExprScalar.cpp clang/lib/CodeGen/CGExprScalar.cpp +index 02b80f3aba21..dbba8cc96f81 100644 +--- clang/lib/CodeGen/CGExprScalar.cpp ++++ clang/lib/CodeGen/CGExprScalar.cpp +@@ -1869,6 +1869,23 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) { + return Visit(E->getInit(0)); + } + ++ if (isa(VType)) { ++ if (NumInitElements == 0) { ++ // C++11 value-initialization for the vector. ++ return EmitNullValue(E->getType()); ++ } ++ ++ if (NumInitElements == 1) { ++ Expr *InitVector = E->getInit(0); ++ ++ // Initialize from another scalable vector of the same type. ++ if (InitVector->getType() == E->getType()) ++ return Visit(InitVector); ++ } ++ ++ llvm_unreachable("Unexpected initialization of a scalable vector!"); ++ } ++ + unsigned ResElts = cast(VType)->getNumElements(); + + // Loop over initializers collecting the Value for each, and remembering diff --git a/devel/llvm16/files/patch-backport-9ca395b5ade1 b/devel/llvm16/files/patch-backport-9ca395b5ade1 new file mode 100644 index 000000000000..7a0122918700 --- /dev/null +++ b/devel/llvm16/files/patch-backport-9ca395b5ade1 @@ -0,0 +1,63 @@ +commit 9ca395b5ade105aee63db20534d49a1c58ac76c7 +Author: Haojian Wu +Date: Mon Jul 10 18:22:12 2023 +0200 + + [clang][AST] Propagate the contains-errors bit to DeclRefExpr from VarDecl's initializer. + + Similar to the https://reviews.llvm.org/D86048 (it only sets the bit for C++ + code), we propagate the contains-errors bit for C-code path. + + Fixes https://github.com/llvm/llvm-project/issues/50236 + Fixes https://github.com/llvm/llvm-project/issues/50243 + Fixes https://github.com/llvm/llvm-project/issues/48636 + Fixes https://github.com/llvm/llvm-project/issues/50320 + + Differential Revision: https://reviews.llvm.org/D154861 + +diff --git clang/lib/AST/ComputeDependence.cpp clang/lib/AST/ComputeDependence.cpp +index 632f38f711fb..09df5401d669 100644 +--- clang/lib/AST/ComputeDependence.cpp ++++ clang/lib/AST/ComputeDependence.cpp +@@ -489,7 +489,7 @@ ExprDependence clang::computeDependence(DeclRefExpr *E, const ASTContext &Ctx) { + // more bullets here that we handle by treating the declaration as having a + // dependent type if they involve a placeholder type that can't be deduced.] + if (Type->isDependentType()) +- return Deps | ExprDependence::TypeValueInstantiation; ++ Deps |= ExprDependence::TypeValueInstantiation; + else if (Type->isInstantiationDependentType()) + Deps |= ExprDependence::Instantiation; + +@@ -525,13 +525,13 @@ ExprDependence clang::computeDependence(DeclRefExpr *E, const ASTContext &Ctx) { + // - it names a potentially-constant variable that is initialized with an + // expression that is value-dependent + if (const auto *Var = dyn_cast(Decl)) { +- if (Var->mightBeUsableInConstantExpressions(Ctx)) { +- if (const Expr *Init = Var->getAnyInitializer()) { +- if (Init->isValueDependent()) +- Deps |= ExprDependence::ValueInstantiation; +- if (Init->containsErrors()) +- Deps |= ExprDependence::Error; +- } ++ if (const Expr *Init = Var->getAnyInitializer()) { ++ if (Init->containsErrors()) ++ Deps |= ExprDependence::Error; ++ ++ if (Var->mightBeUsableInConstantExpressions(Ctx) && ++ Init->isValueDependent()) ++ Deps |= ExprDependence::ValueInstantiation; + } + + // - it names a static data member that is a dependent member of the +diff --git clang/test/SemaCXX/cxx11-crashes.cpp clang/test/SemaCXX/cxx11-crashes.cpp +index a15fea336f8c..11bc42315421 100644 +--- clang/test/SemaCXX/cxx11-crashes.cpp ++++ clang/test/SemaCXX/cxx11-crashes.cpp +@@ -65,7 +65,7 @@ namespace b6981007 { + struct S {}; // expected-note 3{{candidate}} + void f() { + S s(1, 2, 3); // expected-error {{no matching}} +- for (auto x : s) { // expected-error {{invalid range expression of}} ++ for (auto x : s) { + // We used to attempt to evaluate the initializer of this variable, + // and crash because it has an undeduced type. + const int &n(x);