about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-02-06 19:57:09 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-02-10 00:50:39 -0800
commit071ee96277845af99bde5e7e15ccbb0cff9be0a7 (patch)
treebb78ee17f71137362577ed86dd09f4597c4acbef /src
parent2780d9dd5410a5c093f27eacfb1684ddbfcb4632 (diff)
downloadrust-071ee96277845af99bde5e7e15ccbb0cff9be0a7.tar.gz
rust-071ee96277845af99bde5e7e15ccbb0cff9be0a7.zip
Consolidate codegen-related compiler flags
Move them all behind a new -C switch. This migrates some -Z flags and some
top-level flags behind this -C codegen option.

The -C flag takes values of the form "-C name=value" where the "=value" is
optional for some flags.

Flags affected:

* --llvm-args           => -C llvm-args
* --passes              => -C passes
* --ar                  => -C ar
* --linker              => -C linker
* --link-args           => -C link-args
* --target-cpu          => -C target-cpu
* --target-feature      => -C target-fature
* --android-cross-path  => -C android-cross-path
* --save-temps          => -C save-temps
* --no-rpath            => -C no-rpath
* -Z no-prepopulate     => -C no-prepopulate-passes
* -Z no-vectorize-loops => -C no-vectorize-loops
* -Z no-vectorize-slp   => -C no-vectorize-slp
* -Z soft-float         => -C soft-float
* -Z gen-crate-map      => -C gen-crate-map
* -Z prefer-dynamic     => -C prefer-dynamic
* -Z no-integrated-as   => -C no-integrated-as

As a bonus, this also promotes the -Z extra-debug-info flag to a first class -g
or --debuginfo flag.

* -Z debug-info         => removed
* -Z extra-debug-info   => -g or --debuginfo

