gcc -Wall lint.
* coffdump.c (dump_coff_scope): Cast pointer to unsigned long for printf. * coffgrok.c: Include bucomm.h. Don't declare xmalloc. (push_scope): Declare type of parameter link. * size.c: Include libiberty.h. * srconv.c: Include bucomm.h. (find_base): Declare at top of file. (wr_hd): Add default case to architecture switch. (wr_dps_start): Declare type of parameter nest. (wr_du): Comment out variables used only in commented out blocks. (wr_dus): Remove unused variable i. (wr_sc): Remove unused variables myinfo, low, and high. * strings.c: Include libiberty.h. * sysdump.c: Include <ctype.h>.
This commit is contained in:
parent
96d1566d78
commit
958998b7aa
|
@ -1,3 +1,20 @@
|
|||
Wed Jan 18 12:24:14 1995 Ian Lance Taylor <ian@sanguine.cygnus.com>
|
||||
|
||||
* coffdump.c (dump_coff_scope): Cast pointer to unsigned long for
|
||||
printf.
|
||||
* coffgrok.c: Include bucomm.h. Don't declare xmalloc.
|
||||
(push_scope): Declare type of parameter link.
|
||||
* size.c: Include libiberty.h.
|
||||
* srconv.c: Include bucomm.h.
|
||||
(find_base): Declare at top of file.
|
||||
(wr_hd): Add default case to architecture switch.
|
||||
(wr_dps_start): Declare type of parameter nest.
|
||||
(wr_du): Comment out variables used only in commented out blocks.
|
||||
(wr_dus): Remove unused variable i.
|
||||
(wr_sc): Remove unused variables myinfo, low, and high.
|
||||
* strings.c: Include libiberty.h.
|
||||
* sysdump.c: Include <ctype.h>.
|
||||
|
||||
Tue Dec 20 19:13:44 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
|
||||
|
||||
* ar.c (main): Ignore 'f' modifier used on HP/UX 9.
|
||||
|
|
|
@ -0,0 +1,541 @@
|
|||
/* Coff file dumper.
|
||||
Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Binutils.
|
||||
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* Written by Steve Chamberlain <sac@cygnus.com>
|
||||
|
||||
This module reads a type tree generated by coffgrok and prints
|
||||
it out so we can test the grokker.
|
||||
*/
|
||||
|
||||
#include <bfd.h>
|
||||
#include <getopt.h>
|
||||
#include <stdio.h>
|
||||
#include <libiberty.h>
|
||||
#include "bucomm.h"
|
||||
|
||||
#include "coffgrok.h"
|
||||
|
||||
|
||||
#define PROGRAM_VERSION "1.0"
|
||||
|
||||
|
||||
char *xcalloc(a,b)
|
||||
int a;
|
||||
int b;
|
||||
{
|
||||
char *r = xmalloc(a*b);
|
||||
memset (r, 0, a * b);
|
||||
return r;
|
||||
}
|
||||
|
||||
static int atnl;
|
||||
static void dump_coff_scope ();
|
||||
|
||||
static void
|
||||
tab (x)
|
||||
int x;
|
||||
{
|
||||
static int indent;
|
||||
int i;
|
||||
|
||||
if (atnl)
|
||||
{
|
||||
if (x < 0)
|
||||
{
|
||||
printf (")");
|
||||
indent += x;
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("\n");
|
||||
atnl = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (x == -1)
|
||||
{
|
||||
for (i = 0; i < indent; i++)
|
||||
printf (" ");
|
||||
|
||||
indent += x;
|
||||
printf (")");
|
||||
return;
|
||||
}
|
||||
|
||||
indent += x;
|
||||
|
||||
for (i = 0; i < indent; i++)
|
||||
printf (" ");
|
||||
|
||||
if (x)
|
||||
{
|
||||
printf ("(");
|
||||
}
|
||||
}
|
||||
|
||||
static void nl ()
|
||||
{
|
||||
atnl = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
dump_coff_lines (p)
|
||||
struct coff_line *p;
|
||||
{
|
||||
int i;
|
||||
int online = 0;
|
||||
tab(1);
|
||||
printf("#lines %d ",p->nlines);
|
||||
for (i = 0; i < p->nlines; i++)
|
||||
{
|
||||
printf("(%d 0x%x)", p->lines[i], p->addresses[i]);
|
||||
online++;
|
||||
if (online > 6)
|
||||
{
|
||||
nl();
|
||||
tab(0);
|
||||
online = 0;
|
||||
}
|
||||
}
|
||||
nl();
|
||||
tab(-1);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_coff_type (p)
|
||||
struct coff_type *p;
|
||||
{
|
||||
tab (1);
|
||||
printf ("size %d ", p->size);
|
||||
switch (p->type)
|
||||
{
|
||||
case coff_pointer_type:
|
||||
printf ("pointer to");
|
||||
nl ();
|
||||
dump_coff_type (p->u.pointer.points_to);
|
||||
break;
|
||||
case coff_array_type:
|
||||
printf ("array [%d] of", p->u.array.dim);
|
||||
nl ();
|
||||
dump_coff_type (p->u.array.array_of);
|
||||
break;
|
||||
case coff_function_type:
|
||||
printf ("function returning");
|
||||
nl ();
|
||||
dump_coff_type (p->u.function.function_returns);
|
||||
dump_coff_lines (p->u.function.lines);
|
||||
printf ("arguments");
|
||||
nl ();
|
||||
dump_coff_scope (p->u.function.parameters);
|
||||
tab (0);
|
||||
printf ("code");
|
||||
nl ();
|
||||
dump_coff_scope (p->u.function.code);
|
||||
tab(0);
|
||||
break;
|
||||
case coff_structdef_type:
|
||||
printf ("structure definition");
|
||||
nl ();
|
||||
dump_coff_scope (p->u.astructdef.elements);
|
||||
break;
|
||||
case coff_structref_type:
|
||||
if (!p->u.aenumref.ref)
|
||||
printf ("structure ref to UNKNOWN struct");
|
||||
else
|
||||
printf ("structure ref to %s", p->u.aenumref.ref->name);
|
||||
break;
|
||||
case coff_enumref_type:
|
||||
printf ("enum ref to %s", p->u.astructref.ref->name);
|
||||
break;
|
||||
case coff_enumdef_type:
|
||||
printf ("enum definition");
|
||||
nl ();
|
||||
dump_coff_scope (p->u.aenumdef.elements);
|
||||
break;
|
||||
case coff_basic_type:
|
||||
switch (p->u.basic)
|
||||
{
|
||||
case T_NULL:
|
||||
printf ("NULL");
|
||||
break;
|
||||
case T_VOID:
|
||||
printf ("VOID");
|
||||
break;
|
||||
case T_CHAR:
|
||||
printf ("CHAR");
|
||||
break;
|
||||
case T_SHORT:
|
||||
printf ("SHORT");
|
||||
break;
|
||||
case T_INT:
|
||||
printf ("INT ");
|
||||
break;
|
||||
case T_LONG:
|
||||
printf ("LONG");
|
||||
break;
|
||||
case T_FLOAT:
|
||||
printf ("FLOAT");
|
||||
break;
|
||||
case T_DOUBLE:
|
||||
printf ("DOUBLE");
|
||||
break;
|
||||
case T_STRUCT:
|
||||
printf ("STRUCT");
|
||||
break;
|
||||
case T_UNION:
|
||||
printf ("UNION");
|
||||
break;
|
||||
case T_ENUM:
|
||||
printf ("ENUM");
|
||||
break;
|
||||
case T_MOE:
|
||||
printf ("MOE ");
|
||||
break;
|
||||
case T_UCHAR:
|
||||
printf ("UCHAR");
|
||||
break;
|
||||
case T_USHORT:
|
||||
printf ("USHORT");
|
||||
break;
|
||||
case T_UINT:
|
||||
printf ("UINT");
|
||||
break;
|
||||
case T_ULONG:
|
||||
printf ("ULONG");
|
||||
break;
|
||||
case T_LNGDBL:
|
||||
printf ("LNGDBL");
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
nl ();
|
||||
tab (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_coff_where (p)
|
||||
struct coff_where *p;
|
||||
{
|
||||
tab (1);
|
||||
switch (p->where)
|
||||
{
|
||||
case coff_where_stack:
|
||||
printf ("Stack offset %x", p->offset);
|
||||
break;
|
||||
case coff_where_memory:
|
||||
printf ("Memory section %s+%x", p->section->name, p->offset);
|
||||
break;
|
||||
case coff_where_register:
|
||||
printf ("Register %d", p->offset);
|
||||
break;
|
||||
case coff_where_member_of_struct:
|
||||
printf ("Struct Member offset %x", p->offset);
|
||||
break;
|
||||
case coff_where_member_of_enum:
|
||||
printf ("Enum Member offset %x", p->offset);
|
||||
break;
|
||||
case coff_where_unknown:
|
||||
printf ("Undefined symbol");
|
||||
break;
|
||||
case coff_where_strtag:
|
||||
printf ("STRTAG");
|
||||
case coff_where_entag:
|
||||
printf ("ENTAG");
|
||||
break;
|
||||
case coff_where_typedef:
|
||||
printf ("TYPEDEF");
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
nl ();
|
||||
tab (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_coff_visible (p)
|
||||
struct coff_visible *p;
|
||||
{
|
||||
tab (1);
|
||||
switch (p->type)
|
||||
{
|
||||
case coff_vis_ext_def:
|
||||
printf ("coff_vis_ext_def");
|
||||
break;
|
||||
case coff_vis_ext_ref:
|
||||
printf ("coff_vis_ext_ref");
|
||||
break;
|
||||
case coff_vis_int_def:
|
||||
printf ("coff_vis_int_def");
|
||||
break;
|
||||
case coff_vis_common:
|
||||
printf ("coff_vis_common");
|
||||
break;
|
||||
case coff_vis_auto:
|
||||
printf ("coff_vis_auto");
|
||||
break;
|
||||
case coff_vis_autoparam:
|
||||
printf ("coff_vis_autoparam");
|
||||
break;
|
||||
case coff_vis_regparam:
|
||||
printf ("coff_vis_regparam");
|
||||
break;
|
||||
case coff_vis_register:
|
||||
printf ("coff_vis_register");
|
||||
break;
|
||||
case coff_vis_tag:
|
||||
printf ("coff_vis_tag");
|
||||
break;
|
||||
case coff_vis_member_of_struct:
|
||||
printf ("coff_vis_member_of_struct");
|
||||
break;
|
||||
case coff_vis_member_of_enum:
|
||||
printf ("coff_vis_member_of_enum");
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
nl ();
|
||||
tab (-1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dump_coff_symbol (p)
|
||||
struct coff_symbol *p;
|
||||
{
|
||||
tab (1);
|
||||
printf ("List of symbols");
|
||||
nl ();
|
||||
while (p)
|
||||
{
|
||||
tab (1);
|
||||
tab (1);
|
||||
printf ("Symbol %s, tag %d, number %d", p->name, p->tag, p->number);
|
||||
nl ();
|
||||
tab (-1);
|
||||
tab (1);
|
||||
printf ("Type");
|
||||
nl ();
|
||||
dump_coff_type (p->type);
|
||||
tab (-1);
|
||||
tab (1);
|
||||
printf ("Where");
|
||||
dump_coff_where (p->where);
|
||||
tab (-1);
|
||||
tab (1);
|
||||
printf ("Visible");
|
||||
dump_coff_visible (p->visible);
|
||||
tab (-1);
|
||||
p = p->next;
|
||||
tab (-1);
|
||||
}
|
||||
tab (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_coff_scope (p)
|
||||
struct coff_scope *p;
|
||||
{
|
||||
if (p) {
|
||||
tab (1);
|
||||
printf ("List of blocks %lx ",(unsigned long) p);
|
||||
|
||||
if (p->sec) {
|
||||
printf( " %s %x..%x", p->sec->name,p->offset, p->offset + p->size -1);
|
||||
}
|
||||
nl ();
|
||||
tab (0);
|
||||
printf ("*****************");
|
||||
nl ();
|
||||
while (p)
|
||||
{
|
||||
tab (0);
|
||||
printf ("vars %d", p->nvars);
|
||||
nl ();
|
||||
dump_coff_symbol (p->vars_head);
|
||||
printf ("blocks");
|
||||
nl ();
|
||||
dump_coff_scope (p->list_head);
|
||||
nl ();
|
||||
p = p->next;
|
||||
}
|
||||
|
||||
tab (0);
|
||||
printf ("*****************");
|
||||
nl ();
|
||||
tab (-1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dump_coff_sfile (p)
|
||||
struct coff_sfile *p;
|
||||
{
|
||||
tab (1);
|
||||
printf ("List of source files");
|
||||
nl ();
|
||||
while (p)
|
||||
{
|
||||
tab (0);
|
||||
printf ("Source file %s", p->name);
|
||||
nl ();
|
||||
dump_coff_scope (p->scope);
|
||||
p = p->next;
|
||||
}
|
||||
tab (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_coff_section(ptr)
|
||||
struct coff_section *ptr;
|
||||
{
|
||||
int i;
|
||||
tab(1);
|
||||
printf("section %s %d %d address %x size %x number %d nrelocs %d",
|
||||
ptr->name, ptr->code, ptr->data, ptr->address,ptr->size, ptr->number, ptr->nrelocs);
|
||||
nl();
|
||||
|
||||
for (i = 0; i < ptr->nrelocs; i++)
|
||||
{
|
||||
tab(0);
|
||||
printf("(%x %s %x)",
|
||||
ptr->relocs[i].offset,
|
||||
ptr->relocs[i].symbol->name,
|
||||
ptr->relocs[i].addend);
|
||||
nl();
|
||||
}
|
||||
tab(-1);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
coff_dump (ptr)
|
||||
struct coff_ofile *ptr;
|
||||
{
|
||||
int i;
|
||||
printf ("Coff dump");
|
||||
nl ();
|
||||
printf ("#souces %d", ptr->nsources);
|
||||
nl ();
|
||||
dump_coff_sfile (ptr->source_head);
|
||||
for (i = 0; i < ptr->nsections; i++)
|
||||
dump_coff_section(ptr->sections + i);
|
||||
}
|
||||
|
||||
|
||||
|
||||
char * program_name;
|
||||
|
||||
static void
|
||||
show_usage (file, status)
|
||||
FILE *file;
|
||||
int status;
|
||||
{
|
||||
fprintf (file, "Usage: %s [-hV] in-file\n", program_name);
|
||||
exit (status);
|
||||
}
|
||||
|
||||
static void
|
||||
show_help ()
|
||||
{
|
||||
printf ("%s: Print a human readable interpretation of a SYSROFF object file\n",
|
||||
program_name);
|
||||
show_usage (stdout, 0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (ac, av)
|
||||
int ac;
|
||||
char *av[];
|
||||
{
|
||||
bfd *abfd;
|
||||
struct coff_ofile *tree;
|
||||
char **matching;
|
||||
char *input_file = NULL;
|
||||
int opt;
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{ "help", no_argument, 0, 'h' },
|
||||
{ "version", no_argument, 0, 'V' },
|
||||
{ NULL, no_argument, 0, 0 }
|
||||
};
|
||||
|
||||
program_name = av[0];
|
||||
xmalloc_set_program_name (program_name);
|
||||
|
||||
while ((opt = getopt_long (ac, av, "hV", long_options,
|
||||
(int *) NULL))
|
||||
!= EOF)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'h':
|
||||
show_help ();
|
||||
/*NOTREACHED*/
|
||||
case 'V':
|
||||
printf ("GNU %s version %s\n", program_name, PROGRAM_VERSION);
|
||||
exit (0);
|
||||
/*NOTREACHED*/
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
show_usage (stderr, 1);
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < ac)
|
||||
{
|
||||
input_file = av[optind];
|
||||
}
|
||||
|
||||
if (!input_file)
|
||||
{
|
||||
fprintf (stderr,"%s: no input file specified\n",
|
||||
program_name);
|
||||
exit(1);
|
||||
}
|
||||
abfd = bfd_openr (input_file, 0);
|
||||
|
||||
if (!abfd)
|
||||
bfd_fatal (input_file);
|
||||
|
||||
if (! bfd_check_format_matches (abfd, bfd_object, &matching))
|
||||
{
|
||||
bfd_nonfatal (input_file);
|
||||
if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
|
||||
{
|
||||
list_matching_formats (matching);
|
||||
free (matching);
|
||||
}
|
||||
exit (1);
|
||||
}
|
||||
|
||||
tree = coff_grok (abfd);
|
||||
|
||||
coff_dump(tree);
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
|
@ -30,6 +30,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
|
||||
#include <bfd.h>
|
||||
#include <stdio.h>
|
||||
#include "bucomm.h"
|
||||
|
||||
#include "coff/internal.h"
|
||||
#include "../bfd/libcoff.h"
|
||||
|
@ -57,7 +58,6 @@ static struct coff_ptr_struct *rawsyms;
|
|||
static int rawcount;
|
||||
static bfd *abfd;
|
||||
extern char *xcalloc ();
|
||||
extern char *xmalloc ();
|
||||
#define PTR_SIZE 4
|
||||
#define SHORT_SIZE 2
|
||||
#define INT_SIZE 4
|
||||
|
@ -84,6 +84,7 @@ empty_symbol ()
|
|||
/*int l;*/
|
||||
static void
|
||||
push_scope (link)
|
||||
int link;
|
||||
{
|
||||
struct coff_scope *n = empty_scope ();
|
||||
if (link)
|
||||
|
@ -371,6 +372,7 @@ do_type (i)
|
|||
last_struct = res;
|
||||
res->type = coff_structdef_type;
|
||||
res->u.astructdef.elements = empty_scope ();
|
||||
res->u.astructdef.idx = 0;
|
||||
res->u.astructdef.isstruct = (type & 0xf) == T_STRUCT;
|
||||
res->size = aux->x_sym.x_misc.x_lnsz.x_size;
|
||||
}
|
||||
|
@ -585,11 +587,14 @@ doit ()
|
|||
{
|
||||
int i;
|
||||
int infile = 0;
|
||||
struct coff_ofile *head = (struct coff_ofile *) malloc (sizeof (struct coff_ofile));
|
||||
struct coff_ofile *head =
|
||||
(struct coff_ofile *) xmalloc (sizeof (struct coff_ofile));
|
||||
ofile = head;
|
||||
head->source_head = 0;
|
||||
head->source_tail = 0;
|
||||
|
||||
head->nsources = 0;
|
||||
head->symbol_list_tail = 0;
|
||||
head->symbol_list_head = 0;
|
||||
do_sections_p1 (head);
|
||||
push_scope (1);
|
||||
|
||||
|
@ -723,6 +728,6 @@ coff_grok (inabfd)
|
|||
rawcount = obj_raw_syment_count (abfd);;
|
||||
tindex = (struct coff_symbol **) (xcalloc (sizeof (struct coff_symbol *), rawcount));
|
||||
|
||||
p = doit (abfd);
|
||||
p = doit ();
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -29,13 +29,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <libiberty.h>
|
||||
#include "bucomm.h"
|
||||
#include "sysroff.h"
|
||||
#include "coffgrok.h"
|
||||
|
||||
#include "coff/internal.h"
|
||||
#include "../bfd/libcoff.h"
|
||||
|
||||
#define PROGRAM_VERSION "1.3"
|
||||
#define PROGRAM_VERSION "1.5"
|
||||
/*#define FOOP1 1*/
|
||||
|
||||
static int sh;
|
||||
|
@ -43,6 +44,7 @@ static int h8300;
|
|||
static void wr_cs ();
|
||||
static void walk_tree_scope ();
|
||||
static void wr_globals ();
|
||||
static int find_base ();
|
||||
|
||||
static FILE *file;
|
||||
static bfd *abfd;
|
||||
|
@ -55,8 +57,8 @@ static int absolute_p;
|
|||
static int segmented_p;
|
||||
static int code;
|
||||
|
||||
static int ids1[10000];
|
||||
static int ids2[10000];
|
||||
static int ids1[20000];
|
||||
static int ids2[20000];
|
||||
|
||||
static int base1 = 0x18;
|
||||
static int base2 = 0x2018;
|
||||
|
@ -302,8 +304,11 @@ wr_un (ptr, sfile, first)
|
|||
int first;
|
||||
{
|
||||
struct IT_un un;
|
||||
|
||||
struct coff_symbol *s;
|
||||
|
||||
un.spare1 = 0;
|
||||
|
||||
if (abfd->flags & EXEC_P)
|
||||
un.format = FORMAT_LM;
|
||||
else
|
||||
|
@ -338,7 +343,7 @@ wr_un (ptr, sfile, first)
|
|||
un.linker = "L_GX00";
|
||||
un.lcd = DATE;
|
||||
un.name = sfile->name;
|
||||
sysroff_swap_un_out (file, &un, 1);
|
||||
sysroff_swap_un_out (file, &un);
|
||||
}
|
||||
|
||||
|
||||
|
@ -348,8 +353,7 @@ wr_hd (p)
|
|||
{
|
||||
struct IT_hd hd;
|
||||
|
||||
|
||||
|
||||
hd.spare1 = 0;
|
||||
if (abfd->flags & EXEC_P)
|
||||
{
|
||||
hd.mt = MTYPE_ABS_LM;
|
||||
|
@ -385,6 +389,8 @@ wr_hd (p)
|
|||
hd.cpu = "SH";
|
||||
sh = 1;
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
if (!abfd->flags & EXEC_P)
|
||||
|
@ -403,6 +409,8 @@ wr_hd (p)
|
|||
hd.os = "";
|
||||
hd.sys = "";
|
||||
hd.mn = strip_suffix (abfd->filename);
|
||||
|
||||
|
||||
sysroff_swap_hd_out (file, &hd);
|
||||
}
|
||||
|
||||
|
@ -436,6 +444,7 @@ wr_ob (p, section)
|
|||
{
|
||||
struct IT_ob ob;
|
||||
int todo = 200; /* Copy in 200 byte lumps */
|
||||
ob.spare = 0;
|
||||
if (i + todo > section->size)
|
||||
todo = section->size - i;
|
||||
|
||||
|
@ -458,7 +467,7 @@ wr_ob (p, section)
|
|||
ob.data.len = todo;
|
||||
bfd_get_section_contents (abfd, section->bfd_section, stuff, i, todo);
|
||||
ob.data.data = stuff;
|
||||
sysroff_swap_ob_out (file, &ob, i + todo < section->size);
|
||||
sysroff_swap_ob_out (file, &ob /*, i + todo < section->size*/ );
|
||||
i += todo;
|
||||
}
|
||||
}
|
||||
|
@ -540,6 +549,7 @@ wr_dps_start (sfile, section, scope, type, nest)
|
|||
struct coff_section *section;
|
||||
struct coff_scope *scope;
|
||||
int type;
|
||||
int nest;
|
||||
{
|
||||
struct IT_dps dps;
|
||||
dps.end = 0;
|
||||
|
@ -559,6 +569,12 @@ wr_dps_start (sfile, section, scope, type, nest)
|
|||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dps.san = 0;
|
||||
dps.address = 0;
|
||||
dps.block_size = 0;
|
||||
}
|
||||
|
||||
dps.nesting = nest;
|
||||
dps.neg = 0x1001;
|
||||
|
@ -663,6 +679,7 @@ walk_tree_type_1 (sfile, symbol, type, nest)
|
|||
struct IT_dfp dfp;
|
||||
struct coff_symbol *param;
|
||||
dfp.end = 0;
|
||||
dfp.spare = 0;
|
||||
dfp.nparams = type->u.function.parameters->nvars;
|
||||
dfp.neg = 0x1001;
|
||||
|
||||
|
@ -686,6 +703,7 @@ walk_tree_type_1 (sfile, symbol, type, nest)
|
|||
struct IT_dbt dbt;
|
||||
struct IT_dds dds;
|
||||
struct coff_symbol *member;
|
||||
dds.spare = 0;
|
||||
dbt.btype = BTYPE_STRUCT;
|
||||
dbt.bitsize = type->size;
|
||||
dbt.sign = SIGN_UNSPEC;
|
||||
|
@ -744,10 +762,12 @@ walk_tree_type_1 (sfile, symbol, type, nest)
|
|||
dar.min = nints (dims);
|
||||
dar.minspare = nints (dims);
|
||||
dar.neg = 0x1001;
|
||||
dar.length = type->size / type->u.array.dim;
|
||||
for (j = 0; j < dims; j++)
|
||||
{
|
||||
dar.variable[j] = VARIABLE_FIXED;
|
||||
dar.subtype[j] = SUB_INTEGER;
|
||||
dar.spare[j] = 0;
|
||||
dar.max_variable[j] = 0;
|
||||
dar.max[j] = type->u.array.dim;
|
||||
dar.min_variable[j] = 0;
|
||||
|
@ -772,6 +792,7 @@ walk_tree_type_1 (sfile, symbol, type, nest)
|
|||
|
||||
den.end = 0;
|
||||
den.neg = 0x1001;
|
||||
den.spare = 0;
|
||||
sysroff_swap_den_out (file, &den);
|
||||
for (member = type->u.aenumdef.elements->vars_head;
|
||||
member;
|
||||
|
@ -809,6 +830,7 @@ dty_start ()
|
|||
struct IT_dty dty;
|
||||
dty.end = 0;
|
||||
dty.neg = 0x1001;
|
||||
dty.spare = 0;
|
||||
sysroff_swap_dty_out (file, &dty);
|
||||
}
|
||||
|
||||
|
@ -874,9 +896,9 @@ walk_tree_type (sfile, symbol, type, nest)
|
|||
|
||||
wr_dps_end (symbol->where->section,
|
||||
symbol->type->u.function.code,
|
||||
BLOCK_TYPE_BLOCK, nest);
|
||||
BLOCK_TYPE_BLOCK);
|
||||
wr_dps_end (symbol->where->section,
|
||||
symbol->type->u.function.code, BLOCK_TYPE_FUNCTION, nest);
|
||||
symbol->type->u.function.code, BLOCK_TYPE_FUNCTION);
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -903,7 +925,7 @@ walk_tree_symbol (sfile, section, symbol, nest)
|
|||
{
|
||||
struct IT_dsy dsy;
|
||||
|
||||
|
||||
dsy.spare2 = 0;
|
||||
dsy.nesting = nest;
|
||||
|
||||
switch (symbol->type->type)
|
||||
|
@ -1165,13 +1187,16 @@ wr_du (p, sfile, n)
|
|||
{
|
||||
struct IT_du du;
|
||||
int lim;
|
||||
#if 0
|
||||
struct coff_symbol *symbol;
|
||||
static int incit = 0x500000;
|
||||
int used = 0;
|
||||
#endif
|
||||
int i;
|
||||
int j;
|
||||
int used = 0;
|
||||
unsigned int *lowest = (unsigned *) nints (p->nsections);
|
||||
unsigned int *highest = (unsigned *) nints (p->nsections);
|
||||
du.spare = 0;
|
||||
du.format = abfd->flags & EXEC_P ? 0 : 1;
|
||||
du.optimized = 0;
|
||||
du.unit = n;
|
||||
|
@ -1272,7 +1297,6 @@ wr_dus (p, sfile)
|
|||
{
|
||||
|
||||
struct IT_dus dus;
|
||||
int i;
|
||||
|
||||
dus.efn = 0x1001;
|
||||
dus.ns = 1; /* p->nsources; sac 14 jul 94 */
|
||||
|
@ -1289,6 +1313,7 @@ wr_dus (p, sfile)
|
|||
sfile = sfile->next)
|
||||
{
|
||||
dus.drb[i] = 0;
|
||||
dus.spare[i] = 0;
|
||||
dus.fname[i] = sfile->name;
|
||||
i++;
|
||||
}
|
||||
|
@ -1425,7 +1450,8 @@ wr_dln (p, sfile, n)
|
|||
{
|
||||
int i;
|
||||
struct coff_line *l = sy->type->u.function.lines;
|
||||
if (l) {
|
||||
if (l)
|
||||
{
|
||||
int base = find_base (sfile, sy->where->section);
|
||||
for (i = 0; i < l->nlines; i++)
|
||||
{
|
||||
|
@ -1490,7 +1516,7 @@ wr_debug (p)
|
|||
}
|
||||
wr_du (p, sfile, n);
|
||||
wr_dus (p, sfile);
|
||||
wr_program_structure (p, sfile, n);
|
||||
wr_program_structure (p, sfile);
|
||||
wr_dln (p, sfile, n);
|
||||
n++;
|
||||
}
|
||||
|
@ -1525,7 +1551,7 @@ wr_sc (ptr, sfile)
|
|||
{
|
||||
struct coff_section *sec;
|
||||
struct coff_symbol *symbol;
|
||||
} myinfo;
|
||||
};
|
||||
struct coff_symbol *symbol;
|
||||
|
||||
struct myinfo *info
|
||||
|
@ -1565,7 +1591,8 @@ wr_sc (ptr, sfile)
|
|||
struct IT_sc sc;
|
||||
char *name;
|
||||
symbol = info[i].symbol;
|
||||
|
||||
sc.spare = 0;
|
||||
sc.spare1 = 0;
|
||||
if (!symbol)
|
||||
{
|
||||
/* Don't have a symbol set aside for this section, which means that nothing
|
||||
|
@ -1577,9 +1604,6 @@ wr_sc (ptr, sfile)
|
|||
}
|
||||
else
|
||||
{
|
||||
unsigned int low = symbol->where->offset;
|
||||
unsigned int high = symbol->where->offset + symbol->type->size - 1;
|
||||
|
||||
if (abfd->flags & EXEC_P)
|
||||
{
|
||||
sc.format = 0;
|
||||
|
@ -1603,6 +1627,7 @@ wr_sc (ptr, sfile)
|
|||
sc.init = 3;
|
||||
sc.mode = 3;
|
||||
sc.spare = 0;
|
||||
sc.segadd = 0;
|
||||
sc.spare1 = 0; /* If not zero, then it doesn't work */
|
||||
sc.name = section_translate (name);
|
||||
if (strlen (sc.name) == 1)
|
||||
|
@ -1617,6 +1642,10 @@ wr_sc (ptr, sfile)
|
|||
sc.contents = CONTENTS_CODE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.contents = CONTENTS_CODE;
|
||||
}
|
||||
|
||||
|
||||
sysroff_swap_sc_out (file, &sc);
|
||||
|
@ -1642,6 +1671,7 @@ wr_er (ptr, sfile, first)
|
|||
if (sym->visible->type == coff_vis_ext_ref)
|
||||
{
|
||||
struct IT_er er;
|
||||
er.spare = 0;
|
||||
er.type = ER_NOTSPEC;
|
||||
er.name = sym->name;
|
||||
sysroff_swap_er_out (file, &er);
|
||||
|
@ -1655,7 +1685,7 @@ wr_er (ptr, sfile, first)
|
|||
static void
|
||||
wr_ed (ptr, sfile, first)
|
||||
struct coff_ofile *ptr;
|
||||
struct coff_file *sfile;
|
||||
struct coff_sfile *sfile;
|
||||
int first;
|
||||
{
|
||||
struct coff_symbol *s;
|
||||
|
@ -1669,7 +1699,7 @@ wr_ed (ptr, sfile, first)
|
|||
struct IT_ed ed;
|
||||
|
||||
ed.section = s->where->section->number;
|
||||
|
||||
ed.spare = 0;
|
||||
if (s->where->section->data)
|
||||
{
|
||||
ed.type = ED_TYPE_DATA;
|
||||
|
@ -1702,7 +1732,7 @@ wr_unit_info (ptr)
|
|||
sfile = sfile->next)
|
||||
{
|
||||
wr_un (ptr, sfile, first);
|
||||
wr_sc (ptr, sfile, first);
|
||||
wr_sc (ptr, sfile);
|
||||
wr_er (ptr, sfile, first);
|
||||
wr_ed (ptr, sfile, first);
|
||||
first = 0;
|
||||
|
@ -1846,6 +1876,8 @@ main (ac, av)
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
input_file = 0;
|
||||
|
||||
if (!input_file)
|
||||
{
|
||||
|
@ -1892,7 +1924,7 @@ main (ac, av)
|
|||
exit (1);
|
||||
}
|
||||
|
||||
file = fopen (output_file, "w");
|
||||
file = fopen (output_file, "wb");
|
||||
|
||||
if (!file)
|
||||
{
|
||||
|
@ -1901,6 +1933,8 @@ main (ac, av)
|
|||
exit (1);
|
||||
}
|
||||
|
||||
if (debug)
|
||||
printf ("ids %d %d\n", base1, base2);
|
||||
tree = coff_grok (abfd);
|
||||
prescan (tree);
|
||||
wr_module (tree);
|
||||
|
|
Loading…
Reference in New Issue