Hash :
0de3277b
Author :
Date :
2012-12-03T00:02:31
Testsuite fixes (was Re: [PATCH] Fix libffi on m68k-linux-gnu, completely) Dixi quod… >although I believe some 3.0.11 checks to be broken: And indeed, with a few minor changes on top of git master, I still get a full run of PASS plus one XPASS on amd64-linux! With the other patches (from this message’s parent) and these applied, I get a full PASS on m68k-linux as well. So, please git am these three diffs ☺ bye, //mirabilos -- FWIW, I'm quite impressed with mksh interactively. I thought it was much *much* more bare bones. But it turns out it beats the living hell out of ksh93 in that respect. I'd even consider it for my daily use if I hadn't wasted half my life on my zsh setup. :-) -- Frank Terbeck in #!/bin/mksh From 5cb15a3bad1f0fb360520dd48bfc938c821cdcca Mon Sep 17 00:00:00 2001 From: Thorsten Glaser <tg@mirbsd.org> Date: Sun, 2 Dec 2012 23:20:56 +0000 Subject: [PATCH 1/2] Fix tests writing to a closure retval via pointer casts As explained in <Pine.BSM.4.64L.1212022014490.23442@herc.mirbsd.org> all other tests that do the same cast to an ffi_arg pointer instead. PASS on amd64-linux (Xen domU) and m68k-linux (ARAnyM) Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
/* Area: closure_call
Purpose: Test anonymous unsigned char argument.
Limitations: none.
PR: none.
Originator: ARM Ltd. */
/* { dg-do run } */
#include "ffitest.h"
typedef unsigned char T;
static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
void* userdata __UNUSED__)
{
*(ffi_arg *)resp = *(T *)args[0];
printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]);
}
typedef T (*cls_ret_T)(T, ...);
int main (void)
{
ffi_cif cif;
void *code;
ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[3];
T res;
cl_arg_types[0] = &ffi_type_uchar;
cl_arg_types[1] = &ffi_type_uchar;
cl_arg_types[2] = NULL;
/* Initialize the cif */
CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
&ffi_type_uchar, cl_arg_types) == FFI_OK);
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK);
res = ((((cls_ret_T)code)(67, 4)));
/* { dg-output "67: 67 4" } */
printf("res: %d\n", res);
/* { dg-output "\nres: 67" } */
exit(0);
}