change gow prefix to g prefix

This commit is contained in:
Loic Gelle 2017-06-27 10:09:39 -07:00
parent eb5de09ac2
commit 722c3536ad
3 changed files with 26 additions and 20 deletions

View File

@ -5,6 +5,12 @@ build:
install: build install: build
go install go install
ln -f -s $(GOROOT)/bin/gowllvm $(GOROOT)/bin/gowclang ln -f -s $(GOROOT)/bin/gllvm $(GOROOT)/bin/gclang
ln -f -s $(GOROOT)/bin/gowllvm $(GOROOT)/bin/gowclang++ ln -f -s $(GOROOT)/bin/gllvm $(GOROOT)/bin/gclang++
ln -f -s $(GOROOT)/bin/gowllvm $(GOROOT)/bin/gowextract ln -f -s $(GOROOT)/bin/gllvm $(GOROOT)/bin/get-bc
clean:
go clean
rm $(GOROOT)/bin/gclang
rm $(GOROOT)/bin/gclang++
rm $(GOROOT)/bin/get-bc

View File

@ -64,8 +64,8 @@ make install
Usage Usage
----- -----
gowllvm includes three symlinks to the program's binary: `gowclang` and gowllvm includes three symlinks to the program's binary: `gclang` and
`gowclang++`to compile C and C++, and an auxiliary tool `gowextract` for `gclang++`to compile C and C++, and an auxiliary tool `get-bc` for
extracting the bitcode from a build product (object file, executable, library extracting the bitcode from a build product (object file, executable, library
or archive). or archive).
@ -86,8 +86,8 @@ Some useful environment variables are listed here:
variable. variable.
Example `GOWLLVM_TOOLS_PATH=/home/user/llvm_and_clang/Debug+Asserts/bin`. Example `GOWLLVM_TOOLS_PATH=/home/user/llvm_and_clang/Debug+Asserts/bin`.
* `GOWLLVM_CONFIGURE_ONLY` can be set to anything. If it is set, `gowclang` * `GOWLLVM_CONFIGURE_ONLY` can be set to anything. If it is set, `gclang`
and `gowclang++` behave like a normal C or C++ compiler. They do not and `gclang++` behave like a normal C or C++ compiler. They do not
produce bitcode. Setting `GOWLLVM_CONFIGURE_ONLY` may prevent configuration produce bitcode. Setting `GOWLLVM_CONFIGURE_ONLY` may prevent configuration
errors caused by the unexpected production of hidden bitcode files. It is errors caused by the unexpected production of hidden bitcode files. It is
sometimes required when configuring a build. sometimes required when configuring a build.
@ -101,7 +101,7 @@ environment variable `GOWLLVM_BC_STORE` is set to the absolute path of
an existing directory, then gowllvm will copy the produced bitcode files an existing directory, then gowllvm will copy the produced bitcode files
into that directory. The name of a copied bitcode file is the hash of the path into that directory. The name of a copied bitcode file is the hash of the path
to the original bitcode file. For convenience, when using both the manifest to the original bitcode file. For convenience, when using both the manifest
feature of `gowextract` and the store, the manifest will contain both the feature of `get-bc` and the store, the manifest will contain both the
original path, and the store path. original path, and the store path.
Building a bitcode module with clang Building a bitcode module with clang
@ -110,13 +110,13 @@ Building a bitcode module with clang
``` ```
tar xf pkg-config-0.26.tar.gz tar xf pkg-config-0.26.tar.gz
cd pkg-config-0.26 cd pkg-config-0.26
CC=gowclang ./configure CC=gclang ./configure
make make
``` ```
This should produce the executable `pkg-config`. To extract the bitcode: This should produce the executable `pkg-config`. To extract the bitcode:
``` ```
gowextract pkg-config get-bc pkg-config
``` ```
which will produce the bitcode module `pkg-config.bc`. which will produce the bitcode module `pkg-config.bc`.
@ -129,17 +129,17 @@ Building bitcode archive
tar -xvf bullet-2.81-rev2613.tgz tar -xvf bullet-2.81-rev2613.tgz
mkdir bullet-bin mkdir bullet-bin
cd bullet-bin cd bullet-bin
CC=gowclang CXX=gowclang++ cmake ../bullet-2.81-rev2613/ CC=gclang CXX=gclang++ cmake ../bullet-2.81-rev2613/
make make
# Produces src/LinearMath/libLinearMath.bca # Produces src/LinearMath/libLinearMath.bca
gowextract src/LinearMath/libLinearMath.a get-bc src/LinearMath/libLinearMath.a
``` ```
Note that by default extracting bitcode from an archive produces an archive of Note that by default extracting bitcode from an archive produces an archive of
bitcode. You can also extract the bitcode directly into a module: bitcode. You can also extract the bitcode directly into a module:
``` ```
gowextract -b src/LinearMath/libLinearMath.a get-bc -b src/LinearMath/libLinearMath.a
``` ```
produces `src/LinearMath/libLinearMath.a.bc`. produces `src/LinearMath/libLinearMath.a.bc`.
@ -152,8 +152,8 @@ is during configuration, where the production of unexpected files can confuse
the configure script. For this we have a flag `GOWLLVM_CONFIGURE_ONLY` which the configure script. For this we have a flag `GOWLLVM_CONFIGURE_ONLY` which
can be used as follows: can be used as follows:
``` ```
GOWLLVM_CONFIGURE_ONLY=1 CC=gowclang ./configure GOWLLVM_CONFIGURE_ONLY=1 CC=gclang ./configure
CC=gowclang make CC=gclang make
``` ```
@ -163,12 +163,12 @@ Building a bitcode archive then extracting the bitcode
``` ```
tar xvfz jansson-2.7.tar.gz tar xvfz jansson-2.7.tar.gz
cd jansson-2.7 cd jansson-2.7
CC=gowclang ./configure CC=gclang ./configure
make make
mkdir bitcode mkdir bitcode
cp src/.libs/libjansson.a bitcode cp src/.libs/libjansson.a bitcode
cd bitcode cd bitcode
gowextract libjansson.a get-bc libjansson.a
llvm-ar x libjansson.bca llvm-ar x libjansson.bca
ls -la ls -la
``` ```

View File

@ -12,11 +12,11 @@ func main() {
args = args[1:] args = args[1:]
switch callerName { switch callerName {
case "gowclang": case "gclang":
compile(args, "clang") compile(args, "clang")
case "gowclang++": case "gclang++":
compile(args, "clang++") compile(args, "clang++")
case "gowextract": case "get-bc":
extract(args) extract(args)
default: default:
log.Fatal("You should call gowllvm with a valid mode.") log.Fatal("You should call gowllvm with a valid mode.")