Skip to content

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

Open
@jluysf

Description

@jluysf

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);

...

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions