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]

[committed] Darwin: improve objdump --sym output


Hi,

simple patch to improve the output of objdump --sym:
* common symbols are marked COM (instead of UND).
* Section name is displayed in brackets to make the output more readable.

Example:

0000000000000000 g       0f SECT   01 0000 [.text] _p13
0000000000000028 g       0f SECT   02 0000 [.eh_frame] _p13.eh
0000000000000004         01 COM    00 0200 _v20


bfd/

2011-11-22  Tristan Gingold  <gingold@adacore.com>

	* mach-o.c (bfd_mach_o_print_symbol): Display COM for common
	symbols.  Print section name in brackets.

===================================================================
RCS file: /cvs/src/src/bfd/mach-o.c,v
retrieving revision 1.67
diff -c -r1.67 mach-o.c
*** mach-o.c	21 Sep 2011 10:10:11 -0000	1.67
--- mach-o.c	22 Nov 2011 10:44:10 -0000
***************
*** 547,553 ****
  	switch (asym->n_type & BFD_MACH_O_N_TYPE)
  	  {
  	  case BFD_MACH_O_N_UNDF:
! 	    name = "UND";
  	    break;
  	  case BFD_MACH_O_N_ABS:
  	    name = "ABS";
--- 547,556 ----
  	switch (asym->n_type & BFD_MACH_O_N_TYPE)
  	  {
  	  case BFD_MACH_O_N_UNDF:
!             if (symbol->value == 0)
!               name = "UND";
!             else
!               name = "COM";
  	    break;
  	  case BFD_MACH_O_N_ABS:
  	    name = "ABS";
***************
*** 571,577 ****
                 asym->n_type, name, asym->n_sect, asym->n_desc);
        if ((asym->n_type & BFD_MACH_O_N_STAB) == 0
  	  && (asym->n_type & BFD_MACH_O_N_TYPE) == BFD_MACH_O_N_SECT)
! 	fprintf (file, " %-5s", symbol->section->name);
        fprintf (file, " %s", symbol->name);
      }
  }
--- 574,580 ----
                 asym->n_type, name, asym->n_sect, asym->n_desc);
        if ((asym->n_type & BFD_MACH_O_N_STAB) == 0
  	  && (asym->n_type & BFD_MACH_O_N_TYPE) == BFD_MACH_O_N_SECT)
! 	fprintf (file, " [%s]", symbol->section->name);
        fprintf (file, " %s", symbol->name);
      }
  }


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