diff --git a/.github/actions/get-llvm/action.yml b/.github/actions/get-llvm/action.yml index e61e32e..b9240f8 100644 --- a/.github/actions/get-llvm/action.yml +++ b/.github/actions/get-llvm/action.yml @@ -26,11 +26,14 @@ runs: # Extract version from branch name (e.g., "18.x" from "release/18.x") VERSION_PREFIX=$(echo "$BRANCH" | sed 's|release/||' | sed 's|\.x$||') echo "Detected LLVM version prefix from submodule branch: $VERSION_PREFIX" - + # Special case: pin LLVM 18 to specific version 18.1.8 if [ "$VERSION_PREFIX" = "18" ]; then echo "Using pinned version for LLVM 18: llvm-18.1.8" echo "version_prefix=llvm-18.1.8" >> $GITHUB_OUTPUT + elif [ "$VERSION_PREFIX" = "21" ]; then + echo "Using pinned version for LLVM 21: llvm-21.1.6" + echo "version_prefix=llvm-21.1.6" >> $GITHUB_OUTPUT else echo "version_prefix=llvm-$VERSION_PREFIX" >> $GITHUB_OUTPUT fi @@ -42,7 +45,7 @@ runs: echo "Using explicitly provided version: ${{ inputs.version }}" echo "version_prefix=${{ inputs.version }}" >> $GITHUB_OUTPUT fi - + - name: find asset id: find uses: actions/github-script@v7 @@ -53,12 +56,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, @@ -66,43 +72,57 @@ 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); - }); - - let llvmRelease; - if (versionPrefix) { - // Search for latest release matching the version prefix - llvmRelease = releases.find(release => { - return release.tag_name.startsWith(versionPrefix); - }); - if (llvmRelease) { - core.info(`Found LLVM release matching prefix '${versionPrefix}': ${llvmRelease.tag_name}`); - } + if (res.data.length > 0) { + core.info(`Page ${page}: Fetched ${res.data.length} releases`); + allReleases.push(...res.data); + page++; } else { - // Find latest LLVM release - llvmRelease = releases.find(release => { - return release.tag_name.startsWith('llvm-'); - }); - if (llvmRelease) { - core.info(`Found latest LLVM version: ${llvmRelease.tag_name}`); - } + hasMorePages = false; } + } - if (llvmRelease){ - let asset = llvmRelease.assets.find(asset =>{ - return asset.name.includes(target); - }); - if (!asset){ - core.setFailed(`Artifact for '${target}' not found in release ${llvmRelease.tag_name} (${llvmRelease.html_url})`); - process.exit(); - } - return asset.browser_download_url; + core.info(`Total releases fetched: ${allReleases.length}`); + + // Sort all releases by publication date (newest first) + allReleases.sort((a, b) => { + return (a.published_at < b.published_at) ? 1 : ((a.published_at > b.published_at) ? -1 : 0); + }); + + // 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 = llvmReleases.find(release => { + return release.tag_name.startsWith(versionPrefix); + }); + if (llvmRelease) { + core.info(`Selected LLVM release matching prefix '${versionPrefix}': ${llvmRelease.tag_name}`); } + } else { + // Find latest LLVM release (first in sorted list) + llvmRelease = llvmReleases[0]; + if (llvmRelease) { + core.info(`Selected latest LLVM version: ${llvmRelease.tag_name}`); + } + } - page++; - } while(releases.length > 0); + if (llvmRelease) { + let asset = llvmRelease.assets.find(asset => { + return asset.name.includes(target); + }); + if (!asset) { + core.setFailed(`Artifact for '${target}' not found in release ${llvmRelease.tag_name} (${llvmRelease.html_url})`); + process.exit(); + } + return asset.browser_download_url; + } if (versionPrefix) { core.setFailed(`No LLVM releases matching prefix '${versionPrefix}' found! Please check the version.`); diff --git a/.github/workflows/release-llvm.yml b/.github/workflows/release-llvm.yml index 2877918..c65b94b 100644 --- a/.github/workflows/release-llvm.yml +++ b/.github/workflows/release-llvm.yml @@ -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' }} diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index ec3354f..474a28a 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -92,7 +92,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 @@ -103,7 +103,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 }} " @@ -163,7 +163,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 diff --git a/.github/workflows/test-wasm.yml b/.github/workflows/test-wasm.yml index 96ff660..8eac672 100644 --- a/.github/workflows/test-wasm.yml +++ b/.github/workflows/test-wasm.yml @@ -47,7 +47,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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 48954b1..2d0b95b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: | diff --git a/.gitmodules b/.gitmodules index 8d51bb7..9d2f460 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "llvm"] path = llvm url = https://github.com/llvm/llvm-project.git - branch = release/18.x + branch = release/21.x diff --git a/Cargo.lock b/Cargo.lock index 23eb0ea..2092247 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4552,24 +4552,21 @@ checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" [[package]] name = "inkwell" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67349bd7578d4afebbe15eaa642a80b884e8623db74b1716611b131feb1deef" +version = "0.7.1" +source = "git+https://github.com/TheDan64/inkwell.git?branch=master#7abf48a2cf4fc3e338fbeb1780ac7507cbb13e98" dependencies = [ - "either", "inkwell_internals", "libc", "llvm-sys", "once_cell", "serde", - "thiserror 1.0.69", + "thiserror 2.0.17", ] [[package]] name = "inkwell_internals" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f365c8de536236cfdebd0ba2130de22acefed18b1fb99c32783b3840aec5fb46" +version = "0.12.0" +source = "git+https://github.com/TheDan64/inkwell.git?branch=master#7abf48a2cf4fc3e338fbeb1780ac7507cbb13e98" dependencies = [ "proc-macro2", "quote", @@ -4927,9 +4924,9 @@ dependencies = [ [[package]] name = "llvm-sys" -version = "181.2.0" +version = "211.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d320f9d2723c97d4b78f9190a61ed25cc7cfbe456668c08e6e7dd8e50ceb8500" +checksum = "108b3ad2b2eaf2a561fc74196273b20e3436e4a688b8b44e250d83974dc1b2e2" dependencies = [ "anyhow", "cc", diff --git a/Cargo.toml b/Cargo.toml index 21009d6..a8c9e4b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,9 +80,10 @@ polkadot-sdk = { version = "=2507.4.0" } # llvm [workspace.dependencies.inkwell] -version = "0.6.0" +git = "https://github.com/TheDan64/inkwell.git" +branch = "master" 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" diff --git a/Dockerfile b/Dockerfile index 26fa775..a3d0af5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ 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 diff --git a/README.md b/README.md index 1e0e97b..84d6c17 100644 --- a/README.md +++ b/README.md @@ -69,9 +69,9 @@ Download the [latest LLVM build](https://github.com/paritytech/revive/releases?q > xattr -rc /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=/target-llvm/gnu/target-final +export LLVM_SYS_211_PREFIX=/target-llvm/gnu/target-final ``` @@ -79,18 +79,18 @@ export LLVM_SYS_181_PREFIX=/target-llvm/gnu/targ
Building from source -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 ```
### 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: diff --git a/crates/build-utils/src/lib.rs b/crates/build-utils/src/lib.rs index fc30e0b..489af41 100644 --- a/crates/build-utils/src/lib.rs +++ b/crates/build-utils/src/lib.rs @@ -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"; diff --git a/crates/integration/codesize.json b/crates/integration/codesize.json index 8e3ca89..a7b3f07 100644 --- a/crates/integration/codesize.json +++ b/crates/integration/codesize.json @@ -7,4 +7,4 @@ "FibonacciIterative": 1454, "Flipper": 2083, "SHA1": 7727 -} \ No newline at end of file +} diff --git a/crates/lld-sys/build.rs b/crates/lld-sys/build.rs index 469f45d..3796611 100644 --- a/crates/lld-sys/build.rs +++ b/crates/lld-sys/build.rs @@ -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}"); } diff --git a/crates/llvm-builder/README.md b/crates/llvm-builder/README.md index d772739..785358e 100644 --- a/crates/llvm-builder/README.md +++ b/crates/llvm-builder/README.md @@ -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`. diff --git a/crates/llvm-builder/src/platforms/aarch64_linux_musl.rs b/crates/llvm-builder/src/platforms/aarch64_linux_musl.rs index dd33a12..9a0b458 100644 --- a/crates/llvm-builder/src/platforms/aarch64_linux_musl.rs +++ b/crates/llvm-builder/src/platforms/aarch64_linux_musl.rs @@ -221,7 +221,6 @@ fn build_host( "-DCOMPILER_RT_BUILD_MEMPROF='Off'", "-DCOMPILER_RT_BUILD_ORC='Off'", "-DCOMPILER_RT_DEFAULT_TARGET_ARCH='aarch64'", - "-DCOMPILER_RT_DEFAULT_TARGET_ONLY='On'", ]) .args(crate::platforms::shared::SHARED_BUILD_OPTS) .args(crate::platforms::shared::shared_build_opts_ccache( diff --git a/crates/llvm-builder/src/platforms/x86_64_linux_musl.rs b/crates/llvm-builder/src/platforms/x86_64_linux_musl.rs index 74228bc..07a7bc0 100644 --- a/crates/llvm-builder/src/platforms/x86_64_linux_musl.rs +++ b/crates/llvm-builder/src/platforms/x86_64_linux_musl.rs @@ -219,7 +219,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'", ]) diff --git a/crates/llvm-builder/src/utils.rs b/crates/llvm-builder/src/utils.rs index fbd2b33..805bd72 100644 --- a/crates/llvm-builder/src/utils.rs +++ b/crates/llvm-builder/src/utils.rs @@ -38,7 +38,7 @@ pub const MUSL_SNAPSHOTS_URL: &str = "https://git.musl-libc.org/cgit/musl/snapsh pub const EMSDK_SOURCE_URL: &str = "https://github.com/emscripten-core/emsdk.git"; /// The emscripten SDK version. -pub const EMSDK_VERSION: &str = "4.0.9"; +pub const EMSDK_VERSION: &str = "4.0.20"; /// The subprocess runner. /// diff --git a/crates/llvm-context/src/polkavm/context/attribute.rs b/crates/llvm-context/src/polkavm/context/attribute.rs index 3601580..166fa6f 100644 --- a/crates/llvm-context/src/polkavm/context/attribute.rs +++ b/crates/llvm-context/src/polkavm/context/attribute.rs @@ -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 { diff --git a/crates/llvm-context/src/polkavm/context/mod.rs b/crates/llvm-context/src/polkavm/context/mod.rs index 3730227..90a46d9 100644 --- a/crates/llvm-context/src/polkavm/context/mod.rs +++ b/crates/llvm-context/src/polkavm/context/mod.rs @@ -838,8 +838,7 @@ impl<'ctx> Context<'ctx> { .builder() .build_call(intrinsic, &[value.into()], "call_byte_swap")? .try_as_basic_value() - .left() - .unwrap()) + .unwrap_basic()) } /// Builds a GEP instruction. @@ -912,7 +911,7 @@ impl<'ctx> Context<'ctx> { ) .unwrap() .try_as_basic_value() - .left() + .basic() } /// Builds a call to the runtime API `import`, where `import` is a "getter" API. @@ -950,7 +949,7 @@ impl<'ctx> Context<'ctx> { ) .unwrap(); self.modify_call_site_value(arguments, call_site_value, function); - call_site_value.try_as_basic_value().left() + call_site_value.try_as_basic_value().basic() } /// Sets the alignment to `1`, since all non-stack memory pages have such alignment. @@ -1082,13 +1081,7 @@ impl<'ctx> Context<'ctx> { Ok(call_site_value .try_as_basic_value() - .left() - .unwrap_or_else(|| { - panic!( - "revive runtime function {} should return a value", - ::NAME, - ) - }) + .unwrap_basic() .into_pointer_value()) } @@ -1277,7 +1270,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), diff --git a/crates/llvm-context/src/polkavm/evm/bitwise.rs b/crates/llvm-context/src/polkavm/evm/bitwise.rs index e9cb56c..1580775 100644 --- a/crates/llvm-context/src/polkavm/evm/bitwise.rs +++ b/crates/llvm-context/src/polkavm/evm/bitwise.rs @@ -275,6 +275,6 @@ pub fn count_leading_zeros<'ctx>( "clz", )? .try_as_basic_value() - .left() + .basic() .expect("the llvm.ctlz should return a value")) } diff --git a/crates/resolc/Cargo.toml b/crates/resolc/Cargo.toml index bacdbd8..5f79d21 100644 --- a/crates/resolc/Cargo.toml +++ b/crates/resolc/Cargo.toml @@ -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 } diff --git a/crates/runtime-api/Cargo.toml b/crates/runtime-api/Cargo.toml index 84d56ff..96f0f66 100644 --- a/crates/runtime-api/Cargo.toml +++ b/crates/runtime-api/Cargo.toml @@ -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 } diff --git a/crates/stdlib/Cargo.toml b/crates/stdlib/Cargo.toml index 76c6ab6..b2e29e0 100644 --- a/crates/stdlib/Cargo.toml +++ b/crates/stdlib/Cargo.toml @@ -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 } diff --git a/llvm b/llvm index 3b5b5c1..f68f64e 160000 --- a/llvm +++ b/llvm @@ -1 +1 @@ -Subproject commit 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff +Subproject commit f68f64eb81305724d7649814f61103936c903ca6