Skip to content

Commit

Permalink
Move to llvm 13.0
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Young <[email protected]>
  • Loading branch information
seanyoung committed Nov 18, 2021
1 parent f6bfb01 commit 9186266
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 68 deletions.
8 changes: 4 additions & 4 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ RUN apt-get update -y
RUN apt-get upgrade -y
RUN apt-get install -y libz-dev pkg-config libssl-dev git cmake ninja-build gcc g++ python3

RUN git clone --single-branch --branch solana-rustc/12.0-2021-04-15 \
RUN git clone --single-branch --branch solana-rustc/13.0-2021-08-08 \
https://github.com/solana-labs/llvm-project.git

WORKDIR /llvm-project

RUN cmake -G Ninja -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_TERMINFO=Off \
-DLLVM_ENABLE_PROJECTS=clang\;lld \
-DLLVM_TARGETS_TO_BUILD=WebAssembly\;BPF \
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=/llvm12.0 llvm
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=/llvm13.0 llvm

RUN cmake --build . --target install

Expand All @@ -31,6 +31,6 @@ RUN apt-get autoclean
# Get Rust
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain 1.53.0

COPY --from=builder /llvm12.0 /llvm12.0/
COPY --from=builder /llvm13.0 /llvm13.0/

ENV PATH="/llvm12.0/bin:/root/.cargo/bin:${PATH}"
ENV PATH="/llvm13.0/bin:/root/.cargo/bin:${PATH}"
48 changes: 24 additions & 24 deletions .github/workflows/build-llvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: llvm12.0-1
release_name: LLVM Libraries v12.0 (v1)
tag_name: llvm13.0-1
release_name: LLVM Libraries v13.0 (v1)
draft: false
prerelease: false

Expand All @@ -23,26 +23,26 @@ jobs:
runs-on: ubuntu-20.04
needs: create
steps:
- run: git clone --depth 1 --branch solana-rustc/12.0-2021-04-15 https://github.com/solana-labs/llvm-project.git
- run: git clone --depth 1 --branch solana-rustc/13.0-2021-08-08 https://github.com/solana-labs/llvm-project.git
- name: Install Ninja
uses: llvm/actions/install-ninja@main
- run: cmake -G Ninja -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_TERMINFO=Off
-DLLVM_ENABLE_PROJECTS='clang;lld'
-DLLVM_TARGETS_TO_BUILD='WebAssembly;BPF'
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm12.0 llvm
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm13.0 llvm
working-directory: ./llvm-project/
- run: cmake --build . --target install
working-directory: ./llvm-project/
- run: tar Jcf ./llvm12.0-linux-x86-64.tar.xz ./llvm12.0/
- run: tar Jcf ./llvm13.0-linux-x86-64.tar.xz ./llvm13.0/
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create.outputs.upload_url }}
asset_path: ./llvm12.0-linux-x86-64.tar.xz
asset_name: llvm12.0-linux-x86-64.tar.xz
asset_path: ./llvm13.0-linux-x86-64.tar.xz
asset_name: llvm13.0-linux-x86-64.tar.xz
asset_content_type: application/x-xz

mac-arm:
Expand All @@ -51,53 +51,53 @@ jobs:
runs-on: macos-arm
if: ${{ github.repository_owner == 'hyperledger-labs' }}
steps:
- run: git clone --depth 1 --branch solana-rustc/12.0-2021-04-15 https://github.com/solana-labs/llvm-project.git
- name: Install Ninja
uses: llvm/actions/install-ninja@main
- run: git clone --depth 1 --branch solana-rustc/13.0-2021-08-08 https://github.com/solana-labs/llvm-project.git
# - name: Install Ninja
# uses: llvm/actions/install-ninja@main
- run: arch -arm64 cmake -G Ninja -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_TERMINFO=Off
-DLLVM_ENABLE_PROJECTS='clang;lld'
-DLLVM_TARGETS_TO_BUILD='WebAssembly;BPF'
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm12.0 llvm
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm13.0 llvm
working-directory: ./llvm-project/
- run: arch -arm64 cmake --build . --target install
working-directory: ./llvm-project/
- run: tar Jcf ./llvm12.0-mac-arm.tar.xz ./llvm12.0/
- run: tar Jcf ./llvm13.0-mac-arm.tar.xz ./llvm13.0/
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create.outputs.upload_url }}
asset_path: ./llvm12.0-mac-arm.tar.xz
asset_name: llvm12.0-mac-arm.tar.xz
asset_path: ./llvm13.0-mac-arm.tar.xz
asset_name: llvm13.0-mac-arm.tar.xz
asset_content_type: application/x-xz

