[U-Boot] [PATCH 2/3] common: Implement support for linker-generated arrays
Marek Vasut
marex at denx.de
Mon Sep 24 18:52:05 CEST 2012
Dear Joe Hershberger,
[...]
> > +#define ll_entry_declare(_type, _name, _section_u, _section_d) \
> > + _type _u_boot_list_##_section_u##_##_name __attribute__(( \
> > + unused, aligned(4), \
> > + section(".u_boot_list."#_section_d"."#_name))); \
> > + _type _u_boot_list_##_section_u##_##_name
>
> Why repeat the "_type _u_boot_list_##_section_u##_##_name" instead of
> just leaving the semicolon off after the __attribute__()?
Good idea. Do you like my documentation fairytail btw ? :p
> > +
> > +/**
> > + * ll_entry_start() - Point to first entry of linker-generated array
> > + * _type: Data type of the entry
> > + * _section_u: Subsection of u_boot_list in which this entry is placed
> > + * (with underscores instead of dots)
> > + *
> > + * This function returns (_type *) pointer to the very first entry of a
> > + * linker-generated array placed into subsection of .u_boot_list section
> > + * specified by _section_u argument.
> > + *
> > + * Example of usage:
> > + *
> > + * struct my_sub_cmd *msc = ll_entry_start(struct my_sub_cmd, cmd_sub);
> > + */
> > +#define ll_entry_start(_type, _section_u) \
> > + ({ \
> > + extern _type _u_boot_list_##_section_u##__start; \
> > + _type *_ll_result = &_u_boot_list_##_section_u##__start;\
> > + _ll_result; \
> > + })
>
> Tricky. I didn't realize this gcc extension existed.
All this is a horrible pile of tricks
[...]
More information about the U-Boot
mailing list