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]: Renaming


Hi,

many mach-o functions had in their name scan_read_ or scan_write. This patch remove the 'scan_' name
as it was not coherently used and useless.


Tristan.

bfd/
2009-10-09  Tristan Gingold  <gingold@adacore.com>

	* mach-o.c (bfd_mach_o_scan_read_symtab_symbols): Rename to
	bfd_mach_o_read_symtab_symbols.
	(bfd_mach_o_scan_write_thread): Rename to bfd_mach_o_write_thread.
	(bfd_mach_o_scan_write_relocs): Rename to bfd_mach_o_write_relocs.
	(bfd_mach_o_scan_write_section_32): Rename to
	bfd_mach_o_write_section_32.
	(bfd_mach_o_scan_write_section_64): Rename to
	bfd_mach_o_write_section_64.
	(bfd_mach_o_scan_write_segment_32): Rename to
	bfd_mach_o_write_segment_32.
	(bfd_mach_o_scan_write_segment_64): Rename to
	bfd_mach_o_write_segment_64.
	(bfd_mach_o_scan_write_symtab): Rename to bfd_mach_o_write_symtab.
	(bfd_mach_o_scan_read_section_32): Rename to
	bfd_mach_o_read_section_32.
	(bfd_mach_o_scan_read_section_64): Rename to
	bfd_mach_o_read_section_64.
	(bfd_mach_o_scan_read_section): Rename to bfd_mach_o_read_section.
	(bfd_mach_o_scan_read_symtab_strtab): Rename to
	bfd_mach_o_read_symtab_strtab.
	(bfd_mach_o_scan_read_symtab_symbol): Rename to
	bfd_mach_o_read_symtab_symbol.
	(bfd_mach_o_scan_read_dysymtab_symbol): Rename to
	bfd_mach_o_read_dysymtab_symbol.
	(bfd_mach_o_scan_read_dylinker): Rename to bfd_mach_o_read_dylinker.
	(bfd_mach_o_scan_read_dylib): Rename to bfd_mach_o_read_dylib.
	(bfd_mach_o_scan_read_prebound_dylib): Rename to
	bfd_mach_o_read_prebound_dylib.
	(bfd_mach_o_scan_read_thread): Rename to bfd_mach_o_read_thread.
	(bfd_mach_o_scan_read_dysymtab): Rename to bfd_mach_o_read_dysymtab.
	(bfd_mach_o_scan_read_symtab): Rename to bfd_mach_o_read_symtab.
	(bfd_mach_o_scan_read_uuid): Rename to bfd_mach_o_read_uuid.
	(bfd_mach_o_scan_read_linkedit): Rename to bfd_mach_o_read_linkedit.
	(bfd_mach_o_scan_read_str): Rename to bfd_mach_o_read_str.
	(bfd_mach_o_scan_read_dyld_info): Rename to bfd_mach_o_read_dyld_info.
	(bfd_mach_o_scan_read_segment): Rename to bfd_mach_o_read_segment.
	(bfd_mach_o_scan_read_segment_32): Rename to
	bfd_mach_o_read_segment_32.
	(bfd_mach_o_scan_read_segment_64): Rename to
	bfd_mach_o_read_segment_64.
	(bfd_mach_o_scan_read_command): Rename to bfd_mach_o_read_command.
	* mach-o.h (bfd_mach_o_scan_read_dysymtab_symbol): Rename to
	bfd_mach_o_read_dysymtab_symbol.

Index: mach-o.c
===================================================================
RCS file: /cvs/src/src/bfd/mach-o.c,v
retrieving revision 1.44
diff -c -r1.44 mach-o.c
*** mach-o.c 9 Oct 2009 08:18:17 -0000 1.44
--- mach-o.c 9 Oct 2009 13:55:17 -0000
***************
*** 34,40 ****
#define FILE_ALIGN(off, algn) \
(((off) + ((file_ptr) 1 << (algn)) - 1) & ((file_ptr) -1 << (algn)))


! static int bfd_mach_o_scan_read_symtab_symbols (bfd *);

unsigned int
bfd_mach_o_version (bfd *abfd)
--- 34,40 ----
#define FILE_ALIGN(off, algn) \
(((off) + ((file_ptr) 1 << (algn)) - 1) & ((file_ptr) -1 << (algn)))


! static int bfd_mach_o_read_symtab_symbols (bfd *);

  unsigned int
  bfd_mach_o_version (bfd *abfd)
***************
*** 364,370 ****
    if (nsyms < 0)
      return nsyms;

