aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorSteve Chamberlain <sac@cygnus>1992-01-24 22:36:06 +0000
committerSteve Chamberlain <sac@cygnus>1992-01-24 22:36:06 +0000
commit6fd50a2010d886cd606cbec61fe11ce521984cef (patch)
treefb0f4959b0e6371c92168a7189fe11b7e7da283e /ld
parent2e2bf962db00b2e23a222687e4bc3c5971c645b7 (diff)
downloadgdb-6fd50a2010d886cd606cbec61fe11ce521984cef.zip
gdb-6fd50a2010d886cd606cbec61fe11ce521984cef.tar.gz
gdb-6fd50a2010d886cd606cbec61fe11ce521984cef.tar.bz2
.Sanitize: added relax.c
ldsym.c ldlang.* more map stuff
Diffstat (limited to 'ld')
-rw-r--r--ld/.Sanitize7
-rw-r--r--ld/ldlang.c120
-rw-r--r--ld/ldsym.c50
3 files changed, 91 insertions, 86 deletions
diff --git a/ld/.Sanitize b/ld/.Sanitize
index 0064aed..e468e1b 100644
--- a/ld/.Sanitize
+++ b/ld/.Sanitize
@@ -30,6 +30,7 @@ README
i386aout.c
i386aout.sc
ChangeLog
+relax.c
Makefile.in
config
config.h
@@ -91,7 +92,11 @@ echo Done in `pwd`.
#
#
# $Log$
-# Revision 1.25 1991/12/12 03:42:08 sac
+# Revision 1.26 1992/01/24 22:35:55 sac
+# .Sanitize: added relax.c
+# ldsym.c ldlang.* more map stuff
+#
+# Revision 1.25 1991/12/12 03:42:08 sac
# New dos files
#
# Revision 1.24 1991/12/08 01:27:59 sac
diff --git a/ld/ldlang.c b/ld/ldlang.c
index e974356..b99f129 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -112,19 +112,19 @@ static void
DEFUN(print_size,(value),
size_t value)
{
- printf("%5x", (unsigned)value);
+ fprintf(config.map_file, "%5x", (unsigned)value);
}
static void
DEFUN(print_alignment,(value),
unsigned int value)
{
- printf("2**%1u",value);
+ fprintf(config.map_file, "2**%1u",value);
}
static void
DEFUN(print_fill,(value),
fill_type value)
{
- printf("%04x",(unsigned)value);
+ fprintf(config.map_file, "%04x",(unsigned)value);
}
@@ -132,7 +132,7 @@ static void
DEFUN(print_section,(name),
CONST char *CONST name)
{
- printf("%*s", -longest_section_name, name);
+ fprintf(config.map_file, "%*s", -longest_section_name, name);
}
/*----------------------------------------------------------------------
@@ -443,46 +443,44 @@ DEFUN(lang_output_section_statement_lookup,(name),
static void
-DEFUN(print_flags, (outfile, ignore_flags),
- FILE *outfile AND
+DEFUN(print_flags, ( ignore_flags),
int *ignore_flags)
{
- fprintf(outfile,"(");
+ fprintf(config.map_file, "(");
#if 0
if (flags->flag_read) fprintf(outfile,"R");
if (flags->flag_write) fprintf(outfile,"W");
if (flags->flag_executable) fprintf(outfile,"X");
if (flags->flag_loadable) fprintf(outfile,"L");
#endif
- fprintf(outfile,")");
+ fprintf(config.map_file, ")");
}
void
-DEFUN(lang_map,(outfile),
- FILE *outfile)
+DEFUN_VOID(lang_map)
{
lang_memory_region_type *m;
- fprintf(outfile,"**MEMORY CONFIGURATION**\n\n");
+ fprintf(config.map_file,"**MEMORY CONFIGURATION**\n\n");
#ifdef HOST_64_BIT
- fprintf(outfile,"name\t\torigin\t\tlength\t\tattributes\n");
+ fprintf(config.map_file,"name\t\torigin\t\tlength\t\tattributes\n");
#else
- fprintf(outfile,"name\t\torigin length\t\tattributes\n");
+ fprintf(config.map_file,"name\t\torigin length\t\tattributes\n");
#endif
for (m = lang_memory_region_list;
m != (lang_memory_region_type *)NULL;
m = m->next)
{
- fprintf(outfile,"%-16s", m->name);
+ fprintf(config.map_file,"%-16s", m->name);
print_address(m->origin);
print_space();
print_address(m->length);
print_space();
- print_flags(outfile, &m->flags);
- fprintf(outfile,"\n");
+ print_flags( &m->flags);
+ fprintf(config.map_file,"\n");
}
- fprintf(outfile,"\n\n**LINK EDITOR MEMORY MAP**\n\n");
- fprintf(outfile,"output input virtual\n");
- fprintf(outfile,"section section address tsize\n\n");
+ fprintf(config.map_file,"\n\n**LINK EDITOR MEMORY MAP**\n\n");
+ fprintf(config.map_file,"output input virtual\n");
+ fprintf(config.map_file,"section section address tsize\n\n");
print_statements();
@@ -941,21 +939,21 @@ DEFUN(print_output_section_statement,(output_section_statement),
print_alignment(section->alignment_power);
print_space();
#if 0
- printf("%s flags", output_section_statement->region->name);
+ fprintf(config.map_file, "%s flags", output_section_statement->region->name);
print_flags(stdout, &output_section_statement->flags);
#endif
if (section->flags & SEC_LOAD)
- printf("load ");
+ fprintf(config.map_file, "load ");
if (section->flags & SEC_ALLOC)
- printf("alloc ");
+ fprintf(config.map_file, "alloc ");
if (section->flags & SEC_RELOC)
- printf("reloc ");
+ fprintf(config.map_file, "reloc ");
if (section->flags & SEC_HAS_CONTENTS)
- printf("contents ");
+ fprintf(config.map_file, "contents ");
}
else {
- printf("No attached output section");
+ fprintf(config.map_file, "No attached output section");
}
print_nl();
print_statement(output_section_statement->children.head,
@@ -986,11 +984,11 @@ DEFUN(print_assignment,(assignment, output_section),
}
else
{
- printf("*undefined*");
+ fprintf(config.map_file, "*undefined*");
}
print_space();
- exp_print_tree(stdout, assignment->exp);
- printf("\n");
+ exp_print_tree(assignment->exp);
+ fprintf(config.map_file, "\n");
}
static void
@@ -998,7 +996,7 @@ DEFUN(print_input_statement,(statm),
lang_input_statement_type *statm)
{
if (statm->filename != (char *)NULL) {
- printf("LOAD %s\n",statm->filename);
+ fprintf(config.map_file, "LOAD %s\n",statm->filename);
}
}
@@ -1007,11 +1005,11 @@ DEFUN(print_symbol,(q),
asymbol *q)
{
print_section("");
- printf(" ");
+ fprintf(config.map_file, " ");
print_section("");
- printf(" ");
+ fprintf(config.map_file, " ");
print_address(outside_symbol_address(q));
- printf(" %s", q->name ? q->name : " ");
+ fprintf(config.map_file, " %s", q->name ? q->name : " ");
print_nl();
}
@@ -1027,32 +1025,32 @@ DEFUN(print_input_section,(in),
if(size != 0) {
print_section("");
- printf(" ");
+ fprintf(config.map_file, " ");
print_section(i->name);
- printf(" ");
+ fprintf(config.map_file, " ");
if (i->output_section) {
print_address(i->output_section->vma + i->output_offset);
- printf(" ");
+ fprintf(config.map_file, " ");
print_size(size);
- printf(" ");
+ fprintf(config.map_file, " ");
print_alignment(i->alignment_power);
- printf(" ");
+ fprintf(config.map_file, " ");
if (in->ifile) {
bfd *abfd = in->ifile->the_bfd;
if (in->ifile->just_syms_flag == true) {
- printf("symbols only ");
+ fprintf(config.map_file, "symbols only ");
}
- printf(" %s ",abfd->xvec->name);
+ fprintf(config.map_file, " %s ",abfd->xvec->name);
if(abfd->my_archive != (bfd *)NULL) {
- printf("[%s]%s", abfd->my_archive->filename,
+ fprintf(config.map_file, "[%s]%s", abfd->my_archive->filename,
abfd->filename);
}
else {
- printf("%s", abfd->filename);
+ fprintf(config.map_file, "%s", abfd->filename);
}
- printf("(overhead %d bytes)", (int)bfd_alloc_size(abfd));
+ fprintf(config.map_file, "(overhead %d bytes)", (int)bfd_alloc_size(abfd));
print_nl();
/* Find all the symbols in this file defined in this section */
@@ -1075,7 +1073,7 @@ DEFUN(print_input_section,(in),
print_dot = outside_section_address(i) + size;
}
else {
- printf("No output section allocated\n");
+ fprintf(config.map_file, "No output section allocated\n");
}
}
}
@@ -1084,7 +1082,7 @@ static void
DEFUN(print_fill_statement,(fill),
lang_fill_statement_type *fill)
{
- printf("FILL mask ");
+ fprintf(config.map_file, "FILL mask ");
print_fill( fill->fill);
}
@@ -1105,22 +1103,22 @@ DEFUN(print_data_statement,(data),
print_space();
switch (data->type) {
case BYTE :
- printf("BYTE ");
+ fprintf(config.map_file, "BYTE ");
print_dot += BYTE_SIZE;
break;
case SHORT:
- printf("SHORT ");
+ fprintf(config.map_file, "SHORT ");
print_dot += SHORT_SIZE;
break;
case LONG:
- printf("LONG ");
+ fprintf(config.map_file, "LONG ");
print_dot += LONG_SIZE;
break;
}
- exp_print_tree(stdout, data->exp);
+ exp_print_tree(data->exp);
- printf("\n");
+ fprintf(config.map_file, "\n");
}
@@ -1145,18 +1143,18 @@ DEFUN(print_wild_statement,(w,os),
lang_wild_statement_type *w AND
lang_output_section_statement_type *os)
{
- printf(" from ");
+ fprintf(config.map_file, " from ");
if (w->filename != (char *)NULL) {
- printf("%s",w->filename);
+ fprintf(config.map_file, "%s",w->filename);
}
else {
- printf("*");
+ fprintf(config.map_file, "*");
}
if (w->section_name != (char *)NULL) {
- printf("(%s)",w->section_name);
+ fprintf(config.map_file, "(%s)",w->section_name);
}
else {
- printf("(*)");
+ fprintf(config.map_file, "(*)");
}
print_nl();
print_statement(w->children.head, os);
@@ -1172,22 +1170,22 @@ DEFUN(print_statement,(s, os),
switch (s->header.type)
{
case lang_constructors_statement_enum:
- printf("constructors:\n");
+ fprintf(config.map_file, "constructors:\n");
print_statement(constructor_list.head, os);
break;
case lang_wild_statement_enum:
print_wild_statement(&s->wild_statement, os);
break;
default:
- printf("Fail with %d\n",s->header.type);
+ fprintf(config.map_file, "Fail with %d\n",s->header.type);
FAIL();
break;
case lang_address_statement_enum:
- printf("address\n");
+ fprintf(config.map_file, "address\n");
break;
break;
case lang_object_symbols_statement_enum:
- printf("object symbols\n");
+ fprintf(config.map_file, "object symbols\n");
break;
case lang_fill_statement_enum:
print_fill_statement(&s->fill_statement);
@@ -1209,10 +1207,10 @@ DEFUN(print_statement,(s, os),
os);
break;
case lang_target_statement_enum:
- printf("TARGET(%s)\n", s->target_statement.target);
+ fprintf(config.map_file, "TARGET(%s)\n", s->target_statement.target);
break;
case lang_output_statement_enum:
- printf("OUTPUT(%s %s)\n",
+ fprintf(config.map_file, "OUTPUT(%s %s)\n",
s->output_statement.name,
output_target);
break;
@@ -2005,7 +2003,7 @@ DEFUN_VOID(lang_common)
if (write_map)
{
- printf ("Allocating common %s: %x at %x %s\n",
+ fprintf (config.map_file, "Allocating common %s: %x at %x %s\n",
lgs->name,
(unsigned) size,
(unsigned) com->value,
diff --git a/ld/ldsym.c b/ld/ldsym.c
index 5d75c69..e6b7afc 100644
--- a/ld/ldsym.c
+++ b/ld/ldsym.c
@@ -70,6 +70,8 @@ extern discard_locals_type discard_locals;
ldsym_type *symbol_head = (ldsym_type *)NULL;
ldsym_type **symbol_tail_ptr = &symbol_head;
+extern ld_config_type config;
+
/*
incremented for each symbol in the ldsym_type table
no matter what flavour it is
@@ -192,9 +194,9 @@ list_file_locals (entry)
lang_input_statement_type *entry;
{
asymbol **q;
- printf ( "\nLocal symbols of ");
- info("%I", entry);
- printf (":\n\n");
+ fprintf (config.map_file, "\nLocal symbols of ");
+ minfo("%I", entry);
+ fprintf (config.map_file, ":\n\n");
if (entry->asymbols) {
for (q = entry->asymbols; *q; q++)
{
@@ -209,13 +211,13 @@ lang_input_statement_type *entry;
static void
-print_file_stuff(f)
-lang_input_statement_type *f;
+DEFUN(print_file_stuff,(f),
+ lang_input_statement_type *f)
{
- fprintf (stdout, " %s\n", f->filename);
+ fprintf (config.map_file," %s\n", f->filename);
if (f->just_syms_flag)
{
- fprintf (stdout, " symbols only\n");
+ fprintf (config.map_file, " symbols only\n");
}
else
{
@@ -227,14 +229,14 @@ lang_input_statement_type *f;
print_address(s->output_offset);
if (s->flags & SEC_HAS_CONTENTS)
{
- printf (" %08x 2**%2ud %s\n",
+ fprintf (config.map_file, " %08x 2**%2ud %s\n",
(unsigned)bfd_get_section_size_after_reloc(s),
s->alignment_power, s->name);
}
else
{
- printf (" %08x 2**%2ud %s\n",
+ fprintf (config.map_file, " %08x 2**%2ud %s\n",
(unsigned)bfd_get_section_size_before_reloc(s),
s->alignment_power, s->name);
}
@@ -247,32 +249,32 @@ lang_input_statement_type *f;
for (s = f->the_bfd->sections;
s != (asection *)NULL;
s = s->next) {
- printf("%s ", s->name);
+ fprintf(config.map_file, "%s ", s->name);
print_address(s->output_offset);
- printf("(%x)", (unsigned)bfd_get_section_size_after_reloc(s));
+ fprintf(config.map_file, "(%x)", (unsigned)bfd_get_section_size_after_reloc(s));
}
- printf("hex \n");
+ fprintf(config.map_file, "hex \n");
}
}
- fprintf (stdout, "\n");
+ fprintf (config.map_file, "\n");
}
void
ldsym_print_symbol_table ()
{
- fprintf (stdout, "**FILES**\n\n");
+ fprintf (config.map_file, "**FILES**\n\n");
lang_for_each_file(print_file_stuff);
- fprintf(stdout, "**GLOBAL SYMBOLS**\n\n");
- fprintf(stdout, "offset section offset symbol\n");
+ fprintf(config.map_file, "**GLOBAL SYMBOLS**\n\n");
+ fprintf(config.map_file, "offset section offset symbol\n");
{
register ldsym_type *sp;
for (sp = symbol_head; sp; sp = sp->next)
{
if (sp->flags & SYM_INDIRECT) {
- fprintf(stdout,"indirect %s to %s\n",
+ fprintf(config.map_file,"indirect %s to %s\n",
sp->name, (((ldsym_type *)(sp->sdefs_chain))->name));
}
else {
@@ -283,7 +285,7 @@ ldsym_print_symbol_table ()
print_address(defsym->value);
if (defsec)
{
- printf(" %-10s",
+ fprintf(config.map_file, " %-10s",
bfd_section_name(output_bfd,
defsec));
print_space();
@@ -292,23 +294,23 @@ ldsym_print_symbol_table ()
}
else
{
- printf(" .......");
+ fprintf(config.map_file, " .......");
}
}
if (sp->scoms_chain) {
- printf("common ");
+ fprintf(config.map_file, "common ");
print_address((*(sp->scoms_chain))->value);
- printf(" %s ",sp->name);
+ fprintf(config.map_file, " %s ",sp->name);
}
else if (sp->sdefs_chain) {
- printf(" %s ",sp->name);
+ fprintf(config.map_file, " %s ",sp->name);
}
else {
- printf("undefined ");
- printf("%s ",sp->name);
+ fprintf(config.map_file, "undefined ");
+ fprintf(config.map_file, "%s ",sp->name);
}
}