2000-08-01 Kazu Hirata <kazu@hxi.com>

* config/obj-som.c: Fix formatting.
	* config/obj-ieee.c: Likewise.
	* config/tc-arm.c: Likewise.
	* config/tc-v850.c: Likewise.
This commit is contained in:
Kazu Hirata 2000-08-01 19:02:49 +00:00
parent a570e63968
commit 28e4f854cf
5 changed files with 1957 additions and 1815 deletions

View File

@ -1,3 +1,10 @@
2000-08-01 Kazu Hirata <kazu@hxi.com>
* config/obj-som.c: Fix formatting.
* config/obj-ieee.c: Likewise.
* config/tc-arm.c: Likewise.
* config/tc-v850.c: Likewise.
2000-08-01 Nick Clifton <nickc@redhat.com> 2000-08-01 Nick Clifton <nickc@redhat.com>
* doc/c-m68k.texi (section M680x0 Options): Turn into a table * doc/c-m68k.texi (section M680x0 Options): Turn into a table

View File

@ -1,5 +1,6 @@
/* obj-format for ieee-695 records. /* obj-format for ieee-695 records.
Copyright (C) 1991, 92, 93, 94, 95, 1997, 1998 Free Software Foundation, Inc. Copyright (C) 1991, 92, 93, 94, 95, 97, 98, 2000
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@ -18,17 +19,10 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */ 02111-1307, USA. */
/* Created by Steve Chamberlain <steve@cygnus.com>. */
/* /* This will hopefully become the port through which bfd and gas talk,
created by for the moment, only ieee is known to work well. */
steve chamberlain steve@cygnus.com
*/
/*
this will hopefully become the port through which bfd and gas talk,
for the moment, only ieee is known to work well.
*/
#include "bfd.h" #include "bfd.h"
#include "as.h" #include "as.h"
@ -39,10 +33,14 @@
bfd *abfd; bfd *abfd;
/* How many addresses does the .align take? */ /* How many addresses does the .align take? */
static relax_addressT static relax_addressT
relax_align (address, alignment) relax_align (address, alignment)
register relax_addressT address; /* Address now. */ /* Address now. */
register long alignment; /* Alignment (binary). */ register relax_addressT address;
/* Alignment (binary). */
register long alignment;
{ {
relax_addressT mask; relax_addressT mask;
relax_addressT new_address; relax_addressT new_address;
@ -50,18 +48,20 @@ relax_align (address, alignment)
mask = ~((~0) << alignment); mask = ~((~0) << alignment);
new_address = (address + mask) & (~mask); new_address = (address + mask) & (~mask);
return (new_address - address); return (new_address - address);
} /* relax_align() */ }
/* Calculate the size of the frag chain
and create a bfd section to contain all of it. */
/* calculate the size of the frag chain and create a bfd section
to contain all of it */
static void static void
size_section (abfd, idx) size_section (abfd, idx)
bfd * abfd; bfd *abfd;
unsigned int idx; unsigned int idx;
{ {
asection *sec; asection *sec;
unsigned int size = 0; unsigned int size = 0;
fragS *frag = segment_info[idx].frag_root; fragS *frag = segment_info[idx].frag_root;
while (frag) while (frag)
{ {
if (frag->fr_address != size) if (frag->fr_address != size)
@ -92,25 +92,28 @@ size_section (abfd, idx)
if (size) if (size)
{ {
char *name = segment_info[idx].name; char *name = segment_info[idx].name;
if (name == (char *) NULL) if (name == (char *) NULL)
{
name = ".data"; name = ".data";
}
segment_info[idx].user_stuff = (char *) (sec = bfd_make_section (abfd, name)); segment_info[idx].user_stuff =
/* Make it output through itself */ (char *) (sec = bfd_make_section (abfd, name));
/* Make it output through itself. */
sec->output_section = sec; sec->output_section = sec;
sec->flags |= SEC_HAS_CONTENTS; sec->flags |= SEC_HAS_CONTENTS;
bfd_set_section_size (abfd, sec, size); bfd_set_section_size (abfd, sec, size);
} }
} }
/* run through a frag chain and write out the data to go with it */ /* Run through a frag chain and write out the data to go with it. */
static void static void
fill_section (abfd, idx) fill_section (abfd, idx)
bfd * abfd; bfd *abfd;
unsigned int idx; unsigned int idx;
{ {
asection *sec = segment_info[idx].user_stuff; asection *sec = segment_info[idx].user_stuff;
if (sec) if (sec)
{ {
fragS *frag = segment_info[idx].frag_root; fragS *frag = segment_info[idx].frag_root;
@ -156,7 +159,7 @@ fill_section (abfd, idx)
} }
} }
/* Count the relocations in a chain */ /* Count the relocations in a chain. */
static unsigned int static unsigned int
count_entries_in_chain (idx) count_entries_in_chain (idx)
@ -165,7 +168,7 @@ count_entries_in_chain (idx)
unsigned int nrelocs; unsigned int nrelocs;
fixS *fixup_ptr; fixS *fixup_ptr;
/* Count the relocations */ /* Count the relocations. */
fixup_ptr = segment_info[idx].fix_root; fixup_ptr = segment_info[idx].fix_root;
nrelocs = 0; nrelocs = 0;
while (fixup_ptr != (fixS *) NULL) while (fixup_ptr != (fixS *) NULL)
@ -176,7 +179,8 @@ count_entries_in_chain (idx)
return nrelocs; return nrelocs;
} }
/* output all the relocations for a section */ /* Output all the relocations for a section. */
void void
do_relocs_for (idx) do_relocs_for (idx)
unsigned int idx; unsigned int idx;
@ -188,11 +192,13 @@ do_relocs_for (idx)
asection *section = (asection *) (segment_info[idx].user_stuff); asection *section = (asection *) (segment_info[idx].user_stuff);
unsigned int i; unsigned int i;
fixS *from; fixS *from;
if (section) if (section)
{ {
nrelocs = count_entries_in_chain (idx); nrelocs = count_entries_in_chain (idx);
reloc_ptr_vector = (arelent **) malloc ((nrelocs + 1) * sizeof (arelent *)); reloc_ptr_vector =
(arelent **) malloc ((nrelocs + 1) * sizeof (arelent *));
reloc_vector = (arelent *) malloc (nrelocs * sizeof (arelent)); reloc_vector = (arelent *) malloc (nrelocs * sizeof (arelent));
ptrs = (asymbol **) malloc (nrelocs * sizeof (asymbol *)); ptrs = (asymbol **) malloc (nrelocs * sizeof (asymbol *));
from = segment_info[idx].fix_root; from = segment_info[idx].fix_root;
@ -203,8 +209,10 @@ do_relocs_for (idx)
reloc_ptr_vector[i] = to; reloc_ptr_vector[i] = to;
to->howto = (reloc_howto_type *) (from->fx_r_type); to->howto = (reloc_howto_type *) (from->fx_r_type);
#if 0 /* We can't represent complicated things in a reloc yet */ #if 0
if (from->fx_addsy == 0 || from->fx_subsy != 0) abort(); /* We can't represent complicated things in a reloc yet. */
if (from->fx_addsy == 0 || from->fx_subsy != 0)
abort ();
#endif #endif
s = &(from->fx_addsy->sy_symbol.sy); s = &(from->fx_addsy->sy_symbol.sy);
@ -233,11 +241,10 @@ do_relocs_for (idx)
to->sym_ptr_ptr = 0; to->sym_ptr_ptr = 0;
if (to->howto->pcrel_offset) if (to->howto->pcrel_offset)
{ /* This is a pcrel relocation, the addend should
/* This is a pcrel relocation, the addend should be adjusted */ be adjusted. */
to->addend -= to->address + 1; to->addend -= to->address + 1;
} }
}
else else
{ {
to->section = 0; to->section = 0;
@ -245,33 +252,30 @@ do_relocs_for (idx)
to->sym_ptr_ptr = ptrs; to->sym_ptr_ptr = ptrs;
if (to->howto->pcrel_offset) if (to->howto->pcrel_offset)
{ /* This is a pcrel relocation, the addend should
/* This is a pcrel relocation, the addend should be adjusted */ be adjusted. */
to->addend -= to->address - 1; to->addend -= to->address - 1;
} }
} }
}
else else
{
to->section = 0; to->section = 0;
}
ptrs++; ptrs++;
from = from->fx_next; from = from->fx_next;
} }
/* attatch to the section */ /* Attatch to the section. */
section->orelocation = reloc_ptr_vector; section->orelocation = reloc_ptr_vector;
section->reloc_count = nrelocs; section->reloc_count = nrelocs;
section->flags |= SEC_LOAD; section->flags |= SEC_LOAD;
} }
} }
/* do the symbols.. */ /* Do the symbols. */
static void static void
do_symbols (abfd) do_symbols (abfd)
bfd * abfd; bfd *abfd;
{ {
extern symbolS *symbol_rootP; extern symbolS *symbol_rootP;
symbolS *ptr; symbolS *ptr;
@ -280,7 +284,6 @@ do_symbols (abfd)
unsigned int count = 0; unsigned int count = 0;
unsigned int index; unsigned int index;
for (ptr = symbol_rootP; for (ptr = symbol_rootP;
ptr != (symbolS *) NULL; ptr != (symbolS *) NULL;
ptr = ptr->sy_next) ptr = ptr->sy_next)
@ -291,10 +294,8 @@ do_symbols (abfd)
(asection *) (segment_info[ptr->sy_symbol.seg].user_stuff); (asection *) (segment_info[ptr->sy_symbol.seg].user_stuff);
S_SET_VALUE (ptr, S_GET_VALUE (ptr) + ptr->sy_frag->fr_address); S_SET_VALUE (ptr, S_GET_VALUE (ptr) + ptr->sy_frag->fr_address);
if (ptr->sy_symbol.sy.flags == 0) if (ptr->sy_symbol.sy.flags == 0)
{
ptr->sy_symbol.sy.flags = BSF_LOCAL; ptr->sy_symbol.sy.flags = BSF_LOCAL;
} }
}
else else
{ {
switch (ptr->sy_symbol.seg) switch (ptr->sy_symbol.seg)
@ -330,7 +331,7 @@ do_symbols (abfd)
} }
/* The generic as->bfd converter. Other backends may have special case /* The generic as->bfd converter. Other backends may have special case
code */ code. */
void void
bfd_as_write_hook () bfd_as_write_hook ()
@ -338,10 +339,7 @@ bfd_as_write_hook ()
int i; int i;
for (i = SEG_E0; i < SEG_UNKNOWN; i++) for (i = SEG_E0; i < SEG_UNKNOWN; i++)
{
size_section (abfd, i); size_section (abfd, i);
}
for (i = SEG_E0; i < SEG_UNKNOWN; i++) for (i = SEG_E0; i < SEG_UNKNOWN; i++)
fill_section (abfd, i); fill_section (abfd, i);
@ -350,7 +348,6 @@ bfd_as_write_hook ()
for (i = SEG_E0; i < SEG_UNKNOWN; i++) for (i = SEG_E0; i < SEG_UNKNOWN; i++)
do_relocs_for (i); do_relocs_for (i);
} }
S_SET_SEGMENT (x, y) S_SET_SEGMENT (x, y)
@ -437,7 +434,8 @@ obj_ieee_section (ignore)
char *p = input_line_pointer; char *p = input_line_pointer;
char *s = p; char *s = p;
int i; int i;
/* Look up the name, if it doesn't exist, make it */
/* Look up the name, if it doesn't exist, make it. */
while (*p && *p != ' ' && *p != ',' && !is_end_of_line[*p]) while (*p && *p != ' ' && *p != ',' && !is_end_of_line[*p])
{ {
p++; p++;
@ -447,10 +445,7 @@ obj_ieee_section (ignore)
if (segment_info[i].hadone) if (segment_info[i].hadone)
{ {
if (strncmp (segment_info[i].name, s, p - s) == 0) if (strncmp (segment_info[i].name, s, p - s) == 0)
{
goto ok; goto ok;
}
} }
else else
break; break;
@ -470,32 +465,26 @@ ok:
while (!is_end_of_line[*p]) while (!is_end_of_line[*p])
p++; p++;
input_line_pointer = p; input_line_pointer = p;
} }
void cons (); void cons ();
void s_ignore (); void s_ignore ();
void s_globl (); void s_globl ();
const pseudo_typeS obj_pseudo_table[] = const pseudo_typeS obj_pseudo_table[] =
{ {
{"section", obj_ieee_section, 0}, {"section", obj_ieee_section, 0},
{"data.b", cons, 1}, {"data.b" , cons , 1},
{"data.w", cons, 2}, {"data.w" , cons , 2},
{"data.l", cons, 4}, {"data.l" , cons , 4},
{"export", s_globl, 0}, {"export" , s_globl , 0},
{"option", s_ignore, 0}, {"option" , s_ignore , 0},
{"end", s_ignore, 0}, {"end" , s_ignore , 0},
{"import", s_ignore, 0}, {"import" , s_ignore , 0},
{"sdata", stringer, 0}, {"sdata" , stringer , 0},
0, 0,
}; };
void void
obj_symbol_new_hook (symbolP) obj_symbol_new_hook (symbolP)
symbolS *symbolP; symbolS *symbolP;
@ -503,10 +492,6 @@ obj_symbol_new_hook (symbolP)
symbolP->sy_symbol.sy.the_bfd = abfd; symbolP->sy_symbol.sy.the_bfd = abfd;
} }
#if 1 #if 1
extern void extern void
write_object_file () write_object_file ()
@ -531,10 +516,10 @@ write_object_file ()
frchain_ptr != (struct frchain *) NULL; frchain_ptr != (struct frchain *) NULL;
frchain_ptr = frchain_ptr->frch_next) frchain_ptr = frchain_ptr->frch_next)
{ {
/* Run through all the sub-segments and align them up. Also close any /* Run through all the sub-segments and align them up. Also
open frags. We tack a .fill onto the end of the frag chain so close any open frags. We tack a .fill onto the end of the
that any .align's size can be worked by looking at the next frag chain so that any .align's size can be worked by looking
frag. */ at the next frag. */
subseg_set (frchain_ptr->frch_seg, frchain_ptr->frch_subseg); subseg_set (frchain_ptr->frch_seg, frchain_ptr->frch_subseg);
#ifndef SUB_SEGMENT_ALIGN #ifndef SUB_SEGMENT_ALIGN
@ -550,15 +535,16 @@ write_object_file ()
fr_next. */ fr_next. */
for (i = SEG_E0; i < SEG_UNKNOWN; i++) for (i = SEG_E0; i < SEG_UNKNOWN; i++)
{ {
fragS **prev_frag_ptr_ptr; fragS **prev_frag_ptr_ptr;
struct frchain *next_frchain_ptr; struct frchain *next_frchain_ptr;
/* struct frag **head_ptr = segment_info[i].frag_root;*/ #if 0
struct frag **head_ptr = segment_info[i].frag_root;
#endif
segment_info[i].frag_root = segment_info[i].frchainP->frch_root; segment_info[i].frag_root = segment_info[i].frchainP->frch_root;
#if 0 #if 0
/* Im not sure what this is for */ /* I'm not sure what this is for. */
for (frchain_ptr = segment_info[i].frchainP->frch_root; for (frchain_ptr = segment_info[i].frchainP->frch_root;
frchain_ptr != (struct frchain *) NULL; frchain_ptr != (struct frchain *) NULL;
frchain_ptr = frchain_ptr->frch_next) frchain_ptr = frchain_ptr->frch_next)
@ -566,17 +552,13 @@ write_object_file ()
*head_ptr = frchain_ptr; *head_ptr = frchain_ptr;
head_ptr = &frchain_ptr->next; head_ptr = &frchain_ptr->next;
} }
#endif #endif
} }
for (i = SEG_E0; i < SEG_UNKNOWN; i++) for (i = SEG_E0; i < SEG_UNKNOWN; i++)
{
relax_segment (segment_info[i].frag_root, i); relax_segment (segment_info[i].frag_root, i);
}
/* Now the addresses of the frags are correct within the segment */ /* Now the addresses of the frags are correct within the segment. */
bfd_as_write_hook (); bfd_as_write_hook ();
bfd_close (abfd); bfd_close (abfd);
@ -623,5 +605,3 @@ H_GET_TEXT_RELOCATION_SIZE ()
{ {
abort (); abort ();
} }
/* end of obj-ieee.c */

