On Dec  5, 2020, Andreas Schwab <sch...@linux-m68k.org> wrote:

> ../../../../libffi/src/aarch64/ffi.c: In function 'ffi_prep_closure_loc':
> ../../../../libffi/src/aarch64/ffi.c:67:3: internal compiler error: in 
> emit_library_call_value_1, at calls.c:5300
>    67 |   __builtin___clear_cache (start, end);
>       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Is this still aarch64-linux-gnu -mabi=ilp32?  I'm afraid I couldn't
duplicate this error using a cross compiler (without binutils, but with
HAVE_AS_MABI_OPTION forced enabled), and many variants of a manually
minimized ffi.c (to build without libc):

static inline void
ffi_clear_cache (void *start, void *end)
{
  __builtin___clear_cache (start, end);
}

#define FFI_TRAMPOLINE_SIZE 24

typedef struct closure {
  char tramp[FFI_TRAMPOLINE_SIZE / sizeof (long)];
} ffi_closure;

void
ffi_prep_closure_loc (ffi_closure *closure)
{
  static const unsigned char trampoline[16] = {
    0x90, 0x00, 0x00, 0x58,     /* ldr  x16, tramp+16   */
    0xf1, 0xff, 0xff, 0x10,     /* adr  x17, tramp+0    */
    0x00, 0x02, 0x1f, 0xd6      /* br   x16             */
  };
  char *tramp = closure->tramp;
  __builtin_memcpy(tramp, trampoline, sizeof (trampoline));
  ffi_clear_cache(tramp, tramp + FFI_TRAMPOLINE_SIZE);
}


Once you confirm command line and target, I'll look into cross-building
a full toolchain, or using a machine from the compile farm.

Thanks,

-- 
Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
   Free Software Activist         GNU Toolchain Engineer
        Vim, Vi, Voltei pro Emacs -- GNUlius Caesar

Reply via email to