Some of these are guesses, if you know different, just yell.
Thu Oct 8 08:52:48 1992 Steve Chamberlain (sac@thepub.cygnus.com) Now a bfd knows whether underscores are normally prepended to symbols in its file format. Helps with error messages. * aout-adobe.c, aout-target.h, bout.c, coff-a29k.c, coff-h8300.c, coff-z8k.c: targets set so they have leading underscore * coff-i386.c, coff-i960.c, coff-m68k.c, coff-mips.c, coff-m88k.c, coff-rs6000.c, coff-we32k.c, elf.c, ieee.c, srec.c: targets set without leading underscore flag * targets.c: add symbol leading char to xvec description * bfd-in.h (bfd_get_symbol_leading_char): new macro.
This commit is contained in:
parent
0da7012441
commit
294eaca479
18 changed files with 955 additions and 529 deletions
|
@ -1,3 +1,16 @@
|
|||
Thu Oct 8 08:52:48 1992 Steve Chamberlain (sac@thepub.cygnus.com)
|
||||
|
||||
Now a bfd knows whether underscores are normally prepended
|
||||
to symbols in its file format.
|
||||
|
||||
* aout-adobe.c, aout-target.h, bout.c, coff-a29k.c, coff-h8300.c,
|
||||
coff-z8k.c: targets set so they have leading underscore
|
||||
* coff-i386.c, coff-i960.c, coff-m68k.c, coff-mips.c, coff-m88k.c,
|
||||
coff-rs6000.c, coff-we32k.c, elf.c, ieee.c, srec.c: targets set
|
||||
without leading underscore flag
|
||||
* targets.c: add symbol leading char to xvec description
|
||||
* bfd-in.h (bfd_get_symbol_leading_char): new macro.
|
||||
|
||||
Mon Oct 5 14:32:55 1992 Per Bothner (bothner@cygnus.com)
|
||||
|
||||
* archive.c: Make errno global.
|
||||
|
|
507
bfd/aout-adobe.c
Normal file
507
bfd/aout-adobe.c
Normal file
|
@ -0,0 +1,507 @@
|
|||
/* BFD back-end for a.out.adobe binaries.
|
||||
Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support. Based on bout.c.
|
||||
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
#include "aout/adobe.h"
|
||||
|
||||
#include "aout/stab_gnu.h"
|
||||
#include "libaout.h" /* BFD a.out internal data structures */
|
||||
|
||||
extern bfd_target a_out_adobe_vec; /* Forward decl */
|
||||
|
||||
PROTO (static bfd_target *, aout_adobe_callback, (bfd *));
|
||||
|
||||
PROTO (boolean, aout_32_slurp_symbol_table, (bfd *abfd));
|
||||
PROTO (void , aout_32_write_syms, ());
|
||||
PROTO (static void, aout_adobe_write_section, (bfd *abfd, sec_ptr sect));
|
||||
|
||||
/* Swaps the information in an executable header taken from a raw byte
|
||||
stream memory image, into the internal exec_header structure. */
|
||||
|
||||
PROTO(void, aout_adobe_swap_exec_header_in,
|
||||
(bfd *abfd,
|
||||
struct external_exec *raw_bytes,
|
||||
struct internal_exec *execp));
|
||||
|
||||
void
|
||||
DEFUN(aout_adobe_swap_exec_header_in,(abfd, raw_bytes, execp),
|
||||
bfd *abfd AND
|
||||
struct external_exec *raw_bytes AND
|
||||
struct internal_exec *execp)
|
||||
{
|
||||
struct external_exec *bytes = (struct external_exec *)raw_bytes;
|
||||
|
||||
/* Now fill in fields in the execp, from the bytes in the raw data. */
|
||||
execp->a_info = bfd_h_get_32 (abfd, bytes->e_info);
|
||||
execp->a_text = GET_WORD (abfd, bytes->e_text);
|
||||
execp->a_data = GET_WORD (abfd, bytes->e_data);
|
||||
execp->a_bss = GET_WORD (abfd, bytes->e_bss);
|
||||
execp->a_syms = GET_WORD (abfd, bytes->e_syms);
|
||||
execp->a_entry = GET_WORD (abfd, bytes->e_entry);
|
||||
execp->a_trsize = GET_WORD (abfd, bytes->e_trsize);
|
||||
execp->a_drsize = GET_WORD (abfd, bytes->e_drsize);
|
||||
}
|
||||
|
||||
/* Swaps the information in an internal exec header structure into the
|
||||
supplied buffer ready for writing to disk. */
|
||||
|
||||
PROTO(void, aout_adobe_swap_exec_header_out,
|
||||
(bfd *abfd,
|
||||
struct internal_exec *execp,
|
||||
struct external_exec *raw_bytes));
|
||||
void
|
||||
DEFUN(aout_adobe_swap_exec_header_out,(abfd, execp, raw_bytes),
|
||||
bfd *abfd AND
|
||||
struct internal_exec *execp AND
|
||||
struct external_exec *raw_bytes)
|
||||
{
|
||||
struct external_exec *bytes = (struct external_exec *)raw_bytes;
|
||||
|
||||
/* Now fill in fields in the raw data, from the fields in the exec struct. */
|
||||
bfd_h_put_32 (abfd, execp->a_info , bytes->e_info);
|
||||
PUT_WORD (abfd, execp->a_text , bytes->e_text);
|
||||
PUT_WORD (abfd, execp->a_data , bytes->e_data);
|
||||
PUT_WORD (abfd, execp->a_bss , bytes->e_bss);
|
||||
PUT_WORD (abfd, execp->a_syms , bytes->e_syms);
|
||||
PUT_WORD (abfd, execp->a_entry , bytes->e_entry);
|
||||
PUT_WORD (abfd, execp->a_trsize, bytes->e_trsize);
|
||||
PUT_WORD (abfd, execp->a_drsize, bytes->e_drsize);
|
||||
}
|
||||
|
||||
|
||||
static bfd_target *
|
||||
aout_adobe_object_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct internal_exec anexec;
|
||||
struct external_exec exec_bytes;
|
||||
char *targ;
|
||||
|
||||
if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
|
||||
!= EXEC_BYTES_SIZE) {
|
||||
bfd_error = wrong_format;
|
||||
return 0;
|
||||
}
|
||||
|
||||
anexec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info);
|
||||
|
||||
/* Normally we just compare for the magic number.
|
||||
However, a bunch of Adobe tools aren't fixed up yet; they generate
|
||||
files using ZMAGIC(!).
|
||||
If the environment variable GNUTARGET is set to "a.out.adobe", we will
|
||||
take just about any a.out file as an Adobe a.out file. FIXME! */
|
||||
|
||||
if (N_BADMAG (anexec)) {
|
||||
targ = getenv ("GNUTARGET");
|
||||
if (targ && strcmp (targ, a_out_adobe_vec.name))
|
||||
; /* Just continue anyway, if specifically set to this format */
|
||||
else
|
||||
{
|
||||
bfd_error = wrong_format;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
aout_adobe_swap_exec_header_in (abfd, &exec_bytes, &anexec);
|
||||
return aout_32_some_aout_object_p (abfd, &anexec, aout_adobe_callback);
|
||||
}
|
||||
|
||||
|
||||
/* Finish up the opening of a b.out file for reading. Fill in all the
|
||||
fields that are not handled by common code. */
|
||||
|
||||
static bfd_target *
|
||||
aout_adobe_callback (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
unsigned long bss_start;
|
||||
asection *sect;
|
||||
struct external_segdesc ext[1];
|
||||
char *section_name;
|
||||
char try_again[30]; /* name and number */
|
||||
char *newname;
|
||||
int trynum;
|
||||
flagword flags;
|
||||
|
||||
/* Architecture and machine type -- unknown in this format. */
|
||||
bfd_set_arch_mach(abfd, bfd_arch_unknown, 0);
|
||||
|
||||
/* The positions of the string table and symbol table. */
|
||||
obj_str_filepos (abfd) = N_STROFF (*execp);
|
||||
obj_sym_filepos (abfd) = N_SYMOFF (*execp);
|
||||
|
||||
/* Suck up the section information from the file, one section at a time. */
|
||||
|
||||
for (;;) {
|
||||
if (bfd_read ((PTR) ext, 1, sizeof (*ext), abfd) != sizeof (*ext)) {
|
||||
bfd_error = wrong_format;
|
||||
return 0;
|
||||
}
|
||||
switch (ext->e_type[0]) {
|
||||
case N_TEXT:
|
||||
section_name = ".text";
|
||||
flags = SEC_CODE | SEC_LOAD | SEC_ALLOC | SEC_HAS_CONTENTS;
|
||||
break;
|
||||
|
||||
case N_DATA:
|
||||
section_name = ".data";
|
||||
flags = SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_HAS_CONTENTS;
|
||||
break;
|
||||
|
||||
case N_BSS:
|
||||
section_name = ".bss";
|
||||
flags = SEC_DATA | SEC_HAS_CONTENTS;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
goto no_more_sections;
|
||||
|
||||
default:
|
||||
fprintf (stderr, "Unknown section type in a.out.adobe file: %x\n",
|
||||
ext->e_type);
|
||||
goto no_more_sections;
|
||||
}
|
||||
|
||||
/* First one is called ".text" or whatever; subsequent ones are
|
||||
".text1", ".text2", ... */
|
||||
|
||||
bfd_error = no_error;
|
||||
sect = bfd_make_section (abfd, section_name);
|
||||
trynum = 0;
|
||||
while (!sect) {
|
||||
if (bfd_error != no_error)
|
||||
return 0; /* Some other error -- slide into the sunset */
|
||||
sprintf (try_again, "%s%d", section_name, ++trynum);
|
||||
sect = bfd_make_section (abfd, try_again);
|
||||
}
|
||||
|
||||
/* Fix the name, if it is a sprintf'd name. */
|
||||
if (sect->name == try_again) {
|
||||
newname = (char *) bfd_zalloc(abfd, strlen (sect->name));
|
||||
if (newname == NULL) {
|
||||
bfd_error = no_memory;
|
||||
return 0;
|
||||
}
|
||||
strcpy (newname, sect->name);
|
||||
sect->name = newname;
|
||||
}
|
||||
|
||||
/* Now set the section's attributes. */
|
||||
bfd_set_section_flags (abfd, sect, flags);
|
||||
sect->_raw_size = ((ext->e_size[0] << 8) /* Assumed big-endian */
|
||||
| ext->e_size[1] << 8)
|
||||
| ext->e_size[2];
|
||||
sect->_cooked_size = sect->_raw_size;
|
||||
sect->vma = bfd_h_get_32 (abfd, ext->e_virtbase);
|
||||
sect->filepos = bfd_h_get_32 (abfd, ext->e_filebase);
|
||||
/* FIXME XXX alignment? */
|
||||
|
||||
/* Set relocation information for first section of each type. */
|
||||
if (trynum == 0) switch (ext->e_type[0]) {
|
||||
case N_TEXT:
|
||||
sect->rel_filepos = N_TRELOFF (*execp);
|
||||
sect->reloc_count = execp->a_trsize;
|
||||
break;
|
||||
|
||||
case N_DATA:
|
||||
sect->rel_filepos = N_DRELOFF (*execp);
|
||||
sect->reloc_count = execp->a_drsize;
|
||||
break;
|
||||
}
|
||||
}
|
||||
no_more_sections:
|
||||
|
||||
adata(abfd).reloc_entry_size = sizeof (struct reloc_std_external);
|
||||
adata(abfd).symbol_entry_size = sizeof (struct external_nlist);
|
||||
adata(abfd).page_size = 1; /* Not applicable. */
|
||||
adata(abfd).segment_size = 1; /* Not applicable. */
|
||||
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
|
||||
return abfd->xvec;
|
||||
}
|
||||
|
||||
struct bout_data_struct {
|
||||
struct aoutdata a;
|
||||
struct internal_exec e;
|
||||
};
|
||||
|
||||
static boolean
|
||||
aout_adobe_mkobject (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct bout_data_struct *rawptr;
|
||||
|
||||
rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, sizeof (struct bout_data_struct));
|
||||
if (rawptr == NULL) {
|
||||
bfd_error = no_memory;
|
||||
return false;
|
||||
}
|
||||
|
||||
abfd->tdata.bout_data = rawptr;
|
||||
exec_hdr (abfd) = &rawptr->e;
|
||||
|
||||
adata(abfd).reloc_entry_size = sizeof (struct reloc_std_external);
|
||||
adata(abfd).symbol_entry_size = sizeof (struct external_nlist);
|
||||
adata(abfd).page_size = 1; /* Not applicable. */
|
||||
adata(abfd).segment_size = 1; /* Not applicable. */
|
||||
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static boolean
|
||||
aout_adobe_write_object_contents (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct external_exec swapped_hdr;
|
||||
static struct external_segdesc sentinel[1] = {0};
|
||||
asection *sect;
|
||||
|
||||
exec_hdr (abfd)->a_info = ZMAGIC;
|
||||
|
||||
/* Calculate text size as total of text sections, etc. */
|
||||
|
||||
exec_hdr (abfd)->a_text = 0;
|
||||
exec_hdr (abfd)->a_data = 0;
|
||||
exec_hdr (abfd)->a_bss = 0;
|
||||
exec_hdr (abfd)->a_trsize = 0;
|
||||
exec_hdr (abfd)->a_drsize = 0;
|
||||
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (sect->flags & SEC_CODE) {
|
||||
exec_hdr (abfd)->a_text += sect->_raw_size;
|
||||
exec_hdr (abfd)->a_trsize += sect->reloc_count *
|
||||
sizeof (struct reloc_std_external);
|
||||
} else if (sect->flags & SEC_DATA) {
|
||||
exec_hdr (abfd)->a_data += sect->_raw_size;
|
||||
exec_hdr (abfd)->a_drsize += sect->reloc_count *
|
||||
sizeof (struct reloc_std_external);
|
||||
} else if (sect->flags & SEC_ALLOC && !(sect->flags & SEC_LOAD)) {
|
||||
exec_hdr (abfd)->a_bss += sect->_raw_size;
|
||||
}
|
||||
}
|
||||
|
||||
exec_hdr (abfd)->a_syms = bfd_get_symcount (abfd)
|
||||
* sizeof (struct external_nlist);
|
||||
exec_hdr (abfd)->a_entry = bfd_get_start_address (abfd);
|
||||
|
||||
aout_adobe_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr);
|
||||
|
||||
bfd_seek (abfd, 0L, SEEK_SET);
|
||||
bfd_write ((PTR) &swapped_hdr, 1, EXEC_BYTES_SIZE, abfd);
|
||||
|
||||
/* Now write out the section information. Text first, data next, rest
|
||||
afterward. */
|
||||
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (sect->flags & SEC_CODE) {
|
||||
aout_adobe_write_section (abfd, sect);
|
||||
}
|
||||
}
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (sect->flags & SEC_DATA) {
|
||||
aout_adobe_write_section (abfd, sect);
|
||||
}
|
||||
}
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (!(sect->flags & (SEC_CODE|SEC_DATA))) {
|
||||
aout_adobe_write_section (abfd, sect);
|
||||
}
|
||||
}
|
||||
|
||||
/* Write final `sentinel` section header (with type of 0). */
|
||||
bfd_write ((PTR) sentinel, 1, sizeof (*sentinel), abfd);
|
||||
|
||||
/* Now write out reloc info, followed by syms and strings */
|
||||
if (bfd_get_symcount (abfd) != 0)
|
||||
{
|
||||
bfd_seek (abfd,
|
||||
(long)(N_SYMOFF(*exec_hdr(abfd))), SEEK_SET);
|
||||
|
||||
aout_32_write_syms (abfd);
|
||||
|
||||
bfd_seek (abfd, (long)(N_TRELOFF(*exec_hdr(abfd))), SEEK_SET);
|
||||
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (sect->flags & SEC_CODE) {
|
||||
if (!aout_32_squirt_out_relocs (abfd, sect))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bfd_seek (abfd, (long)(N_DRELOFF(*exec_hdr(abfd))), SEEK_SET);
|
||||
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (sect->flags & SEC_DATA) {
|
||||
if (!aout_32_squirt_out_relocs (abfd, sect))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
aout_adobe_write_section (abfd, sect)
|
||||
bfd *abfd;
|
||||
sec_ptr sect;
|
||||
{
|
||||
/* FIXME XXX */
|
||||
}
|
||||
|
||||
static boolean
|
||||
aout_adobe_set_section_contents (abfd, section, location, offset, count)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
unsigned char *location;
|
||||
file_ptr offset;
|
||||
int count;
|
||||
{
|
||||
file_ptr section_start;
|
||||
sec_ptr sect;
|
||||
|
||||
if (abfd->output_has_begun == false) { /* set by bfd.c handler */
|
||||
|
||||
/* Assign file offsets to sections. Text sections are first, and
|
||||
are contiguous. Then data sections. Everything else at the end. */
|
||||
|
||||
section_start = N_TXTOFF (ignore<-->me);
|
||||
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (sect->flags & SEC_CODE) {
|
||||
sect->filepos = section_start;
|
||||
/* FIXME: Round to alignment */
|
||||
section_start += sect->_raw_size;
|
||||
}
|
||||
}
|
||||
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (sect->flags & SEC_DATA) {
|
||||
sect->filepos = section_start;
|
||||
/* FIXME: Round to alignment */
|
||||
section_start += sect->_raw_size;
|
||||
}
|
||||
}
|
||||
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (sect->flags & SEC_HAS_CONTENTS &&
|
||||
!(sect->flags & (SEC_CODE|SEC_DATA))) {
|
||||
sect->filepos = section_start;
|
||||
/* FIXME: Round to alignment */
|
||||
section_start += sect->_raw_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* regardless, once we know what we're doing, we might as well get going */
|
||||
bfd_seek (abfd, section->filepos + offset, SEEK_SET);
|
||||
|
||||
if (count != 0) {
|
||||
return (bfd_write ((PTR)location, 1, count, abfd) == count) ?true:false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean
|
||||
aout_adobe_set_arch_mach (abfd, arch, machine)
|
||||
bfd *abfd;
|
||||
enum bfd_architecture arch;
|
||||
unsigned long machine;
|
||||
{
|
||||
bfd_default_set_arch_mach(abfd, arch, machine);
|
||||
|
||||
if (arch == bfd_arch_unknown) /* Unknown machine arch is OK */
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int
|
||||
DEFUN(aout_adobe_sizeof_headers,(ignore_abfd, ignore),
|
||||
bfd *ignore_abfd AND
|
||||
boolean ignore)
|
||||
{
|
||||
return sizeof(struct internal_exec);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Build the transfer vector for Adobe A.Out files. */
|
||||
|
||||
/* We don't have core files. */
|
||||
#define aout_32_core_file_failing_command _bfd_dummy_core_file_failing_command
|
||||
#define aout_32_core_file_failing_signal _bfd_dummy_core_file_failing_signal
|
||||
#define aout_32_core_file_matches_executable_p \
|
||||
_bfd_dummy_core_file_matches_executable_p
|
||||
|
||||
/* We use BSD-Unix generic archive files. */
|
||||
#define aout_32_openr_next_archived_file bfd_generic_openr_next_archived_file
|
||||
#define aout_32_generic_stat_arch_elt bfd_generic_stat_arch_elt
|
||||
#define aout_32_slurp_armap bfd_slurp_bsd_armap
|
||||
#define aout_32_slurp_extended_name_table bfd_true
|
||||
#define aout_32_write_armap bsd_write_armap
|
||||
#define aout_32_truncate_arname bfd_bsd_truncate_arname
|
||||
|
||||
/* We override these routines from the usual a.out file routines. */
|
||||
#define aout_32_set_section_contents aout_adobe_set_section_contents
|
||||
#define aout_32_set_arch_mach aout_adobe_set_arch_mach
|
||||
#define aout_32_sizeof_headers aout_adobe_sizeof_headers
|
||||
|
||||
#define aout_32_bfd_debug_info_start bfd_void
|
||||
#define aout_32_bfd_debug_info_end bfd_void
|
||||
#define aout_32_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
|
||||
|
||||
#define aout_32_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
|
||||
#define aout_32_bfd_relax_section bfd_generic_relax_section
|
||||
|
||||
bfd_target a_out_adobe_vec =
|
||||
{
|
||||
"a.out.adobe", /* name */
|
||||
bfd_target_aout_flavour,
|
||||
true, /* data byte order is unknown (big assumed) */
|
||||
true, /* hdr byte order is big */
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT ),
|
||||
/* section flags */
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_DATA | SEC_RELOC),
|
||||
'_', /* symbol leading char */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
2, /* minumum alignment power */
|
||||
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
|
||||
{_bfd_dummy_target, aout_adobe_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, aout_adobe_mkobject, /* bfd_set_format */
|
||||
_bfd_generic_mkarchive, bfd_false},
|
||||
{bfd_false, aout_adobe_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
|
||||
JUMP_TABLE(aout_32)
|
||||
};
|
||||
|
|
@ -29,8 +29,9 @@ DEFUN(MY(callback),(abfd),
|
|||
bfd *abfd)
|
||||
{
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
/* Calculate the file positions of the parts of a newly read aout header */
|
||||
struct aout_backend_data *abdp;
|
||||
|
||||
/* Calculate the file positions of the parts of a newly read aout header */
|
||||
obj_textsec (abfd)->_raw_size = N_TXTSIZE(*execp);
|
||||
|
||||
/* The virtual memory addresses of the sections */
|
||||
|
@ -57,6 +58,9 @@ DEFUN(MY(callback),(abfd),
|
|||
bfd_default_set_arch_mach(abfd, DEFAULT_ARCH, 0);
|
||||
#endif
|
||||
|
||||
/* Don't set sizes now -- can't be sure until we know arch & mach.
|
||||
Sizes get set in set_sizes callback, later. */
|
||||
#if 0
|
||||
adata(abfd).page_size = PAGE_SIZE;
|
||||
#ifdef SEGMENT_SIZE
|
||||
adata(abfd).segment_size = SEGMENT_SIZE;
|
||||
|
@ -64,6 +68,7 @@ DEFUN(MY(callback),(abfd),
|
|||
adata(abfd).segment_size = PAGE_SIZE;
|
||||
#endif
|
||||
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
#endif
|
||||
|
||||
return abfd->xvec;
|
||||
}
|
||||
|
@ -124,6 +129,8 @@ DEFUN(MY(mkobject),(abfd),
|
|||
{
|
||||
if (NAME(aout,mkobject)(abfd) == false)
|
||||
return false;
|
||||
#if 0 /* Sizes get set in set_sizes callback, later, after we know
|
||||
the architecture and machine. */
|
||||
adata(abfd).page_size = PAGE_SIZE;
|
||||
#ifdef SEGMENT_SIZE
|
||||
adata(abfd).segment_size = SEGMENT_SIZE;
|
||||
|
@ -131,6 +138,7 @@ DEFUN(MY(mkobject),(abfd),
|
|||
adata(abfd).segment_size = PAGE_SIZE;
|
||||
#endif
|
||||
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
#define MY_mkobject MY(mkobject)
|
||||
|
@ -162,6 +170,32 @@ DEFUN(MY(write_object_contents),(abfd),
|
|||
#define MY_write_object_contents MY(write_object_contents)
|
||||
#endif
|
||||
|
||||
#ifndef MY_set_sizes
|
||||
static boolean
|
||||
DEFUN(MY(set_sizes),(abfd), bfd *abfd)
|
||||
{
|
||||
adata(abfd).page_size = PAGE_SIZE;
|
||||
#ifdef SEGMENT_SIZE
|
||||
adata(abfd).segment_size = SEGMENT_SIZE;
|
||||
#else
|
||||
adata(abfd).segment_size = PAGE_SIZE;
|
||||
#endif
|
||||
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
return true;
|
||||
}
|
||||
#define MY_set_sizes MY(set_sizes)
|
||||
#endif
|
||||
|
||||
#ifndef MY_backend_data
|
||||
static CONST struct aout_backend_data MY(backend_data) = {
|
||||
0, /* zmagic contiguous */
|
||||
0, /* text incl header */
|
||||
0, /* text vma? */
|
||||
MY_set_sizes,
|
||||
};
|
||||
#define MY_backend_data &MY(backend_data)
|
||||
#endif
|
||||
|
||||
/* We assume BFD generic archive files. */
|
||||
#ifndef MY_openr_next_archived_file
|
||||
#define MY_openr_next_archived_file bfd_generic_openr_next_archived_file
|
||||
|
@ -291,8 +325,10 @@ DEFUN(MY(write_object_contents),(abfd),
|
|||
#ifndef MY_make_debug_symbol
|
||||
#define MY_make_debug_symbol 0
|
||||
#endif
|
||||
#ifndef MY_backend_data
|
||||
#define MY_backend_data (PTR) 0
|
||||
|
||||
/* Aout symbols normally have leading underscores */
|
||||
#ifndef MY_symbol_leading_char
|
||||
#define MY_symbol_leading_char '_'
|
||||
#endif
|
||||
|
||||
bfd_target MY(vec) =
|
||||
|
@ -310,6 +346,7 @@ bfd_target MY(vec) =
|
|||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
MY_symbol_leading_char,
|
||||
' ', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
1, /* minimum alignment */
|
||||
|
|
50
bfd/bfd-in.h
50
bfd/bfd-in.h
|
@ -52,7 +52,7 @@ here. */
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#define BFD_VERSION "1.96"
|
||||
#define BFD_VERSION "2.0"
|
||||
|
||||
/* forward declaration */
|
||||
typedef struct _bfd bfd;
|
||||
|
@ -106,17 +106,17 @@ typedef enum bfd_format {
|
|||
bfd_format;
|
||||
|
||||
/* Object file flag values */
|
||||
#define NO_FLAGS 0
|
||||
#define HAS_RELOC 001
|
||||
#define EXEC_P 002
|
||||
#define HAS_LINENO 004
|
||||
#define HAS_DEBUG 010
|
||||
#define HAS_SYMS 020
|
||||
#define HAS_LOCALS 040
|
||||
#define DYNAMIC 0100
|
||||
#define WP_TEXT 0200
|
||||
#define D_PAGED 0400
|
||||
|
||||
#define NO_FLAGS 0x00
|
||||
#define HAS_RELOC 0x01
|
||||
#define EXEC_P 0x02
|
||||
#define HAS_LINENO 0x04
|
||||
#define HAS_DEBUG 0x08
|
||||
#define HAS_SYMS 0x10
|
||||
#define HAS_LOCALS 0x20
|
||||
#define DYNAMIC 0x40
|
||||
#define WP_TEXT 0x80
|
||||
#define D_PAGED 0x100
|
||||
#define BFD_IS_RELAXABLE 0x200
|
||||
|
||||
/* symbols and relocation */
|
||||
|
||||
|
@ -180,14 +180,17 @@ typedef struct lineno_cache_entry {
|
|||
|
||||
typedef struct sec *sec_ptr;
|
||||
|
||||
#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
|
||||
#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
|
||||
#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
|
||||
#define bfd_section_name(bfd, ptr) ((ptr)->name)
|
||||
#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
|
||||
#define bfd_section_vma(bfd, ptr) ((ptr)->vma)
|
||||
#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
|
||||
#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags)
|
||||
#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
|
||||
#define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
|
||||
|
||||
#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (val)), true)
|
||||
#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (val)), ((ptr)->user_set_vma = true), true)
|
||||
#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
|
||||
#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
|
||||
|
||||
|
@ -203,7 +206,7 @@ typedef enum bfd_error {
|
|||
symbol_not_found, file_not_recognized,
|
||||
file_ambiguously_recognized, no_contents,
|
||||
bfd_error_nonrepresentable_section,
|
||||
no_debug_section,
|
||||
no_debug_section, bad_value,
|
||||
invalid_error_code} bfd_ec;
|
||||
|
||||
extern bfd_ec bfd_error;
|
||||
|
@ -226,7 +229,7 @@ typedef struct bfd_error_vector {
|
|||
|
||||
} bfd_error_vector_type;
|
||||
|
||||
PROTO (char *, bfd_errmsg, (bfd_ec error_tag));
|
||||
PROTO (CONST char *, bfd_errmsg, (bfd_ec error_tag));
|
||||
PROTO (void, bfd_perror, (CONST char *message));
|
||||
|
||||
|
||||
|
@ -324,21 +327,10 @@ extern CONST short _bfd_host_big_endian;
|
|||
#define bfd_get_architecture(abfd) ((abfd)->obj_arch)
|
||||
#define bfd_get_machine(abfd) ((abfd)->obj_machine)
|
||||
|
||||
|
||||
#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
|
||||
|
||||
#define BYTE_SIZE 1
|
||||
#define SHORT_SIZE 2
|
||||
#define LONG_SIZE 4
|
||||
|
||||
|
||||
|
||||
/* ANd more from the source */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* And more from the source. */
|
||||
|
|
99
bfd/bout.c
99
bfd/bout.c
|
@ -391,18 +391,17 @@ static reloc_howto_type howto_reloc_abs32code =
|
|||
HOWTO(ABS32CODE, 0, 2, 32, false, 0, true, true,0,"callx", true, 0xffffffff,0xffffffff,false);
|
||||
|
||||
static reloc_howto_type howto_align_table[] = {
|
||||
HOWTO (ALIGN, 0, 0x1, 0, 0, 0, 0, 0, 0, "align16", 0, 0, 0, 0),
|
||||
HOWTO (ALIGN, 0, 0x3, 0, 0, 0, 0, 0, 0, "align32", 0, 0, 0, 0),
|
||||
HOWTO (ALIGN, 0, 0x7, 0, 0, 0, 0, 0, 0, "align64", 0, 0, 0, 0),
|
||||
HOWTO (ALIGN, 0, 0xf, 0, 0, 0, 0, 0, 0, "align128", 0, 0, 0, 0),
|
||||
HOWTO (ALIGN, 0, 0x1, 0, false, 0, false, false, 0, "align16", false, 0, 0, false),
|
||||
HOWTO (ALIGN, 0, 0x3, 0, false, 0, false, false, 0, "align32", false, 0, 0, false),
|
||||
HOWTO (ALIGN, 0, 0x7, 0, false, 0, false, false, 0, "align64", false, 0, 0, false),
|
||||
HOWTO (ALIGN, 0, 0xf, 0, false, 0, false, false, 0, "align128", false, 0, 0, false),
|
||||
};
|
||||
|
||||
static reloc_howto_type howto_done_align_table[] = {
|
||||
HOWTO (ALIGNDONE, 0x1, 0x1, 0, 0, 0, 0, 0, 0, "donealign16", 0, 0, 0,0),
|
||||
HOWTO (ALIGNDONE, 0x3, 0x3, 0, 0, 0, 0, 0, 0, "donealign32", 0, 0, 0,0),
|
||||
HOWTO (ALIGNDONE, 0x7, 0x7, 0, 0, 0, 0, 0, 0, "donealign64", 0, 0, 0,0),
|
||||
HOWTO (ALIGNDONE, 0xf, 0xf, 0, 0, 0, 0, 0, 0, "donealign128", 0, 0, 0,0),
|
||||
|
||||
HOWTO (ALIGNDONE, 0x1, 0x1, 0, false, 0, false, false, 0, "donealign16", false, 0, 0, false),
|
||||
HOWTO (ALIGNDONE, 0x3, 0x3, 0, false, 0, false, false, 0, "donealign32", false, 0, 0, false),
|
||||
HOWTO (ALIGNDONE, 0x7, 0x7, 0, false, 0, false, false, 0, "donealign64", false, 0, 0, false),
|
||||
HOWTO (ALIGNDONE, 0xf, 0xf, 0, false, 0, false, false, 0, "donealign128", false, 0, 0, false),
|
||||
};
|
||||
|
||||
static reloc_howto_type *
|
||||
|
@ -509,6 +508,7 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
|
|||
unsigned char *raw = (unsigned char *)rptr;
|
||||
unsigned int symnum;
|
||||
cache_ptr->address = bfd_h_get_32 (abfd, raw + 0);
|
||||
cache_ptr->howto = 0;
|
||||
if (abfd->xvec->header_byteorder_big_p)
|
||||
{
|
||||
symnum = (raw[4] << 16) | (raw[5] << 8) | raw[6];
|
||||
|
@ -617,7 +617,6 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
|
|||
*/
|
||||
arelent tmp;
|
||||
arelent *cursor = cache_ptr-1;
|
||||
unsigned int where = counter;
|
||||
bfd_vma stop = cache_ptr->address;
|
||||
tmp = *cache_ptr;
|
||||
while (cursor->address > stop && cursor >= reloc_cache)
|
||||
|
@ -652,21 +651,19 @@ b_out_squirt_out_relocs (abfd, section)
|
|||
arelent **generic;
|
||||
int r_extern;
|
||||
int r_idx;
|
||||
int r_addend;
|
||||
int incode_mask;
|
||||
int len_1;
|
||||
unsigned int count = section->reloc_count;
|
||||
struct relocation_info *native, *natptr;
|
||||
size_t natsize = count * sizeof (struct relocation_info);
|
||||
int extern_mask, pcrel_mask, len_2, callj_mask;
|
||||
int len1;
|
||||
if (count == 0) return true;
|
||||
generic = section->orelocation;
|
||||
native = ((struct relocation_info *) bfd_xmalloc (natsize));
|
||||
if (!native) {
|
||||
bfd_error = no_memory;
|
||||
return false;
|
||||
}
|
||||
bfd_error = no_memory;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (abfd->xvec->header_byteorder_big_p)
|
||||
{
|
||||
|
@ -678,7 +675,7 @@ b_out_squirt_out_relocs (abfd, section)
|
|||
callj_mask = 0x02;
|
||||
incode_mask = 0x08;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
/* Little-endian bit field allocation order */
|
||||
pcrel_mask = 0x01;
|
||||
|
@ -719,15 +716,27 @@ else
|
|||
raw[7] = len_2 + incode_mask;
|
||||
}
|
||||
else {
|
||||
raw[7] = len_2;
|
||||
}
|
||||
raw[7] = len_2;
|
||||
}
|
||||
if (output_section == &bfd_com_section
|
||||
|| output_section == &bfd_abs_section
|
||||
|| output_section == &bfd_und_section)
|
||||
{
|
||||
/* Fill in symbol */
|
||||
r_extern = 1;
|
||||
r_idx = stoi((*(g->sym_ptr_ptr))->flags);
|
||||
|
||||
if (bfd_abs_section.symbol == sym)
|
||||
{
|
||||
/* Whoops, looked like an abs symbol, but is really an offset
|
||||
from the abs section */
|
||||
r_idx = 0;
|
||||
r_extern = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Fill in symbol */
|
||||
|
||||
r_extern = 1;
|
||||
r_idx = stoi((*(g->sym_ptr_ptr))->flags);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -737,22 +746,22 @@ else
|
|||
}
|
||||
|
||||
if (abfd->xvec->header_byteorder_big_p) {
|
||||
raw[4] = (unsigned char) (r_idx >> 16);
|
||||
raw[5] = (unsigned char) (r_idx >> 8);
|
||||
raw[6] = (unsigned char) (r_idx );
|
||||
} else {
|
||||
raw[6] = (unsigned char) (r_idx >> 16);
|
||||
raw[5] = (unsigned char) (r_idx>> 8);
|
||||
raw[4] = (unsigned char) (r_idx );
|
||||
}
|
||||
if (r_extern)
|
||||
raw[7] |= extern_mask;
|
||||
raw[4] = (unsigned char) (r_idx >> 16);
|
||||
raw[5] = (unsigned char) (r_idx >> 8);
|
||||
raw[6] = (unsigned char) (r_idx );
|
||||
} else {
|
||||
raw[6] = (unsigned char) (r_idx >> 16);
|
||||
raw[5] = (unsigned char) (r_idx>> 8);
|
||||
raw[4] = (unsigned char) (r_idx );
|
||||
}
|
||||
if (r_extern)
|
||||
raw[7] |= extern_mask;
|
||||
}
|
||||
|
||||
if (bfd_write ((PTR) native, 1, natsize, abfd) != natsize) {
|
||||
free((PTR)native);
|
||||
return false;
|
||||
}
|
||||
free((PTR)native);
|
||||
return false;
|
||||
}
|
||||
free ((PTR)native);
|
||||
|
||||
return true;
|
||||
|
@ -979,11 +988,9 @@ DEFUN(aligncode,(input_section, symbols, r, shrink),
|
|||
unsigned int shrink)
|
||||
{
|
||||
bfd_vma value = get_value(r,0);
|
||||
|
||||
|
||||
bfd_vma dot = input_section->output_section->vma + input_section->output_offset + r->address;
|
||||
bfd_vma gap;
|
||||
bfd_vma this_dot;
|
||||
bfd_vma old_end;
|
||||
bfd_vma new_end;
|
||||
int shrink_delta;
|
||||
|
@ -1259,18 +1266,19 @@ bfd_target b_out_vec_big_host =
|
|||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT ),
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
'_', /* symbol leading char */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
2, /* minumum alignment power */
|
||||
2, /* minumum alignment power */
|
||||
|
||||
_do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* data */
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
|
||||
{_bfd_dummy_target, b_out_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, b_out_mkobject, /* bfd_set_format */
|
||||
_bfd_generic_mkarchive, bfd_false},
|
||||
{bfd_false, b_out_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
_do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* data */
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
|
||||
{_bfd_dummy_target, b_out_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, b_out_mkobject, /* bfd_set_format */
|
||||
_bfd_generic_mkarchive, bfd_false},
|
||||
{bfd_false, b_out_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
|
||||
JUMP_TABLE(aout_32),
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* COFF stuff?! */
|
||||
|
@ -1288,6 +1296,7 @@ bfd_target b_out_vec_little_host =
|
|||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT ),
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
'_', /* symbol leading char */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
2, /* minum align */
|
||||
|
|
|
@ -290,49 +290,50 @@ static void DEFUN(reloc_processing,(relent,reloc, symbols, abfd, section) ,
|
|||
|
||||
bfd_target a29kcoff_big_vec =
|
||||
{
|
||||
"coff-a29k-big", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
true, /* data byte order is big */
|
||||
true, /* header byte order is big */
|
||||
"coff-a29k-big", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
true, /* data byte order is big */
|
||||
true, /* header byte order is big */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC /* section flags */
|
||||
| SEC_LOAD | SEC_RELOC
|
||||
| SEC_READONLY ),
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
2, /* minimum section alignment */
|
||||
/* data */
|
||||
_do_getb64, _do_putb64, _do_getb32,
|
||||
_do_putb32, _do_getb16, _do_putb16,
|
||||
/* hdrs */
|
||||
_do_getb64, _do_putb64, _do_getb32,
|
||||
_do_putb32, _do_getb16, _do_putb16,
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC /* section flags */
|
||||
| SEC_LOAD | SEC_RELOC
|
||||
| SEC_READONLY ),
|
||||
'_', /* leading underscore */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
2, /* minimum section alignment */
|
||||
/* data */
|
||||
_do_getb64, _do_putb64, _do_getb32,
|
||||
_do_putb32, _do_getb16, _do_putb16,
|
||||
/* hdrs */
|
||||
_do_getb64, _do_putb64, _do_getb32,
|
||||
_do_putb32, _do_getb16, _do_putb16,
|
||||
|
||||
{
|
||||
{
|
||||
|
||||
_bfd_dummy_target,
|
||||
coff_object_p,
|
||||
bfd_generic_archive_p,
|
||||
_bfd_dummy_target
|
||||
},
|
||||
{
|
||||
bfd_false,
|
||||
coff_mkobject,
|
||||
_bfd_generic_mkarchive,
|
||||
bfd_false
|
||||
},
|
||||
{
|
||||
bfd_false,
|
||||
coff_write_object_contents,
|
||||
_bfd_write_archive_contents,
|
||||
bfd_false
|
||||
},
|
||||
_bfd_dummy_target,
|
||||
coff_object_p,
|
||||
bfd_generic_archive_p,
|
||||
_bfd_dummy_target
|
||||
},
|
||||
{
|
||||
bfd_false,
|
||||
coff_mkobject,
|
||||
_bfd_generic_mkarchive,
|
||||
bfd_false
|
||||
},
|
||||
{
|
||||
bfd_false,
|
||||
coff_write_object_contents,
|
||||
_bfd_write_archive_contents,
|
||||
bfd_false
|
||||
},
|
||||
|
||||
JUMP_TABLE(coff),
|
||||
COFF_SWAP_TABLE
|
||||
JUMP_TABLE(coff),
|
||||
COFF_SWAP_TABLE
|
||||
};
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ struct internal_reloc *dst)
|
|||
break;
|
||||
|
||||
default:
|
||||
abort();
|
||||
fprintf(stderr,"Bad reloc\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -125,8 +125,6 @@ static void DEFUN(reloc_processing,(relent,reloc, symbols, abfd, section) ,
|
|||
bfd *abfd AND
|
||||
asection *section)
|
||||
{
|
||||
|
||||
asymbol *ptr;
|
||||
relent->address = reloc->r_vaddr;
|
||||
rtype2howto(relent,reloc);
|
||||
|
||||
|
@ -152,7 +150,10 @@ static void DEFUN(reloc_processing,(relent,reloc, symbols, abfd, section) ,
|
|||
#include "coffcode.h"
|
||||
|
||||
|
||||
#define coff_write_armap bsd_write_armap
|
||||
#undef coff_bfd_get_relocated_section_contents
|
||||
#undef coff_bfd_relax_section
|
||||
#define coff_bfd_get_relocated_section_contents bfd_coff_get_relocated_section_contents
|
||||
#define coff_bfd_relax_section bfd_coff_relax_section
|
||||
|
||||
bfd_target h8300coff_vec =
|
||||
{
|
||||
|
@ -164,8 +165,8 @@ bfd_target h8300coff_vec =
|
|||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
|
||||
|
||||
( SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
'_', /* leading char */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
1, /* minimum section alignment */
|
||||
|
|
|
@ -18,14 +18,12 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "obstack.h"
|
||||
#include "coff-i386.h"
|
||||
#include "internalcoff.h"
|
||||
#include "coff/i386.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
|
||||
|
@ -61,7 +59,7 @@ static reloc_howto_type howto_table[] =
|
|||
#define I386 1 /* Customize coffcode.h */
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) \
|
||||
cache_ptr->howto = howto_table + dst.r_type;
|
||||
cache_ptr->howto = howto_table + (dst)->r_type;
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
|
@ -83,6 +81,7 @@ bfd_target i386coff_vec =
|
|||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading underscore */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#define I960 1
|
||||
#define BADMAG(x) I960BADMAG(x)
|
||||
|
||||
|
@ -30,19 +28,21 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#include "coff/i960.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h" /* to allow easier abstraction-breaking */
|
||||
|
||||
#define COFF_LONG_FILENAMES
|
||||
|
||||
#define CALLS 0x66003800 /* Template for 'calls' instruction */
|
||||
#define BAL 0x0b000000 /* Template for 'bal' instruction */
|
||||
#define BAL_MASK 0x00ffffff
|
||||
|
||||
static bfd_reloc_status_type
|
||||
DEFUN (optcall_callback, (abfd, reloc_entry, symbol_in, data, ignore_input_section),
|
||||
DEFUN (optcall_callback, (abfd, reloc_entry, symbol_in, data,
|
||||
ignore_input_section, ignore_bfd),
|
||||
bfd *abfd AND
|
||||
arelent *reloc_entry AND
|
||||
asymbol *symbol_in AND
|
||||
PTR data AND
|
||||
asection *ignore_input_section)
|
||||
asection *ignore_input_section AND
|
||||
bfd *ignore_bfd)
|
||||
{
|
||||
/* This item has already been relocated correctly, but we may be
|
||||
* able to patch in yet better code - done by digging out the
|
||||
|
@ -110,7 +110,7 @@ static reloc_howto_type howto_optcall =
|
|||
static reloc_howto_type *
|
||||
DEFUN (coff_i960_reloc_type_lookup, (abfd, code),
|
||||
bfd *abfd AND
|
||||
bfd_reloc_code_type code)
|
||||
bfd_reloc_code_real_type code)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -153,19 +153,20 @@ bfd_target icoff_little_vec =
|
|||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading underscore */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
|
||||
3, /* minimum alignment power */
|
||||
3, /* minimum alignment power */
|
||||
_do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* data */
|
||||
_do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* hdrs */
|
||||
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, coff_mkobject, /* bfd_set_format */
|
||||
_bfd_generic_mkarchive, bfd_false},
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, coff_mkobject, /* bfd_set_format */
|
||||
_bfd_generic_mkarchive, bfd_false},
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
JUMP_TABLE(coff),
|
||||
COFF_SWAP_TABLE,
|
||||
coff_i960_reloc_type_lookup,
|
||||
|
@ -185,6 +186,7 @@ bfd_target icoff_big_vec =
|
|||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading underscore */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
|
||||
|
|
|
@ -18,17 +18,15 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "obstack.h"
|
||||
#include "coff-m68k.h"
|
||||
#include "internalcoff.h"
|
||||
#include "coff/m68k.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
static reloc_howto_type howto_table[] =
|
||||
reloc_howto_type m68kcoff_howto_table[] =
|
||||
{
|
||||
HOWTO(R_RELBYTE, 0, 0, 8, false, 0, true, true,0,"8", true, 0x000000ff,0x000000ff, false),
|
||||
HOWTO(R_RELWORD, 0, 1, 16, false, 0, true, true,0,"16", true, 0x0000ffff,0x0000ffff, false),
|
||||
|
@ -36,26 +34,42 @@ static reloc_howto_type howto_table[] =
|
|||
HOWTO(R_PCRBYTE, 0, 0, 8, true, 0, false, true,0,"DISP8", true, 0x000000ff,0x000000ff, false),
|
||||
HOWTO(R_PCRWORD, 0, 1, 16, true, 0, false, true,0,"DISP16", true, 0x0000ffff,0x0000ffff, false),
|
||||
HOWTO(R_PCRLONG, 0, 2, 32, true, 0, false, true,0,"DISP32", true, 0xffffffff,0xffffffff, false),
|
||||
HOWTO(R_RELLONG_NEG, 0, -2, 32, false, 0, true, true,0,"-32", true, 0xffffffff,0xffffffff, false),
|
||||
};
|
||||
|
||||
|
||||
/* Turn a howto into a reloc number */
|
||||
|
||||
#define SELECT_RELOC(x,howto) { x = howto_table[howto->size +(int)howto->pc_relative*3].type; }
|
||||
|
||||
#define BADMAG(x) M68KBADMAG(x)
|
||||
#define M68 1 /* Customize coffcode.h */
|
||||
|
||||
#define RTYPE2HOWTO(internal, relocentry) \
|
||||
(internal)->howto = ( howto_table + (relocentry).r_type - R_RELBYTE);
|
||||
m68k_rtype2howto(internal, relocentry)
|
||||
arelent *internal;
|
||||
int relocentry;
|
||||
{
|
||||
switch (relocentry)
|
||||
{
|
||||
case R_RELBYTE: (internal)->howto = ( m68kcoff_howto_table + 0);break;
|
||||
case R_RELWORD: (internal)->howto = ( m68kcoff_howto_table + 1);break;
|
||||
case R_RELLONG: (internal)->howto = ( m68kcoff_howto_table + 2);break;
|
||||
case R_PCRBYTE: (internal)->howto = ( m68kcoff_howto_table + 3);break;
|
||||
case R_PCRWORD: (internal)->howto = ( m68kcoff_howto_table + 4);break;
|
||||
case R_PCRLONG: (internal)->howto = ( m68kcoff_howto_table + 5);break;
|
||||
case R_RELLONG_NEG: (internal)->howto = ( m68kcoff_howto_table + 6);break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#define RTYPE2HOWTO(internal, relocentry) m68k_rtype2howto(internal, (relocentry)->r_type)
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
|
||||
#define coff_write_armap bsd_write_armap
|
||||
|
||||
bfd_target m68kcoff_vec =
|
||||
{
|
||||
"coff-m68k", /* name */
|
||||
"coff-m68k", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
true, /* data byte order is big */
|
||||
true, /* header byte order is big */
|
||||
|
@ -65,19 +79,20 @@ bfd_target m68kcoff_vec =
|
|||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading underscore */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
3, /* minimum section alignment */
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
|
||||
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
|
||||
bfd_false},
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
|
||||
bfd_false},
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
|
||||
JUMP_TABLE(coff),
|
||||
COFF_SWAP_TABLE
|
||||
};
|
||||
};
|
||||
|
|
|
@ -18,22 +18,20 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#define M88 1 /* Customize various include files */
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "obstack.h"
|
||||
#include "coff-m88k.h"
|
||||
#include "internalcoff.h"
|
||||
#include "coff/m88k.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
#undef HOWTO_PREPARE
|
||||
/* Provided the symbol, returns the value reffed */
|
||||
#define HOWTO_PREPARE(relocation, symbol) \
|
||||
{ \
|
||||
if (symbol != (asymbol *)NULL) { \
|
||||
if (symbol->flags & BSF_FORT_COMM) { \
|
||||
if (symbol->section == &bfd_com_section) { \
|
||||
relocation = 0; \
|
||||
} \
|
||||
else { \
|
||||
|
@ -49,14 +47,16 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
|
||||
|
||||
static bfd_reloc_status_type
|
||||
DEFUN(howto_hvrt16,(abfd, reloc_entry, symbol_in, data, ignore_input_section),
|
||||
bfd *abfd AND
|
||||
arelent *reloc_entry AND
|
||||
asymbol *symbol_in AND
|
||||
unsigned char *data AND
|
||||
asection *ignore_input_section)
|
||||
DEFUN(howto_hvrt16,(abfd, reloc_entry, symbol_in, data,
|
||||
ignore_input_section, ignore_bfd),
|
||||
bfd *abfd AND
|
||||
arelent *reloc_entry AND
|
||||
asymbol *symbol_in AND
|
||||
PTR data AND
|
||||
asection *ignore_input_section AND
|
||||
bfd *ignore_bfd)
|
||||
{
|
||||
long relocation;
|
||||
long relocation = 0;
|
||||
bfd_vma addr = reloc_entry->address;
|
||||
long x = bfd_get_16(abfd, (bfd_byte *)data + addr);
|
||||
|
||||
|
@ -89,9 +89,9 @@ static reloc_howto_type howto_table[] =
|
|||
/* Code to turn an external r_type into a pointer to an entry in the
|
||||
above howto table */
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) \
|
||||
if (dst.r_type >= R_PCR16L && dst.r_type <= R_VRT32) { \
|
||||
cache_ptr->howto = howto_table + dst.r_type - R_PCR16L; \
|
||||
cache_ptr->addend += dst.r_offset << 16; \
|
||||
if ((dst)->r_type >= R_PCR16L && (dst)->r_type <= R_VRT32) {\
|
||||
cache_ptr->howto = howto_table + (dst)->r_type - R_PCR16L;\
|
||||
cache_ptr->addend += (dst)->r_offset << 16; \
|
||||
} \
|
||||
else { \
|
||||
BFD_ASSERT(0); \
|
||||
|
@ -116,6 +116,7 @@ bfd_target m88kbcs_vec =
|
|||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading underscore */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
3, /* default alignment power */
|
||||
|
|
|
@ -21,8 +21,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "coff-mips.h"
|
||||
#include "internalcoff.h"
|
||||
#include "coff/mips.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h" /* to allow easier abstraction-breaking */
|
||||
#include "trad-core.h"
|
||||
|
||||
|
@ -57,52 +57,57 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#define coff_swap_lineno_out (PROTO(unsigned,(*),(bfd *,PTR,PTR))) bfd_void
|
||||
|
||||
bfd_target ecoff_little_vec =
|
||||
{"ecoff-littlemips", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
false, /* data byte order is little */
|
||||
false, /* header byte order is little */
|
||||
{
|
||||
"ecoff-littlemips", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
false, /* data byte order is little */
|
||||
false, /* header byte order is little */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect flags */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
3, /* minimum alignment power */
|
||||
_do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* data */
|
||||
_do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* hdrs */
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect
|
||||
flags */
|
||||
0, /* leading underscore */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
3, /* minimum alignment power */
|
||||
_do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* data */
|
||||
_do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* hdrs */
|
||||
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, coff_mkobject, bfd_false, /* bfd_set_format */
|
||||
bfd_false},
|
||||
{bfd_false, coff_write_object_contents, bfd_false, bfd_false},
|
||||
JUMP_TABLE (coff)
|
||||
};
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, coff_mkobject, bfd_false, /* bfd_set_format */
|
||||
bfd_false},
|
||||
{bfd_false, coff_write_object_contents, bfd_false, bfd_false},
|
||||
JUMP_TABLE (coff)
|
||||
};
|
||||
|
||||
bfd_target ecoff_big_vec =
|
||||
{"ecoff-bigmips", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
true, /* data byte order is big */
|
||||
true, /* header byte order is big */
|
||||
{
|
||||
"ecoff-bigmips", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
true, /* data byte order is big */
|
||||
true, /* header byte order is big */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect flags */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
3, /* minimum alignment power */
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16,
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16,
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, coff_mkobject, bfd_false, /* bfd_set_format */
|
||||
bfd_false},
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
||||
bfd_false, bfd_false},
|
||||
JUMP_TABLE(coff),
|
||||
COFF_SWAP_TABLE
|
||||
};
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect flags */
|
||||
0, /* leading underscore */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
3, /* minimum alignment power */
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16,
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16,
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, coff_mkobject, bfd_false, /* bfd_set_format */
|
||||
bfd_false},
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
||||
bfd_false, bfd_false},
|
||||
JUMP_TABLE(coff),
|
||||
COFF_SWAP_TABLE
|
||||
};
|
||||
|
|
|
@ -33,8 +33,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "obstack.h"
|
||||
#include "internalcoff.h"
|
||||
#include "coff-rs6000.h"
|
||||
#include "coff/internal.h"
|
||||
#include "coff/rs6000.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
/* The main body of code is in coffcode.h. */
|
||||
|
@ -234,7 +234,8 @@ rs6000coff_archive_p (abfd)
|
|||
/*
|
||||
* bfd_ardata() accesses the bfd->tdata field.
|
||||
*/
|
||||
abfd->tdata = (void *) bfd_zalloc(abfd, sizeof (*art) + sizeof (hdr));
|
||||
abfd->tdata.aout_ar_data =
|
||||
(void *) bfd_zalloc(abfd, sizeof (*art) + sizeof (hdr));
|
||||
if ((art = bfd_ardata (abfd)) == NULL) {
|
||||
bfd_error = no_memory;
|
||||
return 0;
|
||||
|
@ -292,7 +293,11 @@ rs6000coff_write_armap (arch, elength, map, orl_count, stridx)
|
|||
}
|
||||
#endif /* ARCHIVES_PLEASE */
|
||||
|
||||
#ifdef COREFILES_PLEASE
|
||||
|
||||
#ifdef COREFILES_PLEASE
|
||||
extern bfd_target * rs6000coff_core_p ();
|
||||
extern boolean rs6000coff_get_section_contents ();
|
||||
extern boolean rs6000coff_core_file_matches_executable_p ();
|
||||
|
||||
#undef coff_core_file_matches_executable_p
|
||||
#define coff_core_file_matches_executable_p \
|
||||
|
@ -300,232 +305,8 @@ rs6000coff_write_armap (arch, elength, map, orl_count, stridx)
|
|||
|
||||
#undef coff_get_section_contents
|
||||
#define coff_get_section_contents rs6000coff_get_section_contents
|
||||
|
||||
|
||||
/* AOUTHDR is defined by the above. We need another defn of it, from the
|
||||
system include files. Punt the old one and get us a new name for the
|
||||
typedef in the system include files. */
|
||||
#ifdef AOUTHDR
|
||||
#undef AOUTHDR
|
||||
#endif
|
||||
#define AOUTHDR second_AOUTHDR
|
||||
|
||||
#undef SCNHDR
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* Support for core file stuff.. */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#include <sys/user.h>
|
||||
#include <sys/ldr.h>
|
||||
#include <sys/core.h>
|
||||
|
||||
|
||||
/* Number of special purpose registers supported by gdb. This value
|
||||
should match `tm.h' in gdb directory. Clean this mess up and use
|
||||
the macros in sys/reg.h. FIXMEmgo. */
|
||||
|
||||
#define NUM_OF_SPEC_REGS 7
|
||||
#define STACK_END_ADDR 0x2ff80000
|
||||
|
||||
#define core_hdr(bfd) (((Rs6kCorData*)(bfd->tdata))->hdr)
|
||||
#define core_datasec(bfd) (((Rs6kCorData*)(bfd->tdata))->data_section)
|
||||
#define core_stacksec(bfd) (((Rs6kCorData*)(bfd->tdata))->stack_section)
|
||||
#define core_regsec(bfd) (((Rs6kCorData*)(bfd->tdata))->reg_section)
|
||||
#define core_reg2sec(bfd) (((Rs6kCorData*)(bfd->tdata))->reg2_section)
|
||||
|
||||
/* These are stored in the bfd's tdata */
|
||||
typedef struct {
|
||||
struct core *hdr; /* core file header */
|
||||
asection *data_section,
|
||||
*stack_section,
|
||||
*reg_section, /* section for GPRs and special registers. */
|
||||
*reg2_section; /* section for FPRs. */
|
||||
} Rs6kCorData;
|
||||
|
||||
|
||||
/* Decide if a given bfd represents a `core' file or not. There really is no
|
||||
magic number or anything like, in rs6000coff. */
|
||||
|
||||
static bfd_target *
|
||||
rs6000coff_core_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
int fd;
|
||||
struct core_dump coredata;
|
||||
struct stat statbuf;
|
||||
char *tmpptr;
|
||||
|
||||
/* Use bfd_xxx routines, rather than O/S primitives to read coredata. FIXMEmgo */
|
||||
fd = open (abfd->filename, O_RDONLY);
|
||||
|
||||
fstat (fd, &statbuf);
|
||||
read (fd, &coredata, sizeof (struct core_dump));
|
||||
|
||||
close (fd);
|
||||
|
||||
if (coredata.c_tab < (sizeof (coredata.c_u) + (int)&coredata.c_u - (int)&coredata.c_signo) ||
|
||||
coredata.c_tab >= statbuf.st_size ||
|
||||
(long)coredata.c_stack <= (long)coredata.c_tab ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
If it looks like core file, then.....
|
||||
read core file header..... (maybe you've done it above..)
|
||||
*/
|
||||
|
||||
/* maybe you should alloc space for the whole core chunk over here!! FIXMEmgo */
|
||||
tmpptr = (char*)bfd_zalloc (abfd, sizeof (Rs6kCorData));
|
||||
set_tdata (abfd, tmpptr);
|
||||
|
||||
/* .stack section. */
|
||||
if ((core_stacksec (abfd) = (asection*) bfd_zalloc (abfd, sizeof (asection)))
|
||||
== NULL) {
|
||||
bfd_error = no_memory;
|
||||
/* bfd_release (abfd, ???? ) */
|
||||
return NULL;
|
||||
}
|
||||
core_stacksec (abfd)->name = ".stack";
|
||||
core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD;
|
||||
core_stacksec (abfd)->size = coredata.c_size;
|
||||
core_stacksec (abfd)->vma = STACK_END_ADDR - coredata.c_size;
|
||||
core_stacksec (abfd)->filepos = coredata.c_stack; /*???? */
|
||||
|
||||
/* .reg section for GPRs and special registers. */
|
||||
if ((core_regsec (abfd) = (asection*) bfd_zalloc (abfd, sizeof (asection)))
|
||||
== NULL) {
|
||||
bfd_error = no_memory;
|
||||
/* bfd_release (abfd, ???? ) */
|
||||
return NULL;
|
||||
}
|
||||
core_regsec (abfd)->name = ".reg";
|
||||
core_regsec (abfd)->flags = SEC_ALLOC;
|
||||
core_regsec (abfd)->size = (32 + NUM_OF_SPEC_REGS) * 4;
|
||||
core_regsec (abfd)->vma = NULL; /* not used?? */
|
||||
core_regsec (abfd)->filepos =
|
||||
(char*)&coredata.c_u.u_save - (char*)&coredata;
|
||||
|
||||
/* .reg2 section for FPRs (floating point registers). */
|
||||
if ((core_reg2sec (abfd) = (asection*) bfd_zalloc (abfd, sizeof (asection)))
|
||||
== NULL) {
|
||||
bfd_error = no_memory;
|
||||
/* bfd_release (abfd, ???? ) */
|
||||
return NULL;
|
||||
}
|
||||
core_reg2sec (abfd)->name = ".reg2";
|
||||
core_reg2sec (abfd)->flags = SEC_ALLOC;
|
||||
core_reg2sec (abfd)->size = 8 * 32; /* 32 FPRs. */
|
||||
core_reg2sec (abfd)->vma = NULL; /* not used?? */
|
||||
core_reg2sec (abfd)->filepos =
|
||||
(char*)&coredata.c_u.u_save.fpr[0] - (char*)&coredata;
|
||||
|
||||
/* set up section chain here. */
|
||||
abfd->section_count = 3;
|
||||
abfd->sections = core_stacksec (abfd);
|
||||
core_stacksec (abfd)->next = core_regsec(abfd);
|
||||
core_regsec (abfd)->next = core_reg2sec (abfd);
|
||||
core_reg2sec (abfd)->next = NULL;
|
||||
|
||||
return abfd->xvec; /* this is garbage for now. */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* return `true' if given core is from the given executable.. */
|
||||
static boolean
|
||||
rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
bfd *core_bfd;
|
||||
bfd *exec_bfd;
|
||||
{
|
||||
FILE *fd;
|
||||
struct core_dump coredata;
|
||||
struct ld_info ldinfo;
|
||||
char pathname [1024];
|
||||
char *str1, *str2;
|
||||
|
||||
/* Use bfd_xxx routines, rather than O/S primitives, do error checking!!
|
||||
FIXMEmgo */
|
||||
fd = fopen (core_bfd->filename, "r");
|
||||
|
||||
fread (&coredata, sizeof (struct core_dump), 1, fd);
|
||||
fseek (fd, (long)coredata.c_tab, 0);
|
||||
fread (&ldinfo, (char*)&ldinfo.ldinfo_filename[0] - (char*)&ldinfo.ldinfo_next,
|
||||
1, fd);
|
||||
fscanf (fd, "%s", pathname);
|
||||
printf ("path: %s\n", pathname);
|
||||
|
||||
str1 = strrchr (pathname, '/');
|
||||
str2 = strrchr (exec_bfd->filename, '/');
|
||||
|
||||
/* step over character '/' */
|
||||
str1 = str1 ? str1+1 : &pathname[0];
|
||||
str2 = str2 ? str2+1 : exec_bfd->filename;
|
||||
|
||||
fclose (fd);
|
||||
return strcmp (str1, str2);
|
||||
}
|
||||
|
||||
|
||||
static boolean
|
||||
rs6000coff_get_section_contents (abfd, section, location, offset, count)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
PTR location;
|
||||
file_ptr offset;
|
||||
int count;
|
||||
{
|
||||
if (count == 0)
|
||||
return true;
|
||||
|
||||
/* Reading a core file's sections will be slightly different. For the
|
||||
rest of them we can use bfd_generic_get_section_contents () I suppose. */
|
||||
/* Make sure this routine works for any bfd and any section. FIXMEmgo. */
|
||||
|
||||
if (abfd->format == bfd_core && strcmp (section->name, ".reg") == 0) {
|
||||
|
||||
struct mstsave mstatus;
|
||||
int regoffset = (char*)&mstatus.gpr[0] - (char*)&mstatus;
|
||||
|
||||
/* Assert that the only way this code will be executed is reading the
|
||||
whole section. */
|
||||
if (offset || count != (sizeof(mstatus.gpr) + (4 * NUM_OF_SPEC_REGS)))
|
||||
printf ("ERROR! in rs6000coff_get_section_contents()\n");
|
||||
|
||||
/* for `.reg' section, `filepos' is a pointer to the `mstsave' structure
|
||||
in the core file. */
|
||||
|
||||
/* read GPR's into the location. */
|
||||
if ( bfd_seek(abfd, section->filepos + regoffset, SEEK_SET) == -1
|
||||
|| bfd_read(location, sizeof (mstatus.gpr), 1, abfd) != sizeof (mstatus.gpr))
|
||||
return (false); /* on error */
|
||||
|
||||
/* increment location to the beginning of special registers in the section,
|
||||
reset register offset value to the beginning of first special register
|
||||
in mstsave structure, and read special registers. */
|
||||
|
||||
location = (PTR) ((char*)location + sizeof (mstatus.gpr));
|
||||
regoffset = (char*)&mstatus.iar - (char*)&mstatus;
|
||||
|
||||
if ( bfd_seek(abfd, section->filepos + regoffset, SEEK_SET) == -1
|
||||
|| bfd_read(location, 4 * NUM_OF_SPEC_REGS, 1, abfd) !=
|
||||
4 * NUM_OF_SPEC_REGS)
|
||||
return (false); /* on error */
|
||||
|
||||
/* increment location address, and read the special registers.. */
|
||||
/* FIXMEmgo */
|
||||
return (true);
|
||||
}
|
||||
|
||||
/* else, use default bfd section content transfer. */
|
||||
else
|
||||
return bfd_generic_get_section_contents
|
||||
(abfd, section, location, offset, count);
|
||||
}
|
||||
|
||||
#endif /* COREFILES_PLEASE */
|
||||
|
||||
/* The transfer vector that leads the outside world to all of the above. */
|
||||
|
||||
bfd_target rs6000coff_vec =
|
||||
|
@ -540,6 +321,7 @@ bfd_target rs6000coff_vec =
|
|||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading char */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen??? FIXMEmgo */
|
||||
3, /* default alignment power */
|
||||
|
@ -548,7 +330,13 @@ bfd_target rs6000coff_vec =
|
|||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
|
||||
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
coff_archive_p, _bfd_dummy_target},
|
||||
coff_archive_p,
|
||||
#ifdef COREFILES_PLEASE
|
||||
rs6000coff_core_p
|
||||
#else
|
||||
_bfd_dummy_target
|
||||
#endif
|
||||
},
|
||||
{bfd_false, coff_mkobject, coff_mkarchive, /* bfd_set_format */
|
||||
bfd_false},
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
||||
|
|
|
@ -28,9 +28,32 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
#include "seclet.h"
|
||||
|
||||
extern bfd_error_vector_type bfd_error_vector;
|
||||
func_da() {}
|
||||
func_jr() {}
|
||||
|
||||
/* Dummy for now */
|
||||
static bfd_reloc_status_type
|
||||
DEFUN(func_da, (abfd, reloc_entry, symbol, data, input_section, output_bfd),
|
||||
bfd *abfd AND
|
||||
arelent *reloc_entry AND
|
||||
struct symbol_cache_entry *symbol AND
|
||||
PTR data AND
|
||||
asection *input_section AND
|
||||
bfd *output_bfd)
|
||||
{
|
||||
}
|
||||
|
||||
/* Dummy for now */
|
||||
static bfd_reloc_status_type
|
||||
DEFUN(func_jr, (abfd, reloc_entry, symbol, data, input_section, output_bfd),
|
||||
bfd *abfd AND
|
||||
arelent *reloc_entry AND
|
||||
struct symbol_cache_entry *symbol AND
|
||||
PTR data AND
|
||||
asection *input_section AND
|
||||
bfd *output_bfd)
|
||||
{
|
||||
}
|
||||
|
||||
static reloc_howto_type r_da =
|
||||
HOWTO(R_DA , 0, 1, 16, false, 0, true,
|
||||
|
@ -183,7 +206,7 @@ unsigned int *dst_ptr;
|
|||
|
||||
bfd_target z8kcoff_vec =
|
||||
{
|
||||
"coff-z8k", /* name */
|
||||
"coff-z8k", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
true, /* data byte order is big */
|
||||
true, /* header byte order is big */
|
||||
|
@ -193,19 +216,20 @@ bfd_target z8kcoff_vec =
|
|||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
|
||||
|
||||
( SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
'_', /* leading symbol underscore */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
1, /* minimum section alignment */
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
|
||||
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
|
||||
bfd_false},
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
|
||||
bfd_false},
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
|
||||
JUMP_TABLE(coff),
|
||||
COFF_SWAP_TABLE
|
||||
};
|
||||
JUMP_TABLE(coff),
|
||||
COFF_SWAP_TABLE
|
||||
};
|
||||
|
|
11
bfd/elf.c
11
bfd/elf.c
|
@ -781,7 +781,7 @@ DEFUN(bfd_prpsinfo,(abfd, descdata, descsz, filepos),
|
|||
{
|
||||
if ((core_prpsinfo (abfd) = bfd_alloc (abfd, descsz)) != NULL)
|
||||
{
|
||||
bcopy (descdata, core_prpsinfo (abfd), descsz);
|
||||
memcpy (core_prpsinfo (abfd), descdata, descsz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2484,6 +2484,11 @@ bfd_target elf_big_vec =
|
|||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
|
||||
SEC_CODE | SEC_DATA),
|
||||
|
||||
|
||||
/* leading_symbol_char: is the first char of a user symbol
|
||||
predictable, and if so what is it */
|
||||
0,
|
||||
|
||||
/* ar_pad_char: pad character for filenames within an archive header
|
||||
FIXME: this really has nothing to do with ELF, this is a characteristic
|
||||
of the archiver and/or os and should be independently tunable */
|
||||
|
@ -2556,6 +2561,10 @@ bfd_target elf_little_vec =
|
|||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
|
||||
SEC_DATA),
|
||||
|
||||
/* leading_symbol_char: is the first char of a user symbol
|
||||
predictable, and if so what is it */
|
||||
0,
|
||||
|
||||
/* ar_pad_char: pad character for filenames within an archive header
|
||||
FIXME: this really has nothing to do with ELF, this is a characteristic
|
||||
of the archiver and/or os and should be independently tunable */
|
||||
|
|
68
bfd/ieee.c
68
bfd/ieee.c
|
@ -767,52 +767,50 @@ DEFUN(ieee_get_symtab,(abfd, location),
|
|||
ieee_symbol_type *symp;
|
||||
static bfd dummy_bfd;
|
||||
static asymbol empty_symbol =
|
||||
{ &dummy_bfd," ieee empty",(symvalue)0,BSF_DEBUGGING , &bfd_abs_section};
|
||||
{ &dummy_bfd," ieee empty",(symvalue)0,BSF_DEBUGGING , &bfd_abs_section};
|
||||
|
||||
if (abfd->symcount) {
|
||||
if (abfd->symcount)
|
||||
{
|
||||
ieee_data_type *ieee = IEEE_DATA(abfd);
|
||||
dummy_bfd.xvec= &ieee_vec;
|
||||
ieee_slurp_symbol_table(abfd);
|
||||
|
||||
|
||||
|
||||
|
||||
ieee_data_type *ieee = IEEE_DATA(abfd);
|
||||
dummy_bfd.xvec= &ieee_vec;
|
||||
ieee_slurp_symbol_table(abfd);
|
||||
|
||||
if (ieee->symbol_table_full == false) {
|
||||
/* Arrgh - there are gaps in the table, run through and fill them */
|
||||
/* up with pointers to a null place */
|
||||
unsigned int i;
|
||||
for (i= 0; i < abfd->symcount; i++) {
|
||||
location[i] = &empty_symbol;
|
||||
if (ieee->symbol_table_full == false) {
|
||||
/* Arrgh - there are gaps in the table, run through and fill them */
|
||||
/* up with pointers to a null place */
|
||||
unsigned int i;
|
||||
for (i= 0; i < abfd->symcount; i++) {
|
||||
location[i] = &empty_symbol;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ieee->external_symbol_base_offset= - ieee->external_symbol_min_index;
|
||||
for (symp = IEEE_DATA(abfd)->external_symbols;
|
||||
symp != (ieee_symbol_type *)NULL;
|
||||
symp = symp->next) {
|
||||
/* Place into table at correct index locations */
|
||||
location[symp->index + ieee->external_symbol_base_offset] = &symp->symbol;
|
||||
ieee->external_symbol_base_offset= - ieee->external_symbol_min_index;
|
||||
for (symp = IEEE_DATA(abfd)->external_symbols;
|
||||
symp != (ieee_symbol_type *)NULL;
|
||||
symp = symp->next) {
|
||||
/* Place into table at correct index locations */
|
||||
location[symp->index + ieee->external_symbol_base_offset] = &symp->symbol;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* The external refs are indexed in a bit */
|
||||
ieee->external_reference_base_offset =
|
||||
- ieee->external_reference_min_index +ieee->external_symbol_count ;
|
||||
/* The external refs are indexed in a bit */
|
||||
ieee->external_reference_base_offset =
|
||||
- ieee->external_reference_min_index +ieee->external_symbol_count ;
|
||||
|
||||
for (symp = IEEE_DATA(abfd)->external_reference;
|
||||
symp != (ieee_symbol_type *)NULL;
|
||||
symp = symp->next) {
|
||||
location[symp->index + ieee->external_reference_base_offset] =
|
||||
&symp->symbol;
|
||||
for (symp = IEEE_DATA(abfd)->external_reference;
|
||||
symp != (ieee_symbol_type *)NULL;
|
||||
symp = symp->next) {
|
||||
location[symp->index + ieee->external_reference_base_offset] =
|
||||
&symp->symbol;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
location[abfd->symcount] = (asymbol *)NULL;
|
||||
}
|
||||
return abfd->symcount;
|
||||
}
|
||||
static asection *
|
||||
|
@ -1064,7 +1062,7 @@ uint8e_type buffer[512];
|
|||
else loop = false;
|
||||
}
|
||||
|
||||
ieee->elements = obstack_finish(&ob);
|
||||
ieee->elements = (ieee_ar_obstack_type *)obstack_finish(&ob);
|
||||
|
||||
/* Now scan the area again, and replace BB offsets with file */
|
||||
/* offsets */
|
||||
|
@ -1180,7 +1178,6 @@ DEFUN(ieee_object_p,(abfd),
|
|||
|
||||
}
|
||||
abfd->flags = HAS_SYMS;
|
||||
|
||||
/* By now we know that this is a real IEEE file, we're going to read
|
||||
the whole thing into memory so that we can run up and down it
|
||||
quickly. We can work out how big the file is from the trailer
|
||||
|
@ -2972,6 +2969,7 @@ bfd_target ieee_vec =
|
|||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
||||
( SEC_CODE|SEC_DATA|SEC_ROM|SEC_HAS_CONTENTS
|
||||
|SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading underscore */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
1, /* minimum alignment */
|
||||
|
|
62
bfd/oasys.c
62
bfd/oasys.c
|
@ -18,8 +18,6 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#define UNDERSCORE_HACK 1
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
|
@ -871,6 +869,10 @@ DEFUN(oasys_write_syms, (abfd),
|
|||
}
|
||||
bfd_h_put_16(abfd, 0, (uint8e_type *)(&symbol.refno[0]));
|
||||
}
|
||||
#ifdef UNDERSCORE_HACK
|
||||
if (src[l] == '_')
|
||||
dst[l++] = '.';
|
||||
#endif
|
||||
while (src[l]) {
|
||||
dst[l] = src[l];
|
||||
l++;
|
||||
|
@ -994,7 +996,7 @@ DEFUN(oasys_write_data, (abfd),
|
|||
unsigned int relocs_to_go = s->reloc_count;
|
||||
arelent **p = s->orelocation;
|
||||
if (s->reloc_count != 0) {
|
||||
/* Sort the reloc records so it's easy to insert the relocs into the
|
||||
/* Sort the reloc records so it's easy to insert the relocs into the
|
||||
data */
|
||||
|
||||
qsort(s->orelocation,
|
||||
|
@ -1013,21 +1015,23 @@ DEFUN(oasys_write_data, (abfd),
|
|||
uint8e_type *dst = &processed_data.data[1];
|
||||
|
||||
unsigned int i;
|
||||
unsigned int long_length = 128;
|
||||
*mod = 0;
|
||||
|
||||
|
||||
bfd_h_put_32(abfd, s->vma + current_byte_index, processed_data.addr);
|
||||
if ((size_t)(long_length + current_byte_index) > (size_t)(s->_cooked_size)) {
|
||||
long_length = s->_cooked_size - current_byte_index;
|
||||
}
|
||||
while (long_length > 0 && (dst - (uint8e_type*)&processed_data < 128)) {
|
||||
|
||||
unsigned int length = long_length;
|
||||
*mod =0;
|
||||
if (length > 8)
|
||||
length = 8;
|
||||
bfd_h_put_32(abfd, s->vma + current_byte_index,
|
||||
processed_data.addr);
|
||||
|
||||
/* Don't start a relocation unless you're sure you can finish it
|
||||
within the same data record. The worst case relocation is a
|
||||
4-byte relocatable value which is split across two modification
|
||||
bytes (1 relocation byte + 2 symbol reference bytes + 2 data +
|
||||
1 modification byte + 2 data = 8 bytes total). That's where
|
||||
the magic number 8 comes from.
|
||||
*/
|
||||
while (current_byte_index < s->_raw_size && dst <=
|
||||
(uint8e_type*)&processed_data.data[sizeof(processed_data.data)-8]) {
|
||||
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
if (relocs_to_go != 0) {
|
||||
arelent *r = *p;
|
||||
reloc_howto_type *CONST how=r->howto;
|
||||
|
@ -1104,6 +1108,21 @@ DEFUN(oasys_write_data, (abfd),
|
|||
}
|
||||
|
||||
}
|
||||
#define ADVANCE { if (++i >= 8) { i = 0; mod = dst++; *mod = 0; } current_byte_index++; }
|
||||
/* relocations never occur from an unloadable section,
|
||||
so we can assume that raw_data is not NULL
|
||||
*/
|
||||
*dst++ = *raw_data++;
|
||||
ADVANCE
|
||||
*dst++ = *raw_data++;
|
||||
ADVANCE
|
||||
if (how->size == 2) {
|
||||
*dst++ = *raw_data++;
|
||||
ADVANCE
|
||||
*dst++ = *raw_data++;
|
||||
ADVANCE
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/* If this is coming from an unloadable section then copy
|
||||
|
@ -1114,10 +1133,12 @@ DEFUN(oasys_write_data, (abfd),
|
|||
else {
|
||||
*dst++ = *raw_data++;
|
||||
}
|
||||
current_byte_index++;
|
||||
}
|
||||
mod = dst++;
|
||||
long_length -= length;
|
||||
ADVANCE
|
||||
}
|
||||
|
||||
/* Don't write a useless null modification byte */
|
||||
if (dst == mod+1) {
|
||||
--dst;
|
||||
}
|
||||
|
||||
oasys_write_record(abfd,
|
||||
|
@ -1288,7 +1309,7 @@ return 0;
|
|||
#define oasys_bfd_debug_info_end bfd_void
|
||||
#define oasys_bfd_debug_info_accumulate (FOO(void, (*), (bfd *, asection *)))bfd_void
|
||||
#define oasys_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
|
||||
|
||||
#define oasys_bfd_relax_section bfd_generic_relax_section
|
||||
/*SUPPRESS 460 */
|
||||
bfd_target oasys_vec =
|
||||
{
|
||||
|
@ -1301,6 +1322,7 @@ bfd_target oasys_vec =
|
|||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
||||
(SEC_CODE|SEC_DATA|SEC_ROM|SEC_HAS_CONTENTS
|
||||
|SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading underscore */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
1, /* minimum alignment */
|
||||
|
|
23
bfd/srec.c
23
bfd/srec.c
|
@ -43,7 +43,7 @@ DESCRIPTION
|
|||
An s record looks like:
|
||||
|
||||
EXAMPLE
|
||||
S<length><type><address><data><checksum>
|
||||
S<type><length><address><data><checksum>
|
||||
|
||||
DESCRIPTION
|
||||
Where
|
||||
|
@ -346,9 +346,12 @@ DEFUN(srec_set_section_contents,(abfd, section, location, offset, bytes_to_do),
|
|||
file_ptr offset AND
|
||||
bfd_size_type bytes_to_do)
|
||||
{
|
||||
tdata_type *tdata = abfd->tdata.srec_data;
|
||||
srec_data_list_type *entry = (srec_data_list_type *)
|
||||
bfd_alloc(abfd, sizeof(srec_data_list_type));
|
||||
tdata_type *tdata = abfd->tdata.srec_data;
|
||||
srec_data_list_type *entry = (srec_data_list_type *)
|
||||
bfd_alloc(abfd, sizeof(srec_data_list_type));
|
||||
if ((section->flags & SEC_ALLOC)
|
||||
&& (section->flags & SEC_LOAD))
|
||||
{
|
||||
unsigned char *data = (unsigned char *) bfd_alloc(abfd, bytes_to_do);
|
||||
memcpy(data, location, bytes_to_do);
|
||||
|
||||
|
@ -359,11 +362,11 @@ DEFUN(srec_set_section_contents,(abfd, section, location, offset, bytes_to_do),
|
|||
else if ((section->vma + offset + bytes_to_do) <= 0xffffff
|
||||
&& tdata->type < 2)
|
||||
{
|
||||
tdata->type = 2;
|
||||
tdata->type = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
tdata->type = 3;
|
||||
tdata->type = 3;
|
||||
}
|
||||
|
||||
entry->data = data;
|
||||
|
@ -371,7 +374,8 @@ DEFUN(srec_set_section_contents,(abfd, section, location, offset, bytes_to_do),
|
|||
entry->size = bytes_to_do;
|
||||
entry->next = tdata->head;
|
||||
tdata->head = entry;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Write a record of type, of the supplied number of bytes. The
|
||||
|
@ -468,8 +472,6 @@ DEFUN(srec_write_section,(abfd, tdata, list),
|
|||
|
||||
while (bytes_written < list->size)
|
||||
{
|
||||
char buffer[MAXCHUNK];
|
||||
char *dst = buffer;
|
||||
bfd_vma address;
|
||||
|
||||
unsigned int bytes_this_chunk = list->size - bytes_written;
|
||||
|
@ -587,7 +589,7 @@ DEFUN(srec_make_empty_symbol, (abfd),
|
|||
#define srec_bfd_debug_info_end bfd_void
|
||||
#define srec_bfd_debug_info_accumulate (FOO(void, (*), (bfd *, asection *))) bfd_void
|
||||
#define srec_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
|
||||
|
||||
#define srec_bfd_relax_section bfd_generic_relax_section
|
||||
bfd_target srec_vec =
|
||||
{
|
||||
"srec", /* name */
|
||||
|
@ -599,6 +601,7 @@ bfd_target srec_vec =
|
|||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
||||
(SEC_CODE|SEC_DATA|SEC_ROM|SEC_HAS_CONTENTS
|
||||
|SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading underscore */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
1, /* minimum alignment */
|
||||
|
|
Loading…
Add table
Reference in a new issue