From 9c41011e176e00fc1ff8918ee61bc19bfd26ac0f Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Thu, 14 Feb 2019 11:24:29 +0100 Subject: [PATCH] all: switch to LLVM 8 --- .circleci/config.yml | 6 +++--- .gitmodules | 2 +- .travis.yml | 2 +- BUILDING.md | 8 ++++---- Dockerfile | 14 +++++++------- Gopkg.lock | 6 +++--- Gopkg.toml | 2 +- commands.go | 8 ++++---- commands_macos.go | 6 +++--- lib/compiler-rt | 2 +- loader/libclang.go | 2 +- loader/libclang_config.go | 4 ++-- targets/cortex-m.json | 2 +- targets/wasm.json | 7 ++++--- 14 files changed, 36 insertions(+), 35 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c681cd8a..be0cd83d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 diff --git a/.gitmodules b/.gitmodules index 0e29f9f1..899df8f8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/.travis.yml b/.travis.yml index af1d9d27..bfcbcf8d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ addons: update: true taps: ArmMbed/homebrew-formulae packages: - - llvm@7 + - llvm@8 - qemu - arm-none-eabi-gcc diff --git a/BUILDING.md b/BUILDING.md index d50eb28a..144e2c52 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -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. diff --git a/Dockerfile b/Dockerfile index 5896a999..46c102a1 100644 --- a/Dockerfile +++ b/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 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 && \ diff --git a/Gopkg.lock b/Gopkg.lock index d59f0ca8..bb576945 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -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" diff --git a/Gopkg.toml b/Gopkg.toml index d5c34d6a..7b02b555 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -1,5 +1,5 @@ [[constraint]] - branch = "master" + branch = "llvm8" name = "tinygo.org/x/go-llvm" [[constraint]] diff --git a/commands.go b/commands.go index 33eea1e8..8fb9d13d 100644 --- a/commands.go +++ b/commands.go @@ -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", } diff --git a/commands_macos.go b/commands_macos.go index c40a20de..bd14aa7b 100644 --- a/commands_macos.go +++ b/commands_macos.go @@ -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", } diff --git a/lib/compiler-rt b/lib/compiler-rt index a4cbb02b..5bc79797 160000 --- a/lib/compiler-rt +++ b/lib/compiler-rt @@ -1 +1 @@ -Subproject commit a4cbb02bca3b952117e9ccfbad8a485857f25935 +Subproject commit 5bc79797e1f9184f39e1bd30fac75d995b72cea3 diff --git a/loader/libclang.go b/loader/libclang.go index fe7db21d..3b0ce4f2 100644 --- a/loader/libclang.go +++ b/loader/libclang.go @@ -13,7 +13,7 @@ import ( ) /* -#include // if this fails, install libclang-7-dev +#include // if this fails, install libclang-8-dev #include int tinygo_clang_visitor(CXCursor c, CXCursor parent, CXClientData client_data); diff --git a/loader/libclang_config.go b/loader/libclang_config.go index 5a8e2b2a..ece35a5a 100644 --- a/loader/libclang_config.go +++ b/loader/libclang_config.go @@ -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" diff --git a/targets/cortex-m.json b/targets/cortex-m.json index 7cae5d9b..cc09e0d6 100644 --- a/targets/cortex-m.json +++ b/targets/cortex-m.json @@ -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", diff --git a/targets/wasm.json b/targets/wasm.json index 7a497ccc..08d33420 100644 --- a/targets/wasm.json +++ b/targets/wasm.json @@ -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"] }