[PATCH] D132755: [DWARFLinker][NFC] Set the target DWARF version explicitly.

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 12:27:10 PDT 2022


avl created this revision.
avl added reviewers: aprantl, JDevlieghere, clayborg.
Herald added a subscriber: hiraditya.
Herald added a project: All.
avl requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Currently, DWARFLinker determines the target DWARF version internally.
It examines incoming object files, detects maximal
DWARF version and uses that version for the output file.
This patch allows explicitly setting output DWARF version by the consumer
of DWARFLinker. So that DWARFLinker uses a specified version instead
of autodetected one. It allows consumers to use different logic for
setting the target DWARF version. f.e. instead of the maximally used version
someone could set a higher version to convert from DWARFv4 to DWARFv5
(This possibility is not supported yet, but it would be good if
the interface will support it). Or another variant is to set the target
version through the command line.

The autodetection is moved into the consumers(DwarfLinkerForBinary.cpp,
DebugInfoLinker.cpp). The logic of autodetecting the DWARF version is changed.
Previously, the module version was also taken into account.
This patch does not take the version of the modules into account.
We have a similar assumption for the accelerator tables
(DWARFLinker.cpp:2366):

// If we haven't decided on an accelerator table kind yet, we base ourselves
// on the DWARF we have seen so far. At this point we haven't pulled in debug
// information from modules yet, so it is technically possible that they
// would affect the decision. However, as they're built with the same
// compiler and flags, it is safe to assume that they will follow the
// decision made here.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132755

Files:
  llvm/include/llvm/DWARFLinker/DWARFLinker.h
  llvm/lib/DWARFLinker/DWARFLinker.cpp
  llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
  llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132755.455994.patch
Type: text/x-patch
Size: 6379 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220826/b997afc0/attachment.bin>


More information about the llvm-commits mailing list