diff options
Diffstat (limited to 'src/readelf.c')
| -rw-r--r-- | src/readelf.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/readelf.c b/src/readelf.c index 0b464596..c2561024 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -7851,6 +7851,24 @@ handle_core_items (Elf *core, const void *desc, size_t descsz, { if (nitems == 0) return 0; + unsigned int colno = 0; + + /* FORMAT '\n' makes sense to be present only as a single item as it + processes all the data of a note. FORMATs 'b' and 'B' have a special case + if present as a single item but they can be also processed with other + items below. */ + if (nitems == 1 && (items[0].format == '\n' || items[0].format == 'b' + || items[0].format == 'B')) + { + assert (items[0].offset == 0); + size_t size = descsz; + colno = handle_core_item (core, items, desc, colno, &size); + /* If SIZE is not zero here there is some remaining data. But we do not + know how to process it anyway. */ + return colno; + } + for (size_t i = 0; i < nitems; ++i) + assert (items[i].format != '\n'); /* Sort to collect the groups together. */ const Ebl_Core_Item *sorted_items[nitems]; @@ -7869,23 +7887,7 @@ handle_core_items (Elf *core, const void *desc, size_t descsz, qsort (groups, ngroups, sizeof groups[0], &compare_core_item_groups); /* Write out all the groups. */ - unsigned int colno = 0; - const void *last = desc; - if (nitems == 1) - { - size_t size = descsz; - /* If this note contains registers as well as items, don't pass - &size to express that we don't wish to repeat. */ - colno = handle_core_item (core, sorted_items[0], desc, colno, - size != 0 ? &size : NULL); - - if (size == 0) - return colno; - desc += descsz - size; - descsz = size; - } - do { for (size_t i = 0; i < ngroups; ++i) |
