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)
This commit is contained in:
Oleksandr Tymoshenko 2012-03-22 17:44:36 +00:00
parent 2d57314a1b
commit a4b7818ee6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=233317

View File

@ -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;
}
}