! if (bfd_mach_o_scan_read_symtab_symbols (abfd) != 0)
{
fprintf (stderr,
"bfd_mach_o_canonicalize_symtab: unable to load symbols\n");
--- 364,370 ----
if (nsyms < 0)
return nsyms;


! if (bfd_mach_o_read_symtab_symbols (abfd) != 0)
{
fprintf (stderr,
"bfd_mach_o_canonicalize_symtab: unable to load symbols\n");
***************
*** 613,619 ****
}


static int
! bfd_mach_o_scan_write_thread (bfd *abfd, bfd_mach_o_load_command *command)
{
bfd_mach_o_thread_command *cmd = &command->command.thread;
unsigned int i;
--- 613,619 ----
}


  static int
! bfd_mach_o_write_thread (bfd *abfd, bfd_mach_o_load_command *command)
  {
    bfd_mach_o_thread_command *cmd = &command->command.thread;
    unsigned int i;
***************
*** 837,843 ****
  }

  static bfd_boolean
! bfd_mach_o_scan_write_relocs (bfd *abfd, bfd_mach_o_section *section)
  {
    bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
    unsigned int i;
--- 837,843 ----
  }

  static bfd_boolean
! bfd_mach_o_write_relocs (bfd *abfd, bfd_mach_o_section *section)
  {
    bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
    unsigned int i;
***************
*** 908,914 ****
  }

static int
! bfd_mach_o_scan_write_section_32 (bfd *abfd, bfd_mach_o_section *section)
{
unsigned char buf[BFD_MACH_O_SECTION_SIZE];


--- 908,914 ----
  }

  static int
! bfd_mach_o_write_section_32 (bfd *abfd, bfd_mach_o_section *section)
  {
    unsigned char buf[BFD_MACH_O_SECTION_SIZE];

***************
*** 932,938 ****
  }

static int
! bfd_mach_o_scan_write_section_64 (bfd *abfd, bfd_mach_o_section *section)
{
unsigned char buf[BFD_MACH_O_SECTION_64_SIZE];


--- 932,938 ----
  }

  static int
! bfd_mach_o_write_section_64 (bfd *abfd, bfd_mach_o_section *section)
  {
    unsigned char buf[BFD_MACH_O_SECTION_64_SIZE];

***************
*** 957,963 ****
  }

static int
! bfd_mach_o_scan_write_segment_32 (bfd *abfd, bfd_mach_o_load_command *command)
{
unsigned char buf[BFD_MACH_O_LC_SEGMENT_SIZE];
bfd_mach_o_segment_command *seg = &command->command.segment;
--- 957,963 ----
}


static int
! bfd_mach_o_write_segment_32 (bfd *abfd, bfd_mach_o_load_command *command)
{
unsigned char buf[BFD_MACH_O_LC_SEGMENT_SIZE];
bfd_mach_o_segment_command *seg = &command->command.segment;
***************
*** 966,972 ****
BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT);


    for (i = 0; i < seg->nsects; i++)
!     if (!bfd_mach_o_scan_write_relocs (abfd, &seg->sections[i]))
        return -1;

    memcpy (buf, seg->segname, 16);
--- 966,972 ----
    BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT);

    for (i = 0; i < seg->nsects; i++)
!     if (!bfd_mach_o_write_relocs (abfd, &seg->sections[i]))
        return -1;

    memcpy (buf, seg->segname, 16);
***************
*** 985,998 ****
      return -1;

    for (i = 0; i < seg->nsects; i++)
!     if (bfd_mach_o_scan_write_section_32 (abfd, &seg->sections[i]))
        return -1;

    return 0;
  }

static int
! bfd_mach_o_scan_write_segment_64 (bfd *abfd, bfd_mach_o_load_command *command)
{
unsigned char buf[BFD_MACH_O_LC_SEGMENT_64_SIZE];
bfd_mach_o_segment_command *seg = &command->command.segment;
--- 985,998 ----
return -1;


    for (i = 0; i < seg->nsects; i++)
!     if (bfd_mach_o_write_section_32 (abfd, &seg->sections[i]))
        return -1;

    return 0;
  }

static int
! bfd_mach_o_write_segment_64 (bfd *abfd, bfd_mach_o_load_command *command)
{
unsigned char buf[BFD_MACH_O_LC_SEGMENT_64_SIZE];
bfd_mach_o_segment_command *seg = &command->command.segment;
***************
*** 1001,1007 ****
BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT_64);


    for (i = 0; i < seg->nsects; i++)
!     if (!bfd_mach_o_scan_write_relocs (abfd, &seg->sections[i]))
        return -1;

    memcpy (buf, seg->segname, 16);
