linker_lists: Add a function to access a linker list entry

Once declared, you cannot access a linker_list entry since you do not have
a symbol name for it. Add llsym() macro to provide this. This avoids
searching for the symbol at run-time based on name.

An example usage is to declare a driver with U_BOOT_DRIVER(), then obtain
a pointer to that driver later.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
This commit is contained in:
Simon Glass 2015-03-25 12:21:49 -06:00
parent 63c9729a13
commit 72538f4c3e

View File

@ -102,6 +102,16 @@
* %u_boot_list_2_drivers_3
*/
/**
* ll_sym() - Access a linker-generated array entry
* @_type: Data type of the entry
* @_name: Name of the entry
* @_list: name of the list. Should contain only characters allowed
* in a C variable name!
*/
#define llsym(_type, _name, _list) \
((_type *)&_u_boot_list_2_##_list##_2_##_name)
/**
* ll_entry_declare() - Declare linker-generated array entry
* @_type: Data type of the entry