Re: [RFC v2 2/7] tables.h: add linker table support

From: H. Peter Anvin
Date: Fri Feb 19 2016 - 15:30:48 EST


On 02/19/2016 05:45 AM, Luis R. Rodriguez wrote:
> +
> +/**
> + * DOC: Regular linker linker table constructors
> + *
> + * Regular constructors are expected to be used for valid linker table entries.
> + * Valid uses of weak entries other than the beginning and is currently
> + * untested but should in theory work.
> + */
> +
> +/**
> + * LINKTABLE_TEXT - Declares a linker table entry for execution
> + *
> + * @name: linker table name
> + * @level: order level
> + *
> + * Declares a linker table to be used for execution.
> + */
> +#define LINKTABLE_TEXT(name, level) \
> + __typeof__(name[0]) \
> + __attribute__((used, \
> + __aligned__(LINKTABLE_ALIGNMENT(name)), \
> + section(SECTION_TBL(SECTION_TEXT, name, level))))

I'm really confused by this. Text should obviously be readonly, but I'm
not at all clear how this works here.

The issue with linktables for text is kind of confusing if nothing else;
Russel is right about that. It doesn't prevent us from doing something
similar, but perhaps it ought to have a different name.

For one thing, priority level is meaningless for text, since it is not a
table that can be indexed into.

-hpa