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;
{
/* FIXME: We should use a union here. */
s->u.syment.n_value =
- (bfd_vma)((combined_entry_type *)
- ((unsigned long) s->u.syment.n_value))->offset;
+ (bfd_hostptr_t) ((combined_entry_type *)
+ ((bfd_hostptr_t) s->u.syment.n_value))->offset;
s->fix_value = 0;
}
if (s->fix_line)
symesz = bfd_coff_symesz (abfd);
size = obj_raw_syment_count (abfd) * symesz;
+ if (size == 0)
+ return TRUE;
syms = bfd_malloc (size);
- if (syms == NULL && size != 0)
+ if (syms == NULL)
return FALSE;
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
}
internal_ptr->u.syment._n._n_n._n_offset =
- ((long)
+ ((bfd_hostptr_t)
(string_table
+ (internal_ptr + 1)->u.auxent.x_file.x_n.x_offset));
}
if (internal_ptr->u.syment.n_numaux > 1
&& coff_data (abfd)->pe)
internal_ptr->u.syment._n._n_n._n_offset =
- ((long)
+ ((bfd_hostptr_t)
copy_name (abfd,
(internal_ptr + 1)->u.auxent.x_file.x_fname,
internal_ptr->u.syment.n_numaux * symesz));
else
internal_ptr->u.syment._n._n_n._n_offset =
- ((long)
+ ((bfd_hostptr_t)
copy_name (abfd,
(internal_ptr + 1)->u.auxent.x_file.x_fname,
(size_t) bfd_coff_filnmlen (abfd)));
if (newstring == NULL)
return NULL;
strncpy (newstring, internal_ptr->u.syment._n._n_name, i);
- internal_ptr->u.syment._n._n_n._n_offset = (long int) newstring;
+ internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) newstring;
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 = (long int) "";
+ 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
return NULL;
}
internal_ptr->u.syment._n._n_n._n_offset =
- ((long int)
+ ((bfd_hostptr_t)
(string_table
+ internal_ptr->u.syment._n._n_n._n_offset));
}
/* Long name in debug section. Very similar. */
if (debug_section == NULL)
debug_section = build_debug_section (abfd);
- internal_ptr->u.syment._n._n_n._n_offset = (long int)
+ internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t)
(debug_section + internal_ptr->u.syment._n._n_n._n_offset);
}
}
if (coffsymbol (symbol)->native != NULL
&& coffsymbol (symbol)->native->fix_value)
ret->value = coffsymbol (symbol)->native->u.syment.n_value -
- (unsigned long) obj_raw_syments (abfd);
+ (bfd_hostptr_t) obj_raw_syments (abfd);
}
/* Return the COFF syment for a symbol. */
if (csym->native->fix_value)
psyment->n_value = psyment->n_value -
- (unsigned long) obj_raw_syments (abfd);
+ (bfd_hostptr_t) obj_raw_syments (abfd);
/* FIXME: We should handle fix_line here. */
if (! combined->fix_value)
val = (bfd_vma) combined->u.syment.n_value;
else
- val = combined->u.syment.n_value - (unsigned long) root;
+ val = combined->u.syment.n_value - (bfd_hostptr_t) root;
fprintf (file, "(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x",
combined->u.syment.n_scnum,