1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-28 19:04:27 +03:00
This commit is contained in:
Rui Ueyama 2021-03-29 14:40:00 +09:00
parent f524122e6a
commit 30d104a0e6
3 changed files with 10 additions and 9 deletions

View File

@ -368,9 +368,9 @@ void parse_nonpositional_args(Context &ctx,
ctx.arg.rpaths += ":";
ctx.arg.rpaths += arg;
} else if (read_arg(args, arg, "version-script")) {
parse_version_script(std::string(arg));
parse_version_script(ctx, std::string(arg));
} else if (read_arg(args, arg, "dynamic-list")) {
parse_dynamic_list(std::string(arg));
parse_dynamic_list(ctx, std::string(arg));
} else if (read_flag(args, "build-id")) {
ctx.arg.build_id.kind = BuildId::HASH;
ctx.arg.build_id.hash_size = 20;

View File

@ -209,7 +209,8 @@ static bool read_label(std::span<std::string_view> &tok,
return false;
}
static void parse_version_script_commands(std::span<std::string_view> &tok,
static void parse_version_script_commands(Context &ctx,
std::span<std::string_view> &tok,
i16 &ver, bool is_extern_cpp) {
bool is_global = true;
@ -228,7 +229,7 @@ static void parse_version_script_commands(std::span<std::string_view> &tok,
tok = tok.subspan(1);
tok = skip(tok, "\"C++\"");
tok = skip(tok, "{");
parse_version_script_commands(tok, ver, true);
parse_version_script_commands(ctx, tok, ver, true);
tok = skip(tok, "}");
tok = skip(tok, ";");
continue;
@ -242,7 +243,7 @@ static void parse_version_script_commands(std::span<std::string_view> &tok,
}
}
void parse_version_script(std::string path) {
void parse_version_script(Context &ctx, std::string path) {
current_file = MemoryMappedFile::must_open(path);
std::vector<std::string_view> vec = tokenize(current_file->get_contents());
std::span<std::string_view> tok = vec;
@ -257,7 +258,7 @@ void parse_version_script(std::string path) {
}
tok = skip(tok, "{");
parse_version_script_commands(tok, ver, false);
parse_version_script_commands(ctx, tok, ver, false);
tok = skip(tok, "}");
if (!tok.empty() && tok[0] != ";")
tok = tok.subspan(1);
@ -268,7 +269,7 @@ void parse_version_script(std::string path) {
SyntaxError(tok[0]) << "trailing garbage token";
}
void parse_dynamic_list(std::string path) {
void parse_dynamic_list(Context &ctx, std::string path) {
current_file = MemoryMappedFile::must_open(path);
std::vector<std::string_view> vec = tokenize(current_file->get_contents());
std::span<std::string_view> tok = vec;

4
mold.h
View File

@ -923,8 +923,8 @@ std::vector<MemoryMappedFile *> read_thin_archive_members(MemoryMappedFile *mb);
//
void parse_linker_script(Context &ctx, MemoryMappedFile *mb);
void parse_version_script(std::string path);
void parse_dynamic_list(std::string path);
void parse_version_script(Context &ctx, std::string path);
void parse_dynamic_list(Context &ctx, std::string path);
//
// output_file.cc