Date: Mon, 15 Dec 2014 18:18:58 +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: r275810 - head/contrib/elftoolchain/elfcopy Message-ID: <201412151818.sBFIIwYM022999@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Mon Dec 15 18:18:57 2014 New Revision: 275810 URL: https://svnweb.freebsd.org/changeset/base/275810 Log: Correct elftoolchain strip(1) memory size calculation Calculate the segment's memory size (p_memsz) using the virtual addresses, not the file offsets. Otherwise padding preceeding SHT_NOBITS sections may be excluded from the calculation, resulting in a segment that is too small. PR: 195653 Sponsored by: The FreeBSD Foundation Modified: head/contrib/elftoolchain/elfcopy/segments.c Modified: head/contrib/elftoolchain/elfcopy/segments.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/segments.c Mon Dec 15 18:13:03 2014 (r275809) +++ head/contrib/elftoolchain/elfcopy/segments.c Mon Dec 15 18:18:57 2014 (r275810) @@ -439,7 +439,7 @@ copy_phdr(struct elfcopy *ecp) seg->fsz = seg->msz = 0; for (i = 0; i < seg->nsec; i++) { s = seg->v_sec[i]; - seg->msz = s->off + s->sz - seg->off; + seg->msz = s->vma + s->sz - seg->addr; if (s->type != SHT_NOBITS) seg->fsz = seg->msz; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412151818.sBFIIwYM022999>