Add TOC-indirect addressing example #98

Open
opened 5 years ago by wschmidt-ibm · 1 comments
wschmidt-ibm commented 5 years ago (Migrated from github.com)

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
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 ```
wschmidt-ibm commented 5 years ago (Migrated from github.com)

Ask Alan why our examples are all for GOT-indirect instead of TOC-indirect. Examples include pp. 52-53, 54, 64 (Tables 2.26 and 2.27), 67 (Tables 2.30 and 2.31). Under what circumstances do we actually generate these?

Ask Alan why our examples are all for GOT-indirect instead of TOC-indirect. Examples include pp. 52-53, 54, 64 (Tables 2.26 and 2.27), 67 (Tables 2.30 and 2.31). Under what circumstances do we actually generate these?
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: systemsoftware/ELFv2-ABI#98
Loading…
There is no content yet.