public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] arm: Remove nested functionf rom relocate_pc24
Date: Fri, 12 Aug 2022 12:52:54 +0000 (GMT)	[thread overview]
Message-ID: <20220812125254.CDE633858435@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=453b88efe6fa79f5c7c6fccc3a520c75fdd43074

commit 453b88efe6fa79f5c7c6fccc3a520c75fdd43074
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Jul 26 10:34:01 2022 -0300

    arm: Remove nested functionf rom relocate_pc24
    
    Checked on arm-linux-gnueabihf.

Diff:
---
 sysdeps/arm/dl-machine.h | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index 4e78d8fb0e..b0521c1549 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -227,6 +227,16 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc,
 #define ARCH_LA_PLTEXIT arm_gnu_pltexit
 
 #ifdef RESOLVE_MAP
+/* Set NEW_VALUE based on V, and return true iff it overflows 24 bits.  */
+static inline bool set_new_value (Elf32_Addr *new_value, Elf32_Addr v,
+				  Elf32_Addr *const reloc_addr,
+				  Elf32_Sword addend)
+{
+  *new_value = v + addend - (Elf32_Addr) reloc_addr;
+  Elf32_Addr topbits = *new_value & 0xfe000000;
+  return topbits != 0xfe000000 && topbits != 0x00000000;
+}
+
 /* Handle a PC24 reloc, including the out-of-range case.  */
 static void
 relocate_pc24 (struct link_map *map, Elf32_Addr value,
@@ -234,15 +244,7 @@ relocate_pc24 (struct link_map *map, Elf32_Addr value,
 {
   Elf32_Addr new_value;
 
-  /* Set NEW_VALUE based on V, and return true iff it overflows 24 bits.  */
-  inline bool set_new_value (Elf32_Addr v)
-  {
-    new_value = v + addend - (Elf32_Addr) reloc_addr;
-    Elf32_Addr topbits = new_value & 0xfe000000;
-    return topbits != 0xfe000000 && topbits != 0x00000000;
-  }
-
-  if (set_new_value (value))
+  if (set_new_value (&new_value, value, reloc_addr, addend))
     {
       /* The PC-relative address doesn't fit in 24 bits!  */
 
@@ -271,7 +273,8 @@ relocate_pc24 (struct link_map *map, Elf32_Addr value,
           fix_offset = 0;
         }
 
-      if (set_new_value ((Elf32_Addr) fix_address))
+      if (set_new_value (&new_value, (Elf32_Addr) fix_address, reloc_addr,
+			 addend))
         _dl_signal_error (0, map->l_name, NULL,
                           "R_ARM_PC24 relocation out of range");
     }


                 reply	other threads:[~2022-08-12 12:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220812125254.CDE633858435@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).