soong: Add crt_pad_segment to .so's
crt_pad_segment adds a NOTE to the ELF which is used by the binoic loader to determine whether it should pad segments when mapping them into the virtual address space, such that there are no gaps between mappings of consecutive segments. This avoids an increase in unreclaimable kernel slab memory usage for VMAs on devices where the runtime-page-size > elf-segment-p_align. Since -fandroid-pad-segment [1] respects -nostdlib used in android platform builds, soong must link in crt_pad_segment to platform shared libraries. For simplicity, link crt_pad_segment everywhere that crtend_so is applicable, ignoring nocrt property, as there is no other reason to track these separately. Example: ❯ readelf -WS /system/lib64/libc++.so [Output simplified] ... Section Headers: [Nr] Name Type Address Off Size ES Flg Lk Inf Al ... [ 2] .note.android.pad_segment NOTE 0000000000000288 000288 000018 00 A 0 0 4 ... [1] https://github.com/llvm/llvm-project/pull/77244 Bug: 316403210 Test: readelf -WS <lib>.so Change-Id: Icc06611376cfd5ee4de7281b4134f9f8ffe7ca60 Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Loading
Please register or sign in to comment