From owner-svn-src-all@FreeBSD.ORG Sat Feb 14 23:28:10 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 915C520F; Sat, 14 Feb 2015 23:28:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7AE843D7; Sat, 14 Feb 2015 23:28:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1ENSAdY047021; Sat, 14 Feb 2015 23:28:10 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1ENSA4K047020; Sat, 14 Feb 2015 23:28:10 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201502142328.t1ENSA4K047020@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 14 Feb 2015 23:28:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r278789 - in stable: 10/contrib/llvm/patches 9/contrib/llvm/patches X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Feb 2015 23:28:10 -0000 Author: dim Date: Sat Feb 14 23:28:09 2015 New Revision: 278789 URL: https://svnweb.freebsd.org/changeset/base/278789 Log: Add clang patches corresponding to r278788. Added: stable/9/contrib/llvm/patches/patch-r278788-clang-r201130-pch-miscompilation.diff Changes in other areas also in this revision: Added: stable/10/contrib/llvm/patches/patch-r278788-clang-r201130-pch-miscompilation.diff Added: stable/9/contrib/llvm/patches/patch-r278788-clang-r201130-pch-miscompilation.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/llvm/patches/patch-r278788-clang-r201130-pch-miscompilation.diff Sat Feb 14 23:28:09 2015 (r278789) @@ -0,0 +1,67 @@ +Pull in r201130 from upstream clang trunk (by Ted Kremenek): + + Fix PCH deserialization bug with local static symbols being treated + as local extern. + + This triggered a miscompilation of code using Boost's + function_template.hpp when it was included inside a PCH file. A + local static within that header would be treated as local extern, + resulting in the wrong mangling. This only occurred during PCH + deserialization. + + Fixes and . + +This fixes a crash in audio/murmur, which is using both PCH and Boost. + +Introduced here: http://svnweb.freebsd.org/changeset/base/278788 + +Index: tools/clang/lib/Serialization/ASTReaderDecl.cpp +=================================================================== +--- tools/clang/lib/Serialization/ASTReaderDecl.cpp ++++ tools/clang/lib/Serialization/ASTReaderDecl.cpp +@@ -971,7 +971,7 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::V + VD->setCachedLinkage(VarLinkage); + + // Reconstruct the one piece of the IdentifierNamespace that we need. +- if (VarLinkage != NoLinkage && ++ if (VD->getStorageClass() == SC_Extern && VarLinkage != NoLinkage && + VD->getLexicalDeclContext()->isFunctionOrMethod()) + VD->setLocalExternDecl(); + +Index: tools/clang/test/PCH/local_static.cpp +=================================================================== +--- tools/clang/test/PCH/local_static.cpp ++++ tools/clang/test/PCH/local_static.cpp +@@ -0,0 +1,20 @@ ++// Test this without PCH. ++// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -include %S/local_static.h -fsyntax-only %s -emit-llvm -o %t.no_pch.ll %s ++// RUN: FileCheck --input-file %t.no_pch.ll %s ++ ++// Test with PCH. ++// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -x c++-header -emit-pch -o %t.pch %S/local_static.h ++// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -include-pch %t.pch -emit-llvm -o %t.pch.ll %s ++// RUN: FileCheck --input-file %t.pch.ll %s ++ ++void test(Bar &b) { ++ b.f(); ++ static int s; ++} ++ ++// Check if the mangling of static and local extern variables ++// are correct and preserved by PCH. ++ ++// CHECK: @_ZZ4testR3BarE1s = internal global i32 0, align 4 ++// CHECK: @_ZZN3Bar1fIiEEvvE1y = linkonce_odr constant i32 0, align 4 ++ +Index: tools/clang/test/PCH/local_static.h +=================================================================== +--- tools/clang/test/PCH/local_static.h ++++ tools/clang/test/PCH/local_static.h +@@ -0,0 +1,7 @@ ++class Bar { ++public: ++ template ++ void f() { ++ static const T y = 0; ++ } ++};