diff options
Diffstat (limited to 'meta/classes-global/package.bbclass')
-rw-r--r-- | meta/classes-global/package.bbclass | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/meta/classes-global/package.bbclass b/meta/classes-global/package.bbclass index 2d985d8aff..7a0a428b30 100644 --- a/meta/classes-global/package.bbclass +++ b/meta/classes-global/package.bbclass | |||
@@ -490,16 +490,31 @@ def inject_minidebuginfo(file, dvar, dv, d): | |||
490 | bb.debug(1, 'ELF file {} has no debuginfo, skipping minidebuginfo injection'.format(file)) | 490 | bb.debug(1, 'ELF file {} has no debuginfo, skipping minidebuginfo injection'.format(file)) |
491 | return | 491 | return |
492 | 492 | ||
493 | # minidebuginfo does not make sense to apply to ELF objects other than | ||
494 | # executables and shared libraries, skip applying the minidebuginfo | ||
495 | # generation for objects like kernel modules. | ||
496 | for line in subprocess.check_output([readelf, '-h', debugfile], universal_newlines=True).splitlines(): | ||
497 | if not line.strip().startswith("Type:"): | ||
498 | continue | ||
499 | elftype = line.split(":")[1].strip() | ||
500 | if not any(elftype.startswith(i) for i in ["EXEC", "DYN"]): | ||
501 | bb.debug(1, 'ELF file {} is not executable/shared, skipping minidebuginfo injection'.format(file)) | ||
502 | return | ||
503 | break | ||
504 | |||
493 | # Find non-allocated PROGBITS, NOTE, and NOBITS sections in the debuginfo. | 505 | # Find non-allocated PROGBITS, NOTE, and NOBITS sections in the debuginfo. |
494 | # We will exclude all of these from minidebuginfo to save space. | 506 | # We will exclude all of these from minidebuginfo to save space. |
495 | remove_section_names = [] | 507 | remove_section_names = [] |
496 | for line in subprocess.check_output([readelf, '-W', '-S', debugfile], universal_newlines=True).splitlines(): | 508 | for line in subprocess.check_output([readelf, '-W', '-S', debugfile], universal_newlines=True).splitlines(): |
497 | fields = line.split() | 509 | # strip the leading " [ 1]" section index to allow splitting on space |
498 | if len(fields) < 8: | 510 | if ']' not in line: |
511 | continue | ||
512 | fields = line[line.index(']') + 1:].split() | ||
513 | if len(fields) < 7: | ||
499 | continue | 514 | continue |
500 | name = fields[0] | 515 | name = fields[0] |
501 | type = fields[1] | 516 | type = fields[1] |
502 | flags = fields[7] | 517 | flags = fields[6] |
503 | # .debug_ sections will be removed by objcopy -S so no need to explicitly remove them | 518 | # .debug_ sections will be removed by objcopy -S so no need to explicitly remove them |
504 | if name.startswith('.debug_'): | 519 | if name.startswith('.debug_'): |
505 | continue | 520 | continue |