summaryrefslogtreecommitdiff
path: root/linker/linker_config.cpp
diff options
context:
space:
mode:
authorSteven Laver <lavers@google.com>2019-08-07 15:49:43 -0700
committerSteven Laver <lavers@google.com>2019-08-07 15:49:43 -0700
commitbfda022dd6fbbcea60e9f52496d90ece514b32da (patch)
tree97c69d2bdd0e0ff59d55a0d2a8596ed678cded3e /linker/linker_config.cpp
parent70ebd716b3e81d304cda14d2bd77996cc2840962 (diff)
parent848e1d8a30a3465040edc27085927309fe6cbcff (diff)
Merge RP1A.190528.001
Change-Id: If6e905407e26a19e0266185af46b4ff461c4d45e
Diffstat (limited to 'linker/linker_config.cpp')
-rw-r--r--linker/linker_config.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp
index 774190418..46c91a3dd 100644
--- a/linker/linker_config.cpp
+++ b/linker/linker_config.cpp
@@ -417,9 +417,22 @@ class Properties {
if (resolve) {
std::vector<std::string> resolved_paths;
-
- // do not remove paths that do not exist
- resolve_paths(paths, &resolved_paths);
+ for (const auto& path : paths) {
+ if (path.empty()) {
+ continue;
+ }
+ // this is single threaded. no need to lock
+ auto cached = resolved_paths_.find(path);
+ if (cached == resolved_paths_.end()) {
+ resolved_paths_[path] = resolve_path(path);
+ cached = resolved_paths_.find(path);
+ }
+ CHECK(cached != resolved_paths_.end());
+ if (cached->second.empty()) {
+ continue;
+ }
+ resolved_paths.push_back(cached->second);
+ }
return resolved_paths;
} else {
@@ -442,6 +455,7 @@ class Properties {
return it;
}
std::unordered_map<std::string, PropertyValue> properties_;
+ std::unordered_map<std::string, std::string> resolved_paths_;
int target_sdk_version_;
DISALLOW_IMPLICIT_CONSTRUCTORS(Properties);