summaryrefslogtreecommitdiff
path: root/linker/linker.cpp
diff options
context:
space:
mode:
authorRyan Prichard <rprichard@google.com>2019-12-10 12:39:05 -0800
committerRyan Prichard <rprichard@google.com>2020-01-02 17:40:32 -0800
commitae320cde079439acac22c0d1f28c2737467a9c83 (patch)
treefb69549731c33e1a5c924dbd5b775cc900a964fb /linker/linker.cpp
parent84d00460df204a89c9a166a3c847d4359810abbc (diff)
Prelink each library only once
Previously, during a find_libraries call that loaded a library, a library was prelinked once for each DT_NEEDED reference to the library. This CL has a negligible effect on the linker relocation benchmark (146.9ms -> 146.2ms). Bug: none Test: bionic unit tests Change-Id: I385f312b8acf8d35aa0af9722131fe367b5edd9b
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r--linker/linker.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 54e0703c7..106923437 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -3346,6 +3346,7 @@ bool soinfo::relocate(const VersionTracker& version_tracker, ElfRelIteratorT&& r
static soinfo_list_t g_empty_list;
bool soinfo::prelink_image() {
+ if (flags_ & FLAG_PRELINKED) return true;
/* Extract dynamic section */
ElfW(Word) dynamic_flags = 0;
phdr_table_get_dynamic_section(phdr, phnum, load_bias, &dynamic, &dynamic_flags);
@@ -3840,6 +3841,8 @@ bool soinfo::prelink_image() {
// Don't call add_dlwarning because a missing DT_SONAME isn't important enough to show in the UI
}
+
+ flags_ |= FLAG_PRELINKED;
return true;
}