Skip to content

Commit

Permalink
[ELF] Add -z nodlopen option.
Browse files Browse the repository at this point in the history
Patch by Mark Kettenis.

llvm-svn: 298567
  • Loading branch information
dcci committed Mar 23, 2017
1 parent 351d2c3 commit 7690721
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions lld/ELF/Config.h
Expand Up @@ -142,6 +142,7 @@ struct Configuration {
bool ZExecstack;
bool ZNocopyreloc;
bool ZNodelete;
bool ZNodlopen;
bool ZNow;
bool ZOrigin;
bool ZRelro;
Expand Down
1 change: 1 addition & 0 deletions lld/ELF/Driver.cpp
Expand Up @@ -619,6 +619,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
Config->ZExecstack = hasZOption(Args, "execstack");
Config->ZNocopyreloc = hasZOption(Args, "nocopyreloc");
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");
Expand Down
2 changes: 2 additions & 0 deletions lld/ELF/SyntheticSections.cpp
Expand Up @@ -1034,6 +1034,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;
Expand Down
6 changes: 3 additions & 3 deletions lld/test/ELF/dt_flags.s
Expand Up @@ -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
Expand Down

0 comments on commit 7690721

Please sign in to comment.