forked from Imagelibrary/binutils-gdb
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:
@@ -1,21 +1,21 @@
|
||||
/* srconv.c -- Sysroff conversion program
|
||||
Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Binutils.
|
||||
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 free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* Written by Steve Chamberlain (sac@cygnus.com)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -839,7 +861,7 @@ dump_tree_structure (sfile, symbol, type, nest)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
static void
|
||||
walk_tree_type (sfile, symbol, type, nest)
|
||||
|
||||
struct
|
||||
@@ -860,23 +882,23 @@ walk_tree_type (sfile, symbol, type, nest)
|
||||
dty.end = 1;
|
||||
sysroff_swap_dty_out (file, &dty);
|
||||
|
||||
wr_dps_start (sfile,
|
||||
symbol->where->section,
|
||||
symbol->type->u.function.code,
|
||||
wr_dps_start (sfile,
|
||||
symbol->where->section,
|
||||
symbol->type->u.function.code,
|
||||
BLOCK_TYPE_FUNCTION, nest);
|
||||
wr_dps_start (sfile, symbol->where->section,
|
||||
symbol->type->u.function.code,
|
||||
BLOCK_TYPE_BLOCK, nest);
|
||||
walk_tree_scope (symbol->where->section,
|
||||
sfile,
|
||||
symbol->type->u.function.code,
|
||||
symbol->type->u.function.code,
|
||||
nest + 1, BLOCK_TYPE_BLOCK);
|
||||
|
||||
wr_dps_end (symbol->where->section,
|
||||
symbol->type->u.function.code,
|
||||
BLOCK_TYPE_BLOCK, nest);
|
||||
wr_dps_end (symbol->where->section,
|
||||
symbol->type->u.function.code, BLOCK_TYPE_FUNCTION, nest);
|
||||
wr_dps_end (symbol->where->section,
|
||||
symbol->type->u.function.code,
|
||||
BLOCK_TYPE_BLOCK);
|
||||
wr_dps_end (symbol->where->section,
|
||||
symbol->type->u.function.code, BLOCK_TYPE_FUNCTION);
|
||||
|
||||
}
|
||||
else
|
||||
@@ -903,206 +925,206 @@ walk_tree_symbol (sfile, section, symbol, nest)
|
||||
{
|
||||
struct IT_dsy dsy;
|
||||
|
||||
dsy.spare2 = 0;
|
||||
dsy.nesting = nest;
|
||||
|
||||
dsy.nesting = nest;
|
||||
switch (symbol->type->type)
|
||||
{
|
||||
case coff_function_type:
|
||||
dsy.type = STYPE_FUNC;
|
||||
dsy.assign = 1;
|
||||
break;
|
||||
case coff_structref_type:
|
||||
case coff_pointer_type:
|
||||
case coff_array_type:
|
||||
case coff_basic_type:
|
||||
case coff_enumref_type:
|
||||
dsy.type = STYPE_VAR;
|
||||
dsy.assign = 1;
|
||||
break;
|
||||
case coff_enumdef_type:
|
||||
dsy.type = STYPE_TAG;
|
||||
dsy.assign = 0;
|
||||
dsy.magic = 2;
|
||||
break;
|
||||
case coff_structdef_type:
|
||||
dsy.type = STYPE_TAG;
|
||||
dsy.assign = 0;
|
||||
dsy.magic = symbol->type->u.astructdef.isstruct ? 0 : 1;
|
||||
break;
|
||||
case coff_secdef_type:
|
||||
return;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
switch (symbol->type->type)
|
||||
{
|
||||
case coff_function_type:
|
||||
dsy.type = STYPE_FUNC;
|
||||
dsy.assign = 1;
|
||||
break;
|
||||
case coff_structref_type:
|
||||
case coff_pointer_type:
|
||||
case coff_array_type:
|
||||
case coff_basic_type:
|
||||
case coff_enumref_type:
|
||||
dsy.type = STYPE_VAR;
|
||||
dsy.assign = 1;
|
||||
break;
|
||||
case coff_enumdef_type:
|
||||
dsy.type = STYPE_TAG;
|
||||
dsy.assign = 0;
|
||||
dsy.magic = 2;
|
||||
break;
|
||||
case coff_structdef_type:
|
||||
dsy.type = STYPE_TAG;
|
||||
dsy.assign = 0;
|
||||
dsy.magic = symbol->type->u.astructdef.isstruct ? 0 : 1;
|
||||
break;
|
||||
case coff_secdef_type:
|
||||
return;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
if (symbol->where->where == coff_where_member_of_struct)
|
||||
{
|
||||
dsy.assign = 0;
|
||||
dsy.type = STYPE_MEMBER;
|
||||
}
|
||||
if (symbol->where->where == coff_where_member_of_enum)
|
||||
{
|
||||
dsy.type = STYPE_ENUM;
|
||||
dsy.assign = 0;
|
||||
dsy.vallen = 4;
|
||||
dsy.value = symbol->where->offset;
|
||||
}
|
||||
|
||||
if (symbol->where->where == coff_where_member_of_struct)
|
||||
{
|
||||
dsy.assign = 0;
|
||||
dsy.type = STYPE_MEMBER;
|
||||
}
|
||||
if (symbol->where->where == coff_where_member_of_enum)
|
||||
{
|
||||
dsy.type = STYPE_ENUM;
|
||||
dsy.assign = 0;
|
||||
dsy.vallen = 4;
|
||||
dsy.value = symbol->where->offset;
|
||||
}
|
||||
|
||||
if (symbol->type->type == coff_structdef_type
|
||||
|| symbol->where->where == coff_where_entag
|
||||
|| symbol->where->where == coff_where_strtag)
|
||||
{
|
||||
dsy.snumber = get_member_id (symbol->number);
|
||||
}
|
||||
else
|
||||
{
|
||||
dsy.snumber = get_ordinary_id (symbol->number);
|
||||
}
|
||||
if (symbol->type->type == coff_structdef_type
|
||||
|| symbol->where->where == coff_where_entag
|
||||
|| symbol->where->where == coff_where_strtag)
|
||||
{
|
||||
dsy.snumber = get_member_id (symbol->number);
|
||||
}
|
||||
else
|
||||
{
|
||||
dsy.snumber = get_ordinary_id (symbol->number);
|
||||
}
|
||||
|
||||
|
||||
dsy.sname = symbol->name[0] == '_' ? symbol->name + 1 : symbol->name;
|
||||
dsy.sname = symbol->name[0] == '_' ? symbol->name + 1 : symbol->name;
|
||||
|
||||
switch (symbol->visible->type)
|
||||
{
|
||||
case coff_vis_common:
|
||||
case coff_vis_ext_def:
|
||||
dsy.ainfo = AINFO_STATIC_EXT_DEF;
|
||||
break;
|
||||
case coff_vis_ext_ref:
|
||||
dsy.ainfo = AINFO_STATIC_EXT_REF;
|
||||
break;
|
||||
case coff_vis_int_def:
|
||||
dsy.ainfo = AINFO_STATIC_INT;
|
||||
break;
|
||||
case coff_vis_auto:
|
||||
case coff_vis_autoparam:
|
||||
dsy.ainfo = AINFO_AUTO;
|
||||
break;
|
||||
case coff_vis_register:
|
||||
case coff_vis_regparam:
|
||||
dsy.ainfo = AINFO_REG;
|
||||
break;
|
||||
break;
|
||||
case coff_vis_tag:
|
||||
case coff_vis_member_of_struct:
|
||||
case coff_vis_member_of_enum:
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
switch (symbol->visible->type)
|
||||
{
|
||||
case coff_vis_common:
|
||||
case coff_vis_ext_def:
|
||||
dsy.ainfo = AINFO_STATIC_EXT_DEF;
|
||||
break;
|
||||
case coff_vis_ext_ref:
|
||||
dsy.ainfo = AINFO_STATIC_EXT_REF;
|
||||
break;
|
||||
case coff_vis_int_def:
|
||||
dsy.ainfo = AINFO_STATIC_INT;
|
||||
break;
|
||||
case coff_vis_auto:
|
||||
case coff_vis_autoparam:
|
||||
dsy.ainfo = AINFO_AUTO;
|
||||
break;
|
||||
case coff_vis_register:
|
||||
case coff_vis_regparam:
|
||||
dsy.ainfo = AINFO_REG;
|
||||
break;
|
||||
break;
|
||||
case coff_vis_tag:
|
||||
case coff_vis_member_of_struct:
|
||||
case coff_vis_member_of_enum:
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
dsy.dlength = symbol->type->size;
|
||||
switch (symbol->where->where)
|
||||
{
|
||||
case coff_where_memory:
|
||||
dsy.dlength = symbol->type->size;
|
||||
switch (symbol->where->where)
|
||||
{
|
||||
case coff_where_memory:
|
||||
|
||||
dsy.section = symbol->where->section->number;
|
||||
dsy.section = symbol->where->section->number;
|
||||
#ifdef FOOP
|
||||
dsy.section = 0;
|
||||
dsy.section = 0;
|
||||
#endif
|
||||
break;
|
||||
case coff_where_member_of_struct:
|
||||
case coff_where_member_of_enum:
|
||||
case coff_where_stack:
|
||||
case coff_where_register:
|
||||
case coff_where_unknown:
|
||||
case coff_where_strtag:
|
||||
break;
|
||||
case coff_where_member_of_struct:
|
||||
case coff_where_member_of_enum:
|
||||
case coff_where_stack:
|
||||
case coff_where_register:
|
||||
case coff_where_unknown:
|
||||
case coff_where_strtag:
|
||||
|
||||
case coff_where_entag:
|
||||
case coff_where_typedef:
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
case coff_where_entag:
|
||||
case coff_where_typedef:
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
switch (symbol->where->where)
|
||||
{
|
||||
case coff_where_memory:
|
||||
dsy.address = symbol->where->offset - find_base (sfile, symbol->where->section);
|
||||
break;
|
||||
case coff_where_stack:
|
||||
dsy.address = symbol->where->offset;
|
||||
break;
|
||||
case coff_where_member_of_struct:
|
||||
switch (symbol->where->where)
|
||||
{
|
||||
case coff_where_memory:
|
||||
dsy.address = symbol->where->offset - find_base (sfile, symbol->where->section);
|
||||
break;
|
||||
case coff_where_stack:
|
||||
dsy.address = symbol->where->offset;
|
||||
break;
|
||||
case coff_where_member_of_struct:
|
||||
|
||||
|
||||
if (symbol->where->bitsize)
|
||||
{
|
||||
int bits = (symbol->where->offset * 8 + symbol->where->bitoffset);
|
||||
dsy.bitunit = 1;
|
||||
dsy.field_len = symbol->where->bitsize;
|
||||
dsy.field_off = (bits / 32) * 4;
|
||||
dsy.field_bitoff = bits % 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
dsy.bitunit = 0;
|
||||
if (symbol->where->bitsize)
|
||||
{
|
||||
int bits = (symbol->where->offset * 8 + symbol->where->bitoffset);
|
||||
dsy.bitunit = 1;
|
||||
dsy.field_len = symbol->where->bitsize;
|
||||
dsy.field_off = (bits / 32) * 4;
|
||||
dsy.field_bitoff = bits % 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
dsy.bitunit = 0;
|
||||
|
||||
dsy.field_len = symbol->type->size;
|
||||
dsy.field_off = symbol->where->offset;
|
||||
}
|
||||
break;
|
||||
case coff_where_member_of_enum:
|
||||
/* dsy.bitunit = 0;
|
||||
dsy.field_len = symbol->type->size;
|
||||
dsy.field_off = symbol->where->offset;
|
||||
}
|
||||
break;
|
||||
case coff_where_member_of_enum:
|
||||
/* dsy.bitunit = 0;
|
||||
dsy.field_len = symbol->type->size;
|
||||
dsy.field_off = symbol->where->offset;*/
|
||||
break;
|
||||
case coff_where_register:
|
||||
case coff_where_unknown:
|
||||
case coff_where_strtag:
|
||||
break;
|
||||
case coff_where_register:
|
||||
case coff_where_unknown:
|
||||
case coff_where_strtag:
|
||||
|
||||
case coff_where_entag:
|
||||
case coff_where_typedef:
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
case coff_where_entag:
|
||||
case coff_where_typedef:
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
if (symbol->where->where == coff_where_register)
|
||||
{
|
||||
if (sh)
|
||||
dsy.reg = rname_sh[symbol->where->offset];
|
||||
if (h8300)
|
||||
dsy.reg = rname_h8300[symbol->where->offset];
|
||||
}
|
||||
if (symbol->where->where == coff_where_register)
|
||||
{
|
||||
if (sh)
|
||||
dsy.reg = rname_sh[symbol->where->offset];
|
||||
if (h8300)
|
||||
dsy.reg = rname_h8300[symbol->where->offset];
|
||||
}
|
||||
|
||||
switch (symbol->visible->type)
|
||||
{
|
||||
case coff_vis_common:
|
||||
/* We do this 'cause common C symbols are treated as extdefs */
|
||||
case coff_vis_ext_def:
|
||||
case coff_vis_ext_ref:
|
||||
switch (symbol->visible->type)
|
||||
{
|
||||
case coff_vis_common:
|
||||
/* We do this 'cause common C symbols are treated as extdefs */
|
||||
case coff_vis_ext_def:
|
||||
case coff_vis_ext_ref:
|
||||
|
||||
dsy.ename = symbol->name;
|
||||
break;
|
||||
dsy.ename = symbol->name;
|
||||
break;
|
||||
|
||||
case coff_vis_regparam:
|
||||
case coff_vis_autoparam:
|
||||
dsy.type = STYPE_PARAMETER;
|
||||
break;
|
||||
case coff_vis_regparam:
|
||||
case coff_vis_autoparam:
|
||||
dsy.type = STYPE_PARAMETER;
|
||||
break;
|
||||
|
||||
case coff_vis_int_def:
|
||||
case coff_vis_int_def:
|
||||
|
||||
case coff_vis_auto:
|
||||
case coff_vis_register:
|
||||
case coff_vis_tag:
|
||||
case coff_vis_member_of_struct:
|
||||
case coff_vis_member_of_enum:
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
case coff_vis_auto:
|
||||
case coff_vis_register:
|
||||
case coff_vis_tag:
|
||||
case coff_vis_member_of_struct:
|
||||
case coff_vis_member_of_enum:
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
dsy.sfn = 0;
|
||||
dsy.sln = 2;
|
||||
dsy.sfn = 0;
|
||||
dsy.sln = 2;
|
||||
|
||||
dsy.neg = 0x1001;
|
||||
dsy.neg = 0x1001;
|
||||
|
||||
|
||||
sysroff_swap_dsy_out (file, &dsy);
|
||||
sysroff_swap_dsy_out (file, &dsy);
|
||||
|
||||
walk_tree_type (sfile, symbol, symbol->type, nest);
|
||||
walk_tree_type (sfile, symbol, symbol->type, nest);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -1236,9 +1261,9 @@ wr_du (p, sfile, n)
|
||||
du.san[dst] = dst;
|
||||
if (sfile->section[src].init)
|
||||
{
|
||||
du.length[dst]
|
||||
du.length[dst]
|
||||
= sfile->section[src].high - sfile->section[src].low + 1;
|
||||
du.address[dst]
|
||||
du.address[dst]
|
||||
= sfile->section[src].low;
|
||||
}
|
||||
else
|
||||
@@ -1272,10 +1297,9 @@ wr_dus (p, sfile)
|
||||
{
|
||||
|
||||
struct IT_dus dus;
|
||||
int i;
|
||||
|
||||
dus.efn = 0x1001;
|
||||
dus.ns = 1 ; /* p->nsources; sac 14 jul 94 */
|
||||
dus.ns = 1; /* p->nsources; sac 14 jul 94 */
|
||||
dus.drb = nints (dus.ns);
|
||||
dus.fname = (char **) xcalloc (sizeof (char *), dus.ns);
|
||||
dus.spare = nints (dus.ns);
|
||||
@@ -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,23 +1450,24 @@ wr_dln (p, sfile, n)
|
||||
{
|
||||
int i;
|
||||
struct coff_line *l = sy->type->u.function.lines;
|
||||
if (l) {
|
||||
int base = find_base (sfile, sy->where->section);
|
||||
for (i = 0; i < l->nlines; i++)
|
||||
{
|
||||
dln.section[idx] = sy->where->section->number;
|
||||
dln.sfn[idx] = 0;
|
||||
dln.sln[idx] = l->lines[i];
|
||||
dln.from_address[idx] =
|
||||
l->addresses[i] + sy->where->section->address - base;
|
||||
dln.cc[idx] = 0;
|
||||
if (idx)
|
||||
dln.to_address[idx - 1] = dln.from_address[idx];
|
||||
idx++;
|
||||
if (l)
|
||||
{
|
||||
int base = find_base (sfile, sy->where->section);
|
||||
for (i = 0; i < l->nlines; i++)
|
||||
{
|
||||
dln.section[idx] = sy->where->section->number;
|
||||
dln.sfn[idx] = 0;
|
||||
dln.sln[idx] = l->lines[i];
|
||||
dln.from_address[idx] =
|
||||
l->addresses[i] + sy->where->section->address - base;
|
||||
dln.cc[idx] = 0;
|
||||
if (idx)
|
||||
dln.to_address[idx - 1] = dln.from_address[idx];
|
||||
idx++;
|
||||
|
||||
}
|
||||
dln.to_address[idx - 1] = dln.from_address[idx - 1] + 2;
|
||||
}
|
||||
}
|
||||
dln.to_address[idx - 1] = dln.from_address[idx - 1] + 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lc)
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user