2022-05-02 23:17:03

by Peter Zijlstra

[permalink] [raw]
Subject: [PATCH v2] objtool: Fix STACK_FRAME_NON_STANDARD reloc type

On Fri, Apr 29, 2022 at 01:13:25PM -0700, Josh Poimboeuf wrote:
> Can use _ASM_PTR here, and objtool.h needs synced to tools.

Here goes..

---
Subject: objtool: Fix STACK_FRAME_NON_STANDARD reloc type
From: Peter Zijlstra <[email protected]>
Date: Tue Apr 26 17:08:53 CEST 2022

STACK_FRAME_NON_STANDARD results in inconsistent relocation types
depending on .c or .S usage:

Relocation section '.rela.discard.func_stack_frame_non_standard' at offset 0x3c01090 contains 5 entries:
Offset Info Type Symbol's Value Symbol's Name + Addend
0000000000000000 00020c2200000002 R_X86_64_PC32 0000000000047b40 do_suspend_lowlevel + 0
0000000000000008 0002461e00000001 R_X86_64_64 00000000000480a0 machine_real_restart + 0
0000000000000010 0000001400000001 R_X86_64_64 0000000000000000 .rodata + b3d4
0000000000000018 0002444600000002 R_X86_64_PC32 00000000000678a0 __efi64_thunk + 0
0000000000000020 0002659d00000001 R_X86_64_64 0000000000113160 __crash_kexec + 0

Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
---
include/linux/objtool.h | 2 +-
tools/include/linux/objtool.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

--- a/include/linux/objtool.h
+++ b/include/linux/objtool.h
@@ -137,7 +137,7 @@ struct unwind_hint {

.macro STACK_FRAME_NON_STANDARD func:req
.pushsection .discard.func_stack_frame_non_standard, "aw"
- .long \func - .
+ _ASM_PTR \func
.popsection
.endm

--- a/tools/include/linux/objtool.h
+++ b/tools/include/linux/objtool.h
@@ -137,7 +137,7 @@ struct unwind_hint {

.macro STACK_FRAME_NON_STANDARD func:req
.pushsection .discard.func_stack_frame_non_standard, "aw"
- .long \func - .
+ _ASM_PTR \func
.popsection
.endm


2022-05-03 00:12:33

by Josh Poimboeuf

[permalink] [raw]
Subject: Re: [PATCH v2] objtool: Fix STACK_FRAME_NON_STANDARD reloc type

On Fri, Apr 29, 2022 at 11:22:35PM +0200, Peter Zijlstra wrote:
> On Fri, Apr 29, 2022 at 01:13:25PM -0700, Josh Poimboeuf wrote:
> > Can use _ASM_PTR here, and objtool.h needs synced to tools.
>
> Here goes..
>
> ---
> Subject: objtool: Fix STACK_FRAME_NON_STANDARD reloc type
> From: Peter Zijlstra <[email protected]>
> Date: Tue Apr 26 17:08:53 CEST 2022
>
> STACK_FRAME_NON_STANDARD results in inconsistent relocation types
> depending on .c or .S usage:
>
> Relocation section '.rela.discard.func_stack_frame_non_standard' at offset 0x3c01090 contains 5 entries:
> Offset Info Type Symbol's Value Symbol's Name + Addend
> 0000000000000000 00020c2200000002 R_X86_64_PC32 0000000000047b40 do_suspend_lowlevel + 0
> 0000000000000008 0002461e00000001 R_X86_64_64 00000000000480a0 machine_real_restart + 0
> 0000000000000010 0000001400000001 R_X86_64_64 0000000000000000 .rodata + b3d4
> 0000000000000018 0002444600000002 R_X86_64_PC32 00000000000678a0 __efi64_thunk + 0
> 0000000000000020 0002659d00000001 R_X86_64_64 0000000000113160 __crash_kexec + 0
>
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
> ---
> include/linux/objtool.h | 2 +-
> tools/include/linux/objtool.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> --- a/include/linux/objtool.h
> +++ b/include/linux/objtool.h
> @@ -137,7 +137,7 @@ struct unwind_hint {
>
> .macro STACK_FRAME_NON_STANDARD func:req
> .pushsection .discard.func_stack_frame_non_standard, "aw"
> - .long \func - .
> + _ASM_PTR \func
> .popsection
> .endm

This file needs to include <asm/asm.h>, otherwise you get:

arch/x86/kernel/acpi/wakeup_64.S: Assembler messages:
arch/x86/kernel/acpi/wakeup_64.S:132: Error: no such instruction: `_asm_ptr do_suspend_lowlevel'


--
Josh