Skip to content

When relocating do not lookup STB_LOCAL symbols by name #1065

@wkozaczuk

Description

@wkozaczuk

Some linkers (like gold) in certain scenarios generate ELF objects that end up with symbols with local binding (STB_LOCAL) that need to be relocated. The known concrete scenarios involve symbols of type STT_SECTION and STT_TLS which fail to get relocated by OSv linker as it attempts to look them up by name and they are not present in the relevant lookup tables or worse have an empty name. For more details please look these two discussions on the mailing list - STT_SECTION and STT_TLS and STT_TLS - look for gCurrentThreadInfo.

In such scenarios, we ought to use the symbol definition as is instead of looking up by name. Couple of months ago musl made a similar change to address the exact same type of problems as described by this commit.

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