Skip to content

Commit 721003d

Browse files
committed
Only check if LTO is enabled when using the master branch of libgccjit
1 parent 5502a85 commit 721003d

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
@@ -204,8 +204,15 @@ impl CodegenBackend for GccCodegenBackend {
204204
**self.target_info.info.lock().expect("lock") = context.get_target_info();
205205
}
206206

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

0 commit comments

Comments
 (0)