Set gcc language name and compilation unit name

This commit is contained in:
Antoni Boucher 2026-01-28 14:07:36 -05:00
parent 94e2af7a16
commit 4a6325de8d
5 changed files with 15 additions and 6 deletions

View file

@ -56,18 +56,18 @@ dependencies = [
[[package]]
name = "gccjit"
version = "3.1.1"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff80f4d6d0749eab3a69122210b3a1fdd52edb6162781aadd7c4842e26983683"
checksum = "ef03c8ae23826a0755b980999a553a262c61f2f585245e647192d95bf09eee79"
dependencies = [
"gccjit_sys",
]
[[package]]
name = "gccjit_sys"
version = "1.1.2"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f81d901767ddba371a619fa9bba657066a4d3c5607ee69bbb557c1c5ba9bf85"
checksum = "0ff511da413e4a5da6f09607748395ba37525e01ba7d322cbec3efc43095dd60"
dependencies = [
"libc",
]

View file

@ -24,7 +24,7 @@ default = ["master"]
[dependencies]
object = { version = "0.37.0", default-features = false, features = ["std", "read"] }
tempfile = "3.20"
gccjit = { version = "3.1.1", features = ["dlopen"] }
gccjit = { version = "3.2.0", features = ["dlopen"] }
#gccjit = { git = "https://github.com/rust-lang/gccjit.rs", branch = "error-dlopen", features = ["dlopen"] }
# Local copy.

View file

@ -1 +1 @@
0081ca6631abdfa02bf42bc85aaf507b8a0e6beb
586d798e864fb33b1b4e842c5493a653841a7c02

View file

@ -19,6 +19,8 @@ use rustc_middle::ty::layout::{
};
use rustc_middle::ty::{self, ExistentialTraitRef, Instance, Ty, TyCtxt};
use rustc_session::Session;
#[cfg(feature = "master")]
use rustc_session::config::DebugInfo;
use rustc_span::source_map::respan;
use rustc_span::{DUMMY_SP, Span};
use rustc_target::spec::{HasTargetSpec, HasX86AbiOpt, Target, TlsModel, X86Abi};
@ -143,6 +145,11 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
supports_f64_type: bool,
supports_f128_type: bool,
) -> Self {
#[cfg(feature = "master")]
if tcx.sess.opts.debuginfo != DebugInfo::None {
context.set_filename(codegen_unit.name().as_str());
}
let create_type = |ctype, rust_type| {
let layout = tcx
.layout_of(ty::TypingEnv::fully_monomorphized().as_query_input(rust_type))

View file

@ -240,6 +240,8 @@ impl CodegenBackend for GccCodegenBackend {
#[cfg(feature = "master")]
{
gccjit::set_lang_name(c"GNU Rust");
let target_cpu = target_cpu(sess);
// Get the second TargetInfo with the correct CPU features by setting the arch.