From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B1833138331 for ; Tue, 20 Mar 2018 22:13:33 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7D12AE09C0; Tue, 20 Mar 2018 22:13:32 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 42BA9E09C0 for ; Tue, 20 Mar 2018 22:13:31 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 67E36335C2C for ; Tue, 20 Mar 2018 22:13:30 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id ADA3D216 for ; Tue, 20 Mar 2018 22:13:28 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1521583993.e461935372c17b9715f87b6ce16620046d465add.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/clang/files/6.0.0/, sys-devel/clang/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-devel/clang/clang-6.0.0-r1.ebuild sys-devel/clang/clang-6.0.0.ebuild sys-devel/clang/files/6.0.0/0001-Driver-Avoid-invalidated-iterator-in-insertTargetAnd.patch X-VCS-Directories: sys-devel/clang/files/6.0.0/ sys-devel/clang/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: e461935372c17b9715f87b6ce16620046d465add X-VCS-Branch: master Date: Tue, 20 Mar 2018 22:13:28 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: fd882f1b-9cf6-4ed2-a74f-10b14d4d6eba X-Archives-Hash: 003472b245ab185c0b24d40b72f23f2f commit: e461935372c17b9715f87b6ce16620046d465add Author: Michał Górny gentoo org> AuthorDate: Tue Mar 20 20:19:44 2018 +0000 Commit: Michał Górny gentoo org> CommitDate: Tue Mar 20 22:13:13 2018 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4619353 sys-devel/clang: Backport fix for crash with long cmdline to 6.0.0 Closes: https://bugs.gentoo.org/650082 .../{clang-6.0.0.ebuild => clang-6.0.0-r1.ebuild} | 4 ++ ...d-invalidated-iterator-in-insertTargetAnd.patch | 55 ++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/sys-devel/clang/clang-6.0.0.ebuild b/sys-devel/clang/clang-6.0.0-r1.ebuild similarity index 98% rename from sys-devel/clang/clang-6.0.0.ebuild rename to sys-devel/clang/clang-6.0.0-r1.ebuild index e819506ad55..c001fef8e41 100644 --- a/sys-devel/clang/clang-6.0.0.ebuild +++ b/sys-devel/clang/clang-6.0.0-r1.ebuild @@ -70,6 +70,10 @@ CMAKE_BUILD_TYPE=RelWithDebInfo PATCHES=( # add Prefix include paths for Darwin "${FILESDIR}"/5.0.1/darwin_prefix-include-paths.patch + + # fix Driver crash with CHOST prefix and long command-line + # https://bugs.gentoo.org/650082 + "${FILESDIR}"/6.0.0/0001-Driver-Avoid-invalidated-iterator-in-insertTargetAnd.patch ) # Multilib notes: diff --git a/sys-devel/clang/files/6.0.0/0001-Driver-Avoid-invalidated-iterator-in-insertTargetAnd.patch b/sys-devel/clang/files/6.0.0/0001-Driver-Avoid-invalidated-iterator-in-insertTargetAnd.patch new file mode 100644 index 00000000000..20ba89bf126 --- /dev/null +++ b/sys-devel/clang/files/6.0.0/0001-Driver-Avoid-invalidated-iterator-in-insertTargetAnd.patch @@ -0,0 +1,55 @@ +From 99418eabfbe5378d7a751444856c6c5c656519c4 Mon Sep 17 00:00:00 2001 +From: Serge Pavlov +Date: Mon, 19 Mar 2018 16:13:43 +0000 +Subject: [PATCH 1/2] [Driver] Avoid invalidated iterator in + insertTargetAndModeArgs + +Doing an .insert() can potentially invalidate iterators by reallocating the +vector's storage. When all the stars align just right, this causes segfaults +or glibc aborts. + +Gentoo Linux bug (crashes while building Chromium): https://bugs.gentoo.org/650082. + +Patch by Hector Martin! + +Differential Revision: https://reviews.llvm.org/D44607 + + +git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327863 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + tools/driver/driver.cpp | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp +index fa757da953..1b614accb2 100644 +--- a/tools/driver/driver.cpp ++++ b/tools/driver/driver.cpp +@@ -212,20 +212,21 @@ static void insertTargetAndModeArgs(const ParsedClangName &NameParts, + // Put target and mode arguments at the start of argument list so that + // arguments specified in command line could override them. Avoid putting + // them at index 0, as an option like '-cc1' must remain the first. +- auto InsertionPoint = ArgVector.begin(); +- if (InsertionPoint != ArgVector.end()) ++ int InsertionPoint = 0; ++ if (ArgVector.size() > 0) + ++InsertionPoint; + + if (NameParts.DriverMode) { + // Add the mode flag to the arguments. +- ArgVector.insert(InsertionPoint, ++ ArgVector.insert(ArgVector.begin() + InsertionPoint, + GetStableCStr(SavedStrings, NameParts.DriverMode)); + } + + if (NameParts.TargetIsValid) { + const char *arr[] = {"-target", GetStableCStr(SavedStrings, + NameParts.TargetPrefix)}; +- ArgVector.insert(InsertionPoint, std::begin(arr), std::end(arr)); ++ ArgVector.insert(ArgVector.begin() + InsertionPoint, ++ std::begin(arr), std::end(arr)); + } + } + +-- +2.16.2 +