Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jan 2018 00:27:02 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r327712 - stable/11/contrib/elftoolchain/elfcopy
Message-ID:  <201801090027.w090R2hm078210@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Tue Jan  9 00:27:02 2018
New Revision: 327712
URL: https://svnweb.freebsd.org/changeset/base/327712

Log:
  MFC r327489: elfcopy: copy raw (untranslated) contents to binary output
  
  Previously elfcopy used elf_getdata to obtain data from ELF sections
  being copied to binary output, but elf_getdata returns data that has
  been translated - that is, data is in host byte order. When the host and
  target differ in endianness (e.g., converting a big-endian MIPS ELF
  object to binary on an x86 host) this resulted in byte-swapped data in
  certain sections such as .dynamic.
  
  Instead use elf_rawdata to keep data in the original, target endianness.
  
  Reported by:	Hiroki Mori <yamori83@yahoo.co.jp>, Bill Yuan
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/11/contrib/elftoolchain/elfcopy/binary.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/elftoolchain/elfcopy/binary.c
==============================================================================
--- stable/11/contrib/elftoolchain/elfcopy/binary.c	Tue Jan  9 00:17:15 2018	(r327711)
+++ stable/11/contrib/elftoolchain/elfcopy/binary.c	Tue Jan  9 00:27:02 2018	(r327712)
@@ -101,10 +101,10 @@ create_binary(int ifd, int ofd)
 		    sh.sh_size == 0)
 			continue;
 		(void) elf_errno();
-		if ((d = elf_getdata(scn, NULL)) == NULL) {
+		if ((d = elf_rawdata(scn, NULL)) == NULL) {
 			elferr = elf_errno();
 			if (elferr != 0)
-				warnx("elf_getdata failed: %s", elf_errmsg(-1));
+				warnx("elf_rawdata failed: %s", elf_errmsg(-1));
 			continue;
 		}
 		if (d->d_buf == NULL || d->d_size == 0)



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