Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Feb 2016 14:03:25 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r295661 - head/contrib/elftoolchain/elfcopy
Message-ID:  <201602161403.u1GE3Pig020404@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Tue Feb 16 14:03:25 2016
New Revision: 295661
URL: https://svnweb.freebsd.org/changeset/base/295661

Log:
  Allow elfcopy to convert between two non-ELF formats
  
  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.
  
  ELF Tool Chain ticket #517
  
  Reviewed by:	kai
  Obtained from:	ELF Tool Chain r3411

Modified:
  head/contrib/elftoolchain/elfcopy/main.c

Modified: head/contrib/elftoolchain/elfcopy/main.c
==============================================================================
--- head/contrib/elftoolchain/elfcopy/main.c	Tue Feb 16 13:40:23 2016	(r295660)
+++ head/contrib/elftoolchain/elfcopy/main.c	Tue Feb 16 14:03:25 2016	(r295661)
@@ -641,6 +641,18 @@ create_file(struct elfcopy *ecp, const c
 	 * ELF object before processing.
 	 */
 	if (ecp->itf != ETF_ELF) {
+		/*
+		 * If the output object is not an ELF file, choose an arbitrary
+		 * ELF format for the intermediate file. srec, ihex and binary
+		 * formats are independent of class, endianness and machine
+		 * type so these choices do not affect the output.
+		 */
+		if (ecp->otf != ETF_ELF) {
+			if (ecp->oec == ELFCLASSNONE)
+				ecp->oec = ELFCLASS64;
+			if (ecp->oed == ELFDATANONE)
+				ecp->oed = ELFDATA2LSB;
+		}
 		create_tempfile(&elftemp, &efd);
 		if ((ecp->eout = elf_begin(efd, ELF_C_WRITE, NULL)) == NULL)
 			errx(EXIT_FAILURE, "elf_begin() failed: %s",



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602161403.u1GE3Pig020404>