Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to omit LLVM bitcode from rlibs. #66598

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
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"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enabling this only requires the rlib itself to be rebuild, instead of throwing away the whole incr cache, right?

}

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this extra conditional be folded into the need_crate_bitcode_for_rlib function? I think that would still work, although it'd be good to check.

modules_config.emit_bc_compressed = true;
}
allocator_config.emit_bc_compressed = true;
}

Expand Down