Index: ELF/Config.h =================================================================== --- ELF/Config.h +++ ELF/Config.h @@ -188,6 +188,7 @@ bool ZKeepTextSectionPrefix; bool ZNodelete; bool ZNodlopen; + bool ZNodump; bool ZNow; bool ZOrigin; bool ZRelro; Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -344,7 +344,7 @@ S == "initfirst" || S == "interpose" || S == "keep-text-section-prefix" || S == "lazy" || S == "muldefs" || S == "nocombreloc" || S == "nocopyreloc" || S == "nodelete" || - S == "nodlopen" || S == "noexecstack" || + S == "nodlopen" || S == "nodump" || 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" || @@ -842,6 +842,7 @@ Args, "keep-text-section-prefix", "nokeep-text-section-prefix", false); Config->ZNodelete = hasZOption(Args, "nodelete"); Config->ZNodlopen = hasZOption(Args, "nodlopen"); + Config->ZNodump = hasZOption(Args, "nodump"); Config->ZNow = getZFlag(Args, "now", "lazy", false); Config->ZOrigin = hasZOption(Args, "origin"); Config->ZRelro = getZFlag(Args, "relro", "norelro", true); Index: ELF/SyntheticSections.cpp =================================================================== --- ELF/SyntheticSections.cpp +++ ELF/SyntheticSections.cpp @@ -1274,6 +1274,8 @@ DtFlags1 |= DF_1_NODELETE; if (Config->ZNodlopen) DtFlags1 |= DF_1_NOOPEN; + if (Config->ZNodump) + DtFlags1 |= DF_1_NODUMP; if (Config->ZNow) { DtFlags |= DF_BIND_NOW; DtFlags1 |= DF_1_NOW; Index: docs/ld.lld.1 =================================================================== --- docs/ld.lld.1 +++ docs/ld.lld.1 @@ -470,6 +470,10 @@ .Dv DF_1_NOOPEN flag to indcate that the object may not be opened by .Xr dlopen 3 . +.It Cm nodump +Set the +.Dv DF_1_NODUMP +flag to indicate that the object may not be dumped by the runtime linker. .It Cm norelro Do not indicate that portions of the object shold be mapped read-only after initial relocation processing. Index: test/ELF/dt_flags.s =================================================================== --- test/ELF/dt_flags.s +++ test/ELF/dt_flags.s @@ -4,7 +4,7 @@ # 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: -z nodlopen -z nodump -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 NODUMP # FLAGS: ] # CHECK: DynamicSection [