[lldb-dev] lldb-server stripped binary size: AArch64 ~16Mb vs ARM ~9 Mb

Tamas Berghammer via lldb-dev lldb-dev at lists.llvm.org
Tue Mar 1 02:33:40 PST 2016


As Pavel mentioned the unreasonable large size for lldb-server is caused by
the fact that we are relying on the liker to remove the unused code and it
can't do too good job because we have lot of unreasonable dependencies.

The size difference between arm and arrahc64 caused by several reason:
* On arm we compile to thumb2 instruction set what is in average ~30%
smaller then the arm (and aarch64) instruction set. Before this change the
size of lldb-server on arm was ~14MB
* We have Safe ICF (identical code folding) enabled for arm what reduces
the binary size by 5-10%. It is not enabled for aarch64 because last time I
checked there was still some issue in ld.gold when using ICF on aarch64. It
should be already fixed upstream but haven't reached the NDK yet.
* The aarch64 lldb-server capable of debugging both arm and aarch64
applications so it contains a bit more code because of this (e.g. 2
spearate register context)

Optimizing the size of both binary is possible (and we want to do it sooner
or later) but because of the reasons I listed the arm one will stay much
smaller then the aarch64 one.

Tamas

On Tue, Mar 1, 2016 at 9:18 AM Pavel Labath via lldb-dev <
lldb-dev at lists.llvm.org> wrote:

> Hi,
>
> so the problem here is that we are currently relying on the linker to
> remove code that we don't need, and it can't always do a good job in
> figuring out which code is not used due to complex dependencies. So,
> innocent-looking changes in the code can pull in lots of transitive
> dependencies, even though they are not used. I suspect something like
> that is going on here, although we should keep in mind that arm64 code
> is less dense naturally. Any help on this front will be welcome,
> although it probably won't be trivial, as we have probably picked off
> the low-hanging fruit already.
>
> That said, you may want to try adding LLVM_TARGETS_TO_BUILD=Aarch64 to
> your cmake line. We use that, although I can't say how much it affects
> the size of the resulting binary.
>
> help that helps,
> pl
>
> On 29 February 2016 at 20:15, Mikhail Filimonov via lldb-dev
> <lldb-dev at lists.llvm.org> wrote:
> > Hello, fellow developers and congratulations with long awaited 3.8
> Release.
> >
> > I wonder why AArch64 stripped binary of lldb-server built from [3.8
> Release] RC3 source is so much bigger than its ARM counterpart.
> > See the numbers:
> > 16318632 Feb 29 22:41 lldb-server-3.8.0-aarch64
> >  9570916 Feb 29 22:23 lldb-server-3.8.0-arm
> > lldb-server-3.8.0-aarch64: ELF 64-bit LSB  executable, ARM aarch64,
> version 1 (SYSV), statically linked, stripped
> > lldb-server-3.8.0-arm:     ELF 32-bit LSB  executable, ARM, EABI5
> version 1 (SYSV), statically linked, stripped
> >
> > My build configuration is MinSizeRel in both cases:
> > cmake -GNinja
> > -DCMAKE_BUILD_TYPE=MinSizeRel $HOME/llvm_git
> > -DCMAKE_TOOLCHAIN_FILE=tools/lldb/cmake/platforms/Android.cmake
> > -DANDROID_TOOLCHAIN_DIR=$HOME/Toolchains/aarch64-21-android
> > -DANDROID_ABI=aarch64
> > -DCMAKE_CXX_COMPILER_VERSION=4.9
> > -DLLVM_TARGET_ARCH=aarch64
> > -DLLVM_HOST_TRIPLE=aarch64-unknown-linux-android
> > -DLLVM_TABLEGEN=$HOME/llvm_host/bin/llvm-tblgen
> > -DCLANG_TABLEGEN=$HOME/llvm_host/bin/clang-tblgen
> >
> > cmake -GNinja
> > -DCMAKE_BUILD_TYPE=MinSizeRel $HOME/llvm_git
> > -DCMAKE_TOOLCHAIN_FILE=tools/lldb/cmake/platforms/Android.cmake
> > -DANDROID_TOOLCHAIN_DIR=$HOME/Toolchains/arm-21-android-toolchain
> > -DANDROID_ABI=armeabi
> > -DCMAKE_CXX_COMPILER_VERSION=4.9
> > -DLLVM_TARGET_ARCH=arm
> > -DLLVM_HOST_TRIPLE=arm-unknown-linux-android
> > -DLLVM_TABLEGEN=$HOME/llvm_host/bin/llvm-tblgen
> > -DCLANG_TABLEGEN=$HOME/llvm_host/bin/clang-tblgen
> >
> > Maybe I need some additional settings to be set for AArch64 case?
> >
> > Regards,
> > Mikhail
> >
> > -----Original Message-----
> > From: lldb-dev [mailto:lldb-dev-bounces at lists.llvm.org] On Behalf Of
> Hans Wennborg via lldb-dev
> > Sent: Wednesday, February 24, 2016 12:51 AM
> > To: release-testers at lists.llvm.org
> > Cc: llvm-dev <llvm-dev at lists.llvm.org>; cfe-dev <cfe-dev at lists.llvm.org>;
> openmp-dev (openmp-dev at lists.llvm.org) <openmp-dev at lists.llvm.org>; LLDB
> Dev <lldb-dev at lists.llvm.org>
> > Subject: [lldb-dev] [3.8 Release] RC3 has been tagged
> >
> > Dear testers,
> >
> > Release Candidate 3 has just been tagged [1]. Please build, test, and
> upload to the sftp.
> >
> > If there are no regressions from previous release candidates, this will
> be the last release candidate before the final release.
> >
> > Release notes can still go into the branch.
> >
> > Thanks again for all your work!
> > Hans
> >
> >  [1]
> http://lists.llvm.org/pipermail/llvm-branch-commits/2016-February/009866.html
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
> >
> >
> -----------------------------------------------------------------------------------
> > This email message is for the sole use of the intended recipient(s) and
> may contain
> > confidential information.  Any unauthorized review, use, disclosure or
> distribution
> > is prohibited.  If you are not the intended recipient, please contact
> the sender by
> > reply email and destroy all copies of the original message.
> >
> -----------------------------------------------------------------------------------
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20160301/dcfe96f8/attachment-0001.html>


More information about the lldb-dev mailing list