Skip to content

SCC: fix aggregate lvalues, PPC socketcalls, concat, and target selection - #12

Open
plafosse wants to merge 7 commits into
masterfrom
test_various_scc_fixes
Open

SCC: fix aggregate lvalues, PPC socketcalls, concat, and target selection#12
plafosse wants to merge 7 commits into
masterfrom
test_various_scc_fixes

Conversation

@plafosse

Copy link
Copy Markdown
Member

Summary

This PR addresses the currently open Binary Ninja issues labeled Component: SCC, with implementation changes, documentation updates, and regression coverage. The changes are split into issue-focused commits, followed by one shared test-suite commit.

Issues fixed

  • Fixes scc unions in structs binaryninja-api#563Nested unions and aggregate lvalues. SCC now recursively computes addresses through nested structs, unions, pointers, dereferences, and array indexes. This fixes reads, writes, address-taking, and pre/post increment or decrement while evaluating side-effecting bases and indexes only once.

  • Fixes Powerpc socketcall is not setup properly binaryninja-api#628PowerPC socket calls. Linux/PPC networking wrappers now use the legacy socketcall ABI, placing syscall 102 in r0, the operation in r3, and a pointer to packed arguments in r4. Regression tests validate all 16 wrappers on both ppc and ppcel.

  • Fixes SCC Documentation Fixes binaryninja-api#1422SCC help and documentation. Unsupported options and the unimplemented __initial_<reg> helper are no longer advertised, while the stale claim that byte blacklisting is unimplemented has been removed. The Python wrapper and docs now use --markov-chain-file correctly and describe the supported architectures and retained compatibility parameters accurately.

  • Fixes SCC: jump to end of buffer option emits syscall(exit) binaryninja-api#1423Concatenation control flow. --concat now transfers control to the byte after the generated output instead of calling exit, including when global initialization creates branching control flow. Exact-length and aligned padding now participate in linker layout until relocations and __end converge on the real output boundary.

  • Fixes SCC: Predefined API on Windows x86_64 target broken binaryninja-api#2181Windows x64 predefined APIs. The MessageBox example now uses SCC's runtime-provided declaration instead of introducing a conflicting manual import declaration. Regression coverage verifies both direct use of predefined Windows APIs and compatible redeclarations on the x64 Windows target.

  • Closes invalid handling address math in long mode binaryninja-api#2391Full-width x64 address calculations. The current backend already emits correct 64-bit frame setup and address calculations, so no implementation change was required. Raw-binary and ELF PIE regressions now require the appropriate REX.W encodings and verify RIP-relative global targets, preventing the reported truncation from returning.

  • Fixes scc defaults to 32-bit shellcode without warning, causing unexpected behavior binaryninja-api#6577Implicit target architecture. Normal compilation now warns when it defaults to 32-bit x86, while --exec selects and reports the native x86/x64 target or fails clearly on unsupported hosts. Invalid explicit architectures fail immediately, and late --arch, -m32, or -m64 options retain precedence regardless of argument order.

Tests

  • Added CTest suites for CLI behavior, x64 regressions, and PowerPC socket calls.
  • Coverage includes concat control flow and padding, help and Python-wrapper arguments, architecture diagnostics, nested aggregate lvalues, Windows imports, raw and ELF PIE x64 addressing, and all 16 socket wrappers on ppc and ppcel.
  • ctest --test-dir <build-dir> --output-on-failure — 3/3 tests passed.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@plafosse
plafosse marked this pull request as ready for review August 21, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants