Skip to content

Commit d77483f

Browse files
committed
replace cargo external-symbols feature with a rustc --cfg flag
This feature was not useful for Cargo users, since Cargo does not give you the kind of fine-grained control over C library linkage that you need. So it was just unnecessarily confusing and would cause the build to break if you enabled it accidentally, say, with --all-features.
1 parent b31bf2f commit d77483f

File tree

7 files changed

+65
-77
lines changed

7 files changed

+65
-77
lines changed

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ endomorphism = ["secp256k1-sys/endomorphism"]
2626
lowmemory = ["secp256k1-sys/lowmemory"]
2727
global-context = ["std", "rand-std"]
2828

29-
# Use this feature to not compile the bundled libsecp256k1 C symbols,
30-
# but use external ones. Use this only if you know what you are doing!
31-
external-symbols = ["secp256k1-sys/external-symbols"]
32-
3329
# Do not use this feature! HAZMAT. (meant for Fuzzing only. this is *BROKEN CRYPTOGRAPHY*)
3430
fuzztarget = ["secp256k1-sys/fuzztarget"]
3531

secp256k1-sys/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,5 @@ endomorphism = []
3131
lowmemory = []
3232
std = []
3333

34-
# Use this feature to not compile the bundled libsecp256k1 C symbols,
35-
# but use external ones. Use this only if you know what you are doing!
36-
external-symbols = []
37-
3834
# Do not use this feature! HAZMAT. (meant for Fuzzing only. this is *BROKEN CRYPTOGRAPHY*)
3935
fuzztarget = []

secp256k1-sys/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ $ ./vendor-libsecp.sh depend <version-code> <rev>
2929

3030
## Linking to external symbols
3131

32-
For the more exotic use cases, this crate can be used with existing libsecp256k1
33-
symbols by using the `external-symbols` feature. How to setup rustc to link
34-
against those existing symbols is left as an exercise to the reader.
32+
If you want to compile this library without using the bundled symbols (which may
33+
be required for integration into other build systems), you can do so by adding
34+
`--cfg=rust_secp_no_symbol_renaming'` to your `RUSTFLAGS` variable.
35+

secp256k1-sys/build.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ extern crate cc;
2626
use std::env;
2727

2828
fn main() {
29-
if cfg!(feature = "external-symbols") {
30-
println!("cargo:rustc-link-lib=static=secp256k1");
31-
return;
32-
}
33-
3429
// Actual build
3530
let mut base_config = cc::Build::new();
3631
base_config.include("depend/secp256k1/")

secp256k1-sys/src/lib.rs

Lines changed: 55 additions & 55 deletions
Large diffs are not rendered by default.

secp256k1-sys/src/recovery.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@ impl Default for RecoverableSignature {
3838

3939
#[cfg(not(feature = "fuzztarget"))]
4040
extern "C" {
41-
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_3_1_ecdsa_recoverable_signature_parse_compact")]
41+
#[cfg_attr(not(rust_secp_no_symbol_renaming), link_name = "rustsecp256k1_v0_3_1_ecdsa_recoverable_signature_parse_compact")]
4242
pub fn secp256k1_ecdsa_recoverable_signature_parse_compact(cx: *const Context, sig: *mut RecoverableSignature,
4343
input64: *const c_uchar, recid: c_int)
4444
-> c_int;
4545

46-
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_3_1_ecdsa_recoverable_signature_serialize_compact")]
46+
#[cfg_attr(not(rust_secp_no_symbol_renaming), link_name = "rustsecp256k1_v0_3_1_ecdsa_recoverable_signature_serialize_compact")]
4747
pub fn secp256k1_ecdsa_recoverable_signature_serialize_compact(cx: *const Context, output64: *mut c_uchar,
4848
recid: *mut c_int, sig: *const RecoverableSignature)
4949
-> c_int;
5050

51-
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_3_1_ecdsa_recoverable_signature_convert")]
51+
#[cfg_attr(not(rust_secp_no_symbol_renaming), link_name = "rustsecp256k1_v0_3_1_ecdsa_recoverable_signature_convert")]
5252
pub fn secp256k1_ecdsa_recoverable_signature_convert(cx: *const Context, sig: *mut Signature,
5353
input: *const RecoverableSignature)
5454
-> c_int;
55-
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_3_1_ecdsa_sign_recoverable")]
55+
#[cfg_attr(not(rust_secp_no_symbol_renaming), link_name = "rustsecp256k1_v0_3_1_ecdsa_sign_recoverable")]
5656
pub fn secp256k1_ecdsa_sign_recoverable(cx: *const Context,
5757
sig: *mut RecoverableSignature,
5858
msg32: *const c_uchar,
@@ -61,7 +61,7 @@ extern "C" {
6161
noncedata: *const c_void)
6262
-> c_int;
6363

64-
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_3_1_ecdsa_recover")]
64+
#[cfg_attr(not(rust_secp_no_symbol_renaming), link_name = "rustsecp256k1_v0_3_1_ecdsa_recover")]
6565
pub fn secp256k1_ecdsa_recover(cx: *const Context,
6666
pk: *mut PublicKey,
6767
sig: *const RecoverableSignature,

secp256k1-sys/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl AlignedType {
4040
}
4141
}
4242

43-
#[cfg(all(feature = "std", not(feature = "external-symbols")))]
43+
#[cfg(all(feature = "std", not(rust_secp_no_symbol_renaming)))]
4444
pub(crate) const ALIGN_TO: usize = mem::align_of::<AlignedType>();
4545

4646

0 commit comments

Comments
 (0)