Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dummy atomic support #92

Merged
merged 4 commits into from
Jun 13, 2024
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
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ dlopen-c = ["libc"]
build-with-clang = []
libc = []
ckb2023 = []
# work with `target-feature=-a` Cargo flag
dummy-atomic = []

[build-dependencies]
cc = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This library contains several modules that help you write CKB contract with Rust
* `debug!` macro: a `println!` like macro helps debugging
* `entry!` macro: defines contract entry point
* `default_alloc!` macro: defines global allocator for no-std rust

* `dummy_atomic` module: dummy atomic operations
### Memory allocator

Default allocator uses a mixed allocation strategy:
Expand Down
4 changes: 4 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ fn main() {
setup_compiler_flags(&mut build);
build.compile("libc");
}
if target_arch != "riscv64" && cfg!(feature = "dummy-atomic") {
println!("cargo:warning=This build script intentionally failed: feature `dummy-atomic` can't be used in non risc-v target");
std::process::exit(1);
}
}

fn setup_compiler_flags(build: &mut cc::Build) {
Expand Down
14 changes: 14 additions & 0 deletions contracts/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion contracts/ckb-std-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
ckb-std = { path = "../../", features = [ "dlopen-c" ] }
ckb-std = { path = "../../", features = [ "dlopen-c", "dummy-atomic" ] }
blake2b-ref = { version = "0.3", default-features = false }
bytes = { version = "1.6.0", default-features = false }
log = { version = "0.4.17", default-features = false }
Loading
Loading