Remove cg_llvm::metadata module
This commit is contained in:
parent
267d55d44a
commit
f5d388302b
3 changed files with 15 additions and 26 deletions
compiler/rustc_codegen_llvm/src
|
@ -18,7 +18,6 @@ use crate::builder::Builder;
|
|||
use crate::common;
|
||||
use crate::context::CodegenCx;
|
||||
use crate::llvm;
|
||||
use crate::metadata;
|
||||
use crate::value::Value;
|
||||
|
||||
use rustc_codegen_ssa::base::maybe_create_entry_wrapper;
|
||||
|
@ -47,6 +46,21 @@ pub fn write_compressed_metadata<'tcx>(
|
|||
use snap::write::FrameEncoder;
|
||||
use std::io::Write;
|
||||
|
||||
// Historical note:
|
||||
//
|
||||
// When using link.exe it was seen that the section name `.note.rustc`
|
||||
// was getting shortened to `.note.ru`, and according to the PE and COFF
|
||||
// specification:
|
||||
//
|
||||
// > Executable images do not use a string table and do not support
|
||||
// > section names longer than 8 characters
|
||||
//
|
||||
// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
|
||||
//
|
||||
// As a result, we choose a slightly shorter name! As to why
|
||||
// `.note.rustc` works on MinGW, that's another good question...
|
||||
let section_name = if tcx.sess.target.is_like_osx { "__DATA,.rustc" } else { ".rustc" };
|
||||
|
||||
let (metadata_llcx, metadata_llmod) = (&*llvm_module.llcx, llvm_module.llmod());
|
||||
let mut compressed = tcx.metadata_encoding_version();
|
||||
FrameEncoder::new(&mut compressed).write_all(&metadata.raw_data).unwrap();
|
||||
|
@ -59,7 +73,6 @@ pub fn write_compressed_metadata<'tcx>(
|
|||
unsafe { llvm::LLVMAddGlobal(metadata_llmod, common::val_ty(llconst), buf.as_ptr()) };
|
||||
unsafe {
|
||||
llvm::LLVMSetInitializer(llglobal, llconst);
|
||||
let section_name = metadata::metadata_section_name(&tcx.sess.target);
|
||||
let name = SmallCStr::new(section_name);
|
||||
llvm::LLVMSetSection(llglobal, name.as_ptr());
|
||||
|
||||
|
|
|
@ -69,7 +69,6 @@ pub mod llvm {
|
|||
}
|
||||
|
||||
mod llvm_util;
|
||||
mod metadata;
|
||||
mod mono_item;
|
||||
mod type_;
|
||||
mod type_of;
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
use rustc_target::spec::Target;
|
||||
|
||||
use rustc_fs_util::path_to_c_string;
|
||||
use std::path::Path;
|
||||
use std::slice;
|
||||
|
||||
pub fn metadata_section_name(target: &Target) -> &'static str {
|
||||
// Historical note:
|
||||
//
|
||||
// When using link.exe it was seen that the section name `.note.rustc`
|
||||
// was getting shortened to `.note.ru`, and according to the PE and COFF
|
||||
// specification:
|
||||
//
|
||||
// > Executable images do not use a string table and do not support
|
||||
// > section names longer than 8 characters
|
||||
//
|
||||
// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
|
||||
//
|
||||
// As a result, we choose a slightly shorter name! As to why
|
||||
// `.note.rustc` works on MinGW, that's another good question...
|
||||
|
||||
if target.is_like_osx { "__DATA,.rustc" } else { ".rustc" }
|
||||
}
|
Loading…
Add table
Reference in a new issue