This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH][MIPS] Acknowledge the presence of unknown ASEs/ISA_EXTs
- From: Matthew Fortune <Matthew dot Fortune at imgtec dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Tue, 21 Oct 2014 10:57:28 +0000
- Subject: [PATCH][MIPS] Acknowledge the presence of unknown ASEs/ISA_EXTs
- Authentication-results: sourceware.org; auth=none
The ASES and ISA_EXT fields of .MIPS.abiflags will get new values/bits defined
over time. Currently any unknown values/bits are ignored, for ISA_EXT the word
'Unknown' is printed and for ASEs nothing is printed at all.
This patch improves these cases to print 'Unknown (<value>)' in both cases to
clearly indicate that there is an unknown value present and what that value is.
For ASES this is hex as it is a bitmask and for ISA_EXT it is a decimal.
Tested with no regressions on mips64-linux-gnu. Also manually tested by injecting
unknown values into a binary and checking the output.
Thanks,
Matthew
bfd/
* elfxx-mips.c (print_mips_ases): Print unknown ASEs.
(print_mips_isa_ext): Print the value of an unknown extension.
binutils/
* readelf.c (print_mips_ases): Print unknown ASEs.
(print_mips_isa_ext): Print the value of an unknown extension.
include/
* elf/mips.h (AFL_ASE_MASK): Define.
---
bfd/elfxx-mips.c | 4 +++-
binutils/readelf.c | 4 +++-
include/elf/mips.h | 1 +
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index a1e9945..61c363a 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -15507,6 +15507,8 @@ print_mips_ases (FILE *file, unsigned int mask)
fputs ("\n\tXPA ASE", file);
if (mask == 0)
fprintf (file, "\n\t%s", _("None"));
+ else if ((mask & ~AFL_ASE_MASK) != 0)
+ fprintf (stdout, "\n\t%s (%x)", _("Unknown"), mask & ~AFL_ASE_MASK);
}
static void
@@ -15572,7 +15574,7 @@ print_mips_isa_ext (FILE *file, unsigned int isa_ext)
fputs ("ST Microelectronics Loongson 2F", file);
break;
default:
- fputs (_("Unknown"), file);
+ fprintf (file, "%s (%d)", _("Unknown"), isa_ext);
break;
}
}
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 58ccd93..bc79f03 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -12723,6 +12723,8 @@ print_mips_ases (unsigned int mask)
fputs ("\n\tXPA ASE", stdout);
if (mask == 0)
fprintf (stdout, "\n\t%s", _("None"));
+ else if ((mask & ~AFL_ASE_MASK) != 0)
+ fprintf (stdout, "\n\t%s (%x)", _("Unknown"), mask & ~AFL_ASE_MASK);
}
static void
@@ -12788,7 +12790,7 @@ print_mips_isa_ext (unsigned int isa_ext)
fputs ("ST Microelectronics Loongson 2F", stdout);
break;
default:
- fputs (_("Unknown"), stdout);
+ fprintf (stdout, "%s (%d)", _("Unknown"), isa_ext);
}
}
diff --git a/include/elf/mips.h b/include/elf/mips.h
index 1fa69c1..2ed6acd 100644
--- a/include/elf/mips.h
+++ b/include/elf/mips.h
@@ -1224,6 +1224,7 @@ extern void bfd_mips_elf_swap_abiflags_v0_out
#define AFL_ASE_MIPS16 0x00000400 /* MIPS16 ASE. */
#define AFL_ASE_MICROMIPS 0x00000800 /* MICROMIPS ASE. */
#define AFL_ASE_XPA 0x00001000 /* XPA ASE. */
+#define AFL_ASE_MASK 0x00001fff /* All ASEs. */
/* Values for the isa_ext word of an ABI flags structure. */
--
1.9.4