--- 1001,1007 ----
    BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT_64);

    for (i = 0; i < seg->nsects; i++)
!     if (!bfd_mach_o_write_relocs (abfd, &seg->sections[i]))
        return -1;

    memcpy (buf, seg->segname, 16);
***************
*** 1020,1033 ****
      return -1;

    for (i = 0; i < seg->nsects; i++)
!     if (bfd_mach_o_scan_write_section_64 (abfd, &seg->sections[i]))
        return -1;

    return 0;
  }

static bfd_boolean
! bfd_mach_o_scan_write_symtab (bfd *abfd, bfd_mach_o_load_command *command)
{
bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
bfd_mach_o_symtab_command *sym = &command->command.symtab;
--- 1020,1033 ----
return -1;


    for (i = 0; i < seg->nsects; i++)
!     if (bfd_mach_o_write_section_64 (abfd, &seg->sections[i]))
        return -1;

    return 0;
  }

  static bfd_boolean
! bfd_mach_o_write_symtab (bfd *abfd, bfd_mach_o_load_command *command)
  {
    bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
    bfd_mach_o_symtab_command *sym = &command->command.symtab;
***************
*** 1198,1219 ****
        switch (cur->type)
  	{
  	case BFD_MACH_O_LC_SEGMENT:
! 	  if (bfd_mach_o_scan_write_segment_32 (abfd, cur) != 0)
  	    return FALSE;
  	  break;
  	case BFD_MACH_O_LC_SEGMENT_64:
! 	  if (bfd_mach_o_scan_write_segment_64 (abfd, cur) != 0)
  	    return FALSE;
  	  break;
  	case BFD_MACH_O_LC_SYMTAB:
! 	  if (!bfd_mach_o_scan_write_symtab (abfd, cur))
  	    return FALSE;
  	  break;
  	case BFD_MACH_O_LC_SYMSEG:
  	  break;
  	case BFD_MACH_O_LC_THREAD:
  	case BFD_MACH_O_LC_UNIXTHREAD:
! 	  if (bfd_mach_o_scan_write_thread (abfd, cur) != 0)
  	    return FALSE;
  	  break;
  	case BFD_MACH_O_LC_LOADFVMLIB:
--- 1198,1219 ----
        switch (cur->type)
  	{
  	case BFD_MACH_O_LC_SEGMENT:
! 	  if (bfd_mach_o_write_segment_32 (abfd, cur) != 0)
  	    return FALSE;
  	  break;
  	case BFD_MACH_O_LC_SEGMENT_64:
! 	  if (bfd_mach_o_write_segment_64 (abfd, cur) != 0)
  	    return FALSE;
  	  break;
  	case BFD_MACH_O_LC_SYMTAB:
! 	  if (!bfd_mach_o_write_symtab (abfd, cur))
  	    return FALSE;
  	  break;
  	case BFD_MACH_O_LC_SYMSEG:
  	  break;
  	case BFD_MACH_O_LC_THREAD:
  	case BFD_MACH_O_LC_UNIXTHREAD:
! 	  if (bfd_mach_o_write_thread (abfd, cur) != 0)
  	    return FALSE;
  	  break;
  	case BFD_MACH_O_LC_LOADFVMLIB:
***************
*** 1517,1526 ****
  }

  static int
! bfd_mach_o_scan_read_section_32 (bfd *abfd,
! 				 bfd_mach_o_section *section,
! 				 unsigned int offset,
! 				 unsigned long prot)
  {
    unsigned char buf[BFD_MACH_O_SECTION_SIZE];

--- 1517,1526 ----
  }

  static int
! bfd_mach_o_read_section_32 (bfd *abfd,
!                             bfd_mach_o_section *section,
!                             unsigned int offset,
!                             unsigned long prot)
  {
    unsigned char buf[BFD_MACH_O_SECTION_SIZE];

***************
*** 1552,1561 ****
  }

  static int
! bfd_mach_o_scan_read_section_64 (bfd *abfd,
! 				 bfd_mach_o_section *section,
! 				 unsigned int offset,
! 				 unsigned long prot)
  {
    unsigned char buf[BFD_MACH_O_SECTION_64_SIZE];

--- 1552,1561 ----
  }

  static int
! bfd_mach_o_read_section_64 (bfd *abfd,
!                             bfd_mach_o_section *section,
!                             unsigned int offset,
!                             unsigned long prot)
  {
    unsigned char buf[BFD_MACH_O_SECTION_64_SIZE];

***************
*** 1587,1609 ****
  }

static int
! bfd_mach_o_scan_read_section (bfd *abfd,
! bfd_mach_o_section *section,
! unsigned int offset,
! unsigned long prot,
! unsigned int wide)
{
if (wide)
! return bfd_mach_o_scan_read_section_64 (abfd, section, offset, prot);
else
! return bfd_mach_o_scan_read_section_32 (abfd, section, offset, prot);
}


  static int
! bfd_mach_o_scan_read_symtab_symbol (bfd *abfd,
! 				    bfd_mach_o_symtab_command *sym,
! 				    bfd_mach_o_asymbol *s,
! 				    unsigned long i)
  {
    bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
    unsigned int wide = mach_o_wide_p (&mdata->header);
--- 1587,1609 ----
  }

  static int
! bfd_mach_o_read_section (bfd *abfd,
!                          bfd_mach_o_section *section,
!                          unsigned int offset,
!                          unsigned long prot,
!                          unsigned int wide)
  {
    if (wide)
!     return bfd_mach_o_read_section_64 (abfd, section, offset, prot);
    else
!     return bfd_mach_o_read_section_32 (abfd, section, offset, prot);
  }

static int
! bfd_mach_o_read_symtab_symbol (bfd *abfd,
! bfd_mach_o_symtab_command *sym,
! bfd_mach_o_asymbol *s,
! unsigned long i)
{
bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
unsigned int wide = mach_o_wide_p (&mdata->header);
***************
*** 1623,1629 ****
if (bfd_seek (abfd, symoff, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, symwidth, abfd) != symwidth)
{
! fprintf (stderr, "bfd_mach_o_scan_read_symtab_symbol: unable to read %d bytes at %lu\n",
symwidth, (unsigned long) symoff);
return -1;
}
--- 1623,1629 ----
if (bfd_seek (abfd, symoff, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, symwidth, abfd) != symwidth)
{
! fprintf (stderr, "bfd_mach_o_read_symtab_symbol: unable to read %d bytes at %lu\n",
symwidth, (unsigned long) symoff);
return -1;
}
***************
*** 1640,1646 ****


if (stroff >= sym->strsize)
{
! fprintf (stderr, "bfd_mach_o_scan_read_symtab_symbol: symbol name out of range (%lu >= %lu)\n",
(unsigned long) stroff, (unsigned long) sym->strsize);
return -1;
}
--- 1640,1646 ----


if (stroff >= sym->strsize)
{
! fprintf (stderr, "bfd_mach_o_read_symtab_symbol: symbol name out of range (%lu >= %lu)\n",
(unsigned long) stroff, (unsigned long) sym->strsize);
return -1;
}
***************
*** 1724,1730 ****
/* Mach-O uses 0 to mean "no section"; not an error. */
if (section != 0)
{
! fprintf (stderr, "bfd_mach_o_scan_read_symtab_symbol: "
"symbol \"%s\" specified invalid section %d (max %lu): setting to undefined\n",
s->symbol.name, section, mdata->nsects);
}
--- 1724,1730 ----
/* Mach-O uses 0 to mean "no section"; not an error. */
if (section != 0)
{
! fprintf (stderr, "bfd_mach_o_read_symtab_symbol: "
"symbol \"%s\" specified invalid section %d (max %lu): setting to undefined\n",
s->symbol.name, section, mdata->nsects);
}
***************
*** 1732,1744 ****
}
break;
case BFD_MACH_O_N_INDR:
! fprintf (stderr, "bfd_mach_o_scan_read_symtab_symbol: "
"symbol \"%s\" is unsupported 'indirect' reference: setting to undefined\n",
s->symbol.name);
s->symbol.section = bfd_und_section_ptr;
break;
default:
! fprintf (stderr, "bfd_mach_o_scan_read_symtab_symbol: "
"symbol \"%s\" specified invalid type field 0x%x: setting to undefined\n",
s->symbol.name, symtype);
s->symbol.section = bfd_und_section_ptr;
--- 1732,1744 ----
}
break;
case BFD_MACH_O_N_INDR:
! fprintf (stderr, "bfd_mach_o_read_symtab_symbol: "
"symbol \"%s\" is unsupported 'indirect' reference: setting to undefined\n",
s->symbol.name);
s->symbol.section = bfd_und_section_ptr;
break;
default:
! fprintf (stderr, "bfd_mach_o_read_symtab_symbol: "
"symbol \"%s\" specified invalid type field 0x%x: setting to undefined\n",
s->symbol.name, symtype);
s->symbol.section = bfd_und_section_ptr;
***************
*** 1750,1756 ****
}


  static int
! bfd_mach_o_scan_read_symtab_strtab (bfd *abfd)
  {
    bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
    bfd_mach_o_symtab_command *sym = mdata->symtab;
--- 1750,1756 ----
  }

  static int
! bfd_mach_o_read_symtab_strtab (bfd *abfd)
  {
    bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
    bfd_mach_o_symtab_command *sym = mdata->symtab;
***************
*** 1794,1800 ****
  }

  static int
! bfd_mach_o_scan_read_symtab_symbols (bfd *abfd)
  {
    bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
    bfd_mach_o_symtab_command *sym = mdata->symtab;
--- 1794,1800 ----
  }

  static int
! bfd_mach_o_read_symtab_symbols (bfd *abfd)
  {
    bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
    bfd_mach_o_symtab_command *sym = mdata->symtab;
***************
*** 1808,1824 ****

if (sym->symbols == NULL)
{
! fprintf (stderr, "bfd_mach_o_scan_read_symtab_symbols: unable to allocate memory for symbols\n");
return -1;
}


!   ret = bfd_mach_o_scan_read_symtab_strtab (abfd);
    if (ret != 0)
      return ret;

for (i = 0; i < sym->nsyms; i++)
{
! ret = bfd_mach_o_scan_read_symtab_symbol (abfd, sym, &sym- >symbols[i], i);
if (ret != 0)
return ret;
}
--- 1808,1824 ----


if (sym->symbols == NULL)
{
! fprintf (stderr, "bfd_mach_o_read_symtab_symbols: unable to allocate memory for symbols\n");
return -1;
}


!   ret = bfd_mach_o_read_symtab_strtab (abfd);
    if (ret != 0)
      return ret;

for (i = 0; i < sym->nsyms; i++)
{
! ret = bfd_mach_o_read_symtab_symbol (abfd, sym, &sym->symbols [i], i);
if (ret != 0)
return ret;
}
***************
*** 1827,1837 ****
}


  int
