我有一个用theos新建的一个app工程,想混淆加密一下代码,在论坛和网上搜索了一些方法,发现现有的方案llvm-obfuscator
使用 obfuscator-llvm 的 clang 去编译程序,后面添加响应的参数就可以实现混淆,于是我修改Makefile模板如下:
TARGET_CC = /Users/admin/work/tools/obfuscator/build/bin/clang
TARGET_CXX = /Users/admin/work/tools/obfuscator/build/bin/clang
TARGET_LD = /Users/admin/work/tools/obfuscator/build/bin/clang
_THEOS_TARGET_CFLAGS += -mllvm -fla -mllvm -sub
_THEOS_TARGET_CXXFLAGS += -mllvm -fla -mllvm -sub
编译工程已有的代码都没有问题,我代码里加入了高德地图的SDK,进行链接的时候报错:
Undefined symbols for architecture armv7:
“std::__1::__vector_base_common::__throw_length_error() const”, referenced from:
l049 in libMAMapKit.a(MAMapKit-armv7-master.o)
std::__1::vector<float, std::__1::allocator >::allocate(unsigned long) in libMAMapKit.a(MAMapKit-armv7-master.o)
std::__1::enable_if<(__is_forward_iteratorMAHeatMapTileProviderTools::color*::value) && (is_constructible<MAHeatMapTileProviderTools::color, std::__1::iterator_traitsMAHeatMapTileProviderTools::color*::reference>::value), void>::type std::__1::vector<MAHeatMapTileProviderTools::color, std::__1::allocatorMAHeatMapTileProviderTools::color >::assignMAHeatMapTileProviderTools::color*(MAHeatMapTileProviderTools::color*, MAHeatMapTileProviderTools::color*) in libMAMapKit.a(MAMapKit-armv7-master.o)
std::__1::vector<MAHeatMapTileProviderTools::color, std::__1::allocatorMAHeatMapTileProviderTools::color >::allocate(unsigned long) in libMAMapKit.a(MAMapKit-armv7-master.o)
std::__1::enable_if<(__is_forward_iterator<float*>::value) && (is_constructible<float, std::__1::iterator_traits<float*>::reference>::value), void>::type std::__1::vector<float, std::__1::allocator >::assign<float*>(float*, float*) in libMAMapKit.a(MAMapKit-armv7-master.o)
void std::__1::vector<MAHeatMapTileProviderTools::Gradient::ColorInterval*, std::__1::allocatorMAHeatMapTileProviderTools::Gradient::ColorInterval* >::__push_back_slow_path<MAHeatMapTileProviderTools::Gradient::ColorInterval* const&>(MAHeatMapTileProviderTools::Gradient::ColorInterval* const&&&) in libMAMapKit.a(MAMapKit-armv7-master.o)
std::__1::vector<double, std::__1::allocator >::allocate(unsigned long) in libMAMapKit.a(MAMapKit-armv7-master.o)
…
“std::__1::__next_prime(unsigned long)”, referenced from:
std::__1::__hash_table<std::__1::__hash_value_type<int, MAHeatMapTileProviderTools::Gradient::ColorInterval*>, std::__1::__unordered_map_hasher<int, std::__1::__hash_value_type<int, MAHeatMapTileProviderTools::Gradient::ColorInterval*>, std::__1::hash, true>, std::__1::__unordered_map_equal<int, std::__1::__hash_value_type<int, MAHeatMapTileProviderTools::Gradient::ColorInterval*>, std::__1::equal_to, true>, std::__1::allocator<std::__1::__hash_value_type<int, MAHeatMapTileProviderTools::Gradient::ColorInterval*> > >::rehash(unsigned long) in libMAMapKit.a(MAMapKit-armv7-master.o)
“operator delete”, referenced from:
l048 in libMAMapKit.a(MAMapKit-armv7-master.o)
“operator delete(void*)”, referenced from:
l045 in libMAMapKit.a(MAMapKit-armv7-master.o)
l049 in libMAMapKit.a(MAMapKit-armv7-master.o)
l434 in libMAMapKit.a(MAMapKit-armv7-master.o)
l436 in libMAMapKit.a(MAMapKit-armv7-master.o)
l437 in libMAMapKit.a(MAMapKit-armv7-master.o)
std::__1::__vector_base<float, std::__1::allocator >::~__vector_base() in libMAMapKit.a(MAMapKit-armv7-master.o)
std::__1::vector<MAHeatMapTileProviderTools::color, std::__1::allocatorMAHeatMapTileProviderTools::color >::deallocate() in libMAMapKit.a(MAMapKit-armv7-master.o)
…
“operator new(unsigned long)”, referenced from:
l048 in libMAMapKit.a(MAMapKit-armv7-master.o)
“operator new(unsigned long)”, referenced from:
l049 in libMAMapKit.a(MAMapKit-armv7-master.o)
l434 in libMAMapKit.a(MAMapKit-armv7-master.o)
std::__1::vector<float, std::__1::allocator >::allocate(unsigned long) in libMAMapKit.a(MAMapKit-armv7-master.o)
std::__1::vector<MAHeatMapTileProviderTools::color, std::__1::allocatorMAHeatMapTileProviderTools::color >::allocate(unsigned long) in libMAMapKit.a(MAMapKit-armv7-master.o)
l440 in libMAMapKit.a(MAMapKit-armv7-master.o)
std::__1::unordered_map<int, MAHeatMapTileProviderTools::Gradient::ColorInterval*, std::__1::hash, std::__1::equal_to, std::__1::allocator<std::__1::pair<int const, MAHeatMapTileProviderTools::Gradient::ColorInterval*> > >::operator in libMAMapKit.a(MAMapKit-armv7-master.o)
std::__1::unordered_map<int, MAHeatMapTileProviderTools::Gradient::ColorInterval*, std::__1::hash, std::__1::equal_to, std::__1::allocator<std::__1::pair<int const, MAHeatMapTileProviderTools::Gradient::ColorInterval*> > >::operator(int const&) in libMAMapKit.a(MAMapKit-armv7-master.o)
…
“___gxx_personality_sj0”, referenced from:
+[AMapZipArchive unzipFileAtPath:toDestination:] in libAMapFoundationKit.a(AMapFoundationKit-armv7-master.o)
…
ld: symbol(s) not found for architecture armv7
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
基础实在太差,不知道是遗漏了什么还是有别的需要注意的地方,请求大家帮忙!