Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 35 additions & 29 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ commands:
- run:
name: "Install apt dependencies"
command: |
echo 'deb https://apt.llvm.org/buster/ llvm-toolchain-buster<<parameters.llvm>> main' | sudo tee /etc/apt/sources.list.d/llvm.list
echo 'deb https://apt.llvm.org/buster/ llvm-toolchain-buster-<<parameters.llvm>> main' | sudo tee /etc/apt/sources.list.d/llvm.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt-get update
sudo apt-get install \
llvm<<parameters.llvm>>-dev \
clang<<parameters.llvm>> \
libclang<<parameters.llvm>>-dev \
lld<<parameters.llvm>> \
llvm-<<parameters.llvm>>-dev \
clang-<<parameters.llvm>> \
libclang-<<parameters.llvm>>-dev \
lld-<<parameters.llvm>> \
gcc-arm-linux-gnueabihf \
gcc-aarch64-linux-gnu \
qemu-system-arm \
Expand All @@ -41,48 +41,51 @@ commands:
steps:
- restore_cache:
keys:
- llvm-source-9-v0
- llvm-source-10-v0
- run:
name: "Fetch LLVM source"
command: make llvm-source
- save_cache:
key: llvm-source-9-v0
key: llvm-source-10-v0
paths:
- llvm-project
build-wasi-libc:
steps:
- restore_cache:
keys:
- wasi-libc-sysroot-v1
- wasi-libc-sysroot-v2
- run:
name: "Build wasi-libc"
command: make wasi-libc
- save_cache:
key: wasi-libc-sysroot-v1
key: wasi-libc-sysroot-v2
paths:
- lib/wasi-libc/sysroot
test-linux:
parameters:
llvm:
type: string
steps:
- checkout
- submodules
- apt-dependencies:
llvm: "-9"
llvm: "<<parameters.llvm>>"
- install-node
- restore_cache:
keys:
- go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
- go-cache-v2-{{ checksum "go.mod" }}
- llvm-source-linux
- run: go install .
- run: go install -tags=llvm<<parameters.llvm>> .
- restore_cache:
keys:
- wasi-libc-sysroot-systemclang-v0
- wasi-libc-sysroot-systemclang-v1
- run: make wasi-libc
- save_cache:
key: wasi-libc-sysroot-systemclang-v0
key: wasi-libc-sysroot-systemclang-v1
paths:
- lib/wasi-libc/sysroot
- run: go test -v ./cgo ./compileopts ./interp ./transform .
- run: go test -v -tags=llvm<<parameters.llvm>> ./cgo ./compileopts ./interp ./transform .
- run: make gen-device -j4
- run: make smoketest
- save_cache:
Expand Down Expand Up @@ -117,7 +120,7 @@ commands:
- llvm-source-linux
- restore_cache:
keys:
- llvm-build-9-linux-v0-assert
- llvm-build-10-linux-v0-assert
- run:
name: "Build LLVM"
command: |
Expand All @@ -135,7 +138,7 @@ commands:
make ASSERT=1 llvm-build
fi
- save_cache:
key: llvm-build-9-linux-v0-assert
key: llvm-build-10-linux-v0-assert
paths:
llvm-build
- run: make ASSERT=1
Expand Down Expand Up @@ -176,7 +179,7 @@ commands:
- llvm-source-linux
- restore_cache:
keys:
- llvm-build-9-linux-v0
- llvm-build-10-linux-v0
- run:
name: "Build LLVM"
command: |
Expand All @@ -194,7 +197,7 @@ commands:
make llvm-build
fi
- save_cache:
key: llvm-build-9-linux-v0
key: llvm-build-10-linux-v0
paths:
llvm-build
- build-wasi-libc
Expand Down Expand Up @@ -239,17 +242,17 @@ commands:
- go-cache-macos-v2-{{ checksum "go.mod" }}
- restore_cache:
keys:
- llvm-source-9-macos-v0
- llvm-source-10-macos-v0
- run:
name: "Fetch LLVM source"
command: make llvm-source
- save_cache:
key: llvm-source-9-macos-v0
key: llvm-source-10-macos-v0
paths:
- llvm-project
- restore_cache:
keys:
- llvm-build-9-macos-v0
- llvm-build-10-macos-v0
- run:
name: "Build LLVM"
command: |
Expand All @@ -261,7 +264,7 @@ commands:
make llvm-build
fi
- save_cache:
key: llvm-build-9-macos-v0
key: llvm-build-10-macos-v0
paths:
llvm-build
- restore_cache:
Expand Down Expand Up @@ -310,17 +313,20 @@ jobs:
docker:
- image: circleci/golang:1.11-buster
steps:
- test-linux
test-llvm9-go112:
- test-linux:
llvm: "9"
test-llvm10-go112:
docker:
- image: circleci/golang:1.12-buster
steps:
- test-linux
test-llvm9-go113:
- test-linux:
llvm: "10"
test-llvm10-go113:
docker:
- image: circleci/golang:1.13-buster
steps:
- test-linux
- test-linux:
llvm: "10"
assert-test-linux:
docker:
- image: circleci/golang:1.13-stretch
Expand All @@ -344,8 +350,8 @@ workflows:
test-all:
jobs:
- test-llvm9-go111
- test-llvm9-go112
- test-llvm9-go113
- test-llvm10-go112
- test-llvm10-go113
- build-linux
- build-macos
- assert-test-linux
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# TinyGo base stage installs Go 1.13, LLVM 9 and the TinyGo compiler itself.
# TinyGo base stage installs Go 1.13, LLVM 10 and the TinyGo compiler itself.
FROM golang:1.13 AS tinygo-base

