From owner-svn-src-vendor@freebsd.org Mon May 16 04:47:33 2016 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 D7C05B3C609; Mon, 16 May 2016 04:47:33 +0000 (UTC) (envelope-from mm@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 A90301C25; Mon, 16 May 2016 04:47:33 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4G4lWAx029307; Mon, 16 May 2016 04:47:32 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4G4lWhP029305; Mon, 16 May 2016 04:47:32 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201605160447.u4G4lWhP029305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Mon, 16 May 2016 04:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r299895 - in vendor/libarchive/dist: cpio libarchive X-SVN-Group: vendor 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.22 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: Mon, 16 May 2016 04:47:33 -0000 Author: mm Date: Mon May 16 04:47:32 2016 New Revision: 299895 URL: https://svnweb.freebsd.org/changeset/base/299895 Log: Update vendor/libarchvie to git commit 860ec63 Integrates my pull request #709 Modified: vendor/libarchive/dist/cpio/cpio.c vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c Modified: vendor/libarchive/dist/cpio/cpio.c ============================================================================== --- vendor/libarchive/dist/cpio/cpio.c Mon May 16 04:43:47 2016 (r299894) +++ vendor/libarchive/dist/cpio/cpio.c Mon May 16 04:47:32 2016 (r299895) @@ -295,6 +295,7 @@ main(int argc, char *argv[]) "Cannot use both -p and -%c", cpio->mode); cpio->mode = opt; cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT; + cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS; break; case OPTION_PASSPHRASE: cpio->passphrase = cpio->argument; Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c Mon May 16 04:43:47 2016 (r299894) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c Mon May 16 04:47:32 2016 (r299895) @@ -401,6 +401,11 @@ archive_read_format_cpio_read_header(str /* If this is a symlink, read the link contents. */ if (archive_entry_filetype(entry) == AE_IFLNK) { + if (cpio->entry_bytes_remaining > 1024 * 1024) { + archive_set_error(&a->archive, ENOMEM, + "Rejecting malformed cpio archive: symlink contents exceed 1 megabyte"); + return (ARCHIVE_FATAL); + } h = __archive_read_ahead(a, (size_t)cpio->entry_bytes_remaining, NULL); if (h == NULL) From owner-svn-src-vendor@freebsd.org Thu May 19 20:06:58 2016 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 89463B4221D; Thu, 19 May 2016 20:06:58 +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 mx1.freebsd.org (Postfix) with ESMTPS id 25AC71FCE; Thu, 19 May 2016 20:06:58 +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 u4JK6vTR090735; Thu, 19 May 2016 20:06:57 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4JK6uUN090722; Thu, 19 May 2016 20:06:56 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201605192006.u4JK6uUN090722@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 19 May 2016 20:06:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r300228 - in vendor/elftoolchain/dist: addr2line brandelf common cxxfilt elfcopy elfdump findtextrel ld libdwarf libelf libelftc libpe nm readelf size strings test/cxxfilt test/cxxfilt/... X-SVN-Group: vendor 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.22 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, 19 May 2016 20:06:58 -0000 Author: emaste Date: Thu May 19 20:06:56 2016 New Revision: 300228 URL: https://svnweb.freebsd.org/changeset/base/300228 Log: Import ELF Tool Chain snapshot at revision 3475 From http://svn.code.sf.net/p/elftoolchain/code/ Added: vendor/elftoolchain/dist/ld/ld.1 (contents, props changed) vendor/elftoolchain/dist/libelftc/elftc_reloc_type_str.3 (contents, props changed) vendor/elftoolchain/dist/libelftc/elftc_reloc_type_str.c (contents, props changed) vendor/elftoolchain/dist/test/cxxfilt/ vendor/elftoolchain/dist/test/cxxfilt/Makefile (contents, props changed) vendor/elftoolchain/dist/test/cxxfilt/tet_scen vendor/elftoolchain/dist/test/cxxfilt/tetexec.cfg vendor/elftoolchain/dist/test/cxxfilt/ts/ vendor/elftoolchain/dist/test/cxxfilt/ts/Makefile (contents, props changed) vendor/elftoolchain/dist/test/cxxfilt/ts/common/ vendor/elftoolchain/dist/test/cxxfilt/ts/common/func.sh (contents, props changed) vendor/elftoolchain/dist/test/cxxfilt/ts/common/gen.awk (contents, props changed) vendor/elftoolchain/dist/test/cxxfilt/ts/common/ts.mk (contents, props changed) vendor/elftoolchain/dist/test/cxxfilt/ts/misc/ vendor/elftoolchain/dist/test/cxxfilt/ts/misc/Makefile (contents, props changed) vendor/elftoolchain/dist/test/cxxfilt/ts/misc/tclist Modified: vendor/elftoolchain/dist/addr2line/addr2line.c vendor/elftoolchain/dist/brandelf/brandelf.c vendor/elftoolchain/dist/common/_elftc.h vendor/elftoolchain/dist/common/elfdefinitions.h vendor/elftoolchain/dist/cxxfilt/cxxfilt.c vendor/elftoolchain/dist/elfcopy/ascii.c vendor/elftoolchain/dist/elfcopy/binary.c vendor/elftoolchain/dist/elfcopy/elfcopy.1 vendor/elftoolchain/dist/elfcopy/elfcopy.h vendor/elftoolchain/dist/elfcopy/main.c vendor/elftoolchain/dist/elfcopy/sections.c vendor/elftoolchain/dist/elfcopy/segments.c vendor/elftoolchain/dist/elfcopy/symbols.c vendor/elftoolchain/dist/elfdump/elfdump.c vendor/elftoolchain/dist/findtextrel/findtextrel.c vendor/elftoolchain/dist/ld/Makefile vendor/elftoolchain/dist/ld/amd64.c vendor/elftoolchain/dist/ld/i386.c vendor/elftoolchain/dist/ld/ld_options.c vendor/elftoolchain/dist/ld/ld_options.h vendor/elftoolchain/dist/libdwarf/libdwarf_abbrev.c vendor/elftoolchain/dist/libdwarf/libdwarf_elf_init.c vendor/elftoolchain/dist/libelf/_libelf_config.h vendor/elftoolchain/dist/libelf/elf_data.c vendor/elftoolchain/dist/libelf/libelf_ar.c vendor/elftoolchain/dist/libelf/libelf_convert.m4 vendor/elftoolchain/dist/libelftc/Makefile vendor/elftoolchain/dist/libelftc/libelftc.h vendor/elftoolchain/dist/libelftc/libelftc_dem_arm.c vendor/elftoolchain/dist/libelftc/libelftc_dem_gnu2.c vendor/elftoolchain/dist/libelftc/libelftc_dem_gnu3.c vendor/elftoolchain/dist/libelftc/make-toolchain-version vendor/elftoolchain/dist/libpe/libpe_section.c vendor/elftoolchain/dist/libpe/pe.h vendor/elftoolchain/dist/nm/nm.c vendor/elftoolchain/dist/readelf/readelf.c vendor/elftoolchain/dist/size/size.c vendor/elftoolchain/dist/strings/strings.c vendor/elftoolchain/dist/test/elfdump/ts/dso1/@S@p%libelf.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso1/@c@p@n%libelf.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso1/@e@p@c%libelf.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso1/@p%libelf.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso1/@p@s%libelf.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso2/@S@p%test.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso2/@c@p@n%test.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso2/@e@p@c%test.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso2/@p%test.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso2/@p@s%test.so.out vendor/elftoolchain/dist/test/elfdump/ts/exec1/@S@e@p%ls.out vendor/elftoolchain/dist/test/elfdump/ts/exec1/@c@p@n%ls.out vendor/elftoolchain/dist/test/elfdump/ts/exec1/@e@p%ls.out vendor/elftoolchain/dist/test/elfdump/ts/exec1/@e@p@c@d%ls.out vendor/elftoolchain/dist/test/elfdump/ts/exec1/@p@e%ls.out vendor/elftoolchain/dist/test/elfdump/ts/exec1/@p@n%ls.out vendor/elftoolchain/dist/test/elfdump/ts/exec1/@p@s%ls.out vendor/elftoolchain/dist/test/elfdump/ts/exec2/@S@n%cp.out Modified: vendor/elftoolchain/dist/addr2line/addr2line.c ============================================================================== --- vendor/elftoolchain/dist/addr2line/addr2line.c Thu May 19 20:03:01 2016 (r300227) +++ vendor/elftoolchain/dist/addr2line/addr2line.c Thu May 19 20:06:56 2016 (r300228) @@ -40,7 +40,7 @@ #include "uthash.h" #include "_elftc.h" -ELFTC_VCSID("$Id: addr2line.c 3273 2015-12-11 21:38:57Z kaiwang27 $"); +ELFTC_VCSID("$Id: addr2line.c 3446 2016-05-03 01:31:17Z emaste $"); struct Func { char *name; @@ -284,7 +284,7 @@ collect_func(Dwarf_Debug dbg, Dwarf_Die &de) == DW_DLV_OK) goto add_func; - /* Skip if no name assoicated with this DIE. */ + /* Skip if no name associated with this DIE. */ goto cont_search; add_func: Modified: vendor/elftoolchain/dist/brandelf/brandelf.c ============================================================================== --- vendor/elftoolchain/dist/brandelf/brandelf.c Thu May 19 20:03:01 2016 (r300227) +++ vendor/elftoolchain/dist/brandelf/brandelf.c Thu May 19 20:06:56 2016 (r300228) @@ -44,7 +44,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: brandelf.c 3354 2016-01-18 21:50:15Z jkoshy $"); +ELFTC_VCSID("$Id: brandelf.c 3440 2016-04-07 14:51:47Z emaste $"); static int elftype(const char *); static const char *iselftype(int); @@ -62,6 +62,7 @@ static struct ELFtypes elftypes[] = { { "AIX", ELFOSABI_AIX }, { "ARM", ELFOSABI_ARM }, { "AROS", ELFOSABI_AROS }, + { "CloudABI", ELFOSABI_CLOUDABI }, { "FreeBSD", ELFOSABI_FREEBSD }, { "GNU", ELFOSABI_GNU }, { "HP/UX", ELFOSABI_HPUX}, Modified: vendor/elftoolchain/dist/common/_elftc.h ============================================================================== --- vendor/elftoolchain/dist/common/_elftc.h Thu May 19 20:03:01 2016 (r300227) +++ vendor/elftoolchain/dist/common/_elftc.h Thu May 19 20:06:56 2016 (r300228) @@ -23,11 +23,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: _elftc.h 3244 2015-08-31 19:53:08Z emaste $ + * $Id: _elftc.h 3446 2016-05-03 01:31:17Z emaste $ */ /** - ** Miscellanous definitions needed by multiple components. + ** Miscellaneous definitions needed by multiple components. **/ #ifndef _ELFTC_H Modified: vendor/elftoolchain/dist/common/elfdefinitions.h ============================================================================== --- vendor/elftoolchain/dist/common/elfdefinitions.h Thu May 19 20:03:01 2016 (r300227) +++ vendor/elftoolchain/dist/common/elfdefinitions.h Thu May 19 20:06:56 2016 (r300228) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elfdefinitions.h 3392 2016-02-05 19:51:22Z emaste $ + * $Id: elfdefinitions.h 3455 2016-05-09 13:47:29Z emaste $ */ /* @@ -184,6 +184,10 @@ _ELF_DEFINE_DT(DT_ADDRRNGLO, 0x6F "start of range using the d_ptr field") \ _ELF_DEFINE_DT(DT_GNU_HASH, 0x6FFFFEF5UL, \ "GNU style hash tables") \ +_ELF_DEFINE_DT(DT_TLSDESC_PLT, 0x6FFFFEF6UL, \ + "location of PLT entry for TLS descriptor resolver calls") \ +_ELF_DEFINE_DT(DT_TLSDESC_GOT, 0x6FFFFEF7UL, \ + "location of GOT entry used by TLS descriptor resolver PLT entry") \ _ELF_DEFINE_DT(DT_GNU_CONFLICT, 0x6FFFFEF8UL, \ "address of conflict section") \ _ELF_DEFINE_DT(DT_GNU_LIBLIST, 0x6FFFFEF9UL, \ @@ -269,7 +273,7 @@ _ELF_DEFINE_DT(DT_MIPS_DELTA_RELOC, 0x70 _ELF_DEFINE_DT(DT_MIPS_DELTA_RELOC_NO, 0x7000001CUL, \ "number of entries in DT_MIPS_DELTA_RELOC") \ _ELF_DEFINE_DT(DT_MIPS_DELTA_SYM, 0x7000001DUL, \ - "Delta symbols refered by Delta relocations") \ + "Delta symbols referred by Delta relocations") \ _ELF_DEFINE_DT(DT_MIPS_DELTA_SYM_NO, 0x7000001EUL, \ "number of entries in DT_MIPS_DELTA_SYM") \ _ELF_DEFINE_DT(DT_MIPS_DELTA_CLASSSYM, 0x70000020UL, \ @@ -540,6 +544,7 @@ _ELF_DEFINE_EABI(ELFOSABI_NSK, 14 _ELF_DEFINE_EABI(ELFOSABI_AROS, 15, "Amiga Research OS") \ _ELF_DEFINE_EABI(ELFOSABI_FENIXOS, 16, \ "The FenixOS highly scalable multi-core OS") \ +_ELF_DEFINE_EABI(ELFOSABI_CLOUDABI, 17, "Nuxi CloudABI") \ _ELF_DEFINE_EABI(ELFOSABI_ARM_AEABI, 64, \ "ARM specific symbol versioning extensions") \ _ELF_DEFINE_EABI(ELFOSABI_ARM, 97, "ARM ABI") \ @@ -1193,7 +1198,7 @@ _ELF_DEFINE_SHT(SHT_MIPS_ABIFLAGS, 0x7 "ABI flags") \ _ELF_DEFINE_SHT(SHT_SPARC_GOTDATA, 0x70000000UL, \ "SPARC-specific data") \ -_ELF_DEFINE_SHT(SHT_AMD64_UNWIND, 0x70000001UL, \ +_ELF_DEFINE_SHT(SHT_X86_64_UNWIND, 0x70000001UL, \ "unwind tables for the AMD64") \ _ELF_DEFINE_SHT(SHT_ORDERED, 0x7FFFFFFFUL, \ "sort entries in the section") \ @@ -1212,6 +1217,7 @@ enum { }; /* Aliases for section types. */ +#define SHT_AMD64_UNWIND SHT_X86_64_UNWIND #define SHT_GNU_verdef SHT_SUNW_verdef #define SHT_GNU_verneed SHT_SUNW_verneed #define SHT_GNU_versym SHT_SUNW_versym @@ -1255,6 +1261,7 @@ _ELF_DEFINE_STT(STT_FILE, 4, _ELF_DEFINE_STT(STT_COMMON, 5, "uninitialized common block") \ _ELF_DEFINE_STT(STT_TLS, 6, "thread local storage") \ _ELF_DEFINE_STT(STT_LOOS, 10, "start of OS-specific types") \ +_ELF_DEFINE_STT(STT_GNU_IFUNC, 10, "indirect function") \ _ELF_DEFINE_STT(STT_HIOS, 12, "end of OS-specific types") \ _ELF_DEFINE_STT(STT_LOPROC, 13, \ "start of processor-specific types") \ @@ -1402,10 +1409,37 @@ _ELF_DEFINE_RELOC(R_386_RELATIVE, 8) \ _ELF_DEFINE_RELOC(R_386_GOTOFF, 9) \ _ELF_DEFINE_RELOC(R_386_GOTPC, 10) \ _ELF_DEFINE_RELOC(R_386_32PLT, 11) \ +_ELF_DEFINE_RELOC(R_386_TLS_TPOFF, 14) \ +_ELF_DEFINE_RELOC(R_386_TLS_IE, 15) \ +_ELF_DEFINE_RELOC(R_386_TLS_GOTIE, 16) \ +_ELF_DEFINE_RELOC(R_386_TLS_LE, 17) \ +_ELF_DEFINE_RELOC(R_386_TLS_GD, 18) \ +_ELF_DEFINE_RELOC(R_386_TLS_LDM, 19) \ _ELF_DEFINE_RELOC(R_386_16, 20) \ _ELF_DEFINE_RELOC(R_386_PC16, 21) \ _ELF_DEFINE_RELOC(R_386_8, 22) \ -_ELF_DEFINE_RELOC(R_386_PC8, 23) +_ELF_DEFINE_RELOC(R_386_PC8, 23) \ +_ELF_DEFINE_RELOC(R_386_TLS_GD_32, 24) \ +_ELF_DEFINE_RELOC(R_386_TLS_GD_PUSH, 25) \ +_ELF_DEFINE_RELOC(R_386_TLS_GD_CALL, 26) \ +_ELF_DEFINE_RELOC(R_386_TLS_GD_POP, 27) \ +_ELF_DEFINE_RELOC(R_386_TLS_LDM_32, 28) \ +_ELF_DEFINE_RELOC(R_386_TLS_LDM_PUSH, 29) \ +_ELF_DEFINE_RELOC(R_386_TLS_LDM_CALL, 30) \ +_ELF_DEFINE_RELOC(R_386_TLS_LDM_POP, 31) \ +_ELF_DEFINE_RELOC(R_386_TLS_LDO_32, 32) \ +_ELF_DEFINE_RELOC(R_386_TLS_IE_32, 33) \ +_ELF_DEFINE_RELOC(R_386_TLS_LE_32, 34) \ +_ELF_DEFINE_RELOC(R_386_TLS_DTPMOD32, 35) \ +_ELF_DEFINE_RELOC(R_386_TLS_DTPOFF32, 36) \ +_ELF_DEFINE_RELOC(R_386_TLS_TPOFF32, 37) \ +_ELF_DEFINE_RELOC(R_386_SIZE32, 38) \ +_ELF_DEFINE_RELOC(R_386_TLS_GOTDESC, 39) \ +_ELF_DEFINE_RELOC(R_386_TLS_DESC_CALL, 40) \ +_ELF_DEFINE_RELOC(R_386_TLS_DESC, 41) \ +_ELF_DEFINE_RELOC(R_386_IRELATIVE, 42) \ +_ELF_DEFINE_RELOC(R_386_GOT32X, 43) + /* */ @@ -1795,11 +1829,18 @@ _ELF_DEFINE_RELOC(R_MIPS_GOT16, 9) \ _ELF_DEFINE_RELOC(R_MIPS_PC16, 10) \ _ELF_DEFINE_RELOC(R_MIPS_CALL16, 11) \ _ELF_DEFINE_RELOC(R_MIPS_GPREL32, 12) \ +_ELF_DEFINE_RELOC(R_MIPS_SHIFT5, 16) \ +_ELF_DEFINE_RELOC(R_MIPS_SHIFT6, 17) \ _ELF_DEFINE_RELOC(R_MIPS_64, 18) \ -_ELF_DEFINE_RELOC(R_MIPS_GOTHI16, 21) \ -_ELF_DEFINE_RELOC(R_MIPS_GOTLO16, 22) \ +_ELF_DEFINE_RELOC(R_MIPS_GOT_DISP, 19) \ +_ELF_DEFINE_RELOC(R_MIPS_GOT_PAGE, 20) \ +_ELF_DEFINE_RELOC(R_MIPS_GOT_OFST, 21) \ +_ELF_DEFINE_RELOC(R_MIPS_GOT_HI16, 22) \ +_ELF_DEFINE_RELOC(R_MIPS_GOT_LO16, 23) \ +_ELF_DEFINE_RELOC(R_MIPS_SUB, 24) \ _ELF_DEFINE_RELOC(R_MIPS_CALLHI16, 30) \ _ELF_DEFINE_RELOC(R_MIPS_CALLLO16, 31) \ +_ELF_DEFINE_RELOC(R_MIPS_JALR, 37) \ _ELF_DEFINE_RELOC(R_MIPS_TLS_DTPMOD32, 38) \ _ELF_DEFINE_RELOC(R_MIPS_TLS_DTPREL32, 39) \ _ELF_DEFINE_RELOC(R_MIPS_TLS_DTPMOD64, 40) \ @@ -2095,6 +2136,7 @@ _ELF_DEFINE_RELOC(R_SPARC_PC_HM10, 38) \ _ELF_DEFINE_RELOC(R_SPARC_PC_LM22, 39) \ _ELF_DEFINE_RELOC(R_SPARC_WDISP16, 40) \ _ELF_DEFINE_RELOC(R_SPARC_WDISP19, 41) \ +_ELF_DEFINE_RELOC(R_SPARC_GLOB_JMP, 42) \ _ELF_DEFINE_RELOC(R_SPARC_7, 43) \ _ELF_DEFINE_RELOC(R_SPARC_5, 44) \ _ELF_DEFINE_RELOC(R_SPARC_6, 45) \ @@ -2108,6 +2150,30 @@ _ELF_DEFINE_RELOC(R_SPARC_L44, 52) \ _ELF_DEFINE_RELOC(R_SPARC_REGISTER, 53) \ _ELF_DEFINE_RELOC(R_SPARC_UA64, 54) \ _ELF_DEFINE_RELOC(R_SPARC_UA16, 55) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_GD_HI22, 56) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_GD_LO10, 57) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_GD_ADD, 58) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_GD_CALL, 59) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_LDM_HI22, 60) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_LDM_LO10, 61) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_LDM_ADD, 62) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_LDM_CALL, 63) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_LDO_HIX22, 64) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_LDO_LOX10, 65) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_LDO_ADD, 66) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_IE_HI22, 67) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_IE_LO10, 68) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_IE_LD, 69) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_IE_LDX, 70) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_IE_ADD, 71) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_LE_HIX22, 72) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_LE_LOX10, 73) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_DTPMOD32, 74) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_DTPMOD64, 75) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_DTPOFF32, 76) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_DTPOFF64, 77) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_TPOFF32, 78) \ +_ELF_DEFINE_RELOC(R_SPARC_TLS_TPOFF64, 79) \ _ELF_DEFINE_RELOC(R_SPARC_GOTDATA_HIX22, 80) \ _ELF_DEFINE_RELOC(R_SPARC_GOTDATA_LOX10, 81) \ _ELF_DEFINE_RELOC(R_SPARC_GOTDATA_OP_HIX22, 82) \ @@ -2153,7 +2219,10 @@ _ELF_DEFINE_RELOC(R_X86_64_SIZE64, 33) \ _ELF_DEFINE_RELOC(R_X86_64_GOTPC32_TLSDESC, 34) \ _ELF_DEFINE_RELOC(R_X86_64_TLSDESC_CALL, 35) \ _ELF_DEFINE_RELOC(R_X86_64_TLSDESC, 36) \ -_ELF_DEFINE_RELOC(R_X86_64_IRELATIVE, 37) +_ELF_DEFINE_RELOC(R_X86_64_IRELATIVE, 37) \ +_ELF_DEFINE_RELOC(R_X86_64_RELATIVE64, 38) \ +_ELF_DEFINE_RELOC(R_X86_64_GOTPCRELX, 41) \ +_ELF_DEFINE_RELOC(R_X86_64_REX_GOTPCRELX, 42) #define _ELF_DEFINE_RELOCATIONS() \ _ELF_DEFINE_386_RELOCATIONS() \ @@ -2424,7 +2493,7 @@ _ELF_DEFINE_ODK(ODK_HWOR, 8, _ELF_DEFINE_ODK(ODK_GP_GROUP, 9, \ "GP group to use for text/data sections") \ _ELF_DEFINE_ODK(ODK_IDENT, 10, "ID information") \ -_ELF_DEFINE_ODK(ODK_PAGESIZE, 11, "page size infomation") +_ELF_DEFINE_ODK(ODK_PAGESIZE, 11, "page size information") #undef _ELF_DEFINE_ODK #define _ELF_DEFINE_ODK(N, V, DESCR) N = V , Modified: vendor/elftoolchain/dist/cxxfilt/cxxfilt.c ============================================================================== --- vendor/elftoolchain/dist/cxxfilt/cxxfilt.c Thu May 19 20:03:01 2016 (r300227) +++ vendor/elftoolchain/dist/cxxfilt/cxxfilt.c Thu May 19 20:06:56 2016 (r300228) @@ -35,7 +35,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: cxxfilt.c 3356 2016-01-22 22:31:38Z jkoshy $"); +ELFTC_VCSID("$Id: cxxfilt.c 3454 2016-05-07 17:11:05Z kaiwang27 $"); #define STRBUFSZ 8192 @@ -112,35 +112,18 @@ find_format(const char *fstr) } static char * -demangle(char *name, int strict, size_t *pos) +demangle(char *name) { static char dem[STRBUFSZ]; - char nb[STRBUFSZ]; - size_t p, t; - if (stripus && *name == '_') { - strncpy(nb, name + 1, sizeof(nb) - 1); - t = 1; - } else { - strncpy(nb, name, sizeof(nb) - 1); - t = 0; - } - nb[sizeof(nb) - 1] = '\0'; + if (stripus && *name == '_') + name++; - p = strlen(nb); - if (p == 0) - return NULL; - - while (elftc_demangle(nb, dem, sizeof(dem), (unsigned) format) < 0) { - if (!strict && p > 1) { - nb[--p] = '\0'; - continue; - } else - return (NULL); - } + if (strlen(name) == 0) + return (NULL); - if (pos != NULL) - *pos = t ? p + 1 : p; + if (elftc_demangle(name, dem, sizeof(dem), (unsigned) format) < 0) + return (NULL); return (dem); } @@ -149,7 +132,7 @@ int main(int argc, char **argv) { char *dem, buf[STRBUFSZ]; - size_t i, p, s; + size_t p; int c, n, opt; while ((opt = getopt_long(argc, argv, "_nps:V", longopts, NULL)) != @@ -184,8 +167,8 @@ main(int argc, char **argv) if (*argv != NULL) { for (n = 0; n < argc; n++) { - if ((dem = demangle(argv[n], 1, NULL)) == NULL) - fprintf(stderr, "Failed: %s\n", argv[n]); + if ((dem = demangle(argv[n])) == NULL) + printf("%s\n", argv[n]); else printf("%s\n", dem); } @@ -193,23 +176,18 @@ main(int argc, char **argv) p = 0; for (;;) { c = fgetc(stdin); - if (c == EOF || !isprint(c) || strchr(" \t\n", c)) { + if (c == EOF || !(isalnum(c) || strchr(".$_", c))) { if (p > 0) { buf[p] = '\0'; - if ((dem = demangle(buf, 0, &s)) == - NULL) + if ((dem = demangle(buf)) == NULL) printf("%s", buf); - else { + else printf("%s", dem); - for (i = s; i < p; i++) - putchar(buf[i]); - } p = 0; } if (c == EOF) break; - if (isprint(c) || strchr(" \t\n", c)) - putchar(c); + putchar(c); } else { if ((size_t) p >= sizeof(buf) - 1) warnx("buffer overflowed"); Modified: vendor/elftoolchain/dist/elfcopy/ascii.c ============================================================================== --- vendor/elftoolchain/dist/elfcopy/ascii.c Thu May 19 20:03:01 2016 (r300227) +++ vendor/elftoolchain/dist/elfcopy/ascii.c Thu May 19 20:06:56 2016 (r300228) @@ -36,7 +36,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: ascii.c 3177 2015-03-30 18:19:41Z emaste $"); +ELFTC_VCSID("$Id: ascii.c 3446 2016-05-03 01:31:17Z emaste $"); static void append_data(struct section *s, const void *buf, size_t sz); static char hex_digit(uint8_t n); @@ -187,7 +187,7 @@ create_srec(struct elfcopy *ecp, int ifd if (elferr != 0) warnx("elf_nextscn failed: %s", elf_errmsg(elferr)); - /* Generate S{7,8,9} end of block recrod. */ + /* Generate S{7,8,9} end of block record. */ if (gelf_getehdr(e, &eh) == NULL) errx(EXIT_FAILURE, "gelf_getehdr() failed: %s", elf_errmsg(-1)); Modified: vendor/elftoolchain/dist/elfcopy/binary.c ============================================================================== --- vendor/elftoolchain/dist/elfcopy/binary.c Thu May 19 20:03:01 2016 (r300227) +++ vendor/elftoolchain/dist/elfcopy/binary.c Thu May 19 20:06:56 2016 (r300228) @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -35,7 +36,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: binary.c 3270 2015-12-11 18:48:56Z emaste $"); +ELFTC_VCSID("$Id: binary.c 3445 2016-04-20 19:08:30Z emaste $"); /* * Convert ELF object to `binary'. Sections with SHF_ALLOC flag set @@ -213,9 +214,9 @@ create_elf_from_binary(struct elfcopy *e if ((sym_basename = strdup(ifn)) == NULL) err(1, "strdup"); - p = sym_basename; - while ((p = strchr(p, '.')) != NULL) - *p++ = '_'; + for (p = sym_basename; *p != '\0'; p++) + if (!isalnum(*p)) + *p = '_'; #define _GEN_SYMNAME(S) do { \ snprintf(name, sizeof(name), "%s%s%s", "_binary_", sym_basename, S); \ } while (0) Modified: vendor/elftoolchain/dist/elfcopy/elfcopy.1 ============================================================================== --- vendor/elftoolchain/dist/elfcopy/elfcopy.1 Thu May 19 20:03:01 2016 (r300227) +++ vendor/elftoolchain/dist/elfcopy/elfcopy.1 Thu May 19 20:06:56 2016 (r300228) @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elfcopy.1 3381 2016-01-30 19:39:47Z jkoshy $ +.\" $Id: elfcopy.1 3426 2016-03-05 13:32:28Z emaste $ .\" -.Dd January 29, 2016 +.Dd March 5, 2016 .Os .Dt ELFCOPY 1 .Sh NAME @@ -67,7 +67,10 @@ .Op Fl -change-section-vma Ar section Ns {+|-|=} Ns Ar val .Op Fl -extract-dwo .Op Fl -gap-fill Ns = Ns Ar val +.Op Fl -globalize-symbol Ns = Ns ar symbolname +.Op Fl -globalize-symbols Ns = Ns Ar filename .Op Fl -localize-hidden +.Op Fl -localize-symbols Ns = Ns Ar filename .Op Fl -no-adjust-warnings | Fl -no-change-warnings .Op Fl -only-keep-debug .Op Fl -pad-to Ns = Ns Ar address @@ -239,9 +242,21 @@ Copy only .dwo debug sections to the out Fill the gaps between sections with the byte value specified by the argument .Ar val . +.It Fl -globalize-symbol Ns = Ns Ar symbolname +Make the symbol named by argument +.Ar symbolname +global, so that it is visible outside of the file in which it is defined. +.It Fl -globalize-symbols Ns = Ns Ar filename +Make each symbol listed in the file specified by +.Ar filename +global. .It Fl -localize-hidden Make all hidden symbols local to the output file. This includes symbols with internal visiblity. +.It Fl -localize-symbols Ns = Ns Ar filename +Make each symbol listed in the file specified by +.Ar filename +local to the output file. .It Fl -no-adjust-warnings | Fl -no-change-warnings Do not issue a warning if the section specified by the options .Fl -change-section-address , Modified: vendor/elftoolchain/dist/elfcopy/elfcopy.h ============================================================================== --- vendor/elftoolchain/dist/elfcopy/elfcopy.h Thu May 19 20:03:01 2016 (r300227) +++ vendor/elftoolchain/dist/elfcopy/elfcopy.h Thu May 19 20:06:56 2016 (r300228) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elfcopy.h 3310 2016-01-10 09:10:54Z kaiwang27 $ + * $Id: elfcopy.h 3446 2016-05-03 01:31:17Z emaste $ */ #include @@ -139,7 +139,8 @@ struct section { /* Internal data structure for segments. */ struct segment { - uint64_t addr; /* load addr */ + uint64_t vaddr; /* virtual addr (VMA) */ + uint64_t paddr; /* physical addr (LMA) */ uint64_t off; /* file offset */ uint64_t fsz; /* file size */ uint64_t msz; /* memory size */ @@ -177,7 +178,7 @@ struct elfcopy { Elftc_Bfd_Target_Flavor otf; /* flavour of output object */ const char *otgt; /* output target name */ int oec; /* elfclass of output object */ - unsigned char oed; /* endianess of output object */ + unsigned char oed; /* endianness of output object */ int oem; /* EM_XXX of output object */ int abi; /* OSABI of output object */ Elf *ein; /* ELF descriptor of input object */ @@ -237,7 +238,7 @@ struct elfcopy { uint64_t *secndx; /* section index map. */ uint64_t *symndx; /* symbol index map. */ unsigned char *v_rel; /* symbols needed by relocation. */ - unsigned char *v_grp; /* symbols refered by section group. */ + unsigned char *v_grp; /* symbols referred by section group. */ unsigned char *v_secsym; /* sections with section symbol. */ STAILQ_HEAD(, segment) v_seg; /* list of segments. */ STAILQ_HEAD(, sec_action) v_sac;/* list of section operations. */ Modified: vendor/elftoolchain/dist/elfcopy/main.c ============================================================================== --- vendor/elftoolchain/dist/elfcopy/main.c Thu May 19 20:03:01 2016 (r300227) +++ vendor/elftoolchain/dist/elfcopy/main.c Thu May 19 20:06:56 2016 (r300228) @@ -39,7 +39,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: main.c 3399 2016-02-12 18:07:56Z emaste $"); +ELFTC_VCSID("$Id: main.c 3446 2016-05-03 01:31:17Z emaste $"); enum options { @@ -209,6 +209,7 @@ static struct { {"openbsd", ELFOSABI_OPENBSD}, {"openvms", ELFOSABI_OPENVMS}, {"nsk", ELFOSABI_NSK}, + {"cloudabi", ELFOSABI_CLOUDABI}, {"arm", ELFOSABI_ARM}, {"standalone", ELFOSABI_STANDALONE}, {NULL, 0} @@ -235,7 +236,7 @@ static void strip_main(struct elfcopy *e static void strip_usage(void); /* - * An ELF object usually has a sturcture described by the + * An ELF object usually has a structure described by the * diagram below. * _____________ * | | @@ -641,6 +642,18 @@ create_file(struct elfcopy *ecp, const c * ELF object before processing. */ if (ecp->itf != ETF_ELF) { + /* + * If the output object is not an ELF file, choose an arbitrary + * ELF format for the intermediate file. srec, ihex and binary + * formats are independent of class, endianness and machine + * type so these choices do not affect the output. + */ + if (ecp->otf != ETF_ELF) { + if (ecp->oec == ELFCLASSNONE) + ecp->oec = ELFCLASS64; + if (ecp->oed == ELFDATANONE) + ecp->oed = ELFDATA2LSB; + } create_tempfile(&elftemp, &efd); if ((ecp->eout = elf_begin(efd, ELF_C_WRITE, NULL)) == NULL) errx(EXIT_FAILURE, "elf_begin() failed: %s", @@ -1434,7 +1447,7 @@ Usage: %s [options] infile [outfile]\n\ sections.\n\ --only-keep-debug Copy only debugging information.\n\ --output-target=FORMAT Use the specified format for the output.\n\ - --pad-to=ADDRESS Pad the output object upto the given address.\n\ + --pad-to=ADDRESS Pad the output object up to the given address.\n\ --prefix-alloc-sections=STRING\n\ Prefix the section names of all the allocated\n\ sections with STRING.\n\ Modified: vendor/elftoolchain/dist/elfcopy/sections.c ============================================================================== --- vendor/elftoolchain/dist/elfcopy/sections.c Thu May 19 20:03:01 2016 (r300227) +++ vendor/elftoolchain/dist/elfcopy/sections.c Thu May 19 20:06:56 2016 (r300228) @@ -34,7 +34,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: sections.c 3346 2016-01-17 20:09:15Z kaiwang27 $"); +ELFTC_VCSID("$Id: sections.c 3443 2016-04-15 18:57:54Z kaiwang27 $"); static void add_gnu_debuglink(struct elfcopy *ecp); static uint32_t calc_crc32(const char *p, size_t len, uint32_t crc); @@ -343,7 +343,7 @@ create_scn(struct elfcopy *ecp) GElf_Shdr ish; size_t indx; uint64_t oldndx, newndx; - int elferr, sec_flags; + int elferr, sec_flags, reorder; /* * Insert a pseudo section that contains the ELF header @@ -367,6 +367,7 @@ create_scn(struct elfcopy *ecp) errx(EXIT_FAILURE, "elf_getshstrndx failed: %s", elf_errmsg(-1)); + reorder = 0; is = NULL; while ((is = elf_nextscn(ecp->ein, is)) != NULL) { if (gelf_getshdr(is, &ish) == NULL) @@ -482,8 +483,20 @@ create_scn(struct elfcopy *ecp) /* create section header based on input object. */ if (strcmp(name, ".symtab") != 0 && strcmp(name, ".strtab") != 0 && - strcmp(name, ".shstrtab") != 0) + strcmp(name, ".shstrtab") != 0) { copy_shdr(ecp, s, NULL, 0, sec_flags); + /* + * elfcopy puts .symtab, .strtab and .shstrtab + * sections in the end of the output object. + * If the input objects have more sections + * after any of these 3 sections, the section + * table will be reordered. section symbols + * should be regenerated for relocations. + */ + if (reorder) + ecp->flags &= ~SYMTAB_INTACT; + } else + reorder = 1; if (strcmp(name, ".symtab") == 0) { ecp->flags |= SYMTAB_EXIST; @@ -1519,6 +1532,9 @@ add_gnu_debuglink(struct elfcopy *ecp) err(EXIT_FAILURE, "strdup failed"); if (stat(ecp->debuglink, &sb) == -1) err(EXIT_FAILURE, "stat failed"); + if (sb.st_size == 0) + errx(EXIT_FAILURE, "empty debug link target %s", + ecp->debuglink); if ((buf = malloc(sb.st_size)) == NULL) err(EXIT_FAILURE, "malloc failed"); if ((fp = fopen(ecp->debuglink, "r")) == NULL) Modified: vendor/elftoolchain/dist/elfcopy/segments.c ============================================================================== --- vendor/elftoolchain/dist/elfcopy/segments.c Thu May 19 20:03:01 2016 (r300227) +++ vendor/elftoolchain/dist/elfcopy/segments.c Thu May 19 20:06:56 2016 (r300228) @@ -34,7 +34,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: segments.c 3397 2016-02-12 14:35:19Z emaste $"); +ELFTC_VCSID("$Id: segments.c 3449 2016-05-03 13:59:29Z emaste $"); static void insert_to_inseg_list(struct segment *seg, struct section *sec); @@ -72,12 +72,12 @@ add_to_inseg_list(struct elfcopy *ecp, s */ loadable = 0; STAILQ_FOREACH(seg, &ecp->v_seg, seg_list) { - if (s->off < seg->off || (s->vma < seg->addr && !s->pseudo)) + if (s->off < seg->off || (s->vma < seg->vaddr && !s->pseudo)) continue; if (s->off + s->sz > seg->off + seg->fsz && s->type != SHT_NOBITS) continue; - if (s->vma + s->sz > seg->addr + seg->msz) + if (s->vma + s->sz > seg->vaddr + seg->msz) continue; insert_to_inseg_list(seg, s); @@ -85,7 +85,12 @@ add_to_inseg_list(struct elfcopy *ecp, s s->seg = seg; else if (seg->type == PT_TLS) s->seg_tls = seg; - s->lma = seg->addr + (s->off - seg->off); + if (s->pseudo) + s->vma = seg->vaddr + (s->off - seg->off); + if (seg->paddr > 0) + s->lma = seg->paddr + (s->off - seg->off); + else + s->lma = 0; loadable = 1; } @@ -98,7 +103,7 @@ adjust_addr(struct elfcopy *ecp) struct section *s, *s0; struct segment *seg; struct sec_action *sac; - uint64_t dl, lma, start, end; + uint64_t dl, vma, lma, start, end; int found, i; /* @@ -110,59 +115,52 @@ adjust_addr(struct elfcopy *ecp) if (!s->loadable) continue; + /* Apply global VMA adjustment. */ + if (ecp->change_addr != 0) + s->vma += ecp->change_addr; + /* Apply global LMA adjustment. */ - if (ecp->change_addr != 0 && s->seg != NULL) + if (ecp->change_addr != 0 && s->seg != NULL && + s->seg->paddr > 0) s->lma += ecp->change_addr; - - if (!s->pseudo) { - /* Apply global VMA adjustment. */ - if (ecp->change_addr != 0) - s->vma += ecp->change_addr; - - /* Apply section VMA adjustment. */ - sac = lookup_sec_act(ecp, s->name, 0); - if (sac == NULL) - continue; - if (sac->setvma) - s->vma = sac->vma; - if (sac->vma_adjust != 0) - s->vma += sac->vma_adjust; - } } /* - * Apply sections LMA change in the second iteration. + * Apply sections VMA change in the second iteration. */ TAILQ_FOREACH(s, &ecp->v_sec, sec_list) { - /* - * Only loadable section that's inside a segment can have - * LMA adjusted. - */ - if (!s->loadable || s->seg == NULL) + if (!s->loadable) continue; /* - * Check if there is a LMA change request for this + * Check if there is a VMA change request for this * section. */ sac = lookup_sec_act(ecp, s->name, 0); if (sac == NULL) continue; - if (!sac->setlma && sac->lma_adjust == 0) + vma = s->vma; + if (sac->setvma) + vma = sac->vma; + if (sac->vma_adjust != 0) + vma += sac->vma_adjust; + if (vma == s->vma) continue; - lma = s->lma; - if (sac->setlma) - lma = sac->lma; - if (sac->lma_adjust != 0) - lma += sac->lma_adjust; - if (lma == s->lma) + + /* + * No need to make segment adjustment if the section doesn't + * belong to any segment. + */ + if (s->seg == NULL) { + s->vma = vma; continue; + } /* - * Check if the LMA change is viable. + * Check if the VMA change is viable. * - * 1. Check if the new LMA is properly aligned accroding to + * 1. Check if the new VMA is properly aligned accroding to * section alignment. * * 2. Compute the new extent of segment that contains this @@ -170,37 +168,36 @@ adjust_addr(struct elfcopy *ecp) * segments. */ #ifdef DEBUG - printf("LMA for section %s: %#jx\n", s->name, lma); + printf("VMA for section %s: %#jx\n", s->name, vma); #endif - if (lma % s->align != 0) - errx(EXIT_FAILURE, "The load address %#jx for " + if (vma % s->align != 0) + errx(EXIT_FAILURE, "The VMA %#jx for " "section %s is not aligned to %ju", - (uintmax_t) lma, s->name, (uintmax_t) s->align); + (uintmax_t) vma, s->name, (uintmax_t) s->align); - if (lma < s->lma) { + if (vma < s->vma) { /* Move section to lower address. */ - if (lma < s->lma - s->seg->addr) + if (vma < s->vma - s->seg->vaddr) errx(EXIT_FAILURE, "Not enough space to move " - "section %s load address to %#jx", s->name, - (uintmax_t) lma); - start = lma - (s->lma - s->seg->addr); + "section %s VMA to %#jx", s->name, + (uintmax_t) vma); + start = vma - (s->vma - s->seg->vaddr); if (s == s->seg->v_sec[s->seg->nsec - 1]) end = start + s->seg->msz; else - end = s->seg->addr + s->seg->msz; - + end = s->seg->vaddr + s->seg->msz; } else { /* Move section to upper address. */ if (s == s->seg->v_sec[0]) - start = lma; + start = vma; else - start = s->seg->addr; - end = lma + (s->seg->addr + s->seg->msz - s->lma); + start = s->seg->vaddr; + end = vma + (s->seg->vaddr + s->seg->msz - s->vma); if (end < start) errx(EXIT_FAILURE, "Not enough space to move " - "section %s load address to %#jx", s->name, - (uintmax_t) lma); + "section %s VMA to %#jx", s->name, + (uintmax_t) vma); } #ifdef DEBUG @@ -211,34 +208,34 @@ adjust_addr(struct elfcopy *ecp) STAILQ_FOREACH(seg, &ecp->v_seg, seg_list) { if (seg == s->seg || seg->type != PT_LOAD) continue; - if (start > seg->addr + seg->msz) + if (start > seg->vaddr + seg->msz) continue; - if (end < seg->addr) + if (end < seg->vaddr) continue; errx(EXIT_FAILURE, "The extent of segment containing " "section %s overlaps with segment(%#jx,%#jx)", - s->name, (uintmax_t) seg->addr, - (uintmax_t) (seg->addr + seg->msz)); + s->name, (uintmax_t) seg->vaddr, + (uintmax_t) (seg->vaddr + seg->msz)); } /* - * Update section LMA and file offset. + * Update section VMA and file offset. */ - if (lma < s->lma) { + if (vma < s->vma) { /* - * To move a section to lower load address, we decrease - * the load addresses of the section and all the - * sections that are before it, and we increase the - * file offsets of all the sections that are after it. + * To move a section to lower VMA, we decrease + * the VMA of the section and all the sections that + * are before it, and we increase the file offsets + * of all the sections that are after it. */ - dl = s->lma - lma; + dl = s->vma - vma; for (i = 0; i < s->seg->nsec; i++) { s0 = s->seg->v_sec[i]; - s0->lma -= dl; + s0->vma -= dl; #ifdef DEBUG - printf("section %s LMA set to %#jx\n", - s0->name, (uintmax_t) s0->lma); + printf("section %s VMA set to %#jx\n", + s0->name, (uintmax_t) s0->vma); #endif if (s0 == s) break; @@ -253,13 +250,13 @@ adjust_addr(struct elfcopy *ecp) } } else { /* - * To move a section to upper load address, we increase - * the load addresses of the section and all the - * sections that are after it, and we increase the - * their file offsets too unless the section in question + * To move a section to upper VMA, we increase + * the VMA of the section and all the sections that + * are after it, and we increase the their file + * offsets too unless the section in question * is the first in its containing segment. */ - dl = lma - s->lma; + dl = vma - s->vma; for (i = 0; i < s->seg->nsec; i++) if (s->seg->v_sec[i] == s) break; @@ -269,9 +266,9 @@ adjust_addr(struct elfcopy *ecp) s->name); for (; i < s->seg->nsec; i++) { s0 = s->seg->v_sec[i]; - s0->lma += dl; + s0->vma += dl; #ifdef DEBUG - printf("section %s LMA set to %#jx\n", + printf("section %s VMA set to %#jx\n", s0->name, (uintmax_t) s0->lma); #endif if (s != s->seg->v_sec[0]) { @@ -292,9 +289,8 @@ adjust_addr(struct elfcopy *ecp) if (ecp->pad_to != 0) { /* - * Find the section with highest load address. + * Find the section with highest VMA. */ - s = NULL; STAILQ_FOREACH(seg, &ecp->v_seg, seg_list) { if (seg->type != PT_LOAD) @@ -308,26 +304,113 @@ adjust_addr(struct elfcopy *ecp) s = seg->v_sec[i]; else { s0 = seg->v_sec[i]; - if (s0->lma > s->lma) + if (s0->vma > s->vma) s = s0; } } if (s == NULL) - goto issue_warn; + goto adjust_lma; /* No need to pad if the pad_to address is lower. */ - if (ecp->pad_to <= s->lma + s->sz) - goto issue_warn; + if (ecp->pad_to <= s->vma + s->sz) + goto adjust_lma; - s->pad_sz = ecp->pad_to - (s->lma + s->sz); + s->pad_sz = ecp->pad_to - (s->vma + s->sz); #ifdef DEBUG - printf("pad section %s load to address %#jx by %#jx\n", s->name, + printf("pad section %s VMA to address %#jx by %#jx\n", s->name, (uintmax_t) ecp->pad_to, (uintmax_t) s->pad_sz); #endif } -issue_warn: + +adjust_lma: + + /* + * Apply sections LMA change in the third iteration. + */ + TAILQ_FOREACH(s, &ecp->v_sec, sec_list) { + + /* + * Only loadable section that's inside a segment can have + * LMA adjusted. Also, if LMA of the containing segment is + * set to 0, it probably means we should ignore the LMA. + */ + if (!s->loadable || s->seg == NULL || s->seg->paddr == 0) + continue; + + /* + * Check if there is a LMA change request for this + * section. + */ + sac = lookup_sec_act(ecp, s->name, 0); + if (sac == NULL) + continue; + if (!sac->setlma && sac->lma_adjust == 0) + continue; + lma = s->lma; + if (sac->setlma) + lma = sac->lma; + if (sac->lma_adjust != 0) + lma += sac->lma_adjust; + if (lma == s->lma) + continue; + +#ifdef DEBUG + printf("LMA for section %s: %#jx\n", s->name, lma); +#endif + + /* Check alignment. */ + if (lma % s->align != 0) + errx(EXIT_FAILURE, "The LMA %#jx for " + "section %s is not aligned to %ju", + (uintmax_t) lma, s->name, (uintmax_t) s->align); + + /* + * Update section LMA. + */ + + if (lma < s->lma) { + /* + * To move a section to lower LMA, we decrease + * the LMA of the section and all the sections that + * are before it. + */ + dl = s->lma - lma; + for (i = 0; i < s->seg->nsec; i++) { + s0 = s->seg->v_sec[i]; + s0->lma -= dl; +#ifdef DEBUG + printf("section %s LMA set to %#jx\n", + s0->name, (uintmax_t) s0->lma); +#endif + if (s0 == s) + break; + } + } else { + /* + * To move a section to upper LMA, we increase + * the LMA of the section and all the sections that + * are after it. + */ + dl = lma - s->lma; + for (i = 0; i < s->seg->nsec; i++) + if (s->seg->v_sec[i] == s) + break; + if (i >= s->seg->nsec) + errx(EXIT_FAILURE, "Internal: section `%s' not" + " found in its containing segement", + s->name); + for (; i < s->seg->nsec; i++) { + s0 = s->seg->v_sec[i]; + s0->lma += dl; +#ifdef DEBUG + printf("section %s LMA set to %#jx\n", + s0->name, (uintmax_t) s0->lma); +#endif + } + } + } /* * Issue a warning if there are VMA/LMA adjust requests for @@ -385,8 +468,7 @@ setup_phdr(struct elfcopy *ecp) { struct segment *seg; GElf_Phdr iphdr; - size_t iphnum; - int i; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Thu May 19 20:08:17 2016 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 5E791B42305; Thu, 19 May 2016 20:08:17 +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 mx1.freebsd.org (Postfix) with ESMTPS id 15E0411E4; Thu, 19 May 2016 20:08:17 +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 u4JK8Gqi090819; Thu, 19 May 2016 20:08:16 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4JK8GEV090818; Thu, 19 May 2016 20:08:16 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201605192008.u4JK8GEV090818@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 19 May 2016 20:08:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r300229 - vendor/elftoolchain/elftoolchain-r3475 X-SVN-Group: vendor 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.22 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, 19 May 2016 20:08:17 -0000 Author: emaste Date: Thu May 19 20:08:16 2016 New Revision: 300229 URL: https://svnweb.freebsd.org/changeset/base/300229 Log: Tag ELF Tool Chain r3475 Added: vendor/elftoolchain/elftoolchain-r3475/ - copied from r300228, vendor/elftoolchain/dist/ From owner-svn-src-vendor@freebsd.org Fri May 20 16:19:59 2016 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 AD9E1B449FA; Fri, 20 May 2016 16:19:59 +0000 (UTC) (envelope-from sjg@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 4CA2E1D1C; Fri, 20 May 2016 16:19:59 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4KGJwoM061491; Fri, 20 May 2016 16:19:58 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4KGJvNZ061471; Fri, 20 May 2016 16:19:57 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201605201619.u4KGJvNZ061471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 20 May 2016 16:19:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r300309 - in vendor/NetBSD/bmake/dist: . mk mk/sys X-SVN-Group: vendor 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.22 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, 20 May 2016 16:19:59 -0000 Author: sjg Date: Fri May 20 16:19:56 2016 New Revision: 300309 URL: https://svnweb.freebsd.org/changeset/base/300309 Log: Import bmake-20160512 Interesting changes (from ChangeLog): o meta.c: ignore paths that match .MAKE.META.IGNORE_PATTERNS this is useful for gcov builds. o propagate errors from filemon(4). o meta.c: apply realpath() before matching against metaIgnorePaths o allow makefile to set .MAKE.JOBS Modified: vendor/NetBSD/bmake/dist/ChangeLog vendor/NetBSD/bmake/dist/Makefile vendor/NetBSD/bmake/dist/arch.c vendor/NetBSD/bmake/dist/bmake.1 vendor/NetBSD/bmake/dist/bmake.cat1 vendor/NetBSD/bmake/dist/compat.c vendor/NetBSD/bmake/dist/job.c vendor/NetBSD/bmake/dist/main.c vendor/NetBSD/bmake/dist/make.1 vendor/NetBSD/bmake/dist/meta.c vendor/NetBSD/bmake/dist/meta.h vendor/NetBSD/bmake/dist/mk/ChangeLog vendor/NetBSD/bmake/dist/mk/auto.dep.mk vendor/NetBSD/bmake/dist/mk/autodep.mk vendor/NetBSD/bmake/dist/mk/dirdeps.mk vendor/NetBSD/bmake/dist/mk/dpadd.mk vendor/NetBSD/bmake/dist/mk/final.mk vendor/NetBSD/bmake/dist/mk/gendirdeps.mk vendor/NetBSD/bmake/dist/mk/init.mk vendor/NetBSD/bmake/dist/mk/install-mk vendor/NetBSD/bmake/dist/mk/lib.mk vendor/NetBSD/bmake/dist/mk/libnames.mk vendor/NetBSD/bmake/dist/mk/meta.autodep.mk vendor/NetBSD/bmake/dist/mk/meta.sys.mk vendor/NetBSD/bmake/dist/mk/meta2deps.py vendor/NetBSD/bmake/dist/mk/nls.mk vendor/NetBSD/bmake/dist/mk/own.mk vendor/NetBSD/bmake/dist/mk/prog.mk vendor/NetBSD/bmake/dist/mk/subdir.mk vendor/NetBSD/bmake/dist/mk/sys.mk vendor/NetBSD/bmake/dist/mk/sys/AIX.mk vendor/NetBSD/bmake/dist/mk/sys/Darwin.mk vendor/NetBSD/bmake/dist/mk/sys/Generic.mk vendor/NetBSD/bmake/dist/mk/sys/HP-UX.mk vendor/NetBSD/bmake/dist/mk/sys/IRIX.mk vendor/NetBSD/bmake/dist/mk/sys/Linux.mk vendor/NetBSD/bmake/dist/mk/sys/NetBSD.mk vendor/NetBSD/bmake/dist/mk/sys/OSF1.mk vendor/NetBSD/bmake/dist/mk/sys/OpenBSD.mk vendor/NetBSD/bmake/dist/mk/sys/SunOS.mk vendor/NetBSD/bmake/dist/mk/sys/UnixWare.mk vendor/NetBSD/bmake/dist/mk/warnings.mk vendor/NetBSD/bmake/dist/parse.c vendor/NetBSD/bmake/dist/str.c Modified: vendor/NetBSD/bmake/dist/ChangeLog ============================================================================== --- vendor/NetBSD/bmake/dist/ChangeLog Fri May 20 15:43:51 2016 (r300308) +++ vendor/NetBSD/bmake/dist/ChangeLog Fri May 20 16:19:56 2016 (r300309) @@ -1,3 +1,26 @@ +2016-05-12 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160512 + Merge with NetBSD make, pick up + o meta.c: ignore paths that match .MAKE.META.IGNORE_PATTERNS + this is useful for gcov builds. + o propagate errors from filemon(4). + +2016-05-09 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160509 + Merge with NetBSD make, pick up + o remove use of non-standard types u_int etc. + o meta.c: apply realpath() before matching against metaIgnorePaths + +2016-04-04 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160404 + Merge with NetBSD make, pick up + o allow makefile to set .MAKE.JOBS + + * Makefile (PROG_NAME): use ${_MAKE_VERSION} + 2016-03-15 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20160315 Modified: vendor/NetBSD/bmake/dist/Makefile ============================================================================== --- vendor/NetBSD/bmake/dist/Makefile Fri May 20 15:43:51 2016 (r300308) +++ vendor/NetBSD/bmake/dist/Makefile Fri May 20 16:19:56 2016 (r300309) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.58 2016/03/15 23:39:12 sjg Exp $ +# $Id: Makefile,v 1.63 2016/05/12 20:34:46 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20160315 +_MAKE_VERSION= 20160512 PROG= bmake @@ -131,9 +131,9 @@ OPTIONS_DEFAULT_NO+= \ .include .if ${MK_PROG_VERSION} == "yes" -PROG_NAME= ${PROG}-${MAKE_VERSION} +PROG_NAME= ${PROG}-${_MAKE_VERSION} .if ${MK_PROG_LINK} == "yes" -SYMLINKS+= ${PROG}-${MAKE_VERSION} ${BINDIR}/${PROG} +SYMLINKS+= ${PROG_NAME} ${BINDIR}/${PROG} .endif .endif Modified: vendor/NetBSD/bmake/dist/arch.c ============================================================================== --- vendor/NetBSD/bmake/dist/arch.c Fri May 20 15:43:51 2016 (r300308) +++ vendor/NetBSD/bmake/dist/arch.c Fri May 20 16:19:56 2016 (r300309) @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.68 2016/02/18 18:29:14 christos Exp $ */ +/* $NetBSD: arch.c,v 1.69 2016/04/06 09:57:00 gson Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: arch.c,v 1.68 2016/02/18 18:29:14 christos Exp $"; +static char rcsid[] = "$NetBSD: arch.c,v 1.69 2016/04/06 09:57:00 gson Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: arch.c,v 1.68 2016/02/18 18:29:14 christos Exp $"); +__RCSID("$NetBSD: arch.c,v 1.69 2016/04/06 09:57:00 gson Exp $"); #endif #endif /* not lint */ #endif @@ -832,7 +832,7 @@ ArchSVR4Entry(Arch *ar, char *name, size } if (DEBUG(ARCH)) { fprintf(debug_file, "Found svr4 archive name table with %lu entries\n", - (u_long)entry); + (unsigned long)entry); } return 0; } @@ -850,7 +850,7 @@ ArchSVR4Entry(Arch *ar, char *name, size if (entry >= ar->fnamesize) { if (DEBUG(ARCH)) { fprintf(debug_file, "SVR4 entry offset %s is greater than %lu\n", - name, (u_long)ar->fnamesize); + name, (unsigned long)ar->fnamesize); } return 2; } Modified: vendor/NetBSD/bmake/dist/bmake.1 ============================================================================== --- vendor/NetBSD/bmake/dist/bmake.1 Fri May 20 15:43:51 2016 (r300308) +++ vendor/NetBSD/bmake/dist/bmake.1 Fri May 20 16:19:56 2016 (r300309) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.255 2016/03/14 07:42:15 matthias Exp $ +.\" $NetBSD: make.1,v 1.257 2016/05/10 23:45:45 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd February 19, 2016 +.Dd May 10, 2016 .Dt MAKE 1 .Os .Sh NAME @@ -913,6 +913,9 @@ Provides a list of path prefixes that sh because the contents are expected to change over time. The default list includes: .Ql Pa /dev /etc /proc /tmp /var/run /var/tmp +.It Va .MAKE.META.IGNORE_PATTERNS +Provides a list of patterns to match against pathnames. +Ignore any that match. .It Va .MAKE.META.PREFIX Defines the message printed for each meta file updated in "meta verbose" mode. The default value is: Modified: vendor/NetBSD/bmake/dist/bmake.cat1 ============================================================================== --- vendor/NetBSD/bmake/dist/bmake.cat1 Fri May 20 15:43:51 2016 (r300308) +++ vendor/NetBSD/bmake/dist/bmake.cat1 Fri May 20 16:19:56 2016 (r300309) @@ -586,6 +586,10 @@ VVAARRIIAABBLLEE AASSSSIIGG The default list includes: `_/_d_e_v _/_e_t_c _/_p_r_o_c _/_t_m_p _/_v_a_r_/_r_u_n _/_v_a_r_/_t_m_p' + _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___P_A_T_T_E_R_N_S + Provides a list of patterns to match against pathnames. + Ignore any that match. + _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X Defines the message printed for each meta file updated in "meta verbose" mode. The default value is: @@ -1471,4 +1475,4 @@ BBUUGGSS There is no way of escaping a space character in a filename. -NetBSD 5.1 February 19, 2016 NetBSD 5.1 +NetBSD 5.1 May 10, 2016 NetBSD 5.1 Modified: vendor/NetBSD/bmake/dist/compat.c ============================================================================== --- vendor/NetBSD/bmake/dist/compat.c Fri May 20 15:43:51 2016 (r300308) +++ vendor/NetBSD/bmake/dist/compat.c Fri May 20 16:19:56 2016 (r300309) @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.104 2016/02/18 18:29:14 christos Exp $ */ +/* $NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: compat.c,v 1.104 2016/02/18 18:29:14 christos Exp $"; +static char rcsid[] = "$NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: compat.c,v 1.104 2016/02/18 18:29:14 christos Exp $"); +__RCSID("$NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -586,7 +586,8 @@ Compat_Make(void *gnp, void *pgnp) } #ifdef USE_META if (useMeta && !NoExecute(gn)) { - meta_job_finish(NULL); + if (meta_job_finish(NULL) != 0) + gn->made = ERROR; } #endif Modified: vendor/NetBSD/bmake/dist/job.c ============================================================================== --- vendor/NetBSD/bmake/dist/job.c Fri May 20 15:43:51 2016 (r300308) +++ vendor/NetBSD/bmake/dist/job.c Fri May 20 16:19:56 2016 (r300309) @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.186 2016/02/18 18:29:14 christos Exp $ */ +/* $NetBSD: job.c,v 1.187 2016/05/12 20:28:34 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: job.c,v 1.186 2016/02/18 18:29:14 christos Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.187 2016/05/12 20:28:34 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: job.c,v 1.186 2016/02/18 18:29:14 christos Exp $"); +__RCSID("$NetBSD: job.c,v 1.187 2016/05/12 20:28:34 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -1056,7 +1056,11 @@ JobFinish (Job *job, WAIT_T status) #ifdef USE_META if (useMeta) { - meta_job_finish(job); + int x; + + if ((x = meta_job_finish(job)) != 0 && status == 0) { + status = x; + } } #endif Modified: vendor/NetBSD/bmake/dist/main.c ============================================================================== --- vendor/NetBSD/bmake/dist/main.c Fri May 20 15:43:51 2016 (r300308) +++ vendor/NetBSD/bmake/dist/main.c Fri May 20 16:19:56 2016 (r300309) @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.242 2016/03/07 21:45:43 christos Exp $ */ +/* $NetBSD: main.c,v 1.244 2016/04/05 04:25:43 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.242 2016/03/07 21:45:43 christos Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.244 2016/04/05 04:25:43 sjg Exp $"; #else #include #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.242 2016/03/07 21:45:43 christos Exp $"); +__RCSID("$NetBSD: main.c,v 1.244 2016/04/05 04:25:43 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -1152,14 +1152,6 @@ main(int argc, char **argv) } /* - * Be compatible if user did not specify -j and did not explicitly - * turned compatibility on - */ - if (!compatMake && !forceJobs) { - compatMake = TRUE; - } - - /* * Initialize archive, target and suffix modules in preparation for * parsing the makefile(s) */ @@ -1275,6 +1267,36 @@ main(int argc, char **argv) Var_Append("MFLAGS", Var_Value(MAKEFLAGS, VAR_GLOBAL, &p1), VAR_GLOBAL); free(p1); + if (!forceJobs && !compatMake && + Var_Exists(".MAKE.JOBS", VAR_GLOBAL)) { + char *value; + int n; + + value = Var_Subst(NULL, "${.MAKE.JOBS}", VAR_GLOBAL, VARF_WANTRES); + n = strtol(value, NULL, 0); + if (n < 1) { + (void)fprintf(stderr, "%s: illegal value for .MAKE.JOBS -- must be positive integer!\n", + progname); + exit(1); + } + if (n != maxJobs) { + Var_Append(MAKEFLAGS, "-j", VAR_GLOBAL); + Var_Append(MAKEFLAGS, value, VAR_GLOBAL); + } + maxJobs = n; + maxJobTokens = maxJobs; + forceJobs = TRUE; + free(value); + } + + /* + * Be compatible if user did not specify -j and did not explicitly + * turned compatibility on + */ + if (!compatMake && !forceJobs) { + compatMake = TRUE; + } + if (!compatMake) Job_ServerStart(maxJobTokens, jp_0, jp_1); if (DEBUG(JOB)) Modified: vendor/NetBSD/bmake/dist/make.1 ============================================================================== --- vendor/NetBSD/bmake/dist/make.1 Fri May 20 15:43:51 2016 (r300308) +++ vendor/NetBSD/bmake/dist/make.1 Fri May 20 16:19:56 2016 (r300309) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.255 2016/03/14 07:42:15 matthias Exp $ +.\" $NetBSD: make.1,v 1.257 2016/05/10 23:45:45 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd February 19, 2016 +.Dd May 10, 2016 .Dt MAKE 1 .Os .Sh NAME @@ -913,6 +913,9 @@ Provides a list of path prefixes that sh because the contents are expected to change over time. The default list includes: .Ql Pa /dev /etc /proc /tmp /var/run /var/tmp +.It Va .MAKE.META.IGNORE_PATTERNS +Provides a list of patterns to match against pathnames. +Ignore any that match. .It Va .MAKE.META.PREFIX Defines the message printed for each meta file updated in "meta verbose" mode. The default value is: Modified: vendor/NetBSD/bmake/dist/meta.c ============================================================================== --- vendor/NetBSD/bmake/dist/meta.c Fri May 20 15:43:51 2016 (r300308) +++ vendor/NetBSD/bmake/dist/meta.c Fri May 20 16:19:56 2016 (r300309) @@ -1,4 +1,4 @@ -/* $NetBSD: meta.c,v 1.54 2016/03/11 07:01:21 sjg Exp $ */ +/* $NetBSD: meta.c,v 1.57 2016/05/12 20:28:34 sjg Exp $ */ /* * Implement 'meta' mode. @@ -66,6 +66,9 @@ static char *metaIgnorePathsStr; /* stri #ifndef MAKE_META_IGNORE_PATHS #define MAKE_META_IGNORE_PATHS ".MAKE.META.IGNORE_PATHS" #endif +#ifndef MAKE_META_IGNORE_PATTERNS +#define MAKE_META_IGNORE_PATTERNS ".MAKE.META.IGNORE_PATTERNS" +#endif Boolean useMeta = FALSE; static Boolean useFilemon = FALSE; @@ -73,6 +76,7 @@ static Boolean writeMeta = FALSE; static Boolean metaEnv = FALSE; /* don't save env unless asked */ static Boolean metaVerbose = FALSE; static Boolean metaIgnoreCMDs = FALSE; /* ignore CMDs in .meta files */ +static Boolean metaIgnorePatterns = FALSE; /* do we need to do pattern matches */ static Boolean metaCurdirOk = FALSE; /* write .meta in .CURDIR Ok? */ static Boolean metaSilent = FALSE; /* if we have a .meta be SILENT */ @@ -157,28 +161,33 @@ filemon_open(BuildMon *pbm) * Read the build monitor output file and write records to the target's * metadata file. */ -static void +static int filemon_read(FILE *mfp, int fd) { char buf[BUFSIZ]; int n; + int error; /* Check if we're not writing to a meta data file.*/ if (mfp == NULL) { if (fd >= 0) close(fd); /* not interested */ - return; + return 0; } /* rewind */ (void)lseek(fd, (off_t)0, SEEK_SET); + error = 0; fprintf(mfp, "\n-- filemon acquired metadata --\n"); while ((n = read(fd, buf, sizeof(buf))) > 0) { - fwrite(buf, 1, n, mfp); + if ((int)fwrite(buf, 1, n, mfp) < n) + error = EIO; } fflush(mfp); - close(fd); + if (close(fd) < 0) + error = errno; + return error; } #endif @@ -620,6 +629,15 @@ meta_mode_init(const char *make_mode) if (metaIgnorePathsStr) { str2Lst_Append(metaIgnorePaths, metaIgnorePathsStr, NULL); } + + /* + * We ignore any paths that match ${.MAKE.META.IGNORE_PATTERNS} + */ + cp = NULL; + if (Var_Value(MAKE_META_IGNORE_PATTERNS, VAR_GLOBAL, &cp)) { + metaIgnorePatterns = TRUE; + free(cp); + } } /* @@ -744,27 +762,35 @@ meta_job_output(Job *job, char *cp, cons } } -void +int meta_cmd_finish(void *pbmp) { + int error = 0; #ifdef USE_FILEMON BuildMon *pbm = pbmp; + int x; if (!pbm) pbm = &Mybm; if (pbm->filemon_fd >= 0) { - close(pbm->filemon_fd); - filemon_read(pbm->mfp, pbm->mon_fd); + if (close(pbm->filemon_fd) < 0) + error = errno; + x = filemon_read(pbm->mfp, pbm->mon_fd); + if (error == 0 && x != 0) + error = x; pbm->filemon_fd = pbm->mon_fd = -1; } #endif + return error; } -void +int meta_job_finish(Job *job) { BuildMon *pbm; + int error = 0; + int x; if (job != NULL) { pbm = &job->bm; @@ -772,11 +798,14 @@ meta_job_finish(Job *job) pbm = &Mybm; } if (pbm->mfp != NULL) { - meta_cmd_finish(pbm); - fclose(pbm->mfp); + error = meta_cmd_finish(pbm); + x = fclose(pbm->mfp); + if (error == 0 && x != 0) + error = errno; pbm->mfp = NULL; pbm->meta_fname[0] = '\0'; } + return error; } void @@ -1209,14 +1238,35 @@ meta_oodate(GNode *gn, Boolean oodate) * be part of the dependencies because * they are _expected_ to change. */ - if (*p == '/' && - Lst_ForEach(metaIgnorePaths, prefix_match, p)) { + if (*p == '/') { + realpath(p, fname1); /* clean it up */ + if (Lst_ForEach(metaIgnorePaths, prefix_match, fname1)) { #ifdef DEBUG_META_MODE - if (DEBUG(META)) - fprintf(debug_file, "meta_oodate: ignoring: %s\n", - p); + if (DEBUG(META)) + fprintf(debug_file, "meta_oodate: ignoring path: %s\n", + p); #endif - break; + break; + } + } + + if (metaIgnorePatterns) { + char *pm; + + snprintf(fname1, sizeof(fname1), + "${%s:@m@${%s:L:M$m}@}", + MAKE_META_IGNORE_PATTERNS, p); + pm = Var_Subst(NULL, fname1, gn, VARF_WANTRES); + if (*pm) { +#ifdef DEBUG_META_MODE + if (DEBUG(META)) + fprintf(debug_file, "meta_oodate: ignoring pattern: %s\n", + p); +#endif + free(pm); + break; + } + free(pm); } /* Modified: vendor/NetBSD/bmake/dist/meta.h ============================================================================== --- vendor/NetBSD/bmake/dist/meta.h Fri May 20 15:43:51 2016 (r300308) +++ vendor/NetBSD/bmake/dist/meta.h Fri May 20 16:19:56 2016 (r300309) @@ -1,4 +1,4 @@ -/* $NetBSD: meta.h,v 1.4 2016/03/07 21:45:43 christos Exp $ */ +/* $NetBSD: meta.h,v 1.5 2016/05/12 20:28:34 sjg Exp $ */ /* * Things needed for 'meta' mode. @@ -48,8 +48,8 @@ void meta_job_start(struct Job *, GNode void meta_job_child(struct Job *); void meta_job_error(struct Job *, GNode *, int, int); void meta_job_output(struct Job *, char *, const char *); -void meta_cmd_finish(void *); -void meta_job_finish(struct Job *); +int meta_cmd_finish(void *); +int meta_job_finish(struct Job *); Boolean meta_oodate(GNode *, Boolean); void meta_compat_start(void); void meta_compat_child(void); Modified: vendor/NetBSD/bmake/dist/mk/ChangeLog ============================================================================== --- vendor/NetBSD/bmake/dist/mk/ChangeLog Fri May 20 15:43:51 2016 (r300308) +++ vendor/NetBSD/bmake/dist/mk/ChangeLog Fri May 20 16:19:56 2016 (r300309) @@ -1,3 +1,57 @@ +2016-05-12 Simon J. Gerraty + + * install-mk (MK_VERSION): 20160512 + + * dpadd.mk: always include local.dpadd.mk if it exists + remove some things that better belong in local.dpadd.mk + skip INCLUDES_* for staged libs unless SRC_* defined. + + * own.mk: add INCLUDEDIR + +2016-04-18 Simon J. Gerraty + + * dirdeps.mk: when doing -f dirdeps.mk if target suppies no + TARGET_MACHINE - :E will be empty or match part of path, use + ${MACHINE} + +2016-04-07 Simon J. Gerraty + + * meta.autodep.mk: issue a warning if UPDATE_DEPENDFILE=NO due to + NO_FILEMON_COOKIE + + * dirdeps.mk: move the logic that allows for + make -f dirdeps.mk some/dir.${TARGET_SPEC} + inside the check for !target(_DIRDEP_USE) + +2016-04-04 Simon J. Gerraty + + * Use <> when including local*.mk and others which may exist + elsewhere so that user can better control what they get. + + * meta.autodep.mk (NO_FILEMON_COOKIE): + create a cookie if we ever build dir with nofilemon + so that UPDATE_DEPENDFILE will be forced to NO until cleaned. + +2016-04-01 Simon J. Gerraty + + * install-mk (MK_VERSION): 20160401 + + * meta2deps.py: fix old print statement when debugging. + + * gendirdeps.mk: META2DEPS_CMD append M2D_EXCLUDES with -X + patch from Bryan Drewery + +2016-03-22 Simon J. Gerraty + + * install-mk (MK_VERSION): 20160317 (St. Pats) + + * warnings.mk: g++ does not like -Wimplicit + + * sys.mk sys/*.mk lib.mk prog.mk: use CXX_SUFFIXES to handle the + pelthora of common suffixes for C++ + + * lib.mk: use .So for shared objects + 2016-03-15 Simon J. Gerraty * install-mk (MK_VERSION): 20160315 Modified: vendor/NetBSD/bmake/dist/mk/auto.dep.mk ============================================================================== --- vendor/NetBSD/bmake/dist/mk/auto.dep.mk Fri May 20 15:43:51 2016 (r300308) +++ vendor/NetBSD/bmake/dist/mk/auto.dep.mk Fri May 20 16:19:56 2016 (r300309) @@ -1,6 +1,6 @@ # # RCSid: -# $Id: auto.dep.mk,v 1.4 2016/02/18 21:16:39 sjg Exp $ +# $Id: auto.dep.mk,v 1.5 2016/04/05 15:58:37 sjg Exp $ # # @(#) Copyright (c) 2010, Simon J. Gerraty # @@ -66,7 +66,7 @@ ${.MAKE.DEPENDFILE}: ${OBJS} ${POBJS} ${ .if empty(_SKIP_BUILD) _all_objs = ${OBJS} ${POBJS} ${SOBJS} .for d in ${_all_objs:M*o:T:O:u:%=%.d} -.dinclude "$d" +.dinclude <$d> .endfor .endif Modified: vendor/NetBSD/bmake/dist/mk/autodep.mk ============================================================================== --- vendor/NetBSD/bmake/dist/mk/autodep.mk Fri May 20 15:43:51 2016 (r300308) +++ vendor/NetBSD/bmake/dist/mk/autodep.mk Fri May 20 16:19:56 2016 (r300309) @@ -1,6 +1,6 @@ # # RCSid: -# $Id: autodep.mk,v 1.34 2014/08/04 05:12:27 sjg Exp $ +# $Id: autodep.mk,v 1.36 2016/04/05 15:58:37 sjg Exp $ # # @(#) Copyright (c) 1999-2010, Simon J. Gerraty # @@ -25,7 +25,11 @@ __${.PARSEFILE}__: DEPENDFILE?= .depend .for d in ${DEPENDFILE:N.depend} # bmake only groks .depend -.-include "$d" +.if ${MAKE_VERSION} < 20160218 +.-include <$d> +.else +.dinclude <$d> +.endif .endfor # it does nothing if SRCS is not defined or is empty @@ -75,6 +79,9 @@ CXXFLAGS_MD=${CXXFLAGS:M-[IUD]*} ${CPPFL CC_MD?=${CC} CXX_MD?=${CXX} +# should have been set by sys.mk +CXX_SUFFIXES?= .cc .cpp .cxx .C + # so we can do an explicit make depend, but not otherwise .if make(depend) .SUFFIXES: .d @@ -100,7 +107,7 @@ CXX_MD?=${CXX} @echo updating dependencies for $< @${SHELL} -ec "${CC_MD} -M ${CPPFLAGS_MD} ${AINC} $< | sed '/:/s/^/$@ /' > $@" || { ${RM} -f $@; false; } -.cc.d .cpp.d .C.d .cxx.d: +${CXX_SUFFIXES:%=%.d}: @echo updating dependencies for $< @${SHELL} -ec "${CXX_MD} -M ${CXXFLAGS_MD} $< | sed '/:/s/^/$@ /' > $@" || { ${RM} -f $@; false; } .else @@ -120,7 +127,7 @@ CXX_MD?=${CXX} .s.d .S.d: ${CC_MD} ${CFLAGS_MD:S/D//} ${CPPFLAGS_MD} ${AINC} $< > $@ || { ${RM} -f $@; false; } -.cc.d .cpp.d .C.d .cxx.d: +${CXX_SUFFIXES:%=%.d}: ${CXX_MD} ${CFLAGS_MD:S/D//} ${CXXFLAGS_MD} $< > $@ || { ${RM} -f $@; false; } .endif Modified: vendor/NetBSD/bmake/dist/mk/dirdeps.mk ============================================================================== --- vendor/NetBSD/bmake/dist/mk/dirdeps.mk Fri May 20 15:43:51 2016 (r300308) +++ vendor/NetBSD/bmake/dist/mk/dirdeps.mk Fri May 20 16:19:56 2016 (r300309) @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.62 2016/03/16 00:11:53 sjg Exp $ +# $Id: dirdeps.mk,v 1.67 2016/04/18 21:50:47 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -121,6 +121,26 @@ _DIRDEP_USE_LEVEL?= 0 # and non-specific Makefile.depend* .if !target(_DIRDEP_USE) + +.if ${MAKEFILE:T} == ${.PARSEFILE} && empty(DIRDEPS) && ${.TARGETS:Uall:M*/*} != "" +# This little trick let's us do +# +# mk -f dirdeps.mk some/dir.${TARGET_SPEC} +# +all: +${.TARGETS:Nall}: all +DIRDEPS := ${.TARGETS:M*[/.]*} +# so that -DNO_DIRDEPS works +DEP_RELDIR := ${DIRDEPS:[1]:R} +# this will become DEP_MACHINE below +TARGET_MACHINE := ${DIRDEPS:[1]:E:C/,.*//} +.if ${TARGET_MACHINE:N*/*} == "" +TARGET_MACHINE := ${MACHINE} +.endif +# disable DIRDEPS_CACHE as it does not like this trick +MK_DIRDEPS_CACHE = no +.endif + # make sure we get the behavior we expect .MAKE.SAVE_DOLLARS = no @@ -244,20 +264,6 @@ DEP_${TARGET_SPEC_VARS:[$i]} := ${_tspec DEP_MACHINE := ${_DEP_TARGET_SPEC} .endif -.if ${MAKEFILE:T} == ${.PARSEFILE} && empty(DIRDEPS) && ${.TARGETS:Uall:M*/*} != "" -# This little trick let's us do -# -# mk -f dirdeps.mk some/dir.${TARGET_SPEC} -# -all: -${.TARGETS:Nall}: all -DIRDEPS := ${.TARGETS:M*/*} -# so that -DNO_DIRDEPS works -DEP_RELDIR := ${DIRDEPS:R:[1]} -# disable DIRDEPS_CACHE as it does not like this trick -MK_DIRDEPS_CACHE = no -.endif - # reset each time through _build_all_dirs = @@ -284,7 +290,7 @@ _DEP_RELDIR := ${DEP_RELDIR} # pickup customizations # as below you can use !target(_DIRDEP_USE) to protect things # which should only be done once. -.-include "local.dirdeps.mk" +.-include .if !target(_DIRDEP_USE) # things we skip for host tools @@ -304,7 +310,13 @@ DEP_SKIP_DIR = ${SKIP_DIR} \ NSkipDir = ${DEP_SKIP_DIR:${M_ListToSkip}} -.if defined(NO_DIRDEPS) || defined(NODIRDEPS) || defined(WITHOUT_DIRDEPS) +.if defined(NODIRDEPS) || defined(WITHOUT_DIRDEPS) +NO_DIRDEPS = +.elif defined(WITHOUT_DIRDEPS_BELOW) +NO_DIRDEPS_BELOW = +.endif + +.if defined(NO_DIRDEPS) # confine ourselves to the original dir and below. DIRDEPS_FILTER += M${_DEP_RELDIR}* .elif defined(NO_DIRDEPS_BELOW) @@ -370,7 +382,7 @@ MK_DIRDEPS_CACHE ?= no BUILD_DIRDEPS_CACHE ?= no BUILD_DIRDEPS ?= yes -.if !defined(NO_DIRDEPS) +.if !defined(NO_DIRDEPS) && !defined(NO_DIRDEPS_BELOW) .if ${MK_DIRDEPS_CACHE} == "yes" # this is where we will cache all our work DIRDEPS_CACHE?= ${_OBJDIR}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.} @@ -452,7 +464,7 @@ _this_dir := ${SRCTOP}/${DEP_RELDIR} # on rare occasions, there can be a need for extra help _dep_hack := ${_this_dir}/${.MAKE.DEPENDFILE_PREFIX}.inc -.-include "${_dep_hack}" +.-include <${_dep_hack}> .if ${DEP_RELDIR} != ${_DEP_RELDIR} || ${DEP_TARGET_SPEC} != ${TARGET_SPEC} # this should be all Modified: vendor/NetBSD/bmake/dist/mk/dpadd.mk ============================================================================== --- vendor/NetBSD/bmake/dist/mk/dpadd.mk Fri May 20 15:43:51 2016 (r300308) +++ vendor/NetBSD/bmake/dist/mk/dpadd.mk Fri May 20 16:19:56 2016 (r300309) @@ -1,4 +1,4 @@ -# $Id: dpadd.mk,v 1.19 2014/04/05 22:56:54 sjg Exp $ +# $Id: dpadd.mk,v 1.21 2016/05/18 20:54:55 sjg Exp $ # # @(#) Copyright (c) 2004, Simon J. Gerraty # @@ -21,71 +21,91 @@ __${.PARSEFILE}__: _OBJDIR?= ${.OBJDIR} _CURDIR?= ${.CURDIR} +.if ${_CURDIR} == ${SRCTOP} +RELDIR=. +RELTOP=. +.else +RELDIR?= ${_CURDIR:S,${SRCTOP}/,,} +.if ${RELDIR} == ${_CURDIR} +RELDIR?= ${_OBJDIR:S,${OBJTOP}/,,} +.endif +RELTOP?= ${RELDIR:C,[^/]+,..,g} +.endif +RELOBJTOP?= ${OBJTOP} +RELSRCTOP?= ${SRCTOP} + +# we get included just about everywhere so this is handy... +# C*DEBUG_XTRA are for defining on cmd line etc +# so do not use in makefiles. +.ifdef CFLAGS_DEBUG_XTRA +CFLAGS_LAST += ${CFLAGS_DEBUG_XTRA} +.endif +.ifdef CXXFLAGS_DEBUG_XTRA +CXXFLAGS_LAST += ${CXXFLAGS_DEBUG_XTRA} +.endif + +.-include + # DPLIBS helps us ensure we keep DPADD and LDADD in sync DPLIBS+= ${DPLIBS_LAST} -DPADD+= ${DPLIBS} +DPADD+= ${DPLIBS:N-*} .for __lib in ${DPLIBS:T:R} -LDADD+= ${LDADD_${__lib}:U${__lib:T:R:S/lib/-l/:C/\.so.*//}} +.if "${_lib:M-*}" != "" +LDADD += ${__lib} +.else +LDADD += ${LDADD_${__lib}:U${__lib:T:R:S/lib/-l/:C/\.so.*//}} +.endif .endfor # DPADD can contain things other than libs -__dpadd_libs = ${DPADD:M*/lib*} +__dpadd_libs := ${DPADD:M*/lib*} # some libs have dependencies... # DPLIBS_* allows bsd.libnames.mk to flag libs which must be included # in DPADD for a given library. -.for __lib in ${__dpadd_libs:@d@${DPLIBS_${d:T:R}}@} +# Gather all such dependencies into __ldadd_all_xtras +# dups will be dealt with later. +# Note: libfoo_pic uses DPLIBS_libfoo +__ldadd_all_xtras= +.for __lib in ${__dpadd_libs:@d@${DPLIBS_${d:T:R:S,_pic,,}}@} +__ldadd_all_xtras+= ${LDADD_${__lib}:U${__lib:T:R:S/lib/-l/:C/\.so.*//}} .if "${DPADD:M${__lib}}" == "" DPADD+= ${__lib} -LDADD+= ${LDADD_${__lib}:U${__lib:T:R:S/lib/-l/:C/\.so.*//}} .endif .endfor # Last of all... for libc and libgcc DPADD+= ${DPADD_LAST} +# de-dupuplicate __ldadd_all_xtras into __ldadd_xtras +# in reverse order so that libs end up listed after all that needed them. +__ldadd_xtras= +.for __lib in ${__ldadd_all_xtras:[-1..1]} +.if "${__ldadd_xtras:M${__lib}}" == "" || ${NEED_IMPLICIT_LDADD:tl:Uno} != "no" +__ldadd_xtras+= ${__lib} +.endif +.endfor + +.if !empty(__ldadd_xtras) +# now back to the original order +__ldadd_xtras:= ${__ldadd_xtras:[-1..1]} +LDADD+= ${__ldadd_xtras} +.endif + # Convert DPADD into -I and -L options and add them to CPPFLAGS and LDADD # For the -I's convert the path to a relative one. For separate objdirs # the DPADD paths will be to the obj tree so we need to subst anyway. -# If USE_PROFILE is yes, then check for profiled versions of libs -# and use them. - -USE_PROFILE?=no -.if defined(LIBDL) && exists(${LIBDL}) -.if defined(PROG) && (make(${PROG}_p) || ${USE_PROFILE} == yes) && \ - defined(LDFLAGS) && ${LDFLAGS:M-export-dynamic} -# building profiled version of a prog that needs dlopen to work -DPLIBS+= ${LIBDL} -.endif -.endif - -.if defined(LIBDMALLOC) && exists(${LIBDMALLOC}) -.if defined(USE_DMALLOC) && ${USE_DMALLOC} != no -.if !defined(NO_DMALLOC) -CPPFLAGS+= -DUSE_DMALLOC -.endif -DPLIBS+= ${LIBDMALLOC} -.endif -.endif +# update this +__dpadd_libs := ${DPADD:M*/lib*} # Order -L's to search ours first. # Avoids picking up old versions already installed. -__dpadd_libdirs := ${__dpadd_libs:R:H:S/^/-L/g:O:u:N-L} +__dpadd_libdirs := ${__dpadd_libs}:R:H:S/^/-L/g:O:u:N-L} LDADD += ${__dpadd_libdirs:M-L${OBJTOP}/*} -LDADD += ${__dpadd_libdirs:N-L${OBJTOP}/*} - -.if ${.CURDIR} == ${SRCTOP} -RELDIR=. -RELTOP=. -.else -RELDIR?= ${.CURDIR:S,${SRCTOP}/,,} -.if ${RELDIR} == ${.CURDIR} -RELDIR?= ${.OBJDIR:S,${OBJTOP}/,,} +LDADD += ${__dpadd_libdirs:N-L${OBJTOP}/*:N-L${HOST_LIBDIR:U/usr/lib}} +.if defined(HOST_LIBDIR) && ${HOST_LIBDIR} != "/usr/lib" +LDADD+= -L${HOST_LIBDIR} .endif -RELTOP?= ${RELDIR:C,[^/]+,..,g} -.endif -RELOBJTOP?= ${OBJTOP} -RELSRCTOP?= ${SRCTOP} .if !make(dpadd) .ifdef LIB @@ -109,7 +129,8 @@ __dpadd_libs += ${SRC_LIBS} DPMAGIC_LIBS += ${__dpadd_libs} \ ${__dpadd_libs:@d@${DPMAGIC_LIBS_${d:T:R}}@} -.for __lib in ${DPMAGIC_LIBS:O:u} +# we skip this for staged libs +.for __lib in ${DPMAGIC_LIBS:O:u:N${STAGE_OBJTOP:Unot}*/lib/*} # # if SRC_libfoo is not set, then we assume that the srcdir corresponding # to where we found the library is correct. @@ -127,6 +148,35 @@ INCLUDES_${__lib:T:R}?= -I${exists(${SRC .endfor +# even for staged libs we sometimes +# need to allow direct -I to avoid cicular dependencies +.for __lib in ${DPMAGIC_LIBS:O:u:T:R} +.if !empty(SRC_${__lib}) && empty(INCLUDES_${__lib}) +# must be a staged lib +.if exists(${SRC_${__lib}}/h) +INCLUDES_${__lib} = -I${SRC_${__lib}}/h +.else +INCLUDES_${__lib} = -I${SRC_${__lib}} +.endif +.endif +.endfor + +# when linking a shared lib, avoid non pic libs +SHLDADD+= ${LDADD:N-[lL]*} +.for __lib in ${__dpadd_libs:u} +.if defined(SHLIB_NAME) && ${LDADD:M-l${__lib:T:R:S,lib,,}} != "" +.if ${__lib:T:N*_pic.a:N*.so} == "" || exists(${__lib:R}.so) +SHLDADD+= -l${__lib:T:R:S,lib,,} +.elif exists(${__lib:R}_pic.a) +SHLDADD+= -l${__lib:T:R:S,lib,,}_pic +.else +.warning ${RELDIR}.${TARGET_SPEC} needs ${__lib:T:R}_pic.a +SHLDADD+= -l${__lib:T:R:S,lib,,} +.endif +SHLDADD+= -L${__lib:H} +.endif +.endfor + # Now for the bits we actually need __dpadd_incs= .for __lib in ${__dpadd_libs:u} @@ -134,20 +184,25 @@ __dpadd_incs= __ldadd=-l${__lib:T:R:S,lib,,} LDADD := ${LDADD:S,^${__ldadd}$,${__ldadd}_p,g} .endif +.endfor # -# Some libs generate headers, so we potentially need both -# the src dir and the obj dir. -# If ${INCLUDES_libfoo} contains a word ending in /h, we assume that either -# 1. it does not generate headers or -# 2. INCLUDES_libfoo will have been set correctly -# XXX it gets ugly avoiding duplicates... -# use :? to ensure .for does not prevent correct evaluation -# # We take care of duplicate suppression later. -__dpadd_incs += ${"${INCLUDES_${__lib:T:R}:M*/h}":? :-I${OBJ_${__lib:T:R}}} -__dpadd_incs += ${INCLUDES_${__lib:T:R}} -.endfor +# don't apply :T:R too early +__dpadd_incs += ${__dpadd_libs:u:@x@${INCLUDES_${x:T:R}}@} +__dpadd_incs += ${__dpadd_libs:O:u:@s@${SRC_LIBS_${s:T:R}:U}@:@x@${INCLUDES_${x:T:R}}@} + +__dpadd_last_incs += ${__dpadd_libs:u:@x@${INCLUDES_LAST_${x:T:R}}@} +__dpadd_last_incs += ${__dpadd_libs:O:u:@s@${SRC_LIBS_${s:T:R}:U}@:@x@${INCLUDES_LAST_${x:T:R}}@} + +.if defined(HOSTPROG) || ${MACHINE} == "host" +# we want any -I/usr/* last +__dpadd_last_incs := \ + ${__dpadd_last_incs:N-I/usr/*} \ + ${__dpadd_incs:M-I/usr/*} \ + ${__dpadd_last_incs:M-I/usr/*} +__dpadd_incs := ${__dpadd_incs:N-I/usr/*} +.endif # # eliminate any duplicates - but don't mess with the order @@ -164,13 +219,21 @@ __$t_incs+= $i .endfor .endfor +.for t in CFLAGS_LAST CXXFLAGS_LAST +# avoid duplicates +__$t_incs:=${$t:M-I*:u} +.for i in ${__dpadd_last_incs} +.if "${__$t_incs:M$i}" == "" +$t+= $i +__$t_incs+= $i +.endif +.endfor +.endfor + # This target is used to gather a list of # dir: ${DPADD} # entries .if make(*dpadd*) -# allow overrides -.-include "dpadd++.mk" - .if !target(dpadd) dpadd: .NOTMAIN .if defined(DPADD) && ${DPADD} != "" @@ -193,4 +256,17 @@ dpadd: .NOTMAIN .PATH: ${SRC_PATHADD} .endif +# after all that, if doing -n we don't care +.if ${.MAKEFLAGS:Ux:M-n} != "" +DPADD = *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Fri May 20 16:20:09 2016 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 D7FC3B44A32; Fri, 20 May 2016 16:20:09 +0000 (UTC) (envelope-from sjg@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 800C41D53; Fri, 20 May 2016 16:20:09 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4KGK8Oo061564; Fri, 20 May 2016 16:20:08 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4KGK8kT061563; Fri, 20 May 2016 16:20:08 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201605201620.u4KGK8kT061563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 20 May 2016 16:20:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r300310 - vendor/NetBSD/bmake/20160512 X-SVN-Group: vendor 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.22 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, 20 May 2016 16:20:10 -0000 Author: sjg Date: Fri May 20 16:20:08 2016 New Revision: 300310 URL: https://svnweb.freebsd.org/changeset/base/300310 Log: tag bmake-20160512 Added: vendor/NetBSD/bmake/20160512/ - copied from r300309, vendor/NetBSD/bmake/dist/ From owner-svn-src-vendor@freebsd.org Fri May 20 19:15:09 2016 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 4B2E6B44248; Fri, 20 May 2016 19:15:09 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 329981655; Fri, 20 May 2016 19:15:09 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 2A6B61F35; Fri, 20 May 2016 19:15:09 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id DC9762087C; Fri, 20 May 2016 19:15:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id UI6asowdhath; Fri, 20 May 2016 19:15:06 +0000 (UTC) Subject: Re: svn commit: r300309 - in vendor/NetBSD/bmake/dist: . mk mk/sys DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com E6BA620875 To: "Simon J. Gerraty" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org References: <201605201619.u4KGJvNZ061471@repo.freebsd.org> From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: <575a775a-1b05-791b-ca0d-aed8795bc926@FreeBSD.org> Date: Fri, 20 May 2016 12:15:13 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <201605201619.u4KGJvNZ061471@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="iGItFG68P0TLubVGPHupnkrKEtDJvq2Vm" X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.22 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, 20 May 2016 19:15:09 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --iGItFG68P0TLubVGPHupnkrKEtDJvq2Vm Content-Type: multipart/mixed; boundary="UcriTsjUxu4E0rsE4RUsKrPgdI7jMpPcG" From: Bryan Drewery To: "Simon J. Gerraty" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Message-ID: <575a775a-1b05-791b-ca0d-aed8795bc926@FreeBSD.org> Subject: Re: svn commit: r300309 - in vendor/NetBSD/bmake/dist: . mk mk/sys References: <201605201619.u4KGJvNZ061471@repo.freebsd.org> In-Reply-To: <201605201619.u4KGJvNZ061471@repo.freebsd.org> --UcriTsjUxu4E0rsE4RUsKrPgdI7jMpPcG Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 5/20/2016 9:19 AM, Simon J. Gerraty wrote: > Author: sjg > Date: Fri May 20 16:19:56 2016 > New Revision: 300309 > URL: https://svnweb.freebsd.org/changeset/base/300309 >=20 > Log: > Import bmake-20160512 > =20 > Interesting changes (from ChangeLog): > o meta.c: ignore paths that match .MAKE.META.IGNORE_PATTERNS > this is useful for gcov builds. > o propagate errors from filemon(4). > o meta.c: apply realpath() before matching against metaIgnorePaths Thanks! > o allow makefile to set .MAKE.JOBS Looks like .MAKE.JOBS didn't make it into the manpage. --=20 Regards, Bryan Drewery --UcriTsjUxu4E0rsE4RUsKrPgdI7jMpPcG-- --iGItFG68P0TLubVGPHupnkrKEtDJvq2Vm Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJXP2JBAAoJEDXXcbtuRpfPOXsH/1fYddICh/hxQvFg96CjNVkd 9iZOBtxSkbtoC/poc1AutU4tmr0uKDIG9Pfjyir/vNh3vY4hJsypGlWuo0P2ZT5U toFyxcesMHb40joWAgW1varqdjrUZN2qYQNCFqIpqSqw9vfDsfBKWa2kFme/URkR Sb06FK1PYzWZe9B35lOfBypVKJigd3W6+aOi41KlzSSKvHg41s0Beq17ilisuwC7 Ak2XGLjvNYl1khGmFffb1Ze4a2z3kR/hqlKKAbN5ggt/jLPu62VJQxD1A3CD4ojq KNOJWV+LYf+PQtKdWB0RbIFUZpgPIMFA2gb9okmqWoy/rqWP8/B6rJehhpyGODM= =skIf -----END PGP SIGNATURE----- --iGItFG68P0TLubVGPHupnkrKEtDJvq2Vm--