Line 1... |
Line 1... |
/* simple.c -- BFD simple client routines
|
/* simple.c -- BFD simple client routines
|
Copyright 2002, 2003, 2004, 2005, 2007, 2008
|
Copyright 2002, 2003, 2004, 2005, 2007, 2008, 2009
|
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
Contributed by MontaVista Software, Inc.
|
Contributed by MontaVista Software, Inc.
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
Line 107... |
Line 107... |
static void
|
static void
|
simple_save_output_info (bfd *abfd ATTRIBUTE_UNUSED,
|
simple_save_output_info (bfd *abfd ATTRIBUTE_UNUSED,
|
asection *section,
|
asection *section,
|
void *ptr)
|
void *ptr)
|
{
|
{
|
struct saved_output_info *output_info = ptr;
|
struct saved_output_info *output_info = (struct saved_output_info *) ptr;
|
output_info[section->index].offset = section->output_offset;
|
output_info[section->index].offset = section->output_offset;
|
output_info[section->index].section = section->output_section;
|
output_info[section->index].section = section->output_section;
|
if ((section->flags & SEC_DEBUGGING) != 0
|
if ((section->flags & SEC_DEBUGGING) != 0
|
|| section->output_section == NULL)
|
|| section->output_section == NULL)
|
{
|
{
|
Line 123... |
Line 123... |
static void
|
static void
|
simple_restore_output_info (bfd *abfd ATTRIBUTE_UNUSED,
|
simple_restore_output_info (bfd *abfd ATTRIBUTE_UNUSED,
|
asection *section,
|
asection *section,
|
void *ptr)
|
void *ptr)
|
{
|
{
|
struct saved_output_info *output_info = ptr;
|
struct saved_output_info *output_info = (struct saved_output_info *) ptr;
|
section->output_offset = output_info[section->index].offset;
|
section->output_offset = output_info[section->index].offset;
|
section->output_section = output_info[section->index].section;
|
section->output_section = output_info[section->index].section;
|
}
|
}
|
|
|
/*
|
/*
|
Line 169... |
Line 169... |
{
|
{
|
bfd_size_type amt = sec->rawsize > sec->size ? sec->rawsize : sec->size;
|
bfd_size_type amt = sec->rawsize > sec->size ? sec->rawsize : sec->size;
|
bfd_size_type size = sec->rawsize ? sec->rawsize : sec->size;
|
bfd_size_type size = sec->rawsize ? sec->rawsize : sec->size;
|
|
|
if (outbuf == NULL)
|
if (outbuf == NULL)
|
contents = bfd_malloc (amt);
|
contents = (bfd_byte *) bfd_malloc (amt);
|
else
|
else
|
contents = outbuf;
|
contents = outbuf;
|
|
|
if (contents)
|
if (contents)
|
bfd_get_section_contents (abfd, sec, contents, 0, size);
|
bfd_get_section_contents (abfd, sec, contents, 0, size);
|
Line 208... |
Line 208... |
link_order.u.indirect.section = sec;
|
link_order.u.indirect.section = sec;
|
|
|
data = NULL;
|
data = NULL;
|
if (outbuf == NULL)
|
if (outbuf == NULL)
|
{
|
{
|
data = bfd_malloc (sec->size);
|
bfd_size_type amt = sec->rawsize > sec->size ? sec->rawsize : sec->size;
|
|
data = (bfd_byte *) bfd_malloc (amt);
|
if (data == NULL)
|
if (data == NULL)
|
return NULL;
|
return NULL;
|
outbuf = data;
|
outbuf = data;
|
}
|
}
|
|
|
Line 238... |
Line 239... |
if (symbol_table == NULL)
|
if (symbol_table == NULL)
|
{
|
{
|
_bfd_generic_link_add_symbols (abfd, &link_info);
|
_bfd_generic_link_add_symbols (abfd, &link_info);
|
|
|
storage_needed = bfd_get_symtab_upper_bound (abfd);
|
storage_needed = bfd_get_symtab_upper_bound (abfd);
|
symbol_table = bfd_malloc (storage_needed);
|
symbol_table = (asymbol **) bfd_malloc (storage_needed);
|
bfd_canonicalize_symtab (abfd, symbol_table);
|
bfd_canonicalize_symtab (abfd, symbol_table);
|
}
|
}
|
else
|
else
|
storage_needed = 0;
|
storage_needed = 0;
|
|
|