summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2012-03-22 17:44:36 +0000
committergonzo <gonzo@FreeBSD.org>2012-03-22 17:44:36 +0000
commitc3a5f91cea1e0760c22991398988d50ede2348db (patch)
treee6dc033590798bc686e8523e3a838fc8c71c1e22 /usr.sbin
parent81298371ecfad9427d91cc6b01813643e5540c82 (diff)
downloadFreeBSD-src-c3a5f91cea1e0760c22991398988d50ede2348db.zip
FreeBSD-src-c3a5f91cea1e0760c22991398988d50ede2348db.tar.gz
Fix base vaddr detection for ELF binaries. PT_LOAD with offset 0 is not
mandatory for ELF binaries so we'll use the segment with offset less then alignment and align it appropriately (which covers pt_offset == 0 case)
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pmcstat/pmcstat_log.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/pmcstat/pmcstat_log.c b/usr.sbin/pmcstat/pmcstat_log.c
index db526e3..41d9095 100644
--- a/usr.sbin/pmcstat/pmcstat_log.c
+++ b/usr.sbin/pmcstat/pmcstat_log.c
@@ -697,8 +697,8 @@ pmcstat_image_get_elf_params(struct pmcstat_image *image)
ph.p_offset);
break;
case PT_LOAD:
- if (ph.p_offset == 0)
- image->pi_vaddr = ph.p_vaddr;
+ if ((ph.p_offset & (-ph.p_align)) == 0)
+ image->pi_vaddr = ph.p_vaddr & (-ph.p_align);
break;
}
}
OpenPOWER on IntegriCloud