Coder Social home page Coder Social logo

hanabi's Introduction

花火

Hassle-free Obfuscator-Enabled Apple Clang without any sort of compromise.

License

Please refer to License.

Note that this linked version of license text overrides any artifact left in source code

Must be this tall to ride

Due to its hackish nature (Which is why I don't want to do this in the first place), you should probably know some LLVM/macOS Hooking/Binary Patching and stuff to debug this thing

Using Release Builds

  • Extract the zipped file and move two extracted dylibs under /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
  • Download libsubstitute.dylib and move it to /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
  • See Patching. Ignore library not found in that release version

Building

  • $(LLVM_SOURCE_PATH) The path that stored Hikari's main repo with submodules properly fetched. It's suggested to use a Hikari branch that matches your Apple Clang's LLVM version. See Release Versioning Scheme to see how to find the LLVM version of your Clang
  • ${LLVM_BUILD_PATH} The path you prepare to build in. Note that you need a seperate folder and must not reuse existing build for upstream Hikari

Obtaining Source

  • git clone https://github.com/HikariObfuscator/Hanabi.git $(LLVM_SOURCE_PATH)/projects/
  • Under $(LLVM_SOURCE_PATH), run git submodule update --init --recursive --remote to make sure submodules are fully updated

Build

  • cmake $(LLVM_SOURCE_PATH) -DCMAKE_BUILD_TYPE=Release -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF -G Ninja
  • ninja LLVMHanabi
  • Copy $(LLVM_BUILD_PATH)/lib/libLLVMHanabiDeps.dylib to /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/
  • Copy $(LLVM_BUILD_PATH)/lib/libLLVMHanabi.dylib to /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/
  • Copy $(LLVM_SOURCE_PATH)/projects/Hanabi/libsubstitute.dylib to /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/

Patching

You need to build https://github.com/alexzielenski/optool and put it in your $PATH, then you need to patch two libraries into Clang/SwiftC. !!!ORDER IS VERY IMPORTANT!!!

  • sudo optool install -c load -p @executable_path/libLLVMHanabiDeps.dylib -t /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
  • sudo optool install -c load -p @executable_path/libLLVMHanabi.dylib -t /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang

Known Issues

  • LLVM 6.0.1 (which Xcode 10.1 and before is using) has bugs related to indirectbr CodeGeneration, you might get a crash if you enable INDIBRAN. Try updating your Xcode version

How it works

  • Strictly speaking, many changes are done to the Hikari Core to reduce LLVM library dependencies.
  • Loader's linking options is modified to link to no LLVM library and fully resolve them at runtime in a flat namespace, this loader is also known as libLLVMHanabi.dylib
  • Then, we ship a custom mimimal subset of LLVM Core Libraries which serves as the fallback plan for symbols that are not exported in Apple's binaries, this is known as libLLVMHanabiDeps.dylib.
  • By not linking the full LLVM suite, we are allowed to reduce build time and more importantly, allows us to pass arguments like we normally would. (-mllvm)

Release Versioning Scheme

The releases has a versioning scheme like 6.0@9ab263@LoaderV3 where the first part represents LLVM base version, the second represents Hikari Core's git commit hash and the third one represents the Loader implementation version. In this case, it means the release is tested to work on a Xcode version that uses LLVM6.0. You can refer to Toolchain version history in Xcode - Wikipedia and uses the LLVM column to find the matching Xcode version, which is this case is Xcode 10.0 and Xcode 10.1. This release uses Core at 9ab263 and V3 of the loader

Credits

  • Thanks to @AloneMonkey for compiling substitute and ship it with his amazing project MonkeyDev
  • Thanks to @UESTC-LXY for testing and discussion because I didn't bother to do so.
  • Thanks to@qokelate for initially discovering the broken CMake script and testing the new fix as well as suggestions to this README

hanabi's People

Contributors

naville avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hanabi's Issues

怎么购买私人版的Hikari

你好,问一下现在还卖私人版Hikari吗,仅仅用于对自己的项目进行保护,不知道该如何联系您

Segmentation fault 11

Xcode 11.0 segmentation fault 11 and Xcode 12.0 abort trap 6 substrate tweak

`Applying Apple Clang Hooks...
Applying Apple Clang Hooks...
std::mt19937_64 seeded with current timestamp: 1601527054986
Initializing Hikari Core with Revision ID:1b02aa842d7c940ddb407569341824788653c263
Loading Symbol Configuration From:/Users/colecabral/Hikari/SymbolConfig.json
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: arm64e-apple-ios10.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to http://developer.apple.com/bugreporter/ and include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /var/folders/m9/73b1ft490z558l047mjbzwj80000gn/T/Tweak-d08d8d.mm
clang: note: diagnostic msg: /var/folders/m9/73b1ft490z558l047mjbzwj80000gn/T/Tweak-d08d8d.cache
clang: note: diagnostic msg: /var/folders/m9/73b1ft490z558l047mjbzwj80000gn/T/Tweak-d08d8d.sh
clang: note: diagnostic msg: /var/folders/m9/73b1ft490z558l047mjbzwj80000gn/T/Tweak-d08d8d.crash
clang: note: diagnostic msg:`

crash in XCode Version 12.5 (12E262)

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefaultHanabi.xctoolchain/usr/bin/clang \
-x objective-c -target arm64-apple-ios10.0 -fmessage-length\=0 -fdiagnostics-show-note-include-stack \
-fmacro-backtrace-limit\=0 -std\=gnu11 -fobjc-arc -fobjc-weak -fmodules \
-fmodules-cache-path\=/Users/reblaze/Library/Developer/Xcode/DerivedData/ModuleCache.noindex \
-fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 \
-fbuild-session-file\=/Users/reblaze/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation \
-fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module \
-Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -Os -fno-common \
-Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wdocumentation -Wunreachable-code \
-Wquoted-include-in-framework-header -Wno-implicit-atomic-properties -Werror\=deprecated-objc-isa-usage \
-Wno-objc-interface-ivars -Werror\=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self \
-Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label \
-Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized \
-Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion \
-Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion \
-Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector \
-Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations \
-DNS_BLOCK_ASSERTIONS\=1 -DOBJC_OLD_DISPATCH_PROTOTYPES\=0 \
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.5.sdk \
-fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -Wno-sign-conversion -Winfinite-recursion -Wcomma \
-Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -Wunguarded-availability \
-fembed-bitcode \
-iquote /Users/reblaze/Library/Developer/Xcode/DerivedData/reblaze-brygnjayhxjquyhbvyujfnhksvyc/Build/Intermediates.noindex/ArchiveIntermediates/ReblazeSDK/IntermediateBuildFilesPath/UrlProtocol.build/Release-iphoneos/UrlProtocol.build/UrlProtocol-generated-files.hmap \
-I/Users/reblaze/Library/Developer/Xcode/DerivedData/reblaze-brygnjayhxjquyhbvyujfnhksvyc/Build/Intermediates.noindex/ArchiveIntermediates/ReblazeSDK/IntermediateBuildFilesPath/UrlProtocol.build/Release-iphoneos/UrlProtocol.build/UrlProtocol-own-target-headers.hmap \
-I/Users/reblaze/Library/Developer/Xcode/DerivedData/reblaze-brygnjayhxjquyhbvyujfnhksvyc/Build/Intermediates.noindex/ArchiveIntermediates/ReblazeSDK/IntermediateBuildFilesPath/UrlProtocol.build/Release-iphoneos/UrlProtocol.build/UrlProtocol-all-non-framework-target-headers.hmap \
-ivfsoverlay /Users/reblaze/Library/Developer/Xcode/DerivedData/reblaze-brygnjayhxjquyhbvyujfnhksvyc/Build/Intermediates.noindex/ArchiveIntermediates/ReblazeSDK/IntermediateBuildFilesPath/UrlProtocol.build/Release-iphoneos/UrlProtocol.build/all-product-headers.yaml \
-iquote /Users/reblaze/Library/Developer/Xcode/DerivedData/reblaze-brygnjayhxjquyhbvyujfnhksvyc/Build/Intermediates.noindex/ArchiveIntermediates/ReblazeSDK/IntermediateBuildFilesPath/UrlProtocol.build/Release-iphoneos/UrlProtocol.build/UrlProtocol-project-headers.hmap \
-I/Users/reblaze/Library/Developer/Xcode/DerivedData/reblaze-brygnjayhxjquyhbvyujfnhksvyc/Build/Intermediates.noindex/ArchiveIntermediates/ReblazeSDK/BuildProductsPath/Release-iphoneos/include \
-I/Users/reblaze/Library/Developer/Xcode/DerivedData/reblaze-brygnjayhxjquyhbvyujfnhksvyc/Build/Intermediates.noindex/ArchiveIntermediates/ReblazeSDK/IntermediateBuildFilesPath/UrlProtocol.build/Release-iphoneos/UrlProtocol.build/DerivedSources-normal/arm64 \
-I/Users/reblaze/Library/Developer/Xcode/DerivedData/reblaze-brygnjayhxjquyhbvyujfnhksvyc/Build/Intermediates.noindex/ArchiveIntermediates/ReblazeSDK/IntermediateBuildFilesPath/UrlProtocol.build/Release-iphoneos/UrlProtocol.build/DerivedSources/arm64 \
-I/Users/reblaze/Library/Developer/Xcode/DerivedData/reblaze-brygnjayhxjquyhbvyujfnhksvyc/Build/Intermediates.noindex/ArchiveIntermediates/ReblazeSDK/IntermediateBuildFilesPath/UrlProtocol.build/Release-iphoneos/UrlProtocol.build/DerivedSources \
-F/Users/reblaze/Library/Developer/Xcode/DerivedData/reblaze-brygnjayhxjquyhbvyujfnhksvyc/Build/Intermediates.noindex/ArchiveIntermediates/ReblazeSDK/BuildProductsPath/Release-iphoneos -MMD -MT dependencies \
-MF /Users/reblaze/Library/Developer/Xcode/DerivedData/reblaze-brygnjayhxjquyhbvyujfnhksvyc/Build/Intermediates.noindex/ArchiveIntermediates/ReblazeSDK/IntermediateBuildFilesPath/UrlProtocol.build/Release-iphoneos/UrlProtocol.build/Objects-normal/arm64/UrlProtocol.d \
--serialize-diagnostics /Users/reblaze/Library/Developer/Xcode/DerivedData/reblaze-brygnjayhxjquyhbvyujfnhksvyc/Build/Intermediates.noindex/ArchiveIntermediates/ReblazeSDK/IntermediateBuildFilesPath/UrlProtocol.build/Release-iphoneos/UrlProtocol.build/Objects-normal/arm64/UrlProtocol.dia \
-c /Users/reblaze/bitbucket/reblaze-ios-sdk-xcode11/UrlProtocol/UrlProtocol/UrlProtocol/UrlProtocol.m \
-o /Users/reblaze/Library/Developer/Xcode/DerivedData/reblaze-brygnjayhxjquyhbvyujfnhksvyc/Build/Intermediates.noindex/ArchiveIntermediates/ReblazeSDK/IntermediateBuildFilesPath/UrlProtocol.build/Release-iphoneos/UrlProtocol.build/Objects-normal/arm64/UrlProtocol.o

# Crash reproducer for Apple clang version 12.0.5 (clang-1205.0.22.9)

Process:               clang [22385]
Path:                  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefaultHanabi.xctoolchain/usr/bin/clang
Identifier:            clang
Version:               12.0.5 (1205.0.22)
Code Type:             X86-64 (Native)
Parent Process:        clang [22384]
Responsible:           Xcode [61582]
User ID:               501

Date/Time:             2021-08-17 23:22:05.357 +0300
OS Version:            macOS 11.4 (20F71)
Report Version:        12
Bridge OS Version:     5.4 (18P4663)
Anonymous UUID:        4D50C122-0A7E-E8CC-0B91-443EE348DD1B

Sleep/Wake UUID:       5584F0BF-201D-4A41-86BB-05AA43BC5CAD

Time Awake Since Boot: 2800000 seconds
Time Since Wake:       44000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
dyld2 mode
abort() called
clang(22385,0x112404e00) malloc: *** error for object 0x7ffeefad7630: pointer being realloc'd was not allocated


Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib              0x00007fff2041e92e __pthread_kill + 10
1   libsystem_pthread.dylib             0x00007fff2044d5bd pthread_kill + 263
2   libsystem_c.dylib                   0x00007fff203a24ab __abort + 139
3   libsystem_c.dylib                   0x00007fff203a2420 abort + 135
4   libsystem_malloc.dylib              0x00007fff202821f5 malloc_vreport + 548
5   libsystem_malloc.dylib              0x00007fff2028534a malloc_report + 151
6   libsystem_malloc.dylib              0x00007fff2027650f realloc + 315
7   clang                               0x0000000100c3b0b5 llvm::SmallVectorBase<unsigned long long>::grow_pod(void*, unsigned long, unsigned long) + 69
8   clang                               0x000000010234ddef llvm::sys::path::home_directory(llvm::SmallVectorImpl<char>&) + 143
9   libLLVMHanabi.dylib                 0x0000000106041d36 llvm::FunctionCallObfuscate::doInitialization(llvm::Module&) + 182
10  libLLVMHanabi.dylib                 0x0000000106066e9f llvm::Obfuscation::runOnModule(llvm::Module&) + 127
11  clang                               0x00000001008e04c7 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 663
12  clang                               0x0000000100dbc4a2 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_delete<llvm::raw_pwrite_stream> >) + 5138
13  clang                               0x0000000100f3f2a3 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 787
14  clang                               0x00000001026a5eb6 clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) + 38
15  clang                               0x0000000101604b5e clang::ParseAST(clang::Sema&, bool, bool) + 414
16  clang                               0x0000000101081363 clang::FrontendAction::Execute() + 35
17  clang                               0x000000010103aba1 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 897
18  clang                               0x00000001010cc445 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1829
19  clang                               0x000000010012ab7e cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 1678
20  clang                               0x0000000100129bd9 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) + 761
21  clang                               0x000000010012984c main + 4076
22  libdyld.dylib                       0x00007fff20468f5d start + 1

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x0000000112404e00  rcx: 0x00007ffeefad72a8  rdx: 0x0000000000000000
  rdi: 0x0000000000000103  rsi: 0x0000000000000006  rbp: 0x00007ffeefad72d0  rsp: 0x00007ffeefad72a8
   r8: 0x0000000000000000   r9: 0x0000000000989680  r10: 0x0000000112404e00  r11: 0x0000000000000246
  r12: 0x0000000000000103  r13: 0x0000000000000050  r14: 0x0000000000000006  r15: 0x0000000000000016
  rip: 0x00007fff2041e92e  rfl: 0x0000000000000246  cr2: 0x00007f853bdd1000

