Skip to content

Commit 7a5ee0f

Browse files
committed
Only check if LTO is enabled when using the master branch of libgccjit
1 parent 0166bfc commit 7a5ee0f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/lib.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,15 @@ impl CodegenBackend for GccCodegenBackend {
202202
**self.target_info.info.lock().expect("lock") = context.get_target_info();
203203
}
204204

205-
// NOTE: try the LTO frontend and check if it errors out. If so, do not embed the bitcode.
205+
// While not required by the API, we gate this code on the master feature to make sure we
206+
// don't abort the process while checking if LTO is supported.
207+
// The following could will emit a fatal error if LTO is not supported and older versions
208+
// of libgccjit (the ones without this commit:
209+
// https://github.com/rust-lang/gcc/commit/a073b06800f064b3917a6113d4cc2a0c19a10fda) will
210+
// abort on fatal errors.
211+
#[cfg(feature = "master")]
206212
{
213+
// NOTE: try the LTO frontend and check if it errors out. If so, do not embed the bitcode.
207214
let temp_dir = TempDir::new().expect("cannot create temporary directory");
208215
let temp_file = temp_dir.keep().join("result.asm");
209216
let context = Context::default();

0 commit comments

Comments
 (0)