-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: don't generate A instructions (#37)
A instructions are only supported after ckb 2023 hardfork. It's not supported on ckb testnet or mainnet now. So we use some compiler and linking hacks to avoid generating A instructions. See https://github.com/xxuejie/ckb-contract-bytes-without-a/ for a more detailed explanation.
- Loading branch information
Showing
13 changed files
with
497 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
[build] | ||
target = "riscv64imac-unknown-none-elf" | ||
rustflags = [ | ||
"-C", "target-feature=-a" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "atomics-polyfill" | ||
version = "0.1.0" | ||
edition = "2021" | ||
license = "MIT" | ||
homepage = "https://github.com/synapseweb3/ibc-ckb-contracts" | ||
repository = "https://github.com/synapseweb3/ibc-ckb-contracts" | ||
|
||
[lib] | ||
|
||
[build-dependencies] | ||
cc = "1.0.83" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Inspired by https://github.com/xxuejie/ckb-contract-bytes-without-a/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
fn main() { | ||
// let clang = match std::env::var_os("CLANG") { | ||
// Some(val) => val, | ||
// None => "clang-16".into(), | ||
// }; | ||
|
||
cc::Build::new() | ||
.file("src/atomics.c") | ||
.static_flag(true) | ||
// .compiler(clang) | ||
.no_default_flags(true) | ||
// .flag("--target=riscv64") | ||
.flag("-march=rv64imc") | ||
.flag("-O3") | ||
.flag("-fvisibility=hidden") | ||
.flag("-fdata-sections") | ||
.flag("-ffunction-sections") | ||
.flag("-Wall") | ||
.flag("-Werror") | ||
.flag("-Wno-unused-parameter") | ||
.define("__SHARED_LIBRARY__", None) | ||
.compile("atomics-polyfill"); | ||
} |
Oops, something went wrong.