Verified Commit f7f7951d authored by A. Wilcox's avatar A. Wilcox
Browse files

user/llvm8: Fix segfault while building Rust crates

parent 2d217d05
......@@ -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"
From f7e9f4f4c50245d10ca9869a9f8f3d431dfb6948 Mon Sep 17 00:00:00 2001
From: Warren Ristow <warren_ristow@playstation.sony.com>
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);
}
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment