cross-compiled binutils have large dwp & ld.gold binaries |
|||||
Issue descriptioni have no idea why this is happening, but these binaries are like 10x the size they should be $ du -h /build/*/usr/*/binutils-bin/2.25.51/ld.gold.real 87M /build/arm64-generic/usr/aarch64-cros-linux-gnu/binutils-bin/2.25.51/ld.gold.real 75M /build/peach_pit/usr/armv7a-cros-linux-gnueabi/binutils-bin/2.25.51/ld.gold.real 92M /build/samus/usr/x86_64-cros-linux-gnu/binutils-bin/2.25.51/ld.gold.real 68M /build/x32-generic/usr/x86_64-cros-linux-gnux32/binutils-bin/2.25.51/ld.gold.real 71M /build/x86-alex/usr/i686-pc-linux-gnu/binutils-bin/2.25.51/ld.gold.real $ du -h /build/*/usr/*/binutils-bin/2.25.51/dwp 53M /build/arm64-generic/usr/aarch64-cros-linux-gnu/binutils-bin/2.25.51/dwp 48M /build/peach_pit/usr/armv7a-cros-linux-gnueabi/binutils-bin/2.25.51/dwp 58M /build/samus/usr/x86_64-cros-linux-gnu/binutils-bin/2.25.51/dwp 41M /build/x32-generic/usr/x86_64-cros-linux-gnux32/binutils-bin/2.25.51/dwp 46M /build/x86-alex/usr/i686-pc-linux-gnu/binutils-bin/2.25.51/dwp whereas the native ones look fine: $ du -h /usr/*/*/binutils-bin/2.25.51/ld.gold.real 6.3M /usr/x86_64-pc-linux-gnu/aarch64-cros-linux-gnu/binutils-bin/2.25.51/ld.gold.real 6.3M /usr/x86_64-pc-linux-gnu/arm-none-eabi/binutils-bin/2.25.51/ld.gold.real 6.3M /usr/x86_64-pc-linux-gnu/armv6j-cros-linux-gnueabi/binutils-bin/2.25.51/ld.gold.real 6.3M /usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabi/binutils-bin/2.25.51/ld.gold.real 6.3M /usr/x86_64-pc-linux-gnu/i686-pc-linux-gnu/binutils-bin/2.25.51/ld.gold.real 6.3M /usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.25.51/ld.gold.real $ du -h /usr/*/*/binutils-bin/2.25.51/dwp 3.5M /usr/x86_64-pc-linux-gnu/aarch64-cros-linux-gnu/binutils-bin/2.25.51/dwp 3.5M /usr/x86_64-pc-linux-gnu/arm-none-eabi/binutils-bin/2.25.51/dwp 3.5M /usr/x86_64-pc-linux-gnu/armv6j-cros-linux-gnueabi/binutils-bin/2.25.51/dwp 3.5M /usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabi/binutils-bin/2.25.51/dwp 3.5M /usr/x86_64-pc-linux-gnu/i686-pc-linux-gnu/binutils-bin/2.25.51/dwp 3.5M /usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.25.51/dwp
,
Mar 9 2016
Verified that all of the size increase is from debug info. Cross-compiled binutils is being compiled with "-g". The flag is coming from "chromeos/config/make.conf.generic-target" line 72 (https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/master/chromeos/config/make.conf.generic-target#72). This also explains why the host versions are smaller ("make.conf.generic-target" is included only for target packages). Typically, for other cross-compiled packages, the binaries get stripped before install so we don't see the size increase. This doesn't happen for binutils because the sys-devel/binutils ebuild has RESTRICT="strip". This makes some sense since "strip" itself is part of binutils and may, in some instances, cause circular dependency (you need to strip "strip" before installing it). There are 3 alternative ways I can think of to fix this: 1) Remove "-g" from "make.conf.generic-target". This is intrusive, in that it will affect all cross-compiled packages. Not sure if anything visible will change, since the binaries are getting stripped anyway. 2) Remove RESTRICT="strip" from sys-devel/binutils. The circularity inherent in the package seems to be getting handled already somehow (you need the linker to link the linker). 3) Filter flag "-g" when configuring sources for binutils. This is the least intrusive, and probably what we want: https://chromium-review.googlesource.com/#/c/331772
,
Mar 9 2016
looks like we should do (2). i don't see any reason in the history as to why this was added in the first place, and we don't do it in Gentoo.
,
Mar 9 2016
We have RESTRICT="strip" in sys-devel/gcc ebuild as well. Something special about sys-devel/ binaries? I'll prepare another CL to remove RESTRICT="strip" from the binutils ebuild.
,
Mar 9 2016
gcc is necessary because it mixes $CBUILD binaries (e.g. `gcc`) and $CHOST binaries (e.g. libgcc_s.so). the gcc ebuild though manually strips things in src_install with the right strip prog.
,
Mar 9 2016
,
Mar 9 2016
Comparison of binary sizes:
Before:
Sizes of host and cross-compiled binutils directories:
13M /usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.25.51
163M /build/panther/usr/x86_64-cros-linux-gnu/binutils-bin/2.25.51
Sizes of ld.gold.real:
6.3M /usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.25.51/ld.gold.real
92M /build/panther/usr/x86_64-cros-linux-gnu/binutils-bin/2.25.51/ld.gold.real
After "filter-flags -g": https://chromium-review.googlesource.com/#/c/331772
Sizes of host and cross-compiled binutils directories:
13M /usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.25.51
15M /build/panther/usr/x86_64-cros-linux-gnu/binutils-bin/2.25.51
Sizes of ld.gold.real:
6.3M /usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.25.51/ld.gold.real
6.8M /build/panther/usr/x86_64-cros-linux-gnu/binutils-bin/2.25.51/ld.gold.real
After removing "RESTRICT=strip": https://chromium-review.googlesource.com/#/c/332020
Sizes of host and cross-compiled binutils directories:
9.9M /usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.25.51
11M /build/panther/usr/x86_64-cros-linux-gnu/binutils-bin/2.25.51
Sizes of ld.gold.real:
4.6M /usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.25.51/ld.gold.real
5.1M /build/panther/usr/x86_64-cros-linux-gnu/binutils-bin/2.25.51/ld.gold.real
,
Mar 9 2016
the advantage of (2) over (1) & (3) is that you still have the debug info split out for when you do want it
,
Mar 9 2016
Yunlian, Han and I talked about this. We dont know why RESTRICT="strip" is there. I like 2)
,
Mar 10 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/d0401f9379bf6d2606bde2ca2adaaebbebfafc2a commit d0401f9379bf6d2606bde2ca2adaaebbebfafc2a Author: Rahul Chaudhry <rahulchaudhry@chromium.org> Date: Wed Mar 09 22:24:22 2016 sys-devel/binutils: strip binutils binaries before install. BUG= chromium:592228 TEST='emerge-panther sys-devel/binutils' and 'emerge cross-x86_64-cros-linux-gnu/binutils' produce binaries very similar in size. TEST='cbuildbot --remote -g 332020 --latest-toolchain chromiumos-sdk' was successful. Change-Id: Ic142a00119f618f66120b491c04cc7c5c4e42c2c Reviewed-on: https://chromium-review.googlesource.com/332020 Commit-Ready: Rahul Chaudhry <rahulchaudhry@chromium.org> Tested-by: Rahul Chaudhry <rahulchaudhry@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> [rename] https://crrev.com/d0401f9379bf6d2606bde2ca2adaaebbebfafc2a/sys-devel/binutils/binutils-2.25.51-r56.ebuild [modify] https://crrev.com/d0401f9379bf6d2606bde2ca2adaaebbebfafc2a/sys-devel/binutils/binutils-9999.ebuild
,
Mar 10 2016
thanks ... this will help a lot with test images which have been getting too full lately
,
Apr 11 2016
,
May 23 2016
Bulk verified |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by llozano@chromium.org
, Mar 7 2016Owner: rahulchaudhry@chromium.org
Status: Assigned (was: Unconfirmed)