tpoechtrager / wclang

Cross compile source code easily for Windows with clang on Linux/Unix

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot use flag -mllvm?

beraphin opened this issue · comments

I use o-llvm instead of llvm
when I input command like this:
x86_64-w64-mingw32-clang test2.c -o test.exe -mllvm -fla -v
I got error:
x86_64-w64-mingw32-gcc: error: unrecognized command line option ‘-mllvm’
x86_64-w64-mingw32-gcc: error: unrecognized command line option ‘-sub’

I think you the reason is this project is based on llvm
but I really need obfuscation function,
is there any way to fix this?

Please post the output of

x86_64-w64-mingw32-clang --version

and

x86_64-w64-mingw32-clang test2.c -o test.exe -mllvm -fla -v

@tpoechtrager
Thanks for reply

x86_64-w64-mingw32-clang --version
Obfuscator-LLVM clang version 3.6.1 (tags/RELEASE_361/final) (based on Obfuscator-LLVM 3.6.1)
Target: x86_64-w64-windows-gnu
Thread model: posix
x86_64-w64-mingw32-clang test2.c -o test.exe -mllvm -fla -v
Obfuscator-LLVM clang version 3.6.1 (tags/RELEASE_361/final) (based on Obfuscator-LLVM 3.6.1)
Target: x86_64-w64-windows-gnu
Thread model: posix
 "/home/zzx/ollvm/bin/clang-3.6" -cc1 -triple x86_64-w64-windows-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name test2.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -v -dwarf-column-info -nostdsysteminc -nobuiltininc -resource-dir /home/zzx/ollvm/bin/../lib/clang/3.6.1 -isystem /home/zzx/ollvm/bin/../lib/clang/3.6.1/include -isystem /usr/x86_64-w64-mingw32/include/../../../usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++ -isystem /usr/x86_64-w64-mingw32/include/../../../usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++/x86_64-w64-mingw32 -isystem /usr/x86_64-w64-mingw32/include -fdebug-compilation-dir /home/zzx/Desktop/Test -ferror-limit 19 -fmessage-length 80 -mstackrealign -fno-use-cxa-atexit -fobjc-runtime=gcc -fdiagnostics-show-option -mllvm -fla -o /tmp/test2-7d95d4.o -x c test2.c
clang -cc1 version 3.6.1 based upon Obfuscator-LLVM 3.6.1 default target x86_64-unknown-linux-gnu
#include "..." search starts here:
#include <...> search starts here:
 /home/zzx/ollvm/bin/../lib/clang/3.6.1/include
 /usr/x86_64-w64-mingw32/include/../../../usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++
 /usr/x86_64-w64-mingw32/include/../../../usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++/x86_64-w64-mingw32
 /usr/x86_64-w64-mingw32/include
End of search list.
 "/home/zzx/ollvm/bin/x86_64-w64-mingw32-gcc" -L/usr/lib/gcc/x86_64-w64-mingw32/5.3-win32 -nostdinc -nostdinc++ -fno-exceptions -isystem /home/zzx/ollvm/bin/../lib/clang/3.6.1/include -isystem /usr/x86_64-w64-mingw32/include/../../../usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++ -isystem /usr/x86_64-w64-mingw32/include/../../../usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++/x86_64-w64-mingw32 -isystem /usr/x86_64-w64-mingw32/include -mllvm -fla -v -m64 -o test.exe /tmp/test2-7d95d4.o
Using built-in specs.
COLLECT_GCC=/home/zzx/ollvm/bin/x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-w64-mingw32/5.3-win32/lto-wrapper
x86_64-w64-mingw32-gcc: error: unrecognized command line option ‘-mllvm’
x86_64-w64-mingw32-gcc: error: unrecognized command line option ‘-fla’
Target: x86_64-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' --mandir='/usr/share/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libexecdir='/usr/lib/gcc-mingw-w64' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-shared --enable-static --disable-multilib --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --libdir=/usr/lib --enable-libstdcxx-time=yes --with-tune=generic --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libgomp --enable-languages=c,c++,fortran,objc,obj-c++ --enable-lto --with-plugin-ld --enable-threads=win32 --program-suffix=-win32 --program-prefix=x86_64-w64-mingw32- --target=x86_64-w64-mingw32 --with-as=/usr/bin/x86_64-w64-mingw32-as --with-ld=/usr/bin/x86_64-w64-mingw32-ld --disable-libatomic
Thread model: win32
gcc version 5.3.1 20160211 (GCC) 
clang-3.6: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)

Try compiling and linking in two separate steps:

x86_64-w64-mingw32-clang test2.c -c -mllvm -fla -v
x86_64-w64-mingw32-clang test2.o -o test.exe

Clang 3.6 is still invoking GCC when linking.

Thank you very much
wclang is really amazing