Skip to content

Define GOT before use #271

@kito-cheng

Description

@kito-cheng

Review comment come from @anderslindgren-iar and Anders Berg(IAR) https://lists.riscv.org/g/tech-toolchain-runtime/message/344

global offset table (GOT)

Anders: Where is the specification for GOT (how can one find it)?

    # Load value from a local symbol 
0:  auipc a0, %pcrel_hi(symbol)
    lw    a0, %pcrel_lo(0b)(a0)
    # Store value to a local symbol 
1:  auipc a0, %pcrel_hi(symbol)
    sw    a1, %pcrel_lo(1b)(a0)
    # Calculate address of a local symbol 
2:  auipc a0, %pcrel_hi(symbol)
    addi  a0, a0, %pcrel_lo(2b)
    # Calculate address of non-local symbol 
3:  auipc  a0, %got_pcrel_hi(symbol)
    l[w|d] a0, a0, %pcrel_lo(3b)

Anders: The example is pointless if one cannot find the specification for GOT.
Should it not be an additional case of how to read a non-local symbol?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions