summaryrefslogtreecommitdiffstats
path: root/contrib/elftoolchain/elfcopy/main.c
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2016-02-12 20:54:02 +0000
committeremaste <emaste@FreeBSD.org>2016-02-12 20:54:02 +0000
commita6ae90983efabb9784f1e105ffb29eaec3c0573c (patch)
treecd8537a698afe8dd30dc9c4d04c193e5b3b2e94f /contrib/elftoolchain/elfcopy/main.c
parent0309ab8781484f9cf0561cbbc3cab6df7139d629 (diff)
parent85217dee0e24c5f3ac285420e843063b4b52c1a0 (diff)
downloadFreeBSD-src-a6ae90983efabb9784f1e105ffb29eaec3c0573c.zip
FreeBSD-src-a6ae90983efabb9784f1e105ffb29eaec3c0573c.tar.gz
Update ELF Tool Chain to upstream rev 3400
Some notable improvements include: readelf: - Add AArch64 relocation definitions. - Report value of unknown relocation types. elfcopy: - Consider symbols with STB_GNU_UNIQUE binding as global symbols. - Fixed support for VMA adjustment for loadable sections found in relocatable objects. - Handle nameless global symbols. - Improve wildcard matching for !-prefixed symbols. - Add PE/COFF support. elfdump: - Improve section type reporting. - Add MIPS-specific section types. This update also includes a significant number of bug fixes. PR: 207091 [exp-run] Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'contrib/elftoolchain/elfcopy/main.c')
-rw-r--r--contrib/elftoolchain/elfcopy/main.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/contrib/elftoolchain/elfcopy/main.c b/contrib/elftoolchain/elfcopy/main.c
index e2685b4..b51ba4e 100644
--- a/contrib/elftoolchain/elfcopy/main.c
+++ b/contrib/elftoolchain/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 3399 2016-02-12 18:07:56Z emaste $");
enum options
{
@@ -316,6 +316,7 @@ create_elf(struct elfcopy *ecp)
oeh.e_entry = ieh.e_entry;
oeh.e_version = ieh.e_version;
+ ecp->flags &= ~(EXECUTABLE | DYNAMIC | RELOCATABLE);
if (ieh.e_type == ET_EXEC)
ecp->flags |= EXECUTABLE;
else if (ieh.e_type == ET_DYN)
@@ -722,6 +723,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 +1355,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 +1379,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 +1395,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\
@@ -1471,6 +1486,7 @@ Usage: %s [options] file...\n\
Options:\n\
-d | -g | -S | --strip-debug Remove debugging symbols.\n\
-h | --help Print a help message.\n\
+ -o FILE | --output-file FILE Write output to FILE.\n\
--only-keep-debug Keep debugging information only.\n\
-p | --preserve-dates Preserve access and modification times.\n\
-s | --strip-all Remove all symbols.\n\
OpenPOWER on IntegriCloud