accelerate icon indicating copy to clipboard operation
accelerate copied to clipboard

Object file loading on Windows

Open tmcdonell opened this issue 7 years ago • 5 comments

The CPU backend is currently broken on windows because it lacks an object file loader (here).

This is the same as what GHCi does, but a bit simpler because we only need to handle the most basic types of relocations etc. Unfortunately we can't use that one due to GHC#13624 (unless that does not affect windows, but I doubt it)

Any windows hackers interested in writing one? @RyanGlScott

tmcdonell avatar Aug 23 '17 01:08 tmcdonell

@tmcdonell btw, I'm adding alignment support to Windows in https://phabricator.haskell.org/D3915 (along with memory protection), but I'm afraid I'll miss the 8.4 deadline for adding it, so it'll be only 8.6.

Mistuke avatar Nov 12 '17 16:11 Mistuke

Awesome! :+1:

tmcdonell avatar Nov 12 '17 22:11 tmcdonell

Looks like llvm-hs is adding bindings to load external object files (https://github.com/llvm-hs/llvm-hs/issues/189). Once that is in we can (hopefully) switch to that instead and drop our custom object file loaders.

tmcdonell avatar Mar 29 '18 02:03 tmcdonell

While working on another feature I've reimplemented accelerate-llvm's current dynamic linker using the operating system's own linker and dlopen(): https://github.com/robbert-vdh/accelerate-llvm/commit/272297ccdd8afa097a84904dc1e83914c44c7356

This still does not support Windows, but if this gets merged then it should be fairly trivial to provide another implementation of the Data.Array.Accelerate.LLVM.Native.Link.Posix module for Windows that uses mingw-w64's ld binary that ships with GHC, LoadLIbrary(), and GetProcAddress(). I thought it might be worth mentioning here in case anyone wants to pick this up.

robbert-vdh avatar Nov 27 '21 18:11 robbert-vdh

We've switched from using our own object file loader to using the system linker, so just need to update the code to use LoadLibrary and GetProcAddress on windows.

tmcdonell avatar Feb 20 '22 14:02 tmcdonell