Various fixes

This commit is contained in:
Luke Street 2025-02-26 22:47:42 -07:00
parent f3c157ff06
commit 506c251d68
9 changed files with 39 additions and 65 deletions

View File

@ -236,6 +236,7 @@ jobs:
uses: dtolnay/rust-toolchain@nightly uses: dtolnay/rust-toolchain@nightly
with: with:
targets: wasm32-wasip2 targets: wasm32-wasip2
components: rust-src
- name: Cache Rust workspace - name: Cache Rust workspace
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
- name: Install dependencies - name: Install dependencies

View File

@ -18,7 +18,7 @@ argp = "0.4"
crossterm = "0.28" crossterm = "0.28"
enable-ansi-support = "0.2" enable-ansi-support = "0.2"
memmap2 = "0.9" memmap2 = "0.9"
objdiff-core = { path = "../objdiff-core", features = ["ppc", "std", "config", "dwarf", "bindings", "serde"] } objdiff-core = { path = "../objdiff-core", features = ["all"] }
prost = "0.13" prost = "0.13"
ratatui = "0.29" ratatui = "0.29"
rayon = "1.10" rayon = "1.10"

View File

@ -26,7 +26,7 @@ all = [
"arm64", "arm64",
"mips", "mips",
"ppc", "ppc",
"x86", # "x86",
] ]
# Implicit, used to check if any arch is enabled # Implicit, used to check if any arch is enabled
any-arch = [ any-arch = [
@ -193,20 +193,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" } serde_json = { version = "1.0" }
syn = { version = "2.0", optional = true } syn = { version = "2.0", optional = true }
# Enable all features for tests
[dev-dependencies] [dev-dependencies]
objdiff-core = { path = ".", features = [ # Enable all features for tests
# Features objdiff-core = { path = ".", features = ["all"] }
"bindings",
"build",
"config",
"dwarf",
"serde",
# Architectures
"mips",
"ppc",
# "x86",
"arm",
"arm64",
] }
insta = "1.42.1" insta = "1.42.1"

View File

@ -285,9 +285,7 @@ fn push_args(
} else { } else {
arg_cb(InstructionPart::Arg(InstructionArg::Value( arg_cb(InstructionPart::Arg(InstructionArg::Value(
InstructionArgValue::Opaque( InstructionArgValue::Opaque(
op.display(instruction, display_flags, None::<&str>) op.display(instruction, display_flags, None::<&str>).to_string().into(),
.to_string()
.into(),
), ),
)))?; )))?;
} }

View File

@ -107,11 +107,7 @@ fn diff_data_relocs_for_range<'left, 'right>(
if reloc_eq(left_obj, right_obj, &left_reloc, &right_reloc) { if reloc_eq(left_obj, right_obj, &left_reloc, &right_reloc) {
diffs.push((DataDiffKind::None, Some(left_reloc), Some(right_reloc))); diffs.push((DataDiffKind::None, Some(left_reloc), Some(right_reloc)));
} else { } else {
diffs.push(( diffs.push((DataDiffKind::Replace, Some(left_reloc), Some(right_reloc)));
DataDiffKind::Replace,
Some(left_reloc),
Some(right_reloc),
));
} }
} }
for right_reloc in right_section.relocations.iter() { for right_reloc in right_section.relocations.iter() {

View File

@ -1,17 +0,0 @@
use objdiff_core::{diff, obj};
mod common;
#[test]
#[cfg(feature = "x86")]
fn read_x86() {
let diff_config = diff::DiffObjConfig::default();
let obj = obj::read::parse(include_object!("data/x86/rtest.obj"), &diff_config).unwrap();
insta::assert_debug_snapshot!(obj);
let symbol_idx =
obj.symbols.iter().position(|s| s.name == "Type2Text__10SObjectTagFUi").unwrap();
let diff = diff::code::no_diff_code(&obj, symbol_idx, &diff_config).unwrap();
insta::assert_debug_snapshot!(diff.instruction_rows);
let output = common::display_diff(&obj, &diff, symbol_idx, &diff_config);
insta::assert_snapshot!(output);
}

View File

@ -38,7 +38,7 @@ float-ord = "0.3"
font-kit = "0.14" font-kit = "0.14"
globset = { version = "0.4", features = ["serde1"] } globset = { version = "0.4", features = ["serde1"] }
log = "0.4" log = "0.4"
objdiff-core = { path = "../objdiff-core", features = ["ppc", "arm", "arm64", "mips", "std", "config", "dwarf", "bindings", "serde", "build"] } objdiff-core = { path = "../objdiff-core", features = ["all"] }
open = "5.3" open = "5.3"
png = "0.17" png = "0.17"
pollster = "0.4" pollster = "0.4"

View File

@ -1,16 +1,17 @@
{ {
"name": "objdiff-wasm", "name": "objdiff-wasm",
"version": "2.7.1", "version": "3.0.0-alpha.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "objdiff-wasm", "name": "objdiff-wasm",
"version": "2.7.1", "version": "3.0.0-alpha.1",
"license": "MIT OR Apache-2.0", "license": "MIT OR Apache-2.0",
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^1.9.3", "@biomejs/biome": "^1.9.3",
"@bytecodealliance/jco": "^1.9.1", "@bytecodealliance/jco": "^1.10.1",
"@bytecodealliance/preview2-shim": "^0.17.1",
"@rslib/core": "^0.4.1", "@rslib/core": "^0.4.1",
"typescript": "^5.7.2" "typescript": "^5.7.2"
} }
@ -180,33 +181,33 @@
} }
}, },
"node_modules/@bytecodealliance/componentize-js": { "node_modules/@bytecodealliance/componentize-js": {
"version": "0.15.1", "version": "0.17.0",
"resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.15.1.tgz", "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.17.0.tgz",
"integrity": "sha512-bTQT+uwWNeyFXRiV6cp+5ERUKC2g6lyiMoeMys2/yg8IcWPwq+3btV1Pj/q0ueAwyiIsuQ//c+peMHPrNTmHOg==", "integrity": "sha512-FDgO5UPipfjyq5OghSB4JW313LkQJK3Sl647WH1jvIuYAyCq1j+bMt+Q66c3UF6IVs6PneNTGfGSjYgzID/k0w==",
"dev": true, "dev": true,
"workspaces": [ "workspaces": [
"." "."
], ],
"dependencies": { "dependencies": {
"@bytecodealliance/jco": "^1.8.1", "@bytecodealliance/jco": "^1.9.1",
"@bytecodealliance/weval": "^0.3.3", "@bytecodealliance/weval": "^0.3.3",
"@bytecodealliance/wizer": "^7.0.5", "@bytecodealliance/wizer": "^7.0.5",
"es-module-lexer": "^1.5.4" "es-module-lexer": "^1.6.0"
} }
}, },
"node_modules/@bytecodealliance/jco": { "node_modules/@bytecodealliance/jco": {
"version": "1.9.1", "version": "1.10.1",
"resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.9.1.tgz", "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.10.1.tgz",
"integrity": "sha512-Xmd1iw2OrWhlLOPZraFTBuE1AGfMSQVqKzswmq3k1vQ5B0EJe8O1CFG/UJeRXwbq1fxHHS9DTtlfAZiTeOdLWQ==", "integrity": "sha512-1HfO7HT+Rrvviv/l0CBm5O9/qtx3463W7ulZ+P7AV6icpHM97VeszQ1qbiegUxflT2GRXp4lVSaOaNGxoATQoQ==",
"dev": true, "dev": true,
"license": "(Apache-2.0 WITH LLVM-exception)", "license": "(Apache-2.0 WITH LLVM-exception)",
"workspaces": [ "workspaces": [
"packages/preview2-shim" "packages/preview2-shim"
], ],
"dependencies": { "dependencies": {
"@bytecodealliance/componentize-js": "^0.15.0", "@bytecodealliance/componentize-js": "^0.17.0",
"@bytecodealliance/preview2-shim": "^0.17.1", "@bytecodealliance/preview2-shim": "file:packages/preview2-shim",
"binaryen": "^120.0.0", "binaryen": "^122.0.0",
"chalk-template": "^1", "chalk-template": "^1",
"commander": "^12", "commander": "^12",
"mkdirp": "^3", "mkdirp": "^3",
@ -217,6 +218,13 @@
"jco": "src/jco.js" "jco": "src/jco.js"
} }
}, },
"node_modules/@bytecodealliance/jco/node_modules/@bytecodealliance/preview2-shim": {
"resolved": "node_modules/@bytecodealliance/jco/packages/preview2-shim",
"link": true
},
"node_modules/@bytecodealliance/jco/packages/preview2-shim": {
"dev": true
},
"node_modules/@bytecodealliance/preview2-shim": { "node_modules/@bytecodealliance/preview2-shim": {
"version": "0.17.1", "version": "0.17.1",
"resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.17.1.tgz", "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.17.1.tgz",
@ -943,9 +951,9 @@
} }
}, },
"node_modules/@napi-rs/wasm-runtime": { "node_modules/@napi-rs/wasm-runtime": {
"version": "0.2.6", "version": "0.2.7",
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.6.tgz", "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.7.tgz",
"integrity": "sha512-z8YVS3XszxFTO73iwvFDNpQIzdMmSDTP/mB3E/ucR37V3Sx57hSExcXyMoNwaucWxnsWf4xfbZv0iZ30jr0M4Q==", "integrity": "sha512-5yximcFK5FNompXfJFoWanu5l8v1hNGqNHh9du1xETp9HWk/B/PzvchX55WYOPaIeNglG8++68AAiauBAtbnzw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
@ -1436,9 +1444,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/binaryen": { "node_modules/binaryen": {
"version": "120.0.0", "version": "122.0.0",
"resolved": "https://registry.npmjs.org/binaryen/-/binaryen-120.0.0.tgz", "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-122.0.0.tgz",
"integrity": "sha512-MaNC1qW5ubk5S7MNNxNpAb9ivKp6TAf8CDknRk4XeCC2wkrpdaubK10S1CAwUXaDDF54gZLtk6opzbEA9VTtJw==", "integrity": "sha512-XOvjvucq04e5UW0cuoiEZX4wxzepuF7q8sz24JtaXltqjgCqQOZHPXAq5ja/eLljF/orWYmaxuWivpp7paVUCQ==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {

View File

@ -18,12 +18,13 @@
"scripts": { "scripts": {
"build": "npm run build:wasm && npm run build:transpile && npm run build:lib", "build": "npm run build:wasm && npm run build:transpile && npm run build:lib",
"build:wasm": "cargo +nightly -Zbuild-std=panic_abort,core,alloc -Zbuild-std-features=compiler-builtins-mem build --target wasm32-wasip2 --release --no-default-features", "build:wasm": "cargo +nightly -Zbuild-std=panic_abort,core,alloc -Zbuild-std-features=compiler-builtins-mem build --target wasm32-wasip2 --release --no-default-features",
"build:transpile": "jco transpile ../target/wasm32-wasip2/release/objdiff_wasm.wasm --no-nodejs-compat --no-wasi-shim --no-namespaced-exports --map wasi:logging/logging=./wasi-logging.js -o pkg --name objdiff", "build:transpile": "jco transpile ../target/wasm32-wasip2/release/objdiff_wasm.wasm --no-nodejs-compat --no-wasi-shim --no-namespaced-exports --map wasi:logging/logging=./wasi-logging.js --optimize -o pkg --name objdiff",
"build:lib": "rslib build" "build:lib": "rslib build"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^1.9.3", "@biomejs/biome": "^1.9.3",
"@bytecodealliance/jco": "^1.9.1", "@bytecodealliance/jco": "^1.10.1",
"@bytecodealliance/preview2-shim": "^0.17.1",
"@rslib/core": "^0.4.1", "@rslib/core": "^0.4.1",
"typescript": "^5.7.2" "typescript": "^5.7.2"
} }