View File

@ -1,5 +1,5 @@
/* SOM object file format. /* SOM object file format.
Copyright (C) 1993, 1998 Free Software Foundation, Inc. Copyright (C) 1993, 1998, 2000 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@ -39,12 +39,16 @@ static int copyright_seen = 0;
static int compiler_seen = 0; static int compiler_seen = 0;
/* Unused by SOM. */ /* Unused by SOM. */
void obj_read_begin_hook () {}
void
obj_read_begin_hook ()
{
}
/* Handle a .compiler directive. This is intended to create the /* Handle a .compiler directive. This is intended to create the
compilation unit auxiliary header for MPE such that the linkeditor compilation unit auxiliary header for MPE such that the linkeditor
can handle SOM extraction from archives. The format of the quoted can handle SOM extraction from archives. The format of the quoted
string is "sourcefile language version" and is delimited by blanks.*/ string is "sourcefile language version" and is delimited by blanks. */
void void
obj_som_compiler (unused) obj_som_compiler (unused)
@ -95,7 +99,8 @@ obj_som_compiler (unused)
*p = '\000'; *p = '\000';
language_name = ++p; language_name = ++p;
while (*p != ' ' && *p != '\000') p++; while (*p != ' ' && *p != '\000')
p++;
if (*p == '\000') if (*p == '\000')
{ {
as_bad (".compiler directive missing version"); as_bad (".compiler directive missing version");
@ -104,7 +109,8 @@ obj_som_compiler (unused)
*p = '\000'; *p = '\000';
version_id = ++p; version_id = ++p;
while (*p != '\000') p++; while (*p != '\000')
p++;
/* Remove the trailing quote. */ /* Remove the trailing quote. */
*(--p) = '\000'; *(--p) = '\000';
@ -155,7 +161,8 @@ obj_som_version (unused)
if (bfd_som_attach_aux_hdr (stdoutput, VERSION_AUX_ID, version) == false) if (bfd_som_attach_aux_hdr (stdoutput, VERSION_AUX_ID, version) == false)
{ {
bfd_perror (stdoutput->filename); bfd_perror (stdoutput->filename);
as_perror (_("FATAL: Attaching version header %s"), stdoutput->filename); as_perror (_("FATAL: Attaching version header %s"),
stdoutput->filename);
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
*input_line_pointer = c; *input_line_pointer = c;
@ -200,7 +207,8 @@ obj_som_copyright (unused)
if (bfd_som_attach_aux_hdr (stdoutput, COPYRIGHT_AUX_ID, copyright) == false) if (bfd_som_attach_aux_hdr (stdoutput, COPYRIGHT_AUX_ID, copyright) == false)
{ {
bfd_perror (stdoutput->filename); bfd_perror (stdoutput->filename);
as_perror (_("FATAL: Attaching copyright header %s"), stdoutput->filename); as_perror (_("FATAL: Attaching copyright header %s"),
stdoutput->filename);
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
*input_line_pointer = c; *input_line_pointer = c;
@ -337,4 +345,3 @@ obj_som_weak (ignore)
while (c == ','); while (c == ',');
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff