[LLVMdev] [llmdev] fail to process llvm generated assembly on windows/mingw32
Rafael EspĂndola
rafael.espindola at gmail.com
Sun Jan 26 21:08:35 PST 2014
On 26 January 2014 09:27, Carl <name.is.carl at gmail.com> wrote:
>
>
> Hello guys,
>
> I'm using llvm 3.3 on windows with mingw (triple: "i386-unknown-mingw32") to
> compile IR code that my
> program generates.
>
> I do it in two phases: first I emit assembly code and then assemble it.
>
> TargetMachine targetMachine =
> target.createTargetMachine(triple);
>
> targetMachine.setAsmVerbosityDefault(true);
> targetMachine.setFunctionSections(true);
> targetMachine.setDataSections(true);
> targetMachine.getOptions().setNoFramePointerElim(true);
> output.reset();
> targetMachine.emit(module, output,
> CodeGenFileType.AssemblyFile);
> module.dispose();
> context.dispose();
>
> byte[] asm = output.toByteArray();
> output.reset();
> asm = output.toByteArray();
>
> BufferedOutputStream oOut = new BufferedOutputStream(new
> FileOutputStream(oFile));
>
> targetMachine.assemble(asm, clazz.getClassName(), oOut);
> oOut.close();
>
> (I use a java binding for llvm)
>
> Unfortunately, the assemble call fails with the error:
>
> org.robovm.llvm.LlvmException: java.io.PrintWriter:478:2: error:
> unknown directive
> .section
> .text$java_io_PrintWriter_checkError__Z_lookup,"xr"
> ^
> java.io.PrintWriter:479:2: error: unknown directive
> .linkonce discard
> ^
The linkonce directive is coff only. Looks like the wrong asm parser
is being used.
Cheers,
Rafael
More information about the llvm-dev
mailing list