https://sourceware.org/bugzilla/show_bug.cgi?id=21248
Bug ID: 21248 Summary: GNU BINUTILS 2.28 PPC objdump output error: mtivor35,mtibatl Product: binutils Version: 2.28 Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: jrodor at pacbell dot net Target Milestone: --- Created attachment 9901 --> https://sourceware.org/bugzilla/attachment.cgi?id=9901&action=edit PowerPC Assembly code for gas and then objdump. TITLE: GNU BINUTILS 2.28 PPC objdump output error: mtivor35,mtibatl SUMMARY: This GNU Binutils 2.28 software defect report contains seven enumerated sections, labeled: (#1): ## ORIGINAL_ASM_SOURCE_SIMPLIFIED_EXAMPLE: (#2): ## ASSEMBLY_OF_ASM_SOURCE_XTERM_SESSION_LOG: (#3): ## OBJDUMP_INFORMATION_OUTPUT: (#4): ## OBJDUMP_OUTPUT: --disassembler-options=e6500 --architecture=powerpc:e6500 (#5): ## OBJDUMP_OUTPUT: --disassembler-options=titan --architecture=powerpc:titan (#6): ## RELATED_BINUTILS_SOURCE_CODE_EXCERPT: (#7): ## ANALYSIS: DETAILED_SECTIONS: (#1): ## ORIGINAL_ASM_SOURCE_SIMPLIFIED_EXAMPLE: ## ATTACHED_FILENAME: showObjdumpIssue1.s ## SOURCE_LIST: .text li 3, 0 mtspr 528, 3 mtspr 529, 3 mtspr 530, 3 mtspr 531, 3 mtibatl 1,3 .end (#2): ## ASSEMBLY_OF_ASM_SOURCE_XTERM_SESSION_LOG: jrod@jrod-lx1$:/opt/gnu/binutils/binutils-2.28/gas $ ls -l as-new -rwxr-xr-x 1 jrod users 7514736 Mar 6 13:19 as-new jrod@jrod-lx1$:/opt/gnu/binutils/binutils-2.28/gas $ file as-new as-new: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=18a71b03164e039d3e6e1d882e162d1ecfea10b1, not stripped jrod@jrod-lx1$:/opt/gnu/binutils/binutils-2.28/gas $ ./as-new --version GNU assembler (GNU Binutils) 2.28 Copyright (C) 2017 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty. This assembler was configured for a target of `powerpc-eabi'. jrod@jrod-lx1$:/opt/gnu/binutils/binutils-2.28/gas $ ./as-new -a -me6500 showObjdumpIssue1.s GAS LISTING showObjdumpIssue1.s page 1 1 .text 2 0000 38600000 li 3, 0 3 0004 7C7083A6 mtspr 528, 3 4 0008 7C7183A6 mtspr 529, 3 5 000c 7C7283A6 mtspr 530, 3 6 0010 7C7383A6 mtspr 531, 3 7 0014 7C7383A6 mtibatl 1,3 8 .end GAS LISTING showObjdumpIssue1.s page 2 NO DEFINED SYMBOLS NO UNDEFINED SYMBOLS jrod@jrod-lx1$:/opt/gnu/binutils/binutils-2.28/gas $ jrod@jrod-lx1$:/opt/gnu/binutils/binutils-2.28/gas $ ls -l a.out -rw-r--r-- 1 jrod users 468 Mar 13 11:19 a.out jrod@jrod-lx1$:/opt/gnu/binutils/binutils-2.28/gas $ file a.out a.out: ELF 32-bit MSB relocatable, PowerPC or cisco 4500, version 1 (SYSV), not stripped (#3): ## OBJDUMP_INFORMATION_OUTPUT: jrod@jrod-lx1$:/opt/gnu/binutils/binutils-2.28/gas $ ls -l /opt/gnu/binutils/binutils-2.28/binutils/objdump -rwxr-xr-x 1 jrod users 7642172 Mar 6 13:19 /opt/gnu/binutils/binutils-2.28/binutils/objdump jrod@jrod-lx1$:/opt/gnu/binutils/binutils-2.28/gas $ file /opt/gnu/binutils/binutils-2.28/binutils/objdump /opt/gnu/binutils/binutils-2.28/binutils/objdump: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=e2b2875e3ecd3db24f6bfa7fcce6bee5930b66cd, not stripped jrod@jrod-lx1$:/opt/gnu/binutils/binutils-2.28/gas $ /opt/gnu/binutils/binutils-2.28/binutils/objdump -v GNU objdump (GNU Binutils) 2.28 Copyright (C) 2017 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) any later version. This program has absolutely no warranty. jrod@jrod-lx1$:/opt/gnu/binutils/binutils-2.28/gas $ (#4): ## OBJDUMP_OUTPUT: --disassembler-options=e6500 --architecture=powerpc:e6500 jrod@jrod-lx1$:/opt/gnu/binutils/binutils-2.28/gas $ /opt/gnu/binutils/binutils-2.28/binutils/objdump -l -r -S --disassembler-options=e6500 --architecture=powerpc:e6500 /opt/gnu/binutils/binutils-2.28/gas/a.out /opt/gnu/binutils/binutils-2.28/gas/a.out: file format elf32-powerpc Disassembly of section .text: 00000000 <.text>: 0: 38 60 00 00 li r3,0 4: 7c 70 83 a6 mtibatu 0,r3 8: 7c 71 83 a6 mtibatl 0,r3 c: 7c 72 83 a6 mtibatu 1,r3 10: 7c 73 83 a6 mtibatl 1,r3 14: 7c 73 83 a6 mtibatl 1,r3 (#5): ## OBJDUMP_OUTPUT: --disassembler-options=titan --architecture=powerpc:titan jrod@jrod-lx1$:/opt/gnu/binutils/binutils-2.28/gas $ /opt/gnu/binutils/binutils-2.28/binutils/objdump -l -r -S --disassembler-options=titan --architecture=powerpc:titan /opt/gnu/binutils/binutils-2.28/gas/a.out /opt/gnu/binutils/binutils-2.28/gas/a.out: file format elf32-powerpc Disassembly of section .text: 00000000 <.text>: 0: 38 60 00 00 li r3,0 4: 7c 70 83 a6 mtspr 528,r3 8: 7c 71 83 a6 mtspr 529,r3 c: 7c 72 83 a6 mtspr 530,r3 10: 7c 73 83 a6 mtivor35 r3 14: 7c 73 83 a6 mtivor35 r3 (#6): ## RELATED_BINUTILS_SOURCE_CODE_EXCERPT: /opt/gnu/binutils/binutils-2.28/opcodes/ppc-opc.c {"mtivor32", XSPR(31,467,528), XSPR_MASK, PPCSPE, 0, {RS}}, {"mtibatu", XSPR(31,467,528), XSPRBAT_MASK, PPC, TITAN, {SPRBAT, RS}}, {"mtivor33", XSPR(31,467,529), XSPR_MASK, PPCSPE, 0, {RS}}, {"mtibatl", XSPR(31,467,529), XSPRBAT_MASK, PPC, TITAN, {SPRBAT, RS}}, {"mtivor34", XSPR(31,467,530), XSPR_MASK, PPCSPE, 0, {RS}}, {"mtivor35", XSPR(31,467,531), XSPR_MASK, PPCPMR, 0, {RS}}, (#7): ## ANALYSIS: First I tried with a 2.19-base objdump these available options (NXP core e6500 was not available): --architecture=powerpc:common --architecture=powerpc:e500 --architecture=powerpc:e500mc In every case, objdumpppc output the apparently wrong: b2c: 7c 73 83 a6 mtibatl 1,r3 Instead of the apparently correct value: b2c: 7c 73 83 a6 mtivor35 r3 But the output of the "apparently wrong" objdump interpretation of the machine code "7c7383a6" was not initially distinguishable from the alternative: GAS output of the wrong machine code. After a manual disassembly of machine code "7c7383a6", staff was reasonably certain that GAS generated the correct machine code from the assembly source. Thus, the conclusion that "objdump" was the origin of them problem, staff decided to try the binutils 2.28 released 2017-03-02. It exhibited the same problem. It seems from an examination of the two 2.28 outputs and a peek at the source code in /opt/gnu/binutils/binutils-2.28/opcodes/ppc-opc.c that APM/AMCC's "Titan" core has PPC EABI OPcode which overlap with NXP/Freescale: {"mtivor32", XSPR(31,467,528), XSPR_MASK, PPCSPE, 0, {RS}}, {"mtibatu", XSPR(31,467,528), XSPRBAT_MASK, PPC, TITAN, {SPRBAT, RS}}, {"mtivor33", XSPR(31,467,529), XSPR_MASK, PPCSPE, 0, {RS}}, {"mtibatl", XSPR(31,467,529), XSPRBAT_MASK, PPC, TITAN, {SPRBAT, RS}}, {"mtivor34", XSPR(31,467,530), XSPR_MASK, PPCSPE, 0, {RS}}, {"mtivor35", XSPR(31,467,531), XSPR_MASK, PPCPMR, 0, {RS}}, So to an extent, the objdump-2.28 options that select for NXP/Freescale e6500 are swapped and output the AMCC/APM Titan values: ## OBJDUMP_OUTPUT: --disassembler-options=e6500 --architecture=powerpc:e6500 4: 7c 70 83 a6 mtibatu 0,r3 8: 7c 71 83 a6 mtibatl 0,r3 c: 7c 72 83 a6 mtibatu 1,r3 10: 7c 73 83 a6 mtibatl 1,r3 14: 7c 73 83 a6 mtibatl 1,r3 ## OBJDUMP_OUTPUT: --disassembler-options=titan --architecture=powerpc:titan 4: 7c 70 83 a6 mtspr 528,r3 8: 7c 71 83 a6 mtspr 529,r3 c: 7c 72 83 a6 mtspr 530,r3 10: 7c 73 83 a6 mtivor35 r3 14: 7c 73 83 a6 mtivor35 r3 However, the anomaly seems a little worse than just swapping the two. This is speculation, but in the case of this swapped objdump line: 10: 7c 73 83 a6 mtivor35 r3 It is not evident how that could match with this opcodes/ppc-opc.c line: {"mtivor35", XSPR(31,467,531), XSPR_MASK, PPCPMR, 0, {RS}}, Because XSPR(31,467,531) has no TITAN match, yet the apparent algorithm matched: 10: 7c 73 83 a6 mtibatl 1,r3 But the match for "mtibatl" (Move to IBAT lower) is: XSPR(31,467,529) which does not equal: XSPR(31,467,531), since 529 != 531. Perhaps that is a mismatch feature. In any case, the objdump is defective in that for these PPC OPcodes, selecting architecture=powerpc:e6500 outputs Titan, and vice_versa. The knowledge that the GNU Assembler (gas) is not broken is reassuring. -------------------------------------------------------------------------- NOTE1: Support for PPC "mtivor35" was originally inserted by Aldy Hernandez <al...@redhat.com> https://sourceware.org/ml/binutils/2004-02/msg00250.html patch: ppc-e500 add m*ivor35 From: Aldy Hernandez <aldyh at redhat dot com> To: binutils at sources dot redhat dot com Date: Fri, 20 Feb 2004 00:55:57 -0400 Subject: patch: ppc-e500 add m*ivor35 Sigh. More of the same. I guess I should do them all at once. 2004-02-20 Aldy Hernandez <al...@redhat.com> * ppc-opc.c (powerpc_opcodes): Add m*fivor35. Index: ppc-opc.c =================================================================== RCS file: /cvs/src/src/opcodes/ppc-opc.c,v retrieving revision 1.61 diff -u -p -r1.61 ppc-opc.c --- ppc-opc.c 20 Feb 2004 04:45:37 -0000 1.61 +++ ppc-opc.c 20 Feb 2004 04:54:30 -0000 @@ -3686,6 +3686,7 @@ const struct powerpc_opcode powerpc_opco { "mfivor32", XSPR(31,339,528), XSPR_MASK, PPCSPE, { RT } }, { "mfivor33", XSPR(31,339,529), XSPR_MASK, PPCSPE, { RT } }, { "mfivor34", XSPR(31,339,530), XSPR_MASK, PPCSPE, { RT } }, +{ "mfivor35", XSPR(31,339,531), XSPR_MASK, PPCPMR, { RT } }, { "mfibatu", XSPR(31,339,528), XSPRBAT_MASK, PPC, { RT, SPRBAT } }, { "mfibatl", XSPR(31,339,529), XSPRBAT_MASK, PPC, { RT, SPRBAT } }, { "mfdbatu", XSPR(31,339,536), XSPRBAT_MASK, PPC, { RT, SPRBAT } }, @@ -3996,6 +3997,7 @@ const struct powerpc_opcode powerpc_opco { "mtivor32", XSPR(31,467,528), XSPR_MASK, PPCSPE, { RS } }, { "mtivor33", XSPR(31,467,529), XSPR_MASK, PPCSPE, { RS } }, { "mtivor34", XSPR(31,467,530), XSPR_MASK, PPCSPE, { RS } }, +{ "mtivor35", XSPR(31,467,531), XSPR_MASK, PPCPMR, { RS } }, { "mtibatu", XSPR(31,467,528), XSPRBAT_MASK, PPC, { SPRBAT, RS } }, { "mtibatl", XSPR(31,467,529), XSPRBAT_MASK, PPC, { SPRBAT, RS } }, { "mtdbatu", XSPR(31,467,536), XSPRBAT_MASK, PPC, { SPRBAT, RS } }, NOTE2: The AMCC Titan core was scrapped in 2010, maybe binutils support could be removed? https://en.wikipedia.org/wiki/Titan_%28microprocessor%29 Titan was supposed to be a family of 32-bit Power Architecture-based microprocessor cores designed by Applied Micro Circuits Corporation (AMCC), but was scrapped in 2010 according to reports. ... -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils