aguinet/dragonffi

Support for non-x86?

Closed this issue · 8 comments

This is a great library, thank you.

I need to support ARM64 processors also running Linux. While it's not tested on that platform, is it expected to work? Or does extra code need to be written to support that platform?

In theory, Clang and LLVM support arm64 under Linux, so that should be possible.

I see three ways to give it a try:

  1. having a (powerful) linux box with an ARM64 CPU :)
  2. setup the whole thing using a qemu-based ARM64 debian system (for instance)
  3. cross compile DragonFFI/clang/llvm for Linux/ARM64 (aarch64-linux-gnu to be exact), and run binaries using qemu user mode.

I don't have personally access to 1). I think 2) can be done, but never tried it. 3) seems an interesting option!

I gave number 1 a shot (sorry, I cannot provide details on the hardware). I can happily confirm that the tests work and that the python binding works. I followed the instructions in the README, on ubuntu 16.04.

If I may ask.. what is the purpose of the patches to llvm5? I built the patched llvm and clang as documented, but I don't know anything about their internals, so the patch is rather mysterious!

It's nice to hear this :)

The patches are pretty simple: one make clang emit informations about the calling convention of functions, and the other makes the DWARF support in LLVM supports these CC. They are currently in the process of being reviewed/integrated in the LLVM trunk!

For the record, I tried option 3 (w/o the python bindings at first), and it looks like there's an issue where LLVM still detects the "native" target as x86-64. I've got to check if this can be easily patched or not.

My idea is that it would be nice if arm64 support could be integrated in travis this way, so that arm64/Linux could be officially supported!

Ok it actually works, at least for the library! (my cross-compiliation of clang/llvm was bad). To test the python bindings, I need to cross compile the Python interpreter (AFAIK, it's not in a standard debian mutli-arch environment).

I'll keep that open and will close it when at least the library will be tested w/ travis + qemu user mode!

#10 should do it. It was not that easy to make it work with Travis!

Validated and merged! Closing this issue!

In case you still uses DragonFFI with ARM64, I've just uploaded wheels for manylinux2014_aarch64, so you should be able to install DragonFFI simply with pip install pydffi under Linux/ARM64!