UPX NotCompressibleException

I recently studied a little bit about executable file compression. When compiling a test.c C language test.c and compress it using UPX on Linux, not windows. This is the list in the terminal: UPX: test.so NotCompressibleException . test.c Source test.c :

 int main(){ int i = 0; printf("HelloWorld\n"); return 0; } 

What do I guess that the executable is too simple to compress? Or maybe I missed something? If anyone knows about this problem, let me know the reason. If no one tells me that I have to read the source code to find out the problem. Oh! reading source code.

+4
source share
1 answer

There are several reasons for NotCompressibleException , but in your case it is simply because the size of your binary is too small. UPX cannot process binary files under 40 KB.

The best way to work around this problem is to build your binary in static mode to get a larger executable. So just try: gcc -static -o mytest mytest.c and then upx -o mytest-upx mytest .

+6
source

Source: https://habr.com/ru/post/1435753/


All Articles