patchelf icon indicating copy to clipboard operation
patchelf copied to clipboard

Patchelf --add-needed fails on Android4.1。

Open jluysf opened this issue 9 years ago • 0 comments

Modified program header is stored at the end of elf files. But, linker of Android4.1 read program header at the first PAGE in elf.

code of linker~~~~~~~~:

static soinfo \* 
load_library(const char *name)
{
    ...

if ((cnt = read(fd, &__header[0], PAGE_SIZE)) < 0) {
    DL_ERR("read() failed!");
    goto fail;
}

...

if (load_segments(fd, &__header[0], si) < 0) {
    goto fail;
}

...

}

static int
load_segments(int fd, void *header, soinfo *si)
{
    Elf32_Ehdr *ehdr = (Elf32_Ehdr *)header;
    Elf32_Phdr *phdr = (Elf32_Phdr *)((unsigned char *)header + ehdr->e_phoff);

...

}

jluysf avatar Jan 14 '16 03:01 jluysf