diff options
| author | The Miri Conjob Bot <miri@cron.bot> | 2023-07-22 06:34:13 +0000 |
|---|---|---|
| committer | The Miri Conjob Bot <miri@cron.bot> | 2023-07-22 06:34:13 +0000 |
| commit | bd1e4eeaeaba6bfb67c07af3ccb5241cf80bc431 (patch) | |
| tree | 2be01ed59bba85f4bdfe6c2f9d49856e7cf0b039 /compiler/rustc_codegen_llvm/src/context.rs | |
| parent | 6e3932e10d02c68d2013e3f6c889a95ec588f28f (diff) | |
| parent | 7ac0ef9d1164fdb744f3f3c2f4a6893ed06cbe73 (diff) | |
| download | rust-bd1e4eeaeaba6bfb67c07af3ccb5241cf80bc431.tar.gz rust-bd1e4eeaeaba6bfb67c07af3ccb5241cf80bc431.zip | |
Merge from rustc
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/context.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/context.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index e1e0a442845..5bf641055c5 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -33,6 +33,7 @@ use rustc_target::abi::{ use rustc_target::spec::{HasTargetSpec, RelocModel, Target, TlsModel}; use smallvec::SmallVec; +use libc::c_uint; use std::cell::{Cell, RefCell}; use std::ffi::CStr; use std::str; @@ -349,6 +350,23 @@ pub unsafe fn create_module<'ll>( ); } + // Insert `llvm.ident` metadata. + // + // On the wasm targets it will get hooked up to the "producer" sections + // `processed-by` information. + let rustc_producer = + format!("rustc version {}", option_env!("CFG_VERSION").expect("CFG_VERSION")); + let name_metadata = llvm::LLVMMDStringInContext( + llcx, + rustc_producer.as_ptr().cast(), + rustc_producer.as_bytes().len() as c_uint, + ); + llvm::LLVMAddNamedMetadataOperand( + llmod, + cstr!("llvm.ident").as_ptr(), + llvm::LLVMMDNodeInContext(llcx, &name_metadata, 1), + ); + llmod } |
