[Haskell-cafe] Will GHC 6.14 with LLVM use LLVM C compiler to compile external C Libraries

John Lask jvlask at hotmail.com
Thu Sep 9 20:08:52 EDT 2010

I am not that familiar with LLVM, if anything it complicates matters, 
rather than making things easier.

"The llvm-ld program has limited support for native code generation, 
when using the -native or -native-cbe options. Native code generation is 
performed by converting the linked bitcode into native assembly (.s) or 
C code and running the system compiler (typically gcc) on the result."

so it seems that the gcc support infrastructure that is currently 
integrated into ghc will still be required. Then the question arises 
what library formats will ghc use under the circumstances ?(.bc, .a) and 
how will the two be integrated?

On windows, most c/c++ public domain libraries are either compiled with 
ms-c or gcc which have their standard library formats. which in many 
cases come pre-compiled with the libraries. Becuase of this I would 
assume retention of the .a format, but perhaps compiling haskell to .bc 
would offer opportunities for link time optimisation?

In fact I would like a lot more information on what is being proposed 
with respect of a LLVM backend and any changes to the compiler tool chain.

> Since GHC 6.14 will (hopefully) be use LLVM as a default backend, an
> idea has occured to me
> Should GHC also use the clang (C/C++->LLVM compiler) on external C
> library sources which are used with certain Haskell packages (such as
> gtk) when LLVM does become a default backend for GHC. The consensus is
> that since Clang will also produce LLVM 'assembler', it can be very
> easily linked with the LLVM 'assembler' produced by GHC's LLVM backend,
> making the process of using external C sources a lot easier. Parts of
> Clang required could even be integrated into GHC (although this may be
> tricky since its coded in C++). It should also hopefully make using
> Haskell packages on windows that use C sources less painful
> Clang could also make using FFI with C++ much easier (for reasons stated
> above)
> Thoughts?
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list