summaryrefslogtreecommitdiffstats
path: root/contrib/elftoolchain/elfcopy
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2014-12-15 18:18:57 +0000
committeremaste <emaste@FreeBSD.org>2014-12-15 18:18:57 +0000
commit50872743f93c1edaa918140eed44a7300d41beb8 (patch)
tree8f2868f6525916d5920d47b72dd956c7fdfc020e /contrib/elftoolchain/elfcopy
parent93ef12f5869abbc3948befe430bb97291c1b1379 (diff)
downloadFreeBSD-src-50872743f93c1edaa918140eed44a7300d41beb8.zip
FreeBSD-src-50872743f93c1edaa918140eed44a7300d41beb8.tar.gz
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
Diffstat (limited to 'contrib/elftoolchain/elfcopy')
-rw-r--r--contrib/elftoolchain/elfcopy/segments.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/elftoolchain/elfcopy/segments.c b/contrib/elftoolchain/elfcopy/segments.c
index 853c728..d358e5c 100644
--- a/contrib/elftoolchain/elfcopy/segments.c
+++ b/contrib/elftoolchain/elfcopy/segments.c
@@ -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;
}
OpenPOWER on IntegriCloud