Re: Remaining randconfig objtool warnings, linux-next-20200428

From: Josh Poimboeuf
Date: Wed Apr 29 2020 - 14:55:49 EST


On Tue, Apr 28, 2020 at 11:10:44AM -0500, Josh Poimboeuf wrote:
> > ==> build/x86/0xE0F2ACFF_defconfig/log <==
> > kernel/time/posix-stubs.o: warning: objtool: __x64_sys_timer_create()+0x23: sibling call from callable instruction with modified stack frame

This one is fixed with the following cleanup:

From: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
Subject: [PATCH] linkage: Convert syscall alias macros to C

There's no need to use inline asm to create ELF alias symbols.
Annotated C function declarations can be used instead.

This also makes the ordering of the ELF symbol table more logical, with
the real function now always coming before the aliases. This makes it
easier for objtool, objdump and other tools to differentiate them.

This fixes the following warning:

kernel/time/posix-stubs.o: warning: objtool: __x64_sys_timer_create()+0x23: sibling call from callable instruction with modified stack frame

Reported-by: Arnd Bergmann <arnd@xxxxxxxx>
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
include/linux/linkage.h | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index d796ec20d114..2d7dd6361f91 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -22,18 +22,12 @@
#define asmlinkage CPP_ASMLINKAGE
#endif

-#ifndef cond_syscall
-#define cond_syscall(x) asm( \
- ".weak " __stringify(x) "\n\t" \
- ".set " __stringify(x) "," \
- __stringify(sys_ni_syscall))
+#ifndef SYSCALL_ALIAS
+#define SYSCALL_ALIAS(alias, name) __alias(name) typeof(name) alias
#endif

-#ifndef SYSCALL_ALIAS
-#define SYSCALL_ALIAS(alias, name) asm( \
- ".globl " __stringify(alias) "\n\t" \
- ".set " __stringify(alias) "," \
- __stringify(name))
+#ifndef cond_syscall
+#define cond_syscall(x) __weak SYSCALL_ALIAS(x, sys_ni_syscall)
#endif

#define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE)
--
2.21.1