mirror of
https://github.com/Noratrieb/elven-forest.git
synced 2026-01-14 10:45:03 +01:00
more things
This commit is contained in:
parent
f861e0511d
commit
d6daaea999
7 changed files with 114 additions and 24 deletions
|
|
@ -6,7 +6,7 @@ use clap::Parser;
|
|||
use elven_parser::{
|
||||
consts::{self as c, ShType, SHT_PROGBITS},
|
||||
read::{ElfIdent, ElfReader, Offset},
|
||||
write::{self, ElfWriter, Entry, Section},
|
||||
write::{self, ElfWriter, SectionRelativeAbsoluteAddr, Section},
|
||||
};
|
||||
use memmap2::Mmap;
|
||||
use std::{
|
||||
|
|
@ -60,7 +60,7 @@ pub fn run(opts: Opts) -> Result<()> {
|
|||
|
||||
let section = _start_sym.shndx;
|
||||
|
||||
let entry = Entry {
|
||||
let entry = SectionRelativeAbsoluteAddr {
|
||||
section,
|
||||
rel_offset: Offset(_start_sym.value.0),
|
||||
};
|
||||
|
|
@ -70,7 +70,7 @@ pub fn run(opts: Opts) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn write_output(text: &[u8], entry: Entry) -> Result<()> {
|
||||
fn write_output(text: &[u8], entry: SectionRelativeAbsoluteAddr) -> Result<()> {
|
||||
let ident = ElfIdent {
|
||||
magic: *c::ELFMAG,
|
||||
class: c::Class(c::ELFCLASS64),
|
||||
|
|
@ -83,7 +83,7 @@ fn write_output(text: &[u8], entry: Entry) -> Result<()> {
|
|||
|
||||
let header = write::Header {
|
||||
ident,
|
||||
r#type: c::Type(c::ET_DYN),
|
||||
r#type: c::Type(c::ET_EXEC),
|
||||
machine: c::Machine(c::EM_X86_64),
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue