From a1ffb40e32741f992c743e7b16c061fefa3747ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20B=C3=ADlka?= Date: Mon, 10 Feb 2014 14:45:42 +0100 Subject: Use glibc_likely instead __builtin_expect. --- elf/dl-lookup.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'elf/dl-lookup.c') diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c index a58e5bc72a..690f4046c5 100644 --- a/elf/dl-lookup.c +++ b/elf/dl-lookup.c @@ -110,7 +110,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash, continue; /* Print some debugging info if wanted. */ - if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS, 0)) + if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS)) _dl_debug_printf ("symbol=%s; lookup in file=%s [%lu]\n", undef_name, DSO_FILENAME (map->l_name), map->l_ns); @@ -143,7 +143,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash, #define ALLOWED_STT \ ((1 << STT_NOTYPE) | (1 << STT_OBJECT) | (1 << STT_FUNC) \ | (1 << STT_COMMON) | (1 << STT_TLS) | (1 << STT_GNU_IFUNC)) - if (__builtin_expect (((1 << stt) & ALLOWED_STT) == 0, 0)) + if (__glibc_unlikely (((1 << stt) & ALLOWED_STT) == 0)) return NULL; if (sym != ref && strcmp (strtab + sym->st_name, undef_name)) @@ -153,7 +153,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash, const ElfW(Half) *verstab = map->l_versyms; if (version != NULL) { - if (__builtin_expect (verstab == NULL, 0)) + if (__glibc_unlikely (verstab == NULL)) { /* We need a versioned symbol but haven't found any. If this is the object which is referenced in the verneed @@ -223,7 +223,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash, const ElfW(Sym) *sym; const ElfW(Addr) *bitmask = map->l_gnu_bitmask; - if (__builtin_expect (bitmask != NULL, 1)) + if (__glibc_likely (bitmask != NULL)) { ElfW(Addr) bitmask_word = bitmask[(new_hash / __ELF_NATIVE_CLASS) @@ -287,7 +287,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash, { case STB_WEAK: /* Weak definition. Use this value if we don't find another. */ - if (__builtin_expect (GLRO(dl_dynamic_weak), 0)) + if (__glibc_unlikely (GLRO(dl_dynamic_weak))) { if (! result->s) { @@ -412,7 +412,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash, LD_TRACE_PRELINKING in _dl_debug_bindings. Don't allocate anything and don't enter anything into the hash table. */ - if (__builtin_expect (tab->size, 0)) + if (__glibc_unlikely (tab->size)) { assert (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK); __rtld_lock_unlock_recursive (tab->lock); @@ -530,7 +530,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map, int flags) unsigned long long serial = map->l_serial; /* Make sure nobody can unload the object while we are at it. */ - if (__builtin_expect (flags & DL_LOOKUP_GSCOPE_LOCK, 0)) + if (__glibc_unlikely (flags & DL_LOOKUP_GSCOPE_LOCK)) { /* We can't just call __rtld_lock_lock_recursive (GL(dl_load_lock)) here, that can result in ABBA deadlock. */ @@ -617,7 +617,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map, int flags) } /* Add the reference now. */ - if (__builtin_expect (l_reldepsact >= undef_map->l_reldepsmax, 0)) + if (__glibc_unlikely (l_reldepsact >= undef_map->l_reldepsmax)) { /* Allocate more memory for the dependency list. Since this can never happen during the startup phase we can use @@ -663,7 +663,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map, int flags) } /* Display information if we are debugging. */ - if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0)) + if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES)) _dl_debug_printf ("\ \nfile=%s [%lu]; needed by %s [%lu] (relocation dependency)\n\n", DSO_FILENAME (map->l_name), @@ -679,7 +679,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map, int flags) /* Release the lock. */ __rtld_lock_unlock_recursive (GL(dl_load_lock)); - if (__builtin_expect (flags & DL_LOOKUP_GSCOPE_LOCK, 0)) + if (__glibc_unlikely (flags & DL_LOOKUP_GSCOPE_LOCK)) THREAD_GSCOPE_SET_FLAG (); return result; @@ -726,7 +726,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map, == 0); size_t i = 0; - if (__builtin_expect (skip_map != NULL, 0)) + if (__glibc_unlikely (skip_map != NULL)) /* Search the relevant loaded objects for a definition. */ while ((*scope)->r_list[i] != skip_map) ++i; @@ -763,7 +763,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map, } } - if (__builtin_expect (current_value.s == NULL, 0)) + if (__glibc_unlikely (current_value.s == NULL)) { if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK) && skip_map == NULL @@ -787,7 +787,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map, int protected = (*ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED); - if (__builtin_expect (protected != 0, 0)) + if (__glibc_unlikely (protected != 0)) { /* It is very tricky. We need to figure out what value to return for the protected symbol. */ @@ -835,7 +835,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map, version, type_class, flags, skip_map); /* The object is used. */ - if (__builtin_expect (current_value.m->l_used == 0, 0)) + if (__glibc_unlikely (current_value.m->l_used == 0)) current_value.m->l_used = 1; if (__builtin_expect (GLRO(dl_debug_mask) -- cgit v1.2.1