aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog12
-rw-r--r--bfd/aix386-core.c34
-rw-r--r--bfd/aout-encap.c14
-rw-r--r--bfd/aout-target.h33
-rw-r--r--bfd/aoutf1.h539
-rw-r--r--bfd/bfd-in2.h50
-rw-r--r--bfd/coff-a29k.c13
-rw-r--r--bfd/coffcode.h132
-rw-r--r--bfd/core.c6
-rw-r--r--bfd/cpu-a29k.c3
-rw-r--r--bfd/ctor.c10
-rw-r--r--bfd/ieee.c408
-rw-r--r--bfd/libbfd.h3
-rw-r--r--bfd/oasys.c1719
-rw-r--r--bfd/section.c306
-rw-r--r--bfd/srec.c146
-rw-r--r--bfd/syms.c111
-rw-r--r--bfd/targets.c8
18 files changed, 1844 insertions, 1703 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 262a5d0..f5d01d7 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/aix386-core.c b/bfd/aix386-core.c
index ac0bba6..5d031b0 100644
--- a/bfd/aix386-core.c
+++ b/bfd/aix386-core.c
@@ -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 =
{
diff --git a/bfd/aout-encap.c b/bfd/aout-encap.c
index 722dae6..20c44bf 100644
--- a/bfd/aout-encap.c
+++ b/bfd/aout-encap.c
@@ -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;
diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index 379cf69..906f5f1 100644
--- a/bfd/aout-target.h
+++ b/bfd/aout-target.h
@@ -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 */
diff --git a/bfd/aoutf1.h b/bfd/aoutf1.h
index b5dcecf..dfac4eb 100644
--- a/bfd/aoutf1.h
+++ b/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;
-
- default:
- arch = bfd_arch_obscure;
- machine = 0;
- break;
- }
- bfd_set_arch_mach(abfd, arch, machine);
+ 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;
+
+ 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;
- default:
- case 68020:
- N_SET_MACHTYPE(*execp, M_68020);
+ 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);
}
- 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 */
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 47f7f8e..997b71b 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -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;
diff --git a/bfd/coff-a29k.c b/bfd/coff-a29k.c
index 7161d40..9084a40 100644
--- a/bfd/coff-a29k.c
+++ b/bfd/coff-a29k.c
@@ -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;
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 8f4e25e..b2e50ce 100644
--- a/bfd/coffcode.h
+++ b/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;
diff --git a/bfd/core.c b/bfd/core.c
index c143776..5d88a49 100644
--- a/bfd/core.c
+++ b/bfd/core.c
@@ -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);
diff --git a/bfd/cpu-a29k.c b/bfd/cpu-a29k.c
index 1562c66..fa7f478 100644
--- a/bfd/cpu-a29k.c
+++ b/bfd/cpu-a29k.c
@@ -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);
}
diff --git a/bfd/ctor.c b/bfd/ctor.c
index 5c965a0..8a6e4e4 100644
--- a/bfd/ctor.c
+++ b/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);
diff --git a/bfd/ieee.c b/bfd/ieee.c
index 005581b..8683d7f 100644
--- a/bfd/ieee.c
+++ b/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;
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index c8b0532..59ccdf7 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -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
diff --git a/bfd/oasys.c b/bfd/oasys.c
index adad8bf..e392d17 100644
--- a/bfd/oasys.c
+++ b/bfd/oasys.c
@@ -30,34 +30,34 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Define offsetof for those systems which lack it */
#ifndef offsetof
-#define offsetof(type, identifier) (size_t) &(((type *) 0)->identifier)
+#define offsetof(type, identifier) (size_t) &(((type *) 0)->identifier)
#endif
static boolean oasys_write_sections PARAMS ((bfd *));
/* Read in all the section data and relocation stuff too */
-PROTO(static boolean,oasys_slurp_section_data,(bfd *CONST abfd));
+PROTO (static boolean, oasys_slurp_section_data, (bfd * CONST abfd));
-static void
-DEFUN(oasys_read_record,(abfd, record),
- bfd *CONST abfd AND
- oasys_record_union_type *record)
+static void
+oasys_read_record (abfd, record)
+ bfd *CONST abfd;
+ oasys_record_union_type *record;
{
- bfd_read((PTR)record, 1, sizeof(record->header), abfd);
+ bfd_read ((PTR) record, 1, sizeof (record->header), abfd);
if ((size_t) record->header.length <= (size_t) sizeof (record->header))
return;
- bfd_read((PTR)(((char *)record )+ sizeof(record->header)),
- 1, record->header.length - sizeof(record->header),
- abfd);
+ bfd_read ((PTR) (((char *) record) + sizeof (record->header)),
+ 1, record->header.length - sizeof (record->header),
+ abfd);
}
static size_t
-DEFUN(oasys_string_length,(record),
- oasys_record_union_type *record)
+oasys_string_length (record)
+ oasys_record_union_type *record;
{
-return record->header.length
- - ((char *)record->symbol.name - (char *)record);
+ return record->header.length
+ - ((char *) record->symbol.name - (char *) record);
}
/*****************************************************************************/
@@ -69,7 +69,7 @@ till we get to the first section record.
We'll sort the symbolss into two lists, defined and undefined. The
undefined symbols will be placed into the table according to their
-refno.
+refno.
We do this by placing all undefined symbols at the front of the table
moving in, and the defined symbols at the end of the table moving back.
@@ -77,179 +77,188 @@ moving in, and the defined symbols at the end of the table moving back.
*/
static boolean
-DEFUN(oasys_slurp_symbol_table,(abfd),
- bfd * CONST abfd)
+oasys_slurp_symbol_table (abfd)
+ bfd *CONST abfd;
{
oasys_record_union_type record;
- oasys_data_type *data = OASYS_DATA(abfd);
+ oasys_data_type *data = OASYS_DATA (abfd);
boolean loop = true;
asymbol *dest_defined;
asymbol *dest;
char *string_ptr;
- if (data->symbols != (asymbol *)NULL) {
- return true;
- }
+ if (data->symbols != (asymbol *) NULL)
+ {
+ return true;
+ }
/* Buy enough memory for all the symbols and all the names */
- data->symbols =
- (asymbol *)bfd_alloc(abfd, sizeof(asymbol) * abfd->symcount);
+ data->symbols =
+ (asymbol *) bfd_alloc (abfd, sizeof (asymbol) * abfd->symcount);
#ifdef UNDERSCORE_HACK
/* buy 1 more char for each symbol to keep the underscore in*/
- data->strings = bfd_alloc(abfd, data->symbol_string_length +
- abfd->symcount);
+ data->strings = bfd_alloc (abfd, data->symbol_string_length +
+ abfd->symcount);
#else
- data->strings = bfd_alloc(abfd, data->symbol_string_length);
+ data->strings = bfd_alloc (abfd, data->symbol_string_length);
#endif
if (!data->symbols || !data->strings)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
- dest_defined = data->symbols + abfd->symcount -1;
+ dest_defined = data->symbols + abfd->symcount - 1;
string_ptr = data->strings;
- bfd_seek(abfd, (file_ptr)0, SEEK_SET);
- while (loop) {
+ bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
+ while (loop)
+ {
- oasys_read_record(abfd, &record);
- switch (record.header.type) {
- case oasys_record_is_header_enum:
- break;
- case oasys_record_is_local_enum:
- case oasys_record_is_symbol_enum:
+ oasys_read_record (abfd, &record);
+ switch (record.header.type)
{
- int flag = record.header.type == (int)oasys_record_is_local_enum ?
+ case oasys_record_is_header_enum:
+ break;
+ case oasys_record_is_local_enum:
+ case oasys_record_is_symbol_enum:
+ {
+ int flag = record.header.type == (int) oasys_record_is_local_enum ?
(BSF_LOCAL) : (BSF_GLOBAL | BSF_EXPORT);
- size_t length = oasys_string_length(&record);
- switch (record.symbol.relb & RELOCATION_TYPE_BITS) {
- case RELOCATION_TYPE_ABS:
- dest = dest_defined--;
- dest->section = &bfd_abs_section;
- dest->flags = 0;
-
- break;
- case RELOCATION_TYPE_REL:
- dest = dest_defined--;
- dest->section =
- OASYS_DATA(abfd)->sections[record.symbol.relb &
- RELOCATION_SECT_BITS];
- if (record.header.type == (int)oasys_record_is_local_enum)
- {
- dest->flags = BSF_LOCAL;
- if (dest->section ==(asection *)(~0)) {
- /* It seems that sometimes internal symbols are tied up, but
+ size_t length = oasys_string_length (&record);
+ switch (record.symbol.relb & RELOCATION_TYPE_BITS)
+ {
+ case RELOCATION_TYPE_ABS:
+ dest = dest_defined--;
+ dest->section = &bfd_abs_section;
+ dest->flags = 0;
+
+ break;
+ case RELOCATION_TYPE_REL:
+ dest = dest_defined--;
+ dest->section =
+ OASYS_DATA (abfd)->sections[record.symbol.relb &
+ RELOCATION_SECT_BITS];
+ if (record.header.type == (int) oasys_record_is_local_enum)
+ {
+ dest->flags = BSF_LOCAL;
+ if (dest->section == (asection *) (~0))
+ {
+ /* It seems that sometimes internal symbols are tied up, but
still get output, even though there is no
section */
- dest->section = 0;
+ dest->section = 0;
+ }
}
- }
- else {
+ else
+ {
- dest->flags = flag;
- }
- break;
- case RELOCATION_TYPE_UND:
- dest = data->symbols + bfd_h_get_16(abfd, record.symbol.refno);
- dest->section = &bfd_und_section;
- break;
- case RELOCATION_TYPE_COM:
- dest = dest_defined--;
+ dest->flags = flag;
+ }
+ break;
+ case RELOCATION_TYPE_UND:
+ dest = data->symbols + bfd_h_get_16 (abfd, record.symbol.refno);
+ dest->section = &bfd_und_section;
+ break;
+ case RELOCATION_TYPE_COM:
+ dest = dest_defined--;
+ dest->name = string_ptr;
+ dest->the_bfd = abfd;
+
+ dest->section = &bfd_com_section;
+
+ break;
+ default:
+ dest = dest_defined--;
+ BFD_ASSERT (0);
+ break;
+ }
dest->name = string_ptr;
dest->the_bfd = abfd;
-
- dest->section = &bfd_com_section;
-
- break;
- default:
- dest = dest_defined--;
- BFD_ASSERT(0);
- break;
- }
- dest->name = string_ptr;
- dest->the_bfd = abfd;
- dest->udata = (PTR)NULL;
- dest->value = bfd_h_get_32(abfd, record.symbol.value);
+ dest->udata = (PTR) NULL;
+ dest->value = bfd_h_get_32 (abfd, record.symbol.value);
#ifdef UNDERSCORE_HACK
- if (record.symbol.name[0] != '_') {
- string_ptr[0] = '_';
- string_ptr++;
- }
+ if (record.symbol.name[0] != '_')
+ {
+ string_ptr[0] = '_';
+ string_ptr++;
+ }
#endif
- memcpy(string_ptr, record.symbol.name, length);
+ memcpy (string_ptr, record.symbol.name, length);
- string_ptr[length] =0;
- string_ptr += length +1;
+ string_ptr[length] = 0;
+ string_ptr += length + 1;
+ }
+ break;
+ default:
+ loop = false;
}
- break;
- default:
- loop = false;
}
- }
return true;
}
static unsigned int
-DEFUN(oasys_get_symtab_upper_bound,(abfd),
- bfd *CONST abfd)
+oasys_get_symtab_upper_bound (abfd)
+ bfd *CONST abfd;
{
oasys_slurp_symbol_table (abfd);
- return (abfd->symcount+1) * (sizeof (oasys_symbol_type *));
+ return (abfd->symcount + 1) * (sizeof (oasys_symbol_type *));
}
-/*
+/*
*/
extern bfd_target oasys_vec;
unsigned int
-DEFUN(oasys_get_symtab,(abfd, location),
- bfd *abfd AND
- asymbol **location)
+oasys_get_symtab (abfd, location)
+ bfd *abfd;
+ asymbol **location;
{
- asymbol *symbase ;
- unsigned int counter ;
- if (oasys_slurp_symbol_table(abfd) == false) {
- return 0;
- }
- symbase = OASYS_DATA(abfd)->symbols;
- for (counter = 0; counter < abfd->symcount; counter++) {
- *(location++) = symbase++;
- }
+ asymbol *symbase;
+ unsigned int counter;
+ if (oasys_slurp_symbol_table (abfd) == false)
+ {
+ return 0;
+ }
+ symbase = OASYS_DATA (abfd)->symbols;
+ for (counter = 0; counter < abfd->symcount; counter++)
+ {
+ *(location++) = symbase++;
+ }
*location = 0;
return abfd->symcount;
}
/***********************************************************************
-* archive stuff
+* archive stuff
*/
static bfd_target *
-DEFUN(oasys_archive_p,(abfd),
- bfd *abfd)
+oasys_archive_p (abfd)
+ bfd *abfd;
{
oasys_archive_header_type header;
oasys_extarchive_header_type header_ext;
unsigned int i;
- file_ptr filepos;
+ file_ptr filepos;
- bfd_seek(abfd, (file_ptr) 0, false);
- bfd_read((PTR)&header_ext, 1, sizeof(header_ext), abfd);
+ bfd_seek (abfd, (file_ptr) 0, false);
+ bfd_read ((PTR) & header_ext, 1, sizeof (header_ext), abfd);
- header.version = bfd_h_get_32(abfd, header_ext.version);
- header.mod_count = bfd_h_get_32(abfd, header_ext.mod_count);
- header.mod_tbl_offset = bfd_h_get_32(abfd, header_ext.mod_tbl_offset);
- header.sym_tbl_size = bfd_h_get_32(abfd, header_ext.sym_tbl_size);
- header.sym_count = bfd_h_get_32(abfd, header_ext.sym_count);
- header.sym_tbl_offset = bfd_h_get_32(abfd, header_ext.sym_tbl_offset);
- header.xref_count = bfd_h_get_32(abfd, header_ext.xref_count);
- header.xref_lst_offset = bfd_h_get_32(abfd, header_ext.xref_lst_offset);
+ header.version = bfd_h_get_32 (abfd, header_ext.version);
+ header.mod_count = bfd_h_get_32 (abfd, header_ext.mod_count);
+ header.mod_tbl_offset = bfd_h_get_32 (abfd, header_ext.mod_tbl_offset);
+ header.sym_tbl_size = bfd_h_get_32 (abfd, header_ext.sym_tbl_size);
+ header.sym_count = bfd_h_get_32 (abfd, header_ext.sym_count);
+ header.sym_tbl_offset = bfd_h_get_32 (abfd, header_ext.sym_tbl_offset);
+ header.xref_count = bfd_h_get_32 (abfd, header_ext.xref_count);
+ header.xref_lst_offset = bfd_h_get_32 (abfd, header_ext.xref_lst_offset);
/*
There isn't a magic number in an Oasys archive, so the best we
@@ -257,480 +266,501 @@ DEFUN(oasys_archive_p,(abfd),
the header are too weird
*/
- if (header.version>10000 ||
- header.mod_count>10000 ||
- header.sym_count>100000 ||
- header.xref_count > 100000) return (bfd_target *)NULL;
+ if (header.version > 10000 ||
+ header.mod_count > 10000 ||
+ header.sym_count > 100000 ||
+ header.xref_count > 100000)
+ return (bfd_target *) NULL;
/*
That all worked, let's buy the space for the header and read in
the headers.
*/
- {
- oasys_ar_data_type *ar =
- (oasys_ar_data_type*) bfd_alloc(abfd, sizeof(oasys_ar_data_type));
+ {
+ oasys_ar_data_type *ar =
+ (oasys_ar_data_type *) bfd_alloc (abfd, sizeof (oasys_ar_data_type));
- oasys_module_info_type *module =
- (oasys_module_info_type*)
- bfd_alloc(abfd, sizeof(oasys_module_info_type) * header.mod_count);
- oasys_module_table_type record;
+ oasys_module_info_type *module =
+ (oasys_module_info_type *)
+ bfd_alloc (abfd, sizeof (oasys_module_info_type) * header.mod_count);
+ oasys_module_table_type record;
- if (!ar || !module)
- {
- bfd_error = no_memory;
- return NULL;
- }
+ if (!ar || !module)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
- abfd->tdata.oasys_ar_data = ar;
- ar->module = module;
- ar->module_count = header.mod_count;
+ abfd->tdata.oasys_ar_data = ar;
+ ar->module = module;
+ ar->module_count = header.mod_count;
- filepos = header.mod_tbl_offset;
- for (i = 0; i < header.mod_count; i++) {
- bfd_seek(abfd, filepos, SEEK_SET);
+ filepos = header.mod_tbl_offset;
+ for (i = 0; i < header.mod_count; i++)
+ {
+ bfd_seek (abfd, filepos, SEEK_SET);
/* There are two ways of specifying the archive header */
- if (0) {
- oasys_extmodule_table_type_a_type record_ext;
- bfd_read((PTR)&record_ext, 1, sizeof(record_ext), abfd);
-
- record.mod_size = bfd_h_get_32(abfd, record_ext.mod_size);
- record.file_offset = bfd_h_get_32(abfd, record_ext.file_offset);
+ if (0)
+ {
+ oasys_extmodule_table_type_a_type record_ext;
+ bfd_read ((PTR) & record_ext, 1, sizeof (record_ext), abfd);
- record.dep_count = bfd_h_get_32(abfd, record_ext.dep_count);
- record.depee_count = bfd_h_get_32(abfd, record_ext.depee_count);
- record.sect_count = bfd_h_get_32(abfd, record_ext.sect_count);
+ record.mod_size = bfd_h_get_32 (abfd, record_ext.mod_size);
+ record.file_offset = bfd_h_get_32 (abfd, record_ext.file_offset);
- module[i].name = bfd_alloc(abfd,33);
- if (!module[i].name)
- {
- bfd_error = no_error;
- return NULL;
- }
+ record.dep_count = bfd_h_get_32 (abfd, record_ext.dep_count);
+ record.depee_count = bfd_h_get_32 (abfd, record_ext.depee_count);
+ record.sect_count = bfd_h_get_32 (abfd, record_ext.sect_count);
+
+ module[i].name = bfd_alloc (abfd, 33);
+ if (!module[i].name)
+ {
+ bfd_set_error (bfd_error_no_error);
+ return NULL;
+ }
- memcpy(module[i].name, record_ext.mod_name, 33);
- filepos +=
- sizeof(record_ext) +
+ memcpy (module[i].name, record_ext.mod_name, 33);
+ filepos +=
+ sizeof (record_ext) +
record.dep_count * 4 +
- record.depee_count * 4 +
- record.sect_count * 8 + 187;
- }
- else {
- oasys_extmodule_table_type_b_type record_ext;
- bfd_read((PTR)&record_ext, 1, sizeof(record_ext), abfd);
-
- record.mod_size = bfd_h_get_32(abfd, record_ext.mod_size);
- record.file_offset = bfd_h_get_32(abfd, record_ext.file_offset);
-
- record.dep_count = bfd_h_get_32(abfd, record_ext.dep_count);
- record.depee_count = bfd_h_get_32(abfd, record_ext.depee_count);
- record.sect_count = bfd_h_get_32(abfd, record_ext.sect_count);
- record.module_name_size = bfd_h_get_32(abfd, record_ext.mod_name_length);
-
- module[i].name = bfd_alloc(abfd,record.module_name_size + 1);
- if (!module[i].name)
- {
- bfd_error = no_error;
- return NULL;
- }
- bfd_read((PTR)module[i].name, 1, record.module_name_size, abfd);
- module[i].name[record.module_name_size] = 0;
- filepos +=
- sizeof(record_ext) +
+ record.depee_count * 4 +
+ record.sect_count * 8 + 187;
+ }
+ else
+ {
+ oasys_extmodule_table_type_b_type record_ext;
+ bfd_read ((PTR) & record_ext, 1, sizeof (record_ext), abfd);
+
+ record.mod_size = bfd_h_get_32 (abfd, record_ext.mod_size);
+ record.file_offset = bfd_h_get_32 (abfd, record_ext.file_offset);
+
+ record.dep_count = bfd_h_get_32 (abfd, record_ext.dep_count);
+ record.depee_count = bfd_h_get_32 (abfd, record_ext.depee_count);
+ record.sect_count = bfd_h_get_32 (abfd, record_ext.sect_count);
+ record.module_name_size = bfd_h_get_32 (abfd, record_ext.mod_name_length);
+
+ module[i].name = bfd_alloc (abfd, record.module_name_size + 1);
+ if (!module[i].name)
+ {
+ bfd_set_error (bfd_error_no_error);
+ return NULL;
+ }
+ bfd_read ((PTR) module[i].name, 1, record.module_name_size, abfd);
+ module[i].name[record.module_name_size] = 0;
+ filepos +=
+ sizeof (record_ext) +
record.dep_count * 4 +
- record.module_name_size + 1;
+ record.module_name_size + 1;
- }
+ }
module[i].size = record.mod_size;
module[i].pos = record.file_offset;
module[i].abfd = 0;
}
-
- }
+
+ }
return abfd->xvec;
}
static boolean
-DEFUN(oasys_mkobject,(abfd),
- bfd *abfd)
+oasys_mkobject (abfd)
+ bfd *abfd;
{
- abfd->tdata.oasys_obj_data = (oasys_data_type*)bfd_alloc(abfd, sizeof(oasys_data_type));
+ abfd->tdata.oasys_obj_data = (oasys_data_type *) bfd_alloc (abfd, sizeof (oasys_data_type));
return abfd->tdata.oasys_obj_data ? true : false;
}
#define MAX_SECS 16
static bfd_target *
-DEFUN(oasys_object_p,(abfd),
- bfd *abfd)
+oasys_object_p (abfd)
+ bfd *abfd;
{
oasys_data_type *oasys;
- oasys_data_type *save = OASYS_DATA(abfd);
+ oasys_data_type *save = OASYS_DATA (abfd);
boolean loop = true;
boolean had_usefull = false;
abfd->tdata.oasys_obj_data = 0;
- oasys_mkobject(abfd);
- oasys = OASYS_DATA(abfd);
- memset((PTR)oasys->sections, 0xff, sizeof(oasys->sections));
-
+ oasys_mkobject (abfd);
+ oasys = OASYS_DATA (abfd);
+ memset ((PTR) oasys->sections, 0xff, sizeof (oasys->sections));
+
/* Point to the start of the file */
- bfd_seek(abfd, (file_ptr)0, SEEK_SET);
+ bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
oasys->symbol_string_length = 0;
/* Inspect the records, but only keep the section info -
remember the size of the symbols
*/
oasys->first_data_record = 0;
- while (loop) {
- oasys_record_union_type record;
- oasys_read_record(abfd, &record);
- if ((size_t)record.header.length < (size_t)sizeof(record.header))
- goto fail;
+ while (loop)
+ {
+ oasys_record_union_type record;
+ oasys_read_record (abfd, &record);
+ if ((size_t) record.header.length < (size_t) sizeof (record.header))
+ goto fail;
- switch ((oasys_record_enum_type)(record.header.type)) {
- case oasys_record_is_header_enum:
- had_usefull = true;
- break;
- case oasys_record_is_symbol_enum:
- case oasys_record_is_local_enum:
- /* Count symbols and remember their size for a future malloc */
- abfd->symcount++;
- oasys->symbol_string_length += 1 + oasys_string_length(&record);
- had_usefull = true;
- break;
- case oasys_record_is_section_enum:
+ switch ((oasys_record_enum_type) (record.header.type))
{
- asection *s;
- char *buffer;
- unsigned int section_number;
- if (record.section.header.length != sizeof(record.section))
+ case oasys_record_is_header_enum:
+ had_usefull = true;
+ break;
+ case oasys_record_is_symbol_enum:
+ case oasys_record_is_local_enum:
+ /* Count symbols and remember their size for a future malloc */
+ abfd->symcount++;
+ oasys->symbol_string_length += 1 + oasys_string_length (&record);
+ had_usefull = true;
+ break;
+ case oasys_record_is_section_enum:
+ {
+ asection *s;
+ char *buffer;
+ unsigned int section_number;
+ if (record.section.header.length != sizeof (record.section))
{
goto fail;
}
- buffer = bfd_alloc(abfd, 3);
- if (!buffer)
- {
- bfd_error = no_memory;
- goto fail;
- }
- section_number= record.section.relb & RELOCATION_SECT_BITS;
- sprintf(buffer,"%u", section_number);
- s = bfd_make_section(abfd,buffer);
- oasys->sections[section_number] = s;
- switch (record.section.relb & RELOCATION_TYPE_BITS) {
- case RELOCATION_TYPE_ABS:
- case RELOCATION_TYPE_REL:
- break;
- case RELOCATION_TYPE_UND:
- case RELOCATION_TYPE_COM:
- BFD_FAIL();
- }
+ buffer = bfd_alloc (abfd, 3);
+ if (!buffer)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ goto fail;
+ }
+ section_number = record.section.relb & RELOCATION_SECT_BITS;
+ sprintf (buffer, "%u", section_number);
+ s = bfd_make_section (abfd, buffer);
+ oasys->sections[section_number] = s;
+ switch (record.section.relb & RELOCATION_TYPE_BITS)
+ {
+ case RELOCATION_TYPE_ABS:
+ case RELOCATION_TYPE_REL:
+ break;
+ case RELOCATION_TYPE_UND:
+ case RELOCATION_TYPE_COM:
+ BFD_FAIL ();
+ }
- s->_raw_size = bfd_h_get_32(abfd, record.section.value);
- s->vma = bfd_h_get_32(abfd, record.section.vma);
- s->flags= 0;
- had_usefull = true;
+ s->_raw_size = bfd_h_get_32 (abfd, record.section.value);
+ s->vma = bfd_h_get_32 (abfd, record.section.vma);
+ s->flags = 0;
+ had_usefull = true;
+ }
+ break;
+ case oasys_record_is_data_enum:
+ oasys->first_data_record = bfd_tell (abfd) - record.header.length;
+ case oasys_record_is_debug_enum:
+ case oasys_record_is_module_enum:
+ case oasys_record_is_named_section_enum:
+ case oasys_record_is_end_enum:
+ if (had_usefull == false)
+ goto fail;
+ loop = false;
+ break;
+ default:
+ goto fail;
}
- break;
- case oasys_record_is_data_enum:
- oasys->first_data_record = bfd_tell(abfd) - record.header.length;
- case oasys_record_is_debug_enum:
- case oasys_record_is_module_enum:
- case oasys_record_is_named_section_enum:
- case oasys_record_is_end_enum:
- if (had_usefull == false) goto fail;
- loop = false;
- break;
- default:
- goto fail;
}
- }
- oasys->symbols = (asymbol *)NULL;
- /*
+ oasys->symbols = (asymbol *) NULL;
+ /*
Oasys support several architectures, but I can't see a simple way
- to discover which one is in a particular file - we'll guess
+ to discover which one is in a particular file - we'll guess
*/
- bfd_default_set_arch_mach(abfd, bfd_arch_m68k, 0);
- if (abfd->symcount != 0) {
- abfd->flags |= HAS_SYMS;
- }
+ bfd_default_set_arch_mach (abfd, bfd_arch_m68k, 0);
+ if (abfd->symcount != 0)
+ {
+ abfd->flags |= HAS_SYMS;
+ }
- /*
+ /*
We don't know if a section has data until we've read it..
*/
- oasys_slurp_section_data(abfd);
+ oasys_slurp_section_data (abfd);
return abfd->xvec;
- fail:
- (void) bfd_release(abfd, oasys);
+fail:
+ (void) bfd_release (abfd, oasys);
abfd->tdata.oasys_obj_data = save;
- return (bfd_target *)NULL;
+ return (bfd_target *) NULL;
}
-static void
-DEFUN(oasys_get_symbol_info,(ignore_abfd, symbol, ret),
- bfd *ignore_abfd AND
- asymbol *symbol AND
- symbol_info *ret)
+static void
+oasys_get_symbol_info (ignore_abfd, symbol, ret)
+ bfd *ignore_abfd;
+ asymbol *symbol;
+ symbol_info *ret;
{
bfd_symbol_info (symbol, ret);
if (!symbol->section)
ret->type = (symbol->flags & BSF_LOCAL) ? 'a' : 'A';
}
-static void
-DEFUN(oasys_print_symbol,(ignore_abfd, afile, symbol, how),
- bfd *ignore_abfd AND
- PTR afile AND
- asymbol *symbol AND
- bfd_print_symbol_type how)
+static void
+oasys_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) {
- case bfd_print_symbol_name:
- case bfd_print_symbol_more:
- fprintf(file,"%s", symbol->name);
- break;
- case bfd_print_symbol_all:
+ FILE *file = (FILE *) afile;
+
+ switch (how)
{
- CONST char *section_name = symbol->section == (asection *)NULL ?
+ case bfd_print_symbol_name:
+ case bfd_print_symbol_more:
+ fprintf (file, "%s", symbol->name);
+ break;
+ case bfd_print_symbol_all:
+ {
+ CONST char *section_name = symbol->section == (asection *) NULL ?
(CONST char *) "*abs" : symbol->section->name;
- bfd_print_symbol_vandf((PTR)file,symbol);
+ bfd_print_symbol_vandf ((PTR) file, symbol);
- fprintf(file," %-5s %s",
- section_name,
- symbol->name);
+ fprintf (file, " %-5s %s",
+ section_name,
+ symbol->name);
+ }
+ break;
}
- break;
- }
}
/*
The howto table is build using the top two bits of a reloc byte to
index into it. The bits are PCREL,WORD/LONG
*/
-static reloc_howto_type howto_table[]=
+static reloc_howto_type howto_table[] =
{
-HOWTO( 0, 0, 1, 16, false,0,complain_overflow_bitfield,0,"abs16",true,0x0000ffff, 0x0000ffff,false),
-HOWTO( 0, 0, 2, 32, false,0,complain_overflow_bitfield,0,"abs32",true,0xffffffff, 0xffffffff,false),
-HOWTO( 0, 0, 1, 16, true,0,complain_overflow_signed,0,"pcrel16",true,0x0000ffff, 0x0000ffff,false),
-HOWTO( 0, 0, 2, 32, true,0,complain_overflow_signed,0,"pcrel32",true,0xffffffff, 0xffffffff,false)
+ HOWTO (0, 0, 1, 16, false, 0, complain_overflow_bitfield, 0, "abs16", true, 0x0000ffff, 0x0000ffff, false),
+ HOWTO (0, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, "abs32", true, 0xffffffff, 0xffffffff, false),
+ HOWTO (0, 0, 1, 16, true, 0, complain_overflow_signed, 0, "pcrel16", true, 0x0000ffff, 0x0000ffff, false),
+ HOWTO (0, 0, 2, 32, true, 0, complain_overflow_signed, 0, "pcrel32", true, 0xffffffff, 0xffffffff, false)
};
/* Read in all the section data and relocation stuff too */
-static boolean
-DEFUN(oasys_slurp_section_data,(abfd),
- bfd *CONST abfd)
+static boolean
+oasys_slurp_section_data (abfd)
+ bfd *CONST abfd;
{
oasys_record_union_type record;
- oasys_data_type *data = OASYS_DATA(abfd);
+ oasys_data_type *data = OASYS_DATA (abfd);
boolean loop = true;
- oasys_per_section_type *per ;
+ oasys_per_section_type *per;
asection *s;
/* See if the data has been slurped already .. */
- for (s = abfd->sections; s != (asection *)NULL; s= s->next) {
- per = oasys_per_section(s);
- if (per->initialized == true)
- return true;
- }
+ for (s = abfd->sections; s != (asection *) NULL; s = s->next)
+ {
+ per = oasys_per_section (s);
+ if (per->initialized == true)
+ return true;
+ }
- if (data->first_data_record == 0) return true;
+ if (data->first_data_record == 0)
+ return true;
- bfd_seek(abfd, data->first_data_record, SEEK_SET);
- while (loop) {
- oasys_read_record(abfd, &record);
- switch (record.header.type)
+ bfd_seek (abfd, data->first_data_record, SEEK_SET);
+ while (loop)
+ {
+ oasys_read_record (abfd, &record);
+ switch (record.header.type)
{
case oasys_record_is_header_enum:
break;
case oasys_record_is_data_enum:
- {
+ {
- bfd_byte *src = record.data.data;
- bfd_byte *end_src = ((bfd_byte *)&record) + record.header.length;
- bfd_byte *dst_ptr;
- bfd_byte *dst_base_ptr;
- unsigned int relbit;
- unsigned int count;
- asection * section =
- data->sections[record.data.relb & RELOCATION_SECT_BITS];
- bfd_vma dst_offset ;
+ bfd_byte *src = record.data.data;
+ bfd_byte *end_src = ((bfd_byte *) & record) + record.header.length;
+ bfd_byte *dst_ptr;
+ bfd_byte *dst_base_ptr;
+ unsigned int relbit;
+ unsigned int count;
+ asection *section =
+ data->sections[record.data.relb & RELOCATION_SECT_BITS];
+ bfd_vma dst_offset;
- per = oasys_per_section(section);
+ per = oasys_per_section (section);
- if (per->initialized == false)
+ if (per->initialized == false)
+ {
+ per->data = (bfd_byte *) bfd_zalloc (abfd, section->_raw_size);
+ if (!per->data)
{
- per->data = (bfd_byte *) bfd_zalloc(abfd, section->_raw_size);
- if (!per->data)
- {
- bfd_error = no_memory;
- return false;
- }
- per->reloc_tail_ptr = (oasys_reloc_type **)&(section->relocation);
- per->had_vma = false;
- per->initialized = true;
- section->reloc_count = 0;
- section->flags = SEC_ALLOC;
+ bfd_set_error (bfd_error_no_memory);
+ return false;
}
+ per->reloc_tail_ptr = (oasys_reloc_type **) & (section->relocation);
+ per->had_vma = false;
+ per->initialized = true;
+ section->reloc_count = 0;
+ section->flags = SEC_ALLOC;
+ }
- dst_offset = bfd_h_get_32(abfd, record.data.addr) ;
- if (per->had_vma == false) {
+ dst_offset = bfd_h_get_32 (abfd, record.data.addr);
+ if (per->had_vma == false)
+ {
/* Take the first vma we see as the base */
section->vma = dst_offset;
per->had_vma = true;
}
- dst_offset -= section->vma;
+ dst_offset -= section->vma;
- dst_base_ptr = oasys_per_section(section)->data;
- dst_ptr = oasys_per_section(section)->data +
- dst_offset;
+ dst_base_ptr = oasys_per_section (section)->data;
+ dst_ptr = oasys_per_section (section)->data +
+ dst_offset;
- if (src < end_src) {
+ if (src < end_src)
+ {
section->flags |= SEC_LOAD | SEC_HAS_CONTENTS;
}
- while (src < end_src) {
+ while (src < end_src)
+ {
unsigned char mod_byte = *src++;
size_t gap = end_src - src;
-
+
count = 8;
- if (mod_byte == 0 && gap >= 8) {
- dst_ptr[0] = src[0];
- dst_ptr[1] = src[1];
- dst_ptr[2] = src[2];
- dst_ptr[3] = src[3];
- dst_ptr[4] = src[4];
- dst_ptr[5] = src[5];
- dst_ptr[6] = src[6];
- dst_ptr[7] = src[7];
- dst_ptr+= 8;
- src += 8;
- }
- else {
- for (relbit = 1; count-- != 0 && src < end_src; relbit <<=1)
+ if (mod_byte == 0 && gap >= 8)
+ {
+ dst_ptr[0] = src[0];
+ dst_ptr[1] = src[1];
+ dst_ptr[2] = src[2];
+ dst_ptr[3] = src[3];
+ dst_ptr[4] = src[4];
+ dst_ptr[5] = src[5];
+ dst_ptr[6] = src[6];
+ dst_ptr[7] = src[7];
+ dst_ptr += 8;
+ src += 8;
+ }
+ else
+ {
+ for (relbit = 1; count-- != 0 && src < end_src; relbit <<= 1)
{
- if (relbit & mod_byte)
- {
- unsigned char reloc = *src;
- /* This item needs to be relocated */
- switch (reloc & RELOCATION_TYPE_BITS) {
+ if (relbit & mod_byte)
+ {
+ unsigned char reloc = *src;
+ /* This item needs to be relocated */
+ switch (reloc & RELOCATION_TYPE_BITS)
+ {
case RELOCATION_TYPE_ABS:
break;
- case RELOCATION_TYPE_REL:
- {
- /* Relocate the item relative to the section */
- oasys_reloc_type *r =
- (oasys_reloc_type *)
- bfd_alloc(abfd,
- sizeof(oasys_reloc_type));
- if (!r)
- {
- bfd_error = no_memory;
- return false;
- }
- *(per->reloc_tail_ptr) = r;
- per->reloc_tail_ptr = &r->next;
- r->next= (oasys_reloc_type *)NULL;
- /* Reference to undefined symbol */
- src++;
- /* There is no symbol */
- r->symbol = 0;
- /* Work out the howto */
- abort();
+ case RELOCATION_TYPE_REL:
+ {
+ /* Relocate the item relative to the section */
+ oasys_reloc_type *r =
+ (oasys_reloc_type *)
+ bfd_alloc (abfd,
+ sizeof (oasys_reloc_type));
+ if (!r)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return false;
+ }
+ *(per->reloc_tail_ptr) = r;
+ per->reloc_tail_ptr = &r->next;
+ r->next = (oasys_reloc_type *) NULL;
+ /* Reference to undefined symbol */
+ src++;
+ /* There is no symbol */
+ r->symbol = 0;
+ /* Work out the howto */
+ abort ();
#if 0
- r->relent.section =
- data->sections[reloc &
- RELOCATION_SECT_BITS];
+ r->relent.section =
+ data->sections[reloc &
+ RELOCATION_SECT_BITS];
- r->relent.addend = -
- r->relent.section->vma;
+ r->relent.addend = -
+ r->relent.section->vma;
#endif
- r->relent.address = dst_ptr - dst_base_ptr;
- r->relent.howto = &howto_table[reloc>>6];
- r->relent.sym_ptr_ptr = (asymbol **)NULL;
- section->reloc_count++;
+ r->relent.address = dst_ptr - dst_base_ptr;
+ r->relent.howto = &howto_table[reloc >> 6];
+ r->relent.sym_ptr_ptr = (asymbol **) NULL;
+ section->reloc_count++;
- /* Fake up the data to look like it's got the -ve pc in it, this makes
+ /* Fake up the data to look like it's got the -ve pc in it, this makes
it much easier to convert into other formats. This is done by
hitting the addend.
*/
- if (r->relent.howto->pc_relative == true) {
+ if (r->relent.howto->pc_relative == true)
+ {
r->relent.addend -= dst_ptr - dst_base_ptr;
}
- }
+ }
break;
case RELOCATION_TYPE_UND:
- {
- oasys_reloc_type *r =
- (oasys_reloc_type *)
- bfd_alloc(abfd,
- sizeof(oasys_reloc_type));
- if (!r)
- {
- bfd_error = no_memory;
- return false;
- }
- *(per->reloc_tail_ptr) = r;
- per->reloc_tail_ptr = &r->next;
- r->next= (oasys_reloc_type *)NULL;
- /* Reference to undefined symbol */
- src++;
- /* Get symbol number */
- r->symbol = (src[0]<<8) | src[1];
- /* Work out the howto */
- abort();
-
+ {
+ oasys_reloc_type *r =
+ (oasys_reloc_type *)
+ bfd_alloc (abfd,
+ sizeof (oasys_reloc_type));
+ if (!r)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return false;
+ }
+ *(per->reloc_tail_ptr) = r;
+ per->reloc_tail_ptr = &r->next;
+ r->next = (oasys_reloc_type *) NULL;
+ /* Reference to undefined symbol */
+ src++;
+ /* Get symbol number */
+ r->symbol = (src[0] << 8) | src[1];
+ /* Work out the howto */
+ abort ();
+
#if 0
- r->relent.section = (asection
- *)NULL;
+ r->relent.section = (asection
+ *) NULL;
#endif
- r->relent.addend = 0;
- r->relent.address = dst_ptr - dst_base_ptr;
- r->relent.howto = &howto_table[reloc>>6];
- r->relent.sym_ptr_ptr = (asymbol **)NULL;
- section->reloc_count++;
-
- src+=2;
- /* Fake up the data to look like it's got the -ve pc in it, this makes
+ r->relent.addend = 0;
+ r->relent.address = dst_ptr - dst_base_ptr;
+ r->relent.howto = &howto_table[reloc >> 6];
+ r->relent.sym_ptr_ptr = (asymbol **) NULL;
+ section->reloc_count++;
+
+ src += 2;
+ /* Fake up the data to look like it's got the -ve pc in it, this makes
it much easier to convert into other formats. This is done by
hitting the addend.
*/
- if (r->relent.howto->pc_relative == true) {
+ if (r->relent.howto->pc_relative == true)
+ {
r->relent.addend -= dst_ptr - dst_base_ptr;
}
-
- }
+
+ }
break;
case RELOCATION_TYPE_COM:
- BFD_FAIL();
+ BFD_FAIL ();
}
- }
+ }
*dst_ptr++ = *src++;
}
- }
- }
- }
+ }
+ }
+ }
break;
case oasys_record_is_local_enum:
case oasys_record_is_symbol_enum:
@@ -739,92 +769,93 @@ DEFUN(oasys_slurp_section_data,(abfd),
default:
loop = false;
}
- }
+ }
return true;
}
static boolean
-DEFUN(oasys_new_section_hook,(abfd, newsect),
- bfd *abfd AND
- asection *newsect)
+oasys_new_section_hook (abfd, newsect)
+ bfd *abfd;
+ asection *newsect;
{
newsect->used_by_bfd = (PTR)
- bfd_alloc(abfd, sizeof(oasys_per_section_type));
+ bfd_alloc (abfd, sizeof (oasys_per_section_type));
if (!newsect->used_by_bfd)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
- oasys_per_section( newsect)->data = (bfd_byte *)NULL;
- oasys_per_section(newsect)->section = newsect;
- oasys_per_section(newsect)->offset = 0;
- oasys_per_section(newsect)->initialized = false;
+ oasys_per_section (newsect)->data = (bfd_byte *) NULL;
+ oasys_per_section (newsect)->section = newsect;
+ oasys_per_section (newsect)->offset = 0;
+ oasys_per_section (newsect)->initialized = false;
newsect->alignment_power = 1;
/* Turn the section string into an index */
- sscanf(newsect->name,"%u", &newsect->target_index);
+ sscanf (newsect->name, "%u", &newsect->target_index);
return true;
}
static unsigned int
-DEFUN(oasys_get_reloc_upper_bound, (abfd, asect),
- bfd *abfd AND
- sec_ptr asect)
+oasys_get_reloc_upper_bound (abfd, asect)
+ bfd *abfd;
+ sec_ptr asect;
{
- oasys_slurp_section_data(abfd);
- return (asect->reloc_count+1) * sizeof(arelent *);
+ oasys_slurp_section_data (abfd);
+ return (asect->reloc_count + 1) * sizeof (arelent *);
}
static boolean
-DEFUN(oasys_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)
+oasys_get_section_contents (abfd, section, location, offset, count)
+ bfd *abfd;
+ sec_ptr section;
+ PTR location;
+ file_ptr offset;
+ bfd_size_type count;
{
oasys_per_section_type *p = (oasys_per_section_type *) section->used_by_bfd;
- oasys_slurp_section_data(abfd);
- if (p->initialized == false)
- {
- (void) memset(location, 0, (int)count);
- }
- else
- {
- (void) memcpy(location,(PTR)( p->data + offset), (int)count);
- }
+ oasys_slurp_section_data (abfd);
+ if (p->initialized == false)
+ {
+ (void) memset (location, 0, (int) count);
+ }
+ else
+ {
+ (void) memcpy (location, (PTR) (p->data + offset), (int) count);
+ }
return true;
}
unsigned int
-DEFUN(oasys_canonicalize_reloc,(ignore_abfd, section, relptr, symbols),
- bfd *ignore_abfd AND
- sec_ptr section AND
- arelent **relptr AND
- asymbol **symbols)
+oasys_canonicalize_reloc (ignore_abfd, section, relptr, symbols)
+ bfd *ignore_abfd;
+ sec_ptr section;
+ arelent **relptr;
+ asymbol **symbols;
{
unsigned int reloc_count = 0;
- oasys_reloc_type *src = (oasys_reloc_type *)(section->relocation);
- while (src != (oasys_reloc_type *)NULL) {
- abort();
-
+ oasys_reloc_type *src = (oasys_reloc_type *) (section->relocation);
+ while (src != (oasys_reloc_type *) NULL)
+ {
+ abort ();
+
#if 0
- if (src->relent.section == (asection *)NULL)
+ if (src->relent.section == (asection *) NULL)
{
src->relent.sym_ptr_ptr = symbols + src->symbol;
}
#endif
- *relptr ++ = &src->relent;
- src = src->next;
- reloc_count++;
- }
- *relptr = (arelent *)NULL;
+ *relptr++ = &src->relent;
+ src = src->next;
+ reloc_count++;
+ }
+ *relptr = (arelent *) NULL;
return section->reloc_count = reloc_count;
}
@@ -835,110 +866,122 @@ DEFUN(oasys_canonicalize_reloc,(ignore_abfd, section, relptr, symbols),
/* Calculate the checksum and write one record */
-static void
-DEFUN(oasys_write_record,(abfd, type, record, size),
- bfd *CONST abfd AND
- CONST oasys_record_enum_type type AND
- oasys_record_union_type *record AND
- CONST size_t size)
+static void
+oasys_write_record (abfd, type, record, size)
+ bfd *CONST abfd;
+ CONST oasys_record_enum_type type;
+ oasys_record_union_type *record;
+ CONST size_t size;
{
int checksum;
size_t i;
unsigned char *ptr;
record->header.length = size;
- record->header.type = (int)type;
+ record->header.type = (int) type;
record->header.check_sum = 0;
record->header.fill = 0;
- ptr = (unsigned char *)&record->pad[0];
+ ptr = (unsigned char *) &record->pad[0];
checksum = 0;
- for (i = 0; i < size; i++) {
- checksum += *ptr++;
- }
- record->header.check_sum = 0xff & (- checksum);
- bfd_write((PTR)record, 1, size, abfd);
+ for (i = 0; i < size; i++)
+ {
+ checksum += *ptr++;
+ }
+ record->header.check_sum = 0xff & (-checksum);
+ bfd_write ((PTR) record, 1, size, abfd);
}
/* Write out all the symbols */
-static void
-DEFUN(oasys_write_syms, (abfd),
- bfd * CONST abfd)
+static void
+oasys_write_syms (abfd)
+ bfd *CONST abfd;
{
unsigned int count;
- asymbol **generic = bfd_get_outsymbols(abfd);
+ asymbol **generic = bfd_get_outsymbols (abfd);
unsigned int index = 0;
- for (count = 0; count < bfd_get_symcount(abfd); count++) {
+ for (count = 0; count < bfd_get_symcount (abfd); count++)
+ {
- oasys_symbol_record_type symbol;
- asymbol * CONST g = generic[count];
+ oasys_symbol_record_type symbol;
+ asymbol *CONST g = generic[count];
- CONST char *src = g->name;
- char *dst = symbol.name;
- unsigned int l = 0;
+ CONST char *src = g->name;
+ char *dst = symbol.name;
+ unsigned int l = 0;
- if (bfd_is_com_section (g->section)) {
- symbol.relb = RELOCATION_TYPE_COM;
- bfd_h_put_16(abfd, index, symbol.refno);
- index++;
- }
- else if (g->section == & bfd_abs_section) {
- symbol.relb = RELOCATION_TYPE_ABS;
- bfd_h_put_16(abfd, 0, symbol.refno);
+ if (bfd_is_com_section (g->section))
+ {
+ symbol.relb = RELOCATION_TYPE_COM;
+ bfd_h_put_16 (abfd, index, symbol.refno);
+ index++;
+ }
+ else if (g->section == &bfd_abs_section)
+ {
+ symbol.relb = RELOCATION_TYPE_ABS;
+ bfd_h_put_16 (abfd, 0, symbol.refno);
- }
- else if (g->section == &bfd_und_section) {
- symbol.relb = RELOCATION_TYPE_UND ;
- bfd_h_put_16(abfd, index, symbol.refno);
- /* Overload the value field with the output index number */
- index++;
- }
- else if (g->flags & BSF_DEBUGGING) {
- /* throw it away */
- continue;
- }
- else {
- if (g->section == (asection *)NULL) {
- /* Sometime, the oasys tools give out a symbol with illegal
+ }
+ else if (g->section == &bfd_und_section)
+ {
+ symbol.relb = RELOCATION_TYPE_UND;
+ bfd_h_put_16 (abfd, index, symbol.refno);
+ /* Overload the value field with the output index number */
+ index++;
+ }
+ else if (g->flags & BSF_DEBUGGING)
+ {
+ /* throw it away */
+ continue;
+ }
+ else
+ {
+ if (g->section == (asection *) NULL)
+ {
+ /* Sometime, the oasys tools give out a symbol with illegal
bits in it, we'll output it in the same broken way */
-
- symbol.relb = RELOCATION_TYPE_REL | 0;
- }
- else {
- symbol.relb = RELOCATION_TYPE_REL |g->section->output_section->target_index;
- }
- bfd_h_put_16(abfd, 0, symbol.refno);
- }
+
+ symbol.relb = RELOCATION_TYPE_REL | 0;
+ }
+ else
+ {
+ symbol.relb = RELOCATION_TYPE_REL | g->section->output_section->target_index;
+ }
+ bfd_h_put_16 (abfd, 0, symbol.refno);
+ }
#ifdef UNDERSCORE_HACK
- if (src[l] == '_')
- dst[l++] = '.';
+ if (src[l] == '_')
+ dst[l++] = '.';
#endif
- while (src[l]) {
- dst[l] = src[l];
- l++;
- }
+ while (src[l])
+ {
+ dst[l] = src[l];
+ l++;
+ }
- bfd_h_put_32(abfd, g->value, symbol.value);
+ bfd_h_put_32 (abfd, g->value, symbol.value);
-
- if (g->flags & BSF_LOCAL) {
- oasys_write_record(abfd,
- oasys_record_is_local_enum,
- (oasys_record_union_type *) &symbol,
- offsetof(oasys_symbol_record_type, name[0]) + l);
- }
- else {
- oasys_write_record(abfd,
- oasys_record_is_symbol_enum,
- (oasys_record_union_type *) &symbol,
- offsetof(oasys_symbol_record_type, name[0]) + l);
+
+ if (g->flags & BSF_LOCAL)
+ {
+ oasys_write_record (abfd,
+ oasys_record_is_local_enum,
+ (oasys_record_union_type *) & symbol,
+ offsetof (oasys_symbol_record_type, name[0]) + l);
+ }
+ else
+ {
+ oasys_write_record (abfd,
+ oasys_record_is_symbol_enum,
+ (oasys_record_union_type *) & symbol,
+ offsetof (oasys_symbol_record_type, name[0]) + l);
+ }
+ g->value = index - 1;
}
- g->value = index-1;
- }
}
- /* Write a section header for each section */
+ /* Write a section header for each section */
static boolean
oasys_write_sections (abfd)
bfd *abfd;
@@ -946,259 +989,278 @@ oasys_write_sections (abfd)
asection *s;
static oasys_section_record_type out;
- for (s = abfd->sections; s != (asection *)NULL; s = s->next) {
- if (!isdigit(s->name[0]))
+ for (s = abfd->sections; s != (asection *) NULL; s = s->next)
+ {
+ if (!isdigit (s->name[0]))
{
- bfd_error = nonrepresentable_section;
+ bfd_set_error (bfd_error_nonrepresentable_section);
return false;
}
- out.relb = RELOCATION_TYPE_REL | s->target_index;
- bfd_h_put_32(abfd, s->_cooked_size, out.value);
- bfd_h_put_32(abfd, s->vma, out.vma);
-
- oasys_write_record(abfd,
- oasys_record_is_section_enum,
- (oasys_record_union_type *) &out,
- sizeof(out));
- }
+ out.relb = RELOCATION_TYPE_REL | s->target_index;
+ bfd_h_put_32 (abfd, s->_cooked_size, out.value);
+ bfd_h_put_32 (abfd, s->vma, out.vma);
+
+ oasys_write_record (abfd,
+ oasys_record_is_section_enum,
+ (oasys_record_union_type *) & out,
+ sizeof (out));
+ }
return true;
}
static void
-DEFUN(oasys_write_header, (abfd),
- bfd *CONST abfd)
+oasys_write_header (abfd)
+ bfd *CONST abfd;
{
/* Create and write the header */
oasys_header_record_type r;
- size_t length = strlen(abfd->filename);
- if (length > (size_t)sizeof(r.module_name)) {
- length = sizeof(r.module_name);
- }
+ size_t length = strlen (abfd->filename);
+ if (length > (size_t) sizeof (r.module_name))
+ {
+ length = sizeof (r.module_name);
+ }
- (void)memcpy(r.module_name,
- abfd->filename,
- length);
- (void)memset(r.module_name + length,
- ' ',
- sizeof(r.module_name) - length);
+ (void) memcpy (r.module_name,
+ abfd->filename,
+ length);
+ (void) memset (r.module_name + length,
+ ' ',
+ sizeof (r.module_name) - length);
r.version_number = OASYS_VERSION_NUMBER;
r.rev_number = OASYS_REV_NUMBER;
- oasys_write_record(abfd,
- oasys_record_is_header_enum,
- (oasys_record_union_type *)&r,
- offsetof(oasys_header_record_type, description[0]));
+ oasys_write_record (abfd,
+ oasys_record_is_header_enum,
+ (oasys_record_union_type *) & r,
+ offsetof (oasys_header_record_type, description[0]));
}
static void
-DEFUN(oasys_write_end,(abfd),
- bfd *CONST abfd)
+oasys_write_end (abfd)
+ bfd *CONST abfd;
{
oasys_end_record_type end;
unsigned char null = 0;
end.relb = RELOCATION_TYPE_ABS;
- bfd_h_put_32(abfd, abfd->start_address, end.entry);
- bfd_h_put_16(abfd, 0, end.fill);
+ bfd_h_put_32 (abfd, abfd->start_address, end.entry);
+ bfd_h_put_16 (abfd, 0, end.fill);
end.zero = 0;
- oasys_write_record(abfd,
- oasys_record_is_end_enum,
- (oasys_record_union_type *)&end,
- sizeof(end));
- bfd_write((PTR)&null, 1, 1, abfd);
+ oasys_write_record (abfd,
+ oasys_record_is_end_enum,
+ (oasys_record_union_type *) & end,
+ sizeof (end));
+ bfd_write ((PTR) & null, 1, 1, abfd);
}
-static int
-DEFUN(comp,(ap, bp),
- CONST PTR ap AND
- CONST PTR bp)
+static int
+comp (ap, bp)
+ CONST PTR ap;
+ CONST PTR bp;
{
- arelent *a = *((arelent **)ap);
- arelent *b = *((arelent **)bp);
+ arelent *a = *((arelent **) ap);
+ arelent *b = *((arelent **) bp);
return a->address - b->address;
}
/*
Writing data..
-
+
*/
static void
-DEFUN(oasys_write_data, (abfd),
- bfd *CONST abfd)
+oasys_write_data (abfd)
+ bfd *CONST abfd;
{
asection *s;
- for (s = abfd->sections; s != (asection *)NULL; s = s->next) {
- if (s->flags & SEC_LOAD) {
- bfd_byte *raw_data = oasys_per_section(s)->data;
- oasys_data_record_type processed_data;
- bfd_size_type current_byte_index = 0;
- unsigned int relocs_to_go = s->reloc_count;
- arelent **p = s->orelocation;
- if (s->reloc_count != 0) {
+ for (s = abfd->sections; s != (asection *) NULL; s = s->next)
+ {
+ if (s->flags & SEC_LOAD)
+ {
+ bfd_byte *raw_data = oasys_per_section (s)->data;
+ oasys_data_record_type processed_data;
+ bfd_size_type current_byte_index = 0;
+ unsigned int relocs_to_go = s->reloc_count;
+ arelent **p = s->orelocation;
+ if (s->reloc_count != 0)
+ {
/* Sort the reloc records so it's easy to insert the relocs into the
data */
-
- qsort(s->orelocation,
- s->reloc_count,
- sizeof(arelent **),
- comp);
- }
- current_byte_index = 0;
- processed_data.relb = s->target_index | RELOCATION_TYPE_REL;
- while (current_byte_index < s->_cooked_size)
- {
- /* Scan forwards by eight bytes or however much is left and see if
+ qsort (s->orelocation,
+ s->reloc_count,
+ sizeof (arelent **),
+ comp);
+ }
+ current_byte_index = 0;
+ processed_data.relb = s->target_index | RELOCATION_TYPE_REL;
+
+ while (current_byte_index < s->_cooked_size)
+ {
+ /* Scan forwards by eight bytes or however much is left and see if
there are any relocations going on */
- bfd_byte *mod = &processed_data.data[0];
- bfd_byte *dst = &processed_data.data[1];
+ bfd_byte *mod = &processed_data.data[0];
+ bfd_byte *dst = &processed_data.data[1];
- unsigned int i = 0;
- *mod = 0;
+ unsigned int i = 0;
+ *mod = 0;
- bfd_h_put_32(abfd, s->vma + current_byte_index,
- processed_data.addr);
+ bfd_h_put_32 (abfd, s->vma + current_byte_index,
+ processed_data.addr);
- /* Don't start a relocation unless you're sure you can finish it
+ /* Don't start a relocation unless you're sure you can finish it
within the same data record. The worst case relocation is a
4-byte relocatable value which is split across two modification
bytes (1 relocation byte + 2 symbol reference bytes + 2 data +
1 modification byte + 2 data = 8 bytes total). That's where
the magic number 8 comes from.
*/
- while (current_byte_index < s->_raw_size && dst <=
- &processed_data.data[sizeof(processed_data.data)-8]) {
-
+ while (current_byte_index < s->_raw_size && dst <=
+ &processed_data.data[sizeof (processed_data.data) - 8])
+ {
- if (relocs_to_go != 0) {
- arelent *r = *p;
- const reloc_howto_type * const how=r->howto;
- /* There is a relocation, is it for this byte ? */
- if (r->address == current_byte_index) {
- unsigned char rel_byte;
- p++;
- relocs_to_go--;
+ if (relocs_to_go != 0)
+ {
+ arelent *r = *p;
+ const reloc_howto_type *const how = r->howto;
+ /* There is a relocation, is it for this byte ? */
+ if (r->address == current_byte_index)
+ {
+ unsigned char rel_byte;
+
+ p++;
+ relocs_to_go--;
- *mod |= (1<<i);
- if(how->pc_relative) {
- rel_byte = RELOCATION_PCREL_BIT;
+ *mod |= (1 << i);
+ if (how->pc_relative)
+ {
+ rel_byte = RELOCATION_PCREL_BIT;
- /* Also patch the raw data so that it doesn't have
+ /* Also patch the raw data so that it doesn't have
the -ve stuff any more */
- if (how->size != 2) {
- bfd_put_16(abfd,
- bfd_get_16(abfd,raw_data) +
- current_byte_index, raw_data);
- }
+ if (how->size != 2)
+ {
+ bfd_put_16 (abfd,
+ bfd_get_16 (abfd, raw_data) +
+ current_byte_index, raw_data);
+ }
+
+ else
+ {
+ bfd_put_32 (abfd,
+ bfd_get_32 (abfd, raw_data) +
+ current_byte_index, raw_data);
+ }
+ }
+ else
+ {
+ rel_byte = 0;
+ }
+ if (how->size == 2)
+ {
+ rel_byte |= RELOCATION_32BIT_BIT;
+ }
- else {
- bfd_put_32(abfd,
- bfd_get_32(abfd,raw_data) +
- current_byte_index, raw_data);
- }
- }
- else {
- rel_byte = 0;
- }
- if (how->size ==2) {
- rel_byte |= RELOCATION_32BIT_BIT;
- }
-
- /* Is this a section relative relocation, or a symbol
+ /* Is this a section relative relocation, or a symbol
relative relocation ? */
- abort();
-
+ abort ();
+
#if 0
- if (r->section != (asection*)NULL)
- {
- /* The relent has a section attached, so it must be section
+ if (r->section != (asection *) NULL)
+ {
+ /* The relent has a section attached, so it must be section
relative */
- rel_byte |= RELOCATION_TYPE_REL;
- rel_byte |= r->section->output_section->target_index;
- *dst++ = rel_byte;
- }
- else
+ rel_byte |= RELOCATION_TYPE_REL;
+ rel_byte |= r->section->output_section->target_index;
+ *dst++ = rel_byte;
+ }
+ else
#endif
- {
- asymbol *p = *(r->sym_ptr_ptr);
+ {
+ asymbol *p = *(r->sym_ptr_ptr);
- /* If this symbol has a section attached, then it
+ /* If this symbol has a section attached, then it
has already been resolved. Change from a symbol
ref to a section ref */
- if(p->section != (asection *)NULL) {
- rel_byte |= RELOCATION_TYPE_REL;
- rel_byte |=
- p->section->output_section->target_index;
- *dst++ = rel_byte;
- }
- else {
- rel_byte |= RELOCATION_TYPE_UND;
- *dst++ = rel_byte;
- /* Next two bytes are a symbol index - we can get
+ if (p->section != (asection *) NULL)
+ {
+ rel_byte |= RELOCATION_TYPE_REL;
+ rel_byte |=
+ p->section->output_section->target_index;
+ *dst++ = rel_byte;
+ }
+ else
+ {
+ rel_byte |= RELOCATION_TYPE_UND;
+ *dst++ = rel_byte;
+ /* Next two bytes are a symbol index - we can get
this from the symbol value which has been zapped
into the symbol index in the table when the
symbol table was written
*/
- *dst++ = p->value >> 8;
- *dst++ = p->value;
- }
- }
+ *dst++ = p->value >> 8;
+ *dst++ = p->value;
+ }
+ }
#define ADVANCE { if (++i >= 8) { i = 0; mod = dst++; *mod = 0; } current_byte_index++; }
- /* relocations never occur from an unloadable section,
+ /* relocations never occur from an unloadable section,
so we can assume that raw_data is not NULL
*/
- *dst++ = *raw_data++;
- ADVANCE
- *dst++ = *raw_data++;
- ADVANCE
- if (how->size == 2) {
- *dst++ = *raw_data++;
- ADVANCE
- *dst++ = *raw_data++;
- ADVANCE
+ *dst++ = *raw_data++;
+ ADVANCE
+ * dst++ = *raw_data++;
+ ADVANCE
+ if (how->size == 2)
+ {
+ *dst++ = *raw_data++;
+ ADVANCE
+ * dst++ = *raw_data++;
+ ADVANCE
+ }
+ continue;
+ }
}
- continue;
- }
- }
- /* If this is coming from an unloadable section then copy
+ /* If this is coming from an unloadable section then copy
zeros */
- if (raw_data == NULL) {
- *dst++ = 0;
+ if (raw_data == NULL)
+ {
+ *dst++ = 0;
+ }
+ else
+ {
+ *dst++ = *raw_data++;
+ }
+ ADVANCE
}
- else {
- *dst++ = *raw_data++;
+
+ /* Don't write a useless null modification byte */
+ if (dst == mod + 1)
+ {
+ --dst;
}
- ADVANCE
- }
- /* Don't write a useless null modification byte */
- if (dst == mod+1) {
- --dst;
- }
+ oasys_write_record (abfd,
+ oasys_record_is_data_enum,
+ (oasys_record_union_type *) & processed_data,
+ dst - (bfd_byte *) & processed_data);
- oasys_write_record(abfd,
- oasys_record_is_data_enum,
- (oasys_record_union_type *)&processed_data,
- dst - (bfd_byte *)&processed_data);
-
- }
+ }
+ }
}
- }
}
static boolean
-DEFUN(oasys_write_object_contents, (abfd),
- bfd *abfd)
+oasys_write_object_contents (abfd)
+ bfd *abfd;
{
- oasys_write_header(abfd);
- oasys_write_syms(abfd);
- if (! oasys_write_sections(abfd))
+ oasys_write_header (abfd);
+ oasys_write_syms (abfd);
+ if (!oasys_write_sections (abfd))
return false;
- oasys_write_data(abfd);
- oasys_write_end(abfd);
+ oasys_write_data (abfd);
+ oasys_write_end (abfd);
return true;
}
@@ -1207,32 +1269,33 @@ DEFUN(oasys_write_object_contents, (abfd),
/** exec and core file sections */
-/* set section contents is complicated with OASYS since the format is
+/* set section contents is complicated with OASYS since the format is
* not a byte image, but a record stream.
*/
static boolean
-DEFUN(oasys_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)
+oasys_set_section_contents (abfd, section, location, offset, count)
+ bfd *abfd;
+ sec_ptr section;
+ PTR location;
+ file_ptr offset;
+ bfd_size_type count;
{
- if (count != 0) {
- if (oasys_per_section(section)->data == (bfd_byte *)NULL )
+ if (count != 0)
+ {
+ if (oasys_per_section (section)->data == (bfd_byte *) NULL)
{
- oasys_per_section(section)->data =
- (bfd_byte *)(bfd_alloc(abfd,section->_cooked_size));
- if (! oasys_per_section(section)->data)
+ oasys_per_section (section)->data =
+ (bfd_byte *) (bfd_alloc (abfd, section->_cooked_size));
+ if (!oasys_per_section (section)->data)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
}
- (void) memcpy((PTR)(oasys_per_section(section)->data + offset),
- location,
- count);
- }
+ (void) memcpy ((PTR) (oasys_per_section (section)->data + offset),
+ location,
+ count);
+ }
return true;
}
@@ -1245,108 +1308,114 @@ function exits. We read the strings into a buffer large enough to
hold them all plus all the cached symbol entries. */
static asymbol *
-DEFUN(oasys_make_empty_symbol,(abfd),
- bfd *abfd)
+oasys_make_empty_symbol (abfd)
+ bfd *abfd;
{
- oasys_symbol_type *new =
- (oasys_symbol_type *)bfd_zalloc (abfd, sizeof (oasys_symbol_type));
+ oasys_symbol_type *new =
+ (oasys_symbol_type *) bfd_zalloc (abfd, sizeof (oasys_symbol_type));
if (!new)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return NULL;
}
new->symbol.the_bfd = abfd;
return &new->symbol;
}
+
-
/* User should have checked the file flags; perhaps we should return
BFD_NO_MORE_SYMBOLS if there are none? */
static bfd *
-oasys_openr_next_archived_file(arch, prev)
-bfd *arch;
-bfd *prev;
+oasys_openr_next_archived_file (arch, prev)
+ bfd *arch;
+ bfd *prev;
{
- oasys_ar_data_type *ar = OASYS_AR_DATA(arch);
+ oasys_ar_data_type *ar = OASYS_AR_DATA (arch);
oasys_module_info_type *p;
/* take the next one from the arch state, or reset */
- if (prev == (bfd *)NULL) {
- /* Reset the index - the first two entries are bogus*/
- ar->module_index = 0;
- }
+ if (prev == (bfd *) NULL)
+ {
+ /* Reset the index - the first two entries are bogus*/
+ ar->module_index = 0;
+ }
p = ar->module + ar->module_index;
ar->module_index++;
- if (ar->module_index <= ar->module_count) {
- if (p->abfd == (bfd *)NULL) {
- p->abfd = _bfd_create_empty_archive_element_shell(arch);
- p->abfd->origin = p->pos;
- p->abfd->filename = p->name;
+ if (ar->module_index <= ar->module_count)
+ {
+ if (p->abfd == (bfd *) NULL)
+ {
+ p->abfd = _bfd_create_empty_archive_element_shell (arch);
+ p->abfd->origin = p->pos;
+ p->abfd->filename = p->name;
- /* Fixup a pointer to this element for the member */
- p->abfd->arelt_data = (PTR)p;
+ /* Fixup a pointer to this element for the member */
+ p->abfd->arelt_data = (PTR) p;
+ }
+ return p->abfd;
+ }
+ else
+ {
+ bfd_set_error (bfd_error_no_more_archived_files);
+ return (bfd *) NULL;
}
- return p->abfd;
- }
- else {
- bfd_error = no_more_archived_files;
- return (bfd *)NULL;
- }
}
static boolean
-oasys_find_nearest_line(abfd,
+oasys_find_nearest_line (abfd,
section,
symbols,
offset,
filename_ptr,
functionname_ptr,
line_ptr)
-bfd *abfd;
-asection *section;
-asymbol **symbols;
-bfd_vma offset;
-char **filename_ptr;
-char **functionname_ptr;
-unsigned int *line_ptr;
+ bfd *abfd;
+ asection *section;
+ asymbol **symbols;
+ bfd_vma offset;
+ char **filename_ptr;
+ char **functionname_ptr;
+ unsigned int *line_ptr;
{
return false;
}
static int
-DEFUN(oasys_generic_stat_arch_elt,(abfd, buf),
- bfd *abfd AND
- struct stat *buf)
+oasys_generic_stat_arch_elt (abfd, buf)
+ bfd *abfd;
+ struct stat *buf;
{
oasys_module_info_type *mod = (oasys_module_info_type *) abfd->arelt_data;
- if (mod == (oasys_module_info_type *)NULL) {
- bfd_error = invalid_operation;
- return -1;
- }
- else {
- buf->st_size = mod->size;
- buf->st_mode = 0666;
- return 0;
- }
+ if (mod == (oasys_module_info_type *) NULL)
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return -1;
+ }
+ else
+ {
+ buf->st_size = mod->size;
+ buf->st_mode = 0666;
+ return 0;
+ }
}
-static int
-DEFUN(oasys_sizeof_headers,(abfd, exec),
- bfd *abfd AND
- boolean exec)
+static int
+oasys_sizeof_headers (abfd, exec)
+ bfd *abfd;
+ boolean exec;
{
-return 0;
+ return 0;
}
#define FOO PROTO
#define oasys_core_file_failing_command (char *(*)())(bfd_nullvoidptr)
#define oasys_core_file_failing_signal (int (*)())bfd_0
-#define oasys_core_file_matches_executable_p 0
+#define oasys_core_file_matches_executable_p 0
#define oasys_slurp_armap bfd_true
#define oasys_slurp_extended_name_table bfd_true
#define oasys_truncate_arname (void (*)())bfd_nullvoidptr
@@ -1377,36 +1446,36 @@ bfd_target oasys_vec =
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_CODE|SEC_DATA|SEC_ROM|SEC_HAS_CONTENTS
- |SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
- 0, /* leading underscore */
+ (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
+ | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
+ 0, /* leading underscore */
' ', /* ar_pad_char */
16, /* ar_max_namelen */
1, /* minimum alignment */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
+ bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+ bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
- {_bfd_dummy_target,
- oasys_object_p, /* bfd_check_format */
- oasys_archive_p,
- _bfd_dummy_target,
- },
- { /* bfd_set_format */
- bfd_false,
- oasys_mkobject,
- _bfd_generic_mkarchive,
- bfd_false
- },
- { /* bfd_write_contents */
- bfd_false,
- oasys_write_object_contents,
- _bfd_write_archive_contents,
- bfd_false,
- },
- JUMP_TABLE(oasys),
+ bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+ bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
+
+ {_bfd_dummy_target,
+ oasys_object_p, /* bfd_check_format */
+ oasys_archive_p,
+ _bfd_dummy_target,
+ },
+ { /* bfd_set_format */
+ bfd_false,
+ oasys_mkobject,
+ _bfd_generic_mkarchive,
+ bfd_false
+ },
+ { /* bfd_write_contents */
+ bfd_false,
+ oasys_write_object_contents,
+ _bfd_write_archive_contents,
+ bfd_false,
+ },
+ JUMP_TABLE (oasys),
(PTR) 0
};
diff --git a/bfd/section.c b/bfd/section.c
index 5d13335..e9fbcf9 100644
--- a/bfd/section.c
+++ b/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 = &sect->next;
- sect = sect->next;
- }
+ while (sect)
+ {
+ prev = &sect->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;
-
- 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;
- }
-
- while (sect) {
- if (!strcmp(sect->name, name)) return NULL;
- sect = sect->next;
- }
+ 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_IND_SECTION_NAME) == 0)
+ {
+ return &bfd_ind_section;
+ }
+
+ 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;
}
diff --git a/bfd/srec.c b/bfd/srec.c
index c4a1ce5..3379ba4 100644
--- a/bfd/srec.c
+++ b/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)
diff --git a/bfd/syms.c b/bfd/syms.c
index cb799c6..4154cbf 100644
--- a/bfd/syms.c
+++ b/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 ();
}
-
diff --git a/bfd/targets.c b/bfd/targets.c
index c52a3e6..ddba2bf 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -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