Open iraizo opened 2 years ago
You have some unrelated errors, like unknown argument strip-all
. And you are not using the obfuscator-llvm as a plugin, but implemented these changes directly into the llvm source.
how am i not using it as a plugin? im literally loading the library into clang when compiling the test to obfuscated ll
I'm a bit confused. I don't see the .so
plugin library being loaded into clang in your command. Do you use it on MacOS?
Yes i do since i cannot use it via docker. I modified the command right here https://github.com/MaxXor/obfuscator-llvm/blob/master/test.sh#L21, which is the last step im stuck on, everything else compiles fine and also works the ll seems to be fine, but compiling it to the binary is the problem
clang-13: error: linker command failed due to signal (use -v to see invocation)
Can you run it again with the -v
flag?
➜ test git:(master) ✗ sudo /opt/homebrew/opt/llvm/bin/clang -v -fuse-ld=lld -flto=full -O3 -Wl,-strip-all -o test test_obfuscated.ll
Homebrew clang version 13.0.1
Target: arm64-apple-darwin21.2.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin
"/opt/homebrew/Cellar/llvm/13.0.1/bin/clang-13" -cc1 -triple arm64-apple-macosx12.0.0 -Wundef-prefix=TARGET_OS_ -Werror=undef-prefix -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-llvm-bc -flto=full -flto-unit -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test_obfuscated.ll -mrelocation-model pic -pic-level 2 -mframe-pointer=non-leaf -fno-rounding-math -munwind-tables -fcompatibility-qualified-id-block-type-checking -fvisibility-inlines-hidden-static-local-var -target-cpu apple-m1 -target-feature +v8.5a -target-feature +fp-armv8 -target-feature +neon -target-feature +crc -target-feature +crypto -target-feature +dotprod -target-feature +fp16fml -target-feature +ras -target-feature +lse -target-feature +rdm -target-feature +rcpc -target-feature +zcm -target-feature +zcz -target-feature +fullfp16 -target-feature +sha2 -target-feature +aes -target-abi darwinpcs -fallow-half-arguments-and-returns -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=lldb -target-linker-version 711 -v -fcoverage-compilation-dir=/Users/raizo/Desktop/obfuscator-llvm/test -resource-dir /opt/homebrew/Cellar/llvm/13.0.1/lib/clang/13.0.1 -O3 -fdebug-compilation-dir=/Users/raizo/Desktop/obfuscator-llvm/test -ferror-limit 19 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fmax-type-align=16 -fcolor-diagnostics -vectorize-loops -vectorize-slp -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/test_obfuscated-20ff7a.o -x ir test_obfuscated.ll
clang -cc1 version 13.0.1 based upon LLVM 13.0.1 default target arm64-apple-darwin21.2.0
"/opt/homebrew/opt/llvm/bin/ld64.lld" -demangle -object_path_lto /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/cc-ad9517.o -dynamic -arch arm64 -platform_version macos 12.0.0 12.0.0 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -o test -strip-all /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/test_obfuscated-20ff7a.o -lSystem /opt/homebrew/Cellar/llvm/13.0.1/lib/clang/13.0.1/lib/darwin/libclang_rt.osx.a
ld64.lld: error: unknown argument '-strip-all'
ld64.lld: error: cannot create /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/cc-ad9517.o/0.arm64.lto.o: Not a directory
LLVM ERROR: IO failure on output stream: Bad file descriptor
PLEASE submit a bug report to https://github.com/Homebrew/homebrew-core/issues and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/homebrew/opt/llvm/bin/ld64.lld -demangle -object_path_lto /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/cc-ad9517.o -dynamic -arch arm64 -platform_version macos 12.0.0 12.0.0 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -o test -strip-all /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/test_obfuscated-20ff7a.o -lSystem /opt/homebrew/Cellar/llvm/13.0.1/lib/clang/13.0.1/lib/darwin/libclang_rt.osx.a
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 libLLVM.dylib 0x000000010adf9774 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 libLLVM.dylib 0x000000010adf9d48 SignalHandler(int) + 324
2 libsystem_platform.dylib 0x00000001867d44e4 _sigtramp + 56
3 libsystem_pthread.dylib 0x00000001867bceb0 pthread_kill + 288
4 libsystem_c.dylib 0x00000001866fa314 abort + 164
5 libLLVM.dylib 0x000000010ad53624 llvm::report_fatal_error(llvm::Twine const&, bool) + 256
6 libLLVM.dylib 0x000000010d584e7c llvm::report_fatal_error(llvm::StringRef, bool) + 0
7 libLLVM.dylib 0x000000010addcff0 llvm::raw_fd_ostream::~raw_fd_ostream() + 232
8 lld 0x000000010443be30 lld::saveBuffer(llvm::StringRef, llvm::Twine const&) + 500
9 lld 0x00000001046d809c lld::macho::BitcodeCompiler::compile() + 1240
10 lld 0x00000001046b2a58 lld::macho::link(llvm::ArrayRef<char const*>, bool, llvm::raw_ostream&, llvm::raw_ostream&) + 16984
11 lld 0x000000010442a9b8 lldMain(int, char const**, llvm::raw_ostream&, llvm::raw_ostream&, bool) + 1128
12 lld 0x000000010442a3e4 main + 212
13 dyld 0x0000000104ce90f4 start + 520
clang-13: error: unable to execute command: Abort trap: 6
clang-13: error: linker command failed due to signal (use -v to see invocation)
Does compiling a sample project work without the obfuscator-llvm plugin?
compiling it with llc to LLVM IR, then use llc to compile it to an object file, using clang to build it as a executeable works fine. same as going straight from .c executeable with clang
Compiling this project works fine with some tweaks to it, the problem is compiling the obfuscated IL to maschine code.