From 8f2be47403b0a66836973b4bfb129955668be271 Mon Sep 17 00:00:00 2001 From: lazerg Date: Fri, 27 Nov 2026 12:52:29 +0500 Subject: [PATCH] Fix GH-25742: huge_code_pages program section not found on musl Co-authored-by: Krzysztof Surdy <68391139+krzysztofsurdy@users.noreply.github.com> --- ext/opcache/ZendAccelerator.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 39ecd57d0461..4012b909db30 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -3236,9 +3236,14 @@ accel_remap_huge_pages(void *start, size_t size, size_t real_size) } static int accel_dl_iterate_phdr_callback(struct dl_phdr_info *info, size_t size, void *data) { - if (info->dlpi_name == NULL || strcmp(info->dlpi_name, "") == 0) { - *((uintptr_t*)data) = info->dlpi_addr; - return 1; + uintptr_t addr = (uintptr_t)accel_dl_iterate_phdr_callback; + for (ElfW(Half) idx = 0; idx < info->dlpi_phnum; idx++) { + const ElfW(Phdr) *phdr = &info->dlpi_phdr[idx]; + uintptr_t start = info->dlpi_addr + phdr->p_vaddr; + if (phdr->p_type == PT_LOAD && addr >= start && addr < start + phdr->p_memsz) { + *((uintptr_t*)data) = info->dlpi_addr; + return 1; + } } return 0; }