Skip to content

Commit 288b61e

Browse files
committed
Only check if LTO is enabled when using the master branch of libgccjit
1 parent 8ae6416 commit 288b61e

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

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

0 commit comments

Comments
 (0)