[binutils-gdb] elf: Define ABI_64_P in elf-bfd.h

H.J. Lu hjl@sourceware.org
Sat Oct 4 01:13:16 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=025c45fdaca4e4bbfe16cb7931f77d6f68c5356c

commit 025c45fdaca4e4bbfe16cb7931f77d6f68c5356c
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Sep 23 08:25:49 2025 +0800

    elf: Define ABI_64_P in elf-bfd.h
    
    Define ABI_64_P in elf-bfd.h to avoid duplications.
    
            * elf-bfd.h (ABI_64_P): New.
            * elfxx-mips.c (ABI_64_P): Removed.
            * elfxx-sparc.c (ABI_64_P): Likewise.
            * elfxx-tilegx.c (ABI_64_P): Likewise.
            * elfxx-x86.h (ABI_64_P): Likewise.
    
    Signed-off-by: H.J. Lu <hjl.tools@gmail.com>

Diff:
---
 bfd/elf-bfd.h      | 3 +++
 bfd/elfxx-mips.c   | 4 ----
 bfd/elfxx-sparc.c  | 3 ---
 bfd/elfxx-tilegx.c | 3 ---
 bfd/elfxx-x86.h    | 3 ---
 5 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 9ce81ebd314..5d19529d972 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1919,6 +1919,9 @@ struct bfd_elf_section_data
 #define get_elf_backend_data(abfd) \
    xvec_get_elf_backend_data ((abfd)->xvec)
 
+#define ABI_64_P(abfd) \
+  (get_elf_backend_data (abfd)->s->elfclass == ELFCLASS64)
+
 /* The least object attributes (within an attributes subsection) known
    for any target.  Some code assumes that the value 0 is not used and
    the field for that attribute can instead be used as a marker to
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index bf3fd7df805..181f9f5e9fc 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -816,10 +816,6 @@ static bfd *reldyn_sorting_bfd;
 #define ABI_N32_P(abfd) \
   ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0)
 
-/* Nonzero if ABFD is using the N64 ABI.  */
-#define ABI_64_P(abfd) \
-  (get_elf_backend_data (abfd)->s->elfclass == ELFCLASS64)
-
 /* Nonzero if ABFD is using NewABI conventions.  */
 #define NEWABI_P(abfd) (ABI_N32_P (abfd) || ABI_64_P (abfd))
 
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index bbaa7829132..1f3b9d831d8 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -37,9 +37,6 @@
 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value.  */
 #define MINUS_ONE (~ (bfd_vma) 0)
 
-#define ABI_64_P(abfd) \
-  (get_elf_backend_data (abfd)->s->elfclass == ELFCLASS64)
-
 /* The relocation "howto" table.  */
 
 /* Utility for performing the standard initial work of an instruction
diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c
index 79358e6b204..577d259a3b8 100644
--- a/bfd/elfxx-tilegx.c
+++ b/bfd/elfxx-tilegx.c
@@ -27,9 +27,6 @@
 #include "libiberty.h"
 #include "elfxx-tilegx.h"
 
-#define ABI_64_P(abfd) \
-  (get_elf_backend_data (abfd)->s->elfclass == ELFCLASS64)
-
 #define TILEGX_ELF_WORD_BYTES(htab) \
   ((htab)->bytes_per_word)
 
diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h
index f8a24a77577..4cb18a914f9 100644
--- a/bfd/elfxx-x86.h
+++ b/bfd/elfxx-x86.h
@@ -102,9 +102,6 @@
    header.  */
 #define PLT_SFRAME_FDE_START_OFFSET	sizeof (sframe_header)
 
-#define ABI_64_P(abfd) \
-  (get_elf_backend_data (abfd)->s->elfclass == ELFCLASS64)
-
 /* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
    copying dynamic variables from a shared lib into an app's dynbss
    section, and instead use a dynamic relocation to point into the


More information about the Binutils-cvs mailing list