From fe054be06ed9cea3f8b6efc723de20feb418cb4d Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Fri, 5 Jul 2024 11:55:08 -0400 Subject: [PATCH] Second attempt at fixing LTO tests FIXME: we now have fat LTO objects even when only bitcode is requested. --- Readme.md | 3 +-- build_system/src/config.rs | 6 ------ src/back/lto.rs | 6 ------ src/back/write.rs | 3 ++- tests/failing-ui-tests.txt | 1 + 5 files changed, 4 insertions(+), 15 deletions(-) diff --git a/Readme.md b/Readme.md index bd552b84f92..e92c16ece2f 100644 --- a/Readme.md +++ b/Readme.md @@ -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: diff --git a/build_system/src/config.rs b/build_system/src/config.rs index 30321939f64..965aedd8be8 100644 --- a/build_system/src/config.rs +++ b/build_system/src/config.rs @@ -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(&[ diff --git a/src/back/lto.rs b/src/back/lto.rs index 19573628b1b..6b2dbbbed67 100644 --- a/src/back/lto.rs +++ b/src/back/lto.rs @@ -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; diff --git a/src/back/write.rs b/src/back/write.rs index b9bb62a0351..802968979c7 100644 --- a/src/back/write.rs +++ b/src/back/write.rs @@ -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"), diff --git a/tests/failing-ui-tests.txt b/tests/failing-ui-tests.txt index ce867be7390..5a55bdb156e 100644 --- a/tests/failing-ui-tests.txt +++ b/tests/failing-ui-tests.txt @@ -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