From owner-svn-src-vendor@freebsd.org Tue Dec 12 00:51:40 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C9B5E819A8; Tue, 12 Dec 2017 00:51:40 +0000 (UTC) (envelope-from markj@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 mx1.freebsd.org (Postfix) with ESMTPS id 2CFB81B9E; Tue, 12 Dec 2017 00:51:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBC0pdJW043905; Tue, 12 Dec 2017 00:51:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBC0pdrX043904; Tue, 12 Dec 2017 00:51:39 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201712120051.vBC0pdrX043904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 12 Dec 2017 00:51:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r326785 - vendor-sys/illumos/dist/uts/common/dtrace X-SVN-Group: vendor-sys X-SVN-Commit-Author: markj X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/dtrace X-SVN-Commit-Revision: 326785 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.25 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: Tue, 12 Dec 2017 00:51:40 -0000 Author: markj Date: Tue Dec 12 00:51:39 2017 New Revision: 326785 URL: https://svnweb.freebsd.org/changeset/base/326785 Log: 8880 improve DTrace error checking illumos/illumos-gate@2cf374268f3e1c9e9be6367466b183d27632583a https://github.com/illumos/illumos-gate/commit/2cf374268f3e1c9e9be6367466b183d27632583a https://www.illumos.org/issues/8880 Reviewed by: Tim Kordas Reviewed by: Bryan Cantrill Reviewed by: Richard Lowe Approved by: Dan McDonald Author: Jerry Jelinek Modified: vendor-sys/illumos/dist/uts/common/dtrace/dtrace.c Modified: vendor-sys/illumos/dist/uts/common/dtrace/dtrace.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/dtrace/dtrace.c Mon Dec 11 23:15:43 2017 (r326784) +++ vendor-sys/illumos/dist/uts/common/dtrace/dtrace.c Tue Dec 12 00:51:39 2017 (r326785) @@ -13119,6 +13119,7 @@ static int dtrace_dof_relocate(dof_hdr_t *dof, dof_sec_t *sec, uint64_t ubase) { uintptr_t daddr = (uintptr_t)dof; + uintptr_t ts_end; dof_relohdr_t *dofr = (dof_relohdr_t *)(uintptr_t)(daddr + sec->dofs_offset); dof_sec_t *ss, *rs, *ts; @@ -13134,6 +13135,7 @@ dtrace_dof_relocate(dof_hdr_t *dof, dof_sec_t *sec, ui ss = dtrace_dof_sect(dof, DOF_SECT_STRTAB, dofr->dofr_strtab); rs = dtrace_dof_sect(dof, DOF_SECT_RELTAB, dofr->dofr_relsec); ts = dtrace_dof_sect(dof, DOF_SECT_NONE, dofr->dofr_tgtsec); + ts_end = (uintptr_t)ts + sizeof (dof_sec_t); if (ss == NULL || rs == NULL || ts == NULL) return (-1); /* dtrace_dof_error() has been called already */ @@ -13156,6 +13158,11 @@ dtrace_dof_relocate(dof_hdr_t *dof, dof_sec_t *sec, ui case DOF_RELO_SETX: if (r->dofr_offset >= ts->dofs_size || r->dofr_offset + sizeof (uint64_t) > ts->dofs_size) { + dtrace_dof_error(dof, "bad relocation offset"); + return (-1); + } + + if (taddr >= (uintptr_t)ts && taddr < ts_end) { dtrace_dof_error(dof, "bad relocation offset"); return (-1); } From owner-svn-src-vendor@freebsd.org Thu Dec 14 22:56:58 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF8DBE92BD9; Thu, 14 Dec 2017 22:56:58 +0000 (UTC) (envelope-from jkim@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 mx1.freebsd.org (Postfix) with ESMTPS id 338307D7AA; Thu, 14 Dec 2017 22:56:58 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBEMuu8g031721; Thu, 14 Dec 2017 22:56:56 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBEMurA9031683; Thu, 14 Dec 2017 22:56:53 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201712142256.vBEMurA9031683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 14 Dec 2017 22:56:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r326864 - in vendor-sys/acpica/dist: . generate/unix/acpinames source/common source/compiler source/components/debugger source/components/disassembler source/components/dispatcher sourc... X-SVN-Group: vendor-sys X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in vendor-sys/acpica/dist: . generate/unix/acpinames source/common source/compiler source/components/debugger source/components/disassembler source/components/dispatcher source/components/executer sou... X-SVN-Commit-Revision: 326864 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.25 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: Thu, 14 Dec 2017 22:56:59 -0000 Author: jkim Date: Thu Dec 14 22:56:53 2017 New Revision: 326864 URL: https://svnweb.freebsd.org/changeset/base/326864 Log: Import ACPICA 20171214. Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/generate/unix/acpinames/Makefile vendor-sys/acpica/dist/source/common/adisasm.c vendor-sys/acpica/dist/source/common/dmswitch.c vendor-sys/acpica/dist/source/common/dmtable.c vendor-sys/acpica/dist/source/common/dmtables.c vendor-sys/acpica/dist/source/common/dmtbdump.c vendor-sys/acpica/dist/source/compiler/aslcodegen.c vendor-sys/acpica/dist/source/compiler/aslcompile.c vendor-sys/acpica/dist/source/compiler/asldebug.c vendor-sys/acpica/dist/source/compiler/aslfiles.c vendor-sys/acpica/dist/source/compiler/asloptions.c vendor-sys/acpica/dist/source/compiler/aslparseop.c vendor-sys/acpica/dist/source/compiler/aslstartup.c vendor-sys/acpica/dist/source/compiler/aslsupport.l vendor-sys/acpica/dist/source/compiler/asltree.c vendor-sys/acpica/dist/source/compiler/aslutils.c vendor-sys/acpica/dist/source/compiler/cvcompiler.c vendor-sys/acpica/dist/source/compiler/cvdisasm.c vendor-sys/acpica/dist/source/compiler/cvparser.c vendor-sys/acpica/dist/source/compiler/dtcompile.c vendor-sys/acpica/dist/source/compiler/dttable1.c vendor-sys/acpica/dist/source/compiler/prscan.c vendor-sys/acpica/dist/source/components/debugger/dbfileio.c vendor-sys/acpica/dist/source/components/disassembler/dmwalk.c vendor-sys/acpica/dist/source/components/dispatcher/dspkginit.c vendor-sys/acpica/dist/source/components/executer/exdump.c vendor-sys/acpica/dist/source/components/hardware/hwvalid.c vendor-sys/acpica/dist/source/components/namespace/nsxfeval.c vendor-sys/acpica/dist/source/components/parser/psutils.c vendor-sys/acpica/dist/source/components/utilities/utdebug.c vendor-sys/acpica/dist/source/components/utilities/utnonansi.c vendor-sys/acpica/dist/source/components/utilities/utosi.c vendor-sys/acpica/dist/source/components/utilities/uttrack.c vendor-sys/acpica/dist/source/include/acexcep.h vendor-sys/acpica/dist/source/include/acglobal.h vendor-sys/acpica/dist/source/include/acpixf.h vendor-sys/acpica/dist/source/include/actypes.h vendor-sys/acpica/dist/source/include/acutils.h vendor-sys/acpica/dist/source/os_specific/service_layers/osgendbg.c vendor-sys/acpica/dist/source/tools/acpiexec/aehandlers.c vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c vendor-sys/acpica/dist/source/tools/acpihelp/acpihelp.h vendor-sys/acpica/dist/source/tools/acpihelp/ahdecode.c vendor-sys/acpica/dist/source/tools/acpixtract/acpixtract.c Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/changes.txt Thu Dec 14 22:56:53 2017 (r326864) @@ -1,4 +1,44 @@ ---------------------------------------- +14 December 2017. Summary of changes for version 20171214: + + +1) ACPICA kernel-resident subsystem: + +Fixed a regression in the external (public) AcpiEvaluateObjectTyped +interface where the optional "pathname" argument had inadvertently become +a required argument returning an error if omitted (NULL pointer +argument). + +Fixed two possible memory leaks related to the recently developed "late +resolution" of reference objects within ASL Package Object definitions. + +Added two recently defined _OSI strings: "Windows 2016" and "Windows +2017". Mario Limonciello. + +Implemented and deployed a safer version of the C library function +strncpy: AcpiUtSafeStrncpy. The intent is to at least prevent the +creation of unterminated strings as a possible result of a standard +strncpy. + +Cleaned up and restructured the global variable file (acglobal.h). There +are many changes, but no functional changes. + + +2) iASL Compiler/Disassembler and Tools: + +iASL Table Compiler: Fixed a problem with the DBG2 ACPI table where the +optional OemData field at the end of the table was incorrectly required +for proper compilation. It is now correctly an optional field. + +ASLTS: The entire suite was converted from standard ASL to the ASL+ +language, using the ASL-to-ASL+ converter which is integrated into the +iASL compiler. A binary compare of all output files has verified the +correctness of the conversion. + +iASL: Fixed the source code build for platforms where "char" is unsigned. +This affected the iASL lexer only. Jung-uk Kim. + +---------------------------------------- 10 November 2017. Summary of changes for version 20171110: Modified: vendor-sys/acpica/dist/generate/unix/acpinames/Makefile ============================================================================== --- vendor-sys/acpica/dist/generate/unix/acpinames/Makefile Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/generate/unix/acpinames/Makefile Thu Dec 14 22:56:53 2017 (r326864) @@ -113,6 +113,7 @@ OBJECTS = \ $(OBJDIR)/utmath.o\ $(OBJDIR)/utmisc.o\ $(OBJDIR)/utmutex.o\ + $(OBJDIR)/utnonansi.o\ $(OBJDIR)/utobject.o\ $(OBJDIR)/utosi.o\ $(OBJDIR)/utownerid.o\ Modified: vendor-sys/acpica/dist/source/common/adisasm.c ============================================================================== --- vendor-sys/acpica/dist/source/common/adisasm.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/common/adisasm.c Thu Dec 14 22:56:53 2017 (r326864) @@ -457,9 +457,9 @@ AdDisassembleOneTable ( * (.xxx) file produced from the converter in case if * it fails to get deleted. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { - strncpy (Table->Signature, AcpiGbl_TableSig, 4); + strncpy (Table->Signature, AcpiGbl_TableSig, ACPI_NAME_SIZE); } #endif Modified: vendor-sys/acpica/dist/source/common/dmswitch.c ============================================================================== --- vendor-sys/acpica/dist/source/common/dmswitch.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/common/dmswitch.c Thu Dec 14 22:56:53 2017 (r326864) @@ -543,6 +543,10 @@ AcpiDmIsSwitchBlock ( * statement, so check for it. */ CurrentOp = StoreOp->Common.Next->Common.Next; + if (!CurrentOp) + { + return (FALSE); + } if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP) { CurrentOp = CurrentOp->Common.Next; Modified: vendor-sys/acpica/dist/source/common/dmtable.c ============================================================================== --- vendor-sys/acpica/dist/source/common/dmtable.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/common/dmtable.c Thu Dec 14 22:56:53 2017 (r326864) @@ -1654,7 +1654,6 @@ AcpiDmDumpTable ( break; - case ACPI_DMT_FADTPM: /* FADT Preferred PM Profile names */ Modified: vendor-sys/acpica/dist/source/common/dmtables.c ============================================================================== --- vendor-sys/acpica/dist/source/common/dmtables.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/common/dmtables.c Thu Dec 14 22:56:53 2017 (r326864) @@ -314,7 +314,7 @@ AdCreateTableHeader ( /* * Print comments that come before this definition block. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { ASL_CV_PRINT_ONE_COMMENT(AcpiGbl_ParseOpRoot,AML_COMMENT_STANDARD, NULL, 0); } @@ -517,7 +517,7 @@ AdParseTable ( } #ifdef ACPI_ASL_COMPILER - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { AcpiGbl_ParseOpRoot->Common.CvFilename = AcpiGbl_FileTreeRoot->Filename; } Modified: vendor-sys/acpica/dist/source/common/dmtbdump.c ============================================================================== --- vendor-sys/acpica/dist/source/common/dmtbdump.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/common/dmtbdump.c Thu Dec 14 22:56:53 2017 (r326864) @@ -3734,7 +3734,6 @@ NextSubtable: } - /******************************************************************************* * * FUNCTION: AcpiDmDumpSdev Modified: vendor-sys/acpica/dist/source/compiler/aslcodegen.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcodegen.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/compiler/aslcodegen.c Thu Dec 14 22:56:53 2017 (r326864) @@ -370,7 +370,7 @@ CgWriteAmlOpcode ( * Before printing the bytecode, generate comment byte codes * associated with this node. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { CgWriteAmlComment(Op); } @@ -550,13 +550,13 @@ CgWriteTableHeader ( * "XXXX" table signature prevents this AML file from running on the AML * interpreter. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { - strncpy(AcpiGbl_TableSig, Child->Asl.Value.String, 4); + strncpy(AcpiGbl_TableSig, Child->Asl.Value.String, ACPI_NAME_SIZE); Child->Asl.Value.String = ACPI_SIG_XXXX; } - strncpy (TableHeader.Signature, Child->Asl.Value.String, 4); + strncpy (TableHeader.Signature, Child->Asl.Value.String, ACPI_NAME_SIZE); /* Revision */ @@ -573,12 +573,12 @@ CgWriteTableHeader ( /* OEMID */ Child = Child->Asl.Next; - strncpy (TableHeader.OemId, Child->Asl.Value.String, 6); + strncpy (TableHeader.OemId, Child->Asl.Value.String, ACPI_OEM_ID_SIZE); /* OEM TableID */ Child = Child->Asl.Next; - strncpy (TableHeader.OemTableId, Child->Asl.Value.String, 8); + strncpy (TableHeader.OemTableId, Child->Asl.Value.String, ACPI_OEM_TABLE_ID_SIZE); /* OEM Revision */ @@ -600,7 +600,7 @@ CgWriteTableHeader ( /* Calculate the comment lengths for this definition block parseOp */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { CvDbgPrint ("Calculating comment lengths for %s in write header\n", Op->Asl.ParseOpName); @@ -756,7 +756,8 @@ CgWriteNode ( /* Write all comments here. */ - if (Gbl_CaptureComments) + + if (AcpiGbl_CaptureComments) { CgWriteAmlComment(Op); } @@ -822,7 +823,7 @@ CgWriteNode ( case PARSEOP_DEFINITION_BLOCK: CgWriteTableHeader (Op); - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { CgWriteAmlDefBlockComment (Op); } Modified: vendor-sys/acpica/dist/source/compiler/aslcompile.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompile.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/compiler/aslcompile.c Thu Dec 14 22:56:53 2017 (r326864) @@ -469,7 +469,7 @@ CmDoCompile ( * node during compilation. We take the very last comment and save it in a * global for it to be used by the disassembler. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { AcpiGbl_LastListHead = Gbl_ParseTreeRoot->Asl.CommentList; Gbl_ParseTreeRoot->Asl.CommentList = NULL; Modified: vendor-sys/acpica/dist/source/compiler/asldebug.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asldebug.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/compiler/asldebug.c Thu Dec 14 22:56:53 2017 (r326864) @@ -192,7 +192,7 @@ CvDbgPrint ( va_list Args; - if (!Gbl_CaptureComments || !AcpiGbl_DebugAslConversion) + if (!AcpiGbl_CaptureComments || !AcpiGbl_DebugAslConversion) { return; } Modified: vendor-sys/acpica/dist/source/compiler/aslfiles.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslfiles.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/compiler/aslfiles.c Thu Dec 14 22:56:53 2017 (r326864) @@ -618,7 +618,7 @@ FlOpenAmlOutputFile ( if (!Filename) { /* Create the output AML filename */ - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_AML_CODE); } Modified: vendor-sys/acpica/dist/source/compiler/asloptions.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asloptions.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/compiler/asloptions.c Thu Dec 14 22:56:53 2017 (r326864) @@ -323,7 +323,7 @@ AslDoOptions ( Gbl_IntegerOptimizationFlag = FALSE; Gbl_ReferenceOptimizationFlag = FALSE; Gbl_OptimizeTrivialParseNodes = FALSE; - Gbl_CaptureComments = TRUE; + AcpiGbl_CaptureComments = TRUE; AcpiGbl_DoDisassemblerOptimizations = FALSE; AcpiGbl_DebugAslConversion = TRUE; AcpiGbl_DmEmitExternalOpcodes = TRUE; @@ -391,7 +391,7 @@ AslDoOptions ( Gbl_IntegerOptimizationFlag = FALSE; Gbl_ReferenceOptimizationFlag = FALSE; Gbl_OptimizeTrivialParseNodes = FALSE; - Gbl_CaptureComments = TRUE; + AcpiGbl_CaptureComments = TRUE; AcpiGbl_DoDisassemblerOptimizations = FALSE; AcpiGbl_DmEmitExternalOpcodes = TRUE; Gbl_DoExternalsInPlace = TRUE; @@ -416,25 +416,11 @@ AslDoOptions ( { case '^': - /* Get the required argument */ - - if (AcpiGetoptArgument (argc, argv)) - { - return (-1); - } - Gbl_DoCompile = FALSE; break; case 'a': - /* Get the required argument */ - - if (AcpiGetoptArgument (argc, argv)) - { - return (-1); - } - Gbl_DoCompile = FALSE; Gbl_DisassembleAll = TRUE; break; @@ -796,8 +782,8 @@ AslDoOptions ( Gbl_IntegerOptimizationFlag = FALSE; Gbl_ReferenceOptimizationFlag = FALSE; Gbl_OptimizeTrivialParseNodes = FALSE; - Gbl_CaptureComments = TRUE; Gbl_DoExternalsInPlace = TRUE; + AcpiGbl_CaptureComments = TRUE; return (0); case 'r': /* Override revision found in table header */ Modified: vendor-sys/acpica/dist/source/compiler/aslparseop.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslparseop.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/compiler/aslparseop.c Thu Dec 14 22:56:53 2017 (r326864) @@ -269,7 +269,7 @@ TrCreateOp ( * FirstChild place it in the parent. This also means that * legitimate comments for the child gets put to the parent. */ - if (Gbl_CaptureComments && + if (AcpiGbl_CaptureComments && ((ParseOpcode == PARSEOP_CONNECTION) || (ParseOpcode == PARSEOP_EXTERNAL) || (ParseOpcode == PARSEOP_OFFSET) || @@ -308,7 +308,7 @@ TrCreateOp ( /* Get the comment from last child in the resource template call */ - if (Gbl_CaptureComments && + if (AcpiGbl_CaptureComments && (Op->Asl.ParseOpcode == PARSEOP_RESOURCETEMPLATE)) { CvDbgPrint ("Transferred current comment list to this op.\n"); @@ -794,7 +794,7 @@ TrAllocateOp ( /* The following is for capturing comments */ - if(Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { LatestOp = Gbl_CommentState.LatestParseOp; Op->Asl.InlineComment = NULL; Modified: vendor-sys/acpica/dist/source/compiler/aslstartup.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslstartup.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/compiler/aslstartup.c Thu Dec 14 22:56:53 2017 (r326864) @@ -233,11 +233,11 @@ AslInitializeGlobals ( Gbl_Files[i].Filename = NULL; } - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { Gbl_CommentState.SpacesBefore = 0; Gbl_CommentState.CommentType = 1; - Gbl_CommentState.LatestParseOp = NULL; + Gbl_CommentState.LatestParseOp = NULL; Gbl_CommentState.ParsingParenBraceNode = NULL; Gbl_CommentState.CaptureComments = TRUE; } Modified: vendor-sys/acpica/dist/source/compiler/aslsupport.l ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslsupport.l Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/compiler/aslsupport.l Thu Dec 14 22:56:53 2017 (r326864) @@ -496,7 +496,7 @@ AslInsertLineBuffer ( AslResetCurrentLineBuffer (); } - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { CvProcessCommentState (SourceChar); } @@ -525,7 +525,7 @@ static void count ( int Type) { - int i; + char *p; switch (Type) @@ -547,9 +547,9 @@ count ( break; } - for (i = 0; (yytext[i] != 0) && (yytext[i] != EOF); i++) + for (p = yytext; *p != '\0'; p++) { - AslInsertLineBuffer (yytext[i]); + AslInsertLineBuffer (*p); *Gbl_LineBufPtr = 0; } } @@ -580,7 +580,7 @@ AslDoComment ( AslInsertLineBuffer ('/'); AslInsertLineBuffer ('*'); - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = '/'; ++StringBuffer; @@ -595,7 +595,7 @@ loop: while (((c = input ()) != '*') && (c != EOF)) { AslInsertLineBuffer (c); - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = c; ++StringBuffer; @@ -623,7 +623,7 @@ loop: /* Comment is closed only if the NEXT character is a slash */ AslInsertLineBuffer (c); - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = c; ++StringBuffer; @@ -698,7 +698,7 @@ AslDoCommentType2 ( AslInsertLineBuffer ('/'); - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { AslInsertLineBuffer ('*'); *StringBuffer = '/'; @@ -714,7 +714,7 @@ AslDoCommentType2 ( while (((c = input ()) != '\n') && (c != EOF)) { AslInsertLineBuffer (c); - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = c; ++StringBuffer; Modified: vendor-sys/acpica/dist/source/compiler/asltree.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asltree.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/compiler/asltree.c Thu Dec 14 22:56:53 2017 (r326864) @@ -253,7 +253,7 @@ TrSetOpIntegerValue ( /* Converter: if this is a method invocation, turn off capture comments */ - if (Gbl_CaptureComments && + if (AcpiGbl_CaptureComments && (ParseOpcode == PARSEOP_METHODCALL)) { Gbl_CommentState.CaptureComments = FALSE; @@ -509,7 +509,7 @@ TrLinkOpChildren ( /* The following is for capturing comments */ - if(Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { /* * If there are "regular comments" detected at this point, @@ -590,7 +590,7 @@ TrLinkOpChildren ( va_end(ap); DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); - if(Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { Gbl_CommentState.LatestParseOp = Op; CvDbgPrint ("TrLinkOpChildren=====Set latest parse op to this op.\n"); @@ -768,7 +768,7 @@ TrLinkChildOp ( * turn on capture comments as it signifies that we are done parsing * a method call. */ - if (Gbl_CaptureComments && Op1) + if (AcpiGbl_CaptureComments && Op1) { if (Op1->Asl.ParseOpcode == PARSEOP_METHODCALL) { Modified: vendor-sys/acpica/dist/source/compiler/aslutils.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslutils.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/compiler/aslutils.c Thu Dec 14 22:56:53 2017 (r326864) @@ -422,7 +422,7 @@ UtSetParseOpName ( ACPI_PARSE_OBJECT *Op) { - strncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode), + AcpiUtSafeStrncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode), ACPI_MAX_PARSEOP_NAME); } Modified: vendor-sys/acpica/dist/source/compiler/cvcompiler.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/cvcompiler.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/compiler/cvcompiler.c Thu Dec 14 22:56:53 2017 (r326864) @@ -186,7 +186,7 @@ CvProcessComment ( char *FinalCommentString; - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = (char) c1; ++StringBuffer; @@ -309,7 +309,7 @@ CvProcessCommentType2 ( char *FinalCommentString; - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = 0; /* null terminate */ CvDbgPrint ("Single-line comment\n"); @@ -395,7 +395,7 @@ CvCalculateCommentLengths( ACPI_COMMENT_NODE *Current = NULL; - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { return (0); } @@ -497,7 +497,7 @@ CgWriteAmlDefBlockComment( char *DirectoryPosition; - if (!Gbl_CaptureComments || + if (!AcpiGbl_CaptureComments || (Op->Asl.ParseOpcode != PARSEOP_DEFINITION_BLOCK)) { return; @@ -615,7 +615,7 @@ CgWriteAmlComment( if ((Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK) || - !Gbl_CaptureComments) + !AcpiGbl_CaptureComments) { return; } Modified: vendor-sys/acpica/dist/source/compiler/cvdisasm.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/cvdisasm.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/compiler/cvdisasm.c Thu Dec 14 22:56:53 2017 (r326864) @@ -352,7 +352,7 @@ CvCloseBraceWriteComment( UINT32 Level) { - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { AcpiOsPrintf ("}"); return; @@ -385,7 +385,7 @@ CvCloseParenWriteComment( UINT32 Level) { - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { AcpiOsPrintf (")"); return; Modified: vendor-sys/acpica/dist/source/compiler/cvparser.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/cvparser.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/compiler/cvparser.c Thu Dec 14 22:56:53 2017 (r326864) @@ -254,7 +254,7 @@ CvInitFileTree ( char *ChildFilename = NULL; - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { return; } @@ -720,7 +720,7 @@ CvCaptureCommentsOnly ( ACPI_FILE_NODE *FileNode; - if (!Gbl_CaptureComments || + if (!AcpiGbl_CaptureComments || Opcode != AML_COMMENT_OP) { return; @@ -973,7 +973,7 @@ CvCaptureComments ( const ACPI_OPCODE_INFO *OpInfo; - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { return; } Modified: vendor-sys/acpica/dist/source/compiler/dtcompile.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/dtcompile.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/compiler/dtcompile.c Thu Dec 14 22:56:53 2017 (r326864) @@ -559,9 +559,17 @@ DtCompileTable ( ACPI_STATUS Status = AE_OK; - if (!Field || !*Field) + if (!Field) { return (AE_BAD_PARAMETER); + } + if (!*Field) + { + /* + * The field list is empty, this means that we are out of fields to + * parse. In other words, we are at the end of the table. + */ + return (AE_END_OF_TABLE); } /* Ignore optional subtable if name does not match */ Modified: vendor-sys/acpica/dist/source/compiler/dttable1.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/dttable1.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/compiler/dttable1.c Thu Dec 14 22:56:53 2017 (r326864) @@ -596,8 +596,14 @@ DtCompileDbg2 ( Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2OemData, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) + if (Status == AE_END_OF_TABLE) { + /* optional field was not found and we're at the end of the file */ + + goto subtableDone; + } + else if (ACPI_FAILURE (Status)) + { return (Status); } @@ -615,7 +621,7 @@ DtCompileDbg2 ( DtInsertSubtable (ParentTable, Subtable); } - +subtableDone: SubtableCount--; DtPopSubtable (); /* Get next Device Information subtable */ } Modified: vendor-sys/acpica/dist/source/compiler/prscan.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/prscan.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/compiler/prscan.c Thu Dec 14 22:56:53 2017 (r326864) @@ -1196,7 +1196,7 @@ PrPushDirective ( Info->Next = Gbl_DirectiveStack; Info->Directive = Directive; Info->IgnoringThisCodeBlock = Gbl_IgnoringThisCodeBlock; - strncpy (Info->Argument, Argument, MAX_ARGUMENT_LENGTH); + AcpiUtSafeStrncpy (Info->Argument, Argument, MAX_ARGUMENT_LENGTH); DbgPrint (ASL_DEBUG_OUTPUT, "Pr(%.4u) - [%u %s] %*s Pushed [#%s %s]: IgnoreFlag = %s\n", Modified: vendor-sys/acpica/dist/source/components/debugger/dbfileio.c ============================================================================== --- vendor-sys/acpica/dist/source/components/debugger/dbfileio.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/components/debugger/dbfileio.c Thu Dec 14 22:56:53 2017 (r326864) @@ -218,7 +218,7 @@ AcpiDbOpenDebugFile ( } AcpiOsPrintf ("Debug output file %s opened\n", Name); - strncpy (AcpiGbl_DbDebugFilename, Name, + AcpiUtSafeStrncpy (AcpiGbl_DbDebugFilename, Name, sizeof (AcpiGbl_DbDebugFilename)); AcpiGbl_DbOutputToFile = TRUE; } Modified: vendor-sys/acpica/dist/source/components/disassembler/dmwalk.c ============================================================================== --- vendor-sys/acpica/dist/source/components/disassembler/dmwalk.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/components/disassembler/dmwalk.c Thu Dec 14 22:56:53 2017 (r326864) @@ -527,7 +527,7 @@ AcpiDmDescendingOp ( /* Determine which file this parse node is contained in. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { ASL_CV_LABEL_FILENODE (Op); @@ -1046,7 +1046,7 @@ AcpiDmAscendingOp ( /* Point the Op's filename pointer to the proper file */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { ASL_CV_LABEL_FILENODE (Op); @@ -1074,7 +1074,7 @@ AcpiDmAscendingOp ( /* Print any comments that are at the end of the file here */ - if (Gbl_CaptureComments && AcpiGbl_LastListHead) + if (AcpiGbl_CaptureComments && AcpiGbl_LastListHead) { AcpiOsPrintf ("\n"); ASL_CV_PRINT_ONE_COMMENT_LIST (AcpiGbl_LastListHead, 0); Modified: vendor-sys/acpica/dist/source/components/dispatcher/dspkginit.c ============================================================================== --- vendor-sys/acpica/dist/source/components/dispatcher/dspkginit.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/components/dispatcher/dspkginit.c Thu Dec 14 22:56:53 2017 (r326864) @@ -419,9 +419,12 @@ AcpiDsInitPackageElement ( ACPI_OPERAND_OBJECT **ElementPtr; + ACPI_FUNCTION_TRACE (DsInitPackageElement); + + if (!SourceObject) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* @@ -456,7 +459,7 @@ AcpiDsInitPackageElement ( SourceObject->Package.Flags |= AOPOBJ_DATA_VALID; } - return (AE_OK); + return_ACPI_STATUS (AE_OK); } @@ -481,6 +484,7 @@ AcpiDsResolvePackageElement ( ACPI_GENERIC_STATE ScopeInfo; ACPI_OPERAND_OBJECT *Element = *ElementPtr; ACPI_NAMESPACE_NODE *ResolvedNode; + ACPI_NAMESPACE_NODE *OriginalNode; char *ExternalPath = NULL; ACPI_OBJECT_TYPE Type; @@ -576,6 +580,7 @@ AcpiDsResolvePackageElement ( * will remain as named references. This behavior is not described * in the ACPI spec, but it appears to be an oversight. */ + OriginalNode = ResolvedNode; Status = AcpiExResolveNodeToValue (&ResolvedNode, NULL); if (ACPI_FAILURE (Status)) { @@ -607,26 +612,27 @@ AcpiDsResolvePackageElement ( */ case ACPI_TYPE_DEVICE: case ACPI_TYPE_THERMAL: - - /* TBD: This may not be necesssary */ - - AcpiUtAddReference (ResolvedNode->Object); + case ACPI_TYPE_METHOD: break; case ACPI_TYPE_MUTEX: - case ACPI_TYPE_METHOD: case ACPI_TYPE_POWER: case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_EVENT: case ACPI_TYPE_REGION: + /* AcpiExResolveNodeToValue gave these an extra reference */ + + AcpiUtRemoveReference (OriginalNode->Object); break; default: /* * For all other types - the node was resolved to an actual - * operand object with a value, return the object + * operand object with a value, return the object. Remove + * a reference on the existing object. */ + AcpiUtRemoveReference (Element); *ElementPtr = (ACPI_OPERAND_OBJECT *) ResolvedNode; break; } Modified: vendor-sys/acpica/dist/source/components/executer/exdump.c ============================================================================== --- vendor-sys/acpica/dist/source/components/executer/exdump.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/components/executer/exdump.c Thu Dec 14 22:56:53 2017 (r326864) @@ -747,7 +747,7 @@ AcpiExDumpOperand ( UINT32 Index; - ACPI_FUNCTION_NAME (ExDumpOperand) + ACPI_FUNCTION_NAME (ExDumpOperand); /* Check if debug output enabled */ @@ -1042,7 +1042,7 @@ AcpiExDumpOperands ( const char *OpcodeName, UINT32 NumOperands) { - ACPI_FUNCTION_NAME (ExDumpOperands); + ACPI_FUNCTION_TRACE (ExDumpOperands); if (!OpcodeName) @@ -1070,7 +1070,7 @@ AcpiExDumpOperands ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** End operand dump for [%s]\n", OpcodeName)); - return; + return_VOID; } Modified: vendor-sys/acpica/dist/source/components/hardware/hwvalid.c ============================================================================== --- vendor-sys/acpica/dist/source/components/hardware/hwvalid.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/components/hardware/hwvalid.c Thu Dec 14 22:56:53 2017 (r326864) @@ -245,7 +245,7 @@ AcpiHwValidateIoRequest ( const ACPI_PORT_INFO *PortInfo; - ACPI_FUNCTION_NAME (HwValidateIoRequest); + ACPI_FUNCTION_TRACE (HwValidateIoRequest); /* Supported widths are 8/16/32 */ @@ -256,14 +256,15 @@ AcpiHwValidateIoRequest ( { ACPI_ERROR ((AE_INFO, "Bad BitWidth parameter: %8.8X", BitWidth)); - return (AE_BAD_PARAMETER); + return_ACPI_STATUS (AE_BAD_PARAMETER); } PortInfo = AcpiProtectedPorts; ByteWidth = ACPI_DIV_8 (BitWidth); LastAddress = Address + ByteWidth - 1; - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Address %8.8X%8.8X LastAddress %8.8X%8.8X Length %X", + ACPI_DEBUG_PRINT ((ACPI_DB_IO, + "Address %8.8X%8.8X LastAddress %8.8X%8.8X Length %X", ACPI_FORMAT_UINT64 (Address), ACPI_FORMAT_UINT64 (LastAddress), ByteWidth)); @@ -274,14 +275,14 @@ AcpiHwValidateIoRequest ( ACPI_ERROR ((AE_INFO, "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X", ACPI_FORMAT_UINT64 (Address), ByteWidth)); - return (AE_LIMIT); + return_ACPI_STATUS (AE_LIMIT); } /* Exit if requested address is not within the protected port table */ if (Address > AcpiProtectedPorts[ACPI_PORT_INFO_ENTRIES - 1].End) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* Check request against the list of protected I/O ports */ @@ -303,8 +304,8 @@ AcpiHwValidateIoRequest ( if (AcpiGbl_OsiData >= PortInfo->OsiDependency) { - ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)", + ACPI_DEBUG_PRINT ((ACPI_DB_VALUES, + "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)\n", ACPI_FORMAT_UINT64 (Address), ByteWidth, PortInfo->Name, PortInfo->Start, PortInfo->End)); @@ -320,7 +321,7 @@ AcpiHwValidateIoRequest ( } } - return (AE_OK); + return_ACPI_STATUS (AE_OK); } Modified: vendor-sys/acpica/dist/source/components/namespace/nsxfeval.c ============================================================================== --- vendor-sys/acpica/dist/source/components/namespace/nsxfeval.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/components/namespace/nsxfeval.c Thu Dec 14 22:56:53 2017 (r326864) @@ -174,11 +174,11 @@ AcpiNsResolveReferences ( * * PARAMETERS: Handle - Object handle (optional) * Pathname - Object pathname (optional) - * ExternalParams - List of parameters to pass to method, + * ExternalParams - List of parameters to pass to a method, * terminated by NULL. May be NULL * if no parameters are being passed. - * ReturnBuffer - Where to put method's return value (if - * any). If NULL, no value is returned. + * ReturnBuffer - Where to put the object return value (if + * any). Required. * ReturnType - Expected type of return object * * RETURN: Status @@ -218,10 +218,16 @@ AcpiEvaluateObjectTyped ( FreeBufferOnError = TRUE; } - Status = AcpiGetHandle (Handle, Pathname, &TargetHandle); - if (ACPI_FAILURE (Status)) + /* Get a handle here, in order to build an error message if needed */ + + TargetHandle = Handle; + if (Pathname) { - return_ACPI_STATUS (Status); + Status = AcpiGetHandle (Handle, Pathname, &TargetHandle); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } FullPathname = AcpiNsGetExternalPathname (TargetHandle); Modified: vendor-sys/acpica/dist/source/components/parser/psutils.c ============================================================================== --- vendor-sys/acpica/dist/source/components/parser/psutils.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/components/parser/psutils.c Thu Dec 14 22:56:53 2017 (r326864) @@ -213,7 +213,7 @@ AcpiPsInitOp ( Op->Common.DescriptorType = ACPI_DESC_TYPE_PARSER; Op->Common.AmlOpcode = Opcode; - ACPI_DISASM_ONLY_MEMBERS (strncpy (Op->Common.AmlOpName, + ACPI_DISASM_ONLY_MEMBERS (AcpiUtSafeStrncpy (Op->Common.AmlOpName, (AcpiPsGetOpcodeInfo (Opcode))->Name, sizeof (Op->Common.AmlOpName))); } @@ -293,7 +293,7 @@ AcpiPsAllocOp ( AcpiGbl_CurrentScope = Op; } - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { ASL_CV_TRANSFER_COMMENTS (Op); } Modified: vendor-sys/acpica/dist/source/components/utilities/utdebug.c ============================================================================== --- vendor-sys/acpica/dist/source/components/utilities/utdebug.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/components/utilities/utdebug.c Thu Dec 14 22:56:53 2017 (r326864) @@ -290,8 +290,10 @@ AcpiDebugPrint ( { ACPI_THREAD_ID ThreadId; va_list args; +#ifdef ACPI_APPLICATION + int FillCount; +#endif - /* Check if debug output enabled */ if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId)) @@ -334,10 +336,21 @@ AcpiDebugPrint ( AcpiOsPrintf ("[%u] ", (UINT32) ThreadId); } - AcpiOsPrintf ("[%02ld] ", AcpiGbl_NestingLevel); -#endif + FillCount = 48 - AcpiGbl_NestingLevel - + strlen (AcpiUtTrimFunctionName (FunctionName)); + if (FillCount < 0) + { + FillCount = 0; + } + AcpiOsPrintf ("[%02ld] %*s", + AcpiGbl_NestingLevel, AcpiGbl_NestingLevel + 1, " "); + AcpiOsPrintf ("%s%*s: ", + AcpiUtTrimFunctionName (FunctionName), FillCount, " "); + +#else AcpiOsPrintf ("%-22.22s: ", AcpiUtTrimFunctionName (FunctionName)); +#endif va_start (args, Format); AcpiOsVprintf (Format, args); Modified: vendor-sys/acpica/dist/source/components/utilities/utnonansi.c ============================================================================== --- vendor-sys/acpica/dist/source/components/utilities/utnonansi.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/components/utilities/utnonansi.c Thu Dec 14 22:56:53 2017 (r326864) @@ -344,4 +344,17 @@ AcpiUtSafeStrncat ( strncat (Dest, Source, MaxTransferLength); return (FALSE); } + +void +AcpiUtSafeStrncpy ( + char *Dest, + char *Source, + ACPI_SIZE DestSize) +{ + /* Always terminate destination string */ + + strncpy (Dest, Source, DestSize); + Dest[DestSize - 1] = 0; +} + #endif Modified: vendor-sys/acpica/dist/source/components/utilities/utosi.c ============================================================================== --- vendor-sys/acpica/dist/source/components/utilities/utosi.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/components/utilities/utosi.c Thu Dec 14 22:56:53 2017 (r326864) @@ -214,6 +214,8 @@ static ACPI_INTERFACE_INFO AcpiDefaultSupportedInte {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */ {"Windows 2013", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */ {"Windows 2015", NULL, 0, ACPI_OSI_WIN_10}, /* Windows 10 - Added 03/2015 */ + {"Windows 2016", NULL, 0, ACPI_OSI_WIN_10_RS1}, /* Windows 10 version 1607 - Added 12/2017 */ + {"Windows 2017", NULL, 0, ACPI_OSI_WIN_10_RS2}, /* Windows 10 version 1703 - Added 12/2017 */ /* Feature Group Strings */ Modified: vendor-sys/acpica/dist/source/components/utilities/uttrack.c ============================================================================== --- vendor-sys/acpica/dist/source/components/utilities/uttrack.c Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/components/utilities/uttrack.c Thu Dec 14 22:56:53 2017 (r326864) @@ -557,8 +557,7 @@ AcpiUtTrackAllocation ( Allocation->Component = Component; Allocation->Line = Line; - strncpy (Allocation->Module, Module, ACPI_MAX_MODULE_NAME); - Allocation->Module[ACPI_MAX_MODULE_NAME-1] = 0; + AcpiUtSafeStrncpy (Allocation->Module, (char *) Module, ACPI_MAX_MODULE_NAME); if (!Element) { Modified: vendor-sys/acpica/dist/source/include/acexcep.h ============================================================================== --- vendor-sys/acpica/dist/source/include/acexcep.h Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/include/acexcep.h Thu Dec 14 22:56:53 2017 (r326864) @@ -241,8 +241,9 @@ typedef struct acpi_exception_info #define AE_HEX_OVERFLOW EXCEP_ENV (0x0020) #define AE_DECIMAL_OVERFLOW EXCEP_ENV (0x0021) #define AE_OCTAL_OVERFLOW EXCEP_ENV (0x0022) +#define AE_END_OF_TABLE EXCEP_ENV (0x0023) -#define AE_CODE_ENV_MAX 0x0022 +#define AE_CODE_ENV_MAX 0x0023 /* @@ -379,7 +380,8 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionN EXCEP_TXT ("AE_NUMERIC_OVERFLOW", "Overflow during string-to-integer conversion"), EXCEP_TXT ("AE_HEX_OVERFLOW", "Overflow during ASCII hex-to-binary conversion"), EXCEP_TXT ("AE_DECIMAL_OVERFLOW", "Overflow during ASCII decimal-to-binary conversion"), - EXCEP_TXT ("AE_OCTAL_OVERFLOW", "Overflow during ASCII octal-to-binary conversion") + EXCEP_TXT ("AE_OCTAL_OVERFLOW", "Overflow during ASCII octal-to-binary conversion"), + EXCEP_TXT ("AE_END_OF_TABLE", "Reached the end of table") }; static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Pgm[] = Modified: vendor-sys/acpica/dist/source/include/acglobal.h ============================================================================== --- vendor-sys/acpica/dist/source/include/acglobal.h Thu Dec 14 22:15:46 2017 (r326863) +++ vendor-sys/acpica/dist/source/include/acglobal.h Thu Dec 14 22:56:53 2017 (r326864) @@ -155,7 +155,7 @@ /***************************************************************************** * - * Globals related to the ACPI tables + * Globals related to the incoming ACPI tables * ****************************************************************************/ @@ -197,7 +197,7 @@ ACPI_GLOBAL (UINT8, AcpiGbl_Intege /***************************************************************************** * - * Mutual exclusion within ACPICA subsystem + * Mutual exclusion within the ACPICA subsystem * ****************************************************************************/ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Thu Dec 14 22:57:23 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6153E92C46; Thu, 14 Dec 2017 22:57:23 +0000 (UTC) (envelope-from jkim@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 mx1.freebsd.org (Postfix) with ESMTPS id 831167D8DE; Thu, 14 Dec 2017 22:57:23 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBEMvMeM031784; Thu, 14 Dec 2017 22:57:22 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBEMvMtA031783; Thu, 14 Dec 2017 22:57:22 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201712142257.vBEMvMtA031783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 14 Dec 2017 22:57:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r326865 - vendor-sys/acpica/20171214 X-SVN-Group: vendor-sys X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: vendor-sys/acpica/20171214 X-SVN-Commit-Revision: 326865 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.25 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: Thu, 14 Dec 2017 22:57:23 -0000 Author: jkim Date: Thu Dec 14 22:57:22 2017 New Revision: 326865 URL: https://svnweb.freebsd.org/changeset/base/326865 Log: Tag ACPICA 20171214. Added: vendor-sys/acpica/20171214/ - copied from r326864, vendor-sys/acpica/dist/ From owner-svn-src-vendor@freebsd.org Sat Dec 16 14:44:37 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F37CE8471B; Sat, 16 Dec 2017 14:44:37 +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 mx1.freebsd.org (Postfix) with ESMTPS id 50CF5666A3; Sat, 16 Dec 2017 14:44:37 +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 vBGEiasi032326; Sat, 16 Dec 2017 14:44:36 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBGEiZXM032321; Sat, 16 Dec 2017 14:44:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201712161444.vBGEiZXM032321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 16 Dec 2017 14:44:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r326899 - in vendor/llvm/dist: lib/Target/BPF lib/Transforms/Scalar test/CodeGen/BPF test/Transforms/NewGVN X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/llvm/dist: lib/Target/BPF lib/Transforms/Scalar test/CodeGen/BPF test/Transforms/NewGVN X-SVN-Commit-Revision: 326899 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.25 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, 16 Dec 2017 14:44:37 -0000 Author: dim Date: Sat Dec 16 14:44:35 2017 New Revision: 326899 URL: https://svnweb.freebsd.org/changeset/base/326899 Log: Vendor import of llvm 5.0.1 release r320880: https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_501/final@320880 Added: vendor/llvm/dist/test/Transforms/NewGVN/pr34452.ll Modified: vendor/llvm/dist/lib/Target/BPF/BPFISelLowering.cpp vendor/llvm/dist/lib/Target/BPF/BPFInstrInfo.td vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp vendor/llvm/dist/test/CodeGen/BPF/select_ri.ll Modified: vendor/llvm/dist/lib/Target/BPF/BPFISelLowering.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/BPF/BPFISelLowering.cpp Sat Dec 16 14:36:21 2017 (r326898) +++ vendor/llvm/dist/lib/Target/BPF/BPFISelLowering.cpp Sat Dec 16 14:44:35 2017 (r326899) @@ -578,11 +578,15 @@ BPFTargetLowering::EmitInstrWithCustomInserter(Machine .addReg(LHS) .addReg(MI.getOperand(2).getReg()) .addMBB(Copy1MBB); - else + else { + int64_t imm32 = MI.getOperand(2).getImm(); + // sanity check before we build J*_ri instruction. + assert (isInt<32>(imm32)); BuildMI(BB, DL, TII.get(NewCC)) .addReg(LHS) - .addImm(MI.getOperand(2).getImm()) + .addImm(imm32) .addMBB(Copy1MBB); + } // Copy0MBB: // %FalseValue = ... Modified: vendor/llvm/dist/lib/Target/BPF/BPFInstrInfo.td ============================================================================== --- vendor/llvm/dist/lib/Target/BPF/BPFInstrInfo.td Sat Dec 16 14:36:21 2017 (r326898) +++ vendor/llvm/dist/lib/Target/BPF/BPFInstrInfo.td Sat Dec 16 14:44:35 2017 (r326899) @@ -464,7 +464,7 @@ let usesCustomInserter = 1 in { (ins GPR:$lhs, i64imm:$rhs, i64imm:$imm, GPR:$src, GPR:$src2), "# Select PSEUDO $dst = $lhs $imm $rhs ? $src : $src2", [(set i64:$dst, - (BPFselectcc i64:$lhs, (i64 imm:$rhs), (i64 imm:$imm), i64:$src, i64:$src2))]>; + (BPFselectcc i64:$lhs, (i64 i64immSExt32:$rhs), (i64 imm:$imm), i64:$src, i64:$src2))]>; } // load 64-bit global addr into register Modified: vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp Sat Dec 16 14:36:21 2017 (r326898) +++ vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp Sat Dec 16 14:44:35 2017 (r326899) @@ -586,8 +586,8 @@ class NewGVN { (public) private: // Expression handling. const Expression *createExpression(Instruction *) const; - const Expression *createBinaryExpression(unsigned, Type *, Value *, - Value *) const; + const Expression *createBinaryExpression(unsigned, Type *, Value *, Value *, + Instruction *) const; PHIExpression *createPHIExpression(Instruction *, bool &HasBackEdge, bool &OriginalOpsConstant) const; const DeadExpression *createDeadExpression() const; @@ -902,8 +902,8 @@ bool NewGVN::setBasicExpressionInfo(Instruction *I, Ba } const Expression *NewGVN::createBinaryExpression(unsigned Opcode, Type *T, - Value *Arg1, - Value *Arg2) const { + Value *Arg1, Value *Arg2, + Instruction *I) const { auto *E = new (ExpressionAllocator) BasicExpression(2); E->setType(T); @@ -921,7 +921,7 @@ const Expression *NewGVN::createBinaryExpression(unsig E->op_push_back(lookupOperandLeader(Arg2)); Value *V = SimplifyBinOp(Opcode, E->getOperand(0), E->getOperand(1), SQ); - if (const Expression *SimplifiedE = checkSimplificationResults(E, nullptr, V)) + if (const Expression *SimplifiedE = checkSimplificationResults(E, I, V)) return SimplifiedE; return E; } @@ -1699,8 +1699,9 @@ NewGVN::performSymbolicAggrValueEvaluation(Instruction // expression. assert(II->getNumArgOperands() == 2 && "Expect two args for recognised intrinsics."); - return createBinaryExpression( - Opcode, EI->getType(), II->getArgOperand(0), II->getArgOperand(1)); + return createBinaryExpression(Opcode, EI->getType(), + II->getArgOperand(0), + II->getArgOperand(1), I); } } } @@ -1933,6 +1934,7 @@ void NewGVN::touchAndErase(Map &M, const KeyType &Key) } void NewGVN::addAdditionalUsers(Value *To, Value *User) const { + assert(User && To != User); if (isa(To)) AdditionalUsers[To].insert(User); } Modified: vendor/llvm/dist/test/CodeGen/BPF/select_ri.ll ============================================================================== --- vendor/llvm/dist/test/CodeGen/BPF/select_ri.ll Sat Dec 16 14:36:21 2017 (r326898) +++ vendor/llvm/dist/test/CodeGen/BPF/select_ri.ll Sat Dec 16 14:44:35 2017 (r326899) @@ -25,3 +25,38 @@ entry: } attributes #0 = { norecurse nounwind readonly } + +; test immediate out of 32-bit range +; Source file: + +; unsigned long long +; load_word(void *buf, unsigned long long off) +; asm("llvm.bpf.load.word"); +; +; int +; foo(void *buf) +; { +; unsigned long long sum = 0; +; +; sum += load_word(buf, 100); +; sum += load_word(buf, 104); +; +; if (sum != 0x1ffffffffULL) +; return ~0U; +; +; return 0; +;} + +; Function Attrs: nounwind readonly +define i32 @foo(i8*) local_unnamed_addr #0 { + %2 = tail call i64 @llvm.bpf.load.word(i8* %0, i64 100) + %3 = tail call i64 @llvm.bpf.load.word(i8* %0, i64 104) + %4 = add i64 %3, %2 + %5 = icmp ne i64 %4, 8589934591 +; CHECK: r{{[0-9]+}} = 8589934591ll + %6 = sext i1 %5 to i32 + ret i32 %6 +} + +; Function Attrs: nounwind readonly +declare i64 @llvm.bpf.load.word(i8*, i64) #1 Added: vendor/llvm/dist/test/Transforms/NewGVN/pr34452.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist/test/Transforms/NewGVN/pr34452.ll Sat Dec 16 14:44:35 2017 (r326899) @@ -0,0 +1,49 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -newgvn -S < %s | FileCheck %s +;; Ensure we don't crash when simplifying aggregate value expressions +source_filename = "bugpoint-output-09f7a24.bc" + +@WHOLELINE = external local_unnamed_addr global i32, align 4 + +; Function Attrs: nounwind uwtable +define void @sgrep() local_unnamed_addr #0 { +; CHECK-LABEL: @sgrep( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @WHOLELINE, align 4, !tbaa !1 +; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[TMP0]], 0 +; CHECK-NEXT: [[DOT:%.*]] = select i1 [[TOBOOL]], i32 2048, i32 2047 +; CHECK-NEXT: br label [[WHILE_BODY_US:%.*]] +; CHECK: while.body.us: +; CHECK-NEXT: [[START_1230_US:%.*]] = phi i32 [ [[DOT]], [[ENTRY:%.*]] ], [ 0, [[WHILE_BODY_US]] ] +; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[START_1230_US]] to i64 +; CHECK-NEXT: [[TMP2:%.*]] = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 0, i64 [[TMP1]]) +; CHECK-NEXT: br label [[WHILE_BODY_US]] +; +entry: + %0 = load i32, i32* @WHOLELINE, align 4, !tbaa !1 + %tobool = icmp eq i32 %0, 0 + %. = select i1 %tobool, i32 2048, i32 2047 + br label %while.body.us + +while.body.us: ; preds = %while.body.us, %entry + %start.1230.us = phi i32 [ %., %entry ], [ 0, %while.body.us ] + %1 = sext i32 %start.1230.us to i64 + %2 = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 0, i64 %1) + %.res302 = extractvalue { i64, i1 } %2, 0 + %3 = icmp sge i64 undef, %.res302 + br label %while.body.us +} + +; Function Attrs: nounwind readnone speculatable +declare { i64, i1 } @llvm.sadd.with.overflow.i64(i64, i64) #1 + +attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "polly-optimized" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind readnone speculatable } + +!llvm.ident = !{!0} + +!0 = !{!"clang version 6.0.0 (trunk 311664) (llvm/trunk 311666)"} +!1 = !{!2, !2, i64 0} +!2 = !{!"int", !3, i64 0} +!3 = !{!"omnipotent char", !4, i64 0} +!4 = !{!"Simple C/C++ TBAA"} From owner-svn-src-vendor@freebsd.org Sat Dec 16 14:44:40 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D1A9E84734; Sat, 16 Dec 2017 14:44:40 +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 mx1.freebsd.org (Postfix) with ESMTPS id 375A2666A6; Sat, 16 Dec 2017 14:44:40 +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 vBGEidGD032372; Sat, 16 Dec 2017 14:44:39 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBGEid5D032371; Sat, 16 Dec 2017 14:44:39 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201712161444.vBGEid5D032371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 16 Dec 2017 14:44:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r326900 - vendor/llvm/llvm-release_501-r320880 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm/llvm-release_501-r320880 X-SVN-Commit-Revision: 326900 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.25 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, 16 Dec 2017 14:44:40 -0000 Author: dim Date: Sat Dec 16 14:44:39 2017 New Revision: 326900 URL: https://svnweb.freebsd.org/changeset/base/326900 Log: Tag llvm 5.0.1 release r320880. Added: vendor/llvm/llvm-release_501-r320880/ - copied from r326899, vendor/llvm/dist/ From owner-svn-src-vendor@freebsd.org Sat Dec 16 14:45:39 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12406E84817; Sat, 16 Dec 2017 14:45: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 mx1.freebsd.org (Postfix) with ESMTPS id DE5E266900; Sat, 16 Dec 2017 14:45:38 +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 vBGEjbp0032460; Sat, 16 Dec 2017 14:45:37 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBGEjbhg032455; Sat, 16 Dec 2017 14:45:37 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201712161445.vBGEjbhg032455@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 16 Dec 2017 14:45:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r326901 - in vendor/clang/dist: lib/Basic lib/Sema test/SemaCXX X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/clang/dist: lib/Basic lib/Sema test/SemaCXX X-SVN-Commit-Revision: 326901 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.25 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, 16 Dec 2017 14:45:39 -0000 Author: dim Date: Sat Dec 16 14:45:37 2017 New Revision: 326901 URL: https://svnweb.freebsd.org/changeset/base/326901 Log: Vendor import of clang 5.0.1 release r320880: https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_501/final@320880 Modified: vendor/clang/dist/lib/Basic/Version.cpp vendor/clang/dist/lib/Sema/SemaDecl.cpp vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp vendor/clang/dist/lib/Sema/SemaTemplateInstantiateDecl.cpp vendor/clang/dist/test/SemaCXX/unused.cpp Modified: vendor/clang/dist/lib/Basic/Version.cpp ============================================================================== --- vendor/clang/dist/lib/Basic/Version.cpp Sat Dec 16 14:44:39 2017 (r326900) +++ vendor/clang/dist/lib/Basic/Version.cpp Sat Dec 16 14:45:37 2017 (r326901) @@ -36,7 +36,7 @@ std::string getClangRepositoryPath() { // If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us // pick up a tag in an SVN export, for example. - StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/branches/release_50/lib/Basic/Version.cpp $"); + StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_501/final/lib/Basic/Version.cpp $"); if (URL.empty()) { URL = SVNRepository.slice(SVNRepository.find(':'), SVNRepository.find("/lib/Basic")); Modified: vendor/clang/dist/lib/Sema/SemaDecl.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaDecl.cpp Sat Dec 16 14:44:39 2017 (r326900) +++ vendor/clang/dist/lib/Sema/SemaDecl.cpp Sat Dec 16 14:45:37 2017 (r326901) @@ -1603,7 +1603,24 @@ static bool ShouldDiagnoseUnusedDecl(const NamedDecl * if (D->isInvalidDecl()) return false; - if (D->isReferenced() || D->isUsed() || D->hasAttr() || + bool Referenced = false; + if (auto *DD = dyn_cast(D)) { + // For a decomposition declaration, warn if none of the bindings are + // referenced, instead of if the variable itself is referenced (which + // it is, by the bindings' expressions). + for (auto *BD : DD->bindings()) { + if (BD->isReferenced()) { + Referenced = true; + break; + } + } + } else if (!D->getDeclName()) { + return false; + } else if (D->isReferenced() || D->isUsed()) { + Referenced = true; + } + + if (Referenced || D->hasAttr() || D->hasAttr()) return false; @@ -1726,7 +1743,7 @@ void Sema::DiagnoseUnusedDecl(const NamedDecl *D) { else DiagID = diag::warn_unused_variable; - Diag(D->getLocation(), DiagID) << D->getDeclName() << Hint; + Diag(D->getLocation(), DiagID) << D << Hint; } static void CheckPoppedLabel(LabelDecl *L, Sema &S) { @@ -1756,8 +1773,6 @@ void Sema::ActOnPopScope(SourceLocation Loc, Scope *S) assert(isa(TmpD) && "Decl isn't NamedDecl?"); NamedDecl *D = cast(TmpD); - if (!D->getDeclName()) continue; - // Diagnose unused variables in this scope. if (!S->hasUnrecoverableErrorOccurred()) { DiagnoseUnusedDecl(D); @@ -1765,6 +1780,8 @@ void Sema::ActOnPopScope(SourceLocation Loc, Scope *S) DiagnoseUnusedNestedTypedefs(RD); } + if (!D->getDeclName()) continue; + // If this was a forward reference to a label, verify it was defined. if (LabelDecl *LD = dyn_cast(D)) CheckPoppedLabel(LD, *this); @@ -6155,7 +6172,6 @@ NamedDecl *Sema::ActOnVariableDeclarator( IdentifierInfo *II = Name.getAsIdentifierInfo(); if (D.isDecompositionDeclarator()) { - AddToScope = false; // Take the name of the first declarator as our name for diagnostic // purposes. auto &Decomp = D.getDecompositionDeclarator(); Modified: vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp Sat Dec 16 14:44:39 2017 (r326900) +++ vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp Sat Dec 16 14:45:37 2017 (r326901) @@ -826,7 +826,10 @@ Sema::ActOnDecompositionDeclarator(Scope *S, Declarato NamedDecl *New = ActOnVariableDeclarator(S, D, DC, TInfo, Previous, MultiTemplateParamsArg(), AddToScope, Bindings); - CurContext->addHiddenDecl(New); + if (AddToScope) { + S->AddDecl(New); + CurContext->addHiddenDecl(New); + } if (isInOpenMPDeclareTargetContext()) checkDeclIsAllowedInOpenMPTarget(nullptr, New); Modified: vendor/clang/dist/lib/Sema/SemaTemplateInstantiateDecl.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaTemplateInstantiateDecl.cpp Sat Dec 16 14:44:39 2017 (r326900) +++ vendor/clang/dist/lib/Sema/SemaTemplateInstantiateDecl.cpp Sat Dec 16 14:45:37 2017 (r326901) @@ -677,6 +677,7 @@ TemplateDeclInstantiator::VisitTypeAliasTemplateDecl(T Decl *TemplateDeclInstantiator::VisitBindingDecl(BindingDecl *D) { auto *NewBD = BindingDecl::Create(SemaRef.Context, Owner, D->getLocation(), D->getIdentifier()); + NewBD->setReferenced(D->isReferenced()); SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, NewBD); return NewBD; } Modified: vendor/clang/dist/test/SemaCXX/unused.cpp ============================================================================== --- vendor/clang/dist/test/SemaCXX/unused.cpp Sat Dec 16 14:44:39 2017 (r326900) +++ vendor/clang/dist/test/SemaCXX/unused.cpp Sat Dec 16 14:45:37 2017 (r326901) @@ -1,6 +1,7 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wunused %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 -Wunused %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -Wunused %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 -Wunused %s // PR4103 : Make sure we don't get a bogus unused expression warning namespace PR4103 { @@ -8,7 +9,7 @@ namespace PR4103 { char foo; }; class APSInt : public APInt { - char bar; + char bar; // expected-warning {{private field 'bar' is not used}} public: APSInt &operator=(const APSInt &RHS); }; @@ -69,3 +70,44 @@ namespace UnresolvedLookup { } }; } + +#if __cplusplus >= 201703L +namespace PR33839 { + void a() { + struct X { int a, b; } x; + auto [a, b] = x; // expected-warning {{unused variable '[a, b]'}} + auto [c, d] = x; + (void)d; + } + + template void f() { + struct A { int n; } a[1]; + for (auto [x] : a) { + (void)x; + } + auto [y] = a[0]; // expected-warning {{unused}} + } + template void g() { + struct A { int n; } a[1]; + for (auto [x] : a) { + if constexpr (b) + (void)x; + } + + auto [y] = a[0]; + if constexpr (b) + (void)y; // ok, even when b == false + } + template void h() { + struct A { int n; } a[1]; + for (auto [x] : a) { // expected-warning {{unused variable '[x]'}} + } + } + void use() { + f(); // expected-note {{instantiation of}} + g(); + g(); + h(); // expected-note {{instantiation of}} + } +} +#endif From owner-svn-src-vendor@freebsd.org Sat Dec 16 14:45:42 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93A0DE84837; Sat, 16 Dec 2017 14:45:42 +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 mx1.freebsd.org (Postfix) with ESMTPS id 5E16C66909; Sat, 16 Dec 2017 14:45:42 +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 vBGEjfXR032506; Sat, 16 Dec 2017 14:45:41 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBGEjfHc032505; Sat, 16 Dec 2017 14:45:41 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201712161445.vBGEjfHc032505@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 16 Dec 2017 14:45:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r326902 - vendor/clang/clang-release_501-r320880 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/clang/clang-release_501-r320880 X-SVN-Commit-Revision: 326902 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.25 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, 16 Dec 2017 14:45:42 -0000 Author: dim Date: Sat Dec 16 14:45:41 2017 New Revision: 326902 URL: https://svnweb.freebsd.org/changeset/base/326902 Log: Tag clang 5.0.1 release r320880. Added: vendor/clang/clang-release_501-r320880/ - copied from r326901, vendor/clang/dist/ From owner-svn-src-vendor@freebsd.org Sat Dec 16 14:46:00 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 935DCE84899; Sat, 16 Dec 2017 14:46:00 +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 mx1.freebsd.org (Postfix) with ESMTPS id 5D30366B38; Sat, 16 Dec 2017 14:46:00 +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 vBGEjxmi032561; Sat, 16 Dec 2017 14:45:59 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBGEjxX8032560; Sat, 16 Dec 2017 14:45:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201712161445.vBGEjxX8032560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 16 Dec 2017 14:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r326903 - vendor/compiler-rt/compiler-rt-release_501-r320880 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/compiler-rt/compiler-rt-release_501-r320880 X-SVN-Commit-Revision: 326903 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.25 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, 16 Dec 2017 14:46:00 -0000 Author: dim Date: Sat Dec 16 14:45:59 2017 New Revision: 326903 URL: https://svnweb.freebsd.org/changeset/base/326903 Log: Tag compiler-rt 5.0.1 release r320880. Added: vendor/compiler-rt/compiler-rt-release_501-r320880/ - copied from r326902, vendor/compiler-rt/dist/ From owner-svn-src-vendor@freebsd.org Sat Dec 16 14:46:25 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2C70E84907; Sat, 16 Dec 2017 14:46:25 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9D33E66C6F; Sat, 16 Dec 2017 14:46:25 +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 vBGEkOOJ032622; Sat, 16 Dec 2017 14:46:24 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBGEkOlm032621; Sat, 16 Dec 2017 14:46:24 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201712161446.vBGEkOlm032621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 16 Dec 2017 14:46:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r326904 - vendor/libc++/libc++-release_501-r320880 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/libc++/libc++-release_501-r320880 X-SVN-Commit-Revision: 326904 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.25 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, 16 Dec 2017 14:46:25 -0000 Author: dim Date: Sat Dec 16 14:46:24 2017 New Revision: 326904 URL: https://svnweb.freebsd.org/changeset/base/326904 Log: Tag libc++ 5.0.1 release r320880. Added: vendor/libc++/libc++-release_501-r320880/ - copied from r326903, vendor/libc++/dist/ From owner-svn-src-vendor@freebsd.org Sat Dec 16 14:46:40 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B8CEE8494A; Sat, 16 Dec 2017 14:46:40 +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 mx1.freebsd.org (Postfix) with ESMTPS id 5AC6C66D8C; Sat, 16 Dec 2017 14:46:40 +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 vBGEkd9w032680; Sat, 16 Dec 2017 14:46:39 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBGEkc5t032673; Sat, 16 Dec 2017 14:46:38 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201712161446.vBGEkc5t032673@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 16 Dec 2017 14:46:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r326905 - in vendor/lld/dist: lib/ReaderWriter/MachO test/mach-o X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/lld/dist: lib/ReaderWriter/MachO test/mach-o X-SVN-Commit-Revision: 326905 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.25 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, 16 Dec 2017 14:46:40 -0000 Author: dim Date: Sat Dec 16 14:46:38 2017 New Revision: 326905 URL: https://svnweb.freebsd.org/changeset/base/326905 Log: Vendor import of lld 5.0.1 release r320880: https://llvm.org/svn/llvm-project/lld/tags/RELEASE_501/final@320880 Modified: vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler.h vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_arm.cpp vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_x86.cpp vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp vendor/lld/dist/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp vendor/lld/dist/test/mach-o/lazy-bind-x86_64.yaml Modified: vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler.h ============================================================================== --- vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler.h Sat Dec 16 14:46:24 2017 (r326904) +++ vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler.h Sat Dec 16 14:46:38 2017 (r326905) @@ -112,6 +112,10 @@ class ArchHandler { (public) /// info in final executables. virtual bool isLazyPointer(const Reference &); + /// Reference from an __stub_helper entry to the required offset of the + /// lazy bind commands. + virtual Reference::KindValue lazyImmediateLocationKind() = 0; + /// Returns true if the specified relocation is paired to the next relocation. virtual bool isPairedReloc(const normalized::Relocation &) = 0; Modified: vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_arm.cpp ============================================================================== --- vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_arm.cpp Sat Dec 16 14:46:24 2017 (r326904) +++ vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_arm.cpp Sat Dec 16 14:46:38 2017 (r326905) @@ -67,6 +67,10 @@ class ArchHandler_arm : public ArchHandler { (public) return invalid; } + Reference::KindValue lazyImmediateLocationKind() override { + return lazyImmediateLocation; + } + Reference::KindValue pointerKind() override { return invalid; } Modified: vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp ============================================================================== --- vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp Sat Dec 16 14:46:24 2017 (r326904) +++ vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp Sat Dec 16 14:46:38 2017 (r326905) @@ -127,6 +127,10 @@ class ArchHandler_arm64 : public ArchHandler { (public return pointer64; } + Reference::KindValue lazyImmediateLocationKind() override { + return lazyImmediateLocation; + } + uint32_t dwarfCompactUnwindType() override { return 0x03000000; } Modified: vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_x86.cpp ============================================================================== --- vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_x86.cpp Sat Dec 16 14:46:24 2017 (r326904) +++ vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_x86.cpp Sat Dec 16 14:46:38 2017 (r326905) @@ -70,6 +70,10 @@ class ArchHandler_x86 : public ArchHandler { (public) return delta32; } + Reference::KindValue lazyImmediateLocationKind() override { + return lazyImmediateLocation; + } + Reference::KindValue unwindRefToEhFrameKind() override { return invalid; } Modified: vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp ============================================================================== --- vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp Sat Dec 16 14:46:24 2017 (r326904) +++ vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp Sat Dec 16 14:46:38 2017 (r326905) @@ -116,6 +116,10 @@ class ArchHandler_x86_64 : public ArchHandler { (publi return unwindFDEToFunction; } + Reference::KindValue lazyImmediateLocationKind() override { + return lazyImmediateLocation; + } + Reference::KindValue unwindRefToEhFrameKind() override { return unwindInfoToEhFrame; } Modified: vendor/lld/dist/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp ============================================================================== --- vendor/lld/dist/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp Sat Dec 16 14:46:24 2017 (r326904) +++ vendor/lld/dist/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp Sat Dec 16 14:46:38 2017 (r326905) @@ -172,6 +172,8 @@ class Util { (private) SymbolScope &symbolScope); void appendSection(SectionInfo *si, NormalizedFile &file); uint32_t sectionIndexForAtom(const Atom *atom); + void fixLazyReferenceImm(const DefinedAtom *atom, uint32_t offset, + NormalizedFile &file); typedef llvm::DenseMap AtomToIndex; struct AtomAndIndex { const Atom *atom; uint32_t index; SymbolScope scope; }; @@ -1423,6 +1425,8 @@ void Util::addRebaseAndBindingInfo(const lld::File &at uint8_t segmentIndex; uint64_t segmentStartAddr; + uint32_t offsetInBindInfo = 0; + for (SectionInfo *sect : _sectionInfos) { segIndexForSection(sect, segmentIndex, segmentStartAddr); for (const AtomInfo &info : sect->atomsAndOffsets) { @@ -1467,6 +1471,59 @@ void Util::addRebaseAndBindingInfo(const lld::File &at bind.symbolName = targ->name(); bind.addend = ref->addend(); nFile.lazyBindingInfo.push_back(bind); + + // Now that we know the segmentOffset and the ordinal attribute, + // we can fix the helper's code + + fixLazyReferenceImm(atom, offsetInBindInfo, nFile); + + // 5 bytes for opcodes + variable sizes (target name + \0 and offset + // encode's size) + offsetInBindInfo += + 6 + targ->name().size() + llvm::getULEB128Size(bind.segOffset); + if (bind.ordinal > BIND_IMMEDIATE_MASK) + offsetInBindInfo += llvm::getULEB128Size(bind.ordinal); + } + } + } + } +} + +void Util::fixLazyReferenceImm(const DefinedAtom *atom, uint32_t offset, + NormalizedFile &file) { + for (const auto &ref : *atom) { + const DefinedAtom *da = dyn_cast(ref->target()); + if (da == nullptr) + return; + + const Reference *helperRef = nullptr; + for (const Reference *hr : *da) { + if (hr->kindValue() == _archHandler.lazyImmediateLocationKind()) { + helperRef = hr; + break; + } + } + if (helperRef == nullptr) + continue; + + // TODO: maybe get the fixed atom content from _archHandler ? + for (SectionInfo *sectInfo : _sectionInfos) { + for (const AtomInfo &atomInfo : sectInfo->atomsAndOffsets) { + if (atomInfo.atom == helperRef->target()) { + auto sectionContent = + file.sections[sectInfo->normalizedSectionIndex].content; + uint8_t *rawb = + file.ownedAllocations.Allocate(sectionContent.size()); + llvm::MutableArrayRef newContent{rawb, + sectionContent.size()}; + std::copy(sectionContent.begin(), sectionContent.end(), + newContent.begin()); + llvm::support::ulittle32_t *loc = + reinterpret_cast( + &newContent[atomInfo.offsetInSection + + helperRef->offsetInAtom()]); + *loc = offset; + file.sections[sectInfo->normalizedSectionIndex].content = newContent; } } } Modified: vendor/lld/dist/test/mach-o/lazy-bind-x86_64.yaml ============================================================================== --- vendor/lld/dist/test/mach-o/lazy-bind-x86_64.yaml Sat Dec 16 14:46:24 2017 (r326904) +++ vendor/lld/dist/test/mach-o/lazy-bind-x86_64.yaml Sat Dec 16 14:46:38 2017 (r326905) @@ -80,8 +80,8 @@ undefined-symbols: # CHECK-HELPERS:Disassembly of section __TEXT,__stub_helper: # CHECK-HELPERS: 68 00 00 00 00 pushq $0 -# CHECK-HELPERS: 68 10 00 00 00 pushq $16 -# CHECK-HELPERS: 68 20 00 00 00 pushq $32 +# CHECK-HELPERS: 68 0b 00 00 00 pushq $11 +# CHECK-HELPERS: 68 16 00 00 00 pushq $22 # Make sure the stub helper is correctly aligned # CHECK-DYLIBS: sectname __stub_helper From owner-svn-src-vendor@freebsd.org Sat Dec 16 14:46:43 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E106E84971; Sat, 16 Dec 2017 14:46:43 +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 mx1.freebsd.org (Postfix) with ESMTPS id 3579266D93; Sat, 16 Dec 2017 14:46:43 +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 vBGEkgSE032727; Sat, 16 Dec 2017 14:46:42 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBGEkgVc032726; Sat, 16 Dec 2017 14:46:42 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201712161446.vBGEkgVc032726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 16 Dec 2017 14:46:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r326906 - vendor/lld/lld-release_501-r320880 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lld/lld-release_501-r320880 X-SVN-Commit-Revision: 326906 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.25 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, 16 Dec 2017 14:46:43 -0000 Author: dim Date: Sat Dec 16 14:46:42 2017 New Revision: 326906 URL: https://svnweb.freebsd.org/changeset/base/326906 Log: Tag lld 5.0.1 release r320880. Added: vendor/lld/lld-release_501-r320880/ - copied from r326905, vendor/lld/dist/ From owner-svn-src-vendor@freebsd.org Sat Dec 16 14:47:13 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B681CE84A63; Sat, 16 Dec 2017 14:47:13 +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 mx1.freebsd.org (Postfix) with ESMTPS id 8099767044; Sat, 16 Dec 2017 14:47:13 +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 vBGElCYU032791; Sat, 16 Dec 2017 14:47:12 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBGElCm3032790; Sat, 16 Dec 2017 14:47:12 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201712161447.vBGElCm3032790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 16 Dec 2017 14:47:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r326907 - vendor/lldb/lldb-release_501-r320880 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lldb/lldb-release_501-r320880 X-SVN-Commit-Revision: 326907 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.25 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, 16 Dec 2017 14:47:13 -0000 Author: dim Date: Sat Dec 16 14:47:12 2017 New Revision: 326907 URL: https://svnweb.freebsd.org/changeset/base/326907 Log: Tag lldb 5.0.1 release r320880. Added: vendor/lldb/lldb-release_501-r320880/ - copied from r326906, vendor/lldb/dist/