linker: Cleanup for Android's inclusive language guidance
1. Cleanup for #inclusivefixit. (whitelisted -> allowed_libs)
2. Support the old term for backwards compatibility. (Also update test.)
3. Fix the formatting errors found by clang-format.
See https://source.android.com/setup/contribute/respectful-code
for reference.
Bug: 161896447
Test: atest linker-unit-tests linker-benchmarks
Change-Id: I19dbed27a6d874ac0049cb7b67d2cb0f75369c1b
diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp
index aaa3a03..1771e87 100644
--- a/linker/linker_config.cpp
+++ b/linker/linker_config.cpp
@@ -326,7 +326,8 @@
(*properties)[name].append_value(std::move(value));
} else if (android::base::EndsWith(name, ".paths") ||
android::base::EndsWith(name, ".shared_libs") ||
- android::base::EndsWith(name, ".whitelisted")) {
+ android::base::EndsWith(name, ".whitelisted") ||
+ android::base::EndsWith(name, ".allowed_libs")) {
value = ":" + value;
(*properties)[name].append_value(std::move(value));
} else {
@@ -564,10 +565,15 @@
ns_config->set_isolated(properties.get_bool(property_name_prefix + ".isolated"));
ns_config->set_visible(properties.get_bool(property_name_prefix + ".visible"));
- std::string whitelisted =
+ std::string allowed_libs =
properties.get_string(property_name_prefix + ".whitelisted", &lineno);
- if (!whitelisted.empty()) {
- ns_config->set_whitelisted_libs(android::base::Split(whitelisted, ":"));
+ const std::string libs = properties.get_string(property_name_prefix + ".allowed_libs", &lineno);
+ if (!allowed_libs.empty() && !libs.empty()) {
+ allowed_libs += ":";
+ }
+ allowed_libs += libs;
+ if (!allowed_libs.empty()) {
+ ns_config->set_allowed_libs(android::base::Split(allowed_libs, ":"));
}
// these are affected by is_asan flag