From owner-svn-src-vendor@freebsd.org Sat Aug 11 16:29:44 2018 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D58571072688; Sat, 11 Aug 2018 16:29:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CBC9E860AA; Sat, 11 Aug 2018 16:29:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5662019ABF; Sat, 11 Aug 2018 16:29:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7BGTdJU020047; Sat, 11 Aug 2018 16:29:39 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7BGTaAG020033; Sat, 11 Aug 2018 16:29:36 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201808111629.w7BGTaAG020033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 11 Aug 2018 16:29:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r337633 - in vendor/clang/dist-release_70: docs lib/CodeGen lib/Headers lib/Sema test test/CodeGen test/SemaCXX www X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/clang/dist-release_70: docs lib/CodeGen lib/Headers lib/Sema test test/CodeGen test/SemaCXX www X-SVN-Commit-Revision: 337633 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2018 16:29:44 -0000 Author: dim Date: Sat Aug 11 16:29:35 2018 New Revision: 337633 URL: https://svnweb.freebsd.org/changeset/base/337633 Log: Vendor import of clang release_70 branch r339355: https://llvm.org/svn/llvm-project/cfe/branches/release_70@339355 Added: vendor/clang/dist-release_70/test/CodeGen/global-blocks-win32.c (contents, props changed) Modified: vendor/clang/dist-release_70/docs/AddressSanitizer.rst vendor/clang/dist-release_70/docs/MemorySanitizer.rst vendor/clang/dist-release_70/docs/ReleaseNotes.rst vendor/clang/dist-release_70/lib/CodeGen/CGBlocks.cpp vendor/clang/dist-release_70/lib/CodeGen/CGObjCGNU.cpp vendor/clang/dist-release_70/lib/CodeGen/CodeGenAction.cpp vendor/clang/dist-release_70/lib/Headers/unwind.h vendor/clang/dist-release_70/lib/Sema/SemaExprCXX.cpp vendor/clang/dist-release_70/test/SemaCXX/constructor.cpp vendor/clang/dist-release_70/test/lit.cfg.py vendor/clang/dist-release_70/www/cxx_dr_status.html vendor/clang/dist-release_70/www/cxx_status.html vendor/clang/dist-release_70/www/make_cxx_dr_status Modified: vendor/clang/dist-release_70/docs/AddressSanitizer.rst ============================================================================== --- vendor/clang/dist-release_70/docs/AddressSanitizer.rst Sat Aug 11 16:29:32 2018 (r337632) +++ vendor/clang/dist-release_70/docs/AddressSanitizer.rst Sat Aug 11 16:29:35 2018 (r337633) @@ -144,6 +144,12 @@ For more information on leak detector in AddressSaniti and can be enabled using ``ASAN_OPTIONS=detect_leaks=1`` on OS X; however, it is not yet supported on other platforms. +Writable/Executable paging detection +------------------------------------ + +The W^X detection is disabled by default and can be enabled using +``ASAN_OPTIONS=detect_write_exec=1``. + Issue Suppression ================= Modified: vendor/clang/dist-release_70/docs/MemorySanitizer.rst ============================================================================== --- vendor/clang/dist-release_70/docs/MemorySanitizer.rst Sat Aug 11 16:29:32 2018 (r337632) +++ vendor/clang/dist-release_70/docs/MemorySanitizer.rst Sat Aug 11 16:29:35 2018 (r337633) @@ -165,6 +165,13 @@ to: #. Set environment variable `MSAN_OPTIONS=poison_in_dtor=1` before running the program. +Writable/Executable paging detection +==================================== + +You can eable writable-executable page detection in MemorySanitizer by +setting the environment variable `MSAN_OPTIONS=detect_write_exec=1` before +running the program. + Handling external code ====================== Modified: vendor/clang/dist-release_70/docs/ReleaseNotes.rst ============================================================================== --- vendor/clang/dist-release_70/docs/ReleaseNotes.rst Sat Aug 11 16:29:32 2018 (r337632) +++ vendor/clang/dist-release_70/docs/ReleaseNotes.rst Sat Aug 11 16:29:35 2018 (r337633) @@ -284,7 +284,8 @@ libclang Static Analyzer --------------- -- ... +- The new `MmapWriteExec` checker had been introduced to detect attempts to map pages +both writable and executable. ... Modified: vendor/clang/dist-release_70/lib/CodeGen/CGBlocks.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/CodeGen/CGBlocks.cpp Sat Aug 11 16:29:32 2018 (r337632) +++ vendor/clang/dist-release_70/lib/CodeGen/CGBlocks.cpp Sat Aug 11 16:29:35 2018 (r337633) @@ -1213,9 +1213,13 @@ static llvm::Constant *buildGlobalBlock(CodeGenModule auto fields = builder.beginStruct(); bool IsOpenCL = CGM.getLangOpts().OpenCL; + bool IsWindows = CGM.getTarget().getTriple().isOSWindows(); if (!IsOpenCL) { // isa - fields.add(CGM.getNSConcreteGlobalBlock()); + if (IsWindows) + fields.addNullPointer(CGM.Int8PtrPtrTy); + else + fields.add(CGM.getNSConcreteGlobalBlock()); // __flags BlockFlags flags = BLOCK_IS_GLOBAL | BLOCK_HAS_SIGNATURE; @@ -1250,7 +1254,27 @@ static llvm::Constant *buildGlobalBlock(CodeGenModule llvm::Constant *literal = fields.finishAndCreateGlobal( "__block_literal_global", blockInfo.BlockAlign, - /*constant*/ true, llvm::GlobalVariable::InternalLinkage, AddrSpace); + /*constant*/ !IsWindows, llvm::GlobalVariable::InternalLinkage, AddrSpace); + + // Windows does not allow globals to be initialised to point to globals in + // different DLLs. Any such variables must run code to initialise them. + if (IsWindows) { + auto *Init = llvm::Function::Create(llvm::FunctionType::get(CGM.VoidTy, + {}), llvm::GlobalValue::InternalLinkage, ".block_isa_init", + &CGM.getModule()); + llvm::IRBuilder<> b(llvm::BasicBlock::Create(CGM.getLLVMContext(), "entry", + Init)); + b.CreateAlignedStore(CGM.getNSConcreteGlobalBlock(), + b.CreateStructGEP(literal, 0), CGM.getPointerAlign().getQuantity()); + b.CreateRetVoid(); + // We can't use the normal LLVM global initialisation array, because we + // need to specify that this runs early in library initialisation. + auto *InitVar = new llvm::GlobalVariable(CGM.getModule(), Init->getType(), + /*isConstant*/true, llvm::GlobalValue::InternalLinkage, + Init, ".block_isa_init_ptr"); + InitVar->setSection(".CRT$XCLa"); + CGM.addUsedGlobal(InitVar); + } // Return a constant of the appropriately-casted type. llvm::Type *RequiredType = Modified: vendor/clang/dist-release_70/lib/CodeGen/CGObjCGNU.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/CodeGen/CGObjCGNU.cpp Sat Aug 11 16:29:32 2018 (r337632) +++ vendor/clang/dist-release_70/lib/CodeGen/CGObjCGNU.cpp Sat Aug 11 16:29:35 2018 (r337633) @@ -3812,40 +3812,10 @@ llvm::GlobalVariable *CGObjCGNU::ObjCIvarOffsetVariabl // is. This allows code compiled with non-fragile ivars to work correctly // when linked against code which isn't (most of the time). llvm::GlobalVariable *IvarOffsetPointer = TheModule.getNamedGlobal(Name); - if (!IvarOffsetPointer) { - // This will cause a run-time crash if we accidentally use it. A value of - // 0 would seem more sensible, but will silently overwrite the isa pointer - // causing a great deal of confusion. - uint64_t Offset = -1; - // We can't call ComputeIvarBaseOffset() here if we have the - // implementation, because it will create an invalid ASTRecordLayout object - // that we are then stuck with forever, so we only initialize the ivar - // offset variable with a guess if we only have the interface. The - // initializer will be reset later anyway, when we are generating the class - // description. - if (!CGM.getContext().getObjCImplementation( - const_cast(ID))) - Offset = ComputeIvarBaseOffset(CGM, ID, Ivar); - - llvm::ConstantInt *OffsetGuess = llvm::ConstantInt::get(Int32Ty, Offset, - /*isSigned*/true); - // Don't emit the guess in non-PIC code because the linker will not be able - // to replace it with the real version for a library. In non-PIC code you - // must compile with the fragile ABI if you want to use ivars from a - // GCC-compiled class. - if (CGM.getLangOpts().PICLevel) { - llvm::GlobalVariable *IvarOffsetGV = new llvm::GlobalVariable(TheModule, - Int32Ty, false, - llvm::GlobalValue::PrivateLinkage, OffsetGuess, Name+".guess"); - IvarOffsetPointer = new llvm::GlobalVariable(TheModule, - IvarOffsetGV->getType(), false, llvm::GlobalValue::LinkOnceAnyLinkage, - IvarOffsetGV, Name); - } else { - IvarOffsetPointer = new llvm::GlobalVariable(TheModule, - llvm::Type::getInt32PtrTy(VMContext), false, - llvm::GlobalValue::ExternalLinkage, nullptr, Name); - } - } + if (!IvarOffsetPointer) + IvarOffsetPointer = new llvm::GlobalVariable(TheModule, + llvm::Type::getInt32PtrTy(VMContext), false, + llvm::GlobalValue::ExternalLinkage, nullptr, Name); return IvarOffsetPointer; } Modified: vendor/clang/dist-release_70/lib/CodeGen/CodeGenAction.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/CodeGen/CodeGenAction.cpp Sat Aug 11 16:29:32 2018 (r337632) +++ vendor/clang/dist-release_70/lib/CodeGen/CodeGenAction.cpp Sat Aug 11 16:29:35 2018 (r337633) @@ -127,6 +127,7 @@ namespace clang { CodeGenOpts, C, CoverageInfo)), LinkModules(std::move(LinkModules)) { FrontendTimesIsEnabled = TimePasses; + llvm::TimePassesIsEnabled = TimePasses; } llvm::Module *getModule() const { return Gen->GetModule(); } std::unique_ptr takeModule() { Modified: vendor/clang/dist-release_70/lib/Headers/unwind.h ============================================================================== --- vendor/clang/dist-release_70/lib/Headers/unwind.h Sat Aug 11 16:29:32 2018 (r337632) +++ vendor/clang/dist-release_70/lib/Headers/unwind.h Sat Aug 11 16:29:35 2018 (r337633) @@ -154,8 +154,12 @@ struct _Unwind_Control_Block { struct _Unwind_Exception { _Unwind_Exception_Class exception_class; _Unwind_Exception_Cleanup_Fn exception_cleanup; +#if !defined (__USING_SJLJ_EXCEPTIONS__) && defined (__SEH__) + _Unwind_Word private_[6]; +#else _Unwind_Word private_1; _Unwind_Word private_2; +#endif /* The Itanium ABI requires that _Unwind_Exception objects are "double-word * aligned". GCC has interpreted this to mean "use the maximum useful * alignment for the target"; so do we. */ Modified: vendor/clang/dist-release_70/lib/Sema/SemaExprCXX.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/Sema/SemaExprCXX.cpp Sat Aug 11 16:29:32 2018 (r337632) +++ vendor/clang/dist-release_70/lib/Sema/SemaExprCXX.cpp Sat Aug 11 16:29:35 2018 (r337633) @@ -113,9 +113,15 @@ ParsedType Sema::getConstructorName(IdentifierInfo &II break; } } - if (!InjectedClassName && CurClass->isInvalidDecl()) + if (!InjectedClassName) { + if (!CurClass->isInvalidDecl()) { + // FIXME: RequireCompleteDeclContext doesn't check dependent contexts + // properly. Work around it here for now. + Diag(SS.getLastQualifierNameLoc(), + diag::err_incomplete_nested_name_spec) << CurClass << SS.getRange(); + } return ParsedType(); - assert(InjectedClassName && "couldn't find injected class name"); + } QualType T = Context.getTypeDeclType(InjectedClassName); DiagnoseUseOfDecl(InjectedClassName, NameLoc); Added: vendor/clang/dist-release_70/test/CodeGen/global-blocks-win32.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_70/test/CodeGen/global-blocks-win32.c Sat Aug 11 16:29:35 2018 (r337633) @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fblocks -triple i386-pc-windows-msvc %s -emit-llvm -o - -fblocks | FileCheck %s + + +int (^x)(void) = ^() { return 21; }; + + +// Check that the block literal is emitted with a null isa pointer +// CHECK: @__block_literal_global = internal global { i8**, i32, i32, i8*, %struct.__block_descriptor* } { i8** null, + +// Check that _NSConcreteGlobalBlock has the correct dllimport specifier. +// CHECK: @_NSConcreteGlobalBlock = external dllimport global i8* +// Check that we create an initialiser pointer in the correct section (early library initialisation). +// CHECK: @.block_isa_init_ptr = internal constant void ()* @.block_isa_init, section ".CRT$XCLa" + +// Check that we emit an initialiser for it. +// CHECK: define internal void @.block_isa_init() { +// CHECK: store i8** @_NSConcreteGlobalBlock, i8*** getelementptr inbounds ({ i8**, i32, i32, i8*, %struct.__block_descriptor* }, { i8**, i32, i32, i8*, %struct.__block_descriptor* }* @__block_literal_global, i32 0, i32 0), align 4 + Modified: vendor/clang/dist-release_70/test/SemaCXX/constructor.cpp ============================================================================== --- vendor/clang/dist-release_70/test/SemaCXX/constructor.cpp Sat Aug 11 16:29:32 2018 (r337632) +++ vendor/clang/dist-release_70/test/SemaCXX/constructor.cpp Sat Aug 11 16:29:35 2018 (r337633) @@ -86,3 +86,14 @@ A::S::operator int() { return 1; } A::S::~S() {} +namespace PR38286 { + // FIXME: It'd be nice to give more consistent diagnostics for these cases + // (but they're all failing for somewhat different reasons...). + template struct A; + template A::A() {} // expected-error {{incomplete type 'A' named in nested name specifier}} + /*FIXME: needed to recover properly from previous error*/; + template struct B; + template void B::f() {} // expected-error {{out-of-line definition of 'f' from class 'B'}} + template struct C; + template C::~C() {} // expected-error {{no type named 'C' in 'C'}} +} Modified: vendor/clang/dist-release_70/test/lit.cfg.py ============================================================================== --- vendor/clang/dist-release_70/test/lit.cfg.py Sat Aug 11 16:29:32 2018 (r337632) +++ vendor/clang/dist-release_70/test/lit.cfg.py Sat Aug 11 16:29:35 2018 (r337633) @@ -71,7 +71,7 @@ llvm_config.add_tool_substitutions(tools, tool_dirs) config.substitutions.append( ('%hmaptool', "'%s' %s" % (config.python_executable, - os.path.join(config.llvm_tools_dir, 'hmaptool')))) + os.path.join(config.clang_tools_dir, 'hmaptool')))) # Plugins (loadable modules) # TODO: This should be supplied by Makefile or autoconf. Modified: vendor/clang/dist-release_70/www/cxx_dr_status.html ============================================================================== --- vendor/clang/dist-release_70/www/cxx_dr_status.html Sat Aug 11 16:29:32 2018 (r337632) +++ vendor/clang/dist-release_70/www/cxx_dr_status.html Sat Aug 11 16:29:35 2018 (r337633) @@ -28,7 +28,7 @@

