Skip to content

Commit

Permalink
Add an option to omit LLVM bitcode from rlibs.
Browse files Browse the repository at this point in the history
Because it's only needed when doing LTO, so including it all the time
wastes time and disk space.
  • Loading branch information
nnethercote committed Nov 21, 2019
1 parent 0f0c640 commit c808fbe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
"compile the program with profiling instrumentation"),
profile_use: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED],
"use the given `.profdata` file for profile-guided optimization"),
no_rlib_bitcode: bool = (false, parse_bool, [TRACKED],
"don't put LLVM bitcode in rlib files"),
}

options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
Expand Down
6 changes: 4 additions & 2 deletions src/librustc_codegen_ssa/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,11 @@ pub fn start_async_codegen<B: ExtraBackendMethods>(

// Emit compressed bitcode files for the crate if we're emitting an rlib.
// Whenever an rlib is created, the bitcode is inserted into the archive in
// order to allow LTO against it.
// order to allow LTO against it (unless --no-rlib-bitcode is specified).
if need_crate_bitcode_for_rlib(sess) {
modules_config.emit_bc_compressed = true;
if !sess.opts.cg.no_rlib_bitcode {
modules_config.emit_bc_compressed = true;
}
allocator_config.emit_bc_compressed = true;
}

Expand Down

0 comments on commit c808fbe

Please sign in to comment.