summaryrefslogtreecommitdiff
path: root/gcc/mips-tfile.c
diff options
context:
space:
mode:
authormeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>1992-03-21 23:57:59 +0000
committermeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>1992-03-21 23:57:59 +0000
commitbdd7dca372011acc1848805559325943f851cb71 (patch)
treee3531104075c78d2c359d744211cb72b7c976608 /gcc/mips-tfile.c
parent143a4effbfc334a47c29ff9b51afe90fad541982 (diff)
downloadgcc-bdd7dca372011acc1848805559325943f851cb71.tar.gz
*** empty log message ***
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@557 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/mips-tfile.c')
-rw-r--r--gcc/mips-tfile.c91
1 files changed, 56 insertions, 35 deletions
diff --git a/gcc/mips-tfile.c b/gcc/mips-tfile.c
index 85990d38231..32cd7da0270 100644
--- a/gcc/mips-tfile.c
+++ b/gcc/mips-tfile.c
@@ -616,12 +616,12 @@ typedef const void *CPTR_T;
#define __proto(x) x
#else
-#ifdef _STDIO_H_ /* Ultrix 4.0 */
+#if defined(_STDIO_H_) || defined(__STDIO_H__) /* Ultrix 4.0, SGI */
typedef void *PTR_T;
typedef void *CPTR_T;
#else
-typedef char *PTR_T; /* Ultrix 3.1 */
+typedef char *PTR_T; /* Ultrix 3.1 */
typedef char *CPTR_T;
#endif
@@ -640,18 +640,13 @@ typedef char *CPTR_T;
#define Size_t unsigned int
#define Ptrdiff_t int
-#define CODE_MASK 0x8F300
-#define MIPS_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK)
-#define MIPS_MARK_STAB(code) ((code)+CODE_MASK)
-#define MIPS_UNMARK_STAB(code) ((code)-CODE_MASK)
-
/* The following might be called from obstack or malloc,
so they can't be static. */
extern void pfatal_with_name
__proto((char *));
extern void fancy_abort __proto((void));
-extern void botch __proto((const char *));
+ void botch __proto((const char *));
extern PTR_T xmalloc __proto((Size_t));
extern PTR_T xcalloc __proto((Size_t, Size_t));
extern PTR_T xrealloc __proto((PTR_T, Size_t));
@@ -689,8 +684,8 @@ main ()
#include <signal.h>
#include <sys/stat.h>
-#ifdef USG
-#include "stab.h" /* If doing DBX on sysV, use our own stab.h. */
+#if defined (USG) || defined (NO_STAB_H)
+#include "gstab.h" /* If doing DBX on sysV, use our own stab.h. */
#else
#include <stab.h> /* On BSD, use the system's stab.h. */
#endif /* not USG */
@@ -1598,6 +1593,7 @@ static int version = 0; /* print version # */
static int had_errors = 0; /* != 0 if errors were found */
static int rename_output = 0; /* != 0 if rename output file*/
static int delete_input = 0; /* != 0 if delete input after done */
+static int stabs_seen = 0; /* != 0 if stabs have been seen */
/* Pseudo symbol to use when putting stabs into the symbol table. */
@@ -1680,6 +1676,7 @@ STATIC char *st_to_string __proto((st_t));
STATIC char *sc_to_string __proto((sc_t));
STATIC char *read_line __proto((void));
STATIC void parse_input __proto((void));
+STATIC void mark_stabs __proto((const char *));
STATIC void parse_begin __proto((const char *));
STATIC void parse_bend __proto((const char *));
STATIC void parse_def __proto((const char *));
@@ -1720,6 +1717,12 @@ STATIC void free_scope __proto((scope_t *));
STATIC void free_tag __proto((tag_t *));
STATIC void free_thead __proto((thead_t *));
+/* rms: The following is a very bad idea.
+ It's easy for these to conflict with definitions on certain systems.
+ All system calls and library functions
+ for which an implicit definition will work
+ should be left implicit.
+ I deleted the declarations for open and fstat. */
/* Prototypes for library functions used. */
#if !defined(NO_LIB_PROTOTYPE) && !defined(_OSF_SOURCE) && !defined(_STDIO_H_)
extern char *strchr __proto((const char *, int));
@@ -1740,7 +1743,6 @@ extern FILE *freopen __proto((const char *, const char *, FILE *));
extern int fflush __proto((FILE *));
extern void perror __proto((const char *));
extern void exit __proto((int));
-extern int open __proto((const char *, int, ...));
extern int rename __proto((const char *, const char *));
#ifndef sgi
@@ -1765,7 +1767,6 @@ extern int write __proto((int, CPTR_T, Size_t));
extern int read __proto((int, PTR_T, Size_t));
extern long lseek __proto((int, long, int));
extern int ftruncate __proto((int, long));
-extern int fstat __proto((int, struct stat *));
#endif
extern char *mktemp __proto((char *));
@@ -1773,6 +1774,8 @@ extern char *mktemp __proto((char *));
extern char *optarg;
extern int optind;
extern int opterr;
+extern char *version_string;
+extern char *sys_siglist[NSIG + 1];
#ifndef SEEK_SET /* Symbolic constants for the "fseek" function: */
#define SEEK_SET 0 /* Set file pointer to offset */
@@ -1803,6 +1806,7 @@ static pseudo_ops_t pseudo_ops[] = {
{ "#.stabn", sizeof("#.stabn")-1, parse_stabn },
{ ".stabs", sizeof(".stabs")-1, parse_stabs },
{ ".stabn", sizeof(".stabn")-1, parse_stabn },
+ { "#@stabs", sizeof("#@stabs")-1, mark_stabs },
};
@@ -2794,13 +2798,13 @@ parse_begin (start)
if (cur_file_ptr == (efdr_t *)0)
{
- error ("#.begin directive without a preceeding .file directive");
+ error ("#.begin directive without a preceding .file directive");
return;
}
if (cur_proc_ptr == (PDR *)0)
{
- error ("#.begin directive without a preceeding .ent directive");
+ error ("#.begin directive without a preceding .ent directive");
return;
}
@@ -2844,13 +2848,13 @@ parse_bend (start)
if (cur_file_ptr == (efdr_t *)0)
{
- error ("#.begin directive without a preceeding .file directive");
+ error ("#.begin directive without a preceding .file directive");
return;
}
if (cur_proc_ptr == (PDR *)0)
{
- error ("#.bend directive without a preceeding .ent directive");
+ error ("#.bend directive without a preceding .ent directive");
return;
}
@@ -3465,13 +3469,13 @@ parse_end (start)
if (cur_file_ptr == (efdr_t *)0)
{
- error (".end directive without a preceeding .file directive");
+ error (".end directive without a preceding .file directive");
return;
}
if (cur_proc_ptr == (PDR *)0)
{
- error (".end directive without a preceeding .ent directive");
+ error (".end directive without a preceding .ent directive");
return;
}
@@ -3525,7 +3529,7 @@ parse_ent (start)
if (cur_file_ptr == (efdr_t *)0)
{
- error (".ent directive without a preceeding .file directive");
+ error (".ent directive without a preceding .file directive");
return;
}
@@ -3580,6 +3584,24 @@ parse_file (start)
}
+/* Make sure the @stabs symbol is emitted. */
+
+static void
+mark_stabs (start)
+ char *start; /* Start of directive (ignored) */
+{
+ if (!stabs_seen)
+ {
+ /* Add a dummy @stabs dymbol. */
+ stabs_seen = 1;
+ (void) add_local_symbol (stabs_symbol,
+ stabs_symbol + sizeof (stabs_symbol),
+ stNil, scInfo, -1, MIPS_MARK_STAB(0));
+
+ }
+}
+
+
/* Parse .stabs directives.
.stabs directives have five fields:
@@ -3622,15 +3644,9 @@ parse_stabs_common (string_start, string_end, rest)
st_t st;
sc_t sc;
int ch;
- static int stabs_seen = 0;
- if (stabs_seen++ == 0)
- {
- /* Add a dummy @stabs dymbol. */
- (void) add_local_symbol (stabs_symbol,
- stabs_symbol + sizeof (stabs_symbol),
- stNil, scInfo, -1, MIPS_MARK_STAB(0));
- }
+ if (stabs_seen == 0)
+ mark_stabs ("");
/* Read code from stabs. */
if (!isdigit (*rest))
@@ -3691,12 +3707,10 @@ parse_stabs_common (string_start, string_end, rest)
}
else
{
- code = MIPS_MARK_STAB(code);
-
/* Skip ,0,0, */
if (p[0] != ',' || p[1] != '0' || p[2] != ',' || p[3] != '0' || p[4] != ',')
{
- error ("Illegal .stabs/.stabn directive, manditory 0 isn't");
+ error ("Illegal .stabs/.stabn directive, mandatory 0 isn't");
return;
}
@@ -3739,10 +3753,20 @@ parse_stabs_common (string_start, string_end, rest)
return;
}
- st = (st_t) sym_ptr->st;
- sc = (sc_t) sym_ptr->sc;
+ /* Traditionally, N_LBRAC and N_RBRAC are *not* relocated. */
+ if (code == (int)N_LBRAC || code == (int)N_RBRAC)
+ {
+ sc = scNil;
+ st = stNil;
+ }
+ else
+ {
+ sc = (sc_t) sym_ptr->sc;
+ st = (st_t) sym_ptr->st;
+ }
value = sym_ptr->value;
}
+ code = MIPS_MARK_STAB(code);
}
(void) add_local_symbol (string_start, string_end, st, sc, value, code);
@@ -4807,7 +4831,6 @@ main (argc, argv)
if (version)
{
- extern char *version_string;
fprintf (stderr, "mips-tfile version %s", version_string);
#ifdef TARGET_VERSION
TARGET_VERSION;
@@ -4908,8 +4931,6 @@ STATIC void
catch_signal (signum)
int signum;
{
- extern char *sys_siglist[NSIG + 1];
-
(void) signal (signum, SIG_DFL); /* just in case... */
fatal (sys_siglist[signum]);
}