求助tweak用obfuscator-llvm混淆

我有一个用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)

基础实在太差,不知道是遗漏了什么还是有别的需要注意的地方,请求大家帮忙!

@Zhang

1 个赞

ollvm的没有标准库。你得自己svn checkout compiler-rt libcxx libcxxabi

ollvm的是基于4.0,所以更靠谱的方式是从 releases.llvm.org 下载4.0的配套库放进去一起编译

以第一个符号为例。
std::__1::__vector_base_common::__throw_length_error()
对应 __ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv
实现在LLVM的libc++.

我看了你发的链接,下载了compiler-rt libcxx libcxxabi。
根据 http://llvm.org/docs/GettingStarted.html#getting-started-quickly-a-summary, 将这些源码放到projects下了:


image

然后我重新cmake了一下,但是发现build/projects下并没有我放入的那些库:
image

感觉应该有哪里不对,不敢随便make啊,我这电脑性能不咋地,make一下要1个小时。。。

没错的。编译好的在lib里

cmake可能有缓存。这就不知道了。另外Ninja比make我感觉快很多

试试删掉cmakecache.txt

顺便。你给的链接是ollvm到5.0的移植,所以对应的库也应该是5.0 release

或者。试试看我的移植?基于llvm 6.0,提供更多的功能以及(希望没有) bug
https://github.com/Naville/Hikari/releases

噢,最开始我是找到一个4.0的,然后发现有一个5.0的,就用5.0的了, 现在你写了一个6.0的版本:_1:。我已经在下载了,谢谢你。

嗯我自己加的模块有两个要单独配置,具体看wiki。有问题开issue

好的,github贼慢,我先好好看看wiki,有问题再请教。