/* Support for the generic parts of COFF, for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2007
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
Free Software Foundation, Inc.
Written by Cygnus Support.
struct internal_reloc *irel;
bfd_size_type amt;
+ if (sec->reloc_count == 0)
+ return internal_relocs; /* Nothing to do. */
+
if (coff_section_data (abfd, sec) != NULL
&& coff_section_data (abfd, sec)->relocs != NULL)
{
if (external_relocs == NULL)
{
free_external = bfd_malloc (amt);
- if (free_external == NULL && sec->reloc_count > 0)
+ if (free_external == NULL)
goto error_return;
external_relocs = free_external;
}
amt = sec->reloc_count;
amt *= sizeof (struct internal_reloc);
free_internal = bfd_malloc (amt);
- if (free_internal == NULL && sec->reloc_count > 0)
+ if (free_internal == NULL)
goto error_return;
internal_relocs = free_internal;
}
struct internal_syment *syment)
{
/* Normalize the symbol flags. */
- if (bfd_is_com_section (coff_symbol_ptr->symbol.section))
+ if (coff_symbol_ptr->symbol.section
+ && bfd_is_com_section (coff_symbol_ptr->symbol.section))
{
/* A common symbol is undefined with a value. */
syment->n_scnum = N_UNDEF;
internal_ptr->u.syment._n._n_n._n_zeroes = 0;
}
else if (internal_ptr->u.syment._n._n_n._n_offset == 0)
- internal_ptr->u.syment._n._n_n._n_offset = (bfd_vma) "";
+ internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) "";
else if (!bfd_coff_symname_in_debug (abfd, &internal_ptr->u.syment))
{
/* Long name already. Point symbol at the string in the
/* Probably a section symbol ? */
{
fprintf (file, "AUX scnlen 0x%lx nreloc %d nlnno %d",
- (long) auxp->u.auxent.x_scn.x_scnlen,
+ (unsigned long) auxp->u.auxent.x_scn.x_scnlen,
auxp->u.auxent.x_scn.x_nreloc,
auxp->u.auxent.x_scn.x_nlinno);
if (auxp->u.auxent.x_scn.x_checksum != 0
llnos = auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_lnnoptr;
fprintf (file,
"AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld",
- tagndx, auxp->u.auxent.x_sym.x_misc.x_fsize,
+ tagndx,
+ (unsigned long) auxp->u.auxent.x_sym.x_misc.x_fsize,
llnos, next);
break;
}