rust-lang/rust · error
from uncompressed file
Error message
from uncompressed file
What it means
Raised by rustc_codegen_gcc's fat-LTO path when a serialized module being linked is a SerializedModule::FromUncompressedFile variant. Like the FromRlib arm, the GCC backend has not implemented reading an uncompressed on-disk bitcode file for fat LTO, so it panics via unimplemented! to refuse the unsupported path.
Source
Thrown at compiler/rustc_codegen_gcc/src/back/lto.rs:238
// We add the object files and save in should_combine_object_files that we should combine
// them into a single object file when compiling later.
for (bc_decoded, name) in serialized_modules {
let _timer = prof
.generic_activity_with_arg_recorder("GCC_fat_lto_link_module", |recorder| {
recorder.record_arg(format!("{:?}", name))
});
info!("linking {:?}", name);
match bc_decoded {
SerializedModule::Local(ref module_buffer) => {
module.module_llvm.lto_mode = LtoMode::Fat;
module
.module_llvm
.context
.add_driver_option(module_buffer.0.to_str().expect("path"));
}
SerializedModule::FromRlib(_) => unimplemented!("from rlib"),
SerializedModule::FromUncompressedFile(_) => {
unimplemented!("from uncompressed file")
}
}
}
save_temp_bitcode(cgcx, &module, "lto.input");
// Internalize everything below threshold to help strip out more modules and such.
/*unsafe {
let ptr = symbols_below_threshold.as_ptr();
llvm::LLVMRustRunRestrictionPass(
llmod,
ptr as *const *const libc::c_char,
symbols_below_threshold.len() as libc::size_t,
);*/
save_temp_bitcode(cgcx, &module, "lto.after-restriction");
//}
}
View on GitHub (pinned to 7088e4b63a)
Solutions
- Avoid passing uncompressed .bc files to the GCC backend's LTO step; rebuild from source or compressed modules.
- Disable fat LTO for the GCC backend (-C lto=off).
- Implement or upstream the FromUncompressedFile handling in rustc_codegen_gcc.
Example fix
# before: feeding raw bitcode into a fat-LTO link rustc -C lto=fat --foo.bc main.rs # after rustc -C lto=fat main.rs
Defensive patterns
Strategy: validation
Validate before calling
# Reject builds that feed uncompressed .bc into the GCC backend's LTO step
import sys
if any(a.endswith(".bc") for a in sys.argv):
sys.exit("rustc_codegen_gcc fat-LTO cannot consume uncompressed bitcode files")
Prevention
- Do not pass raw .bc inputs to the GCC backend link/LTO step.
- Build from source so modules reach LTO via the Local path.
When it happens
Trigger: Running fat LTO under the GCC backend where the module set contains an uncompressed bitcode file input (e.g. an explicit .bc file fed to the linker). The match arm at lto.rs:237-238 panics.
Common situations: Build pipeline feeds raw .bc files into the link step; an incremental/incremental-LTO configuration routes modules through the uncompressed-file path; a custom build script passes precompiled bitcode.
Related errors
- from rlib
- not implemented
- not implemented
- archive member at offset {start} with size {} exceeds archiv
- {context}: {err}
AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10).
Data as JSON: /api/errors/422be7cb19c9d709.
Report an issue: GitHub.