xoreaxeaxeax / movfuscator

The single instruction C compiler
Other
9.29k stars 394 forks source link

Cannot run movcc compiled files #26

Closed hrkrx closed 2 years ago

hrkrx commented 6 years ago

i managed to compile a simple HelloWorld program with movcc.

#include <stdio.h>

int main()
{
    printf("Hello World");
    return 0;
}

when i compile it with gcc it just works, but when using movcc i get the following error:

bash: ./program: cannot execute binary file: Exec format error

i checked the format of both files, which are indeed different:

gcc produces an elf64-x86-64 binary

movcc produces an elf32-i386 binary

i tried to pass "-m elf_x86_64" with -Wl but then i get another error:

/usr/bin/ld: Incompatible /mnt/d/TMP/C/git/movfuscator/build//gcc/32/libgcc.a skipped search of -lgcc

What am i doing wrong?

Alexeyan commented 6 years ago

movcc only compiles to 32 bit elfs. You seem to have a 64 bit host. In order to run the produced file you need to fix some things. Look here for further information.

https://askubuntu.com/questions/454253/how-to-run-32-bit-app-in-ubuntu-64-bit

fionafibration commented 5 years ago

This does not fix the issue for me, could it be that MOVfuscator is attempting to link to 64-bit shared libraries? @xoreaxeaxeax should take a look at this.

fionafibration commented 5 years ago

Ah, I have discovered the cause of my issue. Windows Subsystem for Linux only allows emulation of 64-bit ELFs for the kernel, not 32-bits. Apparently 32-bit support is not planned. After patching the fixes in #31 and moving to a Kali Linux computer, movcc compiles C files properly.