-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
39 additions
and
9 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Functions from the library crate marked `#[no_mangle]` seem to be removed from executables if no references are made to the library, | ||
even when a linker arg like `-rdynamic` is used. | ||
This behaviour seems to be described in this bug report: https://github.com/rust-lang/rust/issues/47384. | ||
However, that bug report is supposedly fixed by https://github.com/rust-lang/rust/pull/95604. | ||
|
||
``` | ||
# cat src/bin/without_extern_crate.rs | ||
fn main() { | ||
println!("Hello, world!"); | ||
} | ||
``` | ||
|
||
``` | ||
# RUSTFLAGS='-C link-arg=-rdynamic' cargo build && nm -g target/debug/without_extern_crate.rs | grep foo | ||
# nothing | ||
``` | ||
|
||
``` | ||
# cat src/bin/with_extern_crate.rs | ||
extern crate export_symbols; | ||
fn main() { | ||
println!("Hello, world!"); | ||
} | ||
``` | ||
|
||
``` | ||
# RUSTFLAGS='-C link-arg=-rdynamic' cargo build && nm -g target/debug/with_extern_crate.rs | grep foo | ||
000000000006dfa0 T foo1 | ||
000000000006dfb0 T foo2 | ||
``` |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
extern crate export_symbols; | ||
|
||
fn main() { | ||
println!("Hello, world!"); | ||
} |
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,3 @@ | ||
fn main() { | ||
println!("Hello, world!"); | ||
} |