Closes #9770
Closes #12000
Diffstat (limited to 'src')
-rw-r--r--src/compiletest/runtest.rs6
-rw-r--r--src/doc/rust.md2
-rw-r--r--src/librustc/back/link.rs46
-rw-r--r--src/librustc/back/lto.rs2
-rw-r--r--src/librustc/driver/driver.rs109
-rw-r--r--src/librustc/driver/session.rs175
-rw-r--r--src/librustc/lib.rs28
-rw-r--r--src/librustc/middle/trans/_match.rs4
-rw-r--r--src/librustc/middle/trans/base.rs6
-rw-r--r--src/librustc/middle/trans/closure.rs2
-rw-r--r--src/librustc/middle/trans/context.rs2
-rw-r--r--src/librustc/middle/trans/controlflow.rs2
-rw-r--r--src/librustc/middle/trans/debuginfo.rs10
-rw-r--r--src/librustdoc/test.rs5
-rw-r--r--src/test/compile-fail/issue-10755.rs2
-rw-r--r--src/test/compile-fail/issue-11154.rs2
-rw-r--r--src/test/debug-info/basic-types-metadata.rs2
-rw-r--r--src/test/debug-info/basic-types.rs2
-rw-r--r--src/test/debug-info/borrowed-basic.rs2
-rw-r--r--src/test/debug-info/borrowed-c-style-enum.rs2
-rw-r--r--src/test/debug-info/borrowed-enum.rs2
-rw-r--r--src/test/debug-info/borrowed-managed-basic.rs2
-rw-r--r--src/test/debug-info/borrowed-struct.rs2
-rw-r--r--src/test/debug-info/borrowed-tuple.rs2
-rw-r--r--src/test/debug-info/borrowed-unique-basic.rs2
-rw-r--r--src/test/debug-info/box.rs2
-rw-r--r--src/test/debug-info/boxed-struct.rs2
-rw-r--r--src/test/debug-info/boxed-vec.rs2
-rw-r--r--src/test/debug-info/by-value-non-immediate-argument.rs2
-rw-r--r--src/test/debug-info/by-value-self-argument-in-trait-impl.rs2
-rw-r--r--src/test/debug-info/c-style-enum-in-composite.rs2
-rw-r--r--src/test/debug-info/c-style-enum.rs2
-rw-r--r--src/test/debug-info/closure-in-generic-function.rs2
-rw-r--r--src/test/debug-info/destructured-fn-argument.rs2
-rw-r--r--src/test/debug-info/destructured-local.rs2
-rw-r--r--src/test/debug-info/evec-in-struct.rs2
-rw-r--r--src/test/debug-info/function-arg-initialization.rs2
-rw-r--r--src/test/debug-info/function-arguments.rs2
-rw-r--r--src/test/debug-info/function-prologue-stepping-no-split-stack.rs2
-rw-r--r--src/test/debug-info/generic-function.rs2
-rw-r--r--src/test/debug-info/generic-functions-nested.rs2
-rw-r--r--src/test/debug-info/generic-method-on-generic-struct.rs2
-rw-r--r--src/test/debug-info/generic-static-method-on-struct-and-enum.rs2
-rw-r--r--src/test/debug-info/generic-struct-style-enum.rs2
-rw-r--r--src/test/debug-info/generic-struct.rs2
-rw-r--r--src/test/debug-info/generic-trait-generic-static-default-method.rs2
-rw-r--r--src/test/debug-info/generic-tuple-style-enum.rs2
-rw-r--r--src/test/debug-info/include_string.rs2
-rw-r--r--src/test/debug-info/issue11600.rs2
-rw-r--r--src/test/debug-info/lexical-scope-in-for-loop.rs2
-rw-r--r--src/test/debug-info/lexical-scope-in-if.rs2
-rw-r--r--src/test/debug-info/lexical-scope-in-match.rs2
-rw-r--r--src/test/debug-info/lexical-scope-in-parameterless-closure.rs2
-rw-r--r--src/test/debug-info/lexical-scope-in-stack-closure.rs2
-rw-r--r--src/test/debug-info/lexical-scope-in-unconditional-loop.rs2
-rw-r--r--src/test/debug-info/lexical-scope-in-unique-closure.rs2
-rw-r--r--src/test/debug-info/lexical-scope-in-while.rs2
-rw-r--r--src/test/debug-info/lexical-scope-with-macro.rs2
-rw-r--r--src/test/debug-info/lexical-scopes-in-block-expression.rs2
-rw-r--r--src/test/debug-info/managed-enum.rs2
-rw-r--r--src/test/debug-info/managed-pointer-within-unique-vec.rs2
-rw-r--r--src/test/debug-info/managed-pointer-within-unique.rs2
-rw-r--r--src/test/debug-info/method-on-enum.rs2
-rw-r--r--src/test/debug-info/method-on-generic-struct.rs2
-rw-r--r--src/test/debug-info/method-on-struct.rs2
-rw-r--r--src/test/debug-info/method-on-trait.rs2
-rw-r--r--src/test/debug-info/method-on-tuple-struct.rs2
-rw-r--r--src/test/debug-info/multiple-functions-equal-var-names.rs2
-rw-r--r--src/test/debug-info/multiple-functions.rs2
-rw-r--r--src/test/debug-info/name-shadowing-and-scope-nesting.rs2
-rw-r--r--src/test/debug-info/nil-enum.rs2
-rw-r--r--src/test/debug-info/option-like-enum.rs2
-rw-r--r--src/test/debug-info/packed-struct-with-destructor.rs2
-rw-r--r--src/test/debug-info/packed-struct.rs2
-rw-r--r--src/test/debug-info/recursive-enum.rs2
-rw-r--r--src/test/debug-info/recursive-struct.rs2
-rw-r--r--src/test/debug-info/self-in-default-method.rs2
-rw-r--r--src/test/debug-info/self-in-generic-default-method.rs2
-rw-r--r--src/test/debug-info/shadowed-argument.rs2
-rw-r--r--src/test/debug-info/shadowed-variable.rs2
-rw-r--r--src/test/debug-info/simple-lexical-scope.rs2
-rw-r--r--src/test/debug-info/simple-struct.rs2
-rw-r--r--src/test/debug-info/simple-tuple.rs2
-rw-r--r--src/test/debug-info/static-method-on-struct-and-enum.rs2
-rw-r--r--src/test/debug-info/struct-in-enum.rs2
-rw-r--r--src/test/debug-info/struct-in-struct.rs2
-rw-r--r--src/test/debug-info/struct-style-enum.rs2
-rw-r--r--src/test/debug-info/struct-with-destructor.rs2
-rw-r--r--src/test/debug-info/trait-generic-static-default-method.rs2
-rw-r--r--src/test/debug-info/trait-pointers.rs2
-rw-r--r--src/test/debug-info/tuple-in-struct.rs2
-rw-r--r--src/test/debug-info/tuple-in-tuple.rs2
-rw-r--r--src/test/debug-info/tuple-struct.rs2
-rw-r--r--src/test/debug-info/tuple-style-enum.rs2
-rw-r--r--src/test/debug-info/unique-enum.rs2
-rw-r--r--src/test/debug-info/var-captured-in-nested-closure.rs2
-rw-r--r--src/test/debug-info/var-captured-in-sendable-closure.rs2
-rw-r--r--src/test/debug-info/var-captured-in-stack-closure.rs2
-rw-r--r--src/test/debug-info/vec-slices.rs2
-rw-r--r--src/test/debug-info/vec.rs2
-rw-r--r--src/test/run-make/bootstrap-from-c-with-green/Makefile2
-rw-r--r--src/test/run-make/bootstrap-from-c-with-native/Makefile2
-rw-r--r--src/test/run-make/c-link-to-rust-staticlib/Makefile4
-rw-r--r--src/test/run-make/lto-smoke-c/Makefile2
-rw-r--r--src/test/run-make/mixing-deps/Makefile2
-rw-r--r--src/test/run-make/prefer-dylib/Makefile2
-rw-r--r--src/test/run-make/prune-link-args/Makefile2
-rw-r--r--src/test/run-pass/issue-7712.rs2
108 files changed, 313 insertions, 276 deletions
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index 8edd923390a..f906c0fc4e1 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -332,8 +332,8 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
             let args = split_maybe_args(&config.rustcflags);
             let mut tool_path:~str = ~"";
             for arg in args.iter() {
-                if arg.contains("--android-cross-path=") {
-                    tool_path = arg.replace("--android-cross-path=","");
+                if arg.contains("android-cross-path=") {
+                    tool_path = arg.replace("android-cross-path=","");
                     break;
                 }
             }
@@ -1054,7 +1054,7 @@ fn compile_test_and_save_bitcode(config: &config, props: &TestProps,
     let aux_dir = aux_output_dir_name(config, testfile);
     // FIXME (#9639): This needs to handle non-utf8 paths
     let link_args = ~[~"-L", aux_dir.as_str().unwrap().to_owned()];
-    let llvm_args = ~[~"--emit=obj", ~"--crate-type=lib", ~"--save-temps"];
+    let llvm_args = ~[~"--emit=obj", ~"--crate-type=lib", ~"-C", ~"save-temps"];
     let args = make_compile_args(config, props,
                                  link_args + llvm_args,
                                  |a, b| ThisFile(make_o_name(a, b)), testfile);
diff --git a/src/doc/rust.md b/src/doc/rust.md
index bae8f562af5..725f15f4aaa 100644
--- a/src/doc/rust.md
+++ b/src/doc/rust.md
@@ -3761,7 +3761,7 @@ dependencies will be used:
    with the above limitations in dynamic and static libraries, it is required
    for all upstream dependencies to be in the same format. The next question is
    whether to prefer a dynamic or a static format. The compiler currently favors
-   static linking over dynamic linking, but this can be inverted with the `-Z
+   static linking over dynamic linking, but this can be inverted with the `-C
    prefer-dynamic` flag to the compiler.
 
    What this means is that first the compiler will attempt to find all upstream
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index 531b8bf9034..d6abc7b6954 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -111,13 +111,13 @@ pub mod write {
     fn target_feature<'a>(sess: &'a Session) -> &'a str {
         match sess.targ_cfg.os {
             abi::OsAndroid => {
-                if "" == sess.opts.target_feature {
+                if "" == sess.opts.cg.target_feature {
                     "+v7"
                 } else {
-                    sess.opts.target_feature.as_slice()
+                    sess.opts.cg.target_feature.as_slice()
                 }
             }
-            _ => sess.opts.target_feature.as_slice()
+            _ => sess.opts.cg.target_feature.as_slice()
         }
     }
 
@@ -130,7 +130,7 @@ pub mod write {
         unsafe {
             configure_llvm(sess);
 
-            if sess.opts.save_temps {
+            if sess.opts.cg.save_temps {
                 output.with_extension("no-opt.bc").with_c_str(|buf| {
                     llvm::LLVMWriteBitcodeToFile(llmod, buf);
                 })
@@ -142,7 +142,7 @@ pub mod write {
               session::Default => lib::llvm::CodeGenLevelDefault,
               session::Aggressive => lib::llvm::CodeGenLevelAggressive,
             };
-            let use_softfp = sess.opts.debugging_opts & session::USE_SOFTFP != 0;
+            let use_softfp = sess.opts.cg.soft_float;
 
             // FIXME: #11906: Omitting frame pointers breaks retrieving the value of a parameter.
             // FIXME: #11954: mac64 unwinding may not work with fp elim
@@ -151,7 +151,7 @@ pub mod write {
                               sess.targ_cfg.arch == abi::X86_64);
 
             let tm = sess.targ_cfg.target_strs.target_triple.with_c_str(|T| {
-                sess.opts.target_cpu.with_c_str(|CPU| {
+                sess.opts.cg.target_cpu.with_c_str(|CPU| {
                     target_feature(&sess).with_c_str(|Features| {
                         llvm::LLVMRustCreateTargetMachine(
                             T, CPU, Features,
@@ -180,13 +180,13 @@ pub mod write {
             };
             if !sess.no_verify() { assert!(addpass("verify")); }
 
-            if !sess.no_prepopulate_passes() {
+            if !sess.opts.cg.no_prepopulate_passes {
                 llvm::LLVMRustAddAnalysisPasses(tm, fpm, llmod);
                 llvm::LLVMRustAddAnalysisPasses(tm, mpm, llmod);
                 populate_llvm_passes(fpm, mpm, llmod, OptLevel);
             }
 
-            for pass in sess.opts.custom_passes.iter() {
+            for pass in sess.opts.cg.passes.iter() {
                 pass.with_c_str(|s| {
                     if !llvm::LLVMRustAddPass(mpm, s) {
                         sess.warn(format!("unknown pass {}, ignoring", *pass));
@@ -208,7 +208,7 @@ pub mod write {
             // emitting an rlib. Whenever an rlib is created, the bytecode is
             // inserted into the archive in order to allow LTO against it.
             let crate_types = sess.crate_types.borrow();
-            if sess.opts.save_temps ||
+            if sess.opts.cg.save_temps ||
                (crate_types.get().contains(&session::CrateTypeRlib) &&
                 sess.opts.output_types.contains(&OutputTypeExe)) {
                 output.temp_path(OutputTypeBitcode).with_c_str(|buf| {
@@ -220,7 +220,7 @@ pub mod write {
                 time(sess.time_passes(), "all lto passes", (), |()|
                      lto::run(sess, llmod, tm, trans.reachable));
 
-                if sess.opts.save_temps {
+                if sess.opts.cg.save_temps {
                     output.with_extension("lto.bc").with_c_str(|buf| {
                         llvm::LLVMWriteBitcodeToFile(llmod, buf);
                     })
@@ -353,10 +353,10 @@ pub mod write {
 
         // Copy what clang does by turning on loop vectorization at O2 and
         // slp vectorization at O3
-        let vectorize_loop = !sess.no_vectorize_loops() &&
+        let vectorize_loop = !sess.opts.cg.no_vectorize_loops &&
                              (sess.opts.optimize == session::Default ||
                               sess.opts.optimize == session::Aggressive);
-        let vectorize_slp = !sess.no_vectorize_slp() &&
+        let vectorize_slp = !sess.opts.cg.no_vectorize_slp &&
                             sess.opts.optimize == session::Aggressive;
 
         let mut llvm_c_strs = ~[];
@@ -374,7 +374,7 @@ pub mod write {
         if sess.time_llvm_passes() { add("-time-passes"); }
         if sess.print_llvm_passes() { add("-debug-pass=Structure"); }
 
-        for arg in sess.opts.llvm_args.iter() {
+        for arg in sess.opts.cg.llvm_args.iter() {
             add(*arg);
         }
 
@@ -745,7 +745,7 @@ pub fn output_lib_filename(lm: &LinkMeta) -> ~str {
 }
 
 pub fn get_cc_prog(sess: Session) -> ~str {
-    match sess.opts.linker {
+    match sess.opts.cg.linker {
         Some(ref linker) => return linker.to_owned(),
         None => {}
     }
@@ -763,7 +763,7 @@ pub fn get_cc_prog(sess: Session) -> ~str {
 }
 
 pub fn get_ar_prog(sess: Session) -> ~str {
-    match sess.opts.ar {
+    match sess.opts.cg.ar {
         Some(ref ar) => return ar.to_owned(),
         None => {}
     }
@@ -773,7 +773,7 @@ pub fn get_ar_prog(sess: Session) -> ~str {
 
 fn get_system_tool(sess: Session, tool: &str) -> ~str {
     match sess.targ_cfg.os {
-        abi::OsAndroid => match sess.opts.android_cross_path {
+        abi::OsAndroid => match sess.opts.cg.android_cross_path {
             Some(ref path) => {
                 let tool_str = match tool {
                     "cc" => "gcc",
@@ -783,7 +783,7 @@ fn get_system_tool(sess: Session, tool: &str) -> ~str {
             }
             None => {
                 sess.fatal(format!("need Android NDK path for the '{}' tool \
-                                    (--android-cross-path)", tool))
+                                    (-C android-cross-path)", tool))
             }
         },
         _ => tool.to_owned(),
@@ -813,7 +813,7 @@ pub fn link_binary(sess: Session,
     }
 
     // Remove the temporary object file and metadata if we aren't saving temps
-    if !sess.opts.save_temps {
+    if !sess.opts.cg.save_temps {
         let obj_filename = outputs.temp_path(OutputTypeObject);
         if !sess.opts.output_types.contains(&OutputTypeObject) {
             remove(sess, &obj_filename);
@@ -969,7 +969,7 @@ fn link_rlib(sess: Session,
             // into the archive.
             let bc = obj_filename.with_extension("bc");
             a.add_file(&bc, false);
-            if !sess.opts.save_temps &&
+            if !sess.opts.cg.save_temps &&
                !sess.opts.output_types.contains(&OutputTypeBitcode) {
                 remove(sess, &bc);
             }
@@ -1142,7 +1142,7 @@ fn link_args(sess: Session,
             args.push(~"-dynamiclib");
             args.push(~"-Wl,-dylib");
             // FIXME (#9639): This needs to handle non-utf8 paths
-            if !sess.opts.no_rpath {
+            if !sess.opts.cg.no_rpath {
                 args.push(~"-Wl,-install_name,@rpath/" +
                           out_filename.filename_str().unwrap());
             }
@@ -1163,13 +1163,13 @@ fn link_args(sess: Session,
     // FIXME (#2397): At some point we want to rpath our guesses as to
     // where extern libraries might live, based on the
     // addl_lib_search_paths
-    if !sess.opts.no_rpath {
+    if !sess.opts.cg.no_rpath {
         args.push_all(rpath::get_rpath_flags(sess, out_filename));
     }
 
     // Finally add all the linker arguments provided on the command line along
     // with any #[link_args] attributes found inside the crate
-    args.push_all(sess.opts.linker_args);
+    args.push_all(sess.opts.cg.link_args);
     let used_link_args = sess.cstore.get_used_link_args();
     let used_link_args = used_link_args.borrow();
     for arg in used_link_args.get().iter() {
@@ -1235,7 +1235,7 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
     }
 
     let cstore = sess.cstore;
-    if !dylib && !sess.prefer_dynamic() {
+    if !dylib && !sess.opts.cg.prefer_dynamic {
         // With an executable, things get a little interesting. As a limitation
         // of the current implementation, we require that everything must be
         // static or everything must be dynamic. The reasons for this are a
diff --git a/src/librustc/back/lto.rs b/src/librustc/back/lto.rs
index 3c7d804435f..b2440dcedbd 100644
--- a/src/librustc/back/lto.rs
+++ b/src/librustc/back/lto.rs
@@ -19,7 +19,7 @@ use std::libc;
 
 pub fn run(sess: session::Session, llmod: ModuleRef,
            tm: TargetMachineRef, reachable: &[~str]) {
-    if sess.prefer_dynamic() {
+    if sess.opts.cg.prefer_dynamic {
         sess.err("cannot prefer dynamic linking when performing LTO");
         sess.note("only 'staticlib' and 'bin' outputs are supported with LTO");
         sess.abort_if_errors();
diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs
index 0d45d5bdbab..15240897b2a 100644
--- a/src/librustc/driver/driver.rs
+++ b/src/librustc/driver/driver.rs
@@ -382,7 +382,7 @@ pub fn phase_4_translate_to_llvm(sess: Session,
 pub fn phase_5_run_llvm_passes(sess: Session,
                                trans: &CrateTranslation,
                                outputs: &OutputFilenames) {
-    if sess.no_integrated_as() {
+    if sess.opts.cg.no_integrated_as {
         let output_type = link::OutputTypeAssembly;
 
         time(sess.time_passes(), "LLVM passes", (), |_|
@@ -391,7 +391,7 @@ pub fn phase_5_run_llvm_passes(sess: Session,
         link::write::run_assembler(sess, outputs);
 
         // Remove assembly source, unless --save-temps was specified
-        if !sess.opts.save_temps {
+        if !sess.opts.cg.save_temps {
             fs::unlink(&outputs.temp_path(link::OutputTypeAssembly)).unwrap();
         }
     } else {
@@ -747,7 +747,6 @@ pub fn build_session_options(binary: ~str,
     let parse_only = matches.opt_present("parse-only");
     let no_trans = matches.opt_present("no-trans");
     let no_analysis = matches.opt_present("no-analysis");
-    let no_rpath = matches.opt_present("no-rpath");
 
     let lint_levels = [lint::allow, lint::warn,
                        lint::deny, lint::forbid];
@@ -817,9 +816,6 @@ pub fn build_session_options(binary: ~str,
 
     let sysroot_opt = matches.opt_str("sysroot").map(|m| @Path::new(m));
     let target = matches.opt_str("target").unwrap_or(host_triple());
-    let target_cpu = matches.opt_str("target-cpu").unwrap_or(~"generic");
-    let target_feature = matches.opt_str("target-feature").unwrap_or(~"");
-    let save_temps = matches.opt_present("save-temps");
     let opt_level = {
         if (debugging_opts & session::NO_OPT) != 0 {
             No
@@ -841,85 +837,77 @@ pub fn build_session_options(binary: ~str,
         } else { No }
     };
     let gc = debugging_opts & session::GC != 0;
-    let extra_debuginfo = debugging_opts & session::EXTRA_DEBUG_INFO != 0;
-    let debuginfo = debugging_opts & session::DEBUG_INFO != 0 ||
-        extra_debuginfo;
+    let debuginfo = matches.opt_present("g") || matches.opt_present("debuginfo");
 
     let addl_lib_search_paths = matches.opt_strs("L").map(|s| {
         Path::new(s.as_slice())
     }).move_iter().collect();
-    let ar = matches.opt_str("ar");
-    let linker = matches.opt_str("linker");
-    let linker_args = matches.opt_strs("link-args").flat_map( |a| {
-        a.split(' ').filter_map(|arg| {
-            if arg.is_empty() {
-                None
-            } else {
-                Some(arg.to_owned())
-            }
-        }).collect()
-    });
 
     let cfg = parse_cfgspecs(matches.opt_strs("cfg"));
     let test = matches.opt_present("test");
-    let android_cross_path = matches.opt_str("android-cross-path");
     let write_dependency_info = (matches.opt_present("dep-info"),
                                  matches.opt_str("dep-info").map(|p| Path::new(p)));
 
-    let custom_passes = match matches.opt_str("passes") {
-        None => ~[],
-        Some(s) => {
-            s.split(|c: char| c == ' ' || c == ',').map(|s| {
-                s.trim().to_owned()
-            }).collect()
-        }
-    };
-    let llvm_args = match matches.opt_str("llvm-args") {
-        None => ~[],
-        Some(s) => {
-            s.split(|c: char| c == ' ' || c == ',').map(|s| {
-                s.trim().to_owned()
-            }).collect()
-        }
-    };
     let print_metas = (matches.opt_present("crate-id"),
                        matches.opt_present("crate-name"),
                        matches.opt_present("crate-file-name"));
+    let cg = build_codegen_options(matches);
 
     let sopts = @session::Options {
         crate_types: crate_types,
         gc: gc,
         optimize: opt_level,
-        custom_passes: custom_passes,
-        llvm_args: llvm_args,
         debuginfo: debuginfo,
-        extra_debuginfo: extra_debuginfo,
         lint_opts: lint_opts,
-        save_temps: save_temps,
         output_types: output_types,
         addl_lib_search_paths: @RefCell::new(addl_lib_search_paths),
-        ar: ar,
-        linker: linker,
-        linker_args: linker_args,
         maybe_sysroot: sysroot_opt,
         target_triple: target,
-        target_cpu: target_cpu,
-        target_feature: target_feature,
         cfg: cfg,
         binary: binary,
         test: test,
         parse_only: parse_only,
         no_trans: no_trans,
         no_analysis: no_analysis,
-        no_rpath: no_rpath,
         debugging_opts: debugging_opts,
-        android_cross_path: android_cross_path,
         write_dependency_info: write_dependency_info,
         print_metas: print_metas,
+        cg: cg,
     };
     return sopts;
 }
 
+pub fn build_codegen_options(matches: &getopts::Matches)
+        -> session::CodegenOptions
+{
+    let mut cg = session::basic_codegen_options();
+    for option in matches.opt_strs("C").move_iter() {
+        let mut iter = option.splitn('=', 1);
+        let key = iter.next().unwrap();
+        let value = iter.next();
+        let option_to_lookup = key.replace("-", "_");
+        let mut found = false;
+        for &(candidate, setter, _) in session::CG_OPTIONS.iter() {
+            if option_to_lookup.as_slice() != candidate { continue }
+            if !setter(&mut cg, value) {
+                match value {
+                    Some(..) => early_error(format!("codegen option `{}` takes \
+                                                     no value", key)),
+                    None => early_error(format!("codegen option `{0}` requires \
+                                                 a value (-C {0}=<value>)",
+                                                key))
+                }
+            }
+            found = true;
+            break;
+        }
+        if !found {
+            early_error(format!("unknown codegen option: `{}`", key));
+        }
+    }
+    return cg;
+}
+
 pub fn build_session(sopts: @session::Options,
                      local_crate_source_file: Option<Path>)
                      -> Session {
@@ -1002,15 +990,12 @@ pub fn optgroups() -> ~[getopts::OptGroup] {
   optmulti("", "emit", "Comma separated list of types of output for the compiler
                         to emit",
            "[asm|bc|ir|obj|link]"),
-  optopt("", "linker", "Program to use for linking instead of the default.", "LINKER"),
-  optopt("", "ar", "Program to use for managing archives instead of the default.", "AR"),
   optflag("", "crate-id", "Output the crate id and exit"),
   optflag("", "crate-name", "Output the crate name and exit"),
   optflag("", "crate-file-name", "Output the file(s) that would be written if compilation \
           continued and exit"),
-  optmulti("",  "link-args", "FLAGS is a space-separated list of flags
-                            passed to the linker", "FLAGS"),
   optflag("",  "ls",  "List the symbols defined by a library crate"),
+  optflag("g",  "debuginfo",  "Emit DWARF debug info to the objects created"),
   optflag("", "no-trans",
                         "Run all passes except translation; no output"),
   optflag("", "no-analysis",
@@ -1020,13 +1005,6 @@ pub fn optgroups() -> ~[getopts::OptGroup] {
   optopt("o", "",     "Write output to <filename>", "FILENAME"),
   optopt("", "opt-level",
                         "Optimize with possible levels 0-3", "LEVEL"),
-  optopt("", "passes", "Comma or space separated list of pass names to use. \
-                        Appends to the default list of passes to run for the \
-                        specified current optimization level. A value of \
-                        \"list\" will list all of the available passes", "NAMES"),
-  optopt("", "llvm-args", "A list of arguments to pass to llvm, comma \
-                           separated", "ARGS"),
-  optflag("", "no-rpath", "Disables setting the rpath in libs/exes"),
   optopt( "",  "out-dir",
                         "Write output to compiler-chosen filename
                           in <dir>", "DIR"),
@@ -1041,9 +1019,6 @@ pub fn optgroups() -> ~[getopts::OptGroup] {
                           AST nodes and blocks with IDs)", "TYPE"),
   optflagopt("", "dep-info",
                         "Output dependency info to <filename> after compiling", "FILENAME"),
-  optflag("", "save-temps",
-                        "Write intermediate files (.bc, .opt.bc, .o)
-                          in addition to normal output"),
   optopt("", "sysroot",
                         "Override the system root", "PATH"),
   optflag("", "test", "Build a test harness"),
@@ -1051,14 +1026,6 @@ pub fn optgroups() -> ~[getopts::OptGroup] {
                         "Target triple cpu-manufacturer-kernel[-os]
                           to compile for (see chapter 3.4 of http://www.sourceware.org/autobook/
                           for details)", "TRIPLE"),
-  optopt("", "target-cpu",
-                        "Select target processor (llc -mcpu=help
-                          for details)", "CPU"),
-  optopt("", "target-feature",
-                        "Target specific attributes (llc -mattr=help
-                          for details)", "FEATURE"),
-  optopt("", "android-cross-path",
-         "The path to the Android NDK", "PATH"),
   optmulti("W", "warn",
                         "Set lint warnings", "OPT"),
   optmulti("A", "allow",
@@ -1067,6 +1034,8 @@ pub fn optgroups() -> ~[getopts::OptGroup] {
                         "Set lint denied", "OPT"),
   optmulti("F", "forbid",
                         "Set lint forbidden", "OPT"),
+  optmulti("C", "codegen",
+                        "Set a codegen option", "OPT[=VALUE]"),
   optmulti("Z", "",   "Set internal debugging options", "FLAG"),
   optflag( "v", "version",
                         "Print version info and exit"),
diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs
index dc8598c10d0..27b8e681666 100644
--- a/src/librustc/driver/session.rs
+++ b/src/librustc/driver/session.rs
@@ -65,17 +65,8 @@ debugging_opts!(
         META_STATS,
         NO_OPT,
         GC,
-        DEBUG_INFO,
-        EXTRA_DEBUG_INFO,
         PRINT_LINK_ARGS,
         PRINT_LLVM_PASSES,
-        NO_VECTORIZE_LOOPS,
-        NO_VECTORIZE_SLP,
-        NO_PREPOPULATE_PASSES,
-        USE_SOFTFP,
-        GEN_CRATE_MAP,
-        PREFER_DYNAMIC,
-        NO_INTEGRATED_AS,
         LTO
     ]
     0
@@ -104,26 +95,9 @@ pub fn debugging_opts_map() -> ~[(&'static str, &'static str, u64)] {
      ("print-link-args", "Print the arguments passed to the linker",
       PRINT_LINK_ARGS),
      ("gc", "Garbage collect shared data (experimental)", GC),
-     ("extra-debug-info", "Extra debugging info (experimental)",
-      EXTRA_DEBUG_INFO),
-     ("debug-info", "Produce debug info (experimental)", DEBUG_INFO),
      ("print-llvm-passes",
       "Prints the llvm optimization passes being run",
       PRINT_LLVM_PASSES),
-     ("no-prepopulate-passes",
-      "Don't pre-populate the pass managers with a list of passes, only use \
-        the passes from --passes",
-      NO_PREPOPULATE_PASSES),
-     ("no-vectorize-loops",
-      "Don't run the loop vectorization optimization passes",
-      NO_VECTORIZE_LOOPS),
-     ("no-vectorize-slp", "Don't run LLVM's SLP vectorization passes",
-      NO_VECTORIZE_SLP),
-     ("soft-float", "Generate software floating point library calls", USE_SOFTFP),
-     ("gen-crate-map", "Force generation of a toplevel crate map", GEN_CRATE_MAP),
-     ("prefer-dynamic", "Prefer dynamic linking to static linking", PREFER_DYNAMIC),
-     ("no-integrated-as",
-      "Use external assembler rather than LLVM's integrated one", NO_INTEGRATED_AS),
      ("lto", "Perform LLVM link-time optimizations", LTO),
     ]
 }
@@ -144,24 +118,15 @@ pub struct Options {
 
     gc: bool,
     optimize: OptLevel,
-    custom_passes: ~[~str],
-    llvm_args: ~[~str],
     debuginfo: bool,
-    extra_debuginfo: bool,
     lint_opts: ~[(lint::Lint, lint::level)],
-    save_temps: bool,
     output_types: ~[back::link::OutputType],
     // This was mutable for rustpkg, which updates search paths based on the
     // parsed code. It remains mutable in case its replacements wants to use
     // this.
     addl_lib_search_paths: @RefCell<HashSet<Path>>,
-    ar: Option<~str>,
-    linker: Option<~str>,
-    linker_args: ~[~str],
     maybe_sysroot: Option<@Path>,
     target_triple: ~str,
-    target_cpu: ~str,
-    target_feature: ~str,
     // User-specified cfg meta items. The compiler itself will add additional
     // items to the crate config, and during parsing the entire crate config
     // will be added to the crate AST node.  This should not be used for
@@ -172,13 +137,12 @@ pub struct Options {
     parse_only: bool,
     no_trans: bool,
     no_analysis: bool,
-    no_rpath: bool,
     debugging_opts: u64,
-    android_cross_path: Option<~str>,
     /// Whether to write dependency files. It's (enabled, optional filename).
     write_dependency_info: (bool, Option<Path>),
     /// Crate id-related things to maybe print. It's (crate_id, crate_name, crate_file_name).
     print_metas: (bool, bool, bool),
+    cg: CodegenOptions,
 }
 
 // The type of entry function, so
@@ -329,24 +293,6 @@ impl Session_ {
     pub fn print_llvm_passes(&self) -> bool {
         self.debugging_opt(PRINT_LLVM_PASSES)
     }
-    pub fn no_prepopulate_passes(&self) -> bool {
-        self.debugging_opt(NO_PREPOPULATE_PASSES)
-    }
-    pub fn no_vectorize_loops(&self) -> bool {
-        self.debugging_opt(NO_VECTORIZE_LOOPS)
-    }
-    pub fn no_vectorize_slp(&self) -> bool {
-        self.debugging_opt(NO_VECTORIZE_SLP)
-    }
-    pub fn gen_crate_map(&self) -> bool {
-        self.debugging_opt(GEN_CRATE_MAP)
-    }
-    pub fn prefer_dynamic(&self) -> bool {
-        self.debugging_opt(PREFER_DYNAMIC)
-    }
-    pub fn no_integrated_as(&self) -> bool {
-        self.debugging_opt(NO_INTEGRATED_AS)
-    }
     pub fn lto(&self) -> bool {
         self.debugging_opt(LTO)
     }
@@ -381,35 +327,132 @@ pub fn basic_options() -> @Options {
         crate_types: ~[],
         gc: false,
         optimize: No,
-        custom_passes: ~[],
-        llvm_args: ~[],
         debuginfo: false,
-        extra_debuginfo: false,
         lint_opts: ~[],
-        save_temps: false,
         output_types: ~[],
         addl_lib_search_paths: @RefCell::new(HashSet::new()),
-        ar: None,
-        linker: None,
-        linker_args: ~[],
         maybe_sysroot: None,
         target_triple: host_triple(),
-        target_cpu: ~"generic",
-        target_feature: ~"",
         cfg: ~[],
         binary: ~"rustc",
         test: false,
         parse_only: false,
         no_trans: false,
         no_analysis: false,
-        no_rpath: false,
         debugging_opts: 0,
-        android_cross_path: None,
         write_dependency_info: (false, None),
         print_metas: (false, false, false),
+        cg: basic_codegen_options(),
     }
 }
 
+/// Declare a macro that will define all CodegenOptions fields and parsers all
+/// at once. The goal of this macro is to define an interface that can be
+/// programmatically used by the option parser in order to initialize the struct
+/// without hardcoding field names all over the place.
+///
+/// The goal is to invoke this macro once with the correct fields, and then this
+/// macro generates all necessary code. The main gotcha of this macro is the
+/// cgsetters module which is a bunch of 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! cgoptions(
+    ($($opt:ident : $t:ty = ($init:expr, $parse:ident, $desc:expr)),* ,) =>
+(
+    #[deriving(Clone)]
+    pub struct CodegenOptions { $($opt: $t),* }
+
+    pub fn basic_codegen_options() -> CodegenOptions {
+        CodegenOptions { $($opt: $init),* }
+    }
+
+    pub type CodegenSetter = fn(&mut CodegenOptions, v: Option<&str>) -> bool;
+    pub static CG_OPTIONS: &'static [(&'static str, CodegenSetter,
+                                      &'static str)] =
+        &[ $( (stringify!($opt), cgsetters::$opt, $desc) ),* ];
+
+    mod cgsetters {
+        use super::CodegenOptions;
+
+        $(
+            pub fn $opt(cg: &mut CodegenOptions, v: Option<&str>) -> bool {
+                $parse(&mut cg.$opt, v)
+            }
+        )*
+
+        fn parse_bool(slot: &mut bool, v: Option<&str>) -> bool {
+            match v {
+                Some(..) => false,
+                None => { *slot = true; true }
+            }
+        }
+
+        fn parse_opt_string(slot: &mut Option<~str>, v: Option<&str>) -> bool {
+            match v {
+                Some(s) => { *slot = Some(s.to_owned()); true },
+                None => false,
+            }
+        }
+
+        fn parse_string(slot: &mut ~str, v: Option<&str>) -> bool {
+            match v {
+                Some(s) => { *slot = s.to_owned(); true },
+                None => false,
+            }
+        }
+
+        fn parse_list(slot: &mut ~[~str], v: Option<&str>) -> bool {
+            match v {
+                Some(s) => {
+                    for s in s.words() {
+                        slot.push(s.to_owned());
+                    }
+                    true
+                },
+                None => false,
+            }
+        }
+
+    }
+) )
+
+cgoptions!(
+    ar: Option<~str> = (None, parse_opt_string,
+        "tool to assemble archives with"),
+    linker: Option<~str> = (None, parse_opt_string,
+        "system linker to link outputs with"),
+    link_args: ~[~str] = (~[], parse_list,
+        "extra arguments to pass to the linker (space separated)"),
+    target_cpu: ~str = (~"generic", parse_string,
+        "select target processor (llc -mcpu=help for details)"),
+    target_feature: ~str = (~"", parse_string,
+        "target specific attributes (llc -mattr=help for details)"),
+    passes: ~[~str] = (~[], parse_list,
+        "a list of extra LLVM passes to run (space separated)"),
+    llvm_args: ~[~str] = (~[], parse_list,
+        "a list of arguments to pass to llvm (space separated)"),
+    save_temps: bool = (false, parse_bool,
+        "save all temporary output files during compilation"),
+    android_cross_path: Option<~str> = (None, parse_opt_string,
+        "the path to the Android NDK"),
+    no_rpath: bool = (false, parse_bool,
+        "disables setting the rpath in libs/exes"),
+    no_prepopulate_passes: bool = (false, parse_bool,
+        "don't pre-populate the pass manager with a list of passes"),
+    no_vectorize_loops: bool = (false, parse_bool,
+        "don't run the loop vectorization optimization passes"),
+    no_vectorize_slp: bool = (false, parse_bool,
+        "don't run LLVM's SLP vectorization pass"),
+    soft_float: bool = (false, parse_bool,
+        "generate software floating point library calls"),
+    gen_crate_map: bool = (false, parse_bool,
+        "force generation of a toplevel crate map"),
+    prefer_dynamic: bool = (false, parse_bool,
+        "prefer dynamic linking to static linking"),
+    no_integrated_as: bool = (false, parse_bool,
+        "use an external assembler rather than LLVM's integrated one"),
+)
+
 // Seems out of place, but it uses session, so I'm putting it here
 pub fn expect<T:Clone>(sess: Session, opt: Option<T>, msg: || -> ~str) -> T {
     diagnostic::expect(sess.diagnostic(), opt, msg)
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index edcefdf6594..1b575e96df6 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -168,7 +168,7 @@ Available lint options:
     fn padded(max: uint, s: &str) -> ~str {
         " ".repeat(max - s.len()) + s
     }
-    println!("{}", "\nAvailable lint checks:\n"); // FIXME: #9970
+    println!("\nAvailable lint checks:\n");
     println!("    {}  {:7.7s}  {}",
              padded(max_key, "name"), "default", "meaning");
     println!("    {}  {:7.7s}  {}\n",
@@ -184,7 +184,7 @@ Available lint options:
 }
 
 pub fn describe_debug_flags() {
-    println!("{}", "\nAvailable debug options:\n"); // FIXME: #9970
+    println!("\nAvailable debug options:\n");
     let r = session::debugging_opts_map();
     for tuple in r.iter() {
         match *tuple {
@@ -195,6 +195,22 @@ pub fn describe_debug_flags() {
     }
 }
 
+pub fn describe_codegen_flags() {
+    println!("\nAvailable codegen options:\n");
+    let mut cg = session::basic_codegen_options();
+    for &(name, parser, desc) in session::CG_OPTIONS.iter() {
+        // we invoke the parser function on `None` to see if this option needs
+        // an argument or not.
+        let (width, extra) = if parser(&mut cg, None) {
+            (25, "")
+        } else {
+            (21, "=val")
+        };
+        println!("    -C {:>width$s}{} -- {}", name.replace("_", "-"),
+                 extra, desc, width=width);
+    }
+}
+
 pub fn run_compiler(args: &[~str]) {
     let mut args = args.to_owned();
     let binary = args.shift().unwrap();
@@ -227,7 +243,13 @@ pub fn run_compiler(args: &[~str]) {
         return;
     }
 
-    if matches.opt_str("passes") == Some(~"list") {
+    let cg_flags = matches.opt_strs("C");
+    if cg_flags.iter().any(|x| x == &~"help") {
+        describe_codegen_flags();
+        return;
+    }
+
+    if cg_flags.contains(&~"passes=list") {
         unsafe { lib::llvm::llvm::LLVMRustPrintPasses(); }
         return;
     }
diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs
index f49b0f1af08..8828fd5e019 100644
--- a/src/librustc/middle/trans/_match.rs
+++ b/src/librustc/middle/trans/_match.rs
@@ -1371,7 +1371,7 @@ fn insert_lllocals<'a>(bcx: &'a Block<'a>,
             llmap.get().insert(binding_info.id, datum);
         }
 
-        if bcx.sess().opts.extra_debuginfo {
+        if bcx.sess().opts.debuginfo {
             debuginfo::create_match_binding_metadata(bcx,
                                                      ident,
                                                      binding_info.id,
@@ -2030,7 +2030,7 @@ pub fn store_arg<'a>(mut bcx: &'a Block<'a>,
             // like `x: T`
             let arg_ty = node_id_type(bcx, pat.id);
             if type_of::arg_is_indirect(bcx.ccx(), arg_ty)
-                && !bcx.ccx().sess.opts.extra_debuginfo {
+                && !bcx.ccx().sess.opts.debuginfo {
                 // Don't copy an indirect argument to an alloca, the caller
                 // already put it in a temporary alloca and gave it up, unless
                 // we emit extra-debug-info, which requires local allocas :(.
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index 39e0ca176eb..227b2f6e1dc 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -568,7 +568,7 @@ pub fn get_res_dtor(ccx: @CrateContext,
 
 // Structural comparison: a rather involved form of glue.
 pub fn maybe_name_value(cx: &CrateContext, v: ValueRef, s: &str) {
-    if cx.sess.opts.save_temps {
+    if cx.sess.opts.cg.save_temps {
         s.with_c_str(|buf| {
             unsafe {
                 llvm::LLVMSetValueName(v, buf)
@@ -1389,7 +1389,7 @@ fn copy_args_to_allocas<'a>(fcx: &FunctionContext<'a>,
 
         bcx = _match::store_arg(bcx, args[i].pat, arg_datum, arg_scope_id);
 
-        if fcx.ccx.sess.opts.extra_debuginfo {
+        if fcx.ccx.sess.opts.debuginfo {
             debuginfo::create_argument_metadata(bcx, &args[i]);
         }
     }
@@ -2510,7 +2510,7 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
     let mut n_subcrates = 1;
     let cstore = sess.cstore;
     while cstore.have_crate_data(n_subcrates) { n_subcrates += 1; }
-    let is_top = !sess.building_library.get() || sess.gen_crate_map();
+    let is_top = !sess.building_library.get() || sess.opts.cg.gen_crate_map;
     let sym_name = if is_top {
         ~"_rust_crate_map_toplevel"
     } else {
diff --git a/src/librustc/middle/trans/closure.rs b/src/librustc/middle/trans/closure.rs
index c9631a72ee7..81c671b4952 100644
--- a/src/librustc/middle/trans/closure.rs
+++ b/src/librustc/middle/trans/closure.rs
@@ -298,7 +298,7 @@ fn load_environment<'a>(bcx: &'a Block<'a>, cdata_ty: ty::t,
 
     // Store the pointer to closure data in an alloca for debug info because that's what the
     // llvm.dbg.declare intrinsic expects
-    let env_pointer_alloca = if bcx.ccx().sess.opts.extra_debuginfo {
+    let env_pointer_alloca = if bcx.ccx().sess.opts.debuginfo {
         let alloc = alloc_ty(bcx, ty::mk_mut_ptr(bcx.tcx(), cdata_ty), "__debuginfo_env_ptr");
         Store(bcx, llcdata, alloc);
         Some(alloc)
diff --git a/src/librustc/middle/trans/context.rs b/src/librustc/middle/trans/context.rs
index 95875a01401..2260ddea3c2 100644
--- a/src/librustc/middle/trans/context.rs
+++ b/src/librustc/middle/trans/context.rs
@@ -151,7 +151,7 @@ impl CrateContext {
             let tn = TypeNames::new();
 
             let mut intrinsics = base::declare_intrinsics(llmod);
-            if sess.opts.extra_debuginfo {
+            if sess.opts.debuginfo {
                 base::declare_dbg_intrinsics(llmod, &mut intrinsics);
             }
             let int_type = Type::int(targ_cfg.arch);
diff --git a/src/librustc/middle/trans/controlflow.rs b/src/librustc/middle/trans/controlflow.rs
index d361c36fbda..c339e8bc648 100644
--- a/src/librustc/middle/trans/controlflow.rs
+++ b/src/librustc/middle/trans/controlflow.rs
@@ -56,7 +56,7 @@ pub fn trans_stmt<'a>(cx: &'a Block<'a>,
             match d.node {
                 ast::DeclLocal(ref local) => {
                     bcx = init_local(bcx, *local);
-                    if cx.sess().opts.extra_debuginfo {
+                    if cx.sess().opts.debuginfo {
                         debuginfo::create_local_var_metadata(bcx, *local);
                     }
                 }
diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs
index d214a192ed8..db8f83b41af 100644
--- a/src/librustc/middle/trans/debuginfo.rs
+++ b/src/librustc/middle/trans/debuginfo.rs
@@ -707,7 +707,7 @@ pub fn create_function_debug_context(cx: &CrateContext,
                               fn_decl: &ast::FnDecl,
                               param_substs: Option<@param_substs>,
                               error_span: Span) -> DIArray {
-        if !cx.sess.opts.extra_debuginfo {
+        if !cx.sess.opts.debuginfo {
             return create_DIArray(DIB(cx), []);
         }
 
@@ -784,8 +784,8 @@ pub fn create_function_debug_context(cx: &CrateContext,
                 name_to_append_suffix_to.push_str(",");
             }
 
-            // Only create type information if extra_debuginfo is enabled
-            if cx.sess.opts.extra_debuginfo {
+            // Only create type information if debuginfo is enabled
+            if cx.sess.opts.debuginfo {
                 let actual_self_type_metadata = type_metadata(cx,
                                                               actual_self_type,
                                                               codemap::DUMMY_SP);
@@ -829,8 +829,8 @@ pub fn create_function_debug_context(cx: &CrateContext,
                 name_to_append_suffix_to.push_str(",");
             }
 
-            // Again, only create type information if extra_debuginfo is enabled
-            if cx.sess.opts.extra_debuginfo {
+            // Again, only create type information if debuginfo is enabled
+            if cx.sess.opts.debuginfo {
                 let actual_type_metadata = type_metadata(cx, actual_type, codemap::DUMMY_SP);
                 let param_metadata_string = token::get_ident(ident.name);
                 let param_metadata = param_metadata_string.get()
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index 58c89d6aa4a..17ef8732413 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -105,8 +105,11 @@ fn runtest(test: &str, cratename: &str, libs: HashSet<Path>) {
         maybe_sysroot: Some(@os::self_exe_path().unwrap().dir_path()),
         addl_lib_search_paths: @RefCell::new(libs),
         crate_types: ~[session::CrateTypeExecutable],
-        debugging_opts: session::PREFER_DYNAMIC,
         output_types: ~[link::OutputTypeExe],
+        cg: session::CodegenOptions {
+            prefer_dynamic: true,
+            .. session::basic_codegen_options()
+        },
         .. (*session::basic_options()).clone()
     };
 
diff --git a/src/test/compile-fail/issue-10755.rs b/src/test/compile-fail/issue-10755.rs
index 91afa62b58c..1d8db84ab13 100644
--- a/src/test/compile-fail/issue-10755.rs
+++ b/src/test/compile-fail/issue-10755.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: --linker=llllll
+// compile-flags: -C linker=llllll
 // error-pattern: the linker `llllll`
 
 fn main() {
diff --git a/src/test/compile-fail/issue-11154.rs b/src/test/compile-fail/issue-11154.rs
index 47f86e52eae..aac5eebaf4a 100644
--- a/src/test/compile-fail/issue-11154.rs
+++ b/src/test/compile-fail/issue-11154.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: -Z lto -Z prefer-dynamic
+// compile-flags: -Z lto -C prefer-dynamic
 
 // error-pattern: cannot prefer dynamic linking
 
diff --git a/src/test/debug-info/basic-types-metadata.rs b/src/test/debug-info/basic-types-metadata.rs
index a67279254de..1c19baa4d8e 100644
--- a/src/test/debug-info/basic-types-metadata.rs
+++ b/src/test/debug-info/basic-types-metadata.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/basic-types.rs b/src/test/debug-info/basic-types.rs
index b57c359046a..4a6bacad98f 100644
--- a/src/test/debug-info/basic-types.rs
+++ b/src/test/debug-info/basic-types.rs
@@ -16,7 +16,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/borrowed-basic.rs b/src/test/debug-info/borrowed-basic.rs
index 7f130f212e2..bf9c70488b0 100644
--- a/src/test/debug-info/borrowed-basic.rs
+++ b/src/test/debug-info/borrowed-basic.rs
@@ -13,7 +13,7 @@
 // Gdb doesn't know about UTF-32 character encoding and will print a rust char as only
 // its numerical value.
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/borrowed-c-style-enum.rs b/src/test/debug-info/borrowed-c-style-enum.rs
index 328e0176a91..29f0ea61ca7 100644
--- a/src/test/debug-info/borrowed-c-style-enum.rs
+++ b/src/test/debug-info/borrowed-c-style-enum.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/borrowed-enum.rs b/src/test/debug-info/borrowed-enum.rs
index e6094fdef9f..c8e29cfddb0 100644
--- a/src/test/debug-info/borrowed-enum.rs
+++ b/src/test/debug-info/borrowed-enum.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/borrowed-managed-basic.rs b/src/test/debug-info/borrowed-managed-basic.rs
index a05face4c5e..94a584efe94 100644
--- a/src/test/debug-info/borrowed-managed-basic.rs
+++ b/src/test/debug-info/borrowed-managed-basic.rs
@@ -15,7 +15,7 @@
 // Gdb doesn't know about UTF-32 character encoding and will print a rust char as only
 // its numerical value.
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/borrowed-struct.rs b/src/test/debug-info/borrowed-struct.rs
index 0bb8b247e59..367d3b9a6da 100644
--- a/src/test/debug-info/borrowed-struct.rs
+++ b/src/test/debug-info/borrowed-struct.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/borrowed-tuple.rs b/src/test/debug-info/borrowed-tuple.rs
index ac77c05b832..2fcb67baecd 100644
--- a/src/test/debug-info/borrowed-tuple.rs
+++ b/src/test/debug-info/borrowed-tuple.rs
@@ -12,7 +12,7 @@
 
 #[feature(managed_boxes)];
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/borrowed-unique-basic.rs b/src/test/debug-info/borrowed-unique-basic.rs
index 04973c20799..9863258930a 100644
--- a/src/test/debug-info/borrowed-unique-basic.rs
+++ b/src/test/debug-info/borrowed-unique-basic.rs
@@ -13,7 +13,7 @@
 // Gdb doesn't know about UTF-32 character encoding and will print a rust char as only
 // its numerical value.
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/box.rs b/src/test/debug-info/box.rs
index 304d150d57e..b293b9d2545 100644
--- a/src/test/debug-info/box.rs
+++ b/src/test/debug-info/box.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/boxed-struct.rs b/src/test/debug-info/boxed-struct.rs
index ff67d35a9cd..21f3c0a99f7 100644
--- a/src/test/debug-info/boxed-struct.rs
+++ b/src/test/debug-info/boxed-struct.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/boxed-vec.rs b/src/test/debug-info/boxed-vec.rs
index 2c0edb783f8..b4ca5dbeabe 100644
--- a/src/test/debug-info/boxed-vec.rs
+++ b/src/test/debug-info/boxed-vec.rs
@@ -12,7 +12,7 @@
 
 #[feature(managed_boxes)];
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/by-value-non-immediate-argument.rs b/src/test/debug-info/by-value-non-immediate-argument.rs
index abb863f6b9e..3b1e730ff9e 100644
--- a/src/test/debug-info/by-value-non-immediate-argument.rs
+++ b/src/test/debug-info/by-value-non-immediate-argument.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/by-value-self-argument-in-trait-impl.rs b/src/test/debug-info/by-value-self-argument-in-trait-impl.rs
index d051ab9db93..ee9ef7f2f0f 100644
--- a/src/test/debug-info/by-value-self-argument-in-trait-impl.rs
+++ b/src/test/debug-info/by-value-self-argument-in-trait-impl.rs
@@ -12,7 +12,7 @@
 
 #[feature(managed_boxes)];
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/c-style-enum-in-composite.rs b/src/test/debug-info/c-style-enum-in-composite.rs
index 90956a26413..92168292f93 100644
--- a/src/test/debug-info/c-style-enum-in-composite.rs
+++ b/src/test/debug-info/c-style-enum-in-composite.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/c-style-enum.rs b/src/test/debug-info/c-style-enum.rs
index f9a1c30103c..fc8f752936f 100644
--- a/src/test/debug-info/c-style-enum.rs
+++ b/src/test/debug-info/c-style-enum.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/closure-in-generic-function.rs b/src/test/debug-info/closure-in-generic-function.rs
index 21c20325e3c..b3d2357a63c 100644
--- a/src/test/debug-info/closure-in-generic-function.rs
+++ b/src/test/debug-info/closure-in-generic-function.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/destructured-fn-argument.rs b/src/test/debug-info/destructured-fn-argument.rs
index ed711e2ca0b..5acc3748964 100644
--- a/src/test/debug-info/destructured-fn-argument.rs
+++ b/src/test/debug-info/destructured-fn-argument.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/destructured-local.rs b/src/test/debug-info/destructured-local.rs
index 0d415a85172..dd1cfb036f5 100644
--- a/src/test/debug-info/destructured-local.rs
+++ b/src/test/debug-info/destructured-local.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/evec-in-struct.rs b/src/test/debug-info/evec-in-struct.rs
index a6f0a42bd30..8ac16bdd2dd 100644
--- a/src/test/debug-info/evec-in-struct.rs
+++ b/src/test/debug-info/evec-in-struct.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/function-arg-initialization.rs b/src/test/debug-info/function-arg-initialization.rs
index aab302c72c5..057d2ac21b5 100644
--- a/src/test/debug-info/function-arg-initialization.rs
+++ b/src/test/debug-info/function-arg-initialization.rs
@@ -17,7 +17,7 @@
 // before the arguments have been properly loaded when setting the breakpoint via the function name.
 // Therefore the setup here sets them using line numbers (so be careful when changing this file).
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print pretty off
 // debugger:break function-arg-initialization.rs:139
 // debugger:break function-arg-initialization.rs:154
diff --git a/src/test/debug-info/function-arguments.rs b/src/test/debug-info/function-arguments.rs
index 6bac417f54e..74c59550e0b 100644
--- a/src/test/debug-info/function-arguments.rs
+++ b/src/test/debug-info/function-arguments.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/function-prologue-stepping-no-split-stack.rs b/src/test/debug-info/function-prologue-stepping-no-split-stack.rs
index da2d4e09fc6..690d6248cea 100644
--- a/src/test/debug-info/function-prologue-stepping-no-split-stack.rs
+++ b/src/test/debug-info/function-prologue-stepping-no-split-stack.rs
@@ -16,7 +16,7 @@
 // consequence, and as opposed to regular Rust functions, we can set the breakpoints via the
 // function name (and don't have to fall back on using line numbers).
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak immediate_args
 // debugger:rbreak binding
diff --git a/src/test/debug-info/generic-function.rs b/src/test/debug-info/generic-function.rs
index d76551a212e..0741620fd20 100644
--- a/src/test/debug-info/generic-function.rs
+++ b/src/test/debug-info/generic-function.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/generic-functions-nested.rs b/src/test/debug-info/generic-functions-nested.rs
index a54238e981a..bb21cb38132 100644
--- a/src/test/debug-info/generic-functions-nested.rs
+++ b/src/test/debug-info/generic-functions-nested.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/generic-method-on-generic-struct.rs b/src/test/debug-info/generic-method-on-generic-struct.rs
index f71106cacb1..97607af4cb3 100644
--- a/src/test/debug-info/generic-method-on-generic-struct.rs
+++ b/src/test/debug-info/generic-method-on-generic-struct.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/generic-static-method-on-struct-and-enum.rs b/src/test/debug-info/generic-static-method-on-struct-and-enum.rs
index a0551e570c7..18f3f3109d5 100644
--- a/src/test/debug-info/generic-static-method-on-struct-and-enum.rs
+++ b/src/test/debug-info/generic-static-method-on-struct-and-enum.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/generic-struct-style-enum.rs b/src/test/debug-info/generic-struct-style-enum.rs
index 5930af11567..b73566dad9e 100644
--- a/src/test/debug-info/generic-struct-style-enum.rs
+++ b/src/test/debug-info/generic-struct-style-enum.rs
@@ -11,7 +11,7 @@
 // xfail-tidy-linelength
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print union on
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/generic-struct.rs b/src/test/debug-info/generic-struct.rs
index 143e2ded193..cc913ad8c94 100644
--- a/src/test/debug-info/generic-struct.rs
+++ b/src/test/debug-info/generic-struct.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/generic-trait-generic-static-default-method.rs b/src/test/debug-info/generic-trait-generic-static-default-method.rs
index 4355b4b98fe..8a3fe3d1c2c 100644
--- a/src/test/debug-info/generic-trait-generic-static-default-method.rs
+++ b/src/test/debug-info/generic-trait-generic-static-default-method.rs
@@ -10,7 +10,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/generic-tuple-style-enum.rs b/src/test/debug-info/generic-tuple-style-enum.rs
index 0a737ffe073..497351ac51f 100644
--- a/src/test/debug-info/generic-tuple-style-enum.rs
+++ b/src/test/debug-info/generic-tuple-style-enum.rs
@@ -11,7 +11,7 @@
 // xfail-tidy-linelength
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print union on
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/include_string.rs b/src/test/debug-info/include_string.rs
index 74064bb5782..4d9fbe083ea 100644
--- a/src/test/debug-info/include_string.rs
+++ b/src/test/debug-info/include_string.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/issue11600.rs b/src/test/debug-info/issue11600.rs
index 00e240d147c..30bbfd72c36 100644
--- a/src/test/debug-info/issue11600.rs
+++ b/src/test/debug-info/issue11600.rs
@@ -19,7 +19,7 @@ fn main() {
 // This test case checks whether compile unit names are set correctly, so that the correct default
 // source file can be found.
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:list
 // check:1[...]fn main() {
 // check:2[...]let args : ~[~str] = ::std::os::args();
diff --git a/src/test/debug-info/lexical-scope-in-for-loop.rs b/src/test/debug-info/lexical-scope-in-for-loop.rs
index 04ccc59250d..a426a8e3f6c 100644
--- a/src/test/debug-info/lexical-scope-in-for-loop.rs
+++ b/src/test/debug-info/lexical-scope-in-for-loop.rs
@@ -11,7 +11,7 @@
 // xfail-win32
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/lexical-scope-in-if.rs b/src/test/debug-info/lexical-scope-in-if.rs
index 4cc58229ad0..7020293a3ef 100644
--- a/src/test/debug-info/lexical-scope-in-if.rs
+++ b/src/test/debug-info/lexical-scope-in-if.rs
@@ -11,7 +11,7 @@
 // xfail-win32
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/lexical-scope-in-match.rs b/src/test/debug-info/lexical-scope-in-match.rs
index 7cb68e9890d..ffdd88cfa59 100644
--- a/src/test/debug-info/lexical-scope-in-match.rs
+++ b/src/test/debug-info/lexical-scope-in-match.rs
@@ -11,7 +11,7 @@
 // xfail-win32
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/lexical-scope-in-parameterless-closure.rs b/src/test/debug-info/lexical-scope-in-parameterless-closure.rs
index fbbb66f2904..d9f16e00f97 100644
--- a/src/test/debug-info/lexical-scope-in-parameterless-closure.rs
+++ b/src/test/debug-info/lexical-scope-in-parameterless-closure.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z debug-info
+// compile-flags:-g
 // debugger:run
 
 // Nothing to do here really, just make sure it compiles. See issue #8513.
diff --git a/src/test/debug-info/lexical-scope-in-stack-closure.rs b/src/test/debug-info/lexical-scope-in-stack-closure.rs
index f052448c146..611b71b5c25 100644
--- a/src/test/debug-info/lexical-scope-in-stack-closure.rs
+++ b/src/test/debug-info/lexical-scope-in-stack-closure.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/lexical-scope-in-unconditional-loop.rs b/src/test/debug-info/lexical-scope-in-unconditional-loop.rs
index fa750d247b1..33138f4cc2b 100644
--- a/src/test/debug-info/lexical-scope-in-unconditional-loop.rs
+++ b/src/test/debug-info/lexical-scope-in-unconditional-loop.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/lexical-scope-in-unique-closure.rs b/src/test/debug-info/lexical-scope-in-unique-closure.rs
index 2c732f9f850..7173529bc51 100644
--- a/src/test/debug-info/lexical-scope-in-unique-closure.rs
+++ b/src/test/debug-info/lexical-scope-in-unique-closure.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/lexical-scope-in-while.rs b/src/test/debug-info/lexical-scope-in-while.rs
index f89f677291a..43e8d61b0bb 100644
--- a/src/test/debug-info/lexical-scope-in-while.rs
+++ b/src/test/debug-info/lexical-scope-in-while.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/lexical-scope-with-macro.rs b/src/test/debug-info/lexical-scope-with-macro.rs
index d97fdf66089..bd52e2ba65d 100644
--- a/src/test/debug-info/lexical-scope-with-macro.rs
+++ b/src/test/debug-info/lexical-scope-with-macro.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/lexical-scopes-in-block-expression.rs b/src/test/debug-info/lexical-scopes-in-block-expression.rs
index 1eb03e95f8f..4a10f09177b 100644
--- a/src/test/debug-info/lexical-scopes-in-block-expression.rs
+++ b/src/test/debug-info/lexical-scopes-in-block-expression.rs
@@ -11,7 +11,7 @@
 // xfail-win32
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/managed-enum.rs b/src/test/debug-info/managed-enum.rs
index ef94fd3e331..b5e2ddb8959 100644
--- a/src/test/debug-info/managed-enum.rs
+++ b/src/test/debug-info/managed-enum.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/managed-pointer-within-unique-vec.rs b/src/test/debug-info/managed-pointer-within-unique-vec.rs
index 8eed28170c5..2345857e392 100644
--- a/src/test/debug-info/managed-pointer-within-unique-vec.rs
+++ b/src/test/debug-info/managed-pointer-within-unique-vec.rs
@@ -12,7 +12,7 @@
 
 #[feature(managed_boxes)];
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/managed-pointer-within-unique.rs b/src/test/debug-info/managed-pointer-within-unique.rs
index 4afc8b235ed..5f35e712d7c 100644
--- a/src/test/debug-info/managed-pointer-within-unique.rs
+++ b/src/test/debug-info/managed-pointer-within-unique.rs
@@ -12,7 +12,7 @@
 
 #[feature(managed_boxes)];
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/method-on-enum.rs b/src/test/debug-info/method-on-enum.rs
index 79594c5d389..e0ff04ed0bc 100644
--- a/src/test/debug-info/method-on-enum.rs
+++ b/src/test/debug-info/method-on-enum.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/method-on-generic-struct.rs b/src/test/debug-info/method-on-generic-struct.rs
index fc78aba707f..a9179ed395f 100644
--- a/src/test/debug-info/method-on-generic-struct.rs
+++ b/src/test/debug-info/method-on-generic-struct.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/method-on-struct.rs b/src/test/debug-info/method-on-struct.rs
index 035ebf9caeb..ca7f472f977 100644
--- a/src/test/debug-info/method-on-struct.rs
+++ b/src/test/debug-info/method-on-struct.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/method-on-trait.rs b/src/test/debug-info/method-on-trait.rs
index 7cd5a845cba..5b7c8b85623 100644
--- a/src/test/debug-info/method-on-trait.rs
+++ b/src/test/debug-info/method-on-trait.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/method-on-tuple-struct.rs b/src/test/debug-info/method-on-tuple-struct.rs
index 029a5cd4c91..ac2991171c6 100644
--- a/src/test/debug-info/method-on-tuple-struct.rs
+++ b/src/test/debug-info/method-on-tuple-struct.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/multiple-functions-equal-var-names.rs b/src/test/debug-info/multiple-functions-equal-var-names.rs
index 29a7de4a316..e6b16adc386 100644
--- a/src/test/debug-info/multiple-functions-equal-var-names.rs
+++ b/src/test/debug-info/multiple-functions-equal-var-names.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/multiple-functions.rs b/src/test/debug-info/multiple-functions.rs
index f5abe6e249d..dc22296baad 100644
--- a/src/test/debug-info/multiple-functions.rs
+++ b/src/test/debug-info/multiple-functions.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/name-shadowing-and-scope-nesting.rs b/src/test/debug-info/name-shadowing-and-scope-nesting.rs
index e8c7812eb09..db154ff599c 100644
--- a/src/test/debug-info/name-shadowing-and-scope-nesting.rs
+++ b/src/test/debug-info/name-shadowing-and-scope-nesting.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/nil-enum.rs b/src/test/debug-info/nil-enum.rs
index fc114a79ad6..3fa596285c6 100644
--- a/src/test/debug-info/nil-enum.rs
+++ b/src/test/debug-info/nil-enum.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/option-like-enum.rs b/src/test/debug-info/option-like-enum.rs
index c263d115509..a634eba2850 100644
--- a/src/test/debug-info/option-like-enum.rs
+++ b/src/test/debug-info/option-like-enum.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/packed-struct-with-destructor.rs b/src/test/debug-info/packed-struct-with-destructor.rs
index 5e6480fa8c5..59b65e1119c 100644
--- a/src/test/debug-info/packed-struct-with-destructor.rs
+++ b/src/test/debug-info/packed-struct-with-destructor.rs
@@ -11,7 +11,7 @@
 // xfail-tidy-linelength
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/packed-struct.rs b/src/test/debug-info/packed-struct.rs
index 795b9d275dd..0d3883f1102 100644
--- a/src/test/debug-info/packed-struct.rs
+++ b/src/test/debug-info/packed-struct.rs
@@ -11,7 +11,7 @@
 // xfail-tidy-linelength
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/recursive-enum.rs b/src/test/debug-info/recursive-enum.rs
index 4bdc9994c43..0e3205838de 100644
--- a/src/test/debug-info/recursive-enum.rs
+++ b/src/test/debug-info/recursive-enum.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:run
 
 // Test whether compiling a recursive enum definition crashes debug info generation. The test case
diff --git a/src/test/debug-info/recursive-struct.rs b/src/test/debug-info/recursive-struct.rs
index cf693d7e356..4119549010c 100644
--- a/src/test/debug-info/recursive-struct.rs
+++ b/src/test/debug-info/recursive-struct.rs
@@ -12,7 +12,7 @@
 
 #[feature(managed_boxes)];
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/self-in-default-method.rs b/src/test/debug-info/self-in-default-method.rs
index 9f0b0ea8414..e2e9766a4b5 100644
--- a/src/test/debug-info/self-in-default-method.rs
+++ b/src/test/debug-info/self-in-default-method.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/self-in-generic-default-method.rs b/src/test/debug-info/self-in-generic-default-method.rs
index 5ae88b3d0ce..bc2570f1a37 100644
--- a/src/test/debug-info/self-in-generic-default-method.rs
+++ b/src/test/debug-info/self-in-generic-default-method.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/shadowed-argument.rs b/src/test/debug-info/shadowed-argument.rs
index 7bd77d22a2f..85e917c091c 100644
--- a/src/test/debug-info/shadowed-argument.rs
+++ b/src/test/debug-info/shadowed-argument.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/shadowed-variable.rs b/src/test/debug-info/shadowed-variable.rs
index 9055487aaa7..b21e59283ad 100644
--- a/src/test/debug-info/shadowed-variable.rs
+++ b/src/test/debug-info/shadowed-variable.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/simple-lexical-scope.rs b/src/test/debug-info/simple-lexical-scope.rs
index 6d79d4d813f..9b4fa3c5c2a 100644
--- a/src/test/debug-info/simple-lexical-scope.rs
+++ b/src/test/debug-info/simple-lexical-scope.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/simple-struct.rs b/src/test/debug-info/simple-struct.rs
index 8d50149a284..3bc6ce70a71 100644
--- a/src/test/debug-info/simple-struct.rs
+++ b/src/test/debug-info/simple-struct.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/simple-tuple.rs b/src/test/debug-info/simple-tuple.rs
index 71685c80682..e99a4234df0 100644
--- a/src/test/debug-info/simple-tuple.rs
+++ b/src/test/debug-info/simple-tuple.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/static-method-on-struct-and-enum.rs b/src/test/debug-info/static-method-on-struct-and-enum.rs
index b56f6267a8d..fd94faeb7c2 100644
--- a/src/test/debug-info/static-method-on-struct-and-enum.rs
+++ b/src/test/debug-info/static-method-on-struct-and-enum.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/struct-in-enum.rs b/src/test/debug-info/struct-in-enum.rs
index b706ad1c38c..01a8233a96e 100644
--- a/src/test/debug-info/struct-in-enum.rs
+++ b/src/test/debug-info/struct-in-enum.rs
@@ -11,7 +11,7 @@
 // xfail-tidy-linelength
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print union on
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/struct-in-struct.rs b/src/test/debug-info/struct-in-struct.rs
index d46d0b1cd88..7040448cb35 100644
--- a/src/test/debug-info/struct-in-struct.rs
+++ b/src/test/debug-info/struct-in-struct.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/struct-style-enum.rs b/src/test/debug-info/struct-style-enum.rs
index d7804da7894..a5c1d0e81c6 100644
--- a/src/test/debug-info/struct-style-enum.rs
+++ b/src/test/debug-info/struct-style-enum.rs
@@ -11,7 +11,7 @@
 // xfail-tidy-linelength
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print union on
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/struct-with-destructor.rs b/src/test/debug-info/struct-with-destructor.rs
index febd6061468..bae094cefd7 100644
--- a/src/test/debug-info/struct-with-destructor.rs
+++ b/src/test/debug-info/struct-with-destructor.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/trait-generic-static-default-method.rs b/src/test/debug-info/trait-generic-static-default-method.rs
index 05258d53586..429f2e77deb 100644
--- a/src/test/debug-info/trait-generic-static-default-method.rs
+++ b/src/test/debug-info/trait-generic-static-default-method.rs
@@ -10,7 +10,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 
diff --git a/src/test/debug-info/trait-pointers.rs b/src/test/debug-info/trait-pointers.rs
index de46e1aea58..ef34c50bbf7 100644
--- a/src/test/debug-info/trait-pointers.rs
+++ b/src/test/debug-info/trait-pointers.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:run
 
 #[allow(unused_variable)];
diff --git a/src/test/debug-info/tuple-in-struct.rs b/src/test/debug-info/tuple-in-struct.rs
index b60f21fe6ce..81b0348bed0 100644
--- a/src/test/debug-info/tuple-in-struct.rs
+++ b/src/test/debug-info/tuple-in-struct.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/tuple-in-tuple.rs b/src/test/debug-info/tuple-in-tuple.rs
index 76475109382..19c331079b9 100644
--- a/src/test/debug-info/tuple-in-tuple.rs
+++ b/src/test/debug-info/tuple-in-tuple.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/tuple-struct.rs b/src/test/debug-info/tuple-struct.rs
index 2d571ef4160..1993fe91b73 100644
--- a/src/test/debug-info/tuple-struct.rs
+++ b/src/test/debug-info/tuple-struct.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/tuple-style-enum.rs b/src/test/debug-info/tuple-style-enum.rs
index c9d577a2491..fb90fe5c138 100644
--- a/src/test/debug-info/tuple-style-enum.rs
+++ b/src/test/debug-info/tuple-style-enum.rs
@@ -11,7 +11,7 @@
 // xfail-tidy-linelength
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print union on
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/unique-enum.rs b/src/test/debug-info/unique-enum.rs
index 647a6e55f98..f0383b97dd0 100644
--- a/src/test/debug-info/unique-enum.rs
+++ b/src/test/debug-info/unique-enum.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/var-captured-in-nested-closure.rs b/src/test/debug-info/var-captured-in-nested-closure.rs
index 1032356689f..dc586afaa24 100644
--- a/src/test/debug-info/var-captured-in-nested-closure.rs
+++ b/src/test/debug-info/var-captured-in-nested-closure.rs
@@ -11,7 +11,7 @@
 // xfail-win32: FIXME #10474
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/var-captured-in-sendable-closure.rs b/src/test/debug-info/var-captured-in-sendable-closure.rs
index 82ef467925a..e9b8dc46625 100644
--- a/src/test/debug-info/var-captured-in-sendable-closure.rs
+++ b/src/test/debug-info/var-captured-in-sendable-closure.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/var-captured-in-stack-closure.rs b/src/test/debug-info/var-captured-in-stack-closure.rs
index 53287a8511b..092f7ee443e 100644
--- a/src/test/debug-info/var-captured-in-stack-closure.rs
+++ b/src/test/debug-info/var-captured-in-stack-closure.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:rbreak zzz
 // debugger:run
 // debugger:finish
diff --git a/src/test/debug-info/vec-slices.rs b/src/test/debug-info/vec-slices.rs
index 635608604b1..00e0e0fa783 100644
--- a/src/test/debug-info/vec-slices.rs
+++ b/src/test/debug-info/vec-slices.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/debug-info/vec.rs b/src/test/debug-info/vec.rs
index b1224d14dc4..6806e2f2b3d 100644
--- a/src/test/debug-info/vec.rs
+++ b/src/test/debug-info/vec.rs
@@ -10,7 +10,7 @@
 
 // xfail-android: FIXME(#10381)
 
-// compile-flags:-Z extra-debug-info
+// compile-flags:-g
 // debugger:set print pretty off
 // debugger:rbreak zzz
 // debugger:run
diff --git a/src/test/run-make/bootstrap-from-c-with-green/Makefile b/src/test/run-make/bootstrap-from-c-with-green/Makefile
index 7f466573da7..9a198977aa3 100644
--- a/src/test/run-make/bootstrap-from-c-with-green/Makefile
+++ b/src/test/run-make/bootstrap-from-c-with-green/Makefile
@@ -1,7 +1,7 @@
 -include ../tools.mk
 
 all:
-	$(RUSTC) lib.rs -Z gen-crate-map
+	$(RUSTC) lib.rs -C gen-crate-map
 	ln -nsf $(call DYLIB,boot-*) $(call DYLIB,boot)
 	$(CC) main.c -o $(call RUN,main) -lboot -Wl,-rpath,$(TMPDIR)
 	$(call RUN,main)
diff --git a/src/test/run-make/bootstrap-from-c-with-native/Makefile b/src/test/run-make/bootstrap-from-c-with-native/Makefile
index 7f466573da7..9a198977aa3 100644
--- a/src/test/run-make/bootstrap-from-c-with-native/Makefile
+++ b/src/test/run-make/bootstrap-from-c-with-native/Makefile
@@ -1,7 +1,7 @@
 -include ../tools.mk
 
 all:
-	$(RUSTC) lib.rs -Z gen-crate-map
+	$(RUSTC) lib.rs -C gen-crate-map
 	ln -nsf $(call DYLIB,boot-*) $(call DYLIB,boot)
 	$(CC) main.c -o $(call RUN,main) -lboot -Wl,-rpath,$(TMPDIR)
 	$(call RUN,main)
diff --git a/src/test/run-make/c-link-to-rust-staticlib/Makefile b/src/test/run-make/c-link-to-rust-staticlib/Makefile
index a81f19d6eb3..6fa5369015b 100644
--- a/src/test/run-make/c-link-to-rust-staticlib/Makefile
+++ b/src/test/run-make/c-link-to-rust-staticlib/Makefile
@@ -5,9 +5,9 @@ ifneq ($(shell uname),Darwin)
 endif
 
 all:
-	$(RUSTC) foo.rs -Z gen-crate-map
+	$(RUSTC) foo.rs -C gen-crate-map
 	ln -s $(call STATICLIB,foo-*) $(call STATICLIB,foo)
-	$(CC) bar.c -lfoo -o $(call RUN,bar) $(EXTRAFLAGS) -lstdc++ 
+	$(CC) bar.c -lfoo -o $(call RUN,bar) $(EXTRAFLAGS) -lstdc++
 	$(call RUN,bar)
 	rm $(call STATICLIB,foo*)
 	$(call RUN,bar)
diff --git a/src/test/run-make/lto-smoke-c/Makefile b/src/test/run-make/lto-smoke-c/Makefile
index a491fda7dc2..af120c9baeb 100644
--- a/src/test/run-make/lto-smoke-c/Makefile
+++ b/src/test/run-make/lto-smoke-c/Makefile
@@ -5,7 +5,7 @@ ifneq ($(shell uname),Darwin)
 endif
 
 all:
-	$(RUSTC) foo.rs -Z gen-crate-map -Z lto
+	$(RUSTC) foo.rs -C gen-crate-map -Z lto
 	ln -s $(call STATICLIB,foo-*) $(call STATICLIB,foo)
 	$(CC) bar.c -lfoo -o $(call RUN,bar) $(EXTRAFLAGS) -lstdc++
 	$(call RUN,bar)
diff --git a/src/test/run-make/mixing-deps/Makefile b/src/test/run-make/mixing-deps/Makefile
index 9ab2abca729..76106ada144 100644
--- a/src/test/run-make/mixing-deps/Makefile
+++ b/src/test/run-make/mixing-deps/Makefile
@@ -2,6 +2,6 @@
 
 all:
 	$(RUSTC) both.rs
-	$(RUSTC) dylib.rs -Z prefer-dynamic
+	$(RUSTC) dylib.rs -C prefer-dynamic
 	$(RUSTC) prog.rs
 	$(call RUN,prog)
diff --git a/src/test/run-make/prefer-dylib/Makefile b/src/test/run-make/prefer-dylib/Makefile
index 6fb7434e68a..38759b2f524 100644
--- a/src/test/run-make/prefer-dylib/Makefile
+++ b/src/test/run-make/prefer-dylib/Makefile
@@ -2,7 +2,7 @@
 
 all:
 	$(RUSTC) bar.rs --crate-type=dylib --crate-type=rlib
-	$(RUSTC) foo.rs -Z prefer-dynamic
+	$(RUSTC) foo.rs -C prefer-dynamic
 	$(call RUN,foo)
 	rm $(TMPDIR)/*bar*
 	$(call FAILS,foo)
diff --git a/src/test/run-make/prune-link-args/Makefile b/src/test/run-make/prune-link-args/Makefile
index 53699e0dd98..ea7fa06f5ef 100644
--- a/src/test/run-make/prune-link-args/Makefile
+++ b/src/test/run-make/prune-link-args/Makefile
@@ -1,6 +1,6 @@
 -include ../tools.mk
 # Notice the space in the end, this emulates the output of pkg-config
-RUSTC_FLAGS = --link-args "-lc "
+RUSTC_FLAGS = -C link-args="-lc "
 
 all:
 	$(RUSTC) $(RUSTC_FLAGS) empty.rs
diff --git a/src/test/run-pass/issue-7712.rs b/src/test/run-pass/issue-7712.rs
index fa7d68cf921..f91112416e3 100644
--- a/src/test/run-pass/issue-7712.rs
+++ b/src/test/run-pass/issue-7712.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Z debug-info
+// compile-flags:-g
 
 pub trait TraitWithDefaultMethod {
     fn method(self) {