diff options
author | Christopher Ferris <cferris@google.com> | 2016-06-22 19:37:31 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-06-22 19:37:31 +0000 |
commit | 1b4f54e8786da5fbf50a06fc9ce5e18eed916b53 (patch) | |
tree | d7ac24238a7745f47ae3c42b1ef0bb9cacec50a3 /libnativeloader | |
parent | a81117b8f98f68456daf9d49783684e98c3bf74f (diff) | |
parent | 3fb358478ff561f06f3cfa569477a27ec065b912 (diff) | |
download | system_core-1b4f54e8786da5fbf50a06fc9ce5e18eed916b53.tar.gz system_core-1b4f54e8786da5fbf50a06fc9ce5e18eed916b53.tar.bz2 system_core-1b4f54e8786da5fbf50a06fc9ce5e18eed916b53.zip |
Merge \"Add support to indicate bitness of public library.\"
am: 3fb358478f
Change-Id: Ia5a7580cb26dbafa5863ae5d85aaaccb62936921
Diffstat (limited to 'libnativeloader')
-rw-r--r-- | libnativeloader/native_loader.cpp | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/libnativeloader/native_loader.cpp b/libnativeloader/native_loader.cpp index 1986eebe7..e89c50f40 100644 --- a/libnativeloader/native_loader.cpp +++ b/libnativeloader/native_loader.cpp @@ -134,9 +134,10 @@ class LibraryNamespaces { std::string public_native_libraries_system_config = root_dir + kPublicNativeLibrariesSystemConfigPathFromRoot; - LOG_ALWAYS_FATAL_IF(!ReadConfig(public_native_libraries_system_config, &sonames), + std::string error_msg; + LOG_ALWAYS_FATAL_IF(!ReadConfig(public_native_libraries_system_config, &sonames, &error_msg), "Error reading public native library list from \"%s\": %s", - public_native_libraries_system_config.c_str(), strerror(errno)); + public_native_libraries_system_config.c_str(), error_msg.c_str()); // For debuggable platform builds use ANDROID_ADDITIONAL_PUBLIC_LIBRARIES environment // variable to add libraries to the list. This is intended for platform tests only. @@ -173,20 +174,42 @@ class LibraryNamespaces { } private: - bool ReadConfig(const std::string& configFile, std::vector<std::string>* sonames) { + bool ReadConfig(const std::string& configFile, std::vector<std::string>* sonames, + std::string* error_msg = nullptr) { // Read list of public native libraries from the config file. std::string file_content; if(!base::ReadFileToString(configFile, &file_content)) { + if (error_msg) *error_msg = strerror(errno); return false; } std::vector<std::string> lines = base::Split(file_content, "\n"); - for (const auto& line : lines) { + for (auto& line : lines) { auto trimmed_line = base::Trim(line); if (trimmed_line[0] == '#' || trimmed_line.empty()) { continue; } + size_t space_pos = trimmed_line.rfind(' '); + if (space_pos != std::string::npos) { + std::string type = trimmed_line.substr(space_pos + 1); + if (type != "32" && type != "64") { + if (error_msg) *error_msg = "Malformed line: " + line; + return false; + } +#if defined(__LP64__) + // Skip 32 bit public library. + if (type == "32") { + continue; + } +#else + // Skip 64 bit public library. + if (type == "64") { + continue; + } +#endif + trimmed_line.resize(space_pos); + } sonames->push_back(trimmed_line); } |