summaryrefslogtreecommitdiff
path: root/src/powerpc
Commit message (Collapse)AuthorAgeFilesLines
* Makefile: enable target overridings. (#661)Clément Chigot2022-09-011-0/+5
| | | | | | | | | | This patch allows target to provide extra files enabling the override of Makefile rules. This patch is not needed for libffi itself but only for GCC on AIX. The t-aix file which is here empty will be replaced in GCC repository. We cannot include GCC version directly here because it has no sense for a standalone libffi. Co-authored-by: Clement <clement.chigot@atos.net>
* powerpc64: fix build on gcc-12 (assembly requires AltiVec) (#719)Sergei Trofimovich2022-06-022-0/+4
| | | | | | | | | | Without the change build fails on powerpc64-gcc-12 as: src/powerpc/linux64_closure.S: Assembler messages: src/powerpc/linux64_closure.S:363: Error: unrecognized opcode: `lvx' It's a 90205f67 "rs6000: Fix bootstrap (libffi)" patch by Segher Boessenkool from gcc upstream repository. It's enough to get libffi build on powerpc64.
* powerpc64: fix handling of homogeneous float128 structs (#689)Dan Horák2022-01-311-1/+1
| | | | | | If there is a homogeneous struct with float128 members, they should be copied to vector register save area. The current code incorrectly copies only the value of the first member, not increasing the pointer with each iteration. Fix this.
* darwin powerpc: use go closures only if enabled (#583)Ken2020-10-271-1/+13
| | | | | | SHA: 0ff9419f2e75652426469e256cb7d0748064ad58 added go closures for darwin powerpc AIX, but these have not yet been implemented for non-AIX systems use the go closures only if enabled
* Power10 libffi fixes (#585)Alan Modra2020-10-272-1/+21
| | | | | | | | | | | | | | | | 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.
* ffi_powerpc.h: fix build failure with powerpc7 (#561)Andrew Geissler2020-05-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a patch pulled down from the following: https://github.com/buildroot/buildroot/blob/78926f610b1411b03464152472fd430012deb9ac/package/libffi/0004-ffi_powerpc.h-fix-build-failure-with-powerpc7.patch This issue is being hit on OpenBMC code when pulling the latest libffi tag and building on a P8 ppc64le machine. I verified this patch fixes the issue we are seeing. Below is the original commit message: Sicne commit 73dd43afc8a447ba98ea02e9aad4c6898dc77fb0, build on powerpc7 fails on: In file included from ../src/powerpc/ffi.c:33:0: ../src/powerpc/ffi_powerpc.h:61:9: error: '_Float128' is not supported on this target typedef _Float128 float128; ^~~~~~~~~ Fix this build failure by checking for __HAVE_FLOAT128 before using _Float128, as _Float128 is enabled only on specific conditions, see output/host/powerpc64-buildroot-linux-gnu/sysroot/usr/include/bits/floatn.h: /* Defined to 1 if the current compiler invocation provides a floating-point type with the IEEE 754 binary128 format, and this glibc includes corresponding *f128 interfaces for it. */ #if defined _ARCH_PWR8 && defined __LITTLE_ENDIAN__ && (_CALL_ELF == 2) \ && defined __FLOAT128__ && !defined __NO_LONG_DOUBLE_MATH # define __HAVE_FLOAT128 1 #else # define __HAVE_FLOAT128 0 #endif Fixes: - http://autobuild.buildroot.org/results/5c9dd8fb3b6a128882b6250f197c80232d8a3b53 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Signed-off-by: Andrew Geissler <geissonator@yahoo.com> Co-authored-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
* Update powerpc sysv assembly for ffi_powerpc.h changes (#541)Samuel Holland2020-02-211-7/+5
| | | | | Some of the flag bits were moved when adding powerpc64 vector support. Fixes #536
* powerpc64: Use memcpy to help platforms with no __int128. (#534)Khem Raj2019-12-071-4/+4
| | | Signed-off-by: Khem Raj <raj.khem@gmail.com>
* Address platforms with no __int128.Anthony Green2019-11-291-2/+2
|
* powerpc: fix build failure on power7 and older (#532)Sergei Trofimovich2019-11-281-1/+1
| | | | | | | | | | | | | | | | Build failure looks as: ``` libtool: compile: powerpc-unknown-linux-gnu-gcc \ -O2 -mcpu=powerpc -mtune=powerpc -pipe ... -c src/powerpc/ffi.c ... In file included from src/powerpc/ffi.c:33: src/powerpc/ffi_powerpc.h:65:9: error: '__int128' is not supported on this target 65 | typedef __int128 float128; | ^~~~~~~~ ``` The fix avoids using __int128 in favour of aligned char[16]. Closes: https://github.com/libffi/libffi/issues/531 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* IEEE754 binary128 long double support for PowerPC64 (#526)Samuel Holland2019-11-176-52/+335
| | | | | | * powerpc: Adjust flags to make room for vector types * powerpc64 ELFv2 IEEE128 long double support
* PowerPC bugfixes (#520)Samuel Holland2019-10-083-28/+62
| | | | | | | | | | | | | | * powerpc: Silence warnings about unused labels * powerpc: Fix a couple of comments * powerpc: Fix alignment after float structs * powerpc: Don't pad rvalues copied from FP regs * powerpc: Add missing check in struct alignment * powerpc: Support homogeneous long double structs
* PowerPC64 ELFv1 fp arg fixesAlan Modra2018-05-021-16/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ELFv1 ABI says: "Single precision floating point values are mapped to the second word in a single doubleword" and also "Floating point registers f1 through f13 are used consecutively to pass up to 13 floating point values, one member aggregates passed by value containing a floating point value, and to pass complex floating point values". libffi wasn't expecting float args in the second word, and wasn't passing one member aggregates in fp registers. This patch fixes those problems, making use of the existing ELFv2 homogeneous aggregate support since a one element fp struct is a special case of an homogeneous aggregate. I've also set a flag when returning pointers that might be used one day. This is just a tidy since the ppc64 assembly support code currently doesn't test FLAG_RETURNS_64BITS for integer types.. * src/powerpc/ffi_linux64.c (discover_homogeneous_aggregate): Compile for ELFv1 too, handling single element aggregates. (ffi_prep_cif_linux64_core): Call discover_homogeneous_aggregate for ELFv1. Set FLAG_RETURNS_64BITS for FFI_TYPE_POINTER return. (ffi_prep_args64): Call discover_homogeneous_aggregate for ELFv1, and handle single element structs containing float or double as if the element wasn't wrapped in a struct. Store floats in second word of doubleword slot when big-endian. (ffi_closure_helper_LINUX64): Similarly.
* This patch enables FFI Go Closure on AIX.Tony Reix2017-05-174-9/+578
|
* Prefix ALIGN macros with FFI_Gregory Pakosz2017-04-273-22/+22
|
* [Darwin-ppc, build] Fixes for clang build.Iain Sandoe2016-05-261-3/+3
| | | | | | | clang is experimental on powerpc-darwin, but the changes are appropriate to cctools as as well. Use the 'official' simplified cmpwi insn, rather than the implied one accepted by cctools. Do not re-use a set value.
* Correct powerpc sysv stack argument accountingAlan Modra2015-08-031-109/+98
| | | | | | | | | | | | | | | | | ppc32 starts using the stack for integer arg passing when we run out of integer arg passing registers. Similarly, we start using the stack for floating point args when we run out of floating point registers. The decision on where an integer arg goes does not depend on number of floating point args, nor does the decision on where a floating point arg goes depend on number of integer args. Alignment of stack args also simply depends on number of stack args. This patch untangles the horrible mess we had, with intarg_count being wrongly used to count both integer args and stack words. * src/powerpc/ffi_sysv.c (ffi_prep_cif_sysv_core): Count fprs, gprs, and stack words separately. (ffi_prep_args_SYSV): Similarly.
* powerpc: Fix ffi_go_closure_linux64Richard Henderson2014-11-201-5/+1
| | | | | | | | | Unlike ffi_closure_LINUX64, this entry point is called normally, so we already have the TOC in R2 and the closure in R11. * powerpc/linux64_closure.S (ffi_closure_LINUX64): Remove a register dependency chain. (ffi_go_closure_linux64): Don't load r11 or r2.
* GO closures for powerpc linuxAlan Modra2014-11-209-313/+403
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Plus .cfi async unwind info, rearrangement of ffi_call_linux64 and ffi_call_SYSV function params to avoid register copies, tweaks to trampolines. * src/powerpc/ffitarget.h (FFI_GO_CLOSURES): Define. * src/powerpc/ffi.c (ffi_call_int): New function with extra closure param, and args rearranged on ffi_call_linux64 and ffi_call_SYSV calls, extracted from .. (ffi_call): ..here. (ffi_call_go, ffi_prep_go_closure): New functions. * src/powerpc/ffi_linux64.c (ffi_prep_closure_loc_linux64): Make hidden. Only flush insn part of ELFv2 trampoline. Don't shuffle ELFv1 trampoline. (ffi_closure_helper_LINUX64): Replace closure param with cif, fun, user_data params. * src/powerpc/ffi_powerpc.h (ffi_go_closure_sysv): Declare. (ffi_go_closure_linux64): Declare. (ffi_call_SYSV, fi_call_LINUX64): Update. (ffi_prep_closure_loc_sysv, ffi_prep_closure_loc_linux64): Declare. (ffi_closure_helper_SYSV, ffi_closure_helper_LINUX64): Update. * src/powerpc/ffi_sysv.c (ASM_NEEDS_REGISTERS): Increase to 6. (ffi_prep_closure_loc_sysv): Use bcl in trampoline, put data words last, flush just the insn part. (ffi_closure_helper_SYSV): Replace closure param with cif, fun and user_data params. * src/powerpc/linux64.S (ffi_call_LINUX64): Replace hand-written .eh_frame with .cfi directives. Adjust for changed param order. Pass extra "closure" param to user function in static chain. Add .cfi directives to describe epilogue. Don't provide traceback table for ELFv2 or _CALL_LINUX. * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Replace hand-written .eh_frame with .cfi directives. Adjust for changed ffi_closure_helper_LINUX64 params. Add .cfi directives to describe epilogue. Don't provide traceback table for ELFv2 or _CALL_LINUX. (ffi_go_closure_linux64): New function. * src/powerpc/sysv.S: Remove redundant .globl ffi_prep_args_SYSV. (ffi_call_SYSV): Make hidden. Replace hand-written .eh_frame with .cfi directives. Adjust for changed params. Pass extra "closure" param to user function in static chain. Add .cfi directives to describe epilogue. * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Make hidden. Replace hand-written .eh_frame with .cfi directives. Adjust for changed ffi_closure_helper_SYSV params. Add .cfi directives to describe epilogue. Don't just use nops in the dead __NO_FPRS__ epilogues. (ffi_go_closure_sysv): New function.
* Fix powerpc breakage from 6e8a4460Alan Modra2014-11-201-7/+18
| | | | | | | | * src/powerpc/ffitarget.h: #error on unexpected FFI_TYPE_LAST. (FFI_PPC_TYPE_LAST): Define. (FFI_TYPE_UINT128): Define in terms of FFI_PPC_TYPE_LAST. (FFI_SYSV_TYPE_SMALL_STRUCT, FFI_V2_TYPE_FLOAT_HOMOG): Likewise. (FFI_V2_TYPE_DOUBLE_HOMOG, FFI_V2_TYPE_SMALL_STRUCT): Likewise.
* powerpc: Delete patch outputRichard Henderson2014-11-131-391/+0
| | | | Clearly added by mistake.
* 2014-09-10 Jakub Jelinek <jakub@redhat.com>Jakub Jelinek2014-09-203-4/+397
| | | | | | * src/powerpc/linux64.S: Emit .note.GNU-stack even when POWERPC64 is not defined. * src/powerpc/linux64_closure.S: Likewise. Also test _CALL_ELF == 2.
* Linux/ppc64: Remove assumption on contents of r11 in closureMarcus Comstedt2014-01-042-1/+6
|
* This separates the 32-bit sysv/linux/bsd code from the 64-bit linuxAlan Modra2013-11-219-1762/+2074
| | | | | | | | | | | | | | | | code, and makes it possible to link code compiled with different options to those used to compile libffi. For example, a -mlong-double-128 libffi can be used with -mlong-double-64 code. Using the return value area as a place to pass parameters wasn't such a good idea, causing a failure of cls_ulonglong.c. I didn't see this when running the mainline gcc libffi testsuite because that version of the test is inferior to the upstreamm libffi test. Using NUM_FPR_ARG_REGISTERS rather than NUM_FPR_ARG_REGISTERS64 meant that a parameter save area could be allocated before it was strictly necessary. Wrong but harmless. Found when splitting apart ffi.c into 32-bit and 64-bit support.
* Fix PowerPC Darwin FDE encodings to use pcrel correctly. Modernise the ↵Iain Sandoe2013-11-182-26/+16
| | | | picbase labels.
* An #endif in the wrong place would cause compile failure on powerpcle.Alan Modra2013-11-181-2/+2
| | | | | Using bl instead of b doesn't cause runtime failures as you might think, but does mess the processor branch prediction.
* Finally, this adds _CALL_ELF == 2 support. ELFv1 objects can't beAlan Modra2013-11-164-59/+476
| | | | | | | linked with ELFv2 objects, so this is one case where preprocessor tests in ffi.c are fine. Also, there is no need to define a new FFI_ELFv2 or somesuch value in enum ffi_abi. FFI_LINUX64 will happily serve both ABIs.
* Andreas' 2013-02-08 change reverted some breakage for struct returnAlan Modra2013-11-163-61/+46
| | | | | | | | | | | | | | | | | | | | | values from 2011-11-12, but in so doing reintroduced string instructions to sysv.S that are not supported on all powerpc variants. This patch properly copies the bounce buffer to destination in C code rather than in asm. I have tested this on powerpc64-linux, powerpc-linux and powerpc-freebsd. Well, the last on powerpc-linux by lying to configure with CC="gcc -m32 -msvr4-struct-return -mlong-double-64" \ CXX="g++ -m32 -msvr4-struct-return -mlong-double-64" \ /src/libffi-current/configure --build=powerpc-freebsd and then make && make CC="gcc -m32" CXX="g++ -m32" \ RUNTESTFLAGS=--target_board=unix/-m32/-msvr4-struct-return/-mlong-double-64\ check
* The powerpc64 ABIs align structs passed by value, a fact ignored byAlan Modra2013-11-161-0/+33
| | | | | | | | | | | gcc for quite some time. Since gcc now does the correct alignment, libffi needs to follow suit. This ought to be made selectable via a new abi value, and the #ifdefs removed from ffi.c along with many other #ifdefs present there and in assembly. I'll do that with a followup patch sometime. This is a revised version of https://sourceware.org/ml/libffi-discuss/2013/msg00162.html
* This patch prepares for ELFv2, where sizes of these areas change. ItAlan Modra2013-11-162-98/+102
| | | | also makes some minor changes to improve code efficiency.
* The powerpc64 support opted to pass floating point values both in theAlan Modra2013-11-162-45/+70
| | | | | | | | | | | | | fpr area and the parameter save area, necessary when the backend doesn't know if a function argument corresponds to the ellipsis arguments of a variadic function. This patch adds powerpc support for variadic functions, and changes the code to only pass fp in the ABI mandated area. ELFv2 needs this change since the parameter save area may not exist there. This also fixes two faulty tests that used a non-variadic function cast to call a variadic function, and spuriously reasoned that this is somehow necessary for static functions..
* Fix spelling errorsAnthony Green2013-10-083-3/+3
|
* little-endian ppc64 supportAnthony Green2013-07-023-3/+85
|
* Build fix for soft-float power targetsAnthony Green2013-03-161-1/+1
|
* Fix small struct passing on ppcAnthony Green2013-02-082-20/+47
|
* Fix many.c testcase for ppcAnthony Green2013-02-081-0/+6
|
* xlc compiler supportAnthony Green2013-01-112-10/+10
|
* fix build on ppc when long double == doublerofl0r2012-11-221-0/+2
|
* Rebase for ppc64 fixAnthony Green2012-10-312-4/+37
|
* Fix typo for darwin targetsAnthony Green2012-04-101-1/+1
|
* Repair ppc build regression.Anthony Green2012-04-031-7/+6
|
* More cygwin fixesAnthony Green2012-03-211-2/+2
|
* Rebase post GCC mergeAnthony Green2012-03-191-1/+3
|
* Ensure that users don't include ffitarget.h directlyAnthony Green2012-02-231-2/+8
|
* clean upAnthony Green2011-11-123-1670/+0
|
* Add powerpc soft float supportAnthony Green2011-11-127-263/+1980
|
* Remove use of ppc string instructionsAnthony Green2011-11-122-56/+47
|
* RebaseAnthony Green2011-11-121-3/+4
|
* Fix darwin EHAnthony Green2011-03-302-2/+2
|
* rc8. fix last patch.Anthony Green2011-02-251-1/+1
|