Closed Smertig closed 5 years ago
Change all the lines with: print("cmpl "); emit_kid(p,1,nt); print(", "); emit_kid(p,0,nt); print("\n"); To: print("movl "); emit_kid(p,0,nt); print(", %%eax\n"); print("cmpl "); emit_kid(p,1,nt); print(", %%eax\n");
jump+v does not work either as print("jmp "); emit_kid(p,0,nt); print("\n"); Should be: if (p->kids[0]->syms[0]) { print("jmp %s\n", p->kids[0]->syms[0]->x.name); } else { print("movl "); emit_kid(p,0,nt); print(", %%eax\n"); print("jmp *%%eax\n"); }
"cmpl (%s), 1\n" should be changed to "cmpl $1, (%s)\n" also in cc_branch. Almost certain this code was sketched out only and never tested...
Secondly, unfortunately the C libraries are precompiled when you build movfuscator. emit_start is called in each build, but the result discarded. The library version is what is used. But unfortunately that is using the mov_flow flag, the default. This is one way to do the job by changing default in c code, or much better is to change build.sh to pass --no-mov-flow to the libraries when they are precompiled. static int mov_flow= 0; Better approach in build.sh: "$BUILDDIR/movcc" movfuscator/crt.c -o "$BUILDDIR/crt.c" -c -Wf--crt -Wf--q -Wf--no-mov-flow where is 0, f and d.
After all of this, it works flawlessly though :). Hope the author will commit these changes. I can submit a pull request if need be.
Thanks for the fixes, I'll get this committed shortly. That flag worked at one point, but seems to have broken along the way.
Any chance this will get fixed at some point? Having the same problem still.
Fixed with 6342ae76b580c174eb35e612ec9fc0013be7859d. Thanks @GregoryMorse for the change suggestions.
Hello!
Option
--no-mov-flow
seems not to work. I got these output:To reproduce this bug, you can simply add
-Wf--no-mov-flow
at the end of 22nd line ofcheck.sh