src/ia64/unix.S


Log

Author Commit Date CI Message
Sergei Trofimovich b58caef7 2018-02-17T19:00:40 ia64: fix small struct return This change fixes libffi.call/struct10.c failure on ia64: FAIL: libffi.call/struct10.c -W -Wall -Wno-psabi -O0 execution test .Lst_small_struct handles returns for structs less than 32 bytes (following ia64 return value ABI [1]). Subroutine does roughly the following: ``` mov [sp+0] = r8 mov [sp+8] = r9 mov [sp+16] = r10 mov [sp+24] = r11 memcpy(destination, source=sp, 12); ``` The problem: ia64 ABI guarantees that top 16 bytes of stack are scratch space for callee function. Thus it can clobber it. [1] says (7.1 Procedure Frames): """ * Scratch area. This 16-byte region is provided as scratch storage for procedures that are called by the current procedure. Leaf procedures do not need to allocate this region. A procedure may use the 16 bytes at the top of its own frame as scratch memory, but the contents of this area are not preserved by a procedure call. """ In our case 16 top bytes are clobbered by a PLT resolver when memcpy() is called for the first time. As a result memcpy implementation reads already clobbered data frop top of stack. The fix is simple: allocate 16 bytes of scrats space prior to memcpy() call. [1]: https://www.intel.com/content/dam/www/public/us/en/documents/guides/itanium-software-runtime-architecture-guide.pdf Bug: https://bugs.gentoo.org/634190 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Sergei Trofimovich ed7488c0 2017-10-17T13:00:51 src/ia64/unix.S: unbreak small struct handling commit 6e8a4460833594d5af1b4539178025da0077df19 added FFI_TYPE_COMPLEX value type (comes after FFI_TYPE_POINTER) ia64 ffi_closure_unix reiles on the ordering of FFI_ enums as ia64 has ia64-specific FFI types: small struct and FPU extesions. As a result all tests handling small structs broke. The change fixes dispatch table by adding (no-op) FFI_TYPE_COMPLEX entry This has positive effect of unbreaking most tests on ia64: === libffi Summary === -# of expected passes 1595 -# of unexpected failures 295 +# of expected passes 1930 +# of unexpected failures 10 # of unsupported tests 30 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Anthony Green c6dddbd0 2009-10-04T08:11:33 Initial commit