https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71917
--- Comment #9 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- > I'll certainly check on this but I did run the fix on both big and little > endian MIPS which seems to suggest there isn't a double adjustment overall. So this was broken in 64-bit big-endian too before your fix? > Is there any definition for the raw API? I've seen some reference to > arguments being passed 'in the way a java stack works' but am not sure how > that relates to FFI return values passed in registers. Unfortunately, no, the raw API is undocumented. My understanding is that it's an API that bypasses all the promotions/demotions stuff, at least for targets that implement it natively (i.e. FFI_NATIVE_RAW_API defined, only x86 AFAICS). For other targets, java_raw_api.c contains the necessary glue code. In particular, you don't need to promote 32-bit return values to 64-bit ffi_arg with it because both ffi_java_rvalue_to_raw and ffi_java_raw_to_rvalue do the adjustments, at least in the 64-bit big-endian case. There might be something missing (an extension) for 64-bit little-endian for non-x86 targets.