obfus.h icon indicating copy to clipboard operation
obfus.h copied to clipboard

Add GCC-Compatible Version (obfus-gcc.h)

Open CyberForgeEx opened this issue 2 months ago • 2 comments

Summary

This PR introduces obfus-gcc.h, a GCC/MinGW-optimized version of the obfuscation library that addresses compatibility issues while maintaining the core protection features.

Motivation

The original obfus.h works with TinyC but encounters issues with GCC/MinGW due to:

  • Complex section attribute usage.
  • Dynamic library loading mechanisms.
  • Some inline assembly patterns.
  • Pointer arithmetic in certain macros.

Changes Made

New File: obfus-gcc.h

  • Simplified Section Attributes: Removed problematic custom sections that caused linker issues.
  • Portable Inline Assembly: Uses Intel syntax with proper GCC constraints.
  • Streamlined Library Loading: Direct function calls instead of complex dynamic resolution.
  • Fixed Macro Issues: Corrected pointer arithmetic warnings in RET_BY_VAR.
  • Comprehensive Wrappers: All standard library functions properly wrapped.

Testing

Tested successfully on:

  • Windows 10/11 with MinGW-w64 GCC 11.2.0

Compilation


# With features
gcc -O2 -masm=intel -DVIRT=1 -DCFLOW_V2=1 -DANTIDEBUG_V2=1 your_file.c -o output.exe -w

CyberForgeEx avatar Nov 05 '25 08:11 CyberForgeEx

Hello, @CyberForgeEx! Thank you for your version of obfus.h. I'll definitely publish it in a separate directory dedicated to experiments after the PR is accepted. For now, I'll leave it under review.

DosX-dev avatar Nov 08 '25 11:11 DosX-dev

Thanks for the feedback! I'm glad you found it interesting to include. I'm completely fine with it going into an experiments directory. Out of curiosity, is the goal to eventually refine this approach for the main codebase, or is it purely for reference? I'd be happy to iterate on it if there's a specific direction you have in mind.

CyberForgeEx avatar Nov 08 '25 15:11 CyberForgeEx