src/ia64/ffitarget.h


Log

Author Commit Date CI Message
Sergei Trofimovich 11de69dd 2018-02-11T11:29:39 ia64: fix variadic function closures with FP arguments libffi test framework already flagged failures as: ``` FAIL: libffi.call/cls_double_va.c -W -Wall -Wno-psabi -O0 output pattern test, is 7.0 res: 4 0.0 res: 4 ? should match 7.0 ?es: 4 ?.0 res: 4 ``` Failure happens here at ```c // testsuite/libffi.call/cls_double_va.c ... char* format = "%.1f\n"; double doubleArg = 7; ... CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK); res = ((int(*)(char*, ...))(code))(format, doubleArg); ``` libffi expects 'doubleArg' to be located in 'f9' (second FP argument) but gcc placed it to 'r33' (second GR). ia64 software [1] manual described argument passing ABI in "8.5.2 Register Parameters" as: """ If an actual parameter is known to correspond to a floating-point formal parameter, the following rules apply: a) The actual parameter is passed in the next available floating-point parameter register, if one is available. Floating-point parameter registers are allocated as needed from the range f8-f15, starting with f8. b) If all available floating-point parameter registers have been used, the actual parameter is passed in the appropriate general register(s). (This case can occur only as a result of homogeneous floating-point aggregates, described below.) If a floating-point actual parameter is known to correspond to a variable-argument specification in the formal parameter list, the following rule applies: c) The actual parameter is passed in the appropriate general register(s). If the compiler cannot determine, at the point of call, whether the corresponding formal parameter is a varargs parameter, it must generate code that satisfies both of the above conditions. (The compiler’s determination may be based on prototype declarations, language standard assumptions, analysis, or other user options or information.) """ We have [c] case here and gcc uses only GR for parameter passing. The change binds known variadic arguments ro GRs instead of FPs as those are always expected to be initialized for all variadic call types. This fixes all 10 failures on ia64-unknown-linux-gnu: ``` === libffi Summary === -# of expected passes 1945 -# of unexpected failures 10 + +# of expected passes 1955 ``` [1]: https://www.intel.com/content/dam/www/public/us/en/documents/guides/itanium-software-runtime-architecture-guide.pdf Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Anthony Green 8360bf1c 2012-02-23T07:01:13 Ensure that users don't include ffitarget.h directly
Anthony Green d14178be 2010-07-23T09:14:00 FFI_LAST_ABI fix
Anthony Green c6dddbd0 2009-10-04T08:11:33 Initial commit