mac-intel:
name: Mac Intel
needs: create
runs-on: macos-latest
steps:
- run: git clone --depth 1 --branch solana-rustc/12.0-2021-04-15 https://github.com/solana-labs/llvm-project.git
- run: git clone --depth 1 --branch solana-rustc/13.0-2021-08-08 https://github.com/solana-labs/llvm-project.git
- name: Install Ninja
uses: llvm/actions/install-ninja@main
- run: cmake -G Ninja -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_TERMINFO=Off
-DLLVM_ENABLE_PROJECTS='clang;lld'
-DLLVM_TARGETS_TO_BUILD='WebAssembly;BPF'
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm12.0 llvm
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm13.0 llvm
working-directory: ./llvm-project/
- run: cmake --build . --target install
working-directory: ./llvm-project/
- run: tar Jcf ./llvm12.0-mac-intel.tar.xz ./llvm12.0/
- run: tar Jcf ./llvm13.0-mac-intel.tar.xz ./llvm13.0/
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create.outputs.upload_url }}
asset_path: ./llvm12.0-mac-intel.tar.xz
asset_name: llvm12.0-mac-intel.tar.xz
asset_path: ./llvm13.0-mac-intel.tar.xz
asset_name: llvm13.0-mac-intel.tar.xz
asset_content_type: application/x-xz