C++ Defect Report Support in Clang

-

Last updated: $Date: 2018-07-27 06:41:37 +0200 (Fri, 27 Jul 2018) $

+

Last updated: $Date: 2018-08-06 12:32:02 +0200 (Mon, 06 Aug 2018) $

C++ defect report implementation status

@@ -2021,7 +2021,7 @@ of class templates 330 CD4 Qualification conversions and pointers to arrays of pointers - SVN + Clang 7 331 @@ -7093,7 +7093,7 @@ and POD class 1213 CD3 Array subscripting and xvalues - SVN + Clang 7 1214 @@ -9847,7 +9847,7 @@ and POD class 1672 CD4 Layout compatibility with multiple empty bases - SVN + Clang 7 1673 @@ -9937,7 +9937,7 @@ and POD class 1687 C++14 Conversions of operands of built-in operators - SVN + Clang 7 1688 @@ -9991,7 +9991,7 @@ and POD class 1696 CD4 Temporary lifetime and non-static data member initializers - SVN + Clang 7 1697 @@ -10693,7 +10693,7 @@ and POD class 1813 CD4 Direct vs indirect bases in standard-layout classes - SVN + Clang 7 1814 @@ -11101,7 +11101,7 @@ and POD class 1881 CD4 Standard-layout classes and unnamed bit-fields - SVN + Clang 7 1882 @@ -12535,7 +12535,7 @@ and POD class 2120 CD4 Array as first non-static data member in standard-layout class - SVN + Clang 7 2121 @@ -13189,7 +13189,7 @@ and POD class 2229 tentatively ready Volatile unnamed bit-fields - SVN + Clang 7 2230 Modified: vendor/clang/dist-release_70/www/cxx_status.html ============================================================================== --- vendor/clang/dist-release_70/www/cxx_status.html Sat Aug 11 16:29:32 2018 (r337632) +++ vendor/clang/dist-release_70/www/cxx_status.html Sat Aug 11 16:29:35 2018 (r337633) @@ -26,7 +26,7 @@

C++ Support in Clang

-

Last updated: $Date: 2018-07-27 06:41:37 +0200 (Fri, 27 Jul 2018) $

+

Last updated: $Date: 2018-08-06 12:32:02 +0200 (Mon, 06 Aug 2018) $

Clang fully implements all published ISO C++ standards (C++98 / C++03, P0620R0 (DR) - SVN + Clang 7 @@ -1026,7 +1026,7 @@ and library features that are not part of standard C++ - SVN (P0096R5) + Clang 7 (P0096R5)