|
| 1 | +// Bitcoin secp256k1 bindings |
| 2 | +// Written in 2014 by |
| 3 | +// Elichai Turkel |
| 4 | +// |
| 5 | +// To the extent possible under law, the author(s) have dedicated all |
| 6 | +// copyright and related and neighboring rights to this software to |
| 7 | +// the public domain worldwide. This software is distributed without |
| 8 | +// any warranty. |
| 9 | +// |
| 10 | +// You should have received a copy of the CC0 Public Domain Dedication |
| 11 | +// along with this software. |
| 12 | +// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. |
| 13 | +// |
| 14 | + |
| 15 | +//! # secp256k1 no-std test. |
| 16 | +//! This binary is a short smallest rust code to produce a working binary *without libstd*. |
| 17 | +//! This gives us 2 things: |
| 18 | +//! 1. Test that the parts of the code that should work in a no-std enviroment actually work. |
| 19 | +//! 2. Test that we don't accidentally import libstd into `secp256k1`. |
| 20 | +//! |
| 21 | +//! The first is tested using the following command `cargo run --release | grep -q "Verified Successfully"`. |
| 22 | +//! (Making sure that it successfully printed that. i.e. it didn't abort before that). |
| 23 | +//! |
| 24 | +//! The second is tested by the fact that it compiles. if we accidentally link against libstd we should see the following error: |
| 25 | +//! `error[E0152]: duplicate lang item found`. |
| 26 | +//! Example: |
| 27 | +//! ``` |
| 28 | +//! error[E0152]: duplicate lang item found: `eh_personality`. |
| 29 | +//! --> src/main.rs:37:1 |
| 30 | +//! | |
| 31 | +//! 37 | pub extern "C" fn rust_eh_personality() {} |
| 32 | +//! | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 33 | +//! | |
| 34 | +//! = note: first defined in crate `panic_unwind` (which `std` depends on). |
| 35 | +//! ``` |
| 36 | +//! |
| 37 | +//! Notes: |
| 38 | +//! * Requires `panic=abort` and `--release` to not depend on libunwind(which is provided usually by libstd) https://github.com/rust-lang/rust/issues/47493 |
| 39 | +//! * Requires linking with `libc` for calling `printf`. |
| 40 | +//! |
| 41 | +
|
1 | 42 | #![feature(lang_items)]
|
2 | 43 | #![feature(start)]
|
3 | 44 | #![feature(core_intrinsics)]
|
|
0 commit comments