Merge "Update to tzdata 2015d" into mnc-dev
diff --git a/libc/include/sys/_system_properties.h b/libc/include/sys/_system_properties.h
index c200295..8086020 100644
--- a/libc/include/sys/_system_properties.h
+++ b/libc/include/sys/_system_properties.h
@@ -104,13 +104,19 @@
** objects will have seen __system_property_serial values change.
** But also aids the converse, as changes in the global serial can
** also be used to predict if a failed __system_property_find
-** could in-turn now find an new object; thus preventing the
+** could in-turn now find a new object; thus preventing the
** cycles of effort to poll __system_property_find.
**
-** Called at the beginning of a cache cycle to signal _any_ possible
-** changes have occurred since last. If there is, check each individual
+** Typically called at beginning of a cache cycle to signal if _any_ possible
+** changes have occurred since last. If there is, one may check each individual
** __system_property_serial to confirm dirty, or __system_property_find
-** to check if the property now exists.
+** to check if the property now exists. If a call to __system_property_add
+** or __system_property_update has completed between two calls to
+** __system_property_area_serial then the second call will return a larger
+** value than the first call. Beware of race conditions as changes to the
+** properties are not atomic, the main value of this call is to determine
+** whether the expensive __system_property_find is worth retrying to see if
+** a property now exists.
**
** Returns the serial number on success, -1 on error.
*/
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 0e657d6..8452cd4 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -1743,6 +1743,27 @@
return init_verneed(si_from) && init_verdef(si_from);
}
+bool soinfo::lookup_version_info(const VersionTracker& version_tracker, ElfW(Word) sym,
+ const char* sym_name, const version_info** vi) {
+ const ElfW(Versym)* sym_ver_ptr = get_versym(sym);
+ ElfW(Versym) sym_ver = sym_ver_ptr == nullptr ? 0 : *sym_ver_ptr;
+
+ if (sym_ver != VER_NDX_LOCAL && sym_ver != VER_NDX_GLOBAL) {
+ *vi = version_tracker.get_version_info(sym_ver);
+
+ if (*vi == nullptr) {
+ DL_ERR("cannot find verneed/verdef for version index=%d "
+ "referenced by symbol \"%s\" at \"%s\"", sym_ver, sym_name, get_soname());
+ return false;
+ }
+ } else {
+ // there is no version info
+ *vi = nullptr;
+ }
+
+ return true;
+}
+
#if !defined(__mips__)
#if defined(USE_RELA)
static ElfW(Addr) get_addend(ElfW(Rela)* rela, ElfW(Addr) reloc_addr __unused) {
@@ -1791,27 +1812,16 @@
if (sym != 0) {
sym_name = get_string(symtab_[sym].st_name);
- const ElfW(Versym)* sym_ver_ptr = get_versym(sym);
- ElfW(Versym) sym_ver = sym_ver_ptr == nullptr ? 0 : *sym_ver_ptr;
+ const version_info* vi = nullptr;
- if (sym_ver == VER_NDX_LOCAL || sym_ver == VER_NDX_GLOBAL) {
- // there is no version info for this one
- if (!soinfo_do_lookup(this, sym_name, nullptr, &lsi, global_group, local_group, &s)) {
- return false;
- }
- } else {
- const version_info* vi = version_tracker.get_version_info(sym_ver);
-
- if (vi == nullptr) {
- DL_ERR("cannot find verneed/verdef for version index=%d "
- "referenced by symbol \"%s\" at \"%s\"", sym_ver, sym_name, get_soname());
- return false;
- }
-
- if (!soinfo_do_lookup(this, sym_name, vi, &lsi, global_group, local_group, &s)) {
- return false;
- }
+ if (!lookup_version_info(version_tracker, sym, sym_name, &vi)) {
+ return false;
}
+
+ if (!soinfo_do_lookup(this, sym_name, vi, &lsi, global_group, local_group, &s)) {
+ return false;
+ }
+
if (s == nullptr) {
// We only allow an undefined symbol if this is a weak reference...
s = &symtab_[sym];
diff --git a/linker/linker.h b/linker/linker.h
index dae3972..06e1f53 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -338,6 +338,9 @@
bool gnu_lookup(SymbolName& symbol_name, const version_info* vi, uint32_t* symbol_index) const;
ElfW(Sym)* gnu_addr_lookup(const void* addr);
+ bool lookup_version_info(const VersionTracker& version_tracker, ElfW(Word) sym,
+ const char* sym_name, const version_info** vi);
+
void call_array(const char* array_name, linker_function_t* functions, size_t count, bool reverse);
void call_function(const char* function_name, linker_function_t function);
template<typename ElfRelIteratorT>
diff --git a/linker/linker_mips.cpp b/linker/linker_mips.cpp
index 87b811f..aaf8b5e 100644
--- a/linker/linker_mips.cpp
+++ b/linker/linker_mips.cpp
@@ -75,26 +75,14 @@
if (sym != 0) {
sym_name = get_string(symtab_[sym].st_name);
- const ElfW(Versym)* sym_ver_ptr = get_versym(sym);
- ElfW(Versym) sym_ver = sym_ver_ptr == nullptr ? 0 : *sym_ver_ptr;
+ const version_info* vi = nullptr;
- if (sym_ver == VER_NDX_LOCAL || sym_ver == VER_NDX_GLOBAL) {
- // there is no version info for this one
- if (!soinfo_do_lookup(this, sym_name, nullptr, &lsi, global_group, local_group, &s)) {
- return false;
- }
- } else {
- const version_info* vi = version_tracker.get_version_info(sym_ver);
+ if (!lookup_version_info(version_tracker, sym, sym_name, &vi)) {
+ return false;
+ }
- if (vi == nullptr) {
- DL_ERR("cannot find verneed/verdef for version index=%d "
- "referenced by symbol \"%s\" at \"%s\"", sym_ver, sym_name, get_soname());
- return false;
- }
-
- if (!soinfo_do_lookup(this, sym_name, vi, &lsi, global_group, local_group, &s)) {
- return false;
- }
+ if (!soinfo_do_lookup(this, sym_name, vi, &lsi, global_group, local_group, &s)) {
+ return false;
}
if (s == nullptr) {