Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2bdd075
implement `Termination` for `Result<Infallible, E>`
ibraheemdev Sep 2, 2021
2433d37
simplify `impl Termination for Result<Infallible, E>`
ibraheemdev Sep 3, 2021
caf206b
Stabilize File::options()
workingjubilee May 27, 2021
181716a
compare between Path instead of str
tamaroning Nov 11, 2021
a24e2ed
Android is not GNU
cuviper Nov 12, 2021
2d46d1b
Rename WASI's `is_character_device` to `is_char_device`.
sunfishcode Nov 12, 2021
6323f92
Remove bigint_helper_methods for *signed* types
scottmcm Nov 13, 2021
94ca0b3
fix ICE on Miri/CTFE copy of half a pointer
RalfJung Nov 14, 2021
60595f7
disable portable SIMD tests in Miri
RalfJung Nov 14, 2021
ab5434f
Move some tests to more reasonable directories
c410-f3r Nov 14, 2021
c4884bb
Support having -Z and -C options with the same name
joshtriplett Oct 21, 2021
e35b7bb
Stabilize -Z strip as -C strip
joshtriplett Oct 21, 2021
73ec27d
Rollup merge of #85766 - workingjubilee:file-options, r=yaahc
JohnTitor Nov 16, 2021
c44455a
Rollup merge of #88601 - ibraheemdev:termination-result-infallible, r…
JohnTitor Nov 16, 2021
a0dc4ab
Rollup merge of #90058 - joshtriplett:stabilize-strip, r=wesleywiser
JohnTitor Nov 16, 2021
aaac528
Rollup merge of #90790 - tamaroning:fix-lib-std-test, r=Mark-Simulacrum
JohnTitor Nov 16, 2021
ed7ed5f
Rollup merge of #90834 - cuviper:android-gnu, r=petrochenkov
JohnTitor Nov 16, 2021
96cfc9e
Rollup merge of #90835 - sunfishcode:sunfishcode/wasi-char-device, r=…
JohnTitor Nov 16, 2021
12d5297
Rollup merge of #90837 - c410-f3r:testsssssss, r=petrochenkov
JohnTitor Nov 16, 2021
fb96ecc
Rollup merge of #90848 - scottmcm:remove-signed-bigint-helpers, r=jos…
JohnTitor Nov 16, 2021
fff9055
Rollup merge of #90892 - RalfJung:miri-partial-ptr-copy, r=oli-obk
JohnTitor Nov 16, 2021
35dd1f6
Rollup merge of #90909 - RalfJung:miri-no-portable-simd, r=workingjub…
JohnTitor Nov 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1034,15 +1034,25 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(
SplitDebuginfo::Packed => link_dwarf_object(sess, &out_filename),
}

let strip = strip_value(sess);

if sess.target.is_like_osx {
match sess.opts.debugging_opts.strip {
match strip {
Strip::Debuginfo => strip_symbols_in_osx(sess, &out_filename, Some("-S")),
Strip::Symbols => strip_symbols_in_osx(sess, &out_filename, None),
Strip::None => {}
}
}
}

// Temporarily support both -Z strip and -C strip
fn strip_value(sess: &Session) -> Strip {
match (sess.opts.debugging_opts.strip, sess.opts.cg.strip) {
(s, Strip::None) => s,
(_, s) => s,
}
}

