Commit c128825c authored by Brad Smith's avatar Brad Smith
Browse files

Merging r298567:

------------------------------------------------------------------------
r298567 | davide | 2017-03-22 20:54:16 -0400 (Wed, 22 Mar 2017) | 3 lines

[ELF] Add -z nodlopen option.

Patch by Mark Kettenis.
------------------------------------------------------------------------

llvm-svn: 303455
parent c564b936
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ struct Configuration {
  bool ZCombreloc;
  bool ZExecstack;
  bool ZNodelete;
  bool ZNodlopen;
  bool ZNow;
  bool ZOrigin;
  bool ZRelro;
+1 −0
Original line number Diff line number Diff line
@@ -548,6 +548,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
  Config->ZCombreloc = !hasZOption(Args, "nocombreloc");
  Config->ZExecstack = hasZOption(Args, "execstack");
  Config->ZNodelete = hasZOption(Args, "nodelete");
  Config->ZNodlopen = hasZOption(Args, "nodlopen");
  Config->ZNow = hasZOption(Args, "now");
  Config->ZOrigin = hasZOption(Args, "origin");
  Config->ZRelro = !hasZOption(Args, "norelro");
+2 −0
Original line number Diff line number Diff line
@@ -816,6 +816,8 @@ template <class ELFT> void DynamicSection<ELFT>::addEntries() {
    DtFlags |= DF_SYMBOLIC;
  if (Config->ZNodelete)
    DtFlags1 |= DF_1_NODELETE;
  if (Config->ZNodlopen)
    DtFlags1 |= DF_1_NOOPEN;
  if (Config->ZNow) {
    DtFlags |= DF_BIND_NOW;
    DtFlags1 |= DF_1_NOW;
+3 −3
Original line number Diff line number Diff line
@@ -2,19 +2,19 @@

# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
# RUN: ld.lld -shared %t -o %t.so
# RUN: ld.lld -z now -z nodelete -z origin -Bsymbolic %t %t.so -o %t1
# RUN: ld.lld -z now -z nodelete -z nodlopen -z origin -Bsymbolic %t %t.so -o %t1
# RUN: ld.lld %t %t.so -o %t2
# RUN: llvm-readobj -dynamic-table %t1 | FileCheck -check-prefix=FLAGS %s
# RUN: llvm-readobj -dynamic-table %t2 | FileCheck %s

# FLAGS: DynamicSection [
# FLAGS:   0x000000000000001E FLAGS ORIGIN SYMBOLIC BIND_NOW
# FLAGS:   0x000000006FFFFFFB FLAGS_1 NOW NODELETE ORIGIN
# FLAGS:   0x000000006FFFFFFB FLAGS_1 NOW NODELETE NOOPEN ORIGIN
# FLAGS: ]

# CHECK: DynamicSection [
# CHECK-NOT:   0x000000000000001E FLAGS ORIGIN SYMBOLIC BIND_NOW
# CHECK-NOT:   0x000000006FFFFFFB FLAGS_1 NOW NODELETE ORIGIN
# CHECK-NOT:   0x000000006FFFFFFB FLAGS_1 NOW NODELETE NOOPEN ORIGIN
# CHECK: ]

.globl _start