ctf: handle DW_AT_specification
Newer compilers (GCC 5+ in particular) save space in DWARF 2 debug info by
generating copious DW_AT_specification attributes linking uses to
declarations, allowing them to elide names (among other things). (However, it
looks like earlier GCCs might emit the attribute too, if less often.)
dwarf2ctf does not understand this attribute, leading to a kernel compilation
failure with much screaming like this:
init/main.c:113:early_boot_irqs_disabled: assemble_ctf_variable: 14c22:
skipping type, name attribute not present.
init/main.c:115:system_state: assemble_ctf_variable: 14c33: skipping type,
name attribute not present.
init/main.c:126:late_time_init: assemble_ctf_variable: 14cac: skipping type,
name attribute not present.
init/main.c:129:boot_command_line: assemble_ctf_variable: 14cbd: skipping
type, name attribute not present.
init/main.c:131:saved_command_line: assemble_ctf_variable: 14cce: skipping
type, name attribute not present.
Adding support for it is not hard: we just need to wrap most calls to
dwarf_hasattr() and dwarf_attr() to chase DW_AT_specification if need
be. (The only things that should not be wrapped are calls inside the
wrappers themselves, and any lookups of DW_AT_declaration, which is
always set in the DIE referenced by DW_AT_specification even if it is
not considered set in the referee.)
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Tomas Jedlicka <tomas.jedlicka@oracle.com>
Orabug:
26386100