diff --git a/object_file.cc b/object_file.cc index 64f8bdb1..9685dfe4 100644 --- a/object_file.cc +++ b/object_file.cc @@ -1176,7 +1176,8 @@ void ObjectFile::write_symtab(Context &ctx) { } bool is_c_identifier(std::string_view name) { - static std::regex re("[a-zA-Z_][a-zA-Z0-9_]*"); + static std::regex re("[a-zA-Z_][a-zA-Z0-9_]*", + std::regex_constants::optimize); return std::regex_match(name.begin(), name.end(), re); } diff --git a/passes.cc b/passes.cc index 4d98848d..fc3c7df1 100644 --- a/passes.cc +++ b/passes.cc @@ -311,7 +311,7 @@ void sort_init_fini(Context &ctx) { Timer t(ctx, "sort_init_fini"); auto get_priority = [](InputSection *isec) { - static std::regex re(R"(_array\.(\d+)$)"); + static std::regex re(R"(_array\.(\d+)$)", std::regex_constants::optimize); std::string name = isec->name().begin(); std::smatch m; if (std::regex_search(name, m, re))