Power10 libffi fixes (#585)
authorAlan Modra <amodra@gmail.com>
Tue, 27 Oct 2020 13:06:21 +0000 (23:36 +1030)
committerGitHub <noreply@github.com>
Tue, 27 Oct 2020 13:06:21 +0000 (09:06 -0400)
commitf4435980fa2da335fe388db431d4a7946a99a2b9
treea5b19e7fd7df8c5309437642de6de5247177a289
parent407394c0aac2db4a1978a7691035889db9924a01
Power10 libffi fixes (#585)

Power10 pc-relative code doesn't use or preserve r2 as a TOC pointer.
That means calling between pc-relative and TOC using code can't be
done without intervening linker stubs, and a call from TOC code to
pc-relative code must have a nop after the bl in order to restore r2.

Now the PowerPC libffi assembly code doesn't use r2 except for the
implicit use when making calls back to C, ffi_closure_helper_LINUX64
and ffi_prep_args64.  So changing the assembly to interoperate with
pc-relative code without stubs is easily done.

* src/powerpc/linux64.S (ffi_call_LINUX64): Don't emit global
entry when __PCREL__.  Call using @notoc.  Add nops.
* src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Likewise.
(ffi_go_closure_linux64): Likewise.
src/powerpc/linux64.S
src/powerpc/linux64_closure.S