[ELF2] Correctly set bits when -z now is specified.
The option now just sets NOW bit in DT_FLAGS_1 but some loaders
seem to require also BIND_NOW bit to be set in DT_FLAGS. This is,
also, what ld.bfd and gold do.
Differential Revision: http://reviews.llvm.org/D13883
llvm-svn: 250799
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index 13d3d9c..0bb436a 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -294,7 +294,7 @@
++NumEntries; // DT_INIT
if (FiniSym)
++NumEntries; // DT_FINI
- if (Config->Bsymbolic)
+ if (Config->Bsymbolic || Config->ZNow)
++NumEntries; // DT_FLAGS
if (Config->ZNodelete || Config->ZNow)
++NumEntries; // DT_FLAGS_1
@@ -371,6 +371,8 @@
uint32_t Flags = 0;
if (Config->Bsymbolic)
Flags |= DF_SYMBOLIC;
+ if (Config->ZNow)
+ Flags |= DF_BIND_NOW;
if (Flags)
WriteVal(DT_FLAGS, Flags);
Flags = 0;