Use correct type for phdr addresses.

This commit is contained in:
Bartosz Taudul
2026-07-07 17:54:03 +02:00
parent 6495aab062
commit e842bf223f

View File

@@ -7472,14 +7472,14 @@ phdr_callback_mock (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED,
// calculate the end address as well, so we can quickly determine if a PC is within the range of this image
// headers aren't guaranteed to be in address order; find the max
ptr->dlpi_end_addr = uintptr_t(info->dlpi_addr);
ptr->dlpi_end_addr = ElfW(Addr)(info->dlpi_addr);
for (uint32_t i = 0; i < info->dlpi_phnum; i++)
{
const auto &phdr = info->dlpi_phdr[i];
if (phdr.p_type != PT_LOAD)
continue;
const auto phdr_end = uintptr_t(info->dlpi_addr + phdr.p_vaddr + phdr.p_memsz);
const auto phdr_end = ElfW(Addr)(info->dlpi_addr + phdr.p_vaddr + phdr.p_memsz);
ptr->dlpi_end_addr = std::max(phdr_end, ptr->dlpi_end_addr);
}