linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/boot: Fix crt0.S current address branch form
@ 2023-04-07  4:09 Nicholas Piggin
  2023-04-08  3:44 ` Michael Ellerman
  2023-04-26 12:01 ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Nicholas Piggin @ 2023-04-07  4:09 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

Use the preferred form of branch-and-link for finding the current
address so objtool doesn't think it is an unannotated intra-function
call.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/boot/crt0.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S
index 44544720daae..121cab9d579b 100644
--- a/arch/powerpc/boot/crt0.S
+++ b/arch/powerpc/boot/crt0.S
@@ -51,7 +51,7 @@ _zimage_start:
 _zimage_start_lib:
 	/* Work out the offset between the address we were linked at
 	   and the address where we're running. */
-	bl	.+4
+	bcl	20,31,.+4
 p_base:	mflr	r10		/* r10 now points to runtime addr of p_base */
 #ifndef __powerpc64__
 	/* grab the link address of the dynamic section in r11 */
@@ -274,7 +274,7 @@ prom:
 	mtsrr1	r10
 
 	/* Load FW address, set LR to label 1, and jump to FW */
-	bl	0f
+	bcl	20,31,0f
 0:	mflr	r10
 	addi	r11,r10,(1f-0b)
 	mtlr	r11
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/boot: Fix crt0.S current address branch form
  2023-04-07  4:09 [PATCH] powerpc/boot: Fix crt0.S current address branch form Nicholas Piggin
@ 2023-04-08  3:44 ` Michael Ellerman
  2023-04-12  0:57   ` Michael Ellerman
  2023-04-26 12:01 ` Michael Ellerman
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Ellerman @ 2023-04-08  3:44 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev; +Cc: Nicholas Piggin

Nicholas Piggin <npiggin@gmail.com> writes:
> Use the preferred form of branch-and-link for finding the current
> address so objtool doesn't think it is an unannotated intra-function
> call.

We don't run objtool on this code in mainline AFAIK. Because BOOTAS
doesn't call it.

Did you actually see a warning, or are you just anticipating that it
would warn about it?

This diff would run it on boot asm and seems to build OK, so maybe we
should do that.

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 08071bac056d..5d3a4c5354d7 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -223,7 +223,7 @@ quiet_cmd_bootcc = BOOTCC  $@
       cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
 
 quiet_cmd_bootas = BOOTAS  $@
-      cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
+      cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< $(cmd_objtool)
 
 quiet_cmd_bootar = BOOTAR  $@
       cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(real-prereqs); mv $@.$$$$ $@


cheers

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/boot: Fix crt0.S current address branch form
  2023-04-08  3:44 ` Michael Ellerman
@ 2023-04-12  0:57   ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2023-04-12  0:57 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev; +Cc: Nicholas Piggin

Michael Ellerman <mpe@ellerman.id.au> writes:
> Nicholas Piggin <npiggin@gmail.com> writes:
>> Use the preferred form of branch-and-link for finding the current
>> address so objtool doesn't think it is an unannotated intra-function
>> call.
>
> We don't run objtool on this code in mainline AFAIK. Because BOOTAS
> doesn't call it.

But as Nick pointed out, if you run:

 $ make arch/powerpc/boot/crt0.o

It does run objtool, because it uses the generic cmd_as_o_S rule instead
of the BOOTAS rule.

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/boot: Fix crt0.S current address branch form
  2023-04-07  4:09 [PATCH] powerpc/boot: Fix crt0.S current address branch form Nicholas Piggin
  2023-04-08  3:44 ` Michael Ellerman
@ 2023-04-26 12:01 ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2023-04-26 12:01 UTC (permalink / raw)
  To: linuxppc-dev, Nicholas Piggin

On Fri, 07 Apr 2023 14:09:24 +1000, Nicholas Piggin wrote:
> Use the preferred form of branch-and-link for finding the current
> address so objtool doesn't think it is an unannotated intra-function
> call.
> 
> 

Applied to powerpc/next.

[1/1] powerpc/boot: Fix crt0.S current address branch form
      https://git.kernel.org/powerpc/c/cd99dac6ec5fff763852d8ccb8a79f5de50ed830

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-26 12:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-07  4:09 [PATCH] powerpc/boot: Fix crt0.S current address branch form Nicholas Piggin
2023-04-08  3:44 ` Michael Ellerman
2023-04-12  0:57   ` Michael Ellerman
2023-04-26 12:01 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).