X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fldso%2Fdl_iterate_phdr.c;h=86c87ef8358c86c78755409909baf63533cb0d4b;hb=4d706410779f399e5969439f6005abcee553b01d;hp=e55cbf765796457ab8da257c9e838ca5d9ff78f2;hpb=500f5bee6c03981961f1586fca2a1dee6fdce7c7;p=musl diff --git a/src/ldso/dl_iterate_phdr.c b/src/ldso/dl_iterate_phdr.c index e55cbf76..86c87ef8 100644 --- a/src/ldso/dl_iterate_phdr.c +++ b/src/ldso/dl_iterate_phdr.c @@ -4,6 +4,8 @@ #define AUX_CNT 38 +extern weak hidden const size_t _DYNAMIC[]; + static int static_dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size_t size, void *data), void *data) { unsigned char *p; @@ -20,6 +22,8 @@ static int static_dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size phdr = (void *)p; if (phdr->p_type == PT_PHDR) base = aux[AT_PHDR] - phdr->p_vaddr; + if (phdr->p_type == PT_DYNAMIC && _DYNAMIC) + base = (size_t)_DYNAMIC - phdr->p_vaddr; if (phdr->p_type == PT_TLS) tls_phdr = phdr; }