This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Fwd: RFA:] Print mips-specific dynamic tags with objdump -p


This patch improves the mips objdump -p output for mips by displaying the mips-specific dynamic tag instead of it's numerical equivalent.

For example, print this:
MIPS_SYMTABNO        0x13

Instead of:
  0x70000011  0x13

Okay to install?
Catherine

bfd/ChangeLog

	* elf.c ( _bfd_elf_print_private_bfd_data): Call
	elf_backend_get_target_dtag if defined.
	* elf32-mips.c (elf_backend_get_target_dtag): Define.
	* elf64-mips.c: Likewise.
	* elfn32-mips.c: Likewise.
	* elfxx-mips.c (_bfd_mips_elf_get_target_dtag): New.
	* elfxx-mips.h (_bfd_mips_elf_get_target_dtag): Declare.
	* elf-bfd.h (elf_backend_get_target_dtag): Add prototype.
	* elfxx-target.h (elf_backend_get_target_dtag): Add default.
	(elf_backend_data): Add elf_backend_get_target_dtag.


Index: elf-bfd.h =================================================================== RCS file: /cvs/src/src/bfd/elf-bfd.h,v retrieving revision 1.259 diff -p -r1.259 elf-bfd.h *** elf-bfd.h 15 Feb 2008 08:27:18 -0000 1.259 --- elf-bfd.h 26 Feb 2008 00:27:32 -0000 *************** struct elf_backend_data *** 993,998 **** --- 993,1003 ---- (struct elf_link_hash_entry *, const Elf_Internal_Sym *, bfd_boolean, bfd_boolean);

+   /* This function, if defined, will return a string containing the
+      name of a target-specific dynamic tag.  */
+   char *(*elf_backend_get_target_dtag)
+     (bfd_vma);
+
    /* Decide whether an undefined symbol is special and can be ignored.
       This is the case for OPTIONAL symbols on IRIX.  */
    bfd_boolean (*elf_backend_ignore_undef_symbol)
