-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Description
Describe the bug
See discussion in #21747
To sum up, we have additional PROGBITS sections past the NOBITS bss and noinit sections, which causes bss and noinit to be vast empty regions in a .bin image.
This only affects targets that do not use XIP.
When bss moves to the end, the bss section will be after the kobject_data section.
Uninitialized kernel objects are placed in bss.
When userspace is enabled, there is no data in kobject_data during the first stage of
linking(prelink), so the kernel object address is small.
Before the second stage of linking(finial), the kernel objects in prelink are scanned
and their addresses are placed in kobject_data.
At this time, kobject_data becomes larger, bss be shifted backwards , cause the kernel object address in the final link result will become larger, which will be inconsistent with that in kobject_data.
If the position of bss is before kobject_data, there will not be this problem.
The appropriate method may be to reserve space for kobject_data during prelink, but the related process is relatively unfamiliar to me, so it is difficult to modify.