[binutils-gdb] MIPS/BFD: Make `_bfd_mips_elf_sign_extend' static inline

"Maciej W. Rozycki via Binutils-cvs" <[email protected]>
Newsgroups gmane.comp.gnu.binutils.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4df7dc0f207f32e30af79af2c5402aa31188addf

commit 4df7dc0f207f32e30af79af2c5402aa31188addf
Author: Maciej W. Rozycki <[email protected]>
Date:   Wed Mar 11 16:30:29 2026 +0000

    MIPS/BFD: Make `_bfd_mips_elf_sign_extend' static inline
    
    Let the function be inlined from outside elfxx-mips.c as well, avoiding
    the call overhead for a simple arithmetic calculation, though we have no
    such user at the moment.

Diff:
---
 bfd/elfxx-mips.c |  9 ---------
 bfd/elfxx-mips.h | 11 +++++++++--
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 24a08436d05..0d3fcd28987 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -5234,15 +5234,6 @@ mips_elf_local_relocation_p (bfd *input_bfd,
   return false;
 }
 
-/* Sign-extend VALUE, which has the indicated number of BITS.  */
-
-bfd_vma
-_bfd_mips_elf_sign_extend (bfd_vma value, int bits)
-{
-  bfd_vma sign = (bfd_vma) 1 << (bits - 1);
-  return (value ^ sign) - sign;
-}
-
 /* Return non-zero if the indicated VALUE has overflowed the maximum
    range expressible by a signed number with the indicated number of
    BITS.  */
diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h
index fedc21ed3d9..e39e0b15478 100644
--- a/bfd/elfxx-mips.h
+++ b/bfd/elfxx-mips.h
@@ -168,8 +168,6 @@ extern bfd_reloc_status_type _bfd_mips_elf_generic_reloc
   ATTRIBUTE_HIDDEN;
 extern unsigned long _bfd_elf_mips_mach
   (flagword);
-extern bfd_vma _bfd_mips_elf_sign_extend
-  (bfd_vma, int) ATTRIBUTE_HIDDEN;
 extern void _bfd_mips_elf_merge_symbol_attribute
   (struct elf_link_hash_entry *, unsigned int, bool, bool) ATTRIBUTE_HIDDEN;
 extern char *_bfd_mips_elf_get_target_dtag
@@ -226,6 +224,15 @@ literal_reloc_p (int r_type)
   return r_type == R_MIPS_LITERAL || r_type == R_MICROMIPS_LITERAL;
 }
 
+/* Sign-extend VALUE, which has the indicated number of BITS.  */
+
+static inline bfd_vma
+_bfd_mips_elf_sign_extend (bfd_vma value, int bits)
+{
+  bfd_vma sign = (bfd_vma) 1 << (bits - 1);
+  return (value ^ sign) - sign;
+}
+
 #define elf_backend_common_definition   _bfd_mips_elf_common_definition
 #define elf_backend_name_local_section_symbols \
   _bfd_mips_elf_name_local_section_symbols
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.