! bfd_mach_o_scan_read_dysymtab_symbol (bfd *abfd,
! 				      bfd_mach_o_dysymtab_command *dysym,
! 				      bfd_mach_o_symtab_command *sym,
! 				      bfd_mach_o_asymbol *s,
! 				      unsigned long i)
  {
    unsigned long isymoff = dysym->indirectsymoff + (i * 4);
    unsigned long symindex;
--- 1827,1837 ----
  }

int
! bfd_mach_o_read_dysymtab_symbol (bfd *abfd,
! bfd_mach_o_dysymtab_command *dysym,
! bfd_mach_o_symtab_command *sym,
! bfd_mach_o_asymbol *s,
! unsigned long i)
{
unsigned long isymoff = dysym->indirectsymoff + (i * 4);
unsigned long symindex;
***************
*** 1842,1854 ****
if (bfd_seek (abfd, isymoff, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 4, abfd) != 4)
{
! fprintf (stderr, "bfd_mach_o_scan_read_dysymtab_symbol: unable to read %lu bytes at %lu\n",
(unsigned long) 4, isymoff);
return -1;
}
symindex = bfd_h_get_32 (abfd, buf);


!   return bfd_mach_o_scan_read_symtab_symbol (abfd, sym, s, symindex);
  }

static const char *
--- 1842,1854 ----
if (bfd_seek (abfd, isymoff, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 4, abfd) != 4)
{
! fprintf (stderr, "bfd_mach_o_read_dysymtab_symbol: unable to read %lu bytes at %lu\n",
(unsigned long) 4, isymoff);
return -1;
}
symindex = bfd_h_get_32 (abfd, buf);


!   return bfd_mach_o_read_symtab_symbol (abfd, sym, s, symindex);
  }

  static const char *
***************
*** 1889,1896 ****
  }

  static int
! bfd_mach_o_scan_read_dylinker (bfd *abfd,
! 			       bfd_mach_o_load_command *command)
  {
    bfd_mach_o_dylinker_command *cmd = &command->command.dylinker;
    unsigned char buf[4];
--- 1889,1895 ----
  }

  static int
! bfd_mach_o_read_dylinker (bfd *abfd, bfd_mach_o_load_command *command)
  {
    bfd_mach_o_dylinker_command *cmd = &command->command.dylinker;
    unsigned char buf[4];
***************
*** 1917,1923 ****
  }

static int
! bfd_mach_o_scan_read_dylib (bfd *abfd, bfd_mach_o_load_command *command)
{
bfd_mach_o_dylib_command *cmd = &command->command.dylib;
unsigned char buf[16];
--- 1916,1922 ----
}


  static int
! bfd_mach_o_read_dylib (bfd *abfd, bfd_mach_o_load_command *command)
  {
    bfd_mach_o_dylib_command *cmd = &command->command.dylib;
    unsigned char buf[16];
***************
*** 1956,1963 ****
  }

