Skip to content

Commit 153a74b

Browse files
committed
Add prefixes to more symbols in libbacktrace
More symbols are exported than previously though (on OSX only) and it looks like they in theory should be `static` in the defining file but they aren't, so let's add them to the list of symbols to mangle when compiling. Closes #212
1 parent 9a87e81 commit 153a74b

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ required-features = ["std"]
130130
name = "raw"
131131
required-features = ["std"]
132132

133+
[[example]]
134+
name = "dylib"
135+
required-features = ["std"]
136+
crate-type = ['dylib']
137+
133138
[[test]]
134139
name = "skip_inner_frames"
135140
required-features = ["std"]

crates/backtrace-sys/build.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@ fn main() {
9494
"backtrace_qsort",
9595
"backtrace_create_state",
9696
"backtrace_uncompress_zdebug",
97+
98+
// These should be `static` in C, but they aren't...
99+
"macho_get_view",
100+
"macho_symbol_type_relevant",
101+
"macho_get_commands",
102+
"macho_try_dsym",
103+
"macho_try_dwarf",
104+
"macho_get_addr_range",
105+
"macho_get_uuid",
106+
"macho_add",
107+
"macho_add_symtab",
108+
"macho_file_to_host_u64",
109+
"macho_file_to_host_u32",
97110
];
98111
let prefix = if cfg!(feature = "rustc-dep-of-std") {
99112
println!("cargo:rustc-cfg=rdos");

examples/dylib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//! An example which is actually a test that we can build a `dylib` crate type
2+
//! with this library.
3+
4+
pub fn foo() {
5+
println!("{:?}", backtrace::Backtrace::new());
6+
}

0 commit comments

Comments
 (0)