1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00
* elf/dl-reloc.c (_dl_relocat_object): Add more __builtin_expect.
	* elf/dl-lookup.c: Add more __builtin_expect.
	* elf/dl-init.c (_dl_init): Add more __builtin_expect.
	* elf/dl-fini.c (_dl_fini): Add more __builtin_expect.
	* elf/dl-deps.c (_dl_map_object_deps): Add more __builtin_expect.
	* elf/dl-close.c (_dl_close): Add more __builtin_expect.
	* elf/rtld.c (_dl_start_final): Add more __builtin_expect.
This commit is contained in:
Ulrich Drepper
2000-04-17 15:41:59 +00:00
parent e3265f5bc5
commit 466a0ec998
8 changed files with 28 additions and 20 deletions

View File

@ -1,5 +1,13 @@
2000-04-17 Ulrich Drepper <drepper@redhat.com> 2000-04-17 Ulrich Drepper <drepper@redhat.com>
* elf/dl-reloc.c (_dl_relocat_object): Add more __builtin_expect.
* elf/dl-lookup.c: Add more __builtin_expect.
* elf/dl-init.c (_dl_init): Add more __builtin_expect.
* elf/dl-fini.c (_dl_fini): Add more __builtin_expect.
* elf/dl-deps.c (_dl_map_object_deps): Add more __builtin_expect.
* elf/dl-close.c (_dl_close): Add more __builtin_expect.
* elf/rtld.c (_dl_start_final): Add more __builtin_expect.
* elf/dl-lookup.c (add_dependency): Correct __builtin_expect use. * elf/dl-lookup.c (add_dependency): Correct __builtin_expect use.
2000-04-15 Ulrich Drepper <drepper@redhat.com> 2000-04-15 Ulrich Drepper <drepper@redhat.com>

View File

