diff options
-rw-r--r-- | lld/ELF/Config.h | 1 | ||||
-rw-r--r-- | lld/ELF/Driver.cpp | 5 | ||||
-rw-r--r-- | lld/ELF/SyntheticSections.cpp | 2 | ||||
-rw-r--r-- | lld/docs/ld.lld.1 | 4 | ||||
-rw-r--r-- | lld/test/ELF/dt_flags.s | 6 |
5 files changed, 13 insertions, 5 deletions
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h index c669a04ecf3..37f713f1843 100644 --- a/lld/ELF/Config.h +++ b/lld/ELF/Config.h @@ -189,6 +189,7 @@ struct Configuration { bool ZInitfirst; bool ZInterpose; bool ZKeepTextSectionPrefix; + bool ZNodefaultlib; bool ZNodelete; bool ZNodlopen; bool ZNow; diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 956f0b37346..37fab4c9642 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -350,8 +350,8 @@ static bool isKnownZFlag(StringRef S) { S == "execstack" || S == "global" || S == "hazardplt" || S == "initfirst" || S == "interpose" || S == "keep-text-section-prefix" || S == "lazy" || S == "muldefs" || - S == "nocombreloc" || S == "nocopyreloc" || S == "nodelete" || - S == "nodlopen" || S == "noexecstack" || + S == "nocombreloc" || S == "nocopyreloc" || S == "nodefaultlib" || + S == "nodelete" || S == "nodlopen" || S == "noexecstack" || S == "nokeep-text-section-prefix" || S == "norelro" || S == "notext" || S == "now" || S == "origin" || S == "relro" || S == "retpolineplt" || S == "rodynamic" || S == "text" || S == "wxneeded" || @@ -876,6 +876,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) { Config->ZInterpose = hasZOption(Args, "interpose"); Config->ZKeepTextSectionPrefix = getZFlag( Args, "keep-text-section-prefix", "nokeep-text-section-prefix", false); + Config->ZNodefaultlib = hasZOption(Args, "nodefaultlib"); Config->ZNodelete = hasZOption(Args, "nodelete"); Config->ZNodlopen = hasZOption(Args, "nodlopen"); Config->ZNow = getZFlag(Args, "now", "lazy", false); diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index bf62dcd3ada..9f4554e1d63 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -1268,6 +1268,8 @@ template <class ELFT> void DynamicSection<ELFT>::finalizeContents() { DtFlags1 |= DF_1_INITFIRST; if (Config->ZInterpose) DtFlags1 |= DF_1_INTERPOSE; + if (Config->ZNodefaultlib) + DtFlags1 |= DF_1_NODEFLIB; if (Config->ZNodelete) DtFlags1 |= DF_1_NODELETE; if (Config->ZNodlopen) diff --git a/lld/docs/ld.lld.1 b/lld/docs/ld.lld.1 index 417706dd0ab..d1ce4a3517f 100644 --- a/lld/docs/ld.lld.1 +++ b/lld/docs/ld.lld.1 @@ -496,6 +496,10 @@ This is a synonym for Disable combining and sorting multiple relocation sections. .It Cm nocopyreloc Disable the creation of copy relocations. +.It Cm nodefaultlib +Set the +.Dv DF_1_NODEFLIB +flag to indicate that default library search paths should be ignored. .It Cm nodelete Set the .Dv DF_1_NODELETE diff --git a/lld/test/ELF/dt_flags.s b/lld/test/ELF/dt_flags.s index 8f84dfca0db..5f6addd0780 100644 --- a/lld/test/ELF/dt_flags.s +++ b/lld/test/ELF/dt_flags.s @@ -3,8 +3,8 @@ # 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 global -z initfirst -z interpose -z now -z nodelete \ -# RUN: -z nodlopen -z origin -Bsymbolic %t %t.so -o %t1 +# RUN: ld.lld -z global -z initfirst -z interpose -z now -z nodefaultlib \ +# RUN: -z nodelete -z nodlopen -z origin -Bsymbolic %t %t.so -o %t1 # RUN: llvm-readobj -dynamic-table %t1 | FileCheck -check-prefix=FLAGS %s # RUN: ld.lld %t %t.so -o %t2 @@ -15,7 +15,7 @@ # FLAGS: DynamicSection [ # FLAGS: 0x000000000000001E FLAGS ORIGIN SYMBOLIC BIND_NOW -# FLAGS: 0x000000006FFFFFFB FLAGS_1 NOW GLOBAL NODELETE INITFIRST NOOPEN ORIGIN INTERPOSE +# FLAGS: 0x000000006FFFFFFB FLAGS_1 NOW GLOBAL NODELETE INITFIRST NOOPEN ORIGIN INTERPOSE NODEFLIB # FLAGS: ] # CHECK: DynamicSection [ |