Skip to content

[RuntimeDyld][ELF] Unwanted sign-extension when computing stub addresses. #94478

Closed
@al45tair

Description

@al45tair

The RuntimeDyldELF implementation tries to make a stub, it uses an expression like

reinterpret_cast<uint64_t>(Section.getAddressWithOffset(Section.getStubOffset()))

to get the address of the stub it's generating as a uint64_t.

Sadly, on 32-bit platforms where addresses are regarded as signed, because getAddressWithOffset() returns a uint8_t * pointer, this can cause unwanted sign-extension, so if (for instance) the code has been loaded at 0xf1a10000, and the stub is at offset 4, the resulting uint64_t will be 0xfffffffff1a10004 instead of the expected 0xf1a10004.

Metadata

Metadata

Assignees

No one assigned

    Labels

    llvmUmbrella label for LLVM issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions