From owner-svn-src-vendor@freebsd.org Fri Apr 27 12:02:14 2018 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 135F2FA6662; Fri, 27 Apr 2018 12:02:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B16F581876; Fri, 27 Apr 2018 12:02:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABAD326319; Fri, 27 Apr 2018 12:02:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3RC2DFl060391; Fri, 27 Apr 2018 12:02:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3RC2BFc060365; Fri, 27 Apr 2018 12:02:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804271202.w3RC2BFc060365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 27 Apr 2018 12:02:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r333057 - in vendor/elftoolchain/dist: . ar as common documentation/libelf-by-example elfcopy elfdump ld libdwarf libelf libelftc libpe mk nm readelf strings test/ar/plugin test/elfcopy... X-SVN-Group: vendor X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in vendor/elftoolchain/dist: . ar as common documentation/libelf-by-example elfcopy elfdump ld libdwarf libelf libelftc libpe mk nm readelf strings test/ar/plugin test/elfcopy/plugin test/libdwarf/ts/... X-SVN-Commit-Revision: 333057 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: Fri, 27 Apr 2018 12:02:14 -0000 Author: emaste Date: Fri Apr 27 12:02:11 2018 New Revision: 333057 URL: https://svnweb.freebsd.org/changeset/base/333057 Log: Import ELF Tool Chain snapshot at r3614 From http://svn.code.sf.net/p/elftoolchain/code/ Added: vendor/elftoolchain/dist/tools/build-automation/cli/ vendor/elftoolchain/dist/tools/build-automation/cli/yabs.1 (contents, props changed) vendor/elftoolchain/dist/tools/build-automation/executor/ vendor/elftoolchain/dist/tools/build-automation/executor/yabs-executor.1 (contents, props changed) Deleted: vendor/elftoolchain/dist/tools/build-automation/Makefile.documentation vendor/elftoolchain/dist/tools/build-automation/Makefile.manuals vendor/elftoolchain/dist/tools/build-automation/Makefile.program vendor/elftoolchain/dist/tools/build-automation/build-system.post.nw vendor/elftoolchain/dist/tools/build-automation/build-system.pre.nw vendor/elftoolchain/dist/tools/build-automation/implementation.nw vendor/elftoolchain/dist/tools/build-automation/introduction.nw vendor/elftoolchain/dist/tools/build-automation/master.nw vendor/elftoolchain/dist/tools/build-automation/slave.nw vendor/elftoolchain/dist/tools/build-automation/userguide.nw vendor/elftoolchain/dist/tools/build-automation/utilities.nw vendor/elftoolchain/dist/tools/build-automation/yabs-slave.1 vendor/elftoolchain/dist/tools/build-automation/yabs.1 Modified: vendor/elftoolchain/dist/INSTALL vendor/elftoolchain/dist/Makefile vendor/elftoolchain/dist/ar/Makefile vendor/elftoolchain/dist/as/as.c vendor/elftoolchain/dist/common/Makefile vendor/elftoolchain/dist/common/os.Linux.mk vendor/elftoolchain/dist/documentation/libelf-by-example/Makefile vendor/elftoolchain/dist/elfcopy/Makefile vendor/elftoolchain/dist/elfcopy/binary.c vendor/elftoolchain/dist/elfcopy/elfcopy.1 vendor/elftoolchain/dist/elfcopy/main.c vendor/elftoolchain/dist/elfdump/elfdump.c vendor/elftoolchain/dist/ld/Makefile vendor/elftoolchain/dist/ld/ld_script.awk vendor/elftoolchain/dist/libdwarf/Makefile vendor/elftoolchain/dist/libdwarf/libdwarf.h vendor/elftoolchain/dist/libdwarf/libdwarf_frame.c vendor/elftoolchain/dist/libdwarf/libdwarf_reloc.c vendor/elftoolchain/dist/libelf/Makefile vendor/elftoolchain/dist/libelf/_libelf_config.h vendor/elftoolchain/dist/libelf/gelf_phdr.c vendor/elftoolchain/dist/libelf/libelf_ehdr.c vendor/elftoolchain/dist/libelftc/Makefile vendor/elftoolchain/dist/libelftc/elftc_reloc_type_str.c vendor/elftoolchain/dist/libelftc/libelftc_dem_gnu3.c vendor/elftoolchain/dist/libpe/Makefile vendor/elftoolchain/dist/mk/elftoolchain.components.mk vendor/elftoolchain/dist/mk/elftoolchain.inc.mk vendor/elftoolchain/dist/mk/elftoolchain.lib.mk vendor/elftoolchain/dist/mk/elftoolchain.prog.mk vendor/elftoolchain/dist/mk/elftoolchain.subdir.mk vendor/elftoolchain/dist/mk/elftoolchain.tex.mk vendor/elftoolchain/dist/nm/nm.1 vendor/elftoolchain/dist/readelf/readelf.c vendor/elftoolchain/dist/strings/strings.c vendor/elftoolchain/dist/test/ar/plugin/Makefile.ardiff vendor/elftoolchain/dist/test/elfcopy/plugin/Makefile.ardiff vendor/elftoolchain/dist/test/libdwarf/ts/common/driver.c vendor/elftoolchain/dist/test/libelf/tset/bin/elf-hash vendor/elftoolchain/dist/test/libelf/tset/bin/elfc vendor/elftoolchain/dist/test/tet/Makefile vendor/elftoolchain/dist/tools/build-automation/Makefile vendor/elftoolchain/dist/tools/build-automation/README Modified: vendor/elftoolchain/dist/INSTALL ============================================================================== --- vendor/elftoolchain/dist/INSTALL Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/INSTALL Fri Apr 27 12:02:11 2018 (r333057) @@ -13,12 +13,12 @@ operating systems. ================= ======== ======================= Operating System Version Supported Architectures ----------------- -------- ----------------------- - `DragonFly BSD`_ 2.10.1 i386 - FreeBSD_ 10.2 amd64 & i386 + `DragonFly BSD`_ 5.2 amd64 + FreeBSD_ 11.1 amd64 & i386 Minix_ 3.0.2 i386 - NetBSD_ 7.0 i386 - OpenBSD_ v5.0 i386 - Ubuntu_ GNU/Linux 14.04LTS x86_64 + NetBSD_ 7.1.2 i386 + OpenBSD_ 6.3 amd64 + Ubuntu_ GNU/Linux 17.10 x86_64 ================= ======== ======================= .. _DragonFly BSD: http://www.dragonflybsd.org/ @@ -40,7 +40,7 @@ directories are present. Prerequisites ------------- -:DragonFly BSD 2.10.1: +:DragonFly BSD 5.2: - The core libraries and utilities should build out of the box on a stock install of DragonFly BSD. @@ -49,14 +49,14 @@ Prerequisites #. The current release of the `Test Execution Toolkit`_ needs to be downloaded and unpacked into the ``test/tet/`` directory. - #. The ``py26-yaml`` package needs to be installed:: + #. The ``py27-yaml`` package needs to be installed:: - % sudo pkgin install py26-yaml + % sudo pkg install py27-yaml - Building additional documentation is not currently supported under DragonFly BSD. -:FreeBSD 10.2: +:FreeBSD 11.1: - The core libraries and utilities should build out of the box on a stock install of FreeBSD. @@ -73,7 +73,7 @@ Prerequisites % sudo pkg install python py27-yaml - Building additional documentation is not currently supported under - FreeBSD 10.2. + FreeBSD 11.1. :Minix 3.2.0: - The following packages are pre-requisites for building the @@ -95,9 +95,9 @@ Prerequisites - Building additional documentation is not currently supported under Minix. -:OpenBSD 5.0: +:OpenBSD 6.3: - The following packages are pre-requisites for building the - sources on OpenBSD 5.0: + sources on OpenBSD 6.3: =================== ===================================== **Package** **Description** @@ -108,26 +108,6 @@ Prerequisites The following command line may be used to install the necessary pre-requisites:: - # pkg_add libarchive-2.8.4p0 - - - The test suites cannot currently be built under OpenBSD. - - - Building additional documentation is not currently supported - under OpenBSD. - -:OpenBSD 5.4: - - The following packages are pre-requisites for building the - sources on OpenBSD 5.4: - - =================== ===================================== - **Package** **Description** - =================== ===================================== - ``libarchive`` An archive access library. - =================== ===================================== - - The following command line may be used to install the necessary - pre-requisites:: - # pkg_add libarchive - The test suites cannot currently be built under OpenBSD. @@ -135,21 +115,10 @@ Prerequisites - Building additional documentation is not currently supported under OpenBSD. -:NetBSD 7.0: - - The following packages are pre-requisites for building the - sources on NetBSD 7.0: +:NetBSD 7.1.2: + - The core libraries and utilities should build out of the box on + a stock install of NetBSD 7.1.2. - =================== ===================================== - **Package** **Description** - =================== ===================================== - ``libarchive`` An archive access library. - =================== ===================================== - - The following command line may be used to install the necessary - pre-requisites:: - - # pkg_add libarchive - - To build and run the test suite: #. The current release of the `Test Execution Toolkit`_, needs @@ -159,14 +128,14 @@ Prerequisites #. The following additional package needs to be installed, as listed in the example command line below :: - % sudo pkg_add py27-yaml + % sudo pkgin install py27-yaml - Building additional documentation is not currently supported under NetBSD. -:Ubuntu GNU/Linux 10.04: +:Ubuntu GNU/Linux 17.10: - The following packages are pre-requisites for building the - sources on Ubuntu GNU/Linux 10.04: + sources on Ubuntu GNU/Linux 17.10: =================== ===================================== **Package** **Description** @@ -176,10 +145,11 @@ Prerequisites ``flex`` Lexical analyser. ``gcc`` C compiler. ``libarchive-dev`` Archive access library. + ``libbsd-dev`` BSD headers and libraries. ``libc6-dev`` Files for C language development. ``libexpat1-dev`` An XML processing library. ``m4`` Macro processor. - ``pmake`` A ``make`` that uses BSD-make syntax. + ``bmake`` NetBSD ``make``. ``python-yaml`` A YAML library for Python. ``sharutils`` For ``uudecode``. ``zlib1g-dev`` Compression library. @@ -189,7 +159,7 @@ Prerequisites pre-requisites:: % sudo apt-get install binutils bison flex gcc libarchive-dev \ - libc6-dev m4 pmake zlib1g-dev + libc6-dev m4 bmake zlib1g-dev - To build and run the test suite: @@ -202,50 +172,12 @@ Prerequisites % sudo apt-get install libexpat1-dev python-yaml sharutils - - To build additional documentation, the ``pgf`` package is - needed:: + - To build additional documentation, the packages listed in the + example command line below are needed:: - % sudo apt-get install pgf + % sudo apt-get install texlive-latex-recommended texlive-pictures \ + libbsd-dev -:Ubuntu GNU/Linux 14.04: - - The following packages are pre-requisites for building the - sources on Ubuntu GNU/Linux 14.04: - - =================== ===================================== - **Package** **Description** - =================== ===================================== - ``bison`` Parser generator. - ``build-essential`` Basic build tools. - ``flex`` Lexical analyser. - ``libarchive-dev`` Archive access library. - ``libexpat1-dev`` An XML processing library. - ``m4`` Macro processor. - ``bmake`` NetBSD ``make``. - ``python-yaml`` A YAML library for Python. - ``sharutils`` For ``uudecode``. - ``zlib1g-dev`` Compression library. - =================== ===================================== - - The following command line may be used to install the necessary - pre-requisites:: - - % sudo apt-get install bison build-essential flex libarchive-dev \ - m4 bmake zlib1g-dev - - - To build and run the test suite: - - #. The current release of the `Test Execution Toolkit`_, needs - to be downloaded and unpacked into the ``test/tet/`` - directory. - - #. The following additional packages need to be installed, as - listed in the example command line below:: - - % sudo apt-get install libexpat1-dev python-yaml sharutils - - - Builds of additional documentation are not currently supported - under Ubuntu GNU/Linux 14.04. - .. _Test Execution Toolkit: http://tetworks.opengroup.org/ .. _OpenGroup: http://www.opengroup.org/ @@ -259,9 +191,9 @@ On `DragonFly BSD`_, FreeBSD_, Minix_, NetBSD_ and Op % make -On Ubuntu GNU/Linux with the **pmake** package installed, use:: +On Ubuntu GNU/Linux with the **bmake** package installed, use:: - % pmake + % bmake Testing the software @@ -274,9 +206,9 @@ On `DragonFly BSD`_, FreeBSD_ and NetBSD_, use:: % make run-tests -On Ubuntu GNU/Linux with the **pmake** package installed, use:: +On Ubuntu GNU/Linux with the **bmake** package installed, use:: - % pmake run-tests + % bmake run-tests Installing the Software ======================= @@ -287,9 +219,9 @@ On `DragonFly BSD`_, FreeBSD_, Minix_, NetBSD_ and Ope % make install -On Ubuntu GNU/Linux with the **pmake** package installed, use:: +On Ubuntu GNU/Linux with the **bmake** package installed, use:: - % pmake install + % bmake install By default the ``install`` target will install utilities into @@ -299,7 +231,7 @@ By default the ``install`` target will install utiliti The installation directory may be changed using the ``DESTDIR`` variable. For example:: - % pmake DESTDIR=$HOME/local install + % bmake DESTDIR=$HOME/local install Additional Information @@ -310,7 +242,7 @@ website`_. .. _project website: http://elftoolchain.sourceforge.net/ -.. $Id: INSTALL 3353 2016-01-18 21:50:13Z jkoshy $ +.. $Id: INSTALL 3613 2018-04-21 19:34:37Z jkoshy $ .. Local Variables: .. mode: rst Modified: vendor/elftoolchain/dist/Makefile ============================================================================== --- vendor/elftoolchain/dist/Makefile Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/Makefile Fri Apr 27 12:02:11 2018 (r333057) @@ -1,4 +1,4 @@ -# $Id: Makefile 3382 2016-01-31 12:31:08Z jkoshy $ +# $Id: Makefile 3605 2018-04-13 18:15:09Z jkoshy $ TOP= . @@ -14,12 +14,12 @@ SUBDIR += libdwarf # Build additional APIs. SUBDIR += libelftc -.if defined(WITH_PE) && ${WITH_PE:tl} == "yes" +.if defined(WITH_PE) && ${WITH_PE} == "yes" SUBDIR += libpe .endif # The instruction set analyser. -.if defined(WITH_ISA) && ${WITH_ISA:tl} == "yes" +.if defined(WITH_ISA) && ${WITH_ISA} == "yes" SUBDIR += isa # ('isa' does not build on all platforms yet). .endif @@ -39,18 +39,19 @@ SUBDIR += strings SUBDIR += tools # Build the test suites. -.if exists(${.CURDIR}/test) && defined(WITH_TESTS) && ${WITH_TESTS:tl} == "yes" +.if exists(${.CURDIR}/test) && defined(WITH_TESTS) && ${WITH_TESTS} == "yes" SUBDIR += test .endif # Build additional build tooling. -.if defined(WITH_BUILD_TOOLS) && ${WITH_BUILD_TOOLS:tl} == "yes" +.if defined(WITH_BUILD_TOOLS) && ${WITH_BUILD_TOOLS} == "yes" SUBDIR += tools .endif # Build documentation at the end. -.if exists(${.CURDIR}/documentation) && defined(WITH_DOCUMENTATION) && \ - ${WITH_DOCUMENTATION:tl} == "yes" +.if exists(${.CURDIR}/documentation) && \ + defined(WITH_ADDITIONAL_DOCUMENTATION) && \ + ${WITH_ADDITIONAL_DOCUMENTATION} == "yes" SUBDIR += documentation .endif @@ -61,7 +62,7 @@ SUBDIR += documentation # # Run the test suites. -.if exists(${.CURDIR}/test) && defined(WITH_TESTS) && ${WITH_TESTS:tl} == "yes" +.if exists(${.CURDIR}/test) && defined(WITH_TESTS) && ${WITH_TESTS} == "yes" run-tests: all .PHONY (cd ${.CURDIR}/test; ${MAKE} test) .endif Modified: vendor/elftoolchain/dist/ar/Makefile ============================================================================== --- vendor/elftoolchain/dist/ar/Makefile Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/ar/Makefile Fri Apr 27 12:02:11 2018 (r333057) @@ -1,4 +1,4 @@ -# $Id: Makefile 3107 2014-12-20 08:31:58Z kaiwang27 $ +# $Id: Makefile 3608 2018-04-14 21:23:04Z jkoshy $ TOP= .. @@ -32,4 +32,6 @@ ${EXTRA_TARGETS}: ${PROG} .if ${OS_HOST} == "OpenBSD" CFLAGS+= -I/usr/local/include LDFLAGS+= -L/usr/local/lib +.elif ${OS_HOST} == "DragonFly" +LDADD+= -lbz2 .endif Modified: vendor/elftoolchain/dist/as/as.c ============================================================================== --- vendor/elftoolchain/dist/as/as.c Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/as/as.c Fri Apr 27 12:02:11 2018 (r333057) @@ -24,6 +24,7 @@ * SUCH DAMAGE. */ +#include #include #include #include @@ -34,7 +35,7 @@ #include -ELFTC_VCSID("$Id: as.c 2799 2012-12-22 09:03:29Z jkoshy $"); +ELFTC_VCSID("$Id: as.c 3581 2017-10-13 23:27:45Z emaste $"); enum as_long_option_index { AS_OPT_DEFSYM, @@ -204,7 +205,7 @@ main(int argc, char **argv) if (option_index >= 0) errx(1, "ERROR: option \"--%s\" is unimplemented.", - as_option_long_options[option_index]); + as_option_long_options[option_index].name); else errx(1, "ERROR: option '-%c' is unimplemented.", Modified: vendor/elftoolchain/dist/common/Makefile ============================================================================== --- vendor/elftoolchain/dist/common/Makefile Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/common/Makefile Fri Apr 27 12:02:11 2018 (r333057) @@ -1,4 +1,4 @@ -# $Id: Makefile 3022 2014-04-17 18:05:58Z jkoshy $ +# $Id: Makefile 3594 2018-04-11 18:26:50Z jkoshy $ TOP= .. @@ -7,12 +7,12 @@ INCSDIR= /usr/include .PHONY: all clean clobber depend obj -all depend obj: +all depend: clean clobber: rm -f ${CLEANFILES} cleandepend: - rm -f .depend + rm -f ${.OBJDIR}/.depend .include "${TOP}/mk/elftoolchain.inc.mk" Modified: vendor/elftoolchain/dist/common/os.Linux.mk ============================================================================== --- vendor/elftoolchain/dist/common/os.Linux.mk Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/common/os.Linux.mk Fri Apr 27 12:02:11 2018 (r333057) @@ -1,13 +1,15 @@ # # Build recipes for Linux based operating systems. # -# $Id: os.Linux.mk 2064 2011-10-26 15:12:32Z jkoshy $ +# $Id: os.Linux.mk 3594 2018-04-11 18:26:50Z jkoshy $ _NATIVE_ELF_FORMAT = native-elf-format -.BEGIN: ${_NATIVE_ELF_FORMAT}.h +.if !make(obj) +.BEGIN: ${.OBJDIR}/${_NATIVE_ELF_FORMAT}.h -${_NATIVE_ELF_FORMAT}.h: +${.OBJDIR}/${_NATIVE_ELF_FORMAT}.h: ${.CURDIR}/${_NATIVE_ELF_FORMAT} > ${.TARGET} || rm ${.TARGET} +.endif -CLEANFILES += ${_NATIVE_ELF_FORMAT}.h +CLEANFILES += ${.OBJDIR}/${_NATIVE_ELF_FORMAT}.h Modified: vendor/elftoolchain/dist/documentation/libelf-by-example/Makefile ============================================================================== --- vendor/elftoolchain/dist/documentation/libelf-by-example/Makefile Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/documentation/libelf-by-example/Makefile Fri Apr 27 12:02:11 2018 (r333057) @@ -1,7 +1,7 @@ # # Libelf by Example # -# $Id: Makefile 2441 2012-02-21 05:46:43Z jkoshy $ +# $Id: Makefile 3600 2018-04-12 06:45:40Z jkoshy $ TOP = ../.. @@ -10,19 +10,30 @@ DOC= libelf-by-example SRCS= libelf-by-example.tex prog1.txt prog2.txt prog3.txt \ prog4.txt prog5.txt prog6.txt +CLEANFILES+= ${SRCS:Mprog*:S/.txt/.c/} + .include "${TOP}/mk/elftoolchain.tex.mk" .if ${OS_HOST} == "Linux" +EXTRA_FLAGS= -I/usr/include/bsd -DLIBBSD_OVERLAY EXTRA_LIBS= -lbsd .endif check-example-syntax: .PHONY -.for f in ${SRCS:Mprog*} - @c=$$(basename ${f} .txt).c; sed -e 's/@[^@]*@//' \ - ${.CURDIR}/${f} > ${.OBJDIR}/$${c}; \ - echo -n $${c} ' '; cc -I${.CURDIR}/${TOP}/common \ - -I${.CURDIR}/${TOP}/libelf ${.OBJDIR}/$${c} \ - -L${.CURDIR}/${TOP}/libelf -lelf ${EXTRA_LIBS} && \ - rm ${.OBJDIR}/$${c} a.out +.for f in ${SRCS:Mprog*:S/.txt//} + @sed -e 's/@[^@]*@//' \ + ${.CURDIR}/${f}.txt > ${.OBJDIR}/${f}.c; \ + echo -n ${f} ' '; \ + libelf="${.OBJDIR}/${TOP}/libelf"; \ + if [ ! -d $${libelf} -a "${.CURDIR}" != "${.OBJDIR}" ]; then \ + suffix="${.OBJDIR:S,${.CURDIR}/,,}"; \ + libelf="${.CURDIR}/${TOP}/libelf/$${suffix}"; \ + fi; \ + cc -I${.CURDIR}/${TOP}/common \ + -I${.CURDIR}/${TOP}/libelf \ + ${EXTRA_FLAGS} \ + ${.OBJDIR}/${f}.c \ + -L"$${libelf}" -lelf ${EXTRA_LIBS} && \ + rm ${.OBJDIR}/a.out .endfor @echo Modified: vendor/elftoolchain/dist/elfcopy/Makefile ============================================================================== --- vendor/elftoolchain/dist/elfcopy/Makefile Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/elfcopy/Makefile Fri Apr 27 12:02:11 2018 (r333057) @@ -1,4 +1,4 @@ -# $Id: Makefile 3381 2016-01-30 19:39:47Z jkoshy $ +# $Id: Makefile 3608 2018-04-14 21:23:04Z jkoshy $ TOP= .. @@ -18,7 +18,7 @@ LDADD= -lelf -lelftc LDADD+= -larchive .endif -.if defined(WITH_PE) && ${WITH_PE:tl} == "yes" +.if defined(WITH_PE) && ${WITH_PE} == "yes" SRCS+= pe.c CFLAGS+= -DWITH_PE=1 @@ -51,4 +51,6 @@ ${EXTRA_TARGETS}: ${PROG} .if ${OS_HOST} == "OpenBSD" CFLAGS+= -I/usr/local/include LDFLAGS+= -L/usr/local/lib +.elif ${OS_HOST} == "DragonFly" +LDADD+= -lbz2 .endif Modified: vendor/elftoolchain/dist/elfcopy/binary.c ============================================================================== --- vendor/elftoolchain/dist/elfcopy/binary.c Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/elfcopy/binary.c Fri Apr 27 12:02:11 2018 (r333057) @@ -36,7 +36,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: binary.c 3445 2016-04-20 19:08:30Z emaste $"); +ELFTC_VCSID("$Id: binary.c 3611 2018-04-16 21:35:18Z jkoshy $"); /* * Convert ELF object to `binary'. Sections with SHF_ALLOC flag set @@ -215,7 +215,7 @@ create_elf_from_binary(struct elfcopy *ecp, int ifd, c if ((sym_basename = strdup(ifn)) == NULL) err(1, "strdup"); for (p = sym_basename; *p != '\0'; p++) - if (!isalnum(*p)) + if (!isalnum(*p & 0xFF)) *p = '_'; #define _GEN_SYMNAME(S) do { \ snprintf(name, sizeof(name), "%s%s%s", "_binary_", sym_basename, S); \ Modified: vendor/elftoolchain/dist/elfcopy/elfcopy.1 ============================================================================== --- vendor/elftoolchain/dist/elfcopy/elfcopy.1 Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/elfcopy/elfcopy.1 Fri Apr 27 12:02:11 2018 (r333057) @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elfcopy.1 3426 2016-03-05 13:32:28Z emaste $ +.\" $Id: elfcopy.1 3565 2017-08-31 02:24:19Z emaste $ .\" -.Dd March 5, 2016 +.Dd August 30, 2017 .Os .Dt ELFCOPY 1 .Sh NAME @@ -83,6 +83,7 @@ .Op Fl -srec-forceS3 .Op Fl -srec-len Ns = Ns Ar val .Op Fl -strip-dwo +.Op Fl -strip-symbols= Ns Ar filename .Op Fl -strip-unneeded .Ar infile .Op Ar outfile @@ -339,6 +340,10 @@ This option is only meaningful when the output target .Dq srec . .It Fl -strip-dwo Do not copy .dwo debug sections to the output file. +.It Fl -strip-symbols= Ns Ar filename +Do not copy any of the symbols specified by +.Ar filename +to the output. .It Fl -strip-unneeded Do not copy symbols that are not needed for relocation processing. .El Modified: vendor/elftoolchain/dist/elfcopy/main.c ============================================================================== --- vendor/elftoolchain/dist/elfcopy/main.c Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/elfcopy/main.c Fri Apr 27 12:02:11 2018 (r333057) @@ -39,7 +39,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: main.c 3520 2017-04-17 01:47:52Z kaiwang27 $"); +ELFTC_VCSID("$Id: main.c 3577 2017-09-14 02:19:42Z emaste $"); enum options { @@ -679,6 +679,8 @@ create_file(struct elfcopy *ecp, const char *src, cons if ((ifd = open(elftemp, O_RDONLY)) == -1) err(EXIT_FAILURE, "open %s failed", src); close(efd); + if (unlink(elftemp) < 0) + err(EXIT_FAILURE, "unlink %s failed", elftemp); free(elftemp); } @@ -1283,8 +1285,9 @@ parse_symlist_file(struct elfcopy *ecp, const char *fn err(EXIT_FAILURE, "can not open %s", fn); if ((data = malloc(sb.st_size + 1)) == NULL) err(EXIT_FAILURE, "malloc failed"); - if (fread(data, 1, sb.st_size, fp) == 0 || ferror(fp)) - err(EXIT_FAILURE, "fread failed"); + if (sb.st_size > 0) + if (fread(data, sb.st_size, 1, fp) != 1) + err(EXIT_FAILURE, "fread failed"); fclose(fp); data[sb.st_size] = '\0'; @@ -1534,6 +1537,22 @@ print_version(void) exit(EXIT_SUCCESS); } +/* + * Compare the ending of s with end. + */ +static int +strrcmp(const char *s, const char *end) +{ + size_t endlen, slen; + + slen = strlen(s); + endlen = strlen(end); + + if (slen >= endlen) + s += slen - endlen; + return (strcmp(s, end)); +} + int main(int argc, char **argv) { @@ -1567,12 +1586,16 @@ main(int argc, char **argv) if ((ecp->progname = ELFTC_GETPROGNAME()) == NULL) ecp->progname = "elfcopy"; - if (strcmp(ecp->progname, "strip") == 0) + if (strrcmp(ecp->progname, "strip") == 0) strip_main(ecp, argc, argv); - else if (strcmp(ecp->progname, "mcs") == 0) + else if (strrcmp(ecp->progname, "mcs") == 0) mcs_main(ecp, argc, argv); - else + else { + if (strrcmp(ecp->progname, "elfcopy") != 0 && + strrcmp(ecp->progname, "objcopy") != 0) + warnx("program mode not known, defaulting to elfcopy"); elfcopy_main(ecp, argc, argv); + } free_sec_add(ecp); free_sec_act(ecp); Modified: vendor/elftoolchain/dist/elfdump/elfdump.c ============================================================================== --- vendor/elftoolchain/dist/elfdump/elfdump.c Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/elfdump/elfdump.c Fri Apr 27 12:02:11 2018 (r333057) @@ -50,7 +50,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: elfdump.c 3521 2017-06-04 20:07:09Z jkoshy $"); +ELFTC_VCSID("$Id: elfdump.c 3584 2017-11-05 20:51:43Z jkoshy $"); #if defined(ELFTC_NEED_ELF_NOTE_DEFINITION) #include "native-elf-format.h" @@ -915,7 +915,7 @@ elf_print_ar(struct elfdump *ed, int fd) Elf_Arhdr *arh; Elf_Arsym *arsym; Elf_Cmd cmd; - char idx[10]; + char idx[21]; size_t cnt, i; ed->ar = ed->elf; @@ -1496,7 +1496,7 @@ elf_print_symtab(struct elfdump *ed, int i) struct section *s; const char *name; uint16_t *vs; - char idx[10]; + char idx[13]; Elf_Data *data; GElf_Sym sym; int len, j, elferr, nvs; @@ -1590,7 +1590,7 @@ elf_print_dynamic(struct elfdump *ed) { struct section *s; const char *name; - char idx[10]; + char idx[13]; Elf_Data *data; GElf_Dyn dyn; int elferr, i, len; @@ -2052,7 +2052,7 @@ elf_print_note(struct elfdump *ed) size_t count; int elferr, i; uint8_t *src; - char idx[10]; + char idx[17]; s = NULL; for (i = 0; (size_t)i < ed->shnum; i++) { Modified: vendor/elftoolchain/dist/ld/Makefile ============================================================================== --- vendor/elftoolchain/dist/ld/Makefile Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/ld/Makefile Fri Apr 27 12:02:11 2018 (r333057) @@ -1,4 +1,4 @@ -# $Id: Makefile 3407 2016-02-14 17:47:23Z jkoshy $ +# $Id: Makefile 3594 2018-04-11 18:26:50Z jkoshy $ TOP= .. @@ -47,6 +47,6 @@ YFLAGS= -d .SUFFIXES: .ld .c .ld.c: - awk -f ld_script.awk ${.ALLSRC} > ${.TARGET} + awk -f ${.CURDIR}/ld_script.awk ${.ALLSRC} > ${.TARGET} .include "${TOP}/mk/elftoolchain.prog.mk" Modified: vendor/elftoolchain/dist/ld/ld_script.awk ============================================================================== --- vendor/elftoolchain/dist/ld/ld_script.awk Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/ld/ld_script.awk Fri Apr 27 12:02:11 2018 (r333057) @@ -1,10 +1,19 @@ -# $Id: ld_script.awk 2493 2012-04-15 18:59:09Z kaiwang27 $ +# Transform text file contents into a string literal. +# +# Usage: awk -f THIS-SCRIPT INPUT > OUTPUT +# +# $Id: ld_script.awk 3593 2018-04-11 18:26:20Z jkoshy $ BEGIN { + # Generate a symbol name based on the last component + # of the input file name. split(ARGV[1], s, "."); + sub(".*/", "", s[1]); printf "const char *%s = ", s[1]; } +# Enclose each line of text with a preceding and trailing '"', +# escaping any '"' characters that are present. { printf "\""; gsub("\"", "\\\""); Modified: vendor/elftoolchain/dist/libdwarf/Makefile ============================================================================== --- vendor/elftoolchain/dist/libdwarf/Makefile Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/libdwarf/Makefile Fri Apr 27 12:02:11 2018 (r333057) @@ -1,6 +1,6 @@ -# $Id: Makefile 3097 2014-09-02 22:10:18Z kaiwang27 $ +# $Id: Makefile 3594 2018-04-11 18:26:50Z jkoshy $ -TOP= ${.CURDIR}/.. +TOP= .. LIB= dwarf Modified: vendor/elftoolchain/dist/libdwarf/libdwarf.h ============================================================================== --- vendor/elftoolchain/dist/libdwarf/libdwarf.h Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/libdwarf/libdwarf.h Fri Apr 27 12:02:11 2018 (r333057) @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: libdwarf.h 3295 2016-01-08 22:08:10Z jkoshy $ + * $Id: libdwarf.h 3578 2017-09-14 02:21:28Z emaste $ */ #ifndef _LIBDWARF_H_ @@ -440,6 +440,7 @@ enum Dwarf_ISA { DW_ISA_X86, DW_ISA_X86_64, DW_ISA_AARCH64, + DW_ISA_RISCV, DW_ISA_MAX }; Modified: vendor/elftoolchain/dist/libdwarf/libdwarf_frame.c ============================================================================== --- vendor/elftoolchain/dist/libdwarf/libdwarf_frame.c Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/libdwarf/libdwarf_frame.c Fri Apr 27 12:02:11 2018 (r333057) @@ -26,7 +26,7 @@ #include "_libdwarf.h" -ELFTC_VCSID("$Id: libdwarf_frame.c 3106 2014-12-19 16:00:58Z kaiwang27 $"); +ELFTC_VCSID("$Id: libdwarf_frame.c 3589 2018-03-13 20:34:33Z kaiwang27 $"); static int _dwarf_frame_find_cie(Dwarf_FrameSec fs, Dwarf_Unsigned offset, @@ -142,6 +142,8 @@ _dwarf_frame_parse_lsb_cie_augment(Dwarf_Debug dbg, Dw augdata_p = cie->cie_augdata; while (*aug_p != '\0') { switch (*aug_p) { + case 'S': + break; case 'L': /* Skip one augment in augment data. */ augdata_p++; Modified: vendor/elftoolchain/dist/libdwarf/libdwarf_reloc.c ============================================================================== --- vendor/elftoolchain/dist/libdwarf/libdwarf_reloc.c Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/libdwarf/libdwarf_reloc.c Fri Apr 27 12:02:11 2018 (r333057) @@ -26,7 +26,7 @@ #include "_libdwarf.h" -ELFTC_VCSID("$Id: libdwarf_reloc.c 3198 2015-05-14 18:36:19Z emaste $"); +ELFTC_VCSID("$Id: libdwarf_reloc.c 3578 2017-09-14 02:21:28Z emaste $"); Dwarf_Unsigned _dwarf_get_reloc_type(Dwarf_P_Debug dbg, int is64) @@ -49,6 +49,8 @@ _dwarf_get_reloc_type(Dwarf_P_Debug dbg, int is64) return (R_ARM_ABS32); case DW_ISA_MIPS: return (is64 ? R_MIPS_64 : R_MIPS_32); + case DW_ISA_RISCV: + return (is64 ? R_RISCV_64 : R_RISCV_32); case DW_ISA_IA64: return (is64 ? R_IA_64_DIR64LSB : R_IA_64_DIR32LSB); default: @@ -99,6 +101,12 @@ _dwarf_get_reloc_size(Dwarf_Debug dbg, Dwarf_Unsigned if (rel_type == R_MIPS_32) return (4); else if (rel_type == R_MIPS_64) + return (8); + break; + case EM_RISCV: + if (rel_type == R_RISCV_32) + return (4); + else if (rel_type == R_RISCV_64) return (8); break; case EM_IA_64: Modified: vendor/elftoolchain/dist/libelf/Makefile ============================================================================== --- vendor/elftoolchain/dist/libelf/Makefile Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/libelf/Makefile Fri Apr 27 12:02:11 2018 (r333057) @@ -1,6 +1,6 @@ -# $Id: Makefile 2605 2012-10-02 17:52:20Z jkoshy $ +# $Id: Makefile 3594 2018-04-11 18:26:50Z jkoshy $ -TOP= ${.CURDIR}/.. +TOP= .. LIB= elf Modified: vendor/elftoolchain/dist/libelf/_libelf_config.h ============================================================================== --- vendor/elftoolchain/dist/libelf/_libelf_config.h Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/libelf/_libelf_config.h Fri Apr 27 12:02:11 2018 (r333057) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: _libelf_config.h 3400 2016-02-12 18:38:49Z emaste $ + * $Id: _libelf_config.h 3566 2017-08-31 02:28:40Z emaste $ */ #if defined(__APPLE__) || defined(__DragonFly__) @@ -97,7 +97,7 @@ #define LIBELF_BYTEORDER ELFDATA2MSB #define LIBELF_CLASS ELFCLASS32 -#elif defined(__riscv64) +#elif defined(__riscv) && (__riscv_xlen == 64) #define LIBELF_ARCH EM_RISCV #define LIBELF_BYTEORDER ELFDATA2LSB Modified: vendor/elftoolchain/dist/libelf/gelf_phdr.c ============================================================================== --- vendor/elftoolchain/dist/libelf/gelf_phdr.c Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/libelf/gelf_phdr.c Fri Apr 27 12:02:11 2018 (r333057) @@ -31,7 +31,7 @@ #include "_libelf.h" -ELFTC_VCSID("$Id: gelf_phdr.c 3177 2015-03-30 18:19:41Z emaste $"); +ELFTC_VCSID("$Id: gelf_phdr.c 3576 2017-09-14 02:15:29Z emaste $"); Elf32_Phdr * elf32_getphdr(Elf *e) @@ -53,24 +53,26 @@ gelf_getphdr(Elf *e, int index, GElf_Phdr *d) Elf64_Ehdr *eh64; Elf32_Phdr *ep32; Elf64_Phdr *ep64; + size_t phnum; if (d == NULL || e == NULL || ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64) || - (e->e_kind != ELF_K_ELF) || index < 0) { + (e->e_kind != ELF_K_ELF) || index < 0 || + elf_getphdrnum(e, &phnum) < 0) { LIBELF_SET_ERROR(ARGUMENT, 0); return (NULL); } + if ((size_t)index >= phnum) { + LIBELF_SET_ERROR(ARGUMENT, 0); + return (NULL); + } + if (ec == ELFCLASS32) { if ((eh32 = _libelf_ehdr(e, ELFCLASS32, 0)) == NULL || ((ep32 = _libelf_getphdr(e, ELFCLASS32)) == NULL)) return (NULL); - if (index >= eh32->e_phnum) { - LIBELF_SET_ERROR(ARGUMENT, 0); - return (NULL); - } - ep32 += index; d->p_type = ep32->p_type; @@ -87,11 +89,6 @@ gelf_getphdr(Elf *e, int index, GElf_Phdr *d) (ep64 = _libelf_getphdr(e, ELFCLASS64)) == NULL) return (NULL); - if (index >= eh64->e_phnum) { - LIBELF_SET_ERROR(ARGUMENT, 0); - return (NULL); - } - ep64 += index; *d = *ep64; @@ -125,13 +122,15 @@ gelf_newphdr(Elf *e, size_t count) int gelf_update_phdr(Elf *e, int ndx, GElf_Phdr *s) { - int ec, phnum; + int ec; + size_t phnum; void *ehdr; Elf32_Phdr *ph32; Elf64_Phdr *ph64; if (s == NULL || e == NULL || e->e_kind != ELF_K_ELF || - ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) { + ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64) || + elf_getphdrnum(e, &phnum) < 0) { LIBELF_SET_ERROR(ARGUMENT, 0); return (0); } @@ -144,12 +143,7 @@ gelf_update_phdr(Elf *e, int ndx, GElf_Phdr *s) if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL) return (0); - if (ec == ELFCLASS32) - phnum = ((Elf32_Ehdr *) ehdr)->e_phnum; - else - phnum = ((Elf64_Ehdr *) ehdr)->e_phnum; - - if (ndx < 0 || ndx > phnum) { + if (ndx < 0 || (size_t)ndx > phnum) { LIBELF_SET_ERROR(ARGUMENT, 0); return (0); } Modified: vendor/elftoolchain/dist/libelf/libelf_ehdr.c ============================================================================== --- vendor/elftoolchain/dist/libelf/libelf_ehdr.c Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/libelf/libelf_ehdr.c Fri Apr 27 12:02:11 2018 (r333057) @@ -31,7 +31,7 @@ #include "_libelf.h" -ELFTC_VCSID("$Id: libelf_ehdr.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: libelf_ehdr.c 3575 2017-09-14 02:13:36Z emaste $"); /* * Retrieve counts for sections, phdrs and the section string table index @@ -170,10 +170,6 @@ _libelf_ehdr(Elf *e, int ec, int allocate) (*xlator)((unsigned char*) ehdr, msz, e->e_rawfile, (size_t) 1, e->e_byteorder != LIBELF_PRIVATE(byteorder)); - /* - * If extended numbering is being used, read the correct - * number of sections and program header entries. - */ if (ec == ELFCLASS32) { phnum = ((Elf32_Ehdr *) ehdr)->e_phnum; shnum = ((Elf32_Ehdr *) ehdr)->e_shnum; @@ -193,12 +189,19 @@ _libelf_ehdr(Elf *e, int ec, int allocate) return (NULL); } - if (shnum != 0 || shoff == 0LL) { /* not using extended numbering */ + /* + * If extended numbering is being used, read the correct + * number of sections and program header entries. + */ + if ((shnum == 0 && shoff != 0) || phnum == PN_XNUM || strndx == SHN_XINDEX) { + if (_libelf_load_extended(e, ec, shoff, phnum, strndx) == 0) + return (NULL); + } else { + /* not using extended numbering */ e->e_u.e_elf.e_nphdr = phnum; e->e_u.e_elf.e_nscn = shnum; e->e_u.e_elf.e_strndx = strndx; - } else if (_libelf_load_extended(e, ec, shoff, phnum, strndx) == 0) - return (NULL); + } return (ehdr); } Modified: vendor/elftoolchain/dist/libelftc/Makefile ============================================================================== --- vendor/elftoolchain/dist/libelftc/Makefile Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/libelftc/Makefile Fri Apr 27 12:02:11 2018 (r333057) @@ -1,6 +1,6 @@ -# $Id: Makefile 3489 2016-08-31 00:12:15Z emaste $ +# $Id: Makefile 3601 2018-04-12 16:58:53Z jkoshy $ -TOP= ${.CURDIR}/.. +TOP= .. LIB= elftc @@ -28,7 +28,8 @@ SHLIB_MAJOR= 1 WARNS?= 6 -CLEANFILES+= elftc_version.c +ELFTC_VERSION_FILE= ${.OBJDIR}/elftc_version.c +CLEANFILES+= ${ELFTC_VERSION_FILE} LDADD+= -lelf @@ -50,10 +51,10 @@ MLINKS= elftc_bfd_find_target.3 elftc_bfd_target_byteo elftc_string_table_create.3 elftc_string_table_insert.3 \ elftc_string_table_create.3 elftc_string_table_lookup.3 -.if !make(clean) && !make(clobber) +.if !make(clean) && !make(clobber) && !make(obj) .BEGIN: .SILENT - ${.CURDIR}/make-toolchain-version -t ${TOP} -r ${RELEASE} \ - -h ${OS_HOST} + ${.CURDIR}/make-toolchain-version -t ${.CURDIR}/${TOP} \ + -r ${RELEASE} -h ${OS_HOST} -o ${ELFTC_VERSION_FILE} .endif .include "${TOP}/mk/elftoolchain.lib.mk" Modified: vendor/elftoolchain/dist/libelftc/elftc_reloc_type_str.c ============================================================================== --- vendor/elftoolchain/dist/libelftc/elftc_reloc_type_str.c Fri Apr 27 11:00:12 2018 (r333056) +++ vendor/elftoolchain/dist/libelftc/elftc_reloc_type_str.c Fri Apr 27 12:02:11 2018 (r333057) @@ -501,6 +501,120 @@ elftc_reloc_type_str(unsigned int mach, unsigned int t case 116: return "R_PPC_EMB_RELSDA"; } break; + case EM_PPC64: + switch(type) { + case 0: return "R_PPC64_NONE"; + case 1: return "R_PPC64_ADDR32"; + case 2: return "R_PPC64_ADDR24"; + case 3: return "R_PPC64_ADDR16"; + case 4: return "R_PPC64_ADDR16_LO"; + case 5: return "R_PPC64_ADDR16_HI"; + case 6: return "R_PPC64_ADDR16_HA"; + case 7: return "R_PPC64_ADDR14"; + case 8: return "R_PPC64_ADDR14_BRTAKEN"; + case 9: return "R_PPC64_ADDR14_BRNTAKEN"; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Fri Apr 27 12:03:28 2018 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AD0CFA67E0; Fri, 27 Apr 2018 12:03:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EB7B9824E8; Fri, 27 Apr 2018 12:03:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC25E2632F; Fri, 27 Apr 2018 12:03:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3RC3RVE060484; Fri, 27 Apr 2018 12:03:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3RC3RZ8060483; Fri, 27 Apr 2018 12:03:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804271203.w3RC3RZ8060483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 27 Apr 2018 12:03:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r333058 - vendor/elftoolchain/elftoolchain-r3614 X-SVN-Group: vendor X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: vendor/elftoolchain/elftoolchain-r3614 X-SVN-Commit-Revision: 333058 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: Fri, 27 Apr 2018 12:03:28 -0000 Author: emaste Date: Fri Apr 27 12:03:27 2018 New Revision: 333058 URL: https://svnweb.freebsd.org/changeset/base/333058 Log: Tag ELF Tool Chain r3614 Added: vendor/elftoolchain/elftoolchain-r3614/ - copied from r333057, vendor/elftoolchain/dist/ From owner-svn-src-vendor@freebsd.org Fri Apr 27 21:30:03 2018 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6314FB2541; Fri, 27 Apr 2018 21:30:03 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46D6B8037C; Fri, 27 Apr 2018 21:30:03 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 237C1430F; Fri, 27 Apr 2018 21:30:03 +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 w3RLU3cC052218; Fri, 27 Apr 2018 21:30:03 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3RLU1GD052201; Fri, 27 Apr 2018 21:30:01 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201804272130.w3RLU1GD052201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 27 Apr 2018 21:30:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r333077 - in vendor-sys/acpica/dist: . source/common source/compiler source/components/debugger source/components/dispatcher source/components/resources source/components/tables source/... X-SVN-Group: vendor-sys X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in vendor-sys/acpica/dist: . source/common source/compiler source/components/debugger source/components/dispatcher source/components/resources source/components/tables source/components/utilities sour... X-SVN-Commit-Revision: 333077 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: Fri, 27 Apr 2018 21:30:04 -0000 Author: jkim Date: Fri Apr 27 21:30:01 2018 New Revision: 333077 URL: https://svnweb.freebsd.org/changeset/base/333077 Log: Import ACPICA 20180427. Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/source/common/adfile.c vendor-sys/acpica/dist/source/common/dmtbinfo2.c vendor-sys/acpica/dist/source/compiler/aslcompiler.h vendor-sys/acpica/dist/source/compiler/aslglobal.h vendor-sys/acpica/dist/source/compiler/aslhex.c vendor-sys/acpica/dist/source/compiler/aslload.c vendor-sys/acpica/dist/source/compiler/aslmessages.c vendor-sys/acpica/dist/source/compiler/aslmessages.h vendor-sys/acpica/dist/source/compiler/asloperands.c vendor-sys/acpica/dist/source/compiler/asltypes.h vendor-sys/acpica/dist/source/compiler/aslutils.c vendor-sys/acpica/dist/source/compiler/aslxref.c vendor-sys/acpica/dist/source/components/debugger/dbnames.c vendor-sys/acpica/dist/source/components/debugger/dbtest.c vendor-sys/acpica/dist/source/components/dispatcher/dswscope.c vendor-sys/acpica/dist/source/components/resources/rsdump.c vendor-sys/acpica/dist/source/components/tables/tbinstal.c vendor-sys/acpica/dist/source/components/utilities/utprint.c vendor-sys/acpica/dist/source/components/utilities/utstring.c vendor-sys/acpica/dist/source/include/acapps.h vendor-sys/acpica/dist/source/include/acnames.h vendor-sys/acpica/dist/source/include/acpixf.h vendor-sys/acpica/dist/source/tools/acpiexec/aecommon.h vendor-sys/acpica/dist/source/tools/acpiexec/aeexception.c vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Fri Apr 27 21:22:32 2018 (r333076) +++ vendor-sys/acpica/dist/changes.txt Fri Apr 27 21:30:01 2018 (r333077) @@ -1,4 +1,47 @@ ---------------------------------------- +27 April 2018. Summary of changes for version 20180427: + + +1) ACPICA kernel-resident subsystem: + +Debugger: Added support for Package objects in the "Test Objects" +command. This command walks the entire namespace and evaluates all named +data objects (Integers, Strings, Buffers, and now Packages). + +Improved error messages for the namespace root node. Originally, the root +was referred to by the confusing string "\___". This has been replaced by +"Namespace Root" for clarification. + +Fixed a potential infinite loop in the AcpiRsDumpByteList function. Colin +Ian King . + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implemented support to detect and flag illegal forward references. +For compatibility with other ACPI implementations, these references are +now illegal at the root level of the DSDT or SSDTs. Forward references +have always been illegal within control methods. This change should not +affect existing ASL/AML code because of the fact that these references +have always been illegal in the other ACPI implementation. + +iASL: Added error messages for the case where a table OEM ID and OEM +TABLE ID strings are longer than the ACPI-defined length. Previously, +these strings were simply silently truncated. + +iASL: Enhanced the -tc option (which creates an AML hex file in C, +suitable for import into a firmware project): + 1) Create a unique name for the table, to simplify use of multiple +SSDTs. + 2) Add a protection #ifdef in the file, similar to a .h header file. +With assistance from Sami Mujawar, sami.mujawar@arm.com and Evan Lloyd, +evan.lloyd@arm.com + +AcpiExec: Added a new option, -df, to disable the local fault handler. +This is useful during debugging, where it may be desired to drop into a +debugger on a fault. + +---------------------------------------- 13 March 2018. Summary of changes for version 20180313: Modified: vendor-sys/acpica/dist/source/common/adfile.c ============================================================================== --- vendor-sys/acpica/dist/source/common/adfile.c Fri Apr 27 21:22:32 2018 (r333076) +++ vendor-sys/acpica/dist/source/common/adfile.c Fri Apr 27 21:30:01 2018 (r333077) @@ -454,3 +454,59 @@ FlSplitInputPathname ( return (AE_OK); } + + +/******************************************************************************* + * + * FUNCTION: FlGetFileBasename + * + * PARAMETERS: FilePathname - File path to be split + * + * RETURN: The extracted base name of the file, in upper case + * + * DESCRIPTION: Extract the file base name (the file name with no extension) + * from the input pathname. + * + * Note: Any backslashes in the pathname should be previously + * converted to forward slashes before calling this function. + * + ******************************************************************************/ + +char * +FlGetFileBasename ( + char *FilePathname) +{ + char *FileBasename; + char *Substring; + + + /* Backup to last slash or colon */ + + Substring = strrchr (FilePathname, '/'); + if (!Substring) + { + Substring = strrchr (FilePathname, ':'); + } + + /* Extract the full filename (base + extension) */ + + if (Substring) + { + FileBasename = FlStrdup (Substring + 1); + } + else + { + FileBasename = FlStrdup (FilePathname); + } + + /* Remove the filename extension if present */ + + Substring = strchr (FileBasename, '.'); + if (Substring) + { + *Substring = 0; + } + + AcpiUtStrupr (FileBasename); + return (FileBasename); +} Modified: vendor-sys/acpica/dist/source/common/dmtbinfo2.c ============================================================================== --- vendor-sys/acpica/dist/source/common/dmtbinfo2.c Fri Apr 27 21:22:32 2018 (r333076) +++ vendor-sys/acpica/dist/source/common/dmtbinfo2.c Fri Apr 27 21:30:01 2018 (r333077) @@ -1063,7 +1063,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoNfit7[] = {ACPI_DMT_UINT24, ACPI_NFIT7_OFFSET (Reserved[0]), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_NFIT7_OFFSET (Capabilities), "Capabilities (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_NFIT7_FLAG_OFFSET (Capabilities,0), "Cache Flush to NVDIMM", 0}, - {ACPI_DMT_FLAG1, ACPI_NFIT7_FLAG_OFFSET (Capabilities,0), "Memory Flush to MVDIMM", 0}, + {ACPI_DMT_FLAG1, ACPI_NFIT7_FLAG_OFFSET (Capabilities,0), "Memory Flush to NVDIMM", 0}, {ACPI_DMT_FLAG2, ACPI_NFIT7_FLAG_OFFSET (Capabilities,0), "Memory Mirroring", 0}, {ACPI_DMT_UINT32, ACPI_NFIT7_OFFSET (Reserved2), "Reserved", 0}, ACPI_DMT_TERMINATOR Modified: vendor-sys/acpica/dist/source/compiler/aslcompiler.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompiler.h Fri Apr 27 21:22:32 2018 (r333076) +++ vendor-sys/acpica/dist/source/compiler/aslcompiler.h Fri Apr 27 21:30:01 2018 (r333077) @@ -1187,6 +1187,15 @@ UtDumpBasicOp ( ACPI_PARSE_OBJECT *Op, UINT32 Level); +void * +UtGetParentMethod ( + ACPI_NAMESPACE_NODE *Node); + +BOOLEAN +UtNodeIsDescendantOf ( + ACPI_NAMESPACE_NODE *Node1, + ACPI_NAMESPACE_NODE *Node2); + void UtDisplaySupportedTables ( void); Modified: vendor-sys/acpica/dist/source/compiler/aslglobal.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslglobal.h Fri Apr 27 21:22:32 2018 (r333076) +++ vendor-sys/acpica/dist/source/compiler/aslglobal.h Fri Apr 27 21:30:01 2018 (r333077) @@ -220,7 +220,8 @@ const char *Gbl_OpFlagNames[A "OP_COMPILER_EMITTED", "OP_IS_DUPLICATE", "OP_IS_RESOURCE_DATA", - "OP_IS_NULL_RETURN" + "OP_IS_NULL_RETURN", + "OP_NOT_FOUND_DURING_LOAD" }; #else Modified: vendor-sys/acpica/dist/source/compiler/aslhex.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslhex.c Fri Apr 27 21:22:32 2018 (r333076) +++ vendor-sys/acpica/dist/source/compiler/aslhex.c Fri Apr 27 21:30:01 2018 (r333077) @@ -150,6 +150,7 @@ *****************************************************************************/ #include "aslcompiler.h" +#include "acapps.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("ashex") @@ -265,6 +266,9 @@ HxReadAmlOutputFile ( * output file, but formatted into hex/ascii bytes suitable for * inclusion into a C source file. * + * Note: the base name of the hex output file is prepended to + * all symbols as they are output to the file. + * ******************************************************************************/ static void @@ -276,18 +280,30 @@ HxDoHexOutputC ( UINT32 Offset = 0; UINT32 AmlFileSize; UINT32 i; + char *FileBasename; + /* Obtain the file basename (filename with no extension) */ + + FileBasename = FlGetFileBasename (Gbl_Files [ASL_FILE_HEX_OUTPUT].Filename); + /* Get AML size, seek back to start */ AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT); FlSeekFile (ASL_FILE_AML_OUTPUT, 0); + /* Finish the file header and emit the non-data symbols */ + FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n"); FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n", AmlFileSize); - FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] =\n{\n"); + FlPrintFile (ASL_FILE_HEX_OUTPUT, "#ifndef __%s_HEX__\n", FileBasename); + FlPrintFile (ASL_FILE_HEX_OUTPUT, "#define __%s_HEX__\n\n", FileBasename); + + AcpiUtStrlwr (FileBasename); + FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char %s_aml_code[] =\n{\n", FileBasename); + while (Offset < AmlFileSize) { /* Read enough bytes needed for one output line */ @@ -303,7 +319,7 @@ HxDoHexOutputC ( for (i = 0; i < LineLength; i++) { /* - * Print each hex byte. + * Output each hex byte in the form: "0xnn," * Add a comma until the very last byte of the AML file * (Some C compilers complain about a trailing comma) */ @@ -337,7 +353,8 @@ HxDoHexOutputC ( Offset += LineLength; } - FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n"); + FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n\n"); + FlPrintFile (ASL_FILE_HEX_OUTPUT, "#endif\n"); } Modified: vendor-sys/acpica/dist/source/compiler/aslload.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslload.c Fri Apr 27 21:22:32 2018 (r333076) +++ vendor-sys/acpica/dist/source/compiler/aslload.c Fri Apr 27 21:30:01 2018 (r333077) @@ -153,9 +153,10 @@ #include "amlcode.h" #include "acdispat.h" #include "acnamesp.h" - +#include "acparser.h" #include "aslcompiler.y.h" + #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslload") @@ -470,9 +471,13 @@ LdNamespace1Begin ( UINT32 i; BOOLEAN ForceNewScope = FALSE; ACPI_OWNER_ID OwnerId = 0; + const ACPI_OPCODE_INFO *OpInfo; + ACPI_PARSE_OBJECT *ParentOp; ACPI_FUNCTION_NAME (LdNamespace1Begin); + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n", Op, Op->Asl.ParseOpName)); @@ -548,6 +553,69 @@ LdNamespace1Begin ( return (AE_OK); } + /* Check for a possible illegal forward reference */ + + if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || + (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) + { + /* + * Op->Asl.Namepath will be NULL for these opcodes. + * These opcodes are guaranteed to have a parent. + * Examine the parent opcode. + */ + Status = AE_OK; + ParentOp = Op->Asl.Parent; + OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Asl.AmlOpcode); + + /* + * Exclude all operators that actually declare a new name: + * Name (ABCD, 1) -> Ignore (AML_CLASS_NAMED_OBJECT) + * We only want references to named objects: + * Store (2, WXYZ) -> Attempt to resolve the name + */ + if (OpInfo->Class == AML_CLASS_NAMED_OBJECT) + { + return (AE_OK); + } + + /* + * Check if the referenced object exists at this point during + * the load: + * 1) If it exists, then this cannot be a forward reference. + * 2) If it does not exist, it could be a forward reference or + * it truly does not exist (and no external declaration). + */ + Status = AcpiNsLookup (WalkState->ScopeInfo, + Op->Asl.Value.Name, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &Node); + if (Status == AE_NOT_FOUND) + { + /* + * This is either a foward reference or the object truly + * does not exist. The two cases can only be differentiated + * during the cross-reference stage later. Mark the Op/Name + * as not-found for now to indicate the need for further + * processing. + * + * Special case: Allow forward references from elements of + * Package objects. This provides compatibility with other + * ACPI implementations. To correctly implement this, the + * ACPICA table load defers package resolution until the entire + * namespace has been loaded. + */ + if ((ParentOp->Asl.ParseOpcode != PARSEOP_PACKAGE) && + (ParentOp->Asl.ParseOpcode != PARSEOP_VAR_PACKAGE)) + { + Op->Asl.CompileFlags |= OP_NOT_FOUND_DURING_LOAD; + } + + return (AE_OK); + } + + return (Status); + } + Path = Op->Asl.Namepath; if (!Path) { @@ -584,7 +652,6 @@ LdNamespace1Begin ( } break; - case PARSEOP_EXTERNAL: /* * "External" simply enters a name and type into the namespace. @@ -765,7 +832,6 @@ LdNamespace1Begin ( Status = AE_OK; goto FinishNode; - default: Modified: vendor-sys/acpica/dist/source/compiler/aslmessages.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmessages.c Fri Apr 27 21:22:32 2018 (r333076) +++ vendor-sys/acpica/dist/source/compiler/aslmessages.c Fri Apr 27 21:30:01 2018 (r333077) @@ -342,8 +342,8 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_RANGE */ "Constant out of range", /* ASL_MSG_BUFFER_ALLOCATION */ "Could not allocate line buffer", /* ASL_MSG_MISSING_DEPENDENCY */ "Missing dependency", -/* ASL_MSG_ILLEGAL_FORWARD_REF */ "Illegal forward reference within a method", -/* ASL_MSG_ILLEGAL_METHOD_REF */ "Illegal reference across two methods", +/* ASL_MSG_ILLEGAL_FORWARD_REF */ "Illegal forward reference", +/* ASL_MSG_ILLEGAL_METHOD_REF */ "Object is declared in a different method", /* ASL_MSG_LOCAL_NOT_USED */ "Method Local is set but never used", /* ASL_MSG_ARG_AS_LOCAL_NOT_USED */ "Method Argument (as a local) is set but never used", /* ASL_MSG_ARG_NOT_USED */ "Method Argument is never used", @@ -354,7 +354,9 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_FOUND_HERE */ "Original name creation/declaration below: ", /* ASL_MSG_ILLEGAL_RECURSION */ "Illegal recursive call to method that creates named objects", /* ASL_MSG_EXTERN_COLLISION */ "A name cannot be defined and declared external in the same table", -/* ASL_MSG_FOUND_HERE_EXTERN*/ "Remove one of the declarations indicated above or below:" +/* ASL_MSG_FOUND_HERE_EXTERN */ "Remove one of the declarations indicated above or below:", +/* ASL_MSG_OEM_TABLE_ID */ "Invalid OEM Table ID", +/* ASL_MSG_OEM_ID */ "Invalid OEM ID" }; /* Table compiler */ Modified: vendor-sys/acpica/dist/source/compiler/aslmessages.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmessages.h Fri Apr 27 21:22:32 2018 (r333076) +++ vendor-sys/acpica/dist/source/compiler/aslmessages.h Fri Apr 27 21:30:01 2018 (r333077) @@ -357,6 +357,8 @@ typedef enum ASL_MSG_ILLEGAL_RECURSION, ASL_MSG_EXTERN_COLLISION, ASL_MSG_EXTERN_FOUND_HERE, + ASL_MSG_OEM_TABLE_ID, + ASL_MSG_OEM_ID, /* These messages are used by the Data Table compiler only */ Modified: vendor-sys/acpica/dist/source/compiler/asloperands.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asloperands.c Fri Apr 27 21:22:32 2018 (r333076) +++ vendor-sys/acpica/dist/source/compiler/asloperands.c Fri Apr 27 21:30:01 2018 (r333077) @@ -1061,7 +1061,7 @@ OpnDoDefinitionBlock ( if (strlen (Gbl_TableSignature) != ACPI_NAME_SIZE) { AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, - "Length is not exactly 4"); + "Length must be exactly 4 characters"); } for (i = 0; i < ACPI_NAME_SIZE; i++) @@ -1078,6 +1078,7 @@ OpnDoDefinitionBlock ( Child = Child->Asl.Next; Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + /* * We used the revision to set the integer width earlier */ @@ -1086,6 +1087,12 @@ OpnDoDefinitionBlock ( Child = Child->Asl.Next; Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + if (Child->Asl.Value.String && + strlen (Child->Asl.Value.String) > ACPI_OEM_ID_SIZE) + { + AslError (ASL_ERROR, ASL_MSG_OEM_ID, Child, + "Length cannot exceed 6 characters"); + } /* OEM TableID */ @@ -1094,6 +1101,12 @@ OpnDoDefinitionBlock ( if (Child->Asl.Value.String) { Length = strlen (Child->Asl.Value.String); + if (Length > ACPI_OEM_TABLE_ID_SIZE) + { + AslError (ASL_ERROR, ASL_MSG_OEM_TABLE_ID, Child, + "Length cannot exceed 8 characters"); + } + Gbl_TableId = UtLocalCacheCalloc (Length + 1); strcpy (Gbl_TableId, Child->Asl.Value.String); Modified: vendor-sys/acpica/dist/source/compiler/asltypes.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asltypes.h Fri Apr 27 21:22:32 2018 (r333076) +++ vendor-sys/acpica/dist/source/compiler/asltypes.h Fri Apr 27 21:30:01 2018 (r333077) @@ -183,8 +183,9 @@ #define OP_IS_DUPLICATE 0x00040000 #define OP_IS_RESOURCE_DATA 0x00080000 #define OP_IS_NULL_RETURN 0x00100000 +#define OP_NOT_FOUND_DURING_LOAD 0x00200000 -#define ACPI_NUM_OP_FLAGS 0x21 +#define ACPI_NUM_OP_FLAGS 0x22 /* Keeps information about individual control methods */ Modified: vendor-sys/acpica/dist/source/compiler/aslutils.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslutils.c Fri Apr 27 21:22:32 2018 (r333076) +++ vendor-sys/acpica/dist/source/compiler/aslutils.c Fri Apr 27 21:30:01 2018 (r333077) @@ -238,6 +238,97 @@ UtQueryForOverwrite ( /******************************************************************************* * + * FUNCTION: UtNodeIsDescendantOf + * + * PARAMETERS: Node1 - Child node + * Node2 - Possible parent node + * + * RETURN: Boolean + * + * DESCRIPTION: Returns TRUE if Node1 is a descendant of Node2. Otherwise, + * return FALSE. Note, we assume a NULL Node2 element to be the + * topmost (root) scope. All nodes are descendants of the root. + * Note: Nodes at the same level (siblings) are not considered + * descendants. + * + ******************************************************************************/ + +BOOLEAN +UtNodeIsDescendantOf ( + ACPI_NAMESPACE_NODE *Node1, + ACPI_NAMESPACE_NODE *Node2) +{ + + if (Node1 == Node2) + { + return (FALSE); + } + + if (!Node2) + { + return (TRUE); /* All nodes descend from the root */ + } + + /* Walk upward until the root is reached or parent is found */ + + while (Node1) + { + if (Node1 == Node2) + { + return (TRUE); + } + + Node1 = Node1->Parent; + } + + return (FALSE); +} + + +/******************************************************************************* + * + * FUNCTION: UtGetParentMethod + * + * PARAMETERS: Node - Namespace node for any object + * + * RETURN: Namespace node for the parent method + * NULL - object is not within a method + * + * DESCRIPTION: Find the parent (owning) method node for a namespace object + * + ******************************************************************************/ + +void * +UtGetParentMethod ( + ACPI_NAMESPACE_NODE *Node) +{ + ACPI_NAMESPACE_NODE *ParentNode; + + + if (!Node) + { + return (NULL); + } + + /* Walk upward until a method is found, or the root is reached */ + + ParentNode = Node->Parent; + while (ParentNode) + { + if (ParentNode->Type == ACPI_TYPE_METHOD) + { + return (ParentNode); + } + + ParentNode = ParentNode->Parent; + } + + return (NULL); /* Object is not within a control method */ +} + + +/******************************************************************************* + * * FUNCTION: UtDisplaySupportedTables * * PARAMETERS: None Modified: vendor-sys/acpica/dist/source/compiler/aslxref.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslxref.c Fri Apr 27 21:22:32 2018 (r333076) +++ vendor-sys/acpica/dist/source/compiler/aslxref.c Fri Apr 27 21:30:01 2018 (r333077) @@ -197,23 +197,7 @@ XfCheckFieldRange ( UINT32 FieldBitLength, UINT32 AccessBitWidth); -#ifdef __UNDER_DEVELOPMENT -static ACPI_PARSE_OBJECT * -XfGetParentMethod ( - ACPI_PARSE_OBJECT *Op); -static void -XfCheckIllegalReference ( - ACPI_PARSE_OBJECT *Op, - ACPI_NAMESPACE_NODE *Node); - -static BOOLEAN -XfIsObjectParental ( - ACPI_PARSE_OBJECT *MethodOp1, - ACPI_PARSE_OBJECT *MethodOp2); -#endif - - /******************************************************************************* * * FUNCTION: XfCrossReferenceNamespace @@ -702,7 +686,7 @@ XfNamespaceLocateBegin ( Gbl_NsLookupCount++; Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node)); + ACPI_IMODE_EXECUTE, Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) @@ -760,6 +744,26 @@ XfNamespaceLocateBegin ( return_ACPI_STATUS (Status); } + /* Object was found above, check for an illegal forward reference */ + + if (Op->Asl.CompileFlags & OP_NOT_FOUND_DURING_LOAD) + { + /* + * During the load phase, this Op was flagged as a possible + * illegal forward reference + * + * Note: Allow "forward references" from within a method to an + * object that is not within any method (module-level code) + */ + if (!WalkState->ScopeInfo || (UtGetParentMethod (Node) && + !UtNodeIsDescendantOf (WalkState->ScopeInfo->Scope.Node, + UtGetParentMethod (Node)))) + { + AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op, + Op->Asl.ExternalName); + } + } + /* Check for a reference vs. name declaration */ if (!(OpInfo->Flags & AML_NAMED) && @@ -768,13 +772,6 @@ XfNamespaceLocateBegin ( /* This node has been referenced, mark it for reference check */ Node->Flags |= ANOBJ_IS_REFERENCED; - -#ifdef __UNDER_DEVELOPMENT - - /* Check for an illegal reference */ - - XfCheckIllegalReference (Op, Node); -#endif } /* Attempt to optimize the NamePath */ @@ -1205,178 +1202,3 @@ XfNamespaceLocateEnd ( return_ACPI_STATUS (AE_OK); } - - -#ifdef __UNDER_DEVELOPMENT -/******************************************************************************* - * - * FUNCTION: XfIsObjectParental - * - * PARAMETERS: ChildOp - Op to be checked - * PossibleParentOp - Determine if this op is in the family - * - * RETURN: TRUE if ChildOp is a descendent of PossibleParentOp - * - * DESCRIPTION: Determine if an Op is a descendent of another Op. Used to - * detect if a method is declared within another method. - * - ******************************************************************************/ - -static BOOLEAN -XfIsObjectParental ( - ACPI_PARSE_OBJECT *ChildOp, - ACPI_PARSE_OBJECT *PossibleParentOp) -{ - ACPI_PARSE_OBJECT *ParentOp; - - - /* Search upwards through the tree for possible parent */ - - ParentOp = ChildOp; - while (ParentOp) - { - if (ParentOp == PossibleParentOp) - { - return (TRUE); - } - - ParentOp = ParentOp->Asl.Parent; - } - - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: XfGetParentMethod - * - * PARAMETERS: Op - Op to be checked - * - * RETURN: Op for parent method. NULL if object is not within a method. - * - * DESCRIPTION: Determine if an object is within a control method. Used to - * implement special rules for named references from within a - * control method. - * - * NOTE: It would be better to have the parser set a flag in the Op if possible. - * - ******************************************************************************/ - -static ACPI_PARSE_OBJECT * -XfGetParentMethod ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *ParentOp; - - - if (!Op) - { - return (NULL); - } - - if (Op->Asl.ParseOpcode == PARSEOP_METHOD) - { - return (NULL); - } - - /* Walk upwards through the parse tree, up to the root if necessary */ - - ParentOp = Op; - while (ParentOp) - { - if (ParentOp->Asl.ParseOpcode == PARSEOP_METHOD) - { - return (ParentOp); - } - - ParentOp = ParentOp->Asl.Parent; - } - - /* Object is not within a method */ - - return (NULL); -} - - -/******************************************************************************* - * - * FUNCTION: XfCheckIllegalReference - * - * PARAMETERS: Op - Op referring to the target - * TargetNode - Target of the reference - * - * RETURN: None. Emits error message for an illegal reference - * - * DESCRIPTION: Determine if a named reference is legal. A "named" reference - * is something like: Store(ABCD, ...), where ABCD is an AML - * Nameseg or Namepath. - * - * NOTE: Caller must ensure that the name Op is in fact a reference, and not - * an actual name declaration (creation of a named object). - * - ******************************************************************************/ - -static void -XfCheckIllegalReference ( - ACPI_PARSE_OBJECT *Op, - ACPI_NAMESPACE_NODE *TargetNode) -{ - ACPI_PARSE_OBJECT *MethodOp1; - ACPI_PARSE_OBJECT *MethodOp2; - ACPI_PARSE_OBJECT *TargetOp; - - - /* - * Check for an illegal reference to a named object: - * - * 1) References from one control method to another, non-parent - * method are not allowed, they will fail at runtime. - * - * 2) Forward references within a control method are not allowed. - * AML interpreters use a one-pass parse of control methods - * so these forward references will fail at runtime. - */ - TargetOp = TargetNode->Op; - - MethodOp1 = XfGetParentMethod (Op); - MethodOp2 = XfGetParentMethod (TargetOp); - - /* Are both objects within control method(s)? */ - - if (!MethodOp1 || !MethodOp2) - { - return; - } - - /* Objects not in the same method? */ - - if (MethodOp1 != MethodOp2) - { - /* - * 1) Cross-method named reference - * - * This is OK if and only if the target reference is within in a - * method that is a parent of current method - */ - if (!XfIsObjectParental (MethodOp1, MethodOp2)) - { - AslError (ASL_ERROR, ASL_MSG_ILLEGAL_METHOD_REF, Op, - Op->Asl.ExternalName); - } - } - - /* - * 2) Both reference and target are in the same method. Check if this is - * an (illegal) forward reference by examining the exact source code - * location of each (the referenced object and the object declaration). - * This is a bit nasty, yet effective. - */ - else if (Op->Asl.LogicalByteOffset < TargetOp->Asl.LogicalByteOffset) - { - AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op, - Op->Asl.ExternalName); - } - -} -#endif Modified: vendor-sys/acpica/dist/source/components/debugger/dbnames.c ============================================================================== --- vendor-sys/acpica/dist/source/components/debugger/dbnames.c Fri Apr 27 21:22:32 2018 (r333076) +++ vendor-sys/acpica/dist/source/components/debugger/dbnames.c Fri Apr 27 21:30:01 2018 (r333077) @@ -372,8 +372,17 @@ AcpiDbDumpNamespace ( } AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); - AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n", - ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry); + + if (((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Parent) + { + AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n", + ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry); + } + else + { + AcpiOsPrintf ("ACPI Namespace (from %s):\n", + ACPI_NAMESPACE_ROOT); + } /* Display the subtree */ Modified: vendor-sys/acpica/dist/source/components/debugger/dbtest.c ============================================================================== --- vendor-sys/acpica/dist/source/components/debugger/dbtest.c Fri Apr 27 21:22:32 2018 (r333076) +++ vendor-sys/acpica/dist/source/components/debugger/dbtest.c Fri Apr 27 21:30:01 2018 (r333077) @@ -189,6 +189,10 @@ AcpiDbTestStringType ( UINT32 ByteLength); static ACPI_STATUS +AcpiDbTestPackageType ( + ACPI_NAMESPACE_NODE *Node); + +static ACPI_STATUS AcpiDbReadFromObject ( ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_TYPE ExpectedType, @@ -456,6 +460,11 @@ AcpiDbTestOneObject ( BitLength = ByteLength * 8; break; + case ACPI_TYPE_PACKAGE: + + LocalType = ACPI_TYPE_PACKAGE; + break; + case ACPI_TYPE_FIELD_UNIT: case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_LOCAL_REGION_FIELD: @@ -490,6 +499,7 @@ AcpiDbTestOneObject ( AcpiOsPrintf ("%14s: %4.4s", AcpiUtGetTypeName (Node->Type), Node->Name.Ascii); + if (!ObjDesc) { AcpiOsPrintf (" Ignoring, no attached object\n"); @@ -510,13 +520,12 @@ AcpiDbTestOneObject ( case ACPI_ADR_SPACE_SYSTEM_MEMORY: case ACPI_ADR_SPACE_SYSTEM_IO: case ACPI_ADR_SPACE_PCI_CONFIG: - case ACPI_ADR_SPACE_EC: break; default: - AcpiOsPrintf (" %s space is not supported [%4.4s]\n", + AcpiOsPrintf (" %s space is not supported in this command [%4.4s]\n", AcpiUtGetRegionName (RegionObj->Region.SpaceId), RegionObj->Region.Node->Name.Ascii); return (AE_OK); @@ -546,6 +555,11 @@ AcpiDbTestOneObject ( Status = AcpiDbTestBufferType (Node, BitLength); break; + case ACPI_TYPE_PACKAGE: + + Status = AcpiDbTestPackageType (Node); + break; + default: AcpiOsPrintf (" Ignoring, type not implemented (%2.2X)", @@ -553,6 +567,14 @@ AcpiDbTestOneObject ( break; } + /* Exit on error, but don't abort the namespace walk */ + + if (ACPI_FAILURE (Status)) + { + Status = AE_OK; + goto Exit; + } + switch (Node->Type) { case ACPI_TYPE_LOCAL_REGION_FIELD: @@ -560,12 +582,14 @@ AcpiDbTestOneObject ( RegionObj = ObjDesc->Field.RegionObj; AcpiOsPrintf (" (%s)", AcpiUtGetRegionName (RegionObj->Region.SpaceId)); + break; default: break; } +Exit: AcpiOsPrintf ("\n"); return (Status); } @@ -624,7 +648,6 @@ AcpiDbTestIntegerType ( { ValueToWrite = 0; } - /* Write a new value */ WriteValue.Type = ACPI_TYPE_INTEGER; @@ -917,6 +940,40 @@ Exit: /******************************************************************************* * + * FUNCTION: AcpiDbTestPackageType + * + * PARAMETERS: Node - Parent NS node for the object + * + * RETURN: Status + * + * DESCRIPTION: Test read for a Package object. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbTestPackageType ( + ACPI_NAMESPACE_NODE *Node) +{ + ACPI_OBJECT *Temp1 = NULL; + ACPI_STATUS Status; + + + /* Read the original value */ + + Status = AcpiDbReadFromObject (Node, ACPI_TYPE_PACKAGE, &Temp1); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + AcpiOsPrintf (" %8.8X Elements", Temp1->Package.Count); + AcpiOsFree (Temp1); + return (Status); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDbReadFromObject * * PARAMETERS: Node - Parent NS node for the object @@ -957,8 +1014,8 @@ AcpiDbReadFromObject ( AcpiGbl_MethodExecuting = TRUE; Status = AcpiEvaluateObject (ReadHandle, NULL, &ParamObjects, &ReturnObj); - AcpiGbl_MethodExecuting = FALSE; + AcpiGbl_MethodExecuting = FALSE; if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not read from object, %s", @@ -973,6 +1030,7 @@ AcpiDbReadFromObject ( case ACPI_TYPE_INTEGER: case ACPI_TYPE_BUFFER: case ACPI_TYPE_STRING: + case ACPI_TYPE_PACKAGE: /* * Did we receive the type we wanted? Most important for the * Integer/Buffer case (when a field is larger than an Integer, @@ -984,6 +1042,7 @@ AcpiDbReadFromObject ( AcpiUtGetTypeName (ExpectedType), AcpiUtGetTypeName (RetValue->Type)); + AcpiOsFree (ReturnObj.Pointer); return (AE_TYPE); } Modified: vendor-sys/acpica/dist/source/components/dispatcher/dswscope.c ============================================================================== --- vendor-sys/acpica/dist/source/components/dispatcher/dswscope.c Fri Apr 27 21:22:32 2018 (r333076) +++ vendor-sys/acpica/dist/source/components/dispatcher/dswscope.c Fri Apr 27 21:30:01 2018 (r333077) @@ -269,8 +269,7 @@ AcpiDsScopeStackPush ( } else { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, - "[\\___] (%s)", "ROOT")); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, ACPI_NAMESPACE_ROOT)); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, @@ -328,15 +327,13 @@ AcpiDsScopeStackPop ( NewScopeInfo = WalkState->ScopeInfo; if (NewScopeInfo) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, - "[%4.4s] (%s)\n", + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "[%4.4s] (%s)\n", AcpiUtGetNodeName (NewScopeInfo->Scope.Node), AcpiUtGetTypeName (NewScopeInfo->Common.Value))); } else { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, - "[\\___] (ROOT)\n")); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "%s\n", ACPI_NAMESPACE_ROOT)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Fri Apr 27 21:30:49 2018 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABE21FB2576; Fri, 27 Apr 2018 21:30:49 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 561DA80654; Fri, 27 Apr 2018 21:30:49 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 387F1441B; Fri, 27 Apr 2018 21:30:49 +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 w3RLUnjw053246; Fri, 27 Apr 2018 21:30:49 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3RLUnPD053233; Fri, 27 Apr 2018 21:30:49 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201804272130.w3RLUnPD053233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 27 Apr 2018 21:30:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r333078 - vendor-sys/acpica/20180427 X-SVN-Group: vendor-sys X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: vendor-sys/acpica/20180427 X-SVN-Commit-Revision: 333078 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: Fri, 27 Apr 2018 21:30:49 -0000 Author: jkim Date: Fri Apr 27 21:30:48 2018 New Revision: 333078 URL: https://svnweb.freebsd.org/changeset/base/333078 Log: Tag ACPICA 20180427. Added: vendor-sys/acpica/20180427/ - copied from r333077, vendor-sys/acpica/dist/