mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-25 05:00:01 +00:00
Ran "indent", for GNU coding style; some code & comments still need fixup.
Removed some unneeded files. configure.in: Don't look for te-386bsd.h, which doesn't exist...
This commit is contained in:
parent
5707ea9fad
commit
6efd877de5
@ -1,5 +1,33 @@
|
||||
Mon Nov 23 11:00:16 1992 Ken Raeburn (raeburn@cygnus.com)
|
||||
|
||||
* all files: Whitespace changes for GNU indentation style, done by
|
||||
GNU `indent'. Some cleanup still needed.
|
||||
|
||||
* configure.in: No te-386bsd.h file exists; don't try to use it.
|
||||
|
||||
Tue Nov 10 09:49:24 1992 Ian Lance Taylor (ian@cygnus.com)
|
||||
|
||||
* Makefile.in (as.o, obj-format.o): added dependency on subsegs.h.
|
||||
|
||||
* subsegs.h: add extern to segment_info declaration.
|
||||
|
||||
* read.h: added extern declarations for comment_chars,
|
||||
line_comment_chars, and line_separator_chars.
|
||||
read.c, app.c: removed definitions of comment_chars,
|
||||
line_comment_chars, and line_separator_chars.
|
||||
|
||||
Wed Oct 28 08:52:34 1992 Ken Raeburn (raeburn@cygnus.com)
|
||||
|
||||
* version.c: Put conditional "const" before version_string, not
|
||||
before dummy function for VMS. Now version 1.91.03.
|
||||
|
||||
* app.c (do_scrub_next_char): Need double-\ before `000' to show
|
||||
printed rep of null character.
|
||||
|
||||
Tue Oct 20 12:18:08 1992 Ian Lance Taylor (ian@cygnus.com)
|
||||
|
||||
* configure.in: i386-sysv and i386-sco use coffbfd.
|
||||
|
||||
* app.c (do_scrub_next_char): discard whitespace after a label.
|
||||
|
||||
Sat Oct 10 12:33:45 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
|
||||
@ -251,7 +279,6 @@ Tue Jun 30 20:25:54 1992 D. V. Henkel-Wallace (gumby@cygnus.com)
|
||||
|
||||
* Makefile.in: Add program_suffix (parallel to program_prefix)
|
||||
|
||||
>>>>>>> 1.83
|
||||
Wed Jun 24 10:57:54 1992 Steve Chamberlain (sac@thepub.cygnus.com)
|
||||
|
||||
* app.c (process_escape): new function to handle escapes the right
|
||||
|
595
gas/as.c
595
gas/as.c
@ -1,18 +1,18 @@
|
||||
/* as.c - GAS main program.
|
||||
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. */
|
||||
@ -36,7 +36,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _POSIX_SOURCE
|
||||
#include <sys/types.h> /* For pid_t in signal.h */
|
||||
#include <sys/types.h> /* For pid_t in signal.h */
|
||||
#endif
|
||||
#include <signal.h>
|
||||
|
||||
@ -54,9 +54,9 @@
|
||||
|
||||
#define SIGTY void
|
||||
|
||||
static void got_sig(int sig);
|
||||
static char *stralloc(char *str);
|
||||
static void perform_an_assembly_pass(int argc, char **argv);
|
||||
static void got_sig (int sig);
|
||||
static char *stralloc (char *str);
|
||||
static void perform_an_assembly_pass (int argc, char **argv);
|
||||
|
||||
#else /* __STDC__ */
|
||||
|
||||
@ -64,52 +64,54 @@ static void perform_an_assembly_pass(int argc, char **argv);
|
||||
#define SIGTY int
|
||||
#endif
|
||||
|
||||
static SIGTY got_sig();
|
||||
static char *stralloc(); /* Make a (safe) copy of a string. */
|
||||
static void perform_an_assembly_pass();
|
||||
static SIGTY got_sig ();
|
||||
static char *stralloc (); /* Make a (safe) copy of a string. */
|
||||
static void perform_an_assembly_pass ();
|
||||
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
#ifdef DONTDEF
|
||||
static char * gdb_symbol_file_name;
|
||||
long gdb_begin();
|
||||
static char *gdb_symbol_file_name;
|
||||
long gdb_begin ();
|
||||
#endif
|
||||
|
||||
int listing; /* true if a listing is wanted */
|
||||
int listing; /* true if a listing is wanted */
|
||||
|
||||
char *myname; /* argv[0] */
|
||||
char *myname; /* argv[0] */
|
||||
extern char version_string[];
|
||||
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int work_argc; /* variable copy of argc */
|
||||
char **work_argv; /* variable copy of argv */
|
||||
char *arg; /* an arg to program */
|
||||
char a; /* an arg flag (after -) */
|
||||
static const int sig[] = { SIGHUP, SIGINT, SIGPIPE, SIGTERM, 0};
|
||||
|
||||
for(a=0;sig[a]!=0;a++)
|
||||
if(signal(sig[a], SIG_IGN) != SIG_IGN)
|
||||
signal(sig[a], got_sig);
|
||||
|
||||
myname=argv[0];
|
||||
memset(flagseen, '\0', sizeof(flagseen)); /* aint seen nothing yet */
|
||||
int work_argc; /* variable copy of argc */
|
||||
char **work_argv; /* variable copy of argv */
|
||||
char *arg; /* an arg to program */
|
||||
char a; /* an arg flag (after -) */
|
||||
static const int sig[] =
|
||||
{SIGHUP, SIGINT, SIGPIPE, SIGTERM, 0};
|
||||
|
||||
for (a = 0; sig[a] != 0; a++)
|
||||
if (signal (sig[a], SIG_IGN) != SIG_IGN)
|
||||
signal (sig[a], got_sig);
|
||||
|
||||
myname = argv[0];
|
||||
memset (flagseen, '\0', sizeof (flagseen)); /* aint seen nothing yet */
|
||||
#ifndef OBJ_DEFAULT_OUTPUT_FILE_NAME
|
||||
#define OBJ_DEFAULT_OUTPUT_FILE_NAME "a.out"
|
||||
#endif /* OBJ_DEFAULT_OUTPUT_FILE_NAME */
|
||||
out_file_name = OBJ_DEFAULT_OUTPUT_FILE_NAME;
|
||||
|
||||
symbol_begin(); /* symbols.c */
|
||||
subsegs_begin(); /* subsegs.c */
|
||||
read_begin(); /* read.c */
|
||||
md_begin(); /* MACHINE.c */
|
||||
input_scrub_begin(); /* input_scrub.c */
|
||||
out_file_name = OBJ_DEFAULT_OUTPUT_FILE_NAME;
|
||||
|
||||
symbol_begin (); /* symbols.c */
|
||||
subsegs_begin (); /* subsegs.c */
|
||||
read_begin (); /* read.c */
|
||||
md_begin (); /* MACHINE.c */
|
||||
input_scrub_begin (); /* input_scrub.c */
|
||||
#ifdef DONTDEF
|
||||
gdb_symbol_file_name = 0;
|
||||
gdb_symbol_file_name = 0;
|
||||
#endif
|
||||
/*
|
||||
/*
|
||||
* Parse arguments, but we are only interested in flags.
|
||||
* When we find a flag, we process it then make it's argv[] NULL.
|
||||
* This helps any future argv[] scanners avoid what we processed.
|
||||
@ -119,165 +121,185 @@ char **argv;
|
||||
* name(s) and ""(s) denoting stdin. These file names are used
|
||||
* (perhaps more than once) later.
|
||||
*/
|
||||
/* FIXME-SOMEDAY this should use getopt. */
|
||||
work_argc = argc-1; /* don't count argv[0] */
|
||||
work_argv = argv+1; /* skip argv[0] */
|
||||
for (;work_argc--;work_argv++) {
|
||||
arg = * work_argv; /* work_argv points to this argument */
|
||||
|
||||
if (*arg!='-') /* Filename. We need it later. */
|
||||
continue; /* Keep scanning args looking for flags. */
|
||||
if (arg[1] == '-' && arg[2] == 0) {
|
||||
/* "--" as an argument means read STDIN */
|
||||
/* on this scan, we don't want to think about filenames */
|
||||
* work_argv = ""; /* Code that means 'use stdin'. */
|
||||
continue;
|
||||
}
|
||||
/* This better be a switch. */
|
||||
arg ++; /*->letter. */
|
||||
|
||||
while ((a = * arg) != '\0') {/* scan all the 1-char flags */
|
||||
arg ++; /* arg->after letter. */
|
||||
a &= 0x7F; /* ascii only please */
|
||||
/* if (flagseen[a])
|
||||
/* FIXME-SOMEDAY this should use getopt. */
|
||||
work_argc = argc - 1; /* don't count argv[0] */
|
||||
work_argv = argv + 1; /* skip argv[0] */
|
||||
for (; work_argc--; work_argv++)
|
||||
{
|
||||
arg = *work_argv; /* work_argv points to this argument */
|
||||
|
||||
if (*arg != '-') /* Filename. We need it later. */
|
||||
continue; /* Keep scanning args looking for flags. */
|
||||
if (arg[1] == '-' && arg[2] == 0)
|
||||
{
|
||||
/* "--" as an argument means read STDIN */
|
||||
/* on this scan, we don't want to think about filenames */
|
||||
*work_argv = ""; /* Code that means 'use stdin'. */
|
||||
continue;
|
||||
}
|
||||
/* This better be a switch. */
|
||||
arg++; /*->letter. */
|
||||
|
||||
while ((a = *arg) != '\0')
|
||||
{ /* scan all the 1-char flags */
|
||||
arg++; /* arg->after letter. */
|
||||
a &= 0x7F; /* ascii only please */
|
||||
/* if (flagseen[a])
|
||||
as_tsktsk("%s: Flag option - %c has already been seen.", myname, a); */
|
||||
flagseen[a] = 1;
|
||||
switch (a) {
|
||||
|
||||
case 'a':
|
||||
{
|
||||
int loop =1;
|
||||
|
||||
while (loop) {
|
||||
switch (*arg)
|
||||
{
|
||||
case 'l':
|
||||
listing |= LISTING_LISTING;
|
||||
arg++;
|
||||
break;
|
||||
case 's':
|
||||
listing |= LISTING_SYMBOLS;
|
||||
arg++;
|
||||
break;
|
||||
case 'h':
|
||||
listing |= LISTING_HLL;
|
||||
arg++;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
listing |= LISTING_NOFORM;
|
||||
arg++;
|
||||
break;
|
||||
case 'd':
|
||||
listing |= LISTING_NODEBUG;
|
||||
arg++;
|
||||
break;
|
||||
default:
|
||||
if (!listing)
|
||||
listing= LISTING_DEFAULT;
|
||||
loop = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'f':
|
||||
break; /* -f means fast - no need for "app" preprocessor. */
|
||||
|
||||
case 'D':
|
||||
/* DEBUG is implemented: it debugs different */
|
||||
/* things to other people's assemblers. */
|
||||
break;
|
||||
|
||||
flagseen[a] = 1;
|
||||
switch (a)
|
||||
{
|
||||
|
||||
case 'a':
|
||||
{
|
||||
int loop = 1;
|
||||
|
||||
while (loop)
|
||||
{
|
||||
switch (*arg)
|
||||
{
|
||||
case 'l':
|
||||
listing |= LISTING_LISTING;
|
||||
arg++;
|
||||
break;
|
||||
case 's':
|
||||
listing |= LISTING_SYMBOLS;
|
||||
arg++;
|
||||
break;
|
||||
case 'h':
|
||||
listing |= LISTING_HLL;
|
||||
arg++;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
listing |= LISTING_NOFORM;
|
||||
arg++;
|
||||
break;
|
||||
case 'd':
|
||||
listing |= LISTING_NODEBUG;
|
||||
arg++;
|
||||
break;
|
||||
default:
|
||||
if (!listing)
|
||||
listing = LISTING_DEFAULT;
|
||||
loop = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'f':
|
||||
break; /* -f means fast - no need for "app" preprocessor. */
|
||||
|
||||
case 'D':
|
||||
/* DEBUG is implemented: it debugs different */
|
||||
/* things to other people's assemblers. */
|
||||
break;
|
||||
|
||||
#ifdef DONTDEF
|
||||
case 'G': /* GNU AS switch: include gdbsyms. */
|
||||
if (*arg) /* Rest of argument is file-name. */
|
||||
gdb_symbol_file_name = stralloc (arg);
|
||||
else if (work_argc) { /* Next argument is file-name. */
|
||||
work_argc --;
|
||||
* work_argv = NULL; /* Not a source file-name. */
|
||||
gdb_symbol_file_name = * ++ work_argv;
|
||||
} else
|
||||
as_warn("%s: I expected a filename after -G", myname);
|
||||
arg = ""; /* Finished with this arg. */
|
||||
break;
|
||||
#endif
|
||||
|
||||
case 'I': { /* Include file directory */
|
||||
|
||||
char *temp = NULL;
|
||||
if (*arg)
|
||||
temp = stralloc (arg);
|
||||
else if (work_argc) {
|
||||
* work_argv = NULL;
|
||||
work_argc--;
|
||||
temp = * ++ work_argv;
|
||||
} else
|
||||
as_warn("%s: I expected a filename after -I", myname);
|
||||
add_include_dir (temp);
|
||||
arg = ""; /* Finished with this arg. */
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef WORKING_DOT_WORD
|
||||
case 'K':
|
||||
break;
|
||||
#endif
|
||||
|
||||
case 'L': /* -L means keep L* symbols */
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
if (*arg) /* Rest of argument is object file-name. */
|
||||
out_file_name = stralloc (arg);
|
||||
else if (work_argc) { /* Want next arg for a file-name. */
|
||||
* work_argv = NULL; /* This is not a file-name. */
|
||||
work_argc--;
|
||||
out_file_name = * ++ work_argv;
|
||||
} else
|
||||
as_warn("%s: I expected a filename after -o. \"%s\" assumed.", myname, out_file_name);
|
||||
arg = ""; /* Finished with this arg. */
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
/* -R means put data into text segment */
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
#ifdef VMS
|
||||
{
|
||||
extern char *compiler_version_string;
|
||||
compiler_version_string = arg;
|
||||
}
|
||||
#else /* not VMS */
|
||||
fprintf(stderr,version_string);
|
||||
if(*arg && strcmp(arg,"ersion"))
|
||||
as_warn("Unknown -v option ignored");
|
||||
#endif
|
||||
while(*arg) arg++; /* Skip the rest */
|
||||
break;
|
||||
|
||||
case 'W':
|
||||
/* -W means don't warn about things */
|
||||
case 'X':
|
||||
/* -X means treat warnings as errors */
|
||||
case 'Z':
|
||||
/* -Z means attempt to generate object file even after errors. */
|
||||
break;
|
||||
|
||||
default:
|
||||
--arg;
|
||||
if(md_parse_option(&arg,&work_argc,&work_argv)==0)
|
||||
as_warn("%s: I don't understand '%c' flag.", myname, a);
|
||||
if(arg && *arg)
|
||||
arg++;
|
||||
break;
|
||||
}
|
||||
case 'G': /* GNU AS switch: include gdbsyms. */
|
||||
if (*arg) /* Rest of argument is file-name. */
|
||||
gdb_symbol_file_name = stralloc (arg);
|
||||
else if (work_argc)
|
||||
{ /* Next argument is file-name. */
|
||||
work_argc--;
|
||||
*work_argv = NULL; /* Not a source file-name. */
|
||||
gdb_symbol_file_name = *++work_argv;
|
||||
}
|
||||
/*
|
||||
else
|
||||
as_warn ("%s: I expected a filename after -G", myname);
|
||||
arg = ""; /* Finished with this arg. */
|
||||
break;
|
||||
#endif
|
||||
|
||||
case 'I':
|
||||
{ /* Include file directory */
|
||||
|
||||
char *temp = NULL;
|
||||
if (*arg)
|
||||
temp = stralloc (arg);
|
||||
else if (work_argc)
|
||||
{
|
||||
*work_argv = NULL;
|
||||
work_argc--;
|
||||
temp = *++work_argv;
|
||||
}
|
||||
else
|
||||
as_warn ("%s: I expected a filename after -I", myname);
|
||||
add_include_dir (temp);
|
||||
arg = ""; /* Finished with this arg. */
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef WARN_SIGNED_OVERFLOW_WORD
|
||||
/* Don't warn about signed overflow. */
|
||||
case 'J':
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifndef WORKING_DOT_WORD
|
||||
case 'K':
|
||||
break;
|
||||
#endif
|
||||
|
||||
case 'L': /* -L means keep L* symbols */
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
if (*arg) /* Rest of argument is object file-name. */
|
||||
out_file_name = stralloc (arg);
|
||||
else if (work_argc)
|
||||
{ /* Want next arg for a file-name. */
|
||||
*work_argv = NULL; /* This is not a file-name. */
|
||||
work_argc--;
|
||||
out_file_name = *++work_argv;
|
||||
}
|
||||
else
|
||||
as_warn ("%s: I expected a filename after -o. \"%s\" assumed.", myname, out_file_name);
|
||||
arg = ""; /* Finished with this arg. */
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
/* -R means put data into text segment */
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
#ifdef VMS
|
||||
{
|
||||
extern char *compiler_version_string;
|
||||
compiler_version_string = arg;
|
||||
}
|
||||
#else /* not VMS */
|
||||
fprintf (stderr, version_string);
|
||||
if (*arg && strcmp (arg, "ersion"))
|
||||
as_warn ("Unknown -v option ignored");
|
||||
#endif
|
||||
while (*arg)
|
||||
arg++; /* Skip the rest */
|
||||
break;
|
||||
|
||||
case 'W':
|
||||
case 'w':
|
||||
/* -W means don't warn about things */
|
||||
case 'X':
|
||||
/* -X means treat warnings as errors */
|
||||
case 'Z':
|
||||
/* -Z means attempt to generate object file even after errors. */
|
||||
break;
|
||||
|
||||
default:
|
||||
--arg;
|
||||
if (md_parse_option (&arg, &work_argc, &work_argv) == 0)
|
||||
as_warn ("%s: I don't understand '%c' flag.", myname, a);
|
||||
if (arg && *arg)
|
||||
arg++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* We have just processed a "-..." arg, which was not a
|
||||
* file-name. Smash it so the
|
||||
* things that look for filenames won't ever see it.
|
||||
@ -285,41 +307,42 @@ char **argv;
|
||||
* Whatever work_argv points to, it has already been used
|
||||
* as part of a flag, so DON'T re-use it as a filename.
|
||||
*/
|
||||
*work_argv = NULL; /* NULL means 'not a file-name' */
|
||||
}
|
||||
*work_argv = NULL; /* NULL means 'not a file-name' */
|
||||
}
|
||||
#ifdef DONTDEF
|
||||
if (gdb_begin(gdb_symbol_file_name) == 0)
|
||||
flagseen ['G'] = 0; /* Don't do any gdbsym stuff. */
|
||||
if (gdb_begin (gdb_symbol_file_name) == 0)
|
||||
flagseen['G'] = 0; /* Don't do any gdbsym stuff. */
|
||||
#endif
|
||||
/* Here with flags set up in flagseen[]. */
|
||||
perform_an_assembly_pass(argc,argv); /* Assemble it. */
|
||||
/* Here with flags set up in flagseen[]. */
|
||||
perform_an_assembly_pass (argc, argv); /* Assemble it. */
|
||||
#ifdef TC_I960
|
||||
brtab_emit();
|
||||
brtab_emit ();
|
||||
#endif
|
||||
if (seen_at_least_1_file()
|
||||
&& !((had_warnings() && flagseen['Z'])
|
||||
|| had_errors() > 0)) {
|
||||
write_object_file(); /* relax() addresses then emit object file */
|
||||
} /* we also check in write_object_file() just before emit. */
|
||||
|
||||
input_scrub_end();
|
||||
md_end(); /* MACHINE.c */
|
||||
|
||||
#ifndef NO_LISTING
|
||||
listing_print("");
|
||||
#endif
|
||||
|
||||
#ifndef VMS
|
||||
return((had_warnings() && flagseen['Z'])
|
||||
|| had_errors() > 0); /* WIN */
|
||||
#else /* VMS */
|
||||
return(!((had_warnings() && flagseen['Z'])
|
||||
|| had_errors() > 0)); /* WIN */
|
||||
#endif /* VMS */
|
||||
|
||||
} /* main() */
|
||||
if (seen_at_least_1_file ()
|
||||
&& !((had_warnings () && flagseen['Z'])
|
||||
|| had_errors () > 0))
|
||||
{
|
||||
write_object_file (); /* relax() addresses then emit object file */
|
||||
} /* we also check in write_object_file() just before emit. */
|
||||
|
||||
input_scrub_end ();
|
||||
md_end (); /* MACHINE.c */
|
||||
|
||||
#ifndef NO_LISTING
|
||||
listing_print ("");
|
||||
#endif
|
||||
|
||||
#ifndef VMS
|
||||
return ((had_warnings () && flagseen['Z'])
|
||||
|| had_errors () > 0);/* WIN */
|
||||
#else /* VMS */
|
||||
return (!((had_warnings () && flagseen['Z'])
|
||||
|| had_errors () > 0)); /* WIN */
|
||||
#endif /* VMS */
|
||||
|
||||
} /* main() */
|
||||
|
||||
|
||||
/* perform_an_assembly_pass()
|
||||
*
|
||||
* Here to attempt 1 pass over each input file.
|
||||
@ -331,51 +354,54 @@ char **argv;
|
||||
* Note the un*x semantics: there is only 1 logical input file, but it
|
||||
* may be a catenation of many 'physical' input files.
|
||||
*/
|
||||
static void perform_an_assembly_pass(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
static void
|
||||
perform_an_assembly_pass (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int saw_a_file = 0;
|
||||
unsigned int i;
|
||||
need_pass_2 = 0;
|
||||
|
||||
int saw_a_file = 0;
|
||||
unsigned int i;
|
||||
need_pass_2 = 0;
|
||||
|
||||
#ifdef MANY_SEGMENTS
|
||||
|
||||
|
||||
for (i= SEG_E0; i < SEG_UNKNOWN; i++)
|
||||
{
|
||||
segment_info[i].fix_root = 0;
|
||||
}
|
||||
/* Create the three fixed ones */
|
||||
subseg_new (SEG_E0, 0);
|
||||
subseg_new (SEG_E1, 0);
|
||||
subseg_new (SEG_E2, 0);
|
||||
strcpy(segment_info[SEG_E0].scnhdr.s_name,".text");
|
||||
strcpy(segment_info[SEG_E1].scnhdr.s_name,".data");
|
||||
strcpy(segment_info[SEG_E2].scnhdr.s_name,".bss");
|
||||
|
||||
subseg_new (SEG_E0, 0);
|
||||
|
||||
for (i = SEG_E0; i < SEG_UNKNOWN; i++)
|
||||
{
|
||||
segment_info[i].fix_root = 0;
|
||||
}
|
||||
/* Create the three fixed ones */
|
||||
subseg_new (SEG_E0, 0);
|
||||
subseg_new (SEG_E1, 0);
|
||||
subseg_new (SEG_E2, 0);
|
||||
strcpy (segment_info[SEG_E0].scnhdr.s_name, ".text");
|
||||
strcpy (segment_info[SEG_E1].scnhdr.s_name, ".data");
|
||||
strcpy (segment_info[SEG_E2].scnhdr.s_name, ".bss");
|
||||
|
||||
subseg_new (SEG_E0, 0);
|
||||
#else /* not MANY_SEGMENTS */
|
||||
text_fix_root = NULL;
|
||||
data_fix_root = NULL;
|
||||
bss_fix_root = NULL;
|
||||
|
||||
subseg_new (SEG_TEXT, 0);
|
||||
text_fix_root = NULL;
|
||||
data_fix_root = NULL;
|
||||
bss_fix_root = NULL;
|
||||
|
||||
subseg_new (SEG_TEXT, 0);
|
||||
#endif /* not MANY_SEGMENTS */
|
||||
|
||||
argv++; /* skip argv[0] */
|
||||
argc--; /* skip argv[0] */
|
||||
while (argc--) {
|
||||
if (*argv) { /* Is it a file-name argument? */
|
||||
saw_a_file++;
|
||||
/* argv->"" if stdin desired, else->filename */
|
||||
read_a_source_file(*argv);
|
||||
}
|
||||
argv++; /* completed that argv */
|
||||
argv++; /* skip argv[0] */
|
||||
argc--; /* skip argv[0] */
|
||||
while (argc--)
|
||||
{
|
||||
if (*argv)
|
||||
{ /* Is it a file-name argument? */
|
||||
saw_a_file++;
|
||||
/* argv->"" if stdin desired, else->filename */
|
||||
read_a_source_file (*argv);
|
||||
}
|
||||
if(!saw_a_file)
|
||||
read_a_source_file("");
|
||||
} /* perform_an_assembly_pass() */
|
||||
argv++; /* completed that argv */
|
||||
}
|
||||
if (!saw_a_file)
|
||||
read_a_source_file ("");
|
||||
} /* perform_an_assembly_pass() */
|
||||
|
||||
/*
|
||||
* stralloc()
|
||||
@ -385,35 +411,38 @@ char **argv;
|
||||
*/
|
||||
|
||||
static char *
|
||||
stralloc (str)
|
||||
char * str;
|
||||
stralloc (str)
|
||||
char *str;
|
||||
{
|
||||
register char * retval;
|
||||
register long len;
|
||||
|
||||
len = strlen (str) + 1;
|
||||
retval = xmalloc (len);
|
||||
(void) strcpy(retval, str);
|
||||
return(retval);
|
||||
register char *retval;
|
||||
register long len;
|
||||
|
||||
len = strlen (str) + 1;
|
||||
retval = xmalloc (len);
|
||||
(void) strcpy (retval, str);
|
||||
return (retval);
|
||||
}
|
||||
|
||||
#ifdef comment
|
||||
static void lose() {
|
||||
as_fatal("%s: 2nd pass not implemented - get your code from random(3)", myname);
|
||||
return;
|
||||
} /* lose() */
|
||||
static void
|
||||
lose ()
|
||||
{
|
||||
as_fatal ("%s: 2nd pass not implemented - get your code from random(3)", myname);
|
||||
return;
|
||||
} /* lose() */
|
||||
|
||||
#endif /* comment */
|
||||
|
||||
static SIGTY
|
||||
got_sig(sig)
|
||||
int sig;
|
||||
got_sig (sig)
|
||||
int sig;
|
||||
{
|
||||
static here_before = 0;
|
||||
|
||||
as_bad("Interrupted by signal %d", sig);
|
||||
if(here_before++)
|
||||
exit(1);
|
||||
return((SIGTY) 0);
|
||||
static here_before = 0;
|
||||
|
||||
as_bad ("Interrupted by signal %d", sig);
|
||||
if (here_before++)
|
||||
exit (1);
|
||||
return ((SIGTY) 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
310
gas/as.h
310
gas/as.h
@ -1,18 +1,18 @@
|
||||
/* as.h - global header file
|
||||
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. */
|
||||
@ -22,10 +22,10 @@
|
||||
#include "host.h"
|
||||
#include "flonum.h"
|
||||
|
||||
#if __STDC__ != 1
|
||||
#define volatile /**/
|
||||
#ifndef __STDC__
|
||||
#define volatile /**/
|
||||
#ifndef const
|
||||
#define const /**/
|
||||
#define const /**/
|
||||
#endif /* const */
|
||||
#endif /* __STDC__ */
|
||||
|
||||
@ -76,8 +76,8 @@
|
||||
as_fatal("Case value %d unexpected at line %d of file \"%s\"\n", \
|
||||
value, __LINE__, __FILE__); \
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* These are assembler-wide concepts */
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@
|
||||
#endif
|
||||
#endif
|
||||
/* COMMON now defined */
|
||||
#define DEBUG /* temporary */
|
||||
#define DEBUG /* temporary */
|
||||
|
||||
#ifdef BROKEN_ASSERT
|
||||
/* turn off all assertion checks */
|
||||
@ -112,8 +112,8 @@
|
||||
* Supplies sanitised buffers to read.c.
|
||||
* Also understands printing line-number part of error messages.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* subsegs.c Sub-segments. Also, segment(=expression type)s.*/
|
||||
|
||||
/*
|
||||
@ -160,32 +160,33 @@
|
||||
#define SEG_LIST SEG_TEXT,SEG_DATA,SEG_BSS
|
||||
#endif
|
||||
|
||||
typedef enum _segT {
|
||||
SEG_ABSOLUTE = 0,
|
||||
SEG_LIST,
|
||||
SEG_UNKNOWN,
|
||||
SEG_ABSENT, /* Mythical Segment (absent): NO expression seen. */
|
||||
SEG_PASS1, /* Mythical Segment: Need another pass. */
|
||||
SEG_GOOF, /* Only happens if AS has a logic error. */
|
||||
/* Invented so we don't crash printing */
|
||||
/* error message involving weird segment. */
|
||||
SEG_BIG, /* Bigger than 32 bits constant. */
|
||||
SEG_DIFFERENCE, /* Mythical Segment: absolute difference. */
|
||||
SEG_DEBUG, /* Debug segment */
|
||||
SEG_NTV, /* Transfert vector preload segment */
|
||||
SEG_PTV, /* Transfert vector postload segment */
|
||||
SEG_REGISTER, /* Mythical: a register-valued expression */
|
||||
} segT;
|
||||
typedef enum _segT
|
||||
{
|
||||
SEG_ABSOLUTE = 0,
|
||||
SEG_LIST,
|
||||
SEG_UNKNOWN,
|
||||
SEG_ABSENT, /* Mythical Segment (absent): NO expression seen. */
|
||||
SEG_PASS1, /* Mythical Segment: Need another pass. */
|
||||
SEG_GOOF, /* Only happens if AS has a logic error. */
|
||||
/* Invented so we don't crash printing */
|
||||
/* error message involving weird segment. */
|
||||
SEG_BIG, /* Bigger than 32 bits constant. */
|
||||
SEG_DIFFERENCE, /* Mythical Segment: absolute difference. */
|
||||
SEG_DEBUG, /* Debug segment */
|
||||
SEG_NTV, /* Transfert vector preload segment */
|
||||
SEG_PTV, /* Transfert vector postload segment */
|
||||
SEG_REGISTER, /* Mythical: a register-valued expression */
|
||||
} segT;
|
||||
|
||||
#define SEG_MAXIMUM_ORDINAL (SEG_REGISTER)
|
||||
|
||||
typedef int subsegT;
|
||||
|
||||
COMMON subsegT now_subseg;
|
||||
COMMON subsegT now_subseg;
|
||||
/* What subseg we are accreting now? */
|
||||
|
||||
|
||||
COMMON segT now_seg;
|
||||
COMMON segT now_seg;
|
||||
/* Segment our instructions emit to. */
|
||||
/* Only OK values are SEG_TEXT or SEG_DATA. */
|
||||
|
||||
@ -196,33 +197,34 @@ extern int section_alignment[];
|
||||
|
||||
/* relax() */
|
||||
|
||||
typedef enum _relax_state {
|
||||
rs_fill = 1, /* Variable chars to be repeated fr_offset times.
|
||||
typedef enum _relax_state
|
||||
{
|
||||
rs_fill = 1, /* Variable chars to be repeated fr_offset times.
|
||||
Fr_symbol unused. Used with fr_offset == 0 for a
|
||||
constant length frag. */
|
||||
|
||||
rs_align, /* Align: Fr_offset: power of 2. 1 variable char: fill
|
||||
|
||||
rs_align, /* Align: Fr_offset: power of 2. 1 variable char: fill
|
||||
character. */
|
||||
|
||||
rs_org, /* Org: Fr_offset, fr_symbol: address. 1 variable char: fill
|
||||
|
||||
rs_org, /* Org: Fr_offset, fr_symbol: address. 1 variable char: fill
|
||||
character. */
|
||||
|
||||
rs_machine_dependent,
|
||||
|
||||
|
||||
rs_machine_dependent,
|
||||
|
||||
#ifndef WORKING_DOT_WORD
|
||||
rs_broken_word, /* JF: gunpoint */
|
||||
rs_broken_word, /* JF: gunpoint */
|
||||
#endif
|
||||
} relax_stateT;
|
||||
} relax_stateT;
|
||||
|
||||
/* typedef unsigned char relax_substateT; */
|
||||
/* JF this is more likely to leave the end of a struct frag on an align
|
||||
boundry. Be very careful with this. */
|
||||
typedef unsigned long relax_substateT;
|
||||
|
||||
typedef unsigned long relax_addressT;/* Enough bits for address. */
|
||||
typedef unsigned long relax_addressT; /* Enough bits for address. */
|
||||
/* Still an integer type. */
|
||||
|
||||
|
||||
|
||||
/* frags.c */
|
||||
|
||||
/*
|
||||
@ -236,159 +238,163 @@ typedef unsigned long relax_addressT;/* Enough bits for address. */
|
||||
* of the 1st char of a frag is generally not known until after relax().
|
||||
* Many things at assembly time describe an address by {object-file-address
|
||||
* of a particular frag}+offset.
|
||||
|
||||
|
||||
BUG: it may be smarter to have a single pointer off to various different
|
||||
notes for different frag kinds. See how code pans
|
||||
notes for different frag kinds. See how code pans
|
||||
*/
|
||||
struct frag /* a code fragment */
|
||||
{
|
||||
unsigned long fr_address; /* Object file address. */
|
||||
struct frag *fr_next; /* Chain forward; ascending address order. */
|
||||
/* Rooted in frch_root. */
|
||||
|
||||
long fr_fix; /* (Fixed) number of chars we know we have. */
|
||||
/* May be 0. */
|
||||
long fr_var; /* (Variable) number of chars after above. */
|
||||
/* May be 0. */
|
||||
struct symbol *fr_symbol; /* For variable-length tail. */
|
||||
long fr_offset; /* For variable-length tail. */
|
||||
char *fr_opcode; /*->opcode low addr byte,for relax()ation*/
|
||||
relax_stateT fr_type; /* What state is my tail in? */
|
||||
relax_substateT fr_subtype;
|
||||
/* These are needed only on the NS32K machines */
|
||||
char fr_pcrel_adjust;
|
||||
char fr_bsr;
|
||||
unsigned long fr_address; /* Object file address. */
|
||||
struct frag *fr_next; /* Chain forward; ascending address order. */
|
||||
/* Rooted in frch_root. */
|
||||
|
||||
long fr_fix; /* (Fixed) number of chars we know we have. */
|
||||
/* May be 0. */
|
||||
long fr_var; /* (Variable) number of chars after above. */
|
||||
/* May be 0. */
|
||||
struct symbol *fr_symbol; /* For variable-length tail. */
|
||||
long fr_offset; /* For variable-length tail. */
|
||||
char *fr_opcode; /*->opcode low addr byte,for relax()ation*/
|
||||
relax_stateT fr_type; /* What state is my tail in? */
|
||||
relax_substateT fr_subtype;
|
||||
/* These are needed only on the NS32K machines */
|
||||
char fr_pcrel_adjust;
|
||||
char fr_bsr;
|
||||
#ifndef NO_LISTING
|
||||
struct list_info_struct *line;
|
||||
struct list_info_struct *line;
|
||||
#endif
|
||||
char fr_literal [1]; /* Chars begin here. */
|
||||
/* One day we will compile fr_literal[0]. */
|
||||
char fr_literal[1]; /* Chars begin here. */
|
||||
/* One day we will compile fr_literal[0]. */
|
||||
};
|
||||
|
||||
#define SIZEOF_STRUCT_FRAG \
|
||||
((int)zero_address_frag.fr_literal-(int)&zero_address_frag)
|
||||
/* We want to say fr_literal[0] above. */
|
||||
|
||||
typedef struct frag fragS;
|
||||
|
||||
COMMON fragS *frag_now; /* -> current frag we are building. */
|
||||
COMMON fragS *frag_now; /* -> current frag we are building. */
|
||||
/* This frag is incomplete. */
|
||||
/* It is, however, included in frchain_now. */
|
||||
/* Frag_now->fr_fix is bogus. Use: */
|
||||
/* Virtual frag_now->fr_fix==obstack_next_free(&frags)-frag_now->fr_literal.*/
|
||||
|
||||
COMMON fragS zero_address_frag; /* For foreign-segment symbol fixups. */
|
||||
COMMON fragS bss_address_frag; /* For local common (N_BSS segment) fixups. */
|
||||
COMMON fragS bss_address_frag; /* For local common (N_BSS segment) fixups. */
|
||||
|
||||
/* main program "as.c" (command arguments etc) */
|
||||
|
||||
COMMON char flagseen[128]; /* ['x'] TRUE if "-x" seen. */
|
||||
|
||||
COMMON char * out_file_name; /* name of emitted object file */
|
||||
COMMON char *out_file_name; /* name of emitted object file */
|
||||
|
||||
COMMON int need_pass_2; /* TRUE if we need a second pass. */
|
||||
|
||||
COMMON int linkrelax; /* TRUE if we should do no relaxing, and
|
||||
leave lots of padding. */
|
||||
|
||||
typedef struct {
|
||||
char * poc_name; /* assembler mnemonic, lower case, no '.' */
|
||||
void (*poc_handler)(); /* Do the work */
|
||||
int poc_val; /* Value to pass to handler */
|
||||
} pseudo_typeS;
|
||||
typedef struct
|
||||
{
|
||||
char *poc_name; /* assembler mnemonic, lower case, no '.' */
|
||||
void (*poc_handler) (); /* Do the work */
|
||||
int poc_val; /* Value to pass to handler */
|
||||
}
|
||||
|
||||
#if (__STDC__ == 1) & !defined(NO_STDARG)
|
||||
pseudo_typeS;
|
||||
|
||||
int had_errors(void);
|
||||
int had_warnings(void);
|
||||
void as_bad(const char *Format, ...);
|
||||
void as_fatal(const char *Format, ...);
|
||||
void as_tsktsk(const char *Format, ...);
|
||||
void as_warn(const char *Format, ...);
|
||||
#ifdef __STDC__
|
||||
|
||||
int had_errors (void);
|
||||
int had_warnings (void);
|
||||
void as_bad (const char *Format,...);
|
||||
void as_fatal (const char *Format,...);
|
||||
void as_tsktsk (const char *Format,...);
|
||||
void as_warn (const char *Format,...);
|
||||
|
||||
#else
|
||||
|
||||
int had_errors();
|
||||
int had_warnings();
|
||||
void as_bad();
|
||||
void as_fatal();
|
||||
void as_tsktsk();
|
||||
void as_warn();
|
||||
int had_errors ();
|
||||
int had_warnings ();
|
||||
void as_bad ();
|
||||
void as_fatal ();
|
||||
void as_tsktsk ();
|
||||
void as_warn ();
|
||||
|
||||
#endif /* __STDC__ & !NO_STDARG */
|
||||
|
||||
#if __STDC__ == 1
|
||||
#ifdef __STDC__
|
||||
|
||||
char *app_push(void);
|
||||
char *atof_ieee(char *str, int what_kind, LITTLENUM_TYPE *words);
|
||||
char *input_scrub_include_file(char *filename, char *position);
|
||||
char *input_scrub_new_file(char *filename);
|
||||
char *input_scrub_next_buffer(char **bufp);
|
||||
char *strstr(const char *s, const char *wanted);
|
||||
char *xmalloc(int size);
|
||||
char *xrealloc(char *ptr, long n);
|
||||
int do_scrub_next_char(int (*get)(), void (*unget)());
|
||||
int gen_to_words(LITTLENUM_TYPE *words, int precision, long exponent_bits);
|
||||
int had_err(void);
|
||||
int had_errors(void);
|
||||
int had_warnings(void);
|
||||
int ignore_input(void);
|
||||
int scrub_from_file(void);
|
||||
int scrub_from_file(void);
|
||||
int scrub_from_string(void);
|
||||
int seen_at_least_1_file(void);
|
||||
void app_pop(char *arg);
|
||||
void as_howmuch(FILE *stream);
|
||||
void as_perror(char *gripe, char *filename);
|
||||
void as_where(void);
|
||||
void bump_line_counters(void);
|
||||
void do_scrub_begin(void);
|
||||
void input_scrub_begin(void);
|
||||
void input_scrub_close(void);
|
||||
void input_scrub_end(void);
|
||||
void int_to_gen(long x);
|
||||
void new_logical_line(char *fname, int line_number);
|
||||
void scrub_to_file(int ch);
|
||||
void scrub_to_string(int ch);
|
||||
void subseg_change(segT seg, int subseg);
|
||||
void subseg_new(segT seg, subsegT subseg);
|
||||
void subsegs_begin(void);
|
||||
char *app_push (void);
|
||||
char *atof_ieee (char *str, int what_kind, LITTLENUM_TYPE * words);
|
||||
char *input_scrub_include_file (char *filename, char *position);
|
||||
char *input_scrub_new_file (char *filename);
|
||||
char *input_scrub_next_buffer (char **bufp);
|
||||
char *strstr (const char *s, const char *wanted);
|
||||
char *xmalloc (int size);
|
||||
char *xrealloc (char *ptr, long n);
|
||||
int do_scrub_next_char (int (*get) (), void (*unget) ());
|
||||
int gen_to_words (LITTLENUM_TYPE * words, int precision, long exponent_bits);
|
||||
int had_err (void);
|
||||
int had_errors (void);
|
||||
int had_warnings (void);
|
||||
int ignore_input (void);
|
||||
int scrub_from_file (void);
|
||||
int scrub_from_file (void);
|
||||
int scrub_from_string (void);
|
||||
int seen_at_least_1_file (void);
|
||||
void app_pop (char *arg);
|
||||
void as_howmuch (FILE * stream);
|
||||
void as_perror (char *gripe, char *filename);
|
||||
void as_where (void);
|
||||
void bump_line_counters (void);
|
||||
void do_scrub_begin (void);
|
||||
void input_scrub_begin (void);
|
||||
void input_scrub_close (void);
|
||||
void input_scrub_end (void);
|
||||
void int_to_gen (long x);
|
||||
void new_logical_line (char *fname, int line_number);
|
||||
void scrub_to_file (int ch);
|
||||
void scrub_to_string (int ch);
|
||||
void subseg_change (segT seg, int subseg);
|
||||
void subseg_new (segT seg, subsegT subseg);
|
||||
void subsegs_begin (void);
|
||||
|
||||
#else /* not __STDC__ */
|
||||
|
||||
char *app_push();
|
||||
char *atof_ieee();
|
||||
char *input_scrub_include_file();
|
||||
char *input_scrub_new_file();
|
||||
char *input_scrub_next_buffer();
|
||||
char *strstr();
|
||||
char *xmalloc();
|
||||
char *xrealloc();
|
||||
int do_scrub_next_char();
|
||||
int gen_to_words();
|
||||
int had_err();
|
||||
int had_errors();
|
||||
int had_warnings();
|
||||
int ignore_input();
|
||||
int scrub_from_file();
|
||||
int scrub_from_file();
|
||||
int scrub_from_string();
|
||||
int seen_at_least_1_file();
|
||||
void app_pop();
|
||||
void as_howmuch();
|
||||
void as_perror();
|
||||
void as_where();
|
||||
void bump_line_counters();
|
||||
void do_scrub_begin();
|
||||
void input_scrub_begin();
|
||||
void input_scrub_close();
|
||||
void input_scrub_end();
|
||||
void int_to_gen();
|
||||
void new_logical_line();
|
||||
void scrub_to_file();
|
||||
void scrub_to_string();
|
||||
void subseg_change();
|
||||
void subseg_new();
|
||||
void subsegs_begin();
|
||||
char *app_push ();
|
||||
char *atof_ieee ();
|
||||
char *input_scrub_include_file ();
|
||||
char *input_scrub_new_file ();
|
||||
char *input_scrub_next_buffer ();
|
||||
char *strstr ();
|
||||
char *xmalloc ();
|
||||
char *xrealloc ();
|
||||
int do_scrub_next_char ();
|
||||
int gen_to_words ();
|
||||
int had_err ();
|
||||
int had_errors ();
|
||||
int had_warnings ();
|
||||
int ignore_input ();
|
||||
int scrub_from_file ();
|
||||
int scrub_from_file ();
|
||||
int scrub_from_string ();
|
||||
int seen_at_least_1_file ();
|
||||
void app_pop ();
|
||||
void as_howmuch ();
|
||||
void as_perror ();
|
||||
void as_where ();
|
||||
void bump_line_counters ();
|
||||
void do_scrub_begin ();
|
||||
void input_scrub_begin ();
|
||||
void input_scrub_close ();
|
||||
void input_scrub_end ();
|
||||
void int_to_gen ();
|
||||
void new_logical_line ();
|
||||
void scrub_to_file ();
|
||||
void scrub_to_string ();
|
||||
void subseg_change ();
|
||||
void subseg_new ();
|
||||
void subsegs_begin ();
|
||||
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
/* bignum_copy.c - copy a bignum
|
||||
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. */
|
||||
@ -32,41 +32,48 @@
|
||||
|
||||
/* void */
|
||||
int
|
||||
bignum_copy(in, in_length, out, out_length)
|
||||
register LITTLENUM_TYPE *in;
|
||||
register int in_length; /* in sizeof(littlenum)s */
|
||||
register LITTLENUM_TYPE *out;
|
||||
register int out_length; /* in sizeof(littlenum)s */
|
||||
bignum_copy (in, in_length, out, out_length)
|
||||
register LITTLENUM_TYPE *in;
|
||||
register int in_length; /* in sizeof(littlenum)s */
|
||||
register LITTLENUM_TYPE *out;
|
||||
register int out_length; /* in sizeof(littlenum)s */
|
||||
{
|
||||
int significant_littlenums_dropped;
|
||||
|
||||
if (out_length < in_length) {
|
||||
LITTLENUM_TYPE *p; /* -> most significant (non-zero) input
|
||||
littlenum. */
|
||||
|
||||
memcpy((void *) out, (void *) in,
|
||||
out_length << LITTLENUM_SHIFT);
|
||||
for (p = in + in_length - 1; p >= in; --p) {
|
||||
if (* p) break;
|
||||
}
|
||||
significant_littlenums_dropped = p - in - in_length + 1;
|
||||
|
||||
if (significant_littlenums_dropped < 0) {
|
||||
significant_littlenums_dropped = 0;
|
||||
}
|
||||
} else {
|
||||
memcpy((char *) out, (char *) in,
|
||||
in_length << LITTLENUM_SHIFT);
|
||||
int significant_littlenums_dropped;
|
||||
|
||||
if (out_length > in_length) {
|
||||
memset((char *) (out + out_length),
|
||||
'\0', (out_length - in_length) << LITTLENUM_SHIFT);
|
||||
}
|
||||
if (out_length < in_length)
|
||||
{
|
||||
LITTLENUM_TYPE *p; /* -> most significant (non-zero) input
|
||||
littlenum. */
|
||||
|
||||
significant_littlenums_dropped = 0;
|
||||
memcpy ((void *) out, (void *) in,
|
||||
out_length << LITTLENUM_SHIFT);
|
||||
for (p = in + in_length - 1; p >= in; --p)
|
||||
{
|
||||
if (*p)
|
||||
break;
|
||||
}
|
||||
|
||||
return(significant_littlenums_dropped);
|
||||
} /* bignum_copy() */
|
||||
significant_littlenums_dropped = p - in - in_length + 1;
|
||||
|
||||
if (significant_littlenums_dropped < 0)
|
||||
{
|
||||
significant_littlenums_dropped = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy ((char *) out, (char *) in,
|
||||
in_length << LITTLENUM_SHIFT);
|
||||
|
||||
if (out_length > in_length)
|
||||
{
|
||||
memset ((char *) (out + out_length),
|
||||
'\0', (out_length - in_length) << LITTLENUM_SHIFT);
|
||||
}
|
||||
|
||||
significant_littlenums_dropped = 0;
|
||||
}
|
||||
|
||||
return (significant_littlenums_dropped);
|
||||
} /* bignum_copy() */
|
||||
|
||||
/* end of bignum-copy.c */
|
||||
|
21
gas/bignum.h
21
gas/bignum.h
@ -1,18 +1,18 @@
|
||||
/* bignum.h-arbitrary precision integers
|
||||
Copyright (C) 1987, 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. */
|
||||
@ -44,4 +44,17 @@ typedef unsigned short LITTLENUM_TYPE;
|
||||
#define LOG_TO_BASE_2_OF_10 (3.3219280948873623478703194294893901758651)
|
||||
/* WARNING: I haven't checked that the trailing digits are correct! */
|
||||
|
||||
/* lengths are in sizeof(littlenum)s */
|
||||
#if __STDC__ == 1
|
||||
|
||||
int bignum_copy (LITTLENUM_TYPE * in, int in_length,
|
||||
LITTLENUM_TYPE * out, int out_length);
|
||||
|
||||
#else
|
||||
|
||||
int bignum_copy ();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
|
||||
/* end of bignum.h */
|
||||
|
@ -104,13 +104,15 @@ case ${target} in
|
||||
;;
|
||||
i[34]86-*-bsd*)
|
||||
obj_format=aout
|
||||
emulation=i386bsd
|
||||
;;
|
||||
i[34]86-*-coff | i[34]86-*-sysv* | i[34]86-*-sco*)
|
||||
obj_format=coffbfd
|
||||
need_bfd="./../bfd/libbfd.a"
|
||||
gas_target=i386coff
|
||||
;;
|
||||
i[34]86-*-go32)
|
||||
obj_format=aout
|
||||
;;
|
||||
i960-wrs-vxworks)
|
||||
obj_format=bout
|
||||
;;
|
||||
|
41
gas/expr.h
41
gas/expr.h
@ -1,18 +1,18 @@
|
||||
/* expr.h -> header file for expr.c
|
||||
Copyright (C) 1987 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 1987, 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. */
|
||||
@ -44,11 +44,12 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
symbolS *X_add_symbol; /* foo */
|
||||
symbolS *X_subtract_symbol; /* bar */
|
||||
long X_add_number; /* 42. Must be signed. */
|
||||
segT X_seg; /* What segment (expr type)? */
|
||||
symbolS *X_add_symbol; /* foo */
|
||||
symbolS *X_subtract_symbol; /* bar */
|
||||
long X_add_number; /* 42. Must be signed. */
|
||||
segT X_seg; /* What segment (expr type)? */
|
||||
}
|
||||
|
||||
expressionS;
|
||||
|
||||
/* result should be type (expressionS *). */
|
||||
@ -57,25 +58,25 @@ expressionS;
|
||||
/* If an expression is SEG_BIG, look here */
|
||||
/* for its value. These common data may */
|
||||
/* be clobbered whenever expr() is called. */
|
||||
extern FLONUM_TYPE generic_floating_point_number; /* Flonums returned here. */
|
||||
extern FLONUM_TYPE generic_floating_point_number; /* Flonums returned here. */
|
||||
/* Enough to hold most precise flonum. */
|
||||
extern LITTLENUM_TYPE generic_bignum []; /* Bignums returned here. */
|
||||
extern LITTLENUM_TYPE generic_bignum[]; /* Bignums returned here. */
|
||||
#define SIZE_OF_LARGE_NUMBER (20) /* Number of littlenums in above. */
|
||||
|
||||
typedef char operator_rankT;
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
|
||||
char get_symbol_end(void);
|
||||
segT expr(int rank, expressionS *resultP);
|
||||
unsigned int get_single_number(void);
|
||||
char get_symbol_end (void);
|
||||
segT expr (int rank, expressionS * resultP);
|
||||
unsigned int get_single_number (void);
|
||||
|
||||
#else /* __STDC__ */
|
||||
#else /* not __STDC__ */
|
||||
|
||||
char get_symbol_end();
|
||||
segT expr();
|
||||
unsigned int get_single_number();
|
||||
char get_symbol_end ();
|
||||
segT expr ();
|
||||
unsigned int get_single_number ();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
/* end of expr.h */
|
||||
|
183
gas/flonum-konst.c
Normal file
183
gas/flonum-konst.c
Normal file
@ -0,0 +1,183 @@
|
||||
/* flonum_const.c - Useful Flonum constants
|
||||
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. */
|
||||
|
||||
#include "flonum.h"
|
||||
/* JF: I added the last entry to this table, and I'm not
|
||||
sure if its right or not. Could go either way. I wish
|
||||
I really understood this stuff. */
|
||||
|
||||
|
||||
const int table_size_of_flonum_powers_of_ten = 11;
|
||||
|
||||
static const LITTLENUM_TYPE zero[] =
|
||||
{1};
|
||||
|
||||
/***********************************************************************\
|
||||
* *
|
||||
* Warning: the low order bits may be WRONG here. *
|
||||
* I took this from a suspect bc(1) script. *
|
||||
* "minus_X"[] is supposed to be 10^(2^-X) expressed in base 2^16. *
|
||||
* The radix point is just AFTER the highest element of the [] *
|
||||
* *
|
||||
* Because bc rounds DOWN for printing (I think), the lowest *
|
||||
* significance littlenums should probably have 1 added to them. *
|
||||
* *
|
||||
\***********************************************************************/
|
||||
|
||||
/* JF: If this equals 6553/(2^16)+39321/(2^32)+... it approaches .1 */
|
||||
static const LITTLENUM_TYPE minus_1[] =
|
||||
{
|
||||
39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321,
|
||||
39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321, 6553};
|
||||
static const LITTLENUM_TYPE plus_1[] =
|
||||
{10};
|
||||
|
||||
/* JF: If this equals 655/(2^16) + 23592/(2^32) + ... it approaches .01 */
|
||||
static const LITTLENUM_TYPE minus_2[] =
|
||||
{
|
||||
10485, 36700, 62914, 23592, 49807, 10485, 36700, 62914, 23592, 49807,
|
||||
10485, 36700, 62914, 23592, 49807, 10485, 36700, 62914, 23592, 655};
|
||||
static const LITTLENUM_TYPE plus_2[] =
|
||||
{100};
|
||||
|
||||
/* This approaches .0001 */
|
||||
static const LITTLENUM_TYPE minus_3[] =
|
||||
{
|
||||
52533, 20027, 37329, 65116, 64067, 60397, 14784, 18979, 33659, 19503,
|
||||
2726, 9542, 629, 2202, 40475, 10590, 4299, 47815, 36280, 6};
|
||||
static const LITTLENUM_TYPE plus_3[] =
|
||||
{10000};
|
||||
|
||||
/* JF: this approaches 1e-8 */
|
||||
static const LITTLENUM_TYPE minus_4[] =
|
||||
{
|
||||
22516, 49501, 54293, 19424, 60699, 6716, 24348, 22618, 23904, 21327,
|
||||
3919, 44703, 19149, 28803, 48959, 6259, 50273, 62237, 42};
|
||||
/* This equals 1525 * 2^16 + 57600 */
|
||||
static const LITTLENUM_TYPE plus_4[] =
|
||||
{57600, 1525};
|
||||
|
||||
/* This approaches 1e-16 */
|
||||
static const LITTLENUM_TYPE minus_5[] =
|
||||
{
|
||||
22199, 45957, 17005, 26266, 10526, 16260, 55017, 35680, 40443, 19789,
|
||||
17356, 30195, 55905, 28426, 63010, 44197, 1844};
|
||||
static const LITTLENUM_TYPE plus_5[] =
|
||||
{28609, 34546, 35};
|
||||
|
||||
static const LITTLENUM_TYPE minus_6[] =
|
||||
{
|
||||
30926, 26518, 13110, 43018, 54982, 48258, 24658, 15209, 63366, 11929,
|
||||
20069, 43857, 60487, 51};
|
||||
static const LITTLENUM_TYPE plus_6[] =
|
||||
{61313, 34220, 16731, 11629, 1262};
|
||||
|
||||
static const LITTLENUM_TYPE minus_7[] =
|
||||
{
|
||||
29819, 14733, 21490, 40602, 31315, 65186, 2695};
|
||||
static const LITTLENUM_TYPE plus_7[] =
|
||||
{
|
||||
7937, 49002, 60772, 28216, 38893, 55975, 63988, 59711, 20227, 24};
|
||||
|
||||
static const LITTLENUM_TYPE minus_8[] =
|
||||
{
|
||||
45849, 19069, 18068, 36324, 37948, 48745, 10873, 64360, 15961, 20566,
|
||||
24178, 15922, 59427, 110};
|
||||
static const LITTLENUM_TYPE plus_8[] =
|
||||
{
|
||||
15873, 11925, 39177, 991, 14589, 19735, 25347, 65086, 53853, 938,
|
||||
37209, 47086, 33626, 23253, 32586, 42547, 9731, 59679, 590};
|
||||
|
||||
static const LITTLENUM_TYPE minus_9[] =
|
||||
{
|
||||
63601, 55221, 43562, 33661, 29067, 28203, 65417, 64352, 22462, 41110,
|
||||
12570, 28635, 23199, 50572, 28471, 27074, 46375, 64028, 13106, 63700,
|
||||
32698, 17493, 32420, 34382, 22750, 20681, 12300};
|
||||
static const LITTLENUM_TYPE plus_9[] =
|
||||
{
|
||||
63564, 61556, 29377, 54467, 18621, 28141, 36415, 61241, 47119, 30026,
|
||||
19740, 46002, 13541, 61413, 30480, 38664, 32205, 50593, 51112, 48904,
|
||||
48263, 43814, 286, 30826, 52813, 62575, 61390, 24540, 21495, 5};
|
||||
|
||||
static const LITTLENUM_TYPE minus_10[] =
|
||||
{
|
||||
50313, 34681, 1464, 25889, 19575, 41125, 17635, 4598, 49708, 13427,
|
||||
17287, 56115, 53783, 38255, 32415, 17778, 31596, 7557, 20951, 18477,
|
||||
40353, 1178, 44405, 11837, 11571, 50963, 15649, 11698, 40675, 2308,};
|
||||
static const LITTLENUM_TYPE plus_10[] =
|
||||
{
|
||||
18520, 53764, 54535, 61910, 61962, 59843, 46270, 58053, 12473, 63785,
|
||||
2449, 43230, 50044, 47595, 10403, 35766, 32607, 1124, 24966, 35044,
|
||||
25524, 23631, 18826, 14518, 58448, 14562, 49618, 5588, 25396, 28};
|
||||
|
||||
static const LITTLENUM_TYPE minus_11[] =
|
||||
{
|
||||
6223, 59909, 62437, 59960, 14652, 45336, 48800, 7647, 51962, 37982,
|
||||
60436, 58176, 26767, 8440, 9831, 48556, 20994, 14148, 6757, 17221,
|
||||
60624, 46129, 53210, 44085, 54016, 24259, 11232, 21229, 21313, 81,};
|
||||
static const LITTLENUM_TYPE plus_11[] =
|
||||
{
|
||||
36159, 2055, 33615, 61362, 23581, 62454, 9748, 15275, 39284, 58636,
|
||||
16269, 42793, 47240, 45774, 50861, 48400, 9413, 40281, 4030, 9572,
|
||||
7984, 33038, 59522, 19450, 40593, 24486, 54320, 6661, 55766, 805,};
|
||||
|
||||
/* Shut up complaints about differing pointer types. They only differ
|
||||
in the const attribute, but there isn't any easy way to do this
|
||||
*/
|
||||
#define X (LITTLENUM_TYPE *)
|
||||
|
||||
const FLONUM_TYPE flonum_negative_powers_of_ten[] =
|
||||
{
|
||||
{X zero, X zero, X zero, 0, '+'},
|
||||
{X minus_1, X minus_1 + 19, X minus_1 + 19, -20, '+'},
|
||||
{X minus_2, X minus_2 + 19, X minus_2 + 19, -20, '+'},
|
||||
{X minus_3, X minus_3 + 19, X minus_3 + 19, -20, '+'},
|
||||
{X minus_4, X minus_4 + 18, X minus_4 + 18, -20, '+'},
|
||||
{X minus_5, X minus_5 + 16, X minus_5 + 16, -20, '+'},
|
||||
{X minus_6, X minus_6 + 13, X minus_6 + 13, -20, '+'},
|
||||
{X minus_7, X minus_7 + 6, X minus_7 + 6, -20, '+'},
|
||||
{X minus_8, X minus_8 + 13, X minus_8 + 13, -40, '+'},
|
||||
{X minus_9, X minus_9 + 26, X minus_9 + 26, -80, '+'},
|
||||
{X minus_10, X minus_10 + 29, X minus_10 + 29, -136, '+'},
|
||||
{X minus_11, X minus_11 + 29, X minus_11 + 29, -242, '+'},
|
||||
};
|
||||
|
||||
const FLONUM_TYPE flonum_positive_powers_of_ten[] =
|
||||
{
|
||||
{X zero, X zero, X zero, 0, '+'},
|
||||
{X plus_1, X plus_1 + 0, X plus_1 + 0, 0, '+'},
|
||||
{X plus_2, X plus_2 + 0, X plus_2 + 0, 0, '+'},
|
||||
{X plus_3, X plus_3 + 0, X plus_3 + 0, 0, '+'},
|
||||
{X plus_4, X plus_4 + 1, X plus_4 + 1, 0, '+'},
|
||||
{X plus_5, X plus_5 + 2, X plus_5 + 2, 1, '+'},
|
||||
{X plus_6, X plus_6 + 4, X plus_6 + 4, 2, '+'},
|
||||
{X plus_7, X plus_7 + 9, X plus_7 + 9, 4, '+'},
|
||||
{X plus_8, X plus_8 + 18, X plus_8 + 18, 8, '+'},
|
||||
{X plus_9, X plus_9 + 29, X plus_9 + 29, 24, '+'},
|
||||
{X plus_10, X plus_10 + 29, X plus_10 + 29, 77, '+'},
|
||||
{X plus_11, X plus_11 + 29, X plus_11 + 29, 183, '+'},
|
||||
};
|
||||
|
||||
#ifdef VMS
|
||||
dummy1 ()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of flonum_const.c */
|
@ -1,15 +1,15 @@
|
||||
/* flonum_multip.c - multiply two flonums
|
||||
Copyright (C) 1987, 1990, 1991 Free Software Foundation, Inc.
|
||||
|
||||
/* flonum_mult.c - multiply two flonums
|
||||
Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Gas, the GNU Assembler.
|
||||
|
||||
|
||||
The GNU assembler is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY. No author or distributor
|
||||
accepts responsibility to anyone for the consequences of using it
|
||||
or for whether it serves any particular purpose or works at all,
|
||||
unless he says so in writing. Refer to the GNU Assembler General
|
||||
Public License for full details.
|
||||
|
||||
|
||||
Everyone is granted permission to copy, modify and redistribute
|
||||
the GNU Assembler, but only under the conditions described in the
|
||||
GNU Assembler General Public License. A copy of this license is
|
||||
@ -72,128 +72,130 @@
|
||||
(C style also gives deeper insight [to me] ... oh well ...)
|
||||
*/
|
||||
|
||||
void flonum_multip (a, b, product)
|
||||
const FLONUM_TYPE *a;
|
||||
const FLONUM_TYPE *b;
|
||||
FLONUM_TYPE *product;
|
||||
void
|
||||
flonum_multip (a, b, product)
|
||||
const FLONUM_TYPE *a;
|
||||
const FLONUM_TYPE *b;
|
||||
FLONUM_TYPE *product;
|
||||
{
|
||||
int size_of_a; /* 0 origin */
|
||||
int size_of_b; /* 0 origin */
|
||||
int size_of_product; /* 0 origin */
|
||||
int size_of_sum; /* 0 origin */
|
||||
int extra_product_positions;/* 1 origin */
|
||||
unsigned long work;
|
||||
unsigned long carry;
|
||||
long exponent;
|
||||
LITTLENUM_TYPE * q;
|
||||
long significant; /* TRUE when we emit a non-0 littlenum */
|
||||
/* ForTran accent follows. */
|
||||
int P; /* Scan product low-order -> high. */
|
||||
int N; /* As in sum above. */
|
||||
int A; /* Which [] of a? */
|
||||
int B; /* Which [] of b? */
|
||||
|
||||
if((a->sign!='-' && a->sign!='+') || (b->sign!='-' && b->sign!='+')) {
|
||||
/* ...
|
||||
int size_of_a; /* 0 origin */
|
||||
int size_of_b; /* 0 origin */
|
||||
int size_of_product; /* 0 origin */
|
||||
int size_of_sum; /* 0 origin */
|
||||
int extra_product_positions; /* 1 origin */
|
||||
unsigned long work;
|
||||
unsigned long carry;
|
||||
long exponent;
|
||||
LITTLENUM_TYPE *q;
|
||||
long significant; /* TRUE when we emit a non-0 littlenum */
|
||||
/* ForTran accent follows. */
|
||||
int P; /* Scan product low-order -> high. */
|
||||
int N; /* As in sum above. */
|
||||
int A; /* Which [] of a? */
|
||||
int B; /* Which [] of b? */
|
||||
|
||||
if ((a->sign != '-' && a->sign != '+') || (b->sign != '-' && b->sign != '+'))
|
||||
{
|
||||
/* ...
|
||||
Got to fail somehow. Any suggestions? */
|
||||
product->sign=0;
|
||||
return;
|
||||
product->sign = 0;
|
||||
return;
|
||||
}
|
||||
product->sign = (a->sign == b->sign) ? '+' : '-';
|
||||
size_of_a = a->leader - a->low;
|
||||
size_of_b = b->leader - b->low;
|
||||
exponent = a->exponent + b->exponent;
|
||||
size_of_product = product->high - product->low;
|
||||
size_of_sum = size_of_a + size_of_b;
|
||||
extra_product_positions = size_of_product - size_of_sum;
|
||||
if (extra_product_positions < 0)
|
||||
{
|
||||
P = extra_product_positions; /* P < 0 */
|
||||
exponent -= extra_product_positions; /* Increases exponent. */
|
||||
}
|
||||
else
|
||||
{
|
||||
P = 0;
|
||||
}
|
||||
carry = 0;
|
||||
significant = 0;
|
||||
for (N = 0;
|
||||
N <= size_of_sum;
|
||||
N++)
|
||||
{
|
||||
work = carry;
|
||||
carry = 0;
|
||||
for (A = 0;
|
||||
A <= N;
|
||||
A++)
|
||||
{
|
||||
B = N - A;
|
||||
if (A <= size_of_a && B <= size_of_b && B >= 0)
|
||||
{
|
||||
#ifdef TRACE
|
||||
printf ("a:low[%d.]=%04x b:low[%d.]=%04x work_before=%08x\n", A, a->low[A], B, b->low[B], work);
|
||||
#endif
|
||||
work += a->low[A] * b->low[B];
|
||||
carry += work >> LITTLENUM_NUMBER_OF_BITS;
|
||||
work &= LITTLENUM_MASK;
|
||||
#ifdef TRACE
|
||||
printf ("work=%08x carry=%04x\n", work, carry);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
product -> sign = (a->sign == b->sign) ? '+' : '-';
|
||||
size_of_a = a -> leader - a -> low;
|
||||
size_of_b = b -> leader - b -> low;
|
||||
exponent = a -> exponent + b -> exponent;
|
||||
size_of_product = product -> high - product -> low;
|
||||
size_of_sum = size_of_a + size_of_b;
|
||||
extra_product_positions = size_of_product - size_of_sum;
|
||||
if (extra_product_positions < 0)
|
||||
significant |= work;
|
||||
if (significant || P < 0)
|
||||
{
|
||||
if (P >= 0)
|
||||
{
|
||||
P = extra_product_positions; /* P < 0 */
|
||||
exponent -= extra_product_positions; /* Increases exponent. */
|
||||
}
|
||||
else
|
||||
{
|
||||
P = 0;
|
||||
}
|
||||
carry = 0;
|
||||
significant = 0;
|
||||
for (N = 0;
|
||||
N <= size_of_sum;
|
||||
N++)
|
||||
{
|
||||
work = carry;
|
||||
carry = 0;
|
||||
for (A = 0;
|
||||
A <= N;
|
||||
A ++)
|
||||
{
|
||||
B = N - A;
|
||||
if (A <= size_of_a && B <= size_of_b && B >= 0)
|
||||
{
|
||||
product->low[P] = work;
|
||||
#ifdef TRACE
|
||||
printf("a:low[%d.]=%04x b:low[%d.]=%04x work_before=%08x\n", A, a->low[A], B, b->low[B], work);
|
||||
printf ("P=%d. work[p]:=%04x\n", P, work);
|
||||
#endif
|
||||
work += a -> low [A] * b -> low [B];
|
||||
carry += work >> LITTLENUM_NUMBER_OF_BITS;
|
||||
work &= LITTLENUM_MASK;
|
||||
#ifdef TRACE
|
||||
printf("work=%08x carry=%04x\n", work, carry);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
significant |= work;
|
||||
if (significant || P<0)
|
||||
{
|
||||
if (P >= 0)
|
||||
{
|
||||
product -> low [P] = work;
|
||||
#ifdef TRACE
|
||||
printf("P=%d. work[p]:=%04x\n", P, work);
|
||||
#endif
|
||||
}
|
||||
P ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
extra_product_positions ++;
|
||||
exponent ++;
|
||||
}
|
||||
}
|
||||
/*
|
||||
P++;
|
||||
}
|
||||
else
|
||||
{
|
||||
extra_product_positions++;
|
||||
exponent++;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* [P]-> position # size_of_sum + 1.
|
||||
* This is where 'carry' should go.
|
||||
*/
|
||||
#ifdef TRACE
|
||||
printf("final carry =%04x\n", carry);
|
||||
printf ("final carry =%04x\n", carry);
|
||||
#endif
|
||||
if (carry)
|
||||
if (carry)
|
||||
{
|
||||
if (extra_product_positions > 0)
|
||||
{
|
||||
product->low[P] = carry;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No room at high order for carry littlenum. */
|
||||
/* Shift right 1 to make room for most significant littlenum. */
|
||||
exponent++;
|
||||
P--;
|
||||
for (q = product->low + P;
|
||||
q >= product->low;
|
||||
q--)
|
||||
{
|
||||
if (extra_product_positions > 0)
|
||||
{
|
||||
product -> low [P] = carry;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No room at high order for carry littlenum. */
|
||||
/* Shift right 1 to make room for most significant littlenum. */
|
||||
exponent ++;
|
||||
P --;
|
||||
for (q = product -> low + P;
|
||||
q >= product -> low;
|
||||
q --)
|
||||
{
|
||||
work = * q;
|
||||
* q = carry;
|
||||
carry = work;
|
||||
}
|
||||
}
|
||||
work = *q;
|
||||
*q = carry;
|
||||
carry = work;
|
||||
}
|
||||
else
|
||||
{
|
||||
P --;
|
||||
}
|
||||
product -> leader = product -> low + P;
|
||||
product -> exponent = exponent;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
P--;
|
||||
}
|
||||
product->leader = product->low + P;
|
||||
product->exponent = exponent;
|
||||
}
|
||||
|
||||
/* end of flonum_mult.c */
|
||||
|
51
gas/flonum.h
51
gas/flonum.h
@ -1,18 +1,19 @@
|
||||
/* flonum.h - Floating point package
|
||||
Copyright (C) 1987, 1990, 1991 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
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. */
|
||||
@ -29,8 +30,8 @@
|
||||
* please tell me your nomenclature for flonums! *
|
||||
* *
|
||||
\***********************************************************************/
|
||||
#if !defined(__STDC__) && !defined(const)
|
||||
#define const /* empty */
|
||||
#if (__STDC__ != 1) && !defined(const)
|
||||
#define const /* empty */
|
||||
#endif
|
||||
|
||||
#include "bignum.h"
|
||||
@ -52,12 +53,12 @@
|
||||
*/
|
||||
struct FLONUM_STRUCT
|
||||
{
|
||||
LITTLENUM_TYPE * low; /* low order littlenum of a bignum */
|
||||
LITTLENUM_TYPE * high; /* high order littlenum of a bignum */
|
||||
LITTLENUM_TYPE * leader; /* -> 1st non-zero littlenum */
|
||||
/* If flonum is 0.0, leader==low-1 */
|
||||
long exponent; /* base LITTLENUM_RADIX */
|
||||
char sign; /* '+' or '-' */
|
||||
LITTLENUM_TYPE *low; /* low order littlenum of a bignum */
|
||||
LITTLENUM_TYPE *high; /* high order littlenum of a bignum */
|
||||
LITTLENUM_TYPE *leader; /* -> 1st non-zero littlenum */
|
||||
/* If flonum is 0.0, leader==low-1 */
|
||||
long exponent; /* base LITTLENUM_RADIX */
|
||||
char sign; /* '+' or '-' */
|
||||
};
|
||||
|
||||
typedef struct FLONUM_STRUCT FLONUM_TYPE;
|
||||
@ -91,23 +92,23 @@ extern const int table_size_of_flonum_powers_of_ten;
|
||||
* *
|
||||
\***********************************************************************/
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
|
||||
int atof_generic(char **address_of_string_pointer,
|
||||
const char *string_of_decimal_marks,
|
||||
const char *string_of_decimal_exponent_marks,
|
||||
FLONUM_TYPE *address_of_generic_floating_point_number);
|
||||
int atof_generic (char **address_of_string_pointer,
|
||||
const char *string_of_decimal_marks,
|
||||
const char *string_of_decimal_exponent_marks,
|
||||
FLONUM_TYPE * address_of_generic_floating_point_number);
|
||||
|
||||
void flonum_copy(FLONUM_TYPE *in, FLONUM_TYPE *out);
|
||||
void flonum_multip(const FLONUM_TYPE *a, const FLONUM_TYPE *b, FLONUM_TYPE *product);
|
||||
void flonum_copy (FLONUM_TYPE * in, FLONUM_TYPE * out);
|
||||
void flonum_multip (const FLONUM_TYPE * a, const FLONUM_TYPE * b, FLONUM_TYPE * product);
|
||||
|
||||
#else /* __STDC__ */
|
||||
#else /* not __STDC__ */
|
||||
|
||||
int atof_generic();
|
||||
void flonum_copy();
|
||||
void flonum_multip();
|
||||
int atof_generic ();
|
||||
void flonum_copy ();
|
||||
void flonum_multip ();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
/***********************************************************************\
|
||||
* *
|
||||
|
71
gas/frags.h
71
gas/frags.h
@ -1,23 +1,24 @@
|
||||
/* frags.h - Header file for the frag concept.
|
||||
Copyright (C) 1987 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Copyright (C) 1987, 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. */
|
||||
|
||||
extern struct obstack frags;
|
||||
extern struct obstack frags;
|
||||
/* Frags ONLY live in this obstack. */
|
||||
/* We use obstack_next_free() macro */
|
||||
/* so please don't put any other objects */
|
||||
@ -38,41 +39,41 @@ extern struct obstack frags;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
|
||||
char *frag_more(int nchars);
|
||||
void frag_align(int alignment, int fill_character);
|
||||
void frag_new(int old_frags_var_max_size);
|
||||
void frag_wane(fragS *fragP);
|
||||
char *frag_more (int nchars);
|
||||
void frag_align (int alignment, int fill_character);
|
||||
void frag_new (int old_frags_var_max_size);
|
||||
void frag_wane (fragS * fragP);
|
||||
|
||||
char *frag_variant(relax_stateT type,
|
||||
int max_chars,
|
||||
int var,
|
||||
relax_substateT subtype,
|
||||
symbolS *symbol,
|
||||
long offset,
|
||||
char *opcode,
|
||||
int pcrel_adjust,
|
||||
int bsr);
|
||||
char *frag_variant (relax_stateT type,
|
||||
int max_chars,
|
||||
int var,
|
||||
relax_substateT subtype,
|
||||
symbolS * symbol,
|
||||
long offset,
|
||||
char *opcode,
|
||||
int pcrel_adjust,
|
||||
int bsr);
|
||||
|
||||
char *frag_var(relax_stateT type,
|
||||
int max_chars,
|
||||
int var,
|
||||
relax_substateT subtype,
|
||||
symbolS *symbol,
|
||||
long offset,
|
||||
char *opcode);
|
||||
char *frag_var (relax_stateT type,
|
||||
int max_chars,
|
||||
int var,
|
||||
relax_substateT subtype,
|
||||
symbolS * symbol,
|
||||
long offset,
|
||||
char *opcode);
|
||||
|
||||
#else /* __STDC__ */
|
||||
#else /* not __STDC__ */
|
||||
|
||||
char *frag_more();
|
||||
char *frag_var();
|
||||
char *frag_variant();
|
||||
void frag_align();
|
||||
void frag_new();
|
||||
void frag_wane();
|
||||
char *frag_more ();
|
||||
char *frag_var ();
|
||||
char *frag_variant ();
|
||||
void frag_align ();
|
||||
void frag_new ();
|
||||
void frag_wane ();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
|
@ -1,18 +1,18 @@
|
||||
/* hex_value.c - char=>radix-value -
|
||||
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,32 +26,34 @@
|
||||
/* exceeds any normal radix */
|
||||
|
||||
#if (__STDC__ != 1) && !defined(const)
|
||||
#define const /* empty */
|
||||
#define const /* empty */
|
||||
#endif
|
||||
const char
|
||||
hex_value [256] = { /* for fast ASCII -> binary */
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, __, __, __, __, __, __,
|
||||
__, 10, 11, 12, 13, 14, 15, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, 10, 11, 12, 13, 14, 15, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __
|
||||
};
|
||||
hex_value[256] =
|
||||
{ /* for fast ASCII -> binary */
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, __, __, __, __, __, __,
|
||||
__, 10, 11, 12, 13, 14, 15, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, 10, 11, 12, 13, 14, 15, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
|
||||
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __
|
||||
};
|
||||
|
||||
#ifdef VMS
|
||||
dummy2()
|
||||
dummy2 ()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* end of hex_value.c */
|
||||
|
467
gas/input-file.c
467
gas/input-file.c
@ -1,18 +1,18 @@
|
||||
/* input_file.c - Deal with Input Files -
|
||||
Copyright (C) 1987, 1990, 1991 Free Software Foundation, Inc.
|
||||
|
||||
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. */
|
||||
@ -56,269 +56,298 @@ int preprocess = 0;
|
||||
|
||||
FILE *f_in;
|
||||
/* static JF remove static so app.c can use file_name */
|
||||
char * file_name;
|
||||
char *file_name;
|
||||
|
||||
/* Struct for saving the state of this module for file includes. */
|
||||
struct saved_file {
|
||||
FILE *f_in;
|
||||
char *file_name;
|
||||
int preprocess;
|
||||
char *app_save;
|
||||
};
|
||||
struct saved_file
|
||||
{
|
||||
FILE *f_in;
|
||||
char *file_name;
|
||||
int preprocess;
|
||||
char *app_save;
|
||||
};
|
||||
|
||||
/* These hooks accomodate most operating systems. */
|
||||
|
||||
void input_file_begin() {
|
||||
f_in = (FILE *)0;
|
||||
void
|
||||
input_file_begin ()
|
||||
{
|
||||
f_in = (FILE *) 0;
|
||||
}
|
||||
|
||||
void input_file_end () { }
|
||||
void
|
||||
input_file_end ()
|
||||
{
|
||||
}
|
||||
|
||||
/* Return BUFFER_SIZE. */
|
||||
int input_file_buffer_size() {
|
||||
return (BUFFER_SIZE);
|
||||
int
|
||||
input_file_buffer_size ()
|
||||
{
|
||||
return (BUFFER_SIZE);
|
||||
}
|
||||
|
||||
int input_file_is_open() {
|
||||
return f_in!=(FILE *)0;
|
||||
int
|
||||
input_file_is_open ()
|
||||
{
|
||||
return f_in != (FILE *) 0;
|
||||
}
|
||||
|
||||
/* Push the state of our input, returning a pointer to saved info that
|
||||
can be restored with input_file_pop (). */
|
||||
char *input_file_push () {
|
||||
register struct saved_file *saved;
|
||||
|
||||
saved = (struct saved_file *)xmalloc (sizeof *saved);
|
||||
|
||||
saved->f_in = f_in;
|
||||
saved->file_name = file_name;
|
||||
saved->preprocess = preprocess;
|
||||
if (preprocess)
|
||||
saved->app_save = app_push ();
|
||||
|
||||
input_file_begin (); /* Initialize for new file */
|
||||
|
||||
return (char *)saved;
|
||||
char *
|
||||
input_file_push ()
|
||||
{
|
||||
register struct saved_file *saved;
|
||||
|
||||
saved = (struct saved_file *) xmalloc (sizeof *saved);
|
||||
|
||||
saved->f_in = f_in;
|
||||
saved->file_name = file_name;
|
||||
saved->preprocess = preprocess;
|
||||
if (preprocess)
|
||||
saved->app_save = app_push ();
|
||||
|
||||
input_file_begin (); /* Initialize for new file */
|
||||
|
||||
return (char *) saved;
|
||||
}
|
||||
|
||||
void
|
||||
input_file_pop (arg)
|
||||
char *arg;
|
||||
input_file_pop (arg)
|
||||
char *arg;
|
||||
{
|
||||
register struct saved_file *saved = (struct saved_file *)arg;
|
||||
|
||||
input_file_end (); /* Close out old file */
|
||||
|
||||
f_in = saved->f_in;
|
||||
file_name = saved->file_name;
|
||||
preprocess = saved->preprocess;
|
||||
if (preprocess)
|
||||
app_pop (saved->app_save);
|
||||
|
||||
free(arg);
|
||||
register struct saved_file *saved = (struct saved_file *) arg;
|
||||
|
||||
input_file_end (); /* Close out old file */
|
||||
|
||||
f_in = saved->f_in;
|
||||
file_name = saved->file_name;
|
||||
preprocess = saved->preprocess;
|
||||
if (preprocess)
|
||||
app_pop (saved->app_save);
|
||||
|
||||
free (arg);
|
||||
}
|
||||
|
||||
#ifdef DONTDEF /* JF save old version in case we need it */
|
||||
#ifdef DONTDEF /* JF save old version in case we need it */
|
||||
void
|
||||
input_file_open (filename, preprocess, debugging)
|
||||
char * filename; /* "" means use stdin. Must not be 0. */
|
||||
int preprocess; /* TRUE if needs app. */
|
||||
int debugging; /* TRUE if we are debugging assembler. */
|
||||
input_file_open (filename, preprocess, debugging)
|
||||
char *filename; /* "" means use stdin. Must not be 0. */
|
||||
int preprocess; /* TRUE if needs app. */
|
||||
int debugging; /* TRUE if we are debugging assembler. */
|
||||
{
|
||||
assert( filename != 0 ); /* Filename may not be NULL. */
|
||||
if (filename [0])
|
||||
{ /* We have a file name. Suck it and see. */
|
||||
file_handle = open (filename, O_RDONLY, 0);
|
||||
file_name = filename;
|
||||
}
|
||||
else
|
||||
{ /* use stdin for the input file. */
|
||||
file_handle = fileno (stdin);
|
||||
file_name = "{standard input}"; /* For error messages. */
|
||||
}
|
||||
if (file_handle < 0)
|
||||
as_perror ("Can't open %s for reading", file_name);
|
||||
if ( preprocess )
|
||||
{
|
||||
/*
|
||||
assert (filename != 0); /* Filename may not be NULL. */
|
||||
if (filename[0])
|
||||
{ /* We have a file name. Suck it and see. */
|
||||
file_handle = open (filename, O_RDONLY, 0);
|
||||
file_name = filename;
|
||||
}
|
||||
else
|
||||
{ /* use stdin for the input file. */
|
||||
file_handle = fileno (stdin);
|
||||
file_name = "{standard input}"; /* For error messages. */
|
||||
}
|
||||
if (file_handle < 0)
|
||||
as_perror ("Can't open %s for reading", file_name);
|
||||
if (preprocess)
|
||||
{
|
||||
/*
|
||||
* This code was written in haste for a frobbed BSD 4.2.
|
||||
* I have a flight to catch: will someone please do proper
|
||||
* error checks? - Dean.
|
||||
*/
|
||||
int pid;
|
||||
char temporary_file_name [12];
|
||||
int fd;
|
||||
union wait status;
|
||||
|
||||
(void)strcpy (temporary_file_name, "#appXXXXXX");
|
||||
(void)mktemp (temporary_file_name);
|
||||
pid = vfork ();
|
||||
if (pid == -1)
|
||||
{
|
||||
as_perror ("Vfork failed", file_name);
|
||||
_exit (144);
|
||||
}
|
||||
if (pid == 0)
|
||||
{
|
||||
(void)dup2 (file_handle, fileno(stdin));
|
||||
fd = open (temporary_file_name, O_WRONLY + O_TRUNC + O_CREAT, 0666);
|
||||
if (fd == -1)
|
||||
{
|
||||
(void)write(2,"Can't open temporary\n",21);
|
||||
_exit (99);
|
||||
}
|
||||
(void)dup2 (fd, fileno(stdout));
|
||||
/* JF for testing #define PREPROCESSOR "/lib/app" */
|
||||
#define PREPROCESSOR "./app"
|
||||
execl (PREPROCESSOR, PREPROCESSOR, 0);
|
||||
execl ("app","app",0);
|
||||
(void)write(2,"Exec of app failed. Get help.\n",31);
|
||||
(void)unlink(temporary_file_name);
|
||||
_exit (11);
|
||||
}
|
||||
(void)wait (& status);
|
||||
if (status.w_status & 0xFF00) /* JF was 0xF000, was wrong */
|
||||
{
|
||||
file_handle = -1;
|
||||
as_bad( "Can't preprocess file \"%s\", status = %xx", file_name, status.w_status );
|
||||
}
|
||||
else
|
||||
{
|
||||
file_handle = open (temporary_file_name, O_RDONLY, 0);
|
||||
if ( ! debugging && unlink(temporary_file_name))
|
||||
as_perror ("Can't delete temp file %s", temporary_file_name);
|
||||
}
|
||||
if (file_handle == -1)
|
||||
as_perror ("Can't retrieve temp file %s", temporary_file_name);
|
||||
int pid;
|
||||
char temporary_file_name[12];
|
||||
int fd;
|
||||
union wait status;
|
||||
|
||||
(void) strcpy (temporary_file_name, "#appXXXXXX");
|
||||
(void) mktemp (temporary_file_name);
|
||||
pid = vfork ();
|
||||
if (pid == -1)
|
||||
{
|
||||
as_perror ("Vfork failed", file_name);
|
||||
_exit (144);
|
||||
}
|
||||
if (pid == 0)
|
||||
{
|
||||
(void) dup2 (file_handle, fileno (stdin));
|
||||
fd = open (temporary_file_name, O_WRONLY + O_TRUNC + O_CREAT, 0666);
|
||||
if (fd == -1)
|
||||
{
|
||||
(void) write (2, "Can't open temporary\n", 21);
|
||||
_exit (99);
|
||||
}
|
||||
(void) dup2 (fd, fileno (stdout));
|
||||
/* JF for testing #define PREPROCESSOR "/lib/app" */
|
||||
#define PREPROCESSOR "./app"
|
||||
execl (PREPROCESSOR, PREPROCESSOR, 0);
|
||||
execl ("app", "app", 0);
|
||||
(void) write (2, "Exec of app failed. Get help.\n", 31);
|
||||
(void) unlink (temporary_file_name);
|
||||
_exit (11);
|
||||
}
|
||||
(void) wait (&status);
|
||||
if (status.w_status & 0xFF00) /* JF was 0xF000, was wrong */
|
||||
{
|
||||
file_handle = -1;
|
||||
as_bad ("Can't preprocess file \"%s\", status = %xx", file_name, status.w_status);
|
||||
}
|
||||
else
|
||||
{
|
||||
file_handle = open (temporary_file_name, O_RDONLY, 0);
|
||||
if (!debugging && unlink (temporary_file_name))
|
||||
as_perror ("Can't delete temp file %s", temporary_file_name);
|
||||
}
|
||||
if (file_handle == -1)
|
||||
as_perror ("Can't retrieve temp file %s", temporary_file_name);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void
|
||||
input_file_open (filename,pre)
|
||||
char * filename; /* "" means use stdin. Must not be 0. */
|
||||
int pre;
|
||||
input_file_open (filename, pre)
|
||||
char *filename; /* "" means use stdin. Must not be 0. */
|
||||
int pre;
|
||||
{
|
||||
int c;
|
||||
char buf[80];
|
||||
|
||||
preprocess = pre;
|
||||
|
||||
assert( filename != 0 ); /* Filename may not be NULL. */
|
||||
if (filename [0]) { /* We have a file name. Suck it and see. */
|
||||
f_in=fopen(filename,"r");
|
||||
file_name=filename;
|
||||
} else { /* use stdin for the input file. */
|
||||
f_in = stdin;
|
||||
file_name = "{standard input}"; /* For error messages. */
|
||||
}
|
||||
if (f_in==(FILE *)0) {
|
||||
as_perror ("Can't open %s for reading", file_name);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef VMS
|
||||
/* Ask stdio to buffer our input at BUFFER_SIZE, with a dynamically
|
||||
int c;
|
||||
char buf[80];
|
||||
|
||||
preprocess = pre;
|
||||
|
||||
assert (filename != 0); /* Filename may not be NULL. */
|
||||
if (filename[0])
|
||||
{ /* We have a file name. Suck it and see. */
|
||||
f_in = fopen (filename, "r");
|
||||
file_name = filename;
|
||||
}
|
||||
else
|
||||
{ /* use stdin for the input file. */
|
||||
f_in = stdin;
|
||||
file_name = "{standard input}"; /* For error messages. */
|
||||
}
|
||||
if (f_in == (FILE *) 0)
|
||||
{
|
||||
as_perror ("Can't open %s for reading", file_name);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef _IOFBF
|
||||
/* Ask stdio to buffer our input at BUFFER_SIZE, with a dynamically
|
||||
allocated buffer. */
|
||||
setvbuf(f_in, (char *)NULL, _IOFBF, BUFFER_SIZE);
|
||||
setvbuf (f_in, (char *) NULL, _IOFBF, BUFFER_SIZE);
|
||||
#endif /* VMS */
|
||||
|
||||
c = getc(f_in);
|
||||
if (c == '#') { /* Begins with comment, may not want to preprocess */
|
||||
c = getc(f_in);
|
||||
if (c == 'N') {
|
||||
fgets(buf,80,f_in);
|
||||
if (!strcmp(buf,"O_APP\n"))
|
||||
preprocess=0;
|
||||
if (!strchr(buf,'\n'))
|
||||
ungetc('#',f_in); /* It was longer */
|
||||
else
|
||||
ungetc('\n',f_in);
|
||||
} else if(c=='\n')
|
||||
ungetc('\n',f_in);
|
||||
else
|
||||
ungetc('#',f_in);
|
||||
} else
|
||||
ungetc(c,f_in);
|
||||
|
||||
#ifdef DONTDEF
|
||||
if ( preprocess ) {
|
||||
char temporary_file_name [17];
|
||||
FILE *f_out;
|
||||
|
||||
(void)strcpy (temporary_file_name, "/tmp/#appXXXXXX");
|
||||
(void)mktemp (temporary_file_name);
|
||||
f_out=fopen(temporary_file_name,"w+");
|
||||
if(f_out==(FILE *)0)
|
||||
as_perror("Can't open temp file %s",temporary_file_name);
|
||||
|
||||
/* JF this will have to be moved on any system that
|
||||
does not support removal of open files. */
|
||||
(void)unlink(temporary_file_name);/* JF do it NOW */
|
||||
do_scrub(f_in,f_out);
|
||||
(void)fclose(f_in); /* All done with it */
|
||||
(void)rewind(f_out);
|
||||
f_in=f_out;
|
||||
|
||||
c = getc (f_in);
|
||||
if (c == '#')
|
||||
{ /* Begins with comment, may not want to preprocess */
|
||||
c = getc (f_in);
|
||||
if (c == 'N')
|
||||
{
|
||||
fgets (buf, 80, f_in);
|
||||
if (!strcmp (buf, "O_APP\n"))
|
||||
preprocess = 0;
|
||||
if (!strchr (buf, '\n'))
|
||||
ungetc ('#', f_in); /* It was longer */
|
||||
else
|
||||
ungetc ('\n', f_in);
|
||||
}
|
||||
else if (c == '\n')
|
||||
ungetc ('\n', f_in);
|
||||
else
|
||||
ungetc ('#', f_in);
|
||||
}
|
||||
else
|
||||
ungetc (c, f_in);
|
||||
|
||||
#ifdef DONTDEF
|
||||
if (preprocess)
|
||||
{
|
||||
char temporary_file_name[17];
|
||||
FILE *f_out;
|
||||
|
||||
(void) strcpy (temporary_file_name, "/tmp/#appXXXXXX");
|
||||
(void) mktemp (temporary_file_name);
|
||||
f_out = fopen (temporary_file_name, "w+");
|
||||
if (f_out == (FILE *) 0)
|
||||
as_perror ("Can't open temp file %s", temporary_file_name);
|
||||
|
||||
/* JF this will have to be moved on any system that
|
||||
does not support removal of open files. */
|
||||
(void) unlink (temporary_file_name); /* JF do it NOW */
|
||||
do_scrub (f_in, f_out);
|
||||
(void) fclose (f_in); /* All done with it */
|
||||
(void) rewind (f_out);
|
||||
f_in = f_out;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Close input file. */
|
||||
void input_file_close() {
|
||||
if (f_in != NULL) {
|
||||
fclose (f_in);
|
||||
} /* don't close a null file pointer */
|
||||
f_in = 0;
|
||||
} /* input_file_close() */
|
||||
void
|
||||
input_file_close ()
|
||||
{
|
||||
if (f_in != NULL)
|
||||
{
|
||||
fclose (f_in);
|
||||
} /* don't close a null file pointer */
|
||||
f_in = 0;
|
||||
} /* input_file_close() */
|
||||
|
||||
char *
|
||||
input_file_give_next_buffer (where)
|
||||
char * where; /* Where to place 1st character of new buffer. */
|
||||
input_file_give_next_buffer (where)
|
||||
char *where; /* Where to place 1st character of new buffer. */
|
||||
{
|
||||
char * return_value; /* -> Last char of what we read, + 1. */
|
||||
register int size;
|
||||
|
||||
if (f_in == (FILE *)0)
|
||||
return 0;
|
||||
/*
|
||||
char *return_value; /* -> Last char of what we read, + 1. */
|
||||
register int size;
|
||||
|
||||
if (f_in == (FILE *) 0)
|
||||
return 0;
|
||||
/*
|
||||
* fflush (stdin); could be done here if you want to synchronise
|
||||
* stdin and stdout, for the case where our input file is stdin.
|
||||
* Since the assembler shouldn't do any output to stdout, we
|
||||
* don't bother to synch output and input.
|
||||
*/
|
||||
if(preprocess) {
|
||||
char *p;
|
||||
int n;
|
||||
int ch;
|
||||
extern FILE *scrub_file;
|
||||
|
||||
scrub_file=f_in;
|
||||
for (p = where, n = BUFFER_SIZE; n; --n) {
|
||||
|
||||
ch = do_scrub_next_char(scrub_from_file, scrub_to_file);
|
||||
if (ch == EOF)
|
||||
break;
|
||||
*p++=ch;
|
||||
}
|
||||
size=BUFFER_SIZE-n;
|
||||
} else
|
||||
size= fread(where,sizeof(char),BUFFER_SIZE,f_in);
|
||||
if (size < 0)
|
||||
{
|
||||
as_perror ("Can't read from %s", file_name);
|
||||
size = 0;
|
||||
}
|
||||
if (size)
|
||||
return_value = where + size;
|
||||
else
|
||||
{
|
||||
if (fclose (f_in))
|
||||
as_perror ("Can't close %s", file_name);
|
||||
f_in = (FILE *)0;
|
||||
return_value = 0;
|
||||
}
|
||||
return (return_value);
|
||||
if (preprocess)
|
||||
{
|
||||
char *p;
|
||||
int n;
|
||||
int ch;
|
||||
extern FILE *scrub_file;
|
||||
|
||||
scrub_file = f_in;
|
||||
for (p = where, n = BUFFER_SIZE; n; --n)
|
||||
{
|
||||
|
||||
ch = do_scrub_next_char (scrub_from_file, scrub_to_file);
|
||||
if (ch == EOF)
|
||||
break;
|
||||
*p++ = ch;
|
||||
}
|
||||
size = BUFFER_SIZE - n;
|
||||
}
|
||||
else
|
||||
size = fread (where, sizeof (char), BUFFER_SIZE, f_in);
|
||||
if (size < 0)
|
||||
{
|
||||
as_perror ("Can't read from %s", file_name);
|
||||
size = 0;
|
||||
}
|
||||
if (size)
|
||||
return_value = where + size;
|
||||
else
|
||||
{
|
||||
if (fclose (f_in))
|
||||
as_perror ("Can't close %s", file_name);
|
||||
f_in = (FILE *) 0;
|
||||
return_value = 0;
|
||||
}
|
||||
return (return_value);
|
||||
}
|
||||
|
||||
/* end of input-file.c */
|
||||
|
@ -1,18 +1,18 @@
|
||||
/* input_file.h header for input-file.c
|
||||
Copyright (C) 1987 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 1987, 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. */
|
||||
@ -55,30 +55,30 @@
|
||||
* about I/O errors. No I/O errors are fatal: an end-of-file may be faked.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
|
||||
char *input_file_give_next_buffer(char *where);
|
||||
char *input_file_push(void);
|
||||
int input_file_buffer_size(void);
|
||||
int input_file_is_open(void);
|
||||
void input_file_begin(void);
|
||||
void input_file_close(void);
|
||||
void input_file_end(void);
|
||||
void input_file_open(char *filename, int pre);
|
||||
void input_file_pop(char *arg);
|
||||
char *input_file_give_next_buffer (char *where);
|
||||
char *input_file_push (void);
|
||||
int input_file_buffer_size (void);
|
||||
int input_file_is_open (void);
|
||||
void input_file_begin (void);
|
||||
void input_file_close (void);
|
||||
void input_file_end (void);
|
||||
void input_file_open (char *filename, int pre);
|
||||
void input_file_pop (char *arg);
|
||||
|
||||
#else /* __STDC__ */
|
||||
#else /* not __STDC__ */
|
||||
|
||||
char *input_file_give_next_buffer();
|
||||
char *input_file_push();
|
||||
int input_file_buffer_size();
|
||||
int input_file_is_open();
|
||||
void input_file_begin();
|
||||
void input_file_close();
|
||||
void input_file_end();
|
||||
void input_file_open();
|
||||
void input_file_pop();
|
||||
char *input_file_give_next_buffer ();
|
||||
char *input_file_push ();
|
||||
int input_file_buffer_size ();
|
||||
int input_file_is_open ();
|
||||
void input_file_begin ();
|
||||
void input_file_close ();
|
||||
void input_file_end ();
|
||||
void input_file_open ();
|
||||
void input_file_pop ();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
/* end of input_file.h */
|
||||
|
@ -1,18 +1,19 @@
|
||||
|
||||
/* This file is listing.h
|
||||
Copyright (C) 1987-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. */
|
||||
@ -36,55 +37,55 @@
|
||||
|
||||
#if __STDC__ == 1
|
||||
|
||||
void listing_eject(void);
|
||||
void listing_error(char *message);
|
||||
void listing_file(char *name);
|
||||
void listing_flags(void);
|
||||
void listing_list(unsigned int on);
|
||||
void listing_newline(char *ps);
|
||||
void listing_print(char *name);
|
||||
void listing_psize(void);
|
||||
void listing_source_file(char *);
|
||||
void listing_source_line(unsigned int);
|
||||
void listing_title(unsigned int depth);
|
||||
void listing_warning(char *message);
|
||||
void listing_width(unsigned int x);
|
||||
void listing_eject (void);
|
||||
void listing_error (char *message);
|
||||
void listing_file (char *name);
|
||||
void listing_flags (void);
|
||||
void listing_list (unsigned int on);
|
||||
void listing_newline (char *ps);
|
||||
void listing_print (char *name);
|
||||
void listing_psize (void);
|
||||
void listing_source_file (char *);
|
||||
void listing_source_line (unsigned int);
|
||||
void listing_title (unsigned int depth);
|
||||
void listing_warning (char *message);
|
||||
void listing_width (unsigned int x);
|
||||
|
||||
#else /* not __STDC__ */
|
||||
|
||||
void listing_eject();
|
||||
void listing_error();
|
||||
void listing_file();
|
||||
void listing_flags();
|
||||
void listing_list();
|
||||
void listing_newline();
|
||||
void listing_print();
|
||||
void listing_psize();
|
||||
void listing_source_file();
|
||||
void listing_source_line();
|
||||
void listing_title();
|
||||
void listing_warning();
|
||||
void listing_width();
|
||||
void listing_eject ();
|
||||
void listing_error ();
|
||||
void listing_file ();
|
||||
void listing_flags ();
|
||||
void listing_list ();
|
||||
void listing_newline ();
|
||||
void listing_print ();
|
||||
void listing_psize ();
|
||||
void listing_source_file ();
|
||||
void listing_source_line ();
|
||||
void listing_title ();
|
||||
void listing_warning ();
|
||||
void listing_width ();
|
||||
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
#else /* not NO_LISTING */
|
||||
#else /* NO_LISTING */
|
||||
|
||||
#define LISTING_NEWLINE() {;}
|
||||
|
||||
/* Dummy functions for when compiled without listing enabled */
|
||||
|
||||
#define listing_flags() {;]
|
||||
#define listing_list() {;]
|
||||
#define listing_eject() {;]
|
||||
#define listing_psize() {;]
|
||||
#define listing_title(depth) {;]
|
||||
#define listing_file(name) {;]
|
||||
#define listing_newline(name) {;]
|
||||
#define listing_source_line(n) {;]
|
||||
#define listing_source_file(n) [;]
|
||||
#define listing_flags() {;}
|
||||
#define listing_list() {;}
|
||||
#define listing_eject() {;}
|
||||
#define listing_psize() {;}
|
||||
#define listing_title(depth) {;}
|
||||
#define listing_file(name) {;}
|
||||
#define listing_newline(name) {;}
|
||||
#define listing_source_line(n) {;}
|
||||
#define listing_source_file(n) {;}
|
||||
|
||||
#endif /* not NO_LISTING */
|
||||
#endif /* NO_LISTING */
|
||||
|
||||
#endif /* __listing_h__ */
|
||||
|
||||
|
383
gas/messages.c
383
gas/messages.c
@ -1,23 +1,23 @@
|
||||
/* messages.c - error reporter -
|
||||
Copyright (C) 1987, 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. */
|
||||
|
||||
#include <stdio.h> /* define stderr */
|
||||
#include <stdio.h> /* define stderr */
|
||||
#include <errno.h>
|
||||
|
||||
#include "as.h"
|
||||
@ -76,10 +76,10 @@
|
||||
|
||||
/*
|
||||
ERRORS
|
||||
|
||||
|
||||
JF: this is now bogus. We now print more standard error messages
|
||||
that try to look like everyone else's.
|
||||
|
||||
|
||||
We print the error message 1st, beginning in column 1.
|
||||
All ancillary info starts in column 2 on lines after the
|
||||
key error text.
|
||||
@ -87,31 +87,35 @@
|
||||
just after the main error text.
|
||||
Caller then prints any appendices after that, begining all
|
||||
lines with at least 1 space.
|
||||
|
||||
|
||||
Optionally, we may die.
|
||||
There is no need for a trailing '\n' in your error text format
|
||||
because we supply one.
|
||||
|
||||
|
||||
as_warn(fmt,args) Like fprintf(stderr,fmt,args) but also call errwhere().
|
||||
|
||||
|
||||
as_fatal(fmt,args) Like as_warn() but exit with a fatal status.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
static int warning_count; /* Count of number of warnings issued */
|
||||
static int warning_count; /* Count of number of warnings issued */
|
||||
|
||||
int had_warnings() {
|
||||
return(warning_count);
|
||||
} /* had_err() */
|
||||
int
|
||||
had_warnings ()
|
||||
{
|
||||
return (warning_count);
|
||||
} /* had_err() */
|
||||
|
||||
/* Nonzero if we've hit a 'bad error', and should not write an obj file,
|
||||
and exit with a nonzero error code */
|
||||
|
||||
static int error_count;
|
||||
|
||||
int had_errors() {
|
||||
return(error_count);
|
||||
} /* had_errors() */
|
||||
int
|
||||
had_errors ()
|
||||
{
|
||||
return (error_count);
|
||||
} /* had_errors() */
|
||||
|
||||
|
||||
/*
|
||||
@ -119,64 +123,70 @@ int had_errors() {
|
||||
*
|
||||
* Like perror(3), but with more info.
|
||||
*/
|
||||
void as_perror(gripe, filename)
|
||||
char *gripe; /* Unpunctuated error theme. */
|
||||
char *filename;
|
||||
void
|
||||
as_perror (gripe, filename)
|
||||
char *gripe; /* Unpunctuated error theme. */
|
||||
char *filename;
|
||||
{
|
||||
#ifndef HAVE_STRERROR
|
||||
extern char *strerror();
|
||||
extern char *strerror ();
|
||||
#endif /* HAVE_STRERROR */
|
||||
|
||||
as_where();
|
||||
fprintf(stderr, gripe, filename);
|
||||
fprintf(stderr, ": %s\n", strerror(errno));
|
||||
errno = 0; /* After reporting, clear it. */
|
||||
} /* as_perror() */
|
||||
as_where ();
|
||||
fprintf (stderr, gripe, filename);
|
||||
fprintf (stderr, ": %s\n", strerror (errno));
|
||||
errno = 0; /* After reporting, clear it. */
|
||||
} /* as_perror() */
|
||||
|
||||
/*
|
||||
* a s _ t s k t s k ()
|
||||
*
|
||||
* Send to stderr a string (with bell) (JF: Bell is obnoxious!) as a warning, and locate warning
|
||||
* Send to stderr a string as a warning, and locate warning
|
||||
* in input file(s).
|
||||
* Please only use this for when we have some recovery action.
|
||||
* Please explain in string (which may have '\n's) what recovery was done.
|
||||
*/
|
||||
|
||||
#ifndef NO_STDARG
|
||||
void as_tsktsk(const char *Format, ...)
|
||||
void
|
||||
as_tsktsk (const char *Format,...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
as_where();
|
||||
va_start(args, Format);
|
||||
vfprintf(stderr, Format, args);
|
||||
va_end(args);
|
||||
(void) putc('\n', stderr);
|
||||
} /* as_tsktsk() */
|
||||
va_list args;
|
||||
|
||||
as_where ();
|
||||
va_start (args, Format);
|
||||
vfprintf (stderr, Format, args);
|
||||
va_end (args);
|
||||
(void) putc ('\n', stderr);
|
||||
} /* as_tsktsk() */
|
||||
|
||||
#else
|
||||
#ifndef NO_VARARGS
|
||||
void as_tsktsk(Format,va_alist)
|
||||
char *Format;
|
||||
va_dcl
|
||||
void
|
||||
as_tsktsk (Format, va_alist)
|
||||
char *Format;
|
||||
va_dcl
|
||||
{
|
||||
va_list args;
|
||||
|
||||
as_where();
|
||||
va_start(args);
|
||||
vfprintf(stderr, Format, args);
|
||||
va_end(args);
|
||||
(void) putc('\n', stderr);
|
||||
} /* as_tsktsk() */
|
||||
va_list args;
|
||||
|
||||
as_where ();
|
||||
va_start (args);
|
||||
vfprintf (stderr, Format, args);
|
||||
va_end (args);
|
||||
(void) putc ('\n', stderr);
|
||||
} /* as_tsktsk() */
|
||||
|
||||
#else
|
||||
/*VARARGS1 */
|
||||
as_tsktsk(Format,args)
|
||||
char *Format;
|
||||
as_tsktsk (Format, args)
|
||||
char *Format;
|
||||
{
|
||||
as_where();
|
||||
_doprnt (Format, &args, stderr);
|
||||
(void)putc ('\n', stderr);
|
||||
/* as_where(); */
|
||||
} /* as_tsktsk */
|
||||
as_where ();
|
||||
_doprnt (Format, &args, stderr);
|
||||
(void) putc ('\n', stderr);
|
||||
/* as_where(); */
|
||||
} /* as_tsktsk */
|
||||
|
||||
#endif /* not NO_VARARGS */
|
||||
#endif /* not NO_STDARG */
|
||||
|
||||
@ -190,181 +200,198 @@ char *Format;
|
||||
*/
|
||||
|
||||
#ifndef NO_STDARG
|
||||
void as_warn(const char *Format, ...)
|
||||
void
|
||||
as_warn (const char *Format,...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[200];
|
||||
|
||||
if(!flagseen['W']) {
|
||||
++warning_count;
|
||||
as_where();
|
||||
va_start(args, Format);
|
||||
fprintf(stderr,"Warning: ");
|
||||
vsprintf(buffer, Format, args);
|
||||
fputs (buffer, stderr);
|
||||
va_list args;
|
||||
char buffer[200];
|
||||
|
||||
if (!flagseen['W'])
|
||||
{
|
||||
++warning_count;
|
||||
as_where ();
|
||||
va_start (args, Format);
|
||||
fprintf (stderr, "Warning: ");
|
||||
vsprintf (buffer, Format, args);
|
||||
fputs (buffer, stderr);
|
||||
#ifndef NO_LISTING
|
||||
listing_warning(buffer);
|
||||
listing_warning (buffer);
|
||||
#endif
|
||||
va_end(args);
|
||||
(void) putc('\n', stderr);
|
||||
}
|
||||
} /* as_warn() */
|
||||
va_end (args);
|
||||
(void) putc ('\n', stderr);
|
||||
}
|
||||
} /* as_warn() */
|
||||
|
||||
#else
|
||||
#ifndef NO_VARARGS
|
||||
void as_warn(Format,va_alist)
|
||||
char *Format;
|
||||
va_dcl
|
||||
void
|
||||
as_warn (Format, va_alist)
|
||||
char *Format;
|
||||
va_dcl
|
||||
{
|
||||
va_list args;
|
||||
char buffer[200];
|
||||
|
||||
if(!flagseen['W']) {
|
||||
++warning_count;
|
||||
as_where();
|
||||
va_start(args);
|
||||
fprintf(stderr,"Warning: ");
|
||||
vsprintf(buffer, Format, args);
|
||||
fputs (buffer, stderr);
|
||||
va_list args;
|
||||
char buffer[200];
|
||||
|
||||
if (!flagseen['W'])
|
||||
{
|
||||
++warning_count;
|
||||
as_where ();
|
||||
va_start (args);
|
||||
fprintf (stderr, "Warning: ");
|
||||
vsprintf (buffer, Format, args);
|
||||
fputs (buffer, stderr);
|
||||
#ifndef NO_LISTING
|
||||
listing_warning(buffer);
|
||||
#endif
|
||||
va_end(args);
|
||||
(void) putc('\n', stderr);
|
||||
}
|
||||
} /* as_warn() */
|
||||
listing_warning (buffer);
|
||||
#endif
|
||||
va_end (args);
|
||||
(void) putc ('\n', stderr);
|
||||
}
|
||||
} /* as_warn() */
|
||||
|
||||
#else
|
||||
/*VARARGS1 */
|
||||
as_warn(Format,args)
|
||||
char *Format;
|
||||
as_warn (Format, args)
|
||||
char *Format;
|
||||
{
|
||||
/* -W supresses warning messages. */
|
||||
if (! flagseen ['W']) {
|
||||
++warning_count;
|
||||
as_where();
|
||||
_doprnt (Format, &args, stderr);
|
||||
(void)putc ('\n', stderr);
|
||||
/* as_where(); */
|
||||
}
|
||||
} /* as_warn() */
|
||||
/* -W supresses warning messages. */
|
||||
if (!flagseen['W'])
|
||||
{
|
||||
++warning_count;
|
||||
as_where ();
|
||||
_doprnt (Format, &args, stderr);
|
||||
(void) putc ('\n', stderr);
|
||||
/* as_where(); */
|
||||
}
|
||||
} /* as_warn() */
|
||||
|
||||
#endif /* not NO_VARARGS */
|
||||
#endif /* not NO_STDARG */
|
||||
|
||||
/*
|
||||
* a s _ b a d ()
|
||||
*
|
||||
* Send to stderr a string (with bell) (JF: Bell is obnoxious!) as a warning,
|
||||
* and locate warning in input file(s).
|
||||
* Send to stderr a string as a warning, and locate warning in input file(s).
|
||||
* Please us when there is no recovery, but we want to continue processing
|
||||
* but not produce an object file.
|
||||
* Please explain in string (which may have '\n's) what recovery was done.
|
||||
*/
|
||||
|
||||
#ifndef NO_STDARG
|
||||
void as_bad(const char *Format, ...)
|
||||
void
|
||||
as_bad (const char *Format,...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[200];
|
||||
|
||||
++error_count;
|
||||
as_where();
|
||||
va_start(args, Format);
|
||||
fprintf(stderr,"Error: ");
|
||||
|
||||
vsprintf(buffer, Format, args);
|
||||
fputs (buffer,stderr);
|
||||
va_list args;
|
||||
char buffer[200];
|
||||
|
||||
++error_count;
|
||||
as_where ();
|
||||
va_start (args, Format);
|
||||
fprintf (stderr, "Error: ");
|
||||
|
||||
vsprintf (buffer, Format, args);
|
||||
fputs (buffer, stderr);
|
||||
#ifndef NO_LISTING
|
||||
listing_error(buffer);
|
||||
listing_error (buffer);
|
||||
#endif
|
||||
va_end(args);
|
||||
(void) putc('\n', stderr);
|
||||
} /* as_bad() */
|
||||
va_end (args);
|
||||
(void) putc ('\n', stderr);
|
||||
} /* as_bad() */
|
||||
|
||||
#else
|
||||
#ifndef NO_VARARGS
|
||||
void as_bad(Format,va_alist)
|
||||
char *Format;
|
||||
va_dcl
|
||||
void
|
||||
as_bad (Format, va_alist)
|
||||
char *Format;
|
||||
va_dcl
|
||||
{
|
||||
va_list args;
|
||||
char buffer[200];
|
||||
|
||||
++error_count;
|
||||
as_where();
|
||||
va_start(args);
|
||||
vsprintf(buffer, Format, args);
|
||||
fputs (buffer, stderr);
|
||||
va_list args;
|
||||
char buffer[200];
|
||||
|
||||
++error_count;
|
||||
as_where ();
|
||||
va_start (args);
|
||||
vsprintf (buffer, Format, args);
|
||||
fputs (buffer, stderr);
|
||||
#ifndef NO_LISTING
|
||||
listing_error(buffer);
|
||||
listing_error (buffer);
|
||||
#endif
|
||||
|
||||
va_end(args);
|
||||
(void) putc('\n', stderr);
|
||||
|
||||
va_end (args);
|
||||
(void) putc ('\n', stderr);
|
||||
} /* as_bad() */
|
||||
|
||||
#else
|
||||
/*VARARGS1 */
|
||||
as_bad(Format,args)
|
||||
char *Format;
|
||||
as_bad (Format, args)
|
||||
char *Format;
|
||||
{
|
||||
++error_count;
|
||||
|
||||
as_where();
|
||||
fprintf(stderr,"Error: ");
|
||||
_doprnt (Format, &args, stderr);
|
||||
(void)putc ('\n', stderr);
|
||||
/* as_where(); */
|
||||
} /* as_bad() */
|
||||
++error_count;
|
||||
|
||||
as_where ();
|
||||
fprintf (stderr, "Error: ");
|
||||
_doprnt (Format, &args, stderr);
|
||||
(void) putc ('\n', stderr);
|
||||
/* as_where(); */
|
||||
} /* as_bad() */
|
||||
|
||||
#endif /* not NO_VARARGS */
|
||||
#endif /* not NO_STDARG */
|
||||
|
||||
/*
|
||||
* a s _ f a t a l ()
|
||||
*
|
||||
* Send to stderr a string (with bell) (JF: Bell is obnoxious!) as a fatal
|
||||
* message, and locate stdsource in input file(s).
|
||||
* Send to stderr a string as a fatal message, and print location of error in
|
||||
* input file(s).
|
||||
* Please only use this for when we DON'T have some recovery action.
|
||||
* It exit()s with a warning status.
|
||||
*/
|
||||
|
||||
#ifndef NO_STDARG
|
||||
void as_fatal(const char *Format, ...)
|
||||
void
|
||||
as_fatal (const char *Format,...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
as_where();
|
||||
va_start(args, Format);
|
||||
fprintf (stderr, "FATAL:");
|
||||
vfprintf(stderr, Format, args);
|
||||
(void) putc('\n', stderr);
|
||||
va_end(args);
|
||||
exit(33);
|
||||
} /* as_fatal() */
|
||||
va_list args;
|
||||
|
||||
as_where ();
|
||||
va_start (args, Format);
|
||||
fprintf (stderr, "FATAL:");
|
||||
vfprintf (stderr, Format, args);
|
||||
(void) putc ('\n', stderr);
|
||||
va_end (args);
|
||||
exit (33);
|
||||
} /* as_fatal() */
|
||||
|
||||
#else
|
||||
#ifndef NO_VARARGS
|
||||
void as_fatal(Format,va_alist)
|
||||
char *Format;
|
||||
va_dcl
|
||||
void
|
||||
as_fatal (Format, va_alist)
|
||||
char *Format;
|
||||
va_dcl
|
||||
{
|
||||
va_list args;
|
||||
|
||||
as_where();
|
||||
va_start(args);
|
||||
fprintf (stderr, "FATAL:");
|
||||
vfprintf(stderr, Format, args);
|
||||
(void) putc('\n', stderr);
|
||||
va_end(args);
|
||||
exit(33);
|
||||
} /* as_fatal() */
|
||||
va_list args;
|
||||
|
||||
as_where ();
|
||||
va_start (args);
|
||||
fprintf (stderr, "FATAL:");
|
||||
vfprintf (stderr, Format, args);
|
||||
(void) putc ('\n', stderr);
|
||||
va_end (args);
|
||||
exit (33);
|
||||
} /* as_fatal() */
|
||||
|
||||
#else
|
||||
/*VARARGS1 */
|
||||
as_fatal(Format, args)
|
||||
char *Format;
|
||||
as_fatal (Format, args)
|
||||
char *Format;
|
||||
{
|
||||
as_where();
|
||||
fprintf(stderr,"FATAL:");
|
||||
_doprnt (Format, &args, stderr);
|
||||
(void)putc ('\n', stderr);
|
||||
/* as_where(); */
|
||||
exit(33); /* What is a good exit status? */
|
||||
} /* as_fatal() */
|
||||
as_where ();
|
||||
fprintf (stderr, "FATAL:");
|
||||
_doprnt (Format, &args, stderr);
|
||||
(void) putc ('\n', stderr);
|
||||
/* as_where(); */
|
||||
exit (33); /* What is a good exit status? */
|
||||
} /* as_fatal() */
|
||||
|
||||
#endif /* not NO_VARARGS */
|
||||
#endif /* not NO_STDARG */
|
||||
|
||||
|
58
gas/obj.h
58
gas/obj.h
@ -1,65 +1,65 @@
|
||||
/* obj.h - defines the object dependent hooks for all object
|
||||
format backends.
|
||||
|
||||
Copyright (C) 1987, 1990, 1991 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
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. */
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
|
||||
char *obj_default_output_file_name(void);
|
||||
void obj_crawl_symbol_chain(object_headers *headers);
|
||||
void obj_emit_relocations(char **where, fixS *fixP, relax_addressT segment_address_in_file);
|
||||
void obj_emit_strings(char **where);
|
||||
void obj_emit_symbols(char **where, symbolS *symbol_rootP);
|
||||
void obj_header_append(char **where, object_headers *headers);
|
||||
void obj_read_begin_hook(void);
|
||||
char *obj_default_output_file_name (void);
|
||||
void obj_crawl_symbol_chain (object_headers * headers);
|
||||
void obj_emit_relocations (char **where, fixS * fixP, relax_addressT segment_address_in_file);
|
||||
void obj_emit_strings (char **where);
|
||||
void obj_emit_symbols (char **where, symbolS * symbol_rootP);
|
||||
void obj_header_append (char **where, object_headers * headers);
|
||||
void obj_read_begin_hook (void);
|
||||
|
||||
#ifndef obj_symbol_new_hook
|
||||
void obj_symbol_new_hook(symbolS *symbolP);
|
||||
void obj_symbol_new_hook (symbolS * symbolP);
|
||||
#endif /* obj_symbol_new_hook */
|
||||
|
||||
void obj_symbol_to_chars(char **where, symbolS *symbolP);
|
||||
void obj_symbol_to_chars (char **where, symbolS * symbolP);
|
||||
|
||||
#ifndef obj_pre_write_hook
|
||||
void obj_pre_write_hook(object_headers *headers);
|
||||
void obj_pre_write_hook (object_headers * headers);
|
||||
#endif /* obj_pre_write_hook */
|
||||
|
||||
#else
|
||||
#else /* not __STDC__ */
|
||||
|
||||
char *obj_default_output_file_name();
|
||||
void obj_crawl_symbol_chain();
|
||||
void obj_emit_relocations();
|
||||
void obj_emit_strings();
|
||||
void obj_emit_symbols();
|
||||
void obj_header_append();
|
||||
void obj_read_begin_hook();
|
||||
char *obj_default_output_file_name ();
|
||||
void obj_crawl_symbol_chain ();
|
||||
void obj_emit_relocations ();
|
||||
void obj_emit_strings ();
|
||||
void obj_emit_symbols ();
|
||||
void obj_header_append ();
|
||||
void obj_read_begin_hook ();
|
||||
|
||||
#ifndef obj_symbol_new_hook
|
||||
void obj_symbol_new_hook();
|
||||
void obj_symbol_new_hook ();
|
||||
#endif /* obj_symbol_new_hook */
|
||||
|
||||
void obj_symbol_to_chars();
|
||||
void obj_symbol_to_chars ();
|
||||
|
||||
#ifndef obj_pre_write_hook
|
||||
void obj_pre_write_hook();
|
||||
void obj_pre_write_hook ();
|
||||
#endif /* obj_pre_write_hook */
|
||||
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
extern const pseudo_typeS obj_pseudo_table[];
|
||||
|
||||
|
@ -24,12 +24,22 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#endif
|
||||
|
||||
/* Determine default alignment. */
|
||||
struct fooalign {char x; double d;};
|
||||
struct fooalign
|
||||
{
|
||||
char x;
|
||||
double d;
|
||||
};
|
||||
|
||||
#define DEFAULT_ALIGNMENT ((char *)&((struct fooalign *) 0)->d - (char *)0)
|
||||
/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT.
|
||||
But in fact it might be less smart and round addresses to as much as
|
||||
DEFAULT_ROUNDING. So we prepare for it to do that. */
|
||||
union fooround {long x; double d;};
|
||||
union fooround
|
||||
{
|
||||
long x;
|
||||
double d;
|
||||
};
|
||||
|
||||
#define DEFAULT_ROUNDING (sizeof (union fooround))
|
||||
|
||||
/* When we copy a long block of data, this is the unit to do it with.
|
||||
@ -55,10 +65,10 @@ _obstack_begin (h, size, alignment, chunkfun, freefun)
|
||||
struct obstack *h;
|
||||
int size;
|
||||
int alignment;
|
||||
POINTER (*chunkfun) ();
|
||||
POINTER (*chunkfun) ();
|
||||
void (*freefun) ();
|
||||
{
|
||||
register struct _obstack_chunk* chunk; /* points to new chunk */
|
||||
register struct _obstack_chunk *chunk; /* points to new chunk */
|
||||
|
||||
if (alignment == 0)
|
||||
alignment = DEFAULT_ALIGNMENT;
|
||||
@ -84,7 +94,7 @@ _obstack_begin (h, size, alignment, chunkfun, freefun)
|
||||
h->chunk_size = size;
|
||||
h->alignment_mask = alignment - 1;
|
||||
|
||||
chunk = h->chunk = (*h->chunkfun) (h->chunk_size);
|
||||
chunk = h->chunk = (*h->chunkfun) (h->chunk_size);
|
||||
h->next_free = h->object_base = chunk->contents;
|
||||
h->chunk_limit = chunk->limit
|
||||
= (char *) chunk + h->chunk_size;
|
||||
@ -104,9 +114,9 @@ _obstack_newchunk (h, length)
|
||||
struct obstack *h;
|
||||
int length;
|
||||
{
|
||||
register struct _obstack_chunk* old_chunk = h->chunk;
|
||||
register struct _obstack_chunk* new_chunk;
|
||||
register long new_size;
|
||||
register struct _obstack_chunk *old_chunk = h->chunk;
|
||||
register struct _obstack_chunk *new_chunk;
|
||||
register long new_size;
|
||||
register int obj_size = h->next_free - h->object_base;
|
||||
register int i;
|
||||
int already;
|
||||
@ -128,8 +138,8 @@ _obstack_newchunk (h, length)
|
||||
{
|
||||
for (i = obj_size / sizeof (COPYING_UNIT) - 1;
|
||||
i >= 0; i--)
|
||||
((COPYING_UNIT *)new_chunk->contents)[i]
|
||||
= ((COPYING_UNIT *)h->object_base)[i];
|
||||
((COPYING_UNIT *) new_chunk->contents)[i]
|
||||
= ((COPYING_UNIT *) h->object_base)[i];
|
||||
/* We used to copy the odd few remaining bytes as one extra COPYING_UNIT,
|
||||
but that can cross a page boundary on a machine
|
||||
which does not do strict alignment for COPYING_UNITS. */
|
||||
@ -144,7 +154,7 @@ _obstack_newchunk (h, length)
|
||||
/* If the object just copied was the only data in OLD_CHUNK,
|
||||
free that chunk and remove it from the chain.
|
||||
But not if that chunk might contain an empty object. */
|
||||
if (h->object_base == old_chunk->contents && ! h->maybe_empty_object)
|
||||
if (h->object_base == old_chunk->contents && !h->maybe_empty_object)
|
||||
{
|
||||
new_chunk->prev = old_chunk->prev;
|
||||
(*h->freefun) (old_chunk);
|
||||
@ -165,14 +175,14 @@ _obstack_allocated_p (h, obj)
|
||||
struct obstack *h;
|
||||
POINTER obj;
|
||||
{
|
||||
register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */
|
||||
register struct _obstack_chunk* plp; /* point to previous chunk if any */
|
||||
register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
|
||||
register struct _obstack_chunk *plp; /* point to previous chunk if any */
|
||||
|
||||
lp = (h)->chunk;
|
||||
/* We use >= rather than > since the object cannot be exactly at
|
||||
the beginning of the chunk but might be an empty object exactly
|
||||
at the end of an adjacent chunk. */
|
||||
while (lp != 0 && ((POINTER)lp >= obj || (POINTER)(lp)->limit < obj))
|
||||
while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj))
|
||||
{
|
||||
plp = lp->prev;
|
||||
lp = plp;
|
||||
@ -193,14 +203,14 @@ _obstack_free (h, obj)
|
||||
struct obstack *h;
|
||||
POINTER obj;
|
||||
{
|
||||
register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */
|
||||
register struct _obstack_chunk* plp; /* point to previous chunk if any */
|
||||
register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
|
||||
register struct _obstack_chunk *plp; /* point to previous chunk if any */
|
||||
|
||||
lp = h->chunk;
|
||||
/* We use >= because there cannot be an object at the beginning of a chunk.
|
||||
But there can be an empty object at that address
|
||||
at the end of another chunk. */
|
||||
while (lp != 0 && ((POINTER)lp >= obj || (POINTER)(lp)->limit < obj))
|
||||
while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj))
|
||||
{
|
||||
plp = lp->prev;
|
||||
(*h->freefun) (lp);
|
||||
@ -211,7 +221,7 @@ _obstack_free (h, obj)
|
||||
}
|
||||
if (lp)
|
||||
{
|
||||
h->object_base = h->next_free = (char *)(obj);
|
||||
h->object_base = h->next_free = (char *) (obj);
|
||||
h->chunk_limit = lp->limit;
|
||||
h->chunk = lp;
|
||||
}
|
||||
@ -227,14 +237,14 @@ obstack_free (h, obj)
|
||||
struct obstack *h;
|
||||
POINTER obj;
|
||||
{
|
||||
register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */
|
||||
register struct _obstack_chunk* plp; /* point to previous chunk if any */
|
||||
register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
|
||||
register struct _obstack_chunk *plp; /* point to previous chunk if any */
|
||||
|
||||
lp = h->chunk;
|
||||
/* We use >= because there cannot be an object at the beginning of a chunk.
|
||||
But there can be an empty object at that address
|
||||
at the end of another chunk. */
|
||||
while (lp != 0 && ((POINTER)lp >= obj || (POINTER)(lp)->limit < obj))
|
||||
while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj))
|
||||
{
|
||||
plp = lp->prev;
|
||||
(*h->freefun) (lp);
|
||||
@ -245,7 +255,7 @@ obstack_free (h, obj)
|
||||
}
|
||||
if (lp)
|
||||
{
|
||||
h->object_base = h->next_free = (char *)(obj);
|
||||
h->object_base = h->next_free = (char *) (obj);
|
||||
h->chunk_limit = lp->limit;
|
||||
h->chunk = lp;
|
||||
}
|
||||
|
@ -117,39 +117,39 @@ Summary:
|
||||
|
||||
struct _obstack_chunk /* Lives at front of each chunk. */
|
||||
{
|
||||
char *limit; /* 1 past end of this chunk */
|
||||
char *limit; /* 1 past end of this chunk */
|
||||
struct _obstack_chunk *prev; /* address of prior chunk or NULL */
|
||||
char contents[4]; /* objects begin here */
|
||||
char contents[4]; /* objects begin here */
|
||||
};
|
||||
|
||||
struct obstack /* control current object in current chunk */
|
||||
struct obstack /* control current object in current chunk */
|
||||
{
|
||||
long chunk_size; /* preferred size to allocate chunks in */
|
||||
struct _obstack_chunk* chunk; /* address of current struct obstack_chunk */
|
||||
char *object_base; /* address of object we are building */
|
||||
char *next_free; /* where to add next char to current object */
|
||||
char *chunk_limit; /* address of char after current chunk */
|
||||
int temp; /* Temporary for some macros. */
|
||||
int alignment_mask; /* Mask of alignment for each object. */
|
||||
struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */
|
||||
long chunk_size; /* preferred size to allocate chunks in */
|
||||
struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */
|
||||
char *object_base; /* address of object we are building */
|
||||
char *next_free; /* where to add next char to current object */
|
||||
char *chunk_limit; /* address of char after current chunk */
|
||||
int temp; /* Temporary for some macros. */
|
||||
int alignment_mask; /* Mask of alignment for each object. */
|
||||
struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */
|
||||
void (*freefun) (); /* User's function to free a chunk. */
|
||||
/* Nonzero means there is a possibility the current chunk contains
|
||||
a zero-length object. This prevents freeing the chunk
|
||||
if we allocate a bigger chunk to replace it. */
|
||||
char maybe_empty_object;
|
||||
char maybe_empty_object;
|
||||
};
|
||||
|
||||
/* Declare the external functions we use; they are in obstack.c. */
|
||||
|
||||
#ifdef __STDC__
|
||||
extern void _obstack_newchunk (struct obstack *, int);
|
||||
extern void _obstack_free (struct obstack *, void *);
|
||||
extern void _obstack_begin (struct obstack *, int, int,
|
||||
void *(*) (), void (*) ());
|
||||
extern void _obstack_newchunk (struct obstack *, int);
|
||||
extern void _obstack_free (struct obstack *, void *);
|
||||
extern void _obstack_begin (struct obstack *, int, int,
|
||||
void *(*)(), void (*)());
|
||||
#else
|
||||
extern void _obstack_newchunk ();
|
||||
extern void _obstack_free ();
|
||||
extern void _obstack_begin ();
|
||||
extern void _obstack_newchunk ();
|
||||
extern void _obstack_free ();
|
||||
extern void _obstack_begin ();
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
@ -159,10 +159,10 @@ struct obstack /* control current object in current chunk */
|
||||
|
||||
void obstack_init (struct obstack *obstack);
|
||||
|
||||
void * obstack_alloc (struct obstack *obstack, int size);
|
||||
void *obstack_alloc (struct obstack *obstack, int size);
|
||||
|
||||
void * obstack_copy (struct obstack *obstack, void *address, int size);
|
||||
void * obstack_copy0 (struct obstack *obstack, void *address, int size);
|
||||
void *obstack_copy (struct obstack *obstack, void *address, int size);
|
||||
void *obstack_copy0 (struct obstack *obstack, void *address, int size);
|
||||
|
||||
void obstack_free (struct obstack *obstack, void *block);
|
||||
|
||||
@ -175,7 +175,7 @@ void obstack_1grow (struct obstack *obstack, int data_char);
|
||||
void obstack_ptr_grow (struct obstack *obstack, void *data);
|
||||
void obstack_int_grow (struct obstack *obstack, int data);
|
||||
|
||||
void * obstack_finish (struct obstack *obstack);
|
||||
void *obstack_finish (struct obstack *obstack);
|
||||
|
||||
int obstack_object_size (struct obstack *obstack);
|
||||
|
||||
@ -185,8 +185,8 @@ void obstack_ptr_grow_fast (struct obstack *obstack, void *data);
|
||||
void obstack_int_grow_fast (struct obstack *obstack, int data);
|
||||
void obstack_blank_fast (struct obstack *obstack, int size);
|
||||
|
||||
void * obstack_base (struct obstack *obstack);
|
||||
void * obstack_next_free (struct obstack *obstack);
|
||||
void *obstack_base (struct obstack *obstack);
|
||||
void *obstack_next_free (struct obstack *obstack);
|
||||
int obstack_alignment_mask (struct obstack *obstack);
|
||||
int obstack_chunk_size (struct obstack *obstack);
|
||||
|
||||
@ -282,7 +282,7 @@ __extension__ \
|
||||
/* These assume that the obstack alignment is good enough for pointers or ints,
|
||||
and that the data added so far to the current object
|
||||
shares that much alignment. */
|
||||
|
||||
|
||||
#define obstack_ptr_grow(OBSTACK,datum) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
|
@ -1,16 +1,34 @@
|
||||
/* This file is output-file.h
|
||||
|
||||
Copyright (C) 1987-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. */
|
||||
|
||||
#ifdef __STDC__
|
||||
|
||||
void output_file_append(char *where, long length, char *filename);
|
||||
void output_file_close(char *filename);
|
||||
void output_file_create(char *name);
|
||||
void output_file_append (char *where, long length, char *filename);
|
||||
void output_file_close (char *filename);
|
||||
void output_file_create (char *name);
|
||||
|
||||
#else /* __STDC__ */
|
||||
|
||||
void output_file_append();
|
||||
void output_file_close();
|
||||
void output_file_create();
|
||||
void output_file_append ();
|
||||
void output_file_close ();
|
||||
void output_file_create ();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
|
3061
gas/read.c
3061
gas/read.c
File diff suppressed because it is too large
Load Diff
170
gas/read.h
170
gas/read.h
@ -1,23 +1,24 @@
|
||||
/* read.h - of read.c
|
||||
Copyright (C) 1986, 1990 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Copyright (C) 1986, 1990, 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. */
|
||||
|
||||
extern char *input_line_pointer; /* -> char we are parsing now. */
|
||||
extern char *input_line_pointer;/* -> char we are parsing now. */
|
||||
|
||||
#define PERMIT_WHITESPACE /* Define to make whitespace be allowed in */
|
||||
/* many syntactically unnecessary places. */
|
||||
@ -32,8 +33,8 @@ extern char *input_line_pointer; /* -> char we are parsing now. */
|
||||
#endif
|
||||
|
||||
|
||||
#define LEX_NAME (1) /* may continue a name */
|
||||
#define LEX_BEGIN_NAME (2) /* may begin a name */
|
||||
#define LEX_NAME (1) /* may continue a name */
|
||||
#define LEX_BEGIN_NAME (2) /* may begin a name */
|
||||
|
||||
#define is_name_beginner(c) ( lex_type[c] & LEX_BEGIN_NAME )
|
||||
#define is_part_of_name(c) ( lex_type[c] & LEX_NAME )
|
||||
@ -47,83 +48,90 @@ extern char *input_line_pointer; /* -> char we are parsing now. */
|
||||
extern const char lex_type[];
|
||||
extern char is_end_of_line[];
|
||||
|
||||
#ifdef __STDC__
|
||||
/* These are initialized by the CPU specific target files (tc-*.c). */
|
||||
extern const char comment_chars[];
|
||||
extern const char line_comment_chars[];
|
||||
extern const char line_separator_chars[];
|
||||
|
||||
char *demand_copy_C_string(int *len_pointer);
|
||||
char get_absolute_expression_and_terminator(long *val_pointer);
|
||||
long get_absolute_expression(void);
|
||||
void add_include_dir(char *path);
|
||||
void big_cons(int nbytes);
|
||||
void cons(unsigned int nbytes);
|
||||
void demand_empty_rest_of_line(void);
|
||||
void equals(char *sym_name);
|
||||
void float_cons(int float_type);
|
||||
void ignore_rest_of_line(void);
|
||||
void pseudo_set(symbolS *symbolP);
|
||||
void read_a_source_file(char *name);
|
||||
void read_begin(void);
|
||||
void s_abort(void);
|
||||
void s_align_bytes(int arg);
|
||||
void s_align_ptwo(void);
|
||||
void s_app_file(void);
|
||||
void s_comm(void);
|
||||
void s_data(void);
|
||||
void s_else(int arg);
|
||||
void s_end(int arg);
|
||||
void s_endif(int arg);
|
||||
void s_fill(void);
|
||||
void s_globl(void);
|
||||
void s_if(int arg);
|
||||
void s_ifdef(int arg);
|
||||
void s_ifeqs(int arg);
|
||||
void s_ignore(int arg);
|
||||
void s_include(int arg);
|
||||
void s_lcomm(int needs_align);
|
||||
void s_lsym(void);
|
||||
void s_org(void);
|
||||
void s_set(void);
|
||||
void s_space(void);
|
||||
void s_text(void);
|
||||
#if __STDC__ == 1
|
||||
|
||||
#else /* __STDC__ */
|
||||
char *demand_copy_C_string (int *len_pointer);
|
||||
char get_absolute_expression_and_terminator (long *val_pointer);
|
||||
long get_absolute_expression (void);
|
||||
void add_include_dir (char *path);
|
||||
void big_cons (int nbytes);
|
||||
void cons (unsigned int nbytes);
|
||||
void demand_empty_rest_of_line (void);
|
||||
void equals (char *sym_name);
|
||||
void float_cons (int float_type);
|
||||
void ignore_rest_of_line (void);
|
||||
void pseudo_set (symbolS * symbolP);
|
||||
void read_a_source_file (char *name);
|
||||
void read_begin (void);
|
||||
void s_abort (void);
|
||||
void s_align_bytes (int arg);
|
||||
void s_align_ptwo (void);
|
||||
void s_app_file (void);
|
||||
/* void s_bss(void); -- unneeded; always static when used */
|
||||
void s_comm (void);
|
||||
void s_data (void);
|
||||
void s_else (int arg);
|
||||
void s_end (int arg);
|
||||
void s_endif (int arg);
|
||||
void s_fill (void);
|
||||
void s_globl (void);
|
||||
void s_if (int arg);
|
||||
void s_ifdef (int arg);
|
||||
void s_ifeqs (int arg);
|
||||
void s_ignore (int arg);
|
||||
void s_include (int arg);
|
||||
void s_lcomm (int needs_align);
|
||||
void s_lsym (void);
|
||||
void s_org (void);
|
||||
void s_set (void);
|
||||
void s_space (int mult);
|
||||
void s_text (void);
|
||||
|
||||
char *demand_copy_C_string();
|
||||
char get_absolute_expression_and_terminator();
|
||||
long get_absolute_expression();
|
||||
void add_include_dir();
|
||||
void big_cons();
|
||||
void cons();
|
||||
void demand_empty_rest_of_line();
|
||||
void equals();
|
||||
void float_cons();
|
||||
void ignore_rest_of_line();
|
||||
void pseudo_set();
|
||||
void read_a_source_file();
|
||||
void read_begin();
|
||||
void s_abort();
|
||||
void s_align_bytes();
|
||||
void s_align_ptwo();
|
||||
void s_app_file();
|
||||
void s_comm();
|
||||
void s_data();
|
||||
void s_else();
|
||||
void s_end();
|
||||
void s_endif();
|
||||
void s_fill();
|
||||
void s_globl();
|
||||
void s_if();
|
||||
void s_ifdef();
|
||||
void s_ifeqs();
|
||||
void s_ignore();
|
||||
void s_include();
|
||||
void s_lcomm();
|
||||
void s_lsym();
|
||||
void s_org();
|
||||
void s_set();
|
||||
void s_space();
|
||||
void s_text();
|
||||
#else /* not __STDC__ */
|
||||
|
||||
#endif /* __STDC__ */
|
||||
char *demand_copy_C_string ();
|
||||
char get_absolute_expression_and_terminator ();
|
||||
long get_absolute_expression ();
|
||||
void add_include_dir ();
|
||||
void big_cons ();
|
||||
void cons ();
|
||||
void demand_empty_rest_of_line ();
|
||||
void equals ();
|
||||
void float_cons ();
|
||||
void ignore_rest_of_line ();
|
||||
void pseudo_set ();
|
||||
void read_a_source_file ();
|
||||
void read_begin ();
|
||||
void s_abort ();
|
||||
void s_align_bytes ();
|
||||
void s_align_ptwo ();
|
||||
void s_app_file ();
|
||||
/* void s_bss(); -- unneeded; always static when used */
|
||||
void s_comm ();
|
||||
void s_data ();
|
||||
void s_else ();
|
||||
void s_end ();
|
||||
void s_endif ();
|
||||
void s_fill ();
|
||||
void s_globl ();
|
||||
void s_if ();
|
||||
void s_ifdef ();
|
||||
void s_ifeqs ();
|
||||
void s_ignore ();
|
||||
void s_include ();
|
||||
void s_lcomm ();
|
||||
void s_lsym ();
|
||||
void s_org ();
|
||||
void s_set ();
|
||||
void s_space ();
|
||||
void s_text ();
|
||||
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
|
@ -49,13 +49,13 @@ extern char *sys_errlist[];
|
||||
|
||||
char *
|
||||
strerror (code)
|
||||
int code;
|
||||
int code;
|
||||
{
|
||||
return (((code < 0) || (code >= sys_nerr))
|
||||
return (((code < 0) || (code >= sys_nerr))
|
||||
? "(unknown error)"
|
||||
: sys_errlist [code]);
|
||||
: sys_errlist[code]);
|
||||
}
|
||||
|
||||
#endif /* HAVE_STRERROR */
|
||||
|
||||
/* end of strerror.c */
|
||||
/* end of strerror.c */
|
||||
|
38
gas/strstr.c
38
gas/strstr.c
@ -1,19 +1,19 @@
|
||||
/* strstr - find first occurrence of wanted in s
|
||||
|
||||
Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation.
|
||||
|
||||
|
||||
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. */
|
||||
@ -29,26 +29,26 @@
|
||||
#include <string.h>
|
||||
|
||||
char * /* found string, or NULL if none */
|
||||
strstr(s, wanted)
|
||||
char *s;
|
||||
char *wanted;
|
||||
strstr (s, wanted)
|
||||
char *s;
|
||||
char *wanted;
|
||||
{
|
||||
register char *scan;
|
||||
register SIZET len;
|
||||
register char firstc;
|
||||
|
||||
/*
|
||||
register char *scan;
|
||||
register SIZET len;
|
||||
register char firstc;
|
||||
|
||||
/*
|
||||
* The odd placement of the two tests is so "" is findable.
|
||||
* Also, we inline the first char for speed.
|
||||
* The ++ on scan has been moved down for optimization.
|
||||
*/
|
||||
firstc = *wanted;
|
||||
len = strlen(wanted);
|
||||
for (scan = s; *scan != firstc || strncmp(scan, wanted, len) != 0; )
|
||||
if (*scan++ == '\0')
|
||||
return(NULL);
|
||||
return(scan);
|
||||
} /* strstr() */
|
||||
firstc = *wanted;
|
||||
len = strlen (wanted);
|
||||
for (scan = s; *scan != firstc || strncmp (scan, wanted, len) != 0;)
|
||||
if (*scan++ == '\0')
|
||||
return (NULL);
|
||||
return (scan);
|
||||
} /* strstr() */
|
||||
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
|
@ -1,39 +1,42 @@
|
||||
/* struct_symbol.h - Internal symbol structure
|
||||
Copyright (C) 1987, 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.
|
||||
|
||||
|
||||
oYou 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. */
|
||||
|
||||
#ifndef __struc_symbol_h__
|
||||
#define __struc_symbol_h__
|
||||
|
||||
struct symbol /* our version of an nlist node */
|
||||
{
|
||||
obj_symbol_type sy_symbol; /* what we write in .o file (if permitted) */
|
||||
unsigned long sy_name_offset; /* 4-origin position of sy_name in symbols */
|
||||
/* part of object file. */
|
||||
/* 0 for (nameless) .stabd symbols. */
|
||||
/* Not used until write_object_file() time. */
|
||||
long sy_number; /* 24 bit symbol number. */
|
||||
/* Symbol numbers start at 0 and are */
|
||||
/* unsigned. */
|
||||
struct symbol *sy_next; /* forward chain, or NULL */
|
||||
obj_symbol_type sy_symbol; /* what we write in .o file (if permitted) */
|
||||
unsigned long sy_name_offset; /* 4-origin position of sy_name in symbols */
|
||||
/* part of object file. */
|
||||
/* 0 for (nameless) .stabd symbols. */
|
||||
/* Not used until write_object_file() time. */
|
||||
long sy_number; /* 24 bit symbol number. */
|
||||
/* Symbol numbers start at 0 and are */
|
||||
/* unsigned. */
|
||||
struct symbol *sy_next; /* forward chain, or NULL */
|
||||
#ifdef SYMBOLS_NEED_BACKPOINTERS
|
||||
struct symbol *sy_previous; /* backward chain, or NULL */
|
||||
struct symbol *sy_previous; /* backward chain, or NULL */
|
||||
#endif /* SYMBOLS_NEED_BACKPOINTERS */
|
||||
struct frag *sy_frag; /* NULL or -> frag this symbol attaches to. */
|
||||
struct symbol *sy_forward; /* value is really that of this other symbol */
|
||||
/* We will probably want to add a sy_segment here soon. */
|
||||
struct frag *sy_frag; /* NULL or -> frag this symbol attaches to. */
|
||||
struct symbol *sy_forward; /* value is really that of this other symbol */
|
||||
/* We will probably want to add a sy_segment here soon. */
|
||||
};
|
||||
|
||||
typedef struct symbol symbolS;
|
||||
@ -41,20 +44,21 @@ typedef struct symbol symbolS;
|
||||
typedef unsigned valueT; /* The type of n_value. Helps casting. */
|
||||
|
||||
#ifndef WORKING_DOT_WORD
|
||||
struct broken_word {
|
||||
struct broken_word *next_broken_word;/* One of these strucs per .word x-y */
|
||||
fragS *frag; /* Which frag its in */
|
||||
char *word_goes_here;/* Where in the frag it is */
|
||||
fragS *dispfrag; /* where to add the break */
|
||||
symbolS *add; /* symbol_x */
|
||||
symbolS *sub; /* - symbol_y */
|
||||
long addnum; /* + addnum */
|
||||
int added; /* nasty thing happend yet? */
|
||||
/* 1: added and has a long-jump */
|
||||
/* 2: added but uses someone elses long-jump */
|
||||
struct broken_word *use_jump; /* points to broken_word with a similar
|
||||
struct broken_word
|
||||
{
|
||||
struct broken_word *next_broken_word; /* One of these strucs per .word x-y */
|
||||
fragS *frag; /* Which frag its in */
|
||||
char *word_goes_here; /* Where in the frag it is */
|
||||
fragS *dispfrag; /* where to add the break */
|
||||
symbolS *add; /* symbol_x */
|
||||
symbolS *sub; /* - symbol_y */
|
||||
long addnum; /* + addnum */
|
||||
int added; /* nasty thing happend yet? */
|
||||
/* 1: added and has a long-jump */
|
||||
/* 2: added but uses someone elses long-jump */
|
||||
struct broken_word *use_jump; /* points to broken_word with a similar
|
||||
long-jump */
|
||||
};
|
||||
};
|
||||
extern struct broken_word *broken_words;
|
||||
#endif /* ndef WORKING_DOT_WORD */
|
||||
|
||||
@ -63,27 +67,27 @@ extern struct broken_word *broken_words;
|
||||
* This will change for infinite-segments support (e.g. COFF).
|
||||
*/
|
||||
/* #define SYMBOL_TYPE_TO_SEGMENT(symP) ( N_TYPE_seg [(int) (symP)->sy_type & N_TYPE] ) */
|
||||
extern segT N_TYPE_seg[]; /* subseg.c */
|
||||
extern segT N_TYPE_seg[]; /* subseg.c */
|
||||
|
||||
#define SEGMENT_TO_SYMBOL_TYPE(seg) ( seg_N_TYPE [(int) (seg)] )
|
||||
extern const short seg_N_TYPE[]; /* subseg.c */
|
||||
extern const short seg_N_TYPE[];/* subseg.c */
|
||||
|
||||
#define N_REGISTER 30 /* Fake N_TYPE value for SEG_REGISTER */
|
||||
|
||||
#ifdef SYMBOLS_NEED_BACKPOINTERS
|
||||
#if __STDC__ == 1
|
||||
|
||||
void symbol_clear_list_pointers(symbolS *symbolP);
|
||||
void symbol_insert(symbolS *addme, symbolS *target, symbolS **rootP, symbolS **lastP);
|
||||
void symbol_remove(symbolS *symbolP, symbolS **rootP, symbolS **lastP);
|
||||
void verify_symbol_chain(symbolS *rootP, symbolS *lastP);
|
||||
void symbol_clear_list_pointers (symbolS * symbolP);
|
||||
void symbol_insert (symbolS * addme, symbolS * target, symbolS ** rootP, symbolS ** lastP);
|
||||
void symbol_remove (symbolS * symbolP, symbolS ** rootP, symbolS ** lastP);
|
||||
void verify_symbol_chain (symbolS * rootP, symbolS * lastP);
|
||||
|
||||
#else /* not __STDC__ */
|
||||
|
||||
void symbol_clear_list_pointers();
|
||||
void symbol_insert();
|
||||
void symbol_remove();
|
||||
void verify_symbol_chain();
|
||||
void symbol_clear_list_pointers ();
|
||||
void symbol_insert ();
|
||||
void symbol_remove ();
|
||||
void verify_symbol_chain ();
|
||||
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
@ -96,13 +100,15 @@ void verify_symbol_chain();
|
||||
#endif /* SYMBOLS_NEED_BACKPOINTERS */
|
||||
|
||||
#if __STDC__ == 1
|
||||
void symbol_append(symbolS *addme, symbolS *target, symbolS **rootP, symbolS **lastP);
|
||||
void symbol_append (symbolS * addme, symbolS * target, symbolS ** rootP, symbolS ** lastP);
|
||||
#else /* not __STDC__ */
|
||||
void symbol_append();
|
||||
void symbol_append ();
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
#define symbol_next(s) ((s)->sy_next)
|
||||
|
||||
#endif /* __struc_symbol_h__ */
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* comment-column: 0
|
||||
|
1223
gas/symbols.c
1223
gas/symbols.c
File diff suppressed because it is too large
Load Diff
@ -1,71 +1,92 @@
|
||||
/* symbols.h -
|
||||
|
||||
Copyright (C) 1987, 1990, 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. */
|
||||
|
||||
/* $Id$ */
|
||||
extern struct obstack notes; /* eg FixS live here. */
|
||||
|
||||
extern struct obstack notes; /* eg FixS live here. */
|
||||
|
||||
extern struct obstack cond_obstack; /* this is where we track .ifdef/.endif
|
||||
extern struct obstack cond_obstack; /* this is where we track .ifdef/.endif
|
||||
(if we do that at all). */
|
||||
|
||||
extern unsigned int local_bss_counter; /* Zeroed before a pass. */
|
||||
extern unsigned int local_bss_counter; /* Zeroed before a pass. */
|
||||
/* Only used by .lcomm directive. */
|
||||
|
||||
extern symbolS * symbol_rootP; /* all the symbol nodes */
|
||||
extern symbolS * symbol_lastP; /* last struct symbol we made, or NULL */
|
||||
extern symbolS *symbol_rootP; /* all the symbol nodes */
|
||||
extern symbolS *symbol_lastP; /* last struct symbol we made, or NULL */
|
||||
|
||||
extern symbolS abs_symbol;
|
||||
extern symbolS abs_symbol;
|
||||
|
||||
extern symbolS* dot_text_symbol;
|
||||
extern symbolS* dot_data_symbol;
|
||||
extern symbolS* dot_bss_symbol;
|
||||
extern symbolS *dot_text_symbol;
|
||||
extern symbolS *dot_data_symbol;
|
||||
extern symbolS *dot_bss_symbol;
|
||||
|
||||
#if __STDC__ == 1
|
||||
|
||||
char *decode_local_label_name(char *s);
|
||||
char *local_label_name(int n, int augend);
|
||||
symbolS *symbol_find(char *name);
|
||||
symbolS *symbol_find_base(char *name, int strip_underscore);
|
||||
symbolS *symbol_find_or_make(char *name);
|
||||
symbolS *symbol_make(char *name);
|
||||
symbolS *symbol_new(char *name, segT segment, long value, fragS *frag);
|
||||
void colon(char *sym_name);
|
||||
void local_colon(int n);
|
||||
void symbol_begin(void);
|
||||
void symbol_table_insert(symbolS *symbolP);
|
||||
void verify_symbol_chain(symbolS *rootP, symbolS *lastP);
|
||||
char *decode_local_label_name (char *s);
|
||||
symbolS *symbol_find (char *name);
|
||||
symbolS *symbol_find_base (char *name, int strip_underscore);
|
||||
symbolS *symbol_find_or_make (char *name);
|
||||
symbolS *symbol_make (char *name);
|
||||
symbolS *symbol_new (char *name, segT segment, long value, fragS * frag);
|
||||
void colon (char *sym_name);
|
||||
void local_colon (int n);
|
||||
void symbol_begin (void);
|
||||
void symbol_table_insert (symbolS * symbolP);
|
||||
void verify_symbol_chain (symbolS * rootP, symbolS * lastP);
|
||||
|
||||
#ifdef LOCAL_LABELS_DOLLAR
|
||||
int dollar_label_defined (long l);
|
||||
void dollar_label_clear (void);
|
||||
void define_dollar_label (long l);
|
||||
char *dollar_label_name (long l, int augend);
|
||||
#endif /* LOCAL_LABELS_DOLLAR */
|
||||
|
||||
#ifdef LOCAL_LABELS_FB
|
||||
void fb_label_instance_inc (long label);
|
||||
char *fb_label_name (long n, long augend);
|
||||
#endif /* LOCAL_LABELS_FB */
|
||||
|
||||
#else /* not __STDC__ */
|
||||
|
||||
char *decode_local_label_name();
|
||||
char *local_label_name();
|
||||
symbolS *symbol_find();
|
||||
symbolS *symbol_find_base();
|
||||
symbolS *symbol_find_or_make();
|
||||
symbolS *symbol_make();
|
||||
symbolS *symbol_new();
|
||||
void colon();
|
||||
void local_colon();
|
||||
void symbol_begin();
|
||||
void symbol_table_insert();
|
||||
void verify_symbol_chain();
|
||||
char *decode_local_label_name ();
|
||||
char *fb_label_name ();
|
||||
symbolS *symbol_find ();
|
||||
symbolS *symbol_find_base ();
|
||||
symbolS *symbol_find_or_make ();
|
||||
symbolS *symbol_make ();
|
||||
symbolS *symbol_new ();
|
||||
void colon ();
|
||||
void local_colon ();
|
||||
void symbol_begin ();
|
||||
void symbol_table_insert ();
|
||||
void verify_symbol_chain ();
|
||||
|
||||
#ifdef LOCAL_LABELS_DOLLAR
|
||||
int dollar_label_defined ();
|
||||
void dollar_label_clear ();
|
||||
void define_dollar_label ();
|
||||
char *dollar_label_name ();
|
||||
#endif /* LOCAL_LABELS_DOLLAR */
|
||||
|
||||
#ifdef LOCAL_LABELS_FB
|
||||
void fb_label_instance_inc ();
|
||||
char *fb_label_name ();
|
||||
#endif /* LOCAL_LABELS_FB */
|
||||
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
|
103
gas/tc.h
103
gas/tc.h
@ -1,19 +1,19 @@
|
||||
/* tc.h -target cpu dependent- */
|
||||
/* tc.h - target cpu dependent
|
||||
|
||||
Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
/* Copyright (C) 1987, 1990, 1991 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. */
|
||||
@ -28,72 +28,73 @@ extern const pseudo_typeS md_pseudo_table[];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
long rlx_forward; /* Forward reach. Signed number. > 0. */
|
||||
long rlx_backward; /* Backward reach. Signed number. < 0. */
|
||||
unsigned char rlx_length; /* Bytes length of this address. */
|
||||
relax_substateT rlx_more; /* Next longer relax-state. */
|
||||
/* 0 means there is no 'next' relax-state. */
|
||||
long rlx_forward; /* Forward reach. Signed number. > 0. */
|
||||
long rlx_backward; /* Backward reach. Signed number. < 0. */
|
||||
unsigned char rlx_length; /* Bytes length of this address. */
|
||||
relax_substateT rlx_more; /* Next longer relax-state. */
|
||||
/* 0 means there is no 'next' relax-state. */
|
||||
}
|
||||
|
||||
relax_typeS;
|
||||
|
||||
extern const relax_typeS md_relax_table[]; /* Define it in MACHINE.c */
|
||||
extern const relax_typeS md_relax_table[]; /* Define it in MACHINE.c */
|
||||
|
||||
extern int md_reloc_size; /* Size of a relocation record */
|
||||
extern int md_reloc_size; /* Size of a relocation record */
|
||||
|
||||
extern void (*md_emit_relocations)();
|
||||
extern void (*md_emit_relocations) ();
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
|
||||
char *md_atof(int what_statement_type, char *literalP, int *sizeP);
|
||||
int md_estimate_size_before_relax(fragS *fragP, segT segment);
|
||||
int md_parse_option(char **argP, int *cntP, char ***vecP);
|
||||
long md_pcrel_from(fixS *fixP);
|
||||
long md_section_align(segT seg, long align);
|
||||
short tc_coff_fix2rtype(fixS *fixP);
|
||||
symbolS *md_undefined_symbol(char *name);
|
||||
void md_apply_fix(fixS *fixP, long val);
|
||||
void md_assemble(char *str);
|
||||
void md_begin(void);
|
||||
void md_convert_frag(object_headers *headers, fragS *fragP);
|
||||
void md_create_long_jump(char *ptr, long from_addr, long to_addr, fragS *frag, symbolS *to_symbol);
|
||||
void md_create_short_jump(char *ptr, long from_addr, long to_addr, fragS *frag, symbolS *to_symbol);
|
||||
void md_end(void);
|
||||
void md_number_to_chars(char *buf, long val, int n);
|
||||
void md_operand(expressionS *expressionP);
|
||||
char *md_atof (int what_statement_type, char *literalP, int *sizeP);
|
||||
int md_estimate_size_before_relax (fragS * fragP, segT segment);
|
||||
int md_parse_option (char **argP, int *cntP, char ***vecP);
|
||||
long md_pcrel_from (fixS * fixP);
|
||||
long md_section_align (segT seg, long align);
|
||||
short tc_coff_fix2rtype (fixS * fixP);
|
||||
symbolS *md_undefined_symbol (char *name);
|
||||
void md_apply_fix (fixS * fixP, long val);
|
||||
void md_assemble (char *str);
|
||||
void md_begin (void);
|
||||
void md_convert_frag (object_headers * headers, fragS * fragP);
|
||||
void md_create_long_jump (char *ptr, long from_addr, long to_addr, fragS * frag, symbolS * to_symbol);
|
||||
void md_create_short_jump (char *ptr, long from_addr, long to_addr, fragS * frag, symbolS * to_symbol);
|
||||
void md_end (void);
|
||||
void md_number_to_chars (char *buf, long val, int n);
|
||||
void md_operand (expressionS * expressionP);
|
||||
|
||||
#ifndef tc_crawl_symbol_chain
|
||||
void tc_crawl_symbol_chain(object_headers *headers);
|
||||
void tc_crawl_symbol_chain (object_headers * headers);
|
||||
#endif /* tc_crawl_symbol_chain */
|
||||
|
||||
#ifndef tc_headers_hook
|
||||
void tc_headers_hook(object_headers *headers);
|
||||
void tc_headers_hook (object_headers * headers);
|
||||
#endif /* tc_headers_hook */
|
||||
|
||||
#else
|
||||
|
||||
char *md_atof();
|
||||
int md_estimate_size_before_relax();
|
||||
int md_parse_option();
|
||||
long md_pcrel_from();
|
||||
long md_section_align();
|
||||
short tc_coff_fix2rtype();
|
||||
symbolS *md_undefined_symbol();
|
||||
void md_apply_fix();
|
||||
void md_assemble();
|
||||
void md_begin();
|
||||
void md_convert_frag();
|
||||
void md_create_long_jump();
|
||||
void md_create_short_jump();
|
||||
void md_end();
|
||||
void md_number_to_chars();
|
||||
void md_operand();
|
||||
char *md_atof ();
|
||||
int md_estimate_size_before_relax ();
|
||||
int md_parse_option ();
|
||||
long md_pcrel_from ();
|
||||
long md_section_align ();
|
||||
short tc_coff_fix2rtype ();
|
||||
symbolS *md_undefined_symbol ();
|
||||
void md_apply_fix ();
|
||||
void md_assemble ();
|
||||
void md_begin ();
|
||||
void md_convert_frag ();
|
||||
void md_create_long_jump ();
|
||||
void md_create_short_jump ();
|
||||
void md_end ();
|
||||
void md_number_to_chars ();
|
||||
void md_operand ();
|
||||
|
||||
#ifndef tc_headers_hook
|
||||
void tc_headers_hook();
|
||||
void tc_headers_hook ();
|
||||
#endif /* tc_headers_hook */
|
||||
|
||||
#ifndef tc_crawl_symbol_chain
|
||||
void tc_crawl_symbol_chain();
|
||||
void tc_crawl_symbol_chain ();
|
||||
#endif /* tc_crawl_symbol_chain */
|
||||
|
||||
#endif /* __STDC_ */
|
||||
|
@ -1,20 +1,21 @@
|
||||
/* DO NOT PUT COMMENTS ABOUT CHANGES IN THIS FILE.
|
||||
|
||||
|
||||
This file exists only to define `version_string'.
|
||||
|
||||
|
||||
Log changes in ChangeLog. The easiest way to do this is with
|
||||
the Emacs command `add-change-log-entry'. If you don't use Emacs,
|
||||
add entries of the form:
|
||||
|
||||
|
||||
Thu Jan 1 00:00:00 1970 Dennis Ritchie (dmr at alice)
|
||||
|
||||
|
||||
universe.c (temporal_reality): Began Time.
|
||||
*/
|
||||
|
||||
#ifdef VMS
|
||||
dummy3()
|
||||
dummy3 ()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if (__STDC__ == 1) || defined(const)
|
||||
|
1790
gas/write.c
1790
gas/write.c
File diff suppressed because it is too large
Load Diff
86
gas/write.h
86
gas/write.h
@ -1,19 +1,19 @@
|
||||
/* write.h
|
||||
|
||||
Copyright (C) 1987, 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. */
|
||||
@ -28,7 +28,7 @@
|
||||
#ifdef DOT_LABEL_PREFIX
|
||||
#define LOCAL_LABEL(name) (name[0] =='.' \
|
||||
&& ( name [1] == 'L' || name [1] == '.' ))
|
||||
#else /* not defined DOT_LABEL_PREFIX */
|
||||
#else /* not defined DOT_LABEL_PREFIX */
|
||||
#define LOCAL_LABEL(name) (name [0] == 'L' )
|
||||
#endif /* not defined DOT_LABEL_PREFIX */
|
||||
#endif /* LOCAL_LABEL */
|
||||
@ -41,28 +41,29 @@
|
||||
* FixSs may be built up in any order.
|
||||
*/
|
||||
|
||||
struct fix {
|
||||
fragS *fx_frag; /* Which frag? */
|
||||
long fx_where; /* Where is the 1st byte to fix up? */
|
||||
symbolS *fx_addsy; /* NULL or Symbol whose value we add in. */
|
||||
symbolS *fx_subsy; /* NULL or Symbol whose value we subtract. */
|
||||
long fx_offset; /* Absolute number we add in. */
|
||||
struct fix *fx_next; /* NULL or -> next fixS. */
|
||||
short int fx_size; /* How many bytes are involved? */
|
||||
char fx_pcrel; /* TRUE: pc-relative. */
|
||||
char fx_pcrel_adjust; /* pc-relative offset adjust */
|
||||
char fx_im_disp; /* TRUE: value is a displacement */
|
||||
bit_fixS *fx_bit_fixP; /* IF NULL no bitfix's to do */
|
||||
char fx_bsr; /* sequent-hack */
|
||||
struct fix
|
||||
{
|
||||
fragS *fx_frag; /* Which frag? */
|
||||
long fx_where; /* Where is the 1st byte to fix up? */
|
||||
symbolS *fx_addsy; /* NULL or Symbol whose value we add in. */
|
||||
symbolS *fx_subsy; /* NULL or Symbol whose value we subtract. */
|
||||
long fx_offset; /* Absolute number we add in. */
|
||||
struct fix *fx_next; /* NULL or -> next fixS. */
|
||||
short int fx_size; /* How many bytes are involved? */
|
||||
char fx_pcrel; /* TRUE: pc-relative. */
|
||||
char fx_pcrel_adjust; /* pc-relative offset adjust */
|
||||
char fx_im_disp; /* TRUE: value is a displacement */
|
||||
bit_fixS *fx_bit_fixP; /* IF NULL no bitfix's to do */
|
||||
char fx_bsr; /* sequent-hack */
|
||||
#if defined(TC_SPARC) || defined(TC_A29K) || defined(NEED_FX_R_TYPE)
|
||||
/* Hacks for machines where the type of reloc can't be
|
||||
/* Hacks for machines where the type of reloc can't be
|
||||
worked out by looking at how big it is */
|
||||
|
||||
int fx_r_type;
|
||||
int fx_r_type;
|
||||
#endif
|
||||
char fx_callj; /* TRUE if target is a 'callj' (used by i960) */
|
||||
long fx_addnumber;
|
||||
};
|
||||
char fx_callj; /* TRUE if target is a 'callj' (used by i960) */
|
||||
long fx_addnumber;
|
||||
};
|
||||
|
||||
typedef struct fix fixS;
|
||||
|
||||
@ -71,7 +72,7 @@ COMMON char *next_object_file_charP;
|
||||
#ifndef MANY_SEGMENTS
|
||||
COMMON fixS *text_fix_root, *text_fix_tail; /* Chains fixSs. */
|
||||
COMMON fixS *data_fix_root, *data_fix_tail; /* Chains fixSs. */
|
||||
COMMON fixS *bss_fix_root, *bss_fix_tail; /* Chains fixSs. */
|
||||
COMMON fixS *bss_fix_root, *bss_fix_tail; /* Chains fixSs. */
|
||||
#endif
|
||||
COMMON fixS **seg_fix_rootP, **seg_fix_tailP; /* -> one of above. */
|
||||
extern long string_byte_count;
|
||||
@ -79,30 +80,27 @@ extern int section_alignment[];
|
||||
|
||||
#if __STDC__ == 1
|
||||
|
||||
bit_fixS *bit_fix_new(int size, int offset, long base_type, long base_adj, long min, long max, long add);
|
||||
void append(char **charPP, char *fromP, unsigned long length);
|
||||
void record_alignment(segT seg, int align);
|
||||
void write_object_file(void);
|
||||
bit_fixS *bit_fix_new (int size, int offset, long base_type, long base_adj, long min, long max, long add);
|
||||
void append (char **charPP, char *fromP, unsigned long length);
|
||||
void record_alignment (segT seg, int align);
|
||||
void write_object_file (void);
|
||||
|
||||
fixS *fix_new(fragS *frag,
|
||||
int where,
|
||||
int size,
|
||||
symbolS *add_symbol,
|
||||
symbolS *sub_symbol,
|
||||
long offset,
|
||||
int pcrel
|
||||
#if defined(TC_SPARC) || defined(TC_A29K) || defined(NEED_FX_R_TYPE)
|
||||
, int r_type
|
||||
#endif
|
||||
);
|
||||
fixS *fix_new (fragS * frag,
|
||||
int where,
|
||||
int size,
|
||||
symbolS * add_symbol,
|
||||
symbolS * sub_symbol,
|
||||
long offset,
|
||||
int pcrel,
|
||||
int r_type);
|
||||
|
||||
#else /* not __STDC__ */
|
||||
|
||||
bit_fixS *bit_fix_new();
|
||||
fixS *fix_new();
|
||||
void append();
|
||||
void record_alignment();
|
||||
void write_object_file();
|
||||
bit_fixS *bit_fix_new ();
|
||||
fixS *fix_new ();
|
||||
void append ();
|
||||
void record_alignment ();
|
||||
void write_object_file ();
|
||||
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
/* xmalloc.c - get memory or bust
|
||||
|
||||
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. */
|
||||
@ -23,22 +23,22 @@
|
||||
xmalloc() - get memory or bust
|
||||
INDEX
|
||||
xmalloc() uses malloc()
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
char * my_memory;
|
||||
|
||||
|
||||
my_memory = xmalloc(42); / * my_memory gets address of 42 chars * /
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
|
||||
Use xmalloc() as an "error-free" malloc(). It does almost the same job.
|
||||
When it cannot honour your request for memory it BOMBS your program
|
||||
with a "virtual memory exceeded" message. Malloc() returns NULL and
|
||||
does not bomb your program.
|
||||
|
||||
|
||||
SEE ALSO
|
||||
malloc()
|
||||
|
||||
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
@ -48,23 +48,24 @@
|
||||
#ifdef USG
|
||||
#include <malloc.h>
|
||||
#else
|
||||
char * malloc();
|
||||
char *malloc ();
|
||||
#endif /* USG */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
#define error as_fatal
|
||||
|
||||
char * xmalloc(n)
|
||||
long n;
|
||||
char *
|
||||
xmalloc (n)
|
||||
long n;
|
||||
{
|
||||
char * retval;
|
||||
void error();
|
||||
|
||||
if ((retval = malloc ((unsigned)n)) == NULL)
|
||||
{
|
||||
error("virtual memory exceeded");
|
||||
}
|
||||
return (retval);
|
||||
char *retval;
|
||||
void error ();
|
||||
|
||||
if ((retval = malloc ((unsigned) n)) == NULL)
|
||||
{
|
||||
error ("virtual memory exceeded");
|
||||
}
|
||||
return (retval);
|
||||
}
|
||||
|
||||
/* end of xmalloc.c */
|
||||
|
@ -1,43 +1,43 @@
|
||||
/* xrealloc.c - new memory or bust
|
||||
|
||||
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. */
|
||||
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
|
||||
NAME
|
||||
xrealloc () - get more memory or bust
|
||||
INDEX
|
||||
xrealloc () uses realloc ()
|
||||
SYNOPSIS
|
||||
char *my_memory;
|
||||
|
||||
|
||||
my_memory = xrealloc (my_memory, 42);
|
||||
/ * my_memory gets (perhaps new) address of 42 chars * /
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
|
||||
Use xrealloc () as an "error-free" realloc ().It does almost the same
|
||||
job. When it cannot honour your request for memory it BOMBS your
|
||||
program with a "virtual memory exceeded" message. Realloc() returns
|
||||
NULL and does not bomb your program.
|
||||
|
||||
|
||||
SEE ALSO
|
||||
realloc ()
|
||||
*/
|
||||
@ -48,22 +48,22 @@
|
||||
#ifdef USG
|
||||
#include <malloc.h>
|
||||
#else
|
||||
char *realloc ();
|
||||
char *realloc ();
|
||||
#endif /* USG */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
#define error as_fatal
|
||||
|
||||
char *
|
||||
xrealloc (ptr, n)
|
||||
register char *ptr;
|
||||
long n;
|
||||
char *
|
||||
xrealloc (ptr, n)
|
||||
register char *ptr;
|
||||
long n;
|
||||
{
|
||||
void error();
|
||||
|
||||
if ((ptr = realloc (ptr, (unsigned)n)) == 0)
|
||||
error ("virtual memory exceeded");
|
||||
return (ptr);
|
||||
void error ();
|
||||
|
||||
if ((ptr = realloc (ptr, (unsigned) n)) == 0)
|
||||
error ("virtual memory exceeded");
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
/* end of xrealloc.c */
|
||||
|
Loading…
Reference in New Issue
Block a user