driver_list: unbreak list of builtin drivers for LTO configurations
Check for the availability of the "no_reorder" linker attribute, which keeps the list of builtin drivers in shape on LTO enabled build setups. Keep backwards compatibility for platforms which lack support for the "no_reorder" attribute. Phrase the implementation such that other keywords as well as user provided external specs are possible. This resolves bug #1433. Submitted-By: Ivan Mironov <mironov.ivan@gmail.com>
This commit is contained in:
parent
efce57da32
commit
3decd3b1f0
|
@ -28,6 +28,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SR_PRIV const struct sr_dev_driver *sr_driver_list__start[]
|
SR_PRIV const struct sr_dev_driver *sr_driver_list__start[]
|
||||||
|
SR_DRIVER_LIST_NOREORDER
|
||||||
__attribute__((section (SR_DRIVER_LIST_SECTION),
|
__attribute__((section (SR_DRIVER_LIST_SECTION),
|
||||||
used, aligned(sizeof(struct sr_dev_driver *))))
|
used, aligned(sizeof(struct sr_dev_driver *))))
|
||||||
= { NULL /* Dummy item, as zero length arrays are not allowed by C99 */ };
|
= { NULL /* Dummy item, as zero length arrays are not allowed by C99 */ };
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SR_PRIV const struct sr_dev_driver *sr_driver_list__stop[]
|
SR_PRIV const struct sr_dev_driver *sr_driver_list__stop[]
|
||||||
|
SR_DRIVER_LIST_NOREORDER
|
||||||
__attribute__((section (SR_DRIVER_LIST_SECTION),
|
__attribute__((section (SR_DRIVER_LIST_SECTION),
|
||||||
used, aligned(sizeof(struct sr_dev_driver *))))
|
used, aligned(sizeof(struct sr_dev_driver *))))
|
||||||
= { NULL /* Dummy item, as zero length arrays are not allowed by C99 */ };
|
= { NULL /* Dummy item, as zero length arrays are not allowed by C99 */ };
|
||||||
|
|
|
@ -967,6 +967,15 @@ static inline void write_dblle_inc(uint8_t **p, double x)
|
||||||
#define SR_DRIVER_LIST_SECTION "__sr_driver_list"
|
#define SR_DRIVER_LIST_SECTION "__sr_driver_list"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined SR_DRIVER_LIST_NOREORDER && defined __has_attribute
|
||||||
|
#if __has_attribute(no_reorder)
|
||||||
|
#define SR_DRIVER_LIST_NOREORDER __attribute__((no_reorder))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !defined SR_DRIVER_LIST_NOREORDER
|
||||||
|
#define SR_DRIVER_LIST_NOREORDER /* EMPTY */
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a list of hardware drivers.
|
* Register a list of hardware drivers.
|
||||||
*
|
*
|
||||||
|
@ -996,6 +1005,7 @@ static inline void write_dblle_inc(uint8_t **p, double x)
|
||||||
*/
|
*/
|
||||||
#define SR_REGISTER_DEV_DRIVER_LIST(name, ...) \
|
#define SR_REGISTER_DEV_DRIVER_LIST(name, ...) \
|
||||||
static const struct sr_dev_driver *name[] \
|
static const struct sr_dev_driver *name[] \
|
||||||
|
SR_DRIVER_LIST_NOREORDER \
|
||||||
__attribute__((section (SR_DRIVER_LIST_SECTION), used, \
|
__attribute__((section (SR_DRIVER_LIST_SECTION), used, \
|
||||||
aligned(sizeof(struct sr_dev_driver *)))) \
|
aligned(sizeof(struct sr_dev_driver *)))) \
|
||||||
= { \
|
= { \
|
||||||
|
|
Loading…
Reference in New Issue