Initial x86 support

Includes a bit of work to make adding new
architectures easier in the future
This commit is contained in:
2024-03-16 23:30:27 -06:00
parent aecb078b2a
commit bbe49eb8b4
17 changed files with 844 additions and 289 deletions

View File

@@ -9,16 +9,19 @@ use crate::{
code::{diff_code, find_section_and_symbol, no_diff_code},
data::{diff_bss_symbols, diff_data, no_diff_data},
},
obj::{ObjInfo, ObjIns, ObjSectionKind},
obj::{x86::X86Formatter, ObjInfo, ObjIns, ObjSectionKind},
};
#[derive(Debug, Clone, Default, Eq, PartialEq)]
#[derive(Debug, Clone, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default)]
pub struct DiffObjConfig {
pub relax_reloc_diffs: bool,
pub space_between_args: bool,
pub x86_formatter: X86Formatter,
}
pub struct ProcessCodeResult {
pub ops: Vec<u8>,
pub ops: Vec<u16>,
pub insts: Vec<ObjIns>,
}
@@ -54,6 +57,7 @@ pub fn diff_objs(
)?;
} else {
no_diff_code(
config,
left.architecture,
&left_section.data,
left_symbol,
@@ -82,6 +86,7 @@ pub fn diff_objs(
for right_symbol in &mut right_section.symbols {
if right_symbol.instructions.is_empty() {
no_diff_code(
config,
right.architecture,
&right_section.data,
right_symbol,