Commit 29a011fc authored by Sathvika Vasireddy's avatar Sathvika Vasireddy Committed by Michael Ellerman
Browse files

powerpc: Fix objtool unannotated intra-function call warnings



Objtool throws unannotated intra-function call warnings in the following
assembly files:

arch/powerpc/kernel/vector.o: warning: objtool: .text+0x53c: unannotated intra-function call

arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0x60: unannotated intra-function call
arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0x124: unannotated intra-function call
arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0x5d4: unannotated intra-function call
arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0x5dc: unannotated intra-function call
arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0xcb8: unannotated intra-function call
arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0xd0c: unannotated intra-function call
arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0x1030: unannotated intra-function call

arch/powerpc/kernel/head_64.o: warning: objtool: .text+0x358: unannotated intra-function call
arch/powerpc/kernel/head_64.o: warning: objtool: .text+0x728: unannotated intra-function call
arch/powerpc/kernel/head_64.o: warning: objtool: .text+0x4d94: unannotated intra-function call
arch/powerpc/kernel/head_64.o: warning: objtool: .text+0x4ec4: unannotated intra-function call

arch/powerpc/kvm/book3s_hv_interrupts.o: warning: objtool: .text+0x6c: unannotated intra-function call
arch/powerpc/kernel/misc_64.o: warning: objtool: .text+0x64: unannotated intra-function call

Objtool does not add STT_NOTYPE symbols with size 0 to the rbtree, which
is why find_call_destination() function is not able to find the
destination symbol for 'bl' instruction. For such symbols, objtool is
throwing unannotated intra-function call warnings in assembly files. Fix
these warnings by annotating those symbols with SYM_FUNC_START_LOCAL and
SYM_FUNC_END macros, inorder to set symbol type to STT_FUNC and symbol
size accordingly.

Tested-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Reviewed-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Reviewed-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: default avatarSathvika Vasireddy <sv@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221114175754.1131267-4-sv@linux.ibm.com
parent 01f2cf0b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
 *
 */

#include <linux/linkage.h>
#include <asm/hw_irq.h>
#include <asm/exception-64s.h>
#include <asm/ptrace.h>
@@ -3112,7 +3113,7 @@ _GLOBAL(enable_machine_check)
	blr

/* MSR[RI] should be clear because this uses SRR[01] */
disable_machine_check:
SYM_FUNC_START_LOCAL(disable_machine_check)
	mflr	r0
	bcl	20,31,$+4
0:	mflr	r3
@@ -3125,3 +3126,4 @@ disable_machine_check:
	RFI_TO_KERNEL
1:	mtlr	r0
	blr
SYM_FUNC_END(disable_machine_check)
+5 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
 *  variants.
 */

#include <linux/linkage.h>
#include <linux/threads.h>
#include <linux/init.h>
#include <asm/reg.h>
@@ -462,7 +463,7 @@ generic_secondary_common_init:
 * Assumes we're mapped EA == RA if the MMU is on.
 */
#ifdef CONFIG_PPC_BOOK3S
__mmu_off:
SYM_FUNC_START_LOCAL(__mmu_off)
	mfmsr	r3
	andi.	r0,r3,MSR_IR|MSR_DR
	beqlr
@@ -473,6 +474,7 @@ __mmu_off:
	sync
	rfid
	b	.	/* prevent speculative execution */
SYM_FUNC_END(__mmu_off)
#endif


@@ -869,7 +871,7 @@ _GLOBAL(start_secondary_resume)
/*
 * This subroutine clobbers r11 and r12
 */
enable_64b_mode:
SYM_FUNC_START_LOCAL(enable_64b_mode)
	mfmsr	r11			/* grab the current MSR */
#ifdef CONFIG_PPC_BOOK3E_64
	oris	r11,r11,0x8000		/* CM bit set, we'll set ICM later */
@@ -881,6 +883,7 @@ enable_64b_mode:
	isync
#endif
	blr
SYM_FUNC_END(enable_64b_mode)

/*
 * This puts the TOC pointer into r2, offset by 0x8000 (as expected
+3 −1
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
 * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
 */

#include <linux/linkage.h>
#include <linux/sys.h>
#include <asm/unistd.h>
#include <asm/errno.h>
@@ -353,7 +354,7 @@ _GLOBAL(kexec_smp_wait)
 *
 * don't overwrite r3 here, it is live for kexec_wait above.
 */
real_mode:	/* assume normal blr return */
SYM_FUNC_START_LOCAL(real_mode)	/* assume normal blr return */
#ifdef CONFIG_PPC_BOOK3E_64
	/* Create an identity mapping. */
	b	kexec_create_tlb
@@ -370,6 +371,7 @@ real_mode: /* assume normal blr return */
	mtspr	SPRN_SRR0,r11
	rfid
#endif
SYM_FUNC_END(real_mode)

/*
 * kexec_sequence(newstack, start, image, control, clear_all(),
+3 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/linkage.h>
#include <asm/processor.h>
#include <asm/ppc_asm.h>
#include <asm/reg.h>
@@ -185,7 +186,7 @@ fphalf:
 * Internal routine to enable floating point and set FPSCR to 0.
 * Don't call it from C; it doesn't use the normal calling convention.
 */
fpenable:
SYM_FUNC_START_LOCAL(fpenable)
#ifdef CONFIG_PPC32
	stwu	r1,-64(r1)
#else
@@ -202,6 +203,7 @@ fpenable:
	mffs	fr31
	MTFSF_L(fr1)
	blr
SYM_FUNC_END(fpenable)

fpdisable:
	mtlr	r12
+3 −1
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
 * Authors: Alexander Graf <agraf@suse.de>
 */

#include <linux/linkage.h>
#include <asm/ppc_asm.h>
#include <asm/kvm_asm.h>
#include <asm/reg.h>
@@ -107,7 +108,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
/*
 * void kvmhv_save_host_pmu(void)
 */
kvmhv_save_host_pmu:
SYM_FUNC_START_LOCAL(kvmhv_save_host_pmu)
BEGIN_FTR_SECTION
	/* Work around P8 PMAE bug */
	li	r3, -1
@@ -154,3 +155,4 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
	stw	r8, HSTATE_PMC5(r13)
	stw	r9, HSTATE_PMC6(r13)
31:	blr
SYM_FUNC_END(kvmhv_save_host_pmu)
Loading