gas/Dwarf: record functions
authorJan Beulich <jbeulich@suse.com>
Thu, 7 Apr 2022 06:18:00 +0000 (08:18 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 7 Apr 2022 06:18:00 +0000 (08:18 +0200)
commit591cc9fbbfd6d51131c0f1d4a92e7893edcc7a28
tree9ac81ea37fe5a69bf7b992be0a9f27ec22282b0c
parent0f47cb17d14172a5250b2146b82583271280d170
gas/Dwarf: record functions

To help tools like addr2line looking up function names, in particular
when dealing with e.g. PE/COFF binaries (linked from ELF objects), where
there's no ELF symbol table to fall back to, emit minimalistic
information for functions marked as such and having their size
specified.

Notes regarding the restriction to (pure) ELF:
- I realize this is a layering violation; I don't see how to deal with
  that in a better way.
- S_GET_SIZE(), when OBJ_MAYBE_ELF is defined, looks wrong: Unlike
  S_SET_SIZE() it does not check whether the hook is NULL.
- symbol_get_obj(), when OBJ_MAYBE_ELF is defined, looks unusable, as
  its return type can only ever be one object format's type (and this
  may then not be ELF's).

The new testcases are limited to x86 because I wanted to include the
case where function size can't be determined yet at the time Dwarf2 info
is generated. As .nops gains support by further targets, they could also
be added here then (with, as necessary, expecations suitably relaxed to
cover for insn size differences).
gas/dwarf2dbg.c
gas/testsuite/gas/elf/dwarf-3-func.d [new file with mode: 0644]
gas/testsuite/gas/elf/dwarf-3-func.s [new file with mode: 0644]
gas/testsuite/gas/elf/dwarf-5-func-global.d [new file with mode: 0644]
gas/testsuite/gas/elf/dwarf-5-func-local.d [new file with mode: 0644]
gas/testsuite/gas/elf/dwarf-5-func.d [new file with mode: 0644]
gas/testsuite/gas/elf/elf.exp