Skip to contentSkip to conversation

x86: add .size directive to indirect thunk generation macro

PATCH In review Jan Beulich 2 participants 3 messages Feb 23, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: add .size directive to indirect thunk generation macro

Not adding .type, as these are neither functions nor objects.

xen/arch/x86/indirect-thunk.S +1 -0
@@ -41,6 +41,7 @@ ENTRY(__x86_indirect_thunk_\reg)
         ALTERNATIVE_2 __stringify(IND_THUNK_RETPOLINE \reg),              \
         __stringify(IND_THUNK_LFENCE \reg), X86_FEATURE_IND_THUNK_LFENCE, \
         __stringify(IND_THUNK_JMP \reg),    X86_FEATURE_IND_THUNK_JMP
+        .size __x86_indirect_thunk_\reg, . - __x86_indirect_thunk_\reg
 .endm
 
 /* Instantiate GEN_INDIRECT_THUNK for each register except %rsp. */

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Jan Beulich

Not adding .type, as these are neither functions nor objects.

@function is for executable code in general.  It is not restricted to C's idea of function.

This is how GCC writes a repoline thunk:

    .section .text.__x86_indirect_thunk_rax,"axG",@progbits,__x86_indirect_thunk_rax,comdat .globl    __x86_indirect_thunk_rax
    .hidden    __x86_indirect_thunk_rax
    .type    __x86_indirect_thunk_rax, @function __x86_indirect_thunk_rax:
.LFB1:
    .cfi_startproc
    call    .LIND1
.LIND0:
    lfence
    jmp    .LIND0
.LIND1:
    mov    %rax, (%rsp)
    ret
    .cfi_endproc

xen/arch/x86/indirect-thunk.S ENTRY(__x86_indirect_thunk_\reg) · line 43

Quoted 7 lines
xen/arch/x86/indirect-thunk.S +0 -0
@@ -41,6 +41,7 @@ ENTRY(__x86_indirect_thunk_\reg)
         ALTERNATIVE_2 __stringify(IND_THUNK_RETPOLINE \reg),              \
         __stringify(IND_THUNK_LFENCE \reg), X86_FEATURE_IND_THUNK_LFENCE, \
         __stringify(IND_THUNK_JMP \reg),    X86_FEATURE_IND_THUNK_JMP

Newline please.

xen/arch/x86/indirect-thunk.S ENTRY(__x86_indirect_thunk_\reg) · line 44

Quoted 1 line
xen/arch/x86/indirect-thunk.S +1 -0
+        .size __x86_indirect_thunk_\reg, . - __x86_indirect_thunk_\reg

.type as well.

xen/arch/x86/indirect-thunk.S ENTRY(__x86_indirect_thunk_\reg) · line 47

Quoted 6 lines
xen/arch/x86/indirect-thunk.S +0 -0
 .endm
 
 /* Instantiate GEN_INDIRECT_THUNK for each register except %rsp. */

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 23.02.18 at 12:09, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich

Not adding .type, as these are neither functions nor objects.

@function is for executable code in general. It is not restricted to C's idea of function.

Oh, indeed, I forgot that the spec says "or other executable code".

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel