mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-11 13:02:10 +08:00
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition. Indent some of them to GNU standards. * aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c, cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c, elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h, libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c: Update copyright years.
This commit is contained in:
parent
baef2065d0
commit
57a1867e6c
@ -1,3 +1,15 @@
|
||||
Tue Mar 15 04:41:13 1994 David J. Mackenzie (djm@rtl.cygnus.com)
|
||||
|
||||
* Most files:
|
||||
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
|
||||
Indent some of them to GNU standards.
|
||||
|
||||
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
|
||||
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
|
||||
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
|
||||
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
|
||||
Update copyright years.
|
||||
|
||||
Mon Mar 14 11:41:23 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
|
||||
|
||||
* som.c (som_prep_for_fixups): A relocation involving the section
|
||||
|
@ -76,8 +76,8 @@ struct trad_core_struct {
|
||||
};
|
||||
|
||||
static bfd_target *
|
||||
DEFUN(aix386_core_file_p,(abfd),
|
||||
bfd *abfd)
|
||||
aix386_core_file_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
int i,n;
|
||||
unsigned char longbuf[4]; /* Raw bytes of various header fields */
|
||||
@ -88,7 +88,7 @@ DEFUN(aix386_core_file_p,(abfd),
|
||||
struct corehdr internal_core;
|
||||
} *mergem;
|
||||
|
||||
bfd_error = system_call_error;
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
|
||||
if (bfd_read ((PTR)longbuf, 1, sizeof (longbuf), abfd) != sizeof (longbuf))
|
||||
return 0;
|
||||
@ -100,7 +100,7 @@ DEFUN(aix386_core_file_p,(abfd),
|
||||
mergem = (struct mergem *)bfd_zalloc (abfd, sizeof (struct mergem));
|
||||
if (mergem == NULL)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ DEFUN(aix386_core_file_p,(abfd),
|
||||
|
||||
if ((bfd_read ((PTR) core, 1, core_size, abfd)) != core_size)
|
||||
{
|
||||
bfd_error = system_call_error;
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
bfd_release (abfd, (char *)mergem);
|
||||
return 0;
|
||||
}
|
||||
@ -122,7 +122,7 @@ DEFUN(aix386_core_file_p,(abfd),
|
||||
if (core_regsec (abfd) == NULL)
|
||||
{
|
||||
loser:
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
bfd_release (abfd, (char *)mergem);
|
||||
return 0;
|
||||
}
|
||||
@ -219,23 +219,23 @@ DEFUN(aix386_core_file_p,(abfd),
|
||||
}
|
||||
|
||||
static char *
|
||||
DEFUN(aix386_core_file_failing_command,(abfd),
|
||||
bfd *abfd)
|
||||
aix386_core_file_failing_command (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return core_hdr (abfd)->cd_comm;
|
||||
}
|
||||
|
||||
static int
|
||||
DEFUN(aix386_core_file_failing_signal,(abfd),
|
||||
bfd *abfd)
|
||||
aix386_core_file_failing_signal (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return core_hdr (abfd)->cd_cursig;
|
||||
}
|
||||
|
||||
static boolean
|
||||
DEFUN(aix386_core_file_matches_executable_p, (core_bfd, exec_bfd),
|
||||
bfd *core_bfd AND
|
||||
bfd *exec_bfd)
|
||||
aix386_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
bfd *core_bfd;
|
||||
bfd *exec_bfd;
|
||||
{
|
||||
return true; /* FIXME, We have no way of telling at this
|
||||
point */
|
||||
@ -254,7 +254,7 @@ DEFUN(aix386_core_file_matches_executable_p, (core_bfd, exec_bfd),
|
||||
#define aix386_close_and_cleanup bfd_generic_close_and_cleanup
|
||||
#define aix386_set_section_contents (PROTO(boolean, (*), \
|
||||
(bfd *abfd, asection *section, PTR data, file_ptr offset, \
|
||||
bfd_size_type count))) bfd_false
|
||||
bfd_size_type count))) bfd_generic_set_section_contents
|
||||
#define aix386_get_section_contents bfd_generic_get_section_contents
|
||||
#define aix386_new_section_hook (PROTO (boolean, (*), \
|
||||
(bfd *, sec_ptr))) bfd_true
|
||||
@ -307,9 +307,9 @@ swap_abort()
|
||||
{
|
||||
abort(); /* This way doesn't require any declaration for ANSI to fuck up */
|
||||
}
|
||||
#define NO_GET ((PROTO(bfd_vma, (*), ( bfd_byte *))) swap_abort )
|
||||
#define NO_GETS ((PROTO(bfd_signed_vma, (*), ( bfd_byte *))) swap_abort )
|
||||
#define NO_PUT ((PROTO(void, (*), (bfd_vma, bfd_byte *))) swap_abort )
|
||||
#define NO_GET ((PROTO(bfd_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 )
|
||||
|
||||
bfd_target aix386_core_vec =
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD back-end for a.out files encapsulated with COFF headers.
|
||||
Copyright (C) 1990-1991 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1991 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
@ -38,8 +38,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
bfd_target *encap_real_callback ();
|
||||
|
||||
bfd_target *
|
||||
DEFUN(encap_object_p,(abfd),
|
||||
bfd *abfd)
|
||||
encap_object_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
unsigned char magicbuf[4]; /* Raw bytes of magic number from file */
|
||||
unsigned long magic; /* Swapped magic number */
|
||||
@ -77,8 +77,8 @@ DEFUN(encap_object_p,(abfd),
|
||||
|
||||
/* Finish up the reading of a encapsulated-coff a.out file header */
|
||||
bfd_target *
|
||||
DEFUN(encap_real_callback,(abfd),
|
||||
bfd *abfd)
|
||||
encap_real_callback (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
@ -118,8 +118,8 @@ DEFUN(encap_real_callback,(abfd),
|
||||
file header, symbols, and relocation. */
|
||||
|
||||
boolean
|
||||
DEFUN(encap_write_object_contents,(abfd),
|
||||
bfd *abfd)
|
||||
encap_write_object_contents (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
bfd_size_type data_pad = 0;
|
||||
struct external_exec exec_bytes;
|
||||
|
@ -28,8 +28,8 @@ extern CONST struct reloc_howto_struct * NAME(aout,reloc_type_lookup) ();
|
||||
This routine is called from some_aout_object_p just before it returns. */
|
||||
#ifndef MY_callback
|
||||
static bfd_target *
|
||||
DEFUN(MY(callback),(abfd),
|
||||
bfd *abfd)
|
||||
MY(callback) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
@ -80,8 +80,8 @@ DEFUN(MY(callback),(abfd),
|
||||
/* Finish up the reading of an a.out file header */
|
||||
|
||||
static bfd_target *
|
||||
DEFUN(MY(object_p),(abfd),
|
||||
bfd *abfd)
|
||||
MY(object_p) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct external_exec exec_bytes; /* Raw exec header from file */
|
||||
struct internal_exec exec; /* Cleaned-up exec header */
|
||||
@ -89,7 +89,7 @@ DEFUN(MY(object_p),(abfd),
|
||||
|
||||
if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
|
||||
!= EXEC_BYTES_SIZE) {
|
||||
bfd_error = wrong_format;
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -134,8 +134,8 @@ DEFUN(MY(object_p),(abfd),
|
||||
|
||||
#ifndef MY_mkobject
|
||||
static boolean
|
||||
DEFUN(MY(mkobject),(abfd),
|
||||
bfd *abfd)
|
||||
MY(mkobject) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (NAME(aout,mkobject)(abfd) == false)
|
||||
return false;
|
||||
@ -160,8 +160,8 @@ DEFUN(MY(mkobject),(abfd),
|
||||
|
||||
#ifndef MY_write_object_contents
|
||||
static boolean
|
||||
DEFUN(MY(write_object_contents),(abfd),
|
||||
bfd *abfd)
|
||||
MY(write_object_contents) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct external_exec exec_bytes;
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
@ -181,7 +181,8 @@ DEFUN(MY(write_object_contents),(abfd),
|
||||
|
||||
#ifndef MY_set_sizes
|
||||
static boolean
|
||||
DEFUN(MY(set_sizes),(abfd), bfd *abfd)
|
||||
MY(set_sizes) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
adata(abfd).page_size = PAGE_SIZE;
|
||||
#ifdef SEGMENT_SIZE
|
||||
@ -196,12 +197,22 @@ DEFUN(MY(set_sizes),(abfd), bfd *abfd)
|
||||
#endif
|
||||
|
||||
#ifndef MY_backend_data
|
||||
|
||||
#ifndef MY_read_dynamic_symbols
|
||||
#define MY_read_dynamic_symbols 0
|
||||
#endif
|
||||
#ifndef MY_read_dynamic_relocs
|
||||
#define MY_read_dynamic_relocs 0
|
||||
#endif
|
||||
|
||||
static CONST struct aout_backend_data MY(backend_data) = {
|
||||
0, /* zmagic contiguous */
|
||||
0, /* text incl header */
|
||||
0, /* text vma? */
|
||||
MY_set_sizes,
|
||||
0, /* exec header is counted */
|
||||
MY_read_dynamic_symbols,
|
||||
MY_read_dynamic_relocs
|
||||
};
|
||||
#define MY_backend_data &MY(backend_data)
|
||||
#endif
|
||||
@ -400,7 +411,7 @@ bfd_target MY(vec) =
|
||||
#endif
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
|
||||
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, /* ar_pad_char */
|
||||
|
537
bfd/aoutf1.h
537
bfd/aoutf1.h
@ -23,7 +23,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#include "libbfd.h"
|
||||
|
||||
#include "aout/sun4.h"
|
||||
#include "libaout.h" /* BFD a.out internal data structures */
|
||||
#include "libaout.h" /* BFD a.out internal data structures */
|
||||
|
||||
#include "aout/aout64.h"
|
||||
#include "aout/stab_gnu.h"
|
||||
@ -49,7 +49,7 @@ int in the target format. It changes the sizes of the structs which
|
||||
perform the memory/disk mapping of structures.
|
||||
|
||||
The 64 bit backend may only be used if the host compiler supports 64
|
||||
ints (eg long long with gcc), by defining the name @code{HOST_64_BIT} in @code{bfd.h}.
|
||||
ints (eg long long with gcc), by defining the name @code{BFD_HOST_64_BIT} in @code{bfd.h}.
|
||||
With this name defined, @emph{all} bfd operations are performed with 64bit
|
||||
arithmetic, not just those to a 64bit target.
|
||||
|
||||
@ -64,60 +64,62 @@ The name put into the target vector.
|
||||
/*SUPPRESS529*/
|
||||
|
||||
void
|
||||
DEFUN(NAME(sunos,set_arch_mach), (abfd, machtype),
|
||||
bfd *abfd AND int machtype)
|
||||
NAME (sunos, set_arch_mach) (abfd, machtype)
|
||||
bfd *abfd;
|
||||
int machtype;
|
||||
{
|
||||
/* Determine the architecture and machine type of the object file. */
|
||||
enum bfd_architecture arch;
|
||||
long machine;
|
||||
switch (machtype) {
|
||||
switch (machtype)
|
||||
{
|
||||
|
||||
case M_UNKNOWN:
|
||||
case M_UNKNOWN:
|
||||
/* Some Sun3s make magic numbers without cpu types in them, so
|
||||
we'll default to the 68000. */
|
||||
arch = bfd_arch_m68k;
|
||||
machine = 68000;
|
||||
break;
|
||||
|
||||
case M_68010:
|
||||
case M_HP200:
|
||||
arch = bfd_arch_m68k;
|
||||
machine = 68010;
|
||||
break;
|
||||
|
||||
case M_68020:
|
||||
case M_HP300:
|
||||
arch = bfd_arch_m68k;
|
||||
machine = 68020;
|
||||
break;
|
||||
|
||||
case M_SPARC:
|
||||
arch = bfd_arch_sparc;
|
||||
machine = 0;
|
||||
break;
|
||||
|
||||
case M_386:
|
||||
case M_386_DYNIX:
|
||||
arch = bfd_arch_i386;
|
||||
machine = 0;
|
||||
break;
|
||||
|
||||
case M_29K:
|
||||
arch = bfd_arch_a29k;
|
||||
machine = 0;
|
||||
break;
|
||||
|
||||
case M_HPUX:
|
||||
arch = bfd_arch_m68k;
|
||||
machine = 0;
|
||||
break;
|
||||
arch = bfd_arch_m68k;
|
||||
machine = 68000;
|
||||
break;
|
||||
|
||||
default:
|
||||
arch = bfd_arch_obscure;
|
||||
machine = 0;
|
||||
break;
|
||||
}
|
||||
bfd_set_arch_mach(abfd, arch, machine);
|
||||
case M_68010:
|
||||
case M_HP200:
|
||||
arch = bfd_arch_m68k;
|
||||
machine = 68010;
|
||||
break;
|
||||
|
||||
case M_68020:
|
||||
case M_HP300:
|
||||
arch = bfd_arch_m68k;
|
||||
machine = 68020;
|
||||
break;
|
||||
|
||||
case M_SPARC:
|
||||
arch = bfd_arch_sparc;
|
||||
machine = 0;
|
||||
break;
|
||||
|
||||
case M_386:
|
||||
case M_386_DYNIX:
|
||||
arch = bfd_arch_i386;
|
||||
machine = 0;
|
||||
break;
|
||||
|
||||
case M_29K:
|
||||
arch = bfd_arch_a29k;
|
||||
machine = 0;
|
||||
break;
|
||||
|
||||
case M_HPUX:
|
||||
arch = bfd_arch_m68k;
|
||||
machine = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
arch = bfd_arch_obscure;
|
||||
machine = 0;
|
||||
break;
|
||||
}
|
||||
bfd_set_arch_mach (abfd, arch, machine);
|
||||
}
|
||||
|
||||
#define SET_ARCH_MACH(ABFD, EXEC) \
|
||||
@ -126,18 +128,19 @@ DEFUN(NAME(sunos,set_arch_mach), (abfd, machtype),
|
||||
|
||||
/* Determine the size of a relocation entry, based on the architecture */
|
||||
static void
|
||||
DEFUN(choose_reloc_size,(abfd),
|
||||
bfd *abfd)
|
||||
choose_reloc_size (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
switch (bfd_get_arch(abfd)) {
|
||||
case bfd_arch_sparc:
|
||||
case bfd_arch_a29k:
|
||||
obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
|
||||
break;
|
||||
default:
|
||||
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
|
||||
break;
|
||||
}
|
||||
switch (bfd_get_arch (abfd))
|
||||
{
|
||||
case bfd_arch_sparc:
|
||||
case bfd_arch_a29k:
|
||||
obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
|
||||
break;
|
||||
default:
|
||||
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Write an object file in SunOS format.
|
||||
@ -145,40 +148,41 @@ bfd *abfd)
|
||||
file header, symbols, and relocation. */
|
||||
|
||||
static boolean
|
||||
DEFUN(NAME(aout,sunos4_write_object_contents),
|
||||
(abfd),
|
||||
bfd *abfd)
|
||||
NAME (aout, sunos4_write_object_contents) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct external_exec exec_bytes;
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
|
||||
/* Magic number, maestro, please! */
|
||||
switch (bfd_get_arch(abfd)) {
|
||||
case bfd_arch_m68k:
|
||||
switch (bfd_get_mach(abfd)) {
|
||||
case 68010:
|
||||
N_SET_MACHTYPE(*execp, M_68010);
|
||||
switch (bfd_get_arch (abfd))
|
||||
{
|
||||
case bfd_arch_m68k:
|
||||
switch (bfd_get_mach (abfd))
|
||||
{
|
||||
case 68010:
|
||||
N_SET_MACHTYPE (*execp, M_68010);
|
||||
break;
|
||||
default:
|
||||
case 68020:
|
||||
N_SET_MACHTYPE (*execp, M_68020);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case bfd_arch_sparc:
|
||||
N_SET_MACHTYPE (*execp, M_SPARC);
|
||||
break;
|
||||
case bfd_arch_i386:
|
||||
N_SET_MACHTYPE (*execp, M_386);
|
||||
break;
|
||||
case bfd_arch_a29k:
|
||||
N_SET_MACHTYPE (*execp, M_29K);
|
||||
break;
|
||||
default:
|
||||
case 68020:
|
||||
N_SET_MACHTYPE(*execp, M_68020);
|
||||
break;
|
||||
N_SET_MACHTYPE (*execp, M_UNKNOWN);
|
||||
}
|
||||
break;
|
||||
case bfd_arch_sparc:
|
||||
N_SET_MACHTYPE(*execp, M_SPARC);
|
||||
break;
|
||||
case bfd_arch_i386:
|
||||
N_SET_MACHTYPE(*execp, M_386);
|
||||
break;
|
||||
case bfd_arch_a29k:
|
||||
N_SET_MACHTYPE(*execp, M_29K);
|
||||
break;
|
||||
default:
|
||||
N_SET_MACHTYPE(*execp, M_UNKNOWN);
|
||||
}
|
||||
|
||||
choose_reloc_size(abfd);
|
||||
|
||||
choose_reloc_size (abfd);
|
||||
|
||||
#if 0
|
||||
/* Some tools want this to be 0, some tools want this to be one.
|
||||
@ -187,7 +191,7 @@ DEFUN(NAME(aout,sunos4_write_object_contents),
|
||||
#else
|
||||
|
||||
/* Fri Jun 11 14:23:31 PDT 1993
|
||||
FIXME
|
||||
FIXME
|
||||
Today's optimal setting is 1. This is a pain, since it
|
||||
reopens 1927. This should be readdressed by creating a new
|
||||
target for each each supported, giving perhaps sun3/m68k
|
||||
@ -196,7 +200,7 @@ DEFUN(NAME(aout,sunos4_write_object_contents),
|
||||
N_SET_FLAGS (*execp, 1);
|
||||
#endif
|
||||
|
||||
N_SET_DYNAMIC(*execp, bfd_get_file_flags(abfd) & DYNAMIC);
|
||||
N_SET_DYNAMIC (*execp, bfd_get_file_flags (abfd) & DYNAMIC);
|
||||
|
||||
/* At least for SunOS, the dynamic symbols and relocs are embedded
|
||||
in the .text section, and we do not want to write them out with
|
||||
@ -259,7 +263,7 @@ DEFUN(NAME(aout,sunos4_write_object_contents),
|
||||
}
|
||||
}
|
||||
|
||||
WRITE_HEADERS(abfd, execp);
|
||||
WRITE_HEADERS (abfd, execp);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -278,7 +282,8 @@ DEFUN(NAME(aout,sunos4_write_object_contents),
|
||||
/* But the reg structure can be gotten from the SPARC processor handbook.
|
||||
This really should be in a GNU include file though so that gdb can use
|
||||
the same info. */
|
||||
struct regs {
|
||||
struct regs
|
||||
{
|
||||
int r_psr;
|
||||
int r_pc;
|
||||
int r_npc;
|
||||
@ -306,121 +311,124 @@ struct regs {
|
||||
neither of whose size we know, WITH STUFF IN BETWEEN THEM! We can't
|
||||
even portably access the stuff in between! */
|
||||
|
||||
struct external_sparc_core {
|
||||
int c_magic; /* Corefile magic number */
|
||||
int c_len; /* Sizeof (struct core) */
|
||||
struct external_sparc_core
|
||||
{
|
||||
int c_magic; /* Corefile magic number */
|
||||
int c_len; /* Sizeof (struct core) */
|
||||
#define SPARC_CORE_LEN 432
|
||||
int c_regs[19]; /* General purpose registers -- MACHDEP SIZE */
|
||||
struct external_exec c_aouthdr; /* A.out header */
|
||||
int c_signo; /* Killing signal, if any */
|
||||
int c_tsize; /* Text size (bytes) */
|
||||
int c_dsize; /* Data size (bytes) */
|
||||
int c_ssize; /* Stack size (bytes) */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
|
||||
double fp_stuff[1]; /* external FPU state (size unknown by us) */
|
||||
/* The type "double" is critical here, for alignment.
|
||||
int c_regs[19]; /* General purpose registers -- MACHDEP SIZE */
|
||||
struct external_exec c_aouthdr; /* A.out header */
|
||||
int c_signo; /* Killing signal, if any */
|
||||
int c_tsize; /* Text size (bytes) */
|
||||
int c_dsize; /* Data size (bytes) */
|
||||
int c_ssize; /* Stack size (bytes) */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
|
||||
double fp_stuff[1]; /* external FPU state (size unknown by us) */
|
||||
/* The type "double" is critical here, for alignment.
|
||||
SunOS declares a struct here, but the struct's alignment
|
||||
is double since it contains doubles. */
|
||||
int c_ucode; /* Exception no. from u_code */
|
||||
/* (this member is not accessible by name since we don't
|
||||
int c_ucode; /* Exception no. from u_code */
|
||||
/* (this member is not accessible by name since we don't
|
||||
portably know the size of fp_stuff.) */
|
||||
};
|
||||
};
|
||||
|
||||
struct external_sun3_core {
|
||||
int c_magic; /* Corefile magic number */
|
||||
int c_len; /* Sizeof (struct core) */
|
||||
struct external_sun3_core
|
||||
{
|
||||
int c_magic; /* Corefile magic number */
|
||||
int c_len; /* Sizeof (struct core) */
|
||||
#define SUN3_CORE_LEN 826 /* As of SunOS 4.1.1 */
|
||||
int c_regs[18]; /* General purpose registers -- MACHDEP SIZE */
|
||||
struct external_exec c_aouthdr; /* A.out header */
|
||||
int c_signo; /* Killing signal, if any */
|
||||
int c_tsize; /* Text size (bytes) */
|
||||
int c_dsize; /* Data size (bytes) */
|
||||
int c_ssize; /* Stack size (bytes) */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
|
||||
double fp_stuff[1]; /* external FPU state (size unknown by us) */
|
||||
/* The type "double" is critical here, for alignment.
|
||||
int c_regs[18]; /* General purpose registers -- MACHDEP SIZE */
|
||||
struct external_exec c_aouthdr; /* A.out header */
|
||||
int c_signo; /* Killing signal, if any */
|
||||
int c_tsize; /* Text size (bytes) */
|
||||
int c_dsize; /* Data size (bytes) */
|
||||
int c_ssize; /* Stack size (bytes) */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
|
||||
double fp_stuff[1]; /* external FPU state (size unknown by us) */
|
||||
/* The type "double" is critical here, for alignment.
|
||||
SunOS declares a struct here, but the struct's alignment
|
||||
is double since it contains doubles. */
|
||||
int c_ucode; /* Exception no. from u_code */
|
||||
/* (this member is not accessible by name since we don't
|
||||
int c_ucode; /* Exception no. from u_code */
|
||||
/* (this member is not accessible by name since we don't
|
||||
portably know the size of fp_stuff.) */
|
||||
};
|
||||
};
|
||||
|
||||
struct internal_sunos_core {
|
||||
int c_magic; /* Corefile magic number */
|
||||
int c_len; /* Sizeof (struct core) */
|
||||
long c_regs_pos; /* file offset of General purpose registers */
|
||||
int c_regs_size; /* size of General purpose registers */
|
||||
struct internal_exec c_aouthdr; /* A.out header */
|
||||
int c_signo; /* Killing signal, if any */
|
||||
int c_tsize; /* Text size (bytes) */
|
||||
int c_dsize; /* Data size (bytes) */
|
||||
int c_ssize; /* Stack size (bytes) */
|
||||
bfd_vma c_stacktop; /* Stack top (address) */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
|
||||
long fp_stuff_pos; /* file offset of external FPU state (regs) */
|
||||
int fp_stuff_size; /* Size of it */
|
||||
int c_ucode; /* Exception no. from u_code */
|
||||
};
|
||||
struct internal_sunos_core
|
||||
{
|
||||
int c_magic; /* Corefile magic number */
|
||||
int c_len; /* Sizeof (struct core) */
|
||||
long c_regs_pos; /* file offset of General purpose registers */
|
||||
int c_regs_size; /* size of General purpose registers */
|
||||
struct internal_exec c_aouthdr; /* A.out header */
|
||||
int c_signo; /* Killing signal, if any */
|
||||
int c_tsize; /* Text size (bytes) */
|
||||
int c_dsize; /* Data size (bytes) */
|
||||
int c_ssize; /* Stack size (bytes) */
|
||||
bfd_vma c_stacktop; /* Stack top (address) */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
|
||||
long fp_stuff_pos; /* file offset of external FPU state (regs) */
|
||||
int fp_stuff_size; /* Size of it */
|
||||
int c_ucode; /* Exception no. from u_code */
|
||||
};
|
||||
|
||||
/* byte-swap in the Sun-3 core structure */
|
||||
static void
|
||||
DEFUN(swapcore_sun3,(abfd, ext, intcore),
|
||||
bfd *abfd AND
|
||||
char *ext AND
|
||||
struct internal_sunos_core *intcore)
|
||||
swapcore_sun3 (abfd, ext, intcore)
|
||||
bfd *abfd;
|
||||
char *ext;
|
||||
struct internal_sunos_core *intcore;
|
||||
{
|
||||
struct external_sun3_core *extcore = (struct external_sun3_core *)ext;
|
||||
struct external_sun3_core *extcore = (struct external_sun3_core *) ext;
|
||||
|
||||
intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_magic);
|
||||
intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_len );
|
||||
intcore->c_regs_pos = (long) (((struct external_sun3_core *)0)->c_regs);
|
||||
intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_magic);
|
||||
intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_len);
|
||||
intcore->c_regs_pos = (long) (((struct external_sun3_core *) 0)->c_regs);
|
||||
intcore->c_regs_size = sizeof (extcore->c_regs);
|
||||
NAME(aout,swap_exec_header_in)(abfd, &extcore->c_aouthdr,&intcore->c_aouthdr);
|
||||
intcore->c_signo = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_signo);
|
||||
intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_tsize);
|
||||
intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_dsize);
|
||||
intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_ssize);
|
||||
NAME (aout, swap_exec_header_in) (abfd, &extcore->c_aouthdr, &intcore->c_aouthdr);
|
||||
intcore->c_signo = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_signo);
|
||||
intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_tsize);
|
||||
intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_dsize);
|
||||
intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_ssize);
|
||||
memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
|
||||
intcore->fp_stuff_pos = (long) (((struct external_sun3_core *)0)->fp_stuff);
|
||||
intcore->fp_stuff_pos = (long) (((struct external_sun3_core *) 0)->fp_stuff);
|
||||
/* FP stuff takes up whole rest of struct, except c_ucode. */
|
||||
intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
|
||||
(file_ptr)(((struct external_sun3_core *)0)->fp_stuff);
|
||||
(file_ptr) (((struct external_sun3_core *) 0)->fp_stuff);
|
||||
/* Ucode is the last thing in the struct -- just before the end */
|
||||
intcore->c_ucode =
|
||||
bfd_h_get_32 (abfd,
|
||||
intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore);
|
||||
intcore->c_stacktop = 0x0E000000; /* By experimentation */
|
||||
intcore->c_ucode =
|
||||
bfd_h_get_32 (abfd,
|
||||
intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *) extcore);
|
||||
intcore->c_stacktop = 0x0E000000; /* By experimentation */
|
||||
}
|
||||
|
||||
|
||||
/* byte-swap in the Sparc core structure */
|
||||
static void
|
||||
DEFUN(swapcore_sparc,(abfd, ext, intcore),
|
||||
bfd *abfd AND
|
||||
char *ext AND
|
||||
struct internal_sunos_core *intcore)
|
||||
swapcore_sparc (abfd, ext, intcore)
|
||||
bfd *abfd;
|
||||
char *ext;
|
||||
struct internal_sunos_core *intcore;
|
||||
{
|
||||
struct external_sparc_core *extcore = (struct external_sparc_core *)ext;
|
||||
|
||||
intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_magic);
|
||||
intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_len );
|
||||
intcore->c_regs_pos = (long) (((struct external_sparc_core *)0)->c_regs);
|
||||
struct external_sparc_core *extcore = (struct external_sparc_core *) ext;
|
||||
|
||||
intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_magic);
|
||||
intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_len);
|
||||
intcore->c_regs_pos = (long) (((struct external_sparc_core *) 0)->c_regs);
|
||||
intcore->c_regs_size = sizeof (extcore->c_regs);
|
||||
NAME(aout,swap_exec_header_in)(abfd, &extcore->c_aouthdr,&intcore->c_aouthdr);
|
||||
intcore->c_signo = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_signo);
|
||||
intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_tsize);
|
||||
intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_dsize);
|
||||
intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_ssize);
|
||||
NAME (aout, swap_exec_header_in) (abfd, &extcore->c_aouthdr, &intcore->c_aouthdr);
|
||||
intcore->c_signo = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_signo);
|
||||
intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_tsize);
|
||||
intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_dsize);
|
||||
intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_ssize);
|
||||
memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
|
||||
intcore->fp_stuff_pos = (long) (((struct external_sparc_core *)0)->fp_stuff);
|
||||
intcore->fp_stuff_pos = (long) (((struct external_sparc_core *) 0)->fp_stuff);
|
||||
/* FP stuff takes up whole rest of struct, except c_ucode. */
|
||||
intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
|
||||
(file_ptr)(((struct external_sparc_core *)0)->fp_stuff);
|
||||
(file_ptr) (((struct external_sparc_core *) 0)->fp_stuff);
|
||||
/* Ucode is the last thing in the struct -- just before the end */
|
||||
intcore->c_ucode =
|
||||
bfd_h_get_32 (abfd,
|
||||
intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore);
|
||||
bfd_h_get_32 (abfd,
|
||||
intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *) extcore);
|
||||
|
||||
/* Supposedly the user stack grows downward from the bottom of kernel memory.
|
||||
Presuming that this remains true, this definition will work. */
|
||||
@ -439,7 +447,7 @@ DEFUN(swapcore_sparc,(abfd, ext, intcore),
|
||||
#define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
|
||||
{
|
||||
bfd_vma sp = bfd_h_get_32
|
||||
(abfd, (unsigned char *)&((struct regs *)&extcore->c_regs[0])->r_o6);
|
||||
(abfd, (unsigned char *) &((struct regs *) &extcore->c_regs[0])->r_o6);
|
||||
if (sp < SPARC_USRSTACK_SPARC10)
|
||||
intcore->c_stacktop = SPARC_USRSTACK_SPARC10;
|
||||
else
|
||||
@ -455,8 +463,9 @@ DEFUN(swapcore_sparc,(abfd, ext, intcore),
|
||||
#define core_reg2sec(bfd) (core_hdr(bfd)->reg2_section)
|
||||
|
||||
/* These are stored in the bfd's tdata */
|
||||
struct sun_core_struct {
|
||||
struct internal_sunos_core *hdr; /* core file header */
|
||||
struct sun_core_struct
|
||||
{
|
||||
struct internal_sunos_core *hdr; /* core file header */
|
||||
asection *data_section;
|
||||
asection *stack_section;
|
||||
asection *reg_section;
|
||||
@ -464,29 +473,32 @@ struct sun_core_struct {
|
||||
};
|
||||
|
||||
static bfd_target *
|
||||
DEFUN(sunos4_core_file_p,(abfd),
|
||||
bfd *abfd)
|
||||
sunos4_core_file_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
unsigned char longbuf[4]; /* Raw bytes of various header fields */
|
||||
int core_size;
|
||||
int core_mag;
|
||||
struct internal_sunos_core *core;
|
||||
char *extcore;
|
||||
struct mergem {
|
||||
struct sun_core_struct suncoredata;
|
||||
struct internal_sunos_core internal_sunos_core;
|
||||
char external_core[1];
|
||||
} *mergem;
|
||||
|
||||
if (bfd_read ((PTR)longbuf, 1, sizeof (longbuf), abfd) !=
|
||||
struct mergem
|
||||
{
|
||||
struct sun_core_struct suncoredata;
|
||||
struct internal_sunos_core internal_sunos_core;
|
||||
char external_core[1];
|
||||
}
|
||||
*mergem;
|
||||
|
||||
if (bfd_read ((PTR) longbuf, 1, sizeof (longbuf), abfd) !=
|
||||
sizeof (longbuf))
|
||||
return 0;
|
||||
core_mag = bfd_h_get_32 (abfd, longbuf);
|
||||
|
||||
if (core_mag != CORE_MAGIC) return 0;
|
||||
if (core_mag != CORE_MAGIC)
|
||||
return 0;
|
||||
|
||||
/* SunOS core headers can vary in length; second word is size; */
|
||||
if (bfd_read ((PTR)longbuf, 1, sizeof (longbuf), abfd) !=
|
||||
if (bfd_read ((PTR) longbuf, 1, sizeof (longbuf), abfd) !=
|
||||
sizeof (longbuf))
|
||||
return 0;
|
||||
core_size = bfd_h_get_32 (abfd, longbuf);
|
||||
@ -494,68 +506,76 @@ DEFUN(sunos4_core_file_p,(abfd),
|
||||
if (core_size > 20000)
|
||||
return 0;
|
||||
|
||||
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) < 0) return 0;
|
||||
|
||||
mergem = (struct mergem *)bfd_zalloc (abfd, core_size + sizeof (struct mergem));
|
||||
if (mergem == NULL) {
|
||||
bfd_error = no_memory;
|
||||
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) < 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
mergem = (struct mergem *) bfd_zalloc (abfd, core_size + sizeof (struct mergem));
|
||||
if (mergem == NULL)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extcore = mergem->external_core;
|
||||
|
||||
if ((bfd_read ((PTR) extcore, 1, core_size, abfd)) != core_size) {
|
||||
bfd_error = system_call_error;
|
||||
bfd_release (abfd, (char *)mergem);
|
||||
return 0;
|
||||
}
|
||||
if ((bfd_read ((PTR) extcore, 1, core_size, abfd)) != core_size)
|
||||
{
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
bfd_release (abfd, (char *) mergem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Validate that it's a core file we know how to handle, due to sun
|
||||
botching the positioning of registers and other fields in a machine
|
||||
dependent way. */
|
||||
core = &mergem->internal_sunos_core;
|
||||
switch (core_size) {
|
||||
case SPARC_CORE_LEN:
|
||||
swapcore_sparc (abfd, extcore, core);
|
||||
break;
|
||||
case SUN3_CORE_LEN:
|
||||
swapcore_sun3 (abfd, extcore, core);
|
||||
break;
|
||||
default:
|
||||
bfd_error = system_call_error; /* FIXME */
|
||||
bfd_release (abfd, (char *)mergem);
|
||||
return 0;
|
||||
}
|
||||
switch (core_size)
|
||||
{
|
||||
case SPARC_CORE_LEN:
|
||||
swapcore_sparc (abfd, extcore, core);
|
||||
break;
|
||||
case SUN3_CORE_LEN:
|
||||
swapcore_sun3 (abfd, extcore, core);
|
||||
break;
|
||||
default:
|
||||
bfd_set_error (bfd_error_system_call); /* FIXME */
|
||||
bfd_release (abfd, (char *) mergem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
abfd->tdata.sun_core_data = &mergem->suncoredata;
|
||||
abfd->tdata.sun_core_data->hdr = core;
|
||||
abfd->tdata.sun_core_data = &mergem->suncoredata;
|
||||
abfd->tdata.sun_core_data->hdr = core;
|
||||
|
||||
/* create the sections. This is raunchy, but bfd_close wants to reclaim
|
||||
them */
|
||||
core_stacksec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||
if (core_stacksec (abfd) == NULL) {
|
||||
loser:
|
||||
bfd_error = no_memory;
|
||||
bfd_release (abfd, (char *)mergem);
|
||||
return 0;
|
||||
}
|
||||
if (core_stacksec (abfd) == NULL)
|
||||
{
|
||||
loser:
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
bfd_release (abfd, (char *) mergem);
|
||||
return 0;
|
||||
}
|
||||
core_datasec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||
if (core_datasec (abfd) == NULL) {
|
||||
loser1:
|
||||
bfd_release (abfd, core_stacksec (abfd));
|
||||
goto loser;
|
||||
}
|
||||
if (core_datasec (abfd) == NULL)
|
||||
{
|
||||
loser1:
|
||||
bfd_release (abfd, core_stacksec (abfd));
|
||||
goto loser;
|
||||
}
|
||||
core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||
if (core_regsec (abfd) == NULL) {
|
||||
loser2:
|
||||
bfd_release (abfd, core_datasec (abfd));
|
||||
goto loser1;
|
||||
}
|
||||
if (core_regsec (abfd) == NULL)
|
||||
{
|
||||
loser2:
|
||||
bfd_release (abfd, core_datasec (abfd));
|
||||
goto loser1;
|
||||
}
|
||||
core_reg2sec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||
if (core_reg2sec (abfd) == NULL) {
|
||||
bfd_release (abfd, core_regsec (abfd));
|
||||
goto loser2;
|
||||
}
|
||||
if (core_reg2sec (abfd) == NULL)
|
||||
{
|
||||
bfd_release (abfd, core_regsec (abfd));
|
||||
goto loser2;
|
||||
}
|
||||
|
||||
core_stacksec (abfd)->name = ".stack";
|
||||
core_datasec (abfd)->name = ".data";
|
||||
@ -573,15 +593,15 @@ DEFUN(sunos4_core_file_p,(abfd),
|
||||
core_reg2sec (abfd)->_raw_size = core->fp_stuff_size;
|
||||
|
||||
core_stacksec (abfd)->vma = (core->c_stacktop - core->c_ssize);
|
||||
core_datasec (abfd)->vma = N_DATADDR(core->c_aouthdr);
|
||||
core_datasec (abfd)->vma = N_DATADDR (core->c_aouthdr);
|
||||
core_regsec (abfd)->vma = 0;
|
||||
core_reg2sec (abfd)->vma = 0;
|
||||
|
||||
core_stacksec (abfd)->filepos = core->c_len + core->c_dsize;
|
||||
core_datasec (abfd)->filepos = core->c_len;
|
||||
/* We'll access the regs afresh in the core file, like any section: */
|
||||
core_regsec (abfd)->filepos = (file_ptr)core->c_regs_pos;
|
||||
core_reg2sec (abfd)->filepos = (file_ptr)core->fp_stuff_pos;
|
||||
core_regsec (abfd)->filepos = (file_ptr) core->c_regs_pos;
|
||||
core_reg2sec (abfd)->filepos = (file_ptr) core->fp_stuff_pos;
|
||||
|
||||
/* Align to word at least */
|
||||
core_stacksec (abfd)->alignment_power = 2;
|
||||
@ -599,52 +619,54 @@ DEFUN(sunos4_core_file_p,(abfd),
|
||||
return abfd->xvec;
|
||||
}
|
||||
|
||||
static char *sunos4_core_file_failing_command (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
static char *
|
||||
sunos4_core_file_failing_command (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return core_hdr (abfd)->hdr->c_cmdname;
|
||||
}
|
||||
|
||||
static int
|
||||
DEFUN(sunos4_core_file_failing_signal,(abfd),
|
||||
bfd *abfd)
|
||||
sunos4_core_file_failing_signal (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return core_hdr (abfd)->hdr->c_signo;
|
||||
}
|
||||
|
||||
static boolean
|
||||
DEFUN(sunos4_core_file_matches_executable_p, (core_bfd, exec_bfd),
|
||||
bfd *core_bfd AND
|
||||
bfd *exec_bfd)
|
||||
sunos4_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
bfd *core_bfd;
|
||||
bfd *exec_bfd;
|
||||
{
|
||||
if (core_bfd->xvec != exec_bfd->xvec) {
|
||||
bfd_error = system_call_error;
|
||||
return false;
|
||||
}
|
||||
if (core_bfd->xvec != exec_bfd->xvec)
|
||||
{
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
return false;
|
||||
}
|
||||
|
||||
return (memcmp ((char *)&((core_hdr (core_bfd)->hdr)->c_aouthdr),
|
||||
return (memcmp ((char *) &((core_hdr (core_bfd)->hdr)->c_aouthdr),
|
||||
(char *) exec_hdr (exec_bfd),
|
||||
sizeof (struct internal_exec)) == 0) ? true : false;
|
||||
}
|
||||
|
||||
#define MY_set_sizes sunos4_set_sizes
|
||||
static boolean
|
||||
DEFUN (sunos4_set_sizes, (abfd),
|
||||
bfd *abfd)
|
||||
sunos4_set_sizes (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
switch (bfd_get_arch (abfd))
|
||||
{
|
||||
default:
|
||||
return false;
|
||||
case bfd_arch_sparc:
|
||||
adata(abfd).page_size = 0x2000;
|
||||
adata(abfd).segment_size = 0x2000;
|
||||
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
adata (abfd).page_size = 0x2000;
|
||||
adata (abfd).segment_size = 0x2000;
|
||||
adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
return true;
|
||||
case bfd_arch_m68k:
|
||||
adata(abfd).page_size = 0x2000;
|
||||
adata(abfd).segment_size = 0x20000;
|
||||
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
adata (abfd).page_size = 0x2000;
|
||||
adata (abfd).segment_size = 0x20000;
|
||||
adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -656,7 +678,8 @@ DEFUN (sunos4_set_sizes, (abfd),
|
||||
#define MY_read_dynamic_relocs 0
|
||||
#endif
|
||||
|
||||
static CONST struct aout_backend_data sunos4_aout_backend = {
|
||||
static CONST struct aout_backend_data sunos4_aout_backend =
|
||||
{
|
||||
0, /* zmagic files are not contiguous */
|
||||
1, /* text includes header */
|
||||
0, /* default text vma */
|
||||
|
@ -658,7 +658,7 @@ bfd_create PARAMS ((CONST char *filename, bfd *templ));
|
||||
#define bfd_h_get_signed_64(abfd, ptr) \
|
||||
BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr))
|
||||
|
||||
typedef struct sec
|
||||
typedef struct sec
|
||||
{
|
||||
/* The name of the section; the name isn't a copy, the pointer is
|
||||
the same as that passed to bfd_make_section. */
|
||||
@ -667,7 +667,7 @@ typedef struct sec
|
||||
|
||||
/* Which section is it; 0..nth. */
|
||||
|
||||
int index;
|
||||
int index;
|
||||
|
||||
/* The next section in the list belonging to the BFD, or NULL. */
|
||||
|
||||
@ -675,7 +675,7 @@ typedef struct sec
|
||||
|
||||
/* The field flags contains attributes of the section. Some
|
||||
flags are read in from the object file, and some are
|
||||
synthesized from other information. */
|
||||
synthesized from other information. */
|
||||
|
||||
flagword flags;
|
||||
|
||||
@ -685,7 +685,7 @@ typedef struct sec
|
||||
This is clear for a section containing debug information
|
||||
only. */
|
||||
#define SEC_ALLOC 0x001
|
||||
|
||||
|
||||
/* Tells the OS to load the section from the file when loading.
|
||||
This is clear for a .bss section. */
|
||||
#define SEC_LOAD 0x002
|
||||
@ -784,13 +784,13 @@ typedef struct sec
|
||||
contains a value even if the section has no contents (e.g., the
|
||||
size of <<.bss>>). This will be filled in after relocation */
|
||||
|
||||
bfd_size_type _cooked_size;
|
||||
bfd_size_type _cooked_size;
|
||||
|
||||
/* The original size on disk of the section, in bytes. Normally this
|
||||
value is the same as the size, but if some relaxing has
|
||||
been done, then this value will be bigger. */
|
||||
|
||||
bfd_size_type _raw_size;
|
||||
bfd_size_type _raw_size;
|
||||
|
||||
/* If this section is going to be output, then this value is the
|
||||
offset into the output section of the first byte in the input
|
||||
@ -827,8 +827,8 @@ typedef struct sec
|
||||
|
||||
/* File position of section data */
|
||||
|
||||
file_ptr filepos;
|
||||
|
||||
file_ptr filepos;
|
||||
|
||||
/* File position of relocation info */
|
||||
|
||||
file_ptr rel_filepos;
|
||||
@ -848,7 +848,7 @@ typedef struct sec
|
||||
/* Attached line number information */
|
||||
|
||||
alent *lineno;
|
||||
|
||||
|
||||
/* Number of line number records */
|
||||
|
||||
unsigned int lineno_count;
|
||||
@ -875,7 +875,7 @@ typedef struct sec
|
||||
|
||||
boolean reloc_done;
|
||||
/* A symbol which points at this section only */
|
||||
struct symbol_cache_entry *symbol;
|
||||
struct symbol_cache_entry *symbol;
|
||||
struct symbol_cache_entry **symbol_ptr_ptr;
|
||||
|
||||
struct bfd_link_order *link_order_head;
|
||||
@ -935,14 +935,14 @@ bfd_set_section_size PARAMS ((bfd *abfd, asection *sec, bfd_size_type val));
|
||||
|
||||
boolean
|
||||
bfd_set_section_contents
|
||||
PARAMS ((bfd *abfd,
|
||||
PARAMS ((bfd *abfd,
|
||||
asection *section,
|
||||
PTR data,
|
||||
file_ptr offset,
|
||||
bfd_size_type count));
|
||||
|
||||
boolean
|
||||
bfd_get_section_contents
|
||||
bfd_get_section_contents
|
||||
PARAMS ((bfd *abfd, asection *section, PTR location,
|
||||
file_ptr offset, bfd_size_type count));
|
||||
|
||||
@ -1061,7 +1061,7 @@ CONST char *
|
||||
bfd_printable_arch_mach
|
||||
PARAMS ((enum bfd_architecture arch, unsigned long machine));
|
||||
|
||||
typedef enum bfd_reloc_status
|
||||
typedef enum bfd_reloc_status
|
||||
{
|
||||
/* No errors detected */
|
||||
bfd_reloc_ok,
|
||||
@ -1093,7 +1093,7 @@ typedef enum bfd_reloc_status
|
||||
bfd_reloc_status_type;
|
||||
|
||||
|
||||
typedef struct reloc_cache_entry
|
||||
typedef struct reloc_cache_entry
|
||||
{
|
||||
/* A pointer into the canonical table of pointers */
|
||||
struct symbol_cache_entry **sym_ptr_ptr;
|
||||
@ -1102,7 +1102,7 @@ typedef struct reloc_cache_entry
|
||||
bfd_size_type address;
|
||||
|
||||
/* addend for relocation value */
|
||||
bfd_vma addend;
|
||||
bfd_vma addend;
|
||||
|
||||
/* Pointer to how to perform the required relocation */
|
||||
const struct reloc_howto_struct *howto;
|
||||
@ -1126,8 +1126,8 @@ enum complain_overflow
|
||||
complain_overflow_unsigned
|
||||
};
|
||||
|
||||
typedef struct reloc_howto_struct
|
||||
{
|
||||
typedef struct reloc_howto_struct
|
||||
{
|
||||
/* The type field has mainly a documetary use - the back end can
|
||||
do what it wants with it, though normally the back end's
|
||||
external idea of what a reloc number is stored
|
||||
@ -1167,12 +1167,12 @@ typedef struct reloc_howto_struct
|
||||
called rather than the normal function. This allows really
|
||||
strange relocation methods to be accomodated (e.g., i960 callj
|
||||
instructions). */
|
||||
bfd_reloc_status_type (*special_function)
|
||||
bfd_reloc_status_type (*special_function)
|
||||
PARAMS ((bfd *abfd,
|
||||
arelent *reloc_entry,
|
||||
struct symbol_cache_entry *symbol,
|
||||
PTR data,
|
||||
asection *input_section,
|
||||
asection *input_section,
|
||||
bfd *output_bfd,
|
||||
char **error_message));
|
||||
|
||||
@ -1196,7 +1196,7 @@ typedef struct reloc_howto_struct
|
||||
into the instruction. In most cases src_mask == dst_mask,
|
||||
except in the above special case, where dst_mask would be
|
||||
0x000000ff, and src_mask would be 0x00000000. */
|
||||
bfd_vma dst_mask;
|
||||
bfd_vma dst_mask;
|
||||
|
||||
/* When some formats create PC relative instructions, they leave
|
||||
the value of the pc of the place being relocated in the offset
|
||||
@ -1221,7 +1221,7 @@ typedef struct reloc_howto_struct
|
||||
relocation = symbol->value; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
}
|
||||
int
|
||||
bfd_get_reloc_size PARAMS ((const reloc_howto_type *));
|
||||
|
||||
@ -1241,12 +1241,12 @@ bfd_perform_relocation
|
||||
bfd *output_bfd,
|
||||
char **error_message));
|
||||
|
||||
typedef enum bfd_reloc_code_real
|
||||
typedef enum bfd_reloc_code_real
|
||||
{
|
||||
/* Basic absolute relocations */
|
||||
BFD_RELOC_64,
|
||||
BFD_RELOC_32,
|
||||
BFD_RELOC_16,
|
||||
BFD_RELOC_16,
|
||||
BFD_RELOC_14,
|
||||
BFD_RELOC_8,
|
||||
|
||||
@ -1520,7 +1520,7 @@ const struct reloc_howto_struct *
|
||||
bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
|
||||
|
||||
|
||||
typedef struct symbol_cache_entry
|
||||
typedef struct symbol_cache_entry
|
||||
{
|
||||
/* A pointer to the BFD which owns the symbol. This information
|
||||
is necessary so that a back end can work out what additional
|
||||
@ -1621,7 +1621,7 @@ typedef struct symbol_cache_entry
|
||||
|
||||
flagword flags;
|
||||
|
||||
/* A pointer to the section to which this symbol is
|
||||
/* A pointer to the section to which this symbol is
|
||||
relative. This will always be non NULL, there are special
|
||||
sections for undefined and absolute symbols */
|
||||
struct sec *section;
|
||||
|
@ -248,12 +248,13 @@ static reloc_howto_type howto_table[] =
|
||||
#define RELOC_PROCESSING(relent, reloc, symbols, abfd, section) \
|
||||
reloc_processing(relent, reloc, symbols, abfd, section)
|
||||
|
||||
static void DEFUN(reloc_processing,(relent,reloc, symbols, abfd, section) ,
|
||||
arelent *relent AND
|
||||
struct internal_reloc *reloc AND
|
||||
asymbol **symbols AND
|
||||
bfd *abfd AND
|
||||
asection *section)
|
||||
static void
|
||||
reloc_processing (relent,reloc, symbols, abfd, section)
|
||||
arelent *relent;
|
||||
struct internal_reloc *reloc;
|
||||
asymbol **symbols;
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
{
|
||||
relent->address = reloc->r_vaddr;
|
||||
relent->howto = howto_table + reloc->r_type;
|
||||
|
132
bfd/coffcode.h
132
bfd/coffcode.h
@ -405,9 +405,9 @@ sec_to_styp_flags (sec_name, sec_flags)
|
||||
* in sec_to_styp_flags().
|
||||
*/
|
||||
static flagword
|
||||
DEFUN (styp_to_sec_flags, (abfd, hdr),
|
||||
bfd * abfd AND
|
||||
PTR hdr)
|
||||
styp_to_sec_flags (abfd, hdr)
|
||||
bfd * abfd;
|
||||
PTR hdr;
|
||||
{
|
||||
struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
|
||||
long styp_flags = internal_s->s_flags;
|
||||
@ -695,9 +695,9 @@ dependent COFF routines:
|
||||
/* See whether the magic number matches. */
|
||||
|
||||
static boolean
|
||||
DEFUN (coff_bad_format_hook, (abfd, filehdr),
|
||||
bfd * abfd AND
|
||||
PTR filehdr)
|
||||
coff_bad_format_hook (abfd, filehdr)
|
||||
bfd * abfd;
|
||||
PTR filehdr;
|
||||
{
|
||||
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
|
||||
|
||||
@ -722,9 +722,9 @@ DEFUN (coff_bad_format_hook, (abfd, filehdr),
|
||||
}
|
||||
|
||||
static asection *
|
||||
DEFUN (coff_make_section_hook, (abfd, name),
|
||||
bfd * abfd AND
|
||||
char *name)
|
||||
coff_make_section_hook (abfd, name)
|
||||
bfd * abfd;
|
||||
char *name;
|
||||
{
|
||||
#ifdef TWO_DATA_SECS
|
||||
/* FIXME: This predates the call to bfd_make_section_anyway
|
||||
@ -743,9 +743,9 @@ DEFUN (coff_make_section_hook, (abfd, name),
|
||||
*/
|
||||
|
||||
static boolean
|
||||
DEFUN (coff_new_section_hook, (abfd, section),
|
||||
bfd * abfd AND
|
||||
asection * section)
|
||||
coff_new_section_hook (abfd, section)
|
||||
bfd * abfd;
|
||||
asection * section;
|
||||
{
|
||||
section->alignment_power = abfd->xvec->align_power_min;
|
||||
/* Allocate aux records for section symbols, to store size and
|
||||
@ -764,10 +764,10 @@ DEFUN (coff_new_section_hook, (abfd, section),
|
||||
/* Set the alignment of a BFD section. */
|
||||
|
||||
static void
|
||||
DEFUN (coff_set_alignment_hook, (abfd, section, scnhdr),
|
||||
bfd * abfd AND
|
||||
asection * section AND
|
||||
PTR scnhdr)
|
||||
coff_set_alignment_hook (abfd, section, scnhdr)
|
||||
bfd * abfd;
|
||||
asection * section;
|
||||
PTR scnhdr;
|
||||
{
|
||||
struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr;
|
||||
unsigned int i;
|
||||
@ -786,15 +786,15 @@ DEFUN (coff_set_alignment_hook, (abfd, section, scnhdr),
|
||||
#endif /* ! I960 */
|
||||
|
||||
static boolean
|
||||
DEFUN (coff_mkobject, (abfd),
|
||||
bfd * abfd)
|
||||
coff_mkobject (abfd)
|
||||
bfd * abfd;
|
||||
{
|
||||
coff_data_type *coff;
|
||||
|
||||
abfd->tdata.coff_obj_data = (struct coff_tdata *) bfd_zalloc (abfd, sizeof (coff_data_type));
|
||||
if (abfd->tdata.coff_obj_data == 0)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
coff = coff_data (abfd);
|
||||
@ -810,10 +810,10 @@ DEFUN (coff_mkobject, (abfd),
|
||||
/* Create the COFF backend specific information. */
|
||||
|
||||
static PTR
|
||||
DEFUN (coff_mkobject_hook, (abfd, filehdr, aouthdr),
|
||||
bfd * abfd AND
|
||||
PTR filehdr AND
|
||||
PTR aouthdr)
|
||||
coff_mkobject_hook (abfd, filehdr, aouthdr)
|
||||
bfd * abfd;
|
||||
PTR filehdr;
|
||||
PTR aouthdr;
|
||||
{
|
||||
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
|
||||
coff_data_type *coff;
|
||||
@ -1015,9 +1015,9 @@ coff_set_arch_mach_hook (abfd, filehdr)
|
||||
#ifdef SYMNAME_IN_DEBUG
|
||||
|
||||
static boolean
|
||||
DEFUN (symname_in_debug_hook, (abfd, sym),
|
||||
bfd * abfd AND
|
||||
struct internal_syment *sym)
|
||||
symname_in_debug_hook (abfd, sym)
|
||||
bfd * abfd;
|
||||
struct internal_syment *sym;
|
||||
{
|
||||
return SYMNAME_IN_DEBUG (sym) ? true : false;
|
||||
}
|
||||
@ -1046,8 +1046,8 @@ SUBSUBSECTION
|
||||
*/
|
||||
|
||||
static void
|
||||
DEFUN (coff_write_relocs, (abfd),
|
||||
bfd * abfd)
|
||||
coff_write_relocs (abfd)
|
||||
bfd * abfd;
|
||||
{
|
||||
asection *s;
|
||||
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
|
||||
@ -1109,10 +1109,10 @@ DEFUN (coff_write_relocs, (abfd),
|
||||
type. Result is true if we can represent the arch&type, false if not. */
|
||||
|
||||
static boolean
|
||||
DEFUN (coff_set_flags, (abfd, magicp, flagsp),
|
||||
bfd * abfd AND
|
||||
unsigned *magicp AND
|
||||
unsigned short *flagsp)
|
||||
coff_set_flags (abfd, magicp, flagsp)
|
||||
bfd * abfd;
|
||||
unsigned *magicp;
|
||||
unsigned short *flagsp;
|
||||
{
|
||||
switch (bfd_get_arch (abfd))
|
||||
{
|
||||
@ -1275,10 +1275,10 @@ DEFUN (coff_set_flags, (abfd, magicp, flagsp),
|
||||
|
||||
|
||||
static boolean
|
||||
DEFUN (coff_set_arch_mach, (abfd, arch, machine),
|
||||
bfd * abfd AND
|
||||
enum bfd_architecture arch AND
|
||||
unsigned long machine)
|
||||
coff_set_arch_mach (abfd, arch, machine)
|
||||
bfd * abfd;
|
||||
enum bfd_architecture arch;
|
||||
unsigned long machine;
|
||||
{
|
||||
unsigned dummy1;
|
||||
unsigned short dummy2;
|
||||
@ -1294,8 +1294,8 @@ DEFUN (coff_set_arch_mach, (abfd, arch, machine),
|
||||
/* Calculate the file position for each section. */
|
||||
|
||||
static void
|
||||
DEFUN (coff_compute_section_file_positions, (abfd),
|
||||
bfd * abfd)
|
||||
coff_compute_section_file_positions (abfd)
|
||||
bfd * abfd;
|
||||
{
|
||||
asection *current;
|
||||
asection *previous = (asection *) NULL;
|
||||
@ -1422,7 +1422,7 @@ coff_add_missing_symbols (abfd)
|
||||
sympp2 = (asymbol **) bfd_alloc_by_size_t (abfd, nsyms * sizeof (asymbol *));
|
||||
if (!sympp2)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
memcpy (sympp2, sympp, i * sizeof (asymbol *));
|
||||
@ -1447,8 +1447,8 @@ coff_add_missing_symbols (abfd)
|
||||
/* SUPPRESS 558 */
|
||||
/* SUPPRESS 529 */
|
||||
static boolean
|
||||
DEFUN (coff_write_object_contents, (abfd),
|
||||
bfd * abfd)
|
||||
coff_write_object_contents (abfd)
|
||||
bfd * abfd;
|
||||
{
|
||||
asection *current;
|
||||
unsigned int count;
|
||||
@ -1470,7 +1470,7 @@ DEFUN (coff_write_object_contents, (abfd),
|
||||
struct internal_aouthdr internal_a;
|
||||
|
||||
|
||||
bfd_error = system_call_error;
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
/* Number the output sections, starting from one on the first section
|
||||
with a name which doesn't start with a *.
|
||||
@@ The code doesn't make this check. Is it supposed to be done,
|
||||
@ -1808,12 +1808,12 @@ DEFUN (coff_write_object_contents, (abfd),
|
||||
}
|
||||
|
||||
static boolean
|
||||
DEFUN (coff_set_section_contents, (abfd, section, location, offset, count),
|
||||
bfd * abfd AND
|
||||
sec_ptr section AND
|
||||
PTR location AND
|
||||
file_ptr offset AND
|
||||
bfd_size_type count)
|
||||
coff_set_section_contents (abfd, section, location, offset, count)
|
||||
bfd * abfd;
|
||||
sec_ptr section;
|
||||
PTR location;
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
{
|
||||
if (abfd->output_has_begun == false) /* set by bfd.c handler */
|
||||
coff_compute_section_file_positions (abfd);
|
||||
@ -1857,7 +1857,7 @@ coff_close_and_cleanup (abfd)
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
bfd_error = invalid_operation;
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1878,13 +1878,13 @@ buy_and_read (abfd, where, seek_direction, size)
|
||||
PTR area = (PTR) bfd_alloc (abfd, size);
|
||||
if (!area)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return (NULL);
|
||||
}
|
||||
bfd_seek (abfd, where, seek_direction);
|
||||
if (bfd_read (area, 1, size, abfd) != size)
|
||||
{
|
||||
bfd_error = system_call_error;
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
return (NULL);
|
||||
} /* on error */
|
||||
return (area);
|
||||
@ -1930,7 +1930,7 @@ coff_slurp_line_table (abfd, asect)
|
||||
(alent *) bfd_alloc (abfd, (size_t) ((asect->lineno_count + 1) * sizeof (alent)));
|
||||
if (lineno_cache == NULL)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@ -1972,8 +1972,8 @@ coff_slurp_line_table (abfd, asect)
|
||||
}
|
||||
|
||||
static boolean
|
||||
DEFUN (coff_slurp_symbol_table, (abfd),
|
||||
bfd * abfd)
|
||||
coff_slurp_symbol_table (abfd)
|
||||
bfd * abfd;
|
||||
{
|
||||
combined_entry_type *native_symbols;
|
||||
coff_symbol_type *cached_area;
|
||||
@ -1997,7 +1997,7 @@ DEFUN (coff_slurp_symbol_table, (abfd),
|
||||
|
||||
if (cached_area == NULL)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
} /* on error */
|
||||
table_ptr =
|
||||
@ -2006,7 +2006,7 @@ DEFUN (coff_slurp_symbol_table, (abfd),
|
||||
|
||||
if (table_ptr == NULL)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@ -2277,10 +2277,10 @@ SUBSUBSECTION
|
||||
#endif
|
||||
|
||||
static boolean
|
||||
DEFUN (coff_slurp_reloc_table, (abfd, asect, symbols),
|
||||
bfd * abfd AND
|
||||
sec_ptr asect AND
|
||||
asymbol ** symbols)
|
||||
coff_slurp_reloc_table (abfd, asect, symbols)
|
||||
bfd * abfd;
|
||||
sec_ptr asect;
|
||||
asymbol ** symbols;
|
||||
{
|
||||
RELOC *native_relocs;
|
||||
arelent *reloc_cache;
|
||||
@ -2307,7 +2307,7 @@ DEFUN (coff_slurp_reloc_table, (abfd, asect, symbols),
|
||||
|
||||
if (reloc_cache == NULL)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2376,11 +2376,11 @@ DEFUN (coff_slurp_reloc_table, (abfd, asect, symbols),
|
||||
|
||||
/* This is stupid. This function should be a boolean predicate. */
|
||||
static unsigned int
|
||||
DEFUN (coff_canonicalize_reloc, (abfd, section, relptr, symbols),
|
||||
bfd * abfd AND
|
||||
sec_ptr section AND
|
||||
arelent ** relptr AND
|
||||
asymbol ** symbols)
|
||||
coff_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
bfd * abfd;
|
||||
sec_ptr section;
|
||||
arelent ** relptr;
|
||||
asymbol ** symbols;
|
||||
{
|
||||
arelent *tblptr = section->relocation;
|
||||
unsigned int count = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Core file generic interface routines for BFD.
|
||||
Copyright (C) 1990-1991 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -45,8 +45,8 @@ DESCRIPTION
|
||||
*/
|
||||
|
||||
CONST char *
|
||||
DEFUN(bfd_core_file_failing_command,(abfd),
|
||||
bfd *abfd)
|
||||
bfd_core_file_failing_command (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (abfd->format != bfd_core) {
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
|
@ -38,7 +38,8 @@ static bfd_arch_info_type arch_info_struct =
|
||||
0,
|
||||
};
|
||||
|
||||
void DEFUN_VOID(bfd_a29k_arch)
|
||||
void
|
||||
bfd_a29k_arch ()
|
||||
{
|
||||
bfd_arch_linkin(&arch_info_struct);
|
||||
}
|
||||
|
10
bfd/ctor.c
10
bfd/ctor.c
@ -1,5 +1,5 @@
|
||||
/* BFD library support routines for constructors
|
||||
Copyright (C) 1990-1991 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
|
||||
|
||||
Hacked by Steve Chamberlain of Cygnus Support. With some help from
|
||||
Judy Chamberlain too.
|
||||
@ -115,10 +115,10 @@ DESCRIPTION
|
||||
|
||||
|
||||
boolean
|
||||
DEFUN(bfd_constructor_entry,(abfd, symbol_ptr_ptr, type),
|
||||
bfd *abfd AND
|
||||
asymbol **symbol_ptr_ptr AND
|
||||
CONST char *type)
|
||||
bfd_constructor_entry (abfd, symbol_ptr_ptr, type)
|
||||
bfd *abfd;
|
||||
asymbol **symbol_ptr_ptr;
|
||||
CONST char *type;
|
||||
{
|
||||
/* Look up the section we're using to store the table in */
|
||||
asection *rel_section = bfd_get_section_by_name (abfd, type);
|
||||
|
408
bfd/ieee.c
408
bfd/ieee.c
@ -37,17 +37,17 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
standard requires. */
|
||||
|
||||
static void
|
||||
DEFUN (ieee_write_byte, (abfd, byte),
|
||||
bfd * abfd AND
|
||||
bfd_byte byte)
|
||||
ieee_write_byte (abfd, byte)
|
||||
bfd *abfd;
|
||||
bfd_byte byte;
|
||||
{
|
||||
bfd_write ((PTR) & byte, 1, 1, abfd);
|
||||
}
|
||||
|
||||
static void
|
||||
DEFUN (ieee_write_twobyte, (abfd, twobyte),
|
||||
bfd * abfd AND
|
||||
int twobyte)
|
||||
ieee_write_twobyte (abfd, twobyte)
|
||||
bfd *abfd;
|
||||
int twobyte;
|
||||
{
|
||||
bfd_byte b[2];
|
||||
b[1] = twobyte & 0xff;
|
||||
@ -56,9 +56,9 @@ DEFUN (ieee_write_twobyte, (abfd, twobyte),
|
||||
}
|
||||
|
||||
static void
|
||||
DEFUN (ieee_write_2bytes, (abfd, bytes),
|
||||
bfd * abfd AND
|
||||
int bytes)
|
||||
ieee_write_2bytes (abfd, bytes)
|
||||
bfd *abfd;
|
||||
int bytes;
|
||||
{
|
||||
bfd_byte buffer[2];
|
||||
buffer[0] = bytes >> 8;
|
||||
@ -68,9 +68,9 @@ DEFUN (ieee_write_2bytes, (abfd, bytes),
|
||||
}
|
||||
|
||||
static void
|
||||
DEFUN (ieee_write_int, (abfd, value),
|
||||
bfd * abfd AND
|
||||
bfd_vma value)
|
||||
ieee_write_int (abfd, value)
|
||||
bfd *abfd;
|
||||
bfd_vma value;
|
||||
{
|
||||
if (((unsigned) value) <= 127)
|
||||
{
|
||||
@ -113,9 +113,9 @@ DEFUN (ieee_write_int, (abfd, value),
|
||||
}
|
||||
|
||||
static void
|
||||
DEFUN (ieee_write_id, (abfd, id),
|
||||
bfd * abfd AND
|
||||
CONST char *id)
|
||||
ieee_write_id (abfd, id)
|
||||
bfd *abfd;
|
||||
CONST char *id;
|
||||
{
|
||||
size_t length = strlen (id);
|
||||
if (length <= 127)
|
||||
@ -151,8 +151,8 @@ standard requires:
|
||||
#define this_byte_and_next(ieee) (*((ieee)->input_p++))
|
||||
|
||||
static unsigned short
|
||||
DEFUN (read_2bytes, (ieee),
|
||||
common_header_type * ieee)
|
||||
read_2bytes (ieee)
|
||||
common_header_type *ieee;
|
||||
{
|
||||
unsigned char c1 = this_byte_and_next (ieee);
|
||||
unsigned char c2 = this_byte_and_next (ieee);
|
||||
@ -160,10 +160,10 @@ DEFUN (read_2bytes, (ieee),
|
||||
}
|
||||
|
||||
static void
|
||||
DEFUN (bfd_get_string, (ieee, string, length),
|
||||
common_header_type * ieee AND
|
||||
char *string AND
|
||||
size_t length)
|
||||
bfd_get_string (ieee, string, length)
|
||||
common_header_type *ieee;
|
||||
char *string;
|
||||
size_t length;
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < length; i++)
|
||||
@ -173,8 +173,8 @@ DEFUN (bfd_get_string, (ieee, string, length),
|
||||
}
|
||||
|
||||
static char *
|
||||
DEFUN (read_id, (ieee),
|
||||
common_header_type * ieee)
|
||||
read_id (ieee)
|
||||
common_header_type *ieee;
|
||||
{
|
||||
size_t length;
|
||||
char *string;
|
||||
@ -198,7 +198,7 @@ DEFUN (read_id, (ieee),
|
||||
string = bfd_alloc (ieee->abfd, length + 1);
|
||||
if (!string)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return NULL;
|
||||
}
|
||||
bfd_get_string (ieee, string, length);
|
||||
@ -207,12 +207,12 @@ DEFUN (read_id, (ieee),
|
||||
}
|
||||
|
||||
static void
|
||||
DEFUN (ieee_write_expression, (abfd, value, symbol, pcrel, index),
|
||||
bfd * abfd AND
|
||||
bfd_vma value AND
|
||||
asymbol * symbol AND
|
||||
boolean pcrel AND
|
||||
unsigned int index)
|
||||
ieee_write_expression (abfd, value, symbol, pcrel, index)
|
||||
bfd *abfd;
|
||||
bfd_vma value;
|
||||
asymbol *symbol;
|
||||
boolean pcrel;
|
||||
unsigned int index;
|
||||
{
|
||||
unsigned int term_count = 0;
|
||||
|
||||
@ -289,9 +289,9 @@ DEFUN (ieee_write_expression, (abfd, value, symbol, pcrel, index),
|
||||
writes any integer into the buffer supplied and always takes 5 bytes
|
||||
*/
|
||||
static void
|
||||
DEFUN (ieee_write_int5, (buffer, value),
|
||||
bfd_byte * buffer AND
|
||||
bfd_vma value)
|
||||
ieee_write_int5 (buffer, value)
|
||||
bfd_byte *buffer;
|
||||
bfd_vma value;
|
||||
{
|
||||
buffer[0] = (bfd_byte) ieee_number_repeat_4_enum;
|
||||
buffer[1] = (value >> 24) & 0xff;
|
||||
@ -301,9 +301,9 @@ DEFUN (ieee_write_int5, (buffer, value),
|
||||
}
|
||||
|
||||
static void
|
||||
DEFUN (ieee_write_int5_out, (abfd, value),
|
||||
bfd * abfd AND
|
||||
bfd_vma value)
|
||||
ieee_write_int5_out (abfd, value)
|
||||
bfd *abfd;
|
||||
bfd_vma value;
|
||||
{
|
||||
bfd_byte b[5];
|
||||
ieee_write_int5 (b, value);
|
||||
@ -311,9 +311,9 @@ DEFUN (ieee_write_int5_out, (abfd, value),
|
||||
}
|
||||
|
||||
static boolean
|
||||
DEFUN (parse_int, (ieee, value_ptr),
|
||||
common_header_type * ieee AND
|
||||
bfd_vma * value_ptr)
|
||||
parse_int (ieee, value_ptr)
|
||||
common_header_type *ieee;
|
||||
bfd_vma *value_ptr;
|
||||
{
|
||||
int value = this_byte (ieee);
|
||||
int result;
|
||||
@ -340,9 +340,9 @@ DEFUN (parse_int, (ieee, value_ptr),
|
||||
}
|
||||
|
||||
static int
|
||||
DEFUN (parse_i, (ieee, ok),
|
||||
common_header_type * ieee AND
|
||||
boolean * ok)
|
||||
parse_i (ieee, ok)
|
||||
common_header_type *ieee;
|
||||
boolean *ok;
|
||||
{
|
||||
bfd_vma x;
|
||||
*ok = parse_int (ieee, &x);
|
||||
@ -350,8 +350,8 @@ DEFUN (parse_i, (ieee, ok),
|
||||
}
|
||||
|
||||
static bfd_vma
|
||||
DEFUN (must_parse_int, (ieee),
|
||||
common_header_type * ieee)
|
||||
must_parse_int (ieee)
|
||||
common_header_type *ieee;
|
||||
{
|
||||
bfd_vma result;
|
||||
BFD_ASSERT (parse_int (ieee, &result) == true);
|
||||
@ -396,13 +396,13 @@ static ieee_symbol_index_type NOSYMBOL =
|
||||
|
||||
|
||||
static void
|
||||
DEFUN (parse_expression, (ieee, value, symbol, pcrel, extra, section),
|
||||
ieee_data_type * ieee AND
|
||||
bfd_vma * value AND
|
||||
ieee_symbol_index_type * symbol AND
|
||||
boolean * pcrel AND
|
||||
unsigned int *extra AND
|
||||
asection ** section)
|
||||
parse_expression (ieee, value, symbol, pcrel, extra, section)
|
||||
ieee_data_type *ieee;
|
||||
bfd_vma *value;
|
||||
ieee_symbol_index_type *symbol;
|
||||
boolean *pcrel;
|
||||
unsigned int *extra;
|
||||
asection **section;
|
||||
|
||||
{
|
||||
#define POS sp[1]
|
||||
@ -542,22 +542,22 @@ static unsigned int last_index;
|
||||
static char last_type; /* is the index for an X or a D */
|
||||
|
||||
static ieee_symbol_type *
|
||||
DEFUN (get_symbol, (abfd,
|
||||
ieee,
|
||||
last_symbol,
|
||||
symbol_count,
|
||||
pptr,
|
||||
max_index,
|
||||
this_type
|
||||
),
|
||||
bfd * abfd AND
|
||||
ieee_data_type * ieee AND
|
||||
ieee_symbol_type * last_symbol AND
|
||||
unsigned int *symbol_count AND
|
||||
ieee_symbol_type *** pptr AND
|
||||
unsigned int *max_index AND
|
||||
char this_type
|
||||
get_symbol (abfd,
|
||||
ieee,
|
||||
last_symbol,
|
||||
symbol_count,
|
||||
pptr,
|
||||
max_index,
|
||||
this_type
|
||||
)
|
||||
bfd *abfd;
|
||||
ieee_data_type *ieee;
|
||||
ieee_symbol_type *last_symbol;
|
||||
unsigned int *symbol_count;
|
||||
ieee_symbol_type ***pptr;
|
||||
unsigned int *max_index;
|
||||
char this_type
|
||||
;
|
||||
{
|
||||
/* Need a new symbol */
|
||||
unsigned int new_index = must_parse_int (&(ieee->h));
|
||||
@ -567,7 +567,7 @@ DEFUN (get_symbol, (abfd,
|
||||
sizeof (ieee_symbol_type));
|
||||
if (!new_symbol)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -587,8 +587,8 @@ DEFUN (get_symbol, (abfd,
|
||||
}
|
||||
|
||||
static void
|
||||
DEFUN (ieee_slurp_external_symbols, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_slurp_external_symbols (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
ieee_data_type *ieee = IEEE_DATA (abfd);
|
||||
file_ptr offset = ieee->w.r.external_part;
|
||||
@ -763,8 +763,8 @@ DEFUN (ieee_slurp_external_symbols, (abfd),
|
||||
}
|
||||
|
||||
static void
|
||||
DEFUN (ieee_slurp_symbol_table, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_slurp_symbol_table (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (IEEE_DATA (abfd)->read_symbols == false)
|
||||
{
|
||||
@ -774,8 +774,8 @@ DEFUN (ieee_slurp_symbol_table, (abfd),
|
||||
}
|
||||
|
||||
unsigned int
|
||||
DEFUN (ieee_get_symtab_upper_bound, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_get_symtab_upper_bound (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
ieee_slurp_symbol_table (abfd);
|
||||
|
||||
@ -791,9 +791,9 @@ symbol index order
|
||||
extern bfd_target ieee_vec;
|
||||
|
||||
unsigned int
|
||||
DEFUN (ieee_get_symtab, (abfd, location),
|
||||
bfd * abfd AND
|
||||
asymbol ** location)
|
||||
ieee_get_symtab (abfd, location)
|
||||
bfd *abfd;
|
||||
asymbol **location;
|
||||
{
|
||||
ieee_symbol_type *symp;
|
||||
static bfd dummy_bfd;
|
||||
@ -848,10 +848,10 @@ DEFUN (ieee_get_symtab, (abfd, location),
|
||||
}
|
||||
|
||||
static asection *
|
||||
DEFUN (get_section_entry, (abfd, ieee, index),
|
||||
bfd * abfd AND
|
||||
ieee_data_type * ieee AND
|
||||
unsigned int index)
|
||||
get_section_entry (abfd, ieee, index)
|
||||
bfd *abfd;
|
||||
ieee_data_type *ieee;
|
||||
unsigned int index;
|
||||
{
|
||||
if (ieee->section_table[index] == (asection *) NULL)
|
||||
{
|
||||
@ -860,7 +860,7 @@ DEFUN (get_section_entry, (abfd, ieee, index),
|
||||
|
||||
if (!tmp)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return NULL;
|
||||
}
|
||||
sprintf (tmp, " fsec%4d", index);
|
||||
@ -874,8 +874,8 @@ DEFUN (get_section_entry, (abfd, ieee, index),
|
||||
}
|
||||
|
||||
static void
|
||||
DEFUN (ieee_slurp_sections, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_slurp_sections (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
ieee_data_type *ieee = IEEE_DATA (abfd);
|
||||
file_ptr offset = ieee->w.r.section_part;
|
||||
@ -1039,8 +1039,8 @@ DEFUN (ieee_slurp_sections, (abfd),
|
||||
*/
|
||||
|
||||
bfd_target *
|
||||
DEFUN (ieee_archive_p, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_archive_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
char *library;
|
||||
boolean loop;
|
||||
@ -1054,7 +1054,7 @@ DEFUN (ieee_archive_p, (abfd),
|
||||
abfd->tdata.ieee_ar_data = (ieee_ar_data_type *) bfd_alloc (abfd, sizeof (ieee_ar_data_type));
|
||||
if (!abfd->tdata.ieee_ar_data)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return NULL;
|
||||
}
|
||||
ieee = IEEE_AR_DATA (abfd);
|
||||
@ -1087,7 +1087,7 @@ DEFUN (ieee_archive_p, (abfd),
|
||||
|
||||
if (!obstack_begin (&ob, 128))
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return (bfd_target *) NULL;
|
||||
}
|
||||
|
||||
@ -1132,7 +1132,7 @@ DEFUN (ieee_archive_p, (abfd),
|
||||
ieee->elements = (ieee_ar_obstack_type *) obstack_finish (&ob);
|
||||
if (!ieee->elements)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return (bfd_target *) NULL;
|
||||
}
|
||||
|
||||
@ -1165,16 +1165,16 @@ DEFUN (ieee_archive_p, (abfd),
|
||||
}
|
||||
|
||||
static boolean
|
||||
DEFUN (ieee_mkobject, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_mkobject (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
abfd->tdata.ieee_data = (ieee_data_type *) bfd_zalloc (abfd, sizeof (ieee_data_type));
|
||||
return abfd->tdata.ieee_data ? true : false;
|
||||
}
|
||||
|
||||
bfd_target *
|
||||
DEFUN (ieee_object_p, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_object_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
char *processor;
|
||||
unsigned int part;
|
||||
@ -1270,7 +1270,7 @@ DEFUN (ieee_object_p, (abfd),
|
||||
+ 50);
|
||||
if (!IEEE_DATA (abfd)->h.first_byte)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
goto fail;
|
||||
}
|
||||
bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
|
||||
@ -1285,10 +1285,10 @@ fail:
|
||||
}
|
||||
|
||||
void
|
||||
DEFUN (ieee_get_symbol_info, (ignore_abfd, symbol, ret),
|
||||
bfd * ignore_abfd AND
|
||||
asymbol * symbol AND
|
||||
symbol_info * ret)
|
||||
ieee_get_symbol_info (ignore_abfd, symbol, ret)
|
||||
bfd *ignore_abfd;
|
||||
asymbol *symbol;
|
||||
symbol_info *ret;
|
||||
{
|
||||
bfd_symbol_info (symbol, ret);
|
||||
if (symbol->name[0] == ' ')
|
||||
@ -1298,11 +1298,11 @@ DEFUN (ieee_get_symbol_info, (ignore_abfd, symbol, ret),
|
||||
}
|
||||
|
||||
void
|
||||
DEFUN (ieee_print_symbol, (ignore_abfd, afile, symbol, how),
|
||||
bfd * ignore_abfd AND
|
||||
PTR afile AND
|
||||
asymbol * symbol AND
|
||||
bfd_print_symbol_type how)
|
||||
ieee_print_symbol (ignore_abfd, afile, symbol, how)
|
||||
bfd *ignore_abfd;
|
||||
PTR afile;
|
||||
asymbol *symbol;
|
||||
bfd_print_symbol_type how;
|
||||
{
|
||||
FILE *file = (FILE *) afile;
|
||||
|
||||
@ -1344,11 +1344,11 @@ DEFUN (ieee_print_symbol, (ignore_abfd, afile, symbol, how),
|
||||
}
|
||||
|
||||
static boolean
|
||||
DEFUN (do_one, (ieee, current_map, location_ptr, s),
|
||||
ieee_data_type * ieee AND
|
||||
ieee_per_section_type * current_map AND
|
||||
unsigned char *location_ptr AND
|
||||
asection * s)
|
||||
do_one (ieee, current_map, location_ptr, s)
|
||||
ieee_data_type *ieee;
|
||||
ieee_per_section_type *current_map;
|
||||
unsigned char *location_ptr;
|
||||
asection *s;
|
||||
{
|
||||
switch (this_byte (&(ieee->h)))
|
||||
{
|
||||
@ -1389,7 +1389,7 @@ DEFUN (do_one, (ieee, current_map, location_ptr, s),
|
||||
sizeof (ieee_reloc_type));
|
||||
if (!r)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1540,8 +1540,8 @@ DEFUN (do_one, (ieee, current_map, location_ptr, s),
|
||||
|
||||
/* Read in all the section data and relocation stuff too */
|
||||
static boolean
|
||||
DEFUN (ieee_slurp_section_data, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_slurp_section_data (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
bfd_byte *location_ptr = (bfd_byte *) NULL;
|
||||
ieee_data_type *ieee = IEEE_DATA (abfd);
|
||||
@ -1563,7 +1563,7 @@ DEFUN (ieee_slurp_section_data, (abfd),
|
||||
per->data = (bfd_byte *) bfd_alloc (ieee->h.abfd, s->_raw_size);
|
||||
if (!per->data)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
/*SUPPRESS 68*/
|
||||
@ -1668,15 +1668,15 @@ DEFUN (ieee_slurp_section_data, (abfd),
|
||||
}
|
||||
|
||||
boolean
|
||||
DEFUN (ieee_new_section_hook, (abfd, newsect),
|
||||
bfd * abfd AND
|
||||
asection * newsect)
|
||||
ieee_new_section_hook (abfd, newsect)
|
||||
bfd *abfd;
|
||||
asection *newsect;
|
||||
{
|
||||
newsect->used_by_bfd = (PTR)
|
||||
bfd_alloc (abfd, sizeof (ieee_per_section_type));
|
||||
if (!newsect->used_by_bfd)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
ieee_per_section (newsect)->data = (bfd_byte *) NULL;
|
||||
@ -1685,21 +1685,21 @@ DEFUN (ieee_new_section_hook, (abfd, newsect),
|
||||
}
|
||||
|
||||
unsigned int
|
||||
DEFUN (ieee_get_reloc_upper_bound, (abfd, asect),
|
||||
bfd * abfd AND
|
||||
sec_ptr asect)
|
||||
ieee_get_reloc_upper_bound (abfd, asect)
|
||||
bfd *abfd;
|
||||
sec_ptr asect;
|
||||
{
|
||||
ieee_slurp_section_data (abfd);
|
||||
return (asect->reloc_count + 1) * sizeof (arelent *);
|
||||
}
|
||||
|
||||
static boolean
|
||||
DEFUN (ieee_get_section_contents, (abfd, section, location, offset, count),
|
||||
bfd * abfd AND
|
||||
sec_ptr section AND
|
||||
PTR location AND
|
||||
file_ptr offset AND
|
||||
bfd_size_type count)
|
||||
ieee_get_section_contents (abfd, section, location, offset, count)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
PTR location;
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
{
|
||||
ieee_per_section_type *p = (ieee_per_section_type *) section->used_by_bfd;
|
||||
ieee_slurp_section_data (abfd);
|
||||
@ -1708,11 +1708,11 @@ DEFUN (ieee_get_section_contents, (abfd, section, location, offset, count),
|
||||
}
|
||||
|
||||
unsigned int
|
||||
DEFUN (ieee_canonicalize_reloc, (abfd, section, relptr, symbols),
|
||||
bfd * abfd AND
|
||||
sec_ptr section AND
|
||||
arelent ** relptr AND
|
||||
asymbol ** symbols)
|
||||
ieee_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
arelent **relptr;
|
||||
asymbol **symbols;
|
||||
{
|
||||
/* ieee_per_section_type *p = (ieee_per_section_type *) section->used_by_bfd;*/
|
||||
ieee_reloc_type *src = (ieee_reloc_type *) (section->relocation);
|
||||
@ -1743,9 +1743,9 @@ DEFUN (ieee_canonicalize_reloc, (abfd, section, relptr, symbols),
|
||||
}
|
||||
|
||||
static int
|
||||
DEFUN (comp, (ap, bp),
|
||||
CONST PTR ap AND
|
||||
CONST PTR bp)
|
||||
comp (ap, bp)
|
||||
CONST PTR ap;
|
||||
CONST PTR bp;
|
||||
{
|
||||
arelent *a = *((arelent **) ap);
|
||||
arelent *b = *((arelent **) bp);
|
||||
@ -1757,8 +1757,8 @@ Write the section headers
|
||||
*/
|
||||
|
||||
static void
|
||||
DEFUN (ieee_write_section_part, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_write_section_part (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
ieee_data_type *ieee = IEEE_DATA (abfd);
|
||||
asection *s;
|
||||
@ -1831,9 +1831,9 @@ DEFUN (ieee_write_section_part, (abfd),
|
||||
|
||||
|
||||
static boolean
|
||||
DEFUN (do_with_relocs, (abfd, s),
|
||||
bfd * abfd AND
|
||||
asection * s)
|
||||
do_with_relocs (abfd, s)
|
||||
bfd *abfd;
|
||||
asection *s;
|
||||
{
|
||||
unsigned int relocs_to_go = s->reloc_count;
|
||||
|
||||
@ -1898,7 +1898,7 @@ DEFUN (do_with_relocs, (abfd, s),
|
||||
stream = (unsigned char *) (bfd_alloc (abfd, s->_raw_size));
|
||||
if (!stream)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
memset ((PTR) stream, 0, s->_raw_size);
|
||||
@ -2007,9 +2007,9 @@ be clever about how we write. We block items up into a max of 127
|
||||
bytes */
|
||||
|
||||
static void
|
||||
DEFUN (do_as_repeat, (abfd, s),
|
||||
bfd * abfd AND
|
||||
asection * s)
|
||||
do_as_repeat (abfd, s)
|
||||
bfd *abfd;
|
||||
asection *s;
|
||||
{
|
||||
if (s->_raw_size)
|
||||
{
|
||||
@ -2029,9 +2029,9 @@ DEFUN (do_as_repeat, (abfd, s),
|
||||
}
|
||||
|
||||
static void
|
||||
DEFUN (do_without_relocs, (abfd, s),
|
||||
bfd * abfd AND
|
||||
asection * s)
|
||||
do_without_relocs (abfd, s)
|
||||
bfd *abfd;
|
||||
asection *s;
|
||||
{
|
||||
bfd_byte *stream = ieee_per_section (s)->data;
|
||||
|
||||
@ -2066,13 +2066,13 @@ static bfd *input_bfd;
|
||||
static bfd *output_bfd;
|
||||
static int output_buffer;
|
||||
|
||||
static void
|
||||
static void
|
||||
fill ()
|
||||
{
|
||||
bfd_read ((PTR) input_ptr_start, 1, input_ptr_end - input_ptr_start, input_bfd);
|
||||
input_ptr = input_ptr_start;
|
||||
}
|
||||
static void
|
||||
static void
|
||||
flush ()
|
||||
{
|
||||
bfd_write ((PTR) (output_ptr_start), 1, output_ptr - output_ptr_start, output_bfd);
|
||||
@ -2084,7 +2084,7 @@ flush ()
|
||||
#define NEXT() { input_ptr++; if (input_ptr == input_ptr_end) fill(); }
|
||||
#define OUT(x) { *output_ptr++ = (x); if(output_ptr == output_ptr_end) flush(); }
|
||||
|
||||
static void
|
||||
static void
|
||||
write_int (value)
|
||||
int value;
|
||||
{
|
||||
@ -2128,7 +2128,7 @@ write_int (value)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
copy_id ()
|
||||
{
|
||||
int length = THIS ();
|
||||
@ -2144,7 +2144,7 @@ copy_id ()
|
||||
}
|
||||
|
||||
#define VAR(x) ((x | 0x80))
|
||||
static void
|
||||
static void
|
||||
copy_expression ()
|
||||
{
|
||||
int stack[10];
|
||||
@ -2261,8 +2261,8 @@ struct output_buffer_struct
|
||||
};
|
||||
|
||||
static void
|
||||
DEFUN (fill_int, (buf),
|
||||
struct output_buffer_struct *buf)
|
||||
fill_int (buf)
|
||||
struct output_buffer_struct *buf;
|
||||
{
|
||||
if (buf->buffer == output_buffer)
|
||||
{
|
||||
@ -2276,8 +2276,8 @@ DEFUN (fill_int, (buf),
|
||||
}
|
||||
|
||||
static void
|
||||
DEFUN (drop_int, (buf),
|
||||
struct output_buffer_struct *buf)
|
||||
drop_int (buf)
|
||||
struct output_buffer_struct *buf;
|
||||
{
|
||||
int type = THIS ();
|
||||
int ch;
|
||||
@ -2311,7 +2311,7 @@ DEFUN (drop_int, (buf),
|
||||
OUT (0);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
copy_int ()
|
||||
{
|
||||
int type = THIS ();
|
||||
@ -2351,7 +2351,7 @@ static void copy_till_end ();
|
||||
#define INTn(q) copy_int()
|
||||
#define EXPn(q) copy_expression()
|
||||
|
||||
static void
|
||||
static void
|
||||
f1_record ()
|
||||
{
|
||||
int ch;
|
||||
@ -2452,7 +2452,7 @@ f1_record ()
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
f0_record ()
|
||||
{
|
||||
/* Attribute record */
|
||||
@ -2462,7 +2462,7 @@ f0_record ()
|
||||
ID;
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
copy_till_end ()
|
||||
{
|
||||
int ch = THIS ();
|
||||
@ -2500,7 +2500,7 @@ copy_till_end ()
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
f2_record ()
|
||||
{
|
||||
NEXT ();
|
||||
@ -2514,7 +2514,7 @@ f2_record ()
|
||||
|
||||
|
||||
static void block ();
|
||||
static void
|
||||
static void
|
||||
f8_record ()
|
||||
{
|
||||
int ch;
|
||||
@ -2658,7 +2658,7 @@ f8_record ()
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
e2_record ()
|
||||
{
|
||||
OUT (0xe2);
|
||||
@ -2669,8 +2669,8 @@ e2_record ()
|
||||
EXP;
|
||||
}
|
||||
|
||||
static void
|
||||
DEFUN_VOID (block)
|
||||
static void
|
||||
block ()
|
||||
{
|
||||
int ch;
|
||||
while (1)
|
||||
@ -2711,9 +2711,9 @@ DEFUN_VOID (block)
|
||||
*/
|
||||
|
||||
static void
|
||||
DEFUN (relocate_debug, (output, input),
|
||||
bfd * output AND
|
||||
bfd * input)
|
||||
relocate_debug (output, input)
|
||||
bfd *output;
|
||||
bfd *input;
|
||||
{
|
||||
#define IBS 400
|
||||
#define OBS 400
|
||||
@ -2733,8 +2733,8 @@ DEFUN (relocate_debug, (output, input),
|
||||
*/
|
||||
|
||||
static void
|
||||
DEFUN (ieee_write_debug_part, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_write_debug_part (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
ieee_data_type *ieee = IEEE_DATA (abfd);
|
||||
bfd_chain_type *chain = ieee->chain_root;
|
||||
@ -2822,8 +2822,8 @@ DEFUN (ieee_write_debug_part, (abfd),
|
||||
|
||||
/* write the data in an ieee way */
|
||||
static void
|
||||
DEFUN (ieee_write_data_part, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_write_data_part (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
asection *s;
|
||||
ieee_data_type *ieee = IEEE_DATA (abfd);
|
||||
@ -2845,8 +2845,8 @@ DEFUN (ieee_write_data_part, (abfd),
|
||||
|
||||
|
||||
static boolean
|
||||
DEFUN (init_for_output, (abfd),
|
||||
bfd * abfd)
|
||||
init_for_output (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
asection *s;
|
||||
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
|
||||
@ -2856,7 +2856,7 @@ DEFUN (init_for_output, (abfd),
|
||||
ieee_per_section (s)->data = (bfd_byte *) (bfd_alloc (abfd, s->_raw_size));
|
||||
if (!ieee_per_section (s)->data)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -2870,12 +2870,12 @@ DEFUN (init_for_output, (abfd),
|
||||
* not a byte image, but a record stream.
|
||||
*/
|
||||
boolean
|
||||
DEFUN (ieee_set_section_contents, (abfd, section, location, offset, count),
|
||||
bfd * abfd AND
|
||||
sec_ptr section AND
|
||||
PTR location AND
|
||||
file_ptr offset AND
|
||||
bfd_size_type count)
|
||||
ieee_set_section_contents (abfd, section, location, offset, count)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
PTR location;
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
{
|
||||
if (ieee_per_section (section)->data == (bfd_byte *) NULL)
|
||||
{
|
||||
@ -2895,8 +2895,8 @@ to index them as well. When we write them out we turn their symbol
|
||||
values into indexes from the right base.
|
||||
*/
|
||||
static void
|
||||
DEFUN (ieee_write_external_part, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_write_external_part (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
asymbol **q;
|
||||
ieee_data_type *ieee = IEEE_DATA (abfd);
|
||||
@ -3017,8 +3017,8 @@ static CONST unsigned char envi[] =
|
||||
|
||||
static
|
||||
void
|
||||
DEFUN (ieee_write_me_part, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_write_me_part (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
ieee_data_type *ieee = IEEE_DATA (abfd);
|
||||
ieee->w.r.trailer_part = bfd_tell (abfd);
|
||||
@ -3039,8 +3039,8 @@ DEFUN (ieee_write_me_part, (abfd),
|
||||
}
|
||||
|
||||
boolean
|
||||
DEFUN (ieee_write_object_contents, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_write_object_contents (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
ieee_data_type *ieee = IEEE_DATA (abfd);
|
||||
unsigned int i;
|
||||
@ -3128,15 +3128,15 @@ function exits. We read the strings into a buffer large enough to
|
||||
hold them all plus all the cached symbol entries. */
|
||||
|
||||
asymbol *
|
||||
DEFUN (ieee_make_empty_symbol, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_make_empty_symbol (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
|
||||
ieee_symbol_type *new =
|
||||
(ieee_symbol_type *) bfd_zmalloc (sizeof (ieee_symbol_type));
|
||||
if (!new)
|
||||
{
|
||||
bfd_error = no_error;
|
||||
bfd_set_error (bfd_error_no_error);
|
||||
return NULL;
|
||||
}
|
||||
new->symbol.the_bfd = abfd;
|
||||
@ -3144,9 +3144,9 @@ DEFUN (ieee_make_empty_symbol, (abfd),
|
||||
}
|
||||
|
||||
static bfd *
|
||||
DEFUN (ieee_openr_next_archived_file, (arch, prev),
|
||||
bfd * arch AND
|
||||
bfd * prev)
|
||||
ieee_openr_next_archived_file (arch, prev)
|
||||
bfd *arch;
|
||||
bfd *prev;
|
||||
{
|
||||
ieee_ar_data_type *ar = IEEE_AR_DATA (arch);
|
||||
/* take the next one from the arch state, or reset */
|
||||
@ -3173,7 +3173,7 @@ DEFUN (ieee_openr_next_archived_file, (arch, prev),
|
||||
}
|
||||
else
|
||||
{
|
||||
bfd_error = no_more_archived_files;
|
||||
bfd_set_error (bfd_error_no_more_archived_files);
|
||||
return (bfd *) NULL;
|
||||
}
|
||||
|
||||
@ -3207,7 +3207,7 @@ ieee_generic_stat_arch_elt (abfd, buf)
|
||||
ieee_ar_data_type *ar = abfd->my_archive->tdata.ieee_ar_data;
|
||||
if (ar == (ieee_ar_data_type *) NULL)
|
||||
{
|
||||
bfd_error = invalid_operation;
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
@ -3219,24 +3219,24 @@ ieee_generic_stat_arch_elt (abfd, buf)
|
||||
}
|
||||
|
||||
static int
|
||||
DEFUN (ieee_sizeof_headers, (abfd, x),
|
||||
bfd * abfd AND
|
||||
boolean x)
|
||||
ieee_sizeof_headers (abfd, x)
|
||||
bfd *abfd;
|
||||
boolean x;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
DEFUN (ieee_bfd_debug_info_start, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_bfd_debug_info_start (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
DEFUN (ieee_bfd_debug_info_end, (abfd),
|
||||
bfd * abfd)
|
||||
ieee_bfd_debug_info_end (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
|
||||
}
|
||||
@ -3246,9 +3246,9 @@ DEFUN (ieee_bfd_debug_info_end, (abfd),
|
||||
be ready to output it at close time
|
||||
*/
|
||||
static void
|
||||
DEFUN (ieee_bfd_debug_info_accumulate, (abfd, section),
|
||||
bfd * abfd AND
|
||||
asection * section)
|
||||
ieee_bfd_debug_info_accumulate (abfd, section)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
{
|
||||
ieee_data_type *ieee = IEEE_DATA (section->owner);
|
||||
ieee_data_type *output_ieee = IEEE_DATA (abfd);
|
||||
@ -3270,8 +3270,8 @@ DEFUN (ieee_bfd_debug_info_accumulate, (abfd, section),
|
||||
bfd_chain_type *n = (bfd_chain_type *) bfd_alloc (abfd, sizeof (bfd_chain_type));
|
||||
if (!n)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
abort(); /* FIXME */
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
abort (); /* FIXME */
|
||||
}
|
||||
n->this = section->owner;
|
||||
n->next = (bfd_chain_type *) NULL;
|
||||
|
@ -282,8 +282,7 @@ bfd_constructor_entry PARAMS ((bfd *abfd,
|
||||
|
||||
const struct reloc_howto_struct *
|
||||
bfd_default_reloc_type_lookup
|
||||
PARAMS ((bfd *abfd AND
|
||||
bfd_reloc_code_real_type code));
|
||||
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
|
||||
|
||||
boolean
|
||||
bfd_generic_relax_section
|
||||
|
1719
bfd/oasys.c
1719
bfd/oasys.c
File diff suppressed because it is too large
Load Diff
300
bfd/section.c
300
bfd/section.c
@ -46,7 +46,7 @@ SUBSECTION
|
||||
|
||||
Each section has a name which describes the section in the
|
||||
outside world---for example, <<a.out>> would contain at least
|
||||
three sections, called <<.text>>, <<.data>> and <<.bss>>.
|
||||
three sections, called <<.text>>, <<.data>> and <<.bss>>.
|
||||
|
||||
Names need not be unique; for example a COFF file may have several
|
||||
sections named <<.data>>.
|
||||
@ -78,7 +78,7 @@ SUBSECTION
|
||||
To write a new object style BFD, the various sections to be
|
||||
written have to be created. They are attached to the BFD in
|
||||
the same way as input sections; data is written to the
|
||||
sections using <<bfd_set_section_contents>>.
|
||||
sections using <<bfd_set_section_contents>>.
|
||||
|
||||
Any program that creates or combines sections (e.g., the assembler
|
||||
and linker) must use the <<asection>> fields <<output_section>> and
|
||||
@ -149,7 +149,7 @@ SUBSECTION
|
||||
|
||||
CODE_FRAGMENT
|
||||
.
|
||||
.typedef struct sec
|
||||
.typedef struct sec
|
||||
.{
|
||||
. {* The name of the section; the name isn't a copy, the pointer is
|
||||
. the same as that passed to bfd_make_section. *}
|
||||
@ -158,7 +158,7 @@ CODE_FRAGMENT
|
||||
.
|
||||
. {* Which section is it; 0..nth. *}
|
||||
.
|
||||
. int index;
|
||||
. int index;
|
||||
.
|
||||
. {* The next section in the list belonging to the BFD, or NULL. *}
|
||||
.
|
||||
@ -166,7 +166,7 @@ CODE_FRAGMENT
|
||||
.
|
||||
. {* The field flags contains attributes of the section. Some
|
||||
. flags are read in from the object file, and some are
|
||||
. synthesized from other information. *}
|
||||
. synthesized from other information. *}
|
||||
.
|
||||
. flagword flags;
|
||||
.
|
||||
@ -176,7 +176,7 @@ CODE_FRAGMENT
|
||||
. This is clear for a section containing debug information
|
||||
. only. *}
|
||||
.#define SEC_ALLOC 0x001
|
||||
.
|
||||
.
|
||||
. {* Tells the OS to load the section from the file when loading.
|
||||
. This is clear for a .bss section. *}
|
||||
.#define SEC_LOAD 0x002
|
||||
@ -247,6 +247,12 @@ CODE_FRAGMENT
|
||||
. discarded. *}
|
||||
.#define SEC_DEBUGGING 0x10000
|
||||
.
|
||||
. {* The contents of this section are held in memory pointed to
|
||||
. by the contents field. This is checked by
|
||||
. bfd_get_section_contents, and the data is retrieved from
|
||||
. memory if appropriate. *}
|
||||
.#define SEC_IN_MEMORY 0x20000
|
||||
.
|
||||
. {* End of section flags. *}
|
||||
.
|
||||
. {* The virtual memory address of the section - where it will be
|
||||
@ -269,13 +275,13 @@ CODE_FRAGMENT
|
||||
. contains a value even if the section has no contents (e.g., the
|
||||
. size of <<.bss>>). This will be filled in after relocation *}
|
||||
.
|
||||
. bfd_size_type _cooked_size;
|
||||
. bfd_size_type _cooked_size;
|
||||
.
|
||||
. {* The original size on disk of the section, in bytes. Normally this
|
||||
. value is the same as the size, but if some relaxing has
|
||||
. been done, then this value will be bigger. *}
|
||||
.
|
||||
. bfd_size_type _raw_size;
|
||||
. bfd_size_type _raw_size;
|
||||
.
|
||||
. {* If this section is going to be output, then this value is the
|
||||
. offset into the output section of the first byte in the input
|
||||
@ -312,8 +318,8 @@ CODE_FRAGMENT
|
||||
.
|
||||
. {* File position of section data *}
|
||||
.
|
||||
. file_ptr filepos;
|
||||
.
|
||||
. file_ptr filepos;
|
||||
.
|
||||
. {* File position of relocation info *}
|
||||
.
|
||||
. file_ptr rel_filepos;
|
||||
@ -326,12 +332,14 @@ CODE_FRAGMENT
|
||||
.
|
||||
. PTR userdata;
|
||||
.
|
||||
. struct lang_output_section *otheruserdata;
|
||||
. {* If the SEC_IN_MEMORY flag is set, this points to the actual
|
||||
. contents. *}
|
||||
. unsigned char *contents;
|
||||
.
|
||||
. {* Attached line number information *}
|
||||
.
|
||||
. alent *lineno;
|
||||
.
|
||||
.
|
||||
. {* Number of line number records *}
|
||||
.
|
||||
. unsigned int lineno_count;
|
||||
@ -358,7 +366,7 @@ CODE_FRAGMENT
|
||||
.
|
||||
. boolean reloc_done;
|
||||
. {* A symbol which points at this section only *}
|
||||
. struct symbol_cache_entry *symbol;
|
||||
. struct symbol_cache_entry *symbol;
|
||||
. struct symbol_cache_entry **symbol_ptr_ptr;
|
||||
.
|
||||
. struct bfd_link_order *link_order_head;
|
||||
@ -395,12 +403,13 @@ CODE_FRAGMENT
|
||||
|
||||
/* These symbols are global, not specific to any BFD. Therefore, anything
|
||||
that tries to change them is broken, and should be repaired. */
|
||||
static CONST asymbol global_syms[] = {
|
||||
/* the_bfd, name, value, attr, section [, udata] */
|
||||
{ 0, BFD_COM_SECTION_NAME, 0, BSF_SECTION_SYM, &bfd_com_section },
|
||||
{ 0, BFD_UND_SECTION_NAME, 0, BSF_SECTION_SYM, &bfd_und_section },
|
||||
{ 0, BFD_ABS_SECTION_NAME, 0, BSF_SECTION_SYM, &bfd_abs_section },
|
||||
{ 0, BFD_IND_SECTION_NAME, 0, BSF_SECTION_SYM, &bfd_ind_section },
|
||||
static CONST asymbol global_syms[] =
|
||||
{
|
||||
/* the_bfd, name, value, attr, section [, udata] */
|
||||
{0, BFD_COM_SECTION_NAME, 0, BSF_SECTION_SYM, &bfd_com_section},
|
||||
{0, BFD_UND_SECTION_NAME, 0, BSF_SECTION_SYM, &bfd_und_section},
|
||||
{0, BFD_ABS_SECTION_NAME, 0, BSF_SECTION_SYM, &bfd_abs_section},
|
||||
{0, BFD_IND_SECTION_NAME, 0, BSF_SECTION_SYM, &bfd_ind_section},
|
||||
};
|
||||
|
||||
#define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
|
||||
@ -426,7 +435,7 @@ These are the functions exported by the section handling part of BFD.
|
||||
*/
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
FUNCTION
|
||||
bfd_get_section_by_name
|
||||
|
||||
SYNOPSIS
|
||||
@ -444,14 +453,15 @@ DESCRIPTION
|
||||
*/
|
||||
|
||||
asection *
|
||||
DEFUN(bfd_get_section_by_name,(abfd, name),
|
||||
bfd *abfd AND
|
||||
CONST char *name)
|
||||
bfd_get_section_by_name (abfd, name)
|
||||
bfd *abfd;
|
||||
CONST char *name;
|
||||
{
|
||||
asection *sect;
|
||||
|
||||
for (sect = abfd->sections; sect != NULL; sect = sect->next)
|
||||
if (!strcmp (sect->name, name)) return sect;
|
||||
if (!strcmp (sect->name, name))
|
||||
return sect;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -483,14 +493,14 @@ DESCRIPTION
|
||||
|
||||
|
||||
asection *
|
||||
DEFUN(bfd_make_section_old_way,(abfd, name),
|
||||
bfd *abfd AND
|
||||
CONST char * name)
|
||||
bfd_make_section_old_way (abfd, name)
|
||||
bfd *abfd;
|
||||
CONST char *name;
|
||||
{
|
||||
asection *sec = bfd_get_section_by_name(abfd, name);
|
||||
if (sec == (asection *)NULL)
|
||||
asection *sec = bfd_get_section_by_name (abfd, name);
|
||||
if (sec == (asection *) NULL)
|
||||
{
|
||||
sec = bfd_make_section(abfd, name);
|
||||
sec = bfd_make_section (abfd, name);
|
||||
}
|
||||
return sec;
|
||||
}
|
||||
@ -505,7 +515,7 @@ SYNOPSIS
|
||||
DESCRIPTION
|
||||
Create a new empty section called @var{name} and attach it to the end of
|
||||
the chain of sections for @var{abfd}. Create a new section even if there
|
||||
is already a section with that name.
|
||||
is already a section with that name.
|
||||
|
||||
Return <<NULL>> and set <<bfd_error>> on error; possible errors are:
|
||||
o <<bfd_error_invalid_operation>> - If output has already started for @var{abfd}.
|
||||
@ -519,7 +529,7 @@ bfd_make_section_anyway (abfd, name)
|
||||
{
|
||||
asection *newsect;
|
||||
asection **prev = &abfd->sections;
|
||||
asection * sect = abfd->sections;
|
||||
asection *sect = abfd->sections;
|
||||
|
||||
if (abfd->output_has_begun)
|
||||
{
|
||||
@ -527,32 +537,35 @@ bfd_make_section_anyway (abfd, name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (sect) {
|
||||
prev = §->next;
|
||||
sect = sect->next;
|
||||
}
|
||||
while (sect)
|
||||
{
|
||||
prev = §->next;
|
||||
sect = sect->next;
|
||||
}
|
||||
|
||||
newsect = (asection *) bfd_zalloc(abfd, sizeof (asection));
|
||||
if (newsect == NULL) {
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return NULL;
|
||||
}
|
||||
newsect = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||
if (newsect == NULL)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
newsect->name = name;
|
||||
newsect->index = abfd->section_count++;
|
||||
newsect->flags = SEC_NO_FLAGS;
|
||||
|
||||
newsect->userdata = 0;
|
||||
newsect->next = (asection *)NULL;
|
||||
newsect->relocation = (arelent *)NULL;
|
||||
newsect->userdata = NULL;
|
||||
newsect->contents = NULL;
|
||||
newsect->next = (asection *) NULL;
|
||||
newsect->relocation = (arelent *) NULL;
|
||||
newsect->reloc_count = 0;
|
||||
newsect->line_filepos =0;
|
||||
newsect->line_filepos = 0;
|
||||
newsect->owner = abfd;
|
||||
|
||||
/* Create a symbol whos only job is to point to this section. This is
|
||||
useful for things like relocs which are relative to the base of a
|
||||
section. */
|
||||
newsect->symbol = bfd_make_empty_symbol(abfd);
|
||||
newsect->symbol = bfd_make_empty_symbol (abfd);
|
||||
if (!newsect)
|
||||
return NULL;
|
||||
newsect->symbol->name = name;
|
||||
@ -562,10 +575,11 @@ bfd_make_section_anyway (abfd, name)
|
||||
|
||||
newsect->symbol_ptr_ptr = &newsect->symbol;
|
||||
|
||||
if (BFD_SEND (abfd, _new_section_hook, (abfd, newsect)) != true) {
|
||||
free (newsect);
|
||||
return NULL;
|
||||
}
|
||||
if (BFD_SEND (abfd, _new_section_hook, (abfd, newsect)) != true)
|
||||
{
|
||||
free (newsect);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*prev = newsect;
|
||||
return newsect;
|
||||
@ -586,34 +600,36 @@ DESCRIPTION
|
||||
*/
|
||||
|
||||
sec_ptr
|
||||
DEFUN(bfd_make_section,(abfd, name),
|
||||
bfd *abfd AND
|
||||
CONST char * name)
|
||||
bfd_make_section (abfd, name)
|
||||
bfd *abfd;
|
||||
CONST char *name;
|
||||
{
|
||||
asection * sect = abfd->sections;
|
||||
asection *sect = abfd->sections;
|
||||
|
||||
if (strcmp(name, BFD_ABS_SECTION_NAME) == 0)
|
||||
{
|
||||
return &bfd_abs_section;
|
||||
}
|
||||
if (strcmp(name, BFD_COM_SECTION_NAME) == 0)
|
||||
{
|
||||
return &bfd_com_section;
|
||||
}
|
||||
if (strcmp(name, BFD_UND_SECTION_NAME) == 0)
|
||||
{
|
||||
return &bfd_und_section;
|
||||
}
|
||||
if (strcmp (name, BFD_ABS_SECTION_NAME) == 0)
|
||||
{
|
||||
return &bfd_abs_section;
|
||||
}
|
||||
if (strcmp (name, BFD_COM_SECTION_NAME) == 0)
|
||||
{
|
||||
return &bfd_com_section;
|
||||
}
|
||||
if (strcmp (name, BFD_UND_SECTION_NAME) == 0)
|
||||
{
|
||||
return &bfd_und_section;
|
||||
}
|
||||
|
||||
if (strcmp(name, BFD_IND_SECTION_NAME) == 0)
|
||||
{
|
||||
return &bfd_ind_section;
|
||||
}
|
||||
if (strcmp (name, BFD_IND_SECTION_NAME) == 0)
|
||||
{
|
||||
return &bfd_ind_section;
|
||||
}
|
||||
|
||||
while (sect) {
|
||||
if (!strcmp(sect->name, name)) return NULL;
|
||||
sect = sect->next;
|
||||
}
|
||||
while (sect)
|
||||
{
|
||||
if (!strcmp (sect->name, name))
|
||||
return NULL;
|
||||
sect = sect->next;
|
||||
}
|
||||
|
||||
/* The name is not already used; go ahead and make a new section. */
|
||||
return bfd_make_section_anyway (abfd, name);
|
||||
@ -641,10 +657,10 @@ DESCRIPTION
|
||||
|
||||
/*ARGSUSED*/
|
||||
boolean
|
||||
DEFUN(bfd_set_section_flags,(abfd, section, flags),
|
||||
bfd *abfd AND
|
||||
sec_ptr section AND
|
||||
flagword flags)
|
||||
bfd_set_section_flags (abfd, section, flags)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
flagword flags;
|
||||
{
|
||||
#if 0
|
||||
/* If you try to copy a text section from an input file (where it
|
||||
@ -652,10 +668,11 @@ DEFUN(bfd_set_section_flags,(abfd, section, flags),
|
||||
the bfd_applicable_section_flags (abfd) doesn't have the SEC_CODE
|
||||
set - which it doesn't, at least not for a.out. FIXME */
|
||||
|
||||
if ((flags & bfd_applicable_section_flags (abfd)) != flags) {
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
}
|
||||
if ((flags & bfd_applicable_section_flags (abfd)) != flags)
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
section->flags = flags;
|
||||
@ -677,7 +694,7 @@ SYNOPSIS
|
||||
DESCRIPTION
|
||||
Call the provided function @var{func} for each section
|
||||
attached to the BFD @var{abfd}, passing @var{obj} as an
|
||||
argument. The function will be called as if by
|
||||
argument. The function will be called as if by
|
||||
|
||||
| func(abfd, the_section, obj);
|
||||
|
||||
@ -693,19 +710,19 @@ DESCRIPTION
|
||||
|
||||
/*VARARGS2*/
|
||||
void
|
||||
DEFUN(bfd_map_over_sections,(abfd, operation, user_storage),
|
||||
bfd *abfd AND
|
||||
void (*operation) PARAMS ((bfd *abfd, asection *sect, PTR obj)) AND
|
||||
PTR user_storage)
|
||||
bfd_map_over_sections (abfd, operation, user_storage)
|
||||
bfd *abfd;
|
||||
void (*operation) PARAMS ((bfd * abfd, asection * sect, PTR obj));
|
||||
PTR user_storage;
|
||||
{
|
||||
asection *sect;
|
||||
int i = 0;
|
||||
|
||||
|
||||
for (sect = abfd->sections; sect != NULL; i++, sect = sect->next)
|
||||
(*operation) (abfd, sect, user_storage);
|
||||
|
||||
if (i != abfd->section_count) /* Debugging */
|
||||
abort();
|
||||
if (i != abfd->section_count) /* Debugging */
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
||||
@ -718,7 +735,7 @@ SYNOPSIS
|
||||
|
||||
DESCRIPTION
|
||||
Set @var{sec} to the size @var{val}. If the operation is
|
||||
ok, then <<true>> is returned, else <<false>>.
|
||||
ok, then <<true>> is returned, else <<false>>.
|
||||
|
||||
Possible error returns:
|
||||
o <<bfd_error_invalid_operation>> -
|
||||
@ -727,22 +744,23 @@ DESCRIPTION
|
||||
*/
|
||||
|
||||
boolean
|
||||
DEFUN(bfd_set_section_size,(abfd, ptr, val),
|
||||
bfd *abfd AND
|
||||
sec_ptr ptr AND
|
||||
bfd_size_type val)
|
||||
bfd_set_section_size (abfd, ptr, val)
|
||||
bfd *abfd;
|
||||
sec_ptr ptr;
|
||||
bfd_size_type val;
|
||||
{
|
||||
/* Once you've started writing to any section you cannot create or change
|
||||
the size of any others. */
|
||||
|
||||
if (abfd->output_has_begun) {
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
}
|
||||
if (abfd->output_has_begun)
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
}
|
||||
|
||||
ptr->_cooked_size = val;
|
||||
ptr->_raw_size = val;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -752,7 +770,7 @@ FUNCTION
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_set_section_contents
|
||||
(bfd *abfd,
|
||||
(bfd *abfd,
|
||||
asection *section,
|
||||
PTR data,
|
||||
file_ptr offset,
|
||||
@ -763,7 +781,7 @@ DESCRIPTION
|
||||
Sets the contents of the section @var{section} in BFD
|
||||
@var{abfd} to the data starting in memory at @var{data}. The
|
||||
data is written to the output section starting at offset
|
||||
@var{offset} for @var{count} bytes.
|
||||
@var{offset} for @var{count} bytes.
|
||||
|
||||
|
||||
|
||||
@ -786,20 +804,20 @@ DESCRIPTION
|
||||
: bfd_get_section_size_before_reloc (sec))
|
||||
|
||||
boolean
|
||||
DEFUN(bfd_set_section_contents,(abfd, section, location, offset, count),
|
||||
bfd *abfd AND
|
||||
sec_ptr section AND
|
||||
PTR location AND
|
||||
file_ptr offset AND
|
||||
bfd_size_type count)
|
||||
bfd_set_section_contents (abfd, section, location, offset, count)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
PTR location;
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
{
|
||||
bfd_size_type sz;
|
||||
|
||||
if (!bfd_get_section_flags(abfd, section) & SEC_HAS_CONTENTS)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_contents);
|
||||
return(false);
|
||||
}
|
||||
if (!bfd_get_section_flags (abfd, section) & SEC_HAS_CONTENTS)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_contents);
|
||||
return (false);
|
||||
}
|
||||
|
||||
if (offset < 0)
|
||||
{
|
||||
@ -815,28 +833,28 @@ DEFUN(bfd_set_section_contents,(abfd, section, location, offset, count),
|
||||
|
||||
switch (abfd->direction)
|
||||
{
|
||||
case read_direction:
|
||||
case no_direction:
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
case read_direction:
|
||||
case no_direction:
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
|
||||
case write_direction:
|
||||
break;
|
||||
case write_direction:
|
||||
break;
|
||||
|
||||
case both_direction:
|
||||
/* File is opened for update. `output_has_begun' some time ago when
|
||||
case both_direction:
|
||||
/* File is opened for update. `output_has_begun' some time ago when
|
||||
the file was created. Do not recompute sections sizes or alignments
|
||||
in _bfd_set_section_content. */
|
||||
abfd->output_has_begun = true;
|
||||
break;
|
||||
abfd->output_has_begun = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (BFD_SEND (abfd, _bfd_set_section_contents,
|
||||
(abfd, section, location, offset, count)))
|
||||
{
|
||||
abfd->output_has_begun = true;
|
||||
return true;
|
||||
}
|
||||
(abfd, section, location, offset, count)))
|
||||
{
|
||||
abfd->output_has_begun = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -846,7 +864,7 @@ FUNCTION
|
||||
bfd_get_section_contents
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_get_section_contents
|
||||
boolean bfd_get_section_contents
|
||||
(bfd *abfd, asection *section, PTR location,
|
||||
file_ptr offset, bfd_size_type count);
|
||||
|
||||
@ -866,18 +884,18 @@ DESCRIPTION
|
||||
|
||||
*/
|
||||
boolean
|
||||
DEFUN(bfd_get_section_contents,(abfd, section, location, offset, count),
|
||||
bfd *abfd AND
|
||||
sec_ptr section AND
|
||||
PTR location AND
|
||||
file_ptr offset AND
|
||||
bfd_size_type count)
|
||||
bfd_get_section_contents (abfd, section, location, offset, count)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
PTR location;
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
{
|
||||
bfd_size_type sz;
|
||||
|
||||
if (section->flags & SEC_CONSTRUCTOR)
|
||||
if (section->flags & SEC_CONSTRUCTOR)
|
||||
{
|
||||
memset(location, 0, (unsigned)count);
|
||||
memset (location, 0, (unsigned) count);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -899,7 +917,13 @@ DEFUN(bfd_get_section_contents,(abfd, section, location, offset, count),
|
||||
|
||||
if ((section->flags & SEC_HAS_CONTENTS) == 0)
|
||||
{
|
||||
memset(location, 0, (unsigned)count);
|
||||
memset (location, 0, (unsigned) count);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((section->flags & SEC_IN_MEMORY) != 0)
|
||||
{
|
||||
memcpy (location, section->contents + offset, count);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
146
bfd/srec.c
146
bfd/srec.c
@ -127,7 +127,7 @@ static char hex_value[256];
|
||||
/* Initialize by filling in the hex conversion array. */
|
||||
|
||||
static void
|
||||
DEFUN_VOID (srec_init)
|
||||
srec_init ()
|
||||
{
|
||||
unsigned int i;
|
||||
static boolean inited = false;
|
||||
@ -243,12 +243,12 @@ fillup_symbols (abfd, buf, len, val)
|
||||
}
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
DEFUN (size_srec, (abfd, section, address, raw, length),
|
||||
bfd * abfd AND
|
||||
asection * section AND
|
||||
bfd_vma address AND
|
||||
bfd_byte * raw AND
|
||||
unsigned int length)
|
||||
size_srec (abfd, section, address, raw, length)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
bfd_vma address;
|
||||
bfd_byte *raw;
|
||||
unsigned int length;
|
||||
{
|
||||
if (address < low)
|
||||
low = address;
|
||||
@ -263,12 +263,12 @@ DEFUN (size_srec, (abfd, section, address, raw, length),
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
DEFUN (fillup, (abfd, section, address, raw, length),
|
||||
bfd * abfd AND
|
||||
asection * section AND
|
||||
bfd_vma address AND
|
||||
bfd_byte * raw AND
|
||||
unsigned int length)
|
||||
fillup (abfd, section, address, raw, length)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
bfd_vma address;
|
||||
bfd_byte *raw;
|
||||
unsigned int length;
|
||||
{
|
||||
unsigned int i;
|
||||
bfd_byte *dst =
|
||||
@ -285,7 +285,7 @@ DEFUN (fillup, (abfd, section, address, raw, length),
|
||||
/* Pass over an S-Record file, calling one of the above functions on each
|
||||
record. */
|
||||
|
||||
static int
|
||||
static int
|
||||
white (x)
|
||||
char x;
|
||||
{
|
||||
@ -305,8 +305,8 @@ skipwhite (src, abfd)
|
||||
}
|
||||
|
||||
static boolean
|
||||
DEFUN (srec_mkobject, (abfd),
|
||||
bfd * abfd)
|
||||
srec_mkobject (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (abfd->tdata.srec_data == 0)
|
||||
{
|
||||
@ -324,7 +324,7 @@ DEFUN (srec_mkobject, (abfd),
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
pass_over (abfd, func, symbolfunc, section)
|
||||
bfd *abfd;
|
||||
void (*func) ();
|
||||
@ -480,8 +480,8 @@ object_p (abfd)
|
||||
}
|
||||
|
||||
static bfd_target *
|
||||
DEFUN (srec_object_p, (abfd),
|
||||
bfd * abfd)
|
||||
srec_object_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
char b[4];
|
||||
|
||||
@ -501,8 +501,8 @@ DEFUN (srec_object_p, (abfd),
|
||||
|
||||
|
||||
static bfd_target *
|
||||
DEFUN (symbolsrec_object_p, (abfd),
|
||||
bfd * abfd)
|
||||
symbolsrec_object_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
char b[4];
|
||||
|
||||
@ -519,12 +519,12 @@ DEFUN (symbolsrec_object_p, (abfd),
|
||||
|
||||
|
||||
static boolean
|
||||
DEFUN (srec_get_section_contents, (abfd, section, location, offset, count),
|
||||
bfd * abfd AND
|
||||
asection * section AND
|
||||
PTR location AND
|
||||
file_ptr offset AND
|
||||
bfd_size_type count)
|
||||
srec_get_section_contents (abfd, section, location, offset, count)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
PTR location;
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
{
|
||||
if (section->used_by_bfd == (PTR) NULL)
|
||||
{
|
||||
@ -538,18 +538,18 @@ DEFUN (srec_get_section_contents, (abfd, section, location, offset, count),
|
||||
pass_over (abfd, fillup, fillup_symbols, section);
|
||||
}
|
||||
memcpy ((PTR) location,
|
||||
(PTR) ((char *) (section->used_by_bfd) + offset),
|
||||
count);
|
||||
(PTR) ((char *) (section->used_by_bfd) + offset),
|
||||
count);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
boolean
|
||||
DEFUN (srec_set_arch_mach, (abfd, arch, machine),
|
||||
bfd * abfd AND
|
||||
enum bfd_architecture arch AND
|
||||
unsigned long machine)
|
||||
srec_set_arch_mach (abfd, arch, machine)
|
||||
bfd *abfd;
|
||||
enum bfd_architecture arch;
|
||||
unsigned long machine;
|
||||
{
|
||||
return bfd_default_set_arch_mach (abfd, arch, machine);
|
||||
}
|
||||
@ -559,16 +559,16 @@ DEFUN (srec_set_arch_mach, (abfd, arch, machine),
|
||||
also remember */
|
||||
|
||||
static boolean
|
||||
DEFUN (srec_set_section_contents, (abfd, section, location, offset, bytes_to_do),
|
||||
bfd * abfd AND
|
||||
sec_ptr section AND
|
||||
PTR location AND
|
||||
file_ptr offset AND
|
||||
bfd_size_type bytes_to_do)
|
||||
srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
PTR location;
|
||||
file_ptr offset;
|
||||
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));
|
||||
bfd_alloc (abfd, sizeof (srec_data_list_type));
|
||||
|
||||
if (!entry)
|
||||
{
|
||||
@ -615,13 +615,13 @@ DEFUN (srec_set_section_contents, (abfd, section, location, offset, bytes_to_do)
|
||||
here
|
||||
*/
|
||||
static
|
||||
void
|
||||
DEFUN (srec_write_record, (abfd, type, address, data, end),
|
||||
bfd * abfd AND
|
||||
char type AND
|
||||
bfd_vma address AND
|
||||
CONST unsigned char *data AND
|
||||
CONST unsigned char *end)
|
||||
void
|
||||
srec_write_record (abfd, type, address, data, end)
|
||||
bfd *abfd;
|
||||
char type;
|
||||
bfd_vma address;
|
||||
CONST unsigned char *data;
|
||||
CONST unsigned char *end;
|
||||
|
||||
{
|
||||
char buffer[MAXCHUNK];
|
||||
@ -679,8 +679,8 @@ DEFUN (srec_write_record, (abfd, type, address, data, end),
|
||||
|
||||
|
||||
static void
|
||||
DEFUN (srec_write_header, (abfd),
|
||||
bfd * abfd)
|
||||
srec_write_header (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
unsigned char buffer[MAXCHUNK];
|
||||
unsigned char *dst = buffer;
|
||||
@ -695,10 +695,10 @@ DEFUN (srec_write_header, (abfd),
|
||||
}
|
||||
|
||||
static void
|
||||
DEFUN (srec_write_section, (abfd, tdata, list),
|
||||
bfd * abfd AND
|
||||
tdata_type * tdata AND
|
||||
srec_data_list_type * list)
|
||||
srec_write_section (abfd, tdata, list)
|
||||
bfd *abfd;
|
||||
tdata_type *tdata;
|
||||
srec_data_list_type *list;
|
||||
{
|
||||
unsigned int bytes_written = 0;
|
||||
unsigned char *location = list->data;
|
||||
@ -729,9 +729,9 @@ DEFUN (srec_write_section, (abfd, tdata, list),
|
||||
}
|
||||
|
||||
static void
|
||||
DEFUN (srec_write_terminator, (abfd, tdata),
|
||||
bfd * abfd AND
|
||||
tdata_type * tdata)
|
||||
srec_write_terminator (abfd, tdata)
|
||||
bfd *abfd;
|
||||
tdata_type *tdata;
|
||||
{
|
||||
unsigned char buffer[2];
|
||||
|
||||
@ -842,16 +842,16 @@ symbolsrec_write_object_contents (abfd)
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
DEFUN (srec_sizeof_headers, (abfd, exec),
|
||||
bfd * abfd AND
|
||||
boolean exec)
|
||||
srec_sizeof_headers (abfd, exec)
|
||||
bfd *abfd;
|
||||
boolean exec;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static asymbol *
|
||||
DEFUN (srec_make_empty_symbol, (abfd),
|
||||
bfd * abfd)
|
||||
srec_make_empty_symbol (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol));
|
||||
if (new)
|
||||
@ -869,9 +869,9 @@ srec_get_symtab_upper_bound (abfd)
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
DEFUN (srec_get_symtab, (abfd, alocation),
|
||||
bfd * abfd AND
|
||||
asymbol ** alocation)
|
||||
srec_get_symtab (abfd, alocation)
|
||||
bfd *abfd;
|
||||
asymbol **alocation;
|
||||
{
|
||||
int lim = abfd->symcount;
|
||||
int i;
|
||||
@ -885,21 +885,21 @@ DEFUN (srec_get_symtab, (abfd, alocation),
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
DEFUN (srec_get_symbol_info, (ignore_abfd, symbol, ret),
|
||||
bfd * ignore_abfd AND
|
||||
asymbol * symbol AND
|
||||
symbol_info * ret)
|
||||
srec_get_symbol_info (ignore_abfd, symbol, ret)
|
||||
bfd *ignore_abfd;
|
||||
asymbol *symbol;
|
||||
symbol_info *ret;
|
||||
{
|
||||
bfd_symbol_info (symbol, ret);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
DEFUN (srec_print_symbol, (ignore_abfd, afile, symbol, how),
|
||||
bfd * ignore_abfd AND
|
||||
PTR afile AND
|
||||
asymbol * symbol AND
|
||||
bfd_print_symbol_type how)
|
||||
srec_print_symbol (ignore_abfd, afile, symbol, how)
|
||||
bfd *ignore_abfd;
|
||||
PTR afile;
|
||||
asymbol *symbol;
|
||||
bfd_print_symbol_type how;
|
||||
{
|
||||
FILE *file = (FILE *) afile;
|
||||
switch (how)
|
||||
|
111
bfd/syms.c
111
bfd/syms.c
@ -44,7 +44,7 @@ SECTION
|
||||
output symbols, the application provides BFD with a table of
|
||||
pointers to pointers to <<asymbol>>s. This allows applications
|
||||
like the linker to output a symbol as it was read, since the ``behind
|
||||
the scenes'' information will be still available.
|
||||
the scenes'' information will be still available.
|
||||
@menu
|
||||
@* Reading Symbols::
|
||||
@* Writing Symbols::
|
||||
@ -65,17 +65,17 @@ SUBSECTION
|
||||
| asymbol **symbol_table;
|
||||
| unsigned int number_of_symbols;
|
||||
| unsigned int i;
|
||||
|
|
||||
|
|
||||
| storage_needed = get_symtab_upper_bound (abfd);
|
||||
|
|
||||
|
|
||||
| if (storage_needed == 0) {
|
||||
| return ;
|
||||
| }
|
||||
| symbol_table = (asymbol **) bfd_xmalloc (storage_needed);
|
||||
| symbol_table = (asymbol **) xmalloc (storage_needed);
|
||||
| ...
|
||||
| number_of_symbols =
|
||||
| bfd_canonicalize_symtab (abfd, symbol_table);
|
||||
|
|
||||
| number_of_symbols =
|
||||
| bfd_canonicalize_symtab (abfd, symbol_table);
|
||||
|
|
||||
| for (i = 0; i < number_of_symbols; i++) {
|
||||
| process_symbol (symbol_table[i]);
|
||||
| }
|
||||
@ -100,12 +100,12 @@ SUBSECTION
|
||||
example showing the creation of a symbol table with only one element:
|
||||
|
||||
| #include "bfd.h"
|
||||
| main()
|
||||
| main()
|
||||
| {
|
||||
| bfd *abfd;
|
||||
| asymbol *ptrs[2];
|
||||
| asymbol *new;
|
||||
|
|
||||
|
|
||||
| abfd = bfd_openw("foo","a.out-sunos-big");
|
||||
| bfd_set_format(abfd, bfd_object);
|
||||
| new = bfd_make_empty_symbol(abfd);
|
||||
@ -113,15 +113,15 @@ SUBSECTION
|
||||
| new->section = bfd_make_section_old_way(abfd, ".text");
|
||||
| new->flags = BSF_GLOBAL;
|
||||
| new->value = 0x12345;
|
||||
|
|
||||
|
|
||||
| ptrs[0] = new;
|
||||
| ptrs[1] = (asymbol *)0;
|
||||
|
|
||||
|
|
||||
| bfd_set_symtab(abfd, ptrs, 1);
|
||||
| bfd_close(abfd);
|
||||
| }
|
||||
|
|
||||
| ./makesym
|
||||
|
|
||||
| ./makesym
|
||||
| nm foo
|
||||
| 00012345 A dummy_symbol
|
||||
|
||||
@ -129,7 +129,7 @@ SUBSECTION
|
||||
instance, the <<a.out>> object format does not allow an
|
||||
arbitary number of sections. A symbol pointing to a section
|
||||
which is not one of <<.text>>, <<.data>> or <<.bss>> cannot
|
||||
be described.
|
||||
be described.
|
||||
|
||||
*/
|
||||
|
||||
@ -153,7 +153,7 @@ SUBSECTION
|
||||
CODE_FRAGMENT
|
||||
|
||||
.
|
||||
.typedef struct symbol_cache_entry
|
||||
.typedef struct symbol_cache_entry
|
||||
.{
|
||||
. {* A pointer to the BFD which owns the symbol. This information
|
||||
. is necessary so that a back end can work out what additional
|
||||
@ -254,7 +254,7 @@ CODE_FRAGMENT
|
||||
.
|
||||
. flagword flags;
|
||||
.
|
||||
. {* A pointer to the section to which this symbol is
|
||||
. {* A pointer to the section to which this symbol is
|
||||
. relative. This will always be non NULL, there are special
|
||||
. sections for undefined and absolute symbols *}
|
||||
. struct sec *section;
|
||||
@ -271,7 +271,7 @@ CODE_FRAGMENT
|
||||
|
||||
#include "libbfd.h"
|
||||
#include "aout/stab_gnu.h"
|
||||
|
||||
|
||||
/*
|
||||
DOCDD
|
||||
INODE
|
||||
@ -302,7 +302,7 @@ FUNCTION
|
||||
DESCRIPTION
|
||||
Read the symbols from the BFD @var{abfd}, and fills in
|
||||
the vector @var{location} with pointers to the symbols and
|
||||
a trailing NULL.
|
||||
a trailing NULL.
|
||||
Return the actual number of symbol pointers, not
|
||||
including the NULL.
|
||||
|
||||
@ -333,10 +333,11 @@ bfd_set_symtab (abfd, location, symcount)
|
||||
asymbol **location;
|
||||
unsigned int symcount;
|
||||
{
|
||||
if ((abfd->format != bfd_object) || (bfd_read_p (abfd))) {
|
||||
bfd_error = invalid_operation;
|
||||
return false;
|
||||
}
|
||||
if ((abfd->format != bfd_object) || (bfd_read_p (abfd)))
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
}
|
||||
|
||||
bfd_get_outsymbols (abfd) = location;
|
||||
bfd_get_symcount (abfd) = symcount;
|
||||
@ -355,32 +356,32 @@ DESCRIPTION
|
||||
stream @var{file}.
|
||||
*/
|
||||
void
|
||||
DEFUN(bfd_print_symbol_vandf,(arg, symbol),
|
||||
PTR arg AND
|
||||
asymbol *symbol)
|
||||
bfd_print_symbol_vandf (arg, symbol)
|
||||
PTR arg;
|
||||
asymbol *symbol;
|
||||
{
|
||||
FILE *file = (FILE *) arg;
|
||||
flagword type = symbol->flags;
|
||||
if (symbol->section != (asection *)NULL)
|
||||
{
|
||||
fprintf_vma(file, symbol->value+symbol->section->vma);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf_vma(file, symbol->value);
|
||||
}
|
||||
if (symbol->section != (asection *) NULL)
|
||||
{
|
||||
fprintf_vma (file, symbol->value + symbol->section->vma);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf_vma (file, symbol->value);
|
||||
}
|
||||
|
||||
/* This presumes that a symbol can not be both BSF_DEBUGGING and
|
||||
BSF_DYNAMIC. */
|
||||
fprintf(file," %c%c%c%c%c%c%c",
|
||||
(type & BSF_LOCAL) ? 'l':' ',
|
||||
(type & BSF_GLOBAL) ? 'g' : ' ',
|
||||
(type & BSF_WEAK) ? 'w' : ' ',
|
||||
(type & BSF_CONSTRUCTOR) ? 'C' : ' ',
|
||||
(type & BSF_WARNING) ? 'W' : ' ',
|
||||
(type & BSF_INDIRECT) ? 'I' : ' ',
|
||||
(type & BSF_DEBUGGING) ? 'd'
|
||||
: (type & BSF_DYNAMIC) ? 'D' : ' ');
|
||||
fprintf (file, " %c%c%c%c%c%c%c",
|
||||
(type & BSF_LOCAL) ? 'l' : ' ',
|
||||
(type & BSF_GLOBAL) ? 'g' : ' ',
|
||||
(type & BSF_WEAK) ? 'w' : ' ',
|
||||
(type & BSF_CONSTRUCTOR) ? 'C' : ' ',
|
||||
(type & BSF_WARNING) ? 'W' : ' ',
|
||||
(type & BSF_INDIRECT) ? 'I' : ' ',
|
||||
(type & BSF_DEBUGGING) ? 'd'
|
||||
: (type & BSF_DYNAMIC) ? 'D' : ' ');
|
||||
}
|
||||
|
||||
|
||||
@ -423,7 +424,8 @@ struct section_to_type
|
||||
/* Map section names to POSIX/BSD single-character symbol types.
|
||||
This table is probably incomplete. It is sorted for convenience of
|
||||
adding entries. Since it is so short, a linear search is used. */
|
||||
static CONST struct section_to_type stt[] = {
|
||||
static CONST struct section_to_type stt[] =
|
||||
{
|
||||
{"*DEBUG*", 'N'},
|
||||
{".bss", 'b'},
|
||||
{".data", 'd'},
|
||||
@ -468,8 +470,8 @@ SYNOPSIS
|
||||
int bfd_decode_symclass(asymbol *symbol);
|
||||
*/
|
||||
int
|
||||
DEFUN(bfd_decode_symclass,(symbol),
|
||||
asymbol *symbol)
|
||||
bfd_decode_symclass (symbol)
|
||||
asymbol *symbol;
|
||||
{
|
||||
char c;
|
||||
|
||||
@ -479,7 +481,7 @@ asymbol *symbol)
|
||||
return 'U';
|
||||
if (symbol->section == &bfd_ind_section)
|
||||
return 'I';
|
||||
if (!(symbol->flags & (BSF_GLOBAL|BSF_LOCAL)))
|
||||
if (!(symbol->flags & (BSF_GLOBAL | BSF_LOCAL)))
|
||||
return '?';
|
||||
|
||||
if (symbol->section == &bfd_abs_section)
|
||||
@ -493,8 +495,8 @@ asymbol *symbol)
|
||||
return c;
|
||||
|
||||
/* We don't have to handle these cases just yet, but we will soon:
|
||||
N_SETV: 'v';
|
||||
N_SETA: 'l';
|
||||
N_SETV: 'v';
|
||||
N_SETA: 'l';
|
||||
N_SETT: 'x';
|
||||
N_SETD: 'z';
|
||||
N_SETB: 's';
|
||||
@ -516,21 +518,20 @@ SYNOPSIS
|
||||
*/
|
||||
|
||||
void
|
||||
DEFUN(bfd_symbol_info,(symbol, ret),
|
||||
asymbol *symbol AND
|
||||
symbol_info *ret)
|
||||
bfd_symbol_info (symbol, ret)
|
||||
asymbol *symbol;
|
||||
symbol_info *ret;
|
||||
{
|
||||
ret->type = bfd_decode_symclass (symbol);
|
||||
if (ret->type != 'U')
|
||||
ret->value = symbol->value+symbol->section->vma;
|
||||
ret->value = symbol->value + symbol->section->vma;
|
||||
else
|
||||
ret->value = 0;
|
||||
ret->name = symbol->name;
|
||||
}
|
||||
|
||||
void
|
||||
bfd_symbol_is_absolute()
|
||||
bfd_symbol_is_absolute ()
|
||||
{
|
||||
abort();
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
@ -621,9 +621,9 @@ DESCRIPTION
|
||||
*/
|
||||
|
||||
bfd_target *
|
||||
DEFUN(bfd_find_target,(target_name, abfd),
|
||||
CONST char *target_name AND
|
||||
bfd *abfd)
|
||||
bfd_find_target (target_name, abfd)
|
||||
CONST char *target_name;
|
||||
bfd *abfd;
|
||||
{
|
||||
bfd_target **target;
|
||||
extern char *getenv ();
|
||||
@ -663,7 +663,7 @@ DESCRIPTION
|
||||
*/
|
||||
|
||||
CONST char **
|
||||
DEFUN_VOID(bfd_target_list)
|
||||
bfd_target_list ()
|
||||
{
|
||||
int vec_length= 0;
|
||||
#ifdef NATIVE_HPPAHPUX_COMPILER
|
||||
|
Loading…
Reference in New Issue
Block a user