static int
! bfd_mach_o_scan_read_prebound_dylib (bfd *abfd ATTRIBUTE_UNUSED,
! bfd_mach_o_load_command *command ATTRIBUTE_UNUSED)
{
/* bfd_mach_o_prebound_dylib_command *cmd = &command- >command.prebound_dylib; */


--- 1955,1962 ----
  }

static int
! bfd_mach_o_read_prebound_dylib (bfd *abfd ATTRIBUTE_UNUSED,
! bfd_mach_o_load_command *command ATTRIBUTE_UNUSED)
{
/* bfd_mach_o_prebound_dylib_command *cmd = &command- >command.prebound_dylib; */


***************
*** 1966,1972 ****
  }

static int
! bfd_mach_o_scan_read_thread (bfd *abfd, bfd_mach_o_load_command *command)
{
bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
bfd_mach_o_thread_command *cmd = &command->command.thread;
--- 1965,1971 ----
}


  static int
! bfd_mach_o_read_thread (bfd *abfd, bfd_mach_o_load_command *command)
  {
    bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
    bfd_mach_o_thread_command *cmd = &command->command.thread;
***************
*** 2074,2080 ****
  }

static int
! bfd_mach_o_scan_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
{
bfd_mach_o_dysymtab_command *cmd = &command->command.dysymtab;
bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
--- 2073,2079 ----
}


  static int
! bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
  {
    bfd_mach_o_dysymtab_command *cmd = &command->command.dysymtab;
    bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
***************
*** 2250,2256 ****
  }

static int
! bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
{
bfd_mach_o_symtab_command *symtab = &command->command.symtab;
bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
--- 2249,2255 ----
}


  static int
! bfd_mach_o_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
  {
    bfd_mach_o_symtab_command *symtab = &command->command.symtab;
    bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
***************
*** 2279,2285 ****
  }

static int
! bfd_mach_o_scan_read_uuid (bfd *abfd, bfd_mach_o_load_command *command)
{
bfd_mach_o_uuid_command *cmd = &command->command.uuid;
asection *bfdsec;
--- 2278,2284 ----
}


  static int
! bfd_mach_o_read_uuid (bfd *abfd, bfd_mach_o_load_command *command)
  {
    bfd_mach_o_uuid_command *cmd = &command->command.uuid;
    asection *bfdsec;
***************
*** 2313,2319 ****
  }

static int
! bfd_mach_o_scan_read_linkedit (bfd *abfd, bfd_mach_o_load_command *command)
{
bfd_mach_o_linkedit_command *cmd = &command->command.linkedit;
char buf[8];
--- 2312,2318 ----
}


  static int
! bfd_mach_o_read_linkedit (bfd *abfd, bfd_mach_o_load_command *command)
  {
    bfd_mach_o_linkedit_command *cmd = &command->command.linkedit;
    char buf[8];
***************
*** 2328,2334 ****
  }

  static int
! bfd_mach_o_scan_read_str (bfd *abfd, bfd_mach_o_load_command *command)
  {
    bfd_mach_o_str_command *cmd = &command->command.str;
    char buf[4];
--- 2327,2333 ----
  }

  static int
! bfd_mach_o_read_str (bfd *abfd, bfd_mach_o_load_command *command)
  {
    bfd_mach_o_str_command *cmd = &command->command.str;
    char buf[4];
***************
*** 2351,2357 ****
  }

static int
! bfd_mach_o_scan_read_dyld_info (bfd *abfd, bfd_mach_o_load_command *command)
{
bfd_mach_o_dyld_info_command *cmd = &command->command.dyld_info;
char buf[40];
--- 2350,2356 ----
}


static int
! bfd_mach_o_read_dyld_info (bfd *abfd, bfd_mach_o_load_command *command)
{
bfd_mach_o_dyld_info_command *cmd = &command->command.dyld_info;
char buf[40];
***************
*** 2374,2382 ****
}


  static int
! bfd_mach_o_scan_read_segment (bfd *abfd,
! 			      bfd_mach_o_load_command *command,
! 			      unsigned int wide)
  {
    unsigned char buf[64];
    bfd_mach_o_segment_command *seg = &command->command.segment;
--- 2373,2381 ----
  }

  static int
