Update code base to use LLVM 21 (#434)

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
Co-authored-by: LJ <81748770+elle-j@users.noreply.github.com>
Co-authored-by: xermicus <cyrill@parity.io>
This commit is contained in:
authored and GitHub committed 2026-02-06 12:23:48 -05:00
1 parent 927eca8af5
commit 0cd949aa66
31 files changed
+298 -175

No files matched your search

+30 -15
View File
@@ -51,12 +51,15 @@ runs:
result-encoding: string
script: |
let page = 1;
let releases = [];
let allReleases = [];
let target = process.env.target
let versionPrefix = process.env.version_prefix
do {
// Fetch all releases from all pages
core.info('Fetching releases from revive repository...');
let hasMorePages = true;
while (hasMorePages) {
const res = await github.rest.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
@@ -64,27 +67,42 @@ runs:
page,
});
releases = res.data
releases.sort((a, b) => {
return (a.published_at < b.published_at) ? 1 : ((a.published_at > b.published_at) ? -1 : 0);
if (res.data.length > 0) {
core.info(`Page ${page}: Fetched ${res.data.length} releases`);
allReleases.push(...res.data);
page++;
} else {
hasMorePages = false;
}
}
core.info(`Total releases fetched: ${allReleases.length}`);
// Sort all releases by publication date (newest first)
allReleases.sort((a, b) => new Date(b.published_at) - new Date(a.published_at));
// Debug: Print all LLVM releases
const llvmReleases = allReleases.filter(r => r.tag_name.startsWith('llvm-'));
core.info(`Found ${llvmReleases.length} LLVM releases in total:`);
llvmReleases.forEach(r => {
core.info(` - ${r.tag_name} (published: ${r.published_at})`);
});
// Find the appropriate LLVM release
let llvmRelease;
if (versionPrefix) {
// Search for latest release matching the version prefix
llvmRelease = releases.find(release => {
llvmRelease = llvmReleases.find(release => {
return release.tag_name.startsWith(versionPrefix);
});
if (llvmRelease) {
core.info(`Found LLVM release matching prefix '${versionPrefix}': ${llvmRelease.tag_name}`);
core.info(`Selected LLVM release matching prefix '${versionPrefix}': ${llvmRelease.tag_name}`);
}
} else {
// Find latest LLVM release
llvmRelease = releases.find(release => {
return release.tag_name.startsWith('llvm-');
});
// Find latest LLVM release (first in sorted list)
llvmRelease = llvmReleases[0];
if (llvmRelease) {
core.info(`Found latest LLVM version: ${llvmRelease.tag_name}`);
core.info(`Selected latest LLVM version: ${llvmRelease.tag_name}`);
}
}
@@ -99,9 +117,6 @@ runs:
return asset.browser_download_url;
}
page++;
} while(releases.length > 0);
if (versionPrefix) {
core.setFailed(`No LLVM releases matching prefix '${versionPrefix}' found! Please check the version.`);
} else {
+1 -1
View File
@@ -60,7 +60,7 @@ jobs:
- name: Set LLVM Environment Variables
run: |
echo "LLVM_SYS_181_PREFIX=$(pwd)/llvm-x86_64-unknown-linux-gnu" >> $GITHUB_ENV
echo "LLVM_SYS_211_PREFIX=$(pwd)/llvm-x86_64-unknown-linux-gnu" >> $GITHUB_ENV
- name: Build resolc
run: |
+2 -2
View File
@@ -85,7 +85,7 @@ jobs:
cat /etc/apt/sources.list
sudo sed -i 's/jammy/noble/g' /etc/apt/sources.list
cat /etc/apt/sources.list
sudo apt-get update && sudo apt-get install -y cmake ninja-build curl git libssl-dev pkg-config clang lld musl xz-utils libc6-dev gcc-multilib
sudo apt-get update && sudo apt-get install -y cmake ninja-build curl git libssl-dev pkg-config clang lld musl xz-utils libc6-dev gcc-multilib g++ build-essential linux-libc-dev
- name: Install Dependencies
if: ${{ matrix.host == 'macos' }}
@@ -127,7 +127,7 @@ jobs:
- name: Package Artifact
shell: bash
run: |
mv target-llvm/${{ matrix.builder-arg }}/target-final/ llvm-${{ matrix.target }}
cp -r target-llvm/${{ matrix.builder-arg }}/target-final/ llvm-${{ matrix.target }}
tar -czf "${{ needs.create-release-draft.outputs.version }}-${{ matrix.target }}.tar.gz" llvm-${{ matrix.target }}
- name: Add Artifact to Release
+4 -4
View File
@@ -36,7 +36,7 @@ on:
env:
CARGO_TERM_COLOR: always
RUST_MUSL_CROSS_IMAGE: messense/rust-musl-cross@sha256:c0154e992adb791c3b848dd008939d19862549204f8cb26f5ca7a00f629e6067
RUST_MUSL_CROSS_IMAGE: messense/rust-musl-cross@sha256:2a8837c43bf12e246f1ebd05191de9ee27fcd22f9ca81511ccd4cf75dc16d71c
jobs:
build:
@@ -95,7 +95,7 @@ jobs:
if: ${{ matrix.type == 'native' }}
shell: bash
run: |
export LLVM_SYS_181_PREFIX=$PWD/llvm-${{ matrix.target }}
export LLVM_SYS_211_PREFIX=$PWD/llvm-${{ matrix.target }}
make install-bin
mv target/release/resolc resolc-${{ matrix.target }} || mv target/release/resolc.exe resolc-${{ matrix.target }}.exe
@@ -106,7 +106,7 @@ jobs:
cd /opt/revive
chown -R root:root .
apt update && apt upgrade -y && apt install -y pkg-config
export LLVM_SYS_181_PREFIX=/opt/revive/llvm-${{ matrix.target }}
export LLVM_SYS_211_PREFIX=/opt/revive/llvm-${{ matrix.target }}
make install-bin
mv target/${{ matrix.target }}/release/resolc resolc-${{ matrix.target }}
"
@@ -169,7 +169,7 @@ jobs:
- name: Build
run: |
export LLVM_SYS_181_PREFIX=$PWD/llvm-x86_64-unknown-linux-gnu
export LLVM_SYS_211_PREFIX=$PWD/llvm-x86_64-unknown-linux-gnu
export REVIVE_LLVM_TARGET_PREFIX=$PWD/llvm-wasm32-unknown-emscripten
source emsdk/emsdk_env.sh
make install-wasm
+1 -1
View File
@@ -33,7 +33,7 @@ jobs:
- name: Install Dependencies
if: matrix.runner == 'parity-large'
run: |
sudo apt update && sudo apt-get install -y cmake ninja-build curl git libssl-dev pkg-config clang lld musl
sudo apt update && sudo apt-get install -y cmake ninja-build curl git libssl-dev pkg-config clang lld musl xz-utils build-essential
- name: Install Dependencies
if: matrix.runner == 'macos-15'
+1 -1
View File
@@ -50,7 +50,7 @@ jobs:
- name: Set LLVM Environment Variables
run: |
echo "LLVM_SYS_181_PREFIX=$(pwd)/llvm-x86_64-unknown-linux-gnu" >> $GITHUB_ENV
echo "LLVM_SYS_211_PREFIX=$(pwd)/llvm-x86_64-unknown-linux-gnu" >> $GITHUB_ENV
echo "REVIVE_LLVM_TARGET_PREFIX=$(pwd)/llvm-wasm32-unknown-emscripten" >> $GITHUB_ENV
- name: Build Revive
+1 -1
View File
@@ -38,7 +38,7 @@ jobs:
- name: Set LLVM Environment Variables
run: |
echo "LLVM_SYS_181_PREFIX=$(pwd)/llvm-x86_64-unknown-linux-gnu" >> $GITHUB_ENV
echo "LLVM_SYS_211_PREFIX=$(pwd)/llvm-x86_64-unknown-linux-gnu" >> $GITHUB_ENV
- name: Install Geth
run: |
+1 -1
View File
@@ -1,7 +1,7 @@
[submodule "llvm"]
path = llvm
url = https://github.com/llvm/llvm-project.git
branch = release/18.x
branch = release/21.x
[submodule "revive-differential-tests"]
path = revive-differential-tests
url = https://github.com/paritytech/revive-differential-tests.git
+7
View File
@@ -8,6 +8,13 @@ This is a development pre-release.
- npm package: The `--bin` CLI flag was not producing bytecode because the `outputSelection` was not updated to explicitly requested it.
### Changed
- Updated `LLVM` from `18.1.8` to LLVM `21.1.8`
- Updated `musl` to `1.2.5`
- Updated `inkwell` to `0.8.0`
- Updated `polkavm-*` to `0.31.0`
## v1.0.0
Supported `polkadot-sdk` rev: `unstable2507`
+1 -1
View File
@@ -14,7 +14,7 @@ Revive is a Solidity compiler targeting RISC-V on PolkaVM. It uses `solc` (Ether
## Build Commands
**Prerequisites:** Requires `LLVM_SYS_181_PREFIX` environment variable pointing to a compatible LLVM 18.1.8 build. Download from releases or build with `make install-llvm`.
**Prerequisites:** Requires `LLVM_SYS_211_PREFIX` environment variable pointing to a compatible LLVM 18.1.8 build. Download from releases or build with `make install-llvm`.
```bash
# Install resolc binary
Generated
+72 -16
View File
@@ -4949,9 +4949,9 @@ dependencies = [
[[package]]
name = "llvm-sys"
version = "181.3.0"
version = "211.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e24aad69cbdb0c6ebe777262e9e6314dceba0d6e6a2a63e47563ccd293a2eda8"
checksum = "108b3ad2b2eaf2a561fc74196273b20e3436e4a688b8b44e250d83974dc1b2e2"
dependencies = [
"anyhow",
"cc",
@@ -6901,7 +6901,7 @@ dependencies = [
"pallet-transaction-payment",
"parity-scale-codec",
"paste",
"polkavm",
"polkavm 0.30.0",
"polkavm-common 0.30.0",
"rand 0.8.5",
"revm",
@@ -6934,7 +6934,7 @@ dependencies = [
"cargo_metadata",
"hex",
"pallet-revive-uapi",
"polkavm-linker",
"polkavm-linker 0.30.0",
"serde_json",
"sp-core",
"sp-io",
@@ -8362,9 +8362,23 @@ dependencies = [
"libc",
"log",
"picosimd",
"polkavm-assembler",
"polkavm-assembler 0.30.0",
"polkavm-common 0.30.0",
"polkavm-linux-raw",
"polkavm-linux-raw 0.30.0",
]
[[package]]
name = "polkavm"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34ddb26cbe473e21bf5c329723e72fdf9208b5f9674e54721bf436e2efdbb26f"
dependencies = [
"libc",
"log",
"picosimd",
"polkavm-assembler 0.31.0",
"polkavm-common 0.31.0",
"polkavm-linux-raw 0.31.0",
]
[[package]]
@@ -8376,6 +8390,15 @@ dependencies = [
"log",
]
[[package]]
name = "polkavm-assembler"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f9006f0a135c6d035487fa88fa75b97b32a53d1d914c757f131c8e10a2af295"
dependencies = [
"log",
]
[[package]]
name = "polkavm-common"
version = "0.26.0"
@@ -8391,7 +8414,18 @@ dependencies = [
"blake3",
"log",
"picosimd",
"polkavm-assembler",
"polkavm-assembler 0.30.0",
]
[[package]]
name = "polkavm-common"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0a3e43fa1a54b955a2f9422b1690c3cc29252ac8828c02a99d2370b9f2a188e"
dependencies = [
"log",
"picosimd",
"polkavm-assembler 0.31.0",
]
[[package]]
@@ -8458,15 +8492,15 @@ dependencies = [
[[package]]
name = "polkavm-disassembler"
version = "0.30.0"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8967ce3348d63ed1d56fa34602182e858b2586da5dfc2866d1b656b104374d65"
checksum = "fe6f396ef48600b5127356de38d649411c971119d648408a04e79078138733b8"
dependencies = [
"clap",
"iced-x86",
"polkavm",
"polkavm-common 0.30.0",
"polkavm-linker",
"polkavm 0.31.0",
"polkavm-common 0.31.0",
"polkavm-linker 0.31.0",
]
[[package]]
@@ -8485,12 +8519,34 @@ dependencies = [
"rustc-demangle",
]
[[package]]
name = "polkavm-linker"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1ae3f7aff1af110dcd0f105d783b10ff25cd2837abe411ea4d88ae5cd193b49"
dependencies = [
"dirs",
"gimli 0.31.1",
"hashbrown 0.14.5",
"log",
"object 0.36.7",
"polkavm-common 0.31.0",
"regalloc2 0.9.3",
"rustc-demangle",
]
[[package]]
name = "polkavm-linux-raw"
version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "604b23cdb201979304449f53d21bfd5fb1724c03e3ea889067c9a3bf7ae33862"
[[package]]
name = "polkavm-linux-raw"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbcd9ed5f77c60f3878289001d3e789da301746249b622bfb2876e2d0fe32c0b"
[[package]]
name = "poly1305"
version = "0.8.0"
@@ -9108,7 +9164,7 @@ dependencies = [
"anyhow",
"libc",
"lld-sys",
"polkavm-linker",
"polkavm-linker 0.31.0",
"revive-builtins",
"tempfile",
]
@@ -9143,7 +9199,7 @@ dependencies = [
"itertools 0.14.0",
"libc",
"num",
"polkavm-common 0.30.0",
"polkavm-common 0.31.0",
"polkavm-disassembler",
"revive-common",
"revive-linker",
@@ -9699,7 +9755,7 @@ version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "871f1a283c4a6439235e8dcdfdbfcfa429d0dc14ed106072cd9d62887e50738d"
dependencies = [
"polkavm",
"polkavm 0.30.0",
"sc-allocator",
"sp-maybe-compressed-blob",
"sp-wasm-interface",
@@ -9714,7 +9770,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20634cadfbe2041739e6849d4b82ff599f21735faf003195b077b40ff978491c"
dependencies = [
"log",
"polkavm",
"polkavm 0.30.0",
"sc-executor-common",
"sp-wasm-interface",
]
+5 -5
View File
@@ -49,10 +49,10 @@ which = "8.0"
path-slash = "0.2"
rayon = "1.11"
clap = { version = "4", default-features = false, features = ["derive"] }
polkavm-common = "0.30.0"
polkavm-linker = "0.30.0"
polkavm-disassembler = "0.30.0"
polkavm = "0.30.0"
polkavm-common = "0.31.0"
polkavm-linker = "0.31.0"
polkavm-disassembler = "0.31.0"
polkavm = "0.31.0"
alloy-primitives = { version = "1.4", features = ["serde"] }
alloy-sol-types = "1.4"
alloy-genesis = "1.1.2"
@@ -81,7 +81,7 @@ polkadot-sdk = { version = "=2507.4.0" }
[workspace.dependencies.inkwell]
version = "0.8.0"
default-features = false
features = ["serde", "llvm18-1", "no-libffi-linking", "target-riscv"]
features = ["serde", "llvm21-1", "no-libffi-linking", "target-riscv"]
[profile.bench]
inherits = "release"
+4 -5
View File
@@ -1,4 +1,4 @@
FROM rust:1.85.0 AS llvm-builder
FROM rust:1.92.0 AS llvm-builder
WORKDIR /opt/revive
RUN apt update && \
@@ -8,10 +8,9 @@ RUN apt update && \
COPY . .
RUN make install-llvm-builder
RUN revive-llvm --target-env musl clone
RUN revive-llvm --target-env musl build --llvm-projects lld --llvm-projects clang
FROM messense/rust-musl-cross@sha256:c0154e992adb791c3b848dd008939d19862549204f8cb26f5ca7a00f629e6067 AS resolc-builder
FROM messense/rust-musl-cross@sha256:2a8837c43bf12e246f1ebd05191de9ee27fcd22f9ca81511ccd4cf75dc16d71c AS resolc-builder
WORKDIR /opt/revive
RUN apt update && \
@@ -21,11 +20,11 @@ RUN apt update && \
COPY . .
COPY --from=llvm-builder /opt/revive/target-llvm /opt/revive/target-llvm
ENV LLVM_SYS_181_PREFIX=/opt/revive/target-llvm/musl/target-final
ENV LLVM_SYS_211_PREFIX=/opt/revive/target-llvm/musl/target-final
RUN make install-bin
FROM alpine:latest
ADD https://github.com/ethereum/solidity/releases/download/v0.8.28/solc-static-linux /usr/bin/solc
ADD https://github.com/ethereum/solidity/releases/download/v0.8.33/solc-static-linux /usr/bin/solc
COPY --from=resolc-builder /root/.cargo/bin/resolc /usr/bin/resolc
RUN apk add --no-cache libc6-compat
+5 -5
View File
@@ -76,9 +76,9 @@ Download the [latest LLVM build](https://github.com/paritytech/revive/releases?q
> xattr -rc </path/to/the/extracted/archive>/target-llvm/gnu/target-final/bin/*
> ```
After extracting the archive, point `$LLVM_SYS_181_PREFIX` to it:
After extracting the archive, point `$LLVM_SYS_211_PREFIX` to it:
```sh
export LLVM_SYS_181_PREFIX=</path/to/the/extracted/archive>/target-llvm/gnu/target-final
export LLVM_SYS_211_PREFIX=</path/to/the/extracted/archive>/target-llvm/gnu/target-final
```
</details>
@@ -86,18 +86,18 @@ export LLVM_SYS_181_PREFIX=</path/to/the/extracted/archive>/target-llvm/gnu/targ
<details>
<summary>Building from source</summary>
The `Makefile` provides a shortcut target to obtain a compatible LLVM build, using the provided [revive-llvm](crates/llvm-builder/README.md) utility. Once installed, point `$LLVM_SYS_181_PREFIX` to the installation afterwards:
The `Makefile` provides a shortcut target to obtain a compatible LLVM build, using the provided [revive-llvm](crates/llvm-builder/README.md) utility. Once installed, point `$LLVM_SYS_211_PREFIX` to the installation afterwards:
```sh
make install-llvm
export LLVM_SYS_181_PREFIX=${PWD}/target-llvm/gnu/target-final
export LLVM_SYS_211_PREFIX=${PWD}/target-llvm/gnu/target-final
```
</details>
### The `resolc` Solidity frontend
To build the `resolc` Solidity frontend executable, make sure you have obtained a compatible LLVM build and did export the `LLVM_SYS_181_PREFIX` environment variable pointing to it (see [above](#LLVM)).
To build the `resolc` Solidity frontend executable, make sure you have obtained a compatible LLVM build and did export the `LLVM_SYS_211_PREFIX` environment variable pointing to it (see [above](#LLVM)).
To install the `resolc` Solidity frontend executable:
@@ -11,7 +11,7 @@ The `REVIVE_LLVM_TARGET_PREFIX` environment variable is used to control the targ
```sh
# Build the host LLVM dependency with PolkaVM target support
make install-llvm
export LLVM_SYS_181_PREFIX=${PWD}/target-llvm/gnu/target-final
export LLVM_SYS_211_PREFIX=${PWD}/target-llvm/gnu/target-final
# Build the target LLVM dependency with PolkaVM target support
revive-llvm emsdk
+1 -1
View File
@@ -1,7 +1,7 @@
//! The compiler build utilities library.
/// The revive LLVM host dependency directory prefix environment variable.
pub const REVIVE_LLVM_HOST_PREFIX: &str = "LLVM_SYS_181_PREFIX";
pub const REVIVE_LLVM_HOST_PREFIX: &str = "LLVM_SYS_211_PREFIX";
/// The revive LLVM target dependency directory prefix environment variable.
pub const REVIVE_LLVM_TARGET_PREFIX: &str = "REVIVE_LLVM_TARGET_PREFIX";
+8 -8
View File
@@ -1,10 +1,10 @@
{
"Baseline": 864,
"Computation": 2323,
"DivisionArithmetics": 14475,
"ERC20": 17229,
"Events": 1663,
"FibonacciIterative": 1421,
"Flipper": 2154,
"SHA1": 7751
"Baseline": 870,
"Computation": 2418,
"DivisionArithmetics": 9327,
"ERC20": 17160,
"Events": 1662,
"FibonacciIterative": 1427,
"Flipper": 2240,
"SHA1": 8009
}
+28
View File
@@ -14,6 +14,7 @@ fn set_rustc_link_flags() {
"lldELF",
"lldCommon",
"lldMachO",
"lldWasm",
"LLVMSupport",
"LLVMLinker",
"LLVMCore",
@@ -68,6 +69,33 @@ fn set_rustc_link_flags() {
"LLVMBitReader",
"LLVMRemarks",
"LLVMBitstreamReader",
"LLVMTextAPI",
"LLVMDebugInfoDWARFLowLevel",
"LLVMDebugInfoGSYM",
"LLVMDebugInfoMSF",
"LLVMDebugInfoPDB",
"LLVMDebugInfoBTF",
"LLVMInterfaceStub",
"LLVMCGData",
"LLVMMIRParser",
"LLVMDWARFLinker",
"LLVMDWARFLinkerParallel",
"LLVMDWARFLinkerClassic",
"LLVMLibDriver",
"LLVMDlltoolDriver",
"LLVMTextAPIBinaryReader",
"LLVMCoverage",
"LLVMLineEditor",
"LLVMRISCVTargetMCA",
"LLVMRuntimeDyld",
"LLVMDWP",
"LLVMDWARFCFIChecker",
"LLVMDebugInfoLogicalView",
"LLVMMCA",
"LLVMipo",
"LLVMVectorize",
"LLVMSandboxIR",
"LLVMExtensions",
] {
println!("cargo:rustc-link-lib=static={lib}");
}
+2 -2
View File
@@ -82,10 +82,10 @@ Obtain a compatible build for your host platform from the release section of thi
Build artifacts end up in the `./target-llvm/gnu/target-final/` directory by default.
The `gnu` directory depends on the supported archticture and will either be `gnu`, `musl` or `emscripten`.
You now need to export the final target directory `$LLVM_SYS_181_PREFIX`:
You now need to export the final target directory `$LLVM_SYS_211_PREFIX`:
```shell
export LLVM_SYS_181_PREFIX=${PWD}/target-llvm/gnu/target-final
export LLVM_SYS_211_PREFIX=${PWD}/target-llvm/gnu/target-final
```
If built with the `--enable-tests` option, test tools will be in the `./target-llvm/gnu/build-final/` directory, along with copies of the build artifacts. For all supported build options, run `revive-llvm build --help`.
@@ -33,7 +33,7 @@ pub fn build(
crate::utils::check_presence("lld")?;
crate::utils::check_presence("ninja")?;
let musl_name = "musl-1.2.3";
let musl_name = "musl-1.2.5";
let musl_build = LLVMPath::musl_build(musl_name)?;
let musl_target = LLVMPath::musl_target()?;
@@ -222,6 +222,7 @@ fn build_host(
"-DCOMPILER_RT_BUILD_ORC='Off'",
"-DCOMPILER_RT_DEFAULT_TARGET_ARCH='aarch64'",
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY='On'",
"-DCMAKE_C_COMPILER_TARGET='aarch64-unknown-linux-musl'",
])
.args(crate::platforms::shared::SHARED_BUILD_OPTS)
.args(crate::platforms::shared::shared_build_opts_ccache(
@@ -294,6 +295,7 @@ fn build_target(
"-G",
"Ninja",
"-DBUILD_SHARED_LIBS='Off'",
"-DLLVM_USE_LINKER='lld'",
"-DLINKER_SUPPORTS_COLOR_DIAGNOSTICS=0",
format!(
"-DCMAKE_INSTALL_PREFIX='{}'",
@@ -36,7 +36,7 @@ pub fn build(
crate::utils::check_presence("lld")?;
crate::utils::check_presence("ninja")?;
let musl_name = "musl-1.2.3";
let musl_name = "musl-1.2.5";
let musl_build = LLVMPath::musl_build(musl_name)?;
let musl_target = LLVMPath::musl_target()?;
@@ -138,6 +138,8 @@ fn build_crt(
"-DCOMPILER_RT_BUILD_PROFILE='Off'",
"-DCOMPILER_RT_BUILD_MEMPROF='Off'",
"-DCOMPILER_RT_BUILD_ORC='Off'",
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY='On'",
"-DCMAKE_C_COMPILER_TARGET='x86_64-pc-linux-musl'",
])
.args(crate::platforms::shared::SHARED_BUILD_OPTS)
.args(crate::platforms::shared::shared_build_opts_ccache(
@@ -219,7 +221,6 @@ fn build_host(
"-DCOMPILER_RT_BUILD_MEMPROF='Off'",
"-DCOMPILER_RT_BUILD_ORC='Off'",
"-DCOMPILER_RT_DEFAULT_TARGET_ARCH='x86_64'",
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY='On'",
"-DLIBCLANG_BUILD_STATIC='On'",
"-DBUILD_SHARED_LIBS='Off'",
])
@@ -294,6 +295,7 @@ fn build_target(
"-DBUILD_SHARED_LIBS='Off'",
"-DLIBCLANG_BUILD_STATIC='On'",
"-DLLVM_BUILD_STATIC='On'",
"-DLLVM_USE_LINKER='lld'",
"-DLINKER_SUPPORTS_COLOR_DIAGNOSTICS=0",
format!(
"-DCMAKE_INSTALL_PREFIX='{}'",
@@ -8,7 +8,7 @@ use serde::Serialize;
/// inside of the LLVM build directory. This order is actually generated during the building.
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Attribute {
Unused = 0,
// FirstEnumAttr = 1,
AllocAlign = 1,
AllocatedPointer = 2,
AlwaysInline = 3,
@@ -16,92 +16,107 @@ pub enum Attribute {
Cold = 5,
Convergent = 6,
CoroDestroyOnlyWhenComplete = 7,
DeadOnUnwind = 8,
DisableSanitizerInstrumentation = 9,
FnRetThunkExtern = 10,
Hot = 11,
ImmArg = 12,
InReg = 13,
InlineHint = 14,
JumpTable = 15,
MinSize = 16,
MustProgress = 17,
Naked = 18,
Nest = 19,
NoAlias = 20,
NoBuiltin = 21,
NoCallback = 22,
NoCapture = 23,
NoCfCheck = 24,
NoDuplicate = 25,
NoFree = 26,
NoImplicitFloat = 27,
NoInline = 28,
NoMerge = 29,
NoProfile = 30,
NoRecurse = 31,
NoRedZone = 32,
NoReturn = 33,
NoSanitizeBounds = 34,
NoSanitizeCoverage = 35,
NoSync = 36,
NoUndef = 37,
NoUnwind = 38,
NonLazyBind = 39,
NonNull = 40,
NullPointerIsValid = 41,
OptForFuzzing = 42,
OptimizeForDebugging = 43,
OptimizeForSize = 44,
OptimizeNone = 45,
PresplitCoroutine = 46,
ReadNone = 47,
ReadOnly = 48,
Returned = 49,
ReturnsTwice = 50,
SExt = 51,
SafeStack = 52,
SanitizeAddress = 53,
SanitizeHWAddress = 54,
SanitizeMemTag = 55,
SanitizeMemory = 56,
SanitizeThread = 57,
ShadowCallStack = 58,
SkipProfile = 59,
Speculatable = 60,
SpeculativeLoadHardening = 61,
StackProtect = 62,
StackProtectReq = 63,
StackProtectStrong = 64,
StrictFP = 65,
SwiftAsync = 66,
SwiftError = 67,
SwiftSelf = 68,
WillReturn = 69,
Writable = 70,
WriteOnly = 71,
ZExt = 72,
// LastEnumAttr = 72,
// FirstTypeAttr = 73,
ByRef = 73,
ByVal = 74,
ElementType = 75,
InAlloca = 76,
Preallocated = 77,
StructRet = 78,
// LastTypeAttr = 78,
// FirstIntAttr = 79,
Alignment = 79,
AllocKind = 80,
AllocSize = 81,
Dereferenceable = 82,
DereferenceableOrNull = 83,
Memory = 84,
NoFPClass = 85,
StackAlignment = 86,
UWTable = 87,
VScaleRange = 88,
// LastIntAttr = 88,
CoroElideSafe = 8,
DeadOnReturn = 9,
DeadOnUnwind = 10,
DisableSanitizerInstrumentation = 11,
FnRetThunkExtern = 12,
Hot = 13,
HybridPatchable = 14,
ImmArg = 15,
InReg = 16,
InlineHint = 17,
JumpTable = 18,
MinSize = 19,
MustProgress = 20,
Naked = 21,
Nest = 22,
NoAlias = 23,
NoBuiltin = 24,
NoCallback = 25,
NoCfCheck = 26,
NoDivergenceSource = 27,
NoDuplicate = 28,
NoExt = 29,
NoFree = 30,
NoImplicitFloat = 31,
NoInline = 32,
NoMerge = 33,
NoProfile = 34,
NoRecurse = 35,
NoRedZone = 36,
NoReturn = 37,
NoSanitizeBounds = 38,
NoSanitizeCoverage = 39,
NoSync = 40,
NoUndef = 41,
NoUnwind = 42,
NonLazyBind = 43,
NonNull = 44,
NullPointerIsValid = 45,
OptForFuzzing = 46,
OptimizeForDebugging = 47,
OptimizeForSize = 48,
OptimizeNone = 49,
PresplitCoroutine = 50,
ReadNone = 51,
ReadOnly = 52,
Returned = 53,
ReturnsTwice = 54,
SExt = 55,
SafeStack = 56,
SanitizeAddress = 57,
SanitizeHWAddress = 58,
SanitizeMemTag = 59,
SanitizeMemory = 60,
SanitizeNumericalStability = 61,
SanitizeRealtime = 62,
SanitizeRealtimeBlocking = 63,
SanitizeThread = 64,
SanitizeType = 65,
ShadowCallStack = 66,
SkipProfile = 67,
Speculatable = 68,
SpeculativeLoadHardening = 69,
StackProtect = 70,
StackProtectReq = 71,
StackProtectStrong = 72,
StrictFP = 73,
SwiftAsync = 74,
SwiftError = 75,
SwiftSelf = 76,
WillReturn = 77,
Writable = 78,
WriteOnly = 79,
ZExt = 80,
//LastEnumAttr = 80,
//FirstTypeAttr = 81,
ByRef = 81,
ByVal = 82,
ElementType = 83,
InAlloca = 84,
Preallocated = 85,
StructRet = 86,
//LastTypeAttr = 86,
//FirstIntAttr = 87,
Alignment = 87,
AllocKind = 88,
AllocSize = 89,
Captures = 90,
Dereferenceable = 91,
DereferenceableOrNull = 92,
Memory = 93,
NoFPClass = 94,
StackAlignment = 95,
UWTable = 96,
VScaleRange = 97,
//LastIntAttr = 97,
//FirstConstantRangeAttr = 98,
Range = 98,
//LastConstantRangeAttr = 98,
//FirstConstantRangeListAttr = 99,
Initializes = 99,
//LastConstantRangeListAttr = 99,
}
impl TryFrom<&str> for Attribute {
@@ -1103,13 +1103,7 @@ impl<'ctx> Context<'ctx> {
Ok(call_site_value
.try_as_basic_value()
.basic()
.unwrap_or_else(|| {
panic!(
"revive runtime function {} should return a value",
<PolkaVMSbrkFunction as RuntimeFunction>::NAME,
)
})
.unwrap_basic()
.into_pointer_value())
}
@@ -1298,7 +1292,7 @@ impl<'ctx> Context<'ctx> {
call_site_value.add_attribute(
inkwell::attributes::AttributeLoc::Param(index as u32),
self.llvm
.create_enum_attribute(Attribute::NoCapture as u32, 0),
.create_enum_attribute(Attribute::Captures as u32, 0), // captures(none)
);
call_site_value.add_attribute(
inkwell::attributes::AttributeLoc::Param(index as u32),
+1 -1
View File
@@ -42,7 +42,7 @@ mimalloc = { version = "0.1.46", default-features = false }
[target.'cfg(target_os = "emscripten")'.dependencies]
libc = { workspace = true }
inkwell = { workspace = true, features = ["target-riscv", "llvm18-1-no-llvm-linking"]}
inkwell = { workspace = true, features = ["target-riscv", "llvm21-1-no-llvm-linking"]}
[build-dependencies]
git2 = { workspace = true, default-features = false }
+1 -1
View File
@@ -9,7 +9,7 @@ description = "Implements the low level runtime API bindings with pallet contrac
[dependencies]
anyhow = { workspace = true }
inkwell = { workspace = true, features = ["target-riscv", "no-libffi-linking", "llvm18-1"] }
inkwell = { workspace = true, features = ["target-riscv", "no-libffi-linking", "llvm21-1"] }
revive-common = { workspace = true }
+1 -1
View File
@@ -7,7 +7,7 @@ repository.workspace = true
description = "revive compiler stdlib components"
[dependencies]
inkwell = { workspace = true, features = ["target-riscv", "no-libffi-linking", "llvm18-1"] }
inkwell = { workspace = true, features = ["target-riscv", "no-libffi-linking", "llvm21-1"] }
[build-dependencies]
revive-build-utils = { workspace = true }
+1 -1
View File
@@ -181,7 +181,7 @@
<p>The <code>REVIVE_LLVM_TARGET_PREFIX</code> environment variable is used to control the target environment LLVM dependency. This requires a compatible LLVM build, obtainable via the <code>revive-llvm</code> build script. Example:</p>
<pre><code class="language-sh"># Build the host LLVM dependency with PolkaVM target support
make install-llvm
export LLVM_SYS_181_PREFIX=${PWD}/target-llvm/gnu/target-final
export LLVM_SYS_211_PREFIX=${PWD}/target-llvm/gnu/target-final
# Build the target LLVM dependency with PolkaVM target support
revive-llvm emsdk
+1 -1
View File
@@ -724,7 +724,7 @@ export PATH=/path/to/go-ethereum/build/bin/:$PATH
<p>The <code>REVIVE_LLVM_TARGET_PREFIX</code> environment variable is used to control the target environment LLVM dependency. This requires a compatible LLVM build, obtainable via the <code>revive-llvm</code> build script. Example:</p>
<pre><code class="language-sh"># Build the host LLVM dependency with PolkaVM target support
make install-llvm
export LLVM_SYS_181_PREFIX=${PWD}/target-llvm/gnu/target-final
export LLVM_SYS_211_PREFIX=${PWD}/target-llvm/gnu/target-final
# Build the target LLVM dependency with PolkaVM target support
revive-llvm emsdk
+1 -1
View File
@@ -1 +1 @@
window.search = Object.assign(window.search, JSON.parse('{"doc_urls":["welcome.html#welcome","welcome.html#target-audience","welcome.html#other-polkadot-contracts-resources","welcome.html#about","user_guide.html#resolc-user-guide","user_guide.html#revive-vs-resolc-nomenclature","user_guide/installation.html#installation","user_guide/installation.html#resolc-binary-releases","user_guide/installation.html#installing-the-solc-dependency","user_guide/installation.html#revive-npm-package","user_guide/installation.html#buidling-resolc-from-source","user_guide/cli.html#cli-usage","user_guide/cli.html#llvm-optimization-levels","user_guide/cli.html#stack-size","user_guide/cli.html#heap-size","user_guide/cli.html#solc","user_guide/cli.html#debug-artifacts","user_guide/cli.html#debug-info","user_guide/cli.html#deploy-time-linking","user_guide/js.html#js-npm-package","user_guide/tooling.html#tooling-integration","user_guide/tooling.html#solidity-toolkits","user_guide/tooling.html#compiler-explorer","user_guide/tooling.html#remix-ide","user_guide/std_json.html#standard-json-interface","user_guide/std_json.html#the-settingspolkavm-object","user_guide/std_json.html#settingspolkavmdebuginformation","user_guide/std_json.html#the-settingspolkavmmemoryconfig-object","user_guide/std_json.html#the-settingsoptimizer-object","user_guide/std_json.html#settingsoptimizermode","user_guide/std_json.html#settingsllvmarguments","user_guide/std_json.html#the-settingsoutputselection-object","user_guide/std_json.html#the-all--wildcard","user_guide/std_json.html#the-contract-level-evm-output-selection","user_guide/differences.html#differences-to-evm","user_guide/differences.html#deploy-code-vs-runtime-code","user_guide/differences.html#solidity","user_guide/differences.html#the-6364-gas-rule","user_guide/differences.html#addresscreationcode","user_guide/differences.html#yul-functions","user_guide/differences.html#mload-mstore-msize-mcopy-memory-related-functions","user_guide/differences.html#calldataload-calldatacopy","user_guide/differences.html#codecopy","user_guide/differences.html#create-create2","user_guide/differences.html#dataoffset","user_guide/differences.html#datasize","user_guide/differences.html#revert-return","user_guide/differences.html#prevrandao-difficulty","user_guide/differences.html#pc-extcodecopy","user_guide/differences.html#blobhash-blobbasefee","user_guide/differences.html#difference-regarding-the-solc-via-ir-mode","user_guide/differences.html#example-state-variable-initialization-order-in-inheritance","user_guide/rust_libraries.html#rust-contract-libraries","revive_runner.html#revive-runner-sandbox","revive_runner.html#installation-and-usage","revive_runner.html#trace-logs","revive_runner.html#automatic-contract-instantiation","revive_runner.html#example","developer_guide.html#developer-guide","developer_guide/contributing.html#contributor-guide","developer_guide/contributing.html#getting-started","developer_guide/contributing.html#using-the-makefile","developer_guide/contributing.html#codebase-organization","developer_guide/contributing.html#contribution-rules","developer_guide/contributing.html#style-guide","developer_guide/contributing.html#ai-policy","developer_guide/architecture.html#compiler-architecture-and-internals","developer_guide/architecture.html#resolc","developer_guide/architecture.html#reproducible-contract-builds","developer_guide/architecture.html#the-revive-compiler-libraries","developer_guide/architecture.html#evm-heap-memory","developer_guide/architecture.html#the-llvm-dependency","developer_guide/architecture.html#custom-optimizations","developer_guide/target.html#pvm-and-the-pallet-revive-runtime-target","developer_guide/target.html#target-cpu-configuration","developer_guide/target.html#why-pvm","developer_guide/target.html#host-environment-pallet-revive","developer_guide/testing.html#testing-strategy","developer_guide/testing.html#bug-compatibility-with-ethereum-solidity","developer_guide/testing.html#differential-integration-tests","developer_guide/testing.html#the-differential-testing-utility","developer_guide/cross_compilation.html#cross-compilation","developer_guide/cross_compilation.html#wasm-via-emscripten","developer_guide/cross_compilation.html#musl-libc","faq.html#faq","faq.html#what-evm-version-do-you-support","faq.html#is-inline-assembly-supported","faq.html#do-you-support-opcode-xy","faq.html#in-what-solidity-version-should-i-write-my-dapp","faq.html#tool-xy-says-the-contract-size-is-larger-than-24kb-and-will-fail-to-deploy","faq.html#is-resolc-a-drop-in-replacement-for-solc","roadmap.html#vision-and-roadmap","roadmap.html#roadmap"],"index":{"documentStore":{"docInfo":{"0":{"body":74,"breadcrumbs":2,"title":1},"1":{"body":22,"breadcrumbs":3,"title":2},"10":{"body":6,"breadcrumbs":7,"title":3},"11":{"body":33,"breadcrumbs":8,"title":2},"12":{"body":53,"breadcrumbs":9,"title":3},"13":{"body":62,"breadcrumbs":8,"title":2},"14":{"body":75,"breadcrumbs":8,"title":2},"15":{"body":10,"brLine truncated
window.search = Object.assign(window.search, JSON.parse('{"doc_urls":["welcome.html#welcome","welcome.html#target-audience","welcome.html#other-polkadot-contracts-resources","welcome.html#about","user_guide.html#resolc-user-guide","user_guide.html#revive-vs-resolc-nomenclature","user_guide/installation.html#installation","user_guide/installation.html#resolc-binary-releases","user_guide/installation.html#installing-the-solc-dependency","user_guide/installation.html#revive-npm-package","user_guide/installation.html#buidling-resolc-from-source","user_guide/cli.html#cli-usage","user_guide/cli.html#llvm-optimization-levels","user_guide/cli.html#stack-size","user_guide/cli.html#heap-size","user_guide/cli.html#solc","user_guide/cli.html#debug-artifacts","user_guide/cli.html#debug-info","user_guide/cli.html#deploy-time-linking","user_guide/js.html#js-npm-package","user_guide/tooling.html#tooling-integration","user_guide/tooling.html#solidity-toolkits","user_guide/tooling.html#compiler-explorer","user_guide/tooling.html#remix-ide","user_guide/std_json.html#standard-json-interface","user_guide/std_json.html#the-settingspolkavm-object","user_guide/std_json.html#settingspolkavmdebuginformation","user_guide/std_json.html#the-settingspolkavmmemoryconfig-object","user_guide/std_json.html#the-settingsoptimizer-object","user_guide/std_json.html#settingsoptimizermode","user_guide/std_json.html#settingsllvmarguments","user_guide/std_json.html#the-settingsoutputselection-object","user_guide/std_json.html#the-all--wildcard","user_guide/std_json.html#the-contract-level-evm-output-selection","user_guide/differences.html#differences-to-evm","user_guide/differences.html#deploy-code-vs-runtime-code","user_guide/differences.html#solidity","user_guide/differences.html#the-6364-gas-rule","user_guide/differences.html#addresscreationcode","user_guide/differences.html#yul-functions","user_guide/differences.html#mload-mstore-msize-mcopy-memory-related-functions","user_guide/differences.html#calldataload-calldatacopy","user_guide/differences.html#codecopy","user_guide/differences.html#create-create2","user_guide/differences.html#dataoffset","user_guide/differences.html#datasize","user_guide/differences.html#revert-return","user_guide/differences.html#prevrandao-difficulty","user_guide/differences.html#pc-extcodecopy","user_guide/differences.html#blobhash-blobbasefee","user_guide/differences.html#difference-regarding-the-solc-via-ir-mode","user_guide/differences.html#example-state-variable-initialization-order-in-inheritance","user_guide/rust_libraries.html#rust-contract-libraries","revive_runner.html#revive-runner-sandbox","revive_runner.html#installation-and-usage","revive_runner.html#trace-logs","revive_runner.html#automatic-contract-instantiation","revive_runner.html#example","developer_guide.html#developer-guide","developer_guide/contributing.html#contributor-guide","developer_guide/contributing.html#getting-started","developer_guide/contributing.html#using-the-makefile","developer_guide/contributing.html#codebase-organization","developer_guide/contributing.html#contribution-rules","developer_guide/contributing.html#style-guide","developer_guide/contributing.html#ai-policy","developer_guide/architecture.html#compiler-architecture-and-internals","developer_guide/architecture.html#resolc","developer_guide/architecture.html#reproducible-contract-builds","developer_guide/architecture.html#the-revive-compiler-libraries","developer_guide/architecture.html#evm-heap-memory","developer_guide/architecture.html#the-llvm-dependency","developer_guide/architecture.html#custom-optimizations","developer_guide/target.html#pvm-and-the-pallet-revive-runtime-target","developer_guide/target.html#target-cpu-configuration","developer_guide/target.html#why-pvm","developer_guide/target.html#host-environment-pallet-revive","developer_guide/testing.html#testing-strategy","developer_guide/testing.html#bug-compatibility-with-ethereum-solidity","developer_guide/testing.html#differential-integration-tests","developer_guide/testing.html#the-differential-testing-utility","developer_guide/cross_compilation.html#cross-compilation","developer_guide/cross_compilation.html#wasm-via-emscripten","developer_guide/cross_compilation.html#musl-libc","faq.html#faq","faq.html#what-evm-version-do-you-support","faq.html#is-inline-assembly-supported","faq.html#do-you-support-opcode-xy","faq.html#in-what-solidity-version-should-i-write-my-dapp","faq.html#tool-xy-says-the-contract-size-is-larger-than-24kb-and-will-fail-to-deploy","faq.html#is-resolc-a-drop-in-replacement-for-solc","roadmap.html#vision-and-roadmap","roadmap.html#roadmap"],"index":{"documentStore":{"docInfo":{"0":{"body":74,"breadcrumbs":2,"title":1},"1":{"body":22,"breadcrumbs":3,"title":2},"10":{"body":6,"breadcrumbs":7,"title":3},"11":{"body":33,"breadcrumbs":8,"title":2},"12":{"body":53,"breadcrumbs":9,"title":3},"13":{"body":62,"breadcrumbs":8,"title":2},"14":{"body":75,"breadcrumbs":8,"title":2},"15":{"body":10,"brLine truncated
+1 -1
Submodule llvm updated: 3b5b5c1ec4...2078da43e2.
+5
View File
@@ -1585,6 +1585,7 @@
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.32.1.tgz",
"integrity": "sha512-LKMrmwCPoLhM45Z00O1ulb6jwyVr2kr3XJp+G+tSEZcbauNnScewcQwtJqXDhXeYPDEjZ8C1SjXm015CirEmGg==",
"license": "MIT",
"peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "8.32.1",
"@typescript-eslint/types": "8.32.1",
@@ -1752,6 +1753,7 @@
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz",
"integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==",
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -2361,6 +2363,7 @@
"resolved": "https://registry.npmjs.org/eslint/-/eslint-9.27.0.tgz",
"integrity": "sha512-ixRawFQuMB9DZ7fjU3iGGganFDp3+45bPOdaRurcFHSXO1e/sYwUX/FtQZpLZJR6SjMoJH8hR2pPEAfDyCoU2Q==",
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.12.1",
@@ -2519,6 +2522,7 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"@ethersproject/abi": "5.8.0",
"@ethersproject/abstract-provider": "5.8.0",
@@ -4393,6 +4397,7 @@
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"