Skip to content

Commit 1fc0442

Browse files
author
Charisee
committed
rewriting match on endianness
1 parent 68a5bb4 commit 1fc0442

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

compiler/rustc_codegen_ssa/src/back/metadata.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,17 @@ fn add_gnu_property_note(
117117
let n_descsz: u32 = 16; // Size of the n_desc field
118118
let n_type: u32 = NT_GNU_PROPERTY_TYPE_0; // Type of note descriptor
119119
let header_values = [n_namsz, n_descsz, n_type];
120+
header_values.iter().for_each(|v| {
121+
data.extend_from_slice(&match endianness {
122+
Endianness::Little => v.to_le_bytes(),
123+
Endianness::Big => v.to_be_bytes(),
124+
})
125+
});
126+
/*
120127
match endianness {
121128
Endianness::Little => header_values.map(|v| data.extend_from_slice(&(v.to_le_bytes()))),
122129
Endianness::Big => header_values.map(|v| data.extend_from_slice(&(v.to_be_bytes()))),
123-
};
130+
};*/
124131
data.extend_from_slice(b"GNU\0"); // Owner of the program property note
125132
let pr_type: u32 = match architecture {
126133
Architecture::X86_64 => 0xc0000002,

0 commit comments

Comments
 (0)