/* BFD back-end for PowerPC Microsoft Portable Executable files.
- Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ 2000, 2001
Free Software Foundation, Inc.
Original version pieced together by Kim Knuttila (krk@cygnus.com)
#define HASH_CHECK(addr) \
if (strcmp(addr->eye_catcher, EYE) != 0) \
{ \
- fprintf(stderr,\
+ fprintf (stderr,\
_("File %s, line %d, Hash check failure, bad eye %8s\n"), \
__FILE__, __LINE__, addr->eye_catcher); \
- abort(); \
+ abort (); \
}
#else
/* Now, tailor coffcode.h to use our hash stuff */
#define coff_bfd_link_hash_table_create ppc_coff_link_hash_table_create
-
\f
/* The nt loader points the toc register to &toc + 32768, in order to */
/* use the complete range of a 16-bit displacement. We have to adjust */
#define EXTRACT_FLAGS(x) ((x) & IMAGE_REL_PPC_FLAGMASK)
#define EXTRACT_JUNK(x) \
((x) & ~(IMAGE_REL_PPC_TYPEMASK | IMAGE_REL_PPC_FLAGMASK))
-
\f
/* static helper functions to make relocation work */
/* (Work In Progress) */
asection *section,
bfd *output_bfd,
char **error));
-
\f
static bfd_reloc_status_type ppc_toc16_reloc PARAMS ((bfd *abfd,
arelent *reloc,
char **error));
static boolean in_reloc_p PARAMS((bfd *abfd, reloc_howto_type *howto));
-
\f
/* FIXME: It'll take a while to get through all of these. I only need a few to
get us started, so those I'll make sure work. Those marked FIXME are either
false), /* pcrel_offset */
};
-
\f
-
/* Some really cheezy macros that can be turned on to test stderr :-) */
#ifdef DEBUG_RELOC
if (i == 0) \
{ \
i = 1; \
- fprintf(stderr,_("Unimplemented Relocation -- %s\n"),x); \
+ fprintf (stderr,_("Unimplemented Relocation -- %s\n"),x); \
} \
}
#define DUMP_RELOC(n,r) \
{ \
- fprintf(stderr,"%s sym %d, addr %d, addend %d\n", \
+ fprintf (stderr,"%s sym %d, addr %d, addend %d\n", \
n, (*(r->sym_ptr_ptr))->name, \
r->address, r->addend); \
}
#define DUMP_RELOC2(n,r) \
{ \
- fprintf(stderr,"%s sym %d, r_vaddr %d %s\n", \
+ fprintf (stderr,"%s sym %d, r_vaddr %d %s\n", \
n, r->r_symndx, r->r_vaddr,\
(((r->r_type) & IMAGE_REL_PPC_TOCDEFN) == 0) \
?" ":" TOCDEFN" ); \
#define DUMP_RELOC(n,r)
#define DUMP_RELOC2(n,r)
#endif
-
\f
/* toc construction and management routines */
/* allocate a table */
local_syms =
(int *) bfd_zalloc (abfd,
- obj_raw_syment_count(abfd) * sizeof(int));
+ obj_raw_syment_count(abfd) * sizeof (int));
if (local_syms == 0)
return false;
obj_coff_local_toc_table(abfd) = local_syms;
#endif /* COFF_IMAGE_WITH_PE */
\f
-
/* Return true if this relocation should
appear in the output .reloc section. */
if (r_type == IMAGE_REL_PPC_IMGLUE && h == 0)
{
/* An IMGLUE reloc must have a name. Something is very wrong. */
- abort();
+ abort ();
}
sec = NULL;
if ( toc_section == NULL )
{
/* There is no toc section. Something is very wrong. */
- abort();
+ abort ();
}
}
priv,
strdup(name));
- bfd_put_32(output_bfd,
+ bfd_put_32 (output_bfd,
val,
toc_section->contents + our_toc_offset);
record_toc(toc_section, our_toc_offset, pub, strdup(name));
/* write out the toc entry */
- bfd_put_32(output_bfd,
+ bfd_put_32 (output_bfd,
val,
toc_section->contents + our_toc_offset);
my_name = h->root.root.root.string;
if (h->symbol_is_glue == 1)
{
- x = bfd_get_32(input_bfd, loc);
- bfd_put_32(input_bfd, h->glue_insn, loc);
+ x = bfd_get_32 (input_bfd, loc);
+ bfd_put_32 (input_bfd, h->glue_insn, loc);
}
}
}
my_name = h->root.root.root.string;
}
- fprintf(stderr,
+ fprintf (stderr,
_("Warning: unsupported reloc %s <file %s, section %s>\n"),
howto->name,
bfd_get_filename(input_bfd),
input_section->name);
- fprintf(stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n",
+ fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n",
rel->r_symndx, my_name, (long) rel->r_vaddr,
(unsigned long) rel->r_vaddr);
}
if (myh == 0)
{
/* Missing magic cookies. Something is very wrong. */
- abort();
+ abort ();
}
val = myh->root.u.def.value +
FILE *file = (FILE *) vfile;
struct list_ele *t;
- fprintf(file, _(h1));
- fprintf(file, _(h2));
- fprintf(file, _(h3));
+ fprintf (file, _(h1));
+ fprintf (file, _(h2));
+ fprintf (file, _(h3));
- for(t = head; t != 0; t=t->next)
+ for (t = head; t != 0; t=t->next)
{
const char *cat = "";
cat = _("IAT reference ");
else
{
- fprintf(file,
+ fprintf (file,
_("**** global_toc_size %ld(%lx), thunk_size %ld(%lx)\n"),
global_toc_size, global_toc_size, thunk_size, thunk_size);
cat = _("Out of bounds!");
}
}
- fprintf(file,
+ fprintf (file,
" %04lx (%d)", (unsigned long) t->offset, t->offset - 32768);
- fprintf(file,
+ fprintf (file,
" %s %s\n",
cat, t->name);
}
- fprintf(file, "\n");
+ fprintf (file, "\n");
}
boolean
if (bfd_of_toc_owner == 0)
{
/* No toc owner? Something is very wrong. */
- abort();
+ abort ();
}
s = bfd_get_section_by_name ( bfd_of_toc_owner , TOC_SECTION_NAME);
if (s == NULL)
{
/* No toc section? Something is very wrong. */
- abort();
+ abort ();
}
foo = (bfd_byte *) bfd_alloc(bfd_of_toc_owner, global_toc_size);
i=_bfd_coff_read_internal_relocs(abfd,sec,1,0,0,0);
if (i == 0)
- abort();
+ abort ();
for (rel=i;rel<i+sec->reloc_count;++rel)
{
return bfd_reloc_undefined;
}
-
\f
static bfd_reloc_status_type
ppc_toc16_reloc (abfd,
return bfd_reloc_ok;
}
-
\f
-
#define MAX_RELOC_INDEX \
- (sizeof(ppc_coff_howto_table) / sizeof(ppc_coff_howto_table[0]) - 1)
+ (sizeof (ppc_coff_howto_table) / sizeof (ppc_coff_howto_table[0]) - 1)
/* FIXME: There is a possiblity that when we read in a reloc from a file,
that there are some bits encoded in the upper portion of the
/* the masking process only slices off the bottom byte for r_type. */
if ( r_type > MAX_RELOC_INDEX )
- abort();
+ abort ();
/* check for absolute crap */
if ( junk != 0 )
- abort();
+ abort ();
switch(r_type)
{
howto = ppc_coff_howto_table + IMAGE_REL_PPC_TOCREL16;
break;
default:
- fprintf(stderr,
+ fprintf (stderr,
_("Warning: Unsupported reloc %s [%d] used -- it may not work.\n"),
ppc_coff_howto_table[r_type].name,
r_type);
/* the masking process only slices off the bottom byte for r_type. */
if ( r_type > MAX_RELOC_INDEX )
- abort();
+ abort ();
/* check for absolute crap */
if ( junk != 0 )
- abort();
+ abort ();
switch(r_type)
{
howto = ppc_coff_howto_table + r_type;
break;
default:
- fprintf(stderr,
+ fprintf (stderr,
_("Warning: Unsupported reloc %s [%d] used -- it may not work.\n"),
ppc_coff_howto_table[r_type].name,
r_type);
}
#undef HOW2MAP
-
\f
/* Tailor coffcode.h -- macro heaven. */
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 1 }
#include "coffcode.h"
-
\f
-
#ifndef COFF_IMAGE_WITH_PE
/* FIXME:
What we're trying to do here is allocate a toc section (early), and attach
|| !bfd_set_section_alignment (abfd, s, 2))
{
/* FIXME: set appropriate bfd error */
- abort();
+ abort ();
}
/* save the bfd for later allocation */
}
#endif
\f
-
/* Forward declaration for use by alternative_target field. */
#ifdef TARGET_BIG_SYM
extern const bfd_target TARGET_BIG_SYM;