RUN wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add - && \
echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-9 main" >> /etc/apt/sources.list && \
echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-10 main" >> /etc/apt/sources.list && \
apt-get update && \
apt-get install -y llvm-9-dev libclang-9-dev git
apt-get install -y llvm-10-dev libclang-10-dev git

COPY . /tinygo

Expand All @@ -28,9 +28,9 @@ COPY --from=tinygo-base /tinygo/src /tinygo/src
COPY --from=tinygo-base /tinygo/targets /tinygo/targets

RUN wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add - && \
echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-9 main" >> /etc/apt/sources.list && \
echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-10 main" >> /etc/apt/sources.list && \
apt-get update && \
apt-get install -y libllvm9 lld-9
apt-get install -y libllvm10 lld-10

# tinygo-avr stage installs the needed dependencies to compile TinyGo programs for AVR microcontrollers.
FROM tinygo-base AS tinygo-avr
Expand Down Expand Up @@ -61,7 +61,7 @@ COPY --from=tinygo-base /tinygo/lib /tinygo/lib

RUN cd /tinygo/ && \
apt-get update && \
apt-get install -y apt-utils make clang-9 && \
apt-get install -y apt-utils make clang-10 && \
make gen-device-nrf && make gen-device-stm32

# tinygo-all stage installs the needed dependencies to compile TinyGo programs for all platforms.
Expand All @@ -73,7 +73,7 @@ COPY --from=tinygo-base /tinygo/lib /tinygo/lib

RUN cd /tinygo/ && \
apt-get update && \
apt-get install -y apt-utils make clang-9 binutils-avr gcc-avr avr-libc && \
apt-get install -y apt-utils make clang-10 binutils-avr gcc-avr avr-libc && \
make gen-device

CMD ["tinygo"]
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ LLD_SRC ?= $(LLVM_PROJECTDIR)/lld
ifneq (, $(shell command -v llvm-build/bin/clang 2> /dev/null))
CLANG ?= $(abspath llvm-build/bin/clang)
else
CLANG ?= clang-9
CLANG ?= clang-10
endif
ifneq (, $(shell command -v llvm-build/bin/llvm-ar 2> /dev/null))
LLVM_AR ?= $(abspath llvm-build/bin/llvm-ar)
else ifneq (, $(shell command -v llvm-ar-9 2> /dev/null))
LLVM_AR ?= llvm-ar-9
else ifneq (, $(shell command -v llvm-ar-10 2> /dev/null))
LLVM_AR ?= llvm-ar-10
else
LLVM_AR ?= llvm-ar
endif
ifneq (, $(shell command -v llvm-build/bin/llvm-nm 2> /dev/null))
LLVM_NM ?= $(abspath llvm-build/bin/llvm-nm)
else ifneq (, $(shell command -v llvm-nm-9 2> /dev/null))
LLVM_NM ?= llvm-nm-9
else ifneq (, $(shell command -v llvm-nm-10 2> /dev/null))
LLVM_NM ?= llvm-nm-10
else
LLVM_NM ?= llvm-nm
endif
Expand Down Expand Up @@ -53,7 +53,7 @@ endif

.PHONY: all tinygo test $(LLVM_BUILDDIR) llvm-source clean fmt gen-device gen-device-nrf gen-device-avr

