Fix .localentry example in section 3.4.1 #67

Closed
opened 8 years ago by wschmidt-ibm · 0 comments
wschmidt-ibm commented 8 years ago (Migrated from github.com)

In section 3.4.1 of the ABI, we have the following:

The local-entry-point handling field of st_other is generated with the .localentry pseudo op. The
following is an example using the medium code model:

.globl my_func
.type my_func, @function
my_func:
addis r2, r12, my_sym@ha(.TOC.-my_func)
addi r2, r2, my_sym@l(.TOC.-my_func)
.localentry my_func, .-my_func
... ; function definition
blr

The two references to my_sym appear bogus. Earlier in the document (section 2.3.2.1 Function Prologue) we have instead:

When a function has two entry points, the global entry point is defined as a symbol. The local entry
point is defined with the .localentry assembler pseudo op.

my_func:
addis r2, r12, (.TOC.-my_func)@ha
addi r2, r2, (.TOC.-my_func)@l
.localentry my_func, .-my_func
... ; function definition
blr

which seems correct. Assembly dumps from GCC-compiled code omit the parentheses around .TOC.-my_func, but it only makes sense for the subtraction to bind more tightly than the @ha and @l modifiers, so this should be the same:

        .globl sad_x4_16x16
        .type   sad_x4_16x16, @function
sad_x4_16x16:
.LCF0:
0:      addis 2,12,.TOC.-.LCF0@ha
        addi 2,2,.TOC.-.LCF0@l
        .localentry     sad_x4_16x16,.-sad_x4_16x16

All of which is to say, I think we need to correct the section 3.4.1 example to look like the section 2.3.2.1 example.

In section 3.4.1 of the ABI, we have the following: The local-entry-point handling field of st_other is generated with the .localentry pseudo op. The following is an example using the medium code model: ``` .globl my_func .type my_func, @function my_func: addis r2, r12, my_sym@ha(.TOC.-my_func) addi r2, r2, my_sym@l(.TOC.-my_func) .localentry my_func, .-my_func ... ; function definition blr ``` The two references to my_sym appear bogus. Earlier in the document (section 2.3.2.1 Function Prologue) we have instead: When a function has two entry points, the global entry point is defined as a symbol. The local entry point is defined with the .localentry assembler pseudo op. ``` my_func: addis r2, r12, (.TOC.-my_func)@ha addi r2, r2, (.TOC.-my_func)@l .localentry my_func, .-my_func ... ; function definition blr ``` which seems correct. Assembly dumps from GCC-compiled code omit the parentheses around .TOC.-my_func, but it only makes sense for the subtraction to bind more tightly than the @ha and @l modifiers, so this should be the same: ``` .globl sad_x4_16x16 .type sad_x4_16x16, @function sad_x4_16x16: .LCF0: 0: addis 2,12,.TOC.-.LCF0@ha addi 2,2,.TOC.-.LCF0@l .localentry sad_x4_16x16,.-sad_x4_16x16 ``` All of which is to say, I think we need to correct the section 3.4.1 example to look like the section 2.3.2.1 example.
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#67
Loading…
There is no content yet.