aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-sysdep.c
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2018-06-01 12:53:59 -0400
committerZack Weinberg <zackw@panix.com>2018-06-12 10:02:27 -0400
commit2ba9f2eb978b27ddfa39cd769b73136d0ac4c4ae (patch)
treefabc08af34d8fbe8227e072ade54be411c6a4123 /elf/dl-sysdep.c
parent329ea513b451ae8322aa7a24ed84da13992af2dd (diff)
downloadglibc-zack/elf-builtin-expect-conversion.zip
glibc-zack/elf-builtin-expect-conversion.tar.gz
glibc-zack/elf-builtin-expect-conversion.tar.bz2
Convert __builtin_expect to __glibc_(un)likely throughout elf/.zack/elf-builtin-expect-conversion
In the previous patch I didn't change a use of __builtin_expect to __glibc_(un)likely that happened to be right next to the code I was actually working on; Andreas asked why not, and I said that there were a bunch more uses of __builtin_expect in that file and I would convert them all in a separate patch. This is that patch, converting all of elf/. I would appreciate someone checking over this patch very carefully indeed. In a whole bunch of places, __builtin_expect was used in a way that did not map mechanically to the newer convention. The test suite caught one mistake; I'm not confident I didn't make any more. Writing this patch gave me a deeper appreciation for why we _want_ to switch to __glibc_(un)likely, but also for how difficult it can be. I now think that people should _not_ be asked to change existing uses of __builtin_expect in a patch whose purpose is something else. * elf/dl-addr.c, elf/dl-cache.c, elf/dl-close.c, elf/dl-deps.c * elf/dl-environ.c, elf/dl-error-skeleton.c, elf/dl-fini.c * elf/dl-fptr.c, elf/dl-init.c, elf/dl-libc.c, elf/dl-minimal.c * elf/dl-open.c, elf/dl-reloc.c, elf/dl-runtime.c * elf/dl-sysdep.c, elf/dl-tls.c, elf/dl-version.c, elf/ldconfig.c * elf/rtld.c: Replace __builtin_expect with __glibc_likely or __glibc_unlikely, as appropriate, throughout.
Diffstat (limited to 'elf/dl-sysdep.c')
-rw-r--r--elf/dl-sysdep.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c
index 998c5d5..1a2a043 100644
--- a/elf/dl-sysdep.c
+++ b/elf/dl-sysdep.c
@@ -247,7 +247,7 @@ _dl_sysdep_start (void **start_argptr,
/* If this is a SUID program we make sure that FDs 0, 1, and 2 are
allocated. If necessary we are doing it ourself. If it is not
possible we stop the program. */
- if (__builtin_expect (__libc_enable_secure, 0))
+ if (__glibc_unlikely (__libc_enable_secure))
__libc_check_standard_fds ();
(*dl_main) (phdr, phnum, &user_entry, GLRO(dl_auxv));
@@ -332,10 +332,10 @@ _dl_show_auxv (void)
{
const char *val = (char *) av->a_un.a_val;
- if (__builtin_expect (auxvars[idx].form, dec) == dec)
+ if (__glibc_likely (auxvars[idx].form == dec))
val = _itoa ((unsigned long int) av->a_un.a_val,
buf + sizeof buf - 1, 10, 0);
- else if (__builtin_expect (auxvars[idx].form, hex) == hex)
+ else if (__glibc_likely (auxvars[idx].form == hex))
val = _itoa ((unsigned long int) av->a_un.a_val,
buf + sizeof buf - 1, 16, 0);