[llvm] [LLVM][DWARF] Add support for .gnu_debuglink (PR #77715)

Alexander Yermolovich via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 14:47:38 PST 2024


================
@@ -127,6 +127,9 @@ class DWARFContext : public DIContext {
 
   std::unique_ptr<const DWARFObject> DObj;
 
+  /// Binary containing debug information after objcopy --only-keep-debug
+  object::OwningBinary<object::ObjectFile> GnuLink;
----------------
ayermolo wrote:

Looking more closely through DWARFContext.cpp except for dump in DWARFContext getting DwarfObject is controlled through getDWARFObj(). 
One alternative is in DWARFContext to have both gnulink one, and main binary one. Depending if gnulink is present in it return either it or main binary DWARFObject. With a default parameter in getDWARFObj that can override behavior for apis that need it. Like when eh_frame is used.

This way code can also be moved into constructor.

https://github.com/llvm/llvm-project/pull/77715


More information about the llvm-commits mailing list