How does AOSP 9.0 build system link the executable

2019-08-27 16:34发布

问题:

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

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.

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

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 ......

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?

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.

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

How does the AOSP 9.0 build system link the executable?

回答1:

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

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

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

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?