abseil-cpp: Enable LTO/GC and prune RDEPENDS
Enable -ffunction-sections, -fdata-sections, -Wl,--gc-sections, and
CMake Interprocedural Optimization (LTO) so the linker strips dead code
across translation units in Abseil shared libraries.
Override split_dynamic_packages() without appending all 91 libabsl-*
subpackages to RDEPENDS:${PN}. BitBake's automatic shlibdeps scanner
(do_package_shlibs) inspects ELF DT_NEEDED entries of all target
binaries and installs only the required libabsl-* packages into the
rootfs. This drops 17-18 unreferenced debug/test/profiler shared
libraries (~1.16 MiB raw on aarch64, ~191 KiB raw on arm7a) while
keeping all 91 libraries staged in recipe-sysroot for build-time
linking.
Tested:
Built obmc-phosphor-image for aarch64 and armv7a.
Verified via readelf -d across all rootfs
ELF files (702 on aarch64, 739 on arm7a) that 100% of DT_NEEDED
dependencies are satisfied with 0 missing libraries.
- platform5: http://fusion2/66072b58-7553-32b4-a2e0-260368a1caae
- platform15: http://fusion2/181bde89-1841-314e-935f-519a2ed964ef
- platform18: http://fusion2/b1878938-0d91-3f37-bc2a-7d74e2c8bf62
- platform17: http://fusion2/cf8e0318-483a-3ba7-ad5f-9448eef74430
- platform11+ext: http://fusion2/f829b588-32c1-37dd-903b-90b52416d63c
- platform11: http://fusion2/fb81a76b-f409-37cf-9bae-9a6ea8fd8f3a
- platform25: http://fusion2/da8155f3-fcc6-3d8b-9857-8ecd5f6d16d8
Google-Bug-Id: 481049523
Change-Id: I5517cbf9998a4e5cda4d64a3f12e5f57a9968302
Signed-off-by: Willy Tu <wltu@google.com>