Second attempt at fixing LTO tests

FIXME: we now have fat LTO objects even when only bitcode is requested.
This commit is contained in:
Antoni Boucher 2024-07-05 11:55:08 -04:00
parent bc8520d98e
commit fe054be06e
5 changed files with 4 additions and 15 deletions

View File

@ -121,8 +121,7 @@ If you compiled cg_gccjit in debug mode (aka you didn't pass `--release` to `./y
### LTO
To use LTO, you need to set the variable `FAT_LTO=1` and `EMBED_LTO_BITCODE=1` in addition to setting `lto = "fat"` in the `Cargo.toml`.
Don't set `FAT_LTO` when compiling the sysroot, though: only set `EMBED_LTO_BITCODE=1`.
To use LTO, you need to set the variable `EMBED_LTO_BITCODE=1` in addition to setting `lto = "fat"` in the `Cargo.toml`.
Failing to set `EMBED_LTO_BITCODE` will give you the following error:

View File

@ -387,12 +387,6 @@ impl ConfigInfo {
rustflags.push("-Csymbol-mangling-version=v0".to_string());
}
// Since we don't support ThinLTO, disable LTO completely when not trying to do LTO.
// TODO(antoyo): remove when we can handle ThinLTO.
// TODO: remove:
/*if !env.contains_key(&"FAT_LTO".to_string()) {
rustflags.push("-Clto=off".to_string());
}*/
// FIXME(antoyo): remove once the atomic shim is gone
if os_name == "Darwin" {
rustflags.extend_from_slice(&[

View File

@ -489,7 +489,6 @@ fn thin_lto(
//let path = module_buffer.0.to_str().expect("path");
//let my_path = PathBuf::from(path);
//let exists = my_path.exists();
//println!("Path: {:?}: {}", path, exists);
/*module.module_llvm.should_combine_object_files = true;
module
.module_llvm
@ -626,11 +625,6 @@ pub unsafe fn optimize_thin_module(
match *module {
SerializedModule::Local(ref module_buffer) => {
let path = module_buffer.0.to_str().expect("path");
//let my_path = PathBuf::from(path);
//let exists = my_path.exists();
//println!("Path2: {:?}: {}", path, exists);
context.add_driver_option(path);
should_combine_object_files = true;
/*module.module_llvm.should_combine_object_files = true;

View File

@ -57,6 +57,8 @@ pub(crate) unsafe fn codegen(
.generic_activity_with_arg("GCC_module_codegen_emit_bitcode", &*module.name);
context.add_command_line_option("-flto=auto");
context.add_command_line_option("-flto-partition=one");
// TODO: remove since we don't want fat objects when it is for Bitcode only.
context.add_command_line_option("-ffat-lto-objects");
context
.compile_to_file(OutputKind::ObjectFile, bc_out.to_str().expect("path to str"));
}
@ -135,7 +137,6 @@ pub(crate) unsafe fn codegen(
obj_out.to_str().expect("path to str"),
);
} else {
//println!("Combining to object file");
context.compile_to_file(
OutputKind::ObjectFile,
obj_out.to_str().expect("path to str"),

View File

@ -94,3 +94,4 @@ tests/ui/consts/const-eval/parse_ints.rs
tests/ui/simd/intrinsic/generic-arithmetic-pass.rs
tests/ui/backtrace/backtrace.rs
tests/ui/lifetimes/tail-expr-lock-poisoning.rs
tests/ui/runtime/rt-explody-panic-payloads.rs