aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog38
-rw-r--r--bfd/aout-adobe.c371
-rw-r--r--bfd/aout-arm.c412
-rw-r--r--bfd/aout-cris.c102
-rw-r--r--bfd/aout-ns32k.c289
-rw-r--r--bfd/aout-tic30.c556
-rw-r--r--bfd/coffcode.h860
-rw-r--r--bfd/coffgen.c2
-rw-r--r--bfd/coffswap.h159
-rw-r--r--bfd/i386aout.c86
-rw-r--r--bfd/libaout.h254
-rw-r--r--bfd/libcoff-in.h216
-rw-r--r--bfd/libcoff.h306
-rw-r--r--bfd/libecoff.h115
-rw-r--r--bfd/libnlm.h190
-rw-r--r--bfd/libpei.h76
-rw-r--r--bfd/libxcoff.h126
-rw-r--r--bfd/nlm-target.h226
-rw-r--r--bfd/nlm.c42
-rw-r--r--bfd/nlm32-alpha.c605
-rw-r--r--bfd/nlm32-i386.c168
-rw-r--r--bfd/nlm32-ppc.c914
-rw-r--r--bfd/nlm32-sparc.c219
-rw-r--r--bfd/nlmcode.h850
-rw-r--r--bfd/nlmswap.h48
-rw-r--r--bfd/pe-mips.c552
-rw-r--r--bfd/peXXigen.c271
-rw-r--r--bfd/peicode.h168
-rw-r--r--bfd/vms-gsd.c877
-rw-r--r--bfd/vms-hdr.c280
-rw-r--r--bfd/vms-misc.c463
-rw-r--r--bfd/vms-tir.c598
-rw-r--r--bfd/vms.c1412
-rw-r--r--bfd/vms.h840
34 files changed, 5624 insertions, 7067 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 73258a5..9bacdd8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,41 @@
+2005-04-21 Nick Clifton <nickc@redhat.com>
+
+ * aout-adobe.c: Convert to ISO C and fix formatting.
+ * aout-arm.c: Convert to ISO C and fix formatting.
+ * aout-cris.c: Convert to ISO C and fix formatting.
+ * aout-ns32k.c: Convert to ISO C and fix formatting.
+ * aout-tic30.c: Convert to ISO C and fix formatting.
+ * coffcode.h: Convert to ISO C and fix formatting.
+ * coffswap.h: Convert to ISO C and fix formatting.
+ * i386aout.c: Convert to ISO C and fix formatting.
+ * libaout.h: Convert to ISO C and fix formatting.
+ * libcoff-in.h: Convert to ISO C and fix formatting.
+ * libcoff.h: Convert to ISO C and fix formatting.
+ * libecoff.h: Convert to ISO C and fix formatting.
+ * libnlm.h: Convert to ISO C and fix formatting.
+ * libpei.h: Convert to ISO C and fix formatting.
+ * libxcoff.h: Convert to ISO C and fix formatting.
+ * nlm-target.h: Convert to ISO C and fix formatting.
+ * nlm.c: Convert to ISO C and fix formatting.
+ * nlm32-alpha.c: Convert to ISO C and fix formatting.
+ * nlm32-i386.c: Convert to ISO C and fix formatting.
+ * nlm32-ppc.c: Convert to ISO C and fix formatting.
+ * nlm32-sparc.c: Convert to ISO C and fix formatting.
+ * nlmcode.h: Convert to ISO C and fix formatting.
+ * nlmswap.h: Convert to ISO C and fix formatting.
+ * pe-mips.c: Convert to ISO C and fix formatting.
+ * peXXigen.c: Convert to ISO C and fix formatting.
+ * peicode.h: Convert to ISO C and fix formatting.
+ * vms-gsd.c: Convert to ISO C and fix formatting.
+ * vms-hdr.c: Convert to ISO C and fix formatting.
+ * vms-misc.c: Convert to ISO C and fix formatting.
+ * vms-tir.c: Convert to ISO C and fix formatting.
+ * vms.c: Convert to ISO C and fix formatting.
+ * vms.h: Convert to ISO C and fix formatting.
+
+ * coffgen.c (coff_print_symbol): Restore correct formatting of
+ output.
+
2005-04-20 David S. Miller <davem@davemloft.net>
* elfxx-sparc.c (sparc_elf_r_symndx_64): Fix compiler warning.
diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c
index 9277bc0..de3667e 100644
--- a/bfd/aout-adobe.c
+++ b/bfd/aout-adobe.c
@@ -1,72 +1,43 @@
/* BFD back-end for a.out.adobe binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004
+ 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Written by Cygnus Support. Based on bout.c.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
-
#include "aout/adobe.h"
-
#include "aout/stab_gnu.h"
#include "libaout.h" /* BFD a.out internal data structures. */
/* Forward decl. */
extern const bfd_target a_out_adobe_vec;
-static const bfd_target *aout_adobe_callback
- PARAMS ((bfd *));
-extern bfd_boolean aout_32_slurp_symbol_table
- PARAMS ((bfd *abfd));
-extern bfd_boolean aout_32_write_syms
- PARAMS ((bfd *));
-static void aout_adobe_write_section
- PARAMS ((bfd *abfd, sec_ptr sect));
-static const bfd_target * aout_adobe_object_p
- PARAMS ((bfd *));
-static bfd_boolean aout_adobe_mkobject
- PARAMS ((bfd *));
-static bfd_boolean aout_adobe_write_object_contents
- PARAMS ((bfd *));
-static bfd_boolean aout_adobe_set_section_contents
- PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type));
-static bfd_boolean aout_adobe_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-static int aout_adobe_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
-
/* Swaps the information in an executable header taken from a raw byte
stream memory image, into the internal exec_header structure. */
-void aout_adobe_swap_exec_header_in
- PARAMS ((bfd *, struct external_exec *, struct internal_exec *));
-
-void
-aout_adobe_swap_exec_header_in (abfd, raw_bytes, execp)
- bfd *abfd;
- struct external_exec *raw_bytes;
- struct internal_exec *execp;
+static void
+aout_adobe_swap_exec_header_in (bfd *abfd,
+ struct external_exec *bytes,
+ struct internal_exec *execp)
{
- struct external_exec *bytes = (struct external_exec *) raw_bytes;
-
/* Now fill in fields in the execp, from the bytes in the raw data. */
execp->a_info = H_GET_32 (abfd, bytes->e_info);
execp->a_text = GET_WORD (abfd, bytes->e_text);
@@ -81,17 +52,11 @@ aout_adobe_swap_exec_header_in (abfd, raw_bytes, execp)
/* Swaps the information in an internal exec header structure into the
supplied buffer ready for writing to disk. */
-void aout_adobe_swap_exec_header_out
- PARAMS ((bfd *, struct internal_exec *, struct external_exec *));
-
-void
-aout_adobe_swap_exec_header_out (abfd, execp, raw_bytes)
- bfd *abfd;
- struct internal_exec *execp;
- struct external_exec *raw_bytes;
+static void
+aout_adobe_swap_exec_header_out (bfd *abfd,
+ struct internal_exec *execp,
+ struct external_exec *bytes)
{
- struct external_exec *bytes = (struct external_exec *) raw_bytes;
-
/* Now fill in fields in the raw data, from the fields in the exec
struct. */
H_PUT_32 (abfd, execp->a_info , bytes->e_info);
@@ -104,53 +69,11 @@ aout_adobe_swap_exec_header_out (abfd, execp, raw_bytes)
PUT_WORD (abfd, execp->a_drsize, bytes->e_drsize);
}
-static const bfd_target *
-aout_adobe_object_p (abfd)
- bfd *abfd;
-{
- struct internal_exec anexec;
- struct external_exec exec_bytes;
- char *targ;
- bfd_size_type amt = EXEC_BYTES_SIZE;
-
- if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- return 0;
- }
-
- anexec.a_info = H_GET_32 (abfd, exec_bytes.e_info);
-
- /* Normally we just compare for the magic number.
- However, a bunch of Adobe tools aren't fixed up yet; they generate
- files using ZMAGIC(!).
- If the environment variable GNUTARGET is set to "a.out.adobe", we will
- take just about any a.out file as an Adobe a.out file. FIXME! */
-
- if (N_BADMAG (anexec))
- {
- targ = getenv ("GNUTARGET");
- if (targ && !strcmp (targ, a_out_adobe_vec.name))
- /* Just continue anyway, if specifically set to this format. */
- ;
- else
- {
- bfd_set_error (bfd_error_wrong_format);
- return 0;
- }
- }
-
- aout_adobe_swap_exec_header_in (abfd, &exec_bytes, &anexec);
- return aout_32_some_aout_object_p (abfd, &anexec, aout_adobe_callback);
-}
-
/* Finish up the opening of a b.out file for reading. Fill in all the
fields that are not handled by common code. */
static const bfd_target *
-aout_adobe_callback (abfd)
- bfd *abfd;
+aout_adobe_callback (bfd *abfd)
{
struct internal_exec *execp = exec_hdr (abfd);
asection *sect;
@@ -172,12 +95,12 @@ aout_adobe_callback (abfd)
for (;;)
{
bfd_size_type amt = sizeof (*ext);
- if (bfd_bread ((PTR) ext, amt, abfd) != amt)
+ if (bfd_bread ( ext, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
- return 0;
+ return NULL;
}
switch (ext->e_type[0])
{
@@ -216,7 +139,7 @@ aout_adobe_callback (abfd)
{
if (bfd_get_error () != bfd_error_no_error)
/* Some other error -- slide into the sunset. */
- return 0;
+ return NULL;
sprintf (try_again, "%s%d", section_name, ++trynum);
sect = bfd_make_section (abfd, try_again);
}
@@ -225,9 +148,9 @@ aout_adobe_callback (abfd)
if (sect->name == try_again)
{
amt = strlen (sect->name);
- newname = (char *) bfd_zalloc (abfd, amt);
+ newname = bfd_zalloc (abfd, amt);
if (newname == NULL)
- return 0;
+ return NULL;
strcpy (newname, sect->name);
sect->name = newname;
}
@@ -271,20 +194,59 @@ aout_adobe_callback (abfd)
return abfd->xvec;
}
+static const bfd_target *
+aout_adobe_object_p (bfd *abfd)
+{
+ struct internal_exec anexec;
+ struct external_exec exec_bytes;
+ char *targ;
+ bfd_size_type amt = EXEC_BYTES_SIZE;
+
+ if (bfd_bread (& exec_bytes, amt, abfd) != amt)
+ {
+ if (bfd_get_error () != bfd_error_system_call)
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+
+ anexec.a_info = H_GET_32 (abfd, exec_bytes.e_info);
+
+ /* Normally we just compare for the magic number.
+ However, a bunch of Adobe tools aren't fixed up yet; they generate
+ files using ZMAGIC(!).
+ If the environment variable GNUTARGET is set to "a.out.adobe", we will
+ take just about any a.out file as an Adobe a.out file. FIXME! */
+
+ if (N_BADMAG (anexec))
+ {
+ targ = getenv ("GNUTARGET");
+ if (targ && !strcmp (targ, a_out_adobe_vec.name))
+ /* Just continue anyway, if specifically set to this format. */
+ ;
+ else
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+ }
+
+ aout_adobe_swap_exec_header_in (abfd, &exec_bytes, &anexec);
+ return aout_32_some_aout_object_p (abfd, &anexec, aout_adobe_callback);
+}
+
struct bout_data_struct
- {
- struct aoutdata a;
- struct internal_exec e;
- };
+{
+ struct aoutdata a;
+ struct internal_exec e;
+};
static bfd_boolean
-aout_adobe_mkobject (abfd)
- bfd *abfd;
+aout_adobe_mkobject (bfd *abfd)
{
struct bout_data_struct *rawptr;
bfd_size_type amt = sizeof (struct bout_data_struct);
- rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, amt);
+ rawptr = bfd_zalloc (abfd, amt);
if (rawptr == NULL)
return FALSE;
@@ -300,9 +262,15 @@ aout_adobe_mkobject (abfd)
return TRUE;
}
+static void
+aout_adobe_write_section (bfd *abfd ATTRIBUTE_UNUSED,
+ sec_ptr sect ATTRIBUTE_UNUSED)
+{
+ /* FIXME XXX. */
+}
+
static bfd_boolean
-aout_adobe_write_object_contents (abfd)
- bfd *abfd;
+aout_adobe_write_object_contents (bfd *abfd)
{
struct external_exec swapped_hdr;
static struct external_segdesc sentinel[1]; /* Initialized to zero. */
@@ -312,7 +280,6 @@ aout_adobe_write_object_contents (abfd)
exec_hdr (abfd)->a_info = ZMAGIC;
/* Calculate text size as total of text sections, etc. */
-
exec_hdr (abfd)->a_text = 0;
exec_hdr (abfd)->a_data = 0;
exec_hdr (abfd)->a_bss = 0;
@@ -334,9 +301,7 @@ aout_adobe_write_object_contents (abfd)
sizeof (struct reloc_std_external);
}
else if (sect->flags & SEC_ALLOC && !(sect->flags & SEC_LOAD))
- {
- exec_hdr (abfd)->a_bss += sect->size;
- }
+ exec_hdr (abfd)->a_bss += sect->size;
}
exec_hdr (abfd)->a_syms = bfd_get_symcount (abfd)
@@ -347,12 +312,11 @@ aout_adobe_write_object_contents (abfd)
amt = EXEC_BYTES_SIZE;
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bwrite ((PTR) &swapped_hdr, amt, abfd) != amt)
+ || bfd_bwrite (& swapped_hdr, amt, abfd) != amt)
return FALSE;
/* Now write out the section information. Text first, data next, rest
afterward. */
-
for (sect = abfd->sections; sect; sect = sect->next)
if (sect->flags & SEC_CODE)
aout_adobe_write_section (abfd, sect);
@@ -367,7 +331,7 @@ aout_adobe_write_object_contents (abfd)
/* Write final `sentinel` section header (with type of 0). */
amt = sizeof (*sentinel);
- if (bfd_bwrite ((PTR) sentinel, amt, abfd) != amt)
+ if (bfd_bwrite (sentinel, amt, abfd) != amt)
return FALSE;
/* Now write out reloc info, followed by syms and strings. */
@@ -401,22 +365,13 @@ aout_adobe_write_object_contents (abfd)
return TRUE;
}
-
-static void
-aout_adobe_write_section (abfd, sect)
- bfd *abfd ATTRIBUTE_UNUSED;
- sec_ptr sect ATTRIBUTE_UNUSED;
-{
- /* FIXME XXX */
-}
static bfd_boolean
-aout_adobe_set_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- asection *section;
- const PTR location;
- file_ptr offset;
- bfd_size_type count;
+aout_adobe_set_section_contents (bfd *abfd,
+ asection *section,
+ const void * location,
+ file_ptr offset,
+ bfd_size_type count)
{
file_ptr section_start;
sec_ptr sect;
@@ -468,14 +423,13 @@ aout_adobe_set_section_contents (abfd, section, location, offset, count)
if (count == 0)
return TRUE;
- return bfd_bwrite ((PTR) location, count, abfd) == count;
+ return bfd_bwrite (location, count, abfd) == count;
}
static bfd_boolean
-aout_adobe_set_arch_mach (abfd, arch, machine)
- bfd *abfd;
- enum bfd_architecture arch;
- unsigned long machine;
+aout_adobe_set_arch_mach (bfd *abfd,
+ enum bfd_architecture arch,
+ unsigned long machine)
{
if (! bfd_default_set_arch_mach (abfd, arch, machine))
return FALSE;
@@ -488,86 +442,75 @@ aout_adobe_set_arch_mach (abfd, arch, machine)
}
static int
-aout_adobe_sizeof_headers (ignore_abfd, ignore)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- bfd_boolean ignore ATTRIBUTE_UNUSED;
+aout_adobe_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED,
+ bfd_boolean ignore ATTRIBUTE_UNUSED)
{
return sizeof (struct internal_exec);
}
/* Build the transfer vector for Adobe A.Out files. */
-#define aout_32_close_and_cleanup aout_32_bfd_free_cached_info
-
-#define aout_32_bfd_make_debug_symbol \
- ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
-
-#define aout_32_bfd_reloc_type_lookup \
- ((reloc_howto_type *(*) \
- PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr)
-
-#define aout_32_set_arch_mach aout_adobe_set_arch_mach
-#define aout_32_set_section_contents aout_adobe_set_section_contents
-
-#define aout_32_sizeof_headers aout_adobe_sizeof_headers
-#define aout_32_bfd_get_relocated_section_contents \
- bfd_generic_get_relocated_section_contents
-#define aout_32_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
-#define aout_32_bfd_relax_section bfd_generic_relax_section
-#define aout_32_bfd_gc_sections bfd_generic_gc_sections
-#define aout_32_bfd_merge_sections bfd_generic_merge_sections
-#define aout_32_bfd_is_group_section bfd_generic_is_group_section
-#define aout_32_bfd_discard_group bfd_generic_discard_group
-#define aout_32_section_already_linked \
- _bfd_generic_section_already_linked
-#define aout_32_bfd_link_hash_table_create \
- _bfd_generic_link_hash_table_create
-#define aout_32_bfd_link_hash_table_free \
- _bfd_generic_link_hash_table_free
-#define aout_32_bfd_link_add_symbols _bfd_generic_link_add_symbols
-#define aout_32_bfd_link_just_syms _bfd_generic_link_just_syms
-#define aout_32_bfd_final_link _bfd_generic_final_link
-#define aout_32_bfd_link_split_section _bfd_generic_link_split_section
+#define aout_32_bfd_make_debug_symbol ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr)
+#define aout_32_bfd_reloc_type_lookup ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr)
+#define aout_32_close_and_cleanup aout_32_bfd_free_cached_info
+#define aout_32_set_arch_mach aout_adobe_set_arch_mach
+#define aout_32_set_section_contents aout_adobe_set_section_contents
+#define aout_32_sizeof_headers aout_adobe_sizeof_headers
+#define aout_32_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
+#define aout_32_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
+#define aout_32_bfd_relax_section bfd_generic_relax_section
+#define aout_32_bfd_gc_sections bfd_generic_gc_sections
+#define aout_32_bfd_merge_sections bfd_generic_merge_sections
+#define aout_32_bfd_is_group_section bfd_generic_is_group_section
+#define aout_32_bfd_discard_group bfd_generic_discard_group
+#define aout_32_section_already_linked _bfd_generic_section_already_linked
+#define aout_32_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
+#define aout_32_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
+#define aout_32_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define aout_32_bfd_link_just_syms _bfd_generic_link_just_syms
+#define aout_32_bfd_final_link _bfd_generic_final_link
+#define aout_32_bfd_link_split_section _bfd_generic_link_split_section
const bfd_target a_out_adobe_vec =
- {
- "a.out.adobe", /* name */
- bfd_target_aout_flavour,
- BFD_ENDIAN_BIG, /* data byte order is unknown (big assumed) */
- BFD_ENDIAN_BIG, /* hdr byte order is big */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT ),
- /* section flags */
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_DATA | SEC_RELOC),
- '_', /* symbol leading char */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
-
- 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_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, aout_adobe_object_p, /* bfd_check_format */
- bfd_generic_archive_p, _bfd_dummy_target},
- {bfd_false, aout_adobe_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, aout_adobe_write_object_contents,/* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (aout_32),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd),
- BFD_JUMP_TABLE_SYMBOLS (aout_32),
- BFD_JUMP_TABLE_RELOCS (aout_32),
- BFD_JUMP_TABLE_WRITE (aout_32),
- BFD_JUMP_TABLE_LINK (aout_32),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- (PTR) 0
- };
+{
+ "a.out.adobe", /* Name. */
+ bfd_target_aout_flavour,
+ BFD_ENDIAN_BIG, /* Data byte order is unknown (big assumed). */
+ BFD_ENDIAN_BIG, /* Header byte order is big. */
+ (HAS_RELOC | EXEC_P | /* Object flags. */
+ HAS_LINENO | HAS_DEBUG |
+ HAS_SYMS | HAS_LOCALS | WP_TEXT ),
+ /* section flags */
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_DATA | SEC_RELOC),
+ '_', /* Symbol leading char. */
+ ' ', /* AR_pad_char. */
+ 16, /* AR_max_namelen. */
+
+ 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_getb64, bfd_getb_signed_64, bfd_putb64,
+ bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+ bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
+
+ {_bfd_dummy_target, aout_adobe_object_p, /* bfd_check_format. */
+ bfd_generic_archive_p, _bfd_dummy_target},
+ {bfd_false, aout_adobe_mkobject, /* bfd_set_format. */
+ _bfd_generic_mkarchive, bfd_false},
+ {bfd_false, aout_adobe_write_object_contents,/* bfd_write_contents. */
+ _bfd_write_archive_contents, bfd_false},
+
+ BFD_JUMP_TABLE_GENERIC (aout_32),
+ BFD_JUMP_TABLE_COPY (_bfd_generic),
+ BFD_JUMP_TABLE_CORE (_bfd_nocore),
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd),
+ BFD_JUMP_TABLE_SYMBOLS (aout_32),
+ BFD_JUMP_TABLE_RELOCS (aout_32),
+ BFD_JUMP_TABLE_WRITE (aout_32),
+ BFD_JUMP_TABLE_LINK (aout_32),
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+ NULL,
+
+ NULL
+};
diff --git a/bfd/aout-arm.c b/bfd/aout-arm.c
index 0cdadf1..034e2a1 100644
--- a/bfd/aout-arm.c
+++ b/bfd/aout-arm.c
@@ -3,21 +3,21 @@
Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -54,66 +54,49 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libaout.h"
#include "aout/aout64.h"
-static bfd_boolean MY(write_object_contents)
- PARAMS ((bfd *));
-static bfd_reloc_status_type MY(fix_pcrel_26_done)
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type MY(fix_pcrel_26)
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static void MY(swap_std_reloc_in)
- PARAMS ((bfd *, struct reloc_std_external *, arelent *, asymbol **,
- bfd_size_type));
-reloc_howto_type *MY(bfd_reloc_type_lookup)
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-reloc_howto_type * MY(reloc_howto)
- PARAMS ((bfd *, struct reloc_std_external *, int *, int *, int *));
-void MY(put_reloc)
- PARAMS ((bfd *, int, int, bfd_vma, reloc_howto_type *,
- struct reloc_std_external *));
-void MY(relocatable_reloc)
- PARAMS ((reloc_howto_type *, bfd *, struct reloc_std_external *, bfd_vma *,
- bfd_vma));
-void MY(swap_std_reloc_out)
- PARAMS ((bfd *, arelent *, struct reloc_std_external *));
-reloc_howto_type MY(howto_table)[] =
- {
- /* Type rs size bsz pcrel bitpos ovrf sf name part_inpl
- readmask setmask pcdone. */
- HOWTO (0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, "8", TRUE,
- 0x000000ff, 0x000000ff, FALSE),
- HOWTO (1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, 0, "16", TRUE,
- 0x0000ffff, 0x0000ffff, FALSE),
- HOWTO (2, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "32", TRUE,
- 0xffffffff, 0xffffffff, FALSE),
- HOWTO (3, 2, 2, 26, TRUE, 0, complain_overflow_signed, MY(fix_pcrel_26),
- "ARM26", TRUE, 0x00ffffff, 0x00ffffff, TRUE),
- HOWTO (4, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0, "DISP8", TRUE,
- 0x000000ff, 0x000000ff, TRUE),
- HOWTO (5, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "DISP16", TRUE,
- 0x0000ffff, 0x0000ffff, TRUE),
- HOWTO (6, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0, "DISP32", TRUE,
- 0xffffffff, 0xffffffff, TRUE),
- HOWTO (7, 2, 2, 26, FALSE, 0, complain_overflow_signed,
- MY(fix_pcrel_26_done), "ARM26D", TRUE, 0x0, 0x0,
- FALSE),
- EMPTY_HOWTO (-1),
- HOWTO (9, 0, -1, 16, FALSE, 0, complain_overflow_bitfield, 0, "NEG16", TRUE,
- 0x0000ffff, 0x0000ffff, FALSE),
- HOWTO (10, 0, -2, 32, FALSE, 0, complain_overflow_bitfield, 0, "NEG32", TRUE,
- 0xffffffff, 0xffffffff, FALSE)
- };
+static bfd_reloc_status_type
+ MY (fix_pcrel_26) (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type
+ MY (fix_pcrel_26_done) (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+
+reloc_howto_type MY (howto_table)[] =
+{
+ /* Type rs size bsz pcrel bitpos ovrf sf name part_inpl
+ readmask setmask pcdone. */
+ HOWTO (0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, "8", TRUE,
+ 0x000000ff, 0x000000ff, FALSE),
+ HOWTO (1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, 0, "16", TRUE,
+ 0x0000ffff, 0x0000ffff, FALSE),
+ HOWTO (2, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "32", TRUE,
+ 0xffffffff, 0xffffffff, FALSE),
+ HOWTO (3, 2, 2, 26, TRUE, 0, complain_overflow_signed, MY (fix_pcrel_26),
+ "ARM26", TRUE, 0x00ffffff, 0x00ffffff, TRUE),
+ HOWTO (4, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0, "DISP8", TRUE,
+ 0x000000ff, 0x000000ff, TRUE),
+ HOWTO (5, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "DISP16", TRUE,
+ 0x0000ffff, 0x0000ffff, TRUE),
+ HOWTO (6, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0, "DISP32", TRUE,
+ 0xffffffff, 0xffffffff, TRUE),
+ HOWTO (7, 2, 2, 26, FALSE, 0, complain_overflow_signed,
+ MY (fix_pcrel_26_done), "ARM26D", TRUE, 0x0, 0x0,
+ FALSE),
+ EMPTY_HOWTO (-1),
+ HOWTO (9, 0, -1, 16, FALSE, 0, complain_overflow_bitfield, 0, "NEG16", TRUE,
+ 0x0000ffff, 0x0000ffff, FALSE),
+ HOWTO (10, 0, -2, 32, FALSE, 0, complain_overflow_bitfield, 0, "NEG32", TRUE,
+ 0xffffffff, 0xffffffff, FALSE)
+};
#define RELOC_ARM_BITS_NEG_BIG ((unsigned int) 0x08)
#define RELOC_ARM_BITS_NEG_LITTLE ((unsigned int) 0x10)
-reloc_howto_type *
-MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel)
- bfd *abfd;
- struct reloc_std_external *rel;
- int *r_index;
- int *r_extern;
- int *r_pcrel;
+static reloc_howto_type *
+MY (reloc_howto) (bfd *abfd,
+ struct reloc_std_external *rel,
+ int *r_index,
+ int *r_extern,
+ int *r_pcrel)
{
unsigned int r_length;
unsigned int r_pcrel_done;
@@ -147,20 +130,19 @@ MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel)
if (index == 3)
*r_pcrel = 1;
- return MY(howto_table) + index;
+ return MY (howto_table) + index;
}
#define MY_reloc_howto(BFD, REL, IN, EX, PC) \
- MY(reloc_howto) (BFD, REL, &IN, &EX, &PC)
+ MY (reloc_howto) (BFD, REL, &IN, &EX, &PC)
-void
-MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc)
- bfd *abfd;
- int r_extern;
- int r_index;
- bfd_vma value;
- reloc_howto_type *howto;
- struct reloc_std_external *reloc;
+static void
+MY (put_reloc) (bfd *abfd,
+ int r_extern,
+ int r_index,
+ bfd_vma value,
+ reloc_howto_type *howto,
+ struct reloc_std_external *reloc)
{
unsigned int r_length;
int r_pcrel;
@@ -202,25 +184,22 @@ MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc)
}
#define MY_put_reloc(BFD, EXT, IDX, VAL, HOWTO, RELOC) \
- MY(put_reloc) (BFD, EXT, IDX, VAL, HOWTO, RELOC)
+ MY (put_reloc) (BFD, EXT, IDX, VAL, HOWTO, RELOC)
-void
-MY(relocatable_reloc) (howto, abfd, reloc, amount, r_addr)
- reloc_howto_type *howto;
- bfd *abfd;
- struct reloc_std_external *reloc;
- bfd_vma *amount;
- bfd_vma r_addr;
+static void
+MY (relocatable_reloc) (reloc_howto_type *howto,
+ bfd *abfd,
+ struct reloc_std_external *reloc,
+ bfd_vma *amount,
+ bfd_vma r_addr)
{
if (howto->type == 3)
{
if (reloc->r_type[0]
& (bfd_header_big_endian (abfd)
? RELOC_STD_BITS_EXTERN_BIG : RELOC_STD_BITS_EXTERN_LITTLE))
- {
- /* The reloc is still external, so don't modify anything. */
- *amount = 0;
- }
+ /* The reloc is still external, so don't modify anything. */
+ *amount = 0;
else
{
*amount -= r_addr;
@@ -237,33 +216,29 @@ MY(relocatable_reloc) (howto, abfd, reloc, amount, r_addr)
}
#define MY_relocatable_reloc(HOW, BFD, REL, AMOUNT, ADDR) \
- MY(relocatable_reloc) (HOW, BFD, REL, &(AMOUNT), ADDR)
+ MY (relocatable_reloc) (HOW, BFD, REL, &(AMOUNT), ADDR)
static bfd_reloc_status_type
-MY(fix_pcrel_26_done) (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry ATTRIBUTE_UNUSED;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- char **error_message ATTRIBUTE_UNUSED;
+MY (fix_pcrel_26_done) (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *reloc_entry ATTRIBUTE_UNUSED,
+ asymbol *symbol ATTRIBUTE_UNUSED,
+ void * data ATTRIBUTE_UNUSED,
+ asection *input_section ATTRIBUTE_UNUSED,
+ bfd *output_bfd ATTRIBUTE_UNUSED,
+ char **error_message ATTRIBUTE_UNUSED)
{
/* This is dead simple at present. */
return bfd_reloc_ok;
}
static bfd_reloc_status_type
-MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
+MY (fix_pcrel_26) (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
{
bfd_vma relocation;
bfd_size_type addr = reloc_entry->address;
@@ -278,7 +253,7 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
/* If the sections are different, and we are doing a partial relocation,
just ignore it for now. */
if (symbol->section->name != input_section->name
- && output_bfd != (bfd *)NULL)
+ && output_bfd != NULL)
return bfd_reloc_ok;
relocation = (target & 0x00ffffff) << 2;
@@ -308,17 +283,17 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
/* Now the ARM magic... Change the reloc type so that it is marked as done.
Strictly this is only necessary if we are doing a partial relocation. */
- reloc_entry->howto = &MY(howto_table)[7];
+ reloc_entry->howto = &MY (howto_table)[7];
return flag;
}
-reloc_howto_type *
-MY(bfd_reloc_type_lookup) (abfd,code)
- bfd *abfd;
- bfd_reloc_code_real_type code;
+static reloc_howto_type *
+MY (bfd_reloc_type_lookup) (bfd *abfd,
+ bfd_reloc_code_real_type code)
{
-#define ASTD(i,j) case i: return &MY(howto_table)[j]
+#define ASTD(i,j) case i: return & MY (howto_table)[j]
+
if (code == BFD_RELOC_CTOR)
switch (bfd_get_arch_info (abfd)->bits_per_address)
{
@@ -326,7 +301,7 @@ MY(bfd_reloc_type_lookup) (abfd,code)
code = BFD_RELOC_32;
break;
default:
- return (const struct reloc_howto_struct *) 0;
+ return NULL;
}
switch (code)
@@ -338,26 +313,25 @@ MY(bfd_reloc_type_lookup) (abfd,code)
ASTD (BFD_RELOC_16_PCREL, 5);
ASTD (BFD_RELOC_32_PCREL, 6);
default:
- return (const struct reloc_howto_struct *) 0;
+ return NULL;
}
}
-#define MY_swap_std_reloc_in MY(swap_std_reloc_in)
-#define MY_swap_std_reloc_out MY(swap_std_reloc_out)
-#define MY_get_section_contents _bfd_generic_get_section_contents
-/* #define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create */
-/* #define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols */
-/* #define MY_bfd_final_link _bfd_generic_final_link */
+#define MY_swap_std_reloc_in MY (swap_std_reloc_in)
+#define MY_swap_std_reloc_out MY (swap_std_reloc_out)
+#define MY_get_section_contents _bfd_generic_get_section_contents
+
+void MY_swap_std_reloc_in (bfd *, struct reloc_std_external *, arelent *, asymbol **, bfd_size_type);
+void MY_swap_std_reloc_out (bfd *, arelent *, struct reloc_std_external *);
#include "aoutx.h"
-static void
-MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
- bfd *abfd;
- struct reloc_std_external *bytes;
- arelent *cache_ptr;
- asymbol **symbols;
- bfd_size_type symcount ATTRIBUTE_UNUSED;
+void
+MY_swap_std_reloc_in (bfd *abfd,
+ struct reloc_std_external *bytes,
+ arelent *cache_ptr,
+ asymbol **symbols,
+ bfd_size_type symcount ATTRIBUTE_UNUSED)
{
int r_index;
int r_extern;
@@ -372,10 +346,9 @@ MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
}
void
-MY_swap_std_reloc_out (abfd, g, natptr)
- bfd *abfd;
- arelent *g;
- struct reloc_std_external *natptr;
+MY_swap_std_reloc_out (bfd *abfd,
+ arelent *g,
+ struct reloc_std_external *natptr)
{
int r_index;
asymbol *sym = *(g->sym_ptr_ptr);
@@ -385,21 +358,19 @@ MY_swap_std_reloc_out (abfd, g, natptr)
int r_neg = 0; /* Negative relocs use the BASEREL bit. */
asection *output_section = sym->section->output_section;
- PUT_WORD(abfd, g->address, natptr->r_address);
+ PUT_WORD (abfd, g->address, natptr->r_address);
- r_length = g->howto->size ; /* Size as a power of two */
+ r_length = g->howto->size ; /* Size as a power of two. */
if (r_length < 0)
{
r_length = -r_length;
r_neg = 1;
}
- r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
+ r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
/* For RISC iX, in pc-relative relocs the r_pcrel bit means that the
- relocation has been done already (Only for the 26-bit one I think)???!!!
- */
-
+ relocation has been done already (Only for the 26-bit one I think). */
if (g->howto->type == 3)
{
r_length = 3;
@@ -411,15 +382,14 @@ MY_swap_std_reloc_out (abfd, g, natptr)
r_pcrel = 1;
}
- /* name was clobbered by aout_write_syms to be symbol index */
+ /* Name was clobbered by aout_write_syms to be symbol index. */
/* If this relocation is relative to a symbol then set the
r_index to the symbols index, and the r_extern bit.
Absolute symbols can come in in two ways, either as an offset
from the abs section, or as a symbol which has an abs value.
- check for that here
- */
+ check for that here. */
if (bfd_is_com_section (output_section)
|| output_section == &bfd_abs_section
@@ -478,83 +448,83 @@ MY_swap_std_reloc_out (abfd, g, natptr)
extern const bfd_target aout_arm_big_vec;
const bfd_target aout_arm_little_vec =
- {
- "a.out-arm-little", /* name */
- bfd_target_aout_flavour,
- BFD_ENDIAN_LITTLE, /* target byte order (little) */
- BFD_ENDIAN_LITTLE, /* target headers byte order (little) */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- MY_symbol_leading_char,
- AR_PAD_CHAR, /* ar_pad_char */
- 15, /* ar_max_namelen */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
- {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
- bfd_generic_archive_p, MY_core_file_p},
- {bfd_false, MY_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, MY_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (MY),
- BFD_JUMP_TABLE_COPY (MY),
- BFD_JUMP_TABLE_CORE (MY),
- BFD_JUMP_TABLE_ARCHIVE (MY),
- BFD_JUMP_TABLE_SYMBOLS (MY),
- BFD_JUMP_TABLE_RELOCS (MY),
- BFD_JUMP_TABLE_WRITE (MY),
- BFD_JUMP_TABLE_LINK (MY),
- BFD_JUMP_TABLE_DYNAMIC (MY),
-
- & aout_arm_big_vec,
-
- (PTR) MY_backend_data,
- };
+{
+ "a.out-arm-little", /* Name. */
+ bfd_target_aout_flavour,
+ BFD_ENDIAN_LITTLE, /* Target byte order (little). */
+ BFD_ENDIAN_LITTLE, /* Target headers byte order (little). */
+ (HAS_RELOC | EXEC_P | /* Object flags. */
+ HAS_LINENO | HAS_DEBUG |
+ HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
+ MY_symbol_leading_char,
+ AR_PAD_CHAR, /* AR_pad_char. */
+ 15, /* AR_max_namelen. */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */
+ {_bfd_dummy_target, MY_object_p, /* bfd_check_format. */
+ bfd_generic_archive_p, MY_core_file_p},
+ {bfd_false, MY_mkobject, /* bfd_set_format. */
+ _bfd_generic_mkarchive, bfd_false},
+ {bfd_false, MY_write_object_contents, /* bfd_write_contents. */
+ _bfd_write_archive_contents, bfd_false},
+
+ BFD_JUMP_TABLE_GENERIC (MY),
+ BFD_JUMP_TABLE_COPY (MY),
+ BFD_JUMP_TABLE_CORE (MY),
+ BFD_JUMP_TABLE_ARCHIVE (MY),
+ BFD_JUMP_TABLE_SYMBOLS (MY),
+ BFD_JUMP_TABLE_RELOCS (MY),
+ BFD_JUMP_TABLE_WRITE (MY),
+ BFD_JUMP_TABLE_LINK (MY),
+ BFD_JUMP_TABLE_DYNAMIC (MY),
+
+ & aout_arm_big_vec,
+
+ (void *) MY_backend_data,
+};
const bfd_target aout_arm_big_vec =
- {
- "a.out-arm-big", /* name */
- bfd_target_aout_flavour,
- BFD_ENDIAN_BIG, /* target byte order (big) */
- BFD_ENDIAN_BIG, /* target headers byte order (big) */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- MY_symbol_leading_char,
- AR_PAD_CHAR, /* ar_pad_char */
- 15, /* ar_max_namelen */
- 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_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, MY_object_p, /* bfd_check_format */
- bfd_generic_archive_p, MY_core_file_p},
- {bfd_false, MY_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, MY_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (MY),
- BFD_JUMP_TABLE_COPY (MY),
- BFD_JUMP_TABLE_CORE (MY),
- BFD_JUMP_TABLE_ARCHIVE (MY),
- BFD_JUMP_TABLE_SYMBOLS (MY),
- BFD_JUMP_TABLE_RELOCS (MY),
- BFD_JUMP_TABLE_WRITE (MY),
- BFD_JUMP_TABLE_LINK (MY),
- BFD_JUMP_TABLE_DYNAMIC (MY),
-
- & aout_arm_little_vec,
-
- (PTR) MY_backend_data,
- };
+{
+ "a.out-arm-big", /* Name. */
+ bfd_target_aout_flavour,
+ BFD_ENDIAN_BIG, /* Target byte order (big). */
+ BFD_ENDIAN_BIG, /* Target headers byte order (big). */
+ (HAS_RELOC | EXEC_P | /* Object flags. */
+ HAS_LINENO | HAS_DEBUG |
+ HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
+ MY_symbol_leading_char,
+ AR_PAD_CHAR, /* AR_pad_char. */
+ 15, /* AR_max_namelen. */
+ 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_getb64, bfd_getb_signed_64, bfd_putb64,
+ bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+ bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
+ {_bfd_dummy_target, MY_object_p, /* bfd_check_format. */
+ bfd_generic_archive_p, MY_core_file_p},
+ {bfd_false, MY_mkobject, /* bfd_set_format. */
+ _bfd_generic_mkarchive, bfd_false},
+ {bfd_false, MY_write_object_contents, /* bfd_write_contents. */
+ _bfd_write_archive_contents, bfd_false},
+
+ BFD_JUMP_TABLE_GENERIC (MY),
+ BFD_JUMP_TABLE_COPY (MY),
+ BFD_JUMP_TABLE_CORE (MY),
+ BFD_JUMP_TABLE_ARCHIVE (MY),
+ BFD_JUMP_TABLE_SYMBOLS (MY),
+ BFD_JUMP_TABLE_RELOCS (MY),
+ BFD_JUMP_TABLE_WRITE (MY),
+ BFD_JUMP_TABLE_LINK (MY),
+ BFD_JUMP_TABLE_DYNAMIC (MY),
+
+ & aout_arm_little_vec,
+
+ (void *) MY_backend_data,
+};
diff --git a/bfd/aout-cris.c b/bfd/aout-cris.c
index 26502a4..a0490e7 100644
--- a/bfd/aout-cris.c
+++ b/bfd/aout-cris.c
@@ -1,31 +1,31 @@
/* BFD backend for CRIS a.out binaries.
- Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Axis Communications AB.
Written by Hans-Peter Nilsson.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* See info in the file PORTING for documentation of these macros and
functions. Beware; some of the information there is outdated. */
#define N_HEADER_IN_TEXT(x) 0
-#define N_TXTOFF(x) 32
+#define N_TXTOFF(x) 32
#define ENTRY_CAN_BE_ZERO
-#define TEXT_START_ADDR 0
+#define TEXT_START_ADDR 0
/* Without reading symbols to get the text start symbol, there is no way
to know where the text segment starts in an a.out file. Defaulting to
@@ -47,7 +47,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
*not* included in the text segment. A simple workaround is to
#define ZMAGIC_DISK_BLOCK_SIZE, which is used if defined; otherwise
TARGET_PAGE_SIZE is used. */
-#define ZMAGIC_DISK_BLOCK_SIZE N_TXTOFF (0)
+#define ZMAGIC_DISK_BLOCK_SIZE N_TXTOFF (0)
/* It seems odd at first to set a page-size this low, but gives greater
freedom in where things can be linked. The drawback is that you have
@@ -74,26 +74,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Version 1 of the header. */
#define MY_exec_hdr_flags 1
-#define MY_write_object_contents MY(write_object_contents)
-static bfd_boolean MY(write_object_contents) PARAMS ((bfd *));
+#define MY_write_object_contents MY (write_object_contents)
+static bfd_boolean MY (write_object_contents) (bfd *);
/* Forward this, so we can use a pointer to it in PARAMS. */
struct reloc_ext_external;
-#define MY_swap_ext_reloc_out MY(swap_ext_reloc_out)
-static void MY(swap_ext_reloc_out) PARAMS ((bfd *, arelent *,
- struct reloc_ext_external *));
+#define MY_swap_ext_reloc_out MY (swap_ext_reloc_out)
+static void MY (swap_ext_reloc_out) (bfd *, arelent *, struct reloc_ext_external *);
-#define MY_swap_ext_reloc_in MY(swap_ext_reloc_in)
-static void MY(swap_ext_reloc_in) PARAMS ((bfd *, struct
- reloc_ext_external *,
- arelent *, asymbol **,
- bfd_size_type));
+#define MY_swap_ext_reloc_in MY (swap_ext_reloc_in)
+static void MY (swap_ext_reloc_in) (bfd *, struct reloc_ext_external *,
+ arelent *, asymbol **, bfd_size_type);
-#define MY_set_sizes MY(set_sizes)
-static bfd_boolean MY(set_sizes) PARAMS ((bfd *));
+#define MY_set_sizes MY (set_sizes)
+static bfd_boolean MY (set_sizes) (bfd *);
-/* To set back reloc_size to ext, we make MY(set_sizes) be called
+/* To set back reloc_size to ext, we make MY (set_sizes) be called
through this construct. Note that MY_set_arch_mach is only called
through SET_ARCH_MACH. The default bfd_default_set_arch_mach will
not call set_sizes. */
@@ -104,8 +101,8 @@ static bfd_boolean MY(set_sizes) PARAMS ((bfd *));
/* These macros describe the binary layout of the reloc information we
use in a file. */
-#define RELOC_EXT_BITS_EXTERN_LITTLE 0x80
-#define RELOC_EXT_BITS_TYPE_LITTLE 3
+#define RELOC_EXT_BITS_EXTERN_LITTLE 0x80
+#define RELOC_EXT_BITS_TYPE_LITTLE 3
#define RELOC_EXT_BITS_TYPE_SH_LITTLE 0
#ifndef MY_get_section_contents
@@ -121,8 +118,7 @@ static bfd_boolean MY(set_sizes) PARAMS ((bfd *));
/* We need our own version to set header flags. */
static bfd_boolean
-MY(write_object_contents) (abfd)
- bfd *abfd;
+MY (write_object_contents) (bfd *abfd)
{
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
@@ -135,8 +131,8 @@ MY(write_object_contents) (abfd)
/* Setting N_SET_MACHTYPE and using N_SET_FLAGS is not performed by
the default definition. */
- if (bfd_get_arch(abfd) == bfd_arch_cris)
- N_SET_MACHTYPE(*execp, M_CRIS);
+ if (bfd_get_arch (abfd) == bfd_arch_cris)
+ N_SET_MACHTYPE (*execp, M_CRIS);
N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags);
@@ -150,10 +146,9 @@ MY(write_object_contents) (abfd)
- Fix what seems to be a weak-bug (perhaps there for valid reasons). */
static void
-MY(swap_ext_reloc_out) (abfd, g, natptr)
- bfd *abfd;
- arelent *g;
- struct reloc_ext_external *natptr;
+MY (swap_ext_reloc_out) (bfd *abfd,
+ arelent *g,
+ struct reloc_ext_external *natptr)
{
int r_index;
int r_extern;
@@ -224,12 +219,11 @@ MY(swap_ext_reloc_out) (abfd, g, natptr)
/* We need our own to assert that a normal 8, 16 or 32 reloc is input. */
static void
-MY(swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
- bfd *abfd;
- struct reloc_ext_external *bytes;
- arelent *cache_ptr;
- asymbol **symbols;
- bfd_size_type symcount;
+MY (swap_ext_reloc_in) (bfd *abfd,
+ struct reloc_ext_external *bytes,
+ arelent *cache_ptr,
+ asymbol **symbols,
+ bfd_size_type symcount)
{
unsigned int r_index;
int r_extern;
@@ -278,15 +272,14 @@ MY(swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
NAME (aout, set_arch_mach) in aoutx. */
static bfd_boolean
-MY(set_sizes) (abfd)
- bfd *abfd;
+MY (set_sizes) (bfd *abfd)
{
/* Just as the default in aout-target.h (with some #ifdefs folded)... */
- adata(abfd).page_size = TARGET_PAGE_SIZE;
- adata(abfd).segment_size = SEGMENT_SIZE;
- adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE;
- adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
+ adata (abfd).page_size = TARGET_PAGE_SIZE;
+ adata (abfd).segment_size = SEGMENT_SIZE;
+ adata (abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE;
+ adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
/* ... except for that we have the extended reloc. The alternative
would be to add a check on bfd_arch_cris in NAME (aout,
@@ -297,10 +290,3 @@ MY(set_sizes) (abfd)
return TRUE;
}
-
-/*
- * Local variables:
- * eval: (c-set-style "gnu")
- * indent-tabs-mode: t
- * End:
- */
diff --git a/bfd/aout-ns32k.c b/bfd/aout-ns32k.c
index 40bc244..7cf4d48 100644
--- a/bfd/aout-ns32k.c
+++ b/bfd/aout-ns32k.c
@@ -1,6 +1,6 @@
/* BFD back-end for ns32k a.out-ish binaries.
Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
- 2002, 2003 Free Software Foundation, Inc.
+ 2002, 2003, 2005 Free Software Foundation, Inc.
Contributed by Ian Dall (idall@eleceng.adelaide.edu.au).
This file is part of BFD, the Binary File Descriptor library.
@@ -28,41 +28,21 @@
the tokens. */
#define MYNS(OP) CONCAT2 (ns32kaout_,OP)
-reloc_howto_type *
-MYNS(bfd_reloc_type_lookup)
- PARAMS((bfd *abfd AND
- bfd_reloc_code_real_type code));
-
-bfd_boolean
-MYNS(write_object_contents)
- PARAMS((bfd *abfd));
+reloc_howto_type * MYNS (bfd_reloc_type_lookup) (bfd * abfd, bfd_reloc_code_real_type);
+bfd_boolean MYNS (write_object_contents) (bfd *abfd);
/* Avoid multiple definitions from aoutx if supporting
standard a.out format(s) as well as this one. */
#define NAME(x,y) CONCAT3 (ns32kaout,_32_,y)
-void bfd_ns32k_arch PARAMS ((void));
+void bfd_ns32k_arch (void);
#include "libaout.h"
-#define MY(OP) MYNS(OP)
+#define MY(OP) MYNS (OP)
-#define MY_swap_std_reloc_in MY(swap_std_reloc_in)
-#define MY_swap_std_reloc_out MY(swap_std_reloc_out)
-
-static void
-MY_swap_std_reloc_in PARAMS ((bfd *, struct reloc_std_external *,
- arelent *, asymbol **,
- bfd_size_type));
-static void
-MY_swap_std_reloc_out PARAMS ((bfd *, arelent *,
- struct reloc_std_external *));
-reloc_howto_type *
-MY(reloc_howto) PARAMS ((bfd *, struct reloc_std_external *,
- int *, int *, int *));
-void
-MY(put_reloc) PARAMS ((bfd *, int, int, bfd_vma, reloc_howto_type *,
- struct reloc_std_external *));
+#define MY_swap_std_reloc_in MY (swap_std_reloc_in)
+#define MY_swap_std_reloc_out MY (swap_std_reloc_out)
/* The ns32k series is ah, unusual, when it comes to relocation.
There are three storage methods for relocatable objects. There
@@ -94,83 +74,80 @@ MY(put_reloc) PARAMS ((bfd *, int, int, bfd_vma, reloc_howto_type *,
in the a.out format relocation entries is such that even the relocation
methods which are standard are not encoded the standard way. */
-reloc_howto_type MY(howto_table)[] =
- {
- /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */
- /* ns32k immediate operands. */
- HOWTO (BFD_RELOC_NS32K_IMM_8, 0, 0, 8, FALSE, 0, complain_overflow_signed,
- _bfd_ns32k_reloc_imm, "NS32K_IMM_8",
- TRUE, 0x000000ff,0x000000ff, FALSE),
- HOWTO (BFD_RELOC_NS32K_IMM_16, 0, 1, 16, FALSE, 0, complain_overflow_signed,
- _bfd_ns32k_reloc_imm, "NS32K_IMM_16",
- TRUE, 0x0000ffff,0x0000ffff, FALSE),
- HOWTO (BFD_RELOC_NS32K_IMM_32, 0, 2, 32, FALSE, 0, complain_overflow_signed,
- _bfd_ns32k_reloc_imm, "NS32K_IMM_32",
- TRUE, 0xffffffff,0xffffffff, FALSE),
- HOWTO (BFD_RELOC_NS32K_IMM_8_PCREL, 0, 0, 8, TRUE, 0, complain_overflow_signed,
- _bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_8",
- TRUE, 0x000000ff, 0x000000ff, FALSE),
- HOWTO (BFD_RELOC_NS32K_IMM_16_PCREL, 0, 1, 16, TRUE, 0, complain_overflow_signed,
- _bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_16",
- TRUE, 0x0000ffff,0x0000ffff, FALSE),
- HOWTO (BFD_RELOC_NS32K_IMM_32_PCREL, 0, 2, 32, TRUE, 0, complain_overflow_signed,
- _bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_32",
- TRUE, 0xffffffff,0xffffffff, FALSE),
-
- /* ns32k displacements. */
- HOWTO (BFD_RELOC_NS32K_DISP_8, 0, 0, 7, FALSE, 0, complain_overflow_signed,
- _bfd_ns32k_reloc_disp, "NS32K_DISP_8",
- TRUE, 0x000000ff,0x000000ff, FALSE),
- HOWTO (BFD_RELOC_NS32K_DISP_16, 0, 1, 14, FALSE, 0, complain_overflow_signed,
- _bfd_ns32k_reloc_disp, "NS32K_DISP_16",
- TRUE, 0x0000ffff, 0x0000ffff, FALSE),
- HOWTO (BFD_RELOC_NS32K_DISP_32, 0, 2, 30, FALSE, 0, complain_overflow_signed,
- _bfd_ns32k_reloc_disp, "NS32K_DISP_32",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO (BFD_RELOC_NS32K_DISP_8_PCREL, 0, 0, 7, TRUE, 0, complain_overflow_signed,
+reloc_howto_type MY (howto_table)[] =
+{
+ /* ns32k immediate operands. */
+ HOWTO (BFD_RELOC_NS32K_IMM_8, 0, 0, 8, FALSE, 0, complain_overflow_signed,
+ _bfd_ns32k_reloc_imm, "NS32K_IMM_8",
+ TRUE, 0x000000ff,0x000000ff, FALSE),
+ HOWTO (BFD_RELOC_NS32K_IMM_16, 0, 1, 16, FALSE, 0, complain_overflow_signed,
+ _bfd_ns32k_reloc_imm, "NS32K_IMM_16",
+ TRUE, 0x0000ffff,0x0000ffff, FALSE),
+ HOWTO (BFD_RELOC_NS32K_IMM_32, 0, 2, 32, FALSE, 0, complain_overflow_signed,
+ _bfd_ns32k_reloc_imm, "NS32K_IMM_32",
+ TRUE, 0xffffffff,0xffffffff, FALSE),
+ HOWTO (BFD_RELOC_NS32K_IMM_8_PCREL, 0, 0, 8, TRUE, 0, complain_overflow_signed,
+ _bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_8",
+ TRUE, 0x000000ff, 0x000000ff, FALSE),
+ HOWTO (BFD_RELOC_NS32K_IMM_16_PCREL, 0, 1, 16, TRUE, 0, complain_overflow_signed,
+ _bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_16",
+ TRUE, 0x0000ffff,0x0000ffff, FALSE),
+ HOWTO (BFD_RELOC_NS32K_IMM_32_PCREL, 0, 2, 32, TRUE, 0, complain_overflow_signed,
+ _bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_32",
+ TRUE, 0xffffffff,0xffffffff, FALSE),
+
+ /* ns32k displacements. */
+ HOWTO (BFD_RELOC_NS32K_DISP_8, 0, 0, 7, FALSE, 0, complain_overflow_signed,
+ _bfd_ns32k_reloc_disp, "NS32K_DISP_8",
+ TRUE, 0x000000ff,0x000000ff, FALSE),
+ HOWTO (BFD_RELOC_NS32K_DISP_16, 0, 1, 14, FALSE, 0, complain_overflow_signed,
+ _bfd_ns32k_reloc_disp, "NS32K_DISP_16",
+ TRUE, 0x0000ffff, 0x0000ffff, FALSE),
+ HOWTO (BFD_RELOC_NS32K_DISP_32, 0, 2, 30, FALSE, 0, complain_overflow_signed,
+ _bfd_ns32k_reloc_disp, "NS32K_DISP_32",
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO (BFD_RELOC_NS32K_DISP_8_PCREL, 0, 0, 7, TRUE, 0, complain_overflow_signed,
_bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_8",
- TRUE, 0x000000ff,0x000000ff, FALSE),
- HOWTO (BFD_RELOC_NS32K_DISP_16_PCREL, 0, 1, 14, TRUE, 0, complain_overflow_signed,
- _bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_16",
- TRUE, 0x0000ffff,0x0000ffff, FALSE),
- HOWTO (BFD_RELOC_NS32K_DISP_32_PCREL, 0, 2, 30, TRUE, 0, complain_overflow_signed,
- _bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_32",
- TRUE, 0xffffffff,0xffffffff, FALSE),
-
- /* Normal 2's complement. */
- HOWTO (BFD_RELOC_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,
- "8", TRUE, 0x000000ff,0x000000ff, FALSE),
- HOWTO (BFD_RELOC_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,
- "16", TRUE, 0x0000ffff,0x0000ffff, FALSE),
- HOWTO (BFD_RELOC_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,
- "32", TRUE, 0xffffffff,0xffffffff, FALSE),
- HOWTO (BFD_RELOC_8_PCREL, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0,
- "PCREL_8", TRUE, 0x000000ff,0x000000ff, FALSE),
- HOWTO (BFD_RELOC_16_PCREL, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0,
- "PCREL_16", TRUE, 0x0000ffff,0x0000ffff, FALSE),
- HOWTO (BFD_RELOC_32_PCREL, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0,
- "PCREL_32", TRUE, 0xffffffff,0xffffffff, FALSE),
- };
-
-#define CTOR_TABLE_RELOC_HOWTO(BFD) (MY(howto_table) + 14)
-
-#define RELOC_STD_BITS_NS32K_TYPE_BIG 0x06
-#define RELOC_STD_BITS_NS32K_TYPE_LITTLE 0x60
-#define RELOC_STD_BITS_NS32K_TYPE_SH_BIG 1
-#define RELOC_STD_BITS_NS32K_TYPE_SH_LITTLE 5
-
-reloc_howto_type *
-MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct reloc_std_external *rel;
- int *r_index;
- int *r_extern;
- int *r_pcrel;
+ TRUE, 0x000000ff,0x000000ff, FALSE),
+ HOWTO (BFD_RELOC_NS32K_DISP_16_PCREL, 0, 1, 14, TRUE, 0, complain_overflow_signed,
+ _bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_16",
+ TRUE, 0x0000ffff,0x0000ffff, FALSE),
+ HOWTO (BFD_RELOC_NS32K_DISP_32_PCREL, 0, 2, 30, TRUE, 0, complain_overflow_signed,
+ _bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_32",
+ TRUE, 0xffffffff,0xffffffff, FALSE),
+
+ /* Normal 2's complement. */
+ HOWTO (BFD_RELOC_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,
+ "8", TRUE, 0x000000ff,0x000000ff, FALSE),
+ HOWTO (BFD_RELOC_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,
+ "16", TRUE, 0x0000ffff,0x0000ffff, FALSE),
+ HOWTO (BFD_RELOC_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,
+ "32", TRUE, 0xffffffff,0xffffffff, FALSE),
+ HOWTO (BFD_RELOC_8_PCREL, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0,
+ "PCREL_8", TRUE, 0x000000ff,0x000000ff, FALSE),
+ HOWTO (BFD_RELOC_16_PCREL, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0,
+ "PCREL_16", TRUE, 0x0000ffff,0x0000ffff, FALSE),
+ HOWTO (BFD_RELOC_32_PCREL, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0,
+ "PCREL_32", TRUE, 0xffffffff,0xffffffff, FALSE),
+};
+
+#define CTOR_TABLE_RELOC_HOWTO(BFD) (MY (howto_table) + 14)
+
+#define RELOC_STD_BITS_NS32K_TYPE_BIG 0x06
+#define RELOC_STD_BITS_NS32K_TYPE_LITTLE 0x60
+#define RELOC_STD_BITS_NS32K_TYPE_SH_BIG 1
+#define RELOC_STD_BITS_NS32K_TYPE_SH_LITTLE 5
+
+static reloc_howto_type *
+MY (reloc_howto) (bfd *abfd ATTRIBUTE_UNUSED,
+ struct reloc_std_external *rel,
+ int *r_index,
+ int *r_extern,
+ int *r_pcrel)
{
unsigned int r_length;
int r_ns32k_type;
- /* BFD_ASSERT(bfd_header_little_endian (abfd)); */
*r_index = ((rel->r_index[2] << 16)
| (rel->r_index[1] << 8)
| rel->r_index[0] );
@@ -180,20 +157,19 @@ MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel)
>> RELOC_STD_BITS_LENGTH_SH_LITTLE);
r_ns32k_type = ((rel->r_type[0] & RELOC_STD_BITS_NS32K_TYPE_LITTLE)
>> RELOC_STD_BITS_NS32K_TYPE_SH_LITTLE);
- return (MY(howto_table) + r_length + 3 * (*r_pcrel) + 6 * r_ns32k_type);
+ return (MY (howto_table) + r_length + 3 * (*r_pcrel) + 6 * r_ns32k_type);
}
#define MY_reloc_howto(BFD, REL, IN, EX, PC) \
- MY(reloc_howto) (BFD, REL, &IN, &EX, &PC)
-
-void
-MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc)
- bfd *abfd;
- int r_extern;
- int r_index;
- bfd_vma value;
- reloc_howto_type *howto;
- struct reloc_std_external *reloc;
+ MY (reloc_howto) (BFD, REL, &IN, &EX, &PC)
+
+static void
+MY (put_reloc) (bfd *abfd,
+ int r_extern,
+ int r_index,
+ bfd_vma value,
+ reloc_howto_type *howto,
+ struct reloc_std_external *reloc)
{
unsigned int r_length;
int r_pcrel;
@@ -202,9 +178,8 @@ MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc)
PUT_WORD (abfd, value, reloc->r_address);
r_length = howto->size ; /* Size as a power of two. */
r_pcrel = (int) howto->pc_relative; /* Relative to PC? */
- r_ns32k_type = (howto - MY(howto_table) )/6;
+ r_ns32k_type = (howto - MY (howto_table) )/6;
- /* BFD_ASSERT (bfd_header_little_endian (abfd)); */
reloc->r_index[2] = r_index >> 16;
reloc->r_index[1] = r_index >> 8;
reloc->r_index[0] = r_index;
@@ -216,26 +191,26 @@ MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc)
}
#define MY_put_reloc(BFD, EXT, IDX, VAL, HOWTO, RELOC) \
- MY(put_reloc) (BFD, EXT, IDX, VAL, HOWTO, RELOC)
+ MY (put_reloc) (BFD, EXT, IDX, VAL, HOWTO, RELOC)
#define STAT_FOR_EXEC
#define MY_final_link_relocate _bfd_ns32k_final_link_relocate
-#define MY_relocate_contents _bfd_ns32k_relocate_contents
+#define MY_relocate_contents _bfd_ns32k_relocate_contents
+
+static void MY_swap_std_reloc_in (bfd *, struct reloc_std_external *, arelent *, asymbol **, bfd_size_type);
+static void MY_swap_std_reloc_out (bfd *, arelent *, struct reloc_std_external *);
#include "aoutx.h"
reloc_howto_type *
-MY(bfd_reloc_type_lookup) (abfd,code)
- bfd *abfd;
- bfd_reloc_code_real_type code;
+MY (bfd_reloc_type_lookup) (bfd *abfd, bfd_reloc_code_real_type code)
{
-
-#define ENTRY(i,j) case i: return &MY(howto_table)[j]
+#define ENTRY(i,j) case i: return &MY (howto_table)[j]
int ext = obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE;
- BFD_ASSERT(ext == 0);
+ BFD_ASSERT (ext == 0);
if (code == BFD_RELOC_CTOR)
switch (bfd_get_arch_info (abfd)->bits_per_address)
{
@@ -247,37 +222,36 @@ MY(bfd_reloc_type_lookup) (abfd,code)
}
switch (code)
{
- ENTRY(BFD_RELOC_NS32K_IMM_8, 0);
- ENTRY(BFD_RELOC_NS32K_IMM_16, 1);
- ENTRY(BFD_RELOC_NS32K_IMM_32, 2);
- ENTRY(BFD_RELOC_NS32K_IMM_8_PCREL, 3);
- ENTRY(BFD_RELOC_NS32K_IMM_16_PCREL, 4);
- ENTRY(BFD_RELOC_NS32K_IMM_32_PCREL, 5);
- ENTRY(BFD_RELOC_NS32K_DISP_8, 6);
- ENTRY(BFD_RELOC_NS32K_DISP_16, 7);
- ENTRY(BFD_RELOC_NS32K_DISP_32, 8);
- ENTRY(BFD_RELOC_NS32K_DISP_8_PCREL, 9);
- ENTRY(BFD_RELOC_NS32K_DISP_16_PCREL, 10);
- ENTRY(BFD_RELOC_NS32K_DISP_32_PCREL, 11);
- ENTRY(BFD_RELOC_8, 12);
- ENTRY(BFD_RELOC_16, 13);
- ENTRY(BFD_RELOC_32, 14);
- ENTRY(BFD_RELOC_8_PCREL, 15);
- ENTRY(BFD_RELOC_16_PCREL, 16);
- ENTRY(BFD_RELOC_32_PCREL, 17);
+ ENTRY (BFD_RELOC_NS32K_IMM_8, 0);
+ ENTRY (BFD_RELOC_NS32K_IMM_16, 1);
+ ENTRY (BFD_RELOC_NS32K_IMM_32, 2);
+ ENTRY (BFD_RELOC_NS32K_IMM_8_PCREL, 3);
+ ENTRY (BFD_RELOC_NS32K_IMM_16_PCREL, 4);
+ ENTRY (BFD_RELOC_NS32K_IMM_32_PCREL, 5);
+ ENTRY (BFD_RELOC_NS32K_DISP_8, 6);
+ ENTRY (BFD_RELOC_NS32K_DISP_16, 7);
+ ENTRY (BFD_RELOC_NS32K_DISP_32, 8);
+ ENTRY (BFD_RELOC_NS32K_DISP_8_PCREL, 9);
+ ENTRY (BFD_RELOC_NS32K_DISP_16_PCREL, 10);
+ ENTRY (BFD_RELOC_NS32K_DISP_32_PCREL, 11);
+ ENTRY (BFD_RELOC_8, 12);
+ ENTRY (BFD_RELOC_16, 13);
+ ENTRY (BFD_RELOC_32, 14);
+ ENTRY (BFD_RELOC_8_PCREL, 15);
+ ENTRY (BFD_RELOC_16_PCREL, 16);
+ ENTRY (BFD_RELOC_32_PCREL, 17);
default:
- return (reloc_howto_type *) NULL;
+ return NULL;
}
#undef ENTRY
}
static void
-MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
- bfd *abfd;
- struct reloc_std_external *bytes;
- arelent *cache_ptr;
- asymbol **symbols;
- bfd_size_type symcount ATTRIBUTE_UNUSED;
+MY_swap_std_reloc_in (bfd *abfd,
+ struct reloc_std_external *bytes,
+ arelent *cache_ptr,
+ asymbol **symbols,
+ bfd_size_type symcount ATTRIBUTE_UNUSED)
{
int r_index;
int r_extern;
@@ -287,16 +261,15 @@ MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
cache_ptr->address = H_GET_32 (abfd, bytes->r_address);
/* Now the fun stuff. */
- cache_ptr->howto = MY_reloc_howto(abfd, bytes, r_index, r_extern, r_pcrel);
+ cache_ptr->howto = MY_reloc_howto (abfd, bytes, r_index, r_extern, r_pcrel);
MOVE_ADDRESS (0);
}
static void
-MY_swap_std_reloc_out (abfd, g, natptr)
- bfd *abfd;
- arelent *g;
- struct reloc_std_external *natptr;
+MY_swap_std_reloc_out (bfd *abfd,
+ arelent *g,
+ struct reloc_std_external *natptr)
{
int r_index;
asymbol *sym = *(g->sym_ptr_ptr);
@@ -346,15 +319,14 @@ MY_swap_std_reloc_out (abfd, g, natptr)
}
bfd_reloc_status_type
-_bfd_ns32k_relocate_contents (howto, input_bfd, relocation, location)
- reloc_howto_type *howto;
- bfd *input_bfd;
- bfd_vma relocation;
- bfd_byte *location;
+_bfd_ns32k_relocate_contents (reloc_howto_type *howto,
+ bfd *input_bfd,
+ bfd_vma relocation,
+ bfd_byte *location)
{
- int r_ns32k_type = (howto - MY(howto_table)) / 6;
- bfd_vma (*get_data) PARAMS ((bfd_byte *, int));
- void (*put_data) PARAMS ((bfd_vma, bfd_byte *, int));
+ int r_ns32k_type = (howto - MY (howto_table)) / 6;
+ bfd_vma (*get_data) (bfd_byte *, int);
+ void (*put_data) (bfd_vma, bfd_byte *, int);
switch (r_ns32k_type)
{
@@ -369,7 +341,6 @@ _bfd_ns32k_relocate_contents (howto, input_bfd, relocation, location)
case 2:
return _bfd_relocate_contents (howto, input_bfd, relocation,
location);
- /* NOT REACHED */
break;
default:
return bfd_reloc_notsupported;
diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c
index 850c558..8adca2a 100644
--- a/bfd/aout-tic30.c
+++ b/bfd/aout-tic30.c
@@ -1,5 +1,5 @@
/* BFD back-end for TMS320C30 a.out binaries.
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
@@ -21,11 +21,11 @@
02111-1307, USA. */
#define TARGET_IS_BIG_ENDIAN_P
-#define N_HEADER_IN_TEXT(x) 1
-#define TEXT_START_ADDR 1024
-#define TARGET_PAGE_SIZE 128
-#define SEGMENT_SIZE TARGET_PAGE_SIZE
-#define DEFAULT_ARCH bfd_arch_tic30
+#define N_HEADER_IN_TEXT(x) 1
+#define TEXT_START_ADDR 1024
+#define TARGET_PAGE_SIZE 128
+#define SEGMENT_SIZE TARGET_PAGE_SIZE
+#define DEFAULT_ARCH bfd_arch_tic30
#define ARCH_SIZE 32
/* Do not "beautify" the CONCAT* macro args. Traditional C will not
@@ -38,50 +38,17 @@
#include "bfd.h"
#include "sysdep.h"
#include "libaout.h"
-
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
#include "aout/ar.h"
-static bfd_reloc_status_type tic30_aout_fix_16
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type tic30_aout_fix_32
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type tic30_aout_fix_pcrel_16
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static reloc_howto_type *tic30_aout_reloc_howto
- PARAMS ((bfd *, struct reloc_std_external *, int *, int *, int *));
-static bfd_reloc_status_type tic30_aout_relocate_contents
- PARAMS ((reloc_howto_type *, bfd *, bfd_vma, bfd_byte *));
-static bfd_reloc_status_type tic30_aout_final_link_relocate
- PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, bfd_vma,
- bfd_vma, bfd_vma));
-static const bfd_target *tic30_aout_object_p
- PARAMS ((bfd *));
-static bfd_boolean tic30_aout_write_object_contents
- PARAMS ((bfd *));
-static bfd_boolean tic30_aout_set_sizes
- PARAMS ((bfd *));
-static const bfd_target * tic30_aout_callback
- PARAMS ((bfd *));
-static bfd_boolean MY_bfd_copy_private_section_data
- PARAMS ((bfd *, asection *, bfd *, asection *));
-static bfd_boolean MY_bfd_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
-reloc_howto_type * tic30_aout_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-enum machine_type tic30_aout_machine_type
- PARAMS ((enum bfd_architecture, unsigned long, bfd_boolean *));
-bfd_boolean tic30_aout_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-
-#define MY_reloc_howto(BFD, REL, IN, EX, PC) \
- tic30_aout_reloc_howto(BFD, REL, &IN, &EX, &PC)
-#define MY_final_link_relocate tic30_aout_final_link_relocate
-#define MY_object_p tic30_aout_object_p
-#define MY_mkobject NAME(aout,mkobject)
-#define MY_write_object_contents tic30_aout_write_object_contents
-#define MY_set_sizes tic30_aout_set_sizes
+#define MY_reloc_howto(BFD, REL, IN, EX, PC) tic30_aout_reloc_howto (BFD, REL, & IN, & EX, & PC)
+
+#define MY_final_link_relocate tic30_aout_final_link_relocate
+#define MY_object_p tic30_aout_object_p
+#define MY_mkobject NAME (aout,mkobject)
+#define MY_write_object_contents tic30_aout_write_object_contents
+#define MY_set_sizes tic30_aout_set_sizes
#ifndef MY_exec_hdr_flags
#define MY_exec_hdr_flags 1
@@ -120,13 +87,35 @@ bfd_boolean tic30_aout_set_arch_mach
#define MY_finish_dynamic_link 0
#endif
+static bfd_boolean
+tic30_aout_set_sizes (bfd *abfd)
+{
+ adata (abfd).page_size = TARGET_PAGE_SIZE;
+
+#ifdef SEGMENT_SIZE
+ adata (abfd).segment_size = SEGMENT_SIZE;
+#else
+ adata (abfd).segment_size = TARGET_PAGE_SIZE;
+#endif
+
+#ifdef ZMAGIC_DISK_BLOCK_SIZE
+ adata (abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE;
+#else
+ adata (abfd).zmagic_disk_block_size = TARGET_PAGE_SIZE;
+#endif
+
+ adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
+
+ return TRUE;
+}
+
static const struct aout_backend_data tic30_aout_backend_data =
{
MY_zmagic_contiguous,
MY_text_includes_header,
MY_entry_is_text_address,
MY_exec_hdr_flags,
- 0, /* text vma? */
+ 0, /* Text vma? */
MY_set_sizes,
MY_exec_header_not_counted,
MY_add_dynamic_symbols,
@@ -139,90 +128,45 @@ static const struct aout_backend_data tic30_aout_backend_data =
#define MY_backend_data &tic30_aout_backend_data
#endif
+static reloc_howto_type *
+ tic30_aout_reloc_howto (bfd *, struct reloc_std_external *, int *, int *, int *);
+static bfd_reloc_status_type
+ tic30_aout_final_link_relocate
+ (reloc_howto_type *, bfd *, asection *, bfd_byte *, bfd_vma, bfd_vma, bfd_vma);
+
/* FIXME: This is wrong. aoutx.h should really only be included by
aout32.c. */
#include "aoutx.h"
-/* This table lists the relocation types for the TMS320C30. There are
- only a few relocations required, and all must be divided by 4 (>>
- 2) to get the 32-bit addresses in the format the TMS320C30 likes
- it. */
-reloc_howto_type tic30_aout_howto_table[] =
- {
- EMPTY_HOWTO (-1),
- HOWTO (1, 2, 1, 16, FALSE, 0, 0, tic30_aout_fix_16,
- "16", FALSE, 0x0000FFFF, 0x0000FFFF, FALSE),
- HOWTO (2, 2, 2, 24, FALSE, 0, complain_overflow_bitfield, NULL,
- "24", FALSE, 0x00FFFFFF, 0x00FFFFFF, FALSE),
- HOWTO (3, 18, 3, 24, FALSE, 0, complain_overflow_bitfield, NULL,
- "LDP", FALSE, 0x00FF0000, 0x000000FF, FALSE),
- HOWTO (4, 2, 4, 32, FALSE, 0, complain_overflow_bitfield, tic30_aout_fix_32,
- "32", FALSE, 0xFFFFFFFF, 0xFFFFFFFF, FALSE),
- HOWTO (5, 2, 1, 16, TRUE, 0, complain_overflow_signed,
- tic30_aout_fix_pcrel_16, "PCREL", TRUE, 0x0000FFFF, 0x0000FFFF, TRUE),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1)
- };
-
-extern reloc_howto_type *NAME (aout, reloc_type_lookup)
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-
-reloc_howto_type *
-tic30_aout_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- switch (code)
- {
- case BFD_RELOC_8:
- case BFD_RELOC_TIC30_LDP:
- return &tic30_aout_howto_table[3];
- case BFD_RELOC_16:
- return &tic30_aout_howto_table[1];
- case BFD_RELOC_24:
- return &tic30_aout_howto_table[2];
- case BFD_RELOC_16_PCREL:
- return &tic30_aout_howto_table[5];
- case BFD_RELOC_32:
- return &tic30_aout_howto_table[4];
- default:
- return (reloc_howto_type *) NULL;
- }
-}
+/* This function is used to work out pc-relative offsets for the
+ TMS320C30. The data already placed by md_pcrel_from within gas is
+ useless for a relocation, so we just get the offset value and place
+ a version of this within the object code.
+ tic30_aout_final_link_relocate will then calculate the required
+ relocation to add on to the value in the object code. */
-static reloc_howto_type *
-tic30_aout_reloc_howto (abfd, relocs, r_index, r_extern, r_pcrel)
- bfd *abfd;
- struct reloc_std_external *relocs;
- int *r_index;
- int *r_extern;
- int *r_pcrel;
+static bfd_reloc_status_type
+tic30_aout_fix_pcrel_16 (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol ATTRIBUTE_UNUSED,
+ void * data,
+ asection *input_section ATTRIBUTE_UNUSED,
+ bfd *output_bfd ATTRIBUTE_UNUSED,
+ char **error_message ATTRIBUTE_UNUSED)
{
- unsigned int r_length;
- unsigned int r_pcrel_done;
- int index;
+ bfd_vma relocation = 1;
+ bfd_byte offset_data = bfd_get_8 (abfd, (bfd_byte *) data + reloc_entry->address - 1);
- *r_pcrel = 0;
- if (bfd_header_big_endian (abfd))
- {
- *r_index = ((relocs->r_index[0] << 16) | (relocs->r_index[1] << 8) | relocs->r_index[2]);
- *r_extern = (0 != (relocs->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
- r_pcrel_done = (0 != (relocs->r_type[0] & RELOC_STD_BITS_PCREL_BIG));
- r_length = ((relocs->r_type[0] & RELOC_STD_BITS_LENGTH_BIG) >> RELOC_STD_BITS_LENGTH_SH_BIG);
- }
+ /* The byte before the location of the fix contains bits 23-16 of
+ the pcrel instruction. Bit 21 is set for a delayed instruction
+ which requires on offset of 3 instead of 1. */
+ if (offset_data & 0x20)
+ relocation -= 3;
else
- {
- *r_index = ((relocs->r_index[2] << 16) | (relocs->r_index[1] << 8) | relocs->r_index[0]);
- *r_extern = (0 != (relocs->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE));
- r_pcrel_done = (0 != (relocs->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
- r_length = ((relocs->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) >> RELOC_STD_BITS_LENGTH_SH_LITTLE);
- }
- index = r_length + 4 * r_pcrel_done;
- return tic30_aout_howto_table + index;
+ relocation -= 1;
+ bfd_put_16 (abfd, relocation, (bfd_byte *) data + reloc_entry->address);
+ return bfd_reloc_ok;
}
/* This function is used as a callback for 16-bit relocs. This is
@@ -233,14 +177,13 @@ tic30_aout_reloc_howto (abfd, relocs, r_index, r_extern, r_pcrel)
that. */
static bfd_reloc_status_type
-tic30_aout_fix_16 (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
+tic30_aout_fix_16 (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section ATTRIBUTE_UNUSED,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
{
bfd_vma relocation;
@@ -259,15 +202,13 @@ tic30_aout_fix_16 (abfd, reloc_entry, symbol, data, input_section, output_bfd, e
bit relocations. */
static bfd_reloc_status_type
-tic30_aout_fix_32 (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
+tic30_aout_fix_32 (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section ATTRIBUTE_UNUSED,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
{
bfd_vma relocation;
@@ -282,36 +223,81 @@ tic30_aout_fix_32 (abfd, reloc_entry, symbol, data, input_section,
return bfd_reloc_ok;
}
-/* This function is used to work out pc-relative offsets for the
- TMS320C30. The data already placed by md_pcrel_from within gas is
- useless for a relocation, so we just get the offset value and place
- a version of this within the object code.
- tic30_aout_final_link_relocate will then calculate the required
- relocation to add on to the value in the object code. */
+/* This table lists the relocation types for the TMS320C30. There are
+ only a few relocations required, and all must be divided by 4 (>>
+ 2) to get the 32-bit addresses in the format the TMS320C30 likes
+ it. */
+reloc_howto_type tic30_aout_howto_table[] =
+{
+ EMPTY_HOWTO (-1),
+ HOWTO (1, 2, 1, 16, FALSE, 0, 0, tic30_aout_fix_16,
+ "16", FALSE, 0x0000FFFF, 0x0000FFFF, FALSE),
+ HOWTO (2, 2, 2, 24, FALSE, 0, complain_overflow_bitfield, NULL,
+ "24", FALSE, 0x00FFFFFF, 0x00FFFFFF, FALSE),
+ HOWTO (3, 18, 3, 24, FALSE, 0, complain_overflow_bitfield, NULL,
+ "LDP", FALSE, 0x00FF0000, 0x000000FF, FALSE),
+ HOWTO (4, 2, 4, 32, FALSE, 0, complain_overflow_bitfield, tic30_aout_fix_32,
+ "32", FALSE, 0xFFFFFFFF, 0xFFFFFFFF, FALSE),
+ HOWTO (5, 2, 1, 16, TRUE, 0, complain_overflow_signed,
+ tic30_aout_fix_pcrel_16, "PCREL", TRUE, 0x0000FFFF, 0x0000FFFF, TRUE),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1)
+};
-static bfd_reloc_status_type
-tic30_aout_fix_pcrel_16 (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- char **error_message ATTRIBUTE_UNUSED;
+
+static reloc_howto_type *
+tic30_aout_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
{
- bfd_vma relocation = 1;
- bfd_byte offset_data = bfd_get_8 (abfd, (bfd_byte *) data + reloc_entry->address - 1);
+ switch (code)
+ {
+ case BFD_RELOC_8:
+ case BFD_RELOC_TIC30_LDP:
+ return &tic30_aout_howto_table[3];
+ case BFD_RELOC_16:
+ return &tic30_aout_howto_table[1];
+ case BFD_RELOC_24:
+ return &tic30_aout_howto_table[2];
+ case BFD_RELOC_16_PCREL:
+ return &tic30_aout_howto_table[5];
+ case BFD_RELOC_32:
+ return &tic30_aout_howto_table[4];
+ default:
+ return NULL;
+ }
+}
- /* The byte before the location of the fix contains bits 23-16 of
- the pcrel instruction. Bit 21 is set for a delayed instruction
- which requires on offset of 3 instead of 1. */
- if (offset_data & 0x20)
- relocation -= 3;
+static reloc_howto_type *
+tic30_aout_reloc_howto (bfd *abfd,
+ struct reloc_std_external *relocs,
+ int *r_index,
+ int *r_extern,
+ int *r_pcrel)
+{
+ unsigned int r_length;
+ unsigned int r_pcrel_done;
+ int index;
+
+ *r_pcrel = 0;
+ if (bfd_header_big_endian (abfd))
+ {
+ *r_index = ((relocs->r_index[0] << 16) | (relocs->r_index[1] << 8) | relocs->r_index[2]);
+ *r_extern = (0 != (relocs->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
+ r_pcrel_done = (0 != (relocs->r_type[0] & RELOC_STD_BITS_PCREL_BIG));
+ r_length = ((relocs->r_type[0] & RELOC_STD_BITS_LENGTH_BIG) >> RELOC_STD_BITS_LENGTH_SH_BIG);
+ }
else
- relocation -= 1;
- bfd_put_16 (abfd, relocation, (bfd_byte *) data + reloc_entry->address);
- return bfd_reloc_ok;
+ {
+ *r_index = ((relocs->r_index[2] << 16) | (relocs->r_index[1] << 8) | relocs->r_index[0]);
+ *r_extern = (0 != (relocs->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE));
+ r_pcrel_done = (0 != (relocs->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
+ r_length = ((relocs->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) >> RELOC_STD_BITS_LENGTH_SH_LITTLE);
+ }
+ index = r_length + 4 * r_pcrel_done;
+ return tic30_aout_howto_table + index;
}
/* These macros will get 24-bit values from the bfd definition.
@@ -330,8 +316,7 @@ tic30_aout_fix_pcrel_16 (abfd, reloc_entry, symbol, data, input_section,
This routine is called from some_aout_object_p just before it returns. */
static const bfd_target *
-tic30_aout_callback (abfd)
- bfd *abfd;
+tic30_aout_callback (bfd *abfd)
{
struct internal_exec *execp = exec_hdr (abfd);
unsigned int arch_align_power;
@@ -369,7 +354,7 @@ tic30_aout_callback (abfd)
#endif
/* Now that we know the architecture, set the alignments of the
- sections. This is normally done by NAME(aout,new_section_hook),
+ sections. This is normally done by NAME (aout,new_section_hook),
but when the initial sections were created the architecture had
not yet been set. However, for backward compatibility, we don't
set the alignment power any higher than as required by the size
@@ -391,38 +376,10 @@ tic30_aout_callback (abfd)
}
static bfd_reloc_status_type
-tic30_aout_final_link_relocate (howto, input_bfd, input_section, contents,
- address, value, addend)
- reloc_howto_type *howto;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- bfd_vma address;
- bfd_vma value;
- bfd_vma addend;
-{
- bfd_vma relocation;
-
- if (address > bfd_get_section_limit (input_bfd, input_section))
- return bfd_reloc_outofrange;
-
- relocation = value + addend;
- if (howto->pc_relative)
- {
- relocation -= (input_section->output_section->vma + input_section->output_offset);
- if (howto->pcrel_offset)
- relocation -= address;
- }
- return tic30_aout_relocate_contents (howto, input_bfd, relocation,
- contents + address);
-}
-
-bfd_reloc_status_type
-tic30_aout_relocate_contents (howto, input_bfd, relocation, location)
- reloc_howto_type *howto;
- bfd *input_bfd;
- bfd_vma relocation;
- bfd_byte *location;
+tic30_aout_relocate_contents (reloc_howto_type *howto,
+ bfd *input_bfd,
+ bfd_vma relocation,
+ bfd_byte *location)
{
bfd_vma x;
bfd_boolean overflow;
@@ -495,6 +452,7 @@ tic30_aout_relocate_contents (howto, input_bfd, relocation, location)
{
bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1;
bfd_signed_vma reloc_signed_min = ~reloc_signed_max;
+
if (signed_check > reloc_signed_max || signed_check < reloc_signed_min)
overflow = TRUE;
}
@@ -502,6 +460,7 @@ tic30_aout_relocate_contents (howto, input_bfd, relocation, location)
case complain_overflow_unsigned:
{
bfd_vma reloc_unsigned_max = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
+
if (check > reloc_unsigned_max)
overflow = TRUE;
}
@@ -509,6 +468,7 @@ tic30_aout_relocate_contents (howto, input_bfd, relocation, location)
case complain_overflow_bitfield:
{
bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
+
if ((check & ~reloc_bits) != 0
&& (((bfd_vma) signed_check & ~reloc_bits)
!= ((bfd_vma) -1 & ~reloc_bits)))
@@ -544,18 +504,42 @@ tic30_aout_relocate_contents (howto, input_bfd, relocation, location)
return overflow ? bfd_reloc_overflow : bfd_reloc_ok;
}
+static bfd_reloc_status_type
+tic30_aout_final_link_relocate (reloc_howto_type *howto,
+ bfd *input_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ bfd_vma address,
+ bfd_vma value,
+ bfd_vma addend)
+{
+ bfd_vma relocation;
+
+ if (address > bfd_get_section_limit (input_bfd, input_section))
+ return bfd_reloc_outofrange;
+
+ relocation = value + addend;
+ if (howto->pc_relative)
+ {
+ relocation -= (input_section->output_section->vma + input_section->output_offset);
+ if (howto->pcrel_offset)
+ relocation -= address;
+ }
+ return tic30_aout_relocate_contents (howto, input_bfd, relocation,
+ contents + address);
+}
+
/* Finish up the reading of an a.out file header. */
static const bfd_target *
-tic30_aout_object_p (abfd)
- bfd *abfd;
+tic30_aout_object_p (bfd *abfd)
{
struct external_exec exec_bytes; /* Raw exec header from file. */
- struct internal_exec exec; /* Cleaned-up exec header. */
+ struct internal_exec exec; /* Cleaned-up exec header. */
const bfd_target *target;
bfd_size_type amt = EXEC_BYTES_SIZE;
- if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
+ if (bfd_bread (& exec_bytes, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
@@ -578,9 +562,9 @@ tic30_aout_object_p (abfd)
NAME (aout, swap_exec_header_in) (abfd, &exec_bytes, &exec);
#ifdef SWAP_MAGIC
- /* swap_exec_header_in read in a_info with the wrong byte order */
+ /* Swap_exec_header_in read in a_info with the wrong byte order. */
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
-#endif /* SWAP_MAGIC */
+#endif
target = NAME (aout, some_aout_object_p) (abfd, &exec, tic30_aout_callback);
@@ -601,7 +585,7 @@ tic30_aout_object_p (abfd)
if (stat (abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR))
abfd->flags |= EXEC_P;
}
-#endif /* ENTRY_CAN_BE_ZERO */
+#endif
return target;
}
@@ -613,11 +597,10 @@ tic30_aout_object_p (abfd)
after the section contents have been set. */
static bfd_boolean
-MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
- bfd *ibfd;
- asection *isec ATTRIBUTE_UNUSED;
- bfd *obfd;
- asection *osec ATTRIBUTE_UNUSED;
+MY_bfd_copy_private_section_data (bfd *ibfd,
+ asection *isec ATTRIBUTE_UNUSED,
+ bfd *obfd,
+ asection *osec ATTRIBUTE_UNUSED)
{
if (bfd_get_flavour (obfd) == bfd_target_aout_flavour)
obj_aout_subformat (obfd) = obj_aout_subformat (ibfd);
@@ -629,8 +612,7 @@ MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
file header, symbols, and relocation. */
static bfd_boolean
-tic30_aout_write_object_contents (abfd)
- bfd *abfd;
+tic30_aout_write_object_contents (bfd *abfd)
{
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
@@ -654,10 +636,11 @@ tic30_aout_write_object_contents (abfd)
if (adata (abfd).exec_bytes_size > 0)
{
bfd_size_type amt;
+
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
return FALSE;
amt = adata (abfd).exec_bytes_size;
- if (bfd_bwrite ((PTR) &exec_bytes, amt, abfd) != amt)
+ if (bfd_bwrite (& exec_bytes, amt, abfd) != amt)
return FALSE;
}
@@ -686,42 +669,15 @@ tic30_aout_write_object_contents (abfd)
return TRUE;
}
-static bfd_boolean
-tic30_aout_set_sizes (abfd)
- bfd *abfd;
-{
- adata (abfd).page_size = TARGET_PAGE_SIZE;
-
-#ifdef SEGMENT_SIZE
- adata (abfd).segment_size = SEGMENT_SIZE;
-#else
- adata (abfd).segment_size = TARGET_PAGE_SIZE;
-#endif
-
-#ifdef ZMAGIC_DISK_BLOCK_SIZE
- adata (abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE;
-#else
- adata (abfd).zmagic_disk_block_size = TARGET_PAGE_SIZE;
-#endif
-
- adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
-
- return TRUE;
-}
-
#ifndef MY_final_link_callback
/* Callback for the final_link routine to set the section offsets. */
-static void MY_final_link_callback
- PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *));
-
static void
-MY_final_link_callback (abfd, ptreloff, pdreloff, psymoff)
- bfd *abfd;
- file_ptr *ptreloff;
- file_ptr *pdreloff;
- file_ptr *psymoff;
+MY_final_link_callback (bfd *abfd,
+ file_ptr *ptreloff,
+ file_ptr *pdreloff,
+ file_ptr *psymoff)
{
struct internal_exec *execp = exec_hdr (abfd);
@@ -738,9 +694,7 @@ MY_final_link_callback (abfd, ptreloff, pdreloff, psymoff)
offsets in the output file. */
static bfd_boolean
-MY_bfd_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
{
struct internal_exec *execp = exec_hdr (abfd);
file_ptr pos;
@@ -769,9 +723,7 @@ MY_bfd_final_link (abfd, info)
obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size);
}
else
- {
- obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4);
- }
+ obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4);
if (obj_datasec (abfd)->vma < vma)
obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4);
@@ -801,11 +753,10 @@ MY_bfd_final_link (abfd, info)
#endif
-enum machine_type
-tic30_aout_machine_type (arch, machine, unknown)
- enum bfd_architecture arch;
- unsigned long machine ATTRIBUTE_UNUSED;
- bfd_boolean *unknown;
+static enum machine_type
+tic30_aout_machine_type (enum bfd_architecture arch,
+ unsigned long machine ATTRIBUTE_UNUSED,
+ bfd_boolean *unknown)
{
enum machine_type arch_flags;
@@ -825,11 +776,10 @@ tic30_aout_machine_type (arch, machine, unknown)
return arch_flags;
}
-bfd_boolean
-tic30_aout_set_arch_mach (abfd, arch, machine)
- bfd *abfd;
- enum bfd_architecture arch;
- unsigned long machine;
+static bfd_boolean
+tic30_aout_set_arch_mach (bfd *abfd,
+ enum bfd_architecture arch,
+ unsigned long machine)
{
if (!bfd_default_set_arch_mach (abfd, arch, machine))
return FALSE;
@@ -865,21 +815,21 @@ tic30_aout_set_arch_mach (abfd, arch, machine)
_bfd_archive_bsd_construct_extended_name_table
#endif
#ifndef MY_write_armap
-#define MY_write_armap bsd_write_armap
+#define MY_write_armap bsd_write_armap
#endif
#ifndef MY_read_ar_hdr
-#define MY_read_ar_hdr _bfd_generic_read_ar_hdr
+#define MY_read_ar_hdr _bfd_generic_read_ar_hdr
#endif
#ifndef MY_truncate_arname
#define MY_truncate_arname bfd_bsd_truncate_arname
#endif
#ifndef MY_update_armap_timestamp
-#define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp
+#define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp
#endif
/* No core file defined here -- configure in trad-core.c separately. */
#ifndef MY_core_file_failing_command
-#define MY_core_file_failing_command _bfd_nocore_core_file_failing_command
+#define MY_core_file_failing_command _bfd_nocore_core_file_failing_command
#endif
#ifndef MY_core_file_failing_signal
#define MY_core_file_failing_signal _bfd_nocore_core_file_failing_signal
@@ -889,7 +839,7 @@ tic30_aout_set_arch_mach (abfd, arch, machine)
_bfd_nocore_core_file_matches_executable_p
#endif
#ifndef MY_core_file_p
-#define MY_core_file_p _bfd_dummy_target
+#define MY_core_file_p _bfd_dummy_target
#endif
#ifndef MY_bfd_debug_info_start
@@ -900,20 +850,20 @@ tic30_aout_set_arch_mach (abfd, arch, machine)
#endif
#ifndef MY_bfd_debug_info_accumulate
#define MY_bfd_debug_info_accumulate \
- (void (*) PARAMS ((bfd*, struct bfd_section *))) bfd_void
+ (void (*) (bfd*, struct bfd_section *)) bfd_void
#endif
#ifndef MY_core_file_failing_command
-#define MY_core_file_failing_command NAME(aout,core_file_failing_command)
+#define MY_core_file_failing_command NAME (aout, core_file_failing_command)
#endif
#ifndef MY_core_file_failing_signal
-#define MY_core_file_failing_signal NAME(aout,core_file_failing_signal)
+#define MY_core_file_failing_signal NAME (aout, core_file_failing_signal)
#endif
#ifndef MY_core_file_matches_executable_p
-#define MY_core_file_matches_executable_p NAME(aout,core_file_matches_executable_p)
+#define MY_core_file_matches_executable_p NAME (aout, core_file_matches_executable_p)
#endif
#ifndef MY_set_section_contents
-#define MY_set_section_contents NAME(aout,set_section_contents)
+#define MY_set_section_contents NAME (aout, set_section_contents)
#endif
#ifndef MY_get_section_contents
#define MY_get_section_contents aout_32_get_section_contents
@@ -922,40 +872,40 @@ tic30_aout_set_arch_mach (abfd, arch, machine)
#define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#endif
#ifndef MY_new_section_hook
-#define MY_new_section_hook NAME(aout,new_section_hook)
+#define MY_new_section_hook NAME (aout, new_section_hook)
#endif
#ifndef MY_get_symtab_upper_bound
-#define MY_get_symtab_upper_bound NAME(aout,get_symtab_upper_bound)
+#define MY_get_symtab_upper_bound NAME (aout, get_symtab_upper_bound)
#endif
#ifndef MY_canonicalize_symtab
-#define MY_canonicalize_symtab NAME(aout,canonicalize_symtab)
+#define MY_canonicalize_symtab NAME (aout, canonicalize_symtab)
#endif
#ifndef MY_get_reloc_upper_bound
-#define MY_get_reloc_upper_bound NAME(aout,get_reloc_upper_bound)
+#define MY_get_reloc_upper_bound NAME (aout, get_reloc_upper_bound)
#endif
#ifndef MY_canonicalize_reloc
-#define MY_canonicalize_reloc NAME(aout,canonicalize_reloc)
+#define MY_canonicalize_reloc NAME (aout, canonicalize_reloc)
#endif
#ifndef MY_make_empty_symbol
-#define MY_make_empty_symbol NAME(aout,make_empty_symbol)
+#define MY_make_empty_symbol NAME (aout, make_empty_symbol)
#endif
#ifndef MY_print_symbol
-#define MY_print_symbol NAME(aout,print_symbol)
+#define MY_print_symbol NAME (aout, print_symbol)
#endif
#ifndef MY_get_symbol_info
-#define MY_get_symbol_info NAME(aout,get_symbol_info)
+#define MY_get_symbol_info NAME (aout, get_symbol_info)
#endif
#ifndef MY_get_lineno
-#define MY_get_lineno NAME(aout,get_lineno)
+#define MY_get_lineno NAME (aout, get_lineno)
#endif
#ifndef MY_set_arch_mach
#define MY_set_arch_mach tic30_aout_set_arch_mach
#endif
#ifndef MY_find_nearest_line
-#define MY_find_nearest_line NAME(aout,find_nearest_line)
+#define MY_find_nearest_line NAME (aout, find_nearest_line)
#endif
#ifndef MY_sizeof_headers
-#define MY_sizeof_headers NAME(aout,sizeof_headers)
+#define MY_sizeof_headers NAME (aout, sizeof_headers)
#endif
#ifndef MY_bfd_get_relocated_section_contents
#define MY_bfd_get_relocated_section_contents \
@@ -987,19 +937,19 @@ tic30_aout_set_arch_mach (abfd, arch, machine)
#define MY_bfd_make_debug_symbol 0
#endif
#ifndef MY_read_minisymbols
-#define MY_read_minisymbols NAME(aout,read_minisymbols)
+#define MY_read_minisymbols NAME (aout, read_minisymbols)
#endif
#ifndef MY_minisymbol_to_symbol
-#define MY_minisymbol_to_symbol NAME(aout,minisymbol_to_symbol)
+#define MY_minisymbol_to_symbol NAME (aout, minisymbol_to_symbol)
#endif
#ifndef MY_bfd_link_hash_table_create
-#define MY_bfd_link_hash_table_create NAME(aout,link_hash_table_create)
+#define MY_bfd_link_hash_table_create NAME (aout, link_hash_table_create)
#endif
#ifndef MY_bfd_link_hash_table_free
#define MY_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#endif
#ifndef MY_bfd_link_add_symbols
-#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols)
+#define MY_bfd_link_add_symbols NAME (aout, link_add_symbols)
#endif
#ifndef MY_bfd_link_just_syms
#define MY_bfd_link_just_syms _bfd_generic_link_just_syms
@@ -1042,7 +992,7 @@ tic30_aout_set_arch_mach (abfd, arch, machine)
#endif
#ifndef MY_bfd_free_cached_info
-#define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info)
+#define MY_bfd_free_cached_info NAME (aout, bfd_free_cached_info)
#endif
#ifndef MY_close_and_cleanup
@@ -1070,12 +1020,12 @@ tic30_aout_set_arch_mach (abfd, arch, machine)
_bfd_nodynamic_canonicalize_dynamic_reloc
#endif
-/* Aout symbols normally have leading underscores */
+/* Aout symbols normally have leading underscores. */
#ifndef MY_symbol_leading_char
#define MY_symbol_leading_char '_'
#endif
-/* Aout archives normally use spaces for padding */
+/* Aout archives normally use spaces for padding. */
#ifndef AR_PAD_CHAR
#define AR_PAD_CHAR ' '
#endif
@@ -1083,27 +1033,27 @@ tic30_aout_set_arch_mach (abfd, arch, machine)
#ifndef MY_BFD_TARGET
const bfd_target tic30_aout_vec =
{
- TARGETNAME, /* name */
+ TARGETNAME, /* Name. */
bfd_target_aout_flavour,
- BFD_ENDIAN_BIG, /* target byte order (big) */
- BFD_ENDIAN_BIG, /* target headers byte order (big) */
- (HAS_RELOC | /* object flags */
+ BFD_ENDIAN_BIG, /* Target byte order (big). */
+ BFD_ENDIAN_BIG, /* Target headers byte order (big). */
+ (HAS_RELOC | /* Object flags. */
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */
MY_symbol_leading_char,
- AR_PAD_CHAR, /* ar_pad_char */
- 15, /* ar_max_namelen */
+ AR_PAD_CHAR, /* AR_pad_char. */
+ 15, /* AR_max_namelen. */
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_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, MY_object_p, /* bfd_check_format */
+ bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
+ {_bfd_dummy_target, MY_object_p, /* bfd_check_format. */
bfd_generic_archive_p, MY_core_file_p},
- {bfd_false, MY_mkobject, /* bfd_set_format */
+ {bfd_false, MY_mkobject, /* bfd_set_format. */
_bfd_generic_mkarchive, bfd_false},
- {bfd_false, MY_write_object_contents, /* bfd_write_contents */
+ {bfd_false, MY_write_object_contents, /* bfd_write_contents. */
_bfd_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (MY),
@@ -1118,6 +1068,6 @@ const bfd_target tic30_aout_vec =
NULL,
- (PTR) MY_backend_data
+ MY_backend_data
};
#endif /* MY_BFD_TARGET */
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index f5e56e4..cd4a371 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -20,12 +20,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+/* Most of this hacked by Steve Chamberlain,
+ sac@cygnus.com. */
/*
-Most of this hacked by Steve Chamberlain,
- sac@cygnus.com
-*/
-/*
-
SECTION
coff backends
@@ -313,63 +310,63 @@ CODE_FRAGMENT
#define GNU_LINKONCE_WI ".gnu.linkonce.wi."
static long sec_to_styp_flags
- PARAMS ((const char *, flagword));
+ (const char *, flagword);
static bfd_boolean styp_to_sec_flags
- PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
+ (bfd *, void *, const char *, asection *, flagword *);
static bfd_boolean coff_bad_format_hook
- PARAMS ((bfd *, PTR));
+ (bfd *, void *);
static void coff_set_custom_section_alignment
- PARAMS ((bfd *, asection *, const struct coff_section_alignment_entry *,
- const unsigned int));
+ (bfd *, asection *, const struct coff_section_alignment_entry *,
+ const unsigned int);
static bfd_boolean coff_new_section_hook
- PARAMS ((bfd *, asection *));
+ (bfd *, asection *);
static bfd_boolean coff_set_arch_mach_hook
- PARAMS ((bfd *, PTR));
+ (bfd *, void *);
static bfd_boolean coff_write_relocs
- PARAMS ((bfd *, int));
+ (bfd *, int);
static bfd_boolean coff_set_flags
- PARAMS ((bfd *, unsigned int *, unsigned short *));
+ (bfd *, unsigned int *, unsigned short *);
static bfd_boolean coff_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long)) ATTRIBUTE_UNUSED;
+ (bfd *, enum bfd_architecture, unsigned long) ATTRIBUTE_UNUSED;
static bfd_boolean coff_compute_section_file_positions
- PARAMS ((bfd *));
+ (bfd *);
static bfd_boolean coff_write_object_contents
- PARAMS ((bfd *)) ATTRIBUTE_UNUSED;
+ (bfd *) ATTRIBUTE_UNUSED;
static bfd_boolean coff_set_section_contents
- PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type));
-static PTR buy_and_read
- PARAMS ((bfd *, file_ptr, bfd_size_type));
+ (bfd *, asection *, const void *, file_ptr, bfd_size_type);
+static void * buy_and_read
+ (bfd *, file_ptr, bfd_size_type);
static bfd_boolean coff_slurp_line_table
- PARAMS ((bfd *, asection *));
+ (bfd *, asection *);
static bfd_boolean coff_slurp_symbol_table
- PARAMS ((bfd *));
+ (bfd *);
static enum coff_symbol_classification coff_classify_symbol
- PARAMS ((bfd *, struct internal_syment *));
+ (bfd *, struct internal_syment *);
static bfd_boolean coff_slurp_reloc_table
- PARAMS ((bfd *, asection *, asymbol **));
+ (bfd *, asection *, asymbol **);
static long coff_canonicalize_reloc
- PARAMS ((bfd *, asection *, arelent **, asymbol **));
+ (bfd *, asection *, arelent **, asymbol **);
#ifndef coff_mkobject_hook
-static PTR coff_mkobject_hook
- PARAMS ((bfd *, PTR, PTR));
+static void * coff_mkobject_hook
+ (bfd *, void *, void *);
#endif
#ifdef COFF_WITH_PE
static flagword handle_COMDAT
- PARAMS ((bfd *, flagword, PTR, const char *, asection *));
+ (bfd *, flagword, void *, const char *, asection *);
#endif
#ifdef COFF_IMAGE_WITH_PE
static bfd_boolean coff_read_word
- PARAMS ((bfd *, unsigned int *));
+ (bfd *, unsigned int *);
static unsigned int coff_compute_checksum
- PARAMS ((bfd *));
+ (bfd *);
static bfd_boolean coff_apply_checksum
- PARAMS ((bfd *));
+ (bfd *);
#endif
#ifdef TICOFF
static bfd_boolean ticoff0_bad_format_hook
- PARAMS ((bfd *, PTR ));
+ (bfd *, void * );
static bfd_boolean ticoff1_bad_format_hook
- PARAMS ((bfd *, PTR ));
+ (bfd *, void * );
#endif
/* void warning(); */
@@ -382,6 +379,7 @@ static bfd_boolean ticoff1_bad_format_hook
#ifndef COFF_WITH_PE
/* Macros for setting debugging flags. */
+
#ifdef STYP_DEBUG
#define STYP_XCOFF_DEBUG STYP_DEBUG
#else
@@ -395,9 +393,7 @@ static bfd_boolean ticoff1_bad_format_hook
#endif
static long
-sec_to_styp_flags (sec_name, sec_flags)
- const char *sec_name;
- flagword sec_flags;
+sec_to_styp_flags (const char *sec_name, flagword sec_flags)
{
long styp_flags = 0;
@@ -520,9 +516,7 @@ sec_to_styp_flags (sec_name, sec_flags)
and honor whatever objcopy/strip, etc. sent us as input. */
static long
-sec_to_styp_flags (sec_name, sec_flags)
- const char *sec_name;
- flagword sec_flags;
+sec_to_styp_flags (const char *sec_name, flagword sec_flags)
{
long styp_flags = 0;
@@ -595,12 +589,11 @@ sec_to_styp_flags (sec_name, sec_flags)
#ifndef COFF_WITH_PE
static bfd_boolean
-styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
- bfd *abfd ATTRIBUTE_UNUSED;
- PTR hdr;
- const char *name;
- asection *section ATTRIBUTE_UNUSED;
- flagword *flags_ptr;
+styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED,
+ void * hdr,
+ const char *name,
+ asection *section ATTRIBUTE_UNUSED,
+ flagword *flags_ptr)
{
struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
long styp_flags = internal_s->s_flags;
@@ -738,12 +731,11 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
#else /* COFF_WITH_PE */
static flagword
-handle_COMDAT (abfd, sec_flags, hdr, name, section)
- bfd * abfd;
- flagword sec_flags;
- PTR hdr;
- const char *name;
- asection *section;
+handle_COMDAT (bfd * abfd,
+ flagword sec_flags,
+ void * hdr,
+ const char *name,
+ asection *section)
{
struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
bfd_byte *esymstart, *esym, *esymend;
@@ -781,7 +773,7 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
char buf[SYMNMLEN + 1];
const char *symname;
- bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &isym);
+ bfd_coff_swap_sym_in (abfd, esym, & isym);
if (sizeof (internal_s->s_name) > SYMNMLEN)
{
@@ -862,9 +854,9 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
seen_state = 1;
/* This is the section symbol. */
- bfd_coff_swap_aux_in (abfd, (PTR) (esym + bfd_coff_symesz (abfd)),
+ bfd_coff_swap_aux_in (abfd, (esym + bfd_coff_symesz (abfd)),
isym.n_type, isym.n_sclass,
- 0, isym.n_numaux, (PTR) &aux);
+ 0, isym.n_numaux, & aux);
target_name = strchr (name, '$');
if (target_name != NULL)
@@ -1007,12 +999,11 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
any purpose other than objdump? */
static bfd_boolean
-styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
- bfd *abfd;
- PTR hdr;
- const char *name;
- asection *section;
- flagword *flags_ptr;
+styp_to_sec_flags (bfd *abfd,
+ void * hdr,
+ const char *name,
+ asection *section,
+ flagword *flags_ptr)
{
struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
long styp_flags = internal_s->s_flags;
@@ -1177,34 +1168,34 @@ Special entry points for gdb to swap in coff symbol table parts:
.typedef struct
.{
. void (*_bfd_coff_swap_aux_in)
-. PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+. (bfd *, void *, int, int, int, int, void *);
.
. void (*_bfd_coff_swap_sym_in)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. void (*_bfd_coff_swap_lineno_in)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. unsigned int (*_bfd_coff_swap_aux_out)
-. PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+. (bfd *, void *, int, int, int, int, void *);
.
. unsigned int (*_bfd_coff_swap_sym_out)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. unsigned int (*_bfd_coff_swap_lineno_out)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. unsigned int (*_bfd_coff_swap_reloc_out)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. unsigned int (*_bfd_coff_swap_filehdr_out)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. unsigned int (*_bfd_coff_swap_aouthdr_out)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. unsigned int (*_bfd_coff_swap_scnhdr_out)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. unsigned int _bfd_filhsz;
. unsigned int _bfd_aoutsz;
@@ -1221,86 +1212,86 @@ Special entry points for gdb to swap in coff symbol table parts:
. unsigned int _bfd_coff_debug_string_prefix_length;
.
. void (*_bfd_coff_swap_filehdr_in)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. void (*_bfd_coff_swap_aouthdr_in)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. void (*_bfd_coff_swap_scnhdr_in)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. void (*_bfd_coff_swap_reloc_in)
-. PARAMS ((bfd *abfd, PTR, PTR));
+. (bfd *abfd, void *, void *);
.
. bfd_boolean (*_bfd_coff_bad_format_hook)
-. PARAMS ((bfd *, PTR));
+. (bfd *, void *);
.
. bfd_boolean (*_bfd_coff_set_arch_mach_hook)
-. PARAMS ((bfd *, PTR));
+. (bfd *, void *);
.
-. PTR (*_bfd_coff_mkobject_hook)
-. PARAMS ((bfd *, PTR, PTR));
+. void * (*_bfd_coff_mkobject_hook)
+. (bfd *, void *, void *);
.
. bfd_boolean (*_bfd_styp_to_sec_flags_hook)
-. PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
+. (bfd *, void *, const char *, asection *, flagword *);
.
. void (*_bfd_set_alignment_hook)
-. PARAMS ((bfd *, asection *, PTR));
+. (bfd *, asection *, void *);
.
. bfd_boolean (*_bfd_coff_slurp_symbol_table)
-. PARAMS ((bfd *));
+. (bfd *);
.
. bfd_boolean (*_bfd_coff_symname_in_debug)
-. PARAMS ((bfd *, struct internal_syment *));
+. (bfd *, struct internal_syment *);
.
. bfd_boolean (*_bfd_coff_pointerize_aux_hook)
-. PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
-. unsigned int, combined_entry_type *));
+. (bfd *, combined_entry_type *, combined_entry_type *,
+. unsigned int, combined_entry_type *);
.
. bfd_boolean (*_bfd_coff_print_aux)
-. PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *,
-. combined_entry_type *, unsigned int));
+. (bfd *, FILE *, combined_entry_type *, combined_entry_type *,
+. combined_entry_type *, unsigned int);
.
. void (*_bfd_coff_reloc16_extra_cases)
-. PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
-. bfd_byte *, unsigned int *, unsigned int *));
+. (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
+. bfd_byte *, unsigned int *, unsigned int *);
.
. int (*_bfd_coff_reloc16_estimate)
-. PARAMS ((bfd *, asection *, arelent *, unsigned int,
-. struct bfd_link_info *));
+. (bfd *, asection *, arelent *, unsigned int,
+. struct bfd_link_info *);
.
. enum coff_symbol_classification (*_bfd_coff_classify_symbol)
-. PARAMS ((bfd *, struct internal_syment *));
+. (bfd *, struct internal_syment *);
.
. bfd_boolean (*_bfd_coff_compute_section_file_positions)
-. PARAMS ((bfd *));
+. (bfd *);
.
. bfd_boolean (*_bfd_coff_start_final_link)
-. PARAMS ((bfd *, struct bfd_link_info *));
+. (bfd *, struct bfd_link_info *);
.
. bfd_boolean (*_bfd_coff_relocate_section)
-. PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
-. struct internal_reloc *, struct internal_syment *, asection **));
+. (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+. struct internal_reloc *, struct internal_syment *, asection **);
.
. reloc_howto_type *(*_bfd_coff_rtype_to_howto)
-. PARAMS ((bfd *, asection *, struct internal_reloc *,
+. (bfd *, asection *, struct internal_reloc *,
. struct coff_link_hash_entry *, struct internal_syment *,
-. bfd_vma *));
+. bfd_vma *);
.
. bfd_boolean (*_bfd_coff_adjust_symndx)
-. PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
-. struct internal_reloc *, bfd_boolean *));
+. (bfd *, struct bfd_link_info *, bfd *, asection *,
+. struct internal_reloc *, bfd_boolean *);
.
. bfd_boolean (*_bfd_coff_link_add_one_symbol)
-. PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
+. (struct bfd_link_info *, bfd *, const char *, flagword,
. asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
-. struct bfd_link_hash_entry **));
+. struct bfd_link_hash_entry **);
.
. bfd_boolean (*_bfd_coff_link_output_has_begun)
-. PARAMS ((bfd *, struct coff_final_link_info *));
+. (bfd *, struct coff_final_link_info *);
.
. bfd_boolean (*_bfd_coff_final_link_postscript)
-. PARAMS ((bfd *, struct coff_final_link_info *));
+. (bfd *, struct coff_final_link_info *);
.
.} bfd_coff_backend_data;
.
@@ -1430,18 +1421,16 @@ Special entry points for gdb to swap in coff symbol table parts:
. (info, abfd, name, flags, section, value, string, cp, coll, hashp))
.
.#define bfd_coff_link_output_has_begun(a,p) \
-. ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p))
+. ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p))
.#define bfd_coff_final_link_postscript(a,p) \
-. ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p))
+. ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a, p))
.
*/
/* See whether the magic number matches. */
static bfd_boolean
-coff_bad_format_hook (abfd, filehdr)
- bfd * abfd ATTRIBUTE_UNUSED;
- PTR filehdr;
+coff_bad_format_hook (bfd * abfd ATTRIBUTE_UNUSED, void * filehdr)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
@@ -1466,9 +1455,7 @@ coff_bad_format_hook (abfd, filehdr)
#ifdef TICOFF
static bfd_boolean
-ticoff0_bad_format_hook (abfd, filehdr)
- bfd *abfd ATTRIBUTE_UNUSED;
- PTR filehdr;
+ticoff0_bad_format_hook (bfd *abfd ATTRIBUTE_UNUSED, void * filehdr)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
@@ -1481,9 +1468,7 @@ ticoff0_bad_format_hook (abfd, filehdr)
#ifdef TICOFF
static bfd_boolean
-ticoff1_bad_format_hook (abfd, filehdr)
- bfd *abfd ATTRIBUTE_UNUSED;
- PTR filehdr;
+ticoff1_bad_format_hook (bfd *abfd ATTRIBUTE_UNUSED, void * filehdr)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
@@ -1498,11 +1483,10 @@ ticoff1_bad_format_hook (abfd, filehdr)
default. */
static void
-coff_set_custom_section_alignment (abfd, section, alignment_table, table_size)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section;
- const struct coff_section_alignment_entry *alignment_table;
- const unsigned int table_size;
+coff_set_custom_section_alignment (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *section,
+ const struct coff_section_alignment_entry *alignment_table,
+ const unsigned int table_size)
{
const unsigned int default_alignment = COFF_DEFAULT_SECTION_ALIGNMENT_POWER;
unsigned int i;
@@ -1562,9 +1546,7 @@ static const unsigned int coff_section_alignment_table_size =
particular implementation of COFF. */
static bfd_boolean
-coff_new_section_hook (abfd, section)
- bfd * abfd;
- asection * section;
+coff_new_section_hook (bfd * abfd, asection * section)
{
combined_entry_type *native;
bfd_size_type amt;
@@ -1586,7 +1568,7 @@ coff_new_section_hook (abfd, section)
@@ The 10 is a guess at a plausible maximum number of aux entries
(but shouldn't be a constant). */
amt = sizeof (combined_entry_type) * 10;
- native = (combined_entry_type *) bfd_zalloc (abfd, amt);
+ native = bfd_zalloc (abfd, amt);
if (native == NULL)
return FALSE;
@@ -1612,13 +1594,10 @@ coff_new_section_hook (abfd, section)
/* Set the alignment of a BFD section. */
-static void coff_set_alignment_hook PARAMS ((bfd *, asection *, PTR));
-
static void
-coff_set_alignment_hook (abfd, section, scnhdr)
- bfd * abfd ATTRIBUTE_UNUSED;
- asection * section;
- PTR scnhdr;
+coff_set_alignment_hook (bfd * abfd ATTRIBUTE_UNUSED,
+ asection * section,
+ void * scnhdr)
{
struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr;
unsigned int i;
@@ -1647,25 +1626,22 @@ coff_set_alignment_hook (abfd, section, scnhdr)
#ifdef COFF_WITH_PE
/* A couple of macros to help setting the alignment power field. */
-#define ALIGN_SET(field,x,y) \
- if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x )\
- {\
- section->alignment_power = y;\
- }
-
-#define ELIFALIGN_SET(field,x,y) \
- else if (( (field) & IMAGE_SCN_ALIGN_64BYTES) == x ) \
- {\
- section->alignment_power = y;\
- }
+#define ALIGN_SET(field, x, y) \
+ if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x)\
+ {\
+ section->alignment_power = y;\
+ }
-static void coff_set_alignment_hook PARAMS ((bfd *, asection *, PTR));
+#define ELIFALIGN_SET(field, x, y) \
+ else if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x) \
+ {\
+ section->alignment_power = y;\
+ }
static void
-coff_set_alignment_hook (abfd, section, scnhdr)
- bfd * abfd ATTRIBUTE_UNUSED;
- asection * section;
- PTR scnhdr;
+coff_set_alignment_hook (bfd * abfd ATTRIBUTE_UNUSED,
+ asection * section,
+ void * scnhdr)
{
struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr;
bfd_size_type amt;
@@ -1685,22 +1661,19 @@ coff_set_alignment_hook (abfd, section, scnhdr)
if (coff_section_data (abfd, section) == NULL)
{
amt = sizeof (struct coff_section_tdata);
- section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
+ section->used_by_bfd = bfd_zalloc (abfd, amt);
if (section->used_by_bfd == NULL)
- {
- /* FIXME: Return error. */
- abort ();
- }
+ /* FIXME: Return error. */
+ abort ();
}
+
if (pei_section_data (abfd, section) == NULL)
{
amt = sizeof (struct pei_section_tdata);
- coff_section_data (abfd, section)->tdata = (PTR) bfd_zalloc (abfd, amt);
+ coff_section_data (abfd, section)->tdata = bfd_zalloc (abfd, amt);
if (coff_section_data (abfd, section)->tdata == NULL)
- {
- /* FIXME: Return error. */
- abort ();
- }
+ /* FIXME: Return error. */
+ abort ();
}
pei_section_data (abfd, section)->virt_size = hdr->s_paddr;
pei_section_data (abfd, section)->pe_flags = hdr->s_flags;
@@ -1716,7 +1689,7 @@ coff_set_alignment_hook (abfd, section, scnhdr)
bfd_size_type relsz = bfd_coff_relsz (abfd);
bfd_seek (abfd, (file_ptr) hdr->s_relptr, 0);
- if (bfd_bread ((PTR) &dst, relsz, abfd) != relsz)
+ if (bfd_bread (& dst, relsz, abfd) != relsz)
return;
coff_swap_reloc_in (abfd, &dst, &n);
@@ -1739,13 +1712,8 @@ coff_set_alignment_hook (abfd, section, scnhdr)
When we see one, we correct the reloc and line number counts in the
real header, and remove the section we just created. */
-static void coff_set_alignment_hook PARAMS ((bfd *, asection *, PTR));
-
static void
-coff_set_alignment_hook (abfd, section, scnhdr)
- bfd *abfd;
- asection *section;
- PTR scnhdr;
+coff_set_alignment_hook (bfd *abfd, asection *section, void * scnhdr)
{
struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr;
asection *real_sec;
@@ -1775,7 +1743,7 @@ coff_set_alignment_hook (abfd, section, scnhdr)
#else /* ! RS6000COFF_C */
#define coff_set_alignment_hook \
- ((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void)
+ ((void (*) (bfd *, asection *, void *)) bfd_void)
#endif /* ! RS6000COFF_C */
#endif /* ! COFF_WITH_PE */
@@ -1783,22 +1751,19 @@ coff_set_alignment_hook (abfd, section, scnhdr)
#ifndef coff_mkobject
-static bfd_boolean coff_mkobject PARAMS ((bfd *));
-
static bfd_boolean
-coff_mkobject (abfd)
- bfd * abfd;
+coff_mkobject (bfd * abfd)
{
coff_data_type *coff;
bfd_size_type amt = sizeof (coff_data_type);
- abfd->tdata.coff_obj_data = (struct coff_tdata *) bfd_zalloc (abfd, amt);
- if (abfd->tdata.coff_obj_data == 0)
+ abfd->tdata.coff_obj_data = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.coff_obj_data == NULL)
return FALSE;
coff = coff_data (abfd);
- coff->symbols = (coff_symbol_type *) NULL;
- coff->conversion_table = (unsigned int *) NULL;
- coff->raw_syments = (struct coff_ptr_struct *) NULL;
+ coff->symbols = NULL;
+ coff->conversion_table = NULL;
+ coff->raw_syments = NULL;
coff->relocbase = 0;
coff->local_toc_sym_map = 0;
@@ -1811,11 +1776,10 @@ coff_mkobject (abfd)
/* Create the COFF backend specific information. */
#ifndef coff_mkobject_hook
-static PTR
-coff_mkobject_hook (abfd, filehdr, aouthdr)
- bfd * abfd;
- PTR filehdr;
- PTR aouthdr ATTRIBUTE_UNUSED;
+static void *
+coff_mkobject_hook (bfd * abfd,
+ void * filehdr,
+ void * aouthdr ATTRIBUTE_UNUSED)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
coff_data_type *coff;
@@ -1885,7 +1849,7 @@ coff_mkobject_hook (abfd, filehdr, aouthdr)
abfd->flags |= HAS_DEBUG;
#endif
- return (PTR) coff;
+ return coff;
}
#endif
@@ -1897,9 +1861,7 @@ coff_mkobject_hook (abfd, filehdr, aouthdr)
at linking together COFF files for different architectures. */
static bfd_boolean
-coff_set_arch_mach_hook (abfd, filehdr)
- bfd *abfd;
- PTR filehdr;
+coff_set_arch_mach_hook (bfd *abfd, void * filehdr)
{
unsigned long machine;
enum bfd_architecture arch;
@@ -2092,14 +2054,14 @@ coff_set_arch_mach_hook (abfd, filehdr)
struct internal_syment sym;
bfd_size_type amt = bfd_coff_symesz (abfd);
- buf = (bfd_byte *) bfd_malloc (amt);
+ buf = bfd_malloc (amt);
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
|| bfd_bread (buf, amt, abfd) != amt)
{
free (buf);
return FALSE;
}
- bfd_coff_swap_sym_in (abfd, (PTR) buf, (PTR) &sym);
+ bfd_coff_swap_sym_in (abfd, buf, & sym);
if (sym.n_sclass == C_FILE)
cputype = sym.n_type & 0xff;
else
@@ -2288,13 +2250,8 @@ coff_set_arch_mach_hook (abfd, filehdr)
#ifdef SYMNAME_IN_DEBUG
-static bfd_boolean symname_in_debug_hook
- PARAMS ((bfd *, struct internal_syment *));
-
static bfd_boolean
-symname_in_debug_hook (abfd, sym)
- bfd * abfd ATTRIBUTE_UNUSED;
- struct internal_syment *sym;
+symname_in_debug_hook (bfd * abfd ATTRIBUTE_UNUSED, struct internal_syment *sym)
{
return SYMNAME_IN_DEBUG (sym) != 0;
}
@@ -2302,7 +2259,7 @@ symname_in_debug_hook (abfd, sym)
#else
#define symname_in_debug_hook \
- (bfd_boolean (*) PARAMS ((bfd *, struct internal_syment *))) bfd_false
+ (bfd_boolean (*) (bfd *, struct internal_syment *)) bfd_false
#endif
@@ -2314,17 +2271,12 @@ symname_in_debug_hook (abfd, sym)
/* Handle the csect auxent of a C_EXT or C_HIDEXT symbol. */
-static bfd_boolean coff_pointerize_aux_hook
- PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
- unsigned int, combined_entry_type *));
-
static bfd_boolean
-coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
- bfd *abfd ATTRIBUTE_UNUSED;
- combined_entry_type *table_base;
- combined_entry_type *symbol;
- unsigned int indaux;
- combined_entry_type *aux;
+coff_pointerize_aux_hook (bfd *abfd ATTRIBUTE_UNUSED,
+ combined_entry_type *table_base,
+ combined_entry_type *symbol,
+ unsigned int indaux,
+ combined_entry_type *aux)
{
int class = symbol->u.syment.n_sclass;
@@ -2353,17 +2305,12 @@ coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
/* We don't want to pointerize bal entries. */
-static bfd_boolean coff_pointerize_aux_hook
- PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
- unsigned int, combined_entry_type *));
-
static bfd_boolean
-coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
- bfd *abfd ATTRIBUTE_UNUSED;
- combined_entry_type *table_base ATTRIBUTE_UNUSED;
- combined_entry_type *symbol;
- unsigned int indaux;
- combined_entry_type *aux ATTRIBUTE_UNUSED;
+coff_pointerize_aux_hook (bfd *abfd ATTRIBUTE_UNUSED,
+ combined_entry_type *table_base ATTRIBUTE_UNUSED,
+ combined_entry_type *symbol,
+ unsigned int indaux,
+ combined_entry_type *aux ATTRIBUTE_UNUSED)
{
/* Return TRUE if we don't want to pointerize this aux entry, which
is the case for the lastfirst aux entry for a C_LEAFPROC symbol. */
@@ -2382,18 +2329,13 @@ coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
/* Print an aux entry. This returns TRUE if it has printed it. */
-static bfd_boolean coff_print_aux
- PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *,
- combined_entry_type *, unsigned int));
-
static bfd_boolean
-coff_print_aux (abfd, file, table_base, symbol, aux, indaux)
- bfd *abfd ATTRIBUTE_UNUSED;
- FILE *file ATTRIBUTE_UNUSED;
- combined_entry_type *table_base ATTRIBUTE_UNUSED;
- combined_entry_type *symbol ATTRIBUTE_UNUSED;
- combined_entry_type *aux ATTRIBUTE_UNUSED;
- unsigned int indaux ATTRIBUTE_UNUSED;
+coff_print_aux (bfd *abfd ATTRIBUTE_UNUSED,
+ FILE *file ATTRIBUTE_UNUSED,
+ combined_entry_type *table_base ATTRIBUTE_UNUSED,
+ combined_entry_type *symbol ATTRIBUTE_UNUSED,
+ combined_entry_type *aux ATTRIBUTE_UNUSED,
+ unsigned int indaux ATTRIBUTE_UNUSED)
{
#ifdef RS6000COFF_C
if ((symbol->u.syment.n_sclass == C_EXT
@@ -2461,13 +2403,10 @@ SUBSUBSECTION
#ifdef TARG_AUX
-static int compare_arelent_ptr PARAMS ((const PTR, const PTR));
/* AUX's ld wants relocations to be sorted. */
static int
-compare_arelent_ptr (x, y)
- const PTR x;
- const PTR y;
+compare_arelent_ptr (const void * x, const void * y)
{
const arelent **a = (const arelent **) x;
const arelent **b = (const arelent **) y;
@@ -2480,13 +2419,11 @@ compare_arelent_ptr (x, y)
#endif /* TARG_AUX */
static bfd_boolean
-coff_write_relocs (abfd, first_undef)
- bfd * abfd;
- int first_undef;
+coff_write_relocs (bfd * abfd, int first_undef)
{
asection *s;
- for (s = abfd->sections; s != (asection *) NULL; s = s->next)
+ for (s = abfd->sections; s != NULL; s = s->next)
{
unsigned int i;
struct external_reloc dst;
@@ -2501,7 +2438,7 @@ coff_write_relocs (abfd, first_undef)
amt = s->reloc_count;
amt *= sizeof (arelent *);
- p = (arelent **) bfd_malloc (amt);
+ p = bfd_malloc (amt);
if (p == NULL && s->reloc_count > 0)
return FALSE;
memcpy (p, s->orelocation, (size_t) amt);
@@ -2518,12 +2455,12 @@ coff_write_relocs (abfd, first_undef)
/* Encode real count here as first reloc. */
struct internal_reloc n;
- memset ((PTR) & n, 0, sizeof (n));
+ memset (& n, 0, sizeof (n));
/* Add one to count *this* reloc (grr). */
n.r_vaddr = s->reloc_count + 1;
coff_swap_reloc_out (abfd, &n, &dst);
- if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd),
- abfd) != bfd_coff_relsz (abfd))
+ if (bfd_bwrite (& dst, (bfd_size_type) bfd_coff_relsz (abfd),
+ abfd) != bfd_coff_relsz (abfd))
return FALSE;
}
#endif
@@ -2533,7 +2470,7 @@ coff_write_relocs (abfd, first_undef)
struct internal_reloc n;
arelent *q = p[i];
- memset ((PTR) & n, 0, sizeof (n));
+ memset (& n, 0, sizeof (n));
/* Now we've renumbered the symbols we know where the
undefined symbols live in the table. Check the reloc
@@ -2555,11 +2492,12 @@ coff_write_relocs (abfd, first_undef)
{
const char *intable = outsyms[j]->name;
- if (strcmp (intable, sname) == 0) {
- /* Got a hit, so repoint the reloc. */
- q->sym_ptr_ptr = outsyms + j;
- break;
- }
+ if (strcmp (intable, sname) == 0)
+ {
+ /* Got a hit, so repoint the reloc. */
+ q->sym_ptr_ptr = outsyms + j;
+ break;
+ }
}
}
@@ -2576,7 +2514,7 @@ coff_write_relocs (abfd, first_undef)
if (q->sym_ptr_ptr)
{
#ifdef SECTION_RELATIVE_ABSOLUTE_SYMBOL_P
- if (SECTION_RELATIVE_ABSOLUTE_SYMBOL_P (q,s))
+ if (SECTION_RELATIVE_ABSOLUTE_SYMBOL_P (q, s))
#else
if ((*q->sym_ptr_ptr)->section == bfd_abs_section_ptr
&& ((*q->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0)
@@ -2606,7 +2544,7 @@ coff_write_relocs (abfd, first_undef)
#endif
coff_swap_reloc_out (abfd, &n, &dst);
- if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd),
+ if (bfd_bwrite (& dst, (bfd_size_type) bfd_coff_relsz (abfd),
abfd) != bfd_coff_relsz (abfd))
return FALSE;
}
@@ -2624,68 +2562,44 @@ coff_write_relocs (abfd, first_undef)
type. Result is TRUE if we can represent the arch&type, FALSE if not. */
static bfd_boolean
-coff_set_flags (abfd, magicp, flagsp)
- bfd * abfd;
- unsigned int *magicp ATTRIBUTE_UNUSED;
- unsigned short *flagsp ATTRIBUTE_UNUSED;
+coff_set_flags (bfd * abfd,
+ unsigned int *magicp ATTRIBUTE_UNUSED,
+ unsigned short *flagsp ATTRIBUTE_UNUSED)
{
switch (bfd_get_arch (abfd))
{
#ifdef Z8KMAGIC
case bfd_arch_z8k:
*magicp = Z8KMAGIC;
+
switch (bfd_get_mach (abfd))
{
- case bfd_mach_z8001:
- *flagsp = F_Z8001;
- break;
- case bfd_mach_z8002:
- *flagsp = F_Z8002;
- break;
- default:
- return FALSE;
+ case bfd_mach_z8001: *flagsp = F_Z8001; break;
+ case bfd_mach_z8002: *flagsp = F_Z8002; break;
+ default: return FALSE;
}
return TRUE;
#endif
-#ifdef I960ROMAGIC
+#ifdef I960ROMAGIC
case bfd_arch_i960:
{
unsigned flags;
+
*magicp = I960ROMAGIC;
- /*
- ((bfd_get_file_flags(abfd) & WP_TEXT) ? I960ROMAGIC :
- I960RWMAGIC); FIXME???
- */
+
switch (bfd_get_mach (abfd))
{
- case bfd_mach_i960_core:
- flags = F_I960CORE;
- break;
- case bfd_mach_i960_kb_sb:
- flags = F_I960KB;
- break;
- case bfd_mach_i960_mc:
- flags = F_I960MC;
- break;
- case bfd_mach_i960_xa:
- flags = F_I960XA;
- break;
- case bfd_mach_i960_ca:
- flags = F_I960CA;
- break;
- case bfd_mach_i960_ka_sa:
- flags = F_I960KA;
- break;
- case bfd_mach_i960_jx:
- flags = F_I960JX;
- break;
- case bfd_mach_i960_hx:
- flags = F_I960HX;
- break;
- default:
- return FALSE;
+ case bfd_mach_i960_core: flags = F_I960CORE; break;
+ case bfd_mach_i960_kb_sb: flags = F_I960KB; break;
+ case bfd_mach_i960_mc: flags = F_I960MC; break;
+ case bfd_mach_i960_xa: flags = F_I960XA; break;
+ case bfd_mach_i960_ca: flags = F_I960CA; break;
+ case bfd_mach_i960_ka_sa: flags = F_I960KA; break;
+ case bfd_mach_i960_jx: flags = F_I960JX; break;
+ case bfd_mach_i960_hx: flags = F_I960HX; break;
+ default: return FALSE;
}
*flagsp = flags;
return TRUE;
@@ -2731,6 +2645,7 @@ coff_set_flags (abfd, magicp, flagsp)
*magicp = TIC80_ARCH_MAGIC;
return TRUE;
#endif
+
#ifdef ARMMAGIC
case bfd_arch_arm:
#ifdef ARM_WINCE
@@ -2769,12 +2684,13 @@ coff_set_flags (abfd, magicp, flagsp)
}
return TRUE;
#endif
+
#ifdef PPCMAGIC
case bfd_arch_powerpc:
*magicp = PPCMAGIC;
return TRUE;
- break;
#endif
+
#ifdef I386MAGIC
case bfd_arch_i386:
*magicp = I386MAGIC;
@@ -2783,20 +2699,20 @@ coff_set_flags (abfd, magicp, flagsp)
*magicp = LYNXCOFFMAGIC;
#endif
return TRUE;
- break;
#endif
+
#ifdef I860MAGIC
case bfd_arch_i860:
*magicp = I860MAGIC;
return TRUE;
- break;
#endif
+
#ifdef IA64MAGIC
case bfd_arch_ia64:
*magicp = IA64MAGIC;
return TRUE;
- break;
#endif
+
#ifdef MC68MAGIC
case bfd_arch_m68k:
#ifdef APOLLOM68KMAGIC
@@ -2814,34 +2730,24 @@ coff_set_flags (abfd, magicp, flagsp)
*magicp = LYNXCOFFMAGIC;
#endif
return TRUE;
- break;
#endif
#ifdef MC88MAGIC
case bfd_arch_m88k:
*magicp = MC88OMAGIC;
return TRUE;
- break;
#endif
+
#ifdef H8300MAGIC
case bfd_arch_h8300:
switch (bfd_get_mach (abfd))
{
- case bfd_mach_h8300:
- *magicp = H8300MAGIC;
- return TRUE;
- case bfd_mach_h8300h:
- *magicp = H8300HMAGIC;
- return TRUE;
- case bfd_mach_h8300s:
- *magicp = H8300SMAGIC;
- return TRUE;
- case bfd_mach_h8300hn:
- *magicp = H8300HNMAGIC;
- return TRUE;
- case bfd_mach_h8300sn:
- *magicp = H8300SNMAGIC;
- return TRUE;
+ case bfd_mach_h8300: *magicp = H8300MAGIC; return TRUE;
+ case bfd_mach_h8300h: *magicp = H8300HMAGIC; return TRUE;
+ case bfd_mach_h8300s: *magicp = H8300SMAGIC; return TRUE;
+ case bfd_mach_h8300hn: *magicp = H8300HNMAGIC; return TRUE;
+ case bfd_mach_h8300sn: *magicp = H8300SNMAGIC; return TRUE;
+ default: break;
}
break;
#endif
@@ -2857,14 +2763,12 @@ coff_set_flags (abfd, magicp, flagsp)
*magicp = SH_ARCH_MAGIC_LITTLE;
#endif
return TRUE;
- break;
#endif
#ifdef MIPS_ARCH_MAGIC_WINCE
case bfd_arch_mips:
*magicp = MIPS_ARCH_MAGIC_WINCE;
return TRUE;
- break;
#endif
#ifdef SPARCMAGIC
@@ -2875,7 +2779,6 @@ coff_set_flags (abfd, magicp, flagsp)
*magicp = LYNXCOFFMAGIC;
#endif
return TRUE;
- break;
#endif
#ifdef H8500MAGIC
@@ -2884,6 +2787,7 @@ coff_set_flags (abfd, magicp, flagsp)
return TRUE;
break;
#endif
+
#ifdef A29K_MAGIC_BIG
case bfd_arch_a29k:
if (bfd_big_endian (abfd))
@@ -2891,14 +2795,12 @@ coff_set_flags (abfd, magicp, flagsp)
else
*magicp = A29K_MAGIC_LITTLE;
return TRUE;
- break;
#endif
#ifdef WE32KMAGIC
case bfd_arch_we32k:
*magicp = WE32KMAGIC;
return TRUE;
- break;
#endif
#ifdef RS6000COFF_C
@@ -2909,7 +2811,6 @@ coff_set_flags (abfd, magicp, flagsp)
BFD_ASSERT (bfd_get_flavour (abfd) == bfd_target_xcoff_flavour);
*magicp = bfd_xcoff_magic_number (abfd);
return TRUE;
- break;
#endif
#ifdef MCOREMAGIC
@@ -2938,14 +2839,9 @@ coff_set_flags (abfd, magicp, flagsp)
* magicp = MAXQ20MAGIC;
switch (bfd_get_mach (abfd))
{
- case bfd_mach_maxq10:
- * flagsp = F_MAXQ10;
- return TRUE;
- case bfd_mach_maxq20:
- * flagsp = F_MAXQ20;
- return TRUE;
- default:
- return FALSE;
+ case bfd_mach_maxq10: * flagsp = F_MAXQ10; return TRUE;
+ case bfd_mach_maxq20: * flagsp = F_MAXQ20; return TRUE;
+ default: return FALSE;
}
#endif
@@ -2959,10 +2855,9 @@ coff_set_flags (abfd, magicp, flagsp)
}
static bfd_boolean
-coff_set_arch_mach (abfd, arch, machine)
- bfd * abfd;
- enum bfd_architecture arch;
- unsigned long machine;
+coff_set_arch_mach (bfd * abfd,
+ enum bfd_architecture arch,
+ unsigned long machine)
{
unsigned dummy1;
unsigned short dummy2;
@@ -2972,9 +2867,9 @@ coff_set_arch_mach (abfd, arch, machine)
if (arch != bfd_arch_unknown
&& ! coff_set_flags (abfd, &dummy1, &dummy2))
- return FALSE; /* We can't represent this type */
+ return FALSE; /* We can't represent this type. */
- return TRUE; /* We're easy ... */
+ return TRUE; /* We're easy... */
}
#ifdef COFF_IMAGE_WITH_PE
@@ -2982,12 +2877,8 @@ coff_set_arch_mach (abfd, arch, machine)
/* This is used to sort sections by VMA, as required by PE image
files. */
-static int sort_by_secaddr PARAMS ((const PTR, const PTR));
-
static int
-sort_by_secaddr (arg1, arg2)
- const PTR arg1;
- const PTR arg2;
+sort_by_secaddr (const void * arg1, const void * arg2)
{
const asection *a = *(const asection **) arg1;
const asection *b = *(const asection **) arg2;
@@ -2996,8 +2887,8 @@ sort_by_secaddr (arg1, arg2)
return -1;
else if (a->vma > b->vma)
return 1;
- else
- return 0;
+
+ return 0;
}
#endif /* COFF_IMAGE_WITH_PE */
@@ -3012,11 +2903,10 @@ sort_by_secaddr (arg1, arg2)
#endif
static bfd_boolean
-coff_compute_section_file_positions (abfd)
- bfd * abfd;
+coff_compute_section_file_positions (bfd * abfd)
{
asection *current;
- asection *previous = (asection *) NULL;
+ asection *previous = NULL;
file_ptr sofar = bfd_coff_filhsz (abfd);
bfd_boolean align_adjust;
#ifdef ALIGN_SECTIONS_IN_FILE
@@ -3064,6 +2954,7 @@ coff_compute_section_file_positions (abfd)
#ifdef COFF_IMAGE_WITH_PE
int page_size;
+
if (coff_data (abfd)->link_info)
{
page_size = pe_data (abfd)->pe_opthdr.FileAlignment;
@@ -3082,11 +2973,9 @@ coff_compute_section_file_positions (abfd)
#endif
if (bfd_get_start_address (abfd))
- {
- /* A start address may have been added to the original file. In this
- case it will need an optional header to record it. */
- abfd->flags |= EXEC_P;
- }
+ /* A start address may have been added to the original file. In this
+ case it will need an optional header to record it. */
+ abfd->flags |= EXEC_P;
if (abfd->flags & EXEC_P)
sofar += bfd_coff_aoutsz (abfd);
@@ -3184,7 +3073,7 @@ coff_compute_section_file_positions (abfd)
align_adjust = FALSE;
for (current = abfd->sections;
- current != (asection *) NULL;
+ current != NULL;
current = current->next)
{
#ifdef COFF_IMAGE_WITH_PE
@@ -3193,15 +3082,16 @@ coff_compute_section_file_positions (abfd)
if (coff_section_data (abfd, current) == NULL)
{
bfd_size_type amt = sizeof (struct coff_section_tdata);
- current->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
+
+ current->used_by_bfd = bfd_zalloc (abfd, amt);
if (current->used_by_bfd == NULL)
return FALSE;
}
if (pei_section_data (abfd, current) == NULL)
{
bfd_size_type amt = sizeof (struct pei_section_tdata);
- coff_section_data (abfd, current)->tdata
- = (PTR) bfd_zalloc (abfd, amt);
+
+ coff_section_data (abfd, current)->tdata = bfd_zalloc (abfd, amt);
if (coff_section_data (abfd, current)->tdata == NULL)
return FALSE;
}
@@ -3228,8 +3118,8 @@ coff_compute_section_file_positions (abfd)
{
/* Make sure this section is aligned on the right boundary - by
padding the previous section up if necessary. */
-
old_sofar = sofar;
+
#ifdef RS6000COFF_C
/* AIX loader checks the text section alignment of (vma - filepos)
So even though the filepos may be aligned wrt the o_algntext, for
@@ -3262,7 +3152,7 @@ coff_compute_section_file_positions (abfd)
sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
}
#endif
- if (previous != (asection *) NULL)
+ if (previous != NULL)
previous->size += sofar - old_sofar;
}
@@ -3356,9 +3246,7 @@ static unsigned int pelength;
static unsigned int peheader;
static bfd_boolean
-coff_read_word (abfd, value)
- bfd *abfd;
- unsigned int *value;
+coff_read_word (bfd *abfd, unsigned int *value)
{
unsigned char b[2];
int status;
@@ -3381,8 +3269,7 @@ coff_read_word (abfd, value)
}
static unsigned int
-coff_compute_checksum (abfd)
- bfd *abfd;
+coff_compute_checksum (bfd *abfd)
{
bfd_boolean more_data;
file_ptr filepos;
@@ -3409,8 +3296,7 @@ coff_compute_checksum (abfd)
}
static bfd_boolean
-coff_apply_checksum (abfd)
- bfd *abfd;
+coff_apply_checksum (bfd *abfd)
{
unsigned int computed;
unsigned int checksum = 0;
@@ -3444,11 +3330,8 @@ coff_apply_checksum (abfd)
#endif /* COFF_IMAGE_WITH_PE */
-/* SUPPRESS 558 */
-/* SUPPRESS 529 */
static bfd_boolean
-coff_write_object_contents (abfd)
- bfd * abfd;
+coff_write_object_contents (bfd * abfd)
{
asection *current;
bfd_boolean hasrelocs = FALSE;
@@ -3474,7 +3357,6 @@ coff_write_object_contents (abfd)
/* Make a pass through the symbol table to count line number entries and
put them into the correct asections. */
-
lnno_size = coff_count_linenumbers (abfd) * bfd_coff_linesz (abfd);
if (! abfd->output_has_begun)
@@ -3514,9 +3396,8 @@ coff_write_object_contents (abfd)
lineno_base += current->lineno_count * bfd_coff_linesz (abfd);
}
else
- {
- current->line_filepos = 0;
- }
+ current->line_filepos = 0;
+
if (current->reloc_count)
{
current->rel_filepos = reloc_base;
@@ -3528,9 +3409,7 @@ coff_write_object_contents (abfd)
#endif
}
else
- {
- current->rel_filepos = 0;
- }
+ current->rel_filepos = 0;
}
/* Write section headers to the file. */
@@ -3689,7 +3568,7 @@ coff_write_object_contents (abfd)
bfd_size_type amt = bfd_coff_scnhsz (abfd);
if (coff_swap_scnhdr_out (abfd, &section, &buff) == 0
- || bfd_bwrite ((PTR) &buff, amt, abfd) != amt)
+ || bfd_bwrite (& buff, amt, abfd) != amt)
return FALSE;
}
@@ -3813,7 +3692,7 @@ coff_write_object_contents (abfd)
scnhdr.s_flags = STYP_OVRFLO;
amt = bfd_coff_scnhsz (abfd);
if (coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0
- || bfd_bwrite ((PTR) &buff, amt, abfd) != amt)
+ || bfd_bwrite (& buff, amt, abfd) != amt)
return FALSE;
}
}
@@ -4184,7 +4063,7 @@ coff_write_object_contents (abfd)
}
#endif
- /* now write them */
+ /* Now write them. */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
return FALSE;
@@ -4196,8 +4075,8 @@ coff_write_object_contents (abfd)
if (buff == NULL)
return FALSE;
- bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, (PTR) buff);
- amount = bfd_bwrite ((PTR) buff, amount, abfd);
+ bfd_coff_swap_filehdr_out (abfd, & internal_f, buff);
+ amount = bfd_bwrite (buff, amount, abfd);
free (buff);
@@ -4216,8 +4095,8 @@ coff_write_object_contents (abfd)
if (buff == NULL)
return FALSE;
- coff_swap_aouthdr_out (abfd, (PTR) &internal_a, (PTR) buff);
- amount = bfd_bwrite ((PTR) buff, amount, abfd);
+ coff_swap_aouthdr_out (abfd, & internal_a, buff);
+ amount = bfd_bwrite (buff, amount, abfd);
free (buff);
@@ -4236,12 +4115,12 @@ coff_write_object_contents (abfd)
size_t size;
/* XCOFF seems to always write at least a small a.out header. */
- coff_swap_aouthdr_out (abfd, (PTR) &internal_a, (PTR) &buff);
+ coff_swap_aouthdr_out (abfd, & internal_a, & buff);
if (xcoff_data (abfd)->full_aouthdr)
size = bfd_coff_aoutsz (abfd);
else
size = SMALL_AOUTSZ;
- if (bfd_bwrite ((PTR) &buff, (bfd_size_type) size, abfd) != size)
+ if (bfd_bwrite (& buff, (bfd_size_type) size, abfd) != size)
return FALSE;
}
#endif
@@ -4250,12 +4129,11 @@ coff_write_object_contents (abfd)
}
static bfd_boolean
-coff_set_section_contents (abfd, section, location, offset, count)
- bfd * abfd;
- sec_ptr section;
- const PTR location;
- file_ptr offset;
- bfd_size_type count;
+coff_set_section_contents (bfd * abfd,
+ sec_ptr section,
+ const void * location,
+ file_ptr offset,
+ bfd_size_type count)
{
if (! abfd->output_has_begun) /* Set by bfd.c handler. */
{
@@ -4264,7 +4142,6 @@ coff_set_section_contents (abfd, section, location, offset, count)
}
#if defined(_LIB) && !defined(TARG_AUX)
-
/* The physical address field of a .lib section is used to hold the
number of shared libraries in the section. This code counts the
number of sections being written, and increments the lma field
@@ -4285,7 +4162,6 @@ coff_set_section_contents (abfd, section, location, offset, count)
<robertl@arnet.com> (Thanks!).
Gvran Uddeborg <gvran@uddeborg.pp.se>. */
-
if (strcmp (section->name, _LIB) == 0)
{
bfd_byte *rec, *recend;
@@ -4300,7 +4176,6 @@ coff_set_section_contents (abfd, section, location, offset, count)
BFD_ASSERT (rec == recend);
}
-
#endif
/* Don't write out bss sections - one way to do this is to
@@ -4317,20 +4192,18 @@ coff_set_section_contents (abfd, section, location, offset, count)
return bfd_bwrite (location, count, abfd) == count;
}
-static PTR
-buy_and_read (abfd, where, size)
- bfd *abfd;
- file_ptr where;
- bfd_size_type size;
+static void *
+buy_and_read (bfd *abfd, file_ptr where, bfd_size_type size)
{
- PTR area = (PTR) bfd_alloc (abfd, size);
+ void * area = bfd_alloc (abfd, size);
+
if (!area)
return (NULL);
if (bfd_seek (abfd, where, SEEK_SET) != 0
|| bfd_bread (area, size, abfd) != size)
return (NULL);
return (area);
-} /* buy_and_read() */
+}
/*
SUBSUBSECTION
@@ -4353,19 +4226,16 @@ SUBSUBSECTION
pointing its...
How does this work ?
-
*/
static bfd_boolean
-coff_slurp_line_table (abfd, asect)
- bfd *abfd;
- asection *asect;
+coff_slurp_line_table (bfd *abfd, asection *asect)
{
LINENO *native_lineno;
alent *lineno_cache;
bfd_size_type amt;
- BFD_ASSERT (asect->lineno == (alent *) NULL);
+ BFD_ASSERT (asect->lineno == NULL);
amt = (bfd_size_type) bfd_coff_linesz (abfd) * asect->lineno_count;
native_lineno = (LINENO *) buy_and_read (abfd, asect->line_filepos, amt);
@@ -4376,7 +4246,7 @@ coff_slurp_line_table (abfd, asect)
return FALSE;
}
amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent);
- lineno_cache = (alent *) bfd_alloc (abfd, amt);
+ lineno_cache = bfd_alloc (abfd, amt);
if (lineno_cache == NULL)
return FALSE;
else
@@ -4424,10 +4294,8 @@ coff_slurp_line_table (abfd, asect)
sym->lineno = cache_ptr;
}
else
- {
- cache_ptr->u.offset = dst.l_addr.l_paddr
- - bfd_section_vma (abfd, asect);
- } /* If no linenumber expect a symbol index */
+ cache_ptr->u.offset = dst.l_addr.l_paddr
+ - bfd_section_vma (abfd, asect);
cache_ptr++;
src++;
@@ -4446,8 +4314,7 @@ coff_slurp_line_table (abfd, asect)
symbols via coff_link_add_symbols, rather than via this routine. */
static bfd_boolean
-coff_slurp_symbol_table (abfd)
- bfd * abfd;
+coff_slurp_symbol_table (bfd * abfd)
{
combined_entry_type *native_symbols;
coff_symbol_type *cached_area;
@@ -4465,13 +4332,13 @@ coff_slurp_symbol_table (abfd)
/* Allocate enough room for all the symbols in cached form. */
amt = obj_raw_syment_count (abfd);
amt *= sizeof (coff_symbol_type);
- cached_area = (coff_symbol_type *) bfd_alloc (abfd, amt);
+ cached_area = bfd_alloc (abfd, amt);
if (cached_area == NULL)
return FALSE;
amt = obj_raw_syment_count (abfd);
amt *= sizeof (unsigned int);
- table_ptr = (unsigned int *) bfd_alloc (abfd, amt);
+ table_ptr = bfd_alloc (abfd, amt);
if (table_ptr == NULL)
return FALSE;
@@ -4533,11 +4400,9 @@ coff_slurp_symbol_table (abfd)
- dst->symbol.section->vma);
#endif
if (ISFCN ((src->u.syment.n_type)))
- {
- /* A function ext does not go at the end of a
- file. */
- dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION;
- }
+ /* A function ext does not go at the end of a
+ file. */
+ dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION;
break;
case COFF_SYMBOL_COMMON:
@@ -4776,12 +4641,10 @@ coff_slurp_symbol_table (abfd)
break;
}
-/* BFD_ASSERT(dst->symbol.flags != 0);*/
-
dst->native = src;
dst->symbol.udata.i = 0;
- dst->lineno = (alent *) NULL;
+ dst->lineno = NULL;
this_index += (src->u.syment.n_numaux) + 1;
dst++;
number_of_symbols++;
@@ -4806,16 +4669,15 @@ coff_slurp_symbol_table (abfd)
}
return TRUE;
-} /* coff_slurp_symbol_table() */
+}
/* Classify a COFF symbol. A couple of targets have globally visible
symbols which are not class C_EXT, and this handles those. It also
recognizes some special PE cases. */
static enum coff_symbol_classification
-coff_classify_symbol (abfd, syment)
- bfd *abfd;
- struct internal_syment *syment;
+coff_classify_symbol (bfd *abfd,
+ struct internal_syment *syment)
{
/* FIXME: This partially duplicates the switch in
coff_slurp_symbol_table. */
@@ -4853,18 +4715,15 @@ coff_classify_symbol (abfd, syment)
if (syment->n_sclass == C_STAT)
{
if (syment->n_scnum == 0)
- {
- /* The Microsoft compiler sometimes generates these if a
- small static function is inlined every time it is used.
- The function is discarded, but the symbol table entry
- remains. */
- return COFF_SYMBOL_LOCAL;
- }
+ /* The Microsoft compiler sometimes generates these if a
+ small static function is inlined every time it is used.
+ The function is discarded, but the symbol table entry
+ remains. */
+ return COFF_SYMBOL_LOCAL;
#ifdef STRICT_PE_FORMAT
/* This is correct for Microsoft generated objects, but it
breaks gas generated objects. */
-
if (syment->n_value == 0)
{
asection *sec;
@@ -4895,7 +4754,6 @@ coff_classify_symbol (abfd, syment)
#endif /* COFF_WITH_PE */
/* If it is not a global symbol, we presume it is a local symbol. */
-
if (syment->n_scnum == 0)
{
char buf[SYMNMLEN + 1];
@@ -4933,23 +4791,23 @@ SUBSUBSECTION
and 960 use the @code{r_type} to directly produce an index
into a howto table vector; the 88k subtracts a number from the
@code{r_type} field and creates an addend field.
-
*/
#ifndef CALC_ADDEND
#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
{ \
- coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \
+ coff_symbol_type *coffsym = NULL; \
+ \
if (ptr && bfd_asymbol_bfd (ptr) != abfd) \
coffsym = (obj_symbols (abfd) \
+ (cache_ptr->sym_ptr_ptr - symbols)); \
else if (ptr) \
coffsym = coff_symbol_from (abfd, ptr); \
- if (coffsym != (coff_symbol_type *) NULL \
+ if (coffsym != NULL \
&& coffsym->native->u.syment.n_scnum == 0) \
cache_ptr->addend = 0; \
else if (ptr && bfd_asymbol_bfd (ptr) == abfd \
- && ptr->section != (asection *) NULL) \
+ && ptr->section != NULL) \
cache_ptr->addend = - (ptr->section->vma + ptr->value); \
else \
cache_ptr->addend = 0; \
@@ -4957,10 +4815,7 @@ SUBSUBSECTION
#endif
static bfd_boolean
-coff_slurp_reloc_table (abfd, asect, symbols)
- bfd * abfd;
- sec_ptr asect;
- asymbol ** symbols;
+coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol ** symbols)
{
RELOC *native_relocs;
arelent *reloc_cache;
@@ -4976,10 +4831,11 @@ coff_slurp_reloc_table (abfd, asect, symbols)
return TRUE;
if (!coff_slurp_symbol_table (abfd))
return FALSE;
+
amt = (bfd_size_type) bfd_coff_relsz (abfd) * asect->reloc_count;
native_relocs = (RELOC *) buy_and_read (abfd, asect->rel_filepos, amt);
amt = (bfd_size_type) asect->reloc_count * sizeof (arelent);
- reloc_cache = (arelent *) bfd_alloc (abfd, amt);
+ reloc_cache = bfd_alloc (abfd, amt);
if (reloc_cache == NULL)
return FALSE;
@@ -5036,7 +4892,7 @@ coff_slurp_reloc_table (abfd, asect, symbols)
CALC_ADDEND (abfd, ptr, dst, cache_ptr);
cache_ptr->address -= asect->vma;
-/* !! cache_ptr->section = (asection *) NULL;*/
+ /* !! cache_ptr->section = NULL;*/
/* Fill in the cache_ptr->howto field from dst.r_type. */
RTYPE2HOWTO (cache_ptr, &dst);
@@ -5065,19 +4921,13 @@ coff_slurp_reloc_table (abfd, asect, symbols)
always work. It is the responsibility of the including file to
make sure it is reasonable if it is needed. */
-static reloc_howto_type *coff_rtype_to_howto
- PARAMS ((bfd *, asection *, struct internal_reloc *,
- struct coff_link_hash_entry *, struct internal_syment *,
- bfd_vma *));
-
static reloc_howto_type *
-coff_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec ATTRIBUTE_UNUSED;
- struct internal_reloc *rel;
- struct coff_link_hash_entry *h ATTRIBUTE_UNUSED;
- struct internal_syment *sym ATTRIBUTE_UNUSED;
- bfd_vma *addendp ATTRIBUTE_UNUSED;
+coff_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED,
+ struct internal_reloc *rel,
+ struct coff_link_hash_entry *h ATTRIBUTE_UNUSED,
+ struct internal_syment *sym ATTRIBUTE_UNUSED,
+ bfd_vma *addendp ATTRIBUTE_UNUSED)
{
arelent genrel;
@@ -5093,12 +4943,12 @@ coff_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
#endif /* ! defined (coff_rtype_to_howto) */
/* This is stupid. This function should be a boolean predicate. */
+
static long
-coff_canonicalize_reloc (abfd, section, relptr, symbols)
- bfd * abfd;
- sec_ptr section;
- arelent ** relptr;
- asymbol ** symbols;
+coff_canonicalize_reloc (bfd * abfd,
+ sec_ptr section,
+ arelent ** relptr,
+ asymbol ** symbols)
{
arelent *tblptr = section->relocation;
unsigned int count = 0;
@@ -5133,17 +4983,12 @@ coff_canonicalize_reloc (abfd, section, relptr, symbols)
#ifndef coff_reloc16_estimate
#define coff_reloc16_estimate dummy_reloc16_estimate
-static int dummy_reloc16_estimate
- PARAMS ((bfd *, asection *, arelent *, unsigned int,
- struct bfd_link_info *));
-
static int
-dummy_reloc16_estimate (abfd, input_section, reloc, shrink, link_info)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- arelent *reloc ATTRIBUTE_UNUSED;
- unsigned int shrink ATTRIBUTE_UNUSED;
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
+dummy_reloc16_estimate (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *input_section ATTRIBUTE_UNUSED,
+ arelent *reloc ATTRIBUTE_UNUSED,
+ unsigned int shrink ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
{
abort ();
return 0;
@@ -5157,20 +5002,14 @@ dummy_reloc16_estimate (abfd, input_section, reloc, shrink, link_info)
/* This works even if abort is not declared in any header file. */
-static void dummy_reloc16_extra_cases
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
- bfd_byte *, unsigned int *, unsigned int *));
-
static void
-dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
- dst_ptr)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
- struct bfd_link_order *link_order ATTRIBUTE_UNUSED;
- arelent *reloc ATTRIBUTE_UNUSED;
- bfd_byte *data ATTRIBUTE_UNUSED;
- unsigned int *src_ptr ATTRIBUTE_UNUSED;
- unsigned int *dst_ptr ATTRIBUTE_UNUSED;
+dummy_reloc16_extra_cases (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+ struct bfd_link_order *link_order ATTRIBUTE_UNUSED,
+ arelent *reloc ATTRIBUTE_UNUSED,
+ bfd_byte *data ATTRIBUTE_UNUSED,
+ unsigned int *src_ptr ATTRIBUTE_UNUSED,
+ unsigned int *dst_ptr ATTRIBUTE_UNUSED)
{
abort ();
}
@@ -5182,7 +5021,9 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
/* If coff_relocate_section is defined, we can use the optimized COFF
backend linker. Otherwise we must continue to use the old linker. */
+
#ifdef coff_relocate_section
+
#ifndef coff_bfd_link_hash_table_create
#define coff_bfd_link_hash_table_create _bfd_coff_link_hash_table_create
#endif
@@ -5192,7 +5033,9 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
#ifndef coff_bfd_final_link
#define coff_bfd_final_link _bfd_coff_final_link
#endif
+
#else /* ! defined (coff_relocate_section) */
+
#define coff_relocate_section NULL
#ifndef coff_bfd_link_hash_table_create
#define coff_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
@@ -5201,9 +5044,10 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
#define coff_bfd_link_add_symbols _bfd_generic_link_add_symbols
#endif
#define coff_bfd_final_link _bfd_generic_final_link
+
#endif /* ! defined (coff_relocate_section) */
-#define coff_bfd_link_just_syms _bfd_generic_link_just_syms
+#define coff_bfd_link_just_syms _bfd_generic_link_just_syms
#define coff_bfd_link_split_section _bfd_generic_link_split_section
#ifndef coff_start_final_link
@@ -5220,13 +5064,9 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
#ifndef coff_link_output_has_begun
-static bfd_boolean coff_link_output_has_begun
- PARAMS ((bfd *, struct coff_final_link_info *));
-
static bfd_boolean
-coff_link_output_has_begun (abfd, info)
- bfd * abfd;
- struct coff_final_link_info * info ATTRIBUTE_UNUSED;
+coff_link_output_has_begun (bfd * abfd,
+ struct coff_final_link_info * info ATTRIBUTE_UNUSED)
{
return abfd->output_has_begun;
}
@@ -5234,13 +5074,9 @@ coff_link_output_has_begun (abfd, info)
#ifndef coff_final_link_postscript
-static bfd_boolean coff_final_link_postscript
- PARAMS ((bfd *, struct coff_final_link_info *));
-
static bfd_boolean
-coff_final_link_postscript (abfd, pfinfo)
- bfd * abfd ATTRIBUTE_UNUSED;
- struct coff_final_link_info * pfinfo ATTRIBUTE_UNUSED;
+coff_final_link_postscript (bfd * abfd ATTRIBUTE_UNUSED,
+ struct coff_final_link_info * pfinfo ATTRIBUTE_UNUSED)
{
return TRUE;
}
@@ -5331,6 +5167,7 @@ static const bfd_coff_backend_data bfd_coff_std_swap_table ATTRIBUTE_UNUSED =
#ifdef TICOFF
/* COFF0 differs in file/section header size and relocation entry size. */
+
static const bfd_coff_backend_data ticoff0_swap_table =
{
coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
@@ -5374,6 +5211,7 @@ static const bfd_coff_backend_data ticoff0_swap_table =
#ifdef TICOFF
/* COFF1 differs in section header size. */
+
static const bfd_coff_backend_data ticoff1_swap_table =
{
coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
@@ -5512,16 +5350,16 @@ const bfd_target VAR = \
{ \
NAME , \
bfd_target_coff_flavour, \
- BFD_ENDIAN_BIG, /* data byte order is big */ \
- BFD_ENDIAN_BIG, /* header byte order is big */ \
+ BFD_ENDIAN_BIG, /* Data byte order is big. */ \
+ BFD_ENDIAN_BIG, /* Header byte order is big. */ \
/* object flags */ \
(HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | \
HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS), \
/* section flags */ \
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),\
- UNDER, /* leading symbol underscore */ \
- '/', /* ar_pad_char */ \
- 15, /* ar_max_namelen */ \
+ UNDER, /* Leading symbol underscore. */ \
+ '/', /* AR_pad_char. */ \
+ 15, /* AR_max_namelen. */ \
\
/* Data conversion functions. */ \
bfd_getb64, bfd_getb_signed_64, bfd_putb64, \
@@ -5533,12 +5371,12 @@ const bfd_target VAR = \
bfd_getb32, bfd_getb_signed_32, bfd_putb32, \
bfd_getb16, bfd_getb_signed_16, bfd_putb16, \
\
- /* bfd_check_format */ \
+ /* bfd_check_format. */ \
{ _bfd_dummy_target, coff_object_p, bfd_generic_archive_p, \
_bfd_dummy_target }, \
- /* bfd_set_format */ \
+ /* bfd_set_format. */ \
{ bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false }, \
- /* bfd_write_contents */ \
+ /* bfd_write_contents. */ \
{ bfd_false, coff_write_object_contents, _bfd_write_archive_contents, \
bfd_false }, \
\
@@ -5562,16 +5400,16 @@ const bfd_target VAR = \
{ \
NAME , \
bfd_target_coff_flavour, \
- BFD_ENDIAN_LITTLE, /* data byte order is little */ \
- BFD_ENDIAN_BIG, /* header byte order is big */ \
+ BFD_ENDIAN_LITTLE, /* Data byte order is little. */ \
+ BFD_ENDIAN_BIG, /* Header byte order is big. */ \
/* object flags */ \
(HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | \
HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS), \
/* section flags */ \
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),\
- UNDER, /* leading symbol underscore */ \
- '/', /* ar_pad_char */ \
- 15, /* ar_max_namelen */ \
+ UNDER, /* Leading symbol underscore. */ \
+ '/', /* AR_pad_char. */ \
+ 15, /* AR_max_namelen. */ \
\
/* Data conversion functions. */ \
bfd_getb64, bfd_getb_signed_64, bfd_putb64, \
@@ -5583,12 +5421,12 @@ const bfd_target VAR = \
bfd_getb32, bfd_getb_signed_32, bfd_putb32, \
bfd_getb16, bfd_getb_signed_16, bfd_putb16, \
\
- /* bfd_check_format */ \
+ /* bfd_check_format. */ \
{ _bfd_dummy_target, coff_object_p, bfd_generic_archive_p, \
_bfd_dummy_target }, \
- /* bfd_set_format */ \
+ /* bfd_set_format. */ \
{ bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false }, \
- /* bfd_write_contents */ \
+ /* bfd_write_contents. */ \
{ bfd_false, coff_write_object_contents, _bfd_write_archive_contents, \
bfd_false }, \
\
@@ -5612,16 +5450,16 @@ const bfd_target VAR = \
{ \
NAME , \
bfd_target_coff_flavour, \
- BFD_ENDIAN_LITTLE, /* data byte order is little */ \
- BFD_ENDIAN_LITTLE, /* header byte order is little */ \
+ BFD_ENDIAN_LITTLE, /* Data byte order is little. */ \
+ BFD_ENDIAN_LITTLE, /* Header byte order is little. */ \
/* object flags */ \
(HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | \
HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS), \
/* section flags */ \
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),\
- UNDER, /* leading symbol underscore */ \
- '/', /* ar_pad_char */ \
- 15, /* ar_max_namelen */ \
+ UNDER, /* Leading symbol underscore. */ \
+ '/', /* AR_pad_char. */ \
+ 15, /* AR_max_namelen. */ \
\
/* Data conversion functions. */ \
bfd_getl64, bfd_getl_signed_64, bfd_putl64, \
@@ -5631,12 +5469,12 @@ const bfd_target VAR = \
bfd_getl64, bfd_getl_signed_64, bfd_putl64, \
bfd_getl32, bfd_getl_signed_32, bfd_putl32, \
bfd_getl16, bfd_getl_signed_16, bfd_putl16, \
- /* bfd_check_format */ \
+ /* bfd_check_format. */ \
{ _bfd_dummy_target, coff_object_p, bfd_generic_archive_p, \
_bfd_dummy_target }, \
- /* bfd_set_format */ \
+ /* bfd_set_format. */ \
{ bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false }, \
- /* bfd_write_contents */ \
+ /* bfd_write_contents. */ \
{ bfd_false, coff_write_object_contents, _bfd_write_archive_contents, \
bfd_false }, \
\
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index b60a96f..310e6c9 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -1895,7 +1895,7 @@ coff_print_symbol (bfd *abfd,
else
val = combined->u.syment.n_value - (unsigned long) root;
- fprintf (file, "(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d)",
+ fprintf (file, "(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x",
combined->u.syment.n_scnum,
combined->u.syment.n_flags,
combined->u.syment.n_type,
diff --git a/bfd/coffswap.h b/bfd/coffswap.h
index 5f23ecc..9d2322a 100644
--- a/bfd/coffswap.h
+++ b/bfd/coffswap.h
@@ -1,6 +1,6 @@
/* Generic COFF swapping routines, for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000,
- 2001, 2002
+ 2001, 2002, 2005
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -210,41 +210,17 @@
#define PUT_RELOC_VADDR H_PUT_32
#endif
-static void coff_swap_aouthdr_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR));
-static void coff_swap_scnhdr_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR));
-static void coff_swap_filehdr_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_filehdr_out PARAMS ((bfd *, PTR, PTR));
-#ifndef NO_COFF_RELOCS
-static void coff_swap_reloc_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_reloc_out PARAMS ((bfd *, PTR, PTR));
-#endif /* NO_COFF_RELOCS */
-#ifndef NO_COFF_SYMBOLS
-static void coff_swap_sym_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_sym_out PARAMS ((bfd *, PTR, PTR));
-static void coff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-static unsigned int coff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-#endif /* NO_COFF_SYMBOLS */
-#ifndef NO_COFF_LINENOS
-static void coff_swap_lineno_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_lineno_out PARAMS ((bfd *, PTR, PTR));
-#endif /* NO_COFF_LINENOS */
-
#ifndef NO_COFF_RELOCS
static void
-coff_swap_reloc_in (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
+coff_swap_reloc_in (bfd * abfd, void * src, void * dst)
{
RELOC *reloc_src = (RELOC *) src;
struct internal_reloc *reloc_dst = (struct internal_reloc *) dst;
- reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, reloc_src->r_vaddr);
+ reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, reloc_src->r_vaddr);
reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx);
- reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type);
+ reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type);
#ifdef SWAP_IN_RELOC_OFFSET
reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET (abfd, reloc_src->r_offset);
@@ -252,13 +228,11 @@ coff_swap_reloc_in (abfd, src, dst)
}
static unsigned int
-coff_swap_reloc_out (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
+coff_swap_reloc_out (bfd * abfd, void * src, void * dst)
{
struct internal_reloc *reloc_src = (struct internal_reloc *) src;
struct external_reloc *reloc_dst = (struct external_reloc *) dst;
+
PUT_RELOC_VADDR (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type);
@@ -276,10 +250,7 @@ coff_swap_reloc_out (abfd, src, dst)
#endif /* NO_COFF_RELOCS */
static void
-coff_swap_filehdr_in (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
+coff_swap_filehdr_in (bfd * abfd, void * src, void * dst)
{
FILHDR *filehdr_src = (FILHDR *) src;
struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst;
@@ -287,13 +258,13 @@ coff_swap_filehdr_in (abfd, src, dst)
#ifdef COFF_ADJUST_FILEHDR_IN_PRE
COFF_ADJUST_FILEHDR_IN_PRE (abfd, src, dst);
#endif
- filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic);
- filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src->f_nscns);
+ filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic);
+ filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src->f_nscns);
filehdr_dst->f_timdat = H_GET_32 (abfd, filehdr_src->f_timdat);
filehdr_dst->f_symptr = GET_FILEHDR_SYMPTR (abfd, filehdr_src->f_symptr);
- filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src->f_nsyms);
+ filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src->f_nsyms);
filehdr_dst->f_opthdr = H_GET_16 (abfd, filehdr_src->f_opthdr);
- filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src->f_flags);
+ filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src->f_flags);
#ifdef TIC80_TARGET_ID
filehdr_dst->f_target_id = H_GET_16 (abfd, filehdr_src->f_target_id);
#endif
@@ -304,10 +275,7 @@ coff_swap_filehdr_in (abfd, src, dst)
}
static unsigned int
-coff_swap_filehdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+coff_swap_filehdr_out (bfd *abfd, void * in, void * out)
{
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
FILHDR *filehdr_out = (FILHDR *) out;
@@ -335,10 +303,7 @@ coff_swap_filehdr_out (abfd, in, out)
#ifndef NO_COFF_SYMBOLS
static void
-coff_swap_sym_in (abfd, ext1, in1)
- bfd *abfd;
- PTR ext1;
- PTR in1;
+coff_swap_sym_in (bfd * abfd, void * ext1, void * in1)
{
SYMENT *ext = (SYMENT *) ext1;
struct internal_syment *in = (struct internal_syment *) in1;
@@ -351,21 +316,18 @@ coff_swap_sym_in (abfd, ext1, in1)
else
{
#if SYMNMLEN != E_SYMNMLEN
- -> Error, we need to cope with truncating or extending SYMNMLEN!;
+#error we need to cope with truncating or extending SYMNMLEN
#else
memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN);
#endif
}
+
in->n_value = H_GET_32 (abfd, ext->e_value);
in->n_scnum = H_GET_16 (abfd, ext->e_scnum);
if (sizeof (ext->e_type) == 2)
- {
- in->n_type = H_GET_16 (abfd, ext->e_type);
- }
+ in->n_type = H_GET_16 (abfd, ext->e_type);
else
- {
- in->n_type = H_GET_32 (abfd, ext->e_type);
- }
+ in->n_type = H_GET_32 (abfd, ext->e_type);
in->n_sclass = H_GET_8 (abfd, ext->e_sclass);
in->n_numaux = H_GET_8 (abfd, ext->e_numaux);
#ifdef COFF_ADJUST_SYM_IN_POST
@@ -374,10 +336,7 @@ coff_swap_sym_in (abfd, ext1, in1)
}
static unsigned int
-coff_swap_sym_out (abfd, inp, extp)
- bfd *abfd;
- PTR inp;
- PTR extp;
+coff_swap_sym_out (bfd * abfd, void * inp, void * extp)
{
struct internal_syment *in = (struct internal_syment *) inp;
SYMENT *ext =(SYMENT *) extp;
@@ -394,7 +353,7 @@ coff_swap_sym_out (abfd, inp, extp)
else
{
#if SYMNMLEN != E_SYMNMLEN
- -> Error, we need to cope with truncating or extending SYMNMLEN!;
+#error we need to cope with truncating or extending SYMNMLEN
#else
memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN);
#endif
@@ -404,13 +363,9 @@ coff_swap_sym_out (abfd, inp, extp)
H_PUT_16 (abfd, in->n_scnum, ext->e_scnum);
if (sizeof (ext->e_type) == 2)
- {
- H_PUT_16 (abfd, in->n_type, ext->e_type);
- }
+ H_PUT_16 (abfd, in->n_type, ext->e_type);
else
- {
- H_PUT_32 (abfd, in->n_type, ext->e_type);
- }
+ H_PUT_32 (abfd, in->n_type, ext->e_type);
H_PUT_8 (abfd, in->n_sclass, ext->e_sclass);
H_PUT_8 (abfd, in->n_numaux, ext->e_numaux);
@@ -423,14 +378,13 @@ coff_swap_sym_out (abfd, inp, extp)
}
static void
-coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
- bfd *abfd;
- PTR ext1;
- int type;
- int class;
- int indx;
- int numaux;
- PTR in1;
+coff_swap_aux_in (bfd *abfd,
+ void * ext1,
+ int type,
+ int class,
+ int indx,
+ int numaux,
+ void * in1)
{
AUXENT *ext = (AUXENT *) ext1;
union internal_auxent *in = (union internal_auxent *) in1;
@@ -450,7 +404,7 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
else
{
#if FILNMLEN != E_FILNMLEN
- -> Error, we need to cope with truncating or extending FILNMLEN!;
+#error we need to cope with truncating or extending FILNMLEN
#else
if (numaux > 1)
{
@@ -512,9 +466,7 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
}
if (ISFCN (type))
- {
- in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize);
- }
+ in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize);
else
{
in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO (abfd, ext);
@@ -529,23 +481,22 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
}
static unsigned int
-coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
- bfd *abfd;
- PTR inp;
- int type;
- int class;
- int indx ATTRIBUTE_UNUSED;
- int numaux ATTRIBUTE_UNUSED;
- PTR extp;
+coff_swap_aux_out (bfd * abfd,
+ void * inp,
+ int type,
+ int class,
+ int indx ATTRIBUTE_UNUSED,
+ int numaux ATTRIBUTE_UNUSED,
+ void * extp)
{
- union internal_auxent *in = (union internal_auxent *) inp;
+ union internal_auxent * in = (union internal_auxent *) inp;
AUXENT *ext = (AUXENT *) extp;
#ifdef COFF_ADJUST_AUX_OUT_PRE
COFF_ADJUST_AUX_OUT_PRE (abfd, inp, type, class, indx, numaux, extp);
#endif
- memset ((PTR)ext, 0, AUXESZ);
+ memset (ext, 0, AUXESZ);
switch (class)
{
@@ -558,7 +509,7 @@ coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
else
{
#if FILNMLEN != E_FILNMLEN
- -> Error, we need to cope with truncating or extending FILNMLEN!;
+#error we need to cope with truncating or extending FILNMLEN
#else
memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
#endif
@@ -625,10 +576,7 @@ coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
#ifndef NO_COFF_LINENOS
static void
-coff_swap_lineno_in (abfd, ext1, in1)
- bfd *abfd;
- PTR ext1;
- PTR in1;
+coff_swap_lineno_in (bfd * abfd, void * ext1, void * in1)
{
LINENO *ext = (LINENO *) ext1;
struct internal_lineno *in = (struct internal_lineno *) in1;
@@ -638,10 +586,7 @@ coff_swap_lineno_in (abfd, ext1, in1)
}
static unsigned int
-coff_swap_lineno_out (abfd, inp, outp)
- bfd *abfd;
- PTR inp;
- PTR outp;
+coff_swap_lineno_out (bfd * abfd, void * inp, void * outp)
{
struct internal_lineno *in = (struct internal_lineno *) inp;
struct external_lineno *ext = (struct external_lineno *) outp;
@@ -654,10 +599,7 @@ coff_swap_lineno_out (abfd, inp, outp)
#endif /* NO_COFF_LINENOS */
static void
-coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
- bfd *abfd;
- PTR aouthdr_ext1;
- PTR aouthdr_int1;
+coff_swap_aouthdr_in (bfd * abfd, void * aouthdr_ext1, void * aouthdr_int1)
{
AOUTHDR *aouthdr_ext;
struct internal_aouthdr *aouthdr_int;
@@ -730,10 +672,7 @@ coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
}
static unsigned int
-coff_swap_aouthdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+coff_swap_aouthdr_out (bfd * abfd, void * in, void * out)
{
struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *) in;
AOUTHDR *aouthdr_out = (AOUTHDR *) out;
@@ -807,10 +746,7 @@ coff_swap_aouthdr_out (abfd, in, out)
}
static void
-coff_swap_scnhdr_in (abfd, ext, in)
- bfd *abfd;
- PTR ext;
- PTR in;
+coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in)
{
SCNHDR *scnhdr_ext = (SCNHDR *) ext;
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
@@ -839,10 +775,7 @@ coff_swap_scnhdr_in (abfd, ext, in)
}
static unsigned int
-coff_swap_scnhdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+coff_swap_scnhdr_out (bfd * abfd, void * in, void * out)
{
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
SCNHDR *scnhdr_ext = (SCNHDR *) out;
diff --git a/bfd/i386aout.c b/bfd/i386aout.c
index 9d519d3..bea384e 100644
--- a/bfd/i386aout.c
+++ b/bfd/i386aout.c
@@ -2,22 +2,21 @@
Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003, 2005
Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* The only 386 aout system we have here is GO32 from DJ.
These numbers make BFD work with that. If your aout 386 system
@@ -25,15 +24,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
files. Send me (sac@cygnus.com) the runes to make it work on your
system, and I'll stick it in for the next release. */
-#define N_HEADER_IN_TEXT(x) 0
-
-#define N_TXTOFF(x) 0x20
-#define N_TXTADDR(x) (N_MAGIC(x)==ZMAGIC ? 0x1020 : 0)
-
-#define N_TXTSIZE(x) ((x).a_text)
-#define TARGET_PAGE_SIZE 4096
-#define SEGMENT_SIZE 0x400000
-#define DEFAULT_ARCH bfd_arch_i386
+#define N_HEADER_IN_TEXT(x) 0
+#define N_TXTOFF(x) 0x20
+#define N_TXTADDR(x) (N_MAGIC (x) == ZMAGIC ? 0x1020 : 0)
+#define N_TXTSIZE(x) ((x).a_text)
+#define TARGET_PAGE_SIZE 4096
+#define SEGMENT_SIZE 0x400000
+#define DEFAULT_ARCH bfd_arch_i386
/* Do not "beautify" the CONCAT* macro args. Traditional C will not
remove whitespace added here, and thus will fail to concatenate
@@ -48,14 +45,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "aout/aout64.h"
#include "libaout.h"
-static bfd_boolean i386aout_write_object_contents PARAMS ((bfd *));
-static bfd_boolean MY (set_sizes) PARAMS ((bfd *));
-
/* Set the machine type correctly. */
static bfd_boolean
-i386aout_write_object_contents (abfd)
- bfd *abfd;
+i386aout_write_object_contents (bfd *abfd)
{
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
@@ -69,23 +62,26 @@ i386aout_write_object_contents (abfd)
return TRUE;
}
-#define MY_write_object_contents i386aout_write_object_contents
-
-#define MY_backend_data &MY(backend_data)
-static const struct aout_backend_data MY(backend_data) = {
- 0, /* zmagic contiguous */
- 1, /* text incl header */
- 0, /* entry is text address */
- 0, /* exec_hdr_flags */
- 0, /* text vma? */
- MY(set_sizes),
- 1, /* exec header not counted */
- 0, /* add_dynamic_symbols */
- 0, /* add_one_symbol */
- 0, /* link_dynamic_object */
- 0, /* write_dynamic_symbol */
- 0, /* check_dynamic_reloc */
- 0 /* finish_dynamic_link */
-};
+#define MY_write_object_contents i386aout_write_object_contents
+#define MY_backend_data & MY (backend_data)
+
+static const struct aout_backend_data MY (backend_data);
#include "aout-target.h"
+
+static const struct aout_backend_data MY (backend_data) =
+{
+ 0, /* Zmagic contiguous. */
+ 1, /* Text incl header. */
+ 0, /* Entry is text address. */
+ 0, /* Exec_hdr_flags. */
+ 0, /* Text vma? */
+ MY (set_sizes),
+ 1, /* Exec header not counted. */
+ 0, /* Add_dynamic_symbols. */
+ 0, /* Add_one_symbol. */
+ 0, /* Link_dynamic_object. */
+ 0, /* Write_dynamic_symbol. */
+ 0, /* Check_dynamic_reloc. */
+ 0 /* Finish_dynamic_link. */
+};
diff --git a/bfd/libaout.h b/bfd/libaout.h
index ef9eae1..887ef31 100644
--- a/bfd/libaout.h
+++ b/bfd/libaout.h
@@ -1,6 +1,6 @@
/* BFD back-end data structures for a.out (and similar) files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004
+ 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -31,22 +31,22 @@
/* Macros for accessing components in an aout header. */
-#define H_PUT_64 bfd_h_put_64
-#define H_PUT_32 bfd_h_put_32
-#define H_PUT_16 bfd_h_put_16
-#define H_PUT_8 bfd_h_put_8
+#define H_PUT_64 bfd_h_put_64
+#define H_PUT_32 bfd_h_put_32
+#define H_PUT_16 bfd_h_put_16
+#define H_PUT_8 bfd_h_put_8
#define H_PUT_S64 bfd_h_put_signed_64
#define H_PUT_S32 bfd_h_put_signed_32
#define H_PUT_S16 bfd_h_put_signed_16
-#define H_PUT_S8 bfd_h_put_signed_8
-#define H_GET_64 bfd_h_get_64
-#define H_GET_32 bfd_h_get_32
-#define H_GET_16 bfd_h_get_16
-#define H_GET_8 bfd_h_get_8
+#define H_PUT_S8 bfd_h_put_signed_8
+#define H_GET_64 bfd_h_get_64
+#define H_GET_32 bfd_h_get_32
+#define H_GET_16 bfd_h_get_16
+#define H_GET_8 bfd_h_get_8
#define H_GET_S64 bfd_h_get_signed_64
#define H_GET_S32 bfd_h_get_signed_32
#define H_GET_S16 bfd_h_get_signed_16
-#define H_GET_S8 bfd_h_get_signed_8
+#define H_GET_S8 bfd_h_get_signed_8
/* Parameterize the a.out code based on whether it is being built
for a 32-bit architecture or a 64-bit architecture. */
@@ -54,10 +54,10 @@
remove whitespace added here, and thus will fail to concatenate
the tokens. */
#if ARCH_SIZE==64
-#define GET_WORD H_GET_64
+#define GET_WORD H_GET_64
#define GET_SWORD H_GET_S64
#define GET_MAGIC H_GET_32
-#define PUT_WORD H_PUT_64
+#define PUT_WORD H_PUT_64
#define PUT_MAGIC H_PUT_32
#ifndef NAME
#define NAME(x,y) CONCAT3 (x,_64_,y)
@@ -66,10 +66,10 @@
#define BYTES_IN_WORD 8
#else
#if ARCH_SIZE==16
-#define GET_WORD H_GET_16
+#define GET_WORD H_GET_16
#define GET_SWORD H_GET_S16
#define GET_MAGIC H_GET_16
-#define PUT_WORD H_PUT_16
+#define PUT_WORD H_PUT_16
#define PUT_MAGIC H_PUT_16
#ifndef NAME
#define NAME(x,y) CONCAT3 (x,_16_,y)
@@ -77,10 +77,10 @@
#define JNAME(x) CONCAT2 (x,_16)
#define BYTES_IN_WORD 2
#else /* ARCH_SIZE == 32 */
-#define GET_WORD H_GET_32
+#define GET_WORD H_GET_32
#define GET_SWORD H_GET_S32
#define GET_MAGIC H_GET_32
-#define PUT_WORD H_PUT_32
+#define PUT_WORD H_PUT_32
#define PUT_MAGIC H_PUT_32
#ifndef NAME
#define NAME(x,y) CONCAT3 (x,_32_,y)
@@ -126,7 +126,7 @@ struct aout_link_hash_table
#define aout_link_hash_traverse(table, func, info) \
(bfd_link_hash_traverse \
(&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
(info)))
/* Get the a.out link hash table from the info structure. This is
@@ -165,8 +165,7 @@ struct aout_backend_data
/* Callback for setting the page and segment sizes, if they can't be
trivially determined from the architecture. */
- bfd_boolean (*set_sizes)
- PARAMS ((bfd *));
+ bfd_boolean (*set_sizes) (bfd *);
/* zmagic files only. For go32, the length of the exec header contributes
to the size of the text section in the file for alignment purposes but
@@ -176,39 +175,38 @@ struct aout_backend_data
/* Callback from the add symbols phase of the linker code to handle
a dynamic object. */
bfd_boolean (*add_dynamic_symbols)
- PARAMS ((bfd *, struct bfd_link_info *, struct external_nlist **,
- bfd_size_type *, char **));
+ (bfd *, struct bfd_link_info *, struct external_nlist **,
+ bfd_size_type *, char **);
/* Callback from the add symbols phase of the linker code to handle
adding a single symbol to the global linker hash table. */
bfd_boolean (*add_one_symbol)
- PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
- asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
- struct bfd_link_hash_entry **));
+ (struct bfd_link_info *, bfd *, const char *, flagword,
+ asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
+ struct bfd_link_hash_entry **);
/* Called to handle linking a dynamic object. */
bfd_boolean (*link_dynamic_object)
- PARAMS ((struct bfd_link_info *, bfd *));
+ (struct bfd_link_info *, bfd *);
/* Called for each global symbol being written out by the linker.
This should write out the dynamic symbol information. */
bfd_boolean (*write_dynamic_symbol)
- PARAMS ((bfd *, struct bfd_link_info *, struct aout_link_hash_entry *));
+ (bfd *, struct bfd_link_info *, struct aout_link_hash_entry *);
/* If this callback is not NULL, the linker calls it for each reloc.
RELOC is a pointer to the unswapped reloc. If *SKIP is set to
TRUE, the reloc will be skipped. *RELOCATION may be changed to
change the effects of the relocation. */
bfd_boolean (*check_dynamic_reloc)
- PARAMS ((struct bfd_link_info *info, bfd *input_bfd,
- asection *input_section, struct aout_link_hash_entry *h,
- PTR reloc, bfd_byte *contents, bfd_boolean *skip,
- bfd_vma *relocation));
+ (struct bfd_link_info *info, bfd *input_bfd,
+ asection *input_section, struct aout_link_hash_entry *h,
+ void * reloc, bfd_byte *contents, bfd_boolean *skip,
+ bfd_vma *relocation);
/* Called at the end of a link to finish up any dynamic linking
information. */
- bfd_boolean (*finish_dynamic_link)
- PARAMS ((bfd *, struct bfd_link_info *));
+ bfd_boolean (*finish_dynamic_link) (bfd *, struct bfd_link_info *);
};
#define aout_backend_info(abfd) \
((const struct aout_backend_data *)((abfd)->xvec->backend_data))
@@ -415,7 +413,7 @@ struct aoutdata
struct aout_link_hash_entry **sym_hashes;
/* A pointer for shared library information. */
- PTR dynamic_info;
+ void * dynamic_info;
/* A mapping from local symbols to offsets into the global offset
table, used when linking on SunOS. This is indexed by the symbol
@@ -459,137 +457,138 @@ struct aout_data_struct
struct aout_section_data_struct
{
/* The unswapped relocation entries for this section. */
- PTR relocs;
+ void * relocs;
};
#define aout_section_data(s) \
((struct aout_section_data_struct *) (s)->used_by_bfd)
#define set_aout_section_data(s,v) \
- ((s)->used_by_bfd = (PTR)&(v)->relocs)
+ ((s)->used_by_bfd = (void *)&(v)->relocs)
/* Prototype declarations for functions defined in aoutx.h. */
-extern bfd_boolean NAME(aout,squirt_out_relocs)
- PARAMS ((bfd *, asection *));
+extern bfd_boolean NAME (aout, squirt_out_relocs)
+ (bfd *, asection *);
-extern bfd_boolean NAME(aout,make_sections)
- PARAMS ((bfd *));
+extern bfd_boolean NAME (aout, make_sections)
+ (bfd *);
-extern const bfd_target * NAME(aout,some_aout_object_p)
- PARAMS ((bfd *, struct internal_exec *, const bfd_target *(*) (bfd *)));
+extern const bfd_target * NAME (aout, some_aout_object_p)
+ (bfd *, struct internal_exec *, const bfd_target *(*) (bfd *));
-extern bfd_boolean NAME(aout,mkobject)
- PARAMS ((bfd *));
+extern bfd_boolean NAME (aout, mkobject)
+ (bfd *);
-extern enum machine_type NAME(aout,machine_type)
- PARAMS ((enum bfd_architecture, unsigned long, bfd_boolean *));
+extern enum machine_type NAME (aout, machine_type)
+ (enum bfd_architecture, unsigned long, bfd_boolean *);
-extern bfd_boolean NAME(aout,set_arch_mach)
- PARAMS ((bfd *, enum bfd_architecture, unsigned long));
+extern bfd_boolean NAME (aout, set_arch_mach)
+ (bfd *, enum bfd_architecture, unsigned long);
-extern bfd_boolean NAME(aout,new_section_hook)
- PARAMS ((bfd *, asection *));
+extern bfd_boolean NAME (aout, new_section_hook)
+ (bfd *, asection *);
-extern bfd_boolean NAME(aout,set_section_contents)
- PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type));
+extern bfd_boolean NAME (aout, set_section_contents)
+ (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
-extern asymbol * NAME(aout,make_empty_symbol)
- PARAMS ((bfd *));
+extern asymbol * NAME (aout, make_empty_symbol)
+ (bfd *);
-extern bfd_boolean NAME(aout,translate_symbol_table)
- PARAMS ((bfd *, aout_symbol_type *, struct external_nlist *, bfd_size_type,
- char *, bfd_size_type, bfd_boolean));
+extern bfd_boolean NAME (aout, translate_symbol_table)
+ (bfd *, aout_symbol_type *, struct external_nlist *, bfd_size_type,
+ char *, bfd_size_type, bfd_boolean);
-extern bfd_boolean NAME(aout,slurp_symbol_table)
- PARAMS ((bfd *));
+extern bfd_boolean NAME (aout, slurp_symbol_table)
+ (bfd *);
-extern bfd_boolean NAME(aout,write_syms)
- PARAMS ((bfd *));
+extern bfd_boolean NAME (aout, write_syms)
+ (bfd *);
-extern void NAME(aout,reclaim_symbol_table)
- PARAMS ((bfd *));
+extern void NAME (aout, reclaim_symbol_table)
+ (bfd *);
-extern long NAME(aout,get_symtab_upper_bound)
- PARAMS ((bfd *));
+extern long NAME (aout, get_symtab_upper_bound)
+ (bfd *);
-extern long NAME(aout,canonicalize_symtab)
- PARAMS ((bfd *, asymbol **));
+extern long NAME (aout, canonicalize_symtab)
+ (bfd *, asymbol **);
-extern void NAME(aout,swap_ext_reloc_in)
- PARAMS ((bfd *, struct reloc_ext_external *, arelent *, asymbol **,
- bfd_size_type));
-extern void NAME(aout,swap_std_reloc_in)
- PARAMS ((bfd *, struct reloc_std_external *, arelent *, asymbol **,
- bfd_size_type));
+extern void NAME (aout, swap_ext_reloc_in)
+ (bfd *, struct reloc_ext_external *, arelent *, asymbol **,
+ bfd_size_type);
-extern reloc_howto_type * NAME(aout,reloc_type_lookup)
- PARAMS ((bfd *, bfd_reloc_code_real_type));
+extern void NAME (aout, swap_std_reloc_in)
+ (bfd *, struct reloc_std_external *, arelent *, asymbol **,
+ bfd_size_type);
-extern bfd_boolean NAME(aout,slurp_reloc_table)
- PARAMS ((bfd *, sec_ptr, asymbol **));
+extern reloc_howto_type * NAME (aout, reloc_type_lookup)
+ (bfd *, bfd_reloc_code_real_type);
-extern long NAME(aout,canonicalize_reloc)
- PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
+extern bfd_boolean NAME (aout, slurp_reloc_table)
+ (bfd *, sec_ptr, asymbol **);
-extern long NAME(aout,get_reloc_upper_bound)
- PARAMS ((bfd *, sec_ptr));
+extern long NAME (aout, canonicalize_reloc)
+ (bfd *, sec_ptr, arelent **, asymbol **);
-extern void NAME(aout,reclaim_reloc)
- PARAMS ((bfd *, sec_ptr));
+extern long NAME (aout, get_reloc_upper_bound)
+ (bfd *, sec_ptr);
-extern alent * NAME(aout,get_lineno)
- PARAMS ((bfd *, asymbol *));
+extern void NAME (aout, reclaim_reloc)
+ (bfd *, sec_ptr);
-extern void NAME(aout,print_symbol)
- PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
+extern alent * NAME (aout, get_lineno)
+ (bfd *, asymbol *);
-extern void NAME(aout,get_symbol_info)
- PARAMS ((bfd *, asymbol *, symbol_info *));
+extern void NAME (aout, print_symbol)
+ (bfd *, void *, asymbol *, bfd_print_symbol_type);
-extern bfd_boolean NAME(aout,find_nearest_line)
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
+extern void NAME (aout, get_symbol_info)
+ (bfd *, asymbol *, symbol_info *);
-extern long NAME(aout,read_minisymbols)
- PARAMS ((bfd *, bfd_boolean, PTR *, unsigned int *));
+extern bfd_boolean NAME (aout, find_nearest_line)
+ (bfd *, asection *, asymbol **, bfd_vma, const char **,
+ const char **, unsigned int *);
-extern asymbol * NAME(aout,minisymbol_to_symbol)
- PARAMS ((bfd *, bfd_boolean, const PTR, asymbol *));
+extern long NAME (aout, read_minisymbols)
+ (bfd *, bfd_boolean, void * *, unsigned int *);
-extern int NAME(aout,sizeof_headers)
- PARAMS ((bfd *, bfd_boolean));
+extern asymbol * NAME (aout, minisymbol_to_symbol)
+ (bfd *, bfd_boolean, const void *, asymbol *);
-extern bfd_boolean NAME(aout,adjust_sizes_and_vmas)
- PARAMS ((bfd *, bfd_size_type *, file_ptr *));
+extern int NAME (aout, sizeof_headers)
+ (bfd *, bfd_boolean);
-extern void NAME(aout,swap_exec_header_in)
- PARAMS ((bfd *, struct external_exec *, struct internal_exec *));
+extern bfd_boolean NAME (aout, adjust_sizes_and_vmas)
+ (bfd *, bfd_size_type *, file_ptr *);
-extern void NAME(aout,swap_exec_header_out)
- PARAMS ((bfd *, struct internal_exec *, struct external_exec *));
+extern void NAME (aout, swap_exec_header_in)
+ (bfd *, struct external_exec *, struct internal_exec *);
-extern struct bfd_hash_entry * NAME(aout,link_hash_newfunc)
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+extern void NAME (aout, swap_exec_header_out)
+ (bfd *, struct internal_exec *, struct external_exec *);
-extern bfd_boolean NAME(aout,link_hash_table_init)
- PARAMS ((struct aout_link_hash_table *, bfd *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *)));
+extern struct bfd_hash_entry * NAME (aout, link_hash_newfunc)
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
-extern struct bfd_link_hash_table * NAME(aout,link_hash_table_create)
- PARAMS ((bfd *));
+extern bfd_boolean NAME (aout, link_hash_table_init)
+ (struct aout_link_hash_table *, bfd *,
+ struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *));
-extern bfd_boolean NAME(aout,link_add_symbols)
- PARAMS ((bfd *, struct bfd_link_info *));
+extern struct bfd_link_hash_table * NAME (aout, link_hash_table_create)
+ (bfd *);
-extern bfd_boolean NAME(aout,final_link)
- PARAMS ((bfd *, struct bfd_link_info *,
- void (*) (bfd *, file_ptr *, file_ptr *, file_ptr *)));
+extern bfd_boolean NAME (aout, link_add_symbols)
+ (bfd *, struct bfd_link_info *);
-extern bfd_boolean NAME(aout,bfd_free_cached_info)
- PARAMS ((bfd *));
+extern bfd_boolean NAME (aout, final_link)
+ (bfd *, struct bfd_link_info *,
+ void (*) (bfd *, file_ptr *, file_ptr *, file_ptr *));
+
+extern bfd_boolean NAME (aout, bfd_free_cached_info)
+ (bfd *);
/* A.out uses the generic versions of these routines... */
@@ -616,8 +615,9 @@ extern bfd_boolean NAME(aout,bfd_free_cached_info)
{ \
bfd_size_type text_size; /* Dummy vars. */ \
file_ptr text_end; \
+ \
if (adata(abfd).magic == undecided_magic) \
- NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); \
+ NAME (aout, adjust_sizes_and_vmas) (abfd, & text_size, & text_end); \
\
execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \
execp->a_entry = bfd_get_start_address (abfd); \
@@ -626,32 +626,32 @@ extern bfd_boolean NAME(aout,bfd_free_cached_info)
obj_reloc_entry_size (abfd)); \
execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \
obj_reloc_entry_size (abfd)); \
- NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \
+ NAME (aout, swap_exec_header_out) (abfd, execp, & exec_bytes); \
\
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \
- || bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE,\
+ || bfd_bwrite (& exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \
abfd) != EXEC_BYTES_SIZE) \
return FALSE; \
/* Now write out reloc info, followed by syms and strings. */ \
\
- if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \
+ if (bfd_get_outsymbols (abfd) != NULL \
&& bfd_get_symcount (abfd) != 0) \
{ \
if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)\
return FALSE; \
\
- if (! NAME(aout,write_syms) (abfd)) \
+ if (! NAME (aout, write_syms) (abfd)) \
return FALSE; \
} \
\
if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (*execp)), SEEK_SET) != 0) \
return FALSE; \
- if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) \
+ if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))) \
return FALSE; \
\
if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp)), SEEK_SET) != 0) \
return FALSE; \
- if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) \
+ if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) \
return FALSE; \
}
#endif
diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h
index 464de9c..f4b5b5b 100644
--- a/bfd/libcoff-in.h
+++ b/bfd/libcoff-in.h
@@ -1,55 +1,52 @@
/* BFD COFF object file private structure.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004
+ 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Written by Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfdlink.h"
-/* Object file tdata; access macros */
-
-#define coff_data(bfd) ((bfd)->tdata.coff_obj_data)
-#define exec_hdr(bfd) (coff_data(bfd)->hdr)
-#define obj_pe(bfd) (coff_data(bfd)->pe)
-#define obj_symbols(bfd) (coff_data(bfd)->symbols)
-#define obj_sym_filepos(bfd) (coff_data(bfd)->sym_filepos)
-
-#define obj_relocbase(bfd) (coff_data(bfd)->relocbase)
-#define obj_raw_syments(bfd) (coff_data(bfd)->raw_syments)
-#define obj_raw_syment_count(bfd) (coff_data(bfd)->raw_syment_count)
-#define obj_convert(bfd) (coff_data(bfd)->conversion_table)
-#define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size)
-
-#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms)
-#define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms)
-#define obj_coff_strings(bfd) (coff_data (bfd)->strings)
-#define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings)
-#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes)
+/* Object file tdata; access macros. */
+
+#define coff_data(bfd) ((bfd)->tdata.coff_obj_data)
+#define exec_hdr(bfd) (coff_data (bfd)->hdr)
+#define obj_pe(bfd) (coff_data (bfd)->pe)
+#define obj_symbols(bfd) (coff_data (bfd)->symbols)
+#define obj_sym_filepos(bfd) (coff_data (bfd)->sym_filepos)
+#define obj_relocbase(bfd) (coff_data (bfd)->relocbase)
+#define obj_raw_syments(bfd) (coff_data (bfd)->raw_syments)
+#define obj_raw_syment_count(bfd) (coff_data (bfd)->raw_syment_count)
+#define obj_convert(bfd) (coff_data (bfd)->conversion_table)
+#define obj_conv_table_size(bfd) (coff_data (bfd)->conv_table_size)
+#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms)
+#define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms)
+#define obj_coff_strings(bfd) (coff_data (bfd)->strings)
+#define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings)
+#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes)
#define obj_coff_strings_written(bfd) (coff_data (bfd)->strings_written)
-
-#define obj_coff_local_toc_table(bfd) (coff_data(bfd)->local_toc_sym_map)
+#define obj_coff_local_toc_table(bfd) (coff_data (bfd)->local_toc_sym_map)
/* `Tdata' information kept for COFF files. */
typedef struct coff_tdata
{
- struct coff_symbol_struct *symbols; /* symtab for input bfd */
+ struct coff_symbol_struct *symbols; /* Symtab for input bfd. */
unsigned int *conversion_table;
int conv_table_size;
file_ptr sym_filepos;
@@ -57,7 +54,7 @@ typedef struct coff_tdata
struct coff_ptr_struct *raw_syments;
unsigned long raw_syment_count;
- /* These are only valid once writing has begun */
+ /* These are only valid once writing has begun. */
long int relocbase;
/* These members communicate important constants about the symbol table
@@ -73,7 +70,7 @@ typedef struct coff_tdata
/* The unswapped external symbols. May be NULL. Read by
_bfd_coff_get_external_symbols. */
- PTR external_syms;
+ void * external_syms;
/* If this is TRUE, the external_syms may not be freed. */
bfd_boolean keep_syms;
@@ -85,21 +82,21 @@ typedef struct coff_tdata
/* If this is TRUE, the strings have been written out already. */
bfd_boolean strings_written;
- /* is this a PE format coff file */
+ /* Is this a PE format coff file? */
int pe;
/* Used by the COFF backend linker. */
struct coff_link_hash_entry **sym_hashes;
- /* used by the pe linker for PowerPC */
+ /* Used by the pe linker for PowerPC. */
int *local_toc_sym_map;
struct bfd_link_info *link_info;
/* Used by coff_find_nearest_line. */
- PTR line_info;
+ void * line_info;
- /* A place to stash dwarf2 info for this bfd. */
- PTR dwarf2_find_line_info;
+ /* A place to stash dwarf2 info for this bfd. */
+ void * dwarf2_find_line_info;
/* The timestamp from the COFF file header. */
long timestamp;
@@ -110,14 +107,14 @@ typedef struct coff_tdata
} coff_data_type;
-/* Tdata for pe image files. */
+/* Tdata for pe image files. */
typedef struct pe_tdata
{
coff_data_type coff;
struct internal_extra_pe_aouthdr pe_opthdr;
int dll;
int has_reloc_section;
- bfd_boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *));
+ bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *);
flagword real_flags;
int target_subsystem;
bfd_boolean force_minimum_alignment;
@@ -174,7 +171,7 @@ struct xcoff_tdata
#define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data)
/* We take the address of the first element of an asymbol to ensure that the
- * macro is only ever applied to an asymbol. */
+ macro is only ever applied to an asymbol. */
#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
/* The used_by_bfd field of a section may be set to a pointer to this
@@ -198,9 +195,9 @@ struct coff_section_tdata
struct coff_comdat_info *comdat;
int line_base;
/* A pointer used for .stab linking optimizations. */
- PTR stab_info;
+ void * stab_info;
/* Available for individual backends. */
- PTR tdata;
+ void * tdata;
};
/* An accessor macro for the coff_section_tdata structure. */
@@ -293,7 +290,7 @@ struct coff_link_hash_table
#define coff_link_hash_traverse(table, func, info) \
(bfd_link_hash_traverse \
(&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
(info)))
/* Get the COFF linker hash table from a link_info structure. */
@@ -302,63 +299,63 @@ struct coff_link_hash_table
/* Functions in coffgen.c. */
extern const bfd_target *coff_object_p
- PARAMS ((bfd *));
+ (bfd *);
extern struct bfd_section *coff_section_from_bfd_index
- PARAMS ((bfd *, int));
+ (bfd *, int);
extern long coff_get_symtab_upper_bound
- PARAMS ((bfd *));
+ (bfd *);
extern long coff_canonicalize_symtab
- PARAMS ((bfd *, asymbol **));
+ (bfd *, asymbol **);
extern int coff_count_linenumbers
- PARAMS ((bfd *));
+ (bfd *);
extern struct coff_symbol_struct *coff_symbol_from
- PARAMS ((bfd *, asymbol *));
+ (bfd *, asymbol *);
extern bfd_boolean coff_renumber_symbols
- PARAMS ((bfd *, int *));
+ (bfd *, int *);
extern void coff_mangle_symbols
- PARAMS ((bfd *));
+ (bfd *);
extern bfd_boolean coff_write_symbols
- PARAMS ((bfd *));
+ (bfd *);
extern bfd_boolean coff_write_linenumbers
- PARAMS ((bfd *));
+ (bfd *);
extern alent *coff_get_lineno
- PARAMS ((bfd *, asymbol *));
+ (bfd *, asymbol *);
extern asymbol *coff_section_symbol
- PARAMS ((bfd *, char *));
+ (bfd *, char *);
extern bfd_boolean _bfd_coff_get_external_symbols
- PARAMS ((bfd *));
+ (bfd *);
extern const char *_bfd_coff_read_string_table
- PARAMS ((bfd *));
+ (bfd *);
extern bfd_boolean _bfd_coff_free_symbols
- PARAMS ((bfd *));
+ (bfd *);
extern struct coff_ptr_struct *coff_get_normalized_symtab
- PARAMS ((bfd *));
+ (bfd *);
extern long coff_get_reloc_upper_bound
- PARAMS ((bfd *, sec_ptr));
+ (bfd *, sec_ptr);
extern asymbol *coff_make_empty_symbol
- PARAMS ((bfd *));
+ (bfd *);
extern void coff_print_symbol
- PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type));
+ (bfd *, void * filep, asymbol *, bfd_print_symbol_type);
extern void coff_get_symbol_info
- PARAMS ((bfd *, asymbol *, symbol_info *ret));
+ (bfd *, asymbol *, symbol_info *ret);
extern bfd_boolean _bfd_coff_is_local_label_name
- PARAMS ((bfd *, const char *));
+ (bfd *, const char *);
extern asymbol *coff_bfd_make_debug_symbol
- PARAMS ((bfd *, PTR, unsigned long));
+ (bfd *, void *, unsigned long);
extern bfd_boolean coff_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
+ (bfd *, asection *, asymbol **, bfd_vma, const char **,
+ const char **, unsigned int *);
extern int coff_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
+ (bfd *, bfd_boolean);
extern bfd_boolean bfd_coff_reloc16_relax_section
- PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
+ (bfd *, asection *, struct bfd_link_info *, bfd_boolean *);
extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, bfd_boolean, asymbol **));
+ (bfd *, struct bfd_link_info *, struct bfd_link_order *,
+ bfd_byte *, bfd_boolean, asymbol **);
extern bfd_vma bfd_coff_reloc16_get_value
- PARAMS ((arelent *, struct bfd_link_info *, asection *));
+ (arelent *, struct bfd_link_info *, asection *);
extern void bfd_perform_slip
- PARAMS ((bfd *, unsigned int, asection *, bfd_vma));
+ (bfd *, unsigned int, asection *, bfd_vma);
/* Functions and types in cofflink.c. */
@@ -533,38 +530,37 @@ struct coff_section_alignment_entry
};
extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
extern bfd_boolean _bfd_coff_link_hash_table_init
- PARAMS ((struct coff_link_hash_table *, bfd *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *)));
+ (struct coff_link_hash_table *, bfd *,
+ struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *));
extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create
- PARAMS ((bfd *));
+ (bfd *);
extern const char *_bfd_coff_internal_syment_name
- PARAMS ((bfd *, const struct internal_syment *, char *));
+ (bfd *, const struct internal_syment *, char *);
extern bfd_boolean _bfd_coff_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_coff_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern struct internal_reloc *_bfd_coff_read_internal_relocs
- PARAMS ((bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean,
- struct internal_reloc *));
+ (bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean,
+ struct internal_reloc *);
extern bfd_boolean _bfd_coff_generic_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
-
+ (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+ struct internal_reloc *, struct internal_syment *, asection **);
extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
extern bfd_boolean _bfd_coff_write_global_sym
- PARAMS ((struct coff_link_hash_entry *, PTR));
+ (struct coff_link_hash_entry *, void *);
extern bfd_boolean _bfd_coff_write_task_globals
- PARAMS ((struct coff_link_hash_entry *, PTR));
+ (struct coff_link_hash_entry *, void *);
extern bfd_boolean _bfd_coff_link_input_bfd
- PARAMS ((struct coff_final_link_info *, bfd *));
+ (struct coff_final_link_info *, bfd *);
extern bfd_boolean _bfd_coff_reloc_link_order
- PARAMS ((bfd *, struct coff_final_link_info *, asection *,
- struct bfd_link_order *));
+ (bfd *, struct coff_final_link_info *, asection *,
+ struct bfd_link_order *);
#define coff_get_section_contents_in_window \
@@ -573,30 +569,30 @@ extern bfd_boolean _bfd_coff_reloc_link_order
/* Functions in xcofflink.c. */
extern long _bfd_xcoff_get_dynamic_symtab_upper_bound
- PARAMS ((bfd *));
+ (bfd *);
extern long _bfd_xcoff_canonicalize_dynamic_symtab
- PARAMS ((bfd *, asymbol **));
+ (bfd *, asymbol **);
extern long _bfd_xcoff_get_dynamic_reloc_upper_bound
- PARAMS ((bfd *));
+ (bfd *);
extern long _bfd_xcoff_canonicalize_dynamic_reloc
- PARAMS ((bfd *, arelent **, asymbol **));
+ (bfd *, arelent **, asymbol **);
extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
- PARAMS ((bfd *));
+ (bfd *);
extern void _bfd_xcoff_bfd_link_hash_table_free
- PARAMS ((struct bfd_link_hash_table *));
+ (struct bfd_link_hash_table *);
extern bfd_boolean _bfd_xcoff_bfd_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_xcoff_bfd_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_ppc_xcoff_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
+ (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+ struct internal_reloc *, struct internal_syment *, asection **);
/* Functions in coff-ppc.c. FIXME: These are called be pe.em in the
linker, and so should start with bfd and be declared in bfd.h. */
extern bfd_boolean ppc_allocate_toc_section
- PARAMS ((struct bfd_link_info *));
+ (struct bfd_link_info *);
extern bfd_boolean ppc_process_before_allocation
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index 9aca33e..b716a4e 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -4,56 +4,53 @@
/* BFD COFF object file private structure.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004
+ 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Written by Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfdlink.h"
-/* Object file tdata; access macros */
-
-#define coff_data(bfd) ((bfd)->tdata.coff_obj_data)
-#define exec_hdr(bfd) (coff_data(bfd)->hdr)
-#define obj_pe(bfd) (coff_data(bfd)->pe)
-#define obj_symbols(bfd) (coff_data(bfd)->symbols)
-#define obj_sym_filepos(bfd) (coff_data(bfd)->sym_filepos)
-
-#define obj_relocbase(bfd) (coff_data(bfd)->relocbase)
-#define obj_raw_syments(bfd) (coff_data(bfd)->raw_syments)
-#define obj_raw_syment_count(bfd) (coff_data(bfd)->raw_syment_count)
-#define obj_convert(bfd) (coff_data(bfd)->conversion_table)
-#define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size)
-
-#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms)
-#define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms)
-#define obj_coff_strings(bfd) (coff_data (bfd)->strings)
-#define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings)
-#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes)
+/* Object file tdata; access macros. */
+
+#define coff_data(bfd) ((bfd)->tdata.coff_obj_data)
+#define exec_hdr(bfd) (coff_data (bfd)->hdr)
+#define obj_pe(bfd) (coff_data (bfd)->pe)
+#define obj_symbols(bfd) (coff_data (bfd)->symbols)
+#define obj_sym_filepos(bfd) (coff_data (bfd)->sym_filepos)
+#define obj_relocbase(bfd) (coff_data (bfd)->relocbase)
+#define obj_raw_syments(bfd) (coff_data (bfd)->raw_syments)
+#define obj_raw_syment_count(bfd) (coff_data (bfd)->raw_syment_count)
+#define obj_convert(bfd) (coff_data (bfd)->conversion_table)
+#define obj_conv_table_size(bfd) (coff_data (bfd)->conv_table_size)
+#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms)
+#define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms)
+#define obj_coff_strings(bfd) (coff_data (bfd)->strings)
+#define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings)
+#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes)
#define obj_coff_strings_written(bfd) (coff_data (bfd)->strings_written)
-
-#define obj_coff_local_toc_table(bfd) (coff_data(bfd)->local_toc_sym_map)
+#define obj_coff_local_toc_table(bfd) (coff_data (bfd)->local_toc_sym_map)
/* `Tdata' information kept for COFF files. */
typedef struct coff_tdata
{
- struct coff_symbol_struct *symbols; /* symtab for input bfd */
+ struct coff_symbol_struct *symbols; /* Symtab for input bfd. */
unsigned int *conversion_table;
int conv_table_size;
file_ptr sym_filepos;
@@ -61,7 +58,7 @@ typedef struct coff_tdata
struct coff_ptr_struct *raw_syments;
unsigned long raw_syment_count;
- /* These are only valid once writing has begun */
+ /* These are only valid once writing has begun. */
long int relocbase;
/* These members communicate important constants about the symbol table
@@ -77,7 +74,7 @@ typedef struct coff_tdata
/* The unswapped external symbols. May be NULL. Read by
_bfd_coff_get_external_symbols. */
- PTR external_syms;
+ void * external_syms;
/* If this is TRUE, the external_syms may not be freed. */
bfd_boolean keep_syms;
@@ -89,21 +86,21 @@ typedef struct coff_tdata
/* If this is TRUE, the strings have been written out already. */
bfd_boolean strings_written;
- /* is this a PE format coff file */
+ /* Is this a PE format coff file? */
int pe;
/* Used by the COFF backend linker. */
struct coff_link_hash_entry **sym_hashes;
- /* used by the pe linker for PowerPC */
+ /* Used by the pe linker for PowerPC. */
int *local_toc_sym_map;
struct bfd_link_info *link_info;
/* Used by coff_find_nearest_line. */
- PTR line_info;
+ void * line_info;
- /* A place to stash dwarf2 info for this bfd. */
- PTR dwarf2_find_line_info;
+ /* A place to stash dwarf2 info for this bfd. */
+ void * dwarf2_find_line_info;
/* The timestamp from the COFF file header. */
long timestamp;
@@ -114,14 +111,14 @@ typedef struct coff_tdata
} coff_data_type;
-/* Tdata for pe image files. */
+/* Tdata for pe image files. */
typedef struct pe_tdata
{
coff_data_type coff;
struct internal_extra_pe_aouthdr pe_opthdr;
int dll;
int has_reloc_section;
- bfd_boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *));
+ bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *);
flagword real_flags;
int target_subsystem;
bfd_boolean force_minimum_alignment;
@@ -178,7 +175,7 @@ struct xcoff_tdata
#define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data)
/* We take the address of the first element of an asymbol to ensure that the
- * macro is only ever applied to an asymbol. */
+ macro is only ever applied to an asymbol. */
#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
/* The used_by_bfd field of a section may be set to a pointer to this
@@ -202,9 +199,9 @@ struct coff_section_tdata
struct coff_comdat_info *comdat;
int line_base;
/* A pointer used for .stab linking optimizations. */
- PTR stab_info;
+ void * stab_info;
/* Available for individual backends. */
- PTR tdata;
+ void * tdata;
};
/* An accessor macro for the coff_section_tdata structure. */
@@ -297,7 +294,7 @@ struct coff_link_hash_table
#define coff_link_hash_traverse(table, func, info) \
(bfd_link_hash_traverse \
(&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
(info)))
/* Get the COFF linker hash table from a link_info structure. */
@@ -306,63 +303,63 @@ struct coff_link_hash_table
/* Functions in coffgen.c. */
extern const bfd_target *coff_object_p
- PARAMS ((bfd *));
+ (bfd *);
extern struct bfd_section *coff_section_from_bfd_index
- PARAMS ((bfd *, int));
+ (bfd *, int);
extern long coff_get_symtab_upper_bound
- PARAMS ((bfd *));
+ (bfd *);
extern long coff_canonicalize_symtab
- PARAMS ((bfd *, asymbol **));
+ (bfd *, asymbol **);
extern int coff_count_linenumbers
- PARAMS ((bfd *));
+ (bfd *);
extern struct coff_symbol_struct *coff_symbol_from
- PARAMS ((bfd *, asymbol *));
+ (bfd *, asymbol *);
extern bfd_boolean coff_renumber_symbols
- PARAMS ((bfd *, int *));
+ (bfd *, int *);
extern void coff_mangle_symbols
- PARAMS ((bfd *));
+ (bfd *);
extern bfd_boolean coff_write_symbols
- PARAMS ((bfd *));
+ (bfd *);
extern bfd_boolean coff_write_linenumbers
- PARAMS ((bfd *));
+ (bfd *);
extern alent *coff_get_lineno
- PARAMS ((bfd *, asymbol *));
+ (bfd *, asymbol *);
extern asymbol *coff_section_symbol
- PARAMS ((bfd *, char *));
+ (bfd *, char *);
extern bfd_boolean _bfd_coff_get_external_symbols
- PARAMS ((bfd *));
+ (bfd *);
extern const char *_bfd_coff_read_string_table
- PARAMS ((bfd *));
+ (bfd *);
extern bfd_boolean _bfd_coff_free_symbols
- PARAMS ((bfd *));
+ (bfd *);
extern struct coff_ptr_struct *coff_get_normalized_symtab
- PARAMS ((bfd *));
+ (bfd *);
extern long coff_get_reloc_upper_bound
- PARAMS ((bfd *, sec_ptr));
+ (bfd *, sec_ptr);
extern asymbol *coff_make_empty_symbol
- PARAMS ((bfd *));
+ (bfd *);
extern void coff_print_symbol
- PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type));
+ (bfd *, void * filep, asymbol *, bfd_print_symbol_type);
extern void coff_get_symbol_info
- PARAMS ((bfd *, asymbol *, symbol_info *ret));
+ (bfd *, asymbol *, symbol_info *ret);
extern bfd_boolean _bfd_coff_is_local_label_name
- PARAMS ((bfd *, const char *));
+ (bfd *, const char *);
extern asymbol *coff_bfd_make_debug_symbol
- PARAMS ((bfd *, PTR, unsigned long));
+ (bfd *, void *, unsigned long);
extern bfd_boolean coff_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
+ (bfd *, asection *, asymbol **, bfd_vma, const char **,
+ const char **, unsigned int *);
extern int coff_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
+ (bfd *, bfd_boolean);
extern bfd_boolean bfd_coff_reloc16_relax_section
- PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
+ (bfd *, asection *, struct bfd_link_info *, bfd_boolean *);
extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, bfd_boolean, asymbol **));
+ (bfd *, struct bfd_link_info *, struct bfd_link_order *,
+ bfd_byte *, bfd_boolean, asymbol **);
extern bfd_vma bfd_coff_reloc16_get_value
- PARAMS ((arelent *, struct bfd_link_info *, asection *));
+ (arelent *, struct bfd_link_info *, asection *);
extern void bfd_perform_slip
- PARAMS ((bfd *, unsigned int, asection *, bfd_vma));
+ (bfd *, unsigned int, asection *, bfd_vma);
/* Functions and types in cofflink.c. */
@@ -537,38 +534,37 @@ struct coff_section_alignment_entry
};
extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
extern bfd_boolean _bfd_coff_link_hash_table_init
- PARAMS ((struct coff_link_hash_table *, bfd *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *)));
+ (struct coff_link_hash_table *, bfd *,
+ struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *));
extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create
- PARAMS ((bfd *));
+ (bfd *);
extern const char *_bfd_coff_internal_syment_name
- PARAMS ((bfd *, const struct internal_syment *, char *));
+ (bfd *, const struct internal_syment *, char *);
extern bfd_boolean _bfd_coff_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_coff_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern struct internal_reloc *_bfd_coff_read_internal_relocs
- PARAMS ((bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean,
- struct internal_reloc *));
+ (bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean,
+ struct internal_reloc *);
extern bfd_boolean _bfd_coff_generic_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
-
+ (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+ struct internal_reloc *, struct internal_syment *, asection **);
extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
extern bfd_boolean _bfd_coff_write_global_sym
- PARAMS ((struct coff_link_hash_entry *, PTR));
+ (struct coff_link_hash_entry *, void *);
extern bfd_boolean _bfd_coff_write_task_globals
- PARAMS ((struct coff_link_hash_entry *, PTR));
+ (struct coff_link_hash_entry *, void *);
extern bfd_boolean _bfd_coff_link_input_bfd
- PARAMS ((struct coff_final_link_info *, bfd *));
+ (struct coff_final_link_info *, bfd *);
extern bfd_boolean _bfd_coff_reloc_link_order
- PARAMS ((bfd *, struct coff_final_link_info *, asection *,
- struct bfd_link_order *));
+ (bfd *, struct coff_final_link_info *, asection *,
+ struct bfd_link_order *);
#define coff_get_section_contents_in_window \
@@ -577,32 +573,32 @@ extern bfd_boolean _bfd_coff_reloc_link_order
/* Functions in xcofflink.c. */
extern long _bfd_xcoff_get_dynamic_symtab_upper_bound
- PARAMS ((bfd *));
+ (bfd *);
extern long _bfd_xcoff_canonicalize_dynamic_symtab
- PARAMS ((bfd *, asymbol **));
+ (bfd *, asymbol **);
extern long _bfd_xcoff_get_dynamic_reloc_upper_bound
- PARAMS ((bfd *));
+ (bfd *);
extern long _bfd_xcoff_canonicalize_dynamic_reloc
- PARAMS ((bfd *, arelent **, asymbol **));
+ (bfd *, arelent **, asymbol **);
extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
- PARAMS ((bfd *));
+ (bfd *);
extern void _bfd_xcoff_bfd_link_hash_table_free
- PARAMS ((struct bfd_link_hash_table *));
+ (struct bfd_link_hash_table *);
extern bfd_boolean _bfd_xcoff_bfd_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_xcoff_bfd_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_ppc_xcoff_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
+ (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+ struct internal_reloc *, struct internal_syment *, asection **);
/* Functions in coff-ppc.c. FIXME: These are called be pe.em in the
linker, and so should start with bfd and be declared in bfd.h. */
extern bfd_boolean ppc_allocate_toc_section
- PARAMS ((struct bfd_link_info *));
+ (struct bfd_link_info *);
extern bfd_boolean ppc_process_before_allocation
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
/* Extracted from coffcode.h. */
typedef struct coff_ptr_struct
@@ -676,34 +672,34 @@ enum coff_symbol_classification
typedef struct
{
void (*_bfd_coff_swap_aux_in)
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+ (bfd *, void *, int, int, int, int, void *);
void (*_bfd_coff_swap_sym_in)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
void (*_bfd_coff_swap_lineno_in)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_aux_out)
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+ (bfd *, void *, int, int, int, int, void *);
unsigned int (*_bfd_coff_swap_sym_out)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_lineno_out)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_reloc_out)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_filehdr_out)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_aouthdr_out)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_scnhdr_out)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
unsigned int _bfd_filhsz;
unsigned int _bfd_aoutsz;
@@ -720,86 +716,86 @@ typedef struct
unsigned int _bfd_coff_debug_string_prefix_length;
void (*_bfd_coff_swap_filehdr_in)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
void (*_bfd_coff_swap_aouthdr_in)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
void (*_bfd_coff_swap_scnhdr_in)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
void (*_bfd_coff_swap_reloc_in)
- PARAMS ((bfd *abfd, PTR, PTR));
+ (bfd *abfd, void *, void *);
bfd_boolean (*_bfd_coff_bad_format_hook)
- PARAMS ((bfd *, PTR));
+ (bfd *, void *);
bfd_boolean (*_bfd_coff_set_arch_mach_hook)
- PARAMS ((bfd *, PTR));
+ (bfd *, void *);
- PTR (*_bfd_coff_mkobject_hook)
- PARAMS ((bfd *, PTR, PTR));
+ void * (*_bfd_coff_mkobject_hook)
+ (bfd *, void *, void *);
bfd_boolean (*_bfd_styp_to_sec_flags_hook)
- PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
+ (bfd *, void *, const char *, asection *, flagword *);
void (*_bfd_set_alignment_hook)
- PARAMS ((bfd *, asection *, PTR));
+ (bfd *, asection *, void *);
bfd_boolean (*_bfd_coff_slurp_symbol_table)
- PARAMS ((bfd *));
+ (bfd *);
bfd_boolean (*_bfd_coff_symname_in_debug)
- PARAMS ((bfd *, struct internal_syment *));
+ (bfd *, struct internal_syment *);
bfd_boolean (*_bfd_coff_pointerize_aux_hook)
- PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
- unsigned int, combined_entry_type *));
+ (bfd *, combined_entry_type *, combined_entry_type *,
+ unsigned int, combined_entry_type *);
bfd_boolean (*_bfd_coff_print_aux)
- PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *,
- combined_entry_type *, unsigned int));
+ (bfd *, FILE *, combined_entry_type *, combined_entry_type *,
+ combined_entry_type *, unsigned int);
void (*_bfd_coff_reloc16_extra_cases)
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
- bfd_byte *, unsigned int *, unsigned int *));
+ (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
+ bfd_byte *, unsigned int *, unsigned int *);
int (*_bfd_coff_reloc16_estimate)
- PARAMS ((bfd *, asection *, arelent *, unsigned int,
- struct bfd_link_info *));
+ (bfd *, asection *, arelent *, unsigned int,
+ struct bfd_link_info *);
enum coff_symbol_classification (*_bfd_coff_classify_symbol)
- PARAMS ((bfd *, struct internal_syment *));
+ (bfd *, struct internal_syment *);
bfd_boolean (*_bfd_coff_compute_section_file_positions)
- PARAMS ((bfd *));
+ (bfd *);
bfd_boolean (*_bfd_coff_start_final_link)
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
bfd_boolean (*_bfd_coff_relocate_section)
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
+ (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+ struct internal_reloc *, struct internal_syment *, asection **);
reloc_howto_type *(*_bfd_coff_rtype_to_howto)
- PARAMS ((bfd *, asection *, struct internal_reloc *,
+ (bfd *, asection *, struct internal_reloc *,
struct coff_link_hash_entry *, struct internal_syment *,
- bfd_vma *));
+ bfd_vma *);
bfd_boolean (*_bfd_coff_adjust_symndx)
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
- struct internal_reloc *, bfd_boolean *));
+ (bfd *, struct bfd_link_info *, bfd *, asection *,
+ struct internal_reloc *, bfd_boolean *);
bfd_boolean (*_bfd_coff_link_add_one_symbol)
- PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
+ (struct bfd_link_info *, bfd *, const char *, flagword,
asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
- struct bfd_link_hash_entry **));
+ struct bfd_link_hash_entry **);
bfd_boolean (*_bfd_coff_link_output_has_begun)
- PARAMS ((bfd *, struct coff_final_link_info *));
+ (bfd *, struct coff_final_link_info *);
bfd_boolean (*_bfd_coff_final_link_postscript)
- PARAMS ((bfd *, struct coff_final_link_info *));
+ (bfd *, struct coff_final_link_info *);
} bfd_coff_backend_data;
@@ -929,7 +925,7 @@ typedef struct
(info, abfd, name, flags, section, value, string, cp, coll, hashp))
#define bfd_coff_link_output_has_begun(a,p) \
- ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p))
+ ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p))
#define bfd_coff_final_link_postscript(a,p) \
- ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p))
+ ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a, p))
diff --git a/bfd/libecoff.h b/bfd/libecoff.h
index 495be63..cc31f7e 100644
--- a/bfd/libecoff.h
+++ b/bfd/libecoff.h
@@ -1,23 +1,23 @@
/* BFD ECOFF object file private structure.
- Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003, 2004,
+ 2005 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfdlink.h"
@@ -57,24 +57,22 @@ struct ecoff_backend_data
/* External reloc size. */
bfd_size_type external_reloc_size;
/* Reloc swapping functions. */
- void (*swap_reloc_in) PARAMS ((bfd *, PTR, struct internal_reloc *));
- void (*swap_reloc_out) PARAMS ((bfd *, const struct internal_reloc *, PTR));
+ void (*swap_reloc_in) (bfd *, void *, struct internal_reloc *);
+ void (*swap_reloc_out) (bfd *, const struct internal_reloc *, void *);
/* Backend reloc tweaking. */
void (*adjust_reloc_in)
- PARAMS ((bfd *, const struct internal_reloc *, arelent *));
+ (bfd *, const struct internal_reloc *, arelent *);
void (*adjust_reloc_out)
- PARAMS ((bfd *, const arelent *, struct internal_reloc *));
+ (bfd *, const arelent *, struct internal_reloc *);
/* Relocate section contents while linking. */
bfd_boolean (*relocate_section)
- PARAMS ((bfd *output_bfd, struct bfd_link_info *, bfd *input_bfd,
- asection *input_section, bfd_byte *contents,
- PTR external_relocs));
+ (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, void *);
/* Do final adjustments to filehdr and aouthdr. */
bfd_boolean (*adjust_headers)
- PARAMS ((bfd *, struct internal_filehdr *, struct internal_aouthdr *));
+ (bfd *, struct internal_filehdr *, struct internal_aouthdr *);
/* Read an element from an archive at a given file position. This
is needed because OSF/1 3.2 uses a weird archive format. */
- bfd *(*get_elt_at_filepos) PARAMS ((bfd *, file_ptr));
+ bfd *(*get_elt_at_filepos) (bfd *, file_ptr);
};
/* This is the target specific information kept for ECOFF files. */
@@ -115,7 +113,7 @@ typedef struct ecoff_tdata
struct ecoff_debug_info debug_info;
/* The unswapped ECOFF symbolic information. */
- PTR raw_syments;
+ void * raw_syments;
/* The canonical BFD symbols. */
struct ecoff_symbol_struct *canonical_symbols;
@@ -163,7 +161,7 @@ typedef struct ecoff_symbol_struct
/* A pointer to the unswapped hidden information for this symbol.
This is either a struct sym_ext or a struct ext_ext, depending on
the value of the local field above. */
- PTR native;
+ void * native;
} ecoff_symbol_type;
/* We take the address of the first element of an asymbol to ensure that the
@@ -221,28 +219,28 @@ struct ecoff_link_hash_table
};
/* Make an ECOFF object. */
-extern bfd_boolean _bfd_ecoff_mkobject PARAMS ((bfd *));
+extern bfd_boolean _bfd_ecoff_mkobject (bfd *);
/* Read in the ECOFF symbolic debugging information. */
extern bfd_boolean _bfd_ecoff_slurp_symbolic_info
- PARAMS ((bfd *, asection *, struct ecoff_debug_info *));
+ (bfd *, asection *, struct ecoff_debug_info *);
/* Generic ECOFF BFD backend vectors. */
-extern bfd_boolean _bfd_ecoff_write_object_contents PARAMS ((bfd *abfd));
-extern const bfd_target *_bfd_ecoff_archive_p PARAMS ((bfd *abfd));
+extern bfd_boolean _bfd_ecoff_write_object_contents (bfd *);
+extern const bfd_target *_bfd_ecoff_archive_p (bfd *);
#define _bfd_ecoff_close_and_cleanup _bfd_generic_close_and_cleanup
#define _bfd_ecoff_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
extern bfd_boolean _bfd_ecoff_new_section_hook
- PARAMS ((bfd *, asection *));
+ (bfd *, asection *);
extern bfd_boolean _bfd_ecoff_get_section_contents
- PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type));
+ (bfd *, asection *, void * location, file_ptr, bfd_size_type);
#define _bfd_ecoff_bfd_link_split_section _bfd_generic_link_split_section
extern bfd_boolean _bfd_ecoff_bfd_copy_private_bfd_data
- PARAMS ((bfd *, bfd *));
+ (bfd *, bfd *);
#define _bfd_ecoff_bfd_copy_private_section_data \
_bfd_generic_bfd_copy_private_section_data
@@ -259,13 +257,13 @@ extern bfd_boolean _bfd_ecoff_bfd_copy_private_bfd_data
_bfd_generic_bfd_merge_private_bfd_data
#define _bfd_ecoff_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
-extern bfd_boolean _bfd_ecoff_slurp_armap PARAMS ((bfd *abfd));
+extern bfd_boolean _bfd_ecoff_slurp_armap (bfd *);
#define _bfd_ecoff_slurp_extended_name_table _bfd_slurp_extended_name_table
#define _bfd_ecoff_construct_extended_name_table \
_bfd_archive_bsd_construct_extended_name_table
#define _bfd_ecoff_truncate_arname bfd_dont_truncate_arname
extern bfd_boolean _bfd_ecoff_write_armap
- PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
+ (bfd *, unsigned int, struct orl *, unsigned int, int);
#define _bfd_ecoff_read_ar_hdr _bfd_generic_read_ar_hdr
#define _bfd_ecoff_openr_next_archived_file \
bfd_generic_openr_next_archived_file
@@ -275,65 +273,64 @@ extern bfd_boolean _bfd_ecoff_write_armap
#define _bfd_ecoff_bfd_is_target_special_symbol \
((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
-extern long _bfd_ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd));
-extern long _bfd_ecoff_canonicalize_symtab PARAMS ((bfd *abfd, asymbol **alocation));
-extern asymbol *_bfd_ecoff_make_empty_symbol PARAMS ((bfd *abfd));
+extern long _bfd_ecoff_get_symtab_upper_bound (bfd *);
+extern long _bfd_ecoff_canonicalize_symtab (bfd *, asymbol **);
+extern asymbol *_bfd_ecoff_make_empty_symbol (bfd *);
extern void _bfd_ecoff_print_symbol
- PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type));
+ (bfd *, void *, asymbol *, bfd_print_symbol_type);
extern void _bfd_ecoff_get_symbol_info
- PARAMS ((bfd *, asymbol *, symbol_info *));
+ (bfd *, asymbol *, symbol_info *);
extern bfd_boolean _bfd_ecoff_bfd_is_local_label_name
- PARAMS ((bfd *, const char *));
+ (bfd *, const char *);
#define _bfd_ecoff_get_lineno _bfd_nosymbols_get_lineno
extern bfd_boolean _bfd_ecoff_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma offset,
- const char **filename_ptr, const char **fnname_ptr,
- unsigned int *retline_ptr));
+ (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
+ unsigned int *);
#define _bfd_ecoff_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define _bfd_ecoff_read_minisymbols _bfd_generic_read_minisymbols
#define _bfd_ecoff_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
#define _bfd_ecoff_get_reloc_upper_bound coff_get_reloc_upper_bound
extern long _bfd_ecoff_canonicalize_reloc
- PARAMS ((bfd *, asection *, arelent **, asymbol **symbols));
+ (bfd *, asection *, arelent **, asymbol **symbols);
/* ecoff_bfd_reloc_type_lookup defined by backend. */
extern bfd_boolean _bfd_ecoff_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long));
+ (bfd *, enum bfd_architecture, unsigned long);
extern bfd_boolean _bfd_ecoff_set_section_contents
- PARAMS ((bfd *, asection *, const PTR location, file_ptr, bfd_size_type));
+ (bfd *, asection *, const void * location, file_ptr, bfd_size_type);
-extern int _bfd_ecoff_sizeof_headers PARAMS ((bfd *abfd, bfd_boolean reloc));
+extern int _bfd_ecoff_sizeof_headers (bfd *, bfd_boolean);
/* ecoff_bfd_get_relocated_section_contents defined by backend. */
/* ecoff_bfd_relax_section defined by backend. */
extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create
- PARAMS ((bfd *));
+ (bfd *);
#define _bfd_ecoff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
extern bfd_boolean _bfd_ecoff_bfd_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
#define _bfd_ecoff_bfd_link_just_syms _bfd_generic_link_just_syms
extern bfd_boolean _bfd_ecoff_bfd_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
/* Hook functions for the generic COFF section reading code. */
-extern PTR _bfd_ecoff_mkobject_hook PARAMS ((bfd *, PTR filehdr, PTR aouthdr));
+extern void * _bfd_ecoff_mkobject_hook (bfd *, void *, void *);
#define _bfd_ecoff_set_alignment_hook \
- ((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void)
+ ((void (*) (bfd *, asection *, void *)) bfd_void)
extern bfd_boolean _bfd_ecoff_set_arch_mach_hook
- PARAMS ((bfd *abfd, PTR filehdr));
+ (bfd *, void *);
extern bfd_boolean _bfd_ecoff_styp_to_sec_flags
- PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
-extern bfd_boolean _bfd_ecoff_slurp_symbol_table PARAMS ((bfd *abfd));
+ (bfd *, void *, const char *, asection *, flagword *);
+extern bfd_boolean _bfd_ecoff_slurp_symbol_table (bfd *);
/* ECOFF auxiliary information swapping routines. These are the same
for all ECOFF targets, so they are defined in ecofflink.c. */
extern void _bfd_ecoff_swap_tir_in
- PARAMS ((int, const struct tir_ext *, TIR *));
+ (int, const struct tir_ext *, TIR *);
extern void _bfd_ecoff_swap_tir_out
- PARAMS ((int, const TIR *, struct tir_ext *));
+ (int, const TIR *, struct tir_ext *);
extern void _bfd_ecoff_swap_rndx_in
- PARAMS ((int, const struct rndx_ext *, RNDXR *));
+ (int, const struct rndx_ext *, RNDXR *);
extern void _bfd_ecoff_swap_rndx_out
- PARAMS ((int, const RNDXR *, struct rndx_ext *));
+ (int, const RNDXR *, struct rndx_ext *);
diff --git a/bfd/libnlm.h b/bfd/libnlm.h
index 0a7b4d9..f3c93c0 100644
--- a/bfd/libnlm.h
+++ b/bfd/libnlm.h
@@ -1,22 +1,22 @@
/* BFD back-end data structures for NLM (NetWare Loadable Modules) files.
- Copyright 1993, 1994, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
Written by Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _LIBNLM_H_
#define _LIBNLM_H_ 1
@@ -52,33 +52,19 @@ typedef struct
struct nlm_relent *relocs;
} nlmNAME(symbol_type);
-extern bfd_boolean nlm_mkobject
- PARAMS ((bfd *));
-extern bfd_boolean nlm_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-
-extern void nlmNAME(get_symbol_info)
- PARAMS ((bfd *, asymbol *, symbol_info *));
-extern long nlmNAME(get_symtab_upper_bound)
- PARAMS ((bfd *));
-extern long nlmNAME(canonicalize_symtab)
- PARAMS ((bfd *, asymbol **));
-extern asymbol *nlmNAME(make_empty_symbol)
- PARAMS ((bfd *));
-extern void nlmNAME(print_symbol)
- PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
-extern long nlmNAME(get_reloc_upper_bound)
- PARAMS ((bfd *, asection *));
-extern long nlmNAME(canonicalize_reloc)
- PARAMS ((bfd *, asection *, arelent **, asymbol **));
-extern const bfd_target *nlmNAME(object_p)
- PARAMS ((bfd *));
-extern bfd_boolean nlmNAME(set_arch_mach)
- PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-extern bfd_boolean nlmNAME(set_section_contents)
- PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type));
-extern bfd_boolean nlmNAME(write_object_contents)
- PARAMS ((bfd *));
+extern bfd_boolean nlm_mkobject (bfd *);
+extern bfd_boolean nlm_set_arch_mach (bfd *, enum bfd_architecture, unsigned long);
+extern void nlmNAME (get_symbol_info) (bfd *, asymbol *, symbol_info *);
+extern long nlmNAME (get_symtab_upper_bound)(bfd *);
+extern long nlmNAME (canonicalize_symtab) (bfd *, asymbol **);
+extern asymbol * nlmNAME (make_empty_symbol) (bfd *);
+extern void nlmNAME (print_symbol) (bfd *, void *, asymbol *, bfd_print_symbol_type);
+extern long nlmNAME (get_reloc_upper_bound) (bfd *, asection *);
+extern long nlmNAME (canonicalize_reloc) (bfd *, asection *, arelent **, asymbol **);
+extern const bfd_target * nlmNAME (object_p) (bfd *);
+extern bfd_boolean nlmNAME (set_arch_mach) (bfd *, enum bfd_architecture, unsigned long);
+extern bfd_boolean nlmNAME (set_section_contents) (bfd *, asection *, const void *, file_ptr, bfd_size_type);
+extern bfd_boolean nlmNAME (write_object_contents) (bfd *);
/* Some private data is stashed away for future use using the tdata pointer
in the bfd structure. */
@@ -94,7 +80,7 @@ struct nlm_obj_tdata
Nlm_Internal_Custom_Header nlm_custom_hdr[1];
Nlm_Internal_Cygnus_Ext_Header nlm_cygnus_ext_hdr[1];
/* BFD NLM symbols. */
- nlmNAME(symbol_type) *nlm_symbols;
+ nlmNAME (symbol_type) * nlm_symbols;
/* Lowest text and data VMA values. */
bfd_vma nlm_text_low;
bfd_vma nlm_data_low;
@@ -118,24 +104,22 @@ struct nlm_obj_tdata
};
#define nlm_tdata(bfd) ((bfd) -> tdata.nlm_obj_data)
-#define nlm_fixed_header(bfd) (nlm_tdata(bfd) -> nlm_fixed_hdr)
-#define nlm_variable_header(bfd) (nlm_tdata(bfd) -> nlm_variable_hdr)
-#define nlm_version_header(bfd) (nlm_tdata(bfd) -> nlm_version_hdr)
-#define nlm_copyright_header(bfd) (nlm_tdata(bfd) -> nlm_copyright_hdr)
-#define nlm_extended_header(bfd) (nlm_tdata(bfd) -> nlm_extended_hdr)
-#define nlm_custom_header(bfd) (nlm_tdata(bfd) -> nlm_custom_hdr)
-#define nlm_cygnus_ext_header(bfd) (nlm_tdata(bfd) -> nlm_cygnus_ext_hdr)
-#define nlm_get_symbols(bfd) (nlm_tdata(bfd) -> nlm_symbols)
-#define nlm_set_symbols(bfd, p) (nlm_tdata(bfd) -> nlm_symbols = (p))
-#define nlm_set_text_low(bfd, i) (nlm_tdata(bfd) -> nlm_text_low = (i))
-#define nlm_get_text_low(bfd) (nlm_tdata(bfd) -> nlm_text_low)
-#define nlm_set_data_low(bfd, i) (nlm_tdata(bfd) -> nlm_data_low = (i))
-#define nlm_get_data_low(bfd) (nlm_tdata(bfd) -> nlm_data_low)
-#define nlm_relocation_fixups(bfd) (nlm_tdata(bfd) -> nlm_reloc_fixups)
-#define nlm_relocation_fixup_secs(bfd) (nlm_tdata(bfd)->nlm_reloc_fixup_secs)
-
-#define nlm_alpha_backend_data(bfd) \
- (&nlm_tdata (bfd)->backend_data.alpha_backend_data)
+#define nlm_fixed_header(bfd) (nlm_tdata (bfd) -> nlm_fixed_hdr)
+#define nlm_variable_header(bfd) (nlm_tdata (bfd) -> nlm_variable_hdr)
+#define nlm_version_header(bfd) (nlm_tdata (bfd) -> nlm_version_hdr)
+#define nlm_copyright_header(bfd) (nlm_tdata (bfd) -> nlm_copyright_hdr)
+#define nlm_extended_header(bfd) (nlm_tdata (bfd) -> nlm_extended_hdr)
+#define nlm_custom_header(bfd) (nlm_tdata (bfd) -> nlm_custom_hdr)
+#define nlm_cygnus_ext_header(bfd) (nlm_tdata (bfd) -> nlm_cygnus_ext_hdr)
+#define nlm_get_symbols(bfd) (nlm_tdata (bfd) -> nlm_symbols)
+#define nlm_set_symbols(bfd, p) (nlm_tdata (bfd) -> nlm_symbols = (p))
+#define nlm_set_text_low(bfd, i) (nlm_tdata (bfd) -> nlm_text_low = (i))
+#define nlm_get_text_low(bfd) (nlm_tdata (bfd) -> nlm_text_low)
+#define nlm_set_data_low(bfd, i) (nlm_tdata (bfd) -> nlm_data_low = (i))
+#define nlm_get_data_low(bfd) (nlm_tdata (bfd) -> nlm_data_low)
+#define nlm_relocation_fixups(bfd) (nlm_tdata (bfd) -> nlm_reloc_fixups)
+#define nlm_relocation_fixup_secs(bfd) (nlm_tdata (bfd) -> nlm_reloc_fixup_secs)
+#define nlm_alpha_backend_data(bfd) (&nlm_tdata (bfd) -> backend_data.alpha_backend_data)
/* This is used when writing out the external relocs. */
@@ -171,11 +155,11 @@ struct nlm_backend_data
not NULL, it will be called by nlm_object_p. It should return
TRUE if this file could match this format, and it should leave
the BFD such that a bfd_bread will pick up the fixed header. */
- bfd_boolean (*nlm_backend_object_p) PARAMS ((bfd *));
+ bfd_boolean (*nlm_backend_object_p) (bfd *);
/* Write out the prefix. This function may be NULL. This must
write out the same number of bytes as is in the field
optional_prefix_size. */
- bfd_boolean (*nlm_write_prefix) PARAMS ((bfd *));
+ bfd_boolean (*nlm_write_prefix) (bfd *);
/* Read a relocation fixup from abfd. The reloc information is
machine specific. The second argument is the symbol if this is
an import, or NULL if this is a reloc fixup. This function
@@ -183,74 +167,48 @@ struct nlm_backend_data
belongs in, and the fourth argument to the reloc itself; it does
not need to fill in the sym_ptr_ptr field for a reloc against an
import symbol. */
- bfd_boolean (*nlm_read_reloc)
- PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *));
+ bfd_boolean (*nlm_read_reloc) (bfd *, nlmNAME (symbol_type) *, asection **, arelent *);
/* To make objcopy to an i386 NLM work, the i386 backend needs a
chance to work over the relocs. This is a bit icky. */
- bfd_boolean (*nlm_mangle_relocs)
- PARAMS ((bfd *, asection *, const PTR data, bfd_vma offset,
- bfd_size_type count));
+ bfd_boolean (*nlm_mangle_relocs) (bfd *, asection *, const void *, bfd_vma, bfd_size_type);
/* Read an import record from abfd. It would be nice if this
were in a machine-dependent format, but it doesn't seem to be. */
- bfd_boolean (*nlm_read_import) PARAMS ((bfd *, nlmNAME(symbol_type) *));
+ bfd_boolean (*nlm_read_import) (bfd *, nlmNAME (symbol_type) *);
/* Write an import record to abfd. */
- bfd_boolean (*nlm_write_import) PARAMS ((bfd *, asection *, arelent *));
+ bfd_boolean (*nlm_write_import) (bfd *, asection *, arelent *);
/* Set the section for a public symbol. This may be NULL, in which
case a default method will be used. */
- bfd_boolean (*nlm_set_public_section)
- PARAMS ((bfd *, nlmNAME(symbol_type) *));
+ bfd_boolean (*nlm_set_public_section) (bfd *, nlmNAME (symbol_type) *);
/* Get the offset to write out for a public symbol. This may be
NULL, in which case a default method will be used. */
- bfd_vma (*nlm_get_public_offset) PARAMS ((bfd *, asymbol *));
+ bfd_vma (*nlm_get_public_offset) (bfd *, asymbol *);
/* Swap the fixed header in and out */
- void (*nlm_swap_fhdr_in)
- PARAMS ((bfd *, PTR, Nlm_Internal_Fixed_Header *));
- void (*nlm_swap_fhdr_out)
- PARAMS ((bfd *, struct nlm_internal_fixed_header *, PTR));
+ void (*nlm_swap_fhdr_in) (bfd *, void *, Nlm_Internal_Fixed_Header *);
+ void (*nlm_swap_fhdr_out) (bfd *, struct nlm_internal_fixed_header *, void *);
/* Write out an external reference. */
- bfd_boolean (*nlm_write_external)
- PARAMS ((bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *));
- bfd_boolean (*nlm_write_export) PARAMS ((bfd *, asymbol *, bfd_vma));
+ bfd_boolean (*nlm_write_external) (bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *);
+ bfd_boolean (*nlm_write_export) (bfd *, asymbol *, bfd_vma);
};
-#define nlm_backend(bfd) \
- ((struct nlm_backend_data *)((bfd) -> xvec -> backend_data))
-#define nlm_signature(bfd) \
- (nlm_backend(bfd) -> signature)
-#define nlm_fixed_header_size(bfd) \
- (nlm_backend(bfd) -> fixed_header_size)
-#define nlm_optional_prefix_size(bfd) \
- (nlm_backend(bfd) -> optional_prefix_size)
-#define nlm_architecture(bfd) \
- (nlm_backend(bfd) -> arch)
-#define nlm_machine(bfd) \
- (nlm_backend(bfd) -> mach)
-#define nlm_no_uninitialized_data(bfd) \
- (nlm_backend(bfd) -> no_uninitialized_data)
-#define nlm_backend_object_p_func(bfd) \
- (nlm_backend(bfd) -> nlm_backend_object_p)
-#define nlm_write_prefix_func(bfd) \
- (nlm_backend(bfd) -> nlm_write_prefix)
-#define nlm_read_reloc_func(bfd) \
- (nlm_backend(bfd) -> nlm_read_reloc)
-#define nlm_mangle_relocs_func(bfd) \
- (nlm_backend(bfd) -> nlm_mangle_relocs)
-#define nlm_read_import_func(bfd) \
- (nlm_backend(bfd) -> nlm_read_import)
-#define nlm_write_import_func(bfd) \
- (nlm_backend(bfd) -> nlm_write_import)
-#define nlm_set_public_section_func(bfd) \
- (nlm_backend(bfd) -> nlm_set_public_section)
-#define nlm_get_public_offset_func(bfd) \
- (nlm_backend(bfd) -> nlm_get_public_offset)
-#define nlm_swap_fixed_header_in_func(bfd) \
- (nlm_backend(bfd) -> nlm_swap_fhdr_in)
-#define nlm_swap_fixed_header_out_func(bfd) \
- (nlm_backend(bfd) -> nlm_swap_fhdr_out)
-#define nlm_write_external_func(bfd) \
- (nlm_backend(bfd) -> nlm_write_external)
-#define nlm_write_export_func(bfd) \
- (nlm_backend(bfd) -> nlm_write_export)
+#define nlm_backend(bfd) ((struct nlm_backend_data *)((bfd) -> xvec -> backend_data))
+#define nlm_signature(bfd) (nlm_backend (bfd) -> signature)
+#define nlm_fixed_header_size(bfd) (nlm_backend (bfd) -> fixed_header_size)
+#define nlm_optional_prefix_size(bfd) (nlm_backend (bfd) -> optional_prefix_size)
+#define nlm_architecture(bfd) (nlm_backend (bfd) -> arch)
+#define nlm_machine(bfd) (nlm_backend (bfd) -> mach)
+#define nlm_no_uninitialized_data(bfd) (nlm_backend (bfd) -> no_uninitialized_data)
+#define nlm_backend_object_p_func(bfd) (nlm_backend (bfd) -> nlm_backend_object_p)
+#define nlm_write_prefix_func(bfd) (nlm_backend (bfd) -> nlm_write_prefix)
+#define nlm_read_reloc_func(bfd) (nlm_backend (bfd) -> nlm_read_reloc)
+#define nlm_mangle_relocs_func(bfd) (nlm_backend (bfd) -> nlm_mangle_relocs)
+#define nlm_read_import_func(bfd) (nlm_backend (bfd) -> nlm_read_import)
+#define nlm_write_import_func(bfd) (nlm_backend (bfd) -> nlm_write_import)
+#define nlm_set_public_section_func(bfd) (nlm_backend (bfd) -> nlm_set_public_section)
+#define nlm_get_public_offset_func(bfd) (nlm_backend (bfd) -> nlm_get_public_offset)
+#define nlm_swap_fixed_header_in_func(bfd) (nlm_backend (bfd) -> nlm_swap_fhdr_in)
+#define nlm_swap_fixed_header_out_func(bfd)(nlm_backend (bfd) -> nlm_swap_fhdr_out)
+#define nlm_write_external_func(bfd) (nlm_backend (bfd) -> nlm_write_external)
+#define nlm_write_export_func(bfd) (nlm_backend (bfd) -> nlm_write_export)
/* The NLM code, data, and uninitialized sections have no names defined
in the NLM, but bfd wants to give them names, so use the traditional
diff --git a/bfd/libpei.h b/bfd/libpei.h
index 9ed9c12..89a8b56 100644
--- a/bfd/libpei.h
+++ b/bfd/libpei.h
@@ -1,5 +1,5 @@
/* Support for the generic parts of PE/PEI; common header information.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
Free Software Foundation, Inc.
Written by Cygnus Solutions.
@@ -270,6 +270,11 @@
#endif /* !COFF_WITH_pep */
+/* Macro: Returns true if the bfd is a PE executable as opposed to a PE object file. */
+#define bfd_pe_executable_p(abfd) \
+ (strncmp ((abfd)->xvec->name, "pei-", 4) == 0 \
+ || strncmp ((abfd)->xvec->name, "efi-app-", 8) == 0)
+
/* These functions are architecture dependent, and are in peicode.h:
coff_swap_reloc_in
int coff_swap_reloc_out
@@ -282,56 +287,39 @@
implementations architecture types, and actually appear in
peigen.c. */
-void _bfd_XXi_swap_sym_in PARAMS ((bfd*, PTR, PTR));
-#define coff_swap_sym_in _bfd_XXi_swap_sym_in
-
-unsigned int _bfd_XXi_swap_sym_out PARAMS ((bfd*, PTR, PTR));
-#define coff_swap_sym_out _bfd_XXi_swap_sym_out
-
-void _bfd_XXi_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-#define coff_swap_aux_in _bfd_XXi_swap_aux_in
-
-unsigned int _bfd_XXi_swap_aux_out \
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-#define coff_swap_aux_out _bfd_XXi_swap_aux_out
-
-void _bfd_XXi_swap_lineno_in PARAMS ((bfd*, PTR, PTR));
-#define coff_swap_lineno_in _bfd_XXi_swap_lineno_in
-
-unsigned int _bfd_XXi_swap_lineno_out PARAMS ((bfd*, PTR, PTR));
-#define coff_swap_lineno_out _bfd_XXi_swap_lineno_out
-
-void _bfd_XXi_swap_aouthdr_in PARAMS ((bfd*, PTR, PTR));
-#define coff_swap_aouthdr_in _bfd_XXi_swap_aouthdr_in
-
-unsigned int _bfd_XXi_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR));
+#define coff_swap_sym_in _bfd_XXi_swap_sym_in
+#define coff_swap_sym_out _bfd_XXi_swap_sym_out
+#define coff_swap_aux_in _bfd_XXi_swap_aux_in
+#define coff_swap_aux_out _bfd_XXi_swap_aux_out
+#define coff_swap_lineno_in _bfd_XXi_swap_lineno_in
+#define coff_swap_lineno_out _bfd_XXi_swap_lineno_out
+#define coff_swap_aouthdr_in _bfd_XXi_swap_aouthdr_in
#define coff_swap_aouthdr_out _bfd_XXi_swap_aouthdr_out
-
-unsigned int _bfd_XXi_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR));
-#define coff_swap_scnhdr_out _bfd_XXi_swap_scnhdr_out
-
-bfd_boolean _bfd_XX_print_private_bfd_data_common PARAMS ((bfd *, PTR));
-
-bfd_boolean _bfd_XX_bfd_copy_private_bfd_data_common PARAMS ((bfd *, bfd *));
-
-void _bfd_XX_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
-
-bfd_boolean _bfd_XXi_final_link_postscript
- PARAMS ((bfd *, struct coff_final_link_info *));
+#define coff_swap_scnhdr_out _bfd_XXi_swap_scnhdr_out
#ifndef coff_final_link_postscript
#define coff_final_link_postscript _bfd_XXi_final_link_postscript
#endif
+
+void _bfd_XXi_swap_sym_in (bfd *, void *, void *);
+unsigned _bfd_XXi_swap_sym_out (bfd *, void *, void *);
+void _bfd_XXi_swap_aux_in (bfd *, void *, int, int, int, int, void *);
+unsigned _bfd_XXi_swap_aux_out (bfd *, void *, int, int, int, int, void *);
+void _bfd_XXi_swap_lineno_in (bfd *, void *, void *);
+unsigned _bfd_XXi_swap_lineno_out (bfd *, void *, void *);
+void _bfd_XXi_swap_aouthdr_in (bfd *, void *, void *);
+unsigned _bfd_XXi_swap_aouthdr_out (bfd *, void *, void *);
+unsigned _bfd_XXi_swap_scnhdr_out (bfd *, void *, void *);
+bfd_boolean _bfd_XX_print_private_bfd_data_common (bfd *, void *);
+bfd_boolean _bfd_XX_bfd_copy_private_bfd_data_common (bfd *, bfd *);
+void _bfd_XX_get_symbol_info (bfd *, asymbol *, symbol_info *);
+bfd_boolean _bfd_XXi_final_link_postscript (bfd *, struct coff_final_link_info *);
+
/* The following are needed only for ONE of pe or pei, but don't
otherwise vary; peicode.h fixes up ifdefs but we provide the
prototype. */
-unsigned int _bfd_XX_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
-unsigned int _bfd_XXi_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
-bfd_boolean _bfd_XX_bfd_copy_private_section_data
- PARAMS ((bfd *, asection *, bfd *, asection *));
+unsigned _bfd_XX_only_swap_filehdr_out (bfd *, void *, void *);
+unsigned _bfd_XXi_only_swap_filehdr_out (bfd *, void *, void *);
+bfd_boolean _bfd_XX_bfd_copy_private_section_data (bfd *, asection *, bfd *, asection *);
-/* Macro: Returns true if the bfd is a PE executable as opposed to a PE object file. */
-#define bfd_pe_executable_p(abfd) \
- (strncmp ((abfd)->xvec->name, "pei-", 4) == 0 \
- || strncmp ((abfd)->xvec->name, "efi-app-", 8) == 0)
diff --git a/bfd/libxcoff.h b/bfd/libxcoff.h
index 8537617..7e06b50 100644
--- a/bfd/libxcoff.h
+++ b/bfd/libxcoff.h
@@ -1,5 +1,5 @@
/* BFD XCOFF object file private structure.
- Copyright 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2005 Free Software Foundation, Inc.
Written by Tom Rix, Redhat.
This file is part of BFD, the Binary File Descriptor library.
@@ -39,18 +39,12 @@ struct xcoff_backend_data_rec
long _xcoff_machine;
/* Function pointers to xcoff specific swap routines. */
- void (* _xcoff_swap_ldhdr_in)
- PARAMS ((bfd *, const PTR, struct internal_ldhdr *));
- void (* _xcoff_swap_ldhdr_out)
- PARAMS ((bfd *, const struct internal_ldhdr *, PTR));
- void (* _xcoff_swap_ldsym_in)
- PARAMS ((bfd *, const PTR, struct internal_ldsym *));
- void (* _xcoff_swap_ldsym_out)
- PARAMS ((bfd *, const struct internal_ldsym *, PTR));
- void (* _xcoff_swap_ldrel_in)
- PARAMS ((bfd *, const PTR, struct internal_ldrel *));
- void (* _xcoff_swap_ldrel_out)
- PARAMS ((bfd *, const struct internal_ldrel *, PTR));
+ void (* _xcoff_swap_ldhdr_in) (bfd *, const void *, struct internal_ldhdr *);
+ void (* _xcoff_swap_ldhdr_out)(bfd *, const struct internal_ldhdr *, void *);
+ void (* _xcoff_swap_ldsym_in) (bfd *, const void *, struct internal_ldsym *);
+ void (* _xcoff_swap_ldsym_out)(bfd *, const struct internal_ldsym *, void *);
+ void (* _xcoff_swap_ldrel_in) (bfd *, const void *, struct internal_ldrel *);
+ void (* _xcoff_swap_ldrel_out)(bfd *, const struct internal_ldrel *, void *);
/* Size of the external struct. */
unsigned int _xcoff_ldhdrsz;
@@ -69,33 +63,29 @@ struct xcoff_backend_data_rec
unsigned long _xcoff_ldhdr_version;
bfd_boolean (* _xcoff_put_symbol_name)
- PARAMS ((bfd *, struct bfd_strtab_hash *, struct internal_syment *,
- const char *));
+ (bfd *, struct bfd_strtab_hash *, struct internal_syment *,
+ const char *);
bfd_boolean (* _xcoff_put_ldsymbol_name)
- PARAMS ((bfd *, struct xcoff_loader_info *, struct internal_ldsym *,
- const char *));
+ (bfd *, struct xcoff_loader_info *, struct internal_ldsym *,
+ const char *);
reloc_howto_type *_xcoff_dynamic_reloc;
asection * (* _xcoff_create_csect_from_smclas)
- PARAMS ((bfd *, union internal_auxent *, const char *));
+ (bfd *, union internal_auxent *, const char *);
/* Line number and relocation overflow.
XCOFF32 overflows to another section when the line number or the
relocation count exceeds 0xffff. XCOFF64 does not overflow. */
- bfd_boolean (*_xcoff_is_lineno_count_overflow)
- PARAMS ((bfd *, bfd_vma));
- bfd_boolean (*_xcoff_is_reloc_count_overflow)
- PARAMS ((bfd *, bfd_vma));
+ bfd_boolean (*_xcoff_is_lineno_count_overflow) (bfd *, bfd_vma);
+ bfd_boolean (*_xcoff_is_reloc_count_overflow) (bfd *, bfd_vma);
/* Loader section symbol and relocation table offset
XCOFF32 is after the .loader header
XCOFF64 is offset in .loader header. */
- bfd_vma (*_xcoff_loader_symbol_offset)
- PARAMS ((bfd *, struct internal_ldhdr *));
- bfd_vma (*_xcoff_loader_reloc_offset)
- PARAMS ((bfd *, struct internal_ldhdr *));
+ bfd_vma (*_xcoff_loader_symbol_offset) (bfd *, struct internal_ldhdr *);
+ bfd_vma (*_xcoff_loader_reloc_offset) (bfd *, struct internal_ldhdr *);
/* Global linkage. The first word of global linkage code must be be
modified by filling in the correct TOC offset. */
@@ -107,7 +97,7 @@ struct xcoff_backend_data_rec
/* rtinit. */
unsigned int _xcoff_rtinit_size;
bfd_boolean (*_xcoff_generate_rtinit)
- PARAMS ((bfd *, const char *, const char *, bfd_boolean));
+ (bfd *, const char *, const char *, bfd_boolean);
};
/* Look up an entry in an XCOFF link hash table. */
@@ -120,7 +110,7 @@ struct xcoff_backend_data_rec
#define xcoff_link_hash_traverse(table, func, info) \
(bfd_link_hash_traverse \
(&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
(info)))
/* Get the XCOFF link hash table from the info structure. This is
@@ -131,80 +121,80 @@ struct xcoff_backend_data_rec
#define xcoff_backend(abfd) \
((struct xcoff_backend_data_rec *) (abfd)->xvec->backend_data)
-#define bfd_xcoff_magic_number(a) ((xcoff_backend(a)->_xcoff_magic_number))
-#define bfd_xcoff_architecture(a) ((xcoff_backend(a)->_xcoff_architecture))
-#define bfd_xcoff_machine(a) ((xcoff_backend(a)->_xcoff_machine))
+#define bfd_xcoff_magic_number(a) ((xcoff_backend (a)->_xcoff_magic_number))
+#define bfd_xcoff_architecture(a) ((xcoff_backend (a)->_xcoff_architecture))
+#define bfd_xcoff_machine(a) ((xcoff_backend (a)->_xcoff_machine))
#define bfd_xcoff_swap_ldhdr_in(a, b, c) \
- ((xcoff_backend(a)->_xcoff_swap_ldhdr_in) ((a), (b), (c)))
+ ((xcoff_backend (a)->_xcoff_swap_ldhdr_in) ((a), (b), (c)))
#define bfd_xcoff_swap_ldhdr_out(a, b, c) \
- ((xcoff_backend(a)->_xcoff_swap_ldhdr_out) ((a), (b), (c)))
+ ((xcoff_backend (a)->_xcoff_swap_ldhdr_out) ((a), (b), (c)))
#define bfd_xcoff_swap_ldsym_in(a, b, c) \
- ((xcoff_backend(a)->_xcoff_swap_ldsym_in) ((a), (b), (c)))
+ ((xcoff_backend (a)->_xcoff_swap_ldsym_in) ((a), (b), (c)))
#define bfd_xcoff_swap_ldsym_out(a, b, c) \
- ((xcoff_backend(a)->_xcoff_swap_ldsym_out) ((a), (b), (c)))
+ ((xcoff_backend (a)->_xcoff_swap_ldsym_out) ((a), (b), (c)))
#define bfd_xcoff_swap_ldrel_in(a, b, c) \
- ((xcoff_backend(a)->_xcoff_swap_ldrel_in) ((a), (b), (c)))
+ ((xcoff_backend (a)->_xcoff_swap_ldrel_in) ((a), (b), (c)))
#define bfd_xcoff_swap_ldrel_out(a, b, c) \
- ((xcoff_backend(a)->_xcoff_swap_ldrel_out) ((a), (b), (c)))
+ ((xcoff_backend (a)->_xcoff_swap_ldrel_out) ((a), (b), (c)))
-#define bfd_xcoff_ldhdrsz(a) ((xcoff_backend(a)->_xcoff_ldhdrsz))
-#define bfd_xcoff_ldsymsz(a) ((xcoff_backend(a)->_xcoff_ldsymsz))
-#define bfd_xcoff_ldrelsz(a) ((xcoff_backend(a)->_xcoff_ldrelsz))
+#define bfd_xcoff_ldhdrsz(a) ((xcoff_backend (a)->_xcoff_ldhdrsz))
+#define bfd_xcoff_ldsymsz(a) ((xcoff_backend (a)->_xcoff_ldsymsz))
+#define bfd_xcoff_ldrelsz(a) ((xcoff_backend (a)->_xcoff_ldrelsz))
#define bfd_xcoff_function_descriptor_size(a) \
- ((xcoff_backend(a)->_xcoff_function_descriptor_size))
+ ((xcoff_backend (a)->_xcoff_function_descriptor_size))
#define bfd_xcoff_small_aout_header_size(a) \
- ((xcoff_backend(a)->_xcoff_small_aout_header_size))
+ ((xcoff_backend (a)->_xcoff_small_aout_header_size))
-#define bfd_xcoff_ldhdr_version(a) ((xcoff_backend(a)->_xcoff_ldhdr_version))
+#define bfd_xcoff_ldhdr_version(a) ((xcoff_backend (a)->_xcoff_ldhdr_version))
#define bfd_xcoff_put_symbol_name(a, b, c, d) \
- ((xcoff_backend(a)->_xcoff_put_symbol_name) ((a), (b), (c), (d)))
+ ((xcoff_backend (a)->_xcoff_put_symbol_name) ((a), (b), (c), (d)))
#define bfd_xcoff_put_ldsymbol_name(a, b, c, d) \
- ((xcoff_backend(a)->_xcoff_put_ldsymbol_name) ((a), (b), (c), (d)))
+ ((xcoff_backend (a)->_xcoff_put_ldsymbol_name) ((a), (b), (c), (d)))
/* Get the XCOFF hash table entries for a BFD. */
#define obj_xcoff_sym_hashes(bfd) \
((struct xcoff_link_hash_entry **) obj_coff_sym_hashes (bfd))
#define bfd_xcoff_dynamic_reloc_howto(a) \
- ((xcoff_backend(a)->_xcoff_dynamic_reloc))
+ ((xcoff_backend (a)->_xcoff_dynamic_reloc))
#define bfd_xcoff_create_csect_from_smclas(a, b, c) \
- ((xcoff_backend(a)->_xcoff_create_csect_from_smclas((a), (b), (c))))
+ ((xcoff_backend (a)->_xcoff_create_csect_from_smclas((a), (b), (c))))
#define bfd_xcoff_is_lineno_count_overflow(a, b) \
- ((xcoff_backend(a)->_xcoff_is_lineno_count_overflow((a), (b))))
+ ((xcoff_backend (a)->_xcoff_is_lineno_count_overflow((a), (b))))
#define bfd_xcoff_is_reloc_count_overflow(a, b) \
- ((xcoff_backend(a)->_xcoff_is_reloc_count_overflow((a), (b))))
+ ((xcoff_backend (a)->_xcoff_is_reloc_count_overflow((a), (b))))
#define bfd_xcoff_loader_symbol_offset(a, b) \
- ((xcoff_backend(a)->_xcoff_loader_symbol_offset((a), (b))))
+ ((xcoff_backend (a)->_xcoff_loader_symbol_offset((a), (b))))
#define bfd_xcoff_loader_reloc_offset(a, b) \
- ((xcoff_backend(a)->_xcoff_loader_reloc_offset((a), (b))))
+ ((xcoff_backend (a)->_xcoff_loader_reloc_offset((a), (b))))
-#define bfd_xcoff_glink_code(a, b) ((xcoff_backend(a)->_xcoff_glink_code[(b)]))
-#define bfd_xcoff_glink_code_size(a) ((xcoff_backend(a)->_xcoff_glink_size))
+#define bfd_xcoff_glink_code(a, b) ((xcoff_backend (a)->_xcoff_glink_code[(b)]))
+#define bfd_xcoff_glink_code_size(a) ((xcoff_backend (a)->_xcoff_glink_size))
/* Check for the magic number U803XTOCMAGIC or U64_TOCMAGIC for 64 bit
targets. */
#define bfd_xcoff_is_xcoff64(a) \
- ( (0x01EF == (bfd_xcoff_magic_number(a))) \
- || (0x01F7 == (bfd_xcoff_magic_number(a))))
+ ( (0x01EF == (bfd_xcoff_magic_number (a))) \
+ || (0x01F7 == (bfd_xcoff_magic_number (a))))
/* Check for the magic number U802TOMAGIC for 32 bit targets. */
-#define bfd_xcoff_is_xcoff32(a) (0x01DF == (bfd_xcoff_magic_number(a)))
+#define bfd_xcoff_is_xcoff32(a) (0x01DF == (bfd_xcoff_magic_number (a)))
-#define bfd_xcoff_rtinit_size(a) ((xcoff_backend(a)->_xcoff_rtinit_size))
-#define bfd_xcoff_generate_rtinit(a, b, c, d) ((xcoff_backend(a)->_xcoff_generate_rtinit ((a), (b), (c), (d))))
+#define bfd_xcoff_rtinit_size(a) ((xcoff_backend (a)->_xcoff_rtinit_size))
+#define bfd_xcoff_generate_rtinit(a, b, c, d) ((xcoff_backend (a)->_xcoff_generate_rtinit ((a), (b), (c), (d))))
/* Accessor macros for tdata. */
#define bfd_xcoff_text_align_power(a) ((xcoff_data (a)->text_align_power))
@@ -228,18 +218,18 @@ struct xcoff_backend_data_rec
bfd *, bfd_vma, bfd_vma, struct reloc_howto_struct *howto
extern bfd_boolean (*xcoff_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION])
- PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
+ (XCOFF_RELOC_FUNCTION_ARGS);
extern bfd_boolean (*xcoff_complain_overflow[XCOFF_MAX_COMPLAIN_OVERFLOW])
- PARAMS ((XCOFF_COMPLAIN_FUNCTION_ARGS));
+ (XCOFF_COMPLAIN_FUNCTION_ARGS);
/* Relocation functions */
-bfd_boolean xcoff_reloc_type_noop PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-bfd_boolean xcoff_reloc_type_fail PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-bfd_boolean xcoff_reloc_type_pos PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-bfd_boolean xcoff_reloc_type_neg PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-bfd_boolean xcoff_reloc_type_rel PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-bfd_boolean xcoff_reloc_type_toc PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-bfd_boolean xcoff_reloc_type_ba PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-bfd_boolean xcoff_reloc_type_crel PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
+bfd_boolean xcoff_reloc_type_noop (XCOFF_RELOC_FUNCTION_ARGS);
+bfd_boolean xcoff_reloc_type_fail (XCOFF_RELOC_FUNCTION_ARGS);
+bfd_boolean xcoff_reloc_type_pos (XCOFF_RELOC_FUNCTION_ARGS);
+bfd_boolean xcoff_reloc_type_neg (XCOFF_RELOC_FUNCTION_ARGS);
+bfd_boolean xcoff_reloc_type_rel (XCOFF_RELOC_FUNCTION_ARGS);
+bfd_boolean xcoff_reloc_type_toc (XCOFF_RELOC_FUNCTION_ARGS);
+bfd_boolean xcoff_reloc_type_ba (XCOFF_RELOC_FUNCTION_ARGS);
+bfd_boolean xcoff_reloc_type_crel (XCOFF_RELOC_FUNCTION_ARGS);
#endif /* LIBXCOFF_H */
diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h
index 1c727ed..cdc58b9 100644
--- a/bfd/nlm-target.h
+++ b/bfd/nlm-target.h
@@ -1,61 +1,57 @@
/* Target definitions for 32/64-bit NLM (NetWare Loadable Module)
- Copyright 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+ 2005 Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define nlm_core_file_p _bfd_dummy_target
-#define nlm_get_symtab_upper_bound nlmNAME(get_symtab_upper_bound)
-#define nlm_canonicalize_symtab nlmNAME(canonicalize_symtab)
-#define nlm_make_empty_symbol nlmNAME(make_empty_symbol)
-#define nlm_print_symbol nlmNAME(print_symbol)
-#define nlm_get_symbol_info nlmNAME(get_symbol_info)
-#define nlm_bfd_is_local_label_name bfd_generic_is_local_label_name
-#define nlm_bfd_is_target_special_symbol \
- ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
-#define nlm_get_lineno _bfd_nosymbols_get_lineno
-#define nlm_find_nearest_line _bfd_nosymbols_find_nearest_line
-#define nlm_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
-#define nlm_read_minisymbols _bfd_generic_read_minisymbols
-#define nlm_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-
-#define nlm_get_reloc_upper_bound nlmNAME(get_reloc_upper_bound)
-#define nlm_canonicalize_reloc nlmNAME(canonicalize_reloc)
-#define nlm_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
-
-#define nlm_set_section_contents nlmNAME(set_section_contents)
-
-#define nlm_sizeof_headers _bfd_nolink_sizeof_headers
-#define nlm_bfd_get_relocated_section_contents \
- bfd_generic_get_relocated_section_contents
-#define nlm_bfd_relax_section bfd_generic_relax_section
-#define nlm_bfd_gc_sections bfd_generic_gc_sections
-#define nlm_bfd_merge_sections bfd_generic_merge_sections
-#define nlm_bfd_is_group_section bfd_generic_is_group_section
-#define nlm_bfd_discard_group bfd_generic_discard_group
-#define nlm_section_already_linked \
- _bfd_generic_section_already_linked
-#define nlm_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
-#define nlm_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-#define nlm_bfd_link_add_symbols _bfd_generic_link_add_symbols
-#define nlm_bfd_link_just_syms _bfd_generic_link_just_syms
-#define nlm_bfd_final_link _bfd_generic_final_link
-#define nlm_bfd_link_split_section _bfd_generic_link_split_section
+#define nlm_get_symtab_upper_bound nlmNAME (get_symtab_upper_bound)
+#define nlm_canonicalize_symtab nlmNAME (canonicalize_symtab)
+#define nlm_make_empty_symbol nlmNAME (make_empty_symbol)
+#define nlm_print_symbol nlmNAME (print_symbol)
+#define nlm_get_symbol_info nlmNAME (get_symbol_info)
+#define nlm_bfd_is_local_label_name bfd_generic_is_local_label_name
+#define nlm_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define nlm_get_lineno _bfd_nosymbols_get_lineno
+#define nlm_find_nearest_line _bfd_nosymbols_find_nearest_line
+#define nlm_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
+#define nlm_read_minisymbols _bfd_generic_read_minisymbols
+#define nlm_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
+
+#define nlm_get_reloc_upper_bound nlmNAME (get_reloc_upper_bound)
+#define nlm_canonicalize_reloc nlmNAME (canonicalize_reloc)
+#define nlm_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
+#define nlm_set_section_contents nlmNAME (set_section_contents)
+
+#define nlm_sizeof_headers _bfd_nolink_sizeof_headers
+#define nlm_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
+#define nlm_bfd_relax_section bfd_generic_relax_section
+#define nlm_bfd_gc_sections bfd_generic_gc_sections
+#define nlm_bfd_merge_sections bfd_generic_merge_sections
+#define nlm_bfd_is_group_section bfd_generic_is_group_section
+#define nlm_bfd_discard_group bfd_generic_discard_group
+#define nlm_section_already_linked _bfd_generic_section_already_linked
+#define nlm_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
+#define nlm_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
+#define nlm_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define nlm_bfd_link_just_syms _bfd_generic_link_just_syms
+#define nlm_bfd_final_link _bfd_generic_final_link
+#define nlm_bfd_link_split_section _bfd_generic_link_split_section
/* This structure contains everything that BFD knows about a target.
It includes things like its byte order, name, what routines to call
@@ -73,74 +69,74 @@ extern const bfd_target TARGET_LITTLE_SYM;
#ifdef TARGET_BIG_SYM
const bfd_target TARGET_BIG_SYM =
{
- /* name: identify kind of target */
+ /* Name: identify kind of target. */
TARGET_BIG_NAME,
- /* flavour: general indication about file */
+ /* Flavour: general indication about file. */
bfd_target_nlm_flavour,
- /* byteorder: data is big endian */
+ /* Byteorder: data is big endian. */
BFD_ENDIAN_BIG,
- /* header_byteorder: header is also big endian */
+ /* Header_byteorder: header is also big endian. */
BFD_ENDIAN_BIG,
- /* object_flags: mask of all file flags */
+ /* Object_flags: mask of all file flags. */
(HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
| WP_TEXT),
- /* section_flags: mask of all section flags */
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
- SEC_CODE | SEC_DATA),
+ /* Section_flags: mask of all section flags. */
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY
+ | SEC_CODE | SEC_DATA),
- /* leading_symbol_char: is the first char of a user symbol
- predictable, and if so what is it */
+ /* Leading_symbol_char: is the first char of a user symbol
+ predictable, and if so what is it. */
0,
- /* ar_pad_char: pad character for filenames within an archive header
+ /* AR_pad_char: pad character for filenames within an archive header
FIXME: this really has nothing to do with NLM, this is a characteristic
- of the archiver and/or os and should be independently tunable */
+ of the archiver and/or os and should be independently tunable. */
'/',
- /* ar_max_namelen: maximum number of characters in an archive header
+ /* AR_max_namelen: maximum number of characters in an archive header
FIXME: this really has nothing to do with NLM, this is a characteristic
of the archiver and should be independently tunable. This value is
- a WAG (wild a** guess) */
+ a WAG (wild a** guess). */
15,
- /* Routines to byte-swap various sized integers from the data sections */
+ /* Routines to byte-swap various sized integers from the data sections. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16,
+ bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+ bfd_getb16, bfd_getb_signed_16, bfd_putb16,
- /* Routines to byte-swap various sized integers from the file headers */
+ /* Routines to byte-swap various sized integers from the file headers. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16,
-
- /* bfd_check_format: check the format of a file being read */
- { _bfd_dummy_target, /* unknown format */
- nlmNAME(object_p), /* assembler/linker output (object file) */
- bfd_generic_archive_p, /* an archive */
- nlm_core_file_p /* a core file */
+ bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+ bfd_getb16, bfd_getb_signed_16, bfd_putb16,
+
+ /* bfd_check_format: check the format of a file being read. */
+ { _bfd_dummy_target, /* Unknown format. */
+ nlmNAME (object_p), /* Assembler/linker output (object file). */
+ bfd_generic_archive_p, /* An archive. */
+ nlm_core_file_p /* A core file. */
},
- /* bfd_set_format: set the format of a file being written */
+ /* bfd_set_format: set the format of a file being written. */
{ bfd_false,
nlm_mkobject,
_bfd_generic_mkarchive,
bfd_false
},
- /* bfd_write_contents: write cached information into a file being written */
+ /* bfd_write_contents: write cached information into a file being written. */
{ bfd_false,
- nlmNAME(write_object_contents),
+ nlmNAME (write_object_contents),
_bfd_write_archive_contents,
bfd_false
},
- /* Initialize a jump table with the standard macro. All names start with
- "nlm" */
+ /* Initialize a jump table with the standard macro.
+ All names start with "nlm". */
BFD_JUMP_TABLE_GENERIC (_bfd_generic),
BFD_JUMP_TABLE_COPY (_bfd_generic),
BFD_JUMP_TABLE_CORE (_bfd_nocore),
@@ -158,82 +154,82 @@ const bfd_target TARGET_BIG_SYM =
NULL,
#endif
- /* backend_data: */
- (PTR) TARGET_BACKEND_DATA
+ /* Backend_data. */
+ (void *) TARGET_BACKEND_DATA
};
#endif
#ifdef TARGET_LITTLE_SYM
const bfd_target TARGET_LITTLE_SYM =
{
- /* name: identify kind of target */
+ /* Name: identify kind of target. */
TARGET_LITTLE_NAME,
- /* flavour: general indication about file */
+ /* Flavour: general indication about file. */
bfd_target_nlm_flavour,
- /* byteorder: data is little endian */
+ /* Byteorder: data is little endian. */
BFD_ENDIAN_LITTLE,
- /* header_byteorder: header is also little endian */
+ /* Header_byteorder: header is also little endian. */
BFD_ENDIAN_LITTLE,
- /* object_flags: mask of all file flags */
+ /* Object_flags: mask of all file flags. */
(HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
| WP_TEXT),
- /* section_flags: mask of all section flags */
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
- SEC_DATA),
+ /* Section_flags: mask of all section flags. */
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY
+ | SEC_DATA),
- /* leading_symbol_char: is the first char of a user symbol
- predictable, and if so what is it */
+ /* Leading_symbol_char: is the first char of a user symbol
+ predictable, and if so what is it. */
0,
- /* ar_pad_char: pad character for filenames within an archive header
+ /* AR_pad_char: pad character for filenames within an archive header
FIXME: this really has nothing to do with NLM, this is a characteristic
- of the archiver and/or os and should be independently tunable */
+ of the archiver and/or os and should be independently tunable. */
'/',
- /* ar_max_namelen: maximum number of characters in an archive header
+ /* AR_max_namelen: maximum number of characters in an archive header
FIXME: this really has nothing to do with NLM, this is a characteristic
of the archiver and should be independently tunable. This value is
- a WAG (wild a** guess) */
+ a WAG (wild a** guess). */
15,
- /* Routines to byte-swap various sized integers from the data sections */
+ /* Routines to byte-swap various sized integers from the data sections. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16,
- /* Routines to byte-swap various sized integers from the file headers */
+ /* Routines to byte-swap various sized integers from the file headers. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16,
-
- /* bfd_check_format: check the format of a file being read */
- { _bfd_dummy_target, /* unknown format */
- nlmNAME(object_p), /* assembler/linker output (object file) */
- bfd_generic_archive_p, /* an archive */
- nlm_core_file_p /* a core file */
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16,
+
+ /* bfd_check_format: check the format of a file being read. */
+ { _bfd_dummy_target, /* Unknown format. */
+ nlmNAME(object_p), /* Assembler/linker output (object file). */
+ bfd_generic_archive_p, /* An archive. */
+ nlm_core_file_p /* A core file. */
},
- /* bfd_set_format: set the format of a file being written */
+ /* bfd_set_format: set the format of a file being written. */
{ bfd_false,
nlm_mkobject,
_bfd_generic_mkarchive,
bfd_false
},
- /* bfd_write_contents: write cached information into a file being written */
+ /* bfd_write_contents: write cached information into a file being written. */
{ bfd_false,
nlmNAME(write_object_contents),
_bfd_write_archive_contents,
bfd_false
},
- /* Initialize a jump table with the standard macro. All names start with
- "nlm" */
+ /* Initialize a jump table with the standard macro.
+ All names start with "nlm". */
BFD_JUMP_TABLE_GENERIC (_bfd_generic),
BFD_JUMP_TABLE_COPY (_bfd_generic),
BFD_JUMP_TABLE_CORE (_bfd_nocore),
@@ -251,7 +247,7 @@ const bfd_target TARGET_LITTLE_SYM =
NULL,
#endif
- /* backend_data: */
- (PTR) TARGET_BACKEND_DATA
+ /* Backend_data. */
+ (void *) TARGET_BACKEND_DATA
};
#endif
diff --git a/bfd/nlm.c b/bfd/nlm.c
index 7a0a35e..ed2614e 100644
--- a/bfd/nlm.c
+++ b/bfd/nlm.c
@@ -1,21 +1,22 @@
/* NLM (NetWare Loadable Module) executable support for BFD.
- Copyright 1993, 1994, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 2001, 2002, 2003, 2005
+ Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -26,11 +27,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
information. */
bfd_boolean
-nlm_mkobject (abfd)
- bfd * abfd;
+nlm_mkobject (bfd * abfd)
{
bfd_size_type amt = sizeof (struct nlm_obj_tdata);
- nlm_tdata (abfd) = (struct nlm_obj_tdata *) bfd_zalloc (abfd, amt);
+
+ nlm_tdata (abfd) = bfd_zalloc (abfd, amt);
if (nlm_tdata (abfd) == NULL)
return FALSE;
@@ -38,17 +39,16 @@ nlm_mkobject (abfd)
bfd_default_set_arch_mach (abfd, nlm_architecture (abfd),
nlm_machine (abfd));
- /* since everything is done at close time, do we need any initialization? */
+ /* Since everything is done at close time, do we need any initialization ? */
return TRUE;
}
/* Set the architecture and machine for an NLM object. */
bfd_boolean
-nlm_set_arch_mach (abfd, arch, machine)
- bfd * abfd;
- enum bfd_architecture arch;
- unsigned long machine;
+nlm_set_arch_mach (bfd * abfd,
+ enum bfd_architecture arch,
+ unsigned long machine)
{
bfd_default_set_arch_mach (abfd, arch, machine);
return arch == nlm_architecture (abfd);
diff --git a/bfd/nlm32-alpha.c b/bfd/nlm32-alpha.c
index 3bf597b..7a16ffc 100644
--- a/bfd/nlm32-alpha.c
+++ b/bfd/nlm32-alpha.c
@@ -1,23 +1,23 @@
/* Support for 32-bit Alpha NLM (NetWare Loadable Module)
- Copyright 1993, 1994, 2000, 2001, 2002, 2003, 2004
+ Copyright 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This file describes the 32 bit Alpha NLM format. You might think
that an Alpha chip would use a 64 bit format, but, for some reason,
@@ -33,38 +33,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define Nlm_External_Fixed_Header Nlm32_alpha_External_Fixed_Header
#include "libnlm.h"
-
-static bfd_boolean nlm_alpha_backend_object_p
- PARAMS ((bfd *));
-static bfd_boolean nlm_alpha_write_prefix
- PARAMS ((bfd *));
-static bfd_boolean nlm_alpha_read_reloc
- PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *));
-static bfd_boolean nlm_alpha_mangle_relocs
- PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type));
-static bfd_boolean nlm_alpha_read_import
- PARAMS ((bfd *, nlmNAME(symbol_type) *));
-static bfd_boolean nlm_alpha_write_import
- PARAMS ((bfd *, asection *, arelent *));
-static bfd_boolean nlm_alpha_set_public_section
- PARAMS ((bfd *, nlmNAME(symbol_type) *));
-static bfd_vma nlm_alpha_get_public_offset
- PARAMS ((bfd *, asymbol *));
-static bfd_boolean nlm_alpha_write_external
- PARAMS ((bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *));
/* Alpha NLM's have a prefix header before the standard NLM. This
function reads it in, verifies the version, and seeks the bfd to
the location before the regular NLM header. */
static bfd_boolean
-nlm_alpha_backend_object_p (abfd)
- bfd *abfd;
+nlm_alpha_backend_object_p (bfd *abfd)
{
struct nlm32_alpha_external_prefix_header s;
file_ptr size;
- if (bfd_bread ((PTR) &s, (bfd_size_type) sizeof s, abfd) != sizeof s)
+ if (bfd_bread (&s, (bfd_size_type) sizeof s, abfd) != sizeof s)
return FALSE;
if (H_GET_32 (abfd, s.magic) != NLM32_ALPHA_MAGIC)
@@ -83,8 +63,7 @@ nlm_alpha_backend_object_p (abfd)
/* Write out the prefix. */
static bfd_boolean
-nlm_alpha_write_prefix (abfd)
- bfd *abfd;
+nlm_alpha_write_prefix (bfd *abfd)
{
struct nlm32_alpha_external_prefix_header s;
@@ -92,7 +71,7 @@ nlm_alpha_write_prefix (abfd)
H_PUT_32 (abfd, NLM32_ALPHA_MAGIC, s.magic);
H_PUT_32 (abfd, 2, s.format);
H_PUT_32 (abfd, sizeof s, s.size);
- if (bfd_bwrite ((PTR) &s, (bfd_size_type) sizeof s, abfd) != sizeof s)
+ if (bfd_bwrite (&s, (bfd_size_type) sizeof s, abfd) != sizeof s)
return FALSE;
return TRUE;
}
@@ -106,83 +85,83 @@ static reloc_howto_type nlm32_alpha_howto_table[] =
/* Reloc type 0 is ignored by itself. However, it appears after a
GPDISP reloc to identify the location where the low order 16 bits
of the gp register are loaded. */
- HOWTO (ALPHA_R_IGNORE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "IGNORE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_IGNORE, /* Type. */
+ 0, /* Rightshift. */
+ 0, /* Size (0 = byte, 1 = short, 2 = long). */
+ 8, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "IGNORE", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0, /* Source mask. */
+ 0, /* Dest mask. */
+ FALSE), /* PCrel_offset. */
/* A 32 bit reference to a symbol. */
- HOWTO (ALPHA_R_REFLONG, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "REFLONG", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_REFLONG, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "REFLONG", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Source mask. */
+ 0xffffffff, /* Dest mask. */
+ FALSE), /* PCrel_offset. */
/* A 64 bit reference to a symbol. */
- HOWTO (ALPHA_R_REFQUAD, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "REFQUAD", /* name */
- TRUE, /* partial_inplace */
- ONES (64), /* src_mask */
- ONES (64), /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_REFQUAD, /* Type. */
+ 0, /* Rightshift. */
+ 4, /* Size (0 = byte, 1 = short, 2 = long). */
+ 64, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "REFQUAD", /* Name. */
+ TRUE, /* Partial_inplace. */
+ ONES (64), /* Source mask. */
+ ONES (64), /* Dest mask. */
+ FALSE), /* PCrel_offset. */
/* A 32 bit GP relative offset. This is just like REFLONG except
that when the value is used the value of the gp register will be
added in. */
- HOWTO (ALPHA_R_GPREL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "GPREL32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_GPREL32, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "GPREL32", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Source mask. */
+ 0xffffffff, /* Dest mask. */
+ FALSE), /* PCrel_offset. */
/* Used for an instruction that refers to memory off the GP
register. The offset is 16 bits of the 32 bit instruction. This
reloc always seems to be against the .lita section. */
- HOWTO (ALPHA_R_LITERAL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "LITERAL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_LITERAL, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "LITERAL", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ FALSE), /* PCrel_offset. */
/* This reloc only appears immediately following a LITERAL reloc.
It identifies a use of the literal. It seems that the linker can
@@ -193,19 +172,19 @@ static reloc_howto_type nlm32_alpha_howto_table[] =
instruction; 3 means the literal address is in the target
register of a jsr instruction. This does not actually do any
relocation. */
- HOWTO (ALPHA_R_LITUSE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "LITUSE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_LITUSE, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "LITUSE", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0, /* Source mask. */
+ 0, /* Dest mask. */
+ FALSE), /* PCrel_offset. */
/* Load the gp register. This is always used for a ldah instruction
which loads the upper 16 bits of the gp register. The next reloc
@@ -218,202 +197,201 @@ static reloc_howto_type nlm32_alpha_howto_table[] =
difference between the GP value and the current location; the
load will always be done against a register holding the current
address. */
- HOWTO (ALPHA_R_GPDISP, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "GPDISP", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- TRUE), /* pcrel_offset */
+ HOWTO (ALPHA_R_GPDISP, /* Type. */
+ 16, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ TRUE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "GPDISP", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ TRUE), /* PCrel_offset. */
/* A 21 bit branch. The native assembler generates these for
branches within the text segment, and also fills in the PC
relative offset in the instruction. It seems to me that this
reloc, unlike the others, is not partial_inplace. */
- HOWTO (ALPHA_R_BRADDR, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 21, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "BRADDR", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x1fffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_BRADDR, /* Type. */
+ 2, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 21, /* Bitsize. */
+ TRUE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "BRADDR", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0, /* Source mask. */
+ 0x1fffff, /* Dest mask. */
+ FALSE), /* PCrel_offset. */
/* A hint for a jump to a register. */
- HOWTO (ALPHA_R_HINT, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 14, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "HINT", /* name */
- TRUE, /* partial_inplace */
- 0x3fff, /* src_mask */
- 0x3fff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_HINT, /* Type. */
+ 2, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 14, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "HINT", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0x3fff, /* Source mask. */
+ 0x3fff, /* Dest mask. */
+ FALSE), /* PCrel_offset. */
/* 16 bit PC relative offset. */
- HOWTO (ALPHA_R_SREL16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "SREL16", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_SREL16, /* Type. */
+ 0, /* Rightshift. */
+ 1, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ TRUE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "SREL16", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ FALSE), /* PCrel_offset. */
/* 32 bit PC relative offset. */
- HOWTO (ALPHA_R_SREL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "SREL32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_SREL32, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ TRUE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "SREL32", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Source mask. */
+ 0xffffffff, /* Dest mask. */
+ FALSE), /* PCrel_offset. */
/* A 64 bit PC relative offset. */
- HOWTO (ALPHA_R_SREL64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "SREL64", /* name */
- TRUE, /* partial_inplace */
- ONES (64), /* src_mask */
- ONES (64), /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_SREL64, /* Type. */
+ 0, /* Rightshift. */
+ 4, /* Size (0 = byte, 1 = short, 2 = long). */
+ 64, /* Bitsize. */
+ TRUE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "SREL64", /* Name. */
+ TRUE, /* Partial_inplace. */
+ ONES (64), /* Source mask. */
+ ONES (64), /* Dest mask. */
+ FALSE), /* PCrel_offset. */
/* Push a value on the reloc evaluation stack. */
- HOWTO (ALPHA_R_OP_PUSH, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "OP_PUSH", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_OP_PUSH, /* Type. */
+ 0, /* Rightshift. */
+ 0, /* Size (0 = byte, 1 = short, 2 = long). */
+ 0, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "OP_PUSH", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0, /* Source mask. */
+ 0, /* Dest mask. */
+ FALSE), /* PCrel_offset. */
/* Store the value from the stack at the given address. Store it in
a bitfield of size r_size starting at bit position r_offset. */
- HOWTO (ALPHA_R_OP_STORE, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "OP_STORE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ONES (64), /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_OP_STORE, /* Type. */
+ 0, /* Rightshift. */
+ 4, /* Size (0 = byte, 1 = short, 2 = long). */
+ 64, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "OP_STORE", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0, /* Source mask. */
+ ONES (64), /* Dest mask. */
+ FALSE), /* PCrel_offset. */
/* Subtract the reloc address from the value on the top of the
relocation stack. */
- HOWTO (ALPHA_R_OP_PSUB, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "OP_PSUB", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_OP_PSUB, /* Type. */
+ 0, /* Rightshift. */
+ 0, /* Size (0 = byte, 1 = short, 2 = long). */
+ 0, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "OP_PSUB", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0, /* Source mask. */
+ 0, /* Dest mask. */
+ FALSE), /* PCrel_offset. */
/* Shift the value on the top of the relocation stack right by the
given value. */
- HOWTO (ALPHA_R_OP_PRSHIFT, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "OP_PRSHIFT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_OP_PRSHIFT, /* Type. */
+ 0, /* Rightshift. */
+ 0, /* Size (0 = byte, 1 = short, 2 = long). */
+ 0, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "OP_PRSHIFT", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0, /* Source mask. */
+ 0, /* Dest mask. */
+ FALSE), /* PCrel_offset. */
/* Adjust the GP value for a new range in the object file. */
- HOWTO (ALPHA_R_GPVALUE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "GPVALUE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE) /* pcrel_offset */
+ HOWTO (ALPHA_R_GPVALUE, /* Type. */
+ 0, /* Rightshift. */
+ 0, /* Size (0 = byte, 1 = short, 2 = long). */
+ 0, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "GPVALUE", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0, /* Source mask. */
+ 0, /* Dest mask. */
+ FALSE) /* PCrel_offset. */
};
static reloc_howto_type nlm32_alpha_nw_howto =
- HOWTO (ALPHA_R_NW_RELOC, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "NW_RELOC", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE); /* pcrel_offset */
+ HOWTO (ALPHA_R_NW_RELOC, /* Type. */
+ 0, /* Rightshift. */
+ 0, /* Size (0 = byte, 1 = short, 2 = long). */
+ 0, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "NW_RELOC", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0, /* Source mask. */
+ 0, /* Dest mask. */
+ FALSE); /* PCrel_offset. */
/* Read an Alpha NLM reloc. This routine keeps some static data which
it uses when handling local relocs. This only works correctly
because all the local relocs are read at once. */
static bfd_boolean
-nlm_alpha_read_reloc (abfd, sym, secp, rel)
- bfd *abfd;
- nlmNAME(symbol_type) *sym;
- asection **secp;
- arelent *rel;
+nlm_alpha_read_reloc (bfd *abfd,
+ nlmNAME (symbol_type) *sym,
+ asection **secp,
+ arelent *rel)
{
static bfd_vma gp_value;
static bfd_vma lita_address;
@@ -605,31 +583,28 @@ nlm_alpha_read_reloc (abfd, sym, secp, rel)
/* Mangle Alpha NLM relocs for output. */
static bfd_boolean
-nlm_alpha_mangle_relocs (abfd, sec, data, offset, count)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec ATTRIBUTE_UNUSED;
- const PTR data ATTRIBUTE_UNUSED;
- bfd_vma offset ATTRIBUTE_UNUSED;
- bfd_size_type count ATTRIBUTE_UNUSED;
+nlm_alpha_mangle_relocs (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED,
+ const void * data ATTRIBUTE_UNUSED,
+ bfd_vma offset ATTRIBUTE_UNUSED,
+ bfd_size_type count ATTRIBUTE_UNUSED)
{
return TRUE;
}
-/* Read an ALPHA NLM import record */
+/* Read an ALPHA NLM import record. */
static bfd_boolean
-nlm_alpha_read_import (abfd, sym)
- bfd *abfd;
- nlmNAME(symbol_type) *sym;
+nlm_alpha_read_import (bfd *abfd, nlmNAME (symbol_type) * sym)
{
- struct nlm_relent *nlm_relocs; /* relocation records for symbol */
- bfd_size_type rcount; /* number of relocs */
- bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* temporary 32-bit value */
- unsigned char symlength; /* length of symbol name */
+ struct nlm_relent *nlm_relocs; /* Relocation records for symbol. */
+ bfd_size_type rcount; /* Number of relocs. */
+ bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* Temporary 32-bit value. */
+ unsigned char symlength; /* Length of symbol name. */
char *name;
bfd_size_type amt;
- if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd)
+ if (bfd_bread (& symlength, (bfd_size_type) sizeof (symlength), abfd)
!= sizeof (symlength))
return FALSE;
sym -> symbol.the_bfd = abfd;
@@ -643,12 +618,12 @@ nlm_alpha_read_import (abfd, sym)
sym -> symbol.flags = 0;
sym -> symbol.value = 0;
sym -> symbol.section = bfd_und_section_ptr;
- if (bfd_bread ((PTR) temp, (bfd_size_type) sizeof (temp), abfd)
+ if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd)
!= sizeof (temp))
return FALSE;
rcount = H_GET_32 (abfd, temp);
amt = rcount * sizeof (struct nlm_relent);
- nlm_relocs = (struct nlm_relent *) bfd_alloc (abfd, amt);
+ nlm_relocs = bfd_alloc (abfd, amt);
if (!nlm_relocs)
return FALSE;
sym -> relocs = nlm_relocs;
@@ -670,10 +645,7 @@ nlm_alpha_read_import (abfd, sym)
/* Write an Alpha NLM reloc. */
static bfd_boolean
-nlm_alpha_write_import (abfd, sec, rel)
- bfd *abfd;
- asection *sec;
- arelent *rel;
+nlm_alpha_write_import (bfd * abfd, asection * sec, arelent * rel)
{
asymbol *sym;
bfd_vma r_vaddr;
@@ -734,7 +706,7 @@ nlm_alpha_write_import (abfd, sec, rel)
}
else
{
- /* r_type == ALPHA_R_NW_RELOC */
+ /* r_type == ALPHA_R_NW_RELOC. */
r_vaddr = rel->address;
if (rel->addend == 0)
{
@@ -781,9 +753,7 @@ nlm_alpha_write_import (abfd, sec, rel)
/* Set the section for a public symbol. */
static bfd_boolean
-nlm_alpha_set_public_section (abfd, sym)
- bfd *abfd;
- nlmNAME(symbol_type) *sym;
+nlm_alpha_set_public_section (bfd * abfd, nlmNAME (symbol_type) * sym)
{
asection *code_sec, *data_sec;
@@ -807,9 +777,7 @@ nlm_alpha_set_public_section (abfd, sym)
/* Get the offset to write out for a public symbol. */
static bfd_vma
-nlm_alpha_get_public_offset (abfd, sym)
- bfd *abfd ATTRIBUTE_UNUSED;
- asymbol *sym;
+nlm_alpha_get_public_offset (bfd * abfd ATTRIBUTE_UNUSED, asymbol * sym)
{
return bfd_asymbol_value (sym);
}
@@ -817,11 +785,10 @@ nlm_alpha_get_public_offset (abfd, sym)
/* Write an Alpha NLM external symbol. */
static bfd_boolean
-nlm_alpha_write_external (abfd, count, sym, relocs)
- bfd *abfd;
- bfd_size_type count;
- asymbol *sym;
- struct reloc_and_sec *relocs;
+nlm_alpha_write_external (bfd *abfd,
+ bfd_size_type count,
+ asymbol *sym,
+ struct reloc_and_sec *relocs)
{
bfd_size_type i;
bfd_byte len;
@@ -845,19 +812,17 @@ nlm_alpha_write_external (abfd, count, sym, relocs)
r.address = nlm_alpha_backend_data (abfd)->lita_address;
r.addend = nlm_alpha_backend_data (abfd)->lita_size + 1;
- if (! nlm_alpha_write_import (abfd, (asection *) NULL, &r))
+ if (! nlm_alpha_write_import (abfd, NULL, &r))
return FALSE;
r.address = nlm_alpha_backend_data (abfd)->gp;
r.addend = 0;
- if (! nlm_alpha_write_import (abfd, (asection *) NULL, &r))
+ if (! nlm_alpha_write_import (abfd, NULL, &r))
return FALSE;
for (i = 0; i < count; i++)
- {
- if (! nlm_alpha_write_import (abfd, relocs[i].sec, relocs[i].rel))
- return FALSE;
- }
+ if (! nlm_alpha_write_import (abfd, relocs[i].sec, relocs[i].rel))
+ return FALSE;
return TRUE;
}
@@ -871,7 +836,7 @@ static const struct nlm_backend_data nlm32_alpha_backend =
sizeof (struct nlm32_alpha_external_prefix_header),
bfd_arch_alpha,
0,
- TRUE, /* no uninitialized data permitted by Alpha NetWare. */
+ TRUE, /* No uninitialized data permitted by Alpha NetWare. */
nlm_alpha_backend_object_p,
nlm_alpha_write_prefix,
nlm_alpha_read_reloc,
@@ -883,11 +848,11 @@ static const struct nlm_backend_data nlm32_alpha_backend =
nlm_swap_fixed_header_in,
nlm_swap_fixed_header_out,
nlm_alpha_write_external,
- 0, /* write_export */
+ 0, /* Write_export. */
};
#define TARGET_LITTLE_NAME "nlm32-alpha"
-#define TARGET_LITTLE_SYM nlmNAME(alpha_vec)
-#define TARGET_BACKEND_DATA &nlm32_alpha_backend
+#define TARGET_LITTLE_SYM nlmNAME (alpha_vec)
+#define TARGET_BACKEND_DATA & nlm32_alpha_backend
#include "nlm-target.h"
diff --git a/bfd/nlm32-i386.c b/bfd/nlm32-i386.c
index d084d18..08d336f 100644
--- a/bfd/nlm32-i386.c
+++ b/bfd/nlm32-i386.c
@@ -1,22 +1,22 @@
/* Support for 32-bit i386 NLM (NetWare Loadable Module)
- Copyright 1993, 1994, 2000, 2001, 2002, 2003
+ Copyright 1993, 1994, 2000, 2001, 2002, 2003, 2005
Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -29,59 +29,47 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libnlm.h"
-static bfd_boolean nlm_i386_read_reloc
- PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *));
-static bfd_boolean nlm_i386_write_import
- PARAMS ((bfd *, asection *, arelent *));
-static bfd_boolean nlm_i386_mangle_relocs
- PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type));
-static bfd_boolean nlm_i386_read_import
- PARAMS ((bfd *, nlmNAME(symbol_type) *));
-static bfd_boolean nlm_i386_write_external
- PARAMS ((bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *));
-
/* Adjust the reloc location by an absolute value. */
static reloc_howto_type nlm_i386_abs_howto =
- HOWTO (0, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE); /* pcrel_offset */
+ HOWTO (0, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "32", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Source mask. */
+ 0xffffffff, /* Dest mask. */
+ FALSE); /* PR rel_offset. */
/* Adjust the reloc location by a PC relative displacement. */
static reloc_howto_type nlm_i386_pcrel_howto =
- HOWTO (1, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "DISP32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE); /* pcrel_offset */
+ HOWTO (1, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ TRUE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "DISP32", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Source mask. */
+ 0xffffffff, /* Dest mask. */
+ TRUE); /* PR rel_offset. */
/* Read a NetWare i386 reloc. */
static bfd_boolean
-nlm_i386_read_reloc (abfd, sym, secp, rel)
- bfd *abfd;
- nlmNAME(symbol_type) *sym;
- asection **secp;
- arelent *rel;
+nlm_i386_read_reloc (bfd *abfd,
+ nlmNAME (symbol_type) *sym,
+ asection **secp,
+ arelent *rel)
{
bfd_byte temp[4];
bfd_vma val;
@@ -152,10 +140,7 @@ nlm_i386_read_reloc (abfd, sym, secp, rel)
/* Write a NetWare i386 reloc. */
static bfd_boolean
-nlm_i386_write_import (abfd, sec, rel)
- bfd *abfd;
- asection *sec;
- arelent *rel;
+nlm_i386_write_import (bfd * abfd, asection * sec, arelent * rel)
{
asymbol *sym;
bfd_vma val;
@@ -245,12 +230,11 @@ nlm_i386_write_import (abfd, sec, rel)
general implementation. */
static bfd_boolean
-nlm_i386_mangle_relocs (abfd, sec, data, offset, count)
- bfd *abfd;
- asection *sec;
- const PTR data;
- bfd_vma offset;
- bfd_size_type count;
+nlm_i386_mangle_relocs (bfd *abfd,
+ asection *sec,
+ const PTR data,
+ bfd_vma offset,
+ bfd_size_type count)
{
arelent **rel_ptr_ptr, **rel_end;
@@ -339,19 +323,18 @@ nlm_i386_mangle_relocs (abfd, sec, data, offset, count)
return TRUE;
}
-/* Read a NetWare i386 import record */
+/* Read a NetWare i386 import record. */
+
static bfd_boolean
-nlm_i386_read_import (abfd, sym)
- bfd *abfd;
- nlmNAME(symbol_type) *sym;
+nlm_i386_read_import (bfd * abfd, nlmNAME (symbol_type) * sym)
{
- struct nlm_relent *nlm_relocs; /* relocation records for symbol */
- bfd_size_type rcount; /* number of relocs */
- bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* temporary 32-bit value */
- unsigned char symlength; /* length of symbol name */
+ struct nlm_relent *nlm_relocs; /* Relocation records for symbol. */
+ bfd_size_type rcount; /* Number of relocs. */
+ bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* Temporary 32-bit value. */
+ unsigned char symlength; /* Length of symbol name. */
char *name;
- if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd)
+ if (bfd_bread (& symlength, (bfd_size_type) sizeof (symlength), abfd)
!= sizeof (symlength))
return FALSE;
sym -> symbol.the_bfd = abfd;
@@ -365,12 +348,10 @@ nlm_i386_read_import (abfd, sym)
sym -> symbol.flags = 0;
sym -> symbol.value = 0;
sym -> symbol.section = bfd_und_section_ptr;
- if (bfd_bread ((PTR) temp, (bfd_size_type) sizeof (temp), abfd)
- != sizeof (temp))
+ if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
return FALSE;
rcount = H_GET_32 (abfd, temp);
- nlm_relocs = ((struct nlm_relent *)
- bfd_alloc (abfd, rcount * sizeof (struct nlm_relent)));
+ nlm_relocs = bfd_alloc (abfd, rcount * sizeof (struct nlm_relent));
if (!nlm_relocs)
return FALSE;
sym -> relocs = nlm_relocs;
@@ -391,11 +372,10 @@ nlm_i386_read_import (abfd, sym)
/* Write out an external reference. */
static bfd_boolean
-nlm_i386_write_external (abfd, count, sym, relocs)
- bfd *abfd;
- bfd_size_type count;
- asymbol *sym;
- struct reloc_and_sec *relocs;
+nlm_i386_write_external (bfd *abfd,
+ bfd_size_type count,
+ asymbol *sym,
+ struct reloc_and_sec *relocs)
{
unsigned int i;
bfd_byte len;
@@ -412,10 +392,8 @@ nlm_i386_write_external (abfd, count, sym, relocs)
return FALSE;
for (i = 0; i < count; i++)
- {
- if (! nlm_i386_write_import (abfd, relocs[i].sec, relocs[i].rel))
- return FALSE;
- }
+ if (! nlm_i386_write_import (abfd, relocs[i].sec, relocs[i].rel))
+ return FALSE;
return TRUE;
}
@@ -426,26 +404,26 @@ static const struct nlm_backend_data nlm32_i386_backend =
{
"NetWare Loadable Module\032",
sizeof (Nlm32_i386_External_Fixed_Header),
- 0, /* optional_prefix_size */
+ 0, /* Optional_prefix_size. */
bfd_arch_i386,
0,
FALSE,
- 0, /* backend_object_p */
- 0, /* write_prefix_func */
+ 0, /* Backend_object_p. */
+ 0, /* Write_prefix_func. */
nlm_i386_read_reloc,
nlm_i386_mangle_relocs,
nlm_i386_read_import,
nlm_i386_write_import,
- 0, /* set_public_section */
- 0, /* get_public_offset */
+ 0, /* Set_public_section. */
+ 0, /* Set_public_offset. */
nlm_swap_fixed_header_in,
nlm_swap_fixed_header_out,
nlm_i386_write_external,
- 0, /* write_export */
+ 0, /* Write_export. */
};
#define TARGET_LITTLE_NAME "nlm32-i386"
-#define TARGET_LITTLE_SYM nlmNAME(i386_vec)
-#define TARGET_BACKEND_DATA &nlm32_i386_backend
+#define TARGET_LITTLE_SYM nlmNAME (i386_vec)
+#define TARGET_BACKEND_DATA & nlm32_i386_backend
#include "nlm-target.h"
diff --git a/bfd/nlm32-ppc.c b/bfd/nlm32-ppc.c
index 0d23987..6b35249 100644
--- a/bfd/nlm32-ppc.c
+++ b/bfd/nlm32-ppc.c
@@ -1,22 +1,22 @@
/* Support for 32-bit PowerPC NLM (NetWare Loadable Module)
- Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004,
+ 2005 Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -31,37 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define Nlm_External_Fixed_Header Nlm32_powerpc_External_Fixed_Header
#include "libnlm.h"
-
-#ifdef OLDFORMAT
-static bfd_boolean nlm_powerpc_backend_object_p
- PARAMS ((bfd *));
-static bfd_boolean nlm_powerpc_write_prefix
- PARAMS ((bfd *));
-#endif
-
-static bfd_boolean nlm_powerpc_read_reloc
- PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *));
-static bfd_boolean nlm_powerpc_mangle_relocs
- PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type));
-static bfd_boolean nlm_powerpc_read_import
- PARAMS ((bfd *, nlmNAME(symbol_type) *));
-
-#ifdef OLDFORMAT
-static bfd_boolean nlm_powerpc_write_reloc
- PARAMS ((bfd *, asection *, arelent *, int));
-#endif
-
-static bfd_boolean nlm_powerpc_write_import
- PARAMS ((bfd *, asection *, arelent *));
-static bfd_boolean nlm_powerpc_write_external
- PARAMS ((bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *));
-
-#ifndef OLDFORMAT
-static bfd_boolean nlm_powerpc_set_public_section
- PARAMS ((bfd *, nlmNAME(symbol_type) *));
-static bfd_vma nlm_powerpc_get_public_offset
- PARAMS ((bfd *, asymbol *));
-#endif
#ifdef OLDFORMAT
@@ -72,12 +41,11 @@ static bfd_vma nlm_powerpc_get_public_offset
the location before the regular NLM header. */
static bfd_boolean
-nlm_powerpc_backend_object_p (abfd)
- bfd *abfd;
+nlm_powerpc_backend_object_p (bfd *abfd)
{
struct nlm32_powerpc_external_prefix_header s;
- if (bfd_bread ((PTR) &s, (bfd_size_type) sizeof s, abfd) != sizeof s)
+ if (bfd_bread (& s, (bfd_size_type) sizeof s, abfd) != sizeof s)
return FALSE;
if (memcmp (s.signature, NLM32_POWERPC_SIGNATURE, sizeof s.signature) != 0
@@ -90,8 +58,7 @@ nlm_powerpc_backend_object_p (abfd)
/* Write out the prefix. */
static bfd_boolean
-nlm_powerpc_write_prefix (abfd)
- bfd *abfd;
+nlm_powerpc_write_prefix (bfd *abfd)
{
struct nlm32_powerpc_external_prefix_header s;
@@ -102,97 +69,12 @@ nlm_powerpc_write_prefix (abfd)
/* FIXME: What should we do about the date? */
- if (bfd_bwrite ((PTR) &s, (bfd_size_type) sizeof s, abfd) != sizeof s)
- return FALSE;
-
- return TRUE;
-}
-
-#endif /* OLDFORMAT */
-
-#ifndef OLDFORMAT
-
-/* There is only one type of reloc in a PowerPC NLM. */
-
-static reloc_howto_type nlm_powerpc_howto =
- HOWTO (0, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-/* Read a PowerPC NLM reloc. */
-
-static bfd_boolean
-nlm_powerpc_read_reloc (abfd, sym, secp, rel)
- bfd *abfd;
- nlmNAME(symbol_type) *sym;
- asection **secp;
- arelent *rel;
-{
- bfd_byte temp[4];
- bfd_vma val;
- const char *name;
-
- if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
+ if (bfd_bwrite (& s, (bfd_size_type) sizeof s, abfd) != sizeof s)
return FALSE;
- val = bfd_get_32 (abfd, temp);
-
- /* The value is a word offset into either the code or data segment.
- This is the location which needs to be adjusted.
-
- The high bit is 0 if the value is an offset into the data
- segment, or 1 if the value is an offset into the text segment.
-
- If this is a relocation fixup rather than an imported symbol (the
- sym argument is NULL), then the second most significant bit is 0
- if the address of the data segment should be added to the
- location addressed by the value, or 1 if the address of the text
- segment should be added.
-
- If this is an imported symbol, the second most significant bit is
- not used and must be 0. */
-
- if ((val & NLM_HIBIT) == 0)
- name = NLM_INITIALIZED_DATA_NAME;
- else
- {
- name = NLM_CODE_NAME;
- val &=~ NLM_HIBIT;
- }
- *secp = bfd_get_section_by_name (abfd, name);
-
- if (sym == NULL)
- {
- if ((val & (NLM_HIBIT >> 1)) == 0)
- name = NLM_INITIALIZED_DATA_NAME;
- else
- {
- name = NLM_CODE_NAME;
- val &=~ (NLM_HIBIT >> 1);
- }
- rel->sym_ptr_ptr = bfd_get_section_by_name (abfd, name)->symbol_ptr_ptr;
- }
-
- rel->howto = &nlm_powerpc_howto;
-
- rel->address = val << 2;
- rel->addend = 0;
-
return TRUE;
}
-#else /* OLDFORMAT */
-
/* This reloc handling is only applicable to the old format. */
/* How to process the various reloc types. PowerPC NLMs use XCOFF
@@ -201,345 +83,345 @@ nlm_powerpc_read_reloc (abfd, sym, secp, rel)
static reloc_howto_type nlm_powerpc_howto_table[] =
{
/* Standard 32 bit relocation. */
- HOWTO (0, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_POS", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (0, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_POS", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Source mask. */
+ 0xffffffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* 32 bit relocation, but store negative value. */
- HOWTO (1, /* type */
- 0, /* rightshift */
- -2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_NEG", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (1, /* Type. */
+ 0, /* Rightshift. */
+ -2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_NEG", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Source mask. */
+ 0xffffffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* 32 bit PC relative relocation. */
- HOWTO (2, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_REL", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (2, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ TRUE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_REL", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Source mask. */
+ 0xffffffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* 16 bit TOC relative relocation. */
- HOWTO (3, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_TOC", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (3, /* Type. */
+ 0, /* Rightshift. */
+ 1, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_TOC", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* I don't really know what this is. */
- HOWTO (4, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RTB", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (4, /* Type. */
+ 1, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_RTB", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Source mask. */
+ 0xffffffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* External TOC relative symbol. */
- HOWTO (5, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_GL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (5, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_GL", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* Local TOC relative symbol. */
- HOWTO (6, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TCL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (6, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_TCL", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
{ 7 },
/* Non modifiable absolute branch. */
- HOWTO (8, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_BA", /* name */
- TRUE, /* partial_inplace */
- 0x3fffffc, /* src_mask */
- 0x3fffffc, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (8, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 26, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_BA", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0x3fffffc, /* Source mask. */
+ 0x3fffffc, /* Dest mask. */
+ FALSE), /* PC rel offset. */
{ 9 },
/* Non modifiable relative branch. */
- HOWTO (0xa, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_BR", /* name */
- TRUE, /* partial_inplace */
- 0x3fffffc, /* src_mask */
- 0x3fffffc, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (0xa, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 26, /* Bitsize. */
+ TRUE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_BR", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0x3fffffc, /* Source mask. */
+ 0x3fffffc, /* Dest mask. */
+ FALSE), /* PC rel offset. */
{ 0xb },
/* Indirect load. */
- HOWTO (0xc, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (0xc, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_RL", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* Load address. */
- HOWTO (0xd, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RLA", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (0xd, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_RLA", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
{ 0xe },
/* Non-relocating reference. */
- HOWTO (0xf, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_REF", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (0xf, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_REF", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0, /* Source mask. */
+ 0, /* Dest mask. */
+ FALSE), /* PC rel offset. */
{ 0x10 },
{ 0x11 },
/* TOC relative indirect load. */
- HOWTO (0x12, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TRL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (0x12, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_TRL", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* TOC relative load address. */
- HOWTO (0x13, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TRLA", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (0x13, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_TRLA", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* Modifiable relative branch. */
- HOWTO (0x14, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RRTBI", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (0x14, /* Type. */
+ 1, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_RRTBI", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Source mask. */
+ 0xffffffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* Modifiable absolute branch. */
- HOWTO (0x15, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RRTBA", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (0x15, /* Type. */
+ 1, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_RRTBA", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Source mask. */
+ 0xffffffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* Modifiable call absolute indirect. */
- HOWTO (0x16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_CAI", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (0x16, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_CAI", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* Modifiable call relative. */
- HOWTO (0x17, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_REL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (0x17, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_REL", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* Modifiable branch absolute. */
- HOWTO (0x18, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBA", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (0x18, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_RBA", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* Modifiable branch absolute. */
- HOWTO (0x19, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBAC", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (0x19, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_RBAC", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* Modifiable branch relative. */
- HOWTO (0x1a, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_REL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (0x1a, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 26, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_REL", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* Modifiable branch absolute. */
- HOWTO (0x1b, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_REL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE) /* pcrel_offset */
+ HOWTO (0x1b, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "R_REL", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ FALSE) /* PC rel offset. */
};
#define HOWTO_COUNT (sizeof nlm_powerpc_howto_table \
@@ -548,11 +430,10 @@ static reloc_howto_type nlm_powerpc_howto_table[] =
/* Read a PowerPC NLM reloc. */
static bfd_boolean
-nlm_powerpc_read_reloc (abfd, sym, secp, rel)
- bfd *abfd;
- nlmNAME(symbol_type) *sym;
- asection **secp;
- arelent *rel;
+nlm_powerpc_read_reloc (bfd *abfd,
+ nlmNAME (symbol_type) *sym,
+ asection **secp,
+ arelent *rel)
{
struct nlm32_powerpc_external_reloc ext;
bfd_vma l_vaddr;
@@ -578,11 +459,9 @@ nlm_powerpc_read_reloc (abfd, sym, secp, rel)
/* Work out the arelent fields. */
if (sym != NULL)
- {
- /* This is an import. sym_ptr_ptr is filled in by
- nlm_canonicalize_reloc. */
- rel->sym_ptr_ptr = NULL;
- }
+ /* This is an import. sym_ptr_ptr is filled in by
+ nlm_canonicalize_reloc. */
+ rel->sym_ptr_ptr = NULL;
else
{
asection *sec;
@@ -634,17 +513,95 @@ nlm_powerpc_read_reloc (abfd, sym, secp, rel)
return TRUE;
}
-#endif /* OLDFORMAT */
+#else /* not OLDFORMAT */
+
+/* There is only one type of reloc in a PowerPC NLM. */
+
+static reloc_howto_type nlm_powerpc_howto =
+ HOWTO (0, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "32", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Source mask. */
+ 0xffffffff, /* Dest mask. */
+ FALSE); /* PC rel_offset. */
+
+/* Read a PowerPC NLM reloc. */
+
+static bfd_boolean
+nlm_powerpc_read_reloc (bfd *abfd,
+ nlmNAME (symbol_type) *sym,
+ asection **secp,
+ arelent *rel)
+{
+ bfd_byte temp[4];
+ bfd_vma val;
+ const char *name;
+
+ if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
+ return FALSE;
+
+ val = bfd_get_32 (abfd, temp);
+
+ /* The value is a word offset into either the code or data segment.
+ This is the location which needs to be adjusted.
+
+ The high bit is 0 if the value is an offset into the data
+ segment, or 1 if the value is an offset into the text segment.
+
+ If this is a relocation fixup rather than an imported symbol (the
+ sym argument is NULL), then the second most significant bit is 0
+ if the address of the data segment should be added to the
+ location addressed by the value, or 1 if the address of the text
+ segment should be added.
+
+ If this is an imported symbol, the second most significant bit is
+ not used and must be 0. */
+
+ if ((val & NLM_HIBIT) == 0)
+ name = NLM_INITIALIZED_DATA_NAME;
+ else
+ {
+ name = NLM_CODE_NAME;
+ val &=~ NLM_HIBIT;
+ }
+ *secp = bfd_get_section_by_name (abfd, name);
+
+ if (sym == NULL)
+ {
+ if ((val & (NLM_HIBIT >> 1)) == 0)
+ name = NLM_INITIALIZED_DATA_NAME;
+ else
+ {
+ name = NLM_CODE_NAME;
+ val &=~ (NLM_HIBIT >> 1);
+ }
+ rel->sym_ptr_ptr = bfd_get_section_by_name (abfd, name)->symbol_ptr_ptr;
+ }
+
+ rel->howto = & nlm_powerpc_howto;
+ rel->address = val << 2;
+ rel->addend = 0;
+
+ return TRUE;
+}
+
+#endif /* not OLDFORMAT */
/* Mangle PowerPC NLM relocs for output. */
static bfd_boolean
-nlm_powerpc_mangle_relocs (abfd, sec, data, offset, count)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec ATTRIBUTE_UNUSED;
- const PTR data ATTRIBUTE_UNUSED;
- bfd_vma offset ATTRIBUTE_UNUSED;
- bfd_size_type count ATTRIBUTE_UNUSED;
+nlm_powerpc_mangle_relocs (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED,
+ const void * data ATTRIBUTE_UNUSED,
+ bfd_vma offset ATTRIBUTE_UNUSED,
+ bfd_size_type count ATTRIBUTE_UNUSED)
{
return TRUE;
}
@@ -652,17 +609,15 @@ nlm_powerpc_mangle_relocs (abfd, sec, data, offset, count)
/* Read a PowerPC NLM import record */
static bfd_boolean
-nlm_powerpc_read_import (abfd, sym)
- bfd *abfd;
- nlmNAME(symbol_type) *sym;
+nlm_powerpc_read_import (bfd * abfd, nlmNAME (symbol_type) * sym)
{
- struct nlm_relent *nlm_relocs; /* relocation records for symbol */
- bfd_size_type rcount; /* number of relocs */
- bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* temporary 32-bit value */
- unsigned char symlength; /* length of symbol name */
+ struct nlm_relent *nlm_relocs; /* Relocation records for symbol. */
+ bfd_size_type rcount; /* Number of relocs. */
+ bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* Temporary 32-bit value. */
+ unsigned char symlength; /* Length of symbol name. */
char *name;
- if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd)
+ if (bfd_bread (& symlength, (bfd_size_type) sizeof (symlength), abfd)
!= sizeof (symlength))
return FALSE;
sym -> symbol.the_bfd = abfd;
@@ -676,13 +631,12 @@ nlm_powerpc_read_import (abfd, sym)
sym -> symbol.flags = 0;
sym -> symbol.value = 0;
sym -> symbol.section = bfd_und_section_ptr;
- if (bfd_bread ((PTR) temp, (bfd_size_type) sizeof (temp), abfd)
+ if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd)
!= sizeof (temp))
return FALSE;
rcount = H_GET_32 (abfd, temp);
- nlm_relocs = ((struct nlm_relent *)
- bfd_alloc (abfd, rcount * sizeof (struct nlm_relent)));
- if (nlm_relocs == (struct nlm_relent *) NULL)
+ nlm_relocs = bfd_alloc (abfd, rcount * sizeof (struct nlm_relent));
+ if (nlm_relocs == NULL)
return FALSE;
sym -> relocs = nlm_relocs;
sym -> rcnt = 0;
@@ -704,10 +658,7 @@ nlm_powerpc_read_import (abfd, sym)
/* Write a PowerPC NLM reloc. */
static bfd_boolean
-nlm_powerpc_write_import (abfd, sec, rel)
- bfd *abfd;
- asection *sec;
- arelent *rel;
+nlm_powerpc_write_import (bfd * abfd, asection * sec, arelent * rel)
{
asymbol *sym;
bfd_vma val;
@@ -775,11 +726,10 @@ nlm_powerpc_write_import (abfd, sec, rel)
/* Write a PowerPC NLM reloc. */
static bfd_boolean
-nlm_powerpc_write_reloc (abfd, sec, rel, indx)
- bfd *abfd;
- asection *sec;
- arelent *rel;
- int indx;
+nlm_powerpc_write_reloc (bfd *abfd,
+ asection *sec,
+ arelent *rel,
+ int indx)
{
struct nlm32_powerpc_external_reloc ext;
asection *code_sec, *data_sec, *bss_sec;
@@ -878,10 +828,7 @@ nlm_powerpc_write_reloc (abfd, sec, rel, indx)
/* Write a PowerPC NLM import. */
static bfd_boolean
-nlm_powerpc_write_import (abfd, sec, rel)
- bfd *abfd;
- asection *sec;
- arelent *rel;
+nlm_powerpc_write_import (bfd * abfd, asection * sec, arelent * rel)
{
return nlm_powerpc_write_reloc (abfd, sec, rel, -1);
}
@@ -893,11 +840,10 @@ nlm_powerpc_write_import (abfd, sec, rel)
necessary, and the index never gets reset. */
static bfd_boolean
-nlm_powerpc_write_external (abfd, count, sym, relocs)
- bfd *abfd;
- bfd_size_type count;
- asymbol *sym;
- struct reloc_and_sec *relocs;
+nlm_powerpc_write_external (bfd *abfd,
+ bfd_size_type count,
+ asymbol *sym,
+ struct reloc_and_sec *relocs)
{
unsigned int i;
bfd_byte len;
@@ -943,9 +889,7 @@ nlm_powerpc_write_external (abfd, count, sym, relocs)
/* Set the section for a public symbol. */
static bfd_boolean
-nlm_powerpc_set_public_section (abfd, sym)
- bfd *abfd;
- nlmNAME(symbol_type) *sym;
+nlm_powerpc_set_public_section (bfd *abfd, nlmNAME (symbol_type) *sym)
{
if (sym->symbol.value & NLM_HIBIT)
{
@@ -955,10 +899,8 @@ nlm_powerpc_set_public_section (abfd, sym)
bfd_get_section_by_name (abfd, NLM_CODE_NAME);
}
else
- {
- sym->symbol.section =
- bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
- }
+ sym->symbol.section =
+ bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
sym->symbol.value <<= 2;
@@ -968,9 +910,7 @@ nlm_powerpc_set_public_section (abfd, sym)
/* Get the offset to write out for a public symbol. */
static bfd_vma
-nlm_powerpc_get_public_offset (abfd, sym)
- bfd *abfd;
- asymbol *sym;
+nlm_powerpc_get_public_offset (bfd *abfd, asymbol *sym)
{
bfd_vma offset;
asection *sec;
@@ -1008,7 +948,7 @@ static const struct nlm_backend_data nlm32_powerpc_backend =
"NetWare PowerPC Module \032",
sizeof (Nlm32_powerpc_External_Fixed_Header),
#ifndef OLDFORMAT
- 0, /* optional_prefix_size */
+ 0, /* Optional_prefix_size. */
#else
sizeof (struct nlm32_powerpc_external_prefix_header),
#endif
@@ -1016,8 +956,8 @@ static const struct nlm_backend_data nlm32_powerpc_backend =
0,
FALSE,
#ifndef OLDFORMAT
- 0, /* backend_object_p */
- 0, /* write_prefix */
+ 0, /* Backend_object_p. */
+ 0, /* Write_prefix. */
#else
nlm_powerpc_backend_object_p,
nlm_powerpc_write_prefix,
@@ -1030,17 +970,17 @@ static const struct nlm_backend_data nlm32_powerpc_backend =
nlm_powerpc_set_public_section,
nlm_powerpc_get_public_offset,
#else
- 0, /* set_public_section */
- 0, /* get_public_offset */
+ 0, /* Set_public_section. */
+ 0, /* Get_public_offset. */
#endif
nlm_swap_fixed_header_in,
nlm_swap_fixed_header_out,
nlm_powerpc_write_external,
- 0, /* write_export */
+ 0, /* Write_export. */
};
#define TARGET_BIG_NAME "nlm32-powerpc"
-#define TARGET_BIG_SYM nlmNAME(powerpc_vec)
-#define TARGET_BACKEND_DATA &nlm32_powerpc_backend
+#define TARGET_BIG_SYM nlmNAME (powerpc_vec)
+#define TARGET_BACKEND_DATA & nlm32_powerpc_backend
#include "nlm-target.h"
diff --git a/bfd/nlm32-sparc.c b/bfd/nlm32-sparc.c
index 4876176..8d4c54e 100644
--- a/bfd/nlm32-sparc.c
+++ b/bfd/nlm32-sparc.c
@@ -29,83 +29,67 @@
#include "libnlm.h"
-static bfd_boolean nlm_sparc_read_reloc
- PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *));
-static bfd_boolean nlm_sparc_write_reloc
- PARAMS ((bfd *, asection *, arelent *));
-static bfd_boolean nlm_sparc_mangle_relocs
- PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type));
-static bfd_boolean nlm_sparc_read_import
- PARAMS ((bfd *, nlmNAME(symbol_type) *));
-static bfd_boolean nlm_sparc_write_import
- PARAMS ((bfd *, asection *, arelent *));
-static bfd_boolean nlm_sparc_write_external
- PARAMS ((bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *));
-static bfd_boolean nlm_sparc_write_export
- PARAMS ((bfd *, asymbol *, bfd_vma));
-
enum reloc_type
- {
- R_SPARC_NONE = 0,
- R_SPARC_8, R_SPARC_16, R_SPARC_32,
- R_SPARC_DISP8, R_SPARC_DISP16, R_SPARC_DISP32,
- R_SPARC_WDISP30, R_SPARC_WDISP22,
- R_SPARC_HI22, R_SPARC_22,
- R_SPARC_13, R_SPARC_LO10,
- R_SPARC_GOT10, R_SPARC_GOT13, R_SPARC_GOT22,
- R_SPARC_PC10, R_SPARC_PC22,
- R_SPARC_WPLT30,
- R_SPARC_COPY,
- R_SPARC_GLOB_DAT, R_SPARC_JMP_SLOT,
- R_SPARC_RELATIVE,
- R_SPARC_UA32,
- R_SPARC_max
- };
+{
+ R_SPARC_NONE = 0,
+ R_SPARC_8, R_SPARC_16, R_SPARC_32,
+ R_SPARC_DISP8, R_SPARC_DISP16, R_SPARC_DISP32,
+ R_SPARC_WDISP30, R_SPARC_WDISP22,
+ R_SPARC_HI22, R_SPARC_22,
+ R_SPARC_13, R_SPARC_LO10,
+ R_SPARC_GOT10, R_SPARC_GOT13, R_SPARC_GOT22,
+ R_SPARC_PC10, R_SPARC_PC22,
+ R_SPARC_WPLT30,
+ R_SPARC_COPY,
+ R_SPARC_GLOB_DAT, R_SPARC_JMP_SLOT,
+ R_SPARC_RELATIVE,
+ R_SPARC_UA32,
+ R_SPARC_max
+};
static reloc_howto_type nlm32_sparc_howto_table[] =
- {
- HOWTO (R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, 0,"R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
- HOWTO (R_SPARC_8, 0,0, 8,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_8", FALSE,0,0x000000ff,TRUE),
- HOWTO (R_SPARC_16, 0,1,16,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_16", FALSE,0,0x0000ffff,TRUE),
- HOWTO (R_SPARC_32, 0,2,32,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_32", FALSE,0,0xffffffff,TRUE),
- HOWTO (R_SPARC_DISP8, 0,0, 8,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_DISP8", FALSE,0,0x000000ff,TRUE),
- HOWTO (R_SPARC_DISP16, 0,1,16,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_DISP16", FALSE,0,0x0000ffff,TRUE),
- HOWTO (R_SPARC_DISP32, 0,2,32,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_DISP32", FALSE,0,0x00ffffff,TRUE),
- HOWTO (R_SPARC_WDISP30, 2,2,30,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_WDISP30", FALSE,0,0x3fffffff,TRUE),
- HOWTO (R_SPARC_WDISP22, 2,2,22,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_WDISP22", FALSE,0,0x003fffff,TRUE),
- HOWTO (R_SPARC_HI22, 10,2,22,FALSE,0,complain_overflow_dont, 0,"R_SPARC_HI22", FALSE,0,0x003fffff,TRUE),
- HOWTO (R_SPARC_22, 0,2,22,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_22", FALSE,0,0x003fffff,TRUE),
- HOWTO (R_SPARC_13, 0,2,13,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_13", FALSE,0,0x00001fff,TRUE),
- HOWTO (R_SPARC_LO10, 0,2,10,FALSE,0,complain_overflow_dont, 0,"R_SPARC_LO10", FALSE,0,0x000003ff,TRUE),
- HOWTO (R_SPARC_GOT10, 0,2,10,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_GOT10", FALSE,0,0x000003ff,TRUE),
- HOWTO (R_SPARC_GOT13, 0,2,13,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_GOT13", FALSE,0,0x00001fff,TRUE),
- HOWTO (R_SPARC_GOT22, 10,2,22,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_GOT22", FALSE,0,0x003fffff,TRUE),
- HOWTO (R_SPARC_PC10, 0,2,10,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_PC10", FALSE,0,0x000003ff,TRUE),
- HOWTO (R_SPARC_PC22, 0,2,22,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_PC22", FALSE,0,0x003fffff,TRUE),
- HOWTO (R_SPARC_WPLT30, 0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_WPLT30", FALSE,0,0x00000000,TRUE),
- HOWTO (R_SPARC_COPY, 0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_COPY", FALSE,0,0x00000000,TRUE),
- HOWTO (R_SPARC_GLOB_DAT,0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_GLOB_DAT",FALSE,0,0x00000000,TRUE),
- HOWTO (R_SPARC_JMP_SLOT,0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_JMP_SLOT",FALSE,0,0x00000000,TRUE),
- HOWTO (R_SPARC_RELATIVE,0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_RELATIVE",FALSE,0,0x00000000,TRUE),
- HOWTO (R_SPARC_UA32, 0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_UA32", FALSE,0,0x00000000,TRUE),
+{
+ HOWTO (R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, 0,"R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
+ HOWTO (R_SPARC_8, 0,0, 8,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_8", FALSE,0,0x000000ff,TRUE),
+ HOWTO (R_SPARC_16, 0,1,16,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_16", FALSE,0,0x0000ffff,TRUE),
+ HOWTO (R_SPARC_32, 0,2,32,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_32", FALSE,0,0xffffffff,TRUE),
+ HOWTO (R_SPARC_DISP8, 0,0, 8,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_DISP8", FALSE,0,0x000000ff,TRUE),
+ HOWTO (R_SPARC_DISP16, 0,1,16,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_DISP16", FALSE,0,0x0000ffff,TRUE),
+ HOWTO (R_SPARC_DISP32, 0,2,32,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_DISP32", FALSE,0,0x00ffffff,TRUE),
+ HOWTO (R_SPARC_WDISP30, 2,2,30,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_WDISP30", FALSE,0,0x3fffffff,TRUE),
+ HOWTO (R_SPARC_WDISP22, 2,2,22,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_WDISP22", FALSE,0,0x003fffff,TRUE),
+ HOWTO (R_SPARC_HI22, 10,2,22,FALSE,0,complain_overflow_dont, 0,"R_SPARC_HI22", FALSE,0,0x003fffff,TRUE),
+ HOWTO (R_SPARC_22, 0,2,22,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_22", FALSE,0,0x003fffff,TRUE),
+ HOWTO (R_SPARC_13, 0,2,13,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_13", FALSE,0,0x00001fff,TRUE),
+ HOWTO (R_SPARC_LO10, 0,2,10,FALSE,0,complain_overflow_dont, 0,"R_SPARC_LO10", FALSE,0,0x000003ff,TRUE),
+ HOWTO (R_SPARC_GOT10, 0,2,10,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_GOT10", FALSE,0,0x000003ff,TRUE),
+ HOWTO (R_SPARC_GOT13, 0,2,13,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_GOT13", FALSE,0,0x00001fff,TRUE),
+ HOWTO (R_SPARC_GOT22, 10,2,22,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_GOT22", FALSE,0,0x003fffff,TRUE),
+ HOWTO (R_SPARC_PC10, 0,2,10,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_PC10", FALSE,0,0x000003ff,TRUE),
+ HOWTO (R_SPARC_PC22, 0,2,22,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_PC22", FALSE,0,0x003fffff,TRUE),
+ HOWTO (R_SPARC_WPLT30, 0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_WPLT30", FALSE,0,0x00000000,TRUE),
+ HOWTO (R_SPARC_COPY, 0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_COPY", FALSE,0,0x00000000,TRUE),
+ HOWTO (R_SPARC_GLOB_DAT,0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_GLOB_DAT",FALSE,0,0x00000000,TRUE),
+ HOWTO (R_SPARC_JMP_SLOT,0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_JMP_SLOT",FALSE,0,0x00000000,TRUE),
+ HOWTO (R_SPARC_RELATIVE,0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_RELATIVE",FALSE,0,0x00000000,TRUE),
+ HOWTO (R_SPARC_UA32, 0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_UA32", FALSE,0,0x00000000,TRUE),
};
/* Read a NetWare sparc reloc. */
struct nlm32_sparc_reloc_ext
- {
- unsigned char offset[4];
- unsigned char addend[4];
- unsigned char type[1];
- unsigned char pad1[3];
- };
+{
+ unsigned char offset[4];
+ unsigned char addend[4];
+ unsigned char type[1];
+ unsigned char pad1[3];
+};
static bfd_boolean
-nlm_sparc_read_reloc (abfd, sym, secp, rel)
- bfd *abfd;
- nlmNAME(symbol_type) *sym ATTRIBUTE_UNUSED;
- asection **secp;
- arelent *rel;
+nlm_sparc_read_reloc (bfd *abfd,
+ nlmNAME (symbol_type) *sym ATTRIBUTE_UNUSED,
+ asection **secp,
+ arelent *rel)
{
bfd_vma val, addend;
unsigned int index;
@@ -149,10 +133,7 @@ nlm_sparc_read_reloc (abfd, sym, secp, rel)
/* Write a NetWare sparc reloc. */
static bfd_boolean
-nlm_sparc_write_reloc (abfd, sec, rel)
- bfd *abfd;
- asection *sec;
- arelent *rel;
+nlm_sparc_write_reloc (bfd * abfd, asection * sec, arelent * rel)
{
bfd_vma val;
struct nlm32_sparc_reloc_ext tmp_reloc;
@@ -212,12 +193,11 @@ nlm_sparc_write_reloc (abfd, sec, rel)
SPARC relocs. */
static bfd_boolean
-nlm_sparc_mangle_relocs (abfd, sec, data, offset, count)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec ATTRIBUTE_UNUSED;
- const PTR data ATTRIBUTE_UNUSED;
- bfd_vma offset ATTRIBUTE_UNUSED;
- bfd_size_type count ATTRIBUTE_UNUSED;
+nlm_sparc_mangle_relocs (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED,
+ const void * data ATTRIBUTE_UNUSED,
+ bfd_vma offset ATTRIBUTE_UNUSED,
+ bfd_size_type count ATTRIBUTE_UNUSED)
{
return TRUE;
}
@@ -225,9 +205,7 @@ nlm_sparc_mangle_relocs (abfd, sec, data, offset, count)
/* Read a NetWare sparc import record. */
static bfd_boolean
-nlm_sparc_read_import (abfd, sym)
- bfd *abfd;
- nlmNAME(symbol_type) *sym;
+nlm_sparc_read_import (bfd *abfd, nlmNAME (symbol_type) *sym)
{
struct nlm_relent *nlm_relocs; /* Relocation records for symbol. */
bfd_size_type rcount; /* Number of relocs. */
@@ -237,14 +215,13 @@ nlm_sparc_read_import (abfd, sym)
/* First, read in the number of relocation
entries for this symbol. */
- if (bfd_bread ((PTR) temp, (bfd_size_type) 4, abfd) != 4)
+ if (bfd_bread (temp, (bfd_size_type) 4, abfd) != 4)
return FALSE;
rcount = bfd_get_32 (abfd, temp);
/* Next, read in the length of the symbol. */
-
- if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd)
+ if (bfd_bread (& symlength, (bfd_size_type) sizeof (symlength), abfd)
!= sizeof (symlength))
return FALSE;
sym -> symbol.the_bfd = abfd;
@@ -253,7 +230,6 @@ nlm_sparc_read_import (abfd, sym)
return FALSE;
/* Then read in the symbol. */
-
if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength)
return FALSE;
name[symlength] = '\0';
@@ -263,9 +239,7 @@ nlm_sparc_read_import (abfd, sym)
sym -> symbol.section = bfd_und_section_ptr;
/* Next, start reading in the relocs. */
-
- nlm_relocs = ((struct nlm_relent *)
- bfd_alloc (abfd, rcount * sizeof (struct nlm_relent)));
+ nlm_relocs = bfd_alloc (abfd, rcount * sizeof (struct nlm_relent));
if (!nlm_relocs)
return FALSE;
sym -> relocs = nlm_relocs;
@@ -285,10 +259,7 @@ nlm_sparc_read_import (abfd, sym)
}
static bfd_boolean
-nlm_sparc_write_import (abfd, sec, rel)
- bfd *abfd;
- asection *sec;
- arelent *rel;
+nlm_sparc_write_import (bfd * abfd, asection * sec, arelent * rel)
{
char temp[4];
asection *code, *data, *bss, *symsec;
@@ -313,10 +284,10 @@ nlm_sparc_write_import (abfd, sec, rel)
__FUNCTION__, base + (*rel->sym_ptr_ptr)->value);
#endif
bfd_put_32 (abfd, base + (*rel->sym_ptr_ptr)->value, temp);
- if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4)
+ if (bfd_bwrite (temp, (bfd_size_type) 4, abfd) != 4)
return FALSE;
bfd_put_32 (abfd, (bfd_vma) 1, temp);
- if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4)
+ if (bfd_bwrite (temp, (bfd_size_type) 4, abfd) != 4)
return FALSE;
if (! nlm_sparc_write_reloc (abfd, sec, rel))
return FALSE;
@@ -326,11 +297,10 @@ nlm_sparc_write_import (abfd, sec, rel)
/* Write out an external reference. */
static bfd_boolean
-nlm_sparc_write_external (abfd, count, sym, relocs)
- bfd *abfd;
- bfd_size_type count;
- asymbol *sym;
- struct reloc_and_sec *relocs;
+nlm_sparc_write_external (bfd *abfd,
+ bfd_size_type count,
+ asymbol *sym,
+ struct reloc_and_sec *relocs)
{
unsigned int i;
bfd_byte len;
@@ -347,19 +317,14 @@ nlm_sparc_write_external (abfd, count, sym, relocs)
return FALSE;
for (i = 0; i < count; i++)
- {
- if (! nlm_sparc_write_reloc (abfd, relocs[i].sec, relocs[i].rel))
- return FALSE;
- }
+ if (! nlm_sparc_write_reloc (abfd, relocs[i].sec, relocs[i].rel))
+ return FALSE;
return TRUE;
}
static bfd_boolean
-nlm_sparc_write_export (abfd, sym, value)
- bfd *abfd;
- asymbol *sym;
- bfd_vma value;
+nlm_sparc_write_export (bfd * abfd, asymbol * sym, bfd_vma value)
{
bfd_byte len;
bfd_byte temp[4];
@@ -385,29 +350,29 @@ nlm_sparc_write_export (abfd, sym, value)
#include "nlmswap.h"
static const struct nlm_backend_data nlm32_sparc_backend =
- {
- "NetWare SPARC Module \032",
- sizeof (Nlm32_sparc_External_Fixed_Header),
- 0, /* optional_prefix_size */
- bfd_arch_sparc,
- 0,
- FALSE,
- 0, /* backend_object_p */
- 0, /* write_prefix_func */
- nlm_sparc_read_reloc,
- nlm_sparc_mangle_relocs,
- nlm_sparc_read_import,
- nlm_sparc_write_import,
- 0, /* set_public_section */
- 0, /* get_public_offset */
- nlm_swap_fixed_header_in,
- nlm_swap_fixed_header_out,
- nlm_sparc_write_external,
- nlm_sparc_write_export
- };
+{
+ "NetWare SPARC Module \032",
+ sizeof (Nlm32_sparc_External_Fixed_Header),
+ 0, /* Optional_prefix_size. */
+ bfd_arch_sparc,
+ 0,
+ FALSE,
+ 0, /* Backend_object_p. */
+ 0, /* Write_prefix_func. */
+ nlm_sparc_read_reloc,
+ nlm_sparc_mangle_relocs,
+ nlm_sparc_read_import,
+ nlm_sparc_write_import,
+ 0, /* Set_public_section. */
+ 0, /* Get_public_offset. */
+ nlm_swap_fixed_header_in,
+ nlm_swap_fixed_header_out,
+ nlm_sparc_write_external,
+ nlm_sparc_write_export
+};
#define TARGET_BIG_NAME "nlm32-sparc"
-#define TARGET_BIG_SYM nlmNAME(sparc_vec)
+#define TARGET_BIG_SYM nlmNAME (sparc_vec)
#define TARGET_BACKEND_DATA & nlm32_sparc_backend
#include "nlm-target.h"
diff --git a/bfd/nlmcode.h b/bfd/nlmcode.h
index f0046d7..c7cbd31 100644
--- a/bfd/nlmcode.h
+++ b/bfd/nlmcode.h
@@ -1,6 +1,6 @@
/* NLM (NetWare Loadable Module) executable support for BFD.
- Copyright 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+ 2005 Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support, using ELF support as the
template.
@@ -33,52 +33,29 @@
is named nlm_symbol_type below is actually named nlm32_symbol_type
in the final executable. */
-#define Nlm_External_Fixed_Header NlmNAME(External_Fixed_Header)
-#define Nlm_External_Version_Header NlmNAME(External_Version_Header)
-#define Nlm_External_Copyright_Header NlmNAME(External_Copyright_Header)
-#define Nlm_External_Extended_Header NlmNAME(External_Extended_Header)
-#define Nlm_External_Custom_Header NlmNAME(External_Custom_Header)
-#define Nlm_External_Cygnus_Ext_Header NlmNAME(External_Cygnus_Ext_Header)
-
-#define nlm_symbol_type nlmNAME(symbol_type)
-#define nlm_get_symtab_upper_bound nlmNAME(get_symtab_upper_bound)
-#define nlm_canonicalize_symtab nlmNAME(canonicalize_symtab)
-#define nlm_make_empty_symbol nlmNAME(make_empty_symbol)
-#define nlm_print_symbol nlmNAME(print_symbol)
-#define nlm_get_symbol_info nlmNAME(get_symbol_info)
-#define nlm_get_reloc_upper_bound nlmNAME(get_reloc_upper_bound)
-#define nlm_canonicalize_reloc nlmNAME(canonicalize_reloc)
-#define nlm_object_p nlmNAME(object_p)
-#define nlm_set_section_contents nlmNAME(set_section_contents)
-#define nlm_write_object_contents nlmNAME(write_object_contents)
+#define Nlm_External_Fixed_Header NlmNAME (External_Fixed_Header)
+#define Nlm_External_Version_Header NlmNAME (External_Version_Header)
+#define Nlm_External_Copyright_Header NlmNAME (External_Copyright_Header)
+#define Nlm_External_Extended_Header NlmNAME (External_Extended_Header)
+#define Nlm_External_Custom_Header NlmNAME (External_Custom_Header)
+#define Nlm_External_Cygnus_Ext_Header NlmNAME (External_Cygnus_Ext_Header)
+
+#define nlm_symbol_type nlmNAME (symbol_type)
+#define nlm_get_symtab_upper_bound nlmNAME (get_symtab_upper_bound)
+#define nlm_canonicalize_symtab nlmNAME (canonicalize_symtab)
+#define nlm_make_empty_symbol nlmNAME (make_empty_symbol)
+#define nlm_print_symbol nlmNAME (print_symbol)
+#define nlm_get_symbol_info nlmNAME (get_symbol_info)
+#define nlm_get_reloc_upper_bound nlmNAME (get_reloc_upper_bound)
+#define nlm_canonicalize_reloc nlmNAME (canonicalize_reloc)
+#define nlm_object_p nlmNAME (object_p)
+#define nlm_set_section_contents nlmNAME (set_section_contents)
+#define nlm_write_object_contents nlmNAME (write_object_contents)
#define nlm_swap_fixed_header_in(abfd,src,dst) \
- (nlm_swap_fixed_header_in_func(abfd)) (abfd,src,dst)
+ (nlm_swap_fixed_header_in_func (abfd)) (abfd, src, dst)
#define nlm_swap_fixed_header_out(abfd,src,dst) \
- (nlm_swap_fixed_header_out_func(abfd)) (abfd,src,dst)
-
-/* Forward declarations of static functions. */
-
-static bfd_boolean add_bfd_section
- PARAMS ((bfd *, char *, file_ptr, bfd_size_type, flagword));
-static bfd_boolean nlm_swap_variable_header_in
- PARAMS ((bfd *));
-static bfd_boolean nlm_swap_variable_header_out
- PARAMS ((bfd *));
-static bfd_boolean find_nonzero
- PARAMS ((PTR, size_t));
-static bfd_boolean nlm_swap_auxiliary_headers_in
- PARAMS ((bfd *));
-static bfd_boolean nlm_swap_auxiliary_headers_out
- PARAMS ((bfd *));
-static bfd_boolean nlm_slurp_symbol_table
- PARAMS ((bfd *));
-static bfd_boolean nlm_slurp_reloc_fixups
- PARAMS ((bfd *));
-static bfd_boolean nlm_compute_section_file_positions
- PARAMS ((bfd *));
-static int nlm_external_reloc_compare
- PARAMS ((const void *, const void *));
+ (nlm_swap_fixed_header_out_func (abfd)) (abfd, src, dst)
/* Should perhaps use put_offset, put_word, etc. For now, the two versions
can be handled by explicitly specifying 32 bits or "the long type". */
@@ -91,284 +68,86 @@ static int nlm_external_reloc_compare
#define get_word H_GET_32
#endif
-const bfd_target *
-nlm_object_p (abfd)
- bfd *abfd;
-{
- struct nlm_obj_tdata *preserved_tdata = nlm_tdata (abfd);
- bfd_boolean (*backend_object_p) PARAMS ((bfd *));
- PTR x_fxdhdr = NULL;
- Nlm_Internal_Fixed_Header *i_fxdhdrp;
- struct nlm_obj_tdata *new_tdata = NULL;
- const char *signature;
- enum bfd_architecture arch;
- bfd_size_type amt;
-
- /* Some NLM formats have a prefix before the standard NLM fixed
- header. */
- backend_object_p = nlm_backend_object_p_func (abfd);
- if (backend_object_p)
- {
- if (!(*backend_object_p) (abfd))
- goto got_wrong_format_error;
- }
-
- /* Read in the fixed length portion of the NLM header in external format. */
- amt = nlm_fixed_header_size (abfd);
- x_fxdhdr = (PTR) bfd_malloc (amt);
- if (x_fxdhdr == NULL)
- goto got_no_match;
-
- if (bfd_bread ((PTR) x_fxdhdr, amt, abfd) != amt)
- {
- if (bfd_get_error () != bfd_error_system_call)
- goto got_wrong_format_error;
- else
- goto got_no_match;
- }
-
- /* Allocate an instance of the nlm_obj_tdata structure and hook it up to
- the tdata pointer in the bfd. */
- amt = sizeof (struct nlm_obj_tdata);
- new_tdata = (struct nlm_obj_tdata *) bfd_zalloc (abfd, amt);
- if (new_tdata == NULL)
- goto got_no_match;
-
- nlm_tdata (abfd) = new_tdata;
-
- i_fxdhdrp = nlm_fixed_header (abfd);
- nlm_swap_fixed_header_in (abfd, x_fxdhdr, i_fxdhdrp);
- free (x_fxdhdr);
- x_fxdhdr = NULL;
-
- /* Check to see if we have an NLM file for this backend by matching
- the NLM signature. */
- signature = nlm_signature (abfd);
- if (signature != NULL
- && *signature != '\0'
- && strncmp ((char *) i_fxdhdrp->signature, signature,
- NLM_SIGNATURE_SIZE) != 0)
- goto got_wrong_format_error;
-
- /* There's no supported way to discover the endianess of an NLM, so test for
- a sane version number after doing byte swapping appropriate for this
- XVEC. (Hack alert!) */
- if (i_fxdhdrp->version > 0xFFFF)
- goto got_wrong_format_error;
-
- /* There's no supported way to check for 32 bit versus 64 bit addresses,
- so ignore this distinction for now. (FIXME) */
- /* Swap in the rest of the required header. */
- if (!nlm_swap_variable_header_in (abfd))
- {
- if (bfd_get_error () != bfd_error_system_call)
- goto got_wrong_format_error;
- else
- goto got_no_match;
- }
-
- /* Add the sections supplied by all NLM's, and then read in the
- auxiliary headers. Reading the auxiliary headers may create
- additional sections described in the cygnus_ext header.
- From this point on we assume that we have an NLM, and do not
- treat errors as indicating the wrong format. */
- if (!add_bfd_section (abfd, NLM_CODE_NAME,
- i_fxdhdrp->codeImageOffset,
- i_fxdhdrp->codeImageSize,
- (SEC_CODE | SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_RELOC))
- || !add_bfd_section (abfd, NLM_INITIALIZED_DATA_NAME,
- i_fxdhdrp->dataImageOffset,
- i_fxdhdrp->dataImageSize,
- (SEC_DATA | SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_RELOC))
- || !add_bfd_section (abfd, NLM_UNINITIALIZED_DATA_NAME,
- (file_ptr) 0,
- i_fxdhdrp->uninitializedDataSize,
- SEC_ALLOC))
- goto got_no_match;
-
- if (!nlm_swap_auxiliary_headers_in (abfd))
- goto got_no_match;
-
- if (nlm_fixed_header (abfd)->numberOfRelocationFixups != 0
- || nlm_fixed_header (abfd)->numberOfExternalReferences != 0)
- abfd->flags |= HAS_RELOC;
- if (nlm_fixed_header (abfd)->numberOfPublics != 0
- || nlm_fixed_header (abfd)->numberOfDebugRecords != 0
- || nlm_fixed_header (abfd)->numberOfExternalReferences != 0)
- abfd->flags |= HAS_SYMS;
-
- arch = nlm_architecture (abfd);
- if (arch != bfd_arch_unknown)
- bfd_default_set_arch_mach (abfd, arch, (unsigned long) 0);
-
- abfd->flags |= EXEC_P;
- bfd_get_start_address (abfd) = nlm_fixed_header (abfd)->codeStartOffset;
-
- return (abfd->xvec);
-
-got_wrong_format_error:
- bfd_set_error (bfd_error_wrong_format);
-got_no_match:
- nlm_tdata (abfd) = preserved_tdata;
- if (new_tdata != NULL)
- bfd_release (abfd, new_tdata);
- if (x_fxdhdr != NULL)
- free (x_fxdhdr);
- return (NULL);
-}
-
-/* Add a section to the bfd. */
-
-static bfd_boolean
-add_bfd_section (abfd, name, offset, size, flags)
- bfd *abfd;
- char *name;
- file_ptr offset;
- bfd_size_type size;
- flagword flags;
-{
- asection *newsect;
-
- newsect = bfd_make_section (abfd, name);
- if (newsect == NULL)
- return FALSE;
-
- newsect->vma = 0; /* NLM's are relocatable. */
- newsect->size = size;
- newsect->filepos = offset;
- newsect->flags = flags;
- newsect->alignment_power = bfd_log2 ((bfd_vma) 0); /* FIXME */
-
- return TRUE;
-}
-
/* Read and swap in the variable length header. All the fields must
exist in the NLM, and must exist in the order they are read here. */
static bfd_boolean
-nlm_swap_variable_header_in (abfd)
- bfd *abfd;
+nlm_swap_variable_header_in (bfd *abfd)
{
unsigned char temp[NLM_TARGET_LONG_SIZE];
bfd_size_type amt;
/* Read the description length and text members. */
-
amt = sizeof (nlm_variable_header (abfd)->descriptionLength);
- if (bfd_bread ((PTR) &nlm_variable_header (abfd)->descriptionLength,
+ if (bfd_bread ((void *) &nlm_variable_header (abfd)->descriptionLength,
amt, abfd) != amt)
return FALSE;
amt = nlm_variable_header (abfd)->descriptionLength + 1;
- if (bfd_bread ((PTR) nlm_variable_header (abfd)->descriptionText,
+ if (bfd_bread ((void *) nlm_variable_header (abfd)->descriptionText,
amt, abfd) != amt)
return FALSE;
/* Read and convert the stackSize field. */
-
amt = sizeof (temp);
- if (bfd_bread ((PTR) temp, amt, abfd) != amt)
+ if (bfd_bread ((void *) temp, amt, abfd) != amt)
return FALSE;
nlm_variable_header (abfd)->stackSize = get_word (abfd, (bfd_byte *) temp);
/* Read and convert the reserved field. */
-
amt = sizeof (temp);
- if (bfd_bread ((PTR) temp, amt, abfd) != amt)
+ if (bfd_bread ((void *) temp, amt, abfd) != amt)
return FALSE;
nlm_variable_header (abfd)->reserved = get_word (abfd, (bfd_byte *) temp);
/* Read the oldThreadName field. This field is a fixed length string. */
-
amt = sizeof (nlm_variable_header (abfd)->oldThreadName);
- if (bfd_bread ((PTR) nlm_variable_header (abfd)->oldThreadName,
+ if (bfd_bread ((void *) nlm_variable_header (abfd)->oldThreadName,
amt, abfd) != amt)
return FALSE;
/* Read the screen name length and text members. */
-
amt = sizeof (nlm_variable_header (abfd)->screenNameLength);
- if (bfd_bread ((PTR) & nlm_variable_header (abfd)->screenNameLength,
+ if (bfd_bread ((void *) & nlm_variable_header (abfd)->screenNameLength,
amt, abfd) != amt)
return FALSE;
amt = nlm_variable_header (abfd)->screenNameLength + 1;
- if (bfd_bread ((PTR) nlm_variable_header (abfd)->screenName,
+ if (bfd_bread ((void *) nlm_variable_header (abfd)->screenName,
amt, abfd) != amt)
return FALSE;
/* Read the thread name length and text members. */
-
amt = sizeof (nlm_variable_header (abfd)->threadNameLength);
- if (bfd_bread ((PTR) & nlm_variable_header (abfd)->threadNameLength,
+ if (bfd_bread ((void *) & nlm_variable_header (abfd)->threadNameLength,
amt, abfd) != amt)
return FALSE;
amt = nlm_variable_header (abfd)->threadNameLength + 1;
- if (bfd_bread ((PTR) nlm_variable_header (abfd)->threadName,
+ if (bfd_bread ((void *) nlm_variable_header (abfd)->threadName,
amt, abfd) != amt)
return FALSE;
return TRUE;
}
-/* Swap and write out the variable length header. All the fields must
- exist in the NLM, and must exist in this order. */
+/* Add a section to the bfd. */
static bfd_boolean
-nlm_swap_variable_header_out (abfd)
- bfd *abfd;
+add_bfd_section (bfd *abfd,
+ char *name,
+ file_ptr offset,
+ bfd_size_type size,
+ flagword flags)
{
- unsigned char temp[NLM_TARGET_LONG_SIZE];
- bfd_size_type amt;
-
- /* Write the description length and text members. */
- amt = sizeof (nlm_variable_header (abfd)->descriptionLength);
- if (bfd_bwrite ((PTR) & nlm_variable_header (abfd)->descriptionLength, amt,
- abfd) != amt)
- return FALSE;
- amt = nlm_variable_header (abfd)->descriptionLength + 1;
- if (bfd_bwrite ((PTR) nlm_variable_header (abfd)->descriptionText, amt,
- abfd) != amt)
- return FALSE;
-
- /* Convert and write the stackSize field. */
- put_word (abfd, (bfd_vma) nlm_variable_header (abfd)->stackSize,
- (bfd_byte *) temp);
- amt = sizeof (temp);
- if (bfd_bwrite ((PTR) temp, amt, abfd) != amt)
- return FALSE;
-
- /* Convert and write the reserved field. */
- put_word (abfd, (bfd_vma) nlm_variable_header (abfd)->reserved,
- (bfd_byte *) temp);
- amt = sizeof (temp);
- if (bfd_bwrite ((PTR) temp, amt, abfd) != amt)
- return FALSE;
+ asection *newsect;
- /* Write the oldThreadName field. This field is a fixed length string. */
- amt = sizeof (nlm_variable_header (abfd)->oldThreadName);
- if (bfd_bwrite ((PTR) nlm_variable_header (abfd)->oldThreadName, amt,
- abfd) != amt)
+ newsect = bfd_make_section (abfd, name);
+ if (newsect == NULL)
return FALSE;
- /* Write the screen name length and text members. */
- amt = sizeof (nlm_variable_header (abfd)->screenNameLength);
- if (bfd_bwrite ((PTR) & nlm_variable_header (abfd)->screenNameLength, amt,
- abfd) != amt)
- return FALSE;
- amt = nlm_variable_header (abfd)->screenNameLength + 1;
- if (bfd_bwrite ((PTR) nlm_variable_header (abfd)->screenName, amt,
- abfd) != amt)
- return FALSE;
+ newsect->vma = 0; /* NLM's are relocatable. */
+ newsect->size = size;
+ newsect->filepos = offset;
+ newsect->flags = flags;
+ newsect->alignment_power = bfd_log2 ((bfd_vma) 0); /* FIXME */
- /* Write the thread name length and text members. */
- amt = sizeof (nlm_variable_header (abfd)->threadNameLength);
- if (bfd_bwrite ((PTR) & nlm_variable_header (abfd)->threadNameLength, amt,
- abfd) != amt)
- return FALSE;
- amt = nlm_variable_header (abfd)->threadNameLength + 1;
- if (bfd_bwrite ((PTR) nlm_variable_header (abfd)->threadName, amt,
- abfd) != amt)
- return FALSE;
return TRUE;
}
@@ -382,8 +161,7 @@ nlm_swap_variable_header_out (abfd)
recognize it. */
static bfd_boolean
-nlm_swap_auxiliary_headers_in (abfd)
- bfd *abfd;
+nlm_swap_auxiliary_headers_in (bfd *abfd)
{
char tempstr[16];
file_ptr position;
@@ -393,7 +171,7 @@ nlm_swap_auxiliary_headers_in (abfd)
{
position = bfd_tell (abfd);
amt = sizeof (tempstr);
- if (bfd_bread ((PTR) tempstr, amt, abfd) != amt)
+ if (bfd_bread ((void *) tempstr, amt, abfd) != amt)
return FALSE;
if (bfd_seek (abfd, position, SEEK_SET) != 0)
return FALSE;
@@ -402,7 +180,7 @@ nlm_swap_auxiliary_headers_in (abfd)
Nlm_External_Version_Header thdr;
amt = sizeof (thdr);
- if (bfd_bread ((PTR) &thdr, amt, abfd) != amt)
+ if (bfd_bread ((void *) &thdr, amt, abfd) != amt)
return FALSE;
memcpy (nlm_version_header (abfd)->stamp, thdr.stamp,
sizeof (thdr.stamp));
@@ -424,7 +202,7 @@ nlm_swap_auxiliary_headers_in (abfd)
Nlm_External_Extended_Header thdr;
amt = sizeof (thdr);
- if (bfd_bread ((PTR) &thdr, amt, abfd) != amt)
+ if (bfd_bread ((void *) &thdr, amt, abfd) != amt)
return FALSE;
memcpy (nlm_extended_header (abfd)->stamp, thdr.stamp,
sizeof (thdr.stamp));
@@ -490,16 +268,16 @@ nlm_swap_auxiliary_headers_in (abfd)
else if (strncmp (tempstr, "CoPyRiGhT=", 10) == 0)
{
amt = sizeof (nlm_copyright_header (abfd)->stamp);
- if (bfd_bread ((PTR) nlm_copyright_header (abfd)->stamp,
+ if (bfd_bread ((void *) nlm_copyright_header (abfd)->stamp,
amt, abfd) != amt)
return FALSE;
- if (bfd_bread ((PTR) &(nlm_copyright_header (abfd)
+ if (bfd_bread ((void *) &(nlm_copyright_header (abfd)
->copyrightMessageLength),
(bfd_size_type) 1, abfd) != 1)
return FALSE;
/* The copyright message is a variable length string. */
amt = nlm_copyright_header (abfd)->copyrightMessageLength + 1;
- if (bfd_bread ((PTR) nlm_copyright_header (abfd)->copyrightMessage,
+ if (bfd_bread ((void *) nlm_copyright_header (abfd)->copyrightMessage,
amt, abfd) != amt)
return FALSE;
}
@@ -510,15 +288,15 @@ nlm_swap_auxiliary_headers_in (abfd)
file_ptr dataOffset;
bfd_size_type dataLength;
char dataStamp[8];
- PTR hdr;
+ void * hdr;
/* Read the stamp ("CuStHeAd"). */
amt = sizeof (thdr.stamp);
- if (bfd_bread ((PTR) thdr.stamp, amt, abfd) != amt)
+ if (bfd_bread ((void *) thdr.stamp, amt, abfd) != amt)
return FALSE;
/* Read the length of this custom header. */
amt = sizeof (thdr.length);
- if (bfd_bread ((PTR) thdr.length, amt, abfd) != amt)
+ if (bfd_bread ((void *) thdr.length, amt, abfd) != amt)
return FALSE;
hdrLength = get_word (abfd, (bfd_byte *) thdr.length);
/* Read further fields if we have them. */
@@ -527,7 +305,7 @@ nlm_swap_auxiliary_headers_in (abfd)
else
{
amt = sizeof (thdr.dataOffset);
- if (bfd_bread ((PTR) thdr.dataOffset, amt, abfd) != amt)
+ if (bfd_bread ((void *) thdr.dataOffset, amt, abfd) != amt)
return FALSE;
dataOffset = get_word (abfd, (bfd_byte *) thdr.dataOffset);
}
@@ -536,7 +314,7 @@ nlm_swap_auxiliary_headers_in (abfd)
else
{
amt = sizeof (thdr.dataLength);
- if (bfd_bread ((PTR) thdr.dataLength, amt, abfd) != amt)
+ if (bfd_bread ((void *) thdr.dataLength, amt, abfd) != amt)
return FALSE;
dataLength = get_word (abfd, (bfd_byte *) thdr.dataLength);
}
@@ -545,7 +323,7 @@ nlm_swap_auxiliary_headers_in (abfd)
else
{
amt = sizeof (dataStamp);
- if (bfd_bread ((PTR) dataStamp, amt, abfd) != amt)
+ if (bfd_bread ((void *) dataStamp, amt, abfd) != amt)
return FALSE;
}
@@ -579,7 +357,7 @@ nlm_swap_auxiliary_headers_in (abfd)
pos = bfd_tell (abfd);
if (bfd_seek (abfd, dataOffset, SEEK_SET) != 0)
return FALSE;
- contents = (bfd_byte *) bfd_alloc (abfd, dataLength);
+ contents = bfd_alloc (abfd, dataLength);
if (contents == NULL)
return FALSE;
if (bfd_bread (contents, dataLength, abfd) != dataLength)
@@ -615,8 +393,7 @@ nlm_swap_auxiliary_headers_in (abfd)
null terminated section name
zeroes to adjust to 4 byte boundary
4 byte section data file pointer
- 4 byte section size
- */
+ 4 byte section size. */
name = (char *) p;
l = strlen (name) + 1;
@@ -628,7 +405,7 @@ nlm_swap_auxiliary_headers_in (abfd)
p += 4;
newsec = bfd_make_section_anyway (abfd, name);
- if (newsec == (asection *) NULL)
+ if (newsec == NULL)
return FALSE;
newsec->size = size;
if (filepos != 0)
@@ -656,12 +433,195 @@ nlm_swap_auxiliary_headers_in (abfd)
return TRUE;
}
+const bfd_target *
+nlm_object_p (bfd *abfd)
+{
+ struct nlm_obj_tdata *preserved_tdata = nlm_tdata (abfd);
+ bfd_boolean (*backend_object_p) (bfd *);
+ void * x_fxdhdr = NULL;
+ Nlm_Internal_Fixed_Header *i_fxdhdrp;
+ struct nlm_obj_tdata *new_tdata = NULL;
+ const char *signature;
+ enum bfd_architecture arch;
+ bfd_size_type amt;
+
+ /* Some NLM formats have a prefix before the standard NLM fixed
+ header. */
+ backend_object_p = nlm_backend_object_p_func (abfd);
+ if (backend_object_p)
+ {
+ if (!(*backend_object_p) (abfd))
+ goto got_wrong_format_error;
+ }
+
+ /* Read in the fixed length portion of the NLM header in external format. */
+ amt = nlm_fixed_header_size (abfd);
+ x_fxdhdr = bfd_malloc (amt);
+ if (x_fxdhdr == NULL)
+ goto got_no_match;
+
+ if (bfd_bread ((void *) x_fxdhdr, amt, abfd) != amt)
+ {
+ if (bfd_get_error () != bfd_error_system_call)
+ goto got_wrong_format_error;
+ else
+ goto got_no_match;
+ }
+
+ /* Allocate an instance of the nlm_obj_tdata structure and hook it up to
+ the tdata pointer in the bfd. */
+ amt = sizeof (struct nlm_obj_tdata);
+ new_tdata = bfd_zalloc (abfd, amt);
+ if (new_tdata == NULL)
+ goto got_no_match;
+
+ nlm_tdata (abfd) = new_tdata;
+
+ i_fxdhdrp = nlm_fixed_header (abfd);
+ nlm_swap_fixed_header_in (abfd, x_fxdhdr, i_fxdhdrp);
+ free (x_fxdhdr);
+ x_fxdhdr = NULL;
+
+ /* Check to see if we have an NLM file for this backend by matching
+ the NLM signature. */
+ signature = nlm_signature (abfd);
+ if (signature != NULL
+ && *signature != '\0'
+ && strncmp ((char *) i_fxdhdrp->signature, signature,
+ NLM_SIGNATURE_SIZE) != 0)
+ goto got_wrong_format_error;
+
+ /* There's no supported way to discover the endianess of an NLM, so test for
+ a sane version number after doing byte swapping appropriate for this
+ XVEC. (Hack alert!) */
+ if (i_fxdhdrp->version > 0xFFFF)
+ goto got_wrong_format_error;
+
+ /* There's no supported way to check for 32 bit versus 64 bit addresses,
+ so ignore this distinction for now. (FIXME) */
+ /* Swap in the rest of the required header. */
+ if (!nlm_swap_variable_header_in (abfd))
+ {
+ if (bfd_get_error () != bfd_error_system_call)
+ goto got_wrong_format_error;
+ else
+ goto got_no_match;
+ }
+
+ /* Add the sections supplied by all NLM's, and then read in the
+ auxiliary headers. Reading the auxiliary headers may create
+ additional sections described in the cygnus_ext header.
+ From this point on we assume that we have an NLM, and do not
+ treat errors as indicating the wrong format. */
+ if (!add_bfd_section (abfd, NLM_CODE_NAME,
+ i_fxdhdrp->codeImageOffset,
+ i_fxdhdrp->codeImageSize,
+ (SEC_CODE | SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_RELOC))
+ || !add_bfd_section (abfd, NLM_INITIALIZED_DATA_NAME,
+ i_fxdhdrp->dataImageOffset,
+ i_fxdhdrp->dataImageSize,
+ (SEC_DATA | SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_RELOC))
+ || !add_bfd_section (abfd, NLM_UNINITIALIZED_DATA_NAME,
+ (file_ptr) 0,
+ i_fxdhdrp->uninitializedDataSize,
+ SEC_ALLOC))
+ goto got_no_match;
+
+ if (!nlm_swap_auxiliary_headers_in (abfd))
+ goto got_no_match;
+
+ if (nlm_fixed_header (abfd)->numberOfRelocationFixups != 0
+ || nlm_fixed_header (abfd)->numberOfExternalReferences != 0)
+ abfd->flags |= HAS_RELOC;
+ if (nlm_fixed_header (abfd)->numberOfPublics != 0
+ || nlm_fixed_header (abfd)->numberOfDebugRecords != 0
+ || nlm_fixed_header (abfd)->numberOfExternalReferences != 0)
+ abfd->flags |= HAS_SYMS;
+
+ arch = nlm_architecture (abfd);
+ if (arch != bfd_arch_unknown)
+ bfd_default_set_arch_mach (abfd, arch, (unsigned long) 0);
+
+ abfd->flags |= EXEC_P;
+ bfd_get_start_address (abfd) = nlm_fixed_header (abfd)->codeStartOffset;
+
+ return abfd->xvec;
+
+got_wrong_format_error:
+ bfd_set_error (bfd_error_wrong_format);
+got_no_match:
+ nlm_tdata (abfd) = preserved_tdata;
+ if (new_tdata != NULL)
+ bfd_release (abfd, new_tdata);
+ if (x_fxdhdr != NULL)
+ free (x_fxdhdr);
+
+ return NULL;
+}
+
+/* Swap and write out the variable length header. All the fields must
+ exist in the NLM, and must exist in this order. */
+
+static bfd_boolean
+nlm_swap_variable_header_out (bfd *abfd)
+{
+ bfd_byte temp[NLM_TARGET_LONG_SIZE];
+ bfd_size_type amt;
+
+ /* Write the description length and text members. */
+ amt = sizeof (nlm_variable_header (abfd)->descriptionLength);
+ if (bfd_bwrite (& nlm_variable_header (abfd)->descriptionLength, amt,
+ abfd) != amt)
+ return FALSE;
+ amt = nlm_variable_header (abfd)->descriptionLength + 1;
+ if (bfd_bwrite ((void *) nlm_variable_header (abfd)->descriptionText, amt,
+ abfd) != amt)
+ return FALSE;
+
+ /* Convert and write the stackSize field. */
+ put_word (abfd, (bfd_vma) nlm_variable_header (abfd)->stackSize, temp);
+ amt = sizeof (temp);
+ if (bfd_bwrite (temp, amt, abfd) != amt)
+ return FALSE;
+
+ /* Convert and write the reserved field. */
+ put_word (abfd, (bfd_vma) nlm_variable_header (abfd)->reserved, temp);
+ amt = sizeof (temp);
+ if (bfd_bwrite (temp, amt, abfd) != amt)
+ return FALSE;
+
+ /* Write the oldThreadName field. This field is a fixed length string. */
+ amt = sizeof (nlm_variable_header (abfd)->oldThreadName);
+ if (bfd_bwrite (nlm_variable_header (abfd)->oldThreadName, amt,
+ abfd) != amt)
+ return FALSE;
+
+ /* Write the screen name length and text members. */
+ amt = sizeof (nlm_variable_header (abfd)->screenNameLength);
+ if (bfd_bwrite (& nlm_variable_header (abfd)->screenNameLength, amt,
+ abfd) != amt)
+ return FALSE;
+ amt = nlm_variable_header (abfd)->screenNameLength + 1;
+ if (bfd_bwrite (nlm_variable_header (abfd)->screenName, amt, abfd) != amt)
+ return FALSE;
+
+ /* Write the thread name length and text members. */
+ amt = sizeof (nlm_variable_header (abfd)->threadNameLength);
+ if (bfd_bwrite (& nlm_variable_header (abfd)->threadNameLength, amt,
+ abfd) != amt)
+ return FALSE;
+ amt = nlm_variable_header (abfd)->threadNameLength + 1;
+ if (bfd_bwrite (nlm_variable_header (abfd)->threadName, amt, abfd) != amt)
+ return FALSE;
+ return TRUE;
+}
+
/* Return whether there is a non-zero byte in a memory block. */
static bfd_boolean
-find_nonzero (buf, size)
- PTR buf;
- size_t size;
+find_nonzero (void * buf, size_t size)
{
char *p = (char *) buf;
@@ -676,13 +636,12 @@ find_nonzero (buf, size)
the caller to set up the stamp fields. */
static bfd_boolean
-nlm_swap_auxiliary_headers_out (abfd)
- bfd *abfd;
+nlm_swap_auxiliary_headers_out (bfd *abfd)
{
bfd_size_type amt;
/* Write out the version header if there is one. */
- if (find_nonzero ((PTR) nlm_version_header (abfd),
+ if (find_nonzero (nlm_version_header (abfd),
sizeof (Nlm_Internal_Version_Header)))
{
Nlm_External_Version_Header thdr;
@@ -700,7 +659,7 @@ nlm_swap_auxiliary_headers_out (abfd)
(bfd_byte *) thdr.month);
put_word (abfd, (bfd_vma) nlm_version_header (abfd)->day,
(bfd_byte *) thdr.day);
- if (bfd_bwrite ((PTR) &thdr, (bfd_size_type) sizeof (thdr), abfd)
+ if (bfd_bwrite ((void *) &thdr, (bfd_size_type) sizeof (thdr), abfd)
!= sizeof (thdr))
return FALSE;
}
@@ -709,29 +668,29 @@ nlm_swap_auxiliary_headers_out (abfd)
tag in order to make the NW4.x and NW5.x loaders happy. */
/* Write out the copyright header if there is one. */
- if (find_nonzero ((PTR) nlm_copyright_header (abfd),
+ if (find_nonzero (nlm_copyright_header (abfd),
sizeof (Nlm_Internal_Copyright_Header)))
{
Nlm_External_Copyright_Header thdr;
memcpy (thdr.stamp, "CoPyRiGhT=", 10);
amt = sizeof (thdr.stamp);
- if (bfd_bwrite ((PTR) thdr.stamp, amt, abfd) != amt)
+ if (bfd_bwrite ((void *) thdr.stamp, amt, abfd) != amt)
return FALSE;
thdr.copyrightMessageLength[0] =
nlm_copyright_header (abfd)->copyrightMessageLength;
amt = 1;
- if (bfd_bwrite ((PTR) thdr.copyrightMessageLength, amt, abfd) != amt)
+ if (bfd_bwrite ((void *) thdr.copyrightMessageLength, amt, abfd) != amt)
return FALSE;
/* The copyright message is a variable length string. */
amt = nlm_copyright_header (abfd)->copyrightMessageLength + 1;
- if (bfd_bwrite ((PTR) nlm_copyright_header (abfd)->copyrightMessage,
+ if (bfd_bwrite ((void *) nlm_copyright_header (abfd)->copyrightMessage,
amt, abfd) != amt)
return FALSE;
}
/* Write out the extended header if there is one. */
- if (find_nonzero ((PTR) nlm_extended_header (abfd),
+ if (find_nonzero (nlm_extended_header (abfd),
sizeof (Nlm_Internal_Extended_Header)))
{
Nlm_External_Extended_Header thdr;
@@ -824,20 +783,20 @@ nlm_swap_auxiliary_headers_out (abfd)
put_word (abfd,
(bfd_vma) nlm_extended_header (abfd)->reserved5,
(bfd_byte *) thdr.reserved5);
- if (bfd_bwrite ((PTR) &thdr, (bfd_size_type) sizeof (thdr), abfd)
+ if (bfd_bwrite ((void *) &thdr, (bfd_size_type) sizeof (thdr), abfd)
!= sizeof (thdr))
return FALSE;
}
/* Write out the custom header if there is one. */
- if (find_nonzero ((PTR) nlm_custom_header (abfd),
+ if (find_nonzero (nlm_custom_header (abfd),
sizeof (Nlm_Internal_Custom_Header)))
{
Nlm_External_Custom_Header thdr;
bfd_boolean ds;
bfd_size_type hdrLength;
- ds = find_nonzero ((PTR) nlm_custom_header (abfd)->dataStamp,
+ ds = find_nonzero (nlm_custom_header (abfd)->dataStamp,
sizeof (nlm_custom_header (abfd)->dataStamp));
memcpy (thdr.stamp, "CuStHeAd", 8);
hdrLength = (2 * NLM_TARGET_LONG_SIZE + (ds ? 8 : 0)
@@ -851,7 +810,7 @@ nlm_swap_auxiliary_headers_out (abfd)
{
BFD_ASSERT (nlm_custom_header (abfd)->hdrLength == 0);
amt = sizeof (thdr) - sizeof (thdr.dataStamp);
- if (bfd_bwrite ((PTR) &thdr, amt, abfd) != amt)
+ if (bfd_bwrite ((void *) &thdr, amt, abfd) != amt)
return FALSE;
}
else
@@ -859,7 +818,7 @@ nlm_swap_auxiliary_headers_out (abfd)
memcpy (thdr.dataStamp, nlm_custom_header (abfd)->dataStamp,
sizeof (thdr.dataStamp));
amt = sizeof (thdr);
- if (bfd_bwrite ((PTR) &thdr, amt, abfd) != amt)
+ if (bfd_bwrite ((void *) &thdr, amt, abfd) != amt)
return FALSE;
amt = nlm_custom_header (abfd)->hdrLength;
if (bfd_bwrite (nlm_custom_header (abfd)->hdr, amt, abfd) != amt)
@@ -868,7 +827,7 @@ nlm_swap_auxiliary_headers_out (abfd)
}
/* Write out the Cygnus debugging header if there is one. */
- if (find_nonzero ((PTR) nlm_cygnus_ext_header (abfd),
+ if (find_nonzero (nlm_cygnus_ext_header (abfd),
sizeof (Nlm_Internal_Cygnus_Ext_Header)))
{
Nlm_External_Custom_Header thdr;
@@ -882,7 +841,7 @@ nlm_swap_auxiliary_headers_out (abfd)
(bfd_byte *) thdr.dataLength);
memcpy (thdr.dataStamp, "CyGnUsEx", 8);
amt = sizeof (thdr);
- if (bfd_bwrite ((PTR) &thdr, amt, abfd) != amt)
+ if (bfd_bwrite ((void *) &thdr, amt, abfd) != amt)
return FALSE;
}
@@ -899,8 +858,7 @@ nlm_swap_auxiliary_headers_out (abfd)
on this size. */
long
-nlm_get_symtab_upper_bound (abfd)
- bfd *abfd;
+nlm_get_symtab_upper_bound (bfd *abfd)
{
Nlm_Internal_Fixed_Header *i_fxdhdrp; /* Nlm file header, internal form. */
long symcount;
@@ -911,83 +869,7 @@ nlm_get_symtab_upper_bound (abfd)
+ i_fxdhdrp->numberOfDebugRecords
+ i_fxdhdrp->numberOfExternalReferences);
symtab_size = (symcount + 1) * (sizeof (asymbol));
- return (symtab_size);
-}
-
-/* Note that bfd_get_symcount is guaranteed to be zero if slurping the
- symbol table fails. */
-
-long
-nlm_canonicalize_symtab (abfd, alocation)
- bfd *abfd;
- asymbol **alocation;
-{
- nlm_symbol_type *symbase;
- bfd_size_type counter = 0;
-
- if (! nlm_slurp_symbol_table (abfd))
- return -1;
- symbase = nlm_get_symbols (abfd);
- while (counter < bfd_get_symcount (abfd))
- {
- *alocation++ = &symbase->symbol;
- symbase++;
- counter++;
- }
- *alocation = (asymbol *) NULL;
- return bfd_get_symcount (abfd);
-}
-
-/* Make an NLM symbol. There is nothing special to do here. */
-
-asymbol *
-nlm_make_empty_symbol (abfd)
- bfd *abfd;
-{
- bfd_size_type amt = sizeof (nlm_symbol_type);
- nlm_symbol_type *new = (nlm_symbol_type *) bfd_zalloc (abfd, amt);
-
- if (new)
- new->symbol.the_bfd = abfd;
- return &new->symbol;
-}
-
-/* Get symbol information. */
-
-void
-nlm_get_symbol_info (ignore_abfd, symbol, ret)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
- symbol_info *ret;
-{
- bfd_symbol_info (symbol, ret);
-}
-
-/* Print symbol information. */
-
-void
-nlm_print_symbol (abfd, afile, symbol, how)
- bfd *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:
- if (symbol->name)
- fprintf (file, "%s", symbol->name);
- break;
- case bfd_print_symbol_all:
- bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
- fprintf (file, " %-5s", symbol->section->name);
- if (symbol->name)
- fprintf (file, " %s", symbol->name);
- break;
- }
+ return symtab_size;
}
/* Slurp in nlm symbol table.
@@ -1004,14 +886,13 @@ nlm_print_symbol (abfd, afile, symbol, how)
records we also read in the associated reloc information, which is
attached to the symbol.
- The bfd symbols are copied to SYMPTRS.
+ The bfd symbols are copied to SYMvoid *S.
When we return, the bfd symcount is either zero or contains the correct
number of symbols. */
static bfd_boolean
-nlm_slurp_symbol_table (abfd)
- bfd *abfd;
+nlm_slurp_symbol_table (bfd *abfd)
{
Nlm_Internal_Fixed_Header *i_fxdhdrp; /* Nlm file header, internal form. */
bfd_size_type totsymcount; /* Number of NLM symbols. */
@@ -1020,8 +901,8 @@ nlm_slurp_symbol_table (abfd)
unsigned char symlength; /* Symbol length read into here. */
unsigned char symtype; /* Type of debugging symbol. */
bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* Symbol offsets read into here. */
- bfd_boolean (*read_import_func) PARAMS ((bfd *, nlm_symbol_type *));
- bfd_boolean (*set_public_section_func) PARAMS ((bfd *, nlm_symbol_type *));
+ bfd_boolean (*read_import_func) (bfd *, nlm_symbol_type *);
+ bfd_boolean (*set_public_section_func) (bfd *, nlm_symbol_type *);
bfd_size_type amt;
if (nlm_get_symbols (abfd) != NULL)
@@ -1047,7 +928,7 @@ nlm_slurp_symbol_table (abfd)
return FALSE;
amt = totsymcount * sizeof (nlm_symbol_type);
- sym = ((nlm_symbol_type *) bfd_zalloc (abfd, amt));
+ sym = bfd_zalloc (abfd, amt);
if (!sym)
return FALSE;
nlm_set_symbols (abfd, sym);
@@ -1061,19 +942,19 @@ nlm_slurp_symbol_table (abfd)
while (abfd->symcount < symcount)
{
amt = sizeof (symlength);
- if (bfd_bread ((PTR) &symlength, amt, abfd) != amt)
+ if (bfd_bread ((void *) &symlength, amt, abfd) != amt)
return FALSE;
amt = symlength;
sym->symbol.the_bfd = abfd;
sym->symbol.name = bfd_alloc (abfd, amt + 1);
if (!sym->symbol.name)
return FALSE;
- if (bfd_bread ((PTR) sym->symbol.name, amt, abfd) != amt)
+ if (bfd_bread ((void *) sym->symbol.name, amt, abfd) != amt)
return FALSE;
/* Cast away const. */
((char *) (sym->symbol.name))[symlength] = '\0';
amt = sizeof (temp);
- if (bfd_bread ((PTR) temp, amt, abfd) != amt)
+ if (bfd_bread ((void *) temp, amt, abfd) != amt)
return FALSE;
sym->symbol.flags = BSF_GLOBAL | BSF_EXPORT;
sym->symbol.value = get_word (abfd, temp);
@@ -1094,10 +975,8 @@ nlm_slurp_symbol_table (abfd)
bfd_get_section_by_name (abfd, NLM_CODE_NAME);
}
else
- {
- sym->symbol.section =
- bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
- }
+ sym->symbol.section =
+ bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
}
sym->rcnt = 0;
abfd->symcount++;
@@ -1115,30 +994,29 @@ nlm_slurp_symbol_table (abfd)
while (abfd->symcount < symcount)
{
amt = sizeof (symtype);
- if (bfd_bread ((PTR) &symtype, amt, abfd) != amt)
+ if (bfd_bread ((void *) &symtype, amt, abfd) != amt)
return FALSE;
amt = sizeof (temp);
- if (bfd_bread ((PTR) temp, amt, abfd) != amt)
+ if (bfd_bread ((void *) temp, amt, abfd) != amt)
return FALSE;
amt = sizeof (symlength);
- if (bfd_bread ((PTR) &symlength, amt, abfd) != amt)
+ if (bfd_bread ((void *) &symlength, amt, abfd) != amt)
return FALSE;
amt = symlength;
sym->symbol.the_bfd = abfd;
sym->symbol.name = bfd_alloc (abfd, amt + 1);
if (!sym->symbol.name)
return FALSE;
- if (bfd_bread ((PTR) sym->symbol.name, amt, abfd) != amt)
+ if (bfd_bread ((void *) sym->symbol.name, amt, abfd) != amt)
return FALSE;
/* Cast away const. */
((char *) (sym->symbol.name))[symlength] = '\0';
sym->symbol.flags = BSF_LOCAL;
sym->symbol.value = get_word (abfd, temp);
+
if (symtype == 0)
- {
- sym->symbol.section =
- bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
- }
+ sym->symbol.section =
+ bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
else if (symtype == 1)
{
sym->symbol.flags |= BSF_FUNCTION;
@@ -1146,9 +1024,8 @@ nlm_slurp_symbol_table (abfd)
bfd_get_section_by_name (abfd, NLM_CODE_NAME);
}
else
- {
- sym->symbol.section = bfd_abs_section_ptr;
- }
+ sym->symbol.section = bfd_abs_section_ptr;
+
sym->rcnt = 0;
abfd->symcount++;
sym++;
@@ -1175,6 +1052,78 @@ nlm_slurp_symbol_table (abfd)
return TRUE;
}
+
+/* Note that bfd_get_symcount is guaranteed to be zero if slurping the
+ symbol table fails. */
+
+long
+nlm_canonicalize_symtab (bfd *abfd, asymbol **alocation)
+{
+ nlm_symbol_type *symbase;
+ bfd_size_type counter = 0;
+
+ if (! nlm_slurp_symbol_table (abfd))
+ return -1;
+ symbase = nlm_get_symbols (abfd);
+ while (counter < bfd_get_symcount (abfd))
+ {
+ *alocation++ = &symbase->symbol;
+ symbase++;
+ counter++;
+ }
+ *alocation = NULL;
+ return bfd_get_symcount (abfd);
+}
+
+/* Make an NLM symbol. There is nothing special to do here. */
+
+asymbol *
+nlm_make_empty_symbol (bfd *abfd)
+{
+ bfd_size_type amt = sizeof (nlm_symbol_type);
+ nlm_symbol_type *new = bfd_zalloc (abfd, amt);
+
+ if (new == NULL)
+ return NULL;
+ new->symbol.the_bfd = abfd;
+ return & new->symbol;
+}
+
+/* Get symbol information. */
+
+void
+nlm_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED,
+ asymbol *symbol,
+ symbol_info *ret)
+{
+ bfd_symbol_info (symbol, ret);
+}
+
+/* Print symbol information. */
+
+void
+nlm_print_symbol (bfd *abfd,
+ void * afile,
+ asymbol *symbol,
+ bfd_print_symbol_type how)
+{
+ FILE *file = (FILE *) afile;
+
+ switch (how)
+ {
+ case bfd_print_symbol_name:
+ case bfd_print_symbol_more:
+ if (symbol->name)
+ fprintf (file, "%s", symbol->name);
+ break;
+ case bfd_print_symbol_all:
+ bfd_print_symbol_vandf (abfd, (void *) file, symbol);
+ fprintf (file, " %-5s", symbol->section->name);
+ if (symbol->name)
+ fprintf (file, " %s", symbol->name);
+ break;
+ }
+}
/* Get the relocs for an NLM file. There are two types of relocs.
Imports are relocs against symbols defined in other NLM files. We
@@ -1190,11 +1139,9 @@ nlm_slurp_symbol_table (abfd)
section. */
static bfd_boolean
-nlm_slurp_reloc_fixups (abfd)
- bfd *abfd;
+nlm_slurp_reloc_fixups (bfd *abfd)
{
- bfd_boolean (*read_func)
- PARAMS ((bfd *, nlm_symbol_type *, asection **, arelent *));
+ bfd_boolean (*read_func) (bfd *, nlm_symbol_type *, asection **, arelent *);
bfd_size_type count, amt;
arelent *rels;
asection **secs;
@@ -1211,9 +1158,9 @@ nlm_slurp_reloc_fixups (abfd)
count = nlm_fixed_header (abfd)->numberOfRelocationFixups;
amt = count * sizeof (arelent);
- rels = (arelent *) bfd_alloc (abfd, amt);
+ rels = bfd_alloc (abfd, amt);
amt = count * sizeof (asection *);
- secs = (asection **) bfd_alloc (abfd, amt);
+ secs = bfd_alloc (abfd, amt);
if ((rels == NULL || secs == NULL) && count != 0)
return FALSE;
nlm_relocation_fixups (abfd) = rels;
@@ -1223,7 +1170,7 @@ nlm_slurp_reloc_fixups (abfd)
the machine specific reloc information is. */
while (count-- != 0)
{
- if (! (*read_func) (abfd, (nlm_symbol_type *) NULL, secs, rels))
+ if (! (*read_func) (abfd, NULL, secs, rels))
{
nlm_relocation_fixups (abfd) = NULL;
nlm_relocation_fixup_secs (abfd) = NULL;
@@ -1241,9 +1188,7 @@ nlm_slurp_reloc_fixups (abfd)
That will be handled when they are actually read. */
long
-nlm_get_reloc_upper_bound (abfd, sec)
- bfd *abfd;
- asection *sec;
+nlm_get_reloc_upper_bound (bfd *abfd, asection *sec)
{
nlm_symbol_type *syms;
bfd_size_type count;
@@ -1279,16 +1224,15 @@ nlm_get_reloc_upper_bound (abfd, sec)
/* Get the relocs themselves. */
long
-nlm_canonicalize_reloc (abfd, sec, relptr, symbols)
- bfd *abfd;
- asection *sec;
- arelent **relptr;
- asymbol **symbols;
+nlm_canonicalize_reloc (bfd *abfd,
+ asection *sec,
+ arelent **relptr,
+ asymbol **symbols)
{
arelent *rels;
asection **secs;
bfd_size_type count, i;
- unsigned int ret;
+ long ret;
/* Get the relocation fixups. */
rels = nlm_relocation_fixups (abfd);
@@ -1359,8 +1303,7 @@ nlm_canonicalize_reloc (abfd, sec, relptr, symbols)
final values. */
static bfd_boolean
-nlm_compute_section_file_positions (abfd)
- bfd *abfd;
+nlm_compute_section_file_positions (bfd *abfd)
{
file_ptr sofar;
asection *sec;
@@ -1402,21 +1345,21 @@ nlm_compute_section_file_positions (abfd)
+ nlm_variable_header (abfd)->threadNameLength + 1);
/* The auxiliary headers. */
- if (find_nonzero ((PTR) nlm_version_header (abfd),
+ if (find_nonzero (nlm_version_header (abfd),
sizeof (Nlm_Internal_Version_Header)))
sofar += sizeof (Nlm_External_Version_Header);
- if (find_nonzero ((PTR) nlm_extended_header (abfd),
+ if (find_nonzero (nlm_extended_header (abfd),
sizeof (Nlm_Internal_Extended_Header)))
sofar += sizeof (Nlm_External_Extended_Header);
- if (find_nonzero ((PTR) nlm_copyright_header (abfd),
+ if (find_nonzero (nlm_copyright_header (abfd),
sizeof (Nlm_Internal_Copyright_Header)))
sofar += (sizeof (Nlm_External_Copyright_Header)
+ nlm_copyright_header (abfd)->copyrightMessageLength + 1);
- if (find_nonzero ((PTR) nlm_custom_header (abfd),
+ if (find_nonzero (nlm_custom_header (abfd),
sizeof (Nlm_Internal_Custom_Header)))
sofar += (sizeof (Nlm_External_Custom_Header)
+ nlm_custom_header (abfd)->hdrLength);
- if (find_nonzero ((PTR) nlm_cygnus_ext_header (abfd),
+ if (find_nonzero (nlm_cygnus_ext_header (abfd),
sizeof (Nlm_Internal_Cygnus_Ext_Header)))
sofar += sizeof (Nlm_External_Custom_Header);
@@ -1433,7 +1376,7 @@ nlm_compute_section_file_positions (abfd)
data_align = 0;
bss = 0;
other_align = 0;
- for (sec = abfd->sections; sec != (asection *) NULL; sec = sec->next)
+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
{
flagword f;
@@ -1489,7 +1432,7 @@ nlm_compute_section_file_positions (abfd)
nlm_fixed_header (abfd)->dataImageSize = data;
nlm_fixed_header (abfd)->uninitializedDataSize = bss;
- for (sec = abfd->sections; sec != (asection *) NULL; sec = sec->next)
+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
{
flagword f;
@@ -1565,12 +1508,11 @@ nlm_compute_section_file_positions (abfd)
variable size header information must be known. */
bfd_boolean
-nlm_set_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- asection *section;
- const PTR location;
- file_ptr offset;
- bfd_size_type count;
+nlm_set_section_contents (bfd *abfd,
+ asection *section,
+ const void * location,
+ file_ptr offset,
+ bfd_size_type count)
{
if (! abfd->output_has_begun
&& ! nlm_compute_section_file_positions (abfd))
@@ -1586,7 +1528,7 @@ nlm_set_section_contents (abfd, section, location, offset, count)
if (section->reloc_count != 0)
{
bfd_boolean (*mangle_relocs_func)
- PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type));
+ (bfd *, asection *, const void *, bfd_vma, bfd_size_type);
mangle_relocs_func = nlm_mangle_relocs_func (abfd);
if (mangle_relocs_func != NULL)
@@ -1608,9 +1550,7 @@ nlm_set_section_contents (abfd, section, location, offset, count)
write out the external relocs. */
static int
-nlm_external_reloc_compare (p1, p2)
- const void *p1;
- const void *p2;
+nlm_external_reloc_compare (const void *p1, const void *p2)
{
const struct reloc_and_sec *r1 = (const struct reloc_and_sec *) p1;
const struct reloc_and_sec *r2 = (const struct reloc_and_sec *) p2;
@@ -1656,22 +1596,20 @@ nlm_external_reloc_compare (p1, p2)
list of outsymbols. */
bfd_boolean
-nlm_write_object_contents (abfd)
- bfd *abfd;
+nlm_write_object_contents (bfd *abfd)
{
asection *sec;
- bfd_boolean (*write_import_func) PARAMS ((bfd *, asection *, arelent *));
+ bfd_boolean (*write_import_func) (bfd *, asection *, arelent *);
bfd_size_type external_reloc_count, internal_reloc_count, i, c;
struct reloc_and_sec *external_relocs;
asymbol **sym_ptr_ptr;
file_ptr last;
- bfd_boolean (*write_prefix_func) PARAMS ((bfd *));
+ bfd_boolean (*write_prefix_func) (bfd *);
unsigned char *fixed_header = NULL;
file_ptr pos;
bfd_size_type amt;
- fixed_header = ((unsigned char *)
- bfd_malloc (nlm_fixed_header_size (abfd)));
+ fixed_header = bfd_malloc (nlm_fixed_header_size (abfd));
if (fixed_header == NULL)
goto error_return;
@@ -1713,7 +1651,7 @@ nlm_write_object_contents (abfd)
needed when they are written out below. */
internal_reloc_count = 0;
external_reloc_count = 0;
- for (sec = abfd->sections; sec != (asection *) NULL; sec = sec->next)
+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
{
arelent **rel_ptr_ptr, **rel_end;
@@ -1759,11 +1697,11 @@ nlm_write_object_contents (abfd)
symbol, so we must first gather together all the relocs against
external symbols and sort them. */
amt = external_reloc_count * sizeof (struct reloc_and_sec);
- external_relocs = (struct reloc_and_sec *) bfd_alloc (abfd, amt);
- if (external_relocs == (struct reloc_and_sec *) NULL)
+ external_relocs = bfd_alloc (abfd, amt);
+ if (external_relocs == NULL)
goto error_return;
i = 0;
- for (sec = abfd->sections; sec != (asection *) NULL; sec = sec->next)
+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
{
arelent **rel_ptr_ptr, **rel_end;
@@ -1792,7 +1730,7 @@ nlm_write_object_contents (abfd)
BFD_ASSERT (i == external_reloc_count);
/* Sort the external relocs by name. */
- qsort ((PTR) external_relocs, (size_t) external_reloc_count,
+ qsort (external_relocs, (size_t) external_reloc_count,
sizeof (struct reloc_and_sec), nlm_external_reloc_compare);
/* Write out the external relocs. */
@@ -1828,10 +1766,10 @@ nlm_write_object_contents (abfd)
/* Write out the public symbols (exports). */
sym_ptr_ptr = bfd_get_outsymbols (abfd);
- if (sym_ptr_ptr != (asymbol **) NULL)
+ if (sym_ptr_ptr != NULL)
{
- bfd_vma (*get_public_offset_func) PARAMS ((bfd *, asymbol *));
- bfd_boolean (*write_export_func) PARAMS ((bfd *, asymbol *, bfd_vma));
+ bfd_vma (*get_public_offset_func) (bfd *, asymbol *);
+ bfd_boolean (*write_export_func) (bfd *, asymbol *, bfd_vma);
asymbol **sym_end;
diff --git a/bfd/nlmswap.h b/bfd/nlmswap.h
index 2fbb102b..4ed72eb 100644
--- a/bfd/nlmswap.h
+++ b/bfd/nlmswap.h
@@ -1,24 +1,24 @@
/* NLM (NetWare Loadable Module) swapping routines for BFD.
- Copyright 1993, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1993, 2000, 2001, 2005 Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support, using ELF support as the
template.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Although this is a header file, it defines functions. It is
included by NLM backends to define swapping functions that vary
@@ -29,22 +29,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
At the moment this is only needed for one structure, the fixed NLM
file header. */
-static void nlm_swap_fixed_header_in PARAMS ((bfd *, PTR,
- Nlm_Internal_Fixed_Header *));
-static void nlm_swap_fixed_header_out PARAMS ((bfd *,
- Nlm_Internal_Fixed_Header *,
- PTR));
-
/* Translate an NLM fixed length file header in external format into an NLM
file header in internal format. */
static void
-nlm_swap_fixed_header_in (abfd, realsrc, dst)
- bfd *abfd;
- PTR realsrc;
- Nlm_Internal_Fixed_Header *dst;
+nlm_swap_fixed_header_in (bfd *abfd,
+ void * realsrc,
+ Nlm_Internal_Fixed_Header *dst)
{
Nlm_External_Fixed_Header *src = (Nlm_External_Fixed_Header *) realsrc;
+
memcpy (dst->signature, src->signature, NLM_SIGNATURE_SIZE);
memcpy (dst->moduleName, src->moduleName, NLM_MODULE_NAME_SIZE);
dst->version =
@@ -99,12 +93,12 @@ nlm_swap_fixed_header_in (abfd, realsrc, dst)
an NLM file header in external format. */
static void
-nlm_swap_fixed_header_out (abfd, src, realdst)
- bfd *abfd;
- Nlm_Internal_Fixed_Header *src;
- PTR realdst;
+nlm_swap_fixed_header_out (bfd *abfd,
+ Nlm_Internal_Fixed_Header *src,
+ void * realdst)
{
Nlm_External_Fixed_Header *dst = (Nlm_External_Fixed_Header *) realdst;
+
memset (dst, 0, sizeof *dst);
memcpy (dst->signature, src->signature, NLM_SIGNATURE_SIZE);
memcpy (dst->moduleName, src->moduleName, NLM_MODULE_NAME_SIZE);
diff --git a/bfd/pe-mips.c b/bfd/pe-mips.c
index 9d6da80..a6cc489 100644
--- a/bfd/pe-mips.c
+++ b/bfd/pe-mips.c
@@ -3,21 +3,21 @@
2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Modified from coff-i386.c by DJ Delorie, dj@cygnus.com
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define COFF_WITH_PE
#define COFF_LONG_SECTION_NAMES
@@ -26,35 +26,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
-
#include "coff/mipspe.h"
-
#include "coff/internal.h"
-
#include "coff/pe.h"
-
#include "libcoff.h"
-static bfd_reloc_status_type coff_mips_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static reloc_howto_type *coff_mips_rtype_to_howto
- PARAMS ((bfd *, asection *, struct internal_reloc *,
- struct coff_link_hash_entry *, struct internal_syment *,
- bfd_vma *));
-
-static bfd_boolean in_reloc_p
- PARAMS ((bfd *, reloc_howto_type *));
-static reloc_howto_type * coff_mips_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-static void mips_swap_reloc_in
- PARAMS ((bfd *, PTR, PTR));
-static unsigned int mips_swap_reloc_out
- PARAMS ((bfd *, PTR, PTR));
-static bfd_boolean coff_pe_mips_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
-
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
+#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 2
/* The page size is a guess based on ELF. */
#define COFF_PAGE_SIZE 0x1000
@@ -69,19 +46,17 @@ static bfd_boolean coff_pe_mips_relocate_section
reloc type to make any required adjustments. */
static bfd_reloc_status_type
-coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
- error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
+coff_mips_reloc (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section ATTRIBUTE_UNUSED,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
{
symvalue diff;
- if (output_bfd == (bfd *) NULL)
+ if (output_bfd == NULL)
return bfd_reloc_continue;
if (bfd_is_com_section (symbol->section))
@@ -105,13 +80,11 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
#endif
}
else
- {
- /* For some reason bfd_perform_relocation always effectively
- ignores the addend for a COFF target when producing
- relocatable output. This seems to be always wrong for 386
- COFF, so we handle the addend here instead. */
- diff = reloc_entry->addend;
- }
+ /* For some reason bfd_perform_relocation always effectively
+ ignores the addend for a COFF target when producing
+ relocatable output. This seems to be always wrong for 386
+ COFF, so we handle the addend here instead. */
+ diff = reloc_entry->addend;
#define DOIT(x) \
x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + (diff >> howto->rightshift)) & howto->dst_mask))
@@ -126,6 +99,7 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
case 0:
{
char x = bfd_get_8 (abfd, addr);
+
DOIT (x);
bfd_put_8 (abfd, x, addr);
}
@@ -134,6 +108,7 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
case 1:
{
short x = bfd_get_16 (abfd, addr);
+
DOIT (x);
bfd_put_16 (abfd, (bfd_vma) x, addr);
}
@@ -142,6 +117,7 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
case 2:
{
long x = bfd_get_32 (abfd, addr);
+
DOIT (x);
bfd_put_32 (abfd, (bfd_vma) x, addr);
}
@@ -161,9 +137,7 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
appear in the output .reloc section. */
static bfd_boolean
-in_reloc_p (abfd, howto)
- bfd * abfd ATTRIBUTE_UNUSED;
- reloc_howto_type *howto;
+in_reloc_p (bfd * abfd ATTRIBUTE_UNUSED, reloc_howto_type *howto)
{
return ! howto->pc_relative && howto->type != MIPS_R_RVA;
}
@@ -178,130 +152,130 @@ static reloc_howto_type howto_table[] =
/* Reloc type 0 is ignored. The reloc reading code ensures that
this is a reference to the .abs section, which will cause
bfd_perform_relocation to do nothing. */
- HOWTO (MIPS_R_ABSOLUTE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "IGNORE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (MIPS_R_ABSOLUTE, /* Type. */
+ 0, /* Rightshift. */
+ 0, /* Size (0 = byte, 1 = short, 2 = long). */
+ 8, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont, /* Complain_on_overflow. */
+ 0, /* Special_function. */
+ "IGNORE", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0, /* Src_mask. */
+ 0, /* Dst_mask. */
+ FALSE), /* Pcrel_offset. */
/* A 16 bit reference to a symbol, normally from a data section. */
- HOWTO (MIPS_R_REFHALF, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "REFHALF", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (MIPS_R_REFHALF, /* Type. */
+ 0, /* Rightshift. */
+ 1, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ coff_mips_reloc, /* Special_function. */
+ "REFHALF", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Src_mask. */
+ 0xffff, /* Dst_mask. */
+ FALSE), /* Pcrel_offset. */
/* A 32 bit reference to a symbol, normally from a data section. */
- HOWTO (MIPS_R_REFWORD, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "REFWORD", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (MIPS_R_REFWORD, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ coff_mips_reloc, /* Special_function. */
+ "REFWORD", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Src_mask. */
+ 0xffffffff, /* Dst_mask. */
+ FALSE), /* Pcrel_offset. */
/* A 26 bit absolute jump address. */
- HOWTO (MIPS_R_JMPADDR, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
+ HOWTO (MIPS_R_JMPADDR, /* Type. */
+ 2, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 26, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont, /* Complain_on_overflow. */
/* This needs complex overflow
detection, because the upper four
bits must match the PC. */
- coff_mips_reloc, /* special_function */
- "JMPADDR", /* name */
- TRUE, /* partial_inplace */
- 0x3ffffff, /* src_mask */
- 0x3ffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ coff_mips_reloc, /* Special_function. */
+ "JMPADDR", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0x3ffffff, /* Src_mask. */
+ 0x3ffffff, /* Dst_mask. */
+ FALSE), /* Pcrel_offset. */
/* The high 16 bits of a symbol value. Handled by the function
mips_refhi_reloc. */
- HOWTO (MIPS_R_REFHI, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "REFHI", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (MIPS_R_REFHI, /* Type. */
+ 16, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ coff_mips_reloc, /* Special_function. */
+ "REFHI", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Src_mask. */
+ 0xffff, /* Dst_mask. */
+ FALSE), /* Pcrel_offset. */
/* The low 16 bits of a symbol value. */
- HOWTO (MIPS_R_REFLO, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "REFLO", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (MIPS_R_REFLO, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont, /* Complain_on_overflow. */
+ coff_mips_reloc, /* Special_function. */
+ "REFLO", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Src_mask. */
+ 0xffff, /* Dst_mask. */
+ FALSE), /* Pcrel_offset. */
/* A reference to an offset from the gp register. Handled by the
function mips_gprel_reloc. */
- HOWTO (MIPS_R_GPREL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "GPREL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (MIPS_R_GPREL, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed, /* Complain_on_overflow. */
+ coff_mips_reloc, /* Special_function. */
+ "GPREL", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Src_mask. */
+ 0xffff, /* Dst_mask. */
+ FALSE), /* Pcrel_offset. */
/* A reference to a literal using an offset from the gp register.
Handled by the function mips_gprel_reloc. */
- HOWTO (MIPS_R_LITERAL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "LITERAL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (MIPS_R_LITERAL, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed, /* Complain_on_overflow. */
+ coff_mips_reloc, /* Special_function. */
+ "LITERAL", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Src_mask. */
+ 0xffff, /* Dst_mask. */
+ FALSE), /* Pcrel_offset. */
EMPTY_HOWTO (8),
EMPTY_HOWTO (9),
@@ -329,41 +303,43 @@ static reloc_howto_type howto_table[] =
EMPTY_HOWTO (31),
EMPTY_HOWTO (32),
EMPTY_HOWTO (33),
- HOWTO (MIPS_R_RVA, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "rva32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (MIPS_R_RVA, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ coff_mips_reloc, /* Special_function. */
+ "rva32", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Src_mask. */
+ 0xffffffff, /* Dst_mask. */
+ FALSE), /* Pcrel_offset. */
EMPTY_HOWTO (35),
EMPTY_HOWTO (36),
- HOWTO (MIPS_R_PAIR, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "PAIR", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (MIPS_R_PAIR, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ FALSE, /* PC_relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ coff_mips_reloc, /* Special_function. */
+ "PAIR", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Src_mask. */
+ 0xffffffff, /* Dst_mask. */
+ FALSE), /* Pcrel_offset. */
};
-/* Turn a howto into a reloc nunmber */
+/* Turn a howto into a reloc nunmber. */
+
+#define SELECT_RELOC(x, howto) { x.r_type = howto->type; }
+#define BADMAG(x) MIPSBADMAG (x)
-#define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
-#define BADMAG(x) MIPSBADMAG(x)
-#define MIPS 1 /* Customize coffcode.h */
+/* Customize coffcode.h. */
+#define MIPS 1
#define RTYPE2HOWTO(cache_ptr, dst) \
(cache_ptr)->howto = howto_table + (dst)->r_type;
@@ -383,17 +359,17 @@ static reloc_howto_type howto_table[] =
#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
{ \
- coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \
+ coff_symbol_type *coffsym = NULL; \
if (ptr && bfd_asymbol_bfd (ptr) != abfd) \
coffsym = (obj_symbols (abfd) \
+ (cache_ptr->sym_ptr_ptr - symbols)); \
else if (ptr) \
coffsym = coff_symbol_from (abfd, ptr); \
- if (coffsym != (coff_symbol_type *) NULL \
+ if (coffsym != NULL \
&& coffsym->native->u.syment.n_scnum == 0) \
cache_ptr->addend = - coffsym->native->u.syment.n_value; \
else if (ptr && bfd_asymbol_bfd (ptr) == abfd \
- && ptr->section != (asection *) NULL) \
+ && ptr->section != NULL) \
cache_ptr->addend = - (ptr->section->vma + ptr->value); \
else \
cache_ptr->addend = 0; \
@@ -404,13 +380,12 @@ static reloc_howto_type howto_table[] =
/* Convert an rtype to howto for the COFF backend linker. */
static reloc_howto_type *
-coff_mips_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec;
- struct internal_reloc *rel;
- struct coff_link_hash_entry *h;
- struct internal_syment *sym;
- bfd_vma *addendp;
+coff_mips_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec,
+ struct internal_reloc *rel,
+ struct coff_link_hash_entry *h,
+ struct internal_syment *sym,
+ bfd_vma *addendp)
{
reloc_howto_type *howto;
@@ -470,24 +445,20 @@ coff_mips_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
}
if (rel->r_type == MIPS_R_RVA)
- {
- *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase;
- }
+ *addendp -= pe_data (sec->output_section->owner)->pe_opthdr.ImageBase;
#endif
return howto;
}
-#define coff_rtype_to_howto coff_mips_rtype_to_howto
-
-#define coff_bfd_reloc_type_lookup coff_mips_reloc_type_lookup
+#define coff_rtype_to_howto coff_mips_rtype_to_howto
+#define coff_bfd_reloc_type_lookup coff_mips_reloc_type_lookup
/* Get the howto structure for a generic reloc type. */
static reloc_howto_type *
-coff_mips_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
+coff_mips_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
{
int mips_type;
@@ -519,17 +490,14 @@ coff_mips_reloc_type_lookup (abfd, code)
mips_type = MIPS_R_RVA;
break;
default:
- return (reloc_howto_type *) NULL;
+ return NULL;
}
- return &howto_table[mips_type];
+ return & howto_table [mips_type];
}
static void
-mips_swap_reloc_in (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
+mips_swap_reloc_in (bfd * abfd, void * src, void * dst)
{
static struct internal_reloc pair_prev;
RELOC *reloc_src = (RELOC *) src;
@@ -551,17 +519,13 @@ mips_swap_reloc_in (abfd, src, dst)
reloc_dst->r_offset = reloc_dst->r_symndx;
if (reloc_dst->r_offset & 0x8000)
reloc_dst->r_offset -= 0x10000;
- /*printf ("dj: pair offset is %08x\n", reloc_dst->r_offset);*/
reloc_dst->r_symndx = pair_prev.r_symndx;
break;
}
}
static unsigned int
-mips_swap_reloc_out (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
+mips_swap_reloc_out (bfd * abfd, void * src, void * dst)
{
static int prev_offset = 1;
static bfd_vma prev_addr = 0;
@@ -596,22 +560,19 @@ mips_swap_reloc_out (abfd, src, dst)
return RELSZ;
}
-#define coff_swap_reloc_in mips_swap_reloc_in
-#define coff_swap_reloc_out mips_swap_reloc_out
+#define coff_swap_reloc_in mips_swap_reloc_in
+#define coff_swap_reloc_out mips_swap_reloc_out
#define NO_COFF_RELOCS
static bfd_boolean
-coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
- input_section, contents, relocs, syms,
- sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- struct internal_reloc *relocs;
- struct internal_syment *syms;
- asection **sections;
+coff_pe_mips_relocate_section (bfd *output_bfd,
+ struct bfd_link_info *info,
+ bfd *input_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ struct internal_reloc *relocs,
+ struct internal_syment *syms,
+ asection **sections)
{
bfd_vma gp;
bfd_boolean gp_undefined;
@@ -622,28 +583,23 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
bfd_boolean got_lo;
if (info->relocatable)
- {
- (*_bfd_error_handler)
- (_("%B: `ld -r' not supported with PE MIPS objects\n"), input_bfd);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
+ {
+ (*_bfd_error_handler)
+ (_("%B: `ld -r' not supported with PE MIPS objects\n"), input_bfd);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
BFD_ASSERT (input_bfd->xvec->byteorder
== output_bfd->xvec->byteorder);
gp = _bfd_get_gp_value (output_bfd);
- if (gp == 0)
- gp_undefined = TRUE;
- else
- gp_undefined = FALSE;
-
+ gp_undefined = (gp == 0) ? TRUE : FALSE;
got_lo = FALSE;
-
adjust = 0;
-
rel = relocs;
rel_end = rel + input_section->reloc_count;
+
for (i = 0; rel < rel_end; rel++, i++)
{
long symndx;
@@ -743,8 +699,7 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
/* OK, at this point the following variables are set up:
src = VMA of the memory we're fixing up
mem = pointer to memory we're fixing up
- val = VMA of what we need to refer to
- */
+ val = VMA of what we need to refer to. */
#define UI(x) (*_bfd_error_handler) (_("%B: unimplemented %s\n"), \
input_bfd, x); \
@@ -753,23 +708,23 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
switch (rel->r_type)
{
case MIPS_R_ABSOLUTE:
- /* ignore these */
+ /* Ignore these. */
break;
case MIPS_R_REFHALF:
- UI("refhalf");
+ UI ("refhalf");
break;
case MIPS_R_REFWORD:
- tmp = bfd_get_32(input_bfd, mem);
+ tmp = bfd_get_32 (input_bfd, mem);
/* printf ("refword: src=%08x targ=%08x+%08x\n", src, tmp, val); */
tmp += val;
- bfd_put_32(input_bfd, tmp, mem);
+ bfd_put_32 (input_bfd, tmp, mem);
break;
case MIPS_R_JMPADDR:
- tmp = bfd_get_32(input_bfd, mem);
- targ = val + (tmp&0x03ffffff)*4;
+ tmp = bfd_get_32 (input_bfd, mem);
+ targ = val + (tmp & 0x03ffffff) * 4;
if ((src & 0xf0000000) != (targ & 0xf0000000))
{
(*_bfd_error_handler) (_("%B: jump too far away\n"), input_bfd);
@@ -777,12 +732,12 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
return FALSE;
}
tmp &= 0xfc000000;
- tmp |= (targ/4) & 0x3ffffff;
- bfd_put_32(input_bfd, tmp, mem);
+ tmp |= (targ / 4) & 0x3ffffff;
+ bfd_put_32 (input_bfd, tmp, mem);
break;
case MIPS_R_REFHI:
- tmp = bfd_get_32(input_bfd, mem);
+ tmp = bfd_get_32 (input_bfd, mem);
switch (rel[1].r_type)
{
case MIPS_R_PAIR:
@@ -791,7 +746,7 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
break;
case MIPS_R_REFLO:
/* GNU COFF object */
- low = bfd_get_32(input_bfd, contents + rel[1].r_vaddr);
+ low = bfd_get_32 (input_bfd, contents + rel[1].r_vaddr);
low &= 0xffff;
if (low & 0x8000)
low -= 0x10000;
@@ -805,37 +760,37 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
}
tmp &= 0xffff0000;
tmp |= (targ >> 16) & 0xffff;
- bfd_put_32(input_bfd, tmp, mem);
+ bfd_put_32 (input_bfd, tmp, mem);
break;
case MIPS_R_REFLO:
- tmp = bfd_get_32(input_bfd, mem);
+ tmp = bfd_get_32 (input_bfd, mem);
targ = val + (tmp & 0xffff);
/* printf ("refword: src=%08x targ=%08x\n", src, targ); */
tmp &= 0xffff0000;
tmp |= targ & 0xffff;
- bfd_put_32(input_bfd, tmp, mem);
+ bfd_put_32 (input_bfd, tmp, mem);
break;
case MIPS_R_GPREL:
case MIPS_R_LITERAL:
- UI("gprel");
+ UI ("gprel");
break;
case MIPS_R_SECTION:
- UI("section");
+ UI ("section");
break;
case MIPS_R_SECREL:
- UI("secrel");
+ UI ("secrel");
break;
case MIPS_R_SECRELLO:
- UI("secrello");
+ UI ("secrello");
break;
case MIPS_R_SECRELHI:
- UI("secrelhi");
+ UI ("secrelhi");
break;
case MIPS_R_RVA:
@@ -863,13 +818,8 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
a leading dot for local labels, so if TARGET_UNDERSCORE is defined
we treat all symbols starting with L as local. */
-static bfd_boolean coff_mips_is_local_label_name
- PARAMS ((bfd *, const char *));
-
static bfd_boolean
-coff_mips_is_local_label_name (abfd, name)
- bfd *abfd;
- const char *name;
+coff_mips_is_local_label_name (bfd *abfd, const char *name)
{
if (name[0] == 'L')
return TRUE;
@@ -895,57 +845,57 @@ const bfd_target
#ifdef TARGET_NAME
TARGET_NAME,
#else
- "pe-mips", /* name */
+ "pe-mips", /* Name. */
#endif
bfd_target_coff_flavour,
- BFD_ENDIAN_LITTLE, /* data byte order is little */
- BFD_ENDIAN_LITTLE, /* header byte order is little */
+ BFD_ENDIAN_LITTLE, /* Data byte order is little. */
+ BFD_ENDIAN_LITTLE, /* Header byte order is little. */
- (HAS_RELOC | EXEC_P | /* object flags */
+ (HAS_RELOC | EXEC_P | /* Object flags. */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
#ifndef COFF_WITH_PE
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* Section flags. */
| SEC_CODE | SEC_DATA),
#else
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* Section flags. */
| SEC_CODE | SEC_DATA
| SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
#endif
#ifdef TARGET_UNDERSCORE
- TARGET_UNDERSCORE, /* leading underscore */
+ TARGET_UNDERSCORE, /* Leading underscore. */
#else
0, /* leading underscore */
#endif
- '/', /* ar_pad_char */
- 15, /* ar_max_namelen */
+ '/', /* AR_pad_char. */
+ 15, /* AR_max_namelen. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-
-/* Note that we allow an object file to be treated as a core file as well. */
- {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
- bfd_generic_archive_p, coff_object_p},
- {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
- bfd_false},
- {bfd_false, coff_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (coff),
- BFD_JUMP_TABLE_COPY (coff),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
- BFD_JUMP_TABLE_SYMBOLS (coff),
- BFD_JUMP_TABLE_RELOCS (coff),
- BFD_JUMP_TABLE_WRITE (coff),
- BFD_JUMP_TABLE_LINK (coff),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */
+
+ /* Note that we allow an object file to be treated as a core file as well. */
+ {_bfd_dummy_target, coff_object_p, /* bfd_check_format. */
+ bfd_generic_archive_p, coff_object_p},
+ {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format. */
+ bfd_false},
+ {bfd_false, coff_write_object_contents, /* bfd_write_contents. */
+ _bfd_write_archive_contents, bfd_false},
+
+ BFD_JUMP_TABLE_GENERIC (coff),
+ BFD_JUMP_TABLE_COPY (coff),
+ BFD_JUMP_TABLE_CORE (_bfd_nocore),
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+ BFD_JUMP_TABLE_SYMBOLS (coff),
+ BFD_JUMP_TABLE_RELOCS (coff),
+ BFD_JUMP_TABLE_WRITE (coff),
+ BFD_JUMP_TABLE_LINK (coff),
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 810fc88..ad44e96 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -88,20 +88,9 @@
the code is in peigen.c. PowerPC NT is said to be dead. If
anybody wants to revive the code, you will have to figure out how
to handle those issues. */
-
-static void add_data_entry
- PARAMS ((bfd *, struct internal_extra_pe_aouthdr *, int, char *, bfd_vma));
-static bfd_boolean pe_print_pdata PARAMS ((bfd *, PTR));
-static bfd_boolean pe_print_reloc PARAMS ((bfd *, PTR));
-static bfd_boolean pe_print_idata PARAMS ((bfd *, PTR));
-static bfd_boolean pe_print_edata PARAMS ((bfd *, PTR));
-
void
-_bfd_XXi_swap_sym_in (abfd, ext1, in1)
- bfd *abfd;
- PTR ext1;
- PTR in1;
+_bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1)
{
SYMENT *ext = (SYMENT *) ext1;
struct internal_syment *in = (struct internal_syment *) in1;
@@ -178,7 +167,7 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1)
sec->line_filepos = 0;
sec->lineno_count = 0;
sec->userdata = NULL;
- sec->next = (asection *) NULL;
+ sec->next = NULL;
sec->alignment_power = 2;
sec->flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD;
@@ -198,10 +187,7 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1)
}
unsigned int
-_bfd_XXi_swap_sym_out (abfd, inp, extp)
- bfd *abfd;
- PTR inp;
- PTR extp;
+_bfd_XXi_swap_sym_out (bfd * abfd, void * inp, void * extp)
{
struct internal_syment *in = (struct internal_syment *) inp;
SYMENT *ext = (SYMENT *) extp;
@@ -229,14 +215,13 @@ _bfd_XXi_swap_sym_out (abfd, inp, extp)
}
void
-_bfd_XXi_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
- bfd *abfd;
- PTR ext1;
- int type;
- int class;
- int indx ATTRIBUTE_UNUSED;
- int numaux ATTRIBUTE_UNUSED;
- PTR in1;
+_bfd_XXi_swap_aux_in (bfd * abfd,
+ void * ext1,
+ int type,
+ int class,
+ int indx ATTRIBUTE_UNUSED,
+ int numaux ATTRIBUTE_UNUSED,
+ void * in1)
{
AUXENT *ext = (AUXENT *) ext1;
union internal_auxent *in = (union internal_auxent *) in1;
@@ -301,19 +286,19 @@ _bfd_XXi_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
}
unsigned int
-_bfd_XXi_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
- bfd *abfd;
- PTR inp;
- int type;
- int class;
- int indx ATTRIBUTE_UNUSED;
- int numaux ATTRIBUTE_UNUSED;
- PTR extp;
+_bfd_XXi_swap_aux_out (bfd * abfd,
+ void * inp,
+ int type,
+ int class,
+ int indx ATTRIBUTE_UNUSED,
+ int numaux ATTRIBUTE_UNUSED,
+ void * extp)
{
union internal_auxent *in = (union internal_auxent *) inp;
AUXENT *ext = (AUXENT *) extp;
- memset ((PTR) ext, 0, AUXESZ);
+ memset (ext, 0, AUXESZ);
+
switch (class)
{
case C_FILE:
@@ -375,10 +360,7 @@ _bfd_XXi_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
}
void
-_bfd_XXi_swap_lineno_in (abfd, ext1, in1)
- bfd *abfd;
- PTR ext1;
- PTR in1;
+_bfd_XXi_swap_lineno_in (bfd * abfd, void * ext1, void * in1)
{
LINENO *ext = (LINENO *) ext1;
struct internal_lineno *in = (struct internal_lineno *) in1;
@@ -388,10 +370,7 @@ _bfd_XXi_swap_lineno_in (abfd, ext1, in1)
}
unsigned int
-_bfd_XXi_swap_lineno_out (abfd, inp, outp)
- bfd *abfd;
- PTR inp;
- PTR outp;
+_bfd_XXi_swap_lineno_out (bfd * abfd, void * inp, void * outp)
{
struct internal_lineno *in = (struct internal_lineno *) inp;
struct external_lineno *ext = (struct external_lineno *) outp;
@@ -402,14 +381,13 @@ _bfd_XXi_swap_lineno_out (abfd, inp, outp)
}
void
-_bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
- bfd *abfd;
- PTR aouthdr_ext1;
- PTR aouthdr_int1;
+_bfd_XXi_swap_aouthdr_in (bfd * abfd,
+ void * aouthdr_ext1,
+ void * aouthdr_int1)
{
struct internal_extra_pe_aouthdr *a;
- PEAOUTHDR *src = (PEAOUTHDR *) (aouthdr_ext1);
- AOUTHDR *aouthdr_ext = (AOUTHDR *) aouthdr_ext1;
+ PEAOUTHDR * src = (PEAOUTHDR *) (aouthdr_ext1);
+ AOUTHDR * aouthdr_ext = (AOUTHDR *) aouthdr_ext1;
struct internal_aouthdr *aouthdr_int = (struct internal_aouthdr *)aouthdr_int1;
aouthdr_int->magic = H_GET_16 (abfd, aouthdr_ext->magic);
@@ -421,7 +399,7 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
aouthdr_int->text_start =
GET_AOUTHDR_TEXT_START (abfd, aouthdr_ext->text_start);
#ifndef COFF_WITH_pep
- /* PE32+ does not have data_start member! */
+ /* PE32+ does not have data_start member! */
aouthdr_int->data_start =
GET_AOUTHDR_DATA_START (abfd, aouthdr_ext->data_start);
#endif
@@ -490,7 +468,7 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
}
#ifndef COFF_WITH_pep
- /* PE32+ does not have data_start member! */
+ /* PE32+ does not have data_start member! */
if (aouthdr_int->dsize)
{
aouthdr_int->data_start += a->ImageBase;
@@ -511,12 +489,11 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
/* A support function for below. */
static void
-add_data_entry (abfd, aout, idx, name, base)
- bfd *abfd;
- struct internal_extra_pe_aouthdr *aout;
- int idx;
- char *name;
- bfd_vma base;
+add_data_entry (bfd * abfd,
+ struct internal_extra_pe_aouthdr *aout,
+ int idx,
+ char *name,
+ bfd_vma base)
{
asection *sec = bfd_get_section_by_name (abfd, name);
@@ -539,10 +516,7 @@ add_data_entry (abfd, aout, idx, name, base)
}
unsigned int
-_bfd_XXi_swap_aouthdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+_bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out)
{
struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *) in;
pe_data_type *pe = pe_data (abfd);
@@ -644,7 +618,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
for (sec = abfd->sections; sec; sec = sec->next)
{
- int rounded = FA(sec->size);
+ int rounded = FA (sec->size);
/* The first non-zero section filepos is the header size.
Sections without contents will have a filepos of 0. */
@@ -667,7 +641,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
aouthdr_in->dsize = dsize;
aouthdr_in->tsize = tsize;
extra->SizeOfHeaders = hsize;
- extra->SizeOfImage = SA(hsize) + isize;
+ extra->SizeOfImage = SA (hsize) + isize;
}
H_PUT_16 (abfd, aouthdr_in->magic, aouthdr_out->standard.magic);
@@ -738,10 +712,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
}
unsigned int
-_bfd_XXi_only_swap_filehdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+_bfd_XXi_only_swap_filehdr_out (bfd * abfd, void * in, void * out)
{
int idx;
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
@@ -849,10 +820,7 @@ _bfd_XXi_only_swap_filehdr_out (abfd, in, out)
}
unsigned int
-_bfd_XX_only_swap_filehdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+_bfd_XX_only_swap_filehdr_out (bfd * abfd, void * in, void * out)
{
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
FILHDR *filehdr_out = (FILHDR *) out;
@@ -869,10 +837,7 @@ _bfd_XX_only_swap_filehdr_out (abfd, in, out)
}
unsigned int
-_bfd_XXi_swap_scnhdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+_bfd_XXi_swap_scnhdr_out (bfd * abfd, void * in, void * out)
{
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
SCNHDR *scnhdr_ext = (SCNHDR *) out;
@@ -1037,24 +1002,24 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
}
static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] =
- {
- N_("Export Directory [.edata (or where ever we found it)]"),
- N_("Import Directory [parts of .idata]"),
- N_("Resource Directory [.rsrc]"),
- N_("Exception Directory [.pdata]"),
- N_("Security Directory"),
- N_("Base Relocation Directory [.reloc]"),
- N_("Debug Directory"),
- N_("Description Directory"),
- N_("Special Directory"),
- N_("Thread Storage Directory [.tls]"),
- N_("Load Configuration Directory"),
- N_("Bound Import Directory"),
- N_("Import Address Table Directory"),
- N_("Delay Import Directory"),
- N_("Reserved"),
- N_("Reserved")
- };
+{
+ N_("Export Directory [.edata (or where ever we found it)]"),
+ N_("Import Directory [parts of .idata]"),
+ N_("Resource Directory [.rsrc]"),
+ N_("Exception Directory [.pdata]"),
+ N_("Security Directory"),
+ N_("Base Relocation Directory [.reloc]"),
+ N_("Debug Directory"),
+ N_("Description Directory"),
+ N_("Special Directory"),
+ N_("Thread Storage Directory [.tls]"),
+ N_("Load Configuration Directory"),
+ N_("Bound Import Directory"),
+ N_("Import Address Table Directory"),
+ N_("Delay Import Directory"),
+ N_("Reserved"),
+ N_("Reserved")
+};
#ifdef POWERPC_LE_PE
/* The code for the PPC really falls in the "architecture dependent"
@@ -1065,9 +1030,7 @@ static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] =
#endif
static bfd_boolean
-pe_print_idata (abfd, vfile)
- bfd *abfd;
- PTR vfile;
+pe_print_idata (bfd * abfd, void * vfile)
{
FILE *file = (FILE *) vfile;
bfd_byte *data;
@@ -1270,15 +1233,13 @@ pe_print_idata (abfd, vfile)
else
{
ft_idx = first_thunk - (ft_section->vma - extra->ImageBase);
- ft_data = (bfd_byte *) bfd_malloc (datasize);
+ ft_data = bfd_malloc (datasize);
if (ft_data == NULL)
continue;
/* Read datasize bfd_bytes starting at offset ft_idx. */
- if (! bfd_get_section_contents (abfd, ft_section,
- (PTR) ft_data,
- (bfd_vma) ft_idx,
- datasize))
+ if (! bfd_get_section_contents
+ (abfd, ft_section, ft_data, (bfd_vma) ft_idx, datasize))
{
free (ft_data);
continue;
@@ -1336,9 +1297,7 @@ pe_print_idata (abfd, vfile)
}
static bfd_boolean
-pe_print_edata (abfd, vfile)
- bfd *abfd;
- PTR vfile;
+pe_print_edata (bfd * abfd, void * vfile)
{
FILE *file = (FILE *) vfile;
bfd_byte *data;
@@ -1349,17 +1308,17 @@ pe_print_edata (abfd, vfile)
bfd_signed_vma adj;
struct EDT_type
{
- long export_flags; /* reserved - should be zero */
+ long export_flags; /* Reserved - should be zero. */
long time_stamp;
short major_ver;
short minor_ver;
- bfd_vma name; /* rva - relative to image base */
- long base; /* ordinal base */
- unsigned long num_functions;/* Number in the export address table */
- unsigned long num_names; /* Number in the name pointer table */
- bfd_vma eat_addr; /* rva to the export address table */
- bfd_vma npt_addr; /* rva to the Export Name Pointer Table */
- bfd_vma ot_addr; /* rva to the Ordinal Table */
+ bfd_vma name; /* RVA - relative to image base. */
+ long base; /* Ordinal base. */
+ unsigned long num_functions;/* Number in the export address table. */
+ unsigned long num_names; /* Number in the name pointer table. */
+ bfd_vma eat_addr; /* RVA to the export address table. */
+ bfd_vma npt_addr; /* RVA to the Export Name Pointer Table. */
+ bfd_vma ot_addr; /* RVA to the Ordinal Table. */
} edt;
pe_data_type *pe = pe_data (abfd);
@@ -1407,11 +1366,11 @@ pe_print_edata (abfd, vfile)
dataoff = addr - section->vma;
datasize -= dataoff;
- data = (bfd_byte *) bfd_malloc (datasize);
+ data = bfd_malloc (datasize);
if (data == NULL)
return FALSE;
- if (! bfd_get_section_contents (abfd, section, (PTR) data,
+ if (! bfd_get_section_contents (abfd, section, data,
(file_ptr) dataoff, datasize))
return FALSE;
@@ -1488,8 +1447,7 @@ pe_print_edata (abfd, vfile)
{
long export_rva;
long forwarder_rva;
- } export_address_table_entry;
- */
+ } export_address_table_entry; */
fprintf (file,
_("\nExport Address Table -- Ordinal Base %ld\n"),
@@ -1559,9 +1517,7 @@ pe_print_edata (abfd, vfile)
covers and the address of the corresponding unwind info data. */
static bfd_boolean
-pe_print_pdata (abfd, vfile)
- bfd *abfd;
- PTR vfile;
+pe_print_pdata (bfd * abfd, void * vfile)
{
#ifdef COFF_WITH_pep
# define PDATA_ROW_SIZE (3*8)
@@ -1602,7 +1558,7 @@ pe_print_pdata (abfd, vfile)
if (datasize == 0)
return TRUE;
- if (!bfd_malloc_and_get_section (abfd, section, &data))
+ if (! bfd_malloc_and_get_section (abfd, section, &data))
{
if (data != NULL)
free (data);
@@ -1654,12 +1610,12 @@ pe_print_pdata (abfd, vfile)
if (eh_handler == 0 && eh_data != 0)
{
/* Special bits here, although the meaning may be a little
- mysterious. The only one I know for sure is 0x03. */
- /* Code Significance */
- /* 0x00 None */
- /* 0x01 Register Save Millicode */
- /* 0x02 Register Restore Millicode */
- /* 0x03 Glue Code Sequence */
+ mysterious. The only one I know for sure is 0x03
+ Code Significance
+ 0x00 None
+ 0x01 Register Save Millicode
+ 0x02 Register Restore Millicode
+ 0x03 Glue Code Sequence. */
switch (eh_data)
{
case 0x01:
@@ -1686,26 +1642,24 @@ pe_print_pdata (abfd, vfile)
#define IMAGE_REL_BASED_HIGHADJ 4
static const char * const tbl[] =
- {
- "ABSOLUTE",
- "HIGH",
- "LOW",
- "HIGHLOW",
- "HIGHADJ",
- "MIPS_JMPADDR",
- "SECTION",
- "REL32",
- "RESERVED1",
- "MIPS_JMPADDR16",
- "DIR64",
- "HIGH3ADJ"
- "UNKNOWN", /* MUST be last */
- };
+{
+ "ABSOLUTE",
+ "HIGH",
+ "LOW",
+ "HIGHLOW",
+ "HIGHADJ",
+ "MIPS_JMPADDR",
+ "SECTION",
+ "REL32",
+ "RESERVED1",
+ "MIPS_JMPADDR16",
+ "DIR64",
+ "HIGH3ADJ"
+ "UNKNOWN", /* MUST be last. */
+};
static bfd_boolean
-pe_print_reloc (abfd, vfile)
- bfd *abfd;
- PTR vfile;
+pe_print_reloc (bfd * abfd, void * vfile)
{
FILE *file = (FILE *) vfile;
bfd_byte *data = 0;
@@ -1724,7 +1678,7 @@ pe_print_reloc (abfd, vfile)
_("\n\nPE File Base Relocations (interpreted .reloc section contents)\n"));
datasize = section->size;
- if (!bfd_malloc_and_get_section (abfd, section, &data))
+ if (! bfd_malloc_and_get_section (abfd, section, &data))
{
if (data != NULL)
free (data);
@@ -1791,9 +1745,7 @@ pe_print_reloc (abfd, vfile)
/* Print out the program headers. */
bfd_boolean
-_bfd_XX_print_private_bfd_data_common (abfd, vfile)
- bfd *abfd;
- PTR vfile;
+_bfd_XX_print_private_bfd_data_common (bfd * abfd, void * vfile)
{
FILE *file = (FILE *) vfile;
int j;
@@ -1909,8 +1861,7 @@ _bfd_XX_print_private_bfd_data_common (abfd, vfile)
to the output bfd. */
bfd_boolean
-_bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd)
- bfd *ibfd, *obfd;
+_bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd)
{
/* One day we may try to grok other private data. */
if (ibfd->xvec->flavour != bfd_target_coff_flavour
@@ -1933,11 +1884,10 @@ _bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd)
/* Copy private section data. */
bfd_boolean
-_bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
- bfd *ibfd;
- asection *isec;
- bfd *obfd;
- asection *osec;
+_bfd_XX_bfd_copy_private_section_data (bfd *ibfd,
+ asection *isec,
+ bfd *obfd,
+ asection *osec)
{
if (bfd_get_flavour (ibfd) != bfd_target_coff_flavour
|| bfd_get_flavour (obfd) != bfd_target_coff_flavour)
@@ -1949,7 +1899,7 @@ _bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
if (coff_section_data (obfd, osec) == NULL)
{
bfd_size_type amt = sizeof (struct coff_section_tdata);
- osec->used_by_bfd = (PTR) bfd_zalloc (obfd, amt);
+ osec->used_by_bfd = bfd_zalloc (obfd, amt);
if (osec->used_by_bfd == NULL)
return FALSE;
}
@@ -1957,7 +1907,7 @@ _bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
if (pei_section_data (obfd, osec) == NULL)
{
bfd_size_type amt = sizeof (struct pei_section_tdata);
- coff_section_data (obfd, osec)->tdata = (PTR) bfd_zalloc (obfd, amt);
+ coff_section_data (obfd, osec)->tdata = bfd_zalloc (obfd, amt);
if (coff_section_data (obfd, osec)->tdata == NULL)
return FALSE;
}
@@ -1972,10 +1922,7 @@ _bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
}
void
-_bfd_XX_get_symbol_info (abfd, symbol, ret)
- bfd *abfd;
- asymbol *symbol;
- symbol_info *ret;
+_bfd_XX_get_symbol_info (bfd * abfd, asymbol *symbol, symbol_info *ret)
{
coff_get_symbol_info (abfd, symbol, ret);
}
@@ -1984,9 +1931,7 @@ _bfd_XX_get_symbol_info (abfd, symbol, ret)
access. */
bfd_boolean
-_bfd_XXi_final_link_postscript (abfd, pfinfo)
- bfd *abfd;
- struct coff_final_link_info *pfinfo;
+_bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo)
{
struct coff_link_hash_entry *h1;
struct bfd_link_info *info = pfinfo->info;
diff --git a/bfd/peicode.h b/bfd/peicode.h
index fc9e4d6..bfc6642 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -55,8 +55,7 @@
#include "libpei.h"
-static bfd_boolean (*pe_saved_coff_bfd_print_private_bfd_data)
- PARAMS ((bfd *, PTR)) =
+static bfd_boolean (*pe_saved_coff_bfd_print_private_bfd_data) (bfd *, void *) =
#ifndef coff_bfd_print_private_bfd_data
NULL;
#else
@@ -64,11 +63,10 @@ static bfd_boolean (*pe_saved_coff_bfd_print_private_bfd_data)
#undef coff_bfd_print_private_bfd_data
#endif
-static bfd_boolean pe_print_private_bfd_data PARAMS ((bfd *, PTR));
+static bfd_boolean pe_print_private_bfd_data (bfd *, void *);
#define coff_bfd_print_private_bfd_data pe_print_private_bfd_data
-static bfd_boolean (*pe_saved_coff_bfd_copy_private_bfd_data)
- PARAMS ((bfd *, bfd *)) =
+static bfd_boolean (*pe_saved_coff_bfd_copy_private_bfd_data) (bfd *, bfd *) =
#ifndef coff_bfd_copy_private_bfd_data
NULL;
#else
@@ -76,21 +74,12 @@ static bfd_boolean (*pe_saved_coff_bfd_copy_private_bfd_data)
#undef coff_bfd_copy_private_bfd_data
#endif
-static bfd_boolean pe_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *));
+static bfd_boolean pe_bfd_copy_private_bfd_data (bfd *, bfd *);
#define coff_bfd_copy_private_bfd_data pe_bfd_copy_private_bfd_data
#define coff_mkobject pe_mkobject
#define coff_mkobject_hook pe_mkobject_hook
-#ifndef NO_COFF_RELOCS
-static void coff_swap_reloc_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_reloc_out PARAMS ((bfd *, PTR, PTR));
-#endif
-static void coff_swap_filehdr_in PARAMS ((bfd *, PTR, PTR));
-static void coff_swap_scnhdr_in PARAMS ((bfd *, PTR, PTR));
-static bfd_boolean pe_mkobject PARAMS ((bfd *));
-static PTR pe_mkobject_hook PARAMS ((bfd *, PTR, PTR));
-
#ifdef COFF_IMAGE_WITH_PE
/* This structure contains static variables used by the ILF code. */
typedef asection * asection_ptr;
@@ -131,66 +120,53 @@ typedef struct
}
pe_ILF_vars;
#endif /* COFF_IMAGE_WITH_PE */
-
-/**********************************************************************/
-
+
#ifndef NO_COFF_RELOCS
static void
-coff_swap_reloc_in (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
+coff_swap_reloc_in (bfd * abfd, void * src, void * dst)
{
RELOC *reloc_src = (RELOC *) src;
struct internal_reloc *reloc_dst = (struct internal_reloc *) dst;
- reloc_dst->r_vaddr = H_GET_32 (abfd, reloc_src->r_vaddr);
+ reloc_dst->r_vaddr = H_GET_32 (abfd, reloc_src->r_vaddr);
reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx);
-
- reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type);
-
+ reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type);
#ifdef SWAP_IN_RELOC_OFFSET
reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET (abfd, reloc_src->r_offset);
#endif
}
static unsigned int
-coff_swap_reloc_out (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
+coff_swap_reloc_out (bfd * abfd, void * src, void * dst)
{
- struct internal_reloc *reloc_src = (struct internal_reloc *)src;
- struct external_reloc *reloc_dst = (struct external_reloc *)dst;
+ struct internal_reloc *reloc_src = (struct internal_reloc *) src;
+ struct external_reloc *reloc_dst = (struct external_reloc *) dst;
+
H_PUT_32 (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
-
H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type);
-#ifdef SWAP_OUT_RELOC_OFFSET
+#ifdef SWAP_OUT_RELOC_OFFSET
SWAP_OUT_RELOC_OFFSET (abfd, reloc_src->r_offset, reloc_dst->r_offset);
#endif
#ifdef SWAP_OUT_RELOC_EXTRA
- SWAP_OUT_RELOC_EXTRA(abfd, reloc_src, reloc_dst);
+ SWAP_OUT_RELOC_EXTRA (abfd, reloc_src, reloc_dst);
#endif
return RELSZ;
}
#endif /* not NO_COFF_RELOCS */
static void
-coff_swap_filehdr_in (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
+coff_swap_filehdr_in (bfd * abfd, void * src, void * dst)
{
FILHDR *filehdr_src = (FILHDR *) src;
struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst;
- filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic);
- filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src-> f_nscns);
- filehdr_dst->f_timdat = H_GET_32 (abfd, filehdr_src-> f_timdat);
- filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src-> f_nsyms);
- filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src-> f_flags);
+ filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic);
+ filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src->f_nscns);
+ filehdr_dst->f_timdat = H_GET_32 (abfd, filehdr_src->f_timdat);
+ filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src->f_nsyms);
+ filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src->f_flags);
filehdr_dst->f_symptr = H_GET_32 (abfd, filehdr_src->f_symptr);
/* Other people's tools sometimes generate headers with an nsyms but
@@ -211,22 +187,20 @@ coff_swap_filehdr_in (abfd, src, dst)
#endif
static void
-coff_swap_scnhdr_in (abfd, ext, in)
- bfd *abfd;
- PTR ext;
- PTR in;
+coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in)
{
SCNHDR *scnhdr_ext = (SCNHDR *) ext;
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
- memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof (scnhdr_int->s_name));
- scnhdr_int->s_vaddr = GET_SCNHDR_VADDR (abfd, scnhdr_ext->s_vaddr);
- scnhdr_int->s_paddr = GET_SCNHDR_PADDR (abfd, scnhdr_ext->s_paddr);
- scnhdr_int->s_size = GET_SCNHDR_SIZE (abfd, scnhdr_ext->s_size);
- scnhdr_int->s_scnptr = GET_SCNHDR_SCNPTR (abfd, scnhdr_ext->s_scnptr);
- scnhdr_int->s_relptr = GET_SCNHDR_RELPTR (abfd, scnhdr_ext->s_relptr);
+ memcpy (scnhdr_int->s_name, scnhdr_ext->s_name, sizeof (scnhdr_int->s_name));
+
+ scnhdr_int->s_vaddr = GET_SCNHDR_VADDR (abfd, scnhdr_ext->s_vaddr);
+ scnhdr_int->s_paddr = GET_SCNHDR_PADDR (abfd, scnhdr_ext->s_paddr);
+ scnhdr_int->s_size = GET_SCNHDR_SIZE (abfd, scnhdr_ext->s_size);
+ scnhdr_int->s_scnptr = GET_SCNHDR_SCNPTR (abfd, scnhdr_ext->s_scnptr);
+ scnhdr_int->s_relptr = GET_SCNHDR_RELPTR (abfd, scnhdr_ext->s_relptr);
scnhdr_int->s_lnnoptr = GET_SCNHDR_LNNOPTR (abfd, scnhdr_ext->s_lnnoptr);
- scnhdr_int->s_flags = H_GET_32 (abfd, scnhdr_ext->s_flags);
+ scnhdr_int->s_flags = H_GET_32 (abfd, scnhdr_ext->s_flags);
/* MS handles overflow of line numbers by carrying into the reloc
field (it appears). Since it's supposed to be zero for PE
@@ -255,20 +229,16 @@ coff_swap_scnhdr_in (abfd, ext, in)
&& (((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0
&& (! bfd_pe_executable_p (abfd) || scnhdr_int->s_size == 0))
|| (bfd_pe_executable_p (abfd) && scnhdr_int->s_size > scnhdr_int->s_paddr)))
- {
- scnhdr_int->s_size = scnhdr_int->s_paddr;
-
- /* This code used to set scnhdr_int->s_paddr to 0. However,
- coff_set_alignment_hook stores s_paddr in virt_size, which
- only works if it correctly holds the virtual size of the
- section. */
- }
+ /* This code used to set scnhdr_int->s_paddr to 0. However,
+ coff_set_alignment_hook stores s_paddr in virt_size, which
+ only works if it correctly holds the virtual size of the
+ section. */
+ scnhdr_int->s_size = scnhdr_int->s_paddr;
#endif
}
static bfd_boolean
-pe_mkobject (abfd)
- bfd * abfd;
+pe_mkobject (bfd * abfd)
{
pe_data_type *pe;
bfd_size_type amt = sizeof (pe_data_type);
@@ -296,11 +266,11 @@ pe_mkobject (abfd)
}
/* Create the COFF backend specific information. */
-static PTR
-pe_mkobject_hook (abfd, filehdr, aouthdr)
- bfd * abfd;
- PTR filehdr;
- PTR aouthdr ATTRIBUTE_UNUSED;
+
+static void *
+pe_mkobject_hook (bfd * abfd,
+ void * filehdr,
+ void * aouthdr ATTRIBUTE_UNUSED)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
pe_data_type *pe;
@@ -337,7 +307,7 @@ pe_mkobject_hook (abfd, filehdr, aouthdr)
#ifdef COFF_IMAGE_WITH_PE
if (aouthdr)
- pe->pe_opthdr = ((struct internal_aouthdr *)aouthdr)->pe;
+ pe->pe_opthdr = ((struct internal_aouthdr *) aouthdr)->pe;
#endif
#ifdef ARM
@@ -345,35 +315,30 @@ pe_mkobject_hook (abfd, filehdr, aouthdr)
coff_data (abfd) ->flags = 0;
#endif
- return (PTR) pe;
+ return (void *) pe;
}
static bfd_boolean
-pe_print_private_bfd_data (abfd, vfile)
- bfd *abfd;
- PTR vfile;
+pe_print_private_bfd_data (bfd *abfd, void * vfile)
{
FILE *file = (FILE *) vfile;
if (!_bfd_XX_print_private_bfd_data_common (abfd, vfile))
return FALSE;
- if (pe_saved_coff_bfd_print_private_bfd_data != NULL)
- {
- fputc ('\n', file);
+ if (pe_saved_coff_bfd_print_private_bfd_data == NULL)
+ return TRUE;
- return pe_saved_coff_bfd_print_private_bfd_data (abfd, vfile);
- }
+ fputc ('\n', file);
- return TRUE;
+ return pe_saved_coff_bfd_print_private_bfd_data (abfd, vfile);
}
/* Copy any private info we understand from the input bfd
to the output bfd. */
static bfd_boolean
-pe_bfd_copy_private_bfd_data (ibfd, obfd)
- bfd *ibfd, *obfd;
+pe_bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
/* PR binutils/716: Copy the large address aware flag.
XXX: Should we be copying other flags or other fields in the pe_data()
@@ -428,14 +393,14 @@ pe_bfd_copy_private_bfd_data (ibfd, obfd)
#define NUM_ILF_SECTIONS 6
#define NUM_ILF_SYMS (2 + NUM_ILF_SECTIONS)
-#define SIZEOF_ILF_SYMS (NUM_ILF_SYMS * sizeof (* vars.sym_cache))
-#define SIZEOF_ILF_SYM_TABLE (NUM_ILF_SYMS * sizeof (* vars.sym_table))
-#define SIZEOF_ILF_NATIVE_SYMS (NUM_ILF_SYMS * sizeof (* vars.native_syms))
+#define SIZEOF_ILF_SYMS (NUM_ILF_SYMS * sizeof (* vars.sym_cache))
+#define SIZEOF_ILF_SYM_TABLE (NUM_ILF_SYMS * sizeof (* vars.sym_table))
+#define SIZEOF_ILF_NATIVE_SYMS (NUM_ILF_SYMS * sizeof (* vars.native_syms))
#define SIZEOF_ILF_SYM_PTR_TABLE (NUM_ILF_SYMS * sizeof (* vars.sym_ptr_table))
-#define SIZEOF_ILF_EXT_SYMS (NUM_ILF_SYMS * sizeof (* vars.esym_table))
-#define SIZEOF_ILF_RELOCS (NUM_ILF_RELOCS * sizeof (* vars.reltab))
-#define SIZEOF_ILF_INT_RELOCS (NUM_ILF_RELOCS * sizeof (* vars.int_reltab))
-#define SIZEOF_ILF_STRINGS (strlen (symbol_name) * 2 + 8 \
+#define SIZEOF_ILF_EXT_SYMS (NUM_ILF_SYMS * sizeof (* vars.esym_table))
+#define SIZEOF_ILF_RELOCS (NUM_ILF_RELOCS * sizeof (* vars.reltab))
+#define SIZEOF_ILF_INT_RELOCS (NUM_ILF_RELOCS * sizeof (* vars.int_reltab))
+#define SIZEOF_ILF_STRINGS (strlen (symbol_name) * 2 + 8 \
+ 21 + strlen (source_dll) \
+ NUM_ILF_SECTIONS * 9 \
+ STRING_SIZE_SIZE)
@@ -465,12 +430,13 @@ pe_bfd_copy_private_bfd_data (ibfd, obfd)
+ MAX_TEXT_SECTION_SIZE
/* Create an empty relocation against the given symbol. */
+
static void
-pe_ILF_make_a_symbol_reloc (pe_ILF_vars * vars,
- bfd_vma address,
- bfd_reloc_code_real_type reloc,
- struct bfd_symbol ** sym,
- unsigned int sym_index)
+pe_ILF_make_a_symbol_reloc (pe_ILF_vars * vars,
+ bfd_vma address,
+ bfd_reloc_code_real_type reloc,
+ struct bfd_symbol ** sym,
+ unsigned int sym_index)
{
arelent * entry;
struct internal_reloc * internal;
@@ -493,6 +459,7 @@ pe_ILF_make_a_symbol_reloc (pe_ILF_vars * vars,
}
/* Create an empty relocation against the given section. */
+
static void
pe_ILF_make_a_reloc (pe_ILF_vars * vars,
bfd_vma address,
@@ -504,6 +471,7 @@ pe_ILF_make_a_reloc (pe_ILF_vars * vars,
}
/* Move the queued relocs into the given section. */
+
static void
pe_ILF_save_relocs (pe_ILF_vars * vars,
asection_ptr sec)
@@ -528,6 +496,7 @@ pe_ILF_save_relocs (pe_ILF_vars * vars,
}
/* Create a global symbol and add it to the relevant tables. */
+
static void
pe_ILF_make_a_symbol (pe_ILF_vars * vars,
const char * prefix,
@@ -605,6 +574,7 @@ pe_ILF_make_a_symbol (pe_ILF_vars * vars,
}
/* Create a section. */
+
static asection_ptr
pe_ILF_make_a_section (pe_ILF_vars * vars,
const char * name,
@@ -728,6 +698,7 @@ static jump_table jtab[] =
#endif
/* Build a full BFD from the information supplied in a ILF object. */
+
static bfd_boolean
pe_ILF_build_a_bfd (bfd * abfd,
unsigned int magic,
@@ -988,7 +959,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
|| ! bfd_coff_set_arch_mach_hook (abfd, & internal_f))
return FALSE;
- if (bfd_coff_mkobject_hook (abfd, (PTR) & internal_f, NULL) == NULL)
+ if (bfd_coff_mkobject_hook (abfd, (void *) & internal_f, NULL) == NULL)
return FALSE;
coff_data (abfd)->pe = 1;
@@ -1001,7 +972,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
/* Switch from file contents to memory contents. */
bfd_cache_close (abfd);
- abfd->iostream = (PTR) vars.bim;
+ abfd->iostream = (void *) vars.bim;
abfd->flags |= BFD_IN_MEMORY /* | HAS_LOCALS */;
abfd->where = 0;
obj_sym_filepos (abfd) = 0;
@@ -1039,7 +1010,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
obj_raw_syments (abfd) = vars.native_syms;
obj_raw_syment_count (abfd) = vars.sym_index;
- obj_coff_external_syms (abfd) = (PTR) vars.esym_table;
+ obj_coff_external_syms (abfd) = (void *) vars.esym_table;
obj_coff_keep_syms (abfd) = TRUE;
obj_convert (abfd) = vars.sym_table;
@@ -1055,6 +1026,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
/* We have detected a Image Library Format archive element.
Decode the element and return the appropriate target. */
+
static const bfd_target *
pe_ILF_object_p (bfd * abfd)
{
diff --git a/bfd/vms-gsd.c b/bfd/vms-gsd.c
index 7119dec..95b8d51 100644
--- a/bfd/vms-gsd.c
+++ b/bfd/vms-gsd.c
@@ -8,19 +8,19 @@
Written by Klaus K"ampf (kkaempf@rmi.de)
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -29,15 +29,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "vms.h"
-/*-----------------------------------------------------------------------------*/
-
-/* typical sections for vax object files */
+/* Typical sections for vax object files. */
#define VAX_CODE_NAME "$CODE"
#define VAX_DATA_NAME "$DATA"
#define VAX_ADDRESS_DATA_NAME "$ADDRESS_DATA"
-/* typical sections for evax object files */
+/* Typical sections for evax object files. */
#define EVAX_ABS_NAME "$ABS$"
#define EVAX_CODE_NAME "$CODE$"
@@ -50,113 +48,112 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define EVAX_COMMON_NAME "$COMMON$"
#define EVAX_LOCAL_NAME "$LOCAL$"
-struct sec_flags_struct {
- char *name; /* name of section */
+struct sec_flags_struct
+{
+ char *name; /* Name of section. */
int vflags_always;
- flagword flags_always; /* flags we set always */
+ flagword flags_always; /* Flags we set always. */
int vflags_hassize;
- flagword flags_hassize; /* flags we set if the section has a size > 0 */
+ flagword flags_hassize; /* Flags we set if the section has a size > 0. */
};
-/* These flags are deccrtl/vaxcrtl (openVMS 6.2 VAX) compatible */
-
-static struct sec_flags_struct vax_section_flags[] = {
- { VAX_CODE_NAME,
- (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_SHR|GPS_S_M_EXE|GPS_S_M_RD),
- (SEC_CODE),
- (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_SHR|GPS_S_M_EXE|GPS_S_M_RD),
- (SEC_IN_MEMORY|SEC_CODE|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) },
- { VAX_DATA_NAME,
- (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_RD|GPS_S_M_WRT),
- (SEC_DATA),
- (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_RD|GPS_S_M_WRT),
- (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) },
- { VAX_ADDRESS_DATA_NAME,
- (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_RD),
- (SEC_DATA|SEC_READONLY),
- (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_RD),
- (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_READONLY|SEC_LOAD) },
- { NULL,
- (GPS_S_M_PIC|GPS_S_M_OVR|GPS_S_M_REL|GPS_S_M_GBL|GPS_S_M_RD|GPS_S_M_WRT),
- (SEC_DATA),
- (GPS_S_M_PIC|GPS_S_M_OVR|GPS_S_M_REL|GPS_S_M_GBL|GPS_S_M_RD|GPS_S_M_WRT),
- (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) }
-};
+/* These flags are deccrtl/vaxcrtl (openVMS 6.2 VAX) compatible. */
-/* These flags are deccrtl/vaxcrtl (openVMS 6.2 Alpha) compatible */
-
-static struct sec_flags_struct evax_section_flags[] = {
- { EVAX_ABS_NAME,
- (EGPS_S_V_SHR),
- (SEC_DATA),
- (EGPS_S_V_SHR),
- (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) },
- { EVAX_CODE_NAME,
- (EGPS_S_V_PIC|EGPS_S_V_REL|EGPS_S_V_SHR|EGPS_S_V_EXE),
- (SEC_CODE),
- (EGPS_S_V_PIC|EGPS_S_V_REL|EGPS_S_V_SHR|EGPS_S_V_EXE),
- (SEC_IN_MEMORY|SEC_CODE|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) },
- { EVAX_LITERAL_NAME,
- (EGPS_S_V_PIC|EGPS_S_V_REL|EGPS_S_V_SHR|EGPS_S_V_RD|EGPS_S_V_NOMOD),
- (SEC_DATA|SEC_READONLY),
- (EGPS_S_V_PIC|EGPS_S_V_REL|EGPS_S_V_SHR|EGPS_S_V_RD),
- (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_READONLY|SEC_LOAD) },
- { EVAX_LINK_NAME,
- (EGPS_S_V_REL|EGPS_S_V_RD),
- (SEC_DATA|SEC_READONLY),
- (EGPS_S_V_REL|EGPS_S_V_RD),
- (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_READONLY|SEC_LOAD) },
- { EVAX_DATA_NAME,
- (EGPS_S_V_REL|EGPS_S_V_RD|EGPS_S_V_WRT|EGPS_S_V_NOMOD),
- (SEC_DATA),
- (EGPS_S_V_REL|EGPS_S_V_RD|EGPS_S_V_WRT),
- (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) },
- { EVAX_BSS_NAME,
- (EGPS_S_V_REL|EGPS_S_V_RD|EGPS_S_V_WRT|EGPS_S_V_NOMOD),
- (SEC_NO_FLAGS),
- (EGPS_S_V_REL|EGPS_S_V_RD|EGPS_S_V_WRT|EGPS_S_V_NOMOD),
- (SEC_IN_MEMORY|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) },
- { EVAX_READONLYADDR_NAME,
- (EGPS_S_V_PIC|EGPS_S_V_REL|EGPS_S_V_RD),
- (SEC_DATA|SEC_READONLY),
- (EGPS_S_V_PIC|EGPS_S_V_REL|EGPS_S_V_RD),
- (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_READONLY|SEC_LOAD) },
- { EVAX_READONLY_NAME,
- (EGPS_S_V_PIC|EGPS_S_V_REL|EGPS_S_V_SHR|EGPS_S_V_RD|EGPS_S_V_NOMOD),
- (SEC_DATA|SEC_READONLY),
- (EGPS_S_V_PIC|EGPS_S_V_REL|EGPS_S_V_SHR|EGPS_S_V_RD),
- (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_READONLY|SEC_LOAD) },
- { EVAX_LOCAL_NAME,
- (EGPS_S_V_REL|EGPS_S_V_RD|EGPS_S_V_WRT),
- (SEC_DATA),
- (EGPS_S_V_REL|EGPS_S_V_RD|EGPS_S_V_WRT),
- (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) },
- { NULL,
- (EGPS_S_V_REL|EGPS_S_V_RD|EGPS_S_V_WRT),
- (SEC_DATA),
- (EGPS_S_V_REL|EGPS_S_V_RD|EGPS_S_V_WRT),
- (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) }
-};
+static struct sec_flags_struct vax_section_flags[] =
+ {
+ { VAX_CODE_NAME,
+ (GPS_S_M_PIC | GPS_S_M_REL | GPS_S_M_SHR | GPS_S_M_EXE | GPS_S_M_RD),
+ (SEC_CODE),
+ (GPS_S_M_PIC | GPS_S_M_REL | GPS_S_M_SHR | GPS_S_M_EXE | GPS_S_M_RD),
+ (SEC_IN_MEMORY | SEC_CODE | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD) },
+ { VAX_DATA_NAME,
+ (GPS_S_M_PIC | GPS_S_M_REL | GPS_S_M_RD | GPS_S_M_WRT),
+ (SEC_DATA),
+ (GPS_S_M_PIC | GPS_S_M_REL | GPS_S_M_RD | GPS_S_M_WRT),
+ (SEC_IN_MEMORY | SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD) },
+ { VAX_ADDRESS_DATA_NAME,
+ (GPS_S_M_PIC | GPS_S_M_REL | GPS_S_M_RD),
+ (SEC_DATA | SEC_READONLY),
+ (GPS_S_M_PIC | GPS_S_M_REL | GPS_S_M_RD),
+ (SEC_IN_MEMORY | SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_READONLY | SEC_LOAD) },
+ { NULL,
+ (GPS_S_M_PIC | GPS_S_M_OVR | GPS_S_M_REL | GPS_S_M_GBL | GPS_S_M_RD | GPS_S_M_WRT),
+ (SEC_DATA),
+ (GPS_S_M_PIC | GPS_S_M_OVR | GPS_S_M_REL | GPS_S_M_GBL | GPS_S_M_RD | GPS_S_M_WRT),
+ (SEC_IN_MEMORY | SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD) }
+ };
+
+/* These flags are deccrtl/vaxcrtl (openVMS 6.2 Alpha) compatible. */
-static flagword vms_secflag_by_name PARAMS ((bfd *, struct sec_flags_struct *, char *, int));
-static flagword vms_esecflag_by_name PARAMS ((struct sec_flags_struct *, char *, int));
+static struct sec_flags_struct evax_section_flags[] =
+ {
+ { EVAX_ABS_NAME,
+ (EGPS_S_V_SHR),
+ (SEC_DATA),
+ (EGPS_S_V_SHR),
+ (SEC_IN_MEMORY | SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD) },
+ { EVAX_CODE_NAME,
+ (EGPS_S_V_PIC | EGPS_S_V_REL | EGPS_S_V_SHR | EGPS_S_V_EXE),
+ (SEC_CODE),
+ (EGPS_S_V_PIC | EGPS_S_V_REL | EGPS_S_V_SHR | EGPS_S_V_EXE),
+ (SEC_IN_MEMORY | SEC_CODE | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD) },
+ { EVAX_LITERAL_NAME,
+ (EGPS_S_V_PIC | EGPS_S_V_REL | EGPS_S_V_SHR | EGPS_S_V_RD | EGPS_S_V_NOMOD),
+ (SEC_DATA | SEC_READONLY),
+ (EGPS_S_V_PIC | EGPS_S_V_REL | EGPS_S_V_SHR | EGPS_S_V_RD),
+ (SEC_IN_MEMORY | SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_READONLY | SEC_LOAD) },
+ { EVAX_LINK_NAME,
+ (EGPS_S_V_REL | EGPS_S_V_RD),
+ (SEC_DATA | SEC_READONLY),
+ (EGPS_S_V_REL | EGPS_S_V_RD),
+ (SEC_IN_MEMORY | SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_READONLY | SEC_LOAD) },
+ { EVAX_DATA_NAME,
+ (EGPS_S_V_REL | EGPS_S_V_RD | EGPS_S_V_WRT | EGPS_S_V_NOMOD),
+ (SEC_DATA),
+ (EGPS_S_V_REL | EGPS_S_V_RD | EGPS_S_V_WRT),
+ (SEC_IN_MEMORY | SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD) },
+ { EVAX_BSS_NAME,
+ (EGPS_S_V_REL | EGPS_S_V_RD | EGPS_S_V_WRT | EGPS_S_V_NOMOD),
+ (SEC_NO_FLAGS),
+ (EGPS_S_V_REL | EGPS_S_V_RD | EGPS_S_V_WRT | EGPS_S_V_NOMOD),
+ (SEC_IN_MEMORY | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD) },
+ { EVAX_READONLYADDR_NAME,
+ (EGPS_S_V_PIC | EGPS_S_V_REL | EGPS_S_V_RD),
+ (SEC_DATA | SEC_READONLY),
+ (EGPS_S_V_PIC | EGPS_S_V_REL | EGPS_S_V_RD),
+ (SEC_IN_MEMORY | SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_READONLY | SEC_LOAD) },
+ { EVAX_READONLY_NAME,
+ (EGPS_S_V_PIC | EGPS_S_V_REL | EGPS_S_V_SHR | EGPS_S_V_RD | EGPS_S_V_NOMOD),
+ (SEC_DATA | SEC_READONLY),
+ (EGPS_S_V_PIC | EGPS_S_V_REL | EGPS_S_V_SHR | EGPS_S_V_RD),
+ (SEC_IN_MEMORY | SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_READONLY | SEC_LOAD) },
+ { EVAX_LOCAL_NAME,
+ (EGPS_S_V_REL | EGPS_S_V_RD | EGPS_S_V_WRT),
+ (SEC_DATA),
+ (EGPS_S_V_REL | EGPS_S_V_RD | EGPS_S_V_WRT),
+ (SEC_IN_MEMORY | SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD) },
+ { NULL,
+ (EGPS_S_V_REL | EGPS_S_V_RD | EGPS_S_V_WRT),
+ (SEC_DATA),
+ (EGPS_S_V_REL | EGPS_S_V_RD | EGPS_S_V_WRT),
+ (SEC_IN_MEMORY | SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD) }
+ };
-/* Retrieve bfd section flags by name and size */
+/* Retrieve bfd section flags by name and size. */
static flagword
-vms_secflag_by_name (abfd, section_flags, name, hassize)
- bfd *abfd;
- struct sec_flags_struct *section_flags;
- char *name;
- int hassize;
+vms_secflag_by_name (bfd *abfd,
+ struct sec_flags_struct *section_flags,
+ char *name,
+ int hassize)
{
int i = 0;
while (section_flags[i].name != NULL)
{
- if ((PRIV(is_vax)?
- strcasecmp (name, section_flags[i].name):
- strcmp (name, section_flags[i].name)) == 0)
+ if ((PRIV (is_vax)?
+ strcasecmp (name, section_flags[i].name):
+ strcmp (name, section_flags[i].name)) == 0)
{
if (hassize)
return section_flags[i].flags_hassize;
@@ -170,13 +167,12 @@ vms_secflag_by_name (abfd, section_flags, name, hassize)
return section_flags[i].flags_always;
}
-/* Retrieve vms section flags by name and size */
+/* Retrieve vms section flags by name and size. */
static flagword
-vms_esecflag_by_name (section_flags, name, hassize)
- struct sec_flags_struct *section_flags;
- char *name;
- int hassize;
+vms_esecflag_by_name (struct sec_flags_struct *section_flags,
+ char *name,
+ int hassize)
{
int i = 0;
@@ -196,20 +192,15 @@ vms_esecflag_by_name (section_flags, name, hassize)
return section_flags[i].vflags_always;
}
-/*-----------------------------------------------------------------------------*/
#if VMS_DEBUG
-/* debug */
struct flagdescstruct { char *name; flagword value; };
-/* Convert flag to printable string */
+/* Convert flag to printable string. */
static char *
-flag2str(flagdesc, flags)
- struct flagdescstruct *flagdesc;
- flagword flags;
+flag2str (struct flagdescstruct * flagdesc, flagword flags)
{
-
static char res[64];
int next = 0;
@@ -219,7 +210,7 @@ flag2str(flagdesc, flags)
if ((flags & flagdesc->value) != 0)
{
if (next)
- strcat(res, ",");
+ strcat (res, ",");
else
next = 1;
strcat (res, flagdesc->name);
@@ -230,46 +221,43 @@ flag2str(flagdesc, flags)
}
#endif
-/*-----------------------------------------------------------------------------*/
-/* input routines */
+/* Input routines. */
/* Process GSD/EGSD record
- return 0 on success, -1 on error */
+ return 0 on success, -1 on error. */
int
-_bfd_vms_slurp_gsd (abfd, objtype)
- bfd *abfd;
- int objtype;
+_bfd_vms_slurp_gsd (bfd * abfd, int objtype)
{
#if VMS_DEBUG
static struct flagdescstruct gpsflagdesc[] =
- {
- { "PIC", 0x0001 },
- { "LIB", 0x0002 },
- { "OVR", 0x0004 },
- { "REL", 0x0008 },
- { "GBL", 0x0010 },
- { "SHR", 0x0020 },
- { "EXE", 0x0040 },
- { "RD", 0x0080 },
- { "WRT", 0x0100 },
- { "VEC", 0x0200 },
- { "NOMOD", 0x0400 },
- { "COM", 0x0800 },
- { NULL, 0 }
- };
+ {
+ { "PIC", 0x0001 },
+ { "LIB", 0x0002 },
+ { "OVR", 0x0004 },
+ { "REL", 0x0008 },
+ { "GBL", 0x0010 },
+ { "SHR", 0x0020 },
+ { "EXE", 0x0040 },
+ { "RD", 0x0080 },
+ { "WRT", 0x0100 },
+ { "VEC", 0x0200 },
+ { "NOMOD", 0x0400 },
+ { "COM", 0x0800 },
+ { NULL, 0 }
+ };
static struct flagdescstruct gsyflagdesc[] =
- {
- { "WEAK", 0x0001 },
- { "DEF", 0x0002 },
- { "UNI", 0x0004 },
- { "REL", 0x0008 },
- { "COMM", 0x0010 },
- { "VECEP", 0x0020 },
- { "NORM", 0x0040 },
- { NULL, 0 }
- };
+ {
+ { "WEAK", 0x0001 },
+ { "DEF", 0x0002 },
+ { "UNI", 0x0004 },
+ { "REL", 0x0008 },
+ { "COMM", 0x0010 },
+ { "VECEP", 0x0020 },
+ { "NORM", 0x0040 },
+ { NULL, 0 }
+ };
#endif
int gsd_type, gsd_size;
@@ -290,30 +278,28 @@ _bfd_vms_slurp_gsd (abfd, objtype)
switch (objtype)
{
case EOBJ_S_C_EGSD:
- PRIV(vms_rec) += 8; /* skip type, size, l_temp */
- PRIV(rec_size) -= 8;
+ PRIV (vms_rec) += 8; /* Skip type, size, l_temp. */
+ PRIV (rec_size) -= 8;
break;
case OBJ_S_C_GSD:
- PRIV(vms_rec) += 1;
- PRIV(rec_size) -= 1;
+ PRIV (vms_rec) += 1;
+ PRIV (rec_size) -= 1;
break;
default:
return -1;
}
- /* calculate base address for each section */
+ /* Calculate base address for each section. */
base_addr = 0L;
abfd->symcount = 0;
- while (PRIV(rec_size) > 0)
+ while (PRIV (rec_size) > 0)
{
- vms_rec = PRIV(vms_rec);
+ vms_rec = PRIV (vms_rec);
if (objtype == OBJ_S_C_GSD)
- {
- gsd_type = *vms_rec;
- }
+ gsd_type = *vms_rec;
else
{
_bfd_vms_get_header_values (abfd, vms_rec, &gsd_type, &gsd_size);
@@ -321,288 +307,278 @@ _bfd_vms_slurp_gsd (abfd, objtype)
}
#if VMS_DEBUG
- vms_debug (3, "gsd_type %d\n", gsd_type);
+ vms_debug (3, "gsd_type %d\n", gsd_type);
#endif
switch (gsd_type)
{
- case GSD_S_C_PSC:
- {
- /*
- * program section definition
- */
-
- asection *old_section = 0;
+ case GSD_S_C_PSC:
+ {
+ /* Program section definition. */
+ asection *old_section = 0;
#if VMS_DEBUG
- vms_debug (4, "GSD_S_C_PSC\n");
+ vms_debug (4, "GSD_S_C_PSC\n");
#endif
- /* If this section isn't a bfd section. */
-
- if (PRIV(is_vax) && (psect_idx < (abfd->section_count-1)))
- {
- /* check for temporary section from TIR record. */
-
- if (psect_idx < PRIV(section_count))
- old_section = PRIV(sections)[psect_idx];
- else
- old_section = 0;
- }
-
- name = _bfd_vms_save_counted_string (vms_rec + 8);
- section = bfd_make_section (abfd, name);
- if (!section)
- {
- (*_bfd_error_handler) (_("bfd_make_section (%s) failed"),
- name);
- return -1;
- }
- old_flags = bfd_getl16 (vms_rec + 2);
- section->size = bfd_getl32 (vms_rec + 4); /* allocation */
- new_flags = vms_secflag_by_name (abfd, vax_section_flags, name,
- section->size > 0);
- if (old_flags & EGPS_S_V_REL)
- new_flags |= SEC_RELOC;
- if (old_flags & GPS_S_M_OVR)
- new_flags |= SEC_IS_COMMON;
- if (!bfd_set_section_flags (abfd, section, new_flags))
- {
- (*_bfd_error_handler)
- (_("bfd_set_section_flags (%s, %x) failed"),
- name, new_flags);
- return -1;
- }
- section->alignment_power = vms_rec[1];
- align_addr = (1 << section->alignment_power);
- if ((base_addr % align_addr) != 0)
- base_addr += (align_addr - (base_addr % align_addr));
- section->vma = (bfd_vma)base_addr;
- base_addr += section->size;
-
- /* global section is common symbol */
-
- if (old_flags & GPS_S_M_GBL)
- {
- entry = _bfd_vms_enter_symbol (abfd, name);
- if (entry == (vms_symbol_entry *)NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return -1;
- }
- symbol = entry->symbol;
-
- symbol->value = 0;
- symbol->section = section;
- symbol->flags = (BSF_GLOBAL|BSF_SECTION_SYM|BSF_OLD_COMMON);
- }
-
- /* copy saved contents if old_section set */
-
- if (old_section != 0)
- {
- section->contents = old_section->contents;
- if (section->size < old_section->size)
- {
- (*_bfd_error_handler)
- (_("Size mismatch section %s=%lx, %s=%lx"),
- old_section->name,
- (unsigned long) old_section->size,
- section->name,
- (unsigned long) section->size);
- return -1;
- }
- else if (section->size > old_section->size)
- {
- section->contents = ((unsigned char *)
- bfd_realloc (old_section->contents,
- section->size));
- if (section->contents == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return -1;
- }
- }
- }
- else
- {
- section->contents = ((unsigned char *)
- bfd_zmalloc (section->size));
- if (section->contents == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return -1;
- }
- }
+ /* If this section isn't a bfd section. */
+ if (PRIV (is_vax) && (psect_idx < (abfd->section_count-1)))
+ {
+ /* Check for temporary section from TIR record. */
+ if (psect_idx < PRIV (section_count))
+ old_section = PRIV (sections)[psect_idx];
+ else
+ old_section = 0;
+ }
+
+ name = _bfd_vms_save_counted_string (vms_rec + 8);
+ section = bfd_make_section (abfd, name);
+ if (!section)
+ {
+ (*_bfd_error_handler) (_("bfd_make_section (%s) failed"),
+ name);
+ return -1;
+ }
+ old_flags = bfd_getl16 (vms_rec + 2);
+ section->size = bfd_getl32 (vms_rec + 4); /* allocation */
+ new_flags = vms_secflag_by_name (abfd, vax_section_flags, name,
+ section->size > 0);
+ if (old_flags & EGPS_S_V_REL)
+ new_flags |= SEC_RELOC;
+ if (old_flags & GPS_S_M_OVR)
+ new_flags |= SEC_IS_COMMON;
+ if (!bfd_set_section_flags (abfd, section, new_flags))
+ {
+ (*_bfd_error_handler)
+ (_("bfd_set_section_flags (%s, %x) failed"),
+ name, new_flags);
+ return -1;
+ }
+ section->alignment_power = vms_rec[1];
+ align_addr = (1 << section->alignment_power);
+ if ((base_addr % align_addr) != 0)
+ base_addr += (align_addr - (base_addr % align_addr));
+ section->vma = (bfd_vma)base_addr;
+ base_addr += section->size;
+
+ /* Global section is common symbol. */
+
+ if (old_flags & GPS_S_M_GBL)
+ {
+ entry = _bfd_vms_enter_symbol (abfd, name);
+ if (entry == NULL)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return -1;
+ }
+ symbol = entry->symbol;
+
+ symbol->value = 0;
+ symbol->section = section;
+ symbol->flags = (BSF_GLOBAL | BSF_SECTION_SYM | BSF_OLD_COMMON);
+ }
+
+ /* Copy saved contents if old_section set. */
+ if (old_section != 0)
+ {
+ section->contents = old_section->contents;
+ if (section->size < old_section->size)
+ {
+ (*_bfd_error_handler)
+ (_("Size mismatch section %s=%lx, %s=%lx"),
+ old_section->name,
+ (unsigned long) old_section->size,
+ section->name,
+ (unsigned long) section->size);
+ return -1;
+ }
+ else if (section->size > old_section->size)
+ {
+ section->contents = bfd_realloc (old_section->contents,
+ section->size);
+ if (section->contents == NULL)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return -1;
+ }
+ }
+ }
+ else
+ {
+ section->contents = bfd_zmalloc (section->size);
+ if (section->contents == NULL)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return -1;
+ }
+ }
#if VMS_DEBUG
- vms_debug (4, "gsd psc %d (%s, flags %04x=%s) ",
- section->index, name, old_flags, flag2str (gpsflagdesc, old_flags));
- vms_debug (4, "%d bytes at 0x%08lx (mem %p)\n",
- section->size, section->vma, section->contents);
+ vms_debug (4, "gsd psc %d (%s, flags %04x=%s) ",
+ section->index, name, old_flags, flag2str (gpsflagdesc, old_flags));
+ vms_debug (4, "%d bytes at 0x%08lx (mem %p)\n",
+ section->size, section->vma, section->contents);
#endif
- gsd_size = vms_rec[8] + 9;
+ gsd_size = vms_rec[8] + 9;
- psect_idx++;
- }
+ psect_idx++;
+ }
break;
- case GSD_S_C_EPM:
- case GSD_S_C_EPMW:
+ case GSD_S_C_EPM:
+ case GSD_S_C_EPMW:
#if VMS_DEBUG
- vms_debug(4, "gsd epm\n");
+ vms_debug (4, "gsd epm\n");
#endif
- /*FALLTHRU*/
- case GSD_S_C_SYM:
- case GSD_S_C_SYMW:
- {
- int name_offset = 0, value_offset = 0;
-
- /*
- * symbol specification (definition or reference)
- */
+ /* Fall through. */
+ case GSD_S_C_SYM:
+ case GSD_S_C_SYMW:
+ {
+ int name_offset = 0, value_offset = 0;
+ /* Symbol specification (definition or reference). */
#if VMS_DEBUG
- vms_debug (4, "GSD_S_C_SYM(W)\n");
+ vms_debug (4, "GSD_S_C_SYM(W)\n");
#endif
- old_flags = bfd_getl16 (vms_rec + 2);
- new_flags = BSF_NO_FLAGS;
+ old_flags = bfd_getl16 (vms_rec + 2);
+ new_flags = BSF_NO_FLAGS;
- if (old_flags & GSY_S_M_WEAK)
- new_flags |= BSF_WEAK;
+ if (old_flags & GSY_S_M_WEAK)
+ new_flags |= BSF_WEAK;
- switch (gsd_type)
- {
- case GSD_S_C_EPM:
- name_offset = 11;
- value_offset = 5;
- new_flags |= BSF_FUNCTION;
- break;
- case GSD_S_C_EPMW:
- name_offset = 12;
- value_offset = 6;
- new_flags |= BSF_FUNCTION;
- break;
- case GSD_S_C_SYM:
- if (old_flags & GSY_S_M_DEF) /* symbol definition */
- name_offset = 9;
- else
- name_offset = 4;
- value_offset = 5;
- break;
- case GSD_S_C_SYMW:
- if (old_flags & GSY_S_M_DEF) /* symbol definition */
- name_offset = 10;
- else
- name_offset = 5;
- value_offset = 6;
- break;
- }
-
- /* save symbol in vms_symbol_table */
-
- entry = _bfd_vms_enter_symbol (abfd,
- _bfd_vms_save_counted_string (vms_rec + name_offset));
- if (entry == (vms_symbol_entry *)NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return -1;
- }
- symbol = entry->symbol;
-
- if (old_flags & GSY_S_M_DEF) /* symbol definition */
- {
- int psect;
-
- symbol->value = bfd_getl32 (vms_rec+value_offset);
- if ((gsd_type == GSD_S_C_SYMW)
- || (gsd_type == GSD_S_C_EPMW))
- psect = bfd_getl16 (vms_rec + value_offset - 2);
- else
- psect = vms_rec[value_offset-1];
-
- symbol->section = (asection *) (size_t) psect;
+ switch (gsd_type)
+ {
+ case GSD_S_C_EPM:
+ name_offset = 11;
+ value_offset = 5;
+ new_flags |= BSF_FUNCTION;
+ break;
+ case GSD_S_C_EPMW:
+ name_offset = 12;
+ value_offset = 6;
+ new_flags |= BSF_FUNCTION;
+ break;
+ case GSD_S_C_SYM:
+ if (old_flags & GSY_S_M_DEF) /* Symbol definition. */
+ name_offset = 9;
+ else
+ name_offset = 4;
+ value_offset = 5;
+ break;
+ case GSD_S_C_SYMW:
+ if (old_flags & GSY_S_M_DEF) /* Symbol definition. */
+ name_offset = 10;
+ else
+ name_offset = 5;
+ value_offset = 6;
+ break;
+ }
+
+ /* Save symbol in vms_symbol_table. */
+ entry = _bfd_vms_enter_symbol
+ (abfd, _bfd_vms_save_counted_string (vms_rec + name_offset));
+ if (entry == NULL)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return -1;
+ }
+ symbol = entry->symbol;
+
+ if (old_flags & GSY_S_M_DEF)
+ {
+ /* Symbol definition. */
+ int psect;
+
+ symbol->value = bfd_getl32 (vms_rec + value_offset);
+ if ((gsd_type == GSD_S_C_SYMW)
+ || (gsd_type == GSD_S_C_EPMW))
+ psect = bfd_getl16 (vms_rec + value_offset - 2);
+ else
+ psect = vms_rec[value_offset-1];
+
+ symbol->section = (asection *) (size_t) psect;
#if VMS_DEBUG
- vms_debug(4, "gsd sym def #%d (%s, %d [%p], %04x=%s)\n", abfd->symcount,
- symbol->name, (int)symbol->section, symbol->section, old_flags, flag2str(gsyflagdesc, old_flags));
+ vms_debug (4, "gsd sym def #%d (%s, %d [%p], %04x=%s)\n", abfd->symcount,
+ symbol->name, (int)symbol->section, symbol->section, old_flags, flag2str (gsyflagdesc, old_flags));
#endif
- }
- else /* symbol reference */
- {
- symbol->section = bfd_make_section (abfd, BFD_UND_SECTION_NAME);
+ }
+ else
+ {
+ /* Symbol reference. */
+ symbol->section = bfd_make_section (abfd, BFD_UND_SECTION_NAME);
#if VMS_DEBUG
- vms_debug (4, "gsd sym ref #%d (%s, %s [%p], %04x=%s)\n", abfd->symcount,
- symbol->name, symbol->section->name, symbol->section, old_flags, flag2str (gsyflagdesc, old_flags));
+ vms_debug (4, "gsd sym ref #%d (%s, %s [%p], %04x=%s)\n",
+ abfd->symcount, symbol->name, symbol->section->name,
+ symbol->section, old_flags, flag2str (gsyflagdesc, old_flags));
#endif
- }
+ }
- gsd_size = vms_rec[name_offset] + name_offset + 1;
- symbol->flags = new_flags;
- }
+ gsd_size = vms_rec[name_offset] + name_offset + 1;
+ symbol->flags = new_flags;
+ }
break;
- case GSD_S_C_PRO:
- case GSD_S_C_PROW:
+ case GSD_S_C_PRO:
+ case GSD_S_C_PROW:
#if VMS_DEBUG
- vms_debug(4, "gsd pro\n");
+ vms_debug (4, "gsd pro\n");
#endif
break;
- case GSD_S_C_IDC:
+ case GSD_S_C_IDC:
#if VMS_DEBUG
- vms_debug(4, "gsd idc\n");
+ vms_debug (4, "gsd idc\n");
#endif
break;
- case GSD_S_C_ENV:
+ case GSD_S_C_ENV:
#if VMS_DEBUG
- vms_debug(4, "gsd env\n");
+ vms_debug (4, "gsd env\n");
#endif
break;
- case GSD_S_C_LSY:
+ case GSD_S_C_LSY:
#if VMS_DEBUG
- vms_debug(4, "gsd lsy\n");
+ vms_debug (4, "gsd lsy\n");
#endif
break;
- case GSD_S_C_LEPM:
+ case GSD_S_C_LEPM:
#if VMS_DEBUG
- vms_debug(4, "gsd lepm\n");
+ vms_debug (4, "gsd lepm\n");
#endif
break;
- case GSD_S_C_LPRO:
+ case GSD_S_C_LPRO:
#if VMS_DEBUG
- vms_debug(4, "gsd lpro\n");
+ vms_debug (4, "gsd lpro\n");
#endif
break;
- case GSD_S_C_SPSC:
+ case GSD_S_C_SPSC:
#if VMS_DEBUG
- vms_debug(4, "gsd spsc\n");
+ vms_debug (4, "gsd spsc\n");
#endif
break;
- case GSD_S_C_SYMV:
+ case GSD_S_C_SYMV:
#if VMS_DEBUG
- vms_debug(4, "gsd symv\n");
+ vms_debug (4, "gsd symv\n");
#endif
break;
- case GSD_S_C_EPMV:
+ case GSD_S_C_EPMV:
#if VMS_DEBUG
- vms_debug(4, "gsd epmv\n");
+ vms_debug (4, "gsd epmv\n");
#endif
break;
- case GSD_S_C_PROV:
+ case GSD_S_C_PROV:
#if VMS_DEBUG
- vms_debug(4, "gsd prov\n");
+ vms_debug (4, "gsd prov\n");
#endif
break;
case EGSD_S_C_PSC + EVAX_OFFSET:
{
- /* program section definition */
-
- name = _bfd_vms_save_counted_string (vms_rec+12);
+ /* Program section definition. */
+ name = _bfd_vms_save_counted_string (vms_rec + 12);
section = bfd_make_section (abfd, name);
if (!section)
return -1;
old_flags = bfd_getl16 (vms_rec + 6);
- section->size = bfd_getl32 (vms_rec + 8); /* allocation */
+ section->size = bfd_getl32 (vms_rec + 8); /* Allocation. */
new_flags = vms_secflag_by_name (abfd, evax_section_flags, name,
section->size > 0);
if (old_flags & EGPS_S_V_REL)
@@ -615,14 +591,13 @@ _bfd_vms_slurp_gsd (abfd, objtype)
base_addr += (align_addr - (base_addr % align_addr));
section->vma = (bfd_vma)base_addr;
base_addr += section->size;
- section->contents = ((unsigned char *)
- bfd_zmalloc (section->size));
+ section->contents = bfd_zmalloc (section->size);
if (section->contents == NULL)
return -1;
#if VMS_DEBUG
- vms_debug(4, "egsd psc %d (%s, flags %04x=%s) ",
- section->index, name, old_flags, flag2str(gpsflagdesc, old_flags));
- vms_debug(4, "%d bytes at 0x%08lx (mem %p)\n",
+ vms_debug (4, "egsd psc %d (%s, flags %04x=%s) ",
+ section->index, name, old_flags, flag2str (gpsflagdesc, old_flags));
+ vms_debug (4, "%d bytes at 0x%08lx (mem %p)\n",
section->size, section->vma, section->contents);
#endif
}
@@ -630,8 +605,7 @@ _bfd_vms_slurp_gsd (abfd, objtype)
case EGSD_S_C_SYM + EVAX_OFFSET:
{
- /* symbol specification (definition or reference) */
-
+ /* Symbol specification (definition or reference). */
symbol = bfd_make_empty_symbol (abfd);
if (symbol == 0)
return -1;
@@ -642,54 +616,56 @@ _bfd_vms_slurp_gsd (abfd, objtype)
if (old_flags & EGSY_S_V_WEAK)
new_flags |= BSF_WEAK;
- if (vms_rec[6] & EGSY_S_V_DEF) /* symbol definition */
+ if (vms_rec[6] & EGSY_S_V_DEF)
{
- symbol->name =
- _bfd_vms_save_counted_string (vms_rec+32);
+ /* Symbol definition. */
+ symbol->name = _bfd_vms_save_counted_string (vms_rec + 32);
if (old_flags & EGSY_S_V_NORM)
- { /* proc def */
- new_flags |= BSF_FUNCTION;
- }
- symbol->value = bfd_getl64 (vms_rec+8);
- symbol->section = (asection *) ((unsigned long) bfd_getl32 (vms_rec+28));
+ /* Proc def. */
+ new_flags |= BSF_FUNCTION;
+
+ symbol->value = bfd_getl64 (vms_rec + 8);
+ symbol->section = (asection *) ((unsigned long) bfd_getl32 (vms_rec + 28));
#if VMS_DEBUG
- vms_debug(4, "egsd sym def #%d (%s, %d, %04x=%s)\n", abfd->symcount,
- symbol->name, (int)symbol->section, old_flags, flag2str(gsyflagdesc, old_flags));
+ vms_debug (4, "egsd sym def #%d (%s, %d, %04x=%s)\n", abfd->symcount,
+ symbol->name, (int) symbol->section, old_flags,
+ flag2str (gsyflagdesc, old_flags));
#endif
}
- else /* symbol reference */
+ else
{
- symbol->name =
- _bfd_vms_save_counted_string (vms_rec+8);
+ /* Symbol reference. */
+ symbol->name = _bfd_vms_save_counted_string (vms_rec + 8);
#if VMS_DEBUG
- vms_debug(4, "egsd sym ref #%d (%s, %04x=%s)\n", abfd->symcount,
- symbol->name, old_flags, flag2str(gsyflagdesc, old_flags));
+ vms_debug (4, "egsd sym ref #%d (%s, %04x=%s)\n", abfd->symcount,
+ symbol->name, old_flags, flag2str (gsyflagdesc, old_flags));
#endif
symbol->section = bfd_make_section (abfd, BFD_UND_SECTION_NAME);
}
symbol->flags = new_flags;
- /* save symbol in vms_symbol_table */
-
- entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV(vms_symbol_table),
+ /* Save symbol in vms_symbol_table. */
+ entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV (vms_symbol_table),
symbol->name,
TRUE, FALSE);
- if (entry == (vms_symbol_entry *)NULL)
+ if (entry == NULL)
{
bfd_set_error (bfd_error_no_memory);
return -1;
}
- if (entry->symbol != (asymbol *)NULL)
- { /* FIXME ?, DEC C generates this */
+
+ if (entry->symbol != NULL)
+ {
+ /* FIXME ?, DEC C generates this. */
#if VMS_DEBUG
- vms_debug(4, "EGSD_S_C_SYM: duplicate \"%s\"\n", symbol->name);
+ vms_debug (4, "EGSD_S_C_SYM: duplicate \"%s\"\n", symbol->name);
#endif
}
else
{
entry->symbol = symbol;
- PRIV(gsd_sym_count)++;
+ PRIV (gsd_sym_count)++;
abfd->symcount++;
}
}
@@ -702,13 +678,11 @@ _bfd_vms_slurp_gsd (abfd, objtype)
(*_bfd_error_handler) (_("unknown gsd/egsd subtype %d"), gsd_type);
bfd_set_error (bfd_error_bad_value);
return -1;
+ }
- } /* switch */
-
- PRIV(rec_size) -= gsd_size;
- PRIV(vms_rec) += gsd_size;
-
- } /* while (recsize > 0) */
+ PRIV (rec_size) -= gsd_size;
+ PRIV (vms_rec) += gsd_size;
+ }
if (abfd->symcount > 0)
abfd->flags |= HAS_SYMS;
@@ -716,15 +690,12 @@ _bfd_vms_slurp_gsd (abfd, objtype)
return 0;
}
-/*-----------------------------------------------------------------------------*/
-/* output routines */
+/* Output routines. */
-/* Write section and symbol directory of bfd abfd */
+/* Write section and symbol directory of bfd abfd. */
int
-_bfd_vms_write_gsd (abfd, objtype)
- bfd *abfd;
- int objtype ATTRIBUTE_UNUSED;
+_bfd_vms_write_gsd (bfd *abfd, int objtype ATTRIBUTE_UNUSED)
{
asection *section;
asymbol *symbol;
@@ -738,39 +709,38 @@ _bfd_vms_write_gsd (abfd, objtype)
vms_debug (2, "vms_write_gsd (%p, %d)\n", abfd, objtype);
#endif
- /* output sections */
-
+ /* Output sections. */
section = abfd->sections;
#if VMS_DEBUG
vms_debug (3, "%d sections found\n", abfd->section_count);
#endif
- /* egsd is quadword aligned */
-
+ /* Egsd is quadword aligned. */
_bfd_vms_output_alignment (abfd, 8);
_bfd_vms_output_begin (abfd, EOBJ_S_C_EGSD, -1);
_bfd_vms_output_long (abfd, 0);
- _bfd_vms_output_push (abfd); /* prepare output for subrecords */
+ /* Prepare output for subrecords. */
+ _bfd_vms_output_push (abfd);
while (section != 0)
{
#if VMS_DEBUG
- vms_debug (3, "Section #%d %s, %d bytes\n", section->index, section->name, (int)section->size);
+ vms_debug (3, "Section #%d %s, %d bytes\n", section->index, section->name, (int)section->size);
#endif
- /* 13 bytes egsd, max 31 chars name -> should be 44 bytes */
+ /* 13 bytes egsd, max 31 chars name -> should be 44 bytes. */
if (_bfd_vms_output_check (abfd, 64) < 0)
{
_bfd_vms_output_pop (abfd);
_bfd_vms_output_end (abfd);
_bfd_vms_output_begin (abfd, EOBJ_S_C_EGSD, -1);
_bfd_vms_output_long (abfd, 0);
- _bfd_vms_output_push (abfd); /* prepare output for subrecords */
+ /* Prepare output for subrecords. */
+ _bfd_vms_output_push (abfd);
}
- /* Create dummy sections to keep consecutive indices */
-
+ /* Create dummy sections to keep consecutive indices. */
while (section->index - last_index > 1)
{
#if VMS_DEBUG
@@ -788,15 +758,14 @@ _bfd_vms_write_gsd (abfd, objtype)
/* Don't know if this is necessary for the linker but for now it keeps
vms_slurp_gsd happy */
-
sname = (char *)section->name;
if (*sname == '.')
{
sname++;
if ((*sname == 't') && (strcmp (sname, "text") == 0))
- sname = PRIV(is_vax)?VAX_CODE_NAME:EVAX_CODE_NAME;
+ sname = PRIV (is_vax)?VAX_CODE_NAME:EVAX_CODE_NAME;
else if ((*sname == 'd') && (strcmp (sname, "data") == 0))
- sname = PRIV(is_vax)?VAX_DATA_NAME:EVAX_DATA_NAME;
+ sname = PRIV (is_vax)?VAX_DATA_NAME:EVAX_DATA_NAME;
else if ((*sname == 'b') && (strcmp (sname, "bss") == 0))
sname = EVAX_BSS_NAME;
else if ((*sname == 'l') && (strcmp (sname, "link") == 0))
@@ -816,14 +785,11 @@ _bfd_vms_write_gsd (abfd, objtype)
_bfd_vms_output_begin (abfd, EGSD_S_C_PSC, -1);
_bfd_vms_output_short (abfd, section->alignment_power & 0xff);
if (bfd_is_com_section (section))
- {
- new_flags = (EGPS_S_V_OVR|EGPS_S_V_REL|EGPS_S_V_GBL|EGPS_S_V_RD|EGPS_S_V_WRT|EGPS_S_V_NOMOD|EGPS_S_V_COM);
- }
+ new_flags = (EGPS_S_V_OVR | EGPS_S_V_REL | EGPS_S_V_GBL | EGPS_S_V_RD | EGPS_S_V_WRT | EGPS_S_V_NOMOD | EGPS_S_V_COM);
else
- {
- new_flags = vms_esecflag_by_name (evax_section_flags, sname,
- section->size > 0);
- }
+ new_flags = vms_esecflag_by_name (evax_section_flags, sname,
+ section->size > 0);
+
_bfd_vms_output_short (abfd, new_flags);
_bfd_vms_output_long (abfd, (unsigned long) section->size);
_bfd_vms_output_counted (abfd, sname);
@@ -833,13 +799,12 @@ _bfd_vms_write_gsd (abfd, objtype)
section = section->next;
}
- /* output symbols */
-
+ /* Output symbols. */
#if VMS_DEBUG
vms_debug (3, "%d symbols found\n", abfd->symcount);
#endif
- bfd_set_start_address (abfd, (bfd_vma)-1);
+ bfd_set_start_address (abfd, (bfd_vma) -1);
for (symnum = 0; symnum < abfd->symcount; symnum++)
{
@@ -856,38 +821,39 @@ _bfd_vms_write_gsd (abfd, objtype)
if (old_flags & BSF_FILE)
continue;
- if (((old_flags & (BSF_GLOBAL|BSF_WEAK)) == 0) /* not xdef */
- && (!bfd_is_und_section (symbol->section))) /* and not xref */
- continue; /* dont output */
-
- /* 13 bytes egsd, max 64 chars name -> should be 77 bytes */
+ if (((old_flags & (BSF_GLOBAL | BSF_WEAK)) == 0) /* Not xdef... */
+ && (!bfd_is_und_section (symbol->section))) /* ...and not xref. */
+ continue; /* Dont output. */
+ /* 13 bytes egsd, max 64 chars name -> should be 77 bytes. */
if (_bfd_vms_output_check (abfd, 80) < 0)
{
_bfd_vms_output_pop (abfd);
_bfd_vms_output_end (abfd);
_bfd_vms_output_begin (abfd, EOBJ_S_C_EGSD, -1);
_bfd_vms_output_long (abfd, 0);
- _bfd_vms_output_push (abfd); /* prepare output for subrecords */
+ /* Prepare output for subrecords. */
+ _bfd_vms_output_push (abfd);
}
_bfd_vms_output_begin (abfd, EGSD_S_C_SYM, -1);
- _bfd_vms_output_short (abfd, 0); /* data type, alignment */
+ /* Data type, alignment. */
+ _bfd_vms_output_short (abfd, 0);
new_flags = 0;
if (old_flags & BSF_WEAK)
new_flags |= EGSY_S_V_WEAK;
- if (bfd_is_com_section (symbol->section)) /* .comm */
- new_flags |= (EGSY_S_V_WEAK|EGSY_S_V_COMM);
+ if (bfd_is_com_section (symbol->section))
+ new_flags |= (EGSY_S_V_WEAK | EGSY_S_V_COMM);
if (old_flags & BSF_FUNCTION)
{
new_flags |= EGSY_S_V_NORM;
new_flags |= EGSY_S_V_REL;
}
- if (old_flags & (BSF_GLOBAL|BSF_WEAK))
+ if (old_flags & (BSF_GLOBAL | BSF_WEAK))
{
new_flags |= EGSY_S_V_DEF;
if (!bfd_is_abs_section (symbol->section))
@@ -895,8 +861,9 @@ _bfd_vms_write_gsd (abfd, objtype)
}
_bfd_vms_output_short (abfd, new_flags);
- if (old_flags & (BSF_GLOBAL | BSF_WEAK)) /* symbol definition */
+ if (old_flags & (BSF_GLOBAL | BSF_WEAK))
{
+ /* Symbol definition. */
uquad code_address = 0;
unsigned long ca_psindx = 0;
unsigned long psindx;
diff --git a/bfd/vms-hdr.c b/bfd/vms-hdr.c
index b8c8ee6..c4af34e 100644
--- a/bfd/vms-hdr.c
+++ b/bfd/vms-hdr.c
@@ -11,19 +11,19 @@
Written by Klaus K"ampf (kkaempf@rmi.de)
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "bfdver.h"
@@ -38,18 +38,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <alloca.h>
#endif
-static unsigned char *get_vms_time_string PARAMS ((void));
-
-
-/*---------------------------------------------------------------------------*/
-
/* Read & process emh record
- return 0 on success, -1 on error */
+ return 0 on success, -1 on error. */
int
-_bfd_vms_slurp_hdr (abfd, objtype)
- bfd *abfd;
- int objtype;
+_bfd_vms_slurp_hdr (bfd *abfd, int objtype)
{
unsigned char *ptr;
unsigned char *vms_rec;
@@ -63,14 +56,14 @@ _bfd_vms_slurp_hdr (abfd, objtype)
switch (objtype)
{
- case OBJ_S_C_HDR:
- subtype = vms_rec[1];
- break;
- case EOBJ_S_C_EMH:
- subtype = bfd_getl16 (vms_rec + 4) + EVAX_OFFSET;
- break;
- default:
- subtype = -1;
+ case OBJ_S_C_HDR:
+ subtype = vms_rec[1];
+ break;
+ case EOBJ_S_C_EMH:
+ subtype = bfd_getl16 (vms_rec + 4) + EVAX_OFFSET;
+ break;
+ default:
+ subtype = -1;
}
#if VMS_DEBUG
@@ -79,138 +72,77 @@ _bfd_vms_slurp_hdr (abfd, objtype)
switch (subtype)
{
-
- case MHD_S_C_MHD:
- /*
- * module header
- */
- PRIV(hdr_data).hdr_b_strlvl = vms_rec[2];
- PRIV(hdr_data).hdr_l_recsiz = bfd_getl16 (vms_rec + 3);
- PRIV(hdr_data).hdr_t_name = _bfd_vms_save_counted_string (vms_rec + 5);
- ptr = vms_rec + 5 + vms_rec[5] + 1;
- PRIV(hdr_data).hdr_t_version = _bfd_vms_save_counted_string (ptr);
- ptr += *ptr + 1;
- PRIV(hdr_data).hdr_t_date = _bfd_vms_save_sized_string (ptr, 17);
-
- break;
-
- case MHD_S_C_LNM:
- /*
- *
- */
- PRIV(hdr_data).hdr_c_lnm = _bfd_vms_save_sized_string (vms_rec, PRIV(rec_length-2));
- break;
-
- case MHD_S_C_SRC:
- /*
- *
- */
- PRIV(hdr_data).hdr_c_src = _bfd_vms_save_sized_string (vms_rec, PRIV(rec_length-2));
- break;
-
- case MHD_S_C_TTL:
- /*
- *
- */
- PRIV(hdr_data).hdr_c_ttl = _bfd_vms_save_sized_string (vms_rec, PRIV(rec_length-2));
- break;
-
- case MHD_S_C_CPR:
- /*
- *
- */
- break;
-
- case MHD_S_C_MTC:
- /*
- *
- */
+ case MHD_S_C_MHD:
+ /* Module header. */
+ PRIV (hdr_data).hdr_b_strlvl = vms_rec[2];
+ PRIV (hdr_data).hdr_l_recsiz = bfd_getl16 (vms_rec + 3);
+ PRIV (hdr_data).hdr_t_name = _bfd_vms_save_counted_string (vms_rec + 5);
+ ptr = vms_rec + 5 + vms_rec[5] + 1;
+ PRIV (hdr_data).hdr_t_version = _bfd_vms_save_counted_string (ptr);
+ ptr += *ptr + 1;
+ PRIV (hdr_data).hdr_t_date = _bfd_vms_save_sized_string (ptr, 17);
break;
- case MHD_S_C_GTX:
- /*
- *
- */
+ case MHD_S_C_LNM:
+ PRIV (hdr_data).hdr_c_lnm = _bfd_vms_save_sized_string (vms_rec, PRIV (rec_length - 2));
break;
- case EMH_S_C_MHD + EVAX_OFFSET:
- /*
- * module header
- */
- PRIV(hdr_data).hdr_b_strlvl = vms_rec[6];
- PRIV(hdr_data).hdr_l_arch1 = bfd_getl32 (vms_rec + 8);
- PRIV(hdr_data).hdr_l_arch2 = bfd_getl32 (vms_rec + 12);
- PRIV(hdr_data).hdr_l_recsiz = bfd_getl32 (vms_rec + 16);
- PRIV(hdr_data).hdr_t_name =
- _bfd_vms_save_counted_string (vms_rec + 20);
- ptr = vms_rec + 20 + vms_rec[20] + 1;
- PRIV(hdr_data).hdr_t_version =
- _bfd_vms_save_counted_string (ptr);
- ptr += *ptr + 1;
- PRIV(hdr_data).hdr_t_date =
- _bfd_vms_save_sized_string (ptr, 17);
-
+ case MHD_S_C_SRC:
+ PRIV (hdr_data).hdr_c_src = _bfd_vms_save_sized_string (vms_rec, PRIV (rec_length - 2));
break;
- case EMH_S_C_LNM + EVAX_OFFSET:
- /*
- *
- */
- PRIV(hdr_data).hdr_c_lnm =
- _bfd_vms_save_sized_string (vms_rec, PRIV(rec_length-6));
+ case MHD_S_C_TTL:
+ PRIV (hdr_data).hdr_c_ttl = _bfd_vms_save_sized_string (vms_rec, PRIV (rec_length - 2));
break;
- case EMH_S_C_SRC + EVAX_OFFSET:
- /*
- *
- */
- PRIV(hdr_data).hdr_c_src =
- _bfd_vms_save_sized_string (vms_rec, PRIV(rec_length-6));
+ case EMH_S_C_MHD + EVAX_OFFSET:
+ /* Module header. */
+ PRIV (hdr_data).hdr_b_strlvl = vms_rec[6];
+ PRIV (hdr_data).hdr_l_arch1 = bfd_getl32 (vms_rec + 8);
+ PRIV (hdr_data).hdr_l_arch2 = bfd_getl32 (vms_rec + 12);
+ PRIV (hdr_data).hdr_l_recsiz = bfd_getl32 (vms_rec + 16);
+ PRIV (hdr_data).hdr_t_name = _bfd_vms_save_counted_string (vms_rec + 20);
+ ptr = vms_rec + 20 + vms_rec[20] + 1;
+ PRIV (hdr_data).hdr_t_version =_bfd_vms_save_counted_string (ptr);
+ ptr += *ptr + 1;
+ PRIV (hdr_data).hdr_t_date = _bfd_vms_save_sized_string (ptr, 17);
break;
- case EMH_S_C_TTL + EVAX_OFFSET:
- /*
- *
- */
- PRIV(hdr_data).hdr_c_ttl =
- _bfd_vms_save_sized_string (vms_rec, PRIV(rec_length-6));
+ case EMH_S_C_LNM + EVAX_OFFSET:
+ PRIV (hdr_data).hdr_c_lnm = _bfd_vms_save_sized_string (vms_rec, PRIV (rec_length - 6));
break;
- case EMH_S_C_CPR + EVAX_OFFSET:
- /*
- *
- */
+ case EMH_S_C_SRC + EVAX_OFFSET:
+ PRIV (hdr_data).hdr_c_src = _bfd_vms_save_sized_string (vms_rec, PRIV (rec_length - 6));
break;
- case EMH_S_C_MTC + EVAX_OFFSET:
- /*
- *
- */
+ case EMH_S_C_TTL + EVAX_OFFSET:
+ PRIV (hdr_data).hdr_c_ttl = _bfd_vms_save_sized_string (vms_rec, PRIV (rec_length - 6));
break;
- case EMH_S_C_GTX + EVAX_OFFSET:
- /*
- *
- */
+ case MHD_S_C_CPR:
+ case MHD_S_C_MTC:
+ case MHD_S_C_GTX:
+ case EMH_S_C_CPR + EVAX_OFFSET:
+ case EMH_S_C_MTC + EVAX_OFFSET:
+ case EMH_S_C_GTX + EVAX_OFFSET:
break;
- default:
- bfd_set_error (bfd_error_wrong_format);
+ default:
+ bfd_set_error (bfd_error_wrong_format);
return -1;
-
- } /* switch */
+ }
return 0;
}
-/*-----------------------------------------------------------------------------*/
/* Output routines. */
/* Manufacture a VMS like time on a unix based system.
- stolen from obj-vms.c */
+ stolen from obj-vms.c. */
static unsigned char *
-get_vms_time_string ()
+get_vms_time_string (void)
{
static unsigned char tbuf[18];
#ifndef VMS
@@ -218,7 +150,8 @@ get_vms_time_string ()
char *pnt;
time_t timeb;
- time (&timeb);
+
+ time (& timeb);
pnt = ctime (&timeb);
pnt[3] = 0;
pnt[7] = 0;
@@ -246,12 +179,10 @@ get_vms_time_string ()
return tbuf;
}
-/* write object header for bfd abfd */
+/* Write object header for bfd abfd. */
int
-_bfd_vms_write_hdr (abfd, objtype)
- bfd *abfd;
- int objtype;
+_bfd_vms_write_hdr (bfd *abfd, int objtype)
{
asymbol *symbol;
unsigned int symnum;
@@ -264,12 +195,8 @@ _bfd_vms_write_hdr (abfd, objtype)
_bfd_vms_output_alignment (abfd, 2);
- /* MHD */
-
- if (objtype == OBJ_S_C_HDR)
- {
- }
- else
+ /* MHD. */
+ if (objtype != OBJ_S_C_HDR)
{
_bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_MHD);
_bfd_vms_output_short (abfd, EOBJ_S_C_STRLVL);
@@ -280,12 +207,11 @@ _bfd_vms_write_hdr (abfd, objtype)
if (bfd_get_filename (abfd) != 0)
{
- /* strip path and suffix information */
-
+ /* Strip path and suffix information. */
char *fname, *fout, *fptr;
fptr = bfd_get_filename (abfd);
- fname = (char *) alloca (strlen (fptr) + 1);
+ fname = alloca (strlen (fptr) + 1);
strcpy (fname, fptr);
fout = strrchr (fname, ']');
if (fout == 0)
@@ -295,8 +221,7 @@ _bfd_vms_write_hdr (abfd, objtype)
else
fout = fname;
- /* strip .obj suffix */
-
+ /* Strip .obj suffix. */
fptr = strrchr (fname, '.');
if ((fptr != 0)
&& (strcasecmp (fptr, ".OBJ") == 0))
@@ -321,14 +246,12 @@ _bfd_vms_write_hdr (abfd, objtype)
_bfd_vms_output_fill (abfd, 0, 17);
_bfd_vms_output_flush (abfd);
- /* LMN */
-
+ /* LMN. */
_bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_LNM);
_bfd_vms_output_dump (abfd, (unsigned char *)"GAS proGIS", 10);
_bfd_vms_output_flush (abfd);
- /* SRC */
-
+ /* SRC. */
_bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_SRC);
for (symnum = 0; symnum < abfd->symcount; symnum++)
@@ -339,8 +262,8 @@ _bfd_vms_write_hdr (abfd, objtype)
{
if (strncmp ((char *)symbol->name, "<CASE:", 6) == 0)
{
- PRIV(flag_hash_long_names) = symbol->name[6] - '0';
- PRIV(flag_show_after_trunc) = symbol->name[7] - '0';
+ PRIV (flag_hash_long_names) = symbol->name[6] - '0';
+ PRIV (flag_show_after_trunc) = symbol->name[7] - '0';
if (had_file)
break;
@@ -361,14 +284,12 @@ _bfd_vms_write_hdr (abfd, objtype)
_bfd_vms_output_flush (abfd);
- /* TTL */
-
+ /* TTL. */
_bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_TTL);
_bfd_vms_output_dump (abfd, (unsigned char *)"TTL", 3);
_bfd_vms_output_flush (abfd);
- /* CPR */
-
+ /* CPR. */
_bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_CPR);
_bfd_vms_output_dump (abfd,
(unsigned char *)"GNU BFD ported by Klaus Kämpf 1994-1996",
@@ -378,15 +299,11 @@ _bfd_vms_write_hdr (abfd, objtype)
return 0;
}
-/*-----------------------------------------------------------------------------*/
-
/* Process EOM/EEOM record
- return 0 on success, -1 on error */
+ return 0 on success, -1 on error. */
int
-_bfd_vms_slurp_eom (abfd, objtype)
- bfd *abfd;
- int objtype;
+_bfd_vms_slurp_eom (bfd *abfd, int objtype)
{
unsigned char *vms_rec;
@@ -394,7 +311,7 @@ _bfd_vms_slurp_eom (abfd, objtype)
vms_debug(2, "EOM/EEOM\n");
#endif
- vms_rec = PRIV(vms_rec);
+ vms_rec = PRIV (vms_rec);
if ((objtype == OBJ_S_C_EOM)
|| (objtype == OBJ_S_C_EOMW))
@@ -402,43 +319,42 @@ _bfd_vms_slurp_eom (abfd, objtype)
}
else
{
- PRIV(eom_data).eom_l_total_lps = bfd_getl32 (vms_rec + 4);
- PRIV(eom_data).eom_b_comcod = *(vms_rec + 8);
- if (PRIV(eom_data).eom_b_comcod > 1)
+ PRIV (eom_data).eom_l_total_lps = bfd_getl32 (vms_rec + 4);
+ PRIV (eom_data).eom_b_comcod = *(vms_rec + 8);
+
+ if (PRIV (eom_data).eom_b_comcod > 1)
{
(*_bfd_error_handler) (_("Object module NOT error-free !\n"));
bfd_set_error (bfd_error_bad_value);
return -1;
}
- PRIV(eom_data).eom_has_transfer = FALSE;
- if (PRIV(rec_size) > 10)
+ PRIV (eom_data).eom_has_transfer = FALSE;
+ if (PRIV (rec_size) > 10)
{
- PRIV(eom_data).eom_has_transfer = TRUE;
- PRIV(eom_data).eom_b_tfrflg = *(vms_rec + 9);
- PRIV(eom_data).eom_l_psindx = bfd_getl32 (vms_rec + 12);
- PRIV(eom_data).eom_l_tfradr = bfd_getl32 (vms_rec + 16);
+ PRIV (eom_data).eom_has_transfer = TRUE;
+ PRIV (eom_data).eom_b_tfrflg = *(vms_rec + 9);
+ PRIV (eom_data).eom_l_psindx = bfd_getl32 (vms_rec + 12);
+ PRIV (eom_data).eom_l_tfradr = bfd_getl32 (vms_rec + 16);
- abfd->start_address = PRIV(eom_data).eom_l_tfradr;
+ abfd->start_address = PRIV (eom_data).eom_l_tfradr;
}
}
return 0;
}
-/* Write eom record for bfd abfd */
+/* Write eom record for bfd abfd. */
int
-_bfd_vms_write_eom (abfd, objtype)
- bfd *abfd;
- int objtype;
+_bfd_vms_write_eom (bfd *abfd, int objtype)
{
#if VMS_DEBUG
vms_debug (2, "vms_write_eom (%p, %d)\n", abfd, objtype);
#endif
_bfd_vms_output_begin (abfd, objtype, -1);
- _bfd_vms_output_long (abfd, (unsigned long) (PRIV(vms_linkage_index) >> 1));
- _bfd_vms_output_byte (abfd, 0); /* completion code */
- _bfd_vms_output_byte (abfd, 0); /* fill byte */
+ _bfd_vms_output_long (abfd, (unsigned long) (PRIV (vms_linkage_index) >> 1));
+ _bfd_vms_output_byte (abfd, 0); /* Completion code. */
+ _bfd_vms_output_byte (abfd, 0); /* Fill byte. */
if (bfd_get_start_address (abfd) != (bfd_vma)-1)
{
diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c
index ac9476f..2b91b35 100644
--- a/bfd/vms-misc.c
+++ b/bfd/vms-misc.c
@@ -5,19 +5,19 @@
Written by Klaus K"ampf (kkaempf@rmi.de)
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#if __STDC__
#include <stdarg.h>
@@ -29,16 +29,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libbfd.h"
#include "vms.h"
-
-static vms_section *add_new_contents PARAMS ((bfd *, sec_ptr));
-static int hash_string PARAMS ((const char *));
-static asymbol *new_symbol PARAMS ((bfd *, char *));
-
-/*-----------------------------------------------------------------------------*/
+
#if VMS_DEBUG
-/* debug functions */
+/* Debug functions. */
-/* debug function for all vms extensions
+/* Debug function for all vms extensions
evaluates environment variable VMS_DEBUG for a
numerical value on the first call
all error levels below this value are printed
@@ -50,10 +45,8 @@ static asymbol *new_symbol PARAMS ((bfd *, char *));
9 almost everything
level is also indentation level. Indentation is performed
- if level > 0
- */
+ if level > 0. */
-#if __STDC__
void
_bfd_vms_debug (int level, char *format, ...)
{
@@ -61,13 +54,13 @@ _bfd_vms_debug (int level, char *format, ...)
static FILE *output = NULL;
char *eptr;
va_list args;
- int abslvl = (level > 0)?level:-level;
+ int abslvl = (level > 0) ? level : - level;
if (min_level == -1)
{
- if ((eptr = getenv("VMS_DEBUG")) != NULL)
+ if ((eptr = getenv ("VMS_DEBUG")) != NULL)
{
- min_level = atoi(eptr);
+ min_level = atoi (eptr);
output = stderr;
}
else
@@ -80,60 +73,20 @@ _bfd_vms_debug (int level, char *format, ...)
while (--level>0)
fprintf (output, " ");
- va_start(args, format);
+ va_start (args, format);
vfprintf (output, format, args);
- fflush(output);
- va_end(args);
-
- return;
+ fflush (output);
+ va_end (args);
}
-#else /* not __STDC__ */
+/* A debug function
+ hex dump 'size' bytes starting at 'ptr'. */
void
-_bfd_vms_debug (level, format, a1, a2, a3, a4, a5, a6)
- int level;
- char *format;
- long a1; long a2; long a3;
- long a4; long a5; long a6;
-{
- static int min_level = -1;
- static FILE *output = NULL;
- char *eptr;
-
- if (min_level == -1)
- {
- if ((eptr = getenv("VMS_DEBUG")) != NULL)
- {
- min_level = atoi(eptr);
- output = stderr;
- }
- else
- min_level = 0;
- }
- if (output == NULL)
- return;
- if (level > min_level)
- return;
-
- while (--level>0)
- fprintf (output, " ");
- fprintf (output, format, a1, a2, a3, a4, a5, a6);
- fflush(output);
-
- return;
-}
-#endif /* __STDC__ */
-
-/* a debug function
- hex dump 'size' bytes starting at 'ptr' */
-
-void
-_bfd_hexdump (level, ptr, size, offset)
- int level;
- unsigned char *ptr;
- int size;
- int offset;
+_bfd_hexdump (int level,
+ unsigned char *ptr,
+ int size,
+ int offset)
{
unsigned char *lptr = ptr;
int count = 0;
@@ -167,64 +120,59 @@ _bfd_hexdump (level, ptr, size, offset)
}
if ((count%16) != 0)
vms_debug (-level, "\n");
-
- return;
}
#endif
-/* hash functions
+/* Hash functions
These are needed when reading an object file. */
-/* allocate new vms_hash_entry
- keep the symbol name and a pointer to the bfd symbol in the table */
+/* Allocate new vms_hash_entry
+ keep the symbol name and a pointer to the bfd symbol in the table. */
struct bfd_hash_entry *
-_bfd_vms_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+_bfd_vms_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
vms_symbol_entry *ret;
#if VMS_DEBUG
- vms_debug (5, "_bfd_vms_hash_newfunc(%p, %p, %s)\n", entry, table, string);
+ vms_debug (5, "_bfd_vms_hash_newfunc (%p, %p, %s)\n", entry, table, string);
#endif
- if (entry == (struct bfd_hash_entry *)NULL)
+ if (entry == NULL)
{
ret = (vms_symbol_entry *)
bfd_hash_allocate (table, sizeof (vms_symbol_entry));
- if (ret == (vms_symbol_entry *) NULL)
+ if (ret == NULL)
{
bfd_set_error (bfd_error_no_memory);
- return (struct bfd_hash_entry *)NULL;
+ return NULL;
}
entry = (struct bfd_hash_entry *) ret;
}
/* Call the allocation method of the base class. */
-
ret = (vms_symbol_entry *) bfd_hash_newfunc (entry, table, string);
#if VMS_DEBUG
vms_debug (6, "_bfd_vms_hash_newfunc ret %p\n", ret);
#endif
- ret->symbol = (asymbol *)NULL;
+ ret->symbol = NULL;
return (struct bfd_hash_entry *)ret;
}
-/* object file input functions */
+/* Object file input functions. */
/* Return type and length from record header (buf) on Alpha. */
void
-_bfd_vms_get_header_values (abfd, buf, type, length)
- bfd *abfd ATTRIBUTE_UNUSED;
- unsigned char *buf;
- int *type;
- int *length;
+_bfd_vms_get_header_values (bfd * abfd ATTRIBUTE_UNUSED,
+ unsigned char *buf,
+ int *type,
+ int *length)
{
if (type != 0)
*type = bfd_getl16 (buf);
@@ -235,16 +183,14 @@ _bfd_vms_get_header_values (abfd, buf, type, length)
#if VMS_DEBUG
vms_debug (10, "_bfd_vms_get_header_values type %x, length %x\n", (type?*type:0), (length?*length:0));
#endif
-
- return;
}
-/* Get next record from object file to vms_buf
- set PRIV(buf_size) and return it
+/* Get next record from object file to vms_buf.
+ Set PRIV(buf_size) and return it
- this is a little tricky since it should be portable.
+ This is a little tricky since it should be portable.
- the openVMS object file has 'variable length' which means that
+ The openVMS object file has 'variable length' which means that
read() returns data in chunks of (hopefully) correct and expected
size. The linker (and other tools on vms) depend on that. Unix doesn't
know about 'formatted' files, so reading and writing such an object
@@ -265,17 +211,16 @@ _bfd_vms_get_header_values (abfd, buf, type, length)
wrong attributes (FF_FOREIGN), else we should be in a vms
environment where read() returns the record size (FF_NATIVE).
- reading is always done in 2 steps.
- first just the record header is read and the length extracted
- by get_header_values
+ Reading is always done in 2 steps.
+ First just the record header is read and the length extracted
+ by get_header_values,
then the read buffer is adjusted and the remaining bytes are
read in.
- all file i/o is always done on even file positions */
+ All file i/o is always done on even file positions. */
int
-_bfd_vms_get_record (abfd)
- bfd *abfd;
+_bfd_vms_get_record (bfd * abfd)
{
int test_len, test_start, remaining;
unsigned char *vms_buf;
@@ -284,11 +229,11 @@ _bfd_vms_get_record (abfd)
vms_debug (8, "_bfd_vms_get_record\n");
#endif
- /* minimum is 6 bytes on Alpha
+ /* Minimum is 6 bytes on Alpha
(2 bytes length, 2 bytes record id, 2 bytes length repeated)
- on VAX there's no length information in the record
- so start with OBJ_S_C_MAXRECSIZ */
+ On the VAX there's no length information in the record
+ so start with OBJ_S_C_MAXRECSIZ. */
if (PRIV (buf_size) == 0)
{
@@ -301,7 +246,7 @@ _bfd_vms_get_record (abfd)
}
else
amt = 6;
- PRIV (vms_buf) = (unsigned char *) bfd_malloc (amt);
+ PRIV (vms_buf) = bfd_malloc (amt);
PRIV (buf_size) = amt;
}
@@ -314,8 +259,8 @@ _bfd_vms_get_record (abfd)
{
case FF_UNKNOWN:
case FF_FOREIGN:
- test_len = 6; /* probe 6 bytes */
- test_start = 2; /* where the record starts */
+ test_len = 6; /* Probe 6 bytes. */
+ test_start = 2; /* Where the record starts. */
break;
case FF_NATIVE:
@@ -330,7 +275,7 @@ _bfd_vms_get_record (abfd)
break;
}
- /* skip odd alignment byte */
+ /* Skip odd alignment byte. */
if (bfd_tell (abfd) & 1)
{
@@ -341,8 +286,7 @@ _bfd_vms_get_record (abfd)
}
}
- /* read the record header on Alpha. */
-
+ /* Read the record header on Alpha. */
if ((test_len != 0)
&& (bfd_bread (PRIV (vms_buf), (bfd_size_type) test_len, abfd)
!= (bfd_size_type) test_len))
@@ -351,19 +295,18 @@ _bfd_vms_get_record (abfd)
return 0;
}
- /* check file format on first call */
-
+ /* Check file format on first call. */
if (PRIV (file_format) == FF_UNKNOWN)
- { /* record length repeats ? */
+ { /* Record length repeats ? */
if (vms_buf[0] == vms_buf[4]
&& vms_buf[1] == vms_buf[5])
{
- PRIV (file_format) = FF_FOREIGN; /* Y: foreign environment */
+ PRIV (file_format) = FF_FOREIGN; /* Y: foreign environment. */
test_start = 2;
}
else
{
- PRIV (file_format) = FF_NATIVE; /* N: native environment */
+ PRIV (file_format) = FF_NATIVE; /* N: native environment. */
test_start = 0;
}
}
@@ -379,12 +322,13 @@ _bfd_vms_get_record (abfd)
}
PRIV (vms_rec) = vms_buf;
}
- else /* Alpha */
+ else
{
- /* extract vms record length */
+ /* Alpha. */
+ /* Extract vms record length. */
_bfd_vms_get_header_values (abfd, vms_buf + test_start, NULL,
- &PRIV (rec_length));
+ & PRIV (rec_length));
if (PRIV (rec_length) <= 0)
{
@@ -392,7 +336,7 @@ _bfd_vms_get_record (abfd)
return 0;
}
- /* that's what the linker manual says */
+ /* That's what the linker manual says. */
if (PRIV (rec_length) > EOBJ_S_C_MAXRECSIZ)
{
@@ -400,21 +344,19 @@ _bfd_vms_get_record (abfd)
return 0;
}
- /* adjust the buffer */
+ /* Adjust the buffer. */
if (PRIV (rec_length) > PRIV (buf_size))
{
- PRIV (vms_buf) = ((unsigned char *)
- bfd_realloc (vms_buf,
- (bfd_size_type) PRIV (rec_length)));
+ PRIV (vms_buf) = bfd_realloc (vms_buf,
+ (bfd_size_type) PRIV (rec_length));
vms_buf = PRIV (vms_buf);
if (vms_buf == 0)
return -1;
PRIV (buf_size) = PRIV (rec_length);
}
- /* read the remaining record */
-
+ /* Read the remaining record. */
remaining = PRIV (rec_length) - test_len + test_start;
#if VMS_DEBUG
@@ -436,12 +378,11 @@ _bfd_vms_get_record (abfd)
return PRIV (rec_length);
}
-/* get next vms record from file
- update vms_rec and rec_length to new (remaining) values */
+/* Get next vms record from file
+ update vms_rec and rec_length to new (remaining) values. */
int
-_bfd_vms_next_record (abfd)
- bfd *abfd;
+_bfd_vms_next_record (bfd * abfd)
{
#if VMS_DEBUG
vms_debug (8, "_bfd_vms_next_record (len %d, size %d)\n",
@@ -449,9 +390,7 @@ _bfd_vms_next_record (abfd)
#endif
if (PRIV (rec_length) > 0)
- {
- PRIV (vms_rec) += PRIV (rec_size);
- }
+ PRIV (vms_rec) += PRIV (rec_size);
else
{
if (_bfd_vms_get_record (abfd) <= 0)
@@ -468,10 +407,9 @@ _bfd_vms_next_record (abfd)
PRIV (rec_size) = PRIV (rec_length);
}
else
- {
- _bfd_vms_get_header_values (abfd, PRIV (vms_rec), &PRIV (rec_type),
- &PRIV (rec_size));
- }
+ _bfd_vms_get_header_values (abfd, PRIV (vms_rec), &PRIV (rec_type),
+ &PRIV (rec_size));
+
PRIV (rec_length) -= PRIV (rec_size);
#if VMS_DEBUG
@@ -487,14 +425,12 @@ _bfd_vms_next_record (abfd)
size is string length (size of record) */
char *
-_bfd_vms_save_sized_string (str, size)
- unsigned char *str;
- int size;
+_bfd_vms_save_sized_string (unsigned char *str, int size)
{
char *newstr = bfd_malloc ((bfd_size_type) size + 1);
if (newstr == NULL)
- return 0;
+ return NULL;
strncpy (newstr, (char *) str, (size_t) size);
newstr[size] = 0;
@@ -505,28 +441,24 @@ _bfd_vms_save_sized_string (str, size)
ptr points to length byte on entry */
char *
-_bfd_vms_save_counted_string (ptr)
- unsigned char *ptr;
+_bfd_vms_save_counted_string (unsigned char *ptr)
{
int len = *ptr++;
return _bfd_vms_save_sized_string (ptr, len);
}
-/* stack routines for vms ETIR commands */
+/* Stack routines for vms ETIR commands. */
-/* Push value and section index */
+/* Push value and section index. */
void
-_bfd_vms_push (abfd, val, psect)
- bfd *abfd;
- uquad val;
- int psect;
+_bfd_vms_push (bfd * abfd, uquad val, int psect)
{
static int last_psect;
#if VMS_DEBUG
- vms_debug (4, "<push %016lx(%d) at %d>\n", val, psect, PRIV (stackptr));
+ vms_debug (4, "<push %016lx (%d) at %d>\n", val, psect, PRIV (stackptr));
#endif
if (psect >= 0)
@@ -541,15 +473,12 @@ _bfd_vms_push (abfd, val, psect)
(*_bfd_error_handler) (_("Stack overflow (%d) in _bfd_vms_push"), PRIV (stackptr));
exit (1);
}
- return;
}
-/* Pop value and section index */
+/* Pop value and section index. */
uquad
-_bfd_vms_pop (abfd, psect)
- bfd *abfd;
- int *psect;
+_bfd_vms_pop (bfd * abfd, int *psect)
{
uquad value;
@@ -571,19 +500,17 @@ _bfd_vms_pop (abfd, psect)
return value;
}
-/* object file output functions */
+/* Object file output functions. */
/* GAS tends to write sections in little chunks (bfd_set_section_contents)
which we can't use directly. So we save the little chunks in linked
lists (one per section) and write them later. */
/* Add a new vms_section structure to vms_section_table
- - forward chaining - */
+ - forward chaining -. */
static vms_section *
-add_new_contents (abfd, section)
- bfd *abfd;
- sec_ptr section;
+add_new_contents (bfd * abfd, sec_ptr section)
{
vms_section *sptr, *newptr;
@@ -591,12 +518,11 @@ add_new_contents (abfd, section)
if (sptr != NULL)
return sptr;
- newptr = (vms_section *) bfd_alloc (abfd,
- (bfd_size_type) sizeof (vms_section));
- if (newptr == (vms_section *) NULL)
+ newptr = bfd_alloc (abfd, (bfd_size_type) sizeof (vms_section));
+ if (newptr == NULL)
return NULL;
- newptr->contents = (unsigned char *) bfd_alloc (abfd, section->size);
- if (newptr->contents == (unsigned char *) NULL)
+ newptr->contents = bfd_alloc (abfd, section->size);
+ if (newptr->contents == NULL)
return NULL;
newptr->offset = 0;
newptr->size = section->size;
@@ -609,12 +535,11 @@ add_new_contents (abfd, section)
vms_section_table[] holds the vms_section chain. */
bfd_boolean
-_bfd_save_vms_section (abfd, section, data, offset, count)
- bfd *abfd;
- sec_ptr section;
- const PTR data;
- file_ptr offset;
- bfd_size_type count;
+_bfd_save_vms_section (bfd * abfd,
+ sec_ptr section,
+ const void * data,
+ file_ptr offset,
+ bfd_size_type count)
{
vms_section *sptr;
@@ -636,9 +561,7 @@ _bfd_save_vms_section (abfd, section, data, offset, count)
/* Get vms_section pointer to saved contents for section # index */
vms_section *
-_bfd_get_vms_section (abfd, index)
- bfd *abfd;
- int index;
+_bfd_get_vms_section (bfd * abfd, int index)
{
if (index >= VMS_SECTION_COUNT)
{
@@ -648,27 +571,24 @@ _bfd_get_vms_section (abfd, index)
return PRIV (vms_section_table)[index];
}
-/* Object output routines */
+/* Object output routines. */
/* Begin new record or record header
write 2 bytes rectype
write 2 bytes record length (filled in at flush)
- write 2 bytes header type (ommitted if rechead == -1) */
+ write 2 bytes header type (ommitted if rechead == -1). */
void
-_bfd_vms_output_begin (abfd, rectype, rechead)
- bfd *abfd;
- int rectype;
- int rechead;
+_bfd_vms_output_begin (bfd * abfd, int rectype, int rechead)
{
#if VMS_DEBUG
- vms_debug (6, "_bfd_vms_output_begin(type %d, head %d)\n", rectype,
+ vms_debug (6, "_bfd_vms_output_begin (type %d, head %d)\n", rectype,
rechead);
#endif
_bfd_vms_output_short (abfd, (unsigned int) rectype);
- /* save current output position to fill in length later */
+ /* Save current output position to fill in length later. */
if (PRIV (push_level) > 0)
PRIV (length_pos) = PRIV (output_size);
@@ -678,52 +598,45 @@ _bfd_vms_output_begin (abfd, rectype, rechead)
PRIV (length_pos));
#endif
- _bfd_vms_output_short (abfd, 0); /* placeholder for length */
+ /* Placeholder for length. */
+ _bfd_vms_output_short (abfd, 0);
if (rechead != -1)
_bfd_vms_output_short (abfd, (unsigned int) rechead);
-
- return;
}
-/* Set record/subrecord alignment */
+/* Set record/subrecord alignment. */
void
-_bfd_vms_output_alignment (abfd, alignto)
- bfd *abfd;
- int alignto;
+_bfd_vms_output_alignment (bfd * abfd, int alignto)
{
#if VMS_DEBUG
- vms_debug (6, "_bfd_vms_output_alignment(%d)\n", alignto);
+ vms_debug (6, "_bfd_vms_output_alignment (%d)\n", alignto);
#endif
PRIV (output_alignment) = alignto;
- return;
}
-/* Prepare for subrecord fields */
+/* Prepare for subrecord fields. */
void
-_bfd_vms_output_push (abfd)
- bfd *abfd;
+_bfd_vms_output_push (bfd * abfd)
{
#if VMS_DEBUG
- vms_debug (6, "vms_output_push(pushed_size = %d)\n", PRIV (output_size));
+ vms_debug (6, "vms_output_push (pushed_size = %d)\n", PRIV (output_size));
#endif
PRIV (push_level)++;
PRIV (pushed_size) = PRIV (output_size);
- return;
}
-/* End of subrecord fields */
+/* End of subrecord fields. */
void
-_bfd_vms_output_pop (abfd)
- bfd *abfd;
+_bfd_vms_output_pop (bfd * abfd)
{
#if VMS_DEBUG
- vms_debug (6, "vms_output_pop(pushed_size = %d)\n", PRIV (pushed_size));
+ vms_debug (6, "vms_output_pop (pushed_size = %d)\n", PRIV (pushed_size));
#endif
_bfd_vms_output_flush (abfd);
@@ -735,21 +648,19 @@ _bfd_vms_output_pop (abfd)
PRIV (pushed_size) = 0;
PRIV (push_level)--;
- return;
}
-/* Flush unwritten output, ends current record */
+/* Flush unwritten output, ends current record. */
void
-_bfd_vms_output_flush (abfd)
- bfd *abfd;
+_bfd_vms_output_flush (bfd * abfd)
{
int real_size = PRIV (output_size);
int aligncount;
int length;
#if VMS_DEBUG
- vms_debug (6, "_bfd_vms_output_flush(real_size = %d, pushed_size %d at lenpos %d)\n",
+ vms_debug (6, "_bfd_vms_output_flush (real_size = %d, pushed_size %d at lenpos %d)\n",
real_size, PRIV (pushed_size), PRIV (length_pos));
#endif
@@ -773,14 +684,14 @@ _bfd_vms_output_flush (abfd)
length++;
}
- /* put length to buffer */
+ /* Put length to buffer. */
PRIV (output_size) = PRIV (length_pos);
_bfd_vms_output_short (abfd, (unsigned int) length);
if (PRIV (push_level) == 0)
{
#ifndef VMS
- /* write length first, see FF_FOREIGN in the input routines */
+ /* Write length first, see FF_FOREIGN in the input routines. */
fwrite (PRIV (output_buf) + 2, 2, 1, (FILE *) abfd->iostream);
#endif
fwrite (PRIV (output_buf), (size_t) real_size, 1,
@@ -793,63 +704,51 @@ _bfd_vms_output_flush (abfd)
PRIV (output_size) = real_size;
PRIV (pushed_size) = PRIV (output_size);
}
-
- return;
}
-/* End record output */
+/* End record output. */
void
-_bfd_vms_output_end (abfd)
- bfd *abfd;
+_bfd_vms_output_end (bfd * abfd)
{
#if VMS_DEBUG
vms_debug (6, "_bfd_vms_output_end\n");
#endif
_bfd_vms_output_flush (abfd);
-
- return;
}
-/* check remaining buffer size
+/* Check remaining buffer size
- return what's left. */
+ Return what's left. */
int
-_bfd_vms_output_check (abfd, size)
- bfd *abfd;
- int size;
+_bfd_vms_output_check (bfd * abfd, int size)
{
#if VMS_DEBUG
- vms_debug (6, "_bfd_vms_output_check(%d)\n", size);
+ vms_debug (6, "_bfd_vms_output_check (%d)\n", size);
#endif
return (MAX_OUTREC_SIZE - (PRIV (output_size) + size + MIN_OUTREC_LUFT));
}
-/* Output byte (8 bit) value */
+/* Output byte (8 bit) value. */
void
-_bfd_vms_output_byte (abfd, value)
- bfd *abfd;
- unsigned int value;
+_bfd_vms_output_byte (bfd * abfd, unsigned int value)
{
#if VMS_DEBUG
- vms_debug (6, "_bfd_vms_output_byte(%02x)\n", value);
+ vms_debug (6, "_bfd_vms_output_byte (%02x)\n", value);
#endif
bfd_put_8 (abfd, value & 0xff, PRIV (output_buf) + PRIV (output_size));
PRIV (output_size) += 1;
- return;
}
-/* Output short (16 bit) value */
+/* Output short (16 bit) value. */
void
-_bfd_vms_output_short (abfd, value)
- bfd *abfd;
- unsigned int value;
+_bfd_vms_output_short (bfd * abfd, unsigned int value)
{
#if VMS_DEBUG
vms_debug (6, "_bfd_vms_output_short (%04x)\n", value);
@@ -858,15 +757,12 @@ _bfd_vms_output_short (abfd, value)
bfd_put_16 (abfd, (bfd_vma) value & 0xffff,
PRIV (output_buf) + PRIV (output_size));
PRIV (output_size) += 2;
- return;
}
-/* Output long (32 bit) value */
+/* Output long (32 bit) value. */
void
-_bfd_vms_output_long (abfd, value)
- bfd *abfd;
- unsigned long value;
+_bfd_vms_output_long (bfd * abfd, unsigned long value)
{
#if VMS_DEBUG
vms_debug (6, "_bfd_vms_output_long (%08lx)\n", value);
@@ -874,36 +770,30 @@ _bfd_vms_output_long (abfd, value)
bfd_put_32 (abfd, (bfd_vma) value, PRIV (output_buf) + PRIV (output_size));
PRIV (output_size) += 4;
- return;
}
-/* Output quad (64 bit) value */
+/* Output quad (64 bit) value. */
void
-_bfd_vms_output_quad (abfd, value)
- bfd *abfd;
- uquad value;
+_bfd_vms_output_quad (bfd * abfd, uquad value)
{
#if VMS_DEBUG
- vms_debug (6, "_bfd_vms_output_quad(%016lx)\n", value);
+ vms_debug (6, "_bfd_vms_output_quad (%016lx)\n", value);
#endif
bfd_put_64(abfd, value, PRIV (output_buf) + PRIV (output_size));
PRIV (output_size) += 8;
- return;
}
-/* Output c-string as counted string */
+/* Output c-string as counted string. */
void
-_bfd_vms_output_counted (abfd, value)
- bfd *abfd;
- char *value;
+_bfd_vms_output_counted (bfd * abfd, char *value)
{
-int len;
+ int len;
#if VMS_DEBUG
- vms_debug (6, "_bfd_vms_output_counted(%s)\n", value);
+ vms_debug (6, "_bfd_vms_output_counted (%s)\n", value);
#endif
len = strlen (value);
@@ -918,19 +808,18 @@ int len;
return;
}
_bfd_vms_output_byte (abfd, (unsigned int) len & 0xff);
- _bfd_vms_output_dump (abfd, (unsigned char *)value, len);
+ _bfd_vms_output_dump (abfd, (unsigned char *) value, len);
}
-/* Output character area */
+/* Output character area. */
void
-_bfd_vms_output_dump (abfd, data, length)
- bfd *abfd;
- unsigned char *data;
- int length;
+_bfd_vms_output_dump (bfd * abfd,
+ unsigned char *data,
+ int length)
{
#if VMS_DEBUG
- vms_debug (6, "_bfd_vms_output_dump(%d)\n", length);
+ vms_debug (6, "_bfd_vms_output_dump (%d)\n", length);
#endif
if (length == 0)
@@ -938,40 +827,34 @@ _bfd_vms_output_dump (abfd, data, length)
memcpy (PRIV (output_buf) + PRIV (output_size), data, (size_t) length);
PRIV (output_size) += length;
-
- return;
}
-/* Output count bytes of value */
+/* Output count bytes of value. */
void
-_bfd_vms_output_fill (abfd, value, count)
- bfd *abfd;
- int value;
- int count;
+_bfd_vms_output_fill (bfd * abfd,
+ int value,
+ int count)
{
#if VMS_DEBUG
- vms_debug (6, "_bfd_vms_output_fill(val %02x times %d)\n", value, count);
+ vms_debug (6, "_bfd_vms_output_fill (val %02x times %d)\n", value, count);
#endif
if (count == 0)
return;
memset (PRIV (output_buf) + PRIV (output_size), value, (size_t) count);
PRIV (output_size) += count;
-
- return;
}
-/* this hash routine borrowed from GNU-EMACS, and strengthened slightly ERY*/
+/* This hash routine borrowed from GNU-EMACS, and strengthened slightly. ERY. */
static int
-hash_string (ptr)
- const char *ptr;
+hash_string (const char *ptr)
{
- register const unsigned char *p = (unsigned char *) ptr;
- register const unsigned char *end = p + strlen (ptr);
- register unsigned char c;
- register int hash = 0;
+ const unsigned char *p = (unsigned char *) ptr;
+ const unsigned char *end = p + strlen (ptr);
+ unsigned char c;
+ int hash = 0;
while (p != end)
{
@@ -984,10 +867,7 @@ hash_string (ptr)
/* Generate a length-hashed VMS symbol name (limited to maxlen chars). */
char *
-_bfd_vms_length_hash_symbol (abfd, in, maxlen)
- bfd *abfd;
- const char *in;
- int maxlen;
+_bfd_vms_length_hash_symbol (bfd * abfd, const char *in, int maxlen)
{
long int result;
int in_len;
@@ -998,16 +878,16 @@ _bfd_vms_length_hash_symbol (abfd, in, maxlen)
char *out = outbuf;
#if VMS_DEBUG
- vms_debug(4, "_bfd_vms_length_hash_symbol \"%s\"\n", in);
+ vms_debug (4, "_bfd_vms_length_hash_symbol \"%s\"\n", in);
#endif
if (maxlen > EOBJ_S_C_SYMSIZ)
maxlen = EOBJ_S_C_SYMSIZ;
- new_name = out; /* save this for later. */
+ /* Save this for later. */
+ new_name = out;
/* We may need to truncate the symbol, save the hash for later. */
-
in_len = strlen (in);
result = (in_len > maxlen) ? hash_string (in) : 0;
@@ -1015,11 +895,8 @@ _bfd_vms_length_hash_symbol (abfd, in, maxlen)
old_name = in;
/* Do the length checking. */
-
if (in_len <= maxlen)
- {
- i = in_len;
- }
+ i = in_len;
else
{
if (PRIV (flag_hash_long_names))
@@ -1039,7 +916,7 @@ _bfd_vms_length_hash_symbol (abfd, in, maxlen)
*out = 0;
#if VMS_DEBUG
- vms_debug(4, "--> [%d]\"%s\"\n", strlen (outbuf), outbuf);
+ vms_debug (4, "--> [%d]\"%s\"\n", strlen (outbuf), outbuf);
#endif
if (in_len > maxlen
@@ -1053,9 +930,7 @@ _bfd_vms_length_hash_symbol (abfd, in, maxlen)
/* Allocate and initialize a new symbol. */
static asymbol *
-new_symbol (abfd, name)
- bfd *abfd;
- char *name;
+new_symbol (bfd * abfd, char *name)
{
asymbol *symbol;
@@ -1075,9 +950,7 @@ new_symbol (abfd, name)
/* Allocate and enter a new private symbol. */
vms_symbol_entry *
-_bfd_vms_enter_symbol (abfd, name)
- bfd *abfd;
- char *name;
+_bfd_vms_enter_symbol (bfd * abfd, char *name)
{
vms_symbol_entry *entry;
diff --git a/bfd/vms-tir.c b/bfd/vms-tir.c
index 7c0f9b6..47fcb73 100644
--- a/bfd/vms-tir.c
+++ b/bfd/vms-tir.c
@@ -38,57 +38,10 @@
#include "sysdep.h"
#include "bfdlink.h"
#include "libbfd.h"
-
#include "vms.h"
-
-static void image_set_ptr
- PARAMS ((bfd *abfd, int psect, uquad offset));
-static void image_inc_ptr
- PARAMS ((bfd *abfd, uquad offset));
-static void image_dump
- PARAMS ((bfd *abfd, unsigned char *ptr, int size, int offset));
-static void image_write_b
- PARAMS ((bfd *abfd, unsigned int value));
-static void image_write_w
- PARAMS ((bfd *abfd, unsigned int value));
-static void image_write_l
- PARAMS ((bfd *abfd, unsigned long value));
-static void image_write_q
- PARAMS ((bfd *abfd, uquad value));
-static int check_section
- PARAMS ((bfd *, int));
-static bfd_boolean etir_sta
- PARAMS ((bfd *, int, unsigned char *));
-static bfd_boolean etir_sto
- PARAMS ((bfd *, int, unsigned char *));
-static bfd_boolean etir_opr
- PARAMS ((bfd *, int, unsigned char *));
-static bfd_boolean etir_ctl
- PARAMS ((bfd *, int, unsigned char *));
-static bfd_boolean etir_stc
- PARAMS ((bfd *, int, unsigned char *));
-static asection *new_section
- PARAMS ((bfd *, int));
-static int alloc_section
- PARAMS ((bfd *, unsigned int));
-static int etir_cmd
- PARAMS ((bfd *, int, unsigned char *));
-static int analyze_tir
- PARAMS ((bfd *, unsigned char *, unsigned int));
-static int analyze_etir
- PARAMS ((bfd *, unsigned char *, unsigned int));
-static unsigned char * tir_opr
- PARAMS ((bfd *, unsigned char *));
-static const char * tir_cmd_name
- PARAMS ((int));
-static const char * cmd_name
- PARAMS ((int));
-
static int
-check_section (abfd, size)
- bfd *abfd;
- int size;
+check_section (bfd * abfd, int size)
{
bfd_size_type offset;
@@ -114,10 +67,7 @@ check_section (abfd, size)
/* Initialize image buffer pointer to be filled. */
static void
-image_set_ptr (abfd, psect, offset)
- bfd *abfd;
- int psect;
- uquad offset;
+image_set_ptr (bfd * abfd, int psect, uquad offset)
{
#if VMS_DEBUG
_bfd_vms_debug (4, "image_set_ptr (%d=%s, %d)\n",
@@ -126,33 +76,27 @@ image_set_ptr (abfd, psect, offset)
PRIV (image_ptr) = PRIV (sections)[psect]->contents + offset;
PRIV (image_section) = PRIV (sections)[psect];
- return;
}
/* Increment image buffer pointer by offset. */
static void
-image_inc_ptr (abfd, offset)
- bfd *abfd;
- uquad offset;
+image_inc_ptr (bfd * abfd, uquad offset)
{
#if VMS_DEBUG
_bfd_vms_debug (4, "image_inc_ptr (%d)\n", offset);
#endif
PRIV (image_ptr) += offset;
-
- return;
}
/* Dump multiple bytes to section image. */
static void
-image_dump (abfd, ptr, size, offset)
- bfd *abfd;
- unsigned char *ptr;
- int size;
- int offset ATTRIBUTE_UNUSED;
+image_dump (bfd * abfd,
+ unsigned char *ptr,
+ int size,
+ int offset ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
_bfd_vms_debug (8, "image_dump from (%p, %d) to (%p)\n", ptr, size,
@@ -165,36 +109,30 @@ image_dump (abfd, ptr, size, offset)
while (size-- > 0)
*PRIV (image_ptr)++ = *ptr++;
- return;
}
/* Write byte to section image. */
static void
-image_write_b (abfd, value)
- bfd *abfd;
- unsigned int value;
+image_write_b (bfd * abfd, unsigned int value)
{
#if VMS_DEBUG
- _bfd_vms_debug (6, "image_write_b(%02x)\n", (int) value);
+ _bfd_vms_debug (6, "image_write_b (%02x)\n", (int) value);
#endif
if (PRIV (is_vax) && check_section (abfd, 1))
return;
*PRIV (image_ptr)++ = (value & 0xff);
- return;
}
/* Write 2-byte word to image. */
static void
-image_write_w (abfd, value)
- bfd *abfd;
- unsigned int value;
+image_write_w (bfd * abfd, unsigned int value)
{
#if VMS_DEBUG
- _bfd_vms_debug (6, "image_write_w(%04x)\n", (int) value);
+ _bfd_vms_debug (6, "image_write_w (%04x)\n", (int) value);
#endif
if (PRIV (is_vax) && check_section (abfd, 2))
@@ -202,16 +140,12 @@ image_write_w (abfd, value)
bfd_putl16 ((bfd_vma) value, PRIV (image_ptr));
PRIV (image_ptr) += 2;
-
- return;
}
/* Write 4-byte long to image. */
static void
-image_write_l (abfd, value)
- bfd *abfd;
- unsigned long value;
+image_write_l (bfd * abfd, unsigned long value)
{
#if VMS_DEBUG
_bfd_vms_debug (6, "image_write_l (%08lx)\n", value);
@@ -222,16 +156,12 @@ image_write_l (abfd, value)
bfd_putl32 ((bfd_vma) value, PRIV (image_ptr));
PRIV (image_ptr) += 4;
-
- return;
}
/* Write 8-byte quad to image. */
static void
-image_write_q (abfd, value)
- bfd *abfd;
- uquad value;
+image_write_q (bfd * abfd, uquad value)
{
#if VMS_DEBUG
_bfd_vms_debug (6, "image_write_q (%016lx)\n", value);
@@ -242,13 +172,10 @@ image_write_q (abfd, value)
bfd_putl64 (value, PRIV (image_ptr));
PRIV (image_ptr) += 8;
-
- return;
}
static const char *
-cmd_name (cmd)
- int cmd;
+cmd_name (int cmd)
{
switch (cmd)
{
@@ -304,12 +231,8 @@ cmd_name (cmd)
see table B-8 of the openVMS linker manual. */
static bfd_boolean
-etir_sta (abfd, cmd, ptr)
- bfd *abfd;
- int cmd;
- unsigned char *ptr;
+etir_sta (bfd * abfd, int cmd, unsigned char *ptr)
{
-
#if VMS_DEBUG
_bfd_vms_debug (5, "etir_sta %d/%x\n", cmd, cmd);
_bfd_hexdump (8, ptr, 16, (int) ptr);
@@ -317,13 +240,10 @@ etir_sta (abfd, cmd, ptr)
switch (cmd)
{
- /* stack */
-
/* stack global
arg: cs symbol name
- stack 32 bit value of symbol (high bits set to 0) */
-
+ stack 32 bit value of symbol (high bits set to 0). */
case ETIR_S_C_STA_GBL:
{
char *name;
@@ -332,7 +252,7 @@ etir_sta (abfd, cmd, ptr)
name = _bfd_vms_save_counted_string (ptr);
entry = (vms_symbol_entry *)
bfd_hash_lookup (PRIV (vms_symbol_table), name, FALSE, FALSE);
- if (entry == (vms_symbol_entry *) NULL)
+ if (entry == NULL)
{
#if VMS_DEBUG
_bfd_vms_debug (3, "%s: no symbol \"%s\"\n",
@@ -341,17 +261,14 @@ etir_sta (abfd, cmd, ptr)
_bfd_vms_push (abfd, (uquad) 0, -1);
}
else
- {
- _bfd_vms_push (abfd, (uquad) (entry->symbol->value), -1);
- }
+ _bfd_vms_push (abfd, (uquad) (entry->symbol->value), -1);
}
break;
/* stack longword
arg: lw value
- stack 32 bit value, sign extend to 64 bit */
-
+ stack 32 bit value, sign extend to 64 bit. */
case ETIR_S_C_STA_LW:
_bfd_vms_push (abfd, (uquad) bfd_getl32 (ptr), -1);
break;
@@ -359,8 +276,7 @@ etir_sta (abfd, cmd, ptr)
/* stack global
arg: qw value
- stack 64 bit value of symbol */
-
+ stack 64 bit value of symbol. */
case ETIR_S_C_STA_QW:
_bfd_vms_push (abfd, (uquad) bfd_getl64 (ptr), -1);
break;
@@ -370,8 +286,7 @@ etir_sta (abfd, cmd, ptr)
qw signed quadword offset (low 32 bits)
stack qw argument and section index
- (see ETIR_S_C_STO_OFF, ETIR_S_C_CTL_SETRB) */
-
+ (see ETIR_S_C_STO_OFF, ETIR_S_C_CTL_SETRB). */
case ETIR_S_C_STA_PQ:
{
uquad dummy;
@@ -385,7 +300,7 @@ etir_sta (abfd, cmd, ptr)
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
- dummy = bfd_getl64 (ptr+4);
+ dummy = bfd_getl64 (ptr + 4);
_bfd_vms_push (abfd, dummy, (int) psect);
}
break;
@@ -408,8 +323,7 @@ etir_sta (abfd, cmd, ptr)
return TRUE;
}
-/*
- etir_sto
+/* etir_sto
vms store commands
@@ -419,10 +333,7 @@ etir_sta (abfd, cmd, ptr)
see table B-9 of the openVMS linker manual. */
static bfd_boolean
-etir_sto (abfd, cmd, ptr)
- bfd *abfd;
- int cmd;
- unsigned char *ptr;
+etir_sto (bfd * abfd, int cmd, unsigned char *ptr)
{
uquad dummy;
int psect;
@@ -434,27 +345,24 @@ etir_sto (abfd, cmd, ptr)
switch (cmd)
{
- /* store byte: pop stack, write byte
- arg: - */
-
+ /* Store byte: pop stack, write byte
+ arg: -. */
case ETIR_S_C_STO_B:
dummy = _bfd_vms_pop (abfd, &psect);
- /* FIXME: check top bits */
+ /* FIXME: check top bits. */
image_write_b (abfd, (unsigned int) dummy & 0xff);
break;
- /* store word: pop stack, write word
- arg: - */
-
+ /* Store word: pop stack, write word
+ arg: -. */
case ETIR_S_C_STO_W:
dummy = _bfd_vms_pop (abfd, &psect);
/* FIXME: check top bits */
image_write_w (abfd, (unsigned int) dummy & 0xffff);
break;
- /* store longword: pop stack, write longword
- arg: - */
-
+ /* Store longword: pop stack, write longword
+ arg: -. */
case ETIR_S_C_STO_LW:
dummy = _bfd_vms_pop (abfd, &psect);
dummy += (PRIV (sections)[psect])->vma;
@@ -462,19 +370,18 @@ etir_sto (abfd, cmd, ptr)
image_write_l (abfd, (unsigned int) dummy & 0xffffffff);
break;
- /* store quadword: pop stack, write quadword
- arg: - */
-
+ /* Store quadword: pop stack, write quadword
+ arg: -. */
case ETIR_S_C_STO_QW:
dummy = _bfd_vms_pop (abfd, &psect);
dummy += (PRIV (sections)[psect])->vma;
- image_write_q (abfd, dummy); /* FIXME: check top bits */
+ /* FIXME: check top bits. */
+ image_write_q (abfd, dummy);
break;
- /* store immediate repeated: pop stack for repeat count
+ /* Store immediate repeated: pop stack for repeat count
arg: lw byte count
- da data */
-
+ da data. */
case ETIR_S_C_STO_IMMR:
{
int size;
@@ -486,9 +393,8 @@ etir_sto (abfd, cmd, ptr)
}
break;
- /* store global: write symbol value
+ /* Store global: write symbol value
arg: cs global symbol name. */
-
case ETIR_S_C_STO_GBL:
{
vms_symbol_entry *entry;
@@ -497,7 +403,7 @@ etir_sto (abfd, cmd, ptr)
name = _bfd_vms_save_counted_string (ptr);
entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV (vms_symbol_table),
name, FALSE, FALSE);
- if (entry == (vms_symbol_entry *) NULL)
+ if (entry == NULL)
{
(*_bfd_error_handler) (_("%s: no symbol \"%s\""),
cmd_name (cmd), name);
@@ -509,9 +415,8 @@ etir_sto (abfd, cmd, ptr)
}
break;
- /* store code address: write address of entry point
+ /* Store code address: write address of entry point
arg: cs global symbol name (procedure). */
-
case ETIR_S_C_STO_CA:
{
vms_symbol_entry *entry;
@@ -520,26 +425,26 @@ etir_sto (abfd, cmd, ptr)
name = _bfd_vms_save_counted_string (ptr);
entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV (vms_symbol_table),
name, FALSE, FALSE);
- if (entry == (vms_symbol_entry *) NULL)
+ if (entry == NULL)
{
(*_bfd_error_handler) (_("%s: no symbol \"%s\""),
cmd_name (cmd), name);
return FALSE;
}
else
- image_write_q (abfd, (uquad) (entry->symbol->value)); /* FIXME, reloc */
+ /* FIXME, reloc. */
+ image_write_q (abfd, (uquad) (entry->symbol->value));
}
break;
/* Store offset to psect: pop stack, add low 32 bits to base of psect
arg: none. */
-
case ETIR_S_C_STO_OFF:
{
uquad q;
int psect1;
- q = _bfd_vms_pop (abfd, &psect1);
+ q = _bfd_vms_pop (abfd, & psect1);
q += (PRIV (sections)[psect1])->vma;
image_write_q (abfd, q);
}
@@ -548,7 +453,6 @@ etir_sto (abfd, cmd, ptr)
/* Store immediate
arg: lw count of bytes
da data. */
-
case ETIR_S_C_STO_IMM:
{
int size;
@@ -564,7 +468,6 @@ etir_sto (abfd, cmd, ptr)
FIXME, since the following is just a guess
store global longword: store 32bit value of symbol
arg: cs symbol name. */
-
case ETIR_S_C_STO_GBL_LW:
{
vms_symbol_entry *entry;
@@ -573,7 +476,7 @@ etir_sto (abfd, cmd, ptr)
name = _bfd_vms_save_counted_string (ptr);
entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV (vms_symbol_table),
name, FALSE, FALSE);
- if (entry == (vms_symbol_entry *) NULL)
+ if (entry == NULL)
{
#if VMS_DEBUG
_bfd_vms_debug (3, "%s: no symbol \"%s\"\n", cmd_name (cmd), name);
@@ -613,10 +516,7 @@ etir_sto (abfd, cmd, ptr)
see table B-10 of the openVMS linker manual. */
static bfd_boolean
-etir_opr (abfd, cmd, ptr)
- bfd *abfd;
- int cmd;
- unsigned char *ptr ATTRIBUTE_UNUSED;
+etir_opr (bfd * abfd, int cmd, unsigned char *ptr ATTRIBUTE_UNUSED)
{
long op1, op2;
@@ -627,28 +527,28 @@ etir_opr (abfd, cmd, ptr)
switch (cmd)
{
- case ETIR_S_C_OPR_NOP: /* no-op */
+ case ETIR_S_C_OPR_NOP: /* No-op. */
break;
- case ETIR_S_C_OPR_ADD: /* add */
+ case ETIR_S_C_OPR_ADD: /* Add. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
_bfd_vms_push (abfd, (uquad) (op1 + op2), -1);
break;
- case ETIR_S_C_OPR_SUB: /* subtract */
+ case ETIR_S_C_OPR_SUB: /* Subtract. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
_bfd_vms_push (abfd, (uquad) (op2 - op1), -1);
break;
- case ETIR_S_C_OPR_MUL: /* multiply */
+ case ETIR_S_C_OPR_MUL: /* Multiply. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
_bfd_vms_push (abfd, (uquad) (op1 * op2), -1);
break;
- case ETIR_S_C_OPR_DIV: /* divide */
+ case ETIR_S_C_OPR_DIV: /* Divide. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
if (op2 == 0)
@@ -657,54 +557,54 @@ etir_opr (abfd, cmd, ptr)
_bfd_vms_push (abfd, (uquad) (op2 / op1), -1);
break;
- case ETIR_S_C_OPR_AND: /* logical and */
+ case ETIR_S_C_OPR_AND: /* Logical AND. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
_bfd_vms_push (abfd, (uquad) (op1 & op2), -1);
break;
- case ETIR_S_C_OPR_IOR: /* logical inclusive or */
+ case ETIR_S_C_OPR_IOR: /* Logical inclusive OR. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
_bfd_vms_push (abfd, (uquad) (op1 | op2), -1);
break;
- case ETIR_S_C_OPR_EOR: /* logical exclusive or */
+ case ETIR_S_C_OPR_EOR: /* Logical exclusive OR. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
_bfd_vms_push (abfd, (uquad) (op1 ^ op2), -1);
break;
- case ETIR_S_C_OPR_NEG: /* negate */
+ case ETIR_S_C_OPR_NEG: /* Negate. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
_bfd_vms_push (abfd, (uquad) (-op1), -1);
break;
- case ETIR_S_C_OPR_COM: /* complement */
+ case ETIR_S_C_OPR_COM: /* Complement. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
_bfd_vms_push (abfd, (uquad) (op1 ^ -1L), -1);
break;
- case ETIR_S_C_OPR_ASH: /* arithmetic shift */
+ case ETIR_S_C_OPR_ASH: /* Arithmetic shift. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
- if (op2 < 0) /* shift right */
+ if (op2 < 0) /* Shift right. */
op1 >>= -op2;
- else /* shift left */
+ else /* Shift left. */
op1 <<= op2;
_bfd_vms_push (abfd, (uquad) op1, -1);
break;
- case ETIR_S_C_OPR_INSV: /* insert field */
+ case ETIR_S_C_OPR_INSV: /* Insert field. */
(void) _bfd_vms_pop (abfd, NULL);
- case ETIR_S_C_OPR_USH: /* unsigned shift */
- case ETIR_S_C_OPR_ROT: /* rotate */
+ case ETIR_S_C_OPR_USH: /* Unsigned shift. */
+ case ETIR_S_C_OPR_ROT: /* Rotate. */
case ETIR_S_C_OPR_REDEF: /* Redefine symbol to current location. */
case ETIR_S_C_OPR_DFLIT: /* Define a literal. */
(*_bfd_error_handler) (_("%s: not supported"), cmd_name (cmd));
break;
- case ETIR_S_C_OPR_SEL: /* select */
+ case ETIR_S_C_OPR_SEL: /* Select. */
if ((long) _bfd_vms_pop (abfd, NULL) & 0x01L)
(void) _bfd_vms_pop (abfd, NULL);
else
@@ -728,10 +628,7 @@ etir_opr (abfd, cmd, ptr)
See table B-11 of the openVMS linker manual. */
static bfd_boolean
-etir_ctl (abfd, cmd, ptr)
- bfd *abfd;
- int cmd;
- unsigned char *ptr;
+etir_ctl (bfd * abfd, int cmd, unsigned char *ptr)
{
uquad dummy;
int psect;
@@ -743,44 +640,39 @@ etir_ctl (abfd, cmd, ptr)
switch (cmd)
{
- /* set relocation base: pop stack, set image location counter
+ /* Det relocation base: pop stack, set image location counter
arg: none. */
-
case ETIR_S_C_CTL_SETRB:
dummy = _bfd_vms_pop (abfd, &psect);
image_set_ptr (abfd, psect, dummy);
break;
- /* augment relocation base: increment image location counter by offset
- arg: lw offset value */
-
+ /* Augment relocation base: increment image location counter by offset
+ arg: lw offset value. */
case ETIR_S_C_CTL_AUGRB:
dummy = bfd_getl32 (ptr);
image_inc_ptr (abfd, dummy);
break;
- /* define location: pop index, save location counter under index
+ /* Define location: pop index, save location counter under index
arg: none. */
-
case ETIR_S_C_CTL_DFLOC:
dummy = _bfd_vms_pop (abfd, NULL);
/* FIXME */
break;
- /* set location: pop index, restore location counter from index
+ /* Set location: pop index, restore location counter from index
arg: none. */
-
case ETIR_S_C_CTL_STLOC:
dummy = _bfd_vms_pop (abfd, &psect);
/* FIXME */
break;
- /* stack defined location: pop index, push location counter from index
+ /* Stack defined location: pop index, push location counter from index
arg: none. */
-
case ETIR_S_C_CTL_STKDL:
dummy = _bfd_vms_pop (abfd, &psect);
- /* FIXME */
+ /* FIXME. */
break;
default:
@@ -790,15 +682,12 @@ etir_ctl (abfd, cmd, ptr)
return TRUE;
}
-/* store conditional commands
+/* Store conditional commands
See table B-12 and B-13 of the openVMS linker manual. */
static bfd_boolean
-etir_stc (abfd, cmd, ptr)
- bfd *abfd;
- int cmd;
- unsigned char *ptr ATTRIBUTE_UNUSED;
+etir_stc (bfd * abfd, int cmd, unsigned char *ptr ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
_bfd_vms_debug (5, "etir_stc %d/%x\n", cmd, cmd);
@@ -809,7 +698,6 @@ etir_stc (abfd, cmd, ptr)
{
/* 200 Store-conditional Linkage Pair
arg: none. */
-
case ETIR_S_C_STC_LP:
(*_bfd_error_handler) (_("%s: not supported"), cmd_name (cmd));
break;
@@ -819,7 +707,6 @@ etir_stc (abfd, cmd, ptr)
cs procedure name
by signature length
da signature. */
-
case ETIR_S_C_STC_LP_PSB:
image_inc_ptr (abfd, (uquad) 16); /* skip entry,procval */
break;
@@ -835,7 +722,6 @@ etir_stc (abfd, cmd, ptr)
/* 203 Store-conditional Code Address at global address
arg: lw linkage index
cs procedure name. */
-
case ETIR_S_C_STC_GCA:
(*_bfd_error_handler) (_("%s: not supported"), cmd_name (cmd));
break;
@@ -844,59 +730,48 @@ etir_stc (abfd, cmd, ptr)
arg: lw linkage index
lw psect index
qw offset. */
-
case ETIR_S_C_STC_PS:
(*_bfd_error_handler) (_("%s: not supported"), cmd_name (cmd));
break;
/* 205 Store-conditional NOP at address of global
arg: none. */
-
case ETIR_S_C_STC_NOP_GBL:
/* 206 Store-conditional NOP at pect + offset
arg: none. */
-
case ETIR_S_C_STC_NOP_PS:
/* 207 Store-conditional BSR at global address
arg: none. */
-
case ETIR_S_C_STC_BSR_GBL:
/* 208 Store-conditional BSR at pect + offset
arg: none. */
-
case ETIR_S_C_STC_BSR_PS:
/* 209 Store-conditional LDA at global address
arg: none. */
-
case ETIR_S_C_STC_LDA_GBL:
/* 210 Store-conditional LDA at psect + offset
arg: none. */
-
case ETIR_S_C_STC_LDA_PS:
/* 211 Store-conditional BSR or Hint at global address
arg: none. */
-
case ETIR_S_C_STC_BOH_GBL:
/* 212 Store-conditional BSR or Hint at pect + offset
arg: none. */
-
case ETIR_S_C_STC_BOH_PS:
/* 213 Store-conditional NOP,BSR or HINT at global address
arg: none. */
-
case ETIR_S_C_STC_NBH_GBL:
/* 214 Store-conditional NOP,BSR or HINT at psect + offset
arg: none. */
-
case ETIR_S_C_STC_NBH_PS:
/* FIXME */
break;
@@ -911,9 +786,7 @@ etir_stc (abfd, cmd, ptr)
}
static asection *
-new_section (abfd, idx)
- bfd *abfd ATTRIBUTE_UNUSED;
- int idx;
+new_section (bfd * abfd ATTRIBUTE_UNUSED, int idx)
{
asection *section;
char sname[16];
@@ -926,7 +799,7 @@ new_section (abfd, idx)
name = bfd_malloc ((bfd_size_type) strlen (sname) + 1);
if (name == 0)
- return 0;
+ return NULL;
strcpy (name, sname);
section = bfd_malloc ((bfd_size_type) sizeof (asection));
@@ -935,7 +808,7 @@ new_section (abfd, idx)
#if VMS_DEBUG
_bfd_vms_debug (6, "bfd_make_section (%s) failed", name);
#endif
- return 0;
+ return NULL;
}
section->size = 0;
@@ -948,9 +821,7 @@ new_section (abfd, idx)
}
static int
-alloc_section (abfd, idx)
- bfd *abfd;
- unsigned int idx;
+alloc_section (bfd * abfd, unsigned int idx)
{
bfd_size_type amt;
@@ -960,7 +831,7 @@ alloc_section (abfd, idx)
amt = idx + 1;
amt *= sizeof (asection *);
- PRIV (sections) = (asection **) bfd_realloc (PRIV (sections), amt);
+ PRIV (sections) = bfd_realloc (PRIV (sections), amt);
if (PRIV (sections) == 0)
return -1;
@@ -986,7 +857,7 @@ alloc_section (abfd, idx)
See table 7-3 of the VAX/VMS linker manual. */
static unsigned char *
-tir_sta (bfd *abfd, unsigned char *ptr)
+tir_sta (bfd * abfd, unsigned char *ptr)
{
int cmd = *ptr++;
@@ -1009,8 +880,8 @@ tir_sta (bfd *abfd, unsigned char *ptr)
name = _bfd_vms_save_counted_string (ptr);
entry = _bfd_vms_enter_symbol (abfd, name);
- if (entry == (vms_symbol_entry *) NULL)
- return 0;
+ if (entry == NULL)
+ return NULL;
_bfd_vms_push (abfd, (uquad) (entry->symbol->value), -1);
ptr += *ptr + 1;
@@ -1167,8 +1038,8 @@ tir_sta (bfd *abfd, unsigned char *ptr)
name = _bfd_vms_save_counted_string (ptr);
entry = _bfd_vms_enter_symbol (abfd, name);
- if (entry == (vms_symbol_entry *) NULL)
- return 0;
+ if (entry == NULL)
+ return NULL;
(*_bfd_error_handler) (_("stack-entry-mask not fully implemented"));
_bfd_vms_push (abfd, (uquad) 0, -1);
@@ -1201,8 +1072,8 @@ tir_sta (bfd *abfd, unsigned char *ptr)
ptr += 2;
name = _bfd_vms_save_counted_string (ptr);
entry = _bfd_vms_enter_symbol (abfd, name);
- if (entry == (vms_symbol_entry *) NULL)
- return 0;
+ if (entry == NULL)
+ return NULL;
(*_bfd_error_handler) (_("stack-local-symbol not fully implemented"));
_bfd_vms_push (abfd, (uquad) 0, -1);
ptr += *ptr + 1;
@@ -1235,8 +1106,8 @@ tir_sta (bfd *abfd, unsigned char *ptr)
ptr += 2;
name = _bfd_vms_save_counted_string (ptr);
entry = _bfd_vms_enter_symbol (abfd, name);
- if (entry == (vms_symbol_entry *) NULL)
- return 0;
+ if (entry == NULL)
+ return NULL;
(*_bfd_error_handler) (_("stack-local-symbol-entry-point-mask not fully implemented"));
_bfd_vms_push (abfd, (uquad) 0, -1);
ptr += *ptr + 1;
@@ -1253,8 +1124,7 @@ tir_sta (bfd *abfd, unsigned char *ptr)
}
static const char *
-tir_cmd_name (cmd)
- int cmd;
+tir_cmd_name (int cmd)
{
switch (cmd)
{
@@ -1293,7 +1163,7 @@ tir_cmd_name (cmd)
See table 7-4 of the VAX/VMS linker manual. */
static unsigned char *
-tir_sto (bfd *abfd, unsigned char *ptr)
+tir_sto (bfd * abfd, unsigned char *ptr)
{
unsigned long dummy;
int size;
@@ -1306,28 +1176,28 @@ tir_sto (bfd *abfd, unsigned char *ptr)
switch (*ptr++)
{
case TIR_S_C_STO_SB:
- /* store signed byte: pop stack, write byte
+ /* Store signed byte: pop stack, write byte
arg: none. */
dummy = _bfd_vms_pop (abfd, &psect);
image_write_b (abfd, dummy & 0xff); /* FIXME: check top bits */
break;
case TIR_S_C_STO_SW:
- /* store signed word: pop stack, write word
+ /* Store signed word: pop stack, write word
arg: none. */
dummy = _bfd_vms_pop (abfd, &psect);
image_write_w (abfd, dummy & 0xffff); /* FIXME: check top bits */
break;
case TIR_S_C_STO_LW:
- /* store longword: pop stack, write longword
+ /* Store longword: pop stack, write longword
arg: none. */
dummy = _bfd_vms_pop (abfd, &psect);
image_write_l (abfd, dummy & 0xffffffff); /* FIXME: check top bits */
break;
case TIR_S_C_STO_BD:
- /* store byte displaced: pop stack, sub lc+1, write byte
+ /* Store byte displaced: pop stack, sub lc+1, write byte
arg: none. */
dummy = _bfd_vms_pop (abfd, &psect);
dummy -= ((PRIV (sections)[psect])->vma + 1);
@@ -1335,7 +1205,7 @@ tir_sto (bfd *abfd, unsigned char *ptr)
break;
case TIR_S_C_STO_WD:
- /* store word displaced: pop stack, sub lc+2, write word
+ /* Store word displaced: pop stack, sub lc+2, write word
arg: none. */
dummy = _bfd_vms_pop (abfd, &psect);
dummy -= ((PRIV (sections)[psect])->vma + 2);
@@ -1343,7 +1213,7 @@ tir_sto (bfd *abfd, unsigned char *ptr)
break;
case TIR_S_C_STO_LD:
- /* store long displaced: pop stack, sub lc+4, write long
+ /* Store long displaced: pop stack, sub lc+4, write long
arg: none. */
dummy = _bfd_vms_pop (abfd, &psect);
dummy -= ((PRIV (sections)[psect])->vma + 4);
@@ -1351,14 +1221,14 @@ tir_sto (bfd *abfd, unsigned char *ptr)
break;
case TIR_S_C_STO_LI:
- /* store short literal: pop stack, write byte
+ /* Store short literal: pop stack, write byte
arg: none. */
dummy = _bfd_vms_pop (abfd, &psect);
image_write_b (abfd, dummy & 0xff);/* FIXME: check top bits */
break;
case TIR_S_C_STO_PIDR:
- /* store position independent data reference: pop stack, write longword
+ /* Store position independent data reference: pop stack, write longword
arg: none.
FIXME: incomplete ! */
dummy = _bfd_vms_pop (abfd, &psect);
@@ -1366,7 +1236,7 @@ tir_sto (bfd *abfd, unsigned char *ptr)
break;
case TIR_S_C_STO_PICR:
- /* store position independent code reference: pop stack, write longword
+ /* Store position independent code reference: pop stack, write longword
arg: none.
FIXME: incomplete ! */
dummy = _bfd_vms_pop (abfd, &psect);
@@ -1375,7 +1245,7 @@ tir_sto (bfd *abfd, unsigned char *ptr)
break;
case TIR_S_C_STO_RIVB:
- /* store repeated immediate variable bytes
+ /* Store repeated immediate variable bytes
1-byte count n field followed by n bytes of data
pop stack, write n bytes <stack> times. */
size = *ptr++;
@@ -1386,19 +1256,19 @@ tir_sto (bfd *abfd, unsigned char *ptr)
break;
case TIR_S_C_STO_B:
- /* store byte from top longword. */
+ /* Store byte from top longword. */
dummy = (unsigned long) _bfd_vms_pop (abfd, NULL);
image_write_b (abfd, dummy & 0xff);
break;
case TIR_S_C_STO_W:
- /* store word from top longword. */
+ /* Store word from top longword. */
dummy = (unsigned long) _bfd_vms_pop (abfd, NULL);
image_write_w (abfd, dummy & 0xffff);
break;
case TIR_S_C_STO_RB:
- /* store repeated byte from top longword. */
+ /* Store repeated byte from top longword. */
size = (unsigned long) _bfd_vms_pop (abfd, NULL);
dummy = (unsigned long) _bfd_vms_pop (abfd, NULL);
while (size-- > 0)
@@ -1406,7 +1276,7 @@ tir_sto (bfd *abfd, unsigned char *ptr)
break;
case TIR_S_C_STO_RW:
- /* store repeated word from top longword. */
+ /* Store repeated word from top longword. */
size = (unsigned long) _bfd_vms_pop (abfd, NULL);
dummy = (unsigned long) _bfd_vms_pop (abfd, NULL);
while (size-- > 0)
@@ -1433,17 +1303,15 @@ tir_sto (bfd *abfd, unsigned char *ptr)
return ptr;
}
-/* stack operator commands
- all 32 bit signed arithmetic
- all word just like a stack calculator
- arguments are popped from stack, results are pushed on stack
+/* Stack operator commands
+ All 32 bit signed arithmetic
+ All word just like a stack calculator
+ Arguments are popped from stack, results are pushed on stack
See table 7-5 of the VAX/VMS linker manual. */
static unsigned char *
-tir_opr (abfd, ptr)
- bfd *abfd;
- unsigned char *ptr;
+tir_opr (bfd * abfd, unsigned char *ptr)
{
long op1, op2;
@@ -1451,31 +1319,31 @@ tir_opr (abfd, ptr)
_bfd_vms_debug (5, "tir_opr %d\n", *ptr);
#endif
+ /* Operation. */
switch (*ptr++)
{
- /* operation */
- case TIR_S_C_OPR_NOP: /* no-op */
+ case TIR_S_C_OPR_NOP: /* No-op. */
break;
- case TIR_S_C_OPR_ADD: /* add */
+ case TIR_S_C_OPR_ADD: /* Add. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
_bfd_vms_push (abfd, (uquad) (op1 + op2), -1);
break;
- case TIR_S_C_OPR_SUB: /* subtract */
+ case TIR_S_C_OPR_SUB: /* Subtract. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
_bfd_vms_push (abfd, (uquad) (op2 - op1), -1);
break;
- case TIR_S_C_OPR_MUL: /* multiply */
+ case TIR_S_C_OPR_MUL: /* Multiply. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
_bfd_vms_push (abfd, (uquad) (op1 * op2), -1);
break;
- case TIR_S_C_OPR_DIV: /* divide */
+ case TIR_S_C_OPR_DIV: /* Divide. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
if (op2 == 0)
@@ -1484,77 +1352,77 @@ tir_opr (abfd, ptr)
_bfd_vms_push (abfd, (uquad) (op2 / op1), -1);
break;
- case TIR_S_C_OPR_AND: /* logical and */
+ case TIR_S_C_OPR_AND: /* Logical AND. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
_bfd_vms_push (abfd, (uquad) (op1 & op2), -1);
break;
- case TIR_S_C_OPR_IOR: /* logical inclusive or */
+ case TIR_S_C_OPR_IOR: /* Logical inclusive OR. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
_bfd_vms_push (abfd, (uquad) (op1 | op2), -1);
break;
- case TIR_S_C_OPR_EOR: /* logical exclusive or */
+ case TIR_S_C_OPR_EOR: /* Logical exclusive OR. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
_bfd_vms_push (abfd, (uquad) (op1 ^ op2), -1);
break;
- case TIR_S_C_OPR_NEG: /* negate */
+ case TIR_S_C_OPR_NEG: /* Negate. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
_bfd_vms_push (abfd, (uquad) (-op1), -1);
break;
- case TIR_S_C_OPR_COM: /* complement */
+ case TIR_S_C_OPR_COM: /* Complement. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
_bfd_vms_push (abfd, (uquad) (op1 ^ -1L), -1);
break;
- case TIR_S_C_OPR_INSV: /* insert field */
+ case TIR_S_C_OPR_INSV: /* Insert field. */
(void) _bfd_vms_pop (abfd, NULL);
(*_bfd_error_handler) (_("%s: not fully implemented"),
tir_cmd_name (ptr[-1]));
break;
- case TIR_S_C_OPR_ASH: /* arithmetic shift */
+ case TIR_S_C_OPR_ASH: /* Arithmetic shift. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
- if (HIGHBIT (op1)) /* shift right */
+ if (HIGHBIT (op1)) /* Shift right. */
op2 >>= op1;
- else /* shift left */
+ else /* Shift left. */
op2 <<= op1;
_bfd_vms_push (abfd, (uquad) op2, -1);
(*_bfd_error_handler) (_("%s: not fully implemented"),
tir_cmd_name (ptr[-1]));
break;
- case TIR_S_C_OPR_USH: /* unsigned shift */
+ case TIR_S_C_OPR_USH: /* Unsigned shift. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
- if (HIGHBIT (op1)) /* shift right */
+ if (HIGHBIT (op1)) /* Shift right. */
op2 >>= op1;
- else /* shift left */
+ else /* Shift left. */
op2 <<= op1;
_bfd_vms_push (abfd, (uquad) op2, -1);
(*_bfd_error_handler) (_("%s: not fully implemented"),
tir_cmd_name (ptr[-1]));
break;
- case TIR_S_C_OPR_ROT: /* rotate */
+ case TIR_S_C_OPR_ROT: /* Rotate. */
op1 = (long) _bfd_vms_pop (abfd, NULL);
op2 = (long) _bfd_vms_pop (abfd, NULL);
- if (HIGHBIT (0)) /* shift right */
+ if (HIGHBIT (0)) /* Shift right. */
op2 >>= op1;
- else /* shift left */
+ else /* Shift left. */
op2 <<= op1;
_bfd_vms_push (abfd, (uquad) op2, -1);
(*_bfd_error_handler) (_("%s: not fully implemented"),
tir_cmd_name (ptr[-1]));
break;
- case TIR_S_C_OPR_SEL: /* select */
+ case TIR_S_C_OPR_SEL: /* Select. */
if ((long) _bfd_vms_pop (abfd, NULL) & 0x01L)
(void) _bfd_vms_pop (abfd, NULL);
else
@@ -1579,12 +1447,12 @@ tir_opr (abfd, ptr)
return ptr;
}
-/* control commands
+/* Control commands
See table 7-6 of the VAX/VMS linker manual. */
static unsigned char *
-tir_ctl (bfd *abfd, unsigned char *ptr)
+tir_ctl (bfd * abfd, unsigned char *ptr)
{
unsigned long dummy;
unsigned int psect;
@@ -1645,7 +1513,7 @@ tir_ctl (bfd *abfd, unsigned char *ptr)
/* Handle command from TIR section. */
static unsigned char *
-tir_cmd (bfd *abfd, unsigned char *ptr)
+tir_cmd (bfd * abfd, unsigned char *ptr)
{
struct
{
@@ -1668,8 +1536,9 @@ tir_cmd (bfd *abfd, unsigned char *ptr)
_bfd_hexdump (8, ptr, 16, (int) ptr);
#endif
- if (*ptr & 0x80) /* store immediate */
+ if (*ptr & 0x80)
{
+ /* Store immediate. */
i = 128 - (*ptr++ & 0x7f);
image_dump (abfd, ptr, i, 0);
ptr += i;
@@ -1699,16 +1568,13 @@ tir_cmd (bfd *abfd, unsigned char *ptr)
/* Handle command from ETIR section. */
static int
-etir_cmd (abfd, cmd, ptr)
- bfd *abfd;
- int cmd;
- unsigned char *ptr;
+etir_cmd (bfd * abfd, int cmd, unsigned char *ptr)
{
static struct
{
int mincod;
int maxcod;
- bfd_boolean (*explain) PARAMS ((bfd *, int, unsigned char *));
+ bfd_boolean (*explain) (bfd *, int, unsigned char *);
}
etir_table[] =
{
@@ -1749,10 +1615,7 @@ etir_cmd (abfd, cmd, ptr)
handle tir record. */
static int
-analyze_tir (abfd, ptr, length)
- bfd *abfd;
- unsigned char *ptr;
- unsigned int length;
+analyze_tir (bfd * abfd, unsigned char *ptr, unsigned int length)
{
unsigned char *maxptr;
@@ -1776,10 +1639,7 @@ analyze_tir (abfd, ptr, length)
handle etir record. */
static int
-analyze_etir (abfd, ptr, length)
- bfd *abfd;
- unsigned char *ptr;
- unsigned int length;
+analyze_etir (bfd * abfd, unsigned char *ptr, unsigned int length)
{
int cmd;
unsigned char *maxptr;
@@ -1812,9 +1672,7 @@ analyze_etir (abfd, ptr, length)
Return 0 on success, -1 on error. */
int
-_bfd_vms_slurp_tir (abfd, objtype)
- bfd *abfd;
- int objtype;
+_bfd_vms_slurp_tir (bfd * abfd, int objtype)
{
int result;
@@ -1825,12 +1683,12 @@ _bfd_vms_slurp_tir (abfd, objtype)
switch (objtype)
{
case EOBJ_S_C_ETIR:
- PRIV (vms_rec) += 4; /* skip type, size */
+ PRIV (vms_rec) += 4; /* Skip type, size. */
PRIV (rec_size) -= 4;
result = analyze_etir (abfd, PRIV (vms_rec), (unsigned) PRIV (rec_size));
break;
case OBJ_S_C_TIR:
- PRIV (vms_rec) += 1; /* skip type */
+ PRIV (vms_rec) += 1; /* Skip type. */
PRIV (rec_size) -= 1;
result = analyze_tir (abfd, PRIV (vms_rec), (unsigned) PRIV (rec_size));
break;
@@ -1848,9 +1706,7 @@ _bfd_vms_slurp_tir (abfd, objtype)
Not implemented yet. */
int
-_bfd_vms_slurp_dbg (abfd, objtype)
- bfd *abfd;
- int objtype ATTRIBUTE_UNUSED;
+_bfd_vms_slurp_dbg (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
_bfd_vms_debug (2, "DBG/EDBG\n");
@@ -1866,9 +1722,8 @@ _bfd_vms_slurp_dbg (abfd, objtype)
Not implemented yet. */
int
-_bfd_vms_slurp_tbt (abfd, objtype)
- bfd *abfd ATTRIBUTE_UNUSED;
- int objtype ATTRIBUTE_UNUSED;
+_bfd_vms_slurp_tbt (bfd * abfd ATTRIBUTE_UNUSED,
+ int objtype ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
_bfd_vms_debug (2, "TBT/ETBT\n");
@@ -1883,9 +1738,8 @@ _bfd_vms_slurp_tbt (abfd, objtype)
Not implemented yet. */
int
-_bfd_vms_slurp_lnk (abfd, objtype)
- bfd *abfd ATTRIBUTE_UNUSED;
- int objtype ATTRIBUTE_UNUSED;
+_bfd_vms_slurp_lnk (bfd * abfd ATTRIBUTE_UNUSED,
+ int objtype ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
_bfd_vms_debug (2, "LNK\n");
@@ -1894,23 +1748,42 @@ _bfd_vms_slurp_lnk (abfd, objtype)
return 0;
}
+/* Start ETIR record for section #index at virtual addr offset. */
+
+static void
+start_etir_record (bfd * abfd, int index, uquad offset, bfd_boolean justoffset)
+{
+ if (!justoffset)
+ {
+ /* One ETIR per section. */
+ _bfd_vms_output_begin (abfd, EOBJ_S_C_ETIR, -1);
+ _bfd_vms_output_push (abfd);
+ }
+
+ /* Push start offset. */
+ _bfd_vms_output_begin (abfd, ETIR_S_C_STA_PQ, -1);
+ _bfd_vms_output_long (abfd, (unsigned long) index);
+ _bfd_vms_output_quad (abfd, (uquad) offset);
+ _bfd_vms_output_flush (abfd);
+
+ /* Start = pop (). */
+ _bfd_vms_output_begin (abfd, ETIR_S_C_CTL_SETRB, -1);
+ _bfd_vms_output_flush (abfd);
+}
+
+static void
+end_etir_record (bfd * abfd)
+{
+ _bfd_vms_output_pop (abfd);
+ _bfd_vms_output_end (abfd);
+}
+
/* WRITE ETIR SECTION
This is still under construction and therefore not documented. */
-static void start_etir_record
- PARAMS ((bfd *abfd, int index, uquad offset, bfd_boolean justoffset));
-static void sto_imm
- PARAMS ((bfd *abfd, vms_section *sptr, bfd_vma vaddr, int index));
-static void end_etir_record
- PARAMS ((bfd *abfd));
-
static void
-sto_imm (abfd, sptr, vaddr, index)
- bfd *abfd;
- vms_section *sptr;
- bfd_vma vaddr;
- int index;
+sto_imm (bfd * abfd, vms_section *sptr, bfd_vma vaddr, int index)
{
int size;
int ssize;
@@ -1926,14 +1799,18 @@ sto_imm (abfd, sptr, vaddr, index)
while (ssize > 0)
{
- size = ssize; /* try all the rest */
+ /* Try all the rest. */
+ size = ssize;
if (_bfd_vms_output_check (abfd, size) < 0)
- { /* doesn't fit, split ! */
+ {
+ /* Doesn't fit, split ! */
end_etir_record (abfd);
start_etir_record (abfd, index, vaddr, FALSE);
- size = _bfd_vms_output_check (abfd, 0); /* get max size */
- if (size > ssize) /* more than what's left ? */
+ /* Get max size. */
+ size = _bfd_vms_output_check (abfd, 0);
+ /* More than what's left ? */
+ if (size > ssize)
size = ssize;
}
@@ -1953,46 +1830,10 @@ sto_imm (abfd, sptr, vaddr, index)
}
}
-/* Start ETIR record for section #index at virtual addr offset. */
-
-static void
-start_etir_record (abfd, index, offset, justoffset)
- bfd *abfd;
- int index;
- uquad offset;
- bfd_boolean justoffset;
-{
- if (!justoffset)
- {
- _bfd_vms_output_begin (abfd, EOBJ_S_C_ETIR, -1); /* one ETIR per section */
- _bfd_vms_output_push (abfd);
- }
-
- _bfd_vms_output_begin (abfd, ETIR_S_C_STA_PQ, -1); /* push start offset */
- _bfd_vms_output_long (abfd, (unsigned long) index);
- _bfd_vms_output_quad (abfd, (uquad) offset);
- _bfd_vms_output_flush (abfd);
-
- _bfd_vms_output_begin (abfd, ETIR_S_C_CTL_SETRB, -1); /* start = pop () */
- _bfd_vms_output_flush (abfd);
-}
-
-/* End etir record. */
-
-static void
-end_etir_record (abfd)
- bfd *abfd;
-{
- _bfd_vms_output_pop (abfd);
- _bfd_vms_output_end (abfd);
-}
-
/* Write section contents for bfd abfd. */
int
-_bfd_vms_write_tir (abfd, objtype)
- bfd *abfd;
- int objtype ATTRIBUTE_UNUSED;
+_bfd_vms_write_tir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
{
asection *section;
vms_section *sptr;
@@ -2008,7 +1849,6 @@ _bfd_vms_write_tir (abfd, objtype)
PRIV (vms_linkage_index) = 1;
/* Dump all other sections. */
-
section = abfd->sections;
while (section != NULL)
@@ -2025,10 +1865,8 @@ _bfd_vms_write_tir (abfd, objtype)
int i;
if ((i = section->reloc_count) <= 0)
- {
- (*_bfd_error_handler) (_("SEC_RELOC with no relocs in section %s"),
- section->name);
- }
+ (*_bfd_error_handler) (_("SEC_RELOC with no relocs in section %s"),
+ section->name);
#if VMS_DEBUG
else
{
@@ -2053,7 +1891,8 @@ _bfd_vms_write_tir (abfd, objtype)
if ((section->flags & SEC_HAS_CONTENTS)
&& (! bfd_is_com_section (section)))
{
- bfd_vma vaddr; /* Virtual addr in section. */
+ /* Virtual addr in section. */
+ bfd_vma vaddr;
sptr = _bfd_get_vms_section (abfd, section->index);
if (sptr == NULL)
@@ -2067,11 +1906,12 @@ _bfd_vms_write_tir (abfd, objtype)
start_etir_record (abfd, section->index, (uquad) sptr->offset,
FALSE);
- while (sptr != NULL) /* one STA_PQ, CTL_SETRB per vms_section */
+ while (sptr != NULL)
{
-
- if (section->flags & SEC_RELOC) /* check for relocs */
+ /* One STA_PQ, CTL_SETRB per vms_section. */
+ if (section->flags & SEC_RELOC)
{
+ /* Check for relocs. */
arelent **rptr = section->orelocation;
int i = section->reloc_count;
@@ -2079,18 +1919,22 @@ _bfd_vms_write_tir (abfd, objtype)
{
bfd_size_type addr = (*rptr)->address;
bfd_size_type len = bfd_get_reloc_size ((*rptr)->howto);
- if (sptr->offset < addr) /* sptr starts before reloc */
+ if (sptr->offset < addr)
{
+ /* Sptr starts before reloc. */
bfd_size_type before = addr - sptr->offset;
- if (sptr->size <= before) /* complete before */
+ if (sptr->size <= before)
{
+ /* Complete before. */
sto_imm (abfd, sptr, vaddr, section->index);
vaddr += sptr->size;
break;
}
- else /* partly before */
+ else
{
+ /* Partly before. */
int after = sptr->size - before;
+
sptr->size = before;
sto_imm (abfd, sptr, vaddr, section->index);
vaddr += sptr->size;
@@ -2099,8 +1943,9 @@ _bfd_vms_write_tir (abfd, objtype)
sptr->size = after;
}
}
- else if (sptr->offset == addr) /* sptr starts at reloc */
+ else if (sptr->offset == addr)
{
+ /* Sptr starts at reloc. */
asymbol *sym = *(*rptr)->sym_ptr_ptr;
asection *sec = sym->section;
@@ -2183,6 +2028,7 @@ _bfd_vms_write_tir (abfd, objtype)
{
int slen = strlen ((char *) sym->name);
char *hash;
+
if (_bfd_vms_output_check (abfd, slen) < 0)
{
end_etir_record (abfd);
@@ -2321,37 +2167,39 @@ _bfd_vms_write_tir (abfd, objtype)
rptr++;
}
}
- else /* sptr starts after reloc */
+ else
{
- i--; /* check next reloc */
+ /* Sptr starts after reloc. */
+ i--;
+ /* Check next reloc. */
rptr++;
}
- if (i==0) /* all reloc checked */
+ if (i == 0)
{
+ /* All reloc checked. */
if (sptr->size > 0)
{
- /* dump rest */
+ /* Dump rest. */
sto_imm (abfd, sptr, vaddr, section->index);
vaddr += sptr->size;
}
break;
}
- } /* for (;;) */
- } /* if SEC_RELOC */
- else /* no relocs, just dump */
+ }
+ }
+ else
{
+ /* No relocs, just dump. */
sto_imm (abfd, sptr, vaddr, section->index);
vaddr += sptr->size;
}
sptr = sptr->next;
-
- } /* while (sptr != 0) */
+ }
end_etir_record (abfd);
-
- } /* has_contents */
+ }
section = section->next;
}
@@ -2363,9 +2211,8 @@ _bfd_vms_write_tir (abfd, objtype)
/* Write traceback data for bfd abfd. */
int
-_bfd_vms_write_tbt (abfd, objtype)
- bfd *abfd ATTRIBUTE_UNUSED;
- int objtype ATTRIBUTE_UNUSED;
+_bfd_vms_write_tbt (bfd * abfd ATTRIBUTE_UNUSED,
+ int objtype ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
_bfd_vms_debug (2, "vms_write_tbt (%p, %d)\n", abfd, objtype);
@@ -2377,9 +2224,8 @@ _bfd_vms_write_tbt (abfd, objtype)
/* Write debug info for bfd abfd. */
int
-_bfd_vms_write_dbg (abfd, objtype)
- bfd *abfd ATTRIBUTE_UNUSED;
- int objtype ATTRIBUTE_UNUSED;
+_bfd_vms_write_dbg (bfd * abfd ATTRIBUTE_UNUSED,
+ int objtype ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
_bfd_vms_debug (2, "vms_write_dbg (%p, objtype)\n", abfd, objtype);
diff --git a/bfd/vms.c b/bfd/vms.c
index 0616208..5d81353 100644
--- a/bfd/vms.c
+++ b/bfd/vms.c
@@ -5,19 +5,19 @@
Written by Klaus K"ampf (kkaempf@rmi.de)
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -26,253 +26,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "vms.h"
-static bfd_boolean vms_initialize
- PARAMS ((bfd *));
-static unsigned int priv_section_count;
-static bfd_boolean fill_section_ptr
- PARAMS ((struct bfd_hash_entry *, PTR));
-static bfd_boolean vms_fixup_sections
- PARAMS ((bfd *));
-static bfd_boolean copy_symbols
- PARAMS ((struct bfd_hash_entry *, PTR));
-static bfd_reloc_status_type reloc_nil
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static const struct bfd_target *vms_object_p
- PARAMS ((bfd *abfd));
-static const struct bfd_target *vms_archive_p
- PARAMS ((bfd *abfd));
-static bfd_boolean vms_mkobject
- PARAMS ((bfd *abfd));
-static bfd_boolean vms_write_object_contents
- PARAMS ((bfd *abfd));
-static bfd_boolean vms_close_and_cleanup
- PARAMS ((bfd *abfd));
-static bfd_boolean vms_bfd_free_cached_info
- PARAMS ((bfd *abfd));
-static bfd_boolean vms_new_section_hook
- PARAMS ((bfd *abfd, asection *section));
-static bfd_boolean vms_get_section_contents
- PARAMS ((bfd *abfd, asection *section, PTR x1, file_ptr x2,
- bfd_size_type x3));
-static bfd_boolean vms_get_section_contents_in_window
- PARAMS ((bfd *abfd, asection *section, bfd_window *w, file_ptr offset,
- bfd_size_type count));
-static bfd_boolean vms_bfd_copy_private_bfd_data
- PARAMS ((bfd *src, bfd *dest));
-static bfd_boolean vms_bfd_copy_private_section_data
- PARAMS ((bfd *srcbfd, asection *srcsec, bfd *dstbfd, asection *dstsec));
-static bfd_boolean vms_bfd_copy_private_symbol_data
- PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym));
-static bfd_boolean vms_bfd_print_private_bfd_data
- PARAMS ((bfd *abfd, void *file));
-static char *vms_core_file_failing_command
- PARAMS ((bfd *abfd));
-static int vms_core_file_failing_signal
- PARAMS ((bfd *abfd));
-static bfd_boolean vms_core_file_matches_executable_p
- PARAMS ((bfd *abfd, bfd *bbfd));
-static bfd_boolean vms_slurp_armap
- PARAMS ((bfd *abfd));
-static bfd_boolean vms_slurp_extended_name_table
- PARAMS ((bfd *abfd));
-static bfd_boolean vms_construct_extended_name_table
- PARAMS ((bfd *abfd, char **tabloc, bfd_size_type *tablen,
- const char **name));
-static void vms_truncate_arname
- PARAMS ((bfd *abfd, const char *pathname, char *arhdr));
-static bfd_boolean vms_write_armap
- PARAMS ((bfd *arch, unsigned int elength, struct orl *map,
- unsigned int orl_count, int stridx));
-static PTR vms_read_ar_hdr
- PARAMS ((bfd *abfd));
-static bfd *vms_get_elt_at_index
- PARAMS ((bfd *abfd, symindex index));
-static bfd *vms_openr_next_archived_file
- PARAMS ((bfd *arch, bfd *prev));
-static bfd_boolean vms_update_armap_timestamp
- PARAMS ((bfd *abfd));
-static int vms_generic_stat_arch_elt
- PARAMS ((bfd *, struct stat *));
-static long vms_get_symtab_upper_bound
- PARAMS ((bfd *abfd));
-static long vms_canonicalize_symtab
- PARAMS ((bfd *abfd, asymbol **symbols));
-static void vms_print_symbol
- PARAMS ((bfd *abfd, PTR file, asymbol *symbol, bfd_print_symbol_type how));
-static void vms_get_symbol_info
- PARAMS ((bfd *abfd, asymbol *symbol, symbol_info *ret));
-static bfd_boolean vms_bfd_is_local_label_name
- PARAMS ((bfd *abfd, const char *));
-static alent *vms_get_lineno
- PARAMS ((bfd *abfd, asymbol *symbol));
-static bfd_boolean vms_find_nearest_line
- PARAMS ((bfd *abfd, asection *section, asymbol **symbols, bfd_vma offset,
- const char **file, const char **func, unsigned int *line));
-static asymbol *vms_bfd_make_debug_symbol
- PARAMS ((bfd *abfd, void *ptr, unsigned long size));
-static long vms_read_minisymbols
- PARAMS ((bfd *abfd, bfd_boolean dynamic, PTR *minisymsp,
- unsigned int *sizep));
-static asymbol *vms_minisymbol_to_symbol
- PARAMS ((bfd *abfd, bfd_boolean dynamic, const PTR minisym, asymbol *sym));
-static long vms_get_reloc_upper_bound
- PARAMS ((bfd *abfd, asection *sect));
-static long vms_canonicalize_reloc
- PARAMS ((bfd *abfd, asection *srcsec, arelent **location,
- asymbol **symbols));
-static const struct reloc_howto_struct *vms_bfd_reloc_type_lookup
- PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
-static bfd_boolean vms_set_arch_mach
- PARAMS ((bfd *abfd, enum bfd_architecture arch, unsigned long mach));
-static bfd_boolean vms_set_section_contents
- PARAMS ((bfd *abfd, asection *section, const PTR location, file_ptr offset,
- bfd_size_type count));
-static int vms_sizeof_headers
- PARAMS ((bfd *abfd, bfd_boolean reloc));
-static bfd_byte *vms_bfd_get_relocated_section_contents
- PARAMS ((bfd *abfd, struct bfd_link_info *link_info,
- struct bfd_link_order *link_order, bfd_byte *data,
- bfd_boolean relocatable, asymbol **symbols));
-static bfd_boolean vms_bfd_relax_section
- PARAMS ((bfd *abfd, asection *section, struct bfd_link_info *link_info,
- bfd_boolean *again));
-static bfd_boolean vms_bfd_gc_sections
- PARAMS ((bfd *abfd, struct bfd_link_info *link_info));
-static bfd_boolean vms_bfd_merge_sections
- PARAMS ((bfd *abfd, struct bfd_link_info *link_info));
-static struct bfd_link_hash_table *vms_bfd_link_hash_table_create
- PARAMS ((bfd *abfd));
-static void vms_bfd_link_hash_table_free
- PARAMS ((struct bfd_link_hash_table *hash));
-static bfd_boolean vms_bfd_link_add_symbols
- PARAMS ((bfd *abfd, struct bfd_link_info *link_info));
-static bfd_boolean vms_bfd_final_link
- PARAMS ((bfd *abfd, struct bfd_link_info *link_info));
-static bfd_boolean vms_bfd_link_split_section
- PARAMS ((bfd *abfd, asection *section));
-static long vms_get_dynamic_symtab_upper_bound
- PARAMS ((bfd *abfd));
-static long vms_canonicalize_dynamic_symtab
- PARAMS ((bfd *abfd, asymbol **symbols));
-#define vms_get_synthetic_symtab _bfd_nodynamic_get_synthetic_symtab
-static long vms_get_dynamic_reloc_upper_bound
- PARAMS ((bfd *abfd));
-static long vms_canonicalize_dynamic_reloc
- PARAMS ((bfd *abfd, arelent **arel, asymbol **symbols));
-static bfd_boolean vms_bfd_merge_private_bfd_data
- PARAMS ((bfd *ibfd, bfd *obfd));
-static bfd_boolean vms_bfd_set_private_flags
- PARAMS ((bfd *abfd, flagword flags));
-
#define vms_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
-#define vms_make_empty_symbol _bfd_generic_make_empty_symbol
-#define vms_bfd_link_just_syms _bfd_generic_link_just_syms
-#define vms_bfd_is_group_section bfd_generic_is_group_section
-#define vms_bfd_discard_group bfd_generic_discard_group
-#define vms_section_already_linked \
- _bfd_generic_section_already_linked
-#define vms_bfd_copy_private_header_data \
- _bfd_generic_bfd_copy_private_header_data
-
-/*===========================================================================*/
-
-const bfd_target vms_alpha_vec =
-{
- "vms-alpha", /* name */
- bfd_target_evax_flavour,
- BFD_ENDIAN_LITTLE, /* data byte order is little */
- BFD_ENDIAN_LITTLE, /* header byte order is little */
-
- (HAS_RELOC | HAS_SYMS
- | WP_TEXT | D_PAGED), /* object flags */
- (SEC_ALLOC | SEC_LOAD | SEC_RELOC
- | SEC_READONLY | SEC_CODE | SEC_DATA
- | SEC_HAS_CONTENTS | SEC_IN_MEMORY), /* sect flags */
- 0, /* symbol_leading_char */
- ' ', /* ar_pad_char */
- 15, /* ar_max_namelen */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16,
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16,
-
- {_bfd_dummy_target, vms_object_p, /* bfd_check_format */
- vms_archive_p, _bfd_dummy_target},
- {bfd_false, vms_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, vms_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (vms),
- BFD_JUMP_TABLE_COPY (vms),
- BFD_JUMP_TABLE_CORE (vms),
- BFD_JUMP_TABLE_ARCHIVE (vms),
- BFD_JUMP_TABLE_SYMBOLS (vms),
- BFD_JUMP_TABLE_RELOCS (vms),
- BFD_JUMP_TABLE_WRITE (vms),
- BFD_JUMP_TABLE_LINK (vms),
- BFD_JUMP_TABLE_DYNAMIC (vms),
-
- NULL,
-
- (PTR) 0
-};
-
-const bfd_target vms_vax_vec =
-{
- "vms-vax", /* name */
- bfd_target_ovax_flavour,
- BFD_ENDIAN_LITTLE, /* data byte order is little */
- BFD_ENDIAN_LITTLE, /* header byte order is little */
-
- (HAS_RELOC | HAS_SYMS /* object flags */
- | WP_TEXT | D_PAGED
- | HAS_LINENO | HAS_DEBUG | HAS_LOCALS),
+#define vms_make_empty_symbol _bfd_generic_make_empty_symbol
+#define vms_bfd_link_just_syms _bfd_generic_link_just_syms
+#define vms_bfd_is_group_section bfd_generic_is_group_section
+#define vms_bfd_discard_group bfd_generic_discard_group
+#define vms_section_already_linked _bfd_generic_section_already_linked
+#define vms_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
+#define vms_get_synthetic_symtab _bfd_nodynamic_get_synthetic_symtab
- (SEC_ALLOC | SEC_LOAD | SEC_RELOC
- | SEC_READONLY | SEC_CODE | SEC_DATA
- | SEC_HAS_CONTENTS | SEC_IN_MEMORY), /* sect flags */
- 0, /* symbol_leading_char */
- ' ', /* ar_pad_char */
- 15, /* ar_max_namelen */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-
- {_bfd_dummy_target, vms_object_p, /* bfd_check_format */
- vms_archive_p, _bfd_dummy_target},
- {bfd_false, vms_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, vms_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (vms),
- BFD_JUMP_TABLE_COPY (vms),
- BFD_JUMP_TABLE_CORE (vms),
- BFD_JUMP_TABLE_ARCHIVE (vms),
- BFD_JUMP_TABLE_SYMBOLS (vms),
- BFD_JUMP_TABLE_RELOCS (vms),
- BFD_JUMP_TABLE_WRITE (vms),
- BFD_JUMP_TABLE_LINK (vms),
- BFD_JUMP_TABLE_DYNAMIC (vms),
-
- NULL,
-
- (PTR) 0
-};
+static unsigned int priv_section_count;
+extern const bfd_target vms_vax_vec;
+extern const bfd_target vms_alpha_vec;
-/*===========================================================================*/
-
-/* Initialize private data */
+/* Initialize private data. */
static bfd_boolean
-vms_initialize (abfd)
- bfd *abfd;
+vms_initialize (bfd * abfd)
{
int i;
bfd_size_type amt;
@@ -280,16 +50,16 @@ vms_initialize (abfd)
bfd_set_start_address (abfd, (bfd_vma) -1);
amt = sizeof (struct vms_private_data_struct);
- abfd->tdata.any = (struct vms_private_data_struct*) bfd_alloc (abfd, amt);
- if (abfd->tdata.any == 0)
+ abfd->tdata.any = bfd_alloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
return FALSE;
#ifdef __ALPHA
- PRIV (is_vax) = 0;
+ PRIV (is_vax) = FALSE;
#else
- PRIV (is_vax) = 1;
+ PRIV (is_vax) = TRUE;
#endif
- PRIV (vms_buf) = 0;
+ PRIV (vms_buf) = NULL;
PRIV (buf_size) = 0;
PRIV (rec_length) = 0;
PRIV (file_format) = FF_UNKNOWN;
@@ -297,30 +67,30 @@ vms_initialize (abfd)
PRIV (sections) = NULL;
amt = sizeof (struct stack_struct) * STACKSIZE;
- PRIV (stack) = (struct stack_struct *) bfd_alloc (abfd, amt);
- if (PRIV (stack) == 0)
+ PRIV (stack) = bfd_alloc (abfd, amt);
+ if (PRIV (stack) == NULL)
goto error_ret1;
PRIV (stackptr) = 0;
amt = sizeof (struct bfd_hash_table);
- PRIV (vms_symbol_table) = (struct bfd_hash_table *) bfd_alloc (abfd, amt);
- if (PRIV (vms_symbol_table) == 0)
+ PRIV (vms_symbol_table) = bfd_alloc (abfd, amt);
+ if (PRIV (vms_symbol_table) == NULL)
goto error_ret1;
if (!bfd_hash_table_init (PRIV (vms_symbol_table), _bfd_vms_hash_newfunc))
goto error_ret1;
amt = sizeof (struct location_struct) * LOCATION_SAVE_SIZE;
- PRIV (location_stack) = (struct location_struct *) bfd_alloc (abfd, amt);
- if (PRIV (location_stack) == 0)
+ PRIV (location_stack) = bfd_alloc (abfd, amt);
+ if (PRIV (location_stack) == NULL)
goto error_ret2;
for (i = 0; i < VMS_SECTION_COUNT; i++)
PRIV (vms_section_table)[i] = NULL;
amt = MAX_OUTREC_SIZE;
- PRIV (output_buf) = (unsigned char *) bfd_alloc (abfd, amt);
- if (PRIV (output_buf) == 0)
+ PRIV (output_buf) = bfd_alloc (abfd, amt);
+ if (PRIV (output_buf) == NULL)
goto error_ret2;
PRIV (push_level) = 0;
@@ -335,7 +105,7 @@ vms_initialize (abfd)
bfd_hash_table_free (PRIV (vms_symbol_table));
error_ret1:
bfd_release (abfd, abfd->tdata.any);
- abfd->tdata.any = 0;
+ abfd->tdata.any = NULL;
return FALSE;
}
@@ -346,30 +116,25 @@ vms_initialize (abfd)
It has the correct value for referenced (undefined section) symbols
- called from bfd_hash_traverse in vms_fixup_sections */
+ called from bfd_hash_traverse in vms_fixup_sections. */
static bfd_boolean
-fill_section_ptr (entry, sections)
- struct bfd_hash_entry *entry;
- PTR sections;
+fill_section_ptr (struct bfd_hash_entry * entry, void * sections)
{
asection *sec;
asymbol *sym;
- sym = ((vms_symbol_entry *)entry)->symbol;
+ sym = ((vms_symbol_entry *) entry)->symbol;
sec = sym->section;
#if VMS_DEBUG
vms_debug (6, "fill_section_ptr: sym %p, sec %p\n", sym, sec);
#endif
- /* fill forward references (these contain section number, not section ptr). */
-
+ /* Fill forward references (these contain section number, not section ptr). */
if ((unsigned int) (size_t) sec < priv_section_count)
- {
- sec = ((vms_symbol_entry *) entry)->symbol->section =
- ((asection **) sections)[(unsigned int) (size_t) sec];
- }
+ sec = ((vms_symbol_entry *) entry)->symbol->section =
+ ((asection **) sections)[(unsigned int) (size_t) sec];
if (strcmp (sym->name, sec->name) == 0)
sym->flags |= BSF_SECTION_SYM;
@@ -384,47 +149,40 @@ fill_section_ptr (entry, sections)
are always referenced by an index number.
alloc PRIV(sections) according to abfd->section_count
- copy abfd->sections to PRIV(sections) */
+ copy abfd->sections to PRIV(sections). */
static bfd_boolean
-vms_fixup_sections (abfd)
- bfd *abfd;
+vms_fixup_sections (bfd * abfd)
{
if (PRIV (fixup_done))
return TRUE;
- /*
- * traverse symbol table and fill in all section pointers
- */
+ /* Traverse symbol table and fill in all section pointers. */
- /* can't provide section count as argument to fill_section_ptr(). */
+ /* Can't provide section count as argument to fill_section_ptr(). */
priv_section_count = PRIV (section_count);
- bfd_hash_traverse (PRIV (vms_symbol_table), fill_section_ptr,
- (PTR) (PRIV (sections)));
+ bfd_hash_traverse (PRIV (vms_symbol_table), fill_section_ptr, (PRIV (sections)));
PRIV (fixup_done) = TRUE;
return TRUE;
}
-
-/*===========================================================================*/
-
+
/* Check the format for a file being read.
Return a (bfd_target *) if it's an object file or zero if not. */
static const struct bfd_target *
-vms_object_p (abfd)
- bfd *abfd;
+vms_object_p (bfd * abfd)
{
int err = 0;
int prev_type;
- const struct bfd_target *target_vector = 0;
- const bfd_arch_info_type *arch = 0;
- PTR tdata_save = abfd->tdata.any;
+ const struct bfd_target *target_vector = NULL;
+ const bfd_arch_info_type *arch = NULL;
+ void * tdata_save = abfd->tdata.any;
bfd_vma saddr_save = bfd_get_start_address (abfd);
#if VMS_DEBUG
- vms_debug (1, "vms_object_p(%p)\n", abfd);
+ vms_debug (1, "vms_object_p (%p)\n", abfd);
#endif
if (!vms_initialize (abfd))
@@ -438,7 +196,7 @@ vms_object_p (abfd)
do
{
#if VMS_DEBUG
- vms_debug (7, "reading at %08lx\n", bfd_tell(abfd));
+ vms_debug (7, "reading at %08lx\n", bfd_tell (abfd));
#endif
if (_bfd_vms_next_record (abfd) < 0)
{
@@ -462,12 +220,12 @@ vms_object_p (abfd)
prev_type = PRIV (rec_type);
- if (target_vector == 0)
+ if (target_vector == NULL)
{
if (prev_type <= OBJ_S_C_MAXRECTYP)
- target_vector = &vms_vax_vec;
+ target_vector = & vms_vax_vec;
else
- target_vector = &vms_alpha_vec;
+ target_vector = & vms_alpha_vec;
}
switch (prev_type)
@@ -513,7 +271,7 @@ vms_object_p (abfd)
}
while ((prev_type != EOBJ_S_C_EEOM) && (prev_type != OBJ_S_C_EOM) && (prev_type != OBJ_S_C_EOMW));
- if (target_vector == &vms_vax_vec)
+ if (target_vector == & vms_vax_vec)
{
if (! vms_fixup_sections (abfd))
{
@@ -523,26 +281,26 @@ vms_object_p (abfd)
goto err_wrong_format;
}
- /* set arch_info to vax */
+ /* Set arch_info to vax. */
arch = bfd_scan_arch ("vax");
- PRIV (is_vax) = 1;
+ PRIV (is_vax) = TRUE;
#if VMS_DEBUG
vms_debug (2, "arch is vax\n");
#endif
}
- else if (target_vector == &vms_alpha_vec)
+ else if (target_vector == & vms_alpha_vec)
{
- /* set arch_info to alpha */
+ /* Set arch_info to alpha. */
arch = bfd_scan_arch ("alpha");
- PRIV (is_vax) = 0;
+ PRIV (is_vax) = FALSE;
#if VMS_DEBUG
vms_debug (2, "arch is alpha\n");
#endif
}
- if (arch == 0)
+ if (arch == NULL)
{
#if VMS_DEBUG
vms_debug (2, "arch not found\n");
@@ -567,28 +325,26 @@ vms_object_p (abfd)
Return a (bfd_target *) if it's an archive file or zero. */
static const struct bfd_target *
-vms_archive_p (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
+vms_archive_p (bfd * abfd ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_archive_p(%p)\n", abfd);
+ vms_debug (1, "vms_archive_p (%p)\n", abfd);
#endif
- return 0;
+ return NULL;
}
/* Set the format of a file being written. */
static bfd_boolean
-vms_mkobject (abfd)
- bfd *abfd;
+vms_mkobject (bfd * abfd)
{
#if VMS_DEBUG
- vms_debug (1, "vms_mkobject(%p)\n", abfd);
+ vms_debug (1, "vms_mkobject (%p)\n", abfd);
#endif
if (!vms_initialize (abfd))
- return 0;
+ return FALSE;
{
#ifdef __VAX
@@ -596,10 +352,10 @@ vms_mkobject (abfd)
#else
const bfd_arch_info_type *arch = bfd_scan_arch ("alpha");
#endif
- if (arch == 0)
+ if (arch == NULL)
{
- bfd_set_error(bfd_error_wrong_format);
- return 0;
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
}
abfd->arch_info = arch;
}
@@ -610,11 +366,10 @@ vms_mkobject (abfd)
/* Write cached information into a file being written, at bfd_close. */
static bfd_boolean
-vms_write_object_contents (abfd)
- bfd *abfd;
+vms_write_object_contents (bfd * abfd)
{
#if VMS_DEBUG
- vms_debug (1, "vms_write_object_contents(%p)\n", abfd);
+ vms_debug (1, "vms_write_object_contents (%p)\n", abfd);
#endif
if (abfd->section_count > 0) /* we have sections */
@@ -661,18 +416,17 @@ vms_write_object_contents (abfd)
return TRUE;
}
-/*-- 4.1, generic -----------------------------------------------------------*/
+/* 4.1, generic. */
/* Called when the BFD is being closed to do any necessary cleanup. */
static bfd_boolean
-vms_close_and_cleanup (abfd)
- bfd *abfd;
+vms_close_and_cleanup (bfd * abfd)
{
#if VMS_DEBUG
- vms_debug (1, "vms_close_and_cleanup(%p)\n", abfd);
+ vms_debug (1, "vms_close_and_cleanup (%p)\n", abfd);
#endif
- if (abfd == 0)
+ if (abfd == NULL)
return TRUE;
if (PRIV (vms_buf) != NULL)
@@ -691,12 +445,12 @@ vms_close_and_cleanup (abfd)
}
/* Ask the BFD to free all cached information. */
+
static bfd_boolean
-vms_bfd_free_cached_info (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
+vms_bfd_free_cached_info (bfd * abfd ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_free_cached_info(%p)\n", abfd);
+ vms_debug (1, "vms_bfd_free_cached_info (%p)\n", abfd);
#endif
return TRUE;
}
@@ -704,9 +458,7 @@ vms_bfd_free_cached_info (abfd)
/* Called when a new section is created. */
static bfd_boolean
-vms_new_section_hook (abfd, section)
- bfd *abfd;
- asection *section;
+vms_new_section_hook (bfd * abfd, asection *section)
{
/* Count hasn't been incremented yet. */
unsigned int section_count = abfd->section_count + 1;
@@ -721,8 +473,8 @@ vms_new_section_hook (abfd, section)
{
bfd_size_type amt = section_count;
amt *= sizeof (asection *);
- PRIV (sections) = (asection **) bfd_realloc (PRIV (sections), amt);
- if (PRIV (sections) == 0)
+ PRIV (sections) = bfd_realloc (PRIV (sections), amt);
+ if (PRIV (sections) == NULL)
return FALSE;
PRIV (section_count) = section_count;
}
@@ -742,57 +494,52 @@ vms_new_section_hook (abfd, section)
section data (starting at offset into section) */
static bfd_boolean
-vms_get_section_contents (abfd, section, buf, offset, buf_size)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section ATTRIBUTE_UNUSED;
- PTR buf ATTRIBUTE_UNUSED;
- file_ptr offset ATTRIBUTE_UNUSED;
- bfd_size_type buf_size ATTRIBUTE_UNUSED;
+vms_get_section_contents (bfd * abfd ATTRIBUTE_UNUSED,
+ asection *section ATTRIBUTE_UNUSED,
+ void * buf ATTRIBUTE_UNUSED,
+ file_ptr offset ATTRIBUTE_UNUSED,
+ bfd_size_type buf_size ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_get_section_contents(%p, %s, %p, off %ld, size %d)\n",
+ vms_debug (1, "vms_get_section_contents (%p, %s, %p, off %ld, size %d)\n",
abfd, section->name, buf, offset, (int)buf_size);
#endif
- /* shouldn't be called, since all sections are IN_MEMORY */
-
+ /* Shouldn't be called, since all sections are IN_MEMORY. */
return FALSE;
}
/* Read the contents of a section.
buf points to a buffer of buf_size bytes to be filled with
- section data (starting at offset into section) */
+ section data (starting at offset into section). */
static bfd_boolean
-vms_get_section_contents_in_window (abfd, section, w, offset, count)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section ATTRIBUTE_UNUSED;
- bfd_window *w ATTRIBUTE_UNUSED;
- file_ptr offset ATTRIBUTE_UNUSED;
- bfd_size_type count ATTRIBUTE_UNUSED;
+vms_get_section_contents_in_window (bfd * abfd ATTRIBUTE_UNUSED,
+ asection *section ATTRIBUTE_UNUSED,
+ bfd_window *w ATTRIBUTE_UNUSED,
+ file_ptr offset ATTRIBUTE_UNUSED,
+ bfd_size_type count ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_get_section_contents_in_window(%p, %s, %p, off %ld, count %d)\n",
+ vms_debug (1, "vms_get_section_contents_in_window (%p, %s, %p, off %ld, count %d)\n",
abfd, section->name, w, offset, (int)count);
#endif
- /* shouldn't be called, since all sections are IN_MEMORY */
-
+ /* Shouldn't be called, since all sections are IN_MEMORY. */
return FALSE;
}
-/*-- Part 4.2, copy private data --------------------------------------------*/
+/* Part 4.2, copy private data. */
/* Called to copy BFD general private data from one object file
to another. */
static bfd_boolean
-vms_bfd_copy_private_bfd_data (src, dest)
- bfd *src ATTRIBUTE_UNUSED;
- bfd *dest ATTRIBUTE_UNUSED;
+vms_bfd_copy_private_bfd_data (bfd *src ATTRIBUTE_UNUSED,
+ bfd *dest ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_copy_private_bfd_data(%p, %p)\n", src, dest);
+ vms_debug (1, "vms_bfd_copy_private_bfd_data (%p, %p)\n", src, dest);
#endif
return TRUE;
}
@@ -805,12 +552,11 @@ vms_bfd_copy_private_bfd_data (src, dest)
Not enough memory exists to create private data for @var{obfd}. */
static bfd_boolean
-vms_bfd_merge_private_bfd_data (ibfd, obfd)
- bfd *ibfd ATTRIBUTE_UNUSED;
- bfd *obfd ATTRIBUTE_UNUSED;
+vms_bfd_merge_private_bfd_data (bfd * ibfd ATTRIBUTE_UNUSED,
+ bfd * obfd ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1,"vms_bfd_merge_private_bfd_data(%p, %p)\n", ibfd, obfd);
+ vms_debug (1,"vms_bfd_merge_private_bfd_data (%p, %p)\n", ibfd, obfd);
#endif
return TRUE;
}
@@ -823,12 +569,11 @@ vms_bfd_merge_private_bfd_data (ibfd, obfd)
Not enough memory exists to create private data for @var{obfd}. */
static bfd_boolean
-vms_bfd_set_private_flags (abfd, flags)
- bfd *abfd ATTRIBUTE_UNUSED;
- flagword flags ATTRIBUTE_UNUSED;
+vms_bfd_set_private_flags (bfd * abfd ATTRIBUTE_UNUSED,
+ flagword flags ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1,"vms_bfd_set_private_flags(%p, %lx)\n", abfd, (long)flags);
+ vms_debug (1,"vms_bfd_set_private_flags (%p, %lx)\n", abfd, (long)flags);
#endif
return TRUE;
}
@@ -837,14 +582,13 @@ vms_bfd_set_private_flags (abfd, flags)
to another. */
static bfd_boolean
-vms_bfd_copy_private_section_data (srcbfd, srcsec, dstbfd, dstsec)
- bfd *srcbfd ATTRIBUTE_UNUSED;
- asection *srcsec ATTRIBUTE_UNUSED;
- bfd *dstbfd ATTRIBUTE_UNUSED;
- asection *dstsec ATTRIBUTE_UNUSED;
+vms_bfd_copy_private_section_data (bfd *srcbfd ATTRIBUTE_UNUSED,
+ asection *srcsec ATTRIBUTE_UNUSED,
+ bfd *dstbfd ATTRIBUTE_UNUSED,
+ asection *dstsec ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_copy_private_section_data(%p, %s, %p, %s)\n",
+ vms_debug (1, "vms_bfd_copy_private_section_data (%p, %s, %p, %s)\n",
srcbfd, srcsec->name, dstbfd, dstsec->name);
#endif
return TRUE;
@@ -854,43 +598,40 @@ vms_bfd_copy_private_section_data (srcbfd, srcsec, dstbfd, dstsec)
to another. */
static bfd_boolean
-vms_bfd_copy_private_symbol_data (ibfd, isym, obfd, osym)
- bfd *ibfd ATTRIBUTE_UNUSED;
- asymbol *isym ATTRIBUTE_UNUSED;
- bfd *obfd ATTRIBUTE_UNUSED;
- asymbol *osym ATTRIBUTE_UNUSED;
+vms_bfd_copy_private_symbol_data (bfd *ibfd ATTRIBUTE_UNUSED,
+ asymbol *isym ATTRIBUTE_UNUSED,
+ bfd *obfd ATTRIBUTE_UNUSED,
+ asymbol *osym ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_copy_private_symbol_data(%p, %s, %p, %s)\n",
+ vms_debug (1, "vms_bfd_copy_private_symbol_data (%p, %s, %p, %s)\n",
ibfd, isym->name, obfd, osym->name);
#endif
return TRUE;
}
-/*-- Part 4.3, core file ----------------------------------------------------*/
+/* Part 4.3, core file. */
/* Return a read-only string explaining which program was running
when it failed and produced the core file abfd. */
static char *
-vms_core_file_failing_command (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
+vms_core_file_failing_command (bfd * abfd ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_core_file_failing_command(%p)\n", abfd);
+ vms_debug (1, "vms_core_file_failing_command (%p)\n", abfd);
#endif
- return 0;
+ return NULL;
}
/* Returns the signal number which caused the core dump which
generated the file the BFD abfd is attached to. */
static int
-vms_core_file_failing_signal (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
+vms_core_file_failing_signal (bfd * abfd ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_core_file_failing_signal(%p)\n", abfd);
+ vms_debug (1, "vms_core_file_failing_signal (%p)\n", abfd);
#endif
return 0;
}
@@ -899,27 +640,25 @@ vms_core_file_failing_signal (abfd)
by a run of the executable file attached to exec_bfd, FALSE otherwise. */
static bfd_boolean
-vms_core_file_matches_executable_p (abfd, bbfd)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd *bbfd ATTRIBUTE_UNUSED;
+vms_core_file_matches_executable_p (bfd * abfd ATTRIBUTE_UNUSED,
+ bfd *bbfd ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_core_file_matches_executable_p(%p, %p)\n", abfd, bbfd);
+ vms_debug (1, "vms_core_file_matches_executable_p (%p, %p)\n", abfd, bbfd);
#endif
return FALSE;
}
-/*-- Part 4.4, archive ------------------------------------------------------*/
+/* Part 4.4, archive. */
/* ??? do something with an archive map.
Return FALSE on error, TRUE otherwise. */
static bfd_boolean
-vms_slurp_armap (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
+vms_slurp_armap (bfd * abfd ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_slurp_armap(%p)\n", abfd);
+ vms_debug (1, "vms_slurp_armap (%p)\n", abfd);
#endif
return FALSE;
}
@@ -928,11 +667,10 @@ vms_slurp_armap (abfd)
Return FALSE on error, TRUE otherwise. */
static bfd_boolean
-vms_slurp_extended_name_table (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
+vms_slurp_extended_name_table (bfd * abfd ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_slurp_extended_name_table(%p)\n", abfd);
+ vms_debug (1, "vms_slurp_extended_name_table (%p)\n", abfd);
#endif
return FALSE;
}
@@ -941,44 +679,41 @@ vms_slurp_extended_name_table (abfd)
Return FALSE on error, TRUE otherwise. */
static bfd_boolean
-vms_construct_extended_name_table (abfd, tabloc, tablen, name)
- bfd *abfd ATTRIBUTE_UNUSED;
- char **tabloc ATTRIBUTE_UNUSED;
- bfd_size_type *tablen ATTRIBUTE_UNUSED;
- const char **name ATTRIBUTE_UNUSED;
+vms_construct_extended_name_table (bfd * abfd ATTRIBUTE_UNUSED,
+ char **tabloc ATTRIBUTE_UNUSED,
+ bfd_size_type *tablen ATTRIBUTE_UNUSED,
+ const char **name ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_construct_extended_name_table(%p)\n", abfd);
+ vms_debug (1, "vms_construct_extended_name_table (%p)\n", abfd);
#endif
return FALSE;
}
-/* Truncate the name of an archive to match system-dependent restrictions */
+/* Truncate the name of an archive to match system-dependent restrictions. */
static void
-vms_truncate_arname (abfd, pathname, arhdr)
- bfd *abfd ATTRIBUTE_UNUSED;
- const char *pathname ATTRIBUTE_UNUSED;
- char *arhdr ATTRIBUTE_UNUSED;
+vms_truncate_arname (bfd * abfd ATTRIBUTE_UNUSED,
+ const char *pathname ATTRIBUTE_UNUSED,
+ char *arhdr ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_truncate_arname(%p, %s, %s)\n", abfd, pathname, arhdr);
+ vms_debug (1, "vms_truncate_arname (%p, %s, %s)\n", abfd, pathname, arhdr);
#endif
return;
}
-/* ??? write archive map */
+/* ??? write archive map. */
static bfd_boolean
-vms_write_armap (arch, elength, map, orl_count, stridx)
- bfd *arch ATTRIBUTE_UNUSED;
- unsigned int elength ATTRIBUTE_UNUSED;
- struct orl *map ATTRIBUTE_UNUSED;
- unsigned int orl_count ATTRIBUTE_UNUSED;
- int stridx ATTRIBUTE_UNUSED;
+vms_write_armap (bfd *arch ATTRIBUTE_UNUSED,
+ unsigned int elength ATTRIBUTE_UNUSED,
+ struct orl *map ATTRIBUTE_UNUSED,
+ unsigned int orl_count ATTRIBUTE_UNUSED,
+ int stridx ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_write_armap(%p, %d, %p, %d %d)\n",
+ vms_debug (1, "vms_write_armap (%p, %d, %p, %d %d)\n",
arch, elength, map, orl_count, stridx);
#endif
return TRUE;
@@ -986,14 +721,13 @@ vms_write_armap (arch, elength, map, orl_count, stridx)
/* Read archive header ??? */
-static PTR
-vms_read_ar_hdr (abfd)
- bfd * abfd ATTRIBUTE_UNUSED;
+static void *
+vms_read_ar_hdr (bfd * abfd ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_read_ar_hdr(%p)\n", abfd);
+ vms_debug (1, "vms_read_ar_hdr (%p)\n", abfd);
#endif
- return (PTR)0;
+ return NULL;
}
/* Provided a BFD, @var{archive}, containing an archive and NULL, open
@@ -1003,12 +737,11 @@ vms_read_ar_hdr (abfd)
NULL is returned when there are no more. */
static bfd *
-vms_openr_next_archived_file (arch, prev)
- bfd *arch ATTRIBUTE_UNUSED;
- bfd *prev ATTRIBUTE_UNUSED;
+vms_openr_next_archived_file (bfd *arch ATTRIBUTE_UNUSED,
+ bfd *prev ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_openr_next_archived_file(%p, %p)\n", arch, prev);
+ vms_debug (1, "vms_openr_next_archived_file (%p, %p)\n", arch, prev);
#endif
return NULL;
}
@@ -1017,43 +750,38 @@ vms_openr_next_archived_file (arch, prev)
INDEX. INDEX should have been returned by bfd_get_next_mapent. */
static bfd *
-vms_get_elt_at_index (abfd, index)
- bfd *abfd;
- symindex index;
+vms_get_elt_at_index (bfd * abfd, symindex index)
{
#if VMS_DEBUG
- vms_debug (1, "vms_get_elt_at_index(%p, %p)\n", abfd, index);
+ vms_debug (1, "vms_get_elt_at_index (%p, %p)\n", abfd, index);
#endif
- return _bfd_generic_get_elt_at_index(abfd, index);
+ return _bfd_generic_get_elt_at_index (abfd, index);
}
/* ???
- -> bfd_generic_stat_arch_elt */
+ -> bfd_generic_stat_arch_elt. */
static int
-vms_generic_stat_arch_elt (abfd, st)
- bfd *abfd;
- struct stat *st;
+vms_generic_stat_arch_elt (bfd * abfd, struct stat *st)
{
#if VMS_DEBUG
- vms_debug (1, "vms_generic_stat_arch_elt(%p, %p)\n", abfd, st);
+ vms_debug (1, "vms_generic_stat_arch_elt (%p, %p)\n", abfd, st);
#endif
return bfd_generic_stat_arch_elt (abfd, st);
}
-/* This is a new function in bfd 2.5 */
+/* This is a new function in bfd 2.5. */
static bfd_boolean
-vms_update_armap_timestamp (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
+vms_update_armap_timestamp (bfd * abfd ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_update_armap_timestamp(%p)\n", abfd);
+ vms_debug (1, "vms_update_armap_timestamp (%p)\n", abfd);
#endif
return TRUE;
}
-/*-- Part 4.5, symbols --------------------------------------------------------*/
+/* Part 4.5, symbols. */
/* Return the number of bytes required to store a vector of pointers
to asymbols for all the symbols in the BFD abfd, including a
@@ -1061,30 +789,27 @@ vms_update_armap_timestamp (abfd)
then return 0. If an error occurs, return -1. */
static long
-vms_get_symtab_upper_bound (abfd)
- bfd *abfd;
+vms_get_symtab_upper_bound (bfd * abfd)
{
#if VMS_DEBUG
- vms_debug (1, "vms_get_symtab_upper_bound(%p), %d symbols\n", abfd, PRIV (gsd_sym_count));
+ vms_debug (1, "vms_get_symtab_upper_bound (%p), %d symbols\n", abfd, PRIV (gsd_sym_count));
#endif
- return (PRIV (gsd_sym_count)+1) * sizeof (asymbol *);
+ return (PRIV (gsd_sym_count) + 1) * sizeof (asymbol *);
}
/* Copy symbols from hash table to symbol vector
called from bfd_hash_traverse in vms_canonicalize_symtab
- init counter to 0 if entry == 0 */
+ init counter to 0 if entry == 0. */
static bfd_boolean
-copy_symbols (entry, arg)
- struct bfd_hash_entry *entry;
- PTR arg;
+copy_symbols (struct bfd_hash_entry *entry, void * arg)
{
- bfd *abfd = (bfd *) arg;
+ bfd * abfd = (bfd *) arg;
- if (entry == NULL) /* init counter */
+ if (entry == NULL) /* Init counter. */
PRIV (symnum) = 0;
- else /* fill vector, inc counter */
+ else /* Fill vector, inc counter. */
PRIV (symcache)[PRIV (symnum)++] = ((vms_symbol_entry *)entry)->symbol;
return TRUE;
@@ -1093,24 +818,21 @@ copy_symbols (entry, arg)
/* Read the symbols from the BFD abfd, and fills in the vector
location with pointers to the symbols and a trailing NULL.
- return # of symbols read */
+ Return number of symbols read. */
static long
-vms_canonicalize_symtab (abfd, symbols)
- bfd *abfd;
- asymbol **symbols;
+vms_canonicalize_symtab (bfd * abfd, asymbol **symbols)
{
#if VMS_DEBUG
- vms_debug (1, "vms_canonicalize_symtab(%p, <ret>)\n", abfd);
+ vms_debug (1, "vms_canonicalize_symtab (%p, <ret>)\n", abfd);
#endif
- /* init counter */
- (void)copy_symbols((struct bfd_hash_entry *)0, abfd);
-
- /* traverse table and fill symbols vector */
+ /* Init counter. */
+ copy_symbols (NULL, abfd);
+ /* Traverse table and fill symbols vector. */
PRIV (symcache) = symbols;
- bfd_hash_traverse(PRIV (vms_symbol_table), copy_symbols, (PTR)abfd);
+ bfd_hash_traverse (PRIV (vms_symbol_table), copy_symbols, abfd);
symbols[PRIV (gsd_sym_count)] = NULL;
@@ -1120,17 +842,16 @@ vms_canonicalize_symtab (abfd, symbols)
/* Print symbol to file according to how. how is one of
bfd_print_symbol_name just print the name
bfd_print_symbol_more print more (???)
- bfd_print_symbol_all print all we know, which is not much right now :-) */
+ bfd_print_symbol_all print all we know, which is not much right now :-). */
static void
-vms_print_symbol (abfd, file, symbol, how)
- bfd *abfd;
- PTR file;
- asymbol *symbol;
- bfd_print_symbol_type how;
+vms_print_symbol (bfd * abfd,
+ void * file,
+ asymbol *symbol,
+ bfd_print_symbol_type how)
{
#if VMS_DEBUG
- vms_debug (1, "vms_print_symbol(%p, %p, %p, %d)\n", abfd, file, symbol, how);
+ vms_debug (1, "vms_print_symbol (%p, %p, %p, %d)\n", abfd, file, symbol, how);
#endif
switch (how)
@@ -1144,13 +865,12 @@ vms_print_symbol (abfd, file, symbol, how)
{
const char *section_name = symbol->section->name;
- bfd_print_symbol_vandf (abfd, (PTR)file, symbol);
+ bfd_print_symbol_vandf (abfd, file, symbol);
- fprintf ((FILE *)file," %-8s %s", section_name, symbol->name);
+ fprintf ((FILE *) file," %-8s %s", section_name, symbol->name);
}
break;
}
- return;
}
/* Return information about symbol in ret.
@@ -1165,23 +885,22 @@ vms_print_symbol (abfd, file, symbol, how)
t a static function symbol
T text segment symbol
U undefined
- - debug */
+ - debug. */
static void
-vms_get_symbol_info (abfd, symbol, ret)
- bfd *abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
- symbol_info *ret;
+vms_get_symbol_info (bfd * abfd ATTRIBUTE_UNUSED,
+ asymbol *symbol,
+ symbol_info *ret)
{
asection *sec;
#if VMS_DEBUG
- vms_debug (1, "vms_get_symbol_info(%p, %p, %p)\n", abfd, symbol, ret);
+ vms_debug (1, "vms_get_symbol_info (%p, %p, %p)\n", abfd, symbol, ret);
#endif
sec = symbol->section;
- if (ret == 0)
+ if (ret == NULL)
return;
if (bfd_is_com_section (sec))
@@ -1206,35 +925,31 @@ vms_get_symbol_info (abfd, symbol, ret)
else
ret->value = 0;
ret->name = symbol->name;
-
- return;
}
/* Return TRUE if the given symbol sym in the BFD abfd is
a compiler generated local label, else return FALSE. */
static bfd_boolean
-vms_bfd_is_local_label_name (abfd, name)
- bfd *abfd ATTRIBUTE_UNUSED;
- const char *name;
+vms_bfd_is_local_label_name (bfd * abfd ATTRIBUTE_UNUSED,
+ const char *name)
{
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_is_local_label_name(%p, %s)\n", abfd, name);
+ vms_debug (1, "vms_bfd_is_local_label_name (%p, %s)\n", abfd, name);
#endif
return name[0] == '$';
}
-/* Get source line number for symbol */
+/* Get source line number for symbol. */
static alent *
-vms_get_lineno (abfd, symbol)
- bfd *abfd ATTRIBUTE_UNUSED;
- asymbol *symbol ATTRIBUTE_UNUSED;
+vms_get_lineno (bfd * abfd ATTRIBUTE_UNUSED,
+ asymbol *symbol ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_get_lineno(%p, %p)\n", abfd, symbol);
+ vms_debug (1, "vms_get_lineno (%p, %p)\n", abfd, symbol);
#endif
- return 0;
+ return NULL;
}
/* Provided a BFD, a section and an offset into the section, calculate and
@@ -1242,17 +957,16 @@ vms_get_lineno (abfd, symbol)
location. */
static bfd_boolean
-vms_find_nearest_line (abfd, section, symbols, offset, file, func, line)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section ATTRIBUTE_UNUSED;
- asymbol **symbols ATTRIBUTE_UNUSED;
- bfd_vma offset ATTRIBUTE_UNUSED;
- const char **file ATTRIBUTE_UNUSED;
- const char **func ATTRIBUTE_UNUSED;
- unsigned int *line ATTRIBUTE_UNUSED;
+vms_find_nearest_line (bfd * abfd ATTRIBUTE_UNUSED,
+ asection *section ATTRIBUTE_UNUSED,
+ asymbol **symbols ATTRIBUTE_UNUSED,
+ bfd_vma offset ATTRIBUTE_UNUSED,
+ const char **file ATTRIBUTE_UNUSED,
+ const char **func ATTRIBUTE_UNUSED,
+ unsigned int *line ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_find_nearest_line(%p, %s, %p, %ld, <ret>, <ret>, <ret>)\n",
+ vms_debug (1, "vms_find_nearest_line (%p, %s, %p, %ld, <ret>, <ret>, <ret>)\n",
abfd, section->name, symbols, (long int)offset);
#endif
return FALSE;
@@ -1263,15 +977,14 @@ vms_find_nearest_line (abfd, section, symbols, offset, file, func, line)
when creating COFF files. */
static asymbol *
-vms_bfd_make_debug_symbol (abfd, ptr, size)
- bfd *abfd ATTRIBUTE_UNUSED;
- void *ptr ATTRIBUTE_UNUSED;
- unsigned long size ATTRIBUTE_UNUSED;
+vms_bfd_make_debug_symbol (bfd * abfd ATTRIBUTE_UNUSED,
+ void *ptr ATTRIBUTE_UNUSED,
+ unsigned long size ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_make_debug_symbol(%p, %p, %ld)\n", abfd, ptr, size);
+ vms_debug (1, "vms_bfd_make_debug_symbol (%p, %p, %ld)\n", abfd, ptr, size);
#endif
- return 0;
+ return NULL;
}
/* Read minisymbols. For minisymbols, we use the unmodified a.out
@@ -1279,14 +992,13 @@ vms_bfd_make_debug_symbol (abfd, ptr, size)
BFD asymbol structures. */
static long
-vms_read_minisymbols (abfd, dynamic, minisymsp, sizep)
- bfd *abfd;
- bfd_boolean dynamic;
- PTR *minisymsp;
- unsigned int *sizep;
+vms_read_minisymbols (bfd * abfd,
+ bfd_boolean dynamic,
+ void * *minisymsp,
+ unsigned int *sizep)
{
#if VMS_DEBUG
- vms_debug (1, "vms_read_minisymbols(%p, %d, %p, %d)\n", abfd, dynamic, minisymsp, *sizep);
+ vms_debug (1, "vms_read_minisymbols (%p, %d, %p, %d)\n", abfd, dynamic, minisymsp, *sizep);
#endif
return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep);
}
@@ -1296,31 +1008,29 @@ vms_read_minisymbols (abfd, dynamic, minisymsp, sizep)
by bfd_make_empty_symbol, which we fill in here. */
static asymbol *
-vms_minisymbol_to_symbol (abfd, dynamic, minisym, sym)
- bfd *abfd;
- bfd_boolean dynamic;
- const PTR minisym;
- asymbol *sym;
+vms_minisymbol_to_symbol (bfd * abfd,
+ bfd_boolean dynamic,
+ const void * minisym,
+ asymbol *sym)
{
#if VMS_DEBUG
- vms_debug (1, "vms_minisymbol_to_symbol(%p, %d, %p, %p)\n", abfd, dynamic, minisym, sym);
+ vms_debug (1, "vms_minisymbol_to_symbol (%p, %d, %p, %p)\n", abfd, dynamic, minisym, sym);
#endif
return _bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym);
}
-/*-- Part 4.6, relocations --------------------------------------------------*/
+/* Part 4.6, relocations. */
/* Return the number of bytes required to store the relocation information
associated with section sect attached to bfd abfd.
If an error occurs, return -1. */
static long
-vms_get_reloc_upper_bound (abfd, section)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section ATTRIBUTE_UNUSED;
+vms_get_reloc_upper_bound (bfd * abfd ATTRIBUTE_UNUSED,
+ asection *section ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_get_reloc_upper_bound(%p, %s)\n", abfd, section->name);
+ vms_debug (1, "vms_get_reloc_upper_bound (%p, %s)\n", abfd, section->name);
#endif
return -1L;
}
@@ -1332,35 +1042,32 @@ vms_get_reloc_upper_bound (abfd, section)
Returns the number of relocs, or -1 on error. */
static long
-vms_canonicalize_reloc (abfd, section, location, symbols)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section ATTRIBUTE_UNUSED;
- arelent **location ATTRIBUTE_UNUSED;
- asymbol **symbols ATTRIBUTE_UNUSED;
+vms_canonicalize_reloc (bfd * abfd ATTRIBUTE_UNUSED,
+ asection *section ATTRIBUTE_UNUSED,
+ arelent **location ATTRIBUTE_UNUSED,
+ asymbol **symbols ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_canonicalize_reloc(%p, %s, <ret>, <ret>)\n", abfd, section->name);
+ vms_debug (1, "vms_canonicalize_reloc (%p, %s, <ret>, <ret>)\n", abfd, section->name);
#endif
return FALSE;
}
-
-/*---------------------------------------------------------------------------*/
-/* this is just copied from ecoff-alpha, needs to be fixed probably */
+
+/* This is just copied from ecoff-alpha, needs to be fixed probably. */
/* How to process the various reloc types. */
static bfd_reloc_status_type
-reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc ATTRIBUTE_UNUSED;
- asymbol *sym ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *sec ATTRIBUTE_UNUSED;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- char **error_message ATTRIBUTE_UNUSED;
+reloc_nil (bfd * abfd ATTRIBUTE_UNUSED,
+ arelent *reloc ATTRIBUTE_UNUSED,
+ asymbol *sym ATTRIBUTE_UNUSED,
+ void * data ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED,
+ bfd *output_bfd ATTRIBUTE_UNUSED,
+ char **error_message ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "reloc_nil(abfd %p, output_bfd %p)\n", abfd, output_bfd);
+ vms_debug (1, "reloc_nil (abfd %p, output_bfd %p)\n", abfd, output_bfd);
vms_debug (2, "In section %s, symbol %s\n",
sec->name, sym->name);
vms_debug (2, "reloc sym %s, addr %08lx, addend %08lx, reloc is a %s\n",
@@ -1368,7 +1075,7 @@ reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message)
(unsigned long)reloc->address,
(unsigned long)reloc->addend, reloc->howto->name);
vms_debug (2, "data at %p\n", data);
-/* _bfd_hexdump (2, data, bfd_get_reloc_size(reloc->howto),0); */
+ /* _bfd_hexdump (2, data, bfd_get_reloc_size (reloc->howto), 0); */
#endif
return bfd_reloc_ok;
@@ -1380,219 +1087,219 @@ reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message)
static reloc_howto_type alpha_howto_table[] =
{
- HOWTO (ALPHA_R_IGNORE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- reloc_nil, /* special_function */
- "IGNORE", /* name */
- TRUE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- TRUE), /* pcrel_offset */
+ HOWTO (ALPHA_R_IGNORE, /* Type. */
+ 0, /* Rightshift. */
+ 0, /* Size (0 = byte, 1 = short, 2 = long). */
+ 8, /* Bitsize. */
+ TRUE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont,/* Complain_on_overflow. */
+ reloc_nil, /* Special_function. */
+ "IGNORE", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0, /* Source mask */
+ 0, /* Dest mask. */
+ TRUE), /* PC rel offset. */
/* A 64 bit reference to a symbol. */
- HOWTO (ALPHA_R_REFQUAD, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- reloc_nil, /* special_function */
- "REFQUAD", /* name */
- TRUE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_REFQUAD, /* Type. */
+ 0, /* Rightshift. */
+ 4, /* Size (0 = byte, 1 = short, 2 = long). */
+ 64, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ reloc_nil, /* Special_function. */
+ "REFQUAD", /* Name. */
+ TRUE, /* Partial_inplace. */
+ MINUS_ONE, /* Source mask. */
+ MINUS_ONE, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* A 21 bit branch. The native assembler generates these for
branches within the text segment, and also fills in the PC
relative offset in the instruction. */
- HOWTO (ALPHA_R_BRADDR, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 21, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- reloc_nil, /* special_function */
- "BRADDR", /* name */
- TRUE, /* partial_inplace */
- 0x1fffff, /* src_mask */
- 0x1fffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_BRADDR, /* Type. */
+ 2, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 21, /* Bitsize. */
+ TRUE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed, /* Complain_on_overflow. */
+ reloc_nil, /* Special_function. */
+ "BRADDR", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0x1fffff, /* Source mask. */
+ 0x1fffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* A hint for a jump to a register. */
- HOWTO (ALPHA_R_HINT, /* type */
- 2, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 14, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- reloc_nil, /* special_function */
- "HINT", /* name */
- TRUE, /* partial_inplace */
- 0x3fff, /* src_mask */
- 0x3fff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_HINT, /* Type. */
+ 2, /* Rightshift. */
+ 1, /* Size (0 = byte, 1 = short, 2 = long). */
+ 14, /* Bitsize. */
+ TRUE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont,/* Complain_on_overflow. */
+ reloc_nil, /* Special_function. */
+ "HINT", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0x3fff, /* Source mask. */
+ 0x3fff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* 16 bit PC relative offset. */
- HOWTO (ALPHA_R_SREL16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- reloc_nil, /* special_function */
- "SREL16", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_SREL16, /* Type. */
+ 0, /* Rightshift. */
+ 1, /* Size (0 = byte, 1 = short, 2 = long). */
+ 16, /* Bitsize. */
+ TRUE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed, /* Complain_on_overflow. */
+ reloc_nil, /* Special_function. */
+ "SREL16", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffff, /* Source mask. */
+ 0xffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* 32 bit PC relative offset. */
- HOWTO (ALPHA_R_SREL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- reloc_nil, /* special_function */
- "SREL32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_SREL32, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ TRUE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed, /* Complain_on_overflow. */
+ reloc_nil, /* Special_function. */
+ "SREL32", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Source mask. */
+ 0xffffffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* A 64 bit PC relative offset. */
- HOWTO (ALPHA_R_SREL64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- reloc_nil, /* special_function */
- "SREL64", /* name */
- TRUE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_SREL64, /* Type. */
+ 0, /* Rightshift. */
+ 4, /* Size (0 = byte, 1 = short, 2 = long). */
+ 64, /* Bitsize. */
+ TRUE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed, /* Complain_on_overflow. */
+ reloc_nil, /* Special_function. */
+ "SREL64", /* Name. */
+ TRUE, /* Partial_inplace. */
+ MINUS_ONE, /* Source mask. */
+ MINUS_ONE, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* Push a value on the reloc evaluation stack. */
- HOWTO (ALPHA_R_OP_PUSH, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- reloc_nil, /* special_function */
- "OP_PUSH", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_OP_PUSH, /* Type. */
+ 0, /* Rightshift. */
+ 0, /* Size (0 = byte, 1 = short, 2 = long). */
+ 0, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont,/* Complain_on_overflow. */
+ reloc_nil, /* Special_function. */
+ "OP_PUSH", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0, /* Source mask. */
+ 0, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* Store the value from the stack at the given address. Store it in
a bitfield of size r_size starting at bit position r_offset. */
- HOWTO (ALPHA_R_OP_STORE, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- reloc_nil, /* special_function */
- "OP_STORE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_OP_STORE, /* Type. */
+ 0, /* Rightshift. */
+ 4, /* Size (0 = byte, 1 = short, 2 = long). */
+ 64, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont,/* Complain_on_overflow. */
+ reloc_nil, /* Special_function. */
+ "OP_STORE", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0, /* Source mask. */
+ MINUS_ONE, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* Subtract the reloc address from the value on the top of the
relocation stack. */
- HOWTO (ALPHA_R_OP_PSUB, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- reloc_nil, /* special_function */
- "OP_PSUB", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_OP_PSUB, /* Type. */
+ 0, /* Rightshift. */
+ 0, /* Size (0 = byte, 1 = short, 2 = long). */
+ 0, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont,/* Complain_on_overflow. */
+ reloc_nil, /* Special_function. */
+ "OP_PSUB", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0, /* Source mask. */
+ 0, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* Shift the value on the top of the relocation stack right by the
given value. */
- HOWTO (ALPHA_R_OP_PRSHIFT, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- reloc_nil, /* special_function */
- "OP_PRSHIFT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_OP_PRSHIFT, /* Type. */
+ 0, /* Rightshift. */
+ 0, /* Size (0 = byte, 1 = short, 2 = long). */
+ 0, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont,/* Complain_on_overflow. */
+ reloc_nil, /* Special_function. */
+ "OP_PRSHIFT", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0, /* Source mask. */
+ 0, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* Hack. Linkage is done by linker. */
- HOWTO (ALPHA_R_LINKAGE, /* type */
- 0, /* rightshift */
- 8, /* size (0 = byte, 1 = short, 2 = long) */
- 256, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- reloc_nil, /* special_function */
- "LINKAGE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_LINKAGE, /* Type. */
+ 0, /* Rightshift. */
+ 8, /* Size (0 = byte, 1 = short, 2 = long). */
+ 256, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_dont,/* Complain_on_overflow. */
+ reloc_nil, /* Special_function. */
+ "LINKAGE", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0, /* Source mask. */
+ 0, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* A 32 bit reference to a symbol. */
- HOWTO (ALPHA_R_REFLONG, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- reloc_nil, /* special_function */
- "REFLONG", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_REFLONG, /* Type. */
+ 0, /* Rightshift. */
+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
+ 32, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_bitfield, /* Complain_on_overflow. */
+ reloc_nil, /* Special_function. */
+ "REFLONG", /* Name. */
+ TRUE, /* Partial_inplace. */
+ 0xffffffff, /* Source mask. */
+ 0xffffffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
/* A 64 bit reference to a procedure, written as 32 bit value. */
- HOWTO (ALPHA_R_CODEADDR, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed,/* complain_on_overflow */
- reloc_nil, /* special_function */
- "CODEADDR", /* name */
- FALSE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ HOWTO (ALPHA_R_CODEADDR, /* Type. */
+ 0, /* Rightshift. */
+ 4, /* Size (0 = byte, 1 = short, 2 = long). */
+ 64, /* Bitsize. */
+ FALSE, /* PC relative. */
+ 0, /* Bitpos. */
+ complain_overflow_signed,/* Complain_on_overflow. */
+ reloc_nil, /* Special_function. */
+ "CODEADDR", /* Name. */
+ FALSE, /* Partial_inplace. */
+ 0xffffffff, /* Source mask. */
+ 0xffffffff, /* Dest mask. */
+ FALSE), /* PC rel offset. */
};
@@ -1600,14 +1307,13 @@ static reloc_howto_type alpha_howto_table[] =
the relocation code on data from the architecture noted. */
static const struct reloc_howto_struct *
-vms_bfd_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
+vms_bfd_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
{
int alpha_type;
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_reloc_type_lookup(%p, %d)\t", abfd, code);
+ vms_debug (1, "vms_bfd_reloc_type_lookup (%p, %d)\t", abfd, code);
#endif
switch (code)
@@ -1625,30 +1331,29 @@ vms_bfd_reloc_type_lookup (abfd, code)
case BFD_RELOC_ALPHA_CODEADDR: alpha_type = ALPHA_R_CODEADDR; break;
default:
(*_bfd_error_handler) ("reloc (%d) is *UNKNOWN*", code);
- return (const struct reloc_howto_struct *) NULL;
+ return NULL;
}
#if VMS_DEBUG
vms_debug (2, "reloc is %s\n", alpha_howto_table[alpha_type].name);
#endif
- return &alpha_howto_table[alpha_type];
+ return & alpha_howto_table[alpha_type];
}
-/*-- Part 4.7, writing an object file ---------------------------------------*/
+/* Part 4.7, writing an object file. */
/* Set the architecture and machine type in BFD abfd to arch and mach.
Find the correct pointer to a structure and insert it into the arch_info
pointer. */
static bfd_boolean
-vms_set_arch_mach (abfd, arch, mach)
- bfd *abfd;
- enum bfd_architecture arch ATTRIBUTE_UNUSED;
- unsigned long mach ATTRIBUTE_UNUSED;
+vms_set_arch_mach (bfd * abfd,
+ enum bfd_architecture arch ATTRIBUTE_UNUSED,
+ unsigned long mach ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_set_arch_mach(%p, %d, %ld)\n", abfd, arch, mach);
+ vms_debug (1, "vms_set_arch_mach (%p, %d, %ld)\n", abfd, arch, mach);
#endif
- abfd->arch_info = bfd_scan_arch("alpha");
+ abfd->arch_info = bfd_scan_arch ("alpha");
return TRUE;
}
@@ -1663,32 +1368,30 @@ vms_set_arch_mach (abfd, arch, mach)
o and some more too */
static bfd_boolean
-vms_set_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- asection *section;
- const PTR location;
- file_ptr offset;
- bfd_size_type count;
+vms_set_section_contents (bfd * abfd,
+ asection *section,
+ const void * location,
+ file_ptr offset,
+ bfd_size_type count)
{
#if VMS_DEBUG
- vms_debug (1, "vms_set_section_contents(%p, sec %s, loc %p, off %ld, count %d)\n",
- abfd, section->name, location, (long int)offset, (int)count);
+ vms_debug (1, "vms_set_section_contents (%p, sec %s, loc %p, off %ld, count %d)\n",
+ abfd, section->name, location, (long int)offset, (int)count);
vms_debug (2, "size %d\n", (int) section->size);
#endif
- return _bfd_save_vms_section(abfd, section, location, offset, count);
+ return _bfd_save_vms_section (abfd, section, location, offset, count);
}
-/*-- Part 4.8, linker -------------------------------------------------------*/
+/* Part 4.8, linker. */
/* Get the size of the section headers. */
static int
-vms_sizeof_headers (abfd, reloc)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_boolean reloc ATTRIBUTE_UNUSED;
+vms_sizeof_headers (bfd * abfd ATTRIBUTE_UNUSED,
+ bfd_boolean reloc ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_sizeof_headers(%p, %s)\n", abfd, (reloc)?"True":"False");
+ vms_debug (1, "vms_sizeof_headers (%p, %s)\n", abfd, (reloc)?"True":"False");
#endif
return 0;
}
@@ -1697,56 +1400,51 @@ vms_sizeof_headers (abfd, reloc)
which can't be bothered to do it efficiently. */
static bfd_byte *
-vms_bfd_get_relocated_section_contents (abfd, link_info, link_order, data,
- relocatable, symbols)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
- struct bfd_link_order *link_order ATTRIBUTE_UNUSED;
- bfd_byte *data ATTRIBUTE_UNUSED;
- bfd_boolean relocatable ATTRIBUTE_UNUSED;
- asymbol **symbols ATTRIBUTE_UNUSED;
+vms_bfd_get_relocated_section_contents (bfd * abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+ struct bfd_link_order *link_order ATTRIBUTE_UNUSED,
+ bfd_byte *data ATTRIBUTE_UNUSED,
+ bfd_boolean relocatable ATTRIBUTE_UNUSED,
+ asymbol **symbols ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_get_relocated_section_contents(%p, %p, %p, %p, %s, %p)\n",
- abfd, link_info, link_order, data, (relocatable)?"True":"False", symbols);
+ vms_debug (1, "vms_bfd_get_relocated_section_contents (%p, %p, %p, %p, %s, %p)\n",
+ abfd, link_info, link_order, data, (relocatable)?"True":"False", symbols);
#endif
- return 0;
+ return NULL;
}
/* ??? */
static bfd_boolean
-vms_bfd_relax_section (abfd, section, link_info, again)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section ATTRIBUTE_UNUSED;
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
- bfd_boolean *again ATTRIBUTE_UNUSED;
+vms_bfd_relax_section (bfd * abfd ATTRIBUTE_UNUSED,
+ asection *section ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+ bfd_boolean *again ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_relax_section(%p, %s, %p, <ret>)\n",
- abfd, section->name, link_info);
+ vms_debug (1, "vms_bfd_relax_section (%p, %s, %p, <ret>)\n",
+ abfd, section->name, link_info);
#endif
return TRUE;
}
static bfd_boolean
-vms_bfd_gc_sections (abfd, link_info)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
+vms_bfd_gc_sections (bfd * abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_gc_sections(%p, %p)\n", abfd, link_info);
+ vms_debug (1, "vms_bfd_gc_sections (%p, %p)\n", abfd, link_info);
#endif
return TRUE;
}
static bfd_boolean
-vms_bfd_merge_sections (abfd, link_info)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
+vms_bfd_merge_sections (bfd * abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_merge_sections(%p, %p)\n", abfd, link_info);
+ vms_debug (1, "vms_bfd_merge_sections (%p, %p)\n", abfd, link_info);
#endif
return TRUE;
}
@@ -1755,35 +1453,32 @@ vms_bfd_merge_sections (abfd, link_info)
different information in this table. */
static struct bfd_link_hash_table *
-vms_bfd_link_hash_table_create (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
+vms_bfd_link_hash_table_create (bfd * abfd ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_link_hash_table_create(%p)\n", abfd);
+ vms_debug (1, "vms_bfd_link_hash_table_create (%p)\n", abfd);
#endif
- return 0;
+ return NULL;
}
/* Free a linker hash table. */
static void
-vms_bfd_link_hash_table_free (hash)
- struct bfd_link_hash_table *hash ATTRIBUTE_UNUSED;
+vms_bfd_link_hash_table_free (struct bfd_link_hash_table *hash ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_link_hash_table_free(%p)\n", abfd);
+ vms_debug (1, "vms_bfd_link_hash_table_free (%p)\n", abfd);
#endif
}
/* Add symbols from this object file into the hash table. */
static bfd_boolean
-vms_bfd_link_add_symbols (abfd, link_info)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
+vms_bfd_link_add_symbols (bfd * abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_link_add_symbols(%p, %p)\n", abfd, link_info);
+ vms_debug (1, "vms_bfd_link_add_symbols (%p, %p)\n", abfd, link_info);
#endif
return FALSE;
}
@@ -1792,12 +1487,11 @@ vms_bfd_link_add_symbols (abfd, link_info)
section of the BFD. */
static bfd_boolean
-vms_bfd_final_link (abfd, link_info)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
+vms_bfd_final_link (bfd * abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_final_link(%p, %p)\n", abfd, link_info);
+ vms_debug (1, "vms_bfd_final_link (%p, %p)\n", abfd, link_info);
#endif
return TRUE;
}
@@ -1805,50 +1499,46 @@ vms_bfd_final_link (abfd, link_info)
/* Should this section be split up into smaller pieces during linking. */
static bfd_boolean
-vms_bfd_link_split_section (abfd, section)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section ATTRIBUTE_UNUSED;
+vms_bfd_link_split_section (bfd * abfd ATTRIBUTE_UNUSED,
+ asection *section ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_link_split_section(%p, %s)\n", abfd, section->name);
+ vms_debug (1, "vms_bfd_link_split_section (%p, %s)\n", abfd, section->name);
#endif
return FALSE;
}
-/*-- Part 4.9, dynamic symbols and relocations ------------------------------*/
+/* Part 4.9, dynamic symbols and relocations. */
/* Get the amount of memory required to hold the dynamic symbols. */
static long
-vms_get_dynamic_symtab_upper_bound (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
+vms_get_dynamic_symtab_upper_bound (bfd * abfd ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_get_dynamic_symtab_upper_bound(%p)\n", abfd);
+ vms_debug (1, "vms_get_dynamic_symtab_upper_bound (%p)\n", abfd);
#endif
return 0;
}
static bfd_boolean
-vms_bfd_print_private_bfd_data (abfd, file)
- bfd *abfd ATTRIBUTE_UNUSED;
- void *file ATTRIBUTE_UNUSED;
+vms_bfd_print_private_bfd_data (bfd * abfd ATTRIBUTE_UNUSED,
+ void *file ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_bfd_print_private_bfd_data(%p)\n", abfd);
+ vms_debug (1, "vms_bfd_print_private_bfd_data (%p)\n", abfd);
#endif
- return 0;
+ return FALSE;
}
/* Read in the dynamic symbols. */
static long
-vms_canonicalize_dynamic_symtab (abfd, symbols)
- bfd *abfd ATTRIBUTE_UNUSED;
- asymbol **symbols ATTRIBUTE_UNUSED;
+vms_canonicalize_dynamic_symtab (bfd * abfd ATTRIBUTE_UNUSED,
+ asymbol **symbols ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_canonicalize_dynamic_symtab(%p, <ret>)\n", abfd);
+ vms_debug (1, "vms_canonicalize_dynamic_symtab (%p, <ret>)\n", abfd);
#endif
return 0L;
}
@@ -1856,11 +1546,10 @@ vms_canonicalize_dynamic_symtab (abfd, symbols)
/* Get the amount of memory required to hold the dynamic relocs. */
static long
-vms_get_dynamic_reloc_upper_bound (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
+vms_get_dynamic_reloc_upper_bound (bfd * abfd ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_get_dynamic_reloc_upper_bound(%p)\n", abfd);
+ vms_debug (1, "vms_get_dynamic_reloc_upper_bound (%p)\n", abfd);
#endif
return 0L;
}
@@ -1868,13 +1557,102 @@ vms_get_dynamic_reloc_upper_bound (abfd)
/* Read in the dynamic relocs. */
static long
-vms_canonicalize_dynamic_reloc (abfd, arel, symbols)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent **arel ATTRIBUTE_UNUSED;
- asymbol **symbols ATTRIBUTE_UNUSED;
+vms_canonicalize_dynamic_reloc (bfd * abfd ATTRIBUTE_UNUSED,
+ arelent **arel ATTRIBUTE_UNUSED,
+ asymbol **symbols ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
- vms_debug (1, "vms_canonicalize_dynamic_reloc(%p)\n", abfd);
+ vms_debug (1, "vms_canonicalize_dynamic_reloc (%p)\n", abfd);
#endif
return 0L;
}
+
+const bfd_target vms_alpha_vec =
+{
+ "vms-alpha", /* Name. */
+ bfd_target_evax_flavour,
+ BFD_ENDIAN_LITTLE, /* Data byte order is little. */
+ BFD_ENDIAN_LITTLE, /* Header byte order is little. */
+
+ (HAS_RELOC | HAS_SYMS
+ | WP_TEXT | D_PAGED), /* Object flags. */
+ (SEC_ALLOC | SEC_LOAD | SEC_RELOC
+ | SEC_READONLY | SEC_CODE | SEC_DATA
+ | SEC_HAS_CONTENTS | SEC_IN_MEMORY), /* Sect flags. */
+ 0, /* Symbol_leading_char. */
+ ' ', /* AR_pad_char. */
+ 15, /* AR_max_namelen. */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16,
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16,
+
+ {_bfd_dummy_target, vms_object_p, /* bfd_check_format. */
+ vms_archive_p, _bfd_dummy_target},
+ {bfd_false, vms_mkobject, /* bfd_set_format. */
+ _bfd_generic_mkarchive, bfd_false},
+ {bfd_false, vms_write_object_contents, /* bfd_write_contents. */
+ _bfd_write_archive_contents, bfd_false},
+
+ BFD_JUMP_TABLE_GENERIC (vms),
+ BFD_JUMP_TABLE_COPY (vms),
+ BFD_JUMP_TABLE_CORE (vms),
+ BFD_JUMP_TABLE_ARCHIVE (vms),
+ BFD_JUMP_TABLE_SYMBOLS (vms),
+ BFD_JUMP_TABLE_RELOCS (vms),
+ BFD_JUMP_TABLE_WRITE (vms),
+ BFD_JUMP_TABLE_LINK (vms),
+ BFD_JUMP_TABLE_DYNAMIC (vms),
+
+ NULL,
+
+ NULL
+};
+
+const bfd_target vms_vax_vec =
+{
+ "vms-vax", /* Name. */
+ bfd_target_ovax_flavour,
+ BFD_ENDIAN_LITTLE, /* Data byte order is little. */
+ BFD_ENDIAN_LITTLE, /* Header byte order is little. */
+
+ (HAS_RELOC | HAS_SYMS /* Object flags. */
+ | WP_TEXT | D_PAGED
+ | HAS_LINENO | HAS_DEBUG | HAS_LOCALS),
+
+ (SEC_ALLOC | SEC_LOAD | SEC_RELOC
+ | SEC_READONLY | SEC_CODE | SEC_DATA
+ | SEC_HAS_CONTENTS | SEC_IN_MEMORY), /* Sect flags. */
+ 0, /* Symbol_leading_char. */
+ ' ', /* AR_pad_char. */
+ 15, /* AR_max_namelen. */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */
+
+ {_bfd_dummy_target, vms_object_p, /* bfd_check_format. */
+ vms_archive_p, _bfd_dummy_target},
+ {bfd_false, vms_mkobject, /* bfd_set_format. */
+ _bfd_generic_mkarchive, bfd_false},
+ {bfd_false, vms_write_object_contents, /* bfd_write_contents. */
+ _bfd_write_archive_contents, bfd_false},
+
+ BFD_JUMP_TABLE_GENERIC (vms),
+ BFD_JUMP_TABLE_COPY (vms),
+ BFD_JUMP_TABLE_CORE (vms),
+ BFD_JUMP_TABLE_ARCHIVE (vms),
+ BFD_JUMP_TABLE_SYMBOLS (vms),
+ BFD_JUMP_TABLE_RELOCS (vms),
+ BFD_JUMP_TABLE_WRITE (vms),
+ BFD_JUMP_TABLE_LINK (vms),
+ BFD_JUMP_TABLE_DYNAMIC (vms),
+
+ NULL,
+
+ NULL
+};
diff --git a/bfd/vms.h b/bfd/vms.h
index afd1628..404da7b 100644
--- a/bfd/vms.h
+++ b/bfd/vms.h
@@ -1,25 +1,25 @@
#undef vms
/* vms.h -- Header file for VMS (Alpha and Vax) support.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
Free Software Foundation, Inc.
Written by Klaus K"ampf (kkaempf@rmi.de)
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef VMS_H
#define VMS_H
@@ -102,75 +102,75 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define TIR_S_C_CTL_STKDL 84
#define TIR_S_C_MAXCTLCOD 84
-#define ETIR_S_C_MINSTACOD 0 /* Minimum store code */
-#define ETIR_S_C_STA_GBL 0 /* Stack global symbol value */
-#define ETIR_S_C_STA_LW 1 /* Stack longword */
-#define ETIR_S_C_STA_QW 2 /* Stack quadword */
-#define ETIR_S_C_STA_PQ 3 /* Stack psect base plus quadword offset */
-#define ETIR_S_C_STA_LI 4 /* Stack literal */
-#define ETIR_S_C_STA_MOD 5 /* Stack module */
-#define ETIR_S_C_STA_CKARG 6 /* Check Arguments */
-#define ETIR_S_C_MAXSTACOD 6 /* Maximum stack code */
-#define ETIR_S_C_MINSTOCOD 50 /* Minimum store code */
-#define ETIR_S_C_STO_B 50 /* Store byte */
-#define ETIR_S_C_STO_W 51 /* Store word */
-#define ETIR_S_C_STO_LW 52 /* Store longword */
-#define ETIR_S_C_STO_QW 53 /* Store quadword */
-#define ETIR_S_C_STO_IMMR 54 /* Store immediate Repeated */
-#define ETIR_S_C_STO_GBL 55 /* Store global */
-#define ETIR_S_C_STO_CA 56 /* Store code address */
-#define ETIR_S_C_STO_RB 57 /* Store relative branch */
-#define ETIR_S_C_STO_AB 58 /* Store absolute branch */
-#define ETIR_S_C_STO_OFF 59 /* Store offset within psect */
-#define ETIR_S_C_STO_IMM 61 /* Store immediate */
-#define ETIR_S_C_STO_GBL_LW 62 /* Store global Longword */
-#define ETIR_S_C_STO_LP_PSB 63 /* STO_LP_PSB not valid in level 2 use STC_LP_PSB */
-#define ETIR_S_C_STO_HINT_GBL 64 /* Store 14 bit HINT at global address */
+#define ETIR_S_C_MINSTACOD 0 /* Minimum store code. */
+#define ETIR_S_C_STA_GBL 0 /* Stack global symbol value. */
+#define ETIR_S_C_STA_LW 1 /* Stack longword. */
+#define ETIR_S_C_STA_QW 2 /* Stack quadword. */
+#define ETIR_S_C_STA_PQ 3 /* Stack psect base plus quadword offset. */
+#define ETIR_S_C_STA_LI 4 /* Stack literal. */
+#define ETIR_S_C_STA_MOD 5 /* Stack module. */
+#define ETIR_S_C_STA_CKARG 6 /* Check Arguments. */
+#define ETIR_S_C_MAXSTACOD 6 /* Maximum stack code. */
+#define ETIR_S_C_MINSTOCOD 50 /* Minimum store code. */
+#define ETIR_S_C_STO_B 50 /* Store byte. */
+#define ETIR_S_C_STO_W 51 /* Store word. */
+#define ETIR_S_C_STO_LW 52 /* Store longword. */
+#define ETIR_S_C_STO_QW 53 /* Store quadword. */
+#define ETIR_S_C_STO_IMMR 54 /* Store immediate Repeated. */
+#define ETIR_S_C_STO_GBL 55 /* Store global. */
+#define ETIR_S_C_STO_CA 56 /* Store code address. */
+#define ETIR_S_C_STO_RB 57 /* Store relative branch. */
+#define ETIR_S_C_STO_AB 58 /* Store absolute branch. */
+#define ETIR_S_C_STO_OFF 59 /* Store offset within psect. */
+#define ETIR_S_C_STO_IMM 61 /* Store immediate. */
+#define ETIR_S_C_STO_GBL_LW 62 /* Store global Longword. */
+#define ETIR_S_C_STO_LP_PSB 63 /* STO_LP_PSB not valid in level 2 use STC_LP_PSB. */
+#define ETIR_S_C_STO_HINT_GBL 64 /* Store 14 bit HINT at global address. */
#define ETIR_S_C_STO_HINT_PS 65 /* Store 14 bit HINT at psect + offset */
-#define ETIR_S_C_MAXSTOCOD 65 /* Maximum store code */
-#define ETIR_S_C_MINOPRCOD 100 /* Minimum operate code */
-#define ETIR_S_C_OPR_NOP 100 /* No-op */
-#define ETIR_S_C_OPR_ADD 101 /* Add */
-#define ETIR_S_C_OPR_SUB 102 /* Subtract */
-#define ETIR_S_C_OPR_MUL 103 /* Multiply */
-#define ETIR_S_C_OPR_DIV 104 /* Divide */
-#define ETIR_S_C_OPR_AND 105 /* Logical AND */
-#define ETIR_S_C_OPR_IOR 106 /* Logical inclusive OR */
-#define ETIR_S_C_OPR_EOR 107 /* Logical exclusive OR */
-#define ETIR_S_C_OPR_NEG 108 /* Negate */
-#define ETIR_S_C_OPR_COM 109 /* Complement */
-#define ETIR_S_C_OPR_INSV 110 /* Insert bit field */
-#define ETIR_S_C_OPR_ASH 111 /* Arithmetic shift */
-#define ETIR_S_C_OPR_USH 112 /* Unsigned shift */
-#define ETIR_S_C_OPR_ROT 113 /* Rotate */
-#define ETIR_S_C_OPR_SEL 114 /* Select one of three longwords on top of stack */
-#define ETIR_S_C_OPR_REDEF 115 /* Redefine this symbol after pass 2 */
-#define ETIR_S_C_OPR_DFLIT 116 /* Define a literal */
-#define ETIR_S_C_MAXOPRCOD 116 /* Maximum operate code */
-#define ETIR_S_C_MINCTLCOD 150 /* Minimum control code */
-#define ETIR_S_C_CTL_SETRB 150 /* Set relocation base */
-#define ETIR_S_C_CTL_AUGRB 151 /* Augment relocation base */
-#define ETIR_S_C_CTL_DFLOC 152 /* Define debug location */
-#define ETIR_S_C_CTL_STLOC 153 /* Set debug location */
-#define ETIR_S_C_CTL_STKDL 154 /* Stack debug location */
-#define ETIR_S_C_MAXCTLCOD 154 /* Maximum control code */
-#define ETIR_S_C_MINSTCCOD 200 /* Minimum store-conditional code */
-#define ETIR_S_C_STC_LP 200 /* Store-conditional Linkage Pair */
-#define ETIR_S_C_STC_LP_PSB 201 /* Store-conditional Linkage Pair with Procedure Signature */
-#define ETIR_S_C_STC_GBL 202 /* Store-conditional Address at global address */
-#define ETIR_S_C_STC_GCA 203 /* Store-conditional Code Address at global address */
-#define ETIR_S_C_STC_PS 204 /* Store-conditional Address at psect + offset */
-#define ETIR_S_C_STC_NOP_GBL 205 /* Store-conditional NOP at address of global */
-#define ETIR_S_C_STC_NOP_PS 206 /* Store-conditional NOP at pect + offset */
-#define ETIR_S_C_STC_BSR_GBL 207 /* Store-conditional BSR at global address */
-#define ETIR_S_C_STC_BSR_PS 208 /* Store-conditional BSR at pect + offset */
-#define ETIR_S_C_STC_LDA_GBL 209 /* Store-conditional LDA at global address */
-#define ETIR_S_C_STC_LDA_PS 210 /* Store-conditional LDA at psect + offset */
-#define ETIR_S_C_STC_BOH_GBL 211 /* Store-conditional BSR or Hint at global address */
-#define ETIR_S_C_STC_BOH_PS 212 /* Store-conditional BSR or Hint at pect + offset */
-#define ETIR_S_C_STC_NBH_GBL 213 /* Store-conditional NOP,BSR or HINT at global address */
-#define ETIR_S_C_STC_NBH_PS 214 /* Store-conditional NOP,BSR or HINT at psect + offset */
-#define ETIR_S_C_MAXSTCCOD 214 /* Maximum store-conditional code */
+#define ETIR_S_C_MAXSTOCOD 65 /* Maximum store code. */
+#define ETIR_S_C_MINOPRCOD 100 /* Minimum operate code. */
+#define ETIR_S_C_OPR_NOP 100 /* No-op. */
+#define ETIR_S_C_OPR_ADD 101 /* Add. */
+#define ETIR_S_C_OPR_SUB 102 /* Subtract. */
+#define ETIR_S_C_OPR_MUL 103 /* Multiply. */
+#define ETIR_S_C_OPR_DIV 104 /* Divide. */
+#define ETIR_S_C_OPR_AND 105 /* Logical AND. */
+#define ETIR_S_C_OPR_IOR 106 /* Logical inclusive OR. */
+#define ETIR_S_C_OPR_EOR 107 /* Logical exclusive OR. */
+#define ETIR_S_C_OPR_NEG 108 /* Negate. */
+#define ETIR_S_C_OPR_COM 109 /* Complement. */
+#define ETIR_S_C_OPR_INSV 110 /* Insert bit field. */
+#define ETIR_S_C_OPR_ASH 111 /* Arithmetic shift. */
+#define ETIR_S_C_OPR_USH 112 /* Unsigned shift. */
+#define ETIR_S_C_OPR_ROT 113 /* Rotate. */
+#define ETIR_S_C_OPR_SEL 114 /* Select one of three longwords on top of stack. */
+#define ETIR_S_C_OPR_REDEF 115 /* Redefine this symbol after pass 2. */
+#define ETIR_S_C_OPR_DFLIT 116 /* Define a literal. */
+#define ETIR_S_C_MAXOPRCOD 116 /* Maximum operate code. */
+#define ETIR_S_C_MINCTLCOD 150 /* Minimum control code. */
+#define ETIR_S_C_CTL_SETRB 150 /* Set relocation base. */
+#define ETIR_S_C_CTL_AUGRB 151 /* Augment relocation base. */
+#define ETIR_S_C_CTL_DFLOC 152 /* Define debug location. */
+#define ETIR_S_C_CTL_STLOC 153 /* Set debug location. */
+#define ETIR_S_C_CTL_STKDL 154 /* Stack debug location. */
+#define ETIR_S_C_MAXCTLCOD 154 /* Maximum control code. */
+#define ETIR_S_C_MINSTCCOD 200 /* Minimum store-conditional code. */
+#define ETIR_S_C_STC_LP 200 /* Store-conditional Linkage Pair. */
+#define ETIR_S_C_STC_LP_PSB 201 /* Store-conditional Linkage Pair with Procedure Signature. */
+#define ETIR_S_C_STC_GBL 202 /* Store-conditional Address at global address. */
+#define ETIR_S_C_STC_GCA 203 /* Store-conditional Code Address at global address. */
+#define ETIR_S_C_STC_PS 204 /* Store-conditional Address at psect + offset. */
+#define ETIR_S_C_STC_NOP_GBL 205 /* Store-conditional NOP at address of global. */
+#define ETIR_S_C_STC_NOP_PS 206 /* Store-conditional NOP at pect + offset. */
+#define ETIR_S_C_STC_BSR_GBL 207 /* Store-conditional BSR at global address. */
+#define ETIR_S_C_STC_BSR_PS 208 /* Store-conditional BSR at pect + offset. */
+#define ETIR_S_C_STC_LDA_GBL 209 /* Store-conditional LDA at global address. */
+#define ETIR_S_C_STC_LDA_PS 210 /* Store-conditional LDA at psect + offset. */
+#define ETIR_S_C_STC_BOH_GBL 211 /* Store-conditional BSR or Hint at global address. */
+#define ETIR_S_C_STC_BOH_PS 212 /* Store-conditional BSR or Hint at pect + offset. */
+#define ETIR_S_C_STC_NBH_GBL 213 /* Store-conditional NOP,BSR or HINT at global address. */
+#define ETIR_S_C_STC_NBH_PS 214 /* Store-conditional NOP,BSR or HINT at psect + offset. */
+#define ETIR_S_C_MAXSTCCOD 214 /* Maximum store-conditional code. */
/* VMS Global symbol definition record (GSD/EGSD). */
@@ -194,16 +194,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define GSD_S_C_PROV 15
#define GSD_S_C_MAXRECTYP 15
-#define EGSD_S_K_ENTRIES 2 /* Offset to first entry in record */
-#define EGSD_S_C_ENTRIES 2 /* Offset to first entry in record */
-#define EGSD_S_C_PSC 0 /* Psect definition */
-#define EGSD_S_C_SYM 1 /* Symbol specification */
-#define EGSD_S_C_IDC 2 /* Random entity check */
-#define EGSD_S_C_SPSC 5 /* Shareable image psect definition */
-#define EGSD_S_C_SYMV 6 /* Vectored (dual-valued) versions of SYM, */
-#define EGSD_S_C_SYMM 7 /* Masked versions of SYM, */
-#define EGSD_S_C_SYMG 8 /* EGST - gst version of SYM */
-#define EGSD_S_C_MAXRECTYP 8 /* Maximum entry type defined */
+#define EGSD_S_K_ENTRIES 2 /* Offset to first entry in record. */
+#define EGSD_S_C_ENTRIES 2 /* Offset to first entry in record. */
+#define EGSD_S_C_PSC 0 /* Psect definition. */
+#define EGSD_S_C_SYM 1 /* Symbol specification. */
+#define EGSD_S_C_IDC 2 /* Random entity check. */
+#define EGSD_S_C_SPSC 5 /* Shareable image psect definition. */
+#define EGSD_S_C_SYMV 6 /* Vectored (dual-valued) versions of SYM. */
+#define EGSD_S_C_SYMM 7 /* Masked versions of SYM. */
+#define EGSD_S_C_SYMG 8 /* EGST - gst version of SYM. */
+#define EGSD_S_C_MAXRECTYP 8 /* Maximum entry type defined. */
#define GPS_S_M_PIC 1
#define GPS_S_M_LIB 2
@@ -250,59 +250,55 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define ENV_S_M_DEF 1
#define ENV_S_M_NESTED 2
-/*
- * Debugger symbol definitions: These are done by hand, as no
- * machine-readable version seems
- * to be available.
- */
-#define DST_S_C_C 7 /* Language == "C" */
-#define DST_S_C_CXX 15 /* Language == "C++" */
+/* Debugger symbol definitions: These are done by hand,
+ as no machine-readable version seems to be available. */
+#define DST_S_C_C 7 /* Language == "C". */
+#define DST_S_C_CXX 15 /* Language == "C++". */
#define DST_S_C_VERSION 153
-#define DST_S_C_SOURCE 155 /* Source file */
+#define DST_S_C_SOURCE 155 /* Source file. */
#define DST_S_C_PROLOG 162
-#define DST_S_C_BLKBEG 176 /* Beginning of block */
-#define DST_S_C_BLKEND 177 /* End of block */
+#define DST_S_C_BLKBEG 176 /* Beginning of block. */
+#define DST_S_C_BLKEND 177 /* End of block. */
#define DST_S_C_ENTRY 181
#define DST_S_C_PSECT 184
-#define DST_S_C_LINE_NUM 185 /* Line Number */
+#define DST_S_C_LINE_NUM 185 /* Line Number. */
#define DST_S_C_LBLORLIT 186
#define DST_S_C_LABEL 187
-#define DST_S_C_MODBEG 188 /* Beginning of module */
-#define DST_S_C_MODEND 189 /* End of module */
-#define DST_S_C_RTNBEG 190 /* Beginning of routine */
-#define DST_S_C_RTNEND 191 /* End of routine */
-#define DST_S_C_DELTA_PC_W 1 /* Incr PC */
-#define DST_S_C_INCR_LINUM 2 /* Incr Line # */
-#define DST_S_C_INCR_LINUM_W 3 /* Incr Line # */
+#define DST_S_C_MODBEG 188 /* Beginning of module. */
+#define DST_S_C_MODEND 189 /* End of module. */
+#define DST_S_C_RTNBEG 190 /* Beginning of routine.*/
+#define DST_S_C_RTNEND 191 /* End of routine. */
+#define DST_S_C_DELTA_PC_W 1 /* Incr PC. */
+#define DST_S_C_INCR_LINUM 2 /* Incr Line #. */
+#define DST_S_C_INCR_LINUM_W 3 /* Incr Line #. */
#define DST_S_C_SET_LINUM_INCR 4
#define DST_S_C_SET_LINUM_INCR_W 5
#define DST_S_C_RESET_LINUM_INCR 6
#define DST_S_C_BEG_STMT_MODE 7
#define DST_S_C_END_STMT_MODE 8
-#define DST_S_C_SET_LINE_NUM 9 /* Set Line # */
+#define DST_S_C_SET_LINE_NUM 9 /* Set Line #. */
#define DST_S_C_SET_PC 10
#define DST_S_C_SET_PC_W 11
#define DST_S_C_SET_PC_L 12
#define DST_S_C_SET_STMTNUM 13
-#define DST_S_C_TERM 14 /* End of lines */
-#define DST_S_C_TERM_W 15 /* End of lines */
-#define DST_S_C_SET_ABS_PC 16 /* Set PC */
-#define DST_S_C_DELTA_PC_L 17 /* Incr PC */
-#define DST_S_C_INCR_LINUM_L 18 /* Incr Line # */
-#define DST_S_C_SET_LINUM_B 19 /* Set Line # */
-#define DST_S_C_SET_LINUM_L 20 /* Set Line # */
-#define DST_S_C_TERM_L 21 /* End of lines */
-/* these are used with DST_S_C_SOURCE */
-#define DST_S_C_SRC_DECLFILE 1 /* Declare source file */
-#define DST_S_C_SRC_SETFILE 2 /* Set source file */
-#define DST_S_C_SRC_SETREC_L 3 /* Set record, longword value */
-#define DST_S_C_SRC_SETREC_W 4 /* Set record, word value */
-#define DST_S_C_SRC_DEFLINES_W 10 /* # of line, word counter */
-#define DST_S_C_SRC_DEFLINES_B 11 /* # of line, byte counter */
-#define DST_S_C_SRC_FORMFEED 16 /* ^L counts as a record */
-/* the following are the codes for the various data types. Anything not on
- * the list is included under 'advanced_type'
- */
+#define DST_S_C_TERM 14 /* End of lines. */
+#define DST_S_C_TERM_W 15 /* End of lines. */
+#define DST_S_C_SET_ABS_PC 16 /* Set PC. */
+#define DST_S_C_DELTA_PC_L 17 /* Incr PC. */
+#define DST_S_C_INCR_LINUM_L 18 /* Incr Line #. */
+#define DST_S_C_SET_LINUM_B 19 /* Set Line #. */
+#define DST_S_C_SET_LINUM_L 20 /* Set Line #. */
+#define DST_S_C_TERM_L 21 /* End of lines. */
+/* These are used with DST_S_C_SOURCE */
+#define DST_S_C_SRC_DECLFILE 1 /* Declare source file. */
+#define DST_S_C_SRC_SETFILE 2 /* Set source file. */
+#define DST_S_C_SRC_SETREC_L 3 /* Set record, longword value. */
+#define DST_S_C_SRC_SETREC_W 4 /* Set record, word value. */
+#define DST_S_C_SRC_DEFLINES_W 10 /* # of line, word counter. */
+#define DST_S_C_SRC_DEFLINES_B 11 /* # of line, byte counter. */
+#define DST_S_C_SRC_FORMFEED 16 /* ^L counts as a record. */
+/* The following are the codes for the various data types. Anything not on
+ the list is included under 'advanced_type'. */
#define DBG_S_C_UCHAR 0x02
#define DBG_S_C_USINT 0x03
#define DBG_S_C_ULINT 0x04
@@ -312,76 +308,69 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define DBG_S_C_SLINT 0x08
#define DBG_S_C_SQUAD 0x09
#define DBG_S_C_REAL4 0x0a
-#define DBG_S_C_REAL8 0x0b /* D_float double */
-#define DBG_S_C_COMPLX4 0x0c /* 2xF_float complex float */
-#define DBG_S_C_COMPLX8 0x0d /* 2xD_float complex double */
-#define DBG_S_C_REAL8_G 0x1b /* G_float double */
-#define DBG_S_C_COMPLX8_G 0x1d /* 2xG_float complex double */
+#define DBG_S_C_REAL8 0x0b /* D_float double. */
+#define DBG_S_C_COMPLX4 0x0c /* 2xF_float complex float. */
+#define DBG_S_C_COMPLX8 0x0d /* 2xD_float complex double. */
+#define DBG_S_C_REAL8_G 0x1b /* G_float double. */
+#define DBG_S_C_COMPLX8_G 0x1d /* 2xG_float complex double. */
#define DBG_S_C_FUNCTION_ADDR 0x17
#define DBG_S_C_ADVANCED_TYPE 0xa3
-/* Some of these are just for future reference. [pr]
- */
-#define DBG_S_C_UBITA 0x01 /* unsigned, aligned bit field */
-#define DBG_S_C_UBITU 0x22 /* unsigned, unaligned bit field */
-#define DBG_S_C_SBITA 0x29 /* signed, aligned bit field */
-#define DBG_S_C_SBITU 0x2a /* signed, unaligned bit field */
-#define DBG_S_C_CSTRING 0x2e /* asciz ('\0' terminated) string */
-#define DBG_S_C_WCHAR 0x38 /* wchar_t */
-/* These are descriptor class codes.
- */
-#define DSC_K_CLASS_S 0x01 /* static (fixed length) */
-#define DSC_K_CLASS_D 0x02 /* dynamic string (not via malloc!) */
-#define DSC_K_CLASS_A 0x04 /* array */
-#define DSC_K_CLASS_UBS 0x0d /* unaligned bit string */
+/* Some of these are just for future reference. [pr]. */
+#define DBG_S_C_UBITA 0x01 /* Unsigned, aligned bit field. */
+#define DBG_S_C_UBITU 0x22 /* Unsigned, unaligned bit field. */
+#define DBG_S_C_SBITA 0x29 /* Signed, aligned bit field. */
+#define DBG_S_C_SBITU 0x2a /* Signed, unaligned bit field. */
+#define DBG_S_C_CSTRING 0x2e /* Asciz ('\0' terminated) string. */
+#define DBG_S_C_WCHAR 0x38 /* Wchar_t. */
+/* These are descriptor class codes. */
+#define DSC_K_CLASS_S 0x01 /* Static (fixed length). */
+#define DSC_K_CLASS_D 0x02 /* Dynamic string (not via malloc!). */
+#define DSC_K_CLASS_A 0x04 /* Array. */
+#define DSC_K_CLASS_UBS 0x0d /* Unaligned bit string. */
/* These are the codes that are used to generate the definitions of struct
- * union and enum records
- */
+ union and enum records. */
#define DBG_S_C_ENUM_ITEM 0xa4
#define DBG_S_C_ENUM_START 0xa5
#define DBG_S_C_ENUM_END 0xa6
#define DBG_S_C_STRUCT_ITEM DST_K_VFLAGS_BITOFFS /* 0xff */
#define DBG_S_C_STRUCT_START 0xab
#define DBG_S_C_STRUCT_END 0xac
-#define DST_K_TYPSPEC 0xaf /* type specification */
-/* These codes are used in the generation of the symbol definition records
- */
-#define DST_K_VFLAGS_NOVAL 0x80 /* struct definition only */
-#define DST_K_VFLAGS_DSC 0xfa /* descriptor used */
-#define DST_K_VFLAGS_TVS 0xfb /* trailing value specified */
-#define DST_K_VS_FOLLOWS 0xfd /* value spec follows */
-#define DST_K_VFLAGS_BITOFFS 0xff /* value contains bit offset */
+#define DST_K_TYPSPEC 0xaf /* Type specification. */
+/* These codes are used in the generation of the symbol definition records. */
+#define DST_K_VFLAGS_NOVAL 0x80 /* Struct definition only. */
+#define DST_K_VFLAGS_DSC 0xfa /* Descriptor used. */
+#define DST_K_VFLAGS_TVS 0xfb /* Trailing value specified. */
+#define DST_K_VS_FOLLOWS 0xfd /* Value spec follows. */
+#define DST_K_VFLAGS_BITOFFS 0xff /* Value contains bit offset. */
#define DST_K_VALKIND_LITERAL 0
#define DST_K_VALKIND_ADDR 1
#define DST_K_VALKIND_DESC 2
#define DST_K_VALKIND_REG 3
-#define DST_K_REG_VAX_AP 0x0c /* R12 */
-#define DST_K_REG_VAX_FP 0x0d /* R13 */
-#define DST_K_REG_VAX_SP 0x0e /* R14 */
-#define DST_V_VALKIND 0 /* offset of valkind field */
-#define DST_V_INDIRECT 2 /* offset to indirect bit */
-#define DST_V_DISP 3 /* offset to displacement bit */
-#define DST_V_REGNUM 4 /* offset to register number */
+#define DST_K_REG_VAX_AP 0x0c /* R12. */
+#define DST_K_REG_VAX_FP 0x0d /* R13. */
+#define DST_K_REG_VAX_SP 0x0e /* R14. */
+#define DST_V_VALKIND 0 /* Offset of valkind field. */
+#define DST_V_INDIRECT 2 /* Offset to indirect bit. */
+#define DST_V_DISP 3 /* Offset to displacement bit. */
+#define DST_V_REGNUM 4 /* Offset to register number. */
#define DST_M_INDIRECT (1<<DST_V_INDIRECT)
#define DST_M_DISP (1<<DST_V_DISP)
#define DBG_C_FUNCTION_PARAM /* 0xc9 */ \
(DST_K_VALKIND_ADDR|DST_M_DISP|(DST_K_REG_VAX_AP<<DST_V_REGNUM))
#define DBG_C_LOCAL_SYM /* 0xd9 */ \
(DST_K_VALKIND_ADDR|DST_M_DISP|(DST_K_REG_VAX_FP<<DST_V_REGNUM))
-/* Kinds of value specifications
- */
-#define DST_K_VS_ALLOC_SPLIT 3 /* split lifetime */
-/* Kinds of type specifications
- */
-#define DST_K_TS_ATOM 0x01 /* atomic type specification */
-#define DST_K_TS_DSC 0x02 /* descriptor type spec */
-#define DST_K_TS_IND 0x03 /* indirect type specification */
-#define DST_K_TS_TPTR 0x04 /* typed pointer type spec */
-#define DST_K_TS_PTR 0x05 /* pointer type spec */
-#define DST_K_TS_ARRAY 0x07 /* array type spec */
-#define DST_K_TS_NOV_LENG 0x0e /* novel length type spec */
-/* These are the codes that are used in the suffix records to determine the
- * actual data type
- */
+/* Kinds of value specifications. */
+#define DST_K_VS_ALLOC_SPLIT 3 /* Split lifetime. */
+/* Kinds of type specifications. */
+#define DST_K_TS_ATOM 0x01 /* Atomic type specification. */
+#define DST_K_TS_DSC 0x02 /* Descriptor type spec. */
+#define DST_K_TS_IND 0x03 /* Indirect type specification. */
+#define DST_K_TS_TPTR 0x04 /* Typed pointer type spec. */
+#define DST_K_TS_PTR 0x05 /* Pointer type spec. */
+#define DST_K_TS_ARRAY 0x07 /* Array type spec. */
+#define DST_K_TS_NOV_LENG 0x0e /* Novel length type spec. */
+/* These are the codes that are used in the suffix records to determine the
+ actual data type. */
#define DBG_S_C_BASIC DST_K_TS_ATOM
#define DBG_S_C_BASIC_ARRAY DST_K_TS_DSC
#define DBG_S_C_STRUCT DST_K_TS_IND
@@ -400,272 +389,267 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define MHD_S_C_GTX 6
#define MHD_S_C_MAXHDRTYP 6
-#define EMH_S_C_MHD 0 /* Main header record */
-#define EMH_S_C_LNM 1 /* Language name and version */
-#define EMH_S_C_SRC 2 /* Source file specification */
-#define EMH_S_C_TTL 3 /* Title text of module */
-#define EMH_S_C_CPR 4 /* Copyright notice */
-#define EMH_S_C_MTC 5 /* Maintenance status */
-#define EMH_S_C_GTX 6 /* General text */
-#define EMH_S_C_MAXHDRTYP 6 /* Maximum allowable type */
+#define EMH_S_C_MHD 0 /* Main header record. */
+#define EMH_S_C_LNM 1 /* Language name and version. */
+#define EMH_S_C_SRC 2 /* Source file specification. */
+#define EMH_S_C_TTL 3 /* Title text of module. */
+#define EMH_S_C_CPR 4 /* Copyright notice. */
+#define EMH_S_C_MTC 5 /* Maintenance status. */
+#define EMH_S_C_GTX 6 /* General text. */
+#define EMH_S_C_MAXHDRTYP 6 /* Maximum allowable type. */
/* vms.c. */
-extern asymbol *_bfd_vms_make_empty_symbol PARAMS ((bfd *abfd));
+extern asymbol *_bfd_vms_make_empty_symbol (bfd *);
/* vms-gsd.c. */
-extern int _bfd_vms_slurp_gsd PARAMS ((bfd *abfd, int objtype));
-extern int _bfd_vms_write_gsd PARAMS ((bfd *abfd, int objtype));
+extern int _bfd_vms_slurp_gsd (bfd *, int);
+extern int _bfd_vms_write_gsd (bfd *, int);
/* vms-mhd.c. */
-extern int _bfd_vms_slurp_hdr PARAMS ((bfd *abfd, int objtype));
-extern int _bfd_vms_write_hdr PARAMS ((bfd *abfd, int objtype));
-extern int _bfd_vms_slurp_eom PARAMS ((bfd *abfd, int objtype));
-extern int _bfd_vms_write_eom PARAMS ((bfd *abfd, int objtype));
+extern int _bfd_vms_slurp_hdr (bfd *, int);
+extern int _bfd_vms_write_hdr (bfd *, int);
+extern int _bfd_vms_slurp_eom (bfd *, int);
+extern int _bfd_vms_write_eom (bfd *, int);
/* vms-tir.c. */
-extern int _bfd_vms_slurp_tir PARAMS ((bfd *abfd, int objtype));
-extern int _bfd_vms_slurp_dbg PARAMS ((bfd *abfd, int objtype));
-extern int _bfd_vms_slurp_tbt PARAMS ((bfd *abfd, int objtype));
-extern int _bfd_vms_slurp_lnk PARAMS ((bfd *abfd, int objtype));
-
-extern int _bfd_vms_write_tir PARAMS ((bfd *abfd, int objtype));
-extern int _bfd_vms_write_tbt PARAMS ((bfd *abfd, int objtype));
-extern int _bfd_vms_write_dbg PARAMS ((bfd *abfd, int objtype));
-
-/* The r_type field in a reloc is one of the following values. */
-#define ALPHA_R_IGNORE 0
-#define ALPHA_R_REFQUAD 1
-#define ALPHA_R_BRADDR 2
-#define ALPHA_R_HINT 3
-#define ALPHA_R_SREL16 4
-#define ALPHA_R_SREL32 5
-#define ALPHA_R_SREL64 6
-#define ALPHA_R_OP_PUSH 7
-#define ALPHA_R_OP_STORE 8
-#define ALPHA_R_OP_PSUB 9
-#define ALPHA_R_OP_PRSHIFT 10
-#define ALPHA_R_LINKAGE 11
-#define ALPHA_R_REFLONG 12
-#define ALPHA_R_CODEADDR 13
-
-/* Object language definitions. */
-
-#define OBJ_S_C_HDR 0 /*VAX module header record */
-#define OBJ_S_C_GSD 1 /*VAX global symbol definition record */
-#define OBJ_S_C_TIR 2 /*VAX text information record */
-#define OBJ_S_C_EOM 3 /*VAX end of module record */
-#define OBJ_S_C_DBG 4 /*VAX Debugger information record */
-#define OBJ_S_C_TBT 5 /*VAX Traceback information record */
-#define OBJ_S_C_LNK 6 /*VAX linker options record */
-#define OBJ_S_C_EOMW 7 /*VAX end of module word-psect record */
-#define OBJ_S_C_MAXRECTYP 7 /*VAX Last assigned record type */
-#define EOBJ_S_C_EMH 8 /*EVAX module header record */
-#define EOBJ_S_C_EEOM 9 /*EVAX end of module record */
-#define EOBJ_S_C_EGSD 10 /*EVAX global symbol definition record */
-#define EOBJ_S_C_ETIR 11 /*EVAX text information record */
-#define EOBJ_S_C_EDBG 12 /*EVAX Debugger information record */
-#define EOBJ_S_C_ETBT 13 /*EVAX Traceback information record */
-#define EOBJ_S_C_MAXRECTYP 13 /*EVAX Last assigned record type */
-#define OBJ_S_K_SUBTYP 1
-#define OBJ_S_C_SUBTYP 1
-#define EOBJ_S_K_SUBTYP 4
-#define EOBJ_S_C_SUBTYP 4
-#define OBJ_S_C_MAXRECSIZ 2048 /*Maximum legal record size */
-#define EOBJ_S_C_MAXRECSIZ 8192 /*Maximum legal record size */
-#define OBJ_S_C_STRLVL 0 /*Structure level */
-#define EOBJ_S_C_STRLVL 2 /*Structure level */
-#define OBJ_S_C_SYMSIZ 31 /*Maximum symbol length */
-#define EOBJ_S_C_SYMSIZ 64 /*Maximum symbol length */
-#define EOBJ_S_C_SECSIZ 31 /*Maximum section name length */
-#define OBJ_S_C_STOREPLIM -1 /*Maximum repeat count on store commands */
-#define EOBJ_S_C_STOREPLIM -1 /*Maximum repeat count on store commands */
-#define OBJ_S_C_PSCALILIM 9 /*Maximum p-sect alignment */
-#define EOBJ_S_C_PSCALILIM 16 /*Maximum p-sect alignment */
-
-#define EVAX_OFFSET 256 /*type offset for EVAX codes in switch */
-/* Miscellaneous definitions. */
-
-#if __GNUC__
-typedef unsigned long long uquad;
-#else
-typedef unsigned long uquad;
-#endif
-
-#define MAX_OUTREC_SIZE 4096
-#define MIN_OUTREC_LUFT 64
-
-typedef struct _vms_section {
- unsigned char *contents;
- bfd_vma offset;
- bfd_size_type size;
- struct _vms_section *next;
-} vms_section;
-
-extern vms_section *_bfd_get_vms_section PARAMS ((bfd *abfd, int index));
-
-typedef struct _vms_reloc {
- struct _vms_reloc *next;
- arelent *reloc;
- asection *section;
-} vms_reloc;
-
-/* vms module header */
-
-struct hdr_struc {
- int hdr_b_strlvl;
- long hdr_l_arch1;
- long hdr_l_arch2;
- long hdr_l_recsiz;
- char *hdr_t_name;
- char *hdr_t_version;
- char *hdr_t_date;
- char *hdr_c_lnm;
- char *hdr_c_src;
- char *hdr_c_ttl;
-};
-
-/* vms end of module */
-
-struct eom_struc {
- long eom_l_total_lps;
- unsigned char eom_b_comcod;
- bfd_boolean eom_has_transfer;
- unsigned char eom_b_tfrflg;
- long eom_l_psindx;
- long eom_l_tfradr;
-};
-
+extern int _bfd_vms_slurp_tir (bfd *, int);
+extern int _bfd_vms_slurp_dbg (bfd *, int);
+extern int _bfd_vms_slurp_tbt (bfd *, int);
+extern int _bfd_vms_slurp_lnk (bfd *, int);
+
+extern int _bfd_vms_write_tir (bfd *, int);
+extern int _bfd_vms_write_tbt (bfd *, int);
+extern int _bfd_vms_write_dbg (bfd *, int);
+
+/* The r_type field in a reloc is one of he following values. */
+#define ALPHA_R_IGNORE 0
+#define ALPHA_R_REFQUAD 1
+#define ALPHA_R_BRADDR 2
+#define ALPHA_R_HINT 3
+#define ALPHA_R_SREL16 4
+#define ALPHA_R_SREL32 5
+#define ALPHA_R_SREL64 6
+#define ALPHA_R_OP_PUSH 7
+#define ALPHA_R_OP_STORE 8
+#define ALPHA_R_OP_PSUB 9
+#define ALPHA_R_OP_PRSHIFT 10
+#define ALPHA_R_LINKAGE 11
+#define ALPHA_R_REFLONG 12
+#define ALPHA_R_CODEADDR 13
+
+/* Object language definitions. */
+
+#define OBJ_S_C_HDR 0 /* VAX moule header record. */
+#define OBJ_S_C_GSD 1 /* VAX glbal symbol definition record. */
+#define OBJ_S_C_TIR 2 /* VAX tet information record. */
+#define OBJ_S_C_EOM 3 /* VAX en of module record. */
+#define OBJ_S_C_DBG 4 /* VAX Deugger information record. */
+#define OBJ_S_C_TBT 5 /* VAX Trceback information record. */
+#define OBJ_S_C_LNK 6 /* VAX liker options record. */
+#define OBJ_S_C_EOMW 7 /* VAX en of module word-psect record. */
+#define OBJ_S_C_MAXRECTYP 7 /* VAX Lat assigned record type. */
+#define EOBJ_S_C_EMH 8 /* EVAX mdule header record. */
+#define EOBJ_S_C_EEOM 9 /* EVAX ed of module record. */
+#define EOBJ_S_C_EGSD 10 /* EVAX gobal symbol definition record.*/
+#define EOBJ_S_C_ETIR 11 /* EVAX txt information record. */
+#define EOBJ_S_C_EDBG 12 /* EVAX Dbugger information record. */
+#define EOBJ_S_C_ETBT 13 /* EVAX Taceback information record. */
+#define EOBJ_S_C_MAXRECTYP 13 /* EVAX Lst assigned record type. */
+#define OBJ_S_K_SUBTYP 1
+#define OBJ_S_C_SUBTYP 1
+#define EOBJ_S_K_SUBTYP 4
+#define EOBJ_S_C_SUBTYP 4
+#define OBJ_S_C_MAXRECSIZ 2048 /* Maximu legal record size. */
+#define EOBJ_S_C_MAXRECSIZ 8192 /* Maximu legal record size. */
+#define OBJ_S_C_STRLVL 0 /* Structre level. */
+#define EOBJ_S_C_STRLVL 2 /* Structre level. */
+#define OBJ_S_C_SYMSIZ 31 /* Maximu symbol length. */
+#define EOBJ_S_C_SYMSIZ 64 /* Maximu symbol length. */
+#define EOBJ_S_C_SECSIZ 31 /* Maximu section name length. */
+#define OBJ_S_C_STOREPLIM -1 /* Maximu repeat count on store commands. */
+#define EOBJ_S_C_STOREPLIM -1 /* Maximu repeat count on store commands. */
+#define OBJ_S_C_PSCALILIM 9 /* Maximu p-sect alignment. */
+#define EOBJ_S_C_PSCALILIM 16 /* Maximu p-sect alignment. */
+
+#define EVAX_OFFSET 256 /* Type ofset for EVAX codes in switch. */
+/* Miscellaneous definitions. */
+
+#if __GNUC__
+typedef unsigned long long uquad;
+#else
+typedef unsigned long uquad;
+#endif
+
+#define MAX_OUTREC_SIZE 4096
+#define MIN_OUTREC_LUFT 64
+
+typedef struct _vms_section
+{
+ unsigned char *contents;
+ bfd_vma offset;
+ bfd_size_type size;
+ struct _vms_section *next;
+} vms_section;
+
+extern vms_section * _bfd_get_vms_section (bfd *, int);
+
+typedef struct _vms_reloc
+{
+ struct _vms_reloc *next;
+ arelent *reloc;
+ asection *section;
+} vms_reloc;
+
+/* VMS module header. */
+
+struct hdr_struc
+{
+ int hdr_b_strlvl;
+ long hdr_l_arch1;
+ long hdr_l_arch2;
+ long hdr_l_recsiz;
+ char * hdr_t_name;
+ char * hdr_t_version;
+ char * hdr_t_date;
+ char * hdr_c_lnm;
+ char * hdr_c_src;
+ char * hdr_c_ttl;
+};
+
+/* VMS end of module. */
+
+struct eom_struc
+{
+ long eom_l_total_lps;
+ unsigned char eom_b_comcod;
+ bfd_boolean eom_has_transfer;
+ unsigned char eom_b_tfrflg;
+ long eom_l_psindx;
+ long eom_l_tfradr;
+};
+
enum file_format_enum { FF_UNKNOWN, FF_FOREIGN, FF_NATIVE, FF_VAX };
-
-typedef struct vms_symbol_struct {
- struct bfd_hash_entry bfd_hash;
- asymbol *symbol;
-} vms_symbol_entry;
-
-/* stack value for push/pop commands */
-
-struct stack_struct {
- uquad value;
- int psect;
-};
-#define STACKSIZE 8192
-
-/* location stack definitions for CTL_DFLOC, CTL_STLOC, and CTL_STKDL */
-
-struct location_struct {
- unsigned long value;
- int psect;
-};
-#define LOCATION_SAVE_SIZE 32
-
-#define VMS_SECTION_COUNT 1024
-
-struct vms_private_data_struct {
- int is_vax;
+
+typedef struct vms_symbol_struct
+{
+ struct bfd_hash_entry bfd_hash;
+ asymbol *symbol;
+} vms_symbol_entry;
+
+/* Stack value for push/pop commands. */
+
+struct stack_struct
+{
+ uquad value;
+ int psect;
+};
+#define STACKSIZE 8192
+
+/* location stack definitions for CTL_DFLC, CTL_STLOC, and CTL_STKDL */
+
+struct location_struct
+{
+ unsigned long value;
+ int psect;
+};
+#define LOCATION_SAVE_SIZE 32
+
+#define VMS_SECTION_COUNT 1024
+
+struct vms_private_data_struct
+{
+ bfd_boolean is_vax;
bfd_boolean fixup_done; /* Flag to indicate if all
section pointers and PRIV(sections)
- are set up correctly */
- unsigned char *vms_buf; /* buffer to record */
- int buf_size; /* max size of buffer */
- unsigned char *vms_rec; /* actual record ptr */
- int rec_length; /* remaining record length */
- int rec_size; /* actual record size */
- int rec_type; /* actual record type */
- enum file_format_enum file_format;
-
- struct hdr_struc hdr_data; /* data from HDR/EMH record */
- struct eom_struc eom_data; /* data from EOM/EEOM record */
- unsigned int section_count; /* # of sections in following array */
- asection **sections; /* array of GSD/EGSD sections */
- int gsd_sym_count; /* # of GSD/EGSD symbols */
- asymbol **symbols; /* vector of GSD/EGSD symbols */
- struct proc_value *procedure;
-
- struct stack_struct *stack;
- int stackptr;
-
+ are set up correctly. */
+ unsigned char *vms_buf; /* Buffer to record. */
+ int buf_size; /* Max size of buffer. */
+ unsigned char *vms_rec; /* Actual record ptr. */
+ int rec_length; /* Remaining record length. */
+ int rec_size; /* Actual record size. */
+ int rec_type; /* Actual record type. */
+ enum file_format_enum file_format;
+
+ struct hdr_struc hdr_data; /* Data from HDR/EMH record. */
+ struct eom_struc eom_data; /* Data from EOM/EEOM record. */
+ unsigned int section_count; /* # of sections in following array. */
+ asection **sections; /* Array of GSD/EGSD sections. */
+ int gsd_sym_count; /* # of GSD/EGSD symbols. */
+ asymbol **symbols; /* Vector of GSD/EGSD symbols. */
+ struct proc_value *procedure;
+
+ struct stack_struct *stack;
+ int stackptr;
+
vms_section *vms_section_table[VMS_SECTION_COUNT];
-
+
struct bfd_hash_table *vms_symbol_table;
- struct bfd_symbol **symcache;
- int symnum;
-
+ struct bfd_symbol **symcache;
+ int symnum;
+
struct location_struct *location_stack;
-
- asection *image_section; /* section for image_ptr */
- unsigned char *image_ptr; /* a pointer to section->contents */
-
- unsigned char pdsc[8]; /* procedure descriptor */
-
- /* Output routine storage */
-
- unsigned char *output_buf; /* output data */
- int push_level;
- int pushed_size;
- int length_pos;
- int output_size;
- int output_alignment;
-
- /* linkage index counter
- used by conditional store commands (ETIR_S_C_STC_) */
-
- int vms_linkage_index;
-
- /* see tc-alpha.c of gas for a description. */
- int flag_hash_long_names; /* -+, hash instead of truncate */
- int flag_show_after_trunc; /* -H, show hashing/truncation */
-};
-
-#define PRIV(name) ((struct vms_private_data_struct *)abfd->tdata.any)->name
-
+
+ asection *image_section; /* Section for image_ptr. */
+ unsigned char *image_ptr; /* A pointer to section->contents. */
+
+ unsigned char pdsc[8]; /* Procedure descriptor. */
+
+ /* Output routine storage. */
+ unsigned char *output_buf; /* Output data. */
+ int push_level;
+ int pushed_size;
+ int length_pos;
+ int output_size;
+ int output_alignment;
+
+ /* Linkage index counter
+ used by conditional store commands (TIR_S_C_STC_). */
+ int vms_linkage_index;
+
+ /* see tc-alpha.c of gas for a descripton. */
+ int flag_hash_long_names; /* -+, hash instead of truncate. */
+ int flag_show_after_trunc; /* -H, shw hashing/truncation. */
+};
+
+#define PRIV(name) ((struct vms_private_data_struct *) abfd->tdata.any)->name
+
#define SECTION_NAME_TEMPLATE "__SEC__%d"
-
-#if VMS_DEBUG
-extern void _bfd_vms_debug PARAMS((int level, char *format, ...));
-extern void _bfd_hexdump
- PARAMS ((int level, unsigned char *ptr, int size, int offset));
-
-#define vms_debug _bfd_vms_debug
-#endif
-
-extern struct bfd_hash_entry *_bfd_vms_hash_newfunc
- PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table,
- const char *string));
-extern void _bfd_vms_get_header_values
- PARAMS ((bfd *abfd, unsigned char *buf, int *type, int *length));
-extern int _bfd_vms_get_record PARAMS ((bfd *abfd));
-extern int _bfd_vms_next_record PARAMS ((bfd *abfd));
-
-extern char *_bfd_vms_save_sized_string PARAMS ((unsigned char *str, int size));
-extern char *_bfd_vms_save_counted_string PARAMS ((unsigned char *ptr));
-extern void _bfd_vms_push PARAMS ((bfd *abfd, uquad val, int psect));
-extern uquad _bfd_vms_pop PARAMS ((bfd *abfd, int *psect));
-
-extern bfd_boolean _bfd_save_vms_section
- PARAMS ((bfd *abfd, asection *section, const PTR data, file_ptr offset,
- bfd_size_type count));
-extern void _bfd_vms_output_begin
- PARAMS ((bfd *abfd, int rectype, int rechead));
-extern void _bfd_vms_output_alignment PARAMS ((bfd *abfd, int alignto));
-extern void _bfd_vms_output_push PARAMS ((bfd *abfd));
-extern void _bfd_vms_output_pop PARAMS ((bfd *abfd));
-extern void _bfd_vms_output_flush PARAMS ((bfd *abfd));
-extern void _bfd_vms_output_end PARAMS ((bfd *abfd));
-extern int _bfd_vms_output_check PARAMS ((bfd *abfd, int size));
-extern void _bfd_vms_output_byte PARAMS ((bfd *abfd, unsigned int value));
-extern void _bfd_vms_output_short PARAMS ((bfd *abfd, unsigned int value));
-extern void _bfd_vms_output_long PARAMS ((bfd *abfd, unsigned long value));
-extern void _bfd_vms_output_quad PARAMS ((bfd *abfd, uquad value));
-extern void _bfd_vms_output_counted PARAMS ((bfd *abfd, char *value));
-extern void _bfd_vms_output_dump PARAMS ((bfd *abfd, unsigned char *data,
- int length));
-extern void _bfd_vms_output_fill PARAMS ((bfd *abfd, int value, int length));
-extern char *_bfd_vms_length_hash_symbol PARAMS ((bfd *abfd, const char *in, int maxlen));
-
-extern vms_symbol_entry *_bfd_vms_enter_symbol PARAMS ((bfd *abfd, char *name));
+
+#if VMS_DEBUG
+extern void _bfd_vms_debug (int, char *, ..);
+extern void _bfd_hexdump (int, unsignedchar *, int, int);
+
+#define vms_debug _bfd_vms_debug
+#endif
+
+extern struct bfd_hash_entry * _bfd_vms_hash_newfunc (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
+extern void _bfd_vms_get_header_values (bfd *, unsigned char *, int *, int *);
+extern int _bfd_vms_get_record (bfd *abf);
+extern int _bfd_vms_next_record (bfd *abf);
+extern char * _bfd_vms_save_sized_string (unsigned char *, int);
+extern char * _bfd_vms_save_counted_string (unsigned char *);
+extern void _bfd_vms_push (bfd *, uquad, int);
+extern uquad _bfd_vms_pop (bfd *, int *);
+extern bfd_boolean _bfd_save_vms_section (bfd *, asection *, const void *, file_ptr, bfd_size_type);
+extern void _bfd_vms_output_begin (bfd *, int, int);
+extern void _bfd_vms_output_alignment (bfd *, int);
+extern void _bfd_vms_output_push (bfd *);
+extern void _bfd_vms_output_pop (bfd *);
+extern void _bfd_vms_output_flush (bfd *);
+extern void _bfd_vms_output_end (bfd *);
+extern int _bfd_vms_output_check (bfd *, int);
+extern void _bfd_vms_output_byte (bfd *, unsigned);
+extern void _bfd_vms_output_short (bfd *, unsigned);
+extern void _bfd_vms_output_long (bfd *, unsigned long);
+extern void _bfd_vms_output_quad (bfd *, uquad);
+extern void _bfd_vms_output_counted (bfd *, char *);
+extern void _bfd_vms_output_dump (bfd *, unsigned char *, int);
+extern void _bfd_vms_output_fill (bfd *, int, int);
+extern char * _bfd_vms_length_hash_symbol (bfd *, const char *, int);
+extern vms_symbol_entry * _bfd_vms_enter_symbol (bfd *, char *);
#endif /* VMS_H */