windows:
Expand All @@ -106,7 +106,7 @@ jobs:
runs-on: windows-latest
steps:
- run: Get-Volume
- run: git clone --depth 1 --branch solana-rustc/12.0-2021-04-15 https://github.com/solana-labs/llvm-project.git
- run: git clone --depth 1 --branch solana-rustc/13.0-2021-08-08 https://github.com/solana-labs/llvm-project.git
# We may not have enough space to compile llvm, see https://github.com/actions/virtual-environments/issues/326
working-directory: C:\
- name: Setup Windows
Expand All @@ -117,18 +117,18 @@ jobs:
uses: llvm/actions/install-ninja@main
- run: cmake -G Ninja -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_TERMINFO=Off
'-DLLVM_ENABLE_PROJECTS=clang;lld'
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=C:/llvm12.0 llvm
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=C:/llvm13.0 llvm
working-directory: C:\llvm-project
- run: cmake --build . --target install
working-directory: C:\llvm-project
- run: Compress-Archive -Path C:\llvm12.0 -DestinationPath C:\llvm12.0-win.zip
- run: Compress-Archive -Path C:\llvm13.0 -DestinationPath C:\llvm13.0-win.zip
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create.outputs.upload_url }}
asset_path: C:\llvm12.0-win.zip
asset_name: llvm12.0-win.zip
asset_path: C:\llvm13.0-win.zip
asset_name: llvm13.0-win.zip
asset_content_type: application/zip
4 changes: 2 additions & 2 deletions .github/workflows/ci-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v1
- run: docker build .github/ -t ghcr.io/hyperledger-labs/solang:ci .
- run: docker build -t ghcr.io/${GITHUB_REPOSITORY}:ci .github/
- name: Push to github container registry
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker push ghcr.io/hyperledger-labs/solang:ci
docker push ghcr.io/${GITHUB_REPOSITORY}:ci
48 changes: 24 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v2
- run: git clone --depth 1 --branch solana-rustc/12.0-2021-04-15 https://github.com/solana-labs/llvm-project.git
- run: git clone --depth 1 --branch solana-rustc/13.0-2021-08-08 https://github.com/solana-labs/llvm-project.git
- name: Install Ninja
uses: llvm/actions/install-ninja@main
- run: cmake -G Ninja -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_TERMINFO=Off
-DLLVM_ENABLE_PROJECTS='clang;lld'
-DLLVM_TARGETS_TO_BUILD='WebAssembly;BPF'
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm12.0 llvm
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm13.0 llvm
working-directory: ./llvm-project/
- run: cmake --build . --target install
working-directory: ./llvm-project/
- run: tar Jcf ./llvm12.0-linux-x86-64.tar.xz ./llvm12.0/
- run: tar Jcf ./llvm13.0-linux-x86-64.tar.xz ./llvm13.0/
- name: Upload llvm
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: llvm12.0-linux-x86-64.tar.xz
asset_name: llvm12.0-linux-x86-64.tar.xz
file: llvm13.0-linux-x86-64.tar.xz
asset_name: llvm13.0-linux-x86-64.tar.xz
tag: ${{ github.ref }}
- name: Add LLVM to Path
run: echo "$(pwd)/llvm12.0/bin" >> $GITHUB_PATH
run: echo "$(pwd)/llvm13.0/bin" >> $GITHUB_PATH
- name: Rust stable
run: rustup default 1.53.0
- name: Build
Expand All @@ -52,7 +52,7 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v2
- run: git clone --depth 1 --branch solana-rustc/12.0-2021-04-15 https://github.com/solana-labs/llvm-project.git
- run: git clone --depth 1 --branch solana-rustc/13.0-2021-08-08 https://github.com/solana-labs/llvm-project.git
# We may not have enough space to compile llvm, see https://github.com/actions/virtual-environments/issues/326
working-directory: C:\
- name: Setup Windows
Expand All @@ -63,20 +63,20 @@ jobs:
uses: llvm/actions/install-ninja@main
- run: cmake -G Ninja -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_TERMINFO=Off
'-DLLVM_ENABLE_PROJECTS=clang;lld'
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=C:/llvm12.0 llvm
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=C:/llvm13.0 llvm
working-directory: C:\llvm-project
- run: cmake --build . --target install
working-directory: C:\llvm-project
- run: Compress-Archive -Path C:\llvm12.0 -DestinationPath C:\llvm12.0-win.zip
- run: Compress-Archive -Path C:\llvm13.0 -DestinationPath C:\llvm13.0-win.zip
- name: Upload llvm
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: C:\llvm12.0-win.zip
asset_name: llvm12.0-win.zip
file: C:\llvm13.0-win.zip
asset_name: llvm13.0-win.zip
tag: ${{ github.ref }}
- name: Add LLVM to Path
run: echo "c:\llvm12.0\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
run: echo "c:\llvm13.0\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
- name: Build
run: cargo build --release --verbose
- name: Run tests
Expand All @@ -96,26 +96,26 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v2
- run: git clone --depth 1 --branch solana-rustc/12.0-2021-04-15 https://github.com/solana-labs/llvm-project.git
- run: git clone --depth 1 --branch solana-rustc/13.0-2021-08-08 https://github.com/solana-labs/llvm-project.git
- name: Install Ninja
uses: llvm/actions/install-ninja@main
- run: arch -arm64 cmake -G Ninja -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_TERMINFO=Off
-DLLVM_ENABLE_PROJECTS='clang;lld'
-DLLVM_TARGETS_TO_BUILD='WebAssembly;BPF'
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm12.0 llvm
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm13.0 llvm
working-directory: ./llvm-project/
- run: arch -arm64 cmake --build . --target install
working-directory: ./llvm-project/
- run: tar Jcf ./llvm12.0-mac-arm.tar.xz ./llvm12.0/
- run: tar Jcf ./llvm13.0-mac-arm.tar.xz ./llvm13.0/
- name: Upload llvm
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: llvm12.0-mac-arm.tar.xz
asset_name: llvm12.0-mac-arm.tar.xz
file: llvm13.0-mac-arm.tar.xz
asset_name: llvm13.0-mac-arm.tar.xz
tag: ${{ github.ref }}
- name: Add LLVM to Path
run: echo "$(pwd)/llvm12.0/bin" >> $GITHUB_PATH
run: echo "$(pwd)/llvm13.0/bin" >> $GITHUB_PATH
- name: Build
run: cargo build --release --verbose
- name: Run tests
Expand All @@ -134,26 +134,26 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v2
- run: git clone --depth 1 --branch solana-rustc/12.0-2021-04-15 https://github.com/solana-labs/llvm-project.git
- run: git clone --depth 1 --branch solana-rustc/13.0-2021-08-08 https://github.com/solana-labs/llvm-project.git
- name: Install Ninja
uses: llvm/actions/install-ninja@main
- run: cmake -G Ninja -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_TERMINFO=Off
-DLLVM_ENABLE_PROJECTS='clang;lld'
-DLLVM_TARGETS_TO_BUILD='WebAssembly;BPF'
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm12.0 llvm
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=../llvm13.0 llvm
working-directory: ./llvm-project/
- run: cmake --build . --target install
working-directory: ./llvm-project/
- run: tar Jcf ./llvm12.0-mac-intel.tar.xz ./llvm12.0/
- run: tar Jcf ./llvm13.0-mac-intel.tar.xz ./llvm13.0/
- name: Upload llvm
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: llvm12.0-mac-intel.tar.xz
asset_name: llvm12.0-mac-intel.tar.xz
file: llvm13.0-mac-intel.tar.xz
asset_name: llvm13.0-mac-intel.tar.xz
tag: ${{ github.ref }}
- name: Add LLVM to Path
run: echo "$(pwd)/llvm12.0/bin" >> $GITHUB_PATH
run: echo "$(pwd)/llvm13.0/bin" >> $GITHUB_PATH
- name: Build
run: cargo build --release --verbose
- name: Run tests
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ jobs:
# Make sure "git describe --tags" works for solang --version
fetch-depth: 0
- name: Download LLVM
run: curl -sSL -o c:\llvm.zip https://github.com/hyperledger-labs/solang/releases/download/v0.1.9/llvm12.0-win.zip
run: curl -sSL -o c:\llvm.zip https://github.com/hyperledger-labs/solang/releases/download/llvm13.0-1/llvm13.0-win.zip
- name: Extract LLVM
run: unzip c:\llvm.zip -d c:/
- name: Add LLVM to Path
run: echo "c:\llvm12.0\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
run: echo "c:\llvm13.0\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
# We run clippy on Linux in the lint job above, but this does not check #[cfg(windows)] items
- name: Run cargo clippy
run: cargo clippy --tests --bins -- -D warnings -D clippy::inconsistent-struct-constructor
Expand All @@ -84,11 +84,11 @@ jobs:
# Make sure "git describe --tags" works for solang --version
fetch-depth: 0
- name: Download LLVM
run: wget -q -O llvm12.0-mac-arm.tar.xz https://github.com/hyperledger-labs/solang/releases/download/v0.1.9/llvm12.0-mac-arm.tar.xz
run: wget -q -O llvm13.0-mac-arm.tar.xz https://github.com/hyperledger-labs/solang/releases/download/llvm13.0-1/llvm13.0-mac-arm.tar.xz
- name: Extract LLVM
run: tar Jxf llvm12.0-mac-arm.tar.xz
run: tar Jxf llvm13.0-mac-arm.tar.xz
- name: Add LLVM to Path
run: echo "$(pwd)/llvm12.0/bin" >> $GITHUB_PATH
run: echo "$(pwd)/llvm13.0/bin" >> $GITHUB_PATH
- name: Build
run: cargo build --verbose
- name: Run tests
Expand All @@ -108,11 +108,11 @@ jobs:
# Make sure "git describe --tags" works for solang --version
fetch-depth: 0
- name: Download LLVM
run: wget -q -O llvm12.0-mac-intel.tar.xz https://github.com/hyperledger-labs/solang/releases/download/v0.1.9/llvm12.0-mac-intel.tar.xz
run: wget -q -O llvm13.0-mac-intel.tar.xz https://github.com/hyperledger-labs/solang/releases/download/llvm13.0-1/llvm13.0-mac-intel.tar.xz
- name: Extract LLVM
run: tar Jxf llvm12.0-mac-intel.tar.xz
run: tar Jxf llvm13.0-mac-intel.tar.xz
- name: Add LLVM to Path
run: echo "$(pwd)/llvm12.0/bin" >> $GITHUB_PATH
run: echo "$(pwd)/llvm13.0/bin" >> $GITHUB_PATH
- name: Build
run: cargo build --verbose
- name: Run tests
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
All notable changes to [Solang](https://github.com/hyperledger-labs/solang/)
will be documented here.

## [Unreleased]

### Changed
- Solang now uses LLVM 13.0, based on the [Solana LLVM tree](https://github.com/solana-labs/llvm-project/)

## [0.1.9]

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ tiny-keccak = { version = "2.0", features = ["keccak"] }
serde_json = "1.0"
serde = "1.0"
serde_derive = { version = "1.0" }
inkwell = { version = "^0.1.0-beta.3", features = ["target-webassembly", "target-bpf", "no-libffi-linking", "llvm12-0"] }
inkwell = { version = "^0.1.0-beta.3", features = ["target-webassembly", "target-bpf", "no-libffi-linking", "llvm13-0"] }
blake2-rfc = "0.2.18"
phf = { version = "0.10", features = ["macros"] }
unicode-xid = "0.2.0"
Expand Down
Loading

0 comments on commit 9186266

Please sign in to comment.