LOG_BACKEND_DEFINE(): use Z_STRUCT_SECTION_ITERABLE()

Replace the open coded section attribute by Z_STRUCT_SECTION_ITERABLE()
to properly align structure instances on 64-bit targets.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
Nicolas Pitre 2019-08-04 22:33:05 -04:00 committed by Carles Cufí
commit cd4e7893ea
2 changed files with 2 additions and 3 deletions

View file

@ -143,7 +143,7 @@
SECTION_DATA_PROLOGUE(log_backends_sections,,) SECTION_DATA_PROLOGUE(log_backends_sections,,)
{ {
__log_backends_start = .; __log_backends_start = .;
KEEP(*(".log_backends")); KEEP(*("._log_backend.*"));
__log_backends_end = .; __log_backends_end = .;
} GROUP_LINK_IN(ROMABLE_REGION) } GROUP_LINK_IN(ROMABLE_REGION)

View file

@ -78,8 +78,7 @@ extern const struct log_backend __log_backends_end[0];
.active = false, \ .active = false, \
.id = 0, \ .id = 0, \
}; \ }; \
static const struct log_backend _name \ static const Z_STRUCT_SECTION_ITERABLE(log_backend, _name) = \
__attribute__ ((section(".log_backends"))) __attribute__((used)) = \
{ \ { \
.api = &_api, \ .api = &_api, \
.cb = &UTIL_CAT(backend_cb_, _name), \ .cb = &UTIL_CAT(backend_cb_, _name), \