Skip to content

Immediate values don't use the relocation, meaning lw with a number results in the wrong value passed to auipc. #430

Description

@rsahwe

lw t0 2 gets translated to auipc t0 2 and lw t0 2-pc t0 instead of auipc t0 0 and lw t0 2-pc t0.

This is because the relocation is only used with labels and not with regular immediates I think:

Ripes/src/isa/instruction.h

Lines 652 to 661 in 3a97948

Reg_T_S value = getImm(immToken, success, convInfo);
if (!success) {
// Could not directly resolve immediate. Register it as a symbol to link
// to.
linksWithSymbol.resolveSymbol = applySymbolResolution;
linksWithSymbol.symbol = immToken;
linksWithSymbol.relocation = immToken.relocation();
return Result<>::def();
}

Using an expression such as (2 + 0) works correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions