[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210106015810.5p6crnh7jqtmjtv4@treble>
Date: Tue, 5 Jan 2021 19:58:10 -0600
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Fangrui Song <maskray@...gle.com>,
Arnd Bergmann <arnd@...db.de>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
Nathan Chancellor <natechancellor@...il.com>,
linux-kernel@...r.kernel.org, clang-built-linux@...glegroups.com
Subject: Re: [PATCH v2] x86/entry: use STB_GLOBAL for register restoring thunk
On Tue, Jan 05, 2021 at 04:43:51PM -0800, Nick Desaulniers wrote:
> Arnd found a randconfig that produces the warning:
>
> arch/x86/entry/thunk_64.o: warning: objtool: missing symbol for insn at
> offset 0x3e
>
> when building with LLVM_IAS=1 (use Clang's integrated assembler). Josh
> notes:
>
> With the LLVM assembler stripping the .text section symbol, objtool
> has no way to reference this code when it generates ORC unwinder
> entries, because this code is outside of any ELF function.
>
> Fangrui notes that this is helpful for reducing images size when
> compiling with -ffunction-sections and -fdata-sections. I have observerd
> on the order of tens of thousands of symbols for the kernel images built
> with those flags. A patch has been authored against GNU binutils to
> match this behavior, with a new flag
> --generate-unused-section-symbols=[yes|no].
>
> Use a global symbol for the thunk that way
> objtool can generate proper unwind info here with LLVM_IAS=1.
On second thought, there's no need to make the symbol global. Just
getting rid of the '.L' local label symbol prefix should be enough to
make an ELF symbol:
diff --git a/arch/x86/entry/thunk_64.S b/arch/x86/entry/thunk_64.S
index ccd32877a3c4..c9a9fbf1655f 100644
--- a/arch/x86/entry/thunk_64.S
+++ b/arch/x86/entry/thunk_64.S
@@ -31,7 +31,7 @@ SYM_FUNC_START_NOALIGN(\name)
.endif
call \func
- jmp .L_restore
+ jmp __thunk_restore
SYM_FUNC_END(\name)
_ASM_NOKPROBE(\name)
.endm
@@ -44,7 +44,7 @@ SYM_FUNC_END(\name)
#endif
#ifdef CONFIG_PREEMPTION
-SYM_CODE_START_LOCAL_NOALIGN(.L_restore)
+SYM_CODE_START_LOCAL_NOALIGN(__thunk_restore)
popq %r11
popq %r10
popq %r9
@@ -56,6 +56,6 @@ SYM_CODE_START_LOCAL_NOALIGN(.L_restore)
popq %rdi
popq %rbp
ret
- _ASM_NOKPROBE(.L_restore)
-SYM_CODE_END(.L_restore)
+ _ASM_NOKPROBE(__thunk_restore)
+SYM_CODE_END(__thunk_restore)
#endif
Powered by blists - more mailing lists