Skip to content

Instantly share code, notes, and snippets.

@junlarsen
Created March 7, 2020 20:14
Show Gist options
  • Save junlarsen/a026e9b66ca090783a90f97bd37bf741 to your computer and use it in GitHub Desktop.
Save junlarsen/a026e9b66ca090783a90f97bd37bf741 to your computer and use it in GitHub Desktop.
val triple = LLVM.LLVMGetDefaultTargetTriple()
val target = LLVM.LLVMGetFirstTarget()
val cpu = BytePointer("generic")
val features = BytePointer("")
val machine = LLVM.LLVMCreateTargetMachine(target, triple.string, cpu.string, features.string, 0, 0 ,0)
LLVM.LLVMSetModuleDataLayout(mod, LLVM.LLVMCreateTargetDataLayout(machine))
LLVM.LLVMSetTarget(mod, triple)
LLVM.LLVMTargetMachineEmitToFile(machine, mod, BytePointer("output.o"), LLVM.LLVMObjectFile, BytePointer())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment