Merge "Reformatting"

This commit is contained in:
Dmitriy Ivanov 2014-09-12 16:50:29 +00:00 committed by Gerrit Code Review
commit aad92067bf

View File

@ -88,7 +88,7 @@ static LinkerAllocator<LinkedListEntry<soinfo>> g_soinfo_links_allocator;
static soinfo* solist; static soinfo* solist;
static soinfo* sonext; static soinfo* sonext;
static soinfo* somain; /* main process, always the one after libdl_info */ static soinfo* somain; // main process, always the one after libdl_info
static const char* const kDefaultLdPaths[] = { static const char* const kDefaultLdPaths[] = {
#if defined(__LP64__) #if defined(__LP64__)
@ -182,10 +182,8 @@ size_t linker_get_error_buffer_size() {
return sizeof(__linker_dl_err_buf); return sizeof(__linker_dl_err_buf);
} }
/* // This function is an empty stub where GDB locates a breakpoint to get notified
* This function is an empty stub where GDB locates a breakpoint to get notified // about linker activity.
* about linker activity.
*/
extern "C" void __attribute__((noinline)) __attribute__((visibility("default"))) rtld_db_dlactivity(); extern "C" void __attribute__((noinline)) __attribute__((visibility("default"))) rtld_db_dlactivity();
static pthread_mutex_t g__r_debug_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t g__r_debug_mutex = PTHREAD_MUTEX_INITIALIZER;
@ -199,11 +197,10 @@ static void insert_soinfo_into_debug_map(soinfo* info) {
map->l_name = reinterpret_cast<char*>(info->name); map->l_name = reinterpret_cast<char*>(info->name);
map->l_ld = info->dynamic; map->l_ld = info->dynamic;
/* Stick the new library at the end of the list. // Stick the new library at the end of the list.
* gdb tends to care more about libc than it does // gdb tends to care more about libc than it does
* about leaf libraries, and ordering it this way // about leaf libraries, and ordering it this way
* reduces the back-and-forth over the wire. // reduces the back-and-forth over the wire.
*/
if (r_debug_tail) { if (r_debug_tail) {
r_debug_tail->l_next = map; r_debug_tail->l_next = map;
map->l_prev = r_debug_tail; map->l_prev = r_debug_tail;
@ -314,12 +311,13 @@ static void soinfo_free(soinfo* si) {
TRACE("name %s: freeing soinfo @ %p", si->name, si); TRACE("name %s: freeing soinfo @ %p", si->name, si);
for (trav = solist; trav != nullptr; trav = trav->next) { for (trav = solist; trav != nullptr; trav = trav->next) {
if (trav == si) if (trav == si) {
break; break;
}
prev = trav; prev = trav;
} }
if (trav == nullptr) { if (trav == nullptr) {
/* si was not in solist */ // si was not in solist
DL_ERR("name \"%s\" is not in solist!", si->name); DL_ERR("name \"%s\" is not in solist!", si->name);
return; return;
} }
@ -327,9 +325,8 @@ static void soinfo_free(soinfo* si) {
// clear links to/from si // clear links to/from si
si->remove_all_links(); si->remove_all_links();
/* prev will never be null, because the first entry in solist is // prev will never be null, because the first entry in solist is
always the static libdl_info. // always the static libdl_info.
*/
prev->next = si->next; prev->next = si->next;
if (si == sonext) { if (si == sonext) {
sonext = prev; sonext = prev;
@ -377,15 +374,14 @@ static void parse_LD_PRELOAD(const char* path) {
#if defined(__arm__) #if defined(__arm__)
/* For a given PC, find the .so that it belongs to. // For a given PC, find the .so that it belongs to.
* Returns the base address of the .ARM.exidx section // Returns the base address of the .ARM.exidx section
* for that .so, and the number of 8-byte entries // for that .so, and the number of 8-byte entries
* in that section (via *pcount). // in that section (via *pcount).
* //
* Intended to be called by libc's __gnu_Unwind_Find_exidx(). // Intended to be called by libc's __gnu_Unwind_Find_exidx().
* //
* This function is exposed via dlfcn.cpp and libdl.so. // This function is exposed via dlfcn.cpp and libdl.so.
*/
_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int* pcount) { _Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int* pcount) {
unsigned addr = (unsigned)pc; unsigned addr = (unsigned)pc;
@ -401,8 +397,8 @@ _Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int* pcount) {
#endif #endif
/* Here, we only have to provide a callback to iterate across all the // Here, we only have to provide a callback to iterate across all the
* loaded libraries. gcc_eh does the rest. */ // loaded libraries. gcc_eh does the rest.
int dl_iterate_phdr(int (*cb)(dl_phdr_info* info, size_t size, void* data), void* data) { int dl_iterate_phdr(int (*cb)(dl_phdr_info* info, size_t size, void* data), void* data) {
int rv = 0; int rv = 0;
for (soinfo* si = solist; si != nullptr; si = si->next) { for (soinfo* si = solist; si != nullptr; si = si->next) {
@ -430,7 +426,7 @@ static ElfW(Sym)* soinfo_elf_lookup(soinfo* si, unsigned hash, const char* name)
ElfW(Sym)* s = symtab + n; ElfW(Sym)* s = symtab + n;
if (strcmp(strtab + s->st_name, name)) continue; if (strcmp(strtab + s->st_name, name)) continue;
/* only concern ourselves with global and weak symbol definitions */ // only concern ourselves with global and weak symbol definitions
switch (ELF_ST_BIND(s->st_info)) { switch (ELF_ST_BIND(s->st_info)) {
case STB_GLOBAL: case STB_GLOBAL:
case STB_WEAK: case STB_WEAK: