Skip to content

Commit f7d12b4

Browse files
committed
Session object: Decouple e_flags from FileFlags
1 parent 946a88a commit f7d12b4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

compiler/rustc_codegen_ssa/src/back/metadata.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
130130
};
131131

132132
let mut file = write::Object::new(binary_format, architecture, endianness);
133-
match architecture {
133+
let e_flags = match architecture {
134134
Architecture::Mips => {
135135
let arch = match sess.target.options.cpu.as_ref() {
136136
"mips1" => elf::EF_MIPS_ARCH_1,
@@ -149,7 +149,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
149149
if sess.target.options.cpu.contains("r6") {
150150
e_flags |= elf::EF_MIPS_NAN2008;
151151
}
152-
file.flags = FileFlags::Elf { e_flags };
152+
e_flags
153153
}
154154
Architecture::Mips64 => {
155155
// 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
160160
} else {
161161
elf::EF_MIPS_ARCH_64R2
162162
};
163-
file.flags = FileFlags::Elf { e_flags };
163+
e_flags
164164
}
165165
Architecture::Riscv64 if sess.target.options.features.contains("+d") => {
166166
// copied from `riscv64-linux-gnu-gcc foo.c -c`, note though
167167
// that the `+d` target feature represents whether the double
168168
// float abi is enabled.
169169
let e_flags = elf::EF_RISCV_RVC | elf::EF_RISCV_FLOAT_ABI_DOUBLE;
170-
file.flags = FileFlags::Elf { e_flags };
170+
e_flags
171171
}
172-
_ => {}
172+
_ => 0,
173173
};
174+
file.flags = FileFlags::Elf { e_flags };
174175
Some(file)
175176
}
176177

0 commit comments

Comments
 (0)