#[non_exhaustive]pub enum Architecture {
X86_64,
Aarch64,
}Expand description
The instruction set an object is built for.
The architecture decides which relocation kinds an object may carry and the page size an executable is laid out with.
§Examples
use object_lang::Architecture;
assert_eq!(Architecture::X86_64.page_size(), 0x1000);
assert_eq!(Architecture::Aarch64.page_size(), 0x1_0000);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Implementations§
Source§impl Architecture
impl Architecture
Sourcepub const fn page_size(self) -> u64
pub const fn page_size(self) -> u64
The page size an executable for this architecture is laid out with: the boundary at which loadable segments start, and the alignment of each segment.
AArch64 kernels run with 4 KiB, 16 KiB, or 64 KiB pages, so AArch64 uses 64 KiB, which is correct on all three (and is what GNU ld and LLVM lld default to). x86-64 uses 4 KiB. A linker that places sections for an executable must start each change of permissions on a fresh page of this size.
§Examples
use object_lang::Architecture;
let page = Architecture::X86_64.page_size();
assert!(page.is_power_of_two());Trait Implementations§
Source§impl Clone for Architecture
impl Clone for Architecture
impl Copy for Architecture
Source§impl Debug for Architecture
impl Debug for Architecture
impl Eq for Architecture
Source§impl Hash for Architecture
impl Hash for Architecture
Source§impl PartialEq for Architecture
impl PartialEq for Architecture
impl StructuralPartialEq for Architecture
Auto Trait Implementations§
impl Freeze for Architecture
impl RefUnwindSafe for Architecture
impl Send for Architecture
impl Sync for Architecture
impl Unpin for Architecture
impl UnsafeUnpin for Architecture
impl UnwindSafe for Architecture
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more