From f7f7951daabc324db9a74e513ee39a8653c22a1e Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 20 Jun 2020 02:31:03 +0000 Subject: user/llvm8: Fix segfault while building Rust crates --- user/llvm8/APKBUILD | 6 ++++-- user/llvm8/scc-insertion.patch | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 user/llvm8/scc-insertion.patch (limited to 'user/llvm8') diff --git a/user/llvm8/APKBUILD b/user/llvm8/APKBUILD index 0e09db7af..065576966 100644 --- a/user/llvm8/APKBUILD +++ b/user/llvm8/APKBUILD @@ -6,7 +6,7 @@ _pkgname=llvm pkgver=8.0.1 _majorver=${pkgver%%.*} pkgname=$_pkgname$_majorver -pkgrel=0 +pkgrel=1 pkgdesc="Low Level Virtual Machine compiler system, version $_majorver" arch="all" options="!checkroot !dbg" @@ -25,6 +25,7 @@ source="https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/l more-secure-plt.patch even-more-secure-plt.patch python3-test.patch + scc-insertion.patch " builddir="$srcdir/$_pkgname-$pkgver.src" @@ -233,4 +234,5 @@ caeec8e4dbd92f5f74940780b69075f3879a267a8623822cbdc193fd14706eb089071e3a5a20d60c e5ddbc4b6c4928e79846dc3c022eb7928aaa8fed40515c78f5f03b8ab8264f34f1eb8aa8bfc0f436450932f4917e54ad261603032092ea271d9590f11a37cf1e musl-ppc64-elfv2.patch 7ba7f5b396e1afb49ea53fdc16729f0709fbba88de433cc8a8e2f751d13733011d4121318f68d7f8a16a6c57c3a1bee727cc3e0da0f5c6cae38eff70d3a539cf more-secure-plt.patch deb71762721ebc73bfdf23143b582f40c70eddcef3e337ed14499e8e336bee2906292d38d64fe98fa633430c1bcb66cf6a2e067258c8fbe6e931f99f6d10a6f7 even-more-secure-plt.patch -53cc0d13dd871e9b775bb4e7567de4f9a97d91b8246cd7ce74607fd88d6e3e2ab9455f5b4195bc7f9dbdedbc77d659d43e98ec0b7cd78cd395aaea6919510287 python3-test.patch" +53cc0d13dd871e9b775bb4e7567de4f9a97d91b8246cd7ce74607fd88d6e3e2ab9455f5b4195bc7f9dbdedbc77d659d43e98ec0b7cd78cd395aaea6919510287 python3-test.patch +4422a83ea953a6b30cb447a448d246956abd6b0cbd2451247e5f2c41318b2c0d18c7b6781155ea40a5558bbd66e9e1482cec0875d95776545fd0d87356b5e4bd scc-insertion.patch" diff --git a/user/llvm8/scc-insertion.patch b/user/llvm8/scc-insertion.patch new file mode 100644 index 000000000..b2d7d511a --- /dev/null +++ b/user/llvm8/scc-insertion.patch @@ -0,0 +1,33 @@ +From f7e9f4f4c50245d10ca9869a9f8f3d431dfb6948 Mon Sep 17 00:00:00 2001 +From: Warren Ristow +Date: Tue, 14 Jan 2020 10:30:24 -0800 +Subject: [PATCH] SCC: Allow ReplaceNode to safely support insertion + +If scc_iterator::ReplaceNode is inserting a new entry in the map, +rather than replacing an existing entry, the possibility of growing +the map could cause a failure. This change safely implements the +insertion. + +Reviewed By: probinson + +Differential Revision: https://reviews.llvm.org/D72469 +--- + include/llvm/ADT/SCCIterator.h | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/include/llvm/ADT/SCCIterator.h b/include/llvm/ADT/SCCIterator.h +index eb1a5d0938cf..1e642b9f75d3 100644 +--- a/include/llvm/ADT/SCCIterator.h ++++ b/include/llvm/ADT/SCCIterator.h +@@ -134,7 +134,10 @@ class scc_iterator : public iterator_facade_base< + /// has been deleted, and \c New is to be used in its place. + void ReplaceNode(NodeRef Old, NodeRef New) { + assert(nodeVisitNumbers.count(Old) && "Old not in scc_iterator?"); +- nodeVisitNumbers[New] = nodeVisitNumbers[Old]; ++ // Do the assignment in two steps, in case 'New' is not yet in the map, and ++ // inserting it causes the map to grow. ++ auto tempVal = nodeVisitNumbers[Old]; ++ nodeVisitNumbers[New] = tempVal; + nodeVisitNumbers.erase(Old); + } + }; -- cgit v1.2.3-70-g09d2