AOSP 9.0构建系统如何链接可执行文件? [英] How does AOSP 9.0 build system link the executable?

查看:101
本文介绍了AOSP 9.0构建系统如何链接可执行文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于AOSP 9.0.0_r30源代码,首先使用这些命令输出一个 构建过程中的详细构建日志:

With AOSP 9.0.0_r30 source code, first use these commands to output a detailed build log during build:

make clean
make showcommands -j8 > ~/BuildAndroid.txt

然后在~/BuildAndroid.txt中搜索"lld"(全字匹配).我什么都找不到. Clang链接器应使用lld关键字.搜索"ld"有50个结果,但它们几乎不是链接命令.其中之一是"ld.mc",虽然这是一个候选值.

Then search in ~/BuildAndroid.txt for "lld" (whole word match). I can't find anything. Clang linker should have the lld keyword.Search "ld" there are 50 results but they are hardly be the link commands.One of them is "ld.mc" which is a candidate,though.

并搜索一些cpp源文件名,例如"TextDropShadowCache".我只有2条命令,它们都是clang ++编译命令.

And search for some cpp source file name like "TextDropShadowCache". I only get 2 commands, both of which are clang++ compilation commands.

libhwui.so的链接命令引用了一个文件"libhwui.so.rsp",该文件似乎(只能猜测)包含"TextDropShadowCache.o":

The link command of libhwui.so references a file "libhwui.so.rsp" which seems to possibly (only guess) contains "TextDropShadowCache.o":

prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++ /OpenSource/Build/Android/9.0.0_r30/soong/.intermediates/bionic/libc/crtbegin_so/android_x86_64_core/crtbegin_so.o @/OpenSource/Build/Android/9.0.0_r30/soong/.intermediates/frameworks/base/libs/hwui/libhwui/android_x86_64_core_shared/libhwui.so.rsp ......

如果这是真的,那么libhwui.so.rsp是如何产生的?

If this is true, then how is libhwui.so.rsp produced?

该命令还会引发以下问题:

The command also give rise to this question: What does @ mean in this clang command in AOSP build log?

根据上述问题,@表示从文件中读取一条长命令,因此很有可能是一个列出了libhwui.so所需的所有obj文件的文件.

according to the above question, @ means read a long command from a file, so it is highly possibly be a file that list all the obj files that libhwui.so needs.

因此,该问题基本得到了解决,但尚未得到验证,因为libhwui.so.rsp似乎在构建后已被删除.

So the problem is basically answered, but not verified because libhwui.so.rsp seems to be removed after build.

AOSP 9.0构建系统如何链接可执行文件?

How does the AOSP 9.0 build system link the executable?

推荐答案

我找到了pppd的链接命令行,只使用了

I found the link command line for pppd,it just use

prebuilts/clang/host/linux-x86/clang-4691093/bin/clang ++

prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++

将所有.o/.a/.so文件作为输入,并将pppd作为输出.

with all the .o/.a/.so file as input,and pppd as output.

但这仍然不能解释为什么没有链接命令使用TextDropShadowCache.o作为输入,也许它们使用某些脚本读取多个.o文件?

But this still does not explain why there are no link commands that use TextDropShadowCache.o as input,maybe they use some script to read multiple .o files?

更新:某些链接命令(例如,链接libhwui.so的命令)使用.rsp文件将目标文件列表输入到链接器,因此命令行中没有目标文件列表. .rsp文件应该是包含列表的文本文件.

Update: Some link command such as command that links libhwui.so uses .rsp file to input the list of object files to the linker, so there is no object file list in the command line. The .rsp file should be a text file that contains the list.

这篇关于AOSP 9.0构建系统如何链接可执行文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