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

2020-06-24 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=26164

--- Comment #2 from Alan Modra  ---
Another thing to consider with regards to glibc assembly is that functions
using plain ENTRY as opposed to ENTRY_TOCLESS may incur extra overhead when
being called.  For example when linking staticly, a call from pcrel code to a
function that uses r2 will never be direct to the local entry point.  Instead
the call will go via a stub to the global entry point.

BTW, -Wl,-stats might be useful in tracking down these cases.

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


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

2020-06-24 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=26164

Alan Modra  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|NEW |RESOLVED

--- Comment #1 from Alan Modra  ---
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.


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

2020-06-24 Thread tuliom at ascii dot art.br
https://sourceware.org/bugzilla/show_bug.cgi?id=26164

Tulio Magno Quites Machado Filho  changed:

   What|Removed |Added

 CC||amodra at gmail dot com,
   ||tuliom at ascii dot art.br,
   ||wschmidt at gcc dot gnu.org
   Host||powerpc64le-linux-gnu

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