bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/26164] powerpc64le: ld requires a nop after a branch to another


From: amodra at gmail dot com
Subject: [Bug ld/26164] powerpc64le: ld requires a nop after a branch to another compilation unit
Date: Thu, 25 Jun 2020 00:11:07 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=26164

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #1 from Alan Modra <amodra at gmail dot com> ---
That would be correct linker behaviour, at least if you allow that the linker
doesn't have special knowledge about __GI_exit never returning.

__makecontext is assembly declared to use and preserve r2 (localentry:8),
whereas with -mcpu=power10 posix/_exit.c is compiled to a function that is
declared to not use *and not preserve* r2 (localentry:1).

Faced with a call from a function that apparently needs to preserve r2 to a
function that apparently does not, the linker tries to insert a stub that saves
r2 with r2 being restored on return from the call.  In this case there is no
nop to replace with an insn to restore r2 (and "b" rather than "bl" is used) so
the linker knows r2 can't be restored.  Note that the linker decides whether
the call should preserve r2 by the relocation on the call insn rather than the
st_other localentry bits of __makecontext.

So it seems to me that glibc ought to be using "b __GI_exit@notoc" to call
_exit from makecontext when building for power10.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]