Skip to content

Commit

Permalink
Move to llvm16 (hyperledger-solang#1608)
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Young <[email protected]>
  • Loading branch information
seanyoung authored Dec 8, 2023
1 parent e6a2187 commit a960551
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 45 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
linux-x86-64:
name: Linux x86-64
runs-on: solang-ubuntu-latest
container: ghcr.io/hyperledger/solang-llvm:ci-6
container: ghcr.io/hyperledger/solang-llvm:ci-7
steps:
- name: Checkout sources
uses: actions/[email protected]
Expand All @@ -33,7 +33,7 @@ jobs:
name: Linux arm64
runs-on: linux-arm64
if: ${{ github.repository_owner == 'hyperledger' }}
container: ghcr.io/hyperledger/solang-llvm:ci-6
container: ghcr.io/hyperledger/solang-llvm:ci-7
steps:
- name: Checkout sources
uses: actions/[email protected]
Expand Down Expand Up @@ -62,11 +62,11 @@ jobs:
with:
submodules: recursive
- name: Download LLVM
run: curl -sSL -o c:\llvm.zip https://github.com/hyperledger/solang-llvm/releases/download/llvm15-1/llvm15.0-win.zip
run: curl -sSL -o c:\llvm.zip https://github.com/hyperledger/solang-llvm/releases/download/llvm16-0/llvm16.0-win.zip
- name: Extract LLVM
run: unzip c:\llvm.zip -d c:/
- name: Add LLVM to Path
run: echo "c:\llvm15.0\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
run: echo "c:\llvm16.0\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
- uses: dtolnay/[email protected]
with:
components: clippy
Expand All @@ -92,11 +92,11 @@ jobs:
submodules: recursive
- uses: dtolnay/[email protected]
- name: Get LLVM
run: curl -sSL --output llvm15.0-mac-arm.tar.xz https://github.com/hyperledger/solang-llvm/releases/download/llvm15-1/llvm15.0-mac-arm.tar.xz
run: curl -sSL --output llvm16.0-mac-arm.tar.xz https://github.com/hyperledger/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-arm.tar.xz
- name: Extract LLVM
run: tar Jxf llvm15.0-mac-arm.tar.xz
run: tar Jxf llvm16.0-mac-arm.tar.xz
- name: Add LLVM to Path
run: echo "$(pwd)/llvm15.0/bin" >> $GITHUB_PATH
run: echo "$(pwd)/llvm16.0/bin" >> $GITHUB_PATH
- name: Build
run: cargo build --release --verbose
- name: Run tests
Expand All @@ -122,11 +122,11 @@ jobs:
submodules: recursive
- uses: dtolnay/[email protected]
- name: Get LLVM
run: wget -q -O llvm15.0-mac-intel.tar.xz https://github.com/hyperledger/solang-llvm/releases/download/llvm15-1/llvm15.0-mac-intel.tar.xz
run: wget -q -O llvm16.0-mac-intel.tar.xz https://github.com/hyperledger/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-intel.tar.xz
- name: Extract LLVM
run: tar Jxf llvm15.0-mac-intel.tar.xz
run: tar Jxf llvm16.0-mac-intel.tar.xz
- name: Add LLVM to Path
run: echo "$(pwd)/llvm15.0/bin" >> $GITHUB_PATH
run: echo "$(pwd)/llvm16.0/bin" >> $GITHUB_PATH
- name: Build
run: cargo build --release --verbose
- name: Run tests
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
linux-x86-64:
name: Linux x86-64
runs-on: solang-ubuntu-latest
container: ghcr.io/hyperledger/solang-llvm:ci-6
container: ghcr.io/hyperledger/solang-llvm:ci-7
env:
RUSTFLAGS: -C instrument-coverage -C llvm-args=--instrprof-atomic-counter-update-all --cfg=coverage --cfg=trybuild_no_target
CARGO_INCREMENTAL: 0
Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
name: Linux Arm
runs-on: linux-arm64
if: ${{ github.repository_owner == 'hyperledger' }}
container: ghcr.io/hyperledger/solang-llvm:ci-6
container: ghcr.io/hyperledger/solang-llvm:ci-7
steps:
- name: Checkout sources
uses: actions/checkout@v3
Expand All @@ -137,11 +137,11 @@ jobs:
with:
submodules: recursive
- name: Download LLVM
run: curl -sSL -o c:\llvm.zip https://github.com/hyperledger/solang-llvm/releases/download/llvm15-1/llvm15.0-win.zip
run: curl -sSL -o c:\llvm.zip https://github.com/hyperledger/solang-llvm/releases/download/llvm16-0/llvm16.0-win.zip
- name: Extract LLVM
run: unzip c:\llvm.zip -d c:/
- name: Add LLVM to Path
run: echo "c:\llvm15.0\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
run: echo "c:\llvm16.0\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
# Use C:\ as D:\ might run out of space
- name: "Use C: for rust temporary files"
run: echo "CARGO_TARGET_DIR=C:\target" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Expand Down Expand Up @@ -173,11 +173,11 @@ jobs:
submodules: recursive
- uses: dtolnay/[email protected]
- name: Get LLVM
run: curl -sSL --output llvm15.0-mac-arm.tar.xz https://github.com/hyperledger/solang-llvm/releases/download/llvm15-1/llvm15.0-mac-arm.tar.xz
run: curl -sSL --output llvm16.0-mac-arm.tar.xz https://github.com/hyperledger/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-arm.tar.xz
- name: Extract LLVM
run: tar Jxf llvm15.0-mac-arm.tar.xz
run: tar Jxf llvm16.0-mac-arm.tar.xz
- name: Add LLVM to Path
run: echo "$(pwd)/llvm15.0/bin" >> $GITHUB_PATH
run: echo "$(pwd)/llvm16.0/bin" >> $GITHUB_PATH
- name: Build
run: cargo build --verbose
- name: Run tests
Expand All @@ -199,11 +199,11 @@ jobs:
submodules: recursive
- uses: dtolnay/[email protected]
- name: Get LLVM
run: wget -q -O llvm15.0-mac-intel.tar.xz https://github.com/hyperledger/solang-llvm/releases/download/llvm15-1/llvm15.0-mac-intel.tar.xz
run: wget -q -O llvm16.0-mac-intel.tar.xz https://github.com/hyperledger/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-intel.tar.xz
- name: Extract LLVM
run: tar Jxf llvm15.0-mac-intel.tar.xz
run: tar Jxf llvm16.0-mac-intel.tar.xz
- name: Add LLVM to Path
run: echo "$(pwd)/llvm15.0/bin" >> $GITHUB_PATH
run: echo "$(pwd)/llvm16.0/bin" >> $GITHUB_PATH
- name: Build
run: cargo build --verbose
- name: Run tests
Expand Down Expand Up @@ -254,7 +254,7 @@ jobs:
anchor:
name: Anchor Integration test
runs-on: solang-ubuntu-latest
container: ghcr.io/hyperledger/solang-llvm:ci-6
container: ghcr.io/hyperledger/solang-llvm:ci-7
needs: linux-x86-64
steps:
- name: Checkout sources
Expand Down Expand Up @@ -306,7 +306,7 @@ jobs:
solana:
name: Solana Integration test
runs-on: solang-ubuntu-latest
container: ghcr.io/hyperledger/solang-llvm:ci-6
container: ghcr.io/hyperledger/solang-llvm:ci-7
needs: linux-x86-64
steps:
- name: Checkout sources
Expand Down Expand Up @@ -477,7 +477,7 @@ jobs:
coverage:
runs-on: ubuntu-latest
name: Coverage report
container: ghcr.io/hyperledger/solang-llvm:ci-6
container: ghcr.io/hyperledger/solang-llvm:ci-7
needs: [linux-x86-64, solana, anchor, polkadot, polkadot-subxt, vscode]
env:
RUSTFLAGS: -C instrument-coverage -C llvm-args=--instrprof-atomic-counter-update-all --cfg=coverage --cfg=trybuild_no_target
Expand Down
4 changes: 2 additions & 2 deletions 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.2.0", features = ["target-webassembly", "no-libffi-linking", "llvm15-0"], optional = true }
inkwell = { version = "0.2.0", features = ["target-webassembly", "no-libffi-linking", "llvm16-0"], optional = true }
blake2-rfc = "0.2.18"
handlebars = "4.4"
contract-metadata = "3.2"
Expand All @@ -42,7 +42,7 @@ sha2 = "0.10"
ripemd = "0.1"
bitvec = "1"
funty = "2.0"
itertools = "0.11"
itertools = "0.12"
num-rational = "0.4"
indexmap = "2.0"
once_cell = "1.18"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/hyperledger/solang-llvm:ci-6 as builder
FROM ghcr.io/hyperledger/solang-llvm:ci-7 as builder

COPY . src
WORKDIR /src/stdlib/
Expand Down
22 changes: 11 additions & 11 deletions docs/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,40 +126,40 @@ Linux
~~~~~

A pre-built version of LLVM, specifically configured for Solang, is available at
`<https://github.com/hyperledger/solang-llvm/releases/download/llvm15-2/llvm15.0-linux-x86-64.tar.xz>`_ for x86 processors
and at `<https://github.com/hyperledger/solang-llvm/releases/download/llvm15-2/llvm15.0-linux-arm64.tar.xz>`_ for ARM.
`<https://github.com/hyperledger/solang-llvm/releases/download/llvm16-0/llvm16.0-linux-x86-64.tar.xz>`_ for x86 processors
and at `<https://github.com/hyperledger/solang-llvm/releases/download/llvm16-0/llvm16.0-linux-arm64.tar.xz>`_ for ARM.
After downloading, untar the file in a terminal and add it to your path.

.. code-block:: bash
tar Jxf llvm15.0-linux-x86-64.tar.xz
export PATH=$(pwd)/llvm15.0/bin:$PATH
tar Jxf llvm16.0-linux-x86-64.tar.xz
export PATH=$(pwd)/llvm16.0/bin:$PATH
Windows
~~~~~~~

A pre-built version of LLVM, specifically configured for Solang, is available at
`<https://github.com/hyperledger/solang-llvm/releases/download/llvm15-2/llvm15.0-win.zip>`_.
`<https://github.com/hyperledger/solang-llvm/releases/download/llvm16-0/llvm16.0-win.zip>`_.

After unzipping the file, add the bin directory to your path.

.. code-block:: batch
set PATH=%PATH%;C:\llvm15.0\bin
set PATH=%PATH%;C:\llvm16.0\bin
Mac
~~~

A pre-built version of LLVM for intel macs, is available at
`<https://github.com/hyperledger/solang-llvm/releases/download/llvm15-2/llvm15.0-mac-intel.tar.xz>`_ and for arm macs there is
`<https://github.com/hyperledger/solang-llvm/releases/download/llvm15-2/llvm15.0-mac-arm.tar.xz>`_. After downloading,
`<https://github.com/hyperledger/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-intel.tar.xz>`_ and for arm macs there is
`<https://github.com/hyperledger/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-arm.tar.xz>`_. After downloading,
untar the file in a terminal and add it to your path like so:

.. code-block:: bash
tar Jxf llvm15.0-mac-arm.tar.xz
xattr -rd com.apple.quarantine llvm15.0
export PATH=$(pwd)/llvm15.0/bin:$PATH
tar Jxf llvm16.0-mac-arm.tar.xz
xattr -rd com.apple.quarantine llvm16.0
export PATH=$(pwd)/llvm16.0/bin:$PATH
.. _llvm-from-source:

Expand Down
2 changes: 1 addition & 1 deletion solang-parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ lalrpop = { version = "0.20.0", default-features = false }
lalrpop-util = "0.20.0"
phf = { version = "0.11", features = ["macros"] }
unicode-xid = "0.2"
itertools = "0.11"
itertools = "0.12"
thiserror = "1.0"
serde = { version = "1.0", features = ["derive"], optional = true }

Expand Down
19 changes: 12 additions & 7 deletions src/linker/bpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ PHDRS
{
text PT_LOAD ;
rodata PT_LOAD ;
data PT_LOAD ;
dynamic PT_DYNAMIC ;
}
Expand All @@ -49,14 +50,18 @@ SECTIONS
. = SIZEOF_HEADERS;
.text : { *(.text*) } :text
.rodata : { *(.rodata*) } :rodata
.data.rel.ro : { *(.data.rel.ro*) } :rodata
.dynamic : { *(.dynamic) } :dynamic
.data.rel.ro : { *(.data.rel.ro*) } :dynamic
.dynsym : { *(.dynsym) } :dynamic
.dynstr : { *(.dynstr) } :dynamic
.gnu.hash : { *(.gnu.hash) } :dynamic
.rel.dyn : { *(.rel.dyn) } :dynamic
.hash : { *(.hash) } :dynamic
}"##,
.dynsym : { *(.dynsym) } :data
.dynstr : { *(.dynstr) } :data
.rel.dyn : { *(.rel.dyn) } :data
/DISCARD/ : {
*(.eh_frame*)
*(.gnu.hash*)
*(.hash*)
}
}
"##,
)
.expect("failed to write linker script to temp file");

Expand Down

0 comments on commit a960551

Please sign in to comment.