Skip to content

Add TOC-indirect addressing example #98

@openpower-gitea-migrator

Description

@openpower-gitea-migrator

Originally Gitea issue #98 by @toshywoshy on 2019-08-05


Even though this is very common code generation, we don't reflect it in the ABI (Coding Examples, Position-Dependent Code and Position-Independent Code).

extern int x;
int foo ( ) { return x; }
        .section        ".toc","aw"
        .align 3
.LC0:
        .quad   x
        .section        ".text"
        .align 2
        .p2align 4,,15
        .globl foo
        .type   foo, @function
foo:
        addis 2,12,.TOC.-foo@ha
        addi 2,2,.TOC.-foo@l
        .localentry     foo,.-foo
        addis 9,2,.LC0@toc@ha
        ld 9,.LC0@toc@l(9)
        lwa 3,0(9)
        blr

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions