svn commit: r275810 - head/contrib/elftoolchain/elfcopy
Ed Maste
emaste at FreeBSD.org
Mon Dec 15 18:18:58 UTC 2014
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;
}
More information about the svn-src-head
mailing list