Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ bitflags = "2.9.0"
criterion = "0.8.2"
libloading = "0.9.0"
env_logger = "0.11.6"
gen-elf = "0.1.0"
gen-elf = { path = "tools/gen-elf" }
object = "0.38.1"

[[bench]]
Expand Down
24 changes: 22 additions & 2 deletions src/arch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
//! supported by the ELF loader, including relocation handlers, PLT entry definitions,
//! and instruction-specific fixups.
cfg_if::cfg_if! {
if #[cfg(target_arch = "x86_64")]{
if #[cfg(target_arch = "x86_64")] {
pub(crate) type StaticRelocator = X86_64Relocator;
}else {
} else if #[cfg(target_arch = "riscv64")] {
pub(crate) type StaticRelocator = Riscv64Relocator;
} else {
pub(crate) type StaticRelocator = DummyRelocator;
pub(crate) struct DummyRelocator;
pub(crate) const PLT_ENTRY_SIZE: usize = 16;
Expand All @@ -18,7 +20,25 @@ cfg_if::cfg_if! {
];

impl crate::relocation::StaticReloc for DummyRelocator {
fn new(_relocs: &[&'static [crate::elf::ElfRelType]]) -> Self {
Self
}

fn prepare<D, PreS, PostS, PreH, PostH>(
&mut self,
_relocs: &[&'static [crate::elf::ElfRelType]],
_helper: &crate::relocation::RelocHelper<'_, D, PreS, PostS, PreH, PostH>,
) where
PreS: crate::relocation::SymbolLookup + ?Sized,
PostS: crate::relocation::SymbolLookup + ?Sized,
PreH: crate::relocation::RelocationHandler + ?Sized,
PostH: crate::relocation::RelocationHandler + ?Sized,
{
// No preparation needed
}

fn relocate<D, PreS, PostS, PreH, PostH>(
&mut self,
_helper: &mut crate::relocation::RelocHelper<'_, D, PreS, PostS, PreH, PostH>,
_rel: &crate::elf::ElfRelType,
_pltgot: &mut crate::segment::section::PltGotSection,
Expand Down
Loading