Index: lld/trunk/ELF/OutputSections.cpp =================================================================== --- lld/trunk/ELF/OutputSections.cpp +++ lld/trunk/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; Index: lld/trunk/test/elf2/dt_flags.s =================================================================== --- lld/trunk/test/elf2/dt_flags.s +++ lld/trunk/test/elf2/dt_flags.s @@ -8,12 +8,12 @@ # RUN: llvm-readobj -dynamic-table %t2 | FileCheck %s # FLAGS: DynamicSection [ -# FLAGS: 0x000000000000001E FLAGS SYMBOLIC +# FLAGS: 0x000000000000001E FLAGS SYMBOLIC BIND_NOW # FLAGS: 0x000000006FFFFFFB FLAGS_1 NOW NODELETE # FLAGS: ] # CHECK: DynamicSection [ -# CHECK-NOT: 0x000000000000001E FLAGS SYMBOLIC +# CHECK-NOT: 0x000000000000001E FLAGS SYMBOLIC BIND_NOW # CHECK-NOT: 0x000000006FFFFFFB FLAGS_1 NOW NODELETE # CHECK: ]