aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2001-08-14 10:01:29 +0000
committerNick Clifton <nickc@redhat.com>2001-08-14 10:01:29 +0000
commit1725a96ea642a50fd931aae33a31e65b38c27f99 (patch)
tree06d0afb3d2446cc7fdaf00fcd23dea3bf0911769
parentcde43e70f18662e9b770637f767e9e8bc6f0c746 (diff)
downloadgdb-1725a96ea642a50fd931aae33a31e65b38c27f99.zip
gdb-1725a96ea642a50fd931aae33a31e65b38c27f99.tar.gz
gdb-1725a96ea642a50fd931aae33a31e65b38c27f99.tar.bz2
Add missing protypes
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/aout-adobe.c166
-rw-r--r--bfd/aout-arm.c285
-rw-r--r--bfd/aout-ns32k.c212
-rw-r--r--bfd/aout-tic30.c84
-rw-r--r--bfd/aoutx.h3
-rw-r--r--bfd/peXXigen.c249
7 files changed, 505 insertions, 502 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f647629..35de93c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,7 +1,15 @@
+2001-08-14 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * aout-tic30.c: Add missing prototypes. Fix formatting.
+ * aout-ns32k.c: Add missing prototypes. Fix formatting.
+ * peXXigen.c: Add missining prototypes. Fix formatting.
+ * aout-adobe.c: Add missining prototypes. Fix formatting.
+
2001-08-13 Nick Clifton <nickc@cambridge.redhat.com>
* elf32-v850.c: Add missing function prototypes.
Fix some formatting.
+
* cpu-v850.c: Add missing function prototype.
Fix some formatting.
diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c
index e7c9fc9..b31640a 100644
--- a/bfd/aout-adobe.c
+++ b/bfd/aout-adobe.c
@@ -1,5 +1,5 @@
/* BFD back-end for a.out.adobe binaries.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Written by Cygnus Support. Based on bout.c.
@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "aout/adobe.h"
#include "aout/stab_gnu.h"
-#include "libaout.h" /* BFD a.out internal data structures */
+#include "libaout.h" /* BFD a.out internal data structures. */
/* Forward decl. */
extern const bfd_target a_out_adobe_vec;
@@ -35,7 +35,13 @@ static const bfd_target *aout_adobe_callback PARAMS ((bfd *));
extern boolean aout_32_slurp_symbol_table PARAMS ((bfd *abfd));
extern boolean aout_32_write_syms PARAMS ((bfd *));
-static void aout_adobe_write_section PARAMS ((bfd *abfd, sec_ptr sect));
+static void aout_adobe_write_section PARAMS ((bfd *abfd, sec_ptr sect));
+static const bfd_target * aout_adobe_object_p PARAMS ((bfd *));
+static boolean aout_adobe_mkobject PARAMS ((bfd *));
+static boolean aout_adobe_write_object_contents PARAMS ((bfd *));
+static boolean aout_adobe_set_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
+static boolean aout_adobe_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long));
+static int aout_adobe_sizeof_headers PARAMS ((bfd *, boolean));
/* Swaps the information in an executable header taken from a raw byte
stream memory image, into the internal exec_header structure. */
@@ -142,7 +148,7 @@ aout_adobe_callback (abfd)
asection *sect;
struct external_segdesc ext[1];
char *section_name;
- char try_again[30]; /* name and number */
+ char try_again[30]; /* Name and number. */
char *newname;
int trynum;
flagword flags;
@@ -155,13 +161,13 @@ aout_adobe_callback (abfd)
obj_sym_filepos (abfd) = N_SYMOFF (*execp);
/* Suck up the section information from the file, one section at a time. */
-
for (;;)
{
if (bfd_read ((PTR) ext, 1, sizeof (*ext), abfd) != sizeof (*ext))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
+
return 0;
}
switch (ext->e_type[0])
@@ -193,10 +199,10 @@ aout_adobe_callback (abfd)
/* First one is called ".text" or whatever; subsequent ones are
".text1", ".text2", ... */
-
bfd_set_error (bfd_error_no_error);
sect = bfd_make_section (abfd, section_name);
trynum = 0;
+
while (!sect)
{
if (bfd_get_error () != bfd_error_no_error)
@@ -240,6 +246,9 @@ aout_adobe_callback (abfd)
sect->rel_filepos = N_DRELOFF (*execp);
sect->reloc_count = execp->a_drsize;
break;
+
+ default:
+ break;
}
}
no_more_sections:
@@ -253,10 +262,11 @@ aout_adobe_callback (abfd)
return abfd->xvec;
}
-struct bout_data_struct {
- struct aoutdata a;
- struct internal_exec e;
-};
+struct bout_data_struct
+ {
+ struct aoutdata a;
+ struct internal_exec e;
+ };
static boolean
aout_adobe_mkobject (abfd)
@@ -333,26 +343,16 @@ aout_adobe_write_object_contents (abfd)
afterward. */
for (sect = abfd->sections; sect; sect = sect->next)
- {
- if (sect->flags & SEC_CODE)
- {
- aout_adobe_write_section (abfd, sect);
- }
- }
+ if (sect->flags & SEC_CODE)
+ aout_adobe_write_section (abfd, sect);
+
for (sect = abfd->sections; sect; sect = sect->next)
- {
- if (sect->flags & SEC_DATA)
- {
- aout_adobe_write_section (abfd, sect);
- }
- }
+ if (sect->flags & SEC_DATA)
+ aout_adobe_write_section (abfd, sect);
+
for (sect = abfd->sections; sect; sect = sect->next)
- {
- if (!(sect->flags & (SEC_CODE | SEC_DATA)))
- {
- aout_adobe_write_section (abfd, sect);
- }
- }
+ if (!(sect->flags & (SEC_CODE | SEC_DATA)))
+ aout_adobe_write_section (abfd, sect);
/* Write final `sentinel` section header (with type of 0). */
if (bfd_write ((PTR) sentinel, 1, sizeof (*sentinel), abfd)
@@ -374,27 +374,20 @@ aout_adobe_write_object_contents (abfd)
return false;
for (sect = abfd->sections; sect; sect = sect->next)
- {
- if (sect->flags & SEC_CODE)
- {
- if (!aout_32_squirt_out_relocs (abfd, sect))
- return false;
- }
- }
+ if (sect->flags & SEC_CODE)
+ if (!aout_32_squirt_out_relocs (abfd, sect))
+ return false;
if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*exec_hdr (abfd))), SEEK_SET)
!= 0)
return false;
for (sect = abfd->sections; sect; sect = sect->next)
- {
- if (sect->flags & SEC_DATA)
- {
- if (!aout_32_squirt_out_relocs (abfd, sect))
- return false;
- }
- }
+ if (sect->flags & SEC_DATA)
+ if (!aout_32_squirt_out_relocs (abfd, sect))
+ return false;
}
+
return true;
}
@@ -422,7 +415,6 @@ aout_adobe_set_section_contents (abfd, section, location, offset, count)
{
/* Assign file offsets to sections. Text sections are first, and
are contiguous. Then data sections. Everything else at the end. */
-
section_start = N_TXTOFF (ignore<-->me);
for (sect = abfd->sections; sect; sect = sect->next)
@@ -463,9 +455,8 @@ aout_adobe_set_section_contents (abfd, section, location, offset, count)
return false;
if (count != 0)
- {
- return (bfd_write ((PTR) location, 1, count, abfd) == count) ? true : false;
- }
+ return (bfd_write ((PTR) location, 1, count, abfd) == count) ? true : false;
+
return true;
}
@@ -520,44 +511,45 @@ aout_adobe_sizeof_headers (ignore_abfd, ignore)
#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
-};
+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
+ };
diff --git a/bfd/aout-arm.c b/bfd/aout-arm.c
index ddb0325..cec21ff 100644
--- a/bfd/aout-arm.c
+++ b/bfd/aout-arm.c
@@ -1,5 +1,5 @@
/* BFD back-end for raw ARM a.out binaries.
- Copyright 1994, 1995, 1997, 1998, 1999, 2000
+ Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
@@ -19,6 +19,15 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+#include "bfd.h"
+#include "sysdep.h"
+/* Avoid multiple defininitions from aoutx if supporting standarad a.out
+ as well as our own. */
+#define NAME(x,y) CAT3(aoutarm,_32_,y)
+
+#include "libaout.h"
+#include "aout/aout64.h"
+
#define N_TXTADDR(x) \
((N_MAGIC(x) == NMAGIC) ? 0x8000 : \
(N_MAGIC(x) != ZMAGIC) ? 0 : \
@@ -36,63 +45,45 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
((x).a_info != NMAGIC))
#define N_MAGIC(x) ((x).a_info & ~07200)
-#include "bfd.h"
-#include "sysdep.h"
-
-#define MYARM(OP) CAT(aoutarm_,OP)
-reloc_howto_type *MYARM(bfd_reloc_type_lookup)
- PARAMS((bfd *, bfd_reloc_code_real_type));
-static boolean MYARM(write_object_contents) PARAMS((bfd *));
-
-/* Avoid multiple defininitions from aoutx if supporting standarad a.out
- as well as our own. */
-#define NAME(x,y) CAT3(aoutarm,_32_,y)
-
#define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup
-#include "libaout.h"
-#include "aout/aout64.h"
-
-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));
-void MY(swap_std_reloc_out) PARAMS ((bfd *, arelent *,
- struct reloc_std_external *));
-
+static 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, long, 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)
-};
+ {
+ /* 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)
@@ -157,14 +148,16 @@ MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc)
int r_neg;
PUT_WORD (abfd, value, reloc->r_address);
- r_length = howto->size ; /* Size as a power of two */
+ /* Size as a power of two. */
+ r_length = howto->size;
/* Special case for branch relocations. */
if (howto->type == 3 || howto->type == 7)
r_length = 3;
- r_pcrel = howto->type & 4; /* PC Relative done? */
- r_neg = howto->type & 8; /* Negative relocation */
+ r_pcrel = howto->type & 4; /* PC Relative done? */
+ r_neg = howto->type & 8; /* Negative relocation. */
+
if (bfd_header_big_endian (abfd))
{
reloc->r_index[0] = r_index >> 16;
@@ -258,7 +251,7 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
long target = bfd_get_32 (abfd, (bfd_byte *) data + addr);
bfd_reloc_status_type flag = bfd_reloc_ok;
- /* If this is an undefined symbol, return error */
+ /* If this is an undefined symbol, return error. */
if (symbol->section == &bfd_und_section
&& (symbol->flags & BSF_WEAK) == 0)
return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined;
@@ -270,7 +263,7 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
return bfd_reloc_ok;
relocation = (target & 0x00ffffff) << 2;
- relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend */
+ relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend. */
relocation += symbol->value;
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
@@ -281,7 +274,7 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
if (relocation & 3)
return bfd_reloc_overflow;
- /* Check for overflow */
+ /* Check for overflow. */
if (relocation & 0x02000000)
{
if ((relocation & ~ (bfd_vma) 0x03ffffff) != ~ (bfd_vma) 0x03ffffff)
@@ -313,7 +306,8 @@ MY(bfd_reloc_type_lookup) (abfd,code)
case 32:
code = BFD_RELOC_32;
break;
- default: return (CONST struct reloc_howto_struct *) 0;
+ default:
+ return (CONST struct reloc_howto_struct *) 0;
}
switch (code)
@@ -324,7 +318,8 @@ MY(bfd_reloc_type_lookup) (abfd,code)
ASTD (BFD_RELOC_8_PCREL, 4);
ASTD (BFD_RELOC_16_PCREL, 5);
ASTD (BFD_RELOC_32_PCREL, 6);
- default: return (CONST struct reloc_howto_struct *) 0;
+ default:
+ return (CONST struct reloc_howto_struct *) 0;
}
}
@@ -419,25 +414,25 @@ MY_swap_std_reloc_out (abfd, g, natptr)
if (bfd_abs_section.symbol == sym)
{
/* Whoops, looked like an abs symbol, but is really an offset
- from the abs section */
+ from the abs section. */
r_index = 0;
r_extern = 0;
}
else
{
- /* Fill in symbol */
+ /* Fill in symbol. */
r_extern = 1;
r_index = (*(g->sym_ptr_ptr))->KEEPIT;
}
}
else
{
- /* Just an ordinary section */
+ /* Just an ordinary section. */
r_extern = 0;
r_index = output_section->target_index;
}
- /* now the fun stuff */
+ /* Now the fun stuff. */
if (bfd_header_big_endian (abfd))
{
natptr->r_index[0] = r_index >> 16;
@@ -469,83 +464,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, /* 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,
+ };
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, /* 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,
+ };
diff --git a/bfd/aout-ns32k.c b/bfd/aout-ns32k.c
index dc651cc..e431339 100644
--- a/bfd/aout-ns32k.c
+++ b/bfd/aout-ns32k.c
@@ -1,5 +1,5 @@
/* BFD back-end for ns32k a.out-ish binaries.
- Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1998, 2000
+ Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1998, 2000, 2001
Free Software Foundation, Inc.
Contributed by Ian Dall (idall@eleceng.adelaide.edu.au).
@@ -35,9 +35,8 @@ boolean
MYNS(write_object_contents)
PARAMS((bfd *abfd));
-/* Avoid multiple definitions from aoutx if supporting standard a.out format(s)
- * as well as this one
- */
+/* Avoid multiple definitions from aoutx if supporting
+ standard a.out format(s) as well as this one. */
#define NAME(x,y) CAT3(ns32kaout,_32_,y)
void bfd_ns32k_arch PARAMS ((void));
@@ -53,99 +52,102 @@ static void
MY_swap_std_reloc_in PARAMS ((bfd *abfd, struct reloc_std_external *bytes,
arelent *cache_ptr, asymbol **symbols,
bfd_size_type symcount));
-
static void
MY_swap_std_reloc_out PARAMS ((bfd *abfd, arelent *g,
struct reloc_std_external *natptr));
+reloc_howto_type *
+MY(reloc_howto) PARAMS ((bfd *, struct reloc_std_external *,
+ int *, int *, int *));
+void
+MY(put_reloc) PARAMS ((bfd *, int, int, long, reloc_howto_type *,
+ struct reloc_std_external *));
/* The ns32k series is ah, unusual, when it comes to relocation.
- * There are three storage methods for relocateable objects. There
- * are displacements, immediate operands and ordinary twos complement
- * data. Of these, only the last fits into the standard relocation
- * scheme. Immediate operands are stored huffman encoded and
- * immediate operands are stored big endian (where as the natural byte
- * order is little endian for this achitecture).
-
- * Note that the ns32k displacement storage method is orthogonal to
- * whether the relocation is pc relative or not. The "displacement"
- * storage scheme is used for essentially all address constants. The
- * displacement can be relative to zero (absolute displacement),
- * relative to the pc (pc relative), the stack pointer, the frame
- * pointer, the static base register and general purpose register etc.
-
- * For example:
- *
- * sym1: .long . # pc relative 2's complement
- * sym1: .long foo # 2's complement not pc relative
- *
- * self: movd @self, r0 # pc relative displacement
- * movd foo, r0 # non pc relative displacement
- *
- * self: movd self, r0 # pc relative immediate
- * movd foo, r0 # non pc relative immediate
- *
- * In addition, for historical reasons the encoding of the relocation types
- * in the a.out format relocation entries is such that even the relocation
- * methods which are standard are not encoded the standard way.
- *
- */
+ There are three storage methods for relocateable objects. There
+ are displacements, immediate operands and ordinary twos complement
+ data. Of these, only the last fits into the standard relocation
+ scheme. Immediate operands are stored huffman encoded and
+ immediate operands are stored big endian (where as the natural byte
+ order is little endian for this achitecture).
+
+ Note that the ns32k displacement storage method is orthogonal to
+ whether the relocation is pc relative or not. The "displacement"
+ storage scheme is used for essentially all address constants. The
+ displacement can be relative to zero (absolute displacement),
+ relative to the pc (pc relative), the stack pointer, the frame
+ pointer, the static base register and general purpose register etc.
+
+ For example:
+
+ sym1: .long . # pc relative 2's complement
+ sym1: .long foo # 2's complement not pc relative
+
+ self: movd @self, r0 # pc relative displacement
+ movd foo, r0 # non pc relative displacement
+
+ self: movd self, r0 # pc relative immediate
+ movd foo, r0 # non pc relative immediate
+
+ In addition, for historical reasons the encoding of the relocation types
+ 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)[] =
-{
- /* ns32k immediate operands */
- HOWTO (BFD_RELOC_NS32K_IMM_8, 0, 0, 8, false, 0, true,
- _bfd_ns32k_reloc_imm, "NS32K_IMM_8",
- true, 0x000000ff,0x000000ff, false),
- HOWTO (BFD_RELOC_NS32K_IMM_16, 0, 1, 16, false, 0, true,
- _bfd_ns32k_reloc_imm, "NS32K_IMM_16",
- true, 0x0000ffff,0x0000ffff, false),
- HOWTO (BFD_RELOC_NS32K_IMM_32, 0, 2, 32, false, 0, true,
- _bfd_ns32k_reloc_imm, "NS32K_IMM_32",
- true, 0xffffffff,0xffffffff, false),
- HOWTO (BFD_RELOC_NS32K_IMM_8_PCREL, 0, 0, 8, true, 0, false,
- _bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_8",
- true, 0x000000ff, 0x000000ff, false),
- HOWTO (BFD_RELOC_NS32K_IMM_16_PCREL, 0, 1, 16, true, 0, false,
- _bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_16",
- true, 0x0000ffff,0x0000ffff, false),
- HOWTO (BFD_RELOC_NS32K_IMM_32_PCREL, 0, 2, 32, true, 0, false,
- _bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_32",
- true, 0xffffffff,0xffffffff, false),
-
- /* ns32k displacements */
- HOWTO (BFD_RELOC_NS32K_DISP_8, 0, 0, 8, false, 0, true,
- _bfd_ns32k_reloc_disp, "NS32K_DISP_8",
- true, 0x000000ff,0x000000ff, false),
- HOWTO (BFD_RELOC_NS32K_DISP_16, 0, 1, 16, false, 0, true,
- _bfd_ns32k_reloc_disp, "NS32K_DISP_16",
- true, 0x0000ffff, 0x0000ffff, false),
- HOWTO (BFD_RELOC_NS32K_DISP_32, 0, 2, 32, false, 0, true,
- _bfd_ns32k_reloc_disp, "NS32K_DISP_32",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO (BFD_RELOC_NS32K_DISP_8_PCREL, 0, 0, 8, true, 0, false,
- _bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_8",
- true, 0x000000ff,0x000000ff, false),
- HOWTO (BFD_RELOC_NS32K_DISP_16_PCREL, 0, 1, 16, true, 0, false,
- _bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_16",
- true, 0x0000ffff,0x0000ffff, false),
- HOWTO (BFD_RELOC_NS32K_DISP_32_PCREL, 0, 2, 32, true, 0, false,
- _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),
-};
+ {
+ /* ns32k immediate operands. */
+ HOWTO (BFD_RELOC_NS32K_IMM_8, 0, 0, 8, false, 0, true,
+ _bfd_ns32k_reloc_imm, "NS32K_IMM_8",
+ true, 0x000000ff,0x000000ff, false),
+ HOWTO (BFD_RELOC_NS32K_IMM_16, 0, 1, 16, false, 0, true,
+ _bfd_ns32k_reloc_imm, "NS32K_IMM_16",
+ true, 0x0000ffff,0x0000ffff, false),
+ HOWTO (BFD_RELOC_NS32K_IMM_32, 0, 2, 32, false, 0, true,
+ _bfd_ns32k_reloc_imm, "NS32K_IMM_32",
+ true, 0xffffffff,0xffffffff, false),
+ HOWTO (BFD_RELOC_NS32K_IMM_8_PCREL, 0, 0, 8, true, 0, false,
+ _bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_8",
+ true, 0x000000ff, 0x000000ff, false),
+ HOWTO (BFD_RELOC_NS32K_IMM_16_PCREL, 0, 1, 16, true, 0, false,
+ _bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_16",
+ true, 0x0000ffff,0x0000ffff, false),
+ HOWTO (BFD_RELOC_NS32K_IMM_32_PCREL, 0, 2, 32, true, 0, false,
+ _bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_32",
+ true, 0xffffffff,0xffffffff, false),
+
+ /* ns32k displacements. */
+ HOWTO (BFD_RELOC_NS32K_DISP_8, 0, 0, 8, false, 0, true,
+ _bfd_ns32k_reloc_disp, "NS32K_DISP_8",
+ true, 0x000000ff,0x000000ff, false),
+ HOWTO (BFD_RELOC_NS32K_DISP_16, 0, 1, 16, false, 0, true,
+ _bfd_ns32k_reloc_disp, "NS32K_DISP_16",
+ true, 0x0000ffff, 0x0000ffff, false),
+ HOWTO (BFD_RELOC_NS32K_DISP_32, 0, 2, 32, false, 0, true,
+ _bfd_ns32k_reloc_disp, "NS32K_DISP_32",
+ true, 0xffffffff, 0xffffffff, false),
+ HOWTO (BFD_RELOC_NS32K_DISP_8_PCREL, 0, 0, 8, true, 0, false,
+ _bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_8",
+ true, 0x000000ff,0x000000ff, false),
+ HOWTO (BFD_RELOC_NS32K_DISP_16_PCREL, 0, 1, 16, true, 0, false,
+ _bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_16",
+ true, 0x0000ffff,0x0000ffff, false),
+ HOWTO (BFD_RELOC_NS32K_DISP_32_PCREL, 0, 2, 32, true, 0, false,
+ _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)
@@ -164,7 +166,8 @@ MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel)
{
unsigned int r_length;
int r_ns32k_type;
-/* BFD_ASSERT(bfd_header_little_endian (abfd)); */
+
+ /* BFD_ASSERT(bfd_header_little_endian (abfd)); */
*r_index = ((rel->r_index[2] << 16)
| (rel->r_index[1] << 8)
| rel->r_index[0] );
@@ -191,11 +194,13 @@ MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc)
unsigned int r_length;
int r_pcrel;
int r_ns32k_type;
+
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_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;
-/* BFD_ASSERT (bfd_header_little_endian (abfd)); */
+
+ /* 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;
@@ -233,6 +238,8 @@ MY(bfd_reloc_type_lookup) (abfd,code)
case 32:
code = BFD_RELOC_32;
break;
+ default:
+ break;
}
switch (code)
{
@@ -254,7 +261,8 @@ MY(bfd_reloc_type_lookup) (abfd,code)
ENTRY(BFD_RELOC_8_PCREL, 15);
ENTRY(BFD_RELOC_16_PCREL, 16);
ENTRY(BFD_RELOC_32_PCREL, 17);
- default: return (reloc_howto_type *) NULL;
+ default:
+ return (reloc_howto_type *) NULL;
}
#undef ENTRY
}
@@ -274,11 +282,10 @@ MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address);
- /* now the fun stuff */
-
+ /* Now the fun stuff. */
cache_ptr->howto = MY_reloc_howto(abfd, bytes, r_index, r_extern, r_pcrel);
- MOVE_ADDRESS(0);
+ MOVE_ADDRESS (0);
}
static void
@@ -295,7 +302,7 @@ MY_swap_std_reloc_out (abfd, g, natptr)
r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma;
- /* 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.
@@ -303,7 +310,6 @@ MY_swap_std_reloc_out (abfd, g, natptr)
Absolute symbols can come in in two ways, either as an offset
from the abs section, or as a symbol which has an abs value.
Check for that here. */
-
if (bfd_is_com_section (output_section)
|| output_section == &bfd_abs_section
|| output_section == &bfd_und_section)
@@ -311,13 +317,13 @@ MY_swap_std_reloc_out (abfd, g, natptr)
if (bfd_abs_section.symbol == sym)
{
/* Whoops, looked like an abs symbol, but is really an offset
- from the abs section */
+ from the abs section. */
r_index = 0;
r_extern = 0;
}
else
{
- /* Fill in symbol */
+ /* Fill in symbol. */
r_extern = 1;
#undef KEEPIT
#define KEEPIT udata.i
@@ -327,7 +333,7 @@ MY_swap_std_reloc_out (abfd, g, natptr)
}
else
{
- /* Just an ordinary section */
+ /* Just an ordinary section. */
r_extern = 0;
r_index = output_section->target_index;
}
diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c
index d02cf0d..5d25c20 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 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
This file is part of BFD, the Binary File Descriptor library.
@@ -56,6 +56,12 @@ static bfd_reloc_status_type tic30_aout_final_link_relocate
static const bfd_target *tic30_aout_object_p PARAMS ((bfd *));
static boolean tic30_aout_write_object_contents PARAMS ((bfd *));
static boolean tic30_aout_set_sizes PARAMS ((bfd *));
+static const bfd_target * tic30_aout_callback PARAMS ((bfd *));
+static boolean MY_bfd_copy_private_section_data PARAMS ((bfd *, asection *, bfd *, asection *));
+static 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, boolean *));
+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
@@ -130,26 +136,27 @@ static CONST struct aout_backend_data tic30_aout_backend_data =
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) ();
+ {
+ 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)
@@ -317,10 +324,10 @@ tic30_aout_callback (abfd)
unsigned int arch_align_power;
unsigned long arch_align;
- /* Calculate the file positions of the parts of a newly read aout header */
+ /* Calculate the file positions of the parts of a newly read aout header. */
obj_textsec (abfd)->_raw_size = N_TXTSIZE (*execp);
- /* The virtual memory addresses of the sections */
+ /* The virtual memory addresses of the sections. */
obj_textsec (abfd)->vma = N_TXTADDR (*execp);
obj_datasec (abfd)->vma = N_DATADDR (*execp);
obj_bsssec (abfd)->vma = N_BSSADDR (*execp);
@@ -329,11 +336,11 @@ tic30_aout_callback (abfd)
obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
- /* The file offsets of the sections */
+ /* The file offsets of the sections. */
obj_textsec (abfd)->filepos = N_TXTOFF (*execp);
obj_datasec (abfd)->filepos = N_DATOFF (*execp);
- /* The file offsets of the relocation info */
+ /* The file offsets of the relocation info. */
obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp);
obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp);
@@ -429,7 +436,9 @@ tic30_aout_relocate_contents (howto, input_bfd, relocation, location)
x = bfd_get_32 (input_bfd, location);
break;
}
+
overflow = false;
+
if (howto->complain_on_overflow != complain_overflow_dont)
{
bfd_vma check;
@@ -520,14 +529,14 @@ tic30_aout_relocate_contents (howto, input_bfd, relocation, location)
return overflow ? bfd_reloc_overflow : bfd_reloc_ok;
}
-/* Finish up the reading of an a.out file header */
+/* Finish up the reading of an a.out file header. */
static const bfd_target *
tic30_aout_object_p (abfd)
bfd *abfd;
{
- struct external_exec exec_bytes; /* Raw exec header from file */
- struct internal_exec exec; /* Cleaned-up exec header */
+ struct external_exec exec_bytes; /* Raw exec header from file. */
+ struct internal_exec exec; /* Cleaned-up exec header. */
const bfd_target *target;
if (bfd_read ((PTR) & exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
@@ -562,10 +571,10 @@ tic30_aout_object_p (abfd)
#ifdef ENTRY_CAN_BE_ZERO
/* The NEWSOS3 entry-point is/was 0, which (amongst other lossage)
- * means that it isn't obvious if EXEC_P should be set.
- * All of the following must be true for an executable:
- * There must be no relocations, the bfd can be neither an
- * archive nor an archive element, and the file must be executable. */
+ means that it isn't obvious if EXEC_P should be set.
+ All of the following must be true for an executable:
+ There must be no relocations, the bfd can be neither an
+ archive nor an archive element, and the file must be executable. */
if (exec.a_trsize + exec.a_drsize == 0
&& bfd_get_format (abfd) == bfd_object && abfd->my_archive == NULL)
@@ -614,8 +623,9 @@ tic30_aout_write_object_contents (abfd)
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
{
- bfd_size_type text_size; /* dummy vars */
+ 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);
@@ -633,8 +643,8 @@ tic30_aout_write_object_contents (abfd)
if (bfd_write ((PTR) & exec_bytes, 1, adata (abfd).exec_bytes_size, abfd) != adata (abfd).exec_bytes_size)
return false;
}
- /* Now write out reloc info, followed by syms and strings */
+ /* Now write out reloc info, followed by syms and strings. */
if (bfd_get_outsymbols (abfd) != (asymbol **) NULL
&& bfd_get_symcount (abfd) != 0)
{
@@ -745,10 +755,10 @@ MY_bfd_final_link (abfd, info)
{
obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4);
}
+
if (obj_datasec (abfd)->vma < vma)
- {
- obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4);
- }
+ obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4);
+
obj_datasec (abfd)->user_set_vma = 1;
vma = obj_datasec (abfd)->vma;
obj_datasec (abfd)->filepos = vma + adata (abfd).exec_bytes_size;
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 6119564..e9c1d2f 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -139,6 +139,7 @@ static boolean translate_to_native_sym_flags
static void adjust_o_magic PARAMS ((bfd *, struct internal_exec *));
static void adjust_z_magic PARAMS ((bfd *, struct internal_exec *));
static void adjust_n_magic PARAMS ((bfd *, struct internal_exec *));
+reloc_howto_type * NAME(aout,reloc_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type));
/*
SUBSECTION
@@ -2553,7 +2554,7 @@ NAME(aout,get_symtab_upper_bound) (abfd)
return (bfd_get_symcount (abfd)+1) * (sizeof (aout_symbol_type *));
}
- alent *
+alent *
NAME(aout,get_lineno) (ignore_abfd, ignore_symbol)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
asymbol *ignore_symbol ATTRIBUTE_UNUSED;
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 0e1eaea..957a934 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -95,8 +95,9 @@ static void add_data_entry
PARAMS ((bfd *, struct internal_extra_pe_aouthdr *, int, char *, bfd_vma));
static boolean pe_print_pdata PARAMS ((bfd *, PTR));
static boolean pe_print_reloc PARAMS ((bfd *, PTR));
-
-/**********************************************************************/
+static boolean pe_print_idata PARAMS ((bfd *, PTR));
+static boolean pe_print_edata PARAMS ((bfd *, PTR));
+
void
_bfd_XXi_swap_sym_in (abfd, ext1, in1)
@@ -114,20 +115,16 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1)
bfd_h_get_32 (abfd, (bfd_byte *) ext->e.e.e_offset);
}
else
- {
- memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN);
- }
+ memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN);
in->n_value = bfd_h_get_32 (abfd, (bfd_byte *) ext->e_value);
in->n_scnum = bfd_h_get_16 (abfd, (bfd_byte *) ext->e_scnum);
+
if (sizeof (ext->e_type) == 2)
- {
- in->n_type = bfd_h_get_16 (abfd, (bfd_byte *) ext->e_type);
- }
+ in->n_type = bfd_h_get_16 (abfd, (bfd_byte *) ext->e_type);
else
- {
- in->n_type = bfd_h_get_32 (abfd, (bfd_byte *) ext->e_type);
- }
+ in->n_type = bfd_h_get_32 (abfd, (bfd_byte *) ext->e_type);
+
in->n_sclass = bfd_h_get_8 (abfd, ext->e_sclass);
in->n_numaux = bfd_h_get_8 (abfd, ext->e_numaux);
@@ -166,6 +163,7 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1)
if (in->n_scnum == 0)
{
asection *sec;
+
for (sec = abfd->sections; sec; sec = sec->next)
{
if (strcmp (sec->name, in->n_name) == 0)
@@ -175,11 +173,13 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1)
}
}
}
+
if (in->n_scnum == 0)
{
int unused_section_number = 0;
asection *sec;
char *name;
+
for (sec = abfd->sections; sec; sec = sec->next)
if (unused_section_number <= sec->target_index)
unused_section_number = sec->target_index + 1;
@@ -229,26 +229,23 @@ _bfd_XXi_swap_sym_out (abfd, inp, extp)
{
struct internal_syment *in = (struct internal_syment *) inp;
SYMENT *ext = (SYMENT *) extp;
+
if (in->_n._n_name[0] == 0)
{
bfd_h_put_32 (abfd, 0, (bfd_byte *) ext->e.e.e_zeroes);
bfd_h_put_32 (abfd, in->_n._n_n._n_offset, (bfd_byte *) ext->e.e.e_offset);
}
else
- {
- memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN);
- }
+ memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN);
bfd_h_put_32 (abfd, in->n_value, (bfd_byte *) ext->e_value);
bfd_h_put_16 (abfd, in->n_scnum, (bfd_byte *) ext->e_scnum);
+
if (sizeof (ext->e_type) == 2)
- {
- bfd_h_put_16 (abfd, in->n_type, (bfd_byte *) ext->e_type);
- }
+ bfd_h_put_16 (abfd, in->n_type, (bfd_byte *) ext->e_type);
else
- {
- bfd_h_put_32 (abfd, in->n_type, (bfd_byte *) ext->e_type);
- }
+ bfd_h_put_32 (abfd, in->n_type, (bfd_byte *) ext->e_type);
+
bfd_h_put_8 (abfd, in->n_sclass, ext->e_sclass);
bfd_h_put_8 (abfd, in->n_numaux, ext->e_numaux);
@@ -278,9 +275,7 @@ _bfd_XXi_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
bfd_h_get_32 (abfd, (bfd_byte *) ext->x_file.x_n.x_offset);
}
else
- {
- memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
- }
+ memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
return;
case C_STAT:
@@ -359,9 +354,8 @@ _bfd_XXi_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
(bfd_byte *) ext->x_file.x_n.x_offset);
}
else
- {
- memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
- }
+ memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
+
return AUXESZ;
case C_STAT:
@@ -499,6 +493,7 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
{
int idx;
+
for (idx = 0; idx < 16; idx++)
{
/* If data directory is empty, rva also should be 0. */
@@ -507,10 +502,8 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
a->DataDirectory[idx].Size = size;
if (size)
- {
- a->DataDirectory[idx].VirtualAddress =
- bfd_h_get_32 (abfd, (bfd_byte *) src->DataDirectory[idx][0]);
- }
+ a->DataDirectory[idx].VirtualAddress =
+ bfd_h_get_32 (abfd, (bfd_byte *) src->DataDirectory[idx][0]);
else
a->DataDirectory[idx].VirtualAddress = 0;
}
@@ -523,6 +516,7 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
aouthdr_int->entry &= 0xffffffff;
#endif
}
+
if (aouthdr_int->tsize)
{
aouthdr_int->text_start += a->ImageBase;
@@ -530,6 +524,7 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
aouthdr_int->text_start &= 0xffffffff;
#endif
}
+
#ifndef COFF_WITH_pep
/* PE32+ does not have data_start member! */
if (aouthdr_int->dsize)
@@ -547,7 +542,6 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
thunk_size = a->DataDirectory[12].Size;
import_table_size = a->DataDirectory[1].Size;
#endif
-
}
/* A support function for below. */
@@ -562,12 +556,12 @@ add_data_entry (abfd, aout, idx, name, base)
{
asection *sec = bfd_get_section_by_name (abfd, name);
- /* add import directory information if it exists */
+ /* Add import directory information if it exists. */
if ((sec != NULL)
&& (coff_section_data (abfd, sec) != NULL)
&& (pei_section_data (abfd, sec) != NULL))
{
- /* If data directory is empty, rva also should be 0 */
+ /* If data directory is empty, rva also should be 0. */
int size = pei_section_data (abfd, sec)->virt_size;
aout->DataDirectory[idx].Size = size;
@@ -614,6 +608,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
aouthdr_in->text_start &= 0xffffffff;
#endif
}
+
if (aouthdr_in->dsize)
{
aouthdr_in->data_start -= ib;
@@ -621,6 +616,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
aouthdr_in->data_start &= 0xffffffff;
#endif
}
+
if (aouthdr_in->entry)
{
aouthdr_in->entry -= ib;
@@ -758,6 +754,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
(bfd_byte *) aouthdr_out->NumberOfRvaAndSizes);
{
int idx;
+
for (idx = 0; idx < 16; idx++)
{
bfd_h_put_32 (abfd, extra->DataDirectory[idx].VirtualAddress,
@@ -842,9 +839,9 @@ _bfd_XXi_only_swap_filehdr_out (abfd, in, out)
bfd_h_put_16 (abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr);
bfd_h_put_16 (abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags);
- /* put in extra dos header stuff. This data remains essentially
+ /* Put in extra dos header stuff. This data remains essentially
constant, it just has to be tacked on to the beginning of all exes
- for NT */
+ for NT. */
bfd_h_put_16 (abfd, filehdr_in->pe.e_magic, (bfd_byte *) filehdr_out->e_magic);
bfd_h_put_16 (abfd, filehdr_in->pe.e_cblp, (bfd_byte *) filehdr_out->e_cblp);
bfd_h_put_16 (abfd, filehdr_in->pe.e_cp, (bfd_byte *) filehdr_out->e_cp);
@@ -862,29 +859,24 @@ _bfd_XXi_only_swap_filehdr_out (abfd, in, out)
bfd_h_put_16 (abfd, filehdr_in->pe.e_cs, (bfd_byte *) filehdr_out->e_cs);
bfd_h_put_16 (abfd, filehdr_in->pe.e_lfarlc, (bfd_byte *) filehdr_out->e_lfarlc);
bfd_h_put_16 (abfd, filehdr_in->pe.e_ovno, (bfd_byte *) filehdr_out->e_ovno);
- {
- int idx;
- for (idx = 0; idx < 4; idx++)
- bfd_h_put_16 (abfd, filehdr_in->pe.e_res[idx],
- (bfd_byte *) filehdr_out->e_res[idx]);
- }
+
+ for (idx = 0; idx < 4; idx++)
+ bfd_h_put_16 (abfd, filehdr_in->pe.e_res[idx],
+ (bfd_byte *) filehdr_out->e_res[idx]);
+
bfd_h_put_16 (abfd, filehdr_in->pe.e_oemid, (bfd_byte *) filehdr_out->e_oemid);
bfd_h_put_16 (abfd, filehdr_in->pe.e_oeminfo,
(bfd_byte *) filehdr_out->e_oeminfo);
- {
- int idx;
- for (idx = 0; idx < 10; idx++)
- bfd_h_put_16 (abfd, filehdr_in->pe.e_res2[idx],
- (bfd_byte *) filehdr_out->e_res2[idx]);
- }
+
+ for (idx = 0; idx < 10; idx++)
+ bfd_h_put_16 (abfd, filehdr_in->pe.e_res2[idx],
+ (bfd_byte *) filehdr_out->e_res2[idx]);
+
bfd_h_put_32 (abfd, filehdr_in->pe.e_lfanew, (bfd_byte *) filehdr_out->e_lfanew);
- {
- int idx;
- for (idx = 0; idx < 16; idx++)
- bfd_h_put_32 (abfd, filehdr_in->pe.dos_message[idx],
- (bfd_byte *) filehdr_out->dos_message[idx]);
- }
+ for (idx = 0; idx < 16; idx++)
+ bfd_h_put_32 (abfd, filehdr_in->pe.dos_message[idx],
+ (bfd_byte *) filehdr_out->dos_message[idx]);
/* Also put in the NT signature. */
bfd_h_put_32 (abfd, filehdr_in->pe.nt_signature,
@@ -937,7 +929,6 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
/* NT wants the size data to be rounded up to the next
NT_FILE_ALIGNMENT, but zero if it has no content (as in .bss,
sometimes). */
-
if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0)
{
ps = scnhdr_int->s_size;
@@ -978,6 +969,7 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
{
int flags = scnhdr_int->s_flags;
+
bfd_h_put_32 (abfd, flags, (bfd_byte *) scnhdr_ext->s_flags);
}
@@ -1013,12 +1005,13 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
bfd_h_put_16 (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno);
ret = 0;
}
+
if (scnhdr_int->s_nreloc <= 0xffff)
bfd_h_put_16 (abfd, scnhdr_int->s_nreloc,
(bfd_byte *) scnhdr_ext->s_nreloc);
else
{
- /* PE can deal with large #s of relocs, but not here */
+ /* PE can deal with large #s of relocs, but not here. */
bfd_h_put_16 (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc);
scnhdr_int->s_flags |= IMAGE_SCN_LNK_NRELOC_OVFL;
bfd_h_put_32 (abfd, scnhdr_int->s_flags,
@@ -1036,26 +1029,26 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
return ret;
}
-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")
-};
-
-/**********************************************************************/
+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")
+ };
+
#ifdef POWERPC_LE_PE
/* The code for the PPC really falls in the "architecture dependent"
category. However, it's not clear that anyone will ever care, so
@@ -1064,7 +1057,6 @@ static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] = {
PPC- specific code. */
#endif
-/**********************************************************************/
static boolean
pe_print_idata (abfd, vfile)
bfd *abfd;
@@ -1205,13 +1197,11 @@ pe_print_idata (abfd, vfile)
/* print (i + extra->DataDirectory[1].VirtualAddress) */
fprintf (file, " %08lx\t", (unsigned long) (i + adj + dataoff));
-
+#if 0
if (i + 20 > datasize)
- {
- /* Check stuff. */
- ;
- }
-
+ /* Check stuff. */
+ ;
+#endif
hint_addr = bfd_get_32 (abfd, data + i + dataoff);
time_stamp = bfd_get_32 (abfd, data + i + 4 + dataoff);
forward_chain = bfd_get_32 (abfd, data + i + 8 + dataoff);
@@ -1299,11 +1289,10 @@ pe_print_idata (abfd, vfile)
fprintf (file, _("\tvma: Hint/Ord Member-Name\n"));
differ = 1;
}
+
if (iat_member == 0)
- {
- fprintf (file,
- _("\t>>> Ran out of IAT members!\n"));
- }
+ fprintf (file,
+ _("\t>>> Ran out of IAT members!\n"));
else
{
ordinal = bfd_get_16 (abfd, data + iat_member - adj);
@@ -1318,15 +1307,13 @@ pe_print_idata (abfd, vfile)
if (hint_addr != 0 && hint_member == 0)
break;
}
+
if (differ == 0)
- {
- fprintf (file,
- _("\tThe Import Address Table is identical\n"));
- }
+ fprintf (file,
+ _("\tThe Import Address Table is identical\n"));
}
fprintf (file, "\n");
-
}
free (data);
@@ -1342,24 +1329,23 @@ pe_print_edata (abfd, vfile)
FILE *file = (FILE *) vfile;
bfd_byte *data;
asection *section;
-
bfd_size_type datasize = 0;
bfd_size_type dataoff;
bfd_size_type i;
-
bfd_signed_vma adj;
- struct EDT_type {
- long export_flags; /* reserved - should be zero */
+ struct EDT_type
+ {
+ 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);
@@ -1384,9 +1370,11 @@ pe_print_edata (abfd, vfile)
else
{
addr += extra->ImageBase;
+
for (section = abfd->sections; section != NULL; section = section->next)
{
datasize = bfd_section_size (abfd, section);
+
if (addr >= section->vma && addr < section->vma + datasize)
break;
}
@@ -1428,7 +1416,7 @@ pe_print_edata (abfd, vfile)
adj = section->vma - extra->ImageBase + dataoff;
- /* Dump the EDT first first */
+ /* Dump the EDT first. */
fprintf (file,
_("\nThe Export Tables (interpreted %s section contents)\n\n"),
section->name);
@@ -1482,7 +1470,8 @@ pe_print_edata (abfd, vfile)
/* The next table to find is the Export Address Table. It's basically
a list of pointers that either locate a function in this dll, or
forward the call to another dll. Something like:
- typedef union {
+ typedef union
+ {
long export_rva;
long forwarder_rva;
} export_address_table_entry;
@@ -1631,10 +1620,8 @@ pe_print_pdata (abfd, vfile)
if (begin_addr == 0 && end_addr == 0 && eh_handler == 0
&& eh_data == 0 && prolog_end_addr == 0)
- {
- /* We are probably into the padding of the section now. */
- break;
- }
+ /* We are probably into the padding of the section now. */
+ break;
em_data = ((eh_handler & 0x1) << 2) | (prolog_end_addr & 0x3);
eh_handler &= ~(bfd_vma) 0x3;
@@ -1687,21 +1674,22 @@ 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 */
-};
+static const char * const tbl[] =
+ {
+ "ABSOLUTE",
+ "HIGH",
+ "LOW",
+ "HIGHLOW",
+ "HIGHADJ",
+ "MIPS_JMPADDR",
+ "SECTION",
+ "REL32",
+ "RESERVED1",
+ "MIPS_JMPADDR16",
+ "DIR64",
+ "HIGH3ADJ"
+ "UNKNOWN", /* MUST be last */
+ };
static boolean
pe_print_reloc (abfd, vfile)
@@ -1745,16 +1733,13 @@ pe_print_reloc (abfd, vfile)
long number, size;
/* The .reloc section is a sequence of blocks, with a header consisting
- of two 32 bit quantities, followed by a number of 16 bit entries */
-
+ of two 32 bit quantities, followed by a number of 16 bit entries. */
virtual_address = bfd_get_32 (abfd, data+i);
size = bfd_get_32 (abfd, data+i+4);
number = (size - 8) / 2;
if (size == 0)
- {
- break;
- }
+ break;
fprintf (file,
_("\nVirtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"),
@@ -1785,6 +1770,7 @@ pe_print_reloc (abfd, vfile)
fprintf (file, "\n");
}
+
i += size;
}
@@ -1842,6 +1828,7 @@ _bfd_XX_print_private_bfd_data_common (abfd, vfile)
fprintf (file, "SizeOfImage\t\t%08lx\n", i->SizeOfImage);
fprintf (file, "SizeOfHeaders\t\t%08lx\n", i->SizeOfHeaders);
fprintf (file, "CheckSum\t\t%08lx\n", i->CheckSum);
+
switch (i->Subsystem)
{
case IMAGE_SUBSYSTEM_UNKNOWN:
@@ -1872,6 +1859,7 @@ _bfd_XX_print_private_bfd_data_common (abfd, vfile)
subsystem_name = "EFI runtime driver";
break;
}
+
fprintf (file, "Subsystem\t\t%08x", i->Subsystem);
if (subsystem_name)
fprintf (file, "\t(%s)", subsystem_name);
@@ -1919,7 +1907,7 @@ _bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd)
pe_data (obfd)->pe_opthdr = pe_data (ibfd)->pe_opthdr;
pe_data (obfd)->dll = pe_data (ibfd)->dll;
- /* for strip: if we removed .reloc, we'll make a real mess of things
+ /* For strip: if we removed .reloc, we'll make a real mess of things
if we don't remove this entry as well. */
if (! pe_data (obfd)->has_reloc_section)
{
@@ -1930,6 +1918,7 @@ _bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd)
}
/* Copy private section data. */
+
boolean
_bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
bfd *ibfd;
@@ -1951,6 +1940,7 @@ _bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
if (osec->used_by_bfd == NULL)
return false;
}
+
if (pei_section_data (obfd, osec) == NULL)
{
coff_section_data (obfd, osec)->tdata =
@@ -1958,6 +1948,7 @@ _bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
if (coff_section_data (obfd, osec)->tdata == NULL)
return false;
}
+
pei_section_data (obfd, osec)->virt_size =
pei_section_data (ibfd, isec)->virt_size;
pei_section_data (obfd, osec)->pe_flags =