Skip to content

Commit 6502439

Browse files
author
Charisee
committed
Use constants from object crate
Replace hard-coded values with GNU_PROPERTY_{X86|AARCH64}_FEATURE_1_AND from the object crate.
1 parent 993deaa commit 6502439

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

compiler/rustc_codegen_ssa/src/back/metadata.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use object::{
1212

1313
use snap::write::FrameEncoder;
1414

15-
use object::elf::NT_GNU_PROPERTY_TYPE_0;
1615
use rustc_data_structures::memmap::Mmap;
1716
use rustc_data_structures::owned_slice::{try_slice_owned, OwnedSlice};
1817
use rustc_metadata::fs::METADATA_FILENAME;
@@ -124,7 +123,7 @@ fn add_gnu_property_note(
124123
let mut data: Vec<u8> = Vec::new();
125124
let n_namsz: u32 = 4; // Size of the n_name field
126125
let n_descsz: u32 = 16; // Size of the n_desc field
127-
let n_type: u32 = NT_GNU_PROPERTY_TYPE_0; // Type of note descriptor
126+
let n_type: u32 = object::elf::NT_GNU_PROPERTY_TYPE_0; // Type of note descriptor
128127
let header_values = [n_namsz, n_descsz, n_type];
129128
header_values.iter().for_each(|v| {
130129
data.extend_from_slice(&match endianness {
@@ -134,8 +133,8 @@ fn add_gnu_property_note(
134133
});
135134
data.extend_from_slice(b"GNU\0"); // Owner of the program property note
136135
let pr_type: u32 = match architecture {
137-
Architecture::X86_64 => 0xc0000002,
138-
Architecture::Aarch64 => 0xc0000000,
136+
Architecture::X86_64 => object::elf::GNU_PROPERTY_X86_FEATURE_1_AND,
137+
Architecture::Aarch64 => object::elf::GNU_PROPERTY_AARCH64_FEATURE_1_AND,
139138
_ => unreachable!(),
140139
};
141140
let pr_datasz: u32 = 4; //size of the pr_data field

0 commit comments

Comments
 (0)