aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2016-02-10 19:39:36 +0000
committerEd Maste <emaste@FreeBSD.org>2016-02-10 19:39:36 +0000
commit888a18208d70e0395f1ba2a425a272996246174e (patch)
tree3de9500b684e6cb0b1066dfbf0133793e385df71
parent768a24a304ee84c17865b4348beacb61aa47af1b (diff)
downloadsrc-888a18208d70e0395f1ba2a425a272996246174e.tar.gz
src-888a18208d70e0395f1ba2a425a272996246174e.zip
Import ELF Tool Chain snapshot revision 3395vendor/elftoolchain/elftoolchain-r3395
This is close to the upcoming 0.7.1 release. From http://svn.code.sf.net/p/elftoolchain/code
Notes
Notes: svn path=/vendor/elftoolchain/dist/; revision=295484 svn path=/vendor/elftoolchain/elftoolchain-r3395/; revision=295485; tag=vendor/elftoolchain/elftoolchain-r3395
-rw-r--r--INSTALL70
-rw-r--r--Makefile26
-rw-r--r--RELEASE-NOTES8
-rw-r--r--addr2line/addr2line.c8
-rw-r--r--addr2line/os.NetBSD.mk2
-rw-r--r--ar/ar.c4
-rw-r--r--brandelf/brandelf.c4
-rw-r--r--common/elfdefinitions.h139
-rwxr-xr-xcommon/native-elf-format4
-rw-r--r--cxxfilt/cxxfilt.c21
-rw-r--r--elfcopy/Makefile23
-rw-r--r--elfcopy/archive.c6
-rw-r--r--elfcopy/elfcopy.119
-rw-r--r--elfcopy/elfcopy.h3
-rw-r--r--elfcopy/main.c18
-rw-r--r--elfcopy/pe.c233
-rw-r--r--elfcopy/sections.c107
-rw-r--r--elfcopy/segments.c16
-rw-r--r--elfcopy/symbols.c120
-rw-r--r--elfdump/elfdump.c370
-rw-r--r--elfdump/os.NetBSD.mk2
-rw-r--r--findtextrel/findtextrel.c12
-rw-r--r--ld/Makefile25
-rw-r--r--ld/amd64.c9
-rw-r--r--ld/bigmips_script.ld165
-rw-r--r--ld/i386.c13
-rw-r--r--ld/ld_arch.c20
-rw-r--r--ld/ld_arch.h8
-rw-r--r--ld/ld_dynamic.c4
-rw-r--r--ld/ld_exp.c9
-rw-r--r--ld/ld_file.c5
-rw-r--r--ld/ld_layout.c10
-rw-r--r--ld/ld_output.c7
-rw-r--r--ld/ld_script.c41
-rw-r--r--ld/ld_script.h7
-rw-r--r--ld/ld_script_lexer.l5
-rw-r--r--ld/ld_script_parser.y25
-rw-r--r--ld/ld_strtab.c8
-rw-r--r--ld/ld_symbols.c5
-rw-r--r--ld/littlemips_script.ld165
-rw-r--r--ld/mips.c403
-rw-r--r--ld/mips.h29
-rw-r--r--libdwarf/_libdwarf.h10
-rw-r--r--libdwarf/dwarf.36
-rw-r--r--libdwarf/dwarf_str.c8
-rw-r--r--libdwarf/libdwarf.h4
-rw-r--r--libdwarf/libdwarf_rw.c14
-rw-r--r--libdwarf/os.NetBSD.mk2
-rw-r--r--libelftc/Makefile13
-rw-r--r--libelftc/elftc_bfd_find_target.310
-rw-r--r--libelftc/elftc_copyfile.c24
-rw-r--r--libelftc/elftc_demangle.c10
-rw-r--r--libelftc/elftc_symbol_table_create.3529
-rw-r--r--libelftc/libelftc.h6
-rw-r--r--libelftc/libelftc_bfdtarget.c26
-rw-r--r--libelftc/libelftc_dem_gnu3.c22
-rwxr-xr-xlibelftc/make-toolchain-version4
-rw-r--r--libelftc/os.NetBSD.mk2
-rw-r--r--libpe/Makefile32
-rw-r--r--libpe/_libpe.h213
-rw-r--r--libpe/libpe.h121
-rw-r--r--libpe/libpe_buffer.c185
-rw-r--r--libpe/libpe_coff.c535
-rw-r--r--libpe/libpe_dos.c403
-rw-r--r--libpe/libpe_init.c145
-rw-r--r--libpe/libpe_rich.c128
-rw-r--r--libpe/libpe_section.c518
-rw-r--r--libpe/libpe_utils.c69
-rw-r--r--libpe/os.Linux.mk6
-rw-r--r--libpe/os.NetBSD.mk2
-rw-r--r--libpe/pe.h292
-rw-r--r--libpe/pe_buffer.c100
-rw-r--r--libpe/pe_cntl.c62
-rw-r--r--libpe/pe_coff.c157
-rw-r--r--libpe/pe_dos.c119
-rw-r--r--libpe/pe_flag.c187
-rw-r--r--libpe/pe_init.c95
-rw-r--r--libpe/pe_rich.c107
-rw-r--r--libpe/pe_section.c213
-rw-r--r--libpe/pe_symtab.c86
-rw-r--r--libpe/pe_update.c86
-rw-r--r--mk/elftoolchain.components.mk21
-rw-r--r--mk/elftoolchain.prog.mk14
-rw-r--r--nm/os.NetBSD.mk2
-rw-r--r--readelf/os.NetBSD.mk2
-rw-r--r--readelf/readelf.c108
-rw-r--r--size/os.NetBSD.mk2
-rw-r--r--strings/os.NetBSD.mk2
-rw-r--r--strings/strings.17
-rw-r--r--strings/strings.c12
-rw-r--r--test/ar/plugin/Makefile4
-rw-r--r--test/ar/plugin/ardiff.c19
-rw-r--r--test/ar/plugin/teraser.c6
-rw-r--r--test/ar/tc/usage-bi/usage-bi.err1
-rw-r--r--test/elfcopy/plugin/Makefile4
-rw-r--r--test/elfcopy/plugin/ardiff.c19
-rw-r--r--test/elfcopy/plugin/teraser.c6
-rw-r--r--test/elfcopy/tc/elfcopy-L-1/out/elfcopy-L-1.out.shar26
-rw-r--r--test/elfcopy/tc/elfcopy-L-2/out/elfcopy-L-2.out.shar180
-rw-r--r--test/elfcopy/tc/elfcopy-N-1/out/elfcopy-N-1.out.shar32
-rw-r--r--test/elfcopy/tc/elfcopy-N-2/out/elfcopy-N-2.out.shar32
-rw-r--r--test/elfcopy/tc/elfcopy-noops-1/out/elfcopy-noops-1.out.shar66
-rw-r--r--test/elfcopy/tc/elfcopy-noops-2/out/elfcopy-noops-2.out.shar16
-rw-r--r--test/elfcopy/tc/elfcopy-noops-3/out/elfcopy-noops-3.out.shar16
-rw-r--r--test/elfcopy/tc/elfcopy-noops-4/out/elfcopy-noops-4.out.shar16
-rw-r--r--test/elfcopy/tc/elfcopy-noops-5/out/elfcopy-noops-5.out.shar16
-rw-r--r--test/elfcopy/tc/elfcopy-noops-6/out/elfcopy-noops-6.out.shar82
-rw-r--r--test/elfcopy/tc/elfcopy-noops-7/out/elfcopy-noops-7.out.shar364
-rw-r--r--test/elfcopy/tc/elfcopy-noops-archive-1/out/elfcopy-noops-archive-1.out.shar112
-rw-r--r--test/elfcopy/tc/elfcopy-noops-archive-2/out/elfcopy-noops-archive-2.out.shar112
-rw-r--r--test/elfcopy/tc/elfcopy-rename-1/out/elfcopy-rename-1.out.shar26
-rw-r--r--test/elfcopy/tc/strip-K-2/out/strip-K-2.out.shar30
-rw-r--r--test/elfcopy/tc/strip-all-1/out/strip-all-1.out.shar10
-rw-r--r--test/elfcopy/tc/strip-all-10/out/strip-all-10.out.shar4
-rw-r--r--test/elfcopy/tc/strip-all-2/out/strip-all-2.out.shar10
-rw-r--r--test/elfcopy/tc/strip-all-3/out/strip-all-3.out.shar10
-rw-r--r--test/elfcopy/tc/strip-all-4/out/strip-all-4.out.shar10
-rw-r--r--test/elfcopy/tc/strip-all-5/out/strip-all-5.out.shar8
-rw-r--r--test/elfcopy/tc/strip-all-6/out/strip-all-6.out.shar10
-rw-r--r--test/elfcopy/tc/strip-all-7/out/strip-all-7.out.shar10
-rw-r--r--test/elfcopy/tc/strip-all-8/out/strip-all-8.out.shar10
-rw-r--r--test/elfcopy/tc/strip-all-9/out/strip-all-9.out.shar16
-rw-r--r--test/elfcopy/tc/strip-all-archive-1/out/strip-all-archive-1.out.shar24
-rw-r--r--test/elfcopy/tc/strip-all-archive-2/out/strip-all-archive-2.out.shar18
-rw-r--r--test/elfcopy/tc/strip-debug-1/out/strip-debug-1.out.shar400
-rw-r--r--test/elfcopy/tc/strip-debug-2/out/strip-debug-2.out.shar258
-rw-r--r--test/elfcopy/tc/strip-debug-3/out/strip-debug-3.out.shar16
-rw-r--r--test/elfcopy/tc/strip-debug-4/out/strip-debug-4.out.shar367
-rw-r--r--test/elfcopy/tc/strip-onlydebug-1/out/strip-onlydebug-1.out.shar946
-rw-r--r--test/elfcopy/tc/strip-unneeded-1/out/strip-unneeded-1.out.shar388
-rw-r--r--test/elfcopy/tc/strip-unneeded-2/out/strip-unneeded-2.out.shar16
-rw-r--r--test/elfdump/ts/dso1/@G%libelf.so.out2
-rw-r--r--test/elfdump/ts/dso1/@S@G%libelf.so.out74
-rw-r--r--test/elfdump/ts/dso1/@S@r%libelf.so.out74
-rw-r--r--test/elfdump/ts/dso2/@G%test.so.out40
-rw-r--r--test/elfdump/ts/dso2/@S@G%test.so.out15
-rw-r--r--test/elfdump/ts/dso2/@S@r%test.so.out18
-rw-r--r--test/elfdump/ts/dso2/@e%test.so.out2
-rw-r--r--test/elfdump/ts/dso2/@e@i%test.so.out2
-rw-r--r--test/elfdump/ts/dso2/@e@p@c%test.so.out2
-rw-r--r--test/elfdump/ts/exec1/@G%ls.out2
-rw-r--r--test/elfdump/ts/exec1/@G@e%ls.out2
-rw-r--r--test/elfdump/ts/exec1/@S@G%ls.out140
-rw-r--r--test/elfdump/ts/exec1/@S@r%ls.out140
-rw-r--r--test/elfdump/ts/exec1/@S@r@N%.rela.dyn@N%.rela.plt%ls.out140
-rw-r--r--test/elfdump/ts/exec2/@G%cp.out2
-rw-r--r--test/elfdump/ts/exec2/@G@e%cp.out2
-rw-r--r--test/elfdump/ts/exec2/@S@G%cp.out116
-rw-r--r--test/elfdump/ts/exec2/@S@r%cp.out116
-rw-r--r--test/libdwarf/ts/Makefile.tset8
150 files changed, 8228 insertions, 3284 deletions
diff --git a/INSTALL b/INSTALL
index e6e9752e8291..d3eeaac3a859 100644
--- a/INSTALL
+++ b/INSTALL
@@ -14,13 +14,11 @@ operating systems.
Operating System Version Supported Architectures
----------------- -------- -----------------------
`DragonFly BSD`_ 2.10.1 i386
- FreeBSD_ v8.2 amd64 & i386
- FreeBSD_ v10.1 i386
+ FreeBSD_ 10.2 amd64 & i386
Minix_ 3.0.2 i386
- NetBSD_ v5.0.2 i386
+ NetBSD_ 7.0 i386
OpenBSD_ v5.0 i386
- Ubuntu_ GNU/Linux 10.04LTS i386 & x86_64
- Ubuntu_ GNU/Linux 12.04LTS i386 & x86_64
+ Ubuntu_ GNU/Linux 14.04LTS x86_64
================= ======== =======================
.. _DragonFly BSD: http://www.dragonflybsd.org/
@@ -35,9 +33,9 @@ Building the Source Tree
The core libraries and utilities that make up the software release are
always built by default. Builds of the project's test suites (in the
-``test/`` subdirectory), and of additional documentation (in the
-directory ``documentation/``) are optional and will only be attempted
-if these directories are present.
+``test/`` subdirectory), and of additional documentation (in the directory
+``documentation/``) are optional, and will only be attempted if these
+directories are present.
Prerequisites
-------------
@@ -58,39 +56,24 @@ Prerequisites
- Building additional documentation is not currently supported
under DragonFly BSD.
-:FreeBSD 8.2:
+:FreeBSD 10.2:
- The core libraries and utilities should build out of the box on
a stock install of FreeBSD.
- 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 ``py-yaml`` package needs to be installed::
+ be downloaded and unpacked into the ``test/tet/`` directory::
- % sudo pkg_add -r py-yaml
-
- - To build additional documentation, the ``latex-pgf`` package is
- needed::
-
- % sudo pkg_add -r latex-pgf
-
-:FreeBSD 10.1:
- - The core libraries and utilities should build out of the box on
- a stock install of FreeBSD.
-
- - 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.
+ % cd <SRCDIR>/test/tet
+ % tar -xf /PATH/TO/DOWNLOADED/TET-3.8-SOURCES
#. The ``python`` and ``py27-yaml`` packages need to be installed::
% sudo pkg install python py27-yaml
- Building additional documentation is not currently supported under
- FreeBSD 10.1.
+ FreeBSD 10.2.
:Minix 3.2.0:
- The following packages are pre-requisites for building the
@@ -152,9 +135,20 @@ Prerequisites
- Building additional documentation is not currently supported
under OpenBSD.
-:NetBSD 5.0.2:
- - The core libraries and utilities should build out of the box
- on a stock install of NetBSD.
+:NetBSD 7.0:
+ - The following packages are pre-requisites for building the
+ sources on NetBSD 7.0:
+
+ =================== =====================================
+ **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:
@@ -165,7 +159,7 @@ Prerequisites
#. The following additional package needs to be installed, as
listed in the example command line below ::
- % sudo pkg_add py26-yaml
+ % sudo pkg_add py27-yaml
- Building additional documentation is not currently supported
under NetBSD.
@@ -213,9 +207,9 @@ Prerequisites
% sudo apt-get install pgf
-:Ubuntu GNU/Linux 12.04:
+:Ubuntu GNU/Linux 14.04:
- The following packages are pre-requisites for building the
- sources on Ubuntu GNU/Linux 12.04:
+ sources on Ubuntu GNU/Linux 14.04:
=================== =====================================
**Package** **Description**
@@ -226,7 +220,7 @@ Prerequisites
``libarchive-dev`` Archive access library.
``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.
@@ -236,7 +230,7 @@ Prerequisites
pre-requisites::
% sudo apt-get install bison build-essential flex libarchive-dev \
- m4 pmake zlib1g-dev
+ m4 bmake zlib1g-dev
- To build and run the test suite:
@@ -250,7 +244,7 @@ Prerequisites
% sudo apt-get install libexpat1-dev python-yaml sharutils
- Builds of additional documentation are not currently supported
- under Ubuntu GNU/Linux 12.04.
+ under Ubuntu GNU/Linux 14.04.
.. _Test Execution Toolkit: http://tetworks.opengroup.org/
.. _OpenGroup: http://www.opengroup.org/
@@ -316,7 +310,7 @@ website`_.
.. _project website: http://elftoolchain.sourceforge.net/
-.. $Id: INSTALL 3193 2015-05-04 17:47:14Z jkoshy $
+.. $Id: INSTALL 3353 2016-01-18 21:50:13Z jkoshy $
.. Local Variables:
.. mode: rst
diff --git a/Makefile b/Makefile
index b217fdda1f11..daf376f30a08 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,8 @@
-# $Id: Makefile 3016 2014-04-10 16:01:42Z jkoshy $
+# $Id: Makefile 3382 2016-01-31 12:31:08Z jkoshy $
TOP= .
+.include "${TOP}/mk/elftoolchain.components.mk"
.include "${TOP}/mk/elftoolchain.os.mk"
# Build configuration information first.
@@ -13,10 +14,14 @@ SUBDIR += libdwarf
# Build additional APIs.
SUBDIR += libelftc
+.if defined(WITH_PE) && ${WITH_PE:tl} == "yes"
+SUBDIR += libpe
+.endif
-# Build the tools needed for the rest of the build.
-
-# SUBDIR += isa # ('isa' does not build on all platforms yet).
+# The instruction set analyser.
+.if defined(WITH_ISA) && ${WITH_ISA:tl} == "yes"
+SUBDIR += isa # ('isa' does not build on all platforms yet).
+.endif
# Build tools after the libraries.
SUBDIR += addr2line
@@ -26,6 +31,7 @@ SUBDIR += cxxfilt
SUBDIR += elfcopy
SUBDIR += elfdump
SUBDIR += findtextrel
+SUBDIR += ld
SUBDIR += nm
SUBDIR += readelf
SUBDIR += size
@@ -33,12 +39,18 @@ SUBDIR += strings
SUBDIR += tools
# Build the test suites.
-.if exists(${.CURDIR}/test) && defined(MKTESTS) && ${MKTESTS} == "yes"
+.if exists(${.CURDIR}/test) && defined(WITH_TESTS) && ${WITH_TESTS:tl} == "yes"
SUBDIR += test
.endif
+# Build additional build tooling.
+.if defined(WITH_BUILD_TOOLS) && ${WITH_BUILD_TOOLS:tl} == "yes"
+SUBDIR += tools
+.endif
+
# Build documentation at the end.
-.if exists(${.CURDIR}/documentation) && defined(MKDOC) && ${MKDOC} == "yes"
+.if exists(${.CURDIR}/documentation) && defined(WITH_DOCUMENTATION) && \
+ ${WITH_DOCUMENTATION:tl} == "yes"
SUBDIR += documentation
.endif
@@ -49,7 +61,7 @@ SUBDIR += documentation
#
# Run the test suites.
-.if exists(${.CURDIR}/test) && defined(MKTESTS) && ${MKTESTS} == "yes"
+.if exists(${.CURDIR}/test) && defined(WITH_TESTS) && ${WITH_TESTS:tl} == "yes"
run-tests: all .PHONY
(cd ${.CURDIR}/test; ${MAKE} test)
.endif
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 37e45bdfe303..0aa1c3d266bb 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -1,4 +1,4 @@
-.. $Id: RELEASE-NOTES 2599 2012-09-25 06:25:51Z jkoshy $
+.. $Id: RELEASE-NOTES 3353 2016-01-18 21:50:13Z jkoshy $
.. This file contains a template for use when writing release notes.
.. It needs to be updated with release-specific content prior to
@@ -96,11 +96,11 @@ systems:
**Operating System** **Version** **Supported Architectures**
-------------------- ----------- ---------------------------
`DragonFly BSD`_ 2.10.1 i386
- FreeBSD_ v8.2 amd64 & i386
+ FreeBSD_ 10.2 amd64 & i386
Minix_ 3.2.0 i386
- NetBSD_ v5.0.2 i386
+ NetBSD_ 7.0 i386
OpenBSD_ v5.0 i386
- Ubuntu_ GNU/Linux 10.04LTS i386 & x86_64
+ Ubuntu_ GNU/Linux 14.04LTS x86_64
==================== =========== ===========================
diff --git a/addr2line/addr2line.c b/addr2line/addr2line.c
index 53105762565c..3cd8cb5389fe 100644
--- a/addr2line/addr2line.c
+++ b/addr2line/addr2line.c
@@ -40,7 +40,7 @@
#include "uthash.h"
#include "_elftc.h"
-ELFTC_VCSID("$Id: addr2line.c 3264 2015-11-30 05:38:14Z kaiwang27 $");
+ELFTC_VCSID("$Id: addr2line.c 3273 2015-12-11 21:38:57Z kaiwang27 $");
struct Func {
char *name;
@@ -368,7 +368,8 @@ print_inlines(struct CU *cu, struct Func *f, Dwarf_Unsigned call_file,
printf("%s\n", f->name);
}
}
- (void) printf("%s:%ju\n", base ? basename(file) : file, call_line);
+ (void) printf("%s:%ju\n", base ? basename(file) : file,
+ (uintmax_t) call_line);
if (f->inlined_caller != NULL)
print_inlines(cu, f->inlined_caller, f->call_file,
@@ -562,7 +563,8 @@ out:
}
}
- (void) printf("%s:%ju\n", base ? basename(file) : file, lineno);
+ (void) printf("%s:%ju\n", base ? basename(file) : file,
+ (uintmax_t) lineno);
if (ret == DW_DLV_OK && inlines && cu != NULL &&
cu->srcfiles != NULL && f != NULL && f->inlined_caller != NULL)
diff --git a/addr2line/os.NetBSD.mk b/addr2line/os.NetBSD.mk
new file mode 100644
index 000000000000..ae214e3115c0
--- /dev/null
+++ b/addr2line/os.NetBSD.mk
@@ -0,0 +1,2 @@
+# TODO(#511): Revert after the source tree is -Wconversion clean.
+WARNS=5
diff --git a/ar/ar.c b/ar/ar.c
index 62f0e55d5d31..1b60a12fd480 100644
--- a/ar/ar.c
+++ b/ar/ar.c
@@ -72,7 +72,7 @@
#include "ar.h"
-ELFTC_VCSID("$Id: ar.c 3243 2015-08-31 19:28:45Z emaste $");
+ELFTC_VCSID("$Id: ar.c 3319 2016-01-13 21:37:53Z jkoshy $");
enum options
{
@@ -407,7 +407,7 @@ Usage: %s <command> [options] archive file...\n\
-F FORMAT | --flavor=FORMAT\n\
Create archives with the specified format.\n\
-S Do not generate an archive symbol table.\n\
- -U Use original metadata, for unique archive checksums.\n"
+ -U Use original metadata for archive members.\n"
static void
bsdar_usage(void)
diff --git a/brandelf/brandelf.c b/brandelf/brandelf.c
index cbe5d6cabbb2..22166f796589 100644
--- a/brandelf/brandelf.c
+++ b/brandelf/brandelf.c
@@ -44,7 +44,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: brandelf.c 3234 2015-07-31 12:35:09Z emaste $");
+ELFTC_VCSID("$Id: brandelf.c 3354 2016-01-18 21:50:15Z jkoshy $");
static int elftype(const char *);
static const char *iselftype(int);
@@ -212,7 +212,7 @@ main(int argc, char **argv)
/*
* Update the ABI type.
*/
- ehdr.e_ident[EI_OSABI] = type;
+ ehdr.e_ident[EI_OSABI] = (unsigned char) type;
if (gelf_update_ehdr(elf, &ehdr) == 0) {
warnx("gelf_update_ehdr error: %s",
elf_errmsg(-1));
diff --git a/common/elfdefinitions.h b/common/elfdefinitions.h
index e953c924147d..fa6132d40adb 100644
--- a/common/elfdefinitions.h
+++ b/common/elfdefinitions.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: elfdefinitions.h 3253 2015-10-10 18:31:33Z kaiwang27 $
+ * $Id: elfdefinitions.h 3392 2016-02-05 19:51:22Z emaste $
*/
/*
@@ -1228,6 +1228,7 @@ _ELF_DEFINE_STB(STB_GLOBAL, 1, \
_ELF_DEFINE_STB(STB_WEAK, 2, \
"visible across all object files but with low precedence") \
_ELF_DEFINE_STB(STB_LOOS, 10, "start of OS-specific range") \
+_ELF_DEFINE_STB(STB_GNU_UNIQUE, 10, "unique symbol (GNU)") \
_ELF_DEFINE_STB(STB_HIOS, 12, "end of OS-specific range") \
_ELF_DEFINE_STB(STB_LOPROC, 13, \
"start of processor-specific range") \
@@ -1259,6 +1260,7 @@ _ELF_DEFINE_STT(STT_LOPROC, 13, \
"start of processor-specific types") \
_ELF_DEFINE_STT(STT_ARM_TFUNC, 13, "Thumb function (GNU)") \
_ELF_DEFINE_STT(STT_ARM_16BIT, 15, "Thumb label (GNU)") \
+_ELF_DEFINE_STT(STT_SPARC_REGISTER, 13, "SPARC register information") \
_ELF_DEFINE_STT(STT_HIPROC, 15, \
"end of processor-specific types")
@@ -1395,7 +1397,7 @@ _ELF_DEFINE_RELOC(R_386_GOT32, 3) \
_ELF_DEFINE_RELOC(R_386_PLT32, 4) \
_ELF_DEFINE_RELOC(R_386_COPY, 5) \
_ELF_DEFINE_RELOC(R_386_GLOB_DAT, 6) \
-_ELF_DEFINE_RELOC(R_386_JMP_SLOT, 7) \
+_ELF_DEFINE_RELOC(R_386_JUMP_SLOT, 7) \
_ELF_DEFINE_RELOC(R_386_RELATIVE, 8) \
_ELF_DEFINE_RELOC(R_386_GOTOFF, 9) \
_ELF_DEFINE_RELOC(R_386_GOTPC, 10) \
@@ -1407,9 +1409,129 @@ _ELF_DEFINE_RELOC(R_386_PC8, 23)
/*
*/
-#define _ELF_DEFINE_AARCH64_RELOCATIONS() \
-_ELF_DEFINE_RELOC(R_AARCH64_ABS64, 257) \
-_ELF_DEFINE_RELOC(R_AARCH64_ABS32, 258) \
+#define _ELF_DEFINE_AARCH64_RELOCATIONS() \
+_ELF_DEFINE_RELOC(R_AARCH64_NONE, 0) \
+_ELF_DEFINE_RELOC(R_AARCH64_ABS64, 257) \
+_ELF_DEFINE_RELOC(R_AARCH64_ABS32, 258) \
+_ELF_DEFINE_RELOC(R_AARCH64_ABS16, 259) \
+_ELF_DEFINE_RELOC(R_AARCH64_PREL64, 260) \
+_ELF_DEFINE_RELOC(R_AARCH64_PREL32, 261) \
+_ELF_DEFINE_RELOC(R_AARCH64_PREL16, 262) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G0, 263) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G0_NC, 264) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G1, 265) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G1_NC, 266) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G2, 267) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G2_NC, 268) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G3, 269) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_SABS_G0, 270) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_SABS_G1, 271) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_SABS_G2, 272) \
+_ELF_DEFINE_RELOC(R_AARCH64_LD_PREL_LO19, 273) \
+_ELF_DEFINE_RELOC(R_AARCH64_ADR_PREL_LO21, 274) \
+_ELF_DEFINE_RELOC(R_AARCH64_ADR_PREL_PG_HI21, 275) \
+_ELF_DEFINE_RELOC(R_AARCH64_ADR_PREL_PG_HI21_NC, 276) \
+_ELF_DEFINE_RELOC(R_AARCH64_ADD_ABS_LO12_NC, 277) \
+_ELF_DEFINE_RELOC(R_AARCH64_LDST8_ABS_LO12_NC, 278) \
+_ELF_DEFINE_RELOC(R_AARCH64_TSTBR14, 279) \
+_ELF_DEFINE_RELOC(R_AARCH64_CONDBR19, 280) \
+_ELF_DEFINE_RELOC(R_AARCH64_JUMP26, 282) \
+_ELF_DEFINE_RELOC(R_AARCH64_CALL26, 283) \
+_ELF_DEFINE_RELOC(R_AARCH64_LDST16_ABS_LO12_NC, 284) \
+_ELF_DEFINE_RELOC(R_AARCH64_LDST32_ABS_LO12_NC, 285) \
+_ELF_DEFINE_RELOC(R_AARCH64_LDST64_ABS_LO12_NC, 286) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G0, 287) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G0_NC, 288) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G1, 289) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G1_NC, 290) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G2, 291) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G2_NC, 292) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G3, 293) \
+_ELF_DEFINE_RELOC(R_AARCH64_LDST128_ABS_LO12_NC, 299) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G0, 300) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G0_NC, 301) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G1, 302) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G1_NC, 303) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G2, 304) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G2_NC, 305) \
+_ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G3, 306) \
+_ELF_DEFINE_RELOC(R_AARCH64_GOTREL64, 307) \
+_ELF_DEFINE_RELOC(R_AARCH64_GOTREL32, 308) \
+_ELF_DEFINE_RELOC(R_AARCH64_GOT_LD_PREL19, 309) \
+_ELF_DEFINE_RELOC(R_AARCH64_LD64_GOTOFF_LO15, 310) \
+_ELF_DEFINE_RELOC(R_AARCH64_ADR_GOT_PAGE, 311) \
+_ELF_DEFINE_RELOC(R_AARCH64_LD64_GOT_LO12_NC, 312) \
+_ELF_DEFINE_RELOC(R_AARCH64_LD64_GOTPAGE_LO15, 313) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSGD_ADR_PREL21, 512) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSGD_ADR_PAGE21, 513) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSGD_ADD_LO12_NC, 514) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSGD_MOVW_G1, 515) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSGD_MOVW_G0_NC, 516) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_ADR_PREL21, 517) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_ADR_PAGE21, 518) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_ADD_LO12_NC, 519) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_G1, 520) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_G0_NC, 521) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LD_PREL19, 522) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G2, 523) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G1, 524) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC, 525) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G0, 526) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC, 527) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_ADD_DTPREL_HI12, 529) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC, 530) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST8_DTPREL_LO12, 531) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC, 532) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST16_DTPREL_LO12, 533) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC, 534) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST32_DTPREL_LO12, 535) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC, 536) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST64_DTPREL_LO12, 537) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC, 538) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSIE_MOVW_GOTTPREL_G1, 539) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC, 540) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21, 541) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC, 542) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSIE_LD_GOTTPREL_PREL19, 543) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G2, 544) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G1, 545) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G1_NC, 546) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G0, 547) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G0_NC, 548) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_ADD_TPREL_HI12, 549) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_ADD_TPREL_LO12, 550) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_ADD_TPREL_LO12_NC, 551) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST8_TPREL_LO12, 552) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC, 553) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST16_TPREL_LO12, 554) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC, 555) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST32_TPREL_LO12, 556) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC, 557) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST64_TPREL_LO12, 558) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC, 559) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_LD_PREL19, 560) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_ADR_PREL21, 561) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_ADR_PAGE21, 562) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_LD64_LO12, 563) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_ADD_LO12, 564) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_OFF_G1, 565) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_OFF_G0_NC, 566) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_LDR, 567) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_ADD, 568) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_CALL, 569) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST128_TPREL_LO12, 570) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC, 571) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST128_DTPREL_LO12, 572) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC, 573) \
+_ELF_DEFINE_RELOC(R_AARCH64_COPY, 1024) \
+_ELF_DEFINE_RELOC(R_AARCH64_GLOB_DAT, 1025) \
+_ELF_DEFINE_RELOC(R_AARCH64_JUMP_SLOT, 1026) \
+_ELF_DEFINE_RELOC(R_AARCH64_RELATIVE, 1027) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLS_DTPREL64, 1028) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLS_DTPMOD64, 1029) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLS_TPREL64, 1030) \
+_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC, 1031) \
+_ELF_DEFINE_RELOC(R_AARCH64_IRELATIVE, 1032)
/*
* These are the symbols used in the Sun ``Linkers and Loaders
@@ -1633,7 +1755,7 @@ _ELF_DEFINE_RELOC(R_IA_64_LTV32MSB, 0x74) \
_ELF_DEFINE_RELOC(R_IA_64_LTV32LSB, 0x75) \
_ELF_DEFINE_RELOC(R_IA_64_LTV64MSB, 0x76) \
_ELF_DEFINE_RELOC(R_IA_64_LTV64LSB, 0x77) \
-_ELF_DEFINE_RELOC(R_IA_64_PCREL21BIa, 0x79) \
+_ELF_DEFINE_RELOC(R_IA_64_PCREL21BI, 0x79) \
_ELF_DEFINE_RELOC(R_IA_64_PCREL22, 0x7A) \
_ELF_DEFINE_RELOC(R_IA_64_PCREL64I, 0x7B) \
_ELF_DEFINE_RELOC(R_IA_64_IPLTMSB, 0x80) \
@@ -1723,7 +1845,7 @@ _ELF_DEFINE_RELOC(R_PPC_REL32, 26) \
_ELF_DEFINE_RELOC(R_PPC_PLT32, 27) \
_ELF_DEFINE_RELOC(R_PPC_PLTREL32, 28) \
_ELF_DEFINE_RELOC(R_PPC_PLT16_LO, 29) \
-_ELF_DEFINE_RELOC(R_PPL_PLT16_HI, 30) \
+_ELF_DEFINE_RELOC(R_PPC_PLT16_HI, 30) \
_ELF_DEFINE_RELOC(R_PPC_PLT16_HA, 31) \
_ELF_DEFINE_RELOC(R_PPC_SDAREL16, 32) \
_ELF_DEFINE_RELOC(R_PPC_SECTOFF, 33) \
@@ -1926,7 +2048,7 @@ _ELF_DEFINE_RELOC(R_RISCV_SUB32, 39) \
_ELF_DEFINE_RELOC(R_RISCV_SUB64, 40) \
_ELF_DEFINE_RELOC(R_RISCV_GNU_VTINHERIT, 41) \
_ELF_DEFINE_RELOC(R_RISCV_GNU_VTENTRY, 42) \
-_ELF_DEFINE_RELOC(R_RISCV_ALIGN 43) \
+_ELF_DEFINE_RELOC(R_RISCV_ALIGN, 43) \
_ELF_DEFINE_RELOC(R_RISCV_RVC_BRANCH, 44) \
_ELF_DEFINE_RELOC(R_RISCV_RVC_JUMP, 45)
@@ -2042,6 +2164,7 @@ _ELF_DEFINE_IA64_RELOCATIONS() \
_ELF_DEFINE_MIPS_RELOCATIONS() \
_ELF_DEFINE_PPC32_RELOCATIONS() \
_ELF_DEFINE_PPC64_RELOCATIONS() \
+_ELF_DEFINE_RISCV_RELOCATIONS() \
_ELF_DEFINE_SPARC_RELOCATIONS() \
_ELF_DEFINE_X86_64_RELOCATIONS()
diff --git a/common/native-elf-format b/common/native-elf-format
index d36ab53806de..2bdd914c3052 100755
--- a/common/native-elf-format
+++ b/common/native-elf-format
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $Id: native-elf-format 3186 2015-04-16 22:16:40Z emaste $
+# $Id: native-elf-format 3293 2016-01-07 19:26:27Z emaste $
#
# Find the native ELF format for a host platform by compiling a
# test object and examining the resulting object.
@@ -33,6 +33,8 @@ $1 ~ "Data:" {
$1 ~ "Machine:" {
if (match($0, "Intel.*386")) {
elfarch = "EM_386";
+ } else if (match($0, "MIPS")) {
+ elfarch = "EM_MIPS";
} else if (match($0, ".*[xX]86-64")) {
elfarch = "EM_X86_64";
} else {
diff --git a/cxxfilt/cxxfilt.c b/cxxfilt/cxxfilt.c
index 4efa45b33f22..9318c64f151f 100644
--- a/cxxfilt/cxxfilt.c
+++ b/cxxfilt/cxxfilt.c
@@ -35,7 +35,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: cxxfilt.c 3174 2015-03-27 17:13:41Z emaste $");
+ELFTC_VCSID("$Id: cxxfilt.c 3356 2016-01-22 22:31:38Z jkoshy $");
#define STRBUFSZ 8192
@@ -112,11 +112,11 @@ find_format(const char *fstr)
}
static char *
-demangle(char *name, int strict, int *pos)
+demangle(char *name, int strict, size_t *pos)
{
static char dem[STRBUFSZ];
char nb[STRBUFSZ];
- int p, t;
+ size_t p, t;
if (stripus && *name == '_') {
strncpy(nb, name + 1, sizeof(nb) - 1);
@@ -128,10 +128,10 @@ demangle(char *name, int strict, int *pos)
nb[sizeof(nb) - 1] = '\0';
p = strlen(nb);
- if (p <= 0)
+ if (p == 0)
return NULL;
- while (elftc_demangle(nb, dem, sizeof(dem), format) < 0) {
+ while (elftc_demangle(nb, dem, sizeof(dem), (unsigned) format) < 0) {
if (!strict && p > 1) {
nb[--p] = '\0';
continue;
@@ -149,7 +149,8 @@ int
main(int argc, char **argv)
{
char *dem, buf[STRBUFSZ];
- int c, i, p, s, opt;
+ size_t i, p, s;
+ int c, n, opt;
while ((opt = getopt_long(argc, argv, "_nps:V", longopts, NULL)) !=
-1) {
@@ -182,9 +183,9 @@ main(int argc, char **argv)
argc -= optind;
if (*argv != NULL) {
- for (i = 0; i < argc; i++) {
- if ((dem = demangle(argv[i], 1, NULL)) == NULL)
- fprintf(stderr, "Failed: %s\n", argv[i]);
+ for (n = 0; n < argc; n++) {
+ if ((dem = demangle(argv[n], 1, NULL)) == NULL)
+ fprintf(stderr, "Failed: %s\n", argv[n]);
else
printf("%s\n", dem);
}
@@ -213,7 +214,7 @@ main(int argc, char **argv)
if ((size_t) p >= sizeof(buf) - 1)
warnx("buffer overflowed");
else
- buf[p++] = c;
+ buf[p++] = (char) c;
}
}
diff --git a/elfcopy/Makefile b/elfcopy/Makefile
index cb1a31b400ee..8b208e0ff467 100644
--- a/elfcopy/Makefile
+++ b/elfcopy/Makefile
@@ -1,10 +1,13 @@
-# $Id: Makefile 2290 2011-12-04 07:20:46Z jkoshy $
+# $Id: Makefile 3381 2016-01-30 19:39:47Z jkoshy $
TOP= ..
+.include "${TOP}/mk/elftoolchain.components.mk"
+
PROG= elfcopy
-SRCS= archive.c ascii.c binary.c main.c sections.c segments.c symbols.c
+SRCS= archive.c ascii.c binary.c main.c sections.c segments.c \
+ symbols.c
WARNS?= 5
@@ -15,14 +18,24 @@ LDADD= -lelf -lelftc
LDADD+= -larchive
.endif
+.if defined(WITH_PE) && ${WITH_PE:tl} == "yes"
+SRCS+= pe.c
+CFLAGS+= -DWITH_PE=1
+
+DPADD+= ${LIBPE}
+LDADD+= -lpe
+.endif
+
MAN= elfcopy.1 mcs.1 strip.1
+MLINKS= elfcopy.1 objcopy.1
NO_SHARED?= yes
-LINKS= ${BINDIR}/elfcopy ${BINDIR}/strip \
- ${BINDIR}/elfcopy ${BINDIR}/mcs
+LINKS= ${BINDIR}/elfcopy ${BINDIR}/mcs \
+ ${BINDIR}/elfcopy ${BINDIR}/objcopy \
+ ${BINDIR}/elfcopy ${BINDIR}/strip
-EXTRA_TARGETS= strip mcs
+EXTRA_TARGETS= mcs strip objcopy
CLEANFILES+= ${EXTRA_TARGETS}
diff --git a/elfcopy/archive.c b/elfcopy/archive.c
index 682a1df66dcc..97e2498a66ff 100644
--- a/elfcopy/archive.c
+++ b/elfcopy/archive.c
@@ -38,7 +38,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: archive.c 3174 2015-03-27 17:13:41Z emaste $");
+ELFTC_VCSID("$Id: archive.c 3287 2015-12-31 16:58:48Z emaste $");
#define _ARMAG_LEN 8 /* length of ar magic string */
#define _ARHDR_LEN 60 /* length of ar header */
@@ -382,7 +382,7 @@ ac_read_objs(struct elfcopy *ecp, int ifd)
if (lseek(ifd, 0, SEEK_SET) == -1)
err(EXIT_FAILURE, "lseek failed");
if ((a = archive_read_new()) == NULL)
- errx(EXIT_FAILURE, "%s", archive_error_string(a));
+ errx(EXIT_FAILURE, "archive_read_new failed");
archive_read_support_format_ar(a);
AC(archive_read_open_fd(a, ifd, 10240));
for(;;) {
@@ -443,7 +443,7 @@ ac_write_objs(struct elfcopy *ecp, int ofd)
int nr;
if ((a = archive_write_new()) == NULL)
- errx(EXIT_FAILURE, "%s", archive_error_string(a));
+ errx(EXIT_FAILURE, "archive_write_new failed");
archive_write_set_format_ar_svr4(a);
AC(archive_write_open_fd(a, ofd));
diff --git a/elfcopy/elfcopy.1 b/elfcopy/elfcopy.1
index 83cda5d8c5f7..b7b0ce48dfa1 100644
--- a/elfcopy/elfcopy.1
+++ b/elfcopy/elfcopy.1
@@ -21,13 +21,14 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
-.\" $Id: elfcopy.1 3266 2015-12-07 15:38:26Z emaste $
+.\" $Id: elfcopy.1 3381 2016-01-30 19:39:47Z jkoshy $
.\"
-.Dd December 7, 2015
+.Dd January 29, 2016
.Os
.Dt ELFCOPY 1
.Sh NAME
-.Nm elfcopy
+.Nm elfcopy ,
+.Nm objcopy
.Nd copy and translate object files
.Sh SYNOPSIS
.Nm
@@ -85,7 +86,7 @@
.Sh DESCRIPTION
The
.Nm
-utility copies the content of the ELF object named by argument
+utility copies the content of the binary object named by argument
.Ar infile
to that named by argument
.Ar outfile ,
@@ -121,6 +122,10 @@ to the output.
.It Fl O Ar objformat | Fl -output-target= Ns Ar objformat
Write the output file using the object format specified in argument
.Ar objformat .
+The argument
+.Ar objformat
+should be one of the target names recognized by
+.Xr elftc_bfd_find_target 3 .
.It Fl R Ar sectionname | Fl -remove-section= Ns Ar sectionname
Remove any section with name
.Ar sectionname
@@ -330,8 +335,14 @@ Do not copy symbols that are not needed for relocation processing.
.Xr mcs 1 ,
.Xr strip 1 ,
.Xr elf 3 ,
+.Xr elftc_bfd_find_target 3 ,
.Xr ar 5 ,
.Xr elf 5
+.Sh COMPATIBILITY
+The
+.Nm
+utility is expected to be option compatible with GNU
+.Nm objcopy .
.Sh HISTORY
.Nm
has been implemented by
diff --git a/elfcopy/elfcopy.h b/elfcopy/elfcopy.h
index 48574b55c65b..614c0e7e65bd 100644
--- a/elfcopy/elfcopy.h
+++ b/elfcopy/elfcopy.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: elfcopy.h 3221 2015-05-24 23:42:43Z kaiwang27 $
+ * $Id: elfcopy.h 3310 2016-01-10 09:10:54Z kaiwang27 $
*/
#include <sys/queue.h>
@@ -287,6 +287,7 @@ struct section *create_external_section(struct elfcopy *_ecp, const char *_name,
int _loadable);
void create_external_symtab(struct elfcopy *_ecp);
void create_ihex(int _ifd, int _ofd);
+void create_pe(struct elfcopy *_ecp, int _ifd, int _ofd);
void create_scn(struct elfcopy *_ecp);
void create_srec(struct elfcopy *_ecp, int _ifd, int _ofd, const char *_ofn);
void create_symtab(struct elfcopy *_ecp);
diff --git a/elfcopy/main.c b/elfcopy/main.c
index e2685b476573..205466976a26 100644
--- a/elfcopy/main.c
+++ b/elfcopy/main.c
@@ -39,7 +39,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: main.c 3268 2015-12-07 20:30:55Z emaste $");
+ELFTC_VCSID("$Id: main.c 3381 2016-01-30 19:39:47Z jkoshy $");
enum options
{
@@ -722,6 +722,15 @@ create_file(struct elfcopy *ecp, const char *src, const char *dst)
create_srec(ecp, ofd, ofd0,
dst != NULL ? dst : src);
break;
+ case ETF_PE:
+ case ETF_EFI:
+#if WITH_PE
+ create_pe(ecp, ofd, ofd0);
+#else
+ errx(EXIT_FAILURE, "PE/EFI support not enabled"
+ " at compile time");
+#endif
+ break;
default:
errx(EXIT_FAILURE, "Internal: unsupported"
" output flavour %d", ecp->oec);
@@ -1345,6 +1354,9 @@ set_output_target(struct elfcopy *ecp, const char *target_name)
ecp->oed = elftc_bfd_target_byteorder(tgt);
ecp->oem = elftc_bfd_target_machine(tgt);
}
+ if (ecp->otf == ETF_EFI || ecp->otf == ETF_PE)
+ ecp->oem = elftc_bfd_target_machine(tgt);
+
ecp->otgt = target_name;
}
@@ -1366,7 +1378,7 @@ set_osabi(struct elfcopy *ecp, const char *abi)
#define ELFCOPY_USAGE_MESSAGE "\
Usage: %s [options] infile [outfile]\n\
- Transform an ELF object.\n\n\
+ Transform object files.\n\n\
Options:\n\
-d | -g | --strip-debug Remove debugging information from the output.\n\
-j SECTION | --only-section=SECTION\n\
@@ -1382,6 +1394,8 @@ Usage: %s [options] infile [outfile]\n\
-N SYM | --strip-symbol=SYM Do not copy symbol SYM to the output.\n\
-O FORMAT | --output-target=FORMAT\n\
Specify object format for the output file.\n\
+ FORMAT should be a target name understood by\n\
+ elftc_bfd_find_target(3).\n\
-R NAME | --remove-section=NAME\n\
Remove the named section.\n\
-S | --strip-all Remove all symbol and relocation information\n\
diff --git a/elfcopy/pe.c b/elfcopy/pe.c
new file mode 100644
index 000000000000..0d075c5c93c2
--- /dev/null
+++ b/elfcopy/pe.c
@@ -0,0 +1,233 @@
+/*-
+ * Copyright (c) 2016 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <err.h>
+#include <gelf.h>
+#include <libpe.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include "elfcopy.h"
+
+ELFTC_VCSID("$Id: pe.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+/* Convert ELF object to Portable Executable (PE). */
+void
+create_pe(struct elfcopy *ecp, int ifd, int ofd)
+{
+ Elf *e;
+ Elf_Scn *scn;
+ Elf_Data *d;
+ GElf_Ehdr eh;
+ GElf_Shdr sh;
+ PE *pe;
+ PE_Scn *ps;
+ PE_SecHdr psh;
+ PE_CoffHdr pch;
+ PE_OptHdr poh;
+ PE_Object po;
+ PE_Buffer *pb;
+ const char *name;
+ size_t indx;
+ int elferr, i;
+
+ if (ecp->otf == ETF_EFI || ecp->oem == EM_X86_64)
+ po = PE_O_PE32P;
+ else
+ po = PE_O_PE32;
+
+ if ((e = elf_begin(ifd, ELF_C_READ, NULL)) == NULL)
+ errx(EXIT_FAILURE, "elf_begin() failed: %s",
+ elf_errmsg(-1));
+
+ if (gelf_getehdr(e, &eh) == NULL)
+ errx(EXIT_FAILURE, "gelf_getehdr() failed: %s",
+ elf_errmsg(-1));
+
+ if (elf_getshstrndx(ecp->ein, &indx) == 0)
+ errx(EXIT_FAILURE, "elf_getshstrndx() failed: %s",
+ elf_errmsg(-1));
+
+ if ((pe = pe_init(ofd, PE_C_WRITE, po)) == NULL)
+ err(EXIT_FAILURE, "pe_init() failed");
+
+ /* Setup PE COFF header. */
+ memset(&pch, 0, sizeof(pch));
+ switch (ecp->oem) {
+ case EM_386:
+ pch.ch_machine = IMAGE_FILE_MACHINE_I386;
+ break;
+ case EM_X86_64:
+ pch.ch_machine = IMAGE_FILE_MACHINE_AMD64;
+ break;
+ default:
+ pch.ch_machine = IMAGE_FILE_MACHINE_UNKNOWN;
+ break;
+ }
+ pch.ch_timestamp = (uint32_t) time(NULL);
+ if (pe_update_coff_header(pe, &pch) < 0)
+ err(EXIT_FAILURE, "pe_update_coff_header() failed");
+
+ /* Setup PE optional header. */
+ memset(&poh, 0, sizeof(poh));
+ if (ecp->otf == ETF_EFI)
+ poh.oh_subsystem = IMAGE_SUBSYSTEM_EFI_APPLICATION;
+ poh.oh_entry = (uint32_t) eh.e_entry;
+
+ /*
+ * Default section alignment and file alignment. (Here the
+ * section alignment is set to the default page size of the
+ * archs supported. We should use different section alignment
+ * for some arch. (e.g. IA64)
+ */
+ poh.oh_secalign = 0x1000;
+ poh.oh_filealign = 0x200;
+
+ /* Copy sections. */
+ scn = NULL;
+ while ((scn = elf_nextscn(e, scn)) != NULL) {
+
+ /*
+ * Read in ELF section.
+ */
+
+ if (gelf_getshdr(scn, &sh) == NULL) {
+ warnx("gelf_getshdr() failed: %s", elf_errmsg(-1));
+ (void) elf_errno();
+ continue;
+ }
+ if ((name = elf_strptr(ecp->ein, indx, sh.sh_name)) ==
+ NULL) {
+ warnx("elf_strptr() failed: %s", elf_errmsg(-1));
+ (void) elf_errno();
+ continue;
+ }
+
+ /* Skip sections unneeded. */
+ if (strcmp(name, ".shstrtab") == 0 ||
+ strcmp(name, ".symtab") == 0 ||
+ strcmp(name, ".strtab") == 0)
+ continue;
+
+ if ((d = elf_getdata(scn, NULL)) == NULL) {
+ warnx("elf_getdata() failed: %s", elf_errmsg(-1));
+ (void) elf_errno();
+ continue;
+ }
+
+ if (strcmp(name, ".text") == 0) {
+ poh.oh_textbase = (uint32_t) sh.sh_addr;
+ poh.oh_textsize = (uint32_t) roundup(sh.sh_size,
+ poh.oh_filealign);
+ } else {
+ if (po == PE_O_PE32 && strcmp(name, ".data") == 0)
+ poh.oh_database = sh.sh_addr;
+ if (sh.sh_type == SHT_NOBITS)
+ poh.oh_bsssize += (uint32_t)
+ roundup(sh.sh_size, poh.oh_filealign);
+ else if (sh.sh_flags & SHF_ALLOC)
+ poh.oh_datasize += (uint32_t)
+ roundup(sh.sh_size, poh.oh_filealign);
+ }
+
+ /*
+ * Create PE/COFF section.
+ */
+
+ if ((ps = pe_newscn(pe)) == NULL) {
+ warn("pe_newscn() failed");
+ continue;
+ }
+
+ /*
+ * Setup PE/COFF section header. The section name is not
+ * NUL-terminated if its length happens to be 8. Long
+ * section name should be truncated for PE image according
+ * to the PE/COFF specification.
+ */
+ memset(&psh, 0, sizeof(psh));
+ strncpy(psh.sh_name, name, sizeof(psh.sh_name));
+ psh.sh_addr = sh.sh_addr;
+ psh.sh_virtsize = sh.sh_size;
+ if (sh.sh_type != SHT_NOBITS)
+ psh.sh_rawsize = sh.sh_size;
+ else
+ psh.sh_char |= IMAGE_SCN_CNT_UNINITIALIZED_DATA;
+
+ /*
+ * Translate ELF section flags to PE/COFF section flags.
+ */
+ psh.sh_char |= IMAGE_SCN_MEM_READ;
+ if (sh.sh_flags & SHF_WRITE)
+ psh.sh_char |= IMAGE_SCN_MEM_WRITE;
+ if (sh.sh_flags & SHF_EXECINSTR)
+ psh.sh_char |= IMAGE_SCN_MEM_EXECUTE |
+ IMAGE_SCN_CNT_CODE;
+ if ((sh.sh_flags & SHF_ALLOC) && (psh.sh_char & 0xF0) == 0)
+ psh.sh_char |= IMAGE_SCN_CNT_INITIALIZED_DATA;
+ for (i = 0xE; i > 0; i--) {
+ if (sh.sh_addralign & (1U << (i - 1))) {
+ psh.sh_char |= i << 20;
+ break;
+ }
+ }
+
+ /* Mark relocation section "discardable". */
+ if (strcmp(name, ".reloc") == 0)
+ psh.sh_char |= IMAGE_SCN_MEM_DISCARDABLE;
+
+ if (pe_update_section_header(ps, &psh) < 0) {
+ warn("pe_update_section_header() failed");
+ continue;
+ }
+
+ /* Copy section content. */
+ if ((pb = pe_newbuffer(ps)) == NULL) {
+ warn("pe_newbuffer() failed");
+ continue;
+ }
+ pb->pb_align = 1;
+ pb->pb_off = 0;
+ pb->pb_size = sh.sh_size;
+ pb->pb_buf = d->d_buf;
+ }
+ elferr = elf_errno();
+ if (elferr != 0)
+ warnx("elf_nextscn() failed: %s", elf_errmsg(elferr));
+
+ /* Update PE optional header. */
+ if (pe_update_opt_header(pe, &poh) < 0)
+ err(EXIT_FAILURE, "pe_update_opt_header() failed");
+
+ /* Write out PE/COFF object. */
+ if (pe_update(pe) < 0)
+ err(EXIT_FAILURE, "pe_update() failed");
+
+ pe_finish(pe);
+ elf_end(e);
+}
diff --git a/elfcopy/sections.c b/elfcopy/sections.c
index 0c18171752be..ff41015faeef 100644
--- a/elfcopy/sections.c
+++ b/elfcopy/sections.c
@@ -34,7 +34,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: sections.c 3272 2015-12-11 20:00:54Z kaiwang27 $");
+ELFTC_VCSID("$Id: sections.c 3346 2016-01-17 20:09:15Z kaiwang27 $");
static void add_gnu_debuglink(struct elfcopy *ecp);
static uint32_t calc_crc32(const char *p, size_t len, uint32_t crc);
@@ -223,6 +223,7 @@ static int
is_debug_section(const char *name)
{
const char *dbg_sec[] = {
+ ".apple_",
".debug",
".gnu.linkonce.wi.",
".line",
@@ -369,7 +370,7 @@ create_scn(struct elfcopy *ecp)
is = NULL;
while ((is = elf_nextscn(ecp->ein, is)) != NULL) {
if (gelf_getshdr(is, &ish) == NULL)
- errx(EXIT_FAILURE, "219 gelf_getshdr failed: %s",
+ errx(EXIT_FAILURE, "gelf_getshdr failed: %s",
elf_errmsg(-1));
if ((name = elf_strptr(ecp->ein, indx, ish.sh_name)) == NULL)
errx(EXIT_FAILURE, "elf_strptr failed: %s",
@@ -416,12 +417,19 @@ create_scn(struct elfcopy *ecp)
* is loadable, but if user explicitly set section flags
* while neither "load" nor "alloc" is set, we make the
* section unloadable.
+ *
+ * Sections in relocatable object is loadable if
+ * section flag SHF_ALLOC is set.
*/
if (sec_flags &&
(sec_flags & (SF_LOAD | SF_ALLOC)) == 0)
s->loadable = 0;
- else
+ else {
s->loadable = add_to_inseg_list(ecp, s);
+ if ((ecp->flags & RELOCATABLE) &&
+ (ish.sh_flags & SHF_ALLOC))
+ s->loadable = 1;
+ }
} else {
/* Assuming .shstrtab is "unloadable". */
s = ecp->shstrtab;
@@ -872,10 +880,10 @@ resync_sections(struct elfcopy *ecp)
if (s->align == 0)
s->align = 1;
if (off <= s->off) {
- if (!s->loadable)
+ if (!s->loadable || (ecp->flags & RELOCATABLE))
s->off = roundup(off, s->align);
} else {
- if (s->loadable)
+ if (s->loadable && (ecp->flags & RELOCATABLE) == 0)
warnx("moving loadable section %s, "
"is this intentional?", s->name);
s->off = roundup(off, s->align);
@@ -1025,8 +1033,11 @@ print_section(struct section *s)
print_data(s->buf, s->sz);
} else {
id = NULL;
- while ((id = elf_getdata(s->is, id)) != NULL)
+ while ((id = elf_getdata(s->is, id)) != NULL ||
+ (id = elf_rawdata(s->is, id)) != NULL) {
+ (void) elf_errno();
print_data(id->d_buf, id->d_size);
+ }
elferr = elf_errno();
if (elferr != 0)
errx(EXIT_FAILURE, "elf_getdata() failed: %s",
@@ -1046,7 +1057,9 @@ read_section(struct section *s, size_t *size)
sz = 0;
b = NULL;
id = NULL;
- while ((id = elf_getdata(s->is, id)) != NULL) {
+ while ((id = elf_getdata(s->is, id)) != NULL ||
+ (id = elf_rawdata(s->is, id)) != NULL) {
+ (void) elf_errno();
if (b == NULL)
b = malloc(id->d_size);
else
@@ -1074,10 +1087,10 @@ copy_shdr(struct elfcopy *ecp, struct section *s, const char *name, int copy,
GElf_Shdr ish, osh;
if (gelf_getshdr(s->is, &ish) == NULL)
- errx(EXIT_FAILURE, "526 gelf_getshdr() failed: %s",
+ errx(EXIT_FAILURE, "gelf_getshdr() failed: %s",
elf_errmsg(-1));
if (gelf_getshdr(s->os, &osh) == NULL)
- errx(EXIT_FAILURE, "529 gelf_getshdr() failed: %s",
+ errx(EXIT_FAILURE, "gelf_getshdr() failed: %s",
elf_errmsg(-1));
if (copy)
@@ -1094,19 +1107,32 @@ copy_shdr(struct elfcopy *ecp, struct section *s, const char *name, int copy,
if (sec_flags) {
osh.sh_flags = 0;
- if (sec_flags & SF_ALLOC) {
+ if (sec_flags & SF_ALLOC)
osh.sh_flags |= SHF_ALLOC;
- if (!s->loadable)
- warnx("set SHF_ALLOC flag for "
- "unloadable section %s",
- s->name);
- }
if ((sec_flags & SF_READONLY) == 0)
osh.sh_flags |= SHF_WRITE;
if (sec_flags & SF_CODE)
osh.sh_flags |= SHF_EXECINSTR;
+ if ((sec_flags & SF_CONTENTS) &&
+ s->type == SHT_NOBITS && s->sz > 0) {
+ /*
+ * Convert SHT_NOBITS section to section with
+ * (zero'ed) content on file.
+ */
+ osh.sh_type = s->type = SHT_PROGBITS;
+ if ((s->buf = calloc(1, s->sz)) == NULL)
+ err(EXIT_FAILURE, "malloc failed");
+ s->nocopy = 1;
+ }
} else {
osh.sh_flags = ish.sh_flags;
+ /*
+ * Newer binutils as(1) emits the section flag
+ * SHF_INFO_LINK for relocation sections. elfcopy
+ * emits this flag in the output section if it's
+ * missing in the input section, to remain compatible
+ * with binutils.
+ */
if (ish.sh_type == SHT_REL || ish.sh_type == SHT_RELA)
osh.sh_flags |= SHF_INFO_LINK;
}
@@ -1132,11 +1158,14 @@ copy_data(struct section *s)
return;
if ((id = elf_getdata(s->is, NULL)) == NULL) {
- elferr = elf_errno();
- if (elferr != 0)
- errx(EXIT_FAILURE, "elf_getdata() failed: %s",
- elf_errmsg(elferr));
- return;
+ (void) elf_errno();
+ if ((id = elf_rawdata(s->is, NULL)) == NULL) {
+ elferr = elf_errno();
+ if (elferr != 0)
+ errx(EXIT_FAILURE, "failed to read section:"
+ " %s", s->name);
+ return;
+ }
}
if ((od = elf_newdata(s->os)) == NULL)
@@ -1242,6 +1271,7 @@ insert_sections(struct elfcopy *ecp)
struct sec_add *sa;
struct section *s;
size_t off;
+ uint64_t stype;
/* Put these sections in the end of current list. */
off = 0;
@@ -1256,8 +1286,20 @@ insert_sections(struct elfcopy *ecp)
/* TODO: Add section header vma/lma, flag changes here */
+ /*
+ * The default section type for user added section is
+ * SHT_PROGBITS. If the section name match certain patterns,
+ * elfcopy will try to set a more appropriate section type.
+ * However, data type is always set to ELF_T_BYTE and no
+ * translation is performed by libelf.
+ */
+ stype = SHT_PROGBITS;
+ if (strcmp(sa->name, ".note") == 0 ||
+ strncmp(sa->name, ".note.", strlen(".note.")) == 0)
+ stype = SHT_NOTE;
+
(void) create_external_section(ecp, sa->name, NULL, sa->content,
- sa->size, off, SHT_PROGBITS, ELF_T_BYTE, 0, 1, 0, 0);
+ sa->size, off, stype, ELF_T_BYTE, 0, 1, 0, 0);
}
}
@@ -1282,7 +1324,7 @@ update_shdr(struct elfcopy *ecp, int update_link)
continue;
if (gelf_getshdr(s->os, &osh) == NULL)
- errx(EXIT_FAILURE, "668 gelf_getshdr failed: %s",
+ errx(EXIT_FAILURE, "gelf_getshdr failed: %s",
elf_errmsg(-1));
/* Find section name in string table and set sh_name. */
@@ -1361,7 +1403,7 @@ set_shstrtab(struct elfcopy *ecp)
}
if (gelf_getshdr(s->os, &sh) == NULL)
- errx(EXIT_FAILURE, "692 gelf_getshdr() failed: %s",
+ errx(EXIT_FAILURE, "gelf_getshdr() failed: %s",
elf_errmsg(-1));
sh.sh_addr = 0;
sh.sh_addralign = 1;
@@ -1428,14 +1470,17 @@ add_section(struct elfcopy *ecp, const char *arg)
if (stat(fn, &sb) == -1)
err(EXIT_FAILURE, "stat failed");
sa->size = sb.st_size;
- if ((sa->content = malloc(sa->size)) == NULL)
- err(EXIT_FAILURE, "malloc failed");
- if ((fp = fopen(fn, "r")) == NULL)
- err(EXIT_FAILURE, "can not open %s", fn);
- if (fread(sa->content, 1, sa->size, fp) == 0 ||
- ferror(fp))
- err(EXIT_FAILURE, "fread failed");
- fclose(fp);
+ if (sa->size > 0) {
+ if ((sa->content = malloc(sa->size)) == NULL)
+ err(EXIT_FAILURE, "malloc failed");
+ if ((fp = fopen(fn, "r")) == NULL)
+ err(EXIT_FAILURE, "can not open %s", fn);
+ if (fread(sa->content, 1, sa->size, fp) == 0 ||
+ ferror(fp))
+ err(EXIT_FAILURE, "fread failed");
+ fclose(fp);
+ } else
+ sa->content = NULL;
STAILQ_INSERT_TAIL(&ecp->v_sadd, sa, sadd_list);
ecp->flags |= SEC_ADD;
diff --git a/elfcopy/segments.c b/elfcopy/segments.c
index 837cea5fdbe5..c003c1343e3c 100644
--- a/elfcopy/segments.c
+++ b/elfcopy/segments.c
@@ -34,7 +34,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: segments.c 3269 2015-12-11 18:38:43Z kaiwang27 $");
+ELFTC_VCSID("$Id: segments.c 3340 2016-01-17 15:00:56Z kaiwang27 $");
static void insert_to_inseg_list(struct segment *seg, struct section *sec);
@@ -107,11 +107,11 @@ adjust_addr(struct elfcopy *ecp)
TAILQ_FOREACH(s, &ecp->v_sec, sec_list) {
/* Only adjust loadable section's address. */
- if (!s->loadable || s->seg == NULL)
+ if (!s->loadable)
continue;
/* Apply global LMA adjustment. */
- if (ecp->change_addr != 0)
+ if (ecp->change_addr != 0 && s->seg != NULL)
s->lma += ecp->change_addr;
if (!s->pseudo) {
@@ -135,7 +135,10 @@ adjust_addr(struct elfcopy *ecp)
*/
TAILQ_FOREACH(s, &ecp->v_sec, sec_list) {
- /* Only adjust loadable section's LMA. */
+ /*
+ * Only loadable section that's inside a segment can have
+ * LMA adjusted.
+ */
if (!s->loadable || s->seg == NULL)
continue;
@@ -173,7 +176,7 @@ adjust_addr(struct elfcopy *ecp)
if (lma % s->align != 0)
errx(EXIT_FAILURE, "The load address %#jx for "
"section %s is not aligned to %ju",
- (uintmax_t) lma, s->name, s->align);
+ (uintmax_t) lma, s->name, (uintmax_t) s->align);
if (lma < s->lma) {
/* Move section to lower address. */
@@ -214,7 +217,8 @@ adjust_addr(struct elfcopy *ecp)
continue;
errx(EXIT_FAILURE, "The extent of segment containing "
"section %s overlaps with segment(%#jx,%#jx)",
- s->name, seg->addr, seg->addr + seg->msz);
+ s->name, (uintmax_t) seg->addr,
+ (uintmax_t) (seg->addr + seg->msz));
}
/*
diff --git a/elfcopy/symbols.c b/elfcopy/symbols.c
index 05bcd7a8e2f8..ae6193c212fe 100644
--- a/elfcopy/symbols.c
+++ b/elfcopy/symbols.c
@@ -25,6 +25,7 @@
*/
#include <sys/param.h>
+#include <assert.h>
#include <err.h>
#include <fnmatch.h>
#include <stdio.h>
@@ -33,7 +34,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: symbols.c 3222 2015-05-24 23:47:23Z kaiwang27 $");
+ELFTC_VCSID("$Id: symbols.c 3376 2016-01-26 18:41:39Z emaste $");
/* Symbol table buffer structure. */
struct symbuf {
@@ -79,7 +80,6 @@ static int lookup_exact_string(hash_head *hash, const char *buf,
static int generate_symbols(struct elfcopy *ecp);
static void mark_reloc_symbols(struct elfcopy *ecp, size_t sc);
static void mark_section_group_symbols(struct elfcopy *ecp, size_t sc);
-static int match_wildcard(const char *name, const char *pattern);
uint32_t str_hash(const char *s);
/* Convenient bit vector operation macros. */
@@ -102,7 +102,8 @@ static int
is_global_symbol(unsigned char st_info)
{
- if (GELF_ST_BIND(st_info) == STB_GLOBAL)
+ if (GELF_ST_BIND(st_info) == STB_GLOBAL ||
+ GELF_ST_BIND(st_info) == STB_GNU_UNIQUE)
return (1);
return (0);
@@ -190,12 +191,6 @@ is_remove_symbol(struct elfcopy *ecp, size_t sc, int i, GElf_Sym *s,
SHN_UNDEF, /* st_shndx */
};
- if (lookup_symop_list(ecp, name, SYMOP_KEEP) != NULL)
- return (0);
-
- if (lookup_symop_list(ecp, name, SYMOP_STRIP) != NULL)
- return (1);
-
/*
* Keep the first symbol if it is the special reserved symbol.
* XXX Should we generate one if it's missing?
@@ -208,15 +203,34 @@ is_remove_symbol(struct elfcopy *ecp, size_t sc, int i, GElf_Sym *s,
ecp->secndx[s->st_shndx] == 0)
return (1);
+ /* Keep the symbol if specified by command line option -K. */
+ if (lookup_symop_list(ecp, name, SYMOP_KEEP) != NULL)
+ return (0);
+
if (ecp->strip == STRIP_ALL)
return (1);
+ /* Mark symbols used in relocation. */
if (ecp->v_rel == NULL)
mark_reloc_symbols(ecp, sc);
+ /* Mark symbols used in section groups. */
if (ecp->v_grp == NULL)
mark_section_group_symbols(ecp, sc);
+ /*
+ * Strip the symbol if specified by command line option -N,
+ * unless it's used in relocation.
+ */
+ if (lookup_symop_list(ecp, name, SYMOP_STRIP) != NULL) {
+ if (BIT_ISSET(ecp->v_rel, i)) {
+ warnx("not stripping symbol `%s' because it is named"
+ " in a relocation", name);
+ return (0);
+ }
+ return (1);
+ }
+
if (is_needed_symbol(ecp, i, s))
return (0);
@@ -565,8 +579,11 @@ generate_symbols(struct elfcopy *ecp)
* If the symbol is a STT_SECTION symbol, mark the section
* it points to.
*/
- if (GELF_ST_TYPE(sym.st_info) == STT_SECTION)
+ if (GELF_ST_TYPE(sym.st_info) == STT_SECTION &&
+ sym.st_shndx < SHN_LORESERVE) {
+ assert(ecp->secndx[sym.st_shndx] < (uint64_t)ecp->nos);
BIT_SET(ecp->v_secsym, ecp->secndx[sym.st_shndx]);
+ }
}
/*
@@ -861,6 +878,8 @@ add_to_symtab(struct elfcopy *ecp, const char *name, uint64_t st_value,
* It handles buffer growing, st_name calculating and st_shndx
* updating for symbols with non-special section index.
*/
+#define _ST_NAME_EMPTY_l 0
+#define _ST_NAME_EMPTY_g -1
#define _ADDSYM(B, SZ) do { \
if (sy_buf->B##SZ == NULL) { \
sy_buf->B##SZ = malloc(sy_buf->B##cap * \
@@ -920,7 +939,8 @@ add_to_symtab(struct elfcopy *ecp, const char *name, uint64_t st_value,
st_buf->B.sz += strlen(name) + 1; \
} \
} else \
- sy_buf->B##SZ[sy_buf->n##B##s].st_name = 0; \
+ sy_buf->B##SZ[sy_buf->n##B##s].st_name = \
+ (Elf##SZ##_Word)_ST_NAME_EMPTY_##B; \
sy_buf->n##B##s++; \
} while (0)
@@ -945,6 +965,8 @@ add_to_symtab(struct elfcopy *ecp, const char *name, uint64_t st_value,
ecp->strtab->sz = st_buf->l.sz + st_buf->g.sz;
#undef _ADDSYM
+#undef _ST_NAME_EMPTY_l
+#undef _ST_NAME_EMPTY_g
}
void
@@ -961,10 +983,17 @@ finalize_external_symtab(struct elfcopy *ecp)
sy_buf = ecp->symtab->buf;
st_buf = ecp->strtab->buf;
for (i = 0; (size_t) i < sy_buf->ngs; i++) {
- if (ecp->oec == ELFCLASS32)
- sy_buf->g32[i].st_name += st_buf->l.sz;
- else
- sy_buf->g64[i].st_name += st_buf->l.sz;
+ if (ecp->oec == ELFCLASS32) {
+ if (sy_buf->g32[i].st_name == (Elf32_Word)-1)
+ sy_buf->g32[i].st_name = 0;
+ else
+ sy_buf->g32[i].st_name += st_buf->l.sz;
+ } else {
+ if (sy_buf->g64[i].st_name == (Elf64_Word)-1)
+ sy_buf->g64[i].st_name = 0;
+ else
+ sy_buf->g64[i].st_name += st_buf->l.sz;
+ }
}
}
@@ -1105,46 +1134,47 @@ add_to_symop_list(struct elfcopy *ecp, const char *name, const char *newname,
{
struct symop *s;
- if ((s = lookup_symop_list(ecp, name, ~0U)) == NULL) {
- if ((s = calloc(1, sizeof(*s))) == NULL)
- errx(EXIT_FAILURE, "not enough memory");
- s->name = name;
- if (op == SYMOP_REDEF)
- s->newname = newname;
- }
+ assert (name != NULL);
+ STAILQ_FOREACH(s, &ecp->v_symop, symop_list)
+ if (!strcmp(name, s->name))
+ goto found;
- s->op |= op;
+ if ((s = calloc(1, sizeof(*s))) == NULL)
+ errx(EXIT_FAILURE, "not enough memory");
STAILQ_INSERT_TAIL(&ecp->v_symop, s, symop_list);
-}
-
-static int
-match_wildcard(const char *name, const char *pattern)
-{
- int reverse, match;
-
- reverse = 0;
- if (*pattern == '!') {
- reverse = 1;
- pattern++;
- }
-
- match = 0;
- if (!fnmatch(pattern, name, 0))
- match = 1;
-
- return (reverse ? !match : match);
+ s->name = name;
+found:
+ if (op == SYMOP_REDEF)
+ s->newname = newname;
+ s->op |= op;
}
struct symop *
lookup_symop_list(struct elfcopy *ecp, const char *name, unsigned int op)
{
- struct symop *s;
+ struct symop *s, *ret;
+ const char *pattern;
STAILQ_FOREACH(s, &ecp->v_symop, symop_list) {
- if (name == NULL || !strcmp(name, s->name) ||
- ((ecp->flags & WILDCARD) && match_wildcard(name, s->name)))
- if ((s->op & op) != 0)
+ if ((s->op & op) == 0)
+ continue;
+ if (name == NULL || !strcmp(name, s->name))
return (s);
+ if ((ecp->flags & WILDCARD) == 0)
+ continue;
+
+ /* Handle wildcards. */
+ pattern = s->name;
+ if (pattern[0] == '!') {
+ /* Negative match. */
+ pattern++;
+ ret = NULL;
+ } else {
+ /* Regular wildcard match. */
+ ret = s;
+ }
+ if (!fnmatch(pattern, name, 0))
+ return (ret);
}
return (NULL);
diff --git a/elfdump/elfdump.c b/elfdump/elfdump.c
index baf99eee1e90..334d2856190a 100644
--- a/elfdump/elfdump.c
+++ b/elfdump/elfdump.c
@@ -50,7 +50,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: elfdump.c 3250 2015-10-06 13:56:15Z emaste $");
+ELFTC_VCSID("$Id: elfdump.c 3391 2016-02-05 19:43:01Z emaste $");
#if defined(ELFTC_NEED_ELF_NOTE_DEFINITION)
#include "native-elf-format.h"
@@ -155,77 +155,82 @@ le32dec(const void *pp)
static const char *
d_tags(uint64_t tag)
{
+ static char unknown_buf[64];
+
switch (tag) {
- case 0: return "DT_NULL";
- case 1: return "DT_NEEDED";
- case 2: return "DT_PLTRELSZ";
- case 3: return "DT_PLTGOT";
- case 4: return "DT_HASH";
- case 5: return "DT_STRTAB";
- case 6: return "DT_SYMTAB";
- case 7: return "DT_RELA";
- case 8: return "DT_RELASZ";
- case 9: return "DT_RELAENT";
- case 10: return "DT_STRSZ";
- case 11: return "DT_SYMENT";
- case 12: return "DT_INIT";
- case 13: return "DT_FINI";
- case 14: return "DT_SONAME";
- case 15: return "DT_RPATH";
- case 16: return "DT_SYMBOLIC";
- case 17: return "DT_REL";
- case 18: return "DT_RELSZ";
- case 19: return "DT_RELENT";
- case 20: return "DT_PLTREL";
- case 21: return "DT_DEBUG";
- case 22: return "DT_TEXTREL";
- case 23: return "DT_JMPREL";
- case 24: return "DT_BIND_NOW";
- case 25: return "DT_INIT_ARRAY";
- case 26: return "DT_FINI_ARRAY";
- case 27: return "DT_INIT_ARRAYSZ";
- case 28: return "DT_FINI_ARRAYSZ";
- case 29: return "DT_RUNPATH";
- case 30: return "DT_FLAGS";
- case 32: return "DT_PREINIT_ARRAY"; /* XXX: DT_ENCODING */
- case 33: return "DT_PREINIT_ARRAYSZ";
+ case DT_NULL: return "DT_NULL";
+ case DT_NEEDED: return "DT_NEEDED";
+ case DT_PLTRELSZ: return "DT_PLTRELSZ";
+ case DT_PLTGOT: return "DT_PLTGOT";
+ case DT_HASH: return "DT_HASH";
+ case DT_STRTAB: return "DT_STRTAB";
+ case DT_SYMTAB: return "DT_SYMTAB";
+ case DT_RELA: return "DT_RELA";
+ case DT_RELASZ: return "DT_RELASZ";
+ case DT_RELAENT: return "DT_RELAENT";
+ case DT_STRSZ: return "DT_STRSZ";
+ case DT_SYMENT: return "DT_SYMENT";
+ case DT_INIT: return "DT_INIT";
+ case DT_FINI: return "DT_FINI";
+ case DT_SONAME: return "DT_SONAME";
+ case DT_RPATH: return "DT_RPATH";
+ case DT_SYMBOLIC: return "DT_SYMBOLIC";
+ case DT_REL: return "DT_REL";
+ case DT_RELSZ: return "DT_RELSZ";
+ case DT_RELENT: return "DT_RELENT";
+ case DT_PLTREL: return "DT_PLTREL";
+ case DT_DEBUG: return "DT_DEBUG";
+ case DT_TEXTREL: return "DT_TEXTREL";
+ case DT_JMPREL: return "DT_JMPREL";
+ case DT_BIND_NOW: return "DT_BIND_NOW";
+ case DT_INIT_ARRAY: return "DT_INIT_ARRAY";
+ case DT_FINI_ARRAY: return "DT_FINI_ARRAY";
+ case DT_INIT_ARRAYSZ: return "DT_INIT_ARRAYSZ";
+ case DT_FINI_ARRAYSZ: return "DT_FINI_ARRAYSZ";
+ case DT_RUNPATH: return "DT_RUNPATH";
+ case DT_FLAGS: return "DT_FLAGS";
+ case DT_PREINIT_ARRAY: return "DT_PREINIT_ARRAY"; /* XXX DT_ENCODING */
+ case DT_PREINIT_ARRAYSZ:return "DT_PREINIT_ARRAYSZ";
/* 0x6000000D - 0x6ffff000 operating system-specific semantics */
- case 0x6ffffdf5: return "DT_GNU_PRELINKED";
- case 0x6ffffdf6: return "DT_GNU_CONFLICTSZ";
- case 0x6ffffdf7: return "DT_GNU_LIBLISTSZ";
- case 0x6ffffdf8: return "DT_SUNW_CHECKSUM";
- case 0x6ffffdf9: return "DT_PLTPADSZ";
- case 0x6ffffdfa: return "DT_MOVEENT";
- case 0x6ffffdfb: return "DT_MOVESZ";
- case 0x6ffffdfc: return "DT_FEATURE";
- case 0x6ffffdfd: return "DT_POSFLAG_1";
- case 0x6ffffdfe: return "DT_SYMINSZ";
- case 0x6ffffdff: return "DT_SYMINENT (DT_VALRNGHI)";
- case 0x6ffffe00: return "DT_ADDRRNGLO";
- case 0x6ffffef5: return "DT_GNU_HASH";
- case 0x6ffffef8: return "DT_GNU_CONFLICT";
- case 0x6ffffef9: return "DT_GNU_LIBLIST";
- case 0x6ffffefa: return "DT_CONFIG";
- case 0x6ffffefb: return "DT_DEPAUDIT";
- case 0x6ffffefc: return "DT_AUDIT";
- case 0x6ffffefd: return "DT_PLTPAD";
- case 0x6ffffefe: return "DT_MOVETAB";
- case 0x6ffffeff: return "DT_SYMINFO (DT_ADDRRNGHI)";
- case 0x6ffffff9: return "DT_RELACOUNT";
- case 0x6ffffffa: return "DT_RELCOUNT";
- case 0x6ffffffb: return "DT_FLAGS_1";
- case 0x6ffffffc: return "DT_VERDEF";
- case 0x6ffffffd: return "DT_VERDEFNUM";
- case 0x6ffffffe: return "DT_VERNEED";
- case 0x6fffffff: return "DT_VERNEEDNUM";
- case 0x6ffffff0: return "DT_GNU_VERSYM";
+ case 0x6ffffdf5: return "DT_GNU_PRELINKED";
+ case 0x6ffffdf6: return "DT_GNU_CONFLICTSZ";
+ case 0x6ffffdf7: return "DT_GNU_LIBLISTSZ";
+ case 0x6ffffdf8: return "DT_SUNW_CHECKSUM";
+ case DT_PLTPADSZ: return "DT_PLTPADSZ";
+ case DT_MOVEENT: return "DT_MOVEENT";
+ case DT_MOVESZ: return "DT_MOVESZ";
+ case 0x6ffffdfc: return "DT_FEATURE";
+ case DT_POSFLAG_1: return "DT_POSFLAG_1";
+ case DT_SYMINSZ: return "DT_SYMINSZ";
+ case DT_SYMINENT: return "DT_SYMINENT (DT_VALRNGHI)";
+ case DT_ADDRRNGLO: return "DT_ADDRRNGLO";
+ case DT_GNU_HASH: return "DT_GNU_HASH";
+ case 0x6ffffef8: return "DT_GNU_CONFLICT";
+ case 0x6ffffef9: return "DT_GNU_LIBLIST";
+ case 0x6ffffefa: return "DT_CONFIG";
+ case 0x6ffffefb: return "DT_DEPAUDIT";
+ case 0x6ffffefc: return "DT_AUDIT";
+ case 0x6ffffefd: return "DT_PLTPAD";
+ case 0x6ffffefe: return "DT_MOVETAB";
+ case DT_SYMINFO: return "DT_SYMINFO (DT_ADDRRNGHI)";
+ case DT_RELACOUNT: return "DT_RELACOUNT";
+ case DT_RELCOUNT: return "DT_RELCOUNT";
+ case DT_FLAGS_1: return "DT_FLAGS_1";
+ case DT_VERDEF: return "DT_VERDEF";
+ case DT_VERDEFNUM: return "DT_VERDEFNUM";
+ case DT_VERNEED: return "DT_VERNEED";
+ case DT_VERNEEDNUM: return "DT_VERNEEDNUM";
+ case 0x6ffffff0: return "DT_GNU_VERSYM";
/* 0x70000000 - 0x7fffffff processor-specific semantics */
- case 0x70000000: return "DT_IA_64_PLT_RESERVE";
- case 0x7ffffffd: return "DT_SUNW_AUXILIARY";
- case 0x7ffffffe: return "DT_SUNW_USED";
- case 0x7fffffff: return "DT_SUNW_FILTER";
- default: return "ERROR: TAG NOT DEFINED";
+ case 0x70000000: return "DT_IA_64_PLT_RESERVE";
+ case 0x7ffffffd: return "DT_SUNW_AUXILIARY";
+ case 0x7ffffffe: return "DT_SUNW_USED";
+ case 0x7fffffff: return "DT_SUNW_FILTER";
}
+
+ snprintf(unknown_buf, sizeof(unknown_buf),
+ "<unknown: %#llx>", (unsigned long long)tag);
+ return (unknown_buf);
}
static const char *
@@ -313,42 +318,79 @@ sh_name(struct elfdump *ed, int ndx)
/* http://www.sco.com/developers/gabi/latest/ch4.sheader.html#sh_type */
static const char *
-sh_types(u_int64_t sht) {
- switch (sht) {
- case 0: return "SHT_NULL";
- case 1: return "SHT_PROGBITS";
- case 2: return "SHT_SYMTAB";
- case 3: return "SHT_STRTAB";
- case 4: return "SHT_RELA";
- case 5: return "SHT_HASH";
- case 6: return "SHT_DYNAMIC";
- case 7: return "SHT_NOTE";
- case 8: return "SHT_NOBITS";
- case 9: return "SHT_REL";
- case 10: return "SHT_SHLIB";
- case 11: return "SHT_DYNSYM";
- case 14: return "SHT_INIT_ARRAY";
- case 15: return "SHT_FINI_ARRAY";
- case 16: return "SHT_PREINIT_ARRAY";
- case 17: return "SHT_GROUP";
- case 18: return "SHT_SYMTAB_SHNDX";
- /* 0x60000000 - 0x6fffffff operating system-specific semantics */
- case 0x6ffffff0: return "XXX:VERSYM";
- case 0x6ffffff4: return "SHT_SUNW_dof";
- case 0x6ffffff6: return "SHT_GNU_HASH";
- case 0x6ffffff7: return "SHT_GNU_LIBLIST";
- case 0x6ffffffc: return "XXX:VERDEF";
- case 0x6ffffffd: return "SHT_SUNW(GNU)_verdef";
- case 0x6ffffffe: return "SHT_SUNW(GNU)_verneed";
- case 0x6fffffff: return "SHT_SUNW(GNU)_versym";
- /* 0x70000000 - 0x7fffffff processor-specific semantics */
- case 0x70000000: return "SHT_IA_64_EXT";
- case 0x70000001: return "SHT_IA_64_UNWIND";
- case 0x7ffffffd: return "XXX:AUXILIARY";
- case 0x7fffffff: return "XXX:FILTER";
- /* 0x80000000 - 0xffffffff application programs */
- default: return "ERROR: SHT NOT DEFINED";
+sh_types(uint64_t mach, uint64_t sht) {
+ static char unknown_buf[64];
+
+ if (sht < 0x60000000) {
+ switch (sht) {
+ case SHT_NULL: return "SHT_NULL";
+ case SHT_PROGBITS: return "SHT_PROGBITS";
+ case SHT_SYMTAB: return "SHT_SYMTAB";
+ case SHT_STRTAB: return "SHT_STRTAB";
+ case SHT_RELA: return "SHT_RELA";
+ case SHT_HASH: return "SHT_HASH";
+ case SHT_DYNAMIC: return "SHT_DYNAMIC";
+ case SHT_NOTE: return "SHT_NOTE";
+ case SHT_NOBITS: return "SHT_NOBITS";
+ case SHT_REL: return "SHT_REL";
+ case SHT_SHLIB: return "SHT_SHLIB";
+ case SHT_DYNSYM: return "SHT_DYNSYM";
+ case SHT_INIT_ARRAY: return "SHT_INIT_ARRAY";
+ case SHT_FINI_ARRAY: return "SHT_FINI_ARRAY";
+ case SHT_PREINIT_ARRAY: return "SHT_PREINIT_ARRAY";
+ case SHT_GROUP: return "SHT_GROUP";
+ case SHT_SYMTAB_SHNDX: return "SHT_SYMTAB_SHNDX";
+ }
+ } else if (sht < 0x70000000) {
+ /* 0x60000000-0x6fffffff operating system-specific semantics */
+ switch (sht) {
+ case 0x6ffffff0: return "XXX:VERSYM";
+ case SHT_SUNW_dof: return "SHT_SUNW_dof";
+ case SHT_GNU_HASH: return "SHT_GNU_HASH";
+ case 0x6ffffff7: return "SHT_GNU_LIBLIST";
+ case 0x6ffffffc: return "XXX:VERDEF";
+ case SHT_SUNW_verdef: return "SHT_SUNW(GNU)_verdef";
+ case SHT_SUNW_verneed: return "SHT_SUNW(GNU)_verneed";
+ case SHT_SUNW_versym: return "SHT_SUNW(GNU)_versym";
+ }
+ } else if (sht < 0x80000000) {
+ /* 0x70000000 - 0x7fffffff processor-specific semantics */
+ switch (mach) {
+ case EM_ARM:
+ switch (sht) {
+ case SHT_ARM_EXIDX: return "SHT_ARM_EXIDX";
+ case SHT_ARM_PREEMPTMAP: return "SHT_ARM_PREEMPTMAP";
+ case SHT_ARM_ATTRIBUTES: return "SHT_ARM_ATTRIBUTES";
+ case SHT_ARM_DEBUGOVERLAY:
+ return "SHT_ARM_DEBUGOVERLAY";
+ case SHT_ARM_OVERLAYSECTION:
+ return "SHT_ARM_OVERLAYSECTION";
+ }
+ break;
+ case EM_IA_64:
+ switch (sht) {
+ case 0x70000000: return "SHT_IA_64_EXT";
+ case 0x70000001: return "SHT_IA_64_UNWIND";
+ }
+ break;
+ case EM_MIPS:
+ switch (sht) {
+ case SHT_MIPS_REGINFO: return "SHT_MIPS_REGINFO";
+ case SHT_MIPS_OPTIONS: return "SHT_MIPS_OPTIONS";
+ case SHT_MIPS_ABIFLAGS: return "SHT_MIPS_ABIFLAGS";
+ }
+ break;
+ }
+ switch (sht) {
+ case 0x7ffffffd: return "XXX:AUXILIARY";
+ case 0x7fffffff: return "XXX:FILTER";
+ }
}
+ /* 0x80000000 - 0xffffffff application programs */
+
+ snprintf(unknown_buf, sizeof(unknown_buf),
+ "<unknown: %#llx>", (unsigned long long)sht);
+ return (unknown_buf);
}
/*
@@ -390,22 +432,87 @@ sh_flags(uint64_t shf)
return (flg);
}
-static const char *st_types[] = {
- "STT_NOTYPE", "STT_OBJECT", "STT_FUNC", "STT_SECTION", "STT_FILE",
- "STT_COMMON", "STT_TLS"
-};
+static const char *
+st_type(unsigned int mach, unsigned int type)
+{
+ static char s_type[32];
+
+ switch (type) {
+ case STT_NOTYPE: return "STT_NOTYPE";
+ case STT_OBJECT: return "STT_OBJECT";
+ case STT_FUNC: return "STT_FUNC";
+ case STT_SECTION: return "STT_SECTION";
+ case STT_FILE: return "STT_FILE";
+ case STT_COMMON: return "STT_COMMON";
+ case STT_TLS: return "STT_TLS";
+ case 13:
+ if (mach == EM_SPARCV9)
+ return "STT_SPARC_REGISTER";
+ break;
+ }
+ snprintf(s_type, sizeof(s_type), "<unknown: %#x>", type);
+ return (s_type);
+}
-static const char *st_types_S[] = {
- "NOTY", "OBJT", "FUNC", "SECT", "FILE"
-};
+static const char *
+st_type_S(unsigned int type)
+{
+ static char s_type[32];
-static const char *st_bindings[] = {
- "STB_LOCAL", "STB_GLOBAL", "STB_WEAK"
-};
+ switch (type) {
+ case STT_NOTYPE: return "NOTY";
+ case STT_OBJECT: return "OBJT";
+ case STT_FUNC: return "FUNC";
+ case STT_SECTION: return "SECT";
+ case STT_FILE: return "FILE";
+ }
+ snprintf(s_type, sizeof(s_type), "<unknown: %#x>", type);
+ return (s_type);
+}
-static const char *st_bindings_S[] = {
- "LOCL", "GLOB", "WEAK"
-};
+static const char *
+st_bindings(unsigned int sbind)
+{
+ static char s_sbind[32];
+
+ switch (sbind) {
+ case STB_LOCAL: return "STB_LOCAL";
+ case STB_GLOBAL: return "STB_GLOBAL";
+ case STB_WEAK: return "STB_WEAK";
+ case STB_GNU_UNIQUE: return "STB_GNU_UNIQUE";
+ default:
+ if (sbind >= STB_LOOS && sbind <= STB_HIOS)
+ return "OS";
+ else if (sbind >= STB_LOPROC && sbind <= STB_HIPROC)
+ return "PROC";
+ else
+ snprintf(s_sbind, sizeof(s_sbind), "<unknown: %#x>",
+ sbind);
+ return (s_sbind);
+ }
+}
+
+static const char *
+st_bindings_S(unsigned int sbind)
+{
+ static char s_sbind[32];
+
+ switch (sbind) {
+ case STB_LOCAL: return "LOCL";
+ case STB_GLOBAL: return "GLOB";
+ case STB_WEAK: return "WEAK";
+ case STB_GNU_UNIQUE: return "UNIQ";
+ default:
+ if (sbind >= STB_LOOS && sbind <= STB_HIOS)
+ return "OS";
+ else if (sbind >= STB_LOPROC && sbind <= STB_HIPROC)
+ return "PROC";
+ else
+ snprintf(s_sbind, sizeof(s_sbind), "<%#x>",
+ sbind);
+ return (s_sbind);
+ }
+}
static unsigned char st_others[] = {
'D', 'I', 'H', 'P'
@@ -426,7 +533,7 @@ r_type(unsigned int mach, unsigned int type)
case 4: return "R_386_PLT32";
case 5: return "R_386_COPY";
case 6: return "R_386_GLOB_DAT";
- case 7: return "R_386_JMP_SLOT";
+ case 7: return "R_386_JUMP_SLOT";
case 8: return "R_386_RELATIVE";
case 9: return "R_386_GOTOFF";
case 10: return "R_386_GOTPC";
@@ -769,7 +876,7 @@ r_type(unsigned int mach, unsigned int type)
case 4: return "R_X86_64_PLT32";
case 5: return "R_X86_64_COPY";
case 6: return "R_X86_64_GLOB_DAT";
- case 7: return "R_X86_64_JMP_SLOT";
+ case 7: return "R_X86_64_JUMP_SLOT";
case 8: return "R_X86_64_RELATIVE";
case 9: return "R_X86_64_GOTPCREL";
case 10: return "R_X86_64_32";
@@ -1608,7 +1715,8 @@ elf_print_shdr(struct elfdump *ed)
else
PRT(" sh_flags: 0\n");
PRT(" sh_size: %#-14jx", (uintmax_t)s->sz);
- PRT(" sh_type: [ %s ]\n", sh_types(s->type));
+ PRT(" sh_type: [ %s ]\n",
+ sh_types(ed->ehdr.e_machine, s->type));
PRT(" sh_offset: %#-14jx", (uintmax_t)s->off);
PRT(" sh_entsize: %#jx\n", (uintmax_t)s->entsize);
PRT(" sh_link: %-14u", s->link);
@@ -1618,7 +1726,8 @@ elf_print_shdr(struct elfdump *ed)
PRT("\n");
PRT("entry: %ju\n", (uintmax_t)i);
PRT("\tsh_name: %s\n", s->name);
- PRT("\tsh_type: %s\n", sh_types(s->type));
+ PRT("\tsh_type: %s\n",
+ sh_types(ed->ehdr.e_machine, s->type));
PRT("\tsh_flags: %s\n", sh_flags(s->flags));
PRT("\tsh_addr: %#jx\n", (uintmax_t)s->addr);
PRT("\tsh_offset: %ju\n", (uintmax_t)s->off);
@@ -1745,8 +1854,8 @@ elf_print_symtab(struct elfdump *ed, int i)
PRT("0x%8.8jx ", (uintmax_t)sym.st_size);
else
PRT("0x%12.12jx ", (uintmax_t)sym.st_size);
- PRT("%s ", st_types_S[GELF_ST_TYPE(sym.st_info)]);
- PRT("%s ", st_bindings_S[GELF_ST_BIND(sym.st_info)]);
+ PRT("%s ", st_type_S(GELF_ST_TYPE(sym.st_info)));
+ PRT("%s ", st_bindings_S(GELF_ST_BIND(sym.st_info)));
PRT("%c ", st_others[sym.st_other]);
PRT("%3u ", (vs == NULL ? 0 : vs[j]));
PRT("%-11.11s ", sh_name(ed, sym.st_shndx));
@@ -1757,8 +1866,9 @@ elf_print_symtab(struct elfdump *ed, int i)
PRT("\tst_value: %#jx\n", (uintmax_t)sym.st_value);
PRT("\tst_size: %ju\n", (uintmax_t)sym.st_size);
PRT("\tst_info: %s %s\n",
- st_types[GELF_ST_TYPE(sym.st_info)],
- st_bindings[GELF_ST_BIND(sym.st_info)]);
+ st_type(ed->ehdr.e_machine,
+ GELF_ST_TYPE(sym.st_info)),
+ st_bindings(GELF_ST_BIND(sym.st_info)));
PRT("\tst_shndx: %ju\n", (uintmax_t)sym.st_shndx);
}
}
@@ -2173,11 +2283,14 @@ elf_print_got_section(struct elfdump *ed, struct section *s)
for(i = 0; i < len; i++) {
PRT("[%5.5d] ", i);
if (ed->ec == ELFCLASS32) {
- PRT("%-8.8jx ", s->addr + i * s->entsize);
+ PRT("%-8.8jx ",
+ (uintmax_t) (s->addr + i * s->entsize));
PRT("%-8.8x ", *((uint32_t *)dst.d_buf + i));
} else {
- PRT("%-16.16jx ", s->addr + i * s->entsize);
- PRT("%-16.16jx ", *((uint64_t *)dst.d_buf + i));
+ PRT("%-16.16jx ",
+ (uintmax_t) (s->addr + i * s->entsize));
+ PRT("%-16.16jx ",
+ (uintmax_t) *((uint64_t *)dst.d_buf + i));
}
PRT("%-18s ", r_type(ed->ehdr.e_machine,
GELF_R_TYPE(got[i].u_r.rel.r_info)));
@@ -2198,7 +2311,8 @@ elf_print_got_section(struct elfdump *ed, struct section *s)
if (ed->ec == ELFCLASS32)
PRT("\t%#x\n", *((uint32_t *)dst.d_buf + i));
else
- PRT("\t%#jx\n", *((uint64_t *)dst.d_buf + i));
+ PRT("\t%#jx\n",
+ (uintmax_t) *((uint64_t *)dst.d_buf + i));
}
}
}
diff --git a/elfdump/os.NetBSD.mk b/elfdump/os.NetBSD.mk
new file mode 100644
index 000000000000..ae214e3115c0
--- /dev/null
+++ b/elfdump/os.NetBSD.mk
@@ -0,0 +1,2 @@
+# TODO(#511): Revert after the source tree is -Wconversion clean.
+WARNS=5
diff --git a/findtextrel/findtextrel.c b/findtextrel/findtextrel.c
index 91baa54618cd..ad493cf75398 100644
--- a/findtextrel/findtextrel.c
+++ b/findtextrel/findtextrel.c
@@ -38,7 +38,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: findtextrel.c 3174 2015-03-27 17:13:41Z emaste $");
+ELFTC_VCSID("$Id: findtextrel.c 3359 2016-01-24 17:06:20Z jkoshy $");
static struct option longopts[] = {
{"help", no_argument, NULL, 'H'},
@@ -70,11 +70,11 @@ version(void)
static const char *
find_symbol(const char *fn, Elf *e, Elf_Data *d, GElf_Shdr *sh, uintmax_t off)
{
- GElf_Sym sym;
const char *name;
+ GElf_Sym sym;
int i, len;
- len = d->d_size / sh->sh_entsize;
+ len = (int) (d->d_size / sh->sh_entsize);
for (i = 0; i < len; i++) {
if (gelf_getsym(d, i, &sym) != &sym) {
warnx("%s: gelf_getsym() failed: %s", fn,
@@ -215,7 +215,7 @@ report_textrel(const char *fn, Elf *e, Dwarf_Debug dbg, uintmax_t off,
out:
if (found)
- printf(", file: %s, line: %ju", file, lineno);
+ printf(", file: %s, line: %ju", file, (uintmax_t) lineno);
/*
* Reset internal CU pointer, so we will start from the first CU
@@ -236,11 +236,11 @@ static void
examine_reloc(const char *fn, Elf *e, Elf_Data *d, GElf_Shdr *sh, GElf_Phdr *ph,
int phnum, Dwarf_Debug dbg, int *textrel)
{
- GElf_Rel rel;
GElf_Rela rela;
int i, j, len;
+ GElf_Rel rel;
- len = d->d_size / sh->sh_entsize;
+ len = (int) (d->d_size / sh->sh_entsize);
for (i = 0; i < len; i++) {
if (sh->sh_type == SHT_REL) {
if (gelf_getrel(d, i, &rel) != &rel) {
diff --git a/ld/Makefile b/ld/Makefile
index 64d4eb270b81..2037f01aa91e 100644
--- a/ld/Makefile
+++ b/ld/Makefile
@@ -1,9 +1,9 @@
-# $Id: Makefile 2910 2013-02-03 06:06:23Z kaiwang27 $
+# $Id: Makefile 3385 2016-01-31 14:26:26Z jkoshy $
TOP= ..
PROG= ld
-WARNS?= 6
+WARNS?= 5
SRCS= amd64.c \
amd64_script.c \
@@ -24,26 +24,31 @@ SRCS= amd64.c \
ld_path.c \
ld_reloc.c \
ld_script.c \
- ld_script_lexer.l \
- ld_script_parser.y \
ld_strtab.c \
ld_symbols.c \
ld_symver.c \
- y.tab.h
+ mips.c \
+ littlemips_script.c \
+ bigmips_script.c
-.SUFFIXES: .ld .c
-.ld.c:
- awk -f ld_script.awk ${.ALLSRC} > ${.TARGET}
+LSRC= ld_script_lexer.l
+YSRC= ld_script_parser.y
-GENSRCS= amd64_script.c i386_script.c
+GENSRCS= amd64_script.c i386_script.c littlemips_script.c \
+ bigmips_script.c
-CLEANFILES+= y.tab.h ${GENSRCS}
+CLEANFILES+= ${GENSRCS}
DPADD= ${LIBELFTC} ${LIBELF} ${LIBDWARF}
LDADD= -lelftc -ldwarf -lelf
CFLAGS+= -I. -I${.CURDIR}
+YFLAGS= -d
NOMAN=
+.SUFFIXES: .ld .c
+.ld.c:
+ awk -f ld_script.awk ${.ALLSRC} > ${.TARGET}
+
.include "${TOP}/mk/elftoolchain.prog.mk"
diff --git a/ld/amd64.c b/ld/amd64.c
index 565995ba4809..e22520bfebf9 100644
--- a/ld/amd64.c
+++ b/ld/amd64.c
@@ -35,7 +35,7 @@
#include "ld_utils.h"
#include "amd64.h"
-ELFTC_VCSID("$Id: amd64.c 2963 2013-08-25 17:29:54Z kaiwang27 $");
+ELFTC_VCSID("$Id: amd64.c 3390 2016-02-05 16:15:58Z emaste $");
static void _create_plt_reloc(struct ld *ld, struct ld_symbol *lsb,
uint64_t offset);
@@ -115,7 +115,7 @@ _reloc2str(uint64_t r)
case 4: return "R_X86_64_PLT32";
case 5: return "R_X86_64_COPY";
case 6: return "R_X86_64_GLOB_DAT";
- case 7: return "R_X86_64_JMP_SLOT";
+ case 7: return "R_X86_64_JUMP_SLOT";
case 8: return "R_X86_64_RELATIVE";
case 9: return "R_X86_64_GOTPCREL";
case 10: return "R_X86_64_32";
@@ -133,7 +133,7 @@ _reloc2str(uint64_t r)
case 22: return "R_X86_64_GOTTPOFF";
case 23: return "R_X86_64_TPOFF32";
default:
- snprintf(s, sizeof(s), "<unkown: %ju>", r);
+ snprintf(s, sizeof(s), "<unkown: %ju>", (uintmax_t) r);
return (s);
}
}
@@ -268,12 +268,11 @@ static void
_reserve_gotplt_entry(struct ld *ld, struct ld_symbol *lsb)
{
struct ld_input_section *is;
- uint64_t off;
is = _find_and_create_gotplt_section(ld, 1);
/* Reserve a GOT entry for PLT. */
- off = ld_input_reserve_ibuf(is, 1);
+ (void) ld_input_reserve_ibuf(is, 1);
/*
* Record a R_X86_64_JUMP_SLOT entry for this symbol. Note that
diff --git a/ld/bigmips_script.ld b/ld/bigmips_script.ld
new file mode 100644
index 000000000000..7f60e19bd9f8
--- /dev/null
+++ b/ld/bigmips_script.ld
@@ -0,0 +1,165 @@
+/* $Id$ */
+
+OUTPUT_FORMAT("elf32-bigmips")
+ENTRY(_start)
+SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
+SECTIONS {
+ PROVIDE (__executable_start = 0x00400000);
+ . = 0x00400000 + SIZEOF_HEADERS;
+ .interp : { *(.interp) }
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .gnu.version : { *(.gnu.version) }
+ .gnu.version_d : { *(.gnu.version_d) }
+ .gnu.version_r : { *(.gnu.version_r) }
+ .rel.dyn :
+ {
+ *(.rel.init)
+ *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
+ *(.rel.fini)
+ *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
+ *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
+ *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
+ *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
+ *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
+ *(.rel.ctors)
+ *(.rel.dtors)
+ *(.rel.got)
+ *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
+ *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
+ }
+ .rela.dyn :
+ {
+ *(.rela.init)
+ *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
+ *(.rela.fini)
+ *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
+ *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
+ *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
+ *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
+ *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
+ *(.rela.ctors)
+ *(.rela.dtors)
+ *(.rela.got)
+ *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
+ *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
+ }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+ .init :
+ {
+ KEEP(*(.init))
+ } = 0x00000000
+ .plt : { *(.plt) }
+ .text :
+ {
+ _ftext = .;
+ *(.text .stub .text.* .gnu.linkonce.t.*)
+ } = 0x00000000
+ .fini :
+ {
+ KEEP(*(.fini))
+ } = 0x00000000
+ PROVIDE(__etext = .);
+ PROVIDE(_etext = .);
+ PROVIDE(etext = .);
+ .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
+ .rodata1 : { *(.rodata1) }
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : { KEEP(*(.eh_frame)) }
+ .gcc_except_table : { *(.gcc_except_table) }
+
+ .tdata : ALIGN(4096) { *(.tdata .tdata.* .gnu.linkonce.td.*) }
+ .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
+ PROVIDE(__preinit_array_start = .);
+ .preinit_array : { *(.preinit_array) }
+ PROVIDE(__preinit_array_end = .);
+ PROVIDE(__init_array_start = .);
+ .init_array : { *(.init_array) }
+ PROVIDE(__init_array_end = .);
+ PROVIDE(__fini_array_start = .);
+ .fini_array : { *(.fini_array) }
+ PROVIDE(__fini_array_end = .);
+ .dynamic : { *(.dynamic) }
+ .ctors :
+ {
+ KEEP(*crtbegin*.o(.ctors))
+ KEEP(*(EXCLUDE_FILE (*crtend*.o ) .ctors))
+ KEEP(*(SORT(.ctors.*)))
+ KEEP(*(.ctors))
+ }
+ .dtors :
+ {
+ KEEP(*crtbegin*.o(.dtors))
+ KEEP(*(EXCLUDE_FILE (*crtend*.o ) .dtors))
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ }
+ .jcr : { KEEP(*(.jcr)) }
+ .got : { *(.got.plt) *(.got) }
+ .data :
+ {
+ _fdata = .;
+ *(.data .data.* .gnu.linkonce.d.*)
+ SORT(CONSTRUCTORS)
+ }
+ .data1 : { *(.data1) }
+ _gp = ALIGN(16) + 0x7ff0;
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ }
+ /* Align the end of data segment to page boundary. */
+ . = ALIGN(. != 0 ? 4096 : 1);
+ _edata = .;
+ PROVIDE(edata = .);
+ __bss_start = .;
+ _fbss = .;
+ .sbss : ALIGN(8)
+ {
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ }
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.* .gnu.linkonce.b.*)
+ *(COMMON)
+ . = ALIGN(32 / 8);
+ }
+ . = ALIGN(32 / 8);
+ _end = .;
+ PROVIDE(end = .);
+ . = DATA_SEGMENT_END (.);
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF1 */
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF1 Extension */
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF2 */
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /DISCARD/ : { *(.note.GNU-stack) *(.reginfo) }
+}
diff --git a/ld/i386.c b/ld/i386.c
index fab5643f4fe9..760424a017a9 100644
--- a/ld/i386.c
+++ b/ld/i386.c
@@ -34,7 +34,7 @@
#include "ld_utils.h"
#include "i386.h"
-ELFTC_VCSID("$Id: i386.c 2967 2013-10-12 23:58:13Z kaiwang27 $");
+ELFTC_VCSID("$Id: i386.c 3391 2016-02-05 19:43:01Z emaste $");
static void _create_plt_reloc(struct ld *ld, struct ld_symbol *lsb,
uint64_t offset);
@@ -93,7 +93,7 @@ _reloc2str(uint64_t r)
case 4: return "R_386_PLT32";
case 5: return "R_386_COPY";
case 6: return "R_386_GLOB_DAT";
- case 7: return "R_386_JMP_SLOT";
+ case 7: return "R_386_JUMP_SLOT";
case 8: return "R_386_RELATIVE";
case 9: return "R_386_GOTOFF";
case 10: return "R_386_GOTPC";
@@ -119,7 +119,7 @@ _reloc2str(uint64_t r)
case 37: return "R_386_TLS_TPOFF32";
default:
- snprintf(s, sizeof(s), "<unkown: %ju>", r);
+ snprintf(s, sizeof(s), "<unkown: %ju>", (uintmax_t) r);
return (s);
}
}
@@ -253,15 +253,14 @@ static void
_reserve_gotplt_entry(struct ld *ld, struct ld_symbol *lsb)
{
struct ld_input_section *is;
- uint64_t off;
is = _find_and_create_gotplt_section(ld, 1);
/* Reserve a GOT entry for PLT. */
- off = ld_input_reserve_ibuf(is, 1);
+ (void) ld_input_reserve_ibuf(is, 1);
/*
- * Record a R_386_JMP_SLOT entry for this symbol. Note that
+ * Record a R_386_JUMP_SLOT entry for this symbol. Note that
* we don't need to record the offset (relative to the GOT section)
* here, since the PLT relocations will be sorted later and we
* will generate GOT section according to the new order.
@@ -284,7 +283,7 @@ static void
_create_plt_reloc(struct ld *ld, struct ld_symbol *lsb, uint64_t offset)
{
- ld_reloc_create_entry(ld, ".rel.plt", NULL, R_386_JMP_SLOT,
+ ld_reloc_create_entry(ld, ".rel.plt", NULL, R_386_JUMP_SLOT,
lsb, offset, 0);
lsb->lsb_dynrel = 1;
diff --git a/ld/ld_arch.c b/ld/ld_arch.c
index 33baa132aaab..186beea7cb14 100644
--- a/ld/ld_arch.c
+++ b/ld/ld_arch.c
@@ -28,8 +28,9 @@
#include "ld_arch.h"
#include "i386.h"
#include "amd64.h"
+#include "mips.h"
-ELFTC_VCSID("$Id: ld_arch.c 2515 2012-06-06 23:05:00Z kaiwang27 $");
+ELFTC_VCSID("$Id: ld_arch.c 3281 2015-12-11 21:39:23Z kaiwang27 $");
#define LD_DEFAULT_ARCH "amd64"
@@ -48,6 +49,7 @@ ld_arch_init(struct ld *ld)
i386_register(ld);
amd64_register(ld);
+ mips_register(ld);
/*
* Find out default arch for output object.
@@ -112,7 +114,8 @@ ld_arch_equal(struct ld_arch *a1, struct ld_arch *a2)
}
void
-ld_arch_verify(struct ld *ld, const char *name, int mach)
+ld_arch_verify(struct ld *ld, const char *name, int mach, int endian,
+ unsigned flags)
{
struct ld_arch *la;
struct ld_state *ls;
@@ -120,7 +123,7 @@ ld_arch_verify(struct ld *ld, const char *name, int mach)
assert(ld->ld_arch != NULL);
ls = &ld->ld_state;
- if ((la = ld_arch_guess_arch_name(ld, mach)) == NULL)
+ if ((la = ld_arch_guess_arch_name(ld, mach, endian)) == NULL)
ld_fatal(ld, "%s: ELF object architecture %#x not supported",
name, mach);
@@ -133,11 +136,17 @@ ld_arch_verify(struct ld *ld, const char *name, int mach)
ld->ld_arch = la;
}
+ if (ls->ls_first_elf_object) {
+ la->flags = flags;
+ } else if (la->merge_flags) {
+ la->merge_flags(ld, flags);
+ }
+
ls->ls_first_elf_object = 0;
}
struct ld_arch *
-ld_arch_guess_arch_name(struct ld *ld, int mach)
+ld_arch_guess_arch_name(struct ld *ld, int mach, int endian)
{
char arch[MAX_ARCH_NAME_LEN + 1];
@@ -152,7 +161,8 @@ ld_arch_guess_arch_name(struct ld *ld, int mach)
break;
case EM_MIPS:
case EM_MIPS_RS3_LE:
- snprintf(arch, sizeof(arch), "%s", "mips");
+ snprintf(arch, sizeof(arch), "%s",
+ endian==ELFDATA2MSB ? "bigmips" : "littlemips");
break;
case EM_PPC:
case EM_PPC64:
diff --git a/ld/ld_arch.h b/ld/ld_arch.h
index f1f840339138..2165627d68d0 100644
--- a/ld/ld_arch.h
+++ b/ld/ld_arch.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ld_arch.h 2913 2013-02-16 07:15:24Z kaiwang27 $
+ * $Id: ld_arch.h 3281 2015-12-11 21:39:23Z kaiwang27 $
*/
#define MAX_ARCH_NAME_LEN 64
@@ -47,11 +47,13 @@ struct ld_arch {
void (*finalize_reloc)(struct ld *, struct ld_input_section *,
struct ld_reloc_entry *);
void (*finalize_got_and_plt)(struct ld *);
+ void (*merge_flags)(struct ld *, unsigned flags);
int (*is_absolute_reloc)(uint64_t);
int (*is_relative_reloc)(uint64_t);
unsigned char reloc_is_64bit;
unsigned char reloc_is_rela;
size_t reloc_entsize;
+ unsigned flags; /* processor-specific flags */
UT_hash_handle hh;
struct ld_arch *alias;
};
@@ -59,7 +61,7 @@ struct ld_arch {
void ld_arch_init(struct ld *);
int ld_arch_equal(struct ld_arch *, struct ld_arch *);
struct ld_arch *ld_arch_find(struct ld *, char *);
-struct ld_arch *ld_arch_guess_arch_name(struct ld *, int);
+struct ld_arch *ld_arch_guess_arch_name(struct ld *, int, int);
void ld_arch_set(struct ld *, char *);
void ld_arch_set_from_target(struct ld *);
-void ld_arch_verify(struct ld *, const char *, int);
+void ld_arch_verify(struct ld *, const char *, int, int, unsigned);
diff --git a/ld/ld_dynamic.c b/ld/ld_dynamic.c
index 371e0caa6677..aa0ab6991d71 100644
--- a/ld/ld_dynamic.c
+++ b/ld/ld_dynamic.c
@@ -37,7 +37,7 @@
#include "ld_symver.h"
#include "ld_strtab.h"
-ELFTC_VCSID("$Id: ld_dynamic.c 2965 2013-09-10 02:46:29Z kaiwang27 $");
+ELFTC_VCSID("$Id: ld_dynamic.c 3384 2016-01-31 13:12:41Z jkoshy $");
static void _check_dso_needed(struct ld *ld, struct ld_output *lo);
static void _create_dynamic(struct ld *ld, struct ld_output *lo);
@@ -253,7 +253,7 @@ _create_interp(struct ld *ld, struct ld_output *lo)
if ((odb->odb_buf = calloc(odb->odb_size, 1)) == NULL)
ld_fatal_std(ld, "calloc");
- strncpy(odb->odb_buf, interp, strlen(interp));
+ strncpy((char*) odb->odb_buf, interp, strlen(interp));
odb->odb_buf[strlen(interp)] = '\0';
(void) ld_output_create_section_element(ld, os, OET_DATA_BUFFER, odb,
diff --git a/ld/ld_exp.c b/ld/ld_exp.c
index 8eb182c1a06e..9c57cd8b24ae 100644
--- a/ld/ld_exp.c
+++ b/ld/ld_exp.c
@@ -30,7 +30,7 @@
#include "ld_exp.h"
#include "ld_layout.h"
-ELFTC_VCSID("$Id: ld_exp.c 2526 2012-07-17 17:43:30Z kaiwang27 $");
+ELFTC_VCSID("$Id: ld_exp.c 3278 2015-12-11 21:39:13Z kaiwang27 $");
/*
* Support routines for ldscript expression.
@@ -202,7 +202,7 @@ ld_exp_eval(struct ld* ld, struct ld_exp *le)
assert(le != NULL);
switch (le->le_op) {
case LEOP_ABS:
- return (abs(_EXP_EVAL(le->le_e1)));
+ return (llabs(_EXP_EVAL(le->le_e1)));
case LEOP_ADD:
return (_EXP_EVAL(le->le_e1) + _EXP_EVAL(le->le_e2));
case LEOP_ADDR:
@@ -569,7 +569,8 @@ static int64_t
_func_data_segment_align(struct ld *ld, struct ld_exp *le)
{
struct ld_state *ls;
- uint64_t maxpagesize, commonpagesize;
+ uint64_t maxpagesize;
+ /* uint64_t commonpagesize; */
/*
* TODO: test if align to common page size use less number
@@ -577,7 +578,7 @@ _func_data_segment_align(struct ld *ld, struct ld_exp *le)
*/
ls = &ld->ld_state;
maxpagesize = _EXP_EVAL(le->le_e1);
- commonpagesize = _EXP_EVAL(le->le_e2);
+ /* commonpagesize = _EXP_EVAL(le->le_e2); */
return (roundup(ls->ls_loc_counter, maxpagesize) +
(ls->ls_loc_counter & (maxpagesize - 1)));
diff --git a/ld/ld_file.c b/ld/ld_file.c
index 4e9ae0057f72..b55918950f08 100644
--- a/ld/ld_file.c
+++ b/ld/ld_file.c
@@ -29,7 +29,7 @@
#include "ld_file.h"
#include "ld_path.h"
-ELFTC_VCSID("$Id: ld_file.c 2930 2013-03-17 22:54:26Z kaiwang27 $");
+ELFTC_VCSID("$Id: ld_file.c 3281 2015-12-11 21:39:23Z kaiwang27 $");
/*
* Support routines for input file handling.
@@ -156,7 +156,8 @@ ld_file_load(struct ld *ld, struct ld_file *lf)
ld_fatal(ld, "%s: unknown ELF type %u", ehdr.e_type);
}
- ld_arch_verify(ld, lf->lf_name, ehdr.e_machine);
+ ld_arch_verify(ld, lf->lf_name, ehdr.e_machine, ehdr.e_ident[EI_DATA],
+ ehdr.e_flags);
}
void
diff --git a/ld/ld_layout.c b/ld/ld_layout.c
index 11711b2d825a..c9ad07be26e3 100644
--- a/ld/ld_layout.c
+++ b/ld/ld_layout.c
@@ -39,7 +39,7 @@
#include "ld_symbols.h"
#include "ld_strtab.h"
-ELFTC_VCSID("$Id: ld_layout.c 2965 2013-09-10 02:46:29Z kaiwang27 $");
+ELFTC_VCSID("$Id: ld_layout.c 3276 2015-12-11 21:39:06Z kaiwang27 $");
struct ld_wildcard_match {
char *wm_name;
@@ -89,10 +89,8 @@ ld_layout_sections(struct ld *ld)
struct ld_output *lo;
struct ld_script *lds;
struct ld_script_cmd *ldc;
- struct ld_state *ls;
int sections_cmd_exist;
- ls = &ld->ld_state;
lo = ld->ld_output;
lds = ld->ld_scp;
@@ -270,10 +268,10 @@ _print_section_layout(struct ld *ld, struct ld_output_section *os)
printf(" %-14s", is->is_name);
if (lo->lo_ec == ELFCLASS32)
printf(" 0x%08jx", (uintmax_t)
- os->os_addr + is->is_reloff);
+ (os->os_addr + is->is_reloff));
else
printf(" 0x%016jx", (uintmax_t)
- os->os_addr + is->is_reloff);
+ (os->os_addr + is->is_reloff));
if (is->is_size == 0)
printf(" %10s", "0x0");
else
@@ -885,7 +883,7 @@ ld_layout_insert_output_section(struct ld *ld, const char *name,
}
_os = STAILQ_NEXT(os, os_next);
- if (_os == NULL &&
+ if (_os != NULL &&
(_os->os_flags & SHF_ALLOC) != (flags & SHF_ALLOC))
break;
}
diff --git a/ld/ld_output.c b/ld/ld_output.c
index 43ea818da2c8..fc4a7762af04 100644
--- a/ld/ld_output.c
+++ b/ld/ld_output.c
@@ -36,7 +36,7 @@
#include "ld_strtab.h"
#include "ld_symbols.h"
-ELFTC_VCSID("$Id: ld_output.c 2965 2013-09-10 02:46:29Z kaiwang27 $");
+ELFTC_VCSID("$Id: ld_output.c 3281 2015-12-11 21:39:23Z kaiwang27 $");
static void _alloc_input_section_data(struct ld *ld, Elf_Scn *scn,
struct ld_input_section *is);
@@ -113,7 +113,7 @@ ld_output_init(struct ld *ld)
eh.e_ident[EI_CLASS] = lo->lo_ec;
eh.e_ident[EI_DATA] = lo->lo_endian;
- eh.e_flags = 0; /* TODO */
+ eh.e_flags = ld->ld_arch->flags;
eh.e_machine = elftc_bfd_target_machine(ld->ld_otgt);
if (ld->ld_dso || ld->ld_pie)
eh.e_type = ET_DYN;
@@ -916,7 +916,8 @@ ld_output_create(struct ld *ld)
ld_input_alloc_internal_section_buffers(ld);
/* Finalize PLT and GOT sections. */
- ld->ld_arch->finalize_got_and_plt(ld);
+ if (ld->ld_arch->finalize_got_and_plt)
+ ld->ld_arch->finalize_got_and_plt(ld);
/* Join and sort dynamic relocation sections. */
_join_and_finalize_dynamic_reloc_sections(ld, lo);
diff --git a/ld/ld_script.c b/ld/ld_script.c
index 1e3d10437463..685c47d35d26 100644
--- a/ld/ld_script.c
+++ b/ld/ld_script.c
@@ -30,8 +30,9 @@
#include "ld_script.h"
#include "ld_file.h"
#include "ld_symbols.h"
+#include "ld_output.h"
-ELFTC_VCSID("$Id: ld_script.c 2881 2013-01-09 22:46:54Z kaiwang27 $");
+ELFTC_VCSID("$Id: ld_script.c 3281 2015-12-11 21:39:23Z kaiwang27 $");
static void _input_file_add(struct ld *ld, struct ld_script_input_file *ldif);
static void _overlay_section_free(void *ptr);
@@ -145,6 +146,40 @@ ld_script_assign_free(struct ld_script_assign *lda)
free(lda);
}
+static void
+_update_variable_section(struct ld *ld, struct ld_script_variable *ldv)
+{
+ struct ld_output_section *os, *last;
+
+ if (ldv->ldv_os_base) {
+ /* Get base address of the section. */
+ STAILQ_FOREACH(os, &ld->ld_output->lo_oslist, os_next) {
+ if (strcmp(os->os_name, ldv->ldv_os_base) == 0) {
+ ldv->ldv_base = os->os_addr;
+ ldv->ldv_os_ref = ldv->ldv_os_base;
+ ldv->ldv_os_base = 0;
+ break;
+ }
+ }
+ }
+
+ if (ldv->ldv_os_ref) {
+ /* Bind the symbol to the last section. */
+ last = 0;
+ STAILQ_FOREACH(os, &ld->ld_output->lo_oslist, os_next) {
+ if (! os->os_empty)
+ last = os;
+ if (strcmp(os->os_name, ldv->ldv_os_ref) == 0) {
+ if (last) {
+ ldv->ldv_symbol->lsb_shndx = elf_ndxscn(last->os_scn);
+ }
+ ldv->ldv_os_ref = 0;
+ break;
+ }
+ }
+ }
+}
+
void
ld_script_process_assign(struct ld *ld, struct ld_script_assign *lda)
{
@@ -170,6 +205,10 @@ ld_script_process_assign(struct ld *ld, struct ld_script_assign *lda)
(uintmax_t) ls->ls_loc_counter,
(uintmax_t) ldv->ldv_val);
ls->ls_loc_counter = (uint64_t) ldv->ldv_val;
+
+ } else if (ldv->ldv_symbol != NULL) {
+ _update_variable_section(ld, ldv);
+ ldv->ldv_symbol->lsb_value = ldv->ldv_val + ldv->ldv_base;
}
lda->lda_res = ldv->ldv_val;
}
diff --git a/ld/ld_script.h b/ld/ld_script.h
index ea862521c883..1de4ce0353e5 100644
--- a/ld/ld_script.h
+++ b/ld/ld_script.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ld_script.h 2881 2013-01-09 22:46:54Z kaiwang27 $
+ * $Id: ld_script.h 3281 2015-12-11 21:39:23Z kaiwang27 $
*/
enum ld_script_cmd_type {
@@ -198,8 +198,11 @@ struct ld_script_sections {
struct ld_script_variable {
char *ldv_name; /* variable name */
+ char *ldv_os_base; /* add base address of this section */
+ char *ldv_os_ref; /* link symbol to this section */
struct ld_symbol *ldv_symbol; /* assoicated symbol */
int64_t ldv_val; /* variable value */
+ int64_t ldv_base; /* base value */
UT_hash_handle hh; /* hash handle */
};
@@ -242,6 +245,8 @@ struct ld_script {
unsigned char lds_vn_name_omitted; /* version node w/o name exists */
struct ld_script_cmd_head lds_c; /* other ldscript cmd list */
struct ld_script_variable *lds_v; /* variable table */
+ char *lds_last_os_name; /* last output section */
+ char *lds_base_os_name; /* current output section */
};
struct ld_script_cmd *ld_script_assert(struct ld *, struct ld_exp *, char *);
diff --git a/ld/ld_script_lexer.l b/ld/ld_script_lexer.l
index 4a8ff9a2fdf6..f516da33a637 100644
--- a/ld/ld_script_lexer.l
+++ b/ld/ld_script_lexer.l
@@ -26,9 +26,9 @@
*/
#include "ld.h"
-#include "y.tab.h"
+#include "ld_script_parser.h"
-ELFTC_VCSID("$Id: ld_script_lexer.l 2875 2013-01-09 22:46:03Z kaiwang27 $");
+ELFTC_VCSID("$Id: ld_script_lexer.l 3385 2016-01-31 14:26:26Z jkoshy $");
#define YY_NO_UNPUT
int lineno = 1;
@@ -51,6 +51,7 @@ MATTR \(!?[rRwWxXaAiIlL]+\)
%option noyywrap
%option never-interactive
+%option nounput
%%
diff --git a/ld/ld_script_parser.y b/ld/ld_script_parser.y
index d2ffeeee1aa6..71c913145733 100644
--- a/ld/ld_script_parser.y
+++ b/ld/ld_script_parser.y
@@ -34,7 +34,7 @@
#include "ld_path.h"
#include "ld_exp.h"
-ELFTC_VCSID("$Id: ld_script_parser.y 2924 2013-03-17 22:53:36Z kaiwang27 $");
+ELFTC_VCSID("$Id: ld_script_parser.y 3281 2015-12-11 21:39:23Z kaiwang27 $");
struct yy_buffer_state;
typedef struct yy_buffer_state *YY_BUFFER_STATE;
@@ -756,7 +756,10 @@ sections_sub_command
;
output_sections_desc
- : ident output_section_addr_and_type ':'
+ : ident output_section_addr_and_type ':' {
+ /* Remember the name of last output section, needed later for assignment. */
+ ld->ld_scp->lds_base_os_name = $1;
+ }
output_section_lma
output_section_align
output_section_subalign
@@ -772,16 +775,18 @@ output_sections_desc
$$->ldso_name = $1;
$$->ldso_vma = $2->ldl_entry;
$$->ldso_type = $2->ldl_next->ldl_entry;
- $$->ldso_lma = $4;
- $$->ldso_align = $5;
- $$->ldso_subalign = $6;
- $$->ldso_constraint = $7;
+ $$->ldso_lma = $5;
+ $$->ldso_align = $6;
+ $$->ldso_subalign = $7;
+ $$->ldso_constraint = $8;
memcpy(&$$->ldso_c, &ldso_c, sizeof(ldso_c));
- $$->ldso_region = $11;
- $$->ldso_lma_region = $12;
- $$->ldso_phdr = ld_script_list_reverse($13);
- $$->ldso_fill = $14;
+ $$->ldso_region = $12;
+ $$->ldso_lma_region = $13;
+ $$->ldso_phdr = ld_script_list_reverse($14);
+ $$->ldso_fill = $15;
STAILQ_INIT(&ldso_c);
+ ld->ld_scp->lds_base_os_name = 0;
+ ld->ld_scp->lds_last_os_name = $1;
}
;
diff --git a/ld/ld_strtab.c b/ld/ld_strtab.c
index 59f0be2a228a..178f50fae479 100644
--- a/ld/ld_strtab.c
+++ b/ld/ld_strtab.c
@@ -27,7 +27,7 @@
#include "ld.h"
#include "ld_strtab.h"
-ELFTC_VCSID("$Id: ld_strtab.c 2965 2013-09-10 02:46:29Z kaiwang27 $");
+ELFTC_VCSID("$Id: ld_strtab.c 3279 2015-12-11 21:39:16Z kaiwang27 $");
#define _DEFAULT_STRTAB_SIZE 512
@@ -78,9 +78,6 @@ ld_strtab_free(struct ld_strtab *st)
if (st == NULL)
return;
- free(st->st_buf);
- free(st);
-
if (st->st_pool != NULL) {
HASH_ITER(hh, st->st_pool, str, tmp) {
HASH_DELETE(hh, st->st_pool, str);
@@ -88,6 +85,9 @@ ld_strtab_free(struct ld_strtab *st)
free(str);
}
}
+
+ free(st->st_buf);
+ free(st);
}
char *
diff --git a/ld/ld_symbols.c b/ld/ld_symbols.c
index d49d638089b9..cb034a66b072 100644
--- a/ld/ld_symbols.c
+++ b/ld/ld_symbols.c
@@ -34,7 +34,7 @@
#include "ld_script.h"
#include "ld_strtab.h"
-ELFTC_VCSID("$Id: ld_symbols.c 2965 2013-09-10 02:46:29Z kaiwang27 $");
+ELFTC_VCSID("$Id: ld_symbols.c 3281 2015-12-11 21:39:23Z kaiwang27 $");
#define _INIT_SYMTAB_SIZE 128
@@ -171,6 +171,9 @@ ld_symbols_add_variable(struct ld *ld, struct ld_script_variable *ldv,
if (hidden)
lsb->lsb_other = STV_HIDDEN;
lsb->lsb_ref_ndso = 1;
+ ldv->ldv_symbol = lsb;
+ ldv->ldv_os_ref = ld->ld_scp->lds_last_os_name;
+ ldv->ldv_os_base = ld->ld_scp->lds_base_os_name;
if (ld->ld_var_symbols == NULL) {
ld->ld_var_symbols = malloc(sizeof(*ld->ld_var_symbols));
diff --git a/ld/littlemips_script.ld b/ld/littlemips_script.ld
new file mode 100644
index 000000000000..3fe3779a8cb7
--- /dev/null
+++ b/ld/littlemips_script.ld
@@ -0,0 +1,165 @@
+/* $Id$ */
+
+OUTPUT_FORMAT("elf32-littlemips")
+ENTRY(_start)
+SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
+SECTIONS {
+ PROVIDE (__executable_start = 0x00400000);
+ . = 0x00400000 + SIZEOF_HEADERS;
+ .interp : { *(.interp) }
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .gnu.version : { *(.gnu.version) }
+ .gnu.version_d : { *(.gnu.version_d) }
+ .gnu.version_r : { *(.gnu.version_r) }
+ .rel.dyn :
+ {
+ *(.rel.init)
+ *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
+ *(.rel.fini)
+ *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
+ *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
+ *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
+ *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
+ *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
+ *(.rel.ctors)
+ *(.rel.dtors)
+ *(.rel.got)
+ *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
+ *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
+ }
+ .rela.dyn :
+ {
+ *(.rela.init)
+ *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
+ *(.rela.fini)
+ *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
+ *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
+ *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
+ *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
+ *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
+ *(.rela.ctors)
+ *(.rela.dtors)
+ *(.rela.got)
+ *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
+ *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
+ }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+ .init :
+ {
+ KEEP(*(.init))
+ } = 0x00000000
+ .plt : { *(.plt) }
+ .text :
+ {
+ _ftext = .;
+ *(.text .stub .text.* .gnu.linkonce.t.*)
+ } = 0x00000000
+ .fini :
+ {
+ KEEP(*(.fini))
+ } = 0x00000000
+ PROVIDE(__etext = .);
+ PROVIDE(_etext = .);
+ PROVIDE(etext = .);
+ .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
+ .rodata1 : { *(.rodata1) }
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : { KEEP(*(.eh_frame)) }
+ .gcc_except_table : { *(.gcc_except_table) }
+
+ .tdata : ALIGN(4096) { *(.tdata .tdata.* .gnu.linkonce.td.*) }
+ .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
+ PROVIDE(__preinit_array_start = .);
+ .preinit_array : { *(.preinit_array) }
+ PROVIDE(__preinit_array_end = .);
+ PROVIDE(__init_array_start = .);
+ .init_array : { *(.init_array) }
+ PROVIDE(__init_array_end = .);
+ PROVIDE(__fini_array_start = .);
+ .fini_array : { *(.fini_array) }
+ PROVIDE(__fini_array_end = .);
+ .dynamic : { *(.dynamic) }
+ .ctors :
+ {
+ KEEP(*crtbegin*.o(.ctors))
+ KEEP(*(EXCLUDE_FILE (*crtend*.o ) .ctors))
+ KEEP(*(SORT(.ctors.*)))
+ KEEP(*(.ctors))
+ }
+ .dtors :
+ {
+ KEEP(*crtbegin*.o(.dtors))
+ KEEP(*(EXCLUDE_FILE (*crtend*.o ) .dtors))
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ }
+ .jcr : { KEEP(*(.jcr)) }
+ .got : { *(.got.plt) *(.got) }
+ .data :
+ {
+ _fdata = .;
+ *(.data .data.* .gnu.linkonce.d.*)
+ SORT(CONSTRUCTORS)
+ }
+ .data1 : { *(.data1) }
+ _gp = ALIGN(16) + 0x7ff0;
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ }
+ /* Align the end of data segment to page boundary. */
+ . = ALIGN(. != 0 ? 4096 : 1);
+ _edata = .;
+ PROVIDE(edata = .);
+ __bss_start = .;
+ _fbss = .;
+ .sbss : ALIGN(8)
+ {
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ }
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.* .gnu.linkonce.b.*)
+ *(COMMON)
+ . = ALIGN(32 / 8);
+ }
+ . = ALIGN(32 / 8);
+ _end = .;
+ PROVIDE(end = .);
+ . = DATA_SEGMENT_END (.);
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF1 */
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF1 Extension */
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF2 */
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /DISCARD/ : { *(.note.GNU-stack) *(.reginfo) }
+}
diff --git a/ld/mips.c b/ld/mips.c
new file mode 100644
index 000000000000..59a92219a223
--- /dev/null
+++ b/ld/mips.c
@@ -0,0 +1,403 @@
+/*-
+ * Copyright (c) 2015 Serge Vakulenko
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "ld.h"
+#include "ld_arch.h"
+#include "ld_dynamic.h"
+#include "ld_input.h"
+#include "ld_output.h"
+#include "ld_reloc.h"
+#include "ld_symbols.h"
+#include "ld_utils.h"
+#include "mips.h"
+
+#define EF_MIPS_ABI2 0x00000020 /* n32 abi */
+#define EF_MIPS_ABI 0x00007000 /* Application binary interface */
+#define E_MIPS_ABI_O32 0x00001000 /* MIPS 32 bit ABI (UCODE) */
+#define E_MIPS_ABI_O64 0x00002000 /* UCODE MIPS 64 bit ABI */
+#define E_MIPS_ABI_EABI32 0x00003000 /* Embedded ABI for 32-bit */
+#define E_MIPS_ABI_EABI64 0x00004000 /* Embedded ABI for 64-bit */
+
+#define EF_MIPS_ASE_MDMX 0x08000000 /* MDMX multimedia extensions */
+#define EF_MIPS_ASE_M16 0x04000000 /* MIPS16e ISA extensions */
+#define EF_MIPS_ASE_MICROMIPS 0x02000000 /* MicroMIPS architecture */
+
+#define EF_MIPS_ARCH_1 0x00000000 /* MIPS I instruction set */
+#define EF_MIPS_ARCH_2 0x10000000 /* MIPS II instruction set */
+#define EF_MIPS_ARCH_3 0x20000000 /* MIPS III instruction set */
+#define EF_MIPS_ARCH_4 0x30000000 /* MIPS IV instruction set */
+#define EF_MIPS_ARCH_5 0x40000000 /* Never introduced */
+#define EF_MIPS_ARCH_32 0x50000000 /* Mips32 Revision 1 */
+#define EF_MIPS_ARCH_64 0x60000000 /* Mips64 Revision 1 */
+#define EF_MIPS_ARCH_32R2 0x70000000 /* Mips32 Revision 2 */
+#define EF_MIPS_ARCH_64R2 0x80000000 /* Mips64 Revision 2 */
+
+ELFTC_VCSID("$Id$");
+
+static void
+_scan_reloc(struct ld *ld, struct ld_input_section *is,
+ struct ld_reloc_entry *lre)
+{
+
+ (void) is;
+
+ switch (lre->lre_type) {
+
+ case R_MIPS_NONE:
+ case R_MIPS_32:
+ case R_MIPS_26:
+ case R_MIPS_PC16:
+ case R_MIPS_GPREL16:
+ case R_MIPS_HI16:
+ case R_MIPS_LO16:
+ break;
+
+ default:
+ ld_warn(ld, "can not handle relocation %ju",
+ lre->lre_type);
+ break;
+ }
+}
+
+static void
+_process_reloc(struct ld *ld, struct ld_input_section *is,
+ struct ld_reloc_entry *lre, struct ld_symbol *lsb, uint8_t *buf)
+{
+ struct ld_output *lo = ld->ld_output;
+ uint32_t pc, s;
+ int32_t a, v, la;
+ static uint64_t gp;
+ static char gp_name[] = "_gp";
+
+ assert(lo != NULL);
+
+ pc = lre->lre_offset + is->is_output->os_addr + is->is_reloff;
+ s = (uint32_t) lsb->lsb_value;
+ READ_32(buf + lre->lre_offset, a);
+
+ switch (lre->lre_type) {
+
+ case R_MIPS_NONE:
+ break;
+
+ case R_MIPS_32:
+ /* 32-bit byte address. */
+ v = s + a;
+ WRITE_32(buf + lre->lre_offset, v);
+ break;
+
+ case R_MIPS_26:
+ /* Word address at lower 26 bits. */
+ s += (a & 0x3ffffff) << 2;
+ v = (a & ~0x3ffffff) | ((s >> 2) & 0x3ffffff);
+ WRITE_32(buf + lre->lre_offset, v);
+ break;
+
+ case R_MIPS_PC16:
+ /* PC-relative word address at lower 16 bits. */
+ s += ((a & 0xffff) << 2) - pc;
+ v = (a & ~0xffff) | ((s >> 2) & 0xffff);
+ WRITE_32(buf + lre->lre_offset, v);
+ break;
+
+ case R_MIPS_GPREL16:
+ /* GP-relative byte address at lower 16 bits. */
+ if (! gp && ld_symbols_get_value(ld, gp_name, &gp) < 0)
+ ld_fatal(ld, "symbol _gp is undefined");
+
+ s += (int16_t)(a & 0xffff) - gp;
+ v = (a & ~0xffff) | (s & 0xffff);
+ WRITE_32(buf + lre->lre_offset, v);
+ break;
+
+ case R_MIPS_HI16:
+ /* 16-bit high part of address pair. */
+ if (! STAILQ_NEXT(lre, lre_next) ||
+ STAILQ_NEXT(lre, lre_next)->lre_type != R_MIPS_LO16)
+ ld_fatal(ld, "no LO16 after HI16 relocation");
+ READ_32(buf + STAILQ_NEXT(lre, lre_next)->lre_offset, la);
+ s += (a << 16) + (int16_t)la;
+ v = (a & ~0xffff) | (((s - (int16_t)s) >> 16) & 0xffff);
+ WRITE_32(buf + lre->lre_offset, v);
+ break;
+
+ case R_MIPS_LO16:
+ /* 16-bit low part of address pair. */
+ s += (int16_t)a;
+ v = (a & ~0xffff) | (s & 0xffff);
+ WRITE_32(buf + lre->lre_offset, v);
+ break;
+
+ default:
+ ld_fatal(ld, "Relocation %d not supported", lre->lre_type);
+ break;
+ }
+}
+
+/*
+ * Map flags into a valid MIPS architecture level value.
+ */
+static unsigned
+_map_arch(unsigned flags)
+{
+ flags &= EF_MIPS_ARCH;
+
+ switch (flags) {
+ default:
+ case EF_MIPS_ARCH_1:
+ return EF_MIPS_ARCH_1;
+ case EF_MIPS_ARCH_2:
+ case EF_MIPS_ARCH_3:
+ case EF_MIPS_ARCH_4:
+ case EF_MIPS_ARCH_5:
+ case EF_MIPS_ARCH_32:
+ case EF_MIPS_ARCH_64:
+ case EF_MIPS_ARCH_32R2:
+ case EF_MIPS_ARCH_64R2:
+ return flags;
+ }
+}
+
+/*
+ * Merge architecture levels of two files.
+ */
+static unsigned
+_merge_arch(unsigned old_arch, unsigned new_arch)
+{
+ unsigned base, extended;
+
+ if (old_arch < new_arch) {
+ base = old_arch;
+ extended = new_arch;
+ } else if (old_arch > new_arch) {
+ base = new_arch;
+ extended = old_arch;
+ } else
+ return old_arch;
+
+ switch (extended) {
+ default:
+ case EF_MIPS_ARCH_1:
+ case EF_MIPS_ARCH_2:
+ case EF_MIPS_ARCH_3:
+ case EF_MIPS_ARCH_4:
+ case EF_MIPS_ARCH_5:
+ return extended;
+
+ case EF_MIPS_ARCH_32:
+ if (base <= EF_MIPS_ARCH_2)
+ return EF_MIPS_ARCH_32;
+ return EF_MIPS_ARCH_64;
+
+ case EF_MIPS_ARCH_64:
+ return EF_MIPS_ARCH_64;
+
+ case EF_MIPS_ARCH_32R2:
+ if (base <= EF_MIPS_ARCH_2 || base == EF_MIPS_ARCH_32)
+ return EF_MIPS_ARCH_32R2;
+ return EF_MIPS_ARCH_64R2;
+
+ case EF_MIPS_ARCH_64R2:
+ return EF_MIPS_ARCH_64R2;
+ }
+}
+
+static const char*
+_abi_name(int flags)
+{
+ switch (flags & EF_MIPS_ABI) {
+ case 0:
+ return (flags & EF_MIPS_ABI2) ? "N32" : "none";
+ case E_MIPS_ABI_O32:
+ return "O32";
+ case E_MIPS_ABI_O64:
+ return "O64";
+ case E_MIPS_ABI_EABI32:
+ return "EABI32";
+ case E_MIPS_ABI_EABI64:
+ return "EABI64";
+ default:
+ return "Unknown";
+ }
+}
+
+/*
+ * Merge options of application binary interface.
+ */
+static unsigned
+_merge_abi(struct ld *ld, unsigned new_flags)
+{
+ int old = ld->ld_arch->flags & EF_MIPS_ABI;
+ int new = new_flags & EF_MIPS_ABI;
+
+ if (old == 0)
+ return new;
+
+ if (new != old && new != 0)
+ ld_fatal(ld, "ABI mismatch: linking '%s' module with previous '%s' modules",
+ _abi_name(new_flags), _abi_name(ld->ld_arch->flags));
+
+ return old;
+}
+
+/*
+ * Merge options of application-specific extensions.
+ */
+static unsigned
+_merge_ase(struct ld *ld, unsigned new_flags)
+{
+ int old_micro = ld->ld_arch->flags & EF_MIPS_ASE_MICROMIPS;
+ int new_micro = new_flags & EF_MIPS_ASE_MICROMIPS;
+ int old_m16 = ld->ld_arch->flags & EF_MIPS_ASE_M16;
+ int new_m16 = new_flags & EF_MIPS_ASE_M16;
+
+ if ((old_m16 && new_micro) || (old_micro && new_m16))
+ ld_fatal(ld, "ASE mismatch: linking '%s' module with previous '%s' modules",
+ new_m16 ? "MIPS16" : "microMIPS",
+ old_micro ? "microMIPS" : "MIPS16");
+ return old_micro | new_micro | old_m16 | new_m16;
+}
+
+/*
+ * Merge architecture-specific flags of the file to be linked
+ * into a resulting value for output file.
+ */
+static void
+_merge_flags(struct ld *ld, unsigned new_flags)
+{
+ struct ld_arch *la = ld->ld_arch;
+ unsigned value;
+
+ /* At least one .noreorder directive appeared in the source. */
+ la->flags |= new_flags & EF_MIPS_NOREORDER;
+
+ /* Merge position-independent flags. */
+ if (((new_flags & (EF_MIPS_PIC | EF_MIPS_CPIC)) != 0) !=
+ ((la->flags & (EF_MIPS_PIC | EF_MIPS_CPIC)) != 0))
+ ld_warn(ld, "linking PIC files with non-PIC files");
+ if (new_flags & (EF_MIPS_PIC | EF_MIPS_CPIC))
+ la->flags |= EF_MIPS_CPIC;
+ if (! (new_flags & EF_MIPS_PIC))
+ la->flags &= ~EF_MIPS_PIC;
+
+ /* Merge architecture level. */
+ value = _merge_arch(_map_arch(la->flags), _map_arch(new_flags));
+ la->flags &= ~EF_MIPS_ARCH;
+ la->flags |= value;
+
+ /* Merge ABI options. */
+ value = _merge_abi(ld, new_flags);
+ la->flags &= ~EF_MIPS_ABI;
+ la->flags |= value;
+
+ /* Merge application-specific extensions. */
+ value = _merge_ase(ld, new_flags);
+ la->flags &= ~EF_MIPS_ARCH_ASE;
+ la->flags |= value;
+}
+
+static uint64_t
+_get_max_page_size(struct ld *ld)
+{
+
+ (void) ld;
+
+ return 0x1000;
+}
+
+static uint64_t
+_get_common_page_size(struct ld *ld)
+{
+
+ (void) ld;
+
+ return 0x1000;
+}
+
+static int
+_is_absolute_reloc(uint64_t r)
+{
+ if (r == R_MIPS_32)
+ return 1;
+
+ return 0;
+}
+
+static int
+_is_relative_reloc(uint64_t r)
+{
+ if (r == R_MIPS_REL32)
+ return 1;
+
+ return 0;
+}
+
+void
+mips_register(struct ld *ld)
+{
+ struct ld_arch *mips_little_endian, *mips_big_endian;
+
+ if ((mips_little_endian = calloc(1, sizeof(*mips_little_endian))) == NULL)
+ ld_fatal_std(ld, "calloc");
+ if ((mips_big_endian = calloc(1, sizeof(*mips_big_endian))) == NULL)
+ ld_fatal_std(ld, "calloc");
+
+ /*
+ * Little endian.
+ */
+ snprintf(mips_little_endian->name, sizeof(mips_little_endian->name), "%s", "littlemips");
+
+ mips_little_endian->script = littlemips_script;
+ mips_little_endian->get_max_page_size = _get_max_page_size;
+ mips_little_endian->get_common_page_size = _get_common_page_size;
+ mips_little_endian->scan_reloc = _scan_reloc;
+ mips_little_endian->process_reloc = _process_reloc;
+ mips_little_endian->is_absolute_reloc = _is_absolute_reloc;
+ mips_little_endian->is_relative_reloc = _is_relative_reloc;
+ mips_little_endian->merge_flags = _merge_flags;
+ mips_little_endian->reloc_is_64bit = 0;
+ mips_little_endian->reloc_is_rela = 0;
+ mips_little_endian->reloc_entsize = sizeof(Elf32_Rel);
+
+ /*
+ * Big endian.
+ */
+ snprintf(mips_big_endian->name, sizeof(mips_big_endian->name), "%s", "bigmips");
+
+ mips_big_endian->script = bigmips_script;
+ mips_big_endian->get_max_page_size = _get_max_page_size;
+ mips_big_endian->get_common_page_size = _get_common_page_size;
+ mips_big_endian->scan_reloc = _scan_reloc;
+ mips_big_endian->process_reloc = _process_reloc;
+ mips_big_endian->is_absolute_reloc = _is_absolute_reloc;
+ mips_big_endian->is_relative_reloc = _is_relative_reloc;
+ mips_little_endian->merge_flags = _merge_flags;
+ mips_big_endian->reloc_is_64bit = 0;
+ mips_big_endian->reloc_is_rela = 0;
+ mips_big_endian->reloc_entsize = sizeof(Elf32_Rel);
+
+ HASH_ADD_STR(ld->ld_arch_list, name, mips_little_endian);
+ HASH_ADD_STR(ld->ld_arch_list, name, mips_big_endian);
+}
diff --git a/ld/mips.h b/ld/mips.h
new file mode 100644
index 000000000000..90de4aa7fa94
--- /dev/null
+++ b/ld/mips.h
@@ -0,0 +1,29 @@
+/*-
+ * Copyright (c) 2015 Serge Vakulenko
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+char *littlemips_script;
+char *bigmips_script;
+
+void mips_register(struct ld *);
diff --git a/libdwarf/_libdwarf.h b/libdwarf/_libdwarf.h
index e6eb496feed1..6658d2d2f6f4 100644
--- a/libdwarf/_libdwarf.h
+++ b/libdwarf/_libdwarf.h
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: _libdwarf.h 3164 2015-02-19 01:20:12Z kaiwang27 $
+ * $Id: _libdwarf.h 3298 2016-01-09 15:43:31Z jkoshy $
*/
#ifndef __LIBDWARF_H_
@@ -92,8 +92,8 @@ extern struct _libdwarf_globals _libdwarf;
typedef struct _Dwarf_CU *Dwarf_CU;
struct _Dwarf_AttrDef {
- uint64_t ad_attrib; /* DW_AT_XXX */
- uint64_t ad_form; /* DW_FORM_XXX */
+ Dwarf_Half ad_attrib; /* DW_AT_XXX */
+ Dwarf_Half ad_form; /* DW_FORM_XXX */
uint64_t ad_offset; /* Offset in abbrev section. */
STAILQ_ENTRY(_Dwarf_AttrDef) ad_next; /* Next attribute define. */
};
@@ -102,8 +102,8 @@ struct _Dwarf_Attribute {
Dwarf_Die at_die; /* Ptr to containing DIE. */
Dwarf_Die at_refdie; /* Ptr to reference DIE. */
uint64_t at_offset; /* Offset in info section. */
- uint64_t at_attrib; /* DW_AT_XXX */
- uint64_t at_form; /* DW_FORM_XXX */
+ Dwarf_Half at_attrib; /* DW_AT_XXX */
+ Dwarf_Half at_form; /* DW_FORM_XXX */
int at_indirect; /* Has indirect form. */
union {
uint64_t u64; /* Unsigned value. */
diff --git a/libdwarf/dwarf.3 b/libdwarf/dwarf.3
index dbb417908094..863bee6dcfdf 100644
--- a/libdwarf/dwarf.3
+++ b/libdwarf/dwarf.3
@@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
-.\" $Id: dwarf.3 3195 2015-05-12 17:22:19Z emaste $
+.\" $Id: dwarf.3 3295 2016-01-08 22:08:10Z jkoshy $
.\"
.Dd December 21, 2014
.Os
@@ -110,9 +110,7 @@ A pointer to an error handling function.
.It Vt Dwarf_Line
A descriptor for a source line.
.It Vt Dwarf_Off
-An unsigned file offset, corresponding to an
-.Vt off_t
-type supported by the underlying operating system.
+An unsigned file offset.
.It Vt Dwarf_P_Expr
A descriptor for a location expression.
.It Vt Dwarf_Ptr
diff --git a/libdwarf/dwarf_str.c b/libdwarf/dwarf_str.c
index 71a7f75b2842..c402f2181973 100644
--- a/libdwarf/dwarf_str.c
+++ b/libdwarf/dwarf_str.c
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: dwarf_str.c 2075 2011-10-27 03:47:28Z jkoshy $");
+ELFTC_VCSID("$Id: dwarf_str.c 3295 2016-01-08 22:08:10Z jkoshy $");
int
dwarf_get_str(Dwarf_Debug dbg, Dwarf_Off offset, char **string,
@@ -34,7 +34,7 @@ dwarf_get_str(Dwarf_Debug dbg, Dwarf_Off offset, char **string,
{
Dwarf_Section *ds;
- if (dbg == NULL || offset < 0 || string == NULL || ret_strlen == NULL) {
+ if (dbg == NULL || string == NULL || ret_strlen == NULL) {
DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
return (DW_DLV_ERROR);
}
@@ -45,12 +45,12 @@ dwarf_get_str(Dwarf_Debug dbg, Dwarf_Off offset, char **string,
return (DW_DLV_NO_ENTRY);
}
- if ((Dwarf_Unsigned) offset > ds->ds_size) {
+ if (offset > ds->ds_size) {
DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
return (DW_DLV_ERROR);
}
- if ((Dwarf_Unsigned) offset == ds->ds_size) {
+ if (offset == ds->ds_size) {
DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
return (DW_DLV_NO_ENTRY);
}
diff --git a/libdwarf/libdwarf.h b/libdwarf/libdwarf.h
index 0cb8b1ae8cbc..02f0ce5f98df 100644
--- a/libdwarf/libdwarf.h
+++ b/libdwarf/libdwarf.h
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: libdwarf.h 3174 2015-03-27 17:13:41Z emaste $
+ * $Id: libdwarf.h 3295 2016-01-08 22:08:10Z jkoshy $
*/
#ifndef _LIBDWARF_H_
@@ -33,7 +33,7 @@
#include <libelf.h>
typedef int Dwarf_Bool;
-typedef off_t Dwarf_Off;
+typedef uint64_t Dwarf_Off;
typedef uint64_t Dwarf_Unsigned;
typedef uint16_t Dwarf_Half;
typedef uint8_t Dwarf_Small;
diff --git a/libdwarf/libdwarf_rw.c b/libdwarf/libdwarf_rw.c
index 8cb455124f4a..f0286d5fa831 100644
--- a/libdwarf/libdwarf_rw.c
+++ b/libdwarf/libdwarf_rw.c
@@ -27,7 +27,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_rw.c 2952 2013-06-26 19:09:40Z kaiwang27 $");
+ELFTC_VCSID("$Id: libdwarf_rw.c 3286 2015-12-31 16:45:46Z emaste $");
uint64_t
_dwarf_read_lsb(uint8_t *data, uint64_t *offsetp, int bytes_to_read)
@@ -42,10 +42,13 @@ _dwarf_read_lsb(uint8_t *data, uint64_t *offsetp, int bytes_to_read)
case 8:
ret |= ((uint64_t) src[4]) << 32 | ((uint64_t) src[5]) << 40;
ret |= ((uint64_t) src[6]) << 48 | ((uint64_t) src[7]) << 56;
+ /* FALLTHROUGH */
case 4:
ret |= ((uint64_t) src[2]) << 16 | ((uint64_t) src[3]) << 24;
+ /* FALLTHROUGH */
case 2:
ret |= ((uint64_t) src[1]) << 8;
+ /* FALLTHROUGH */
case 1:
ret |= src[0];
break;
@@ -71,10 +74,13 @@ _dwarf_decode_lsb(uint8_t **data, int bytes_to_read)
case 8:
ret |= ((uint64_t) src[4]) << 32 | ((uint64_t) src[5]) << 40;
ret |= ((uint64_t) src[6]) << 48 | ((uint64_t) src[7]) << 56;
+ /* FALLTHROUGH */
case 4:
ret |= ((uint64_t) src[2]) << 16 | ((uint64_t) src[3]) << 24;
+ /* FALLTHROUGH */
case 2:
ret |= ((uint64_t) src[1]) << 8;
+ /* FALLTHROUGH */
case 1:
ret |= src[0];
break;
@@ -171,11 +177,14 @@ _dwarf_write_lsb(uint8_t *data, uint64_t *offsetp, uint64_t value,
dst[6] = (value >> 48) & 0xff;
dst[5] = (value >> 40) & 0xff;
dst[4] = (value >> 32) & 0xff;
+ /* FALLTHROUGH */
case 4:
dst[3] = (value >> 24) & 0xff;
dst[2] = (value >> 16) & 0xff;
+ /* FALLTHROUGH */
case 2:
dst[1] = (value >> 8) & 0xff;
+ /* FALLTHROUGH */
case 1:
dst[0] = value & 0xff;
break;
@@ -222,13 +231,16 @@ _dwarf_write_msb(uint8_t *data, uint64_t *offsetp, uint64_t value,
dst[5] = (value >> 16) & 0xff;
dst[4] = (value >> 24) & 0xff;
value >>= 32;
+ /* FALLTHROUGH */
case 4:
dst[3] = value & 0xff;
dst[2] = (value >> 8) & 0xff;
value >>= 16;
+ /* FALLTHROUGH */
case 2:
dst[1] = value & 0xff;
value >>= 8;
+ /* FALLTHROUGH */
case 1:
dst[0] = value & 0xff;
break;
diff --git a/libdwarf/os.NetBSD.mk b/libdwarf/os.NetBSD.mk
new file mode 100644
index 000000000000..ae214e3115c0
--- /dev/null
+++ b/libdwarf/os.NetBSD.mk
@@ -0,0 +1,2 @@
+# TODO(#511): Revert after the source tree is -Wconversion clean.
+WARNS=5
diff --git a/libelftc/Makefile b/libelftc/Makefile
index a5fc2975097f..4af496b0b574 100644
--- a/libelftc/Makefile
+++ b/libelftc/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile 2859 2013-01-05 09:21:54Z jkoshy $
+# $Id: Makefile 3292 2016-01-06 21:46:32Z jkoshy $
TOP= ${.CURDIR}/..
@@ -45,16 +45,7 @@ MLINKS= elftc_bfd_find_target.3 elftc_bfd_target_byteorder.3 \
elftc_string_table_create.3 elftc_string_table_destroy.3 \
elftc_string_table_create.3 elftc_string_table_image.3 \
elftc_string_table_create.3 elftc_string_table_insert.3 \
- elftc_string_table_create.3 elftc_string_table_lookup.3 \
- elftc_symbol_table_create.3 elftc_symbol_table_create_nested.3 \
- elftc_symbol_table_create.3 elftc_symbol_table_delete_name.3 \
- elftc_symbol_table_create.3 elftc_symbol_table_delete_entry.3 \
- elftc_symbol_table_create.3 elftc_symbol_table_destroy.3 \
- elftc_symbol_table_create.3 elftc_symbol_table_from_section.3 \
- elftc_symbol_table_create.3 elftc_symbol_table_insert.3 \
- elftc_symbol_table_create.3 elftc_symbol_table_iterate.3 \
- elftc_symbol_table_create.3 elftc_symbol_table_lookup.3 \
- elftc_symbol_table_create.3 elftc_symbol_table_to_image.3
+ elftc_string_table_create.3 elftc_string_table_lookup.3
.if !make(clean) && !make(clobber)
.BEGIN: .SILENT
diff --git a/libelftc/elftc_bfd_find_target.3 b/libelftc/elftc_bfd_find_target.3
index 851ae314ea7e..20dea3cb97d9 100644
--- a/libelftc/elftc_bfd_find_target.3
+++ b/libelftc/elftc_bfd_find_target.3
@@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
-.\" $Id: elftc_bfd_find_target.3 2251 2011-11-30 16:50:06Z jkoshy $
+.\" $Id: elftc_bfd_find_target.3 3348 2016-01-18 14:18:50Z emaste $
.\"
.Dd November 30, 2011
.Os
@@ -58,9 +58,11 @@ Binary object descriptors encapsulate properties of an object format
such as its file representation, ELF class, and byte endianness.
.Pp
Known descriptor names and their properties include:
-.Bl -column -offset "XXXX" ".Li elf32-x86-64-freebsd" "Object format" "Byte Order" "ELF Class"
-.It Em Name Ta Em "Object Format" Ta Em "Byte Order" Ta Em "ELF Class"
+.Bl -column -offset "XXXX" ".Li elf32-x86-64-freebsd" "Object format" "Byte Order" "Bit Width"
+.It Em Name Ta Em "Object Format" Ta Em "Byte Order" Ta Em "Bit Width"
.It Li binary Ta Binary Ta - Ta -
+.It Li efi-app-ia32 Ta PE Ta LSB Ta 32
+.It Li efi-app-x86_64 Ta PE Ta LSB Ta 64
.It Li elf32-avr Ta ELF Ta LSB Ta 32
.It Li elf32-big Ta ELF Ta MSB Ta 32
.It Li elf32-bigarm Ta ELF Ta MSB Ta 32
@@ -101,6 +103,8 @@ Known descriptor names and their properties include:
.It Li elf64-x86-64 Ta ELF Ta LSB Ta 64
.It Li elf64-x86-64-freebsd Ta ELF Ta LSB Ta 64
.It Li ihex Ta IHEX Ta - Ta -
+.It Li pei-i386 Ta PE Ta LSB Ta 32
+.It Li pei-x86-64 Ta PE Ta LSB Ta 64
.It Li srec Ta SREC Ta - Ta -
.It Li symbolsrec Ta SREC Ta - Ta -
.El
diff --git a/libelftc/elftc_copyfile.c b/libelftc/elftc_copyfile.c
index 7df1678e702d..dac9c145beed 100644
--- a/libelftc/elftc_copyfile.c
+++ b/libelftc/elftc_copyfile.c
@@ -37,7 +37,7 @@
#include <sys/mman.h>
#endif
-ELFTC_VCSID("$Id: elftc_copyfile.c 2981 2014-02-01 02:41:13Z jkoshy $");
+ELFTC_VCSID("$Id: elftc_copyfile.c 3297 2016-01-09 15:26:34Z jkoshy $");
/*
* Copy the contents referenced by 'ifd' to 'ofd'. Returns 0 on
@@ -47,11 +47,11 @@ ELFTC_VCSID("$Id: elftc_copyfile.c 2981 2014-02-01 02:41:13Z jkoshy $");
int
elftc_copyfile(int ifd, int ofd)
{
+ size_t file_size, n;
int buf_mmapped;
struct stat sb;
char *b, *buf;
- ssize_t nw;
- size_t n;
+ ssize_t nr, nw;
/* Determine the input file's size. */
if (fstat(ifd, &sb) < 0)
@@ -63,12 +63,13 @@ elftc_copyfile(int ifd, int ofd)
buf = NULL;
buf_mmapped = 0;
+ file_size = (size_t) sb.st_size;
#if ELFTC_HAVE_MMAP
/*
* Prefer mmap() if it is available.
*/
- buf = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, ifd, (off_t) 0);
+ buf = mmap(NULL, file_size, PROT_READ, MAP_SHARED, ifd, (off_t) 0);
if (buf != MAP_FAILED)
buf_mmapped = 1;
else
@@ -80,24 +81,27 @@ elftc_copyfile(int ifd, int ofd)
* failed, allocate a buffer, and read in input data.
*/
if (buf_mmapped == false) {
- if ((buf = malloc(sb.st_size)) == NULL)
- return (-1);
- if (read(ifd, buf, sb.st_size) != sb.st_size) {
- free(buf);
+ if ((buf = malloc(file_size)) == NULL)
return (-1);
+ b = buf;
+ for (n = file_size; n > 0; n -= (size_t) nr, b += nr) {
+ if ((nr = read(ifd, b, n)) < 0) {
+ free(buf);
+ return (-1);
+ }
}
}
/*
* Write data to the output file descriptor.
*/
- for (n = sb.st_size, b = buf; n > 0; n -= nw, b += nw)
+ for (n = file_size, b = buf; n > 0; n -= (size_t) nw, b += nw)
if ((nw = write(ofd, b, n)) <= 0)
break;
/* Release the input buffer. */
#if ELFTC_HAVE_MMAP
- if (buf_mmapped && munmap(buf, sb.st_size) < 0)
+ if (buf_mmapped && munmap(buf, file_size) < 0)
return (-1);
#endif
diff --git a/libelftc/elftc_demangle.c b/libelftc/elftc_demangle.c
index ff3095504286..945f777791be 100644
--- a/libelftc/elftc_demangle.c
+++ b/libelftc/elftc_demangle.c
@@ -33,10 +33,10 @@
#include "_libelftc.h"
-ELFTC_VCSID("$Id: elftc_demangle.c 3174 2015-03-27 17:13:41Z emaste $");
+ELFTC_VCSID("$Id: elftc_demangle.c 3296 2016-01-09 14:17:28Z jkoshy $");
-static int
-is_mangled(const char *s, int style)
+static unsigned int
+is_mangled(const char *s, unsigned int style)
{
switch (style) {
@@ -58,7 +58,7 @@ is_mangled(const char *s, int style)
}
static char *
-demangle(const char *s, int style, int rc)
+demangle(const char *s, unsigned int style, unsigned int rc)
{
(void) rc; /* XXX */
@@ -76,7 +76,7 @@ int
elftc_demangle(const char *mangledname, char *buffer, size_t bufsize,
unsigned int flags)
{
- int style, rc;
+ unsigned int style, rc;
char *rlt;
style = flags & 0xFFFF;
diff --git a/libelftc/elftc_symbol_table_create.3 b/libelftc/elftc_symbol_table_create.3
deleted file mode 100644
index 76f90e9c643d..000000000000
--- a/libelftc/elftc_symbol_table_create.3
+++ /dev/null
@@ -1,529 +0,0 @@
-.\" Copyright (c) 2012 Joseph Koshy. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" This software is provided by Joseph Koshy ``as is'' and
-.\" any express or implied warranties, including, but not limited to, the
-.\" implied warranties of merchantability and fitness for a particular purpose
-.\" are disclaimed. in no event shall Joseph Koshy be liable
-.\" for any direct, indirect, incidental, special, exemplary, or consequential
-.\" damages (including, but not limited to, procurement of substitute goods
-.\" or services; loss of use, data, or profits; or business interruption)
-.\" however caused and on any theory of liability, whether in contract, strict
-.\" liability, or tort (including negligence or otherwise) arising in any way
-.\" out of the use of this software, even if advised of the possibility of
-.\" such damage.
-.\"
-.\" $Id: elftc_symbol_table_create.3 3182 2015-04-10 16:08:10Z emaste $
-.\"
-.Dd December 29, 2012
-.Os
-.Dt ELFTC_SYMBOL_TABLE_CREATE 3
-.Sh NAME
-.Nm elftc_elf_symbol_table_from_section ,
-.Nm elftc_symbol_table_count ,
-.Nm elftc_symbol_table_create ,
-.Nm elftc_symbol_table_create_nested ,
-.Nm elftc_symbol_table_delete_name ,
-.Nm elftc_symbol_table_delete_entry ,
-.Nm elftc_symbol_table_destroy ,
-.Nm elftc_symbol_table_insert ,
-.Nm elftc_symbol_table_iterate ,
-.Nm elftc_symbol_table_lookup ,
-.Nm elftc_symbol_table_lookup_value ,
-.Nm elftc_symbol_table_replace ,
-.Nm elftc_symbol_table_sort ,
-.Nm elftc_symbol_table_step
-.Nd symbol table management routines
-.Sh SYNOPSIS
-.In libelftc.h
-.Bd -literal
-typedef struct _Elftc_Symbol_Table Elftc_Symbol_Table;
-
-typedef struct _Elftc_Symbol {
- ... library private fields ...
- const char *sym_name;
- uintptr_t sym_value;
-} Elftc_Symbol;
-.Ed
-.Ft size_t
-.Fn elftc_symbol_table_count "Elftc_Symbol_Table *table"
-.Ft "Elftc_Symbol_Table *"
-.Fo elftc_symbol_table_create
-.Fa "size_t entrysize"
-.Fa "int sizehint"
-.Fc
-.Ft "Elftc_Symbol_Table *"
-.Fo elftc_symbol_table_create_nested
-.Fa "Elftc_Symbol_Table *table"
-.Fa "int sizehint"
-.Fc
-.Ft int
-.Fo elftc_symbol_table_delete_name
-.Fa "Elftc_Symbol_Table *table"
-.Fa "const char *name"
-.Fc
-.Ft int
-.Fo elftc_symbol_table_delete_entry
-.Fa "Elftc_Symbol_Table *table"
-.Fa "Elftc_Symbol *entry"
-.Fc
-.Ft int
-.Fn elftc_symbol_table_destroy "Elftc_Symbol_Table *table"
-.Ft "Elftc_Symbol *entry"
-.Fo elftc_symbol_table_insert
-.Fa "Elftc_Symbol_Table *table"
-.Fa "const char *symbolname"
-.Fa "int *status"
-.Fc
-.Ft int
-.Fo elftc_symbol_table_iterate
-.Fa "Elftc_Symbol_Table *table"
-.Fa "int (*iterfn)(Elftc_Symbol *entry, void *cookie)"
-.Fa "void *cookie"
-.Fc
-.Ft "Elftc_Symbol *"
-.Fo elftc_symbol_table_lookup
-.Fa "Elftc_Symbol_Table *table"
-.Fa "const char *symbolname"
-.Fc
-.Ft "Elftc_Elf_Symbol *"
-.Fo elftc_symbol_table_lookup_value
-.Fa "Elftc_Symbol_Table *table"
-.Fa "uintptr_t value"
-.Fa "int searchflags"
-.Fc
-.Ft int
-.Fo elftc_symbol_table_replace
-.Fa "Elftc_Symbol_Table *table"
-.Fa "Elftc_Symbol *sym1"
-.Fa "Elftc_Symbol *sym2"
-.Fc
-.Ft int
-.Fo elftc_symbol_table_sort
-.Fa "Elftc_Symbol_Table *table"
-.Fa "int (*cmpfn)(Elftc_Symbol *s1, Elftc_Symbol *s2)"
-.Fc
-.Ft "Elftc_Symbol *"
-.Fo elftc_symbol_table_step
-.Fa "Elftc_Symbol_Table *table"
-.Fa "Elftc_Symbol *cursym"
-.Fa "int direction"
-.Fc
-.Bd -literal
-typedef struct _Elftc_Elf_Symbol {
- ... library private fields ...
- const char *sym_name;
- Gelf_Sym sym_elf;
-} Elftc_Elf_Symbol;
-.Ed
-.Ft "Elftc_Symbol_Table *"
-.Fo elftc_elf_symbol_table_from_section
-.Fa "Elf_Scn *symscn"
-.Fa "Elf_Scn *strscn"
-.Fc
-.Sh DESCRIPTION
-This manual page documents convenience routines for handling symbol
-tables.
-Two flavors of symbol tables are supported:
-.Bl -bullet -compact
-.It
-.Dq Regular
-symbol tables supporting insertion, deletion and lookup of entries by
-name or by value, sorting of entries, and stepping through entries in
-the table's current traversal order.
-.It
-.Dq ELF-centric
-symbol tables support additional operations for conversions to and
-from the symbol table format understood by
-.Lb libelf .
-.El
-The default traversal order for a symbol table is the order in which
-entries were inserted into it.
-This traversal order may be changed using function
-.Fn elftc_symbol_table_sort .
-.Ss Operations on Regular Symbol Tables
-Regular symbol tables use symbols that are subtypes of
-.Vt Elftc_Symbol ,
-as described in the section
-.Sx "Structure of a Symbol Table Entry"
-below.
-.Pp
-Function
-.Fn elftc_symbol_table_count
-returns the number of entries currently in the symbol table.
-.Pp
-Function
-.Fn elftc_symbol_table_create
-creates a new, empty symbol table.
-The argument
-.Ar entrysize
-specifies the size of each symbol table entry, as described
-in the section
-.Sx "Structure of a Symbol Table Entry"
-below.
-The argument
-.Ar sizehint
-specifies the expected number of symbol table entries.
-If
-.Ar sizehint
-is zero, an implementation-defined default will be used.
-.Pp
-Function
-.Fn elftc_symbol_table_create_nested
-creates a symbol table whose search scope nests inside that of a
-parent symbol table.
-The argument
-.Ar parent
-specifies the parent symbol table to nest under.
-The argument
-.Ar sizehint
-specifies the expected number of symbol table entries.
-If
-.Ar sizehint
-is zero, an implementation-defined default will be used instead.
-.Pp
-The function
-.Fn elftc_symbol_table_delete_name
-removes the symbol entry named by the argument
-.Ar name
-from the symbol table specified by argument
-.Ar table ,
-according to the rules described in section
-.Sx "Symbol Search Rules" .
-.Pp
-The function
-.Fn elftc_symbol_table_delete_entry
-removes the symbol table entry specified by argument
-.Ar entry
-from the symbol table specified by argument
-.Ar table .
-.Pp
-Function
-.Fn elftc_symbol_table_destroy
-is used to destroy a symbol table and free up its internal
-resources.
-.Pp
-The function
-.Fn elftc_symbol_table_insert
-inserts a symbol entry for the name specified by argument
-.Ar symbolname
-into the symbol table specified by argument
-.Ar table ,
-returning a pointer to a symbol table entry.
-The argument
-.Ar status
-should point to a location that will be updated with one of
-the following values:
-.Bl -tag -width indent -compact -offset indent
-.It Dv ELFTC_INSERT_ERROR
-An error occurred during insertion of the symbol.
-.It Dv ELFTC_INSERT_EXISTING
-The name in argument
-.Ar symbolname
-was already in the symbol table, and a pointer to the existing
-symbol table entry is being returned.
-.It Dv ELFTC_INSERT_NEW
-A new symbol table entry was allocated for the symbol name
-in
-.Ar symbolname .
-The application will need to initialize the application-specific
-fields of the symbol table entry.
-.El
-Insertion obeys the scoping rules described in section
-.Sx "Symbol Search Rules" .
-.Pp
-The function
-.Fn elftc_symbol_table_iterate
-iterates over the symbol table specifed by argument
-.Ar table ,
-applying the function pointed to by argument
-.Ar iterfn
-to each symbol table entry.
-The return value from the function
-.Ar iterfn
-controls progress of the iteration:
-.Bl -tag -width indent -compact -offset indent
-.It Dv ELFTC_ITERATE_ABORT
-Terminates the iteration.
-.It Dv ELFTC_ITERATE_CONTINUE
-Iteration will continue on to the next element in the symbol table.
-.El
-Argument
-.Ar cookie
-will be passed to each invocation of
-.Ar iterfn ,
-and may be used to track persistent state.
-The ordering of symbol table entries presented to function
-.Ar iterfn
-is not defined.
-The behavior of the iteration is undefined if
-.Ar iterfn
-adds or deletes symbol entries from a symbol table that currently
-being iterated through.
-.Pp
-Function
-.Fn elftc_symbol_table_lookup
-returns the symbol entry corresponding to the name of the symbol
-in argument
-.Ar symbolname .
-.Pp
-Function
-.Fn elftc_symbol_table_lookup_value
-returns the symbol entry that has a
-.Va sym_value
-field that is closest to the value specified in argument
-.Ar value .
-The argument
-.Ar table
-should point to a symbol table, that has been sorted
-by a prior call to
-.Fn elftc_symbol_table_sort .
-The argument
-.Ar searchflags
-can be a combination of the following flags:
-.Bl -tag -width indent -compact -offset indent
-.It Dv ELFTC_SEARCH_FORWARD
-Find the symbol entry with the next higher value in its
-.Va sym_value
-field.
-.It Dv ELFTC_SEARCH_BACKWARD
-Find the symbol entry with next lower value in its
-.Va sym_value
-field.
-.El
-If both
-.Dv ELFTC_SEARCH_FORWARD
-and
-.Dv ELFTC_SEARCH_BACKWARD
-are specified, then this function will return the symbol that is
-closest to the argument
-.Ar value .
-.Pp
-Function
-.Fn elftc_symbol_table_replace
-moves the symbol table entry pointed to by argument
-.Ar sym2
-into the traversal position for the entry pointed to by
-.Ar sym1 ,
-and implicitly deletes the entry pointed to by argument
-.Ar sym1 .
-Argument
-.Ar table
-should point to a valid symbol table.
-.Pp
-Function
-.Fn elftc_symbol_table_sort
-is used to define an ordering of symbol entries in a symbol
-table.
-This ordering will be associated with the symbol table till the next
-call to function
-.Fn elftc_symbol_table_insert ,
-.Fn elftc_symbol_table_delete_name
-or
-.Fn elftc_symbol_table_delete_entry .
-The argument
-.Ar cmpfn
-should point to a function that compares two symbol entries pointed
-to by
-.Ar s1
-and
-.Ar s2
-and returns -1, 0, or 1, depending whether
-.Ar s1
-is less, equal to, or greater than
-.Ar s2
-respectively.
-.Pp
-Function
-.Fn elftc_symbol_table_step
-is used to step to the next symbol in a sorted symbol table.
-Argument
-.Ar table
-should point to a symbol table.
-The argument
-.Ar cursym
-specifies the current symbol.
-The argument
-.Ar direction
-specifies the direction to step:
-.Bl -tag -width indent -compact -offset ident
-.It Dv ELFTC_STEP_NEXT
-Return the symbol which follows the argument
-.Ar cursym
-in the current traversal order.
-If argument
-.Ar cursym
-is NULL, return the first symbol in the current
-traversal order.
-.It Dv ELFTC_STEP_PREVIOUS
-Return the symbol which precedes the argument
-.Ar cursym
-in the current traversal order.
-If argument
-.Ar cursym
-is NULL, return the last symbol in the current
-traversal order.
-.El
-.Ss Operations on ELF-centric symbol tables
-ELF-centric symbol tables use symbols that are subtypes of
-.Vt Elftc_Elf_Symbol ,
-as described in the section
-.Sx "Structure of a Symbol Table Entry"
-below.
-.Pp
-In addition to the operations on regular symbol tables listed above,
-these symbol tables may be used with the following additional
-functions.
-.Pp
-The function
-.Fn elftc_elf_symbol_table_from_section
-builds a symbol table from the contents of an ELF section.
-The argument
-.Ar symscn
-should reference an ELF section of type
-.Dv SHT_SYMTAB
-or
-.Dv SHT_DYNSYM .
-The argument
-.Ar strscn
-should reference an ELF section of type
-.Dv SHT_STRTAB
-containing the string table associated wit section
-.Ar symscn .
-.Ss Structure of a Symbol Table Entry
-The symbol tables managed by
-.Lb libelftc
-are collections of symbol table entries.
-Each entry should be a subtype of one of the
-.Vt Elftc_Symbol
-or
-.Vt Elftc_Elf_Symbol
-types.
-In other words, each entry should have an
-.Vt Elftc_Symbol
-or
-.Vt Elftc_Elf_Symbol
-structure as its first member, before any application specific
-fields.
-For example:
-.Bd -literal -offset indent
-struct _MySymbol {
- Elftc_Symbol sym_base;
- ... other application-specific fields ...
-};
-.Ed
-.Pp
-The size of the combined entry is indicated to the library
-at the time of creating a new symbol table.
-Applications may then cast the returned pointers from these
-routines to the appropriate type:
-.Bd -literal -offset indent
-struct _MySymbol *mysym;
-
-mysym = (struct _MySymbol *) elftc_symbol_table_lookup(table,
- name);
-.Ed
-.Pp
-The
-.Vt Elftc_Symbol
-type has two public fields:
-.Bl -tag -width ".Va sym_value" -compact -offset indent
-.It Va sym_name
-Points to a NUL-terminated string containing the symbol's name.
-The application should not change the value of this field.
-.It Va sym_value
-The value associated with this symbol.
-This field is entirely under the application's control.
-.El
-.Pp
-The
-.Vt Elftc_Elf_Symbol
-type has two public fields:
-.Bl -tag -width ".Va sym_value" -compact -offset indent
-.It Va sym_name
-Points to a NUL-terminated string containing the symbol's name.
-The application should not change the value of this field.
-.It Va sym_elf
-A structure of type
-.Vt Gelf_Sym
-containing ELF symbol information.
-This field is entirely under the application's control.
-.El
-.Ss Symbol Search Rules
-During lookups, symbols are looked up first in the symbol table passed in
-to the
-.Fn elftc_symbol_table_lookup
-function.
-If the specified symbol is not found, and if the symbol table has a
-parent, then the search continues recursively up the chain of parent
-symbol tables till either a matching symbol is found or till there are
-no more parent symbol tables to search in.
-.Pp
-Insertions and deletion only work on the specified symbol table and
-do not recurse into parent symbol tables.
-.Ss Memory Management
-The
-.Lb libelftc
-manages its memory allocations.
-Applications should not free the pointers returned by the
-API documented in this manual page.
-.Sh RETURN VALUES
-Function
-.Fn elftc_symbol_table_count
-returns a count of the number of symbol table entries as an unsigned
-value.
-.Pp
-Functions
-.Fn elftc_symbol_table_create ,
-.Fn elftc_symbol_table_create_nested
-and
-.Fn elftc_symbol_table_from_section
-return a pointer to an opaque structure of type
-.Vt Elftc_Symbol_Table
-on success, or return NULL in case of an error.
-.Pp
-Functions
-.Fn elftc_symbol_table_delete_name ,
-.Fn elftc_symbol_table_delete_name
-.Fn elftc_symbol_table_destroy ,
-.Fn elftc_symbol_table_replace
-and
-.Fn elftc_symbol_table_sort
-return a non-zero value on success, or return zero in case of an error.
-.Pp
-Functions
-.Fn elftc_symbol_table_insert ,
-.Fn elftc_symbol_table_lookup
-and
-.Fn elftc_symbol_table_lookup_value
-return a pointer to a structure that is a subtype of
-.Vt Elftc_Symbol
-on success, or return NULL in case of an error.
-.Pp
-The function
-.Fn elftc_symbol_table_step
-return a pointer to a structure that is a subtype of
-.Vt Elftc_Symbol
-on success.
-The function returns NULL if there are no more elements in the
-specified traversal direction.
-.Pp
-The function
-.Fn elftc_symbol_table_iterate
-returns
-.Dv ELFTC_ITERATE_SUCCESS
-if the symbol table was successfully traversed, or
-.Dv ELFTC_ITERATE_ABORT
-in case the iteration function aborted the traversal.
-.Sh SEE ALSO
-.Xr dwarf 3 ,
-.Xr elf 3 ,
-.Xr elftc 3
diff --git a/libelftc/libelftc.h b/libelftc/libelftc.h
index 062db318c4d2..e3adaf23c696 100644
--- a/libelftc/libelftc.h
+++ b/libelftc/libelftc.h
@@ -24,7 +24,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: users/kaiwang27/elftc/libelftc.h 392 2009-05-31 19:17:46Z kaiwang27 $
- * $Id: libelftc.h 3174 2015-03-27 17:13:41Z emaste $
+ * $Id: libelftc.h 3309 2016-01-10 09:10:51Z kaiwang27 $
*/
#ifndef _LIBELFTC_H_
@@ -46,7 +46,9 @@ typedef enum {
ETF_ELF,
ETF_BINARY,
ETF_SREC,
- ETF_IHEX
+ ETF_IHEX,
+ ETF_PE,
+ ETF_EFI,
} Elftc_Bfd_Target_Flavor;
/*
diff --git a/libelftc/libelftc_bfdtarget.c b/libelftc/libelftc_bfdtarget.c
index 00ba2254fc16..88f3220df0b0 100644
--- a/libelftc/libelftc_bfdtarget.c
+++ b/libelftc/libelftc_bfdtarget.c
@@ -30,7 +30,7 @@
#include "_libelftc.h"
-ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3174 2015-03-27 17:13:41Z emaste $");
+ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3309 2016-01-10 09:10:51Z kaiwang27 $");
struct _Elftc_Bfd_Target _libelftc_targets[] = {
@@ -375,6 +375,30 @@ struct _Elftc_Bfd_Target _libelftc_targets[] = {
},
{
+ .bt_name = "efi-app-ia32",
+ .bt_type = ETF_EFI,
+ .bt_machine = EM_386,
+ },
+
+ {
+ .bt_name = "efi-app-x86_64",
+ .bt_type = ETF_EFI,
+ .bt_machine = EM_X86_64,
+ },
+
+ {
+ .bt_name = "pei-i386",
+ .bt_type = ETF_PE,
+ .bt_machine = EM_386,
+ },
+
+ {
+ .bt_name = "pei-x86-64",
+ .bt_type = ETF_PE,
+ .bt_machine = EM_X86_64,
+ },
+
+ {
.bt_name = NULL,
.bt_type = ETF_NONE,
},
diff --git a/libelftc/libelftc_dem_gnu3.c b/libelftc/libelftc_dem_gnu3.c
index e8fd78fe0ded..f5ca7b312683 100644
--- a/libelftc/libelftc_dem_gnu3.c
+++ b/libelftc/libelftc_dem_gnu3.c
@@ -36,7 +36,7 @@
#include "_libelftc.h"
-ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3212 2015-05-17 13:40:55Z kaiwang27 $");
+ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3291 2016-01-04 02:36:38Z emaste $");
/**
* @file cpp_demangle.c
@@ -1262,11 +1262,13 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
if (!cpp_demangle_push_str(ddata,
"non-transaction clone for ", 26))
return (0);
+ break;
case 't':
default:
if (!cpp_demangle_push_str(ddata,
"transaction clone for ", 22))
return (0);
+ break;
}
++ddata->cur;
return (cpp_demangle_read_encoding(ddata));
@@ -1895,35 +1897,35 @@ cpp_demangle_read_subst(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('S', 'd'):
/* std::basic_iostream<char, std::char_traits<char> > */
- if (!cpp_demangle_push_str(ddata, "std::iostream", 19))
+ if (!cpp_demangle_push_str(ddata, "std::basic_iostream", 19))
return (0);
- ddata->last_sname = "iostream";
+ ddata->last_sname = "basic_iostream";
ddata->cur += 2;
if (*ddata->cur == 'I')
return (cpp_demangle_read_subst_stdtmpl(ddata,
- "std::iostream", 19));
+ "std::basic_iostream", 19));
return (1);
case SIMPLE_HASH('S', 'i'):
/* std::basic_istream<char, std::char_traits<char> > */
- if (!cpp_demangle_push_str(ddata, "std::istream", 18))
+ if (!cpp_demangle_push_str(ddata, "std::basic_istream", 18))
return (0);
- ddata->last_sname = "istream";
+ ddata->last_sname = "basic_istream";
ddata->cur += 2;
if (*ddata->cur == 'I')
return (cpp_demangle_read_subst_stdtmpl(ddata,
- "std::istream", 18));
+ "std::basic_istream", 18));
return (1);
case SIMPLE_HASH('S', 'o'):
/* std::basic_ostream<char, std::char_traits<char> > */
- if (!cpp_demangle_push_str(ddata, "std::ostream", 18))
+ if (!cpp_demangle_push_str(ddata, "std::basic_ostream", 18))
return (0);
- ddata->last_sname = "istream";
+ ddata->last_sname = "basic_ostream";
ddata->cur += 2;
if (*ddata->cur == 'I')
return (cpp_demangle_read_subst_stdtmpl(ddata,
- "std::ostream", 18));
+ "std::basic_ostream", 18));
return (1);
case SIMPLE_HASH('S', 's'):
diff --git a/libelftc/make-toolchain-version b/libelftc/make-toolchain-version
index ac6155a49a00..8891258eeaf9 100755
--- a/libelftc/make-toolchain-version
+++ b/libelftc/make-toolchain-version
@@ -3,7 +3,7 @@
# This script generates a project-wide version identifier for use by
# the `elftc_version()' API.
#
-# $Id: make-toolchain-version 2583 2012-09-14 09:49:25Z jkoshy $
+# $Id: make-toolchain-version 3299 2016-01-09 19:58:46Z jkoshy $
#
# Defaults.
@@ -64,7 +64,7 @@ done
curdir=`pwd`
cd ${top} || usage "ERROR: Cannot change directory to \"${top}\"."
-if [ -d .svn ]; then # FreeBSD and SF.Net sources.
+if [ -d .svn -o -d ../.svn ]; then # FreeBSD and SF.Net sources.
versionstring=" svn:"$(svnversion)
elif [ -d CVS ]; then # NetBSD.
versionstring=" cvs:unknown"
diff --git a/libelftc/os.NetBSD.mk b/libelftc/os.NetBSD.mk
new file mode 100644
index 000000000000..ae214e3115c0
--- /dev/null
+++ b/libelftc/os.NetBSD.mk
@@ -0,0 +1,2 @@
+# TODO(#511): Revert after the source tree is -Wconversion clean.
+WARNS=5
diff --git a/libpe/Makefile b/libpe/Makefile
new file mode 100644
index 000000000000..d02fb5080ef6
--- /dev/null
+++ b/libpe/Makefile
@@ -0,0 +1,32 @@
+# $Id: Makefile 3349 2016-01-18 21:09:16Z jkoshy $
+
+TOP= ${.CURDIR}/..
+
+LIB= pe
+
+SRCS= libpe_buffer.c \
+ libpe_coff.c \
+ libpe_dos.c \
+ libpe_init.c \
+ libpe_rich.c \
+ libpe_section.c \
+ libpe_utils.c \
+ pe_buffer.c \
+ pe_cntl.c \
+ pe_coff.c \
+ pe_dos.c \
+ pe_flag.c \
+ pe_init.c \
+ pe_rich.c \
+ pe_section.c \
+ pe_symtab.c \
+ pe_update.c
+
+INCS= libpe.h pe.h
+INCSDIR= /usr/include
+
+SHLIB_MAJOR= 1
+
+WARNS?= 6
+
+.include "${TOP}/mk/elftoolchain.lib.mk"
diff --git a/libpe/_libpe.h b/libpe/_libpe.h
new file mode 100644
index 000000000000..1a83a674194a
--- /dev/null
+++ b/libpe/_libpe.h
@@ -0,0 +1,213 @@
+/*-
+ * Copyright (c) 2015 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: _libpe.h 3312 2016-01-10 09:23:51Z kaiwang27 $
+ */
+
+#ifndef __LIBPE_H_
+#define __LIBPE_H_
+
+#include <sys/types.h>
+#include <sys/queue.h>
+
+#include "libpe.h"
+
+#include "_elftc.h"
+
+typedef struct _PE_SecBuf {
+ PE_Buffer sb_pb; /* application buffer */
+ PE_Scn *sb_ps; /* PE_Scn pointer */
+ unsigned int sb_flags; /* buffer flags */
+ STAILQ_ENTRY(_PE_SecBuf) sb_next;
+} PE_SecBuf;
+
+struct _PE_Scn {
+ PE *ps_pe; /* PE descriptor */
+ PE_SecHdr ps_sh; /* section header */
+ unsigned int ps_ndx; /* 1-based section index */
+ unsigned int ps_flags; /* section flags */
+ unsigned int ps_falign; /* section file alignment */
+ STAILQ_HEAD(, _PE_SecBuf) ps_b; /* buffer list */
+ STAILQ_ENTRY(_PE_Scn) ps_next;
+};
+
+struct _PE {
+ int pe_fd; /* file descriptor */
+ PE_Cmd pe_cmd; /* open mode */
+ PE_Object pe_obj; /* PE32/PE32+/COFF */
+ size_t pe_fsize; /* file size */
+ unsigned int pe_flags; /* library flags */
+ PE_DosHdr *pe_dh; /* MS-DOS header */
+ char *pe_stub; /* MS-DOS stub */
+ size_t pe_stub_ex; /* MS-DOS stub len (exclude hdr) */
+ char *pe_stub_app; /* MS-DOS stub (app supplied) */
+ size_t pe_stub_app_sz; /* MS-DOS stub len (app supplied) */
+ PE_RichHdr *pe_rh; /* rich header */
+ char *pe_rh_start; /* pointer to rich header */
+ PE_CoffHdr *pe_ch; /* COFF header */
+ PE_OptHdr *pe_oh; /* optional header */
+ PE_DataDir *pe_dd; /* data directories */
+ unsigned int pe_nscn; /* num. of sections */
+ char *pe_symtab; /* COFF symbol table */
+ size_t pe_symbtab_sz; /* size of symbol table */
+ unsigned int pe_nsym; /* num. of symbols */
+ unsigned int pe_rvamax; /* maximum RVA */
+ STAILQ_HEAD(, _PE_Scn) pe_scn; /* section list */
+};
+
+/* Library internal flags */
+#define LIBPE_F_API_MASK 0x000FFFU
+#define LIBPE_F_SPECIAL_FILE 0x001000U
+#define LIBPE_F_BAD_DOS_HEADER 0x002000U
+#define LIBPE_F_BAD_PE_HEADER 0x004000U
+#define LIBPE_F_BAD_COFF_HEADER 0x008000U
+#define LIBPE_F_BAD_OPT_HEADER 0x010000U
+#define LIBPE_F_BAD_SEC_HEADER 0x020000U
+#define LIBPE_F_LOAD_DOS_STUB 0x040000U
+#define LIBPE_F_FD_DONE 0x080000U
+#define LIBPE_F_DIRTY_DOS_HEADER 0x100000U
+#define LIBPE_F_DIRTY_COFF_HEADER 0x200000U
+#define LIBPE_F_DIRTY_OPT_HEADER 0x400000U
+#define LIBPE_F_DIRTY_SEC_HEADER 0x800000U
+
+/* Internal section flags */
+#define LIBPE_F_LOAD_SECTION 0x1000U
+#define LIBPE_F_STRIP_SECTION 0x2000U
+
+/* Internal buffer flags */
+#define LIBPE_F_BUFFER_MALLOCED 0x1000U
+
+/* Library internal defines */
+#define PE_DOS_MAGIC 0x5a4dU
+#define PE_RICH_TEXT "Rich"
+#define PE_RICH_HIDDEN 0x536e6144U /* DanS */
+#define PE_SIGNATURE 0x4550U /* PE\0\0 */
+#define PE_COFF_OPT_SIZE_32 224
+#define PE_COFF_OPT_SIZE_32P 240
+#define PE_SYM_ENTRY_SIZE 18
+
+/* Encode/Decode macros */
+#if defined(ELFTC_NEED_BYTEORDER_EXTENSIONS)
+static __inline uint16_t
+le16dec(const void *pp)
+{
+ unsigned char const *p = (unsigned char const *)pp;
+
+ return ((p[1] << 8) | p[0]);
+}
+
+static __inline uint32_t
+le32dec(const void *pp)
+{
+ unsigned char const *p = (unsigned char const *)pp;
+
+ return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);
+}
+
+static __inline uint64_t
+le64dec(const void *pp)
+{
+ unsigned char const *p = (unsigned char const *)pp;
+
+ return (((uint64_t)le32dec(p + 4) << 32) | le32dec(p));
+}
+
+static __inline void
+le16enc(void *pp, uint16_t u)
+{
+ unsigned char *p = (unsigned char *)pp;
+
+ p[0] = u & 0xff;
+ p[1] = (u >> 8) & 0xff;
+}
+
+static __inline void
+le32enc(void *pp, uint32_t u)
+{
+ unsigned char *p = (unsigned char *)pp;
+
+ p[0] = u & 0xff;
+ p[1] = (u >> 8) & 0xff;
+ p[2] = (u >> 16) & 0xff;
+ p[3] = (u >> 24) & 0xff;
+}
+
+static __inline void
+le64enc(void *pp, uint64_t u)
+{
+ unsigned char *p = (unsigned char *)pp;
+
+ le32enc(p, (uint32_t)(u & 0xffffffffU));
+ le32enc(p + 4, (uint32_t)(u >> 32));
+}
+#endif /* ELFTC_NEED_BYTEORDER_EXTENSIONS */
+
+#define PE_READ16(p,v) do { \
+ (v) = le16dec((p)); \
+ (p) += 2; \
+} while(0)
+
+#define PE_READ32(p,v) do { \
+ (v) = le32dec((p)); \
+ (p) += 4; \
+} while(0)
+
+#define PE_WRITE16(p,v) do { \
+ le16enc((p), (v)); \
+ (p) += 2; \
+} while(0)
+
+#define PE_WRITE32(p,v) do { \
+ le32enc((p), (v)); \
+ (p) += 4; \
+} while(0)
+
+
+/* Internal function declarations */
+off_t libpe_align(PE *, off_t, size_t);
+PE_SecBuf *libpe_alloc_buffer(PE_Scn *, size_t);
+PE_Scn *libpe_alloc_scn(PE *);
+int libpe_load_all_sections(PE *);
+int libpe_load_section(PE *, PE_Scn *);
+int libpe_open_object(PE *);
+int libpe_pad(PE *, size_t);
+int libpe_parse_msdos_header(PE *, char *);
+int libpe_parse_coff_header(PE *, char *);
+int libpe_parse_rich_header(PE *);
+int libpe_parse_section_headers(PE *);
+int libpe_read_msdos_stub(PE *);
+void libpe_release_buffer(PE_SecBuf *);
+void libpe_release_object(PE *);
+void libpe_release_scn(PE_Scn *);
+size_t libpe_resync_buffers(PE_Scn *);
+int libpe_resync_sections(PE *, off_t);
+int libpe_write_buffers(PE_Scn *);
+off_t libpe_write_coff_header(PE *, off_t);
+off_t libpe_write_msdos_stub(PE *, off_t);
+off_t libpe_write_pe_header(PE *, off_t);
+off_t libpe_write_sections(PE *, off_t);
+off_t libpe_write_section_headers(PE *, off_t);
+
+#endif /* !__LIBPE_H_ */
diff --git a/libpe/libpe.h b/libpe/libpe.h
new file mode 100644
index 000000000000..3cec39a8f522
--- /dev/null
+++ b/libpe/libpe.h
@@ -0,0 +1,121 @@
+/*-
+ * Copyright (c) 2015 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: libpe.h 3312 2016-01-10 09:23:51Z kaiwang27 $
+ */
+
+#ifndef _LIBPE_H_
+#define _LIBPE_H_
+
+#include <sys/types.h>
+
+#include "pe.h"
+
+/* Library private data structures */
+typedef struct _PE PE;
+typedef struct _PE_Scn PE_Scn;
+
+/* Section buffers */
+typedef struct PE_Buffer {
+ unsigned int pb_align;
+ off_t pb_off;
+ size_t pb_size;
+ void *pb_buf;
+} PE_Buffer;
+
+/* Object types */
+typedef enum {
+ PE_O_UNKNOWN = 0,
+ PE_O_PE32,
+ PE_O_PE32P,
+ PE_O_COFF,
+} PE_Object;
+
+/* Commands */
+typedef enum {
+ PE_C_NULL = 0,
+ PE_C_CLR,
+ PE_C_FDDONE,
+ PE_C_FDREAD,
+ PE_C_RDWR,
+ PE_C_READ,
+ PE_C_SET,
+ PE_C_WRITE,
+ PE_C_NUM
+} PE_Cmd;
+
+/* Flags defined by the API. */
+#define PE_F_DIRTY 0x001U
+#define PE_F_STRIP_DOS_STUB 0x002U
+#define PE_F_STRIP_RICH_HEADER 0x004U
+#define PE_F_STRIP_SYMTAB 0x008U
+#define PE_F_STRIP_DEBUG 0x010U
+#define PE_F_STRIP_SECTION 0x020U
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+PE_CoffHdr *pe_coff_header(PE *);
+int pe_cntl(PE *, PE_Cmd);
+PE_DataDir *pe_data_dir(PE *);
+void pe_finish(PE *);
+int pe_flag(PE *, PE_Cmd, unsigned int);
+int pe_flag_buffer(PE_Buffer *, PE_Cmd, unsigned int);
+int pe_flag_coff_header(PE *, PE_Cmd, unsigned int);
+int pe_flag_data_dir(PE *, PE_Cmd, unsigned int);
+int pe_flag_dos_header(PE *, PE_Cmd, unsigned int);
+int pe_flag_opt_header(PE *, PE_Cmd, unsigned int);
+int pe_flag_section_header(PE_Scn *, PE_Cmd, unsigned int);
+int pe_flag_scn(PE_Scn *, PE_Cmd, unsigned int);
+PE_Buffer *pe_getbuffer(PE_Scn *, PE_Buffer *);
+PE_Scn *pe_getscn(PE *, size_t);
+PE *pe_init(int, PE_Cmd, PE_Object);
+PE_Scn *pe_insertscn(PE *, size_t);
+PE_DosHdr *pe_msdos_header(PE *);
+char *pe_msdos_stub(PE *, size_t *);
+size_t pe_ndxscn(PE_Scn *);
+PE_Buffer *pe_newbuffer(PE_Scn *);
+PE_Scn *pe_newscn(PE *);
+PE_Scn *pe_nextscn(PE *, PE_Scn *);
+PE_Object pe_object(PE *);
+PE_OptHdr *pe_opt_header(PE *);
+PE_RichHdr *pe_rich_header(PE *);
+int pe_rich_header_validate(PE *);
+PE_SecHdr *pe_section_header(PE_Scn *);
+off_t pe_update(PE *);
+int pe_update_coff_header(PE *, PE_CoffHdr *);
+int pe_update_opt_header(PE *, PE_OptHdr *);
+int pe_update_data_dir(PE *, PE_DataDir *);
+int ps_update_msdos_header(PE *, PE_DosHdr *);
+int ps_update_msdos_stub(PE *, char *, size_t);
+int pe_update_section_header(PE_Scn *, PE_SecHdr *);
+int pe_update_symtab(PE *, char *, size_t, unsigned int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LIBPE_H_ */
diff --git a/libpe/libpe_buffer.c b/libpe/libpe_buffer.c
new file mode 100644
index 000000000000..cc633dd04ee9
--- /dev/null
+++ b/libpe/libpe_buffer.c
@@ -0,0 +1,185 @@
+/*-
+ * Copyright (c) 2016 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: libpe_buffer.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+PE_SecBuf *
+libpe_alloc_buffer(PE_Scn *ps, size_t sz)
+{
+ PE_SecBuf *sb;
+
+ if ((sb = malloc(sizeof(PE_SecBuf))) == NULL) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+
+ sb->sb_ps = ps;
+ sb->sb_flags = 0;
+ sb->sb_pb.pb_align = 1;
+ sb->sb_pb.pb_off = 0;
+ sb->sb_pb.pb_size = sz;
+ if (sz > 0) {
+ if ((sb->sb_pb.pb_buf = malloc(sz)) == NULL) {
+ free(sb);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ sb->sb_flags |= LIBPE_F_BUFFER_MALLOCED;
+ } else
+ sb->sb_pb.pb_buf = NULL;
+
+ STAILQ_INSERT_TAIL(&ps->ps_b, sb, sb_next);
+
+ return (sb);
+}
+
+void
+libpe_release_buffer(PE_SecBuf *sb)
+{
+ PE_Scn *ps;
+
+ assert(sb != NULL);
+
+ ps = sb->sb_ps;
+
+ STAILQ_REMOVE(&ps->ps_b, sb, _PE_SecBuf, sb_next);
+
+ if (sb->sb_flags & LIBPE_F_BUFFER_MALLOCED)
+ free(sb->sb_pb.pb_buf);
+
+ free(sb);
+}
+
+static int
+cmp_sb(PE_SecBuf *a, PE_SecBuf *b)
+{
+
+ if (a->sb_pb.pb_off < b->sb_pb.pb_off)
+ return (-1);
+ else if (a->sb_pb.pb_off == b->sb_pb.pb_off)
+ return (0);
+ else
+ return (1);
+}
+
+static void
+sort_buffers(PE_Scn *ps)
+{
+
+ if (STAILQ_EMPTY(&ps->ps_b))
+ return;
+
+ STAILQ_SORT(&ps->ps_b, _PE_SecBuf, sb_next, cmp_sb);
+}
+
+size_t
+libpe_resync_buffers(PE_Scn *ps)
+{
+ PE_SecBuf *sb;
+ PE_Buffer *pb;
+ size_t sz;
+
+ assert(ps->ps_flags & LIBPE_F_LOAD_SECTION);
+
+ sort_buffers(ps);
+
+ sz = 0;
+ STAILQ_FOREACH(sb, &ps->ps_b, sb_next) {
+ if (ps->ps_flags & PE_F_DIRTY)
+ sb->sb_flags |= PE_F_DIRTY;
+
+ pb = (PE_Buffer *) sb;
+ if (pb->pb_align > ps->ps_falign)
+ pb->pb_align = ps->ps_falign;
+ if (pb->pb_buf == NULL || pb->pb_size == 0)
+ continue;
+
+ sz = roundup(sz, pb->pb_align);
+
+ if (pb->pb_off != (off_t) sz) {
+ pb->pb_off = sz;
+ sb->sb_flags |= PE_F_DIRTY;
+ }
+ sz += pb->pb_size;
+ }
+
+ return (sz);
+}
+
+int
+libpe_write_buffers(PE_Scn *ps)
+{
+ PE *pe;
+ PE_SecBuf *sb;
+ PE_Buffer *pb;
+ off_t off;
+
+ assert(ps->ps_flags & LIBPE_F_LOAD_SECTION);
+
+ pe = ps->ps_pe;
+
+ off = 0;
+ STAILQ_FOREACH(sb, &ps->ps_b, sb_next) {
+ pb = &sb->sb_pb;
+ if (pb->pb_buf == NULL || pb->pb_size == 0)
+ continue;
+
+ if ((sb->sb_flags & PE_F_DIRTY) == 0) {
+ assert((pe->pe_flags & LIBPE_F_SPECIAL_FILE) == 0);
+ if (lseek(pe->pe_fd, (off_t) pb->pb_size, SEEK_CUR) <
+ 0) {
+ errno = EIO;
+ return (-1);
+ }
+ goto next_buf;
+ }
+
+ if (pb->pb_off > off) {
+ if (libpe_pad(pe, pb->pb_off - off) < 0)
+ return (-1);
+ off = pb->pb_off;
+ }
+
+ if (write(pe->pe_fd, pb->pb_buf, pb->pb_size) !=
+ (ssize_t) pb->pb_size) {
+ errno = EIO;
+ return (-1);
+ }
+
+ next_buf:
+ off += pb->pb_size;
+ }
+
+ return (0);
+}
diff --git a/libpe/libpe_coff.c b/libpe/libpe_coff.c
new file mode 100644
index 000000000000..e161f7c71864
--- /dev/null
+++ b/libpe/libpe_coff.c
@@ -0,0 +1,535 @@
+/*-
+ * Copyright (c) 2015 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: libpe_coff.c 3326 2016-01-16 17:46:17Z kaiwang27 $");
+
+int
+libpe_parse_coff_header(PE *pe, char *hdr)
+{
+ char tmp[128];
+ PE_CoffHdr *ch;
+ PE_OptHdr *oh;
+ PE_DataDir *dd;
+ unsigned p, r, s;
+ int i;
+
+ if ((ch = malloc(sizeof(PE_CoffHdr))) == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+
+ PE_READ16(hdr, ch->ch_machine);
+ PE_READ16(hdr, ch->ch_nsec);
+ PE_READ32(hdr, ch->ch_timestamp);
+ PE_READ32(hdr, ch->ch_symptr);
+ PE_READ32(hdr, ch->ch_nsym);
+ PE_READ16(hdr, ch->ch_optsize);
+ PE_READ16(hdr, ch->ch_char);
+
+ pe->pe_ch = ch;
+
+ /*
+ * The Optional header is omitted for object files.
+ */
+ if (ch->ch_optsize == 0)
+ return (libpe_parse_section_headers(pe));
+
+ if ((oh = calloc(1, sizeof(PE_OptHdr))) == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ pe->pe_oh = oh;
+
+#define READ_OPT(n) \
+ do { \
+ /* \
+ * Since the Optional Header size is variable, we must \
+ * check if the requested read size will overrun the \
+ * remaining header bytes. \
+ */ \
+ if (p + (n) > ch->ch_optsize) { \
+ /* Consume the "extra" bytes */ \
+ r = ch->ch_optsize - p; \
+ if (read(pe->pe_fd, tmp, r) != (ssize_t) r) { \
+ pe->pe_flags |= LIBPE_F_BAD_SEC_HEADER;\
+ return (0); \
+ } \
+ return (libpe_parse_section_headers(pe)); \
+ } \
+ if (read(pe->pe_fd, tmp, (n)) != (ssize_t) (n)) { \
+ pe->pe_flags |= LIBPE_F_BAD_OPT_HEADER; \
+ return (0); \
+ } \
+ p += (n); \
+ } while (0)
+#define READ_OPT8(v) do { READ_OPT(1); (v) = *tmp; } while(0)
+#define READ_OPT16(v) do { READ_OPT(2); (v) = le16dec(tmp); } while(0)
+#define READ_OPT32(v) do { READ_OPT(4); (v) = le32dec(tmp); } while(0)
+#define READ_OPT64(v) do { READ_OPT(8); (v) = le64dec(tmp); } while(0)
+
+ /*
+ * Read in the Optional header. Size of some fields are depending
+ * on the PE format specified by the oh_magic field. (PE32 or PE32+)
+ */
+
+ p = 0;
+ READ_OPT16(oh->oh_magic);
+ if (oh->oh_magic == PE_FORMAT_32P)
+ pe->pe_obj = PE_O_PE32P;
+ READ_OPT8(oh->oh_ldvermajor);
+ READ_OPT8(oh->oh_ldverminor);
+ READ_OPT32(oh->oh_textsize);
+ READ_OPT32(oh->oh_datasize);
+ READ_OPT32(oh->oh_bsssize);
+ READ_OPT32(oh->oh_entry);
+ READ_OPT32(oh->oh_textbase);
+ if (oh->oh_magic != PE_FORMAT_32P) {
+ READ_OPT32(oh->oh_database);
+ READ_OPT32(oh->oh_imgbase);
+ } else
+ READ_OPT64(oh->oh_imgbase);
+ READ_OPT32(oh->oh_secalign);
+ READ_OPT32(oh->oh_filealign);
+ READ_OPT16(oh->oh_osvermajor);
+ READ_OPT16(oh->oh_osverminor);
+ READ_OPT16(oh->oh_imgvermajor);
+ READ_OPT16(oh->oh_imgverminor);
+ READ_OPT16(oh->oh_subvermajor);
+ READ_OPT16(oh->oh_subverminor);
+ READ_OPT32(oh->oh_win32ver);
+ READ_OPT32(oh->oh_imgsize);
+ READ_OPT32(oh->oh_hdrsize);
+ READ_OPT32(oh->oh_checksum);
+ READ_OPT16(oh->oh_subsystem);
+ READ_OPT16(oh->oh_dllchar);
+ if (oh->oh_magic != PE_FORMAT_32P) {
+ READ_OPT32(oh->oh_stacksizer);
+ READ_OPT32(oh->oh_stacksizec);
+ READ_OPT32(oh->oh_heapsizer);
+ READ_OPT32(oh->oh_heapsizec);
+ } else {
+ READ_OPT64(oh->oh_stacksizer);
+ READ_OPT64(oh->oh_stacksizec);
+ READ_OPT64(oh->oh_heapsizer);
+ READ_OPT64(oh->oh_heapsizec);
+ }
+ READ_OPT32(oh->oh_ldrflags);
+ READ_OPT32(oh->oh_ndatadir);
+
+ /*
+ * Read in the Data Directories.
+ */
+
+ if (oh->oh_ndatadir > 0) {
+ if ((dd = calloc(1, sizeof(PE_DataDir))) == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ pe->pe_dd = dd;
+
+ dd->dd_total = oh->oh_ndatadir < PE_DD_MAX ? oh->oh_ndatadir :
+ PE_DD_MAX;
+
+ for (i = 0; (uint32_t) i < dd->dd_total; i++) {
+ READ_OPT32(dd->dd_e[i].de_addr);
+ READ_OPT32(dd->dd_e[i].de_size);
+ }
+ }
+
+ /* Consume the remaining bytes in the Optional header, if any. */
+ if (ch->ch_optsize > p) {
+ r = ch->ch_optsize - p;
+ for (; r > 0; r -= s) {
+ s = r > sizeof(tmp) ? sizeof(tmp) : r;
+ if (read(pe->pe_fd, tmp, s) != (ssize_t) s) {
+ pe->pe_flags |= LIBPE_F_BAD_SEC_HEADER;
+ return (0);
+ }
+ }
+ }
+
+ return (libpe_parse_section_headers(pe));
+}
+
+off_t
+libpe_write_pe_header(PE *pe, off_t off)
+{
+ char tmp[4];
+
+ if (pe->pe_cmd == PE_C_RDWR &&
+ (pe->pe_flags & LIBPE_F_BAD_PE_HEADER) == 0) {
+ assert(pe->pe_dh != NULL);
+ off = lseek(pe->pe_fd, (off_t) pe->pe_dh->dh_lfanew + 4,
+ SEEK_SET);
+ return (off);
+ }
+
+ /*
+ * PE Header should to be aligned on 8-byte boundary according to
+ * the PE/COFF specification.
+ */
+ if ((off = libpe_align(pe, off, 8)) < 0)
+ return (-1);
+
+ le32enc(tmp, PE_SIGNATURE);
+ if (write(pe->pe_fd, tmp, sizeof(tmp)) != (ssize_t) sizeof(tmp)) {
+ errno = EIO;
+ return (-1);
+ }
+
+ off += 4;
+
+ pe->pe_flags &= ~LIBPE_F_BAD_PE_HEADER;
+
+ /* Trigger rewrite for the following headers. */
+ pe->pe_flags |= LIBPE_F_DIRTY_COFF_HEADER;
+ pe->pe_flags |= LIBPE_F_DIRTY_OPT_HEADER;
+
+ return (off);
+}
+
+off_t
+libpe_write_coff_header(PE *pe, off_t off)
+{
+ char tmp[128], *hdr;
+ PE_CoffHdr *ch;
+ PE_DataDir *dd;
+ PE_OptHdr *oh;
+ PE_Scn *ps;
+ PE_SecHdr *sh;
+ unsigned p;
+ uint32_t reloc_rva, reloc_sz;
+ int i, reloc;
+
+ reloc = 0;
+ reloc_rva = reloc_sz = 0;
+
+ if (pe->pe_cmd == PE_C_RDWR) {
+ assert((pe->pe_flags & LIBPE_F_SPECIAL_FILE) == 0);
+
+ if ((pe->pe_flags & LIBPE_F_DIRTY_COFF_HEADER) == 0 &&
+ (pe->pe_flags & LIBPE_F_BAD_COFF_HEADER) == 0) {
+ if (lseek(pe->pe_fd, (off_t) sizeof(PE_CoffHdr),
+ SEEK_CUR) < 0) {
+ errno = EIO;
+ return (-1);
+ }
+ off += sizeof(PE_CoffHdr);
+ assert(pe->pe_ch != NULL);
+ ch = pe->pe_ch;
+ goto coff_done;
+ }
+
+ /* lseek(2) to the offset of the COFF header. */
+ if (lseek(pe->pe_fd, off, SEEK_SET) < 0) {
+ errno = EIO;
+ return (-1);
+ }
+ }
+
+ if (pe->pe_ch == NULL) {
+ if ((ch = calloc(1, sizeof(PE_CoffHdr))) == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ pe->pe_ch = ch;
+
+ /*
+ * Default value for ch_machine if not provided by the
+ * application.
+ */
+ if (pe->pe_obj == PE_O_PE32P)
+ ch->ch_machine = IMAGE_FILE_MACHINE_AMD64;
+ else
+ ch->ch_machine = IMAGE_FILE_MACHINE_I386;
+
+ } else
+ ch = pe->pe_ch;
+
+ if (!ch->ch_timestamp)
+ ch->ch_timestamp = time(NULL);
+
+ if (pe->pe_obj == PE_O_PE32) {
+ if (!ch->ch_optsize)
+ ch->ch_optsize = PE_COFF_OPT_SIZE_32;
+ ch->ch_char |= IMAGE_FILE_EXECUTABLE_IMAGE |
+ IMAGE_FILE_32BIT_MACHINE;
+ } else if (pe->pe_obj == PE_O_PE32P) {
+ if (!ch->ch_optsize)
+ ch->ch_optsize = PE_COFF_OPT_SIZE_32P;
+ ch->ch_char |= IMAGE_FILE_EXECUTABLE_IMAGE |
+ IMAGE_FILE_LARGE_ADDRESS_AWARE;
+ } else
+ ch->ch_optsize = 0;
+
+ /*
+ * COFF line number is deprecated by the PE/COFF
+ * specification. COFF symbol table is deprecated
+ * for executables.
+ */
+ ch->ch_char |= IMAGE_FILE_LINE_NUMS_STRIPPED;
+ if (pe->pe_obj == PE_O_PE32 || pe->pe_obj == PE_O_PE32P)
+ ch->ch_char |= IMAGE_FILE_LOCAL_SYMS_STRIPPED;
+
+ ch->ch_nsec = pe->pe_nscn;
+
+ STAILQ_FOREACH(ps, &pe->pe_scn, ps_next) {
+ sh = &ps->ps_sh;
+
+ if (ps->ps_ndx == 0xFFFFFFFFU) {
+ ch->ch_symptr = sh->sh_rawptr;
+ ch->ch_nsym = pe->pe_nsym;
+ }
+
+ if (pe->pe_obj == PE_O_PE32 || pe->pe_obj == PE_O_PE32P) {
+ if (ps->ps_ndx == (0xFFFF0000 | PE_DD_BASERELOC) ||
+ strncmp(sh->sh_name, ".reloc", strlen(".reloc")) ==
+ 0) {
+ reloc = 1;
+ reloc_rva = sh->sh_addr;
+ reloc_sz = sh->sh_virtsize;
+ }
+ }
+ }
+
+ if (!reloc)
+ ch->ch_char |= IMAGE_FILE_RELOCS_STRIPPED;
+
+ if (pe->pe_flags & LIBPE_F_BAD_OPT_HEADER) {
+ if (pe->pe_obj == PE_O_PE32)
+ ch->ch_optsize = PE_COFF_OPT_SIZE_32;
+ else if (pe->pe_obj == PE_O_PE32P)
+ ch->ch_optsize = PE_COFF_OPT_SIZE_32P;
+ else
+ ch->ch_optsize = 0;
+ }
+
+ /*
+ * Write the COFF header.
+ */
+ hdr = tmp;
+ PE_WRITE16(hdr, ch->ch_machine);
+ PE_WRITE16(hdr, ch->ch_nsec);
+ PE_WRITE32(hdr, ch->ch_timestamp);
+ PE_WRITE32(hdr, ch->ch_symptr);
+ PE_WRITE32(hdr, ch->ch_nsym);
+ PE_WRITE16(hdr, ch->ch_optsize);
+ PE_WRITE16(hdr, ch->ch_char);
+ if (write(pe->pe_fd, tmp, sizeof(PE_CoffHdr)) !=
+ (ssize_t) sizeof(PE_CoffHdr)) {
+ errno = EIO;
+ return (-1);
+ }
+
+coff_done:
+ off += sizeof(PE_CoffHdr);
+ pe->pe_flags &= ~LIBPE_F_DIRTY_COFF_HEADER;
+ pe->pe_flags &= ~LIBPE_F_BAD_COFF_HEADER;
+ pe->pe_flags |= LIBPE_F_DIRTY_SEC_HEADER;
+
+ if (ch->ch_optsize == 0)
+ return (off);
+
+ /*
+ * Write the Optional header.
+ */
+
+ if (pe->pe_cmd == PE_C_RDWR) {
+ if ((pe->pe_flags & LIBPE_F_DIRTY_OPT_HEADER) == 0 &&
+ (pe->pe_flags & LIBPE_F_BAD_OPT_HEADER) == 0) {
+ if (lseek(pe->pe_fd, (off_t) ch->ch_optsize,
+ SEEK_CUR) < 0) {
+ errno = EIO;
+ return (-1);
+ }
+ off += ch->ch_optsize;
+ return (off);
+ }
+
+ }
+
+ if (pe->pe_oh == NULL) {
+ if ((oh = calloc(1, sizeof(PE_OptHdr))) == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ pe->pe_oh = oh;
+ } else
+ oh = pe->pe_oh;
+
+ if (pe->pe_obj == PE_O_PE32)
+ oh->oh_magic = PE_FORMAT_32;
+ else
+ oh->oh_magic = PE_FORMAT_32P;
+
+ /*
+ * LinkerVersion should not be less than 2.5, which will cause
+ * Windows to complain the executable is invalid in some case.
+ * By default we set LinkerVersion to 2.22 (binutils 2.22)
+ */
+ if (!oh->oh_ldvermajor && !oh->oh_ldverminor) {
+ oh->oh_ldvermajor = 2;
+ oh->oh_ldverminor = 22;
+ }
+
+ /*
+ * The library always tries to write out all 16 data directories
+ * but the actual data dir written will depend on ch_optsize.
+ */
+ oh->oh_ndatadir = PE_DD_MAX;
+
+ if (!oh->oh_filealign)
+ oh->oh_filealign = 0x200;
+ if (!oh->oh_secalign)
+ oh->oh_secalign = 0x1000;
+ oh->oh_hdrsize = roundup(off + ch->ch_optsize + pe->pe_nscn *
+ sizeof(PE_SecHdr), oh->oh_filealign);
+ oh->oh_imgsize = roundup(pe->pe_rvamax, oh->oh_secalign);
+
+#define WRITE_OPT(n) \
+ do { \
+ /* \
+ * Since the Optional Header size is variable, we must \
+ * check if the requested write size will overrun the \
+ * remaining header bytes. \
+ */ \
+ if (p + (n) > ch->ch_optsize) { \
+ /* Pad the "extra" bytes */ \
+ if (libpe_pad(pe, ch->ch_optsize - p) < 0) { \
+ errno = EIO; \
+ return (-1); \
+ } \
+ goto opt_done; \
+ } \
+ if (write(pe->pe_fd, tmp, (n)) != (ssize_t) (n)) { \
+ errno = EIO; \
+ return (-1); \
+ } \
+ p += (n); \
+ } while (0)
+#define WRITE_OPT8(v) do { *tmp = (v); WRITE_OPT(1); } while(0)
+#define WRITE_OPT16(v) do { le16enc(tmp, (v)); WRITE_OPT(2); } while(0)
+#define WRITE_OPT32(v) do { le32enc(tmp, (v)); WRITE_OPT(4); } while(0)
+#define WRITE_OPT64(v) do { le64enc(tmp, (v)); WRITE_OPT(8); } while(0)
+
+ p = 0;
+ WRITE_OPT16(oh->oh_magic);
+ if (oh->oh_magic == PE_FORMAT_32P)
+ pe->pe_obj = PE_O_PE32P;
+ WRITE_OPT8(oh->oh_ldvermajor);
+ WRITE_OPT8(oh->oh_ldverminor);
+ WRITE_OPT32(oh->oh_textsize);
+ WRITE_OPT32(oh->oh_datasize);
+ WRITE_OPT32(oh->oh_bsssize);
+ WRITE_OPT32(oh->oh_entry);
+ WRITE_OPT32(oh->oh_textbase);
+ if (oh->oh_magic != PE_FORMAT_32P) {
+ WRITE_OPT32(oh->oh_database);
+ WRITE_OPT32(oh->oh_imgbase);
+ } else
+ WRITE_OPT64(oh->oh_imgbase);
+ WRITE_OPT32(oh->oh_secalign);
+ WRITE_OPT32(oh->oh_filealign);
+ WRITE_OPT16(oh->oh_osvermajor);
+ WRITE_OPT16(oh->oh_osverminor);
+ WRITE_OPT16(oh->oh_imgvermajor);
+ WRITE_OPT16(oh->oh_imgverminor);
+ WRITE_OPT16(oh->oh_subvermajor);
+ WRITE_OPT16(oh->oh_subverminor);
+ WRITE_OPT32(oh->oh_win32ver);
+ WRITE_OPT32(oh->oh_imgsize);
+ WRITE_OPT32(oh->oh_hdrsize);
+ WRITE_OPT32(oh->oh_checksum);
+ WRITE_OPT16(oh->oh_subsystem);
+ WRITE_OPT16(oh->oh_dllchar);
+ if (oh->oh_magic != PE_FORMAT_32P) {
+ WRITE_OPT32(oh->oh_stacksizer);
+ WRITE_OPT32(oh->oh_stacksizec);
+ WRITE_OPT32(oh->oh_heapsizer);
+ WRITE_OPT32(oh->oh_heapsizec);
+ } else {
+ WRITE_OPT64(oh->oh_stacksizer);
+ WRITE_OPT64(oh->oh_stacksizec);
+ WRITE_OPT64(oh->oh_heapsizer);
+ WRITE_OPT64(oh->oh_heapsizec);
+ }
+ WRITE_OPT32(oh->oh_ldrflags);
+ WRITE_OPT32(oh->oh_ndatadir);
+
+ /*
+ * Write the Data Directories.
+ */
+
+ if (oh->oh_ndatadir > 0) {
+ if (pe->pe_dd == NULL) {
+ if ((dd = calloc(1, sizeof(PE_DataDir))) == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ pe->pe_dd = dd;
+ dd->dd_total = PE_DD_MAX;
+ } else
+ dd = pe->pe_dd;
+
+ assert(oh->oh_ndatadir <= PE_DD_MAX);
+
+ if (reloc) {
+ dd->dd_e[PE_DD_BASERELOC].de_addr = reloc_rva;
+ dd->dd_e[PE_DD_BASERELOC].de_size = reloc_sz;
+ }
+
+ for (i = 0; (uint32_t) i < dd->dd_total; i++) {
+ WRITE_OPT32(dd->dd_e[i].de_addr);
+ WRITE_OPT32(dd->dd_e[i].de_size);
+ }
+ }
+
+ /* Pad the remaining bytes in the Optional header, if any. */
+ if (ch->ch_optsize > p) {
+ if (libpe_pad(pe, ch->ch_optsize - p) < 0) {
+ errno = EIO;
+ return (-1);
+ }
+ }
+
+opt_done:
+ off += ch->ch_optsize;
+ pe->pe_flags &= ~LIBPE_F_DIRTY_OPT_HEADER;
+ pe->pe_flags &= ~LIBPE_F_BAD_OPT_HEADER;
+ pe->pe_flags |= LIBPE_F_DIRTY_SEC_HEADER;
+
+ return (off);
+}
diff --git a/libpe/libpe_dos.c b/libpe/libpe_dos.c
new file mode 100644
index 000000000000..a48ad1241597
--- /dev/null
+++ b/libpe/libpe_dos.c
@@ -0,0 +1,403 @@
+/*-
+ * Copyright (c) 2015 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: libpe_dos.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+int
+libpe_parse_msdos_header(PE *pe, char *hdr)
+{
+ PE_DosHdr *dh;
+ char coff[sizeof(PE_CoffHdr)];
+ uint32_t pe_magic;
+ int i;
+
+ if ((pe->pe_stub = malloc(sizeof(PE_DosHdr))) == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ memcpy(pe->pe_stub, hdr, sizeof(PE_DosHdr));
+
+ if ((dh = malloc(sizeof(*dh))) == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ pe->pe_dh = dh;
+
+ /* Read the conventional MS-DOS EXE header. */
+ memcpy(dh->dh_magic, hdr, 2);
+ hdr += 2;
+ PE_READ16(hdr, dh->dh_lastsize);
+ PE_READ16(hdr, dh->dh_nblock);
+ PE_READ16(hdr, dh->dh_nreloc);
+ PE_READ16(hdr, dh->dh_hdrsize);
+ PE_READ16(hdr, dh->dh_minalloc);
+ PE_READ16(hdr, dh->dh_maxalloc);
+ PE_READ16(hdr, dh->dh_ss);
+ PE_READ16(hdr, dh->dh_sp);
+ PE_READ16(hdr, dh->dh_checksum);
+ PE_READ16(hdr, dh->dh_ip);
+ PE_READ16(hdr, dh->dh_cs);
+ PE_READ16(hdr, dh->dh_relocpos);
+ PE_READ16(hdr, dh->dh_noverlay);
+
+ /* Do not continue if the EXE is not a PE/NE/... (new executable) */
+ if (dh->dh_relocpos != 0x40) {
+ pe->pe_flags |= LIBPE_F_BAD_DOS_HEADER;
+ return (0);
+ }
+
+ for (i = 0; i < 4; i++)
+ PE_READ16(hdr, dh->dh_reserved1[i]);
+ PE_READ16(hdr, dh->dh_oemid);
+ PE_READ16(hdr, dh->dh_oeminfo);
+ for (i = 0; i < 10; i++)
+ PE_READ16(hdr, dh->dh_reserved2[i]);
+ PE_READ32(hdr, dh->dh_lfanew);
+
+ /* Check if the e_lfanew pointer is valid. */
+ if (dh->dh_lfanew > pe->pe_fsize - 4) {
+ pe->pe_flags |= LIBPE_F_BAD_DOS_HEADER;
+ return (0);
+ }
+
+ if (dh->dh_lfanew < sizeof(PE_DosHdr) &&
+ (pe->pe_flags & LIBPE_F_SPECIAL_FILE)) {
+ pe->pe_flags |= LIBPE_F_BAD_DOS_HEADER;
+ return (0);
+ }
+
+ if (dh->dh_lfanew > sizeof(PE_DosHdr)) {
+ pe->pe_stub_ex = dh->dh_lfanew - sizeof(PE_DosHdr);
+ if (pe->pe_flags & LIBPE_F_SPECIAL_FILE) {
+ /* Read in DOS stub now. */
+ if (libpe_read_msdos_stub(pe) < 0) {
+ pe->pe_flags |= LIBPE_F_BAD_DOS_HEADER;
+ return (0);
+ }
+ }
+ }
+
+ if ((pe->pe_flags & LIBPE_F_SPECIAL_FILE) == 0) {
+ /* Jump to the PE header. */
+ if (lseek(pe->pe_fd, (off_t) dh->dh_lfanew, SEEK_SET) < 0) {
+ pe->pe_flags |= LIBPE_F_BAD_PE_HEADER;
+ return (0);
+ }
+ }
+
+ if (read(pe->pe_fd, &pe_magic, 4) != 4 ||
+ htole32(pe_magic) != PE_SIGNATURE) {
+ pe->pe_flags |= LIBPE_F_BAD_PE_HEADER;
+ return (0);
+ }
+
+ if (read(pe->pe_fd, coff, sizeof(coff)) != (ssize_t) sizeof(coff)) {
+ pe->pe_flags |= LIBPE_F_BAD_COFF_HEADER;
+ return (0);
+ }
+
+ return (libpe_parse_coff_header(pe, coff));
+}
+
+int
+libpe_read_msdos_stub(PE *pe)
+{
+ void *m;
+
+ assert(pe->pe_stub_ex > 0 &&
+ (pe->pe_flags & LIBPE_F_LOAD_DOS_STUB) == 0);
+
+ if ((pe->pe_flags & LIBPE_F_SPECIAL_FILE) == 0) {
+ if (lseek(pe->pe_fd, (off_t) sizeof(PE_DosHdr), SEEK_SET) <
+ 0) {
+ errno = EIO;
+ goto fail;
+ }
+ }
+
+ if ((m = realloc(pe->pe_stub, sizeof(PE_DosHdr) + pe->pe_stub_ex)) ==
+ NULL) {
+ errno = ENOMEM;
+ goto fail;
+ }
+ pe->pe_stub = m;
+
+ if (read(pe->pe_fd, pe->pe_stub + sizeof(PE_DosHdr), pe->pe_stub_ex) !=
+ (ssize_t) pe->pe_stub_ex) {
+ errno = EIO;
+ goto fail;
+ }
+
+ pe->pe_flags |= LIBPE_F_LOAD_DOS_STUB;
+
+ /* Search for the Rich header embedded just before the PE header. */
+ (void) libpe_parse_rich_header(pe);
+
+ return (0);
+
+fail:
+ pe->pe_stub_ex = 0;
+
+ return (-1);
+}
+
+/*
+ * The "standard" MS-DOS stub displaying "This program cannot be run in
+ * DOS mode".
+ */
+static const char msdos_stub[] = {
+ '\x0e','\x1f','\xba','\x0e','\x00','\xb4','\x09','\xcd',
+ '\x21','\xb8','\x01','\x4c','\xcd','\x21','\x54','\x68',
+ '\x69','\x73','\x20','\x70','\x72','\x6f','\x67','\x72',
+ '\x61','\x6d','\x20','\x63','\x61','\x6e','\x6e','\x6f',
+ '\x74','\x20','\x62','\x65','\x20','\x72','\x75','\x6e',
+ '\x20','\x69','\x6e','\x20','\x44','\x4f','\x53','\x20',
+ '\x6d','\x6f','\x64','\x65','\x2e','\x0d','\x0d','\x0a',
+ '\x24','\x00','\x00','\x00','\x00','\x00','\x00','\x00',
+};
+
+static void
+init_dos_header(PE_DosHdr *dh)
+{
+
+ dh->dh_magic[0] = 'M';
+ dh->dh_magic[1] = 'Z';
+ dh->dh_lastsize = 144;
+ dh->dh_nblock = 3;
+ dh->dh_hdrsize = 4;
+ dh->dh_maxalloc = 65535;
+ dh->dh_sp = 184;
+ dh->dh_relocpos = 0x40;
+ dh->dh_lfanew = 0x80;
+}
+
+off_t
+libpe_write_msdos_stub(PE *pe, off_t off)
+{
+ PE_DosHdr *dh;
+ char tmp[sizeof(PE_DosHdr)], *hdr;
+ off_t d;
+ int i, strip_rich;
+
+ strip_rich = 0;
+
+ if (pe->pe_cmd == PE_C_RDWR) {
+ assert((pe->pe_flags & LIBPE_F_SPECIAL_FILE) == 0);
+
+ if (pe->pe_dh != NULL &&
+ (pe->pe_flags & PE_F_STRIP_DOS_STUB)) {
+ /*
+ * If we strip MS-DOS stub, everything after it
+ * needs rewritten.
+ */
+ pe->pe_flags |= LIBPE_F_BAD_PE_HEADER;
+ goto done;
+ }
+
+ /*
+ * lseek(2) to the PE signature if MS-DOS stub is not
+ * modified.
+ */
+ if (pe->pe_dh != NULL &&
+ (pe->pe_flags & LIBPE_F_DIRTY_DOS_HEADER) == 0 &&
+ (pe->pe_flags & LIBPE_F_BAD_DOS_HEADER) == 0 &&
+ (pe->pe_flags & PE_F_STRIP_RICH_HEADER) == 0) {
+ if (lseek(pe->pe_fd,
+ (off_t) (sizeof(PE_DosHdr) + pe->pe_stub_ex),
+ SEEK_CUR) < 0) {
+ errno = EIO;
+ return (-1);
+ }
+ off = sizeof(PE_DosHdr) + pe->pe_stub_ex;
+ goto done;
+ }
+
+ /* Check if we should strip the Rich header. */
+ if (pe->pe_dh != NULL && pe->pe_stub_app == NULL &&
+ (pe->pe_flags & LIBPE_F_BAD_DOS_HEADER) == 0 &&
+ (pe->pe_flags & PE_F_STRIP_RICH_HEADER)) {
+ if ((pe->pe_flags & LIBPE_F_LOAD_DOS_STUB) == 0) {
+ (void) libpe_read_msdos_stub(pe);
+ if (lseek(pe->pe_fd, off, SEEK_SET) < 0) {
+ errno = EIO;
+ return (-1);
+ }
+ }
+ if (pe->pe_rh != NULL) {
+ strip_rich = 1;
+ pe->pe_flags |= LIBPE_F_DIRTY_DOS_HEADER;
+ }
+ }
+
+ /*
+ * If length of MS-DOS stub will change, Mark the PE
+ * signature is broken so that the PE signature and the
+ * headers follow it will be rewritten.
+ *
+ * The sections should be loaded now since the stub might
+ * overwrite the section data.
+ */
+ if ((pe->pe_flags & LIBPE_F_BAD_DOS_HEADER) ||
+ (pe->pe_stub_app != NULL && pe->pe_stub_app_sz !=
+ sizeof(PE_DosHdr) + pe->pe_stub_ex) || strip_rich) {
+ if (libpe_load_all_sections(pe) < 0)
+ return (-1);
+ if (lseek(pe->pe_fd, off, SEEK_SET) < 0) {
+ errno = EIO;
+ return (-1);
+ }
+ pe->pe_flags |= LIBPE_F_BAD_PE_HEADER;
+ }
+ }
+
+ if (pe->pe_flags & PE_F_STRIP_DOS_STUB)
+ goto done;
+
+ /* Always use application supplied MS-DOS stub, if exists. */
+ if (pe->pe_stub_app != NULL && pe->pe_stub_app_sz > 0) {
+ if (write(pe->pe_fd, pe->pe_stub_app, pe->pe_stub_app_sz) !=
+ (ssize_t) pe->pe_stub_app_sz) {
+ errno = EIO;
+ return (-1);
+ }
+ off = pe->pe_stub_app_sz;
+ goto done;
+ }
+
+ /*
+ * Write MS-DOS header.
+ */
+
+ if (pe->pe_dh == NULL) {
+ if ((dh = calloc(1, sizeof(PE_DosHdr))) == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ pe->pe_dh = dh;
+
+ init_dos_header(dh);
+
+ pe->pe_flags |= LIBPE_F_DIRTY_DOS_HEADER;
+ } else
+ dh = pe->pe_dh;
+
+ if (pe->pe_flags & LIBPE_F_BAD_DOS_HEADER)
+ init_dos_header(dh);
+
+ if (strip_rich) {
+ d = pe->pe_rh_start - pe->pe_stub;
+ dh->dh_lfanew = roundup(d, 8);
+ }
+
+ if ((pe->pe_flags & LIBPE_F_DIRTY_DOS_HEADER) ||
+ (pe->pe_flags & LIBPE_F_BAD_DOS_HEADER)) {
+ memcpy(tmp, dh->dh_magic, 2);
+ hdr = tmp + 2;
+ PE_WRITE16(hdr, dh->dh_lastsize);
+ PE_WRITE16(hdr, dh->dh_nblock);
+ PE_WRITE16(hdr, dh->dh_nreloc);
+ PE_WRITE16(hdr, dh->dh_hdrsize);
+ PE_WRITE16(hdr, dh->dh_minalloc);
+ PE_WRITE16(hdr, dh->dh_maxalloc);
+ PE_WRITE16(hdr, dh->dh_ss);
+ PE_WRITE16(hdr, dh->dh_sp);
+ PE_WRITE16(hdr, dh->dh_checksum);
+ PE_WRITE16(hdr, dh->dh_ip);
+ PE_WRITE16(hdr, dh->dh_cs);
+ PE_WRITE16(hdr, dh->dh_relocpos);
+ PE_WRITE16(hdr, dh->dh_noverlay);
+ for (i = 0; i < 4; i++)
+ PE_WRITE16(hdr, dh->dh_reserved1[i]);
+ PE_WRITE16(hdr, dh->dh_oemid);
+ PE_WRITE16(hdr, dh->dh_oeminfo);
+ for (i = 0; i < 10; i++)
+ PE_WRITE16(hdr, dh->dh_reserved2[i]);
+ PE_WRITE32(hdr, dh->dh_lfanew);
+
+ if (write(pe->pe_fd, tmp, sizeof(tmp)) !=
+ (ssize_t) sizeof(tmp)) {
+ errno = EIO;
+ return (-1);
+ }
+ } else {
+ assert((pe->pe_flags & LIBPE_F_SPECIAL_FILE) == 0);
+ if (lseek(pe->pe_fd, (off_t) sizeof(PE_DosHdr), SEEK_CUR) <
+ 0) {
+ errno = EIO;
+ return (-1);
+ }
+ }
+
+ off = sizeof(PE_DosHdr);
+
+ /*
+ * Write the MS-DOS stub.
+ */
+
+ if (strip_rich) {
+ assert((pe->pe_flags & LIBPE_F_SPECIAL_FILE) == 0);
+ assert(pe->pe_stub != NULL && pe->pe_rh_start != NULL);
+ d = pe->pe_rh_start - pe->pe_stub;
+ if (lseek(pe->pe_fd, d, SEEK_SET) < 0) {
+ errno = EIO;
+ return (-1);
+ }
+ off = d;
+ goto done;
+ }
+
+ if (pe->pe_cmd == PE_C_RDWR) {
+ if (lseek(pe->pe_fd, (off_t) pe->pe_stub_ex, SEEK_CUR) < 0) {
+ errno = EIO;
+ return (-1);
+ }
+ off += pe->pe_stub_ex;
+ goto done;
+ }
+
+ if (write(pe->pe_fd, msdos_stub, sizeof(msdos_stub)) !=
+ (ssize_t) sizeof(msdos_stub)) {
+ errno = EIO;
+ return (-1);
+ }
+ off += sizeof(msdos_stub);
+
+done:
+ pe->pe_flags &= ~LIBPE_F_DIRTY_DOS_HEADER;
+ pe->pe_flags &= ~LIBPE_F_BAD_DOS_HEADER;
+
+ return (off);
+}
diff --git a/libpe/libpe_init.c b/libpe/libpe_init.c
new file mode 100644
index 000000000000..2579774bf0c5
--- /dev/null
+++ b/libpe/libpe_init.c
@@ -0,0 +1,145 @@
+/*-
+ * Copyright (c) 2015 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/stat.h>
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: libpe_init.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+int
+libpe_open_object(PE *pe)
+{
+ struct stat sb;
+ mode_t mode;
+ char magic[sizeof(PE_DosHdr)];
+
+ if (fstat(pe->pe_fd, &sb) < 0)
+ return (-1);
+
+ mode = sb.st_mode;
+ pe->pe_fsize = (size_t) sb.st_size;
+
+ /* Reject unsupported file types. */
+ if (!S_ISREG(mode) && !S_ISCHR(mode) && !S_ISFIFO(mode) &&
+ !S_ISSOCK(mode)) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ /* Read/Write mode is not supported for non-regular file. */
+ if (pe->pe_cmd == PE_C_RDWR && !S_ISREG(mode)) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ /* The minimal file should at least contain a COFF header. */
+ if (S_ISREG(mode) && pe->pe_fsize < sizeof(PE_CoffHdr)) {
+ errno = ENOENT;
+ return (-1);
+ }
+
+ /*
+ * Search for MS-DOS header or COFF header.
+ */
+
+ if (read(pe->pe_fd, magic, 2) != 2) {
+ errno = EIO;
+ return (-1);
+ }
+
+ if (magic[0] == 'M' && magic[1] == 'Z') {
+ pe->pe_obj = PE_O_PE32;
+ if (read(pe->pe_fd, &magic[2], sizeof(PE_DosHdr) - 2) !=
+ (ssize_t) sizeof(PE_DosHdr) - 2) {
+ errno = EIO;
+ return (-1);
+ }
+ return (libpe_parse_msdos_header(pe, magic));
+
+ } else if (magic[0] == 'P' && magic[1] == 'E') {
+ if (read(pe->pe_fd, magic, 2) != 2) {
+ errno = EIO;
+ return (-1);
+ }
+ if (magic[0] == '\0' && magic[1] == '\0') {
+ pe->pe_obj = PE_O_PE32;
+ if (read(pe->pe_fd, magic, sizeof(PE_CoffHdr)) !=
+ (ssize_t) sizeof(PE_CoffHdr)) {
+ errno = EIO;
+ return (-1);
+ }
+ return (libpe_parse_coff_header(pe, magic));
+ }
+ errno = ENOENT;
+ return (-1);
+
+ } else {
+ pe->pe_obj = PE_O_COFF;
+ if (read(pe->pe_fd, &magic[2], sizeof(PE_CoffHdr) - 2) !=
+ (ssize_t) sizeof(PE_CoffHdr) - 2) {
+ errno = EIO;
+ return (-1);
+ }
+ return (libpe_parse_coff_header(pe, magic));
+ }
+}
+
+void
+libpe_release_object(PE *pe)
+{
+ PE_Scn *ps, *_ps;
+
+ if (pe->pe_dh)
+ free(pe->pe_dh);
+
+ if (pe->pe_rh) {
+ free(pe->pe_rh->rh_compid);
+ free(pe->pe_rh->rh_cnt);
+ free(pe->pe_rh);
+ }
+
+ if (pe->pe_ch)
+ free(pe->pe_ch);
+
+ if (pe->pe_oh)
+ free(pe->pe_oh);
+
+ if (pe->pe_dd)
+ free(pe->pe_dd);
+
+ if (pe->pe_stub)
+ free(pe->pe_stub);
+
+ STAILQ_FOREACH_SAFE(ps, &pe->pe_scn, ps_next, _ps)
+ libpe_release_scn(ps);
+
+ free(pe);
+}
diff --git a/libpe/libpe_rich.c b/libpe/libpe_rich.c
new file mode 100644
index 000000000000..4669a224d004
--- /dev/null
+++ b/libpe/libpe_rich.c
@@ -0,0 +1,128 @@
+/*-
+ * Copyright (c) 2015 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: libpe_rich.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+static char *
+memfind(char *s, const char *find, size_t slen, size_t flen)
+{
+ int i;
+
+ if (slen == 0 || flen == 0 || flen > slen)
+ return (NULL);
+
+ for (i = 0; (size_t) i <= slen - flen; i++) {
+ if (s[i] != find[0])
+ continue;
+ if (flen == 1)
+ return (&s[i]);
+ if (memcmp(&s[i + 1], &find[1], flen - 1) == 0)
+ return (&s[i]);
+ }
+
+ return (NULL);
+}
+
+int
+libpe_parse_rich_header(PE *pe)
+{
+ PE_RichHdr *rh;
+ char *p, *r, *s;
+ uint32_t x;
+ int found, i;
+
+ assert(pe->pe_stub != NULL && pe->pe_stub_ex > 0);
+
+ /* Search for the "Rich" keyword to locate the Rich header. */
+ s = pe->pe_stub + sizeof(PE_DosHdr);
+ r = memfind(s, PE_RICH_TEXT, pe->pe_stub_ex, 4);
+ if (r == NULL || r + 8 > s + pe->pe_stub_ex) {
+ errno = ENOENT;
+ return (-1);
+ }
+
+ if ((rh = calloc(1, sizeof(*rh))) == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+
+ rh->rh_xor = le32dec(r + 4); /* Retrieve the "XOR mask" */
+
+ /*
+ * Search for the hidden keyword "DanS" by XOR the dwords before
+ * the "Rich" keyword with the XOR mask.
+ */
+ found = 0;
+ for (p = r - 4; p >= s; p -= 4) {
+ x = le32dec(p) ^ rh->rh_xor;
+ if (x == PE_RICH_HIDDEN) {
+ found = 1;
+ break;
+ }
+ }
+ if (!found) {
+ free(rh);
+ errno = ENOENT;
+ return (-1);
+ }
+
+ /*
+ * Found the "DanS" keyword, which is the start of the Rich header.
+ * The next step is to skip the first 16 bytes (DanS, XOR mask,
+ * XOR mask, XOR mask) and read the (compid,cnt) tuples.
+ */
+ pe->pe_rh_start = p;
+ p += 16;
+ rh->rh_total = (r - p) / 8;
+ if ((rh->rh_compid = malloc(rh->rh_total * sizeof(*rh->rh_compid))) ==
+ NULL) {
+ free(rh);
+ errno = ENOMEM;
+ return (-1);
+ }
+ if ((rh->rh_cnt = malloc(rh->rh_total * sizeof(*rh->rh_cnt))) ==
+ NULL) {
+ free(rh->rh_compid);
+ free(rh);
+ errno = ENOMEM;
+ return (-1);
+ }
+ for (i = 0; (uint32_t) i < rh->rh_total; i++, p += 8) {
+ rh->rh_compid[i] = le32dec(p) ^ rh->rh_xor;
+ rh->rh_cnt[i] = le32dec(p + 4) ^ rh->rh_xor;
+ }
+
+ pe->pe_rh = rh;
+
+ return (0);
+}
diff --git a/libpe/libpe_section.c b/libpe/libpe_section.c
new file mode 100644
index 000000000000..7ff63fbef60f
--- /dev/null
+++ b/libpe/libpe_section.c
@@ -0,0 +1,518 @@
+/*-
+ * Copyright (c) 2016 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: libpe_section.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+PE_Scn *
+libpe_alloc_scn(PE *pe)
+{
+ PE_Scn *ps;
+
+ if ((ps = calloc(1, sizeof(PE_Scn))) == NULL) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ STAILQ_INIT(&ps->ps_b);
+ ps->ps_pe = pe;
+
+ return (ps);
+}
+
+void
+libpe_release_scn(PE_Scn *ps)
+{
+ PE *pe;
+ PE_SecBuf *sb, *_sb;
+
+ assert(ps != NULL);
+
+ pe = ps->ps_pe;
+
+ STAILQ_REMOVE(&pe->pe_scn, ps, _PE_Scn, ps_next);
+
+ STAILQ_FOREACH_SAFE(sb, &ps->ps_b, sb_next, _sb)
+ libpe_release_buffer(sb);
+
+ free(ps);
+}
+
+static int
+cmp_scn(PE_Scn *a, PE_Scn *b)
+{
+
+ if (a->ps_sh.sh_addr < b->ps_sh.sh_addr)
+ return (-1);
+ else if (a->ps_sh.sh_addr == b->ps_sh.sh_addr)
+ return (0);
+ else
+ return (1);
+}
+
+static void
+sort_sections(PE *pe)
+{
+
+ if (STAILQ_EMPTY(&pe->pe_scn))
+ return;
+
+ /* Sort the list of Scn by RVA in ascending order. */
+ STAILQ_SORT(&pe->pe_scn, _PE_Scn, ps_next, cmp_scn);
+}
+
+int
+libpe_parse_section_headers(PE *pe)
+{
+ char tmp[sizeof(PE_SecHdr)], *hdr;
+ PE_Scn *ps;
+ PE_SecHdr *sh;
+ PE_CoffHdr *ch;
+ PE_DataDir *dd;
+ int found, i;
+
+ assert(pe->pe_ch != NULL);
+
+ for (i = 0; (uint16_t) i < pe->pe_ch->ch_nsec; i++) {
+ if (read(pe->pe_fd, tmp, sizeof(PE_SecHdr)) !=
+ (ssize_t) sizeof(PE_SecHdr)) {
+ pe->pe_flags |= LIBPE_F_BAD_SEC_HEADER;
+ return (0);
+ }
+
+ if ((ps = libpe_alloc_scn(pe)) == NULL)
+ return (-1);
+ STAILQ_INSERT_TAIL(&pe->pe_scn, ps, ps_next);
+ ps->ps_ndx = ++pe->pe_nscn; /* Setion index is 1-based */
+ sh = &ps->ps_sh;
+
+ /*
+ * Note that the section name won't be NUL-terminated if
+ * its length happens to be 8.
+ */
+ memcpy(sh->sh_name, tmp, sizeof(sh->sh_name));
+ hdr = tmp + 8;
+ PE_READ32(hdr, sh->sh_virtsize);
+ PE_READ32(hdr, sh->sh_addr);
+ PE_READ32(hdr, sh->sh_rawsize);
+ PE_READ32(hdr, sh->sh_rawptr);
+ PE_READ32(hdr, sh->sh_relocptr);
+ PE_READ32(hdr, sh->sh_lineptr);
+ PE_READ16(hdr, sh->sh_nreloc);
+ PE_READ16(hdr, sh->sh_nline);
+ PE_READ32(hdr, sh->sh_char);
+ }
+
+ /*
+ * For all the data directories that don't belong to any section,
+ * we create pseudo sections for them to make layout easier.
+ */
+ dd = pe->pe_dd;
+ if (dd != NULL && dd->dd_total > 0) {
+ for (i = 0; (uint32_t) i < pe->pe_dd->dd_total; i++) {
+ if (dd->dd_e[i].de_size == 0)
+ continue;
+ found = 0;
+ STAILQ_FOREACH(ps, &pe->pe_scn, ps_next) {
+ sh = &ps->ps_sh;
+ if (dd->dd_e[i].de_addr >= sh->sh_addr &&
+ dd->dd_e[i].de_addr + dd->dd_e[i].de_size <=
+ sh->sh_addr + sh->sh_virtsize) {
+ found = 1;
+ break;
+ }
+ }
+ if (found)
+ continue;
+
+ if ((ps = libpe_alloc_scn(pe)) == NULL)
+ return (-1);
+ STAILQ_INSERT_TAIL(&pe->pe_scn, ps, ps_next);
+ ps->ps_ndx = 0xFFFF0000U | i;
+ sh = &ps->ps_sh;
+ sh->sh_rawptr = dd->dd_e[i].de_addr; /* FIXME */
+ sh->sh_rawsize = dd->dd_e[i].de_size;
+ }
+ }
+
+ /*
+ * Also consider the COFF symbol table as a pseudo section.
+ */
+ ch = pe->pe_ch;
+ if (ch->ch_nsym > 0) {
+ if ((ps = libpe_alloc_scn(pe)) == NULL)
+ return (-1);
+ STAILQ_INSERT_TAIL(&pe->pe_scn, ps, ps_next);
+ ps->ps_ndx = 0xFFFFFFFFU;
+ sh = &ps->ps_sh;
+ sh->sh_rawptr = ch->ch_symptr;
+ sh->sh_rawsize = ch->ch_nsym * PE_SYM_ENTRY_SIZE;
+ pe->pe_nsym = ch->ch_nsym;
+ }
+
+ /* PE file headers initialization is complete if we reach here. */
+ return (0);
+}
+
+int
+libpe_load_section(PE *pe, PE_Scn *ps)
+{
+ PE_SecHdr *sh;
+ PE_SecBuf *sb;
+ size_t sz;
+ char tmp[4];
+
+ assert(pe != NULL && ps != NULL);
+ assert((ps->ps_flags & LIBPE_F_LOAD_SECTION) == 0);
+
+ sh = &ps->ps_sh;
+
+ /* Allocate a PE_SecBuf struct without buffer for empty sections. */
+ if (sh->sh_rawsize == 0) {
+ (void) libpe_alloc_buffer(ps, 0);
+ ps->ps_flags |= LIBPE_F_LOAD_SECTION;
+ return (0);
+ }
+
+ if ((pe->pe_flags & LIBPE_F_SPECIAL_FILE) == 0) {
+ if (lseek(pe->pe_fd, (off_t) sh->sh_rawptr, SEEK_SET) < 0) {
+ errno = EIO;
+ return (-1);
+ }
+ }
+
+ if ((sb = libpe_alloc_buffer(ps, sh->sh_rawsize)) == NULL)
+ return (-1);
+
+ if (read(pe->pe_fd, sb->sb_pb.pb_buf, sh->sh_rawsize) !=
+ (ssize_t) sh->sh_rawsize) {
+ errno = EIO;
+ return (-1);
+ }
+
+ if (ps->ps_ndx == 0xFFFFFFFFU) {
+ /*
+ * Index 0xFFFFFFFF indicates this section is a pseudo
+ * section that contains the COFF symbol table. We should
+ * read in the string table right after it.
+ */
+ if (read(pe->pe_fd, tmp, sizeof(tmp)) !=
+ (ssize_t) sizeof(tmp)) {
+ errno = EIO;
+ return (-1);
+ }
+ sz = le32dec(tmp);
+
+ /*
+ * The minimum value for the size field is 4, which indicates
+ * there is no string table.
+ */
+ if (sz > 4) {
+ sz -= 4;
+ if ((sb = libpe_alloc_buffer(ps, sz)) == NULL)
+ return (-1);
+ if (read(pe->pe_fd, sb->sb_pb.pb_buf, sz) !=
+ (ssize_t) sz) {
+ errno = EIO;
+ return (-1);
+ }
+ }
+ }
+
+ ps->ps_flags |= LIBPE_F_LOAD_SECTION;
+
+ return (0);
+}
+
+int
+libpe_load_all_sections(PE *pe)
+{
+ PE_Scn *ps;
+ PE_SecHdr *sh;
+ unsigned r, s;
+ off_t off;
+ char tmp[256];
+
+ /* Calculate the current offset into the file. */
+ off = 0;
+ if (pe->pe_dh != NULL)
+ off += pe->pe_dh->dh_lfanew + 4;
+ if (pe->pe_ch != NULL)
+ off += sizeof(PE_CoffHdr) + pe->pe_ch->ch_optsize;
+
+ STAILQ_FOREACH(ps, &pe->pe_scn, ps_next) {
+ if (ps->ps_flags & LIBPE_F_LOAD_SECTION)
+ continue;
+ sh = &ps->ps_sh;
+
+ /*
+ * For special files, we consume the padding in between
+ * and advance to the section offset.
+ */
+ if (pe->pe_flags & LIBPE_F_SPECIAL_FILE) {
+ /* Can't go backwards. */
+ if (off > sh->sh_rawptr) {
+ errno = EIO;
+ return (-1);
+ }
+ if (off < sh->sh_rawptr) {
+ r = sh->sh_rawptr - off;
+ for (; r > 0; r -= s) {
+ s = r > sizeof(tmp) ? sizeof(tmp) : r;
+ if (read(pe->pe_fd, tmp, s) !=
+ (ssize_t) s) {
+ errno = EIO;
+ return (-1);
+ }
+ }
+ }
+ }
+
+ /* Load the section content. */
+ if (libpe_load_section(pe, ps) < 0)
+ return (-1);
+ }
+
+ return (0);
+}
+
+int
+libpe_resync_sections(PE *pe, off_t off)
+{
+ PE_Scn *ps;
+ PE_SecHdr *sh;
+ size_t falign, nsec;
+
+ /* Firstly, sort all sections by their file offsets. */
+ sort_sections(pe);
+
+ /* Count the number of sections. */
+ nsec = 0;
+ STAILQ_FOREACH(ps, &pe->pe_scn, ps_next) {
+ if (ps->ps_flags & LIBPE_F_STRIP_SECTION)
+ continue;
+ if (ps->ps_ndx & 0xFFFF0000U)
+ continue;
+ nsec++;
+ }
+ pe->pe_nscn = nsec;
+
+ /*
+ * Calculate the file offset for the first section. (`off' is
+ * currently pointing to the COFF header.)
+ */
+ off += sizeof(PE_CoffHdr);
+ if (pe->pe_ch != NULL && pe->pe_ch->ch_optsize > 0)
+ off += pe->pe_ch->ch_optsize;
+ else {
+ switch (pe->pe_obj) {
+ case PE_O_PE32:
+ off += PE_COFF_OPT_SIZE_32;
+ break;
+ case PE_O_PE32P:
+ off += PE_COFF_OPT_SIZE_32P;
+ break;
+ case PE_O_COFF:
+ default:
+ break;
+ }
+ }
+ off += nsec * sizeof(PE_SecHdr);
+
+ /*
+ * Determine the file alignment for sections.
+ */
+ if (pe->pe_oh != NULL && pe->pe_oh->oh_filealign > 0)
+ falign = pe->pe_oh->oh_filealign;
+ else {
+ /*
+ * Use the default file alignment defined by the
+ * PE/COFF specification.
+ */
+ if (pe->pe_obj == PE_O_COFF)
+ falign = 4;
+ else
+ falign = 512;
+ }
+
+ /*
+ * Step through each section (and pseduo section) and verify
+ * alignment constraint and overlapping, make adjustment if need.
+ */
+ pe->pe_rvamax = 0;
+ STAILQ_FOREACH(ps, &pe->pe_scn, ps_next) {
+ if (ps->ps_flags & LIBPE_F_STRIP_SECTION)
+ continue;
+
+ sh = &ps->ps_sh;
+
+ if (sh->sh_addr + sh->sh_virtsize > pe->pe_rvamax)
+ pe->pe_rvamax = sh->sh_addr + sh->sh_virtsize;
+
+ if (ps->ps_ndx & 0xFFFF0000U)
+ ps->ps_falign = 4;
+ else
+ ps->ps_falign = falign;
+
+ off = roundup(off, ps->ps_falign);
+
+ if (off != sh->sh_rawptr)
+ ps->ps_flags |= PE_F_DIRTY;
+
+ if (ps->ps_flags & PE_F_DIRTY) {
+ if ((ps->ps_flags & LIBPE_F_LOAD_SECTION) == 0) {
+ if (libpe_load_section(pe, ps) < 0)
+ return (-1);
+ }
+ sh->sh_rawsize = libpe_resync_buffers(ps);
+ }
+
+ /*
+ * Sections only contains uninitialized data should set
+ * PointerToRawData to zero according to the PE/COFF
+ * specification.
+ */
+ if (sh->sh_rawsize == 0)
+ sh->sh_rawptr = 0;
+ else
+ sh->sh_rawptr = off;
+
+ off += sh->sh_rawsize;
+ }
+
+ return (0);
+}
+
+off_t
+libpe_write_section_headers(PE *pe, off_t off)
+{
+ char tmp[sizeof(PE_SecHdr)], *hdr;
+ PE_Scn *ps;
+ PE_SecHdr *sh;
+
+ if (pe->pe_flags & LIBPE_F_BAD_SEC_HEADER || pe->pe_nscn == 0)
+ return (off);
+
+ if ((pe->pe_flags & LIBPE_F_DIRTY_SEC_HEADER) == 0) {
+ off += sizeof(PE_SecHdr) * pe->pe_ch->ch_nsec;
+ return (off);
+ }
+
+ STAILQ_FOREACH(ps, &pe->pe_scn, ps_next) {
+ if (ps->ps_flags & LIBPE_F_STRIP_SECTION)
+ continue;
+ if (ps->ps_ndx & 0xFFFF0000U)
+ continue;
+ if ((pe->pe_flags & LIBPE_F_DIRTY_SEC_HEADER) == 0 &&
+ (ps->ps_flags & PE_F_DIRTY) == 0)
+ goto next_header;
+
+ sh = &ps->ps_sh;
+
+ memcpy(tmp, sh->sh_name, sizeof(sh->sh_name));
+ hdr = tmp + 8;
+ PE_WRITE32(hdr, sh->sh_virtsize);
+ PE_WRITE32(hdr, sh->sh_addr);
+ PE_WRITE32(hdr, sh->sh_rawsize);
+ PE_WRITE32(hdr, sh->sh_rawptr);
+ PE_WRITE32(hdr, sh->sh_relocptr);
+ PE_WRITE32(hdr, sh->sh_lineptr);
+ PE_WRITE16(hdr, sh->sh_nreloc);
+ PE_WRITE16(hdr, sh->sh_nline);
+ PE_WRITE32(hdr, sh->sh_char);
+
+ if (write(pe->pe_fd, tmp, sizeof(PE_SecHdr)) !=
+ (ssize_t) sizeof(PE_SecHdr)) {
+ errno = EIO;
+ return (-1);
+ }
+
+ next_header:
+ off += sizeof(PE_SecHdr);
+ }
+
+ return (off);
+}
+
+off_t
+libpe_write_sections(PE *pe, off_t off)
+{
+ PE_Scn *ps;
+ PE_SecHdr *sh;
+
+ if (pe->pe_flags & LIBPE_F_BAD_SEC_HEADER)
+ return (off);
+
+ STAILQ_FOREACH(ps, &pe->pe_scn, ps_next) {
+ sh = &ps->ps_sh;
+
+ if (ps->ps_flags & LIBPE_F_STRIP_SECTION)
+ continue;
+
+ /* Skip empty sections. */
+ if (sh->sh_rawptr == 0 || sh->sh_rawsize == 0)
+ continue;
+
+ /*
+ * Padding between sections. (padding always written
+ * in case the the section headers or sections are
+ * moved or shrinked.)
+ */
+ assert(off <= sh->sh_rawptr);
+ if (off < sh->sh_rawptr)
+ libpe_pad(pe, sh->sh_rawptr - off);
+
+ if ((ps->ps_flags & PE_F_DIRTY) == 0) {
+ assert((pe->pe_flags & LIBPE_F_SPECIAL_FILE) == 0);
+ if (lseek(pe->pe_fd,
+ (off_t) (sh->sh_rawptr + sh->sh_rawsize),
+ SEEK_SET) < 0) {
+ errno = EIO;
+ return (-1);
+ }
+ off = sh->sh_rawptr + sh->sh_rawsize;
+ continue;
+ }
+
+ off = sh->sh_rawptr;
+
+ if (libpe_write_buffers(ps) < 0)
+ return (-1);
+
+ off += sh->sh_rawsize;
+
+ ps->ps_flags &= ~PE_F_DIRTY;
+ }
+
+ return (off);
+}
diff --git a/libpe/libpe_utils.c b/libpe/libpe_utils.c
new file mode 100644
index 000000000000..9bc9a54bc4ea
--- /dev/null
+++ b/libpe/libpe_utils.c
@@ -0,0 +1,69 @@
+/*-
+ * Copyright (c) 2016 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: libpe_utils.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+off_t
+libpe_align(PE *pe, off_t off, size_t align)
+{
+ off_t n;
+
+ assert(align > 0 && (align & (align - 1)) == 0);
+
+ n = roundup(off, align);
+ if (n > off) {
+ if (libpe_pad(pe, n - off) < 0)
+ return (-1);
+ }
+
+ return (n);
+}
+
+int
+libpe_pad(PE *pe, size_t pad)
+{
+ char tmp[128];
+ size_t s;
+
+ memset(tmp, 0, sizeof(tmp));
+ for (; pad > 0; pad -= s) {
+ s = pad > sizeof(tmp) ? sizeof(tmp) : pad;
+ if (write(pe->pe_fd, tmp, s) != (ssize_t) s) {
+ errno = EIO;
+ return (-1);
+ }
+ }
+
+ return (0);
+}
diff --git a/libpe/os.Linux.mk b/libpe/os.Linux.mk
new file mode 100644
index 000000000000..ed5bdf00e835
--- /dev/null
+++ b/libpe/os.Linux.mk
@@ -0,0 +1,6 @@
+# $Id: os.Linux.mk 3312 2016-01-10 09:23:51Z kaiwang27 $
+
+CFLAGS+= -Wall -Wno-unused-parameter -Wstrict-prototypes \
+ -Wmissing-prototypes -Wpointer-arith -Wreturn-type \
+ -Wcast-qual -Wwrite-strings -Wswitch -Wshadow \
+ -Wcast-align -Wunused-parameter
diff --git a/libpe/os.NetBSD.mk b/libpe/os.NetBSD.mk
new file mode 100644
index 000000000000..ae214e3115c0
--- /dev/null
+++ b/libpe/os.NetBSD.mk
@@ -0,0 +1,2 @@
+# TODO(#511): Revert after the source tree is -Wconversion clean.
+WARNS=5
diff --git a/libpe/pe.h b/libpe/pe.h
new file mode 100644
index 000000000000..5b6130e47a7f
--- /dev/null
+++ b/libpe/pe.h
@@ -0,0 +1,292 @@
+/*-
+ * Copyright (c) 2015 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: pe.h 3312 2016-01-10 09:23:51Z kaiwang27 $
+ */
+
+#ifndef _PE_H_
+#define _PE_H_
+
+#include <stdint.h>
+
+/*
+ * MS-DOS header.
+ */
+
+typedef struct _PE_DosHdr {
+ char dh_magic[2];
+ uint16_t dh_lastsize;
+ uint16_t dh_nblock;
+ uint16_t dh_nreloc;
+ uint16_t dh_hdrsize;
+ uint16_t dh_minalloc;
+ uint16_t dh_maxalloc;
+ uint16_t dh_ss;
+ uint16_t dh_sp;
+ uint16_t dh_checksum;
+ uint16_t dh_ip;
+ uint16_t dh_cs;
+ uint16_t dh_relocpos;
+ uint16_t dh_noverlay;
+ uint16_t dh_reserved1[4];
+ uint16_t dh_oemid;
+ uint16_t dh_oeminfo;
+ uint16_t dh_reserved2[10];
+ uint32_t dh_lfanew;
+} PE_DosHdr;
+
+/*
+ * Rich header.
+ */
+
+typedef struct _PE_RichHdr {
+ uint32_t rh_xor;
+ uint32_t rh_total;
+ uint32_t *rh_compid;
+ uint32_t *rh_cnt;
+} PE_RichHdr;
+
+/*
+ * COFF header: Machine Types.
+ */
+
+#define IMAGE_FILE_MACHINE_UNKNOWN 0x0 /* not specified */
+#define IMAGE_FILE_MACHINE_AM33 0x1d3 /* Matsushita AM33 */
+#define IMAGE_FILE_MACHINE_AMD64 0x8664 /* x86-64 */
+#define IMAGE_FILE_MACHINE_ARM 0x1c0 /* ARM LE */
+#define IMAGE_FILE_MACHINE_ARMNT 0x1c4 /* ARMv7(or higher) Thumb */
+#define IMAGE_FILE_MACHINE_ARM64 0xaa64 /* ARMv8 64-bit */
+#define IMAGE_FILE_MACHINE_EBC 0xebc /* EFI byte code */
+#define IMAGE_FILE_MACHINE_I386 0x14c /* x86 */
+#define IMAGE_FILE_MACHINE_IA64 0x200 /* IA64 */
+#define IMAGE_FILE_MACHINE_M32R 0x9041 /* Mitsubishi M32R LE */
+#define IMAGE_FILE_MACHINE_MIPS16 0x266 /* MIPS16 */
+#define IMAGE_FILE_MACHINE_MIPSFPU 0x366 /* MIPS with FPU */
+#define IMAGE_FILE_MACHINE_MIPSFPU16 0x466 /* MIPS16 with FPU */
+#define IMAGE_FILE_MACHINE_POWERPC 0x1f0 /* Power PC LE */
+#define IMAGE_FILE_MACHINE_POWERPCFP 0x1f1 /* Power PC floating point */
+#define IMAGE_FILE_MACHINE_R4000 0x166 /* MIPS R4000 LE */
+#define IMAGE_FILE_MACHINE_SH3 0x1a2 /* Hitachi SH3 */
+#define IMAGE_FILE_MACHINE_SH3DSP 0x1a3 /* Hitachi SH3 DSP */
+#define IMAGE_FILE_MACHINE_SH4 0x1a6 /* Hitachi SH4 */
+#define IMAGE_FILE_MACHINE_SH5 0x1a8 /* Hitachi SH5 */
+#define IMAGE_FILE_MACHINE_THUMB 0x1c2 /* ARM or Thumb interworking */
+#define IMAGE_FILE_MACHINE_WCEMIPSV2 0x169 /* MIPS LE WCE v2 */
+
+/*
+ * COFF header: Characteristics
+ */
+
+#define IMAGE_FILE_RELOCS_STRIPPED 0x0001
+#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
+#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
+#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
+#define IMAGE_FILE_AGGRESSIVE_WS_TRIM 0x0010
+#define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
+#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
+#define IMAGE_FILE_32BIT_MACHINE 0x0100
+#define IMAGE_FILE_DEBUG_STRIPPED 0x0200
+#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
+#define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
+#define IMAGE_FILE_SYSTEM 0x1000
+#define IMAGE_FILE_DLL 0x2000
+#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
+#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
+
+/*
+ * COFF Header.
+ */
+
+typedef struct _PE_CoffHdr {
+ uint16_t ch_machine;
+ uint16_t ch_nsec;
+ uint32_t ch_timestamp;
+ uint32_t ch_symptr;
+ uint32_t ch_nsym;
+ uint16_t ch_optsize;
+ uint16_t ch_char;
+} PE_CoffHdr;
+
+
+/*
+ * Optional Header: Subsystem.
+ */
+
+#define IMAGE_SUBSYSTEM_UNKNOWN 0
+#define IMAGE_SUBSYSTEM_NATIVE 1
+#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
+#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
+#define IMAGE_SUBSYSTEM_POSIX_CUI 7
+#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
+#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
+#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
+#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
+#define IMAGE_SUBSYSTEM_EFI_ROM 13
+#define IMAGE_SUBSYSTEM_XBOX 14
+
+/*
+ * Optional Header: DLL Characteristics
+ */
+
+#define IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE 0x0040
+#define IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY 0x0080
+#define IMAGE_DLL_CHARACTERISTICS_NX_COMPAT 0x0100
+#define IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION 0x0200
+#define IMAGE_DLL_CHARACTERISTICS_NO_SEH 0x0400
+#define IMAGE_DLL_CHARACTERISTICS_NO_BIND 0x0800
+#define IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER 0x2000
+#define IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
+
+/*
+ * Optional Header.
+ */
+
+#define PE_FORMAT_ROM 0x107
+#define PE_FORMAT_32 0x10b
+#define PE_FORMAT_32P 0x20b
+
+typedef struct _PE_OptHdr {
+ uint16_t oh_magic;
+ uint8_t oh_ldvermajor;
+ uint8_t oh_ldverminor;
+ uint32_t oh_textsize;
+ uint32_t oh_datasize;
+ uint32_t oh_bsssize;
+ uint32_t oh_entry;
+ uint32_t oh_textbase;
+ uint32_t oh_database;
+ uint64_t oh_imgbase;
+ uint32_t oh_secalign;
+ uint32_t oh_filealign;
+ uint16_t oh_osvermajor;
+ uint16_t oh_osverminor;
+ uint16_t oh_imgvermajor;
+ uint16_t oh_imgverminor;
+ uint16_t oh_subvermajor;
+ uint16_t oh_subverminor;
+ uint32_t oh_win32ver;
+ uint32_t oh_imgsize;
+ uint32_t oh_hdrsize;
+ uint32_t oh_checksum;
+ uint16_t oh_subsystem;
+ uint16_t oh_dllchar;
+ uint64_t oh_stacksizer;
+ uint64_t oh_stacksizec;
+ uint64_t oh_heapsizer;
+ uint64_t oh_heapsizec;
+ uint32_t oh_ldrflags;
+ uint32_t oh_ndatadir;
+} PE_OptHdr;
+
+/*
+ * Optional Header: Data Directories.
+ */
+
+#define PE_DD_EXPORT 0
+#define PE_DD_IMPORT 1
+#define PE_DD_RESROUCE 2
+#define PE_DD_EXCEPTION 3
+#define PE_DD_CERTIFICATE 4
+#define PE_DD_BASERELOC 5
+#define PE_DD_DEBUG 6
+#define PE_DD_ARCH 7
+#define PE_DD_GLOBALPTR 8
+#define PE_DD_TLS 9
+#define PE_DD_LOADCONFIG 10
+#define PE_DD_BOUNDIMPORT 11
+#define PE_DD_IAT 12
+#define PE_DD_DELAYIMPORT 13
+#define PE_DD_CLRRUNTIME 14
+#define PE_DD_RESERVED 15
+#define PE_DD_MAX 16
+
+typedef struct _PE_DataDirEntry {
+ uint32_t de_addr;
+ uint32_t de_size;
+} PE_DataDirEntry;
+
+typedef struct _PE_DataDir {
+ PE_DataDirEntry dd_e[PE_DD_MAX];
+ uint32_t dd_total;
+} PE_DataDir;
+
+/*
+ * Section Headers: Section flags.
+ */
+
+#define IMAGE_SCN_TYPE_NO_PAD 0x00000008
+#define IMAGE_SCN_CNT_CODE 0x00000020
+#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
+#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
+#define IMAGE_SCN_LNK_OTHER 0x00000100
+#define IMAGE_SCN_LNK_INFO 0x00000200
+#define IMAGE_SCN_LNK_REMOVE 0x00000800
+#define IMAGE_SCN_LNK_COMDAT 0x00001000
+#define IMAGE_SCN_GPREL 0x00008000
+#define IMAGE_SCN_MEM_PURGEABLE 0x00020000
+#define IMAGE_SCN_MEM_16BIT 0x00020000
+#define IMAGE_SCN_MEM_LOCKED 0x00040000
+#define IMAGE_SCN_MEM_PRELOAD 0x00080000
+#define IMAGE_SCN_ALIGN_1BYTES 0x00100000
+#define IMAGE_SCN_ALIGN_2BYTES 0x00200000
+#define IMAGE_SCN_ALIGN_4BYTES 0x00300000
+#define IMAGE_SCN_ALIGN_8BYTES 0x00400000
+#define IMAGE_SCN_ALIGN_16BYTES 0x00500000
+#define IMAGE_SCN_ALIGN_32BYTES 0x00600000
+#define IMAGE_SCN_ALIGN_64BYTES 0x00700000
+#define IMAGE_SCN_ALIGN_128BYTES 0x00800000
+#define IMAGE_SCN_ALIGN_256BYTES 0x00900000
+#define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
+#define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
+#define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
+#define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
+#define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
+#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
+#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
+#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
+#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
+#define IMAGE_SCN_MEM_SHARED 0x10000000
+#define IMAGE_SCN_MEM_EXECUTE 0x20000000
+#define IMAGE_SCN_MEM_READ 0x40000000
+#define IMAGE_SCN_MEM_WRITE 0x80000000
+
+/*
+ * Section Headers.
+ */
+
+typedef struct _PE_SecHdr {
+ char sh_name[8];
+ uint32_t sh_virtsize;
+ uint32_t sh_addr;
+ uint32_t sh_rawsize;
+ uint32_t sh_rawptr;
+ uint32_t sh_relocptr;
+ uint32_t sh_lineptr;
+ uint16_t sh_nreloc;
+ uint16_t sh_nline;
+ uint32_t sh_char;
+} PE_SecHdr;
+
+#endif /* !_PE_H_ */
diff --git a/libpe/pe_buffer.c b/libpe/pe_buffer.c
new file mode 100644
index 000000000000..e4ac19fa04b8
--- /dev/null
+++ b/libpe/pe_buffer.c
@@ -0,0 +1,100 @@
+/*-
+ * Copyright (c) 2016 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: pe_buffer.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+PE_Buffer *
+pe_getbuffer(PE_Scn *ps, PE_Buffer *pb)
+{
+ PE *pe;
+ PE_SecBuf *sb;
+
+ if (ps == NULL) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ pe = ps->ps_pe;
+
+ if ((ps->ps_flags & LIBPE_F_LOAD_SECTION) == 0) {
+ if (pe->pe_flags & LIBPE_F_FD_DONE) {
+ errno = EACCES;
+ return (NULL);
+ }
+ if (pe->pe_flags & LIBPE_F_SPECIAL_FILE) {
+ if (libpe_load_all_sections(pe) < 0)
+ return (NULL);
+ } else {
+ if (libpe_load_section(pe, ps) < 0)
+ return (NULL);
+ }
+ }
+
+ sb = (PE_SecBuf *) pb;
+
+ if (sb == NULL)
+ sb = STAILQ_FIRST(&ps->ps_b);
+ else
+ sb = STAILQ_NEXT(sb, sb_next);
+
+ return ((PE_Buffer *) sb);
+}
+
+PE_Buffer *
+pe_newbuffer(PE_Scn *ps)
+{
+ PE *pe;
+ PE_SecBuf *sb;
+
+ if (ps == NULL) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ pe = ps->ps_pe;
+
+ if (pe->pe_flags & LIBPE_F_FD_DONE) {
+ errno = EACCES;
+ return (NULL);
+ }
+
+ if ((ps->ps_flags & LIBPE_F_LOAD_SECTION) == 0) {
+ if (libpe_load_section(pe, ps) < 0)
+ return (NULL);
+ }
+
+ if ((sb = libpe_alloc_buffer(ps, 0)) == NULL)
+ return (NULL);
+
+ sb->sb_flags |= PE_F_DIRTY;
+ ps->ps_flags |= PE_F_DIRTY;
+
+ return ((PE_Buffer *) sb);
+}
diff --git a/libpe/pe_cntl.c b/libpe/pe_cntl.c
new file mode 100644
index 000000000000..1fc8c474015e
--- /dev/null
+++ b/libpe/pe_cntl.c
@@ -0,0 +1,62 @@
+/*-
+ * Copyright (c) 2016 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: pe_cntl.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+int
+pe_cntl(PE *pe, PE_Cmd cmd)
+{
+
+ if (pe == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ switch (cmd) {
+ case PE_C_FDDONE:
+ pe->pe_flags |= LIBPE_F_FD_DONE;
+ break;
+
+ case PE_C_FDREAD:
+ if (pe->pe_cmd == PE_C_WRITE) {
+ errno = EACCES;
+ return (-1);
+ }
+ if (libpe_load_all_sections(pe) < 0)
+ return (-1);
+ break;
+
+ default:
+ errno = EINVAL;
+ return (-1);
+ }
+
+ return (0);
+}
diff --git a/libpe/pe_coff.c b/libpe/pe_coff.c
new file mode 100644
index 000000000000..d5cd83311a58
--- /dev/null
+++ b/libpe/pe_coff.c
@@ -0,0 +1,157 @@
+/*-
+ * Copyright (c) 2015 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: pe_coff.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+PE_CoffHdr *
+pe_coff_header(PE *pe)
+{
+
+ if (pe->pe_ch == NULL) {
+ errno = ENOENT;
+ return (NULL);
+ }
+
+ return (pe->pe_ch);
+}
+
+PE_OptHdr *
+pe_opt_header(PE *pe)
+{
+
+ if (pe->pe_oh == NULL) {
+ errno = ENOENT;
+ return (NULL);
+ }
+
+ return (pe->pe_oh);
+}
+
+PE_DataDir *
+pe_data_dir(PE *pe)
+{
+
+ if (pe->pe_dd == NULL) {
+ errno = ENOENT;
+ return (NULL);
+ }
+
+ return (pe->pe_dd);
+}
+
+int
+pe_update_coff_header(PE *pe, PE_CoffHdr *ch)
+{
+
+ if (pe == NULL || ch == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (pe->pe_cmd == PE_C_READ || pe->pe_flags & LIBPE_F_FD_DONE) {
+ errno = EACCES;
+ return (-1);
+ }
+
+ if (pe->pe_ch == NULL) {
+ if ((pe->pe_ch = malloc(sizeof(PE_CoffHdr))) == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ } else {
+ /* Rewrite optional header if `optsize' field changed. */
+ if (pe->pe_ch->ch_optsize != ch->ch_optsize)
+ pe->pe_flags |= LIBPE_F_DIRTY_OPT_HEADER;
+ }
+
+ *pe->pe_ch = *ch;
+
+ pe->pe_flags |= LIBPE_F_DIRTY_COFF_HEADER;
+
+ return (0);
+}
+
+int
+pe_update_opt_header(PE *pe, PE_OptHdr *oh)
+{
+
+ if (pe == NULL || oh == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (pe->pe_cmd == PE_C_READ || pe->pe_flags & LIBPE_F_FD_DONE) {
+ errno = EACCES;
+ return (-1);
+ }
+
+ if (pe->pe_oh == NULL) {
+ if ((pe->pe_oh = malloc(sizeof(PE_OptHdr))) == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ }
+
+ *pe->pe_oh = *oh;
+
+ pe->pe_flags |= LIBPE_F_DIRTY_OPT_HEADER;
+
+ return (0);
+}
+
+int
+pe_update_data_dir(PE *pe, PE_DataDir *dd)
+{
+
+ if (pe == NULL || dd == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (pe->pe_cmd == PE_C_READ || pe->pe_flags & LIBPE_F_FD_DONE) {
+ errno = EACCES;
+ return (-1);
+ }
+
+ if (pe->pe_dd == NULL) {
+ if ((pe->pe_dd = malloc(sizeof(PE_DataDir))) == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ }
+
+ *pe->pe_dd = *dd;
+
+ pe->pe_flags |= LIBPE_F_DIRTY_OPT_HEADER;
+
+ return (0);
+}
diff --git a/libpe/pe_dos.c b/libpe/pe_dos.c
new file mode 100644
index 000000000000..01ba42f44aae
--- /dev/null
+++ b/libpe/pe_dos.c
@@ -0,0 +1,119 @@
+/*-
+ * Copyright (c) 2015 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: pe_dos.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+PE_DosHdr *
+pe_msdos_header(PE *pe)
+{
+
+ if (pe == NULL) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ if (pe->pe_dh == NULL) {
+ errno = ENOENT;
+ return (NULL);
+ }
+
+ return (pe->pe_dh);
+}
+
+char *
+pe_msdos_stub(PE *pe, size_t *len)
+{
+
+ if (pe == NULL || len == NULL) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ if (pe->pe_stub_ex > 0 &&
+ (pe->pe_flags & LIBPE_F_LOAD_DOS_STUB) == 0) {
+ assert((pe->pe_flags & LIBPE_F_SPECIAL_FILE) == 0);
+ (void) libpe_read_msdos_stub(pe);
+ }
+
+ *len = sizeof(PE_DosHdr) + pe->pe_stub_ex;
+
+ return (pe->pe_stub);
+}
+
+int
+ps_update_msdos_header(PE *pe, PE_DosHdr *dh)
+{
+
+ if (pe == NULL || dh == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (pe->pe_cmd == PE_C_READ || pe->pe_flags & LIBPE_F_FD_DONE) {
+ errno = EACCES;
+ return (-1);
+ }
+
+ if (pe->pe_dh == NULL) {
+ if ((pe->pe_dh = malloc(sizeof(PE_DosHdr))) == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ }
+
+ *pe->pe_dh = *dh;
+
+ pe->pe_flags |= LIBPE_F_DIRTY_DOS_HEADER;
+
+ return (0);
+}
+
+int
+ps_update_msdos_stub(PE *pe, char *dos_stub, size_t sz)
+{
+
+ if (pe == NULL || dos_stub == NULL || sz == 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (pe->pe_cmd == PE_C_READ || pe->pe_flags & LIBPE_F_FD_DONE) {
+ errno = EACCES;
+ return (-1);
+ }
+
+ pe->pe_stub_app = dos_stub;
+ pe->pe_stub_app_sz = sz;
+
+ return (0);
+}
diff --git a/libpe/pe_flag.c b/libpe/pe_flag.c
new file mode 100644
index 000000000000..c392a4d2eeaf
--- /dev/null
+++ b/libpe/pe_flag.c
@@ -0,0 +1,187 @@
+/*-
+ * Copyright (c) 2016 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: pe_flag.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+int
+pe_flag(PE *pe, PE_Cmd c, unsigned int flags)
+{
+
+ if (pe == NULL || (c != PE_C_SET && c != PE_C_CLR)) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if ((flags & ~(PE_F_STRIP_DOS_STUB | PE_F_STRIP_RICH_HEADER |
+ PE_F_STRIP_SYMTAB | PE_F_STRIP_DEBUG)) != 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (c == PE_C_SET)
+ pe->pe_flags |= flags;
+ else
+ pe->pe_flags &= ~flags;
+
+ return (0);
+}
+
+int
+pe_flag_dos_header(PE *pe, PE_Cmd c, unsigned int flags)
+{
+
+ if (pe == NULL || (c != PE_C_SET && c != PE_C_CLR) ||
+ (flags & ~PE_F_DIRTY) != 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (c == PE_C_SET)
+ pe->pe_flags |= LIBPE_F_DIRTY_DOS_HEADER;
+ else
+ pe->pe_flags &= ~LIBPE_F_DIRTY_DOS_HEADER;
+
+ return (0);
+}
+
+int
+pe_flag_coff_header(PE *pe, PE_Cmd c, unsigned int flags)
+{
+
+ if (pe == NULL || (c != PE_C_SET && c != PE_C_CLR) ||
+ (flags & ~PE_F_DIRTY) != 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (c == PE_C_SET)
+ pe->pe_flags |= LIBPE_F_DIRTY_COFF_HEADER;
+ else
+ pe->pe_flags &= ~LIBPE_F_DIRTY_COFF_HEADER;
+
+ return (0);
+}
+
+int
+pe_flag_opt_header(PE *pe, PE_Cmd c, unsigned int flags)
+{
+
+ if (pe == NULL || (c != PE_C_SET && c != PE_C_CLR) ||
+ (flags & ~PE_F_DIRTY) != 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (c == PE_C_SET)
+ pe->pe_flags |= LIBPE_F_DIRTY_OPT_HEADER;
+ else
+ pe->pe_flags &= ~LIBPE_F_DIRTY_OPT_HEADER;
+
+ return (0);
+}
+
+int
+pe_flag_data_dir(PE *pe, PE_Cmd c, unsigned int flags)
+{
+
+ if (pe == NULL || (c != PE_C_SET && c != PE_C_CLR) ||
+ (flags & ~PE_F_DIRTY) != 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (c == PE_C_SET)
+ pe->pe_flags |= LIBPE_F_DIRTY_OPT_HEADER;
+ else
+ pe->pe_flags &= ~LIBPE_F_DIRTY_OPT_HEADER;
+
+ return (0);
+}
+
+int
+pe_flag_scn(PE_Scn *ps, PE_Cmd c, unsigned int flags)
+{
+
+ if (ps == NULL || (c != PE_C_SET && c != PE_C_CLR) ||
+ (flags & ~(PE_F_DIRTY | PE_F_STRIP_SECTION)) == 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (c == PE_C_SET)
+ ps->ps_flags |= flags;
+ else
+ ps->ps_flags &= ~flags;
+
+ return (0);
+}
+
+int
+pe_flag_section_header(PE_Scn *ps, PE_Cmd c, unsigned int flags)
+{
+ PE *pe;
+
+ if (ps == NULL || (c != PE_C_SET && c != PE_C_CLR) ||
+ (flags & ~PE_F_DIRTY) != 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ pe = ps->ps_pe;
+
+ /* The library doesn't support per section header dirty flag. */
+ if (c == PE_C_SET)
+ pe->pe_flags |= LIBPE_F_DIRTY_SEC_HEADER;
+ else
+ pe->pe_flags &= ~LIBPE_F_DIRTY_SEC_HEADER;
+
+ return (0);
+}
+
+int
+pe_flag_buffer(PE_Buffer *pb, PE_Cmd c, unsigned int flags)
+{
+ PE_SecBuf *sb;
+
+ if (pb == NULL || (c != PE_C_SET && c != PE_C_CLR) ||
+ (flags & ~PE_F_DIRTY) != 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ sb = (PE_SecBuf *) pb;
+
+ if (c == PE_C_SET)
+ sb->sb_flags |= flags;
+ else
+ sb->sb_flags &= ~flags;
+
+ return (0);
+}
diff --git a/libpe/pe_init.c b/libpe/pe_init.c
new file mode 100644
index 000000000000..4e2f22a260d2
--- /dev/null
+++ b/libpe/pe_init.c
@@ -0,0 +1,95 @@
+/*-
+ * Copyright (c) 2015 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/queue.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: pe_init.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+PE *
+pe_init(int fd, PE_Cmd c, PE_Object o)
+{
+ PE *pe;
+
+ if ((pe = calloc(1, sizeof(*pe))) == NULL) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ pe->pe_fd = fd;
+ pe->pe_cmd = c;
+ pe->pe_obj = o;
+ STAILQ_INIT(&pe->pe_scn);
+
+ switch (c) {
+ case PE_C_READ:
+ case PE_C_RDWR:
+ if (libpe_open_object(pe) < 0)
+ goto init_fail;
+ break;
+
+ case PE_C_WRITE:
+ if (o < PE_O_PE32 || o > PE_O_COFF) {
+ errno = EINVAL;
+ goto init_fail;
+ }
+ break;
+
+ default:
+ errno = EINVAL;
+ goto init_fail;
+ }
+
+ return (pe);
+
+init_fail:
+ pe_finish(pe);
+ return (NULL);
+}
+
+void
+pe_finish(PE *pe)
+{
+
+ if (pe == NULL)
+ return;
+
+ libpe_release_object(pe);
+}
+
+PE_Object
+pe_object(PE *pe)
+{
+
+ if (pe == NULL) {
+ errno = EINVAL;
+ return (PE_O_UNKNOWN);
+ }
+
+ return (pe->pe_obj);
+}
diff --git a/libpe/pe_rich.c b/libpe/pe_rich.c
new file mode 100644
index 000000000000..ea1029e58f5f
--- /dev/null
+++ b/libpe/pe_rich.c
@@ -0,0 +1,107 @@
+/*-
+ * Copyright (c) 2016 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <assert.h>
+#include <errno.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: pe_rich.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+PE_RichHdr *
+pe_rich_header(PE *pe)
+{
+
+ if (pe == NULL) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ if (pe->pe_rh == NULL && pe->pe_stub_ex > 0 &&
+ (pe->pe_flags & LIBPE_F_LOAD_DOS_STUB) == 0) {
+ assert((pe->pe_flags & LIBPE_F_SPECIAL_FILE) == 0);
+ (void) libpe_read_msdos_stub(pe);
+ }
+
+ if (pe->pe_rh == NULL) {
+ errno = ENOENT;
+ return (NULL);
+ }
+
+ return (pe->pe_rh);
+}
+
+static uint32_t
+rol32(uint32_t n, int c)
+{
+
+ c &= 0x1f;
+
+ return ((n << c) | (n >> (0x20 - c)));
+}
+
+int
+pe_rich_header_validate(PE *pe)
+{
+ PE_RichHdr *rh;
+ uint32_t cksum;
+ char *p;
+ int i, off;
+
+ if (pe_rich_header(pe) == NULL)
+ return (-1);
+
+ assert(pe->pe_rh_start != NULL);
+
+ /*
+ * Initial value of the checksum is the offset to the begin of
+ * the Rich header.
+ */
+ cksum = pe->pe_rh_start - pe->pe_stub;
+
+ /*
+ * Add the bytes before the Rich header to the checksum, rotated
+ * left by the offset.
+ */
+ for (p = pe->pe_stub; p < pe->pe_rh_start; p++) {
+ /* Skip dh_lfanew. */
+ off = p - pe->pe_stub;
+ if (off >= 0x3c && off < 0x40)
+ continue;
+ cksum += rol32((unsigned char) *p, off);
+ }
+
+ /* Add each compid rotated left by its count to the checksum. */
+ rh = pe->pe_rh;
+ for (i = 0; (uint32_t) i < rh->rh_total; i++)
+ cksum += rol32(rh->rh_compid[i], rh->rh_cnt[i]);
+
+ /* Validate the checksum with the XOR mask stored after "Rich". */
+ if (cksum == rh->rh_xor)
+ return (1);
+
+ return (0);
+}
diff --git a/libpe/pe_section.c b/libpe/pe_section.c
new file mode 100644
index 000000000000..3e82d8480596
--- /dev/null
+++ b/libpe/pe_section.c
@@ -0,0 +1,213 @@
+/*-
+ * Copyright (c) 2016 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <string.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: pe_section.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+PE_Scn *
+pe_getscn(PE *pe, size_t ndx)
+{
+ PE_Scn *ps;
+
+ if (pe == NULL || ndx < 1 || ndx > 0xFFFFU) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ STAILQ_FOREACH(ps, &pe->pe_scn, ps_next) {
+ if (ps->ps_ndx == ndx)
+ return (ps);
+ }
+
+ errno = ENOENT;
+
+ return (NULL);
+}
+
+size_t
+pe_ndxscn(PE_Scn *ps)
+{
+
+ if (ps == NULL) {
+ errno = EINVAL;
+ return (0);
+ }
+
+ return (ps->ps_ndx);
+}
+
+PE_Scn *
+pe_nextscn(PE *pe, PE_Scn *ps)
+{
+
+ if (pe == NULL) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ if (ps == NULL)
+ ps = STAILQ_FIRST(&pe->pe_scn);
+ else
+ ps = STAILQ_NEXT(ps, ps_next);
+
+ while (ps != NULL) {
+ if (ps->ps_ndx >= 1 && ps->ps_ndx <= 0xFFFFU)
+ return (ps);
+ ps = STAILQ_NEXT(ps, ps_next);
+ }
+
+ return (NULL);
+}
+
+PE_Scn *
+pe_newscn(PE *pe)
+{
+ PE_Scn *ps, *tps, *_tps;
+
+ if (pe == NULL) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ if (pe->pe_cmd == PE_C_READ || pe->pe_flags & LIBPE_F_FD_DONE) {
+ errno = EACCES;
+ return (NULL);
+ }
+
+ if ((ps = libpe_alloc_scn(pe)) == NULL)
+ return (NULL);
+
+ if (pe->pe_flags & LIBPE_F_BAD_SEC_HEADER) {
+ STAILQ_FOREACH_SAFE(tps, &pe->pe_scn, ps_next, _tps)
+ libpe_release_scn(tps);
+ pe->pe_flags &= ~LIBPE_F_BAD_SEC_HEADER;
+ }
+
+ STAILQ_INSERT_TAIL(&pe->pe_scn, ps, ps_next);
+
+ ps->ps_flags |= PE_F_DIRTY | LIBPE_F_LOAD_SECTION;
+ pe->pe_flags |= LIBPE_F_DIRTY_SEC_HEADER;
+
+ return (ps);
+}
+
+PE_Scn *
+pe_insertscn(PE *pe, size_t ndx)
+{
+ PE_Scn *ps, *a, *b;
+
+ if (pe == NULL || ndx < 1 || ndx > 0xFFFFU) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ if (pe->pe_cmd == PE_C_READ || pe->pe_flags & LIBPE_F_FD_DONE) {
+ errno = EACCES;
+ return (NULL);
+ }
+
+ if ((ps = libpe_alloc_scn(pe)) == NULL)
+ return (NULL);
+
+ if (pe->pe_flags & LIBPE_F_BAD_SEC_HEADER) {
+ STAILQ_FOREACH_SAFE(a, &pe->pe_scn, ps_next, b)
+ libpe_release_scn(a);
+ pe->pe_flags &= ~LIBPE_F_BAD_SEC_HEADER;
+ }
+
+ b = NULL;
+ STAILQ_FOREACH(a, &pe->pe_scn, ps_next) {
+ if (a->ps_ndx & 0xFFFF0000U)
+ continue;
+ if (a->ps_ndx == ndx)
+ break;
+ b = a;
+ }
+
+ if (a == NULL) {
+ STAILQ_INSERT_TAIL(&pe->pe_scn, ps, ps_next);
+ if (b == NULL)
+ ps->ps_ndx = 1;
+ else
+ ps->ps_ndx = b->ps_ndx + 1;
+ } else if (b == NULL) {
+ STAILQ_INSERT_HEAD(&pe->pe_scn, ps, ps_next);
+ ps->ps_ndx = 1;
+ } else {
+ STAILQ_INSERT_AFTER(&pe->pe_scn, b, ps, ps_next);
+ ps->ps_ndx = ndx;
+ }
+
+ a = ps;
+ while ((a = STAILQ_NEXT(a, ps_next)) != NULL) {
+ if ((a->ps_ndx & 0xFFFF0000U) == 0)
+ a->ps_ndx++;
+ }
+
+ ps->ps_flags |= PE_F_DIRTY | LIBPE_F_LOAD_SECTION;
+ pe->pe_flags |= LIBPE_F_DIRTY_SEC_HEADER;
+
+ return (ps);
+}
+
+PE_SecHdr *
+pe_section_header(PE_Scn *ps)
+{
+
+ if (ps == NULL) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ return (&ps->ps_sh);
+}
+
+int
+pe_update_section_header(PE_Scn *ps, PE_SecHdr *sh)
+{
+ PE *pe;
+
+ if (ps == NULL || sh == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ pe = ps->ps_pe;
+
+ if (pe->pe_cmd == PE_C_READ || pe->pe_flags & LIBPE_F_FD_DONE) {
+ errno = EACCES;
+ return (-1);
+ }
+
+ ps->ps_sh = *sh;
+ pe->pe_flags |= LIBPE_F_DIRTY_SEC_HEADER;
+
+ return (0);
+}
diff --git a/libpe/pe_symtab.c b/libpe/pe_symtab.c
new file mode 100644
index 000000000000..d0e90d14ad3e
--- /dev/null
+++ b/libpe/pe_symtab.c
@@ -0,0 +1,86 @@
+/*-
+ * Copyright (c) 2016 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: pe_symtab.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+int
+pe_update_symtab(PE *pe, char *symtab, size_t sz, unsigned int nsym)
+{
+ PE_Scn *ps;
+ PE_SecBuf *sb;
+ PE_SecHdr *sh;
+
+ if (pe == NULL || symtab == NULL || sz == 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (pe->pe_cmd == PE_C_READ || pe->pe_flags & LIBPE_F_FD_DONE) {
+ errno = EACCES;
+ return (-1);
+ }
+
+ /* Remove the old symbol table. */
+ STAILQ_FOREACH(ps, &pe->pe_scn, ps_next) {
+ if (ps->ps_ndx == 0xFFFFFFFFU)
+ libpe_release_scn(ps);
+ }
+
+ /*
+ * Insert the new symbol table.
+ */
+
+ if ((ps = libpe_alloc_scn(pe)) == NULL)
+ return (-1);
+
+ STAILQ_INSERT_TAIL(&pe->pe_scn, ps, ps_next);
+ ps->ps_ndx = 0xFFFFFFFFU;
+ ps->ps_flags |= PE_F_DIRTY;
+
+ /*
+ * Set the symbol table section offset to the maximum to make sure
+ * that it will be placed in the end of the file during section
+ * layout.
+ */
+ sh = &ps->ps_sh;
+ sh->sh_rawptr = 0xFFFFFFFFU;
+ sh->sh_rawsize = sz;
+
+ /* Allocate the buffer. */
+ if ((sb = libpe_alloc_buffer(ps, 0)) == NULL)
+ return (-1);
+ sb->sb_flags |= PE_F_DIRTY;
+ sb->sb_pb.pb_size = sz;
+ sb->sb_pb.pb_buf = symtab;
+
+ pe->pe_nsym = nsym;
+
+ return (0);
+}
diff --git a/libpe/pe_update.c b/libpe/pe_update.c
new file mode 100644
index 000000000000..ec2b2e52492d
--- /dev/null
+++ b/libpe/pe_update.c
@@ -0,0 +1,86 @@
+/*-
+ * Copyright (c) 2016 Kai Wang
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <assert.h>
+#include <errno.h>
+#include <unistd.h>
+
+#include "_libpe.h"
+
+ELFTC_VCSID("$Id: pe_update.c 3312 2016-01-10 09:23:51Z kaiwang27 $");
+
+off_t
+pe_update(PE *pe)
+{
+ off_t off;
+
+ if (pe == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (pe->pe_cmd == PE_C_READ || pe->pe_flags & LIBPE_F_FD_DONE) {
+ errno = EACCES;
+ return (-1);
+ }
+
+ if (pe->pe_cmd == PE_C_RDWR || (pe->pe_cmd == PE_C_WRITE &&
+ (pe->pe_flags & LIBPE_F_SPECIAL_FILE) == 0)) {
+ if (lseek(pe->pe_fd, 0, SEEK_SET) < 0) {
+ errno = EIO;
+ return (-1);
+ }
+ }
+
+ off = 0;
+
+ if (pe->pe_obj == PE_O_PE32 || pe->pe_obj == PE_O_PE32P) {
+ if ((off = libpe_write_msdos_stub(pe, off)) < 0)
+ return (-1);
+
+ if ((off = libpe_write_pe_header(pe, off)) < 0)
+ return (-1);
+ }
+
+ if (libpe_resync_sections(pe, off) < 0)
+ return (-1);
+
+ if ((off = libpe_write_coff_header(pe, off)) < 0)
+ return (-1);
+
+ if ((off = libpe_write_section_headers(pe, off)) < 0)
+ return (-1);
+
+ if ((off = libpe_write_sections(pe, off)) < 0)
+ return (-1);
+
+ if (ftruncate(pe->pe_fd, off) < 0) {
+ errno = EIO;
+ return (-1);
+ }
+
+ return (off);
+}
diff --git a/mk/elftoolchain.components.mk b/mk/elftoolchain.components.mk
new file mode 100644
index 000000000000..44ba7893aa01
--- /dev/null
+++ b/mk/elftoolchain.components.mk
@@ -0,0 +1,21 @@
+#
+# $Id: elftoolchain.components.mk 3316 2016-01-11 22:48:22Z jkoshy $
+#
+
+# Knobs to turn parts of the source tree on or off.
+
+# Build the automation tools.
+WITH_BUILD_TOOLS= no
+
+# Build additional tutorial documentation. (Manual page generation is
+# controlled by the 'MKDOC' knob).
+WITH_DOCUMENTATION=yes
+
+# Build the instruction set analyser.
+WITH_ISA= no
+
+# Build PE support.
+WITH_PE= yes
+
+# Build test suites.
+WITH_TESTS= yes
diff --git a/mk/elftoolchain.prog.mk b/mk/elftoolchain.prog.mk
index f19902a9a830..529171e22b53 100644
--- a/mk/elftoolchain.prog.mk
+++ b/mk/elftoolchain.prog.mk
@@ -1,7 +1,7 @@
#
# Rules for building programs.
#
-# $Id: elftoolchain.prog.mk 2985 2014-03-06 03:24:35Z jkoshy $
+# $Id: elftoolchain.prog.mk 3352 2016-01-18 21:50:10Z jkoshy $
.if !defined(TOP)
.error Make variable \"TOP\" has not been defined.
@@ -36,6 +36,18 @@ _LDADD_LIBELFTC=${LDADD:M-lelftc}
CFLAGS+= -I${TOP}/libelftc
LDFLAGS+= -L${TOP}/libelftc
.endif
+
+_LDADD_LIBPE=${LDADD:M-lpe}
+.if !empty(_LDADD_LIBPE)
+CFLAGS+= -I${TOP}/libpe
+LDFLAGS+= -L${TOP}/libpe
+.endif
+.endif
+
+_LDADD_LIBARCHIVE=${LDADD:M-larchive}
+.if !empty(_LDADD_LIBARCHIVE) && ${OS_HOST} == NetBSD
+CFLAGS+= -I/usr/pkg/include
+LDFLAGS+= -L/usr/pkg/lib
.endif
#
diff --git a/nm/os.NetBSD.mk b/nm/os.NetBSD.mk
new file mode 100644
index 000000000000..ae214e3115c0
--- /dev/null
+++ b/nm/os.NetBSD.mk
@@ -0,0 +1,2 @@
+# TODO(#511): Revert after the source tree is -Wconversion clean.
+WARNS=5
diff --git a/readelf/os.NetBSD.mk b/readelf/os.NetBSD.mk
new file mode 100644
index 000000000000..ae214e3115c0
--- /dev/null
+++ b/readelf/os.NetBSD.mk
@@ -0,0 +1,2 @@
+# TODO(#511): Revert after the source tree is -Wconversion clean.
+WARNS=5
diff --git a/readelf/readelf.c b/readelf/readelf.c
index 3b4b2d3c56b0..a8f5dd975382 100644
--- a/readelf/readelf.c
+++ b/readelf/readelf.c
@@ -47,7 +47,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: readelf.c 3271 2015-12-11 18:53:08Z kaiwang27 $");
+ELFTC_VCSID("$Id: readelf.c 3395 2016-02-10 16:29:44Z emaste $");
/*
* readelf(1) options.
@@ -338,7 +338,7 @@ static const char *phdr_type(unsigned int ptype);
static const char *ppc_abi_fp(uint64_t fp);
static const char *ppc_abi_vector(uint64_t vec);
static const char *r_type(unsigned int mach, unsigned int type);
-static void readelf_usage(void);
+static void readelf_usage(int status);
static void readelf_version(void);
static void search_loclist_at(struct readelf *re, Dwarf_Die die,
Dwarf_Unsigned lowpc);
@@ -348,7 +348,7 @@ static void set_cu_context(struct readelf *re, Dwarf_Half psize,
Dwarf_Half osize, Dwarf_Half ver);
static const char *st_bind(unsigned int sbind);
static const char *st_shndx(unsigned int shndx);
-static const char *st_type(unsigned int stype);
+static const char *st_type(unsigned int mach, unsigned int stype);
static const char *st_vis(unsigned int svis);
static const char *top_tag(unsigned int tag);
static void unload_sections(struct readelf *re);
@@ -958,6 +958,7 @@ st_bind(unsigned int sbind)
case STB_LOCAL: return "LOCAL";
case STB_GLOBAL: return "GLOBAL";
case STB_WEAK: return "WEAK";
+ case STB_GNU_UNIQUE: return "UNIQUE";
default:
if (sbind >= STB_LOOS && sbind <= STB_HIOS)
return "OS";
@@ -971,7 +972,7 @@ st_bind(unsigned int sbind)
}
static const char *
-st_type(unsigned int stype)
+st_type(unsigned int mach, unsigned int stype)
{
static char s_stype[32];
@@ -987,10 +988,12 @@ st_type(unsigned int stype)
if (stype >= STT_LOOS && stype <= STT_HIOS)
snprintf(s_stype, sizeof(s_stype), "OS+%#x",
stype - STT_LOOS);
- else if (stype >= STT_LOPROC && stype <= STT_HIPROC)
+ else if (stype >= STT_LOPROC && stype <= STT_HIPROC) {
+ if (mach == EM_SPARCV9 && stype == STT_SPARC_REGISTER)
+ return "REGISTER";
snprintf(s_stype, sizeof(s_stype), "PROC+%#x",
stype - STT_LOPROC);
- else
+ } else
snprintf(s_stype, sizeof(s_stype), "<unknown: %#x>",
stype);
return (s_stype);
@@ -1053,8 +1056,9 @@ static struct {
static const char *
r_type(unsigned int mach, unsigned int type)
{
+ static char s_type[32];
+
switch(mach) {
- case EM_NONE: return "";
case EM_386:
case EM_IAMCU:
switch(type) {
@@ -1065,7 +1069,7 @@ r_type(unsigned int mach, unsigned int type)
case 4: return "R_386_PLT32";
case 5: return "R_386_COPY";
case 6: return "R_386_GLOB_DAT";
- case 7: return "R_386_JMP_SLOT";
+ case 7: return "R_386_JUMP_SLOT";
case 8: return "R_386_RELATIVE";
case 9: return "R_386_GOTOFF";
case 10: return "R_386_GOTPC";
@@ -1089,8 +1093,8 @@ r_type(unsigned int mach, unsigned int type)
case 35: return "R_386_TLS_DTPMOD32";
case 36: return "R_386_TLS_DTPOFF32";
case 37: return "R_386_TLS_TPOFF32";
- default: return "";
}
+ break;
case EM_AARCH64:
switch(type) {
case 0: return "R_AARCH64_NONE";
@@ -1145,6 +1149,16 @@ r_type(unsigned int mach, unsigned int type)
case 311: return "R_AARCH64_ADR_GOT_PAGE";
case 312: return "R_AARCH64_LD64_GOT_LO12_NC";
case 313: return "R_AARCH64_LD64_GOTPAGE_LO15";
+ case 560: return "R_AARCH64_TLSDESC_LD_PREL19";
+ case 561: return "R_AARCH64_TLSDESC_ADR_PREL21";
+ case 562: return "R_AARCH64_TLSDESC_ADR_PAGE21";
+ case 563: return "R_AARCH64_TLSDESC_LD64_LO12";
+ case 564: return "R_AARCH64_TLSDESC_ADD_LO12";
+ case 565: return "R_AARCH64_TLSDESC_OFF_G1";
+ case 566: return "R_AARCH64_TLSDESC_OFF_G0_NC";
+ case 567: return "R_AARCH64_TLSDESC_LDR";
+ case 568: return "R_AARCH64_TLSDESC_ADD";
+ case 569: return "R_AARCH64_TLSDESC_CALL";
case 1024: return "R_AARCH64_COPY";
case 1025: return "R_AARCH64_GLOB_DAT";
case 1026: return "R_AARCH64_JUMP_SLOT";
@@ -1154,8 +1168,8 @@ r_type(unsigned int mach, unsigned int type)
case 1030: return "R_AARCH64_TLS_TPREL64";
case 1031: return "R_AARCH64_TLSDESC";
case 1032: return "R_AARCH64_IRELATIVE";
- default: return "";
}
+ break;
case EM_ARM:
switch(type) {
case 0: return "R_ARM_NONE";
@@ -1206,8 +1220,8 @@ r_type(unsigned int mach, unsigned int type)
case 253: return "R_ARM_RABS32";
case 254: return "R_ARM_RPC24";
case 255: return "R_ARM_RBASE";
- default: return "";
}
+ break;
case EM_IA_64:
switch(type) {
case 0: return "R_IA_64_NONE";
@@ -1290,8 +1304,8 @@ r_type(unsigned int mach, unsigned int type)
case 182: return "R_IA_64_DTPREL64MSB";
case 183: return "R_IA_64_DTPREL64LSB";
case 186: return "R_IA_64_LTOFF_DTPREL22";
- default: return "";
}
+ break;
case EM_MIPS:
switch(type) {
case 0: return "R_MIPS_NONE";
@@ -1324,9 +1338,8 @@ r_type(unsigned int mach, unsigned int type)
case 48: return "R_MIPS_TLS_TPREL64";
case 49: return "R_MIPS_TLS_TPREL_HI16";
case 50: return "R_MIPS_TLS_TPREL_LO16";
-
- default: return "";
}
+ break;
case EM_PPC:
switch(type) {
case 0: return "R_PPC_NONE";
@@ -1406,8 +1419,8 @@ r_type(unsigned int mach, unsigned int type)
case 114: return "R_PPC_EMB_RELST_HA";
case 115: return "R_PPC_EMB_BIT_FLD";
case 116: return "R_PPC_EMB_RELSDA";
- default: return "";
}
+ break;
case EM_RISCV:
switch(type) {
case 0: return "R_RISCV_NONE";
@@ -1453,6 +1466,7 @@ r_type(unsigned int mach, unsigned int type)
case 44: return "R_RISCV_RVC_BRANCH";
case 45: return "R_RISCV_RVC_JUMP";
}
+ break;
case EM_SPARC:
case EM_SPARCV9:
switch(type) {
@@ -1536,8 +1550,8 @@ r_type(unsigned int mach, unsigned int type)
case 77: return "R_SPARC_TLS_DTPOFF64";
case 78: return "R_SPARC_TLS_TPOFF32";
case 79: return "R_SPARC_TLS_TPOFF64";
- default: return "";
}
+ break;
case EM_X86_64:
switch(type) {
case 0: return "R_X86_64_NONE";
@@ -1547,7 +1561,7 @@ r_type(unsigned int mach, unsigned int type)
case 4: return "R_X86_64_PLT32";
case 5: return "R_X86_64_COPY";
case 6: return "R_X86_64_GLOB_DAT";
- case 7: return "R_X86_64_JMP_SLOT";
+ case 7: return "R_X86_64_JUMP_SLOT";
case 8: return "R_X86_64_RELATIVE";
case 9: return "R_X86_64_GOTPCREL";
case 10: return "R_X86_64_32";
@@ -1578,10 +1592,12 @@ r_type(unsigned int mach, unsigned int type)
case 35: return "R_X86_64_TLSDESC_CALL";
case 36: return "R_X86_64_TLSDESC";
case 37: return "R_X86_64_IRELATIVE";
- default: return "";
}
- default: return "";
+ break;
}
+
+ snprintf(s_type, sizeof(s_type), "<unknown: %#x>", type);
+ return (s_type);
}
static const char *
@@ -3452,9 +3468,10 @@ dump_symtab(struct readelf *re, int i)
continue;
}
printf("%6d:", j);
- printf(" %16.16jx", (uintmax_t)sym.st_value);
- printf(" %5ju", sym.st_size);
- printf(" %-7s", st_type(GELF_ST_TYPE(sym.st_info)));
+ printf(" %16.16jx", (uintmax_t) sym.st_value);
+ printf(" %5ju", (uintmax_t) sym.st_size);
+ printf(" %-7s", st_type(re->ehdr.e_machine,
+ GELF_ST_TYPE(sym.st_info)));
printf(" %-6s", st_bind(GELF_ST_BIND(sym.st_info)));
printf(" %-8s", st_vis(GELF_ST_VISIBILITY(sym.st_other)));
printf(" %3s", st_shndx(sym.st_shndx));
@@ -4287,7 +4304,7 @@ dump_compatibility_tag(uint8_t *p, uint8_t *pe)
uint64_t val;
val = _decode_uleb128(&p, pe);
- printf("flag = %ju, vendor = %s\n", val, p);
+ printf("flag = %ju, vendor = %s\n", (uintmax_t) val, p);
p += strlen((char *) p) + 1;
return (p);
@@ -4811,6 +4828,7 @@ dump_dwarf_line(struct readelf *re)
}
endoff = offset + length;
+ pe = (uint8_t *) d->d_buf + endoff;
version = re->dw_read(d, &offset, 2);
hdrlen = re->dw_read(d, &offset, dwarf_size);
minlen = re->dw_read(d, &offset, 1);
@@ -4876,7 +4894,6 @@ dump_dwarf_line(struct readelf *re)
#define ADDRESS(x) ((((x) - opbase) / lrange) * minlen)
p++;
- pe = (uint8_t *) d->d_buf + endoff;
printf("\n");
printf(" Line Number Statements:\n");
@@ -4981,7 +4998,8 @@ dump_dwarf_line(struct readelf *re)
break;
case DW_LNS_set_isa:
isa = _decode_uleb128(&p, pe);
- printf(" Set isa to %ju\n", isa);
+ printf(" Set isa to %ju\n",
+ (uintmax_t) isa);
break;
default:
/* Unrecognized extended opcodes. */
@@ -5733,12 +5751,12 @@ dump_dwarf_ranges_foreach(struct readelf *re, Dwarf_Die die, Dwarf_Addr base)
}
if (re->ec == ELFCLASS32)
printf("%08jx %08jx\n",
- ranges[j].dwr_addr1 + base0,
- ranges[j].dwr_addr2 + base0);
+ (uintmax_t) (ranges[j].dwr_addr1 + base0),
+ (uintmax_t) (ranges[j].dwr_addr2 + base0));
else
printf("%016jx %016jx\n",
- ranges[j].dwr_addr1 + base0,
- ranges[j].dwr_addr2 + base0);
+ (uintmax_t) (ranges[j].dwr_addr1 + base0),
+ (uintmax_t) (ranges[j].dwr_addr2 + base0));
}
}
@@ -6712,7 +6730,7 @@ dump_dwarf_loclist(struct readelf *re)
set_cu_context(re, la->la_cu_psize, la->la_cu_osize,
la->la_cu_ver);
for (i = 0; i < lcnt; i++) {
- printf(" %8.8jx ", la->la_off);
+ printf(" %8.8jx ", (uintmax_t) la->la_off);
if (llbuf[i]->ld_lopc == 0 && llbuf[i]->ld_hipc == 0) {
printf("<End of list>\n");
continue;
@@ -6834,13 +6852,15 @@ hex_dump(struct readelf *re)
if (find_dumpop(re, (size_t) i, s->name, HEX_DUMP, -1) == NULL)
continue;
(void) elf_errno();
- if ((d = elf_getdata(s->scn, NULL)) == NULL) {
+ if ((d = elf_getdata(s->scn, NULL)) == NULL &&
+ (d = elf_rawdata(s->scn, NULL)) == NULL) {
elferr = elf_errno();
if (elferr != 0)
warnx("elf_getdata failed: %s",
elf_errmsg(elferr));
continue;
}
+ (void) elf_errno();
if (d->d_size <= 0 || d->d_buf == NULL) {
printf("\nSection '%s' has no data to dump.\n",
s->name);
@@ -6889,13 +6909,15 @@ str_dump(struct readelf *re)
if (find_dumpop(re, (size_t) i, s->name, STR_DUMP, -1) == NULL)
continue;
(void) elf_errno();
- if ((d = elf_getdata(s->scn, NULL)) == NULL) {
+ if ((d = elf_getdata(s->scn, NULL)) == NULL &&
+ (d = elf_rawdata(s->scn, NULL)) == NULL) {
elferr = elf_errno();
if (elferr != 0)
warnx("elf_getdata failed: %s",
elf_errmsg(elferr));
continue;
}
+ (void) elf_errno();
if (d->d_size <= 0 || d->d_buf == NULL) {
printf("\nSection '%s' has no data to dump.\n",
s->name);
@@ -7354,10 +7376,13 @@ _read_lsb(Elf_Data *d, uint64_t *offsetp, int bytes_to_read)
case 8:
ret |= ((uint64_t) src[4]) << 32 | ((uint64_t) src[5]) << 40;
ret |= ((uint64_t) src[6]) << 48 | ((uint64_t) src[7]) << 56;
+ /* FALLTHROUGH */
case 4:
ret |= ((uint64_t) src[2]) << 16 | ((uint64_t) src[3]) << 24;
+ /* FALLTHROUGH */
case 2:
ret |= ((uint64_t) src[1]) << 8;
+ /* FALLTHROUGH */
case 1:
ret |= src[0];
break;
@@ -7417,10 +7442,13 @@ _decode_lsb(uint8_t **data, int bytes_to_read)
case 8:
ret |= ((uint64_t) src[4]) << 32 | ((uint64_t) src[5]) << 40;
ret |= ((uint64_t) src[6]) << 48 | ((uint64_t) src[7]) << 56;
+ /* FALLTHROUGH */
case 4:
ret |= ((uint64_t) src[2]) << 16 | ((uint64_t) src[3]) << 24;
+ /* FALLTHROUGH */
case 2:
ret |= ((uint64_t) src[1]) << 8;
+ /* FALLTHROUGH */
case 1:
ret |= src[0];
break;
@@ -7473,7 +7501,7 @@ static int64_t
_decode_sleb128(uint8_t **dp, uint8_t *dpe)
{
int64_t ret = 0;
- uint8_t b;
+ uint8_t b = 0;
int shift = 0;
uint8_t *src = *dp;
@@ -7542,6 +7570,10 @@ Usage: %s [options] file...\n\
-s | --syms | --symbols Print symbol tables.\n\
-t | --section-details Print additional information about sections.\n\
-v | --version Print a version identifier and exit.\n\
+ -w[afilmoprsFLR] | --debug-dump={abbrev,aranges,decodedline,frames,\n\
+ frames-interp,info,loc,macro,pubnames,\n\
+ ranges,Ranges,rawline,str}\n\
+ Display DWARF information.\n\
-x INDEX | --hex-dump=INDEX\n\
Display contents of a section as hexadecimal.\n\
-A | --arch-specific (accepted, but ignored)\n\
@@ -7558,10 +7590,10 @@ Usage: %s [options] file...\n\
static void
-readelf_usage(void)
+readelf_usage(int status)
{
fprintf(stderr, USAGE_MESSAGE, ELFTC_GETPROGNAME());
- exit(EXIT_FAILURE);
+ exit(status);
}
int
@@ -7580,7 +7612,7 @@ main(int argc, char **argv)
longopts, NULL)) != -1) {
switch(opt) {
case '?':
- readelf_usage();
+ readelf_usage(EXIT_SUCCESS);
break;
case 'A':
re->options |= RE_AA;
@@ -7605,7 +7637,7 @@ main(int argc, char **argv)
re->options |= RE_G;
break;
case 'H':
- readelf_usage();
+ readelf_usage(EXIT_SUCCESS);
break;
case 'h':
re->options |= RE_H;
@@ -7683,7 +7715,7 @@ main(int argc, char **argv)
argc -= optind;
if (argc == 0 || re->options == 0)
- readelf_usage();
+ readelf_usage(EXIT_FAILURE);
if (argc > 1)
re->flags |= DISPLAY_FILENAME;
diff --git a/size/os.NetBSD.mk b/size/os.NetBSD.mk
new file mode 100644
index 000000000000..ae214e3115c0
--- /dev/null
+++ b/size/os.NetBSD.mk
@@ -0,0 +1,2 @@
+# TODO(#511): Revert after the source tree is -Wconversion clean.
+WARNS=5
diff --git a/strings/os.NetBSD.mk b/strings/os.NetBSD.mk
new file mode 100644
index 000000000000..ae214e3115c0
--- /dev/null
+++ b/strings/os.NetBSD.mk
@@ -0,0 +1,2 @@
+# TODO(#511): Revert after the source tree is -Wconversion clean.
+WARNS=5
diff --git a/strings/strings.1 b/strings/strings.1
index 15ad7a7f1eb3..205afdfc4505 100644
--- a/strings/strings.1
+++ b/strings/strings.1
@@ -22,9 +22,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: strings.1 3195 2015-05-12 17:22:19Z emaste $
+.\" $Id: strings.1 3360 2016-01-24 18:34:06Z jkoshy $
.\"
-.Dd December 19, 2011
+.Dd January 24, 2016
.Dt STRINGS 1
.Os
.Sh NAME
@@ -100,6 +100,9 @@ Print a usage summary and exit.
Print the contiguous character sequence of at least
.Ar number
characters long, instead of the default of 4 characters.
+Argument
+.Ar number
+should specify a positive decimal integer.
.It Fl o
Equivalent to specifying
.Fl t Ar o .
diff --git a/strings/strings.c b/strings/strings.c
index 6eab165e0bf4..f122eba34393 100644
--- a/strings/strings.c
+++ b/strings/strings.c
@@ -37,6 +37,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sysexits.h>
#include <unistd.h>
#include <libelf.h>
@@ -45,7 +46,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: strings.c 3174 2015-03-27 17:13:41Z emaste $");
+ELFTC_VCSID("$Id: strings.c 3360 2016-01-24 18:34:06Z jkoshy $");
enum return_code {
RETURN_OK,
@@ -73,10 +74,10 @@ enum encoding_style {
((c) == '\t' || isprint((c)) || \
(encoding == ENCODING_8BIT && (c) > 127)))
-
-static int encoding_size, entire_file, min_len, show_filename, show_loc;
+static int encoding_size, entire_file, show_filename, show_loc;
static enum encoding_style encoding;
static enum radix_style radix;
+static intmax_t min_len;
static struct option strings_longopts[] = {
{ "all", no_argument, NULL, 'a'},
@@ -144,7 +145,10 @@ main(int argc, char **argv)
show_filename = 1;
break;
case 'n':
- min_len = (int)strtoimax(optarg, (char**)NULL, 10);
+ min_len = strtoimax(optarg, (char**)NULL, 10);
+ if (min_len <= 0)
+ errx(EX_USAGE, "option -n should specify a "
+ "positive decimal integer.");
break;
case 'o':
show_loc = 1;
diff --git a/test/ar/plugin/Makefile b/test/ar/plugin/Makefile
index f9644aea89f0..5585ec736634 100644
--- a/test/ar/plugin/Makefile
+++ b/test/ar/plugin/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile 3192 2015-05-04 17:20:15Z jkoshy $
+# $Id: Makefile 3380 2016-01-29 07:53:10Z jkoshy $
PLUGINS= ardiff teraser
@@ -11,7 +11,7 @@ ${PLUGINS}:
test: .PHONY
-clean cleandepend depend: .PHONY
+clean cleandepend clobber depend: .PHONY
.for plugin in ${PLUGINS}
${MAKE} -f Makefile.${plugin} ${.TARGET}
.endfor
diff --git a/test/ar/plugin/ardiff.c b/test/ar/plugin/ardiff.c
index 907d1ea80da9..84048c632116 100644
--- a/test/ar/plugin/ardiff.c
+++ b/test/ar/plugin/ardiff.c
@@ -12,7 +12,7 @@
* By default, it compares nothing and consider the test "not ok"
* iff it encounters errors while reading archive.
*
- * $Id: ardiff.c 3102 2014-10-29 21:09:01Z jkoshy $
+ * $Id: ardiff.c 3364 2016-01-24 21:23:17Z jkoshy $
*/
#include <archive.h>
@@ -48,10 +48,9 @@ main(int argc, char **argv)
char checksize;
char checktime;
char a1end;
- ssize_t size1;
- ssize_t size2;
- char opt;
- int r;
+ size_t size1;
+ size_t size2;
+ int opt, r;
/*
* Parse command line options.
@@ -170,8 +169,8 @@ main(int argc, char **argv)
* Compare member size if required.
*/
if (checksize || checkcont) {
- size1 = archive_entry_size(e1);
- size2 = archive_entry_size(e2);
+ size1 = (size_t) archive_entry_size(e1);
+ size2 = (size_t) archive_entry_size(e2);
if (size1 != size2)
filediff(tc, "member size differ",
archive_entry_pathname(e1));
@@ -185,10 +184,12 @@ main(int argc, char **argv)
filediff(tc, "not enough memory", NULL);
if ((buf2 = malloc(size2)) == NULL)
filediff(tc, "not enough memory", NULL);
- if (archive_read_data(a1, buf1, size1) != size1)
+ if ((size_t) archive_read_data(a1, buf1, size1) !=
+ size1)
filediff(tc, "archive_read_data failed",
archive_entry_pathname(e1));
- if (archive_read_data(a2, buf2, size2) != size2)
+ if ((size_t) archive_read_data(a2, buf2, size2) !=
+ size2)
filediff(tc, "archive_read_data failed",
archive_entry_pathname(e1));
if (memcmp(buf1, buf2, size1) != 0)
diff --git a/test/ar/plugin/teraser.c b/test/ar/plugin/teraser.c
index d16752e7cefb..5fa08a0df540 100644
--- a/test/ar/plugin/teraser.c
+++ b/test/ar/plugin/teraser.c
@@ -2,7 +2,7 @@
* make it easy to `diff'. (option -e)
* 2. Check the sanity of timestamp. (option -c)
*
- * $Id: teraser.c 3102 2014-10-29 21:09:01Z jkoshy $
+ * $Id: teraser.c 3365 2016-01-24 21:26:46Z jkoshy $
*/
#include <errno.h>
@@ -25,14 +25,14 @@ static void usage(void);
int
main(int argc, char **argv)
{
- char opt;
+ int opt;
char checktime;
char erasetime;
char buf[TSLEN + 1];
char *tc;
int fd;
int ts;
- int now;
+ time_t now;
FILE *ct, *ps;
diff --git a/test/ar/tc/usage-bi/usage-bi.err b/test/ar/tc/usage-bi/usage-bi.err
index b509d6c75712..99721eb4e035 100644
--- a/test/ar/tc/usage-bi/usage-bi.err
+++ b/test/ar/tc/usage-bi/usage-bi.err
@@ -30,3 +30,4 @@ Usage: ar <command> [options] archive file...
-F FORMAT | --flavor=FORMAT
Create archives with the specified format.
-S Do not generate an archive symbol table.
+ -U Use original metadata for archive members.
diff --git a/test/elfcopy/plugin/Makefile b/test/elfcopy/plugin/Makefile
index f9644aea89f0..5585ec736634 100644
--- a/test/elfcopy/plugin/Makefile
+++ b/test/elfcopy/plugin/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile 3192 2015-05-04 17:20:15Z jkoshy $
+# $Id: Makefile 3380 2016-01-29 07:53:10Z jkoshy $
PLUGINS= ardiff teraser
@@ -11,7 +11,7 @@ ${PLUGINS}:
test: .PHONY
-clean cleandepend depend: .PHONY
+clean cleandepend clobber depend: .PHONY
.for plugin in ${PLUGINS}
${MAKE} -f Makefile.${plugin} ${.TARGET}
.endfor
diff --git a/test/elfcopy/plugin/ardiff.c b/test/elfcopy/plugin/ardiff.c
index 907d1ea80da9..0f2c0dde73c6 100644
--- a/test/elfcopy/plugin/ardiff.c
+++ b/test/elfcopy/plugin/ardiff.c
@@ -12,7 +12,7 @@
* By default, it compares nothing and consider the test "not ok"
* iff it encounters errors while reading archive.
*
- * $Id: ardiff.c 3102 2014-10-29 21:09:01Z jkoshy $
+ * $Id: ardiff.c 3366 2016-01-24 21:33:06Z jkoshy $
*/
#include <archive.h>
@@ -48,10 +48,9 @@ main(int argc, char **argv)
char checksize;
char checktime;
char a1end;
- ssize_t size1;
- ssize_t size2;
- char opt;
- int r;
+ size_t size1;
+ size_t size2;
+ int opt, r;
/*
* Parse command line options.
@@ -170,8 +169,8 @@ main(int argc, char **argv)
* Compare member size if required.
*/
if (checksize || checkcont) {
- size1 = archive_entry_size(e1);
- size2 = archive_entry_size(e2);
+ size1 = (size_t) archive_entry_size(e1);
+ size2 = (size_t) archive_entry_size(e2);
if (size1 != size2)
filediff(tc, "member size differ",
archive_entry_pathname(e1));
@@ -185,10 +184,12 @@ main(int argc, char **argv)
filediff(tc, "not enough memory", NULL);
if ((buf2 = malloc(size2)) == NULL)
filediff(tc, "not enough memory", NULL);
- if (archive_read_data(a1, buf1, size1) != size1)
+ if ((size_t) archive_read_data(a1, buf1, size1) !=
+ size1)
filediff(tc, "archive_read_data failed",
archive_entry_pathname(e1));
- if (archive_read_data(a2, buf2, size2) != size2)
+ if ((size_t) archive_read_data(a2, buf2, size2) !=
+ size2)
filediff(tc, "archive_read_data failed",
archive_entry_pathname(e1));
if (memcmp(buf1, buf2, size1) != 0)
diff --git a/test/elfcopy/plugin/teraser.c b/test/elfcopy/plugin/teraser.c
index 0deb7cc90630..b29d44d5597e 100644
--- a/test/elfcopy/plugin/teraser.c
+++ b/test/elfcopy/plugin/teraser.c
@@ -2,7 +2,7 @@
* make it easy to `diff'. (option -e)
* 2. Check the sanity of timestamp. (option -c)
*
- * $Id: teraser.c 3102 2014-10-29 21:09:01Z jkoshy $
+ * $Id: teraser.c 3366 2016-01-24 21:33:06Z jkoshy $
*/
#include <errno.h>
@@ -25,14 +25,14 @@ static void usage(void);
int
main(int argc, char **argv)
{
- char opt;
+ int opt;
char checktime;
char erasetime;
char buf[TSLEN + 1];
char *tc;
int fd;
int ts;
- int now;
+ time_t now;
FILE *ct, *ps;
diff --git a/test/elfcopy/tc/elfcopy-L-1/out/elfcopy-L-1.out.shar b/test/elfcopy/tc/elfcopy-L-1/out/elfcopy-L-1.out.shar
index 67ee9364d478..6d136d031c56 100644
--- a/test/elfcopy/tc/elfcopy-L-1/out/elfcopy-L-1.out.shar
+++ b/test/elfcopy/tc/elfcopy-L-1/out/elfcopy-L-1.out.shar
@@ -11,23 +11,23 @@
echo x - sym.o.1.uu
sed 's/^X//' >sym.o.1.uu << 'cc3b7341ff25eb16b80756fcb867a66b'
Xbegin 644 sym.o.1
-XM?T5,1@$!`0D```````````$``P`!``````````````#8`````````#0`````
+XM?T5,1@$!`0D```````````$``P`!``````````````"4`0```````#0`````
XM`"@`"``%`````````````````%6)Y;@`````7<.-M@````!5B>6X`````%W#
XMC;8`````58GEN`````!=PXVV`````%6)Y;@`````7<,```!'0T,Z("A'3E4I
XM(#0N,BXQ(#(P,#<P-S$Y("!;1G)E94)31%T``"YS>6UT86(`+G-T<G1A8@`N
XM<VAS=')T86(`+G1E>'0`+F1A=&$`+F)S<P`N8V]M;65N=```````````````
-XM`````````````````````````````````````````!L````!````!@``````
-XM``!`````.@``````````````$``````````A`````0````,`````````?```
-XM``````````````````0`````````)P````@````#`````````'P`````````
-XM```````````$`````````"P````!``````````````!\````)@``````````
-XM`````0`````````1`````P``````````````H@```#4```````````````$`
-XM`````````0````(``````````````!@"``"@````!P````@````$````$```
-XM``D````#``````````````"X`@``&@```````````````0``````````````
-XM`````````````````0``````````````!`#Q_P````````````````,``0``
-XM```````````````#``(``````````````````P`#``````````````````,`
-XM!``(````$`````H````"``$`#````"`````*`````@`!`!$`````````"@``
-XM`!(``0`5````,`````H````2``$``'1E<W0N8P!B87(`9F]O,@!F;V\`8F%R
-X",@``
+XM``````````$```````````````0`\?\````````````````#``$`````````
+XM`````````P`"``````````````````,``P`````````````````#``0`"```
+XM`!`````*`````@`!``P````@````"@````(``0`1``````````H````2``$`
+XM%0```#`````*````$@`!``!T97-T+F,`8F%R`&9O;S(`9F]O`&)A<C(`````
+XM````````````````````````````````````````````````````&P````$`
+XM```&`````````$`````Z```````````````0`````````"$````!`````P``
+XM``````!\````````````````````!``````````G````"`````,`````````
+XM?`````````````````````0`````````+`````$``````````````'P````F
+XM```````````````!`````````!$````#``````````````"B````-0``````
+XM`````````0`````````!`````@``````````````V````*`````'````"```
+XM``0````0````"0````,``````````````'@!```:```````````````!````
+X$````````
X`
Xend
cc3b7341ff25eb16b80756fcb867a66b
diff --git a/test/elfcopy/tc/elfcopy-L-2/out/elfcopy-L-2.out.shar b/test/elfcopy/tc/elfcopy-L-2/out/elfcopy-L-2.out.shar
index 863030faccd9..317ec1d8a98b 100644
--- a/test/elfcopy/tc/elfcopy-L-2/out/elfcopy-L-2.out.shar
+++ b/test/elfcopy/tc/elfcopy-L-2/out/elfcopy-L-2.out.shar
@@ -10,8 +10,8 @@
#
echo x - a.out.1.uu
sed 's/^X//' >a.out.1.uu << 'f933ed5eb3f7f89e0de47764c538d3cb'
-Xbegin 755 a.out.1
-XM?T5,1@(!`0D```````````(`/@`!````L`1```````!``````````'@+````
+Xbegin 644 a.out.1
+XM?T5,1@(!`0D```````````(`/@`!````L`1```````!```````````@4````
XM`````````$``.``'`$``&P`8``8````%````0`````````!``$```````$``
XM0```````B`$```````"(`0````````@``````````P````0```#(`0``````
XM`,@!0```````R`%````````5`````````!4``````````0`````````!````
@@ -76,100 +76,100 @@ XM=')T86(`+FEN=&5R<``N;F]T92Y!0DDM=&%G`"YH87-H`"YD>6YS>6T`+F1Y
XM;G-T<@`N9VYU+G9E<G-I;VX`+F=N=2YV97)S:6]N7W(`+G)E;&$N<&QT`"YI
XM;FET`"YT97AT`"YF:6YI`"YR;V1A=&$`+F5H7V9R86UE7VAD<@`N9&%T80`N
XM96A?9G)A;64`+F1Y;F%M:6,`+F-T;W)S`"YD=&]R<P`N:F-R`"YG;W0`+F)S
-XM<P`N8V]M;65N=```````````````````````````````````````````````
-XM````````````````````````````````````````&P````$````"````````
-XM`,@!0```````R`$````````5`````````````````````0``````````````
-XM`````",````'`````@````````#@`4```````.`!````````&```````````
-XM``````````0````````````````````Q````!0````(`````````^`%`````
-XM``#X`0```````#P`````````!``````````(``````````0`````````-P``
-XM``L````"`````````#@"0```````.`(```````#P``````````4````!````
-XM"``````````8`````````#\````#`````@`````````H`T```````"@#````
-XM````70````````````````````$```````````````````!'````____;P(`
-XM````````A@-```````"&`P```````!0`````````!``````````"````````
-XM``(`````````5````/[__V\"`````````*`#0```````H`,````````@````
-XM``````4````!````"````````````````````&,````$`````@````````#`
-XM`T```````,`#````````>``````````$````"@````@`````````&```````
-XM``!M`````0````8`````````.`1````````X!````````!,`````````````
-XM```````$````````````````````:`````$````&`````````$P$0```````
-XM3`0```````!@````````````````````!``````````0`````````',````!
-XM````!@````````"P!$```````+`$````````:`$``````````````````!``
-XM``````````````````!Y`````0````8`````````&`9````````8!@``````
-XM``X````````````````````$````````````````````?P````$````"````
-XM`````"8&0```````)@8```````"E`````````````````````0``````````
-XM`````````(<````!`````@````````#,!D```````,P&````````"```````
-XM``````````````0```````````````````"5`````0````,`````````V`90
-XM``````#8!@```````!@````````````````````(````````````````````
-XMFP````$````"`````````/`&4```````\`8```````#`````````````````
-XM````"````````````````````*4````&`````P````````"P!U```````+`'
-XM````````8`$````````%``````````@`````````$`````````"N`````0``
-XM``,`````````$`E0```````0"0```````!`````````````````````(````
-XM````````````````M0````$````#`````````"`)4```````(`D````````0
-XM````````````````````"````````````````````+P````!`````P``````
-XM```P"5```````#`)````````"`````````````````````@`````````````
-XM``````#!`````0````,`````````.`E0```````X"0```````$``````````
-XM```````````(``````````@`````````Q@````@````#`````````'@)4```
-XM````>`D````````0````````````````````"````````````````````,L`
-XM```!`````````````````````````'@)````````+`$`````````````````
-XM``$````````````````````1`````P````````````````````````"D"@``
-XM`````-0````````````````````!`````````````````````0````(`````
-XM````````````````````.!(```````"0!@```````!H````U````"```````
-XM```8``````````D````#`````````````````````````,@8````````^0$`
-XM``````````````````$`````````````````````````````````````````
-XM`````````````````P`!`,@!0````````````````````````P`"`.`!0```
-XM`````````````````````P`#`/@!0````````````````````````P`$`#@"
-XM0````````````````````````P`%`"@#0````````````````````````P`&
-XM`(8#0````````````````````````P`'`*`#0```````````````````````
-XM`P`(`,`#0````````````````````````P`)`#@$0```````````````````
-XM`````P`*`$P$0````````````````````````P`+`+`$0```````````````
-XM`````````P`,`!@&0````````````````````````P`-`"8&0```````````
-XM`````````````P`.`,P&0````````````````````````P`/`-@&4```````
-XM`````````````````P`0`/`&4````````````````````````P`1`+`'4```
-XM`````````````````````P`2`!`)4````````````````````````P`3`"`)
-XM4````````````````````````P`4`#`)4````````````````````````P`5
-XM`#@)4````````````````````````P`6`'@)4```````````````````````
-XM`P`7`````````````````````````````P`8````````````````````````
-XM`````P`9`````````````````````````````P`:````````````````````
-XM```!````!`#Q_P`````````````````````(`````0`"`.`!0```````&```
-XM```````/````!`#Q_P`````````````````````M````!`#Q_P``````````
-XM```````````\````!`#Q_P`````````````````````/````!`#Q_P``````
-XM``````````````!'````!`#Q_P````````````````````!2`````0`2`!`)
-XM4`````````````````!@`````0`3`"`)4`````````````````!N`````0`4
-XM`#`)4`````````````````![`````@`+`%`%0`````````````````"1````
-XM`0`6`'@)4````````0````````"@`````0`/`.@&4`````````````````"G
-XM`````@`+`)`%0`````````````````!'````!`#Q_P``````````````````
-XM``"S`````0`2`!@)4`````````````````#``````0`3`"@)4```````````
-XM``````#-`````0`0`'@'4`````````````````#;`````0`4`#`)4```````
-XM``````````#G`````@`+`/`%0`````````````````#]````!`#Q_P``````
+XM<P`N8V]M;65N=````````````````````````````````````````P`!`,@!
+XM0````````````````````````P`"`.`!0````````````````````````P`#
+XM`/@!0````````````````````````P`$`#@"0```````````````````````
+XM`P`%`"@#0````````````````````````P`&`(8#0```````````````````
+XM`````P`'`*`#0````````````````````````P`(`,`#0```````````````
+XM`````````P`)`#@$0````````````````````````P`*`$P$0```````````
+XM`````````````P`+`+`$0````````````````````````P`,`!@&0```````
+XM`````````````````P`-`"8&0````````````````````````P`.`,P&0```
+XM`````````````````````P`/`-@&4````````````````````````P`0`/`&
+XM4````````````````````````P`1`+`'4````````````````````````P`2
+XM`!`)4````````````````````````P`3`"`)4```````````````````````
+XM`P`4`#`)4````````````````````````P`5`#@)4```````````````````
+XM`````P`6`'@)4````````````````````````P`7````````````````````
+XM`````````P`8`````````````````````````````P`9````````````````
+XM`````````````P`:```````````````````````!````!`#Q_P``````````
+XM```````````(`````0`"`.`!0```````&``````````/````!`#Q_P``````
XM```````````````M````!`#Q_P`````````````````````\````!`#Q_P``
-XM``````````````````#]````!`#Q_P`````````````````````;`0``!`#Q
-XM_P`````````````````````B`0````#Q_X@)4``````````````````G`0``
-XM$@```%P$0```````T@`````````V`0``$0`1`+`'4``````````````````_
-XM`0``$0(/`.`&4`````````````````!,`0``$@```&P$0````````@``````
-XM``!@`0``$@`)`#@$0`````````````````!F`0``$0`6`(`)4```````"```
-XM``````!N`0``$0`/`-@&4```````"`````````!Y`0``$@`+`+`$0```````
-XMDP````````"``0``$@```'P$0```````H@````````"1`0``$`#Q_W@)4```
-XM``````````````"=`0``$@`+`,`%0```````+0````````"B`0``$@`,`!@&
-XM0`````````````````"H`0``$@```(P$0```````+P````````"W`0``$`#Q
-XM_W@)4`````````````````"^`0``$0`5`#@)4`````````````````#4`0``
-XM$@```)P$0```````+P````````#E`0``(```````````````````````````
-XM8W)T,2YC`&%B:71A9P`O=7-R+W-R8R]L:6(O8W-U+V%M9#8T+V-R=&DN4P`\
-XM8V]M;6%N9"UL:6YE/@`\8G5I;'0M:6X^`&-R='-T=69F+F,`7U]#5$]27TQ)
-XM4U1?7P!?7T143U)?3$E35%]?`%]?2D-27TQ)4U1?7P!?7V1O7V=L;V)A;%]D
-XM=&]R<U]A=7@`8V]M<&QE=&5D+C4P,CD`<"XU,#(W`&9R86UE7V1U;6UY`%]?
-XM0U1/4E]%3D1?7P!?7T143U)?14Y$7U\`7U]&4D%-15]%3D1?7P!?7TI#4E]%
-XM3D1?7P!?7V1O7V=L;V)A;%]C=&]R<U]A=7@`+W5S<B]S<F,O;&EB+V-S=2]A
-XM;60V-"]C<G1N+E,`=&5S="YC`%]E;F0`<'5T<T!`1D)31%\Q+C``7T193D%-
-XM24,`7U]D<V]?:&%N9&QE`%]I;FET7W1L<T!`1D)31%\Q+C``7VEN:70`96YV
-XM:7)O;@!?7W!R;V=N86UE`%]S=&%R=`!P<FEN=&9`0$9"4T1?,2XP`%]?8G-S
-XM7W-T87)T`&UA:6X`7V9I;FD`97AI=$!`1D)31%\Q+C``7V5D871A`%]'3$]"
-XM04Q?3T9&4T547U1!0DQ%7P!A=&5X:71`0$9"4T1?,2XP`%]*=E]296=I<W1E
-X)<D-L87-S97,`
+XM```````````````````/````!`#Q_P````````````````````!'````!`#Q
+XM_P````````````````````!2`````0`2`!`)4`````````````````!@````
+XM`0`3`"`)4`````````````````!N`````0`4`#`)4`````````````````![
+XM`````@`+`%`%0`````````````````"1`````0`6`'@)4````````0``````
+XM``"@`````0`/`.@&4`````````````````"G`````@`+`)`%0```````````
+XM``````!'````!`#Q_P````````````````````"S`````0`2`!@)4```````
+XM``````````#``````0`3`"@)4`````````````````#-`````0`0`'@'4```
+XM``````````````#;`````0`4`#`)4`````````````````#G`````@`+`/`%
+XM0`````````````````#]````!`#Q_P`````````````````````M````!`#Q
+XM_P`````````````````````\````!`#Q_P````````````````````#]````
+XM!`#Q_P`````````````````````;`0``!`#Q_P`````````````````````B
+XM`0````#Q_X@)4``````````````````G`0``$@```%P$0```````T@``````
+XM```V`0``$0`1`+`'4``````````````````_`0``$0(/`.`&4```````````
+XM``````!,`0``$@```&P$0````````@````````!@`0``$@`)`#@$0```````
+XM``````````!F`0``$0`6`(`)4```````"`````````!N`0``$0`/`-@&4```
+XM````"`````````!Y`0``$@`+`+`$0```````DP````````"``0``$@```'P$
+XM0```````H@````````"1`0``$`#Q_W@)4`````````````````"=`0``$@`+
+XM`,`%0```````+0````````"B`0``$@`,`!@&0`````````````````"H`0``
+XM$@```(P$0```````+P````````"W`0``$`#Q_W@)4`````````````````"^
+XM`0``$0`5`#@)4`````````````````#4`0``$@```)P$0```````+P``````
+XM``#E`0``(```````````````````````````8W)T,2YC`&%B:71A9P`O=7-R
+XM+W-R8R]L:6(O8W-U+V%M9#8T+V-R=&DN4P`\8V]M;6%N9"UL:6YE/@`\8G5I
+XM;'0M:6X^`&-R='-T=69F+F,`7U]#5$]27TQ)4U1?7P!?7T143U)?3$E35%]?
+XM`%]?2D-27TQ)4U1?7P!?7V1O7V=L;V)A;%]D=&]R<U]A=7@`8V]M<&QE=&5D
+XM+C4P,CD`<"XU,#(W`&9R86UE7V1U;6UY`%]?0U1/4E]%3D1?7P!?7T143U)?
+XM14Y$7U\`7U]&4D%-15]%3D1?7P!?7TI#4E]%3D1?7P!?7V1O7V=L;V)A;%]C
+XM=&]R<U]A=7@`+W5S<B]S<F,O;&EB+V-S=2]A;60V-"]C<G1N+E,`=&5S="YC
+XM`%]E;F0`<'5T<T!`1D)31%\Q+C``7T193D%-24,`7U]D<V]?:&%N9&QE`%]I
+XM;FET7W1L<T!`1D)31%\Q+C``7VEN:70`96YV:7)O;@!?7W!R;V=N86UE`%]S
+XM=&%R=`!P<FEN=&9`0$9"4T1?,2XP`%]?8G-S7W-T87)T`&UA:6X`7V9I;FD`
+XM97AI=$!`1D)31%\Q+C``7V5D871A`%]'3$]"04Q?3T9&4T547U1!0DQ%7P!A
+XM=&5X:71`0$9"4T1?,2XP`%]*=E]296=I<W1E<D-L87-S97,`````````````
+XM````````````````````````````````````````````````````````````
+XM```````````````````````;`````0````(`````````R`%```````#(`0``
+XM`````!4````````````````````!````````````````````(P````<````"
+XM`````````.`!0```````X`$````````8````````````````````!```````
+XM`````````````#$````%`````@````````#X`4```````/@!````````/```
+XM```````$``````````@`````````!``````````W````"P````(`````````
+XM.`)````````X`@```````/``````````!0````$````(`````````!@`````
+XM````/P````,````"`````````"@#0```````*`,```````!=````````````
+XM`````````0```````````````````$<```#___]O`@````````"&`T``````
+XM`(8#````````%``````````$``````````(``````````@````````!4````
+XM_O__;P(`````````H`-```````"@`P```````"``````````!0````$````(
+XM````````````````````8P````0```!"`````````,`#0```````P`,`````
+XM``!X``````````0````*````"``````````8`````````&T````!````!@``
+XM```````X!$```````#@$````````$P````````````````````0`````````
+XM``````````!H`````0````8`````````3`1```````!,!````````&``````
+XM```````````````$`````````!``````````<P````$````&`````````+`$
+XM0```````L`0```````!H`0``````````````````$```````````````````
+XM`'D````!````!@`````````8!D```````!@&````````#@``````````````
+XM``````0```````````````````!_`````0````(`````````)@9````````F
+XM!@```````*4````````````````````!````````````````````AP````$`
+XM```"`````````,P&0```````S`8````````(````````````````````!```
+XM`````````````````)4````!`````P````````#8!E```````-@&````````
+XM&`````````````````````@```````````````````";`````0````(`````
+XM````\`90``````#P!@```````,`````````````````````(````````````
+XM````````I0````8````#`````````+`'4```````L`<```````!@`0``````
+XM``4`````````"``````````0`````````*X````!`````P`````````0"5``
+XM`````!`)````````$`````````````````````@```````````````````"U
+XM`````0````,`````````(`E0```````@"0```````!``````````````````
+XM```(````````````````````O`````$````#`````````#`)4```````,`D`
+XM```````(````````````````````"````````````````````,$````!````
+XM`P`````````X"5```````#@)````````0`````````````````````@`````
+XM````"`````````#&````"`````,`````````>`E0``````!X"0```````!``
+XM```````````````````(````````````````````RP````$`````````````
+XM````````````>`D````````L`0```````````````````0``````````````
+XM`````!$````#`````````````````````````*0*````````U```````````
+XM``````````$````````````````````!`````@``````````````````````
+XM``!X"P```````)`&````````&@```#4````(`````````!@`````````"0``
+XM``,`````````````````````````"!(```````#Y`0``````````````````
+X0`0``````````````````````
X`
Xend
f933ed5eb3f7f89e0de47764c538d3cb
echo x - a.out.uu
sed 's/^X//' >a.out.uu << 'debc64a5f6aece67b22914f9f4be2988'
-Xbegin 755 a.out
+Xbegin 644 a.out
XM?T5,1@(!`0D```````````(`/@`!````L`1```````!``````````'@+````
XM`````````$``.``'`$``&P`8``8````%````0`````````!``$```````$``
XM0```````B`$```````"(`0````````@``````````P````0```#(`0``````
diff --git a/test/elfcopy/tc/elfcopy-N-1/out/elfcopy-N-1.out.shar b/test/elfcopy/tc/elfcopy-N-1/out/elfcopy-N-1.out.shar
index 52ec049e7aaf..2098237cbc9c 100644
--- a/test/elfcopy/tc/elfcopy-N-1/out/elfcopy-N-1.out.shar
+++ b/test/elfcopy/tc/elfcopy-N-1/out/elfcopy-N-1.out.shar
@@ -9,29 +9,29 @@
# sym.o.uu
#
echo x - sym.o.1.uu
-sed 's/^X//' >sym.o.1.uu << 'END-of-sym.o.1.uu'
+sed 's/^X//' >sym.o.1.uu << 'cc3b7341ff25eb16b80756fcb867a66b'
Xbegin 644 sym.o.1
-XM?T5,1@$!`0D```````````$``P`!``````````````#8`````````#0`````
+XM?T5,1@$!`0D```````````$``P`!``````````````"``0```````#0`````
XM`"@`"``%`````````````````%6)Y;@`````7<.-M@````!5B>6X`````%W#
XMC;8`````58GEN`````!=PXVV`````%6)Y;@`````7<,```!'0T,Z("A'3E4I
XM(#0N,BXQ(#(P,#<P-S$Y("!;1G)E94)31%T``"YS>6UT86(`+G-T<G1A8@`N
XM<VAS=')T86(`+G1E>'0`+F1A=&$`+F)S<P`N8V]M;65N=```````````````
-XM`````````````````````````````````````````!L````!````!@``````
-XM``!`````.@``````````````$``````````A`````0````,`````````?```
-XM``````````````````0`````````)P````@````#`````````'P`````````
-XM```````````$`````````"P````!``````````````!\````)@``````````
-XM`````0`````````1`````P``````````````H@```#4```````````````$`
-XM`````````0````(``````````````!@"``"0````!P````8````$````$```
-XM``D````#``````````````"H`@``%0```````````````0``````````````
-XM`````````````````0``````````````!`#Q_P````````````````,``0``
-XM```````````````#``(``````````````````P`#``````````````````,`
-XM!``(``````````H````2``$`#````!`````*````$@`!`!`````@````"@``
-X:`!(``0``=&5S="YC`&9O;P!B87(`9F]O,@``
+XM``````````$```````````````0`\?\````````````````#``$`````````
+XM`````````P`"``````````````````,``P`````````````````#``0`"```
+XM```````*````$@`!``P````0````"@```!(``0`0````(`````H````2``$`
+XM`'1E<W0N8P!F;V\`8F%R`&9O;S(`````````````````````````````````
+XM`````````````````````````!L````!````!@````````!`````.@``````
+XM````````$``````````A`````0````,`````````?```````````````````
+XM``0`````````)P````@````#`````````'P````````````````````$````
+XM`````"P````!``````````````!\````)@```````````````0`````````1
+XM`````P``````````````H@```#4```````````````$``````````0````(`
+XM`````````````-@```"0````!P````8````$````$`````D````#````````
+X=``````!H`0``%0```````````````0``````````
X`
Xend
-END-of-sym.o.1.uu
+cc3b7341ff25eb16b80756fcb867a66b
echo x - sym.o.uu
-sed 's/^X//' >sym.o.uu << 'END-of-sym.o.uu'
+sed 's/^X//' >sym.o.uu << '07b26866a0eaf5d2a40d8f75b1109c67'
Xbegin 644 sym.o
XM?T5,1@$!`0D```````````$``P`!``````````````#8`````````#0`````
XM`"@`"``%`````````````````%6)Y;@`````7<.-M@````!5B>6X`````%W#
@@ -52,6 +52,6 @@ XM`!(``0`5````,`````H````2``$``'1E<W0N8P!F;V\`8F%R`&9O;S(`8F%R
X",@``
X`
Xend
-END-of-sym.o.uu
+07b26866a0eaf5d2a40d8f75b1109c67
exit
diff --git a/test/elfcopy/tc/elfcopy-N-2/out/elfcopy-N-2.out.shar b/test/elfcopy/tc/elfcopy-N-2/out/elfcopy-N-2.out.shar
index c9fe5b6737bc..7d700193f51b 100644
--- a/test/elfcopy/tc/elfcopy-N-2/out/elfcopy-N-2.out.shar
+++ b/test/elfcopy/tc/elfcopy-N-2/out/elfcopy-N-2.out.shar
@@ -9,29 +9,29 @@
# dup.o.uu
#
echo x - dup.o.1.uu
-sed 's/^X//' >dup.o.1.uu << 'END-of-dup.o.1.uu'
+sed 's/^X//' >dup.o.1.uu << 'f11d3ae31690547dd28efbfd6006f908'
Xbegin 644 dup.o.1
-XM?T5,1@$!`0D```````````$``P`!``````````````#8`````````#0`````
+XM?T5,1@$!`0D```````````$``P`!``````````````"$`0```````#0`````
XM`"@`"``%`````````````````%6)Y;@`````7<.-M@````!5B>6X`````%W#
XMC;8`````58GEN`````!=PXVV`````%6)Y;@`````7<,```!'0T,Z("A'3E4I
XM(#0N,BXQ(#(P,#<P-S$Y("!;1G)E94)31%T``"YS>6UT86(`+G-T<G1A8@`N
XM<VAS=')T86(`+G1E>'0`+F1A=&$`+F)S<P`N8V]M;65N=```````````````
-XM`````````````````````````````````````````!L````!````!@``````
-XM``!`````.@``````````````$``````````A`````0````,`````````?```
-XM``````````````````0`````````)P````@````#`````````'P`````````
-XM```````````$`````````"P````!``````````````!\````)@``````````
-XM`````0`````````1`````P``````````````H@```#4```````````````$`
-XM`````````0````(``````````````!@"``"0````!P````8````$````$```
-XM``D````#``````````````"H`@``&P```````````````0``````````````
-XM`````````````````0``````````````!`#Q_P````````````````,``0``
-XM```````````````#``(``````````````````P`#``````````````````,`
-XM!``(``````````H````2``$`$P```"`````*````$@`!`!<````P````"@``
-X@`!(``0``=&5S="YC`'!R969I>%]F;V\`9F]O`&)A<@``
+XM``````````$```````````````0`\?\````````````````#``$`````````
+XM`````````P`"``````````````````,``P`````````````````#``0`"```
+XM```````*````$@`!`!,````@````"@```!(``0`7````,`````H````2``$`
+XM`'1E<W0N8P!P<F5F:7A?9F]O`&9O;P!B87(`````````````````````````
+XM```````````````````````````````;`````0````8`````````0````#H`
+XM`````````````!``````````(0````$````#`````````'P`````````````
+XM```````$`````````"<````(`````P````````!\````````````````````
+XM!``````````L`````0``````````````?````"8```````````````$`````
+XM````$0````,``````````````*(````U```````````````!``````````$`
+XM```"``````````````#8````D`````<````&````!````!`````)`````P``
+XA````````````:`$``!L```````````````$`````````
X`
Xend
-END-of-dup.o.1.uu
+f11d3ae31690547dd28efbfd6006f908
echo x - dup.o.uu
-sed 's/^X//' >dup.o.uu << 'END-of-dup.o.uu'
+sed 's/^X//' >dup.o.uu << 'b473e23605eb82e8423dd39bf18cc444'
Xbegin 644 dup.o
XM?T5,1@$!`0D```````````$``P`!``````````````#8`````````#0`````
XM`"@`"``%`````````````````%6)Y;@`````7<.-M@````!5B>6X`````%W#
@@ -52,6 +52,6 @@ XM`!(``0`<````,`````H````2``$``'1E<W0N8P!P<F5F:7A?9F]O`&)A<C(`
X(9F]O`&)A<@``
X`
Xend
-END-of-dup.o.uu
+b473e23605eb82e8423dd39bf18cc444
exit
diff --git a/test/elfcopy/tc/elfcopy-noops-1/out/elfcopy-noops-1.out.shar b/test/elfcopy/tc/elfcopy-noops-1/out/elfcopy-noops-1.out.shar
index ddefbdb0fefd..55ac39399bdf 100644
--- a/test/elfcopy/tc/elfcopy-noops-1/out/elfcopy-noops-1.out.shar
+++ b/test/elfcopy/tc/elfcopy-noops-1/out/elfcopy-noops-1.out.shar
@@ -9,9 +9,9 @@
# pkill.uu
#
echo x - pkill.new.uu
-sed 's/^X//' >pkill.new.uu << 'END-of-pkill.new.uu'
-Xbegin 755 pkill.new
-XM?T5,1@$!`0D```````````(``P`!````D(X$"#0```#T+@```````#0`(``&
+sed 's/^X//' >pkill.new.uu << '672fadc176202ece55dbb7d4b04d86b9'
+Xbegin 644 pkill.new
+XM?T5,1@$!`0D```````````(``P`!````D(X$"#0```"\/@```````#0`(``&
XM`"@`&P`8``8````T````-(`$"#2`!`C`````P`````4````$`````P```/0`
XM``#T@`0(](`$"!4````5````!`````$````!``````````"`!`@`@`0(YBH`
XM`.8J```%`````!````$```#H*@``Z+H$".BZ!`C$`0``R`(```8`````$```
@@ -278,31 +278,7 @@ XM=&%B`"YI;G1E<G``+FYO=&4N04))+71A9P`N:&%S:``N9'EN<WEM`"YD>6YS
XM='(`+F=N=2YV97)S:6]N`"YG;G4N=F5R<VEO;E]R`"YR96PN9'EN`"YR96PN
XM<&QT`"YI;FET`"YT97AT`"YF:6YI`"YR;V1A=&$`+F1A=&$`+F5H7V9R86UE
XM`"YD>6YA;6EC`"YC=&]R<P`N9'1O<G,`+FIC<@`N9V]T`"YB<W,`+F-O;6UE
-XM;G0`````````````````````````````````````````````````````````
-XM&P````$````"````](`$"/0````5```````````````!`````````",````'
-XM`````@````R!!`@,`0``&```````````````!``````````Q````!0````(`
-XM```D@00()`$``*0!```$``````````0````$````-P````L````"````R(($
-XM",@"```@!```!0````$````$````$````#\````#`````@```.B&!`CH!@``
-XM10(``````````````0````````!'````____;P(````NB00(+@D``(0````$
-XM``````````(````"````5````/[__V\"````M(D$"+0)```@````!0````$`
-XM```$`````````&,````)`````@```-2)!`C4"0``2`````0`````````!```
-XM``@```!L````"0````(````<B@0('`H``'`!```$````"P````0````(````
-XM=0````$````&````C(L$"(P+```1```````````````$`````````'`````!
-XM````!@```*"+!`B@"P``\`(`````````````!`````0```![`````0````8`
-XM``"0C@0(D`X``/P6`````````````!``````````@0````$````&````C*4$
-XM"(PE```,```````````````$`````````(<````!`````@```)BE!`B8)0``
-XM3@4`````````````!`````````"/`````0````,```#HN@0(Z"H``!@`````
-XM``````````0`````````E0````$````"`````+L$"``K```$````````````
-XM```$`````````)\````&`````P````2[!`@$*P``T`````4`````````!```
-XM``@```"H`````0````,```#4NP0(U"L```@```````````````0`````````
-XMKP````$````#````W+L$"-PK```(```````````````$`````````+8````!
-XM`````P```.2[!`CD*P``!```````````````!`````````"[`````0````,`
-XM``#HNP0(Z"L``,0```````````````0````$````P`````@````#````K+P$
-XM"*PL```$`0`````````````(`````````,4````!``````````````"L+```
-XM>`$``````````````0`````````1`````P``````````````)"X``,X`````
-XM``````````$``````````0````(``````````````"PS``!@"0``&@```%(`
-XM```$````$`````D````#``````````````",/```9@8``````````````0``
-XM`````````````````````````````````/2`!`@``````P`!```````,@00(
+XM;G0``````````````````````````````/2`!`@``````P`!```````,@00(
XM``````,``@``````)($$"``````#``,``````,B"!`@``````P`$``````#H
XMA@0(``````,`!0``````+HD$"``````#``8``````+2)!`@``````P`'````
XM``#4B00(``````,`"```````'(H$"``````#``D``````(R+!`@``````P`*
@@ -391,13 +367,37 @@ XM<$!`1D)31%\Q+C``;W!T:6YD0$!&0E-$7S$N,`!?7W-R9V5T0$!&0E-$7S$N
XM,`!R96=C;VUP0$!&0E-$7S$N,`!A=&5X:71`0$9"4T1?,2XP`&=E='!I9$!`
XM1D)31%\Q+C``<W1R;&5N0$!&0E-$7S$N,`!K=FU?;W!E;F9I;&5S`&=E='!G
XM<G!`0$9"4T1?,2XP`%]*=E]296=I<W1E<D-L87-S97,`9V5T<')O9VYA;65`
-XF0$9"4T1?,2XP`&=E=&-`0$9"4T1?,2XP`&MV;5]G971P<F]C<P``
+XM0$9"4T1?,2XP`&=E=&-`0$9"4T1?,2XP`&MV;5]G971P<F]C<P``````````
+XM```````````````````````````````````````````````;`````0````(`
+XM``#T@`0(]````!4```````````````$`````````(P````<````"````#($$
+XM"`P!```8```````````````$`````````#$````%`````@```"2!!`@D`0``
+XMI`$```0`````````!`````0````W````"P````(```#(@@0(R`(``"`$```%
+XM`````0````0````0````/P````,````"````Z(8$".@&``!%`@``````````
+XM```!`````````$<```#___]O`@```"Z)!`@N"0``A`````0``````````@``
+XM``(```!4````_O__;P(```"TB00(M`D``"`````%`````0````0`````````
+XM8P````D```!"````U(D$"-0)``!(````!``````````$````"````&P````)
+XM````0@```!R*!`@<"@``<`$```0````+````!`````@```!U`````0````8`
+XM``",BP0(C`L``!$```````````````0`````````<`````$````&````H(L$
+XM"*`+``#P`@`````````````$````!````'L````!````!@```)".!`B0#@``
+XM_!8`````````````$`````````"!`````0````8```",I00(C"4```P`````
+XM``````````0`````````AP````$````"````F*4$")@E``!.!0``````````
+XM```$`````````(\````!`````P```.BZ!`CH*@``&```````````````!```
+XM``````"5`````0````(`````NP0(`"L```0```````````````0`````````
+XMGP````8````#````!+L$"`0K``#0````!0`````````$````"````*@````!
+XM`````P```-2[!`C4*P``"```````````````!`````````"O`````0````,`
+XM``#<NP0(W"L```@```````````````0`````````M@````$````#````Y+L$
+XM".0K```$```````````````$`````````+L````!`````P```.B[!`CH*P``
+XMQ```````````````!`````0```#`````"`````,```"LO`0(K"P```0!````
+XM``````````@`````````Q0````$``````````````*PL``!X`0``````````
+XM```!`````````!$````#```````````````D+@``S@```````````````0``
+XM```````!`````@``````````````]"X``&`)```:````4@````0````0````
+XH"0````,``````````````%0X``!F!@`````````````!````````````
X`
Xend
-END-of-pkill.new.uu
+672fadc176202ece55dbb7d4b04d86b9
echo x - pkill.uu
-sed 's/^X//' >pkill.uu << 'END-of-pkill.uu'
-Xbegin 755 pkill
+sed 's/^X//' >pkill.uu << '521a9e5ac40550eee504b066258ae35d'
+Xbegin 644 pkill
XM?T5,1@$!`0D```````````(``P`!````D(X$"#0```#T+@```````#0`(``&
XM`"@`&P`8``8````T````-(`$"#2`!`C`````P`````4````$`````P```/0`
XM``#T@`0(](`$"!4````5````!`````$````!``````````"`!`@`@`0(YBH`
@@ -781,6 +781,6 @@ XM<G!`0$9"4T1?,2XP`%]*=E]296=I<W1E<D-L87-S97,`9V5T<')O9VYA;65`
XF0$9"4T1?,2XP`&=E=&-`0$9"4T1?,2XP`&MV;5]G971P<F]C<P``
X`
Xend
-END-of-pkill.uu
+521a9e5ac40550eee504b066258ae35d
exit
diff --git a/test/elfcopy/tc/elfcopy-noops-2/out/elfcopy-noops-2.out.shar b/test/elfcopy/tc/elfcopy-noops-2/out/elfcopy-noops-2.out.shar
index d100ebf2a433..570378a01f11 100644
--- a/test/elfcopy/tc/elfcopy-noops-2/out/elfcopy-noops-2.out.shar
+++ b/test/elfcopy/tc/elfcopy-noops-2/out/elfcopy-noops-2.out.shar
@@ -9,8 +9,8 @@
# ls.uu
#
echo x - ls.new.uu
-sed 's/^X//' >ls.new.uu << 'END-of-ls.new.uu'
-Xbegin 755 ls.new
+sed 's/^X//' >ls.new.uu << '546f75a0f05440808208cba22c526606'
+Xbegin 644 ls.new
XM?T5,1@$!`0D```````````(``P`!````D),$"#0```!T7@```````#0`(``'
XM`"@`&@`9``8````T````-(`$"#2`!`C@````X`````4````$`````P```!0!
XM```4@00(%($$"!4````5````!`````$````!``````````"`!`@`@`0(<%@`
@@ -555,8 +555,8 @@ XM(0````4````"````1($$"$0!``!H`@``!``````````$````!````"<````+
XM`````@```*R#!`BL`P``4`4```4````!````!````!`````O`````P````(`
XM``#\B`0(_`@```@#``````````````$`````````-P```/___V\"````!(P$
XM"`0,``"J````!``````````"`````@```$0```#^__]O`@```+",!`BP#```
-XM(`````4````!````!`````````!3````"0````(```#0C`0(T`P``#`````$
-XM``````````0````(````7`````D````"`````(T$"``-```@`@``!`````L`
+XM(`````4````!````!`````````!3````"0```$(```#0C`0(T`P``#`````$
+XM``````````0````(````7`````D```!"`````(T$"``-```@`@``!`````L`
XM```$````"````&4````!````!@```""/!`@@#P``$0``````````````!```
XM``````!@`````0````8````TCP0(-`\``%`$``````````````0````$````
XM:P````$````&````D),$")`3``!,0``````````````0`````````'$````!
@@ -574,10 +574,10 @@ XM`.!:``#(`@`````````````!``````````$````#``````````````"H70``
X4S````````````````0``````````
X`
Xend
-END-of-ls.new.uu
+546f75a0f05440808208cba22c526606
echo x - ls.uu
-sed 's/^X//' >ls.uu << 'END-of-ls.uu'
-Xbegin 755 ls
+sed 's/^X//' >ls.uu << '4db11c737631d887608e3186a17a7a3e'
+Xbegin 644 ls
XM?T5,1@$!`0D```````````(``P`!````D),$"#0```!T7@```````#0`(``'
XM`"@`&@`9``8````T````-(`$"#2`!`C@````X`````4````$`````P```!0!
XM```4@00(%($$"!4````5````!`````$````!``````````"`!`@`@`0(<%@`
@@ -1141,6 +1141,6 @@ XM`.!:``#(`@`````````````!``````````$````#``````````````"H70``
X4S````````````````0``````````
X`
Xend
-END-of-ls.uu
+4db11c737631d887608e3186a17a7a3e
exit
diff --git a/test/elfcopy/tc/elfcopy-noops-3/out/elfcopy-noops-3.out.shar b/test/elfcopy/tc/elfcopy-noops-3/out/elfcopy-noops-3.out.shar
index 40bc524b6440..43ace560bcec 100644
--- a/test/elfcopy/tc/elfcopy-noops-3/out/elfcopy-noops-3.out.shar
+++ b/test/elfcopy/tc/elfcopy-noops-3/out/elfcopy-noops-3.out.shar
@@ -9,8 +9,8 @@
# ps.uu
#
echo x - ps.new.uu
-sed 's/^X//' >ps.new.uu << 'END-of-ps.new.uu'
-Xbegin 755 ps.new
+sed 's/^X//' >ps.new.uu << 'cffb18ef50dd17690799ebccb9f304ef'
+Xbegin 644 ps.new
XM?T5,1@$!`0D```````````(``P`!````T)0$"#0````(>````````#0`(``'
XM`"@`&@`9``8````T````-(`$"#2`!`C@````X`````4````$`````P```!0!
XM```4@00(%($$"!4````5````!`````$````!``````````"`!`@`@`0(!&``
@@ -701,8 +701,8 @@ XM```$``````````0````$````)P````L````"````Q(,$",0#``"P!0``!0``
XM``$````$````$````"\````#`````@```'2)!`AT"0``+@,`````````````
XM`0`````````W````____;P(```"BC`0(H@P``+8````$``````````(````"
XM````1````/[__V\"````6(T$"%@-``!`````!0````(````$`````````%,`
-XM```)`````@```)B-!`B8#0``,`````0`````````!`````@```!<````"0``
-XM``(```#(C00(R`T``$@"```$````"P````0````(````90````$````&````
+XM```)````0@```)B-!`B8#0``,`````0`````````!`````@```!<````"0``
+XM`$(```#(C00(R`T``$@"```$````"P````0````(````90````$````&````
XM$)`$"!`0```1```````````````$`````````&`````!````!@```"20!`@D
XM$```H`0`````````````!`````0```!K`````0````8```#0E`0(T!0``%Q!
XM`````````````!``````````<0````$````&````+-8$""Q6```,````````
@@ -719,10 +719,10 @@ XM"`````````##`````0``````````````V',``&,#``````````````$`````
XK`````0````,``````````````#MW``#,```````````````!````````````
X`
Xend
-END-of-ps.new.uu
+cffb18ef50dd17690799ebccb9f304ef
echo x - ps.uu
-sed 's/^X//' >ps.uu << 'END-of-ps.uu'
-Xbegin 755 ps
+sed 's/^X//' >ps.uu << '1d41113d6c473df8a15e4a4e0ea90bc3'
+Xbegin 644 ps
XM?T5,1@$!`0D```````````(``P`!````T)0$"#0````(>````````#0`(``'
XM`"@`&@`9``8````T````-(`$"#2`!`C@````X`````4````$`````P```!0!
XM```4@00(%($$"!4````5````!`````$````!``````````"`!`@`@`0(!&``
@@ -1431,6 +1431,6 @@ XM"`````````##`````0``````````````V',``&,#``````````````$`````
XK`````0````,``````````````#MW``#,```````````````!````````````
X`
Xend
-END-of-ps.uu
+1d41113d6c473df8a15e4a4e0ea90bc3
exit
diff --git a/test/elfcopy/tc/elfcopy-noops-4/out/elfcopy-noops-4.out.shar b/test/elfcopy/tc/elfcopy-noops-4/out/elfcopy-noops-4.out.shar
index 4ab2a51c2877..09672f7cb968 100644
--- a/test/elfcopy/tc/elfcopy-noops-4/out/elfcopy-noops-4.out.shar
+++ b/test/elfcopy/tc/elfcopy-noops-4/out/elfcopy-noops-4.out.shar
@@ -9,8 +9,8 @@
# vi.uu
#
echo x - vi.new.uu
-sed 's/^X//' >vi.new.uu << 'END-of-vi.new.uu'
-Xbegin 755 vi.new
+sed 's/^X//' >vi.new.uu << 'c6a212f79bb8cf302d242d299c785f85'
+Xbegin 644 vi.new
XM?T5,1@$!`0D```````````(``P`!````X*0$"#0````8IP0``````#0`(``'
XM`"@`&@`9``8````T````-(`$"#2`!`C@````X`````4````$`````P```!0!
XM```4@00(%($$"!4````5````!`````$````!``````````"`!`@`@`0(@(\$
@@ -6794,8 +6794,8 @@ XM"$0!``"T!```!``````````$````!````"<````+`````@```/B%!`CX!0``
XM@`H```4````!````!````!`````O`````P````(```!XD`0(>!```-`$````
XM``````````$`````````-P```/___V\"````2)4$"$@5``!0`0``!```````
XM```"`````@```$0```#^__]O`@```)B6!`B8%@``(`````4````!````!```
-XM``````!3````"0````(```"XE@0(N!8``&`````$``````````0````(````
-XM7`````D````"````&)<$"!@7``"(!```!`````L````$````"````&4````!
+XM``````!3````"0```$(```"XE@0(N!8``&`````$``````````0````(````
+XM7`````D```!"````&)<$"!@7``"(!```!`````L````$````"````&4````!
XM````!@```*";!`B@&P``$0``````````````!`````````!@`````0````8`
XM``"TFP0(M!L``"`)``````````````0````$````:P````$````&````X*0$
XM".`D```\Y0,````````````0`````````'$````!````!@```!R*"`@<"@0`
@@ -6813,10 +6813,10 @@ XM```!``````````$````#``````````````!)I@0`S````````````````0``
X%````````
X`
Xend
-END-of-vi.new.uu
+c6a212f79bb8cf302d242d299c785f85
echo x - vi.uu
-sed 's/^X//' >vi.uu << 'END-of-vi.uu'
-Xbegin 755 vi
+sed 's/^X//' >vi.uu << '5f6cb34c34598fc980a32aede89eafe8'
+Xbegin 644 vi
XM?T5,1@$!`0D```````````(``P`!````X*0$"#0````8IP0``````#0`(``'
XM`"@`&@`9``8````T````-(`$"#2`!`C@````X`````4````$`````P```!0!
XM```4@00(%($$"!4````5````!`````$````!``````````"`!`@`@`0(@(\$
@@ -13619,6 +13619,6 @@ XM```!``````````$````#``````````````!)I@0`S````````````````0``
X%````````
X`
Xend
-END-of-vi.uu
+5f6cb34c34598fc980a32aede89eafe8
exit
diff --git a/test/elfcopy/tc/elfcopy-noops-5/out/elfcopy-noops-5.out.shar b/test/elfcopy/tc/elfcopy-noops-5/out/elfcopy-noops-5.out.shar
index e397a7620ae6..07731b10d3a3 100644
--- a/test/elfcopy/tc/elfcopy-noops-5/out/elfcopy-noops-5.out.shar
+++ b/test/elfcopy/tc/elfcopy-noops-5/out/elfcopy-noops-5.out.shar
@@ -9,8 +9,8 @@
# tcsh.uu
#
echo x - tcsh.new.uu
-sed 's/^X//' >tcsh.new.uu << 'END-of-tcsh.new.uu'
-Xbegin 755 tcsh.new
+sed 's/^X//' >tcsh.new.uu << '3ae563ac759cfb26a3b39b907ea0d291'
+Xbegin 644 tcsh.new
XM?T5,1@$!`0D```````````(``P`!````(*0$"#0```"HVP0``````#0`(``'
XM`"@`&@`9``8````T````-(`$"#2`!`C@````X`````4````$`````P```!0!
XM```4@00(%($$"!4````5````!`````$````!``````````"`!`@`@`0(7)\$
@@ -7093,8 +7093,8 @@ XM!`A$`0``E`0```0`````````!`````0````G````"P````(```#8A00(V`4`
XM```*```%`````0````0````0````+P````,````"````V(\$"-@/```X!0``
XM```````````!`````````#<```#___]O`@```!"5!`@0%0``0`$```0`````
XM`````@````(```!$````_O__;P(```!0E@0(4!8``"`````%`````0````0`
-XM````````4P````D````"````<)8$"'`6```@````!``````````$````"```
-XM`%P````)`````@```)"6!`B0%@``>`0```0````+````!`````@```!E````
+XM````````4P````D```!"````<)8$"'`6```@````!``````````$````"```
+XM`%P````)````0@```)"6!`B0%@``>`0```0````+````!`````@```!E````
XM`0````8````(FP0("!L``!$```````````````0`````````8`````$````&
XM````')L$"!P;````"0`````````````$````!````&L````!````!@```""D
XM!`@@)```W`P$````````````$`````````!Q`````0````8```#\L`@(_#`$
@@ -7112,10 +7112,10 @@ XM`````0`````````!`````P``````````````V=H$`,P```````````````$`
X&````````
X`
Xend
-END-of-tcsh.new.uu
+3ae563ac759cfb26a3b39b907ea0d291
echo x - tcsh.uu
-sed 's/^X//' >tcsh.uu << 'END-of-tcsh.uu'
-Xbegin 755 tcsh
+sed 's/^X//' >tcsh.uu << 'e0b48b8aefb9960c9da54cac18bdcb01'
+Xbegin 644 tcsh
XM?T5,1@$!`0D```````````(``P`!````(*0$"#0```"HVP0``````#0`(``'
XM`"@`&@`9``8````T````-(`$"#2`!`C@````X`````4````$`````P```!0!
XM```4@00(%($$"!4````5````!`````$````!``````````"`!`@`@`0(7)\$
@@ -14217,6 +14217,6 @@ XM`````0`````````!`````P``````````````V=H$`,P```````````````$`
X&````````
X`
Xend
-END-of-tcsh.uu
+e0b48b8aefb9960c9da54cac18bdcb01
exit
diff --git a/test/elfcopy/tc/elfcopy-noops-6/out/elfcopy-noops-6.out.shar b/test/elfcopy/tc/elfcopy-noops-6/out/elfcopy-noops-6.out.shar
index 4bf7a7a553d9..fca78bf34ab0 100644
--- a/test/elfcopy/tc/elfcopy-noops-6/out/elfcopy-noops-6.out.shar
+++ b/test/elfcopy/tc/elfcopy-noops-6/out/elfcopy-noops-6.out.shar
@@ -9,9 +9,9 @@
# mcs.o.uu
#
echo x - mcs.o.1.uu
-sed 's/^X//' >mcs.o.1.uu << 'END-of-mcs.o.1.uu'
+sed 's/^X//' >mcs.o.1.uu << 'f795b6a491de52ced7008ed30e59ba9b'
Xbegin 644 mcs.o.1
-XM?T5,1@$!`0D```````````$``P`!``````````````!\"0```````#0`````
+XM?T5,1@$!`0D```````````$``P`!```````````````P#@```````#0`````
XM`"@`"@`'`````````````````%6)Y8/L&(E4)`3'1"0(`````(D$).C\____
XM,=*%P'0),=*#>"``#Y7"R8G0PXUV`%6)Y8/L&(E4)`3'1"0(`````(D$).C\
XM____,=*%P'0),=*#>!@`#Y7"R8G0PXUV`%6)Y8/L&,=$)`@`````B50D!(D$
@@ -65,47 +65,47 @@ XM;&]C(&9A:6QE9`!R96%L;&]C(&9A:6QE9``N<VAS=')T86(`9V5L9E]G971E
XM:&1R(&9A:6QE9#H@)7,`9V5L9E]F<VEZ92!F86EL960Z("5S`&5L9E]N97AT
XM<V-N(&9A:6QE9#H@)7,``"YS>6UT86(`+G-T<G1A8@`N<VAS=')T86(`+G)E
XM;"YT97AT`"YD871A`"YB<W,`+F-O;6UE;G0`+G)O9&%T82YS='(Q+C$`````
-XM```````````````````````````````````````````````````?`````0``
-XM``8`````````0`````P(`````````````!``````````&P````D`````````
-XM`````!`.``"P`0``"`````$````$````"````"4````!`````P````````!,
-XM"```````````````````!``````````K````"`````,`````````3`@`````
-XM``````````````0`````````,`````$``````````````$P(```P````````
-XM```````!`````````#D````!````,@````````!\"```MP``````````````
-XM`0````$````1`````P``````````````,PD``$@```````````````$`````
-XM`````0````(```````````````P+``#P`0``"0````H````$````$`````D`
-XM```#``````````````#\#```$P$``````````````0``````````````````
-XM`````````````0``````````````!`#Q_P````````````````,``0``````
-XM```````````#``,``````````````````P`$``<`````````+0````(``0`8
-XM````,````"T````"``$`+````&`````V`````@`!``````````````````,`
-XM!@`````````````````#``4`/@``````````````$````$T`````````````
-XM`!````!7````H````&P'```2``$`9```````````````$````'``````````
-XM`````!````!]```````````````0````B0``````````````$````)``````
-XM`````````!````"8```````````````0````H```````````````$````*<`
-XM`````````````!````"N```````````````0````OP``````````````$```
-XM`,H``````````````!````#/```````````````0````U```````````````
-XM$````-P``````````````!````#I```````````````0````]```````````
-XM````$````/X``````````````!`````/`0`````````````0`````&UC<RYC
-XM`&ES7W!R:6YT7W-E8W1I;VX`:7-?8V]M<')E<W-?<V5C=&EO;@!I<U]A<'!E
-XM;F1?<V5C=&EO;@!L;V]K=7!?<V5C7V%C=`!?7W5D:79D:3,`;6-S7W-E8W1I
-XM;VYS`&5L9E]N97AT<V-N`&=E;&9?9V5T<VAD<@!E;&9?9V5T9&%T80!M86QL
-XM;V,`<F5A;&QO8P!S=')N8W!Y`'-T<FQE;@!S=')C;7``9V5L9E]U<&1A=&5?
-XM<VAD<@!E;&9?97)R;7-G`&5R<G@`<'5T<P!P=71C:&%R`&=E;&9?9V5T96AD
-XM<@!G96QF7V9S:7IE`&5L9E]E<G)N;P!G96QF7W5P9&%T95]E:&1R`&5R<@``
-XM%@````(*``!&`````@H``'8````""@``U`````(-``#W`````@X``(,!```"
-XM#@``NP$```(/```4`@```A```)$"```"$0``T`(```(2```N`P```A,``'<#
-XM```"$P``F`,```(4``#3`P```@L```8$```"%0``&@0```(6```B!````0@`
-XM`#($```"%P``<`0```(*``!]!````A,``*,$```"$0``T@0```(2```K!0``
-XM`@X``&0%```"%0``HP4```(8``"K!0```A,``+X%```"&0``TP4```(.``#C
-XM!0```0@``!4&```"&@``9`8```(;``")!@```AD``),&```"'```"@<```(=
-XM```A!P```AP``#P'```!"```2`<```(>``!4!P```A8``%P'```!"```;`<`
-XM``(7``!T!P```0@``(`'```"'@``C`<```(6``"4!P```0@``*0'```"%P``
-XML`<```(6``"X!P```0@``,@'```"%P``T`<```(6``#8!P```0@``.@'```"
-X;%P``\`<```(6``#X!P```0@```@(```"%P``
+XM```````````````````!```````````````$`/'_`````````````````P`!
+XM``````````````````,``P`````````````````#``0`!P`````````M````
+XM`@`!`!@````P````+0````(``0`L````8````#8````"``$`````````````
+XM`````P`&``````````````````,`!0`^```````````````0````30``````
+XM````````$````%<```"@````;`<``!(``0!D```````````````0````<```
+XM````````````$````'T``````````````!````")```````````````0````
+XMD```````````````$````)@``````````````!````"@```````````````0
+XM````IP``````````````$````*X``````````````!````"_````````````
+XM```0````R@``````````````$````,\``````````````!````#4````````
+XM```````0````W```````````````$````.D``````````````!````#T````
+XM```````````0````_@``````````````$`````\!`````````````!``````
+XM;6-S+F,`:7-?<')I;G1?<V5C=&EO;@!I<U]C;VUP<F5S<U]S96-T:6]N`&ES
+XM7V%P<&5N9%]S96-T:6]N`&QO;VMU<%]S96-?86-T`%]?=61I=F1I,P!M8W-?
+XM<V5C=&EO;G,`96QF7VYE>'1S8VX`9V5L9E]G971S:&1R`&5L9E]G971D871A
+XM`&UA;&QO8P!R96%L;&]C`'-T<FYC<'D`<W1R;&5N`'-T<F-M<`!G96QF7W5P
+XM9&%T95]S:&1R`&5L9E]E<G)M<V<`97)R>`!P=71S`'!U=&-H87(`9V5L9E]G
+XM971E:&1R`&=E;&9?9G-I>F4`96QF7V5R<FYO`&=E;&9?=7!D871E7V5H9'(`
+XM97)R```6`````@H``$8````""@``=@````(*``#4`````@T``/<````"#@``
+XM@P$```(.``"[`0```@\``!0"```"$```D0(```(1``#0`@```A(``"X#```"
+XM$P``=P,```(3``"8`P```A0``-,#```""P``!@0```(5```:!````A8``"($
+XM```!"```,@0```(7``!P!````@H``'T$```"$P``HP0```(1``#2!````A(`
+XM`"L%```"#@``9`4```(5``"C!0```A@``*L%```"$P``O@4```(9``#3!0``
+XM`@X``.,%```!"```%08```(:``!D!@```AL``(D&```"&0``DP8```(<```*
+XM!P```AT``"$'```"'```/`<```$(``!(!P```AX``%0'```"%@``7`<```$(
+XM``!L!P```A<``'0'```!"```@`<```(>``",!P```A8``)0'```!"```I`<`
+XM``(7``"P!P```A8``+@'```!"```R`<```(7``#0!P```A8``-@'```!"```
+XMZ`<```(7``#P!P```A8``/@'```!"```"`@```(7````````````````````
+XM````````````````````````````````````'P````$````&`````````$``
+XM```,"``````````````0`````````!L````)````0`````````"`#```L`$`
+XM``@````!````!`````@````E`````0````,`````````3`@`````````````
+XM``````0`````````*P````@````#`````````$P(```````````````````$
+XM`````````#`````!``````````````!,"```,````````````````0``````
+XM```Y`````0```#(`````````?`@``+<```````````````$````!````$0``
+XM``,``````````````#,)``!(```````````````!``````````$````"````
+XM``````````!\"0``\`$```D````*````!````!`````)`````P``````````
+X;````;`L``!,!``````````````$`````````
X`
Xend
-END-of-mcs.o.1.uu
+f795b6a491de52ced7008ed30e59ba9b
echo x - mcs.o.uu
-sed 's/^X//' >mcs.o.uu << 'END-of-mcs.o.uu'
+sed 's/^X//' >mcs.o.uu << '4890727b4c22736e61623154688c0ec6'
Xbegin 644 mcs.o
XM?T5,1@$!`0D```````````$``P`!``````````````!\"0```````#0`````
XM`"@`"@`'`````````````````%6)Y8/L&(E4)`3'1"0(`````(D$).C\____
@@ -199,6 +199,6 @@ XML`<```(6``"X!P```0@``,@'```"%P``T`<```(6``#8!P```0@``.@'```"
X;%P``\`<```(6``#X!P```0@```@(```"%P``
X`
Xend
-END-of-mcs.o.uu
+4890727b4c22736e61623154688c0ec6
exit
diff --git a/test/elfcopy/tc/elfcopy-noops-7/out/elfcopy-noops-7.out.shar b/test/elfcopy/tc/elfcopy-noops-7/out/elfcopy-noops-7.out.shar
index 6d711187a1e0..b936bcc3d407 100644
--- a/test/elfcopy/tc/elfcopy-noops-7/out/elfcopy-noops-7.out.shar
+++ b/test/elfcopy/tc/elfcopy-noops-7/out/elfcopy-noops-7.out.shar
@@ -9,9 +9,9 @@
# sections.o.debug.uu
#
echo x - sections.o.debug.1.uu
-sed 's/^X//' >sections.o.debug.1.uu << 'END-of-sections.o.debug.1.uu'
+sed 's/^X//' >sections.o.debug.1.uu << '7441d94dfba58dda29235b0205ebc7b3'
Xbegin 644 sections.o.debug.1
-XM?T5,1@$!`0D```````````$``P`!``````````````!86@```````#0`````
+XM?T5,1@$!`0D```````````$``P`!``````````````"`=0```````#0`````
XM`"@`&0`6`````````````````%6)Y5:)QE.+2'R)TX7)=#^+0A"+4A0[411R
XM''<%.T$0<A6+24B%R70F.5$4<O2)]G<%.4$0=NN+04R)2TB)0TR+04R)&(U#
XM2(E!3%M>7</'0T@`````BX:`````B4-,BX:`````B1B-0TB)AH````!;7EW#
@@ -525,188 +525,188 @@ XM96)U9U]A8F)R978`+G)E;"YD96)U9U]I;F9O`"YR96PN9&5B=6=?;&EN90`N
XM8V]M;65N=``N<F]D871A+G-T<C$N,0`N<F]D871A+G-T<C$N-``N<F5L+F1E
XM8G5G7V9R86UE`"YD96)U9U]L;V,`+G)E;"YD96)U9U]P=6)N86UE<P`N<F5L
XM+F1E8G5G7V%R86YG97,`+F1E8G5G7W)A;F=E<P`N9&5B=6=?<W1R````````
-XM```````````````````````````````````````````````````?`````0``
-XM``8`````````0````.48`````````````!``````````&P````D`````````
-XM`````-!D``#`!@``%P````$````$````"````"4````!`````P`````````H
-XM&0``````````````````!``````````K````"`````,`````````*!D`````
-XM``````````````0`````````,`````$``````````````"@9```K`P``````
-XM```````!`````````$(````!``````````````!3'```0Q<`````````````
-XM`0`````````^````"0``````````````D&L``,@,```7````!@````0````(
-XM````4@````$``````````````)8S``!T!``````````````!`````````$X`
-XM```)``````````````!8>```"````!<````(````!`````@```!>`````0``
-XM````````````"C@``#````````````````$`````````9P````$````R````
-XM`````#HX``":`@`````````````!`````0```'8````!````,@````````#4
-XM.@``+0``````````````!`````$```")`````0``````````````!#L``.0!
-XM``````````````0`````````A0````D``````````````&!X``#P````%P``
-XM``T````$````"````)8````!``````````````#H/```&Q``````````````
-XM`0````````"E`````0```````````````TT``+L```````````````$`````
-XM````H0````D``````````````%!Y```(````%P```!`````$````"````+D`
-XM```!``````````````"^30``(````````````````0````````"U````"0``
-XM````````````6'D``!`````7````$@````0````(````R`````$`````````
-XM`````-Y-``#(`@`````````````!`````````-8````!````,`````````"F
-XM4```S@@``````````````0````$````1`````P``````````````=%D``.$`
-XM``````````````$``````````0````(``````````````$!>```P!```&```
-XM`!8````$````$`````D````#``````````````!P8@``8`(`````````````
-XM`0```````````````````````````````0``````````````!`#Q_P``````
-XM``````````,``0`````````````````#``,``````````````````P`$````
-XM``````````````,`!0`````````````````#``8``````````````````P`(
-XM``P`````````=`````(``0`````````````````#``L`'P```(`#``!R````
-XM`@`!``````````````````,`#``O````,`P``"T````"``$`0P```&`,```V
-XM`````@`!`%4```"@$```Z`````(``0`````````````````#``T`````````
-XM`````````P`/``````````````````,`$``````````````````#`!(`````
-XM`````````````P`4``````````````````,`%0`````````````````#``H`
-XM8````(````#M`0``$@`!`&T``````````````!````!Z```````````````0
-XM````A@``````````````$````)<``````````````!````"B````````````
-XM```0````L@``````````````$````+H``````````````!````#%````````
-XM```````0````R@```'`"```,`0``$@`!`-8``````````````!````#D````
-XM```````````0````[@``````````````$````/\`````!````P(``!(``0`/
-XM`0`````````````0````&@$`````````````$````"$!`````````````!``
-XM```E`0``$`8``!8!```2``$`+P$`````````````$````#L!```P!P``.0$`
-XM`!(``0!%`0`````````````0````3P$``'`(``#P`0``$@`!`%\!````````
-XM`````!````!E`0``8`H``"@!```2``$`<@$`````````````$````'\!````
-XM`````````!````"*`0``D`L``)<````2``$`F0$`````````````$````*`!
-XM`````````````!````"G`0``H`P``/8#```2``$`L@$`````````````$```
-XM`,(!`````````````!````#4`0`````````````0````X`$`````````````
-XM$````.L!`````````````!````#X`0`````````````0`````@(`````````
-XM````$`````<"`````````````!`````/`@``D!$``%4'```2``$`'`(`````
-XM````````$````"H"`````````````!`````Q`@`````````````0````.`(`
-XM````````````$````$`"`````````````!````!,`@`````````````0````
-XM`'-E8W1I;VYS+F,`:6YS97)T7W1O7W-E8U]L:7-T`&%D9%]T;U]S:'-T<G1A
-XM8@!I<U]C;VUP<F5S<U]S96-T:6]N`&ES7V%P<&5N9%]S96-T:6]N`'!R:6YT
-XM7V1A=&$`<V5T7W-H<W1R=&%B`&=E;&9?9V5T<VAD<@!E;&9?;F5W9&%T80!G
-XM96QF7W5P9&%T95]S:&1R`&5L9E]N9'AS8VX`96QF7W-E='-H<W1R;F1X`&UE
-XM;6UO=F4`96QF7V5R<FUS9P!E<G)X`'5P9&%T95]S:&1R`&QO;VMU<%]S=')I
-XM;F<`96QF7V5R<FYO`&EN<V5R=%]T;U]S=')T86(`861D7W5N;&]A9&%B;&5S
-XM`&5L9E]N97=S8VX`8V%L;&]C`&5R<@!C;W!Y7V1A=&$`96QF7V=E=&1A=&$`
-XM8V]P>5]S:&1R`%]?=61I=F1I,P!R97-Y;F-?<V5C=&EO;G,`=V%R;G@`:6YS
-XM97)T7W-H=&%B`&=E;&9?9V5T96AD<@!G96QF7V9S:7IE`&QO;VMU<%]S96-?
-XM86-T`'-T<F-M<`!M86QL;V,`8W)E871E7W-C;@!E;&9?9V5T<VAS=')N9'@`
-XM861D7W1O7VEN<V5G7VQI<W0`96QF7VYE>'1S8VX`96QF7W-T<G!T<@!?7VES
-XM=&AR96%D960`7U]S=&1O=71P`'!U=&,`7U]S=V)U9@!C;W!Y7V-O;G1E;G0`
-XM8W)E871E7W-Y;71A8@!M96UC<'D`<W1R;&5N`'-T<FYC<'D`9V5L9E]G971R
-XM96P`;&]O:W5P7VME97!?<WEM;&ES=`"=`````A<```D!```"&```.P$```(9
-XM``")`0```AH``)@!```"&P``U`$```(<``#E`0```AT``.T!```!"0``_0$`
-XM``(>```)`@```AT``!$"```!"0``(0(```(>```M`@```AT``#4"```!"0``
-XM10(```(>``!1`@```AT``%D"```!"0``:0(```(>``"1`@```A<``*8"```"
-XM(```TP(```(:``#K`@```AD``/L"```"(0``'`,```(=```D`P```0D``#0#
-XM```"'@``0`,```(=``!(`P```0D``%@#```"'@``8`,```(=``!H`P```0D`
-XM`'@#```"'@``H`,```(B``"T`P```0D``+P#```"(@``Q`,```$)``#,`P``
-XM`B(``-0#```!"0``W`,```(B``#D`P```0D``.P#```"(@``)`0```$)``!*
-XM!````B0``&@$```")0``PP0```(8```8!0```A<``$`%```"&0``9P4```(=
-XM``!O!0```0D``'\%```"'@``AP4```$)``"3!0```B8``)\%```"'0``IP4`
-XM``$)``"W!0```AX``,,%```"'0``RP4```$)``#;!0```AX``.<%```"'0``
-XM[P4```$)``#_!0```AX``#<&```"&```BP8```(H``"6!@```B$``.H&```"
-XM'0``\@8```$)```"!P```AX```H'```"'0``$@<```$)```B!P```AX``$P'
-XM```"%P``9@<```(7``#K!P```AD```4(```"'0``#0@```$)```="````AX`
-XM`"D(```"'0``,0@```$)``!!"````AX``$T(```"'0``50@```$)``!E"```
-XM`AX``.@(```"*@``2PD```(7``!]"0```AD``.T)```"*@``#0H```$+```2
-XM"@```BP``"`*```"'0``*`H```$)```X"@```AX``$0*```"'0``3`H```$)
-XM``!<"@```AX``'D*```"+@``E0H```(E``#L"@```B\``#0+```"'0``/`L`
-XM``$)``!,"P```AX``%@+```"'0``8`L```$)``!P"P```AX``'@+```!"0``
-XMA`L```(>``"Y"P```C$``-P+```",@``%PP```$)```C#````AX``$8,```"
-XM,```=@P```(P``"Y#````B4``,T,```!"0``&@T```(T```V#0```0D``&0-
-XM```")0``N0T```(U``#*#0```B0``.`-```"&@``^`T```$)```)#@```0D`
-XM`"4.```!"0``5`X```(V``!Q#@```A<``)4.```"-P``K0X```$)``#L#@``
-XM`BD``/D.```!"0``-0\```(P``!X#P```0D``)@/```"(0``M@\```(=``"^
-XM#P```0D``,X/```"'@``V@\```(=``#B#P```0D``/(/```"'@``_@\```(=
-XM```&$````0D``!80```"'@``(A````(=```J$````0D``#H0```"'@``0A``
-XM``$)``!.$````B8``%H0```"'0``8A````$)``!R$````AX``'H0```"'0``
-XM@A````$)``"2$````AX``+40```!.```OQ````$Y``#M$````3@``/<0```!
-XM.0``)A$```$Y```V$0```CH``$$1```!.0``4!$```(Z``!J$0```CL``'\1
-XM```".P``SA$```$)``#K$0```CT```P2```!"0``'1(```$)``!J$@```C(`
-XM`)02```"/@``K!(```(H``#($@```C(``/$2```"%P``4A,```(A``"0$P``
-XM`C(``!L4```"/P``-A0```(Q``"'%````B<``*`4```",```[A0```(H``#Y
-XM%````B$```<5```!.```%14```$Y``!E%0```D```+\5```"0```XQ4```(P
-XM``#N%0```C\```86```"0```-!8```(^``!5%@```C```&`6```"/P``=!8`
-XM``$)``"`%@```B8``(46```!.0``E18```(Z``#"%@```CL``/86```"*```
-XM&Q<```)!```[%P```AH``%$7```"-P``:!<```)"``""%P```C(``+07```"
-XM,@``TA<```(=``#:%P```0D``.H7```"'@``\A<```$)``#^%P```B8```H8
-XM```"'0``$A@```$)```B&````AX``"X8```"'0``-A@```$)``!&&````AX`
-XM`$L8```"(0``C1@```(O``#!&````AT``,D8```!"0``V1@```(>```&````
-XM`04```P````!%```$0````$4```5`````10``!D````!`@``'0````$"```A
-XM`````0<``"@````!%```+P````$4```V`````10``#L````!%```2`````$4
-XM``!4`````10``&$````!%```9@````$4``!S`````10``'@````!%```A0``
-XM``$4``",`````10``),````!%```F`````$4``"E`````10``*P````!%```
-XML0````$4``#!`````10``,P````!%```UP````$4``#S`````10``/X````!
-XM%```"0$```$4```5`0```10``",!```!%```.`$```$4``!K`0```10``'D!
-XM```!%```E0$```$4``"C`0```10``+$!```!%```OP$```$4``#-`0```10`
-XM`-L!```!%```]P$```$4```3`@```10``"$"```!%```/0(```$4``!+`@``
-XM`10``-`"```!%```_`(```$4```'`P```10``!(#```!%```-0,```$4``!#
-XM`P```10``%(#```!%```70,```$4``!H`P```10``',#```!%```?@,```$4
-XM``")`P```10``)P#```!%```J@,```$4``"X`P```10``,8#```!%```U`,`
-XM``$4``#B`P```10``/`#```!%```_@,```$4```,!````10``!H$```!%```
-XM*`0```$4```V!````10``$0$```!%```4@0```$4``!A!````10``'0$```!
-XM%```@@0```$4``"0!````10``)X$```!%```K`0```$4``"Z!````10``,@$
-XM```!%```U@0```$4``#D!````10``/($```!%````04```$4```4!0```10`
-XM`"(%```!%```,04```$4``!'!0```10``$T%```!%```6`4```$4``!F!0``
-XM`10``&P%```!%```<@4```$4``!X!0```10``'X%```!%```A`4```$4``"*
-XM!0```10``)`%```!%```E@4```$4``"<!0```10``*(%```!%```J`4```$4
-XM``"N!0```10``+0%```!%```N@4```$4``#`!0```10``,8%```!%```S`4`
-XM``$4``#2!0```10``-@%```!%```W@4```$4``#D!0```10``.H%```!%```
-XM\`4```$4``#W!0```10```H&```!%```&08```$4```E!@```10``#,&```!
-XM%```008```$4``!/!@```10``%T&```!%```:P8```$4``!Y!@```10``(<&
-XM```!%```E08```$4``"P!@```10``+L&```!%```Q@8```$4``#1!@```10`
-XM`.0&```!%```\P8```$4``#_!@```10```T'```!%```*@<```$4```Y!P``
-XM`10``$4'```!%```4P<```$4``!A!P```10``&\'```!%```BP<```$4``"9
-XM!P```10``*<'```!%```M0<```$4``##!P```10``-$'```!%```WP<```$4
-XM``#\!P```10```L(```!%```%P@```$4```E"````10``#,(```!%```00@`
-XM``$4``!>"````10``&P(```!%```>P@```$4``"'"````10``.8(```!%```
-XM]`@```$4```0"0```10``!X)```!%```+`D```$4```Z"0```10``$@)```!
-XM%```:PD```$4``!Y"0```10``(@)```!%```E`D```$4``"B"0```10``+D)
-XM```!%```R`D```$4``#^"0```10```P*```!%```&@H```$4```H"@```10`
-XM`$4*```!%```2PH```$4``!1"@```10``%<*```!%```70H```$4``!L"@``
-XM`10``'H*```!%```EPH```$4``"E"@```10``,(*```!%```T`H```$4``#M
-XM"@```10``/L*```!%```&`L```$4```F"P```10``#T+```!%```2PL```$4
-XM``!B"P```10``'$+```!%```?0L```$4``"+"P```10``)D+```!%```T0L`
-XM``$4``#?"P```10``.T+```!%```^PL```$4```)#````10``!<,```!%```
-XM)0P```$4```S#````10``$$,```!%```3PP```$4``!=#````10``&L,```!
-XM%```>0P```$4``"'#````10``)4,```!%```HPP```$4``"Q#````10``+\,
-XM```!%```S0P```$4``#;#````10``.D,```!%```]PP```$4```-#0```10`
-XM`!0-```!`@``&`T```$"```<#0```1```"\-```!$```/@T```$0``!6#0``
-XM`10``%X-```!`@``8@T```$"``!F#0```1```'H-```!$```B`T```$0``"-
-XM#0```10``)@-```!$```M`T```$4``"\#0```0(``,`-```!`@``Q`T```$0
-XM``#8#0```1```.8-```!$```]`T```$0```)#@```10``!0.```!$```&0X`
-XM``$4```F#@```10``"X.```!`@``,@X```$"```V#@```1```$H.```!$```
-XM3PX```$4``!:#@```1```&@.```!$```;PX```$4``!W#@```0(``'L.```!
-XM`@``?PX```$0``"3#@```1```*(.```!$```IPX```$4``"R#@```1```,L.
-XM```!$```V@X```$0``#Q#@```10``/D.```!`@``_0X```$"```!#P```1``
-XM`!,/```!$```(@\```$0```Q#P```1```#8/```!%```00\```$0``!(#P``
-XM`10``%`/```!`@``5`\```$"``!8#P```1```&P/```!$```>P\```$0``"*
-XM#P```1```(\/```!%```F@\```$0``#!#P```10``,D/```!`@``S0\```$"
-XM``#1#P```1```.4/```!$```\P\```$0```3$````1```!H0```!%```)1``
-XM``$"```I$````0(``"T0```!$```0!````$0``!.$````1```%,0```!%```
-XM7A````$0``!S$````10``'X0```!$```A1````$4``"0$````0(``)00```!
-XM`@``F!````$0``"K$````1```+`0```!%```NA````$0``#)$````1```-@0
-XM```!$```WA````$4``#I$````0(``.T0```!`@``\1````$0```$$0```1``
-XM``D1```!%```$Q$```$0```B$0```1```"@1```!%```,Q$```$"```W$0``
-XM`0(``#L1```!$```3A$```$0``!3$0```10``%T1```!$```;!$```$0``!R
-XM$0```10``(X1```!%```J!$```$4``"O$0```0(``+,1```!`@``MQ$```$0
-XM``#*$0```1```-<1```!$```W!$```$4``#F$0```1```/01```!$```"!(`
-XM``$4```2$@```1```!<2```!%```(1(```$0```J$@```1,``#L2```!`@``
-XM/Q(```$"``!($@```1```%`2```!%```?Q(```$4``"'$@```0(``(L2```!
-XM`@``CQ(```$0``"A$@```1```+`2```!$```OA(```$0``#'$@```1,``-<2
-XM```!$```YA(```$3``#R$@```1```/L2```!$````A,```$4```P$P```10`
-XM`%03```!%```8!,```$4``!W$P```10``(T3```!%```LA,```$4``#.$P``
-XM`10``-H3```!%```"A0```$4```6%````10``&X4```!%```>Q0```$4``"7
-XM%````10``,,4```!%```UA0```$4``#R%````10```D5```!%```+!4```$4
-XM```Z%0```10``$(5```!`@``1A4```$"``!*%0```1```%X5```!$```=14`
-XM``$3``"+%0```1,``)05```!$```G14```$0``"W%0```1```-(5```!$```
-XM[!4```$3``#\%0```1````L6```!$P``(18```$3```J%@```1```#,6```!
-XM$```1A8```$0``!4%@```1```%T6```!$```>18```$3``"+%@```1,``)06
-XM```!$```IQ8```$0``"T%@```0(``+@6```!`@``SA8```$"``#2%@```0(`
-XM`-L6```!$```YA8```$3``#S%@```1,``/P6```!$```!1<```$0```.%P``
-XM`1,``!H7```!$```*!<```$4```U%P```10``,4````!`@``&`````$/```<
-XM`````0(``#@````!#P``/`````$"``!8`````0\``%P````!`@``>`````$/
-XM``!\`````0(``)@````!#P``G`````$"``"X`````0\``+P````!`@``V```
-XM``$/``#<`````0(``/@````!#P``_`````$"```8`0```0\``!P!```!`@``
-XM.`$```$/```\`0```0(``%@!```!#P``7`$```$"``!P`0```0\``'0!```!
-XM`@``B`$```$/``",`0```0(``*@!```!#P``K`$```$"``#(`0```0\``,P!
-X>```!`@``!@````$&```&`````08``!`````!`@``
+XM```````````````````!```````````````$`/'_`````````````````P`!
+XM``````````````````,``P`````````````````#``0`````````````````
+XM`P`%``````````````````,`!@`````````````````#``@`#`````````!T
+XM`````@`!``````````````````,`"P`?````@`,``'(````"``$`````````
+XM`````````P`,`"\````P#```+0````(``0!#````8`P``#8````"``$`50``
+XM`*`0``#H`````@`!``````````````````,`#0`````````````````#``\`
+XM`````````````````P`0``````````````````,`$@`````````````````#
+XM`!0``````````````````P`5``````````````````,`"@!@````@````.T!
+XM```2``$`;0``````````````$````'H``````````````!````"&````````
+XM```````0````EP``````````````$````*(``````````````!````"R````
+XM```````````0````N@``````````````$````,4``````````````!````#*
+XM````<`(```P!```2``$`U@``````````````$````.0``````````````!``
+XM``#N```````````````0````_P`````$```#`@``$@`!``\!````````````
+XM`!`````:`0`````````````0````(0$`````````````$````"4!```0!@``
+XM%@$``!(``0`O`0`````````````0````.P$``#`'```Y`0``$@`!`$4!````
+XM`````````!````!/`0``<`@``/`!```2``$`7P$`````````````$````&4!
+XM``!@"@``*`$``!(``0!R`0`````````````0````?P$`````````````$```
+XM`(H!``"0"P``EP```!(``0"9`0`````````````0````H`$`````````````
+XM$````*<!``"@#```]@,``!(``0"R`0`````````````0````P@$`````````
+XM````$````-0!`````````````!````#@`0`````````````0````ZP$`````
+XM````````$````/@!`````````````!`````"`@`````````````0````!P(`
+XM````````````$`````\"``"0$0``50<``!(``0`<`@`````````````0````
+XM*@(`````````````$````#$"`````````````!`````X`@`````````````0
+XM````0`(`````````````$````$P"`````````````!``````<V5C=&EO;G,N
+XM8P!I;G-E<G1?=&]?<V5C7VQI<W0`861D7W1O7W-H<W1R=&%B`&ES7V-O;7!R
+XM97-S7W-E8W1I;VX`:7-?87!P96YD7W-E8W1I;VX`<')I;G1?9&%T80!S971?
+XM<VAS=')T86(`9V5L9E]G971S:&1R`&5L9E]N97=D871A`&=E;&9?=7!D871E
+XM7W-H9'(`96QF7VYD>'-C;@!E;&9?<V5T<VAS=')N9'@`;65M;6]V90!E;&9?
+XM97)R;7-G`&5R<G@`=7!D871E7W-H9'(`;&]O:W5P7W-T<FEN9P!E;&9?97)R
+XM;F\`:6YS97)T7W1O7W-T<G1A8@!A9&1?=6YL;V%D86)L97,`96QF7VYE=W-C
+XM;@!C86QL;V,`97)R`&-O<'E?9&%T80!E;&9?9V5T9&%T80!C;W!Y7W-H9'(`
+XM7U]U9&EV9&DS`')E<WEN8U]S96-T:6]N<P!W87)N>`!I;G-E<G1?<VAT86(`
+XM9V5L9E]G971E:&1R`&=E;&9?9G-I>F4`;&]O:W5P7W-E8U]A8W0`<W1R8VUP
+XM`&UA;&QO8P!C<F5A=&5?<V-N`&5L9E]G971S:'-T<FYD>`!A9&1?=&]?:6YS
+XM96=?;&ES=`!E;&9?;F5X='-C;@!E;&9?<W1R<'1R`%]?:7-T:')E861E9`!?
+XM7W-T9&]U='``<'5T8P!?7W-W8G5F`&-O<'E?8V]N=&5N=`!C<F5A=&5?<WEM
+XM=&%B`&UE;6-P>0!S=')L96X`<W1R;F-P>0!G96QF7V=E=')E;`!L;V]K=7!?
+XM:V5E<%]S>6UL:7-T`)T````"%P``"0$```(8```[`0```AD``(D!```"&@``
+XMF`$```(;``#4`0```AP``.4!```"'0``[0$```$)``#]`0```AX```D"```"
+XM'0``$0(```$)```A`@```AX``"T"```"'0``-0(```$)``!%`@```AX``%$"
+XM```"'0``60(```$)``!I`@```AX``)$"```"%P``I@(```(@``#3`@```AH`
+XM`.L"```"&0``^P(```(A```<`P```AT``"0#```!"0``-`,```(>``!``P``
+XM`AT``$@#```!"0``6`,```(>``!@`P```AT``&@#```!"0``>`,```(>``"@
+XM`P```B(``+0#```!"0``O`,```(B``#$`P```0D``,P#```"(@``U`,```$)
+XM``#<`P```B(``.0#```!"0``[`,```(B```D!````0D``$H$```")```:`0`
+XM``(E``##!````A@``!@%```"%P``0`4```(9``!G!0```AT``&\%```!"0``
+XM?P4```(>``"'!0```0D``),%```")@``GP4```(=``"G!0```0D``+<%```"
+XM'@``PP4```(=``#+!0```0D``-L%```"'@``YP4```(=``#O!0```0D``/\%
+XM```"'@``-P8```(8``"+!@```B@``)8&```"(0``Z@8```(=``#R!@```0D`
+XM``('```"'@``"@<```(=```2!P```0D``"('```"'@``3`<```(7``!F!P``
+XM`A<``.L'```"&0``!0@```(=```-"````0D``!T(```"'@``*0@```(=```Q
+XM"````0D``$$(```"'@``30@```(=``!5"````0D``&4(```"'@``Z`@```(J
+XM``!+"0```A<``'T)```"&0``[0D```(J```-"@```0L``!(*```"+```(`H`
+XM``(=```H"@```0D``#@*```"'@``1`H```(=``!,"@```0D``%P*```"'@``
+XM>0H```(N``"5"@```B4``.P*```"+P``-`L```(=```\"P```0D``$P+```"
+XM'@``6`L```(=``!@"P```0D``'`+```"'@``>`L```$)``"$"P```AX``+D+
+XM```",0``W`L```(R```7#````0D``",,```"'@``1@P```(P``!V#````C``
+XM`+D,```")0``S0P```$)```:#0```C0``#8-```!"0``9`T```(E``"Y#0``
+XM`C4``,H-```")```X`T```(:``#X#0```0D```D.```!"0``)0X```$)``!4
+XM#@```C8``'$.```"%P``E0X```(W``"M#@```0D``.P.```"*0``^0X```$)
+XM```U#P```C```'@/```!"0``F`\```(A``"V#P```AT``+X/```!"0``S@\`
+XM``(>``#:#P```AT``.(/```!"0``\@\```(>``#^#P```AT```80```!"0``
+XM%A````(>```B$````AT``"H0```!"0``.A````(>``!"$````0D``$X0```"
+XM)@``6A````(=``!B$````0D``'(0```"'@``>A````(=``""$````0D``)(0
+XM```"'@``M1````$X``"_$````3D``.T0```!.```]Q````$Y```F$0```3D`
+XM`#81```".@``01$```$Y``!0$0```CH``&H1```".P``?Q$```([``#.$0``
+XM`0D``.L1```"/0``#!(```$)```=$@```0D``&H2```",@``E!(```(^``"L
+XM$@```B@``,@2```",@``\1(```(7``!2$P```B$``)`3```",@``&Q0```(_
+XM```V%````C$``(<4```")P``H!0```(P``#N%````B@``/D4```"(0``!Q4`
+XM``$X```5%0```3D``&45```"0```OQ4```)```#C%0```C```.X5```"/P``
+XM!A8```)````T%@```CX``%46```",```8!8```(_``!T%@```0D``(`6```"
+XM)@``A18```$Y``"5%@```CH``,(6```".P``]A8```(H```;%P```D$``#L7
+XM```"&@``41<```(W``!H%P```D(``((7```",@``M!<```(R``#2%P```AT`
+XM`-H7```!"0``ZA<```(>``#R%P```0D``/X7```")@``"A@```(=```2&```
+XM`0D``"(8```"'@``+A@```(=```V&````0D``$88```"'@``2Q@```(A``"-
+XM&````B\``,$8```"'0``R1@```$)``#9&````AX```8````!!0``#`````$4
+XM```1`````10``!4````!%```&0````$"```=`````0(``"$````!!P``*```
+XM``$4```O`````10``#8````!%```.P````$4``!(`````10``%0````!%```
+XM80````$4``!F`````10``',````!%```>`````$4``"%`````10``(P````!
+XM%```DP````$4``"8`````10``*4````!%```K`````$4``"Q`````10``,$`
+XM```!%```S`````$4``#7`````10``/,````!%```_@````$4```)`0```10`
+XM`!4!```!%```(P$```$4```X`0```10``&L!```!%```>0$```$4``"5`0``
+XM`10``*,!```!%```L0$```$4``"_`0```10``,T!```!%```VP$```$4``#W
+XM`0```10``!,"```!%```(0(```$4```]`@```10``$L"```!%```T`(```$4
+XM``#\`@```10```<#```!%```$@,```$4```U`P```10``$,#```!%```4@,`
+XM``$4``!=`P```10``&@#```!%```<P,```$4``!^`P```10``(D#```!%```
+XMG`,```$4``"J`P```10``+@#```!%```Q@,```$4``#4`P```10``.(#```!
+XM%```\`,```$4``#^`P```10```P$```!%```&@0```$4```H!````10``#8$
+XM```!%```1`0```$4``!2!````10``&$$```!%```=`0```$4``""!````10`
+XM`)`$```!%```G@0```$4``"L!````10``+H$```!%```R`0```$4``#6!```
+XM`10``.0$```!%```\@0```$4```!!0```10``!0%```!%```(@4```$4```Q
+XM!0```10``$<%```!%```304```$4``!8!0```10``&8%```!%```;`4```$4
+XM``!R!0```10``'@%```!%```?@4```$4``"$!0```10``(H%```!%```D`4`
+XM``$4``"6!0```10``)P%```!%```H@4```$4``"H!0```10``*X%```!%```
+XMM`4```$4``"Z!0```10``,`%```!%```Q@4```$4``#,!0```10``-(%```!
+XM%```V`4```$4``#>!0```10``.0%```!%```Z@4```$4``#P!0```10``/<%
+XM```!%```"@8```$4```9!@```10``"4&```!%```,P8```$4``!!!@```10`
+XM`$\&```!%```708```$4``!K!@```10``'D&```!%```AP8```$4``"5!@``
+XM`10``+`&```!%```NP8```$4``#&!@```10``-$&```!%```Y`8```$4``#S
+XM!@```10``/\&```!%```#0<```$4```J!P```10``#D'```!%```10<```$4
+XM``!3!P```10``&$'```!%```;P<```$4``"+!P```10``)D'```!%```IP<`
+XM``$4``"U!P```10``,,'```!%```T0<```$4``#?!P```10``/P'```!%```
+XM"P@```$4```7"````10``"4(```!%```,P@```$4``!!"````10``%X(```!
+XM%```;`@```$4``!["````10``(<(```!%```Y@@```$4``#T"````10``!`)
+XM```!%```'@D```$4```L"0```10``#H)```!%```2`D```$4``!K"0```10`
+XM`'D)```!%```B`D```$4``"4"0```10``*()```!%```N0D```$4``#("0``
+XM`10``/X)```!%```#`H```$4```:"@```10``"@*```!%```10H```$4``!+
+XM"@```10``%$*```!%```5PH```$4``!="@```10``&P*```!%```>@H```$4
+XM``"7"@```10``*4*```!%```P@H```$4``#0"@```10``.T*```!%```^PH`
+XM``$4```8"P```10``"8+```!%```/0L```$4``!+"P```10``&(+```!%```
+XM<0L```$4``!]"P```10``(L+```!%```F0L```$4``#1"P```10``-\+```!
+XM%```[0L```$4``#["P```10```D,```!%```%PP```$4```E#````10``#,,
+XM```!%```00P```$4``!/#````10``%T,```!%```:PP```$4``!Y#````10`
+XM`(<,```!%```E0P```$4``"C#````10``+$,```!%```OPP```$4``#-#```
+XM`10``-L,```!%```Z0P```$4``#W#````10```T-```!%```%`T```$"```8
+XM#0```0(``!P-```!$```+PT```$0```^#0```1```%8-```!%```7@T```$"
+XM``!B#0```0(``&8-```!$```>@T```$0``"(#0```1```(T-```!%```F`T`
+XM``$0``"T#0```10``+P-```!`@``P`T```$"``#$#0```1```-@-```!$```
+XMY@T```$0``#T#0```1````D.```!%```%`X```$0```9#@```10``"8.```!
+XM%```+@X```$"```R#@```0(``#8.```!$```2@X```$0``!/#@```10``%H.
+XM```!$```:`X```$0``!O#@```10``'<.```!`@``>PX```$"``!_#@```1``
+XM`),.```!$```H@X```$0``"G#@```10``+(.```!$```RPX```$0``#:#@``
+XM`1```/$.```!%```^0X```$"``#]#@```0(```$/```!$```$P\```$0```B
+XM#P```1```#$/```!$```-@\```$4``!!#P```1```$@/```!%```4`\```$"
+XM``!4#P```0(``%@/```!$```;`\```$0``![#P```1```(H/```!$```CP\`
+XM``$4``":#P```1```,$/```!%```R0\```$"``#-#P```0(``-$/```!$```
+XMY0\```$0``#S#P```1```!,0```!$```&A````$4```E$````0(``"D0```!
+XM`@``+1````$0``!`$````1```$X0```!$```4Q````$4``!>$````1```',0
+XM```!%```?A````$0``"%$````10``)`0```!`@``E!````$"``"8$````1``
+XM`*L0```!$```L!````$4``"Z$````1```,D0```!$```V!````$0``#>$```
+XM`10``.D0```!`@``[1````$"``#Q$````1````01```!$```"1$```$4```3
+XM$0```1```"(1```!$```*!$```$4```S$0```0(``#<1```!`@``.Q$```$0
+XM``!.$0```1```%,1```!%```71$```$0``!L$0```1```'(1```!%```CA$`
+XM``$4``"H$0```10``*\1```!`@``LQ$```$"``"W$0```1```,H1```!$```
+XMUQ$```$0``#<$0```10``.81```!$```]!$```$0```($@```10``!(2```!
+XM$```%Q(```$4```A$@```1```"H2```!$P``.Q(```$"```_$@```0(``$@2
+XM```!$```4!(```$4``!_$@```10``(<2```!`@``BQ(```$"``"/$@```1``
+XM`*$2```!$```L!(```$0``"^$@```1```,<2```!$P``UQ(```$0``#F$@``
+XM`1,``/(2```!$```^Q(```$0```"$P```10``#`3```!%```5!,```$4``!@
+XM$P```10``'<3```!%```C1,```$4``"R$P```10``,X3```!%```VA,```$4
+XM```*%````10``!84```!%```;A0```$4``![%````10``)<4```!%```PQ0`
+XM``$4``#6%````10``/(4```!%```"14```$4```L%0```10``#H5```!%```
+XM0A4```$"``!&%0```0(``$H5```!$```7A4```$0``!U%0```1,``(L5```!
+XM$P``E!4```$0``"=%0```1```+<5```!$```TA4```$0``#L%0```1,``/P5
+XM```!$```"Q8```$3```A%@```1,``"H6```!$```,Q8```$0``!&%@```1``
+XM`%06```!$```718```$0``!Y%@```1,``(L6```!$P``E!8```$0``"G%@``
+XM`1```+06```!`@``N!8```$"``#.%@```0(``-(6```!`@``VQ8```$0``#F
+XM%@```1,``/,6```!$P``_!8```$0```%%P```1````X7```!$P``&A<```$0
+XM```H%P```10``#47```!%```Q0````$"```8`````0\``!P````!`@``.```
+XM``$/```\`````0(``%@````!#P``7`````$"``!X`````0\``'P````!`@``
+XMF`````$/``"<`````0(``+@````!#P``O`````$"``#8`````0\``-P````!
+XM`@``^`````$/``#\`````0(``!@!```!#P``'`$```$"```X`0```0\``#P!
+XM```!`@``6`$```$/``!<`0```0(``'`!```!#P``=`$```$"``"(`0```0\`
+XM`(P!```!`@``J`$```$/``"L`0```0(``,@!```!#P``S`$```$"```&````
+XM`08```8````!!@``$`````$"````````````````````````````````````
+XM````````````````````'P````$````&`````````$````#E&```````````
+XM```0`````````!L````)````0`````````#H8```P`8``!<````!````!```
+XM``@````E`````0````,`````````*!D```````````````````0`````````
+XM*P````@````#`````````"@9```````````````````$`````````#`````!
+XM```````````````H&0``*P,``````````````0````````!"`````0``````
+XM````````4QP``$,7``````````````$`````````/@````D```!`````````
+XM`*AG``#(#```%P````8````$````"````%(````!``````````````"6,P``
+XM=`0``````````````0````````!.````"0```$``````````<'0```@````7
+XM````"`````0````(````7@````$```````````````HX```P````````````
+XM```!`````````&<````!````,@`````````Z.```F@(``````````````0``
+XM``$```!V`````0```#(`````````U#H``"T```````````````0````!````
+XMB0````$```````````````0[``#D`0`````````````$`````````(4````)
+XM````0`````````!X=```\````!<````-````!`````@```"6`````0``````
+XM````````Z#P``!L0``````````````$`````````I0````$`````````````
+XM``--``"[```````````````!`````````*$````)````0`````````!H=0``
+XM"````!<````0````!`````@```"Y`````0``````````````ODT``"``````
+XM``````````$`````````M0````D```!``````````'!U```0````%P```!(`
+XM```$````"````,@````!``````````````#>30``R`(``````````````0``
+XM``````#6`````0```#``````````IE```,X(``````````````$````!````
+XM$0````,``````````````'19``#A```````````````!``````````$````"
+XM``````````````!86@``,`0``!@````6````!````!`````)`````P``````
+X>````````B%X``&`"``````````````$`````````
X`
Xend
-END-of-sections.o.debug.1.uu
+7441d94dfba58dda29235b0205ebc7b3
echo x - sections.o.debug.uu
-sed 's/^X//' >sections.o.debug.uu << 'END-of-sections.o.debug.uu'
+sed 's/^X//' >sections.o.debug.uu << '07454e9209d1c5eccb83c5c72e752a37'
Xbegin 644 sections.o.debug
XM?T5,1@$!`0D```````````$``P`!``````````````!86@```````#0`````
XM`"@`&0`6`````````````````%6)Y5:)QE.+2'R)TX7)=#^+0A"+4A0[411R
@@ -1401,6 +1401,6 @@ XM`@``B`$```$/``",`0```0(``*@!```!#P``K`$```$"``#(`0```0\``,P!
X>```!`@``!@````$&```&`````08``!`````!`@``
X`
Xend
-END-of-sections.o.debug.uu
+07454e9209d1c5eccb83c5c72e752a37
exit
diff --git a/test/elfcopy/tc/elfcopy-noops-archive-1/out/elfcopy-noops-archive-1.out.shar b/test/elfcopy/tc/elfcopy-noops-archive-1/out/elfcopy-noops-archive-1.out.shar
index d1449fe14d6c..445b715cca3e 100644
--- a/test/elfcopy/tc/elfcopy-noops-archive-1/out/elfcopy-noops-archive-1.out.shar
+++ b/test/elfcopy/tc/elfcopy-noops-archive-1/out/elfcopy-noops-archive-1.out.shar
@@ -11,87 +11,87 @@
echo x - liba.a.1.uu
sed 's/^X//' >liba.a.1.uu << 'b253f047a1631a2a184043b6f45926f7'
Xbegin 644 liba.a.1
-XM(3QA<F-H/@HO("`@("`@("`@("`@("`@,3(S,34S,3DQ,B`@,"`@("`@,"`@
+XM(3QA<F-H/@HO("`@("`@("`@("`@("`@,30U,S`T-C(Q,R`@,"`@("`@,"`@
XM("`@,"`@("`@("`Q,#`@("`@("`@8`H````*````J````*@```.L```#K```
XM!R@```<H```'*```"F0```ID```*9'-U;6UU;`!A`&US9P!P<FEN=&US9P!S
XM=6)S=')A8W0`>`!Y`&US9S$`;7-G,@!O=71P=71M<V<`83$N;R\@("`@("`@
-XM("`@(#$R,S$U,S$Y,3(@(#$P,#$@(#`@("`@(#$P,#8T-"`@-S$R("`@("`@
-XM(&`*?T5,1@$!`0D```````````$``P`!``````````````#``````````#0`
+XM("`@(#$Q.30U,#DS-#D@(#$P,#$@(#`@("`@(#$P,#8T-"`@-S$R("`@("`@
+XM(&`*?T5,1@$!`0D```````````$``P`!``````````````!@`0```````#0`
XM`````"@`"0`&`````````````````%6)Y<<%``````4```"+10R+50@!PJ$`
XM````#Z_"7<,``$=#0SH@*$=.52D@-"XR+C$@,C`P-S`W,3D@(%M&<F5E0E-$
XM70``+G-Y;71A8@`N<W1R=&%B`"YS:'-T<G1A8@`N<F5L+G1E>'0`+F1A=&$`
-XM+F)S<P`N8V]M;65N=```````````````````````````````````````````
-XM`````````````!\````!````!@````````!`````'P``````````````$```
-XM```````;````"0``````````````N`(``!`````'`````0````0````(````
-XM)0````$````#`````````&`````````````````````$`````````"L````(
-XM`````P````````!@````````````````````!``````````P`````0``````
-XM````````8````"8```````````````$`````````$0````,`````````````
-XM`(8````Y```````````````!``````````$````"```````````````H`@``
-XM@`````@````&````!````!`````)`````P``````````````J`(```\`````
-XM``````````$```````````````````````````````$```````````````0`
+XM+F)S<P`N8V]M;65N=`````````````````````````$```````````````0`
XM\?\````````````````#``$``````````````````P`#````````````````
XM``,`!``````````````````#``4`!@`````````?````$@`!``T````$````
-XM!````!$`\O\`83$N8P!S=6UM=6P`80``!0````$'```6`````0<``&$R+F\O
-XM("`@("`@("`@("`Q,C,Q-3,Q.3$R("`Q,#`Q("`P("`@("`Q,#`V-#0@(#@S
-XM,B`@("`@("!@"G]%3$8!`0$)```````````!``,``0``````````````W```
+XM!````!$`\O\`83$N8P!S=6UM=6P`80``!0````$'```6`````0<`````````
+XM```````````````````````````````````````````````?`````0````8`
+XM````````0````!\``````````````!``````````&P````D```!`````````
+XM`%`!```0````!P````$````$````"````"4````!`````P````````!@````
+XM````````````````!``````````K````"`````,`````````8```````````
+XM``````````0`````````,`````$``````````````&`````F````````````
+XM```!`````````!$````#``````````````"&````.0```````````````0``
+XM```````!`````@``````````````P````(`````(````!@````0````0````
+XM"0````,``````````````$`!```/```````````````!`````````&$R+F\O
+XM("`@("`@("`@("`Q,3DT-3`Y,S0Y("`Q,#`Q("`P("`@("`Q,#`V-#0@(#@S
+XM,B`@("`@("!@"G]%3$8!`0$)```````````!``,``0``````````````L`$`
XM```````T```````H``H`!P````````````````!5B>6#[`C'1"0$`````,<$
XM)`````#H_/___\G#:&5L;&\L('=O<FQD`````&US9SH@)7,*``!'0T,Z("A'
XM3E4I(#0N,BXQ(#(P,#<P-S$Y("!;1G)E94)31%T``"YS>6UT86(`+G-T<G1A
XM8@`N<VAS=')T86(`+G)E;"YT97AT`"YD871A`"YB<W,`+G)O9&%T80`N8V]M
-XM;65N=```````````````````````````````````````````````````````
-XM'P````$````&`````````$`````<```````````````0`````````!L````)
-XM```````````````H`P``&`````@````!````!`````@````E`````0````,`
-XM````````7`````T```````````````0`````````*P````@````#````````
-XM`&P````````````````````$`````````#`````!`````@````````!L````
-XM"0```````````````0`````````X`````0``````````````=0```"8`````
-XM``````````$`````````$0````,``````````````)L```!!````````````
-XM```!``````````$````"``````````````!L`@``H`````D````'````!```
-XM`!`````)`````P``````````````#`,``!H```````````````$`````````
-XM``````````````````````$```````````````0`\?\````````````````#
-XM``$``````````````````P`#``````````````````,`!```````````````
-XM```#``4``````````````````P`&``8`````````#0```!$``P`*````````
-XM`!P````2``$`$P``````````````$`````!A,BYC`&US9P!P<FEN=&US9P!P
-XM<FEN=&8````*`````0<``!$````!!0``%@````()``!A,RYO+R`@("`@("`@
-XM("`@,3(S,34S,3DQ,B`@,3`P,2`@,"`@("`@,3`P-C0T("`W-C@@("`@("`@
-XM8`I_14Q&`0$!"0```````````0`#``$``````````````-0`````````-```
+XM;65N=````````````````````````0``````````````!`#Q_P``````````
+XM``````,``0`````````````````#``,``````````````````P`$````````
+XM``````````,`!0`````````````````#``8`!@`````````-````$0`#``H`
+XM````````'````!(``0`3```````````````0`````&$R+F,`;7-G`'!R:6YT
+XM;7-G`'!R:6YT9@````H````!!P``$0````$%```6`````@D`````````````
+XM```````````````````````````````````````````?`````0````8`````
+XM````0````!P``````````````!``````````&P````D```!``````````)@!
+XM```8````"`````$````$````"````"4````!`````P````````!<````#0``
+XM````````````!``````````K````"`````,`````````;```````````````
+XM``````0`````````,`````$````"`````````&P````)```````````````!
+XM`````````#@````!``````````````!U````)@```````````````0``````
+XM```1`````P``````````````FP```$$```````````````$``````````0``
+XM``(``````````````-P```"@````"0````<````$````$`````D````#````
+XM``````````!\`0``&@```````````````0````````!A,RYO+R`@("`@("`@
+XM("`@,3$Y-#4P.3,T.2`@,3`P,2`@,"`@("`@,3`P-C0T("`W-C@@("`@("`@
+XM8`I_14Q&`0$!"0```````````0`#``$``````````````)@!````````-```
XM````*``)``8`````````````````58GEQP4``````0```,<%``````(```"+
XM%0````"+10B)P2G1B<JA`````(G1*<&)R%W#``!'0T,Z("A'3E4I(#0N,BXQ
XM(#(P,#<P-S$Y("!;1G)E94)31%T``"YS>6UT86(`+G-T<G1A8@`N<VAS=')T
XM86(`+G)E;"YT97AT`"YD871A`"YB<W,`+F-O;6UE;G0`````````````````
-XM```````````````````````````````````````?`````0````8`````````
-XM0````#,``````````````!``````````&P````D``````````````.`"```@
-XM````!P````$````$````"````"4````!`````P````````!T````````````
-XM````````!``````````K````"`````,`````````=```````````````````
-XM``0`````````,`````$``````````````'0````F```````````````!````
-XM`````!$````#``````````````":````.0```````````````0`````````!
-XM`````@``````````````/`(``)`````(````!@````0````0````"0````,`
-XM`````````````,P"```4```````````````!````````````````````````
XM```````!```````````````$`/'_`````````````````P`!````````````
XM``````,``P`````````````````#``0``````````````````P`%``8`````
XM````,P```!(``0`0````!`````0````1`/+_$@````0````$````$0#R_P!A
XM,RYC`'-U8G-T<F%C=`!X`'D`!0````$'```/`````0@``!D````!!P``)P``
-XM``$(``!A-"YO+R`@("`@("`@("`@,3(S,34S,3DQ,B`@,3`P,2`@,"`@("`@
+XM``$(````````````````````````````````````````````````````````
+XM'P````$````&`````````$`````S```````````````0`````````!L````)
+XM````0`````````!X`0``(`````<````!````!`````@````E`````0````,`
+XM````````=`````````````````````0`````````*P````@````#````````
+XM`'0````````````````````$`````````#`````!``````````````!T````
+XM)@```````````````0`````````1`````P``````````````F@```#D`````
+XM``````````$``````````0````(``````````````-0```"0````"`````8`
+XM```$````$`````D````#``````````````!D`0``%````````````````0``
+XM``````!A-"YO+R`@("`@("`@("`@,3$Y-#4P.3,T.2`@,3`P,2`@,"`@("`@
XM,3`P-C0T("`X.#@@("`@("`@8`I_14Q&`0$!"0```````````0`#``$`````
-XM`````````/0`````````-```````*``*``<`````````````````58GE@^P8
+XM`````````.@!````````-```````*``*``<`````````````````58GE@^P8
XMQT0D"`````#'1"0$`````,<$)`````#H_/___\G#;65S<V%G93$`;65S<V%G
XM93(```!M<V<Q(#T@)7,*;7-G,B`]("5S"@``1T-#.B`H1TY5*2`T+C(N,2`R
XM,#`W,#<Q.2`@6T9R965"4T1=```N<WEM=&%B`"YS=')T86(`+G-H<W1R=&%B
XM`"YR96PN=&5X=``N9&%T80`N8G-S`"YR;V1A=&$`+F-O;6UE;G0`````````
-XM`````````````````````````````````````````````!\````!````!@``
-XM``````!`````)```````````````$``````````;````"0``````````````
-XM6`,``"`````(`````0````0````(````)0````$````#`````````&0````2
-XM```````````````$`````````"L````(`````P````````!X````````````
-XM````````!``````````P`````0````(`````````>````!4`````````````
-XM``$`````````.`````$``````````````(T````F```````````````!````
-XM`````!$````#``````````````"S````00```````````````0`````````!
-XM`````@``````````````A`(``+`````)````!P````0````0````"0````,`
-XM`````````````#0#```A```````````````!````````````````````````
-XM```````!```````````````$`/'_`````````````````P`!````````````
-XM``````,``P`````````````````#``0``````````````````P`%````````
-XM``````````,`!@`&``````````D````1``,`"P````D````)````$0`#`!``
-XM````````)````!(``0`:```````````````0`````&$T+F,`;7-G,0!M<V<R
-XM`&]U='!U=&US9P!P<FEN=&8`````"@````$(```2`````0<``!D````!!0``
-X('@````(*````
+XM``````````````$```````````````0`\?\````````````````#``$`````
+XM`````````````P`#``````````````````,`!``````````````````#``4`
+XM`````````````````P`&``8`````````"0```!$``P`+````"0````D````1
+XM``,`$``````````D````$@`!`!H``````````````!``````830N8P!M<V<Q
+XM`&US9S(`;W5T<'5T;7-G`'!R:6YT9@`````*`````0@``!(````!!P``&0``
+XM``$%```>`````@H`````````````````````````````````````````````
+XM```````````?`````0````8`````````0````"0``````````````!``````
+XM````&P````D```!``````````,@!```@````"`````$````$````"````"4`
+XM```!`````P````````!D````$@``````````````!``````````K````"```
+XM``,`````````>`````````````````````0`````````,`````$````"````
+XM`````'@````5```````````````!`````````#@````!``````````````"-
+XM````)@```````````````0`````````1`````P``````````````LP```$$`
+XM``````````````$``````````0````(``````````````/0```"P````"0``
+XM``<````$````$`````D````#``````````````"D`0``(0``````````````
+X(`0``````````
X`
Xend
b253f047a1631a2a184043b6f45926f7
diff --git a/test/elfcopy/tc/elfcopy-noops-archive-2/out/elfcopy-noops-archive-2.out.shar b/test/elfcopy/tc/elfcopy-noops-archive-2/out/elfcopy-noops-archive-2.out.shar
index dfb04aa71f96..4a6544ec8d23 100644
--- a/test/elfcopy/tc/elfcopy-noops-archive-2/out/elfcopy-noops-archive-2.out.shar
+++ b/test/elfcopy/tc/elfcopy-noops-archive-2/out/elfcopy-noops-archive-2.out.shar
@@ -11,89 +11,89 @@
echo x - liblong.a.1.uu
sed 's/^X//' >liblong.a.1.uu << '8eb77b0d36e0369a1b3adf0cc5ef193a'
Xbegin 644 liblong.a.1
-XM(3QA<F-H/@HO("`@("`@("`@("`@("`@,3(S,34S,S`R-"`@,"`@("`@,"`@
+XM(3QA<F-H/@HO("`@("`@("`@("`@("`@,30U,S`T-C,T.2`@,"`@("`@,"`@
XM("`@,"`@("`@("`Q,#`@("`@("`@8`H````*```!$@```1(```06```$%@``
XM!Y(```>2```'D@``"LX```K.```*SG-U;6UU;`!A`&US9P!P<FEN=&US9P!S
XM=6)S=')A8W0`>`!Y`&US9S$`;7-G,@!O=71P=71M<V<`+R\@("`@("`@("`@
XM("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@-#8@("`@("`@
XM(&`*83%?:&%S7V%?;&]N9U]F:6QE7VYA;64N;R\*831?:7-?,39?;&]N9U\N
-XM;R\*"B\P("`@("`@("`@("`@("`Q,C,Q-3,S,#(T("`Q,#`Q("`P("`@("`Q
+XM;R\*"B\P("`@("`@("`@("`@("`Q,3DT-S<W.34U("`Q,#`Q("`P("`@("`Q
XM,#`V-#0@(#<Q,B`@("`@("!@"G]%3$8!`0$)```````````!``,``0``````
-XM````````P``````````T```````H``D`!@````````````````!5B>7'!0``
+XM````````8`$````````T```````H``D`!@````````````````!5B>7'!0``
XM```%````BT4,BU4(`<*A``````^OPEW#``!'0T,Z("A'3E4I(#0N,BXQ(#(P
XM,#<P-S$Y("!;1G)E94)31%T``"YS>6UT86(`+G-T<G1A8@`N<VAS=')T86(`
XM+G)E;"YT97AT`"YD871A`"YB<W,`+F-O;6UE;G0`````````````````````
-XM```````````````````````````````````?`````0````8`````````0```
-XM`!\``````````````!``````````&P````D``````````````+@"```0````
-XM!P````$````$````"````"4````!`````P````````!@````````````````
-XM````!``````````K````"`````,`````````8`````````````````````0`
-XM````````,`````$``````````````&`````F```````````````!````````
-XM`!$````#``````````````"&````.0```````````````0`````````!````
-XM`@``````````````*`(``(`````(````!@````0````0````"0````,`````
-XM`````````*@"```/```````````````!````````````````````````````
XM```!```````````````$`/'_`````````````````P`!````````````````
XM``,``P`````````````````#``0``````````````````P`%``8`````````
XM'P```!(``0`-````!`````0````1`/+_`&$Q+F,`<W5M;75L`&$```4````!
-XM!P``%@````$'``!A,E]I<U\Q-5]L;VYG+F\O,3(S,34S,S`R-"`@,3`P,2`@
+XM!P``%@````$'````````````````````````````````````````````````
+XM````````'P````$````&`````````$`````?```````````````0````````
+XM`!L````)````0`````````!0`0``$`````<````!````!`````@````E````
+XM`0````,`````````8`````````````````````0`````````*P````@````#
+XM`````````&`````````````````````$`````````#`````!````````````
+XM``!@````)@```````````````0`````````1`````P``````````````A@``
+XM`#D```````````````$``````````0````(``````````````,````"`````
+XM"`````8````$````$`````D````#``````````````!``0``#P``````````
+XM`````0````````!A,E]I<U\Q-5]L;VYG+F\O,3$Y-#<W-SDU-2`@,3`P,2`@
XM,"`@("`@,3`P-C0T("`X,S(@("`@("`@8`I_14Q&`0$!"0```````````0`#
-XM``$``````````````-P`````````-```````*``*``<`````````````````
+XM``$``````````````+`!````````-```````*``*``<`````````````````
XM58GE@^P(QT0D!`````#'!"0`````Z/S____)PVAE;&QO+"!W;W)L9`````!M
XM<V<Z("5S"@``1T-#.B`H1TY5*2`T+C(N,2`R,#`W,#<Q.2`@6T9R965"4T1=
XM```N<WEM=&%B`"YS=')T86(`+G-H<W1R=&%B`"YR96PN=&5X=``N9&%T80`N
-XM8G-S`"YR;V1A=&$`+F-O;6UE;G0`````````````````````````````````
-XM`````````````````````!\````!````!@````````!`````'```````````
-XM````$``````````;````"0``````````````*`,``!@````(`````0````0`
-XM```(````)0````$````#`````````%P````-```````````````$````````
-XM`"L````(`````P````````!L````````````````````!``````````P````
-XM`0````(`````````;`````D```````````````$`````````.`````$`````
-XM`````````'4````F```````````````!`````````!$````#````````````
-XM``";````00```````````````0`````````!`````@``````````````;`(`
-XM`*`````)````!P````0````0````"0````,```````````````P#```:````
-XM```````````!```````````````````````````````!```````````````$
-XM`/'_`````````````````P`!``````````````````,``P``````````````
-XM```#``0``````````````````P`%``````````````````,`!@`&````````
-XM``T````1``,`"@`````````<````$@`!`!,``````````````!``````83(N
-XM8P!M<V<`<')I;G1M<V<`<')I;G1F````"@````$'```1`````04``!8````"
-XM"0``83-?;F]R;6%L+F\O("`@(#$R,S$U,S,P,C0@(#$P,#$@(#`@("`@(#$P
+XM8G-S`"YR;V1A=&$`+F-O;6UE;G0```````````````````````$`````````
+XM``````0`\?\````````````````#``$``````````````````P`#````````
+XM``````````,`!``````````````````#``4``````````````````P`&``8`
+XM````````#0```!$``P`*`````````!P````2``$`$P``````````````$```
+XM``!A,BYC`&US9P!P<FEN=&US9P!P<FEN=&8````*`````0<``!$````!!0``
+XM%@````()````````````````````````````````````````````````````
+XM````'P````$````&`````````$`````<```````````````0`````````!L`
+XM```)````0`````````"8`0``&`````@````!````!`````@````E`````0``
+XM``,`````````7`````T```````````````0`````````*P````@````#````
+XM`````&P````````````````````$`````````#`````!`````@````````!L
+XM````"0```````````````0`````````X`````0``````````````=0```"8`
+XM``````````````$`````````$0````,``````````````)L```!!````````
+XM```````!``````````$````"``````````````#<````H`````D````'````
+XM!````!`````)`````P``````````````?`$``!H```````````````$`````
+XM````83-?;F]R;6%L+F\O("`@(#$Q.30W-S<Y-34@(#$P,#$@(#`@("`@(#$P
XM,#8T-"`@-S8X("`@("`@(&`*?T5,1@$!`0D```````````$``P`!````````
-XM``````#4`````````#0``````"@`"0`&`````````````````%6)Y<<%````
+XM``````"8`0```````#0``````"@`"0`&`````````````````%6)Y<<%````
XM``$```#'!0`````"````BQ4`````BT4(B<$IT8G*H0````")T2G!B<A=PP``
XM1T-#.B`H1TY5*2`T+C(N,2`R,#`W,#<Q.2`@6T9R965"4T1=```N<WEM=&%B
XM`"YS=')T86(`+G-H<W1R=&%B`"YR96PN=&5X=``N9&%T80`N8G-S`"YC;VUM
-XM96YT````````````````````````````````````````````````````````
-XM'P````$````&`````````$`````S```````````````0`````````!L````)
-XM``````````````#@`@``(`````<````!````!`````@````E`````0````,`
-XM````````=`````````````````````0`````````*P````@````#````````
-XM`'0````````````````````$`````````#`````!``````````````!T````
-XM)@```````````````0`````````1`````P``````````````F@```#D`````
-XM``````````$``````````0````(``````````````#P"``"0````"`````8`
-XM```$````$`````D````#``````````````#,`@``%````````````````0``
-XM`````````````````````````````0``````````````!`#Q_P``````````
+XM96YT`````````````````````````0``````````````!`#Q_P``````````
XM``````,``0`````````````````#``,``````````````````P`$````````
XM``````````,`!0`&`````````#,````2``$`$`````0````$````$0#R_Q(`
XM```$````!````!$`\O\`83,N8P!S=6)S=')A8W0`>`!Y``4````!!P``#P``
-XM``$(```9`````0<``"<````!"```+S(W("`@("`@("`@("`@(#$R,S$U,S,P
-XM,C0@(#$P,#$@(#`@("`@(#$P,#8T-"`@.#@X("`@("`@(&`*?T5,1@$!`0D`
-XM``````````$``P`!``````````````#T`````````#0``````"@`"@`'````
+XM``$(```9`````0<``"<````!"```````````````````````````````````
+XM`````````````````````!\````!````!@````````!`````,P``````````
+XM````$``````````;````"0```$``````````>`$``"`````'`````0````0`
+XM```(````)0````$````#`````````'0````````````````````$````````
+XM`"L````(`````P````````!T````````````````````!``````````P````
+XM`0``````````````=````"8```````````````$`````````$0````,`````
+XM`````````)H````Y```````````````!``````````$````"````````````
+XM``#4````D`````@````&````!````!`````)`````P``````````````9`$`
+XM`!0```````````````$`````````+S(W("`@("`@("`@("`@(#$Q.30W-S<Y
+XM-34@(#$P,#$@(#`@("`@(#$P,#8T-"`@.#@X("`@("`@(&`*?T5,1@$!`0D`
+XM``````````$``P`!``````````````#H`0```````#0``````"@`"@`'````
XM`````````````%6)Y8/L&,=$)`@`````QT0D!`````#'!"0`````Z/S____)
XMPVUE<W-A9V4Q`&UE<W-A9V4R````;7-G,2`]("5S"FUS9S(@/2`E<PH``$=#
XM0SH@*$=.52D@-"XR+C$@,C`P-S`W,3D@(%M&<F5E0E-$70``+G-Y;71A8@`N
XM<W1R=&%B`"YS:'-T<G1A8@`N<F5L+G1E>'0`+F1A=&$`+F)S<P`N<F]D871A
-XM`"YC;VUM96YT````````````````````````````````````````````````
-XM```````?`````0````8`````````0````"0``````````````!``````````
-XM&P````D``````````````%@#```@````"`````$````$````"````"4````!
-XM`````P````````!D````$@``````````````!``````````K````"`````,`
-XM````````>`````````````````````0`````````,`````$````"````````
-XM`'@````5```````````````!`````````#@````!``````````````"-````
-XM)@```````````````0`````````1`````P``````````````LP```$$`````
-XM``````````$``````````0````(``````````````(0"``"P````"0````<`
-XM```$````$`````D````#```````````````T`P``(0```````````````0``
-XM`````````````````````````````0``````````````!`#Q_P``````````
-XM``````,``0`````````````````#``,``````````````````P`$````````
-XM``````````,`!0`````````````````#``8`!@`````````)````$0`#``L`
-XM```)````"0```!$``P`0`````````"0````2``$`&@``````````````$```
-XM``!A-"YC`&US9S$`;7-G,@!O=71P=71M<V<`<')I;G1F``````H````!"```
-X8$@````$'```9`````04``!X````""@``
+XM`"YC;VUM96YT```````````````````````!```````````````$`/'_````
+XM`````````````P`!``````````````````,``P`````````````````#``0`
+XM`````````````````P`%``````````````````,`!@`&``````````D````1
+XM``,`"P````D````)````$0`#`!``````````)````!(``0`:````````````
+XM```0`````&$T+F,`;7-G,0!M<V<R`&]U='!U=&US9P!P<FEN=&8`````"@``
+XM``$(```2`````0<``!D````!!0``'@````(*````````````````````````
+XM````````````````````````````````'P````$````&`````````$`````D
+XM```````````````0`````````!L````)````0`````````#(`0``(`````@`
+XM```!````!`````@````E`````0````,`````````9````!(`````````````
+XM``0`````````*P````@````#`````````'@````````````````````$````
+XM`````#`````!`````@````````!X````%0```````````````0`````````X
+XM`````0``````````````C0```"8```````````````$`````````$0````,`
+XM`````````````+,```!!```````````````!``````````$````"````````
+XM``````#T````L`````D````'````!````!`````)`````P``````````````
+X8I`$``"$```````````````$`````````
X`
Xend
8eb77b0d36e0369a1b3adf0cc5ef193a
diff --git a/test/elfcopy/tc/elfcopy-rename-1/out/elfcopy-rename-1.out.shar b/test/elfcopy/tc/elfcopy-rename-1/out/elfcopy-rename-1.out.shar
index edfab30e654f..228017768f47 100644
--- a/test/elfcopy/tc/elfcopy-rename-1/out/elfcopy-rename-1.out.shar
+++ b/test/elfcopy/tc/elfcopy-rename-1/out/elfcopy-rename-1.out.shar
@@ -10,23 +10,23 @@
echo x - sym.o.uu
sed 's/^X//' >sym.o.uu << '07b26866a0eaf5d2a40d8f75b1109c67'
Xbegin 644 sym.o
-XM?T5,1@$!`0D```````````$``P`!``````````````#@`````````#0`````
+XM?T5,1@$!`0D```````````$``P`!``````````````"<`0```````#0`````
XM`"@`"``%`````````````````%6)Y;@`````7<.-M@````!5B>6X`````%W#
XMC;8`````58GEN`````!=PXVV`````%6)Y;@`````7<,```!'0T,Z("A'3E4I
XM(#0N,BXQ(#(P,#<P-S$Y("!;1G)E94)31%T``"YS>6UT86(`+G-T<G1A8@`N
XM<VAS=')T86(`+G1E>'0N;F5W;F%M90`N9&%T80`N8G-S`"YC;VUM96YT````
-XM````````````````````````````````````````````````````&P````$`
-XM```&`````````$`````Z```````````````0`````````"D````!`````P``
-XM``````!\````````````````````!``````````O````"`````,`````````
-XM?`````````````````````0`````````-`````$``````````````'P````F
-XM```````````````!`````````!$````#``````````````"B````/0``````
-XM`````````0`````````!`````@``````````````(`(``*`````'````!@``
-XM``0````0````"0````,``````````````,`"```:```````````````!````
-XM```````````````````````````!```````````````$`/'_````````````
-XM`````P`!``````````````````,``@`````````````````#``,`````````
-XM`````````P`$``@`````````"@```!(``0`,````$`````H````2``$`$```
-XM`"`````*````$@`!`!4````P````"@```!(``0``=&5S="YC`&9O;P!B87(`
-X*9F]O,@!B87(R````
+XM`````````````````````0``````````````!`#Q_P````````````````,`
+XM`0`````````````````#``(``````````````````P`#````````````````
+XM``,`!``(``````````H````2``$`#````!`````*````$@`!`!`````@````
+XM"@```!(``0`5````,`````H````2``$``'1E<W0N8P!F;V\`8F%R`&9O;S(`
+XM8F%R,@``````````````````````````````````````````````````````
+XM```;`````0````8`````````0````#H``````````````!``````````*0``
+XM``$````#`````````'P````````````````````$`````````"\````(````
+XM`P````````!\````````````````````!``````````T`````0``````````
+XM````?````"8```````````````$`````````$0````,``````````````*(`
+XM```]```````````````!``````````$````"``````````````#@````H```
+XM``<````&````!````!`````)`````P``````````````@`$``!H`````````
+X,``````$`````````
X`
Xend
07b26866a0eaf5d2a40d8f75b1109c67
diff --git a/test/elfcopy/tc/strip-K-2/out/strip-K-2.out.shar b/test/elfcopy/tc/strip-K-2/out/strip-K-2.out.shar
index 13542f7be2f5..eb0efffbe200 100644
--- a/test/elfcopy/tc/strip-K-2/out/strip-K-2.out.shar
+++ b/test/elfcopy/tc/strip-K-2/out/strip-K-2.out.shar
@@ -9,28 +9,28 @@
# sym.o.uu
#
echo x - sym.o.1.uu
-sed 's/^X//' >sym.o.1.uu << 'END-of-sym.o.1.uu'
+sed 's/^X//' >sym.o.1.uu << 'cc3b7341ff25eb16b80756fcb867a66b'
Xbegin 644 sym.o.1
-XM?T5,1@$!`0D```````````$``P`!``````````````#8`````````#0`````
+XM?T5,1@$!`0D```````````$``P`!``````````````!``0```````#0`````
XM`"@`"``%`````````````````%6)Y;@`````7<.-M@````!5B>6X`````%W#
XMC;8`````58GEN`````!=PXVV`````%6)Y;@`````7<,```!'0T,Z("A'3E4I
XM(#0N,BXQ(#(P,#<P-S$Y("!;1G)E94)31%T``"YS>6UT86(`+G-T<G1A8@`N
XM<VAS=')T86(`+G1E>'0`+F1A=&$`+F)S<P`N8V]M;65N=```````````````
-XM`````````````````````````````````````````!L````!````!@``````
-XM``!`````.@``````````````$``````````A`````0````,`````````?```
-XM``````````````````0`````````)P````@````#`````````'P`````````
-XM```````````$`````````"P````!``````````````!\````)@``````````
-XM`````0`````````1`````P``````````````H@```#4```````````````$`
-XM`````````0````(``````````````!@"``!@````!P````4````$````$```
-XM``D````#``````````````!X`@``!0```````````````0``````````````
-XM`````````````````````````````````P`!``````````````````,``@``
-XM```````````````#``,``````````````````P`$``$`````````"@```!(`
-X'`0``9F]O````
+XM``````````````````````````,``0`````````````````#``(`````````
+XM`````````P`#``````````````````,`!``!``````````H````2``$``&9O
+XM;P``````````````````````````````````````````````````````````
+XM&P````$````&`````````$`````Z```````````````0`````````"$````!
+XM`````P````````!\````````````````````!``````````G````"`````,`
+XM````````?`````````````````````0`````````+`````$`````````````
+XM`'P````F```````````````!`````````!$````#``````````````"B````
+XM-0```````````````0`````````!`````@``````````````V````&`````'
+XM````!0````0````0````"0````,``````````````#@!```%````````````
+X*```!````````````
X`
Xend
-END-of-sym.o.1.uu
+cc3b7341ff25eb16b80756fcb867a66b
echo x - sym.o.uu
-sed 's/^X//' >sym.o.uu << 'END-of-sym.o.uu'
+sed 's/^X//' >sym.o.uu << '07b26866a0eaf5d2a40d8f75b1109c67'
Xbegin 644 sym.o
XM?T5,1@$!`0D```````````$``P`!``````````````#8`````````#0`````
XM`"@`"``%`````````````````%6)Y;@`````7<.-M@````!5B>6X`````%W#
@@ -51,6 +51,6 @@ XM`!(``0`5````,`````H````2``$``'1E<W0N8P!F;V\`8F%R`&9O;S(`8F%R
X",@``
X`
Xend
-END-of-sym.o.uu
+07b26866a0eaf5d2a40d8f75b1109c67
exit
diff --git a/test/elfcopy/tc/strip-all-1/out/strip-all-1.out.shar b/test/elfcopy/tc/strip-all-1/out/strip-all-1.out.shar
index 03dba738852f..e3f8268f208f 100644
--- a/test/elfcopy/tc/strip-all-1/out/strip-all-1.out.shar
+++ b/test/elfcopy/tc/strip-all-1/out/strip-all-1.out.shar
@@ -8,8 +8,8 @@
# ls.uu
#
echo x - ls.uu
-sed 's/^X//' >ls.uu << 'END-of-ls.uu'
-Xbegin 755 ls
+sed 's/^X//' >ls.uu << '4db11c737631d887608e3186a17a7a3e'
+Xbegin 644 ls
XM?T5,1@$!`0D```````````(``P`!````D),$"#0```!T7@```````#0`(``'
XM`"@`&@`9``8````T````-(`$"#2`!`C@````X`````4````$`````P```!0!
XM```4@00(%($$"!4````5````!`````$````!``````````"`!`@`@`0(<%@`
@@ -554,8 +554,8 @@ XM(0````4````"````1($$"$0!``!H`@``!``````````$````!````"<````+
XM`````@```*R#!`BL`P``4`4```4````!````!````!`````O`````P````(`
XM``#\B`0(_`@```@#``````````````$`````````-P```/___V\"````!(P$
XM"`0,``"J````!``````````"`````@```$0```#^__]O`@```+",!`BP#```
-XM(`````4````!````!`````````!3````"0````(```#0C`0(T`P``#`````$
-XM``````````0````(````7`````D````"`````(T$"``-```@`@``!`````L`
+XM(`````4````!````!`````````!3````"0```$(```#0C`0(T`P``#`````$
+XM``````````0````(````7`````D```!"`````(T$"``-```@`@``!`````L`
XM```$````"````&4````!````!@```""/!`@@#P``$0``````````````!```
XM``````!@`````0````8````TCP0(-`\``%`$``````````````0````$````
XM:P````$````&````D),$")`3``!,0``````````````0`````````'$````!
@@ -573,6 +573,6 @@ XM`.!:``#(`@`````````````!``````````$````#``````````````"H70``
X4S````````````````0``````````
X`
Xend
-END-of-ls.uu
+4db11c737631d887608e3186a17a7a3e
exit
diff --git a/test/elfcopy/tc/strip-all-10/out/strip-all-10.out.shar b/test/elfcopy/tc/strip-all-10/out/strip-all-10.out.shar
index 03641e9c55ec..7d0daf3ebb73 100644
--- a/test/elfcopy/tc/strip-all-10/out/strip-all-10.out.shar
+++ b/test/elfcopy/tc/strip-all-10/out/strip-all-10.out.shar
@@ -2530,9 +2530,9 @@ XM``0````````````````````G````!0````(`````````$`-````````0`P``
XM`````(0#````````!``````````(``````````0`````````+0````L````"
XM`````````)@&0```````F`8```````#0"P````````4````!````"```````
XM```8`````````#4````#`````@````````!H$D```````&@2````````Z@,`
-XM``````````````````$````````````````````]````!`````(`````````
+XM``````````````````$````````````````````]````!````$(`````````
XM6!9```````!8%@```````%`!````````!``````````(`````````!@`````
-XM````1P````0````"`````````*@70```````J!<```````#`"0````````0`
+XM````1P````0```!"`````````*@70```````J!<```````#`"0````````0`
XM```)````"``````````8`````````%$````!````!@````````!P(4``````
XM`'`A````````#@```````````````````!````````````````````!,````
XM`0````8`````````@"%```````"`(0```````)`&```````````````````$
diff --git a/test/elfcopy/tc/strip-all-2/out/strip-all-2.out.shar b/test/elfcopy/tc/strip-all-2/out/strip-all-2.out.shar
index ba58f923f30a..cb9aece58210 100644
--- a/test/elfcopy/tc/strip-all-2/out/strip-all-2.out.shar
+++ b/test/elfcopy/tc/strip-all-2/out/strip-all-2.out.shar
@@ -8,8 +8,8 @@
# ps.uu
#
echo x - ps.uu
-sed 's/^X//' >ps.uu << 'END-of-ps.uu'
-Xbegin 755 ps
+sed 's/^X//' >ps.uu << '1d41113d6c473df8a15e4a4e0ea90bc3'
+Xbegin 644 ps
XM?T5,1@$!`0D```````````(``P`!````T)0$"#0````(>````````#0`(``'
XM`"@`&@`9``8````T````-(`$"#2`!`C@````X`````4````$`````P```!0!
XM```4@00(%($$"!4````5````!`````$````!``````````"`!`@`@`0(!&``
@@ -700,8 +700,8 @@ XM```$``````````0````$````)P````L````"````Q(,$",0#``"P!0``!0``
XM``$````$````$````"\````#`````@```'2)!`AT"0``+@,`````````````
XM`0`````````W````____;P(```"BC`0(H@P``+8````$``````````(````"
XM````1````/[__V\"````6(T$"%@-``!`````!0````(````$`````````%,`
-XM```)`````@```)B-!`B8#0``,`````0`````````!`````@```!<````"0``
-XM``(```#(C00(R`T``$@"```$````"P````0````(````90````$````&````
+XM```)````0@```)B-!`B8#0``,`````0`````````!`````@```!<````"0``
+XM`$(```#(C00(R`T``$@"```$````"P````0````(````90````$````&````
XM$)`$"!`0```1```````````````$`````````&`````!````!@```"20!`@D
XM$```H`0`````````````!`````0```!K`````0````8```#0E`0(T!0``%Q!
XM`````````````!``````````<0````$````&````+-8$""Q6```,````````
@@ -718,6 +718,6 @@ XM"`````````##`````0``````````````V',``&,#``````````````$`````
XK`````0````,``````````````#MW``#,```````````````!````````````
X`
Xend
-END-of-ps.uu
+1d41113d6c473df8a15e4a4e0ea90bc3
exit
diff --git a/test/elfcopy/tc/strip-all-3/out/strip-all-3.out.shar b/test/elfcopy/tc/strip-all-3/out/strip-all-3.out.shar
index f7b6173e4c28..a2a657c0cfa1 100644
--- a/test/elfcopy/tc/strip-all-3/out/strip-all-3.out.shar
+++ b/test/elfcopy/tc/strip-all-3/out/strip-all-3.out.shar
@@ -8,8 +8,8 @@
# tcsh.uu
#
echo x - tcsh.uu
-sed 's/^X//' >tcsh.uu << 'END-of-tcsh.uu'
-Xbegin 755 tcsh
+sed 's/^X//' >tcsh.uu << 'e0b48b8aefb9960c9da54cac18bdcb01'
+Xbegin 644 tcsh
XM?T5,1@$!`0D```````````(``P`!````(*0$"#0```"HVP0``````#0`(``'
XM`"@`&@`9``8````T````-(`$"#2`!`C@````X`````4````$`````P```!0!
XM```4@00(%($$"!4````5````!`````$````!``````````"`!`@`@`0(7)\$
@@ -7092,8 +7092,8 @@ XM!`A$`0``E`0```0`````````!`````0````G````"P````(```#8A00(V`4`
XM```*```%`````0````0````0````+P````,````"````V(\$"-@/```X!0``
XM```````````!`````````#<```#___]O`@```!"5!`@0%0``0`$```0`````
XM`````@````(```!$````_O__;P(```!0E@0(4!8``"`````%`````0````0`
-XM````````4P````D````"````<)8$"'`6```@````!``````````$````"```
-XM`%P````)`````@```)"6!`B0%@``>`0```0````+````!`````@```!E````
+XM````````4P````D```!"````<)8$"'`6```@````!``````````$````"```
+XM`%P````)````0@```)"6!`B0%@``>`0```0````+````!`````@```!E````
XM`0````8````(FP0("!L``!$```````````````0`````````8`````$````&
XM````')L$"!P;````"0`````````````$````!````&L````!````!@```""D
XM!`@@)```W`P$````````````$`````````!Q`````0````8```#\L`@(_#`$
@@ -7111,6 +7111,6 @@ XM`````0`````````!`````P``````````````V=H$`,P```````````````$`
X&````````
X`
Xend
-END-of-tcsh.uu
+e0b48b8aefb9960c9da54cac18bdcb01
exit
diff --git a/test/elfcopy/tc/strip-all-4/out/strip-all-4.out.shar b/test/elfcopy/tc/strip-all-4/out/strip-all-4.out.shar
index 4acf57ad90a0..1706b0b6bbb1 100644
--- a/test/elfcopy/tc/strip-all-4/out/strip-all-4.out.shar
+++ b/test/elfcopy/tc/strip-all-4/out/strip-all-4.out.shar
@@ -8,8 +8,8 @@
# vi.uu
#
echo x - vi.uu
-sed 's/^X//' >vi.uu << 'END-of-vi.uu'
-Xbegin 755 vi
+sed 's/^X//' >vi.uu << '5f6cb34c34598fc980a32aede89eafe8'
+Xbegin 644 vi
XM?T5,1@$!`0D```````````(``P`!````X*0$"#0````8IP0``````#0`(``'
XM`"@`&@`9``8````T````-(`$"#2`!`C@````X`````4````$`````P```!0!
XM```4@00(%($$"!4````5````!`````$````!``````````"`!`@`@`0(@(\$
@@ -6793,8 +6793,8 @@ XM"$0!``"T!```!``````````$````!````"<````+`````@```/B%!`CX!0``
XM@`H```4````!````!````!`````O`````P````(```!XD`0(>!```-`$````
XM``````````$`````````-P```/___V\"````2)4$"$@5``!0`0``!```````
XM```"`````@```$0```#^__]O`@```)B6!`B8%@``(`````4````!````!```
-XM``````!3````"0````(```"XE@0(N!8``&`````$``````````0````(````
-XM7`````D````"````&)<$"!@7``"(!```!`````L````$````"````&4````!
+XM``````!3````"0```$(```"XE@0(N!8``&`````$``````````0````(````
+XM7`````D```!"````&)<$"!@7``"(!```!`````L````$````"````&4````!
XM````!@```*";!`B@&P``$0``````````````!`````````!@`````0````8`
XM``"TFP0(M!L``"`)``````````````0````$````:P````$````&````X*0$
XM".`D```\Y0,````````````0`````````'$````!````!@```!R*"`@<"@0`
@@ -6812,6 +6812,6 @@ XM```!``````````$````#``````````````!)I@0`S````````````````0``
X%````````
X`
Xend
-END-of-vi.uu
+5f6cb34c34598fc980a32aede89eafe8
exit
diff --git a/test/elfcopy/tc/strip-all-5/out/strip-all-5.out.shar b/test/elfcopy/tc/strip-all-5/out/strip-all-5.out.shar
index 96bcaf5a81ca..40c03cdbf86c 100644
--- a/test/elfcopy/tc/strip-all-5/out/strip-all-5.out.shar
+++ b/test/elfcopy/tc/strip-all-5/out/strip-all-5.out.shar
@@ -8,8 +8,8 @@
# pkill.uu
#
echo x - pkill.uu
-sed 's/^X//' >pkill.uu << 'END-of-pkill.uu'
-Xbegin 755 pkill
+sed 's/^X//' >pkill.uu << '521a9e5ac40550eee504b066258ae35d'
+Xbegin 644 pkill
XM?T5,1@$!`0D```````````(``P`!````D(X$"#0```#D+@```````#0`(``&
XM`"@`&0`8``8````T````-(`$"#2`!`C`````P`````4````$`````P```/0`
XM``#T@`0(](`$"!4````5````!`````$````!``````````"`!`@`@`0(YBH`
@@ -284,7 +284,7 @@ XM````````!`````0````G````"P````(```#(@@0(R`(``"`$```%`````0``
XM``0````0````+P````,````"````Z(8$".@&``!%`@`````````````!````
XM`````#<```#___]O`@```"Z)!`@N"0``A`````0``````````@````(```!$
XM````_O__;P(```"TB00(M`D``"`````%`````0````0`````````4P````D`
-XM```"````U(D$"-0)``!(````!``````````$````"````%P````)`````@``
+XM``!"````U(D$"-0)``!(````!``````````$````"````%P````)````0@``
XM`!R*!`@<"@``<`$```0````+````!`````@```!E`````0````8```",BP0(
XMC`L``!$```````````````0`````````8`````$````&````H(L$"*`+``#P
XM`@`````````````$````!````&L````!````!@```)".!`B0#@``_!8`````
@@ -301,6 +301,6 @@ XM``@`````````M0````$``````````````*PL``!X`0`````````````!````
XL``````$````#```````````````D+@``O@```````````````0``````````
X`
Xend
-END-of-pkill.uu
+521a9e5ac40550eee504b066258ae35d
exit
diff --git a/test/elfcopy/tc/strip-all-6/out/strip-all-6.out.shar b/test/elfcopy/tc/strip-all-6/out/strip-all-6.out.shar
index 8ffbaaa6455a..2571223c3692 100644
--- a/test/elfcopy/tc/strip-all-6/out/strip-all-6.out.shar
+++ b/test/elfcopy/tc/strip-all-6/out/strip-all-6.out.shar
@@ -9,7 +9,7 @@
# mcs.o.uu
#
echo x - mcs.o.1.uu
-sed 's/^X//' >mcs.o.1.uu << 'END-of-mcs.o.1.uu'
+sed 's/^X//' >mcs.o.1.uu << 'f795b6a491de52ced7008ed30e59ba9b'
Xbegin 644 mcs.o.1
XM?T5,1@$!`0D```````````$``P`!``````````````!L"0```````#0`````
XM`"@`"``'`````````````````%6)Y8/L&(E4)`3'1"0(`````(D$).C\____
@@ -66,7 +66,7 @@ XM:&1R(&9A:6QE9#H@)7,`9V5L9E]F<VEZ92!F86EL960Z("5S`&5L9E]N97AT
XM<V-N(&9A:6QE9#H@)7,``"YS:'-T<G1A8@`N<F5L+G1E>'0`+F1A=&$`+F)S
XM<P`N8V]M;65N=``N<F]D871A+G-T<C$N,0``````````````````````````
XM``````````````````````````````\````!````!@````````!`````#`@`
-XM````````````$``````````+````"0``````````````K`H`````````````
+XM````````````$``````````+````"0```$``````````;`D`````````````
XM`0````0````(````%0````$````#`````````$P(```````````````````$
XM`````````!L````(`````P````````!,"```````````````````!```````
XM```@`````0``````````````3`@``#````````````````$`````````*0``
@@ -74,9 +74,9 @@ XM``$````R`````````'P(``"W```````````````!`````0````$````#````
X@```````````S"0``.````````````````0``````````
X`
Xend
-END-of-mcs.o.1.uu
+f795b6a491de52ced7008ed30e59ba9b
echo x - mcs.o.uu
-sed 's/^X//' >mcs.o.uu << 'END-of-mcs.o.uu'
+sed 's/^X//' >mcs.o.uu << '4890727b4c22736e61623154688c0ec6'
Xbegin 644 mcs.o
XM?T5,1@$!`0D```````````$``P`!``````````````!\"0```````#0`````
XM`"@`"@`'`````````````````%6)Y8/L&(E4)`3'1"0(`````(D$).C\____
@@ -170,6 +170,6 @@ XML`<```(6``"X!P```0@``,@'```"%P``T`<```(6``#8!P```0@``.@'```"
X;%P``\`<```(6``#X!P```0@```@(```"%P``
X`
Xend
-END-of-mcs.o.uu
+4890727b4c22736e61623154688c0ec6
exit
diff --git a/test/elfcopy/tc/strip-all-7/out/strip-all-7.out.shar b/test/elfcopy/tc/strip-all-7/out/strip-all-7.out.shar
index 6e7c4727885b..59f78aa347a2 100644
--- a/test/elfcopy/tc/strip-all-7/out/strip-all-7.out.shar
+++ b/test/elfcopy/tc/strip-all-7/out/strip-all-7.out.shar
@@ -9,7 +9,7 @@
# sections.o.uu
#
echo x - sections.o.1.uu
-sed 's/^X//' >sections.o.1.uu << 'END-of-sections.o.1.uu'
+sed 's/^X//' >sections.o.1.uu << 'eb2ac2808b7045ab3c2faf26922f5e01'
Xbegin 644 sections.o.1
XM?T5,1@$!`0D```````````$``P`!``````````````!H'````````#0`````
XM`"@`"0`(`````````````````%6)Y5:)QE.+2'R)TX7)=#^+0A"+4A0[411R
@@ -174,7 +174,7 @@ XM`&UO=FEN9R!L;V%D86)L92!S96-T:6]N+&ES('1H:7,@:6YT96YT:6]N86P_
XM```N<VAS=')T86(`+G)E;"YT97AT`"YD871A`"YB<W,`+F-O;6UE;G0`+G)O
XM9&%T82YS='(Q+C$`+G)O9&%T82YS='(Q+C0`````````````````````````
XM``````````````````````````````\````!````!@````````!`````Y1@`
-XM````````````$``````````+````"0``````````````T!T`````````````
+XM````````````$``````````+````"0```$``````````:!P`````````````
XM`0````0````(````%0````$````#`````````"@9```````````````````$
XM`````````!L````(`````P`````````H&0``````````````````!```````
XM```@`````0``````````````*!D``#````````````````$`````````*0``
@@ -183,9 +183,9 @@ XM,@````````#T&P``+0``````````````!`````$````!`````P``````````
X;````(1P``$<```````````````$`````````
X`
Xend
-END-of-sections.o.1.uu
+eb2ac2808b7045ab3c2faf26922f5e01
echo x - sections.o.uu
-sed 's/^X//' >sections.o.uu << 'END-of-sections.o.uu'
+sed 's/^X//' >sections.o.uu << 'f3eccedeeefe85afebc666fca5eb0742'
Xbegin 644 sections.o
XM?T5,1@$!`0D```````````$``P`!``````````````!X'````````#0`````
XM`"@`"P`(`````````````````%6)Y5:)QE.+2'R)TX7)=#^+0A"+4A0[411R
@@ -434,6 +434,6 @@ XM`#88```!!@``1A@```(5``!+&````A@``(T8```")@``P1@```(4``#)&```
X,`08``-D8```"%0``
X`
Xend
-END-of-sections.o.uu
+f3eccedeeefe85afebc666fca5eb0742
exit
diff --git a/test/elfcopy/tc/strip-all-8/out/strip-all-8.out.shar b/test/elfcopy/tc/strip-all-8/out/strip-all-8.out.shar
index 36d2beb5b3dd..3a5c52f7387e 100644
--- a/test/elfcopy/tc/strip-all-8/out/strip-all-8.out.shar
+++ b/test/elfcopy/tc/strip-all-8/out/strip-all-8.out.shar
@@ -9,7 +9,7 @@
# sections.o.debug.uu
#
echo x - sections.o.debug.1.uu
-sed 's/^X//' >sections.o.debug.1.uu << 'END-of-sections.o.debug.1.uu'
+sed 's/^X//' >sections.o.debug.1.uu << '7441d94dfba58dda29235b0205ebc7b3'
Xbegin 644 sections.o.debug.1
XM?T5,1@$!`0D```````````$``P`!``````````````!H'````````#0`````
XM`"@`"0`(`````````````````%6)Y5:)QE.+2'R)TX7)=#^+0A"+4A0[411R
@@ -174,7 +174,7 @@ XM`&UO=FEN9R!L;V%D86)L92!S96-T:6]N+&ES('1H:7,@:6YT96YT:6]N86P_
XM```N<VAS=')T86(`+G)E;"YT97AT`"YD871A`"YB<W,`+F-O;6UE;G0`+G)O
XM9&%T82YS='(Q+C$`+G)O9&%T82YS='(Q+C0`````````````````````````
XM``````````````````````````````\````!````!@````````!`````Y1@`
-XM````````````$``````````+````"0``````````````T!T`````````````
+XM````````````$``````````+````"0```$``````````:!P`````````````
XM`0````0````(````%0````$````#`````````"@9```````````````````$
XM`````````!L````(`````P`````````H&0``````````````````!```````
XM```@`````0``````````````*!D``#````````````````$`````````*0``
@@ -183,9 +183,9 @@ XM,@````````#T&P``+0``````````````!`````$````!`````P``````````
X;````(1P``$<```````````````$`````````
X`
Xend
-END-of-sections.o.debug.1.uu
+7441d94dfba58dda29235b0205ebc7b3
echo x - sections.o.debug.uu
-sed 's/^X//' >sections.o.debug.uu << 'END-of-sections.o.debug.uu'
+sed 's/^X//' >sections.o.debug.uu << '07454e9209d1c5eccb83c5c72e752a37'
Xbegin 644 sections.o.debug
XM?T5,1@$!`0D```````````$``P`!``````````````!86@```````#0`````
XM`"@`&0`6`````````````````%6)Y5:)QE.+2'R)TX7)=#^+0A"+4A0[411R
@@ -880,6 +880,6 @@ XM`@``B`$```$/``",`0```0(``*@!```!#P``K`$```$"``#(`0```0\``,P!
X>```!`@``!@````$&```&`````08``!`````!`@``
X`
Xend
-END-of-sections.o.debug.uu
+07454e9209d1c5eccb83c5c72e752a37
exit
diff --git a/test/elfcopy/tc/strip-all-9/out/strip-all-9.out.shar b/test/elfcopy/tc/strip-all-9/out/strip-all-9.out.shar
index 96d9028c57d3..c73f7e806239 100644
--- a/test/elfcopy/tc/strip-all-9/out/strip-all-9.out.shar
+++ b/test/elfcopy/tc/strip-all-9/out/strip-all-9.out.shar
@@ -9,8 +9,8 @@
# elfcopy.uu
#
echo x - elfcopy.1.uu
-sed 's/^X//' >elfcopy.1.uu << 'END-of-elfcopy.1.uu'
-Xbegin 755 elfcopy.1
+sed 's/^X//' >elfcopy.1.uu << 'e4e59173f6354081a9e3a7debde2f069'
+Xbegin 644 elfcopy.1
XM?T5,1@(!`0D```````````(`/@`!````4!M```````!``````````'B!````
XM`````````$``.``'`$``&@`9``8````%````0`````````!``$```````$``
XM0```````B`$```````"(`0````````@``````````P````0```#(`0``````
@@ -759,8 +759,8 @@ XMT`M```````#0"P````````\#```````````````````!````````````````
XM````-P```/___V\"`````````.`.0```````X`X```````"@``````````0`
XM`````````@`````````"`````````$0```#^__]O`@````````"`#T``````
XM`(`/````````0``````````%`````@````@```````````````````!3````
-XM!`````(`````````P`]```````#`#P```````'@`````````!``````````(
-XM`````````!@`````````70````0````"`````````#@00```````.!``````
+XM!````$(`````````P`]```````#`#P```````'@`````````!``````````(
+XM`````````!@`````````70````0```!"`````````#@00```````.!``````
XM``"0!@````````0````+````"``````````8`````````&<````!````!@``
XM``````#(%D```````,@6````````$P````````````````````0`````````
XM``````````!B`````0````8`````````W!9```````#<%@```````'`$````
@@ -787,10 +787,10 @@ XM``````$````#`````````````````````````*:`````````S@``````````
X7``````````$`````````````````````
X`
Xend
-END-of-elfcopy.1.uu
+e4e59173f6354081a9e3a7debde2f069
echo x - elfcopy.uu
-sed 's/^X//' >elfcopy.uu << 'END-of-elfcopy.uu'
-Xbegin 755 elfcopy
+sed 's/^X//' >elfcopy.uu << '2151ae8f08071e33d3c60fbc8f2d2844'
+Xbegin 644 elfcopy
XM?T5,1@(!`0D```````````(`/@`!````4!M```````!``````````#AM`0``
XM`````````$``.``'`$``)0`B``8````%````0`````````!``$```````$``
XM0```````B`$```````"(`0````````@``````````P````0```#(`0``````
@@ -3078,6 +3078,6 @@ XM7U)E9VES=&5R0VQA<W-E<P!G971P<F]G;F%M94!`1D)31%\Q+C``<V5T=7!?
XF<&AD<@!G96QF7V=E=')E;$!`1D)31%\Q+C``8W)E871E7W-C;@``
X`
Xend
-END-of-elfcopy.uu
+2151ae8f08071e33d3c60fbc8f2d2844
exit
diff --git a/test/elfcopy/tc/strip-all-archive-1/out/strip-all-archive-1.out.shar b/test/elfcopy/tc/strip-all-archive-1/out/strip-all-archive-1.out.shar
index 438c45be918b..0f52d44d246a 100644
--- a/test/elfcopy/tc/strip-all-archive-1/out/strip-all-archive-1.out.shar
+++ b/test/elfcopy/tc/strip-all-archive-1/out/strip-all-archive-1.out.shar
@@ -11,45 +11,45 @@
echo x - liba.a.1.uu
sed 's/^X//' >liba.a.1.uu << 'b253f047a1631a2a184043b6f45926f7'
Xbegin 644 liba.a.1
-XM(3QA<F-H/@HO("`@("`@("`@("`@("`@,3(S,34T-#$P,R`@,"`@("`@,"`@
-XM("`@,"`@("`@("`T("`@("`@("`@8`H`````83$N;R\@("`@("`@("`@(#$R
-XM,S$U-#0Q,#,@(#$P,#$@(#`@("`@(#$P,#8T-"`@-#4V("`@("`@(&`*?T5,
+XM(3QA<F-H/@HO("`@("`@("`@("`@("`@,30U,S`U-S8P-R`@,"`@("`@,"`@
+XM("`@,"`@("`@("`T("`@("`@("`@8`H`````83$N;R\@("`@("`@("`@(#$Q
+XM.30U,#DS-#D@(#$P,#$@(#`@("`@(#$P,#8T-"`@-#4V("`@("`@(&`*?T5,
XM1@$!`0D```````````$``P`!``````````````"P`````````#0``````"@`
XM!P`&`````````````````%6)Y<<%``````4```"+10R+50@!PJ$`````#Z_"
XM7<,``$=#0SH@*$=.52D@-"XR+C$@,C`P-S`W,3D@(%M&<F5E0E-$70``+G-H
XM<W1R=&%B`"YR96PN=&5X=``N9&%T80`N8G-S`"YC;VUM96YT````````````
XM````````````````````````````````````````````#P````$````&````
-XM`````$`````?```````````````0``````````L````)``````````````#(
-XM`0`````````````!````!`````@````5`````0````,`````````8```````
+XM`````$`````?```````````````0``````````L````)````0`````````"P
+XM```````````````!````!`````@````5`````0````,`````````8```````
XM``````````````0`````````&P````@````#`````````&``````````````
XM```````$`````````"`````!``````````````!@````)@``````````````
XM`0`````````!`````P``````````````A@```"D```````````````$`````
-XM````83(N;R\@("`@("`@("`@(#$R,S$U-#0Q,#,@(#$P,#$@(#`@("`@(#$P
+XM````83(N;R\@("`@("`@("`@(#$Q.30U,#DS-#D@(#$P,#$@(#`@("`@(#$P
XM,#8T-"`@-3(T("`@("`@(&`*?T5,1@$!`0D```````````$``P`!````````
XM``````#,`````````#0``````"@`"``'`````````````````%6)Y8/L",=$
XM)`0`````QP0D`````.C\____R<-H96QL;RP@=V]R;&0`````;7-G.B`E<PH`
XM`$=#0SH@*$=.52D@-"XR+C$@,C`P-S`W,3D@(%M&<F5E0E-$70``+G-H<W1R
XM=&%B`"YR96PN=&5X=``N9&%T80`N8G-S`"YR;V1A=&$`+F-O;6UE;G0`````
XM``````````````````````````````````````````````````\````!````
-XM!@````````!`````'```````````````$``````````+````"0``````````
-XM````#`(``````````````0````0````(````%0````$````#`````````%P`
+XM!@````````!`````'```````````````$``````````+````"0```$``````
+XM````S````````````````0````0````(````%0````$````#`````````%P`
XM```-```````````````$`````````!L````(`````P````````!L````````
XM````````````!``````````@`````0````(`````````;`````D`````````
XM``````$`````````*`````$``````````````'4````F```````````````!
XM``````````$````#``````````````";````,0```````````````0``````
-XM``!A,RYO+R`@("`@("`@("`@,3(S,34T-#$P,R`@,3`P,2`@,"`@("`@,3`P
+XM``!A,RYO+R`@("`@("`@("`@,3$Y-#4P.3,T.2`@,3`P,2`@,"`@("`@,3`P
XM-C0T("`T-S8@("`@("`@8`I_14Q&`0$!"0```````````0`#``$`````````
XM`````,0`````````-```````*``'``8`````````````````58GEQP4`````
XM`0```,<%``````(```"+%0````"+10B)P2G1B<JA`````(G1*<&)R%W#``!'
XM0T,Z("A'3E4I(#0N,BXQ(#(P,#<P-S$Y("!;1G)E94)31%T``"YS:'-T<G1A
XM8@`N<F5L+G1E>'0`+F1A=&$`+F)S<P`N8V]M;65N=```````````````````
XM``````````````````````````````````````\````!````!@````````!`
-XM````,P``````````````$``````````+````"0``````````````W`$`````
+XM````,P``````````````$``````````+````"0```$``````````Q```````
XM`````````0````0````(````%0````$````#`````````'0`````````````
XM```````$`````````!L````(`````P````````!T````````````````````
XM!``````````@`````0``````````````=````"8```````````````$`````
XM`````0````,``````````````)H````I```````````````!`````````&$T
-XM+F\O("`@("`@("`@("`Q,C,Q-30T,3`S("`Q,#`Q("`P("`@("`Q,#`V-#0@
+XM+F\O("`@("`@("`@("`Q,3DT-3`Y,S0Y("`Q,#`Q("`P("`@("`Q,#`V-#0@
XM(#4T."`@("`@("!@"G]%3$8!`0$)```````````!``,``0``````````````
XMY``````````T```````H``@`!P````````````````!5B>6#[!C'1"0(````
XM`,=$)`0`````QP0D`````.C\____R<-M97-S86=E,0!M97-S86=E,@```&US
@@ -57,7 +57,7 @@ XM9S$@/2`E<PIM<V<R(#T@)7,*``!'0T,Z("A'3E4I(#0N,BXQ(#(P,#<P-S$Y
XM("!;1G)E94)31%T``"YS:'-T<G1A8@`N<F5L+G1E>'0`+F1A=&$`+F)S<P`N
XM<F]D871A`"YC;VUM96YT````````````````````````````````````````
XM```````````````/`````0````8`````````0````"0``````````````!``
-XM````````"P````D``````````````"0"``````````````$````$````"```
+XM````````"P````D```!``````````.0```````````````$````$````"```
XM`!4````!`````P````````!D````$@``````````````!``````````;````
XM"`````,`````````>`````````````````````0`````````(`````$````"
XM`````````'@````5```````````````!`````````"@````!````````````
diff --git a/test/elfcopy/tc/strip-all-archive-2/out/strip-all-archive-2.out.shar b/test/elfcopy/tc/strip-all-archive-2/out/strip-all-archive-2.out.shar
index 1efbed52ab9b..a5c6f68e6a90 100644
--- a/test/elfcopy/tc/strip-all-archive-2/out/strip-all-archive-2.out.shar
+++ b/test/elfcopy/tc/strip-all-archive-2/out/strip-all-archive-2.out.shar
@@ -11,22 +11,22 @@
echo x - liblong.a.1.uu
sed 's/^X//' >liblong.a.1.uu << '8eb77b0d36e0369a1b3adf0cc5ef193a'
Xbegin 644 liblong.a.1
-XM(3QA<F-H/@HO("`@("`@("`@("`@("`@,3(S,34T-#`V,B`@,"`@("`@,"`@
+XM(3QA<F-H/@HO("`@("`@("`@("`@("`@,30U,S`U-S8V."`@,"`@("`@,"`@
XM("`@,"`@("`@("`T("`@("`@("`@8`H`````+R\@("`@("`@("`@("`@("`@
XM("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@-#8@("`@("`@(&`*83%?
XM:&%S7V%?;&]N9U]F:6QE7VYA;64N;R\*831?:7-?,39?;&]N9U\N;R\*"B\P
-XM("`@("`@("`@("`@("`Q,C,Q-30T,#8R("`Q,#`Q("`P("`@("`Q,#`V-#0@
+XM("`@("`@("`@("`@("`Q,3DT-S<W.34U("`Q,#`Q("`P("`@("`Q,#`V-#0@
XM(#0U-B`@("`@("!@"G]%3$8!`0$)```````````!``,``0``````````````
XML``````````T```````H``<`!@````````````````!5B>7'!0`````%````
XMBT4,BU4(`<*A``````^OPEW#``!'0T,Z("A'3E4I(#0N,BXQ(#(P,#<P-S$Y
XM("!;1G)E94)31%T``"YS:'-T<G1A8@`N<F5L+G1E>'0`+F1A=&$`+F)S<P`N
XM8V]M;65N=```````````````````````````````````````````````````
XM``````\````!````!@````````!`````'P``````````````$``````````+
-XM````"0``````````````R`$``````````````0````0````(````%0````$`
+XM````"0```$``````````L````````````````0````0````(````%0````$`
XM```#`````````&`````````````````````$`````````!L````(`````P``
XM``````!@````````````````````!``````````@`````0``````````````
XM8````"8```````````````$``````````0````,``````````````(8````I
-XM```````````````!`````````&$R7VES7S$U7VQO;F<N;R\Q,C,Q-30T,#8R
+XM```````````````!`````````&$R7VES7S$U7VQO;F<N;R\Q,3DT-S<W.34U
XM("`Q,#`Q("`P("`@("`Q,#`V-#0@(#4R-"`@("`@("!@"G]%3$8!`0$)````
XM```````!``,``0``````````````S``````````T```````H``@`!P``````
XM``````````!5B>6#[`C'1"0$`````,<$)`````#H_/___\G#:&5L;&\L('=O
@@ -34,12 +34,12 @@ XM<FQD`````&US9SH@)7,*``!'0T,Z("A'3E4I(#0N,BXQ(#(P,#<P-S$Y("!;
XM1G)E94)31%T``"YS:'-T<G1A8@`N<F5L+G1E>'0`+F1A=&$`+F)S<P`N<F]D
XM871A`"YC;VUM96YT````````````````````````````````````````````
XM```````````/`````0````8`````````0````!P``````````````!``````
-XM````"P````D```````````````P"``````````````$````$````"````!4`
+XM````"P````D```!``````````,P```````````````$````$````"````!4`
XM```!`````P````````!<````#0``````````````!``````````;````"```
XM``,`````````;`````````````````````0`````````(`````$````"````
XM`````&P````)```````````````!`````````"@````!``````````````!U
XM````)@```````````````0`````````!`````P``````````````FP```#$`
-XM``````````````$`````````83-?;F]R;6%L+F\O("`@(#$R,S$U-#0P-C(@
+XM``````````````$`````````83-?;F]R;6%L+F\O("`@(#$Q.30W-S<Y-34@
XM(#$P,#$@(#`@("`@(#$P,#8T-"`@-#<V("`@("`@(&`*?T5,1@$!`0D`````
XM``````$``P`!``````````````#$`````````#0``````"@`!P`&````````
XM`````````%6)Y<<%``````$```#'!0`````"````BQ4`````BT4(B<$IT8G*
@@ -47,11 +47,11 @@ XMH0````")T2G!B<A=PP``1T-#.B`H1TY5*2`T+C(N,2`R,#`W,#<Q.2`@6T9R
XM965"4T1=```N<VAS=')T86(`+G)E;"YT97AT`"YD871A`"YB<W,`+F-O;6UE
XM;G0````````````````````````````````````````````````````````/
XM`````0````8`````````0````#,``````````````!``````````"P````D`
-XM`````````````-P!``````````````$````$````"````!4````!`````P``
+XM``!``````````,0```````````````$````$````"````!4````!`````P``
XM``````!T````````````````````!``````````;````"`````,`````````
XM=`````````````````````0`````````(`````$``````````````'0````F
XM```````````````!``````````$````#``````````````":````*0``````
-XM`````````0`````````O,C<@("`@("`@("`@("`@,3(S,34T-#`V,B`@,3`P
+XM`````````0`````````O,C<@("`@("`@("`@("`@,3$Y-#<W-SDU-2`@,3`P
XM,2`@,"`@("`@,3`P-C0T("`U-#@@("`@("`@8`I_14Q&`0$!"0``````````
XM`0`#``$``````````````.0`````````-```````*``(``<`````````````
XM````58GE@^P8QT0D"`````#'1"0$`````,<$)`````#H_/___\G#;65S<V%G
@@ -59,7 +59,7 @@ XM93$`;65S<V%G93(```!M<V<Q(#T@)7,*;7-G,B`]("5S"@``1T-#.B`H1TY5
XM*2`T+C(N,2`R,#`W,#<Q.2`@6T9R965"4T1=```N<VAS=')T86(`+G)E;"YT
XM97AT`"YD871A`"YB<W,`+G)O9&%T80`N8V]M;65N=```````````````````
XM````````````````````````````````````#P````$````&`````````$``
-XM```D```````````````0``````````L````)```````````````D`@``````
+XM```D```````````````0``````````L````)````0`````````#D````````
XM```````!````!`````@````5`````0````,`````````9````!(`````````
XM``````0`````````&P````@````#`````````'@````````````````````$
XM`````````"`````!`````@````````!X````%0```````````````0``````
diff --git a/test/elfcopy/tc/strip-debug-1/out/strip-debug-1.out.shar b/test/elfcopy/tc/strip-debug-1/out/strip-debug-1.out.shar
index 4e9730a296d8..e139296a9ae2 100644
--- a/test/elfcopy/tc/strip-debug-1/out/strip-debug-1.out.shar
+++ b/test/elfcopy/tc/strip-debug-1/out/strip-debug-1.out.shar
@@ -9,9 +9,9 @@
# sections.o.uu
#
echo x - sections.o.1.uu
-sed 's/^X//' >sections.o.1.uu << 'END-of-sections.o.1.uu'
+sed 's/^X//' >sections.o.1.uu << 'eb2ac2808b7045ab3c2faf26922f5e01'
Xbegin 644 sections.o.1
-XM?T5,1@(!`0D```````````$`/@`!`````````````````````````!`>````
+XM?T5,1@(!`0D```````````$`/@`!`````````````````````````#`]````
XM`````````$```````$``#0`*`$B+E\````!(A=)T'TB+1B!(.T(@<PSK/$@Y
XM0B!F9F:0=S)(BU)82(72=>U(QT98`````$B+A\@```!(B49@2(N'R````$B)
XM,$B-1EA(B8?(````PTB+0F!(B5982(E&8$B+0F!(B3!(C4982(E"8,-,B60D
@@ -182,207 +182,207 @@ XM`-L`````00X0A@)%#AA$#B"#`P``-````!P"````````[@8```!"#A!"#AA"
XM#B!"#BA!#C!!#CA'#M`!@P>&!HP%C02.`X\"````````+G-Y;71A8@`N<W1R
XM=&%B`"YS:'-T<G1A8@`N<F5L82YT97AT`"YD871A`"YB<W,`+F-O;6UE;G0`
XM+G)O9&%T82YS='(Q+C$`+G)O9&%T82YS='(Q+C@`+G)E;&$N96A?9G)A;64`
+XM```````````````````````````````````````#``$`````````````````
+XM``````$````"``$```````````!P```````````````#``8`````````````
+XM`````````!0````"``$`,`,```````!K```````````````#``<`````````
+XM`````````````"0````"``$`L`H````````B`````````#@````"``$`X`H`
+XM```````W`````````$H````"``$`(`L```````!``0```````%P````"``$`
+XM$!````````#;```````````````#``,````````````````````````````#
+XM``0````````````````````````````#``4`````````````````````````
+XM```#``@``````````````````````&<````2``$`<`````````"V`0``````
+XM`'0````0`````````````````````````($````0````````````````````
+XM`````(T````0`````````````````````````)X````0````````````````
+XM`````````*D````0`````````````````````````+D````0````````````
+XM`````````````,$````0`````````````````````````,P````0````````
+XM`````````````````-$````2``$`,`(```````#\`````````-T````0````
+XM`````````````````````.L````0`````````````````````````/4````0
+XM``````````````````````````8!```2``$`H`,```````#I`0```````!8!
+XM```0`````````````````````````"$!```0````````````````````````
+XM`"@!```0`````````````````````````"P!```2``$`D`4```````#T````
+XM`````#8!```0`````````````````````````$(!```2``$`D`8````````Y
+XM`0```````$P!```2``$`T`<````````O`0```````%P!```0````````````
+XM`````````````&(!```2``$```D```````#_`````````&\!```0````````
+XM`````````````````'P!```0`````````````````````````(<!```2``$`
+XM``H```````"B`````````)8!```0`````````````````````````)T!```0
+XM`````````````````````````*0!```0`````````````````````````*L!
+XM```0`````````````````````````+(!```0````````````````````````
+XM`+H!```2``$`8`P```````"F`P```````,4!```0````````````````````
+XM`````-4!```0`````````````````````````.$!```0````````````````
+XM`````````.P!```0`````````````````````````/X!```0````````````
+XM``````````````L"```0`````````````````````````!4"```0````````
+XM`````````````````!H"```0`````````````````````````"("```2``$`
+XM\!````````#N!@```````"\"```0`````````````````````````#T"```0
+XM`````````````````````````$0"```0`````````````````````````$P"
+XM```0`````````````````````````%@"```0````````````````````````
+XM``!I;G-E<G1?=&]?<V5C7VQI<W0`861D7W1O7W-H<W1R=&%B`&ES7V-O;7!R
+XM97-S7W-E8W1I;VX`:7-?87!P96YD7W-E8W1I;VX`:7-?<F5M;W9E7W-E8W1I
+XM;VX`<')I;G1?9&%T80!S971?<VAS=')T86(`9V5L9E]G971S:&1R`&5L9E]N
+XM97=D871A`&=E;&9?=7!D871E7W-H9'(`96QF7VYD>'-C;@!E;&9?<V5T<VAS
+XM=')N9'@`;65M;6]V90!E;&9?97)R;7-G`&5R<G@`=7!D871E7W-H9'(`;&]O
+XM:W5P7W-T<FEN9P!E;&9?97)R;F\`:6YS97)T7W1O7W-T<G1A8@!A9&1?=6YL
+XM;V%D86)L97,`96QF7VYE=W-C;@!C86QL;V,`97)R`&-O<'E?9&%T80!E;&9?
+XM9V5T9&%T80!C;W!Y7W-H9'(`<F5S>6YC7W-E8W1I;VYS`'=A<FYX`&EN<V5R
+XM=%]S:'1A8@!G96QF7V=E=&5H9'(`9V5L9E]F<VEZ90!L;V]K=7!?<V5C7V%C
+XM=`!S=')C;7``;6%L;&]C`&UE;7-E=`!S=')L96X`<W1R;F-M<`!C<F5A=&5?
+XM<V-N`&5L9E]G971S:'-T<FYD>`!E;&9?;F5X='-C;@!E;&9?<W1R<'1R`&%D
+XM9%]T;U]I;G-E9U]L:7-T`%]?:7-T:')E861E9`!?7W-T9&]U='``<'5T8P!?
+XM7W-W8G5F`&-O<'E?8V]N=&5N=`!C<F5A=&5?<WEM=&%B`&UE;6-P>0!S=')N
+XM8W!Y`&=E;&9?9V5T<F5L`&QO;VMU<%]K965P7W-Y;6QI<W0``````)<`````
+XM`````@````\```#\_________^X``````````@```!````#\_________QL!
+XM`````````@```!$```#\_________UD!`````````@```!(```#\________
+XM_V8!`````````@```!,```#\_________Z4!`````````@```!0```#\____
+XM_____[0!`````````@```!4```#\_________[D!````````"@````,`````
+XM`````````,@!`````````@```!8```#\_________](!`````````@```!4`
+XM``#\_________]<!````````"@````,````>`````````.8!`````````@``
+XM`!8```#\__________`!`````````@```!4```#\__________4!````````
+XM"@````,````W``````````0"`````````@```!8```#\_________PX"````
+XM`````@```!4```#\_________Q,"````````"@````,```!5`````````"("
+XM`````````@```!8```#\_________T\"`````````@````\```#\________
+XM_V`"`````````@```!@```#\_________Y<"`````````@```!(```#\____
+XM_____Z@"`````````@```!$```#\_________[H"`````````@```!D```#\
+XM_________]L"`````````@```!4```#\_________^`"````````"@````,`
+XM``!R`````````.\"`````````@```!8```#\__________D"`````````@``
+XM`!4```#\__________X"````````"@````,````W``````````T#````````
+XM`@```!8```#\_________Q0#`````````@```!4```#\_________QD#````
+XM````"@````,```".`````````"@#`````````@```!8```#\_________VD#
+XM````````"@````,```"E`````````&X#`````````@```!H```#\________
+XM_W8#````````"@````,```"F`````````'L#`````````@```!H```#\____
+XM_____X,#````````"@````,```"N`````````(@#`````````@```!H```#\
+XM_________XT#````````"@````,```"V`````````)4#`````````@```!H`
+XM``#\_________[T#````````"@````,```"V`````````/4#`````````@``
+XM`!P```#\_________Q`$`````````@```!T```#\_________V\$````````
+XM`@```!````#\_________[,$`````````@````\```#\_________]H$````
+XM`````@```!$```#\_________P8%`````````@```!4```#\_________PL%
+XM````````"@````,```#``````````!H%`````````@```!8```#\________
+XM_Q\%````````"@````,```#8`````````"L%`````````@```!X```#\____
+XM_____S4%`````````@```!4```#\_________SH%````````"@````,````>
+XM`````````$D%`````````@```!8```#\_________U,%`````````@```!4`
+XM``#\_________U@%````````"@````,```#E`````````&<%`````````@``
+XM`!8```#\_________W$%`````````@```!4```#\_________W8%````````
+XM"@````,````W`````````(4%`````````@```!8```#\_________[4%````
+XM`````@```!````#\__________X%`````````@```"````#\_________PL&
+XM`````````@```!D```#\_________U$&`````````@```!4```#\________
+XM_U8&````````"@````,````>`````````&4&`````````@```!8```#\____
+XM_____VP&`````````@```!4```#\_________W$&````````"@````,````#
+XM`0```````(`&`````````@```!8```#\_________[T&`````````@````\`
+XM``#\_________]$&`````````@````\```#\_________S\'`````````@``
+XM`!$```#\_________W4'`````````@```!4```#\_________WH'````````
+XM"@````,````<`0```````(D'`````````@```!8```#\_________Y,'````
+XM`````@```!4```#\_________Y@'````````"@````,````Z`0```````*<'
+XM`````````@```!8```#\_________[$'`````````@```!4```#\________
+XM_[8'````````"@````,```!8`0```````,4'`````````@```!8```#\____
+XM_____TL(`````````@````\```#\_________VX(`````````@```!$```#\
+XM_________[,(````````"@````4``````````````+H(`````````@```",`
+XM``#\_________\D(`````````@```!4```#\_________\X(````````"@``
+XM``,```!S`0```````-T(`````````@```!8```#\_________^<(````````
+XM`@```!4```#\_________^P(````````"@````,```!8`0```````/L(````
+XM`````@```!8```#\_________Q$)`````````@```"4```#\_________RD)
+XM`````````@```!T```#\_________WH)`````````@```"8```#\________
+XM_[@)`````````@```!4```#\_________[T)````````"@````,```"1`0``
+XM`````,P)`````````@```!8```#\_________]8)`````````@```!4```#\
+XM_________]L)````````"@````,```"Y`0```````.H)`````````@```!8`
+XM``#\_________^\)````````"@````,```"K`0```````/L)`````````@``
+XM`!8```#\_________S$*`````````@```"@```#\_________U0*````````
+XM`@```"D```#\_________VL*`````````@```"H```#\_________Y0*````
+XM````"@````,```#1`0```````)X*`````````@```!8```#\_________[<*
+XM`````````@```"<```#\_________^<*`````````@```"<```#\________
+XM_T(+````````"@````,```"V`````````&D+````````"@````,```"F````
+XM`````(8+````````"@````,```"N`````````)<+````````"@````,```#C
+XM`0```````*(+````````"P````,```#C`0```````*L+````````"P````,`
+XM``#J`0```````+0+````````"P````,```#\`0```````+T+````````"P``
+XM``,````"`@```````.(+`````````@```"L```#\__________`+````````
+XM`@```"P```#\_________R(,`````````@```"<```#\_________W\,````
+XM`````@```!T```#\_________Y,,````````"P````,```"V`````````,L,
+XM`````````@```"X```#\_________^@,`````````@```"\```#\________
+XM__\,`````````@````\```#\_________QT-`````````@```#````#\____
+XM_____U0-````````"@````,```"V`````````'X-`````````@```!P```#\
+XM_________Y,-`````````@```!(```#\_________[@-````````"@````,`
+XM``"F`````````-(-````````"@````,```"N`````````!$.`````````@``
+XM`"X```#\_________RH.`````````@```"\```#\_________SX.````````
+XM`@```!(```#\_________TX.`````````@````\```#\_________VL.````
+XM`````@```#````#\_________YL.`````````@```!T```#\_________]P.
+XM`````````@```#$```#\__________<.`````````@```"$```#\________
+XM_P$/`````````@```!D```#\_________Q`/`````````@```!4```#\____
+XM_____Q4/````````"@````,```".`````````"0/`````````@```!8```#\
+XM_________RD/`````````@```!D```#\_________TD/`````````@```!4`
+XM``#\_________TX/````````"@````,````_`@```````%T/`````````@``
+XM`!8```#\_________V</`````````@```!4```#\_________VP/````````
+XM"@````,````C`@```````'L/`````````@```!8```#\_________X4/````
+XM`````@```!4```#\_________XH/````````"@````,```"#`@```````)D/
+XM`````````@```!8```#\_________Z,/`````````@```!4```#\________
+XM_Z@/````````"@````,```!M`@```````+</`````````@```!8```#\____
+XM_____[P/````````"@````,```"K`0```````,8/`````````@```!X```#\
+XM_________]`/`````````@```!4```#\_________]4/````````"@````,`
+XM```(`@```````.0/`````````@```!8```#\_________^X/`````````@``
+XM`!4```#\__________,/````````"@````,```!5`@````````(0````````
+XM`@```!8```#\_________R80`````````@```#(```#\_________S$0````
+XM`````@```#,```#\_________V40`````````@```#(```#\_________W`0
+XM`````````@```#,```#\_________Z00`````````@```#,```#\________
+XM_ZX0`````````@```#0```#\_________[<0`````````@```#,```#\____
+XM_____[\0`````````@```#0```#\_________],0`````````@```#4```#\
+XM_________^(0`````````@```#4```#\_________S<1````````"@````,`
+XM``"F`````````%<1`````````@```#<```#\_________X`1````````"@``
+XM``,```"N`````````)(1````````"@````,```"V`````````.H1````````
+XM`@```"D```#\_________PP2`````````@```#@```#\_________R$2````
+XM`````@```"````#\_________SL2`````````@```"D```#\_________UD2
+XM`````````@````\```#\_________\$2`````````@```!D```#\________
+XM_P(3`````````@```"D```#\_________ZD3`````````@```"L```#\____
+XM_____\$3`````````@```"@```#\_________PD4`````````@```!\```#\
+XM_________QD4`````````@```"<```#\_________V`4`````````@```"``
+XM``#\_________VT4`````````@```!D```#\_________WL4`````````@``
+XM`#(```#\_________XH4`````````@```#,```#\_________]84````````
+XM`@```#D```#\_________S85`````````@```#D```#\_________U`5````
+XM`````@```"<```#\_________UP5`````````@```"L```#\_________W05
+XM`````````@```#D```#\_________Z(5`````````@```#@```#\________
+XM_[<5`````````@```"<```#\_________\`5`````````@```"L```#\____
+XM_____]05````````"@````,```"^`@```````.`5`````````@```!X```#\
+XM_________^<5`````````@```#,```#\__________$5`````````@```#0`
+XM``#\_________R46`````````@```"````#\_________T,6`````````@``
+XM`#H```#\_________V<6`````````@```!(```#\_________WL6````````
+XM`@```#````#\_________Y$6`````````@```#L```#\_________ZH6````
+XM`````@```"D```#\_________]H6`````````@```#4```#\_________^D6
+XM`````````@```"D```#\_________Q,7`````````@```!4```#\________
+XM_Q@7````````"@````,````#`0```````"<7`````````@```!8```#\____
+XM_____RP7````````"@````,```"P`@```````#87`````````@```!X```#\
+XM_________T`7`````````@```!4```#\_________T47````````"@````,`
+XM``"1`0```````%07`````````@```!8```#\_________UX7`````````@``
+XM`!4```#\_________V,7````````"@````,````_`@```````'(7````````
+XM`@```!8```#\_________WP7`````````@```!4```#\_________X$7````
+XM````"@````,```"9`@```````)`7`````````@```!8```#\_________Y47
+XM`````````@```!D```#\_________\47`````````@```"8```#\________
+XM_V$#`````````@```!H```#\_________R``````````"@````$`````````
+XM`````#@`````````"@````$```!P`````````%@`````````"@````$````P
+XM`@```````(``````````"@````$````P`P```````)@`````````"@````$`
+XM``"@`P```````,@`````````"@````$```"0!0```````.@`````````"@``
+XM``$```"0!@````````@!````````"@````$```#0!P```````#`!````````
+XM"@````$`````"0```````%`!````````"@````$`````"@```````'@!````
+XM````"@````$```"P"@```````)`!````````"@````$```#@"@```````*@!
+XM````````"@````$````@"P```````,@!````````"@````$```!@#```````
+XM```"````````"@````$````0$````````"`"````````"@````$```#P$```
XM````````````````````````````````````````````````````````````
-XM```````````````````````````@`````0````8```````````````````!`
-XM`````````-X7```````````````````0````````````````````&P````0`
-XM````````````````````````8"D```````"0%0````````L````!````"```
-XM```````8`````````"8````!`````P```````````````````"`8````````
-XM``````````````````````0````````````````````L````"`````,`````
-XM```````````````@&``````````````````````````````$````````````
-XM````````,0````$`````````````````````````(!@````````P````````
-XM`````````````0```````````````````#H````!````,@``````````````
-XM`````%`8````````UP(```````````````````$``````````0````````!)
-XM`````0```#(````````````````````H&P```````"T`````````````````
-XM```(``````````$`````````70````$````"````````````````````6!L`
-XM``````!0`@``````````````````"````````````````````%@````$````
-XM`````````````````````/`^````````@`$````````+````"`````@`````
-XM````&``````````1`````P````````````````````````"H'0```````&<`
-XM```````````````````!`````````````````````0````(`````````````
-XM````````````4"$```````"@!0````````P````.````"``````````8````
-XM``````D````#`````````````````````````/`F````````;`(`````````
-XM``````````$`````````````````````````````````````````````````
-XM`````````P`!```````````````````````!`````@`!````````````<```
-XM`````````````P`&```````````````````````4`````@`!`#`#````````
-XM:P```````````````P`'```````````````````````D`````@`!`+`*````
-XM````(@`````````X`````@`!`.`*````````-P````````!*`````@`!`"`+
-XM````````0`$```````!<`````@`!`!`0````````VP```````````````P`#
-XM`````````````````````````````P`$````````````````````````````
-XM`P`%`````````````````````````````P`(``````````````````````!G
-XM````$@`!`'``````````M@$```````!T````$```````````````````````
-XM``"!````$`````````````````````````"-````$```````````````````
-XM``````">````$`````````````````````````"I````$```````````````
-XM``````````"Y````$`````````````````````````#!````$```````````
-XM``````````````#,````$`````````````````````````#1````$@`!`#`"
-XM````````_`````````#=````$`````````````````````````#K````$```
-XM``````````````````````#U````$``````````````````````````&`0``
-XM$@`!`*`#````````Z0$````````6`0``$``````````````````````````A
-XM`0``$``````````````````````````H`0``$```````````````````````
-XM```L`0``$@`!`)`%````````]``````````V`0``$```````````````````
-XM``````!"`0``$@`!`)`&````````.0$```````!,`0``$@`!`-`'````````
-XM+P$```````!<`0``$`````````````````````````!B`0``$@`!```)````
-XM````_P````````!O`0``$`````````````````````````!\`0``$```````
-XM``````````````````"'`0``$@`!```*````````H@````````"6`0``$```
-XM``````````````````````"=`0``$`````````````````````````"D`0``
-XM$`````````````````````````"K`0``$`````````````````````````"R
-XM`0``$`````````````````````````"Z`0``$@`!`&`,````````I@,`````
-XM``#%`0``$`````````````````````````#5`0``$```````````````````
-XM``````#A`0``$`````````````````````````#L`0``$```````````````
-XM``````````#^`0``$``````````````````````````+`@``$```````````
-XM```````````````5`@``$``````````````````````````:`@``$```````
-XM```````````````````B`@``$@`!`/`0````````[@8````````O`@``$```
-XM```````````````````````]`@``$`````````````````````````!$`@``
-XM$`````````````````````````!,`@``$`````````````````````````!8
-XM`@``$```````````````````````````:6YS97)T7W1O7W-E8U]L:7-T`&%D
-XM9%]T;U]S:'-T<G1A8@!I<U]C;VUP<F5S<U]S96-T:6]N`&ES7V%P<&5N9%]S
-XM96-T:6]N`&ES7W)E;6]V95]S96-T:6]N`'!R:6YT7V1A=&$`<V5T7W-H<W1R
-XM=&%B`&=E;&9?9V5T<VAD<@!E;&9?;F5W9&%T80!G96QF7W5P9&%T95]S:&1R
-XM`&5L9E]N9'AS8VX`96QF7W-E='-H<W1R;F1X`&UE;6UO=F4`96QF7V5R<FUS
-XM9P!E<G)X`'5P9&%T95]S:&1R`&QO;VMU<%]S=')I;F<`96QF7V5R<FYO`&EN
-XM<V5R=%]T;U]S=')T86(`861D7W5N;&]A9&%B;&5S`&5L9E]N97=S8VX`8V%L
-XM;&]C`&5R<@!C;W!Y7V1A=&$`96QF7V=E=&1A=&$`8V]P>5]S:&1R`')E<WEN
-XM8U]S96-T:6]N<P!W87)N>`!I;G-E<G1?<VAT86(`9V5L9E]G971E:&1R`&=E
-XM;&9?9G-I>F4`;&]O:W5P7W-E8U]A8W0`<W1R8VUP`&UA;&QO8P!M96US970`
-XM<W1R;&5N`'-T<FYC;7``8W)E871E7W-C;@!E;&9?9V5T<VAS=')N9'@`96QF
-XM7VYE>'1S8VX`96QF7W-T<G!T<@!A9&1?=&]?:6YS96=?;&ES=`!?7VES=&AR
-XM96%D960`7U]S=&1O=71P`'!U=&,`7U]S=V)U9@!C;W!Y7V-O;G1E;G0`8W)E
-XM871E7W-Y;71A8@!M96UC<'D`<W1R;F-P>0!G96QF7V=E=')E;`!L;V]K=7!?
-XM:V5E<%]S>6UL:7-T``````"7``````````(````/````_/_________N````
-XM``````(````0````_/________\;`0````````(````1````_/________]9
-XM`0````````(````2````_/________]F`0````````(````3````_/______
-XM__^E`0````````(````4````_/________^T`0````````(````5````_/__
-XM______^Y`0````````H````#``````````````#(`0````````(````6````
-XM_/_________2`0````````(````5````_/_________7`0````````H````#
-XM````'@````````#F`0````````(````6````_/_________P`0````````(`
-XM```5````_/_________U`0````````H````#````-P`````````$`@``````
-XM``(````6````_/________\.`@````````(````5````_/________\3`@``
-XM``````H````#````50`````````B`@````````(````6````_/________]/
-XM`@````````(````/````_/________]@`@````````(````8````_/______
-XM__^7`@````````(````2````_/________^H`@````````(````1````_/__
-XM______^Z`@````````(````9````_/_________;`@````````(````5````
-XM_/_________@`@````````H````#````<@````````#O`@````````(````6
-XM````_/_________Y`@````````(````5````_/_________^`@````````H`
-XM```#````-P`````````-`P````````(````6````_/________\4`P``````
-XM``(````5````_/________\9`P````````H````#````C@`````````H`P``
-XM``````(````6````_/________]I`P````````H````#````I0````````!N
-XM`P````````(````:````_/________]V`P````````H````#````I@``````
-XM``![`P````````(````:````_/________^#`P````````H````#````K@``
-XM``````"(`P````````(````:````_/________^-`P````````H````#````
-XMM@````````"5`P````````(````:````_/________^]`P````````H````#
-XM````M@````````#U`P````````(````<````_/________\0!`````````(`
-XM```=````_/________]O!`````````(````0````_/________^S!```````
-XM``(````/````_/_________:!`````````(````1````_/________\&!0``
-XM``````(````5````_/________\+!0````````H````#````P``````````:
-XM!0````````(````6````_/________\?!0````````H````#````V```````
-XM```K!0````````(````>````_/________\U!0````````(````5````_/__
-XM______\Z!0````````H````#````'@````````!)!0````````(````6````
-XM_/________]3!0````````(````5````_/________]8!0````````H````#
-XM````Y0````````!G!0````````(````6````_/________]Q!0````````(`
-XM```5````_/________]V!0````````H````#````-P````````"%!0``````
-XM``(````6````_/________^U!0````````(````0````_/_________^!0``
-XM``````(````@````_/________\+!@````````(````9````_/________]1
-XM!@````````(````5````_/________]6!@````````H````#````'@``````
-XM``!E!@````````(````6````_/________]L!@````````(````5````_/__
-XM______]Q!@````````H````#`````P$```````"`!@````````(````6````
-XM_/________^]!@````````(````/````_/_________1!@````````(````/
-XM````_/________\_!P````````(````1````_/________]U!P````````(`
-XM```5````_/________]Z!P````````H````#````'`$```````")!P``````
-XM``(````6````_/________^3!P````````(````5````_/________^8!P``
-XM``````H````#````.@$```````"G!P````````(````6````_/________^Q
-XM!P````````(````5````_/________^V!P````````H````#````6`$`````
-XM``#%!P````````(````6````_/________]+"`````````(````/````_/__
-XM______]N"`````````(````1````_/________^S"`````````H````%````
-XM``````````"Z"`````````(````C````_/_________)"`````````(````5
-XM````_/_________."`````````H````#````<P$```````#="`````````(`
-XM```6````_/_________G"`````````(````5````_/_________L"```````
-XM``H````#````6`$```````#["`````````(````6````_/________\1"0``
-XM``````(````E````_/________\I"0````````(````=````_/________]Z
-XM"0````````(````F````_/________^X"0````````(````5````_/______
-XM__^]"0````````H````#````D0$```````#,"0````````(````6````_/__
-XM_______6"0````````(````5````_/_________;"0````````H````#````
-XMN0$```````#J"0````````(````6````_/_________O"0````````H````#
-XM````JP$```````#["0````````(````6````_/________\Q"@````````(`
-XM```H````_/________]4"@````````(````I````_/________]K"@``````
-XM``(````J````_/________^4"@````````H````#````T0$```````">"@``
-XM``````(````6````_/________^W"@````````(````G````_/_________G
-XM"@````````(````G````_/________]""P````````H````#````M@``````
-XM``!I"P````````H````#````I@````````"&"P````````H````#````K@``
-XM``````"7"P````````H````#````XP$```````"B"P````````L````#````
-XMXP$```````"K"P````````L````#````Z@$```````"T"P````````L````#
-XM````_`$```````"]"P````````L````#`````@(```````#B"P````````(`
-XM```K````_/_________P"P````````(````L````_/________\B#```````
-XM``(````G````_/________]_#`````````(````=````_/________^3#```
-XM``````L````#````M@````````#+#`````````(````N````_/_________H
-XM#`````````(````O````_/__________#`````````(````/````_/______
-XM__\=#0````````(````P````_/________]4#0````````H````#````M@``
-XM``````!^#0````````(````<````_/________^3#0````````(````2````
-XM_/________^X#0````````H````#````I@````````#2#0````````H````#
-XM````K@`````````1#@````````(````N````_/________\J#@````````(`
-XM```O````_/________\^#@````````(````2````_/________].#@``````
-XM``(````/````_/________]K#@````````(````P````_/________^;#@``
-XM``````(````=````_/_________<#@````````(````Q````_/_________W
-XM#@````````(````A````_/________\!#P````````(````9````_/______
-XM__\0#P````````(````5````_/________\5#P````````H````#````C@``
-XM```````D#P````````(````6````_/________\I#P````````(````9````
-XM_/________])#P````````(````5````_/________].#P````````H````#
-XM````/P(```````!=#P````````(````6````_/________]G#P````````(`
-XM```5````_/________]L#P````````H````#````(P(```````![#P``````
-XM``(````6````_/________^%#P````````(````5````_/________^*#P``
-XM``````H````#````@P(```````"9#P````````(````6````_/________^C
-XM#P````````(````5````_/________^H#P````````H````#````;0(`````
-XM``"W#P````````(````6````_/________^\#P````````H````#````JP$`
-XM``````#&#P````````(````>````_/_________0#P````````(````5````
-XM_/_________5#P````````H````#````"`(```````#D#P````````(````6
-XM````_/_________N#P````````(````5````_/_________S#P````````H`
-XM```#````50(````````"$`````````(````6````_/________\F$```````
-XM``(````R````_/________\Q$`````````(````S````_/________]E$```
-XM``````(````R````_/________]P$`````````(````S````_/________^D
-XM$`````````(````S````_/________^N$`````````(````T````_/______
-XM__^W$`````````(````S````_/________^_$`````````(````T````_/__
-XM_______3$`````````(````U````_/_________B$`````````(````U````
-XM_/________\W$0````````H````#````I@````````!7$0````````(````W
-XM````_/________^`$0````````H````#````K@````````"2$0````````H`
-XM```#````M@````````#J$0````````(````I````_/________\,$@``````
-XM``(````X````_/________\A$@````````(````@````_/________\[$@``
-XM``````(````I````_/________]9$@````````(````/````_/_________!
-XM$@````````(````9````_/________\"$P````````(````I````_/______
-XM__^I$P````````(````K````_/_________!$P````````(````H````_/__
-XM______\)%`````````(````?````_/________\9%`````````(````G````
-XM_/________]@%`````````(````@````_/________]M%`````````(````9
-XM````_/________][%`````````(````R````_/________^*%`````````(`
-XM```S````_/_________6%`````````(````Y````_/________\V%0``````
-XM``(````Y````_/________]0%0````````(````G````_/________]<%0``
-XM``````(````K````_/________]T%0````````(````Y````_/________^B
-XM%0````````(````X````_/________^W%0````````(````G````_/______
-XM___`%0````````(````K````_/_________4%0````````H````#````O@(`
-XM``````#@%0````````(````>````_/_________G%0````````(````S````
-XM_/_________Q%0````````(````T````_/________\E%@````````(````@
-XM````_/________]#%@````````(````Z````_/________]G%@````````(`
-XM```2````_/________][%@````````(````P````_/________^1%@``````
-XM``(````[````_/________^J%@````````(````I````_/_________:%@``
-XM``````(````U````_/_________I%@````````(````I````_/________\3
-XM%P````````(````5````_/________\8%P````````H````#`````P$`````
-XM```G%P````````(````6````_/________\L%P````````H````#````L`(`
-XM```````V%P````````(````>````_/________]`%P````````(````5````
-XM_/________]%%P````````H````#````D0$```````!4%P````````(````6
-XM````_/________]>%P````````(````5````_/________]C%P````````H`
-XM```#````/P(```````!R%P````````(````6````_/________]\%P``````
-XM``(````5````_/________^!%P````````H````#````F0(```````"0%P``
-XM``````(````6````_/________^5%P````````(````9````_/_________%
-XM%P````````(````F````_/________]A`P````````(````:````_/______
-XM__\@``````````H````!```````````````X``````````H````!````<```
-XM``````!8``````````H````!````,`(```````"```````````H````!````
-XM,`,```````"8``````````H````!````H`,```````#(``````````H````!
-XM````D`4```````#H``````````H````!````D`8````````(`0````````H`
-XM```!````T`<````````P`0````````H````!``````D```````!0`0``````
-XM``H````!``````H```````!X`0````````H````!````L`H```````"0`0``
-XM``````H````!````X`H```````"H`0````````H````!````(`L```````#(
-XM`0````````H````!````8`P``````````@````````H````!````$!``````
-X:```@`@````````H````!````\!``````````
+XM```````````````````````````````@`````0````8`````````````````
+XM``!``````````-X7```````````````````0````````````````````&P``
+XM``0```!`````````````````````("8```````"0%0````````L````!````
+XM"``````````8`````````"8````!`````P```````````````````"`8````
+XM``````````````````````````0````````````````````L````"`````,`
+XM```````````````````@&``````````````````````````````$````````
+XM````````````,0````$`````````````````````````(!@````````P````
+XM`````````````````0```````````````````#H````!````,@``````````
+XM`````````%`8````````UP(```````````````````$``````````0``````
+XM``!)`````0```#(````````````````````H&P```````"T`````````````
+XM```````(``````````$`````````70````$````"````````````````````
+XM6!L```````!0`@``````````````````"````````````````````%@````$
+XM````0````````````````````+`[````````@`$````````+````"`````@`
+XM````````&``````````1`````P````````````````````````"H'0``````
+XM`&<````````````````````!`````````````````````0````(`````````
+XM````````````````$!X```````"@!0````````P````.````"``````````8
+XM``````````D````#`````````````````````````+`C````````;`(`````
+X:``````````````$`````````````````````
X`
Xend
-END-of-sections.o.1.uu
+eb2ac2808b7045ab3c2faf26922f5e01
echo x - sections.o.uu
-sed 's/^X//' >sections.o.uu << 'END-of-sections.o.uu'
+sed 's/^X//' >sections.o.uu << 'f3eccedeeefe85afebc666fca5eb0742'
Xbegin 644 sections.o
XM?T5,1@(!`0D```````````$`/@`!`````````````````````````"!Q````
XM`````````$```````$``&P`8`$B+E\````!(A=)T'TB+1B!(.T(@<PSK/$@Y
@@ -1498,6 +1498,6 @@ XM```*`````@```/`0````````!@`````````*````!@``````````````!@``
XM```````*````!@``````````````$``````````!`````@``````````````
X`
Xend
-END-of-sections.o.uu
+f3eccedeeefe85afebc666fca5eb0742
exit
diff --git a/test/elfcopy/tc/strip-debug-2/out/strip-debug-2.out.shar b/test/elfcopy/tc/strip-debug-2/out/strip-debug-2.out.shar
index 37bd10aff4a2..249ede99598c 100644
--- a/test/elfcopy/tc/strip-debug-2/out/strip-debug-2.out.shar
+++ b/test/elfcopy/tc/strip-debug-2/out/strip-debug-2.out.shar
@@ -9,9 +9,9 @@
# symbols.o.uu
#
echo x - symbols.o.1.uu
-sed 's/^X//' >symbols.o.1.uu << 'END-of-symbols.o.1.uu'
+sed 's/^X//' >symbols.o.1.uu << '7e9b8d093a79e3138d3b7dc9490f1606'
Xbegin 644 symbols.o.1
-XM?T5,1@(!`0D```````````$`/@`!`````````````````````````)`<````
+XM?T5,1@(!`0D```````````$`/@`!`````````````````````````%@O````
XM`````````$```````$``#``)``^V1P3`Z`0L`0^4P`^VP,,/MD<$P.@$A,`/
XME,`/ML##54B)]5-(@^P(2(N?T````$B%VW4+ZR%(BUL(2(7;=!A(BS-(B>_H
XM`````(7`=>A(@\0(L`%;7<-(@\0(,<!;7<-F9F:09F9FD&9F9I!F9I!(B5PD
@@ -174,135 +174,135 @@ XM`&8`````3@X@A@*#`S0```"<`````````/H7````0@X01PX80@X@C02.`X\"
XM10XH00XP00XX1P[@!(,'A@:,!0```````"YS>6UT86(`+G-T<G1A8@`N<VAS
XM=')T86(`+G)E;&$N=&5X=``N9&%T80`N8G-S`"YC;VUM96YT`"YR;V1A=&$N
XM<W1R,2XQ`"YR96QA+F5H7V9R86UE````````````````````````````````
-XM```````````````````````````````````````````````````````@````
-XM`0````8```````````````````!``````````$H9```````````````````0
-XM````````````````````&P````0`````````````````````````("4`````
-XM``"H#`````````H````!````"``````````8`````````"8````!`````P``
-XM`````````````````(P9``````````````````````````````0`````````
-XM```````````L````"`````,```````````````````",&0``````````````
-XM```````````````$````````````````````,0````$`````````````````
-XM````````C!D````````P`````````````````````0``````````````````
-XM`#H````!````,@```````````````````+P9````````K`$`````````````
-XM``````$``````````0````````!.`````0````(```````````````````!H
-XM&P```````-`````````````````````(````````````````````20````0`
-XM````````````````````````R#$```````"0``````````H````'````"```
-XM```````8`````````!$````#`````````````````````````#@<````````
-XM6`````````````````````$````````````````````!`````@``````````
-XM``````````````"0'P```````/`#````````"P````D````(`````````!@`
-XM````````"0````,`````````````````````````@",```````"<`0``````
-XM`````````````0``````````````````````````````````````````````
-XM```````````#``$```````````````````````$````"``$````````````0
-XM`````````!(````"``$`$``````````0```````````````#``8`````````
-XM```````````````````#``,````````````````````````````#``0`````
-XM```````````````````````#``4````````````````````````````#``<`
-XM`````````````````````"(````2``$`(`````````!!`````````#8````0
-XM`````````````````````````#T````2``$`<`````````!F`````````$\`
-XM```0`````````````````````````%8````0````````````````````````
-XM`%L````2``$`X`````````!F`````````&P````2``$`4`$```````#Z%P``
-XM`````'H````0`````````````````````````(0````0````````````````
-XM`````````)$````0`````````````````````````*$````0````````````
-XM`````````````*\````0`````````````````````````+8````0````````
-XM`````````````````,(````0`````````````````````````,T````0````
-XM`````````````````````-@````0`````````````````````````.(````0
-XM`````````````````````````.<````0`````````````````````````/,`
-XM```0`````````````````````````/X````0````````````````````````
-XM``H!```0`````````````````````````!8!```0````````````````````
-XM`````"`!```0`````````````````````````#$!```0````````````````
-XM`````````#P!```0`````````````````````````$0!```0````````````
-XM`````````````$L!```0`````````````````````````%,!```0````````
-XM`````````````````%<!```0`````````````````````````&D!```0````
-XM`````````````````````'T!```0`````````````````````````(H!```0
-XM`````````````````````````)`!```0``````````````````````````!I
-XM<U]G;&]B86Q?<WEM8F]L`&ES7VQO8V%L7W-Y;6)O;`!L;V]K=7!?:V5E<%]S
-XM>6UL:7-T`'-T<F-M<`!A9&1?=&]?<W1R:7!?;&ES=`!M86QL;V,`97)R>`!A
-XM9&1?=&]?:V5E<%]L:7-T`&-R96%T95]S>6UT86(`8V]P>5]S:&1R`&=E;&9?
-XM9V5T<VAD<@!E;&9?9V5T<VAS=')N9'@`9V5L9E]G971C;&%S<P!C86QL;V,`
-XM96QF7VYE>'1S8VX`96QF7W-T<G!T<@!E;&9?;F1X<V-N`&5L9E]E<G)N;P!F
-XM<F5E`&5L9E]N97=D871A`&=E;&9?9G-I>F4`96QF7V=E=&1A=&$`9V5L9E]G
-XM971S>6T`8V]P>5]D871A`&=E;&9?=7!D871E7W-H9'(`96QF7V5R<FUS9P!R
-XM96%L;&]C`'-T<FQE;@!S=')N8W!Y`&5R<@!I<U]R96UO=F5?<V5C=&EO;@!I
-XM<U]R96UO=F5?<F5L;V-?<V5C`&=E;&9?9V5T<F5L80!W87)N>`!G96QF7V=E
-XM=')E;```````1P`````````"````"@```/S_________B@`````````"````
-XM#````/S_________Q@`````````*````!```````````````T@`````````"
-XM````#0```/S_________^@`````````"````#````/S_________-@$`````
-XM```*````!```````````````0@$````````"````#0```/S_________4P$`
-XM```````*````!````!(`````````A`$````````"````$````/S_________
-XMF0$````````*````!````!H`````````G@$````````"````$````/S_____
-XM____M`$````````"````$0```/S_________TP$````````"````$0```/S_
-XM________^`$````````"````$@```/S_________"0(````````"````$P``
-XM`/S_________)`(````````"````%````/S_________.@(````````"````
-XM#````/S_________:@(````````"````%````/S_________F`(````````"
-XM````%0```/S_________KP(````````"````$0```/S_________T`(`````
-XM```"````%@```/S_________X@(````````*````!````!H`````````]@(`
-XM```````"````%P```/S_________``,````````"````&````/S_________
-XM*@,````````"````%0```/S_________/0,````````"````$0```/S_____
-XM____7@,````````"````%@```/S_________<`,````````*````!````!(`
-XM````````A0,````````"````&````/S_________Z@,````````*````!```
-XM`!(`````````$00````````*````!````!H`````````(@0````````*````
-XM!````&H!````````3@0````````"````%P```/S_________H`0````````"
-XM````%P```/S_________\@4````````"````&0```/S_________9P8`````
-XM```"````&@```/S_________$P<````````"````&P```/S_________+`<`
-XM```````"````$0```/S_________4P<````````"````'````/S_________
-XMB`<````````"````'0```/S_________NP<````````"````'@```/S_____
-XM____Q0<````````"````'@```/S_________W`<````````"````&````/S_
-XM________9`@````````"````'P```/S_________?@@````````"````'P``
-XM`/S_________D`@````````"````(````/S_________E0@````````*````
-XM!````(X!````````I`@````````"````#0```/S_________L@@````````"
-XM````&@```/S_________%`D````````"````&@```/S_________=`D`````
-XM```"````%````/S_________HPD````````"````%````/S_________Q0D`
-XM```````"````'````/S_________9`H````````"````'0```/S_________
-XMA`H````````"````%@```/S_________FPH````````"````"0```/S_____
-XM____Q0H````````"````"@```/S_________`@T````````"````(0```/S_
-XM________&`T````````"````(@```/S_________1`T````````"````(P``
-XM`/S_________3`T````````"````(@```/S_________6`T````````"````
-XM(@```/S_________`Q$````````"````(0```/S_________&!$````````*
-XM````!````%L!````````)!$````````"````)````/S_________/Q$`````
-XM```"````(0```/S_________6Q$````````"````(````/S_________8!$`
-XM```````*````!````*,`````````;Q$````````"````#0```/S_________
-XM>1$````````"````(````/S_________?A$````````*````!````(P`````
-XM````C1$````````"````#0```/S_________2A,````````"````(0```/S_
-XM________=1,````````"````(0```/S_________M1,````````"````#```
-XM`/S_________RA,````````*````!````'X`````````UA,````````"````
-XM)````/S_________]Q,````````"````(0```/S_________4Q0````````"
-XM````#````/S_________=A0````````"````(````/S_________>Q0`````
-XM```*````!````"(`````````BA0````````"````#0```/S_________E!0`
-XM```````"````(````/S_________F10````````*````!`````(!````````
-XMJ!0````````"````#0```/S_________VA0````````"````%````/S_____
-XM____^Q0````````"````$@```/S_________$A4````````"````%0```/S_
-XM________+A4````````"````$0```/S_________8A4````````"````%@``
-XM`/S_________=A4````````"````)0```/S_________B14````````"````
-XM)@```/S_________I14````````"````%P```/S_________[!4````````"
-XM````'````/S_________3Q8````````"````)P```/S_________DA8`````
-XM```*````!````$8!````````F18````````"````*````/S_________Q!8`
-XM```````"````#````/S_________ZA8````````"````#````/S_________
-XM&1<````````"````(0```/S_________,A<````````"````&````/S_____
-XM____5A<````````"````(````/S_________6Q<````````*````!````.L`
-XM````````:A<````````"````#0```/S_________?Q<````````"````#```
-XM`/S_________F1<````````*````!````-``````````I1<````````"````
-XM#0```/S_________JA<````````"````&````/S_________PQ<````````"
-XM````(````/S_________R!<````````*````!````+D`````````UQ<`````
-XM```"````#0```/S_________W!<````````*````!````'``````````YA<`
-XM```````"````)````/S_________\!<````````"````(````/S_________
-XM]1<````````*````!````%<`````````!!@````````"````#0```/S_____
-XM____"1@````````*````!````'``````````%1@````````"````)````/S_
-XM________&A@````````*````!````'X`````````)!@````````"````)```
-XM`/S_________+A@````````"````(````/S_________,Q@````````*````
-XM!````#P`````````0A@````````"````#0```/S_________3!@````````"
-XM````(````/S_________41@````````*````!````'0!````````8!@`````
-XM```"````#0```/S_________D!@````````"````&````/S_________LA@`
-XM```````"````#````/S_________[Q@````````"````*0```/S_________
-XM%!D````````"````(````/S_________&1D````````*````!````"\!````
-XM````*!D````````"````#0```/S_________,AD````````"````(````/S_
-XM________-QD````````*````!````!D!````````1AD````````"````#0``
-XM`/S_________(``````````*`````0``````````````.``````````*````
-XM`0```!``````````4``````````*`````0```"``````````<``````````*
-XM`````0```'``````````B``````````*`````0```.``````````H```````
-X2```*`````0```%`!````````
+XM```````#``$```````````````````````$````"``$````````````0````
+XM`````!(````"``$`$``````````0```````````````#``8`````````````
+XM```````````````#``,````````````````````````````#``0`````````
+XM```````````````````#``4````````````````````````````#``<`````
+XM`````````````````"(````2``$`(`````````!!`````````#8````0````
+XM`````````````````````#T````2``$`<`````````!F`````````$\````0
+XM`````````````````````````%8````0`````````````````````````%L`
+XM```2``$`X`````````!F`````````&P````2``$`4`$```````#Z%P``````
+XM`'H````0`````````````````````````(0````0````````````````````
+XM`````)$````0`````````````````````````*$````0````````````````
+XM`````````*\````0`````````````````````````+8````0````````````
+XM`````````````,(````0`````````````````````````,T````0````````
+XM`````````````````-@````0`````````````````````````.(````0````
+XM`````````````````````.<````0`````````````````````````/,````0
+XM`````````````````````````/X````0``````````````````````````H!
+XM```0`````````````````````````!8!```0````````````````````````
+XM`"`!```0`````````````````````````#$!```0````````````````````
+XM`````#P!```0`````````````````````````$0!```0````````````````
+XM`````````$L!```0`````````````````````````%,!```0````````````
+XM`````````````%<!```0`````````````````````````&D!```0````````
+XM`````````````````'T!```0`````````````````````````(H!```0````
+XM`````````````````````)`!```0``````````````````````````!I<U]G
+XM;&]B86Q?<WEM8F]L`&ES7VQO8V%L7W-Y;6)O;`!L;V]K=7!?:V5E<%]S>6UL
+XM:7-T`'-T<F-M<`!A9&1?=&]?<W1R:7!?;&ES=`!M86QL;V,`97)R>`!A9&1?
+XM=&]?:V5E<%]L:7-T`&-R96%T95]S>6UT86(`8V]P>5]S:&1R`&=E;&9?9V5T
+XM<VAD<@!E;&9?9V5T<VAS=')N9'@`9V5L9E]G971C;&%S<P!C86QL;V,`96QF
+XM7VYE>'1S8VX`96QF7W-T<G!T<@!E;&9?;F1X<V-N`&5L9E]E<G)N;P!F<F5E
+XM`&5L9E]N97=D871A`&=E;&9?9G-I>F4`96QF7V=E=&1A=&$`9V5L9E]G971S
+XM>6T`8V]P>5]D871A`&=E;&9?=7!D871E7W-H9'(`96QF7V5R<FUS9P!R96%L
+XM;&]C`'-T<FQE;@!S=')N8W!Y`&5R<@!I<U]R96UO=F5?<V5C=&EO;@!I<U]R
+XM96UO=F5?<F5L;V-?<V5C`&=E;&9?9V5T<F5L80!W87)N>`!G96QF7V=E=')E
+XM;```````1P`````````"````"@```/S_________B@`````````"````#```
+XM`/S_________Q@`````````*````!```````````````T@`````````"````
+XM#0```/S_________^@`````````"````#````/S_________-@$````````*
+XM````!```````````````0@$````````"````#0```/S_________4P$`````
+XM```*````!````!(`````````A`$````````"````$````/S_________F0$`
+XM```````*````!````!H`````````G@$````````"````$````/S_________
+XMM`$````````"````$0```/S_________TP$````````"````$0```/S_____
+XM____^`$````````"````$@```/S_________"0(````````"````$P```/S_
+XM________)`(````````"````%````/S_________.@(````````"````#```
+XM`/S_________:@(````````"````%````/S_________F`(````````"````
+XM%0```/S_________KP(````````"````$0```/S_________T`(````````"
+XM````%@```/S_________X@(````````*````!````!H`````````]@(`````
+XM```"````%P```/S_________``,````````"````&````/S_________*@,`
+XM```````"````%0```/S_________/0,````````"````$0```/S_________
+XM7@,````````"````%@```/S_________<`,````````*````!````!(`````
+XM````A0,````````"````&````/S_________Z@,````````*````!````!(`
+XM````````$00````````*````!````!H`````````(@0````````*````!```
+XM`&H!````````3@0````````"````%P```/S_________H`0````````"````
+XM%P```/S_________\@4````````"````&0```/S_________9P8````````"
+XM````&@```/S_________$P<````````"````&P```/S_________+`<`````
+XM```"````$0```/S_________4P<````````"````'````/S_________B`<`
+XM```````"````'0```/S_________NP<````````"````'@```/S_________
+XMQ0<````````"````'@```/S_________W`<````````"````&````/S_____
+XM____9`@````````"````'P```/S_________?@@````````"````'P```/S_
+XM________D`@````````"````(````/S_________E0@````````*````!```
+XM`(X!````````I`@````````"````#0```/S_________L@@````````"````
+XM&@```/S_________%`D````````"````&@```/S_________=`D````````"
+XM````%````/S_________HPD````````"````%````/S_________Q0D`````
+XM```"````'````/S_________9`H````````"````'0```/S_________A`H`
+XM```````"````%@```/S_________FPH````````"````"0```/S_________
+XMQ0H````````"````"@```/S_________`@T````````"````(0```/S_____
+XM____&`T````````"````(@```/S_________1`T````````"````(P```/S_
+XM________3`T````````"````(@```/S_________6`T````````"````(@``
+XM`/S_________`Q$````````"````(0```/S_________&!$````````*````
+XM!````%L!````````)!$````````"````)````/S_________/Q$````````"
+XM````(0```/S_________6Q$````````"````(````/S_________8!$`````
+XM```*````!````*,`````````;Q$````````"````#0```/S_________>1$`
+XM```````"````(````/S_________?A$````````*````!````(P`````````
+XMC1$````````"````#0```/S_________2A,````````"````(0```/S_____
+XM____=1,````````"````(0```/S_________M1,````````"````#````/S_
+XM________RA,````````*````!````'X`````````UA,````````"````)```
+XM`/S_________]Q,````````"````(0```/S_________4Q0````````"````
+XM#````/S_________=A0````````"````(````/S_________>Q0````````*
+XM````!````"(`````````BA0````````"````#0```/S_________E!0`````
+XM```"````(````/S_________F10````````*````!`````(!````````J!0`
+XM```````"````#0```/S_________VA0````````"````%````/S_________
+XM^Q0````````"````$@```/S_________$A4````````"````%0```/S_____
+XM____+A4````````"````$0```/S_________8A4````````"````%@```/S_
+XM________=A4````````"````)0```/S_________B14````````"````)@``
+XM`/S_________I14````````"````%P```/S_________[!4````````"````
+XM'````/S_________3Q8````````"````)P```/S_________DA8````````*
+XM````!````$8!````````F18````````"````*````/S_________Q!8`````
+XM```"````#````/S_________ZA8````````"````#````/S_________&1<`
+XM```````"````(0```/S_________,A<````````"````&````/S_________
+XM5A<````````"````(````/S_________6Q<````````*````!````.L`````
+XM````:A<````````"````#0```/S_________?Q<````````"````#````/S_
+XM________F1<````````*````!````-``````````I1<````````"````#0``
+XM`/S_________JA<````````"````&````/S_________PQ<````````"````
+XM(````/S_________R!<````````*````!````+D`````````UQ<````````"
+XM````#0```/S_________W!<````````*````!````'``````````YA<`````
+XM```"````)````/S_________\!<````````"````(````/S_________]1<`
+XM```````*````!````%<`````````!!@````````"````#0```/S_________
+XM"1@````````*````!````'``````````%1@````````"````)````/S_____
+XM____&A@````````*````!````'X`````````)!@````````"````)````/S_
+XM________+A@````````"````(````/S_________,Q@````````*````!```
+XM`#P`````````0A@````````"````#0```/S_________3!@````````"````
+XM(````/S_________41@````````*````!````'0!````````8!@````````"
+XM````#0```/S_________D!@````````"````&````/S_________LA@`````
+XM```"````#````/S_________[Q@````````"````*0```/S_________%!D`
+XM```````"````(````/S_________&1D````````*````!````"\!````````
+XM*!D````````"````#0```/S_________,AD````````"````(````/S_____
+XM____-QD````````*````!````!D!````````1AD````````"````#0```/S_
+XM________(``````````*`````0``````````````.``````````*`````0``
+XM`!``````````4``````````*`````0```"``````````<``````````*````
+XM`0```'``````````B``````````*`````0```.``````````H``````````*
+XM`````0```%`!````````````````````````````````````````````````
+XM`````````````````````````````````````````````"`````!````!@``
+XM`````````````````$``````````2AD``````````````````!``````````
+XM```````````;````!````$`````````````````````@(@```````*@,````
+XM````"@````$````(`````````!@`````````)@````$````#````````````
+XM````````C!D`````````````````````````````!```````````````````
+XM`"P````(`````P```````````````````(P9````````````````````````
+XM``````0````````````````````Q`````0````````````````````````",
+XM&0```````#`````````````````````!````````````````````.@````$`
+XM```R````````````````````O!D```````"L`0```````````````````0``
+XM```````!`````````$X````!`````@```````````````````&@;````````
+XMT`````````````````````@```````````````````!)````!````$``````
+XM``````````````#(+@```````)``````````"@````<````(`````````!@`
+XM````````$0````,`````````````````````````.!P```````!8````````
+XM`````````````0````````````````````$````"````````````````````
+XM`````)`<````````\`,````````+````"0````@`````````&``````````)
+XM`````P````````````````````````"`(````````)P!````````````````
+X2```!````````````````````
X`
Xend
-END-of-symbols.o.1.uu
+7e9b8d093a79e3138d3b7dc9490f1606
echo x - symbols.o.uu
-sed 's/^X//' >symbols.o.uu << 'END-of-symbols.o.uu'
+sed 's/^X//' >symbols.o.uu << '4a9e1967a3d1d330020ec46c822fc6a0'
Xbegin 644 symbols.o
XM?T5,1@(!`0D```````````$`/@`!`````````````````````````,!C````
XM`````````$```````$``&@`7``^V1P3`Z`0L`0^4P`^VP,,/MD<$P.@$A,`/
@@ -1202,6 +1202,6 @@ XM```*````!@``````````````!@`````````*````!@``````````````$```
X5```````!`````@``````````````
X`
Xend
-END-of-symbols.o.uu
+4a9e1967a3d1d330020ec46c822fc6a0
exit
diff --git a/test/elfcopy/tc/strip-debug-3/out/strip-debug-3.out.shar b/test/elfcopy/tc/strip-debug-3/out/strip-debug-3.out.shar
index a3ffa9c4b433..c4937a3302ea 100644
--- a/test/elfcopy/tc/strip-debug-3/out/strip-debug-3.out.shar
+++ b/test/elfcopy/tc/strip-debug-3/out/strip-debug-3.out.shar
@@ -9,8 +9,8 @@
# ls.uu
#
echo x - ls.1.uu
-sed 's/^X//' >ls.1.uu << 'END-of-ls.1.uu'
-Xbegin 755 ls.1
+sed 's/^X//' >ls.1.uu << 'd7b52e16e66a16e1176ab066b800c102'
+Xbegin 444 ls.1
XM?T5,1@(!`0D```````````(`/@`!````H!M```````!``````````#!M````
XM`````````$``.``'`$``&@`9``8````%````0`````````!``$```````$``
XM0```````B`$```````"(`0````````@``````````P````0```#(`0``````
@@ -643,9 +643,9 @@ XM`````!@`````````+P````,````"`````````%@,0```````6`P````````1
XM`P```````````````````0```````````````````#<```#___]O`@``````
XM``!J#T```````&H/````````J@`````````$``````````(``````````@``
XM``````!$````_O__;P(`````````&!!````````8$````````#``````````
-XM!0````$````(````````````````````4P````0````"`````````$@00```
+XM!0````$````(````````````````````4P````0```!"`````````$@00```
XM````2!````````"0``````````0`````````"``````````8`````````%T`
-XM```$`````@````````#8$$```````-@0````````8`8````````$````"P``
+XM```$````0@````````#8$$```````-@0````````8`8````````$````"P``
XM``@`````````&`````````!G`````0````8`````````.!=````````X%P``
XM`````!,````````````````````$````````````````````8@````$````&
XM`````````$P70```````3!<```````!0!```````````````````!```````
@@ -672,10 +672,10 @@ XM``````````````!?;````````,X````````````````````!````````````
X&````````
X`
Xend
-END-of-ls.1.uu
+d7b52e16e66a16e1176ab066b800c102
echo x - ls.uu
-sed 's/^X//' >ls.uu << 'END-of-ls.uu'
-Xbegin 555 ls
+sed 's/^X//' >ls.uu << '4db11c737631d887608e3186a17a7a3e'
+Xbegin 444 ls
XM?T5,1@(!`0D```````````(`/@`!````H!M```````!``````````#!M````
XM`````````$``.``'`$``&@`9``8````%````0`````````!``$```````$``
XM0```````B`$```````"(`0````````@``````````P````0```#(`0``````
@@ -1337,6 +1337,6 @@ XM``````````````!?;````````,X````````````````````!````````````
X&````````
X`
Xend
-END-of-ls.uu
+4db11c737631d887608e3186a17a7a3e
exit
diff --git a/test/elfcopy/tc/strip-debug-4/out/strip-debug-4.out.shar b/test/elfcopy/tc/strip-debug-4/out/strip-debug-4.out.shar
index 0f80086e27ec..59d47aa55b4c 100644
--- a/test/elfcopy/tc/strip-debug-4/out/strip-debug-4.out.shar
+++ b/test/elfcopy/tc/strip-debug-4/out/strip-debug-4.out.shar
@@ -9,9 +9,9 @@
# elfcopy.uu
#
echo x - elfcopy.1.uu
-sed 's/^X//' >elfcopy.1.uu << 'END-of-elfcopy.1.uu'
-Xbegin 755 elfcopy.1
-XM?T5,1@(!`0D```````````(`/@`!````4!M```````!``````````(B!````
+sed 's/^X//' >elfcopy.1.uu << 'e4e59173f6354081a9e3a7debde2f069'
+Xbegin 644 elfcopy.1
+XM?T5,1@(!`0D```````````(`/@`!````4!M```````!``````````("9````
XM`````````$``.``'`$``'``9``8````%````0`````````!``$```````$``
XM0```````B`$```````"(`0````````@``````````P````0```#(`0``````
XM`,@!0```````R`%````````5`````````!4``````````0`````````!````
@@ -748,188 +748,189 @@ XM87-H`"YD>6YS>6T`+F1Y;G-T<@`N9VYU+G9E<G-I;VX`+F=N=2YV97)S:6]N
XM7W(`+G)E;&$N9'EN`"YR96QA+G!L=``N:6YI=``N=&5X=``N9FEN:0`N<F]D
XM871A`"YE:%]F<F%M95]H9'(`+F1A=&$`+F5H7V9R86UE`"YD>6YA;6EC`"YC
XM=&]R<P`N9'1O<G,`+FIC<@`N9V]T`"YB<W,`+F-O;6UE;G0`````````````
-XM````````````````````````````````````````````````````````````
-XM```````````````````;`````0````(`````````R`%```````#(`0``````
-XM`!4````````````````````!````````````````````(P````<````"````
-XM`````.`!0```````X`$````````8````````````````````!```````````
-XM`````````#$````%`````@````````#X`4```````/@!````````5`(`````
-XM```$``````````@`````````!``````````W````"P````(`````````4`1`
-XM``````!0!````````(`'````````!0````$````(`````````!@`````````
-XM/P````,````"`````````-`+0```````T`L````````/`P``````````````
-XM`````0```````````````````$<```#___]O`@````````#@#D```````.`.
-XM````````H``````````$``````````(``````````@````````!4````_O__
-XM;P(`````````@`]```````"`#P```````$``````````!0````(````(````
-XM````````````````8P````0````"`````````,`/0```````P`\```````!X
-XM``````````0`````````"``````````8`````````&T````$`````@``````
-XM```X$$```````#@0````````D`8````````$````"P````@`````````&```
-XM``````!W`````0````8`````````R!9```````#(%@```````!,`````````
-XM```````````$````````````````````<@````$````&`````````-P60```
-XM````W!8```````!P!```````````````````!``````````0`````````'T`
-XM```!````!@````````!0&T```````%`;````````Z$T`````````````````
-XM`!````````````````````"#`````0````8`````````.&E````````X:0``
-XM``````X````````````````````$````````````````````B0````$````"
-XM`````````$AI0```````2&D```````#\"```````````````````"```````
-XM`````````````)$````!`````@````````!$<D```````$1R````````"```
-XM``````````````````0```````````````````"?`````0````,`````````
-XM8')0``````!@<@`````````#```````````````````@````````````````
-XM````I0````$````"`````````&!U4```````8'4```````!`!0``````````
-XM````````"````````````````````*\````&`````P````````"@>E``````
-XM`*!Z````````H`$````````%``````````@`````````$`````````"X````
-XM`0````,`````````0'Q0``````!`?````````!`````````````````````(
-XM````````````````````OP````$````#`````````%!\4```````4'P`````
-XM```0````````````````````"````````````````````,8````!`````P``
-XM``````!@?%```````&!\````````"`````````````````````@`````````
-XM``````````#+`````0````,`````````:'Q0``````!H?````````$@"````
-XM```````````````(``````````@`````````T`````@````#`````````+!^
-XM4```````L'X````````P````````````````````"```````````````````
-XM`-4````!`````````````````````````+!^````````]@$`````````````
-XM``````$````````````````````1`````P````````````````````````"F
-XM@````````-X````````````````````!`````````````````````0````(`
-XM````````````````````````B(@`````````#P```````!L````S````"```
-XM```````8``````````D````#`````````````````````````(B7````````
-XM\P@```````````````````$`````````````````````````````````````
-XM```````````````!`````0`"`.`!0```````&``````````(`````0`3`$!\
-XM4``````````````````6`````0`4`%!\4``````````````````D`````0`5
-XM`&!\4``````````````````Q`````@`,`/`;0`````````````````!'````
-XM`0`7`-1^4````````0````````!6`````0`0`'!R4`````````````````!=
-XM`````@`,`#`<0`````````````````!I`````0`3`$A\4```````````````
-XM``!V`````0`4`%A\4`````````````````"#`````0`1`&AZ4```````````
-XM``````"1`````0`5`&!\4`````````````````"=`````@`,`!!I0```````
-XM``````````"S`````@`,`&`<0```````*0````````"_`````@`,`)`<0```
-XM````*0````````#)`````@`,`,`<0```````*0````````#7`````@`,`/`<
-XM0```````CP8```````#C`````0`0`,!S4```````H`$```````#T`````0`0
-XM`(!R4```````0`$````````#`0```@`,`/`K0```````?0`````````6`0``
-XM`@`,`$`O0```````:P`````````F`0```@`,`-`V0```````(@`````````Z
-XM`0```@`,```W0```````-P````````!,`0```@`,`-`\0```````VP``````
-XM``!7`0```@`,`)!-0```````$`````````!H`0```@`,`*!-0```````$```
-XM`````````````P`!`,@!0````````````````````````P`"`.`!0```````
-XM`````````````````P`#`/@!0````````````````````````P`$`%`$0```
-XM`````````````````````P`%`-`+0````````````````````````P`&`.`.
-XM0````````````````````````P`'`(`/0````````````````````````P`(
-XM`,`/0````````````````````````P`)`#@00```````````````````````
-XM`P`*`,@60````````````````````````P`+`-P60```````````````````
-XM`````P`,`%`;0````````````````````````P`-`#AI0```````````````
-XM`````````P`.`$AI0````````````````````````P`/`$1R0```````````
-XM`````````````P`0`&!R4````````````````````````P`1`&!U4```````
-XM`````````````````P`2`*!Z4````````````````````````P`3`$!\4```
-XM`````````````````````P`4`%!\4````````````````````````P`5`&!\
-XM4````````````````````````P`6`&A\4````````````````````````P`7
-XM`+!^4````````````````````````P`8``````````````````````!X`0``
-XM$@`,`"`U0```````_P````````"%`0``$@`,`*`Q0```````]`````````"/
-XM`0``$@```.P60```````D`````````"A`0``$@```/P60```````AP``````
-XM``"[`0``$@````P70```````%P$```````#2`0``$@```!P70```````314`
-XM``````#G`0``$@`,`*`R0```````.0$```````#Q`0``$@```"P70```````
-XM?`$````````"`@``$@`,`'!.0```````9@`````````3`@``$0`2`*!Z4```
-XM```````````````<`@``$@```#P70```````V@(````````R`@``$@```$P7
-XM0```````G@````````!!`@``$@```%P70```````-`````````!3`@``$@``
-XM`&P70```````50````````!D`@``$@`,`)`X0```````%0$```````!X`@``
-XM$@`,`+`]0```````TPL```````"%`@``$@```'P70```````Y0````````";
-XM`@``$@`,`.!F0```````CP````````"I`@``$@```(P70```````B@``````
-XM``"Y`@``$@```)P70`````````````````#*`@``$@```*P70```````:@``
-XM``````#A`@``$0(0`&AR4`````````````````#N`@``$@```+P70```````
-XMX@`````````#`P``$@`,`.!.0```````^A<````````1`P``$@```,P70```
-XM````C`$````````K`P``$@`,`+`O0```````X@$````````[`P``$@```-P7
-XM0````````@````````!/`P``$@```.P70```````AP8```````!A`P``$@``
-XM`/P70```````.P````````!W`P``$@````P80```````&0$```````".`P``
-XM$@`,`.`S0```````.@$```````">`P``$@`*`,@60`````````````````"D
-XM`P``$@```!P80```````)`````````"[`P``$@```"P80```````B```````
-XM``#*`P``$0`7`-A^4```````"`````````#2`P``$@```#P80```````3```
-XM``````#D`P``$@```$P80```````*0````````#U`P``$@```%P80```````
-XM-0`````````*!```$@```&P80```````:0$````````?!```$@```'P80```
-XM````:@`````````Y!```$0`7`+!^4```````!`````````!0!```$@```(P8
-XM0```````K0(```````!A!```$@```)P80```````%@````````!T!```$0`0
-XM`&!R4```````"`````````!_!```$@`,`"`V0```````H@````````".!```
-XM$@`,`%`;0```````DP````````"5!```$@```*P80```````E0````````"E
-XM!```$@```+P80`````````````````"T!```$0`7`+A^4```````"```````
-XM``#%!```$@```,P80`````````````````#6!```$@```-P80```````2P``
-XM``````#L!```$@```.P80```````K`$````````'!0``$@`,`#`N0```````
-XM!P$````````3!0``$@`,`'!*0```````[@$````````=!0``$@`,`'!G0```
-XM````GP$````````N!0``$@```/P80```````*`````````!%!0``$@````P9
-XM0```````C`$```````!;!0``$@```!P90`````````````````!L!0``$@``
-XM`"P90```````-@````````""!0``$`#Q_[!^4`````````````````".!0``
-XM$@```#P90```````"P````````"D!0``$@```$P90`````````````````"T
-XM!0``$@`,`(`C0```````<`@```````"Y!0``$@```%P90```````C0$`````
-XM``#0!0``$@```&P90```````2@$```````#A!0``$@```'P90```````:@``
-XM``````#X!0``$@```(P90```````Z@`````````(!@``$@`,`'`L0```````
-XMM@$````````5!@``$@`,`+!-0```````00`````````I!@``$@```)P90```
-XM````A`$```````!`!@``$@```*P90```````XP$```````!4!@``$@```+P9
-XM0```````90````````!E!@``$@`-`#AI0`````````````````!K!@``$0`7
-XM`,!^4```````"`````````!_!@``$@```,P90```````#`````````"7!@``
-XM$@```-P90`````````````````"H!@``$@```.P90```````R@````````"Y
-XM!@``$@```/P90```````2@$```````#.!@``$@````P:0```````)0``````
-XM``#@!@``$@```!P:0`````````````````#O!@``$@```"P:0```````````
-XM```````!!P``$@```#P:0```````Y@`````````3!P``$@```$P:0```````
-XMP0$````````N!P``$@```%P:0```````+P`````````]!P``$@```&P:0```
-XM````KP````````!.!P``$@```'P:0```````%P````````!B!P``$@`,`$`W
-XM0```````20$```````!T!P``$@```(P:0```````J@````````""!P``$@``
-XM`)P:0```````*@$```````"4!P``$`#Q_[!^4`````````````````";!P``
-XM$@```*P:0`````````````````"L!P``$0`6`&A\4`````````````````#"
-XM!P``$`#Q_^!^4`````````````````#'!P``$@```+P:0```````\@``````
-XM``#8!P``$0`7`,A^4```````"`````````#L!P``$@```,P:0```````=@``
-XM``````#[!P``$0`7`-!^4```````!``````````,"```$@```-P:0```````
-XM+P`````````="```$@`,``!.0```````9@`````````O"```$@`,`)!)0```
-XM````V0````````!!"```$@```.P:0```````'@````````!2"```$@```/P:
-XM0```````N0$```````!M"```$@````P;0```````(0````````"""```$@``
-XM`!P;0```````<P$```````"="```(`````````````````````````"Q"```
-XM$@```"P;0```````"P````````#'"```$@`,`&!,0```````)0$```````#2
-XM"```$@```#P;0```````:`$```````#H"```$@`,`+`Y0```````%0,`````
-XM````86)I=&%G`%]?0U1/4E],25-47U\`7U]$5$]27TQ)4U1?7P!?7TI#4E],
-XM25-47U\`7U]D;U]G;&]B86Q?9'1O<G-?875X`&-O;7!L971E9"XU,#(Y`'`N
-XM-3`R-P!F<F%M95]D=6UM>0!?7T-43U)?14Y$7U\`7U]$5$]27T5.1%]?`%]?
-XM1E)!345?14Y$7U\`7U]*0U)?14Y$7U\`7U]D;U]G;&]B86Q?8W1O<G-?875X
-XM`'-T<FEP7W5S86=E`&UC<U]U<V%G90!E;&9C;W!Y7W5S86=E`&-R96%T95]F
-XM:6QE`&5L9F-O<'E?;&]N9V]P=',`<W1R:7!?;&]N9V]P=',`:6YS97)T7W1O
-XM7W-E8U]L:7-T`&%D9%]T;U]S:'-T<G1A8@!I<U]C;VUP<F5S<U]S96-T:6]N
-XM`&ES7V%P<&5N9%]S96-T:6]N`'!R:6YT7V1A=&$`:7-?9VQO8F%L7W-Y;6)O
-XM;`!I<U]L;V-A;%]S>6UB;VP`:6YS97)T7W-H=&%B`&-O<'E?9&%T80!F<')I
-XM;G1F0$!&0E-$7S$N,`!E;&9?<V5T<VAS=')N9'A`0$9"4T1?,2XP`&=E;&9?
-XM9V5T96AD<D!`1D)31%\Q+C``96QF7W5P9&%T94!`1D)31%\Q+C``8V]P>5]S
-XM:&1R`&=E=&5N=D!`1D)31%\Q+C``861D7W1O7VME97!?;&ES=`!?1%E.04U)
-XM0P!E;&9?9V5T9&%T84!`1D)31%\Q+C``<'5T8T!`1D)31%\Q+C``<W1R;F-M
-XM<$!`1D)31%\Q+C``<W1R9'5P0$!&0E-$7S$N,`!I<U]R96UO=F5?<F5L;V-?
-XM<V5C`&-O<'E?8V]N=&5N=`!E;&9?;F5W9&%T84!`1D)31%\Q+C``;&]O:W5P
-XM7W-T<FEN9P!F<F5A9$!`1D)31%\Q+C``<F5N86UE0$!&0E-$7S$N,`!E;&9?
-XM9V5T<&AN=6U`0$9"4T1?,2XP`%]?9'-O7VAA;F1L90!E;&9?97)R;7-G0$!&
-XM0E-$7S$N,`!C<F5A=&5?<WEM=&%B`&=E;&9?=7!D871E7W)E;$!`1D)31%\Q
-XM+C``861D7W5N;&]A9&%B;&5S`%]I;FET7W1L<T!`1D)31%\Q+C``<F5A;&QO
-XM8T!`1D)31%\Q+C``96QF7VYE>'1S8VY`0$9"4T1?,2XP`&=E;&9?9V5T<VAD
-XM<D!`1D)31%\Q+C``<F5S>6YC7W-E8W1I;VYS`%]I;FET`&=E;&9?;F5W<&AD
-XM<D!`1D)31%\Q+C``97)R>$!`1D)31%\Q+C``96YV:7)O;@!S=')N8W!Y0$!&
-XM0E-$7S$N,`!S=')C:')`0$9"4T1?,2XP`&=E;&9?9G-I>F5`0$9"4T1?,2XP
-XM`&5L9E]S=')P=')`0$9"4T1?,2XP`&5L9E]G971S:'-T<FYD>$!`1D)31%\Q
-XM+C``7U]I<W1H<F5A9&5D0$!&0E-$7S$N,`!G971O<'1`0$9"4T1?,2XP`&5L
-XM9E]K:6YD0$!&0E-$7S$N,`!?7W!R;V=N86UE`&QO;VMU<%]S96-?86-T`%]S
-XM=&%R=`!W87)N>$!`1D)31%\Q+C``<W1A=$!`1D)31%\Q+C``;W!T87)G0$!&
-XM0E-$7S$N,`!M96US971`0$9"4T1?,2XP`&5L9E]F;&%G96QF0$!&0E-$7S$N
-XM,`!G96QF7W5P9&%T95]E:&1R0$!&0E-$7S$N,`!U<&1A=&5?<VAD<@!C;W!Y
-XM7W!H9'(`:6YS97)T7W1O7W-T<G1A8@!G96QF7VYE=V5H9')`0$9"4T1?,2XP
-XM`&=E;&9?9V5T<WEM0$!&0E-$7S$N,`!S=')C;7!`0$9"4T1?,2XP`&5L9E]V
-XM97)S:6]N0$!&0E-$7S$N,`!?7V)S<U]S=&%R=`!G971O<'1?;&]N9T!`1D)3
-XM1%\Q+C``8VQO<V5`0$9"4T1?,2XP`&UA:6X`9V5L9E]G971P:&1R0$!&0E-$
-XM7S$N,`!C86QL;V-`0$9"4T1?,2XP`&5L9E]G971S:&YU;4!`1D)31%\Q+C``
-XM9F]P96Y`0$9"4T1?,2XP`'-E=%]S:'-T<G1A8@!L;V]K=7!?:V5E<%]S>6UL
-XM:7-T`&=E;&9?9V5T<F5L84!`1D)31%\Q+C``96QF7V)E9VEN0$!&0E-$7S$N
-XM,`!F97)R;W)`0$9"4T1?,2XP`%]F:6YI`%]?<W1D;W5T<$!`1D)31%\Q+C``
-XM9V5L9E]G971C;&%S<T!`1D)31%\Q+C``9F-H;6]D0$!&0E-$7S$N,`!F=W)I
-XM=&5`0$9"4T1?,2XP`&5L9E]N97=S8VY`0$9"4T1?,2XP`&UK<W1E;7!`0$9"
-XM4T1?,2XP`&]P96Y`0$9"4T1?,2XP`&UE;6UO=F5`0$9"4T1?,2XP`%]?<W=B
-XM=69`0$9"4T1?,2XP`&=E;&9?=7!D871E7W!H9')`0$9"4T1?,2XP`&5X:71`
-XM0$9"4T1?,2XP`&UA;&QO8T!`1D)31%\Q+C``96QF7V5R<FYO0$!&0E-$7S$N
-XM,`!I<U]R96UO=F5?<V5C=&EO;@!E<G)`0$9"4T1?,2XP`&5L9E]E;F1`0$9"
-XM4T1?,2XP`%]E9&%T80!M96UC<'E`0$9"4T1?,2XP`%]'3$]"04Q?3T9&4T54
-XM7U1!0DQ%7P!?96YD`&9C;&]S94!`1D)31%\Q+C``7U]S=&1E<G)P0$!&0E-$
-XM7S$N,`!F<F5E0$!&0E-$7S$N,`!O<'1I;F1`0$9"4T1?,2XP`&%T97AI=$!`
-XM1D)31%\Q+C``861D7W1O7W-T<FEP7VQI<W0`861D7W1O7VEN<V5G7VQI<W0`
-XM<W1R;&5N0$!&0E-$7S$N,`!G96QF7W5P9&%T95]R96QA0$!&0E-$7S$N,`!E
-XM;&9?;F1X<V-N0$!&0E-$7S$N,`!G96QF7W5P9&%T95]S:&1R0$!&0E-$7S$N
-XM,`!?2G9?4F5G:7-T97)#;&%S<V5S`&=E='!R;V=N86UE0$!&0E-$7S$N,`!S
-XK971U<%]P:&1R`&=E;&9?9V5T<F5L0$!&0E-$7S$N,`!C<F5A=&5?<V-N````
+XM``````````````````````````$````!``(`X`%````````8``````````@`
+XM```!`!,`0'Q0`````````````````!8````!`!0`4'Q0````````````````
+XM`"0````!`!4`8'Q0`````````````````#$````"``P`\!M`````````````
+XM`````$<````!`!<`U'Y0```````!`````````%8````!`!``<')0````````
+XM`````````%T````"``P`,!Q``````````````````&D````!`!,`2'Q0````
+XM`````````````'8````!`!0`6'Q0`````````````````(,````!`!$`:'I0
+XM`````````````````)$````!`!4`8'Q0`````````````````)T````"``P`
+XM$&E``````````````````+,````"``P`8!Q````````I`````````+\````"
+XM``P`D!Q````````I`````````,D````"``P`P!Q````````I`````````-<`
+XM```"``P`\!Q```````"/!@```````.,````!`!``P'-0``````"@`0``````
+XM`/0````!`!``@')0``````!``0````````,!```"``P`\"M```````!]````
+XM`````!8!```"``P`0"]```````!K`````````"8!```"``P`T#9````````B
+XM`````````#H!```"``P``#=````````W`````````$P!```"``P`T#Q`````
+XM``#;`````````%<!```"``P`D$U````````0`````````&@!```"``P`H$U`
+XM```````0```````````````#``$`R`%````````````````````````#``(`
+XMX`%````````````````````````#``,`^`%````````````````````````#
+XM``0`4`1````````````````````````#``4`T`M`````````````````````
+XM```#``8`X`Y````````````````````````#``<`@`]`````````````````
+XM```````#``@`P`]````````````````````````#``D`.!!`````````````
+XM```````````#``H`R!9````````````````````````#``L`W!9`````````
+XM```````````````#``P`4!M````````````````````````#``T`.&E`````
+XM```````````````````#``X`2&E````````````````````````#``\`1')`
+XM```````````````````````#`!``8')0```````````````````````#`!$`
+XM8'50```````````````````````#`!(`H'I0```````````````````````#
+XM`!,`0'Q0```````````````````````#`!0`4'Q0````````````````````
+XM```#`!4`8'Q0```````````````````````#`!8`:'Q0````````````````
+XM```````#`!<`L'Y0```````````````````````#`!@`````````````````
+XM`````'@!```2``P`(#5```````#_`````````(4!```2``P`H#%```````#T
+XM`````````(\!```2````[!9```````"0`````````*$!```2````_!9`````
+XM``"'`````````+L!```2````#!=````````7`0```````-(!```2````'!=`
+XM``````!-%0```````.<!```2``P`H#)````````Y`0```````/$!```2````
+XM+!=```````!\`0````````("```2``P`<$Y```````!F`````````!,"```1
+XM`!(`H'I0`````````````````!P"```2````/!=```````#:`@```````#("
+XM```2````3!=```````">`````````$$"```2````7!=````````T````````
+XM`%,"```2````;!=```````!5`````````&0"```2``P`D#A````````5`0``
+XM`````'@"```2``P`L#U```````#3"P```````(4"```2````?!=```````#E
+XM`````````)L"```2``P`X&9```````"/`````````*D"```2````C!=`````
+XM``"*`````````+D"```2````G!=``````````````````,H"```2````K!=`
+XM``````!J`````````.$"```1`A``:')0`````````````````.X"```2````
+XMO!=```````#B``````````,#```2``P`X$Y```````#Z%P```````!$#```2
+XM````S!=```````",`0```````"L#```2``P`L"]```````#B`0```````#L#
+XM```2````W!=````````"`````````$\#```2````[!=```````"'!@``````
+XM`&$#```2````_!=````````[`````````'<#```2````#!A````````9`0``
+XM`````(X#```2``P`X#-````````Z`0```````)X#```2``H`R!9`````````
+XM`````````*0#```2````'!A````````D`````````+L#```2````+!A`````
+XM``"(`````````,H#```1`!<`V'Y0```````(`````````-(#```2````/!A`
+XM``````!,`````````.0#```2````3!A````````I`````````/4#```2````
+XM7!A````````U``````````H$```2````;!A```````!I`0```````!\$```2
+XM````?!A```````!J`````````#D$```1`!<`L'Y0```````$`````````%`$
+XM```2````C!A```````"M`@```````&$$```2````G!A````````6````````
+XM`'0$```1`!``8')0```````(`````````'\$```2``P`(#9```````"B````
+XM`````(X$```2``P`4!M```````"3`````````)4$```2````K!A```````"5
+XM`````````*4$```2````O!A``````````````````+0$```1`!<`N'Y0````
+XM```(`````````,4$```2````S!A``````````````````-8$```2````W!A`
+XM``````!+`````````.P$```2````[!A```````"L`0````````<%```2``P`
+XM,"Y````````'`0```````!,%```2``P`<$I```````#N`0```````!T%```2
+XM``P`<&=```````"?`0```````"X%```2````_!A````````H`````````$4%
+XM```2````#!E```````",`0```````%L%```2````'!E`````````````````
+XM`&P%```2````+!E````````V`````````((%```0`/'_L'Y0````````````
+XM`````(X%```2````/!E````````+`````````*0%```2````3!E`````````
+XM`````````+0%```2``P`@"-```````!P"````````+D%```2````7!E`````
+XM``"-`0```````-`%```2````;!E```````!*`0```````.$%```2````?!E`
+XM``````!J`````````/@%```2````C!E```````#J``````````@&```2``P`
+XM<"Q```````"V`0```````!4&```2``P`L$U```````!!`````````"D&```2
+XM````G!E```````"$`0```````$`&```2````K!E```````#C`0```````%0&
+XM```2````O!E```````!E`````````&4&```2``T`.&E`````````````````
+XM`&L&```1`!<`P'Y0```````(`````````'\&```2````S!E````````,````
+XM`````)<&```2````W!E``````````````````*@&```2````[!E```````#*
+XM`````````+D&```2````_!E```````!*`0```````,X&```2````#!I`````
+XM```E`````````.`&```2````'!I``````````````````.\&```2````+!I`
+XM``````````````````$'```2````/!I```````#F`````````!,'```2````
+XM3!I```````#!`0```````"X'```2````7!I````````O`````````#T'```2
+XM````;!I```````"O`````````$X'```2````?!I````````7`````````&('
+XM```2``P`0#=```````!)`0```````'0'```2````C!I```````"J````````
+XM`(('```2````G!I````````J`0```````)0'```0`/'_L'Y0````````````
+XM`````)L'```2````K!I``````````````````*P'```1`!8`:'Q0````````
+XM`````````,('```0`/'_X'Y0`````````````````,<'```2````O!I`````
+XM``#R`````````-@'```1`!<`R'Y0```````(`````````.P'```2````S!I`
+XM``````!V`````````/L'```1`!<`T'Y0```````$``````````P(```2````
+XMW!I````````O`````````!T(```2``P``$Y```````!F`````````"\(```2
+XM``P`D$E```````#9`````````$$(```2````[!I````````>`````````%((
+XM```2````_!I```````"Y`0```````&T(```2````#!M````````A````````
+XM`(((```2````'!M```````!S`0```````)T(```@````````````````````
+XM`````+$(```2````+!M````````+`````````,<(```2``P`8$Q````````E
+XM`0```````-((```2````/!M```````!H`0```````.@(```2``P`L#E`````
+XM```5`P````````!A8FET86<`7U]#5$]27TQ)4U1?7P!?7T143U)?3$E35%]?
+XM`%]?2D-27TQ)4U1?7P!?7V1O7V=L;V)A;%]D=&]R<U]A=7@`8V]M<&QE=&5D
+XM+C4P,CD`<"XU,#(W`&9R86UE7V1U;6UY`%]?0U1/4E]%3D1?7P!?7T143U)?
+XM14Y$7U\`7U]&4D%-15]%3D1?7P!?7TI#4E]%3D1?7P!?7V1O7V=L;V)A;%]C
+XM=&]R<U]A=7@`<W1R:7!?=7-A9V4`;6-S7W5S86=E`&5L9F-O<'E?=7-A9V4`
+XM8W)E871E7V9I;&4`96QF8V]P>5]L;VYG;W!T<P!S=')I<%]L;VYG;W!T<P!I
+XM;G-E<G1?=&]?<V5C7VQI<W0`861D7W1O7W-H<W1R=&%B`&ES7V-O;7!R97-S
+XM7W-E8W1I;VX`:7-?87!P96YD7W-E8W1I;VX`<')I;G1?9&%T80!I<U]G;&]B
+XM86Q?<WEM8F]L`&ES7VQO8V%L7W-Y;6)O;`!I;G-E<G1?<VAT86(`8V]P>5]D
+XM871A`&9P<FEN=&9`0$9"4T1?,2XP`&5L9E]S971S:'-T<FYD>$!`1D)31%\Q
+XM+C``9V5L9E]G971E:&1R0$!&0E-$7S$N,`!E;&9?=7!D871E0$!&0E-$7S$N
+XM,`!C;W!Y7W-H9'(`9V5T96YV0$!&0E-$7S$N,`!A9&1?=&]?:V5E<%]L:7-T
+XM`%]$64Y!34E#`&5L9E]G971D871A0$!&0E-$7S$N,`!P=71C0$!&0E-$7S$N
+XM,`!S=')N8VUP0$!&0E-$7S$N,`!S=')D=7!`0$9"4T1?,2XP`&ES7W)E;6]V
+XM95]R96QO8U]S96,`8V]P>5]C;VYT96YT`&5L9E]N97=D871A0$!&0E-$7S$N
+XM,`!L;V]K=7!?<W1R:6YG`&9R96%D0$!&0E-$7S$N,`!R96YA;65`0$9"4T1?
+XM,2XP`&5L9E]G971P:&YU;4!`1D)31%\Q+C``7U]D<V]?:&%N9&QE`&5L9E]E
+XM<G)M<V=`0$9"4T1?,2XP`&-R96%T95]S>6UT86(`9V5L9E]U<&1A=&5?<F5L
+XM0$!&0E-$7S$N,`!A9&1?=6YL;V%D86)L97,`7VEN:71?=&QS0$!&0E-$7S$N
+XM,`!R96%L;&]C0$!&0E-$7S$N,`!E;&9?;F5X='-C;D!`1D)31%\Q+C``9V5L
+XM9E]G971S:&1R0$!&0E-$7S$N,`!R97-Y;F-?<V5C=&EO;G,`7VEN:70`9V5L
+XM9E]N97=P:&1R0$!&0E-$7S$N,`!E<G)X0$!&0E-$7S$N,`!E;G9I<F]N`'-T
+XM<FYC<'E`0$9"4T1?,2XP`'-T<F-H<D!`1D)31%\Q+C``9V5L9E]F<VEZ94!`
+XM1D)31%\Q+C``96QF7W-T<G!T<D!`1D)31%\Q+C``96QF7V=E='-H<W1R;F1X
+XM0$!&0E-$7S$N,`!?7VES=&AR96%D961`0$9"4T1?,2XP`&=E=&]P=$!`1D)3
+XM1%\Q+C``96QF7VMI;F1`0$9"4T1?,2XP`%]?<')O9VYA;64`;&]O:W5P7W-E
+XM8U]A8W0`7W-T87)T`'=A<FYX0$!&0E-$7S$N,`!S=&%T0$!&0E-$7S$N,`!O
+XM<'1A<F=`0$9"4T1?,2XP`&UE;7-E=$!`1D)31%\Q+C``96QF7V9L86=E;&9`
+XM0$9"4T1?,2XP`&=E;&9?=7!D871E7V5H9')`0$9"4T1?,2XP`'5P9&%T95]S
+XM:&1R`&-O<'E?<&AD<@!I;G-E<G1?=&]?<W1R=&%B`&=E;&9?;F5W96AD<D!`
+XM1D)31%\Q+C``9V5L9E]G971S>6U`0$9"4T1?,2XP`'-T<F-M<$!`1D)31%\Q
+XM+C``96QF7W9E<G-I;VY`0$9"4T1?,2XP`%]?8G-S7W-T87)T`&=E=&]P=%]L
+XM;VYG0$!&0E-$7S$N,`!C;&]S94!`1D)31%\Q+C``;6%I;@!G96QF7V=E='!H
+XM9')`0$9"4T1?,2XP`&-A;&QO8T!`1D)31%\Q+C``96QF7V=E='-H;G5M0$!&
+XM0E-$7S$N,`!F;W!E;D!`1D)31%\Q+C``<V5T7W-H<W1R=&%B`&QO;VMU<%]K
+XM965P7W-Y;6QI<W0`9V5L9E]G971R96QA0$!&0E-$7S$N,`!E;&9?8F5G:6Y`
+XM0$9"4T1?,2XP`&9E<G)O<D!`1D)31%\Q+C``7V9I;FD`7U]S=&1O=71P0$!&
+XM0E-$7S$N,`!G96QF7V=E=&-L87-S0$!&0E-$7S$N,`!F8VAM;V1`0$9"4T1?
+XM,2XP`&9W<FET94!`1D)31%\Q+C``96QF7VYE=W-C;D!`1D)31%\Q+C``;6MS
+XM=&5M<$!`1D)31%\Q+C``;W!E;D!`1D)31%\Q+C``;65M;6]V94!`1D)31%\Q
+XM+C``7U]S=V)U9D!`1D)31%\Q+C``9V5L9E]U<&1A=&5?<&AD<D!`1D)31%\Q
+XM+C``97AI=$!`1D)31%\Q+C``;6%L;&]C0$!&0E-$7S$N,`!E;&9?97)R;F]`
+XM0$9"4T1?,2XP`&ES7W)E;6]V95]S96-T:6]N`&5R<D!`1D)31%\Q+C``96QF
+XM7V5N9$!`1D)31%\Q+C``7V5D871A`&UE;6-P>4!`1D)31%\Q+C``7T=,3T)!
+XM3%]/1D93151?5$%"3$5?`%]E;F0`9F-L;W-E0$!&0E-$7S$N,`!?7W-T9&5R
+XM<G!`0$9"4T1?,2XP`&9R965`0$9"4T1?,2XP`&]P=&EN9$!`1D)31%\Q+C``
+XM871E>&ET0$!&0E-$7S$N,`!A9&1?=&]?<W1R:7!?;&ES=`!A9&1?=&]?:6YS
+XM96=?;&ES=`!S=')L96Y`0$9"4T1?,2XP`&=E;&9?=7!D871E7W)E;&%`0$9"
+XM4T1?,2XP`&5L9E]N9'AS8VY`0$9"4T1?,2XP`&=E;&9?=7!D871E7W-H9')`
+XM0$9"4T1?,2XP`%]*=E]296=I<W1E<D-L87-S97,`9V5T<')O9VYA;65`0$9"
+XM4T1?,2XP`'-E='5P7W!H9'(`9V5L9E]G971R96Q`0$9"4T1?,2XP`&-R96%T
+XM95]S8VX`````````````````````````````````````````````````````
+XM````````````````````````````````````````&P````$````"````````
+XM`,@!0```````R`$````````5`````````````````````0``````````````
+XM`````",````'`````@````````#@`4```````.`!````````&```````````
+XM``````````0````````````````````Q````!0````(`````````^`%`````
+XM``#X`0```````%0"````````!``````````(``````````0`````````-P``
+XM``L````"`````````%`$0```````4`0```````"`!P````````4````!````
+XM"``````````8`````````#\````#`````@````````#0"T```````-`+````
+XM````#P,```````````````````$```````````````````!'````____;P(`
+XM````````X`Y```````#@#@```````*``````````!``````````"````````
+XM``(`````````5````/[__V\"`````````(`/0```````@`\```````!`````
+XM``````4````"````"````````````````````&,````$````0@````````#`
+XM#T```````,`/````````>``````````$``````````@`````````&```````
+XM``!M````!````$(`````````.!!````````X$````````)`&````````!```
+XM``L````(`````````!@`````````=P````$````&`````````,@60```````
+XMR!8````````3````````````````````!````````````````````'(````!
+XM````!@````````#<%D```````-P6````````<`0```````````````````0`
+XM````````$`````````!]`````0````8`````````4!M```````!0&P``````
+XM`.A-```````````````````0````````````````````@P````$````&````
+XM`````#AI0```````.&D````````.````````````````````!```````````
+XM`````````(D````!`````@````````!(:4```````$AI````````_`@`````
+XM``````````````@```````````````````"1`````0````(`````````1')`
+XM``````!$<@````````@````````````````````$````````````````````
+XMGP````$````#`````````&!R4```````8'(``````````P``````````````
+XM````(````````````````````*4````!`````@````````!@=5```````&!U
+XM````````0`4```````````````````@```````````````````"O````!@``
+XM``,`````````H'I0``````"@>@```````*`!````````!0`````````(````
+XM`````!``````````N`````$````#`````````$!\4```````0'P````````0
+XM````````````````````"````````````````````+\````!`````P``````
+XM``!0?%```````%!\````````$`````````````````````@`````````````
+XM``````#&`````0````,`````````8'Q0``````!@?`````````@`````````
+XM```````````(````````````````````RP````$````#`````````&A\4```
+XM````:'P```````!(`@``````````````````"``````````(`````````-``
+XM```(`````P````````"P?E```````+!^````````,```````````````````
+XM``@```````````````````#5`````0````````````````````````"P?@``
+XM`````/8!```````````````````!````````````````````$0````,`````
+XM````````````````````IH````````#>`````````````````````0``````
+XM``````````````$````"`````````````````````````(B!``````````\`
+XM```````;````,P````@`````````&``````````)`````P``````````````
+XM``````````"(D````````/,(```````````````````!````````````````
+X#````
X`
Xend
-END-of-elfcopy.1.uu
+e4e59173f6354081a9e3a7debde2f069
echo x - elfcopy.uu
-sed 's/^X//' >elfcopy.uu << 'END-of-elfcopy.uu'
-Xbegin 755 elfcopy
+sed 's/^X//' >elfcopy.uu << '2151ae8f08071e33d3c60fbc8f2d2844'
+Xbegin 644 elfcopy
XM?T5,1@(!`0D```````````(`/@`!````4!M```````!``````````#AM`0``
XM`````````$``.``'`$``)0`B``8````%````0`````````!``$```````$``
XM0```````B`$```````"(`0````````@``````````P````0```#(`0``````
@@ -3217,6 +3218,6 @@ XM7U)E9VES=&5R0VQA<W-E<P!G971P<F]G;F%M94!`1D)31%\Q+C``<V5T=7!?
XF<&AD<@!G96QF7V=E=')E;$!`1D)31%\Q+C``8W)E871E7W-C;@``
X`
Xend
-END-of-elfcopy.uu
+2151ae8f08071e33d3c60fbc8f2d2844
exit
diff --git a/test/elfcopy/tc/strip-onlydebug-1/out/strip-onlydebug-1.out.shar b/test/elfcopy/tc/strip-onlydebug-1/out/strip-onlydebug-1.out.shar
index f5a5d8c11436..dd813fa275ce 100644
--- a/test/elfcopy/tc/strip-onlydebug-1/out/strip-onlydebug-1.out.shar
+++ b/test/elfcopy/tc/strip-onlydebug-1/out/strip-onlydebug-1.out.shar
@@ -9,9 +9,9 @@
# sections.o.uu
#
echo x - sections.o.1.uu
-sed 's/^X//' >sections.o.1.uu << 'END-of-sections.o.1.uu'
+sed 's/^X//' >sections.o.1.uu << 'eb2ac2808b7045ab3c2faf26922f5e01'
Xbegin 644 sections.o.1
-XM?T5,1@(!`0D```````````$`/@`!`````````````````````````/!3````
+XM?T5,1@(!`0D```````````$`/@`!`````````````````````````(B?````
XM`````````$```````$``&P`8``$1`24.$PL##AL.$0$2`1`&```")``+"SX+
XM`PX```,6``,..@L["TD3```$)``+"SX+`P@```4D``L+/@L```8/``L+```'
XM#P`+"TD3```()@!)$P``"1,!`PX+"SH+.PL!$P``"@T``PXZ"SL+21,X"@``
@@ -489,479 +489,479 @@ XM=6=?;&EN90`N8V]M;65N=``N<F]D871A+G-T<C$N,0`N<F]D871A+G-T<C$N
XM.``N<F5L82YD96)U9U]F<F%M90`N<F5L82YE:%]F<F%M90`N9&5B=6=?;&]C
XM`"YR96QA+F1E8G5G7W!U8FYA;65S`"YR96QA+F1E8G5G7V%R86YG97,`+F1E
XM8G5G7W)A;F=E<P`N9&5B=6=?<W1R````````````````````````````````
-XM````````````````````````````````````````````````````````(```
-XM``@````&````````````````````0`````````#>%P``````````````````
-XM$````````````````````!L````$`````````````````````````+AC````
-XM````D!4````````9`````0````@`````````&``````````F````"`````,`
-XM``````````````````!````````````````````````````````$````````
-XM````````````+`````@````#````````````````````0```````````````
-XM````````````````!````````````````````#$````!````````````````
-XM`````````$``````````=0,```````````````````$`````````````````
-XM``!$`````0````````````````````````"U`P````````(9````````````
-XM```````!````````````````````/P````0`````````````````````````
-XM2'D````````@*````````!D````&````"``````````8`````````%4````!
-XM`````````````````````````+<<````````@@0```````````````````$`
-XM``````````````````!0````!`````````````````````````!HH0``````
-XM`!@`````````&0````@````(`````````!@`````````80````$`````````
-XM````````````````.2$````````P`````````````````````0``````````
-XM`````````&H````(````,@```````````````````&DA````````UP(`````
-XM``````````````$``````````0````````!Y````"````#(`````````````
-XM``````!P(0```````"T````````````````````(``````````$`````````
-XMC0````$`````````````````````````<"$```````#(`@``````````````
-XM````"````````````````````(@````$`````````````````````````("A
-XM``````````,````````9````#0````@`````````&`````````"?````"```
-XM``(````````````````````X)````````%`"```````````````````(````
-XM````````````````F@````0`````````````````````````@*0```````"`
-XM`0```````!D````/````"``````````8`````````*D````!````````````
-XM`````````````#@D````````#AX```````````````````$`````````````
-XM``````"Y`````0````````````````````````!&0@```````+L`````````
-XM```````````!````````````````````M`````0`````````````````````
-XM`````*8````````8`````````!D````2````"``````````8`````````,X`
-XM```!``````````````````````````%#````````,```````````````````
-XM``$```````````````````#)````!``````````````````````````8I@``
-XM`````#``````````&0```!0````(`````````!@`````````W0````$`````
-XM````````````````````,4,```````#@!@```````````````````0``````
-XM`````````````.L````!````,````````````````````!%*````````Z`@`
-XM``````````````````$``````````0`````````1`````P``````````````
-XM``````````#Y4@```````/8````````````````````!````````````````
-XM`````0````(`````````````````````````L%H```````"0!@```````!H`
-XM```8````"``````````8``````````D````#````````````````````````
-XM`$!A````````=P(```````````````````$`````````````````````````
-XM```````````````````````````!````!`#Q_P``````````````````````
-XM`````P`!`````````````````````````````P`#````````````````````
-XM`````````P`$`````````````````````````````P`%````````````````
-XM`````````````P`&`````````````````````````````P`(````````````
-XM```````````,`````@`!````````````<````````````````P`+````````
-XM```````````````?`````@`!`#`#````````:P```````````````P`,````
-XM```````````````````O`````@`!`+`*````````(@````````!#`````@`!
-XM`.`*````````-P````````!5`````@`!`"`+````````0`$```````!G````
-XM`@`!`!`0````````VP```````````````P`-````````````````````````
-XM`````P`/`````````````````````````````P`1````````````````````
-XM`````````P`2`````````````````````````````P`4````````````````
-XM`````````````P`6`````````````````````````````P`7````````````
-XM`````````````````P`*``````````````````````!R````$@`!`'``````
-XM````M@$```````!_````$`````````````````````````",````$```````
-XM``````````````````"8````$`````````````````````````"I````$```
-XM``````````````````````"T````$`````````````````````````#$````
-XM$`````````````````````````#,````$`````````````````````````#7
-XM````$`````````````````````````#<````$@`!`#`"````````_```````
-XM``#H````$`````````````````````````#V````$```````````````````
-XM`````````0``$``````````````````````````1`0``$@`!`*`#````````
-XMZ0$````````A`0``$``````````````````````````L`0``$```````````
-XM```````````````S`0``$``````````````````````````W`0``$@`!`)`%
-XM````````]`````````!!`0``$`````````````````````````!-`0``$@`!
-XM`)`&````````.0$```````!7`0``$@`!`-`'````````+P$```````!G`0``
-XM$`````````````````````````!M`0``$@`!```)````````_P````````!Z
-XM`0``$`````````````````````````"'`0``$```````````````````````
-XM``"2`0``$@`!```*````````H@````````"A`0``$```````````````````
-XM``````"H`0``$`````````````````````````"O`0``$```````````````
-XM``````````"V`0``$`````````````````````````"]`0``$```````````
-XM``````````````#%`0``$@`!`&`,````````I@,```````#0`0``$```````
-XM``````````````````#@`0``$`````````````````````````#L`0``$```
-XM``````````````````````#W`0``$``````````````````````````)`@``
-XM$``````````````````````````6`@``$``````````````````````````@
-XM`@``$``````````````````````````E`@``$```````````````````````
-XM```M`@``$@`!`/`0````````[@8````````Z`@``$```````````````````
-XM``````!(`@``$`````````````````````````!/`@``$```````````````
-XM``````````!7`@``$`````````````````````````!C`@``$```````````
-XM````````````````<V5C=&EO;G,N8P!I;G-E<G1?=&]?<V5C7VQI<W0`861D
-XM7W1O7W-H<W1R=&%B`&ES7V-O;7!R97-S7W-E8W1I;VX`:7-?87!P96YD7W-E
-XM8W1I;VX`:7-?<F5M;W9E7W-E8W1I;VX`<')I;G1?9&%T80!S971?<VAS=')T
-XM86(`9V5L9E]G971S:&1R`&5L9E]N97=D871A`&=E;&9?=7!D871E7W-H9'(`
-XM96QF7VYD>'-C;@!E;&9?<V5T<VAS=')N9'@`;65M;6]V90!E;&9?97)R;7-G
-XM`&5R<G@`=7!D871E7W-H9'(`;&]O:W5P7W-T<FEN9P!E;&9?97)R;F\`:6YS
-XM97)T7W1O7W-T<G1A8@!A9&1?=6YL;V%D86)L97,`96QF7VYE=W-C;@!C86QL
-XM;V,`97)R`&-O<'E?9&%T80!E;&9?9V5T9&%T80!C;W!Y7W-H9'(`<F5S>6YC
-XM7W-E8W1I;VYS`'=A<FYX`&EN<V5R=%]S:'1A8@!G96QF7V=E=&5H9'(`9V5L
-XM9E]F<VEZ90!L;V]K=7!?<V5C7V%C=`!S=')C;7``;6%L;&]C`&UE;7-E=`!S
-XM=')L96X`<W1R;F-M<`!C<F5A=&5?<V-N`&5L9E]G971S:'-T<FYD>`!E;&9?
-XM;F5X='-C;@!E;&9?<W1R<'1R`&%D9%]T;U]I;G-E9U]L:7-T`%]?:7-T:')E
-XM861E9`!?7W-T9&]U='``<'5T8P!?7W-W8G5F`&-O<'E?8V]N=&5N=`!C<F5A
-XM=&5?<WEM=&%B`&UE;6-P>0!S=')N8W!Y`&=E;&9?9V5T<F5L`&QO;VMU<%]K
-XM965P7W-Y;6QI<W0``)<``````````@```!D```#\_________^X`````````
-XM`@```!H```#\_________QL!`````````@```!L```#\_________UD!````
-XM`````@```!P```#\_________V8!`````````@```!T```#\_________Z4!
-XM`````````@```!X```#\_________[0!`````````@```!\```#\________
-XM_[D!````````"@````D``````````````,@!`````````@```"````#\____
-XM_____](!`````````@```!\```#\_________]<!````````"@````D````>
-XM`````````.8!`````````@```"````#\__________`!`````````@```!\`
-XM``#\__________4!````````"@````D````W``````````0"`````````@``
-XM`"````#\_________PX"`````````@```!\```#\_________Q,"````````
-XM"@````D```!5`````````"("`````````@```"````#\_________T\"````
-XM`````@```!D```#\_________V`"`````````@```"(```#\_________Y<"
-XM`````````@```!P```#\_________Z@"`````````@```!L```#\________
-XM_[H"`````````@```",```#\_________]L"`````````@```!\```#\____
-XM_____^`"````````"@````D```!R`````````.\"`````````@```"````#\
-XM__________D"`````````@```!\```#\__________X"````````"@````D`
-XM```W``````````T#`````````@```"````#\_________Q0#`````````@``
-XM`!\```#\_________QD#````````"@````D```".`````````"@#````````
-XM`@```"````#\_________VD#````````"@````D```"E`````````&X#````
-XM`````@```"0```#\_________W8#````````"@````D```"F`````````'L#
-XM`````````@```"0```#\_________X,#````````"@````D```"N````````
-XM`(@#`````````@```"0```#\_________XT#````````"@````D```"V````
-XM`````)4#`````````@```"0```#\_________[T#````````"@````D```"V
-XM`````````/4#`````````@```"8```#\_________Q`$`````````@```"<`
-XM``#\_________V\$`````````@```!H```#\_________[,$`````````@``
-XM`!D```#\_________]H$`````````@```!L```#\_________P8%````````
-XM`@```!\```#\_________PL%````````"@````D```#``````````!H%````
-XM`````@```"````#\_________Q\%````````"@````D```#8`````````"L%
-XM`````````@```"@```#\_________S4%`````````@```!\```#\________
-XM_SH%````````"@````D````>`````````$D%`````````@```"````#\____
-XM_____U,%`````````@```!\```#\_________U@%````````"@````D```#E
-XM`````````&<%`````````@```"````#\_________W$%`````````@```!\`
-XM``#\_________W8%````````"@````D````W`````````(4%`````````@``
-XM`"````#\_________[4%`````````@```!H```#\__________X%````````
-XM`@```"H```#\_________PL&`````````@```",```#\_________U$&````
-XM`````@```!\```#\_________U8&````````"@````D````>`````````&4&
-XM`````````@```"````#\_________VP&`````````@```!\```#\________
-XM_W$&````````"@````D````#`0```````(`&`````````@```"````#\____
-XM_____[T&`````````@```!D```#\_________]$&`````````@```!D```#\
-XM_________S\'`````````@```!L```#\_________W4'`````````@```!\`
-XM``#\_________WH'````````"@````D````<`0```````(D'`````````@``
-XM`"````#\_________Y,'`````````@```!\```#\_________Y@'````````
-XM"@````D````Z`0```````*<'`````````@```"````#\_________[$'````
-XM`````@```!\```#\_________[8'````````"@````D```!8`0```````,4'
-XM`````````@```"````#\_________TL(`````````@```!D```#\________
-XM_VX(`````````@```!L```#\_________[,(````````"@````L`````````
-XM`````+H(`````````@```"T```#\_________\D(`````````@```!\```#\
-XM_________\X(````````"@````D```!S`0```````-T(`````````@```"``
-XM``#\_________^<(`````````@```!\```#\_________^P(````````"@``
-XM``D```!8`0```````/L(`````````@```"````#\_________Q$)````````
-XM`@```"\```#\_________RD)`````````@```"<```#\_________WH)````
-XM`````@```#````#\_________[@)`````````@```!\```#\_________[T)
-XM````````"@````D```"1`0```````,P)`````````@```"````#\________
-XM_]8)`````````@```!\```#\_________]L)````````"@````D```"Y`0``
-XM`````.H)`````````@```"````#\_________^\)````````"@````D```"K
-XM`0```````/L)`````````@```"````#\_________S$*`````````@```#(`
-XM``#\_________U0*`````````@```#,```#\_________VL*`````````@``
-XM`#0```#\_________Y0*````````"@````D```#1`0```````)X*````````
-XM`@```"````#\_________[<*`````````@```#$```#\_________^<*````
-XM`````@```#$```#\_________T(+````````"@````D```"V`````````&D+
-XM````````"@````D```"F`````````(8+````````"@````D```"N````````
-XM`)<+````````"@````D```#C`0```````*(+````````"P````D```#C`0``
-XM`````*L+````````"P````D```#J`0```````+0+````````"P````D```#\
-XM`0```````+T+````````"P````D````"`@```````.(+`````````@```#4`
-XM``#\__________`+`````````@```#8```#\_________R(,`````````@``
-XM`#$```#\_________W\,`````````@```"<```#\_________Y,,````````
-XM"P````D```"V`````````,L,`````````@```#@```#\_________^@,````
-XM`````@```#D```#\__________\,`````````@```!D```#\_________QT-
-XM`````````@```#H```#\_________U0-````````"@````D```"V````````
-XM`'X-`````````@```"8```#\_________Y,-`````````@```!P```#\____
-XM_____[@-````````"@````D```"F`````````-(-````````"@````D```"N
-XM`````````!$.`````````@```#@```#\_________RH.`````````@```#D`
-XM``#\_________SX.`````````@```!P```#\_________TX.`````````@``
-XM`!D```#\_________VL.`````````@```#H```#\_________YL.````````
-XM`@```"<```#\_________]P.`````````@```#L```#\__________<.````
-XM`````@```"L```#\_________P$/`````````@```",```#\_________Q`/
-XM`````````@```!\```#\_________Q4/````````"@````D```".````````
-XM`"0/`````````@```"````#\_________RD/`````````@```",```#\____
-XM_____TD/`````````@```!\```#\_________TX/````````"@````D````_
-XM`@```````%T/`````````@```"````#\_________V</`````````@```!\`
-XM``#\_________VP/````````"@````D````C`@```````'L/`````````@``
-XM`"````#\_________X4/`````````@```!\```#\_________XH/````````
-XM"@````D```"#`@```````)D/`````````@```"````#\_________Z,/````
-XM`````@```!\```#\_________Z@/````````"@````D```!M`@```````+</
-XM`````````@```"````#\_________[P/````````"@````D```"K`0``````
-XM`,8/`````````@```"@```#\_________]`/`````````@```!\```#\____
-XM_____]4/````````"@````D````(`@```````.0/`````````@```"````#\
-XM_________^X/`````````@```!\```#\__________,/````````"@````D`
-XM``!5`@````````(0`````````@```"````#\_________R80`````````@``
-XM`#P```#\_________S$0`````````@```#T```#\_________V40````````
-XM`@```#P```#\_________W`0`````````@```#T```#\_________Z00````
-XM`````@```#T```#\_________ZX0`````````@```#X```#\_________[<0
-XM`````````@```#T```#\_________[\0`````````@```#X```#\________
-XM_],0`````````@```#\```#\_________^(0`````````@```#\```#\____
-XM_____S<1````````"@````D```"F`````````%<1`````````@```$$```#\
-XM_________X`1````````"@````D```"N`````````)(1````````"@````D`
-XM``"V`````````.H1`````````@```#,```#\_________PP2`````````@``
-XM`$(```#\_________R$2`````````@```"H```#\_________SL2````````
-XM`@```#,```#\_________UD2`````````@```!D```#\_________\$2````
-XM`````@```",```#\_________P(3`````````@```#,```#\_________ZD3
-XM`````````@```#4```#\_________\$3`````````@```#(```#\________
-XM_PD4`````````@```"D```#\_________QD4`````````@```#$```#\____
-XM_____V`4`````````@```"H```#\_________VT4`````````@```",```#\
-XM_________WL4`````````@```#P```#\_________XH4`````````@```#T`
-XM``#\_________]84`````````@```$,```#\_________S85`````````@``
-XM`$,```#\_________U`5`````````@```#$```#\_________UP5````````
-XM`@```#4```#\_________W05`````````@```$,```#\_________Z(5````
-XM`````@```$(```#\_________[<5`````````@```#$```#\_________\`5
-XM`````````@```#4```#\_________]05````````"@````D```"^`@``````
-XM`.`5`````````@```"@```#\_________^<5`````````@```#T```#\____
-XM______$5`````````@```#X```#\_________R46`````````@```"H```#\
-XM_________T,6`````````@```$0```#\_________V<6`````````@```!P`
-XM``#\_________WL6`````````@```#H```#\_________Y$6`````````@``
-XM`$4```#\_________ZH6`````````@```#,```#\_________]H6````````
-XM`@```#\```#\_________^D6`````````@```#,```#\_________Q,7````
-XM`````@```!\```#\_________Q@7````````"@````D````#`0```````"<7
-XM`````````@```"````#\_________RP7````````"@````D```"P`@``````
-XM`#87`````````@```"@```#\_________T`7`````````@```!\```#\____
-XM_____T47````````"@````D```"1`0```````%07`````````@```"````#\
-XM_________UX7`````````@```!\```#\_________V,7````````"@````D`
-XM```_`@```````'(7`````````@```"````#\_________WP7`````````@``
-XM`!\```#\_________X$7````````"@````D```"9`@```````)`7````````
-XM`@```"````#\_________Y47`````````@```",```#\_________\47````
-XM`````@```#````#\_________V$#`````````@```"0```#\_________P8`
-XM````````"@````4```````````````P`````````"@```!8```!'"```````
-XM`!$`````````"@```!8````!`@```````!4`````````"@```!8```!#!@``
-XM`````!D``````````0````(``````````````"$``````````0````(```#>
-XM%P```````"D`````````"@````<``````````````#``````````"@```!8`
-XM``#_!P```````#<`````````"@```!8````O!P```````#X`````````"@``
-XM`!8```#I!0```````$,`````````"@```!8```!<`@```````%``````````
-XM"@```!8````7"````````%P`````````"@```!8```!/!P```````&D`````
-XM````"@```!8```!Q`````````&X`````````"@```!8```!L!0```````'L`
-XM````````"@```!8```#S!0```````(``````````"@```!8````T`P``````
-XM`(T`````````"@```!8```#E!@```````)0`````````"@```!8```!G"```
-XM`````)L`````````"@```!8```#B`0```````*``````````"@```!8```!P
-XM!@```````+``````````"@```!8```#Q!P```````+T`````````"@```!8`
-XM``"8`P```````,(`````````"@```!8```"+!0```````,T`````````"@``
-XM`!8```"M`0```````-@`````````"@```!8````Z!@```````/0`````````
-XM"@```!8````$`P```````/\`````````"@```!8```#;`0````````H!````
-XM````"@```!8```"O!P```````!8!````````"@```!8```!X!````````"0!
-XM````````"@```!8```",`````````#D!````````"@```!8````X`@``````
-XM`&P!````````"@```!8```"E`````````'H!````````"@```!8```"9!```
-XM`````)8!````````"@```!8```"<`````````*0!````````"@```!8```!]
-XM`0```````+(!````````"@```!8```#Z`P```````,`!````````"@```!8`
-XM```7`0```````,X!````````"@```!8```#1"````````-P!````````"@``
-XM`!8```"Q!0```````/@!````````"@```!8````N!0```````!0"````````
-XM"@```!8```#7"````````"("````````"@```!8```"1"````````#X"````
-XM````"@```!8```#*!@```````$T"````````"@```!8```!R`@```````-,"
-XM````````"@```!8````3`````````/\"````````"@```!8```"O"```````
-XM``P#````````"@```!8```!'!````````!$#````````"@```!8```#)!P``
-XM`````!P#````````"@```!8```"V`````````#\#````````"@```!8```#2
-XM!0```````$T#````````"@```!8```"%`P```````%P#````````"@```!8`
-XM``"(!````````&<#````````"@```!8``````````````'(#````````"@``
-XM`!8````_`P```````'T#````````"@```!8```!^!````````(@#````````
-XM"@```!8```"D"````````),#````````"@```!8````Q!````````*8#````
-XM````"@```!8````)!P```````+0#````````"@```!8```"2!P```````,(#
-XM````````"@```!8```"V!P```````-`#````````"@```!8```"L````````
-XM`-X#````````"@```!8```"E`0```````.P#````````"@```!8```#'````
-XM`````/H#````````"@```!8```!B``````````@$````````"@```!8```"R
-XM`P```````!8$````````"@```!8```#P`````````"0$````````"@```!8`
-XM``"P`@```````#($````````"@```!8````&!@```````$`$````````"@``
-XM`!8```!F`0```````$X$````````"@```!8```#;!0```````%P$````````
-XM"@```!8```#@`P```````&L$````````"@```!8```#F!P```````'X$````
-XM````"@```!8````S"````````(P$````````"@```!8```#W!@```````)H$
-XM````````"@```!8```"F!P```````*@$````````"@```!8```"-!@``````
-XM`+8$````````"@```!8````%!0```````,0$````````"@```!8```"K!```
-XM`````-($````````"@```!8````R!@```````.`$````````"@```!8```#8
-XM`P```````.X$````````"@```!8```"7"````````/P$````````"@```!8`
-XM``!?`P````````L%````````"@```!8```#,`@```````!X%````````"@``
-XM`!8```#2!0```````"P%````````"@```!8```"%`P```````#L%````````
-XM"@```!8```"4!0```````%$%````````"@```!8````["````````%<%````
-XM````"@```!8````W`0```````&(%````````"@```!8```!+`0```````'`%
-XM````````"@```!8````C!0```````'8%````````"@```!8```"Y!```````
-XM`'P%````````"@```!8```"=`P```````((%````````"@```!8```![`P``
-XM`````(@%````````"@```!8```!5!````````(X%````````"@```!8```"T
-XM"````````)0%````````"@```!8```",`P```````)H%````````"@```!8`
-XM``!7`````````*`%````````"@```!8```!O`P```````*8%````````"@``
-XM`!8```"G`P```````*P%````````"@```!8````]!````````+(%````````
-XM"@```!8```!:!P```````+@%````````"@```!8````H!@```````+X%````
-XM````"@```!8```#Y`@```````,0%````````"@```!8```#I!````````,H%
-XM````````"@```!8```#%"````````-`%````````"@```!8````=`0``````
-XM`-8%````````"@```!8```""`@```````-P%````````"@```!8````2`P``
-XM`````.(%````````"@```!8```"V!@```````.@%````````"@```!8````+
-XM"````````.X%````````"@```!8```#/!````````/0%````````"@```!8`
-XM```5`@```````/H%````````"@```!8```"2``````````$&````````"@``
-XM`!8````<`P```````!0&````````"@```!8````>!@```````",&````````
-XM"@```!8```#\!0```````"\&````````"@```!8```#3!@```````#T&````
-XM````"@```!8```#$!````````$L&````````"@```!8```!J!@```````%D&
-XM````````"@```!8```!J`````````&<&````````"@```!8````+`P``````
-XM`'4&````````"@```!8```#_!@```````(,&````````"@```!8````#`0``
-XM`````)$&````````"@```!8```"*!P```````)\&````````"@```!8````>
-XM!````````+H&````````"@```!8```!Y!P```````,4&````````"@```!8`
-XM``#Y`````````-`&````````"@```!8```#1`0```````-L&````````"@``
-XM`!8```#)!0```````.X&````````"@```!8````>!@```````/T&````````
-XM"@```!8```!@!`````````D'````````"@```!8```"Q!@```````!<'````
-XM````"@```!8```"%`0```````#0'````````"@```!8````>!@```````$,'
-XM````````"@```!8```"^!0```````$\'````````"@```!8```"Q!@``````
-XM`%T'````````"@```!8````/!0```````&L'````````"@```!8```!V!0``
-XM`````'D'````````"@```!8```"Z`P```````)4'````````"@```!8```#Z
-XM`0```````*,'````````"@```!8````(!````````+$'````````"@```!8`
-XM``"@`0```````+\'````````"@```!8```#C!0```````,T'````````"@``
-XM`!8````]`````````-L'````````"@```!8````7!````````.D'````````
-XM"@```!8```#!!@````````8(````````"@```!8````>!@```````!4(````
-XM````"@```!8```".`0```````"$(````````"@```!8```"Q!@```````"\(
-XM````````"@```!8```""!P```````#T(````````"@```!8```#*!```````
-XM`$L(````````"@```!8````M`````````&@(````````"@```!8````)`0``
-XM`````'8(````````"@```!8```"V`0```````(4(````````"@```!8```":
-XM!@```````)$(````````"@```!8```"Q!@```````/`(````````"@```!8`
-XM``"_"````````/X(````````"@```!8````J!P```````!H)````````"@``
-XM`!8```!4`0```````"@)````````"@```!8```#^!````````#8)````````
-XM"@```!8```"2!````````$0)````````"@```!8````J"````````%()````
-XM````"@```!8```"?!P```````'4)````````"@```!8````)`0```````(,)
-XM````````"@```!8```"V`0```````)()````````"@```!8````,`@``````
-XM`)X)````````"@```!8```#;!@```````*P)````````"@```!8```#`!P``
-XM`````,,)````````"@```!8````>!@```````-()````````"@```!8```#9
-XM``````````@*````````"@```!8````J!P```````!8*````````"@```!8`
-XM```]`````````"0*````````"@```!8```"9!P```````#(*````````"@``
-XM`!8````E`P```````$\*````````"@```!8```#(`P```````%4*````````
-XM"@```!8```#/`````````%L*````````"@```!8```"?!````````&$*````
-XM````"@```!8```"A`@```````&<*````````"@```!8```"B!@```````'8*
-XM````````"@```!8````G`@```````(0*````````"@```!8```#K`P``````
-XM`*$*````````"@```!8````G`@```````*\*````````"@```!8```#K`P``
-XM`````,P*````````"@```!8````G`@```````-H*````````"@```!8```#K
-XM`P```````/<*````````"@```!8````G`@````````4+````````"@```!8`
-XM``#K`P```````"(+````````"@```!8````G`@```````#`+````````"@``
-XM`!8```#K`P```````$<+````````"@```!8```#;!@```````%4+````````
-XM"@```!8```#`!P```````&P+````````"@```!8```!B!0```````'L+````
-XM````"@```!8```!'`@```````(<+````````"@```!8```!=`0```````)4+
-XM````````"@```!8```"S!````````*,+````````"@```!8```!``@``````
-XM`-L+````````"@```!8```"5!@```````.D+````````"@```!8```#!`P``
-XM`````/<+````````"@```!8```!0``````````4,````````"@```!8```!N
-XM"````````!,,````````"@```!8````7!P```````"$,````````"@```!8`
-XM``!*`P```````"\,````````"@```!8```"_`0```````#T,````````"@``
-XM`!8```">!0```````$L,````````"@```!8```!+!0```````%D,````````
-XM"@```!8```#>`@```````&<,````````"@```!8```!`"````````'4,````
-XM````"@```!8```!"!0```````(,,````````"@```!8```#Y!P```````)$,
-XM````````"@```!8````N`P```````)\,````````"@```!8````E!```````
-XM`*T,````````"@```!8````W`````````+L,````````"@```!8```!H!```
-XM`````,H,````````"@```!8```#7`@```````-D,````````"@```!8````_
-XM`0```````.@,````````"@```!8```!R`0```````/<,````````"@```!8`
-XM``"9!P````````8-````````"@```!8```!R!P```````!P-````````"@``
-XM`!8```!^"````````",-`````````0````(``````````````"L-````````
-XM`0````(```!P`````````&@-````````"@```!8````U!0```````'`-````
-XM`````0````(```!P`````````'@-`````````0````(````F`@```````(`-
-XM````````"@```!(``````````````)0-````````"@```!(````Y````````
-XM`*(-````````"@```!(```""`````````*<-````````"@```!8```#3`P``
-XM`````+(-````````"@```!(```"X`````````,X-````````"@```!8```!$
-XM`````````-8-`````````0````(````P`@```````-X-`````````0````(`
-XM```L`P```````.8-````````"@```!(````4`0```````/H-````````"@``
-XM`!(```")`0````````@.````````"@```!(```#2`0```````!8.````````
-XM"@```!(````(`@```````"L.````````"@```!8````!!````````#8.````
-XM````"@```!(```!1`@```````#L.````````"@```!8```!J`P```````$@.
-XM````````"@```!8````.!@```````%`.`````````0````(````P`P``````
-XM`%@.`````````0````(```";`P```````&`.````````"@```!(```"'`@``
-XM`````'0.````````"@```!(```"_`@```````'D.````````"@```!8```"Q
-XM!@```````(0.````````"@```!(```#U`@```````)(.````````"@```!(`
-XM``!1`P```````)D.````````"@```!8```!:!@```````*$.`````````0``
-XM``(```"@`P```````*D.`````````0````(```")!0```````+$.````````
-XM"@```!(```":`P```````,4.````````"@```!(````W!````````-0.````
-XM````"@```!(```"3!````````-D.````````"@```!8```#!`````````.0.
-XM````````"@```!(```#)!````````/T.````````"@```!(```#_!```````
-XM``P/````````"@```!(```!(!0```````",/````````"@```!8```"6`0``
-XM`````"L/`````````0````(```"0!0```````#,/`````````0````(```"$
-XM!@```````#L/````````"@```!(```!^!0```````$T/````````"@```!(`
-XM``#>!0```````%P/````````"@```!(```!-!@```````&L/````````"@``
-XM`!(```"6!@```````'`/````````"@```!8````!!````````'L/````````
-XM"@```!(```#?!@```````((/````````"@```!8```#T!````````(H/````
-XM`````0````(```"0!@```````)(/`````````0````(```#)!P```````)H/
-XM````````"@```!(````5!P```````*X/````````"@```!(```!.!P``````
-XM`+T/````````"@```!(```"7!P```````,P/````````"@```!(```#-!P``
-XM`````-$/````````"@```!8```"Q!@```````-P/````````"@```!(````6
-XM"`````````,0````````"@```!8```"\`@````````L0`````````0````(`
-XM``#0!P```````!,0`````````0````(```#_"````````!L0````````"@``
-XM`!(```!?"````````"\0````````"@```!(```#H"````````#T0````````
-XM"@```!(````Q"0```````%T0````````"@```!(```!G"0```````&00````
-XM````"@```!8````6!0```````'`0`````````0````(`````"0```````'@0
-XM`````````0````(```#_"0```````(`0````````"@```!(````B"@``````
-XM`)00````````"@```!(```"#"@```````*(0````````"@```!(```#,"@``
-XM`````*<0````````"@```!8````R`@```````+(0````````"@```!(```#O
-XM"@```````,<0````````"@```!8````K!````````-(0````````"@```!(`
-XM```2"P```````-D0````````"@```!8```#A`````````.00`````````0``
-XM``(`````"@```````.P0`````````0````(```"B"@```````/00````````
-XM"@```!(```!("P````````<1````````"@```!(```#0"P````````P1````
-XM````"@```!8```"Q!@```````!81````````"@```!(````L#````````"41
-XM````````"@```!(```"(#````````#01````````"@```!(```#D#```````
-XM`#H1````````"@```!8```!Y!@```````$41`````````0````(```"P"@``
-XM`````$T1`````````0````(```#2"@```````%41````````"@```!(````:
-XM#0```````&@1````````"@```!(```!2#0```````&T1````````"@```!8`
-XM``"Q!@```````'<1````````"@```!(```!U#0```````(81````````"@``
-XM`!(```"8#0```````(P1````````"@```!8```#H`0```````)<1````````
-XM`0````(```#@"@```````)\1`````````0````(````7"P```````*<1````
-XM````"@```!(```"[#0```````+H1````````"@```!(```#S#0```````+\1
-XM````````"@```!8```"Q!@```````,D1````````"@```!(````6#@``````
-XM`-@1````````"@```!(````Y#@```````-X1````````"@```!8````<````
-XM`````.\1````````"@```!8```"Q!@```````/H1````````"@```!8````+
-XM`````````"42````````"@```!8```#4!P```````#`2`````````0````(`
-XM```@"P```````#@2`````````0````(```!@#````````$`2````````"@``
-XM`!(```!O#@```````%,2````````"@```!(```"H#@```````%@2````````
-XM"@```!8```"Q!@```````&(2````````"@```!(```#Q#@```````&<2````
-XM````"@```!4``````````````'H2````````"@```!(```!@#P```````(02
-XM`````````0````(```"6"P```````(P2`````````0````(```#X"P``````
-XM`)P2`````````0````(```"6"P```````*02`````````0````(```#>"P``
-XM`````+X2````````"@```!8```#E`@```````-H2````````"@```!8```#8
-XM`P```````.42````````"@```!8```"Q!@````````43````````"@```!8`
-XM``#U`P```````!`3````````"@```!8````!!````````!T3````````"@``
-XM`!8```!G`@```````"03`````````0````(```!@#````````"P3````````
-XM`0````(````&$````````#03````````"@```!(```"I#P```````$<3````
-XM````"@```!(```!:$````````%03````````"@```!(```"C$````````%D3
-XM````````"@```!8```"Q!@```````&,3````````"@```!(```#_$```````
-XM`'$3````````"@```!(```"Z$0```````(43````````"@```!8```#U`P``
-XM`````)03````````"@```!8````!!````````)X3````````"@```!(```#P
-XM$0```````*<3````````"@```!4```!``````````+D3````````"@```!4`
-XM``"0`````````,(3````````"@```!(````F$@```````-03````````"@``
-XM`!(```!O$@```````.83````````"@```!(```#>$@```````.X3````````
-XM"@```!8```!Z`@```````!T4````````"@```!8```#="````````"44````
-XM`````0````(````0$````````"T4`````````0````(```#K$````````#44
-XM````````"@```!(````4$P```````$<4````````"@```!(```!T$P``````
-XM`%84````````"@```!(```#0$P```````&04````````"@```!(````L%```
-XM`````&T4````````"@```!4```!@`0```````'T4````````"@```!(```!B
-XM%````````(P4````````"@```!4```"0`0```````)@4````````"@```!(`
-XM``"^%````````*$4````````"@```!(````:%0```````*@4````````"@``
-XM`!8````J`0```````-84````````"@```!8```"Q!@```````/H4````````
-XM"@```!8```!<!0````````85````````"@```!8````1!P```````!T5````
-XM````"@```!8````!!````````#,5````````"@```!8```"X!0```````%@5
-XM````````"@```!8````]!P```````'05````````"@```!8```"Q!@``````
-XM`(`5````````"@```!8```#:!````````+`5````````"@```!8````1!```
-XM`````+P5````````"@```!8````A`@```````!06````````"@```!8````2
-XM`0```````"$6````````"@```!8```!^!0```````#T6````````"@```!8`
-XM``#*!````````&D6````````"@```!8````!!````````'P6````````"@``
-XM`!8```"0`@```````)@6````````"@```!8```"Q!@```````*\6````````
-XM"@```!8```!^`````````-(6````````"@```!8````!!````````.`6````
-XM````"@```!8```!E!P```````.@6`````````0````(```#P$````````/`6
-XM`````````0````(```#>%P```````/@6````````"@```!(```!V%0``````
-XM``P7````````"@```!(````G%@```````!H7````````"@```!(```"'%@``
-XM`````",7````````"@```!4```#@`0```````#D7````````"@```!4```!`
-XM`@```````$(7````````"@```!(```"]%@```````$L7````````"@```!(`
-XM```&%P```````&87````````"@```!(```!/%P```````&\7````````"@``
-XM`!(```"^%P```````'@7````````"@```!(````M&````````($7````````
-XM"@```!(```")&````````)L7````````"@```!4```"``P```````*L7````
-XM````"@```!(```#2&````````+H7````````"@```!4```"P`P```````-`7
-XM````````"@```!4````0!````````-D7````````"@```!(````(&0``````
-XM`.(7````````"@```!(````^&0```````/47````````"@```!(```#;&0``
-XM``````,8````````"@```!(```!=&@````````P8````````"@```!(```#?
-XM&@```````"@8````````"@```!4````P!0```````#H8````````"@```!4`
-XM``!P!0```````$,8````````"@```!(```"'&P```````%88````````"@``
-XM`!(```!5'````````&,8`````````0````(````-%````````&L8````````
-XM`0````(````Q%````````(48`````````0````(````=%````````(T8````
-XM`````0````(````Q%````````)H8````````"@```!(```">'````````*48
-XM````````"@```!4```#0!0```````+(8````````"@```!4````P!@``````
-XM`+L8````````"@```!(```#G'````````,08````````"@```!(```!I'0``
-XM`````,T8````````"@```!4```"P!@```````-D8````````"@```!(```"R
-XM'0```````.<8````````"@```!8```!N!````````/08````````"@```!8`
-XM``!/`@```````,4``````````0````(``````````````!P`````````"@``
-XM`!```````````````"```````````0````(``````````````#0`````````
-XM"@```!```````````````#@``````````0````(```!P`````````%P`````
-XM````"@```!```````````````&```````````0````(````P`@```````(P`
-XM````````"@```!```````````````)```````````0````(````P`P``````
-XM`*P`````````"@```!```````````````+```````````0````(```"@`P``
-XM`````.0`````````"@```!```````````````.@``````````0````(```"0
-XM!0````````P!````````"@```!```````````````!`!`````````0````(`
-XM``"0!@```````#0!````````"@```!```````````````#@!`````````0``
-XM``(```#0!P```````&0!````````"@```!```````````````&@!````````
-XM`0````(`````"0```````(P!````````"@```!```````````````)`!````
-XM`````0````(`````"@```````+P!````````"@```!```````````````,`!
-XM`````````0````(```"P"@```````-P!````````"@```!``````````````
-XM`.`!`````````0````(```#@"@```````/P!````````"@```!``````````
-XM```````"`````````0````(````@"P```````"0"````````"@```!``````
-XM`````````"@"`````````0````(```!@#````````&0"````````"@```!``
-XM`````````````&@"`````````0````(````0$````````(P"````````"@``
-XM`!```````````````)`"`````````0````(```#P$````````"``````````
-XM"@````(``````````````#@`````````"@````(```!P`````````%@`````
-XM````"@````(````P`@```````(``````````"@````(````P`P```````)@`
-XM````````"@````(```"@`P```````,@`````````"@````(```"0!0``````
-XM`.@`````````"@````(```"0!@````````@!````````"@````(```#0!P``
-XM`````#`!````````"@````(`````"0```````%`!````````"@````(`````
-XM"@```````'@!````````"@````(```"P"@```````)`!````````"@````(`
-XM``#@"@```````*@!````````"@````(````@"P```````,@!````````"@``
-XM``(```!@#``````````"````````"@````(````0$````````"`"````````
-XM"@````(```#P$`````````8`````````"@````8```````````````8`````
-XK````"@````8``````````````!```````````0````(`````````````````
+XM```!````!`#Q_P```````````````````````````P`!````````````````
+XM`````````````P`#`````````````````````````````P`$````````````
+XM`````````````````P`%`````````````````````````````P`&````````
+XM`````````````````````P`(```````````````````````,`````@`!````
+XM````````<````````````````P`+```````````````````````?`````@`!
+XM`#`#````````:P```````````````P`,```````````````````````O````
+XM`@`!`+`*````````(@````````!#`````@`!`.`*````````-P````````!5
+XM`````@`!`"`+````````0`$```````!G`````@`!`!`0````````VP``````
+XM`````````P`-`````````````````````````````P`/````````````````
+XM`````````````P`1`````````````````````````````P`2````````````
+XM`````````````````P`4`````````````````````````````P`6````````
+XM`````````````````````P`7`````````````````````````````P`*````
+XM``````````````````!R````$@`!`'``````````M@$```````!_````$```
+XM``````````````````````",````$`````````````````````````"8````
+XM$`````````````````````````"I````$`````````````````````````"T
+XM````$`````````````````````````#$````$```````````````````````
+XM``#,````$`````````````````````````#7````$```````````````````
+XM``````#<````$@`!`#`"````````_`````````#H````$```````````````
+XM``````````#V````$````````````````````````````0``$```````````
+XM```````````````1`0``$@`!`*`#````````Z0$````````A`0``$```````
+XM```````````````````L`0``$``````````````````````````S`0``$```
+XM```````````````````````W`0``$@`!`)`%````````]`````````!!`0``
+XM$`````````````````````````!-`0``$@`!`)`&````````.0$```````!7
+XM`0``$@`!`-`'````````+P$```````!G`0``$```````````````````````
+XM``!M`0``$@`!```)````````_P````````!Z`0``$```````````````````
+XM``````"'`0``$`````````````````````````"2`0``$@`!```*````````
+XMH@````````"A`0``$`````````````````````````"H`0``$```````````
+XM``````````````"O`0``$`````````````````````````"V`0``$```````
+XM``````````````````"]`0``$`````````````````````````#%`0``$@`!
+XM`&`,````````I@,```````#0`0``$`````````````````````````#@`0``
+XM$`````````````````````````#L`0``$`````````````````````````#W
+XM`0``$``````````````````````````)`@``$```````````````````````
+XM```6`@``$``````````````````````````@`@``$```````````````````
+XM```````E`@``$``````````````````````````M`@``$@`!`/`0````````
+XM[@8````````Z`@``$`````````````````````````!(`@``$```````````
+XM``````````````!/`@``$`````````````````````````!7`@``$```````
+XM``````````````````!C`@``$```````````````````````````<V5C=&EO
+XM;G,N8P!I;G-E<G1?=&]?<V5C7VQI<W0`861D7W1O7W-H<W1R=&%B`&ES7V-O
+XM;7!R97-S7W-E8W1I;VX`:7-?87!P96YD7W-E8W1I;VX`:7-?<F5M;W9E7W-E
+XM8W1I;VX`<')I;G1?9&%T80!S971?<VAS=')T86(`9V5L9E]G971S:&1R`&5L
+XM9E]N97=D871A`&=E;&9?=7!D871E7W-H9'(`96QF7VYD>'-C;@!E;&9?<V5T
+XM<VAS=')N9'@`;65M;6]V90!E;&9?97)R;7-G`&5R<G@`=7!D871E7W-H9'(`
+XM;&]O:W5P7W-T<FEN9P!E;&9?97)R;F\`:6YS97)T7W1O7W-T<G1A8@!A9&1?
+XM=6YL;V%D86)L97,`96QF7VYE=W-C;@!C86QL;V,`97)R`&-O<'E?9&%T80!E
+XM;&9?9V5T9&%T80!C;W!Y7W-H9'(`<F5S>6YC7W-E8W1I;VYS`'=A<FYX`&EN
+XM<V5R=%]S:'1A8@!G96QF7V=E=&5H9'(`9V5L9E]F<VEZ90!L;V]K=7!?<V5C
+XM7V%C=`!S=')C;7``;6%L;&]C`&UE;7-E=`!S=')L96X`<W1R;F-M<`!C<F5A
+XM=&5?<V-N`&5L9E]G971S:'-T<FYD>`!E;&9?;F5X='-C;@!E;&9?<W1R<'1R
+XM`&%D9%]T;U]I;G-E9U]L:7-T`%]?:7-T:')E861E9`!?7W-T9&]U='``<'5T
+XM8P!?7W-W8G5F`&-O<'E?8V]N=&5N=`!C<F5A=&5?<WEM=&%B`&UE;6-P>0!S
+XM=')N8W!Y`&=E;&9?9V5T<F5L`&QO;VMU<%]K965P7W-Y;6QI<W0``)<`````
+XM`````@```!D```#\_________^X``````````@```!H```#\_________QL!
+XM`````````@```!L```#\_________UD!`````````@```!P```#\________
+XM_V8!`````````@```!T```#\_________Z4!`````````@```!X```#\____
+XM_____[0!`````````@```!\```#\_________[D!````````"@````D`````
+XM`````````,@!`````````@```"````#\_________](!`````````@```!\`
+XM``#\_________]<!````````"@````D````>`````````.8!`````````@``
+XM`"````#\__________`!`````````@```!\```#\__________4!````````
+XM"@````D````W``````````0"`````````@```"````#\_________PX"````
+XM`````@```!\```#\_________Q,"````````"@````D```!5`````````"("
+XM`````````@```"````#\_________T\"`````````@```!D```#\________
+XM_V`"`````````@```"(```#\_________Y<"`````````@```!P```#\____
+XM_____Z@"`````````@```!L```#\_________[H"`````````@```",```#\
+XM_________]L"`````````@```!\```#\_________^`"````````"@````D`
+XM``!R`````````.\"`````````@```"````#\__________D"`````````@``
+XM`!\```#\__________X"````````"@````D````W``````````T#````````
+XM`@```"````#\_________Q0#`````````@```!\```#\_________QD#````
+XM````"@````D```".`````````"@#`````````@```"````#\_________VD#
+XM````````"@````D```"E`````````&X#`````````@```"0```#\________
+XM_W8#````````"@````D```"F`````````'L#`````````@```"0```#\____
+XM_____X,#````````"@````D```"N`````````(@#`````````@```"0```#\
+XM_________XT#````````"@````D```"V`````````)4#`````````@```"0`
+XM``#\_________[T#````````"@````D```"V`````````/4#`````````@``
+XM`"8```#\_________Q`$`````````@```"<```#\_________V\$````````
+XM`@```!H```#\_________[,$`````````@```!D```#\_________]H$````
+XM`````@```!L```#\_________P8%`````````@```!\```#\_________PL%
+XM````````"@````D```#``````````!H%`````````@```"````#\________
+XM_Q\%````````"@````D```#8`````````"L%`````````@```"@```#\____
+XM_____S4%`````````@```!\```#\_________SH%````````"@````D````>
+XM`````````$D%`````````@```"````#\_________U,%`````````@```!\`
+XM``#\_________U@%````````"@````D```#E`````````&<%`````````@``
+XM`"````#\_________W$%`````````@```!\```#\_________W8%````````
+XM"@````D````W`````````(4%`````````@```"````#\_________[4%````
+XM`````@```!H```#\__________X%`````````@```"H```#\_________PL&
+XM`````````@```",```#\_________U$&`````````@```!\```#\________
+XM_U8&````````"@````D````>`````````&4&`````````@```"````#\____
+XM_____VP&`````````@```!\```#\_________W$&````````"@````D````#
+XM`0```````(`&`````````@```"````#\_________[T&`````````@```!D`
+XM``#\_________]$&`````````@```!D```#\_________S\'`````````@``
+XM`!L```#\_________W4'`````````@```!\```#\_________WH'````````
+XM"@````D````<`0```````(D'`````````@```"````#\_________Y,'````
+XM`````@```!\```#\_________Y@'````````"@````D````Z`0```````*<'
+XM`````````@```"````#\_________[$'`````````@```!\```#\________
+XM_[8'````````"@````D```!8`0```````,4'`````````@```"````#\____
+XM_____TL(`````````@```!D```#\_________VX(`````````@```!L```#\
+XM_________[,(````````"@````L``````````````+H(`````````@```"T`
+XM``#\_________\D(`````````@```!\```#\_________\X(````````"@``
+XM``D```!S`0```````-T(`````````@```"````#\_________^<(````````
+XM`@```!\```#\_________^P(````````"@````D```!8`0```````/L(````
+XM`````@```"````#\_________Q$)`````````@```"\```#\_________RD)
+XM`````````@```"<```#\_________WH)`````````@```#````#\________
+XM_[@)`````````@```!\```#\_________[T)````````"@````D```"1`0``
+XM`````,P)`````````@```"````#\_________]8)`````````@```!\```#\
+XM_________]L)````````"@````D```"Y`0```````.H)`````````@```"``
+XM``#\_________^\)````````"@````D```"K`0```````/L)`````````@``
+XM`"````#\_________S$*`````````@```#(```#\_________U0*````````
+XM`@```#,```#\_________VL*`````````@```#0```#\_________Y0*````
+XM````"@````D```#1`0```````)X*`````````@```"````#\_________[<*
+XM`````````@```#$```#\_________^<*`````````@```#$```#\________
+XM_T(+````````"@````D```"V`````````&D+````````"@````D```"F````
+XM`````(8+````````"@````D```"N`````````)<+````````"@````D```#C
+XM`0```````*(+````````"P````D```#C`0```````*L+````````"P````D`
+XM``#J`0```````+0+````````"P````D```#\`0```````+T+````````"P``
+XM``D````"`@```````.(+`````````@```#4```#\__________`+````````
+XM`@```#8```#\_________R(,`````````@```#$```#\_________W\,````
+XM`````@```"<```#\_________Y,,````````"P````D```"V`````````,L,
+XM`````````@```#@```#\_________^@,`````````@```#D```#\________
+XM__\,`````````@```!D```#\_________QT-`````````@```#H```#\____
+XM_____U0-````````"@````D```"V`````````'X-`````````@```"8```#\
+XM_________Y,-`````````@```!P```#\_________[@-````````"@````D`
+XM``"F`````````-(-````````"@````D```"N`````````!$.`````````@``
+XM`#@```#\_________RH.`````````@```#D```#\_________SX.````````
+XM`@```!P```#\_________TX.`````````@```!D```#\_________VL.````
+XM`````@```#H```#\_________YL.`````````@```"<```#\_________]P.
+XM`````````@```#L```#\__________<.`````````@```"L```#\________
+XM_P$/`````````@```",```#\_________Q`/`````````@```!\```#\____
+XM_____Q4/````````"@````D```".`````````"0/`````````@```"````#\
+XM_________RD/`````````@```",```#\_________TD/`````````@```!\`
+XM``#\_________TX/````````"@````D````_`@```````%T/`````````@``
+XM`"````#\_________V</`````````@```!\```#\_________VP/````````
+XM"@````D````C`@```````'L/`````````@```"````#\_________X4/````
+XM`````@```!\```#\_________XH/````````"@````D```"#`@```````)D/
+XM`````````@```"````#\_________Z,/`````````@```!\```#\________
+XM_Z@/````````"@````D```!M`@```````+</`````````@```"````#\____
+XM_____[P/````````"@````D```"K`0```````,8/`````````@```"@```#\
+XM_________]`/`````````@```!\```#\_________]4/````````"@````D`
+XM```(`@```````.0/`````````@```"````#\_________^X/`````````@``
+XM`!\```#\__________,/````````"@````D```!5`@````````(0````````
+XM`@```"````#\_________R80`````````@```#P```#\_________S$0````
+XM`````@```#T```#\_________V40`````````@```#P```#\_________W`0
+XM`````````@```#T```#\_________Z00`````````@```#T```#\________
+XM_ZX0`````````@```#X```#\_________[<0`````````@```#T```#\____
+XM_____[\0`````````@```#X```#\_________],0`````````@```#\```#\
+XM_________^(0`````````@```#\```#\_________S<1````````"@````D`
+XM``"F`````````%<1`````````@```$$```#\_________X`1````````"@``
+XM``D```"N`````````)(1````````"@````D```"V`````````.H1````````
+XM`@```#,```#\_________PP2`````````@```$(```#\_________R$2````
+XM`````@```"H```#\_________SL2`````````@```#,```#\_________UD2
+XM`````````@```!D```#\_________\$2`````````@```",```#\________
+XM_P(3`````````@```#,```#\_________ZD3`````````@```#4```#\____
+XM_____\$3`````````@```#(```#\_________PD4`````````@```"D```#\
+XM_________QD4`````````@```#$```#\_________V`4`````````@```"H`
+XM``#\_________VT4`````````@```",```#\_________WL4`````````@``
+XM`#P```#\_________XH4`````````@```#T```#\_________]84````````
+XM`@```$,```#\_________S85`````````@```$,```#\_________U`5````
+XM`````@```#$```#\_________UP5`````````@```#4```#\_________W05
+XM`````````@```$,```#\_________Z(5`````````@```$(```#\________
+XM_[<5`````````@```#$```#\_________\`5`````````@```#4```#\____
+XM_____]05````````"@````D```"^`@```````.`5`````````@```"@```#\
+XM_________^<5`````````@```#T```#\__________$5`````````@```#X`
+XM``#\_________R46`````````@```"H```#\_________T,6`````````@``
+XM`$0```#\_________V<6`````````@```!P```#\_________WL6````````
+XM`@```#H```#\_________Y$6`````````@```$4```#\_________ZH6````
+XM`````@```#,```#\_________]H6`````````@```#\```#\_________^D6
+XM`````````@```#,```#\_________Q,7`````````@```!\```#\________
+XM_Q@7````````"@````D````#`0```````"<7`````````@```"````#\____
+XM_____RP7````````"@````D```"P`@```````#87`````````@```"@```#\
+XM_________T`7`````````@```!\```#\_________T47````````"@````D`
+XM``"1`0```````%07`````````@```"````#\_________UX7`````````@``
+XM`!\```#\_________V,7````````"@````D````_`@```````'(7````````
+XM`@```"````#\_________WP7`````````@```!\```#\_________X$7````
+XM````"@````D```"9`@```````)`7`````````@```"````#\_________Y47
+XM`````````@```",```#\_________\47`````````@```#````#\________
+XM_V$#`````````@```"0```#\_________P8`````````"@````4`````````
+XM``````P`````````"@```!8```!'"````````!$`````````"@```!8````!
+XM`@```````!4`````````"@```!8```!#!@```````!D``````````0````(`
+XM`````````````"$``````````0````(```#>%P```````"D`````````"@``
+XM``<``````````````#``````````"@```!8```#_!P```````#<`````````
+XM"@```!8````O!P```````#X`````````"@```!8```#I!0```````$,`````
+XM````"@```!8```!<`@```````%``````````"@```!8````7"````````%P`
+XM````````"@```!8```!/!P```````&D`````````"@```!8```!Q````````
+XM`&X`````````"@```!8```!L!0```````'L`````````"@```!8```#S!0``
+XM`````(``````````"@```!8````T`P```````(T`````````"@```!8```#E
+XM!@```````)0`````````"@```!8```!G"````````)L`````````"@```!8`
+XM``#B`0```````*``````````"@```!8```!P!@```````+``````````"@``
+XM`!8```#Q!P```````+T`````````"@```!8```"8`P```````,(`````````
+XM"@```!8```"+!0```````,T`````````"@```!8```"M`0```````-@`````
+XM````"@```!8````Z!@```````/0`````````"@```!8````$`P```````/\`
+XM````````"@```!8```#;`0````````H!````````"@```!8```"O!P``````
+XM`!8!````````"@```!8```!X!````````"0!````````"@```!8```",````
+XM`````#D!````````"@```!8````X`@```````&P!````````"@```!8```"E
+XM`````````'H!````````"@```!8```"9!````````)8!````````"@```!8`
+XM``"<`````````*0!````````"@```!8```!]`0```````+(!````````"@``
+XM`!8```#Z`P```````,`!````````"@```!8````7`0```````,X!````````
+XM"@```!8```#1"````````-P!````````"@```!8```"Q!0```````/@!````
+XM````"@```!8````N!0```````!0"````````"@```!8```#7"````````"("
+XM````````"@```!8```"1"````````#X"````````"@```!8```#*!@``````
+XM`$T"````````"@```!8```!R`@```````-,"````````"@```!8````3````
+XM`````/\"````````"@```!8```"O"`````````P#````````"@```!8```!'
+XM!````````!$#````````"@```!8```#)!P```````!P#````````"@```!8`
+XM``"V`````````#\#````````"@```!8```#2!0```````$T#````````"@``
+XM`!8```"%`P```````%P#````````"@```!8```"(!````````&<#````````
+XM"@```!8``````````````'(#````````"@```!8````_`P```````'T#````
+XM````"@```!8```!^!````````(@#````````"@```!8```"D"````````),#
+XM````````"@```!8````Q!````````*8#````````"@```!8````)!P``````
+XM`+0#````````"@```!8```"2!P```````,(#````````"@```!8```"V!P``
+XM`````-`#````````"@```!8```"L`````````-X#````````"@```!8```"E
+XM`0```````.P#````````"@```!8```#'`````````/H#````````"@```!8`
+XM``!B``````````@$````````"@```!8```"R`P```````!8$````````"@``
+XM`!8```#P`````````"0$````````"@```!8```"P`@```````#($````````
+XM"@```!8````&!@```````$`$````````"@```!8```!F`0```````$X$````
+XM````"@```!8```#;!0```````%P$````````"@```!8```#@`P```````&L$
+XM````````"@```!8```#F!P```````'X$````````"@```!8````S"```````
+XM`(P$````````"@```!8```#W!@```````)H$````````"@```!8```"F!P``
+XM`````*@$````````"@```!8```"-!@```````+8$````````"@```!8````%
+XM!0```````,0$````````"@```!8```"K!````````-($````````"@```!8`
+XM```R!@```````.`$````````"@```!8```#8`P```````.X$````````"@``
+XM`!8```"7"````````/P$````````"@```!8```!?`P````````L%````````
+XM"@```!8```#,`@```````!X%````````"@```!8```#2!0```````"P%````
+XM````"@```!8```"%`P```````#L%````````"@```!8```"4!0```````%$%
+XM````````"@```!8````["````````%<%````````"@```!8````W`0``````
+XM`&(%````````"@```!8```!+`0```````'`%````````"@```!8````C!0``
+XM`````'8%````````"@```!8```"Y!````````'P%````````"@```!8```"=
+XM`P```````((%````````"@```!8```![`P```````(@%````````"@```!8`
+XM``!5!````````(X%````````"@```!8```"T"````````)0%````````"@``
+XM`!8```",`P```````)H%````````"@```!8```!7`````````*`%````````
+XM"@```!8```!O`P```````*8%````````"@```!8```"G`P```````*P%````
+XM````"@```!8````]!````````+(%````````"@```!8```!:!P```````+@%
+XM````````"@```!8````H!@```````+X%````````"@```!8```#Y`@``````
+XM`,0%````````"@```!8```#I!````````,H%````````"@```!8```#%"```
+XM`````-`%````````"@```!8````=`0```````-8%````````"@```!8```""
+XM`@```````-P%````````"@```!8````2`P```````.(%````````"@```!8`
+XM``"V!@```````.@%````````"@```!8````+"````````.X%````````"@``
+XM`!8```#/!````````/0%````````"@```!8````5`@```````/H%````````
+XM"@```!8```"2``````````$&````````"@```!8````<`P```````!0&````
+XM````"@```!8````>!@```````",&````````"@```!8```#\!0```````"\&
+XM````````"@```!8```#3!@```````#T&````````"@```!8```#$!```````
+XM`$L&````````"@```!8```!J!@```````%D&````````"@```!8```!J````
+XM`````&<&````````"@```!8````+`P```````'4&````````"@```!8```#_
+XM!@```````(,&````````"@```!8````#`0```````)$&````````"@```!8`
+XM``"*!P```````)\&````````"@```!8````>!````````+H&````````"@``
+XM`!8```!Y!P```````,4&````````"@```!8```#Y`````````-`&````````
+XM"@```!8```#1`0```````-L&````````"@```!8```#)!0```````.X&````
+XM````"@```!8````>!@```````/T&````````"@```!8```!@!`````````D'
+XM````````"@```!8```"Q!@```````!<'````````"@```!8```"%`0``````
+XM`#0'````````"@```!8````>!@```````$,'````````"@```!8```"^!0``
+XM`````$\'````````"@```!8```"Q!@```````%T'````````"@```!8````/
+XM!0```````&L'````````"@```!8```!V!0```````'D'````````"@```!8`
+XM``"Z`P```````)4'````````"@```!8```#Z`0```````*,'````````"@``
+XM`!8````(!````````+$'````````"@```!8```"@`0```````+\'````````
+XM"@```!8```#C!0```````,T'````````"@```!8````]`````````-L'````
+XM````"@```!8````7!````````.D'````````"@```!8```#!!@````````8(
+XM````````"@```!8````>!@```````!4(````````"@```!8```".`0``````
+XM`"$(````````"@```!8```"Q!@```````"\(````````"@```!8```""!P``
+XM`````#T(````````"@```!8```#*!````````$L(````````"@```!8````M
+XM`````````&@(````````"@```!8````)`0```````'8(````````"@```!8`
+XM``"V`0```````(4(````````"@```!8```":!@```````)$(````````"@``
+XM`!8```"Q!@```````/`(````````"@```!8```"_"````````/X(````````
+XM"@```!8````J!P```````!H)````````"@```!8```!4`0```````"@)````
+XM````"@```!8```#^!````````#8)````````"@```!8```"2!````````$0)
+XM````````"@```!8````J"````````%()````````"@```!8```"?!P``````
+XM`'4)````````"@```!8````)`0```````(,)````````"@```!8```"V`0``
+XM`````)()````````"@```!8````,`@```````)X)````````"@```!8```#;
+XM!@```````*P)````````"@```!8```#`!P```````,,)````````"@```!8`
+XM```>!@```````-()````````"@```!8```#9``````````@*````````"@``
+XM`!8````J!P```````!8*````````"@```!8````]`````````"0*````````
+XM"@```!8```"9!P```````#(*````````"@```!8````E`P```````$\*````
+XM````"@```!8```#(`P```````%4*````````"@```!8```#/`````````%L*
+XM````````"@```!8```"?!````````&$*````````"@```!8```"A`@``````
+XM`&<*````````"@```!8```"B!@```````'8*````````"@```!8````G`@``
+XM`````(0*````````"@```!8```#K`P```````*$*````````"@```!8````G
+XM`@```````*\*````````"@```!8```#K`P```````,P*````````"@```!8`
+XM```G`@```````-H*````````"@```!8```#K`P```````/<*````````"@``
+XM`!8````G`@````````4+````````"@```!8```#K`P```````"(+````````
+XM"@```!8````G`@```````#`+````````"@```!8```#K`P```````$<+````
+XM````"@```!8```#;!@```````%4+````````"@```!8```#`!P```````&P+
+XM````````"@```!8```!B!0```````'L+````````"@```!8```!'`@``````
+XM`(<+````````"@```!8```!=`0```````)4+````````"@```!8```"S!```
+XM`````*,+````````"@```!8```!``@```````-L+````````"@```!8```"5
+XM!@```````.D+````````"@```!8```#!`P```````/<+````````"@```!8`
+XM``!0``````````4,````````"@```!8```!N"````````!,,````````"@``
+XM`!8````7!P```````"$,````````"@```!8```!*`P```````"\,````````
+XM"@```!8```"_`0```````#T,````````"@```!8```">!0```````$L,````
+XM````"@```!8```!+!0```````%D,````````"@```!8```#>`@```````&<,
+XM````````"@```!8```!`"````````'4,````````"@```!8```!"!0``````
+XM`(,,````````"@```!8```#Y!P```````)$,````````"@```!8````N`P``
+XM`````)\,````````"@```!8````E!````````*T,````````"@```!8````W
+XM`````````+L,````````"@```!8```!H!````````,H,````````"@```!8`
+XM``#7`@```````-D,````````"@```!8````_`0```````.@,````````"@``
+XM`!8```!R`0```````/<,````````"@```!8```"9!P````````8-````````
+XM"@```!8```!R!P```````!P-````````"@```!8```!^"````````",-````
+XM`````0````(``````````````"L-`````````0````(```!P`````````&@-
+XM````````"@```!8````U!0```````'`-`````````0````(```!P````````
+XM`'@-`````````0````(````F`@```````(`-````````"@```!(`````````
+XM`````)0-````````"@```!(````Y`````````*(-````````"@```!(```""
+XM`````````*<-````````"@```!8```#3`P```````+(-````````"@```!(`
+XM``"X`````````,X-````````"@```!8```!$`````````-8-`````````0``
+XM``(````P`@```````-X-`````````0````(````L`P```````.8-````````
+XM"@```!(````4`0```````/H-````````"@```!(```")`0````````@.````
+XM````"@```!(```#2`0```````!8.````````"@```!(````(`@```````"L.
+XM````````"@```!8````!!````````#8.````````"@```!(```!1`@``````
+XM`#L.````````"@```!8```!J`P```````$@.````````"@```!8````.!@``
+XM`````%`.`````````0````(````P`P```````%@.`````````0````(```";
+XM`P```````&`.````````"@```!(```"'`@```````'0.````````"@```!(`
+XM``"_`@```````'D.````````"@```!8```"Q!@```````(0.````````"@``
+XM`!(```#U`@```````)(.````````"@```!(```!1`P```````)D.````````
+XM"@```!8```!:!@```````*$.`````````0````(```"@`P```````*D.````
+XM`````0````(```")!0```````+$.````````"@```!(```":`P```````,4.
+XM````````"@```!(````W!````````-0.````````"@```!(```"3!```````
+XM`-D.````````"@```!8```#!`````````.0.````````"@```!(```#)!```
+XM`````/T.````````"@```!(```#_!`````````P/````````"@```!(```!(
+XM!0```````",/````````"@```!8```"6`0```````"L/`````````0````(`
+XM``"0!0```````#,/`````````0````(```"$!@```````#L/````````"@``
+XM`!(```!^!0```````$T/````````"@```!(```#>!0```````%P/````````
+XM"@```!(```!-!@```````&L/````````"@```!(```"6!@```````'`/````
+XM````"@```!8````!!````````'L/````````"@```!(```#?!@```````((/
+XM````````"@```!8```#T!````````(H/`````````0````(```"0!@``````
+XM`)(/`````````0````(```#)!P```````)H/````````"@```!(````5!P``
+XM`````*X/````````"@```!(```!.!P```````+T/````````"@```!(```"7
+XM!P```````,P/````````"@```!(```#-!P```````-$/````````"@```!8`
+XM``"Q!@```````-P/````````"@```!(````6"`````````,0````````"@``
+XM`!8```"\`@````````L0`````````0````(```#0!P```````!,0````````
+XM`0````(```#_"````````!L0````````"@```!(```!?"````````"\0````
+XM````"@```!(```#H"````````#T0````````"@```!(````Q"0```````%T0
+XM````````"@```!(```!G"0```````&00````````"@```!8````6!0``````
+XM`'`0`````````0````(`````"0```````'@0`````````0````(```#_"0``
+XM`````(`0````````"@```!(````B"@```````)00````````"@```!(```"#
+XM"@```````*(0````````"@```!(```#,"@```````*<0````````"@```!8`
+XM```R`@```````+(0````````"@```!(```#O"@```````,<0````````"@``
+XM`!8````K!````````-(0````````"@```!(````2"P```````-D0````````
+XM"@```!8```#A`````````.00`````````0````(`````"@```````.P0````
+XM`````0````(```"B"@```````/00````````"@```!(```!("P````````<1
+XM````````"@```!(```#0"P````````P1````````"@```!8```"Q!@``````
+XM`!81````````"@```!(````L#````````"41````````"@```!(```"(#```
+XM`````#01````````"@```!(```#D#````````#H1````````"@```!8```!Y
+XM!@```````$41`````````0````(```"P"@```````$T1`````````0````(`
+XM``#2"@```````%41````````"@```!(````:#0```````&@1````````"@``
+XM`!(```!2#0```````&T1````````"@```!8```"Q!@```````'<1````````
+XM"@```!(```!U#0```````(81````````"@```!(```"8#0```````(P1````
+XM````"@```!8```#H`0```````)<1`````````0````(```#@"@```````)\1
+XM`````````0````(````7"P```````*<1````````"@```!(```"[#0``````
+XM`+H1````````"@```!(```#S#0```````+\1````````"@```!8```"Q!@``
+XM`````,D1````````"@```!(````6#@```````-@1````````"@```!(````Y
+XM#@```````-X1````````"@```!8````<`````````.\1````````"@```!8`
+XM``"Q!@```````/H1````````"@```!8````+`````````"42````````"@``
+XM`!8```#4!P```````#`2`````````0````(````@"P```````#@2````````
+XM`0````(```!@#````````$`2````````"@```!(```!O#@```````%,2````
+XM````"@```!(```"H#@```````%@2````````"@```!8```"Q!@```````&(2
+XM````````"@```!(```#Q#@```````&<2````````"@```!4`````````````
+XM`'H2````````"@```!(```!@#P```````(02`````````0````(```"6"P``
+XM`````(P2`````````0````(```#X"P```````)P2`````````0````(```"6
+XM"P```````*02`````````0````(```#>"P```````+X2````````"@```!8`
+XM``#E`@```````-H2````````"@```!8```#8`P```````.42````````"@``
+XM`!8```"Q!@````````43````````"@```!8```#U`P```````!`3````````
+XM"@```!8````!!````````!T3````````"@```!8```!G`@```````"03````
+XM`````0````(```!@#````````"P3`````````0````(````&$````````#03
+XM````````"@```!(```"I#P```````$<3````````"@```!(```!:$```````
+XM`%03````````"@```!(```"C$````````%D3````````"@```!8```"Q!@``
+XM`````&,3````````"@```!(```#_$````````'$3````````"@```!(```"Z
+XM$0```````(43````````"@```!8```#U`P```````)03````````"@```!8`
+XM```!!````````)X3````````"@```!(```#P$0```````*<3````````"@``
+XM`!4```!``````````+D3````````"@```!4```"0`````````,(3````````
+XM"@```!(````F$@```````-03````````"@```!(```!O$@```````.83````
+XM````"@```!(```#>$@```````.X3````````"@```!8```!Z`@```````!T4
+XM````````"@```!8```#="````````"44`````````0````(````0$```````
+XM`"T4`````````0````(```#K$````````#44````````"@```!(````4$P``
+XM`````$<4````````"@```!(```!T$P```````%84````````"@```!(```#0
+XM$P```````&04````````"@```!(````L%````````&T4````````"@```!4`
+XM``!@`0```````'T4````````"@```!(```!B%````````(P4````````"@``
+XM`!4```"0`0```````)@4````````"@```!(```"^%````````*$4````````
+XM"@```!(````:%0```````*@4````````"@```!8````J`0```````-84````
+XM````"@```!8```"Q!@```````/H4````````"@```!8```!<!0````````85
+XM````````"@```!8````1!P```````!T5````````"@```!8````!!```````
+XM`#,5````````"@```!8```"X!0```````%@5````````"@```!8````]!P``
+XM`````'05````````"@```!8```"Q!@```````(`5````````"@```!8```#:
+XM!````````+`5````````"@```!8````1!````````+P5````````"@```!8`
+XM```A`@```````!06````````"@```!8````2`0```````"$6````````"@``
+XM`!8```!^!0```````#T6````````"@```!8```#*!````````&D6````````
+XM"@```!8````!!````````'P6````````"@```!8```"0`@```````)@6````
+XM````"@```!8```"Q!@```````*\6````````"@```!8```!^`````````-(6
+XM````````"@```!8````!!````````.`6````````"@```!8```!E!P``````
+XM`.@6`````````0````(```#P$````````/`6`````````0````(```#>%P``
+XM`````/@6````````"@```!(```!V%0````````P7````````"@```!(````G
+XM%@```````!H7````````"@```!(```"'%@```````",7````````"@```!4`
+XM``#@`0```````#D7````````"@```!4```!``@```````$(7````````"@``
+XM`!(```"]%@```````$L7````````"@```!(````&%P```````&87````````
+XM"@```!(```!/%P```````&\7````````"@```!(```"^%P```````'@7````
+XM````"@```!(````M&````````($7````````"@```!(```")&````````)L7
+XM````````"@```!4```"``P```````*L7````````"@```!(```#2&```````
+XM`+H7````````"@```!4```"P`P```````-`7````````"@```!4````0!```
+XM`````-D7````````"@```!(````(&0```````.(7````````"@```!(````^
+XM&0```````/47````````"@```!(```#;&0````````,8````````"@```!(`
+XM``!=&@````````P8````````"@```!(```#?&@```````"@8````````"@``
+XM`!4````P!0```````#H8````````"@```!4```!P!0```````$,8````````
+XM"@```!(```"'&P```````%88````````"@```!(```!5'````````&,8````
+XM`````0````(````-%````````&L8`````````0````(````Q%````````(48
+XM`````````0````(````=%````````(T8`````````0````(````Q%```````
+XM`)H8````````"@```!(```">'````````*48````````"@```!4```#0!0``
+XM`````+(8````````"@```!4````P!@```````+L8````````"@```!(```#G
+XM'````````,08````````"@```!(```!I'0```````,T8````````"@```!4`
+XM``"P!@```````-D8````````"@```!(```"R'0```````.<8````````"@``
+XM`!8```!N!````````/08````````"@```!8```!/`@```````,4`````````
+XM`0````(``````````````!P`````````"@```!```````````````"``````
+XM`````0````(``````````````#0`````````"@```!```````````````#@`
+XM`````````0````(```!P`````````%P`````````"@```!``````````````
+XM`&```````````0````(````P`@```````(P`````````"@```!``````````
+XM`````)```````````0````(````P`P```````*P`````````"@```!``````
+XM`````````+```````````0````(```"@`P```````.0`````````"@```!``
+XM`````````````.@``````````0````(```"0!0````````P!````````"@``
+XM`!```````````````!`!`````````0````(```"0!@```````#0!````````
+XM"@```!```````````````#@!`````````0````(```#0!P```````&0!````
+XM````"@```!```````````````&@!`````````0````(`````"0```````(P!
+XM````````"@```!```````````````)`!`````````0````(`````"@``````
+XM`+P!````````"@```!```````````````,`!`````````0````(```"P"@``
+XM`````-P!````````"@```!```````````````.`!`````````0````(```#@
+XM"@```````/P!````````"@```!`````````````````"`````````0````(`
+XM```@"P```````"0"````````"@```!```````````````"@"`````````0``
+XM``(```!@#````````&0"````````"@```!```````````````&@"````````
+XM`0````(````0$````````(P"````````"@```!```````````````)`"````
+XM`````0````(```#P$````````"``````````"@````(``````````````#@`
+XM````````"@````(```!P`````````%@`````````"@````(````P`@``````
+XM`(``````````"@````(````P`P```````)@`````````"@````(```"@`P``
+XM`````,@`````````"@````(```"0!0```````.@`````````"@````(```"0
+XM!@````````@!````````"@````(```#0!P```````#`!````````"@````(`
+XM````"0```````%`!````````"@````(`````"@```````'@!````````"@``
+XM``(```"P"@```````)`!````````"@````(```#@"@```````*@!````````
+XM"@````(````@"P```````,@!````````"@````(```!@#``````````"````
+XM````"@````(````0$````````"`"````````"@````(```#P$`````````8`
+XM````````"@````8```````````````8`````````"@````8`````````````
+XM`!```````````0````(`````````````````````````````````````````
+XM```````````````````````````````````````````````````````````@
+XM````"`````8```````````````````!``````````-X7````````````````
+XM```0````````````````````&P````0```!`````````````````````^%P`
+XM``````"0%0```````!D````!````"``````````8`````````"8````(````
+XM`P```````````````````$````````````````````````````````0`````
+XM```````````````L````"`````,```````````````````!`````````````
+XM```````````````````$````````````````````,0````$`````````````
+XM````````````0`````````!U`P```````````````````0``````````````
+XM`````$0````!`````````````````````````+4#`````````AD`````````
+XM``````````$````````````````````_````!````$``````````````````
+XM``"(<@```````"`H````````&0````8````(`````````!@`````````50``
+XM``$`````````````````````````MQP```````""!```````````````````
+XM`0```````````````````%`````$````0````````````````````*B:````
+XM````&``````````9````"`````@`````````&`````````!A`````0``````
+XM```````````````````Y(0```````#`````````````````````!````````
+XM````````````:@````@````R````````````````````:2$```````#7`@``
+XM`````````````````0`````````!`````````'D````(````,@``````````
+XM`````````'`A````````+0````````````````````@``````````0``````
+XM``"-`````0````````````````````````!P(0```````,@"````````````
+XM```````(````````````````````B`````0```!`````````````````````
+XMP)H``````````P```````!D````-````"``````````8`````````)\````(
+XM`````@```````````````````#@D````````4`(```````````````````@`
+XM``````````````````":````!````$````````````````````#`G0``````
+XM`(`!````````&0````\````(`````````!@`````````J0````$`````````
+XM````````````````."0````````.'@```````````````````0``````````
+XM`````````+D````!`````````````````````````$9"````````NP``````
+XM``````````````$```````````````````"T````!````$``````````````
+XM``````!`GP```````!@`````````&0```!(````(`````````!@`````````
+XMS@````$``````````````````````````4,````````P````````````````
+XM`````0```````````````````,D````$````0````````````````````%B?
+XM````````,``````````9````%`````@`````````&`````````#=`````0``
+XM```````````````````````Q0P```````.`&```````````````````!````
+XM````````````````ZP````$````P````````````````````$4H```````#H
+XM"````````````````````0`````````!`````````!$````#````````````
+XM`````````````/E2````````]@````````````````````$`````````````
+XM```````!`````@````````````````````````#P4P```````)`&````````
+XM&@```!@````(`````````!@`````````"0````,`````````````````````
+XK````@%H```````!W`@```````````````````0``````````````````````
X`
Xend
-END-of-sections.o.1.uu
+eb2ac2808b7045ab3c2faf26922f5e01
echo x - sections.o.uu
-sed 's/^X//' >sections.o.uu << 'END-of-sections.o.uu'
+sed 's/^X//' >sections.o.uu << 'f3eccedeeefe85afebc666fca5eb0742'
Xbegin 644 sections.o
XM?T5,1@(!`0D```````````$`/@`!`````````````````````````"!Q````
XM`````````$```````$``&P`8`$B+E\````!(A=)T'TB+1B!(.T(@<PSK/$@Y
@@ -2077,6 +2077,6 @@ XM```*`````@```/`0````````!@`````````*````!@``````````````!@``
XM```````*````!@``````````````$``````````!`````@``````````````
X`
Xend
-END-of-sections.o.uu
+f3eccedeeefe85afebc666fca5eb0742
exit
diff --git a/test/elfcopy/tc/strip-unneeded-1/out/strip-unneeded-1.out.shar b/test/elfcopy/tc/strip-unneeded-1/out/strip-unneeded-1.out.shar
index 4c37e6d861ee..1d0310770270 100644
--- a/test/elfcopy/tc/strip-unneeded-1/out/strip-unneeded-1.out.shar
+++ b/test/elfcopy/tc/strip-unneeded-1/out/strip-unneeded-1.out.shar
@@ -9,9 +9,9 @@
# sections.o.uu
#
echo x - sections.o.1.uu
-sed 's/^X//' >sections.o.1.uu << 'END-of-sections.o.1.uu'
+sed 's/^X//' >sections.o.1.uu << 'eb2ac2808b7045ab3c2faf26922f5e01'
Xbegin 644 sections.o.1
-XM?T5,1@(!`0D```````````$`/@`!`````````````````````````!`>````
+XM?T5,1@(!`0D```````````$`/@`!`````````````````````````#@\````
XM`````````$```````$``#0`*`$B+E\````!(A=)T'TB+1B!(.T(@<PSK/$@Y
XM0B!F9F:0=S)(BU)82(72=>U(QT98`````$B+A\@```!(B49@2(N'R````$B)
XM,$B-1EA(B8?(````PTB+0F!(B5982(E&8$B+0F!(B3!(C4982(E"8,-,B60D
@@ -182,202 +182,202 @@ XM`-L`````00X0A@)%#AA$#B"#`P``-````!P"````````[@8```!"#A!"#AA"
XM#B!"#BA!#C!!#CA'#M`!@P>&!HP%C02.`X\"````````+G-Y;71A8@`N<W1R
XM=&%B`"YS:'-T<G1A8@`N<F5L82YT97AT`"YD871A`"YB<W,`+F-O;6UE;G0`
XM+G)O9&%T82YS='(Q+C$`+G)O9&%T82YS='(Q+C@`+G)E;&$N96A?9G)A;64`
+XM```````````````````````````````````````#``$`````````````````
+XM```````````#``8````````````````````````````#``<`````````````
+XM```````````````#``,````````````````````````````#``0`````````
+XM```````````````````#``4````````````````````````````#``@`````
+XM``````````````````$````2``$`<`````````"V`0````````X````0````
+XM`````````````````````!L````0`````````````````````````"<````0
+XM`````````````````````````#@````0`````````````````````````$,`
+XM```0`````````````````````````%,````0````````````````````````
+XM`%L````0`````````````````````````&8````0````````````````````
+XM`````&L````2``$`,`(```````#\`````````'<````0````````````````
+XM`````````(4````0`````````````````````````(\````0````````````
+XM`````````````*`````2``$`H`,```````#I`0```````+`````0````````
+XM`````````````````+L````0`````````````````````````,(````0````
+XM`````````````````````,8````2``$`D`4```````#T`````````-`````0
+XM`````````````````````````-P````2``$`D`8````````Y`0```````.8`
+XM```2``$`T`<````````O`0```````/8````0````````````````````````
+XM`/P````2``$```D```````#_``````````D!```0````````````````````
+XM`````!8!```0`````````````````````````"$!```2``$```H```````"B
+XM`````````#`!```0`````````````````````````#<!```0````````````
+XM`````````````#X!```0`````````````````````````$4!```0````````
+XM`````````````````$P!```0`````````````````````````%0!```2``$`
+XM8`P```````"F`P```````%\!```0`````````````````````````&\!```0
+XM`````````````````````````'L!```0`````````````````````````(8!
+XM```0`````````````````````````)@!```0````````````````````````
+XM`*4!```0`````````````````````````*\!```0````````````````````
+XM`````+0!```0`````````````````````````+P!```2``$`\!````````#N
+XM!@```````,D!```0`````````````````````````-<!```0````````````
+XM`````````````-X!```0`````````````````````````.8!```0````````
+XM`````````````````/(!```0``````````````````````````!S971?<VAS
+XM=')T86(`9V5L9E]G971S:&1R`&5L9E]N97=D871A`&=E;&9?=7!D871E7W-H
+XM9'(`96QF7VYD>'-C;@!E;&9?<V5T<VAS=')N9'@`;65M;6]V90!E;&9?97)R
+XM;7-G`&5R<G@`=7!D871E7W-H9'(`;&]O:W5P7W-T<FEN9P!E;&9?97)R;F\`
+XM:6YS97)T7W1O7W-T<G1A8@!A9&1?=6YL;V%D86)L97,`96QF7VYE=W-C;@!C
+XM86QL;V,`97)R`&-O<'E?9&%T80!E;&9?9V5T9&%T80!C;W!Y7W-H9'(`<F5S
+XM>6YC7W-E8W1I;VYS`'=A<FYX`&EN<V5R=%]S:'1A8@!G96QF7V=E=&5H9'(`
+XM9V5L9E]F<VEZ90!L;V]K=7!?<V5C7V%C=`!S=')C;7``;6%L;&]C`&UE;7-E
+XM=`!S=')L96X`<W1R;F-M<`!C<F5A=&5?<V-N`&5L9E]G971S:'-T<FYD>`!E
+XM;&9?;F5X='-C;@!E;&9?<W1R<'1R`&%D9%]T;U]I;G-E9U]L:7-T`%]?:7-T
+XM:')E861E9`!?7W-T9&]U='``<'5T8P!?7W-W8G5F`&-O<'E?8V]N=&5N=`!C
+XM<F5A=&5?<WEM=&%B`&UE;6-P>0!S=')N8W!Y`&=E;&9?9V5T<F5L`&QO;VMU
+XM<%]K965P7W-Y;6QI<W0```"7``````````(````)````_/_________N````
+XM``````(````*````_/________\;`0````````(````+````_/________]9
+XM`0````````(````,````_/________]F`0````````(````-````_/______
+XM__^E`0````````(````.````_/________^T`0````````(````/````_/__
+XM______^Y`0````````H````"``````````````#(`0````````(````0````
+XM_/_________2`0````````(````/````_/_________7`0````````H````"
+XM````'@````````#F`0````````(````0````_/_________P`0````````(`
+XM```/````_/_________U`0````````H````"````-P`````````$`@``````
+XM``(````0````_/________\.`@````````(````/````_/________\3`@``
+XM``````H````"````50`````````B`@````````(````0````_/________]/
+XM`@````````(````)````_/________]@`@````````(````2````_/______
+XM__^7`@````````(````,````_/________^H`@````````(````+````_/__
+XM______^Z`@````````(````3````_/_________;`@````````(````/````
+XM_/_________@`@````````H````"````<@````````#O`@````````(````0
+XM````_/_________Y`@````````(````/````_/_________^`@````````H`
+XM```"````-P`````````-`P````````(````0````_/________\4`P``````
+XM``(````/````_/________\9`P````````H````"````C@`````````H`P``
+XM``````(````0````_/________]I`P````````H````"````I0````````!N
+XM`P````````(````4````_/________]V`P````````H````"````I@``````
+XM``![`P````````(````4````_/________^#`P````````H````"````K@``
+XM``````"(`P````````(````4````_/________^-`P````````H````"````
+XMM@````````"5`P````````(````4````_/________^]`P````````H````"
+XM````M@````````#U`P````````(````6````_/________\0!`````````(`
+XM```7````_/________]O!`````````(````*````_/________^S!```````
+XM``(````)````_/_________:!`````````(````+````_/________\&!0``
+XM``````(````/````_/________\+!0````````H````"````P``````````:
+XM!0````````(````0````_/________\?!0````````H````"````V```````
+XM```K!0````````(````8````_/________\U!0````````(````/````_/__
+XM______\Z!0````````H````"````'@````````!)!0````````(````0````
+XM_/________]3!0````````(````/````_/________]8!0````````H````"
+XM````Y0````````!G!0````````(````0````_/________]Q!0````````(`
+XM```/````_/________]V!0````````H````"````-P````````"%!0``````
+XM``(````0````_/________^U!0````````(````*````_/_________^!0``
+XM``````(````:````_/________\+!@````````(````3````_/________]1
+XM!@````````(````/````_/________]6!@````````H````"````'@``````
+XM``!E!@````````(````0````_/________]L!@````````(````/````_/__
+XM______]Q!@````````H````"`````P$```````"`!@````````(````0````
+XM_/________^]!@````````(````)````_/_________1!@````````(````)
+XM````_/________\_!P````````(````+````_/________]U!P````````(`
+XM```/````_/________]Z!P````````H````"````'`$```````")!P``````
+XM``(````0````_/________^3!P````````(````/````_/________^8!P``
+XM``````H````"````.@$```````"G!P````````(````0````_/________^Q
+XM!P````````(````/````_/________^V!P````````H````"````6`$`````
+XM``#%!P````````(````0````_/________]+"`````````(````)````_/__
+XM______]N"`````````(````+````_/________^S"`````````H````#````
+XM``````````"Z"`````````(````=````_/_________)"`````````(````/
+XM````_/_________."`````````H````"````<P$```````#="`````````(`
+XM```0````_/_________G"`````````(````/````_/_________L"```````
+XM``H````"````6`$```````#["`````````(````0````_/________\1"0``
+XM``````(````?````_/________\I"0````````(````7````_/________]Z
+XM"0````````(````@````_/________^X"0````````(````/````_/______
+XM__^]"0````````H````"````D0$```````#,"0````````(````0````_/__
+XM_______6"0````````(````/````_/_________;"0````````H````"````
+XMN0$```````#J"0````````(````0````_/_________O"0````````H````"
+XM````JP$```````#["0````````(````0````_/________\Q"@````````(`
+XM```B````_/________]4"@````````(````C````_/________]K"@``````
+XM``(````D````_/________^4"@````````H````"````T0$```````">"@``
+XM``````(````0````_/________^W"@````````(````A````_/_________G
+XM"@````````(````A````_/________]""P````````H````"````M@``````
+XM``!I"P````````H````"````I@````````"&"P````````H````"````K@``
+XM``````"7"P````````H````"````XP$```````"B"P````````L````"````
+XMXP$```````"K"P````````L````"````Z@$```````"T"P````````L````"
+XM````_`$```````"]"P````````L````"`````@(```````#B"P````````(`
+XM```E````_/_________P"P````````(````F````_/________\B#```````
+XM``(````A````_/________]_#`````````(````7````_/________^3#```
+XM``````L````"````M@````````#+#`````````(````H````_/_________H
+XM#`````````(````I````_/__________#`````````(````)````_/______
+XM__\=#0````````(````J````_/________]4#0````````H````"````M@``
+XM``````!^#0````````(````6````_/________^3#0````````(````,````
+XM_/________^X#0````````H````"````I@````````#2#0````````H````"
+XM````K@`````````1#@````````(````H````_/________\J#@````````(`
+XM```I````_/________\^#@````````(````,````_/________].#@``````
+XM``(````)````_/________]K#@````````(````J````_/________^;#@``
+XM``````(````7````_/_________<#@````````(````K````_/_________W
+XM#@````````(````;````_/________\!#P````````(````3````_/______
+XM__\0#P````````(````/````_/________\5#P````````H````"````C@``
+XM```````D#P````````(````0````_/________\I#P````````(````3````
+XM_/________])#P````````(````/````_/________].#P````````H````"
+XM````/P(```````!=#P````````(````0````_/________]G#P````````(`
+XM```/````_/________]L#P````````H````"````(P(```````![#P``````
+XM``(````0````_/________^%#P````````(````/````_/________^*#P``
+XM``````H````"````@P(```````"9#P````````(````0````_/________^C
+XM#P````````(````/````_/________^H#P````````H````"````;0(`````
+XM``"W#P````````(````0````_/________^\#P````````H````"````JP$`
+XM``````#&#P````````(````8````_/_________0#P````````(````/````
+XM_/_________5#P````````H````"````"`(```````#D#P````````(````0
+XM````_/_________N#P````````(````/````_/_________S#P````````H`
+XM```"````50(````````"$`````````(````0````_/________\F$```````
+XM``(````L````_/________\Q$`````````(````M````_/________]E$```
+XM``````(````L````_/________]P$`````````(````M````_/________^D
+XM$`````````(````M````_/________^N$`````````(````N````_/______
+XM__^W$`````````(````M````_/________^_$`````````(````N````_/__
+XM_______3$`````````(````O````_/_________B$`````````(````O````
+XM_/________\W$0````````H````"````I@````````!7$0````````(````Q
+XM````_/________^`$0````````H````"````K@````````"2$0````````H`
+XM```"````M@````````#J$0````````(````C````_/________\,$@``````
+XM``(````R````_/________\A$@````````(````:````_/________\[$@``
+XM``````(````C````_/________]9$@````````(````)````_/_________!
+XM$@````````(````3````_/________\"$P````````(````C````_/______
+XM__^I$P````````(````E````_/_________!$P````````(````B````_/__
+XM______\)%`````````(````9````_/________\9%`````````(````A````
+XM_/________]@%`````````(````:````_/________]M%`````````(````3
+XM````_/________][%`````````(````L````_/________^*%`````````(`
+XM```M````_/_________6%`````````(````S````_/________\V%0``````
+XM``(````S````_/________]0%0````````(````A````_/________]<%0``
+XM``````(````E````_/________]T%0````````(````S````_/________^B
+XM%0````````(````R````_/________^W%0````````(````A````_/______
+XM___`%0````````(````E````_/_________4%0````````H````"````O@(`
+XM``````#@%0````````(````8````_/_________G%0````````(````M````
+XM_/_________Q%0````````(````N````_/________\E%@````````(````:
+XM````_/________]#%@````````(````T````_/________]G%@````````(`
+XM```,````_/________][%@````````(````J````_/________^1%@``````
+XM``(````U````_/________^J%@````````(````C````_/_________:%@``
+XM``````(````O````_/_________I%@````````(````C````_/________\3
+XM%P````````(````/````_/________\8%P````````H````"`````P$`````
+XM```G%P````````(````0````_/________\L%P````````H````"````L`(`
+XM```````V%P````````(````8````_/________]`%P````````(````/````
+XM_/________]%%P````````H````"````D0$```````!4%P````````(````0
+XM````_/________]>%P````````(````/````_/________]C%P````````H`
+XM```"````/P(```````!R%P````````(````0````_/________]\%P``````
+XM``(````/````_/________^!%P````````H````"````F0(```````"0%P``
+XM``````(````0````_/________^5%P````````(````3````_/_________%
+XM%P````````(````@````_/________]A`P````````(````4````_/______
+XM__\@``````````H````!```````````````X``````````H````!````<```
+XM``````!8``````````H````!````,`(```````"```````````H````!````
+XM,`,```````"8``````````H````!````H`,```````#(``````````H````!
+XM````D`4```````#H``````````H````!````D`8````````(`0````````H`
+XM```!````T`<````````P`0````````H````!``````D```````!0`0``````
+XM``H````!``````H```````!X`0````````H````!````L`H```````"0`0``
+XM``````H````!````X`H```````"H`0````````H````!````(`L```````#(
+XM`0````````H````!````8`P``````````@````````H````!````$!``````
+XM```@`@````````H````!````\!``````````````````````````````````
XM````````````````````````````````````````````````````````````
-XM```````````````````````````@`````0````8```````````````````!`
-XM`````````-X7```````````````````0````````````````````&P````0`
-XM````````````````````````:"@```````"0%0````````L````!````"```
-XM```````8`````````"8````!`````P```````````````````"`8````````
-XM``````````````````````0````````````````````L````"`````,`````
-XM```````````````@&``````````````````````````````$````````````
-XM````````,0````$`````````````````````````(!@````````P````````
-XM`````````````0```````````````````#H````!````,@``````````````
-XM`````%`8````````UP(```````````````````$``````````0````````!)
-XM`````0```#(````````````````````H&P```````"T`````````````````
-XM```(``````````$`````````70````$````"````````````````````6!L`
-XM``````!0`@``````````````````"````````````````````%@````$````
-XM`````````````````````/@]````````@`$````````+````"`````@`````
-XM````&``````````1`````P````````````````````````"H'0```````&<`
-XM```````````````````!`````````````````````0````(`````````````
-XM````````````4"$````````0!0````````P````(````"``````````8````
-XM``````D````#`````````````````````````&`F````````!@(`````````
-XM``````````$`````````````````````````````````````````````````
-XM`````````P`!`````````````````````````````P`&````````````````
-XM`````````````P`'`````````````````````````````P`#````````````
-XM`````````````````P`$`````````````````````````````P`%````````
-XM`````````````````````P`(```````````````````````!````$@`!`'``
-XM````````M@$````````.````$``````````````````````````;````$```
-XM```````````````````````G````$``````````````````````````X````
-XM$`````````````````````````!#````$`````````````````````````!3
-XM````$`````````````````````````!;````$```````````````````````
-XM``!F````$`````````````````````````!K````$@`!`#`"````````_```
-XM``````!W````$`````````````````````````"%````$```````````````
-XM``````````"/````$`````````````````````````"@````$@`!`*`#````
-XM````Z0$```````"P````$`````````````````````````"[````$```````
-XM``````````````````#"````$`````````````````````````#&````$@`!
-XM`)`%````````]`````````#0````$`````````````````````````#<````
-XM$@`!`)`&````````.0$```````#F````$@`!`-`'````````+P$```````#V
-XM````$`````````````````````````#\````$@`!```)````````_P``````
-XM```)`0``$``````````````````````````6`0``$```````````````````
-XM```````A`0``$@`!```*````````H@`````````P`0``$```````````````
-XM```````````W`0``$``````````````````````````^`0``$```````````
-XM``````````````!%`0``$`````````````````````````!,`0``$```````
-XM``````````````````!4`0``$@`!`&`,````````I@,```````!?`0``$```
-XM``````````````````````!O`0``$`````````````````````````![`0``
-XM$`````````````````````````"&`0``$`````````````````````````"8
-XM`0``$`````````````````````````"E`0``$```````````````````````
-XM``"O`0``$`````````````````````````"T`0``$```````````````````
-XM``````"\`0``$@`!`/`0````````[@8```````#)`0``$```````````````
-XM``````````#7`0``$`````````````````````````#>`0``$```````````
-XM``````````````#F`0``$`````````````````````````#R`0``$```````
-XM````````````````````<V5T7W-H<W1R=&%B`&=E;&9?9V5T<VAD<@!E;&9?
-XM;F5W9&%T80!G96QF7W5P9&%T95]S:&1R`&5L9E]N9'AS8VX`96QF7W-E='-H
-XM<W1R;F1X`&UE;6UO=F4`96QF7V5R<FUS9P!E<G)X`'5P9&%T95]S:&1R`&QO
-XM;VMU<%]S=')I;F<`96QF7V5R<FYO`&EN<V5R=%]T;U]S=')T86(`861D7W5N
-XM;&]A9&%B;&5S`&5L9E]N97=S8VX`8V%L;&]C`&5R<@!C;W!Y7V1A=&$`96QF
-XM7V=E=&1A=&$`8V]P>5]S:&1R`')E<WEN8U]S96-T:6]N<P!W87)N>`!I;G-E
-XM<G1?<VAT86(`9V5L9E]G971E:&1R`&=E;&9?9G-I>F4`;&]O:W5P7W-E8U]A
-XM8W0`<W1R8VUP`&UA;&QO8P!M96US970`<W1R;&5N`'-T<FYC;7``8W)E871E
-XM7W-C;@!E;&9?9V5T<VAS=')N9'@`96QF7VYE>'1S8VX`96QF7W-T<G!T<@!A
-XM9&1?=&]?:6YS96=?;&ES=`!?7VES=&AR96%D960`7U]S=&1O=71P`'!U=&,`
-XM7U]S=V)U9@!C;W!Y7V-O;G1E;G0`8W)E871E7W-Y;71A8@!M96UC<'D`<W1R
-XM;F-P>0!G96QF7V=E=')E;`!L;V]K=7!?:V5E<%]S>6UL:7-T````EP``````
-XM```"````"0```/S_________[@`````````"````"@```/S_________&P$`
-XM```````"````"P```/S_________60$````````"````#````/S_________
-XM9@$````````"````#0```/S_________I0$````````"````#@```/S_____
-XM____M`$````````"````#P```/S_________N0$````````*`````@``````
-XM````````R`$````````"````$````/S_________T@$````````"````#P``
-XM`/S_________UP$````````*`````@```!X`````````Y@$````````"````
-XM$````/S_________\`$````````"````#P```/S_________]0$````````*
-XM`````@```#<`````````!`(````````"````$````/S_________#@(`````
-XM```"````#P```/S_________$P(````````*`````@```%4`````````(@(`
-XM```````"````$````/S_________3P(````````"````"0```/S_________
-XM8`(````````"````$@```/S_________EP(````````"````#````/S_____
-XM____J`(````````"````"P```/S_________N@(````````"````$P```/S_
-XM________VP(````````"````#P```/S_________X`(````````*`````@``
-XM`'(`````````[P(````````"````$````/S_________^0(````````"````
-XM#P```/S__________@(````````*`````@```#<`````````#0,````````"
-XM````$````/S_________%`,````````"````#P```/S_________&0,`````
-XM```*`````@```(X`````````*`,````````"````$````/S_________:0,`
-XM```````*`````@```*4`````````;@,````````"````%````/S_________
-XM=@,````````*`````@```*8`````````>P,````````"````%````/S_____
-XM____@P,````````*`````@```*X`````````B`,````````"````%````/S_
-XM________C0,````````*`````@```+8`````````E0,````````"````%```
-XM`/S_________O0,````````*`````@```+8`````````]0,````````"````
-XM%@```/S_________$`0````````"````%P```/S_________;P0````````"
-XM````"@```/S_________LP0````````"````"0```/S_________V@0`````
-XM```"````"P```/S_________!@4````````"````#P```/S_________"P4`
-XM```````*`````@```,``````````&@4````````"````$````/S_________
-XM'P4````````*`````@```-@`````````*P4````````"````&````/S_____
-XM____-04````````"````#P```/S_________.@4````````*`````@```!X`
-XM````````204````````"````$````/S_________4P4````````"````#P``
-XM`/S_________6`4````````*`````@```.4`````````9P4````````"````
-XM$````/S_________<04````````"````#P```/S_________=@4````````*
-XM`````@```#<`````````A04````````"````$````/S_________M04`````
-XM```"````"@```/S__________@4````````"````&@```/S_________"P8`
-XM```````"````$P```/S_________408````````"````#P```/S_________
-XM5@8````````*`````@```!X`````````908````````"````$````/S_____
-XM____;`8````````"````#P```/S_________<08````````*`````@````,!
-XM````````@`8````````"````$````/S_________O08````````"````"0``
-XM`/S_________T08````````"````"0```/S_________/P<````````"````
-XM"P```/S_________=0<````````"````#P```/S_________>@<````````*
-XM`````@```!P!````````B0<````````"````$````/S_________DP<`````
-XM```"````#P```/S_________F`<````````*`````@```#H!````````IP<`
-XM```````"````$````/S_________L0<````````"````#P```/S_________
-XMM@<````````*`````@```%@!````````Q0<````````"````$````/S_____
-XM____2P@````````"````"0```/S_________;@@````````"````"P```/S_
-XM________LP@````````*`````P``````````````N@@````````"````'0``
-XM`/S_________R0@````````"````#P```/S_________S@@````````*````
-XM`@```',!````````W0@````````"````$````/S_________YP@````````"
-XM````#P```/S_________[`@````````*`````@```%@!````````^P@`````
-XM```"````$````/S_________$0D````````"````'P```/S_________*0D`
-XM```````"````%P```/S_________>@D````````"````(````/S_________
-XMN`D````````"````#P```/S_________O0D````````*`````@```)$!````
-XM````S`D````````"````$````/S_________U@D````````"````#P```/S_
-XM________VPD````````*`````@```+D!````````Z@D````````"````$```
-XM`/S_________[PD````````*`````@```*L!````````^PD````````"````
-XM$````/S_________,0H````````"````(@```/S_________5`H````````"
-XM````(P```/S_________:PH````````"````)````/S_________E`H`````
-XM```*`````@```-$!````````G@H````````"````$````/S_________MPH`
-XM```````"````(0```/S_________YPH````````"````(0```/S_________
-XM0@L````````*`````@```+8`````````:0L````````*`````@```*8`````
-XM````A@L````````*`````@```*X`````````EPL````````*`````@```.,!
-XM````````H@L````````+`````@```.,!````````JPL````````+`````@``
-XM`.H!````````M`L````````+`````@```/P!````````O0L````````+````
-XM`@````("````````X@L````````"````)0```/S_________\`L````````"
-XM````)@```/S_________(@P````````"````(0```/S_________?PP`````
-XM```"````%P```/S_________DPP````````+`````@```+8`````````RPP`
-XM```````"````*````/S_________Z`P````````"````*0```/S_________
-XM_PP````````"````"0```/S_________'0T````````"````*@```/S_____
-XM____5`T````````*`````@```+8`````````?@T````````"````%@```/S_
-XM________DPT````````"````#````/S_________N`T````````*`````@``
-XM`*8`````````T@T````````*`````@```*X`````````$0X````````"````
-XM*````/S_________*@X````````"````*0```/S_________/@X````````"
-XM````#````/S_________3@X````````"````"0```/S_________:PX`````
-XM```"````*@```/S_________FPX````````"````%P```/S_________W`X`
-XM```````"````*P```/S_________]PX````````"````&P```/S_________
-XM`0\````````"````$P```/S_________$`\````````"````#P```/S_____
-XM____%0\````````*`````@```(X`````````)`\````````"````$````/S_
-XM________*0\````````"````$P```/S_________20\````````"````#P``
-XM`/S_________3@\````````*`````@```#\"````````70\````````"````
-XM$````/S_________9P\````````"````#P```/S_________;`\````````*
-XM`````@```","````````>P\````````"````$````/S_________A0\`````
-XM```"````#P```/S_________B@\````````*`````@```(,"````````F0\`
-XM```````"````$````/S_________HP\````````"````#P```/S_________
-XMJ`\````````*`````@```&T"````````MP\````````"````$````/S_____
-XM____O`\````````*`````@```*L!````````Q@\````````"````&````/S_
-XM________T`\````````"````#P```/S_________U0\````````*`````@``
-XM``@"````````Y`\````````"````$````/S_________[@\````````"````
-XM#P```/S_________\P\````````*`````@```%4"`````````A`````````"
-XM````$````/S_________)A`````````"````+````/S_________,1``````
-XM```"````+0```/S_________91`````````"````+````/S_________<!``
-XM```````"````+0```/S_________I!`````````"````+0```/S_________
-XMKA`````````"````+@```/S_________MQ`````````"````+0```/S_____
-XM____OQ`````````"````+@```/S_________TQ`````````"````+P```/S_
-XM________XA`````````"````+P```/S_________-Q$````````*`````@``
-XM`*8`````````5Q$````````"````,0```/S_________@!$````````*````
-XM`@```*X`````````DA$````````*`````@```+8`````````ZA$````````"
-XM````(P```/S_________#!(````````"````,@```/S_________(1(`````
-XM```"````&@```/S_________.Q(````````"````(P```/S_________61(`
-XM```````"````"0```/S_________P1(````````"````$P```/S_________
-XM`A,````````"````(P```/S_________J1,````````"````)0```/S_____
-XM____P1,````````"````(@```/S_________"10````````"````&0```/S_
-XM________&10````````"````(0```/S_________8!0````````"````&@``
-XM`/S_________;10````````"````$P```/S_________>Q0````````"````
-XM+````/S_________BA0````````"````+0```/S_________UA0````````"
-XM````,P```/S_________-A4````````"````,P```/S_________4!4`````
-XM```"````(0```/S_________7!4````````"````)0```/S_________=!4`
-XM```````"````,P```/S_________HA4````````"````,@```/S_________
-XMMQ4````````"````(0```/S_________P!4````````"````)0```/S_____
-XM____U!4````````*`````@```+X"````````X!4````````"````&````/S_
-XM________YQ4````````"````+0```/S_________\14````````"````+@``
-XM`/S_________)18````````"````&@```/S_________0Q8````````"````
-XM-````/S_________9Q8````````"````#````/S_________>Q8````````"
-XM````*@```/S_________D18````````"````-0```/S_________JA8`````
-XM```"````(P```/S_________VA8````````"````+P```/S_________Z18`
-XM```````"````(P```/S_________$Q<````````"````#P```/S_________
-XM&!<````````*`````@````,!````````)Q<````````"````$````/S_____
-XM____+!<````````*`````@```+`"````````-A<````````"````&````/S_
-XM________0!<````````"````#P```/S_________11<````````*`````@``
-XM`)$!````````5!<````````"````$````/S_________7A<````````"````
-XM#P```/S_________8Q<````````*`````@```#\"````````<A<````````"
-XM````$````/S_________?!<````````"````#P```/S_________@1<`````
-XM```*`````@```)D"````````D!<````````"````$````/S_________E1<`
-XM```````"````$P```/S_________Q1<````````"````(````/S_________
-XM80,````````"````%````/S_________(``````````*`````0``````````
-XM````.``````````*`````0```'``````````6``````````*`````0```#`"
-XM````````@``````````*`````0```#`#````````F``````````*`````0``
-XM`*`#````````R``````````*`````0```)`%````````Z``````````*````
-XM`0```)`&````````"`$````````*`````0```-`'````````,`$````````*
-XM`````0`````)````````4`$````````*`````0`````*````````>`$`````
-XM```*`````0```+`*````````D`$````````*`````0```.`*````````J`$`
-XM```````*`````0```"`+````````R`$````````*`````0```&`,````````
-XM``(````````*`````0```!`0````````(`(````````*`````0```/`0````
+XM(`````$````&````````````````````0`````````#>%P``````````````
+XM````$````````````````````!L````$````0````````````````````"@E
+XM````````D!4````````+`````0````@`````````&``````````F`````0``
+XM``,````````````````````@&``````````````````````````````$````
+XM````````````````+`````@````#````````````````````(!@`````````
+XM````````````````````!````````````````````#$````!````````````
+XM`````````````"`8````````,`````````````````````$`````````````
+XM```````Z`````0```#(```````````````````!0&````````-<"````````
+XM```````````!``````````$`````````20````$````R````````````````
+XM````*!L````````M````````````````````"``````````!`````````%T`
+XM```!`````@```````````````````%@;````````4`(`````````````````
+XM``@```````````````````!8````!````$````````````````````"X.@``
+XM`````(`!````````"P````@````(`````````!@`````````$0````,`````
+XM````````````````````J!T```````!G`````````````````````0``````
+XM``````````````$````"`````````````````````````!`>````````$`4`
+XM```````,````"`````@`````````&``````````)`````P``````````````
+XM```````````@(P````````8"```````````````````!````````````````
X#````
X`
Xend
-END-of-sections.o.1.uu
+eb2ac2808b7045ab3c2faf26922f5e01
echo x - sections.o.uu
-sed 's/^X//' >sections.o.uu << 'END-of-sections.o.uu'
+sed 's/^X//' >sections.o.uu << 'f3eccedeeefe85afebc666fca5eb0742'
Xbegin 644 sections.o
XM?T5,1@(!`0D```````````$`/@`!`````````````````````````"!Q````
XM`````````$```````$``&P`8`$B+E\````!(A=)T'TB+1B!(.T(@<PSK/$@Y
@@ -1493,6 +1493,6 @@ XM```*`````@```/`0````````!@`````````*````!@``````````````!@``
XM```````*````!@``````````````$``````````!`````@``````````````
X`
Xend
-END-of-sections.o.uu
+f3eccedeeefe85afebc666fca5eb0742
exit
diff --git a/test/elfcopy/tc/strip-unneeded-2/out/strip-unneeded-2.out.shar b/test/elfcopy/tc/strip-unneeded-2/out/strip-unneeded-2.out.shar
index 96d9028c57d3..c73f7e806239 100644
--- a/test/elfcopy/tc/strip-unneeded-2/out/strip-unneeded-2.out.shar
+++ b/test/elfcopy/tc/strip-unneeded-2/out/strip-unneeded-2.out.shar
@@ -9,8 +9,8 @@
# elfcopy.uu
#
echo x - elfcopy.1.uu
-sed 's/^X//' >elfcopy.1.uu << 'END-of-elfcopy.1.uu'
-Xbegin 755 elfcopy.1
+sed 's/^X//' >elfcopy.1.uu << 'e4e59173f6354081a9e3a7debde2f069'
+Xbegin 644 elfcopy.1
XM?T5,1@(!`0D```````````(`/@`!````4!M```````!``````````'B!````
XM`````````$``.``'`$``&@`9``8````%````0`````````!``$```````$``
XM0```````B`$```````"(`0````````@``````````P````0```#(`0``````
@@ -759,8 +759,8 @@ XMT`M```````#0"P````````\#```````````````````!````````````````
XM````-P```/___V\"`````````.`.0```````X`X```````"@``````````0`
XM`````````@`````````"`````````$0```#^__]O`@````````"`#T``````
XM`(`/````````0``````````%`````@````@```````````````````!3````
-XM!`````(`````````P`]```````#`#P```````'@`````````!``````````(
-XM`````````!@`````````70````0````"`````````#@00```````.!``````
+XM!````$(`````````P`]```````#`#P```````'@`````````!``````````(
+XM`````````!@`````````70````0```!"`````````#@00```````.!``````
XM``"0!@````````0````+````"``````````8`````````&<````!````!@``
XM``````#(%D```````,@6````````$P````````````````````0`````````
XM``````````!B`````0````8`````````W!9```````#<%@```````'`$````
@@ -787,10 +787,10 @@ XM``````$````#`````````````````````````*:`````````S@``````````
X7``````````$`````````````````````
X`
Xend
-END-of-elfcopy.1.uu
+e4e59173f6354081a9e3a7debde2f069
echo x - elfcopy.uu
-sed 's/^X//' >elfcopy.uu << 'END-of-elfcopy.uu'
-Xbegin 755 elfcopy
+sed 's/^X//' >elfcopy.uu << '2151ae8f08071e33d3c60fbc8f2d2844'
+Xbegin 644 elfcopy
XM?T5,1@(!`0D```````````(`/@`!````4!M```````!``````````#AM`0``
XM`````````$``.``'`$``)0`B``8````%````0`````````!``$```````$``
XM0```````B`$```````"(`0````````@``````````P````0```#(`0``````
@@ -3078,6 +3078,6 @@ XM7U)E9VES=&5R0VQA<W-E<P!G971P<F]G;F%M94!`1D)31%\Q+C``<V5T=7!?
XF<&AD<@!G96QF7V=E=')E;$!`1D)31%\Q+C``8W)E871E7W-C;@``
X`
Xend
-END-of-elfcopy.uu
+2151ae8f08071e33d3c60fbc8f2d2844
exit
diff --git a/test/elfdump/ts/dso1/@G%libelf.so.out b/test/elfdump/ts/dso1/@G%libelf.so.out
index 12c593d07073..546816c00bbd 100644
--- a/test/elfdump/ts/dso1/@G%libelf.so.out
+++ b/test/elfdump/ts/dso1/@G%libelf.so.out
@@ -1,5 +1,5 @@
-global offset table:
+global offset table: .got
entry: 0
0x118208
diff --git a/test/elfdump/ts/dso1/@S@G%libelf.so.out b/test/elfdump/ts/dso1/@S@G%libelf.so.out
index e95ee8f3ef67..19f412c40c31 100644
--- a/test/elfdump/ts/dso1/@S@G%libelf.so.out
+++ b/test/elfdump/ts/dso1/@S@G%libelf.so.out
@@ -4,43 +4,43 @@ Global Offset Table Section: .got (47 entries)
[00000] 00000000001183e0 0000000000118208 R_X86_64_NONE 000000000000
[00001] 00000000001183e8 0000000000000000 R_X86_64_NONE 000000000000
[00002] 00000000001183f0 0000000000000000 R_X86_64_NONE 000000000000
-[00003] 00000000001183f8 0000000000002852 R_X86_64_JMP_SLOT 000000000000 write
-[00004] 0000000000118400 0000000000002862 R_X86_64_JMP_SLOT 000000000000 elf_flagscn
-[00005] 0000000000118408 0000000000002872 R_X86_64_JMP_SLOT 000000000000 elf_rawdata
-[00006] 0000000000118410 0000000000002882 R_X86_64_JMP_SLOT 000000000000 elf_flagelf
-[00007] 0000000000118418 0000000000002892 R_X86_64_JMP_SLOT 000000000000 strlcat
-[00008] 0000000000118420 00000000000028a2 R_X86_64_JMP_SLOT 000000000000 gelf_getehdr
-[00009] 0000000000118428 00000000000028b2 R_X86_64_JMP_SLOT 000000000000 __cxa_finalize
-[00010] 0000000000118430 00000000000028c2 R_X86_64_JMP_SLOT 000000000000 elf_hash
-[00011] 0000000000118438 00000000000028d2 R_X86_64_JMP_SLOT 000000000000 strerror
-[00012] 0000000000118440 00000000000028e2 R_X86_64_JMP_SLOT 000000000000 gelf_fsize
-[00013] 0000000000118448 00000000000028f2 R_X86_64_JMP_SLOT 000000000000 elf_flagshdr
-[00014] 0000000000118450 0000000000002902 R_X86_64_JMP_SLOT 000000000000 gelf_getsym
-[00015] 0000000000118458 0000000000002912 R_X86_64_JMP_SLOT 000000000000 munmap
-[00016] 0000000000118460 0000000000002922 R_X86_64_JMP_SLOT 000000000000 strncpy
-[00017] 0000000000118468 0000000000002932 R_X86_64_JMP_SLOT 000000000000 elf_getscn
-[00018] 0000000000118470 0000000000002942 R_X86_64_JMP_SLOT 000000000000 memset
-[00019] 0000000000118478 0000000000002952 R_X86_64_JMP_SLOT 000000000000 elf_getdata
-[00020] 0000000000118480 0000000000002962 R_X86_64_JMP_SLOT 000000000000 mmap
-[00021] 0000000000118488 0000000000002972 R_X86_64_JMP_SLOT 000000000000 __error
-[00022] 0000000000118490 0000000000002982 R_X86_64_JMP_SLOT 000000000000 __assert
-[00023] 0000000000118498 0000000000002992 R_X86_64_JMP_SLOT 000000000000 lseek
-[00024] 00000000001184a0 00000000000029a2 R_X86_64_JMP_SLOT 000000000000 elf64_fsize
-[00025] 00000000001184a8 00000000000029b2 R_X86_64_JMP_SLOT 000000000000 ftruncate
-[00026] 00000000001184b0 00000000000029c2 R_X86_64_JMP_SLOT 000000000000 calloc
-[00027] 00000000001184b8 00000000000029d2 R_X86_64_JMP_SLOT 000000000000 elf_end
-[00028] 00000000001184c0 00000000000029e2 R_X86_64_JMP_SLOT 000000000000 elf32_fsize
-[00029] 00000000001184c8 00000000000029f2 R_X86_64_JMP_SLOT 000000000000 gelf_getshdr
-[00030] 00000000001184d0 0000000000002a02 R_X86_64_JMP_SLOT 000000000000 gelf_update_sym
-[00031] 00000000001184d8 0000000000002a12 R_X86_64_JMP_SLOT 000000000000 malloc
-[00032] 00000000001184e0 0000000000002a22 R_X86_64_JMP_SLOT 000000000000 memcpy
-[00033] 00000000001184e8 0000000000002a32 R_X86_64_JMP_SLOT 000000000000 free
-[00034] 00000000001184f0 0000000000002a42 R_X86_64_JMP_SLOT 000000000000 elf_flagphdr
-[00035] 00000000001184f8 0000000000002a52 R_X86_64_JMP_SLOT 000000000000 __stack_chk_fail
-[00036] 0000000000118500 0000000000002a62 R_X86_64_JMP_SLOT 000000000000 elf_memory
-[00037] 0000000000118508 0000000000002a72 R_X86_64_JMP_SLOT 000000000000 elf_flagehdr
-[00038] 0000000000118510 0000000000002a82 R_X86_64_JMP_SLOT 000000000000 fstat
-[00039] 0000000000118518 0000000000002a92 R_X86_64_JMP_SLOT 000000000000 strlcpy
+[00003] 00000000001183f8 0000000000002852 R_X86_64_JUMP_SLOT 000000000000 write
+[00004] 0000000000118400 0000000000002862 R_X86_64_JUMP_SLOT 000000000000 elf_flagscn
+[00005] 0000000000118408 0000000000002872 R_X86_64_JUMP_SLOT 000000000000 elf_rawdata
+[00006] 0000000000118410 0000000000002882 R_X86_64_JUMP_SLOT 000000000000 elf_flagelf
+[00007] 0000000000118418 0000000000002892 R_X86_64_JUMP_SLOT 000000000000 strlcat
+[00008] 0000000000118420 00000000000028a2 R_X86_64_JUMP_SLOT 000000000000 gelf_getehdr
+[00009] 0000000000118428 00000000000028b2 R_X86_64_JUMP_SLOT 000000000000 __cxa_finalize
+[00010] 0000000000118430 00000000000028c2 R_X86_64_JUMP_SLOT 000000000000 elf_hash
+[00011] 0000000000118438 00000000000028d2 R_X86_64_JUMP_SLOT 000000000000 strerror
+[00012] 0000000000118440 00000000000028e2 R_X86_64_JUMP_SLOT 000000000000 gelf_fsize
+[00013] 0000000000118448 00000000000028f2 R_X86_64_JUMP_SLOT 000000000000 elf_flagshdr
+[00014] 0000000000118450 0000000000002902 R_X86_64_JUMP_SLOT 000000000000 gelf_getsym
+[00015] 0000000000118458 0000000000002912 R_X86_64_JUMP_SLOT 000000000000 munmap
+[00016] 0000000000118460 0000000000002922 R_X86_64_JUMP_SLOT 000000000000 strncpy
+[00017] 0000000000118468 0000000000002932 R_X86_64_JUMP_SLOT 000000000000 elf_getscn
+[00018] 0000000000118470 0000000000002942 R_X86_64_JUMP_SLOT 000000000000 memset
+[00019] 0000000000118478 0000000000002952 R_X86_64_JUMP_SLOT 000000000000 elf_getdata
+[00020] 0000000000118480 0000000000002962 R_X86_64_JUMP_SLOT 000000000000 mmap
+[00021] 0000000000118488 0000000000002972 R_X86_64_JUMP_SLOT 000000000000 __error
+[00022] 0000000000118490 0000000000002982 R_X86_64_JUMP_SLOT 000000000000 __assert
+[00023] 0000000000118498 0000000000002992 R_X86_64_JUMP_SLOT 000000000000 lseek
+[00024] 00000000001184a0 00000000000029a2 R_X86_64_JUMP_SLOT 000000000000 elf64_fsize
+[00025] 00000000001184a8 00000000000029b2 R_X86_64_JUMP_SLOT 000000000000 ftruncate
+[00026] 00000000001184b0 00000000000029c2 R_X86_64_JUMP_SLOT 000000000000 calloc
+[00027] 00000000001184b8 00000000000029d2 R_X86_64_JUMP_SLOT 000000000000 elf_end
+[00028] 00000000001184c0 00000000000029e2 R_X86_64_JUMP_SLOT 000000000000 elf32_fsize
+[00029] 00000000001184c8 00000000000029f2 R_X86_64_JUMP_SLOT 000000000000 gelf_getshdr
+[00030] 00000000001184d0 0000000000002a02 R_X86_64_JUMP_SLOT 000000000000 gelf_update_sym
+[00031] 00000000001184d8 0000000000002a12 R_X86_64_JUMP_SLOT 000000000000 malloc
+[00032] 00000000001184e0 0000000000002a22 R_X86_64_JUMP_SLOT 000000000000 memcpy
+[00033] 00000000001184e8 0000000000002a32 R_X86_64_JUMP_SLOT 000000000000 free
+[00034] 00000000001184f0 0000000000002a42 R_X86_64_JUMP_SLOT 000000000000 elf_flagphdr
+[00035] 00000000001184f8 0000000000002a52 R_X86_64_JUMP_SLOT 000000000000 __stack_chk_fail
+[00036] 0000000000118500 0000000000002a62 R_X86_64_JUMP_SLOT 000000000000 elf_memory
+[00037] 0000000000118508 0000000000002a72 R_X86_64_JUMP_SLOT 000000000000 elf_flagehdr
+[00038] 0000000000118510 0000000000002a82 R_X86_64_JUMP_SLOT 000000000000 fstat
+[00039] 0000000000118518 0000000000002a92 R_X86_64_JUMP_SLOT 000000000000 strlcpy
[00040] 0000000000118520 0000000000000000 R_X86_64_GLOB_DAT 000000000000 __cxa_finalize
[00041] 0000000000118528 0000000000000000 R_X86_64_GLOB_DAT 000000000000 __stack_chk_guard
[00042] 0000000000118530 0000000000000000 R_X86_64_GLOB_DAT 000000000000 elf64_fsize
diff --git a/test/elfdump/ts/dso1/@S@r%libelf.so.out b/test/elfdump/ts/dso1/@S@r%libelf.so.out
index f22931a386c9..e8e7d44c2b11 100644
--- a/test/elfdump/ts/dso1/@S@r%libelf.so.out
+++ b/test/elfdump/ts/dso1/@S@r%libelf.so.out
@@ -115,40 +115,40 @@ Relocation Section: .rela.dyn
Relocation Section: .rela.plt
type offset addend section with respect to
- R_X86_64_JMP_SLOT 0x1183f8 0 .rela.plt write
- R_X86_64_JMP_SLOT 0x118400 0 .rela.plt elf_flagscn
- R_X86_64_JMP_SLOT 0x118408 0 .rela.plt elf_rawdata
- R_X86_64_JMP_SLOT 0x118410 0 .rela.plt elf_flagelf
- R_X86_64_JMP_SLOT 0x118418 0 .rela.plt strlcat
- R_X86_64_JMP_SLOT 0x118420 0 .rela.plt gelf_getehdr
- R_X86_64_JMP_SLOT 0x118428 0 .rela.plt __cxa_finalize
- R_X86_64_JMP_SLOT 0x118430 0 .rela.plt elf_hash
- R_X86_64_JMP_SLOT 0x118438 0 .rela.plt strerror
- R_X86_64_JMP_SLOT 0x118440 0 .rela.plt gelf_fsize
- R_X86_64_JMP_SLOT 0x118448 0 .rela.plt elf_flagshdr
- R_X86_64_JMP_SLOT 0x118450 0 .rela.plt gelf_getsym
- R_X86_64_JMP_SLOT 0x118458 0 .rela.plt munmap
- R_X86_64_JMP_SLOT 0x118460 0 .rela.plt strncpy
- R_X86_64_JMP_SLOT 0x118468 0 .rela.plt elf_getscn
- R_X86_64_JMP_SLOT 0x118470 0 .rela.plt memset
- R_X86_64_JMP_SLOT 0x118478 0 .rela.plt elf_getdata
- R_X86_64_JMP_SLOT 0x118480 0 .rela.plt mmap
- R_X86_64_JMP_SLOT 0x118488 0 .rela.plt __error
- R_X86_64_JMP_SLOT 0x118490 0 .rela.plt __assert
- R_X86_64_JMP_SLOT 0x118498 0 .rela.plt lseek
- R_X86_64_JMP_SLOT 0x1184a0 0 .rela.plt elf64_fsize
- R_X86_64_JMP_SLOT 0x1184a8 0 .rela.plt ftruncate
- R_X86_64_JMP_SLOT 0x1184b0 0 .rela.plt calloc
- R_X86_64_JMP_SLOT 0x1184b8 0 .rela.plt elf_end
- R_X86_64_JMP_SLOT 0x1184c0 0 .rela.plt elf32_fsize
- R_X86_64_JMP_SLOT 0x1184c8 0 .rela.plt gelf_getshdr
- R_X86_64_JMP_SLOT 0x1184d0 0 .rela.plt gelf_update_sym
- R_X86_64_JMP_SLOT 0x1184d8 0 .rela.plt malloc
- R_X86_64_JMP_SLOT 0x1184e0 0 .rela.plt memcpy
- R_X86_64_JMP_SLOT 0x1184e8 0 .rela.plt free
- R_X86_64_JMP_SLOT 0x1184f0 0 .rela.plt elf_flagphdr
- R_X86_64_JMP_SLOT 0x1184f8 0 .rela.plt __stack_chk_fail
- R_X86_64_JMP_SLOT 0x118500 0 .rela.plt elf_memory
- R_X86_64_JMP_SLOT 0x118508 0 .rela.plt elf_flagehdr
- R_X86_64_JMP_SLOT 0x118510 0 .rela.plt fstat
- R_X86_64_JMP_SLOT 0x118518 0 .rela.plt strlcpy
+ R_X86_64_JUMP_SLOT 0x1183f8 0 .rela.plt write
+ R_X86_64_JUMP_SLOT 0x118400 0 .rela.plt elf_flagscn
+ R_X86_64_JUMP_SLOT 0x118408 0 .rela.plt elf_rawdata
+ R_X86_64_JUMP_SLOT 0x118410 0 .rela.plt elf_flagelf
+ R_X86_64_JUMP_SLOT 0x118418 0 .rela.plt strlcat
+ R_X86_64_JUMP_SLOT 0x118420 0 .rela.plt gelf_getehdr
+ R_X86_64_JUMP_SLOT 0x118428 0 .rela.plt __cxa_finalize
+ R_X86_64_JUMP_SLOT 0x118430 0 .rela.plt elf_hash
+ R_X86_64_JUMP_SLOT 0x118438 0 .rela.plt strerror
+ R_X86_64_JUMP_SLOT 0x118440 0 .rela.plt gelf_fsize
+ R_X86_64_JUMP_SLOT 0x118448 0 .rela.plt elf_flagshdr
+ R_X86_64_JUMP_SLOT 0x118450 0 .rela.plt gelf_getsym
+ R_X86_64_JUMP_SLOT 0x118458 0 .rela.plt munmap
+ R_X86_64_JUMP_SLOT 0x118460 0 .rela.plt strncpy
+ R_X86_64_JUMP_SLOT 0x118468 0 .rela.plt elf_getscn
+ R_X86_64_JUMP_SLOT 0x118470 0 .rela.plt memset
+ R_X86_64_JUMP_SLOT 0x118478 0 .rela.plt elf_getdata
+ R_X86_64_JUMP_SLOT 0x118480 0 .rela.plt mmap
+ R_X86_64_JUMP_SLOT 0x118488 0 .rela.plt __error
+ R_X86_64_JUMP_SLOT 0x118490 0 .rela.plt __assert
+ R_X86_64_JUMP_SLOT 0x118498 0 .rela.plt lseek
+ R_X86_64_JUMP_SLOT 0x1184a0 0 .rela.plt elf64_fsize
+ R_X86_64_JUMP_SLOT 0x1184a8 0 .rela.plt ftruncate
+ R_X86_64_JUMP_SLOT 0x1184b0 0 .rela.plt calloc
+ R_X86_64_JUMP_SLOT 0x1184b8 0 .rela.plt elf_end
+ R_X86_64_JUMP_SLOT 0x1184c0 0 .rela.plt elf32_fsize
+ R_X86_64_JUMP_SLOT 0x1184c8 0 .rela.plt gelf_getshdr
+ R_X86_64_JUMP_SLOT 0x1184d0 0 .rela.plt gelf_update_sym
+ R_X86_64_JUMP_SLOT 0x1184d8 0 .rela.plt malloc
+ R_X86_64_JUMP_SLOT 0x1184e0 0 .rela.plt memcpy
+ R_X86_64_JUMP_SLOT 0x1184e8 0 .rela.plt free
+ R_X86_64_JUMP_SLOT 0x1184f0 0 .rela.plt elf_flagphdr
+ R_X86_64_JUMP_SLOT 0x1184f8 0 .rela.plt __stack_chk_fail
+ R_X86_64_JUMP_SLOT 0x118500 0 .rela.plt elf_memory
+ R_X86_64_JUMP_SLOT 0x118508 0 .rela.plt elf_flagehdr
+ R_X86_64_JUMP_SLOT 0x118510 0 .rela.plt fstat
+ R_X86_64_JUMP_SLOT 0x118518 0 .rela.plt strlcpy
diff --git a/test/elfdump/ts/dso2/@G%test.so.out b/test/elfdump/ts/dso2/@G%test.so.out
index d506229a774c..5f706577ebc8 100644
--- a/test/elfdump/ts/dso2/@G%test.so.out
+++ b/test/elfdump/ts/dso2/@G%test.so.out
@@ -1,5 +1,5 @@
-global offset table:
+global offset table: .got
entry: 0
0
@@ -9,3 +9,41 @@ entry: 1
entry: 2
0
+
+global offset table: .got.plt
+
+entry: 0
+ 0x200c58
+
+entry: 1
+ 0
+
+entry: 2
+ 0
+
+entry: 3
+ 0x69e
+
+entry: 4
+ 0x6ae
+
+entry: 5
+ 0x6be
+
+entry: 6
+ 0x6ce
+
+entry: 7
+ 0x6de
+
+entry: 8
+ 0x6ee
+
+entry: 9
+ 0x6fe
+
+entry: 10
+ 0x70e
+
+entry: 11
+ 0x71e
diff --git a/test/elfdump/ts/dso2/@S@G%test.so.out b/test/elfdump/ts/dso2/@S@G%test.so.out
index 7b5bdff019e3..8c23988ad673 100644
--- a/test/elfdump/ts/dso2/@S@G%test.so.out
+++ b/test/elfdump/ts/dso2/@S@G%test.so.out
@@ -4,3 +4,18 @@ Global Offset Table Section: .got (3 entries)
[00000] 0000000000200de8 0000000000000000 R_X86_64_GLOB_DAT 000000000000 __gmon_start__
[00001] 0000000000200df0 0000000000000000 R_X86_64_GLOB_DAT 000000000000 _Jv_RegisterClasses
[00002] 0000000000200df8 0000000000000000 R_X86_64_GLOB_DAT 000000000000 __cxa_finalize
+
+Global Offset Table Section: .got.plt (12 entries)
+ ndx addr value reloc addend symbol
+[00000] 0000000000200e00 0000000000200c58 R_X86_64_NONE 000000000000
+[00001] 0000000000200e08 0000000000000000 R_X86_64_NONE 000000000000
+[00002] 0000000000200e10 0000000000000000 R_X86_64_NONE 000000000000
+[00003] 0000000000200e18 000000000000069e R_X86_64_JUMP_SLOT 000000000000 printf
+[00004] 0000000000200e20 00000000000006ae R_X86_64_JUMP_SLOT 000000000000 puts
+[00005] 0000000000200e28 00000000000006be R_X86_64_JUMP_SLOT 000000000000 toupper
+[00006] 0000000000200e30 00000000000006ce R_X86_64_JUMP_SLOT 000000000000 cos
+[00007] 0000000000200e38 00000000000006de R_X86_64_JUMP_SLOT 000000000000 cosh
+[00008] 0000000000200e40 00000000000006ee R_X86_64_JUMP_SLOT 000000000000 __cxa_finalize
+[00009] 0000000000200e48 00000000000006fe R_X86_64_JUMP_SLOT 000000000000 gets
+[00010] 0000000000200e50 000000000000070e R_X86_64_JUMP_SLOT 000000000000 tolower
+[00011] 0000000000200e58 000000000000071e R_X86_64_JUMP_SLOT 000000000000 acos
diff --git a/test/elfdump/ts/dso2/@S@r%test.so.out b/test/elfdump/ts/dso2/@S@r%test.so.out
index d787b2cd9313..8d0fdd40d262 100644
--- a/test/elfdump/ts/dso2/@S@r%test.so.out
+++ b/test/elfdump/ts/dso2/@S@r%test.so.out
@@ -9,12 +9,12 @@ Relocation Section: .rela.dyn
Relocation Section: .rela.plt
type offset addend section with respect to
- R_X86_64_JMP_SLOT 0x200e18 0 .rela.plt printf
- R_X86_64_JMP_SLOT 0x200e20 0 .rela.plt puts
- R_X86_64_JMP_SLOT 0x200e28 0 .rela.plt toupper
- R_X86_64_JMP_SLOT 0x200e30 0 .rela.plt cos
- R_X86_64_JMP_SLOT 0x200e38 0 .rela.plt cosh
- R_X86_64_JMP_SLOT 0x200e40 0 .rela.plt __cxa_finalize
- R_X86_64_JMP_SLOT 0x200e48 0 .rela.plt gets
- R_X86_64_JMP_SLOT 0x200e50 0 .rela.plt tolower
- R_X86_64_JMP_SLOT 0x200e58 0 .rela.plt acos
+ R_X86_64_JUMP_SLOT 0x200e18 0 .rela.plt printf
+ R_X86_64_JUMP_SLOT 0x200e20 0 .rela.plt puts
+ R_X86_64_JUMP_SLOT 0x200e28 0 .rela.plt toupper
+ R_X86_64_JUMP_SLOT 0x200e30 0 .rela.plt cos
+ R_X86_64_JUMP_SLOT 0x200e38 0 .rela.plt cosh
+ R_X86_64_JUMP_SLOT 0x200e40 0 .rela.plt __cxa_finalize
+ R_X86_64_JUMP_SLOT 0x200e48 0 .rela.plt gets
+ R_X86_64_JUMP_SLOT 0x200e50 0 .rela.plt tolower
+ R_X86_64_JUMP_SLOT 0x200e58 0 .rela.plt acos
diff --git a/test/elfdump/ts/dso2/@e%test.so.out b/test/elfdump/ts/dso2/@e%test.so.out
index 427aef9d2bb5..c3aef5226ed8 100644
--- a/test/elfdump/ts/dso2/@e%test.so.out
+++ b/test/elfdump/ts/dso2/@e%test.so.out
@@ -1,7 +1,7 @@
elf header:
- e_ident: ELFCLASS64 ELFDATA2LSB ELFOSABI_SYSV
+ e_ident: ELFCLASS64 ELFDATA2LSB ELFOSABI_NONE
e_type: ET_DYN
e_machine: EM_X86_64
e_version: EV_CURRENT
diff --git a/test/elfdump/ts/dso2/@e@i%test.so.out b/test/elfdump/ts/dso2/@e@i%test.so.out
index 427aef9d2bb5..c3aef5226ed8 100644
--- a/test/elfdump/ts/dso2/@e@i%test.so.out
+++ b/test/elfdump/ts/dso2/@e@i%test.so.out
@@ -1,7 +1,7 @@
elf header:
- e_ident: ELFCLASS64 ELFDATA2LSB ELFOSABI_SYSV
+ e_ident: ELFCLASS64 ELFDATA2LSB ELFOSABI_NONE
e_type: ET_DYN
e_machine: EM_X86_64
e_version: EV_CURRENT
diff --git a/test/elfdump/ts/dso2/@e@p@c%test.so.out b/test/elfdump/ts/dso2/@e@p@c%test.so.out
index 370dced8b06f..f696e7941cb2 100644
--- a/test/elfdump/ts/dso2/@e@p@c%test.so.out
+++ b/test/elfdump/ts/dso2/@e@p@c%test.so.out
@@ -1,7 +1,7 @@
elf header:
- e_ident: ELFCLASS64 ELFDATA2LSB ELFOSABI_SYSV
+ e_ident: ELFCLASS64 ELFDATA2LSB ELFOSABI_NONE
e_type: ET_DYN
e_machine: EM_X86_64
e_version: EV_CURRENT
diff --git a/test/elfdump/ts/exec1/@G%ls.out b/test/elfdump/ts/exec1/@G%ls.out
index 8470efe18be6..1e54cd826d2b 100644
--- a/test/elfdump/ts/exec1/@G%ls.out
+++ b/test/elfdump/ts/exec1/@G%ls.out
@@ -1,5 +1,5 @@
-global offset table:
+global offset table: .got
entry: 0
0x506708
diff --git a/test/elfdump/ts/exec1/@G@e%ls.out b/test/elfdump/ts/exec1/@G@e%ls.out
index a58bacfeb761..6080ed8bcbb9 100644
--- a/test/elfdump/ts/exec1/@G@e%ls.out
+++ b/test/elfdump/ts/exec1/@G@e%ls.out
@@ -16,7 +16,7 @@ elf header:
e_shnum: 26
e_shstrndx: 25
-global offset table:
+global offset table: .got
entry: 0
0x506708
diff --git a/test/elfdump/ts/exec1/@S@G%ls.out b/test/elfdump/ts/exec1/@S@G%ls.out
index 07560abcdcb4..a4aa058faf5a 100644
--- a/test/elfdump/ts/exec1/@S@G%ls.out
+++ b/test/elfdump/ts/exec1/@S@G%ls.out
@@ -4,73 +4,73 @@ Global Offset Table Section: .got (73 entries)
[00000] 00000000005068e0 0000000000506708 R_X86_64_NONE 000000000000
[00001] 00000000005068e8 0000000000000000 R_X86_64_NONE 000000000000
[00002] 00000000005068f0 0000000000000000 R_X86_64_NONE 000000000000
-[00003] 00000000005068f8 0000000000401862 R_X86_64_JMP_SLOT 000000000000 fflagstostr
-[00004] 0000000000506900 0000000000401872 R_X86_64_JMP_SLOT 000000000000 puts
-[00005] 0000000000506908 0000000000401882 R_X86_64_JMP_SLOT 000000000000 fprintf
-[00006] 0000000000506910 0000000000401892 R_X86_64_JMP_SLOT 000000000000 atoi
-[00007] 0000000000506918 00000000004018a2 R_X86_64_JMP_SLOT 000000000000 time
-[00008] 0000000000506920 00000000004018b2 R_X86_64_JMP_SLOT 000000000000 mbrtowc
-[00009] 0000000000506928 00000000004018c2 R_X86_64_JMP_SLOT 000000000000 write
-[00010] 0000000000506930 00000000004018d2 R_X86_64_JMP_SLOT 000000000000 fputc
-[00011] 0000000000506938 00000000004018e2 R_X86_64_JMP_SLOT 000000000000 getenv
-[00012] 0000000000506940 00000000004018f2 R_X86_64_JMP_SLOT 000000000000 kill
-[00013] 0000000000506948 0000000000401902 R_X86_64_JMP_SLOT 000000000000 humanize_number
-[00014] 0000000000506950 0000000000401912 R_X86_64_JMP_SLOT 000000000000 tgoto
-[00015] 0000000000506958 0000000000401922 R_X86_64_JMP_SLOT 000000000000 putc
-[00016] 0000000000506960 0000000000401932 R_X86_64_JMP_SLOT 000000000000 strdup
-[00017] 0000000000506968 0000000000401942 R_X86_64_JMP_SLOT 000000000000 mac_get_link
-[00018] 0000000000506970 0000000000401952 R_X86_64_JMP_SLOT 000000000000 fputs
-[00019] 0000000000506978 0000000000401962 R_X86_64_JMP_SLOT 000000000000 ___runetype
-[00020] 0000000000506980 0000000000401972 R_X86_64_JMP_SLOT 000000000000 mac_prepare_file_label
-[00021] 0000000000506988 0000000000401982 R_X86_64_JMP_SLOT 000000000000 mac_to_text
-[00022] 0000000000506990 0000000000401992 R_X86_64_JMP_SLOT 000000000000 ioctl
-[00023] 0000000000506998 00000000004019a2 R_X86_64_JMP_SLOT 000000000000 group_from_gid
-[00024] 00000000005069a0 00000000004019b2 R_X86_64_JMP_SLOT 000000000000 strftime
-[00025] 00000000005069a8 00000000004019c2 R_X86_64_JMP_SLOT 000000000000 strerror
-[00026] 00000000005069b0 00000000004019d2 R_X86_64_JMP_SLOT 000000000000 _init_tls
-[00027] 00000000005069b8 00000000004019e2 R_X86_64_JMP_SLOT 000000000000 realloc
-[00028] 00000000005069c0 00000000004019f2 R_X86_64_JMP_SLOT 000000000000 localtime
-[00029] 00000000005069c8 0000000000401a02 R_X86_64_JMP_SLOT 000000000000 mac_free
-[00030] 00000000005069d0 0000000000401a12 R_X86_64_JMP_SLOT 000000000000 acl_get_entry
-[00031] 00000000005069d8 0000000000401a22 R_X86_64_JMP_SLOT 000000000000 fts_set
-[00032] 00000000005069e0 0000000000401a32 R_X86_64_JMP_SLOT 000000000000 strchr
-[00033] 00000000005069e8 0000000000401a42 R_X86_64_JMP_SLOT 000000000000 strcoll
-[00034] 00000000005069f0 0000000000401a52 R_X86_64_JMP_SLOT 000000000000 getopt
-[00035] 00000000005069f8 0000000000401a62 R_X86_64_JMP_SLOT 000000000000 strmode
-[00036] 0000000000506a00 0000000000401a72 R_X86_64_JMP_SLOT 000000000000 warnx
-[00037] 0000000000506a08 0000000000401a82 R_X86_64_JMP_SLOT 000000000000 tputs
-[00038] 0000000000506a10 0000000000401a92 R_X86_64_JMP_SLOT 000000000000 sscanf
-[00039] 0000000000506a18 0000000000401aa2 R_X86_64_JMP_SLOT 000000000000 memset
-[00040] 0000000000506a20 0000000000401ab2 R_X86_64_JMP_SLOT 000000000000 __error
-[00041] 0000000000506a28 0000000000401ac2 R_X86_64_JMP_SLOT 000000000000 pathconf
-[00042] 0000000000506a30 0000000000401ad2 R_X86_64_JMP_SLOT 000000000000 fts_children
-[00043] 0000000000506a38 0000000000401ae2 R_X86_64_JMP_SLOT 000000000000 printf
-[00044] 0000000000506a40 0000000000401af2 R_X86_64_JMP_SLOT 000000000000 user_from_uid
-[00045] 0000000000506a48 0000000000401b02 R_X86_64_JMP_SLOT 000000000000 snprintf
-[00046] 0000000000506a50 0000000000401b12 R_X86_64_JMP_SLOT 000000000000 warn
-[00047] 0000000000506a58 0000000000401b22 R_X86_64_JMP_SLOT 000000000000 tgetent
-[00048] 0000000000506a60 0000000000401b32 R_X86_64_JMP_SLOT 000000000000 signal
-[00049] 0000000000506a68 0000000000401b42 R_X86_64_JMP_SLOT 000000000000 fts_read
-[00050] 0000000000506a70 0000000000401b52 R_X86_64_JMP_SLOT 000000000000 nl_langinfo
-[00051] 0000000000506a78 0000000000401b62 R_X86_64_JMP_SLOT 000000000000 setenv
-[00052] 0000000000506a80 0000000000401b72 R_X86_64_JMP_SLOT 000000000000 fwrite
-[00053] 0000000000506a88 0000000000401b82 R_X86_64_JMP_SLOT 000000000000 fts_open
-[00054] 0000000000506a90 0000000000401b92 R_X86_64_JMP_SLOT 000000000000 getbsize
-[00055] 0000000000506a98 0000000000401ba2 R_X86_64_JMP_SLOT 000000000000 __swbuf
-[00056] 0000000000506aa0 0000000000401bb2 R_X86_64_JMP_SLOT 000000000000 exit
-[00057] 0000000000506aa8 0000000000401bc2 R_X86_64_JMP_SLOT 000000000000 malloc
-[00058] 0000000000506ab0 0000000000401bd2 R_X86_64_JMP_SLOT 000000000000 mac_get_file
-[00059] 0000000000506ab8 0000000000401be2 R_X86_64_JMP_SLOT 000000000000 err
-[00060] 0000000000506ac0 0000000000401bf2 R_X86_64_JMP_SLOT 000000000000 isatty
-[00061] 0000000000506ac8 0000000000401c02 R_X86_64_JMP_SLOT 000000000000 setlocale
-[00062] 0000000000506ad0 0000000000401c12 R_X86_64_JMP_SLOT 000000000000 free
-[00063] 0000000000506ad8 0000000000401c22 R_X86_64_JMP_SLOT 000000000000 getuid
-[00064] 0000000000506ae0 0000000000401c32 R_X86_64_JMP_SLOT 000000000000 __stack_chk_fail
-[00065] 0000000000506ae8 0000000000401c42 R_X86_64_JMP_SLOT 000000000000 atexit
-[00066] 0000000000506af0 0000000000401c52 R_X86_64_JMP_SLOT 000000000000 acl_free
-[00067] 0000000000506af8 0000000000401c62 R_X86_64_JMP_SLOT 000000000000 getpid
-[00068] 0000000000506b00 0000000000401c72 R_X86_64_JMP_SLOT 000000000000 strlen
-[00069] 0000000000506b08 0000000000401c82 R_X86_64_JMP_SLOT 000000000000 strcpy
-[00070] 0000000000506b10 0000000000401c92 R_X86_64_JMP_SLOT 000000000000 readlink
-[00071] 0000000000506b18 0000000000401ca2 R_X86_64_JMP_SLOT 000000000000 tgetstr
-[00072] 0000000000506b20 0000000000401cb2 R_X86_64_JMP_SLOT 000000000000 acl_get_file
+[00003] 00000000005068f8 0000000000401862 R_X86_64_JUMP_SLOT 000000000000 fflagstostr
+[00004] 0000000000506900 0000000000401872 R_X86_64_JUMP_SLOT 000000000000 puts
+[00005] 0000000000506908 0000000000401882 R_X86_64_JUMP_SLOT 000000000000 fprintf
+[00006] 0000000000506910 0000000000401892 R_X86_64_JUMP_SLOT 000000000000 atoi
+[00007] 0000000000506918 00000000004018a2 R_X86_64_JUMP_SLOT 000000000000 time
+[00008] 0000000000506920 00000000004018b2 R_X86_64_JUMP_SLOT 000000000000 mbrtowc
+[00009] 0000000000506928 00000000004018c2 R_X86_64_JUMP_SLOT 000000000000 write
+[00010] 0000000000506930 00000000004018d2 R_X86_64_JUMP_SLOT 000000000000 fputc
+[00011] 0000000000506938 00000000004018e2 R_X86_64_JUMP_SLOT 000000000000 getenv
+[00012] 0000000000506940 00000000004018f2 R_X86_64_JUMP_SLOT 000000000000 kill
+[00013] 0000000000506948 0000000000401902 R_X86_64_JUMP_SLOT 000000000000 humanize_number
+[00014] 0000000000506950 0000000000401912 R_X86_64_JUMP_SLOT 000000000000 tgoto
+[00015] 0000000000506958 0000000000401922 R_X86_64_JUMP_SLOT 000000000000 putc
+[00016] 0000000000506960 0000000000401932 R_X86_64_JUMP_SLOT 000000000000 strdup
+[00017] 0000000000506968 0000000000401942 R_X86_64_JUMP_SLOT 000000000000 mac_get_link
+[00018] 0000000000506970 0000000000401952 R_X86_64_JUMP_SLOT 000000000000 fputs
+[00019] 0000000000506978 0000000000401962 R_X86_64_JUMP_SLOT 000000000000 ___runetype
+[00020] 0000000000506980 0000000000401972 R_X86_64_JUMP_SLOT 000000000000 mac_prepare_file_label
+[00021] 0000000000506988 0000000000401982 R_X86_64_JUMP_SLOT 000000000000 mac_to_text
+[00022] 0000000000506990 0000000000401992 R_X86_64_JUMP_SLOT 000000000000 ioctl
+[00023] 0000000000506998 00000000004019a2 R_X86_64_JUMP_SLOT 000000000000 group_from_gid
+[00024] 00000000005069a0 00000000004019b2 R_X86_64_JUMP_SLOT 000000000000 strftime
+[00025] 00000000005069a8 00000000004019c2 R_X86_64_JUMP_SLOT 000000000000 strerror
+[00026] 00000000005069b0 00000000004019d2 R_X86_64_JUMP_SLOT 000000000000 _init_tls
+[00027] 00000000005069b8 00000000004019e2 R_X86_64_JUMP_SLOT 000000000000 realloc
+[00028] 00000000005069c0 00000000004019f2 R_X86_64_JUMP_SLOT 000000000000 localtime
+[00029] 00000000005069c8 0000000000401a02 R_X86_64_JUMP_SLOT 000000000000 mac_free
+[00030] 00000000005069d0 0000000000401a12 R_X86_64_JUMP_SLOT 000000000000 acl_get_entry
+[00031] 00000000005069d8 0000000000401a22 R_X86_64_JUMP_SLOT 000000000000 fts_set
+[00032] 00000000005069e0 0000000000401a32 R_X86_64_JUMP_SLOT 000000000000 strchr
+[00033] 00000000005069e8 0000000000401a42 R_X86_64_JUMP_SLOT 000000000000 strcoll
+[00034] 00000000005069f0 0000000000401a52 R_X86_64_JUMP_SLOT 000000000000 getopt
+[00035] 00000000005069f8 0000000000401a62 R_X86_64_JUMP_SLOT 000000000000 strmode
+[00036] 0000000000506a00 0000000000401a72 R_X86_64_JUMP_SLOT 000000000000 warnx
+[00037] 0000000000506a08 0000000000401a82 R_X86_64_JUMP_SLOT 000000000000 tputs
+[00038] 0000000000506a10 0000000000401a92 R_X86_64_JUMP_SLOT 000000000000 sscanf
+[00039] 0000000000506a18 0000000000401aa2 R_X86_64_JUMP_SLOT 000000000000 memset
+[00040] 0000000000506a20 0000000000401ab2 R_X86_64_JUMP_SLOT 000000000000 __error
+[00041] 0000000000506a28 0000000000401ac2 R_X86_64_JUMP_SLOT 000000000000 pathconf
+[00042] 0000000000506a30 0000000000401ad2 R_X86_64_JUMP_SLOT 000000000000 fts_children
+[00043] 0000000000506a38 0000000000401ae2 R_X86_64_JUMP_SLOT 000000000000 printf
+[00044] 0000000000506a40 0000000000401af2 R_X86_64_JUMP_SLOT 000000000000 user_from_uid
+[00045] 0000000000506a48 0000000000401b02 R_X86_64_JUMP_SLOT 000000000000 snprintf
+[00046] 0000000000506a50 0000000000401b12 R_X86_64_JUMP_SLOT 000000000000 warn
+[00047] 0000000000506a58 0000000000401b22 R_X86_64_JUMP_SLOT 000000000000 tgetent
+[00048] 0000000000506a60 0000000000401b32 R_X86_64_JUMP_SLOT 000000000000 signal
+[00049] 0000000000506a68 0000000000401b42 R_X86_64_JUMP_SLOT 000000000000 fts_read
+[00050] 0000000000506a70 0000000000401b52 R_X86_64_JUMP_SLOT 000000000000 nl_langinfo
+[00051] 0000000000506a78 0000000000401b62 R_X86_64_JUMP_SLOT 000000000000 setenv
+[00052] 0000000000506a80 0000000000401b72 R_X86_64_JUMP_SLOT 000000000000 fwrite
+[00053] 0000000000506a88 0000000000401b82 R_X86_64_JUMP_SLOT 000000000000 fts_open
+[00054] 0000000000506a90 0000000000401b92 R_X86_64_JUMP_SLOT 000000000000 getbsize
+[00055] 0000000000506a98 0000000000401ba2 R_X86_64_JUMP_SLOT 000000000000 __swbuf
+[00056] 0000000000506aa0 0000000000401bb2 R_X86_64_JUMP_SLOT 000000000000 exit
+[00057] 0000000000506aa8 0000000000401bc2 R_X86_64_JUMP_SLOT 000000000000 malloc
+[00058] 0000000000506ab0 0000000000401bd2 R_X86_64_JUMP_SLOT 000000000000 mac_get_file
+[00059] 0000000000506ab8 0000000000401be2 R_X86_64_JUMP_SLOT 000000000000 err
+[00060] 0000000000506ac0 0000000000401bf2 R_X86_64_JUMP_SLOT 000000000000 isatty
+[00061] 0000000000506ac8 0000000000401c02 R_X86_64_JUMP_SLOT 000000000000 setlocale
+[00062] 0000000000506ad0 0000000000401c12 R_X86_64_JUMP_SLOT 000000000000 free
+[00063] 0000000000506ad8 0000000000401c22 R_X86_64_JUMP_SLOT 000000000000 getuid
+[00064] 0000000000506ae0 0000000000401c32 R_X86_64_JUMP_SLOT 000000000000 __stack_chk_fail
+[00065] 0000000000506ae8 0000000000401c42 R_X86_64_JUMP_SLOT 000000000000 atexit
+[00066] 0000000000506af0 0000000000401c52 R_X86_64_JUMP_SLOT 000000000000 acl_free
+[00067] 0000000000506af8 0000000000401c62 R_X86_64_JUMP_SLOT 000000000000 getpid
+[00068] 0000000000506b00 0000000000401c72 R_X86_64_JUMP_SLOT 000000000000 strlen
+[00069] 0000000000506b08 0000000000401c82 R_X86_64_JUMP_SLOT 000000000000 strcpy
+[00070] 0000000000506b10 0000000000401c92 R_X86_64_JUMP_SLOT 000000000000 readlink
+[00071] 0000000000506b18 0000000000401ca2 R_X86_64_JUMP_SLOT 000000000000 tgetstr
+[00072] 0000000000506b20 0000000000401cb2 R_X86_64_JUMP_SLOT 000000000000 acl_get_file
diff --git a/test/elfdump/ts/exec1/@S@r%ls.out b/test/elfdump/ts/exec1/@S@r%ls.out
index 7bfc084aa140..e0a4b2a44d27 100644
--- a/test/elfdump/ts/exec1/@S@r%ls.out
+++ b/test/elfdump/ts/exec1/@S@r%ls.out
@@ -12,73 +12,73 @@ Relocation Section: .rela.dyn
Relocation Section: .rela.plt
type offset addend section with respect to
- R_X86_64_JMP_SLOT 0x5068f8 0 .rela.plt fflagstostr
- R_X86_64_JMP_SLOT 0x506900 0 .rela.plt puts
- R_X86_64_JMP_SLOT 0x506908 0 .rela.plt fprintf
- R_X86_64_JMP_SLOT 0x506910 0 .rela.plt atoi
- R_X86_64_JMP_SLOT 0x506918 0 .rela.plt time
- R_X86_64_JMP_SLOT 0x506920 0 .rela.plt mbrtowc
- R_X86_64_JMP_SLOT 0x506928 0 .rela.plt write
- R_X86_64_JMP_SLOT 0x506930 0 .rela.plt fputc
- R_X86_64_JMP_SLOT 0x506938 0 .rela.plt getenv
- R_X86_64_JMP_SLOT 0x506940 0 .rela.plt kill
- R_X86_64_JMP_SLOT 0x506948 0 .rela.plt humanize_number
- R_X86_64_JMP_SLOT 0x506950 0 .rela.plt tgoto
- R_X86_64_JMP_SLOT 0x506958 0 .rela.plt putc
- R_X86_64_JMP_SLOT 0x506960 0 .rela.plt strdup
- R_X86_64_JMP_SLOT 0x506968 0 .rela.plt mac_get_link
- R_X86_64_JMP_SLOT 0x506970 0 .rela.plt fputs
- R_X86_64_JMP_SLOT 0x506978 0 .rela.plt ___runetype
- R_X86_64_JMP_SLOT 0x506980 0 .rela.plt mac_prepare_file_label
- R_X86_64_JMP_SLOT 0x506988 0 .rela.plt mac_to_text
- R_X86_64_JMP_SLOT 0x506990 0 .rela.plt ioctl
- R_X86_64_JMP_SLOT 0x506998 0 .rela.plt group_from_gid
- R_X86_64_JMP_SLOT 0x5069a0 0 .rela.plt strftime
- R_X86_64_JMP_SLOT 0x5069a8 0 .rela.plt strerror
- R_X86_64_JMP_SLOT 0x5069b0 0 .rela.plt _init_tls
- R_X86_64_JMP_SLOT 0x5069b8 0 .rela.plt realloc
- R_X86_64_JMP_SLOT 0x5069c0 0 .rela.plt localtime
- R_X86_64_JMP_SLOT 0x5069c8 0 .rela.plt mac_free
- R_X86_64_JMP_SLOT 0x5069d0 0 .rela.plt acl_get_entry
- R_X86_64_JMP_SLOT 0x5069d8 0 .rela.plt fts_set
- R_X86_64_JMP_SLOT 0x5069e0 0 .rela.plt strchr
- R_X86_64_JMP_SLOT 0x5069e8 0 .rela.plt strcoll
- R_X86_64_JMP_SLOT 0x5069f0 0 .rela.plt getopt
- R_X86_64_JMP_SLOT 0x5069f8 0 .rela.plt strmode
- R_X86_64_JMP_SLOT 0x506a00 0 .rela.plt warnx
- R_X86_64_JMP_SLOT 0x506a08 0 .rela.plt tputs
- R_X86_64_JMP_SLOT 0x506a10 0 .rela.plt sscanf
- R_X86_64_JMP_SLOT 0x506a18 0 .rela.plt memset
- R_X86_64_JMP_SLOT 0x506a20 0 .rela.plt __error
- R_X86_64_JMP_SLOT 0x506a28 0 .rela.plt pathconf
- R_X86_64_JMP_SLOT 0x506a30 0 .rela.plt fts_children
- R_X86_64_JMP_SLOT 0x506a38 0 .rela.plt printf
- R_X86_64_JMP_SLOT 0x506a40 0 .rela.plt user_from_uid
- R_X86_64_JMP_SLOT 0x506a48 0 .rela.plt snprintf
- R_X86_64_JMP_SLOT 0x506a50 0 .rela.plt warn
- R_X86_64_JMP_SLOT 0x506a58 0 .rela.plt tgetent
- R_X86_64_JMP_SLOT 0x506a60 0 .rela.plt signal
- R_X86_64_JMP_SLOT 0x506a68 0 .rela.plt fts_read
- R_X86_64_JMP_SLOT 0x506a70 0 .rela.plt nl_langinfo
- R_X86_64_JMP_SLOT 0x506a78 0 .rela.plt setenv
- R_X86_64_JMP_SLOT 0x506a80 0 .rela.plt fwrite
- R_X86_64_JMP_SLOT 0x506a88 0 .rela.plt fts_open
- R_X86_64_JMP_SLOT 0x506a90 0 .rela.plt getbsize
- R_X86_64_JMP_SLOT 0x506a98 0 .rela.plt __swbuf
- R_X86_64_JMP_SLOT 0x506aa0 0 .rela.plt exit
- R_X86_64_JMP_SLOT 0x506aa8 0 .rela.plt malloc
- R_X86_64_JMP_SLOT 0x506ab0 0 .rela.plt mac_get_file
- R_X86_64_JMP_SLOT 0x506ab8 0 .rela.plt err
- R_X86_64_JMP_SLOT 0x506ac0 0 .rela.plt isatty
- R_X86_64_JMP_SLOT 0x506ac8 0 .rela.plt setlocale
- R_X86_64_JMP_SLOT 0x506ad0 0 .rela.plt free
- R_X86_64_JMP_SLOT 0x506ad8 0 .rela.plt getuid
- R_X86_64_JMP_SLOT 0x506ae0 0 .rela.plt __stack_chk_fail
- R_X86_64_JMP_SLOT 0x506ae8 0 .rela.plt atexit
- R_X86_64_JMP_SLOT 0x506af0 0 .rela.plt acl_free
- R_X86_64_JMP_SLOT 0x506af8 0 .rela.plt getpid
- R_X86_64_JMP_SLOT 0x506b00 0 .rela.plt strlen
- R_X86_64_JMP_SLOT 0x506b08 0 .rela.plt strcpy
- R_X86_64_JMP_SLOT 0x506b10 0 .rela.plt readlink
- R_X86_64_JMP_SLOT 0x506b18 0 .rela.plt tgetstr
- R_X86_64_JMP_SLOT 0x506b20 0 .rela.plt acl_get_file
+ R_X86_64_JUMP_SLOT 0x5068f8 0 .rela.plt fflagstostr
+ R_X86_64_JUMP_SLOT 0x506900 0 .rela.plt puts
+ R_X86_64_JUMP_SLOT 0x506908 0 .rela.plt fprintf
+ R_X86_64_JUMP_SLOT 0x506910 0 .rela.plt atoi
+ R_X86_64_JUMP_SLOT 0x506918 0 .rela.plt time
+ R_X86_64_JUMP_SLOT 0x506920 0 .rela.plt mbrtowc
+ R_X86_64_JUMP_SLOT 0x506928 0 .rela.plt write
+ R_X86_64_JUMP_SLOT 0x506930 0 .rela.plt fputc
+ R_X86_64_JUMP_SLOT 0x506938 0 .rela.plt getenv
+ R_X86_64_JUMP_SLOT 0x506940 0 .rela.plt kill
+ R_X86_64_JUMP_SLOT 0x506948 0 .rela.plt humanize_number
+ R_X86_64_JUMP_SLOT 0x506950 0 .rela.plt tgoto
+ R_X86_64_JUMP_SLOT 0x506958 0 .rela.plt putc
+ R_X86_64_JUMP_SLOT 0x506960 0 .rela.plt strdup
+ R_X86_64_JUMP_SLOT 0x506968 0 .rela.plt mac_get_link
+ R_X86_64_JUMP_SLOT 0x506970 0 .rela.plt fputs
+ R_X86_64_JUMP_SLOT 0x506978 0 .rela.plt ___runetype
+ R_X86_64_JUMP_SLOT 0x506980 0 .rela.plt mac_prepare_file_label
+ R_X86_64_JUMP_SLOT 0x506988 0 .rela.plt mac_to_text
+ R_X86_64_JUMP_SLOT 0x506990 0 .rela.plt ioctl
+ R_X86_64_JUMP_SLOT 0x506998 0 .rela.plt group_from_gid
+ R_X86_64_JUMP_SLOT 0x5069a0 0 .rela.plt strftime
+ R_X86_64_JUMP_SLOT 0x5069a8 0 .rela.plt strerror
+ R_X86_64_JUMP_SLOT 0x5069b0 0 .rela.plt _init_tls
+ R_X86_64_JUMP_SLOT 0x5069b8 0 .rela.plt realloc
+ R_X86_64_JUMP_SLOT 0x5069c0 0 .rela.plt localtime
+ R_X86_64_JUMP_SLOT 0x5069c8 0 .rela.plt mac_free
+ R_X86_64_JUMP_SLOT 0x5069d0 0 .rela.plt acl_get_entry
+ R_X86_64_JUMP_SLOT 0x5069d8 0 .rela.plt fts_set
+ R_X86_64_JUMP_SLOT 0x5069e0 0 .rela.plt strchr
+ R_X86_64_JUMP_SLOT 0x5069e8 0 .rela.plt strcoll
+ R_X86_64_JUMP_SLOT 0x5069f0 0 .rela.plt getopt
+ R_X86_64_JUMP_SLOT 0x5069f8 0 .rela.plt strmode
+ R_X86_64_JUMP_SLOT 0x506a00 0 .rela.plt warnx
+ R_X86_64_JUMP_SLOT 0x506a08 0 .rela.plt tputs
+ R_X86_64_JUMP_SLOT 0x506a10 0 .rela.plt sscanf
+ R_X86_64_JUMP_SLOT 0x506a18 0 .rela.plt memset
+ R_X86_64_JUMP_SLOT 0x506a20 0 .rela.plt __error
+ R_X86_64_JUMP_SLOT 0x506a28 0 .rela.plt pathconf
+ R_X86_64_JUMP_SLOT 0x506a30 0 .rela.plt fts_children
+ R_X86_64_JUMP_SLOT 0x506a38 0 .rela.plt printf
+ R_X86_64_JUMP_SLOT 0x506a40 0 .rela.plt user_from_uid
+ R_X86_64_JUMP_SLOT 0x506a48 0 .rela.plt snprintf
+ R_X86_64_JUMP_SLOT 0x506a50 0 .rela.plt warn
+ R_X86_64_JUMP_SLOT 0x506a58 0 .rela.plt tgetent
+ R_X86_64_JUMP_SLOT 0x506a60 0 .rela.plt signal
+ R_X86_64_JUMP_SLOT 0x506a68 0 .rela.plt fts_read
+ R_X86_64_JUMP_SLOT 0x506a70 0 .rela.plt nl_langinfo
+ R_X86_64_JUMP_SLOT 0x506a78 0 .rela.plt setenv
+ R_X86_64_JUMP_SLOT 0x506a80 0 .rela.plt fwrite
+ R_X86_64_JUMP_SLOT 0x506a88 0 .rela.plt fts_open
+ R_X86_64_JUMP_SLOT 0x506a90 0 .rela.plt getbsize
+ R_X86_64_JUMP_SLOT 0x506a98 0 .rela.plt __swbuf
+ R_X86_64_JUMP_SLOT 0x506aa0 0 .rela.plt exit
+ R_X86_64_JUMP_SLOT 0x506aa8 0 .rela.plt malloc
+ R_X86_64_JUMP_SLOT 0x506ab0 0 .rela.plt mac_get_file
+ R_X86_64_JUMP_SLOT 0x506ab8 0 .rela.plt err
+ R_X86_64_JUMP_SLOT 0x506ac0 0 .rela.plt isatty
+ R_X86_64_JUMP_SLOT 0x506ac8 0 .rela.plt setlocale
+ R_X86_64_JUMP_SLOT 0x506ad0 0 .rela.plt free
+ R_X86_64_JUMP_SLOT 0x506ad8 0