]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
MIPS/BFD: Make `_bfd_mips_elf_sign_extend' static inline
authorMaciej W. Rozycki <macro@orcam.me.uk>
Wed, 11 Mar 2026 16:30:29 +0000 (16:30 +0000)
committerMaciej W. Rozycki <macro@orcam.me.uk>
Wed, 11 Mar 2026 16:30:29 +0000 (16:30 +0000)
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.

bfd/elfxx-mips.c
bfd/elfxx-mips.h

index 24a08436d055cf490395be21b6733d7cfed0bdb3..0d3fcd28987f2c1683fb7fa38bbe4cfc6bdeead4 100644 (file)
@@ -5234,15 +5234,6 @@ mips_elf_local_relocation_p (bfd *input_bfd,
   return false;
 }
 \f
-/* 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.  */
index fedc21ed3d95ca17d11dd5960678b976bc2706c6..e39e0b15478d48b45b8394ab6971e505a6ea4a66 100644 (file)
@@ -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