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

Ed Maste via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 25 04:59:16 PST 2015


emaste updated this revision to Diff 43628.
emaste added a comment.

Drop MIPS special-case; DT_DEBUG is not currently used on MIPS but it doesn't hurt anything to leave the entry there either.


http://reviews.llvm.org/D15775

Files:
  ELF/OutputSections.cpp
  test/ELF/dt_tags.s

Index: test/ELF/dt_tags.s
===================================================================
--- /dev/null
+++ test/ELF/dt_tags.s
@@ -0,0 +1,18 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t
+# RUN: ld.lld -shared %t -o %t.so
+# RUN: ld.lld %t %t.so -o %t.exe
+# RUN: llvm-readobj -dynamic-table %t.so | FileCheck -check-prefix=DSO %s
+# RUN: llvm-readobj -dynamic-table %t.exe | FileCheck -check-prefix=EXE %s
+
+# EXE: DynamicSection [
+# EXE:   0x0000000000000015 DEBUG                0x0
+# EXE: ]
+
+# DSO: DynamicSection [
+# DSO-NOT:   0x0000000000000015 DEBUG                0x0
+# DSO: ]
+
+.globl _start
+_start:
Index: ELF/OutputSections.cpp
===================================================================
--- ELF/OutputSections.cpp
+++ ELF/OutputSections.cpp
@@ -642,6 +642,9 @@
   if (DtFlags1)
     ++NumEntries; // DT_FLAGS_1
 
+  if (!Config->Entry.empty())
+    ++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->Entry.empty())
+    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.43628.patch
Type: text/x-patch
Size: 1341 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151225/93a6b531/attachment.bin>


More information about the llvm-commits mailing list