[ELF] Only binaries should have DT_DEBUG entry
authorPetr Hosek <phosek@chromium.org>
Wed, 7 Dec 2016 02:05:42 +0000 (02:05 +0000)
committerPetr Hosek <phosek@chromium.org>
Wed, 7 Dec 2016 02:05:42 +0000 (02:05 +0000)
The presence of DT_DEBUG entry is unrelated to the existence of entry point.

Differential Revision: https://reviews.llvm.org/D27496

llvm-svn: 288877

lld/ELF/SyntheticSections.cpp

index c3888dc..3653354 100644 (file)
@@ -795,7 +795,7 @@ template <class ELFT> void DynamicSection<ELFT>::addEntries() {
   if (DtFlags1)
     add({DT_FLAGS_1, DtFlags1});
 
-  if (!Config->Entry.empty())
+  if (!Config->Shared && !Config->Relocatable)
     add({DT_DEBUG, (uint64_t)0});
 }