diff --git a/cmdline.cc b/cmdline.cc index 0e35132d..4075e068 100644 --- a/cmdline.cc +++ b/cmdline.cc @@ -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; diff --git a/linker_script.cc b/linker_script.cc index d0544b51..4c2e1350 100644 --- a/linker_script.cc +++ b/linker_script.cc @@ -209,7 +209,8 @@ static bool read_label(std::span &tok, return false; } -static void parse_version_script_commands(std::span &tok, +static void parse_version_script_commands(Context &ctx, + std::span &tok, i16 &ver, bool is_extern_cpp) { bool is_global = true; @@ -228,7 +229,7 @@ static void parse_version_script_commands(std::span &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 &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 vec = tokenize(current_file->get_contents()); std::span 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 vec = tokenize(current_file->get_contents()); std::span tok = vec; diff --git a/mold.h b/mold.h index 97698855..8c24ad78 100644 --- a/mold.h +++ b/mold.h @@ -923,8 +923,8 @@ std::vector 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