Skip to content

Commit a3f3787

Browse files
committed
Warn when using LTO
1 parent aa5c49c commit a3f3787

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/lib.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,11 @@ impl<'clif, 'tcx, B: Backend + 'static> CodegenCx<'clif, 'tcx, B> {
162162
struct CraneliftCodegenBackend;
163163

164164
impl CodegenBackend for CraneliftCodegenBackend {
165-
fn init(&self, _sess: &Session) {}
165+
fn init(&self, sess: &Session) {
166+
if sess.lto() != rustc_session::config::Lto::No {
167+
sess.warn("LTO is not supported. You may get a linker error.");
168+
}
169+
}
166170

167171
fn metadata_loader(&self) -> Box<dyn MetadataLoader + Sync> {
168172
Box::new(crate::metadata::CraneliftMetadataLoader)

0 commit comments

Comments
 (0)