Closed
Description
void foo();
int main()
{
foo();
return 0;
}
#![crate_type = "staticlib"]
struct Destroy;
impl Drop for Destroy { fn drop(&mut self) {} }
thread_local! {
static X: Destroy = Destroy
}
#[no_mangle]
pub extern "C" fn foo() {
X.with(|_| ());
}
rustc staticlib2.rs
gcc staticlib2.c libstaticlib2.a -ldl -lpthread -lrt -lgcc_s -lpthread -lc -lm -o staticlib2
gcc staticlib2.c -pie libstaticlib2.a -ldl -lpthread -lrt -lgcc_s -lpthread -lc -lm -o staticlib2-pie
staticlib2
segfaults, staticlib2-pie
doesn't.
This is possibly/probably the expected behaviour, but it would be quite nice to not cause a segfault or at least find some way to help the user get it right. (cc http://stackoverflow.com/q/29632715/1256624)
Metadata
Metadata
Assignees
Labels
No labels