[PATCH] D15775: Add debugger rendezvous DT_DEBUG .dynamic entry

Ed Maste via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 24 11:19:24 PST 2015


emaste created this revision.
emaste added reviewers: ruiu, rafael.
emaste added subscribers: llvm-commits, davide.

The runtime linker may store a pointer to a data structure used by debuggers. This allows gdb and lldb to debug lld-linked binaries.

I can combine it as an else case in the existing `if (Config->EMachine == EM_MIPS)` block if that's preferred.

http://reviews.llvm.org/D15775

Files:
  ELF/OutputSections.cpp

Index: ELF/OutputSections.cpp
===================================================================
--- ELF/OutputSections.cpp
+++ ELF/OutputSections.cpp
@@ -642,6 +642,9 @@
   if (DtFlags1)
     ++NumEntries; // DT_FLAGS_1
 
+  if (Config->EMachine != EM_MIPS)
+    ++NumEntries; // DT_DEBUG
+
   if (Config->EMachine == EM_MIPS) {
     ++NumEntries; // DT_MIPS_RLD_VERSION
     ++NumEntries; // DT_MIPS_FLAGS
@@ -740,6 +743,8 @@
     WriteVal(DT_FLAGS, DtFlags);
   if (DtFlags1)
     WriteVal(DT_FLAGS_1, DtFlags1);
+  if (Config->EMachine != EM_MIPS)
+    WriteVal(DT_DEBUG, 0);
 
   // See "Dynamic Section" in Chapter 5 in the following document
   // for detailed description:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15775.43611.patch
Type: text/x-patch
Size: 682 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151224/f93760fa/attachment.bin>


More information about the llvm-commits mailing list