Skip to content
/ llvm Public
forked from nsf/gollvm

LLVM bindings for the Go programming language

License

Notifications You must be signed in to change notification settings

go-llvm/llvm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoLLVM

This project has moved to llvm.org. Any contributions or bug reports should be sent there. Please refer to the Go bindings readme for more information.

LLVM bindings for The Go Programming Language.

Build Status

Prerequisites

  • Go 1.2+.
  • CMake (to build LLVM).

The author has only built and tested with Linux, but there is no particular reason why GoLLVM should not work with other operating systems.

Building LLVM

The development version of GoLLVM is tied to a specific revision of LLVM SVN trunk. We also make releases which are synchronized with LLVM releases. Those releases are available in branches named vMN, where M is the major number of the LLVM release and N is the minor number.

The script update\_llvm.sh in this directory can be used to build the required revision of LLVM and prepare it to be used by GoLLVM. If you receive an error message from go build like this:

./analysis.go:4:84: fatal error: llvm-c/Analysis.h: No such file or directory
 #include <llvm-c/Analysis.h> // If you are getting an error here read README.md

or like this:

./llvm_dep.go:5: undefined: run_update_llvm_sh_to_get_revision_NNNNNN

it means that LLVM needs to be built or updated by running the script.

$ ./update_llvm.sh

Any command line arguments supplied to the script are passed to LLVM's CMake build system. A good set of arguments to use during development are:

$ ./update_llvm.sh -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD=host -DBUILD_SHARED_LIBS=ON

Note that CMake keeps a cache of build settings so once you have built LLVM there is no need to pass these arguments again after updating.

Alternatively, you can build LLVM yourself or use a version provided by your distribution, but you must then set the CGO_CFLAGS and CGO_LDFLAGS environment variables:

$ export CGO_CFLAGS=`llvm-config --cflags`
$ export CGO_LDFLAGS="`llvm-config --ldflags` -Wl,-L`llvm-config --libdir` -lLLVM-`llvm-config --version`"
$ go get -tags byollvm github.com/go-llvm/llvm

About

LLVM bindings for the Go programming language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 84.3%
  • C++ 9.6%
  • C 4.7%
  • Shell 1.4%