Logical CPU:     0
Error Code:      0x02000148
Trap Number:     133

Thread 0 instruction stream not available.

Thread 0 last branch register state not available.


Binary Images:
       0x100123000 -        0x103beefff +clang (12.0.5 - 1205.0.22) <A8FF74D5-AC51-3D37-9DAF-C74F6280E272> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefaultHanabi.xctoolchain/usr/bin/clang
       0x10549c000 -        0x105d83fff +libLLVMHanabiDeps.dylib (0) <6DFD0934-AFD5-3CCF-9E81-33F5CAB23029> /Users/USER/*/libLLVMHanabiDeps.dylib
       0x10603f000 -        0x10606cfff +libLLVMHanabi.dylib (0) <91582B4F-F18A-36E0-BDD5-0EA5A9A5941D> /Users/USER/*/libLLVMHanabi.dylib
       0x106084000 -        0x106090fff +libsubstitute.dylib (0) <761D40EE-033D-348E-9A07-ED3FDDECE1D7> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefaultHanabi.xctoolchain/usr/bin/libsubstitute.dylib
       0x11232d000 -        0x1123c8fff  dyld (852) <1AC76561-4F9A-34B1-BA7C-4516CACEAED7> /usr/lib/dyld
    0x7fff20185000 -     0x7fff20186fff  libsystem_blocks.dylib (79) <48AF56A9-6E42-3A5E-A213-E6AFD8F81044> /usr/lib/system/libsystem_blocks.dylib
    0x7fff20187000 -     0x7fff201bcfff  libxpc.dylib (2038.120.1) <5751A7F5-6DC5-3090-B7F1-D90ED71BEF1F> /usr/lib/system/libxpc.dylib
    0x7fff201bd000 -     0x7fff201d4fff  libsystem_trace.dylib (1277.120.1) <8E243C00-BFC2-3FAA-989C-0D72314DB04D> /usr/lib/system/libsystem_trace.dylib
    0x7fff201d5000 -     0x7fff20272fff  libcorecrypto.dylib (1000.120.2) <FADB19A0-1BF3-3F47-B729-87B4FA8CA677> /usr/lib/system/libcorecrypto.dylib
    0x7fff20273000 -     0x7fff2029ffff  libsystem_malloc.dylib (317.121.1) <CAD162A5-7367-3A30-9C15-5D036411AEDE> /usr/lib/system/libsystem_malloc.dylib
    0x7fff202a0000 -     0x7fff202e4fff  libdispatch.dylib (1271.120.2) <7B229797-1F2E-3409-9D0C-060C7EEF2E12> /usr/lib/system/libdispatch.dylib
    0x7fff202e5000 -     0x7fff2031efff  libobjc.A.dylib (824) <FE5AF22E-80A1-34BB-98D6-610879988BAA> /usr/lib/libobjc.A.dylib
    0x7fff2031f000 -     0x7fff20321fff  libsystem_featureflags.dylib (28.60.1) <77F7F479-39BD-3111-BE3C-C74567FD120C> /usr/lib/system/libsystem_featureflags.dylib
    0x7fff20322000 -     0x7fff203aafff  libsystem_c.dylib (1439.100.3) <38F8A126-C995-349A-B909-FF831914ED2E> /usr/lib/system/libsystem_c.dylib
    0x7fff203ab000 -     0x7fff20400fff  libc++.1.dylib (905.6) <B3812B86-4FCF-3A10-8866-DF67940A974C> /usr/lib/libc++.1.dylib
    0x7fff20401000 -     0x7fff20416fff  libc++abi.dylib (905.6) <A0FE88B7-E157-3C9C-A29A-11D3BE3436B3> /usr/lib/libc++abi.dylib
    0x7fff20417000 -     0x7fff20446fff  libsystem_kernel.dylib (7195.121.3) <A4938CF5-ABC0-397B-8A6E-B7BEEFA24D0A> /usr/lib/system/libsystem_kernel.dylib
    0x7fff20447000 -     0x7fff20452fff  libsystem_pthread.dylib (454.120.2) <17482C9D-061E-3769-AC9E-BE1239D33098> /usr/lib/system/libsystem_pthread.dylib
    0x7fff20453000 -     0x7fff2048efff  libdyld.dylib (852) <C10CEA28-D5A0-324F-8F07-8C7CE4805412> /usr/lib/system/libdyld.dylib
    0x7fff2048f000 -     0x7fff20498fff  libsystem_platform.dylib (254.80.2) <8664A4CD-EE27-3C71-B5CC-06E2B1B4F394> /usr/lib/system/libsystem_platform.dylib
    0x7fff20499000 -     0x7fff204c4fff  libsystem_info.dylib (542.40.3) <EA3F9C9C-3116-3DB4-A3F1-5B03172C1E72> /usr/lib/system/libsystem_info.dylib
    0x7fff2288e000 -     0x7fff22897fff  libsystem_darwin.dylib (1439.100.3) <BF5B5FD8-B5A3-3035-8641-466E625A6CE8> /usr/lib/system/libsystem_darwin.dylib
    0x7fff22cad000 -     0x7fff22cb8fff  libsystem_notify.dylib (279.40.4) <7FFECC25-FA84-3B59-9CC8-4D9DC84E6EC1> /usr/lib/system/libsystem_notify.dylib
    0x7fff24c42000 -     0x7fff24c50fff  libsystem_networkextension.dylib (1295.120.5) <02486B74-EAAD-3055-AE20-F12E79B39297> /usr/lib/system/libsystem_networkextension.dylib
    0x7fff24caf000 -     0x7fff24cc5fff  libsystem_asl.dylib (385) <B3E89650-A7FE-3E93-8A1B-D88145FDD45C> /usr/lib/system/libsystem_asl.dylib
    0x7fff2638a000 -     0x7fff26391fff  libsystem_symptoms.dylib (1431.120.1) <3BEA5355-D267-39D4-8BC6-A1703845BD3F> /usr/lib/system/libsystem_symptoms.dylib
    0x7fff28398000 -     0x7fff283a8fff  libsystem_containermanager.dylib (318.100.4) <2BBFF58C-D27E-3371-968D-7DE1E53749F6> /usr/lib/system/libsystem_containermanager.dylib
    0x7fff290b0000 -     0x7fff290b3fff  libsystem_configuration.dylib (1109.120.1) <C7A9BD10-192B-31D3-92ED-2581A61A99F6> /usr/lib/system/libsystem_configuration.dylib
    0x7fff290b4000 -     0x7fff290b8fff  libsystem_sandbox.dylib (1441.120.5) <DC075A7C-9D4A-32D3-9022-CD47764AFDAD> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff29daa000 -     0x7fff29dacfff  libquarantine.dylib (119.40.2) <4611645F-5817-3A80-8382-2DB03A8C0141> /usr/lib/system/libquarantine.dylib
    0x7fff2a355000 -     0x7fff2a359fff  libsystem_coreservices.dylib (127.1) <1E2DA16B-D528-3D43-86C2-2BB9127954A0> /usr/lib/system/libsystem_coreservices.dylib
    0x7fff2a556000 -     0x7fff2a568fff  libz.1.dylib (76) <C1E6CE87-167E-39EC-8B8F-2C3213A0208E> /usr/lib/libz.1.dylib
    0x7fff2a569000 -     0x7fff2a5b0fff  libsystem_m.dylib (3186.100.3) <21949128-D4E6-3179-B248-41B05C1CE102> /usr/lib/system/libsystem_m.dylib
    0x7fff2a5b2000 -     0x7fff2a5b7fff  libmacho.dylib (980) <3677B3B7-03E8-3804-B2FE-5640B18FE40E> /usr/lib/system/libmacho.dylib
    0x7fff2a5d4000 -     0x7fff2a5dffff  libcommonCrypto.dylib (60178.120.3) <BBA72D86-B9C1-3123-AE59-D629DE278695> /usr/lib/system/libcommonCrypto.dylib
    0x7fff2a5e0000 -     0x7fff2a5eafff  libunwind.dylib (201) <3149D79A-911B-39ED-9C93-6C7E6B0860C7> /usr/lib/system/libunwind.dylib
    0x7fff2a5eb000 -     0x7fff2a5f2fff  liboah.dylib (203.46) <0A17EAFC-15E9-37FE-8EE2-DE0F7F220AD8> /usr/lib/liboah.dylib
    0x7fff2a5f3000 -     0x7fff2a5fdfff  libcopyfile.dylib (173.40.2) <7304CA0D-E93C-367F-9BEE-AC56B873F06C> /usr/lib/system/libcopyfile.dylib
    0x7fff2a5fe000 -     0x7fff2a605fff  libcompiler_rt.dylib (102.2) <0DB1902E-C79C-3E26-BE51-F70960ECF0B9> /usr/lib/system/libcompiler_rt.dylib
    0x7fff2a606000 -     0x7fff2a608fff  libsystem_collections.dylib (1439.100.3) <E180C04A-9CFB-3C8E-9C2B-978D23A99F2A> /usr/lib/system/libsystem_collections.dylib
    0x7fff2a609000 -     0x7fff2a60bfff  libsystem_secinit.dylib (87.60.1) <8C33D323-C11C-34CB-9295-4D7C98B8AFD6> /usr/lib/system/libsystem_secinit.dylib
    0x7fff2a60c000 -     0x7fff2a60efff  libremovefile.dylib (49.120.1) <6DEAEEC9-2A65-3C7B-A9CE-23245772FD07> /usr/lib/system/libremovefile.dylib
    0x7fff2a60f000 -     0x7fff2a60ffff  libkeymgr.dylib (31) <FD167835-3829-3FFD-B13E-D18113E271AB> /usr/lib/system/libkeymgr.dylib
    0x7fff2a610000 -     0x7fff2a617fff  libsystem_dnssd.dylib (1310.120.71) <7BB607FE-EF79-3144-8BD0-A66792FF1443> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff2a618000 -     0x7fff2a61dfff  libcache.dylib (83) <8B201058-2C34-3C12-9A7A-898CB0AAD150> /usr/lib/system/libcache.dylib
    0x7fff2a61e000 -     0x7fff2a61ffff  libSystem.B.dylib (1292.120.1) <A8309074-31CC-31F0-A143-81DF019F7A86> /usr/lib/libSystem.B.dylib
    0x7fff2da25000 -     0x7fff2da25fff  liblaunch.dylib (2038.120.1) <FB6430FC-AACB-3AFF-8763-4C5AFABEF40E> /usr/lib/system/liblaunch.dylib
    0x7fff2feb4000 -     0x7fff2feb4fff  libsystem_product_info_filter.dylib (8.40.1) <D5194AB1-61C4-3C8D-9E3C-C65702BAB859> /usr/lib/system/libsystem_product_info_filter.dylib
    0x7fff40d60000 -     0x7fff40d8ffff  libncurses.5.4.dylib (57) <575D6FE4-911D-39E4-8D19-1CC44687CE6D> /usr/lib/libncurses.5.4.dylib

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 47
    thread_create: 0
    thread_set_state: 1886

