1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-27 10:23:41 +03:00

Add "-z nodlopen" and "-z nodelete"

This commit is contained in:
Rui Ueyama 2021-03-18 13:16:52 +09:00
parent 8f80533628
commit 9a477418e3
4 changed files with 12 additions and 0 deletions

View File

@ -301,6 +301,10 @@ void parse_nonpositional_args(std::span<std::string_view> args,
config.z_defs = true;
} else if (read_z_flag(args, "nodefs")) {
config.z_defs = false;
} else if (read_z_flag(args, "nodlopen")) {
config.z_dlopen = false;
} else if (read_z_flag(args, "nodelete")) {
config.z_delete = false;
} else if (read_flag(args, "no-undefined")) {
config.z_defs = true;
} else if (read_flag(args, "fork")) {

1
elf.h
View File

@ -171,6 +171,7 @@ static constexpr u32 DF_STATIC_TLS = 0x10;
static constexpr u32 DF_1_NOW = 0x00000001;
static constexpr u32 DF_1_NODELETE = 0x00000008;
static constexpr u32 DF_1_NOOPEN = 0x00000040;
static constexpr u32 DF_1_PIE = 0x08000000;
static constexpr u32 NT_GNU_BUILD_ID = 3;

2
mold.h
View File

@ -90,6 +90,8 @@ struct Config {
bool strip_debug = false;
bool trace = false;
bool z_defs = false;
bool z_delete = true;
bool z_dlopen = true;
bool z_execstack = false;
bool z_now = false;
bool z_relro = true;

View File

@ -381,6 +381,11 @@ static std::vector<u64> create_dynamic_section() {
flags1 |= DF_1_NOW;
}
if (!config.z_dlopen)
flags1 |= DF_1_NOOPEN;
if (!config.z_delete)
flags1 |= DF_1_NODELETE;
if (out::df_static_tls)
flags |= DF_STATIC_TLS;