ll_entry_count returns 0 even though the linker list has 5 entries

Simon Glass sjg at chromium.org
Mon Oct 14 21:13:21 CEST 2024


Hi Osman,

On Mon, 14 Oct 2024 at 07:03, Osman <aibaykaro at gmail.com> wrote:
>
> Hello,
> After enabling CONFIG_FIT in defconfig the u-boot-spl becomes unable to
> detect the root_driver in function lists_driver_lookup_name(). The spl
> executes without issues when manually changing the n_ents variable to 5
> while debugging so i am guessing the ll_entry_count() function somehow
> returns the wrong value but i am not sure why. For reference this is the
> section in u-boot-spl.map file that contains the "root_driver":
>
>  __u_boot_list_2_driver_1
>                 0x0000000080009b78        0x0 drivers/core/root.o
>  __u_boot_list_2_driver_2_root_driver
>                 0x0000000080009c68       0x78 drivers/core/root.o
>                 0x0000000080009c68
>  _u_boot_list_2_driver_2_root_driver
> __u_boot_list_2_driver_3
>                 0x0000000080009dd0        0x0 drivers/core/root.o
>
> (gdb) x /8xw 0x0000000080009c68
> 0x80009c68 <_u_boot_list_2_driver_2_root_driver>: 0x800091a0 0x00000000
> 0x00000000 0x00000000
>
> By manually calculating (end-start)/size from the symbol addresses of the
> .map file i found the correct value to be 5 but ll_entry_count returns 0
> while the function lists_driver_lookup_name executes:
>
> (gdb) s
> 27 const int n_ents = ll_entry_count(struct driver, driver);
> (gdb) s
> 30 for (entry = drv; entry != drv + n_ents; entry++) {
> (gdb) info locals
> drv = 0x80009b78 <_u_boot_list_2_driver_2_cpu_bus>
> n_ents = 0
> entry = 0x80009b78 <_u_boot_list_2_driver_2_cpu_bus>(gdb) frame#0
>  lists_driver_lookup_name (name=0x800091a0 "root_driver")
>
>  I am not sure whats causing this but disabling CONFIG_FIT in my defconfig
> causes the program to execute without issues again. Could someone point out
> what i am missing here?

That is very strange. I can only suggest debugging it a bit more, e.g.
adding the code from ll_entry_count() into your function and seeing
what it shows. Is it a 64-bit platform?

See also LINKER_LIST_ALIGN

Regards,
Simon


More information about the U-Boot mailing list