[glibc] aarch64: Standardize code by using macros __glibc_{un, }likely

Yury Khrustalev via Glibc-cvs <[email protected]>
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=78e3de9ecd5493cbb38cbe13d8f258953df3165f

commit 78e3de9ecd5493cbb38cbe13d8f258953df3165f
Author: caiyinyu <[email protected]>
Date:   Mon Mar 13 11:18:30 2023 +0800

    aarch64: Standardize code by using macros __glibc_{un,}likely
    
    Improves code readability by using the same macros across code
    in the sysdeps/aarch64 directory.
    
    Reviewed-by: Wilco Dijkstra  <[email protected]>

Diff:
---
 sysdeps/aarch64/dl-machine.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
index 7605b760b8..14a76dd2ef 100644
--- a/sysdeps/aarch64/dl-machine.h
+++ b/sysdeps/aarch64/dl-machine.h
@@ -175,9 +175,9 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
   ElfW(Addr) *const reloc_addr = reloc_addr_arg;
   const unsigned int r_type = ELFW (R_TYPE) (reloc->r_info);
 
-  if (__builtin_expect (r_type == R_AARCH64_RELATIVE, 0))
+  if (__glibc_unlikely (r_type == R_AARCH64_RELATIVE))
       *reloc_addr = map->l_addr + reloc->r_addend;
-  else if (__builtin_expect (r_type == R_AARCH64_NONE, 0))
+  else if (__glibc_unlikely (r_type == R_AARCH64_NONE))
       return;
   else
     {
@@ -312,7 +312,7 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
   ElfW(Addr) *const reloc_addr = (void *) (l_addr + reloc->r_offset);
   const unsigned int r_type = ELFW (R_TYPE) (reloc->r_info);
   /* Check for unexpected PLT reloc type.  */
-  if (__builtin_expect (r_type == R_AARCH64_JUMP_SLOT, 1))
+  if (__glibc_likely (r_type == R_AARCH64_JUMP_SLOT))
     {
       if (__glibc_unlikely (map->l_info[DT_AARCH64 (VARIANT_PCS)] != NULL))
 	{
@@ -342,7 +342,7 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
       else
 	*reloc_addr = map->l_mach.plt;
     }
-  else if (__builtin_expect (r_type == R_AARCH64_TLSDESC, 1))
+  else if (__glibc_likely (r_type == R_AARCH64_TLSDESC))
     {
       const Elf_Symndx symndx = ELFW (R_SYM) (reloc->r_info);
       const ElfW (Sym) *symtab = (const void *)D_PTR (map, l_info[DT_SYMTAB]);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.