about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/back
diff options
context:
space:
mode:
authorTrevor Gross <t.gross35@gmail.com>2025-02-23 14:30:26 -0500
committerGitHub <noreply@github.com>2025-02-23 14:30:26 -0500
commit2c6fa32bdc9a23a970836df394900001158d024f (patch)
tree4991511fb213c7676fdbb5d5b3d11c1eff77320c /compiler/rustc_codegen_ssa/src/back
parenta2bb4d748db15454900f5830cfc6ab1c7311ea8b (diff)
parent17f2928caa78b665989fc48f204bcd9b4327a746 (diff)
downloadrust-2c6fa32bdc9a23a970836df394900001158d024f.tar.gz
rust-2c6fa32bdc9a23a970836df394900001158d024f.zip
Rollup merge of #136637 - Pyr0de:binary-format, r=Noratrieb
Add binary_format to rustc target specs

Added binary format field to `TargetOptions`

Fixes #135724

r? `@Noratrieb`
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/metadata.rs10
1 files changed, 1 insertions, 9 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/metadata.rs b/compiler/rustc_codegen_ssa/src/back/metadata.rs
index d70413b8a47..236507ac0cd 100644
--- a/compiler/rustc_codegen_ssa/src/back/metadata.rs
+++ b/compiler/rustc_codegen_ssa/src/back/metadata.rs
@@ -252,15 +252,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
         // Unsupported architecture.
         _ => return None,
     };
-    let binary_format = if sess.target.is_like_osx {
-        BinaryFormat::MachO
-    } else if sess.target.is_like_windows {
-        BinaryFormat::Coff
-    } else if sess.target.is_like_aix {
-        BinaryFormat::Xcoff
-    } else {
-        BinaryFormat::Elf
-    };
+    let binary_format = sess.target.binary_format.to_object();
 
     let mut file = write::Object::new(binary_format, architecture, endianness);
     file.set_sub_architecture(sub_architecture);