about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartin Kröning <mkroening@posteo.net>2022-06-01 23:13:46 +0200
committerMartin Kröning <mkroening@posteo.net>2022-06-01 23:13:46 +0200
commitf7d12b4eec92b403909e4ae743fbb77e59ce3994 (patch)
tree00b13a7692778a80da413ee9cf85f21f95e1dc8e
parent946a88a989acdcc3b0d05a666eaac0db414ec2cd (diff)
downloadrust-f7d12b4eec92b403909e4ae743fbb77e59ce3994.tar.gz
rust-f7d12b4eec92b403909e4ae743fbb77e59ce3994.zip
Session object: Decouple e_flags from FileFlags
-rw-r--r--compiler/rustc_codegen_ssa/src/back/metadata.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/metadata.rs b/compiler/rustc_codegen_ssa/src/back/metadata.rs
index 6aa96f9f403..4c330c5906a 100644
--- a/compiler/rustc_codegen_ssa/src/back/metadata.rs
+++ b/compiler/rustc_codegen_ssa/src/back/metadata.rs
@@ -130,7 +130,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
     };
 
     let mut file = write::Object::new(binary_format, architecture, endianness);
-    match architecture {
+    let e_flags = match architecture {
         Architecture::Mips => {
             let arch = match sess.target.options.cpu.as_ref() {
                 "mips1" => elf::EF_MIPS_ARCH_1,
@@ -149,7 +149,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
             if sess.target.options.cpu.contains("r6") {
                 e_flags |= elf::EF_MIPS_NAN2008;
             }
-            file.flags = FileFlags::Elf { e_flags };
+            e_flags
         }
         Architecture::Mips64 => {
             // copied from `mips64el-linux-gnuabi64-gcc foo.c -c`
@@ -160,17 +160,18 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
                 } else {
                     elf::EF_MIPS_ARCH_64R2
                 };
-            file.flags = FileFlags::Elf { e_flags };
+            e_flags
         }
         Architecture::Riscv64 if sess.target.options.features.contains("+d") => {
             // copied from `riscv64-linux-gnu-gcc foo.c -c`, note though
             // that the `+d` target feature represents whether the double
             // float abi is enabled.
             let e_flags = elf::EF_RISCV_RVC | elf::EF_RISCV_FLOAT_ABI_DOUBLE;
-            file.flags = FileFlags::Elf { e_flags };
+            e_flags
         }
-        _ => {}
+        _ => 0,
     };
+    file.flags = FileFlags::Elf { e_flags };
     Some(file)
 }