aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1993-09-14 17:58:35 +0000
committerIan Lance Taylor <ian@airs.com>1993-09-14 17:58:35 +0000
commit4f0bccc7d88f5d63a2a295d608a17288e138ad44 (patch)
tree4390fc37d118233fe0106fd78424fcc6edaf3572 /gas
parent1225fcbd24a9752c33d66b4db24b11855c44c017 (diff)
downloadgdb-4f0bccc7d88f5d63a2a295d608a17288e138ad44.zip
gdb-4f0bccc7d88f5d63a2a295d608a17288e138ad44.tar.gz
gdb-4f0bccc7d88f5d63a2a295d608a17288e138ad44.tar.bz2
Some more gcc lint, and:
* read.c (change_to_section): Removed. This is now done by subseg_new. (get_stab_string_offset): Rearranged somewhat. Create the section using subseg_new. Store the string index in seg_info, rather than in a static variable. Force the first string to be empty. Use frag_more rather than FRAG_APPEND_1_CHAR. (s_stab_generic): Rewrote. * subsegs.h (segment_info_type): Added stabu union. * subsegs.c (subseg_new): Initialize stab_string_size to 0. * config/obj-aout.c: Don't include aout/stab_gnu.h. (obj_aout_stab, obj_aout_desc): Removed. (obj_pseudo_table): Removed desc and stabX entries. * config/obj-bout.c: Same changes as config/obj-aout.c. * config/obj-bout.h (S_SET_TYPE): Define. (tc_bout_fix_to_chars): Declare. * config/obj-coff.c (obj_coff_stab): Removed. (obj_pseudo_table): Removed desc and stabX entries. * config/obj-coff.h (SEPARATE_STAB_SECTIONS): Define. * config/obj-coffbfd.c (current_stab_symbol): Removed. * config/obj-coffbfd.h (obj_symbol_type): Removed n_strx, n_type, n_other, n_desc and n_value fields. (S_{S,G}ET_{OFFSET,OTHER,TYPE,DESC}): Removed. (MAKE_STAB_SYMBOL): Removed. * config/obj-ecoff.c (obj_ecoff_stab): Renamed to ecoff_stab. Changed arguments and removed parsing code. (obj_pseudo_table): Removed stabX entries. * config/obj-ecoff.h (ecoff_stab): Declare. (OBJ_PROCESS_STAB): Define. * config/obj-elf.c: Don't include aout/stab_gnu.h. (obj_elf_stab, obj_elf_xstab, obj_elf_desc, elf_stab_symbol_string, elf_stab_symbol, obj_elf_stab_generic): Removed. (obj_pseudo_table): Removed desc, stabX and xstabs entries. (obj_elf_version): Use subseg_new, not bfd_make_section. Don't set SEC_LOAD for .note section. (adjust_stab_sections): Get frag pointer from seg_info, rather than looking through frags. * config/obj-elf.h (S_{S,G}ET_{OTHER,TYPE,DESC}): Removed. (SEPARATE_STAB_SECTIONS, INIT_STAB_SECTION, OBJ_PROCESS_STAB): Define. * config/obj-vms.c (obj_aout_stab): Removed. (obj_pseudo_table): Removed stabX entries. * config/obj-vms.h (S_SET_TYPE): Define.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog58
-rw-r--r--gas/config/obj-bout.c223
-rw-r--r--gas/config/obj-bout.h13
-rw-r--r--gas/config/obj-coffbfd.c38
-rw-r--r--gas/config/obj-coffbfd.h24
-rw-r--r--gas/config/obj-elf.c413
-rw-r--r--gas/config/obj-vms.c155
-rw-r--r--gas/config/obj-vms.h2
-rw-r--r--gas/config/tc-a29k.c11
9 files changed, 116 insertions, 821 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index ca0ff4d..933e067 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,61 @@
+Tue Sep 14 13:31:04 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
+
+ * read.c (change_to_section): Removed. This is now done by
+ subseg_new.
+ (get_stab_string_offset): Rearranged somewhat. Create the section
+ using subseg_new. Store the string index in seg_info, rather than
+ in a static variable. Force the first string to be empty. Use
+ frag_more rather than FRAG_APPEND_1_CHAR.
+ (s_stab_generic): Rewrote.
+ * subsegs.h (segment_info_type): Added stabu union.
+ * subsegs.c (subseg_new): Initialize stab_string_size to 0.
+ * config/obj-aout.c: Don't include aout/stab_gnu.h.
+ (obj_aout_stab, obj_aout_desc): Removed.
+ (obj_pseudo_table): Removed desc and stabX entries.
+ * config/obj-bout.c: Same changes as config/obj-aout.c.
+ * config/obj-bout.h (S_SET_TYPE): Define.
+ (tc_bout_fix_to_chars): Declare.
+ * config/obj-coff.c (obj_coff_stab): Removed.
+ (obj_pseudo_table): Removed desc and stabX entries.
+ * config/obj-coff.h (SEPARATE_STAB_SECTIONS): Define.
+ * config/obj-coffbfd.c (current_stab_symbol): Removed.
+ * config/obj-coffbfd.h (obj_symbol_type): Removed n_strx, n_type,
+ n_other, n_desc and n_value fields.
+ (S_{S,G}ET_{OFFSET,OTHER,TYPE,DESC}): Removed.
+ (MAKE_STAB_SYMBOL): Removed.
+ * config/obj-ecoff.c (obj_ecoff_stab): Renamed to ecoff_stab.
+ Changed arguments and removed parsing code.
+ (obj_pseudo_table): Removed stabX entries.
+ * config/obj-ecoff.h (ecoff_stab): Declare.
+ (OBJ_PROCESS_STAB): Define.
+ * config/obj-elf.c: Don't include aout/stab_gnu.h.
+ (obj_elf_stab, obj_elf_xstab, obj_elf_desc,
+ elf_stab_symbol_string, elf_stab_symbol, obj_elf_stab_generic):
+ Removed.
+ (obj_pseudo_table): Removed desc, stabX and xstabs entries.
+ (obj_elf_version): Use subseg_new, not bfd_make_section. Don't
+ set SEC_LOAD for .note section.
+ (adjust_stab_sections): Get frag pointer from seg_info, rather
+ than looking through frags.
+ * config/obj-elf.h (S_{S,G}ET_{OTHER,TYPE,DESC}): Removed.
+ (SEPARATE_STAB_SECTIONS, INIT_STAB_SECTION, OBJ_PROCESS_STAB):
+ Define.
+ * config/obj-vms.c (obj_aout_stab): Removed.
+ (obj_pseudo_table): Removed stabX entries.
+ * config/obj-vms.h (S_SET_TYPE): Define.
+
+ * as.h: Declare listing.
+ * read.c: Don't declare listing.
+ (emit_expr): Cast fix_new_exp argument.
+ (parse_bitfield_cons): Correct printf format.
+ * symbols.c (symbol_new): Add cast to avoid warning.
+ * write.h: Declare text_last_frag and data_last_frag.
+ * config/obj-bout.c (obj_bout_line): Added dummy argument.
+ * config/obj-coffbfd.c: Add some casts to avoid warnings.
+ * config/tc-a29k.c: Likewise.
+ * config/tc-i960.c: Likewise. Also fully bracket structure
+ initializations, fix printf formats, and remove unused variables.
+
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.
diff --git a/gas/config/obj-bout.c b/gas/config/obj-bout.c
index 6fc5b37..cbbffae 100644
--- a/gas/config/obj-bout.c
+++ b/gas/config/obj-bout.c
@@ -19,7 +19,6 @@
#include "as.h"
#include "obstack.h"
-#include "aout/stab_gnu.h"
const short /* in: segT out: N_TYPE bits */
seg_N_TYPE[] =
{
@@ -55,24 +54,11 @@ const segT N_TYPE_seg[N_TYPE + 2] =
SEG_GOOF,
};
-#if __STDC__ == 1
-static void obj_bout_stab (int what);
-static void obj_bout_line (void);
-static void obj_bout_desc (void);
-#else /* not __STDC__ */
-static void obj_bout_desc ();
-static void obj_bout_stab ();
-static void obj_bout_line ();
-#endif /* not __STDC__ */
+static void obj_bout_line PARAMS ((int));
const pseudo_typeS obj_pseudo_table[] =
{
-/* stabs (aka a.out aka b.out directives for debug symbols) */
- {"desc", obj_bout_desc, 0}, /* def */
{"line", obj_bout_line, 0}, /* source code line number */
- {"stabd", obj_bout_stab, 'd'},/* stabs */
- {"stabn", obj_bout_stab, 'n'},/* stabs */
- {"stabs", obj_bout_stab, 's'},/* stabs */
/* coff debugging directives. Currently ignored silently */
{"def", s_ignore, 0},
@@ -226,7 +212,8 @@ obj_symbol_new_hook (symbolP)
} /* obj_symbol_new_hook() */
static void
-obj_bout_line ()
+obj_bout_line (ignore)
+ int ignore;
{
/* Assume delimiter is part of expression. */
/* BSD4.2 as fails with delightful bug, so we */
@@ -235,190 +222,6 @@ obj_bout_line ()
demand_empty_rest_of_line ();
} /* obj_bout_line() */
-/*
- * stab()
- *
- * Handle .stabX directives, which used to be open-coded.
- * So much creeping featurism overloaded the semantics that we decided
- * to put all .stabX thinking in one place. Here.
- *
- * We try to make any .stabX directive legal. Other people's AS will often
- * do assembly-time consistency checks: eg assigning meaning to n_type bits
- * and "protecting" you from setting them to certain values. (They also zero
- * certain bits before emitting symbols. Tut tut.)
- *
- * If an expression is not absolute we either gripe or use the relocation
- * information. Other people's assemblers silently forget information they
- * don't need and invent information they need that you didn't supply.
- *
- * .stabX directives always make a symbol table entry. It may be junk if
- * the rest of your .stabX directive is malformed.
- */
-static void
-obj_bout_stab (what)
- int what;
-{
- register symbolS *symbolP = 0;
- register char *string;
- int saved_type = 0;
- int length;
- int goof; /* TRUE if we have aborted. */
- long longint;
-
- /*
- * Enter with input_line_pointer pointing past .stabX and any following
- * whitespace.
- */
- goof = 0; /* JF who forgot this?? */
- if (what == 's')
- {
- string = demand_copy_C_string (&length);
- SKIP_WHITESPACE ();
- if (*input_line_pointer == ',')
- input_line_pointer++;
- else
- {
- as_bad ("I need a comma after symbol's name");
- goof = 1;
- }
- }
- else
- string = "";
-
- /*
- * Input_line_pointer->after ','. String->symbol name.
- */
- if (!goof)
- {
- symbolP = symbol_new (string,
- SEG_UNKNOWN,
- 0,
- (struct frag *) 0);
- switch (what)
- {
- case 'd':
- S_SET_NAME (symbolP, NULL); /* .stabd feature. */
- S_SET_VALUE (symbolP, obstack_next_free (&frags) -
- frag_now->fr_literal);
- symbolP->sy_frag = frag_now;
- break;
-
- case 'n':
- symbolP->sy_frag = &zero_address_frag;
- break;
-
- case 's':
- symbolP->sy_frag = &zero_address_frag;
- break;
-
- default:
- BAD_CASE (what);
- break;
- }
- if (get_absolute_expression_and_terminator (&longint) == ',')
- symbolP->sy_symbol.n_type = saved_type = longint;
- else
- {
- as_bad ("I want a comma after the n_type expression");
- goof = 1;
- input_line_pointer--; /* Backup over a non-',' char. */
- }
- }
- if (!goof)
- {
- if (get_absolute_expression_and_terminator (&longint) == ',')
- S_SET_OTHER (symbolP, longint);
- else
- {
- as_bad ("I want a comma after the n_other expression");
- goof = 1;
- input_line_pointer--; /* Backup over a non-',' char. */
- }
- }
- if (!goof)
- {
- S_SET_DESC (symbolP, get_absolute_expression ());
- if (what == 's' || what == 'n')
- {
- if (*input_line_pointer != ',')
- {
- as_bad ("I want a comma after the n_desc expression");
- goof = 1;
- }
- else
- {
- input_line_pointer++;
- }
- }
- }
- if ((!goof) && (what == 's' || what == 'n'))
- {
- pseudo_set (symbolP);
- symbolP->sy_symbol.n_type = saved_type;
- }
-#ifndef NO_LISTING
- {
- extern int listing;
-
- if (listing && !goof)
- {
- if (symbolP->sy_symbol.n_type == N_SLINE)
- {
-
- listing_source_line (symbolP->sy_symbol.n_desc);
- }
- else if (symbolP->sy_symbol.n_type == N_SO
- || symbolP->sy_symbol.n_type == N_SOL)
- {
- listing_source_file (string);
- }
- }
- }
-
-#endif
-
- if (goof)
- ignore_rest_of_line ();
- else
- demand_empty_rest_of_line ();
-} /* obj_bout_stab() */
-
-static void
-obj_bout_desc ()
-{
- register char *name;
- register char c;
- register char *p;
- register symbolS *symbolP;
- register int temp;
-
- /*
- * Frob invented at RMS' request. Set the n_desc of a symbol.
- */
- name = input_line_pointer;
- c = get_symbol_end ();
- p = input_line_pointer;
- *p = c;
- SKIP_WHITESPACE ();
- if (*input_line_pointer != ',')
- {
- *p = 0;
- as_bad ("Expected comma after name \"%s\"", name);
- *p = c;
- ignore_rest_of_line ();
- }
- else
- {
- input_line_pointer++;
- temp = get_absolute_expression ();
- *p = 0;
- symbolP = symbol_find_or_make (name);
- *p = c;
- S_SET_DESC (symbolP, temp);
- }
- demand_empty_rest_of_line ();
-} /* obj_bout_desc() */
-
void
obj_read_begin_hook ()
{
@@ -446,19 +249,19 @@ obj_crawl_symbol_chain (headers)
resolve_symbol_value (symbolP);
/* OK, here is how we decide which symbols go out into the
- brave new symtab. Symbols that do are:
+ brave new symtab. Symbols that do are:
- * symbols with no name (stabd's?)
- * symbols with debug info in their N_TYPE
+ * symbols with no name (stabd's?)
+ * symbols with debug info in their N_TYPE
- Symbols that don't are:
- * symbols that are registers
- * symbols with \1 as their 3rd character (numeric labels)
- * "local labels" as defined by S_LOCAL_NAME(name)
- if the -L switch was passed to gas.
+ Symbols that don't are:
+ * symbols that are registers
+ * symbols with \1 as their 3rd character (numeric labels)
+ * "local labels" as defined by S_LOCAL_NAME(name)
+ if the -L switch was passed to gas.
- All other symbols are output. We complain if a deleted
- symbol was marked external. */
+ All other symbols are output. We complain if a deleted
+ symbol was marked external. */
if (1
diff --git a/gas/config/obj-bout.h b/gas/config/obj-bout.h
index 2fa6f6e..41cff7b 100644
--- a/gas/config/obj-bout.h
+++ b/gas/config/obj-bout.h
@@ -228,6 +228,8 @@ struct relocation_info
#define S_SET_OTHER(s,v) ((s)->sy_symbol.n_other = (v))
/* Set the n_desc expression value */
#define S_SET_DESC(s,v) ((s)->sy_symbol.n_desc = (v))
+/* Set the n_type value */
+#define S_SET_TYPE(s,v) ((s)->sy_symbol.n_type = (v))
/* File header macro and type definition */
@@ -294,9 +296,12 @@ object_headers;
#if __STDC__
struct fix;
-void tc_aout_fix_to_chars (char *where, struct fix *fixP, relax_addressT segment_address);
-#else /* not __STDC__ */
-void tc_aout_fix_to_chars ();
-#endif /* not __STDC__ */
+#endif
+extern void tc_aout_fix_to_chars PARAMS ((char *where,
+ struct fix *fixP,
+ relax_addressT segment_address));
+extern void tc_bout_fix_to_chars PARAMS ((char *where,
+ struct fix *fixP,
+ relax_addressT segment_address));
/* end of obj-bout.h */
diff --git a/gas/config/obj-coffbfd.c b/gas/config/obj-coffbfd.c
index b224f05..0ebc8fa 100644
--- a/gas/config/obj-coffbfd.c
+++ b/gas/config/obj-coffbfd.c
@@ -80,13 +80,6 @@ const short seg_N_TYPE[] =
int function_lineoff = -1; /* Offset in line#s where the last function
started (the odd entry for line #0) */
-/* This is used along with macros in the .h file to fake the .stabX
- directive reader into thinking it's working on a real symbol, when
- it's actually only a temporary that will get converted into a
- stab-section symbol later. */
-
-symbolS current_stab_symbol;
-
static symbolS *last_line_symbol;
/* Add 4 to the real value to get the index and compensate the
@@ -554,7 +547,7 @@ DEFUN (fill_section, (abfd, h, file_cursor),
{
memcpy (buffer + frag->fr_address,
frag->fr_literal,
- frag->fr_fix);
+ (unsigned int) frag->fr_fix);
offset += frag->fr_fix;
}
@@ -566,7 +559,7 @@ DEFUN (fill_section, (abfd, h, file_cursor),
{
memcpy (buffer + frag->fr_address,
frag->fr_literal,
- frag->fr_fix);
+ (unsigned int) frag->fr_fix);
offset += frag->fr_fix;
}
@@ -828,7 +821,7 @@ obj_coff_ln (appline)
{
if (! appline)
l += line_base - 1;
- listing_source_line (l);
+ listing_source_line ((unsigned int) l);
}
}
@@ -895,7 +888,7 @@ DEFUN (obj_coff_def, (what),
S_SET_NAME (def_symbol_in_progress, symbol_name_copy);
#endif /* STRIP_UNDERSCORE */
/* free(symbol_name_copy); */
- def_symbol_in_progress->sy_name_offset = ~0;
+ def_symbol_in_progress->sy_name_offset = (unsigned long) ~0;
def_symbol_in_progress->sy_number = ~0;
def_symbol_in_progress->sy_frag = &zero_address_frag;
S_SET_VALUE (def_symbol_in_progress, 0);
@@ -1147,7 +1140,7 @@ obj_coff_line (ignore)
extern int listing;
if (listing && 0)
{
- listing_source_line (line_base);
+ listing_source_line ((unsigned int) line_base);
}
}
#endif
@@ -1266,7 +1259,7 @@ obj_coff_val (ignore)
if (!strcmp (symbol_name, "."))
{
def_symbol_in_progress->sy_frag = frag_now;
- S_SET_VALUE (def_symbol_in_progress, obstack_next_free (&frags) - frag_now->fr_literal);
+ S_SET_VALUE (def_symbol_in_progress, (valueT) frag_now_fix ());
/* If the .val is != from the .def (e.g. statics) */
}
else if (strcmp (S_GET_NAME (def_symbol_in_progress), symbol_name))
@@ -1300,7 +1293,8 @@ obj_coff_val (ignore)
}
else
{
- S_SET_VALUE (def_symbol_in_progress, get_absolute_expression ());
+ S_SET_VALUE (def_symbol_in_progress,
+ (valueT) get_absolute_expression ());
} /* if symbol based */
demand_empty_rest_of_line ();
@@ -1706,7 +1700,7 @@ DEFUN (w_strings, (where),
symbolS *symbolP;
/* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK */
- md_number_to_chars (where, string_byte_count, 4);
+ md_number_to_chars (where, (valueT) string_byte_count, 4);
where += 4;
for (symbolP = symbol_rootP;
symbolP;
@@ -1811,7 +1805,7 @@ DEFUN_VOID (remove_subsegs)
}
}
-int machine;
+unsigned long machine;
int coff_flags;
extern void
DEFUN_VOID (write_object_file)
@@ -1881,7 +1875,7 @@ DEFUN_VOID (write_object_file)
H_GET_NUMBER_OF_SECTIONS (&headers) + 1);
}
- size = size_section (abfd, i);
+ size = size_section (abfd, (unsigned int) i);
addr += size;
if (i == SEG_E0)
@@ -1910,7 +1904,7 @@ DEFUN_VOID (write_object_file)
file_cursor = H_GET_TEXT_FILE_OFFSET (&headers);
- bfd_seek (abfd, file_cursor, 0);
+ bfd_seek (abfd, (file_ptr) file_cursor, 0);
/* Plant the data */
@@ -2072,7 +2066,7 @@ obj_coff_section (ignore)
}
}
- subseg_new (section_name, exp);
+ subseg_new (section_name, (subsegT) exp);
segment_info[now_seg].scnhdr.s_flags |= flags;
@@ -2134,7 +2128,9 @@ c_symbol_merge (debug, normal)
if (S_GET_NUMBER_AUXILIARY (debug) > 0)
{
- memcpy ((char *) &normal->sy_symbol.ost_auxent[0], (char *) &debug->sy_symbol.ost_auxent[0], S_GET_NUMBER_AUXILIARY (debug) * AUXESZ);
+ memcpy ((char *) &normal->sy_symbol.ost_auxent[0],
+ (char *) &debug->sy_symbol.ost_auxent[0],
+ (unsigned int) (S_GET_NUMBER_AUXILIARY (debug) * AUXESZ));
} /* Move all the auxiliary information */
/* Move the debug flags. */
@@ -2206,7 +2202,7 @@ c_dot_file_symbol (filename)
#endif
SF_SET_DEBUG (symbolP);
- S_SET_VALUE (symbolP, (long) previous_file_symbol);
+ S_SET_VALUE (symbolP, (valueT) previous_file_symbol);
previous_file_symbol = symbolP;
diff --git a/gas/config/obj-coffbfd.h b/gas/config/obj-coffbfd.h
index 0968767..659c709 100644
--- a/gas/config/obj-coffbfd.h
+++ b/gas/config/obj-coffbfd.h
@@ -122,28 +122,10 @@ typedef struct
union internal_auxent ost_auxent[OBJ_COFF_MAX_AUXENTRIES]; /* Auxiliary entry. */
unsigned int ost_flags; /* obj_coff internal use only flags */
-
- /* For stabs-in-coff. */
- unsigned long n_strx; /* index into string table of name */
- unsigned char n_type; /* type of symbol */
- unsigned char n_other; /* misc info (usually empty) */
- unsigned short n_desc; /* description field */
- bfd_vma n_value; /* value of symbol */
-
}
obj_symbol_type;
-#define S_SET_OFFSET_2(S,V) ((S)->sy_symbol.n_strx = (V))
-#define S_SET_OTHER(S,V) ((S)->sy_symbol.n_other = (V))
-#define S_SET_TYPE(S,T) ((S)->sy_symbol.n_type = (T))
-#define S_SET_DESC(S,D) ((S)->sy_symbol.n_desc = (D))
-#define S_GET_OFFSET_2(S) ((S)->sy_symbol.n_strx)
-#define S_GET_OTHER(S) ((S)->sy_symbol.n_other)
-#define S_GET_TYPE(S) ((S)->sy_symbol.n_type)
-#define S_GET_DESC(S) ((S)->sy_symbol.n_desc)
-
-
#ifndef DO_NOT_STRIP
#define DO_NOT_STRIP 0
#define DO_STRIP 1
@@ -550,10 +532,4 @@ extern SCNHDR text_section_header;
#define SEPARATE_STAB_SECTIONS
-#define MAKE_STAB_SYMBOL(SYM, STR, SEC) \
- { extern symbolS current_stab_symbol; \
- (SYM) = &current_stab_symbol; \
- (SYM)->sy_symbol.n_strx = get_stab_string_offset(STR, SEC); \
- }
-
/* end of obj-coffbfd.h */
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 9acca92..11c5499 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -19,15 +19,11 @@
#include "as.h"
#include "subsegs.h"
-#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 ((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));
@@ -49,13 +45,7 @@ const pseudo_typeS obj_pseudo_table[] =
{"weak", obj_elf_weak, 0},
/* These are used for stabs-in-elf configurations. */
- {"desc", obj_elf_desc, 0},
{"line", obj_elf_line, 0},
- {"stabd", obj_elf_stab, 'd'},
- {"stabn", obj_elf_stab, 'n'},
- {"stabs", obj_elf_stab, 's'},
-/* This is used on Solaris 2.x on SPARC, but not supported yet. */
- {"xstabs", obj_elf_xstab, 's'},
/* These are used for dwarf. */
{"2byte", cons, 2},
@@ -491,379 +481,6 @@ obj_elf_line (ignore)
demand_empty_rest_of_line ();
}
-/*
- * stab()
- *
- * Handle .stabX directives, which used to be open-coded.
- * So much creeping featurism overloaded the semantics that we decided
- * to put all .stabX thinking in one place. Here.
- *
- * We try to make any .stabX directive legal. Other people's AS will often
- * do assembly-time consistency checks: eg assigning meaning to n_type bits
- * and "protecting" you from setting them to certain values. (They also zero
- * certain bits before emitting symbols. Tut tut.)
- *
- * If an expression is not absolute we either gripe or use the relocation
- * information. Other people's assemblers silently forget information they
- * don't need and invent information they need that you didn't supply.
- *
- * .stabX directives always make a symbol table entry. It may be junk if
- * the rest of your .stabX directive is malformed.
- */
-
-/*
- * elf_stab_symbol_string()
- *
- * Build a string dictionary entry for a .stabX symbol.
- * The symbol is added to the .stabstr section.
- *
- */
-
-static unsigned int
-elf_stab_symbol_string (string, secname)
- char *string, *secname;
-{
- asection *save_seg;
- asection *seg;
- subsegT save_subseg;
- unsigned int length;
- unsigned int old_gdb_string_index;
- char *clengthP;
- int i;
- char c;
- /* @@FIXME -- there should be no static data here!
- This also has the effect of making all stab string tables large enough
- to contain all the contents written to any of them. This only matters
- with the Solaris native compiler for the moment, but it should be fixed
- anyways. */
- static unsigned int gdb_string_index = 0;
-
- old_gdb_string_index = 0;
- length = strlen (string);
- clengthP = (char *) &length;
- if (length > 0)
- { /* Ordinary case. */
- save_seg = now_seg;
- save_subseg = now_subseg;
-
- /* Create the stab sections, if they are not already created. */
- {
- char *newsecname = xmalloc ((unsigned long) (strlen (secname) + 4));
- strcpy (newsecname, secname);
- strcat (newsecname, "str");
- seg = bfd_get_section_by_name (stdoutput, newsecname);
- if (seg == 0)
- {
- seg = bfd_make_section_old_way (stdoutput, newsecname);
- bfd_set_section_flags (stdoutput, seg,
- SEC_LOAD | SEC_READONLY | SEC_ALLOC);
- }
-/* free (newsecname);*/
- }
- subseg_new ((char *) seg->name, save_subseg);
- old_gdb_string_index = gdb_string_index;
- i = 0;
- while ((c = *string++))
- {
- i++;
- gdb_string_index++;
- FRAG_APPEND_1_CHAR (c);
- }
- {
- FRAG_APPEND_1_CHAR ((char) 0);
- i++;
- gdb_string_index++;
- }
- while (i % 4 != 0)
- {
- FRAG_APPEND_1_CHAR ((char) 0);
- i++;
- gdb_string_index++;
- }
- subseg_new ((char *) save_seg->name, save_subseg);
- }
-
- return old_gdb_string_index;
-}
-
-static void
-DEFUN (elf_stab_symbol, (symbolP, stab_type),
- symbolS *symbolP AND
- int stab_type)
-{
- char *toP;
-
- toP = frag_more (8);
- /* the string index portion of the stab */
- md_number_to_chars (toP, (valueT) symbolP->sy_name_offset, 4);
- md_number_to_chars (toP + 4, (valueT) S_GET_TYPE (symbolP), 1);
- md_number_to_chars (toP + 5, (valueT) S_GET_OTHER (symbolP), 1);
- md_number_to_chars (toP + 6, (valueT) S_GET_DESC (symbolP), 2);
- /* The n_value field doesn't get written here, it gets done below. It
- may be an expression needing relocating. */
-}
-
-static void
-obj_elf_stab_generic (what, secname)
- int what;
- char *secname;
-{
- extern int listing;
-
- symbolS *symbolP = 0;
- char *string;
- int saved_type = 0;
- int length;
- int goof = 0;
- int seg_is_new = 0;
- long longint;
- asection *saved_seg = now_seg;
- asection *seg;
- subsegT subseg = now_subseg;
-
-#if 0
- /* This function doesn't work yet.
-
- Actually, this function is okay, but some finalizations are
- needed before writing the object file; that's not done yet, and
- the Solaris linker chokes without it.
-
- In any case, this should effectively disable it for now. */
- if (what == 's')
- demand_copy_C_string (&length);
- s_ignore (69);
- return;
-#endif
-
- seg = bfd_get_section_by_name (stdoutput, secname);
- if (seg == 0)
- {
- seg = subseg_new (secname, 0);
- bfd_set_section_flags (stdoutput, seg,
- SEC_LOAD | SEC_READONLY | SEC_ALLOC | SEC_RELOC);
- subseg_set (saved_seg, subseg);
- seg_is_new = 1;
- }
-
- /*
- * Enter with input_line_pointer pointing past .stabX and any following
- * whitespace.
- */
- if (what == 's')
- {
- string = demand_copy_C_string (&length);
- SKIP_WHITESPACE ();
- if (*input_line_pointer == ',')
- input_line_pointer++;
- else
- {
- as_bad ("I need a comma after symbol's name");
- goof = 1;
- }
- }
- else
- string = "";
-
- /*
- * Input_line_pointer->after ','. String->symbol name.
- */
- if (!goof)
- {
- symbolP = symbol_new (string, &bfd_und_section, (valueT) 0, (struct frag *) 0);
-
- /* enter the string in the .stab string table (section .stabstr) */
- symbolP->sy_name_offset = elf_stab_symbol_string (string, secname);
-
- switch (what)
- {
- case 'd':
- S_SET_NAME (symbolP, NULL); /* .stabd feature. */
- S_SET_VALUE (symbolP,
- (valueT) ((char*) obstack_next_free (&frags) - frag_now->fr_literal));
- S_SET_SEGMENT (symbolP, now_seg);
- symbolP->sy_frag = frag_now;
- break;
-
- case 'n':
- symbolP->sy_frag = &zero_address_frag;
- break;
-
- case 's':
- symbolP->sy_frag = &zero_address_frag;
- break;
-
- default:
- BAD_CASE (what);
- break;
- }
-
- if (get_absolute_expression_and_terminator (&longint) == ',')
- {
- saved_type = longint;
- S_SET_TYPE (symbolP, saved_type);
- }
- else
- {
- as_bad ("I want a comma after the n_type expression");
- goof = 1;
- input_line_pointer--; /* Backup over a non-',' char. */
- }
- }
-
- if (!goof)
- {
- if (get_absolute_expression_and_terminator (&longint) == ',')
- S_SET_OTHER (symbolP, longint);
- else
- {
- as_bad ("I want a comma after the n_other expression");
- goof = 1;
- input_line_pointer--; /* Backup over a non-',' char. */
- }
- }
-
- if (!goof)
- {
- S_SET_DESC (symbolP, get_absolute_expression ());
- if (what == 's' || what == 'n')
- {
- if (*input_line_pointer != ',')
- {
- as_bad ("I want a comma after the n_desc expression");
- goof = 1;
- }
- else
- {
- input_line_pointer++;
- }
- }
- }
-
- if (goof)
- {
- ignore_rest_of_line ();
- return;
- }
-
- subseg_set (seg, subseg);
-
- if (seg_is_new)
- /* allocate and discard -- filled in later */
- (void) frag_more (12);
-
- /* Emit the stab symbol. */
- elf_stab_symbol (symbolP, what);
-
- if (what == 's' || what == 'n')
- {
- cons (4);
- input_line_pointer--;
- }
- else
- {
- char *p = frag_more (4);
- md_number_to_chars (p, 0, 4);
- }
-
- subseg_set (saved_seg, subseg);
-
- if ((what == 's' || what == 'n')
- && symbolP->sy_value.X_op == O_constant)
- {
- /* symbol is not needed in the regular symbol table */
- symbol_remove (symbolP, &symbol_rootP, &symbol_lastP);
- }
-
- if (what == 's' && S_GET_TYPE (symbolP) == N_SO)
- {
- fragS *fragp = seg_info (seg)->frchainP->frch_root;
- while (fragp
- && fragp->fr_address + fragp->fr_fix < 12)
- fragp = fragp->fr_next;
- assert (fragp != 0);
- assert (fragp->fr_type == rs_fill);
- assert (fragp->fr_address == 0 && fragp->fr_fix >= 12);
- md_number_to_chars (fragp->fr_literal, (valueT) symbolP->sy_name_offset,
- 4);
- }
-
- if (listing)
- switch (S_GET_TYPE (symbolP))
- {
- case N_SLINE:
- listing_source_line ((unsigned int) S_GET_DESC (symbolP));
- break;
- case N_SO:
- case N_SOL:
- listing_source_file (string);
- break;
- }
-
- demand_empty_rest_of_line ();
-}
-
-static void
-obj_elf_stab (what)
- int what;
-{
- obj_elf_stab_generic (what, ".stab");
-}
-
-static void
-obj_elf_xstab (what)
- int what;
-{
- int length;
- char *secname;
-
- secname = demand_copy_C_string (&length);
- SKIP_WHITESPACE ();
- if (*input_line_pointer == ',')
- input_line_pointer++;
- else
- {
- as_bad ("comma missing in .xstabs");
- ignore_rest_of_line ();
- return;
- }
- obj_elf_stab_generic (what, secname);
-}
-
-void
-obj_elf_desc (ignore)
- int ignore;
-{
- char *name;
- char c;
- char *p;
- symbolS *symbolP;
- int temp;
-
- /* Frob invented at RMS' request. Set the n_desc of a symbol. */
- name = input_line_pointer;
- c = get_symbol_end ();
- p = input_line_pointer;
- *p = c;
- SKIP_WHITESPACE ();
- if (*input_line_pointer != ',')
- {
- *p = 0;
- as_bad ("Expected comma after name \"%s\"", name);
- *p = c;
- ignore_rest_of_line ();
- }
- else
- {
- input_line_pointer++;
- temp = get_absolute_expression ();
- *p = 0;
- symbolP = symbol_find_or_make (name);
- *p = c;
- S_SET_DESC (symbolP, temp);
- }
- demand_empty_rest_of_line ();
-} /* obj_elf_desc() */
-
void
obj_read_begin_hook ()
{
@@ -913,20 +530,15 @@ obj_elf_version (ignore)
*(input_line_pointer - 1) = '\0';
*input_line_pointer = c;
- /* create the .note section if this is the first version string */
+ /* create the .note section */
- note_secp = bfd_get_section_by_name (stdoutput, ".note");
- if (note_secp == (asection *) NULL)
- {
- note_secp = bfd_make_section_old_way (stdoutput, ".note");
- bfd_set_section_flags (stdoutput,
- note_secp,
- SEC_LOAD | SEC_HAS_CONTENTS | SEC_READONLY);
- }
+ note_secp = subseg_new (".note", 0);
+ bfd_set_section_flags (stdoutput,
+ note_secp,
+ SEC_HAS_CONTENTS | SEC_READONLY);
/* process the version string */
- subseg_set (note_secp, 0);
len = strlen (name);
i_note.namesz = ((len + 1) + 3) & ~3; /* round this to word boundary */
@@ -1083,7 +695,7 @@ adjust_stab_sections (abfd, sec, xxx)
{
char *name;
asection *strsec;
- fragS *fragp;
+ char *p;
int strsz, nsyms;
if (strncmp (".stab", sec->name, 5))
@@ -1101,16 +713,11 @@ adjust_stab_sections (abfd, sec, xxx)
strsz = 0;
nsyms = bfd_section_size (abfd, sec) / 12 - 1;
- fragp = seg_info (sec)->frchainP->frch_root;
- while (fragp
- && fragp->fr_address + fragp->fr_fix < 12)
- fragp = fragp->fr_next;
- assert (fragp != 0);
- assert (fragp->fr_type == rs_fill);
- assert (fragp->fr_address == 0 && fragp->fr_fix >= 12);
+ p = seg_info (sec)->stabu.p;
+ assert (p != 0);
- bfd_h_put_16 (abfd, (bfd_vma) nsyms, fragp->fr_literal + 6);
- bfd_h_put_32 (abfd, (bfd_vma) strsz, fragp->fr_literal + 8);
+ bfd_h_put_16 (abfd, (bfd_vma) nsyms, p + 6);
+ bfd_h_put_32 (abfd, (bfd_vma) strsz, p + 8);
}
void
diff --git a/gas/config/obj-vms.c b/gas/config/obj-vms.c
index 2ea43f5..4bbb67d 100644
--- a/gas/config/obj-vms.c
+++ b/gas/config/obj-vms.c
@@ -332,165 +332,10 @@ s_const ()
demand_empty_rest_of_line ();
}
-/*
- * stab()
- *
- * Handle .stabX directives, which used to be open-coded.
- * So much creeping featurism overloaded the semantics that we decided
- * to put all .stabX thinking in one place. Here.
- *
- * We try to make any .stabX directive legal. Other people's AS will often
- * do assembly-time consistency checks: eg assigning meaning to n_type bits
- * and "protecting" you from setting them to certain values. (They also zero
- * certain bits before emitting symbols. Tut tut.)
- *
- * If an expression is not absolute we either gripe or use the relocation
- * information. Other people's assemblers silently forget information they
- * don't need and invent information they need that you didn't supply.
- *
- * .stabX directives always make a symbol table entry. It may be junk if
- * the rest of your .stabX directive is malformed.
- */
-static void
-obj_aout_stab (what)
- int what;
-{
-#ifndef NO_LISTING
- extern int listing;
-#endif /* NO_LISTING */
-
- register symbolS *symbolP = 0;
- register char *string;
- int saved_type = 0;
- int length;
- int goof; /* TRUE if we have aborted. */
- long longint;
-
-/*
- * Enter with input_line_pointer pointing past .stabX and any following
- * whitespace.
- */
- goof = 0; /* JF who forgot this?? */
- if (what == 's')
- {
- string = demand_copy_C_string (&length);
- SKIP_WHITESPACE ();
- if (*input_line_pointer == ',')
- input_line_pointer++;
- else
- {
- as_bad ("I need a comma after symbol's name");
- goof = 1;
- }
- }
- else
- string = "";
-
-/*
- * Input_line_pointer->after ','. String->symbol name.
- */
- if (!goof)
- {
- symbolP = symbol_new (string,
- SEG_UNKNOWN,
- 0,
- (struct frag *) 0);
- switch (what)
- {
- case 'd':
- S_SET_NAME (symbolP, NULL); /* .stabd feature. */
- S_SET_VALUE (symbolP, obstack_next_free (&frags) - frag_now->fr_literal);
- symbolP->sy_frag = frag_now;
- break;
-
- case 'n':
- symbolP->sy_frag = &zero_address_frag;
- break;
-
- case 's':
- symbolP->sy_frag = &zero_address_frag;
- break;
-
- default:
- BAD_CASE (what);
- break;
- }
-
- if (get_absolute_expression_and_terminator (&longint) == ',')
- symbolP->sy_symbol.n_type = saved_type = longint;
- else
- {
- as_bad ("I want a comma after the n_type expression");
- goof = 1;
- input_line_pointer--; /* Backup over a non-',' char. */
- }
- }
-
- if (!goof)
- {
- if (get_absolute_expression_and_terminator (&longint) == ',')
- S_SET_OTHER (symbolP, longint);
- else
- {
- as_bad ("I want a comma after the n_other expression");
- goof = 1;
- input_line_pointer--; /* Backup over a non-',' char. */
- }
- }
-
- if (!goof)
- {
- S_SET_DESC (symbolP, get_absolute_expression ());
- if (what == 's' || what == 'n')
- {
- if (*input_line_pointer != ',')
- {
- as_bad ("I want a comma after the n_desc expression");
- goof = 1;
- }
- else
- {
- input_line_pointer++;
- }
- }
- }
-
- if ((!goof) && (what == 's' || what == 'n'))
- {
- pseudo_set (symbolP);
- symbolP->sy_symbol.n_type = saved_type;
- }
-
-#ifndef NO_LISTING
- if (listing && !goof)
- {
- if (symbolP->sy_symbol.n_type == N_SLINE)
- {
-
- listing_source_line(symbolP->sy_symbol.n_desc);
- }
- else if (symbolP->sy_symbol.n_type == N_SO
- || symbolP->sy_symbol.n_type == N_SOL)
- {
- listing_source_file(string);
- }
- }
-#endif
-
- if (goof)
- ignore_rest_of_line ();
- else
- demand_empty_rest_of_line ();
-} /* obj_aout_stab() */
-
const pseudo_typeS obj_pseudo_table[] =
{
- {"stabd", obj_aout_stab, 'd'},/* stabs */
- {"stabn", obj_aout_stab, 'n'},/* stabs */
- {"stabs", obj_aout_stab, 's'},/* stabs */
{"const", s_const, 0},
{0, 0, 0},
-
}; /* obj_pseudo_table */
int
diff --git a/gas/config/obj-vms.h b/gas/config/obj-vms.h
index c30a3a4..b62599c 100644
--- a/gas/config/obj-vms.h
+++ b/gas/config/obj-vms.h
@@ -196,6 +196,8 @@ typedef struct nlist obj_symbol_type; /* Symbol table entry */
#define S_SET_OTHER(s,v) ((s)->sy_symbol.n_other = (v))
/* Set the n_desc expression value */
#define S_SET_DESC(s,v) ((s)->sy_symbol.n_desc = (v))
+/* Set the n_type expression value */
+#define S_SET_TYPE(s,v) ((s)->sy_symbol.n_type = (v))
/* File header macro and type definition */
diff --git a/gas/config/tc-a29k.c b/gas/config/tc-a29k.c
index 11a5793..9843d19 100644
--- a/gas/config/tc-a29k.c
+++ b/gas/config/tc-a29k.c
@@ -201,12 +201,14 @@ insert_sreg (regname, regnum)
char buf[80];
int i;
- symbol_table_insert (symbol_new (regname, SEG_REGISTER, regnum, &zero_address_frag));
+ symbol_table_insert (symbol_new (regname, SEG_REGISTER, (valueT) regnum,
+ &zero_address_frag));
for (i = 0; regname[i]; i++)
buf[i] = islower (regname[i]) ? toupper (regname[i]) : regname[i];
buf[i] = '\0';
- symbol_table_insert (symbol_new (buf, SEG_REGISTER, regnum, &zero_address_frag));
+ symbol_table_insert (symbol_new (buf, SEG_REGISTER, (valueT) regnum,
+ &zero_address_frag));
} /* insert_sreg() */
/* Install symbol definitions for assorted special registers.
@@ -770,7 +772,7 @@ md_atof (type, litP, sizeP)
*sizeP = prec * sizeof (LITTLENUM_TYPE);
for (wordP = words; prec--;)
{
- md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE));
+ md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
return ""; /* Someone should teach Dean about null pointers */
@@ -1112,7 +1114,8 @@ md_undefined_symbol (name)
/* We have a wiener! Define and return a new symbol for it. */
if (name[0] == 'l' || name[0] == 'L')
regnum += 128;
- return (symbol_new (name, SEG_REGISTER, regnum, &zero_address_frag));
+ return (symbol_new (name, SEG_REGISTER, (valueT) regnum,
+ &zero_address_frag));
}
}