Date: Sat, 11 Aug 2018 16:29:36 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> 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 Message-ID: <201808111629.w7BGTaAG020033@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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<ObjCInterfaceDecl *>(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<llvm::Module> 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<typename> struct A; + template<typename T> A<T>::A() {} // expected-error {{incomplete type 'A' named in nested name specifier}} + /*FIXME: needed to recover properly from previous error*/; + template<typename> struct B; + template<typename T> void B<T>::f() {} // expected-error {{out-of-line definition of 'f' from class 'B<type-parameter-0-0>'}} + template<typename> struct C; + template<typename T> C<T>::~C() {} // expected-error {{no type named 'C' in 'C<type-parameter-0-0>'}} +} 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 @@ <!--*************************************************************************--> <h1>C++ Defect Report Support in Clang</h1> <!--*************************************************************************--> -<p>Last updated: $Date: 2018-07-27 06:41:37 +0200 (Fri, 27 Jul 2018) $</p> +<p>Last updated: $Date: 2018-08-06 12:32:02 +0200 (Mon, 06 Aug 2018) $</p> <h2 id="cxxdr">C++ defect report implementation status</h2> @@ -2021,7 +2021,7 @@ of class templates</td> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#330">330</a></td> <td>CD4</td> <td>Qualification conversions and pointers to arrays of pointers</td> - <td class="svn" align="center">SVN</td> + <td class="svn" align="center">Clang 7</td> </tr> <tr id="331"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#331">331</a></td> @@ -7093,7 +7093,7 @@ and <I>POD class</I></td> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1213">1213</a></td> <td>CD3</td> <td>Array subscripting and xvalues</td> - <td class="svn" align="center">SVN</td> + <td class="svn" align="center">Clang 7</td> </tr> <tr id="1214"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1214">1214</a></td> @@ -9847,7 +9847,7 @@ and <I>POD class</I></td> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1672">1672</a></td> <td>CD4</td> <td>Layout compatibility with multiple empty bases</td> - <td class="svn" align="center">SVN</td> + <td class="svn" align="center">Clang 7</td> </tr> <tr id="1673"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1673">1673</a></td> @@ -9937,7 +9937,7 @@ and <I>POD class</I></td> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1687">1687</a></td> <td>C++14</td> <td>Conversions of operands of built-in operators</td> - <td class="svn" align="center">SVN</td> + <td class="svn" align="center">Clang 7</td> </tr> <tr id="1688"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#1688">1688</a></td> @@ -9991,7 +9991,7 @@ and <I>POD class</I></td> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1696">1696</a></td> <td>CD4</td> <td>Temporary lifetime and non-static data member initializers</td> - <td class="svn" align="center">SVN</td> + <td class="svn" align="center">Clang 7</td> </tr> <tr class="open" id="1697"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1697">1697</a></td> @@ -10693,7 +10693,7 @@ and <I>POD class</I></td> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1813">1813</a></td> <td>CD4</td> <td>Direct vs indirect bases in standard-layout classes</td> - <td class="svn" align="center">SVN</td> + <td class="svn" align="center">Clang 7</td> </tr> <tr id="1814"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1814">1814</a></td> @@ -11101,7 +11101,7 @@ and <I>POD class</I></td> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1881">1881</a></td> <td>CD4</td> <td>Standard-layout classes and unnamed bit-fields</td> - <td class="svn" align="center">SVN</td> + <td class="svn" align="center">Clang 7</td> </tr> <tr id="1882"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1882">1882</a></td> @@ -12535,7 +12535,7 @@ and <I>POD class</I></td> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2120">2120</a></td> <td>CD4</td> <td>Array as first non-static data member in standard-layout class</td> - <td class="svn" align="center">SVN</td> + <td class="svn" align="center">Clang 7</td> </tr> <tr class="open" id="2121"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2121">2121</a></td> @@ -13189,7 +13189,7 @@ and <I>POD class</I></td> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2229">2229</a></td> <td>tentatively ready</td> <td>Volatile unnamed bit-fields</td> - <td class="svn" align="center">SVN</td> + <td class="svn" align="center">Clang 7</td> </tr> <tr id="2230"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#2230">2230</a></td> 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 @@ <!--*************************************************************************--> <h1>C++ Support in Clang</h1> <!--*************************************************************************--> -<p>Last updated: $Date: 2018-07-27 06:41:37 +0200 (Fri, 27 Jul 2018) $</p> +<p>Last updated: $Date: 2018-08-06 12:32:02 +0200 (Mon, 06 Aug 2018) $</p> <p>Clang fully implements all published ISO C++ standards (<a href="#cxx98">C++98 / C++03</a>, <a @@ -707,7 +707,7 @@ version 3.7. <tr> <!-- from Kona 2017 --> <td><a href="http://wg21.link/p0620r1">P0620R0</a> (<a href="#dr">DR</a>)</td> - <td class="svn" align="center">SVN</td> + <td class="svn" align="center">Clang 7</td> </tr> <tr> <!-- from Toronto 2017 --> @@ -1026,7 +1026,7 @@ and library features that are not part of standard C++ </tr> <tr> <td class="svn" align="center"> - SVN (<a href="http://wg21.link/p0096r5">P0096R5</a>)</a> + Clang 7 (<a href="http://wg21.link/p0096r5">P0096R5</a>)</a> </td> </tr> <!-- FIXME: Implement latest recommendations. Modified: vendor/clang/dist-release_70/www/make_cxx_dr_status ============================================================================== --- vendor/clang/dist-release_70/www/make_cxx_dr_status Sat Aug 11 16:29:32 2018 (r337632) +++ vendor/clang/dist-release_70/www/make_cxx_dr_status Sat Aug 11 16:29:35 2018 (r337633) @@ -108,8 +108,11 @@ def availability(issue): if status == 'unknown': avail = 'Unknown' avail_style = ' class="none"' - elif status == '7': + elif status == '8': avail = 'SVN' + avail_style = ' class="svn"' + elif status == '7': + avail = 'Clang 7' avail_style = ' class="svn"' elif re.match('^[0-9]+\.?[0-9]*', status): avail = 'Clang %s' % status
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808111629.w7BGTaAG020033>