aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1993-09-13 21:32:07 +0000
committerIan Lance Taylor <ian@airs.com>1993-09-13 21:32:07 +0000
commit604633aeca413d9fe75280b214894721f8186315 (patch)
tree84f5270da91f3afd187d29e3dc1e512674d74cf2 /gas
parent37c99ddb4ef28794e0f9cc37f02e239a1adaf881 (diff)
downloadfsf-binutils-gdb-604633aeca413d9fe75280b214894721f8186315.zip
fsf-binutils-gdb-604633aeca413d9fe75280b214894721f8186315.tar.gz
fsf-binutils-gdb-604633aeca413d9fe75280b214894721f8186315.tar.bz2
* subsegs.c: Renamed non-BFD_ASSEMBLER subseg_new to subseg_set.
Wrote non-BFD_ASSEMBLER subseg_new. Now subseg_new always takes a section name, and subseg_set always takes a segT. Changed all callers as appropriate. * config/obj-coffbfd.c (change_to_section): Renamed to obj_coff_add_segment. Corrected. Made callers use subseg_new. * config/obj-coffbfd.h (obj_segment_name, obj_add_segment): Define. Also some more gcc warning removal.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog41
-rw-r--r--gas/as.h16
-rw-r--r--gas/config/obj-aout.c22
-rw-r--r--gas/config/obj-coffbfd.c202
-rw-r--r--gas/config/obj-coffbfd.h40
-rw-r--r--gas/config/obj-elf.c83
-rw-r--r--gas/config/obj-ieee.c10
-rw-r--r--gas/config/obj-vms.c2
-rw-r--r--gas/config/tc-a29k.c31
-rw-r--r--gas/config/tc-i960.c7
-rw-r--r--gas/config/tc-m88k.c4
-rw-r--r--gas/config/tc-mips.c40
-rw-r--r--gas/read.c155
-rw-r--r--gas/subsegs.c594
-rw-r--r--gas/symbols.c16
-rw-r--r--gas/write.h13
16 files changed, 729 insertions, 547 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index d986124..ca0ff4d 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,44 @@
+Mon Sep 13 16:48:38 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
+
+ * read.c (s_desc): Only compile and use if S_SET_DESC is defined.
+ * struc-symbol.h: Declare verify_symbol_chain and
+ verify_symbol_chain_2 even if not SYMBOLS_NEED_BACKPOINTERS.
+ * symbols.c (verify_symbol_chain): Removed useless expression.
+ * write.c (headers, the_object_file): Only use if not
+ BFD_ASSEMBLER and not BFD.
+ (fixup_segment, cvs_frag_to_fill): Only use if BFD_ASSEMBLER or
+ not BFD.
+ (merge_data_into_text): Only use if BFD_ASSEMBLER or (not BFD and
+ not OBJ_AOUT).
+ * write.h: Declare relax_segment.
+ * config/obj-coffbfd.c (stack_pop, stack_push, stack_init): Made
+ static.
+ (stack_top): Commented out, since it's not used.
+ Fixed up pseudo-op functions to take an ignored int argument.
+ (size_section): Added default BAD_CASE to switch.
+ Changed bzero calls to memset.
+ * config/obj-coffbfd.h (S_IS_LOCAL): Call strchr on S_GET_NAME
+ (s), not on s itself.
+ * config/tc-a29k.c (s_use): Take ignored int argument. Only
+ define if OBJ_COFF is not defined.
+ * config/tc-i386.c: (fits_in_signed_byte, smallest_imm_type): Make
+ argument signed again.
+ * config/tc-m68k.c (s_bss, s_even, s_proc): Take ignored int
+ argument.
+ (m68k_ip): Fully bracket initialization of archs.
+ Correct several formats for __LINE__ to be %d rather than %s.
+ (init_table): Fully bracket initialization.
+ Cast values larger than 0x7f assigned to fr_opcode to char.
+
+ * subsegs.c: Renamed non-BFD_ASSEMBLER subseg_new to subseg_set.
+ Wrote non-BFD_ASSEMBLER subseg_new. Now subseg_new always takes a
+ section name, and subseg_set always takes a segT. Changed all
+ callers as appropriate.
+ * config/obj-coffbfd.c (change_to_section): Renamed to
+ obj_coff_add_segment. Corrected. Made callers use subseg_new.
+ * config/obj-coffbfd.h (obj_segment_name, obj_add_segment):
+ Define.
+
Mon Sep 13 13:15:03 1993 Doug Evans (dje@canuck.cygnus.com)
* config/tc-sparc.h (LOCAL_LABEL): Remove test for name[0] == 'L'.
diff --git a/gas/as.h b/gas/as.h
index dadbcf0..72c9bca 100644
--- a/gas/as.h
+++ b/gas/as.h
@@ -339,7 +339,7 @@ struct _pseudo_type
/* assembler mnemonic, lower case, no '.' */
char *poc_name;
/* Do the work */
- void (*poc_handler) ();
+ void (*poc_handler) PARAMS ((int));
/* Value to pass to handler */
int poc_val;
};
@@ -379,6 +379,7 @@ void sprint_value PARAMS ((char *buf, addressT value));
int had_errors PARAMS ((void));
int had_warnings PARAMS ((void));
+void print_version_id PARAMS ((void));
char *app_push PARAMS ((void));
char *atof_ieee PARAMS ((char *str, int what_kind, LITTLENUM_TYPE * words));
char *input_scrub_include_file PARAMS ((char *filename, char *position));
@@ -387,17 +388,14 @@ char *input_scrub_next_buffer PARAMS ((char **bufp));
#if 0 /* incompatible with solaris 2 native cc */
char *strstr PARAMS ((const char *s, const char *wanted));
#endif
-char *xmalloc PARAMS ((long size));
-char *xrealloc PARAMS ((char *ptr, long n));
-int do_scrub_next_char PARAMS ((int (*get) (), void (*unget) ()));
+char *xmalloc PARAMS ((unsigned long size));
+char *xrealloc PARAMS ((char *ptr, unsigned long n));
+int do_scrub_next_char PARAMS ((int (*get) (void), void (*unget) (int)));
int gen_to_words PARAMS ((LITTLENUM_TYPE * words, int precision,
long exponent_bits));
int had_err PARAMS ((void));
-int had_errors PARAMS ((void));
-int had_warnings PARAMS ((void));
int ignore_input PARAMS ((void));
int scrub_from_file PARAMS ((void));
-int scrub_from_file PARAMS ((void));
int scrub_from_string PARAMS ((void));
int seen_at_least_1_file PARAMS ((void));
void app_pop PARAMS ((char *arg));
@@ -415,12 +413,8 @@ void scrub_to_file PARAMS ((int ch));
void scrub_to_string PARAMS ((int ch));
void subsegs_begin PARAMS ((void));
void subseg_change PARAMS ((segT seg, int subseg));
-#ifdef BFD_ASSEMBLER
segT subseg_new PARAMS ((const char *name, subsegT subseg));
void subseg_set PARAMS ((segT seg, subsegT subseg));
-#else
-void subseg_new PARAMS ((segT seg, subsegT subseg));
-#endif
/* this one starts the chain of target dependant headers */
#include "targ-env.h"
diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c
index b43826f..2d7d2ca 100644
--- a/gas/config/obj-aout.c
+++ b/gas/config/obj-aout.c
@@ -19,7 +19,9 @@ to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "as.h"
#include "aout/stab_gnu.h"
+#ifdef BFD_ASSEMBLER
#include "aout/aout64.h"
+#endif
#include "obstack.h"
#ifndef BFD_ASSEMBLER
@@ -60,8 +62,8 @@ const segT N_TYPE_seg[N_TYPE + 2] =
#endif
static void obj_aout_stab PARAMS ((int what));
-static void obj_aout_line PARAMS ((void));
-static void obj_aout_desc PARAMS ((void));
+static void obj_aout_line PARAMS ((int));
+static void obj_aout_desc PARAMS ((int));
const pseudo_typeS obj_pseudo_table[] =
{
@@ -242,7 +244,8 @@ obj_emit_symbols (where, symbol_rootP)
#endif /* ! BFD_ASSEMBLER */
static void
-obj_aout_line ()
+obj_aout_line (ignore)
+ int ignore;
{
/* Assume delimiter is part of expression.
BSD4.2 as fails with delightful bug, so we
@@ -313,7 +316,7 @@ obj_aout_stab (what)
{
case 'd':
S_SET_NAME (symbolP, NULL); /* .stabd feature. */
- S_SET_VALUE (symbolP, (char*) obstack_next_free (&frags) - frag_now->fr_literal);
+ S_SET_VALUE (symbolP, (valueT) frag_now_fix ());
symbolP->sy_frag = frag_now;
break;
@@ -382,7 +385,7 @@ obj_aout_stab (what)
{
if (S_GET_TYPE (symbolP) == N_SLINE)
{
- listing_source_line (S_GET_DESC (symbolP));
+ listing_source_line ((unsigned int) S_GET_DESC (symbolP));
}
else if (S_GET_TYPE (symbolP) == N_SO || S_GET_TYPE (symbolP) == N_SOL)
{
@@ -398,7 +401,8 @@ obj_aout_stab (what)
} /* obj_aout_stab() */
static void
-obj_aout_desc ()
+obj_aout_desc (ignore)
+ int ignore;
{
register char *name;
register char c;
@@ -603,15 +607,15 @@ DEFUN_VOID (s_sect)
if (strcmp (section_name, ".text") == 0)
{
- subseg_new (SEG_TEXT, (subsegT) exp);
+ subseg_set (SEG_TEXT, (subsegT) exp);
}
if (strcmp (section_name, ".data") == 0)
{
if (flagseen['R'])
- subseg_new (SEG_TEXT, (subsegT) exp + 1000);
+ subseg_set (SEG_TEXT, (subsegT) exp + 1000);
else
- subseg_new (SEG_DATA, (subsegT) exp);
+ subseg_set (SEG_DATA, (subsegT) exp);
}
*section_name_end = c;
diff --git a/gas/config/obj-coffbfd.c b/gas/config/obj-coffbfd.c
index 85414ca..b224f05 100644
--- a/gas/config/obj-coffbfd.c
+++ b/gas/config/obj-coffbfd.c
@@ -134,30 +134,39 @@ static void EXFUN (w_symbols,
char *where,
symbolS * symbol_rootP));
+static char *stack_pop PARAMS ((stack * st));
+static char *stack_push PARAMS ((stack * st, char *element));
+#if 0
+static char *stack_top PARAMS ((stack * st));
+#endif
+static stack *stack_init PARAMS ((unsigned long chunk_size,
+ unsigned long element_size));
-static void EXFUN (obj_coff_def, (int what));
-static void EXFUN (obj_coff_lcomm, (void));
-static void EXFUN (obj_coff_dim, (void));
-static void EXFUN (obj_coff_text, (void));
-static void EXFUN (obj_coff_data, (void));
-static void EXFUN( obj_coff_bss,(void));
-static void EXFUN( obj_coff_ident,(void));
-static void EXFUN (obj_coff_endef, (void));
-static void EXFUN (obj_coff_line, (void));
-static void EXFUN (obj_coff_ln, (int));
-static void EXFUN (obj_coff_scl, (void));
-static void EXFUN (obj_coff_size, (void));
-static void EXFUN (obj_coff_tag, (void));
-static void EXFUN (obj_coff_type, (void));
-static void EXFUN (obj_coff_val, (void));
-void EXFUN (obj_coff_section, (void));
-static void EXFUN (tag_init, (void));
-static void EXFUN (tag_insert, (char *name, symbolS * symbolP));
+static void tag_init PARAMS ((void));
+static void tag_insert PARAMS ((char *name, symbolS * symbolP));
static struct hash_control *tag_hash;
+
static symbolS *def_symbol_in_progress = NULL;
+static void obj_coff_def PARAMS ((int));
+static void obj_coff_lcomm PARAMS ((int));
+static void obj_coff_dim PARAMS ((int));
+static void obj_coff_text PARAMS ((int));
+static void obj_coff_data PARAMS ((int));
+static void obj_coff_bss PARAMS ((int));
+static void obj_coff_ident PARAMS ((int));
+static void obj_coff_endef PARAMS ((int));
+static void obj_coff_line PARAMS ((int));
+static void obj_coff_ln PARAMS ((int));
+static void obj_coff_scl PARAMS ((int));
+static void obj_coff_size PARAMS ((int));
+static void obj_coff_tag PARAMS ((int));
+static void obj_coff_type PARAMS ((int));
+static void obj_coff_val PARAMS ((int));
+void obj_coff_section PARAMS ((int));
+
const pseudo_typeS obj_pseudo_table[] =
{
{"def", obj_coff_def, 0},
@@ -309,6 +318,10 @@ DEFUN (size_section, (abfd, idx),
case rs_align:
size += frag->fr_fix;
size += relax_align (size, frag->fr_offset);
+ break;
+ default:
+ BAD_CASE (frag->fr_type);
+ break;
}
frag = frag->fr_next;
}
@@ -696,7 +709,7 @@ obj_symbol_new_hook (symbolP)
/* Additional information */
symbolP->sy_symbol.ost_flags = 0;
/* Auxiliary entries */
- bzero ((char *) &symbolP->sy_symbol.ost_auxent[0], AUXESZ);
+ memset ((char *) &symbolP->sy_symbol.ost_auxent[0], 0, AUXESZ);
#ifdef STRIP_UNDERSCORE
/* Remove leading underscore at the beginning of the symbol.
@@ -718,7 +731,7 @@ obj_symbol_new_hook (symbolP)
} /* obj_symbol_new_hook() */
/* stack stuff */
-stack *
+static stack *
stack_init (chunk_size, element_size)
unsigned long chunk_size;
unsigned long element_size;
@@ -747,7 +760,7 @@ stack_delete (st)
free (st);
}
-char *
+static char *
stack_push (st, element)
stack *st;
char *element;
@@ -763,26 +776,28 @@ stack_push (st, element)
return st->data + st->pointer;
} /* stack_push() */
-char *
+static char *
stack_pop (st)
stack *st;
{
- if ((st->pointer -= st->element_size) < 0)
+ if (st->pointer < st->element_size)
{
st->pointer = 0;
return (char *) 0;
}
-
+ st->pointer -= st->element_size;
return st->data + st->pointer;
}
-char *
+#if 0
+/* Not used. */
+static char *
stack_top (st)
stack *st;
{
return st->data + st->pointer - st->element_size;
}
-
+#endif
/*
* Handle .ln directives.
@@ -863,7 +878,7 @@ DEFUN (obj_coff_def, (what),
SKIP_WHITESPACES ();
def_symbol_in_progress = (symbolS *) obstack_alloc (&notes, sizeof (*def_symbol_in_progress));
- bzero (def_symbol_in_progress, sizeof (*def_symbol_in_progress));
+ memset (def_symbol_in_progress, 0, sizeof (*def_symbol_in_progress));
symbol_name = input_line_pointer;
name_end = get_symbol_end ();
@@ -897,8 +912,10 @@ DEFUN (obj_coff_def, (what),
} /* obj_coff_def() */
unsigned int dim_index;
+
static void
-DEFUN_VOID (obj_coff_endef)
+obj_coff_endef (ignore)
+ int ignore;
{
symbolS *symbolP = 0;
/* DIM BUG FIX sac@cygnus.com */
@@ -1066,7 +1083,8 @@ DEFUN_VOID (obj_coff_endef)
}
static void
-DEFUN_VOID (obj_coff_dim)
+obj_coff_dim (ignore)
+ int ignore;
{
register int dim_index;
@@ -1106,7 +1124,8 @@ DEFUN_VOID (obj_coff_dim)
} /* obj_coff_dim() */
static void
-obj_coff_line ()
+obj_coff_line (ignore)
+ int ignore;
{
int this_base;
@@ -1140,7 +1159,8 @@ obj_coff_line ()
} /* obj_coff_line() */
static void
-obj_coff_size ()
+obj_coff_size (ignore)
+ int ignore;
{
if (def_symbol_in_progress == NULL)
{
@@ -1156,7 +1176,8 @@ obj_coff_size ()
} /* obj_coff_size() */
static void
-obj_coff_scl ()
+obj_coff_scl (ignore)
+ int ignore;
{
if (def_symbol_in_progress == NULL)
{
@@ -1171,7 +1192,8 @@ obj_coff_scl ()
} /* obj_coff_scl() */
static void
-obj_coff_tag ()
+obj_coff_tag (ignore)
+ int ignore;
{
char *symbol_name;
char name_end;
@@ -1203,7 +1225,8 @@ obj_coff_tag ()
} /* obj_coff_tag() */
static void
-obj_coff_type ()
+obj_coff_type (ignore)
+ int ignore;
{
if (def_symbol_in_progress == NULL)
{
@@ -1225,7 +1248,8 @@ obj_coff_type ()
} /* obj_coff_type() */
static void
-obj_coff_val ()
+obj_coff_val (ignore)
+ int ignore;
{
if (def_symbol_in_progress == NULL)
{
@@ -1271,7 +1295,7 @@ obj_coff_val ()
/* FIXME: this is to avoid an error message in the
FIXME case mentioned just above. */
- while (! is_end_of_line[*input_line_pointer])
+ while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}
else
@@ -1299,7 +1323,7 @@ tag_insert (name, symbolP)
char *name;
symbolS *symbolP;
{
- register char *error_string;
+ register const char *error_string;
if (*(error_string = hash_jam (tag_hash, name, (char *) symbolP)))
{
@@ -1617,9 +1641,7 @@ DEFUN (crawl_symbols, (h, abfd),
object_headers *h AND
bfd * abfd)
{
-
unsigned int i;
- symbolS *symbolP;
/* Initialize the stack used to keep track of the matching .bb .be */
@@ -1823,7 +1845,7 @@ DEFUN_VOID (write_object_file)
that any .align's size can be worked by looking at the next
frag */
- subseg_new (frchain_ptr->frch_seg, frchain_ptr->frch_subseg);
+ subseg_set (frchain_ptr->frch_seg, frchain_ptr->frch_subseg);
#ifndef SUB_SEGMENT_ALIGN
#define SUB_SEGMENT_ALIGN(SEG) 1
#endif
@@ -1917,7 +1939,7 @@ DEFUN_VOID (write_object_file)
{
unsigned int symtable_size = H_GET_SYMBOL_TABLE_SIZE (&headers);
char *buffer1 = xmalloc (symtable_size + string_byte_count + 1);
- char *ptr = buffer1;
+
H_SET_SYMBOL_TABLE_POINTER (&headers, bfd_tell (abfd));
w_symbols (abfd, buffer1, symbol_rootP);
if (string_byte_count > 0)
@@ -1933,27 +1955,40 @@ DEFUN_VOID (write_object_file)
bfd_errmsg (bfd_error));
}
+/* Add a new segment. This is called from subseg_new via the
+ obj_new_segment macro. */
-static void
-DEFUN (change_to_section, (name, len, exp),
- char *name AND
- unsigned int len AND
- unsigned int exp)
+segT
+obj_coff_add_segment (name)
+ const char *name;
{
+ unsigned int len;
unsigned int i;
- /* Find out if we've already got a section of this name etc */
+
+ /* Find out if we've already got a section of this name. */
+ len = strlen (name);
+ if (len < sizeof (segment_info[i].scnhdr.s_name))
+ ++len;
+ else
+ len = sizeof (segment_info[i].scnhdr.s_name);
for (i = SEG_E0; i < SEG_E9 && segment_info[i].scnhdr.s_name[0]; i++)
+ if (strncmp (segment_info[i].scnhdr.s_name, name, len) == 0
+ && (len == sizeof (segment_info[i].scnhdr.s_name)
+ || segment_info[i].scnhdr.s_name[len] == '\0'))
+ return (segT) i;
+
+ if (i == SEG_E9)
{
- if (strncmp (segment_info[i].scnhdr.s_name, name, len) == 0)
- {
- subseg_new (i, exp);
- return;
- }
+ as_bad ("Too many new sections; can't add \"%s\"", name);
+ return now_seg;
}
- /* No section, add one */
- strncpy (segment_info[i].scnhdr.s_name, name, 8);
+
+ /* Add a new section. */
+ strncpy (segment_info[i].scnhdr.s_name, name,
+ sizeof (segment_info[i].scnhdr.s_name));
segment_info[i].scnhdr.s_flags = STYP_REG;
- subseg_new (i, exp);
+
+ return (segT) i;
}
/*
@@ -1973,7 +2008,8 @@ DEFUN (change_to_section, (name, len, exp),
*/
void
-DEFUN_VOID (obj_coff_section)
+obj_coff_section (ignore)
+ int ignore;
{
/* Strip out the section name */
char *section_name;
@@ -2012,7 +2048,7 @@ DEFUN_VOID (obj_coff_section)
{
++input_line_pointer;
while (*input_line_pointer != '"'
- && ! is_end_of_line[*input_line_pointer])
+ && ! is_end_of_line[(unsigned char) *input_line_pointer])
{
switch (*input_line_pointer)
{
@@ -2036,7 +2072,7 @@ DEFUN_VOID (obj_coff_section)
}
}
- change_to_section (section_name, len, exp);
+ subseg_new (section_name, exp);
segment_info[now_seg].scnhdr.s_flags |= flags;
@@ -2045,38 +2081,42 @@ DEFUN_VOID (obj_coff_section)
static void
-obj_coff_text ()
+obj_coff_text (ignore)
+ int ignore;
{
- change_to_section (".text", 5, get_absolute_expression ());
+ subseg_new (".text", get_absolute_expression ());
}
static void
-obj_coff_data ()
+obj_coff_data (ignore)
+ int ignore;
{
if (flagseen['R'])
- change_to_section (".text", 5, get_absolute_expression () + 1000);
+ subseg_new (".text", get_absolute_expression () + 1000);
else
- change_to_section (".data", 5, get_absolute_expression ());
+ subseg_new (".data", get_absolute_expression ());
}
static void
-obj_coff_bss()
+obj_coff_bss (ignore)
+ int ignore;
{
if (*input_line_pointer == '\n') /* .bss */
- change_to_section(".bss",4, get_absolute_expression());
+ subseg_new(".bss", get_absolute_expression());
else /* .bss id,expr */
- obj_coff_lcomm();
+ obj_coff_lcomm(0);
}
static void
-obj_coff_ident()
+obj_coff_ident (ignore)
+ int ignore;
{
segT current_seg = now_seg; /* save current seg */
subsegT current_subseg = now_subseg;
- change_to_section (".comment", 8, 0); /* .comment seg */
+ subseg_new (".comment", 0); /* .comment seg */
stringer (1); /* read string */
- subseg_new (current_seg, current_subseg); /* restore current seg */
+ subseg_set (current_seg, current_subseg); /* restore current seg */
}
void
@@ -2250,7 +2290,7 @@ DEFUN (w_symbols, (abfd, where, symbol_rootP),
}
else
{
- bzero (symbolP->sy_symbol.ost_entry.n_name, SYMNMLEN);
+ memset (symbolP->sy_symbol.ost_entry.n_name, 0, SYMNMLEN);
strncpy (symbolP->sy_symbol.ost_entry.n_name, temp, SYMNMLEN);
}
where = symbol_to_chars (abfd, where, symbolP);
@@ -2260,7 +2300,8 @@ DEFUN (w_symbols, (abfd, where, symbol_rootP),
} /* w_symbols() */
static void
-DEFUN_VOID (obj_coff_lcomm)
+obj_coff_lcomm (ignore)
+ int ignore;
{
char *name;
char c;
@@ -2305,12 +2346,12 @@ DEFUN_VOID (obj_coff_lcomm)
segT current_seg = now_seg; /* save current seg */
subsegT current_subseg = now_subseg;
- subseg_new (SEG_E2, 1);
+ subseg_set (SEG_E2, 1);
symbolP->sy_frag = frag_now;
p = frag_var(rs_org, 1, 1, (relax_substateT)0, symbolP,
temp, (char *)0);
*p = 0;
- subseg_new (current_seg, current_subseg); /* restore current seg */
+ subseg_set (current_seg, current_subseg); /* restore current seg */
S_SET_SEGMENT(symbolP, SEG_E2);
S_SET_STORAGE_CLASS(symbolP, C_STAT);
}
@@ -2448,9 +2489,10 @@ DEFUN (fixup_segment, (segP, this_segment_type),
}
else
{
- as_bad ("Can't emit reloc {- %s-seg symbol \"%s\"} @ file address %d.",
+ as_bad ("Can't emit reloc {- %s-seg symbol \"%s\"} @ file address %ld.",
segment_name (S_GET_SEGMENT (sub_symbolP)),
- S_GET_NAME (sub_symbolP), fragP->fr_address + where);
+ S_GET_NAME (sub_symbolP),
+ (long) (fragP->fr_address + where));
} /* if absolute */
}
} /* if sub_symbolP */
@@ -2565,8 +2607,9 @@ DEFUN (fixup_segment, (segP, this_segment_type),
(size == 2 &&
(add_number & ~0xFFFF) && ((add_number & ~0xFFFF) != (-1 & ~0xFFFF))))
{
- as_bad ("Value of %d too large for field of %d bytes at 0x%x",
- add_number, size, fragP->fr_address + where);
+ as_bad ("Value of %ld too large for field of %d bytes at 0x%lx",
+ (long) add_number, size,
+ (unsigned long) (fragP->fr_address + where));
} /* generic error checking */
#endif
#ifdef WARN_SIGNED_OVERFLOW_WORD
@@ -2577,8 +2620,9 @@ DEFUN (fixup_segment, (segP, this_segment_type),
if (!flagseen['J']
&& size == 2
&& add_number > 0x7fff)
- as_bad ("Signed .word overflow; switch may be too large; %d at 0x%x",
- add_number, fragP->fr_address + where);
+ as_bad ("Signed .word overflow; switch may be too large; %ld at 0x%lx",
+ (long) add_number,
+ (unsigned long) (fragP->fr_address + where));
#endif
} /* not a bit fix */
/* once this fix has been applied, we don't have to output anything
diff --git a/gas/config/obj-coffbfd.h b/gas/config/obj-coffbfd.h
index 9e75f7c..0968767 100644
--- a/gas/config/obj-coffbfd.h
+++ b/gas/config/obj-coffbfd.h
@@ -183,7 +183,7 @@ obj_symbol_type;
#define S_IS_LOCAL(s) \
((s)->sy_symbol.ost_entry.n_scnum == C_REGISTER_SECTION \
|| (S_LOCAL_NAME(s) && !flagseen['L']) \
- || (strchr (s, '\001') != NULL))
+ || (strchr (S_GET_NAME (s), '\001') != NULL))
/* True if a symbol is not defined in this file */
#define S_IS_EXTERN(s) ((s)->sy_symbol.ost_entry.n_scnum == 0 \
&& S_GET_VALUE (s) == 0)
@@ -500,30 +500,30 @@ typedef struct
stack;
+#define obj_segment_name(i) (segment_info[(int) (i)].scnhdr.s_name)
+#define obj_add_segment(s) obj_coff_add_segment (s)
-char *EXFUN (stack_pop, (stack * st));
-char *EXFUN (stack_push, (stack * st, char *element));
-char *EXFUN (stack_top, (stack * st));
-stack *EXFUN (stack_init, (unsigned long chunk_size, unsigned long element_size));
-void EXFUN (c_dot_file_symbol, (char *filename));
-void EXFUN (obj_extra_stuff, (object_headers * headers));
-void EXFUN (stack_delete, (stack * st));
+extern segT obj_coff_add_segment PARAMS ((const char *));
-segT EXFUN (s_get_segment,(struct symbol * ptr));
+extern void obj_coff_section PARAMS ((int));
-void EXFUN (c_section_header, (
+extern void c_dot_file_symbol PARAMS ((char *filename));
+extern void obj_extra_stuff PARAMS ((object_headers * headers));
+extern void stack_delete PARAMS ((stack * st));
- struct internal_scnhdr * header,
- char *name,
- long core_address,
- long size,
- long data_ptr,
- long reloc_ptr,
- long lineno_ptr,
- long reloc_number,
- long lineno_number,
- long alignment));
+extern segT s_get_segment PARAMS ((struct symbol * ptr));
+
+extern void c_section_header PARAMS ((struct internal_scnhdr * header,
+ char *name,
+ long core_address,
+ long size,
+ long data_ptr,
+ long reloc_ptr,
+ long lineno_ptr,
+ long reloc_number,
+ long lineno_number,
+ long alignment));
/* sanity check */
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 5ccf21d..9acca92 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -22,17 +22,19 @@
#include "aout/stab_gnu.h"
#include "obstack.h"
+static int obj_elf_write_symbol_p PARAMS ((symbolS *sym));
+
static void obj_elf_stab PARAMS ((int what));
static void obj_elf_xstab PARAMS ((int what));
-static void obj_elf_line PARAMS ((void));
-void obj_elf_desc PARAMS ((void));
-void obj_elf_version PARAMS ((void));
-static void obj_elf_size PARAMS ((void));
-static void obj_elf_type PARAMS ((void));
-static void obj_elf_ident PARAMS ((void));
-static void obj_elf_weak PARAMS ((void));
-static void obj_elf_local PARAMS ((void));
-static void obj_elf_common PARAMS ((void));
+static void obj_elf_line PARAMS ((int));
+void obj_elf_desc PARAMS ((int));
+void obj_elf_version PARAMS ((int));
+static void obj_elf_size PARAMS ((int));
+static void obj_elf_type PARAMS ((int));
+static void obj_elf_ident PARAMS ((int));
+static void obj_elf_weak PARAMS ((int));
+static void obj_elf_local PARAMS ((int));
+static void obj_elf_common PARAMS ((int));
const pseudo_typeS obj_pseudo_table[] =
{
@@ -87,7 +89,8 @@ elf_file_symbol (s)
}
static void
-obj_elf_common ()
+obj_elf_common (ignore)
+ int ignore;
{
char *name;
char c;
@@ -153,7 +156,7 @@ obj_elf_common ()
{
segT old_sec;
int old_subsec;
- char *p;
+ char *pfrag;
int align;
/* allocate_bss: */
@@ -167,9 +170,9 @@ obj_elf_common ()
if (S_GET_SEGMENT (symbolP) == bss_section)
symbolP->sy_frag->fr_symbol = 0;
symbolP->sy_frag = frag_now;
- p = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, size,
- (char *) 0);
- *p = 0;
+ pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, size,
+ (char *) 0);
+ *pfrag = 0;
S_SET_SEGMENT (symbolP, bss_section);
S_CLEAR_EXTERNAL (symbolP);
subseg_set (old_sec, old_subsec);
@@ -177,7 +180,7 @@ obj_elf_common ()
else
{
allocate_common:
- S_SET_VALUE (symbolP, size);
+ S_SET_VALUE (symbolP, (valueT) size);
S_SET_EXTERNAL (symbolP);
/* should be common, but this is how gas does it for now */
S_SET_SEGMENT (symbolP, &bfd_und_section);
@@ -221,7 +224,8 @@ obj_elf_common ()
}
static void
-obj_elf_local ()
+obj_elf_local (ignore)
+ int ignore;
{
char *name;
int c;
@@ -249,7 +253,8 @@ obj_elf_local ()
}
static void
-obj_elf_weak ()
+obj_elf_weak (ignore)
+ int ignore;
{
char *name;
int c;
@@ -307,7 +312,7 @@ obj_elf_section (xxx)
p++;
c = *p;
*p = 0;
- string = xmalloc (p - input_line_pointer + 1);
+ string = xmalloc ((unsigned long) (p - input_line_pointer + 1));
strcpy (string, input_line_pointer);
*p = c;
input_line_pointer = p;
@@ -324,7 +329,8 @@ obj_elf_section (xxx)
while (*input_line_pointer == ',')
{
flagword bit;
- int len, inv;
+ unsigned int len;
+ int inv;
char *p, oldp;
input_line_pointer++;
@@ -393,7 +399,8 @@ obj_elf_section (xxx)
}
void
-obj_elf_previous ()
+obj_elf_previous (ignore)
+ int ignore;
{
if (previous_section == 0)
{
@@ -404,7 +411,7 @@ obj_elf_previous ()
previous_section = 0;
}
-int
+static int
obj_elf_write_symbol_p (sym)
symbolS *sym;
{
@@ -475,7 +482,8 @@ obj_elf_frob_symbol (sym, punt)
}
static void
-obj_elf_line ()
+obj_elf_line (ignore)
+ int ignore;
{
/* Assume delimiter is part of expression. BSD4.2 as fails with
delightful bug, so we are not being incompatible here. */
@@ -540,7 +548,7 @@ elf_stab_symbol_string (string, secname)
/* Create the stab sections, if they are not already created. */
{
- char *newsecname = xmalloc (strlen (secname) + 4);
+ char *newsecname = xmalloc ((unsigned long) (strlen (secname) + 4));
strcpy (newsecname, secname);
strcat (newsecname, "str");
seg = bfd_get_section_by_name (stdoutput, newsecname);
@@ -737,7 +745,7 @@ obj_elf_stab_generic (what, secname)
return;
}
- subseg_new ((char *) seg->name, subseg);
+ subseg_set (seg, subseg);
if (seg_is_new)
/* allocate and discard -- filled in later */
@@ -757,7 +765,7 @@ obj_elf_stab_generic (what, secname)
md_number_to_chars (p, 0, 4);
}
- subseg_new ((char *) saved_seg->name, subseg);
+ subseg_set (saved_seg, subseg);
if ((what == 's' || what == 'n')
&& symbolP->sy_value.X_op == O_constant)
@@ -783,7 +791,7 @@ obj_elf_stab_generic (what, secname)
switch (S_GET_TYPE (symbolP))
{
case N_SLINE:
- listing_source_line (S_GET_DESC (symbolP));
+ listing_source_line ((unsigned int) S_GET_DESC (symbolP));
break;
case N_SO:
case N_SOL:
@@ -822,7 +830,8 @@ obj_elf_xstab (what)
}
void
-obj_elf_desc ()
+obj_elf_desc (ignore)
+ int ignore;
{
char *name;
char c;
@@ -877,7 +886,8 @@ obj_symbol_new_hook (symbolP)
}
void
-obj_elf_version ()
+obj_elf_version (ignore)
+ int ignore;
{
char *name;
unsigned int c;
@@ -916,7 +926,7 @@ obj_elf_version ()
/* process the version string */
- subseg_new ((char *) note_secp->name, 0);
+ subseg_set (note_secp, 0);
len = strlen (name);
i_note.namesz = ((len + 1) + 3) & ~3; /* round this to word boundary */
@@ -938,7 +948,7 @@ obj_elf_version ()
}
frag_align (2, 0);
- subseg_new ((char *) seg->name, subseg);
+ subseg_set (seg, subseg);
}
else
{
@@ -948,7 +958,8 @@ obj_elf_version ()
}
static void
-obj_elf_size ()
+obj_elf_size (ignore)
+ int ignore;
{
char *name = input_line_pointer;
char c = get_symbol_end ();
@@ -995,7 +1006,8 @@ obj_elf_size ()
}
static void
-obj_elf_type ()
+obj_elf_type (ignore)
+ int ignore;
{
char *name = input_line_pointer;
char c = get_symbol_end ();
@@ -1042,7 +1054,8 @@ obj_elf_type ()
}
static void
-obj_elf_ident ()
+obj_elf_ident (ignore)
+ int ignore;
{
static segT comment_section;
segT old_section = now_seg;
@@ -1096,8 +1109,8 @@ adjust_stab_sections (abfd, sec, xxx)
assert (fragp->fr_type == rs_fill);
assert (fragp->fr_address == 0 && fragp->fr_fix >= 12);
- bfd_h_put_16 (abfd, nsyms, fragp->fr_literal + 6);
- bfd_h_put_32 (abfd, strsz, fragp->fr_literal + 8);
+ bfd_h_put_16 (abfd, (bfd_vma) nsyms, fragp->fr_literal + 6);
+ bfd_h_put_32 (abfd, (bfd_vma) strsz, fragp->fr_literal + 8);
}
void
diff --git a/gas/config/obj-ieee.c b/gas/config/obj-ieee.c
index 61fff02..7d70f48 100644
--- a/gas/config/obj-ieee.c
+++ b/gas/config/obj-ieee.c
@@ -457,7 +457,7 @@ obj_ieee_section (ignore)
memcpy (segment_info[i].name, s, p - s);
segment_info[i].name[p - s] = 0;
ok:
- subseg_new (i, 0);
+ subseg_set (i, 0);
while (!is_end_of_line[*p])
p++;
input_line_pointer = p;
@@ -515,9 +515,9 @@ DEFUN_VOID (write_object_file)
}
bfd_set_format (abfd, bfd_object);
bfd_set_arch_mach (abfd, bfd_arch_h8300, 0);
- subseg_new (1, 0);
- subseg_new (2, 0);
- subseg_new (3, 0);
+ subseg_set (1, 0);
+ subseg_set (2, 0);
+ subseg_set (3, 0);
for (frchain_ptr = frchain_root;
frchain_ptr != (struct frchain *) NULL;
frchain_ptr = frchain_ptr->frch_next)
@@ -527,7 +527,7 @@ DEFUN_VOID (write_object_file)
that any .align's size can be worked by looking at the next
frag. */
- subseg_new (frchain_ptr->frch_seg, frchain_ptr->frch_subseg);
+ subseg_set (frchain_ptr->frch_seg, frchain_ptr->frch_subseg);
#ifndef SUB_SEGMENT_ALIGN
#define SUB_SEGMENT_ALIGN(SEG) 2
#endif
diff --git a/gas/config/obj-vms.c b/gas/config/obj-vms.c
index b8c75e2..2ea43f5 100644
--- a/gas/config/obj-vms.c
+++ b/gas/config/obj-vms.c
@@ -327,7 +327,7 @@ s_const ()
register int temp;
temp = get_absolute_expression ();
- subseg_new (SEG_DATA, (subsegT) temp);
+ subseg_set (SEG_DATA, (subsegT) temp);
const_flag = 1;
demand_empty_rest_of_line ();
}
diff --git a/gas/config/tc-a29k.c b/gas/config/tc-a29k.c
index 78e8d10..11a5793 100644
--- a/gas/config/tc-a29k.c
+++ b/gas/config/tc-a29k.c
@@ -33,7 +33,9 @@
#define machine_it a29k_it
const relax_typeS md_relax_table[] =
-{0};
+{
+ { 0, 0, 0, 0 }
+};
#define IMMEDIATE_BIT 0x01000000 /* Turns RB into Immediate */
#define ABSOLUTE_BIT 0x01000000 /* Turns PC-relative to Absolute */
@@ -61,8 +63,10 @@ the_insn;
static void machine_ip PARAMS ((char *str));
/* static void print_insn PARAMS ((struct machine_it *insn)); */
+#ifndef OBJ_COFF
static void s_data1 PARAMS ((void));
-static void s_use PARAMS ((void));
+static void s_use PARAMS ((int));
+#endif
const pseudo_typeS
md_pseudo_table[] =
@@ -132,8 +136,11 @@ static unsigned char toHex[256];
*/
#define ANNUL (1 << 29)
+#ifndef OBJ_COFF
+
static void
-s_use ()
+s_use (ignore)
+ int ignore;
{
if (strncmp (input_line_pointer, ".text", 5) == 0)
@@ -159,7 +166,7 @@ s_use ()
if (strncmp (input_line_pointer, ".lit", 4) == 0)
{
input_line_pointer += 4;
- subseg_new (SEG_DATA, 200);
+ subseg_set (SEG_DATA, 200);
demand_empty_rest_of_line ();
return;
}
@@ -172,11 +179,13 @@ s_use ()
static void
s_data1 ()
{
- subseg_new (SEG_DATA, 1);
+ subseg_set (SEG_DATA, 1);
demand_empty_rest_of_line ();
return;
}
+#endif /* OBJ_COFF */
+
/* Install symbol definition that maps REGNAME to REGNO.
FIXME-SOON: These are not recognized in mixed case. */
@@ -260,7 +269,7 @@ define_some_regs ()
void
md_begin ()
{
- register char *retval = NULL;
+ register const char *retval = NULL;
int lose = 0;
register int skipnext = 0;
register unsigned int i;
@@ -322,7 +331,7 @@ md_begin ()
skipnext = 1;
}
- retval = hash_insert (op_hash, name, &machine_opcodes[i]);
+ retval = hash_insert (op_hash, name, (PTR) &machine_opcodes[i]);
if (retval != NULL && *retval != '\0')
{
fprintf (stderr, "internal error: can't hash `%s': %s\n",
@@ -491,8 +500,8 @@ machine_ip (str)
}
else
{
- as_bad ("Immediate value of %d is too large",
- operand->X_add_number);
+ as_bad ("Immediate value of %ld is too large",
+ (long) operand->X_add_number);
continue;
}
}
@@ -518,8 +527,8 @@ machine_ip (str)
}
else
{
- as_bad ("Immediate value of %d is too large",
- operand->X_add_number);
+ as_bad ("Immediate value of %ld is too large",
+ (long) operand->X_add_number);
continue;
}
}
diff --git a/gas/config/tc-i960.c b/gas/config/tc-i960.c
index e2ed93d..be54da4 100644
--- a/gas/config/tc-i960.c
+++ b/gas/config/tc-i960.c
@@ -1219,7 +1219,7 @@ brtab_emit ()
return;
}
- subseg_new (SEG_DATA, 0); /* .data */
+ subseg_set (SEG_DATA, 0); /* .data */
frag_align (2, 0); /* .align 2 */
record_alignment (now_seg, 2);
colon (BR_TAB_NAME); /* BR_TAB_NAME: */
@@ -1839,14 +1839,14 @@ parse_expr (textP, expP)
/* Treat empty string as absolute 0 */
expP->X_add_symbol = expP->X_op_symbol = NULL;
expP->X_add_number = 0;
- exp->X_op = O_constant;
+ expP->X_op = O_constant;
}
else
{
save_in = input_line_pointer; /* Save global */
input_line_pointer = textP; /* Make parser work for us */
- seg = expression (expP);
+ (void) expression (expP);
if (input_line_pointer - textP != strlen (textP))
{
/* Did not consume all of the input */
@@ -1862,7 +1862,6 @@ parse_expr (textP, expP)
input_line_pointer = save_in; /* Restore global */
}
- return seg;
}
diff --git a/gas/config/tc-m88k.c b/gas/config/tc-m88k.c
index ea5635f..e064003 100644
--- a/gas/config/tc-m88k.c
+++ b/gas/config/tc-m88k.c
@@ -1269,7 +1269,7 @@ s_bss ()
segT current_seg = now_seg;
subsegT current_subseg = now_subseg;
- subseg_new (SEG_BSS, 1); /* switch to bss */
+ subseg_set (SEG_BSS, 1); /* switch to bss */
if (bss_align)
frag_align (bss_align, 0);
@@ -1284,7 +1284,7 @@ s_bss ()
*p = 0;
S_SET_SEGMENT (symbolP, SEG_BSS);
- subseg_new (current_seg, current_subseg);
+ subseg_set (current_seg, current_subseg);
}
}
else
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 9bf0dcc..30ef6c4 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -155,7 +155,7 @@ static int prev_prev_insn_unreordered;
#endif
static int insn_uses_reg PARAMS ((struct mips_cl_insn *ip,
- int reg, int fpr));
+ unsigned int reg, int fpr));
static void append_insn PARAMS ((struct mips_cl_insn * ip,
expressionS * p,
bfd_reloc_code_real_type r));
@@ -286,7 +286,7 @@ static bfd_reloc_code_real_type offset_reloc;
void
md_begin ()
{
- register char *retval = NULL;
+ register const char *retval = NULL;
register unsigned int i = 0;
if (mips_isa == -1)
@@ -312,7 +312,7 @@ md_begin ()
{
const char *name = mips_opcodes[i].name;
- retval = hash_insert (op_hash, name, &mips_opcodes[i]);
+ retval = hash_insert (op_hash, name, (PTR) &mips_opcodes[i]);
if (retval != NULL && *retval != '\0')
{
fprintf (stderr, "internal error: can't hash `%s': %s\n",
@@ -392,7 +392,7 @@ md_assemble (str)
static int
insn_uses_reg (ip, reg, fpr)
struct mips_cl_insn *ip;
- int reg;
+ unsigned int reg;
int fpr;
{
/* Don't report on general register 0, since it never changes. */
@@ -409,10 +409,12 @@ insn_uses_reg (ip, reg, fpr)
because there is no instruction that sets both $f0 and $f1
and requires a delay. */
if ((ip->insn_mo->pinfo & INSN_READ_FPR_S)
- && ((ip->insn_opcode >> OP_SH_FS) & OP_MASK_FS) == (reg &~ 1))
+ && (((ip->insn_opcode >> OP_SH_FS) & OP_MASK_FS)
+ == (reg &~ (unsigned) 1)))
return 1;
if ((ip->insn_mo->pinfo & INSN_READ_FPR_T)
- && ((ip->insn_opcode >> OP_SH_FT) & OP_MASK_FT) == (reg &~ 1))
+ && (((ip->insn_opcode >> OP_SH_FT) & OP_MASK_FT)
+ == (reg &~ (unsigned) 1)))
return 1;
}
else
@@ -598,7 +600,7 @@ append_insn (ip, address_expr, reloc_type)
{
assert (S_GET_SEGMENT (insn_label) == now_seg);
insn_label->sy_frag = frag_now;
- S_SET_VALUE (insn_label, frag_now_fix ());
+ S_SET_VALUE (insn_label, (valueT) frag_now_fix ());
}
}
}
@@ -914,7 +916,7 @@ mips_emit_delays ()
{
assert (S_GET_SEGMENT (insn_label) == now_seg);
insn_label->sy_frag = frag_now;
- S_SET_VALUE (insn_label, frag_now_fix ());
+ S_SET_VALUE (insn_label, (valueT) frag_now_fix ());
}
}
mips_no_prev_insn ();
@@ -3196,7 +3198,8 @@ mips_ip (str, ip)
char *save_in;
char *err;
unsigned char temp[8];
- int length;
+ int len;
+ unsigned int length;
segT seg;
subsegT subseg;
char *p;
@@ -3222,7 +3225,8 @@ mips_ip (str, ip)
save_in = input_line_pointer;
input_line_pointer = s;
- err = md_atof (f64 ? 'd' : 'f', (char *) temp, &length);
+ err = md_atof (f64 ? 'd' : 'f', (char *) temp, &len);
+ length = len;
s = input_line_pointer;
input_line_pointer = save_in;
if (err != NULL && *err != '\0')
@@ -3279,7 +3283,7 @@ mips_ip (str, ip)
offset_expr.X_add_number = 0;
/* Put the floating point number into the section. */
- p = frag_more (length);
+ p = frag_more ((int) length);
memcpy (p, temp, length);
/* Switch back to the original section. */
@@ -3835,7 +3839,7 @@ md_apply_fix (fixP, valueP)
return 0;
}
insn |= value & 0xFFFF;
- md_number_to_chars ((char *) buf, insn, 4);
+ md_number_to_chars ((char *) buf, (valueT) insn, 4);
break;
default:
@@ -3956,7 +3960,7 @@ mips_align (to, fill)
{
assert (S_GET_SEGMENT (insn_label) == now_seg);
insn_label->sy_frag = frag_now;
- S_SET_VALUE (insn_label, frag_now_fix ());
+ S_SET_VALUE (insn_label, (valueT) frag_now_fix ());
insn_label = NULL;
}
}
@@ -4035,7 +4039,7 @@ s_change_sec (sec)
switch (sec)
{
case 't':
- s_text ();
+ s_text (0);
break;
case 'r':
#ifdef OBJ_ECOFF
@@ -4046,14 +4050,10 @@ s_change_sec (sec)
/* Fall through. */
#endif
case 'd':
- s_data ();
+ s_data (0);
break;
case 'b':
-#ifdef BFD_ASSEMBLER
subseg_set (bss_section, (subsegT) get_absolute_expression ());
-#else
- subseg_new (bss_section, (subsegT) get_absolute_expression ());
-#endif
demand_empty_rest_of_line ();
break;
case 's':
@@ -4092,7 +4092,7 @@ static void
s_extern (x)
int x;
{
- long size;
+ valueT size;
symbolS *symbolP;
symbolP = get_symbol ();
diff --git a/gas/read.c b/gas/read.c
index 5dc4f3b..762d3d8 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -204,7 +204,9 @@ static const pseudo_typeS potable[] =
{"byte", cons, 1},
{"comm", s_comm, 0},
{"data", s_data, 0},
+#ifdef S_SET_DESC
{"desc", s_desc, 0},
+#endif
/* dim */
{"double", float_cons, 'd'},
/* dsect */
@@ -270,7 +272,7 @@ static const pseudo_typeS potable[] =
static void
pobegin ()
{
- char *errtxt; /* error text */
+ const char *errtxt; /* error text */
const pseudo_typeS *pop;
po_hash = hash_new ();
@@ -599,7 +601,7 @@ read_a_source_file (name)
char *ends;
char *new_buf;
char *new_tmp;
- int new_length;
+ unsigned int new_length;
char *tmp_buf = 0;
extern char *scrub_string, *scrub_last_string;
@@ -613,8 +615,8 @@ read_a_source_file (name)
if (!ends)
{
- int tmp_len;
- int num;
+ unsigned int tmp_len;
+ unsigned int num;
/* The end of the #APP wasn't in this buffer. We
keep reading in buffers until we find the #NO_APP
@@ -710,7 +712,8 @@ read_a_source_file (name)
} /* read_a_source_file() */
void
-s_abort ()
+s_abort (ignore)
+ int ignore;
{
as_fatal (".abort detected. Abandoning ship.");
} /* s_abort() */
@@ -759,16 +762,17 @@ s_align_bytes (arg)
temp_fill = 0;
/* Only make a frag if we HAVE to. . . */
if (temp && !need_pass_2)
- frag_align (temp, (int) temp_fill);
+ frag_align ((int) temp, (int) temp_fill);
- record_alignment (now_seg, temp);
+ record_alignment (now_seg, (int) temp);
demand_empty_rest_of_line ();
} /* s_align_bytes() */
/* For machines where ".align 4" means align to 2**4 boundary. */
void
-s_align_ptwo ()
+s_align_ptwo (ignore)
+ int ignore;
{
register int temp;
register long temp_fill;
@@ -802,7 +806,8 @@ s_align_ptwo ()
} /* s_align_ptwo() */
void
-s_comm ()
+s_comm (ignore)
+ int ignore;
{
register char *name;
register char c;
@@ -860,7 +865,8 @@ s_comm ()
} /* s_comm() */
void
-s_data ()
+s_data (ignore)
+ int ignore;
{
segT section;
register int temp;
@@ -874,11 +880,7 @@ s_data ()
else
section = data_section;
-#ifdef BFD_ASSEMBLER
subseg_set (section, (subsegT) temp);
-#else
- subseg_new (section, (subsegT) temp);
-#endif
#ifdef OBJ_VMS
const_flag = 0;
@@ -927,7 +929,8 @@ s_app_file (appfile)
specific pseudo-ops. */
void
-s_app_line ()
+s_app_line (ignore)
+ int ignore;
{
int l;
@@ -942,7 +945,8 @@ s_app_line ()
}
void
-s_fill ()
+s_fill (ignore)
+ int ignore;
{
long temp_repeat = 0;
long temp_size = 1;
@@ -982,14 +986,14 @@ s_fill ()
if (temp_size && !need_pass_2)
{
p = frag_var (rs_fill, (int) temp_size, (int) temp_size, (relax_substateT) 0, (symbolS *) 0, temp_repeat, (char *) 0);
- memset (p, 0, (int) temp_size);
+ memset (p, 0, (unsigned int) temp_size);
/* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX
* flavoured AS. The following bizzare behaviour is to be
* compatible with above. I guess they tried to take up to 8
* bytes from a 4-byte expression and they forgot to sign
* extend. Un*x Sux. */
#define BSD_FILL_SIZE_CROCK_4 (4)
- md_number_to_chars (p, temp_fill,
+ md_number_to_chars (p, (valueT) temp_fill,
(temp_size > BSD_FILL_SIZE_CROCK_4
? BSD_FILL_SIZE_CROCK_4
: (int) temp_size));
@@ -1002,7 +1006,8 @@ s_fill ()
}
void
-s_globl ()
+s_globl (ignore)
+ int ignore;
{
char *name;
int c;
@@ -1123,13 +1128,9 @@ s_lcomm (needs_align)
(S_GET_SEGMENT (symbolP) == bss_seg
|| (!S_IS_DEFINED (symbolP) && S_GET_VALUE (symbolP) == 0)))
{
- char *p;
+ char *pfrag;
-#ifdef BFD_ASSEMBLER
subseg_set (bss_seg, 1);
-#else
- subseg_new (bss_seg, 1);
-#endif
if (align)
frag_align (align, 0);
@@ -1138,9 +1139,9 @@ s_lcomm (needs_align)
symbolP->sy_frag->fr_symbol = NULL;
symbolP->sy_frag = frag_now;
- p = frag_var (rs_org, 1, 1, (relax_substateT)0, symbolP,
- temp, (char *)0);
- *p = 0;
+ pfrag = frag_var (rs_org, 1, 1, (relax_substateT)0, symbolP,
+ temp, (char *)0);
+ *pfrag = 0;
S_SET_SEGMENT (symbolP, bss_seg);
@@ -1159,29 +1160,14 @@ s_lcomm (needs_align)
as_bad ("Ignoring attempt to re-define symbol %s.", name);
}
-#ifdef BFD_ASSEMBLER
subseg_set (current_seg, current_subseg);
-#else
- subseg_new (current_seg, current_subseg);
-#endif
demand_empty_rest_of_line ();
} /* s_lcomm() */
-void
-s_long ()
-{
- cons (4);
-}
-
-void
-s_int ()
-{
- cons (4);
-}
-
void
-s_lsym ()
+s_lsym (ignore)
+ int ignore;
{
register char *name;
register char c;
@@ -1242,7 +1228,8 @@ s_lsym ()
} /* s_lsym() */
void
-s_org ()
+s_org (ignore)
+ int ignore;
{
register segT segment;
expressionS exp;
@@ -1281,7 +1268,8 @@ s_org ()
} /* s_org() */
void
-s_set ()
+s_set (ignore)
+ int ignore;
{
register char *name;
register char delim;
@@ -1391,16 +1379,13 @@ s_space (mult)
} /* s_space() */
void
-s_text ()
+s_text (ignore)
+ int ignore;
{
register int temp;
temp = get_absolute_expression ();
-#ifdef BFD_ASSEMBLER
subseg_set (text_section, (subsegT) temp);
-#else
- subseg_new (text_section, (subsegT) temp);
-#endif
demand_empty_rest_of_line ();
} /* s_text() */
@@ -1502,13 +1487,13 @@ pseudo_set (symbolP)
else
S_CLEAR_EXTERNAL (symbolP);
#endif /* OBJ_AOUT or OBJ_BOUT */
- S_SET_VALUE (symbolP, exp.X_add_number);
+ S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
symbolP->sy_frag = &zero_address_frag;
break;
case O_register:
S_SET_SEGMENT (symbolP, reg_section);
- S_SET_VALUE (symbolP, exp.X_add_number);
+ S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
symbolP->sy_frag = &zero_address_frag;
break;
@@ -1592,7 +1577,7 @@ parse_repeat_cons PARAMS ((expressionS *exp, unsigned int nbytes));
/* end-of-line. */
void
cons (nbytes)
- register unsigned int nbytes; /* 1=.byte, 2=.word, 4=.long */
+ register int nbytes; /* 1=.byte, 2=.word, 4=.long */
{
expressionS exp;
@@ -1604,8 +1589,8 @@ cons (nbytes)
do
{
- TC_PARSE_CONS_EXPRESSION (&exp, nbytes);
- emit_expr (&exp, nbytes);
+ TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
+ emit_expr (&exp, (unsigned int) nbytes);
}
while (*input_line_pointer++ == ',');
@@ -1649,7 +1634,7 @@ emit_expr (exp, nbytes)
op = O_constant;
}
- p = frag_more (nbytes);
+ p = frag_more ((int) nbytes);
#ifndef WORKING_DOT_WORD
/* If we have the difference of two symbols in a word, save it on
@@ -1700,11 +1685,12 @@ emit_expr (exp, nbytes)
{ /* Leading bits contain both 0s & 1s. */
as_warn ("Value 0x%lx truncated to 0x%lx.", get, use);
}
- md_number_to_chars (p, use, nbytes); /* put bytes in right order. */
+ /* put bytes in right order. */
+ md_number_to_chars (p, (valueT) use, (int) nbytes);
}
else
{
- md_number_to_chars (p, (long) 0, nbytes);
+ md_number_to_chars (p, (valueT) 0, (int) nbytes);
/* Now we need to generate a fixS to record the symbol value.
This is easy for BFD. For other targets it can be more
@@ -1719,7 +1705,7 @@ emit_expr (exp, nbytes)
#ifdef TC_CONS_FIX_NEW
TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp);
#else
- fix_new_exp (frag_now, p - frag_now->fr_literal, nbytes, exp, 0,
+ fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp, 0,
/* @@ Should look at CPU word size. */
nbytes == 2 ? BFD_RELOC_16
: nbytes == 8 ? BFD_RELOC_64
@@ -2098,7 +2084,7 @@ big_cons (nbytes)
p[i] = *src++;
}
else
- memcpy (p, bignum_low, (int) nbytes);
+ memcpy (p, bignum_low, (unsigned int) nbytes);
}
/* C contains character after number. */
SKIP_WHITESPACE ();
@@ -2112,7 +2098,7 @@ big_cons (nbytes)
static void
grow_bignum ()
{
- register long length;
+ register unsigned long length;
bignum_high++;
if (bignum_high >= bignum_limit)
@@ -2209,7 +2195,7 @@ float_cons (float_type)
while (--count >= 0)
{
p = frag_more (length);
- memcpy (p, temp, length);
+ memcpy (p, temp, (unsigned int) length);
}
}
SKIP_WHITESPACE ();
@@ -2595,7 +2581,7 @@ s_include (arg)
filename = demand_copy_string (&i);
demand_empty_rest_of_line ();
- path = xmalloc (i + include_dir_maxlen + 5 /* slop */ );
+ path = xmalloc ((unsigned long) i + include_dir_maxlen + 5 /* slop */ );
for (i = 0; i < include_dir_count; i++)
{
strcpy (path, include_dirs[i]);
@@ -2685,14 +2671,14 @@ change_to_section (name, len, exp)
{
if (strncmp (segment_info[i].scnhdr.s_name, name, len) == 0)
{
- subseg_new (i, exp);
+ subseg_set (i, exp);
return;
}
}
/* No section, add one */
strncpy (segment_info[i].scnhdr.s_name, name, 8);
segment_info[i].scnhdr.s_flags = 0 /* STYP_NOLOAD */;
- subseg_new (i, exp);
+ subseg_set (i, exp);
#endif
#endif
}
@@ -2744,15 +2730,11 @@ get_stab_string_offset (string, secname)
bfd_set_section_flags (stdoutput, seg, SEC_READONLY | SEC_ALLOC);
}
#else
- change_to_section(newsecname, strlen(newsecname), 0);
+ subseg_new (newsecname, 0);
#endif
/* free (newsecname);*/
}
-#ifdef BFD_ASSEMBLER
subseg_set (seg, save_subseg);
-#else
-/* subseg_new (seg, save_subseg); */
-#endif
old_gdb_string_index = gdb_string_index;
i = 0;
while ((c = *string++))
@@ -2772,11 +2754,7 @@ get_stab_string_offset (string, secname)
i++;
gdb_string_index++;
}
-#ifdef BFD_ASSEMBLER
subseg_set (save_seg, save_subseg);
-#else
-/* subseg_new (save_seg, save_subseg); */
-#endif
}
return old_gdb_string_index;
}
@@ -2803,7 +2781,7 @@ s_stab_generic (what, secname)
segT seg;
subsegT saved_subseg = now_subseg;
subsegT subseg;
- int valu;
+ valueT valu;
#ifdef SEPARATE_STAB_SECTIONS
int seg_is_new = 0;
#endif
@@ -2822,7 +2800,7 @@ s_stab_generic (what, secname)
seg_is_new = 1;
}
#else
- change_to_section (secname, strlen(secname), 0);
+ subseg_new (secname, 0);
#endif
#endif /* SEPARATE_STAB_SECTIONS */
@@ -2934,17 +2912,11 @@ s_stab_generic (what, secname)
if (goof)
{
ignore_rest_of_line ();
-#ifdef BFD_ASSEMBLER
subseg_set (saved_seg, saved_subseg);
-#else
- subseg_new (saved_seg, saved_subseg);
-#endif
return;
}
-#ifdef BFD_ASSEMBLER
subseg_set (seg, subseg);
-#endif
#if 0 /* needed for elf only? */
if (seg_is_new)
@@ -2956,7 +2928,7 @@ s_stab_generic (what, secname)
{
char *toP;
- change_to_section(secname, strlen(secname), 0);
+ subseg_new (secname, 0);
toP = frag_more (8);
/* the string index portion of the stab */
md_number_to_chars (toP, (valueT) S_GET_OFFSET_2(symbol), 4);
@@ -2977,12 +2949,8 @@ s_stab_generic (what, secname)
char *p = frag_more (4);
md_number_to_chars (p, 0, 4);
}
-#ifdef BFD_ASSEMBLER
subseg_set (saved_seg, subseg);
#else
-/* subseg_new (saved_seg, subseg); */
-#endif
-#else
if (what == 's' || what == 'n')
{
pseudo_set (symbol);
@@ -3010,7 +2978,7 @@ s_stab_generic (what, secname)
switch (S_GET_TYPE (symbol))
{
case N_SLINE:
- listing_source_line (S_GET_DESC (symbol));
+ listing_source_line ((unsigned int) S_GET_DESC (symbol));
break;
case N_SO:
case N_SOL:
@@ -3020,7 +2988,7 @@ s_stab_generic (what, secname)
#endif /* !NO_LISTING */
#ifdef SEPARATE_STAB_SECTIONS
- subseg_new (saved_seg, saved_subseg);
+ subseg_set (saved_seg, saved_subseg);
#endif
demand_empty_rest_of_line ();
@@ -3057,10 +3025,13 @@ s_xstab (what)
s_stab_generic (what, secname);
}
+#ifdef S_SET_DESC
+
/* Frob invented at RMS' request. Set the n_desc of a symbol. */
void
-s_desc ()
+s_desc (ignore)
+ int ignore;
{
char *name;
char c;
@@ -3092,4 +3063,6 @@ s_desc ()
demand_empty_rest_of_line ();
} /* s_desc() */
+#endif /* defined (S_SET_DESC) */
+
/* end of read.c */
diff --git a/gas/subsegs.c b/gas/subsegs.c
index 5ef9570..6f5f753 100644
--- a/gas/subsegs.c
+++ b/gas/subsegs.c
@@ -1,18 +1,18 @@
/* subsegs.c - subsegments -
Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc.
-
+
This file is part of GAS, the GNU Assembler.
-
+
GAS 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, or (at your option)
any later version.
-
+
GAS 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 GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
@@ -26,95 +26,90 @@
#include "subsegs.h"
#include "obstack.h"
+frchainS *frchain_root, *frchain_now;
+
+#ifndef BFD_ASSEMBLER
#ifdef MANY_SEGMENTS
segment_info_type segment_info[SEG_MAXIMUM_ORDINAL];
-frchainS* frchain_root,
- * frchain_now;
-
#else
-frchainS* frchain_root,
- * frchain_now, /* Commented in "subsegs.h". */
- * data0_frchainP,
- * bss0_frchainP;
+/* Commented in "subsegs.h". */
+frchainS *data0_frchainP, *bss0_frchainP;
-#endif
-char * const /* in: segT out: char* */
- seg_name[] = {
- "absolute",
+#endif /* MANY_SEGMENTS */
+char *const seg_name[] =
+{
+ "absolute",
#ifdef MANY_SEGMENTS
- "e0","e1","e2","e3","e4","e5","e6","e7","e8","e9",
+ "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9",
#else
- "text",
- "data",
- "bss",
-#endif
- "unknown",
- "absent",
- "pass1",
- "ASSEMBLER-INTERNAL-LOGIC-ERROR!",
- "bignum/flonum",
- "difference",
- "debug",
- "transfert vector preload",
- "transfert vector postload",
- "register",
- "",
- }; /* Used by error reporters, dumpers etc. */
+ "text",
+ "data",
+ "bss",
+#endif /* MANY_SEGMENTS */
+ "unknown",
+ "ASSEMBLER-INTERNAL-LOGIC-ERROR!",
+ "expr",
+ "debug",
+ "transfert vector preload",
+ "transfert vector postload",
+ "register",
+ "",
+}; /* Used by error reporters, dumpers etc. */
+#endif /* BFD_ASSEMBLER */
+static void subseg_set_rest PARAMS ((segT, subsegT));
void
- subsegs_begin()
+subsegs_begin ()
{
- /* Check table(s) seg_name[], seg_N_TYPE[] is in correct order */
-#ifdef MANY_SEGMENTS
-#else
- know( SEG_ABSOLUTE == 0 );
- know( SEG_TEXT == 1 );
- know( SEG_DATA == 2 );
- know( SEG_BSS == 3 );
- know( SEG_UNKNOWN == 4 );
- know( SEG_ABSENT == 5 );
- know( SEG_PASS1 == 6 );
- know( SEG_GOOF == 7 );
- know( SEG_BIG == 8 );
- know( SEG_DIFFERENCE == 9 );
- know( SEG_DEBUG == 10 );
- know( SEG_NTV == 11 );
- know( SEG_PTV == 12 );
- know( SEG_REGISTER == 13 );
- know( SEG_MAXIMUM_ORDINAL == SEG_REGISTER );
- /* know( segment_name (SEG_MAXIMUM_ORDINAL + 1) [0] == 0 );*/
+ /* Check table(s) seg_name[], seg_N_TYPE[] is in correct order */
+#if !defined (MANY_SEGMENTS) && !defined (BFD_ASSEMBLER)
+ know (SEG_ABSOLUTE == 0);
+ know (SEG_TEXT == 1);
+ know (SEG_DATA == 2);
+ know (SEG_BSS == 3);
+ know (SEG_UNKNOWN == 4);
+ know (SEG_GOOF == 5);
+ know (SEG_EXPR == 6);
+ know (SEG_DEBUG == 7);
+ know (SEG_NTV == 8);
+ know (SEG_PTV == 9);
+ know (SEG_REGISTER == 10);
+ know (SEG_MAXIMUM_ORDINAL == SEG_REGISTER);
#endif
-
- obstack_begin( &frags, 5000);
- frchain_root = NULL;
- frchain_now = NULL; /* Warn new_subseg() that we are booting. */
- /* Fake up 1st frag. */
- /* It won't be used=> is ok if obstack... */
- /* pads the end of it for alignment. */
- frag_now=(fragS *)obstack_alloc(&frags,SIZEOF_STRUCT_FRAG);
- memset(frag_now, SIZEOF_STRUCT_FRAG, 0);
- /* This 1st frag will not be in any frchain. */
- /* We simply give subseg_new somewhere to scribble. */
- now_subseg = 42; /* Lie for 1st call to subseg_new. */
+
+ obstack_begin (&frags, 5000);
+ frchain_root = NULL;
+ frchain_now = NULL; /* Warn new_subseg() that we are booting. */
+ /* Fake up 1st frag. It won't be used=> is ok if obstack...
+ pads the end of it for alignment. */
+ frag_now = (fragS *) obstack_alloc (&frags, SIZEOF_STRUCT_FRAG);
+ memset (frag_now, SIZEOF_STRUCT_FRAG, 0);
+
+#ifndef BFD_ASSEMBLER
+ /* This 1st frag will not be in any frchain.
+ We simply give subseg_new somewhere to scribble. */
+ now_subseg = 42; /* Lie for 1st call to subseg_new. */
#ifdef MANY_SEGMENTS
- {
- int i;
- for (i = SEG_E0; i < SEG_UNKNOWN; i++) {
- subseg_new(i, 0);
- segment_info[i].frchainP = frchain_now;
- }
- }
+ {
+ int i;
+ for (i = SEG_E0; i < SEG_UNKNOWN; i++)
+ {
+ subseg_set (i, 0);
+ segment_info[i].frchainP = frchain_now;
+ }
+ }
#else
- subseg_new (SEG_DATA, 0); /* .data 0 */
- data0_frchainP = frchain_now;
+ subseg_set (SEG_DATA, 0); /* .data 0 */
+ data0_frchainP = frchain_now;
- subseg_new (SEG_BSS, 0);
- bss0_frchainP = frchain_now;
+ subseg_set (SEG_BSS, 0);
+ bss0_frchainP = frchain_now;
+
+#endif /* ! MANY_SEGMENTS */
+#endif /* ! BFD_ASSEMBLER */
-#endif
-
}
/*
@@ -122,42 +117,185 @@ void
*
* Change the subsegment we are in, BUT DO NOT MAKE A NEW FRAG for the
* subsegment. If we are already in the correct subsegment, change nothing.
- * This is used eg as a worker for subseg_new [which does make a new frag_now]
+ * This is used eg as a worker for subseg_set [which does make a new frag_now]
* and for changing segments after we have read the source. We construct eg
* fixSs even after the source file is read, so we do have to keep the
* segment context correct.
*/
void
- subseg_change (seg, subseg)
-register segT seg;
-register int subseg;
+subseg_change (seg, subseg)
+ register segT seg;
+ register int subseg;
{
- now_seg = seg;
- now_subseg = subseg;
+ now_seg = seg;
+ now_subseg = subseg;
+
+#ifdef BFD_ASSEMBLER
+ {
+ segment_info_type *seginfo;
+ seginfo = (segment_info_type *) bfd_get_section_userdata (stdoutput, seg);
+ if (! seginfo)
+ {
+ seginfo = (segment_info_type *) xmalloc (sizeof (*seginfo));
+ if (! seginfo)
+ abort ();
+ seginfo->fix_root = 0;
+ seginfo->fix_tail = 0;
+ seginfo->bfd_section = seg;
+ seginfo->sym = 0;
+ bfd_set_section_userdata (stdoutput, seg, (char *) seginfo);
+ }
+ }
+#else
#ifdef MANY_SEGMENTS
- seg_fix_rootP = & segment_info[seg].fix_root;
- seg_fix_tailP = & segment_info[seg].fix_tail;
+ seg_fix_rootP = &segment_info[seg].fix_root;
+ seg_fix_tailP = &segment_info[seg].fix_tail;
#else
- if (seg == SEG_DATA)
- {
- seg_fix_rootP = & data_fix_root;
- seg_fix_tailP = & data_fix_tail;
- }
- else if (seg == SEG_TEXT)
- {
- seg_fix_rootP = & text_fix_root;
- seg_fix_tailP = & text_fix_tail;
- }
- else {
- know (seg == SEG_BSS);
- seg_fix_rootP = & bss_fix_root;
- seg_fix_tailP = & bss_fix_tail;
- }
+ if (seg == SEG_DATA)
+ {
+ seg_fix_rootP = &data_fix_root;
+ seg_fix_tailP = &data_fix_tail;
+ }
+ else if (seg == SEG_TEXT)
+ {
+ seg_fix_rootP = &text_fix_root;
+ seg_fix_tailP = &text_fix_tail;
+ }
+ else
+ {
+ know (seg == SEG_BSS);
+ seg_fix_rootP = &bss_fix_root;
+ seg_fix_tailP = &bss_fix_tail;
+ }
+
+#endif
#endif
}
+static void
+subseg_set_rest (seg, subseg)
+ segT seg;
+ subsegT subseg;
+{
+ long tmp; /* JF for obstack alignment hacking */
+ register frchainS *frcP; /* crawl frchain chain */
+ register frchainS **lastPP; /* address of last pointer */
+ frchainS *newP; /* address of new frchain */
+ register fragS *former_last_fragP;
+ register fragS *new_fragP;
+
+ if (frag_now) /* If not bootstrapping. */
+ {
+ frag_now->fr_fix = (char*) obstack_next_free (&frags) - frag_now->fr_literal;
+ frag_wane (frag_now); /* Close off any frag in old subseg. */
+ }
+ /*
+ * It would be nice to keep an obstack for each subsegment, if we swap
+ * subsegments a lot. Hence we would have much fewer frag_wanes().
+ */
+ {
+ obstack_finish (&frags);
+ /*
+ * If we don't do the above, the next object we put on obstack frags
+ * will appear to start at the fr_literal of the current frag.
+ * Also, above ensures that the next object will begin on a
+ * address that is aligned correctly for the engine that runs
+ * this program.
+ */
+ }
+ subseg_change (seg, (int) subseg);
+ /*
+ * Attempt to find or make a frchain for that sub seg.
+ * Crawl along chain of frchainSs, begins @ frchain_root.
+ * If we need to make a frchainS, link it into correct
+ * position of chain rooted in frchain_root.
+ */
+ for (frcP = *(lastPP = &frchain_root);
+ frcP && (int) (frcP->frch_seg) <= (int) seg;
+ frcP = *(lastPP = &frcP->frch_next))
+ {
+ if ((int) (frcP->frch_seg) == (int) seg
+ && frcP->frch_subseg >= subseg)
+ {
+ break;
+ }
+ }
+ /*
+ * frcP: Address of the 1st frchainS in correct segment with
+ * frch_subseg >= subseg.
+ * We want to either use this frchainS, or we want
+ * to insert a new frchainS just before it.
+ *
+ * If frcP==NULL, then we are at the end of the chain
+ * of frchainS-s. A NULL frcP means we fell off the end
+ * of the chain looking for a
+ * frch_subseg >= subseg, so we
+ * must make a new frchainS.
+ *
+ * If we ever maintain a pointer to
+ * the last frchainS in the chain, we change that pointer
+ * ONLY when frcP==NULL.
+ *
+ * lastPP: Address of the pointer with value frcP;
+ * Never NULL.
+ * May point to frchain_root.
+ *
+ */
+ if (!frcP
+ || ((int) (frcP->frch_seg) > (int) seg
+ || frcP->frch_subseg > subseg)) /* Kinky logic only works with 2 segments. */
+ {
+ /*
+ * This should be the only code that creates a frchainS.
+ */
+ newP = (frchainS *) obstack_alloc (&frags, sizeof (frchainS));
+ memset (newP, sizeof (frchainS), 0);
+ /* This begines on a good boundary because a obstack_done()
+ preceeded it. It implies an obstack_done(), so we expect
+ the next object allocated to begin on a correct boundary. */
+ *lastPP = newP;
+ newP->frch_next = frcP; /* perhaps NULL */
+ (frcP = newP)->frch_subseg = subseg;
+ newP->frch_seg = seg;
+ newP->frch_last = NULL;
+ }
+ /*
+ * Here with frcP ->ing to the frchainS for subseg.
+ */
+ frchain_now = frcP;
+ /*
+ * Make a fresh frag for the subsegment.
+ */
+ /* We expect this to happen on a correct boundary since it was
+ proceeded by a obstack_done(). */
+ tmp = obstack_alignment_mask (&frags); /* JF disable alignment */
+ obstack_alignment_mask (&frags) = 0;
+ frag_now = (fragS *) obstack_alloc (&frags, SIZEOF_STRUCT_FRAG);
+ memset (frag_now, 0, SIZEOF_STRUCT_FRAG);
+ obstack_alignment_mask (&frags) = tmp;
+ /* But we want any more chars to come immediately after the
+ structure we just made. */
+ new_fragP = frag_now;
+ new_fragP->fr_next = NULL;
+ /*
+ * Append new frag to current frchain.
+ */
+ former_last_fragP = frcP->frch_last;
+ if (former_last_fragP)
+ {
+ know (former_last_fragP->fr_next == NULL);
+ know (frchain_now->frch_root);
+ former_last_fragP->fr_next = new_fragP;
+ }
+ else
+ {
+ frcP->frch_root = new_fragP;
+ }
+ frcP->frch_last = new_fragP;
+}
+
/*
- * subseg_new()
+ * subseg_set(segT, subsegT)
*
* If you attempt to change to the current subsegment, nothing happens.
*
@@ -172,156 +310,118 @@ register int subseg;
* Frchain_root updated if needed.
*/
-void
- subseg_new (seg, subseg) /* begin assembly for a new sub-segment */
-register segT seg; /* SEG_DATA or SEG_TEXT */
-register subsegT subseg;
+#ifndef BFD_ASSEMBLER
+
+segT
+subseg_new (segname, subseg)
+ const char *segname;
+ subsegT subseg;
{
- long tmp; /* JF for obstack alignment hacking */
-#ifndef MANY_SEGMENTS
- know(seg == SEG_DATA || seg == SEG_TEXT || seg == SEG_BSS);
-#endif
-#ifdef OBJ_AOUT
-/* If -R specifed, always put stuff into the data section */
- if (flagseen['R'])
+ int i;
+
+ for (i = 0; i < (int) SEG_MAXIMUM_ORDINAL; i++)
+ {
+ const char *s;
+
+ s = segment_name ((segT) i);
+ if (strcmp (segname, s) == 0
+ || (segname[0] == '.'
+ && strcmp (segname + 1, s) == 0))
{
- if (seg == SEG_DATA)
- {
- subseg += 1000;
- seg = SEG_TEXT;
- }
+ subseg_set ((segT) i, subseg);
+ return (segT) i;
+ }
+#ifdef obj_segment_name
+ s = obj_segment_name ((segT) i);
+ if (strcmp (segname, s) == 0
+ || (segname[0] == '.'
+ && strcmp (segname + 1, s) == 0))
+ {
+ subseg_set ((segT) i, subseg);
+ return (segT) i;
}
#endif
- if (seg != now_seg || subseg != now_subseg)
- { /* we just changed sub-segments */
- register frchainS * frcP; /* crawl frchain chain */
- register frchainS** lastPP; /* address of last pointer */
- frchainS * newP; /* address of new frchain */
- register fragS * former_last_fragP;
- register fragS * new_fragP;
-
- if (frag_now) /* If not bootstrapping. */
- {
- frag_now -> fr_fix = obstack_next_free(& frags) - frag_now -> fr_literal;
- frag_wane(frag_now); /* Close off any frag in old subseg. */
- }
- /*
- * It would be nice to keep an obstack for each subsegment, if we swap
- * subsegments a lot. Hence we would have much fewer frag_wanes().
- */
- {
-
- obstack_finish( &frags);
- /*
- * If we don't do the above, the next object we put on obstack frags
- * will appear to start at the fr_literal of the current frag.
- * Also, above ensures that the next object will begin on a
- * address that is aligned correctly for the engine that runs
- * this program.
- */
- }
- subseg_change (seg, (int)subseg);
- /*
- * Attempt to find or make a frchain for that sub seg.
- * Crawl along chain of frchainSs, begins @ frchain_root.
- * If we need to make a frchainS, link it into correct
- * position of chain rooted in frchain_root.
- */
- for (frcP = * (lastPP = & frchain_root);
- frcP
- && (int)(frcP -> frch_seg) <= (int)seg;
- frcP = * ( lastPP = & frcP -> frch_next)
- )
- {
- if ( (int)(frcP -> frch_seg) == (int)seg
- && frcP -> frch_subseg >= subseg)
- {
- break;
- }
- }
- /*
- * frcP: Address of the 1st frchainS in correct segment with
- * frch_subseg >= subseg.
- * We want to either use this frchainS, or we want
- * to insert a new frchainS just before it.
- *
- * If frcP==NULL, then we are at the end of the chain
- * of frchainS-s. A NULL frcP means we fell off the end
- * of the chain looking for a
- * frch_subseg >= subseg, so we
- * must make a new frchainS.
- *
- * If we ever maintain a pointer to
- * the last frchainS in the chain, we change that pointer
- * ONLY when frcP==NULL.
- *
- * lastPP: Address of the pointer with value frcP;
- * Never NULL.
- * May point to frchain_root.
- *
- */
- if ( ! frcP
- || ( (int)(frcP -> frch_seg) > (int)seg
- || frcP->frch_subseg > subseg)) /* Kinky logic only works with 2 segments. */
- {
- /*
- * This should be the only code that creates a frchainS.
- */
- newP=(frchainS *)obstack_alloc(&frags,sizeof(frchainS));
- memset(newP, sizeof(frchainS), 0);
- /* This begines on a good boundary */
- /* because a obstack_done() preceeded it. */
- /* It implies an obstack_done(), so we */
- /* expect the next object allocated to */
- /* begin on a correct boundary. */
- *lastPP = newP;
- newP -> frch_next = frcP; /* perhaps NULL */
- (frcP = newP) -> frch_subseg = subseg;
- newP -> frch_seg = seg;
- newP -> frch_last = NULL;
- }
- /*
- * Here with frcP ->ing to the frchainS for subseg.
- */
- frchain_now = frcP;
- /*
- * Make a fresh frag for the subsegment.
- */
- /* We expect this to happen on a correct */
- /* boundary since it was proceeded by a */
- /* obstack_done(). */
- tmp=obstack_alignment_mask(&frags); /* JF disable alignment */
- obstack_alignment_mask(&frags)=0;
- frag_now=(fragS *)obstack_alloc(&frags,SIZEOF_STRUCT_FRAG);
- obstack_alignment_mask(&frags)=tmp;
- /* know( frags . obstack_c_next_free == frag_now -> fr_literal ); */
- /* But we want any more chars to come */
- /* immediately after the structure we just made. */
- new_fragP = frag_now;
- new_fragP -> fr_next = NULL;
- /*
- * Append new frag to current frchain.
- */
- former_last_fragP = frcP -> frch_last;
- if (former_last_fragP)
- {
- know( former_last_fragP -> fr_next == NULL );
- know( frchain_now -> frch_root );
- former_last_fragP -> fr_next = new_fragP;
- }
- else
- {
- frcP -> frch_root = new_fragP;
- }
- frcP -> frch_last = new_fragP;
- } /* if (changing subsegments) */
-} /* subseg_new() */
+ }
-/*
- * Local Variables:
- * comment-column: 0
- * fill-column: 131
- * End:
- */
+#ifdef obj_add_segment
+ {
+ segT new_seg;
+ new_seg = obj_add_segment (segname);
+ subseg_set (new_seg, subseg);
+ return new_seg;
+ }
+#else
+ as_bad ("Attempt to switch to nonexistent segment \"%s\"", segname);
+ return now_seg;
+#endif
+}
+
+void
+subseg_set (seg, subseg) /* begin assembly for a new sub-segment */
+ register segT seg; /* SEG_DATA or SEG_TEXT */
+ register subsegT subseg;
+{
+#ifndef MANY_SEGMENTS
+ know (seg == SEG_DATA || seg == SEG_TEXT || seg == SEG_BSS);
+#endif
+
+ if (seg != now_seg || subseg != now_subseg)
+ { /* we just changed sub-segments */
+ subseg_set_rest (seg, subseg);
+ }
+}
+
+#else /* BFD_ASSEMBLER */
+
+segT
+subseg_new (segname, subseg)
+ const char *segname;
+ subsegT subseg;
+{
+ segT secptr;
+ segment_info_type *seginfo;
+ const char *now_seg_name = (now_seg
+ ? bfd_get_section_name (stdoutput, now_seg)
+ : 0);
+
+ if (now_seg_name
+ && (now_seg_name == segname
+ || !strcmp (now_seg_name, segname))
+ && subseg == now_subseg)
+ return now_seg;
+
+ secptr = bfd_make_section_old_way (stdoutput, segname);
+ seginfo = seg_info (secptr);
+ if (! seginfo)
+ {
+ secptr->output_section = secptr;
+ seginfo = (segment_info_type *) xmalloc (sizeof (*seginfo));
+ seginfo->fix_root = 0;
+ seginfo->fix_tail = 0;
+ seginfo->bfd_section = secptr;
+ bfd_set_section_userdata (stdoutput, secptr, (char *) seginfo);
+ subseg_set_rest (secptr, subseg);
+ seginfo->frchainP = frchain_now;
+ seginfo->lineno_list_head = seginfo->lineno_list_tail = 0;
+ seginfo->sym = 0;
+ seginfo->dot = 0;
+ seginfo->hadone = 0;
+ seginfo->user_stuff = 0;
+ }
+ else
+ subseg_set_rest (secptr, subseg);
+ return secptr;
+}
+
+void
+subseg_set (secptr, subseg)
+ segT secptr;
+ subsegT subseg;
+{
+ if (! (secptr == now_seg && subseg == now_subseg))
+ subseg_set_rest (secptr, subseg);
+}
+
+#endif /* BFD_ASSEMBLER */
/* end of subsegs.c */
diff --git a/gas/symbols.c b/gas/symbols.c
index 0a57994..bf281e2 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -82,10 +82,10 @@ symbol_begin ()
*/
symbolS *
-symbol_new (name, segment, value, frag)
+symbol_new (name, segment, valu, frag)
CONST char *name; /* It is copied, the caller can destroy/modify */
segT segment; /* Segment identifier (SEG_<something>) */
- valueT value; /* Symbol value */
+ valueT valu; /* Symbol value */
fragS *frag; /* Associated fragment */
{
unsigned int name_length;
@@ -113,7 +113,7 @@ symbol_new (name, segment, value, frag)
S_SET_NAME (symbolP, preserved_copy_of_name);
S_SET_SEGMENT (symbolP, segment);
- S_SET_VALUE (symbolP, value);
+ S_SET_VALUE (symbolP, valu);
symbol_clear_list_pointers(symbolP);
symbolP->sy_frag = frag;
@@ -329,12 +329,12 @@ void
symbol_table_insert (symbolP)
symbolS *symbolP;
{
- register char *error_string;
+ register const char *error_string;
know (symbolP);
know (S_GET_NAME (symbolP));
- if (*(error_string = hash_jam (sy_hash, S_GET_NAME (symbolP), (char *) symbolP)))
+ if (*(error_string = hash_jam (sy_hash, S_GET_NAME (symbolP), (PTR) symbolP)))
{
as_fatal ("Inserting \"%s\" into symbol table failed: %s",
S_GET_NAME (symbolP), error_string);
@@ -542,7 +542,7 @@ verify_symbol_chain (rootP, lastP)
know (symbolP->sy_next->sy_previous == symbolP);
#else
/* Walk the list anyways, to make sure pointers are still good. */
- *symbolP;
+ ;
#endif /* SYMBOLS_NEED_BACKPOINTERS */
}
@@ -707,7 +707,7 @@ static long *dollar_labels;
static long *dollar_label_instances;
static char *dollar_label_defines;
static long dollar_label_count;
-static long dollar_label_max;
+static unsigned long dollar_label_max;
int
dollar_label_defined (label)
@@ -745,7 +745,7 @@ dollar_label_instance (label)
void
dollar_label_clear ()
{
- memset (dollar_label_defines, '\0', dollar_label_count);
+ memset (dollar_label_defines, '\0', (unsigned int) dollar_label_count);
}
#define DOLLAR_LABEL_BUMP_BY 10
diff --git a/gas/write.h b/gas/write.h
index 12bdebc..6d16bab 100644
--- a/gas/write.h
+++ b/gas/write.h
@@ -101,16 +101,21 @@ bit_fixS *bit_fix_new PARAMS ((int size, int offset, long base_type,
void append PARAMS ((char **charPP, char *fromP, unsigned long length));
void record_alignment PARAMS ((segT seg, int align));
void write_object_file PARAMS ((void));
+void relax_segment PARAMS ((struct frag * seg_frag_root, segT seg_type));
#ifdef BFD_ASSEMBLER
fixS *fix_new PARAMS ((fragS * frag, int where, int size,
- symbolS * add_symbol, symbolS * sub_symbol,
- offsetT offset, int pcrel,
+ symbolS * add_symbol, offsetT offset, int pcrel,
bfd_reloc_code_real_type r_type));
+fixS *fix_new_exp PARAMS ((fragS * frag, int where, int size,
+ expressionS *exp, int pcrel,
+ bfd_reloc_code_real_type r_type));
#else
fixS *fix_new PARAMS ((fragS * frag, int where, int size,
- symbolS * add_symbol, symbolS * sub_symbol,
- long offset, int pcrel, int r_type));
+ symbolS * add_symbol, offsetT offset, int pcrel,
+ int r_type));
+fixS *fix_new_exp PARAMS ((fragS * frag, int where, int size,
+ expressionS *exp, int pcrel, int r_type));
#endif
/* end of write.h */