/dsce

*uncaches your dyld*

Primary LanguageObjective-C

dsce

Incomplete macOS 12+ dyld cache extractor. Used by OCLP to support some legacy GPUs and Wi-Fi hardware. Produces working binaries in many cases, but outputs should be treated with extreme suspicion...

credits

status

  • copy header and load commands
    • allocate space for additional commands (temporarily disabled)
  • copy segments/sections, fixing offsets and alignment
    • optionally pad to keep addresses contiguous (produces 2+ GB images)
  • generate rebase opcodes
    • by applying cache rebase chain
  • generate bind opcodes
    • by scanning rebases for external pointers
      • matching imported dylib exports
      • recursing re-exported dylibs/symbols
    • by restoring uniqued __got section (Ventura)
    • using C++ addend hack
    • from weak/lazy bind info
  • generate exports trie
    • regular
    • re-export
    • stub and resolver
  • copy legacy symbols, indirect symbols, and string table
  • fix Objective-C structures
    • revert selector uniquing
    • revert protocol uniquing
    • fix class, category, and protocol method lists
    • create fake __objc_imageinfo (work around Ventura crash)
  • update UUIDs to D5CE<version>-... for visibility in logs (formerly 416D7900-...)
  • produce fully compliant images
    • satisfy install_name_tool -id test
    • satisfy codesign -fs -
    • satisfy dyld_info -objc
    • satisfy Stubber 2 (nm, Objective-C runtime, linker)
    • satisfy lldb
  • produce working images
    • 12.0 DP6 - GeForceAIRPlugin, GeForceMTLDriver
    • 12.0 DP6 - GeForceGLDriver
    • 12.6 - AppKit, QuartzCore, CoreGraphics, Carbon, RenderBox, VectorKit, Metal, MetalPerformanceShaders, MTLCompiler, GPUCompiler, AppleGVA, AppleGVACore
    • 12.6 - AMDMTLBronzeDriver, AMDShared, AMDRadeonVADriver, AMDRadeonVADriver2
    • 13.2.1 - AppKit, QuartzCore, CoreGraphics, Carbon, RenderBox, VectorKit, Metal, MetalPerformanceShaders, MTLCompiler, GPUCompiler
    • 13.2.1 - libSystem, Foundation, Combine, ContactsFoundation, FamilyCircle...
    • 14.0 DP6 - AppleIntelKBLGraphicsMTLDriver
    • 14.0 DP6 - AppKit, QuartzCore, Metal...
  • support Big Sur
  • support Monterey
  • support Ventura
  • support Sonoma
  • support arm64 (unlikely...)
  • use sane amounts of RAM and CPU (getting closer...)
  • write automated tests to detect regressions