[DWARFv5][DWARFLinker] Remove dsymutil-classic compatibility feature as it leads...
authorAlexey Lapshin <a.v.lapshin@mail.ru>
Tue, 27 Jun 2023 19:27:34 +0000 (21:27 +0200)
committerAlexey Lapshin <a.v.lapshin@mail.ru>
Thu, 29 Jun 2023 13:40:04 +0000 (15:40 +0200)
commit4546015f867ac19823116374bb1fb21f27bd2447
tree9c8039d74f53863b7051605832cdd52c7028d8f2
parentd95c2c27f890bad94cdf9db6416e5a666527f0dd
[DWARFv5][DWARFLinker] Remove dsymutil-classic compatibility feature as it leads to an error.

DWARFLinker has a compatibility feature with dsymutil-classic.
It may keep location expression attribute even if does not
reference live address. Current llvm-dwarfdump --verify
reports a error if variable references an address but is not
added into the .debug_names table.

error: Name Index @ 0x0: Entry for DIE @ 0xf35 (DW_TAG_variable) with name seed missing.

DW_TAG_variable
  DW_AT_name      ("seed")
  DW_AT_type      (0x00000000000047b7 "uint64_t")
  DW_AT_location  (DW_OP_addr 0x9ff8)  <<<< dead address

DWARFLinker does not add the variable into .debug_names table
because it references dead address. To have a valid variable and
consistent accelerator table it is necessary to remove location expression
referencing dead address. This patch removes dsymutil-classic
compatibilty feature.

Differential Revision: https://reviews.llvm.org/D153988
llvm/include/llvm/DWARFLinker/DWARFLinker.h
llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h
llvm/lib/DWARFLinker/DWARFLinker.cpp
llvm/test/tools/dsymutil/X86/dead-stripped.cpp