From patchwork Fri Feb 2 17:42:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lu, Hongjiu" X-Patchwork-Id: 25775 Received: (qmail 68768 invoked by alias); 2 Feb 2018 17:42:50 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 68750 invoked by uid 89); 2 Feb 2018 17:42:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, NO_DNS_FOR_FROM, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=5008 X-HELO: mga18.intel.com X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False X-ExtLoop1: 1 Date: Fri, 2 Feb 2018 09:42:46 -0800 From: "H.J. Lu" To: GNU C Library Subject: [PATCH] x86-64: Use __glibc_likely/__glibc_likely in dl-machine.h Message-ID: <20180202174246.GA12457@gmail.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.1 (2017-09-22) OK for master? H.J. --- * sysdeps/x86_64/dl-machine.h (elf_machine_rela): Replace __builtin_expect with __glibc_likely and __glibc_likely. (elf_machine_lazy_rel): Likewise. --- sysdeps/x86_64/dl-machine.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index f525600071..5d45ca5342 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -310,10 +310,9 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc, : (ElfW(Addr)) sym_map->l_addr + sym->st_value); if (sym != NULL - && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, - 0) - && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1) - && __builtin_expect (!skip_ifunc, 1)) + && __glibc_unlikely (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC) + && __glibc_likely (sym->st_shndx != SHN_UNDEF) + && __glibc_likely (!skip_ifunc)) { # ifndef RTLD_BOOTSTRAP if (sym_map != map @@ -500,8 +499,8 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc, break; memcpy (reloc_addr_arg, (void *) value, MIN (sym->st_size, refsym->st_size)); - if (__builtin_expect (sym->st_size > refsym->st_size, 0) - || (__builtin_expect (sym->st_size < refsym->st_size, 0) + if (__glibc_unlikely (sym->st_size > refsym->st_size) + || (__glibc_unlikely (sym->st_size < refsym->st_size) && GLRO(dl_verbose))) { fmt = "\ @@ -554,7 +553,8 @@ elf_machine_lazy_rel (struct link_map *map, /* Check for unexpected PLT reloc type. */ if (__glibc_likely (r_type == R_X86_64_JUMP_SLOT)) { - if (__builtin_expect (map->l_mach.plt, 0) == 0) + /* Prelinked has been deprecated. */ + if (__glibc_likely (map->l_mach.plt == 0)) *reloc_addr += l_addr; else *reloc_addr =