From 8390634fd5fb311f01b82ba35a8db4b40b983cc8 Mon Sep 17 00:00:00 2001 From: Steve Ellcey Date: Thu, 3 Jul 2014 13:25:21 -0700 Subject: Update Binutils 2.24 to include mips32r6, mips64r6 and MSA changes. Change-Id: I24f28bc29dff188ba059388d8d5478f51da56a12 --- binutils-2.24/binutils/ChangeLog | 14 ++ binutils-2.24/binutils/doc/binutils.texi | 6 + binutils-2.24/binutils/readelf.c | 238 +++++++++++++++++++-- binutils-2.24/binutils/testsuite/ChangeLog | 6 + .../binutils/testsuite/binutils-all/objcopy.exp | 4 +- .../binutils/testsuite/binutils-all/readelf.exp | 2 + .../binutils/testsuite/binutils-all/readelf.s | 6 +- .../testsuite/binutils-all/readelf.ss-tmips | 12 +- .../binutils/testsuite/binutils-all/strip-3.d | 2 +- 9 files changed, 265 insertions(+), 25 deletions(-) (limited to 'binutils-2.24/binutils') diff --git a/binutils-2.24/binutils/ChangeLog b/binutils-2.24/binutils/ChangeLog index f9014b51..e4ee252b 100644 --- a/binutils-2.24/binutils/ChangeLog +++ b/binutils-2.24/binutils/ChangeLog @@ -1,3 +1,12 @@ +2014-04-23 Andrew Bennett + + * doc/binutils.texi: Document the disassemble MIPS XPA instructions + command line option. + +2014-02-06 Andrew Pinski + + * readelf.c (get_machine_flags): Handle E_MIPS_MACH_OCTEON3 case. + 2013-11-22 Cory Fields * windres.c (define_resource): Use zero for timestamp, making @@ -28,6 +37,11 @@ * nm.c (display_rel_file): Treat bfd_error_no_symbols as non-fatal. +2013-10-14 Chao-ying Fu + + * readelf.c (display_mips_gnu_attribute): Support Tag_GNU_MIPS_ABI_MSA. + * doc/binutils.texi: Document -Mmsa disassembler option. + 2013-10-12 H.J. Lu * dwarf.c (display_debug_frames): Pass offset_size to diff --git a/binutils-2.24/binutils/doc/binutils.texi b/binutils-2.24/binutils/doc/binutils.texi index 9176d9b5..59a33b1c 100644 --- a/binutils-2.24/binutils/doc/binutils.texi +++ b/binutils-2.24/binutils/doc/binutils.texi @@ -2114,9 +2114,15 @@ Print the 'raw' instruction mnemonic instead of some pseudo instruction mnemonic. I.e., print 'daddu' or 'or' instead of 'move', 'sll' instead of 'nop', etc. +@item msa +Disassemble MSA instructions. + @item virt Disassemble the virtualization ASE instructions. +@item xpa +Disassemble the eXtended Physical Address (XPA) ASE instructions. + @item gpr-names=@var{ABI} Print GPR (general-purpose register) names as appropriate for the specified ABI. By default, GPR names are selected according to diff --git a/binutils-2.24/binutils/readelf.c b/binutils-2.24/binutils/readelf.c index 61ea0ada..8e0c8195 100644 --- a/binutils-2.24/binutils/readelf.c +++ b/binutils-2.24/binutils/readelf.c @@ -2601,6 +2601,7 @@ get_machine_flags (unsigned e_flags, unsigned e_machine) case E_MIPS_MACH_LS3A: strcat (buf, ", loongson-3a"); break; case E_MIPS_MACH_OCTEON: strcat (buf, ", octeon"); break; case E_MIPS_MACH_OCTEON2: strcat (buf, ", octeon2"); break; + case E_MIPS_MACH_OCTEON3: strcat (buf, ", octeon3"); break; case E_MIPS_MACH_XLR: strcat (buf, ", xlr"); break; case 0: /* We simply ignore the field in this case to avoid confusion: @@ -2643,8 +2644,10 @@ get_machine_flags (unsigned e_flags, unsigned e_machine) case E_MIPS_ARCH_5: strcat (buf, ", mips5"); break; case E_MIPS_ARCH_32: strcat (buf, ", mips32"); break; case E_MIPS_ARCH_32R2: strcat (buf, ", mips32r2"); break; + case E_MIPS_ARCH_32R6: strcat (buf, ", mips32r6"); break; case E_MIPS_ARCH_64: strcat (buf, ", mips64"); break; case E_MIPS_ARCH_64R2: strcat (buf, ", mips64r2"); break; + case E_MIPS_ARCH_64R6: strcat (buf, ", mips64r6"); break; default: strcat (buf, _(", unknown ISA")); break; } break; @@ -2951,6 +2954,8 @@ get_mips_segment_type (unsigned long type) return "RTPROC"; case PT_MIPS_OPTIONS: return "OPTIONS"; + case PT_MIPS_ABIFLAGS: + return "ABIFLAGS"; default: break; } @@ -3150,6 +3155,7 @@ get_mips_section_type_name (unsigned int sh_type) case SHT_MIPS_EH_REGION: return "MIPS_EH_REGION"; case SHT_MIPS_XLATE_OLD: return "MIPS_XLATE_OLD"; case SHT_MIPS_PDR_EXCEPTION: return "MIPS_PDR_EXCEPTION"; + case SHT_MIPS_ABIFLAGS: return "MIPS_ABIFLAGS"; default: break; } @@ -11755,6 +11761,41 @@ display_sparc_gnu_attribute (unsigned char * p, return display_tag_value (tag, p, end); } +static void +print_mips_fp_abi_value (int val) +{ + switch (val) + { + case Val_GNU_MIPS_ABI_FP_ANY: + printf (_("Hard or soft float\n")); + break; + case Val_GNU_MIPS_ABI_FP_DOUBLE: + printf (_("Hard float (double precision)\n")); + break; + case Val_GNU_MIPS_ABI_FP_SINGLE: + printf (_("Hard float (single precision)\n")); + break; + case Val_GNU_MIPS_ABI_FP_SOFT: + printf (_("Soft float\n")); + break; + case Val_GNU_MIPS_ABI_FP_OLD_64: + printf (_("Hard float (MIPS32r2 64-bit FPU 12 callee-saved)\n")); + break; + case Val_GNU_MIPS_ABI_FP_XX: + printf (_("Hard float (32-bit CPU, Any FPU)\n")); + break; + case Val_GNU_MIPS_ABI_FP_64: + printf (_("Hard float (32-bit CPU, 64-bit FPU)\n")); + break; + case Val_GNU_MIPS_ABI_FP_64A: + printf (_("Hard float compat (32-bit CPU, 64-bit FPU)\n")); + break; + default: + printf ("??? (%d)\n", val); + break; + } +} + static unsigned char * display_mips_gnu_attribute (unsigned char * p, int tag, @@ -11769,29 +11810,34 @@ display_mips_gnu_attribute (unsigned char * p, p += len; printf (" Tag_GNU_MIPS_ABI_FP: "); + print_mips_fp_abi_value (val); + + return p; + } + + if (tag == Tag_GNU_MIPS_ABI_MSA) + { + unsigned int len; + int val; + + val = read_uleb128 (p, &len, end); + p += len; + printf (" Tag_GNU_MIPS_ABI_MSA: "); + switch (val) { - case Val_GNU_MIPS_ABI_FP_ANY: - printf (_("Hard or soft float\n")); + case Val_GNU_MIPS_ABI_MSA_ANY: + printf (_("Any MSA or not\n")); break; - case Val_GNU_MIPS_ABI_FP_DOUBLE: - printf (_("Hard float (double precision)\n")); - break; - case Val_GNU_MIPS_ABI_FP_SINGLE: - printf (_("Hard float (single precision)\n")); - break; - case Val_GNU_MIPS_ABI_FP_SOFT: - printf (_("Soft float\n")); - break; - case Val_GNU_MIPS_ABI_FP_64: - printf (_("Hard float (MIPS32r2 64-bit FPU)\n")); + case Val_GNU_MIPS_ABI_MSA_128: + printf (_("128-bit MSA\n")); break; default: printf ("??? (%d)\n", val); break; } return p; - } + } return display_tag_value (tag & 1, p, end); } @@ -12361,10 +12407,121 @@ print_mips_pltgot_entry (unsigned char * data, bfd_vma pltgot, bfd_vma addr) return addr + (is_32bit_elf ? 4 : 8); } +static void +print_mips_ases (unsigned int mask) +{ + if (mask & AFL_ASE_DSP) + fputs ("\n\tDSP ASE", stdout); + if (mask & AFL_ASE_DSPR2) + fputs ("\n\tDSP R2 ASE", stdout); + if (mask & AFL_ASE_EVA) + fputs ("\n\tEnhanced VA Scheme", stdout); + if (mask & AFL_ASE_MCU) + fputs ("\n\tMCU (MicroController) ASE", stdout); + if (mask & AFL_ASE_MDMX) + fputs ("\n\tMDMX ASE", stdout); + if (mask & AFL_ASE_MIPS3D) + fputs ("\n\tMIPS-3D ASE", stdout); + if (mask & AFL_ASE_MT) + fputs ("\n\tMT ASE", stdout); + if (mask & AFL_ASE_SMARTMIPS) + fputs ("\n\tSmartMIPS ASE", stdout); + if (mask & AFL_ASE_VIRT) + fputs ("\n\tVZ ASE", stdout); + if (mask & AFL_ASE_MSA) + fputs ("\n\tMSA ASE", stdout); + if (mask & AFL_ASE_MIPS16) + fputs ("\n\tMIPS16 ASE", stdout); + if (mask & AFL_ASE_MICROMIPS) + fputs ("\n\tMICROMIPS ASE", stdout); + if (mask & AFL_ASE_XPA) + fputs ("\n\tXPA ASE", stdout); + if (mask == 0) + fprintf (stdout, "\n\t%s", _("None")); +} + +static void +print_mips_isa_ext (unsigned int isa_ext) +{ + switch (isa_ext) + { + case 0: + fputs (_("None"), stdout); + break; + case AFL_EXT_XLR: + fputs ("RMI XLR", stdout); + break; + case AFL_EXT_OCTEON2: + fputs ("Cavium Networks Octeon2", stdout); + break; + case AFL_EXT_OCTEONP: + fputs ("Cavium Networks OcteonP", stdout); + break; + case AFL_EXT_LOONGSON_3A: + fputs ("Loongson 3A", stdout); + break; + case AFL_EXT_OCTEON: + fputs ("Cavium Networks Octeon", stdout); + break; + case AFL_EXT_5900: + fputs ("Toshiba R5900", stdout); + break; + case AFL_EXT_4650: + fputs ("MIPS R4650", stdout); + break; + case AFL_EXT_4010: + fputs ("LSI R4010", stdout); + break; + case AFL_EXT_4100: + fputs ("NEC VR4100", stdout); + break; + case AFL_EXT_3900: + fputs ("Toshiba R3900", stdout); + break; + case AFL_EXT_10000: + fputs ("MIPS R10000", stdout); + break; + case AFL_EXT_SB1: + fputs ("Broadcom SB-1", stdout); + break; + case AFL_EXT_4111: + fputs ("NEC VR4111/VR4181", stdout); + break; + case AFL_EXT_4120: + fputs ("NEC VR4120", stdout); + break; + case AFL_EXT_5400: + fputs ("NEC VR5400", stdout); + break; + case AFL_EXT_5500: + fputs ("NEC VR5500", stdout); + break; + case AFL_EXT_LOONGSON_2E: + fputs ("ST Microelectronics Loongson 2E", stdout); + break; + case AFL_EXT_LOONGSON_2F: + fputs ("ST Microelectronics Loongson 2F", stdout); + break; + default: + fputs (_("Unknown"), stdout); + } +} + +static int +get_mips_reg_size (int reg_size) +{ + return (reg_size == AFL_REG_NONE) ? 0 + : (reg_size == AFL_REG_32) ? 32 + : (reg_size == AFL_REG_64) ? 64 + : (reg_size == AFL_REG_128) ? 128 + : -1; +} + static int process_mips_specific (FILE * file) { Elf_Internal_Dyn * entry; + Elf_Internal_Shdr *sect = NULL; size_t liblist_offset = 0; size_t liblistno = 0; size_t conflictsno = 0; @@ -12382,6 +12539,57 @@ process_mips_specific (FILE * file) process_attributes (file, NULL, SHT_GNU_ATTRIBUTES, NULL, display_mips_gnu_attribute); + sect = find_section (".MIPS.abiflags"); + + if (sect != NULL) + { + Elf_External_ABIFlags_v0 *abiflags_ext; + Elf_Internal_ABIFlags_v0 abiflags_in; + + if (sizeof (Elf_External_ABIFlags_v0) != sect->sh_size) + fputs ("\nCorrupt ABI Flags section.\n", stdout); + else + { + abiflags_ext = get_data (NULL, file, sect->sh_offset, 1, + sect->sh_size, _("MIPS ABI Flags section")); + if (abiflags_ext) + { + abiflags_in.version = BYTE_GET (abiflags_ext->version); + abiflags_in.isa_level = BYTE_GET (abiflags_ext->isa_level); + abiflags_in.isa_rev = BYTE_GET (abiflags_ext->isa_rev); + abiflags_in.gpr_size = BYTE_GET (abiflags_ext->gpr_size); + abiflags_in.cpr1_size = BYTE_GET (abiflags_ext->cpr1_size); + abiflags_in.cpr2_size = BYTE_GET (abiflags_ext->cpr2_size); + abiflags_in.fp_abi = BYTE_GET (abiflags_ext->fp_abi); + abiflags_in.isa_ext = BYTE_GET (abiflags_ext->isa_ext); + abiflags_in.ases = BYTE_GET (abiflags_ext->ases); + abiflags_in.flags1 = BYTE_GET (abiflags_ext->flags1); + abiflags_in.flags2 = BYTE_GET (abiflags_ext->flags2); + + printf ("\nMIPS ABI Flags Version: %d\n", abiflags_in.version); + printf ("\nISA: MIPS%d", abiflags_in.isa_level); + if (abiflags_in.isa_rev > 1) + printf ("r%d", abiflags_in.isa_rev); + printf ("\nGPR size: %d", + get_mips_reg_size (abiflags_in.gpr_size)); + printf ("\nCPR1 size: %d", + get_mips_reg_size (abiflags_in.cpr1_size)); + printf ("\nCPR2 size: %d", + get_mips_reg_size (abiflags_in.cpr2_size)); + fputs ("\nFP ABI: ", stdout); + print_mips_fp_abi_value (abiflags_in.fp_abi); + fputs ("ISA Extension: ", stdout); + print_mips_isa_ext (abiflags_in.isa_ext); + fputs ("\nASEs:", stdout); + print_mips_ases (abiflags_in.ases); + printf ("\nFLAGS 1: %8.8lx", abiflags_in.flags1); + printf ("\nFLAGS 2: %8.8lx", abiflags_in.flags2); + fputc ('\n', stdout); + free (abiflags_ext); + } + } + } + /* We have a lot of special sections. Thanks SGI! */ if (dynamic_section == NULL) /* No information available. */ @@ -12521,11 +12729,11 @@ process_mips_specific (FILE * file) if (options_offset != 0) { Elf_External_Options * eopt; - Elf_Internal_Shdr * sect = section_headers; Elf_Internal_Options * iopt; Elf_Internal_Options * option; size_t offset; int cnt; + sect = section_headers; /* Find the section header so that we get the size. */ while (sect->sh_type != SHT_MIPS_OPTIONS) diff --git a/binutils-2.24/binutils/testsuite/ChangeLog b/binutils-2.24/binutils/testsuite/ChangeLog index 1ab6e86b..90ccd391 100644 --- a/binutils-2.24/binutils/testsuite/ChangeLog +++ b/binutils-2.24/binutils/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-11-27 Matthew Fortune + + * binutils-all/objcopy.exp: Consider mips-mti-elf the same as + mips-sde-elf + * binutils-all/readelf.exp: Likewise + 2013-10-12 H.J. Lu * binutils-all/x86-64/compressed-1a.d: Updated for 64-bit addresses. diff --git a/binutils-2.24/binutils/testsuite/binutils-all/objcopy.exp b/binutils-2.24/binutils/testsuite/binutils-all/objcopy.exp index 4dfb73c7..66d3d517 100644 --- a/binutils-2.24/binutils/testsuite/binutils-all/objcopy.exp +++ b/binutils-2.24/binutils/testsuite/binutils-all/objcopy.exp @@ -988,7 +988,9 @@ if [is_elf_format] { # targ_defvec=bfd_elf32_nbigmips_vec or # targ_defvec=bfd_elf32_nlittlemips_vec in config.bfd. When syncing, # don't forget that earlier case-matches trump later ones. - if { ![istarget "mips*-sde-elf*"] && ![istarget "mips64*-*-openbsd*"] } { + if { ![istarget "mips*-sde-elf*"] && ![istarget "mips*-mti-elf*"] + && ![istarget "mips*-img-elf*"] + && ![istarget "mips64*-*-openbsd*"] } { setup_xfail "mips*-*-irix5*" "mips*-*-irix6*" "mips*-*-elf*" \ "mips*-*-rtems*" "mips*-*-windiss" "mips*-*-none" \ "mips*-*-openbsd*" "mips*-*-chorus*" diff --git a/binutils-2.24/binutils/testsuite/binutils-all/readelf.exp b/binutils-2.24/binutils/testsuite/binutils-all/readelf.exp index db56a868..a0f54d93 100644 --- a/binutils-2.24/binutils/testsuite/binutils-all/readelf.exp +++ b/binutils-2.24/binutils/testsuite/binutils-all/readelf.exp @@ -102,6 +102,8 @@ proc readelf_test { options binary_file regexp_file xfails } { if [istarget "mips*-*-*"] then { if { [istarget "mips*-*-*linux*"] || [istarget "mips*-sde-elf*"] + || [istarget "mips*-mti-elf*"] + || [istarget "mips*-img-elf*"] || [istarget "mips*-*freebsd*"] } then { set target_machine tmips } else { diff --git a/binutils-2.24/binutils/testsuite/binutils-all/readelf.s b/binutils-2.24/binutils/testsuite/binutils-all/readelf.s index 8361a7eb..3b044b10 100644 --- a/binutils-2.24/binutils/testsuite/binutils-all/readelf.s +++ b/binutils-2.24/binutils/testsuite/binutils-all/readelf.s @@ -6,16 +6,16 @@ Section Headers: # On the normal MIPS systems, sections must be aligned to 16 byte # boundaries. On IA64, text sections are aligned to 16 byte boundaries. +\[ 1\] .text +PROGBITS +00000000 0000(34|40) 0000(08|10) 00 +AX +0 +0 +(.|..) - +\[ 2\] .rel.+text +REL. +0+ 0+.* 00000. 0. +. +1 +4 + +\[ 2\] .rel.+text +REL. +0+ 0+.* 0000.. 0. +I +.+ +1 +4 # MIPS targets put .rela.text here. #... +\[ .\] .data +PROGBITS +00000000 0000(3c|48|50) 0000(04|10) 00 +WA +0 +0 +(.|..) +\[ .\] .bss +NOBITS +00000000 0000(40|4c|60) 000000 00 +WA +0 +0 +(.|..) -# MIPS targets put .reginfo and .mdebug here. +# MIPS targets put .reginfo, .mdebug, .MIPS.abiflags and .gnu.attributes here. # v850 targets put .call_table_data and .call_table_text here. #... +\[ .\] .shstrtab +STRTAB +00000000 0+.* 0+.* 00 +0 +0 +. - +\[ .\] .symtab +SYMTAB +00000000 0+.* 0+.* 10 +.. +. +4 + +\[..\] .symtab +SYMTAB +00000000 0+.* 0+.* 10 +.. +.+ +4 +\[..\] .strtab +STRTAB +00000000 0+.* 0+.* 00 +0 +0 +1 Key to Flags: #... diff --git a/binutils-2.24/binutils/testsuite/binutils-all/readelf.ss-tmips b/binutils-2.24/binutils/testsuite/binutils-all/readelf.ss-tmips index 1f872489..c59f7531 100644 --- a/binutils-2.24/binutils/testsuite/binutils-all/readelf.ss-tmips +++ b/binutils-2.24/binutils/testsuite/binutils-all/readelf.ss-tmips @@ -1,5 +1,5 @@ -Symbol table '.symtab' contains 12 entries: +Symbol table '.symtab' contains 14 entries: +Num: +Value +Size +Type +Bind +Vis +Ndx +Name +0: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +UND +1: 00000000 +0 +SECTION +LOCAL +DEFAULT +1 @@ -9,7 +9,9 @@ Symbol table '.symtab' contains 12 entries: +5: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +3 static_data_symbol +6: 00000000 +0 +SECTION +LOCAL +DEFAULT +5 +7: 00000000 +0 +SECTION +LOCAL +DEFAULT +6 - +8: 00000000 +0 +OBJECT +GLOBAL +DEFAULT +1 text_symbol - +9: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol - +10: 00000000 +0 +OBJECT +GLOBAL +DEFAULT +3 data_symbol - +11: 00000004 +4 +(COMMON|OBJECT) +GLOBAL +DEFAULT +(PRC|COM) common_symbol + +8: 00000000 +0 +SECTION +LOCAL +DEFAULT +7 + +9: 00000000 +0 +SECTION +LOCAL +DEFAULT +8 + +10: 00000000 +0 +OBJECT +GLOBAL +DEFAULT +1 text_symbol + +11: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol + +12: 00000000 +0 +OBJECT +GLOBAL +DEFAULT +3 data_symbol + +13: 00000004 +4 +(COMMON|OBJECT) +GLOBAL +DEFAULT +(PRC|COM) common_symbol diff --git a/binutils-2.24/binutils/testsuite/binutils-all/strip-3.d b/binutils-2.24/binutils/testsuite/binutils-all/strip-3.d index acfec85d..ee2708e4 100644 --- a/binutils-2.24/binutils/testsuite/binutils-all/strip-3.d +++ b/binutils-2.24/binutils/testsuite/binutils-all/strip-3.d @@ -1,6 +1,6 @@ #PROG: strip #source: empty.s -#strip: -R .text -R .data -R .bss -R .ARM.attributes -R .reginfo -R .pdr -R .xtensa.info +#strip: -R .text -R .data -R .bss -R .ARM.attributes -R .reginfo -R .gnu.attributes -R .MIPS.abiflags -R .pdr -R .xtensa.info #readelf: -S --wide #name: strip empty file #target: *-*-linux* *-*-gnu* -- cgit v1.2.3