Merge pull request #377 from rust-lang/feature/comment-section · rust-lang/rustc_codegen_gcc@c6bc7ec (original) (raw)

Original file line number Diff line number Diff line change
@@ -39,6 +39,8 @@ extern crate rustc_errors;
39 39 extern crate rustc_fluent_macro;
40 40 extern crate rustc_fs_util;
41 41 extern crate rustc_hir;
42 +#[cfg(feature="master")]
43 +extern crate rustc_interface;
42 44 extern crate rustc_macros;
43 45 extern crate rustc_metadata;
44 46 extern crate rustc_middle;
@@ -86,7 +88,7 @@ use std::sync::atomic::Ordering;
86 88
87 89 use gccjit::{Context, OptimizationLevel};
88 90 #[cfg(feature="master")]
89 -use gccjit::TargetInfo;
91 +use gccjit::{TargetInfo, Version};
90 92 #[cfg(not(feature="master"))]
91 93 use gccjit::CType;
92 94 use errors::LTONotSupported;
@@ -249,6 +251,16 @@ fn new_context<'gcc, 'tcx>(tcx: &TyCtxt<'tcx>) -> Context<'gcc> {
249 251 if tcx.sess.target.arch == "x86" |
250 252 context.add_command_line_option("-masm=intel");
251 253 }
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.
252 264 context.add_command_line_option("-fno-asynchronous-unwind-tables");
253 265 context
254 266 }