Dlang LLVM ERROR: Program used external function which could not be resolved
David Nadlinger via digitalmars-d-ldc
digitalmars-d-ldc at puremagic.com
Thu Jun 15 09:22:28 PDT 2017
On 15 Jun 2017, at 16:17, BARRE KEVIN via digitalmars-d-ldc wrote:
> I want try llvm tools :)
> for example compile D source in llvm source (.bc, .ll) and compile
> later with llc or execute with lli.
> it is possible ??
Using the LLVM tools is definitely possible – in fact, this is a large
part of what makes LLVM development so much easier than for the DMD
backend (and to some extent, also than GCC). Using llc should always
work just fine. What LDC does to produce an executable is more or less
equivalent to "llc -filetype=obj …", followed by a call to the system
linker which you can see using "ldc2 -v". I also regularly use the opt
tool to look at what individual optimizer passes do to a given piece of
code, and bugpoint for debugging LLVM crashes/miscompilations.
lli is a bit different to the usual compilation workflow in that it
literally executes the IR inside an interpreter. Thus, all the code that
relies on the program image (executable file)/globals/… as a concept
won't work. This includes the central druntime mechanics for module
registration and (probably) also garbage collection. Thus, lli might not
be the easiest thing to get started with, although it can definitely be
made to work if you work without druntime.
More information about the digitalmars-d-ldc