Skip to content

Latest commit

 

History

History
76 lines (61 loc) · 5.01 KB

File metadata and controls

76 lines (61 loc) · 5.01 KB

Languages: English | 简体中文 | 繁體中文 | 日本語 | 한국어 | Français | Deutsch | Español | Italiano | Русский | العربية

← DynCode Compiler

DynCode Compiler — Progress Tracker

Stage 0 — macOS arm64 MVP (delivered)

  • Directory & CMake skeleton (nevercDynCode library)
  • ZeroRelocPass: two-phase (Prep + Stackify), automatic stack-ification of mutable globals
  • Data2TextPass: two-phase (constant arrays → stack chunk stores; post-SROA vector constant splitting; ConstantFP → volatile-loaded bit patterns)
  • SyscallStubPass: table-driven whitelist covering Darwin BSD / Linux arm64 / Linux x86_64 / Android syscalls
  • AllBlrPass: optional aggressive indirect call rewriting
  • DynCodeExtractor: Mach-O .o → flat .bin with intra-section relocation patching
  • CLI options via generated neverc/include/neverc/Invoke/Options.td.h (-fdyncode, -fdyncode-all-blr, -mdyncode-syscall, -fdyncode-keep-obj=, -fdyncode-entry=)
  • All-platform default PIC (isPICDefault() returns true universally)
  • Generic recursive stack-ification (function pointer tables, string pointer tables, nested struct tables, ConstantExpr GEP/BitCast initializers)
  • IndirectBrPass: GCC computed-goto (&&label) → switch, including multi-dispatch-site table sharing
  • SIMD vector constant inlining (inlineVectorConstants)
  • _Thread_local auto-demotion to static
  • Native macOS arm64 loader (MAP_JIT + i-cache flush)

Tests: 108/108 dyncode assertions passing. Binary sizes: add 8B, fib 64B, hello 64B, big_const 632B.

Stage 1 — Linux / Android / Windows cross-platform (delivered)

  • TargetDesc abstraction: table-driven platform differences
  • Cross-platform -mdyncode-syscall semantics (replaces Darwin-only -mdyncode-libsystem)
  • Linux / Android syscall number tables (Darwin BSD 100+, Linux arm64 130+, Linux x86_64 150+)
  • DynCodeExtractor refactored into MachOExtractor / ELFExtractor / COFFExtractor
  • ELF extractor (arm64: R_AARCH64_CALL26/JUMP26/ADR_PREL_PG_HI21/etc.; x86_64: R_X86_64_PC32/PLT32)
  • COFF extractor (arm64: IMAGE_REL_ARM64_BRANCH26/etc.; x86_64: IMAGE_REL_AMD64_REL32/etc.)
  • Windows PEB import pass (WinPEBImportPass) with real PEB walk resolver
  • Multi-DLL Win32 API whitelist (~210 APIs across kernel32/ntdll/user32/ws2_32/advapi32/shell32)
  • MemIntrinPass: memcpy/memset/memmove/memcmp/bcmp/bzero/memchr + strlen/strcpy/strcmp/etc. → inline byte-loop helpers
  • CompilerRtPass: __int128 division/modulo → inline long-division helpers
  • Windows aarch64-pc-windows-msvc frontend support
  • MIRPrepPass: cross-platform pseudo stripping (CFI/EH/XRay/StackMap/SEH/FENTRY/etc.)
  • MIR + byte-level obfuscation interposes (11 interposes across IR/MIR/byte-stream layers)
  • AArch64 non-Darwin long double auto-downgrade to binary64
  • DynCode shim headers: <windows.h>, <unistd.h>, <fcntl.h>, <sys/stat.h>, <sys/mman.h>, <string.h>, <stdlib.h>
  • Windows POSIX compatibility layer (13 POSIX→Win32 bridges: write→WriteFile, mmap→VirtualAlloc, etc.)
  • K&R implicit declaration auto-fix (50+ canonical POSIX signatures)
  • Table-driven purification (arch branch hardcoding → zero)
  • KernelImportPass: ring-0 automatic resolver-backed callsite rewriting
  • Kernel helper name table-driven diagnostics (KernelHelperNames.def)
  • <neverc/dyncode/kernel.h> for ring-0 entry conventions
  • Entry offset zero enforcement (placeEntryFirst)
  • Finalize pipeline: bad-byte rewriter SDK + charset encoder SDK + sizing constraints
  • Out-of-tree C Plugin API (NevercPluginAPI.h): 11 dyncode interpose points (NEVERC_INTERPOSE_SC_*)
  • x86_64 -mno-implicit-float injection (prevents backend SSE constant pool spills)
  • Cross-platform loaders (macOS/Linux/Windows)

Tests: 743+ dyncode assertions, all passing across 8 triples. Overall neverc suite: 1000+ tests passing.

Stage 2 — Printable / Alphanumeric Encoder (planned)

  • ARM64 printable dyncode encoder (0x20–0x7e instruction subset)
  • x86_64 alphanumeric encoder
  • Self-decoding stub (decoder stub) generation
  • Post-encoding size / entropy statistics

Stage 3 — Polymorphism / Self-Modifying (planned)

  • Polymorphic engine: same source → different equivalent byte sequences per compilation
  • Self-modifying code: runtime decryption / decompression of payload body
  • Anti-detection: avoid known dyncode signature patterns

Future Extensions

  • iOS arm64 (code signing + JIT jailbreak scenarios)
  • Cortex-M / Thumb
  • RISC-V 64