[PATCH 08/10] dm: core: Deal with a wrinkle with linker lists

Tom Rini trini at konsulko.com
Tue Apr 19 14:50:00 CEST 2022


On Sun, Mar 27, 2022 at 02:26:20PM -0600, Simon Glass wrote:

> When every member of a linker list is aligned by the compiler, we can no
> longer rely on the sizeof of the struct to determine the number of
> entries.
> 
> For example, if the struct size is 0x90 but every entry is aligned to 0xa0
> by the compiler, the linker list entries takes more space in memory and
> the calculation of the number of entries is incorrect. For example, we may
> see 0x12 entries when there are only 0x11.
> 
> This is a real problem. There may be a general solution, although I cannot
> currently think of one. So far it only bites with OF_PLATDATA_RT which
> creates a pointer to each entry of the 'struct udevice' linker_list. This
> does not happen without that option, so it only affects SPL.
> 
> Work around it by manually calculating the aligned size of struct udevice,
> then using that for the n_ent calculation.
> 
> Note: the alignment fix to linker list was here:
> 
>    0b2fa98aa5e linker_lists: Fix alignment issue
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot-custodians/attachments/20220419/7be128e7/attachment.sig>


More information about the U-Boot-Custodians mailing list