@ -80,7 +80,7 @@ _dl_close (void *_map)
&& imap->l_init_called) && imap->l_init_called)
{ {
/* When debugging print a message first. */ /* When debugging print a message first. */
if (_dl_debug_impcalls) if (__builtin_expect (_dl_debug_impcalls, 0))
_dl_debug_message (1, "\ncalling fini: ", imap->l_name, _dl_debug_message (1, "\ncalling fini: ", imap->l_name,
"\n\n", NULL); "\n\n", NULL);

View File

@ -119,7 +119,7 @@ struct list
else \ else \
{ \ { \
/* This is for DT_AUXILIARY. */ \ /* This is for DT_AUXILIARY. */ \
if (_dl_debug_libs) \ if (__builtin_expect (_dl_debug_libs, 0)) \
_dl_debug_message (1, "cannot load auxiliary `", __str, \ _dl_debug_message (1, "cannot load auxiliary `", __str, \
"' because of empty dynamic string" \ "' because of empty dynamic string" \
" token substitution\n", NULL); \ " token substitution\n", NULL); \
@ -280,7 +280,7 @@ _dl_map_object_deps (struct link_map *map,
args.name = name; args.name = name;
/* Say that we are about to load an auxiliary library. */ /* Say that we are about to load an auxiliary library. */
if (_dl_debug_libs) if (__builtin_expect (_dl_debug_libs, 0))
_dl_debug_message (1, "load auxiliary object=", _dl_debug_message (1, "load auxiliary object=",
name, " requested by file=", name, " requested by file=",
l->l_name[0] l->l_name[0]
@ -302,7 +302,7 @@ _dl_map_object_deps (struct link_map *map,
else else
{ {
/* Say that we are about to load an auxiliary library. */ /* Say that we are about to load an auxiliary library. */
if (_dl_debug_libs) if (__builtin_expect (_dl_debug_libs, 0))
_dl_debug_message (1, "load filtered object=", name, _dl_debug_message (1, "load filtered object=", name,
" requested by file=", " requested by file=",
l->l_name[0] l->l_name[0]

View File

@ -141,7 +141,7 @@ _dl_fini (void)
continue; continue;
/* When debugging print a message first. */ /* When debugging print a message first. */
if (_dl_debug_impcalls) if (__builtin_expect (_dl_debug_impcalls, 0))
_dl_debug_message (1, "\ncalling fini: ", _dl_debug_message (1, "\ncalling fini: ",
l->l_name[0] ? l->l_name : _dl_argv[0], l->l_name[0] ? l->l_name : _dl_argv[0],
"\n\n", NULL); "\n\n", NULL);

View File

@ -43,7 +43,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
ElfW(Addr) *addrs; ElfW(Addr) *addrs;
unsigned int cnt; unsigned int cnt;
if (_dl_debug_impcalls) if (__builtin_expect (_dl_debug_impcalls, 0))
_dl_debug_message (1, "\ncalling preinit: ", _dl_debug_message (1, "\ncalling preinit: ",
main_map->l_name[0] main_map->l_name[0]
? main_map->l_name : _dl_argv[0], "\n\n", NULL); ? main_map->l_name : _dl_argv[0], "\n\n", NULL);
@ -94,7 +94,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
continue; continue;
/* Print a debug message if wanted. */ /* Print a debug message if wanted. */
if (_dl_debug_impcalls) if (__builtin_expect (_dl_debug_impcalls, 0))
_dl_debug_message (1, "\ncalling init: ", _dl_debug_message (1, "\ncalling init: ",
l->l_name[0] ? l->l_name : _dl_argv[0], l->l_name[0] ? l->l_name : _dl_argv[0],
"\n\n", NULL); "\n\n", NULL);

View File

@ -128,7 +128,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map)
if (runp != NULL) if (runp != NULL)
{ {
/* The object is still available. Add the reference now. */ /* The object is still available. Add the reference now. */
if (act >= undef_map->l_reldepsmax) if (__builtin_expect (act >= undef_map->l_reldepsmax, 0))
{ {
/* Allocate more memory for the dependency list. Since /* Allocate more memory for the dependency list. Since
this can never happen during the startup phase we can this can never happen during the startup phase we can
@ -152,7 +152,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map)
This means this increment can never be reverted and the This means this increment can never be reverted and the
object will never be unloaded. This is semantically the object will never be unloaded. This is semantically the
correct behaviour. */ correct behaviour. */
if (act < undef_map->l_reldepsmax) if (__builtin_expect (act < undef_map->l_reldepsmax, 1))
undef_map->l_reldeps[undef_map->l_reldepsact++] = map; undef_map->l_reldeps[undef_map->l_reldepsact++] = map;
/* And increment the counter in the referenced object. */ /* And increment the counter in the referenced object. */
@ -205,7 +205,7 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
in the global scope which was dynamically loaded. In this case in the global scope which was dynamically loaded. In this case
we have to prevent the latter from being unloaded unless the we have to prevent the latter from being unloaded unless the
UNDEF_MAP object is also unloaded. */ UNDEF_MAP object is also unloaded. */
if (current_value.m->l_global if (__builtin_expect (current_value.m->l_global, 0)
&& (__builtin_expect (current_value.m->l_type, lt_library) && (__builtin_expect (current_value.m->l_type, lt_library)
== lt_loaded) == lt_loaded)
&& undef_map != current_value.m && undef_map != current_value.m
@ -219,7 +219,7 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
break; break;
} }
if (current_value.s == NULL) if (__builtin_expect (current_value.s == NULL, 0))
{ {
if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK) if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
/* We could find no value for a strong reference. */ /* We could find no value for a strong reference. */
@ -298,7 +298,7 @@ _dl_lookup_symbol_skip (const char *undef_name,
in the global scope which was dynamically loaded. In this case in the global scope which was dynamically loaded. In this case
we have to prevent the latter from being unloaded unless the we have to prevent the latter from being unloaded unless the
UNDEF_MAP object is also unloaded. */ UNDEF_MAP object is also unloaded. */
if (current_value.m->l_global if (__builtin_expect (current_value.m->l_global, 0)
&& (__builtin_expect (current_value.m->l_type, lt_library) && (__builtin_expect (current_value.m->l_type, lt_library)
== lt_loaded) == lt_loaded)
&& undef_map != current_value.m && undef_map != current_value.m
@ -312,7 +312,7 @@ _dl_lookup_symbol_skip (const char *undef_name,
break; break;
} }
if (current_value.s == NULL) if (__builtin_expect (current_value.s == NULL, 0))
{ {
*ref = NULL; *ref = NULL;
return 0; return 0;
@ -364,7 +364,7 @@ _dl_lookup_versioned_symbol (const char *undef_name,
in the global scope which was dynamically loaded. In this case in the global scope which was dynamically loaded. In this case
we have to prevent the latter from being unloaded unless the we have to prevent the latter from being unloaded unless the
UNDEF_MAP object is also unloaded. */ UNDEF_MAP object is also unloaded. */
if (current_value.m->l_global if (__builtin_expect (current_value.m->l_global, 0)
&& (__builtin_expect (current_value.m->l_type, lt_library) && (__builtin_expect (current_value.m->l_type, lt_library)
== lt_loaded) == lt_loaded)
&& undef_map != current_value.m && undef_map != current_value.m
@ -379,7 +379,7 @@ _dl_lookup_versioned_symbol (const char *undef_name,
break; break;
} }
if (res < 0) if (__builtin_expect (res, 0) < 0)
{ {
/* Oh, oh. The file named in the relocation entry does not /* Oh, oh. The file named in the relocation entry does not
contain the needed symbol. */ contain the needed symbol. */
@ -398,7 +398,7 @@ _dl_lookup_versioned_symbol (const char *undef_name,
} }
} }
if (current_value.s == NULL) if (__builtin_expect (current_value.s == NULL, 0))
{ {
if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK) if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
/* We could find no value for a strong reference. */ /* We could find no value for a strong reference. */
@ -458,7 +458,7 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
in the global scope which was dynamically loaded. In this case in the global scope which was dynamically loaded. In this case
we have to prevent the latter from being unloaded unless the we have to prevent the latter from being unloaded unless the
UNDEF_MAP object is also unloaded. */ UNDEF_MAP object is also unloaded. */
if (current_value.m->l_global if (__builtin_expect (current_value.m->l_global, 0)
&& (__builtin_expect (current_value.m->l_type, lt_library) && (__builtin_expect (current_value.m->l_type, lt_library)
== lt_loaded) == lt_loaded)
&& undef_map != current_value.m && undef_map != current_value.m
@ -494,7 +494,7 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
break; break;
} }
if (current_value.s == NULL) if (__builtin_expect (current_value.s == NULL, 0))
{ {
if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK) if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
{ {

View File

@ -38,7 +38,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
if (!consider_profiling && l->l_info[DT_BIND_NOW]) if (!consider_profiling && l->l_info[DT_BIND_NOW])
lazy = 0; lazy = 0;
if (_dl_debug_reloc) if (__builtin_expect (_dl_debug_reloc, 0))
_dl_debug_message (1, "\nrelocation processing: ", _dl_debug_message (1, "\nrelocation processing: ",
l->l_name[0] ? l->l_name : _dl_argv[0], l->l_name[0] ? l->l_name : _dl_argv[0],
lazy ? " (lazy)\n" : "\n", NULL); lazy ? " (lazy)\n" : "\n", NULL);

View File

@ -251,7 +251,7 @@ _dl_start_final (void *arg, struct link_map *bootstrap_map_p,
HP_TIMING_DIFF (rtld_total_time, start_time, end_time); HP_TIMING_DIFF (rtld_total_time, start_time, end_time);
} }
if (_dl_debug_statistics) if (__builtin_expect (_dl_debug_statistics, 0))
print_statistics (); print_statistics ();
return *start_addr; return *start_addr;