Update to latest rustc
This commit is contained in:
parent
cf4c629a2b
commit
a94d4d57de
@ -1,4 +1,4 @@
|
|||||||
use crate::spec::{base, PanicStrategy, Target, TargetMetadata};
|
use crate::spec::{PanicStrategy, Target, TargetMetadata, base};
|
||||||
|
|
||||||
pub(crate) fn target() -> Target {
|
pub(crate) fn target() -> Target {
|
||||||
let mut base = base::mikros::opts();
|
let mut base = base::mikros::opts();
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#![stable(feature = "mikros", since = "1.80.0")]
|
#![stable(feature = "mikros", since = "1.80.0")]
|
||||||
|
|
||||||
|
use elf::ElfBytes;
|
||||||
use elf::abi::{
|
use elf::abi::{
|
||||||
PT_DYNAMIC, PT_GNU_EH_FRAME, PT_GNU_RELRO, PT_GNU_STACK, PT_LOAD, PT_NULL, PT_PHDR,
|
PT_DYNAMIC, PT_GNU_EH_FRAME, PT_GNU_RELRO, PT_GNU_STACK, PT_LOAD, PT_NULL, PT_PHDR,
|
||||||
R_X86_64_RELATIVE, SHT_REL, SHT_RELA,
|
R_X86_64_RELATIVE, SHT_REL, SHT_RELA,
|
||||||
};
|
};
|
||||||
use elf::endian::AnyEndian;
|
use elf::endian::AnyEndian;
|
||||||
use elf::ElfBytes;
|
|
||||||
use x86_64::structures::paging::Page;
|
|
||||||
use x86_64::VirtAddr;
|
use x86_64::VirtAddr;
|
||||||
|
use x86_64::structures::paging::Page;
|
||||||
|
|
||||||
use super::address_space::AddressSpace;
|
use super::address_space::AddressSpace;
|
||||||
use crate::ptr;
|
use crate::ptr;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use core::alloc::Layout;
|
use core::alloc::Layout;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
use core::mem::{align_of, size_of};
|
use core::mem::{align_of, size_of};
|
||||||
use core::ptr::{null_mut, NonNull};
|
use core::ptr::{NonNull, null_mut};
|
||||||
|
|
||||||
use super::{align_down_size, align_up, align_up_size};
|
use super::{align_down_size, align_up, align_up_size};
|
||||||
|
|
||||||
|
@ -32,7 +32,3 @@ pub fn decode_error_kind(_code: i32) -> crate::io::ErrorKind {
|
|||||||
pub fn abort_internal() -> ! {
|
pub fn abort_internal() -> ! {
|
||||||
core::intrinsics::abort();
|
core::intrinsics::abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hashmap_random_keys() -> (u64, u64) {
|
|
||||||
(1, 2)
|
|
||||||
}
|
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
use super::syscalls;
|
use super::syscalls;
|
||||||
use crate::io;
|
use crate::io;
|
||||||
use crate::os::mikros::ipc::rpc;
|
use crate::os::mikros::ipc::rpc;
|
||||||
use crate::sync::atomic::AtomicUsize;
|
|
||||||
use crate::sync::OnceLock;
|
use crate::sync::OnceLock;
|
||||||
|
use crate::sync::atomic::AtomicUsize;
|
||||||
|
|
||||||
pub(crate) static STDIN_FD: OnceLock<Option<(u64, u64)>> = OnceLock::new();
|
pub(crate) static STDIN_FD: OnceLock<Option<(u64, u64)>> = OnceLock::new();
|
||||||
pub(crate) static STDOUT_FD: OnceLock<Option<(u64, u64)>> = OnceLock::new();
|
pub(crate) static STDOUT_FD: OnceLock<Option<(u64, u64)>> = OnceLock::new();
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
pub use zkvm::fill_bytes;
|
pub use zkvm::fill_bytes;
|
||||||
} else if #[cfg(any(
|
} else if #[cfg(any(
|
||||||
all(target_family = "wasm", target_os = "unknown"),
|
all(target_family = "wasm", target_os = "unknown"),
|
||||||
target_os = "xous",
|
target_os = "xous", target_os = "mikros",
|
||||||
))] {
|
))] {
|
||||||
// FIXME: finally remove std support for wasm32-unknown-unknown
|
// FIXME: finally remove std support for wasm32-unknown-unknown
|
||||||
// FIXME: add random data generation to xous
|
// FIXME: add random data generation to xous
|
||||||
@ -85,6 +85,7 @@
|
|||||||
target_os = "android",
|
target_os = "android",
|
||||||
all(target_family = "wasm", target_os = "unknown"),
|
all(target_family = "wasm", target_os = "unknown"),
|
||||||
target_os = "xous",
|
target_os = "xous",
|
||||||
|
target_os = "mikros",
|
||||||
)))]
|
)))]
|
||||||
pub fn hashmap_random_keys() -> (u64, u64) {
|
pub fn hashmap_random_keys() -> (u64, u64) {
|
||||||
let mut buf = [0; 16];
|
let mut buf = [0; 16];
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
extern crate quickcheck;
|
extern crate quickcheck;
|
||||||
|
|
||||||
use cobs::{
|
use cobs::{
|
||||||
decode, decode_vec, decode_vec_with_sentinel, encode, encode_vec, encode_vec_with_sentinel,
|
CobsDecoder, CobsEncoder, decode, decode_vec, decode_vec_with_sentinel, encode, encode_vec,
|
||||||
max_encoding_length, CobsDecoder, CobsEncoder,
|
encode_vec_with_sentinel, max_encoding_length,
|
||||||
};
|
};
|
||||||
use quickcheck::{quickcheck, TestResult};
|
use quickcheck::{TestResult, quickcheck};
|
||||||
|
|
||||||
fn test_pair(source: Vec<u8>, encoded: Vec<u8>) {
|
fn test_pair(source: Vec<u8>, encoded: Vec<u8>) {
|
||||||
let mut test_encoded = encoded.clone();
|
let mut test_encoded = encoded.clone();
|
||||||
|
@ -81,54 +81,38 @@ mod parse_tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_chdr32_lsb() {
|
fn parse_chdr32_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF32, CompressionHeader {
|
||||||
LittleEndian,
|
|
||||||
Class::ELF32,
|
|
||||||
CompressionHeader {
|
|
||||||
ch_type: 0x03020100,
|
ch_type: 0x03020100,
|
||||||
ch_size: 0x07060504,
|
ch_size: 0x07060504,
|
||||||
ch_addralign: 0x0B0A0908,
|
ch_addralign: 0x0B0A0908,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_chdr32_msb() {
|
fn parse_chdr32_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF32, CompressionHeader {
|
||||||
BigEndian,
|
|
||||||
Class::ELF32,
|
|
||||||
CompressionHeader {
|
|
||||||
ch_type: 0x00010203,
|
ch_type: 0x00010203,
|
||||||
ch_size: 0x04050607,
|
ch_size: 0x04050607,
|
||||||
ch_addralign: 0x08090A0B,
|
ch_addralign: 0x08090A0B,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_chdr64_lsb() {
|
fn parse_chdr64_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF64, CompressionHeader {
|
||||||
LittleEndian,
|
|
||||||
Class::ELF64,
|
|
||||||
CompressionHeader {
|
|
||||||
ch_type: 0x03020100,
|
ch_type: 0x03020100,
|
||||||
ch_size: 0x0F0E0D0C0B0A0908,
|
ch_size: 0x0F0E0D0C0B0A0908,
|
||||||
ch_addralign: 0x1716151413121110,
|
ch_addralign: 0x1716151413121110,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_chdr64_msb() {
|
fn parse_chdr64_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF64, CompressionHeader {
|
||||||
BigEndian,
|
|
||||||
Class::ELF64,
|
|
||||||
CompressionHeader {
|
|
||||||
ch_type: 0x00010203,
|
ch_type: 0x00010203,
|
||||||
ch_size: 0x08090A0B0C0D0E0F,
|
ch_size: 0x08090A0B0C0D0E0F,
|
||||||
ch_addralign: 0x1011121314151617,
|
ch_addralign: 0x1011121314151617,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -89,20 +89,18 @@ fn parse_dyn32_msb() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_dyn64_lsb() {
|
fn parse_dyn64_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF64, Dyn {
|
||||||
LittleEndian,
|
d_tag: 0x0706050403020100,
|
||||||
Class::ELF64,
|
d_un: 0x0F0E0D0C0B0A0908,
|
||||||
Dyn { d_tag: 0x0706050403020100, d_un: 0x0F0E0D0C0B0A0908 },
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_dyn64_msb() {
|
fn parse_dyn64_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF64, Dyn {
|
||||||
BigEndian,
|
d_tag: 0x0001020304050607,
|
||||||
Class::ELF64,
|
d_un: 0x08090A0B0C0D0E0F,
|
||||||
Dyn { d_tag: 0x0001020304050607, d_un: 0x08090A0B0C0D0E0F },
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
use crate::compression::CompressionHeader;
|
use crate::compression::CompressionHeader;
|
||||||
use crate::dynamic::{Dyn, DynamicTable};
|
use crate::dynamic::{Dyn, DynamicTable};
|
||||||
use crate::endian::EndianParse;
|
use crate::endian::EndianParse;
|
||||||
use crate::file::{parse_ident, Class, FileHeader};
|
use crate::file::{Class, FileHeader, parse_ident};
|
||||||
use crate::gnu_symver::{
|
use crate::gnu_symver::{
|
||||||
SymbolVersionTable, VerDefIterator, VerNeedIterator, VersionIndex, VersionIndexTable,
|
SymbolVersionTable, VerDefIterator, VerNeedIterator, VersionIndex, VersionIndexTable,
|
||||||
};
|
};
|
||||||
@ -807,9 +807,7 @@ fn segments() {
|
|||||||
|
|
||||||
let segments: Vec<ProgramHeader> =
|
let segments: Vec<ProgramHeader> =
|
||||||
file.segments().expect("File should have a segment table").iter().collect();
|
file.segments().expect("File should have a segment table").iter().collect();
|
||||||
assert_eq!(
|
assert_eq!(segments[0], ProgramHeader {
|
||||||
segments[0],
|
|
||||||
ProgramHeader {
|
|
||||||
p_type: abi::PT_PHDR,
|
p_type: abi::PT_PHDR,
|
||||||
p_offset: 64,
|
p_offset: 64,
|
||||||
p_vaddr: 4194368,
|
p_vaddr: 4194368,
|
||||||
@ -818,8 +816,7 @@ fn segments() {
|
|||||||
p_memsz: 448,
|
p_memsz: 448,
|
||||||
p_flags: 5,
|
p_flags: 5,
|
||||||
p_align: 8,
|
p_align: 8,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -831,9 +828,7 @@ fn segments_phnum_in_shdr0() {
|
|||||||
|
|
||||||
let segments: Vec<ProgramHeader> =
|
let segments: Vec<ProgramHeader> =
|
||||||
file.segments().expect("File should have a segment table").iter().collect();
|
file.segments().expect("File should have a segment table").iter().collect();
|
||||||
assert_eq!(
|
assert_eq!(segments[0], ProgramHeader {
|
||||||
segments[0],
|
|
||||||
ProgramHeader {
|
|
||||||
p_type: abi::PT_PHDR,
|
p_type: abi::PT_PHDR,
|
||||||
p_offset: 92,
|
p_offset: 92,
|
||||||
p_vaddr: 0,
|
p_vaddr: 0,
|
||||||
@ -842,8 +837,7 @@ fn segments_phnum_in_shdr0() {
|
|||||||
p_memsz: 32,
|
p_memsz: 32,
|
||||||
p_flags: 0x20003,
|
p_flags: 0x20003,
|
||||||
p_align: 0x40000,
|
p_align: 0x40000,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1034,14 +1028,18 @@ fn section_data_as_relas() {
|
|||||||
.expect("Failed to get rela shdr");
|
.expect("Failed to get rela shdr");
|
||||||
|
|
||||||
let mut relas = file.section_data_as_relas(&shdr).expect("Failed to read relas section");
|
let mut relas = file.section_data_as_relas(&shdr).expect("Failed to read relas section");
|
||||||
assert_eq!(
|
assert_eq!(relas.next().expect("Failed to get rela entry"), Rela {
|
||||||
relas.next().expect("Failed to get rela entry"),
|
r_offset: 6293704,
|
||||||
Rela { r_offset: 6293704, r_sym: 1, r_type: 7, r_addend: 0 }
|
r_sym: 1,
|
||||||
);
|
r_type: 7,
|
||||||
assert_eq!(
|
r_addend: 0
|
||||||
relas.next().expect("Failed to get rela entry"),
|
});
|
||||||
Rela { r_offset: 6293712, r_sym: 2, r_type: 7, r_addend: 0 }
|
assert_eq!(relas.next().expect("Failed to get rela entry"), Rela {
|
||||||
);
|
r_offset: 6293712,
|
||||||
|
r_sym: 2,
|
||||||
|
r_type: 7,
|
||||||
|
r_addend: 0
|
||||||
|
});
|
||||||
assert!(relas.next().is_none());
|
assert!(relas.next().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1106,14 +1104,14 @@ fn dynamic() {
|
|||||||
.expect("Failed to parse .dynamic")
|
.expect("Failed to parse .dynamic")
|
||||||
.expect("Failed to find .dynamic")
|
.expect("Failed to find .dynamic")
|
||||||
.iter();
|
.iter();
|
||||||
assert_eq!(
|
assert_eq!(dynamic.next().expect("Failed to get dyn entry"), Dyn {
|
||||||
dynamic.next().expect("Failed to get dyn entry"),
|
d_tag: abi::DT_NEEDED,
|
||||||
Dyn { d_tag: abi::DT_NEEDED, d_un: 1 }
|
d_un: 1
|
||||||
);
|
});
|
||||||
assert_eq!(
|
assert_eq!(dynamic.next().expect("Failed to get dyn entry"), Dyn {
|
||||||
dynamic.next().expect("Failed to get dyn entry"),
|
d_tag: abi::DT_INIT,
|
||||||
Dyn { d_tag: abi::DT_INIT, d_un: 4195216 }
|
d_un: 4195216
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1128,17 +1126,14 @@ fn symbol_table() {
|
|||||||
.expect("Failed to read symbol table")
|
.expect("Failed to read symbol table")
|
||||||
.expect("Failed to find symbol table");
|
.expect("Failed to find symbol table");
|
||||||
let symbol = symtab.get(30).expect("Failed to get symbol");
|
let symbol = symtab.get(30).expect("Failed to get symbol");
|
||||||
assert_eq!(
|
assert_eq!(symbol, Symbol {
|
||||||
symbol,
|
|
||||||
Symbol {
|
|
||||||
st_name: 19,
|
st_name: 19,
|
||||||
st_value: 6293200,
|
st_value: 6293200,
|
||||||
st_size: 0,
|
st_size: 0,
|
||||||
st_shndx: 21,
|
st_shndx: 21,
|
||||||
st_info: 1,
|
st_info: 1,
|
||||||
st_other: 0,
|
st_other: 0,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
strtab.get(symbol.st_name as usize).expect("Failed to get name from strtab"),
|
strtab.get(symbol.st_name as usize).expect("Failed to get name from strtab"),
|
||||||
"__JCR_LIST__"
|
"__JCR_LIST__"
|
||||||
@ -1157,10 +1152,14 @@ fn dynamic_symbol_table() {
|
|||||||
.expect("Failed to read symbol table")
|
.expect("Failed to read symbol table")
|
||||||
.expect("Failed to find symbol table");
|
.expect("Failed to find symbol table");
|
||||||
let symbol = symtab.get(1).expect("Failed to get symbol");
|
let symbol = symtab.get(1).expect("Failed to get symbol");
|
||||||
assert_eq!(
|
assert_eq!(symbol, Symbol {
|
||||||
symbol,
|
st_name: 11,
|
||||||
Symbol { st_name: 11, st_value: 0, st_size: 0, st_shndx: 0, st_info: 18, st_other: 0 }
|
st_value: 0,
|
||||||
);
|
st_size: 0,
|
||||||
|
st_shndx: 0,
|
||||||
|
st_info: 18,
|
||||||
|
st_other: 0
|
||||||
|
});
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
strtab.get(symbol.st_name as usize).expect("Failed to get name from strtab"),
|
strtab.get(symbol.st_name as usize).expect("Failed to get name from strtab"),
|
||||||
"memset"
|
"memset"
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
use crate::compression::CompressionHeader;
|
use crate::compression::CompressionHeader;
|
||||||
use crate::dynamic::DynamicTable;
|
use crate::dynamic::DynamicTable;
|
||||||
use crate::endian::EndianParse;
|
use crate::endian::EndianParse;
|
||||||
use crate::file::{parse_ident, Class, FileHeader};
|
use crate::file::{Class, FileHeader, parse_ident};
|
||||||
use crate::gnu_symver::{
|
use crate::gnu_symver::{
|
||||||
SymbolVersionTable, VerDefIterator, VerNeedIterator, VersionIndex, VersionIndexTable,
|
SymbolVersionTable, VerDefIterator, VerNeedIterator, VersionIndex, VersionIndexTable,
|
||||||
};
|
};
|
||||||
@ -780,9 +780,7 @@ fn segments() {
|
|||||||
let file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
let file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||||
|
|
||||||
let segments = file.segments();
|
let segments = file.segments();
|
||||||
assert_eq!(
|
assert_eq!(segments[0], ProgramHeader {
|
||||||
segments[0],
|
|
||||||
ProgramHeader {
|
|
||||||
p_type: abi::PT_PHDR,
|
p_type: abi::PT_PHDR,
|
||||||
p_offset: 64,
|
p_offset: 64,
|
||||||
p_vaddr: 4194368,
|
p_vaddr: 4194368,
|
||||||
@ -791,8 +789,7 @@ fn segments() {
|
|||||||
p_memsz: 448,
|
p_memsz: 448,
|
||||||
p_flags: 5,
|
p_flags: 5,
|
||||||
p_align: 8,
|
p_align: 8,
|
||||||
}
|
})
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -801,9 +798,7 @@ fn segments_phnum_in_shdr0() {
|
|||||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||||
let file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
let file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(file.segments()[0], ProgramHeader {
|
||||||
file.segments()[0],
|
|
||||||
ProgramHeader {
|
|
||||||
p_type: abi::PT_PHDR,
|
p_type: abi::PT_PHDR,
|
||||||
p_offset: 92,
|
p_offset: 92,
|
||||||
p_vaddr: 0,
|
p_vaddr: 0,
|
||||||
@ -812,8 +807,7 @@ fn segments_phnum_in_shdr0() {
|
|||||||
p_memsz: 32,
|
p_memsz: 32,
|
||||||
p_flags: 0x20003,
|
p_flags: 0x20003,
|
||||||
p_align: 0x40000,
|
p_align: 0x40000,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -827,17 +821,14 @@ fn symbol_table() {
|
|||||||
.expect("Failed to read symbol table")
|
.expect("Failed to read symbol table")
|
||||||
.expect("Failed to find symbol table");
|
.expect("Failed to find symbol table");
|
||||||
let symbol = symtab.get(30).expect("Failed to get symbol");
|
let symbol = symtab.get(30).expect("Failed to get symbol");
|
||||||
assert_eq!(
|
assert_eq!(symbol, Symbol {
|
||||||
symbol,
|
|
||||||
Symbol {
|
|
||||||
st_name: 19,
|
st_name: 19,
|
||||||
st_value: 6293200,
|
st_value: 6293200,
|
||||||
st_size: 0,
|
st_size: 0,
|
||||||
st_shndx: 21,
|
st_shndx: 21,
|
||||||
st_info: 1,
|
st_info: 1,
|
||||||
st_other: 0,
|
st_other: 0,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
strtab.get(symbol.st_name as usize).expect("Failed to get name from strtab"),
|
strtab.get(symbol.st_name as usize).expect("Failed to get name from strtab"),
|
||||||
"__JCR_LIST__"
|
"__JCR_LIST__"
|
||||||
@ -855,10 +846,14 @@ fn dynamic_symbol_table() {
|
|||||||
.expect("Failed to read symbol table")
|
.expect("Failed to read symbol table")
|
||||||
.expect("Failed to find symbol table");
|
.expect("Failed to find symbol table");
|
||||||
let symbol = symtab.get(1).expect("Failed to get symbol");
|
let symbol = symtab.get(1).expect("Failed to get symbol");
|
||||||
assert_eq!(
|
assert_eq!(symbol, Symbol {
|
||||||
symbol,
|
st_name: 11,
|
||||||
Symbol { st_name: 11, st_value: 0, st_size: 0, st_shndx: 0, st_info: 18, st_other: 0 }
|
st_value: 0,
|
||||||
);
|
st_size: 0,
|
||||||
|
st_shndx: 0,
|
||||||
|
st_info: 18,
|
||||||
|
st_other: 0
|
||||||
|
});
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
strtab.get(symbol.st_name as usize).expect("Failed to get name from strtab"),
|
strtab.get(symbol.st_name as usize).expect("Failed to get name from strtab"),
|
||||||
"memset"
|
"memset"
|
||||||
@ -876,14 +871,14 @@ fn dynamic() {
|
|||||||
.expect("Failed to parse .dynamic")
|
.expect("Failed to parse .dynamic")
|
||||||
.expect("Failed to find .dynamic")
|
.expect("Failed to find .dynamic")
|
||||||
.iter();
|
.iter();
|
||||||
assert_eq!(
|
assert_eq!(dynamic.next().expect("Failed to get dyn entry"), Dyn {
|
||||||
dynamic.next().expect("Failed to get dyn entry"),
|
d_tag: abi::DT_NEEDED,
|
||||||
Dyn { d_tag: abi::DT_NEEDED, d_un: 1 }
|
d_un: 1
|
||||||
);
|
});
|
||||||
assert_eq!(
|
assert_eq!(dynamic.next().expect("Failed to get dyn entry"), Dyn {
|
||||||
dynamic.next().expect("Failed to get dyn entry"),
|
d_tag: abi::DT_INIT,
|
||||||
Dyn { d_tag: abi::DT_INIT, d_un: 4195216 }
|
d_un: 4195216
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -904,14 +899,18 @@ fn section_data_as_relas() {
|
|||||||
|
|
||||||
let shdr = file.section_headers()[10];
|
let shdr = file.section_headers()[10];
|
||||||
let mut relas = file.section_data_as_relas(&shdr).expect("Failed to read relas section");
|
let mut relas = file.section_data_as_relas(&shdr).expect("Failed to read relas section");
|
||||||
assert_eq!(
|
assert_eq!(relas.next().expect("Failed to get rela entry"), Rela {
|
||||||
relas.next().expect("Failed to get rela entry"),
|
r_offset: 6293704,
|
||||||
Rela { r_offset: 6293704, r_sym: 1, r_type: 7, r_addend: 0 }
|
r_sym: 1,
|
||||||
);
|
r_type: 7,
|
||||||
assert_eq!(
|
r_addend: 0
|
||||||
relas.next().expect("Failed to get rela entry"),
|
});
|
||||||
Rela { r_offset: 6293712, r_sym: 2, r_type: 7, r_addend: 0 }
|
assert_eq!(relas.next().expect("Failed to get rela entry"), Rela {
|
||||||
);
|
r_offset: 6293712,
|
||||||
|
r_sym: 2,
|
||||||
|
r_type: 7,
|
||||||
|
r_addend: 0
|
||||||
|
});
|
||||||
assert!(relas.next().is_none());
|
assert!(relas.next().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,9 +368,7 @@ fn test_parse_ehdr32_works() {
|
|||||||
*elem = n as u8;
|
*elem = n as u8;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(FileHeader::parse_tail(ident, &tail).unwrap(), FileHeader {
|
||||||
FileHeader::parse_tail(ident, &tail).unwrap(),
|
|
||||||
FileHeader {
|
|
||||||
class: Class::ELF32,
|
class: Class::ELF32,
|
||||||
endianness: AnyEndian::Little,
|
endianness: AnyEndian::Little,
|
||||||
version: 0x7060504,
|
version: 0x7060504,
|
||||||
@ -388,8 +386,7 @@ fn test_parse_ehdr32_works() {
|
|||||||
e_shentsize: 0x1F1E,
|
e_shentsize: 0x1F1E,
|
||||||
e_shnum: 0x2120,
|
e_shnum: 0x2120,
|
||||||
e_shstrndx: 0x2322,
|
e_shstrndx: 0x2322,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -415,9 +412,7 @@ fn test_parse_ehdr64_works() {
|
|||||||
*elem = n as u8;
|
*elem = n as u8;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(FileHeader::parse_tail(ident, &tail).unwrap(), FileHeader {
|
||||||
FileHeader::parse_tail(ident, &tail).unwrap(),
|
|
||||||
FileHeader {
|
|
||||||
class: Class::ELF64,
|
class: Class::ELF64,
|
||||||
endianness: AnyEndian::Big,
|
endianness: AnyEndian::Big,
|
||||||
version: 0x04050607,
|
version: 0x04050607,
|
||||||
@ -435,8 +430,7 @@ fn test_parse_ehdr64_works() {
|
|||||||
e_shentsize: 0x2A2B,
|
e_shentsize: 0x2A2B,
|
||||||
e_shnum: 0x2C2D,
|
e_shnum: 0x2C2D,
|
||||||
e_shstrndx: 0x2E2F,
|
e_shstrndx: 0x2E2F,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -694,16 +694,13 @@ fn verneedaux_iter_one_entry() {
|
|||||||
let mut iter =
|
let mut iter =
|
||||||
VerNeedAuxIterator::new(LittleEndian, Class::ELF64, 1, 0x10, &GNU_VERNEED_DATA);
|
VerNeedAuxIterator::new(LittleEndian, Class::ELF64, 1, 0x10, &GNU_VERNEED_DATA);
|
||||||
let aux1 = iter.next().expect("Failed to parse");
|
let aux1 = iter.next().expect("Failed to parse");
|
||||||
assert_eq!(
|
assert_eq!(aux1, VerNeedAux {
|
||||||
aux1,
|
|
||||||
VerNeedAux {
|
|
||||||
vna_hash: 0x0827e5c0,
|
vna_hash: 0x0827e5c0,
|
||||||
vna_flags: 0,
|
vna_flags: 0,
|
||||||
vna_other: 0x0a,
|
vna_other: 0x0a,
|
||||||
vna_name: 0x01,
|
vna_name: 0x01,
|
||||||
vna_next: 0
|
vna_next: 0
|
||||||
}
|
});
|
||||||
);
|
|
||||||
assert!(iter.next().is_none());
|
assert!(iter.next().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,38 +709,29 @@ fn verneedaux_iter_multiple_entries() {
|
|||||||
let mut iter =
|
let mut iter =
|
||||||
VerNeedAuxIterator::new(LittleEndian, Class::ELF64, 3, 0x30, &GNU_VERNEED_DATA);
|
VerNeedAuxIterator::new(LittleEndian, Class::ELF64, 3, 0x30, &GNU_VERNEED_DATA);
|
||||||
let aux1 = iter.next().expect("Failed to parse");
|
let aux1 = iter.next().expect("Failed to parse");
|
||||||
assert_eq!(
|
assert_eq!(aux1, VerNeedAux {
|
||||||
aux1,
|
|
||||||
VerNeedAux {
|
|
||||||
vna_hash: 0x0d696913,
|
vna_hash: 0x0d696913,
|
||||||
vna_flags: 0,
|
vna_flags: 0,
|
||||||
vna_other: 0x0c,
|
vna_other: 0x0c,
|
||||||
vna_name: 0x0c,
|
vna_name: 0x0c,
|
||||||
vna_next: 0x10
|
vna_next: 0x10
|
||||||
}
|
});
|
||||||
);
|
|
||||||
let aux2 = iter.next().expect("Failed to parse");
|
let aux2 = iter.next().expect("Failed to parse");
|
||||||
assert_eq!(
|
assert_eq!(aux2, VerNeedAux {
|
||||||
aux2,
|
|
||||||
VerNeedAux {
|
|
||||||
vna_hash: 0x069691b3,
|
vna_hash: 0x069691b3,
|
||||||
vna_flags: 0,
|
vna_flags: 0,
|
||||||
vna_other: 0x0b,
|
vna_other: 0x0b,
|
||||||
vna_name: 0x17,
|
vna_name: 0x17,
|
||||||
vna_next: 0x10
|
vna_next: 0x10
|
||||||
}
|
});
|
||||||
);
|
|
||||||
let aux3 = iter.next().expect("Failed to parse");
|
let aux3 = iter.next().expect("Failed to parse");
|
||||||
assert_eq!(
|
assert_eq!(aux3, VerNeedAux {
|
||||||
aux3,
|
|
||||||
VerNeedAux {
|
|
||||||
vna_hash: 0x06969194,
|
vna_hash: 0x06969194,
|
||||||
vna_flags: 0,
|
vna_flags: 0,
|
||||||
vna_other: 0x09,
|
vna_other: 0x09,
|
||||||
vna_name: 0x37,
|
vna_name: 0x37,
|
||||||
vna_next: 0
|
vna_next: 0
|
||||||
}
|
});
|
||||||
);
|
|
||||||
assert!(iter.next().is_none());
|
assert!(iter.next().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -766,49 +754,37 @@ fn verneedaux_iter_two_lists_interspersed() {
|
|||||||
let mut iter2 = VerNeedAuxIterator::new(LittleEndian, Class::ELF64, 2, 0x10, &data);
|
let mut iter2 = VerNeedAuxIterator::new(LittleEndian, Class::ELF64, 2, 0x10, &data);
|
||||||
|
|
||||||
let aux1_1 = iter1.next().expect("Failed to parse");
|
let aux1_1 = iter1.next().expect("Failed to parse");
|
||||||
assert_eq!(
|
assert_eq!(aux1_1, VerNeedAux {
|
||||||
aux1_1,
|
|
||||||
VerNeedAux {
|
|
||||||
vna_hash: 0x0827e5c0,
|
vna_hash: 0x0827e5c0,
|
||||||
vna_flags: 0,
|
vna_flags: 0,
|
||||||
vna_other: 0x0a,
|
vna_other: 0x0a,
|
||||||
vna_name: 0x0ccc,
|
vna_name: 0x0ccc,
|
||||||
vna_next: 0x20,
|
vna_next: 0x20,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
let aux2_1 = iter2.next().expect("Failed to parse");
|
let aux2_1 = iter2.next().expect("Failed to parse");
|
||||||
assert_eq!(
|
assert_eq!(aux2_1, VerNeedAux {
|
||||||
aux2_1,
|
|
||||||
VerNeedAux {
|
|
||||||
vna_hash: 0x0d696913,
|
vna_hash: 0x0d696913,
|
||||||
vna_flags: 0,
|
vna_flags: 0,
|
||||||
vna_other: 0x0c,
|
vna_other: 0x0c,
|
||||||
vna_name: 0x0cd7,
|
vna_name: 0x0cd7,
|
||||||
vna_next: 0x20
|
vna_next: 0x20
|
||||||
}
|
});
|
||||||
);
|
|
||||||
let aux1_2 = iter1.next().expect("Failed to parse");
|
let aux1_2 = iter1.next().expect("Failed to parse");
|
||||||
assert_eq!(
|
assert_eq!(aux1_2, VerNeedAux {
|
||||||
aux1_2,
|
|
||||||
VerNeedAux {
|
|
||||||
vna_hash: 0x069691b3,
|
vna_hash: 0x069691b3,
|
||||||
vna_flags: 0,
|
vna_flags: 0,
|
||||||
vna_other: 0x0b,
|
vna_other: 0x0b,
|
||||||
vna_name: 0x0ce1,
|
vna_name: 0x0ce1,
|
||||||
vna_next: 0
|
vna_next: 0
|
||||||
}
|
});
|
||||||
);
|
|
||||||
let aux2_2 = iter2.next().expect("Failed to parse");
|
let aux2_2 = iter2.next().expect("Failed to parse");
|
||||||
assert_eq!(
|
assert_eq!(aux2_2, VerNeedAux {
|
||||||
aux2_2,
|
|
||||||
VerNeedAux {
|
|
||||||
vna_hash: 0x06969194,
|
vna_hash: 0x06969194,
|
||||||
vna_flags: 0,
|
vna_flags: 0,
|
||||||
vna_other: 0x09,
|
vna_other: 0x09,
|
||||||
vna_name: 0x0cec,
|
vna_name: 0x0cec,
|
||||||
vna_next: 0
|
vna_next: 0
|
||||||
}
|
});
|
||||||
);
|
|
||||||
assert!(iter1.next().is_none());
|
assert!(iter1.next().is_none());
|
||||||
assert!(iter2.next().is_none());
|
assert!(iter2.next().is_none());
|
||||||
}
|
}
|
||||||
@ -878,9 +854,7 @@ fn verdef_iter() {
|
|||||||
|
|
||||||
assert_eq!(entries.len(), 4);
|
assert_eq!(entries.len(), 4);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(entries, vec![
|
||||||
entries,
|
|
||||||
vec![
|
|
||||||
(
|
(
|
||||||
VerDef {
|
VerDef {
|
||||||
vd_flags: 1,
|
vd_flags: 1,
|
||||||
@ -912,10 +886,10 @@ fn verdef_iter() {
|
|||||||
vd_aux: 20,
|
vd_aux: 20,
|
||||||
vd_next: 36,
|
vd_next: 36,
|
||||||
},
|
},
|
||||||
vec![
|
vec![VerDefAux { vda_name: 0x17, vda_next: 8 }, VerDefAux {
|
||||||
VerDefAux { vda_name: 0x17, vda_next: 8 },
|
vda_name: 0xC,
|
||||||
VerDefAux { vda_name: 0xC, vda_next: 0 }
|
vda_next: 0
|
||||||
]
|
}]
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
VerDef {
|
VerDef {
|
||||||
@ -926,13 +900,12 @@ fn verdef_iter() {
|
|||||||
vd_aux: 20,
|
vd_aux: 20,
|
||||||
vd_next: 0,
|
vd_next: 0,
|
||||||
},
|
},
|
||||||
vec![
|
vec![VerDefAux { vda_name: 0xC, vda_next: 8 }, VerDefAux {
|
||||||
VerDefAux { vda_name: 0xC, vda_next: 8 },
|
vda_name: 0x17,
|
||||||
VerDefAux { vda_name: 0x17, vda_next: 0 }
|
vda_next: 0
|
||||||
]
|
}]
|
||||||
),
|
),
|
||||||
]
|
]);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1041,31 +1014,25 @@ fn version_table() {
|
|||||||
.get_requirement(2)
|
.get_requirement(2)
|
||||||
.expect("Failed to parse definition")
|
.expect("Failed to parse definition")
|
||||||
.expect("Failed to find req");
|
.expect("Failed to find req");
|
||||||
assert_eq!(
|
assert_eq!(req1, SymbolRequirement {
|
||||||
req1,
|
|
||||||
SymbolRequirement {
|
|
||||||
file: "libc.so.6",
|
file: "libc.so.6",
|
||||||
name: "GLIBC_2.3",
|
name: "GLIBC_2.3",
|
||||||
hash: 0x6969194,
|
hash: 0x6969194,
|
||||||
flags: 0,
|
flags: 0,
|
||||||
hidden: false
|
hidden: false
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
let req2 = table
|
let req2 = table
|
||||||
.get_requirement(3)
|
.get_requirement(3)
|
||||||
.expect("Failed to parse definition")
|
.expect("Failed to parse definition")
|
||||||
.expect("Failed to find req");
|
.expect("Failed to find req");
|
||||||
assert_eq!(
|
assert_eq!(req2, SymbolRequirement {
|
||||||
req2,
|
|
||||||
SymbolRequirement {
|
|
||||||
file: "libz.so.1",
|
file: "libz.so.1",
|
||||||
name: "ZLIB_1.2.0",
|
name: "ZLIB_1.2.0",
|
||||||
hash: 0x827E5C0,
|
hash: 0x827E5C0,
|
||||||
flags: 0,
|
flags: 0,
|
||||||
hidden: false
|
hidden: false
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// The last version_index points to non-existent definitions. Maybe we should treat
|
// The last version_index points to non-existent definitions. Maybe we should treat
|
||||||
// this as a ParseError instead of returning an empty Option? This can only happen
|
// this as a ParseError instead of returning an empty Option? This can only happen
|
||||||
@ -1138,17 +1105,14 @@ fn parse_verdef32_lsb() {
|
|||||||
let entry = VerDef::parse_at(LittleEndian, Class::ELF32, &mut offset, data.as_ref())
|
let entry = VerDef::parse_at(LittleEndian, Class::ELF32, &mut offset, data.as_ref())
|
||||||
.expect("Failed to parse VerDef");
|
.expect("Failed to parse VerDef");
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(entry, VerDef {
|
||||||
entry,
|
|
||||||
VerDef {
|
|
||||||
vd_flags: 0x0302,
|
vd_flags: 0x0302,
|
||||||
vd_ndx: 0x0504,
|
vd_ndx: 0x0504,
|
||||||
vd_cnt: 0x0706,
|
vd_cnt: 0x0706,
|
||||||
vd_hash: 0x0B0A0908,
|
vd_hash: 0x0B0A0908,
|
||||||
vd_aux: 0x0F0E0D0C,
|
vd_aux: 0x0F0E0D0C,
|
||||||
vd_next: 0x13121110,
|
vd_next: 0x13121110,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
assert_eq!(offset, ELFVERDEFSIZE);
|
assert_eq!(offset, ELFVERDEFSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1180,17 +1144,14 @@ fn parse_verdef64_msb() {
|
|||||||
let entry = VerDef::parse_at(BigEndian, Class::ELF64, &mut offset, data.as_ref())
|
let entry = VerDef::parse_at(BigEndian, Class::ELF64, &mut offset, data.as_ref())
|
||||||
.expect("Failed to parse VerDef");
|
.expect("Failed to parse VerDef");
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(entry, VerDef {
|
||||||
entry,
|
|
||||||
VerDef {
|
|
||||||
vd_flags: 0x0203,
|
vd_flags: 0x0203,
|
||||||
vd_ndx: 0x0405,
|
vd_ndx: 0x0405,
|
||||||
vd_cnt: 0x0607,
|
vd_cnt: 0x0607,
|
||||||
vd_hash: 0x08090A0B,
|
vd_hash: 0x08090A0B,
|
||||||
vd_aux: 0x0C0D0E0F,
|
vd_aux: 0x0C0D0E0F,
|
||||||
vd_next: 0x10111213,
|
vd_next: 0x10111213,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
assert_eq!(offset, ELFVERDEFSIZE);
|
assert_eq!(offset, ELFVERDEFSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1229,38 +1190,34 @@ fn parse_verdef_bad_version_errors() {
|
|||||||
//
|
//
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_verdefaux32_lsb() {
|
fn parse_verdefaux32_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF32, VerDefAux {
|
||||||
LittleEndian,
|
vda_name: 0x03020100,
|
||||||
Class::ELF32,
|
vda_next: 0x07060504,
|
||||||
VerDefAux { vda_name: 0x03020100, vda_next: 0x07060504 },
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_verdefaux32_msb() {
|
fn parse_verdefaux32_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF32, VerDefAux {
|
||||||
BigEndian,
|
vda_name: 0x00010203,
|
||||||
Class::ELF32,
|
vda_next: 0x04050607,
|
||||||
VerDefAux { vda_name: 0x00010203, vda_next: 0x04050607 },
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_verdefaux64_lsb() {
|
fn parse_verdefaux64_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF64, VerDefAux {
|
||||||
LittleEndian,
|
vda_name: 0x03020100,
|
||||||
Class::ELF64,
|
vda_next: 0x07060504,
|
||||||
VerDefAux { vda_name: 0x03020100, vda_next: 0x07060504 },
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_verdefaux64_msb() {
|
fn parse_verdefaux64_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF64, VerDefAux {
|
||||||
BigEndian,
|
vda_name: 0x00010203,
|
||||||
Class::ELF64,
|
vda_next: 0x04050607,
|
||||||
VerDefAux { vda_name: 0x00010203, vda_next: 0x04050607 },
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1299,15 +1256,12 @@ fn parse_verneed32_lsb() {
|
|||||||
let entry = VerNeed::parse_at(LittleEndian, Class::ELF32, &mut offset, data.as_ref())
|
let entry = VerNeed::parse_at(LittleEndian, Class::ELF32, &mut offset, data.as_ref())
|
||||||
.expect("Failed to parse VerNeed");
|
.expect("Failed to parse VerNeed");
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(entry, VerNeed {
|
||||||
entry,
|
|
||||||
VerNeed {
|
|
||||||
vn_cnt: 0x0302,
|
vn_cnt: 0x0302,
|
||||||
vn_file: 0x07060504,
|
vn_file: 0x07060504,
|
||||||
vn_aux: 0x0B0A0908,
|
vn_aux: 0x0B0A0908,
|
||||||
vn_next: 0x0F0E0D0C,
|
vn_next: 0x0F0E0D0C,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
assert_eq!(offset, ELFVERNEEDSIZE);
|
assert_eq!(offset, ELFVERNEEDSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1339,15 +1293,12 @@ fn parse_verneed64_msb() {
|
|||||||
let entry = VerNeed::parse_at(BigEndian, Class::ELF64, &mut offset, data.as_ref())
|
let entry = VerNeed::parse_at(BigEndian, Class::ELF64, &mut offset, data.as_ref())
|
||||||
.expect("Failed to parse VerNeed");
|
.expect("Failed to parse VerNeed");
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(entry, VerNeed {
|
||||||
entry,
|
|
||||||
VerNeed {
|
|
||||||
vn_cnt: 0x0203,
|
vn_cnt: 0x0203,
|
||||||
vn_file: 0x04050607,
|
vn_file: 0x04050607,
|
||||||
vn_aux: 0x08090A0B,
|
vn_aux: 0x08090A0B,
|
||||||
vn_next: 0x0C0D0E0F,
|
vn_next: 0x0C0D0E0F,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
assert_eq!(offset, ELFVERNEEDSIZE);
|
assert_eq!(offset, ELFVERNEEDSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1372,62 +1323,46 @@ fn parse_verneed64_fuzz_too_short() {
|
|||||||
//
|
//
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_verneedaux32_lsb() {
|
fn parse_verneedaux32_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF32, VerNeedAux {
|
||||||
LittleEndian,
|
|
||||||
Class::ELF32,
|
|
||||||
VerNeedAux {
|
|
||||||
vna_hash: 0x03020100,
|
vna_hash: 0x03020100,
|
||||||
vna_flags: 0x0504,
|
vna_flags: 0x0504,
|
||||||
vna_other: 0x0706,
|
vna_other: 0x0706,
|
||||||
vna_name: 0x0B0A0908,
|
vna_name: 0x0B0A0908,
|
||||||
vna_next: 0x0F0E0D0C,
|
vna_next: 0x0F0E0D0C,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_verneedaux32_msb() {
|
fn parse_verneedaux32_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF32, VerNeedAux {
|
||||||
BigEndian,
|
|
||||||
Class::ELF32,
|
|
||||||
VerNeedAux {
|
|
||||||
vna_hash: 0x00010203,
|
vna_hash: 0x00010203,
|
||||||
vna_flags: 0x0405,
|
vna_flags: 0x0405,
|
||||||
vna_other: 0x0607,
|
vna_other: 0x0607,
|
||||||
vna_name: 0x08090A0B,
|
vna_name: 0x08090A0B,
|
||||||
vna_next: 0x0C0D0E0F,
|
vna_next: 0x0C0D0E0F,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_verneedaux64_lsb() {
|
fn parse_verneedaux64_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF64, VerNeedAux {
|
||||||
LittleEndian,
|
|
||||||
Class::ELF64,
|
|
||||||
VerNeedAux {
|
|
||||||
vna_hash: 0x03020100,
|
vna_hash: 0x03020100,
|
||||||
vna_flags: 0x0504,
|
vna_flags: 0x0504,
|
||||||
vna_other: 0x0706,
|
vna_other: 0x0706,
|
||||||
vna_name: 0x0B0A0908,
|
vna_name: 0x0B0A0908,
|
||||||
vna_next: 0x0F0E0D0C,
|
vna_next: 0x0F0E0D0C,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_verneedaux64_msb() {
|
fn parse_verneedaux64_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF64, VerNeedAux {
|
||||||
BigEndian,
|
|
||||||
Class::ELF64,
|
|
||||||
VerNeedAux {
|
|
||||||
vna_hash: 0x00010203,
|
vna_hash: 0x00010203,
|
||||||
vna_flags: 0x0405,
|
vna_flags: 0x0405,
|
||||||
vna_other: 0x0607,
|
vna_other: 0x0607,
|
||||||
vna_name: 0x08090A0B,
|
vna_name: 0x08090A0B,
|
||||||
vna_next: 0x0C0D0E0F,
|
vna_next: 0x0C0D0E0F,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -316,38 +316,34 @@ mod sysv_parse_tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_sysvhdr32_lsb() {
|
fn parse_sysvhdr32_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF32, SysVHashHeader {
|
||||||
LittleEndian,
|
nbucket: 0x03020100,
|
||||||
Class::ELF32,
|
nchain: 0x07060504,
|
||||||
SysVHashHeader { nbucket: 0x03020100, nchain: 0x07060504 },
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_sysvhdr32_msb() {
|
fn parse_sysvhdr32_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF32, SysVHashHeader {
|
||||||
BigEndian,
|
nbucket: 0x00010203,
|
||||||
Class::ELF32,
|
nchain: 0x04050607,
|
||||||
SysVHashHeader { nbucket: 0x00010203, nchain: 0x04050607 },
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_sysvhdr64_lsb() {
|
fn parse_sysvhdr64_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF64, SysVHashHeader {
|
||||||
LittleEndian,
|
nbucket: 0x03020100,
|
||||||
Class::ELF64,
|
nchain: 0x07060504,
|
||||||
SysVHashHeader { nbucket: 0x03020100, nchain: 0x07060504 },
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_sysvhdr64_msb() {
|
fn parse_sysvhdr64_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF64, SysVHashHeader {
|
||||||
BigEndian,
|
nbucket: 0x00010203,
|
||||||
Class::ELF64,
|
nchain: 0x04050607,
|
||||||
SysVHashHeader { nbucket: 0x00010203, nchain: 0x04050607 },
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -388,58 +384,42 @@ fn gnu_hash_tests() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_gnuhdr32_lsb() {
|
fn parse_gnuhdr32_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF32, GnuHashHeader {
|
||||||
LittleEndian,
|
|
||||||
Class::ELF32,
|
|
||||||
GnuHashHeader {
|
|
||||||
nbucket: 0x03020100,
|
nbucket: 0x03020100,
|
||||||
table_start_idx: 0x07060504,
|
table_start_idx: 0x07060504,
|
||||||
nbloom: 0x0B0A0908,
|
nbloom: 0x0B0A0908,
|
||||||
nshift: 0x0F0E0D0C,
|
nshift: 0x0F0E0D0C,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_gnuhdr32_msb() {
|
fn parse_gnuhdr32_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF32, GnuHashHeader {
|
||||||
BigEndian,
|
|
||||||
Class::ELF32,
|
|
||||||
GnuHashHeader {
|
|
||||||
nbucket: 0x00010203,
|
nbucket: 0x00010203,
|
||||||
table_start_idx: 0x04050607,
|
table_start_idx: 0x04050607,
|
||||||
nbloom: 0x008090A0B,
|
nbloom: 0x008090A0B,
|
||||||
nshift: 0x0C0D0E0F,
|
nshift: 0x0C0D0E0F,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_gnuhdr64_lsb() {
|
fn parse_gnuhdr64_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF64, GnuHashHeader {
|
||||||
LittleEndian,
|
|
||||||
Class::ELF64,
|
|
||||||
GnuHashHeader {
|
|
||||||
nbucket: 0x03020100,
|
nbucket: 0x03020100,
|
||||||
table_start_idx: 0x07060504,
|
table_start_idx: 0x07060504,
|
||||||
nbloom: 0x0B0A0908,
|
nbloom: 0x0B0A0908,
|
||||||
nshift: 0x0F0E0D0C,
|
nshift: 0x0F0E0D0C,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_gnuhdr64_msb() {
|
fn parse_gnuhdr64_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF64, GnuHashHeader {
|
||||||
BigEndian,
|
|
||||||
Class::ELF64,
|
|
||||||
GnuHashHeader {
|
|
||||||
nbucket: 0x00010203,
|
nbucket: 0x00010203,
|
||||||
table_start_idx: 0x04050607,
|
table_start_idx: 0x04050607,
|
||||||
nbloom: 0x008090A0B,
|
nbloom: 0x008090A0B,
|
||||||
nshift: 0x0C0D0E0F,
|
nshift: 0x0C0D0E0F,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -473,46 +473,38 @@ fn parse_note_32_lsb_with_no_desc() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_nhdr32_lsb() {
|
fn parse_nhdr32_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF32, NoteHeader {
|
||||||
LittleEndian,
|
n_namesz: 0x03020100,
|
||||||
Class::ELF32,
|
n_descsz: 0x07060504,
|
||||||
NoteHeader { n_namesz: 0x03020100, n_descsz: 0x07060504, n_type: 0x0B0A0908 },
|
n_type: 0x0B0A0908,
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_nhdr32_msb() {
|
fn parse_nhdr32_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF32, NoteHeader {
|
||||||
BigEndian,
|
n_namesz: 0x00010203,
|
||||||
Class::ELF32,
|
n_descsz: 0x04050607,
|
||||||
NoteHeader { n_namesz: 0x00010203, n_descsz: 0x04050607, n_type: 0x08090A0B },
|
n_type: 0x08090A0B,
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_nhdr64_lsb() {
|
fn parse_nhdr64_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF64, NoteHeader {
|
||||||
LittleEndian,
|
|
||||||
Class::ELF64,
|
|
||||||
NoteHeader {
|
|
||||||
n_namesz: 0x0706050403020100,
|
n_namesz: 0x0706050403020100,
|
||||||
n_descsz: 0x0F0E0D0C0B0A0908,
|
n_descsz: 0x0F0E0D0C0B0A0908,
|
||||||
n_type: 0x1716151413121110,
|
n_type: 0x1716151413121110,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_nhdr64_msb() {
|
fn parse_nhdr64_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF64, NoteHeader {
|
||||||
BigEndian,
|
|
||||||
Class::ELF64,
|
|
||||||
NoteHeader {
|
|
||||||
n_namesz: 0x0001020304050607,
|
n_namesz: 0x0001020304050607,
|
||||||
n_descsz: 0x08090A0B0C0D0E0F,
|
n_descsz: 0x08090A0B0C0D0E0F,
|
||||||
n_type: 0x1011121314151617,
|
n_type: 0x1011121314151617,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -142,38 +142,38 @@ mod parse_tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_rel32_lsb() {
|
fn parse_rel32_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF32, Rel {
|
||||||
LittleEndian,
|
r_offset: 0x03020100,
|
||||||
Class::ELF32,
|
r_sym: 0x00070605,
|
||||||
Rel { r_offset: 0x03020100, r_sym: 0x00070605, r_type: 0x00000004 },
|
r_type: 0x00000004,
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_rel32_msb() {
|
fn parse_rel32_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF32, Rel {
|
||||||
BigEndian,
|
r_offset: 0x00010203,
|
||||||
Class::ELF32,
|
r_sym: 0x00040506,
|
||||||
Rel { r_offset: 0x00010203, r_sym: 0x00040506, r_type: 0x00000007 },
|
r_type: 0x00000007,
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_rel64_lsb() {
|
fn parse_rel64_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF64, Rel {
|
||||||
LittleEndian,
|
r_offset: 0x0706050403020100,
|
||||||
Class::ELF64,
|
r_sym: 0x0F0E0D0C,
|
||||||
Rel { r_offset: 0x0706050403020100, r_sym: 0x0F0E0D0C, r_type: 0x0B0A0908 },
|
r_type: 0x0B0A0908,
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_rel64_msb() {
|
fn parse_rel64_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF64, Rel {
|
||||||
BigEndian,
|
r_offset: 0x0001020304050607,
|
||||||
Class::ELF64,
|
r_sym: 0x08090A0B,
|
||||||
Rel { r_offset: 0x0001020304050607, r_sym: 0x08090A0B, r_type: 0x0C0D0E0F },
|
r_type: 0x0C0D0E0F,
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -198,58 +198,42 @@ fn parse_rel64_msb_fuzz_too_short() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_rela32_lsb() {
|
fn parse_rela32_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF32, Rela {
|
||||||
LittleEndian,
|
|
||||||
Class::ELF32,
|
|
||||||
Rela {
|
|
||||||
r_offset: 0x03020100,
|
r_offset: 0x03020100,
|
||||||
r_sym: 0x00070605,
|
r_sym: 0x00070605,
|
||||||
r_type: 0x00000004,
|
r_type: 0x00000004,
|
||||||
r_addend: 0x0B0A0908,
|
r_addend: 0x0B0A0908,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_rela32_msb() {
|
fn parse_rela32_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF32, Rela {
|
||||||
BigEndian,
|
|
||||||
Class::ELF32,
|
|
||||||
Rela {
|
|
||||||
r_offset: 0x00010203,
|
r_offset: 0x00010203,
|
||||||
r_sym: 0x00040506,
|
r_sym: 0x00040506,
|
||||||
r_type: 0x00000007,
|
r_type: 0x00000007,
|
||||||
r_addend: 0x08090A0B,
|
r_addend: 0x08090A0B,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_rela64_lsb() {
|
fn parse_rela64_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF64, Rela {
|
||||||
LittleEndian,
|
|
||||||
Class::ELF64,
|
|
||||||
Rela {
|
|
||||||
r_offset: 0x0706050403020100,
|
r_offset: 0x0706050403020100,
|
||||||
r_sym: 0x0F0E0D0C,
|
r_sym: 0x0F0E0D0C,
|
||||||
r_type: 0x0B0A0908,
|
r_type: 0x0B0A0908,
|
||||||
r_addend: 0x1716151413121110,
|
r_addend: 0x1716151413121110,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_rela64_msb() {
|
fn parse_rela64_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF64, Rela {
|
||||||
BigEndian,
|
|
||||||
Class::ELF64,
|
|
||||||
Rela {
|
|
||||||
r_offset: 0x0001020304050607,
|
r_offset: 0x0001020304050607,
|
||||||
r_sym: 0x08090A0B,
|
r_sym: 0x08090A0B,
|
||||||
r_type: 0x0C0D0E0F,
|
r_type: 0x0C0D0E0F,
|
||||||
r_addend: 0x1011121314151617,
|
r_addend: 0x1011121314151617,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -131,10 +131,7 @@ mod parse_tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_shdr32_lsb() {
|
fn parse_shdr32_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF32, SectionHeader {
|
||||||
LittleEndian,
|
|
||||||
Class::ELF32,
|
|
||||||
SectionHeader {
|
|
||||||
sh_name: 0x03020100,
|
sh_name: 0x03020100,
|
||||||
sh_type: 0x07060504,
|
sh_type: 0x07060504,
|
||||||
sh_flags: 0xB0A0908,
|
sh_flags: 0xB0A0908,
|
||||||
@ -145,16 +142,12 @@ fn parse_shdr32_lsb() {
|
|||||||
sh_info: 0x1F1E1D1C,
|
sh_info: 0x1F1E1D1C,
|
||||||
sh_addralign: 0x23222120,
|
sh_addralign: 0x23222120,
|
||||||
sh_entsize: 0x27262524,
|
sh_entsize: 0x27262524,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_shdr32_msb() {
|
fn parse_shdr32_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF32, SectionHeader {
|
||||||
BigEndian,
|
|
||||||
Class::ELF32,
|
|
||||||
SectionHeader {
|
|
||||||
sh_name: 0x00010203,
|
sh_name: 0x00010203,
|
||||||
sh_type: 0x04050607,
|
sh_type: 0x04050607,
|
||||||
sh_flags: 0x08090A0B,
|
sh_flags: 0x08090A0B,
|
||||||
@ -165,16 +158,12 @@ fn parse_shdr32_msb() {
|
|||||||
sh_info: 0x1C1D1E1F,
|
sh_info: 0x1C1D1E1F,
|
||||||
sh_addralign: 0x20212223,
|
sh_addralign: 0x20212223,
|
||||||
sh_entsize: 0x24252627,
|
sh_entsize: 0x24252627,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_shdr64_lsb() {
|
fn parse_shdr64_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF64, SectionHeader {
|
||||||
LittleEndian,
|
|
||||||
Class::ELF64,
|
|
||||||
SectionHeader {
|
|
||||||
sh_name: 0x03020100,
|
sh_name: 0x03020100,
|
||||||
sh_type: 0x07060504,
|
sh_type: 0x07060504,
|
||||||
sh_flags: 0x0F0E0D0C0B0A0908,
|
sh_flags: 0x0F0E0D0C0B0A0908,
|
||||||
@ -185,16 +174,12 @@ fn parse_shdr64_lsb() {
|
|||||||
sh_info: 0x2F2E2D2C,
|
sh_info: 0x2F2E2D2C,
|
||||||
sh_addralign: 0x3736353433323130,
|
sh_addralign: 0x3736353433323130,
|
||||||
sh_entsize: 0x3F3E3D3C3B3A3938,
|
sh_entsize: 0x3F3E3D3C3B3A3938,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_shdr64_msb() {
|
fn parse_shdr64_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF64, SectionHeader {
|
||||||
BigEndian,
|
|
||||||
Class::ELF64,
|
|
||||||
SectionHeader {
|
|
||||||
sh_name: 0x00010203,
|
sh_name: 0x00010203,
|
||||||
sh_type: 0x04050607,
|
sh_type: 0x04050607,
|
||||||
sh_flags: 0x08090A0B0C0D0E0F,
|
sh_flags: 0x08090A0B0C0D0E0F,
|
||||||
@ -205,8 +190,7 @@ fn parse_shdr64_msb() {
|
|||||||
sh_info: 0x2C2D2E2F,
|
sh_info: 0x2C2D2E2F,
|
||||||
sh_addralign: 0x3031323334353637,
|
sh_addralign: 0x3031323334353637,
|
||||||
sh_entsize: 0x38393A3B3C3D3E3F,
|
sh_entsize: 0x38393A3B3C3D3E3F,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -131,10 +131,7 @@ mod parse_tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_phdr32_lsb() {
|
fn parse_phdr32_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF32, ProgramHeader {
|
||||||
LittleEndian,
|
|
||||||
Class::ELF32,
|
|
||||||
ProgramHeader {
|
|
||||||
p_type: 0x03020100,
|
p_type: 0x03020100,
|
||||||
p_offset: 0x07060504,
|
p_offset: 0x07060504,
|
||||||
p_vaddr: 0xB0A0908,
|
p_vaddr: 0xB0A0908,
|
||||||
@ -143,16 +140,12 @@ fn parse_phdr32_lsb() {
|
|||||||
p_memsz: 0x17161514,
|
p_memsz: 0x17161514,
|
||||||
p_flags: 0x1B1A1918,
|
p_flags: 0x1B1A1918,
|
||||||
p_align: 0x1F1E1D1C,
|
p_align: 0x1F1E1D1C,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_phdr32_msb() {
|
fn parse_phdr32_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF32, ProgramHeader {
|
||||||
BigEndian,
|
|
||||||
Class::ELF32,
|
|
||||||
ProgramHeader {
|
|
||||||
p_type: 0x00010203,
|
p_type: 0x00010203,
|
||||||
p_offset: 0x04050607,
|
p_offset: 0x04050607,
|
||||||
p_vaddr: 0x08090A0B,
|
p_vaddr: 0x08090A0B,
|
||||||
@ -161,16 +154,12 @@ fn parse_phdr32_msb() {
|
|||||||
p_memsz: 0x14151617,
|
p_memsz: 0x14151617,
|
||||||
p_flags: 0x18191A1B,
|
p_flags: 0x18191A1B,
|
||||||
p_align: 0x1C1D1E1F,
|
p_align: 0x1C1D1E1F,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_phdr64_lsb() {
|
fn parse_phdr64_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF64, ProgramHeader {
|
||||||
LittleEndian,
|
|
||||||
Class::ELF64,
|
|
||||||
ProgramHeader {
|
|
||||||
p_type: 0x03020100,
|
p_type: 0x03020100,
|
||||||
p_offset: 0x0F0E0D0C0B0A0908,
|
p_offset: 0x0F0E0D0C0B0A0908,
|
||||||
p_vaddr: 0x1716151413121110,
|
p_vaddr: 0x1716151413121110,
|
||||||
@ -179,16 +168,12 @@ fn parse_phdr64_lsb() {
|
|||||||
p_memsz: 0x2F2E2D2C2B2A2928,
|
p_memsz: 0x2F2E2D2C2B2A2928,
|
||||||
p_flags: 0x07060504,
|
p_flags: 0x07060504,
|
||||||
p_align: 0x3736353433323130,
|
p_align: 0x3736353433323130,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_phdr64_msb() {
|
fn parse_phdr64_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF64, ProgramHeader {
|
||||||
BigEndian,
|
|
||||||
Class::ELF64,
|
|
||||||
ProgramHeader {
|
|
||||||
p_type: 0x00010203,
|
p_type: 0x00010203,
|
||||||
p_offset: 0x08090A0B0C0D0E0F,
|
p_offset: 0x08090A0B0C0D0E0F,
|
||||||
p_vaddr: 0x1011121314151617,
|
p_vaddr: 0x1011121314151617,
|
||||||
@ -197,8 +182,7 @@ fn parse_phdr64_msb() {
|
|||||||
p_memsz: 0x28292A2B2C2D2E2F,
|
p_memsz: 0x28292A2B2C2D2E2F,
|
||||||
p_flags: 0x04050607,
|
p_flags: 0x04050607,
|
||||||
p_align: 0x3031323334353637,
|
p_align: 0x3031323334353637,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -168,66 +168,50 @@ mod parse_tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_sym32_lsb() {
|
fn parse_sym32_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF32, Symbol {
|
||||||
LittleEndian,
|
|
||||||
Class::ELF32,
|
|
||||||
Symbol {
|
|
||||||
st_name: 0x03020100,
|
st_name: 0x03020100,
|
||||||
st_value: 0x07060504,
|
st_value: 0x07060504,
|
||||||
st_size: 0x0B0A0908,
|
st_size: 0x0B0A0908,
|
||||||
st_shndx: 0x0F0E,
|
st_shndx: 0x0F0E,
|
||||||
st_info: 0x0C,
|
st_info: 0x0C,
|
||||||
st_other: 0x0D,
|
st_other: 0x0D,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_sym32_msb() {
|
fn parse_sym32_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF32, Symbol {
|
||||||
BigEndian,
|
|
||||||
Class::ELF32,
|
|
||||||
Symbol {
|
|
||||||
st_name: 0x00010203,
|
st_name: 0x00010203,
|
||||||
st_value: 0x04050607,
|
st_value: 0x04050607,
|
||||||
st_size: 0x08090A0B,
|
st_size: 0x08090A0B,
|
||||||
st_shndx: 0x0E0F,
|
st_shndx: 0x0E0F,
|
||||||
st_info: 0x0C,
|
st_info: 0x0C,
|
||||||
st_other: 0x0D,
|
st_other: 0x0D,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_sym64_lsb() {
|
fn parse_sym64_lsb() {
|
||||||
test_parse_for(
|
test_parse_for(LittleEndian, Class::ELF64, Symbol {
|
||||||
LittleEndian,
|
|
||||||
Class::ELF64,
|
|
||||||
Symbol {
|
|
||||||
st_name: 0x03020100,
|
st_name: 0x03020100,
|
||||||
st_value: 0x0F0E0D0C0B0A0908,
|
st_value: 0x0F0E0D0C0B0A0908,
|
||||||
st_size: 0x1716151413121110,
|
st_size: 0x1716151413121110,
|
||||||
st_shndx: 0x0706,
|
st_shndx: 0x0706,
|
||||||
st_info: 0x04,
|
st_info: 0x04,
|
||||||
st_other: 0x05,
|
st_other: 0x05,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_sym64_msb() {
|
fn parse_sym64_msb() {
|
||||||
test_parse_for(
|
test_parse_for(BigEndian, Class::ELF64, Symbol {
|
||||||
BigEndian,
|
|
||||||
Class::ELF64,
|
|
||||||
Symbol {
|
|
||||||
st_name: 0x00010203,
|
st_name: 0x00010203,
|
||||||
st_value: 0x08090A0B0C0D0E0F,
|
st_value: 0x08090A0B0C0D0E0F,
|
||||||
st_size: 0x1011121314151617,
|
st_size: 0x1011121314151617,
|
||||||
st_shndx: 0x0607,
|
st_shndx: 0x0607,
|
||||||
st_info: 0x04,
|
st_info: 0x04,
|
||||||
st_other: 0x05,
|
st_other: 0x05,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -19,8 +19,8 @@ mod musl_reference_tests {
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::{env, fs};
|
use std::{env, fs};
|
||||||
|
|
||||||
use rand::seq::SliceRandom;
|
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
use rand::seq::SliceRandom;
|
||||||
|
|
||||||
// Number of tests to generate for each function
|
// Number of tests to generate for each function
|
||||||
const NTESTS: usize = 500;
|
const NTESTS: usize = 500;
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
use core::ptr::read_volatile;
|
use core::ptr::read_volatile;
|
||||||
|
|
||||||
use super::fenv::{
|
use super::fenv::{
|
||||||
feclearexcept, fegetround, feraiseexcept, fetestexcept, FE_INEXACT, FE_TONEAREST, FE_UNDERFLOW,
|
FE_INEXACT, FE_TONEAREST, FE_UNDERFLOW, feclearexcept, fegetround, feraiseexcept, fetestexcept,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -221,10 +221,10 @@ macro_rules! llvm_intrinsically_optimized {
|
|||||||
pub use self::erf::{erf, erfc};
|
pub use self::erf::{erf, erfc};
|
||||||
pub use self::erff::{erfcf, erff};
|
pub use self::erff::{erfcf, erff};
|
||||||
pub use self::exp::exp;
|
pub use self::exp::exp;
|
||||||
pub use self::exp10::exp10;
|
|
||||||
pub use self::exp10f::exp10f;
|
|
||||||
pub use self::exp2::exp2;
|
pub use self::exp2::exp2;
|
||||||
pub use self::exp2f::exp2f;
|
pub use self::exp2f::exp2f;
|
||||||
|
pub use self::exp10::exp10;
|
||||||
|
pub use self::exp10f::exp10f;
|
||||||
pub use self::expf::expf;
|
pub use self::expf::expf;
|
||||||
pub use self::expm1::expm1;
|
pub use self::expm1::expm1;
|
||||||
pub use self::expm1f::expm1f;
|
pub use self::expm1f::expm1f;
|
||||||
@ -261,12 +261,12 @@ macro_rules! llvm_intrinsically_optimized {
|
|||||||
pub use self::lgammaf::lgammaf;
|
pub use self::lgammaf::lgammaf;
|
||||||
pub use self::lgammaf_r::lgammaf_r;
|
pub use self::lgammaf_r::lgammaf_r;
|
||||||
pub use self::log::log;
|
pub use self::log::log;
|
||||||
pub use self::log10::log10;
|
|
||||||
pub use self::log10f::log10f;
|
|
||||||
pub use self::log1p::log1p;
|
pub use self::log1p::log1p;
|
||||||
pub use self::log1pf::log1pf;
|
pub use self::log1pf::log1pf;
|
||||||
pub use self::log2::log2;
|
pub use self::log2::log2;
|
||||||
pub use self::log2f::log2f;
|
pub use self::log2f::log2f;
|
||||||
|
pub use self::log10::log10;
|
||||||
|
pub use self::log10f::log10f;
|
||||||
pub use self::logf::logf;
|
pub use self::logf::logf;
|
||||||
pub use self::modf::modf;
|
pub use self::modf::modf;
|
||||||
pub use self::modff::modff;
|
pub use self::modff::modff;
|
||||||
|
@ -42,10 +42,7 @@ pub enum Error {
|
|||||||
impl Display for Error {
|
impl Display for Error {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
|
||||||
use Error::*;
|
use Error::*;
|
||||||
write!(
|
write!(f, "{}", match self {
|
||||||
f,
|
|
||||||
"{}",
|
|
||||||
match self {
|
|
||||||
WontImplement => "This is a feature that PostCard will never implement",
|
WontImplement => "This is a feature that PostCard will never implement",
|
||||||
NotYetImplemented => {
|
NotYetImplemented => {
|
||||||
"This is a feature that Postcard intends to support, but does not yet"
|
"This is a feature that Postcard intends to support, but does not yet"
|
||||||
@ -66,8 +63,7 @@ fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
|
|||||||
SerdeSerCustom => "Serde Serialization Error",
|
SerdeSerCustom => "Serde Serialization Error",
|
||||||
SerdeDeCustom => "Serde Deserialization Error",
|
SerdeDeCustom => "Serde Deserialization Error",
|
||||||
CollectStrError => "Error while processing `collect_str` during serialization",
|
CollectStrError => "Error while processing `collect_str` during serialization",
|
||||||
}
|
})
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
use core::num::{
|
use core::num::{
|
||||||
NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroIsize, NonZeroU128,
|
NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI128, NonZeroIsize, NonZeroU8,
|
||||||
NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize,
|
NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128, NonZeroUsize,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::varint::varint_max;
|
use crate::varint::varint_max;
|
||||||
|
@ -556,7 +556,7 @@ pub mod crc {
|
|||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
use super::alloc;
|
use super::alloc;
|
||||||
use super::{Flavor, Slice};
|
use super::{Flavor, Slice};
|
||||||
use crate::{serialize_with_flavor, Result};
|
use crate::{Result, serialize_with_flavor};
|
||||||
|
|
||||||
/// Manages CRC modifications as a flavor.
|
/// Manages CRC modifications as a flavor.
|
||||||
pub struct CrcModifier<'a, B, W>
|
pub struct CrcModifier<'a, B, W>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use serde::{ser, Serialize};
|
use serde::{Serialize, ser};
|
||||||
|
|
||||||
use crate::error::{Error, Result};
|
use crate::error::{Error, Result};
|
||||||
use crate::ser::flavors::Flavor;
|
use crate::ser::flavors::Flavor;
|
||||||
|
@ -2425,11 +2425,11 @@ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
|||||||
where
|
where
|
||||||
D: Deserializer<'de>,
|
D: Deserializer<'de>,
|
||||||
{
|
{
|
||||||
let (start, end) = tri!(deserializer.deserialize_struct(
|
let (start, end) =
|
||||||
"Range",
|
tri!(deserializer.deserialize_struct("Range", range::FIELDS, range::RangeVisitor {
|
||||||
range::FIELDS,
|
expecting: "struct Range",
|
||||||
range::RangeVisitor { expecting: "struct Range", phantom: PhantomData },
|
phantom: PhantomData
|
||||||
));
|
},));
|
||||||
Ok(start..end)
|
Ok(start..end)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
use self::private::{First, Second};
|
use self::private::{First, Second};
|
||||||
use crate::de::{self, size_hint, Deserializer, Expected, IntoDeserializer, SeqAccess, Visitor};
|
use crate::de::{self, Deserializer, Expected, IntoDeserializer, SeqAccess, Visitor, size_hint};
|
||||||
use crate::lib::*;
|
use crate::lib::*;
|
||||||
use crate::ser;
|
use crate::ser;
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ mod core {
|
|||||||
pub use std::sync::atomic::Ordering;
|
pub use std::sync::atomic::Ordering;
|
||||||
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic)))]
|
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic)))]
|
||||||
pub use std::sync::atomic::{
|
pub use std::sync::atomic::{
|
||||||
AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8,
|
AtomicBool, AtomicI8, AtomicI16, AtomicI32, AtomicIsize, AtomicU8, AtomicU16, AtomicU32,
|
||||||
AtomicUsize, Ordering,
|
AtomicUsize, Ordering,
|
||||||
};
|
};
|
||||||
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "8"))]
|
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "8"))]
|
||||||
@ -256,8 +256,8 @@ mod core {
|
|||||||
pub use self::core::ops::{Bound, Range, RangeFrom, RangeInclusive, RangeTo};
|
pub use self::core::ops::{Bound, Range, RangeFrom, RangeInclusive, RangeTo};
|
||||||
pub use self::core::time::Duration;
|
pub use self::core::time::Duration;
|
||||||
pub use self::core::{
|
pub use self::core::{
|
||||||
clone, convert, default, f32, f64, i16, i32, i64, i8, isize, iter, num, option, ptr,
|
clone, convert, default, f32, f64, i8, i16, i32, i64, isize, iter, num, option, ptr,
|
||||||
result, str, u16, u32, u64, u8, usize,
|
result, str, u8, u16, u32, u64, usize,
|
||||||
};
|
};
|
||||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||||
pub use self::core::{cmp, mem, slice};
|
pub use self::core::{cmp, mem, slice};
|
||||||
|
@ -200,8 +200,8 @@ mod content {
|
|||||||
use crate::actually_private;
|
use crate::actually_private;
|
||||||
use crate::de::value::{MapDeserializer, SeqDeserializer};
|
use crate::de::value::{MapDeserializer, SeqDeserializer};
|
||||||
use crate::de::{
|
use crate::de::{
|
||||||
self, size_hint, Deserialize, DeserializeSeed, Deserializer, EnumAccess, Expected,
|
self, Deserialize, DeserializeSeed, Deserializer, EnumAccess, Expected, IgnoredAny,
|
||||||
IgnoredAny, MapAccess, SeqAccess, Unexpected, Visitor,
|
MapAccess, SeqAccess, Unexpected, Visitor, size_hint,
|
||||||
};
|
};
|
||||||
use crate::lib::*;
|
use crate::lib::*;
|
||||||
|
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
use core::arch::asm;
|
use core::arch::asm;
|
||||||
|
|
||||||
use crate::registers::model_specific::{FsBase, GsBase, Msr};
|
|
||||||
pub use crate::registers::segmentation::{Segment, Segment64, CS, DS, ES, FS, GS, SS};
|
|
||||||
use crate::structures::gdt::SegmentSelector;
|
|
||||||
use crate::VirtAddr;
|
use crate::VirtAddr;
|
||||||
|
use crate::registers::model_specific::{FsBase, GsBase, Msr};
|
||||||
|
pub use crate::registers::segmentation::{CS, DS, ES, FS, GS, SS, Segment, Segment64};
|
||||||
|
use crate::structures::gdt::SegmentSelector;
|
||||||
|
|
||||||
macro_rules! get_reg_impl {
|
macro_rules! get_reg_impl {
|
||||||
($name:literal) => {
|
($name:literal) => {
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
use core::arch::asm;
|
use core::arch::asm;
|
||||||
|
|
||||||
use crate::structures::gdt::SegmentSelector;
|
|
||||||
pub use crate::structures::DescriptorTablePointer;
|
|
||||||
use crate::VirtAddr;
|
use crate::VirtAddr;
|
||||||
|
pub use crate::structures::DescriptorTablePointer;
|
||||||
|
use crate::structures::gdt::SegmentSelector;
|
||||||
|
|
||||||
/// Load a GDT.
|
/// Load a GDT.
|
||||||
///
|
///
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
use bit_field::BitField;
|
use bit_field::BitField;
|
||||||
|
|
||||||
use crate::instructions::segmentation::{Segment, CS};
|
use crate::instructions::segmentation::{CS, Segment};
|
||||||
use crate::structures::paging::page::{NotGiantPageSize, PageRange};
|
use crate::structures::paging::page::{NotGiantPageSize, PageRange};
|
||||||
use crate::structures::paging::{Page, PageSize, Size2MiB, Size4KiB};
|
use crate::structures::paging::{Page, PageSize, Size2MiB, Size4KiB};
|
||||||
use crate::{PrivilegeLevel, VirtAddr};
|
use crate::{PrivilegeLevel, VirtAddr};
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#![allow(elided_lifetimes_in_paths)]
|
#![allow(elided_lifetimes_in_paths)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
pub use crate::addr::{align_down, align_up, PhysAddr, VirtAddr};
|
pub use crate::addr::{PhysAddr, VirtAddr, align_down, align_up};
|
||||||
|
|
||||||
pub mod addr;
|
pub mod addr;
|
||||||
pub mod instructions;
|
pub mod instructions;
|
||||||
|
@ -164,17 +164,17 @@ mod x86_64 {
|
|||||||
use bit_field::BitField;
|
use bit_field::BitField;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::PrivilegeLevel;
|
||||||
use crate::addr::VirtAddr;
|
use crate::addr::VirtAddr;
|
||||||
use crate::registers::rflags::RFlags;
|
use crate::registers::rflags::RFlags;
|
||||||
// imports for intra doc links
|
// imports for intra doc links
|
||||||
#[cfg(doc)]
|
#[cfg(doc)]
|
||||||
use crate::registers::{
|
use crate::registers::{
|
||||||
control::Cr4Flags,
|
control::Cr4Flags,
|
||||||
segmentation::{Segment, Segment64, CS, SS},
|
segmentation::{CS, SS, Segment, Segment64},
|
||||||
};
|
};
|
||||||
use crate::structures::gdt::SegmentSelector;
|
use crate::structures::gdt::SegmentSelector;
|
||||||
use crate::structures::paging::{Page, Size4KiB};
|
use crate::structures::paging::{Page, Size4KiB};
|
||||||
use crate::PrivilegeLevel;
|
|
||||||
|
|
||||||
impl Msr {
|
impl Msr {
|
||||||
/// Read 64 bits msr register.
|
/// Read 64 bits msr register.
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
use bit_field::BitField;
|
use bit_field::BitField;
|
||||||
|
|
||||||
use super::model_specific::Msr;
|
use super::model_specific::Msr;
|
||||||
|
use crate::{PrivilegeLevel, VirtAddr};
|
||||||
// imports for intra doc links
|
// imports for intra doc links
|
||||||
#[cfg(doc)]
|
#[cfg(doc)]
|
||||||
use crate::{
|
use crate::{
|
||||||
registers::control::Cr4Flags,
|
registers::control::Cr4Flags,
|
||||||
structures::gdt::{Descriptor, DescriptorFlags, GlobalDescriptorTable},
|
structures::gdt::{Descriptor, DescriptorFlags, GlobalDescriptorTable},
|
||||||
};
|
};
|
||||||
use crate::{PrivilegeLevel, VirtAddr};
|
|
||||||
|
|
||||||
/// An x86 segment
|
/// An x86 segment
|
||||||
///
|
///
|
||||||
|
@ -9,12 +9,12 @@
|
|||||||
#[cfg(not(feature = "instructions"))]
|
#[cfg(not(feature = "instructions"))]
|
||||||
use u64 as EntryValue;
|
use u64 as EntryValue;
|
||||||
|
|
||||||
|
use crate::PrivilegeLevel;
|
||||||
pub use crate::registers::segmentation::SegmentSelector;
|
pub use crate::registers::segmentation::SegmentSelector;
|
||||||
// imports for intra-doc links
|
// imports for intra-doc links
|
||||||
#[cfg(doc)]
|
#[cfg(doc)]
|
||||||
use crate::registers::segmentation::{Segment, CS, SS};
|
use crate::registers::segmentation::{CS, SS, Segment};
|
||||||
use crate::structures::tss::TaskStateSegment;
|
use crate::structures::tss::TaskStateSegment;
|
||||||
use crate::PrivilegeLevel;
|
|
||||||
|
|
||||||
/// 8-byte entry in a descriptor table.
|
/// 8-byte entry in a descriptor table.
|
||||||
///
|
///
|
||||||
|
@ -788,7 +788,7 @@ pub const fn missing() -> Self {
|
|||||||
#[cfg(feature = "instructions")]
|
#[cfg(feature = "instructions")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn set_handler_addr(&mut self, addr: VirtAddr) -> &mut EntryOptions {
|
pub unsafe fn set_handler_addr(&mut self, addr: VirtAddr) -> &mut EntryOptions {
|
||||||
use crate::instructions::segmentation::{Segment, CS};
|
use crate::instructions::segmentation::{CS, Segment};
|
||||||
|
|
||||||
let addr = addr.as_u64();
|
let addr = addr.as_u64();
|
||||||
self.pointer_low = addr as u16;
|
self.pointer_low = addr as u16;
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
use core::ops::{Add, AddAssign, Sub, SubAssign};
|
use core::ops::{Add, AddAssign, Sub, SubAssign};
|
||||||
|
|
||||||
use super::page::AddressNotAligned;
|
use super::page::AddressNotAligned;
|
||||||
use crate::structures::paging::page::{PageSize, Size4KiB};
|
|
||||||
use crate::PhysAddr;
|
use crate::PhysAddr;
|
||||||
|
use crate::structures::paging::page::{PageSize, Size4KiB};
|
||||||
|
|
||||||
/// A physical memory frame.
|
/// A physical memory frame.
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use core::fmt;
|
use core::fmt;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::VirtAddr;
|
||||||
use crate::registers::control::Cr3;
|
use crate::registers::control::Cr3;
|
||||||
use crate::structures::paging::frame_alloc::FrameAllocator;
|
use crate::structures::paging::frame_alloc::FrameAllocator;
|
||||||
use crate::structures::paging::page::{AddressNotAligned, NotGiantPageSize, PageRangeInclusive};
|
use crate::structures::paging::page::{AddressNotAligned, NotGiantPageSize, PageRangeInclusive};
|
||||||
@ -12,7 +13,6 @@
|
|||||||
use crate::structures::paging::{
|
use crate::structures::paging::{
|
||||||
FrameDeallocator, Page, PageSize, PageTableIndex, PhysFrame, Size1GiB, Size2MiB, Size4KiB,
|
FrameDeallocator, Page, PageSize, PageTableIndex, PhysFrame, Size1GiB, Size2MiB, Size4KiB,
|
||||||
};
|
};
|
||||||
use crate::VirtAddr;
|
|
||||||
|
|
||||||
/// A recursive page table is a last level page table with an entry mapped to the table itself.
|
/// A recursive page table is a last level page table with an entry mapped to the table itself.
|
||||||
///
|
///
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
use core::ops::{Add, AddAssign, Sub, SubAssign};
|
use core::ops::{Add, AddAssign, Sub, SubAssign};
|
||||||
|
|
||||||
use crate::sealed::Sealed;
|
|
||||||
use crate::structures::paging::page_table::PageTableLevel;
|
|
||||||
use crate::structures::paging::PageTableIndex;
|
|
||||||
use crate::VirtAddr;
|
use crate::VirtAddr;
|
||||||
|
use crate::sealed::Sealed;
|
||||||
|
use crate::structures::paging::PageTableIndex;
|
||||||
|
use crate::structures::paging::page_table::PageTableLevel;
|
||||||
|
|
||||||
/// Trait for abstracting over the three possible page sizes on x86_64, 4KiB, 2MiB, 1GiB.
|
/// Trait for abstracting over the three possible page sizes on x86_64, 4KiB, 2MiB, 1GiB.
|
||||||
pub trait PageSize: Copy + Eq + PartialOrd + Ord + Sealed {
|
pub trait PageSize: Copy + Eq + PartialOrd + Ord + Sealed {
|
||||||
|
@ -87,27 +87,31 @@ fn new_cc_build(build: &Build, target: TargetSelection) -> cc::Build {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn find(build: &Build) {
|
pub fn find(build: &Build) {
|
||||||
let targets: HashSet<_> = match build.config.cmd {
|
// Commit 94fbe141558b94fbe141558b is just wrong. This breaks fmt for mikros, so undo it.
|
||||||
// We don't need to check cross targets for these commands.
|
//let targets: HashSet<_> = match build.config.cmd {
|
||||||
crate::Subcommand::Clean { .. }
|
// // We don't need to check cross targets for these commands.
|
||||||
| crate::Subcommand::Suggest { .. }
|
// crate::Subcommand::Clean { .. }
|
||||||
| crate::Subcommand::Format { .. }
|
// | crate::Subcommand::Suggest { .. }
|
||||||
| crate::Subcommand::Setup { .. } => {
|
// | crate::Subcommand::Format { .. }
|
||||||
build.hosts.iter().cloned().chain(iter::once(build.build)).collect()
|
// | crate::Subcommand::Setup { .. } => {
|
||||||
}
|
// build.hosts.iter().cloned().chain(iter::once(build.build)).collect()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// _ => {
|
||||||
|
// // For all targets we're going to need a C compiler for building some shims
|
||||||
|
// // and such as well as for being a linker for Rust code.
|
||||||
|
// build
|
||||||
|
// .targets
|
||||||
|
// .iter()
|
||||||
|
// .chain(&build.hosts)
|
||||||
|
// .cloned()
|
||||||
|
// .chain(iter::once(build.build))
|
||||||
|
// .collect()
|
||||||
|
// }
|
||||||
|
//};
|
||||||
|
|
||||||
_ => {
|
let targets: HashSet<_> =
|
||||||
// For all targets we're going to need a C compiler for building some shims
|
build.targets.iter().chain(&build.hosts).cloned().chain(iter::once(build.build)).collect();
|
||||||
// and such as well as for being a linker for Rust code.
|
|
||||||
build
|
|
||||||
.targets
|
|
||||||
.iter()
|
|
||||||
.chain(&build.hosts)
|
|
||||||
.cloned()
|
|
||||||
.chain(iter::once(build.build))
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
for target in targets.into_iter() {
|
for target in targets.into_iter() {
|
||||||
find_target(build, target);
|
find_target(build, target);
|
||||||
|
Loading…
Reference in New Issue
Block a user