all: switch to LLVM 8

This commit is contained in:
Ayke van Laethem
2019-02-14 11:24:29 +01:00
committed by Ron Evans
parent 5569cd1b6b
commit 9c41011e17
14 changed files with 36 additions and 35 deletions
+3 -3
View File
@@ -70,7 +70,7 @@ commands:
jobs:
test-llvm7-go111:
test-llvm8-go111:
docker:
- image: circleci/golang:1.11
@@ -79,7 +79,7 @@ jobs:
- checkout
- submodules
- apt-dependencies:
llvm: "-7"
llvm: "-8"
- install-node
- restore_cache:
keys:
@@ -99,4 +99,4 @@ jobs:
workflows:
test-all:
jobs:
- test-llvm7-go111
- test-llvm8-go111
+1 -1
View File
@@ -13,4 +13,4 @@
[submodule "lib/compiler-rt"]
path = lib/compiler-rt
url = https://github.com/llvm-mirror/compiler-rt.git
branch = release_70
branch = release_80
+1 -1
View File
@@ -13,7 +13,7 @@ addons:
update: true
taps: ArmMbed/homebrew-formulae
packages:
- llvm@7
- llvm@8
- qemu
- arm-none-eabi-gcc
+4 -4
View File
@@ -30,9 +30,9 @@ on a different system like Mac.
The first step is to get the source code. Place it in some directory, assuming
`$HOME/src` here, but you can pick a different one of course:
git clone -b release_70 https://github.com/llvm-mirror/llvm.git $HOME/src/llvm
git clone -b release_70 https://github.com/llvm-mirror/clang.git $HOME/src/llvm/tools/clang
git clone -b release_70 https://github.com/llvm-mirror/lld.git $HOME/src/llvm/tools/lld
git clone -b release_80 https://github.com/llvm-mirror/llvm.git $HOME/src/llvm
git clone -b release_80 https://github.com/llvm-mirror/clang.git $HOME/src/llvm/tools/clang
git clone -b release_80 https://github.com/llvm-mirror/lld.git $HOME/src/llvm/tools/lld
go get -d github.com/tinygo-org/tinygo
cd $HOME/go/src/github.com/tinygo-org/tinygo
dep ensure -vendor-only # download dependencies
@@ -62,7 +62,7 @@ Make a build directory. LLVM requires out-of-tree builds:
Configure LLVM with CMake:
cmake -G Ninja ../llvm "-DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=AVR;WebAssembly" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=OFF -DLIBCLANG_BUILD_STATIC=ON
cmake -G Ninja ../llvm "-DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64;WebAssembly" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=AVR" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=OFF -DLIBCLANG_BUILD_STATIC=ON
You can also choose a different build system than Ninja, but Ninja is fast.
+7 -7
View File
@@ -1,10 +1,10 @@
# TinyGo base stage just installs LLVM 7 and the TinyGo compiler itself.
# TinyGo base stage just installs LLVM 8 and the TinyGo compiler itself.
FROM golang:latest AS tinygo-base
RUN wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add - && \
echo "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-7 main" >> /etc/apt/sources.list && \
echo "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main" >> /etc/apt/sources.list && \
apt-get update && \
apt-get install -y llvm-7-dev libclang-7-dev git
apt-get install -y llvm-8-dev libclang-8-dev git
RUN wget -O- https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
@@ -25,9 +25,9 @@ COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/src /go/src/github.
COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/targets /go/src/github.com/tinygo-org/tinygo/targets
RUN wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add - && \
echo "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-7 main" >> /etc/apt/sources.list && \
echo "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main" >> /etc/apt/sources.list && \
apt-get update && \
apt-get install -y libllvm7 lld-7
apt-get install -y libllvm8 lld-8
# tinygo-avr stage installs the needed dependencies to compile TinyGo programs for AVR microcontrollers.
FROM tinygo-base AS tinygo-avr
@@ -59,7 +59,7 @@ COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/lib /go/src/github.
RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
apt-get update && \
apt-get install -y apt-utils python3 make binutils-arm-none-eabi clang-7 && \
apt-get install -y apt-utils python3 make binutils-arm-none-eabi clang-8 && \
make gen-device-nrf && make gen-device-stm32 && \
apt-get remove -y python3 make && \
apt-get autoremove -y && \
@@ -74,7 +74,7 @@ COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/lib /go/src/github.
RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
apt-get update && \
apt-get install -y apt-utils python3 make binutils-arm-none-eabi clang-7 binutils-avr gcc-avr avr-libc && \
apt-get install -y apt-utils python3 make binutils-arm-none-eabi clang-8 binutils-avr gcc-avr avr-libc && \
make gen-device && \
apt-get remove -y python3 make && \
apt-get autoremove -y && \
Generated
+3 -3
View File
@@ -22,12 +22,12 @@
revision = "3744606dbb67b99c60d3f11cb10bd3f9e6dad472"
[[projects]]
branch = "master"
digest = "1:a6a25fd8906c74978f1ed811bc9fd3422da8093be863b458874b02a782b6ae3e"
branch = "llvm8"
digest = "1:bf5539bdf6b3cc3ec1e45926db05d81180da11ce722fa1edcce3f0b4e1967da5"
name = "tinygo.org/x/go-llvm"
packages = ["."]
pruneopts = "UT"
revision = "d5f730401f5069618b275a5241c6417eb0c38a65"
revision = "7707ae5d1261a8929edea7336c8087ca8b520d8d"
[solve-meta]
analyzer-name = "dep"
+1 -1
View File
@@ -1,5 +1,5 @@
[[constraint]]
branch = "master"
branch = "llvm8"
name = "tinygo.org/x/go-llvm"
[[constraint]]
+4 -4
View File
@@ -4,8 +4,8 @@ package main
// commands used by the compilation process might have different file names on Linux than those used on macOS.
var commands = map[string]string{
"ar": "llvm-ar-7",
"clang": "clang-7",
"ld.lld": "ld.lld-7",
"wasm-ld": "wasm-ld-7",
"ar": "llvm-ar-8",
"clang": "clang-8",
"ld.lld": "ld.lld-8",
"wasm-ld": "wasm-ld-8",
}
+3 -3
View File
@@ -5,7 +5,7 @@ package main
// commands used by the compilation process might have different file names on macOS than those used on Linux.
var commands = map[string]string{
"ar": "llvm-ar",
"clang": "clang-7",
"ld.lld": "ld.lld-7",
"wasm-ld": "wasm-ld-7",
"clang": "clang-8",
"ld.lld": "ld.lld-8",
"wasm-ld": "wasm-ld-8",
}
+1 -1
View File
@@ -13,7 +13,7 @@ import (
)
/*
#include <clang-c/Index.h> // if this fails, install libclang-7-dev
#include <clang-c/Index.h> // if this fails, install libclang-8-dev
#include <stdlib.h>
int tinygo_clang_visitor(CXCursor c, CXCursor parent, CXClientData client_data);
+2 -2
View File
@@ -3,9 +3,9 @@
package loader
/*
#cgo linux CFLAGS: -I/usr/lib/llvm-7/include
#cgo linux CFLAGS: -I/usr/lib/llvm-8/include
#cgo darwin CFLAGS: -I/usr/local/opt/llvm/include
#cgo linux LDFLAGS: -L/usr/lib/llvm-7/lib -lclang
#cgo linux LDFLAGS: -L/usr/lib/llvm-8/lib -lclang
#cgo darwin LDFLAGS: -L/usr/local/opt/llvm/lib -lclang -lffi
*/
import "C"
+1 -1
View File
@@ -2,7 +2,7 @@
"build-tags": ["tinygo.arm", "js", "wasm"],
"goos": "js",
"goarch": "wasm",
"compiler": "clang-7",
"compiler": "clang-8",
"gc": "marksweep",
"linker": "arm-none-eabi-ld",
"rtlib": "compiler-rt",
+4 -3
View File
@@ -3,14 +3,15 @@
"build-tags": ["js", "wasm"],
"goos": "js",
"goarch": "wasm",
"compiler": "clang-7",
"linker": "wasm-ld-7",
"compiler": "clang-8",
"linker": "wasm-ld-8",
"cflags": [
"--target=wasm32",
"-Oz"
],
"ldflags": [
"-allow-undefined"
"--allow-undefined",
"--export-all"
],
"emulator": ["node", "targets/wasm_exec.js"]
}