From f6142e59339cbecdc3a2da9f969b953f4e85e3d8 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Fri, 15 May 2020 16:04:23 -0700 Subject: [PATCH] Add system link for libfdtrack.so libfdtrack.so is currently a library on the system image that's used via dlopen to debug file descriptor leaks. We may want to move this into the runtime module, but for now, add it as a system link. Bug: http://b/151688751 Bug: http://b/156571476 Test: added dlopen to adbd Change-Id: I21ebfe04d7ad85149e4df8a40911efd94ce5cf94 --- contents/common/system_links.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contents/common/system_links.cc b/contents/common/system_links.cc index 5dc9953..0cdeeb9 100644 --- a/contents/common/system_links.cc +++ b/contents/common/system_links.cc @@ -18,6 +18,7 @@ #include #include +#include #include #include "linkerconfig/context.h" @@ -41,6 +42,7 @@ using android::linkerconfig::modules::Namespace; using android::linkerconfig::modules::Section; void AddStandardSystemLinks(const Context& ctx, Section* section) { + const bool debuggable = android::base::GetBoolProperty("ro.debuggable", false); const std::string system_ns_name = ctx.GetSystemNamespaceName(); const bool is_section_vndk_enabled = ctx.IsSectionVndkEnabled(); section->ForEachNamespaces([&](Namespace& ns) { @@ -50,6 +52,10 @@ void AddStandardSystemLinks(const Context& ctx, Section* section) { ns.GetLink(system_ns_name) .AddSharedLib(Var("SANITIZER_RUNTIME_LIBRARIES")); } + if (debuggable) { + // Library on the system image that can be dlopened for debugging purposes. + ns.GetLink(system_ns_name).AddSharedLib("libfdtrack.so"); + } } }); } -- 2.11.0