diff mbox series

linux: powerpc: Fix syscall_cancel build for powerpc64le-linux-gnu [BZ #32125]

Message ID 6cae24d1-940e-408d-a1f8-f479399d8612@linux.ibm.com
State New
Headers show
Series linux: powerpc: Fix syscall_cancel build for powerpc64le-linux-gnu [BZ #32125] | expand

Commit Message

jeevitha Aug. 30, 2024, 12:09 p.m. UTC
In __syscall_cancel_arch, there's a tail call to __syscall_do_cancel.
On P10, since the caller uses the TOC and the callee is using
PC-relative addressing, there's only a branch instruction with no NOPs
to restore the TOC, which causes the build error. The fix involves adding
the NOTOC directive to the branch instruction, informing the linker
not to generate a TOC stub, thus resolving the issue.

---
 sysdeps/powerpc/powerpc64/sysdep.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Adhemerval Zanella Netto Aug. 30, 2024, 12:12 p.m. UTC | #1
On 30/08/24 09:09, jeevitha wrote:
> In __syscall_cancel_arch, there's a tail call to __syscall_do_cancel.
> On P10, since the caller uses the TOC and the callee is using
> PC-relative addressing, there's only a branch instruction with no NOPs
> to restore the TOC, which causes the build error. The fix involves adding
> the NOTOC directive to the branch instruction, informing the linker
> not to generate a TOC stub, thus resolving the issue.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> 
> ---
>  sysdeps/powerpc/powerpc64/sysdep.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h
> index 643aadaae0..c439b06121 100644
> --- a/sysdeps/powerpc/powerpc64/sysdep.h
> +++ b/sysdeps/powerpc/powerpc64/sysdep.h
> @@ -354,7 +354,7 @@ LT_LABELSUFFIX(name,_name_end): ; \
>  
>  #ifdef SHARED
>  # define TAIL_CALL_NO_RETURN(__func) \
> -    b JUMPTARGET(__func)
> +    b JUMPTARGET (NOTOC (__func))
>  #else
>  # define TAIL_CALL_NO_RETURN(__func) \
>      .ifdef .Local ## __func; \
Peter Bergner Aug. 30, 2024, 1:56 p.m. UTC | #2
On 8/30/24 7:09 AM, jeevitha wrote:
> In __syscall_cancel_arch, there's a tail call to __syscall_do_cancel.
> On P10, since the caller uses the TOC and the callee is using
> PC-relative addressing, there's only a branch instruction with no NOPs
> to restore the TOC, which causes the build error. The fix involves adding
> the NOTOC directive to the branch instruction, informing the linker
> not to generate a TOC stub, thus resolving the issue.

LGTM too and pushed. 

Unfortunately, I forgot to append Adhenerval and my Reviewed-bys. :-(

Peter
diff mbox series

Patch

diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h
index 643aadaae0..c439b06121 100644
--- a/sysdeps/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/powerpc/powerpc64/sysdep.h
@@ -354,7 +354,7 @@  LT_LABELSUFFIX(name,_name_end): ; \
 
 #ifdef SHARED
 # define TAIL_CALL_NO_RETURN(__func) \
-    b JUMPTARGET(__func)
+    b JUMPTARGET (NOTOC (__func))
 #else
 # define TAIL_CALL_NO_RETURN(__func) \
     .ifdef .Local ## __func; \