]> git.lizzy.rs Git - rust.git/commitdiff
Change name of metadata file to rust.metadata.bin to match cg_llvm
authorbjorn3 <bjorn3@users.noreply.github.com>
Thu, 25 Oct 2018 12:59:02 +0000 (14:59 +0200)
committerbjorn3 <bjorn3@users.noreply.github.com>
Thu, 25 Oct 2018 12:59:02 +0000 (14:59 +0200)
src/lib.rs
src/metadata.rs

index 7d316be513ff3ad003fe55ac719b25b7dcfe80ae..b14ed0e67863d87a33cde9cced03901b5174e8c2 100644 (file)
@@ -33,7 +33,6 @@
 use crate::rustc::ty::query::Providers;
 use crate::rustc_codegen_utils::codegen_backend::CodegenBackend;
 use crate::rustc_codegen_utils::link::out_filename;
-use crate::rustc_data_structures::svh::Svh;
 use crate::syntax::symbol::Symbol;
 
 use cranelift::codegen::settings;
@@ -94,7 +93,7 @@ mod prelude {
     pub use crate::common::*;
     pub use crate::Caches;
 
-    pub fn should_codegen(sess: &Session) -> bool {
+    pub fn should_codegen(_sess: &Session) -> bool {
         true
         //::std::env::var("SHOULD_CODEGEN").is_ok()
         //    || sess.crate_types.get().contains(&CrateType::Executable)
@@ -124,7 +123,6 @@ struct OngoingCodegen {
     product: cranelift_faerie::FaerieProduct,
     metadata: Vec<u8>,
     crate_name: Symbol,
-    crate_hash: Svh,
 }
 
 impl CodegenBackend for CraneliftCodegenBackend {
@@ -255,7 +253,6 @@ fn build_isa(tcx: TyCtxt) -> Box<isa::TargetIsa> {
                 product: faerie_module.finish(),
                 metadata: metadata.raw_data,
                 crate_name: tcx.crate_name(LOCAL_CRATE),
-                crate_hash: tcx.crate_hash(LOCAL_CRATE),
             });
         }
     }
@@ -274,8 +271,6 @@ fn join_codegen_and_link(
         let artifact = ongoing_codegen.product.artifact;
         let metadata = ongoing_codegen.metadata;
 
-        let metadata_name =
-            ".rustc.clif_metadata".to_string() + &ongoing_codegen.crate_hash.to_string();
         /*
         artifact
             .declare_with(
@@ -320,7 +315,7 @@ fn join_codegen_and_link(
                         builder
                             .append(
                                 &ar::Header::new(
-                                    metadata_name.as_bytes().to_vec(),
+                                    metadata::METADATA_FILE.to_vec(),
                                     metadata.len() as u64,
                                 ),
                                 ::std::io::Cursor::new(metadata.clone()),
index e4db7783963602632d8d05b0e7a243b1914bd1e9..1e68e9f1363a9a9c594f1cb50873b7235c7ad7c1 100644 (file)
@@ -3,6 +3,8 @@
 use std::fs::File;
 use std::path::Path;
 
+pub const METADATA_FILE: &'static [u8] = b"rust.metadata.bin" as &[u8];
+
 pub struct CraneliftMetadataLoader;
 
 impl MetadataLoader for CraneliftMetadataLoader {
@@ -17,8 +19,7 @@ fn get_rlib_metadata(
             let mut entry = entry_result.map_err(|e| format!("{:?}", e))?;
             if entry
                 .header()
-                .identifier()
-                .starts_with(b".rustc.clif_metadata")
+                .identifier() == METADATA_FILE
             {
                 let mut buf = Vec::new();
                 ::std::io::copy(&mut entry, &mut buf).map_err(|e| format!("{:?}", e))?;