fn strip_symbols_in_osx<'a>(sess: &'a Session, out_filename: &Path, option: Option<&str>) {
let mut cmd = Command::new("strip");
if let Some(option) = option {
Expand Down Expand Up @@ -2014,7 +2024,7 @@ fn add_order_independent_options(
cmd.optimize();

// Pass debuginfo and strip flags down to the linker.
cmd.debuginfo(sess.opts.debugging_opts.strip);
cmd.debuginfo(strip_value(sess));

// We want to prevent the compiler from accidentally leaking in any system libraries,
// so by default we tell linkers not to link to any default libraries.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ fn test_codegen_options_tracking_hash() {
untracked!(remark, Passes::Some(vec![String::from("pass1"), String::from("pass2")]));
untracked!(rpath, true);
untracked!(save_temps, true);
untracked!(strip, Strip::Debuginfo);

macro_rules! tracked {
($name: ident, $non_default_value: expr) => {
Expand Down Expand Up @@ -684,7 +685,6 @@ fn test_debugging_options_tracking_hash() {
untracked!(self_profile_events, Some(vec![String::new()]));
untracked!(span_debug, true);
untracked!(span_free_formats, true);
untracked!(strip, Strip::Debuginfo);
untracked!(temps_dir, Some(String::from("abc")));
untracked!(terminal_width, Some(80));
untracked!(threads, 99);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use std::iter::{self, FromIterator};
use std::path::{Path, PathBuf};
use std::str::{self, FromStr};

/// The different settings that the `-Z strip` flag can have.
/// The different settings that the `-C strip` flag can have.
#[derive(Clone, Copy, PartialEq, Hash, Debug)]
pub enum Strip {
/// Do not strip at all.
Expand Down
16 changes: 10 additions & 6 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ top_level_options!(
/// generated code to parse an option into its respective field in the struct. There are a few
/// hand-written parsers for parsing specific types of values in this module.
macro_rules! options {
($struct_name:ident, $stat:ident, $prefix:expr, $outputname:expr,
($struct_name:ident, $stat:ident, $optmod:ident, $prefix:expr, $outputname:expr,
$($( #[$attr:meta] )* $opt:ident : $t:ty = (
$init:expr,
$parse:ident,
Expand Down Expand Up @@ -264,13 +264,15 @@ macro_rules! options {
}

pub const $stat: OptionDescrs<$struct_name> =
&[ $( (stringify!($opt), $opt, desc::$parse, $desc) ),* ];
&[ $( (stringify!($opt), $optmod::$opt, desc::$parse, $desc) ),* ];

mod $optmod {
$(
fn $opt(cg: &mut $struct_name, v: Option<&str>) -> bool {
parse::$parse(&mut redirect_field!(cg.$opt), v)
pub(super) fn $opt(cg: &mut super::$struct_name, v: Option<&str>) -> bool {
super::parse::$parse(&mut redirect_field!(cg.$opt), v)
}
)*
}

) }

Expand Down Expand Up @@ -918,7 +920,7 @@ mod parse {
}

options! {
CodegenOptions, CG_OPTIONS, "C", "codegen",
CodegenOptions, CG_OPTIONS, cgopts, "C", "codegen",

// This list is in alphabetical order.
//
Expand Down Expand Up @@ -1013,6 +1015,8 @@ options! {
"use soft float ABI (*eabihf targets only) (default: no)"),
split_debuginfo: Option<SplitDebuginfo> = (None, parse_split_debuginfo, [TRACKED],
"how to handle split-debuginfo, a platform-specific option"),
strip: Strip = (Strip::None, parse_strip, [UNTRACKED],
"tell the linker which information to strip (`none` (default), `debuginfo` or `symbols`)"),
target_cpu: Option<String> = (None, parse_opt_string, [TRACKED],
"select target processor (`rustc --print target-cpus` for details)"),
target_feature: String = (String::new(), parse_target_feature, [TRACKED],
Expand All @@ -1027,7 +1031,7 @@ options! {
}

options! {
DebuggingOptions, DB_OPTIONS, "Z", "debugging",
DebuggingOptions, DB_OPTIONS, dbopts, "Z", "debugging",

// This list is in alphabetical order.
//
Expand Down
16 changes: 16 additions & 0 deletions src/doc/rustc/src/codegen-options/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,22 @@ platforms. Possible values are:
Note that `packed` and `unpacked` are gated behind `-Z unstable-options` on
non-macOS platforms at this time.

## strip

The option `-C strip=val` controls stripping of debuginfo and similar auxiliary
data from binaries during linking.

Supported values for this option are:

- `none` - debuginfo and symbols (if they exist) are copied to the produced
binary or separate files depending on the target (e.g. `.pdb` files in case
of MSVC).
- `debuginfo` - debuginfo sections and debuginfo symbols from the symbol table
section are stripped at link time and are not copied to the produced binary
or separate files.
- `symbols` - same as `debuginfo`, but the rest of the symbol table section is
stripped as well if the linker supports it.

## target-cpu

This instructs `rustc` to generate code specifically for a particular processor.
Expand Down
17 changes: 0 additions & 17 deletions src/doc/unstable-book/src/compiler-flags/strip.md

This file was deleted.