! bfd_mach_o_read_segment (bfd *abfd,
!                          bfd_mach_o_load_command *command,
!                          unsigned int wide)
  {
    unsigned char buf[64];
    bfd_mach_o_segment_command *seg = &command->command.segment;
***************
*** 2440,2446 ****
              segoff = command->offset + BFD_MACH_O_LC_SEGMENT_SIZE
                + (i * BFD_MACH_O_SECTION_SIZE);

! 	  if (bfd_mach_o_scan_read_section
  	      (abfd, &seg->sections[i], segoff, seg->initprot, wide) != 0)
  	    return -1;
  	}
--- 2439,2445 ----
              segoff = command->offset + BFD_MACH_O_LC_SEGMENT_SIZE
                + (i * BFD_MACH_O_SECTION_SIZE);

! 	  if (bfd_mach_o_read_section
  	      (abfd, &seg->sections[i], segoff, seg->initprot, wide) != 0)
  	    return -1;
  	}
***************
*** 2450,2468 ****
  }

static int
! bfd_mach_o_scan_read_segment_32 (bfd *abfd, bfd_mach_o_load_command *command)
{
! return bfd_mach_o_scan_read_segment (abfd, command, 0);
}


static int
! bfd_mach_o_scan_read_segment_64 (bfd *abfd, bfd_mach_o_load_command *command)
{
! return bfd_mach_o_scan_read_segment (abfd, command, 1);
}


static int
! bfd_mach_o_scan_read_command (bfd *abfd, bfd_mach_o_load_command *command)
{
unsigned char buf[8];


--- 2449,2467 ----
  }

static int
! bfd_mach_o_read_segment_32 (bfd *abfd, bfd_mach_o_load_command *command)
{
! return bfd_mach_o_read_segment (abfd, command, 0);
}


static int
! bfd_mach_o_read_segment_64 (bfd *abfd, bfd_mach_o_load_command *command)
{
! return bfd_mach_o_read_segment (abfd, command, 1);
}


  static int