Index: elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.435
diff -p -r1.435 elf.c
*** elf.c	17 Feb 2008 23:45:23 -0000	1.435
--- elf.c	26 Feb 2008 00:27:33 -0000
*************** _bfd_elf_print_private_bfd_data (bfd *ab
*** 1204,1212 ****
        for (; extdyn < extdynend; extdyn += extdynsize)
  	{
  	  Elf_Internal_Dyn dyn;
! 	  const char *name;
  	  char ab[20];
  	  bfd_boolean stringp;

(*swap_dyn_in) (abfd, extdyn, &dyn);

--- 1204,1213 ----
        for (; extdyn < extdynend; extdyn += extdynsize)
  	{
  	  Elf_Internal_Dyn dyn;
! 	  const char *name = "";
  	  char ab[20];
  	  bfd_boolean stringp;
+ 	  const struct elf_backend_data *bed = get_elf_backend_data (abfd);

(*swap_dyn_in) (abfd, extdyn, &dyn);

*************** _bfd_elf_print_private_bfd_data (bfd *ab
*** 1217,1224 ****
  	  switch (dyn.d_tag)
  	    {
  	    default:
! 	      sprintf (ab, "0x%lx", (unsigned long) dyn.d_tag);
! 	      name = ab;
  	      break;

  	    case DT_NEEDED: name = "NEEDED"; stringp = TRUE; break;
--- 1218,1231 ----
  	  switch (dyn.d_tag)
  	    {
  	    default:
! 	      if (bed->elf_backend_get_target_dtag)
! 		name = (*bed->elf_backend_get_target_dtag) (dyn.d_tag);
!
! 	      if (!strcmp (name, ""))
! 		{
! 		  sprintf (ab, "0x%lx", (unsigned long) dyn.d_tag);
! 		  name = ab;
! 		}
  	      break;

  	    case DT_NEEDED: name = "NEEDED"; stringp = TRUE; break;
*************** _bfd_elf_print_private_bfd_data (bfd *ab
*** 1281,1287 ****
  	    case DT_GNU_HASH: name = "GNU_HASH"; break;
  	    }

! 	  fprintf (f, "  %-11s ", name);
  	  if (! stringp)
  	    fprintf (f, "0x%lx", (unsigned long) dyn.d_un.d_val);
  	  else
--- 1288,1294 ----
  	    case DT_GNU_HASH: name = "GNU_HASH"; break;
  	    }

! 	  fprintf (f, "  %-20s ", name);
  	  if (! stringp)
  	    fprintf (f, "0x%lx", (unsigned long) dyn.d_un.d_val);
  	  else
Index: elf32-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-mips.c,v
retrieving revision 1.196
diff -p -r1.196 elf32-mips.c
*** elf32-mips.c	3 Jul 2007 14:26:41 -0000	1.196
--- elf32-mips.c	26 Feb 2008 00:27:33 -0000
*************** static const struct ecoff_debug_swap mip
*** 1558,1563 ****
--- 1558,1564 ----
  #define elf_backend_check_relocs	_bfd_mips_elf_check_relocs
  #define elf_backend_merge_symbol_attribute \
  					_bfd_mips_elf_merge_symbol_attribute
+ #define elf_backend_get_target_dtag	_bfd_mips_elf_get_target_dtag
  #define elf_backend_adjust_dynamic_symbol \
  					_bfd_mips_elf_adjust_dynamic_symbol
  #define elf_backend_always_size_sections \
Index: elf64-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-mips.c,v
retrieving revision 1.84
diff -p -r1.84 elf64-mips.c
*** elf64-mips.c	24 Aug 2007 13:46:32 -0000	1.84
--- elf64-mips.c	26 Feb 2008 00:27:33 -0000
*************** const struct elf_size_info mips_elf64_si
*** 3107,3112 ****
--- 3107,3113 ----
  #define elf_backend_check_relocs	_bfd_mips_elf_check_relocs
  #define elf_backend_merge_symbol_attribute \
  				_bfd_mips_elf_merge_symbol_attribute
+ #define elf_backend_get_target_dtag	_bfd_mips_elf_get_target_dtag
  #define elf_backend_adjust_dynamic_symbol \
  				_bfd_mips_elf_adjust_dynamic_symbol
  #define elf_backend_always_size_sections \
Index: elfn32-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfn32-mips.c,v
retrieving revision 1.39
diff -p -r1.39 elfn32-mips.c
*** elfn32-mips.c	3 Jul 2007 14:26:42 -0000	1.39
--- elfn32-mips.c	26 Feb 2008 00:27:33 -0000
*************** static const struct ecoff_debug_swap mip
*** 2361,2366 ****
--- 2361,2367 ----
  #define elf_backend_check_relocs	_bfd_mips_elf_check_relocs
  #define elf_backend_merge_symbol_attribute \
  					_bfd_mips_elf_merge_symbol_attribute
+ #define elf_backend_get_target_dtag	_bfd_mips_elf_get_target_dtag
  #define elf_backend_adjust_dynamic_symbol \
  					_bfd_mips_elf_adjust_dynamic_symbol
  #define elf_backend_always_size_sections \
Index: elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.226
diff -p -r1.226 elfxx-mips.c
*** elfxx-mips.c	15 Feb 2008 03:35:52 -0000	1.226
--- elfxx-mips.c	26 Feb 2008 00:27:35 -0000
*************** _bfd_mips_elf_set_private_flags (bfd *ab
*** 11700,11705 ****
--- 11700,11800 ----
    return TRUE;
  }

+ char *
+ _bfd_mips_elf_get_target_dtag (bfd_vma dtag)
+ {
+   switch (dtag)
+     {
+     default: return "";
+     case DT_MIPS_RLD_VERSION:
+       return "MIPS_RLD_VERSION";
+     case DT_MIPS_TIME_STAMP:
+       return "MIPS_TIME_STAMP";
+     case DT_MIPS_ICHECKSUM:
+       return "MIPS_ICHECKSUM";
+     case DT_MIPS_IVERSION:
+       return "MIPS_IVERSION";
+     case DT_MIPS_FLAGS:
+       return "MIPS_FLAGS";
+     case DT_MIPS_BASE_ADDRESS:
+       return "MIPS_BASE_ADDRESS";
+     case DT_MIPS_MSYM:
+       return "MIPS_MSYM";
+     case DT_MIPS_CONFLICT:
+       return "MIPS_CONFLICT";
+     case DT_MIPS_LIBLIST:
+       return "MIPS_LIBLIST";
+     case DT_MIPS_LOCAL_GOTNO:
+       return "MIPS_LOCAL_GOTNO";
+     case DT_MIPS_CONFLICTNO:
+       return "MIPS_CONFLICTNO";
+     case DT_MIPS_LIBLISTNO:
+       return "MIPS_LIBLISTNO";
+     case DT_MIPS_SYMTABNO:
+       return "MIPS_SYMTABNO";
+     case DT_MIPS_UNREFEXTNO:
+       return "MIPS_UNREFEXTNO";
+     case DT_MIPS_GOTSYM:
+       return "MIPS_GOTSYM";
+     case DT_MIPS_HIPAGENO:
+       return "MIPS_HIPAGENO";
+     case DT_MIPS_RLD_MAP:
+       return "MIPS_RLD_MAP";
+     case DT_MIPS_DELTA_CLASS:
+       return "MIPS_DELTA_CLASS";
+     case DT_MIPS_DELTA_CLASS_NO:
+       return "MIPS_DELTA_CLASS_NO";
+     case DT_MIPS_DELTA_INSTANCE:
+       return "MIPS_DELTA_INSTANCE";
+     case DT_MIPS_DELTA_INSTANCE_NO:
+       return "MIPS_DELTA_INSTANCE_NO";
+     case DT_MIPS_DELTA_RELOC:
+       return "MIPS_DELTA_RELOC";
+     case DT_MIPS_DELTA_RELOC_NO:
+       return "MIPS_DELTA_RELOC_NO";
+     case DT_MIPS_DELTA_SYM:
+       return "MIPS_DELTA_SYM";
+     case DT_MIPS_DELTA_SYM_NO:
+       return "MIPS_DELTA_SYM_NO";
+     case DT_MIPS_DELTA_CLASSSYM:
+       return "MIPS_DELTA_CLASSSYM";
+     case DT_MIPS_DELTA_CLASSSYM_NO:
+       return "MIPS_DELTA_CLASSSYM_NO";
+     case DT_MIPS_CXX_FLAGS:
+       return "MIPS_CXX_FLAGS";
+     case DT_MIPS_PIXIE_INIT:
+       return "MIPS_PIXIE_INIT";
+     case DT_MIPS_SYMBOL_LIB:
+       return "MIPS_SYMBOL_LIB";
+     case DT_MIPS_LOCALPAGE_GOTIDX:
+       return "MIPS_LOCALPAGE_GOTIDX";
+     case DT_MIPS_LOCAL_GOTIDX:
+       return "MIPS_LOCAL_GOTIDX";
+     case DT_MIPS_HIDDEN_GOTIDX:
+       return "MIPS_HIDDEN_GOTIDX";
+     case DT_MIPS_PROTECTED_GOTIDX:
+       return "MIPS_PROTECTED_GOT_IDX";
+     case DT_MIPS_OPTIONS:
+       return "MIPS_OPTIONS";
+     case DT_MIPS_INTERFACE:
+       return "MIPS_INTERFACE";
+     case DT_MIPS_DYNSTR_ALIGN:
+       return "DT_MIPS_DYNSTR_ALIGN";
+     case DT_MIPS_INTERFACE_SIZE:
+       return "DT_MIPS_INTERFACE_SIZE";
+     case DT_MIPS_RLD_TEXT_RESOLVE_ADDR:
+       return "DT_MIPS_RLD_TEXT_RESOLVE_ADDR";
+     case DT_MIPS_PERF_SUFFIX:
+       return "DT_MIPS_PERF_SUFFIX";
+     case DT_MIPS_COMPACT_SIZE:
+       return "DT_MIPS_COMPACT_SIZE";
+     case DT_MIPS_GP_VALUE:
+       return "DT_MIPS_GP_VALUE";
+     case DT_MIPS_AUX_DYNAMIC:
+       return "DT_MIPS_AUX_DYNAMIC";
+     }
+ }
+
  bfd_boolean
  _bfd_mips_elf_print_private_bfd_data (bfd *abfd, void *ptr)
  {
Index: elfxx-mips.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.h,v
retrieving revision 1.37
diff -p -r1.37 elfxx-mips.h
*** elfxx-mips.h	3 Jul 2007 14:26:42 -0000	1.37
--- elfxx-mips.h	26 Feb 2008 00:27:35 -0000
*************** extern bfd_vma _bfd_mips_elf_sign_extend
*** 138,143 ****
--- 138,144 ----
    (bfd_vma, int);
  extern void _bfd_mips_elf_merge_symbol_attribute
    (struct elf_link_hash_entry *, const Elf_Internal_Sym *, bfd_boolean, bfd_boolean);
+ extern char *_bfd_mips_elf_get_target_dtag (bfd_vma);
  extern bfd_boolean _bfd_mips_elf_ignore_undef_symbol
    (struct elf_link_hash_entry *);

Index: elfxx-target.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-target.h,v
retrieving revision 1.113
diff -p -r1.113 elfxx-target.h
*** elfxx-target.h	12 Feb 2008 11:32:31 -0000	1.113
--- elfxx-target.h	26 Feb 2008 00:27:35 -0000
***************
*** 482,487 ****
--- 482,490 ----
  #ifndef elf_backend_merge_symbol_attribute
  #define elf_backend_merge_symbol_attribute	NULL
  #endif
+ #ifndef elf_backend_get_target_dtag
+ #define elf_backend_get_target_dtag		NULL
+ #endif
  #ifndef elf_backend_ignore_undef_symbol
  #define elf_backend_ignore_undef_symbol		NULL
  #endif
*************** static struct elf_backend_data elfNN_bed
*** 672,677 ****
--- 675,681 ----
    elf_backend_hide_symbol,
    elf_backend_fixup_symbol,
    elf_backend_merge_symbol_attribute,
+   elf_backend_get_target_dtag,
    elf_backend_ignore_undef_symbol,
    elf_backend_emit_relocs,
    elf_backend_count_relocs,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]