aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-02-21 13:49:26 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-02-21 13:49:26 +0000
commit9893f787ec755ffaa14c66fc74fc9e5f524e3301 (patch)
treebb5f550a5fd2ee1357495987f5076839273e5998 /contrib
parent90a472637517f21b8fd51c12f7b58da4acb804cb (diff)
parent1e1bbb79fd726164b79f1c060f6ebb10ca7277a2 (diff)
downloadsrc-9893f787ec755ffaa14c66fc74fc9e5f524e3301.tar.gz
src-9893f787ec755ffaa14c66fc74fc9e5f524e3301.zip
Merge ^/head r295601 through r295844.
Notes
Notes: svn path=/projects/clang380-import/; revision=295845
Diffstat (limited to 'contrib')
-rw-r--r--contrib/elftoolchain/elfcopy/main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/contrib/elftoolchain/elfcopy/main.c b/contrib/elftoolchain/elfcopy/main.c
index b51ba4e3ac38..31d34a8f1c3e 100644
--- a/contrib/elftoolchain/elfcopy/main.c
+++ b/contrib/elftoolchain/elfcopy/main.c
@@ -641,6 +641,18 @@ create_file(struct elfcopy *ecp, const char *src, const char *dst)
* ELF object before processing.
*/
if (ecp->itf != ETF_ELF) {
+ /*
+ * If the output object is not an ELF file, choose an arbitrary
+ * ELF format for the intermediate file. srec, ihex and binary
+ * formats are independent of class, endianness and machine
+ * type so these choices do not affect the output.
+ */
+ if (ecp->otf != ETF_ELF) {
+ if (ecp->oec == ELFCLASSNONE)
+ ecp->oec = ELFCLASS64;
+ if (ecp->oed == ELFDATANONE)
+ ecp->oed = ELFDATA2LSB;
+ }
create_tempfile(&elftemp, &efd);
if ((ecp->eout = elf_begin(efd, ELF_C_WRITE, NULL)) == NULL)
errx(EXIT_FAILURE, "elf_begin() failed: %s",