Re: [RFC v1 0/8] x86/init: Linux linker tables

From: H. Peter Anvin
Date: Thu Dec 17 2015 - 23:41:04 EST


On 12/17/15 20:25, H. Peter Anvin wrote:
>
> /* DECLARE_LINKTABLE_RO */
> extern const struct foo tablename[], tablename__end[];
>
> /* DEFINE_LINKTABLE_RO */
> DECLARE_LINKTABLE_RO(struct foo, tablename);
>
> const struct
> foo__attribute__((used,section(".rodata.tbl.tablename.0"))) tablename[0];
>
> const struct
> foo__attribute__((used,section(".rodata.tbl.tablename.999")))
> tablename__end[0];
>
> /* LINKTABLE_RO */
> static const __typeof__(tablename)
> __attribute__((used,section(".rodata.tbl.tablename.50")))
> __tbl_tablename_12345
>
> /* LINKTABLE_SIZE */
> ((tablename__end) - (tablename))
>
> ... and so on for all the possible sections where we may want tables.
>

Come to think of it, we could even eliminate the need for a DEFINE
entirely if we made the start and end symbols static. However, this
would generate an awful lot of identical-but-local symbols which
probably would make the linker slower and definitely would bloat the
debug data.

-hpa


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/