Your message dated Wed, 5 Aug 2020 17:48:37 +0200 with message-id <2f101c32-f493-066d-8bb9-233504bca093@debian.org> and subject line Re: ocaml-ctypes: FTBFS on mips64el: tests are failing has caused the Debian Bug report #841166, regarding ocaml-ctypes: FTBFS on mips64el: tests are failing to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact owner@bugs.debian.org immediately.) -- 841166: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841166 Debian Bug Tracking System Contact owner@bugs.debian.org with problems
--- Begin Message ---
- To: "submit@bugs.debian.org" <submit@bugs.debian.org>
- Subject: ocaml-ctypes: FTBFS on mips64el: tests are failing
- From: Daniel Knezevic <Daniel.Knezevic@imgtec.com>
- Date: Tue, 18 Oct 2016 08:21:44 +0000
- Message-id: <0A96475F12B40545AC867C341CA9DAB353674324@BADAG02.ba.imgtec.org>
--- ocaml-ctypes-0.7.0.orig/src/ctypes-foreign-base/ffi_call_stubs.c +++ ocaml-ctypes-0.7.0/src/ctypes-foreign-base/ffi_call_stubs.c @@ -256,9 +256,11 @@ value ctypes_add_argument(value callspec CAMLreturn(Val_int(offset)); } -static int ffi_return_type_promotes(ffi_type *f) +static int ffi_return_type_adjustment(ffi_type *f) { - /* libffi promotes integer return types that are smaller than a word */ +#ifdef ARCH_BIG_ENDIAN + /* An adjustment is needed (on bigendian systems) for integer types + less than the size of a word */ if (f->size < sizeof(ffi_arg)) { switch (f->type) { case FFI_TYPE_INT: @@ -270,21 +272,10 @@ static int ffi_return_type_promotes(ffi_ case FFI_TYPE_SINT32: case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: - return 1; + return sizeof(ffi_arg) - f->size; default: break; } } - return 0; -} - -static int ffi_return_type_adjustment(ffi_type *f) -{ -#ifdef ARCH_BIG_ENDIAN - /* An adjustment is needed (on bigendian systems) for integer types - less than the size of a word */ - if (ffi_return_type_promotes(f)) { - return sizeof(ffi_arg) - f->size; - } #endif return 0; } @@ -471,13 +462,51 @@ static void callback_handler_with_lock(f /* now store the return value */ assert (Tag_val(boxedfn) == Done); - if (ffi_return_type_promotes(cif->rtype)) { - *(ffi_arg *)ret = 0; - } - - argptr = CTYPES_FROM_PTR(ret + ffi_return_type_adjustment(cif->rtype)); + argptr = CTYPES_FROM_PTR(ret); caml_callback(Field(boxedfn, 0), argptr); + /* workaround for libffi api: small integers must be promoted to + * full word size (sign/zero extended) */ + if (cif->rtype->size < sizeof(ffi_arg)) { + int do_nothing = 0; + ffi_arg x; + switch (cif->rtype->type) { + case FFI_TYPE_INT: + x = *(int*)ret; + break; + case FFI_TYPE_UINT8: + x = *(uint8_t*)ret; + break; + case FFI_TYPE_SINT8: + x = *(int8_t*)ret; + break; + case FFI_TYPE_UINT16: + x = *(uint16_t*)ret; + break; + case FFI_TYPE_SINT16: + x = *(int16_t*)ret; + break; + case FFI_TYPE_UINT32: + x = *(uint32_t*)ret; + break; + case FFI_TYPE_SINT32: + x = *(int32_t*)ret; + break; + case FFI_TYPE_UINT64: + x = *(uint64_t*)ret; + break; + case FFI_TYPE_SINT64: + x = *(int64_t*)ret; + break; + default: + do_nothing = 1; + break; + } + if ( do_nothing == 0 ) { + *(ffi_arg*)ret = x; + } + } + CAMLreturn0; }
--- End Message ---
--- Begin Message ---
- To: 841166-done@bugs.debian.org
- Subject: Re: ocaml-ctypes: FTBFS on mips64el: tests are failing
- From: Stéphane Glondu <glondu@debian.org>
- Date: Wed, 5 Aug 2020 17:48:37 +0200
- Message-id: <2f101c32-f493-066d-8bb9-233504bca093@debian.org>
Version: 0.17.1-1 All tests are passing now on mips64el. Closing. Cheers, -- Stéphane
--- End Message ---