Bug 18317 - objdump -W fails to handle elf32-mep
Summary: objdump -W fails to handle elf32-mep
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.26
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-24 12:37 UTC by H.J. Lu
Modified: 2015-04-30 15:02 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2015-04-24 12:37:24 UTC
[hjl@gnu-tools-1 binutils]$ ../gas/as-new -o x.o /export/gnu/import/git/sources/binutils-gdb/binutils/testsuite/binutils-all/dw2-1.S
[hjl@gnu-tools-1 binutils]$ ./objdump -W x.o > 1[hjl@gnu-tools-1 binutils]$ ./readelf -w  x.o > 2
[hjl@gnu-tools-1 binutils]$ diff -up 1 2
--- 1	2015-04-24 05:36:47.807462881 -0700
+++ 2	2015-04-24 05:36:55.928630935 -0700
@@ -1,6 +1,3 @@
-
-x.o:     file format elf32-mep-little
-
 Contents of the .debug_info section:
 
   Compilation Unit @ offset 0x0:
@@ -10,8 +7,8 @@ Contents of the .debug_info section:
    Pointer Size:  4
  <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
     <c>   DW_AT_stmt_list   : 0x0
-    <10>   DW_AT_high_pc     : 0x0
-    <14>   DW_AT_low_pc      : 0x0
+    <10>   DW_AT_high_pc     : 0x8
+    <14>   DW_AT_low_pc      : 0x4
     <18>   DW_AT_name        : file1.txt
     <22>   DW_AT_producer    : GNU C 3.3.3
     <2e>   DW_AT_language    : 1	(ANSI C)
@@ -21,8 +18,8 @@ Contents of the .debug_info section:
     <32>   DW_AT_decl_line   : 2
     <33>   DW_AT_name        : func_cu1
     <3c>   DW_AT_type        : <0x4a>
-    <40>   DW_AT_low_pc      : 0x0
-    <44>   DW_AT_high_pc     : 0x0
+    <40>   DW_AT_low_pc      : 0x4
+    <44>   DW_AT_high_pc     : 0x8
     <48>   DW_AT_frame_base  : 1 byte block: 55 	(DW_OP_reg5 (r5))
  <1><4a>: Abbrev Number: 3 (DW_TAG_base_type)
     <4b>   DW_AT_name        : int
@@ -66,11 +63,11 @@ Raw dump of debug contents of section .d
   1	0	0	0	file1.txt
 
  Line Number Statements:
-  [0x0000002d]  Extended opcode 2: set Address to 0x0
+  [0x0000002d]  Extended opcode 2: set Address to 0x4
   [0x00000034]  Advance Line by 3 to 4
   [0x00000036]  Copy
   [0x00000037]  Copy
-  [0x00000038]  Extended opcode 2: set Address to 0x0
+  [0x00000038]  Extended opcode 2: set Address to 0x8
   [0x0000003f]  Extended opcode 1: End of Sequence
 
 
[hjl@gnu-tools-1 binutils]$
Comment 1 H.J. Lu 2015-04-24 12:57:10 UTC
objdump fails to apply relocations for -W.
Comment 2 cvs-commit@gcc.gnu.org 2015-04-30 15:00:16 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

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

commit 153a27763ccc9979fdb5f342e21eb1666c8f117b
Author: Nick Clifton <nickc@redhat.com>
Date:   Thu Apr 30 15:57:41 2015 +0100

    Fix handling of relocs for the MeP target.
    
    bfd	PR 18317
    	* elf32-mep.c (MEPREL): Use bfd_elf_generic_reloc instead of
    	mep_reloc.
    	(mep_reloc): Delete unused function.
    
    bin	* readelf.c (get_machine_flags): Add description of MeP flags.
    
    tests	* binutils-all/objdump.exp (cpus_expected): Add MeP CPU names.
Comment 3 Nick Clifton 2015-04-30 15:02:31 UTC
Hi H.J.

  I have checked in a patch to fix this problem.  (The MeP's special reloc handling function was non-functional).

  In the course of checking the patch I noticed that readelf was not decoding the flags in the MEP ELF header and that one of the objdump tests was not handling the MeP CPU, so I fixed those as well.

Cheers
  Nick