! bfd_mach_o_read_command (bfd *abfd, bfd_mach_o_load_command *command)
  {
    unsigned char buf[8];

***************
*** 2479,2516 ****
    switch (command->type)
      {
      case BFD_MACH_O_LC_SEGMENT:
!       if (bfd_mach_o_scan_read_segment_32 (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_SEGMENT_64:
!       if (bfd_mach_o_scan_read_segment_64 (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_SYMTAB:
!       if (bfd_mach_o_scan_read_symtab (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_SYMSEG:
        break;
      case BFD_MACH_O_LC_THREAD:
      case BFD_MACH_O_LC_UNIXTHREAD:
!       if (bfd_mach_o_scan_read_thread (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_LOAD_DYLINKER:
      case BFD_MACH_O_LC_ID_DYLINKER:
!       if (bfd_mach_o_scan_read_dylinker (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_LOAD_DYLIB:
      case BFD_MACH_O_LC_ID_DYLIB:
      case BFD_MACH_O_LC_LOAD_WEAK_DYLIB:
      case BFD_MACH_O_LC_REEXPORT_DYLIB:
!       if (bfd_mach_o_scan_read_dylib (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_PREBOUND_DYLIB:
!       if (bfd_mach_o_scan_read_prebound_dylib (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_LOADFVMLIB:
--- 2478,2515 ----
    switch (command->type)
      {
      case BFD_MACH_O_LC_SEGMENT:
!       if (bfd_mach_o_read_segment_32 (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_SEGMENT_64:
!       if (bfd_mach_o_read_segment_64 (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_SYMTAB:
!       if (bfd_mach_o_read_symtab (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_SYMSEG:
        break;
      case BFD_MACH_O_LC_THREAD:
      case BFD_MACH_O_LC_UNIXTHREAD:
!       if (bfd_mach_o_read_thread (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_LOAD_DYLINKER:
      case BFD_MACH_O_LC_ID_DYLINKER:
!       if (bfd_mach_o_read_dylinker (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_LOAD_DYLIB:
      case BFD_MACH_O_LC_ID_DYLIB:
      case BFD_MACH_O_LC_LOAD_WEAK_DYLIB:
      case BFD_MACH_O_LC_REEXPORT_DYLIB:
!       if (bfd_mach_o_read_dylib (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_PREBOUND_DYLIB:
!       if (bfd_mach_o_read_prebound_dylib (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_LOADFVMLIB:
***************
*** 2524,2550 ****
      case BFD_MACH_O_LC_SUB_UMBRELLA:
      case BFD_MACH_O_LC_SUB_LIBRARY:
      case BFD_MACH_O_LC_SUB_CLIENT:
!       if (bfd_mach_o_scan_read_str (abfd, command) != 0)
          return -1;
        break;
      case BFD_MACH_O_LC_DYSYMTAB:
!       if (bfd_mach_o_scan_read_dysymtab (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_TWOLEVEL_HINTS:
      case BFD_MACH_O_LC_PREBIND_CKSUM:
        break;
      case BFD_MACH_O_LC_UUID:
!       if (bfd_mach_o_scan_read_uuid (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_CODE_SIGNATURE:
      case BFD_MACH_O_LC_SEGMENT_SPLIT_INFO:
!       if (bfd_mach_o_scan_read_linkedit (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_DYLD_INFO:
!       if (bfd_mach_o_scan_read_dyld_info (abfd, command) != 0)
  	return -1;
        break;
      default:
--- 2523,2549 ----
      case BFD_MACH_O_LC_SUB_UMBRELLA:
      case BFD_MACH_O_LC_SUB_LIBRARY:
      case BFD_MACH_O_LC_SUB_CLIENT:
!       if (bfd_mach_o_read_str (abfd, command) != 0)
          return -1;
        break;
      case BFD_MACH_O_LC_DYSYMTAB:
!       if (bfd_mach_o_read_dysymtab (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_TWOLEVEL_HINTS:
      case BFD_MACH_O_LC_PREBIND_CKSUM:
        break;
      case BFD_MACH_O_LC_UUID:
!       if (bfd_mach_o_read_uuid (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_CODE_SIGNATURE:
      case BFD_MACH_O_LC_SEGMENT_SPLIT_INFO:
!       if (bfd_mach_o_read_linkedit (abfd, command) != 0)
  	return -1;
        break;
      case BFD_MACH_O_LC_DYLD_INFO:
!       if (bfd_mach_o_read_dyld_info (abfd, command) != 0)
  	return -1;
        break;
      default:
***************
*** 2737,2743 ****
  	      cur->offset = prev->offset + prev->len;
  	    }

! 	  if (bfd_mach_o_scan_read_command (abfd, cur) < 0)
  	    return -1;
  	}
      }
--- 2736,2742 ----
  	      cur->offset = prev->offset + prev->len;
  	    }

! if (bfd_mach_o_read_command (abfd, cur) < 0)
return -1;
}
}
***************
*** 3548,3559 ****
|| dysymtab->nextrefsyms > 0)
{
/* Try to read the symbols to display the toc or indirect symbols. */
! bfd_mach_o_scan_read_symtab_symbols (abfd);
}
else if (dysymtab->nmodtab > 0)
{
/* Try to read the strtab to display modules name. */
! bfd_mach_o_scan_read_symtab_strtab (abfd);
}


for (i = 0; i < dysymtab->nmodtab; i++)
--- 3547,3558 ----
|| dysymtab->nextrefsyms > 0)
{
/* Try to read the symbols to display the toc or indirect symbols. */
! bfd_mach_o_read_symtab_symbols (abfd);
}
else if (dysymtab->nmodtab > 0)
{
/* Try to read the strtab to display modules name. */
! bfd_mach_o_read_symtab_strtab (abfd);
}


    for (i = 0; i < dysymtab->nmodtab; i++)
Index: mach-o.h
===================================================================
RCS file: /cvs/src/src/bfd/mach-o.h,v
retrieving revision 1.20
diff -c -r1.20 mach-o.h
*** mach-o.h	9 Oct 2009 08:18:17 -0000	1.20
--- mach-o.h	9 Oct 2009 13:55:17 -0000
***************
*** 858,864 ****
    ((bfd_mach_o_backend_data*)(abfd)->xvec->backend_data)

bfd_boolean bfd_mach_o_valid (bfd *);
! int bfd_mach_o_scan_read_dysymtab_symbol (bfd *, bfd_mach_o_dysymtab_command *, bfd_mach_o_symtab_command *, bfd_mach_o_asymbol *, unsigned long);
int bfd_mach_o_scan_start_address (bfd *);
int bfd_mach_o_scan (bfd *, bfd_mach_o_header *, bfd_mach_o_data_struct *);
bfd_boolean bfd_mach_o_mkobject_init (bfd *);
--- 858,864 ----
((bfd_mach_o_backend_data*)(abfd)->xvec->backend_data)


bfd_boolean bfd_mach_o_valid (bfd *);
! int bfd_mach_o_read_dysymtab_symbol (bfd *, bfd_mach_o_dysymtab_command *, bfd_mach_o_symtab_command *, bfd_mach_o_asymbol *, unsigned long);
int bfd_mach_o_scan_start_address (bfd *);
int bfd_mach_o_scan (bfd *, bfd_mach_o_header *, bfd_mach_o_data_struct *);
bfd_boolean bfd_mach_o_mkobject_init (bfd *);



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