关于Android的prelink

在Android中添加自己的库文件,在编译时会提示:library 'XXX.so' not in prelink map 错误,

其中一个很重要的文件在build/core/prelink-linux-arm.map,下面是从google 上关于prelink-linux-arm.map文件的说明:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

prelink-linux-arm.map is for providing addresses so that the loading of all the registered libraries can be done faster.
If you want you can add address for your library.
You can see on top of the file various address ranges for different categories.

If you do not want to add, then just add:
LOCAL_PRELINK_MODULE := false
line in your Android.mk file

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

从上面的英文说明我们知道将下面的变量设置为false那么将不做prelink操作
LOCAL_PRELINK_MODULE := false
默认是需要prlink 的,同时需要在 build/core/prelink-linux-arm.map 中加入libhellod.so 0x96000000这 个map文件好像是制定动态库的地址的,在前面注释上面有一些地址范围的信息,注意库与库之间的间隔数,如果指定不好的话编译的时候会提示说地址 空间冲突的问题。另外,注意排序,这里要把数大的放到前面去,按照大小降序排序。解析 LOCAL_PRELINK_MODULE 变量
build/core/dynamic_binary.mk:94:ifeq ($(LOCAL_PRELINK_MODULE),true)
ifeq ($(LOCAL_PRELINK_MODULE),true)
$(prelink_output): $(prelink_input) $(TARGET_PRELINKER_MAP) $(APRIORI)
$(transform-to-prelinked)
transform-to-prelinked定义:
./build/core/definitions.mk:1002:define transform-to-prelinked
define transform-to-prelinked
@mkdir -p $(dir $@)
@echo "target Prelink: $(PRIVATE_MODULE) ($@)"
$(hide) $(APRIORI) /
--prelinkmap $(TARGET_PRELINKER_MAP) /
--locals-only /
--quiet /
$/build/tools/apriori”
参 考文档:
动态库优化——Prelink(预连接)技术
http://www.eefocus.com/article/09-04/71629s.html


你可能感兴趣的:(关于Android的prelink)