LLVM_COMPONENTS = all-targets analysis asmparser asmprinter bitreader bitwriter codegen core coroutines coverage debuginfodwarf executionengine instrumentation interpreter ipo irreader linker lto mc mcjit objcarcopts option profiledata scalaropts support target
LLVM_COMPONENTS = all-targets analysis asmparser asmprinter bitreader bitwriter codegen core coroutines coverage debuginfodwarf executionengine frontendopenmp instrumentation interpreter ipo irreader linker lto mc mcjit objcarcopts option profiledata scalaropts support target

ifeq ($(OS),Windows_NT)
EXE = .exe
Expand Down Expand Up @@ -103,8 +103,8 @@ LLD_LIBS = $(START_GROUP) -llldCOFF -llldCommon -llldCore -llldDriver -llldELF -
# For static linking.
ifneq ("$(wildcard $(LLVM_BUILDDIR)/bin/llvm-config*)","")
CGO_CPPFLAGS=$(shell $(LLVM_BUILDDIR)/bin/llvm-config --cppflags) -I$(abspath $(LLVM_BUILDDIR))/tools/clang/include -I$(abspath $(CLANG_SRC))/include -I$(abspath $(LLD_SRC))/include
CGO_CXXFLAGS=-std=c++11
CGO_LDFLAGS+=$(LIBCLANG_PATH) -std=c++11 -L$(abspath $(LLVM_BUILDDIR)/lib) $(CLANG_LIBS) $(LLD_LIBS) $(shell $(LLVM_BUILDDIR)/bin/llvm-config --ldflags --libs --system-libs $(LLVM_COMPONENTS)) -lstdc++ $(CGO_LDFLAGS_EXTRA)
CGO_CXXFLAGS=-std=c++14
CGO_LDFLAGS+=$(LIBCLANG_PATH) -std=c++14 -L$(abspath $(LLVM_BUILDDIR)/lib) $(CLANG_LIBS) $(LLD_LIBS) $(shell $(LLVM_BUILDDIR)/bin/llvm-config --ldflags --libs --system-libs $(LLVM_COMPONENTS)) -lstdc++ $(CGO_LDFLAGS_EXTRA)
endif


Expand Down Expand Up @@ -148,7 +148,7 @@ gen-device-stm32: build/gen-device-svd

# Get LLVM sources.
$(LLVM_PROJECTDIR)/README.md:
git clone -b release/9.x https://github.com/llvm/llvm-project $(LLVM_PROJECTDIR)
git clone -b release/10.x https://github.com/llvm/llvm-project $(LLVM_PROJECTDIR)
llvm-source: $(LLVM_PROJECTDIR)/README.md

# Configure LLVM.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,4 @@ The original reasoning was: if [Python](https://micropython.org/) can run on mic

This project is licensed under the BSD 3-clause license, just like the [Go project](https://golang.org/LICENSE) itself.

Some code has been copied from the LLVM project and is therefore licensed under [a variant of the Apache 2.0 license](http://releases.llvm.org/9.0.0/LICENSE.TXT). This has been clearly indicated in the header of these files.
Some code has been copied from the LLVM project and is therefore licensed under [a variant of the Apache 2.0 license](http://releases.llvm.org/10.0.0/LICENSE.TXT). This has been clearly indicated in the header of these files.
12 changes: 4 additions & 8 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
steps:
- task: GoTool@0
inputs:
version: '1.13.8'
version: '1.13.8'
- checkout: self
- task: CacheBeta@0
displayName: Cache LLVM source
inputs:
key: llvm-source-9-windows-v0
key: llvm-source-10-windows-v0
path: llvm-project
- task: Bash@3
displayName: Download LLVM source
Expand All @@ -27,7 +27,7 @@ jobs:
- task: CacheBeta@0
displayName: Cache LLVM build
inputs:
key: llvm-build-9-windows-v0
key: llvm-build-10-windows-v0
path: llvm-build
- task: Bash@3
displayName: Build LLVM
Expand All @@ -37,10 +37,6 @@ jobs:
if [ ! -f llvm-build/lib/liblldELF.a ]
then
choco install ninja
# LLVM 9 cannot be built with MinGW 8.
# For details: https://reviews.llvm.org/D70266
choco uninstall mingw
choco install mingw --version=7.3.0
make llvm-build
fi
- task: Bash@3
Expand All @@ -51,7 +47,7 @@ jobs:
- task: CacheBeta@0
displayName: Cache wasi-libc sysroot
inputs:
key: wasi-libc-sysroot-v1
key: wasi-libc-sysroot-v2
path: lib/wasi-libc/sysroot
- task: Bash@3
displayName: Build wasi-libc
Expand Down
Loading