Set the .comment section

This commit is contained in:
Antoni Boucher 2023-10-27 19:31:02 -04:00
parent 551ea4b027
commit 4dbfa4d698
2 changed files with 15 additions and 3 deletions

4
Cargo.lock generated
View File

@ -74,7 +74,7 @@ dependencies = [
[[package]] [[package]]
name = "gccjit" name = "gccjit"
version = "1.0.0" version = "1.0.0"
source = "git+https://github.com/antoyo/gccjit.rs#c52a218f5529321285b4489e5562a00e5428e033" source = "git+https://github.com/antoyo/gccjit.rs#6e290f25b1d1edab5ae9ace486fd2dc8c08d6421"
dependencies = [ dependencies = [
"gccjit_sys", "gccjit_sys",
] ]
@ -82,7 +82,7 @@ dependencies = [
[[package]] [[package]]
name = "gccjit_sys" name = "gccjit_sys"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/antoyo/gccjit.rs#c52a218f5529321285b4489e5562a00e5428e033" source = "git+https://github.com/antoyo/gccjit.rs#6e290f25b1d1edab5ae9ace486fd2dc8c08d6421"
dependencies = [ dependencies = [
"libc", "libc",
] ]

View File

@ -39,6 +39,8 @@
extern crate rustc_fluent_macro; extern crate rustc_fluent_macro;
extern crate rustc_fs_util; extern crate rustc_fs_util;
extern crate rustc_hir; extern crate rustc_hir;
#[cfg(feature="master")]
extern crate rustc_interface;
extern crate rustc_macros; extern crate rustc_macros;
extern crate rustc_metadata; extern crate rustc_metadata;
extern crate rustc_middle; extern crate rustc_middle;
@ -86,7 +88,7 @@
use gccjit::{Context, OptimizationLevel}; use gccjit::{Context, OptimizationLevel};
#[cfg(feature="master")] #[cfg(feature="master")]
use gccjit::TargetInfo; use gccjit::{TargetInfo, Version};
#[cfg(not(feature="master"))] #[cfg(not(feature="master"))]
use gccjit::CType; use gccjit::CType;
use errors::LTONotSupported; use errors::LTONotSupported;
@ -249,6 +251,16 @@ fn new_context<'gcc, 'tcx>(tcx: &TyCtxt<'tcx>) -> Context<'gcc> {
if tcx.sess.target.arch == "x86" || tcx.sess.target.arch == "x86_64" { if tcx.sess.target.arch == "x86" || tcx.sess.target.arch == "x86_64" {
context.add_command_line_option("-masm=intel"); context.add_command_line_option("-masm=intel");
} }
#[cfg(feature="master")]
{
let version = Version::get();
let version = format!("{}.{}.{}", version.major, version.minor, version.patch);
context.set_output_ident(&format!("rustc version {} with libgccjit {}",
rustc_interface::util::rustc_version_str().unwrap_or("unknown version"),
version,
));
}
// TODO(antoyo): check if this should only be added when using -Cforce-unwind-tables=n.
context.add_command_line_option("-fno-asynchronous-unwind-tables"); context.add_command_line_option("-fno-asynchronous-unwind-tables");
context context
} }