[binutils-gdb] MIPS/BFD: Use enumeration constants for EI_ABIVERSION
Maciej W.Rozycki
macro@sourceware.org
Thu Jun 21 20:42:00 GMT 2018
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bb29b84d8c2cc2e91f8dec7f7eb64f03470bd03c
commit bb29b84d8c2cc2e91f8dec7f7eb64f03470bd03c
Author: Maciej W. Rozycki <macro@mips.com>
Date: Thu Jun 21 21:40:56 2018 +0100
MIPS/BFD: Use enumeration constants for EI_ABIVERSION
Define enumeration constants based on generated `libc-abis.h' from GNU
libc, adding a MIPS_ prefix as these are port-specific. Use them to
replace magic numbers stored in the EI_ABIVERSION field of the ELF file
header.
bfd/
* elfxx-mips.c (MIPS_LIBC_ABI_DEFAULT, MIPS_LIBC_ABI_MIPS_PLT)
(MIPS_LIBC_ABI_UNIQUE, MIPS_LIBC_ABI_MIPS_O32_FP64)
(MIPS_LIBC_ABI_MAX): New enumeration constants.
(_bfd_mips_post_process_headers): Use them in place of magic
numbers.
Diff:
---
bfd/ChangeLog | 8 ++++++++
bfd/elfxx-mips.c | 16 ++++++++++++++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e962822..68db522 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-21 Maciej W. Rozycki <macro@mips.com>
+
+ * elfxx-mips.c (MIPS_LIBC_ABI_DEFAULT, MIPS_LIBC_ABI_MIPS_PLT)
+ (MIPS_LIBC_ABI_UNIQUE, MIPS_LIBC_ABI_MIPS_O32_FP64)
+ (MIPS_LIBC_ABI_MAX): New enumeration constants.
+ (_bfd_mips_post_process_headers): Use them in place of magic
+ numbers.
+
2018-06-21 Jim Wilson <jimw@sifive.com>
* elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Update comment.
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 844750eb..f3a2d3b 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -16230,6 +16230,18 @@ bfd_mips_elf_get_abiflags (bfd *abfd)
return tdata->abiflags_valid ? &tdata->abiflags : NULL;
}
+/* MIPS libc ABI versions, used with the EI_ABIVERSION ELF file header
+ field. Taken from `libc-abis.h' generated at GNU libc build time.
+ Using a MIPS_ prefix as other libc targets use different values. */
+enum
+{
+ MIPS_LIBC_ABI_DEFAULT = 0,
+ MIPS_LIBC_ABI_MIPS_PLT,
+ MIPS_LIBC_ABI_UNIQUE,
+ MIPS_LIBC_ABI_MIPS_O32_FP64,
+ MIPS_LIBC_ABI_MAX
+};
+
void
_bfd_mips_post_process_headers (bfd *abfd, struct bfd_link_info *link_info)
{
@@ -16243,14 +16255,14 @@ _bfd_mips_post_process_headers (bfd *abfd, struct bfd_link_info *link_info)
BFD_ASSERT (htab != NULL);
if (htab->use_plts_and_copy_relocs && !htab->is_vxworks)
- i_ehdrp->e_ident[EI_ABIVERSION] = 1;
+ i_ehdrp->e_ident[EI_ABIVERSION] = MIPS_LIBC_ABI_MIPS_PLT;
}
_bfd_elf_post_process_headers (abfd, link_info);
if (mips_elf_tdata (abfd)->abiflags.fp_abi == Val_GNU_MIPS_ABI_FP_64
|| mips_elf_tdata (abfd)->abiflags.fp_abi == Val_GNU_MIPS_ABI_FP_64A)
- i_ehdrp->e_ident[EI_ABIVERSION] = 3;
+ i_ehdrp->e_ident[EI_ABIVERSION] = MIPS_LIBC_ABI_MIPS_O32_FP64;
}
int
More information about the Binutils-cvs
mailing list