-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Pass objcopy args for stripping on OSX #135034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,8 @@ | ||
fn main() { | ||
hey_i_get_compiled(); | ||
} | ||
|
||
#[inline(never)] | ||
fn hey_i_get_compiled() { | ||
println!("Hi! Do or do not strip me, your choice."); | ||
} |
This file contains hidden or 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,42 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
//@ ignore-windows Windows does not actually strip | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
// Test that -Cstrip correctly strips/preserves debuginfo and symbols. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
use run_make_support::{bin_name, is_darwin, llvm_dwarfdump, llvm_nm, rustc}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
fn main() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
// We use DW_ (the start of any DWARF name) to check that some debuginfo is present. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
let dwarf_indicator = "DW_"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
let test_symbol = "hey_i_get_compiled"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
let binary = &bin_name("hello"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
// Avoid checking debuginfo on darwin, because it is not actually affected by strip. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
// Darwin *never* puts debuginfo in the main binary (-Csplit-debuginfo=off just removes it), | ||||||||||||||||||||||||||||||||||||||||||||||||||||
// so we never actually have any debuginfo in there, so we can't check that it's present. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
let do_debuginfo_check = !is_darwin(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+14
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remark: the split-debuginfo behavior is observed in the rust/tests/run-make/split-debuginfo/Makefile Lines 8 to 32 in 1b2745d
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
// Additionally, use -Cdebuginfo=2 to make the test independent of the amount of debuginfo | ||||||||||||||||||||||||||||||||||||||||||||||||||||
// for std. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
// -Cstrip=none should preserve symbols and debuginfo. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
rustc().arg("hello.rs").arg("-Cdebuginfo=2").arg("-Cstrip=none").run(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
llvm_nm().input(binary).run().assert_stdout_contains(test_symbol); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
if do_debuginfo_check { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
llvm_dwarfdump().input(binary).run().assert_stdout_contains(dwarf_indicator); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
// -Cstrip=debuginfo should preserve symbols and strip debuginfo. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
rustc().arg("hello.rs").arg("-Cdebuginfo=2").arg("-Cstrip=debuginfo").run(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
llvm_nm().input(binary).run().assert_stdout_contains(test_symbol); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
if do_debuginfo_check { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
llvm_dwarfdump().input(binary).run().assert_stdout_not_contains(dwarf_indicator); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
// -Cstrip=symbols should strip symbols and strip debuginfo. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
rustc().arg("hello.rs").arg("-Cdebuginfo=2").arg("-Cstrip=symbols").run(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
llvm_nm().input(binary).run().assert_stderr_not_contains(test_symbol); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
if do_debuginfo_check { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
llvm_dwarfdump().input(binary).run().assert_stdout_not_contains(dwarf_indicator); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.