all: switch to LLVM 8
Этот коммит содержится в:
родитель
5569cd1b6b
коммит
9c41011e17
14 изменённых файлов: 36 добавлений и 35 удалений
|
@ -70,7 +70,7 @@ commands:
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-llvm7-go111:
|
test-llvm8-go111:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/golang:1.11
|
- image: circleci/golang:1.11
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ jobs:
|
||||||
- checkout
|
- checkout
|
||||||
- submodules
|
- submodules
|
||||||
- apt-dependencies:
|
- apt-dependencies:
|
||||||
llvm: "-7"
|
llvm: "-8"
|
||||||
- install-node
|
- install-node
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
keys:
|
keys:
|
||||||
|
@ -99,4 +99,4 @@ jobs:
|
||||||
workflows:
|
workflows:
|
||||||
test-all:
|
test-all:
|
||||||
jobs:
|
jobs:
|
||||||
- test-llvm7-go111
|
- test-llvm8-go111
|
||||||
|
|
2
.gitmodules
предоставленный
2
.gitmodules
предоставленный
|
@ -13,4 +13,4 @@
|
||||||
[submodule "lib/compiler-rt"]
|
[submodule "lib/compiler-rt"]
|
||||||
path = lib/compiler-rt
|
path = lib/compiler-rt
|
||||||
url = https://github.com/llvm-mirror/compiler-rt.git
|
url = https://github.com/llvm-mirror/compiler-rt.git
|
||||||
branch = release_70
|
branch = release_80
|
||||||
|
|
|
@ -13,7 +13,7 @@ addons:
|
||||||
update: true
|
update: true
|
||||||
taps: ArmMbed/homebrew-formulae
|
taps: ArmMbed/homebrew-formulae
|
||||||
packages:
|
packages:
|
||||||
- llvm@7
|
- llvm@8
|
||||||
- qemu
|
- qemu
|
||||||
- arm-none-eabi-gcc
|
- arm-none-eabi-gcc
|
||||||
|
|
||||||
|
|
|
@ -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
|
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:
|
`$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_80 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_80 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/lld.git $HOME/src/llvm/tools/lld
|
||||||
go get -d github.com/tinygo-org/tinygo
|
go get -d github.com/tinygo-org/tinygo
|
||||||
cd $HOME/go/src/github.com/tinygo-org/tinygo
|
cd $HOME/go/src/github.com/tinygo-org/tinygo
|
||||||
dep ensure -vendor-only # download dependencies
|
dep ensure -vendor-only # download dependencies
|
||||||
|
@ -62,7 +62,7 @@ Make a build directory. LLVM requires out-of-tree builds:
|
||||||
|
|
||||||
Configure LLVM with CMake:
|
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.
|
You can also choose a different build system than Ninja, but Ninja is fast.
|
||||||
|
|
||||||
|
|
14
Dockerfile
14
Dockerfile
|
@ -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
|
FROM golang:latest AS tinygo-base
|
||||||
|
|
||||||
RUN wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add - && \
|
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 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
|
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
|
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 - && \
|
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 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.
|
# tinygo-avr stage installs the needed dependencies to compile TinyGo programs for AVR microcontrollers.
|
||||||
FROM tinygo-base AS tinygo-avr
|
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/ && \
|
RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
|
||||||
apt-get update && \
|
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 && \
|
make gen-device-nrf && make gen-device-stm32 && \
|
||||||
apt-get remove -y python3 make && \
|
apt-get remove -y python3 make && \
|
||||||
apt-get autoremove -y && \
|
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/ && \
|
RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
|
||||||
apt-get update && \
|
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 && \
|
make gen-device && \
|
||||||
apt-get remove -y python3 make && \
|
apt-get remove -y python3 make && \
|
||||||
apt-get autoremove -y && \
|
apt-get autoremove -y && \
|
||||||
|
|
6
Gopkg.lock
сгенерированный
6
Gopkg.lock
сгенерированный
|
@ -22,12 +22,12 @@
|
||||||
revision = "3744606dbb67b99c60d3f11cb10bd3f9e6dad472"
|
revision = "3744606dbb67b99c60d3f11cb10bd3f9e6dad472"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "llvm8"
|
||||||
digest = "1:a6a25fd8906c74978f1ed811bc9fd3422da8093be863b458874b02a782b6ae3e"
|
digest = "1:bf5539bdf6b3cc3ec1e45926db05d81180da11ce722fa1edcce3f0b4e1967da5"
|
||||||
name = "tinygo.org/x/go-llvm"
|
name = "tinygo.org/x/go-llvm"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
pruneopts = "UT"
|
pruneopts = "UT"
|
||||||
revision = "d5f730401f5069618b275a5241c6417eb0c38a65"
|
revision = "7707ae5d1261a8929edea7336c8087ca8b520d8d"
|
||||||
|
|
||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
branch = "master"
|
branch = "llvm8"
|
||||||
name = "tinygo.org/x/go-llvm"
|
name = "tinygo.org/x/go-llvm"
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
|
|
|
@ -4,8 +4,8 @@ package main
|
||||||
|
|
||||||
// commands used by the compilation process might have different file names on Linux than those used on macOS.
|
// commands used by the compilation process might have different file names on Linux than those used on macOS.
|
||||||
var commands = map[string]string{
|
var commands = map[string]string{
|
||||||
"ar": "llvm-ar-7",
|
"ar": "llvm-ar-8",
|
||||||
"clang": "clang-7",
|
"clang": "clang-8",
|
||||||
"ld.lld": "ld.lld-7",
|
"ld.lld": "ld.lld-8",
|
||||||
"wasm-ld": "wasm-ld-7",
|
"wasm-ld": "wasm-ld-8",
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
// commands used by the compilation process might have different file names on macOS than those used on Linux.
|
// commands used by the compilation process might have different file names on macOS than those used on Linux.
|
||||||
var commands = map[string]string{
|
var commands = map[string]string{
|
||||||
"ar": "llvm-ar",
|
"ar": "llvm-ar",
|
||||||
"clang": "clang-7",
|
"clang": "clang-8",
|
||||||
"ld.lld": "ld.lld-7",
|
"ld.lld": "ld.lld-8",
|
||||||
"wasm-ld": "wasm-ld-7",
|
"wasm-ld": "wasm-ld-8",
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit a4cbb02bca3b952117e9ccfbad8a485857f25935
|
Subproject commit 5bc79797e1f9184f39e1bd30fac75d995b72cea3
|
|
@ -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>
|
#include <stdlib.h>
|
||||||
|
|
||||||
int tinygo_clang_visitor(CXCursor c, CXCursor parent, CXClientData client_data);
|
int tinygo_clang_visitor(CXCursor c, CXCursor parent, CXClientData client_data);
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
package loader
|
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 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
|
#cgo darwin LDFLAGS: -L/usr/local/opt/llvm/lib -lclang -lffi
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"build-tags": ["tinygo.arm", "js", "wasm"],
|
"build-tags": ["tinygo.arm", "js", "wasm"],
|
||||||
"goos": "js",
|
"goos": "js",
|
||||||
"goarch": "wasm",
|
"goarch": "wasm",
|
||||||
"compiler": "clang-7",
|
"compiler": "clang-8",
|
||||||
"gc": "marksweep",
|
"gc": "marksweep",
|
||||||
"linker": "arm-none-eabi-ld",
|
"linker": "arm-none-eabi-ld",
|
||||||
"rtlib": "compiler-rt",
|
"rtlib": "compiler-rt",
|
||||||
|
|
|
@ -3,14 +3,15 @@
|
||||||
"build-tags": ["js", "wasm"],
|
"build-tags": ["js", "wasm"],
|
||||||
"goos": "js",
|
"goos": "js",
|
||||||
"goarch": "wasm",
|
"goarch": "wasm",
|
||||||
"compiler": "clang-7",
|
"compiler": "clang-8",
|
||||||
"linker": "wasm-ld-7",
|
"linker": "wasm-ld-8",
|
||||||
"cflags": [
|
"cflags": [
|
||||||
"--target=wasm32",
|
"--target=wasm32",
|
||||||
"-Oz"
|
"-Oz"
|
||||||
],
|
],
|
||||||
"ldflags": [
|
"ldflags": [
|
||||||
"-allow-undefined"
|
"--allow-undefined",
|
||||||
|
"--export-all"
|
||||||
],
|
],
|
||||||
"emulator": ["node", "targets/wasm_exec.js"]
|
"emulator": ["node", "targets/wasm_exec.js"]
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче