@@ -39,6 +39,8 @@ extern crate rustc_errors;
3939extern crate rustc_fluent_macro;
4040extern crate rustc_fs_util;
4141extern crate rustc_hir;
42+ #[ cfg( feature="master" ) ]
43+ extern crate rustc_interface;
4244extern crate rustc_macros;
4345extern crate rustc_metadata;
4446extern crate rustc_middle;
@@ -86,7 +88,7 @@ use std::sync::atomic::Ordering;
8688
8789use gccjit:: { Context , OptimizationLevel } ;
8890#[ cfg( feature="master" ) ]
89- use gccjit:: TargetInfo ;
91+ use gccjit:: { TargetInfo , Version } ;
9092#[ cfg( not( feature="master" ) ) ]
9193use gccjit:: CType ;
9294use 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