VM Region Summary:
ReadOnly portion of Libraries: Total=595.7M resident=0K(0%) swapped_out_or_unallocated=595.7M(100%)
Writable regions: Total=100.0M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=100.0M(100%)

                                VIRTUAL   REGION
REGION TYPE                        SIZE    COUNT (non-coalesced)
===========                     =======  =======
Kernel Alloc Once                    8K        1
MALLOC                            91.5M       41
MALLOC guard page                   16K        4
STACK GUARD                       56.0M        1
Stack                             8192K        1
VM_ALLOCATE                         16K        4
__DATA                            5116K       51
__DATA_CONST                       243K       34
__DATA_DIRTY                        58K       22
__LINKEDIT                       522.6M        8
__OBJC_RO                         70.2M        1
__OBJC_RW                         2480K        2
__TEXT                            73.1M       51
mapped file                       20.7M       26
shared memory                        4K        1
===========                     =======  =======
TOTAL                            849.8M      248

Ask

this work for Swift?

LLVM ERROR: out of memory

Xcode版本10.2,Hanabi版本是最新的release,使用optool注入,未添加-mllvm和其他other c flag
编译报错如下

Applying Apple Clang Hooks...
Applying Apple Clang Hooks...
std::mt19937_64 seeded with current timestamp: 1557301905166
Initializing Hikari Core with Revision ID:9ab2634299fc8e891cf2bc66cd7ca09c59343c48
LLVM ERROR: out of memory
clang: error: unable to execute command: Abort trap: 6
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Apple LLVM version 10.0.1 (clang-1001.0.46.3)
Target: arm-apple-darwin18.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to http://developer.apple.com/bugreporter/ and include the crash backtrace, preprocessed source, and associated run script.
clang: error: unable to execute command: Abort trap: 6
clang: note: diagnostic msg: Error generating preprocessed source(s).

