Skip to content

Commit 4dbfa4d

Browse files
committed
Set the .comment section
1 parent 551ea4b commit 4dbfa4d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ extern crate rustc_errors;
3939
extern crate rustc_fluent_macro;
4040
extern crate rustc_fs_util;
4141
extern crate rustc_hir;
42+
#[cfg(feature="master")]
43+
extern crate rustc_interface;
4244
extern crate rustc_macros;
4345
extern crate rustc_metadata;
4446
extern crate rustc_middle;
@@ -86,7 +88,7 @@ use std::sync::atomic::Ordering;
8688

8789
use gccjit::{Context, OptimizationLevel};
8890
#[cfg(feature="master")]
89-
use gccjit::TargetInfo;
91+
use gccjit::{TargetInfo, Version};
9092
#[cfg(not(feature="master"))]
9193
use gccjit::CType;
9294
use errors::LTONotSupported;
@@ -249,6 +251,16 @@ fn new_context<'gcc, 'tcx>(tcx: &TyCtxt<'tcx>) -> Context<'gcc> {
249251
if tcx.sess.target.arch == "x86" || tcx.sess.target.arch == "x86_64" {
250252
context.add_command_line_option("-masm=intel");
251253
}
254+
#[cfg(feature="master")]
255+
{
256+
let version = Version::get();
257+
let version = format!("{}.{}.{}", version.major, version.minor, version.patch);
258+
context.set_output_ident(&format!("rustc version {} with libgccjit {}",
259+
rustc_interface::util::rustc_version_str().unwrap_or("unknown version"),
260+
version,
261+
));
262+
}
263+
// TODO(antoyo): check if this should only be added when using -Cforce-unwind-tables=n.
252264
context.add_command_line_option("-fno-asynchronous-unwind-tables");
253265
context
254266
}

0 commit comments

Comments
 (0)