* opncls.c (bfd_alloc_by_size_t): Set bfd_error_no_memory if
obstack_alloc fails. (bfd_alloc_finish): Set bfd_error_no_memory if obstack_finish fails. * libbfd.c (bfd_zmalloc): Set bfd_error_no_memory if malloc fails. * Many files: don't set bfd_error_no_memory if one of the above routines fails.
This commit is contained in:
parent
8f2bdc2032
commit
a9713b91a7
|
@ -1,5 +1,13 @@
|
||||||
Wed Nov 29 12:42:36 1995 Ian Lance Taylor <ian@cygnus.com>
|
Wed Nov 29 12:42:36 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||||
|
|
||||||
|
* opncls.c (bfd_alloc_by_size_t): Set bfd_error_no_memory if
|
||||||
|
obstack_alloc fails.
|
||||||
|
(bfd_alloc_finish): Set bfd_error_no_memory if obstack_finish
|
||||||
|
fails.
|
||||||
|
* libbfd.c (bfd_zmalloc): Set bfd_error_no_memory if malloc fails.
|
||||||
|
* Many files: don't set bfd_error_no_memory if one of the above
|
||||||
|
routines fails.
|
||||||
|
|
||||||
* elf.c (assign_file_positions_for_segments): Don't adjust p_paddr
|
* elf.c (assign_file_positions_for_segments): Don't adjust p_paddr
|
||||||
if p_paddr_valid is set.
|
if p_paddr_valid is set.
|
||||||
(copy_private_bfd_data): New static function.
|
(copy_private_bfd_data): New static function.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* BFD back-end for AIX on PS/2 core files.
|
/* BFD back-end for AIX on PS/2 core files.
|
||||||
This was based on trad-core.c, which was written by John Gilmore of
|
This was based on trad-core.c, which was written by John Gilmore of
|
||||||
Cygnus Support.
|
Cygnus Support.
|
||||||
Copyright 1988, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
|
Copyright 1988, 1989, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||||
Written by Minh Tran-Le <TRANLE@INTELLICORP.COM>.
|
Written by Minh Tran-Le <TRANLE@INTELLICORP.COM>.
|
||||||
Converted to back end form by Ian Lance Taylor <ian@cygnus.com>.
|
Converted to back end form by Ian Lance Taylor <ian@cygnus.com>.
|
||||||
|
|
||||||
|
@ -19,14 +19,7 @@ GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
/* To use this file on a particular host, configure the host with these
|
|
||||||
parameters in the config/h-HOST file:
|
|
||||||
|
|
||||||
HDEFINES=-DAIX386_CORE=1
|
|
||||||
HDEPFILES=aix386-core.o
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
|
@ -75,7 +68,7 @@ struct trad_core_struct {
|
||||||
asection *sections[MAX_CORE_SEGS];
|
asection *sections[MAX_CORE_SEGS];
|
||||||
};
|
};
|
||||||
|
|
||||||
static bfd_target *
|
static const bfd_target *
|
||||||
aix386_core_file_p (abfd)
|
aix386_core_file_p (abfd)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
{
|
{
|
||||||
|
@ -101,10 +94,7 @@ aix386_core_file_p (abfd)
|
||||||
|
|
||||||
mergem = (struct mergem *)bfd_zalloc (abfd, sizeof (struct mergem));
|
mergem = (struct mergem *)bfd_zalloc (abfd, sizeof (struct mergem));
|
||||||
if (mergem == NULL)
|
if (mergem == NULL)
|
||||||
{
|
return 0;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
core = &mergem->internal_core;
|
core = &mergem->internal_core;
|
||||||
|
|
||||||
|
@ -125,7 +115,6 @@ aix386_core_file_p (abfd)
|
||||||
if (core_regsec (abfd) == NULL)
|
if (core_regsec (abfd) == NULL)
|
||||||
{
|
{
|
||||||
loser:
|
loser:
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
bfd_release (abfd, (char *)mergem);
|
bfd_release (abfd, (char *)mergem);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -198,8 +187,8 @@ aix386_core_file_p (abfd)
|
||||||
core_regsec (abfd)->name = ".reg";
|
core_regsec (abfd)->name = ".reg";
|
||||||
core_reg2sec (abfd)->name = ".reg2";
|
core_reg2sec (abfd)->name = ".reg2";
|
||||||
|
|
||||||
core_regsec (abfd)->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
|
core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
|
||||||
core_reg2sec (abfd)->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
|
core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS;
|
||||||
|
|
||||||
core_regsec (abfd)->_raw_size = sizeof(core->cd_regs);
|
core_regsec (abfd)->_raw_size = sizeof(core->cd_regs);
|
||||||
core_reg2sec (abfd)->_raw_size = sizeof(core->cd_fpregs);
|
core_reg2sec (abfd)->_raw_size = sizeof(core->cd_fpregs);
|
||||||
|
@ -254,7 +243,7 @@ swap_abort()
|
||||||
#define NO_GETS ((PROTO(bfd_signed_vma, (*), (const bfd_byte *))) swap_abort )
|
#define NO_GETS ((PROTO(bfd_signed_vma, (*), (const bfd_byte *))) swap_abort )
|
||||||
#define NO_PUT ((PROTO(void, (*), (bfd_vma, bfd_byte *))) swap_abort )
|
#define NO_PUT ((PROTO(void, (*), (bfd_vma, bfd_byte *))) swap_abort )
|
||||||
|
|
||||||
bfd_target aix386_core_vec =
|
const bfd_target aix386_core_vec =
|
||||||
{
|
{
|
||||||
"aix386-core",
|
"aix386-core",
|
||||||
bfd_target_unknown_flavour,
|
bfd_target_unknown_flavour,
|
||||||
|
@ -268,7 +257,6 @@ bfd_target aix386_core_vec =
|
||||||
0, /* leading underscore */
|
0, /* leading underscore */
|
||||||
' ', /* ar_pad_char */
|
' ', /* ar_pad_char */
|
||||||
16, /* ar_max_namelen */
|
16, /* ar_max_namelen */
|
||||||
3, /* minimum alignment power */
|
|
||||||
NO_GET, NO_GETS, NO_PUT,
|
NO_GET, NO_GETS, NO_PUT,
|
||||||
NO_GET, NO_GETS, NO_PUT,
|
NO_GET, NO_GETS, NO_PUT,
|
||||||
NO_GET, NO_GETS, NO_PUT, /* data */
|
NO_GET, NO_GETS, NO_PUT, /* data */
|
||||||
|
@ -291,6 +279,7 @@ bfd_target aix386_core_vec =
|
||||||
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
|
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
|
||||||
BFD_JUMP_TABLE_WRITE (_bfd_generic),
|
BFD_JUMP_TABLE_WRITE (_bfd_generic),
|
||||||
BFD_JUMP_TABLE_LINK (_bfd_nolink),
|
BFD_JUMP_TABLE_LINK (_bfd_nolink),
|
||||||
|
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||||
|
|
||||||
(PTR) 0
|
(PTR) 0
|
||||||
};
|
};
|
||||||
|
|
|
@ -180,8 +180,9 @@ aout_adobe_callback (abfd)
|
||||||
goto no_more_sections;
|
goto no_more_sections;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf (stderr, "Unknown section type in a.out.adobe file: %x\n",
|
(*_bfd_error_handler)
|
||||||
ext->e_type[0]);
|
("%s: Unknown section type in a.out.adobe file: %x\n",
|
||||||
|
bfd_get_filename (abfd), ext->e_type[0]);
|
||||||
goto no_more_sections;
|
goto no_more_sections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,10 +202,8 @@ aout_adobe_callback (abfd)
|
||||||
/* Fix the name, if it is a sprintf'd name. */
|
/* Fix the name, if it is a sprintf'd name. */
|
||||||
if (sect->name == try_again) {
|
if (sect->name == try_again) {
|
||||||
newname = (char *) bfd_zalloc(abfd, strlen (sect->name));
|
newname = (char *) bfd_zalloc(abfd, strlen (sect->name));
|
||||||
if (newname == NULL) {
|
if (newname == NULL)
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
strcpy (newname, sect->name);
|
strcpy (newname, sect->name);
|
||||||
sect->name = newname;
|
sect->name = newname;
|
||||||
}
|
}
|
||||||
|
@ -255,10 +254,8 @@ aout_adobe_mkobject (abfd)
|
||||||
struct bout_data_struct *rawptr;
|
struct bout_data_struct *rawptr;
|
||||||
|
|
||||||
rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, sizeof (struct bout_data_struct));
|
rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, sizeof (struct bout_data_struct));
|
||||||
if (rawptr == NULL) {
|
if (rawptr == NULL)
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
abfd->tdata.bout_data = rawptr;
|
abfd->tdata.bout_data = rawptr;
|
||||||
exec_hdr (abfd) = &rawptr->e;
|
exec_hdr (abfd) = &rawptr->e;
|
||||||
|
@ -481,6 +478,7 @@ aout_adobe_sizeof_headers (ignore_abfd, ignore)
|
||||||
#define aout_32_sizeof_headers aout_adobe_sizeof_headers
|
#define aout_32_sizeof_headers aout_adobe_sizeof_headers
|
||||||
#define aout_32_bfd_get_relocated_section_contents \
|
#define aout_32_bfd_get_relocated_section_contents \
|
||||||
bfd_generic_get_relocated_section_contents
|
bfd_generic_get_relocated_section_contents
|
||||||
|
#define aout_32_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
|
||||||
#define aout_32_bfd_relax_section bfd_generic_relax_section
|
#define aout_32_bfd_relax_section bfd_generic_relax_section
|
||||||
#define aout_32_bfd_link_hash_table_create \
|
#define aout_32_bfd_link_hash_table_create \
|
||||||
_bfd_generic_link_hash_table_create
|
_bfd_generic_link_hash_table_create
|
||||||
|
|
54
bfd/aoutx.h
54
bfd/aoutx.h
|
@ -430,10 +430,8 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
|
||||||
const bfd_target *result;
|
const bfd_target *result;
|
||||||
|
|
||||||
rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, sizeof (struct aout_data_struct ));
|
rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, sizeof (struct aout_data_struct ));
|
||||||
if (rawptr == NULL) {
|
if (rawptr == NULL)
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
oldrawptr = abfd->tdata.aout_data;
|
oldrawptr = abfd->tdata.aout_data;
|
||||||
abfd->tdata.aout_data = rawptr;
|
abfd->tdata.aout_data = rawptr;
|
||||||
|
@ -644,10 +642,8 @@ NAME(aout,mkobject) (abfd)
|
||||||
/* Use an intermediate variable for clarity */
|
/* Use an intermediate variable for clarity */
|
||||||
rawptr = (struct aout_data_struct *)bfd_zalloc (abfd, sizeof (struct aout_data_struct ));
|
rawptr = (struct aout_data_struct *)bfd_zalloc (abfd, sizeof (struct aout_data_struct ));
|
||||||
|
|
||||||
if (rawptr == NULL) {
|
if (rawptr == NULL)
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
abfd->tdata.aout_data = rawptr;
|
abfd->tdata.aout_data = rawptr;
|
||||||
exec_hdr (abfd) = &(rawptr->e);
|
exec_hdr (abfd) = &(rawptr->e);
|
||||||
|
@ -1440,10 +1436,7 @@ translate_from_native_sym_flags (abfd, cache_ptr)
|
||||||
|
|
||||||
copy = bfd_alloc (abfd, strlen (cache_ptr->symbol.name) + 1);
|
copy = bfd_alloc (abfd, strlen (cache_ptr->symbol.name) + 1);
|
||||||
if (copy == NULL)
|
if (copy == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
strcpy (copy, cache_ptr->symbol.name);
|
strcpy (copy, cache_ptr->symbol.name);
|
||||||
section = bfd_make_section (abfd, copy);
|
section = bfd_make_section (abfd, copy);
|
||||||
|
@ -1453,10 +1446,7 @@ translate_from_native_sym_flags (abfd, cache_ptr)
|
||||||
|
|
||||||
reloc = (arelent_chain *) bfd_alloc (abfd, sizeof (arelent_chain));
|
reloc = (arelent_chain *) bfd_alloc (abfd, sizeof (arelent_chain));
|
||||||
if (reloc == NULL)
|
if (reloc == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Build a relocation entry for the constructor. */
|
/* Build a relocation entry for the constructor. */
|
||||||
switch (cache_ptr->type & N_TYPE)
|
switch (cache_ptr->type & N_TYPE)
|
||||||
|
@ -1667,10 +1657,7 @@ NAME(aout,make_empty_symbol) (abfd)
|
||||||
aout_symbol_type *new =
|
aout_symbol_type *new =
|
||||||
(aout_symbol_type *)bfd_zalloc (abfd, sizeof (aout_symbol_type));
|
(aout_symbol_type *)bfd_zalloc (abfd, sizeof (aout_symbol_type));
|
||||||
if (!new)
|
if (!new)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
new->symbol.the_bfd = abfd;
|
new->symbol.the_bfd = abfd;
|
||||||
|
|
||||||
return &new->symbol;
|
return &new->symbol;
|
||||||
|
@ -2377,10 +2364,8 @@ NAME(aout,squirt_out_relocs) (abfd, section)
|
||||||
each_size = obj_reloc_entry_size (abfd);
|
each_size = obj_reloc_entry_size (abfd);
|
||||||
natsize = each_size * count;
|
natsize = each_size * count;
|
||||||
native = (unsigned char *) bfd_zalloc (abfd, natsize);
|
native = (unsigned char *) bfd_zalloc (abfd, natsize);
|
||||||
if (!native) {
|
if (!native)
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
generic = section->orelocation;
|
generic = section->orelocation;
|
||||||
|
|
||||||
|
@ -2859,10 +2844,7 @@ NAME(aout,link_hash_newfunc) (entry, table, string)
|
||||||
ret = ((struct aout_link_hash_entry *)
|
ret = ((struct aout_link_hash_entry *)
|
||||||
bfd_hash_allocate (table, sizeof (struct aout_link_hash_entry)));
|
bfd_hash_allocate (table, sizeof (struct aout_link_hash_entry)));
|
||||||
if (ret == (struct aout_link_hash_entry *) NULL)
|
if (ret == (struct aout_link_hash_entry *) NULL)
|
||||||
{
|
return (struct bfd_hash_entry *) ret;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (struct bfd_hash_entry *) ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Call the allocation method of the superclass. */
|
/* Call the allocation method of the superclass. */
|
||||||
ret = ((struct aout_link_hash_entry *)
|
ret = ((struct aout_link_hash_entry *)
|
||||||
|
@ -2902,10 +2884,7 @@ NAME(aout,link_hash_table_create) (abfd)
|
||||||
ret = ((struct aout_link_hash_table *)
|
ret = ((struct aout_link_hash_table *)
|
||||||
bfd_alloc (abfd, sizeof (struct aout_link_hash_table)));
|
bfd_alloc (abfd, sizeof (struct aout_link_hash_table)));
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
return (struct bfd_link_hash_table *) NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (struct bfd_link_hash_table *) NULL;
|
|
||||||
}
|
|
||||||
if (! NAME(aout,link_hash_table_init) (ret, abfd,
|
if (! NAME(aout,link_hash_table_init) (ret, abfd,
|
||||||
NAME(aout,link_hash_newfunc)))
|
NAME(aout,link_hash_newfunc)))
|
||||||
{
|
{
|
||||||
|
@ -3229,10 +3208,7 @@ aout_link_add_symbols (abfd, info)
|
||||||
((size_t) sym_count
|
((size_t) sym_count
|
||||||
* sizeof (struct aout_link_hash_entry *))));
|
* sizeof (struct aout_link_hash_entry *))));
|
||||||
if (sym_hash == NULL && sym_count != 0)
|
if (sym_hash == NULL && sym_count != 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
obj_aout_sym_hashes (abfd) = sym_hash;
|
obj_aout_sym_hashes (abfd) = sym_hash;
|
||||||
|
|
||||||
add_one_symbol = aout_backend_info (abfd)->add_one_symbol;
|
add_one_symbol = aout_backend_info (abfd)->add_one_symbol;
|
||||||
|
@ -3515,7 +3491,12 @@ NAME(aout,final_link) (abfd, info, callback)
|
||||||
and call get_reloc_upper_bound and canonicalize_reloc to
|
and call get_reloc_upper_bound and canonicalize_reloc to
|
||||||
work out the number of relocs needed, and then multiply
|
work out the number of relocs needed, and then multiply
|
||||||
by the reloc size. */
|
by the reloc size. */
|
||||||
abort ();
|
(*_bfd_error_handler)
|
||||||
|
("%s: relocateable link from %s to %s not supported",
|
||||||
|
bfd_get_filename (abfd),
|
||||||
|
sub->xvec->name, abfd->xvec->name);
|
||||||
|
bfd_set_error (bfd_error_invalid_operation);
|
||||||
|
goto error_return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5270,10 +5251,7 @@ aout_link_reloc_link_order (finfo, o, p)
|
||||||
size = bfd_get_reloc_size (howto);
|
size = bfd_get_reloc_size (howto);
|
||||||
buf = (bfd_byte *) bfd_zmalloc (size);
|
buf = (bfd_byte *) bfd_zmalloc (size);
|
||||||
if (buf == (bfd_byte *) NULL)
|
if (buf == (bfd_byte *) NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
r = MY_relocate_contents (howto, finfo->output_bfd,
|
r = MY_relocate_contents (howto, finfo->output_bfd,
|
||||||
pr->addend, buf);
|
pr->addend, buf);
|
||||||
switch (r)
|
switch (r)
|
||||||
|
|
|
@ -187,10 +187,7 @@ _bfd_generic_mkarchive (abfd)
|
||||||
bfd_zalloc (abfd, sizeof (struct artdata)));
|
bfd_zalloc (abfd, sizeof (struct artdata)));
|
||||||
|
|
||||||
if (bfd_ardata (abfd) == NULL)
|
if (bfd_ardata (abfd) == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bfd_ardata (abfd)->cache = NULL;
|
bfd_ardata (abfd)->cache = NULL;
|
||||||
bfd_ardata (abfd)->archive_head = NULL;
|
bfd_ardata (abfd)->archive_head = NULL;
|
||||||
|
@ -251,15 +248,7 @@ bfd *
|
||||||
_bfd_create_empty_archive_element_shell (obfd)
|
_bfd_create_empty_archive_element_shell (obfd)
|
||||||
bfd *obfd;
|
bfd *obfd;
|
||||||
{
|
{
|
||||||
bfd *nbfd;
|
return _bfd_new_bfd_contained_in (obfd);
|
||||||
|
|
||||||
nbfd = _bfd_new_bfd_contained_in (obfd);
|
|
||||||
if (nbfd == NULL)
|
|
||||||
{
|
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return nbfd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -310,10 +299,7 @@ _bfd_add_bfd_to_archive_cache (arch_bfd, filepos, new_elt)
|
||||||
sizeof (struct ar_cache)));
|
sizeof (struct ar_cache)));
|
||||||
|
|
||||||
if (new_cache == NULL)
|
if (new_cache == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
new_cache->ptr = filepos;
|
new_cache->ptr = filepos;
|
||||||
new_cache->arelt = new_elt;
|
new_cache->arelt = new_elt;
|
||||||
|
@ -430,10 +416,7 @@ _bfd_generic_read_ar_hdr (abfd)
|
||||||
|
|
||||||
allocptr = bfd_zalloc (abfd, allocsize);
|
allocptr = bfd_zalloc (abfd, allocsize);
|
||||||
if (allocptr == NULL)
|
if (allocptr == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
filename = (allocptr
|
filename = (allocptr
|
||||||
+ sizeof (struct areltdata)
|
+ sizeof (struct areltdata)
|
||||||
+ sizeof (struct ar_hdr));
|
+ sizeof (struct ar_hdr));
|
||||||
|
@ -473,10 +456,7 @@ _bfd_generic_read_ar_hdr (abfd)
|
||||||
{
|
{
|
||||||
allocptr = bfd_zalloc (abfd, allocsize);
|
allocptr = bfd_zalloc (abfd, allocsize);
|
||||||
if (allocptr == NULL)
|
if (allocptr == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ared = (struct areltdata *) allocptr;
|
ared = (struct areltdata *) allocptr;
|
||||||
|
@ -627,8 +607,11 @@ const bfd_target *
|
||||||
bfd_generic_archive_p (abfd)
|
bfd_generic_archive_p (abfd)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
{
|
{
|
||||||
|
struct artdata *tdata_hold;
|
||||||
char armag[SARMAG + 1];
|
char armag[SARMAG + 1];
|
||||||
|
|
||||||
|
tdata_hold = abfd->tdata.aout_ar_data;
|
||||||
|
|
||||||
if (bfd_read ((PTR) armag, 1, SARMAG, abfd) != SARMAG)
|
if (bfd_read ((PTR) armag, 1, SARMAG, abfd) != SARMAG)
|
||||||
{
|
{
|
||||||
if (bfd_get_error () != bfd_error_system_call)
|
if (bfd_get_error () != bfd_error_system_call)
|
||||||
|
@ -651,10 +634,7 @@ bfd_generic_archive_p (abfd)
|
||||||
bfd_zalloc (abfd, sizeof (struct artdata)));
|
bfd_zalloc (abfd, sizeof (struct artdata)));
|
||||||
|
|
||||||
if (bfd_ardata (abfd) == NULL)
|
if (bfd_ardata (abfd) == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bfd_ardata (abfd)->first_file_filepos = SARMAG;
|
bfd_ardata (abfd)->first_file_filepos = SARMAG;
|
||||||
bfd_ardata (abfd)->cache = NULL;
|
bfd_ardata (abfd)->cache = NULL;
|
||||||
|
@ -666,14 +646,14 @@ bfd_generic_archive_p (abfd)
|
||||||
if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd)))
|
if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd)))
|
||||||
{
|
{
|
||||||
bfd_release (abfd, bfd_ardata (abfd));
|
bfd_release (abfd, bfd_ardata (abfd));
|
||||||
abfd->tdata.aout_ar_data = NULL;
|
abfd->tdata.aout_ar_data = tdata_hold;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd)))
|
if (!BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd)))
|
||||||
{
|
{
|
||||||
bfd_release (abfd, bfd_ardata (abfd));
|
bfd_release (abfd, bfd_ardata (abfd));
|
||||||
abfd->tdata.aout_ar_data = NULL;
|
abfd->tdata.aout_ar_data = tdata_hold;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -711,7 +691,7 @@ bfd_generic_archive_p (abfd)
|
||||||
err = bfd_get_error ();
|
err = bfd_get_error ();
|
||||||
(void) bfd_close (first);
|
(void) bfd_close (first);
|
||||||
bfd_release (abfd, bfd_ardata (abfd));
|
bfd_release (abfd, bfd_ardata (abfd));
|
||||||
abfd->tdata.aout_ar_data = NULL;
|
abfd->tdata.aout_ar_data = tdata_hold;
|
||||||
bfd_set_error (err);
|
bfd_set_error (err);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -763,10 +743,7 @@ do_slurp_bsd_armap (abfd)
|
||||||
|
|
||||||
raw_armap = (bfd_byte *) bfd_zalloc (abfd, parsed_size);
|
raw_armap = (bfd_byte *) bfd_zalloc (abfd, parsed_size);
|
||||||
if (raw_armap == (bfd_byte *) NULL)
|
if (raw_armap == (bfd_byte *) NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bfd_read ((PTR) raw_armap, 1, parsed_size, abfd) != parsed_size)
|
if (bfd_read ((PTR) raw_armap, 1, parsed_size, abfd) != parsed_size)
|
||||||
{
|
{
|
||||||
|
@ -796,10 +773,7 @@ do_slurp_bsd_armap (abfd)
|
||||||
(ardata->symdef_count
|
(ardata->symdef_count
|
||||||
* sizeof (carsym)));
|
* sizeof (carsym)));
|
||||||
if (!ardata->symdefs)
|
if (!ardata->symdefs)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (counter = 0, set = ardata->symdefs;
|
for (counter = 0, set = ardata->symdefs;
|
||||||
counter < ardata->symdef_count;
|
counter < ardata->symdef_count;
|
||||||
|
@ -877,20 +851,14 @@ do_slurp_coff_armap (abfd)
|
||||||
|
|
||||||
ardata->symdefs = (carsym *) bfd_zalloc (abfd, carsym_size + stringsize + 1);
|
ardata->symdefs = (carsym *) bfd_zalloc (abfd, carsym_size + stringsize + 1);
|
||||||
if (ardata->symdefs == NULL)
|
if (ardata->symdefs == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
carsyms = ardata->symdefs;
|
carsyms = ardata->symdefs;
|
||||||
stringbase = ((char *) ardata->symdefs) + carsym_size;
|
stringbase = ((char *) ardata->symdefs) + carsym_size;
|
||||||
|
|
||||||
/* Allocate and read in the raw offsets. */
|
/* Allocate and read in the raw offsets. */
|
||||||
raw_armap = (int *) bfd_alloc (abfd, ptrsize);
|
raw_armap = (int *) bfd_alloc (abfd, ptrsize);
|
||||||
if (raw_armap == NULL)
|
if (raw_armap == NULL)
|
||||||
{
|
goto release_symdefs;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto release_symdefs;
|
|
||||||
}
|
|
||||||
if (bfd_read ((PTR) raw_armap, 1, ptrsize, abfd) != ptrsize
|
if (bfd_read ((PTR) raw_armap, 1, ptrsize, abfd) != ptrsize
|
||||||
|| bfd_read ((PTR) stringbase, 1, stringsize, abfd) != stringsize)
|
|| bfd_read ((PTR) stringbase, 1, stringsize, abfd) != stringsize)
|
||||||
{
|
{
|
||||||
|
@ -1022,7 +990,6 @@ bfd_slurp_bsd_armap_f2 (abfd)
|
||||||
raw_armap = (bfd_byte *) bfd_zalloc (abfd, mapdata->parsed_size);
|
raw_armap = (bfd_byte *) bfd_zalloc (abfd, mapdata->parsed_size);
|
||||||
if (raw_armap == NULL)
|
if (raw_armap == NULL)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
byebye:
|
byebye:
|
||||||
bfd_release (abfd, (PTR) mapdata);
|
bfd_release (abfd, (PTR) mapdata);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1060,10 +1027,7 @@ bfd_slurp_bsd_armap_f2 (abfd)
|
||||||
(ardata->symdef_count
|
(ardata->symdef_count
|
||||||
* BSD_SYMDEF_SIZE));
|
* BSD_SYMDEF_SIZE));
|
||||||
if (!ardata->symdefs)
|
if (!ardata->symdefs)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (counter = 0, set = ardata->symdefs;
|
for (counter = 0, set = ardata->symdefs;
|
||||||
counter < ardata->symdef_count;
|
counter < ardata->symdef_count;
|
||||||
|
@ -1124,7 +1088,6 @@ _bfd_slurp_extended_name_table (abfd)
|
||||||
bfd_zalloc (abfd, namedata->parsed_size);
|
bfd_zalloc (abfd, namedata->parsed_size);
|
||||||
if (bfd_ardata (abfd)->extended_names == NULL)
|
if (bfd_ardata (abfd)->extended_names == NULL)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
byebye:
|
byebye:
|
||||||
bfd_release (abfd, (PTR) namedata);
|
bfd_release (abfd, (PTR) namedata);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1198,10 +1161,7 @@ normalize (abfd, file)
|
||||||
|
|
||||||
copy = (char *) bfd_alloc (abfd, last - first + 1);
|
copy = (char *) bfd_alloc (abfd, last - first + 1);
|
||||||
if (copy == NULL)
|
if (copy == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy (copy, first, last - first);
|
memcpy (copy, first, last - first);
|
||||||
copy[last - first] = 0;
|
copy[last - first] = 0;
|
||||||
|
@ -1321,10 +1281,7 @@ _bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen)
|
||||||
|
|
||||||
*tabloc = bfd_zalloc (abfd, total_namelen);
|
*tabloc = bfd_zalloc (abfd, total_namelen);
|
||||||
if (*tabloc == NULL)
|
if (*tabloc == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
*tablen = total_namelen;
|
*tablen = total_namelen;
|
||||||
strptr = *tabloc;
|
strptr = *tabloc;
|
||||||
|
@ -1400,10 +1357,7 @@ bfd_ar_hdr_from_filesystem (abfd, filename)
|
||||||
ared = (struct areltdata *) bfd_zalloc (abfd, sizeof (struct ar_hdr) +
|
ared = (struct areltdata *) bfd_zalloc (abfd, sizeof (struct ar_hdr) +
|
||||||
sizeof (struct areltdata));
|
sizeof (struct areltdata));
|
||||||
if (ared == NULL)
|
if (ared == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata));
|
hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata));
|
||||||
|
|
||||||
/* ar headers are space padded, not null padded! */
|
/* ar headers are space padded, not null padded! */
|
||||||
|
@ -1778,7 +1732,7 @@ _bfd_compute_and_write_armap (arch, elength)
|
||||||
them when done. */
|
them when done. */
|
||||||
first_name = bfd_alloc (arch, 1);
|
first_name = bfd_alloc (arch, 1);
|
||||||
if (first_name == NULL)
|
if (first_name == NULL)
|
||||||
goto no_memory_return;
|
goto error_return;
|
||||||
|
|
||||||
/* Drop all the files called __.SYMDEF, we're going to make our
|
/* Drop all the files called __.SYMDEF, we're going to make our
|
||||||
own */
|
own */
|
||||||
|
@ -1850,10 +1804,10 @@ _bfd_compute_and_write_armap (arch, elength)
|
||||||
bfd_alloc (arch,
|
bfd_alloc (arch,
|
||||||
sizeof (char *)));
|
sizeof (char *)));
|
||||||
if (map[orl_count].name == NULL)
|
if (map[orl_count].name == NULL)
|
||||||
goto no_memory_return;
|
goto error_return;
|
||||||
*(map[orl_count].name) = bfd_alloc (arch, namelen + 1);
|
*(map[orl_count].name) = bfd_alloc (arch, namelen + 1);
|
||||||
if (*(map[orl_count].name) == NULL)
|
if (*(map[orl_count].name) == NULL)
|
||||||
goto no_memory_return;
|
goto error_return;
|
||||||
strcpy (*(map[orl_count].name), syms[src_count]->name);
|
strcpy (*(map[orl_count].name), syms[src_count]->name);
|
||||||
(map[orl_count]).pos = (file_ptr) current;
|
(map[orl_count]).pos = (file_ptr) current;
|
||||||
(map[orl_count]).namidx = stridx;
|
(map[orl_count]).namidx = stridx;
|
||||||
|
|
19
bfd/binary.c
19
bfd/binary.c
|
@ -149,10 +149,7 @@ mangle_name (abfd, suffix)
|
||||||
|
|
||||||
buf = (char *) bfd_alloc (abfd, size);
|
buf = (char *) bfd_alloc (abfd, size);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
{
|
return "";
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf (buf, "_binary_%s_%s", bfd_get_filename (abfd), suffix);
|
sprintf (buf, "_binary_%s_%s", bfd_get_filename (abfd), suffix);
|
||||||
|
|
||||||
|
@ -177,10 +174,7 @@ binary_get_symtab (abfd, alocation)
|
||||||
|
|
||||||
syms = (asymbol *) bfd_alloc (abfd, BIN_SYMS * sizeof (asymbol));
|
syms = (asymbol *) bfd_alloc (abfd, BIN_SYMS * sizeof (asymbol));
|
||||||
if (syms == NULL)
|
if (syms == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Start symbol. */
|
/* Start symbol. */
|
||||||
syms[0].the_bfd = abfd;
|
syms[0].the_bfd = abfd;
|
||||||
|
@ -219,12 +213,7 @@ static asymbol *
|
||||||
binary_make_empty_symbol (abfd)
|
binary_make_empty_symbol (abfd)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
{
|
{
|
||||||
asymbol *ret;
|
return (asymbol *) bfd_alloc (abfd, sizeof (asymbol));
|
||||||
|
|
||||||
ret = (asymbol *) bfd_alloc (abfd, sizeof (asymbol));
|
|
||||||
if (ret == NULL)
|
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define binary_print_symbol _bfd_nosymbols_print_symbol
|
#define binary_print_symbol _bfd_nosymbols_print_symbol
|
||||||
|
@ -305,6 +294,8 @@ binary_sizeof_headers (abfd, exec)
|
||||||
#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||||
#define binary_bfd_final_link _bfd_generic_final_link
|
#define binary_bfd_final_link _bfd_generic_final_link
|
||||||
#define binary_bfd_link_split_section _bfd_generic_link_split_section
|
#define binary_bfd_link_split_section _bfd_generic_link_split_section
|
||||||
|
#define binary_get_section_contents_in_window \
|
||||||
|
_bfd_generic_get_section_contents_in_window
|
||||||
|
|
||||||
const bfd_target binary_vec =
|
const bfd_target binary_vec =
|
||||||
{
|
{
|
||||||
|
|
10
bfd/bout.c
10
bfd/bout.c
|
@ -204,10 +204,8 @@ b_out_mkobject (abfd)
|
||||||
struct bout_data_struct *rawptr;
|
struct bout_data_struct *rawptr;
|
||||||
|
|
||||||
rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, sizeof (struct bout_data_struct));
|
rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, sizeof (struct bout_data_struct));
|
||||||
if (rawptr == NULL) {
|
if (rawptr == NULL)
|
||||||
bfd_set_error (bfd_error_no_memory);
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
abfd->tdata.bout_data = rawptr;
|
abfd->tdata.bout_data = rawptr;
|
||||||
exec_hdr (abfd) = &rawptr->e;
|
exec_hdr (abfd) = &rawptr->e;
|
||||||
|
@ -1396,6 +1394,8 @@ b_out_bfd_get_relocated_section_contents (in_abfd, link_info, link_order,
|
||||||
#define b_out_bfd_final_link _bfd_generic_final_link
|
#define b_out_bfd_final_link _bfd_generic_final_link
|
||||||
#define b_out_bfd_link_split_section _bfd_generic_link_split_section
|
#define b_out_bfd_link_split_section _bfd_generic_link_split_section
|
||||||
|
|
||||||
|
#define aout_32_get_section_contents_in_window \
|
||||||
|
_bfd_generic_get_section_contents_in_window
|
||||||
|
|
||||||
const bfd_target b_out_vec_big_host =
|
const bfd_target b_out_vec_big_host =
|
||||||
{
|
{
|
||||||
|
@ -1410,7 +1410,6 @@ const bfd_target b_out_vec_big_host =
|
||||||
'_', /* symbol leading char */
|
'_', /* symbol leading char */
|
||||||
' ', /* ar_pad_char */
|
' ', /* ar_pad_char */
|
||||||
16, /* ar_max_namelen */
|
16, /* ar_max_namelen */
|
||||||
2, /* minumum alignment power */
|
|
||||||
|
|
||||||
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||||
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||||
|
@ -1452,7 +1451,6 @@ const bfd_target b_out_vec_little_host =
|
||||||
'_', /* symbol leading char */
|
'_', /* symbol leading char */
|
||||||
' ', /* ar_pad_char */
|
' ', /* ar_pad_char */
|
||||||
16, /* ar_max_namelen */
|
16, /* ar_max_namelen */
|
||||||
2, /* minum align */
|
|
||||||
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||||
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||||
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
||||||
|
|
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
|
@ -49,7 +49,7 @@ struct cisco_core_struct
|
||||||
int sig;
|
int sig;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bfd_target *
|
static const bfd_target *
|
||||||
cisco_core_file_p (abfd)
|
cisco_core_file_p (abfd)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
{
|
{
|
||||||
|
@ -116,10 +116,7 @@ cisco_core_file_p (abfd)
|
||||||
((struct cisco_core_struct *)
|
((struct cisco_core_struct *)
|
||||||
bfd_zmalloc (sizeof (struct cisco_core_struct)));
|
bfd_zmalloc (sizeof (struct cisco_core_struct)));
|
||||||
if (abfd->tdata.cisco_core_data == NULL)
|
if (abfd->tdata.cisco_core_data == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ((crashreason) bfd_get_32 (abfd, crashinfo.reason))
|
switch ((crashreason) bfd_get_32 (abfd, crashinfo.reason))
|
||||||
{
|
{
|
||||||
|
@ -202,12 +199,9 @@ cisco_core_file_p (abfd)
|
||||||
|
|
||||||
asect = (asection *) bfd_zmalloc (sizeof (asection));
|
asect = (asection *) bfd_zmalloc (sizeof (asection));
|
||||||
if (asect == NULL)
|
if (asect == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
asect->name = ".reg";
|
asect->name = ".reg";
|
||||||
asect->flags = SEC_ALLOC | SEC_HAS_CONTENTS;
|
asect->flags = SEC_HAS_CONTENTS;
|
||||||
/* This can be bigger than the real size. Set it to the size of the whole
|
/* This can be bigger than the real size. Set it to the size of the whole
|
||||||
core file. */
|
core file. */
|
||||||
asect->_raw_size = statbuf.st_size;
|
asect->_raw_size = statbuf.st_size;
|
||||||
|
@ -221,10 +215,7 @@ cisco_core_file_p (abfd)
|
||||||
We call it .data. */
|
We call it .data. */
|
||||||
asect = (asection *) bfd_zmalloc (sizeof (asection));
|
asect = (asection *) bfd_zmalloc (sizeof (asection));
|
||||||
if (asect == NULL)
|
if (asect == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
asect->name = ".data";
|
asect->name = ".data";
|
||||||
asect->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
|
asect->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
|
||||||
/* The size of memory is the size of the core file itself. */
|
/* The size of memory is the size of the core file itself. */
|
||||||
|
@ -273,7 +264,7 @@ cisco_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bfd_target cisco_core_vec =
|
const bfd_target cisco_core_vec =
|
||||||
{
|
{
|
||||||
"trad-core",
|
"trad-core",
|
||||||
bfd_target_unknown_flavour,
|
bfd_target_unknown_flavour,
|
||||||
|
@ -286,7 +277,6 @@ bfd_target cisco_core_vec =
|
||||||
0, /* symbol prefix */
|
0, /* symbol prefix */
|
||||||
' ', /* ar_pad_char */
|
' ', /* ar_pad_char */
|
||||||
16, /* ar_max_namelen */
|
16, /* ar_max_namelen */
|
||||||
3, /* minimum alignment power */
|
|
||||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
||||||
|
@ -317,6 +307,7 @@ bfd_target cisco_core_vec =
|
||||||
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
|
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
|
||||||
BFD_JUMP_TABLE_WRITE (_bfd_generic),
|
BFD_JUMP_TABLE_WRITE (_bfd_generic),
|
||||||
BFD_JUMP_TABLE_LINK (_bfd_nolink),
|
BFD_JUMP_TABLE_LINK (_bfd_nolink),
|
||||||
|
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||||
|
|
||||||
(PTR) 0 /* backend_data */
|
(PTR) 0 /* backend_data */
|
||||||
};
|
};
|
||||||
|
|
|
@ -1387,10 +1387,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
(NUM_RELOC_SECTIONS
|
(NUM_RELOC_SECTIONS
|
||||||
* sizeof (asection *))));
|
* sizeof (asection *))));
|
||||||
if (!symndx_to_section)
|
if (!symndx_to_section)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
symndx_to_section[RELOC_SECTION_NONE] = NULL;
|
symndx_to_section[RELOC_SECTION_NONE] = NULL;
|
||||||
symndx_to_section[RELOC_SECTION_TEXT] =
|
symndx_to_section[RELOC_SECTION_TEXT] =
|
||||||
|
|
|
@ -212,10 +212,7 @@ coff_i960_relocate (abfd, reloc_entry, symbol, data, input_section,
|
||||||
((PTR) bfd_zalloc (abfd,
|
((PTR) bfd_zalloc (abfd,
|
||||||
sizeof (struct coff_section_tdata)));
|
sizeof (struct coff_section_tdata)));
|
||||||
if (osec->used_by_bfd == NULL)
|
if (osec->used_by_bfd == NULL)
|
||||||
{
|
return bfd_reloc_overflow;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return bfd_reloc_overflow;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
coff_section_data (output_bfd, osec)->tdata = (PTR) syms;
|
coff_section_data (output_bfd, osec)->tdata = (PTR) syms;
|
||||||
}
|
}
|
||||||
|
@ -549,6 +546,8 @@ coff_i960_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
|
||||||
{
|
{
|
||||||
struct coff_link_hash_entry *h;
|
struct coff_link_hash_entry *h;
|
||||||
|
|
||||||
|
*adjustedp = false;
|
||||||
|
|
||||||
h = obj_coff_sym_hashes (ibfd)[irel->r_symndx];
|
h = obj_coff_sym_hashes (ibfd)[irel->r_symndx];
|
||||||
if (h == NULL
|
if (h == NULL
|
||||||
|| (h->root.type != bfd_link_hash_defined
|
|| (h->root.type != bfd_link_hash_defined
|
||||||
|
@ -587,7 +586,6 @@ const bfd_target icoff_little_vec =
|
||||||
'/', /* ar_pad_char */
|
'/', /* ar_pad_char */
|
||||||
15, /* ar_max_namelen */
|
15, /* ar_max_namelen */
|
||||||
|
|
||||||
3, /* minimum alignment power */
|
|
||||||
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||||
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||||
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
||||||
|
@ -632,7 +630,6 @@ const bfd_target icoff_big_vec =
|
||||||
'/', /* ar_pad_char */
|
'/', /* ar_pad_char */
|
||||||
15, /* ar_max_namelen */
|
15, /* ar_max_namelen */
|
||||||
|
|
||||||
3, /* minimum alignment power */
|
|
||||||
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||||
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||||
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
||||||
|
|
|
@ -1204,10 +1204,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
(NUM_RELOC_SECTIONS
|
(NUM_RELOC_SECTIONS
|
||||||
* sizeof (asection *))));
|
* sizeof (asection *))));
|
||||||
if (!symndx_to_section)
|
if (!symndx_to_section)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
symndx_to_section[RELOC_SECTION_NONE] = NULL;
|
symndx_to_section[RELOC_SECTION_NONE] = NULL;
|
||||||
symndx_to_section[RELOC_SECTION_TEXT] =
|
symndx_to_section[RELOC_SECTION_TEXT] =
|
||||||
|
@ -1801,10 +1798,7 @@ mips_read_relocs (abfd, sec)
|
||||||
sec->used_by_bfd =
|
sec->used_by_bfd =
|
||||||
(PTR) bfd_alloc_by_size_t (abfd, sizeof (struct ecoff_section_tdata));
|
(PTR) bfd_alloc_by_size_t (abfd, sizeof (struct ecoff_section_tdata));
|
||||||
if (sec->used_by_bfd == NULL)
|
if (sec->used_by_bfd == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
section_tdata = ecoff_section_data (abfd, sec);
|
section_tdata = ecoff_section_data (abfd, sec);
|
||||||
section_tdata->external_relocs = NULL;
|
section_tdata->external_relocs = NULL;
|
||||||
|
@ -1822,10 +1816,7 @@ mips_read_relocs (abfd, sec)
|
||||||
section_tdata->external_relocs =
|
section_tdata->external_relocs =
|
||||||
(PTR) bfd_alloc (abfd, external_relocs_size);
|
(PTR) bfd_alloc (abfd, external_relocs_size);
|
||||||
if (section_tdata->external_relocs == NULL && external_relocs_size != 0)
|
if (section_tdata->external_relocs == NULL && external_relocs_size != 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0
|
if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0
|
||||||
|| (bfd_read (section_tdata->external_relocs, 1,
|
|| (bfd_read (section_tdata->external_relocs, 1,
|
||||||
|
@ -2046,10 +2037,7 @@ mips_relax_section (abfd, sec, info, again)
|
||||||
size = sec->reloc_count * sizeof (long);
|
size = sec->reloc_count * sizeof (long);
|
||||||
offsets = (long *) bfd_alloc_by_size_t (abfd, size);
|
offsets = (long *) bfd_alloc_by_size_t (abfd, size);
|
||||||
if (offsets == (long *) NULL)
|
if (offsets == (long *) NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
memset (offsets, 0, size);
|
memset (offsets, 0, size);
|
||||||
section_tdata->offsets = offsets;
|
section_tdata->offsets = offsets;
|
||||||
}
|
}
|
||||||
|
@ -2226,10 +2214,7 @@ mips_relax_section (abfd, sec, info, again)
|
||||||
adjust = ((struct ecoff_value_adjust *)
|
adjust = ((struct ecoff_value_adjust *)
|
||||||
bfd_alloc (abfd, sizeof (struct ecoff_value_adjust)));
|
bfd_alloc (abfd, sizeof (struct ecoff_value_adjust)));
|
||||||
if (adjust == (struct ecoff_value_adjust *) NULL)
|
if (adjust == (struct ecoff_value_adjust *) NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
|
|
||||||
adjust->start = int_rel.r_vaddr;
|
adjust->start = int_rel.r_vaddr;
|
||||||
adjust->end = sec->vma + sec->_raw_size;
|
adjust->end = sec->vma + sec->_raw_size;
|
||||||
|
@ -2330,10 +2315,7 @@ bfd_mips_ecoff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
|
||||||
|
|
||||||
relsec->contents = (bfd_byte *) bfd_alloc (abfd, datasec->reloc_count * 4);
|
relsec->contents = (bfd_byte *) bfd_alloc (abfd, datasec->reloc_count * 4);
|
||||||
if (relsec->contents == NULL)
|
if (relsec->contents == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = relsec->contents;
|
p = relsec->contents;
|
||||||
|
|
||||||
|
@ -2442,7 +2424,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
|
||||||
mips_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
|
mips_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
|
||||||
_bfd_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
|
_bfd_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
|
||||||
_bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
|
_bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
|
||||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
||||||
},
|
},
|
||||||
/* Supported architecture. */
|
/* Supported architecture. */
|
||||||
bfd_arch_mips,
|
bfd_arch_mips,
|
||||||
|
@ -2519,6 +2501,10 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
|
||||||
#define _bfd_ecoff_bfd_get_relocated_section_contents \
|
#define _bfd_ecoff_bfd_get_relocated_section_contents \
|
||||||
bfd_generic_get_relocated_section_contents
|
bfd_generic_get_relocated_section_contents
|
||||||
|
|
||||||
|
/* Handling file windows is generic. */
|
||||||
|
#define _bfd_ecoff_get_section_contents_in_window \
|
||||||
|
_bfd_generic_get_section_contents_in_window
|
||||||
|
|
||||||
/* Relaxing sections is MIPS specific. */
|
/* Relaxing sections is MIPS specific. */
|
||||||
#define _bfd_ecoff_bfd_relax_section mips_relax_section
|
#define _bfd_ecoff_bfd_relax_section mips_relax_section
|
||||||
|
|
||||||
|
|
169
bfd/coff-ppc.c
169
bfd/coff-ppc.c
|
@ -152,10 +152,7 @@ ppc_coff_link_hash_table_create (abfd)
|
||||||
ret = ((struct ppc_coff_link_hash_table *)
|
ret = ((struct ppc_coff_link_hash_table *)
|
||||||
bfd_alloc (abfd, sizeof (struct ppc_coff_link_hash_table)));
|
bfd_alloc (abfd, sizeof (struct ppc_coff_link_hash_table)));
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (! ppc_coff_link_hash_table_init (ret, abfd,
|
if (! ppc_coff_link_hash_table_init (ret, abfd,
|
||||||
ppc_coff_link_hash_newfunc))
|
ppc_coff_link_hash_newfunc))
|
||||||
{
|
{
|
||||||
|
@ -762,10 +759,18 @@ enum toc_type
|
||||||
toc_64
|
toc_64
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ref_category
|
||||||
|
{
|
||||||
|
priv,
|
||||||
|
pub,
|
||||||
|
data
|
||||||
|
};
|
||||||
|
|
||||||
struct list_ele
|
struct list_ele
|
||||||
{
|
{
|
||||||
struct list_ele *next;
|
struct list_ele *next;
|
||||||
bfd_vma addr;
|
bfd_vma addr;
|
||||||
|
enum ref_category cat;
|
||||||
int offset;
|
int offset;
|
||||||
const char *name;
|
const char *name;
|
||||||
};
|
};
|
||||||
|
@ -774,9 +779,10 @@ extern struct list_ele *head;
|
||||||
extern struct list_ele *tail;
|
extern struct list_ele *tail;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
record_toc(toc_section, our_toc_offset, name)
|
record_toc(toc_section, our_toc_offset, cat, name)
|
||||||
asection *toc_section;
|
asection *toc_section;
|
||||||
int our_toc_offset;
|
int our_toc_offset;
|
||||||
|
enum ref_category cat;
|
||||||
const char *name;
|
const char *name;
|
||||||
{
|
{
|
||||||
/* add this entry to our toc addr-offset-name list */
|
/* add this entry to our toc addr-offset-name list */
|
||||||
|
@ -785,6 +791,7 @@ record_toc(toc_section, our_toc_offset, name)
|
||||||
t->next = 0;
|
t->next = 0;
|
||||||
t->offset = our_toc_offset;
|
t->offset = our_toc_offset;
|
||||||
t->name = name;
|
t->name = name;
|
||||||
|
t->cat = cat;
|
||||||
t->addr = toc_section->output_offset + our_toc_offset;
|
t->addr = toc_section->output_offset + our_toc_offset;
|
||||||
|
|
||||||
if (head == 0)
|
if (head == 0)
|
||||||
|
@ -840,10 +847,7 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
|
||||||
(int *) bfd_zalloc (abfd,
|
(int *) bfd_zalloc (abfd,
|
||||||
obj_raw_syment_count(abfd) * sizeof(int));
|
obj_raw_syment_count(abfd) * sizeof(int));
|
||||||
if (local_syms == 0)
|
if (local_syms == 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
obj_coff_local_toc_table(abfd) = local_syms;
|
obj_coff_local_toc_table(abfd) = local_syms;
|
||||||
for (i = 0; i < obj_raw_syment_count(abfd); ++i)
|
for (i = 0; i < obj_raw_syment_count(abfd); ++i)
|
||||||
local_syms[i] = 1;
|
local_syms[i] = 1;
|
||||||
|
@ -854,6 +858,15 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
|
||||||
local_syms[sym] = global_toc_size;
|
local_syms[sym] = global_toc_size;
|
||||||
ret_val = global_toc_size;
|
ret_val = global_toc_size;
|
||||||
global_toc_size += 4;
|
global_toc_size += 4;
|
||||||
|
|
||||||
|
/* The size must fit in a 16bit displacment */
|
||||||
|
if (global_toc_size >= 65535)
|
||||||
|
{
|
||||||
|
fprintf(stderr,
|
||||||
|
"Exceeded toc size of 65535\n");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef TOC_DEBUG
|
#ifdef TOC_DEBUG
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Setting toc_offset for local sym %d to %d\n",
|
"Setting toc_offset for local sym %d to %d\n",
|
||||||
|
@ -881,6 +894,15 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
|
||||||
h->toc_offset = global_toc_size;
|
h->toc_offset = global_toc_size;
|
||||||
ret_val = global_toc_size;
|
ret_val = global_toc_size;
|
||||||
global_toc_size += 4;
|
global_toc_size += 4;
|
||||||
|
|
||||||
|
/* The size must fit in a 16bit displacment */
|
||||||
|
if (global_toc_size >= 65535)
|
||||||
|
{
|
||||||
|
fprintf(stderr,
|
||||||
|
"Exceeded toc size of 65535\n");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef TOC_DEBUG
|
#ifdef TOC_DEBUG
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Setting toc_offset for sym %d (%s) [h=%p] to %d\n",
|
"Setting toc_offset for sym %d (%s) [h=%p] to %d\n",
|
||||||
|
@ -950,10 +972,7 @@ ppc_record_data_in_toc_entry(abfd, info, sec, sym, toc_kind)
|
||||||
(int *) bfd_zalloc (abfd,
|
(int *) bfd_zalloc (abfd,
|
||||||
obj_raw_syment_count(abfd) * sizeof(int));
|
obj_raw_syment_count(abfd) * sizeof(int));
|
||||||
if (local_syms == 0)
|
if (local_syms == 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
obj_coff_local_toc_table(abfd) = local_syms;
|
obj_coff_local_toc_table(abfd) = local_syms;
|
||||||
for (i = 0; i < obj_raw_syment_count(abfd); ++i)
|
for (i = 0; i < obj_raw_syment_count(abfd); ++i)
|
||||||
local_syms[i] = 1;
|
local_syms[i] = 1;
|
||||||
|
@ -1339,16 +1358,18 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
#ifdef TOC_DEBUG
|
#ifdef TOC_DEBUG
|
||||||
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Not writing out toc_offset of %d for %s\n", our_toc_offset, name);
|
"Not writing out toc_offset of %d for %s\n",
|
||||||
|
our_toc_offset, name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* write out the toc entry */
|
/* write out the toc entry */
|
||||||
record_toc(toc_section, our_toc_offset, strdup(name));
|
record_toc(toc_section, our_toc_offset, priv, strdup(name));
|
||||||
#ifdef TOC_DEBUG
|
#ifdef TOC_DEBUG
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Writing out toc_offset toc_section (%p,%p)+%d val %d for %s\n",
|
"Writing out toc_offset "
|
||||||
|
"toc_section (%p,%p)+%d val %d for %s\n",
|
||||||
toc_section,
|
toc_section,
|
||||||
toc_section->contents,
|
toc_section->contents,
|
||||||
our_toc_offset,
|
our_toc_offset,
|
||||||
|
@ -1369,15 +1390,38 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
const char *name = h->root.root.root.string;
|
const char *name = h->root.root.root.string;
|
||||||
our_toc_offset = h->toc_offset;
|
our_toc_offset = h->toc_offset;
|
||||||
|
|
||||||
if ( (r_flags & IMAGE_REL_PPC_TOCDEFN) == IMAGE_REL_PPC_TOCDEFN &&
|
if ((r_flags & IMAGE_REL_PPC_TOCDEFN)
|
||||||
our_toc_offset == 1)
|
== IMAGE_REL_PPC_TOCDEFN
|
||||||
|
&& our_toc_offset == 1)
|
||||||
{
|
{
|
||||||
/* This is unbelievable cheese. Some knowledgable asm hacker has decided to
|
/* This is unbelievable cheese. Some knowledgable asm
|
||||||
use r2 as a base for loading a value. He/She does this by setting the
|
hacker has decided to use r2 as a base for loading
|
||||||
tocdefn bit, and not supplying a toc definition. The behaviour is then
|
a value. He/She does this by setting the tocdefn bit,
|
||||||
to use the value of the symbol as a toc index. Good Grief.
|
and not supplying a toc definition. The behaviour is
|
||||||
|
then to use the difference between the value of the
|
||||||
|
symbol and the actual location of the toc as the toc
|
||||||
|
index.
|
||||||
|
|
||||||
|
In fact, what is usually happening is, because the
|
||||||
|
Import Address Table is mapped immediately following
|
||||||
|
the toc, some trippy library code trying for speed on
|
||||||
|
dll linkage, takes advantage of that and considers
|
||||||
|
the IAT to be part of the toc, thus saving a load.
|
||||||
*/
|
*/
|
||||||
our_toc_offset = val - (toc_section->output_section->vma + toc_section->output_offset);
|
our_toc_offset = val -
|
||||||
|
(toc_section->output_section->vma +
|
||||||
|
toc_section->output_offset);
|
||||||
|
|
||||||
|
/* The size must still fit in a 16bit displacment */
|
||||||
|
if (our_toc_offset >= 65535)
|
||||||
|
{
|
||||||
|
fprintf(stderr,
|
||||||
|
"TOCDEFN Relocation exceeded "
|
||||||
|
"displacment of 65535\n");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
record_toc(toc_section, our_toc_offset, pub, strdup(name));
|
||||||
}
|
}
|
||||||
else if ((our_toc_offset & 1) != 0)
|
else if ((our_toc_offset & 1) != 0)
|
||||||
{
|
{
|
||||||
|
@ -1388,17 +1432,19 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
our_toc_offset &= ~1;
|
our_toc_offset &= ~1;
|
||||||
#ifdef TOC_DEBUG
|
#ifdef TOC_DEBUG
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Not writing out toc_offset of %d for %s\n", our_toc_offset, name);
|
"Not writing out toc_offset of %d for %s\n",
|
||||||
|
our_toc_offset, name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
record_toc(toc_section, our_toc_offset, strdup(name));
|
record_toc(toc_section, our_toc_offset, pub, strdup(name));
|
||||||
|
|
||||||
#ifdef TOC_DEBUG
|
#ifdef TOC_DEBUG
|
||||||
/* write out the toc entry */
|
/* write out the toc entry */
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Writing out toc_offset toc_section (%p,%p)+%d val %d for %s\n",
|
"Writing out toc_offset "
|
||||||
|
"toc_section (%p,%p)+%d val %d for %s\n",
|
||||||
toc_section,
|
toc_section,
|
||||||
toc_section->contents,
|
toc_section->contents,
|
||||||
our_toc_offset,
|
our_toc_offset,
|
||||||
|
@ -1558,7 +1604,8 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
false, false, true);
|
false, false, true);
|
||||||
if (myh == 0)
|
if (myh == 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Missing idata magic cookies, this cannot work anyway...\n");
|
fprintf(stderr, "Missing idata magic cookies, "
|
||||||
|
"this cannot work anyway...\n");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1704,6 +1751,13 @@ long int thunk_size;
|
||||||
struct list_ele *head;
|
struct list_ele *head;
|
||||||
struct list_ele *tail;
|
struct list_ele *tail;
|
||||||
|
|
||||||
|
static char *
|
||||||
|
h1 = "\n\t\t\tTOC MAPPING\n\n";
|
||||||
|
static char *
|
||||||
|
h2 = " TOC disassembly Comments Name\n";
|
||||||
|
static char *
|
||||||
|
h3 = " Offset spelling (if present)\n";
|
||||||
|
|
||||||
void
|
void
|
||||||
dump_toc(vfile)
|
dump_toc(vfile)
|
||||||
void *vfile;
|
void *vfile;
|
||||||
|
@ -1711,15 +1765,38 @@ dump_toc(vfile)
|
||||||
FILE *file = vfile;
|
FILE *file = vfile;
|
||||||
struct list_ele *t;
|
struct list_ele *t;
|
||||||
|
|
||||||
fprintf(file,
|
fprintf(file, h1);
|
||||||
" Offset Offset Name if present\n");
|
fprintf(file, h2);
|
||||||
|
fprintf(file, h3);
|
||||||
|
|
||||||
for(t = head; t != 0; t=t->next)
|
for(t = head; t != 0; t=t->next)
|
||||||
{
|
{
|
||||||
|
char *cat;
|
||||||
|
|
||||||
|
if (t->cat == priv)
|
||||||
|
cat = "private ";
|
||||||
|
else if (t->cat == pub)
|
||||||
|
cat = "public ";
|
||||||
|
else if (t->cat == data)
|
||||||
|
cat = "data-in-toc ";
|
||||||
|
|
||||||
|
if (t->offset > global_toc_size)
|
||||||
|
{
|
||||||
|
if (t->offset <= global_toc_size + thunk_size)
|
||||||
|
cat = "IAT reference ";
|
||||||
|
else
|
||||||
|
cat = "Out of bounds!";
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(file,
|
fprintf(file,
|
||||||
" %2x %04lx %s\n",
|
" %04lx (%d)", t->offset, t->offset - 32768);
|
||||||
t->offset - 32768, t->offset, t->name);
|
fprintf(file,
|
||||||
|
" %s %s\n",
|
||||||
|
cat, t->name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fprintf(file, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
@ -1764,7 +1841,7 @@ ppc_process_before_allocation (abfd, info)
|
||||||
asection *sec;
|
asection *sec;
|
||||||
struct internal_reloc *i, *rel;
|
struct internal_reloc *i, *rel;
|
||||||
|
|
||||||
#if 0
|
#if DEBUG_RELOC
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"ppc_process_before_allocation: BFD %s\n",
|
"ppc_process_before_allocation: BFD %s\n",
|
||||||
bfd_get_filename(abfd));
|
bfd_get_filename(abfd));
|
||||||
|
@ -1786,6 +1863,7 @@ ppc_process_before_allocation (abfd, info)
|
||||||
for (; sec != 0; sec = sec->next)
|
for (; sec != 0; sec = sec->next)
|
||||||
{
|
{
|
||||||
int toc_offset;
|
int toc_offset;
|
||||||
|
|
||||||
#ifdef DEBUG_RELOC
|
#ifdef DEBUG_RELOC
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
" section %s reloc count %d\n",
|
" section %s reloc count %d\n",
|
||||||
|
@ -1831,6 +1909,12 @@ ppc_process_before_allocation (abfd, info)
|
||||||
switch(r_type)
|
switch(r_type)
|
||||||
{
|
{
|
||||||
case IMAGE_REL_PPC_TOCREL16:
|
case IMAGE_REL_PPC_TOCREL16:
|
||||||
|
#if 0
|
||||||
|
/* FIXME:
|
||||||
|
This remains unimplemented for now, as it currently adds
|
||||||
|
un-necessary elements to the toc. All we need to do today
|
||||||
|
is not do anything if TOCDEFN is on.
|
||||||
|
*/
|
||||||
if ( r_flags & IMAGE_REL_PPC_TOCDEFN )
|
if ( r_flags & IMAGE_REL_PPC_TOCDEFN )
|
||||||
toc_offset = ppc_record_data_in_toc_entry(abfd, info, sec,
|
toc_offset = ppc_record_data_in_toc_entry(abfd, info, sec,
|
||||||
rel->r_symndx,
|
rel->r_symndx,
|
||||||
|
@ -1838,6 +1922,10 @@ ppc_process_before_allocation (abfd, info)
|
||||||
else
|
else
|
||||||
toc_offset = ppc_record_toc_entry(abfd, info, sec,
|
toc_offset = ppc_record_toc_entry(abfd, info, sec,
|
||||||
rel->r_symndx, default_toc);
|
rel->r_symndx, default_toc);
|
||||||
|
#endif
|
||||||
|
if ( (r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN )
|
||||||
|
toc_offset = ppc_record_toc_entry(abfd, info, sec,
|
||||||
|
rel->r_symndx, default_toc);
|
||||||
break;
|
break;
|
||||||
case IMAGE_REL_PPC_IMGLUE:
|
case IMAGE_REL_PPC_IMGLUE:
|
||||||
ppc_mark_symbol_as_glue(abfd, rel->r_symndx, rel);
|
ppc_mark_symbol_as_glue(abfd, rel->r_symndx, rel);
|
||||||
|
@ -2181,9 +2269,6 @@ coff_ppc_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
|
||||||
unsigned short r_flags = EXTRACT_FLAGS(rel->r_type);
|
unsigned short r_flags = EXTRACT_FLAGS(rel->r_type);
|
||||||
unsigned short junk = EXTRACT_JUNK (rel->r_type);
|
unsigned short junk = EXTRACT_JUNK (rel->r_type);
|
||||||
|
|
||||||
fprintf(stderr,
|
|
||||||
"coff_ppc_rtype_to_howto\n");
|
|
||||||
|
|
||||||
/* the masking process only slices off the bottom byte for r_type. */
|
/* the masking process only slices off the bottom byte for r_type. */
|
||||||
if ( r_type > MAX_RELOC_INDEX )
|
if ( r_type > MAX_RELOC_INDEX )
|
||||||
{
|
{
|
||||||
|
@ -2320,6 +2405,20 @@ ppc_coff_swap_sym_in_hook ();
|
||||||
|
|
||||||
|
|
||||||
#ifndef COFF_IMAGE_WITH_PE
|
#ifndef COFF_IMAGE_WITH_PE
|
||||||
|
/* FIXME:
|
||||||
|
What we're trying to do here is allocate a toc section (early), and attach
|
||||||
|
it to the last bfd to be processed. This avoids the problem of having a toc
|
||||||
|
written out before all files have been processed. This code allocates
|
||||||
|
a toc section for every file, and records the last one seen. There are
|
||||||
|
at least two problems with this approach:
|
||||||
|
1. We allocate whole bunches of toc sections that are ignored, but at
|
||||||
|
at least we will not allocate a toc if no .toc is present.
|
||||||
|
2. It's not clear to me that being the last bfd read necessarily means
|
||||||
|
that you are the last bfd closed.
|
||||||
|
3. Doing it on a "swap in" hook depends on when the "swap in" is called,
|
||||||
|
and how often, etc. It's not clear to me that there isn't a hole here.
|
||||||
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ppc_coff_swap_sym_in_hook (abfd, ext1, in1)
|
ppc_coff_swap_sym_in_hook (abfd, ext1, in1)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
|
|
|
@ -67,10 +67,7 @@ xcoff_mkobject (abfd)
|
||||||
((struct xcoff_tdata *)
|
((struct xcoff_tdata *)
|
||||||
bfd_zalloc (abfd, sizeof (struct xcoff_tdata)));
|
bfd_zalloc (abfd, sizeof (struct xcoff_tdata)));
|
||||||
if (abfd->tdata.xcoff_obj_data == NULL)
|
if (abfd->tdata.xcoff_obj_data == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
coff = coff_data (abfd);
|
coff = coff_data (abfd);
|
||||||
coff->symbols = (coff_symbol_type *) NULL;
|
coff->symbols = (coff_symbol_type *) NULL;
|
||||||
coff->conversion_table = (unsigned int *) NULL;
|
coff->conversion_table = (unsigned int *) NULL;
|
||||||
|
@ -709,10 +706,7 @@ xcoff_slurp_armap (abfd)
|
||||||
sz = strtol (hdr.size, (char **) NULL, 10);
|
sz = strtol (hdr.size, (char **) NULL, 10);
|
||||||
contents = (bfd_byte *) bfd_alloc (abfd, sz);
|
contents = (bfd_byte *) bfd_alloc (abfd, sz);
|
||||||
if (contents == NULL)
|
if (contents == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (bfd_read ((PTR) contents, 1, sz, abfd) != sz)
|
if (bfd_read ((PTR) contents, 1, sz, abfd) != sz)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -728,10 +722,7 @@ xcoff_slurp_armap (abfd)
|
||||||
bfd_ardata (abfd)->symdefs = ((carsym *)
|
bfd_ardata (abfd)->symdefs = ((carsym *)
|
||||||
bfd_alloc (abfd, c * sizeof (carsym)));
|
bfd_alloc (abfd, c * sizeof (carsym)));
|
||||||
if (bfd_ardata (abfd)->symdefs == NULL)
|
if (bfd_ardata (abfd)->symdefs == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* After the count comes a list of four byte file offsets. */
|
/* After the count comes a list of four byte file offsets. */
|
||||||
for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 4;
|
for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 4;
|
||||||
|
@ -788,10 +779,7 @@ xcoff_archive_p (abfd)
|
||||||
(struct artdata *) bfd_zalloc (abfd, sizeof (struct artdata));
|
(struct artdata *) bfd_zalloc (abfd, sizeof (struct artdata));
|
||||||
|
|
||||||
if (bfd_ardata (abfd) == (struct artdata *) NULL)
|
if (bfd_ardata (abfd) == (struct artdata *) NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bfd_ardata (abfd)->first_file_filepos = strtol (hdr.firstmemoff,
|
bfd_ardata (abfd)->first_file_filepos = strtol (hdr.firstmemoff,
|
||||||
(char **) NULL, 10);
|
(char **) NULL, 10);
|
||||||
|
@ -802,10 +790,7 @@ xcoff_archive_p (abfd)
|
||||||
|
|
||||||
bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, SIZEOF_AR_FILE_HDR);
|
bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, SIZEOF_AR_FILE_HDR);
|
||||||
if (bfd_ardata (abfd)->tdata == NULL)
|
if (bfd_ardata (abfd)->tdata == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy (bfd_ardata (abfd)->tdata, &hdr, SIZEOF_AR_FILE_HDR);
|
memcpy (bfd_ardata (abfd)->tdata, &hdr, SIZEOF_AR_FILE_HDR);
|
||||||
|
|
||||||
|
@ -836,10 +821,7 @@ xcoff_read_ar_hdr (abfd)
|
||||||
namlen = strtol (hdr.namlen, (char **) NULL, 10);
|
namlen = strtol (hdr.namlen, (char **) NULL, 10);
|
||||||
hdrp = bfd_alloc (abfd, SIZEOF_AR_HDR + namlen + 1);
|
hdrp = bfd_alloc (abfd, SIZEOF_AR_HDR + namlen + 1);
|
||||||
if (hdrp == NULL)
|
if (hdrp == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
memcpy (hdrp, &hdr, SIZEOF_AR_HDR);
|
memcpy (hdrp, &hdr, SIZEOF_AR_HDR);
|
||||||
if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR, 1, namlen, abfd) != namlen)
|
if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR, 1, namlen, abfd) != namlen)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -847,10 +829,7 @@ xcoff_read_ar_hdr (abfd)
|
||||||
|
|
||||||
ret = (struct areltdata *) bfd_alloc (abfd, sizeof (struct areltdata));
|
ret = (struct areltdata *) bfd_alloc (abfd, sizeof (struct areltdata));
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
ret->arch_header = (char *) hdrp;
|
ret->arch_header = (char *) hdrp;
|
||||||
ret->parsed_size = strtol (hdr.size, (char **) NULL, 10);
|
ret->parsed_size = strtol (hdr.size, (char **) NULL, 10);
|
||||||
ret->filename = (char *) hdrp + SIZEOF_AR_HDR;
|
ret->filename = (char *) hdrp + SIZEOF_AR_HDR;
|
||||||
|
@ -1062,10 +1041,7 @@ xcoff_write_archive_contents (abfd)
|
||||||
}
|
}
|
||||||
offsets = (file_ptr *) bfd_alloc (abfd, count * sizeof (file_ptr));
|
offsets = (file_ptr *) bfd_alloc (abfd, count * sizeof (file_ptr));
|
||||||
if (offsets == NULL)
|
if (offsets == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bfd_seek (abfd, SIZEOF_AR_FILE_HDR, SEEK_SET) != 0)
|
if (bfd_seek (abfd, SIZEOF_AR_FILE_HDR, SEEK_SET) != 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1118,10 +1094,7 @@ xcoff_write_archive_contents (abfd)
|
||||||
sub->arelt_data = ((struct areltdata *)
|
sub->arelt_data = ((struct areltdata *)
|
||||||
bfd_alloc (sub, sizeof (struct areltdata)));
|
bfd_alloc (sub, sizeof (struct areltdata)));
|
||||||
if (sub->arelt_data == NULL)
|
if (sub->arelt_data == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
arch_eltdata (sub)->parsed_size = s.st_size;
|
arch_eltdata (sub)->parsed_size = s.st_size;
|
||||||
|
@ -1282,6 +1255,26 @@ xcoff_write_archive_contents (abfd)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We can't use the usual coff_sizeof_headers routine, because AIX
|
||||||
|
always uses an a.out header. */
|
||||||
|
|
||||||
|
/*ARGSUSED*/
|
||||||
|
static int
|
||||||
|
_bfd_xcoff_sizeof_headers (abfd, reloc)
|
||||||
|
bfd *abfd;
|
||||||
|
boolean reloc;
|
||||||
|
{
|
||||||
|
int size;
|
||||||
|
|
||||||
|
size = FILHSZ;
|
||||||
|
if (xcoff_data (abfd)->full_aouthdr)
|
||||||
|
size += AOUTSZ;
|
||||||
|
else
|
||||||
|
size += SMALL_AOUTSZ;
|
||||||
|
size += abfd->section_count * SCNHSZ;
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
#define CORE_FILE_P _bfd_dummy_target
|
#define CORE_FILE_P _bfd_dummy_target
|
||||||
|
|
||||||
#define coff_core_file_failing_command _bfd_nocore_core_file_failing_command
|
#define coff_core_file_failing_command _bfd_nocore_core_file_failing_command
|
||||||
|
@ -1333,7 +1326,6 @@ extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd));
|
||||||
|
|
||||||
#endif /* LYNX_CORE */
|
#endif /* LYNX_CORE */
|
||||||
|
|
||||||
#define _bfd_xcoff_sizeof_headers coff_sizeof_headers
|
|
||||||
#define _bfd_xcoff_bfd_get_relocated_section_contents \
|
#define _bfd_xcoff_bfd_get_relocated_section_contents \
|
||||||
coff_bfd_get_relocated_section_contents
|
coff_bfd_get_relocated_section_contents
|
||||||
#define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section
|
#define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section
|
||||||
|
@ -1341,9 +1333,18 @@ extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd));
|
||||||
|
|
||||||
/* The transfer vector that leads the outside world to all of the above. */
|
/* The transfer vector that leads the outside world to all of the above. */
|
||||||
|
|
||||||
const bfd_target rs6000coff_vec =
|
const bfd_target
|
||||||
|
#ifdef TARGET_SYM
|
||||||
|
TARGET_SYM =
|
||||||
|
#else
|
||||||
|
rs6000coff_vec =
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifdef TARGET_NAME
|
||||||
|
TARGET_NAME,
|
||||||
|
#else
|
||||||
"aixcoff-rs6000", /* name */
|
"aixcoff-rs6000", /* name */
|
||||||
|
#endif
|
||||||
bfd_target_coff_flavour,
|
bfd_target_coff_flavour,
|
||||||
true, /* data byte order is big */
|
true, /* data byte order is big */
|
||||||
true, /* header byte order is big */
|
true, /* header byte order is big */
|
||||||
|
|
|
@ -626,10 +626,7 @@ sh_relax_section (abfd, sec, link_info, again)
|
||||||
sec->used_by_bfd =
|
sec->used_by_bfd =
|
||||||
((PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata)));
|
((PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata)));
|
||||||
if (sec->used_by_bfd == NULL)
|
if (sec->used_by_bfd == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
coff_section_data (abfd, sec)->relocs = internal_relocs;
|
coff_section_data (abfd, sec)->relocs = internal_relocs;
|
||||||
|
@ -749,10 +746,7 @@ sh_relax_section (abfd, sec, link_info, again)
|
||||||
sec->used_by_bfd =
|
sec->used_by_bfd =
|
||||||
((PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata)));
|
((PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata)));
|
||||||
if (sec->used_by_bfd == NULL)
|
if (sec->used_by_bfd == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
coff_section_data (abfd, sec)->relocs = NULL;
|
coff_section_data (abfd, sec)->relocs = NULL;
|
||||||
}
|
}
|
||||||
coff_section_data (abfd, sec)->contents = contents;
|
coff_section_data (abfd, sec)->contents = contents;
|
||||||
|
@ -1470,7 +1464,6 @@ const bfd_target shcoff_vec =
|
||||||
'_', /* leading symbol underscore */
|
'_', /* leading symbol underscore */
|
||||||
'/', /* ar_pad_char */
|
'/', /* ar_pad_char */
|
||||||
15, /* ar_max_namelen */
|
15, /* ar_max_namelen */
|
||||||
2, /* minimum section alignment */
|
|
||||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
||||||
|
@ -1513,7 +1506,6 @@ const bfd_target shlcoff_vec =
|
||||||
'_', /* leading symbol underscore */
|
'_', /* leading symbol underscore */
|
||||||
'/', /* ar_pad_char */
|
'/', /* ar_pad_char */
|
||||||
15, /* ar_max_namelen */
|
15, /* ar_max_namelen */
|
||||||
2, /* minimum section alignment */
|
|
||||||
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||||
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||||
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
||||||
|
@ -1521,11 +1513,8 @@ const bfd_target shlcoff_vec =
|
||||||
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||||
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
|
||||||
|
|
||||||
/* Note that we use a special archive recognizer.
|
|
||||||
This is so that we only use one archive format for both
|
|
||||||
object file types */
|
|
||||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||||
_bfd_dummy_target, _bfd_dummy_target},
|
bfd_generic_archive_p, _bfd_dummy_target},
|
||||||
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
|
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
|
||||||
bfd_false},
|
bfd_false},
|
||||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
||||||
|
|
|
@ -1019,10 +1019,7 @@ coff_mkobject (abfd)
|
||||||
|
|
||||||
abfd->tdata.coff_obj_data = (struct coff_tdata *) bfd_zalloc (abfd, sizeof (coff_data_type));
|
abfd->tdata.coff_obj_data = (struct coff_tdata *) bfd_zalloc (abfd, sizeof (coff_data_type));
|
||||||
if (abfd->tdata.coff_obj_data == 0)
|
if (abfd->tdata.coff_obj_data == 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
coff = coff_data (abfd);
|
coff = coff_data (abfd);
|
||||||
coff->symbols = (coff_symbol_type *) NULL;
|
coff->symbols = (coff_symbol_type *) NULL;
|
||||||
coff->conversion_table = (unsigned int *) NULL;
|
coff->conversion_table = (unsigned int *) NULL;
|
||||||
|
@ -2055,10 +2052,7 @@ coff_add_missing_symbols (abfd)
|
||||||
nsyms += need_text + need_data + need_bss + need_file;
|
nsyms += need_text + need_data + need_bss + need_file;
|
||||||
sympp2 = (asymbol **) bfd_alloc_by_size_t (abfd, nsyms * sizeof (asymbol *));
|
sympp2 = (asymbol **) bfd_alloc_by_size_t (abfd, nsyms * sizeof (asymbol *));
|
||||||
if (!sympp2)
|
if (!sympp2)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
memcpy (sympp2, sympp, i * sizeof (asymbol *));
|
memcpy (sympp2, sympp, i * sizeof (asymbol *));
|
||||||
if (need_file)
|
if (need_file)
|
||||||
{
|
{
|
||||||
|
@ -2717,10 +2711,7 @@ buy_and_read (abfd, where, seek_direction, size)
|
||||||
{
|
{
|
||||||
PTR area = (PTR) bfd_alloc (abfd, size);
|
PTR area = (PTR) bfd_alloc (abfd, size);
|
||||||
if (!area)
|
if (!area)
|
||||||
{
|
return (NULL);
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
if (bfd_seek (abfd, where, seek_direction) != 0
|
if (bfd_seek (abfd, where, seek_direction) != 0
|
||||||
|| bfd_read (area, 1, size, abfd) != size)
|
|| bfd_read (area, 1, size, abfd) != size)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
@ -2766,10 +2757,7 @@ coff_slurp_line_table (abfd, asect)
|
||||||
lineno_cache =
|
lineno_cache =
|
||||||
(alent *) bfd_alloc (abfd, (size_t) ((asect->lineno_count + 1) * sizeof (alent)));
|
(alent *) bfd_alloc (abfd, (size_t) ((asect->lineno_count + 1) * sizeof (alent)));
|
||||||
if (lineno_cache == NULL)
|
if (lineno_cache == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int counter = 0;
|
unsigned int counter = 0;
|
||||||
|
@ -2841,20 +2829,14 @@ coff_slurp_symbol_table (abfd)
|
||||||
* sizeof (coff_symbol_type))));
|
* sizeof (coff_symbol_type))));
|
||||||
|
|
||||||
if (cached_area == NULL)
|
if (cached_area == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
} /* on error */
|
|
||||||
table_ptr = ((unsigned int *)
|
table_ptr = ((unsigned int *)
|
||||||
bfd_alloc (abfd,
|
bfd_alloc (abfd,
|
||||||
(obj_raw_syment_count (abfd)
|
(obj_raw_syment_count (abfd)
|
||||||
* sizeof (unsigned int))));
|
* sizeof (unsigned int))));
|
||||||
|
|
||||||
if (table_ptr == NULL)
|
if (table_ptr == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
coff_symbol_type *dst = cached_area;
|
coff_symbol_type *dst = cached_area;
|
||||||
|
@ -3228,10 +3210,7 @@ coff_slurp_reloc_table (abfd, asect, symbols)
|
||||||
bfd_alloc (abfd, (size_t) (asect->reloc_count * sizeof (arelent)));
|
bfd_alloc (abfd, (size_t) (asect->reloc_count * sizeof (arelent)));
|
||||||
|
|
||||||
if (reloc_cache == NULL)
|
if (reloc_cache == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (idx = 0; idx < asect->reloc_count; idx++)
|
for (idx = 0; idx < asect->reloc_count; idx++)
|
||||||
|
|
|
@ -73,10 +73,7 @@ make_a_section_from_file (abfd, hdr, target_index)
|
||||||
/* Assorted wastage to null-terminate the name, thanks AT&T! */
|
/* Assorted wastage to null-terminate the name, thanks AT&T! */
|
||||||
name = bfd_alloc (abfd, sizeof (hdr->s_name) + 1);
|
name = bfd_alloc (abfd, sizeof (hdr->s_name) + 1);
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
strncpy (name, (char *) &hdr->s_name[0], sizeof (hdr->s_name));
|
strncpy (name, (char *) &hdr->s_name[0], sizeof (hdr->s_name));
|
||||||
name[sizeof (hdr->s_name)] = 0;
|
name[sizeof (hdr->s_name)] = 0;
|
||||||
|
|
||||||
|
@ -166,10 +163,7 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
|
||||||
readsize = nscns * scnhsz;
|
readsize = nscns * scnhsz;
|
||||||
external_sections = (char *) bfd_alloc (abfd, readsize);
|
external_sections = (char *) bfd_alloc (abfd, readsize);
|
||||||
if (!external_sections)
|
if (!external_sections)
|
||||||
{
|
goto fail;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bfd_read ((PTR) external_sections, 1, readsize, abfd) != readsize)
|
if (bfd_read ((PTR) external_sections, 1, readsize, abfd) != readsize)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -451,10 +445,7 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs,
|
||||||
(PTR) bfd_zalloc (abfd,
|
(PTR) bfd_zalloc (abfd,
|
||||||
sizeof (struct coff_section_tdata));
|
sizeof (struct coff_section_tdata));
|
||||||
if (sec->used_by_bfd == NULL)
|
if (sec->used_by_bfd == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
coff_section_data (abfd, sec)->contents = NULL;
|
coff_section_data (abfd, sec)->contents = NULL;
|
||||||
}
|
}
|
||||||
coff_section_data (abfd, sec)->relocs = free_internal;
|
coff_section_data (abfd, sec)->relocs = free_internal;
|
||||||
|
@ -626,10 +617,7 @@ coff_renumber_symbols (bfd_ptr, first_undef)
|
||||||
sizeof (asymbol *)
|
sizeof (asymbol *)
|
||||||
* (symbol_count + 1));
|
* (symbol_count + 1));
|
||||||
if (!newsyms)
|
if (!newsyms)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bfd_ptr->outsymbols = newsyms;
|
bfd_ptr->outsymbols = newsyms;
|
||||||
for (i = 0; i < symbol_count; i++)
|
for (i = 0; i < symbol_count; i++)
|
||||||
if ((symbol_ptr_ptr[i]->flags & BSF_NOT_AT_END) != 0
|
if ((symbol_ptr_ptr[i]->flags & BSF_NOT_AT_END) != 0
|
||||||
|
@ -913,10 +901,7 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p,
|
||||||
symesz = bfd_coff_symesz (abfd);
|
symesz = bfd_coff_symesz (abfd);
|
||||||
buf = bfd_alloc (abfd, symesz);
|
buf = bfd_alloc (abfd, symesz);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bfd_coff_swap_sym_out (abfd, &native->u.syment, buf);
|
bfd_coff_swap_sym_out (abfd, &native->u.syment, buf);
|
||||||
if (bfd_write (buf, 1, symesz, abfd) != symesz)
|
if (bfd_write (buf, 1, symesz, abfd) != symesz)
|
||||||
return false;
|
return false;
|
||||||
|
@ -930,10 +915,7 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p,
|
||||||
auxesz = bfd_coff_auxesz (abfd);
|
auxesz = bfd_coff_auxesz (abfd);
|
||||||
buf = bfd_alloc (abfd, auxesz);
|
buf = bfd_alloc (abfd, auxesz);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (j = 0; j < native->u.syment.n_numaux; j++)
|
for (j = 0; j < native->u.syment.n_numaux; j++)
|
||||||
{
|
{
|
||||||
bfd_coff_swap_aux_out (abfd,
|
bfd_coff_swap_aux_out (abfd,
|
||||||
|
@ -1242,10 +1224,7 @@ coff_write_linenumbers (abfd)
|
||||||
linesz = bfd_coff_linesz (abfd);
|
linesz = bfd_coff_linesz (abfd);
|
||||||
buff = bfd_alloc (abfd, linesz);
|
buff = bfd_alloc (abfd, linesz);
|
||||||
if (!buff)
|
if (!buff)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
|
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
|
||||||
{
|
{
|
||||||
if (s->lineno_count)
|
if (s->lineno_count)
|
||||||
|
@ -1416,10 +1395,7 @@ build_debug_section (abfd)
|
||||||
debug_section = (PTR) bfd_alloc (abfd,
|
debug_section = (PTR) bfd_alloc (abfd,
|
||||||
bfd_get_section_size_before_reloc (sect));
|
bfd_get_section_size_before_reloc (sect));
|
||||||
if (debug_section == NULL)
|
if (debug_section == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Seek to the beginning of the `.debug' section and read it.
|
/* Seek to the beginning of the `.debug' section and read it.
|
||||||
Save the current position first; it is needed by our caller.
|
Save the current position first; it is needed by our caller.
|
||||||
|
@ -1457,10 +1433,7 @@ copy_name (abfd, name, maxlen)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((newname = (PTR) bfd_alloc (abfd, len + 1)) == NULL)
|
if ((newname = (PTR) bfd_alloc (abfd, len + 1)) == NULL)
|
||||||
{
|
return (NULL);
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
strncpy (newname, name, len);
|
strncpy (newname, name, len);
|
||||||
newname[len] = '\0';
|
newname[len] = '\0';
|
||||||
return newname;
|
return newname;
|
||||||
|
@ -1617,10 +1590,7 @@ coff_get_normalized_symtab (abfd)
|
||||||
size = obj_raw_syment_count (abfd) * sizeof (combined_entry_type);
|
size = obj_raw_syment_count (abfd) * sizeof (combined_entry_type);
|
||||||
internal = (combined_entry_type *) bfd_alloc (abfd, size);
|
internal = (combined_entry_type *) bfd_alloc (abfd, size);
|
||||||
if (internal == NULL && size != 0)
|
if (internal == NULL && size != 0)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
internal_end = internal + obj_raw_syment_count (abfd);
|
internal_end = internal + obj_raw_syment_count (abfd);
|
||||||
|
|
||||||
if (! _bfd_coff_get_external_symbols (abfd))
|
if (! _bfd_coff_get_external_symbols (abfd))
|
||||||
|
@ -1726,10 +1696,7 @@ coff_get_normalized_symtab (abfd)
|
||||||
} /* possible lengths of this string. */
|
} /* possible lengths of this string. */
|
||||||
|
|
||||||
if ((newstring = (PTR) bfd_alloc (abfd, ++i)) == NULL)
|
if ((newstring = (PTR) bfd_alloc (abfd, ++i)) == NULL)
|
||||||
{
|
return (NULL);
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (NULL);
|
|
||||||
} /* on error */
|
|
||||||
memset (newstring, 0, i);
|
memset (newstring, 0, i);
|
||||||
strncpy (newstring, internal_ptr->u.syment._n._n_name, i - 1);
|
strncpy (newstring, internal_ptr->u.syment._n._n_name, i - 1);
|
||||||
internal_ptr->u.syment._n._n_n._n_offset = (long int) newstring;
|
internal_ptr->u.syment._n._n_n._n_offset = (long int) newstring;
|
||||||
|
@ -1790,10 +1757,7 @@ coff_make_empty_symbol (abfd)
|
||||||
{
|
{
|
||||||
coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, sizeof (coff_symbol_type));
|
coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, sizeof (coff_symbol_type));
|
||||||
if (new == NULL)
|
if (new == NULL)
|
||||||
{
|
return (NULL);
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (NULL);
|
|
||||||
} /* on error */
|
|
||||||
memset (new, 0, sizeof *new);
|
memset (new, 0, sizeof *new);
|
||||||
new->symbol.section = 0;
|
new->symbol.section = 0;
|
||||||
new->native = 0;
|
new->native = 0;
|
||||||
|
@ -1813,17 +1777,11 @@ coff_bfd_make_debug_symbol (abfd, ptr, sz)
|
||||||
{
|
{
|
||||||
coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, sizeof (coff_symbol_type));
|
coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, sizeof (coff_symbol_type));
|
||||||
if (new == NULL)
|
if (new == NULL)
|
||||||
{
|
return (NULL);
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (NULL);
|
|
||||||
} /* on error */
|
|
||||||
/* @@ This shouldn't be using a constant multiplier. */
|
/* @@ This shouldn't be using a constant multiplier. */
|
||||||
new->native = (combined_entry_type *) bfd_zalloc (abfd, sizeof (combined_entry_type) * 10);
|
new->native = (combined_entry_type *) bfd_zalloc (abfd, sizeof (combined_entry_type) * 10);
|
||||||
if (!new->native)
|
if (!new->native)
|
||||||
{
|
return (NULL);
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (NULL);
|
|
||||||
} /* on error */
|
|
||||||
new->symbol.section = bfd_abs_section_ptr;
|
new->symbol.section = bfd_abs_section_ptr;
|
||||||
new->symbol.flags = BSF_DEBUGGING;
|
new->symbol.flags = BSF_DEBUGGING;
|
||||||
new->lineno = (alent *) NULL;
|
new->lineno = (alent *) NULL;
|
||||||
|
|
|
@ -186,10 +186,7 @@ _bfd_coff_link_hash_newfunc (entry, table, string)
|
||||||
ret = ((struct coff_link_hash_entry *)
|
ret = ((struct coff_link_hash_entry *)
|
||||||
bfd_hash_allocate (table, sizeof (struct coff_link_hash_entry)));
|
bfd_hash_allocate (table, sizeof (struct coff_link_hash_entry)));
|
||||||
if (ret == (struct coff_link_hash_entry *) NULL)
|
if (ret == (struct coff_link_hash_entry *) NULL)
|
||||||
{
|
return (struct bfd_hash_entry *) ret;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (struct bfd_hash_entry *) ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Call the allocation method of the superclass. */
|
/* Call the allocation method of the superclass. */
|
||||||
ret = ((struct coff_link_hash_entry *)
|
ret = ((struct coff_link_hash_entry *)
|
||||||
|
@ -204,7 +201,6 @@ _bfd_coff_link_hash_newfunc (entry, table, string)
|
||||||
ret->numaux = 0;
|
ret->numaux = 0;
|
||||||
ret->auxbfd = NULL;
|
ret->auxbfd = NULL;
|
||||||
ret->aux = NULL;
|
ret->aux = NULL;
|
||||||
ret->toc_offset = 1; /* invalid toc address, sets the high bit */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (struct bfd_hash_entry *) ret;
|
return (struct bfd_hash_entry *) ret;
|
||||||
|
@ -234,10 +230,7 @@ _bfd_coff_link_hash_table_create (abfd)
|
||||||
ret = ((struct coff_link_hash_table *)
|
ret = ((struct coff_link_hash_table *)
|
||||||
bfd_alloc (abfd, sizeof (struct coff_link_hash_table)));
|
bfd_alloc (abfd, sizeof (struct coff_link_hash_table)));
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (! _bfd_coff_link_hash_table_init (ret, abfd,
|
if (! _bfd_coff_link_hash_table_init (ret, abfd,
|
||||||
_bfd_coff_link_hash_newfunc))
|
_bfd_coff_link_hash_newfunc))
|
||||||
{
|
{
|
||||||
|
@ -265,10 +258,7 @@ coff_debug_merge_hash_newfunc (entry, table, string)
|
||||||
bfd_hash_allocate (table,
|
bfd_hash_allocate (table,
|
||||||
sizeof (struct coff_debug_merge_hash_entry)));
|
sizeof (struct coff_debug_merge_hash_entry)));
|
||||||
if (ret == (struct coff_debug_merge_hash_entry *) NULL)
|
if (ret == (struct coff_debug_merge_hash_entry *) NULL)
|
||||||
{
|
return (struct bfd_hash_entry *) ret;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (struct bfd_hash_entry *) ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Call the allocation method of the superclass. */
|
/* Call the allocation method of the superclass. */
|
||||||
ret = ((struct coff_debug_merge_hash_entry *)
|
ret = ((struct coff_debug_merge_hash_entry *)
|
||||||
|
@ -450,10 +440,7 @@ coff_link_add_symbols (abfd, info)
|
||||||
((size_t) symcount
|
((size_t) symcount
|
||||||
* sizeof (struct coff_link_hash_entry *))));
|
* sizeof (struct coff_link_hash_entry *))));
|
||||||
if (sym_hash == NULL && symcount != 0)
|
if (sym_hash == NULL && symcount != 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
obj_coff_sym_hashes (abfd) = sym_hash;
|
obj_coff_sym_hashes (abfd) = sym_hash;
|
||||||
memset (sym_hash, 0,
|
memset (sym_hash, 0,
|
||||||
(size_t) symcount * sizeof (struct coff_link_hash_entry *));
|
(size_t) symcount * sizeof (struct coff_link_hash_entry *));
|
||||||
|
@ -531,7 +518,6 @@ coff_link_add_symbols (abfd, info)
|
||||||
(*sym_hash)->type = sym.n_type;
|
(*sym_hash)->type = sym.n_type;
|
||||||
(*sym_hash)->numaux = sym.n_numaux;
|
(*sym_hash)->numaux = sym.n_numaux;
|
||||||
(*sym_hash)->auxbfd = abfd;
|
(*sym_hash)->auxbfd = abfd;
|
||||||
(*sym_hash)->toc_offset = 1;
|
|
||||||
if (sym.n_numaux != 0)
|
if (sym.n_numaux != 0)
|
||||||
{
|
{
|
||||||
union internal_auxent *alloc;
|
union internal_auxent *alloc;
|
||||||
|
@ -544,10 +530,7 @@ coff_link_add_symbols (abfd, info)
|
||||||
(sym.n_numaux
|
(sym.n_numaux
|
||||||
* sizeof (*alloc))));
|
* sizeof (*alloc))));
|
||||||
if (alloc == NULL)
|
if (alloc == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (i = 0, eaux = esym + symesz, iaux = alloc;
|
for (i = 0, eaux = esym + symesz, iaux = alloc;
|
||||||
i < sym.n_numaux;
|
i < sym.n_numaux;
|
||||||
i++, eaux += symesz, iaux++)
|
i++, eaux += symesz, iaux++)
|
||||||
|
@ -974,25 +957,28 @@ _bfd_coff_final_link (abfd, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write out the string table. */
|
/* Write out the string table. */
|
||||||
if (bfd_seek (abfd,
|
if (obj_raw_syment_count (abfd) != 0)
|
||||||
(obj_sym_filepos (abfd)
|
{
|
||||||
+ obj_raw_syment_count (abfd) * symesz),
|
if (bfd_seek (abfd,
|
||||||
SEEK_SET) != 0)
|
(obj_sym_filepos (abfd)
|
||||||
return false;
|
+ obj_raw_syment_count (abfd) * symesz),
|
||||||
|
SEEK_SET) != 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
#if STRING_SIZE_SIZE == 4
|
#if STRING_SIZE_SIZE == 4
|
||||||
bfd_h_put_32 (abfd,
|
bfd_h_put_32 (abfd,
|
||||||
_bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE,
|
_bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE,
|
||||||
(bfd_byte *) strbuf);
|
(bfd_byte *) strbuf);
|
||||||
#else
|
#else
|
||||||
#error Change bfd_h_put_32
|
#error Change bfd_h_put_32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (bfd_write (strbuf, 1, STRING_SIZE_SIZE, abfd) != STRING_SIZE_SIZE)
|
if (bfd_write (strbuf, 1, STRING_SIZE_SIZE, abfd) != STRING_SIZE_SIZE)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (! _bfd_stringtab_emit (abfd, finfo.strtab))
|
if (! _bfd_stringtab_emit (abfd, finfo.strtab))
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
_bfd_stringtab_free (finfo.strtab);
|
_bfd_stringtab_free (finfo.strtab);
|
||||||
|
|
||||||
|
@ -1373,10 +1359,7 @@ coff_link_input_bfd (finfo, input_bfd)
|
||||||
bfd_alloc (input_bfd,
|
bfd_alloc (input_bfd,
|
||||||
sizeof (struct coff_debug_merge_type)));
|
sizeof (struct coff_debug_merge_type)));
|
||||||
if (mt == NULL)
|
if (mt == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
mt->class = isym.n_sclass;
|
mt->class = isym.n_sclass;
|
||||||
|
|
||||||
/* Pick up the aux entry, which points to the end of the tag
|
/* Pick up the aux entry, which points to the end of the tag
|
||||||
|
@ -1404,10 +1387,7 @@ coff_link_input_bfd (finfo, input_bfd)
|
||||||
bfd_alloc (input_bfd,
|
bfd_alloc (input_bfd,
|
||||||
sizeof (struct coff_debug_merge_element)));
|
sizeof (struct coff_debug_merge_element)));
|
||||||
if (*epp == NULL)
|
if (*epp == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
elename = _bfd_coff_internal_syment_name (input_bfd, islp,
|
elename = _bfd_coff_internal_syment_name (input_bfd, islp,
|
||||||
elebuf);
|
elebuf);
|
||||||
|
@ -1416,10 +1396,7 @@ coff_link_input_bfd (finfo, input_bfd)
|
||||||
|
|
||||||
copy = (char *) bfd_alloc (input_bfd, strlen (elename) + 1);
|
copy = (char *) bfd_alloc (input_bfd, strlen (elename) + 1);
|
||||||
if (copy == NULL)
|
if (copy == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
strcpy (copy, elename);
|
strcpy (copy, elename);
|
||||||
|
|
||||||
(*epp)->name = copy;
|
(*epp)->name = copy;
|
||||||
|
@ -2227,10 +2204,7 @@ coff_reloc_link_order (output_bfd, finfo, output_section, link_order)
|
||||||
size = bfd_get_reloc_size (howto);
|
size = bfd_get_reloc_size (howto);
|
||||||
buf = (bfd_byte *) bfd_zmalloc (size);
|
buf = (bfd_byte *) bfd_zmalloc (size);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
rstat = _bfd_relocate_contents (howto, output_bfd,
|
rstat = _bfd_relocate_contents (howto, output_bfd,
|
||||||
link_order->u.reloc.p->addend, buf);
|
link_order->u.reloc.p->addend, buf);
|
||||||
|
|
90
bfd/ecoff.c
90
bfd/ecoff.c
|
@ -82,10 +82,7 @@ _bfd_ecoff_mkobject (abfd)
|
||||||
abfd->tdata.ecoff_obj_data = ((struct ecoff_tdata *)
|
abfd->tdata.ecoff_obj_data = ((struct ecoff_tdata *)
|
||||||
bfd_zalloc (abfd, sizeof (ecoff_data_type)));
|
bfd_zalloc (abfd, sizeof (ecoff_data_type)));
|
||||||
if (abfd->tdata.ecoff_obj_data == NULL)
|
if (abfd->tdata.ecoff_obj_data == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -580,10 +577,7 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
|
||||||
}
|
}
|
||||||
raw = (PTR) bfd_alloc (abfd, raw_size);
|
raw = (PTR) bfd_alloc (abfd, raw_size);
|
||||||
if (raw == NULL)
|
if (raw == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (bfd_seek (abfd,
|
if (bfd_seek (abfd,
|
||||||
(ecoff_data (abfd)->sym_filepos
|
(ecoff_data (abfd)->sym_filepos
|
||||||
+ backend->debug_swap.external_hdr_size),
|
+ backend->debug_swap.external_hdr_size),
|
||||||
|
@ -629,10 +623,7 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
|
||||||
(internal_symhdr->ifdMax *
|
(internal_symhdr->ifdMax *
|
||||||
sizeof (struct fdr)));
|
sizeof (struct fdr)));
|
||||||
if (debug->fdr == NULL)
|
if (debug->fdr == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
external_fdr_size = backend->debug_swap.external_fdr_size;
|
external_fdr_size = backend->debug_swap.external_fdr_size;
|
||||||
fdr_ptr = debug->fdr;
|
fdr_ptr = debug->fdr;
|
||||||
fraw_src = (char *) debug->external_fdr;
|
fraw_src = (char *) debug->external_fdr;
|
||||||
|
@ -665,10 +656,7 @@ _bfd_ecoff_make_empty_symbol (abfd)
|
||||||
|
|
||||||
new = (ecoff_symbol_type *) bfd_alloc (abfd, sizeof (ecoff_symbol_type));
|
new = (ecoff_symbol_type *) bfd_alloc (abfd, sizeof (ecoff_symbol_type));
|
||||||
if (new == (ecoff_symbol_type *) NULL)
|
if (new == (ecoff_symbol_type *) NULL)
|
||||||
{
|
return (asymbol *) NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (asymbol *) NULL;
|
|
||||||
}
|
|
||||||
memset ((PTR) new, 0, sizeof *new);
|
memset ((PTR) new, 0, sizeof *new);
|
||||||
new->symbol.section = (asection *) NULL;
|
new->symbol.section = (asection *) NULL;
|
||||||
new->fdr = (FDR *) NULL;
|
new->fdr = (FDR *) NULL;
|
||||||
|
@ -882,10 +870,7 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
|
||||||
|
|
||||||
copy = (char *) bfd_alloc (abfd, strlen (name) + 1);
|
copy = (char *) bfd_alloc (abfd, strlen (name) + 1);
|
||||||
if (!copy)
|
if (!copy)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
strcpy (copy, name);
|
strcpy (copy, name);
|
||||||
section = bfd_make_section (abfd, copy);
|
section = bfd_make_section (abfd, copy);
|
||||||
}
|
}
|
||||||
|
@ -894,10 +879,7 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
|
||||||
reloc_chain =
|
reloc_chain =
|
||||||
(arelent_chain *) bfd_alloc (abfd, sizeof (arelent_chain));
|
(arelent_chain *) bfd_alloc (abfd, sizeof (arelent_chain));
|
||||||
if (!reloc_chain)
|
if (!reloc_chain)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
reloc_chain->relent.sym_ptr_ptr =
|
reloc_chain->relent.sym_ptr_ptr =
|
||||||
bfd_get_section (asym)->symbol_ptr_ptr;
|
bfd_get_section (asym)->symbol_ptr_ptr;
|
||||||
reloc_chain->relent.address = section->_raw_size;
|
reloc_chain->relent.address = section->_raw_size;
|
||||||
|
@ -968,10 +950,7 @@ _bfd_ecoff_slurp_symbol_table (abfd)
|
||||||
internal_size = bfd_get_symcount (abfd) * sizeof (ecoff_symbol_type);
|
internal_size = bfd_get_symcount (abfd) * sizeof (ecoff_symbol_type);
|
||||||
internal = (ecoff_symbol_type *) bfd_alloc (abfd, internal_size);
|
internal = (ecoff_symbol_type *) bfd_alloc (abfd, internal_size);
|
||||||
if (internal == NULL)
|
if (internal == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal_ptr = internal;
|
internal_ptr = internal;
|
||||||
eraw_src = (char *) ecoff_data (abfd)->debug_info.external_ext;
|
eraw_src = (char *) ecoff_data (abfd)->debug_info.external_ext;
|
||||||
|
@ -1697,10 +1676,7 @@ ecoff_slurp_reloc_table (abfd, section, symbols)
|
||||||
external_relocs = (char *) bfd_alloc (abfd, external_relocs_size);
|
external_relocs = (char *) bfd_alloc (abfd, external_relocs_size);
|
||||||
if (internal_relocs == (arelent *) NULL
|
if (internal_relocs == (arelent *) NULL
|
||||||
|| external_relocs == (char *) NULL)
|
|| external_relocs == (char *) NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (bfd_seek (abfd, section->rel_filepos, SEEK_SET) != 0)
|
if (bfd_seek (abfd, section->rel_filepos, SEEK_SET) != 0)
|
||||||
return false;
|
return false;
|
||||||
if (bfd_read (external_relocs, 1, external_relocs_size, abfd)
|
if (bfd_read (external_relocs, 1, external_relocs_size, abfd)
|
||||||
|
@ -1857,10 +1833,7 @@ _bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset,
|
||||||
((struct ecoff_find_line *)
|
((struct ecoff_find_line *)
|
||||||
bfd_alloc (abfd, sizeof (struct ecoff_find_line)));
|
bfd_alloc (abfd, sizeof (struct ecoff_find_line)));
|
||||||
if (ecoff_data (abfd)->find_line_info == NULL)
|
if (ecoff_data (abfd)->find_line_info == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ecoff_data (abfd)->find_line_info->find_buffer = NULL;
|
ecoff_data (abfd)->find_line_info->find_buffer = NULL;
|
||||||
ecoff_data (abfd)->find_line_info->fdrtab_len = 0;
|
ecoff_data (abfd)->find_line_info->fdrtab_len = 0;
|
||||||
ecoff_data (abfd)->find_line_info->fdrtab = NULL;
|
ecoff_data (abfd)->find_line_info->fdrtab = NULL;
|
||||||
|
@ -2759,10 +2732,7 @@ _bfd_ecoff_write_object_contents (abfd)
|
||||||
reloc_buff =
|
reloc_buff =
|
||||||
bfd_alloc (abfd, current->reloc_count * external_reloc_size);
|
bfd_alloc (abfd, current->reloc_count * external_reloc_size);
|
||||||
if (reloc_buff == NULL)
|
if (reloc_buff == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
|
|
||||||
reloc_ptr_ptr = current->orelocation;
|
reloc_ptr_ptr = current->orelocation;
|
||||||
reloc_end = reloc_ptr_ptr + current->reloc_count;
|
reloc_end = reloc_ptr_ptr + current->reloc_count;
|
||||||
|
@ -3027,10 +2997,7 @@ _bfd_ecoff_slurp_armap (abfd)
|
||||||
|
|
||||||
raw_armap = (char *) bfd_alloc (abfd, parsed_size);
|
raw_armap = (char *) bfd_alloc (abfd, parsed_size);
|
||||||
if (raw_armap == (char *) NULL)
|
if (raw_armap == (char *) NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bfd_read ((PTR) raw_armap, 1, parsed_size, abfd) != parsed_size)
|
if (bfd_read ((PTR) raw_armap, 1, parsed_size, abfd) != parsed_size)
|
||||||
{
|
{
|
||||||
|
@ -3099,10 +3066,7 @@ _bfd_ecoff_slurp_armap (abfd)
|
||||||
bfd_alloc (abfd,
|
bfd_alloc (abfd,
|
||||||
ardata->symdef_count * sizeof (struct symdef)));
|
ardata->symdef_count * sizeof (struct symdef)));
|
||||||
if (!symdef_ptr)
|
if (!symdef_ptr)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ardata->symdefs = (carsym *) symdef_ptr;
|
ardata->symdefs = (carsym *) symdef_ptr;
|
||||||
|
|
||||||
|
@ -3216,10 +3180,7 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
|
||||||
|
|
||||||
hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize);
|
hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize);
|
||||||
if (!hashtable)
|
if (!hashtable)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
current = abfd->archive_head;
|
current = abfd->archive_head;
|
||||||
last_elt = current;
|
last_elt = current;
|
||||||
|
@ -3318,10 +3279,7 @@ _bfd_ecoff_archive_p (abfd)
|
||||||
(struct artdata *) bfd_zalloc (abfd, sizeof (struct artdata));
|
(struct artdata *) bfd_zalloc (abfd, sizeof (struct artdata));
|
||||||
|
|
||||||
if (bfd_ardata (abfd) == (struct artdata *) NULL)
|
if (bfd_ardata (abfd) == (struct artdata *) NULL)
|
||||||
{
|
return (const bfd_target *) NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (const bfd_target *) NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bfd_ardata (abfd)->first_file_filepos = SARMAG;
|
bfd_ardata (abfd)->first_file_filepos = SARMAG;
|
||||||
bfd_ardata (abfd)->cache = NULL;
|
bfd_ardata (abfd)->cache = NULL;
|
||||||
|
@ -3372,10 +3330,7 @@ ecoff_link_hash_newfunc (entry, table, string)
|
||||||
ret = ((struct ecoff_link_hash_entry *)
|
ret = ((struct ecoff_link_hash_entry *)
|
||||||
bfd_hash_allocate (table, sizeof (struct ecoff_link_hash_entry)));
|
bfd_hash_allocate (table, sizeof (struct ecoff_link_hash_entry)));
|
||||||
if (ret == (struct ecoff_link_hash_entry *) NULL)
|
if (ret == (struct ecoff_link_hash_entry *) NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Call the allocation method of the superclass. */
|
/* Call the allocation method of the superclass. */
|
||||||
ret = ((struct ecoff_link_hash_entry *)
|
ret = ((struct ecoff_link_hash_entry *)
|
||||||
|
@ -3406,10 +3361,7 @@ _bfd_ecoff_bfd_link_hash_table_create (abfd)
|
||||||
ret = ((struct ecoff_link_hash_table *)
|
ret = ((struct ecoff_link_hash_table *)
|
||||||
bfd_alloc (abfd, sizeof (struct ecoff_link_hash_table)));
|
bfd_alloc (abfd, sizeof (struct ecoff_link_hash_table)));
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (! _bfd_link_hash_table_init (&ret->root, abfd,
|
if (! _bfd_link_hash_table_init (&ret->root, abfd,
|
||||||
ecoff_link_hash_newfunc))
|
ecoff_link_hash_newfunc))
|
||||||
{
|
{
|
||||||
|
@ -3839,10 +3791,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
|
||||||
bfd_alloc (abfd,
|
bfd_alloc (abfd,
|
||||||
ext_count * sizeof (struct bfd_link_hash_entry *)));
|
ext_count * sizeof (struct bfd_link_hash_entry *)));
|
||||||
if (!sym_hash)
|
if (!sym_hash)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ecoff_data (abfd)->sym_hashes = sym_hash;
|
ecoff_data (abfd)->sym_hashes = sym_hash;
|
||||||
|
|
||||||
ext_ptr = (char *) external_ext;
|
ext_ptr = (char *) external_ext;
|
||||||
|
@ -4677,10 +4626,7 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
|
||||||
size = bfd_get_reloc_size (rel.howto);
|
size = bfd_get_reloc_size (rel.howto);
|
||||||
buf = (bfd_byte *) bfd_zmalloc (size);
|
buf = (bfd_byte *) bfd_zmalloc (size);
|
||||||
if (buf == (bfd_byte *) NULL)
|
if (buf == (bfd_byte *) NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
rstat = _bfd_relocate_contents (rel.howto, output_bfd, addend, buf);
|
rstat = _bfd_relocate_contents (rel.howto, output_bfd, addend, buf);
|
||||||
switch (rstat)
|
switch (rstat)
|
||||||
{
|
{
|
||||||
|
|
|
@ -318,10 +318,7 @@ string_hash_newfunc (entry, table, string)
|
||||||
ret = ((struct string_hash_entry *)
|
ret = ((struct string_hash_entry *)
|
||||||
bfd_hash_allocate (table, sizeof (struct string_hash_entry)));
|
bfd_hash_allocate (table, sizeof (struct string_hash_entry)));
|
||||||
if (ret == (struct string_hash_entry *) NULL)
|
if (ret == (struct string_hash_entry *) NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Call the allocation method of the superclass. */
|
/* Call the allocation method of the superclass. */
|
||||||
ret = ((struct string_hash_entry *)
|
ret = ((struct string_hash_entry *)
|
||||||
|
@ -1226,10 +1223,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
|
||||||
return false;
|
return false;
|
||||||
symbols = (asymbol **) bfd_alloc (output_bfd, symsize);
|
symbols = (asymbol **) bfd_alloc (output_bfd, symsize);
|
||||||
if (symbols == (asymbol **) NULL)
|
if (symbols == (asymbol **) NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
symcount = bfd_canonicalize_symtab (input_bfd, symbols);
|
symcount = bfd_canonicalize_symtab (input_bfd, symbols);
|
||||||
if (symcount < 0)
|
if (symcount < 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1880,10 +1874,7 @@ mk_fdrtab (abfd, debug_info, debug_swap, line_info)
|
||||||
bfd_zalloc (abfd,
|
bfd_zalloc (abfd,
|
||||||
len * sizeof (struct ecoff_fdrtab_entry)));
|
len * sizeof (struct ecoff_fdrtab_entry)));
|
||||||
if (line_info->fdrtab == NULL)
|
if (line_info->fdrtab == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
line_info->fdrtab_len = len;
|
line_info->fdrtab_len = len;
|
||||||
|
|
||||||
tab = line_info->fdrtab;
|
tab = line_info->fdrtab;
|
||||||
|
|
92
bfd/elf.c
92
bfd/elf.c
|
@ -83,10 +83,7 @@ elf_read (abfd, offset, size)
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
if ((buf = bfd_alloc (abfd, size)) == NULL)
|
if ((buf = bfd_alloc (abfd, size)) == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (bfd_seek (abfd, offset, SEEK_SET) == -1)
|
if (bfd_seek (abfd, offset, SEEK_SET) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (bfd_read ((PTR) buf, size, 1, abfd) != size)
|
if (bfd_read ((PTR) buf, size, 1, abfd) != size)
|
||||||
|
@ -107,10 +104,7 @@ elf_mkobject (abfd)
|
||||||
elf_tdata (abfd) = (struct elf_obj_tdata *)
|
elf_tdata (abfd) = (struct elf_obj_tdata *)
|
||||||
bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
|
bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
|
||||||
if (elf_tdata (abfd) == 0)
|
if (elf_tdata (abfd) == 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
/* since everything is done at close time, do we need any
|
/* since everything is done at close time, do we need any
|
||||||
initialization? */
|
initialization? */
|
||||||
|
|
||||||
|
@ -441,10 +435,7 @@ _bfd_elf_link_hash_newfunc (entry, table, string)
|
||||||
ret = ((struct elf_link_hash_entry *)
|
ret = ((struct elf_link_hash_entry *)
|
||||||
bfd_hash_allocate (table, sizeof (struct elf_link_hash_entry)));
|
bfd_hash_allocate (table, sizeof (struct elf_link_hash_entry)));
|
||||||
if (ret == (struct elf_link_hash_entry *) NULL)
|
if (ret == (struct elf_link_hash_entry *) NULL)
|
||||||
{
|
return (struct bfd_hash_entry *) ret;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (struct bfd_hash_entry *) ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Call the allocation method of the superclass. */
|
/* Call the allocation method of the superclass. */
|
||||||
ret = ((struct elf_link_hash_entry *)
|
ret = ((struct elf_link_hash_entry *)
|
||||||
|
@ -498,10 +489,7 @@ _bfd_elf_link_hash_table_create (abfd)
|
||||||
ret = ((struct elf_link_hash_table *)
|
ret = ((struct elf_link_hash_table *)
|
||||||
bfd_alloc (abfd, sizeof (struct elf_link_hash_table)));
|
bfd_alloc (abfd, sizeof (struct elf_link_hash_table)));
|
||||||
if (ret == (struct elf_link_hash_table *) NULL)
|
if (ret == (struct elf_link_hash_table *) NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! _bfd_elf_link_hash_table_init (ret, abfd, _bfd_elf_link_hash_newfunc))
|
if (! _bfd_elf_link_hash_table_init (ret, abfd, _bfd_elf_link_hash_newfunc))
|
||||||
{
|
{
|
||||||
|
@ -804,10 +792,7 @@ _bfd_elf_new_section_hook (abfd, sec)
|
||||||
|
|
||||||
sdata = (struct bfd_elf_section_data *) bfd_alloc (abfd, sizeof (*sdata));
|
sdata = (struct bfd_elf_section_data *) bfd_alloc (abfd, sizeof (*sdata));
|
||||||
if (!sdata)
|
if (!sdata)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
sec->used_by_bfd = (PTR) sdata;
|
sec->used_by_bfd = (PTR) sdata;
|
||||||
memset (sdata, 0, sizeof (*sdata));
|
memset (sdata, 0, sizeof (*sdata));
|
||||||
return true;
|
return true;
|
||||||
|
@ -852,10 +837,7 @@ bfd_section_from_phdr (abfd, hdr, index)
|
||||||
sprintf (namebuf, split ? "segment%da" : "segment%d", index);
|
sprintf (namebuf, split ? "segment%da" : "segment%d", index);
|
||||||
name = bfd_alloc (abfd, strlen (namebuf) + 1);
|
name = bfd_alloc (abfd, strlen (namebuf) + 1);
|
||||||
if (!name)
|
if (!name)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
strcpy (name, namebuf);
|
strcpy (name, namebuf);
|
||||||
newsect = bfd_make_section (abfd, name);
|
newsect = bfd_make_section (abfd, name);
|
||||||
if (newsect == NULL)
|
if (newsect == NULL)
|
||||||
|
@ -886,10 +868,7 @@ bfd_section_from_phdr (abfd, hdr, index)
|
||||||
sprintf (namebuf, "segment%db", index);
|
sprintf (namebuf, "segment%db", index);
|
||||||
name = bfd_alloc (abfd, strlen (namebuf) + 1);
|
name = bfd_alloc (abfd, strlen (namebuf) + 1);
|
||||||
if (!name)
|
if (!name)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
strcpy (name, namebuf);
|
strcpy (name, namebuf);
|
||||||
newsect = bfd_make_section (abfd, name);
|
newsect = bfd_make_section (abfd, name);
|
||||||
if (newsect == NULL)
|
if (newsect == NULL)
|
||||||
|
@ -1032,7 +1011,6 @@ elf_fake_sections (abfd, asect, failedptrarg)
|
||||||
name = bfd_alloc (abfd, sizeof ".rela" + strlen (asect->name));
|
name = bfd_alloc (abfd, sizeof ".rela" + strlen (asect->name));
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
*failedptr = true;
|
*failedptr = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1101,17 +1079,13 @@ assign_section_numbers (abfd)
|
||||||
i_shdrp = ((Elf_Internal_Shdr **)
|
i_shdrp = ((Elf_Internal_Shdr **)
|
||||||
bfd_alloc (abfd, section_number * sizeof (Elf_Internal_Shdr *)));
|
bfd_alloc (abfd, section_number * sizeof (Elf_Internal_Shdr *)));
|
||||||
if (i_shdrp == NULL)
|
if (i_shdrp == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
i_shdrp[0] = ((Elf_Internal_Shdr *)
|
i_shdrp[0] = ((Elf_Internal_Shdr *)
|
||||||
bfd_alloc (abfd, sizeof (Elf_Internal_Shdr)));
|
bfd_alloc (abfd, sizeof (Elf_Internal_Shdr)));
|
||||||
if (i_shdrp[0] == NULL)
|
if (i_shdrp[0] == NULL)
|
||||||
{
|
{
|
||||||
bfd_release (abfd, i_shdrp);
|
bfd_release (abfd, i_shdrp);
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
memset (i_shdrp[0], 0, sizeof (Elf_Internal_Shdr));
|
memset (i_shdrp[0], 0, sizeof (Elf_Internal_Shdr));
|
||||||
|
@ -1277,10 +1251,7 @@ elf_map_symbols (abfd)
|
||||||
max_index++;
|
max_index++;
|
||||||
sect_syms = (asymbol **) bfd_zalloc (abfd, max_index * sizeof (asymbol *));
|
sect_syms = (asymbol **) bfd_zalloc (abfd, max_index * sizeof (asymbol *));
|
||||||
if (sect_syms == NULL)
|
if (sect_syms == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
elf_section_syms (abfd) = sect_syms;
|
elf_section_syms (abfd) = sect_syms;
|
||||||
|
|
||||||
for (idx = 0; idx < symcount; idx++)
|
for (idx = 0; idx < symcount; idx++)
|
||||||
|
@ -1357,10 +1328,7 @@ elf_map_symbols (abfd)
|
||||||
bfd_alloc (abfd,
|
bfd_alloc (abfd,
|
||||||
(num_locals + num_globals) * sizeof (asymbol *)));
|
(num_locals + num_globals) * sizeof (asymbol *)));
|
||||||
if (new_syms == NULL)
|
if (new_syms == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (idx = 0; idx < symcount; idx++)
|
for (idx = 0; idx < symcount; idx++)
|
||||||
{
|
{
|
||||||
|
@ -1536,10 +1504,7 @@ make_mapping (abfd, sections, from, to)
|
||||||
(sizeof (struct elf_segment_map)
|
(sizeof (struct elf_segment_map)
|
||||||
+ (to - from - 1) * sizeof (asection *))));
|
+ (to - from - 1) * sizeof (asection *))));
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
m->next = NULL;
|
m->next = NULL;
|
||||||
m->p_type = PT_LOAD;
|
m->p_type = PT_LOAD;
|
||||||
for (i = from, hdrpp = sections + from; i < to; i++, hdrpp++)
|
for (i = from, hdrpp = sections + from; i < to; i++, hdrpp++)
|
||||||
|
@ -1611,10 +1576,7 @@ map_sections_to_segments (abfd)
|
||||||
m = ((struct elf_segment_map *)
|
m = ((struct elf_segment_map *)
|
||||||
bfd_zalloc (abfd, sizeof (struct elf_segment_map)));
|
bfd_zalloc (abfd, sizeof (struct elf_segment_map)));
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
m->next = NULL;
|
m->next = NULL;
|
||||||
m->p_type = PT_PHDR;
|
m->p_type = PT_PHDR;
|
||||||
/* FIXME: UnixWare and Solaris set PF_X, Irix 5 does not. */
|
/* FIXME: UnixWare and Solaris set PF_X, Irix 5 does not. */
|
||||||
|
@ -1627,10 +1589,7 @@ map_sections_to_segments (abfd)
|
||||||
m = ((struct elf_segment_map *)
|
m = ((struct elf_segment_map *)
|
||||||
bfd_zalloc (abfd, sizeof (struct elf_segment_map)));
|
bfd_zalloc (abfd, sizeof (struct elf_segment_map)));
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
m->next = NULL;
|
m->next = NULL;
|
||||||
m->p_type = PT_INTERP;
|
m->p_type = PT_INTERP;
|
||||||
m->count = 1;
|
m->count = 1;
|
||||||
|
@ -1697,10 +1656,7 @@ map_sections_to_segments (abfd)
|
||||||
m = ((struct elf_segment_map *)
|
m = ((struct elf_segment_map *)
|
||||||
bfd_zalloc (abfd, sizeof (struct elf_segment_map)));
|
bfd_zalloc (abfd, sizeof (struct elf_segment_map)));
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
m->next = NULL;
|
m->next = NULL;
|
||||||
m->p_type = PT_DYNAMIC;
|
m->p_type = PT_DYNAMIC;
|
||||||
m->count = 1;
|
m->count = 1;
|
||||||
|
@ -1821,10 +1777,7 @@ assign_file_positions_for_segments (abfd)
|
||||||
phdrs = ((Elf_Internal_Phdr *)
|
phdrs = ((Elf_Internal_Phdr *)
|
||||||
bfd_alloc (abfd, alloc * sizeof (Elf_Internal_Phdr)));
|
bfd_alloc (abfd, alloc * sizeof (Elf_Internal_Phdr)));
|
||||||
if (phdrs == NULL)
|
if (phdrs == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
off = bed->s->sizeof_ehdr;
|
off = bed->s->sizeof_ehdr;
|
||||||
off += alloc * bed->s->sizeof_phdr;
|
off += alloc * bed->s->sizeof_phdr;
|
||||||
|
@ -2503,10 +2456,7 @@ copy_private_bfd_data (ibfd, obfd)
|
||||||
(sizeof (struct elf_segment_map)
|
(sizeof (struct elf_segment_map)
|
||||||
+ (csecs - 1) * sizeof (asection *))));
|
+ (csecs - 1) * sizeof (asection *))));
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m->next = NULL;
|
m->next = NULL;
|
||||||
m->p_type = p->p_type;
|
m->p_type = p->p_type;
|
||||||
|
@ -2678,10 +2628,7 @@ swap_out_syms (abfd, sttp)
|
||||||
outbound_syms = bfd_alloc (abfd,
|
outbound_syms = bfd_alloc (abfd,
|
||||||
(1 + symcount) * bed->s->sizeof_sym);
|
(1 + symcount) * bed->s->sizeof_sym);
|
||||||
if (outbound_syms == NULL)
|
if (outbound_syms == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
symtab_hdr->contents = (PTR) outbound_syms;
|
symtab_hdr->contents = (PTR) outbound_syms;
|
||||||
|
|
||||||
/* now generate the data (for "contents") */
|
/* now generate the data (for "contents") */
|
||||||
|
@ -2948,10 +2895,7 @@ _bfd_elf_make_empty_symbol (abfd)
|
||||||
|
|
||||||
newsym = (elf_symbol_type *) bfd_zalloc (abfd, sizeof (elf_symbol_type));
|
newsym = (elf_symbol_type *) bfd_zalloc (abfd, sizeof (elf_symbol_type));
|
||||||
if (!newsym)
|
if (!newsym)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newsym->symbol.the_bfd = abfd;
|
newsym->symbol.the_bfd = abfd;
|
||||||
|
|
|
@ -21,14 +21,14 @@ GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
#include "bfdlink.h"
|
#include "bfdlink.h"
|
||||||
#include "libbfd.h"
|
#include "libbfd.h"
|
||||||
#include "obstack.h"
|
#include "obstack.h"
|
||||||
#include "libelf.h"
|
#include "elf-bfd.h"
|
||||||
|
|
||||||
/* The internal type of a symbol table extension entry. */
|
/* The internal type of a symbol table extension entry. */
|
||||||
typedef unsigned long symext_entryS;
|
typedef unsigned long symext_entryS;
|
||||||
|
@ -219,7 +219,7 @@ static void elf_info_to_howto
|
||||||
PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
|
PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
|
||||||
|
|
||||||
static boolean elf32_hppa_backend_symbol_table_processing
|
static boolean elf32_hppa_backend_symbol_table_processing
|
||||||
PARAMS ((bfd *, elf_symbol_type *, int));
|
PARAMS ((bfd *, elf_symbol_type *, unsigned int));
|
||||||
|
|
||||||
static void elf32_hppa_backend_begin_write_processing
|
static void elf32_hppa_backend_begin_write_processing
|
||||||
PARAMS ((bfd *, struct bfd_link_info *));
|
PARAMS ((bfd *, struct bfd_link_info *));
|
||||||
|
@ -575,10 +575,7 @@ elf32_hppa_stub_hash_newfunc (entry, table, string)
|
||||||
bfd_hash_allocate (table,
|
bfd_hash_allocate (table,
|
||||||
sizeof (struct elf32_hppa_stub_hash_entry)));
|
sizeof (struct elf32_hppa_stub_hash_entry)));
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Call the allocation method of the superclass. */
|
/* Call the allocation method of the superclass. */
|
||||||
ret = ((struct elf32_hppa_stub_hash_entry *)
|
ret = ((struct elf32_hppa_stub_hash_entry *)
|
||||||
|
@ -630,10 +627,7 @@ elf32_hppa_args_hash_newfunc (entry, table, string)
|
||||||
bfd_hash_allocate (table,
|
bfd_hash_allocate (table,
|
||||||
sizeof (struct elf32_hppa_args_hash_entry)));
|
sizeof (struct elf32_hppa_args_hash_entry)));
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Call the allocation method of the superclass. */
|
/* Call the allocation method of the superclass. */
|
||||||
ret = ((struct elf32_hppa_args_hash_entry *)
|
ret = ((struct elf32_hppa_args_hash_entry *)
|
||||||
|
@ -659,10 +653,7 @@ elf32_hppa_link_hash_table_create (abfd)
|
||||||
ret = ((struct elf32_hppa_link_hash_table *)
|
ret = ((struct elf32_hppa_link_hash_table *)
|
||||||
bfd_alloc (abfd, sizeof (struct elf32_hppa_link_hash_table)));
|
bfd_alloc (abfd, sizeof (struct elf32_hppa_link_hash_table)));
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
|
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
|
||||||
_bfd_elf_link_hash_newfunc))
|
_bfd_elf_link_hash_newfunc))
|
||||||
{
|
{
|
||||||
|
@ -785,7 +776,7 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
{
|
{
|
||||||
int r_type;
|
int r_type;
|
||||||
reloc_howto_type *howto;
|
reloc_howto_type *howto;
|
||||||
long r_symndx;
|
unsigned long r_symndx;
|
||||||
struct elf_link_hash_entry *h;
|
struct elf_link_hash_entry *h;
|
||||||
Elf_Internal_Sym *sym;
|
Elf_Internal_Sym *sym;
|
||||||
asection *sym_sec;
|
asection *sym_sec;
|
||||||
|
@ -945,11 +936,12 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
relocation with modifications based on format and field. */
|
relocation with modifications based on format and field. */
|
||||||
|
|
||||||
elf32_hppa_reloc_type **
|
elf32_hppa_reloc_type **
|
||||||
hppa_elf_gen_reloc_type (abfd, base_type, format, field)
|
hppa_elf_gen_reloc_type (abfd, base_type, format, field, ignore)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
elf32_hppa_reloc_type base_type;
|
elf32_hppa_reloc_type base_type;
|
||||||
int format;
|
int format;
|
||||||
int field;
|
int field;
|
||||||
|
int ignore;
|
||||||
{
|
{
|
||||||
elf32_hppa_reloc_type *finaltype;
|
elf32_hppa_reloc_type *finaltype;
|
||||||
elf32_hppa_reloc_type **final_types;
|
elf32_hppa_reloc_type **final_types;
|
||||||
|
@ -1786,10 +1778,7 @@ add_entry_to_symext_chain (abfd, arg_reloc, sym_idx, symext_root, symext_last)
|
||||||
/* Allocate memory and initialize this entry. */
|
/* Allocate memory and initialize this entry. */
|
||||||
symextP = (symext_chainS *) bfd_alloc (abfd, sizeof (symext_chainS) * 2);
|
symextP = (symext_chainS *) bfd_alloc (abfd, sizeof (symext_chainS) * 2);
|
||||||
if (!symextP)
|
if (!symextP)
|
||||||
{
|
abort(); /* FIXME */
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
abort(); /* FIXME */
|
|
||||||
}
|
|
||||||
|
|
||||||
symextP[0].entry = ELF32_PARISC_SX_WORD (PARISC_SXT_SYMNDX, sym_idx);
|
symextP[0].entry = ELF32_PARISC_SX_WORD (PARISC_SXT_SYMNDX, sym_idx);
|
||||||
symextP[0].next = &symextP[1];
|
symextP[0].next = &symextP[1];
|
||||||
|
@ -1829,10 +1818,7 @@ elf_hppa_tc_make_sections (abfd, symext_root)
|
||||||
symextn_contents = (bfd_byte *) bfd_zalloc (abfd,
|
symextn_contents = (bfd_byte *) bfd_zalloc (abfd,
|
||||||
symextn_sec->_raw_size);
|
symextn_sec->_raw_size);
|
||||||
if (!symextn_contents)
|
if (!symextn_contents)
|
||||||
{
|
abort(); /* FIXME */
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
abort(); /* FIXME */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fill in the contents of the symbol extension chain. */
|
/* Fill in the contents of the symbol extension chain. */
|
||||||
for (i = 0, symextP = symext_root; symextP; symextP = symextP->next, ++i)
|
for (i = 0, symextP = symext_root; symextP; symextP = symextP->next, ++i)
|
||||||
|
@ -1850,7 +1836,7 @@ static boolean
|
||||||
elf32_hppa_backend_symbol_table_processing (abfd, esyms,symcnt)
|
elf32_hppa_backend_symbol_table_processing (abfd, esyms,symcnt)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
elf_symbol_type *esyms;
|
elf_symbol_type *esyms;
|
||||||
int symcnt;
|
unsigned int symcnt;
|
||||||
{
|
{
|
||||||
Elf32_Internal_Shdr *symextn_hdr =
|
Elf32_Internal_Shdr *symextn_hdr =
|
||||||
bfd_elf_find_section (abfd, SYMEXTN_SECTION_NAME);
|
bfd_elf_find_section (abfd, SYMEXTN_SECTION_NAME);
|
||||||
|
@ -1870,10 +1856,7 @@ elf32_hppa_backend_symbol_table_processing (abfd, esyms,symcnt)
|
||||||
/* Allocate a buffer of the appropriate size for the symextn section. */
|
/* Allocate a buffer of the appropriate size for the symextn section. */
|
||||||
symextn_hdr->contents = bfd_zalloc(abfd,symextn_hdr->sh_size);
|
symextn_hdr->contents = bfd_zalloc(abfd,symextn_hdr->sh_size);
|
||||||
if (!symextn_hdr->contents)
|
if (!symextn_hdr->contents)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read in the symextn section. */
|
/* Read in the symextn section. */
|
||||||
if (bfd_seek (abfd, symextn_hdr->sh_offset, SEEK_SET) == -1)
|
if (bfd_seek (abfd, symextn_hdr->sh_offset, SEEK_SET) == -1)
|
||||||
|
@ -1948,7 +1931,7 @@ elf32_hppa_read_symext_info (input_bfd, symtab_hdr, args_hash_table, local_syms)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
contents = (bfd_byte *) malloc (symextn_sec->_raw_size);
|
contents = (bfd_byte *) malloc ((size_t) symextn_sec->_raw_size);
|
||||||
if (contents == NULL)
|
if (contents == NULL)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
bfd_set_error (bfd_error_no_memory);
|
||||||
|
@ -2502,10 +2485,7 @@ elf32_hppa_build_stubs (stub_bfd, info)
|
||||||
size = bfd_section_size (stub_bfd, stub_sec);
|
size = bfd_section_size (stub_bfd, stub_sec);
|
||||||
stub_sec->contents = (unsigned char *) bfd_zalloc (stub_bfd, size);
|
stub_sec->contents = (unsigned char *) bfd_zalloc (stub_bfd, size);
|
||||||
if (stub_sec->contents == NULL)
|
if (stub_sec->contents == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
table = elf32_hppa_hash_table(info)->stub_hash_table;
|
table = elf32_hppa_hash_table(info)->stub_hash_table;
|
||||||
table->location = stub_sec->contents;
|
table->location = stub_sec->contents;
|
||||||
|
|
||||||
|
@ -2757,7 +2737,8 @@ elf32_hppa_size_stubs (stub_bfd, output_bfd, link_info)
|
||||||
irelaend = irela + section->reloc_count;
|
irelaend = irela + section->reloc_count;
|
||||||
for (; irela < irelaend; irela++)
|
for (; irela < irelaend; irela++)
|
||||||
{
|
{
|
||||||
long r_type, callee_args, caller_args, r_index, size_of_stub;
|
long r_type, callee_args, caller_args, size_of_stub;
|
||||||
|
unsigned long r_index;
|
||||||
struct elf_link_hash_entry *hash;
|
struct elf_link_hash_entry *hash;
|
||||||
struct elf32_hppa_stub_hash_entry *stub_hash;
|
struct elf32_hppa_stub_hash_entry *stub_hash;
|
||||||
struct elf32_hppa_args_hash_entry *args_hash;
|
struct elf32_hppa_args_hash_entry *args_hash;
|
||||||
|
@ -2948,7 +2929,6 @@ elf32_hppa_size_stubs (stub_bfd, output_bfd, link_info)
|
||||||
stub_name, true, true);
|
stub_name, true, true);
|
||||||
if (stub_hash == NULL)
|
if (stub_hash == NULL)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
free (stub_name);
|
free (stub_name);
|
||||||
free (internal_relocs);
|
free (internal_relocs);
|
||||||
for (i = 0; i < bfd_count; i++)
|
for (i = 0; i < bfd_count; i++)
|
||||||
|
|
|
@ -1550,7 +1550,6 @@ mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
|
||||||
bfd_alloc (abfd, sizeof (struct mips_elf_find_line)));
|
bfd_alloc (abfd, sizeof (struct mips_elf_find_line)));
|
||||||
if (fi == NULL)
|
if (fi == NULL)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
msec->flags = origflags;
|
msec->flags = origflags;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1570,7 +1569,6 @@ mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
|
||||||
sizeof (struct fdr))));
|
sizeof (struct fdr))));
|
||||||
if (fi->d.fdr == NULL)
|
if (fi->d.fdr == NULL)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
msec->flags = origflags;
|
msec->flags = origflags;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1669,10 +1667,7 @@ mips_elf_link_hash_newfunc (entry, table, string)
|
||||||
bfd_hash_allocate (table,
|
bfd_hash_allocate (table,
|
||||||
sizeof (struct mips_elf_link_hash_entry)));
|
sizeof (struct mips_elf_link_hash_entry)));
|
||||||
if (ret == (struct mips_elf_link_hash_entry *) NULL)
|
if (ret == (struct mips_elf_link_hash_entry *) NULL)
|
||||||
{
|
return (struct bfd_hash_entry *) ret;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (struct bfd_hash_entry *) ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Call the allocation method of the superclass. */
|
/* Call the allocation method of the superclass. */
|
||||||
ret = ((struct mips_elf_link_hash_entry *)
|
ret = ((struct mips_elf_link_hash_entry *)
|
||||||
|
@ -1701,10 +1696,7 @@ mips_elf_link_hash_table_create (abfd)
|
||||||
ret = ((struct mips_elf_link_hash_table *)
|
ret = ((struct mips_elf_link_hash_table *)
|
||||||
bfd_alloc (abfd, sizeof (struct mips_elf_link_hash_table)));
|
bfd_alloc (abfd, sizeof (struct mips_elf_link_hash_table)));
|
||||||
if (ret == (struct mips_elf_link_hash_table *) NULL)
|
if (ret == (struct mips_elf_link_hash_table *) NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
|
if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
|
||||||
mips_elf_link_hash_newfunc))
|
mips_elf_link_hash_newfunc))
|
||||||
|
@ -2226,6 +2218,9 @@ mips_elf_final_link (abfd, info)
|
||||||
gptab_bss_sec = o;
|
gptab_bss_sec = o;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
(*_bfd_error_handler)
|
||||||
|
("%s: illegal section name `%s'",
|
||||||
|
bfd_get_filename (abfd), o->name);
|
||||||
bfd_set_error (bfd_error_nonrepresentable_section);
|
bfd_set_error (bfd_error_nonrepresentable_section);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2372,7 +2367,6 @@ mips_elf_final_link (abfd, info)
|
||||||
bfd_alloc (abfd, c * sizeof (Elf32_External_gptab)));
|
bfd_alloc (abfd, c * sizeof (Elf32_External_gptab)));
|
||||||
if (ext_tab == NULL)
|
if (ext_tab == NULL)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
free (tab);
|
free (tab);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,10 +310,7 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
|
||||||
size = symtab_hdr->sh_info * sizeof (bfd_vma);
|
size = symtab_hdr->sh_info * sizeof (bfd_vma);
|
||||||
local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size);
|
local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size);
|
||||||
if (local_got_offsets == NULL)
|
if (local_got_offsets == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
elf_local_got_offsets (abfd) = local_got_offsets;
|
elf_local_got_offsets (abfd) = local_got_offsets;
|
||||||
for (i = 0; i < symtab_hdr->sh_info; i++)
|
for (i = 0; i < symtab_hdr->sh_info; i++)
|
||||||
local_got_offsets[i] = (bfd_vma) -1;
|
local_got_offsets[i] = (bfd_vma) -1;
|
||||||
|
@ -719,10 +716,7 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
|
||||||
/* Allocate memory for the section contents. */
|
/* Allocate memory for the section contents. */
|
||||||
s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
|
s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
|
||||||
if (s->contents == NULL && s->_raw_size != 0)
|
if (s->contents == NULL && s->_raw_size != 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elf_hash_table (info)->dynamic_sections_created)
|
if (elf_hash_table (info)->dynamic_sections_created)
|
||||||
|
|
|
@ -495,7 +495,7 @@ elf_object_p (abfd)
|
||||||
new_tdata = ((struct elf_obj_tdata *)
|
new_tdata = ((struct elf_obj_tdata *)
|
||||||
bfd_zalloc (abfd, sizeof (struct elf_obj_tdata)));
|
bfd_zalloc (abfd, sizeof (struct elf_obj_tdata)));
|
||||||
if (new_tdata == NULL)
|
if (new_tdata == NULL)
|
||||||
goto got_no_memory_error;
|
goto got_no_match;
|
||||||
elf_tdata (abfd) = new_tdata;
|
elf_tdata (abfd) = new_tdata;
|
||||||
|
|
||||||
/* Now that we know the byte order, swap in the rest of the header */
|
/* Now that we know the byte order, swap in the rest of the header */
|
||||||
|
@ -569,7 +569,7 @@ elf_object_p (abfd)
|
||||||
bfd_alloc (abfd,
|
bfd_alloc (abfd,
|
||||||
sizeof (i_shdrp) * i_ehdrp->e_shnum));
|
sizeof (i_shdrp) * i_ehdrp->e_shnum));
|
||||||
if (!i_shdrp || !elf_elfsections (abfd))
|
if (!i_shdrp || !elf_elfsections (abfd))
|
||||||
goto got_no_memory_error;
|
goto got_no_match;
|
||||||
if (bfd_seek (abfd, i_ehdrp->e_shoff, SEEK_SET) != 0)
|
if (bfd_seek (abfd, i_ehdrp->e_shoff, SEEK_SET) != 0)
|
||||||
goto got_no_match;
|
goto got_no_match;
|
||||||
for (shindex = 0; shindex < i_ehdrp->e_shnum; shindex++)
|
for (shindex = 0; shindex < i_ehdrp->e_shnum; shindex++)
|
||||||
|
@ -585,6 +585,34 @@ elf_object_p (abfd)
|
||||||
goto got_no_match;
|
goto got_no_match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Read in the program headers. */
|
||||||
|
if (i_ehdrp->e_phnum == 0)
|
||||||
|
elf_tdata (abfd)->phdr = NULL;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Elf_Internal_Phdr *i_phdr;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
elf_tdata (abfd)->phdr = ((Elf_Internal_Phdr *)
|
||||||
|
bfd_alloc (abfd,
|
||||||
|
(i_ehdrp->e_phnum
|
||||||
|
* sizeof (Elf_Internal_Phdr))));
|
||||||
|
if (elf_tdata (abfd)->phdr == NULL)
|
||||||
|
goto got_no_match;
|
||||||
|
if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) != 0)
|
||||||
|
goto got_no_match;
|
||||||
|
i_phdr = elf_tdata (abfd)->phdr;
|
||||||
|
for (i = 0; i < i_ehdrp->e_phnum; i++, i_phdr++)
|
||||||
|
{
|
||||||
|
Elf_External_Phdr x_phdr;
|
||||||
|
|
||||||
|
if (bfd_read ((PTR) &x_phdr, sizeof x_phdr, 1, abfd)
|
||||||
|
!= sizeof x_phdr)
|
||||||
|
goto got_no_match;
|
||||||
|
elf_swap_phdr_in (abfd, &x_phdr, i_phdr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Read in the string table containing the names of the sections. We
|
/* Read in the string table containing the names of the sections. We
|
||||||
will need the base pointer to this table later. */
|
will need the base pointer to this table later. */
|
||||||
/* We read this inline now, so that we don't have to go through
|
/* We read this inline now, so that we don't have to go through
|
||||||
|
@ -618,9 +646,6 @@ elf_object_p (abfd)
|
||||||
got_wrong_format_error:
|
got_wrong_format_error:
|
||||||
bfd_set_error (bfd_error_wrong_format);
|
bfd_set_error (bfd_error_wrong_format);
|
||||||
goto got_no_match;
|
goto got_no_match;
|
||||||
got_no_memory_error:
|
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto got_no_match;
|
|
||||||
got_no_match:
|
got_no_match:
|
||||||
if (new_tdata != NULL
|
if (new_tdata != NULL
|
||||||
&& new_tdata->elf_sect_ptr != NULL)
|
&& new_tdata->elf_sect_ptr != NULL)
|
||||||
|
@ -671,7 +696,6 @@ write_relocs (abfd, sec, data)
|
||||||
rela_hdr->contents = (PTR) bfd_alloc (abfd, rela_hdr->sh_size);
|
rela_hdr->contents = (PTR) bfd_alloc (abfd, rela_hdr->sh_size);
|
||||||
if (rela_hdr->contents == NULL)
|
if (rela_hdr->contents == NULL)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
*failedp = true;
|
*failedp = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -799,10 +823,7 @@ write_shdrs_and_ehdr (abfd)
|
||||||
x_shdrp = (Elf_External_Shdr *)
|
x_shdrp = (Elf_External_Shdr *)
|
||||||
bfd_alloc (abfd, sizeof (*x_shdrp) * (i_ehdrp->e_shnum));
|
bfd_alloc (abfd, sizeof (*x_shdrp) * (i_ehdrp->e_shnum));
|
||||||
if (!x_shdrp)
|
if (!x_shdrp)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (count = 0; count < i_ehdrp->e_shnum; count++)
|
for (count = 0; count < i_ehdrp->e_shnum; count++)
|
||||||
{
|
{
|
||||||
|
@ -865,10 +886,7 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
|
||||||
symbase = ((elf_symbol_type *)
|
symbase = ((elf_symbol_type *)
|
||||||
bfd_zalloc (abfd, symcount * sizeof (elf_symbol_type)));
|
bfd_zalloc (abfd, symcount * sizeof (elf_symbol_type)));
|
||||||
if (symbase == (elf_symbol_type *) NULL)
|
if (symbase == (elf_symbol_type *) NULL)
|
||||||
{
|
return -1;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
sym = symbase;
|
sym = symbase;
|
||||||
|
|
||||||
/* Temporarily allocate room for the raw ELF symbols. */
|
/* Temporarily allocate room for the raw ELF symbols. */
|
||||||
|
@ -1052,10 +1070,7 @@ elf_slurp_reloc_table (abfd, asect, symbols)
|
||||||
relents = ((arelent *)
|
relents = ((arelent *)
|
||||||
bfd_alloc (abfd, asect->reloc_count * sizeof (arelent)));
|
bfd_alloc (abfd, asect->reloc_count * sizeof (arelent)));
|
||||||
if (relents == NULL)
|
if (relents == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
|
|
||||||
entsize = d->rel_hdr.sh_entsize;
|
entsize = d->rel_hdr.sh_entsize;
|
||||||
BFD_ASSERT (entsize == sizeof (Elf_External_Rel)
|
BFD_ASSERT (entsize == sizeof (Elf_External_Rel)
|
||||||
|
|
|
@ -15,10 +15,10 @@ GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
/* Core file support */
|
/* Core file support */
|
||||||
|
|
||||||
#ifdef HAVE_PROCFS /* Some core file support requires host /proc files */
|
#ifdef HAVE_SYS_PROCFS_H /* Some core file support requires host /proc files */
|
||||||
#include <sys/procfs.h>
|
#include <sys/procfs.h>
|
||||||
#else
|
#else
|
||||||
#define bfd_prstatus(abfd, descdata, descsz, filepos) true
|
#define bfd_prstatus(abfd, descdata, descsz, filepos) true
|
||||||
|
@ -26,7 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#define bfd_prpsinfo(abfd, descdata, descsz, filepos) true
|
#define bfd_prpsinfo(abfd, descdata, descsz, filepos) true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_PROCFS
|
#ifdef HAVE_SYS_PROCFS_H
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
bfd_prstatus (abfd, descdata, descsz, filepos)
|
bfd_prstatus (abfd, descdata, descsz, filepos)
|
||||||
|
@ -67,10 +67,7 @@ bfd_prpsinfo (abfd, descdata, descsz, filepos)
|
||||||
if (descsz == sizeof (prpsinfo_t))
|
if (descsz == sizeof (prpsinfo_t))
|
||||||
{
|
{
|
||||||
if ((core_prpsinfo (abfd) = bfd_alloc (abfd, descsz)) == NULL)
|
if ((core_prpsinfo (abfd) = bfd_alloc (abfd, descsz)) == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
memcpy (core_prpsinfo (abfd), descdata, descsz);
|
memcpy (core_prpsinfo (abfd), descdata, descsz);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -95,7 +92,7 @@ bfd_fpregset (abfd, descdata, descsz, filepos)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_PROCFS */
|
#endif /* HAVE_SYS_PROCFS_H */
|
||||||
|
|
||||||
/* Return a pointer to the args (including the command name) that were
|
/* Return a pointer to the args (including the command name) that were
|
||||||
seen by the program that generated the core dump. Note that for
|
seen by the program that generated the core dump. Note that for
|
||||||
|
@ -107,7 +104,7 @@ char *
|
||||||
elf_core_file_failing_command (abfd)
|
elf_core_file_failing_command (abfd)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
{
|
{
|
||||||
#ifdef HAVE_PROCFS
|
#ifdef HAVE_SYS_PROCFS_H
|
||||||
if (core_prpsinfo (abfd))
|
if (core_prpsinfo (abfd))
|
||||||
{
|
{
|
||||||
prpsinfo_t *p = core_prpsinfo (abfd);
|
prpsinfo_t *p = core_prpsinfo (abfd);
|
||||||
|
@ -135,7 +132,7 @@ int
|
||||||
elf_core_file_failing_signal (abfd)
|
elf_core_file_failing_signal (abfd)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
{
|
{
|
||||||
#ifdef HAVE_PROCFS
|
#ifdef HAVE_SYS_PROCFS_H
|
||||||
if (core_prstatus (abfd))
|
if (core_prstatus (abfd))
|
||||||
{
|
{
|
||||||
return ((prstatus_t *) (core_prstatus (abfd)))->pr_cursig;
|
return ((prstatus_t *) (core_prstatus (abfd)))->pr_cursig;
|
||||||
|
@ -155,7 +152,7 @@ elf_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||||
bfd *core_bfd;
|
bfd *core_bfd;
|
||||||
bfd *exec_bfd;
|
bfd *exec_bfd;
|
||||||
{
|
{
|
||||||
#ifdef HAVE_PROCFS
|
#ifdef HAVE_SYS_PROCFS_H
|
||||||
char *corename;
|
char *corename;
|
||||||
char *execname;
|
char *execname;
|
||||||
#endif
|
#endif
|
||||||
|
@ -168,7 +165,7 @@ elf_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_PROCFS
|
#ifdef HAVE_SYS_PROCFS_H
|
||||||
|
|
||||||
/* If no prpsinfo, just return true. Otherwise, grab the last component
|
/* If no prpsinfo, just return true. Otherwise, grab the last component
|
||||||
of the exec'd pathname from the prpsinfo. */
|
of the exec'd pathname from the prpsinfo. */
|
||||||
|
@ -201,7 +198,7 @@ elf_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#endif /* HAVE_PROCFS */
|
#endif /* HAVE_SYS_PROCFS_H */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ELF core files contain a segment of type PT_NOTE, that holds much of
|
/* ELF core files contain a segment of type PT_NOTE, that holds much of
|
||||||
|
@ -218,11 +215,11 @@ elf_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||||
the bfd client will have to interpret the structures itself. Even with
|
the bfd client will have to interpret the structures itself. Even with
|
||||||
/proc support, it might want these full structures for it's own reasons.
|
/proc support, it might want these full structures for it's own reasons.
|
||||||
|
|
||||||
In the second level of support, where HAVE_PROCFS is defined, bfd will
|
In the second level of support, where HAVE_SYS_PROCFS_H is defined,
|
||||||
pick apart the structures to gather some additional information that
|
bfd will pick apart the structures to gather some additional
|
||||||
clients may want, such as the general register set, the name of the
|
information that clients may want, such as the general register
|
||||||
exec'ed file and its arguments, the signal (if any) that caused the
|
set, the name of the exec'ed file and its arguments, the signal (if
|
||||||
core dump, etc.
|
any) that caused the core dump, etc.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -241,7 +238,7 @@ elf_corefile_note (abfd, hdr)
|
||||||
asection *newsect;
|
asection *newsect;
|
||||||
|
|
||||||
if (hdr->p_filesz > 0
|
if (hdr->p_filesz > 0
|
||||||
&& (buf = (char *) malloc (hdr->p_filesz)) != NULL
|
&& (buf = (char *) malloc ((size_t) hdr->p_filesz)) != NULL
|
||||||
&& bfd_seek (abfd, hdr->p_offset, SEEK_SET) != -1
|
&& bfd_seek (abfd, hdr->p_offset, SEEK_SET) != -1
|
||||||
&& bfd_read ((PTR) buf, hdr->p_filesz, 1, abfd) == hdr->p_filesz)
|
&& bfd_read ((PTR) buf, hdr->p_filesz, 1, abfd) == hdr->p_filesz)
|
||||||
{
|
{
|
||||||
|
@ -388,10 +385,7 @@ elf_core_file_p (abfd)
|
||||||
elf_tdata (abfd) =
|
elf_tdata (abfd) =
|
||||||
(struct elf_obj_tdata *) bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
|
(struct elf_obj_tdata *) bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
|
||||||
if (elf_tdata (abfd) == NULL)
|
if (elf_tdata (abfd) == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME, `wrong' returns from this point onward, leak memory. */
|
/* FIXME, `wrong' returns from this point onward, leak memory. */
|
||||||
|
|
||||||
|
@ -449,10 +443,7 @@ elf_core_file_p (abfd)
|
||||||
i_phdrp = (Elf_Internal_Phdr *)
|
i_phdrp = (Elf_Internal_Phdr *)
|
||||||
bfd_alloc (abfd, sizeof (*i_phdrp) * i_ehdrp->e_phnum);
|
bfd_alloc (abfd, sizeof (*i_phdrp) * i_ehdrp->e_phnum);
|
||||||
if (!i_phdrp)
|
if (!i_phdrp)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) == -1)
|
if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
for (phindex = 0; phindex < i_ehdrp->e_phnum; phindex++)
|
for (phindex = 0; phindex < i_ehdrp->e_phnum; phindex++)
|
||||||
|
|
|
@ -279,10 +279,7 @@ elf_link_add_object_symbols (abfd, info)
|
||||||
sz = bfd_section_size (abfd, s);
|
sz = bfd_section_size (abfd, s);
|
||||||
msg = (char *) bfd_alloc (abfd, sz);
|
msg = (char *) bfd_alloc (abfd, sz);
|
||||||
if (msg == NULL)
|
if (msg == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! bfd_get_section_contents (abfd, s, msg, (file_ptr) 0, sz))
|
if (! bfd_get_section_contents (abfd, s, msg, (file_ptr) 0, sz))
|
||||||
goto error_return;
|
goto error_return;
|
||||||
|
@ -344,10 +341,7 @@ elf_link_add_object_symbols (abfd, info)
|
||||||
bfd_alloc (abfd,
|
bfd_alloc (abfd,
|
||||||
extsymcount * sizeof (struct elf_link_hash_entry *)));
|
extsymcount * sizeof (struct elf_link_hash_entry *)));
|
||||||
if (sym_hash == NULL)
|
if (sym_hash == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
elf_sym_hashes (abfd) = sym_hash;
|
elf_sym_hashes (abfd) = sym_hash;
|
||||||
|
|
||||||
if (elf_elfheader (abfd)->e_type != ET_DYN)
|
if (elf_elfheader (abfd)->e_type != ET_DYN)
|
||||||
|
@ -1446,10 +1440,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
|
||||||
s->_raw_size = dynsymcount * sizeof (Elf_External_Sym);
|
s->_raw_size = dynsymcount * sizeof (Elf_External_Sym);
|
||||||
s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
|
s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
|
||||||
if (s->contents == NULL && s->_raw_size != 0)
|
if (s->contents == NULL && s->_raw_size != 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The first entry in .dynsym is a dummy symbol. */
|
/* The first entry in .dynsym is a dummy symbol. */
|
||||||
isym.st_value = 0;
|
isym.st_value = 0;
|
||||||
|
@ -1473,10 +1464,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
|
||||||
s->_raw_size = (2 + bucketcount + dynsymcount) * (ARCH_SIZE / 8);
|
s->_raw_size = (2 + bucketcount + dynsymcount) * (ARCH_SIZE / 8);
|
||||||
s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
|
s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
|
||||||
if (s->contents == NULL)
|
if (s->contents == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
memset (s->contents, 0, (size_t) s->_raw_size);
|
memset (s->contents, 0, (size_t) s->_raw_size);
|
||||||
|
|
||||||
put_word (output_bfd, bucketcount, s->contents);
|
put_word (output_bfd, bucketcount, s->contents);
|
||||||
|
@ -1856,10 +1844,7 @@ elf_bfd_final_link (abfd, info)
|
||||||
so we allocate it with bfd_alloc rather than malloc. */
|
so we allocate it with bfd_alloc rather than malloc. */
|
||||||
rel_hdr->contents = (PTR) bfd_alloc (abfd, rel_hdr->sh_size);
|
rel_hdr->contents = (PTR) bfd_alloc (abfd, rel_hdr->sh_size);
|
||||||
if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
|
if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = ((struct elf_link_hash_entry **)
|
p = ((struct elf_link_hash_entry **)
|
||||||
malloc (o->reloc_count
|
malloc (o->reloc_count
|
||||||
|
@ -3044,10 +3029,7 @@ elf_reloc_link_order (output_bfd, info, output_section, link_order)
|
||||||
size = bfd_get_reloc_size (howto);
|
size = bfd_get_reloc_size (howto);
|
||||||
buf = (bfd_byte *) bfd_zmalloc (size);
|
buf = (bfd_byte *) bfd_zmalloc (size);
|
||||||
if (buf == (bfd_byte *) NULL)
|
if (buf == (bfd_byte *) NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
rstat = _bfd_relocate_contents (howto, output_bfd,
|
rstat = _bfd_relocate_contents (howto, output_bfd,
|
||||||
link_order->u.reloc.p->addend, buf);
|
link_order->u.reloc.p->addend, buf);
|
||||||
switch (rstat)
|
switch (rstat)
|
||||||
|
|
289
bfd/hash.c
289
bfd/hash.c
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
|
@ -234,8 +234,12 @@ EXAMPLE
|
||||||
. {* Allocate the structure if it has not already been allocated by a
|
. {* Allocate the structure if it has not already been allocated by a
|
||||||
. derived class. *}
|
. derived class. *}
|
||||||
. if (ret == (@var{entry_type} *) NULL)
|
. if (ret == (@var{entry_type} *) NULL)
|
||||||
. ret = ((@var{entry_type} *)
|
. {
|
||||||
. bfd_hash_allocate (table, sizeof (@var{entry_type})));
|
. ret = ((@var{entry_type} *)
|
||||||
|
. bfd_hash_allocate (table, sizeof (@var{entry_type})));
|
||||||
|
. if (ret == (@var{entry_type} *) NULL)
|
||||||
|
. return NULL;
|
||||||
|
. }
|
||||||
.
|
.
|
||||||
. {* Call the allocation method of the base class. *}
|
. {* Call the allocation method of the base class. *}
|
||||||
. ret = ((@var{entry_type} *)
|
. ret = ((@var{entry_type} *)
|
||||||
|
@ -311,14 +315,14 @@ bfd_hash_table_init_n (table, newfunc, size)
|
||||||
alloc = size * sizeof (struct bfd_hash_entry *);
|
alloc = size * sizeof (struct bfd_hash_entry *);
|
||||||
if (!obstack_begin (&table->memory, alloc))
|
if (!obstack_begin (&table->memory, alloc))
|
||||||
{
|
{
|
||||||
bfd_error = no_memory;
|
bfd_set_error (bfd_error_no_memory);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
table->table = ((struct bfd_hash_entry **)
|
table->table = ((struct bfd_hash_entry **)
|
||||||
obstack_alloc (&table->memory, alloc));
|
obstack_alloc (&table->memory, alloc));
|
||||||
if (!table->table)
|
if (!table->table)
|
||||||
{
|
{
|
||||||
bfd_error = no_memory;
|
bfd_set_error (bfd_error_no_memory);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
memset ((PTR) table->table, 0, alloc);
|
memset ((PTR) table->table, 0, alloc);
|
||||||
|
@ -399,7 +403,7 @@ bfd_hash_lookup (table, string, create, copy)
|
||||||
new = (char *) obstack_alloc (&table->memory, len + 1);
|
new = (char *) obstack_alloc (&table->memory, len + 1);
|
||||||
if (!new)
|
if (!new)
|
||||||
{
|
{
|
||||||
bfd_error = no_memory;
|
bfd_set_error (bfd_error_no_memory);
|
||||||
return (struct bfd_hash_entry *) NULL;
|
return (struct bfd_hash_entry *) NULL;
|
||||||
}
|
}
|
||||||
strcpy (new, string);
|
strcpy (new, string);
|
||||||
|
@ -413,6 +417,32 @@ bfd_hash_lookup (table, string, create, copy)
|
||||||
return hashp;
|
return hashp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Replace an entry in a hash table. */
|
||||||
|
|
||||||
|
void
|
||||||
|
bfd_hash_replace (table, old, nw)
|
||||||
|
struct bfd_hash_table *table;
|
||||||
|
struct bfd_hash_entry *old;
|
||||||
|
struct bfd_hash_entry *nw;
|
||||||
|
{
|
||||||
|
unsigned int index;
|
||||||
|
struct bfd_hash_entry **pph;
|
||||||
|
|
||||||
|
index = old->hash % table->size;
|
||||||
|
for (pph = &table->table[index];
|
||||||
|
(*pph) != (struct bfd_hash_entry *) NULL;
|
||||||
|
pph = &(*pph)->next)
|
||||||
|
{
|
||||||
|
if (*pph == old)
|
||||||
|
{
|
||||||
|
*pph = nw;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
/* Base method for creating a new hash table entry. */
|
/* Base method for creating a new hash table entry. */
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
|
@ -435,7 +465,12 @@ bfd_hash_allocate (table, size)
|
||||||
struct bfd_hash_table *table;
|
struct bfd_hash_table *table;
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
{
|
{
|
||||||
return obstack_alloc (&table->memory, size);
|
PTR ret;
|
||||||
|
|
||||||
|
ret = obstack_alloc (&table->memory, size);
|
||||||
|
if (ret == NULL && size != 0)
|
||||||
|
bfd_set_error (bfd_error_no_memory);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Traverse a hash table. */
|
/* Traverse a hash table. */
|
||||||
|
@ -459,3 +494,243 @@ bfd_hash_traverse (table, func, info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* A few different object file formats (a.out, COFF, ELF) use a string
|
||||||
|
table. These functions support adding strings to a string table,
|
||||||
|
returning the byte offset, and writing out the table.
|
||||||
|
|
||||||
|
Possible improvements:
|
||||||
|
+ look for strings matching trailing substrings of other strings
|
||||||
|
+ better data structures? balanced trees?
|
||||||
|
+ look at reducing memory use elsewhere -- maybe if we didn't have
|
||||||
|
to construct the entire symbol table at once, we could get by
|
||||||
|
with smaller amounts of VM? (What effect does that have on the
|
||||||
|
string table reductions?) */
|
||||||
|
|
||||||
|
/* An entry in the strtab hash table. */
|
||||||
|
|
||||||
|
struct strtab_hash_entry
|
||||||
|
{
|
||||||
|
struct bfd_hash_entry root;
|
||||||
|
/* Index in string table. */
|
||||||
|
bfd_size_type index;
|
||||||
|
/* Next string in strtab. */
|
||||||
|
struct strtab_hash_entry *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* The strtab hash table. */
|
||||||
|
|
||||||
|
struct bfd_strtab_hash
|
||||||
|
{
|
||||||
|
struct bfd_hash_table table;
|
||||||
|
/* Size of strtab--also next available index. */
|
||||||
|
bfd_size_type size;
|
||||||
|
/* First string in strtab. */
|
||||||
|
struct strtab_hash_entry *first;
|
||||||
|
/* Last string in strtab. */
|
||||||
|
struct strtab_hash_entry *last;
|
||||||
|
/* Whether to precede strings with a two byte length, as in the
|
||||||
|
XCOFF .debug section. */
|
||||||
|
boolean xcoff;
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct bfd_hash_entry *strtab_hash_newfunc
|
||||||
|
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
|
||||||
|
|
||||||
|
/* Routine to create an entry in a strtab. */
|
||||||
|
|
||||||
|
static struct bfd_hash_entry *
|
||||||
|
strtab_hash_newfunc (entry, table, string)
|
||||||
|
struct bfd_hash_entry *entry;
|
||||||
|
struct bfd_hash_table *table;
|
||||||
|
const char *string;
|
||||||
|
{
|
||||||
|
struct strtab_hash_entry *ret = (struct strtab_hash_entry *) entry;
|
||||||
|
|
||||||
|
/* Allocate the structure if it has not already been allocated by a
|
||||||
|
subclass. */
|
||||||
|
if (ret == (struct strtab_hash_entry *) NULL)
|
||||||
|
ret = ((struct strtab_hash_entry *)
|
||||||
|
bfd_hash_allocate (table, sizeof (struct strtab_hash_entry)));
|
||||||
|
if (ret == (struct strtab_hash_entry *) NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* Call the allocation method of the superclass. */
|
||||||
|
ret = ((struct strtab_hash_entry *)
|
||||||
|
bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
/* Initialize the local fields. */
|
||||||
|
ret->index = (bfd_size_type) -1;
|
||||||
|
ret->next = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (struct bfd_hash_entry *) ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Look up an entry in an strtab. */
|
||||||
|
|
||||||
|
#define strtab_hash_lookup(t, string, create, copy) \
|
||||||
|
((struct strtab_hash_entry *) \
|
||||||
|
bfd_hash_lookup (&(t)->table, (string), (create), (copy)))
|
||||||
|
|
||||||
|
/* Create a new strtab. */
|
||||||
|
|
||||||
|
struct bfd_strtab_hash *
|
||||||
|
_bfd_stringtab_init ()
|
||||||
|
{
|
||||||
|
struct bfd_strtab_hash *table;
|
||||||
|
|
||||||
|
table = (struct bfd_strtab_hash *) malloc (sizeof (struct bfd_strtab_hash));
|
||||||
|
if (table == NULL)
|
||||||
|
{
|
||||||
|
bfd_set_error (bfd_error_no_memory);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! bfd_hash_table_init (&table->table, strtab_hash_newfunc))
|
||||||
|
{
|
||||||
|
free (table);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
table->size = 0;
|
||||||
|
table->first = NULL;
|
||||||
|
table->last = NULL;
|
||||||
|
table->xcoff = false;
|
||||||
|
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create a new strtab in which the strings are output in the format
|
||||||
|
used in the XCOFF .debug section: a two byte length precedes each
|
||||||
|
string. */
|
||||||
|
|
||||||
|
struct bfd_strtab_hash *
|
||||||
|
_bfd_xcoff_stringtab_init ()
|
||||||
|
{
|
||||||
|
struct bfd_strtab_hash *ret;
|
||||||
|
|
||||||
|
ret = _bfd_stringtab_init ();
|
||||||
|
if (ret != NULL)
|
||||||
|
ret->xcoff = true;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Free a strtab. */
|
||||||
|
|
||||||
|
void
|
||||||
|
_bfd_stringtab_free (table)
|
||||||
|
struct bfd_strtab_hash *table;
|
||||||
|
{
|
||||||
|
bfd_hash_table_free (&table->table);
|
||||||
|
free (table);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the index of a string in a strtab, adding it if it is not
|
||||||
|
already present. If HASH is false, we don't really use the hash
|
||||||
|
table, and we don't eliminate duplicate strings. */
|
||||||
|
|
||||||
|
bfd_size_type
|
||||||
|
_bfd_stringtab_add (tab, str, hash, copy)
|
||||||
|
struct bfd_strtab_hash *tab;
|
||||||
|
const char *str;
|
||||||
|
boolean hash;
|
||||||
|
boolean copy;
|
||||||
|
{
|
||||||
|
register struct strtab_hash_entry *entry;
|
||||||
|
|
||||||
|
if (hash)
|
||||||
|
{
|
||||||
|
entry = strtab_hash_lookup (tab, str, true, copy);
|
||||||
|
if (entry == NULL)
|
||||||
|
return (bfd_size_type) -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entry = ((struct strtab_hash_entry *)
|
||||||
|
bfd_hash_allocate (&tab->table,
|
||||||
|
sizeof (struct strtab_hash_entry)));
|
||||||
|
if (entry == NULL)
|
||||||
|
return (bfd_size_type) -1;
|
||||||
|
if (! copy)
|
||||||
|
entry->root.string = str;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *n;
|
||||||
|
|
||||||
|
n = (char *) bfd_hash_allocate (&tab->table, strlen (str) + 1);
|
||||||
|
if (n == NULL)
|
||||||
|
return (bfd_size_type) -1;
|
||||||
|
entry->root.string = n;
|
||||||
|
}
|
||||||
|
entry->index = (bfd_size_type) -1;
|
||||||
|
entry->next = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry->index == (bfd_size_type) -1)
|
||||||
|
{
|
||||||
|
entry->index = tab->size;
|
||||||
|
tab->size += strlen (str) + 1;
|
||||||
|
if (tab->xcoff)
|
||||||
|
{
|
||||||
|
entry->index += 2;
|
||||||
|
tab->size += 2;
|
||||||
|
}
|
||||||
|
if (tab->first == NULL)
|
||||||
|
tab->first = entry;
|
||||||
|
else
|
||||||
|
tab->last->next = entry;
|
||||||
|
tab->last = entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
return entry->index;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the number of bytes in a strtab. */
|
||||||
|
|
||||||
|
bfd_size_type
|
||||||
|
_bfd_stringtab_size (tab)
|
||||||
|
struct bfd_strtab_hash *tab;
|
||||||
|
{
|
||||||
|
return tab->size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Write out a strtab. ABFD must already be at the right location in
|
||||||
|
the file. */
|
||||||
|
|
||||||
|
boolean
|
||||||
|
_bfd_stringtab_emit (abfd, tab)
|
||||||
|
register bfd *abfd;
|
||||||
|
struct bfd_strtab_hash *tab;
|
||||||
|
{
|
||||||
|
register boolean xcoff;
|
||||||
|
register struct strtab_hash_entry *entry;
|
||||||
|
|
||||||
|
xcoff = tab->xcoff;
|
||||||
|
|
||||||
|
for (entry = tab->first; entry != NULL; entry = entry->next)
|
||||||
|
{
|
||||||
|
register const char *str;
|
||||||
|
register size_t len;
|
||||||
|
|
||||||
|
str = entry->root.string;
|
||||||
|
len = strlen (str) + 1;
|
||||||
|
|
||||||
|
if (xcoff)
|
||||||
|
{
|
||||||
|
bfd_byte buf[2];
|
||||||
|
|
||||||
|
/* The output length includes the null byte. */
|
||||||
|
bfd_put_16 (abfd, len, buf);
|
||||||
|
if (bfd_write ((PTR) buf, 1, 2, abfd) != 2)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bfd_write ((PTR) str, 1, len, abfd) != len)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* BFD back-end for HPPA BSD core files.
|
/* BFD back-end for HPPA BSD core files.
|
||||||
Copyright 1993 Free Software Foundation, Inc.
|
Copyright 1993, 1994 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of BFD, the Binary File Descriptor library.
|
This file is part of BFD, the Binary File Descriptor library.
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Written by the Center for Software Science at the University of Utah
|
Written by the Center for Software Science at the University of Utah
|
||||||
and by Cygnus Support.
|
and by Cygnus Support.
|
||||||
|
@ -28,9 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* This file can only be compiled on systems which use HPPA-BSD style
|
/* This file can only be compiled on systems which use HPPA-BSD style
|
||||||
core files. In the config/XXXXXX.mh file for such a system add
|
core files.
|
||||||
HDEFINES=-DHPPABSD_CORE
|
|
||||||
HDEPFILES=hppabsd-core.o
|
|
||||||
|
|
||||||
I would not expect this to be of use to any other host/target, but
|
I would not expect this to be of use to any other host/target, but
|
||||||
you never know. */
|
you never know. */
|
||||||
|
@ -55,9 +53,9 @@
|
||||||
|
|
||||||
static asection *make_bfd_asection PARAMS ((bfd *, CONST char *,
|
static asection *make_bfd_asection PARAMS ((bfd *, CONST char *,
|
||||||
flagword, bfd_size_type,
|
flagword, bfd_size_type,
|
||||||
bfd_vma, unsigned int));
|
file_ptr, unsigned int));
|
||||||
static asymbol *hppabsd_core_make_empty_symbol PARAMS ((bfd *));
|
static asymbol *hppabsd_core_make_empty_symbol PARAMS ((bfd *));
|
||||||
static bfd_target *hppabsd_core_core_file_p PARAMS ((bfd *));
|
static const bfd_target *hppabsd_core_core_file_p PARAMS ((bfd *));
|
||||||
static char *hppabsd_core_core_file_failing_command PARAMS ((bfd *));
|
static char *hppabsd_core_core_file_failing_command PARAMS ((bfd *));
|
||||||
static int hppabsd_core_core_file_failing_signal PARAMS ((bfd *));
|
static int hppabsd_core_core_file_failing_signal PARAMS ((bfd *));
|
||||||
static boolean hppabsd_core_core_file_matches_executable_p
|
static boolean hppabsd_core_core_file_matches_executable_p
|
||||||
|
@ -83,12 +81,12 @@ struct hppabsd_core_struct
|
||||||
#define core_regsec(bfd) (core_hdr(bfd)->reg_section)
|
#define core_regsec(bfd) (core_hdr(bfd)->reg_section)
|
||||||
|
|
||||||
static asection *
|
static asection *
|
||||||
make_bfd_asection (abfd, name, flags, _raw_size, vma, alignment_power)
|
make_bfd_asection (abfd, name, flags, _raw_size, offset, alignment_power)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
CONST char *name;
|
CONST char *name;
|
||||||
flagword flags;
|
flagword flags;
|
||||||
bfd_size_type _raw_size;
|
bfd_size_type _raw_size;
|
||||||
bfd_vma vma;
|
file_ptr offset;
|
||||||
unsigned int alignment_power;
|
unsigned int alignment_power;
|
||||||
{
|
{
|
||||||
asection *asect;
|
asection *asect;
|
||||||
|
@ -99,8 +97,7 @@ make_bfd_asection (abfd, name, flags, _raw_size, vma, alignment_power)
|
||||||
|
|
||||||
asect->flags = flags;
|
asect->flags = flags;
|
||||||
asect->_raw_size = _raw_size;
|
asect->_raw_size = _raw_size;
|
||||||
asect->vma = vma;
|
asect->filepos = offset;
|
||||||
asect->filepos = bfd_tell (abfd);
|
|
||||||
asect->alignment_power = alignment_power;
|
asect->alignment_power = alignment_power;
|
||||||
|
|
||||||
return asect;
|
return asect;
|
||||||
|
@ -116,7 +113,7 @@ hppabsd_core_make_empty_symbol (abfd)
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bfd_target *
|
static const bfd_target *
|
||||||
hppabsd_core_core_file_p (abfd)
|
hppabsd_core_core_file_p (abfd)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
{
|
{
|
||||||
|
@ -139,6 +136,15 @@ hppabsd_core_core_file_p (abfd)
|
||||||
for PA 1.0 machines and PA 1.1 machines. Yuk! */
|
for PA 1.0 machines and PA 1.1 machines. Yuk! */
|
||||||
clicksz = u.u_pcb.pcb_pgsz;
|
clicksz = u.u_pcb.pcb_pgsz;
|
||||||
|
|
||||||
|
/* clicksz must be a power of two >= 2k. */
|
||||||
|
if (clicksz < 0x800
|
||||||
|
|| clicksz != (clicksz & -clicksz))
|
||||||
|
{
|
||||||
|
bfd_set_error (bfd_error_wrong_format);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Sanity checks. Make sure the size of the core file matches the
|
/* Sanity checks. Make sure the size of the core file matches the
|
||||||
the size computed from information within the core itself. */
|
the size computed from information within the core itself. */
|
||||||
{
|
{
|
||||||
|
@ -168,10 +174,7 @@ hppabsd_core_core_file_p (abfd)
|
||||||
coredata = (struct hppabsd_core_struct *)
|
coredata = (struct hppabsd_core_struct *)
|
||||||
bfd_zalloc (abfd, sizeof (struct hppabsd_core_struct));
|
bfd_zalloc (abfd, sizeof (struct hppabsd_core_struct));
|
||||||
if (!coredata)
|
if (!coredata)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make the core data and available via the tdata part of the BFD. */
|
/* Make the core data and available via the tdata part of the BFD. */
|
||||||
abfd->tdata.hppabsd_core_data = coredata;
|
abfd->tdata.hppabsd_core_data = coredata;
|
||||||
|
@ -192,7 +195,7 @@ hppabsd_core_core_file_p (abfd)
|
||||||
core_datasec (abfd)->vma = UDATASEG;
|
core_datasec (abfd)->vma = UDATASEG;
|
||||||
|
|
||||||
core_regsec (abfd) = make_bfd_asection (abfd, ".reg",
|
core_regsec (abfd) = make_bfd_asection (abfd, ".reg",
|
||||||
SEC_ALLOC + SEC_HAS_CONTENTS,
|
SEC_HAS_CONTENTS,
|
||||||
KSTAKSIZE * NBPG,
|
KSTAKSIZE * NBPG,
|
||||||
NBPG * USIZE, 2);
|
NBPG * USIZE, 2);
|
||||||
core_regsec (abfd)->vma = 0;
|
core_regsec (abfd)->vma = 0;
|
||||||
|
@ -236,6 +239,8 @@ hppabsd_core_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||||
#define hppabsd_core_get_lineno _bfd_nosymbols_get_lineno
|
#define hppabsd_core_get_lineno _bfd_nosymbols_get_lineno
|
||||||
#define hppabsd_core_find_nearest_line _bfd_nosymbols_find_nearest_line
|
#define hppabsd_core_find_nearest_line _bfd_nosymbols_find_nearest_line
|
||||||
#define hppabsd_core_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
#define hppabsd_core_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
||||||
|
#define hppabsd_core_read_minisymbols _bfd_nosymbols_read_minisymbols
|
||||||
|
#define hppabsd_core_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol
|
||||||
|
|
||||||
/* If somebody calls any byte-swapping routines, shoot them. */
|
/* If somebody calls any byte-swapping routines, shoot them. */
|
||||||
static void
|
static void
|
||||||
|
@ -250,7 +255,7 @@ swap_abort ()
|
||||||
#define NO_SIGNED_GET \
|
#define NO_SIGNED_GET \
|
||||||
((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
|
((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
|
||||||
|
|
||||||
bfd_target hppabsd_core_vec =
|
const bfd_target hppabsd_core_vec =
|
||||||
{
|
{
|
||||||
"hppabsd-core",
|
"hppabsd-core",
|
||||||
bfd_target_unknown_flavour,
|
bfd_target_unknown_flavour,
|
||||||
|
@ -258,12 +263,11 @@ bfd_target hppabsd_core_vec =
|
||||||
true, /* target headers byte order */
|
true, /* target headers byte order */
|
||||||
(HAS_RELOC | EXEC_P | /* object flags */
|
(HAS_RELOC | EXEC_P | /* object flags */
|
||||||
HAS_LINENO | HAS_DEBUG |
|
HAS_LINENO | HAS_DEBUG |
|
||||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
|
||||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||||
0, /* symbol prefix */
|
0, /* symbol prefix */
|
||||||
' ', /* ar_pad_char */
|
' ', /* ar_pad_char */
|
||||||
16, /* ar_max_namelen */
|
16, /* ar_max_namelen */
|
||||||
3, /* minimum alignment power */
|
|
||||||
NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */
|
NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */
|
||||||
NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */
|
NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */
|
||||||
NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */
|
NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */
|
||||||
|
@ -294,6 +298,7 @@ bfd_target hppabsd_core_vec =
|
||||||
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
|
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
|
||||||
BFD_JUMP_TABLE_WRITE (_bfd_generic),
|
BFD_JUMP_TABLE_WRITE (_bfd_generic),
|
||||||
BFD_JUMP_TABLE_LINK (_bfd_nolink),
|
BFD_JUMP_TABLE_LINK (_bfd_nolink),
|
||||||
|
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||||
|
|
||||||
(PTR) 0 /* backend_data */
|
(PTR) 0 /* backend_data */
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,6 +36,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
#define MY(OP) CAT(i386linux_,OP)
|
#define MY(OP) CAT(i386linux_,OP)
|
||||||
#define TARGETNAME "a.out-i386-linux"
|
#define TARGETNAME "a.out-i386-linux"
|
||||||
|
|
||||||
|
extern const bfd_target MY(vec);
|
||||||
|
|
||||||
/* We always generate QMAGIC files in preference to ZMAGIC files. It
|
/* We always generate QMAGIC files in preference to ZMAGIC files. It
|
||||||
would be possible to make this a linker option, if that ever
|
would be possible to make this a linker option, if that ever
|
||||||
becomes important. */
|
becomes important. */
|
||||||
|
@ -219,10 +221,7 @@ linux_link_hash_table_create (abfd)
|
||||||
ret = ((struct linux_link_hash_table *)
|
ret = ((struct linux_link_hash_table *)
|
||||||
bfd_alloc (abfd, sizeof (struct linux_link_hash_table)));
|
bfd_alloc (abfd, sizeof (struct linux_link_hash_table)));
|
||||||
if (ret == (struct linux_link_hash_table *) NULL)
|
if (ret == (struct linux_link_hash_table *) NULL)
|
||||||
{
|
return (struct bfd_link_hash_table *) NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (struct bfd_link_hash_table *) NULL;
|
|
||||||
}
|
|
||||||
if (! NAME(aout,link_hash_table_init) (&ret->root, abfd,
|
if (! NAME(aout,link_hash_table_init) (&ret->root, abfd,
|
||||||
linux_link_hash_newfunc))
|
linux_link_hash_newfunc))
|
||||||
{
|
{
|
||||||
|
@ -585,10 +584,7 @@ bfd_linux_size_dynamic_sections (output_bfd, info)
|
||||||
s->_raw_size = 8 + linux_hash_table (info)->fixup_count * 8;
|
s->_raw_size = 8 + linux_hash_table (info)->fixup_count * 8;
|
||||||
s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
|
s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
|
||||||
if (s->contents == NULL)
|
if (s->contents == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
memset (s->contents, 0, (size_t) s->_raw_size);
|
memset (s->contents, 0, (size_t) s->_raw_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,15 +15,14 @@ GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#define BYTES_IN_WORD 4
|
#define BYTES_IN_WORD 4
|
||||||
#define ARCH 32
|
|
||||||
#define N_SHARED_LIB(x) 0
|
#define N_SHARED_LIB(x) 0
|
||||||
|
|
||||||
#define TEXT_START_ADDR 0
|
#define TEXT_START_ADDR 0
|
||||||
#define PAGE_SIZE 4096
|
#define TARGET_PAGE_SIZE 4096
|
||||||
#define SEGMENT_SIZE PAGE_SIZE
|
#define SEGMENT_SIZE TARGET_PAGE_SIZE
|
||||||
#define DEFAULT_ARCH bfd_arch_i386
|
#define DEFAULT_ARCH bfd_arch_i386
|
||||||
|
|
||||||
#define MY(OP) CAT(i386lynx_aout_,OP)
|
#define MY(OP) CAT(i386lynx_aout_,OP)
|
||||||
|
@ -83,7 +82,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "libaout.h"
|
#include "libaout.h"
|
||||||
#include "aout/aout64.h"
|
#include "aout/aout64.h"
|
||||||
|
|
||||||
#ifdef HOST_LYNX
|
#ifdef LYNX_CORE
|
||||||
|
|
||||||
char *lynx_core_file_failing_command ();
|
char *lynx_core_file_failing_command ();
|
||||||
int lynx_core_file_failing_signal ();
|
int lynx_core_file_failing_signal ();
|
||||||
|
@ -95,7 +94,7 @@ const bfd_target *lynx_core_file_p ();
|
||||||
#define MY_core_file_matches_executable_p lynx_core_file_matches_executable_p
|
#define MY_core_file_matches_executable_p lynx_core_file_matches_executable_p
|
||||||
#define MY_core_file_p lynx_core_file_p
|
#define MY_core_file_p lynx_core_file_p
|
||||||
|
|
||||||
#endif /* HOST_LYNX */
|
#endif /* LYNX_CORE */
|
||||||
|
|
||||||
|
|
||||||
#define KEEPIT flags
|
#define KEEPIT flags
|
||||||
|
@ -144,10 +143,10 @@ NAME(lynx,swap_std_reloc_out) (abfd, g, natptr)
|
||||||
|
|
||||||
|
|
||||||
if (bfd_is_com_section (output_section)
|
if (bfd_is_com_section (output_section)
|
||||||
|| output_section == &bfd_abs_section
|
|| bfd_is_abs_section (output_section)
|
||||||
|| output_section == &bfd_und_section)
|
|| bfd_is_und_section (output_section))
|
||||||
{
|
{
|
||||||
if (bfd_abs_section.symbol == sym)
|
if (bfd_abs_section_ptr->symbol == sym)
|
||||||
{
|
{
|
||||||
/* Whoops, looked like an abs symbol, but is really an offset
|
/* Whoops, looked like an abs symbol, but is really an offset
|
||||||
from the abs section */
|
from the abs section */
|
||||||
|
@ -231,10 +230,10 @@ NAME(lynx,swap_ext_reloc_out) (abfd, g, natptr)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (bfd_is_com_section (output_section)
|
if (bfd_is_com_section (output_section)
|
||||||
|| output_section == &bfd_abs_section
|
|| bfd_is_abs_section (output_section)
|
||||||
|| output_section == &bfd_und_section)
|
|| bfd_is_und_section (output_section))
|
||||||
{
|
{
|
||||||
if (bfd_abs_section.symbol == sym)
|
if (bfd_abs_section_ptr->symbol == sym)
|
||||||
{
|
{
|
||||||
/* Whoops, looked like an abs symbol, but is really an offset
|
/* Whoops, looked like an abs symbol, but is really an offset
|
||||||
from the abs section */
|
from the abs section */
|
||||||
|
@ -314,18 +313,19 @@ NAME(lynx,swap_ext_reloc_out) (abfd, g, natptr)
|
||||||
default: \
|
default: \
|
||||||
case N_ABS: \
|
case N_ABS: \
|
||||||
case N_ABS | N_EXT: \
|
case N_ABS | N_EXT: \
|
||||||
cache_ptr->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr; \
|
cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; \
|
||||||
cache_ptr->addend = ad; \
|
cache_ptr->addend = ad; \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
void
|
void
|
||||||
NAME(lynx,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols)
|
NAME(lynx,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
struct reloc_ext_external *bytes;
|
struct reloc_ext_external *bytes;
|
||||||
arelent *cache_ptr;
|
arelent *cache_ptr;
|
||||||
asymbol **symbols;
|
asymbol **symbols;
|
||||||
|
bfd_size_type symcount;
|
||||||
{
|
{
|
||||||
int r_index;
|
int r_index;
|
||||||
int r_extern;
|
int r_extern;
|
||||||
|
@ -344,11 +344,12 @@ NAME(lynx,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NAME(lynx,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols)
|
NAME(lynx,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
struct reloc_std_external *bytes;
|
struct reloc_std_external *bytes;
|
||||||
arelent *cache_ptr;
|
arelent *cache_ptr;
|
||||||
asymbol **symbols;
|
asymbol **symbols;
|
||||||
|
bfd_size_type symcount;
|
||||||
{
|
{
|
||||||
int r_index;
|
int r_index;
|
||||||
int r_extern;
|
int r_extern;
|
||||||
|
@ -420,7 +421,6 @@ doit:
|
||||||
reloc_cache = (arelent *) malloc (count * sizeof (arelent));
|
reloc_cache = (arelent *) malloc (count * sizeof (arelent));
|
||||||
if (!reloc_cache && count != 0)
|
if (!reloc_cache && count != 0)
|
||||||
{
|
{
|
||||||
nomem:
|
|
||||||
bfd_set_error (bfd_error_no_memory);
|
bfd_set_error (bfd_error_no_memory);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -430,7 +430,7 @@ doit:
|
||||||
if (!relocs && reloc_size != 0)
|
if (!relocs && reloc_size != 0)
|
||||||
{
|
{
|
||||||
free (reloc_cache);
|
free (reloc_cache);
|
||||||
goto nomem;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bfd_read (relocs, 1, reloc_size, abfd) != reloc_size)
|
if (bfd_read (relocs, 1, reloc_size, abfd) != reloc_size)
|
||||||
|
@ -448,7 +448,8 @@ doit:
|
||||||
|
|
||||||
for (; counter < count; counter++, rptr++, cache_ptr++)
|
for (; counter < count; counter++, rptr++, cache_ptr++)
|
||||||
{
|
{
|
||||||
NAME(lynx,swap_ext_reloc_in) (abfd, rptr, cache_ptr, symbols);
|
NAME(lynx,swap_ext_reloc_in) (abfd, rptr, cache_ptr, symbols,
|
||||||
|
bfd_get_symcount (abfd));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -459,7 +460,8 @@ doit:
|
||||||
|
|
||||||
for (; counter < count; counter++, rptr++, cache_ptr++)
|
for (; counter < count; counter++, rptr++, cache_ptr++)
|
||||||
{
|
{
|
||||||
NAME(lynx,swap_std_reloc_in) (abfd, rptr, cache_ptr, symbols);
|
NAME(lynx,swap_std_reloc_in) (abfd, rptr, cache_ptr, symbols,
|
||||||
|
bfd_get_symcount (abfd));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -493,10 +495,7 @@ NAME(lynx,squirt_out_relocs) (abfd, section)
|
||||||
natsize = each_size * count;
|
natsize = each_size * count;
|
||||||
native = (unsigned char *) bfd_zalloc (abfd, natsize);
|
native = (unsigned char *) bfd_zalloc (abfd, natsize);
|
||||||
if (!native)
|
if (!native)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
generic = section->orelocation;
|
generic = section->orelocation;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
|
@ -26,7 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "libaout.h" /* BFD a.out internal data structures */
|
#include "libaout.h" /* BFD a.out internal data structures */
|
||||||
#include "os9k.h"
|
#include "os9k.h"
|
||||||
|
|
||||||
static bfd_target *os9k_callback PARAMS ((bfd *));
|
static const bfd_target *os9k_callback PARAMS ((bfd *));
|
||||||
|
|
||||||
/* Swaps the information in an executable header taken from a raw byte
|
/* Swaps the information in an executable header taken from a raw byte
|
||||||
stream memory image, into the internal exec_header structure. */
|
stream memory image, into the internal exec_header structure. */
|
||||||
|
@ -104,7 +104,7 @@ os9k_swap_exec_header_out (abfd, execp, raw_bytes)
|
||||||
|
|
||||||
#endif /* 0 */
|
#endif /* 0 */
|
||||||
|
|
||||||
static bfd_target *
|
static const bfd_target *
|
||||||
os9k_object_p (abfd)
|
os9k_object_p (abfd)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
{
|
{
|
||||||
|
@ -139,7 +139,7 @@ os9k_object_p (abfd)
|
||||||
/* Finish up the opening of a b.out file for reading. Fill in all the
|
/* Finish up the opening of a b.out file for reading. Fill in all the
|
||||||
fields that are not handled by common code. */
|
fields that are not handled by common code. */
|
||||||
|
|
||||||
static bfd_target *
|
static const bfd_target *
|
||||||
os9k_callback (abfd)
|
os9k_callback (abfd)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
{
|
{
|
||||||
|
@ -199,23 +199,15 @@ os9k_mkobject (abfd)
|
||||||
|
|
||||||
rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, sizeof (struct bout_data_struct));
|
rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, sizeof (struct bout_data_struct));
|
||||||
if (rawptr == NULL)
|
if (rawptr == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
abfd->tdata.bout_data = rawptr;
|
abfd->tdata.bout_data = rawptr;
|
||||||
exec_hdr (abfd) = &rawptr->e;
|
exec_hdr (abfd) = &rawptr->e;
|
||||||
|
|
||||||
/* For simplicity's sake we just make all the sections right here. */
|
|
||||||
obj_textsec (abfd) = (asection *) NULL;
|
obj_textsec (abfd) = (asection *) NULL;
|
||||||
obj_datasec (abfd) = (asection *) NULL;
|
obj_datasec (abfd) = (asection *) NULL;
|
||||||
obj_bsssec (abfd) = (asection *) NULL;
|
obj_bsssec (abfd) = (asection *) NULL;
|
||||||
|
|
||||||
bfd_make_section (abfd, ".text");
|
|
||||||
bfd_make_section (abfd, ".data");
|
|
||||||
bfd_make_section (abfd, ".bss");
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,6 +217,9 @@ os9k_write_object_contents (abfd)
|
||||||
{
|
{
|
||||||
struct external_exec swapped_hdr;
|
struct external_exec swapped_hdr;
|
||||||
|
|
||||||
|
if (! aout_32_make_sections (abfd))
|
||||||
|
return false;
|
||||||
|
|
||||||
exec_hdr (abfd)->a_info = BMAGIC;
|
exec_hdr (abfd)->a_info = BMAGIC;
|
||||||
|
|
||||||
exec_hdr (abfd)->a_text = obj_textsec (abfd)->_raw_size;
|
exec_hdr (abfd)->a_text = obj_textsec (abfd)->_raw_size;
|
||||||
|
@ -288,12 +283,8 @@ os9k_set_section_contents (abfd, section, location, offset, count)
|
||||||
|
|
||||||
if (abfd->output_has_begun == false)
|
if (abfd->output_has_begun == false)
|
||||||
{ /* set by bfd.c handler */
|
{ /* set by bfd.c handler */
|
||||||
if ((obj_textsec (abfd) == NULL) || (obj_datasec (abfd) == NULL) /*||
|
if (! aout_32_make_sections (abfd))
|
||||||
(obj_textsec (abfd)->_cooked_size == 0) || (obj_datasec (abfd)->_cooked_size == 0)*/ )
|
return false;
|
||||||
{
|
|
||||||
bfd_set_error (bfd_error_invalid_operation);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
obj_textsec (abfd)->filepos = sizeof (struct internal_exec);
|
obj_textsec (abfd)->filepos = sizeof (struct internal_exec);
|
||||||
obj_datasec (abfd)->filepos = obj_textsec (abfd)->filepos
|
obj_datasec (abfd)->filepos = obj_textsec (abfd)->filepos
|
||||||
|
@ -329,14 +320,18 @@ os9k_sizeof_headers (ignore_abfd, ignore)
|
||||||
|
|
||||||
#define aout_32_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
|
#define aout_32_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
|
||||||
|
|
||||||
|
#define aout_32_get_section_contents_in_window \
|
||||||
|
_bfd_generic_get_section_contents_in_window
|
||||||
|
|
||||||
#define os9k_bfd_get_relocated_section_contents \
|
#define os9k_bfd_get_relocated_section_contents \
|
||||||
bfd_generic_get_relocated_section_contents
|
bfd_generic_get_relocated_section_contents
|
||||||
#define os9k_bfd_relax_section bfd_generic_relax_section
|
#define os9k_bfd_relax_section bfd_generic_relax_section
|
||||||
#define os9k_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
#define os9k_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||||
#define os9k_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
#define os9k_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||||
#define os9k_bfd_final_link _bfd_generic_final_link
|
#define os9k_bfd_final_link _bfd_generic_final_link
|
||||||
|
#define os9k_bfd_link_split_section _bfd_generic_link_split_section
|
||||||
|
|
||||||
bfd_target i386os9k_vec =
|
const bfd_target i386os9k_vec =
|
||||||
{
|
{
|
||||||
"i386os9k", /* name */
|
"i386os9k", /* name */
|
||||||
bfd_target_os9k_flavour,
|
bfd_target_os9k_flavour,
|
||||||
|
@ -347,7 +342,6 @@ bfd_target i386os9k_vec =
|
||||||
0, /* symbol leading char */
|
0, /* symbol leading char */
|
||||||
' ', /* ar_pad_char */
|
' ', /* ar_pad_char */
|
||||||
16, /* ar_max_namelen */
|
16, /* ar_max_namelen */
|
||||||
2, /* minumum alignment power */
|
|
||||||
|
|
||||||
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||||
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||||
|
|
60
bfd/ieee.c
60
bfd/ieee.c
|
@ -201,10 +201,7 @@ read_id (ieee)
|
||||||
/* Buy memory and read string */
|
/* Buy memory and read string */
|
||||||
string = bfd_alloc (ieee->abfd, length + 1);
|
string = bfd_alloc (ieee->abfd, length + 1);
|
||||||
if (!string)
|
if (!string)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
bfd_get_string (ieee, string, length);
|
bfd_get_string (ieee, string, length);
|
||||||
string[length] = 0;
|
string[length] = 0;
|
||||||
return string;
|
return string;
|
||||||
|
@ -574,10 +571,7 @@ get_symbol (abfd,
|
||||||
ieee_symbol_type *new_symbol = (ieee_symbol_type *) bfd_alloc (ieee->h.abfd,
|
ieee_symbol_type *new_symbol = (ieee_symbol_type *) bfd_alloc (ieee->h.abfd,
|
||||||
sizeof (ieee_symbol_type));
|
sizeof (ieee_symbol_type));
|
||||||
if (!new_symbol)
|
if (!new_symbol)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
new_symbol->index = new_index;
|
new_symbol->index = new_index;
|
||||||
last_index = new_index;
|
last_index = new_index;
|
||||||
|
@ -876,10 +870,7 @@ get_section_entry (abfd, ieee, index)
|
||||||
asection *section;
|
asection *section;
|
||||||
|
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
sprintf (tmp, " fsec%4d", index);
|
sprintf (tmp, " fsec%4d", index);
|
||||||
section = bfd_make_section (abfd, tmp);
|
section = bfd_make_section (abfd, tmp);
|
||||||
ieee->section_table[index] = section;
|
ieee->section_table[index] = section;
|
||||||
|
@ -1070,10 +1061,7 @@ ieee_archive_p (abfd)
|
||||||
ieee_ar_data_type *ieee;
|
ieee_ar_data_type *ieee;
|
||||||
abfd->tdata.ieee_ar_data = (ieee_ar_data_type *) bfd_alloc (abfd, sizeof (ieee_ar_data_type));
|
abfd->tdata.ieee_ar_data = (ieee_ar_data_type *) bfd_alloc (abfd, sizeof (ieee_ar_data_type));
|
||||||
if (!abfd->tdata.ieee_ar_data)
|
if (!abfd->tdata.ieee_ar_data)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
ieee = IEEE_AR_DATA (abfd);
|
ieee = IEEE_AR_DATA (abfd);
|
||||||
|
|
||||||
/* FIXME: Check return value. I'm not sure whether it needs to read
|
/* FIXME: Check return value. I'm not sure whether it needs to read
|
||||||
|
@ -1243,7 +1231,7 @@ ieee_object_p (abfd)
|
||||||
/* Determine the architecture and machine type of the object file.
|
/* Determine the architecture and machine type of the object file.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
bfd_arch_info_type *arch = bfd_scan_arch (processor);
|
const bfd_arch_info_type *arch = bfd_scan_arch (processor);
|
||||||
if (arch == 0)
|
if (arch == 0)
|
||||||
goto got_wrong_format;
|
goto got_wrong_format;
|
||||||
abfd->arch_info = arch;
|
abfd->arch_info = arch;
|
||||||
|
@ -1297,10 +1285,7 @@ ieee_object_p (abfd)
|
||||||
IEEE_DATA (abfd)->h.first_byte = (unsigned char *) bfd_alloc (ieee->h.abfd, ieee->w.r.me_record
|
IEEE_DATA (abfd)->h.first_byte = (unsigned char *) bfd_alloc (ieee->h.abfd, ieee->w.r.me_record
|
||||||
+ 50);
|
+ 50);
|
||||||
if (!IEEE_DATA (abfd)->h.first_byte)
|
if (!IEEE_DATA (abfd)->h.first_byte)
|
||||||
{
|
goto fail;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
|
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
/* FIXME: Check return value. I'm not sure whether it needs to read
|
/* FIXME: Check return value. I'm not sure whether it needs to read
|
||||||
|
@ -1421,10 +1406,7 @@ do_one (ieee, current_map, location_ptr, s)
|
||||||
(ieee_reloc_type *) bfd_alloc (ieee->h.abfd,
|
(ieee_reloc_type *) bfd_alloc (ieee->h.abfd,
|
||||||
sizeof (ieee_reloc_type));
|
sizeof (ieee_reloc_type));
|
||||||
if (!r)
|
if (!r)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
*(current_map->reloc_tail_ptr) = r;
|
*(current_map->reloc_tail_ptr) = r;
|
||||||
current_map->reloc_tail_ptr = &r->next;
|
current_map->reloc_tail_ptr = &r->next;
|
||||||
|
@ -1595,10 +1577,7 @@ ieee_slurp_section_data (abfd)
|
||||||
ieee_per_section_type *per = (ieee_per_section_type *) s->used_by_bfd;
|
ieee_per_section_type *per = (ieee_per_section_type *) s->used_by_bfd;
|
||||||
per->data = (bfd_byte *) bfd_alloc (ieee->h.abfd, s->_raw_size);
|
per->data = (bfd_byte *) bfd_alloc (ieee->h.abfd, s->_raw_size);
|
||||||
if (!per->data)
|
if (!per->data)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
/*SUPPRESS 68*/
|
/*SUPPRESS 68*/
|
||||||
per->reloc_tail_ptr =
|
per->reloc_tail_ptr =
|
||||||
(ieee_reloc_type **) & (s->relocation);
|
(ieee_reloc_type **) & (s->relocation);
|
||||||
|
@ -1708,10 +1687,7 @@ ieee_new_section_hook (abfd, newsect)
|
||||||
newsect->used_by_bfd = (PTR)
|
newsect->used_by_bfd = (PTR)
|
||||||
bfd_alloc (abfd, sizeof (ieee_per_section_type));
|
bfd_alloc (abfd, sizeof (ieee_per_section_type));
|
||||||
if (!newsect->used_by_bfd)
|
if (!newsect->used_by_bfd)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ieee_per_section (newsect)->data = (bfd_byte *) NULL;
|
ieee_per_section (newsect)->data = (bfd_byte *) NULL;
|
||||||
ieee_per_section (newsect)->section = newsect;
|
ieee_per_section (newsect)->section = newsect;
|
||||||
return true;
|
return true;
|
||||||
|
@ -1933,10 +1909,7 @@ do_with_relocs (abfd, s)
|
||||||
/* Outputting a section without data, fill it up */
|
/* Outputting a section without data, fill it up */
|
||||||
stream = (unsigned char *) (bfd_alloc (abfd, s->_raw_size));
|
stream = (unsigned char *) (bfd_alloc (abfd, s->_raw_size));
|
||||||
if (!stream)
|
if (!stream)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
memset ((PTR) stream, 0, (size_t) s->_raw_size);
|
memset ((PTR) stream, 0, (size_t) s->_raw_size);
|
||||||
}
|
}
|
||||||
while (current_byte_index < s->_raw_size)
|
while (current_byte_index < s->_raw_size)
|
||||||
|
@ -2903,10 +2876,7 @@ init_for_output (abfd)
|
||||||
{
|
{
|
||||||
ieee_per_section (s)->data = (bfd_byte *) (bfd_alloc (abfd, s->_raw_size));
|
ieee_per_section (s)->data = (bfd_byte *) (bfd_alloc (abfd, s->_raw_size));
|
||||||
if (!ieee_per_section (s)->data)
|
if (!ieee_per_section (s)->data)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -3325,10 +3295,7 @@ ieee_bfd_debug_info_accumulate (abfd, section)
|
||||||
{
|
{
|
||||||
bfd_chain_type *n = (bfd_chain_type *) bfd_alloc (abfd, sizeof (bfd_chain_type));
|
bfd_chain_type *n = (bfd_chain_type *) bfd_alloc (abfd, sizeof (bfd_chain_type));
|
||||||
if (!n)
|
if (!n)
|
||||||
{
|
abort (); /* FIXME */
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
abort (); /* FIXME */
|
|
||||||
}
|
|
||||||
n->this = section->owner;
|
n->this = section->owner;
|
||||||
n->next = (bfd_chain_type *) NULL;
|
n->next = (bfd_chain_type *) NULL;
|
||||||
|
|
||||||
|
@ -3360,6 +3327,7 @@ ieee_bfd_debug_info_accumulate (abfd, section)
|
||||||
((boolean (*) \
|
((boolean (*) \
|
||||||
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \
|
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \
|
||||||
bfd_true)
|
bfd_true)
|
||||||
|
#define ieee_read_ar_hdr bfd_nullvoidptr
|
||||||
#define ieee_update_armap_timestamp bfd_true
|
#define ieee_update_armap_timestamp bfd_true
|
||||||
|
|
||||||
#define ieee_bfd_is_local_label bfd_generic_is_local_label
|
#define ieee_bfd_is_local_label bfd_generic_is_local_label
|
||||||
|
@ -3372,6 +3340,8 @@ ieee_bfd_debug_info_accumulate (abfd, section)
|
||||||
|
|
||||||
#define ieee_set_arch_mach _bfd_generic_set_arch_mach
|
#define ieee_set_arch_mach _bfd_generic_set_arch_mach
|
||||||
|
|
||||||
|
#define ieee_get_section_contents_in_window \
|
||||||
|
_bfd_generic_get_section_contents_in_window
|
||||||
#define ieee_bfd_get_relocated_section_contents \
|
#define ieee_bfd_get_relocated_section_contents \
|
||||||
bfd_generic_get_relocated_section_contents
|
bfd_generic_get_relocated_section_contents
|
||||||
#define ieee_bfd_relax_section bfd_generic_relax_section
|
#define ieee_bfd_relax_section bfd_generic_relax_section
|
||||||
|
|
28
bfd/libbfd.c
28
bfd/libbfd.c
|
@ -165,8 +165,13 @@ bfd_zmalloc (size)
|
||||||
{
|
{
|
||||||
char *ptr = (char *) malloc ((size_t) size);
|
char *ptr = (char *) malloc ((size_t) size);
|
||||||
|
|
||||||
if (ptr && size)
|
if (size != 0)
|
||||||
memset(ptr, 0, (size_t) size);
|
{
|
||||||
|
if (ptr == NULL)
|
||||||
|
bfd_set_error (bfd_error_no_memory);
|
||||||
|
else
|
||||||
|
memset (ptr, 0, (size_t) size);
|
||||||
|
}
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
@ -252,7 +257,7 @@ bfd_init_window (windowp)
|
||||||
|
|
||||||
#undef HAVE_MPROTECT /* code's not tested yet */
|
#undef HAVE_MPROTECT /* code's not tested yet */
|
||||||
|
|
||||||
#if HAVE_MMAP || HAVE_MPROTECT
|
#if HAVE_MMAP || HAVE_MPROTECT || HAVE_MADVISE
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -263,6 +268,12 @@ bfd_init_window (windowp)
|
||||||
|
|
||||||
static int debug_windows;
|
static int debug_windows;
|
||||||
|
|
||||||
|
/* Currently, if USE_MMAP is undefined, none if the window stuff is
|
||||||
|
used. Okay, so it's mis-named. At least the command-line option
|
||||||
|
"--without-mmap" is more obvious than "--without-windows" or some
|
||||||
|
such. */
|
||||||
|
#ifdef USE_MMAP
|
||||||
|
|
||||||
void
|
void
|
||||||
bfd_free_window (windowp)
|
bfd_free_window (windowp)
|
||||||
bfd_window *windowp;
|
bfd_window *windowp;
|
||||||
|
@ -299,6 +310,7 @@ bfd_free_window (windowp)
|
||||||
/* There should be no more references to i at this point. */
|
/* There should be no more references to i at this point. */
|
||||||
free (i);
|
free (i);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int ok_to_map = 1;
|
static int ok_to_map = 1;
|
||||||
|
|
||||||
|
@ -314,6 +326,10 @@ bfd_get_file_window (abfd, offset, size, windowp, writable)
|
||||||
bfd_window_internal *i = windowp->i;
|
bfd_window_internal *i = windowp->i;
|
||||||
size_t size_to_alloc = size;
|
size_t size_to_alloc = size;
|
||||||
|
|
||||||
|
#ifndef USE_MMAP
|
||||||
|
abort ();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (debug_windows)
|
if (debug_windows)
|
||||||
fprintf (stderr, "bfd_get_file_window (%p, %6ld, %6ld, %p<%p,%lx,%p>, %d)",
|
fprintf (stderr, "bfd_get_file_window (%p, %6ld, %6ld, %p<%p,%lx,%p>, %d)",
|
||||||
abfd, (long) offset, (long) size,
|
abfd, (long) offset, (long) size,
|
||||||
|
@ -386,7 +402,7 @@ bfd_get_file_window (abfd, offset, size, windowp, writable)
|
||||||
fprintf (stderr, "\n\tmapped %ld at %p, offset is %ld\n",
|
fprintf (stderr, "\n\tmapped %ld at %p, offset is %ld\n",
|
||||||
(long) real_size, i->data, (long) offset2);
|
(long) real_size, i->data, (long) offset2);
|
||||||
i->size = real_size;
|
i->size = real_size;
|
||||||
windowp->data = i->data + offset2;
|
windowp->data = (PTR) ((bfd_byte *) i->data + offset2);
|
||||||
windowp->size = size;
|
windowp->size = size;
|
||||||
i->mapped = 1;
|
i->mapped = 1;
|
||||||
return true;
|
return true;
|
||||||
|
@ -1014,6 +1030,7 @@ _bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count)
|
||||||
file_ptr offset;
|
file_ptr offset;
|
||||||
bfd_size_type count;
|
bfd_size_type count;
|
||||||
{
|
{
|
||||||
|
#ifdef USE_MMAP
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
return true;
|
return true;
|
||||||
if (abfd->xvec->_bfd_get_section_contents != _bfd_generic_get_section_contents)
|
if (abfd->xvec->_bfd_get_section_contents != _bfd_generic_get_section_contents)
|
||||||
|
@ -1045,6 +1062,9 @@ _bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count)
|
||||||
== false))
|
== false))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
#else
|
||||||
|
abort ();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This generic function can only be used in implementations where creating
|
/* This generic function can only be used in implementations where creating
|
||||||
|
|
51
bfd/linker.c
51
bfd/linker.c
|
@ -594,10 +594,7 @@ _bfd_generic_link_hash_table_create (abfd)
|
||||||
ret = ((struct generic_link_hash_table *)
|
ret = ((struct generic_link_hash_table *)
|
||||||
bfd_alloc (abfd, sizeof (struct generic_link_hash_table)));
|
bfd_alloc (abfd, sizeof (struct generic_link_hash_table)));
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
return (struct bfd_link_hash_table *) NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (struct bfd_link_hash_table *) NULL;
|
|
||||||
}
|
|
||||||
if (! _bfd_link_hash_table_init (&ret->root, abfd,
|
if (! _bfd_link_hash_table_init (&ret->root, abfd,
|
||||||
generic_link_hash_newfunc))
|
generic_link_hash_newfunc))
|
||||||
{
|
{
|
||||||
|
@ -628,10 +625,7 @@ generic_link_read_symbols (abfd)
|
||||||
return false;
|
return false;
|
||||||
abfd->outsymbols = (asymbol **) bfd_alloc (abfd, symsize);
|
abfd->outsymbols = (asymbol **) bfd_alloc (abfd, symsize);
|
||||||
if (abfd->outsymbols == NULL && symsize != 0)
|
if (abfd->outsymbols == NULL && symsize != 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
symcount = bfd_canonicalize_symtab (abfd, abfd->outsymbols);
|
symcount = bfd_canonicalize_symtab (abfd, abfd->outsymbols);
|
||||||
if (symcount < 0)
|
if (symcount < 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1188,16 +1182,21 @@ generic_link_add_symbol_list (abfd, info, symbol_count, symbols, collect)
|
||||||
struct generic_link_hash_entry *h;
|
struct generic_link_hash_entry *h;
|
||||||
|
|
||||||
name = bfd_asymbol_name (p);
|
name = bfd_asymbol_name (p);
|
||||||
if ((p->flags & BSF_INDIRECT) != 0
|
if (((p->flags & BSF_INDIRECT) != 0
|
||||||
|| bfd_is_ind_section (p->section))
|
|| bfd_is_ind_section (p->section))
|
||||||
string = bfd_asymbol_name ((asymbol *) p->value);
|
&& pp + 1 < ppend)
|
||||||
else if ((p->flags & BSF_WARNING) != 0)
|
{
|
||||||
|
pp++;
|
||||||
|
string = bfd_asymbol_name (*pp);
|
||||||
|
}
|
||||||
|
else if ((p->flags & BSF_WARNING) != 0
|
||||||
|
&& pp + 1 < ppend)
|
||||||
{
|
{
|
||||||
/* The name of P is actually the warning string, and the
|
/* The name of P is actually the warning string, and the
|
||||||
value is actually a pointer to the symbol to warn
|
next symbol is the one to warn about. */
|
||||||
about. */
|
|
||||||
string = name;
|
string = name;
|
||||||
name = bfd_asymbol_name ((asymbol *) p->value);
|
pp++;
|
||||||
|
name = bfd_asymbol_name (*pp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
string = NULL;
|
string = NULL;
|
||||||
|
@ -1495,7 +1494,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
|
||||||
case DEF:
|
case DEF:
|
||||||
case DEFW:
|
case DEFW:
|
||||||
{
|
{
|
||||||
enum bfd_link_order_type oldtype;
|
enum bfd_link_hash_type oldtype;
|
||||||
|
|
||||||
/* Define a symbol. */
|
/* Define a symbol. */
|
||||||
oldtype = h->type;
|
oldtype = h->type;
|
||||||
|
@ -1928,10 +1927,7 @@ _bfd_generic_final_link (abfd, info)
|
||||||
(o->reloc_count
|
(o->reloc_count
|
||||||
* sizeof (arelent *))));
|
* sizeof (arelent *))));
|
||||||
if (!o->orelocation)
|
if (!o->orelocation)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
o->flags |= SEC_RELOC;
|
o->flags |= SEC_RELOC;
|
||||||
/* Reset the count so that it can be used as an index
|
/* Reset the count so that it can be used as an index
|
||||||
when putting in the output relocs. */
|
when putting in the output relocs. */
|
||||||
|
@ -2360,10 +2356,7 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order)
|
||||||
|
|
||||||
r = (arelent *) bfd_alloc (abfd, sizeof (arelent));
|
r = (arelent *) bfd_alloc (abfd, sizeof (arelent));
|
||||||
if (r == (arelent *) NULL)
|
if (r == (arelent *) NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
r->address = link_order->offset;
|
r->address = link_order->offset;
|
||||||
r->howto = bfd_reloc_type_lookup (abfd, link_order->u.reloc.p->reloc);
|
r->howto = bfd_reloc_type_lookup (abfd, link_order->u.reloc.p->reloc);
|
||||||
|
@ -2410,10 +2403,7 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order)
|
||||||
size = bfd_get_reloc_size (r->howto);
|
size = bfd_get_reloc_size (r->howto);
|
||||||
buf = (bfd_byte *) bfd_zmalloc (size);
|
buf = (bfd_byte *) bfd_zmalloc (size);
|
||||||
if (buf == (bfd_byte *) NULL)
|
if (buf == (bfd_byte *) NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
rstat = _bfd_relocate_contents (r->howto, abfd,
|
rstat = _bfd_relocate_contents (r->howto, abfd,
|
||||||
link_order->u.reloc.p->addend, buf);
|
link_order->u.reloc.p->addend, buf);
|
||||||
switch (rstat)
|
switch (rstat)
|
||||||
|
@ -2464,10 +2454,7 @@ bfd_new_link_order (abfd, section)
|
||||||
new = ((struct bfd_link_order *)
|
new = ((struct bfd_link_order *)
|
||||||
bfd_alloc_by_size_t (abfd, sizeof (struct bfd_link_order)));
|
bfd_alloc_by_size_t (abfd, sizeof (struct bfd_link_order)));
|
||||||
if (!new)
|
if (!new)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
new->type = bfd_undefined_link_order;
|
new->type = bfd_undefined_link_order;
|
||||||
new->offset = 0;
|
new->offset = 0;
|
||||||
|
|
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
/* This file describes the 32 bit Alpha NLM format. You might think
|
/* This file describes the 32 bit Alpha NLM format. You might think
|
||||||
that an Alpha chip would use a 64 bit format, but, for some reason,
|
that an Alpha chip would use a 64 bit format, but, for some reason,
|
||||||
|
@ -461,7 +461,7 @@ nlm_alpha_read_reloc (abfd, sym, secp, rel)
|
||||||
|| r_type == ALPHA_R_GPDISP
|
|| r_type == ALPHA_R_GPDISP
|
||||||
|| r_type == ALPHA_R_IGNORE)
|
|| r_type == ALPHA_R_IGNORE)
|
||||||
{
|
{
|
||||||
rel->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
|
rel->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
||||||
rel->addend = 0;
|
rel->addend = 0;
|
||||||
}
|
}
|
||||||
else if (r_symndx == ALPHA_RELOC_SECTION_TEXT)
|
else if (r_symndx == ALPHA_RELOC_SECTION_TEXT)
|
||||||
|
@ -478,7 +478,7 @@ nlm_alpha_read_reloc (abfd, sym, secp, rel)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BFD_ASSERT (0);
|
BFD_ASSERT (0);
|
||||||
rel->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
|
rel->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
||||||
rel->addend = 0;
|
rel->addend = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,7 +531,7 @@ nlm_alpha_read_reloc (abfd, sym, secp, rel)
|
||||||
addend, but they do use a special code. Put this code in the
|
addend, but they do use a special code. Put this code in the
|
||||||
addend field. */
|
addend field. */
|
||||||
rel->addend = r_symndx;
|
rel->addend = r_symndx;
|
||||||
rel->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
|
rel->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ALPHA_R_OP_STORE:
|
case ALPHA_R_OP_STORE:
|
||||||
|
@ -562,7 +562,7 @@ nlm_alpha_read_reloc (abfd, sym, secp, rel)
|
||||||
some reason the address of this reloc type is not adjusted by
|
some reason the address of this reloc type is not adjusted by
|
||||||
the section vma. We record the gp value for this object file
|
the section vma. We record the gp value for this object file
|
||||||
here, for convenience when doing the GPDISP relocation. */
|
here, for convenience when doing the GPDISP relocation. */
|
||||||
rel->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
|
rel->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
||||||
rel->address = r_vaddr;
|
rel->address = r_vaddr;
|
||||||
rel->addend = gp_value;
|
rel->addend = gp_value;
|
||||||
break;
|
break;
|
||||||
|
@ -584,7 +584,7 @@ nlm_alpha_read_reloc (abfd, sym, secp, rel)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
BFD_ASSERT (0);
|
BFD_ASSERT (0);
|
||||||
rel->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
|
rel->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -623,33 +623,29 @@ nlm_alpha_read_import (abfd, sym)
|
||||||
bfd_size_type rcount; /* number of relocs */
|
bfd_size_type rcount; /* number of relocs */
|
||||||
bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* temporary 32-bit value */
|
bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* temporary 32-bit value */
|
||||||
unsigned char symlength; /* length of symbol name */
|
unsigned char symlength; /* length of symbol name */
|
||||||
|
char *name;
|
||||||
|
|
||||||
if (bfd_read ((PTR) &symlength, sizeof (symlength), 1, abfd)
|
if (bfd_read ((PTR) &symlength, sizeof (symlength), 1, abfd)
|
||||||
!= sizeof (symlength))
|
!= sizeof (symlength))
|
||||||
return false;
|
return false;
|
||||||
sym -> symbol.the_bfd = abfd;
|
sym -> symbol.the_bfd = abfd;
|
||||||
sym -> symbol.name = bfd_alloc (abfd, symlength + 1);
|
name = bfd_alloc (abfd, symlength + 1);
|
||||||
if (!sym -> symbol.name)
|
if (name == NULL)
|
||||||
{
|
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (bfd_read ((PTR) sym -> symbol.name, symlength, 1, abfd)
|
|
||||||
!= symlength)
|
|
||||||
return false;
|
return false;
|
||||||
|
if (bfd_read (name, symlength, 1, abfd) != symlength)
|
||||||
|
return false;
|
||||||
|
name[symlength] = '\0';
|
||||||
|
sym -> symbol.name = name;
|
||||||
sym -> symbol.flags = 0;
|
sym -> symbol.flags = 0;
|
||||||
sym -> symbol.value = 0;
|
sym -> symbol.value = 0;
|
||||||
sym -> symbol.section = &bfd_und_section;
|
sym -> symbol.section = bfd_und_section_ptr;
|
||||||
if (bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp))
|
if (bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp))
|
||||||
return false;
|
return false;
|
||||||
rcount = bfd_h_get_32 (abfd, temp);
|
rcount = bfd_h_get_32 (abfd, temp);
|
||||||
nlm_relocs = ((struct nlm_relent *)
|
nlm_relocs = ((struct nlm_relent *)
|
||||||
bfd_alloc (abfd, rcount * sizeof (struct nlm_relent)));
|
bfd_alloc (abfd, rcount * sizeof (struct nlm_relent)));
|
||||||
if (!nlm_relocs)
|
if (!nlm_relocs)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
sym -> relocs = nlm_relocs;
|
sym -> relocs = nlm_relocs;
|
||||||
sym -> rcnt = 0;
|
sym -> rcnt = 0;
|
||||||
while (sym -> rcnt < rcount)
|
while (sym -> rcnt < rcount)
|
||||||
|
@ -693,7 +689,7 @@ nlm_alpha_write_import (abfd, sec, rel)
|
||||||
r_vaddr += bfd_section_size (abfd,
|
r_vaddr += bfd_section_size (abfd,
|
||||||
bfd_get_section_by_name (abfd,
|
bfd_get_section_by_name (abfd,
|
||||||
NLM_CODE_NAME));
|
NLM_CODE_NAME));
|
||||||
if (bfd_get_section (sym) == &bfd_und_section)
|
if (bfd_is_und_section (bfd_get_section (sym)))
|
||||||
{
|
{
|
||||||
r_extern = 1;
|
r_extern = 1;
|
||||||
r_symndx = 0;
|
r_symndx = 0;
|
||||||
|
@ -842,7 +838,7 @@ nlm_alpha_write_external (abfd, count, sym, relocs)
|
||||||
|
|
||||||
/* The first two relocs for each external symbol are the .lita
|
/* The first two relocs for each external symbol are the .lita
|
||||||
address and the GP value. */
|
address and the GP value. */
|
||||||
r.sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
|
r.sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
||||||
r.howto = &nlm32_alpha_nw_howto;
|
r.howto = &nlm32_alpha_nw_howto;
|
||||||
|
|
||||||
r.address = nlm_alpha_backend_data (abfd)->lita_address;
|
r.address = nlm_alpha_backend_data (abfd)->lita_address;
|
||||||
|
|
|
@ -18,7 +18,7 @@ GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <string.h> /* For strrchr and friends */
|
#include <string.h> /* For strrchr and friends */
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
|
@ -114,7 +114,7 @@ nlm_object_p (abfd)
|
||||||
|
|
||||||
/* Read in the fixed length portion of the NLM header in external format. */
|
/* Read in the fixed length portion of the NLM header in external format. */
|
||||||
|
|
||||||
x_fxdhdr = (PTR) malloc (nlm_fixed_header_size (abfd));
|
x_fxdhdr = (PTR) malloc ((size_t) nlm_fixed_header_size (abfd));
|
||||||
if (x_fxdhdr == NULL)
|
if (x_fxdhdr == NULL)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
bfd_set_error (bfd_error_no_memory);
|
||||||
|
@ -136,10 +136,7 @@ nlm_object_p (abfd)
|
||||||
new_tdata = ((struct nlm_obj_tdata *)
|
new_tdata = ((struct nlm_obj_tdata *)
|
||||||
bfd_zalloc (abfd, sizeof (struct nlm_obj_tdata)));
|
bfd_zalloc (abfd, sizeof (struct nlm_obj_tdata)));
|
||||||
if (new_tdata == NULL)
|
if (new_tdata == NULL)
|
||||||
{
|
goto got_no_match;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto got_no_match;
|
|
||||||
}
|
|
||||||
|
|
||||||
nlm_tdata (abfd) = new_tdata;
|
nlm_tdata (abfd) = new_tdata;
|
||||||
|
|
||||||
|
@ -274,7 +271,7 @@ nlm_swap_variable_header_in (abfd)
|
||||||
if (bfd_read ((PTR) nlm_variable_header (abfd)->descriptionText,
|
if (bfd_read ((PTR) nlm_variable_header (abfd)->descriptionText,
|
||||||
nlm_variable_header (abfd)->descriptionLength + 1,
|
nlm_variable_header (abfd)->descriptionLength + 1,
|
||||||
1, abfd) !=
|
1, abfd) !=
|
||||||
nlm_variable_header (abfd)->descriptionLength + 1)
|
(bfd_size_type) nlm_variable_header (abfd)->descriptionLength + 1)
|
||||||
return (false);
|
return (false);
|
||||||
|
|
||||||
/* Read and convert the stackSize field. */
|
/* Read and convert the stackSize field. */
|
||||||
|
@ -307,7 +304,7 @@ nlm_swap_variable_header_in (abfd)
|
||||||
if (bfd_read ((PTR) nlm_variable_header (abfd)->screenName,
|
if (bfd_read ((PTR) nlm_variable_header (abfd)->screenName,
|
||||||
nlm_variable_header (abfd)->screenNameLength + 1,
|
nlm_variable_header (abfd)->screenNameLength + 1,
|
||||||
1, abfd) !=
|
1, abfd) !=
|
||||||
nlm_variable_header (abfd)->screenNameLength + 1)
|
(bfd_size_type) nlm_variable_header (abfd)->screenNameLength + 1)
|
||||||
return (false);
|
return (false);
|
||||||
|
|
||||||
/* Read the thread name length and text members. */
|
/* Read the thread name length and text members. */
|
||||||
|
@ -320,7 +317,7 @@ nlm_swap_variable_header_in (abfd)
|
||||||
if (bfd_read ((PTR) nlm_variable_header (abfd)->threadName,
|
if (bfd_read ((PTR) nlm_variable_header (abfd)->threadName,
|
||||||
nlm_variable_header (abfd)->threadNameLength + 1,
|
nlm_variable_header (abfd)->threadNameLength + 1,
|
||||||
1, abfd) !=
|
1, abfd) !=
|
||||||
nlm_variable_header (abfd)->threadNameLength + 1)
|
(bfd_size_type) nlm_variable_header (abfd)->threadNameLength + 1)
|
||||||
return (false);
|
return (false);
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
@ -344,7 +341,7 @@ nlm_swap_variable_header_out (abfd)
|
||||||
if (bfd_write ((PTR) nlm_variable_header (abfd)->descriptionText,
|
if (bfd_write ((PTR) nlm_variable_header (abfd)->descriptionText,
|
||||||
nlm_variable_header (abfd)->descriptionLength + 1,
|
nlm_variable_header (abfd)->descriptionLength + 1,
|
||||||
1, abfd) !=
|
1, abfd) !=
|
||||||
nlm_variable_header (abfd)->descriptionLength + 1)
|
(bfd_size_type) nlm_variable_header (abfd)->descriptionLength + 1)
|
||||||
return (false);
|
return (false);
|
||||||
|
|
||||||
/* Convert and write the stackSize field. */
|
/* Convert and write the stackSize field. */
|
||||||
|
@ -379,7 +376,7 @@ nlm_swap_variable_header_out (abfd)
|
||||||
if (bfd_write ((PTR) nlm_variable_header (abfd)->screenName,
|
if (bfd_write ((PTR) nlm_variable_header (abfd)->screenName,
|
||||||
nlm_variable_header (abfd)->screenNameLength + 1,
|
nlm_variable_header (abfd)->screenNameLength + 1,
|
||||||
1, abfd) !=
|
1, abfd) !=
|
||||||
nlm_variable_header (abfd)->screenNameLength + 1)
|
(bfd_size_type) nlm_variable_header (abfd)->screenNameLength + 1)
|
||||||
return (false);
|
return (false);
|
||||||
|
|
||||||
/* Write the thread name length and text members. */
|
/* Write the thread name length and text members. */
|
||||||
|
@ -392,7 +389,7 @@ nlm_swap_variable_header_out (abfd)
|
||||||
if (bfd_write ((PTR) nlm_variable_header (abfd)->threadName,
|
if (bfd_write ((PTR) nlm_variable_header (abfd)->threadName,
|
||||||
nlm_variable_header (abfd)->threadNameLength + 1,
|
nlm_variable_header (abfd)->threadNameLength + 1,
|
||||||
1, abfd) !=
|
1, abfd) !=
|
||||||
nlm_variable_header (abfd)->threadNameLength + 1)
|
(bfd_size_type) nlm_variable_header (abfd)->threadNameLength + 1)
|
||||||
return (false);
|
return (false);
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
@ -522,7 +519,8 @@ nlm_swap_auxiliary_headers_in (abfd)
|
||||||
if (bfd_read ((PTR) nlm_copyright_header (abfd)->copyrightMessage,
|
if (bfd_read ((PTR) nlm_copyright_header (abfd)->copyrightMessage,
|
||||||
nlm_copyright_header (abfd)->copyrightMessageLength + 1,
|
nlm_copyright_header (abfd)->copyrightMessageLength + 1,
|
||||||
1, abfd) !=
|
1, abfd) !=
|
||||||
nlm_copyright_header (abfd)->copyrightMessageLength + 1)
|
((bfd_size_type)
|
||||||
|
nlm_copyright_header (abfd)->copyrightMessageLength + 1))
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
else if (strncmp (tempstr, "CuStHeAd", 8) == 0)
|
else if (strncmp (tempstr, "CuStHeAd", 8) == 0)
|
||||||
|
@ -584,10 +582,7 @@ nlm_swap_auxiliary_headers_in (abfd)
|
||||||
hdrLength -= 2 * NLM_TARGET_LONG_SIZE + 8;
|
hdrLength -= 2 * NLM_TARGET_LONG_SIZE + 8;
|
||||||
hdr = bfd_alloc (abfd, hdrLength);
|
hdr = bfd_alloc (abfd, hdrLength);
|
||||||
if (hdr == NULL)
|
if (hdr == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (bfd_read (hdr, 1, hdrLength, abfd) != hdrLength)
|
if (bfd_read (hdr, 1, hdrLength, abfd) != hdrLength)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -608,10 +603,7 @@ nlm_swap_auxiliary_headers_in (abfd)
|
||||||
return false;
|
return false;
|
||||||
contents = (bfd_byte *) bfd_alloc (abfd, dataLength);
|
contents = (bfd_byte *) bfd_alloc (abfd, dataLength);
|
||||||
if (contents == NULL)
|
if (contents == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (bfd_read (contents, 1, dataLength, abfd) != dataLength)
|
if (bfd_read (contents, 1, dataLength, abfd) != dataLength)
|
||||||
return false;
|
return false;
|
||||||
if (bfd_seek (abfd, pos, SEEK_SET) != 0)
|
if (bfd_seek (abfd, pos, SEEK_SET) != 0)
|
||||||
|
@ -851,7 +843,8 @@ nlm_swap_auxiliary_headers_out (abfd)
|
||||||
if (bfd_write ((PTR) nlm_copyright_header (abfd)->copyrightMessage,
|
if (bfd_write ((PTR) nlm_copyright_header (abfd)->copyrightMessage,
|
||||||
nlm_copyright_header (abfd)->copyrightMessageLength + 1,
|
nlm_copyright_header (abfd)->copyrightMessageLength + 1,
|
||||||
1, abfd) !=
|
1, abfd) !=
|
||||||
nlm_copyright_header (abfd)->copyrightMessageLength + 1)
|
((bfd_size_type)
|
||||||
|
nlm_copyright_header (abfd)->copyrightMessageLength + 1))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1077,10 +1070,7 @@ nlm_slurp_symbol_table (abfd)
|
||||||
sym = ((nlm_symbol_type *)
|
sym = ((nlm_symbol_type *)
|
||||||
bfd_zalloc (abfd, totsymcount * sizeof (nlm_symbol_type)));
|
bfd_zalloc (abfd, totsymcount * sizeof (nlm_symbol_type)));
|
||||||
if (!sym)
|
if (!sym)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
nlm_set_symbols (abfd, sym);
|
nlm_set_symbols (abfd, sym);
|
||||||
|
|
||||||
/* We use the bfd's symcount directly as the control count, so that early
|
/* We use the bfd's symcount directly as the control count, so that early
|
||||||
|
@ -1097,10 +1087,7 @@ nlm_slurp_symbol_table (abfd)
|
||||||
sym->symbol.the_bfd = abfd;
|
sym->symbol.the_bfd = abfd;
|
||||||
sym->symbol.name = bfd_alloc (abfd, symlength + 1);
|
sym->symbol.name = bfd_alloc (abfd, symlength + 1);
|
||||||
if (!sym->symbol.name)
|
if (!sym->symbol.name)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (bfd_read ((PTR) sym->symbol.name, symlength, 1, abfd)
|
if (bfd_read ((PTR) sym->symbol.name, symlength, 1, abfd)
|
||||||
!= symlength)
|
!= symlength)
|
||||||
return (false);
|
return (false);
|
||||||
|
@ -1156,10 +1143,7 @@ nlm_slurp_symbol_table (abfd)
|
||||||
sym->symbol.the_bfd = abfd;
|
sym->symbol.the_bfd = abfd;
|
||||||
sym->symbol.name = bfd_alloc (abfd, symlength + 1);
|
sym->symbol.name = bfd_alloc (abfd, symlength + 1);
|
||||||
if (!sym->symbol.name)
|
if (!sym->symbol.name)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (bfd_read ((PTR) sym->symbol.name, symlength, 1, abfd)
|
if (bfd_read ((PTR) sym->symbol.name, symlength, 1, abfd)
|
||||||
!= symlength)
|
!= symlength)
|
||||||
return (false);
|
return (false);
|
||||||
|
@ -1180,7 +1164,7 @@ nlm_slurp_symbol_table (abfd)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sym->symbol.section = &bfd_abs_section;
|
sym->symbol.section = bfd_abs_section_ptr;
|
||||||
}
|
}
|
||||||
sym->rcnt = 0;
|
sym->rcnt = 0;
|
||||||
abfd->symcount++;
|
abfd->symcount++;
|
||||||
|
@ -1248,10 +1232,7 @@ nlm_slurp_reloc_fixups (abfd)
|
||||||
rels = (arelent *) bfd_alloc (abfd, count * sizeof (arelent));
|
rels = (arelent *) bfd_alloc (abfd, count * sizeof (arelent));
|
||||||
secs = (asection **) bfd_alloc (abfd, count * sizeof (asection *));
|
secs = (asection **) bfd_alloc (abfd, count * sizeof (asection *));
|
||||||
if ((rels == NULL || secs == NULL) && count != 0)
|
if ((rels == NULL || secs == NULL) && count != 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
nlm_relocation_fixups (abfd) = rels;
|
nlm_relocation_fixups (abfd) = rels;
|
||||||
nlm_relocation_fixup_secs (abfd) = secs;
|
nlm_relocation_fixup_secs (abfd) = secs;
|
||||||
|
|
||||||
|
@ -1402,7 +1383,7 @@ nlm_compute_section_file_positions (abfd)
|
||||||
asection *sec;
|
asection *sec;
|
||||||
bfd_vma text, data, bss;
|
bfd_vma text, data, bss;
|
||||||
bfd_vma text_low, data_low;
|
bfd_vma text_low, data_low;
|
||||||
int text_align, data_align, other_align;
|
unsigned int text_align, data_align, other_align;
|
||||||
file_ptr text_ptr, data_ptr, other_ptr;
|
file_ptr text_ptr, data_ptr, other_ptr;
|
||||||
asection *bss_sec;
|
asection *bss_sec;
|
||||||
asymbol **sym_ptr_ptr;
|
asymbol **sym_ptr_ptr;
|
||||||
|
@ -1704,7 +1685,8 @@ nlm_write_object_contents (abfd)
|
||||||
boolean (*write_prefix_func) PARAMS ((bfd *));
|
boolean (*write_prefix_func) PARAMS ((bfd *));
|
||||||
unsigned char *fixed_header = NULL;
|
unsigned char *fixed_header = NULL;
|
||||||
|
|
||||||
fixed_header = (unsigned char *) malloc (nlm_fixed_header_size (abfd));
|
fixed_header = ((unsigned char *)
|
||||||
|
malloc ((size_t) nlm_fixed_header_size (abfd)));
|
||||||
if (fixed_header == NULL)
|
if (fixed_header == NULL)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
bfd_set_error (bfd_error_no_memory);
|
||||||
|
@ -1779,7 +1761,7 @@ nlm_write_object_contents (abfd)
|
||||||
rel = *rel_ptr_ptr;
|
rel = *rel_ptr_ptr;
|
||||||
sym = *rel->sym_ptr_ptr;
|
sym = *rel->sym_ptr_ptr;
|
||||||
|
|
||||||
if (bfd_get_section (sym) != &bfd_und_section)
|
if (! bfd_is_und_section (bfd_get_section (sym)))
|
||||||
{
|
{
|
||||||
++internal_reloc_count;
|
++internal_reloc_count;
|
||||||
if ((*write_import_func) (abfd, sec, rel) == false)
|
if ((*write_import_func) (abfd, sec, rel) == false)
|
||||||
|
@ -1800,10 +1782,7 @@ nlm_write_object_contents (abfd)
|
||||||
(external_reloc_count
|
(external_reloc_count
|
||||||
* sizeof (struct reloc_and_sec)));
|
* sizeof (struct reloc_and_sec)));
|
||||||
if (external_relocs == (struct reloc_and_sec *) NULL)
|
if (external_relocs == (struct reloc_and_sec *) NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for (sec = abfd->sections; sec != (asection *) NULL; sec = sec->next)
|
for (sec = abfd->sections; sec != (asection *) NULL; sec = sec->next)
|
||||||
{
|
{
|
||||||
|
@ -1822,7 +1801,7 @@ nlm_write_object_contents (abfd)
|
||||||
rel = *rel_ptr_ptr;
|
rel = *rel_ptr_ptr;
|
||||||
sym = *rel->sym_ptr_ptr;
|
sym = *rel->sym_ptr_ptr;
|
||||||
|
|
||||||
if (bfd_get_section (sym) != &bfd_und_section)
|
if (! bfd_is_und_section (bfd_get_section (sym)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
external_relocs[i].rel = rel;
|
external_relocs[i].rel = rel;
|
||||||
|
@ -1893,7 +1872,7 @@ nlm_write_object_contents (abfd)
|
||||||
sym = *sym_ptr_ptr;
|
sym = *sym_ptr_ptr;
|
||||||
|
|
||||||
if ((sym->flags & (BSF_EXPORT | BSF_GLOBAL)) == 0
|
if ((sym->flags & (BSF_EXPORT | BSF_GLOBAL)) == 0
|
||||||
|| bfd_get_section (sym) == &bfd_und_section)
|
|| bfd_is_und_section (bfd_get_section (sym)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
++c;
|
++c;
|
||||||
|
@ -1978,7 +1957,7 @@ nlm_write_object_contents (abfd)
|
||||||
debugging symbol NLM does not understand at all. */
|
debugging symbol NLM does not understand at all. */
|
||||||
if ((sym->flags & (BSF_LOCAL | BSF_GLOBAL | BSF_EXPORT)) == 0
|
if ((sym->flags & (BSF_LOCAL | BSF_GLOBAL | BSF_EXPORT)) == 0
|
||||||
|| (sym->flags & BSF_DEBUGGING) != 0
|
|| (sym->flags & BSF_DEBUGGING) != 0
|
||||||
|| bfd_get_section (sym) == &bfd_und_section)
|
|| bfd_is_und_section (bfd_get_section (sym)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
++c;
|
++c;
|
||||||
|
@ -2065,7 +2044,8 @@ nlm_write_object_contents (abfd)
|
||||||
goto error_return;
|
goto error_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BFD_ASSERT (bfd_tell (abfd) == nlm_optional_prefix_size (abfd));
|
BFD_ASSERT ((bfd_size_type) bfd_tell (abfd)
|
||||||
|
== nlm_optional_prefix_size (abfd));
|
||||||
|
|
||||||
nlm_swap_fixed_header_out (abfd, nlm_fixed_header (abfd), fixed_header);
|
nlm_swap_fixed_header_out (abfd, nlm_fixed_header (abfd), fixed_header);
|
||||||
if (bfd_write (fixed_header, nlm_fixed_header_size (abfd), 1, abfd)
|
if (bfd_write (fixed_header, nlm_fixed_header_size (abfd), 1, abfd)
|
||||||
|
|
58
bfd/oasys.c
58
bfd/oasys.c
|
@ -118,10 +118,7 @@ oasys_slurp_symbol_table (abfd)
|
||||||
data->strings = bfd_alloc (abfd, data->symbol_string_length);
|
data->strings = bfd_alloc (abfd, data->symbol_string_length);
|
||||||
#endif
|
#endif
|
||||||
if (!data->symbols || !data->strings)
|
if (!data->symbols || !data->strings)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
dest_defined = data->symbols + abfd->symcount - 1;
|
dest_defined = data->symbols + abfd->symcount - 1;
|
||||||
|
|
||||||
|
@ -310,10 +307,7 @@ oasys_archive_p (abfd)
|
||||||
oasys_module_table_type record;
|
oasys_module_table_type record;
|
||||||
|
|
||||||
if (!ar || !module)
|
if (!ar || !module)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
abfd->tdata.oasys_ar_data = ar;
|
abfd->tdata.oasys_ar_data = ar;
|
||||||
ar->module = module;
|
ar->module = module;
|
||||||
|
@ -343,10 +337,7 @@ oasys_archive_p (abfd)
|
||||||
|
|
||||||
module[i].name = bfd_alloc (abfd, 33);
|
module[i].name = bfd_alloc (abfd, 33);
|
||||||
if (!module[i].name)
|
if (!module[i].name)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy (module[i].name, record_ext.mod_name, 33);
|
memcpy (module[i].name, record_ext.mod_name, 33);
|
||||||
filepos +=
|
filepos +=
|
||||||
|
@ -372,10 +363,7 @@ oasys_archive_p (abfd)
|
||||||
|
|
||||||
module[i].name = bfd_alloc (abfd, record.module_name_size + 1);
|
module[i].name = bfd_alloc (abfd, record.module_name_size + 1);
|
||||||
if (!module[i].name)
|
if (!module[i].name)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (bfd_read ((PTR) module[i].name, 1, record.module_name_size,
|
if (bfd_read ((PTR) module[i].name, 1, record.module_name_size,
|
||||||
abfd)
|
abfd)
|
||||||
!= record.module_name_size)
|
!= record.module_name_size)
|
||||||
|
@ -462,10 +450,7 @@ oasys_object_p (abfd)
|
||||||
}
|
}
|
||||||
buffer = bfd_alloc (abfd, 3);
|
buffer = bfd_alloc (abfd, 3);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
{
|
goto fail;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
section_number = record.section.relb & RELOCATION_SECT_BITS;
|
section_number = record.section.relb & RELOCATION_SECT_BITS;
|
||||||
sprintf (buffer, "%u", section_number);
|
sprintf (buffer, "%u", section_number);
|
||||||
s = bfd_make_section (abfd, buffer);
|
s = bfd_make_section (abfd, buffer);
|
||||||
|
@ -633,10 +618,7 @@ oasys_slurp_section_data (abfd)
|
||||||
{
|
{
|
||||||
per->data = (bfd_byte *) bfd_zalloc (abfd, section->_raw_size);
|
per->data = (bfd_byte *) bfd_zalloc (abfd, section->_raw_size);
|
||||||
if (!per->data)
|
if (!per->data)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
per->reloc_tail_ptr = (oasys_reloc_type **) & (section->relocation);
|
per->reloc_tail_ptr = (oasys_reloc_type **) & (section->relocation);
|
||||||
per->had_vma = false;
|
per->had_vma = false;
|
||||||
per->initialized = true;
|
per->initialized = true;
|
||||||
|
@ -703,10 +685,7 @@ oasys_slurp_section_data (abfd)
|
||||||
bfd_alloc (abfd,
|
bfd_alloc (abfd,
|
||||||
sizeof (oasys_reloc_type));
|
sizeof (oasys_reloc_type));
|
||||||
if (!r)
|
if (!r)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*(per->reloc_tail_ptr) = r;
|
*(per->reloc_tail_ptr) = r;
|
||||||
per->reloc_tail_ptr = &r->next;
|
per->reloc_tail_ptr = &r->next;
|
||||||
r->next = (oasys_reloc_type *) NULL;
|
r->next = (oasys_reloc_type *) NULL;
|
||||||
|
@ -750,10 +729,7 @@ oasys_slurp_section_data (abfd)
|
||||||
bfd_alloc (abfd,
|
bfd_alloc (abfd,
|
||||||
sizeof (oasys_reloc_type));
|
sizeof (oasys_reloc_type));
|
||||||
if (!r)
|
if (!r)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*(per->reloc_tail_ptr) = r;
|
*(per->reloc_tail_ptr) = r;
|
||||||
per->reloc_tail_ptr = &r->next;
|
per->reloc_tail_ptr = &r->next;
|
||||||
r->next = (oasys_reloc_type *) NULL;
|
r->next = (oasys_reloc_type *) NULL;
|
||||||
|
@ -819,10 +795,7 @@ oasys_new_section_hook (abfd, newsect)
|
||||||
newsect->used_by_bfd = (PTR)
|
newsect->used_by_bfd = (PTR)
|
||||||
bfd_alloc (abfd, sizeof (oasys_per_section_type));
|
bfd_alloc (abfd, sizeof (oasys_per_section_type));
|
||||||
if (!newsect->used_by_bfd)
|
if (!newsect->used_by_bfd)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
oasys_per_section (newsect)->data = (bfd_byte *) NULL;
|
oasys_per_section (newsect)->data = (bfd_byte *) NULL;
|
||||||
oasys_per_section (newsect)->section = newsect;
|
oasys_per_section (newsect)->section = newsect;
|
||||||
oasys_per_section (newsect)->offset = 0;
|
oasys_per_section (newsect)->offset = 0;
|
||||||
|
@ -1038,6 +1011,9 @@ oasys_write_sections (abfd)
|
||||||
{
|
{
|
||||||
if (!isdigit (s->name[0]))
|
if (!isdigit (s->name[0]))
|
||||||
{
|
{
|
||||||
|
(*_bfd_error_handler)
|
||||||
|
("%s: can not represent section `%s' in oasys",
|
||||||
|
bfd_get_filename (abfd), s->name);
|
||||||
bfd_set_error (bfd_error_nonrepresentable_section);
|
bfd_set_error (bfd_error_nonrepresentable_section);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1345,10 +1321,7 @@ oasys_set_section_contents (abfd, section, location, offset, count)
|
||||||
oasys_per_section (section)->data =
|
oasys_per_section (section)->data =
|
||||||
(bfd_byte *) (bfd_alloc (abfd, section->_cooked_size));
|
(bfd_byte *) (bfd_alloc (abfd, section->_cooked_size));
|
||||||
if (!oasys_per_section (section)->data)
|
if (!oasys_per_section (section)->data)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
(void) memcpy ((PTR) (oasys_per_section (section)->data + offset),
|
(void) memcpy ((PTR) (oasys_per_section (section)->data + offset),
|
||||||
location,
|
location,
|
||||||
|
@ -1373,10 +1346,7 @@ oasys_make_empty_symbol (abfd)
|
||||||
oasys_symbol_type *new =
|
oasys_symbol_type *new =
|
||||||
(oasys_symbol_type *) bfd_zalloc (abfd, sizeof (oasys_symbol_type));
|
(oasys_symbol_type *) bfd_zalloc (abfd, sizeof (oasys_symbol_type));
|
||||||
if (!new)
|
if (!new)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
new->symbol.the_bfd = abfd;
|
new->symbol.the_bfd = abfd;
|
||||||
return &new->symbol;
|
return &new->symbol;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1112,8 +1112,8 @@ static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] =
|
||||||
"Special Directory",
|
"Special Directory",
|
||||||
"Thread Storage Directory [.tls]",
|
"Thread Storage Directory [.tls]",
|
||||||
"Load Configuration Directory",
|
"Load Configuration Directory",
|
||||||
"Reserved",
|
"Bound Import Directory",
|
||||||
"Reserved [first thunk address on PPC]",
|
"Import Address Table Directory",
|
||||||
"Reserved",
|
"Reserved",
|
||||||
"Reserved",
|
"Reserved",
|
||||||
"Reserved"
|
"Reserved"
|
||||||
|
@ -1436,9 +1436,9 @@ pe_print_pdata(abfd, vfile)
|
||||||
static boolean
|
static boolean
|
||||||
pe_print_private_bfd_data (abfd, vfile)
|
pe_print_private_bfd_data (abfd, vfile)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
void *vfile;
|
PTR vfile;
|
||||||
{
|
{
|
||||||
FILE *file = vfile;
|
FILE *file = (FILE *) vfile;
|
||||||
int j;
|
int j;
|
||||||
pe_data_type *pe = pe_data (abfd);
|
pe_data_type *pe = pe_data (abfd);
|
||||||
struct internal_extra_pe_aouthdr *i = &pe->pe_opthdr;
|
struct internal_extra_pe_aouthdr *i = &pe->pe_opthdr;
|
||||||
|
@ -1496,10 +1496,7 @@ pe_mkobject (abfd)
|
||||||
(struct pe_tdata *) bfd_zalloc (abfd, sizeof (pe_data_type));
|
(struct pe_tdata *) bfd_zalloc (abfd, sizeof (pe_data_type));
|
||||||
|
|
||||||
if (abfd->tdata.pe_obj_data == 0)
|
if (abfd->tdata.pe_obj_data == 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
pe = pe_data (abfd);
|
pe = pe_data (abfd);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* BFD backend for core files which use the ptrace_user structure
|
/* BFD backend for core files which use the ptrace_user structure
|
||||||
Copyright 1993 Free Software Foundation, Inc.
|
Copyright 1993, 1994 Free Software Foundation, Inc.
|
||||||
The structure of this file is based on trad-core.c written by John Gilmore
|
The structure of this file is based on trad-core.c written by John Gilmore
|
||||||
of Cygnus Support.
|
of Cygnus Support.
|
||||||
Modified to work with the ptrace_user structure by Kevin A. Buettner.
|
Modified to work with the ptrace_user structure by Kevin A. Buettner.
|
||||||
|
@ -19,15 +19,7 @@ GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
To use this file on a particular host, configure the host with these
|
|
||||||
parameters in the config/h-HOST file:
|
|
||||||
|
|
||||||
HDEFINES=-DPTRACE_CORE
|
|
||||||
HDEPFILES=ptrace-core.o
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef PTRACE_CORE
|
#ifdef PTRACE_CORE
|
||||||
|
|
||||||
|
@ -51,7 +43,7 @@ struct trad_core_struct
|
||||||
asection *stack_section;
|
asection *stack_section;
|
||||||
asection *reg_section;
|
asection *reg_section;
|
||||||
struct ptrace_user u;
|
struct ptrace_user u;
|
||||||
} *rawptr;
|
};
|
||||||
|
|
||||||
#define core_upage(bfd) (&((bfd)->tdata.trad_core_data->u))
|
#define core_upage(bfd) (&((bfd)->tdata.trad_core_data->u))
|
||||||
#define core_datasec(bfd) ((bfd)->tdata.trad_core_data->data_section)
|
#define core_datasec(bfd) ((bfd)->tdata.trad_core_data->data_section)
|
||||||
|
@ -60,20 +52,21 @@ struct trad_core_struct
|
||||||
|
|
||||||
/* forward declarations */
|
/* forward declarations */
|
||||||
|
|
||||||
bfd_target * ptrace_unix_core_file_p PARAMS ((bfd *abfd));
|
const bfd_target *ptrace_unix_core_file_p PARAMS ((bfd *abfd));
|
||||||
char * ptrace_unix_core_file_failing_command PARAMS ((bfd *abfd));
|
char * ptrace_unix_core_file_failing_command PARAMS ((bfd *abfd));
|
||||||
int ptrace_unix_core_file_failing_signal PARAMS ((bfd *abfd));
|
int ptrace_unix_core_file_failing_signal PARAMS ((bfd *abfd));
|
||||||
boolean ptrace_unix_core_file_matches_executable_p
|
boolean ptrace_unix_core_file_matches_executable_p
|
||||||
PARAMS ((bfd *core_bfd, bfd *exec_bfd));
|
PARAMS ((bfd *core_bfd, bfd *exec_bfd));
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
bfd_target *
|
const bfd_target *
|
||||||
ptrace_unix_core_file_p (abfd)
|
ptrace_unix_core_file_p (abfd)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
|
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
struct ptrace_user u;
|
struct ptrace_user u;
|
||||||
|
struct trad_core_struct *rawptr;
|
||||||
|
|
||||||
val = bfd_read ((void *)&u, 1, sizeof u, abfd);
|
val = bfd_read ((void *)&u, 1, sizeof u, abfd);
|
||||||
if (val != sizeof u || u.pt_magic != _BCS_PTRACE_MAGIC
|
if (val != sizeof u || u.pt_magic != _BCS_PTRACE_MAGIC
|
||||||
|
@ -91,10 +84,8 @@ ptrace_unix_core_file_p (abfd)
|
||||||
rawptr = (struct trad_core_struct *)
|
rawptr = (struct trad_core_struct *)
|
||||||
bfd_zalloc (abfd, sizeof (struct trad_core_struct));
|
bfd_zalloc (abfd, sizeof (struct trad_core_struct));
|
||||||
|
|
||||||
if (rawptr == NULL) {
|
if (rawptr == NULL)
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
abfd->tdata.trad_core_data = rawptr;
|
abfd->tdata.trad_core_data = rawptr;
|
||||||
|
|
||||||
|
@ -103,24 +94,15 @@ ptrace_unix_core_file_p (abfd)
|
||||||
/* Create the sections. This is raunchy, but bfd_close wants to free
|
/* Create the sections. This is raunchy, but bfd_close wants to free
|
||||||
them separately. */
|
them separately. */
|
||||||
|
|
||||||
core_stacksec(abfd) = (asection *) bfd_zmalloc (sizeof (asection));
|
core_stacksec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||||
if (core_stacksec (abfd) == NULL) {
|
if (core_stacksec (abfd) == NULL)
|
||||||
loser:
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
core_datasec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||||
free ((void *)rawptr);
|
if (core_datasec (abfd) == NULL)
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||||
core_datasec (abfd) = (asection *) zalloc (sizeof (asection));
|
if (core_regsec (abfd) == NULL)
|
||||||
if (core_datasec (abfd) == NULL) {
|
return NULL;
|
||||||
loser1:
|
|
||||||
free ((void *)core_stacksec (abfd));
|
|
||||||
goto loser;
|
|
||||||
}
|
|
||||||
core_regsec (abfd) = (asection *) zalloc (sizeof (asection));
|
|
||||||
if (core_regsec (abfd) == NULL) {
|
|
||||||
free ((void *)core_datasec (abfd));
|
|
||||||
goto loser1;
|
|
||||||
}
|
|
||||||
|
|
||||||
core_stacksec (abfd)->name = ".stack";
|
core_stacksec (abfd)->name = ".stack";
|
||||||
core_datasec (abfd)->name = ".data";
|
core_datasec (abfd)->name = ".data";
|
||||||
|
@ -133,7 +115,7 @@ ptrace_unix_core_file_p (abfd)
|
||||||
|
|
||||||
core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
|
core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
|
||||||
core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
|
core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
|
||||||
core_regsec (abfd)->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
|
core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
|
||||||
|
|
||||||
core_datasec (abfd)->_raw_size = u.pt_dsize;
|
core_datasec (abfd)->_raw_size = u.pt_dsize;
|
||||||
core_stacksec (abfd)->_raw_size = u.pt_ssize;
|
core_stacksec (abfd)->_raw_size = u.pt_ssize;
|
||||||
|
@ -200,7 +182,7 @@ swap_abort()
|
||||||
#define NO_SIGNED_GET \
|
#define NO_SIGNED_GET \
|
||||||
((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
|
((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
|
||||||
|
|
||||||
bfd_target ptrace_core_vec =
|
const bfd_target ptrace_core_vec =
|
||||||
{
|
{
|
||||||
"trad-core",
|
"trad-core",
|
||||||
bfd_target_unknown_flavour,
|
bfd_target_unknown_flavour,
|
||||||
|
@ -213,7 +195,6 @@ bfd_target ptrace_core_vec =
|
||||||
0, /* symbol prefix */
|
0, /* symbol prefix */
|
||||||
' ', /* ar_pad_char */
|
' ', /* ar_pad_char */
|
||||||
16, /* ar_max_namelen */
|
16, /* ar_max_namelen */
|
||||||
3, /* minimum alignment power */
|
|
||||||
NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */
|
NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */
|
||||||
NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */
|
NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */
|
||||||
NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */
|
NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */
|
||||||
|
@ -244,6 +225,7 @@ bfd_target ptrace_core_vec =
|
||||||
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
|
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
|
||||||
BFD_JUMP_TABLE_WRITE (_bfd_generic),
|
BFD_JUMP_TABLE_WRITE (_bfd_generic),
|
||||||
BFD_JUMP_TABLE_LINK (_bfd_nolink),
|
BFD_JUMP_TABLE_LINK (_bfd_nolink),
|
||||||
|
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||||
|
|
||||||
(PTR) 0 /* backend_data */
|
(PTR) 0 /* backend_data */
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,643 @@
|
||||||
|
/* BFD back-end for RISC iX (Acorn, arm) binaries.
|
||||||
|
Copyright (C) 1994 Free Software Foundation, Inc.
|
||||||
|
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
|
||||||
|
|
||||||
|
This file is part of BFD, the Binary File Descriptor library.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
|
||||||
|
/* RISC iX overloads the MAGIC field to indicate more than just the usual
|
||||||
|
[ZNO]MAGIC values. Also included are squeezing information and
|
||||||
|
shared library usage. */
|
||||||
|
|
||||||
|
/* The following come from the man page. */
|
||||||
|
#define SHLIBLEN 60
|
||||||
|
|
||||||
|
#define MF_IMPURE 00200
|
||||||
|
#define MF_SQUEEZED 01000
|
||||||
|
#define MF_USES_SL 02000
|
||||||
|
#define MF_IS_SL 04000
|
||||||
|
|
||||||
|
/* Common combinations. */
|
||||||
|
#define IMAGIC (MF_IMPURE|ZMAGIC) /* Demand load (impure text) */
|
||||||
|
#define SPOMAGIC (MF_USES_SL|OMAGIC) /* OMAGIC with large header */
|
||||||
|
/* -- may contain a ref to a */
|
||||||
|
/* shared lib required by the */
|
||||||
|
/* object. */
|
||||||
|
#define SLOMAGIC (MF_IS_SL|OMAGIC) /* A reference to a shared library */
|
||||||
|
/* The text portion of the object */
|
||||||
|
/* contains "overflow text" from */
|
||||||
|
/* the shared library to be linked */
|
||||||
|
/* in with an object */
|
||||||
|
#define QMAGIC (MF_SQUEEZED|ZMAGIC) /* Sqeezed demand paged. */
|
||||||
|
/* NOTE: This interpretation of */
|
||||||
|
/* QMAGIC seems to be at variance */
|
||||||
|
/* With that used on other */
|
||||||
|
/* architectures. */
|
||||||
|
#define SPZMAGIC (MF_USES_SL|ZMAGIC) /* program which uses sl */
|
||||||
|
#define SPQMAGIC (MF_USES_SL|QMAGIC) /* sqeezed ditto */
|
||||||
|
#define SLZMAGIC (MF_IS_SL|ZMAGIC) /* shared lib part of prog */
|
||||||
|
#define SLPZMAGIC (MF_USES_SL|SLZMAGIC) /* sl which uses another */
|
||||||
|
|
||||||
|
#define N_SHARED_LIB(x) ((x).a_info & MF_USES_SL)
|
||||||
|
|
||||||
|
/* Only a pure OMAGIC file has the minimal header */
|
||||||
|
#define N_TXTOFF(x) \
|
||||||
|
((x).a_info == OMAGIC ? 32 \
|
||||||
|
: (N_MAGIC(x) == ZMAGIC) ? TARGET_PAGE_SIZE \
|
||||||
|
: 999)
|
||||||
|
|
||||||
|
#define N_TXTADDR(x) \
|
||||||
|
(N_MAGIC(x) != ZMAGIC ? 0 /* object file or NMAGIC */ \
|
||||||
|
/* Programs with shared libs are loaded at the first page after all the \
|
||||||
|
text segments of the shared library programs. Without looking this \
|
||||||
|
up we can't know exactly what the address will be. A reasonable guess \
|
||||||
|
is that a_entry will be in the first page of the executable. */ \
|
||||||
|
: N_SHARED_LIB(x) ? ((x).a_entry & ~(TARGET_PAGE_SIZE - 1)) \
|
||||||
|
: TEXT_START_ADDR)
|
||||||
|
|
||||||
|
#define N_SYMOFF(x) \
|
||||||
|
(N_TXTOFF (x) + (x).a_text + (x).a_data + (x).a_trsize + (x).a_drsize)
|
||||||
|
|
||||||
|
#define N_STROFF(x) (N_SYMOFF (x) + (x).a_syms)
|
||||||
|
|
||||||
|
#define TEXT_START_ADDR 32768
|
||||||
|
#define TARGET_PAGE_SIZE 32768
|
||||||
|
#define SEGMENT_SIZE TARGET_PAGE_SIZE
|
||||||
|
#define DEFAULT_ARCH bfd_arch_arm
|
||||||
|
|
||||||
|
#define MY(OP) CAT(riscix_,OP)
|
||||||
|
#define TARGETNAME "a.out-riscix"
|
||||||
|
#define N_BADMAG(x) ((((x).a_info & ~007200) != ZMAGIC) && \
|
||||||
|
(((x).a_info & ~006000) != OMAGIC) && \
|
||||||
|
((x).a_info != NMAGIC))
|
||||||
|
#define N_MAGIC(x) ((x).a_info & ~07200)
|
||||||
|
|
||||||
|
#include "bfd.h"
|
||||||
|
#include "sysdep.h"
|
||||||
|
#include "libbfd.h"
|
||||||
|
#include "assert.h"
|
||||||
|
|
||||||
|
#define WRITE_HEADERS(abfd, execp) \
|
||||||
|
{ \
|
||||||
|
bfd_size_type text_size; /* dummy vars */ \
|
||||||
|
file_ptr text_end; \
|
||||||
|
if (adata(abfd).magic == undecided_magic) \
|
||||||
|
NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); \
|
||||||
|
\
|
||||||
|
execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \
|
||||||
|
execp->a_entry = bfd_get_start_address (abfd); \
|
||||||
|
\
|
||||||
|
execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \
|
||||||
|
obj_reloc_entry_size (abfd)); \
|
||||||
|
execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \
|
||||||
|
obj_reloc_entry_size (abfd)); \
|
||||||
|
NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \
|
||||||
|
\
|
||||||
|
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false; \
|
||||||
|
if (bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) \
|
||||||
|
!= EXEC_BYTES_SIZE) \
|
||||||
|
return false; \
|
||||||
|
/* Now write out reloc info, followed by syms and strings */ \
|
||||||
|
\
|
||||||
|
if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \
|
||||||
|
&& bfd_get_symcount (abfd) != 0) \
|
||||||
|
{ \
|
||||||
|
if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET) != 0) \
|
||||||
|
return false; \
|
||||||
|
\
|
||||||
|
if (! NAME(aout,write_syms)(abfd)) return false; \
|
||||||
|
\
|
||||||
|
if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET) != 0) \
|
||||||
|
return false; \
|
||||||
|
\
|
||||||
|
if (! riscix_squirt_out_relocs (abfd, obj_textsec (abfd))) \
|
||||||
|
return false; \
|
||||||
|
if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET) != 0) \
|
||||||
|
return false; \
|
||||||
|
\
|
||||||
|
if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd))) \
|
||||||
|
return false; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "libaout.h"
|
||||||
|
#include "aout/aout64.h"
|
||||||
|
|
||||||
|
static bfd_reloc_status_type
|
||||||
|
riscix_fix_pcrel_26_done PARAMS ((bfd *, arelent *, asymbol *, PTR,
|
||||||
|
asection *, bfd *, char **));
|
||||||
|
|
||||||
|
static bfd_reloc_status_type
|
||||||
|
riscix_fix_pcrel_26 PARAMS ((bfd *, arelent *, asymbol *, PTR,
|
||||||
|
asection *, bfd *, char **));
|
||||||
|
|
||||||
|
static reloc_howto_type riscix_std_reloc_howto[] = {
|
||||||
|
/* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */
|
||||||
|
HOWTO( 0, 0, 0, 8, false, 0, complain_overflow_bitfield,0,"8", true, 0x000000ff,0x000000ff, false),
|
||||||
|
HOWTO( 1, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"16", true, 0x0000ffff,0x0000ffff, false),
|
||||||
|
HOWTO( 2, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"32", true, 0xffffffff,0xffffffff, false),
|
||||||
|
HOWTO( 3, 2, 3, 26, true, 0, complain_overflow_signed, riscix_fix_pcrel_26 , "ARM26", true, 0x00ffffff,0x00ffffff, false),
|
||||||
|
HOWTO( 4, 0, 0, 8, true, 0, complain_overflow_signed, 0,"DISP8", true, 0x000000ff,0x000000ff, true),
|
||||||
|
HOWTO( 5, 0, 1, 16, true, 0, complain_overflow_signed, 0,"DISP16", true, 0x0000ffff,0x0000ffff, true),
|
||||||
|
HOWTO( 6, 0, 2, 32, true, 0, complain_overflow_signed, 0,"DISP32", true, 0xffffffff,0xffffffff, true),
|
||||||
|
HOWTO( 7, 2, 3, 26, false, 0, complain_overflow_signed, riscix_fix_pcrel_26_done, "ARM26D",true,0x00ffffff,0x00ffffff, false),
|
||||||
|
{-1},
|
||||||
|
HOWTO( 9, 0, -1, 16, false, 0, complain_overflow_bitfield,0,"NEG16", true, 0x0000ffff,0x0000ffff, false),
|
||||||
|
HOWTO( 10, 0, -2, 32, false, 0, complain_overflow_bitfield,0,"NEG32", true, 0xffffffff,0xffffffff, false)
|
||||||
|
};
|
||||||
|
|
||||||
|
#define RISCIX_TABLE_SIZE \
|
||||||
|
(sizeof (riscix_std_reloc_howto) / sizeof (reloc_howto_type))
|
||||||
|
|
||||||
|
|
||||||
|
static bfd_reloc_status_type
|
||||||
|
riscix_fix_pcrel_26_done (abfd, reloc_entry, symbol, data, input_section,
|
||||||
|
output_bfd, error_message)
|
||||||
|
bfd *abfd;
|
||||||
|
arelent *reloc_entry;
|
||||||
|
asymbol *symbol;
|
||||||
|
PTR data;
|
||||||
|
asection *input_section;
|
||||||
|
bfd *output_bfd;
|
||||||
|
char **error_message;
|
||||||
|
{
|
||||||
|
/* This is dead simple at present. */
|
||||||
|
return bfd_reloc_ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bfd_reloc_status_type
|
||||||
|
riscix_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section,
|
||||||
|
output_bfd, error_message)
|
||||||
|
bfd *abfd;
|
||||||
|
arelent *reloc_entry;
|
||||||
|
asymbol *symbol;
|
||||||
|
PTR data;
|
||||||
|
asection *input_section;
|
||||||
|
bfd *output_bfd;
|
||||||
|
char **error_message;
|
||||||
|
{
|
||||||
|
bfd_vma relocation;
|
||||||
|
bfd_size_type addr = reloc_entry->address;
|
||||||
|
long target = bfd_get_32 (abfd, (bfd_byte *) data + addr);
|
||||||
|
bfd_reloc_status_type flag = bfd_reloc_ok;
|
||||||
|
|
||||||
|
/* If this is an undefined symbol, return error */
|
||||||
|
if (symbol->section == &bfd_und_section
|
||||||
|
&& (symbol->flags & BSF_WEAK) == 0)
|
||||||
|
return output_bfd ? bfd_reloc_continue : bfd_reloc_undefined;
|
||||||
|
|
||||||
|
/* If the sections are different, and we are doing a partial relocation,
|
||||||
|
just ignore it for now. */
|
||||||
|
if (symbol->section->name != input_section->name
|
||||||
|
&& output_bfd != (bfd *)NULL)
|
||||||
|
return bfd_reloc_continue;
|
||||||
|
|
||||||
|
relocation = (target & 0x00ffffff) << 2;
|
||||||
|
relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend */
|
||||||
|
relocation += symbol->value;
|
||||||
|
relocation += symbol->section->output_section->vma;
|
||||||
|
relocation += symbol->section->output_offset;
|
||||||
|
relocation += reloc_entry->addend;
|
||||||
|
relocation -= input_section->output_section->vma;
|
||||||
|
relocation -= input_section->output_offset;
|
||||||
|
relocation -= addr;
|
||||||
|
if (relocation & 3)
|
||||||
|
return bfd_reloc_overflow;
|
||||||
|
|
||||||
|
/* Check for overflow */
|
||||||
|
if (relocation & 0x02000000)
|
||||||
|
{
|
||||||
|
if ((relocation & ~0x03ffffff) != ~0x03ffffff)
|
||||||
|
flag = bfd_reloc_overflow;
|
||||||
|
}
|
||||||
|
else if (relocation & ~0x03ffffff)
|
||||||
|
flag = bfd_reloc_overflow;
|
||||||
|
|
||||||
|
target &= ~0x00ffffff;
|
||||||
|
target |= (relocation >> 2) & 0x00ffffff;
|
||||||
|
bfd_put_32 (abfd, target, (bfd_byte *) data + addr);
|
||||||
|
|
||||||
|
/* Now the ARM magic... Change the reloc type so that it is marked as done.
|
||||||
|
Strictly this is only necessary if we are doing a partial relocation. */
|
||||||
|
reloc_entry->howto = &riscix_std_reloc_howto[7];
|
||||||
|
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
reloc_howto_type *
|
||||||
|
DEFUN(riscix_reloc_type_lookup,(abfd,code),
|
||||||
|
bfd *abfd AND
|
||||||
|
bfd_reloc_code_real_type code)
|
||||||
|
{
|
||||||
|
#define ASTD(i,j) case i: return &riscix_std_reloc_howto[j]
|
||||||
|
if (code == BFD_RELOC_CTOR)
|
||||||
|
switch (bfd_get_arch_info (abfd)->bits_per_address)
|
||||||
|
{
|
||||||
|
case 32:
|
||||||
|
code = BFD_RELOC_32;
|
||||||
|
break;
|
||||||
|
default: return (reloc_howto_type *) NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (code)
|
||||||
|
{
|
||||||
|
ASTD (BFD_RELOC_16, 1);
|
||||||
|
ASTD (BFD_RELOC_32, 2);
|
||||||
|
ASTD (BFD_RELOC_ARM_PCREL_BRANCH, 3);
|
||||||
|
ASTD (BFD_RELOC_8_PCREL, 4);
|
||||||
|
ASTD (BFD_RELOC_16_PCREL, 5);
|
||||||
|
ASTD (BFD_RELOC_32_PCREL, 6);
|
||||||
|
default: return (reloc_howto_type *) NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||||
|
#define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||||
|
#define MY_bfd_final_link _bfd_generic_final_link
|
||||||
|
|
||||||
|
#define MY_bfd_reloc_type_lookup riscix_reloc_type_lookup
|
||||||
|
#define MY_canonicalize_reloc riscix_canonicalize_reloc
|
||||||
|
#define MY_object_p riscix_object_p
|
||||||
|
|
||||||
|
static const bfd_target *riscix_callback PARAMS ((bfd *));
|
||||||
|
|
||||||
|
void
|
||||||
|
riscix_swap_std_reloc_out (abfd, g, natptr)
|
||||||
|
bfd *abfd;
|
||||||
|
arelent *g;
|
||||||
|
struct reloc_std_external *natptr;
|
||||||
|
{
|
||||||
|
int r_index;
|
||||||
|
asymbol *sym = *(g->sym_ptr_ptr);
|
||||||
|
int r_extern;
|
||||||
|
int r_length;
|
||||||
|
int r_pcrel;
|
||||||
|
int r_neg = 0; /* Negative relocs use the BASEREL bit. */
|
||||||
|
asection *output_section = sym->section->output_section;
|
||||||
|
|
||||||
|
PUT_WORD(abfd, g->address, natptr->r_address);
|
||||||
|
|
||||||
|
r_length = g->howto->size ; /* Size as a power of two */
|
||||||
|
if (r_length < 0)
|
||||||
|
{
|
||||||
|
r_length = -r_length;
|
||||||
|
r_neg = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
|
||||||
|
|
||||||
|
/* For RISC iX, in pc-relative relocs the r_pcrel bit means that the
|
||||||
|
relocation has been done already (Only for the 26-bit one I think)???!!!
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (r_length == 3)
|
||||||
|
r_pcrel = r_pcrel ? 0 : 1;
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* For a standard reloc, the addend is in the object file. */
|
||||||
|
r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* name was clobbered by aout_write_syms to be symbol index */
|
||||||
|
|
||||||
|
/* If this relocation is relative to a symbol then set the
|
||||||
|
r_index to the symbols index, and the r_extern bit.
|
||||||
|
|
||||||
|
Absolute symbols can come in in two ways, either as an offset
|
||||||
|
from the abs section, or as a symbol which has an abs value.
|
||||||
|
check for that here
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (bfd_is_com_section (output_section)
|
||||||
|
|| output_section == &bfd_abs_section
|
||||||
|
|| output_section == &bfd_und_section)
|
||||||
|
{
|
||||||
|
if (bfd_abs_section.symbol == sym)
|
||||||
|
{
|
||||||
|
/* Whoops, looked like an abs symbol, but is really an offset
|
||||||
|
from the abs section */
|
||||||
|
r_index = 0;
|
||||||
|
r_extern = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Fill in symbol */
|
||||||
|
r_extern = 1;
|
||||||
|
r_index = stoi((*(g->sym_ptr_ptr))->flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Just an ordinary section */
|
||||||
|
r_extern = 0;
|
||||||
|
r_index = output_section->target_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* now the fun stuff */
|
||||||
|
if (abfd->xvec->header_byteorder_big_p != false)
|
||||||
|
{
|
||||||
|
natptr->r_index[0] = r_index >> 16;
|
||||||
|
natptr->r_index[1] = r_index >> 8;
|
||||||
|
natptr->r_index[2] = r_index;
|
||||||
|
natptr->r_type[0] =
|
||||||
|
( (r_extern ? RELOC_STD_BITS_EXTERN_BIG: 0)
|
||||||
|
| (r_pcrel ? RELOC_STD_BITS_PCREL_BIG: 0)
|
||||||
|
| (r_neg ? RELOC_STD_BITS_BASEREL_BIG: 0)
|
||||||
|
| (r_length << RELOC_STD_BITS_LENGTH_SH_BIG));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
natptr->r_index[2] = r_index >> 16;
|
||||||
|
natptr->r_index[1] = r_index >> 8;
|
||||||
|
natptr->r_index[0] = r_index;
|
||||||
|
natptr->r_type[0] =
|
||||||
|
( (r_extern ? RELOC_STD_BITS_EXTERN_LITTLE: 0)
|
||||||
|
| (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE: 0)
|
||||||
|
| (r_neg ? RELOC_STD_BITS_BASEREL_LITTLE: 0)
|
||||||
|
| (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean
|
||||||
|
riscix_squirt_out_relocs (abfd, section)
|
||||||
|
bfd *abfd;
|
||||||
|
asection *section;
|
||||||
|
{
|
||||||
|
arelent **generic;
|
||||||
|
unsigned char *native, *natptr;
|
||||||
|
size_t each_size;
|
||||||
|
|
||||||
|
unsigned int count = section->reloc_count;
|
||||||
|
size_t natsize;
|
||||||
|
|
||||||
|
if (count == 0) return true;
|
||||||
|
|
||||||
|
each_size = obj_reloc_entry_size (abfd);
|
||||||
|
natsize = each_size * count;
|
||||||
|
native = (unsigned char *) bfd_zalloc (abfd, natsize);
|
||||||
|
if (!native)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
generic = section->orelocation;
|
||||||
|
|
||||||
|
for (natptr = native;
|
||||||
|
count != 0;
|
||||||
|
--count, natptr += each_size, ++generic)
|
||||||
|
riscix_swap_std_reloc_out (abfd, *generic,
|
||||||
|
(struct reloc_std_external *) natptr);
|
||||||
|
|
||||||
|
if ( bfd_write ((PTR) native, 1, natsize, abfd) != natsize)
|
||||||
|
{
|
||||||
|
bfd_release(abfd, native);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bfd_release (abfd, native);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is just like the standard aoutx.h version but we need to do our
|
||||||
|
* own mapping of external reloc type values to howto entries.
|
||||||
|
*/
|
||||||
|
long
|
||||||
|
MY(canonicalize_reloc)(abfd, section, relptr, symbols)
|
||||||
|
bfd *abfd;
|
||||||
|
sec_ptr section;
|
||||||
|
arelent **relptr;
|
||||||
|
asymbol **symbols;
|
||||||
|
{
|
||||||
|
arelent *tblptr = section->relocation;
|
||||||
|
unsigned int count, c;
|
||||||
|
extern reloc_howto_type NAME(aout,std_howto_table)[];
|
||||||
|
|
||||||
|
/* If we have already read in the relocation table, return the values. */
|
||||||
|
if (section->flags & SEC_CONSTRUCTOR) {
|
||||||
|
arelent_chain *chain = section->constructor_chain;
|
||||||
|
|
||||||
|
for (count = 0; count < section->reloc_count; count++) {
|
||||||
|
*relptr++ = &chain->relent;
|
||||||
|
chain = chain->next;
|
||||||
|
}
|
||||||
|
*relptr = 0;
|
||||||
|
return section->reloc_count;
|
||||||
|
}
|
||||||
|
if (tblptr && section->reloc_count) {
|
||||||
|
for (count = 0; count++ < section->reloc_count;)
|
||||||
|
*relptr++ = tblptr++;
|
||||||
|
*relptr = 0;
|
||||||
|
return section->reloc_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!NAME(aout,slurp_reloc_table)(abfd, section, symbols))
|
||||||
|
return -1;
|
||||||
|
tblptr = section->relocation;
|
||||||
|
|
||||||
|
/* fix up howto entries */
|
||||||
|
for (count = 0; count++ < section->reloc_count;)
|
||||||
|
{
|
||||||
|
c = tblptr->howto - NAME(aout,std_howto_table);
|
||||||
|
assert (c < RISCIX_TABLE_SIZE);
|
||||||
|
tblptr->howto = &riscix_std_reloc_howto[c];
|
||||||
|
|
||||||
|
*relptr++ = tblptr++;
|
||||||
|
}
|
||||||
|
*relptr = 0;
|
||||||
|
return section->reloc_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is the same as NAME(aout,some_aout_object_p), but has different
|
||||||
|
expansions of the macro definitions. */
|
||||||
|
|
||||||
|
const bfd_target *
|
||||||
|
riscix_some_aout_object_p (abfd, execp, callback_to_real_object_p)
|
||||||
|
bfd *abfd;
|
||||||
|
struct internal_exec *execp;
|
||||||
|
const bfd_target *(*callback_to_real_object_p) PARAMS ((bfd *));
|
||||||
|
{
|
||||||
|
struct aout_data_struct *rawptr, *oldrawptr;
|
||||||
|
const bfd_target *result;
|
||||||
|
|
||||||
|
rawptr = ((struct aout_data_struct *)
|
||||||
|
bfd_zalloc (abfd, sizeof (struct aout_data_struct )));
|
||||||
|
|
||||||
|
if (rawptr == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
oldrawptr = abfd->tdata.aout_data;
|
||||||
|
abfd->tdata.aout_data = rawptr;
|
||||||
|
|
||||||
|
/* Copy the contents of the old tdata struct.
|
||||||
|
In particular, we want the subformat, since for hpux it was set in
|
||||||
|
hp300hpux.c:swap_exec_header_in and will be used in
|
||||||
|
hp300hpux.c:callback. */
|
||||||
|
if (oldrawptr != NULL)
|
||||||
|
*abfd->tdata.aout_data = *oldrawptr;
|
||||||
|
|
||||||
|
abfd->tdata.aout_data->a.hdr = &rawptr->e;
|
||||||
|
*(abfd->tdata.aout_data->a.hdr) = *execp; /* Copy in the internal_exec
|
||||||
|
struct */
|
||||||
|
execp = abfd->tdata.aout_data->a.hdr;
|
||||||
|
|
||||||
|
/* Set the file flags */
|
||||||
|
abfd->flags = NO_FLAGS;
|
||||||
|
if (execp->a_drsize || execp->a_trsize)
|
||||||
|
abfd->flags |= HAS_RELOC;
|
||||||
|
/* Setting of EXEC_P has been deferred to the bottom of this function */
|
||||||
|
if (execp->a_syms)
|
||||||
|
abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS;
|
||||||
|
if (N_DYNAMIC(*execp))
|
||||||
|
abfd->flags |= DYNAMIC;
|
||||||
|
|
||||||
|
|
||||||
|
if ((execp->a_info & MF_SQUEEZED) != 0) /* Squeezed files aren't supported
|
||||||
|
(yet)! */
|
||||||
|
{
|
||||||
|
bfd_set_error (bfd_error_wrong_format);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else if ((execp->a_info & MF_IS_SL) != 0) /* Nor are shared libraries */
|
||||||
|
{
|
||||||
|
bfd_set_error (bfd_error_wrong_format);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else if (N_MAGIC (*execp) == ZMAGIC)
|
||||||
|
{
|
||||||
|
abfd->flags |= D_PAGED | WP_TEXT;
|
||||||
|
adata (abfd).magic = z_magic;
|
||||||
|
}
|
||||||
|
else if (N_MAGIC (*execp) == NMAGIC)
|
||||||
|
{
|
||||||
|
abfd->flags |= WP_TEXT;
|
||||||
|
adata (abfd).magic = n_magic;
|
||||||
|
}
|
||||||
|
else if (N_MAGIC (*execp) == OMAGIC)
|
||||||
|
adata (abfd).magic = o_magic;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Should have been checked with N_BADMAG before this routine
|
||||||
|
was called. */
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
bfd_get_start_address (abfd) = execp->a_entry;
|
||||||
|
|
||||||
|
obj_aout_symbols (abfd) = (aout_symbol_type *)NULL;
|
||||||
|
bfd_get_symcount (abfd) = execp->a_syms / sizeof (struct external_nlist);
|
||||||
|
|
||||||
|
/* The default relocation entry size is that of traditional V7 Unix. */
|
||||||
|
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
|
||||||
|
|
||||||
|
/* The default symbol entry size is that of traditional Unix. */
|
||||||
|
obj_symbol_entry_size (abfd) = EXTERNAL_NLIST_SIZE;
|
||||||
|
|
||||||
|
obj_aout_external_syms (abfd) = NULL;
|
||||||
|
obj_aout_external_strings (abfd) = NULL;
|
||||||
|
obj_aout_sym_hashes (abfd) = NULL;
|
||||||
|
|
||||||
|
if (! NAME(aout,make_sections) (abfd))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
obj_datasec (abfd)->_raw_size = execp->a_data;
|
||||||
|
obj_bsssec (abfd)->_raw_size = execp->a_bss;
|
||||||
|
|
||||||
|
obj_textsec (abfd)->flags =
|
||||||
|
(execp->a_trsize != 0
|
||||||
|
? (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS | SEC_RELOC)
|
||||||
|
: (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS));
|
||||||
|
obj_datasec (abfd)->flags =
|
||||||
|
(execp->a_drsize != 0
|
||||||
|
? (SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS | SEC_RELOC)
|
||||||
|
: (SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS));
|
||||||
|
obj_bsssec (abfd)->flags = SEC_ALLOC;
|
||||||
|
|
||||||
|
result = (*callback_to_real_object_p)(abfd);
|
||||||
|
|
||||||
|
#if defined(MACH) || defined(STAT_FOR_EXEC)
|
||||||
|
/* The original heuristic doesn't work in some important cases. The
|
||||||
|
* a.out file has no information about the text start address. For
|
||||||
|
* files (like kernels) linked to non-standard addresses (ld -Ttext
|
||||||
|
* nnn) the entry point may not be between the default text start
|
||||||
|
* (obj_textsec(abfd)->vma) and (obj_textsec(abfd)->vma) + text size
|
||||||
|
* This is not just a mach issue. Many kernels are loaded at non
|
||||||
|
* standard addresses.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
struct stat stat_buf;
|
||||||
|
if (abfd->iostream
|
||||||
|
&& (fstat(fileno((FILE *) (abfd->iostream)), &stat_buf) == 0)
|
||||||
|
&& ((stat_buf.st_mode & 0111) != 0))
|
||||||
|
abfd->flags |= EXEC_P;
|
||||||
|
}
|
||||||
|
#else /* ! MACH */
|
||||||
|
/* Now that the segment addresses have been worked out, take a better
|
||||||
|
guess at whether the file is executable. If the entry point
|
||||||
|
is within the text segment, assume it is. (This makes files
|
||||||
|
executable even if their entry point address is 0, as long as
|
||||||
|
their text starts at zero.)
|
||||||
|
|
||||||
|
At some point we should probably break down and stat the file and
|
||||||
|
declare it executable if (one of) its 'x' bits are on... */
|
||||||
|
if ((execp->a_entry >= obj_textsec(abfd)->vma) &&
|
||||||
|
(execp->a_entry < obj_textsec(abfd)->vma + obj_textsec(abfd)->_raw_size))
|
||||||
|
abfd->flags |= EXEC_P;
|
||||||
|
#endif /* MACH */
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
free (rawptr);
|
||||||
|
abfd->tdata.aout_data = oldrawptr;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const bfd_target *
|
||||||
|
MY(object_p) (abfd)
|
||||||
|
bfd *abfd;
|
||||||
|
{
|
||||||
|
struct external_exec exec_bytes; /* Raw exec header from file */
|
||||||
|
struct internal_exec exec; /* Cleaned-up exec header */
|
||||||
|
const bfd_target *target;
|
||||||
|
|
||||||
|
if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
|
||||||
|
!= EXEC_BYTES_SIZE) {
|
||||||
|
if (bfd_get_error () != bfd_error_system_call)
|
||||||
|
bfd_set_error (bfd_error_wrong_format);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
exec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info);
|
||||||
|
|
||||||
|
if (N_BADMAG (exec)) return 0;
|
||||||
|
#ifdef MACHTYPE_OK
|
||||||
|
if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
NAME(aout,swap_exec_header_in)(abfd, &exec_bytes, &exec);
|
||||||
|
|
||||||
|
target = riscix_some_aout_object_p (abfd, &exec, MY(callback));
|
||||||
|
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include "aout-target.h"
|
139
bfd/som.c
139
bfd/som.c
|
@ -1409,10 +1409,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field, sym_diff)
|
||||||
final_types = (int **) bfd_alloc_by_size_t (abfd, sizeof (int *) * 6);
|
final_types = (int **) bfd_alloc_by_size_t (abfd, sizeof (int *) * 6);
|
||||||
final_type = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
|
final_type = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
|
||||||
if (!final_types || !final_type)
|
if (!final_types || !final_type)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The field selector may require additional relocations to be
|
/* The field selector may require additional relocations to be
|
||||||
generated. It's impossible to know at this moment if additional
|
generated. It's impossible to know at this moment if additional
|
||||||
|
@ -1436,10 +1433,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field, sym_diff)
|
||||||
case e_rtsel:
|
case e_rtsel:
|
||||||
final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
|
final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
|
||||||
if (!final_types[0])
|
if (!final_types[0])
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (field == e_tsel)
|
if (field == e_tsel)
|
||||||
*final_types[0] = R_FSEL;
|
*final_types[0] = R_FSEL;
|
||||||
else if (field == e_ltsel)
|
else if (field == e_ltsel)
|
||||||
|
@ -1455,10 +1449,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field, sym_diff)
|
||||||
case e_rssel:
|
case e_rssel:
|
||||||
final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
|
final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
|
||||||
if (!final_types[0])
|
if (!final_types[0])
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
*final_types[0] = R_S_MODE;
|
*final_types[0] = R_S_MODE;
|
||||||
final_types[1] = final_type;
|
final_types[1] = final_type;
|
||||||
final_types[2] = NULL;
|
final_types[2] = NULL;
|
||||||
|
@ -1469,10 +1460,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field, sym_diff)
|
||||||
case e_rsel:
|
case e_rsel:
|
||||||
final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
|
final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
|
||||||
if (!final_types[0])
|
if (!final_types[0])
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
*final_types[0] = R_N_MODE;
|
*final_types[0] = R_N_MODE;
|
||||||
final_types[1] = final_type;
|
final_types[1] = final_type;
|
||||||
final_types[2] = NULL;
|
final_types[2] = NULL;
|
||||||
|
@ -1483,10 +1471,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field, sym_diff)
|
||||||
case e_rdsel:
|
case e_rdsel:
|
||||||
final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
|
final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
|
||||||
if (!final_types[0])
|
if (!final_types[0])
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
*final_types[0] = R_D_MODE;
|
*final_types[0] = R_D_MODE;
|
||||||
final_types[1] = final_type;
|
final_types[1] = final_type;
|
||||||
final_types[2] = NULL;
|
final_types[2] = NULL;
|
||||||
|
@ -1497,10 +1482,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field, sym_diff)
|
||||||
case e_rrsel:
|
case e_rrsel:
|
||||||
final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
|
final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
|
||||||
if (!final_types[0])
|
if (!final_types[0])
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
*final_types[0] = R_R_MODE;
|
*final_types[0] = R_R_MODE;
|
||||||
final_types[1] = final_type;
|
final_types[1] = final_type;
|
||||||
final_types[2] = NULL;
|
final_types[2] = NULL;
|
||||||
|
@ -1519,10 +1501,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field, sym_diff)
|
||||||
final_types[2] = (int *)bfd_alloc_by_size_t (abfd, sizeof (int));
|
final_types[2] = (int *)bfd_alloc_by_size_t (abfd, sizeof (int));
|
||||||
final_types[3] = (int *)bfd_alloc_by_size_t (abfd, sizeof (int));
|
final_types[3] = (int *)bfd_alloc_by_size_t (abfd, sizeof (int));
|
||||||
if (!final_types[0] || !final_types[1] || !final_types[2])
|
if (!final_types[0] || !final_types[1] || !final_types[2])
|
||||||
{
|
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
if (field == e_fsel)
|
if (field == e_fsel)
|
||||||
*final_types[0] = R_FSEL;
|
*final_types[0] = R_FSEL;
|
||||||
else if (field == e_rsel)
|
else if (field == e_rsel)
|
||||||
|
@ -1577,10 +1556,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field, sym_diff)
|
||||||
final_types[2] = (int *)bfd_alloc_by_size_t (abfd, sizeof (int));
|
final_types[2] = (int *)bfd_alloc_by_size_t (abfd, sizeof (int));
|
||||||
final_types[3] = (int *)bfd_alloc_by_size_t (abfd, sizeof (int));
|
final_types[3] = (int *)bfd_alloc_by_size_t (abfd, sizeof (int));
|
||||||
if (!final_types[0] || !final_types[1] || !final_types[2])
|
if (!final_types[0] || !final_types[1] || !final_types[2])
|
||||||
{
|
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
if (field == e_fsel)
|
if (field == e_fsel)
|
||||||
*final_types[0] = R_FSEL;
|
*final_types[0] = R_FSEL;
|
||||||
else if (field == e_rsel)
|
else if (field == e_rsel)
|
||||||
|
@ -1677,10 +1653,7 @@ som_object_setup (abfd, file_hdrp, aux_hdrp)
|
||||||
obj_som_exec_data (abfd) = (struct som_exec_data *)
|
obj_som_exec_data (abfd) = (struct som_exec_data *)
|
||||||
bfd_zalloc (abfd, sizeof (struct som_exec_data ));
|
bfd_zalloc (abfd, sizeof (struct som_exec_data ));
|
||||||
if (obj_som_exec_data (abfd) == NULL)
|
if (obj_som_exec_data (abfd) == NULL)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The braindamaged OSF1 linker switched exec_flags and exec_entry!
|
/* The braindamaged OSF1 linker switched exec_flags and exec_entry!
|
||||||
|
|
||||||
|
@ -2092,10 +2065,7 @@ som_mkobject (abfd)
|
||||||
abfd->tdata.som_data = (struct som_data_struct *)
|
abfd->tdata.som_data = (struct som_data_struct *)
|
||||||
bfd_zalloc (abfd, sizeof (struct som_data_struct));
|
bfd_zalloc (abfd, sizeof (struct som_data_struct));
|
||||||
if (abfd->tdata.som_data == NULL)
|
if (abfd->tdata.som_data == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2113,11 +2083,7 @@ som_prep_headers (abfd)
|
||||||
/* Make and attach a file header to the BFD. */
|
/* Make and attach a file header to the BFD. */
|
||||||
file_hdr = (struct header *) bfd_zalloc (abfd, sizeof (struct header));
|
file_hdr = (struct header *) bfd_zalloc (abfd, sizeof (struct header));
|
||||||
if (file_hdr == NULL)
|
if (file_hdr == NULL)
|
||||||
|
return false;
|
||||||
{
|
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
obj_som_file_hdr (abfd) = file_hdr;
|
obj_som_file_hdr (abfd) = file_hdr;
|
||||||
|
|
||||||
if (abfd->flags & (EXEC_P | DYNAMIC))
|
if (abfd->flags & (EXEC_P | DYNAMIC))
|
||||||
|
@ -2127,10 +2093,7 @@ som_prep_headers (abfd)
|
||||||
obj_som_exec_hdr (abfd) = (struct som_exec_auxhdr *)
|
obj_som_exec_hdr (abfd) = (struct som_exec_auxhdr *)
|
||||||
bfd_zalloc (abfd, sizeof (struct som_exec_auxhdr));
|
bfd_zalloc (abfd, sizeof (struct som_exec_auxhdr));
|
||||||
if (obj_som_exec_hdr (abfd) == NULL)
|
if (obj_som_exec_hdr (abfd) == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (abfd->flags & D_PAGED)
|
if (abfd->flags & D_PAGED)
|
||||||
file_hdr->a_magic = DEMAND_MAGIC;
|
file_hdr->a_magic = DEMAND_MAGIC;
|
||||||
|
@ -2177,10 +2140,7 @@ som_prep_headers (abfd)
|
||||||
= (struct space_dictionary_record *)
|
= (struct space_dictionary_record *)
|
||||||
bfd_zalloc (abfd, sizeof (struct space_dictionary_record));
|
bfd_zalloc (abfd, sizeof (struct space_dictionary_record));
|
||||||
if (som_section_data (section)->space_dict == NULL)
|
if (som_section_data (section)->space_dict == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
/* Set space attributes. Note most attributes of SOM spaces
|
/* Set space attributes. Note most attributes of SOM spaces
|
||||||
are set based on the subspaces it contains. */
|
are set based on the subspaces it contains. */
|
||||||
som_section_data (section)->space_dict->loader_fix_index = -1;
|
som_section_data (section)->space_dict->loader_fix_index = -1;
|
||||||
|
@ -2203,10 +2163,7 @@ som_prep_headers (abfd)
|
||||||
= (struct subspace_dictionary_record *)
|
= (struct subspace_dictionary_record *)
|
||||||
bfd_zalloc (abfd, sizeof (struct subspace_dictionary_record));
|
bfd_zalloc (abfd, sizeof (struct subspace_dictionary_record));
|
||||||
if (som_section_data (section)->subspace_dict == NULL)
|
if (som_section_data (section)->subspace_dict == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set subspace attributes. Basic stuff is done here, additional
|
/* Set subspace attributes. Basic stuff is done here, additional
|
||||||
attributes are filled in later as more information becomes
|
attributes are filled in later as more information becomes
|
||||||
|
@ -3841,12 +3798,12 @@ som_slurp_string_table (abfd)
|
||||||
|
|
||||||
/* Allocate and read in the string table. */
|
/* Allocate and read in the string table. */
|
||||||
stringtab = malloc (obj_som_stringtab_size (abfd));
|
stringtab = malloc (obj_som_stringtab_size (abfd));
|
||||||
bzero (stringtab, obj_som_stringtab_size (abfd));
|
|
||||||
if (stringtab == NULL)
|
if (stringtab == NULL)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
bfd_set_error (bfd_error_no_memory);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
memset (stringtab, 0, obj_som_stringtab_size (abfd));
|
||||||
|
|
||||||
if (bfd_seek (abfd, obj_som_str_filepos (abfd), SEEK_SET) < 0)
|
if (bfd_seek (abfd, obj_som_str_filepos (abfd), SEEK_SET) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -3949,12 +3906,12 @@ som_slurp_symbol_table (abfd)
|
||||||
|
|
||||||
symbase = (som_symbol_type *)
|
symbase = (som_symbol_type *)
|
||||||
malloc (symbol_count * sizeof (som_symbol_type));
|
malloc (symbol_count * sizeof (som_symbol_type));
|
||||||
bzero (symbase, symbol_count * sizeof (som_symbol_type));
|
|
||||||
if (symbase == NULL)
|
if (symbase == NULL)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
bfd_set_error (bfd_error_no_memory);
|
||||||
goto error_return;
|
goto error_return;
|
||||||
}
|
}
|
||||||
|
memset (symbase, 0, symbol_count * sizeof (som_symbol_type));
|
||||||
|
|
||||||
/* Read in the external SOM representation. */
|
/* Read in the external SOM representation. */
|
||||||
buf = malloc (symbol_count * symsize);
|
buf = malloc (symbol_count * symsize);
|
||||||
|
@ -4136,10 +4093,7 @@ som_make_empty_symbol (abfd)
|
||||||
som_symbol_type *new =
|
som_symbol_type *new =
|
||||||
(som_symbol_type *) bfd_zalloc (abfd, sizeof (som_symbol_type));
|
(som_symbol_type *) bfd_zalloc (abfd, sizeof (som_symbol_type));
|
||||||
if (new == NULL)
|
if (new == NULL)
|
||||||
{
|
return 0;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
new->symbol.the_bfd = abfd;
|
new->symbol.the_bfd = abfd;
|
||||||
|
|
||||||
return &new->symbol;
|
return &new->symbol;
|
||||||
|
@ -4604,10 +4558,7 @@ som_slurp_reloc_table (abfd, section, symbols, just_count)
|
||||||
internal_relocs = (arelent *)
|
internal_relocs = (arelent *)
|
||||||
bfd_zalloc (abfd, (num_relocs * sizeof (arelent)));
|
bfd_zalloc (abfd, (num_relocs * sizeof (arelent)));
|
||||||
if (internal_relocs == (arelent *) NULL)
|
if (internal_relocs == (arelent *) NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Process and internalize the relocations. */
|
/* Process and internalize the relocations. */
|
||||||
som_set_reloc_info (external_relocs, fixup_stream_size,
|
som_set_reloc_info (external_relocs, fixup_stream_size,
|
||||||
|
@ -4679,10 +4630,7 @@ som_new_section_hook (abfd, newsect)
|
||||||
newsect->used_by_bfd =
|
newsect->used_by_bfd =
|
||||||
(PTR) bfd_zalloc (abfd, sizeof (struct som_section_data_struct));
|
(PTR) bfd_zalloc (abfd, sizeof (struct som_section_data_struct));
|
||||||
if (!newsect->used_by_bfd)
|
if (!newsect->used_by_bfd)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
newsect->alignment_power = 3;
|
newsect->alignment_power = 3;
|
||||||
|
|
||||||
/* We allow more than three sections internally */
|
/* We allow more than three sections internally */
|
||||||
|
@ -4733,10 +4681,7 @@ som_bfd_copy_private_section_data (ibfd, isection, obfd, osection)
|
||||||
= (struct som_copyable_section_data_struct *)
|
= (struct som_copyable_section_data_struct *)
|
||||||
bfd_zalloc (obfd, sizeof (struct som_copyable_section_data_struct));
|
bfd_zalloc (obfd, sizeof (struct som_copyable_section_data_struct));
|
||||||
if (som_section_data (osection)->copy_data == NULL)
|
if (som_section_data (osection)->copy_data == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy (som_section_data (osection)->copy_data,
|
memcpy (som_section_data (osection)->copy_data,
|
||||||
som_section_data (isection)->copy_data,
|
som_section_data (isection)->copy_data,
|
||||||
|
@ -4766,10 +4711,7 @@ som_bfd_copy_private_bfd_data (ibfd, obfd)
|
||||||
obj_som_exec_data (obfd) = (struct som_exec_data *)
|
obj_som_exec_data (obfd) = (struct som_exec_data *)
|
||||||
bfd_zalloc (obfd, sizeof (struct som_exec_data));
|
bfd_zalloc (obfd, sizeof (struct som_exec_data));
|
||||||
if (obj_som_exec_data (obfd) == NULL)
|
if (obj_som_exec_data (obfd) == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now copy the data. */
|
/* Now copy the data. */
|
||||||
memcpy (obj_som_exec_data (obfd), obj_som_exec_data (ibfd),
|
memcpy (obj_som_exec_data (obfd), obj_som_exec_data (ibfd),
|
||||||
|
@ -4797,10 +4739,7 @@ bfd_som_set_section_attributes (section, defined, private, sort_key, spnum)
|
||||||
bfd_zalloc (section->owner,
|
bfd_zalloc (section->owner,
|
||||||
sizeof (struct som_copyable_section_data_struct));
|
sizeof (struct som_copyable_section_data_struct));
|
||||||
if (som_section_data (section)->copy_data == NULL)
|
if (som_section_data (section)->copy_data == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
som_section_data (section)->copy_data->sort_key = sort_key;
|
som_section_data (section)->copy_data->sort_key = sort_key;
|
||||||
som_section_data (section)->copy_data->is_defined = defined;
|
som_section_data (section)->copy_data->is_defined = defined;
|
||||||
|
@ -4830,10 +4769,7 @@ bfd_som_set_subsection_attributes (section, container, access,
|
||||||
bfd_zalloc (section->owner,
|
bfd_zalloc (section->owner,
|
||||||
sizeof (struct som_copyable_section_data_struct));
|
sizeof (struct som_copyable_section_data_struct));
|
||||||
if (som_section_data (section)->copy_data == NULL)
|
if (som_section_data (section)->copy_data == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
som_section_data (section)->copy_data->sort_key = sort_key;
|
som_section_data (section)->copy_data->sort_key = sort_key;
|
||||||
som_section_data (section)->copy_data->access_control_bits = access;
|
som_section_data (section)->copy_data->access_control_bits = access;
|
||||||
|
@ -4875,10 +4811,7 @@ bfd_som_attach_aux_hdr (abfd, type, string)
|
||||||
bfd_zalloc (abfd, sizeof (struct aux_id)
|
bfd_zalloc (abfd, sizeof (struct aux_id)
|
||||||
+ sizeof (unsigned int) + len + pad);
|
+ sizeof (unsigned int) + len + pad);
|
||||||
if (!obj_som_version_hdr (abfd))
|
if (!obj_som_version_hdr (abfd))
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
obj_som_version_hdr (abfd)->header_id.type = VERSION_AUX_ID;
|
obj_som_version_hdr (abfd)->header_id.type = VERSION_AUX_ID;
|
||||||
obj_som_version_hdr (abfd)->header_id.length = len + pad;
|
obj_som_version_hdr (abfd)->header_id.length = len + pad;
|
||||||
obj_som_version_hdr (abfd)->header_id.length += sizeof (int);
|
obj_som_version_hdr (abfd)->header_id.length += sizeof (int);
|
||||||
|
@ -4896,10 +4829,7 @@ bfd_som_attach_aux_hdr (abfd, type, string)
|
||||||
bfd_zalloc (abfd, sizeof (struct aux_id)
|
bfd_zalloc (abfd, sizeof (struct aux_id)
|
||||||
+ sizeof (unsigned int) + len + pad);
|
+ sizeof (unsigned int) + len + pad);
|
||||||
if (!obj_som_copyright_hdr (abfd))
|
if (!obj_som_copyright_hdr (abfd))
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
obj_som_copyright_hdr (abfd)->header_id.type = COPYRIGHT_AUX_ID;
|
obj_som_copyright_hdr (abfd)->header_id.type = COPYRIGHT_AUX_ID;
|
||||||
obj_som_copyright_hdr (abfd)->header_id.length = len + pad;
|
obj_som_copyright_hdr (abfd)->header_id.length = len + pad;
|
||||||
obj_som_copyright_hdr (abfd)->header_id.length += sizeof (int);
|
obj_som_copyright_hdr (abfd)->header_id.length += sizeof (int);
|
||||||
|
@ -5216,10 +5146,7 @@ som_bfd_fill_in_ar_symbols (abfd, lst_header, syms)
|
||||||
/* Allocate space for the name and null terminate it too. */
|
/* Allocate space for the name and null terminate it too. */
|
||||||
set->name = bfd_zalloc (abfd, len + 1);
|
set->name = bfd_zalloc (abfd, len + 1);
|
||||||
if (!set->name)
|
if (!set->name)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
if (bfd_read (set->name, 1, len, abfd) != len)
|
if (bfd_read (set->name, 1, len, abfd) != len)
|
||||||
goto error_return;
|
goto error_return;
|
||||||
|
|
||||||
|
@ -5255,10 +5182,7 @@ som_bfd_fill_in_ar_symbols (abfd, lst_header, syms)
|
||||||
/* Allocate space for the name and null terminate it too. */
|
/* Allocate space for the name and null terminate it too. */
|
||||||
set->name = bfd_zalloc (abfd, len + 1);
|
set->name = bfd_zalloc (abfd, len + 1);
|
||||||
if (!set->name)
|
if (!set->name)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bfd_read (set->name, 1, len, abfd) != len)
|
if (bfd_read (set->name, 1, len, abfd) != len)
|
||||||
goto error_return;
|
goto error_return;
|
||||||
|
@ -5369,10 +5293,7 @@ som_slurp_armap (abfd)
|
||||||
(ardata->symdef_count
|
(ardata->symdef_count
|
||||||
* sizeof (carsym)));
|
* sizeof (carsym)));
|
||||||
if (!ardata->symdefs)
|
if (!ardata->symdefs)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now fill in the canonical archive symbols. */
|
/* Now fill in the canonical archive symbols. */
|
||||||
if (som_bfd_fill_in_ar_symbols (abfd, &lst_header, &ardata->symdefs)
|
if (som_bfd_fill_in_ar_symbols (abfd, &lst_header, &ardata->symdefs)
|
||||||
|
@ -5568,10 +5489,7 @@ som_bfd_ar_write_symbol_stuff (abfd, nsyms, string_size, lst)
|
||||||
unsigned int thislen;
|
unsigned int thislen;
|
||||||
|
|
||||||
if (!normal)
|
if (!normal)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
thislen = strlen (normal);
|
thislen = strlen (normal);
|
||||||
if (thislen > maxname)
|
if (thislen > maxname)
|
||||||
extended_name_length += thislen + 1;
|
extended_name_length += thislen + 1;
|
||||||
|
@ -5978,6 +5896,8 @@ som_bfd_link_split_section (abfd, sec)
|
||||||
#define som_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
#define som_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
||||||
#define som_read_minisymbols _bfd_generic_read_minisymbols
|
#define som_read_minisymbols _bfd_generic_read_minisymbols
|
||||||
#define som_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
|
#define som_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
|
||||||
|
#define som_get_section_contents_in_window \
|
||||||
|
_bfd_generic_get_section_contents_in_window
|
||||||
|
|
||||||
#define som_bfd_get_relocated_section_contents \
|
#define som_bfd_get_relocated_section_contents \
|
||||||
bfd_generic_get_relocated_section_contents
|
bfd_generic_get_relocated_section_contents
|
||||||
|
@ -5986,6 +5906,7 @@ som_bfd_link_split_section (abfd, sec)
|
||||||
#define som_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
#define som_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||||
#define som_bfd_final_link _bfd_generic_final_link
|
#define som_bfd_final_link _bfd_generic_final_link
|
||||||
|
|
||||||
|
|
||||||
const bfd_target som_vec =
|
const bfd_target som_vec =
|
||||||
{
|
{
|
||||||
"som", /* name */
|
"som", /* name */
|
||||||
|
|
38
bfd/srec.c
38
bfd/srec.c
|
@ -208,10 +208,7 @@ srec_mkobject (abfd)
|
||||||
{
|
{
|
||||||
tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type));
|
tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type));
|
||||||
if (tdata == NULL)
|
if (tdata == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
abfd->tdata.srec_data = tdata;
|
abfd->tdata.srec_data = tdata;
|
||||||
tdata->type = 1;
|
tdata->type = 1;
|
||||||
tdata->head = NULL;
|
tdata->head = NULL;
|
||||||
|
@ -271,8 +268,9 @@ srec_bad_byte (abfd, lineno, c, error)
|
||||||
buf[0] = c;
|
buf[0] = c;
|
||||||
buf[1] = '\0';
|
buf[1] = '\0';
|
||||||
}
|
}
|
||||||
fprintf (stderr, "%s:%d: Unexpected character `%s' in S-record file\n",
|
(*_bfd_error_handler)
|
||||||
bfd_get_filename (abfd), lineno, buf);
|
("%s:%d: Unexpected character `%s' in S-record file\n",
|
||||||
|
bfd_get_filename (abfd), lineno, buf);
|
||||||
bfd_set_error (bfd_error_bad_value);
|
bfd_set_error (bfd_error_bad_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -289,10 +287,7 @@ srec_new_symbol (abfd, name, val)
|
||||||
|
|
||||||
n = (struct srec_symbol *) bfd_alloc (abfd, sizeof (struct srec_symbol));
|
n = (struct srec_symbol *) bfd_alloc (abfd, sizeof (struct srec_symbol));
|
||||||
if (n == NULL)
|
if (n == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
n->name = name;
|
n->name = name;
|
||||||
n->val = val;
|
n->val = val;
|
||||||
|
@ -765,10 +760,7 @@ srec_get_section_contents (abfd, section, location, offset, count)
|
||||||
section->used_by_bfd = bfd_alloc (abfd, section->_raw_size);
|
section->used_by_bfd = bfd_alloc (abfd, section->_raw_size);
|
||||||
if (section->used_by_bfd == NULL
|
if (section->used_by_bfd == NULL
|
||||||
&& section->_raw_size != 0)
|
&& section->_raw_size != 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! srec_read_section (abfd, section, section->used_by_bfd))
|
if (! srec_read_section (abfd, section, section->used_by_bfd))
|
||||||
return false;
|
return false;
|
||||||
|
@ -796,10 +788,7 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
|
||||||
entry = ((srec_data_list_type *)
|
entry = ((srec_data_list_type *)
|
||||||
bfd_alloc (abfd, sizeof (srec_data_list_type)));
|
bfd_alloc (abfd, sizeof (srec_data_list_type)));
|
||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bytes_to_do
|
if (bytes_to_do
|
||||||
&& (section->flags & SEC_ALLOC)
|
&& (section->flags & SEC_ALLOC)
|
||||||
|
@ -807,10 +796,7 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
|
||||||
{
|
{
|
||||||
bfd_byte *data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do);
|
bfd_byte *data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do);
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
memcpy ((PTR) data, location, (size_t) bytes_to_do);
|
memcpy ((PTR) data, location, (size_t) bytes_to_do);
|
||||||
|
|
||||||
if ((section->lma + offset + bytes_to_do - 1) <= 0xffff)
|
if ((section->lma + offset + bytes_to_do - 1) <= 0xffff)
|
||||||
|
@ -1148,10 +1134,7 @@ srec_get_symtab (abfd, alocation)
|
||||||
|
|
||||||
csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol));
|
csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol));
|
||||||
if (csymbols == NULL && symcount != 0)
|
if (csymbols == NULL && symcount != 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
abfd->tdata.srec_data->csymbols = csymbols;
|
abfd->tdata.srec_data->csymbols = csymbols;
|
||||||
|
|
||||||
for (s = abfd->tdata.srec_data->symbols, c = csymbols;
|
for (s = abfd->tdata.srec_data->symbols, c = csymbols;
|
||||||
|
@ -1224,6 +1207,9 @@ srec_print_symbol (ignore_abfd, afile, symbol, how)
|
||||||
((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l)
|
((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l)
|
||||||
#define srec_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
|
#define srec_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
|
||||||
|
|
||||||
|
#define srec_get_section_contents_in_window \
|
||||||
|
_bfd_generic_get_section_contents_in_window
|
||||||
|
|
||||||
#define srec_set_arch_mach bfd_default_set_arch_mach
|
#define srec_set_arch_mach bfd_default_set_arch_mach
|
||||||
|
|
||||||
#define srec_bfd_get_relocated_section_contents \
|
#define srec_bfd_get_relocated_section_contents \
|
||||||
|
|
80
bfd/sunos.c
80
bfd/sunos.c
|
@ -141,10 +141,7 @@ sunos_read_dynamic_info (abfd)
|
||||||
info = ((struct sunos_dynamic_info *)
|
info = ((struct sunos_dynamic_info *)
|
||||||
bfd_zalloc (abfd, sizeof (struct sunos_dynamic_info)));
|
bfd_zalloc (abfd, sizeof (struct sunos_dynamic_info)));
|
||||||
if (!info)
|
if (!info)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
info->valid = false;
|
info->valid = false;
|
||||||
info->dynsym = NULL;
|
info->dynsym = NULL;
|
||||||
info->dynstr = NULL;
|
info->dynstr = NULL;
|
||||||
|
@ -289,10 +286,7 @@ sunos_slurp_dynamic_symtab (abfd)
|
||||||
(info->dynsym_count
|
(info->dynsym_count
|
||||||
* EXTERNAL_NLIST_SIZE)));
|
* EXTERNAL_NLIST_SIZE)));
|
||||||
if (info->dynsym == NULL && info->dynsym_count != 0)
|
if (info->dynsym == NULL && info->dynsym_count != 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (bfd_seek (abfd, info->dyninfo.ld_stab, SEEK_SET) != 0
|
if (bfd_seek (abfd, info->dyninfo.ld_stab, SEEK_SET) != 0
|
||||||
|| (bfd_read ((PTR) info->dynsym, info->dynsym_count,
|
|| (bfd_read ((PTR) info->dynsym, info->dynsym_count,
|
||||||
EXTERNAL_NLIST_SIZE, abfd)
|
EXTERNAL_NLIST_SIZE, abfd)
|
||||||
|
@ -312,10 +306,7 @@ sunos_slurp_dynamic_symtab (abfd)
|
||||||
{
|
{
|
||||||
info->dynstr = (char *) bfd_alloc (abfd, info->dyninfo.ld_symb_size);
|
info->dynstr = (char *) bfd_alloc (abfd, info->dyninfo.ld_symb_size);
|
||||||
if (info->dynstr == NULL && info->dyninfo.ld_symb_size != 0)
|
if (info->dynstr == NULL && info->dyninfo.ld_symb_size != 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (bfd_seek (abfd, info->dyninfo.ld_symbols, SEEK_SET) != 0
|
if (bfd_seek (abfd, info->dyninfo.ld_symbols, SEEK_SET) != 0
|
||||||
|| (bfd_read ((PTR) info->dynstr, 1, info->dyninfo.ld_symb_size,
|
|| (bfd_read ((PTR) info->dynstr, 1, info->dyninfo.ld_symb_size,
|
||||||
abfd)
|
abfd)
|
||||||
|
@ -398,10 +389,7 @@ sunos_canonicalize_dynamic_symtab (abfd, storage)
|
||||||
(info->dynsym_count
|
(info->dynsym_count
|
||||||
* sizeof (aout_symbol_type))));
|
* sizeof (aout_symbol_type))));
|
||||||
if (info->canonical_dynsym == NULL && info->dynsym_count != 0)
|
if (info->canonical_dynsym == NULL && info->dynsym_count != 0)
|
||||||
{
|
return -1;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! aout_32_translate_symbol_table (abfd, info->canonical_dynsym,
|
if (! aout_32_translate_symbol_table (abfd, info->canonical_dynsym,
|
||||||
info->dynsym, info->dynsym_count,
|
info->dynsym, info->dynsym_count,
|
||||||
|
@ -479,10 +467,7 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms)
|
||||||
(info->dynrel_count
|
(info->dynrel_count
|
||||||
* obj_reloc_entry_size (abfd)));
|
* obj_reloc_entry_size (abfd)));
|
||||||
if (info->dynrel == NULL && info->dynrel_count != 0)
|
if (info->dynrel == NULL && info->dynrel_count != 0)
|
||||||
{
|
return -1;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (bfd_seek (abfd, info->dyninfo.ld_rel, SEEK_SET) != 0
|
if (bfd_seek (abfd, info->dyninfo.ld_rel, SEEK_SET) != 0
|
||||||
|| (bfd_read ((PTR) info->dynrel, info->dynrel_count,
|
|| (bfd_read ((PTR) info->dynrel, info->dynrel_count,
|
||||||
obj_reloc_entry_size (abfd), abfd)
|
obj_reloc_entry_size (abfd), abfd)
|
||||||
|
@ -508,10 +493,7 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms)
|
||||||
(info->dynrel_count
|
(info->dynrel_count
|
||||||
* sizeof (arelent))));
|
* sizeof (arelent))));
|
||||||
if (info->canonical_dynrel == NULL && info->dynrel_count != 0)
|
if (info->canonical_dynrel == NULL && info->dynrel_count != 0)
|
||||||
{
|
return -1;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
to = info->canonical_dynrel;
|
to = info->canonical_dynrel;
|
||||||
|
|
||||||
|
@ -685,10 +667,7 @@ sunos_link_hash_newfunc (entry, table, string)
|
||||||
ret = ((struct sunos_link_hash_entry *)
|
ret = ((struct sunos_link_hash_entry *)
|
||||||
bfd_hash_allocate (table, sizeof (struct sunos_link_hash_entry)));
|
bfd_hash_allocate (table, sizeof (struct sunos_link_hash_entry)));
|
||||||
if (ret == (struct sunos_link_hash_entry *) NULL)
|
if (ret == (struct sunos_link_hash_entry *) NULL)
|
||||||
{
|
return (struct bfd_hash_entry *) ret;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (struct bfd_hash_entry *) ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Call the allocation method of the superclass. */
|
/* Call the allocation method of the superclass. */
|
||||||
ret = ((struct sunos_link_hash_entry *)
|
ret = ((struct sunos_link_hash_entry *)
|
||||||
|
@ -718,10 +697,7 @@ sunos_link_hash_table_create (abfd)
|
||||||
ret = ((struct sunos_link_hash_table *)
|
ret = ((struct sunos_link_hash_table *)
|
||||||
bfd_alloc (abfd, sizeof (struct sunos_link_hash_table)));
|
bfd_alloc (abfd, sizeof (struct sunos_link_hash_table)));
|
||||||
if (ret == (struct sunos_link_hash_table *) NULL)
|
if (ret == (struct sunos_link_hash_table *) NULL)
|
||||||
{
|
return (struct bfd_link_hash_table *) NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (struct bfd_link_hash_table *) NULL;
|
|
||||||
}
|
|
||||||
if (! NAME(aout,link_hash_table_init) (&ret->root, abfd,
|
if (! NAME(aout,link_hash_table_init) (&ret->root, abfd,
|
||||||
sunos_link_hash_newfunc))
|
sunos_link_hash_newfunc))
|
||||||
{
|
{
|
||||||
|
@ -974,10 +950,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
|
||||||
|
|
||||||
needed = (struct bfd_link_needed_list *) bfd_alloc (abfd, sizeof (struct bfd_link_needed_list));
|
needed = (struct bfd_link_needed_list *) bfd_alloc (abfd, sizeof (struct bfd_link_needed_list));
|
||||||
if (needed == NULL)
|
if (needed == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
needed->by = abfd;
|
needed->by = abfd;
|
||||||
|
|
||||||
/* We return the name as [-l]name[.maj][.min]. */
|
/* We return the name as [-l]name[.maj][.min]. */
|
||||||
|
@ -1007,10 +980,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
|
||||||
}
|
}
|
||||||
needed->name = bfd_alloc_finish (abfd);
|
needed->name = bfd_alloc_finish (abfd);
|
||||||
if (needed->name == NULL)
|
if (needed->name == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
needed->next = NULL;
|
needed->next = NULL;
|
||||||
|
|
||||||
|
@ -1293,10 +1263,7 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
|
||||||
s->_raw_size = dynsymcount * sizeof (struct external_nlist);
|
s->_raw_size = dynsymcount * sizeof (struct external_nlist);
|
||||||
s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
|
s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
|
||||||
if (s->contents == NULL && s->_raw_size != 0)
|
if (s->contents == NULL && s->_raw_size != 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The number of buckets is just the number of symbols divided by
|
/* The number of buckets is just the number of symbols divided by
|
||||||
four. To compute the final size of the hash table, we must
|
four. To compute the final size of the hash table, we must
|
||||||
|
@ -1316,10 +1283,7 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
|
||||||
hashalloc = (dynsymcount + bucketcount - 1) * HASH_ENTRY_SIZE;
|
hashalloc = (dynsymcount + bucketcount - 1) * HASH_ENTRY_SIZE;
|
||||||
s->contents = (bfd_byte *) bfd_alloc (dynobj, hashalloc);
|
s->contents = (bfd_byte *) bfd_alloc (dynobj, hashalloc);
|
||||||
if (s->contents == NULL && dynsymcount > 0)
|
if (s->contents == NULL && dynsymcount > 0)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
memset (s->contents, 0, hashalloc);
|
memset (s->contents, 0, hashalloc);
|
||||||
for (i = 0; i < bucketcount; i++)
|
for (i = 0; i < bucketcount; i++)
|
||||||
PUT_WORD (output_bfd, (bfd_vma) -1, s->contents + i * HASH_ENTRY_SIZE);
|
PUT_WORD (output_bfd, (bfd_vma) -1, s->contents + i * HASH_ENTRY_SIZE);
|
||||||
|
@ -1367,10 +1331,7 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
|
||||||
{
|
{
|
||||||
s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
|
s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
|
||||||
if (s->contents == NULL)
|
if (s->contents == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fill in the first entry in the table. */
|
/* Fill in the first entry in the table. */
|
||||||
switch (bfd_get_arch (dynobj))
|
switch (bfd_get_arch (dynobj))
|
||||||
|
@ -1393,10 +1354,7 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
|
||||||
{
|
{
|
||||||
s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
|
s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
|
||||||
if (s->contents == NULL)
|
if (s->contents == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* We use the reloc_count field to keep track of how many of the
|
/* We use the reloc_count field to keep track of how many of the
|
||||||
relocs we have output so far. */
|
relocs we have output so far. */
|
||||||
|
@ -1406,10 +1364,7 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
|
||||||
s = bfd_get_section_by_name (dynobj, ".got");
|
s = bfd_get_section_by_name (dynobj, ".got");
|
||||||
s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
|
s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
|
||||||
if (s->contents == NULL)
|
if (s->contents == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
*sdynptr = bfd_get_section_by_name (dynobj, ".dynamic");
|
*sdynptr = bfd_get_section_by_name (dynobj, ".dynamic");
|
||||||
*sneedptr = bfd_get_section_by_name (dynobj, ".need");
|
*sneedptr = bfd_get_section_by_name (dynobj, ".need");
|
||||||
|
@ -1753,10 +1708,7 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
|
||||||
(bfd_get_symcount (abfd)
|
(bfd_get_symcount (abfd)
|
||||||
* sizeof (bfd_vma)));
|
* sizeof (bfd_vma)));
|
||||||
if (adata (abfd).local_got_offsets == NULL)
|
if (adata (abfd).local_got_offsets == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adata (abfd).local_got_offsets[r_index] != 0)
|
if (adata (abfd).local_got_offsets[r_index] != 0)
|
||||||
|
|
|
@ -530,6 +530,7 @@ extern const bfd_target m68kcoffun_vec;
|
||||||
extern const bfd_target m68klynx_aout_vec;
|
extern const bfd_target m68klynx_aout_vec;
|
||||||
extern const bfd_target m68klynx_coff_vec;
|
extern const bfd_target m68klynx_coff_vec;
|
||||||
extern const bfd_target m68knetbsd_vec;
|
extern const bfd_target m68knetbsd_vec;
|
||||||
|
extern const bfd_target m68k4knetbsd_vec;
|
||||||
extern const bfd_target m88kbcs_vec;
|
extern const bfd_target m88kbcs_vec;
|
||||||
extern const bfd_target m88kmach3_vec;
|
extern const bfd_target m88kmach3_vec;
|
||||||
extern const bfd_target newsos3_vec;
|
extern const bfd_target newsos3_vec;
|
||||||
|
@ -871,10 +872,8 @@ bfd_target_list ()
|
||||||
name_ptr = name_list = (CONST char **)
|
name_ptr = name_list = (CONST char **)
|
||||||
bfd_zmalloc ((vec_length + 1) * sizeof (char **));
|
bfd_zmalloc ((vec_length + 1) * sizeof (char **));
|
||||||
|
|
||||||
if (name_list == NULL) {
|
if (name_list == NULL)
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
for (target = &bfd_target_vector[0]; *target != NULL; target++)
|
for (target = &bfd_target_vector[0]; *target != NULL; target++)
|
||||||
*(name_ptr++) = (*target)->name;
|
*(name_ptr++) = (*target)->name;
|
||||||
|
|
34
bfd/tekhex.c
34
bfd/tekhex.c
|
@ -335,10 +335,7 @@ find_chunk (abfd, vma)
|
||||||
bfd_alloc (abfd, sizeof (struct data_struct));
|
bfd_alloc (abfd, sizeof (struct data_struct));
|
||||||
|
|
||||||
if (!sname || !d)
|
if (!sname || !d)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset (d->chunk_init, 0, CHUNK_MASK + 1);
|
memset (d->chunk_init, 0, CHUNK_MASK + 1);
|
||||||
memset (d->chunk_data, 0, CHUNK_MASK + 1);
|
memset (d->chunk_data, 0, CHUNK_MASK + 1);
|
||||||
|
@ -399,10 +396,7 @@ first_phase (abfd, type, src)
|
||||||
char *n = bfd_alloc (abfd, len + 1);
|
char *n = bfd_alloc (abfd, len + 1);
|
||||||
|
|
||||||
if (!n)
|
if (!n)
|
||||||
{
|
abort(); /* FIXME */
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
abort(); /* FIXME */
|
|
||||||
}
|
|
||||||
memcpy (n, sym, len + 1);
|
memcpy (n, sym, len + 1);
|
||||||
section = bfd_make_section (abfd, n);
|
section = bfd_make_section (abfd, n);
|
||||||
}
|
}
|
||||||
|
@ -431,10 +425,7 @@ first_phase (abfd, type, src)
|
||||||
char type = (*src);
|
char type = (*src);
|
||||||
|
|
||||||
if (!new)
|
if (!new)
|
||||||
{
|
abort(); /* FIXME */
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
abort(); /* FIXME */
|
|
||||||
}
|
|
||||||
new->symbol.the_bfd = abfd;
|
new->symbol.the_bfd = abfd;
|
||||||
src++;
|
src++;
|
||||||
abfd->symcount++;
|
abfd->symcount++;
|
||||||
|
@ -444,10 +435,7 @@ first_phase (abfd, type, src)
|
||||||
len = getsym (sym, &src);
|
len = getsym (sym, &src);
|
||||||
new->symbol.name = bfd_alloc (abfd, len + 1);
|
new->symbol.name = bfd_alloc (abfd, len + 1);
|
||||||
if (!new->symbol.name)
|
if (!new->symbol.name)
|
||||||
{
|
abort(); /* FIXME */
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
abort(); /* FIXME */
|
|
||||||
}
|
|
||||||
memcpy ((char *) (new->symbol.name), sym, len + 1);
|
memcpy ((char *) (new->symbol.name), sym, len + 1);
|
||||||
new->symbol.section = section;
|
new->symbol.section = section;
|
||||||
if (type <= '4')
|
if (type <= '4')
|
||||||
|
@ -545,10 +533,7 @@ tekhex_mkobject (abfd)
|
||||||
tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type));
|
tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type));
|
||||||
|
|
||||||
if (!tdata)
|
if (!tdata)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
abfd->tdata.tekhex_data = tdata;
|
abfd->tdata.tekhex_data = tdata;
|
||||||
tdata->type = 1;
|
tdata->type = 1;
|
||||||
tdata->head = (tekhex_data_list_type *) NULL;
|
tdata->head = (tekhex_data_list_type *) NULL;
|
||||||
|
@ -925,10 +910,7 @@ tekhex_make_empty_symbol (abfd)
|
||||||
(tekhex_symbol_type *) bfd_zalloc (abfd, sizeof (struct tekhex_symbol_struct));
|
(tekhex_symbol_type *) bfd_zalloc (abfd, sizeof (struct tekhex_symbol_struct));
|
||||||
|
|
||||||
if (!new)
|
if (!new)
|
||||||
{
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
new->symbol.the_bfd = abfd;
|
new->symbol.the_bfd = abfd;
|
||||||
new->prev = (struct tekhex_symbol_struct *) NULL;
|
new->prev = (struct tekhex_symbol_struct *) NULL;
|
||||||
return &(new->symbol);
|
return &(new->symbol);
|
||||||
|
@ -992,6 +974,9 @@ tekhex_print_symbol (ignore_abfd, filep, symbol, how)
|
||||||
#define tekhex_bfd_final_link _bfd_generic_final_link
|
#define tekhex_bfd_final_link _bfd_generic_final_link
|
||||||
#define tekhex_bfd_link_split_section _bfd_generic_link_split_section
|
#define tekhex_bfd_link_split_section _bfd_generic_link_split_section
|
||||||
|
|
||||||
|
#define tekhex_get_section_contents_in_window \
|
||||||
|
_bfd_generic_get_section_contents_in_window
|
||||||
|
|
||||||
const bfd_target tekhex_vec =
|
const bfd_target tekhex_vec =
|
||||||
{
|
{
|
||||||
"tekhex", /* name */
|
"tekhex", /* name */
|
||||||
|
@ -1006,7 +991,6 @@ const bfd_target tekhex_vec =
|
||||||
0, /* leading underscore */
|
0, /* leading underscore */
|
||||||
' ', /* ar_pad_char */
|
' ', /* ar_pad_char */
|
||||||
16, /* ar_max_namelen */
|
16, /* ar_max_namelen */
|
||||||
1, /* minimum alignment */
|
|
||||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
||||||
|
|
|
@ -41,7 +41,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
asection *stack_section;
|
asection *stack_section;
|
||||||
asection *reg_section;
|
asection *reg_section;
|
||||||
struct user u;
|
struct user u;
|
||||||
} *rawptr;
|
};
|
||||||
|
|
||||||
#define core_upage(bfd) (&((bfd)->tdata.trad_core_data->u))
|
#define core_upage(bfd) (&((bfd)->tdata.trad_core_data->u))
|
||||||
#define core_datasec(bfd) ((bfd)->tdata.trad_core_data->data_section)
|
#define core_datasec(bfd) ((bfd)->tdata.trad_core_data->data_section)
|
||||||
|
@ -66,6 +66,7 @@ trad_unix_core_file_p (abfd)
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
struct user u;
|
struct user u;
|
||||||
|
struct trad_core_struct *rawptr;
|
||||||
|
|
||||||
#ifdef TRAD_CORE_USER_OFFSET
|
#ifdef TRAD_CORE_USER_OFFSET
|
||||||
/* If defined, this macro is the file position of the user struct. */
|
/* If defined, this macro is the file position of the user struct. */
|
||||||
|
@ -135,10 +136,8 @@ trad_unix_core_file_p (abfd)
|
||||||
a single free() will free them both. */
|
a single free() will free them both. */
|
||||||
rawptr = (struct trad_core_struct *)
|
rawptr = (struct trad_core_struct *)
|
||||||
bfd_zmalloc (sizeof (struct trad_core_struct));
|
bfd_zmalloc (sizeof (struct trad_core_struct));
|
||||||
if (rawptr == NULL) {
|
if (rawptr == NULL)
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
abfd->tdata.trad_core_data = rawptr;
|
abfd->tdata.trad_core_data = rawptr;
|
||||||
|
|
||||||
|
@ -147,24 +146,15 @@ trad_unix_core_file_p (abfd)
|
||||||
/* Create the sections. This is raunchy, but bfd_close wants to free
|
/* Create the sections. This is raunchy, but bfd_close wants to free
|
||||||
them separately. */
|
them separately. */
|
||||||
|
|
||||||
core_stacksec(abfd) = (asection *) bfd_zmalloc (sizeof (asection));
|
core_stacksec(abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||||
if (core_stacksec (abfd) == NULL) {
|
if (core_stacksec (abfd) == NULL)
|
||||||
loser:
|
return NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
core_datasec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||||
free ((void *)rawptr);
|
if (core_datasec (abfd) == NULL)
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||||
core_datasec (abfd) = (asection *) bfd_zmalloc (sizeof (asection));
|
if (core_regsec (abfd) == NULL)
|
||||||
if (core_datasec (abfd) == NULL) {
|
return NULL;
|
||||||
loser1:
|
|
||||||
free ((void *)core_stacksec (abfd));
|
|
||||||
goto loser;
|
|
||||||
}
|
|
||||||
core_regsec (abfd) = (asection *) bfd_zmalloc (sizeof (asection));
|
|
||||||
if (core_regsec (abfd) == NULL) {
|
|
||||||
free ((void *)core_datasec (abfd));
|
|
||||||
goto loser1;
|
|
||||||
}
|
|
||||||
|
|
||||||
core_stacksec (abfd)->name = ".stack";
|
core_stacksec (abfd)->name = ".stack";
|
||||||
core_datasec (abfd)->name = ".data";
|
core_datasec (abfd)->name = ".data";
|
||||||
|
@ -210,7 +200,7 @@ trad_unix_core_file_p (abfd)
|
||||||
0 is at the place pointed to by u_ar0 (by setting the vma of the start
|
0 is at the place pointed to by u_ar0 (by setting the vma of the start
|
||||||
of the section to -u_ar0). GDB uses this info to locate the regs,
|
of the section to -u_ar0). GDB uses this info to locate the regs,
|
||||||
using minor trickery to get around the offset-or-absolute-addr problem. */
|
using minor trickery to get around the offset-or-absolute-addr problem. */
|
||||||
core_regsec (abfd)->vma = 0 - (int) u.u_ar0;
|
core_regsec (abfd)->vma = 0 - (bfd_vma) u.u_ar0;
|
||||||
|
|
||||||
core_datasec (abfd)->filepos = NBPG * UPAGES;
|
core_datasec (abfd)->filepos = NBPG * UPAGES;
|
||||||
core_stacksec (abfd)->filepos = (NBPG * UPAGES) + NBPG * u.u_dsize
|
core_stacksec (abfd)->filepos = (NBPG * UPAGES) + NBPG * u.u_dsize
|
||||||
|
@ -290,7 +280,6 @@ const bfd_target trad_core_vec =
|
||||||
0, /* symbol prefix */
|
0, /* symbol prefix */
|
||||||
' ', /* ar_pad_char */
|
' ', /* ar_pad_char */
|
||||||
16, /* ar_max_namelen */
|
16, /* ar_max_namelen */
|
||||||
3, /* minimum alignment power */
|
|
||||||
NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */
|
NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */
|
||||||
NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */
|
NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */
|
||||||
NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */
|
NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */
|
||||||
|
|
|
@ -162,10 +162,7 @@ versados_mkobject (abfd)
|
||||||
{
|
{
|
||||||
tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type));
|
tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type));
|
||||||
if (tdata == NULL)
|
if (tdata == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
abfd->tdata.versados_data = tdata;
|
abfd->tdata.versados_data = tdata;
|
||||||
tdata->symbols = NULL;
|
tdata->symbols = NULL;
|
||||||
VDATA (abfd)->alert = 0x12345678;
|
VDATA (abfd)->alert = 0x12345678;
|
||||||
|
@ -672,6 +669,9 @@ versados_get_section_contents (abfd, section, location, offset, count)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define versados_get_section_contents_in_window \
|
||||||
|
_bfd_generic_get_section_contents_in_window
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
versados_set_section_contents (abfd, section, location, offset, bytes_to_do)
|
versados_set_section_contents (abfd, section, location, offset, bytes_to_do)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
|
@ -866,7 +866,6 @@ const bfd_target versados_vec =
|
||||||
0, /* leading underscore */
|
0, /* leading underscore */
|
||||||
' ', /* ar_pad_char */
|
' ', /* ar_pad_char */
|
||||||
16, /* ar_max_namelen */
|
16, /* ar_max_namelen */
|
||||||
1, /* minimum alignment */
|
|
||||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
||||||
|
|
|
@ -585,10 +585,7 @@ xcoff_link_hash_newfunc (entry, table, string)
|
||||||
ret = ((struct xcoff_link_hash_entry *)
|
ret = ((struct xcoff_link_hash_entry *)
|
||||||
bfd_hash_allocate (table, sizeof (struct xcoff_link_hash_entry)));
|
bfd_hash_allocate (table, sizeof (struct xcoff_link_hash_entry)));
|
||||||
if (ret == (struct xcoff_link_hash_entry *) NULL)
|
if (ret == (struct xcoff_link_hash_entry *) NULL)
|
||||||
{
|
return (struct bfd_hash_entry *) ret;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (struct bfd_hash_entry *) ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Call the allocation method of the superclass. */
|
/* Call the allocation method of the superclass. */
|
||||||
ret = ((struct xcoff_link_hash_entry *)
|
ret = ((struct xcoff_link_hash_entry *)
|
||||||
|
@ -621,10 +618,7 @@ _bfd_xcoff_bfd_link_hash_table_create (abfd)
|
||||||
ret = ((struct xcoff_link_hash_table *)
|
ret = ((struct xcoff_link_hash_table *)
|
||||||
bfd_alloc (abfd, sizeof (struct xcoff_link_hash_table)));
|
bfd_alloc (abfd, sizeof (struct xcoff_link_hash_table)));
|
||||||
if (ret == (struct xcoff_link_hash_table *) NULL)
|
if (ret == (struct xcoff_link_hash_table *) NULL)
|
||||||
{
|
return (struct bfd_link_hash_table *) NULL;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return (struct bfd_link_hash_table *) NULL;
|
|
||||||
}
|
|
||||||
if (! _bfd_link_hash_table_init (&ret->root, abfd, xcoff_link_hash_newfunc))
|
if (! _bfd_link_hash_table_init (&ret->root, abfd, xcoff_link_hash_newfunc))
|
||||||
{
|
{
|
||||||
bfd_release (abfd, ret);
|
bfd_release (abfd, ret);
|
||||||
|
@ -1043,10 +1037,7 @@ xcoff_link_add_symbols (abfd, info)
|
||||||
(symcount
|
(symcount
|
||||||
* sizeof (struct xcoff_link_hash_entry *))));
|
* sizeof (struct xcoff_link_hash_entry *))));
|
||||||
if (sym_hash == NULL && symcount != 0)
|
if (sym_hash == NULL && symcount != 0)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
coff_data (abfd)->sym_hashes = (struct coff_link_hash_entry **) sym_hash;
|
coff_data (abfd)->sym_hashes = (struct coff_link_hash_entry **) sym_hash;
|
||||||
memset (sym_hash, 0,
|
memset (sym_hash, 0,
|
||||||
(size_t) symcount * sizeof (struct xcoff_link_hash_entry *));
|
(size_t) symcount * sizeof (struct xcoff_link_hash_entry *));
|
||||||
|
@ -1057,10 +1048,7 @@ xcoff_link_add_symbols (abfd, info)
|
||||||
csect_cache = ((asection **)
|
csect_cache = ((asection **)
|
||||||
bfd_alloc (abfd, symcount * sizeof (asection *)));
|
bfd_alloc (abfd, symcount * sizeof (asection *)));
|
||||||
if (csect_cache == NULL && symcount != 0)
|
if (csect_cache == NULL && symcount != 0)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
xcoff_data (abfd)->csects = csect_cache;
|
xcoff_data (abfd)->csects = csect_cache;
|
||||||
memset (csect_cache, 0, (size_t) symcount * sizeof (asection *));
|
memset (csect_cache, 0, (size_t) symcount * sizeof (asection *));
|
||||||
|
|
||||||
|
@ -1489,17 +1477,11 @@ xcoff_link_add_symbols (abfd, info)
|
||||||
((struct coff_section_tdata *)
|
((struct coff_section_tdata *)
|
||||||
bfd_zalloc (abfd, sizeof (struct coff_section_tdata)));
|
bfd_zalloc (abfd, sizeof (struct coff_section_tdata)));
|
||||||
if (csect->used_by_bfd == NULL)
|
if (csect->used_by_bfd == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
coff_section_data (abfd, csect)->tdata =
|
coff_section_data (abfd, csect)->tdata =
|
||||||
bfd_zalloc (abfd, sizeof (struct xcoff_section_tdata));
|
bfd_zalloc (abfd, sizeof (struct xcoff_section_tdata));
|
||||||
if (coff_section_data (abfd, csect)->tdata == NULL)
|
if (coff_section_data (abfd, csect)->tdata == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
xcoff_section_data (abfd, csect)->enclosing = enclosing;
|
xcoff_section_data (abfd, csect)->enclosing = enclosing;
|
||||||
xcoff_section_data (abfd, csect)->lineno_count =
|
xcoff_section_data (abfd, csect)->lineno_count =
|
||||||
enclosing->lineno_count;
|
enclosing->lineno_count;
|
||||||
|
@ -1622,17 +1604,11 @@ xcoff_link_add_symbols (abfd, info)
|
||||||
((struct coff_section_tdata *)
|
((struct coff_section_tdata *)
|
||||||
bfd_zalloc (abfd, sizeof (struct coff_section_tdata)));
|
bfd_zalloc (abfd, sizeof (struct coff_section_tdata)));
|
||||||
if (csect->used_by_bfd == NULL)
|
if (csect->used_by_bfd == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
coff_section_data (abfd, csect)->tdata =
|
coff_section_data (abfd, csect)->tdata =
|
||||||
bfd_zalloc (abfd, sizeof (struct xcoff_section_tdata));
|
bfd_zalloc (abfd, sizeof (struct xcoff_section_tdata));
|
||||||
if (coff_section_data (abfd, csect)->tdata == NULL)
|
if (coff_section_data (abfd, csect)->tdata == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
xcoff_section_data (abfd, csect)->first_symndx = csect_index;
|
xcoff_section_data (abfd, csect)->first_symndx = csect_index;
|
||||||
|
|
||||||
if (first_csect == NULL)
|
if (first_csect == NULL)
|
||||||
|
@ -2071,10 +2047,7 @@ xcoff_link_add_dynamic_symbols (abfd, info)
|
||||||
n = ((struct xcoff_import_file *)
|
n = ((struct xcoff_import_file *)
|
||||||
bfd_alloc (abfd, sizeof (struct xcoff_import_file)));
|
bfd_alloc (abfd, sizeof (struct xcoff_import_file)));
|
||||||
if (n == NULL)
|
if (n == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
n->next = NULL;
|
n->next = NULL;
|
||||||
|
|
||||||
/* For some reason, the path entry in the import file list for a
|
/* For some reason, the path entry in the import file list for a
|
||||||
|
@ -2344,10 +2317,7 @@ bfd_xcoff_link_record_set (output_bfd, info, harg, size)
|
||||||
n = ((struct xcoff_link_size_list *)
|
n = ((struct xcoff_link_size_list *)
|
||||||
bfd_alloc (output_bfd, sizeof (struct xcoff_link_size_list)));
|
bfd_alloc (output_bfd, sizeof (struct xcoff_link_size_list)));
|
||||||
if (n == NULL)
|
if (n == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
n->next = xcoff_hash_table (info)->size_list;
|
n->next = xcoff_hash_table (info)->size_list;
|
||||||
n->h = h;
|
n->h = h;
|
||||||
n->size = size;
|
n->size = size;
|
||||||
|
@ -2401,10 +2371,7 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
|
||||||
h->ldsym = ((struct internal_ldsym *)
|
h->ldsym = ((struct internal_ldsym *)
|
||||||
bfd_zalloc (output_bfd, sizeof (struct internal_ldsym)));
|
bfd_zalloc (output_bfd, sizeof (struct internal_ldsym)));
|
||||||
if (h->ldsym == NULL)
|
if (h->ldsym == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imppath == NULL)
|
if (imppath == NULL)
|
||||||
|
@ -2433,10 +2400,7 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
|
||||||
n = ((struct xcoff_import_file *)
|
n = ((struct xcoff_import_file *)
|
||||||
bfd_alloc (output_bfd, sizeof (struct xcoff_import_file)));
|
bfd_alloc (output_bfd, sizeof (struct xcoff_import_file)));
|
||||||
if (n == NULL)
|
if (n == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
n->next = NULL;
|
n->next = NULL;
|
||||||
n->path = imppath;
|
n->path = imppath;
|
||||||
n->file = impfile;
|
n->file = impfile;
|
||||||
|
@ -2764,10 +2728,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
|
||||||
lsec->_raw_size = stoff + ldhdr->l_stlen;
|
lsec->_raw_size = stoff + ldhdr->l_stlen;
|
||||||
lsec->contents = (bfd_byte *) bfd_zalloc (output_bfd, lsec->_raw_size);
|
lsec->contents = (bfd_byte *) bfd_zalloc (output_bfd, lsec->_raw_size);
|
||||||
if (lsec->contents == NULL)
|
if (lsec->contents == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set up the header. */
|
/* Set up the header. */
|
||||||
xcoff_swap_ldhdr_out (output_bfd, ldhdr,
|
xcoff_swap_ldhdr_out (output_bfd, ldhdr,
|
||||||
|
@ -2818,30 +2779,21 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
|
||||||
{
|
{
|
||||||
sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size);
|
sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size);
|
||||||
if (sec->contents == NULL)
|
if (sec->contents == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
sec = xcoff_hash_table (info)->toc_section;
|
sec = xcoff_hash_table (info)->toc_section;
|
||||||
if (sec->_raw_size > 0)
|
if (sec->_raw_size > 0)
|
||||||
{
|
{
|
||||||
sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size);
|
sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size);
|
||||||
if (sec->contents == NULL)
|
if (sec->contents == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
sec = xcoff_hash_table (info)->descriptor_section;
|
sec = xcoff_hash_table (info)->descriptor_section;
|
||||||
if (sec->_raw_size > 0)
|
if (sec->_raw_size > 0)
|
||||||
{
|
{
|
||||||
sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size);
|
sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size);
|
||||||
if (sec->contents == NULL)
|
if (sec->contents == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now that we've done garbage collection, figure out the contents
|
/* Now that we've done garbage collection, figure out the contents
|
||||||
|
@ -2878,10 +2830,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
|
||||||
debug_index = ((unsigned long *)
|
debug_index = ((unsigned long *)
|
||||||
bfd_zalloc (sub, symcount * sizeof (unsigned long)));
|
bfd_zalloc (sub, symcount * sizeof (unsigned long)));
|
||||||
if (debug_index == NULL)
|
if (debug_index == NULL)
|
||||||
{
|
goto error_return;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
goto error_return;
|
|
||||||
}
|
|
||||||
xcoff_data (sub)->debug_indices = debug_index;
|
xcoff_data (sub)->debug_indices = debug_index;
|
||||||
|
|
||||||
/* Grab the contents of the .debug section. We use malloc and
|
/* Grab the contents of the .debug section. We use malloc and
|
||||||
|
@ -3131,7 +3080,6 @@ xcoff_build_ldsyms (h, p)
|
||||||
if (h->ldsym == NULL)
|
if (h->ldsym == NULL)
|
||||||
{
|
{
|
||||||
ldinfo->failed = true;
|
ldinfo->failed = true;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4704,10 +4652,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
|
||||||
bfd_alloc (finfo->output_bfd,
|
bfd_alloc (finfo->output_bfd,
|
||||||
sizeof (struct xcoff_toc_rel_hash)));
|
sizeof (struct xcoff_toc_rel_hash)));
|
||||||
if (n == NULL)
|
if (n == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
si = finfo->section_info + target_index;
|
si = finfo->section_info + target_index;
|
||||||
n->next = si->toc_rel_hashes;
|
n->next = si->toc_rel_hashes;
|
||||||
n->h = h;
|
n->h = h;
|
||||||
|
@ -5375,10 +5320,7 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
|
||||||
size = bfd_get_reloc_size (howto);
|
size = bfd_get_reloc_size (howto);
|
||||||
buf = (bfd_byte *) bfd_zmalloc (size);
|
buf = (bfd_byte *) bfd_zmalloc (size);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
{
|
return false;
|
||||||
bfd_set_error (bfd_error_no_memory);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf);
|
rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf);
|
||||||
switch (rstat)
|
switch (rstat)
|
||||||
|
|
Loading…
Reference in New Issue