报错信息如下
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff60dd62c6 __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff60e8bbf1 pthread_kill + 284
2 libsystem_c.dylib 0x00007fff60d40745 __abort + 144
3 libsystem_c.dylib 0x00007fff60d406b5 abort + 142
4 clang 0x000000010ec74b85 llvm::report_bad_alloc_error(char const*, bool) + 133
5 clang 0x000000010ec74bc5 out_of_memory_new_handler() + 21
6 libc++abi.dylib 0x00007fff5dcf7370 operator new(unsigned long) + 32
7 libLLVMHanabi.dylib 0x00000001126339e0 llvm::FunctionCallObfuscate::doInitialization(llvm::Module&) + 384
8 libLLVMHanabi.dylib 0x0000000112658dff llvm::Obfuscation::runOnModule(llvm::Module&) + 127
9 clang 0x000000010e7f9057 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 695
10 clang 0x000000010ef0d773 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_deletellvm::raw_pwrite_stream >) + 6099
11 clang 0x000000010d5c612a clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 458
12 clang 0x000000010ddc1a8c clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) + 44
13 clang 0x000000010d408dd6 clang::ParseAST(clang::Sema&, bool, bool) + 294
14 clang 0x000000010d407f1a clang::FrontendAction::Execute() + 42
15 clang 0x000000010d3e7f2a clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 490
16 clang 0x000000010d3e61e5 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 693
17 clang 0x000000010de5a84a cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 1578
18 clang 0x000000010d3dbcc1 main + 3105
19 libdyld.dylib 0x00007fff60c9b3d5 start + 1

Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x00000001171ba5c0 rcx: 0x00007ffee2822b38 rdx: 0x0000000000000000
rdi: 0x0000000000000307 rsi: 0x0000000000000006 rbp: 0x00007ffee2822b70 rsp: 0x00007ffee2822b38
r8: 0x0000000000000000 r9: 0x0000000000989680 r10: 0x0000000000000000 r11: 0x0000000000000206
r12: 0x0000000000000307 r13: 0x00000001110b07f0 r14: 0x0000000000000006 r15: 0x000000000000002d
rip: 0x00007fff60dd62c6 rfl: 0x0000000000000206 cr2: 0x00007fff93c98260

Logical CPU: 0
Error Code: 0x02000148
Trap Number: 133

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.