diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f6df264..a0d2efb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -236,6 +236,7 @@ jobs: uses: dtolnay/rust-toolchain@nightly with: targets: wasm32-wasip2 + components: rust-src - name: Cache Rust workspace uses: Swatinem/rust-cache@v2 - name: Install dependencies diff --git a/objdiff-cli/Cargo.toml b/objdiff-cli/Cargo.toml index 6530ea7..268d1e9 100644 --- a/objdiff-cli/Cargo.toml +++ b/objdiff-cli/Cargo.toml @@ -18,7 +18,7 @@ argp = "0.4" crossterm = "0.28" enable-ansi-support = "0.2" 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" ratatui = "0.29" rayon = "1.10" diff --git a/objdiff-core/Cargo.toml b/objdiff-core/Cargo.toml index 20f52dd..56bad1d 100644 --- a/objdiff-core/Cargo.toml +++ b/objdiff-core/Cargo.toml @@ -26,7 +26,7 @@ all = [ "arm64", "mips", "ppc", - "x86", + # "x86", ] # Implicit, used to check if any arch is enabled any-arch = [ @@ -193,20 +193,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = { version = "1.0" } syn = { version = "2.0", optional = true } -# Enable all features for tests [dev-dependencies] -objdiff-core = { path = ".", features = [ - # Features - "bindings", - "build", - "config", - "dwarf", - "serde", - # Architectures - "mips", - "ppc", -# "x86", - "arm", - "arm64", -] } +# Enable all features for tests +objdiff-core = { path = ".", features = ["all"] } insta = "1.42.1" diff --git a/objdiff-core/src/arch/mips.rs b/objdiff-core/src/arch/mips.rs index bc128ca..ececeef 100644 --- a/objdiff-core/src/arch/mips.rs +++ b/objdiff-core/src/arch/mips.rs @@ -285,9 +285,7 @@ fn push_args( } else { arg_cb(InstructionPart::Arg(InstructionArg::Value( InstructionArgValue::Opaque( - op.display(instruction, display_flags, None::<&str>) - .to_string() - .into(), + op.display(instruction, display_flags, None::<&str>).to_string().into(), ), )))?; } diff --git a/objdiff-core/src/diff/data.rs b/objdiff-core/src/diff/data.rs index e56e75b..e260e79 100644 --- a/objdiff-core/src/diff/data.rs +++ b/objdiff-core/src/diff/data.rs @@ -107,11 +107,7 @@ fn diff_data_relocs_for_range<'left, 'right>( if reloc_eq(left_obj, right_obj, &left_reloc, &right_reloc) { diffs.push((DataDiffKind::None, Some(left_reloc), Some(right_reloc))); } else { - diffs.push(( - DataDiffKind::Replace, - Some(left_reloc), - Some(right_reloc), - )); + diffs.push((DataDiffKind::Replace, Some(left_reloc), Some(right_reloc))); } } for right_reloc in right_section.relocations.iter() { diff --git a/objdiff-core/tests/arch_x86.rs b/objdiff-core/tests/arch_x86.rs deleted file mode 100644 index 55605fb..0000000 --- a/objdiff-core/tests/arch_x86.rs +++ /dev/null @@ -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); -} diff --git a/objdiff-gui/Cargo.toml b/objdiff-gui/Cargo.toml index 28ee962..e2b9892 100644 --- a/objdiff-gui/Cargo.toml +++ b/objdiff-gui/Cargo.toml @@ -38,7 +38,7 @@ float-ord = "0.3" font-kit = "0.14" globset = { version = "0.4", features = ["serde1"] } 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" png = "0.17" pollster = "0.4" diff --git a/objdiff-wasm/package-lock.json b/objdiff-wasm/package-lock.json index fe515b3..b9a7741 100644 --- a/objdiff-wasm/package-lock.json +++ b/objdiff-wasm/package-lock.json @@ -1,16 +1,17 @@ { "name": "objdiff-wasm", - "version": "2.7.1", + "version": "3.0.0-alpha.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "objdiff-wasm", - "version": "2.7.1", + "version": "3.0.0-alpha.1", "license": "MIT OR Apache-2.0", "devDependencies": { "@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", "typescript": "^5.7.2" } @@ -180,33 +181,33 @@ } }, "node_modules/@bytecodealliance/componentize-js": { - "version": "0.15.1", - "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.15.1.tgz", - "integrity": "sha512-bTQT+uwWNeyFXRiV6cp+5ERUKC2g6lyiMoeMys2/yg8IcWPwq+3btV1Pj/q0ueAwyiIsuQ//c+peMHPrNTmHOg==", + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.17.0.tgz", + "integrity": "sha512-FDgO5UPipfjyq5OghSB4JW313LkQJK3Sl647WH1jvIuYAyCq1j+bMt+Q66c3UF6IVs6PneNTGfGSjYgzID/k0w==", "dev": true, "workspaces": [ "." ], "dependencies": { - "@bytecodealliance/jco": "^1.8.1", + "@bytecodealliance/jco": "^1.9.1", "@bytecodealliance/weval": "^0.3.3", "@bytecodealliance/wizer": "^7.0.5", - "es-module-lexer": "^1.5.4" + "es-module-lexer": "^1.6.0" } }, "node_modules/@bytecodealliance/jco": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.9.1.tgz", - "integrity": "sha512-Xmd1iw2OrWhlLOPZraFTBuE1AGfMSQVqKzswmq3k1vQ5B0EJe8O1CFG/UJeRXwbq1fxHHS9DTtlfAZiTeOdLWQ==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.10.1.tgz", + "integrity": "sha512-1HfO7HT+Rrvviv/l0CBm5O9/qtx3463W7ulZ+P7AV6icpHM97VeszQ1qbiegUxflT2GRXp4lVSaOaNGxoATQoQ==", "dev": true, "license": "(Apache-2.0 WITH LLVM-exception)", "workspaces": [ "packages/preview2-shim" ], "dependencies": { - "@bytecodealliance/componentize-js": "^0.15.0", - "@bytecodealliance/preview2-shim": "^0.17.1", - "binaryen": "^120.0.0", + "@bytecodealliance/componentize-js": "^0.17.0", + "@bytecodealliance/preview2-shim": "file:packages/preview2-shim", + "binaryen": "^122.0.0", "chalk-template": "^1", "commander": "^12", "mkdirp": "^3", @@ -217,6 +218,13 @@ "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": { "version": "0.17.1", "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.17.1.tgz", @@ -943,9 +951,9 @@ } }, "node_modules/@napi-rs/wasm-runtime": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.6.tgz", - "integrity": "sha512-z8YVS3XszxFTO73iwvFDNpQIzdMmSDTP/mB3E/ucR37V3Sx57hSExcXyMoNwaucWxnsWf4xfbZv0iZ30jr0M4Q==", + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.7.tgz", + "integrity": "sha512-5yximcFK5FNompXfJFoWanu5l8v1hNGqNHh9du1xETp9HWk/B/PzvchX55WYOPaIeNglG8++68AAiauBAtbnzw==", "dev": true, "license": "MIT", "optional": true, @@ -1436,9 +1444,9 @@ "license": "MIT" }, "node_modules/binaryen": { - "version": "120.0.0", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-120.0.0.tgz", - "integrity": "sha512-MaNC1qW5ubk5S7MNNxNpAb9ivKp6TAf8CDknRk4XeCC2wkrpdaubK10S1CAwUXaDDF54gZLtk6opzbEA9VTtJw==", + "version": "122.0.0", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-122.0.0.tgz", + "integrity": "sha512-XOvjvucq04e5UW0cuoiEZX4wxzepuF7q8sz24JtaXltqjgCqQOZHPXAq5ja/eLljF/orWYmaxuWivpp7paVUCQ==", "dev": true, "license": "Apache-2.0", "bin": { diff --git a/objdiff-wasm/package.json b/objdiff-wasm/package.json index 26b136a..a50ac35 100644 --- a/objdiff-wasm/package.json +++ b/objdiff-wasm/package.json @@ -18,12 +18,13 @@ "scripts": { "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: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" }, "devDependencies": { "@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", "typescript": "^5.7.2" }