about summary refs log tree commit diff
diff options
context:
space:
mode:
authorantoyo <antoyo@users.noreply.github.com>2023-11-08 18:53:15 -0500
committerGitHub <noreply@github.com>2023-11-08 18:53:15 -0500
commitc6bc7ecd65046ee502118664f42637ca318cdfb5 (patch)
tree42fb54a0a0cd44aa44bc025a787111aa2a1ae6eb
parent551ea4b027a917f45ef69de3780202ab32413b64 (diff)
parent4dbfa4d698f75db615347854a58c9838c1477165 (diff)
downloadrust-c6bc7ecd65046ee502118664f42637ca318cdfb5.tar.gz
rust-c6bc7ecd65046ee502118664f42637ca318cdfb5.zip
Merge pull request #377 from rust-lang/feature/comment-section
Feature/comment section
-rw-r--r--Cargo.lock4
-rw-r--r--src/lib.rs14
2 files changed, 15 insertions, 3 deletions
diff --git a/Cargo.lock b/Cargo.lock
index b8e2e5d8080..7c186336927 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -74,7 +74,7 @@ dependencies = [
 [[package]]
 name = "gccjit"
 version = "1.0.0"
-source = "git+https://github.com/antoyo/gccjit.rs#c52a218f5529321285b4489e5562a00e5428e033"
+source = "git+https://github.com/antoyo/gccjit.rs#6e290f25b1d1edab5ae9ace486fd2dc8c08d6421"
 dependencies = [
  "gccjit_sys",
 ]
@@ -82,7 +82,7 @@ dependencies = [
 [[package]]
 name = "gccjit_sys"
 version = "0.0.1"
-source = "git+https://github.com/antoyo/gccjit.rs#c52a218f5529321285b4489e5562a00e5428e033"
+source = "git+https://github.com/antoyo/gccjit.rs#6e290f25b1d1edab5ae9ace486fd2dc8c08d6421"
 dependencies = [
  "libc",
 ]
diff --git a/src/lib.rs b/src/lib.rs
index 26f1763bb80..f672a45af91 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -39,6 +39,8 @@ extern crate rustc_errors;
 extern crate rustc_fluent_macro;
 extern crate rustc_fs_util;
 extern crate rustc_hir;
+#[cfg(feature="master")]
+extern crate rustc_interface;
 extern crate rustc_macros;
 extern crate rustc_metadata;
 extern crate rustc_middle;
@@ -86,7 +88,7 @@ use std::sync::atomic::Ordering;
 
 use gccjit::{Context, OptimizationLevel};
 #[cfg(feature="master")]
-use gccjit::TargetInfo;
+use gccjit::{TargetInfo, Version};
 #[cfg(not(feature="master"))]
 use gccjit::CType;
 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" {
         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
 }