mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
Compare commits
19
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
172a0f0d16 | ||
|
|
0a7d464a50 | ||
|
|
d281aade56 | ||
|
|
3bc3e3e7a0 | ||
|
|
882a774068 | ||
|
|
629f6b0bf2 | ||
|
|
e1a24d8124 | ||
|
|
98fe3299b5 | ||
|
|
3536cebfe7 | ||
|
|
8059c08edf | ||
|
|
636e8b707b | ||
|
|
8d89ba84f2 | ||
|
|
360c01d3ff | ||
|
|
1518f96ea4 | ||
|
|
a52267f5d2 | ||
|
|
11d9599263 | ||
|
|
48d99c98a4 | ||
|
|
0b079fd92f | ||
|
|
842f308487 |
No files matched your search
@@ -1,11 +0,0 @@
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/6/93
|
||||
# $FreeBSD$
|
||||
|
||||
NOSHARED?=yes
|
||||
|
||||
PROG= chflags
|
||||
CFLAGS+=-Wall
|
||||
.PATH: ${.CURDIR}/../../lib/libc/gen
|
||||
SRCS= chflags.c setflags.c
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
@@ -1,138 +0,0 @@
|
||||
.\" Copyright (c) 1989, 1990, 1993, 1994
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
.\" This code is derived from software contributed to Berkeley by
|
||||
.\" the Institute of Electrical and Electronics Engineers, Inc.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by the University of
|
||||
.\" California, Berkeley and its contributors.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)chflags.1 8.4 (Berkeley) 5/2/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd May 2, 1995
|
||||
.Dt CHFLAGS 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm chflags
|
||||
.Nd change file flags
|
||||
.Sh SYNOPSIS
|
||||
.Nm chflags
|
||||
.Oo
|
||||
.Fl R
|
||||
.Op Fl H | Fl L | Fl P
|
||||
.Oc
|
||||
.Ar flags
|
||||
.Ar
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility modifies the file flags of the listed files
|
||||
as specified by the
|
||||
.Ar flags
|
||||
operand.
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width indent
|
||||
.It Fl H
|
||||
If the
|
||||
.Fl R
|
||||
option is specified, symbolic links on the command line are followed.
|
||||
(Symbolic links encountered in the tree traversal are not followed.)
|
||||
.It Fl L
|
||||
If the
|
||||
.Fl R
|
||||
option is specified, all symbolic links are followed.
|
||||
.It Fl P
|
||||
If the
|
||||
.Fl R
|
||||
option is specified, no symbolic links are followed.
|
||||
.It Fl R
|
||||
Change the file flags for the file hierarchies rooted
|
||||
in the files instead of just the files themselves.
|
||||
.El
|
||||
.Pp
|
||||
Flags are a comma separated list of keywords.
|
||||
The following keywords are currently defined:
|
||||
.Bd -literal -offset indent compact
|
||||
arch set the archived flag (super-user only)
|
||||
opaque set the opaque flag (owner or super-user only)
|
||||
nodump set the nodump flag (owner or super-user only)
|
||||
sappnd set the system append-only flag (super-user only)
|
||||
schg set the system immutable flag (super-user only)
|
||||
sunlnk set the system undeletable flag (super-user only)
|
||||
uappnd set the user append-only flag (owner or super-user only)
|
||||
uchg set the user immutable flag (owner or super-user only)
|
||||
uunlnk set the user undeletable flag (owner or super-user only)
|
||||
archived, sappend, schange, simmutable, uappend, uchange, uimmutable,
|
||||
sunlink, uunlink
|
||||
aliases for the above
|
||||
.Ed
|
||||
.Pp
|
||||
Putting the letters
|
||||
.Dq no
|
||||
before an option causes the flag to be turned off.
|
||||
For example:
|
||||
.Bd -literal -offset indent compact
|
||||
nouchg the immutable bit should be cleared
|
||||
.Ed
|
||||
.Pp
|
||||
Symbolic links do not have flags, so unless the
|
||||
.Fl H
|
||||
or
|
||||
.Fl L
|
||||
option is set,
|
||||
.Nm
|
||||
on a symbolic link always succeeds and has no effect.
|
||||
The
|
||||
.Fl H ,
|
||||
.Fl L
|
||||
and
|
||||
.Fl P
|
||||
options are ignored unless the
|
||||
.Fl R
|
||||
option is specified.
|
||||
In addition, these options override each other and the
|
||||
command's actions are determined by the last one specified.
|
||||
.Pp
|
||||
You can use "ls -lo" to see the flags of existing files.
|
||||
.Sh DIAGNOSTICS
|
||||
The
|
||||
.Nm
|
||||
utility exits 0 on success, and >0 if an error occurs.
|
||||
.Sh SEE ALSO
|
||||
.Xr ls 1 ,
|
||||
.Xr chflags 2 ,
|
||||
.Xr stat 2 ,
|
||||
.Xr fts 3 ,
|
||||
.Xr symlink 7
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
command first appeared in
|
||||
.Bx 4.4 .
|
||||
@@ -1,185 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char copyright[] =
|
||||
"@(#) Copyright (c) 1992, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)chflags.c 8.5 (Berkeley) 4/1/94";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fts.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
extern u_long setflags __P((char **, u_long *, u_long *));
|
||||
|
||||
void usage __P((void));
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
FTS *ftsp;
|
||||
FTSENT *p;
|
||||
u_long clear, set;
|
||||
long val;
|
||||
int Hflag, Lflag, Pflag, Rflag, ch, fts_options, oct, rval;
|
||||
char *flags, *ep;
|
||||
|
||||
Hflag = Lflag = Pflag = Rflag = 0;
|
||||
while ((ch = getopt(argc, argv, "HLPR")) != -1)
|
||||
switch (ch) {
|
||||
case 'H':
|
||||
Hflag = 1;
|
||||
Lflag = Pflag = 0;
|
||||
break;
|
||||
case 'L':
|
||||
Lflag = 1;
|
||||
Hflag = Pflag = 0;
|
||||
break;
|
||||
case 'P':
|
||||
Pflag = 1;
|
||||
Hflag = Lflag = 0;
|
||||
break;
|
||||
case 'R':
|
||||
Rflag = 1;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
if (argc < 2)
|
||||
usage();
|
||||
|
||||
fts_options = FTS_PHYSICAL;
|
||||
if (Rflag) {
|
||||
if (Hflag)
|
||||
fts_options |= FTS_COMFOLLOW;
|
||||
if (Lflag) {
|
||||
fts_options &= ~FTS_PHYSICAL;
|
||||
fts_options |= FTS_LOGICAL;
|
||||
}
|
||||
}
|
||||
|
||||
flags = *argv;
|
||||
if (*flags >= '0' && *flags <= '7') {
|
||||
errno = 0;
|
||||
val = strtol(flags, &ep, 8);
|
||||
if (val < 0)
|
||||
errno = ERANGE;
|
||||
if (errno)
|
||||
err(1, "invalid flags: %s", flags);
|
||||
if (*ep)
|
||||
errx(1, "invalid flags: %s", flags);
|
||||
set = val;
|
||||
oct = 1;
|
||||
} else {
|
||||
if (setflags(&flags, &set, &clear))
|
||||
errx(1, "invalid flag: %s", flags);
|
||||
clear = ~clear;
|
||||
oct = 0;
|
||||
}
|
||||
|
||||
if ((ftsp = fts_open(++argv, fts_options , 0)) == NULL)
|
||||
err(1, NULL);
|
||||
|
||||
for (rval = 0; (p = fts_read(ftsp)) != NULL;) {
|
||||
switch (p->fts_info) {
|
||||
case FTS_D:
|
||||
if (Rflag) /* Change it at FTS_DP. */
|
||||
continue;
|
||||
fts_set(ftsp, p, FTS_SKIP);
|
||||
break;
|
||||
case FTS_DNR: /* Warn, chflag, continue. */
|
||||
warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
|
||||
rval = 1;
|
||||
break;
|
||||
case FTS_ERR: /* Warn, continue. */
|
||||
case FTS_NS:
|
||||
warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
|
||||
rval = 1;
|
||||
continue;
|
||||
case FTS_SL: /* Ignore. */
|
||||
case FTS_SLNONE:
|
||||
/*
|
||||
* The only symlinks that end up here are ones that
|
||||
* don't point to anything and ones that we found
|
||||
* doing a physical walk.
|
||||
*/
|
||||
continue;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (oct) {
|
||||
if (!chflags(p->fts_accpath, set))
|
||||
continue;
|
||||
} else {
|
||||
p->fts_statp->st_flags |= set;
|
||||
p->fts_statp->st_flags &= clear;
|
||||
if (!chflags(p->fts_accpath, p->fts_statp->st_flags))
|
||||
continue;
|
||||
}
|
||||
warn("%s", p->fts_path);
|
||||
rval = 1;
|
||||
}
|
||||
if (errno)
|
||||
err(1, "fts_read");
|
||||
exit(rval);
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: chflags [-R [-H | -L | -P]] flags file ...\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
2.8.1
|
||||
@@ -1,585 +0,0 @@
|
||||
@section @code{typedef bfd}
|
||||
A BFD has type @code{bfd}; objects of this type are the
|
||||
cornerstone of any application using BFD. Using BFD
|
||||
consists of making references though the BFD and to data in the BFD.
|
||||
|
||||
Here is the structure that defines the type @code{bfd}. It
|
||||
contains the major data about the file and pointers
|
||||
to the rest of the data.
|
||||
@*
|
||||
.
|
||||
@example
|
||||
struct _bfd
|
||||
@{
|
||||
/* The filename the application opened the BFD with. */
|
||||
CONST char *filename;
|
||||
|
||||
/* A pointer to the target jump table. */
|
||||
const struct bfd_target *xvec;
|
||||
|
||||
/* To avoid dragging too many header files into every file that
|
||||
includes `@code{bfd.h}', IOSTREAM has been declared as a "char
|
||||
*", and MTIME as a "long". Their correct types, to which they
|
||||
are cast when used, are "FILE *" and "time_t". The iostream
|
||||
is the result of an fopen on the filename. However, if the
|
||||
BFD_IN_MEMORY flag is set, then iostream is actually a pointer
|
||||
to a bfd_in_memory struct. */
|
||||
PTR iostream;
|
||||
|
||||
/* Is the file descriptor being cached? That is, can it be closed as
|
||||
needed, and re-opened when accessed later? */
|
||||
|
||||
boolean cacheable;
|
||||
|
||||
/* Marks whether there was a default target specified when the
|
||||
BFD was opened. This is used to select which matching algorithm
|
||||
to use to choose the back end. */
|
||||
|
||||
boolean target_defaulted;
|
||||
|
||||
/* The caching routines use these to maintain a
|
||||
least-recently-used list of BFDs */
|
||||
|
||||
struct _bfd *lru_prev, *lru_next;
|
||||
|
||||
/* When a file is closed by the caching routines, BFD retains
|
||||
state information on the file here: */
|
||||
|
||||
file_ptr where;
|
||||
|
||||
/* and here: (``once'' means at least once) */
|
||||
|
||||
boolean opened_once;
|
||||
|
||||
/* Set if we have a locally maintained mtime value, rather than
|
||||
getting it from the file each time: */
|
||||
|
||||
boolean mtime_set;
|
||||
|
||||
/* File modified time, if mtime_set is true: */
|
||||
|
||||
long mtime;
|
||||
|
||||
/* Reserved for an unimplemented file locking extension.*/
|
||||
|
||||
int ifd;
|
||||
|
||||
/* The format which belongs to the BFD. (object, core, etc.) */
|
||||
|
||||
bfd_format format;
|
||||
|
||||
/* The direction the BFD was opened with*/
|
||||
|
||||
enum bfd_direction @{no_direction = 0,
|
||||
read_direction = 1,
|
||||
write_direction = 2,
|
||||
both_direction = 3@} direction;
|
||||
|
||||
/* Format_specific flags*/
|
||||
|
||||
flagword flags;
|
||||
|
||||
/* Currently my_archive is tested before adding origin to
|
||||
anything. I believe that this can become always an add of
|
||||
origin, with origin set to 0 for non archive files. */
|
||||
|
||||
file_ptr origin;
|
||||
|
||||
/* Remember when output has begun, to stop strange things
|
||||
from happening. */
|
||||
boolean output_has_begun;
|
||||
|
||||
/* Pointer to linked list of sections*/
|
||||
struct sec *sections;
|
||||
|
||||
/* The number of sections */
|
||||
unsigned int section_count;
|
||||
|
||||
/* Stuff only useful for object files:
|
||||
The start address. */
|
||||
bfd_vma start_address;
|
||||
|
||||
/* Used for input and output*/
|
||||
unsigned int symcount;
|
||||
|
||||
/* Symbol table for output BFD (with symcount entries) */
|
||||
struct symbol_cache_entry **outsymbols;
|
||||
|
||||
/* Pointer to structure which contains architecture information*/
|
||||
const struct bfd_arch_info *arch_info;
|
||||
|
||||
/* Stuff only useful for archives:*/
|
||||
PTR arelt_data;
|
||||
struct _bfd *my_archive; /* The containing archive BFD. */
|
||||
struct _bfd *next; /* The next BFD in the archive. */
|
||||
struct _bfd *archive_head; /* The first BFD in the archive. */
|
||||
boolean has_armap;
|
||||
|
||||
/* A chain of BFD structures involved in a link. */
|
||||
struct _bfd *link_next;
|
||||
|
||||
/* A field used by _bfd_generic_link_add_archive_symbols. This will
|
||||
be used only for archive elements. */
|
||||
int archive_pass;
|
||||
|
||||
/* Used by the back end to hold private data. */
|
||||
|
||||
union
|
||||
@{
|
||||
struct aout_data_struct *aout_data;
|
||||
struct artdata *aout_ar_data;
|
||||
struct _oasys_data *oasys_obj_data;
|
||||
struct _oasys_ar_data *oasys_ar_data;
|
||||
struct coff_tdata *coff_obj_data;
|
||||
struct pe_tdata *pe_obj_data;
|
||||
struct xcoff_tdata *xcoff_obj_data;
|
||||
struct ecoff_tdata *ecoff_obj_data;
|
||||
struct ieee_data_struct *ieee_data;
|
||||
struct ieee_ar_data_struct *ieee_ar_data;
|
||||
struct srec_data_struct *srec_data;
|
||||
struct ihex_data_struct *ihex_data;
|
||||
struct tekhex_data_struct *tekhex_data;
|
||||
struct elf_obj_tdata *elf_obj_data;
|
||||
struct nlm_obj_tdata *nlm_obj_data;
|
||||
struct bout_data_struct *bout_data;
|
||||
struct sun_core_struct *sun_core_data;
|
||||
struct trad_core_struct *trad_core_data;
|
||||
struct som_data_struct *som_data;
|
||||
struct hpux_core_struct *hpux_core_data;
|
||||
struct hppabsd_core_struct *hppabsd_core_data;
|
||||
struct sgi_core_struct *sgi_core_data;
|
||||
struct lynx_core_struct *lynx_core_data;
|
||||
struct osf_core_struct *osf_core_data;
|
||||
struct cisco_core_struct *cisco_core_data;
|
||||
struct versados_data_struct *versados_data;
|
||||
struct netbsd_core_struct *netbsd_core_data;
|
||||
PTR any;
|
||||
@} tdata;
|
||||
|
||||
/* Used by the application to hold private data*/
|
||||
PTR usrdata;
|
||||
|
||||
/* Where all the allocated stuff under this BFD goes. This is a
|
||||
struct objalloc *, but we use PTR to avoid requiring the inclusion of
|
||||
objalloc.h. */
|
||||
PTR memory;
|
||||
@};
|
||||
|
||||
@end example
|
||||
@section Error reporting
|
||||
Most BFD functions return nonzero on success (check their
|
||||
individual documentation for precise semantics). On an error,
|
||||
they call @code{bfd_set_error} to set an error condition that callers
|
||||
can check by calling @code{bfd_get_error}.
|
||||
If that returns @code{bfd_error_system_call}, then check
|
||||
@code{errno}.
|
||||
|
||||
The easiest way to report a BFD error to the user is to
|
||||
use @code{bfd_perror}.
|
||||
@*
|
||||
@subsection Type @code{bfd_error_type}
|
||||
The values returned by @code{bfd_get_error} are defined by the
|
||||
enumerated type @code{bfd_error_type}.
|
||||
@*
|
||||
.
|
||||
@example
|
||||
typedef enum bfd_error
|
||||
@{
|
||||
bfd_error_no_error = 0,
|
||||
bfd_error_system_call,
|
||||
bfd_error_invalid_target,
|
||||
bfd_error_wrong_format,
|
||||
bfd_error_invalid_operation,
|
||||
bfd_error_no_memory,
|
||||
bfd_error_no_symbols,
|
||||
bfd_error_no_armap,
|
||||
bfd_error_no_more_archived_files,
|
||||
bfd_error_malformed_archive,
|
||||
bfd_error_file_not_recognized,
|
||||
bfd_error_file_ambiguously_recognized,
|
||||
bfd_error_no_contents,
|
||||
bfd_error_nonrepresentable_section,
|
||||
bfd_error_no_debug_section,
|
||||
bfd_error_bad_value,
|
||||
bfd_error_file_truncated,
|
||||
bfd_error_file_too_big,
|
||||
bfd_error_invalid_error_code
|
||||
@} bfd_error_type;
|
||||
|
||||
@end example
|
||||
@findex bfd_get_error
|
||||
@subsubsection @code{bfd_get_error}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
bfd_error_type bfd_get_error (void);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the current BFD error condition.
|
||||
@*
|
||||
@findex bfd_set_error
|
||||
@subsubsection @code{bfd_set_error}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void bfd_set_error (bfd_error_type error_tag);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the BFD error condition to be @var{error_tag}.
|
||||
@*
|
||||
@findex bfd_errmsg
|
||||
@subsubsection @code{bfd_errmsg}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
CONST char *bfd_errmsg (bfd_error_type error_tag);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return a string describing the error @var{error_tag}, or
|
||||
the system error if @var{error_tag} is @code{bfd_error_system_call}.
|
||||
@*
|
||||
@findex bfd_perror
|
||||
@subsubsection @code{bfd_perror}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void bfd_perror (CONST char *message);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Print to the standard error stream a string describing the
|
||||
last BFD error that occurred, or the last system error if
|
||||
the last BFD error was a system call failure. If @var{message}
|
||||
is non-NULL and non-empty, the error string printed is preceded
|
||||
by @var{message}, a colon, and a space. It is followed by a newline.
|
||||
@*
|
||||
@subsection BFD error handler
|
||||
Some BFD functions want to print messages describing the
|
||||
problem. They call a BFD error handler function. This
|
||||
function may be overriden by the program.
|
||||
|
||||
The BFD error handler acts like printf.
|
||||
@*
|
||||
.
|
||||
@example
|
||||
typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
|
||||
|
||||
@end example
|
||||
@findex bfd_set_error_handler
|
||||
@subsubsection @code{bfd_set_error_handler}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the BFD error handler function. Returns the previous
|
||||
function.
|
||||
@*
|
||||
@findex bfd_set_error_program_name
|
||||
@subsubsection @code{bfd_set_error_program_name}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void bfd_set_error_program_name (const char *);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the program name to use when printing a BFD error. This
|
||||
is printed before the error message followed by a colon and
|
||||
space. The string must not be changed after it is passed to
|
||||
this function.
|
||||
@*
|
||||
@section Symbols
|
||||
|
||||
@*
|
||||
@findex bfd_get_reloc_upper_bound
|
||||
@subsubsection @code{bfd_get_reloc_upper_bound}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
long bfd_get_reloc_upper_bound(bfd *abfd, asection *sect);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the number of bytes required to store the
|
||||
relocation information associated with section @var{sect}
|
||||
attached to bfd @var{abfd}. If an error occurs, return -1.
|
||||
@*
|
||||
@findex bfd_canonicalize_reloc
|
||||
@subsubsection @code{bfd_canonicalize_reloc}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
long bfd_canonicalize_reloc
|
||||
(bfd *abfd,
|
||||
asection *sec,
|
||||
arelent **loc,
|
||||
asymbol **syms);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Call the back end associated with the open BFD
|
||||
@var{abfd} and translate the external form of the relocation
|
||||
information attached to @var{sec} into the internal canonical
|
||||
form. Place the table into memory at @var{loc}, which has
|
||||
been preallocated, usually by a call to
|
||||
@code{bfd_get_reloc_upper_bound}. Returns the number of relocs, or
|
||||
-1 on error.
|
||||
|
||||
The @var{syms} table is also needed for horrible internal magic
|
||||
reasons.
|
||||
@*
|
||||
@findex bfd_set_reloc
|
||||
@subsubsection @code{bfd_set_reloc}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void bfd_set_reloc
|
||||
(bfd *abfd, asection *sec, arelent **rel, unsigned int count)
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the relocation pointer and count within
|
||||
section @var{sec} to the values @var{rel} and @var{count}.
|
||||
The argument @var{abfd} is ignored.
|
||||
@*
|
||||
@findex bfd_set_file_flags
|
||||
@subsubsection @code{bfd_set_file_flags}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_set_file_flags(bfd *abfd, flagword flags);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the flag word in the BFD @var{abfd} to the value @var{flags}.
|
||||
|
||||
Possible errors are:
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_error_wrong_format} - The target bfd was not of object format.
|
||||
@item
|
||||
@code{bfd_error_invalid_operation} - The target bfd was open for reading.
|
||||
@item
|
||||
@code{bfd_error_invalid_operation} -
|
||||
The flag word contained a bit which was not applicable to the
|
||||
type of file. E.g., an attempt was made to set the @code{D_PAGED} bit
|
||||
on a BFD format which does not support demand paging.
|
||||
@end itemize
|
||||
@*
|
||||
@findex bfd_set_start_address
|
||||
@subsubsection @code{bfd_set_start_address}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_set_start_address(bfd *abfd, bfd_vma vma);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Make @var{vma} the entry point of output BFD @var{abfd}.
|
||||
@*
|
||||
@strong{Returns}@*
|
||||
Returns @code{true} on success, @code{false} otherwise.
|
||||
@*
|
||||
@findex bfd_get_mtime
|
||||
@subsubsection @code{bfd_get_mtime}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
long bfd_get_mtime(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the file modification time (as read from the file system, or
|
||||
from the archive header for archive members).
|
||||
@*
|
||||
@findex bfd_get_size
|
||||
@subsubsection @code{bfd_get_size}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
long bfd_get_size(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the file size (as read from file system) for the file
|
||||
associated with BFD @var{abfd}.
|
||||
|
||||
The initial motivation for, and use of, this routine is not
|
||||
so we can get the exact size of the object the BFD applies to, since
|
||||
that might not be generally possible (archive members for example).
|
||||
It would be ideal if someone could eventually modify
|
||||
it so that such results were guaranteed.
|
||||
|
||||
Instead, we want to ask questions like "is this NNN byte sized
|
||||
object I'm about to try read from file offset YYY reasonable?"
|
||||
As as example of where we might do this, some object formats
|
||||
use string tables for which the first @code{sizeof(long)} bytes of the
|
||||
table contain the size of the table itself, including the size bytes.
|
||||
If an application tries to read what it thinks is one of these
|
||||
string tables, without some way to validate the size, and for
|
||||
some reason the size is wrong (byte swapping error, wrong location
|
||||
for the string table, etc.), the only clue is likely to be a read
|
||||
error when it tries to read the table, or a "virtual memory
|
||||
exhausted" error when it tries to allocate 15 bazillon bytes
|
||||
of space for the 15 bazillon byte table it is about to read.
|
||||
This function at least allows us to answer the quesion, "is the
|
||||
size reasonable?".
|
||||
@*
|
||||
@findex bfd_get_gp_size
|
||||
@subsubsection @code{bfd_get_gp_size}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
int bfd_get_gp_size(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the maximum size of objects to be optimized using the GP
|
||||
register under MIPS ECOFF. This is typically set by the @code{-G}
|
||||
argument to the compiler, assembler or linker.
|
||||
@*
|
||||
@findex bfd_set_gp_size
|
||||
@subsubsection @code{bfd_set_gp_size}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void bfd_set_gp_size(bfd *abfd, int i);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the maximum size of objects to be optimized using the GP
|
||||
register under ECOFF or MIPS ELF. This is typically set by
|
||||
the @code{-G} argument to the compiler, assembler or linker.
|
||||
@*
|
||||
@findex bfd_scan_vma
|
||||
@subsubsection @code{bfd_scan_vma}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
bfd_vma bfd_scan_vma(CONST char *string, CONST char **end, int base);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Convert, like @code{strtoul}, a numerical expression
|
||||
@var{string} into a @code{bfd_vma} integer, and return that integer.
|
||||
(Though without as many bells and whistles as @code{strtoul}.)
|
||||
The expression is assumed to be unsigned (i.e., positive).
|
||||
If given a @var{base}, it is used as the base for conversion.
|
||||
A base of 0 causes the function to interpret the string
|
||||
in hex if a leading "0x" or "0X" is found, otherwise
|
||||
in octal if a leading zero is found, otherwise in decimal.
|
||||
|
||||
Overflow is not detected.
|
||||
@*
|
||||
@findex bfd_copy_private_bfd_data
|
||||
@subsubsection @code{bfd_copy_private_bfd_data}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Copy private BFD information from the BFD @var{ibfd} to the
|
||||
the BFD @var{obfd}. Return @code{true} on success, @code{false} on error.
|
||||
Possible error returns are:
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_error_no_memory} -
|
||||
Not enough memory exists to create private data for @var{obfd}.
|
||||
@end itemize
|
||||
@example
|
||||
#define bfd_copy_private_bfd_data(ibfd, obfd) \
|
||||
BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
|
||||
(ibfd, obfd))
|
||||
@end example
|
||||
@*
|
||||
@findex bfd_merge_private_bfd_data
|
||||
@subsubsection @code{bfd_merge_private_bfd_data}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_merge_private_bfd_data(bfd *ibfd, bfd *obfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Merge private BFD information from the BFD @var{ibfd} to the
|
||||
the output file BFD @var{obfd} when linking. Return @code{true}
|
||||
on success, @code{false} on error. Possible error returns are:
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_error_no_memory} -
|
||||
Not enough memory exists to create private data for @var{obfd}.
|
||||
@end itemize
|
||||
@example
|
||||
#define bfd_merge_private_bfd_data(ibfd, obfd) \
|
||||
BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
|
||||
(ibfd, obfd))
|
||||
@end example
|
||||
@*
|
||||
@findex bfd_set_private_flags
|
||||
@subsubsection @code{bfd_set_private_flags}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_set_private_flags(bfd *abfd, flagword flags);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set private BFD flag information in the BFD @var{abfd}.
|
||||
Return @code{true} on success, @code{false} on error. Possible error
|
||||
returns are:
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_error_no_memory} -
|
||||
Not enough memory exists to create private data for @var{obfd}.
|
||||
@end itemize
|
||||
@example
|
||||
#define bfd_set_private_flags(abfd, flags) \
|
||||
BFD_SEND (abfd, _bfd_set_private_flags, \
|
||||
(abfd, flags))
|
||||
@end example
|
||||
@*
|
||||
@findex stuff
|
||||
@subsubsection @code{stuff}
|
||||
@strong{Description}@*
|
||||
Stuff which should be documented:
|
||||
@example
|
||||
#define bfd_sizeof_headers(abfd, reloc) \
|
||||
BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
|
||||
|
||||
#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
|
||||
BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, sec, syms, off, file, func, line))
|
||||
|
||||
/* Do these three do anything useful at all, for any back end? */
|
||||
#define bfd_debug_info_start(abfd) \
|
||||
BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
|
||||
|
||||
#define bfd_debug_info_end(abfd) \
|
||||
BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
|
||||
|
||||
#define bfd_debug_info_accumulate(abfd, section) \
|
||||
BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
|
||||
|
||||
|
||||
#define bfd_stat_arch_elt(abfd, stat) \
|
||||
BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
|
||||
|
||||
#define bfd_update_armap_timestamp(abfd) \
|
||||
BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
|
||||
|
||||
#define bfd_set_arch_mach(abfd, arch, mach)\
|
||||
BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
|
||||
|
||||
#define bfd_relax_section(abfd, section, link_info, again) \
|
||||
BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
|
||||
|
||||
#define bfd_link_hash_table_create(abfd) \
|
||||
BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
|
||||
|
||||
#define bfd_link_add_symbols(abfd, info) \
|
||||
BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
|
||||
|
||||
#define bfd_final_link(abfd, info) \
|
||||
BFD_SEND (abfd, _bfd_final_link, (abfd, info))
|
||||
|
||||
#define bfd_free_cached_info(abfd) \
|
||||
BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
|
||||
|
||||
#define bfd_get_dynamic_symtab_upper_bound(abfd) \
|
||||
BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
|
||||
|
||||
#define bfd_print_private_bfd_data(abfd, file)\
|
||||
BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
|
||||
|
||||
#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
|
||||
BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
|
||||
|
||||
#define bfd_get_dynamic_reloc_upper_bound(abfd) \
|
||||
BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
|
||||
|
||||
#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
|
||||
BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
|
||||
|
||||
extern bfd_byte *bfd_get_relocated_section_contents
|
||||
PARAMS ((bfd *, struct bfd_link_info *,
|
||||
struct bfd_link_order *, bfd_byte *,
|
||||
boolean, asymbol **));
|
||||
|
||||
@end example
|
||||
@*
|
||||
@@ -1,127 +0,0 @@
|
||||
/* conf.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if using alloca.c. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
|
||||
This function is required for alloca.c support on those systems. */
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define as __inline if that's what the C compiler calls it. */
|
||||
#undef inline
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown
|
||||
*/
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Should gas use high-level BFD interfaces? */
|
||||
#undef BFD_ASSEMBLER
|
||||
|
||||
/* Some assert/preprocessor combinations are incapable of handling
|
||||
certain kinds of constructs in the argument of assert. For example,
|
||||
quoted strings (if requoting isn't done right) or newlines. */
|
||||
#undef BROKEN_ASSERT
|
||||
|
||||
/* If we aren't doing cross-assembling, some operations can be optimized,
|
||||
since byte orders and value sizes don't need to be adjusted. */
|
||||
#undef CROSS_COMPILE
|
||||
|
||||
/* Some gas code wants to know these parameters. */
|
||||
#undef TARGET_ALIAS
|
||||
#undef TARGET_CPU
|
||||
#undef TARGET_CANONICAL
|
||||
#undef TARGET_OS
|
||||
#undef TARGET_VENDOR
|
||||
|
||||
/* Sometimes the system header files don't declare strstr. */
|
||||
#undef NEED_DECLARATION_STRSTR
|
||||
|
||||
/* Sometimes the system header files don't declare malloc and realloc. */
|
||||
#undef NEED_DECLARATION_MALLOC
|
||||
|
||||
/* Sometimes the system header files don't declare free. */
|
||||
#undef NEED_DECLARATION_FREE
|
||||
|
||||
/* Sometimes the system header files don't declare sbrk. */
|
||||
#undef NEED_DECLARATION_SBRK
|
||||
|
||||
/* Sometimes errno.h doesn't declare errno itself. */
|
||||
#undef NEED_DECLARATION_ERRNO
|
||||
|
||||
#undef MANY_SEGMENTS
|
||||
|
||||
/* Needed only for sparc configuration. */
|
||||
#undef SPARC_V9
|
||||
#undef SPARC_ARCH64
|
||||
|
||||
/* Defined if using CGEN. */
|
||||
#undef USING_CGEN
|
||||
|
||||
/* Needed only for some configurations that can produce multiple output
|
||||
formats. */
|
||||
#undef DEFAULT_EMULATION
|
||||
#undef EMULATIONS
|
||||
#undef USE_EMULATIONS
|
||||
#undef OBJ_MAYBE_AOUT
|
||||
#undef OBJ_MAYBE_BOUT
|
||||
#undef OBJ_MAYBE_COFF
|
||||
#undef OBJ_MAYBE_ECOFF
|
||||
#undef OBJ_MAYBE_ELF
|
||||
#undef OBJ_MAYBE_GENERIC
|
||||
#undef OBJ_MAYBE_HP300
|
||||
#undef OBJ_MAYBE_IEEE
|
||||
#undef OBJ_MAYBE_SOM
|
||||
#undef OBJ_MAYBE_VMS
|
||||
|
||||
/* Used for some of the COFF configurations, when the COFF code needs
|
||||
to select something based on the CPU type before it knows it... */
|
||||
#undef I386COFF
|
||||
#undef M68KCOFF
|
||||
#undef M88KCOFF
|
||||
|
||||
/* Define if you have the remove function. */
|
||||
#undef HAVE_REMOVE
|
||||
|
||||
/* Define if you have the sbrk function. */
|
||||
#undef HAVE_SBRK
|
||||
|
||||
/* Define if you have the unlink function. */
|
||||
#undef HAVE_UNLINK
|
||||
|
||||
/* Define if you have the <errno.h> header file. */
|
||||
#undef HAVE_ERRNO_H
|
||||
|
||||
/* Define if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define if you have the <stdarg.h> header file. */
|
||||
#undef HAVE_STDARG_H
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if you have the <varargs.h> header file. */
|
||||
#undef HAVE_VARARGS_H
|
||||
@@ -1 +0,0 @@
|
||||
TDEFINES=-DI386COFF
|
||||
@@ -1 +0,0 @@
|
||||
TDEFINES=-DSCO_ELF
|
||||
@@ -1,247 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
#
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
||||
-3757
File diff suppressed because it is too large.
Load diff
@@ -1,18 +0,0 @@
|
||||
Specifying the -g flag to GCC on a RISC iX machine requires upgrading the
|
||||
standard assembler distributed with both RISC iX 1.1 and RISC iX 1.2 with a
|
||||
replacement that is available from Acorn. This version of the assembler is
|
||||
also an order of magnitude faster when assembling to an NFS mounted
|
||||
file-system.
|
||||
|
||||
Users of RISC iX 1.2 and above can obtain a copy of the assembler from the
|
||||
following places:
|
||||
|
||||
1) Via ftp from acorn.acorn.co.uk, directory pub/riscix.
|
||||
|
||||
2) From Acorn Customer Services.
|
||||
|
||||
3) From Granada Microcare.
|
||||
|
||||
Users of versions of RISC iX prior 1.2 should contact Acorn Customer Services;
|
||||
the assembler available on the net will not work with these versions due to
|
||||
changes in the shared libraries and system call numbers.
|
||||
@@ -1,55 +0,0 @@
|
||||
Since COFF-encapsulation is obsolete, this may not be needed anymore.
|
||||
|
||||
Return-Path: <[email protected]>
|
||||
Date: Mon, 10 Apr 89 10:13:45 +0300
|
||||
From: Jyrki Kuoppala <[email protected]>
|
||||
Sender: [email protected]
|
||||
To: [email protected]
|
||||
Subject: Kernel fix needed for Altos 3068 to get coff-encapsulation working right
|
||||
Organization: Helsinki University of Technology, Finland.
|
||||
|
||||
Here's a description how to fix a kernel bug in Altos 3068 and get
|
||||
gcc-compiled programs working.
|
||||
|
||||
Author: Jyrki Kuoppala ([email protected])
|
||||
Last modified: Mon Apr 10 09:28:40 1989
|
||||
|
||||
There's a bug in the Altos 3068 kernel that causes gcc-compiled
|
||||
programs to fail in certain situations when the machine has a heavy
|
||||
load and also in some other situations. The bug exists at least in
|
||||
SVR 2.2 1.0gT1 and SVR 2.2 1.0e.
|
||||
|
||||
If you have source code to your system, apply the following change to
|
||||
os/exec.c (function gethead):
|
||||
|
||||
Change the lines containing
|
||||
|
||||
u.u_exdata.ux_tstart = sizeof(struct naout) +
|
||||
sizeof(struct filhd) + (ep->ef.nscns * sizeof(struct scnhdr));
|
||||
|
||||
to
|
||||
|
||||
u.u_exdata.ux_tstart = u.u_exdata.ux_txtorg;
|
||||
|
||||
If you only have binary, use sdb to find out the address of the
|
||||
previous lines (on our system it's gethead+0x140) and use your
|
||||
favourite binary editor to change the bytes '3036 0162 fffc 0002 0280
|
||||
0000' to '23f9 01fb f4ca 01fb f4c2 6016'. This may or may not work in
|
||||
your case, depending on the version of the operating system and the
|
||||
phase of the moon.
|
||||
|
||||
Here's what is just before gethead+0x140 to ease finding out the right place:
|
||||
|
||||
0x9224 (gethead+0x122): 23f9 01fb f4ca 01fb f4ce mov.l &0x1fbf4ca.L,&0
|
||||
x1fbf4ce.L []
|
||||
0x922e (gethead+0x12c): 23f9 01fb f4c6 01fb f4ca mov.l &0x1fbf4c6.L,&0
|
||||
x1fbf4ca.L []
|
||||
0x9238 (gethead+0x136): 23f9 01fb f4c2 01fb f4c6 mov.l &0x1fbf4c2.L,&0
|
||||
x1fbf4c6.L []
|
||||
|
||||
Good luck !
|
||||
|
||||
//Jyrki
|
||||
|
||||
[email protected]
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
README.apollo
|
||||
|
||||
Building GCC 2.0 for 680x0 based Apollo systems requires the GNU
|
||||
assembler (GAS) version 1.38.1, with John Vasta's patches applied.
|
||||
|
||||
If you haven't done so yet, get `gas-1.38.1.tar.Z' from your favourite
|
||||
GNU distribution site. Furthermore, get `apollo-gas-1.38.1.diffs'
|
||||
from `labrea.stanford.edu:/pub/gnu', apply the patches, compile and
|
||||
install gas (under the name as). This should go through without any
|
||||
problems.
|
||||
|
||||
After switching into the BSD environment, you can configure GCC 2.0
|
||||
with the command
|
||||
|
||||
% ./configure m68k-apollo-bsd
|
||||
|
||||
The Apollo's `/usr/include/setjmp.h' uses a nonstandard `#options()'
|
||||
construct. You should create a local copy of this file and remove
|
||||
these constructs from the declarations of SIGSETJMP and SIGLONGJMP.
|
||||
|
||||
The Apollo's `/usr/include/sys/types.h' (BSD Version) doesn't allow
|
||||
to test for the definition of `size_t'. This should be fixed by
|
||||
|
||||
#ifndef _SIZE_T
|
||||
#define _SIZE_T
|
||||
typedef long size_t;
|
||||
#endif
|
||||
|
||||
The script `patch-apollo-includes' fixes these two problems, but does
|
||||
_not_ pretend to be a full fledged `fixincludes' for this system.
|
||||
|
||||
If you now follow the standard GCC installation instructions, building
|
||||
GCC 2.0 (including G++ 2.0) should proceed without any problems.
|
||||
|
||||
NB: Debugging is not yet supported for the Apollo. If someone wants
|
||||
to do a _big_ favour to the Apollo users, he/she should consider
|
||||
porting the Binary File Description library (BFD) to the Apollo.
|
||||
This library can be found in the gdb-4.x distributions or in the
|
||||
binutils-1.9x distributions.
|
||||
|
||||
|
||||
|
||||
|
||||
#!/bin/sh
|
||||
# patch-apollo-includes -- fix some (but not all!) Apollo brain damage.
|
||||
|
||||
FILES_TO_PATCH='sys/types.h setjmp.h'
|
||||
|
||||
mkdir sys
|
||||
|
||||
for i in $FILES_TO_PATCH;
|
||||
do
|
||||
cp /bsd4.3/usr/include/$i ./$i
|
||||
done
|
||||
|
||||
patch -b -apollo <<'EOP'
|
||||
*** /bsd4.3/usr/include/sys/types.h Fri Apr 8 20:29:06 1988
|
||||
--- sys/types.h Wed Feb 26 21:17:57 1992
|
||||
***************
|
||||
*** 38,44 ****
|
||||
--- 38,47 ----
|
||||
typedef char * caddr_t;
|
||||
typedef u_long ino_t;
|
||||
typedef long swblk_t;
|
||||
+ #ifndef _SIZE_T
|
||||
+ #define _SIZE_T
|
||||
typedef long size_t;
|
||||
+ #endif
|
||||
typedef long time_t;
|
||||
typedef long dev_t;
|
||||
typedef long off_t;
|
||||
*** /bsd4.3/usr/include/setjmp.h Fri Feb 3 21:40:21 1989
|
||||
--- setjmp.h Sun Feb 23 19:06:55 1992
|
||||
***************
|
||||
*** 24,30 ****
|
||||
--- 24,39 ----
|
||||
#endif
|
||||
|
||||
|
||||
+ #ifdef __GNUC__
|
||||
#ifdef _PROTOTYPES
|
||||
+ extern int sigsetjmp (sigjmp_buf env, int savemask);
|
||||
+ extern void siglongjmp (sigjmp_buf env, int val);
|
||||
+ #else
|
||||
+ extern int sigsetjmp();
|
||||
+ extern void siglongjmp();
|
||||
+ #endif /* _PROTOTYPES */
|
||||
+ #else /* not __GNUC__ */
|
||||
+ #ifdef _PROTOTYPES
|
||||
extern int sigsetjmp(
|
||||
sigjmp_buf env,
|
||||
int savemask
|
||||
***************
|
||||
*** 37,43 ****
|
||||
extern int sigsetjmp() #options(abnormal);
|
||||
extern void siglongjmp() #options(noreturn);
|
||||
#endif /* _PROTOTYPES */
|
||||
!
|
||||
#undef _PROTOTYPES
|
||||
|
||||
#ifdef __cplusplus
|
||||
--- 46,52 ----
|
||||
extern int sigsetjmp() #options(abnormal);
|
||||
extern void siglongjmp() #options(noreturn);
|
||||
#endif /* _PROTOTYPES */
|
||||
! #endif /* not __GNUC__ */
|
||||
#undef _PROTOTYPES
|
||||
|
||||
#ifdef __cplusplus
|
||||
EOP
|
||||
|
||||
exit 0
|
||||
@@ -1,17 +0,0 @@
|
||||
Compiling Fresco with g++
|
||||
-----------------------------
|
||||
|
||||
Fresco is an evolving interface and toolkit for object-oriented
|
||||
graphics. A preliminary version (written in C++) was released
|
||||
with x11r6.
|
||||
|
||||
Previous versions of Fresco have not compiled using g++,
|
||||
partly because of the use of true and false as identifiers.
|
||||
(They are now reserved words in g++, as required by the
|
||||
ANSI/ISO draft standard for C++.)
|
||||
|
||||
If you get x11r6 with public patch #5 or a later version
|
||||
of Fresco, these problems should now be fixed.
|
||||
|
||||
See http://www.faslab.com/fresco/HomePage.html for information
|
||||
on Fresco, including how to get the latest version.
|
||||
@@ -1,130 +0,0 @@
|
||||
This file describes the implementation notes of the GNU C Compiler for
|
||||
the National Semiconductor 32032 chip (and 32000 family).
|
||||
|
||||
The 32032 machine description and configuration file for this compiler
|
||||
is, for NS32000 family machine, primarily machine independent.
|
||||
However, since this release still depends on vendor-supplied
|
||||
assemblers and linkers, the compiler must obey the existing
|
||||
conventions of the actual machine to which this compiler is targeted.
|
||||
In this case, the actual machine which this compiler was targeted to
|
||||
is a Sequent Balance 8000, running DYNIX 2.1.
|
||||
|
||||
The assembler for DYNIX 2.1 (and DYNIX 3.0, alas) does not cope with
|
||||
the full generality of the addressing mode REGISTER RELATIVE.
|
||||
Specifically, it generates incorrect code for operands of the
|
||||
following form:
|
||||
|
||||
sym(rn)
|
||||
|
||||
Where `rn' is one of the general registers. Correct code is generated
|
||||
for operands of the form
|
||||
|
||||
sym(pn)
|
||||
|
||||
where `pn' is one of the special processor registers (sb, fp, or sp).
|
||||
|
||||
An equivalent operand can be generated by the form
|
||||
|
||||
sym[rn:b]
|
||||
|
||||
although this addressing mode is about twice as slow on the 32032.
|
||||
|
||||
The more efficient addressing mode is controlled by defining the
|
||||
constant SEQUENT_ADDRESS_BUG to 0. It is currently defined to be 1.
|
||||
|
||||
Another bug in the assembler makes it impossible to compute with
|
||||
explicit addresses. In order to compute with a symbolic address, it
|
||||
is necessary to load that address into a register using the "addr"
|
||||
instruction. For example, it is not possible to say
|
||||
|
||||
cmpd _p,@_x
|
||||
|
||||
Rather one must say
|
||||
|
||||
addr _x,rn
|
||||
cmpd _p,rn
|
||||
|
||||
|
||||
The ns32032 chip has a number of known bugs. Any attempt to make the
|
||||
compiler unaware of these deficiencies will surely bring disaster.
|
||||
The current list of know bugs are as follows (list provided by Richard
|
||||
Stallman):
|
||||
|
||||
1) instructions with two overlapping operands in memory
|
||||
(unlikely in C code, perhaps impossible).
|
||||
|
||||
2) floating point conversion instructions with constant
|
||||
operands (these may never happen, but I'm not certain).
|
||||
|
||||
3) operands crossing a page boundary. These can be prevented
|
||||
by setting the flag in tm.h that requires strict alignment.
|
||||
|
||||
4) Scaled indexing in an insn following an insn that has a read-write
|
||||
operand in memory. This can be prevented by placing a no-op in
|
||||
between. I, Michael Tiemann, do not understand what exactly is meant
|
||||
by `read-write operand in memory'. If this is referring to the special
|
||||
TOS mode, for example "addd 5,tos" then one need not fear, since this
|
||||
will never be generated. However, is this includes "addd 5,-4(fp)"
|
||||
then there is room for disaster. The Sequent compiler does not insert
|
||||
a no-op for code involving the latter, and I have been informed that
|
||||
Sequent is aware of this list of bugs, so I must assume that it is not
|
||||
a problem.
|
||||
|
||||
5) The 32032 cannot shift by 32 bits. It shifts modulo the word size
|
||||
of the operand. Therefore, for 32-bit operations, 32-bit shifts are
|
||||
interpreted as zero bit shifts. 32-bit shifts have been removed from
|
||||
the compiler, but future hackers must be careful not to reintroduce
|
||||
them.
|
||||
|
||||
6) The ns32032 is a very slow chip; however, some instructions are
|
||||
still very much slower than one might expect. For example, it is
|
||||
almost always faster to double a quantity by adding it to itself than
|
||||
by shifting it by one, even if that quantity is deep in memory. The
|
||||
MOVM instruction has a 20-cycle setup time, after which it moves data
|
||||
at about the speed that normal moves would. It is also faster to use
|
||||
address generation instructions than shift instructions for left
|
||||
shifts less than 4. I do not claim that I generate optimal code for all
|
||||
given patterns, but where I did escape from National's "clean
|
||||
architecture", I did so because the timing specification from the data
|
||||
book says that I will win if I do. I suppose this is called the
|
||||
"performance gap".
|
||||
|
||||
|
||||
Signed bitfield extraction has not been implemented. It is not
|
||||
provided by the NS32032, and while it is most certainly possible to do
|
||||
better than the standard shift-left/shift-right sequence, it is also
|
||||
quite hairy. Also, since signed bitfields do not yet exist in C, this
|
||||
omission seems relatively harmless.
|
||||
|
||||
|
||||
Zero extractions could be better implemented if it were possible in
|
||||
GCC to provide sized zero extractions: i.e. a byte zero extraction
|
||||
would be allowed to yield a byte result. The current implementation
|
||||
of GCC manifests 68000-ist thinking, where bitfields are extracted
|
||||
into a register, and automatically sign/zero extended to fill the
|
||||
register. See comments in ns32k.md around the "extzv" insn for more
|
||||
details.
|
||||
|
||||
|
||||
It should be noted that while the NS32000 family was designed to
|
||||
provide odd-aligned addressing capability for multi-byte data (also
|
||||
provided by the 68020, but not by the 68000 or 68010), many machines
|
||||
do not opt to take advantage of this. For example, on the sequent,
|
||||
although there is no advantage to long-word aligning word data, shorts
|
||||
must be int-aligned in structs. This is an example of another
|
||||
machine-specific machine dependency.
|
||||
|
||||
|
||||
Because the ns32032 is has a coherent byte-order/bit-order
|
||||
architecture, many instructions which would be different for
|
||||
68000-style machines, fold into the same instruction for the 32032.
|
||||
The classic case is push effective address, where it does not matter
|
||||
whether one is pushing a long, word, or byte address. They all will
|
||||
push the same address.
|
||||
|
||||
|
||||
The macro FUNCTION_VALUE_REGNO_P is probably not sufficient, what is
|
||||
needed is FUNCTION_VALUE_P, which also takes a MODE parameter. In
|
||||
this way it will be possible to determine more exactly whether a
|
||||
register is really a function value register, or just one that happens
|
||||
to look right.
|
||||
@@ -1,111 +0,0 @@
|
||||
AIX 3.1 and 3.2 assembler problems
|
||||
|
||||
Specifying the -g flag to GCC on the RS/6000 requires upgrading the
|
||||
standard AIX assembler distributed with AIX 3.1 and versions of AIX
|
||||
3.2 earlier than 3.2.4 with a replacement that is available from IBM.
|
||||
Note that Makefile.in specifies the -g when compiling libgcc2.c.
|
||||
|
||||
You can test for the presence of a fixed assembler by entering the following:
|
||||
% as -u < /dev/null
|
||||
If the command exits normally, the assembler fix already is installed.
|
||||
If the assembler complains that "-u" is an unknown flag, you need to order
|
||||
the fix.
|
||||
|
||||
If you are running AIX 3.1 (lslpp -h bos.obj output reports
|
||||
03.01.0005.XXXX where the 0005 can be any higher number and the XXXX
|
||||
can be any value), call IBM Support at 800-237-5511 and ask for
|
||||
shipment of AIX/6000 fix PTF U403044 for APAR IX22829 (.extern foo
|
||||
conflicts with defining foo).
|
||||
|
||||
If you are running AIX 3.2 but not 3.2.4 or later (lslpp -h bos.obj
|
||||
output reports 03.02.0000.0000), a newer update to the assembler fix
|
||||
is available. Ask for shipment of AIX/6000 fix PTF U416277 for
|
||||
IX32992 (.global prevents detection of duplicate symbol).
|
||||
|
||||
If you are running AIX 3.2.4 or later, you already have the new
|
||||
assembler.
|
||||
|
||||
Any customer can order and get the replacement assembler, and install it on
|
||||
one or more machines. It is available on diskette from IBM Customer Support
|
||||
and from the IBM Internet fix anonymous ftp server (FixDist) at
|
||||
aix.boulder.ibm.com (198.17.57.66).
|
||||
|
||||
If you contact IBM Customer Support, they may also ask you for your customer
|
||||
number. If you do not know it, you will still be able to get the fix, but
|
||||
you will have to be persistent. IBM has corresponding support organizations
|
||||
outside of North America. Call your IBM branch office and ask them to put
|
||||
you in touch with the department that handles fixes for AIX/6000. If that
|
||||
doesn't work, ask for the department that handles software defect support
|
||||
for AIX/6000 and ask for the APAR fix.
|
||||
|
||||
If you use the GNU assembler instead of the system supplied assembler, you need
|
||||
an assembler modified after October 16th, 1995 in order to build the GNU C
|
||||
compiler. This is because the GNU C compiler wants to build a variant of its
|
||||
library, libgcc.a with the -mcpu=common switch to support building programs
|
||||
that can run on either the Power or PowerPC machines.
|
||||
|
||||
|
||||
AIX NLS problems
|
||||
|
||||
AIX on the RS/6000 provides support (NLS) for environments outside of
|
||||
the United States. Compilers and assemblers use NLS to support
|
||||
locale-specific representations of various objects including
|
||||
floating-point numbers ("." vs "," for separating decimal fractions).
|
||||
There have been problems reported where the library linked with GCC does
|
||||
not produce the same floating-point formats that the assembler accepts.
|
||||
If you have this problem, set the LANG environment variable to "C" or
|
||||
"En_US".
|
||||
|
||||
|
||||
AIX 3.2.5 XLC-1.3 problems
|
||||
|
||||
XLC version 1.3.0.0 distributed with AIX 3.2.5 will miscompile jump.c when
|
||||
building the stage1 compiler during the bootstrap process. This will cause
|
||||
GCC to crash and the bootstrap to fail later while compiling libgcc2.c. XLC
|
||||
version 1.3.0.1 or later fixes this problem. XLC-1.3.0.19 also cannot
|
||||
bootstrap GCC so please avoid that release as well. You can obtain
|
||||
XLC-1.3.0.24 by requesting PTF 432238 from IBM, or just ask for the latest
|
||||
release of XLC-1.3.
|
||||
|
||||
There also have been reports of problems bootstrapping GCC with some older
|
||||
releases of xlc-1.2.1, including xlc-1.2.1.8. Newer releases of xlc-1.2.1
|
||||
do not exhibit this problem: xlc-1.2.1.28 is known to bootstrap properly.
|
||||
|
||||
|
||||
AIX 3.2 common-mode support
|
||||
|
||||
AIX common-mode providing transparent support of both the POWER and PowerPC
|
||||
architectures is usable in AIX 3.2.3 and above but an export file and
|
||||
support for hidden export via libc.a will not exist until AIX 4.1. libgcc.a
|
||||
also must be compiled in common-mode. Note that executables generated for
|
||||
the POWER (RIOS1 and RSC) architecture will run directly on systems using
|
||||
the MPC601 chip. Common-mode only improves the performance of a single
|
||||
executable run on both POWER and PowerPC architecture platforms by not using
|
||||
POWER- or PowerPC-specific instructions and eliminating the need to trap to
|
||||
emulation (for POWER instructions run on PowerPC).
|
||||
|
||||
To link a common-mode application prior to AIX 4.1 and run it on a system at
|
||||
AIX level 3.2.3 or above, use the text between the "<>" as an export file
|
||||
(e.g. milli.exp)
|
||||
|
||||
<><><><><><><><><><><>
|
||||
#!
|
||||
__mulh 0x3100
|
||||
__mull 0x3180
|
||||
__divss 0x3200
|
||||
__divus 0x3280
|
||||
__quoss 0x3300
|
||||
__quous 0x3380
|
||||
<><><><><><><><><><><>
|
||||
|
||||
and then link with -Wl,-bI:milli.exp.
|
||||
|
||||
|
||||
AIX 4.1 binder
|
||||
|
||||
Due to changes in the way that GCC invokes the binder (linker) for AIX 4.1,
|
||||
the link step now may produce warnings of duplicate symbols which were not
|
||||
reported before. The assembly files generated by GCC for AIX always have
|
||||
included multiple symbol definitions for certain global variable and
|
||||
function declarations in the original program. The warnings should not
|
||||
prevent the linker from producing a correct library or runnable executable.
|
||||
@@ -1,447 +0,0 @@
|
||||
[This file contains two alternative recipes for compiling X11 with GCC.
|
||||
The first alternative puts libgcc.a into the shared X library; the second
|
||||
does not. Neither alternative works on all kinds of systems.
|
||||
It may be that when using GCC 2.4, both alternatives work okay on
|
||||
relatively recent Sparc systems. The first alternative is likely
|
||||
not to work on a Sun 3 without hardware floating point.]
|
||||
|
||||
How to compile X11R5 (patch level 11) with GCC version 2:
|
||||
|
||||
The patches include support for building the shared libraries with GCC
|
||||
2 on the Sparc and 68k machines. This version includes the necessary
|
||||
parts of libgcc.a in the shared library for X, in case functions in
|
||||
that library need it. Thus the default behavior is now to build
|
||||
everything, including the libraries, with gcc.
|
||||
|
||||
If you build the shared library this way, it may not work with
|
||||
executables made with older versions of GCC (2.3.3 and earlier).
|
||||
If that happens, relink those executables with the latest GCC.
|
||||
IF YOU THINK YOU MIGHT COMPILE X FOR SOLARIS 2, then you really don't
|
||||
need this patch: get /contrib/R5.SunOS5.patch.tar.Z from
|
||||
export.lcs.mit.edu instead. It has everything you need to do the
|
||||
build for Solaris 2, sets you up to everything with GCC, and is
|
||||
backward compatible with Sunos 4.*. Get the the README
|
||||
(/contrib/R5.SunOS5.patch.README at export) for more info.
|
||||
|
||||
If you see undefined symbols _dlopen, _dlsym, or _dlclose when linking
|
||||
with -lX11, compile and link against the file mit/util/misc/dlsym.c in
|
||||
the MIT X11R5 distribution. Alternatively, do dynamic linking
|
||||
by using a non-GNU ld.
|
||||
|
||||
mit/config/Imake.tmpl -- Do not set -fstrength-reduce if we have GCC 2.
|
||||
If -fstrength-reduce (or any other -f option) is a major win, then it
|
||||
will most likely be turned on by -O2 optimization.
|
||||
|
||||
mit/config/sunLib.rules -- If HasGcc and GccVersion > 1 are true, then
|
||||
use gcc -fpic to generate PIC code. Make sure that gcc does not use
|
||||
gas (the GNU assembler) when compiling PIC code; gas does not assemble
|
||||
it correctly.
|
||||
|
||||
***If you have gas installed where gcc uses it by default, you might have
|
||||
to add -B/bin/ to the PositionIndependentCFlags.***
|
||||
|
||||
mit/config/site.def -- Define GccVersion to be 2.
|
||||
|
||||
mit/config/sun.cf -- When compiling with GCC 2, use -O2 optimization.
|
||||
|
||||
mit/config/sunLib.rules -- When compiling with GCC 2, use -fpic for
|
||||
position independent code generation.
|
||||
|
||||
mit/rgb/Imakefile -- No longer need to compile some modules with
|
||||
cc on the Sparc since GCC 2 produces proper -fpcc-struct-return code.
|
||||
|
||||
mit/server/os/Imakefile -- Likewise.
|
||||
|
||||
mit/server/ddx/sun/Imakefile -- When compiling with GCC 2, some modules
|
||||
should be compiled with -fvolatile.
|
||||
|
||||
mit/clients/twm/Imakefile -- Fix bad decls of malloc, realloc in gram.c.
|
||||
|
||||
mit/lib/X/Imakefile -- Make libgcc.a a required lib for libX11.so
|
||||
|
||||
*** mit/clients/twm/Imakefile Mon May 17 22:05:22 1993
|
||||
--- new/clients/twm/Imakefile Mon May 17 22:28:46 1993
|
||||
***************
|
||||
*** 32,41 ****
|
||||
--- 32,48 ----
|
||||
ComplexProgramTarget(twm)
|
||||
InstallNonExecFile(system.twmrc,$(TWMDIR))
|
||||
|
||||
+ #if HasGcc && GccVersion > 1 && defined (SunArchitecture)
|
||||
gram.h gram.c: gram.y
|
||||
yacc $(YFLAGS) gram.y
|
||||
+ sed -e 's/^extern char \*malloc(), \*realloc();//g' y.tab.c >gram.c
|
||||
+ $(MV) y.tab.h gram.h
|
||||
+ #else
|
||||
+ gram.h gram.c: gram.y
|
||||
+ yacc $(YFLAGS) gram.y
|
||||
$(MV) y.tab.c gram.c
|
||||
$(MV) y.tab.h gram.h
|
||||
+ #endif
|
||||
|
||||
clean::
|
||||
$(RM) y.tab.h y.tab.c lex.yy.c gram.h gram.c lex.c deftwmrc.c
|
||||
*** mit/config/Imake.tmpl Mon May 17 22:02:57 1993
|
||||
--- new/config/Imake.tmpl Mon May 17 22:15:06 1993
|
||||
***************
|
||||
*** 500,506 ****
|
||||
--- 500,510 ----
|
||||
#endif
|
||||
#ifndef CcCmd
|
||||
#if HasGcc
|
||||
+ #if GccVersion > 1
|
||||
+ #define CcCmd gcc -fpcc-struct-return
|
||||
+ #else
|
||||
#define CcCmd gcc -fstrength-reduce -fpcc-struct-return
|
||||
+ #endif
|
||||
#else
|
||||
#define CcCmd cc
|
||||
#endif
|
||||
*** mit/config/site.def Mon May 17 22:02:44 1993
|
||||
--- new/config/site.def Mon May 17 22:22:28 1993
|
||||
***************
|
||||
*** 25,31 ****
|
||||
|
||||
#ifdef BeforeVendorCF
|
||||
|
||||
! /* #define HasGcc YES */
|
||||
|
||||
#endif /* BeforeVendorCF */
|
||||
|
||||
--- 25,33 ----
|
||||
|
||||
#ifdef BeforeVendorCF
|
||||
|
||||
! #define HasGcc YES
|
||||
! /* GccVersion > 1 implies building shared libraries with gcc */
|
||||
! #define GccVersion 2
|
||||
|
||||
#endif /* BeforeVendorCF */
|
||||
|
||||
*** mit/config/sun.cf Mon May 17 22:03:02 1993
|
||||
--- new/config/sun.cf Mon May 17 22:24:55 1993
|
||||
***************
|
||||
*** 41,49 ****
|
||||
--- 41,55 ----
|
||||
|
||||
#if HasGcc
|
||||
|
||||
+ #if GccVersion > 1
|
||||
+ #define OptimizedCDebugFlags -O2
|
||||
+ #else
|
||||
+ #define OptimizedCDebugFlags -O
|
||||
#define SharedLibraryCcCmd cc
|
||||
#define ExtraLoadFlags -B/usr/bin/
|
||||
#define AllocateLocalDefines /**/
|
||||
+ #endif
|
||||
+
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $*.c
|
||||
*** mit/config/sunLib.rules Mon May 17 22:02:46 1993
|
||||
--- new/config/sunLib.rules Mon May 17 22:19:06 1993
|
||||
***************
|
||||
*** 23,29 ****
|
||||
--- 23,33 ----
|
||||
#define SharedLibraryLoadFlags -assert pure-text
|
||||
#endif
|
||||
#ifndef PositionIndependentCFlags
|
||||
+ #if defined(HasGcc) && GccVersion > 1
|
||||
+ #define PositionIndependentCFlags -fpic
|
||||
+ #else
|
||||
#define PositionIndependentCFlags -pic
|
||||
+ #endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
*** mit/lib/X/Imakefile Mon May 17 22:05:03 1993
|
||||
--- new/lib/X/Imakefile Mon May 17 22:32:26 1993
|
||||
***************
|
||||
*** 9,14 ****
|
||||
--- 9,31 ----
|
||||
#define MotifBC NO
|
||||
#endif
|
||||
|
||||
+ #if defined(SunArchitecture)
|
||||
+ #if SystemV4
|
||||
+ #if HasGcc
|
||||
+ REQUIREDLIBS= -lgcc -lc
|
||||
+ #else
|
||||
+ REQUIREDLIBS= -lc
|
||||
+ #endif
|
||||
+ #else
|
||||
+ #if HasGcc && GccVersion > 1
|
||||
+ XCOMM Hack to fix gcc 2 ``-nostdlib'' deficiency on SunOS 4.x
|
||||
+ REQUIREDLIBS= `gcc -v 2>&1 | awk '{print $$4}' | sed -e 's/specs$$/libgcc.a/'`
|
||||
+ #else
|
||||
+ REQUIREDLIBS=
|
||||
+ #endif
|
||||
+ #endif
|
||||
+ #endif
|
||||
+
|
||||
#ifndef BuildXimp
|
||||
#define BuildXimp NO
|
||||
#endif
|
||||
*** mit/rgb/Imakefile Mon May 17 22:05:31 1993
|
||||
--- new/rgb/Imakefile Mon May 17 22:25:30 1993
|
||||
***************
|
||||
*** 17,23 ****
|
||||
#if !(defined(SGIArchitecture) || SystemV4)
|
||||
DBMLIB = -ldbm
|
||||
#endif
|
||||
! #if defined(SparcArchitecture) && HasGcc
|
||||
CC = cc
|
||||
CCOPTIONS = /**/
|
||||
EXTRA_LOAD_FLAGS = /**/
|
||||
--- 17,23 ----
|
||||
#if !(defined(SGIArchitecture) || SystemV4)
|
||||
DBMLIB = -ldbm
|
||||
#endif
|
||||
! #if defined(SparcArchitecture) && HasGcc && GccVersion <= 1
|
||||
CC = cc
|
||||
CCOPTIONS = /**/
|
||||
EXTRA_LOAD_FLAGS = /**/
|
||||
*** mit/server/ddx/sun/Imakefile Mon May 17 22:05:57 1993
|
||||
--- new/server/ddx/sun/Imakefile Mon May 17 22:27:23 1993
|
||||
***************
|
||||
*** 43,48 ****
|
||||
--- 43,53 ----
|
||||
LinkFile(sunGX.o,sunGX.o.dist)
|
||||
#endif
|
||||
|
||||
+ #if HasGcc && GccVersion > 1
|
||||
+ SpecialObjectRule(sunCG2C.o,sunCG2C.c,-fvolatile)
|
||||
+ SpecialObjectRule(sunCG2M.o,sunCG2M.c,-fvolatile)
|
||||
+ #endif
|
||||
+
|
||||
sunInitExtMono.o: $(ICONFIGFILES)
|
||||
ObjectFromSpecialSource(sunInitExtMono,../mi/miinitext,-UPEXEXT)
|
||||
ObjectFromSpecialSource(sunInitMono,sunInit,-DMONO_ONLY)
|
||||
*** mit/server/os/Imakefile Mon May 17 22:05:46 1993
|
||||
--- new/server/os/Imakefile Mon May 17 22:26:02 1993
|
||||
***************
|
||||
*** 132,138 ****
|
||||
SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
|
||||
SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
|
||||
SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
|
||||
! #if defined(SparcArchitecture) && HasGcc
|
||||
oscolor.o: $(ICONFIGFILES)
|
||||
$(RM) $@
|
||||
cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
|
||||
--- 132,138 ----
|
||||
SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
|
||||
SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
|
||||
SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
|
||||
! #if defined(SparcArchitecture) && HasGcc && GccVersion <= 1
|
||||
oscolor.o: $(ICONFIGFILES)
|
||||
$(RM) $@
|
||||
cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
|
||||
|
||||
|
||||
[This is the older version]
|
||||
|
||||
How to compile X11R5 (patch level 11) with GCC version 2:
|
||||
|
||||
The patches include support for building the shared libraries with GCC 2 on
|
||||
the Sparc and 68k machines.
|
||||
|
||||
NOTE: Such shared libraries built with GCC version 2.3 DID NOT WORK
|
||||
with executables previously linked using Sun CC! This is because
|
||||
neither those executables nor the gcc-compiled shared libraries contain
|
||||
libgcc.a. The shared libraries did work with executables linked using
|
||||
GCC (running the Sun linker, of course) because GCC tells the linker to
|
||||
link in libgcc.a. Because of these limitations the default behavior is
|
||||
to NOT build the shared libraries with gcc.
|
||||
|
||||
Changes in GCC 2.4 seem to have eliminated the problem, and such a
|
||||
shared library now seems work with all executables. If you want the
|
||||
gcc-compiled shared libraries turn on "Gcc2BuildLibs" in site.def. If
|
||||
you try this, please tell [email protected] whether it works.
|
||||
|
||||
Sun forgot to include a static version of libdl.a with some versions
|
||||
of SunOS (4.1 mainly). If you see undefined symbols _dlopen, _dlsym,
|
||||
or _dlclose when linking with -lX11, compile and link against the file
|
||||
mit/util/misc/dlsym.c in the MIT X11R5 distribution.
|
||||
|
||||
mit/config/Imake.tmpl -- Do not set -fstrength-reduce if we have GCC 2. If
|
||||
-fstrength-reduce (or any other -f option) is a major win, then it will
|
||||
most likely be turned on by -O2 optimization.
|
||||
|
||||
mit/config/sunLib.rules -- If HasGcc2 and Gcc2BuildLibs are defined, then
|
||||
use gcc -fpic to generate PIC code. Make sure that gcc does not use gas (the
|
||||
GNU assembler) when compiling PIC code; gas does not assemble it correctly.
|
||||
If you have gas installed where gcc uses it by default, you might have to add
|
||||
-B/bin/ to the PositionIndependentCFlags.
|
||||
|
||||
mit/config/site.def -- Define HasGcc2 to be YES.
|
||||
|
||||
mit/config/sun.cf -- When compiling with GCC 2, use -O2 optimization.
|
||||
|
||||
mit/rgb/Imakefile -- No longer need to compile some modules with
|
||||
cc on the Sparc since GCC 2 produces proper -fpcc-struct-return code.
|
||||
|
||||
mit/server/os/Imakefile -- Likewise.
|
||||
|
||||
mit/clients/twm/Imakefile -- fix bad decls of malloc, realloc in gram.c.
|
||||
|
||||
*** mit/config/Imake.tmpl.ORIG Tue Dec 31 11:07:56 1991
|
||||
--- mit/config/Imake.tmpl Tue Dec 31 12:30:47 1991
|
||||
***************
|
||||
*** 499,508 ****
|
||||
--- 499,512 ----
|
||||
#define HasGcc NO
|
||||
#endif
|
||||
#ifndef CcCmd
|
||||
+ #if HasGcc2
|
||||
+ #define CcCmd gcc -fpcc-struct-return
|
||||
+ #else
|
||||
#if HasGcc
|
||||
#define CcCmd gcc -fstrength-reduce -fpcc-struct-return
|
||||
#else
|
||||
#define CcCmd cc
|
||||
+ #endif
|
||||
#endif
|
||||
#endif
|
||||
#if HasFortran
|
||||
*** mit/config/sunLib.rules.ORIG Tue Dec 31 11:11:24 1991
|
||||
--- mit/config/sunLib.rules Tue May 5 12:26:12 1992
|
||||
***************
|
||||
*** 23,30 ****
|
||||
--- 23,34 ----
|
||||
#define SharedLibraryLoadFlags -assert pure-text
|
||||
#endif
|
||||
#ifndef PositionIndependentCFlags
|
||||
+ #if defined(HasGcc2) && defined (Gcc2BuildLibs)
|
||||
+ #define PositionIndependentCFlags -fpic
|
||||
+ #else
|
||||
#define PositionIndependentCFlags -pic
|
||||
#endif
|
||||
+ #endif
|
||||
|
||||
/*
|
||||
* InstallSharedLibrary - generate rules to install the shared library.
|
||||
*** mit/config/site.def.ORIG Tue Dec 31 11:13:49 1991
|
||||
--- mit/config/site.def Tue Dec 31 12:02:59 1991
|
||||
***************
|
||||
*** 25,31 ****
|
||||
|
||||
#ifdef BeforeVendorCF
|
||||
|
||||
! /* #define HasGcc YES */
|
||||
|
||||
#endif /* BeforeVendorCF */
|
||||
|
||||
--- 25,33 ----
|
||||
|
||||
#ifdef BeforeVendorCF
|
||||
|
||||
! #define HasGcc YES
|
||||
! #define HasGcc2 YES
|
||||
! /* #define Gcc2BuildLibs YES */
|
||||
|
||||
#endif /* BeforeVendorCF */
|
||||
|
||||
*** mit/config/sun.cf.ORIG Tue Dec 31 11:13:57 1991
|
||||
--- mit/config/sun.cf Tue May 5 12:29:50 1992
|
||||
***************
|
||||
*** 34,42 ****
|
||||
--- 41,61 ----
|
||||
|
||||
#if HasGcc
|
||||
|
||||
+ #if defined(HasGcc2)
|
||||
+ #define OptimizedCDebugFlags -O2
|
||||
+ /* Leave Alone XXX */
|
||||
+ #else
|
||||
+ #define OptimizedCDebugFlags -O
|
||||
#define SharedLibraryCcCmd cc
|
||||
#define ExtraLoadFlags -B/usr/bin/
|
||||
#define AllocateLocalDefines /**/
|
||||
+ #endif
|
||||
+
|
||||
+ #if !defined(Gcc2BuildLibs)
|
||||
+ #define SharedLibraryCcCmd cc
|
||||
+ #define ExtraLoadFlags -B/usr/bin/
|
||||
+ #define AllocateLocalDefines /**/
|
||||
+ #endif
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $*.c
|
||||
*** mit/rgb/Imakefile.ORIG Wed Jan 15 16:43:18 1992
|
||||
--- mit/rgb/Imakefile Thu Jan 2 13:34:09 1992
|
||||
***************
|
||||
*** 17,23 ****
|
||||
#if !(defined(SGIArchitecture) || SystemV4)
|
||||
DBMLIB = -ldbm
|
||||
#endif
|
||||
! #if defined(SparcArchitecture) && HasGcc
|
||||
CC = cc
|
||||
CCOPTIONS = /**/
|
||||
EXTRA_LOAD_FLAGS = /**/
|
||||
--- 17,23 ----
|
||||
#if !(defined(SGIArchitecture) || SystemV4)
|
||||
DBMLIB = -ldbm
|
||||
#endif
|
||||
! #if defined(SparcArchitecture) && HasGcc && !defined(HasGcc2)
|
||||
CC = cc
|
||||
CCOPTIONS = /**/
|
||||
EXTRA_LOAD_FLAGS = /**/
|
||||
*** mit/server/os/Imakefile.ORIG Wed Jan 15 16:46:23 1992
|
||||
--- mit/server/os/Imakefile Wed Jan 15 16:46:48 1992
|
||||
***************
|
||||
*** 132,138 ****
|
||||
SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
|
||||
SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
|
||||
SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
|
||||
! #if defined(SparcArchitecture) && HasGcc
|
||||
oscolor.o: $(ICONFIGFILES)
|
||||
$(RM) $@
|
||||
cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
|
||||
--- 132,138 ----
|
||||
SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
|
||||
SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
|
||||
SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
|
||||
! #if defined(SparcArchitecture) && HasGcc && !defined(HasGcc2)
|
||||
oscolor.o: $(ICONFIGFILES)
|
||||
$(RM) $@
|
||||
cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
|
||||
*** 1.1 1992/09/08 19:52:07
|
||||
--- mit/server/ddx/sun/Imakefile 1992/09/08 21:10:22
|
||||
***************
|
||||
*** 43,48 ****
|
||||
--- 43,53 ----
|
||||
LinkFile(sunGX.o,sunGX.o.dist)
|
||||
#endif
|
||||
|
||||
+ #if HasGcc2
|
||||
+ SpecialObjectRule(sunCG2C.o,sunCG2C.c,-fvolatile)
|
||||
+ SpecialObjectRule(sunCG2M.o,sunCG2M.c,-fvolatile)
|
||||
+ #endif
|
||||
+
|
||||
sunInitExtMono.o: $(ICONFIGFILES)
|
||||
ObjectFromSpecialSource(sunInitExtMono,../mi/miinitext,-UPEXEXT)
|
||||
ObjectFromSpecialSource(sunInitMono,sunInit,-DMONO_ONLY)
|
||||
|
||||
*** /tmp/RCSAa24446 Tue Sep 15 12:23:32 1992
|
||||
--- mit/clients/twm/Imakefile Thu Aug 13 18:18:07 1992
|
||||
***************
|
||||
*** 32,41 ****
|
||||
--- 32,48 ----
|
||||
ComplexProgramTarget(twm)
|
||||
InstallNonExecFile(system.twmrc,$(TWMDIR))
|
||||
|
||||
+ #if HasGcc2 && defined (SunArchitecture)
|
||||
gram.h gram.c: gram.y
|
||||
yacc $(YFLAGS) gram.y
|
||||
+ sed -e 's/^extern char \*malloc(), \*realloc();//g' y.tab.c >gram.c
|
||||
+ $(MV) y.tab.h gram.h
|
||||
+ #else
|
||||
+ gram.h gram.c: gram.y
|
||||
+ yacc $(YFLAGS) gram.y
|
||||
$(MV) y.tab.c gram.c
|
||||
$(MV) y.tab.h gram.h
|
||||
+ #endif
|
||||
|
||||
clean::
|
||||
$(RM) y.tab.h y.tab.c lex.yy.c gram.h gram.c lex.c deftwmrc.c
|
||||
|
||||
@@ -1,504 +0,0 @@
|
||||
/* alloca.c -- allocate automatically reclaimed memory
|
||||
(Mostly) portable public-domain implementation -- D A Gwyn
|
||||
|
||||
This implementation of the PWB library alloca function,
|
||||
which is used to allocate space off the run-time stack so
|
||||
that it is automatically reclaimed upon procedure exit,
|
||||
was inspired by discussions with J. Q. Johnson of Cornell.
|
||||
J.Otto Tennant <[email protected]> contributed the Cray support.
|
||||
|
||||
There are some preprocessor constants that can
|
||||
be defined when compiling for your specific system, for
|
||||
improved efficiency; however, the defaults should be okay.
|
||||
|
||||
The general concept of this implementation is to keep
|
||||
track of all alloca-allocated blocks, and reclaim any
|
||||
that are found to be deeper in the stack than the current
|
||||
invocation. This heuristic does not reclaim storage as
|
||||
soon as it becomes invalid, but it will do so eventually.
|
||||
|
||||
As a special case, alloca(0) reclaims storage without
|
||||
allocating any. It is a good idea to use alloca(0) in
|
||||
your main control loop, etc. to force garbage collection. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef emacs
|
||||
#include "blockinput.h"
|
||||
#endif
|
||||
|
||||
/* If compiling with GCC 2, this file's not needed. */
|
||||
#if !defined (__GNUC__) || __GNUC__ < 2
|
||||
|
||||
/* If someone has defined alloca as a macro,
|
||||
there must be some other way alloca is supposed to work. */
|
||||
#ifndef alloca
|
||||
|
||||
#ifdef emacs
|
||||
#ifdef static
|
||||
/* actually, only want this if static is defined as ""
|
||||
-- this is for usg, in which emacs must undefine static
|
||||
in order to make unexec workable
|
||||
*/
|
||||
#ifndef STACK_DIRECTION
|
||||
you
|
||||
lose
|
||||
-- must know STACK_DIRECTION at compile-time
|
||||
#endif /* STACK_DIRECTION undefined */
|
||||
#endif /* static */
|
||||
#endif /* emacs */
|
||||
|
||||
/* If your stack is a linked list of frames, you have to
|
||||
provide an "address metric" ADDRESS_FUNCTION macro. */
|
||||
|
||||
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
long i00afunc ();
|
||||
#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
|
||||
#else
|
||||
#define ADDRESS_FUNCTION(arg) &(arg)
|
||||
#endif
|
||||
|
||||
#if __STDC__
|
||||
typedef void *pointer;
|
||||
#else
|
||||
typedef char *pointer;
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
/* Different portions of Emacs need to call different versions of
|
||||
malloc. The Emacs executable needs alloca to call xmalloc, because
|
||||
ordinary malloc isn't protected from input signals. On the other
|
||||
hand, the utilities in lib-src need alloca to call malloc; some of
|
||||
them are very simple, and don't have an xmalloc routine.
|
||||
|
||||
Non-Emacs programs expect this to call use xmalloc.
|
||||
|
||||
Callers below should use malloc. */
|
||||
|
||||
#ifndef emacs
|
||||
#define malloc xmalloc
|
||||
#endif
|
||||
extern pointer malloc ();
|
||||
|
||||
/* Define STACK_DIRECTION if you know the direction of stack
|
||||
growth for your system; otherwise it will be automatically
|
||||
deduced at run-time.
|
||||
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
|
||||
#ifndef STACK_DIRECTION
|
||||
#define STACK_DIRECTION 0 /* Direction unknown. */
|
||||
#endif
|
||||
|
||||
#if STACK_DIRECTION != 0
|
||||
|
||||
#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
|
||||
|
||||
#else /* STACK_DIRECTION == 0; need run-time code. */
|
||||
|
||||
static int stack_dir; /* 1 or -1 once known. */
|
||||
#define STACK_DIR stack_dir
|
||||
|
||||
static void
|
||||
find_stack_direction ()
|
||||
{
|
||||
static char *addr = NULL; /* Address of first `dummy', once known. */
|
||||
auto char dummy; /* To get stack address. */
|
||||
|
||||
if (addr == NULL)
|
||||
{ /* Initial entry. */
|
||||
addr = ADDRESS_FUNCTION (dummy);
|
||||
|
||||
find_stack_direction (); /* Recurse once. */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Second entry. */
|
||||
if (ADDRESS_FUNCTION (dummy) > addr)
|
||||
stack_dir = 1; /* Stack grew upward. */
|
||||
else
|
||||
stack_dir = -1; /* Stack grew downward. */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* STACK_DIRECTION == 0 */
|
||||
|
||||
/* An "alloca header" is used to:
|
||||
(a) chain together all alloca'ed blocks;
|
||||
(b) keep track of stack depth.
|
||||
|
||||
It is very important that sizeof(header) agree with malloc
|
||||
alignment chunk size. The following default should work okay. */
|
||||
|
||||
#ifndef ALIGN_SIZE
|
||||
#define ALIGN_SIZE sizeof(double)
|
||||
#endif
|
||||
|
||||
typedef union hdr
|
||||
{
|
||||
char align[ALIGN_SIZE]; /* To force sizeof(header). */
|
||||
struct
|
||||
{
|
||||
union hdr *next; /* For chaining headers. */
|
||||
char *deep; /* For stack depth measure. */
|
||||
} h;
|
||||
} header;
|
||||
|
||||
static header *last_alloca_header = NULL; /* -> last alloca header. */
|
||||
|
||||
/* Return a pointer to at least SIZE bytes of storage,
|
||||
which will be automatically reclaimed upon exit from
|
||||
the procedure that called alloca. Originally, this space
|
||||
was supposed to be taken from the current stack frame of the
|
||||
caller, but that method cannot be made to work for some
|
||||
implementations of C, for example under Gould's UTX/32. */
|
||||
|
||||
pointer
|
||||
alloca (size)
|
||||
unsigned size;
|
||||
{
|
||||
auto char probe; /* Probes stack depth: */
|
||||
register char *depth = ADDRESS_FUNCTION (probe);
|
||||
|
||||
#if STACK_DIRECTION == 0
|
||||
if (STACK_DIR == 0) /* Unknown growth direction. */
|
||||
find_stack_direction ();
|
||||
#endif
|
||||
|
||||
/* Reclaim garbage, defined as all alloca'd storage that
|
||||
was allocated from deeper in the stack than currently. */
|
||||
|
||||
{
|
||||
register header *hp; /* Traverses linked list. */
|
||||
|
||||
#ifdef emacs
|
||||
BLOCK_INPUT;
|
||||
#endif
|
||||
|
||||
for (hp = last_alloca_header; hp != NULL;)
|
||||
if ((STACK_DIR > 0 && hp->h.deep > depth)
|
||||
|| (STACK_DIR < 0 && hp->h.deep < depth))
|
||||
{
|
||||
register header *np = hp->h.next;
|
||||
|
||||
free ((pointer) hp); /* Collect garbage. */
|
||||
|
||||
hp = np; /* -> next header. */
|
||||
}
|
||||
else
|
||||
break; /* Rest are not deeper. */
|
||||
|
||||
last_alloca_header = hp; /* -> last valid storage. */
|
||||
|
||||
#ifdef emacs
|
||||
UNBLOCK_INPUT;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
return NULL; /* No allocation required. */
|
||||
|
||||
/* Allocate combined header + user data storage. */
|
||||
|
||||
{
|
||||
register pointer new = malloc (sizeof (header) + size);
|
||||
/* Address of header. */
|
||||
|
||||
if (new == 0)
|
||||
abort();
|
||||
|
||||
((header *) new)->h.next = last_alloca_header;
|
||||
((header *) new)->h.deep = depth;
|
||||
|
||||
last_alloca_header = (header *) new;
|
||||
|
||||
/* User storage begins just after header. */
|
||||
|
||||
return (pointer) ((char *) new + sizeof (header));
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifndef CRAY_STACK
|
||||
#define CRAY_STACK
|
||||
#ifndef CRAY2
|
||||
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
|
||||
struct stack_control_header
|
||||
{
|
||||
long shgrow:32; /* Number of times stack has grown. */
|
||||
long shaseg:32; /* Size of increments to stack. */
|
||||
long shhwm:32; /* High water mark of stack. */
|
||||
long shsize:32; /* Current size of stack (all segments). */
|
||||
};
|
||||
|
||||
/* The stack segment linkage control information occurs at
|
||||
the high-address end of a stack segment. (The stack
|
||||
grows from low addresses to high addresses.) The initial
|
||||
part of the stack segment linkage control information is
|
||||
0200 (octal) words. This provides for register storage
|
||||
for the routine which overflows the stack. */
|
||||
|
||||
struct stack_segment_linkage
|
||||
{
|
||||
long ss[0200]; /* 0200 overflow words. */
|
||||
long sssize:32; /* Number of words in this segment. */
|
||||
long ssbase:32; /* Offset to stack base. */
|
||||
long:32;
|
||||
long sspseg:32; /* Offset to linkage control of previous
|
||||
segment of stack. */
|
||||
long:32;
|
||||
long sstcpt:32; /* Pointer to task common address block. */
|
||||
long sscsnm; /* Private control structure number for
|
||||
microtasking. */
|
||||
long ssusr1; /* Reserved for user. */
|
||||
long ssusr2; /* Reserved for user. */
|
||||
long sstpid; /* Process ID for pid based multi-tasking. */
|
||||
long ssgvup; /* Pointer to multitasking thread giveup. */
|
||||
long sscray[7]; /* Reserved for Cray Research. */
|
||||
long ssa0;
|
||||
long ssa1;
|
||||
long ssa2;
|
||||
long ssa3;
|
||||
long ssa4;
|
||||
long ssa5;
|
||||
long ssa6;
|
||||
long ssa7;
|
||||
long sss0;
|
||||
long sss1;
|
||||
long sss2;
|
||||
long sss3;
|
||||
long sss4;
|
||||
long sss5;
|
||||
long sss6;
|
||||
long sss7;
|
||||
};
|
||||
|
||||
#else /* CRAY2 */
|
||||
/* The following structure defines the vector of words
|
||||
returned by the STKSTAT library routine. */
|
||||
struct stk_stat
|
||||
{
|
||||
long now; /* Current total stack size. */
|
||||
long maxc; /* Amount of contiguous space which would
|
||||
be required to satisfy the maximum
|
||||
stack demand to date. */
|
||||
long high_water; /* Stack high-water mark. */
|
||||
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
|
||||
long hits; /* Number of internal buffer hits. */
|
||||
long extends; /* Number of block extensions. */
|
||||
long stko_mallocs; /* Block allocations by $STKOFEN. */
|
||||
long underflows; /* Number of stack underflow calls ($STKRETN). */
|
||||
long stko_free; /* Number of deallocations by $STKRETN. */
|
||||
long stkm_free; /* Number of deallocations by $STKMRET. */
|
||||
long segments; /* Current number of stack segments. */
|
||||
long maxs; /* Maximum number of stack segments so far. */
|
||||
long pad_size; /* Stack pad size. */
|
||||
long current_address; /* Current stack segment address. */
|
||||
long current_size; /* Current stack segment size. This
|
||||
number is actually corrupted by STKSTAT to
|
||||
include the fifteen word trailer area. */
|
||||
long initial_address; /* Address of initial segment. */
|
||||
long initial_size; /* Size of initial segment. */
|
||||
};
|
||||
|
||||
/* The following structure describes the data structure which trails
|
||||
any stack segment. I think that the description in 'asdef' is
|
||||
out of date. I only describe the parts that I am sure about. */
|
||||
|
||||
struct stk_trailer
|
||||
{
|
||||
long this_address; /* Address of this block. */
|
||||
long this_size; /* Size of this block (does not include
|
||||
this trailer). */
|
||||
long unknown2;
|
||||
long unknown3;
|
||||
long link; /* Address of trailer block of previous
|
||||
segment. */
|
||||
long unknown5;
|
||||
long unknown6;
|
||||
long unknown7;
|
||||
long unknown8;
|
||||
long unknown9;
|
||||
long unknown10;
|
||||
long unknown11;
|
||||
long unknown12;
|
||||
long unknown13;
|
||||
long unknown14;
|
||||
};
|
||||
|
||||
#endif /* CRAY2 */
|
||||
#endif /* not CRAY_STACK */
|
||||
|
||||
#ifdef CRAY2
|
||||
/* Determine a "stack measure" for an arbitrary ADDRESS.
|
||||
I doubt that "lint" will like this much. */
|
||||
|
||||
static long
|
||||
i00afunc (long *address)
|
||||
{
|
||||
struct stk_stat status;
|
||||
struct stk_trailer *trailer;
|
||||
long *block, size;
|
||||
long result = 0;
|
||||
|
||||
/* We want to iterate through all of the segments. The first
|
||||
step is to get the stack status structure. We could do this
|
||||
more quickly and more directly, perhaps, by referencing the
|
||||
$LM00 common block, but I know that this works. */
|
||||
|
||||
STKSTAT (&status);
|
||||
|
||||
/* Set up the iteration. */
|
||||
|
||||
trailer = (struct stk_trailer *) (status.current_address
|
||||
+ status.current_size
|
||||
- 15);
|
||||
|
||||
/* There must be at least one stack segment. Therefore it is
|
||||
a fatal error if "trailer" is null. */
|
||||
|
||||
if (trailer == 0)
|
||||
abort ();
|
||||
|
||||
/* Discard segments that do not contain our argument address. */
|
||||
|
||||
while (trailer != 0)
|
||||
{
|
||||
block = (long *) trailer->this_address;
|
||||
size = trailer->this_size;
|
||||
if (block == 0 || size == 0)
|
||||
abort ();
|
||||
trailer = (struct stk_trailer *) trailer->link;
|
||||
if ((block <= address) && (address < (block + size)))
|
||||
break;
|
||||
}
|
||||
|
||||
/* Set the result to the offset in this segment and add the sizes
|
||||
of all predecessor segments. */
|
||||
|
||||
result = address - block;
|
||||
|
||||
if (trailer == 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (trailer->this_size <= 0)
|
||||
abort ();
|
||||
result += trailer->this_size;
|
||||
trailer = (struct stk_trailer *) trailer->link;
|
||||
}
|
||||
while (trailer != 0);
|
||||
|
||||
/* We are done. Note that if you present a bogus address (one
|
||||
not in any segment), you will get a different number back, formed
|
||||
from subtracting the address of the first block. This is probably
|
||||
not what you want. */
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
#else /* not CRAY2 */
|
||||
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
|
||||
Determine the number of the cell within the stack,
|
||||
given the address of the cell. The purpose of this
|
||||
routine is to linearize, in some sense, stack addresses
|
||||
for alloca. */
|
||||
|
||||
static long
|
||||
i00afunc (long address)
|
||||
{
|
||||
long stkl = 0;
|
||||
|
||||
long size, pseg, this_segment, stack;
|
||||
long result = 0;
|
||||
|
||||
struct stack_segment_linkage *ssptr;
|
||||
|
||||
/* Register B67 contains the address of the end of the
|
||||
current stack segment. If you (as a subprogram) store
|
||||
your registers on the stack and find that you are past
|
||||
the contents of B67, you have overflowed the segment.
|
||||
|
||||
B67 also points to the stack segment linkage control
|
||||
area, which is what we are really interested in. */
|
||||
|
||||
stkl = CRAY_STACKSEG_END ();
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
|
||||
/* If one subtracts 'size' from the end of the segment,
|
||||
one has the address of the first word of the segment.
|
||||
|
||||
If this is not the first segment, 'pseg' will be
|
||||
nonzero. */
|
||||
|
||||
pseg = ssptr->sspseg;
|
||||
size = ssptr->sssize;
|
||||
|
||||
this_segment = stkl - size;
|
||||
|
||||
/* It is possible that calling this routine itself caused
|
||||
a stack overflow. Discard stack segments which do not
|
||||
contain the target address. */
|
||||
|
||||
while (!(this_segment <= address && address <= stkl))
|
||||
{
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
|
||||
#endif
|
||||
if (pseg == 0)
|
||||
break;
|
||||
stkl = stkl - pseg;
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
size = ssptr->sssize;
|
||||
pseg = ssptr->sspseg;
|
||||
this_segment = stkl - size;
|
||||
}
|
||||
|
||||
result = address - this_segment;
|
||||
|
||||
/* If you subtract pseg from the current end of the stack,
|
||||
you get the address of the previous stack segment's end.
|
||||
This seems a little convoluted to me, but I'll bet you save
|
||||
a cycle somewhere. */
|
||||
|
||||
while (pseg != 0)
|
||||
{
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o\n", pseg, size);
|
||||
#endif
|
||||
stkl = stkl - pseg;
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
size = ssptr->sssize;
|
||||
pseg = ssptr->sspseg;
|
||||
result += size;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
#endif /* not CRAY2 */
|
||||
#endif /* CRAY */
|
||||
|
||||
#endif /* no alloca */
|
||||
#endif /* not GCC version 2 */
|
||||
@@ -1,992 +0,0 @@
|
||||
/* Output bytecodes for GNU C-compiler.
|
||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#ifdef __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include "machmode.h"
|
||||
#include "rtl.h"
|
||||
#include "real.h"
|
||||
#include "obstack.h"
|
||||
#include "bytecode.h"
|
||||
#ifdef __GNUC__
|
||||
#include "bytetypes.h"
|
||||
#endif
|
||||
#include "bc-emit.h"
|
||||
#include "bc-opcode.h"
|
||||
#include "bc-typecd.h"
|
||||
#include "bi-run.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
extern void free ();
|
||||
|
||||
extern struct obstack *rtl_obstack;
|
||||
|
||||
/* Indexed by mode class, gives the narrowest mode for each class. */
|
||||
|
||||
extern enum machine_mode class_narrowest_mode[(int) MAX_MODE_CLASS];
|
||||
|
||||
/* Commonly used modes. */
|
||||
/* Mode whose width is BITS_PER_UNIT */
|
||||
extern enum machine_mode byte_mode;
|
||||
|
||||
/* Mode whose width is BITS_PER_WORD */
|
||||
extern enum machine_mode word_mode;
|
||||
|
||||
/* Vector indexed by opcode giving info about the args for each opcode. */
|
||||
static struct arityvec arityvec[] = {
|
||||
#include "bc-arity.h"
|
||||
};
|
||||
|
||||
/* How to print a symbol name for the assembler. */
|
||||
static void
|
||||
prsym (file, s)
|
||||
FILE *file;
|
||||
char *s;
|
||||
{
|
||||
if (*s == '*')
|
||||
fprintf (file, "%s", s + 1);
|
||||
else
|
||||
|
||||
#ifdef NAMES_HAVE_UNDERSCORES
|
||||
fprintf (file, "_%s", s);
|
||||
#else
|
||||
fprintf (file, "%s", s);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/* Maintain a bucket hash table for symbol names. */
|
||||
|
||||
#define HASH_BITS 32
|
||||
#define HASH_SIZE 509
|
||||
|
||||
static struct bc_sym *hashtab[HASH_SIZE];
|
||||
|
||||
static unsigned int
|
||||
hash (name)
|
||||
char *name;
|
||||
{
|
||||
unsigned int hash = 0;
|
||||
|
||||
while (*name)
|
||||
{
|
||||
hash = hash << 3 | hash >> HASH_BITS - 3;
|
||||
hash += *name++;
|
||||
}
|
||||
|
||||
return hash % HASH_SIZE;
|
||||
}
|
||||
|
||||
|
||||
/* Look up the named symbol, creating it if it doesn't exist. */
|
||||
struct bc_sym *
|
||||
sym_lookup (name)
|
||||
char *name;
|
||||
{
|
||||
int i;
|
||||
struct bc_sym *s;
|
||||
|
||||
i = hash (name);
|
||||
for (s = hashtab[i]; s; s = s->next)
|
||||
if (!strcmp (s->name, name))
|
||||
return s;
|
||||
|
||||
s = (struct bc_sym *) xmalloc (sizeof (struct bc_sym));
|
||||
s->name = xmalloc (strlen (name) + 1);
|
||||
strcpy (s->name, name);
|
||||
s->defined = s->global = s->common = 0;
|
||||
s->val = 0;
|
||||
s->next = hashtab[i];
|
||||
hashtab[i] = s;
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
/* Write out .globl and common symbols to the named file. */
|
||||
static void
|
||||
bc_sym_write (file)
|
||||
FILE *file;
|
||||
{
|
||||
int i;
|
||||
struct bc_sym *s;
|
||||
|
||||
for (i = 0; i < HASH_SIZE; ++i)
|
||||
for (s = hashtab[i]; s; s = s->next)
|
||||
{
|
||||
if (s->global)
|
||||
{
|
||||
fprintf (file, "\n\t.globl ");
|
||||
prsym (file, s->name);
|
||||
putc ('\n', file);
|
||||
if (s->common)
|
||||
{
|
||||
fprintf (file, "\n\t.comm ");
|
||||
prsym (file, s->name);
|
||||
fprintf (file, ", %lu\n", s->val);
|
||||
}
|
||||
}
|
||||
else if (s->common)
|
||||
{
|
||||
fprintf (file, "\n\t.lcomm ");
|
||||
prsym (file, s->name);
|
||||
fprintf (file, ", %lu\n", s->val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Create and initialize a new segment. */
|
||||
static struct bc_seg *
|
||||
seg_create ()
|
||||
{
|
||||
struct bc_seg *result;
|
||||
|
||||
result = (struct bc_seg *) xmalloc (sizeof (struct bc_seg));
|
||||
result->alloc = 256;
|
||||
result->data = xmalloc (result->alloc);
|
||||
result->size = 0;
|
||||
result->syms = 0;
|
||||
result->relocs = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* Advance the segment index to the next alignment boundary. */
|
||||
static void
|
||||
seg_align (seg, log)
|
||||
struct bc_seg *seg;
|
||||
int log;
|
||||
{
|
||||
unsigned int oldsize = seg->size;
|
||||
|
||||
seg->size = seg->size + (1 << log) - 1 & ~((1 << log) - 1);
|
||||
if (seg->size > seg->alloc)
|
||||
{
|
||||
while (seg->size > seg->alloc)
|
||||
seg->alloc *= 2;
|
||||
seg->data = xrealloc (seg->data, seg->alloc);
|
||||
}
|
||||
bzero (seg->data + oldsize, seg->size - oldsize);
|
||||
}
|
||||
|
||||
|
||||
/* Append the given data to the given segment. */
|
||||
static void
|
||||
seg_data (seg, data, size)
|
||||
struct bc_seg *seg;
|
||||
char *data;
|
||||
unsigned int size;
|
||||
{
|
||||
if (seg->size + size > seg->alloc)
|
||||
{
|
||||
while (seg->size + size > seg->alloc)
|
||||
seg->alloc *= 2;
|
||||
seg->data = xrealloc (seg->data, seg->alloc);
|
||||
}
|
||||
|
||||
bcopy (data, seg->data + seg->size, size);
|
||||
seg->size += size;
|
||||
}
|
||||
|
||||
|
||||
/* Append a zero-filled skip to the given segment. */
|
||||
static void
|
||||
seg_skip (seg, size)
|
||||
struct bc_seg *seg;
|
||||
unsigned int size;
|
||||
{
|
||||
if (seg->size + size > seg->alloc)
|
||||
{
|
||||
while (seg->size + size > seg->alloc)
|
||||
seg->alloc *= 2;
|
||||
seg->data = xrealloc (seg->data, seg->alloc);
|
||||
}
|
||||
|
||||
memset (seg->data + seg->size, 0, size);
|
||||
seg->size += size;
|
||||
}
|
||||
|
||||
|
||||
/* Define the given name as the current offset in the given segment. It
|
||||
is an error if the name is already defined. Return 0 or 1 indicating
|
||||
failure or success respectively. */
|
||||
static int
|
||||
seg_defsym (seg, name)
|
||||
struct bc_seg *seg;
|
||||
char *name;
|
||||
{
|
||||
struct bc_sym *sym;
|
||||
struct bc_segsym *segsym;
|
||||
|
||||
sym = sym_lookup (name);
|
||||
if (sym->defined)
|
||||
return 0;
|
||||
|
||||
sym->defined = 1;
|
||||
sym->val = seg->size;
|
||||
segsym = (struct bc_segsym *) xmalloc (sizeof (struct bc_segsym));
|
||||
segsym->sym = sym;
|
||||
segsym->next = seg->syms;
|
||||
seg->syms = segsym;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Generate in seg's data a reference to the given sym, adjusted by
|
||||
the given offset. */
|
||||
static void
|
||||
seg_refsym (seg, name, offset)
|
||||
struct bc_seg *seg;
|
||||
char *name;
|
||||
int offset;
|
||||
{
|
||||
struct bc_sym *sym;
|
||||
struct bc_segreloc *segreloc;
|
||||
|
||||
sym = sym_lookup (name);
|
||||
segreloc = (struct bc_segreloc *) xmalloc (sizeof (struct bc_segreloc));
|
||||
segreloc->offset = seg->size;
|
||||
segreloc->sym = sym;
|
||||
segreloc->next = seg->relocs;
|
||||
seg->relocs = segreloc;
|
||||
seg_data (seg, (char *) &offset, sizeof offset);
|
||||
}
|
||||
|
||||
|
||||
/* Concatenate the contents of given segments into the first argument. */
|
||||
static void
|
||||
seg_concat (result, seg)
|
||||
struct bc_seg *result, *seg;
|
||||
{
|
||||
unsigned int fix;
|
||||
struct bc_segsym *segsym;
|
||||
struct bc_segreloc *segreloc;
|
||||
|
||||
seg_align (result, MACHINE_SEG_ALIGN);
|
||||
fix = result->size;
|
||||
seg_data (result, seg->data, seg->size);
|
||||
free (seg->data);
|
||||
|
||||
/* Go through the symbols and relocs of SEG, adjusting their offsets
|
||||
for their new location in RESULT. */
|
||||
if (seg->syms)
|
||||
{
|
||||
segsym = seg->syms;
|
||||
do
|
||||
segsym->sym->val += fix;
|
||||
while (segsym->next && (segsym = segsym->next));
|
||||
segsym->next = result->syms;
|
||||
result->syms = seg->syms;
|
||||
}
|
||||
if (seg->relocs)
|
||||
{
|
||||
segreloc = seg->relocs;
|
||||
do
|
||||
segreloc->offset += fix;
|
||||
while (segreloc->next && (segreloc = segreloc->next));
|
||||
segreloc->next = result->relocs;
|
||||
result->relocs = seg->relocs;
|
||||
}
|
||||
|
||||
free ((char *) seg);
|
||||
}
|
||||
|
||||
/* Write a segment to a file. */
|
||||
static void
|
||||
bc_seg_write (seg, file)
|
||||
struct bc_seg *seg;
|
||||
FILE *file;
|
||||
{
|
||||
struct bc_segsym *segsym, *nsegsym, *psegsym;
|
||||
struct bc_segreloc *segreloc, *nsegreloc, *psegreloc;
|
||||
int i, offset, flag;
|
||||
|
||||
/* Reverse the list of symbols. */
|
||||
for (psegsym = 0, segsym = seg->syms; segsym; segsym = nsegsym)
|
||||
{
|
||||
nsegsym = segsym->next;
|
||||
segsym->next = psegsym;
|
||||
psegsym = segsym;
|
||||
}
|
||||
seg->syms = psegsym;
|
||||
|
||||
/* Reverse the list of relocs. */
|
||||
for (psegreloc = 0, segreloc = seg->relocs; segreloc; segreloc = nsegreloc)
|
||||
{
|
||||
nsegreloc = segreloc->next;
|
||||
segreloc->next = psegreloc;
|
||||
psegreloc = segreloc;
|
||||
}
|
||||
seg->relocs = psegreloc;
|
||||
|
||||
/* Output each byte of the segment. */
|
||||
for (i = 0, segsym = seg->syms, segreloc = seg->relocs; i < seg->size; ++i)
|
||||
{
|
||||
while (segsym && segsym->sym->val == i)
|
||||
{
|
||||
if (i % 8 != 0)
|
||||
putc ('\n', file);
|
||||
|
||||
BC_WRITE_SEGSYM (segsym, file);
|
||||
segsym = segsym->next;
|
||||
flag = 1;
|
||||
}
|
||||
if (segreloc && segreloc->offset == i)
|
||||
{
|
||||
if (i % 8 != 0)
|
||||
putc ('\n', file);
|
||||
|
||||
bcopy (seg->data + i, (char *) &offset, sizeof (int));
|
||||
i += sizeof (int) - 1;
|
||||
|
||||
BC_WRITE_RELOC_ENTRY (segreloc, file, offset);
|
||||
segreloc = segreloc->next;
|
||||
flag = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i % 8 == 0 || flag)
|
||||
BC_START_BYTECODE_LINE (file);
|
||||
|
||||
BC_WRITE_BYTECODE (i % 8 == 0 || flag ? ' ' : ',',
|
||||
seg->data[i] & 0xFF,
|
||||
file);
|
||||
flag = 0;
|
||||
if (i % 8 == 7)
|
||||
putc ('\n', file);
|
||||
}
|
||||
}
|
||||
|
||||
/* Paranoia check--we should have visited all syms and relocs during
|
||||
the output pass. */
|
||||
|
||||
if (segsym || segreloc)
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Text and data segments of the object file in making. */
|
||||
static struct bc_seg *bc_text_seg;
|
||||
static struct bc_seg *bc_data_seg;
|
||||
|
||||
/* Called before anything else in this module. */
|
||||
void
|
||||
bc_initialize ()
|
||||
{
|
||||
int min_class_size[(int) MAX_MODE_CLASS];
|
||||
enum machine_mode mode;
|
||||
int i;
|
||||
|
||||
bc_init_mode_to_code_map ();
|
||||
|
||||
bc_text_seg = seg_create ();
|
||||
bc_data_seg = seg_create ();
|
||||
|
||||
dconst0 = REAL_VALUE_ATOF ("0", DFmode);
|
||||
dconst1 = REAL_VALUE_ATOF ("1", DFmode);
|
||||
dconst2 = REAL_VALUE_ATOF ("2", DFmode);
|
||||
dconstm1 = REAL_VALUE_ATOF ("-1", DFmode);
|
||||
|
||||
/* Find the narrowest mode for each class and compute the word and byte
|
||||
modes. */
|
||||
|
||||
for (i = 0; i < (int) MAX_MODE_CLASS; i++)
|
||||
min_class_size[i] = 1000;
|
||||
|
||||
for (mode = VOIDmode; (int) mode < (int) MAX_MACHINE_MODE;
|
||||
mode = (enum machine_mode) ((int) mode + 1))
|
||||
{
|
||||
if (GET_MODE_SIZE (mode) < min_class_size[(int) GET_MODE_CLASS (mode)])
|
||||
{
|
||||
class_narrowest_mode[(int) GET_MODE_CLASS (mode)] = mode;
|
||||
min_class_size[(int) GET_MODE_CLASS (mode)] = GET_MODE_SIZE (mode);
|
||||
}
|
||||
if (GET_MODE_CLASS (mode) == MODE_INT
|
||||
&& GET_MODE_BITSIZE (mode) == BITS_PER_UNIT)
|
||||
byte_mode = mode;
|
||||
|
||||
if (GET_MODE_CLASS (mode) == MODE_INT
|
||||
&& GET_MODE_BITSIZE (mode) == BITS_PER_WORD)
|
||||
word_mode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* External addresses referenced in a function. Rather than trying to
|
||||
work relocatable address directly into bytecoded functions (which would
|
||||
require us to provide hairy location info and possibly obey alignment
|
||||
rules imposed by the architecture) we build an auxiliary table of
|
||||
pointer constants, and encode just offsets into this table into the
|
||||
actual bytecode. */
|
||||
static struct bc_seg *ptrconsts;
|
||||
|
||||
/* Trampoline code for the function entry. */
|
||||
struct bc_seg *trampoline;
|
||||
|
||||
/* Actual byte code of the function. */
|
||||
struct bc_seg *bytecode;
|
||||
|
||||
/* List of labels defined in the function. */
|
||||
struct bc_label *labels;
|
||||
|
||||
/* List of label references in the function. */
|
||||
struct bc_labelref *labelrefs;
|
||||
|
||||
|
||||
/* Add symbol to pointer table. Return offset into table where
|
||||
pointer was stored. The offset usually goes into the bytecode
|
||||
stream as a constP literal. */
|
||||
int
|
||||
bc_define_pointer (p)
|
||||
char *p;
|
||||
{
|
||||
int offset = ptrconsts->size;
|
||||
|
||||
seg_refsym (ptrconsts, p, 0);
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
/* Begin a bytecoded function. */
|
||||
int
|
||||
bc_begin_function (name)
|
||||
char *name;
|
||||
{
|
||||
ptrconsts = seg_create ();
|
||||
trampoline = seg_create ();
|
||||
bytecode = seg_create ();
|
||||
return seg_defsym (trampoline, name);
|
||||
}
|
||||
|
||||
|
||||
/* Force alignment in inline bytecode. */
|
||||
void
|
||||
bc_align_bytecode (align)
|
||||
int align;
|
||||
{
|
||||
seg_align (bytecode, align);
|
||||
}
|
||||
|
||||
|
||||
/* Emit data inline into bytecode. */
|
||||
void
|
||||
bc_emit_bytecode_const (data, size)
|
||||
char *data;
|
||||
unsigned int size;
|
||||
{
|
||||
if (bytecode)
|
||||
seg_data (bytecode, data, size);
|
||||
}
|
||||
|
||||
|
||||
/* Create a new "bytecode label", to have its value defined later.
|
||||
Bytecode labels have nothing to do with the object file symbol table,
|
||||
and are purely local to a given bytecoded function. */
|
||||
struct bc_label *
|
||||
bc_get_bytecode_label ()
|
||||
{
|
||||
struct bc_label *result;
|
||||
|
||||
result = (struct bc_label *) xmalloc (sizeof (struct bc_label));
|
||||
result->defined = 0;
|
||||
result->next = labels;
|
||||
result->uid = 0;
|
||||
labels = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* Define the given label with the current location counter. */
|
||||
int
|
||||
bc_emit_bytecode_labeldef (label)
|
||||
struct bc_label *label;
|
||||
{
|
||||
extern int bc_new_uid ();
|
||||
|
||||
if (!label || label->defined)
|
||||
return 0;
|
||||
|
||||
label->offset = bytecode->size;
|
||||
label->defined = 1;
|
||||
label->uid = bc_new_uid ();
|
||||
|
||||
#ifdef DEBUG_PRINT_CODE
|
||||
fprintf (stderr, "$%lx:\n", label);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Generate a location-relative reference to the given bytecode label.
|
||||
It need not be defined yet; label references will be backpatched later. */
|
||||
void
|
||||
bc_emit_bytecode_labelref (label)
|
||||
struct bc_label *label;
|
||||
{
|
||||
struct bc_labelref *labelref;
|
||||
static int zero;
|
||||
|
||||
labelref = (struct bc_labelref *) xmalloc (sizeof (struct bc_labelref));
|
||||
labelref->label = label;
|
||||
labelref->offset = bytecode->size;
|
||||
labelref->next = labelrefs;
|
||||
labelrefs = labelref;
|
||||
|
||||
#ifdef DEBUG_PRINT_CODE
|
||||
fprintf (stderr, " $%lx", label);
|
||||
#endif
|
||||
|
||||
seg_data (bytecode, (char *) &zero, sizeof zero);
|
||||
}
|
||||
|
||||
|
||||
/* Emit a reference to an external address; generate the reference in the
|
||||
ptrconst area, and emit an offset in the bytecode. */
|
||||
void
|
||||
bc_emit_code_labelref (name, offset)
|
||||
char *name;
|
||||
int offset;
|
||||
{
|
||||
int ptroff;
|
||||
|
||||
ptroff = ptrconsts->size / sizeof (char *);
|
||||
seg_data (bytecode, (char *) &ptroff, sizeof ptroff);
|
||||
seg_refsym (ptrconsts, name, offset);
|
||||
|
||||
#ifdef DEBUG_PRINT_CODE
|
||||
fprintf (stderr, " [external <%x> %s]", ptroff, name);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Backpatch label references in the byte code, and concatenate the bytecode
|
||||
and pointer constant segments to the cumulative text for the object file.
|
||||
Return a label name for the pointer constants region. */
|
||||
char *
|
||||
bc_end_function ()
|
||||
{
|
||||
int addr;
|
||||
struct bc_label *label, *next;
|
||||
struct bc_labelref *ref, *nextref;
|
||||
char ptrconsts_label[20];
|
||||
static int nlab;
|
||||
|
||||
/* Backpatch bytecode label references. */
|
||||
for (ref = labelrefs; ref; ref = ref->next)
|
||||
if (ref->label->defined)
|
||||
{
|
||||
addr = ref->label->offset;
|
||||
bcopy ((char *) &addr, bytecode->data + ref->offset, sizeof addr);
|
||||
}
|
||||
|
||||
/* Free the chains of labelrefs and labeldefs. */
|
||||
for (ref = labelrefs; ref; ref = nextref)
|
||||
{
|
||||
nextref = ref->next;
|
||||
free ((char *) ref);
|
||||
}
|
||||
|
||||
for (label = labels; label; label = next)
|
||||
{
|
||||
next = label->next;
|
||||
free ((char *) label);
|
||||
}
|
||||
|
||||
seg_concat (trampoline, bytecode);
|
||||
seg_align (trampoline, MACHINE_SEG_ALIGN);
|
||||
sprintf (ptrconsts_label, "*LP%d", nlab++);
|
||||
seg_defsym (trampoline, ptrconsts_label);
|
||||
seg_concat (trampoline, ptrconsts);
|
||||
seg_concat (bc_text_seg, trampoline);
|
||||
|
||||
labels = 0;
|
||||
labelrefs = 0;
|
||||
trampoline = 0;
|
||||
bytecode = 0;
|
||||
ptrconsts = 0;
|
||||
|
||||
return sym_lookup (ptrconsts_label)->name;
|
||||
}
|
||||
|
||||
/* Force alignment in const data. */
|
||||
void
|
||||
bc_align_const (align)
|
||||
int align;
|
||||
{
|
||||
seg_align (bc_text_seg, align);
|
||||
}
|
||||
|
||||
/* Emit const data. */
|
||||
void
|
||||
bc_emit_const (data, size)
|
||||
char *data;
|
||||
unsigned int size;
|
||||
{
|
||||
seg_data (bc_text_seg, data, size);
|
||||
}
|
||||
|
||||
/* Emit a zero-filled constant skip. */
|
||||
void
|
||||
bc_emit_const_skip (size)
|
||||
unsigned int size;
|
||||
{
|
||||
seg_skip (bc_text_seg, size);
|
||||
}
|
||||
|
||||
/* Emit a label definition in const data. */
|
||||
int
|
||||
bc_emit_const_labeldef (name)
|
||||
char *name;
|
||||
{
|
||||
return seg_defsym (bc_text_seg, name);
|
||||
}
|
||||
|
||||
/* Emit a label reference in const data. */
|
||||
void
|
||||
bc_emit_const_labelref (name, offset)
|
||||
char *name;
|
||||
int offset;
|
||||
{
|
||||
seg_refsym (bc_text_seg, name, offset);
|
||||
}
|
||||
|
||||
/* Force alignment in data. */
|
||||
void
|
||||
bc_align_data (align)
|
||||
int align;
|
||||
{
|
||||
seg_align (bc_data_seg, align);
|
||||
}
|
||||
|
||||
/* Emit data. */
|
||||
void
|
||||
bc_emit_data (data, size)
|
||||
char *data;
|
||||
unsigned int size;
|
||||
{
|
||||
seg_data (bc_data_seg, data, size);
|
||||
}
|
||||
|
||||
/* Emit a zero-filled data skip. */
|
||||
void
|
||||
bc_emit_data_skip (size)
|
||||
unsigned int size;
|
||||
{
|
||||
seg_skip (bc_data_seg, size);
|
||||
}
|
||||
|
||||
/* Emit label definition in data. */
|
||||
int
|
||||
bc_emit_data_labeldef (name)
|
||||
char *name;
|
||||
{
|
||||
return seg_defsym (bc_data_seg, name);
|
||||
}
|
||||
|
||||
/* Emit label reference in data. */
|
||||
void
|
||||
bc_emit_data_labelref (name, offset)
|
||||
char *name;
|
||||
int offset;
|
||||
{
|
||||
seg_refsym (bc_data_seg, name, offset);
|
||||
}
|
||||
|
||||
/* Emit a common block of the given name and size. Note that
|
||||
when the .o file is actually written non-global "common"
|
||||
blocks will have to be turned into space in the data section. */
|
||||
int
|
||||
bc_emit_common (name, size)
|
||||
char *name;
|
||||
unsigned int size;
|
||||
{
|
||||
struct bc_sym *sym;
|
||||
|
||||
sym = sym_lookup (name);
|
||||
if (sym->defined)
|
||||
return 0;
|
||||
|
||||
sym->defined = 1;
|
||||
sym->common = 1;
|
||||
sym->val = size;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Globalize the given label. */
|
||||
void
|
||||
bc_globalize_label (name)
|
||||
char *name;
|
||||
{
|
||||
struct bc_sym *sym;
|
||||
|
||||
sym = sym_lookup (name);
|
||||
sym->global = 1;
|
||||
}
|
||||
|
||||
static enum { in_text, in_data } section = in_text;
|
||||
|
||||
void
|
||||
bc_text ()
|
||||
{
|
||||
section = in_text;
|
||||
}
|
||||
|
||||
void
|
||||
bc_data ()
|
||||
{
|
||||
section = in_data;
|
||||
}
|
||||
|
||||
void
|
||||
bc_align (align)
|
||||
int align;
|
||||
{
|
||||
if (section == in_text)
|
||||
bc_align_const (align);
|
||||
else
|
||||
bc_align_data (align);
|
||||
}
|
||||
|
||||
void
|
||||
bc_emit (data, size)
|
||||
char *data;
|
||||
unsigned int size;
|
||||
{
|
||||
if (section == in_text)
|
||||
bc_emit_const (data, size);
|
||||
else
|
||||
bc_emit_data (data, size);
|
||||
}
|
||||
|
||||
void
|
||||
bc_emit_skip (size)
|
||||
unsigned int size;
|
||||
{
|
||||
if (section == in_text)
|
||||
bc_emit_const_skip (size);
|
||||
else
|
||||
bc_emit_data_skip (size);
|
||||
}
|
||||
|
||||
int
|
||||
bc_emit_labeldef (name)
|
||||
char *name;
|
||||
{
|
||||
if (section == in_text)
|
||||
return bc_emit_const_labeldef (name);
|
||||
else
|
||||
return bc_emit_data_labeldef (name);
|
||||
}
|
||||
|
||||
void
|
||||
bc_emit_labelref (name, offset)
|
||||
char *name;
|
||||
int offset;
|
||||
{
|
||||
if (section == in_text)
|
||||
bc_emit_const_labelref (name, offset);
|
||||
else
|
||||
bc_emit_data_labelref (name, offset);
|
||||
}
|
||||
|
||||
void
|
||||
bc_write_file (file)
|
||||
FILE *file;
|
||||
{
|
||||
BC_WRITE_FILE (file);
|
||||
}
|
||||
|
||||
|
||||
/* Allocate a new bytecode rtx.
|
||||
If you supply a null BC_LABEL, we generate one. */
|
||||
|
||||
rtx
|
||||
bc_gen_rtx (label, offset, bc_label)
|
||||
char *label;
|
||||
int offset;
|
||||
struct bc_label *bc_label;
|
||||
{
|
||||
rtx r;
|
||||
|
||||
if (bc_label == 0)
|
||||
bc_label = (struct bc_label *) xmalloc (sizeof (struct bc_label));
|
||||
|
||||
r = gen_rtx (CODE_LABEL, VOIDmode, label, bc_label);
|
||||
bc_label->offset = offset;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/* Print bytecode rtx */
|
||||
void
|
||||
bc_print_rtl (fp, r)
|
||||
FILE *fp;
|
||||
rtx r;
|
||||
{
|
||||
#if 0 /* This needs to get fixed to really work again. */
|
||||
/* BC_WRITE_RTL has a definition
|
||||
that doesn't even make sense for this use. */
|
||||
BC_WRITE_RTL (r, fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Emit a bytecode, keeping a running tally of the stack depth. */
|
||||
void
|
||||
bc_emit_bytecode (bytecode)
|
||||
enum bytecode_opcode bytecode;
|
||||
{
|
||||
char byte;
|
||||
static int prev_lineno = -1;
|
||||
|
||||
byte = (char) bytecode;
|
||||
|
||||
#ifdef BCDEBUG_PRINT_CODE
|
||||
if (lineno != prev_lineno)
|
||||
{
|
||||
fprintf (stderr, "<line %d>\n", lineno);
|
||||
prev_lineno = lineno;
|
||||
}
|
||||
|
||||
fputs (opcode_name[(unsigned int) bytecode], stderr);
|
||||
#endif
|
||||
|
||||
/* Due to errors we are often requested to output bytecodes that
|
||||
will cause an interpreter stack undeflow when executed. Instead of
|
||||
dumping core on such occasions, we omit the bytecode. Erroneous code
|
||||
should not be executed, regardless. This makes life much easier, since
|
||||
we don't have to deceive ourselves about the known stack depth. */
|
||||
|
||||
bc_emit_bytecode_const (&byte, 1);
|
||||
|
||||
if ((stack_depth -= arityvec[(int) bytecode].ninputs) >= 0)
|
||||
{
|
||||
if ((stack_depth += arityvec[(int) bytecode].noutputs) > max_stack_depth)
|
||||
max_stack_depth = stack_depth;
|
||||
}
|
||||
|
||||
#ifdef VALIDATE_STACK_FOR_BC
|
||||
VALIDATE_STACK_FOR_BC ();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef BCDEBUG_PRINT_CODE
|
||||
#define PRLIT(TYPE, PTR) fprintf (stderr, " [%x]", *(TYPE *) PTR)
|
||||
#else
|
||||
#define PRLIT(X,Y)
|
||||
#endif
|
||||
|
||||
/* Emit a complete bytecode instruction, expecting the correct number
|
||||
of literal values in the call. First argument is the instruction, the
|
||||
remaining arguments are literals of size HOST_WIDE_INT or smaller. */
|
||||
void
|
||||
bc_emit_instruction VPROTO((enum bytecode_opcode opcode, ...))
|
||||
{
|
||||
#ifndef __STDC__
|
||||
enum bytecode_opcode opcode;
|
||||
#endif
|
||||
va_list arguments;
|
||||
int nliteral, instruction;
|
||||
|
||||
VA_START (arguments, opcode);
|
||||
|
||||
#ifndef __STDC__
|
||||
opcode = va_arg (arguments, enum bytecode_opcode);
|
||||
#endif
|
||||
|
||||
/* Emit instruction bytecode */
|
||||
bc_emit_bytecode (opcode);
|
||||
instruction = (int) opcode;
|
||||
|
||||
/* Loop literals and emit as bytecode constants */
|
||||
for (nliteral = 0; nliteral < arityvec[instruction].nliterals; nliteral++)
|
||||
{
|
||||
switch (arityvec[instruction].literals[nliteral])
|
||||
{
|
||||
/* This conditional is a kludge, but it's necessary
|
||||
because TYPE might be long long. */
|
||||
#ifdef __GNUC__
|
||||
/* Expand definitions into case statements */
|
||||
#define DEFTYPECODE(CODE, NAME, MODE, TYPE) \
|
||||
case CODE: \
|
||||
{ \
|
||||
TYPE temp = va_arg (arguments, TYPE); \
|
||||
bc_emit_bytecode_const ((void *) &temp, sizeof temp); \
|
||||
PRLIT (TYPE, &temp); } \
|
||||
break;
|
||||
|
||||
#include "bc-typecd.def"
|
||||
|
||||
#undef DEFTYPECODE
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BCDEBUG_PRINT_CODE
|
||||
fputc ('\n', stderr);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Emit the machine-code interface trampoline at the beginning of a byte
|
||||
coded function. The argument is a label name of the interpreter
|
||||
bytecode callinfo structure; the return value is a label name for
|
||||
the beginning of the actual bytecode. */
|
||||
char *
|
||||
bc_emit_trampoline (callinfo)
|
||||
char *callinfo;
|
||||
{
|
||||
char mylab[20];
|
||||
static int n;
|
||||
|
||||
sprintf (mylab, "*LB%d", n++);
|
||||
|
||||
BC_EMIT_TRAMPOLINE (trampoline, callinfo);
|
||||
|
||||
seg_defsym (bytecode, mylab);
|
||||
return sym_lookup (mylab)->name;
|
||||
}
|
||||
|
||||
|
||||
/* Simple strdup */
|
||||
char *
|
||||
bc_xstrdup (str)
|
||||
char *str;
|
||||
{
|
||||
char *tmp = xmalloc (strlen (str) + 1);
|
||||
|
||||
strcpy (tmp, str);
|
||||
return tmp;
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
/* bc-emit.h - declare entry points for producing object files of bytecodes. */
|
||||
|
||||
/* Internal format of symbol table for the object file. */
|
||||
struct bc_sym
|
||||
{
|
||||
/* Private copy separately malloc'd. */
|
||||
char *name;
|
||||
|
||||
/* Symbol has a defined value. */
|
||||
unsigned int defined:1;
|
||||
|
||||
/* Symbol has been globalized. */
|
||||
unsigned int global:1;
|
||||
|
||||
/* Symbol is common. */
|
||||
unsigned int common:1;
|
||||
|
||||
/* Value if defined. */
|
||||
unsigned long int val;
|
||||
|
||||
/* Used in internal symbol table structure. */
|
||||
struct bc_sym *next;
|
||||
};
|
||||
|
||||
|
||||
/* List of symbols defined in a particular segment. */
|
||||
struct bc_segsym
|
||||
{
|
||||
struct bc_sym *sym;
|
||||
struct bc_segsym *next;
|
||||
};
|
||||
|
||||
|
||||
/* List of relocations needed in a particular segment. */
|
||||
struct bc_segreloc
|
||||
{
|
||||
/* Offset of datum to be relocated. */
|
||||
unsigned int offset;
|
||||
|
||||
/* Symbol to be relocated by. */
|
||||
struct bc_sym *sym;
|
||||
|
||||
struct bc_segreloc *next;
|
||||
};
|
||||
|
||||
|
||||
/* Segment of an object file. */
|
||||
struct bc_seg
|
||||
{
|
||||
/* Size allocated to contents. */
|
||||
unsigned int alloc;
|
||||
|
||||
/* Pointer to base of contents. */
|
||||
char *data;
|
||||
|
||||
/* Actual size of contents. */
|
||||
unsigned int size;
|
||||
|
||||
/* List of symbols defined in this segment. */
|
||||
struct bc_segsym *syms;
|
||||
|
||||
/* List of relocations for this segment. */
|
||||
struct bc_segreloc *relocs;
|
||||
};
|
||||
|
||||
|
||||
/* Anonymous bytecode label within a single function. */
|
||||
struct bc_label
|
||||
{
|
||||
/* Offset of label from start of segment. */
|
||||
unsigned int offset;
|
||||
|
||||
/* True when offset is valid. */
|
||||
unsigned int defined:1;
|
||||
|
||||
/* Unique bytecode ID, used to determine innermost
|
||||
block containment */
|
||||
int uid;
|
||||
|
||||
/* Next node in list */
|
||||
struct bc_label *next;
|
||||
};
|
||||
|
||||
|
||||
/* Reference to a bc_label; a list of all such references is kept for
|
||||
the function, then when it is finished they are backpatched to
|
||||
contain the correct values. */
|
||||
|
||||
struct bc_labelref
|
||||
{
|
||||
/* Label referenced. */
|
||||
struct bc_label *label;
|
||||
|
||||
/* Code offset of reference. */
|
||||
unsigned int offset;
|
||||
|
||||
/* Next labelref in list */
|
||||
struct bc_labelref *next;
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern void bc_initialize();
|
||||
extern int bc_begin_function();
|
||||
extern char *bc_emit_trampoline();
|
||||
extern void bc_emit_bytecode();
|
||||
extern void bc_emit_bytecode_const();
|
||||
extern struct bc_label *bc_get_bytecode_label();
|
||||
extern int bc_emit_bytecode_labeldef();
|
||||
extern void bc_emit_bytecode_labelref();
|
||||
extern void bc_emit_code_labelref();
|
||||
extern char *bc_end_function();
|
||||
extern void bc_align_const();
|
||||
extern void bc_emit_const();
|
||||
extern void bc_emit_const_skip();
|
||||
extern int bc_emit_const_labeldef();
|
||||
extern void bc_emit_const_labelref();
|
||||
extern void bc_align_data();
|
||||
extern void bc_emit_data();
|
||||
extern void bc_emit_data_skip();
|
||||
extern int bc_emit_data_labeldef();
|
||||
extern void bc_emit_data_labelref();
|
||||
extern int bc_define_pointer ();
|
||||
extern int bc_emit_common();
|
||||
extern void bc_globalize_label();
|
||||
extern void bc_text();
|
||||
extern void bc_data();
|
||||
extern void bc_align();
|
||||
extern void bc_emit();
|
||||
extern void bc_emit_skip();
|
||||
extern int bc_emit_labeldef();
|
||||
extern void bc_emit_labelref();
|
||||
extern void bc_write_file();
|
||||
@@ -1,789 +0,0 @@
|
||||
/* Bytecode conversion definitions for GNU C-compiler.
|
||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#include "tree.h"
|
||||
#include "rtl.h"
|
||||
#include "machmode.h"
|
||||
#include "obstack.h"
|
||||
#include "bytecode.h"
|
||||
#include "bc-typecd.h"
|
||||
#include "bc-opcode.h"
|
||||
#include "bc-optab.h"
|
||||
|
||||
#define obstack_chunk_alloc xmalloc
|
||||
#define obstack_chunk_free free
|
||||
|
||||
extern char *xmalloc ();
|
||||
extern void free ();
|
||||
|
||||
/* Table relating interpreter typecodes to machine modes. */
|
||||
#define GET_TYPECODE_MODE(CODE) (typecode_mode[((int) CODE)])
|
||||
enum machine_mode typecode_mode[] = {
|
||||
#define DEFTYPECODE(CODE, NAME, MODE, TYPE) MODE,
|
||||
#include "bc-typecd.def"
|
||||
#undef DEFTYPECODE
|
||||
};
|
||||
|
||||
/* Machine mode to type code map */
|
||||
static enum typecode signed_mode_to_code_map[MAX_MACHINE_MODE+1];
|
||||
static enum typecode unsigned_mode_to_code_map[MAX_MACHINE_MODE+1];
|
||||
|
||||
#define GET_TYPECODE_SIZE(CODE) GET_MODE_SIZE (GET_TYPECODE_MODE (CODE))
|
||||
|
||||
#define BIG_ARBITRARY_NUMBER 100000
|
||||
|
||||
/* Table of recipes for conversions among scalar types, to be filled
|
||||
in as needed at run time. */
|
||||
static struct conversion_recipe
|
||||
{
|
||||
unsigned char *opcodes; /* Bytecodes to emit in order. */
|
||||
int nopcodes; /* Count of bytecodes. */
|
||||
int cost; /* A rather arbitrary cost function. */
|
||||
} conversion_recipe[NUM_TYPECODES][NUM_TYPECODES];
|
||||
|
||||
/* Binary operator tables. */
|
||||
struct binary_operator optab_plus_expr[] = {
|
||||
{ addSI, SIcode, SIcode, SIcode },
|
||||
{ addDI, DIcode, DIcode, DIcode },
|
||||
{ addSF, SFcode, SFcode, SFcode },
|
||||
{ addDF, DFcode, DFcode, DFcode },
|
||||
{ addXF, XFcode, XFcode, XFcode },
|
||||
{ addPSI, Pcode, Pcode, SIcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_minus_expr[] = {
|
||||
{ subSI, SIcode, SIcode, SIcode },
|
||||
{ subDI, DIcode, DIcode, DIcode },
|
||||
{ subSF, SFcode, SFcode, SFcode },
|
||||
{ subDF, DFcode, DFcode, DFcode },
|
||||
{ subXF, XFcode, XFcode, XFcode },
|
||||
{ subPP, SIcode, Pcode, Pcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
/* The ordering of the tables for multiplicative operators
|
||||
is such that unsigned operations will be preferred to signed
|
||||
operations when one argument is unsigned. */
|
||||
|
||||
struct binary_operator optab_mult_expr[] = {
|
||||
{ mulSU, SUcode, SUcode, SUcode },
|
||||
{ mulDU, DUcode, DUcode, DUcode },
|
||||
{ mulSI, SIcode, SIcode, SIcode },
|
||||
{ mulDI, DIcode, DIcode, DIcode },
|
||||
{ mulSF, SFcode, SFcode, SFcode },
|
||||
{ mulDF, DFcode, DFcode, DFcode },
|
||||
{ mulXF, XFcode, XFcode, XFcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_trunc_div_expr[] = {
|
||||
{ divSU, SUcode, SUcode, SUcode },
|
||||
{ divDU, DUcode, DUcode, DUcode },
|
||||
{ divSI, SIcode, SIcode, SIcode },
|
||||
{ divDI, DIcode, DIcode, DIcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_trunc_mod_expr[] = {
|
||||
{ modSU, SUcode, SUcode, SUcode },
|
||||
{ modDU, DUcode, DUcode, DUcode },
|
||||
{ modSI, SIcode, SIcode, SIcode },
|
||||
{ modDI, DIcode, DIcode, DIcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_rdiv_expr[] = {
|
||||
{ divSF, SFcode, SFcode, SFcode },
|
||||
{ divDF, DFcode, DFcode, DFcode },
|
||||
{ divXF, XFcode, XFcode, XFcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_bit_and_expr[] = {
|
||||
{ andSI, SIcode, SIcode, SIcode },
|
||||
{ andDI, DIcode, DIcode, DIcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_bit_ior_expr[] = {
|
||||
{ iorSI, SIcode, SIcode, SIcode },
|
||||
{ iorDI, DIcode, DIcode, DIcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_bit_xor_expr[] = {
|
||||
{ xorSI, SIcode, SIcode, SIcode },
|
||||
{ xorDI, DIcode, DIcode, DIcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_lshift_expr[] = {
|
||||
{ lshiftSI, SIcode, SIcode, SIcode },
|
||||
{ lshiftSU, SUcode, SUcode, SIcode },
|
||||
{ lshiftDI, DIcode, DIcode, SIcode },
|
||||
{ lshiftDU, DUcode, DUcode, SIcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_rshift_expr[] = {
|
||||
{ rshiftSI, SIcode, SIcode, SIcode },
|
||||
{ rshiftSU, SUcode, SUcode, SIcode },
|
||||
{ rshiftDI, DIcode, DIcode, SIcode },
|
||||
{ rshiftDU, DUcode, DUcode, SIcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_truth_and_expr[] = {
|
||||
{ andSI, SIcode, Tcode, Tcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_truth_or_expr[] = {
|
||||
{ iorSI, SIcode, Tcode, Tcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_lt_expr[] = {
|
||||
{ ltSI, Tcode, SIcode, SIcode },
|
||||
{ ltSU, Tcode, SUcode, SUcode },
|
||||
{ ltDI, Tcode, DIcode, DIcode },
|
||||
{ ltDU, Tcode, DUcode, DUcode },
|
||||
{ ltSF, Tcode, SFcode, SFcode },
|
||||
{ ltDF, Tcode, DFcode, DFcode },
|
||||
{ ltXF, Tcode, XFcode, XFcode },
|
||||
{ ltP, Tcode, Pcode, Pcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_le_expr[] = {
|
||||
{ leSI, Tcode, SIcode, SIcode },
|
||||
{ leSU, Tcode, SUcode, SUcode },
|
||||
{ leDI, Tcode, DIcode, DIcode },
|
||||
{ leDU, Tcode, DUcode, DUcode },
|
||||
{ leSF, Tcode, SFcode, SFcode },
|
||||
{ leDF, Tcode, DFcode, DFcode },
|
||||
{ leXF, Tcode, XFcode, XFcode },
|
||||
{ leP, Tcode, Pcode, Pcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_ge_expr[] = {
|
||||
{ geSI, Tcode, SIcode, SIcode },
|
||||
{ geSU, Tcode, SUcode, SUcode },
|
||||
{ geDI, Tcode, DIcode, DIcode },
|
||||
{ geDU, Tcode, DUcode, DUcode },
|
||||
{ geSF, Tcode, SFcode, SFcode },
|
||||
{ geDF, Tcode, DFcode, DFcode },
|
||||
{ geXF, Tcode, XFcode, XFcode },
|
||||
{ geP, Tcode, Pcode, Pcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_gt_expr[] = {
|
||||
{ gtSI, Tcode, SIcode, SIcode },
|
||||
{ gtSU, Tcode, SUcode, SUcode },
|
||||
{ gtDI, Tcode, DIcode, DIcode },
|
||||
{ gtDU, Tcode, DUcode, DUcode },
|
||||
{ gtSF, Tcode, SFcode, SFcode },
|
||||
{ gtDF, Tcode, DFcode, DFcode },
|
||||
{ gtXF, Tcode, XFcode, XFcode },
|
||||
{ gtP, Tcode, Pcode, Pcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_eq_expr[] = {
|
||||
{ eqSI, Tcode, SIcode, SIcode },
|
||||
{ eqDI, Tcode, DIcode, DIcode },
|
||||
{ eqSF, Tcode, SFcode, SFcode },
|
||||
{ eqDF, Tcode, DFcode, DFcode },
|
||||
{ eqXF, Tcode, XFcode, XFcode },
|
||||
{ eqP, Tcode, Pcode, Pcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct binary_operator optab_ne_expr[] = {
|
||||
{ neSI, Tcode, SIcode, SIcode },
|
||||
{ neDI, Tcode, DIcode, DIcode },
|
||||
{ neSF, Tcode, SFcode, SFcode },
|
||||
{ neDF, Tcode, DFcode, DFcode },
|
||||
{ neXF, Tcode, XFcode, XFcode },
|
||||
{ neP, Tcode, Pcode, Pcode },
|
||||
{ -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
/* Unary operator tables. */
|
||||
struct unary_operator optab_negate_expr[] = {
|
||||
{ negSI, SIcode, SIcode },
|
||||
{ negDI, DIcode, DIcode },
|
||||
{ negSF, SFcode, SFcode },
|
||||
{ negDF, DFcode, DFcode },
|
||||
{ negXF, XFcode, XFcode },
|
||||
{ -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct unary_operator optab_bit_not_expr[] = {
|
||||
{ notSI, SIcode, SIcode },
|
||||
{ notDI, DIcode, DIcode },
|
||||
{ -1, -1, -1 },
|
||||
};
|
||||
|
||||
struct unary_operator optab_truth_not_expr[] = {
|
||||
{ notT, SIcode, SIcode },
|
||||
{ -1, -1, -1 },
|
||||
};
|
||||
|
||||
/* Increment operator tables. */
|
||||
struct increment_operator optab_predecrement_expr[] = {
|
||||
{ predecQI, QIcode },
|
||||
{ predecQI, QUcode },
|
||||
{ predecHI, HIcode },
|
||||
{ predecHI, HUcode },
|
||||
{ predecSI, SIcode },
|
||||
{ predecSI, SUcode },
|
||||
{ predecDI, DIcode },
|
||||
{ predecDI, DUcode },
|
||||
{ predecP, Pcode },
|
||||
{ predecSF, SFcode },
|
||||
{ predecDF, DFcode },
|
||||
{ predecXF, XFcode },
|
||||
{ -1, -1 },
|
||||
};
|
||||
|
||||
struct increment_operator optab_preincrement_expr[] = {
|
||||
{ preincQI, QIcode },
|
||||
{ preincQI, QUcode },
|
||||
{ preincHI, HIcode },
|
||||
{ preincHI, HUcode },
|
||||
{ preincSI, SIcode },
|
||||
{ preincSI, SUcode },
|
||||
{ preincDI, DIcode },
|
||||
{ preincDI, DUcode },
|
||||
{ preincP, Pcode },
|
||||
{ preincSF, SFcode },
|
||||
{ preincDF, DFcode },
|
||||
{ preincXF, XFcode },
|
||||
{ -1, -1 },
|
||||
};
|
||||
|
||||
struct increment_operator optab_postdecrement_expr[] = {
|
||||
{ postdecQI, QIcode },
|
||||
{ postdecQI, QUcode },
|
||||
{ postdecHI, HIcode },
|
||||
{ postdecHI, HUcode },
|
||||
{ postdecSI, SIcode },
|
||||
{ postdecSI, SUcode },
|
||||
{ postdecDI, DIcode },
|
||||
{ postdecDI, DUcode },
|
||||
{ postdecP, Pcode },
|
||||
{ postdecSF, SFcode },
|
||||
{ postdecDF, DFcode },
|
||||
{ postdecXF, XFcode },
|
||||
{ -1, -1 },
|
||||
};
|
||||
|
||||
struct increment_operator optab_postincrement_expr[] = {
|
||||
{ postincQI, QIcode },
|
||||
{ postincQI, QUcode },
|
||||
{ postincHI, HIcode },
|
||||
{ postincHI, HUcode },
|
||||
{ postincSI, SIcode },
|
||||
{ postincSI, SUcode },
|
||||
{ postincDI, DIcode },
|
||||
{ postincDI, DUcode },
|
||||
{ postincP, Pcode },
|
||||
{ postincSF, SFcode },
|
||||
{ postincDF, DFcode },
|
||||
{ postincXF, XFcode },
|
||||
{ -1, -1 },
|
||||
};
|
||||
|
||||
/* Table of conversions supported by the interpreter. */
|
||||
static struct conversion_info
|
||||
{
|
||||
enum bytecode_opcode opcode; /* here indicates the conversion needs no opcode. */
|
||||
enum typecode from;
|
||||
enum typecode to;
|
||||
int cost; /* 1 for no-op conversions, 2 for widening conversions,
|
||||
4 for int/float conversions, 8 for narrowing conversions. */
|
||||
} conversion_info[] = {
|
||||
{ -1, QIcode, QUcode, 1 },
|
||||
{ -1, HIcode, HUcode, 1 },
|
||||
{ -1, SIcode, SUcode, 1 },
|
||||
{ -1, DIcode, DUcode, 1 },
|
||||
{ -1, QUcode, QIcode, 1 },
|
||||
{ -1, HUcode, HIcode, 1 },
|
||||
{ -1, SUcode, SIcode, 1 },
|
||||
{ -1, DUcode, DIcode, 1 },
|
||||
{ -1, Tcode, SIcode, 1 },
|
||||
{ convertQIHI, QIcode, HIcode, 2 },
|
||||
{ convertQUHU, QUcode, HUcode, 2 },
|
||||
{ convertQUSU, QUcode, SUcode, 2 },
|
||||
{ convertHISI, HIcode, SIcode, 2 },
|
||||
{ convertHUSU, HUcode, SUcode, 2 },
|
||||
{ convertSIDI, SIcode, DIcode, 2 },
|
||||
{ convertSUDU, SUcode, DUcode, 2 },
|
||||
{ convertSFDF, SFcode, DFcode, 2 },
|
||||
{ convertDFXF, DFcode, XFcode, 2 },
|
||||
{ convertHIQI, HIcode, QIcode, 8 },
|
||||
{ convertSIQI, SIcode, QIcode, 8 },
|
||||
{ convertSIHI, SIcode, HIcode, 8 },
|
||||
{ convertSUQU, SUcode, QUcode, 8 },
|
||||
{ convertDISI, DIcode, SIcode, 8 },
|
||||
{ convertDFSF, DFcode, SFcode, 8 },
|
||||
{ convertXFDF, XFcode, DFcode, 8 },
|
||||
{ convertPSI, Pcode, SIcode, 2 },
|
||||
{ convertSIP, SIcode, Pcode, 2 },
|
||||
{ convertSIT, SIcode, Tcode, 2 },
|
||||
{ convertDIT, DIcode, Tcode, 2 },
|
||||
{ convertSFT, SFcode, Tcode, 2 },
|
||||
{ convertDFT, DFcode, Tcode, 2 },
|
||||
{ convertXFT, XFcode, Tcode, 2 },
|
||||
{ convertQISI, QIcode, SIcode, 2 },
|
||||
{ convertPT, Pcode, Tcode, 2 },
|
||||
{ convertSISF, SIcode, SFcode, 4 },
|
||||
{ convertSIDF, SIcode, DFcode, 4 },
|
||||
{ convertSIXF, SIcode, XFcode, 4 },
|
||||
{ convertSUSF, SUcode, SFcode, 4 },
|
||||
{ convertSUDF, SUcode, DFcode, 4 },
|
||||
{ convertSUXF, SUcode, XFcode, 4 },
|
||||
{ convertDISF, DIcode, SFcode, 4 },
|
||||
{ convertDIDF, DIcode, DFcode, 4 },
|
||||
{ convertDIXF, DIcode, XFcode, 4 },
|
||||
{ convertDUSF, DUcode, SFcode, 4 },
|
||||
{ convertDUDF, DUcode, DFcode, 4 },
|
||||
{ convertDUXF, DUcode, XFcode, 4 },
|
||||
{ convertSFSI, SFcode, SIcode, 4 },
|
||||
{ convertDFSI, DFcode, SIcode, 4 },
|
||||
{ convertXFSI, XFcode, SIcode, 4 },
|
||||
{ convertSFSU, SFcode, SUcode, 4 },
|
||||
{ convertDFSU, DFcode, SUcode, 4 },
|
||||
{ convertXFSU, XFcode, SUcode, 4 },
|
||||
{ convertSFDI, SFcode, DIcode, 4 },
|
||||
{ convertDFDI, DFcode, DIcode, 4 },
|
||||
{ convertXFDI, XFcode, DIcode, 4 },
|
||||
{ convertSFDU, SFcode, DUcode, 4 },
|
||||
{ convertDFDU, DFcode, DUcode, 4 },
|
||||
{ convertXFDU, XFcode, DUcode, 4 },
|
||||
{ convertSIQI, SIcode, QIcode, 8 },
|
||||
};
|
||||
|
||||
#define NUM_CONVERSIONS (sizeof conversion_info / sizeof (struct conversion_info))
|
||||
|
||||
/* List form of a conversion recipe. */
|
||||
struct conversion_list
|
||||
{
|
||||
enum bytecode_opcode opcode;
|
||||
enum typecode to;
|
||||
int cost;
|
||||
struct conversion_list *prev;
|
||||
};
|
||||
|
||||
/* Determine if it is "reasonable" to add a given conversion to
|
||||
a given list of conversions. The following criteria define
|
||||
"reasonable" conversion lists:
|
||||
* No typecode appears more than once in the sequence (no loops).
|
||||
* At most one conversion from integer to float or vice versa is present.
|
||||
* Either sign extensions or zero extensions may be present, but not both.
|
||||
* No widening conversions occur after a signed/unsigned conversion.
|
||||
* The sequence of sizes must be strict nonincreasing or nondecreasing. */
|
||||
static int
|
||||
conversion_reasonable_p (conversion, list)
|
||||
struct conversion_info *conversion;
|
||||
struct conversion_list *list;
|
||||
{
|
||||
struct conversion_list *curr;
|
||||
int curr_size, prev_size;
|
||||
int has_int_float, has_float_int;
|
||||
int has_sign_extend, has_zero_extend;
|
||||
int has_signed_unsigned, has_unsigned_signed;
|
||||
|
||||
has_int_float = 0;
|
||||
has_float_int = 0;
|
||||
has_sign_extend = 0;
|
||||
has_zero_extend = 0;
|
||||
has_signed_unsigned = 0;
|
||||
has_unsigned_signed = 0;
|
||||
|
||||
/* Make sure the destination typecode doesn't already appear in
|
||||
the list. */
|
||||
for (curr = list; curr; curr = curr->prev)
|
||||
if (conversion->to == curr->to)
|
||||
return 0;
|
||||
|
||||
/* Check for certain kinds of conversions. */
|
||||
if (TYPECODE_INTEGER_P (conversion->from)
|
||||
&& TYPECODE_FLOAT_P (conversion->to))
|
||||
has_int_float = 1;
|
||||
if (TYPECODE_FLOAT_P (conversion->from)
|
||||
&& TYPECODE_INTEGER_P (conversion->to))
|
||||
has_float_int = 1;
|
||||
if (TYPECODE_SIGNED_P (conversion->from)
|
||||
&& TYPECODE_SIGNED_P (conversion->to)
|
||||
&& GET_TYPECODE_SIZE (conversion->from)
|
||||
< GET_TYPECODE_SIZE (conversion->to))
|
||||
has_sign_extend = 1;
|
||||
if (TYPECODE_UNSIGNED_P (conversion->from)
|
||||
&& TYPECODE_UNSIGNED_P (conversion->to)
|
||||
&& GET_TYPECODE_SIZE (conversion->from)
|
||||
< GET_TYPECODE_SIZE (conversion->to))
|
||||
has_zero_extend = 1;
|
||||
|
||||
for (curr = list; curr && curr->prev; curr = curr->prev)
|
||||
{
|
||||
if (TYPECODE_INTEGER_P (curr->prev->to)
|
||||
&& TYPECODE_FLOAT_P (curr->to))
|
||||
has_int_float = 1;
|
||||
if (TYPECODE_FLOAT_P (curr->prev->to)
|
||||
&& TYPECODE_INTEGER_P (curr->to))
|
||||
has_float_int = 1;
|
||||
if (TYPECODE_SIGNED_P (curr->prev->to)
|
||||
&& TYPECODE_SIGNED_P (curr->to)
|
||||
&& GET_TYPECODE_SIZE (curr->prev->to)
|
||||
< GET_TYPECODE_SIZE (curr->to))
|
||||
has_sign_extend = 1;
|
||||
if (TYPECODE_UNSIGNED_P (curr->prev->to)
|
||||
&& TYPECODE_UNSIGNED_P (curr->to)
|
||||
&& GET_TYPECODE_SIZE (curr->prev->to)
|
||||
< GET_TYPECODE_SIZE (curr->to))
|
||||
has_zero_extend = 1;
|
||||
if (TYPECODE_SIGNED_P (curr->prev->to)
|
||||
&& TYPECODE_UNSIGNED_P (curr->to))
|
||||
has_signed_unsigned = 1;
|
||||
if (TYPECODE_UNSIGNED_P (curr->prev->to)
|
||||
&& TYPECODE_SIGNED_P (curr->to))
|
||||
has_unsigned_signed = 1;
|
||||
}
|
||||
|
||||
if (TYPECODE_INTEGER_P (conversion->from)
|
||||
&& TYPECODE_INTEGER_P (conversion->to)
|
||||
&& GET_TYPECODE_SIZE (conversion->to)
|
||||
> GET_TYPECODE_SIZE (conversion->from)
|
||||
&& (has_signed_unsigned || has_unsigned_signed))
|
||||
return 0;
|
||||
|
||||
if (has_float_int && has_int_float || has_sign_extend && has_zero_extend)
|
||||
return 0;
|
||||
|
||||
/* Make sure the sequence of destination typecode sizes is
|
||||
strictly nondecreasing or strictly nonincreasing. */
|
||||
prev_size = GET_TYPECODE_SIZE (conversion->to);
|
||||
for (curr = list; curr; curr = curr->prev)
|
||||
{
|
||||
curr_size = GET_TYPECODE_SIZE (curr->to);
|
||||
if (curr_size != prev_size)
|
||||
break;
|
||||
}
|
||||
if (!curr)
|
||||
return 1;
|
||||
|
||||
if (curr_size < prev_size)
|
||||
for (prev_size = curr_size; curr; curr = curr->prev)
|
||||
{
|
||||
curr_size = GET_TYPECODE_SIZE (curr->to);
|
||||
if (curr_size > prev_size)
|
||||
return 0;
|
||||
prev_size = curr_size;
|
||||
}
|
||||
else
|
||||
for (prev_size = curr_size; curr; curr = curr->prev)
|
||||
{
|
||||
curr_size = GET_TYPECODE_SIZE (curr->to);
|
||||
if (curr_size < prev_size)
|
||||
return 0;
|
||||
prev_size = curr_size;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Exhaustively search all reasonable conversions to find one to
|
||||
convert the given types. */
|
||||
static struct conversion_recipe
|
||||
deduce_conversion (from, to)
|
||||
enum typecode from, to;
|
||||
{
|
||||
struct rl
|
||||
{
|
||||
struct conversion_list *list;
|
||||
struct rl *next;
|
||||
} *prev, curr, *good, *temp;
|
||||
struct conversion_list *conv, *best;
|
||||
int i, cost, bestcost;
|
||||
struct conversion_recipe result;
|
||||
struct obstack recipe_obstack;
|
||||
|
||||
|
||||
obstack_init (&recipe_obstack);
|
||||
curr.next = (struct rl *) obstack_alloc (&recipe_obstack, sizeof (struct rl));
|
||||
curr.next->list =
|
||||
(struct conversion_list *) obstack_alloc (&recipe_obstack,
|
||||
sizeof (struct conversion_list));
|
||||
curr.next->list->opcode = -1;
|
||||
curr.next->list->to = from;
|
||||
curr.next->list->cost = 0;
|
||||
curr.next->list->prev = 0;
|
||||
curr.next->next = 0;
|
||||
good = 0;
|
||||
|
||||
while (curr.next)
|
||||
{
|
||||
/* Remove successful conversions from further consideration. */
|
||||
for (prev = &curr; prev; prev = prev->next)
|
||||
if (prev->next && prev->next->list->to == to)
|
||||
{
|
||||
temp = prev->next->next;
|
||||
prev->next->next = good;
|
||||
good = prev->next;
|
||||
prev->next = temp;
|
||||
}
|
||||
|
||||
/* Go through each of the pending conversion chains, trying
|
||||
all possible candidate conversions on them. */
|
||||
for (prev = curr.next, curr.next = 0; prev; prev = prev->next)
|
||||
for (i = 0; i < NUM_CONVERSIONS; ++i)
|
||||
if (conversion_info[i].from == prev->list->to
|
||||
&& conversion_reasonable_p (&conversion_info[i], prev->list))
|
||||
{
|
||||
temp = (struct rl *) obstack_alloc (&recipe_obstack,
|
||||
sizeof (struct rl));
|
||||
temp->list = (struct conversion_list *)
|
||||
obstack_alloc (&recipe_obstack,
|
||||
sizeof (struct conversion_list));
|
||||
temp->list->opcode = conversion_info[i].opcode;
|
||||
temp->list->to = conversion_info[i].to;
|
||||
temp->list->cost = conversion_info[i].cost;
|
||||
temp->list->prev = prev->list;
|
||||
temp->next = curr.next;
|
||||
curr.next = temp;
|
||||
}
|
||||
}
|
||||
|
||||
bestcost = BIG_ARBITRARY_NUMBER;
|
||||
best = 0;
|
||||
for (temp = good; temp; temp = temp->next)
|
||||
{
|
||||
for (conv = temp->list, cost = 0; conv; conv = conv->prev)
|
||||
cost += conv->cost;
|
||||
if (cost < bestcost)
|
||||
{
|
||||
bestcost = cost;
|
||||
best = temp->list;
|
||||
}
|
||||
}
|
||||
|
||||
if (!best)
|
||||
abort ();
|
||||
|
||||
for (i = 0, conv = best; conv; conv = conv->prev)
|
||||
if (conv->opcode != -1)
|
||||
++i;
|
||||
|
||||
result.opcodes = (unsigned char *) xmalloc (i);
|
||||
result.nopcodes = i;
|
||||
for (conv = best; conv; conv = conv->prev)
|
||||
if (conv->opcode != -1)
|
||||
result.opcodes[--i] = conv->opcode;
|
||||
result.cost = bestcost;
|
||||
obstack_free (&recipe_obstack, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define DEDUCE_CONVERSION(FROM, TO) \
|
||||
(conversion_recipe[(int) FROM][(int) TO].opcodes ? 0 \
|
||||
: (conversion_recipe[(int) FROM][(int) TO] \
|
||||
= deduce_conversion (FROM, TO), 0))
|
||||
|
||||
|
||||
/* Emit a conversion between the given scalar types. */
|
||||
void
|
||||
emit_typecode_conversion (from, to)
|
||||
enum typecode from, to;
|
||||
{
|
||||
int i;
|
||||
|
||||
DEDUCE_CONVERSION (from, to);
|
||||
for (i = 0; i < conversion_recipe[(int) from][(int) to].nopcodes; ++i)
|
||||
bc_emit_instruction (conversion_recipe[(int) from][(int) to].opcodes[i]);
|
||||
}
|
||||
|
||||
|
||||
/* Initialize mode_to_code_map[] */
|
||||
void
|
||||
bc_init_mode_to_code_map ()
|
||||
{
|
||||
int mode;
|
||||
|
||||
for (mode = 0; mode < MAX_MACHINE_MODE + 1; mode++)
|
||||
{
|
||||
signed_mode_to_code_map[mode] =
|
||||
unsigned_mode_to_code_map[mode] =
|
||||
LAST_AND_UNUSED_TYPECODE;
|
||||
}
|
||||
|
||||
#define DEF_MODEMAP(SYM, CODE, UCODE, CONST, LOAD, STORE) \
|
||||
{ signed_mode_to_code_map[(int) SYM] = CODE; \
|
||||
unsigned_mode_to_code_map[(int) SYM] = UCODE; }
|
||||
#include "modemap.def"
|
||||
#undef DEF_MODEMAP
|
||||
|
||||
/* Initialize opcode maps for const, load, and store */
|
||||
bc_init_mode_to_opcode_maps ();
|
||||
}
|
||||
|
||||
/* Given a machine mode return the preferred typecode. */
|
||||
enum typecode
|
||||
preferred_typecode (mode, unsignedp)
|
||||
enum machine_mode mode;
|
||||
int unsignedp;
|
||||
{
|
||||
enum typecode code = (unsignedp
|
||||
? unsigned_mode_to_code_map
|
||||
: signed_mode_to_code_map) [MIN ((int) mode,
|
||||
(int) MAX_MACHINE_MODE)];
|
||||
|
||||
if (code == LAST_AND_UNUSED_TYPECODE)
|
||||
abort ();
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
/* Expand a conversion between the given types. */
|
||||
void
|
||||
bc_expand_conversion (from, to)
|
||||
tree from, to;
|
||||
{
|
||||
enum typecode fcode, tcode;
|
||||
|
||||
fcode = preferred_typecode (TYPE_MODE (from), TREE_UNSIGNED (from));
|
||||
tcode = preferred_typecode (TYPE_MODE (to), TREE_UNSIGNED (to));
|
||||
|
||||
emit_typecode_conversion (fcode, tcode);
|
||||
}
|
||||
|
||||
/* Expand a conversion of the given type to a truth value. */
|
||||
void
|
||||
bc_expand_truth_conversion (from)
|
||||
tree from;
|
||||
{
|
||||
enum typecode fcode;
|
||||
|
||||
fcode = preferred_typecode (TYPE_MODE (from), TREE_UNSIGNED (from));
|
||||
emit_typecode_conversion (fcode, Tcode);
|
||||
}
|
||||
|
||||
/* Emit an appropriate binary operation. */
|
||||
void
|
||||
bc_expand_binary_operation (optab, resulttype, arg0, arg1)
|
||||
struct binary_operator optab[];
|
||||
tree resulttype, arg0, arg1;
|
||||
{
|
||||
int i, besti, cost, bestcost;
|
||||
enum typecode resultcode, arg0code, arg1code;
|
||||
|
||||
resultcode = preferred_typecode (TYPE_MODE (resulttype), TREE_UNSIGNED (resulttype));
|
||||
arg0code = preferred_typecode (TYPE_MODE (TREE_TYPE (arg0)), TREE_UNSIGNED (resulttype));
|
||||
arg1code = preferred_typecode (TYPE_MODE (TREE_TYPE (arg1)), TREE_UNSIGNED (resulttype));
|
||||
|
||||
besti = -1;
|
||||
bestcost = BIG_ARBITRARY_NUMBER;
|
||||
|
||||
for (i = 0; optab[i].opcode != -1; ++i)
|
||||
{
|
||||
cost = 0;
|
||||
DEDUCE_CONVERSION (arg0code, optab[i].arg0);
|
||||
cost += conversion_recipe[(int) arg0code][(int) optab[i].arg0].cost;
|
||||
DEDUCE_CONVERSION (arg1code, optab[i].arg1);
|
||||
cost += conversion_recipe[(int) arg1code][(int) optab[i].arg1].cost;
|
||||
if (cost < bestcost)
|
||||
{
|
||||
besti = i;
|
||||
bestcost = cost;
|
||||
}
|
||||
}
|
||||
|
||||
if (besti == -1)
|
||||
abort ();
|
||||
|
||||
expand_expr (arg1, 0, VOIDmode, 0);
|
||||
emit_typecode_conversion (arg1code, optab[besti].arg1);
|
||||
expand_expr (arg0, 0, VOIDmode, 0);
|
||||
emit_typecode_conversion (arg0code, optab[besti].arg0);
|
||||
bc_emit_instruction (optab[besti].opcode);
|
||||
emit_typecode_conversion (optab[besti].result, resultcode);
|
||||
}
|
||||
|
||||
/* Emit an appropriate unary operation. */
|
||||
void
|
||||
bc_expand_unary_operation (optab, resulttype, arg0)
|
||||
struct unary_operator optab[];
|
||||
tree resulttype, arg0;
|
||||
{
|
||||
int i, besti, cost, bestcost;
|
||||
enum typecode resultcode, arg0code;
|
||||
|
||||
resultcode = preferred_typecode (TYPE_MODE (resulttype), TREE_UNSIGNED (resulttype));
|
||||
arg0code = preferred_typecode (TYPE_MODE (TREE_TYPE (arg0)), TREE_UNSIGNED (TREE_TYPE (arg0)));
|
||||
|
||||
besti = -1;
|
||||
bestcost = BIG_ARBITRARY_NUMBER;
|
||||
|
||||
for (i = 0; optab[i].opcode != -1; ++i)
|
||||
{
|
||||
DEDUCE_CONVERSION (arg0code, optab[i].arg0);
|
||||
cost = conversion_recipe[(int) arg0code][(int) optab[i].arg0].cost;
|
||||
if (cost < bestcost)
|
||||
{
|
||||
besti = i;
|
||||
bestcost = cost;
|
||||
}
|
||||
}
|
||||
|
||||
if (besti == -1)
|
||||
abort ();
|
||||
|
||||
expand_expr (arg0, 0, VOIDmode, 0);
|
||||
emit_typecode_conversion (arg0code, optab[besti].arg0);
|
||||
bc_emit_instruction (optab[besti].opcode);
|
||||
emit_typecode_conversion (optab[besti].result, resultcode);
|
||||
}
|
||||
|
||||
|
||||
/* Emit an appropriate increment. */
|
||||
void
|
||||
bc_expand_increment (optab, type)
|
||||
struct increment_operator optab[];
|
||||
tree type;
|
||||
{
|
||||
enum typecode code;
|
||||
int i;
|
||||
|
||||
code = preferred_typecode (TYPE_MODE (type), TREE_UNSIGNED (type));
|
||||
for (i = 0; (int) optab[i].opcode >= 0; ++i)
|
||||
if (code == optab[i].arg)
|
||||
{
|
||||
bc_emit_instruction (optab[i].opcode);
|
||||
return;
|
||||
}
|
||||
abort ();
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/* Bytecode token definitions for GNU C-compiler.
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
extern void bc_expand_conversion ();
|
||||
extern void bc_expand_truth_conversion ();
|
||||
extern void bc_expand_binary_operation ();
|
||||
extern void bc_expand_unary_operation ();
|
||||
|
||||
struct binary_operator
|
||||
{
|
||||
enum bytecode_opcode opcode;
|
||||
enum typecode result;
|
||||
enum typecode arg0;
|
||||
enum typecode arg1;
|
||||
};
|
||||
|
||||
extern struct binary_operator optab_plus_expr[];
|
||||
extern struct binary_operator optab_minus_expr[];
|
||||
extern struct binary_operator optab_mult_expr[];
|
||||
extern struct binary_operator optab_trunc_div_expr[];
|
||||
extern struct binary_operator optab_trunc_mod_expr[];
|
||||
extern struct binary_operator optab_rdiv_expr[];
|
||||
extern struct binary_operator optab_bit_and_expr[];
|
||||
extern struct binary_operator optab_bit_ior_expr[];
|
||||
extern struct binary_operator optab_bit_xor_expr[];
|
||||
extern struct binary_operator optab_lshift_expr[];
|
||||
extern struct binary_operator optab_rshift_expr[];
|
||||
extern struct binary_operator optab_truth_and_expr[];
|
||||
extern struct binary_operator optab_truth_or_expr[];
|
||||
extern struct binary_operator optab_lt_expr[];
|
||||
extern struct binary_operator optab_le_expr[];
|
||||
extern struct binary_operator optab_ge_expr[];
|
||||
extern struct binary_operator optab_gt_expr[];
|
||||
extern struct binary_operator optab_eq_expr[];
|
||||
extern struct binary_operator optab_ne_expr[];
|
||||
|
||||
struct unary_operator
|
||||
{
|
||||
enum bytecode_opcode opcode;
|
||||
enum typecode result;
|
||||
enum typecode arg0;
|
||||
};
|
||||
|
||||
extern struct unary_operator optab_negate_expr[];
|
||||
extern struct unary_operator optab_bit_not_expr[];
|
||||
extern struct unary_operator optab_truth_not_expr[];
|
||||
|
||||
struct increment_operator
|
||||
{
|
||||
enum bytecode_opcode opcode;
|
||||
enum typecode arg;
|
||||
};
|
||||
|
||||
extern struct increment_operator optab_predecrement_expr[];
|
||||
extern struct increment_operator optab_preincrement_expr[];
|
||||
extern struct increment_operator optab_postdecrement_expr[];
|
||||
extern struct increment_operator optab_postincrement_expr[];
|
||||
@@ -1,21 +0,0 @@
|
||||
/* Typecodes used by the interpreter and their related
|
||||
machine modes and types.
|
||||
|
||||
The last argument is used for retrieving the given
|
||||
type from a varargs list. Due to a bug in varargs,
|
||||
the type has to be the generic machine type of
|
||||
larger. */
|
||||
|
||||
DEFTYPECODE (QIcode, "QI", QImode, SItype)
|
||||
DEFTYPECODE (QUcode, "QU", QImode, SUtype)
|
||||
DEFTYPECODE (HIcode, "HI", HImode, SItype)
|
||||
DEFTYPECODE (HUcode, "HU", HImode, SUtype)
|
||||
DEFTYPECODE (SIcode, "SI", SImode, SItype)
|
||||
DEFTYPECODE (SUcode, "SU", SImode, SUtype)
|
||||
DEFTYPECODE (DIcode, "DI", DImode, DItype)
|
||||
DEFTYPECODE (DUcode, "DU", DImode, DUtype)
|
||||
DEFTYPECODE (SFcode, "SF", SFmode, SFtype)
|
||||
DEFTYPECODE (DFcode, "DF", DFmode, DFtype)
|
||||
DEFTYPECODE (XFcode, "XF", XFmode, XFtype)
|
||||
DEFTYPECODE (Pcode, "P", PSImode, Ptype)
|
||||
DEFTYPECODE (Tcode, "T", SImode, SItype)
|
||||
@@ -1,54 +0,0 @@
|
||||
/* Typecode definitions for Bytecode Interpreter.
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef TYPECODE_H
|
||||
#define TYPECODE_H
|
||||
|
||||
enum typecode
|
||||
{
|
||||
#define DEFTYPECODE(CODE, NAME, MACHMODE, TYPE) CODE,
|
||||
#include "bc-typecd.def"
|
||||
#undef DEFTYPECODE
|
||||
|
||||
LAST_AND_UNUSED_TYPECODE
|
||||
};
|
||||
|
||||
/* Determine if a given type is integer. */
|
||||
#define TYPECODE_INTEGER_P(TYPECODE) ((int) (TYPECODE) < (int) SFcode)
|
||||
|
||||
/* Determine if a given type is unsigned. */
|
||||
#define TYPECODE_UNSIGNED_P(TYPECODE) \
|
||||
(TYPECODE_INTEGER_P(TYPECODE) && (int) (TYPECODE) & 1)
|
||||
|
||||
/* Determine if a given type is signed. */
|
||||
#define TYPECODE_SIGNED_P(TYPECODE) \
|
||||
(TYPECODE_INTEGER_P(TYPECODE) && !((int) (TYPECODE) & 1))
|
||||
|
||||
/* Determine if a given type is floating. */
|
||||
#define TYPECODE_FLOAT_P(TYPECODE) \
|
||||
((int) (TYPECODE) < (int) Pcode && !TYPECODE_INTEGER_P(TYPECODE))
|
||||
|
||||
/* Determine if the given type is arithmetic. */
|
||||
#define TYPECODE_ARITH_P(TYPECODE) \
|
||||
(TYPECODE_INTEGER_P(TYPECODE) || TYPECODE_FLOAT_P(TYPECODE))
|
||||
|
||||
#define NUM_TYPECODES ((int) LAST_AND_UNUSED_TYPECODE)
|
||||
|
||||
#endif
|
||||
@@ -1,80 +0,0 @@
|
||||
/* Bytecode Interpreter utility to generate arity table.
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "hconfig.h"
|
||||
#include "bi-defs.h"
|
||||
|
||||
int
|
||||
length (n)
|
||||
struct node *n;
|
||||
{
|
||||
int k;
|
||||
|
||||
for (k = 0; n; n = n->next)
|
||||
++k;
|
||||
return k;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
struct def *d;
|
||||
struct variation *v;
|
||||
struct node *n;
|
||||
|
||||
yyparse ();
|
||||
reverse ();
|
||||
|
||||
for (d = defs; d; d = d->next)
|
||||
for (v = d->variations; v; v = v->next)
|
||||
{
|
||||
printf ("{ %d, %d, %d, {", length (v->inputs),
|
||||
length (v->outputs), length (v->literals));
|
||||
for (n = v->literals; n; n = n->next)
|
||||
printf ("(char) %scode, ", n->text);
|
||||
if (v->literals == 0)
|
||||
printf ("0");
|
||||
printf ("}},\n");
|
||||
}
|
||||
|
||||
fflush (stdout);
|
||||
exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
|
||||
/* NOTREACHED */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Safely allocate NBYTES bytes of memory. Returns pointer to block of
|
||||
memory. */
|
||||
char *
|
||||
xmalloc (nbytes)
|
||||
int nbytes;
|
||||
{
|
||||
char *tmp = (char *) malloc (nbytes);
|
||||
|
||||
if (!tmp)
|
||||
{
|
||||
fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes);
|
||||
exit (FATAL_EXIT_CODE);
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/* Definitions for Bytecode Interpreter.
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
struct node
|
||||
{
|
||||
char *text;
|
||||
struct node *next;
|
||||
};
|
||||
|
||||
struct variation
|
||||
{
|
||||
char *name;
|
||||
int code;
|
||||
struct node *inputs;
|
||||
struct node *outputs;
|
||||
struct node *literals;
|
||||
struct variation *next;
|
||||
};
|
||||
|
||||
struct def
|
||||
{
|
||||
char *basename;
|
||||
char *template;
|
||||
struct variation *variations;
|
||||
struct def *next;
|
||||
};
|
||||
|
||||
extern struct def *defs;
|
||||
extern int ndefs;
|
||||
extern void reverse();
|
||||
@@ -1,167 +0,0 @@
|
||||
/* Lexer for scanner of bytecode definition file.
|
||||
Copyright (C) 1993, 1995 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "hconfig.h"
|
||||
#include "bi-parser.h"
|
||||
|
||||
|
||||
/* Safely allocate NBYTES bytes of memory. Returns pointer to block of
|
||||
memory. */
|
||||
|
||||
static char *
|
||||
xmalloc (nbytes)
|
||||
int nbytes;
|
||||
{
|
||||
char *tmp = (char *) malloc (nbytes);
|
||||
|
||||
if (!tmp)
|
||||
{
|
||||
fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes);
|
||||
exit (FATAL_EXIT_CODE);
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
/* Safely reallocate BLOCK so its size becomes NBYTES.
|
||||
The block returned may be different from the one supplied. */
|
||||
|
||||
static char *
|
||||
xrealloc (block, nbytes)
|
||||
char *block;
|
||||
int nbytes;
|
||||
{
|
||||
char *tmp = (block
|
||||
? (char *) realloc (block, nbytes)
|
||||
: (char *) malloc (nbytes));
|
||||
|
||||
if (!tmp)
|
||||
{
|
||||
fprintf (stderr, "can't reallocate %d bytes (out of virtual memory)\n", nbytes);
|
||||
exit (FATAL_EXIT_CODE);
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
/* Scan for string token on standard input. A string is, for our
|
||||
purposes here, a sequence of characters that starts with the regexp
|
||||
``[^ #\t\n(),]'' and is then followed by the regexp ``[^#(),]*''. Any
|
||||
character is accepted if preceded by a backslash, "\\". It is assumed
|
||||
that the first character has already been checked by the main loop. */
|
||||
|
||||
static char *
|
||||
scan_string ()
|
||||
{
|
||||
char *buffer = NULL;
|
||||
char *point = NULL;
|
||||
int buffer_size = 0;
|
||||
int c;
|
||||
|
||||
while ((c = getc (stdin)) != EOF
|
||||
&& c != '#' && c != '(' && c != ')' && c != ',')
|
||||
{
|
||||
/* Extend buffer, if necessary (minus two so there's room for the NUL
|
||||
trailer as well as another character if this one is a backslash). */
|
||||
if (!buffer_size || (point - buffer >= buffer_size-2))
|
||||
{
|
||||
int previous_point_index = point - buffer;
|
||||
|
||||
buffer_size = (!buffer_size ? 32 : buffer_size * 2);
|
||||
if (!buffer)
|
||||
buffer = xmalloc (buffer_size);
|
||||
else
|
||||
buffer = xrealloc (buffer, buffer_size);
|
||||
|
||||
point = buffer + previous_point_index;
|
||||
}
|
||||
*point++ = c & 0xff;
|
||||
|
||||
if (c == '\\')
|
||||
{
|
||||
c = getc (stdin);
|
||||
|
||||
/* Catch special case: backslash at end of file */
|
||||
if (c == EOF)
|
||||
break;
|
||||
|
||||
*point++ = c;
|
||||
}
|
||||
}
|
||||
*point = 0;
|
||||
|
||||
if (c != EOF)
|
||||
ungetc (c, stdin);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
yylex ()
|
||||
{
|
||||
int c;
|
||||
char *token;
|
||||
|
||||
|
||||
/* First char determines what token we're looking at */
|
||||
for (;;)
|
||||
{
|
||||
c = getc (stdin);
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case EOF:
|
||||
return 0;
|
||||
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
/* Ignore whitespace */
|
||||
continue;
|
||||
|
||||
case '#':
|
||||
/* Comments advance to next line */
|
||||
while ((c = getc (stdin)) != '\n' && c != EOF);
|
||||
continue;
|
||||
|
||||
default:
|
||||
if (c != '(' && c != ')' && c != '\\' && c != ',')
|
||||
{
|
||||
ungetc (c, stdin);
|
||||
yylval.string = scan_string ();
|
||||
|
||||
/* Check if string is "define_operator"; if so, return
|
||||
a DEFOP token instead. */
|
||||
if (!strcmp (yylval.string, "define_operator"))
|
||||
{
|
||||
free (yylval.string);
|
||||
yylval.string = 0;
|
||||
return DEFOP;
|
||||
}
|
||||
return STRING;
|
||||
}
|
||||
return c & 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/* Utility to generate opcode list from bytecode definition.
|
||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "hconfig.h"
|
||||
#include "bi-defs.h"
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
struct def *d;
|
||||
struct variation *v;
|
||||
int i;
|
||||
|
||||
yyparse();
|
||||
reverse();
|
||||
|
||||
|
||||
printf ("/* This file is automatically generated from bytecode.def,\n");
|
||||
printf ("do not make any changes here. Instead edit bytecode.def. */\n\n");
|
||||
printf ("enum bytecode_opcode\n{");
|
||||
|
||||
i = 0;
|
||||
for (d = defs; d; d = d->next)
|
||||
for (v = d->variations; v; v = v->next)
|
||||
{
|
||||
printf (" %s%s,\n", d->basename, v->name);
|
||||
++i;
|
||||
}
|
||||
|
||||
puts (" LAST_AND_UNUSED_OPCODE\n};");
|
||||
|
||||
if (i > 256)
|
||||
fprintf (stderr, "%s: warning, number of opcodes is %d\n", *argv, i);
|
||||
else
|
||||
fprintf (stderr, "(Number of opcodes is %d)\n", i);
|
||||
|
||||
fflush (stdout);
|
||||
exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
|
||||
/* NOTREACHED */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Safely allocate NBYTES bytes of memory. Returns pointer to block of
|
||||
memory. */
|
||||
char *
|
||||
xmalloc (nbytes)
|
||||
int nbytes;
|
||||
{
|
||||
char *tmp = (char *) malloc (nbytes);
|
||||
|
||||
if (!tmp)
|
||||
{
|
||||
fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes);
|
||||
exit (FATAL_EXIT_CODE);
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/* Utility to generate opcode name list from bytecode definition file.
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "hconfig.h"
|
||||
#include "bi-defs.h"
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
struct def *d;
|
||||
struct variation *v;
|
||||
|
||||
yyparse();
|
||||
reverse();
|
||||
|
||||
for (d = defs; d; d = d->next)
|
||||
for (v = d->variations; v; v = v->next)
|
||||
printf("\"%s%s\",\n", d->basename, v->name);
|
||||
|
||||
fflush (stdout);
|
||||
exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
|
||||
/* NOTREACHED */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Safely allocate NBYTES bytes of memory. Returns pointer to block of
|
||||
memory. */
|
||||
char *
|
||||
xmalloc (nbytes)
|
||||
int nbytes;
|
||||
{
|
||||
char *tmp = (char *) malloc (nbytes);
|
||||
|
||||
if (!tmp)
|
||||
{
|
||||
fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes);
|
||||
exit (FATAL_EXIT_CODE);
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
/* Bytecode definition file parser.
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
%{
|
||||
|
||||
#include <stdio.h>
|
||||
#include "hconfig.h"
|
||||
#include "bi-defs.h"
|
||||
|
||||
extern char yytext[];
|
||||
extern int yyleng;
|
||||
|
||||
|
||||
/* Chain of all defs built by the parser. */
|
||||
struct def *defs;
|
||||
int ndefs;
|
||||
|
||||
static struct node *makenode ();
|
||||
static struct variation *makevar ();
|
||||
static struct def *makedef ();
|
||||
|
||||
void yyerror ();
|
||||
|
||||
%}
|
||||
|
||||
%union
|
||||
{
|
||||
char *string;
|
||||
struct def *def;
|
||||
struct variation *variation;
|
||||
struct node *node;
|
||||
}
|
||||
|
||||
%token <string> DEFOP STRING
|
||||
%type <string> opt_string
|
||||
%type <def> defs def
|
||||
%type <variation> variations variation
|
||||
%type <node> list items item
|
||||
|
||||
%%
|
||||
|
||||
top:
|
||||
defs
|
||||
{ defs = $1; }
|
||||
;
|
||||
|
||||
defs:
|
||||
def
|
||||
| defs def
|
||||
{ $2->next = $1; $$ = $2; }
|
||||
;
|
||||
|
||||
def:
|
||||
DEFOP '(' STRING ',' opt_string ',' '(' variations ')' ')'
|
||||
{ $$ = makedef ($3, $5, $8); }
|
||||
;
|
||||
|
||||
variations:
|
||||
variation
|
||||
| variations ',' variation
|
||||
{ $3->next = $1; $$ = $3; }
|
||||
;
|
||||
|
||||
variation:
|
||||
'(' opt_string ')'
|
||||
{ $$ = makevar ($2, (struct node *) NULL, (struct node *) NULL, (struct node *) NULL); }
|
||||
| '(' opt_string ',' list ')'
|
||||
{ $$ = makevar ($2, $4, (struct node *) NULL, (struct node *) NULL); }
|
||||
| '(' opt_string ',' list ',' list ')'
|
||||
{ $$ = makevar ($2, $4, $6, (struct node *) NULL); }
|
||||
| '(' opt_string ',' list ',' list ',' list ')'
|
||||
{ $$ = makevar ($2, $4, $6, $8); }
|
||||
;
|
||||
|
||||
opt_string:
|
||||
/* empty */ { $$ = ""; }
|
||||
| STRING { $$ = $1; }
|
||||
;
|
||||
|
||||
list:
|
||||
'(' items ')'
|
||||
{ $$ = $2; }
|
||||
| /* empty */
|
||||
{ $$ = NULL; }
|
||||
;
|
||||
|
||||
items:
|
||||
item
|
||||
/* Note right recursion. */
|
||||
| item ',' items
|
||||
{ $1->next = $3; $$ = $1; }
|
||||
;
|
||||
|
||||
item:
|
||||
STRING
|
||||
{ $$ = makenode ($1); }
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
static struct node *
|
||||
makenode (s)
|
||||
char *s;
|
||||
{
|
||||
struct node *n;
|
||||
|
||||
n = (struct node *) malloc (sizeof (struct node));
|
||||
n->text = s;
|
||||
n->next = NULL;
|
||||
return n;
|
||||
}
|
||||
|
||||
static struct variation *
|
||||
makevar (name, inputs, outputs, literals)
|
||||
char *name;
|
||||
struct node *inputs, *outputs, *literals;
|
||||
{
|
||||
struct variation *v;
|
||||
|
||||
v = (struct variation *) malloc (sizeof (struct variation));
|
||||
v->name = name;
|
||||
v->code = ndefs++;
|
||||
v->inputs = inputs;
|
||||
v->outputs = outputs;
|
||||
v->literals = literals;
|
||||
v->next = NULL;
|
||||
return v;
|
||||
}
|
||||
|
||||
static struct def *
|
||||
makedef (name, template, vars)
|
||||
char *name, *template;
|
||||
struct variation *vars;
|
||||
{
|
||||
struct def *d;
|
||||
|
||||
d = (struct def *) malloc (sizeof (struct def));
|
||||
d->basename = name;
|
||||
d->template = template;
|
||||
d->variations = vars;
|
||||
d->next = NULL;
|
||||
return d;
|
||||
}
|
||||
|
||||
void
|
||||
yyerror (s)
|
||||
char *s;
|
||||
{
|
||||
fprintf (stderr, "syntax error in input\n");
|
||||
exit (FATAL_EXIT_CODE);
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/* Reverse order of definitions obtained from bytecode definition file.
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
#include "hconfig.h"
|
||||
#include "bi-defs.h"
|
||||
|
||||
void
|
||||
reverse()
|
||||
{
|
||||
struct def *dp, *d, *dn;
|
||||
struct variation *vp, *v, *vn;
|
||||
|
||||
dp = defs;
|
||||
if (dp)
|
||||
{
|
||||
vp = dp->variations;
|
||||
if (vp)
|
||||
{
|
||||
for (v = vp->next, vp->next = 0; v; vp = v, v = vn)
|
||||
{
|
||||
vn = v->next;
|
||||
v->next = vp;
|
||||
}
|
||||
dp->variations = vp;
|
||||
}
|
||||
for (d = dp->next, dp->next = 0; d; dp = d, d = dn)
|
||||
{
|
||||
vp = d->variations;
|
||||
if (vp)
|
||||
{
|
||||
for (v = vp->next, vp->next = 0; v; vp = v, v = vn)
|
||||
{
|
||||
vn = v->next;
|
||||
v->next = vp;
|
||||
}
|
||||
d->variations = vp;
|
||||
}
|
||||
dn = d->next;
|
||||
d->next = dp;
|
||||
}
|
||||
defs = dp;
|
||||
}
|
||||
}
|
||||
@@ -1,159 +0,0 @@
|
||||
/* Definitions for Bytecode Interpreter.
|
||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define MAXLITERALS 5
|
||||
|
||||
struct arityvec
|
||||
{
|
||||
char ninputs;
|
||||
char noutputs;
|
||||
char nliterals;
|
||||
char literals[MAXLITERALS];
|
||||
};
|
||||
|
||||
struct argtype
|
||||
{
|
||||
int modealign; /* Argument mode:alignment */
|
||||
int size; /* Argument size, in bytes */
|
||||
};
|
||||
|
||||
struct callinfo
|
||||
{
|
||||
int nargs; /* Number of arguments in call */
|
||||
struct argtype retvaltype; /* Type of return value */
|
||||
struct argtype argtypes[1]; /* Argument types */
|
||||
};
|
||||
|
||||
/* Structure describing a bytecode function. If this changes, we also
|
||||
need to change expand_function_end () in bc-trans.c */
|
||||
struct bytecode
|
||||
{
|
||||
int stacksize; /* Depth required of evaluation stack. */
|
||||
int localsize; /* Size in bytes of local variables. */
|
||||
unsigned char *pc0; /* Initial program counter. */
|
||||
void **ptrlit; /* Vector of (relocatable) pointer literals. */
|
||||
struct callinfo *callinfo; /* Vector of procedure call type info. */
|
||||
};
|
||||
|
||||
|
||||
#define INTERP_BPC 8 /* Bits per char */
|
||||
#define INTERP_BPI \
|
||||
(sizeof (int) * INTERP_BPC) /* Bits per int */
|
||||
|
||||
|
||||
#ifndef min
|
||||
#define min(L, R) ((L) < (R) ? (L) : (R))
|
||||
#endif
|
||||
|
||||
|
||||
/* bit field operations. */
|
||||
|
||||
/* Low (high) mask: int with low (high) N bits set */
|
||||
|
||||
#define LM(N) ((1 << (N)) - 1)
|
||||
#define HM(N) ((~LM (INTERP_BPI - (N))))
|
||||
|
||||
|
||||
/* Sign-extend SIZE low bits of VALUE to integer (typeof VALUE)
|
||||
Signed bitfields are loaded from memory by the sxloadBI instruction,
|
||||
which first retrieves the bitfield with XFIELD and then sign extends
|
||||
it to an SItype. */
|
||||
|
||||
#define EXTEND(SIZE, VALUE) \
|
||||
({ SUtype value = (SUtype) (VALUE); \
|
||||
(value & (1 << ((SIZE) - 1)) ? value | ~LM (SIZE) : value); })
|
||||
|
||||
|
||||
/* Given OFFSET:SIZE for a bitfield, calculate:
|
||||
|
||||
[1] BYTE_OFFSET = the byte offset of the bit field.
|
||||
[2] BIT_OFFSET = the bit offset of the bit field (less than INTERP_BPC).
|
||||
[3] NBYTES = the number of integral bytes in the bit field.
|
||||
[4] TRAILING_BITS= the number of trailing bits (less than INTERP_BPC).
|
||||
|
||||
|
||||
, , , , , (memory bytes)
|
||||
---------------- (bitfield)
|
||||
| | || | | (divisions)
|
||||
^ ^ ^ ^
|
||||
| | | |__ [4] (bits)
|
||||
| | |_________ [3] (bytes)
|
||||
| |_________________ [2] (bits)
|
||||
|___________________________ [1] (bytes)
|
||||
|
||||
|
||||
The above applies to BYTE_LOW_ENDIAN machines. In BYTE_BIG_ENDIAN machines, the
|
||||
bit numbering is reversed (i.e. bit 0 is the sign bit).
|
||||
|
||||
(All right, so I drew this to keep my tongue in cheek while writing the code below,
|
||||
not because I'm into ASCII art.) */
|
||||
|
||||
|
||||
#define BI_PARAMS(OFFSET, SIZE, BYTE_OFFSET, BIT_OFFSET, NBYTES, TRAILING_BITS) \
|
||||
{ BYTE_OFFSET = (OFFSET) / (INTERP_BPC); \
|
||||
BIT_OFFSET = (OFFSET) % (INTERP_BPC); \
|
||||
NBYTES = ((SIZE) - (INTERP_BPC - (BIT_OFFSET))) / INTERP_BPC; \
|
||||
if ((NBYTES) < 0 || ((NBYTES) > 64)) \
|
||||
NBYTES = 0; \
|
||||
if ((SIZE) + (BIT_OFFSET) <= INTERP_BPC) \
|
||||
TRAILING_BITS = 0; \
|
||||
else \
|
||||
TRAILING_BITS = ((SIZE) - (INTERP_BPC - (BIT_OFFSET))) % INTERP_BPC; }
|
||||
|
||||
|
||||
/* SHIFT_IN_BITS retrieves NBITS bits from SOURCE and shifts into
|
||||
DEST. The bit field starts OFFSET bits into SOURCE.
|
||||
|
||||
OR_IN_BITS copies the NBITS low bits from VALUE into a the bitfield in
|
||||
DEST offset by OFFSET bits. */
|
||||
|
||||
|
||||
#define SHIFT_IN_BITS(DEST, SOURCE, OFFSET, NBITS) \
|
||||
(DEST = ((DEST) << (NBITS)) \
|
||||
| (LM ((NBITS)) \
|
||||
& ((SOURCE) \
|
||||
>> (BYTES_BIG_ENDIAN \
|
||||
? (INTERP_BPC - (OFFSET) - (NBITS)) \
|
||||
: (OFFSET)))))
|
||||
|
||||
#define OR_IN_BITS(DEST, VALUE, OFFSET, NBITS) \
|
||||
(DEST = ((DEST) & ~(LM ((NBITS)) \
|
||||
<< (BIG_ENDIAN \
|
||||
? (INTERP_BPC - (OFFSET) - (NBITS)) \
|
||||
: (OFFSET))) \
|
||||
| (((VALUE) & LM ((NBITS))) \
|
||||
<< (BIG_ENDIAN \
|
||||
? (INTERP_BPC - (OFFSET) - (NBITS)) \
|
||||
: (OFFSET)))))
|
||||
|
||||
/* Procedure call; arguments are a pointer to the function to be called,
|
||||
a pointer to a place to store the return value, a pointer to a vector
|
||||
describing the type of procedure call, and the interpreter's stack pointer,
|
||||
which will point to the first of the arguments at this point. */
|
||||
|
||||
#define CALL(FUNC, CALLDESC, RETVAL, SP) __call(FUNC, CALLDESC, RETVAL, SP)
|
||||
|
||||
|
||||
/* Procedure return; arguments are a pointer to the calldesc for this
|
||||
function, and a pointer to the place where the value to be returned
|
||||
may be found. Generally the MACHARGS above contain a machine dependent
|
||||
cookie that is used to determine where to jump to. */
|
||||
|
||||
#define PROCRET(CALLDESC, RETVAL) return
|
||||
@@ -1,322 +0,0 @@
|
||||
# -*- C -*-
|
||||
# bytecode.def - definitions of bytecodes for the stack machine.
|
||||
|
||||
# The production of the bytecode interpreter and compiler is
|
||||
# heavily automated by using this file creatively.
|
||||
|
||||
# Various elementary data types are understood by the bytecode interpreter.
|
||||
# Q[IU] - quarter word (byte) signed and unsigned integers (char).
|
||||
# H[IU] - half word signed and unsigned integers (short int, maybe int).
|
||||
# S[IU] - single word signed and unsigned integers (maybe int, long int).
|
||||
# D[IU] - double word signed and unsigned integers (long long int).
|
||||
# SF - single precision floating point (float).
|
||||
# DF - double precision floating point (double).
|
||||
# XF - extended precision floating point (long double).
|
||||
# P - pointer type for address arithmetic and other purposes.
|
||||
|
||||
# The bytecode specification consists of a series of define_operator
|
||||
# forms, that are parsed by preprocessors to automatically build
|
||||
# various switch statements.
|
||||
# define_operator(name,
|
||||
# <C prototype code for implementing the operator>,
|
||||
# <list of variations>)
|
||||
# The <C prototype> is self explanatory.
|
||||
# The <list of variations> consists of a (parenthesized list) of
|
||||
# variation items, each of which is in itself a list. A variation
|
||||
# item consists of a name suffix, the types of the input arguments
|
||||
# expected on the stack (shallowest item first) and (optionally) the
|
||||
# types of the output arguments (similarly ordered). Finally, the
|
||||
# types of the literal arguments (if any) may appear.
|
||||
|
||||
# Substitution in the C prototype code is as follows:
|
||||
# Substitution happens only after a dollar sign. To get a literal
|
||||
# dollar sign (why would you ever want one anyway?) use $$.
|
||||
# $R1 means "result 1" $TR1 means "type name of result one"
|
||||
# $S1 means "source 1" and similarly with $TS1.
|
||||
# $L1 means "literal (inline) argument 1" and $TL1 means type thereof.
|
||||
#
|
||||
|
||||
# Notice that the number following $R doesn't affect the push order;
|
||||
# it's used only for clarity and orthogonality, although it's checked
|
||||
# to make sure it doesn't exceed the number of outputs. A $R reference
|
||||
# results in a push, and represents the result lvalue. E.g.
|
||||
|
||||
# $R1 = 2\, $R2 = 17
|
||||
# will expand to:
|
||||
# INTERP_PUSH($TR1) = 2, INTERP_PUSH($TR2) = 17
|
||||
#
|
||||
|
||||
# Opcode 0 should never happen.
|
||||
define_operator(neverneverland, abort\(\), (()))
|
||||
|
||||
# Stack manipulations.
|
||||
define_operator(drop, 0, ((, (SI))))
|
||||
define_operator(duplicate, 0, ((, (SI), (SI, SI))))
|
||||
define_operator(over, 0, ((, (SI), (SI, SI))))
|
||||
|
||||
# Adjust stack pointer
|
||||
|
||||
define_operator(setstack, 0, ((SI,,,(SI))))
|
||||
define_operator(adjstack, 0, ((SI,,,(SI))))
|
||||
|
||||
# Constants, loads, and stores.
|
||||
define_operator(const,
|
||||
$R1 = $L1,
|
||||
((QI,, (QI), (QI)), (HI,, (HI), (HI)),
|
||||
(SI,, (SI), (SI)), (DI,, (DI), (DI)),
|
||||
(SF,, (SF), (SF)), (DF,, (DF), (DF)),
|
||||
(XF,, (XF), (XF)), (P,, (P), (P))))
|
||||
define_operator(load,
|
||||
$R1 = *\($TR1 *\) $S1,
|
||||
((QI, (P), (QI)), (HI, (P), (HI)),
|
||||
(SI, (P), (SI)), (DI, (P), (DI)),
|
||||
(SF, (P), (SF)), (DF, (P), (DF)),
|
||||
(XF, (P), (XF)), (P, (P), (P))))
|
||||
define_operator(store,
|
||||
*\($TS2 *\) $S1 = $S2,
|
||||
((QI, (P, QI)), (HI, (P, HI)),
|
||||
(SI, (P, SI)), (DI, (P, DI)),
|
||||
(SF, (P, SF)), (DF, (P, DF)),
|
||||
(XF, (P, XF)), (P, (P, P)),
|
||||
(BLK, (SI, BLK, BLK))))
|
||||
|
||||
# Clear memory block
|
||||
|
||||
define_operator(clear, $S1 + $S2, ((BLK, (SI, BLK))))
|
||||
|
||||
|
||||
# Advance pointer by SI constant
|
||||
|
||||
define_operator(addconst, $R1 = $S1, ((PSI, (P), (P), (SI))))
|
||||
|
||||
|
||||
# newlocalSI is used for creating variable-sized storage during function
|
||||
# initialization.
|
||||
|
||||
# Create local space, return pointer to block
|
||||
|
||||
define_operator(newlocal, $R1 = $S1, ((SI, (SI), (P))))
|
||||
|
||||
|
||||
# Push the address of a local variable.
|
||||
define_operator(local, $R1 = locals + $L1, ((P,, (P), (SI))))
|
||||
|
||||
# Push the address of an argument variable.
|
||||
define_operator(arg, $R1 = args + $L1, ((P,, (P), (SI))))
|
||||
|
||||
# Arithmetic conversions.
|
||||
define_operator(convert,
|
||||
$R1 = \($TR1\) $S1,
|
||||
(# Signed integral promotions (sign extensions).
|
||||
(QIHI, (QI), (HI)), (HISI, (HI), (SI)), (SIDI, (SI), (DI)),
|
||||
(QISI, (QI), (SI)),
|
||||
# Unsigned integral promotions (zero extensions).
|
||||
(QUHU, (QU), (HU)), (HUSU, (HU), (SU)), (SUDU, (SU), (DU)),
|
||||
(QUSU, (QU), (SU)),
|
||||
# Floating promotions.
|
||||
(SFDF, (SF), (DF)), (DFXF, (DF), (XF)),
|
||||
# Integral truncation.
|
||||
(HIQI, (HI), (QI)), (SIHI, (SI), (HI)), (DISI, (DI), (SI)),
|
||||
(SIQI, (SI), (QI)),
|
||||
# Unsigned truncation.
|
||||
(SUQU, (SU), (QU)),
|
||||
# Floating truncation.
|
||||
(DFSF, (DF), (SF)), (XFDF, (XF), (DF)),
|
||||
# Integral conversions to floating types.
|
||||
(SISF, (SI), (SF)), (SIDF, (SI), (DF)), (SIXF, (SI), (XF)),
|
||||
(SUSF, (SU), (SF)), (SUDF, (SU), (DF)), (SUXF, (SU), (XF)),
|
||||
(DISF, (DI), (SF)), (DIDF, (DI), (DF)), (DIXF, (DI), (XF)),
|
||||
(DUSF, (DU), (SF)), (DUDF, (DU), (DF)), (DUXF, (DU), (XF)),
|
||||
# Floating conversions to integral types.
|
||||
(SFSI, (SF), (SI)), (DFSI, (DF), (SI)), (XFSI, (XF), (SI)),
|
||||
(SFSU, (SF), (SU)), (DFSU, (DF), (SU)), (XFSU, (XF), (SU)),
|
||||
(SFDI, (SF), (DI)), (DFDI, (DF), (DI)), (XFDI, (XF), (DI)),
|
||||
(SFDU, (SF), (DU)), (DFDU, (DF), (DU)), (XFDU, (XF), (DU)),
|
||||
# Pointer/integer conversions.
|
||||
(PSI, (P), (SI)), (SIP, (SI), (P))))
|
||||
|
||||
# Truth value conversion. These are necessary because conversions of, e.g.,
|
||||
# floating types to integers may not function correctly for large values.
|
||||
define_operator(convert,
|
||||
$R1 = !!$S1,
|
||||
((SIT, (SI), (T)), (DIT, (DI), (T)),
|
||||
(SFT, (SF), (T)), (DFT, (DF), (T)),
|
||||
(XFT, (XF), (T)), (PT, (P), (T))))
|
||||
|
||||
# Bit field load/store.
|
||||
|
||||
# Load and zero-extend bitfield
|
||||
|
||||
define_operator(zxload, $R1 = $S1, ((BI, (SU, SU, P), (SU))))
|
||||
|
||||
# Load and sign-extend bitfield
|
||||
|
||||
define_operator(sxload, $R1 = $S1, ((BI, (SU, SU, P), (SI))))
|
||||
|
||||
# Store integer in bitfield
|
||||
|
||||
define_operator(sstore, $R1 = $S1, ((BI, (SU, SU, P, SI))))
|
||||
|
||||
|
||||
# Binary operations.
|
||||
define_operator(add,
|
||||
$R1 = $S1 + $S2,
|
||||
((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)),
|
||||
(SF, (SF, SF), (SF)), (DF, (DF, DF), (DF)),
|
||||
(XF, (XF, XF), (XF)),
|
||||
(PSI, (P, SI), (P))))
|
||||
define_operator(sub,
|
||||
$R1 = $S1 - $S2,
|
||||
((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)),
|
||||
(SF, (SF, SF), (SF)), (DF, (DF, DF), (DF)),
|
||||
(XF, (XF, XF), (XF)),
|
||||
(PP, (P, P), (SI))))
|
||||
define_operator(mul,
|
||||
$R1 = $S1 * $S2,
|
||||
((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)),
|
||||
(SU, (SU, SU), (SU)), (DU, (DU, DU), (DU)),
|
||||
(SF, (SF, SF), (SF)), (DF, (DF, DF), (DF)),
|
||||
(XF, (XF, XF), (XF))))
|
||||
define_operator(div,
|
||||
$R1 = $S1 / $S2,
|
||||
((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)),
|
||||
(SU, (SU, SU), (SU)), (DU, (DU, DU), (DU)),
|
||||
(SF, (SF, SF), (SF)), (DF, (DF, DF), (DF)),
|
||||
(XF, (XF, XF), (XF))))
|
||||
define_operator(mod,
|
||||
$R1 = $S1 % $S2,
|
||||
((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)),
|
||||
(SU, (SU, SU), (SU)), (DU, (DU, DU), (DU))))
|
||||
define_operator(and,
|
||||
$R1 = $S1 & $S2,
|
||||
((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI))))
|
||||
define_operator(ior,
|
||||
$R1 = $S1 | $S2,
|
||||
((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI))))
|
||||
define_operator(xor,
|
||||
$R1 = $S1 ^ $S2,
|
||||
((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI))))
|
||||
define_operator(lshift,
|
||||
$R1 = $S1 << $S2,
|
||||
((SI, (SI, SI), (SI)), (SU, (SU, SI), (SU)),
|
||||
(DI, (DI, SI), (DI)), (DU, (DU, SI), (DU))))
|
||||
define_operator(rshift,
|
||||
$R1 = $S1 >> $S2,
|
||||
((SI, (SI, SI), (SI)), (SU, (SU, SI), (SU)),
|
||||
(DI, (DI, SI), (DI)), (DU, (DU, SI), (DU))))
|
||||
define_operator(lt,
|
||||
$R1 = $S1 < $S2,
|
||||
((SI, (SI, SI), (T)), (SU, (SU, SU), (T)),
|
||||
(DI, (DI, DI), (T)), (DU, (DU, DU), (T)),
|
||||
(SF, (SF, SF), (T)), (DF, (DF, DF), (T)),
|
||||
(XF, (XF, XF), (T)), (P, (P, P), (T))))
|
||||
define_operator(le,
|
||||
$R1 = $S1 <= $S2,
|
||||
((SI, (SI, SI), (T)), (SU, (SU, SU), (T)),
|
||||
(DI, (DI, DI), (T)), (DU, (DU, DU), (T)),
|
||||
(SF, (SF, SF), (T)), (DF, (DF, DF), (T)),
|
||||
(XF, (XF, XF), (T)), (P, (P, P), (T))))
|
||||
define_operator(ge,
|
||||
$R1 = $S1 >= $S2,
|
||||
((SI, (SI, SI), (T)), (SU, (SU, SU), (T)),
|
||||
(DI, (DI, DI), (T)), (DU, (DU, DU), (T)),
|
||||
(SF, (SF, SF), (T)), (DF, (DF, DF), (T)),
|
||||
(XF, (XF, XF), (T)), (P, (P, P), (T))))
|
||||
define_operator(gt,
|
||||
$R1 = $S1 > $S2,
|
||||
((SI, (SI, SI), (T)), (SU, (SU, SU), (T)),
|
||||
(DI, (DI, DI), (T)), (DU, (DU, DU), (T)),
|
||||
(SF, (SF, SF), (T)), (DF, (DF, DF), (T)),
|
||||
(XF, (XF, XF), (T)), (P, (P, P), (T))))
|
||||
define_operator(eq,
|
||||
$R1 = $S1 == $S2,
|
||||
((SI, (SI, SI), (T)), (DI, (DI, DI), (T)),
|
||||
(SF, (SF, SF), (T)), (DF, (DF, DF), (T)),
|
||||
(XF, (XF, XF), (T)), (P, (P, P), (T))))
|
||||
define_operator(ne,
|
||||
$R1 = $S1 != $S2,
|
||||
((SI, (SI, SI), (T)), (DI, (DI, DI), (T)),
|
||||
(SF, (SF, SF), (T)), (DF, (DF, DF), (T)),
|
||||
(XF, (XF, XF), (T)), (P, (P, P), (T))))
|
||||
|
||||
# Unary operations.
|
||||
define_operator(neg,
|
||||
$R1 = -$S1,
|
||||
((SI, (SI), (SI)), (DI, (DI), (DI)),
|
||||
(SF, (SF), (SF)), (DF, (DF), (DF)),
|
||||
(XF, (XF), (XF))))
|
||||
define_operator(not,
|
||||
$R1 = ~$S1,
|
||||
((SI, (SI), (SI)), (DI, (DI), (DI))))
|
||||
define_operator(not,
|
||||
$R1 = !$S1,
|
||||
((T, (SI), (SI))))
|
||||
|
||||
# Increment operations.
|
||||
define_operator(predec,
|
||||
$R1 = *\($TR1 *\) $S1 -= $S2,
|
||||
((QI, (P, QI), (QI)), (HI, (P, HI), (HI)),
|
||||
(SI, (P, SI), (SI)), (DI, (P, DI), (DI)),
|
||||
(P, (P, SI), (P)), (SF, (P, SF), (SF)),
|
||||
(DF, (P, DF), (DF)), (XF, (P, XF), (XF)),
|
||||
(BI, (SU, SU, P, SI), (SI))))
|
||||
|
||||
define_operator(preinc,
|
||||
$R1 = *\($TR1 *\) $S1 += $S2,
|
||||
((QI, (P, QI), (QI)), (HI, (P, HI), (HI)),
|
||||
(SI, (P, SI), (SI)), (DI, (P, DI), (DI)),
|
||||
(P, (P, SI), (P)), (SF, (P, SF), (SF)),
|
||||
(DF, (P, DF), (DF)), (XF, (P, XF), (XF)),
|
||||
(BI, (SU, SU, P, SI), (SI))))
|
||||
|
||||
define_operator(postdec,
|
||||
$R1 = *\($TR1 *\) $S1\, *\($TR1 *\) $S1 -= $S2,
|
||||
((QI, (P, QI), (QI)), (HI, (P, HI), (HI)),
|
||||
(SI, (P, SI), (SI)), (DI, (P, DI), (DI)),
|
||||
(P, (P, SI), (P)), (SF, (P, SF), (SF)),
|
||||
(DF, (P, DF), (DF)), (XF, (P, XF), (XF)),
|
||||
(BI, (SU, SU, P, SI), (SI))))
|
||||
|
||||
define_operator(postinc,
|
||||
$R1 = *\($TR1 *\) $S1\, *\($TR1 *\) $S1 += $S2,
|
||||
((QI, (P, QI), (QI)), (HI, (P, HI), (HI)),
|
||||
(SI, (P, SI), (SI)), (DI, (P, DI), (DI)),
|
||||
(P, (P, SI), (P)), (SF, (P, SF), (SF)),
|
||||
(DF, (P, DF), (DF)), (XF, (P, XF), (XF)),
|
||||
(BI, (SU, SU, P, SI), (SI))))
|
||||
|
||||
# Jumps.
|
||||
define_operator(xjumpif, if \($S1\) pc = code->pc0 + $L1, ((, (T),, (SI))))
|
||||
define_operator(xjumpifnot, if \(! $S1\) pc = code->pc0 + $L1, ((, (T),, (SI))))
|
||||
define_operator(jump, pc = code->pc0 + $L1, ((,,,(SI))))
|
||||
|
||||
# This is for GCC2. It jumps to the address on the stack.
|
||||
define_operator(jump, pc = \(void *\) $S1, ((P,,)))
|
||||
|
||||
# Switches. In order to (eventually) support ranges we provide four different
|
||||
# varieties of switches. Arguments are the switch index from the stack, the
|
||||
# bytecode offset of the switch table, the size of the switch table, and
|
||||
# the default label.
|
||||
define_operator(caseSI, CASESI\($S1\, $L1\, $L2\, $L3\), ((, (SI),, (SI, SI, SI))))
|
||||
define_operator(caseSU, CASESU\($S1\, $L1\, $L2\, $L3\), ((, (SU),, (SI, SI, SI))))
|
||||
define_operator(caseDI, CASEDI\($S1\, $L1\, $L2\, $L3\), ((, (DI),, (SI, SI, SI))))
|
||||
define_operator(caseDU, CASEDU\($S1\, $L1\, $L2\, $L3\), ((, (DU),, (SI, SI, SI))))
|
||||
|
||||
# Procedure call.
|
||||
# Stack arguments are (deepest first):
|
||||
# procedure arguments in reverse order.
|
||||
# pointer to the place to hold the return value.
|
||||
# address of the call description vector.
|
||||
# pointer to the procedure to be called.
|
||||
define_operator(call, CALL\($S1\, $S2\, $S3\, sp\), ((, (P, P, P))))
|
||||
|
||||
# Procedure return.
|
||||
# Pushes on interpreter stack:
|
||||
# value of retptr (pointer to return value storage slot)
|
||||
define_operator(return, $R1 = retptr, ((P,,(P))))
|
||||
|
||||
# Really return.
|
||||
define_operator(ret, return, (()))
|
||||
|
||||
# Print an obnoxious line number.
|
||||
define_operator(linenote, fprintf\(stderr\, "%d\\n"\, $L1\), ((,,,(SI))))
|
||||
@@ -1,81 +0,0 @@
|
||||
/* Bytecode definitions for GNU C-compiler.
|
||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
extern int output_bytecode;
|
||||
extern int stack_depth;
|
||||
extern int max_stack_depth;
|
||||
|
||||
/* Emit DI constant according to target machine word ordering */
|
||||
|
||||
#define bc_emit_bytecode_DI_const(CST) \
|
||||
{ int opcode; \
|
||||
opcode = (WORDS_BIG_ENDIAN \
|
||||
? TREE_INT_CST_HIGH (CST) \
|
||||
: TREE_INT_CST_LOW (CST)); \
|
||||
bc_emit_bytecode_const ((char *) &opcode, sizeof opcode); \
|
||||
opcode = (WORDS_BIG_ENDIAN \
|
||||
? TREE_INT_CST_LOW (CST) \
|
||||
: TREE_INT_CST_HIGH (CST)); \
|
||||
bc_emit_bytecode_const ((char *) &opcode, sizeof opcode); \
|
||||
}
|
||||
|
||||
extern void bc_expand_expr ();
|
||||
extern void bc_output_data_constructor ();
|
||||
extern void bc_store_field ();
|
||||
extern void bc_load_bit_field ();
|
||||
extern void bc_store_bit_field ();
|
||||
extern void bc_push_offset_and_size ();
|
||||
extern void bc_init_mode_to_code_map ();
|
||||
|
||||
/* These are just stubs, so the compiler will compile for targets
|
||||
that aren't yet supported by the bytecode generator. */
|
||||
|
||||
#ifndef TARGET_SUPPORTS_BYTECODE
|
||||
|
||||
#define MACHINE_SEG_ALIGN 1
|
||||
#define INT_ALIGN 1
|
||||
#define PTR_ALIGN 1
|
||||
#define NAMES_HAVE_UNDERSCORES
|
||||
#define BC_NOP (0)
|
||||
#define BC_GLOBALIZE_LABEL(FP, NAME) BC_NOP
|
||||
#define BC_OUTPUT_COMMON(FP, NAME, SIZE, ROUNDED) BC_NOP
|
||||
#define BC_OUTPUT_LOCAL(FP, NAME, SIZE, ROUNDED) BC_NOP
|
||||
#define BC_OUTPUT_ALIGN(FP, ALIGN) BC_NOP
|
||||
#define BC_OUTPUT_LABEL(FP, NAME) BC_NOP
|
||||
#define BC_OUTPUT_SKIP(FP, SIZE) BC_NOP
|
||||
#define BC_OUTPUT_LABELREF(FP, NAME) BC_NOP
|
||||
#define BC_OUTPUT_FLOAT(FP, VAL) BC_NOP
|
||||
#define BC_OUTPUT_DOUBLE(FP, VAL) BC_NOP
|
||||
#define BC_OUTPUT_BYTE(FP, VAL) BC_NOP
|
||||
#define BC_OUTPUT_FILE ASM_OUTPUT_FILE
|
||||
#define BC_OUTPUT_ASCII ASM_OUTPUT_ASCII
|
||||
#define BC_OUTPUT_IDENT ASM_OUTPUT_IDENT
|
||||
#define BCXSTR(RTX) ((RTX)->bc_label)
|
||||
#define BC_WRITE_FILE(FP) BC_NOP
|
||||
#define BC_WRITE_SEGSYM(SEGSYM, FP) BC_NOP
|
||||
#define BC_WRITE_RELOC_ENTRY(SEGRELOC, FP, OFFSET) BC_NOP
|
||||
#define BC_START_BYTECODE_LINE(FP) BC_NOP
|
||||
#define BC_WRITE_BYTECODE(SEP, VAL, FP) BC_NOP
|
||||
#define BC_WRITE_RTL(R, FP) BC_NOP
|
||||
#define BC_EMIT_TRAMPOLINE(TRAMPSEG, CALLINFO) BC_NOP
|
||||
#define VALIDATE_STACK BC_NOP
|
||||
|
||||
#endif /* !TARGET_SUPPORTS_BYTECODE */
|
||||
@@ -1,35 +0,0 @@
|
||||
/* These should come from genemit */
|
||||
|
||||
/* Use __signed__ in case compiling with -traditional. */
|
||||
|
||||
typedef __signed__ char QItype;
|
||||
typedef unsigned char QUtype;
|
||||
typedef __signed__ short int HItype;
|
||||
typedef unsigned short int HUtype;
|
||||
typedef __signed__ long int SItype;
|
||||
typedef unsigned long int SUtype;
|
||||
typedef __signed__ long long int DItype;
|
||||
typedef unsigned long long int DUtype;
|
||||
typedef float SFtype;
|
||||
typedef double DFtype;
|
||||
typedef long double XFtype;
|
||||
typedef char *Ptype;
|
||||
typedef int Ttype;
|
||||
|
||||
|
||||
typedef union stacktype
|
||||
{
|
||||
QItype QIval;
|
||||
QUtype QUval;
|
||||
HItype HIval;
|
||||
HUtype HUval;
|
||||
SItype SIval;
|
||||
SUtype SUval;
|
||||
DItype DIval;
|
||||
DUtype DUval;
|
||||
SFtype SFval;
|
||||
DFtype DFval;
|
||||
XFtype XFval;
|
||||
Ptype Pval;
|
||||
Ttype Tval;
|
||||
} stacktype;
|
||||
Vendored
-976
@@ -1,976 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script, version 1.1.
|
||||
# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc.
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
#
|
||||
# This file 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 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program 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 this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||
|
||||
# This file is supposed to be the same for all GNU packages
|
||||
# and recognize all the CPU types, system types and aliases
|
||||
# that are meaningful with *any* GNU software.
|
||||
# Each package is responsible for reporting which valid configurations
|
||||
# it does not support. The user should be able to distinguish
|
||||
# a failure to support a valid configuration from a meaningless
|
||||
# configuration.
|
||||
|
||||
# The goal of this file is to map all the various variations of a given
|
||||
# machine specification into a single specification in the form:
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or in some cases, the newer four-part form:
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# It is wrong to echo any other type of specification.
|
||||
|
||||
if [ x$1 = x ]
|
||||
then
|
||||
echo Configuration name missing. 1>&2
|
||||
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
|
||||
echo "or $0 ALIAS" 1>&2
|
||||
echo where ALIAS is a recognized configuration type. 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# First pass through any local machine types.
|
||||
case $1 in
|
||||
*local*)
|
||||
echo $1
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
linux-gnu*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
*)
|
||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
then os=`echo $1 | sed 's/.*-/-/'`
|
||||
else os=; fi
|
||||
;;
|
||||
esac
|
||||
|
||||
### Let's recognize common machines as not being operating systems so
|
||||
### that things like config.sub decstation-3100 work. We also
|
||||
### recognize some manufacturers as not being operating systems, so we
|
||||
### can provide default operating systems below.
|
||||
case $os in
|
||||
-sun*os*)
|
||||
# Prevent following clause from handling this invalid input.
|
||||
;;
|
||||
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
|
||||
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
|
||||
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
-sco5)
|
||||
os=-sco3.2v5
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco4)
|
||||
os=-sco3.2v4
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco3.2.[4-9]*)
|
||||
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco3.2v[4-9]*)
|
||||
# Don't forget version if it is 3.2v4 or newer.
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco*)
|
||||
os=-sco3.2v2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-isc)
|
||||
os=-isc2.2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-clix*)
|
||||
basic_machine=clipper-intergraph
|
||||
;;
|
||||
-isc*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-lynx*)
|
||||
os=-lynxos
|
||||
;;
|
||||
-ptx*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
|
||||
;;
|
||||
-windowsnt*)
|
||||
os=`echo $os | sed -e 's/windowsnt/winnt/'`
|
||||
;;
|
||||
-psos*)
|
||||
os=-psos
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode aliases for certain CPU-COMPANY combinations.
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
|
||||
| arme[lb] | pyramid | mn10200 | mn10300 \
|
||||
| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
|
||||
| alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
|
||||
| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
|
||||
| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
|
||||
| mipstx39 | mipstx39el \
|
||||
| sparc | sparclet | sparclite | sparc64 | v850)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
thumb | thumbel)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
i[34567]86)
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
*-*-*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
|
||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
||||
| power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
|
||||
| xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \
|
||||
| alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
|
||||
| ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
|
||||
| sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
|
||||
| sparc64-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| f301-*)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
||||
basic_machine=m68000-att
|
||||
;;
|
||||
3b*)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
alliant | fx80)
|
||||
basic_machine=fx80-alliant
|
||||
;;
|
||||
altos | altos3068)
|
||||
basic_machine=m68k-altos
|
||||
;;
|
||||
am29k)
|
||||
basic_machine=a29k-none
|
||||
os=-bsd
|
||||
;;
|
||||
amdahl)
|
||||
basic_machine=580-amdahl
|
||||
os=-sysv
|
||||
;;
|
||||
amiga | amiga-*)
|
||||
basic_machine=m68k-cbm
|
||||
;;
|
||||
amigaos | amigados)
|
||||
basic_machine=m68k-cbm
|
||||
os=-amigaos
|
||||
;;
|
||||
amigaunix | amix)
|
||||
basic_machine=m68k-cbm
|
||||
os=-sysv4
|
||||
;;
|
||||
apollo68)
|
||||
basic_machine=m68k-apollo
|
||||
os=-sysv
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
;;
|
||||
balance)
|
||||
basic_machine=ns32k-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
convex-c1)
|
||||
basic_machine=c1-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c2)
|
||||
basic_machine=c2-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c32)
|
||||
basic_machine=c32-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c34)
|
||||
basic_machine=c34-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c38)
|
||||
basic_machine=c38-convex
|
||||
os=-bsd
|
||||
;;
|
||||
cray | ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cray2)
|
||||
basic_machine=cray2-cray
|
||||
os=-unicos
|
||||
;;
|
||||
[ctj]90-cray)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
|
||||
basic_machine=mips-dec
|
||||
;;
|
||||
delta | 3300 | motorola-3300 | motorola-delta \
|
||||
| 3300-motorola | delta-motorola)
|
||||
basic_machine=m68k-motorola
|
||||
;;
|
||||
delta88)
|
||||
basic_machine=m88k-motorola
|
||||
os=-sysv3
|
||||
;;
|
||||
dpx20 | dpx20-*)
|
||||
basic_machine=rs6000-bull
|
||||
os=-bosx
|
||||
;;
|
||||
dpx2* | dpx2*-bull)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv3
|
||||
;;
|
||||
ebmon29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-ebmon
|
||||
;;
|
||||
elxsi)
|
||||
basic_machine=elxsi-elxsi
|
||||
os=-bsd
|
||||
;;
|
||||
encore | umax | mmax)
|
||||
basic_machine=ns32k-encore
|
||||
;;
|
||||
fx2800)
|
||||
basic_machine=i860-alliant
|
||||
;;
|
||||
genix)
|
||||
basic_machine=ns32k-ns
|
||||
;;
|
||||
gmicro)
|
||||
basic_machine=tron-gmicro
|
||||
os=-sysv
|
||||
;;
|
||||
h3050r* | hiux*)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
h8300hms)
|
||||
basic_machine=h8300-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
harris)
|
||||
basic_machine=m88k-harris
|
||||
os=-sysv3
|
||||
;;
|
||||
hp300-*)
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp300bsd)
|
||||
basic_machine=m68k-hp
|
||||
os=-bsd
|
||||
;;
|
||||
hp300hpux)
|
||||
basic_machine=m68k-hp
|
||||
os=-hpux
|
||||
;;
|
||||
hp9k2[0-9][0-9] | hp9k31[0-9])
|
||||
basic_machine=m68000-hp
|
||||
;;
|
||||
hp9k3[2-9][0-9])
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp9k6[0-9][0-9] | hp6[0-9][0-9] )
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
hp9k7[0-79][0-9] | hp7[0-79][0-9] )
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k78[0-9] | hp78[0-9] )
|
||||
# FIXME: really hppa2.0-hp
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | \
|
||||
hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893 )
|
||||
# FIXME: really hppa2.0-hp
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][13679] | hp8[0-9][13679] )
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
hppa-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i[34567]86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
;;
|
||||
i[34567]86v4*)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv4
|
||||
;;
|
||||
i[34567]86v)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv
|
||||
;;
|
||||
i[34567]86sol2)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-solaris2
|
||||
;;
|
||||
iris | iris4d)
|
||||
basic_machine=mips-sgi
|
||||
case $os in
|
||||
-irix*)
|
||||
;;
|
||||
*)
|
||||
os=-irix4
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
isi68 | isi)
|
||||
basic_machine=m68k-isi
|
||||
os=-sysv
|
||||
;;
|
||||
m88k-omron*)
|
||||
basic_machine=m88k-omron
|
||||
;;
|
||||
magnum | m3230)
|
||||
basic_machine=mips-mips
|
||||
os=-sysv
|
||||
;;
|
||||
merlin)
|
||||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
mipsel*-linux*)
|
||||
basic_machine=mipsel-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
mips*-linux*)
|
||||
basic_machine=mips-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
mips3*-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
||||
;;
|
||||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
;;
|
||||
news | news700 | news800 | news900)
|
||||
basic_machine=m68k-sony
|
||||
os=-newsos
|
||||
;;
|
||||
news1000)
|
||||
basic_machine=m68030-sony
|
||||
os=-newsos
|
||||
;;
|
||||
news-3600 | risc-news)
|
||||
basic_machine=mips-sony
|
||||
os=-newsos
|
||||
;;
|
||||
next | m*-next )
|
||||
basic_machine=m68k-next
|
||||
case $os in
|
||||
-nextstep* )
|
||||
;;
|
||||
-ns2*)
|
||||
os=-nextstep2
|
||||
;;
|
||||
*)
|
||||
os=-nextstep3
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
nh3000)
|
||||
basic_machine=m68k-harris
|
||||
os=-cxux
|
||||
;;
|
||||
nh[45]000)
|
||||
basic_machine=m88k-harris
|
||||
os=-cxux
|
||||
;;
|
||||
nindy960)
|
||||
basic_machine=i960-intel
|
||||
os=-nindy
|
||||
;;
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
pa-hitachi)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
paragon)
|
||||
basic_machine=i860-intel
|
||||
os=-osf
|
||||
;;
|
||||
pbd)
|
||||
basic_machine=sparc-tti
|
||||
;;
|
||||
pbb)
|
||||
basic_machine=m68k-tti
|
||||
;;
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5 | k5 | nexen)
|
||||
basic_machine=i586-pc
|
||||
;;
|
||||
pentiumpro | p6 | k6 | 6x86)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentiumii | pentium2)
|
||||
basic_machine=i786-pc
|
||||
;;
|
||||
pentium-* | p5-* | k5-* | nexen-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-* | k6-* | 6x86-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumii-* | pentium2-*)
|
||||
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
power) basic_machine=rs6000-ibm
|
||||
;;
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
;;
|
||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||
basic_machine=powerpcle-unknown
|
||||
;;
|
||||
ppcle-* | powerpclittle-*)
|
||||
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ps2)
|
||||
basic_machine=i386-ibm
|
||||
;;
|
||||
rm[46]00)
|
||||
basic_machine=mips-siemens
|
||||
;;
|
||||
rtpc | rtpc-*)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
sequent)
|
||||
basic_machine=i386-sequent
|
||||
;;
|
||||
sh)
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sps7)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv2
|
||||
;;
|
||||
spur)
|
||||
basic_machine=spur-unknown
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
sun2os3)
|
||||
basic_machine=m68000-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun2os4)
|
||||
basic_machine=m68000-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun3os3)
|
||||
basic_machine=m68k-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun3os4)
|
||||
basic_machine=m68k-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun4os3)
|
||||
basic_machine=sparc-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun4os4)
|
||||
basic_machine=sparc-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun4sol2)
|
||||
basic_machine=sparc-sun
|
||||
os=-solaris2
|
||||
;;
|
||||
sun3 | sun3-*)
|
||||
basic_machine=m68k-sun
|
||||
;;
|
||||
sun4)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
sun386 | sun386i | roadrunner)
|
||||
basic_machine=i386-sun
|
||||
;;
|
||||
symmetry)
|
||||
basic_machine=i386-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
tx39)
|
||||
basic_machine=mipstx39-unknown
|
||||
;;
|
||||
tx39el)
|
||||
basic_machine=mipstx39el-unknown
|
||||
;;
|
||||
tower | tower-32)
|
||||
basic_machine=m68k-ncr
|
||||
;;
|
||||
udi29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
ultra3)
|
||||
basic_machine=a29k-nyu
|
||||
os=-sym1
|
||||
;;
|
||||
vaxv)
|
||||
basic_machine=vax-dec
|
||||
os=-sysv
|
||||
;;
|
||||
vms)
|
||||
basic_machine=vax-dec
|
||||
os=-vms
|
||||
;;
|
||||
vpp*|vx|vx-*)
|
||||
basic_machine=f301-fujitsu
|
||||
;;
|
||||
vxworks960)
|
||||
basic_machine=i960-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
vxworks68)
|
||||
basic_machine=m68k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
vxworks29k)
|
||||
basic_machine=a29k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
xmp)
|
||||
basic_machine=xmp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
none)
|
||||
basic_machine=none-none
|
||||
os=-none
|
||||
;;
|
||||
|
||||
# Here we handle the default manufacturer of certain CPU types. It is in
|
||||
# some cases the only manufacturer, in others, it is the most popular.
|
||||
mips)
|
||||
if [ x$os = x-linux-gnu ]; then
|
||||
basic_machine=mips-unknown
|
||||
else
|
||||
basic_machine=mips-mips
|
||||
fi
|
||||
;;
|
||||
romp)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
rs6000)
|
||||
basic_machine=rs6000-ibm
|
||||
;;
|
||||
vax)
|
||||
basic_machine=vax-dec
|
||||
;;
|
||||
pdp11)
|
||||
basic_machine=pdp11-dec
|
||||
;;
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sparc)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
basic_machine=cydra-cydrome
|
||||
;;
|
||||
orion)
|
||||
basic_machine=orion-highlevel
|
||||
;;
|
||||
orion105)
|
||||
basic_machine=clipper-highlevel
|
||||
;;
|
||||
*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Here we canonicalize certain aliases for manufacturers.
|
||||
case $basic_machine in
|
||||
*-digital*)
|
||||
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
|
||||
;;
|
||||
*-commodore*)
|
||||
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode manufacturer-specific aliases for certain operating systems.
|
||||
|
||||
if [ x"$os" != x"" ]
|
||||
then
|
||||
case $os in
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# -solaris* is a basic system type, with this one exception.
|
||||
-solaris1 | -solaris1.*)
|
||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||
;;
|
||||
-solaris)
|
||||
os=-solaris2
|
||||
;;
|
||||
-svr4*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-unixware*)
|
||||
os=-sysv4.2uw
|
||||
;;
|
||||
-gnu/linux*)
|
||||
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
|
||||
;;
|
||||
# First accept the basic system types.
|
||||
# The portable systems comes first.
|
||||
# Each alternative MUST END IN A *, to match a version number.
|
||||
# -sysv* is not here because it comes later, after sysvr4.
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv* | -beos* )
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
;;
|
||||
-sunos5*)
|
||||
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
||||
;;
|
||||
-sunos6*)
|
||||
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
||||
;;
|
||||
-osfrose*)
|
||||
os=-osfrose
|
||||
;;
|
||||
-osf*)
|
||||
os=-osf
|
||||
;;
|
||||
-utek*)
|
||||
os=-bsd
|
||||
;;
|
||||
-dynix*)
|
||||
os=-bsd
|
||||
;;
|
||||
-acis*)
|
||||
os=-aos
|
||||
;;
|
||||
-ctix* | -uts*)
|
||||
os=-sysv
|
||||
;;
|
||||
-ns2 )
|
||||
os=-nextstep2
|
||||
;;
|
||||
# Preserve the version number of sinix5.
|
||||
-sinix5.*)
|
||||
os=`echo $os | sed -e 's|sinix|sysv|'`
|
||||
;;
|
||||
-sinix*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-triton*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-oss*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-svr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
-svr3)
|
||||
os=-sysv3
|
||||
;;
|
||||
-sysvr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
# This must come after -sysvr4.
|
||||
-sysv*)
|
||||
;;
|
||||
-xenix)
|
||||
os=-xenix
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
# Get rid of the `-' at the beginning of $os.
|
||||
os=`echo $os | sed 's/[^-]*-//'`
|
||||
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
|
||||
# Here we handle the default operating systems that come with various machines.
|
||||
# The value should be what the vendor currently ships out the door with their
|
||||
# machine or put another way, the most popular os provided with the machine.
|
||||
|
||||
# Note that if you're going to try to match "-MANUFACTURER" here (say,
|
||||
# "-sun"), then you have to tell the case statement up towards the top
|
||||
# that MANUFACTURER isn't an operating system. Otherwise, code above
|
||||
# will signal an error saying that MANUFACTURER isn't an operating
|
||||
# system, and we'll never get to this point.
|
||||
|
||||
case $basic_machine in
|
||||
*-acorn)
|
||||
os=-riscix1.2
|
||||
;;
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
pdp11-*)
|
||||
os=-none
|
||||
;;
|
||||
*-dec | vax-*)
|
||||
os=-ultrix4.2
|
||||
;;
|
||||
m68*-apollo)
|
||||
os=-domain
|
||||
;;
|
||||
i386-sun)
|
||||
os=-sunos4.0.2
|
||||
;;
|
||||
m68000-sun)
|
||||
os=-sunos3
|
||||
# This also exists in the configure program, but was not the
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=-sysv3
|
||||
;;
|
||||
sparc-* | *-sun)
|
||||
os=-sunos4.1.1
|
||||
;;
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-hp)
|
||||
os=-hpux
|
||||
;;
|
||||
*-hitachi)
|
||||
os=-hiux
|
||||
;;
|
||||
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
|
||||
os=-sysv
|
||||
;;
|
||||
*-cbm)
|
||||
os=-amigaos
|
||||
;;
|
||||
*-dg)
|
||||
os=-dgux
|
||||
;;
|
||||
*-dolphin)
|
||||
os=-sysv3
|
||||
;;
|
||||
m68k-ccur)
|
||||
os=-rtu
|
||||
;;
|
||||
m88k-omron*)
|
||||
os=-luna
|
||||
;;
|
||||
*-next )
|
||||
os=-nextstep
|
||||
;;
|
||||
*-sequent)
|
||||
os=-ptx
|
||||
;;
|
||||
*-crds)
|
||||
os=-unos
|
||||
;;
|
||||
*-ns)
|
||||
os=-genix
|
||||
;;
|
||||
i370-*)
|
||||
os=-mvs
|
||||
;;
|
||||
*-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
*-gould)
|
||||
os=-sysv
|
||||
;;
|
||||
*-highlevel)
|
||||
os=-bsd
|
||||
;;
|
||||
*-encore)
|
||||
os=-bsd
|
||||
;;
|
||||
*-sgi)
|
||||
os=-irix
|
||||
;;
|
||||
*-siemens)
|
||||
os=-sysv4
|
||||
;;
|
||||
*-masscomp)
|
||||
os=-rtu
|
||||
;;
|
||||
f301-fujitsu)
|
||||
os=-uxpv
|
||||
;;
|
||||
*-be)
|
||||
os=-beos
|
||||
;;
|
||||
*)
|
||||
os=-none
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Here we handle the case where we know the os, and the CPU type, but not the
|
||||
# manufacturer. We pick the logical manufacturer.
|
||||
vendor=unknown
|
||||
case $basic_machine in
|
||||
*-unknown)
|
||||
case $os in
|
||||
-riscix*)
|
||||
vendor=acorn
|
||||
;;
|
||||
-sunos*)
|
||||
vendor=sun
|
||||
;;
|
||||
-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-hpux*)
|
||||
vendor=hp
|
||||
;;
|
||||
-hiux*)
|
||||
vendor=hitachi
|
||||
;;
|
||||
-unos*)
|
||||
vendor=crds
|
||||
;;
|
||||
-dgux*)
|
||||
vendor=dg
|
||||
;;
|
||||
-luna*)
|
||||
vendor=omron
|
||||
;;
|
||||
-genix*)
|
||||
vendor=ns
|
||||
;;
|
||||
-mvs*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
vendor=sequent
|
||||
;;
|
||||
-vxsim* | -vxworks*)
|
||||
vendor=wrs
|
||||
;;
|
||||
-aux*)
|
||||
vendor=apple
|
||||
;;
|
||||
-beos*)
|
||||
vendor=be
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
esac
|
||||
|
||||
echo $basic_machine$os
|
||||
+4128
-548
File diff suppressed because it is too large.
Load diff
@@ -1,26 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for DEC Alpha, using
|
||||
encapsulated stabs and OSF V1.2.
|
||||
Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
Contributed by Richard Kenner ([email protected])
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "alpha/osf12.h"
|
||||
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
@@ -1,26 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for DEC Alpha, using
|
||||
encapsulated stabs.
|
||||
Copyright (C) 1992, 1993 Free Software Foundation, Inc.
|
||||
Contributed by Peter Schauer ([email protected]).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "alpha/osf2.h"
|
||||
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
@@ -1,26 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for DEC Alpha, using
|
||||
encapsulated stabs.
|
||||
Copyright (C) 1992, 1993 Free Software Foundation, Inc.
|
||||
Contributed by Peter Schauer ([email protected]).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "alpha/alpha.h"
|
||||
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
@@ -1,32 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for DEC Alpha.
|
||||
Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||
Contributed by Richard Kenner ([email protected])
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
#include "alpha/alpha.h"
|
||||
|
||||
/* In OSF 2.0, the size of wchar_t was changed from short unsigned
|
||||
to unsigned int. */
|
||||
|
||||
#undef WCHAR_TYPE
|
||||
#define WCHAR_TYPE "unsigned int"
|
||||
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
#define WCHAR_TYPE_SIZE 32
|
||||
@@ -1 +1,2 @@
|
||||
CLIB=-lmld
|
||||
EXTRA_HEADERS = $(srcdir)/config/alpha/va_list.h
|
||||
@@ -41,12 +41,18 @@ Boston, MA 02111-1307, USA. */
|
||||
#define SUCCESS_EXIT_CODE 0
|
||||
#define FATAL_EXIT_CODE 33
|
||||
|
||||
/* If not compiled with GNU C, use the builtin alloca. */
|
||||
#if !defined(__GNUC__) && !defined(_WIN32)
|
||||
/* If compiled with GNU C, use the builtin alloca. */
|
||||
#ifndef alloca
|
||||
#if defined(__GNUC__) && !defined(USE_C_ALLOCA)
|
||||
#define alloca __builtin_alloca
|
||||
#else
|
||||
#if !defined(_WIN32) && !defined(USE_C_ALLOCA) && !defined(OPEN_VMS) && !defined(__INTERIX)
|
||||
#include <alloca.h>
|
||||
#else
|
||||
extern void *alloca ();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* The host compiler has problems with enum bitfields since it makes
|
||||
them signed so we can't fit all our codes in. */
|
||||
@@ -65,14 +71,6 @@ extern void *malloc (), *realloc (), *calloc ();
|
||||
#include "string.h"
|
||||
#endif
|
||||
|
||||
/* OSF/1 has vprintf. */
|
||||
|
||||
#define HAVE_VPRINTF
|
||||
|
||||
/* OSF/1 has putenv. */
|
||||
|
||||
#define HAVE_PUTENV
|
||||
|
||||
/* OSF/1 is POSIX.1 compliant. */
|
||||
|
||||
#define POSIX
|
||||
@@ -1,96 +0,0 @@
|
||||
/* Configuration for an i386 running MS-DOS with djgpp/go32. */
|
||||
|
||||
#include "dbxcoff.h"
|
||||
|
||||
/* Don't assume anything about the header files. */
|
||||
#define NO_IMPLICIT_EXTERN_C
|
||||
|
||||
#define HANDLE_SYSV_PRAGMA
|
||||
|
||||
#define YES_UNDERSCORES
|
||||
|
||||
#include "i386/gas.h"
|
||||
|
||||
#ifdef CPP_PREDEFINES
|
||||
#undef CPP_PREDEFINES
|
||||
#endif
|
||||
#define CPP_PREDEFINES "-Dunix -Di386 -DGO32 -DMSDOS \
|
||||
-Asystem(unix) -Asystem(msdos) -Acpu(i386) -Amachine(i386)"
|
||||
|
||||
#undef EXTRA_SECTIONS
|
||||
#define EXTRA_SECTIONS in_ctor, in_dtor
|
||||
|
||||
#undef EXTRA_SECTION_FUNCTIONS
|
||||
#define EXTRA_SECTION_FUNCTIONS \
|
||||
CTOR_SECTION_FUNCTION \
|
||||
DTOR_SECTION_FUNCTION
|
||||
|
||||
#define CTOR_SECTION_FUNCTION \
|
||||
void \
|
||||
ctor_section () \
|
||||
{ \
|
||||
if (in_section != in_ctor) \
|
||||
{ \
|
||||
fprintf (asm_out_file, "\t.section .ctor\n"); \
|
||||
in_section = in_ctor; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DTOR_SECTION_FUNCTION \
|
||||
void \
|
||||
dtor_section () \
|
||||
{ \
|
||||
if (in_section != in_dtor) \
|
||||
{ \
|
||||
fprintf (asm_out_file, "\t.section .dtor\n"); \
|
||||
in_section = in_dtor; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
|
||||
do { \
|
||||
ctor_section (); \
|
||||
fprintf (FILE, "%s\t", ASM_LONG); \
|
||||
assemble_name (FILE, NAME); \
|
||||
fprintf (FILE, "\n"); \
|
||||
} while (0)
|
||||
|
||||
/* Allow (eg) __attribute__((section "locked")) to work */
|
||||
#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC)\
|
||||
do { \
|
||||
fprintf (FILE, "\t.section %s\n", NAME); \
|
||||
} while (0)
|
||||
|
||||
#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
|
||||
do { \
|
||||
dtor_section (); \
|
||||
fprintf (FILE, "%s\t", ASM_LONG); \
|
||||
assemble_name (FILE, NAME); \
|
||||
fprintf (FILE, "\n"); \
|
||||
} while (0)
|
||||
|
||||
/* Output at beginning of assembler file. */
|
||||
/* The .file command should always begin the output. */
|
||||
/* Use the main_input_filename instead of dump_base_name */
|
||||
|
||||
#undef ASM_FILE_START
|
||||
#define ASM_FILE_START(FILE) \
|
||||
do { \
|
||||
output_file_directive (FILE, main_input_filename); \
|
||||
} while (0)
|
||||
|
||||
/* This is how to output an assembler line
|
||||
that says to advance the location counter
|
||||
to a multiple of 2**LOG bytes. */
|
||||
|
||||
#undef ASM_OUTPUT_ALIGN
|
||||
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
|
||||
if ((LOG) != 0) fprintf ((FILE), "\t.p2align %d\n", LOG)
|
||||
|
||||
/* djgpp has atexit (). */
|
||||
#undef HAVE_ATEXIT
|
||||
#define HAVE_ATEXIT
|
||||
|
||||
/* djgpp automatically calls its own version of __main, so don't define one
|
||||
in libgcc, nor call one in main(). */
|
||||
#define HAS_INIT_SECTION
|
||||
@@ -1,67 +0,0 @@
|
||||
/* Definitions for Intel 386 running Interactive Unix System V,
|
||||
producing stabs-in-coff output (using a slightly modified gas).
|
||||
Specifically, this is for recent versions that support POSIX;
|
||||
for version 2.0.2, use configuration option i386-sysv instead. */
|
||||
|
||||
/* Underscores are not used on ISC systems (probably not on any COFF
|
||||
system), despite the comments in i386/gas.h. If this is not defined,
|
||||
enquire (for example) will fail to link. [email protected] */
|
||||
#define NO_UNDERSCORES
|
||||
|
||||
/* Mostly like other gas-using systems. */
|
||||
#include "i386/gas.h"
|
||||
|
||||
/* But with ISC-specific additions. */
|
||||
#include "i386/isc.h"
|
||||
|
||||
/* We do not want to output SDB debugging information. */
|
||||
|
||||
#undef SDB_DEBUGGING_INFO
|
||||
|
||||
/* We want to output DBX debugging information. */
|
||||
|
||||
#define DBX_DEBUGGING_INFO
|
||||
|
||||
|
||||
/* The function `dbxout_init' in dbxout.c omits the first character of
|
||||
`ltext_label_name' when outputting the main source directory and main
|
||||
source filename. I don't understand why, but rather than making a
|
||||
system-independent change there, I override dbxout.c's defaults.
|
||||
Perhaps it would be better to use ".Ltext0" instead of
|
||||
`ltext_label_name', but we've already generated the label, so we just
|
||||
use it here. [email protected] */
|
||||
#define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(asmfile, cwd) \
|
||||
do { fprintf (asmfile, "%s ", ASM_STABS_OP); \
|
||||
output_quoted_string (asmfile, cwd); \
|
||||
fprintf (asmfile, ",%d,0,0,%s\n", N_SO, ltext_label_name); \
|
||||
} while (0)
|
||||
#define DBX_OUTPUT_MAIN_SOURCE_FILENAME(asmfile, input_file_name) \
|
||||
fprintf (asmfile, "%s ", ASM_STABS_OP); \
|
||||
output_quoted_string (input_file_name); \
|
||||
fprintf (asmfile, ",%d,0,0,%s\n", N_SO, ltext_label_name); \
|
||||
text_section (); \
|
||||
ASM_OUTPUT_INTERNAL_LABEL (asmfile, "Ltext", 0)
|
||||
|
||||
|
||||
/* Because we don't include `svr3.h', we haven't yet defined SIZE_TYPE
|
||||
and PTRDIFF_TYPE. ISC's definitions don't match GCC's defaults, so: */
|
||||
|
||||
#undef SIZE_TYPE
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
#define PTRDIFF_TYPE "int"
|
||||
|
||||
|
||||
/* But we can't use crtbegin.o and crtend.o, because gas 1.38.1 doesn't
|
||||
grok .section. The definitions here are otherwise identical to those
|
||||
in i386/isc.h. */
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC \
|
||||
"%{!shlib:%{posix:%{pg:mcrtp1.o%s}%{!pg:%{p:mcrtp1.o%s}%{!p:crtp1.o%s}}}\
|
||||
%{!posix:%{pg:mcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}\
|
||||
%{p:-L/lib/libp} %{pg:-L/lib/libp}}}\
|
||||
%{shlib:%{posix:crtp1.o%s}%{!posix:crt1.o%s}}"
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC "crtn.o%s"
|
||||
@@ -1,7 +0,0 @@
|
||||
/* next.c: Functions for NeXT as target machine for GNU C compiler. */
|
||||
|
||||
/* Note that the include below means that we can't debug routines in
|
||||
i386.c when running on a COFF system. */
|
||||
|
||||
#include "i386/i386.c"
|
||||
#include "nextstep.c"
|
||||
@@ -1,7 +0,0 @@
|
||||
/* Target definitions for GNU compiler for Intel 80386 running System V.4
|
||||
with gas and gdb. */
|
||||
|
||||
/* Use stabs instead of DWARF debug format. */
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
|
||||
#include "i386/sysv4.h"
|
||||
@@ -1,2 +0,0 @@
|
||||
# The one that comes with the system is POSIX-compliant.
|
||||
LIMITS_H =
|
||||
@@ -1,4 +0,0 @@
|
||||
# Don't run fixproto
|
||||
STMP_FIXPROTO =
|
||||
# Use only native include files
|
||||
USER_H =
|
||||
@@ -1,4 +0,0 @@
|
||||
/* Configuration for GCC for Intel i386 running NetBSD as host. */
|
||||
|
||||
#include <i386/xm-i386.h>
|
||||
#include <xm-netbsd.h>
|
||||
@@ -1,26 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SPARC using a.out.
|
||||
Copyright (C) 1994, 1996 Free Software Foundation, Inc.
|
||||
Contributed by Michael Tiemann ([email protected]).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "sparc/sparc.h" /* SPARC definitions */
|
||||
#include "aoutos.h" /* A.out definitions */
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dsparc -Acpu(sparc) -Amachine(sparc)"
|
||||
@@ -1,7 +0,0 @@
|
||||
#include "sparc/sparc.h"
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:gcrt0.o%s}%{!p:crt0.o%s}}"
|
||||
@@ -1,58 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler,
|
||||
for SPARC running in an embedded environment using the ELF file format.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "sol2.h"
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dsparc -D__elf__ -Acpu(sparc) -Amachine(sparc)"
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
|
||||
|
||||
/* Use the default. */
|
||||
#undef LINK_SPEC
|
||||
|
||||
/* Don't set the target flags, this is done by the linker script */
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC ""
|
||||
|
||||
/* FIXME: until fixed */
|
||||
#undef LONG_DOUBLE_TYPE_SIZE
|
||||
#define LONG_DOUBLE_TYPE_SIZE 64
|
||||
|
||||
/* This solaris2 define does not apply. */
|
||||
#undef STDC_0_IN_SYSTEM_HEADERS
|
||||
|
||||
/* We don't want to use the Solaris2 specific long long int conversion
|
||||
routines. */
|
||||
#undef INIT_SUBTARGET_OPTABS
|
||||
#define INIT_SUBTARGET_OPTABS
|
||||
|
||||
/* ??? We haven't added Solaris2 equivalent 64 bit library routines to
|
||||
lb1sp*.asm, so we need to avoid using them. */
|
||||
#undef MULDI3_LIBCALL
|
||||
#undef DIVDI3_LIBCALL
|
||||
#undef UDIVDI3_LIBCALL
|
||||
#undef MODDI3_LIBCALL
|
||||
#undef UMODDI3_LIBCALL
|
||||
@@ -1,425 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Mangled into a form that works on Sparc Solaris 2 by Mark Eichin
|
||||
* for Cygnus Support, July 1992.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
|
||||
#if 0
|
||||
#include "sparc/gmon.h"
|
||||
#else
|
||||
struct phdr {
|
||||
char *lpc;
|
||||
char *hpc;
|
||||
int ncnt;
|
||||
};
|
||||
#define HISTFRACTION 2
|
||||
#define HISTCOUNTER unsigned short
|
||||
#define HASHFRACTION 1
|
||||
#define ARCDENSITY 2
|
||||
#define MINARCS 50
|
||||
struct tostruct {
|
||||
char *selfpc;
|
||||
long count;
|
||||
unsigned short link;
|
||||
};
|
||||
struct rawarc {
|
||||
unsigned long raw_frompc;
|
||||
unsigned long raw_selfpc;
|
||||
long raw_count;
|
||||
};
|
||||
#define ROUNDDOWN(x,y) (((x)/(y))*(y))
|
||||
#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y))
|
||||
|
||||
#endif
|
||||
|
||||
/* extern mcount() asm ("mcount"); */
|
||||
/*extern*/ char *minbrk /* asm ("minbrk") */;
|
||||
|
||||
/*
|
||||
* froms is actually a bunch of unsigned shorts indexing tos
|
||||
*/
|
||||
static int profiling = 3;
|
||||
static unsigned short *froms;
|
||||
static struct tostruct *tos = 0;
|
||||
static long tolimit = 0;
|
||||
static char *s_lowpc = 0;
|
||||
static char *s_highpc = 0;
|
||||
static unsigned long s_textsize = 0;
|
||||
|
||||
static int ssiz;
|
||||
static char *sbuf;
|
||||
static int s_scale;
|
||||
/* see profil(2) where this is describe (incorrectly) */
|
||||
#define SCALE_1_TO_1 0x10000L
|
||||
|
||||
#define MSG "No space for profiling buffer(s)\n"
|
||||
|
||||
static void moncontrol PROTO ((int));
|
||||
extern void monstartup PROTO ((char *, char *));
|
||||
extern void _mcleanup PROTO ((void));
|
||||
|
||||
void monstartup(lowpc, highpc)
|
||||
char *lowpc;
|
||||
char *highpc;
|
||||
{
|
||||
int monsize;
|
||||
char *buffer;
|
||||
register int o;
|
||||
|
||||
/*
|
||||
* round lowpc and highpc to multiples of the density we're using
|
||||
* so the rest of the scaling (here and in gprof) stays in ints.
|
||||
*/
|
||||
lowpc = (char *)
|
||||
ROUNDDOWN((unsigned)lowpc, HISTFRACTION*sizeof(HISTCOUNTER));
|
||||
s_lowpc = lowpc;
|
||||
highpc = (char *)
|
||||
ROUNDUP((unsigned)highpc, HISTFRACTION*sizeof(HISTCOUNTER));
|
||||
s_highpc = highpc;
|
||||
s_textsize = highpc - lowpc;
|
||||
monsize = (s_textsize / HISTFRACTION) + sizeof(struct phdr);
|
||||
buffer = sbrk( monsize );
|
||||
if ( buffer == (char *) -1 ) {
|
||||
write( 2 , MSG , sizeof(MSG) );
|
||||
return;
|
||||
}
|
||||
froms = (unsigned short *) sbrk( s_textsize / HASHFRACTION );
|
||||
if ( froms == (unsigned short *) -1 ) {
|
||||
write( 2 , MSG , sizeof(MSG) );
|
||||
froms = 0;
|
||||
return;
|
||||
}
|
||||
tolimit = s_textsize * ARCDENSITY / 100;
|
||||
if ( tolimit < MINARCS ) {
|
||||
tolimit = MINARCS;
|
||||
} else if ( tolimit > 65534 ) {
|
||||
tolimit = 65534;
|
||||
}
|
||||
tos = (struct tostruct *) sbrk( tolimit * sizeof( struct tostruct ) );
|
||||
if ( tos == (struct tostruct *) -1 ) {
|
||||
write( 2 , MSG , sizeof(MSG) );
|
||||
froms = 0;
|
||||
tos = 0;
|
||||
return;
|
||||
}
|
||||
minbrk = sbrk(0);
|
||||
tos[0].link = 0;
|
||||
sbuf = buffer;
|
||||
ssiz = monsize;
|
||||
( (struct phdr *) buffer ) -> lpc = lowpc;
|
||||
( (struct phdr *) buffer ) -> hpc = highpc;
|
||||
( (struct phdr *) buffer ) -> ncnt = ssiz;
|
||||
monsize -= sizeof(struct phdr);
|
||||
if ( monsize <= 0 )
|
||||
return;
|
||||
o = highpc - lowpc;
|
||||
if( monsize < o )
|
||||
#ifndef hp300
|
||||
s_scale = ( (float) monsize / o ) * SCALE_1_TO_1;
|
||||
#else /* avoid floating point */
|
||||
{
|
||||
int quot = o / monsize;
|
||||
|
||||
if (quot >= 0x10000)
|
||||
s_scale = 1;
|
||||
else if (quot >= 0x100)
|
||||
s_scale = 0x10000 / quot;
|
||||
else if (o >= 0x800000)
|
||||
s_scale = 0x1000000 / (o / (monsize >> 8));
|
||||
else
|
||||
s_scale = 0x1000000 / ((o << 8) / monsize);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
s_scale = SCALE_1_TO_1;
|
||||
moncontrol(1);
|
||||
}
|
||||
|
||||
void
|
||||
_mcleanup()
|
||||
{
|
||||
int fd;
|
||||
int fromindex;
|
||||
int endfrom;
|
||||
char *frompc;
|
||||
int toindex;
|
||||
struct rawarc rawarc;
|
||||
char *profdir;
|
||||
const char *proffile;
|
||||
char *progname;
|
||||
char buf[PATH_MAX];
|
||||
extern char **___Argv;
|
||||
|
||||
moncontrol(0);
|
||||
|
||||
if ((profdir = getenv("PROFDIR")) != NULL) {
|
||||
/* If PROFDIR contains a null value, no profiling output is produced */
|
||||
if (*profdir == '\0') {
|
||||
return;
|
||||
}
|
||||
|
||||
progname=strrchr(___Argv[0], '/');
|
||||
if (progname == NULL)
|
||||
progname=___Argv[0];
|
||||
else
|
||||
progname++;
|
||||
|
||||
sprintf(buf, "%s/%ld.%s", profdir, getpid(), progname);
|
||||
proffile = buf;
|
||||
} else {
|
||||
proffile = "gmon.out";
|
||||
}
|
||||
|
||||
fd = creat( proffile, 0666 );
|
||||
if ( fd < 0 ) {
|
||||
perror( proffile );
|
||||
return;
|
||||
}
|
||||
# ifdef DEBUG
|
||||
fprintf( stderr , "[mcleanup] sbuf 0x%x ssiz %d\n" , sbuf , ssiz );
|
||||
# endif DEBUG
|
||||
write( fd , sbuf , ssiz );
|
||||
endfrom = s_textsize / (HASHFRACTION * sizeof(*froms));
|
||||
for ( fromindex = 0 ; fromindex < endfrom ; fromindex++ ) {
|
||||
if ( froms[fromindex] == 0 ) {
|
||||
continue;
|
||||
}
|
||||
frompc = s_lowpc + (fromindex * HASHFRACTION * sizeof(*froms));
|
||||
for (toindex=froms[fromindex]; toindex!=0; toindex=tos[toindex].link) {
|
||||
# ifdef DEBUG
|
||||
fprintf( stderr ,
|
||||
"[mcleanup] frompc 0x%x selfpc 0x%x count %d\n" ,
|
||||
frompc , tos[toindex].selfpc , tos[toindex].count );
|
||||
# endif DEBUG
|
||||
rawarc.raw_frompc = (unsigned long) frompc;
|
||||
rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc;
|
||||
rawarc.raw_count = tos[toindex].count;
|
||||
write( fd , &rawarc , sizeof rawarc );
|
||||
}
|
||||
}
|
||||
close( fd );
|
||||
}
|
||||
|
||||
/*
|
||||
* The Sparc stack frame is only held together by the frame pointers
|
||||
* in the register windows. According to the SVR4 SPARC ABI
|
||||
* Supplement, Low Level System Information/Operating System
|
||||
* Interface/Software Trap Types, a type 3 trap will flush all of the
|
||||
* register windows to the stack, which will make it possible to walk
|
||||
* the frames and find the return addresses.
|
||||
* However, it seems awfully expensive to incur a trap (system
|
||||
* call) for every function call. It turns out that "call" simply puts
|
||||
* the return address in %o7 expecting the "save" in the procedure to
|
||||
* shift it into %i7; this means that before the "save" occurs, %o7
|
||||
* contains the address of the call to mcount, and %i7 still contains
|
||||
* the caller above that. The asm mcount here simply saves those
|
||||
* registers in argument registers and branches to internal_mcount,
|
||||
* simulating a call with arguments.
|
||||
* Kludges:
|
||||
* 1) the branch to internal_mcount is hard coded; it should be
|
||||
* possible to tell asm to use the assembler-name of a symbol.
|
||||
* 2) in theory, the function calling mcount could have saved %i7
|
||||
* somewhere and reused the register; in practice, I *think* this will
|
||||
* break longjmp (and maybe the debugger) but I'm not certain. (I take
|
||||
* some comfort in the knowledge that it will break the native mcount
|
||||
* as well.)
|
||||
* 3) if builtin_return_address worked, this could be portable.
|
||||
* However, it would really have to be optimized for arguments of 0
|
||||
* and 1 and do something like what we have here in order to avoid the
|
||||
* trap per function call performance hit.
|
||||
* 4) the atexit and monsetup calls prevent this from simply
|
||||
* being a leaf routine that doesn't do a "save" (and would thus have
|
||||
* access to %o7 and %i7 directly) but the call to write() at the end
|
||||
* would have also prevented this.
|
||||
*
|
||||
* -- [eichin:19920702.1107EST]
|
||||
*/
|
||||
|
||||
static void internal_mcount PROTO((char *, unsigned short *)) ATTRIBUTE_UNUSED;
|
||||
|
||||
/* i7 == last ret, -> frompcindex */
|
||||
/* o7 == current ret, -> selfpc */
|
||||
/* Solaris 2 libraries use _mcount. */
|
||||
asm(".global _mcount; _mcount: mov %i7,%o1; mov %o7,%o0;b,a internal_mcount");
|
||||
/* This is for compatibility with old versions of gcc which used mcount. */
|
||||
asm(".global mcount; mcount: mov %i7,%o1; mov %o7,%o0;b,a internal_mcount");
|
||||
|
||||
static void internal_mcount(selfpc, frompcindex)
|
||||
register char *selfpc;
|
||||
register unsigned short *frompcindex;
|
||||
{
|
||||
register struct tostruct *top;
|
||||
register struct tostruct *prevtop;
|
||||
register long toindex;
|
||||
static char already_setup;
|
||||
|
||||
/*
|
||||
* find the return address for mcount,
|
||||
* and the return address for mcount's caller.
|
||||
*/
|
||||
|
||||
if(!already_setup) {
|
||||
extern char etext[];
|
||||
already_setup = 1;
|
||||
monstartup(0, (char *)etext);
|
||||
#ifdef USE_ONEXIT
|
||||
on_exit(_mcleanup, 0);
|
||||
#else
|
||||
atexit(_mcleanup);
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* check that we are profiling
|
||||
* and that we aren't recursively invoked.
|
||||
*/
|
||||
if (profiling) {
|
||||
goto out;
|
||||
}
|
||||
profiling++;
|
||||
/*
|
||||
* check that frompcindex is a reasonable pc value.
|
||||
* for example: signal catchers get called from the stack,
|
||||
* not from text space. too bad.
|
||||
*/
|
||||
frompcindex = (unsigned short *)((long)frompcindex - (long)s_lowpc);
|
||||
if ((unsigned long)frompcindex > s_textsize) {
|
||||
goto done;
|
||||
}
|
||||
frompcindex =
|
||||
&froms[((long)frompcindex) / (HASHFRACTION * sizeof(*froms))];
|
||||
toindex = *frompcindex;
|
||||
if (toindex == 0) {
|
||||
/*
|
||||
* first time traversing this arc
|
||||
*/
|
||||
toindex = ++tos[0].link;
|
||||
if (toindex >= tolimit) {
|
||||
goto overflow;
|
||||
}
|
||||
*frompcindex = toindex;
|
||||
top = &tos[toindex];
|
||||
top->selfpc = selfpc;
|
||||
top->count = 1;
|
||||
top->link = 0;
|
||||
goto done;
|
||||
}
|
||||
top = &tos[toindex];
|
||||
if (top->selfpc == selfpc) {
|
||||
/*
|
||||
* arc at front of chain; usual case.
|
||||
*/
|
||||
top->count++;
|
||||
goto done;
|
||||
}
|
||||
/*
|
||||
* have to go looking down chain for it.
|
||||
* top points to what we are looking at,
|
||||
* prevtop points to previous top.
|
||||
* we know it is not at the head of the chain.
|
||||
*/
|
||||
for (; /* goto done */; ) {
|
||||
if (top->link == 0) {
|
||||
/*
|
||||
* top is end of the chain and none of the chain
|
||||
* had top->selfpc == selfpc.
|
||||
* so we allocate a new tostruct
|
||||
* and link it to the head of the chain.
|
||||
*/
|
||||
toindex = ++tos[0].link;
|
||||
if (toindex >= tolimit) {
|
||||
goto overflow;
|
||||
}
|
||||
top = &tos[toindex];
|
||||
top->selfpc = selfpc;
|
||||
top->count = 1;
|
||||
top->link = *frompcindex;
|
||||
*frompcindex = toindex;
|
||||
goto done;
|
||||
}
|
||||
/*
|
||||
* otherwise, check the next arc on the chain.
|
||||
*/
|
||||
prevtop = top;
|
||||
top = &tos[top->link];
|
||||
if (top->selfpc == selfpc) {
|
||||
/*
|
||||
* there it is.
|
||||
* increment its count
|
||||
* move it to the head of the chain.
|
||||
*/
|
||||
top->count++;
|
||||
toindex = prevtop->link;
|
||||
prevtop->link = top->link;
|
||||
top->link = *frompcindex;
|
||||
*frompcindex = toindex;
|
||||
goto done;
|
||||
}
|
||||
|
||||
}
|
||||
done:
|
||||
profiling--;
|
||||
/* and fall through */
|
||||
out:
|
||||
return; /* normal return restores saved registers */
|
||||
|
||||
overflow:
|
||||
profiling++; /* halt further profiling */
|
||||
# define TOLIMIT "mcount: tos overflow\n"
|
||||
write(2, TOLIMIT, sizeof(TOLIMIT));
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Control profiling
|
||||
* profiling is what mcount checks to see if
|
||||
* all the data structures are ready.
|
||||
*/
|
||||
static void moncontrol(mode)
|
||||
int mode;
|
||||
{
|
||||
if (mode) {
|
||||
/* start */
|
||||
profil((unsigned short *)(sbuf + sizeof(struct phdr)),
|
||||
ssiz - sizeof(struct phdr),
|
||||
(int)s_lowpc, s_scale);
|
||||
profiling = 0;
|
||||
} else {
|
||||
/* stop */
|
||||
profil((unsigned short *)0, 0, 0, 0);
|
||||
profiling = 3;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for HAL
|
||||
SPARC running Solaris 2 HALOS
|
||||
Copyright 1998 Free Software Foundation, Inc.
|
||||
Contributed by Carol LePage ([email protected])
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Need different command line for assembler */
|
||||
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC \
|
||||
"%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -e1 \
|
||||
%{fpic:-K PIC} %{fPIC:-K PIC}"
|
||||
|
||||
/* Need DWARF for debuggers. */
|
||||
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
|
||||
@@ -1,784 +0,0 @@
|
||||
/* This is an assembly language implementation of libgcc1.c for the sparc
|
||||
processor.
|
||||
|
||||
These routines are derived from the Sparc Architecture Manual, version 8,
|
||||
slightly edited to match the desired calling convention, and also to
|
||||
optimize them for our purposes. */
|
||||
|
||||
#ifdef L_mulsi3
|
||||
.text
|
||||
.align 4
|
||||
.global .umul
|
||||
.proc 4
|
||||
.umul:
|
||||
or %o0, %o1, %o4 ! logical or of multiplier and multiplicand
|
||||
mov %o0, %y ! multiplier to Y register
|
||||
andncc %o4, 0xfff, %o5 ! mask out lower 12 bits
|
||||
be mul_shortway ! can do it the short way
|
||||
andcc %g0, %g0, %o4 ! zero the partial product and clear NV cc
|
||||
!
|
||||
! long multiply
|
||||
!
|
||||
mulscc %o4, %o1, %o4 ! first iteration of 33
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4 ! 32nd iteration
|
||||
mulscc %o4, %g0, %o4 ! last iteration only shifts
|
||||
! the upper 32 bits of product are wrong, but we do not care
|
||||
retl
|
||||
rd %y, %o0
|
||||
!
|
||||
! short multiply
|
||||
!
|
||||
mul_shortway:
|
||||
mulscc %o4, %o1, %o4 ! first iteration of 13
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4
|
||||
mulscc %o4, %o1, %o4 ! 12th iteration
|
||||
mulscc %o4, %g0, %o4 ! last iteration only shifts
|
||||
rd %y, %o5
|
||||
sll %o4, 12, %o4 ! left shift partial product by 12 bits
|
||||
srl %o5, 20, %o5 ! right shift partial product by 20 bits
|
||||
retl
|
||||
or %o5, %o4, %o0 ! merge for true product
|
||||
#endif
|
||||
|
||||
#ifdef L_divsi3
|
||||
/*
|
||||
* Division and remainder, from Appendix E of the Sparc Version 8
|
||||
* Architecture Manual, with fixes from Gordon Irlam.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Input: dividend and divisor in %o0 and %o1 respectively.
|
||||
*
|
||||
* m4 parameters:
|
||||
* .div name of function to generate
|
||||
* div div=div => %o0 / %o1; div=rem => %o0 % %o1
|
||||
* true true=true => signed; true=false => unsigned
|
||||
*
|
||||
* Algorithm parameters:
|
||||
* N how many bits per iteration we try to get (4)
|
||||
* WORDSIZE total number of bits (32)
|
||||
*
|
||||
* Derived constants:
|
||||
* TOPBITS number of bits in the top decade of a number
|
||||
*
|
||||
* Important variables:
|
||||
* Q the partial quotient under development (initially 0)
|
||||
* R the remainder so far, initially the dividend
|
||||
* ITER number of main division loop iterations required;
|
||||
* equal to ceil(log2(quotient) / N). Note that this
|
||||
* is the log base (2^N) of the quotient.
|
||||
* V the current comparand, initially divisor*2^(ITER*N-1)
|
||||
*
|
||||
* Cost:
|
||||
* Current estimate for non-large dividend is
|
||||
* ceil(log2(quotient) / N) * (10 + 7N/2) + C
|
||||
* A large dividend is one greater than 2^(31-TOPBITS) and takes a
|
||||
* different path, as the upper bits of the quotient must be developed
|
||||
* one bit at a time.
|
||||
*/
|
||||
.global .udiv
|
||||
.align 4
|
||||
.proc 4
|
||||
.text
|
||||
.udiv:
|
||||
b ready_to_divide
|
||||
mov 0, %g3 ! result is always positive
|
||||
|
||||
.global .div
|
||||
.align 4
|
||||
.proc 4
|
||||
.text
|
||||
.div:
|
||||
! compute sign of result; if neither is negative, no problem
|
||||
orcc %o1, %o0, %g0 ! either negative?
|
||||
bge ready_to_divide ! no, go do the divide
|
||||
xor %o1, %o0, %g3 ! compute sign in any case
|
||||
tst %o1
|
||||
bge 1f
|
||||
tst %o0
|
||||
! %o1 is definitely negative; %o0 might also be negative
|
||||
bge ready_to_divide ! if %o0 not negative...
|
||||
sub %g0, %o1, %o1 ! in any case, make %o1 nonneg
|
||||
1: ! %o0 is negative, %o1 is nonnegative
|
||||
sub %g0, %o0, %o0 ! make %o0 nonnegative
|
||||
|
||||
|
||||
ready_to_divide:
|
||||
|
||||
! Ready to divide. Compute size of quotient; scale comparand.
|
||||
orcc %o1, %g0, %o5
|
||||
bne 1f
|
||||
mov %o0, %o3
|
||||
|
||||
! Divide by zero trap. If it returns, return 0 (about as
|
||||
! wrong as possible, but that is what SunOS does...).
|
||||
ta 0x2 ! ST_DIV0
|
||||
retl
|
||||
clr %o0
|
||||
|
||||
1:
|
||||
cmp %o3, %o5 ! if %o1 exceeds %o0, done
|
||||
blu got_result ! (and algorithm fails otherwise)
|
||||
clr %o2
|
||||
sethi %hi(1 << (32 - 4 - 1)), %g1
|
||||
cmp %o3, %g1
|
||||
blu not_really_big
|
||||
clr %o4
|
||||
|
||||
! Here the dividend is >= 2**(31-N) or so. We must be careful here,
|
||||
! as our usual N-at-a-shot divide step will cause overflow and havoc.
|
||||
! The number of bits in the result here is N*ITER+SC, where SC <= N.
|
||||
! Compute ITER in an unorthodox manner: know we need to shift V into
|
||||
! the top decade: so do not even bother to compare to R.
|
||||
1:
|
||||
cmp %o5, %g1
|
||||
bgeu 3f
|
||||
mov 1, %g2
|
||||
sll %o5, 4, %o5
|
||||
b 1b
|
||||
add %o4, 1, %o4
|
||||
|
||||
! Now compute %g2.
|
||||
2: addcc %o5, %o5, %o5
|
||||
bcc not_too_big
|
||||
add %g2, 1, %g2
|
||||
|
||||
! We get here if the %o1 overflowed while shifting.
|
||||
! This means that %o3 has the high-order bit set.
|
||||
! Restore %o5 and subtract from %o3.
|
||||
sll %g1, 4, %g1 ! high order bit
|
||||
srl %o5, 1, %o5 ! rest of %o5
|
||||
add %o5, %g1, %o5
|
||||
b do_single_div
|
||||
sub %g2, 1, %g2
|
||||
|
||||
not_too_big:
|
||||
3: cmp %o5, %o3
|
||||
blu 2b
|
||||
nop
|
||||
be do_single_div
|
||||
nop
|
||||
/* NB: these are commented out in the V8-Sparc manual as well */
|
||||
/* (I do not understand this) */
|
||||
! %o5 > %o3: went too far: back up 1 step
|
||||
! srl %o5, 1, %o5
|
||||
! dec %g2
|
||||
! do single-bit divide steps
|
||||
!
|
||||
! We have to be careful here. We know that %o3 >= %o5, so we can do the
|
||||
! first divide step without thinking. BUT, the others are conditional,
|
||||
! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high-
|
||||
! order bit set in the first step, just falling into the regular
|
||||
! division loop will mess up the first time around.
|
||||
! So we unroll slightly...
|
||||
do_single_div:
|
||||
subcc %g2, 1, %g2
|
||||
bl end_regular_divide
|
||||
nop
|
||||
sub %o3, %o5, %o3
|
||||
mov 1, %o2
|
||||
b end_single_divloop
|
||||
nop
|
||||
single_divloop:
|
||||
sll %o2, 1, %o2
|
||||
bl 1f
|
||||
srl %o5, 1, %o5
|
||||
! %o3 >= 0
|
||||
sub %o3, %o5, %o3
|
||||
b 2f
|
||||
add %o2, 1, %o2
|
||||
1: ! %o3 < 0
|
||||
add %o3, %o5, %o3
|
||||
sub %o2, 1, %o2
|
||||
2:
|
||||
end_single_divloop:
|
||||
subcc %g2, 1, %g2
|
||||
bge single_divloop
|
||||
tst %o3
|
||||
b,a end_regular_divide
|
||||
|
||||
not_really_big:
|
||||
1:
|
||||
sll %o5, 4, %o5
|
||||
cmp %o5, %o3
|
||||
bleu 1b
|
||||
addcc %o4, 1, %o4
|
||||
be got_result
|
||||
sub %o4, 1, %o4
|
||||
|
||||
tst %o3 ! set up for initial iteration
|
||||
divloop:
|
||||
sll %o2, 4, %o2
|
||||
! depth 1, accumulated bits 0
|
||||
bl L1.16
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
! depth 2, accumulated bits 1
|
||||
bl L2.17
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
! depth 3, accumulated bits 3
|
||||
bl L3.19
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
! depth 4, accumulated bits 7
|
||||
bl L4.23
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (7*2+1), %o2
|
||||
|
||||
L4.23:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (7*2-1), %o2
|
||||
|
||||
|
||||
L3.19:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
! depth 4, accumulated bits 5
|
||||
bl L4.21
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (5*2+1), %o2
|
||||
|
||||
L4.21:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (5*2-1), %o2
|
||||
|
||||
L2.17:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
! depth 3, accumulated bits 1
|
||||
bl L3.17
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
! depth 4, accumulated bits 3
|
||||
bl L4.19
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (3*2+1), %o2
|
||||
|
||||
L4.19:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (3*2-1), %o2
|
||||
|
||||
L3.17:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
! depth 4, accumulated bits 1
|
||||
bl L4.17
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (1*2+1), %o2
|
||||
|
||||
L4.17:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (1*2-1), %o2
|
||||
|
||||
L1.16:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
! depth 2, accumulated bits -1
|
||||
bl L2.15
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
! depth 3, accumulated bits -1
|
||||
bl L3.15
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
! depth 4, accumulated bits -1
|
||||
bl L4.15
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (-1*2+1), %o2
|
||||
|
||||
L4.15:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (-1*2-1), %o2
|
||||
|
||||
L3.15:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
! depth 4, accumulated bits -3
|
||||
bl L4.13
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (-3*2+1), %o2
|
||||
|
||||
L4.13:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (-3*2-1), %o2
|
||||
|
||||
L2.15:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
! depth 3, accumulated bits -3
|
||||
bl L3.13
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
! depth 4, accumulated bits -5
|
||||
bl L4.11
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (-5*2+1), %o2
|
||||
|
||||
L4.11:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (-5*2-1), %o2
|
||||
|
||||
L3.13:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
! depth 4, accumulated bits -7
|
||||
bl L4.9
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (-7*2+1), %o2
|
||||
|
||||
L4.9:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (-7*2-1), %o2
|
||||
|
||||
9:
|
||||
end_regular_divide:
|
||||
subcc %o4, 1, %o4
|
||||
bge divloop
|
||||
tst %o3
|
||||
bl,a got_result
|
||||
! non-restoring fixup here (one instruction only!)
|
||||
sub %o2, 1, %o2
|
||||
|
||||
|
||||
got_result:
|
||||
! check to see if answer should be < 0
|
||||
tst %g3
|
||||
bl,a 1f
|
||||
sub %g0, %o2, %o2
|
||||
1:
|
||||
retl
|
||||
mov %o2, %o0
|
||||
#endif
|
||||
|
||||
#ifdef L_modsi3
|
||||
/* This implementation was taken from glibc:
|
||||
*
|
||||
* Input: dividend and divisor in %o0 and %o1 respectively.
|
||||
*
|
||||
* Algorithm parameters:
|
||||
* N how many bits per iteration we try to get (4)
|
||||
* WORDSIZE total number of bits (32)
|
||||
*
|
||||
* Derived constants:
|
||||
* TOPBITS number of bits in the top decade of a number
|
||||
*
|
||||
* Important variables:
|
||||
* Q the partial quotient under development (initially 0)
|
||||
* R the remainder so far, initially the dividend
|
||||
* ITER number of main division loop iterations required;
|
||||
* equal to ceil(log2(quotient) / N). Note that this
|
||||
* is the log base (2^N) of the quotient.
|
||||
* V the current comparand, initially divisor*2^(ITER*N-1)
|
||||
*
|
||||
* Cost:
|
||||
* Current estimate for non-large dividend is
|
||||
* ceil(log2(quotient) / N) * (10 + 7N/2) + C
|
||||
* A large dividend is one greater than 2^(31-TOPBITS) and takes a
|
||||
* different path, as the upper bits of the quotient must be developed
|
||||
* one bit at a time.
|
||||
*/
|
||||
.text
|
||||
.align 4
|
||||
.global .urem
|
||||
.proc 4
|
||||
.urem:
|
||||
b divide
|
||||
mov 0, %g3 ! result always positive
|
||||
|
||||
.align 4
|
||||
.global .rem
|
||||
.proc 4
|
||||
.rem:
|
||||
! compute sign of result; if neither is negative, no problem
|
||||
orcc %o1, %o0, %g0 ! either negative?
|
||||
bge 2f ! no, go do the divide
|
||||
mov %o0, %g3 ! sign of remainder matches %o0
|
||||
tst %o1
|
||||
bge 1f
|
||||
tst %o0
|
||||
! %o1 is definitely negative; %o0 might also be negative
|
||||
bge 2f ! if %o0 not negative...
|
||||
sub %g0, %o1, %o1 ! in any case, make %o1 nonneg
|
||||
1: ! %o0 is negative, %o1 is nonnegative
|
||||
sub %g0, %o0, %o0 ! make %o0 nonnegative
|
||||
2:
|
||||
|
||||
! Ready to divide. Compute size of quotient; scale comparand.
|
||||
divide:
|
||||
orcc %o1, %g0, %o5
|
||||
bne 1f
|
||||
mov %o0, %o3
|
||||
|
||||
! Divide by zero trap. If it returns, return 0 (about as
|
||||
! wrong as possible, but that is what SunOS does...).
|
||||
ta 0x2 !ST_DIV0
|
||||
retl
|
||||
clr %o0
|
||||
|
||||
1:
|
||||
cmp %o3, %o5 ! if %o1 exceeds %o0, done
|
||||
blu got_result ! (and algorithm fails otherwise)
|
||||
clr %o2
|
||||
sethi %hi(1 << (32 - 4 - 1)), %g1
|
||||
cmp %o3, %g1
|
||||
blu not_really_big
|
||||
clr %o4
|
||||
|
||||
! Here the dividend is >= 2**(31-N) or so. We must be careful here,
|
||||
! as our usual N-at-a-shot divide step will cause overflow and havoc.
|
||||
! The number of bits in the result here is N*ITER+SC, where SC <= N.
|
||||
! Compute ITER in an unorthodox manner: know we need to shift V into
|
||||
! the top decade: so do not even bother to compare to R.
|
||||
1:
|
||||
cmp %o5, %g1
|
||||
bgeu 3f
|
||||
mov 1, %g2
|
||||
sll %o5, 4, %o5
|
||||
b 1b
|
||||
add %o4, 1, %o4
|
||||
|
||||
! Now compute %g2.
|
||||
2: addcc %o5, %o5, %o5
|
||||
bcc not_too_big
|
||||
add %g2, 1, %g2
|
||||
|
||||
! We get here if the %o1 overflowed while shifting.
|
||||
! This means that %o3 has the high-order bit set.
|
||||
! Restore %o5 and subtract from %o3.
|
||||
sll %g1, 4, %g1 ! high order bit
|
||||
srl %o5, 1, %o5 ! rest of %o5
|
||||
add %o5, %g1, %o5
|
||||
b do_single_div
|
||||
sub %g2, 1, %g2
|
||||
|
||||
not_too_big:
|
||||
3: cmp %o5, %o3
|
||||
blu 2b
|
||||
nop
|
||||
be do_single_div
|
||||
nop
|
||||
/* NB: these are commented out in the V8-Sparc manual as well */
|
||||
/* (I do not understand this) */
|
||||
! %o5 > %o3: went too far: back up 1 step
|
||||
! srl %o5, 1, %o5
|
||||
! dec %g2
|
||||
! do single-bit divide steps
|
||||
!
|
||||
! We have to be careful here. We know that %o3 >= %o5, so we can do the
|
||||
! first divide step without thinking. BUT, the others are conditional,
|
||||
! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high-
|
||||
! order bit set in the first step, just falling into the regular
|
||||
! division loop will mess up the first time around.
|
||||
! So we unroll slightly...
|
||||
do_single_div:
|
||||
subcc %g2, 1, %g2
|
||||
bl end_regular_divide
|
||||
nop
|
||||
sub %o3, %o5, %o3
|
||||
mov 1, %o2
|
||||
b end_single_divloop
|
||||
nop
|
||||
single_divloop:
|
||||
sll %o2, 1, %o2
|
||||
bl 1f
|
||||
srl %o5, 1, %o5
|
||||
! %o3 >= 0
|
||||
sub %o3, %o5, %o3
|
||||
b 2f
|
||||
add %o2, 1, %o2
|
||||
1: ! %o3 < 0
|
||||
add %o3, %o5, %o3
|
||||
sub %o2, 1, %o2
|
||||
2:
|
||||
end_single_divloop:
|
||||
subcc %g2, 1, %g2
|
||||
bge single_divloop
|
||||
tst %o3
|
||||
b,a end_regular_divide
|
||||
|
||||
not_really_big:
|
||||
1:
|
||||
sll %o5, 4, %o5
|
||||
cmp %o5, %o3
|
||||
bleu 1b
|
||||
addcc %o4, 1, %o4
|
||||
be got_result
|
||||
sub %o4, 1, %o4
|
||||
|
||||
tst %o3 ! set up for initial iteration
|
||||
divloop:
|
||||
sll %o2, 4, %o2
|
||||
! depth 1, accumulated bits 0
|
||||
bl L1.16
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
! depth 2, accumulated bits 1
|
||||
bl L2.17
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
! depth 3, accumulated bits 3
|
||||
bl L3.19
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
! depth 4, accumulated bits 7
|
||||
bl L4.23
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (7*2+1), %o2
|
||||
L4.23:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (7*2-1), %o2
|
||||
|
||||
L3.19:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
! depth 4, accumulated bits 5
|
||||
bl L4.21
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (5*2+1), %o2
|
||||
|
||||
L4.21:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (5*2-1), %o2
|
||||
|
||||
L2.17:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
! depth 3, accumulated bits 1
|
||||
bl L3.17
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
! depth 4, accumulated bits 3
|
||||
bl L4.19
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (3*2+1), %o2
|
||||
|
||||
L4.19:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (3*2-1), %o2
|
||||
|
||||
L3.17:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
! depth 4, accumulated bits 1
|
||||
bl L4.17
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (1*2+1), %o2
|
||||
|
||||
L4.17:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (1*2-1), %o2
|
||||
|
||||
L1.16:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
! depth 2, accumulated bits -1
|
||||
bl L2.15
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
! depth 3, accumulated bits -1
|
||||
bl L3.15
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
! depth 4, accumulated bits -1
|
||||
bl L4.15
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (-1*2+1), %o2
|
||||
|
||||
L4.15:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (-1*2-1), %o2
|
||||
|
||||
L3.15:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
! depth 4, accumulated bits -3
|
||||
bl L4.13
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (-3*2+1), %o2
|
||||
|
||||
L4.13:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (-3*2-1), %o2
|
||||
|
||||
L2.15:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
! depth 3, accumulated bits -3
|
||||
bl L3.13
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
! depth 4, accumulated bits -5
|
||||
bl L4.11
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (-5*2+1), %o2
|
||||
|
||||
L4.11:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (-5*2-1), %o2
|
||||
|
||||
L3.13:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
! depth 4, accumulated bits -7
|
||||
bl L4.9
|
||||
srl %o5,1,%o5
|
||||
! remainder is positive
|
||||
subcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (-7*2+1), %o2
|
||||
|
||||
L4.9:
|
||||
! remainder is negative
|
||||
addcc %o3,%o5,%o3
|
||||
b 9f
|
||||
add %o2, (-7*2-1), %o2
|
||||
|
||||
9:
|
||||
end_regular_divide:
|
||||
subcc %o4, 1, %o4
|
||||
bge divloop
|
||||
tst %o3
|
||||
bl,a got_result
|
||||
! non-restoring fixup here (one instruction only!)
|
||||
add %o3, %o1, %o3
|
||||
|
||||
got_result:
|
||||
! check to see if answer should be < 0
|
||||
tst %g3
|
||||
bl,a 1f
|
||||
sub %g0, %o3, %o3
|
||||
1:
|
||||
retl
|
||||
mov %o3, %o0
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,246 +0,0 @@
|
||||
/* This is an assembly language implementation of libgcc1.c for the sparclite
|
||||
processor.
|
||||
|
||||
These routines are all from the Sparclite User's Guide, slightly edited
|
||||
to match the desired calling convention, and also to optimize them. */
|
||||
|
||||
#ifdef L_udivsi3
|
||||
.text
|
||||
.align 4
|
||||
.global .udiv
|
||||
.proc 04
|
||||
.udiv:
|
||||
wr %g0,%g0,%y ! Not a delayed write for sparclite
|
||||
tst %g0
|
||||
divscc %o0,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
retl
|
||||
divscc %g1,%o1,%o0
|
||||
#endif
|
||||
|
||||
#ifdef L_umodsi3
|
||||
.text
|
||||
.align 4
|
||||
.global .urem
|
||||
.proc 04
|
||||
.urem:
|
||||
wr %g0,%g0,%y ! Not a delayed write for sparclite
|
||||
tst %g0
|
||||
divscc %o0,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
divscc %g1,%o1,%g1
|
||||
bl 1f
|
||||
rd %y,%o0
|
||||
retl
|
||||
nop
|
||||
1: retl
|
||||
add %o0,%o1,%o0
|
||||
#endif
|
||||
|
||||
#ifdef L_divsi3
|
||||
.text
|
||||
.align 4
|
||||
.global .div
|
||||
.proc 04
|
||||
! ??? This routine could be made faster if was optimized, and if it was
|
||||
! rewritten to only calculate the quotient.
|
||||
.div:
|
||||
wr %g0,%g0,%y ! Not a delayed write for sparclite
|
||||
mov %o1,%o4
|
||||
tst %o1
|
||||
bl,a 1f
|
||||
sub %g0,%o4,%o4
|
||||
1: tst %o0
|
||||
bl,a 2f
|
||||
mov -1,%y
|
||||
2: divscc %o0,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
be 6f
|
||||
mov %y,%o3
|
||||
bg 4f
|
||||
addcc %o3,%o4,%g0
|
||||
be,a 6f
|
||||
mov %g0,%o3
|
||||
tst %o0
|
||||
bl 5f
|
||||
tst %g1
|
||||
ba 5f
|
||||
add %o3,%o4,%o3
|
||||
4: subcc %o3,%o4,%g0
|
||||
be,a 6f
|
||||
mov %g0,%o3
|
||||
tst %o0
|
||||
bge 5f
|
||||
tst %g1
|
||||
sub %o3,%o4,%o3
|
||||
5: bl,a 6f
|
||||
add %g1,1,%g1
|
||||
6: tst %o1
|
||||
bl,a 7f
|
||||
sub %g0,%g1,%g1
|
||||
7: retl
|
||||
mov %g1,%o0 ! Quotient is in %g1.
|
||||
#endif
|
||||
|
||||
#ifdef L_modsi3
|
||||
.text
|
||||
.align 4
|
||||
.global .rem
|
||||
.proc 04
|
||||
! ??? This routine could be made faster if was optimized, and if it was
|
||||
! rewritten to only calculate the remainder.
|
||||
.rem:
|
||||
wr %g0,%g0,%y ! Not a delayed write for sparclite
|
||||
mov %o1,%o4
|
||||
tst %o1
|
||||
bl,a 1f
|
||||
sub %g0,%o4,%o4
|
||||
1: tst %o0
|
||||
bl,a 2f
|
||||
mov -1,%y
|
||||
2: divscc %o0,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
divscc %g1,%o4,%g1
|
||||
be 6f
|
||||
mov %y,%o3
|
||||
bg 4f
|
||||
addcc %o3,%o4,%g0
|
||||
be,a 6f
|
||||
mov %g0,%o3
|
||||
tst %o0
|
||||
bl 5f
|
||||
tst %g1
|
||||
ba 5f
|
||||
add %o3,%o4,%o3
|
||||
4: subcc %o3,%o4,%g0
|
||||
be,a 6f
|
||||
mov %g0,%o3
|
||||
tst %o0
|
||||
bge 5f
|
||||
tst %g1
|
||||
sub %o3,%o4,%o3
|
||||
5: bl,a 6f
|
||||
add %g1,1,%g1
|
||||
6: tst %o1
|
||||
bl,a 7f
|
||||
sub %g0,%g1,%g1
|
||||
7: retl
|
||||
mov %o3,%o0 ! Remainder is in %o3.
|
||||
#endif
|
||||
@@ -1,130 +0,0 @@
|
||||
/* Definitions for SPARC running Linux-based GNU systems with a.out.
|
||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
Contributed by Eddie C. Dost ([email protected])
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <aoutos.h>
|
||||
#include <sparc/sparc.h>
|
||||
|
||||
/* Don't assume anything about the header files. */
|
||||
#define NO_IMPLICIT_EXTERN_C
|
||||
|
||||
#undef HAVE_ATEXIT
|
||||
#define HAVE_ATEXIT
|
||||
|
||||
/* GNU/Linux uses ctype from glibc.a. I am not sure how complete it is.
|
||||
For now, we play safe. It may change later. */
|
||||
|
||||
#if 0
|
||||
#undef MULTIBYTE_CHARS
|
||||
#define MULTIBYTE_CHARS 1
|
||||
#endif
|
||||
|
||||
/* We need that too. */
|
||||
#define HANDLE_SYSV_PRAGMA
|
||||
|
||||
#undef MD_EXEC_PREFIX
|
||||
#undef MD_STARTFILE_PREFIX
|
||||
|
||||
/* Output at beginning of assembler file. */
|
||||
/* The .file command should always begin the output. */
|
||||
#undef ASM_FILE_START
|
||||
#define ASM_FILE_START(FILE) \
|
||||
do { \
|
||||
output_file_directive (FILE, main_input_filename); \
|
||||
fprintf (FILE, "\t.version\t\"01.01\"\n"); \
|
||||
} while (0)
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC "%{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}} %{static:-static}"
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (sparc GNU/Linux with a.out)");
|
||||
|
||||
#undef SIZE_TYPE
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
#define PTRDIFF_TYPE "int"
|
||||
|
||||
#undef WCHAR_TYPE
|
||||
#define WCHAR_TYPE "long int"
|
||||
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
#define WCHAR_TYPE_SIZE BITS_PER_WORD
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dunix -Dsparc -Dlinux -Asystem(unix) -Asystem(posix)"
|
||||
|
||||
#undef CPP_SUBTARGET_SPEC
|
||||
#define CPP_SUBTARGET_SPEC \
|
||||
"%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
|
||||
|
||||
/* Don't default to pcc-struct-return, because gcc is the only compiler,
|
||||
and we want to retain compatibility with older gcc versions. */
|
||||
#define DEFAULT_PCC_STRUCT_RETURN 0
|
||||
|
||||
#undef LIB_SPEC
|
||||
|
||||
#if 1
|
||||
/* We no longer link with libc_p.a or libg.a by default. If you
|
||||
want to profile or debug the GNU/Linux C library, please add
|
||||
-lc_p or -ggdb to LDFLAGS at the link time, respectively. */
|
||||
#define LIB_SPEC \
|
||||
"%{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} %{!ggdb:-lc} %{ggdb:-lg}"
|
||||
#else
|
||||
#define LIB_SPEC \
|
||||
"%{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
|
||||
%{!p:%{!pg:%{!g*:-lc} %{g*:-lg -static}}}"
|
||||
#endif
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "-m sparclinux"
|
||||
|
||||
/* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
|
||||
It's safe to pass -s always, even if -g is not used. */
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC \
|
||||
"%{V} %{v:%{!V:-V}} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s %{fpic:-K PIC} %{fPIC:-K PIC}"
|
||||
|
||||
#if 0
|
||||
/* Define for support of TFmode long double and REAL_ARITHMETIC.
|
||||
Sparc ABI says that long double is 4 words. GNU/Linux does not support
|
||||
long double yet. */
|
||||
#define LONG_DOUBLE_TYPE_SIZE 128
|
||||
#endif
|
||||
|
||||
/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special
|
||||
traps available which can get and set the condition codes
|
||||
reliably. */
|
||||
#undef MACHINE_STATE_SAVE
|
||||
#define MACHINE_STATE_SAVE(ID) \
|
||||
unsigned long int ms_flags, ms_saveret; \
|
||||
asm volatile("ta 0x20\n\t" \
|
||||
"mov %%g1, %0\n\t" \
|
||||
"mov %%g2, %1\n\t" \
|
||||
: "=r" (ms_flags), "=r" (ms_saveret));
|
||||
|
||||
#undef MACHINE_STATE_RESTORE
|
||||
#define MACHINE_STATE_RESTORE(ID) \
|
||||
asm volatile("mov %0, %%g1\n\t" \
|
||||
"mov %1, %%g2\n\t" \
|
||||
"ta 0x21\n\t" \
|
||||
: /* no outputs */ \
|
||||
: "r" (ms_flags), "r" (ms_saveret));
|
||||
@@ -1,259 +0,0 @@
|
||||
/* Definitions for SPARC running Linux-based GNU systems with ELF.
|
||||
Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Contributed by Eddie C. Dost ([email protected])
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define LINUX_DEFAULT_ELF
|
||||
|
||||
/* Don't assume anything about the header files. */
|
||||
#define NO_IMPLICIT_EXTERN_C
|
||||
|
||||
#undef HAVE_ATEXIT
|
||||
#define HAVE_ATEXIT
|
||||
|
||||
/* GNU/Linux uses ctype from glibc.a. I am not sure how complete it is.
|
||||
For now, we play safe. It may change later. */
|
||||
|
||||
#if 0
|
||||
#undef MULTIBYTE_CHARS
|
||||
#define MULTIBYTE_CHARS 1
|
||||
#endif
|
||||
|
||||
#ifndef USE_GNULIBC_1
|
||||
#undef DEFAULT_VTABLE_THUNKS
|
||||
#define DEFAULT_VTABLE_THUNKS 1
|
||||
#endif
|
||||
|
||||
/* Use stabs instead of DWARF debug format. */
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
|
||||
#include <sparc/sysv4.h>
|
||||
|
||||
#undef MD_EXEC_PREFIX
|
||||
#undef MD_STARTFILE_PREFIX
|
||||
|
||||
/* Output at beginning of assembler file. */
|
||||
/* The .file command should always begin the output. */
|
||||
#undef ASM_FILE_START
|
||||
#define ASM_FILE_START(FILE) \
|
||||
do { \
|
||||
output_file_directive (FILE, main_input_filename); \
|
||||
fprintf (FILE, "\t.version\t\"01.01\"\n"); \
|
||||
} while (0)
|
||||
|
||||
/* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
|
||||
the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
|
||||
provides part of the support for getting C++ file-scope static
|
||||
object constructed before entering `main'. */
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC \
|
||||
"%{!shared: \
|
||||
%{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
|
||||
crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
|
||||
|
||||
/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
|
||||
the GNU/Linux magical crtend.o file (see crtstuff.c) which
|
||||
provides part of the support for getting C++ file-scope static
|
||||
object constructed before entering `main', followed by a normal
|
||||
GNU/Linux "finalizer" file, `crtn.o'. */
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC \
|
||||
"%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
|
||||
|
||||
/* This is for -profile to use -lc_p instead of -lc. */
|
||||
#undef CC1_SPEC
|
||||
#define CC1_SPEC "%{profile:-p} \
|
||||
%{sun4:} %{target:} \
|
||||
%{mcypress:-mcpu=cypress} \
|
||||
%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
|
||||
%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
|
||||
"
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (sparc GNU/Linux with ELF)");
|
||||
|
||||
#undef SIZE_TYPE
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
#define PTRDIFF_TYPE "int"
|
||||
|
||||
#undef WCHAR_TYPE
|
||||
#define WCHAR_TYPE "long int"
|
||||
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
#define WCHAR_TYPE_SIZE BITS_PER_WORD
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-D__ELF__ -Dunix -D__sparc__ -Dlinux -Asystem(unix) -Asystem(posix)"
|
||||
|
||||
#undef CPP_SUBTARGET_SPEC
|
||||
#ifdef USE_GNULIBC_1
|
||||
#define CPP_SUBTARGET_SPEC \
|
||||
"%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
|
||||
#else
|
||||
#define CPP_SUBTARGET_SPEC \
|
||||
"%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
|
||||
#endif
|
||||
|
||||
#undef LIB_SPEC
|
||||
/* We no longer link with libc_p.a or libg.a by default. If you
|
||||
want to profile or debug the GNU/Linux C library, please add
|
||||
-lc_p or -ggdb to LDFLAGS at the link time, respectively. */
|
||||
#if 1
|
||||
#ifdef USE_GNULIBC_1
|
||||
#define LIB_SPEC \
|
||||
"%{!shared: %{p:-lgmon} %{pg:-lgmon} %{profile:-lgmon -lc_p} \
|
||||
%{!profile:%{!ggdb:-lc} %{ggdb:-lg}}}"
|
||||
#else
|
||||
#define LIB_SPEC \
|
||||
"%{shared: -lc} \
|
||||
%{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \
|
||||
%{profile:-lc_p} %{!profile: -lc}}"
|
||||
#endif
|
||||
#else
|
||||
#define LIB_SPEC \
|
||||
"%{!shared: \
|
||||
%{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
|
||||
%{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}"
|
||||
#endif
|
||||
|
||||
/* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support
|
||||
for the special GCC options -static and -shared, which allow us to
|
||||
link things in one of these three modes by applying the appropriate
|
||||
combinations of options at link-time. We like to support here for
|
||||
as many of the other GNU linker options as possible. But I don't
|
||||
have the time to search for those flags. I am sure how to add
|
||||
support for -soname shared_object_name. H.J.
|
||||
|
||||
I took out %{v:%{!V:-V}}. It is too much :-(. They can use
|
||||
-Wl,-V.
|
||||
|
||||
When the -shared link option is used a final link is not being
|
||||
done. */
|
||||
|
||||
/* If ELF is the default format, we should not use /lib/elf. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#ifdef USE_GNULIBC_1
|
||||
#ifndef LINUX_DEFAULT_ELF
|
||||
#define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
|
||||
%{!shared: \
|
||||
%{!ibcs: \
|
||||
%{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
%{!dynamic-linker:-dynamic-linker /lib/elf/ld-linux.so.1} \
|
||||
%{!rpath:-rpath /lib/elf/}} %{static:-static}}}"
|
||||
#else
|
||||
#define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
|
||||
%{!shared: \
|
||||
%{!ibcs: \
|
||||
%{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \
|
||||
%{static:-static}}}"
|
||||
#endif
|
||||
#else
|
||||
#define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
|
||||
%{!shared: \
|
||||
%{!ibcs: \
|
||||
%{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
|
||||
%{static:-static}}}"
|
||||
#endif
|
||||
|
||||
/* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
|
||||
It's safe to pass -s always, even if -g is not used. */
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC \
|
||||
"%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s %{fpic:-K PIC} %{fPIC:-K PIC}"
|
||||
|
||||
/* Same as sparc.h */
|
||||
#undef DBX_REGISTER_NUMBER
|
||||
#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
|
||||
|
||||
/* We use stabs-in-elf for debugging, because that is what the native
|
||||
toolchain uses. XXX */
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
|
||||
#undef ASM_OUTPUT_ALIGNED_LOCAL
|
||||
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
|
||||
do { \
|
||||
fputs ("\t.local\t", (FILE)); \
|
||||
assemble_name ((FILE), (NAME)); \
|
||||
putc ('\n', (FILE)); \
|
||||
ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
|
||||
} while (0)
|
||||
|
||||
#undef COMMON_ASM_OP
|
||||
#define COMMON_ASM_OP "\t.common"
|
||||
|
||||
/* This is how to output a definition of an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class. */
|
||||
|
||||
#undef ASM_OUTPUT_INTERNAL_LABEL
|
||||
#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
|
||||
fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
|
||||
|
||||
/* This is how to output a reference to an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class. */
|
||||
|
||||
#undef ASM_OUTPUT_INTERNAL_LABELREF
|
||||
#define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \
|
||||
fprintf (FILE, ".L%s%d", PREFIX, NUM)
|
||||
|
||||
/* This is how to store into the string LABEL
|
||||
the symbol_ref name of an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class.
|
||||
This is suitable for output with `assemble_name'. */
|
||||
|
||||
#undef ASM_GENERATE_INTERNAL_LABEL
|
||||
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
|
||||
sprintf (LABEL, "*.L%s%d", PREFIX, NUM)
|
||||
|
||||
|
||||
#if 0
|
||||
/* Define for support of TFmode long double and REAL_ARITHMETIC.
|
||||
Sparc ABI says that long double is 4 words. GNU/Linux does not support
|
||||
long double yet. */
|
||||
#define LONG_DOUBLE_TYPE_SIZE 128
|
||||
#endif
|
||||
|
||||
/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special
|
||||
traps available which can get and set the condition codes
|
||||
reliably. */
|
||||
#undef MACHINE_STATE_SAVE
|
||||
#define MACHINE_STATE_SAVE(ID) \
|
||||
unsigned long int ms_flags, ms_saveret; \
|
||||
asm volatile("ta 0x20\n\t" \
|
||||
"mov %%g1, %0\n\t" \
|
||||
"mov %%g2, %1\n\t" \
|
||||
: "=r" (ms_flags), "=r" (ms_saveret));
|
||||
|
||||
#undef MACHINE_STATE_RESTORE
|
||||
#define MACHINE_STATE_RESTORE(ID) \
|
||||
asm volatile("mov %0, %%g1\n\t" \
|
||||
"mov %1, %%g2\n\t" \
|
||||
"ta 0x21\n\t" \
|
||||
: /* no outputs */ \
|
||||
: "r" (ms_flags), "r" (ms_saveret));
|
||||
@@ -1,366 +0,0 @@
|
||||
/* Definitions for 64-bit SPARC running Linux-based GNU systems with ELF.
|
||||
Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Contributed by David S. Miller ([email protected])
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define SPARC_BI_ARCH
|
||||
|
||||
#define LINUX_DEFAULT_ELF
|
||||
|
||||
/* Don't assume anything about the header files. */
|
||||
#define NO_IMPLICIT_EXTERN_C
|
||||
|
||||
#undef HAVE_ATEXIT
|
||||
#define HAVE_ATEXIT
|
||||
|
||||
#include <sparc/sysv4.h>
|
||||
|
||||
#undef MD_EXEC_PREFIX
|
||||
#undef MD_STARTFILE_PREFIX
|
||||
|
||||
#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
|
||||
/* A 64 bit v9 compiler with stack-bias,
|
||||
in a Medium/Low code model environment. */
|
||||
|
||||
#undef TARGET_DEFAULT
|
||||
#define TARGET_DEFAULT \
|
||||
(MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \
|
||||
+ MASK_STACK_BIAS + MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU)
|
||||
#endif
|
||||
|
||||
/* Output at beginning of assembler file. */
|
||||
/* The .file command should always begin the output. */
|
||||
#undef ASM_FILE_START
|
||||
#define ASM_FILE_START(FILE) \
|
||||
do { \
|
||||
output_file_directive (FILE, main_input_filename); \
|
||||
fprintf (FILE, "\t.version\t\"01.01\"\n"); \
|
||||
} while (0)
|
||||
|
||||
#undef ASM_CPU_DEFAULT_SPEC
|
||||
#define ASM_CPU_DEFAULT_SPEC "-Av9a"
|
||||
|
||||
/* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
|
||||
the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
|
||||
provides part of the support for getting C++ file-scope static
|
||||
object constructed before entering `main'. */
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
|
||||
#define STARTFILE_SPEC32 \
|
||||
"%{!shared: \
|
||||
%{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
|
||||
crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
|
||||
|
||||
#define STARTFILE_SPEC64 \
|
||||
"%{!shared: \
|
||||
%{pg:/usr/lib64/gcrt1.o%s} %{!pg:%{p:/usr/lib64/gcrt1.o%s} %{!p:/usr/lib64/crt1.o%s}}}\
|
||||
/usr/lib64/crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
|
||||
|
||||
#ifdef SPARC_BI_ARCH
|
||||
|
||||
#if DEFAULT_ARCH32_P
|
||||
#define STARTFILE_SPEC "\
|
||||
%{m32:" STARTFILE_SPEC32 "} \
|
||||
%{m64:" STARTFILE_SPEC64 "} \
|
||||
%{!m32:%{!m64:" STARTFILE_SPEC32 "}}"
|
||||
#else
|
||||
#define STARTFILE_SPEC "\
|
||||
%{m32:" STARTFILE_SPEC32 "} \
|
||||
%{m64:" STARTFILE_SPEC64 "} \
|
||||
%{!m32:%{!m64:" STARTFILE_SPEC64 "}}"
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define STARTFILE_SPEC STARTFILE_SPEC64
|
||||
|
||||
#endif
|
||||
|
||||
/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
|
||||
the GNU/Linux magical crtend.o file (see crtstuff.c) which
|
||||
provides part of the support for getting C++ file-scope static
|
||||
object constructed before entering `main', followed by a normal
|
||||
GNU/Linux "finalizer" file, `crtn.o'. */
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
|
||||
#define ENDFILE_SPEC32 \
|
||||
"%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
|
||||
|
||||
#define ENDFILE_SPEC64 \
|
||||
"%{!shared:crtend.o%s} %{shared:crtendS.o%s} /usr/lib64/crtn.o%s"
|
||||
|
||||
#ifdef SPARC_BI_ARCH
|
||||
|
||||
#if DEFAULT_ARCH32_P
|
||||
#define ENDFILE_SPEC "\
|
||||
%{m32:" ENDFILE_SPEC32 "} \
|
||||
%{m64:" ENDFILE_SPEC64 "} \
|
||||
%{!m32:%{!m64:" ENDFILE_SPEC32 "}}"
|
||||
#else
|
||||
#define ENDFILE_SPEC "\
|
||||
%{m32:" ENDFILE_SPEC32 "} \
|
||||
%{m64:" ENDFILE_SPEC64 "} \
|
||||
%{!m32:%{!m64:" ENDFILE_SPEC64 "}}"
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define ENDFILE_SPEC ENDFILE_SPEC64
|
||||
|
||||
#endif
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (sparc64 GNU/Linux with ELF)");
|
||||
|
||||
/* The default code model. */
|
||||
#undef SPARC_DEFAULT_CMODEL
|
||||
#define SPARC_DEFAULT_CMODEL CM_MEDLOW
|
||||
|
||||
#undef WCHAR_TYPE
|
||||
#define WCHAR_TYPE "long int"
|
||||
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
#define WCHAR_TYPE_SIZE BITS_PER_WORD
|
||||
|
||||
#undef LONG_DOUBLE_TYPE_SIZE
|
||||
#define LONG_DOUBLE_TYPE_SIZE 128
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-D__ELF__ -Dunix -D_LONGLONG -D__sparc__ -Dlinux -Asystem(unix) -Asystem(posix)"
|
||||
|
||||
#undef CPP_SUBTARGET_SPEC
|
||||
#define CPP_SUBTARGET_SPEC "\
|
||||
%{fPIC:-D__PIC__ -D__pic__} \
|
||||
%{fpic:-D__PIC__ -D__pic__} \
|
||||
%{posix:-D_POSIX_SOURCE} \
|
||||
%{pthread:-D_REENTRANT} \
|
||||
"
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC \
|
||||
"%{shared: -lc} \
|
||||
%{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \
|
||||
%{profile:-lc_p} %{!profile: -lc}}"
|
||||
|
||||
/* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support
|
||||
for the special GCC options -static and -shared, which allow us to
|
||||
link things in one of these three modes by applying the appropriate
|
||||
combinations of options at link-time. We like to support here for
|
||||
as many of the other GNU linker options as possible. But I don't
|
||||
have the time to search for those flags. I am sure how to add
|
||||
support for -soname shared_object_name. H.J.
|
||||
|
||||
I took out %{v:%{!V:-V}}. It is too much :-(. They can use
|
||||
-Wl,-V.
|
||||
|
||||
When the -shared link option is used a final link is not being
|
||||
done. */
|
||||
|
||||
/* If ELF is the default format, we should not use /lib/elf. */
|
||||
|
||||
#ifdef SPARC_BI_ARCH
|
||||
|
||||
#undef SUBTARGET_EXTRA_SPECS
|
||||
#define SUBTARGET_EXTRA_SPECS \
|
||||
{ "link_arch32", LINK_ARCH32_SPEC }, \
|
||||
{ "link_arch64", LINK_ARCH64_SPEC }, \
|
||||
{ "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
|
||||
{ "link_arch", LINK_ARCH_SPEC },
|
||||
|
||||
#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
|
||||
%{!shared: \
|
||||
%{!ibcs: \
|
||||
%{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
|
||||
%{static:-static}}} \
|
||||
"
|
||||
|
||||
#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \
|
||||
%{!shared: \
|
||||
%{!ibcs: \
|
||||
%{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
%{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \
|
||||
%{static:-static}}} \
|
||||
"
|
||||
|
||||
#define LINK_ARCH_SPEC "\
|
||||
%{m32:%(link_arch32)} \
|
||||
%{m64:%(link_arch64)} \
|
||||
%{!m32:%{!m64:%(link_arch_default)}} \
|
||||
"
|
||||
|
||||
#define LINK_ARCH_DEFAULT_SPEC \
|
||||
(DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "\
|
||||
%(link_arch) \
|
||||
%{mlittle-endian:-EL} \
|
||||
"
|
||||
|
||||
#undef CC1_SPEC
|
||||
#if DEFAULT_ARCH32_P
|
||||
#define CC1_SPEC "\
|
||||
%{sun4:} %{target:} \
|
||||
%{mcypress:-mcpu=cypress} \
|
||||
%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
|
||||
%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
|
||||
%{m64:-mptr64 -mcpu=ultrasparc -mstack-bias} \
|
||||
"
|
||||
#else
|
||||
#define CC1_SPEC "\
|
||||
%{sun4:} %{target:} \
|
||||
%{mcypress:-mcpu=cypress} \
|
||||
%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
|
||||
%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
|
||||
%{m32:-mptr32 -mcpu=cypress -mno-stack-bias} \
|
||||
"
|
||||
#endif
|
||||
|
||||
#if DEFAULT_ARCH32_P
|
||||
#define MULTILIB_DEFAULTS { "m32" }
|
||||
#else
|
||||
#define MULTILIB_DEFAULTS { "m64" }
|
||||
#endif
|
||||
|
||||
#else /* !SPARC_BI_ARCH */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_ARCH_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \
|
||||
%{!shared: \
|
||||
%{!ibcs: \
|
||||
%{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
%{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \
|
||||
%{static:-static}}} \
|
||||
%{mlittle-endian:-EL} \
|
||||
"
|
||||
|
||||
#endif /* !SPARC_BI_ARCH */
|
||||
|
||||
/* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
|
||||
It's safe to pass -s always, even if -g is not used. */
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC "\
|
||||
%{V} \
|
||||
%{v:%{!V:-V}} \
|
||||
%{!Qn:-Qy} \
|
||||
%{n} \
|
||||
%{T} \
|
||||
%{Ym,*} \
|
||||
%{Wa,*:%*} \
|
||||
-s %{fpic:-K PIC} %{fPIC:-K PIC} \
|
||||
%{mlittle-endian:-EL} \
|
||||
%(asm_cpu) %(asm_arch) \
|
||||
"
|
||||
|
||||
/* Same as sparc.h */
|
||||
#undef DBX_REGISTER_NUMBER
|
||||
#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
|
||||
|
||||
/* System V Release 4 uses DWARF debugging info. Buf DWARF1 doesn't do
|
||||
64-bit anything, so we use DWARF2. */
|
||||
|
||||
#undef DWARF2_DEBUGGING_INFO
|
||||
#undef DWARF_DEBUGGING_INFO
|
||||
#undef DBX_DEBUGGING_INFO
|
||||
#define DWARF2_DEBUGGING_INFO
|
||||
#define DBX_DEBUGGING_INFO
|
||||
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
|
||||
|
||||
#undef ASM_OUTPUT_ALIGNED_LOCAL
|
||||
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
|
||||
do { \
|
||||
fputs ("\t.local\t", (FILE)); \
|
||||
assemble_name ((FILE), (NAME)); \
|
||||
putc ('\n', (FILE)); \
|
||||
ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
|
||||
} while (0)
|
||||
|
||||
#undef COMMON_ASM_OP
|
||||
#define COMMON_ASM_OP "\t.common"
|
||||
|
||||
/* This is how to output a definition of an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class. */
|
||||
|
||||
#undef ASM_OUTPUT_INTERNAL_LABEL
|
||||
#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
|
||||
fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
|
||||
|
||||
/* This is how to output a reference to an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class. */
|
||||
|
||||
#undef ASM_OUTPUT_INTERNAL_LABELREF
|
||||
#define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \
|
||||
fprintf (FILE, ".L%s%d", PREFIX, NUM)
|
||||
|
||||
/* This is how to store into the string LABEL
|
||||
the symbol_ref name of an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class.
|
||||
This is suitable for output with `assemble_name'. */
|
||||
|
||||
#undef ASM_GENERATE_INTERNAL_LABEL
|
||||
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
|
||||
sprintf (LABEL, "*.L%s%d", PREFIX, NUM)
|
||||
|
||||
/* Stabs doesn't use this, and it confuses a simulator. */
|
||||
/* ??? Need to see what DWARF needs, if anything. */
|
||||
#undef ASM_IDENTIFY_GCC
|
||||
#define ASM_IDENTIFY_GCC(FILE)
|
||||
|
||||
/* Define the names of various pseudo-ops used by the Sparc/svr4 assembler.
|
||||
??? If ints are 64 bits then UNALIGNED_INT_ASM_OP (defined elsewhere) is
|
||||
misnamed. These should all refer to explicit sizes (half/word/xword?),
|
||||
anything other than short/int/long/etc. */
|
||||
|
||||
#define UNALIGNED_DOUBLE_INT_ASM_OP ".uaxword"
|
||||
|
||||
/* DWARF bits. */
|
||||
|
||||
/* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets.
|
||||
Obviously the Dwarf2 folks havn't tried to actually build systems
|
||||
with their spec. On a 64-bit system, only 64-bit relocs become
|
||||
RELATIVE relocations. */
|
||||
|
||||
/* #define DWARF_OFFSET_SIZE PTR_SIZE */
|
||||
|
||||
/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special
|
||||
traps available which can get and set the condition codes
|
||||
reliably. */
|
||||
#undef MACHINE_STATE_SAVE
|
||||
#define MACHINE_STATE_SAVE(ID) \
|
||||
unsigned long int ms_flags, ms_saveret; \
|
||||
asm volatile("ta 0x20\n\t" \
|
||||
"mov %%g1, %0\n\t" \
|
||||
"mov %%g2, %1\n\t" \
|
||||
: "=r" (ms_flags), "=r" (ms_saveret));
|
||||
|
||||
#undef MACHINE_STATE_RESTORE
|
||||
#define MACHINE_STATE_RESTORE(ID) \
|
||||
asm volatile("mov %0, %%g1\n\t" \
|
||||
"mov %1, %%g2\n\t" \
|
||||
"ta 0x21\n\t" \
|
||||
: /* no outputs */ \
|
||||
: "r" (ms_flags), "r" (ms_saveret));
|
||||
@@ -1,38 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SPARClite w/o FPU.
|
||||
Copyright (C) 1993, 1996 Free Software Foundation, Inc.
|
||||
Contributed by Jim Wilson ([email protected]).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "sparc/sparc.h"
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dsparc -Dsparclite -Acpu(sparc) -Amachine(sparc)"
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (sparclite)");
|
||||
|
||||
/* Enable app-regs and epilogue options. Do not enable the fpu. */
|
||||
|
||||
#undef TARGET_DEFAULT
|
||||
#define TARGET_DEFAULT (MASK_APP_REGS + MASK_EPILOGUE)
|
||||
|
||||
/* US Software GOFAST library support. */
|
||||
#include "gofast.h"
|
||||
#undef INIT_SUBTARGET_OPTABS
|
||||
#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS
|
||||
@@ -1,113 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SPARClite w/o FPU, COFF.
|
||||
Copyright (C) 1994, 1996 Free Software Foundation, Inc.
|
||||
Written by Ken Raeburn ([email protected]).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "sparc/lite.h"
|
||||
|
||||
#undef ASM_OUTPUT_IDENT
|
||||
|
||||
#undef SELECT_SECTION
|
||||
#undef SELECT_RTX_SECTION
|
||||
#define BSS_SECTION_ASM_OP ".section\t\".bss\""
|
||||
|
||||
#include "svr3.h"
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dsparc -Dsparclite -Acpu(sparc) -Amachine(sparc)"
|
||||
|
||||
/* Default to stabs in COFF. */
|
||||
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
|
||||
#include "dbxcoff.h"
|
||||
|
||||
/* Support the ctors and dtors sections for g++. */
|
||||
|
||||
#undef INIT_SECTION_ASM_OP
|
||||
|
||||
/* Support the ctors and dtors sections for g++. */
|
||||
|
||||
#undef CTORS_SECTION_ASM_OP
|
||||
#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"x\""
|
||||
#undef DTORS_SECTION_ASM_OP
|
||||
#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"x\""
|
||||
|
||||
/* A list of other sections which the compiler might be "in" at any
|
||||
given time. */
|
||||
|
||||
#undef EXTRA_SECTIONS
|
||||
#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
|
||||
|
||||
/* A list of extra section function definitions. */
|
||||
|
||||
#undef EXTRA_SECTION_FUNCTIONS
|
||||
#define EXTRA_SECTION_FUNCTIONS \
|
||||
CONST_SECTION_FUNCTION \
|
||||
CTORS_SECTION_FUNCTION \
|
||||
DTORS_SECTION_FUNCTION
|
||||
|
||||
#define CTORS_SECTION_FUNCTION \
|
||||
void \
|
||||
ctors_section () \
|
||||
{ \
|
||||
if (in_section != in_ctors) \
|
||||
{ \
|
||||
fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
|
||||
in_section = in_ctors; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DTORS_SECTION_FUNCTION \
|
||||
void \
|
||||
dtors_section () \
|
||||
{ \
|
||||
if (in_section != in_dtors) \
|
||||
{ \
|
||||
fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
|
||||
in_section = in_dtors; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define INT_ASM_OP ".long"
|
||||
|
||||
/* A C statement (sans semicolon) to output an element in the table of
|
||||
global constructors. */
|
||||
#undef ASM_OUTPUT_CONSTRUCTOR
|
||||
#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
|
||||
do { \
|
||||
ctors_section (); \
|
||||
fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
|
||||
assemble_name (FILE, NAME); \
|
||||
fprintf (FILE, "\n"); \
|
||||
} while (0)
|
||||
|
||||
/* A C statement (sans semicolon) to output an element in the table of
|
||||
global destructors. */
|
||||
#undef ASM_OUTPUT_DESTRUCTOR
|
||||
#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
|
||||
do { \
|
||||
dtors_section (); \
|
||||
fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
|
||||
assemble_name (FILE, NAME); \
|
||||
fprintf (FILE, "\n"); \
|
||||
} while (0)
|
||||
|
||||
#undef DO_GLOBAL_CTORS_BODY
|
||||
#undef DO_GLOBAL_DTORS_BODY
|
||||
@@ -1,41 +0,0 @@
|
||||
/* Definitions for SPARC running LynxOS, using Lynx's old as and ld.
|
||||
Copyright (C) 1993, 1995 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <sparc/sparc.h>
|
||||
#include <lynx-ng.h>
|
||||
|
||||
/* ??? Must redefine to get sparclite and v8 defines. Can this be done
|
||||
differently? */
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%{mthreads:-D_MULTITHREADED} \
|
||||
%{mposix:-D_POSIX_SOURCE} \
|
||||
%{msystem-v:-I/usr/include_v} \
|
||||
%(cpp_cpu)"
|
||||
|
||||
/* Names to predefine in the preprocessor for this target machine. */
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dunix -Dsparc -DLynx -DIBITS32 -Asystem(unix) -Asystem(lynx) -Acpu(sparc) -Amachine(sparc)"
|
||||
|
||||
/* Provide required defaults for linker switches. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "-e __main -T 0 %{msystem-v:-V} %{mcoff:-k}"
|
||||
@@ -1,53 +0,0 @@
|
||||
/* Definitions for SPARC running LynxOS.
|
||||
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <sparc/sparc.h>
|
||||
|
||||
#undef ASM_OUTPUT_IDENT
|
||||
#undef SELECT_SECTION
|
||||
#undef SELECT_RTX_SECTION
|
||||
|
||||
#define BSS_SECTION_ASM_OP ".section\t\".bss\""
|
||||
|
||||
#include <lynx.h>
|
||||
|
||||
/* ??? Must redefine to get sparclite and v8 defines. Can this be done
|
||||
differently? */
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%{mthreads:-D_MULTITHREADED} \
|
||||
%{mposix:-D_POSIX_SOURCE} \
|
||||
%{msystem-v:-I/usr/include_v} \
|
||||
%(cpp_cpu)"
|
||||
|
||||
/* Names to predefine in the preprocessor for this target machine. */
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dunix -Dsparc -DSPARC -DLynx -DLYNX -DIBITS32 -Asystem(unix) -Asystem(lynx) -Acpu(sparc) -Amachine(sparc)"
|
||||
|
||||
#undef LINK_SPEC
|
||||
|
||||
/* Sparc version of libc.a has references to libm.a (printf calls pow for
|
||||
instance), so we must always link both. */
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC "%{mthreads:-L/lib/thread/} \
|
||||
%{msystem-v:-lc_v -lm_v -lc_v} \
|
||||
%{!msystem-v:%{mposix:-lc_p} -lc -lm -lc}"
|
||||
@@ -1,46 +0,0 @@
|
||||
#include <sparc/sparc.h>
|
||||
|
||||
/* Get generic NetBSD definitions. */
|
||||
|
||||
#include <netbsd.h>
|
||||
|
||||
/* Names to predefine in the preprocessor for this target machine. */
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dunix -Dsparc -D__NetBSD__ -Asystem(unix) -Asystem(NetBSD) -Acpu(sparc) -Amachine(sparc)"
|
||||
|
||||
/* Make gcc agree with <machine/ansi.h> */
|
||||
|
||||
#undef SIZE_TYPE
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
#define PTRDIFF_TYPE "int"
|
||||
|
||||
#undef WCHAR_TYPE
|
||||
#define WCHAR_TYPE "int"
|
||||
|
||||
#undef WCHAR_UNSIGNED
|
||||
#define WCHAR_UNSIGNED 0
|
||||
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
#define WCHAR_TYPE_SIZE 32
|
||||
|
||||
/* This is BSD, so it wants DBX format. */
|
||||
|
||||
#define DBX_DEBUGGING_INFO
|
||||
|
||||
/* This is the char to use for continuation (in case we need to turn
|
||||
continuation back on). */
|
||||
|
||||
#define DBX_CONTIN_CHAR '?'
|
||||
|
||||
/* Don't default to pcc-struct-return, because gcc is the only compiler, and
|
||||
we want to retain compatibility with older gcc versions. */
|
||||
#undef DEFAULT_PCC_STRUCT_RETURN
|
||||
#define DEFAULT_PCC_STRUCT_RETURN 0
|
||||
|
||||
/* Until they use ELF or something that handles dwarf2 unwinds
|
||||
and initialization stuff better. */
|
||||
#define DWARF2_UNWIND_INFO 0
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Configuration file for sparc OpenBSD target.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <sparc/sparc.h>
|
||||
|
||||
/* Get generic OpenBSD definitions. */
|
||||
#define OBSD_OLD_GAS
|
||||
#include <openbsd.h>
|
||||
|
||||
/* Run-time target specifications. */
|
||||
#define CPP_PREDEFINES "-D__unix__ -D__sparc__ -D__OpenBSD__ -Asystem(unix) -Asystem(OpenBSD) -Acpu(sparc) -Amachine(sparc)"
|
||||
|
||||
/* Layout of source language data types */
|
||||
|
||||
/* This must agree with <machine/ansi.h> */
|
||||
#undef SIZE_TYPE
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
#define PTRDIFF_TYPE "int"
|
||||
|
||||
#undef WCHAR_TYPE
|
||||
#define WCHAR_TYPE "int"
|
||||
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
#define WCHAR_TYPE_SIZE 32
|
||||
|
||||
/* Specific options for DBX Output. */
|
||||
|
||||
/* This is BSD, so it wants DBX format. */
|
||||
#define DBX_DEBUGGING_INFO
|
||||
|
||||
/* This is the char to use for continuation */
|
||||
#define DBX_CONTIN_CHAR '?'
|
||||
|
||||
/* Stack & calling: aggregate returns. */
|
||||
|
||||
/* Don't default to pcc-struct-return, because gcc is the only compiler, and
|
||||
we want to retain compatibility with older gcc versions. */
|
||||
#undef DEFAULT_PCC_STRUCT_RETURN
|
||||
#define DEFAULT_PCC_STRUCT_RETURN 0
|
||||
|
||||
/* Assembler format: exception region output. */
|
||||
|
||||
/* All configurations that don't use elf must be explicit about not using
|
||||
dwarf unwind information. egcs doesn't try too hard to check internal
|
||||
configuration files... */
|
||||
#define DWARF2_UNWIND_INFO 0
|
||||
|
||||
/* Default sparc.h does already define ASM_OUTPUT_MI_THUNK */
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, Citicorp/TTI Unicom PBD
|
||||
version (using GAS and COFF (encapsulated is unacceptable) )
|
||||
Copyright (C) 1990, 1996 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "sparc/sparc.h"
|
||||
|
||||
/* Names to predefine in the preprocessor for this target machine. */
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dsparc -DUnicomPBD -Dunix -D__GCC_NEW_VARARGS__ -Asystem(unix) -Acpu(sparc) -Amachine(sparc)"
|
||||
|
||||
/* We want DBX format for use with gdb under COFF. */
|
||||
|
||||
#define DBX_DEBUGGING_INFO
|
||||
|
||||
/* Generate calls to memcpy, memcmp and memset. */
|
||||
|
||||
#define TARGET_MEM_FUNCTIONS
|
||||
|
||||
/* we use /lib/libp/lib* when profiling */
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC "%{p:-L/usr/lib/libp} %{pg:-L/usr/lib/libp} -lc"
|
||||
|
||||
|
||||
/* Use crt1.o as a startup file and crtn.o as a closing file. */
|
||||
/*
|
||||
* The loader directive file gcc.ifile defines how to merge the constructor
|
||||
* sections into the data section. Also, since gas only puts out those
|
||||
* sections in response to N_SETT stabs, and does not (yet) have a
|
||||
* ".sections" directive, gcc.ifile also defines the list symbols
|
||||
* __DTOR_LIST__ and __CTOR_LIST__.
|
||||
*
|
||||
* Finally, we must explicitly specify the file from libgcc.a that defines
|
||||
* exit(), otherwise if the user specifies (for example) "-lc_s" on the
|
||||
* command line, the wrong exit() will be used and global destructors will
|
||||
* not get called .
|
||||
*/
|
||||
|
||||
#define STARTFILE_SPEC \
|
||||
"%{!r: gcc.ifile%s} %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}} \
|
||||
%{!r:_exit.o%s}"
|
||||
|
||||
#define ENDFILE_SPEC "crtn.o%s"
|
||||
|
||||
/* cpp has to support a #sccs directive for the /usr/include files */
|
||||
|
||||
#define SCCS_DIRECTIVE
|
||||
|
||||
/* LINK_SPEC is needed only for SunOS 4. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
|
||||
/* Although the gas we use can create .ctor and .dtor sections from N_SETT
|
||||
stabs, it does not support section directives, so we need to have the loader
|
||||
define the lists.
|
||||
*/
|
||||
#define CTOR_LISTS_DEFINED_EXTERNALLY
|
||||
|
||||
/* similar to default, but allows for the table defined by ld with gcc.ifile.
|
||||
nptrs is always 0. So we need to instead check that __DTOR_LIST__[1] != 0.
|
||||
The old check is left in so that the same macro can be used if and when
|
||||
a future version of gas does support section directives. */
|
||||
|
||||
#define DO_GLOBAL_DTORS_BODY {int nptrs = *(int *)__DTOR_LIST__; int i; \
|
||||
if (nptrs == -1 || (__DTOR_LIST__[0] == 0 && __DTOR_LIST__[1] != 0)) \
|
||||
for (nptrs = 0; __DTOR_LIST__[nptrs + 1] != 0; nptrs++); \
|
||||
for (i = nptrs; i >= 1; i--) \
|
||||
__DTOR_LIST__[i] (); }
|
||||
|
||||
/*
|
||||
* Here is an example gcc.ifile. I've tested it on PBD sparc
|
||||
* systems. The NEXT(0x200000) works on just about all 386 and m68k systems,
|
||||
* but can be reduced to any power of 2 that is >= NBPS (0x40000 on a pbd).
|
||||
|
||||
SECTIONS {
|
||||
.text BIND(0x41000200) BLOCK (0x200) :
|
||||
{ *(.init) *(.text) vfork = fork; *(.fini) }
|
||||
|
||||
GROUP BIND( NEXT(0x200000) + ADDR(.text) + SIZEOF(.text)):
|
||||
{ .data : { __CTOR_LIST__ = . ; . += 4; *(.ctor) . += 4 ;
|
||||
__DTOR_LIST__ = . ; . += 4; *(.dtor) . += 4 ; }
|
||||
.bss : { }
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/* The prefix to add to user-visible assembler symbols. */
|
||||
|
||||
#undef USER_LABEL_PREFIX
|
||||
#define USER_LABEL_PREFIX ""
|
||||
|
||||
/* fixes: */
|
||||
/*
|
||||
* Internal labels are prefixed with a period.
|
||||
*/
|
||||
|
||||
/* This is how to store into the string LABEL
|
||||
the symbol_ref name of an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class.
|
||||
This is suitable for output with `assemble_name'. */
|
||||
|
||||
#undef ASM_GENERATE_INTERNAL_LABEL
|
||||
|
||||
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
|
||||
sprintf (LABEL, "*.%s%d", PREFIX, NUM)
|
||||
|
||||
|
||||
/* This is how to output an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class. */
|
||||
|
||||
#undef ASM_OUTPUT_INTERNAL_LABEL
|
||||
#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
|
||||
fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
|
||||
|
||||
/* This is how to output an element of a case-vector that is relative. */
|
||||
|
||||
#undef ASM_OUTPUT_ADDR_DIFF_ELT
|
||||
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
|
||||
fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
|
||||
|
||||
/* This is how to output an element of a case-vector that is absolute.
|
||||
(The 68000 does not use such vectors,
|
||||
but we must define this macro anyway.) */
|
||||
|
||||
#undef ASM_OUTPUT_ADDR_VEC_ELT
|
||||
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
|
||||
fprintf (FILE, "\t.word .L%d\n", VALUE)
|
||||
|
||||
/* This is needed for SunOS 4.0, and should not hurt for 3.2
|
||||
versions either. */
|
||||
#undef ASM_OUTPUT_SOURCE_LINE(file, line)
|
||||
#define ASM_OUTPUT_SOURCE_LINE(file, line) \
|
||||
{ static int sym_lineno = 1; \
|
||||
fprintf (file, ".stabn 68,0,%d,.LM%d\n.LM%d:\n", \
|
||||
line, sym_lineno, sym_lineno); \
|
||||
sym_lineno += 1; }
|
||||
|
||||
#define ASM_INT_OP ".long "
|
||||
@@ -1,35 +0,0 @@
|
||||
/* Definitions for rtems targeting a SPARC using a.out.
|
||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
Contributed by Joel Sherrill ([email protected]).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "sparc/aout.h"
|
||||
|
||||
/* Specify predefined symbols in preprocessor. */
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dsparc -D__GCC_NEW_VARARGS__ -Drtems -D__rtems__ \
|
||||
-Asystem(rtems) -Acpu(sparc) -Amachine(sparc)"
|
||||
|
||||
/* Generate calls to memcpy, memcmp and memset. */
|
||||
#ifndef TARGET_MEM_FUNCTIONS
|
||||
#define TARGET_MEM_FUNCTIONS
|
||||
#endif
|
||||
|
||||
/* end of sparc/rtems.h */
|
||||
@@ -1,110 +0,0 @@
|
||||
! crt1.s for sparc & sparcv9 (SunOS 5)
|
||||
|
||||
! Copyright (C) 1992 Free Software Foundation, Inc.
|
||||
! Written By David Vinayak Henkel-Wallace, June 1992
|
||||
!
|
||||
! This file 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.
|
||||
!
|
||||
! In addition to the permissions in the GNU General Public License, the
|
||||
! Free Software Foundation gives you unlimited permission to link the
|
||||
! compiled version of this file with other programs, and to distribute
|
||||
! those programs without any restriction coming from the use of this
|
||||
! file. (The General Public License restrictions do apply in other
|
||||
! respects; for example, they cover modification of the file, and
|
||||
! distribution when not linked into another program.)
|
||||
!
|
||||
! This file 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 this program; see the file COPYING. If not, write to
|
||||
! the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
! Boston, MA 02111-1307, USA.
|
||||
!
|
||||
! As a special exception, if you link this library with files
|
||||
! compiled with GCC to produce an executable, this does not cause
|
||||
! the resulting executable to be covered by the GNU General Public License.
|
||||
! This exception does not however invalidate any other reasons why
|
||||
! the executable file might be covered by the GNU General Public License.
|
||||
!
|
||||
|
||||
! This file takes control of the process from the kernel, as specified
|
||||
! in section 3 of the SVr4 ABI.
|
||||
! This file is the first thing linked into any executable.
|
||||
|
||||
#ifdef __sparcv9
|
||||
#define CPTRSIZE 8
|
||||
#define CPTRSHIFT 3
|
||||
#define STACK_BIAS 2047
|
||||
#define ldn ldx
|
||||
#define stn stx
|
||||
#define setn(s, scratch, dst) setx s, scratch, dst
|
||||
#else
|
||||
#define CPTRSIZE 4
|
||||
#define CPTRSHIFT 2
|
||||
#define STACK_BIAS 0
|
||||
#define ldn ld
|
||||
#define stn st
|
||||
#define setn(s, scratch, dst) set s, dst
|
||||
#endif
|
||||
|
||||
.section ".text"
|
||||
.proc 022
|
||||
.global _start
|
||||
|
||||
_start:
|
||||
mov 0, %fp ! Mark bottom frame pointer
|
||||
ldn [%sp + (16 * CPTRSIZE) + STACK_BIAS], %l0 ! argc
|
||||
add %sp, (17 * CPTRSIZE) + STACK_BIAS, %l1 ! argv
|
||||
|
||||
! Leave some room for a call. Sun leaves 32 octets (to sit on
|
||||
! a cache line?) so we do too.
|
||||
#ifdef __sparcv9
|
||||
sub %sp, 48, %sp
|
||||
#else
|
||||
sub %sp, 32, %sp
|
||||
#endif
|
||||
|
||||
! %g1 may contain a function to be registered w/atexit
|
||||
orcc %g0, %g1, %g0
|
||||
#ifdef __sparcv9
|
||||
be %xcc, .nope
|
||||
#else
|
||||
be .nope
|
||||
#endif
|
||||
mov %g1, %o0
|
||||
call atexit
|
||||
nop
|
||||
.nope:
|
||||
! Now make sure constructors and destructors are handled.
|
||||
setn(_fini, %o1, %o0)
|
||||
call atexit, 1
|
||||
nop
|
||||
call _init, 0
|
||||
nop
|
||||
|
||||
! We ignore the auxiliary vector; there is no defined way to
|
||||
! access those data anyway. Instead, go straight to main:
|
||||
mov %l0, %o0 ! argc
|
||||
mov %l1, %o1 ! argv
|
||||
! Skip argc words past argv, to env:
|
||||
sll %l0, CPTRSHIFT, %o2
|
||||
add %o2, CPTRSIZE, %o2
|
||||
add %l1, %o2, %o2 ! env
|
||||
setn(_environ, %o4, %o3)
|
||||
stn %o2, [%o3] ! *_environ
|
||||
call main, 4
|
||||
nop
|
||||
call exit, 0
|
||||
nop
|
||||
call _exit, 0
|
||||
nop
|
||||
! We should never get here.
|
||||
|
||||
.type _start,#function
|
||||
.size _start,.-_start
|
||||
@@ -1,68 +0,0 @@
|
||||
! crti.s for solaris 2.0.
|
||||
|
||||
! Copyright (C) 1992 Free Software Foundation, Inc.
|
||||
! Written By David Vinayak Henkel-Wallace, June 1992
|
||||
!
|
||||
! This file 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.
|
||||
!
|
||||
! In addition to the permissions in the GNU General Public License, the
|
||||
! Free Software Foundation gives you unlimited permission to link the
|
||||
! compiled version of this file with other programs, and to distribute
|
||||
! those programs without any restriction coming from the use of this
|
||||
! file. (The General Public License restrictions do apply in other
|
||||
! respects; for example, they cover modification of the file, and
|
||||
! distribution when not linked into another program.)
|
||||
!
|
||||
! This file 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 this program; see the file COPYING. If not, write to
|
||||
! the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
! Boston, MA 02111-1307, USA.
|
||||
!
|
||||
! As a special exception, if you link this library with files
|
||||
! compiled with GCC to produce an executable, this does not cause
|
||||
! the resulting executable to be covered by the GNU General Public License.
|
||||
! This exception does not however invalidate any other reasons why
|
||||
! the executable file might be covered by the GNU General Public License.
|
||||
!
|
||||
|
||||
! This file just make a stack frame for the contents of the .fini and
|
||||
! .init sections. Users may put any desired instructions in those
|
||||
! sections.
|
||||
|
||||
! This file is linked in before the Values-Xx.o files and also before
|
||||
! crtbegin, with which perhaps it should be merged.
|
||||
|
||||
.file "crti.s"
|
||||
|
||||
.section ".init"
|
||||
.proc 022
|
||||
.global _init
|
||||
.type _init,#function
|
||||
.align 4
|
||||
_init:
|
||||
#ifdef __sparcv9
|
||||
save %sp, -176, %sp
|
||||
#else
|
||||
save %sp, -96, %sp
|
||||
#endif
|
||||
|
||||
|
||||
.section ".fini"
|
||||
.proc 022
|
||||
.global _fini
|
||||
.type _fini,#function
|
||||
.align 4
|
||||
_fini:
|
||||
#ifdef __sparcv9
|
||||
save %sp, -176, %sp
|
||||
#else
|
||||
save %sp, -96, %sp
|
||||
#endif
|
||||
@@ -1,54 +0,0 @@
|
||||
! crtn.s for solaris 2.0.
|
||||
|
||||
! Copyright (C) 1992 Free Software Foundation, Inc.
|
||||
! Written By David Vinayak Henkel-Wallace, June 1992
|
||||
!
|
||||
! This file 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.
|
||||
!
|
||||
! In addition to the permissions in the GNU General Public License, the
|
||||
! Free Software Foundation gives you unlimited permission to link the
|
||||
! compiled version of this file with other programs, and to distribute
|
||||
! those programs without any restriction coming from the use of this
|
||||
! file. (The General Public License restrictions do apply in other
|
||||
! respects; for example, they cover modification of the file, and
|
||||
! distribution when not linked into another program.)
|
||||
!
|
||||
! This file 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 this program; see the file COPYING. If not, write to
|
||||
! the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
! Boston, MA 02111-1307, USA.
|
||||
!
|
||||
! As a special exception, if you link this library with files
|
||||
! compiled with GCC to produce an executable, this does not cause
|
||||
! the resulting executable to be covered by the GNU General Public License.
|
||||
! This exception does not however invalidate any other reasons why
|
||||
! the executable file might be covered by the GNU General Public License.
|
||||
!
|
||||
|
||||
! This file just makes sure that the .fini and .init sections do in
|
||||
! fact return. Users may put any desired instructions in those sections.
|
||||
! This file is the last thing linked into any executable.
|
||||
|
||||
.file "crtn.s"
|
||||
|
||||
.section ".init"
|
||||
.align 4
|
||||
|
||||
ret
|
||||
restore
|
||||
|
||||
.section ".fini"
|
||||
.align 4
|
||||
|
||||
ret
|
||||
restore
|
||||
|
||||
! Th-th-th-that is all folks!
|
||||
@@ -1,88 +0,0 @@
|
||||
! gcrt1.s for solaris 2.0.
|
||||
|
||||
! Copyright (C) 1992 Free Software Foundation, Inc.
|
||||
! Written By David Vinayak Henkel-Wallace, June 1992
|
||||
!
|
||||
! This file 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.
|
||||
!
|
||||
! In addition to the permissions in the GNU General Public License, the
|
||||
! Free Software Foundation gives you unlimited permission to link the
|
||||
! compiled version of this file with other programs, and to distribute
|
||||
! those programs without any restriction coming from the use of this
|
||||
! file. (The General Public License restrictions do apply in other
|
||||
! respects; for example, they cover modification of the file, and
|
||||
! distribution when not linked into another program.)
|
||||
!
|
||||
! This file 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 this program; see the file COPYING. If not, write to
|
||||
! the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
! Boston, MA 02111-1307, USA.
|
||||
!
|
||||
! As a special exception, if you link this library with files
|
||||
! compiled with GCC to produce an executable, this does not cause
|
||||
! the resulting executable to be covered by the GNU General Public License.
|
||||
! This exception does not however invalidate any other reasons why
|
||||
! the executable file might be covered by the GNU General Public License.
|
||||
!
|
||||
|
||||
! This file takes control of the process from the kernel, as specified
|
||||
! in section 3 of the SVr4 ABI.
|
||||
! This file is the first thing linked into any executable.
|
||||
|
||||
.section ".text"
|
||||
.proc 022
|
||||
.global _start
|
||||
|
||||
_start:
|
||||
mov 0, %fp ! Mark bottom frame pointer
|
||||
ld [%sp + 64], %l0 ! argc
|
||||
add %sp, 68, %l1 ! argv
|
||||
|
||||
! Leave some room for a call. Sun leaves 32 octets (to sit on
|
||||
! a cache line?) so we do too.
|
||||
sub %sp, 32, %sp
|
||||
|
||||
! %g1 may contain a function to be registered w/atexit
|
||||
orcc %g0, %g1, %g0
|
||||
be .nope
|
||||
mov %g1, %o0
|
||||
call atexit
|
||||
nop
|
||||
.nope:
|
||||
! Now make sure constructors and destructors are handled.
|
||||
set _fini, %o0
|
||||
call atexit, 1
|
||||
nop
|
||||
call _init, 0
|
||||
nop
|
||||
|
||||
! We ignore the auxiliary vector; there's no defined way to
|
||||
! access those data anyway. Instead, go straight to main:
|
||||
mov %l0, %o0 ! argc
|
||||
mov %l1, %o1 ! argv
|
||||
set ___Argv, %o3
|
||||
st %o1, [%o3] ! *___Argv
|
||||
! Skip argc words past argv, to env:
|
||||
sll %l0, 2, %o2
|
||||
add %o2, 4, %o2
|
||||
add %l1, %o2, %o2 ! env
|
||||
set _environ, %o3
|
||||
st %o2, [%o3] ! *_environ
|
||||
call main, 4
|
||||
nop
|
||||
call exit, 0
|
||||
nop
|
||||
call _exit, 0
|
||||
nop
|
||||
! We should never get here.
|
||||
|
||||
.type _start,#function
|
||||
.size _start,.-_start
|
||||
@@ -1,363 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for 64-bit SPARC
|
||||
running Solaris 2 using the system linker. */
|
||||
|
||||
#define SPARC_BI_ARCH
|
||||
|
||||
#include "sparc/sol2.h"
|
||||
|
||||
/* At least up through Solaris 2.6,
|
||||
the system linker does not work with DWARF or DWARF2,
|
||||
since it does not have working support for relocations
|
||||
to unaligned data. */
|
||||
|
||||
#define LINKER_DOES_NOT_WORK_WITH_DWARF2
|
||||
|
||||
/* A 64 bit v9 compiler with stack-bias */
|
||||
|
||||
#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
|
||||
#undef TARGET_DEFAULT
|
||||
#define TARGET_DEFAULT \
|
||||
(MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ + \
|
||||
MASK_STACK_BIAS + MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU)
|
||||
#endif
|
||||
|
||||
/* The default code model. */
|
||||
#undef SPARC_DEFAULT_CMODEL
|
||||
#define SPARC_DEFAULT_CMODEL CM_MEDANY
|
||||
|
||||
#undef LONG_DOUBLE_TYPE_SIZE
|
||||
#define LONG_DOUBLE_TYPE_SIZE 128
|
||||
|
||||
#undef ASM_CPU32_DEFAULT_SPEC
|
||||
#define ASM_CPU32_DEFAULT_SPEC ""
|
||||
#undef ASM_CPU64_DEFAULT_SPEC
|
||||
#define ASM_CPU64_DEFAULT_SPEC "-xarch=v9"
|
||||
|
||||
#if TARGET_CPU_DEFAULT == TARGET_CPU_v9
|
||||
#undef CPP_CPU64_DEFAULT_SPEC
|
||||
#define CPP_CPU64_DEFAULT_SPEC ""
|
||||
#undef ASM_CPU32_DEFAULT_SPEC
|
||||
#define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plus"
|
||||
#endif
|
||||
#if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
|
||||
#undef CPP_CPU64_DEFAULT_SPEC
|
||||
#define CPP_CPU64_DEFAULT_SPEC ""
|
||||
#undef ASM_CPU32_DEFAULT_SPEC
|
||||
#define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusa"
|
||||
#undef ASM_CPU64_DEFAULT_SPEC
|
||||
#define ASM_CPU64_DEFAULT_SPEC "-xarch=v9a"
|
||||
#endif
|
||||
|
||||
/* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
|
||||
It's safe to pass -s always, even if -g is not used. */
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC "\
|
||||
%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
|
||||
%{fpic:-K PIC} %{fPIC:-K PIC} \
|
||||
%(asm_cpu)\
|
||||
"
|
||||
|
||||
#if DEFAULT_ARCH32_P
|
||||
#define DEF_ARCH32_SPEC(__str) "%{!m64:" __str "}"
|
||||
#define DEF_ARCH64_SPEC(__str) "%{m64:" __str "}"
|
||||
#else
|
||||
#define DEF_ARCH32_SPEC(__str) "%{m32:" __str "}"
|
||||
#define DEF_ARCH64_SPEC(__str) "%{!m32:" __str "}"
|
||||
#endif
|
||||
|
||||
#undef CPP_CPU_SPEC
|
||||
#define CPP_CPU_SPEC "\
|
||||
%{mcypress:} \
|
||||
%{msparclite:-D__sparclite__} \
|
||||
%{mf930:-D__sparclite__} %{mf934:-D__sparclite__} \
|
||||
%{mv8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
|
||||
%{msupersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
|
||||
%{mcpu=sparclet:-D__sparclet__} %{mcpu=tsc701:-D__sparclet__} \
|
||||
%{mcpu=sparclite:-D__sparclite__} \
|
||||
%{mcpu=f930:-D__sparclite__} %{mcpu=f934:-D__sparclite__} \
|
||||
%{mcpu=v8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
|
||||
%{mcpu=supersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
|
||||
%{mcpu=v9:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
|
||||
%{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
|
||||
%{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \
|
||||
"
|
||||
|
||||
#undef ASM_CPU_SPEC
|
||||
#define ASM_CPU_SPEC "\
|
||||
%{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC("-xarch=v9a") "} \
|
||||
%{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC("-xarch=v9") "} \
|
||||
%{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC("-xarch=v9") "}}} \
|
||||
%{!mcpu*:%(asm_cpu_default)} \
|
||||
"
|
||||
|
||||
#define STARTFILE_SPEC32 "\
|
||||
%{ansi:values-Xc.o%s} \
|
||||
%{!ansi: \
|
||||
%{traditional:values-Xt.o%s} \
|
||||
%{!traditional:values-Xa.o%s}}"
|
||||
|
||||
#define STARTFILE_SPEC64 "\
|
||||
%{ansi:/usr/lib/sparcv9/values-Xc.o%s} \
|
||||
%{!ansi: \
|
||||
%{traditional:/usr/lib/sparcv9/values-Xt.o%s} \
|
||||
%{!traditional:/usr/lib/sparcv9/values-Xa.o%s}}"
|
||||
|
||||
#ifdef SPARC_BI_ARCH
|
||||
|
||||
#if DEFAULT_ARCH32_P
|
||||
#define STARTFILE_ARCH_SPEC "\
|
||||
%{m32:" STARTFILE_SPEC32 "} \
|
||||
%{m64:" STARTFILE_SPEC64 "} \
|
||||
%{!m32:%{!m64:" STARTFILE_SPEC32 "}}"
|
||||
#else
|
||||
#define STARTFILE_ARCH_SPEC "\
|
||||
%{m32:" STARTFILE_SPEC32 "} \
|
||||
%{m64:" STARTFILE_SPEC64 "} \
|
||||
%{!m32:%{!m64:" STARTFILE_SPEC64 "}}"
|
||||
#endif
|
||||
|
||||
#else /* !SPARC_BI_ARCH */
|
||||
|
||||
/* In this case we define MD_STARTFILE_PREFIX to /usr/lib/sparcv9/ */
|
||||
#define STARTFILE_ARCH_SPEC STARTFILE_SPEC32
|
||||
|
||||
#endif /* !SPARC_BI_ARCH */
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC "%{!shared: \
|
||||
%{!symbolic: \
|
||||
%{p:mcrt1.o%s} \
|
||||
%{!p: \
|
||||
%{pg:gcrt1.o%s gmon.o%s} \
|
||||
%{!pg:crt1.o%s}}}} \
|
||||
crti.o%s" STARTFILE_ARCH_SPEC " \
|
||||
crtbegin.o%s"
|
||||
|
||||
#ifdef SPARC_BI_ARCH
|
||||
|
||||
#undef CPP_CPU_DEFAULT_SPEC
|
||||
#define CPP_CPU_DEFAULT_SPEC \
|
||||
(DEFAULT_ARCH32_P ? "\
|
||||
%{m64:" CPP_CPU64_DEFAULT_SPEC "} \
|
||||
%{!m64:" CPP_CPU32_DEFAULT_SPEC "} \
|
||||
" : "\
|
||||
%{m32:" CPP_CPU32_DEFAULT_SPEC "} \
|
||||
%{!m32:" CPP_CPU64_DEFAULT_SPEC "} \
|
||||
")
|
||||
|
||||
#undef ASM_CPU_DEFAULT_SPEC
|
||||
#define ASM_CPU_DEFAULT_SPEC \
|
||||
(DEFAULT_ARCH32_P ? "\
|
||||
%{m64:" ASM_CPU64_DEFAULT_SPEC "} \
|
||||
%{!m64:" ASM_CPU32_DEFAULT_SPEC "} \
|
||||
" : "\
|
||||
%{m32:" ASM_CPU32_DEFAULT_SPEC "} \
|
||||
%{!m32:" ASM_CPU64_DEFAULT_SPEC "} \
|
||||
")
|
||||
|
||||
#undef CPP_ARCH32_SPEC
|
||||
#define CPP_ARCH32_SPEC "-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int \
|
||||
-D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc)"
|
||||
#undef CPP_ARCH64_SPEC
|
||||
#define CPP_ARCH64_SPEC "-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int \
|
||||
-D__arch64__ -Acpu(sparc64) -Amachine(sparcv9) -D__sparcv9"
|
||||
|
||||
#undef CPP_ARCH_SPEC
|
||||
#define CPP_ARCH_SPEC "\
|
||||
%{m32:%(cpp_arch32)} \
|
||||
%{m64:%(cpp_arch64)} \
|
||||
%{!m32:%{!m64:%(cpp_arch_default)}} \
|
||||
"
|
||||
|
||||
#undef ASM_ARCH_SPEC
|
||||
#define ASM_ARCH_SPEC ""
|
||||
|
||||
#undef ASM_ARCH32_SPEC
|
||||
#define ASM_ARCH32_SPEC ""
|
||||
|
||||
#undef ASM_ARCH64_SPEC
|
||||
#define ASM_ARCH64_SPEC ""
|
||||
|
||||
#undef ASM_ARCH_DEFAULT_SPEC
|
||||
#define ASM_ARCH_DEFAULT_SPEC ""
|
||||
|
||||
#undef SUBTARGET_EXTRA_SPECS
|
||||
#define SUBTARGET_EXTRA_SPECS \
|
||||
{ "link_arch32", LINK_ARCH32_SPEC }, \
|
||||
{ "link_arch64", LINK_ARCH64_SPEC }, \
|
||||
{ "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
|
||||
{ "link_arch", LINK_ARCH_SPEC },
|
||||
|
||||
/* This should be the same as in svr4.h, except with -R added. */
|
||||
#define LINK_ARCH32_SPEC \
|
||||
"%{G:-G} \
|
||||
%{YP,*} \
|
||||
%{R*} \
|
||||
%{compat-bsd: \
|
||||
%{!YP,*:%{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
|
||||
%{pg:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
|
||||
%{!p:%{!pg:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}}} \
|
||||
-R /usr/ucblib} \
|
||||
%{!compat-bsd: \
|
||||
%{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
|
||||
%{pg:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
|
||||
%{!p:%{!pg:-Y P,/usr/ccs/lib:/usr/lib}}}}"
|
||||
|
||||
#define LINK_ARCH64_SPEC \
|
||||
"%{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \
|
||||
%{G:-G} \
|
||||
%{YP,*} \
|
||||
%{R*} \
|
||||
%{compat-bsd: \
|
||||
%{!YP,*:%{p:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
|
||||
%{pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
|
||||
%{!p:%{!pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/sparcv9}}} \
|
||||
-R /usr/ucblib} \
|
||||
%{!compat-bsd: \
|
||||
%{!YP,*:%{p:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
|
||||
%{pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
|
||||
%{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}}"
|
||||
|
||||
#define LINK_ARCH_SPEC "\
|
||||
%{m32:%(link_arch32)} \
|
||||
%{m64:%(link_arch64)} \
|
||||
%{!m32:%{!m64:%(link_arch_default)}} \
|
||||
"
|
||||
|
||||
#define LINK_ARCH_DEFAULT_SPEC \
|
||||
(DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC \
|
||||
"%{h*} %{v:-V} \
|
||||
%{b} %{Wl,*:%*} \
|
||||
%{static:-dn -Bstatic} \
|
||||
%{shared:-G -dy %{!mimpure-text:-z text}} \
|
||||
%{symbolic:-Bsymbolic -G -dy -z text} \
|
||||
%(link_arch) \
|
||||
%{Qy:} %{!Qn:-Qy}"
|
||||
|
||||
#undef CC1_SPEC
|
||||
#if DEFAULT_ARCH32_P
|
||||
#define CC1_SPEC "\
|
||||
%{sun4:} %{target:} \
|
||||
%{mcypress:-mcpu=cypress} \
|
||||
%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
|
||||
%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
|
||||
%{m64:-mptr64 -mcpu=v9 -mstack-bias -mno-v8plus} \
|
||||
"
|
||||
#else
|
||||
#define CC1_SPEC "\
|
||||
%{sun4:} %{target:} \
|
||||
%{mcypress:-mcpu=cypress} \
|
||||
%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
|
||||
%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
|
||||
%{m32:-mptr32 -mcpu=cypress -mno-stack-bias} \
|
||||
%{mv8plus:-m32 -mptr32 -mcpu=cypress -mno-stack-bias} \
|
||||
"
|
||||
#endif
|
||||
|
||||
#if DEFAULT_ARCH32_P
|
||||
#define MULTILIB_DEFAULTS { "m32" }
|
||||
#else
|
||||
#define MULTILIB_DEFAULTS { "m64" }
|
||||
#endif
|
||||
|
||||
#else /* !SPARC_BI_ARCH */
|
||||
|
||||
/*
|
||||
* This should be the same as in sol2-sld.h, except with "/sparcv9"
|
||||
* appended to the paths and /usr/ccs/lib is no longer necessary
|
||||
*/
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC \
|
||||
"%{h*} %{v:-V} \
|
||||
%{b} %{Wl,*:%*} \
|
||||
%{static:-dn -Bstatic} \
|
||||
%{shared:-G -dy %{!mimpure-text:-z text}} \
|
||||
%{symbolic:-Bsymbolic -G -dy -z text} \
|
||||
%{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \
|
||||
%{G:-G} \
|
||||
%{YP,*} \
|
||||
%{R*} \
|
||||
%{compat-bsd: \
|
||||
%{!YP,*:%{p:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
|
||||
%{pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
|
||||
%{!p:%{!pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/sparcv9}}} \
|
||||
-R /usr/ucblib} \
|
||||
%{!compat-bsd: \
|
||||
%{!YP,*:%{p:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
|
||||
%{pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
|
||||
%{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}} \
|
||||
%{Qy:} %{!Qn:-Qy}"
|
||||
|
||||
#undef MD_STARTFILE_PREFIX
|
||||
#define MD_STARTFILE_PREFIX "/usr/lib/sparcv9/"
|
||||
|
||||
#endif /* ! SPARC_BI_ARCH */
|
||||
|
||||
/*
|
||||
* Attempt to turn on access permissions for the stack.
|
||||
*
|
||||
* This code must be defined when compiling gcc but not when compiling
|
||||
* libgcc2.a, unless we're generating code for 64 bits SPARC
|
||||
*
|
||||
* _SC_STACK_PROT is only defined for post 2.6, but we want this code
|
||||
* to run always. 2.6 can change the stack protection but has no way to
|
||||
* query it.
|
||||
*
|
||||
*/
|
||||
|
||||
#define TRANSFER_FROM_TRAMPOLINE \
|
||||
static int need_enable_exec_stack; \
|
||||
\
|
||||
static void check_enabling(void) __attribute__ ((constructor)); \
|
||||
static void check_enabling(void) \
|
||||
{ \
|
||||
extern long sysconf(int); \
|
||||
\
|
||||
int prot = (int) sysconf(515 /*_SC_STACK_PROT */); \
|
||||
if (prot != 7) \
|
||||
need_enable_exec_stack = 1; \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
__enable_execute_stack (addr) \
|
||||
void *addr; \
|
||||
{ \
|
||||
if (!need_enable_exec_stack) \
|
||||
return; \
|
||||
else { \
|
||||
long size = getpagesize (); \
|
||||
long mask = ~(size-1); \
|
||||
char *page = (char *) (((long) addr) & mask); \
|
||||
char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \
|
||||
\
|
||||
/* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \
|
||||
if (mprotect (page, end - page, 7) < 0) \
|
||||
perror ("mprotect of trampoline code"); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* A C statement (sans semicolon) to output an element in the table of
|
||||
global constructors. */
|
||||
#undef ASM_OUTPUT_CONSTRUCTOR
|
||||
#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
|
||||
do { \
|
||||
ctors_section (); \
|
||||
fprintf (FILE, "\t%s\t ", TARGET_ARCH64 ? ASM_LONGLONG : INT_ASM_OP); \
|
||||
assemble_name (FILE, NAME); \
|
||||
fprintf (FILE, "\n"); \
|
||||
} while (0)
|
||||
|
||||
/* A C statement (sans semicolon) to output an element in the table of
|
||||
global destructors. */
|
||||
#undef ASM_OUTPUT_DESTRUCTOR
|
||||
#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
|
||||
do { \
|
||||
dtors_section (); \
|
||||
fprintf (FILE, "\t%s\t ", TARGET_ARCH64 ? ASM_LONGLONG : INT_ASM_OP); \
|
||||
assemble_name (FILE, NAME); \
|
||||
fprintf (FILE, "\n"); \
|
||||
} while (0)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SPARC running Solaris 2
|
||||
using the system linker. */
|
||||
|
||||
#include "sparc/sol2.h"
|
||||
|
||||
/* At least up through Solaris 2.6,
|
||||
the system linker does not work with DWARF or DWARF2,
|
||||
since it does not have working support for relocations
|
||||
to unaligned data. */
|
||||
|
||||
#define LINKER_DOES_NOT_WORK_WITH_DWARF2
|
||||
@@ -1,236 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SPARC running Solaris 2
|
||||
Copyright 1992, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Contributed by Ron Guilmette (rfg@netcom.com).
|
||||
Additional changes by David V. Henkel-Wallace (gumby@cygnus.com).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Supposedly the same as vanilla sparc svr4, except for the stuff below: */
|
||||
#include "sparc/sysv4.h"
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES \
|
||||
"-Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 \
|
||||
-Asystem(unix) -Asystem(svr4)"
|
||||
|
||||
#undef CPP_SUBTARGET_SPEC
|
||||
#define CPP_SUBTARGET_SPEC "\
|
||||
%{pthreads:-D_REENTRANT -D_PTHREADS} \
|
||||
%{!pthreads:%{threads:-D_REENTRANT -D_SOLARIS_THREADS}} \
|
||||
%{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude} \
|
||||
"
|
||||
|
||||
/* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
|
||||
It's safe to pass -s always, even if -g is not used. */
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC "\
|
||||
%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
|
||||
%{fpic:-K PIC} %{fPIC:-K PIC} \
|
||||
%(asm_cpu) \
|
||||
"
|
||||
|
||||
/* This is here rather than in sparc.h because it's not known what
|
||||
other assemblers will accept. */
|
||||
#if TARGET_CPU_DEFAULT == TARGET_CPU_v9
|
||||
#undef ASM_CPU_DEFAULT_SPEC
|
||||
#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plus"
|
||||
#endif
|
||||
#if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
|
||||
#undef ASM_CPU_DEFAULT_SPEC
|
||||
#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusa"
|
||||
#endif
|
||||
#undef ASM_CPU_SPEC
|
||||
#define ASM_CPU_SPEC "\
|
||||
%{mcpu=v8plus:-xarch=v8plus} \
|
||||
%{mcpu=ultrasparc:-xarch=v8plusa} \
|
||||
%{!mcpu*:%(asm_cpu_default)} \
|
||||
"
|
||||
|
||||
/* However it appears that Solaris 2.0 uses the same reg numbering as
|
||||
the old BSD-style system did. */
|
||||
|
||||
#undef DBX_REGISTER_NUMBER
|
||||
/* Same as sparc.h */
|
||||
#define DBX_REGISTER_NUMBER(REGNO) \
|
||||
(TARGET_FLAT && REGNO == FRAME_POINTER_REGNUM ? 31 : REGNO)
|
||||
|
||||
/* We use stabs-in-elf for debugging, because that is what the native
|
||||
toolchain uses. */
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
|
||||
/* The Solaris 2 assembler uses .skip, not .zero, so put this back. */
|
||||
#undef ASM_OUTPUT_SKIP
|
||||
#define ASM_OUTPUT_SKIP(FILE,SIZE) \
|
||||
fprintf (FILE, "\t.skip %u\n", (SIZE))
|
||||
|
||||
/* Use .uahalf/.uaword so packed structure members don't generate
|
||||
assembler errors when using the native assembler. */
|
||||
#undef ASM_SHORT
|
||||
#define ASM_SHORT ".uahalf"
|
||||
#undef ASM_LONG
|
||||
#define ASM_LONG ".uaword"
|
||||
|
||||
/* This is how to output a definition of an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class. */
|
||||
|
||||
#undef ASM_OUTPUT_INTERNAL_LABEL
|
||||
#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
|
||||
fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
|
||||
|
||||
/* This is how to output a reference to an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class. */
|
||||
|
||||
#undef ASM_OUTPUT_INTERNAL_LABELREF
|
||||
#define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \
|
||||
fprintf (FILE, ".L%s%d", PREFIX, NUM)
|
||||
|
||||
/* This is how to store into the string LABEL
|
||||
the symbol_ref name of an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class.
|
||||
This is suitable for output with `assemble_name'. */
|
||||
|
||||
#undef ASM_GENERATE_INTERNAL_LABEL
|
||||
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
|
||||
sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))
|
||||
|
||||
|
||||
/* We don't use the standard svr4 STARTFILE_SPEC because it's wrong for us.
|
||||
We don't use the standard LIB_SPEC only because we don't yet support c++ */
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC "%{!shared: \
|
||||
%{!symbolic: \
|
||||
%{p:mcrt1.o%s} \
|
||||
%{!p: \
|
||||
%{pg:gcrt1.o%s gmon.o%s} \
|
||||
%{!pg:crt1.o%s}}}} \
|
||||
crti.o%s \
|
||||
%{ansi:values-Xc.o%s} \
|
||||
%{!ansi: \
|
||||
%{traditional:values-Xt.o%s} \
|
||||
%{!traditional:values-Xa.o%s}} \
|
||||
crtbegin.o%s"
|
||||
|
||||
/* ??? Note: in order for -compat-bsd to work fully,
|
||||
we must somehow arrange to fixincludes /usr/ucbinclude
|
||||
and put the result in $(libsubdir)/ucbinclude. */
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC \
|
||||
"%{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} \
|
||||
%{!shared:\
|
||||
%{!symbolic:\
|
||||
%{pthreads:-lpthread} \
|
||||
%{!pthreads:%{threads:-lthread}} \
|
||||
-lc}}"
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
|
||||
|
||||
/* This should be the same as in svr4.h, except with -R added. */
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC \
|
||||
"%{h*} %{v:-V} \
|
||||
%{b} %{Wl,*:%*} \
|
||||
%{static:-dn -Bstatic} \
|
||||
%{shared:-G -dy %{!mimpure-text:-z text}} \
|
||||
%{symbolic:-Bsymbolic -G -dy -z text} \
|
||||
%{G:-G} \
|
||||
%{YP,*} \
|
||||
%{R*} \
|
||||
%{compat-bsd: \
|
||||
%{!YP,*:%{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
|
||||
%{pg:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
|
||||
%{!p:%{!pg:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}}} \
|
||||
-R /usr/ucblib} \
|
||||
%{!compat-bsd: \
|
||||
%{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
|
||||
%{pg:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
|
||||
%{!p:%{!pg:-Y P,/usr/ccs/lib:/usr/lib}}}} \
|
||||
%{Qy:} %{!Qn:-Qy}"
|
||||
|
||||
/* This defines which switch letters take arguments.
|
||||
It is as in svr4.h but with -R added. */
|
||||
|
||||
#undef SWITCH_TAKES_ARG
|
||||
#define SWITCH_TAKES_ARG(CHAR) \
|
||||
(DEFAULT_SWITCH_TAKES_ARG(CHAR) \
|
||||
|| (CHAR) == 'R' \
|
||||
|| (CHAR) == 'h' \
|
||||
|| (CHAR) == 'x' \
|
||||
|| (CHAR) == 'z')
|
||||
|
||||
/* ??? This does not work in SunOS 4.x, so it is not enabled in sparc.h.
|
||||
Instead, it is enabled here, because it does work under Solaris. */
|
||||
/* Define for support of TFmode long double and REAL_ARITHMETIC.
|
||||
Sparc ABI says that long double is 4 words. */
|
||||
#define LONG_DOUBLE_TYPE_SIZE 128
|
||||
|
||||
/* But indicate that it isn't supported by the hardware. */
|
||||
#define WIDEST_HARDWARE_FP_SIZE 64
|
||||
|
||||
#define STDC_0_IN_SYSTEM_HEADERS
|
||||
|
||||
#define MULDI3_LIBCALL "__mul64"
|
||||
#define DIVDI3_LIBCALL "__div64"
|
||||
#define UDIVDI3_LIBCALL "__udiv64"
|
||||
#define MODDI3_LIBCALL "__rem64"
|
||||
#define UMODDI3_LIBCALL "__urem64"
|
||||
|
||||
#undef INIT_SUBTARGET_OPTABS
|
||||
#define INIT_SUBTARGET_OPTABS \
|
||||
fixsfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, \
|
||||
TARGET_ARCH64 ? "__ftol" : "__ftoll"); \
|
||||
fixunssfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, \
|
||||
TARGET_ARCH64 ? "__ftoul" : "__ftoull"); \
|
||||
fixdfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, \
|
||||
TARGET_ARCH64 ? "__dtol" : "__dtoll"); \
|
||||
fixunsdfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, \
|
||||
TARGET_ARCH64 ? "__dtoul" : "__dtoull")
|
||||
|
||||
/* No weird SPARC variants on Solaris */
|
||||
#undef TARGET_LIVE_G0
|
||||
#define TARGET_LIVE_G0 0
|
||||
#undef TARGET_BROKEN_SAVERESTORE
|
||||
#define TARGET_BROKEN_SAVERESTORE 0
|
||||
|
||||
/* Solaris allows 64 bit out and global registers in 32 bit mode.
|
||||
sparc_override_options will disable V8+ if not generating V9 code. */
|
||||
#undef TARGET_DEFAULT
|
||||
#define TARGET_DEFAULT (MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU + MASK_V8PLUS)
|
||||
|
||||
/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special
|
||||
traps available which can get and set the condition codes
|
||||
reliably. */
|
||||
#undef MACHINE_STATE_SAVE
|
||||
#define MACHINE_STATE_SAVE(ID) \
|
||||
unsigned long int ms_flags, ms_saveret; \
|
||||
asm volatile("ta 0x20\n\t" \
|
||||
"mov %%g1, %0\n\t" \
|
||||
"mov %%g2, %1\n\t" \
|
||||
: "=r" (ms_flags), "=r" (ms_saveret));
|
||||
|
||||
#undef MACHINE_STATE_RESTORE
|
||||
#define MACHINE_STATE_RESTORE(ID) \
|
||||
asm volatile("mov %0, %%g1\n\t" \
|
||||
"mov %1, %%g2\n\t" \
|
||||
"ta 0x21\n\t" \
|
||||
: /* no outputs */ \
|
||||
: "r" (ms_flags), "r" (ms_saveret));
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SPARC64, a.out.
|
||||
Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Contributed by Doug Evans, dje@cygnus.com.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "sparc/sparc.h"
|
||||
#include "aoutos.h"
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (sparc64-aout)")
|
||||
|
||||
#undef TARGET_DEFAULT
|
||||
#define TARGET_DEFAULT \
|
||||
(MASK_V9 + MASK_PTR64 + MASK_64BIT + MASK_HARD_QUAD \
|
||||
+ MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU + MASK_STACK_BIAS)
|
||||
|
||||
/* The only code model supported is Medium/Low. */
|
||||
#undef SPARC_DEFAULT_CMODEL
|
||||
#define SPARC_DEFAULT_CMODEL CM_MEDLOW
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dsparc -Acpu(sparc) -Amachine(sparc)"
|
||||
@@ -1,158 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SPARC64, ELF.
|
||||
Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Contributed by Doug Evans, dje@cygnus.com.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* ??? We're taking the scheme of including another file and then overriding
|
||||
the values we don't like a bit too far here. The alternative is to more or
|
||||
less duplicate all of svr4.h, sparc/sysv4.h, and sparc/sol2.h here
|
||||
(suitably cleaned up). */
|
||||
|
||||
#include "sparc/sol2.h"
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (sparc64-elf)")
|
||||
|
||||
/* A 64 bit v9 compiler in a Medium/Anywhere code model environment. */
|
||||
|
||||
#undef TARGET_DEFAULT
|
||||
#define TARGET_DEFAULT \
|
||||
(MASK_V9 + MASK_PTR64 + MASK_64BIT + MASK_HARD_QUAD \
|
||||
+ MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU + MASK_STACK_BIAS)
|
||||
|
||||
#undef SPARC_DEFAULT_CMODEL
|
||||
#define SPARC_DEFAULT_CMODEL CM_EMBMEDANY
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dsparc -D__ELF__ -Acpu(sparc) -Amachine(sparc)"
|
||||
|
||||
/* __svr4__ is used by the C library (FIXME) */
|
||||
#undef CPP_SUBTARGET_SPEC
|
||||
#define CPP_SUBTARGET_SPEC "-D__svr4__"
|
||||
|
||||
#undef MD_EXEC_PREFIX
|
||||
#undef MD_STARTFILE_PREFIX
|
||||
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC "\
|
||||
%{v:-V} -s %{fpic:-K PIC} %{fPIC:-K PIC} \
|
||||
%{mlittle-endian:-EL} \
|
||||
%(asm_cpu) %(asm_arch) \
|
||||
"
|
||||
|
||||
/* This is taken from sol2.h. */
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "\
|
||||
%{v:-V} \
|
||||
%{mlittle-endian:-EL} \
|
||||
"
|
||||
|
||||
/* We need something a little simpler for the embedded environment.
|
||||
Profiling doesn't really work yet so we just copy the default. */
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC "\
|
||||
%{!shared:%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}} \
|
||||
crtbegin.o%s \
|
||||
"
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC "crtend.o%s"
|
||||
|
||||
/* Use the default (for now). */
|
||||
#undef LIB_SPEC
|
||||
|
||||
/* V9 chips can handle either endianness. */
|
||||
#undef SUBTARGET_SWITCHES
|
||||
#define SUBTARGET_SWITCHES \
|
||||
{"big-endian", -MASK_LITTLE_ENDIAN, "Generate code for big endian" }, \
|
||||
{"little-endian", MASK_LITTLE_ENDIAN, "Generate code for little endian" },
|
||||
|
||||
#undef BYTES_BIG_ENDIAN
|
||||
#define BYTES_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
|
||||
|
||||
#undef WORDS_BIG_ENDIAN
|
||||
#define WORDS_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
|
||||
|
||||
/* ??? This should be 32 bits for v9 but what can we do? */
|
||||
#undef WCHAR_TYPE
|
||||
#define WCHAR_TYPE "short unsigned int"
|
||||
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
#define WCHAR_TYPE_SIZE 16
|
||||
|
||||
#undef LONG_DOUBLE_TYPE_SIZE
|
||||
#define LONG_DOUBLE_TYPE_SIZE 128
|
||||
|
||||
/* The medium/anywhere code model practically requires us to put jump tables
|
||||
in the text section as gcc is unable to distinguish LABEL_REF's of jump
|
||||
tables from other label refs (when we need to). */
|
||||
/* But we now defer the tables to the end of the function, so we make
|
||||
this 0 to not confuse the branch shortening code. */
|
||||
#undef JUMP_TABLES_IN_TEXT_SECTION
|
||||
#define JUMP_TABLES_IN_TEXT_SECTION 0
|
||||
|
||||
/* System V Release 4 uses DWARF debugging info.
|
||||
GDB doesn't support 64 bit stabs yet and the desired debug format is DWARF
|
||||
anyway so it is the default. */
|
||||
|
||||
#define DWARF_DEBUGGING_INFO
|
||||
#define DWARF2_DEBUGGING_INFO
|
||||
#define DBX_DEBUGGING_INFO
|
||||
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
|
||||
|
||||
/* Stabs doesn't use this, and it confuses a simulator. */
|
||||
/* ??? Need to see what DWARF needs, if anything. */
|
||||
#undef ASM_IDENTIFY_GCC
|
||||
#define ASM_IDENTIFY_GCC(FILE)
|
||||
|
||||
/* Define the names of various pseudo-ops used by the Sparc/svr4 assembler.
|
||||
??? If ints are 64 bits then UNALIGNED_INT_ASM_OP (defined elsewhere) is
|
||||
misnamed. These should all refer to explicit sizes (half/word/xword?),
|
||||
anything other than short/int/long/etc. */
|
||||
|
||||
#define UNALIGNED_LONGLONG_ASM_OP ".uaxword"
|
||||
|
||||
/* DWARF stuff. */
|
||||
|
||||
#define ASM_OUTPUT_DWARF_ADDR(FILE, LABEL) \
|
||||
do { \
|
||||
fprintf ((FILE), "\t%s\t", UNALIGNED_LONGLONG_ASM_OP); \
|
||||
assemble_name ((FILE), (LABEL)); \
|
||||
fprintf ((FILE), "\n"); \
|
||||
} while (0)
|
||||
|
||||
#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE, RTX) \
|
||||
do { \
|
||||
fprintf ((FILE), "\t%s\t", UNALIGNED_LONGLONG_ASM_OP); \
|
||||
output_addr_const ((FILE), (RTX)); \
|
||||
fputc ('\n', (FILE)); \
|
||||
} while (0)
|
||||
|
||||
#define ASM_OUTPUT_DWARF2_ADDR_CONST(FILE, ADDR) \
|
||||
fprintf ((FILE), "\t%s\t%s", UNALIGNED_LONGLONG_ASM_OP, (ADDR))
|
||||
|
||||
/* ??? Not sure if this should be 4 or 8 bytes. 4 works for now. */
|
||||
#define ASM_OUTPUT_DWARF_REF(FILE, LABEL) \
|
||||
do { \
|
||||
fprintf ((FILE), "\t%s\t", UNALIGNED_INT_ASM_OP); \
|
||||
assemble_name ((FILE), (LABEL)); \
|
||||
fprintf ((FILE), "\n"); \
|
||||
} while (0)
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,69 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SPARClet.
|
||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
Contributed by Doug Evans (dje@cygnus.com).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "sparc/aout.h"
|
||||
|
||||
/* -mbroken-saverestore is not included here because the long term
|
||||
default is -mno-broken-saverestore. */
|
||||
#undef TARGET_DEFAULT
|
||||
#define TARGET_DEFAULT (MASK_APP_REGS + MASK_EPILOGUE)
|
||||
|
||||
/* -mlive-g0 is only supported on the sparclet. */
|
||||
#undef SUBTARGET_SWITCHES
|
||||
#define SUBTARGET_SWITCHES \
|
||||
{"big-endian", -MASK_LITTLE_ENDIAN, "Generate code for big endian" }, \
|
||||
{"little-endian", MASK_LITTLE_ENDIAN, "Generate code for little endian" }, \
|
||||
{"live-g0", MASK_LIVE_G0, "Use g0 as a normal register" }, \
|
||||
{"no-live-g0", -MASK_LIVE_G0, "Register g0 is fixed with a zero value" }, \
|
||||
{"broken-saverestore", MASK_BROKEN_SAVERESTORE, "Enable save/restore bug workarounds" }, \
|
||||
{"no-broken-saverestore", -MASK_BROKEN_SAVERESTORE, "Disable save/restore bug workarouns" },
|
||||
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC "%{mlittle-endian:-EL} %(asm_cpu)"
|
||||
|
||||
/* Require the user to supply crt0.o. */
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "%{mlittle-endian:-EL}"
|
||||
|
||||
/* sparclet chips are bi-endian. */
|
||||
#undef BYTES_BIG_ENDIAN
|
||||
#define BYTES_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
|
||||
#undef WORDS_BIG_ENDIAN
|
||||
#define WORDS_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
|
||||
|
||||
#undef SUBTARGET_OVERRIDE_OPTIONS
|
||||
#define SUBTARGET_OVERRIDE_OPTIONS \
|
||||
do { \
|
||||
if (TARGET_LIVE_G0) \
|
||||
{ \
|
||||
warning ("Option '-mlive-g0' deprecated."); \
|
||||
target_flags &= ~MASK_LIVE_G0; \
|
||||
} \
|
||||
else if (TARGET_BROKEN_SAVERESTORE) \
|
||||
{ \
|
||||
warning ("Option '-mbroken-saverestore' deprecated."); \
|
||||
target_flags &= ~MASK_BROKEN_SAVERESTORE; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SunOS 4.x with gas
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* gas supports unaligned data. */
|
||||
#define UNALIGNED_DOUBLE_INT_ASM_OP ".uaxword"
|
||||
#define UNALIGNED_INT_ASM_OP ".uaword"
|
||||
#define UNALIGNED_SHORT_ASM_OP ".uahalf"
|
||||
|
||||
/* defaults.h will define DWARF2_UNWIND_INFO for us. */
|
||||
#undef DWARF2_UNWIND_INFO
|
||||
@@ -1,29 +0,0 @@
|
||||
#include "sparc/sparc.h"
|
||||
|
||||
/* Override the name of the mcount profiling function. */
|
||||
|
||||
#undef MCOUNT_FUNCTION
|
||||
#define MCOUNT_FUNCTION "*.mcount"
|
||||
|
||||
/* LINK_SPEC is needed only for SunOS 4. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
|
||||
/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special
|
||||
traps available which can get and set the condition codes
|
||||
reliably. */
|
||||
#undef MACHINE_STATE_SAVE
|
||||
#define MACHINE_STATE_SAVE(ID) \
|
||||
unsigned long int ms_flags, ms_saveret; \
|
||||
asm volatile("ta 0x20\n\t" \
|
||||
"mov %%g1, %0\n\t" \
|
||||
"mov %%g2, %1\n\t" \
|
||||
: "=r" (ms_flags), "=r" (ms_saveret));
|
||||
|
||||
#undef MACHINE_STATE_RESTORE
|
||||
#define MACHINE_STATE_RESTORE(ID) \
|
||||
asm volatile("mov %0, %%g1\n\t" \
|
||||
"mov %1, %%g2\n\t" \
|
||||
"ta 0x21\n\t" \
|
||||
: /* no outputs */ \
|
||||
: "r" (ms_flags), "r" (ms_saveret));
|
||||
@@ -1,49 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SunOS 4.x
|
||||
Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define SUNOS4_SHARED_LIBRARIES 1
|
||||
|
||||
/* Use N_BINCL stabs. */
|
||||
|
||||
#define DBX_USE_BINCL
|
||||
|
||||
#include "sparc/sparc.h"
|
||||
|
||||
/* The Sun as doesn't like unaligned data. */
|
||||
#define DWARF2_UNWIND_INFO 0
|
||||
|
||||
/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special
|
||||
traps available which can get and set the condition codes
|
||||
reliably. */
|
||||
#undef MACHINE_STATE_SAVE
|
||||
#define MACHINE_STATE_SAVE(ID) \
|
||||
unsigned long int ms_flags, ms_saveret; \
|
||||
asm volatile("ta 0x20\n\t" \
|
||||
"mov %%g1, %0\n\t" \
|
||||
"mov %%g2, %1\n\t" \
|
||||
: "=r" (ms_flags), "=r" (ms_saveret));
|
||||
|
||||
#undef MACHINE_STATE_RESTORE
|
||||
#define MACHINE_STATE_RESTORE(ID) \
|
||||
asm volatile("mov %0, %%g1\n\t" \
|
||||
"mov %1, %%g2\n\t" \
|
||||
"ta 0x21\n\t" \
|
||||
: /* no outputs */ \
|
||||
: "r" (ms_flags), "r" (ms_saveret));
|
||||
@@ -1,216 +0,0 @@
|
||||
/* Target definitions for GNU compiler for Sparc running System V.4
|
||||
Copyright (C) 1991, 92, 95, 96, 97, 1998 Free Software Foundation, Inc.
|
||||
Contributed by Ron Guilmette (rfg@monkeys.com).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "sparc/sparc.h"
|
||||
|
||||
/* Undefine some symbols which are defined in "sparc.h" but which are
|
||||
appropriate only for SunOS 4.x, and not for svr4. */
|
||||
|
||||
#undef WORD_SWITCH_TAKES_ARG
|
||||
#undef ASM_OUTPUT_SOURCE_LINE
|
||||
#undef SELECT_SECTION
|
||||
#undef ASM_DECLARE_FUNCTION_NAME
|
||||
#undef TEXT_SECTION_ASM_OP
|
||||
#undef DATA_SECTION_ASM_OP
|
||||
|
||||
#include "svr4.h"
|
||||
|
||||
/* ??? Put back the SIZE_TYPE/PTRDIFF_TYPE definitions set by sparc.h.
|
||||
Why, exactly, is svr4.h messing with this? Seems like the chip
|
||||
would know best. */
|
||||
|
||||
#undef SIZE_TYPE
|
||||
#define SIZE_TYPE (TARGET_ARCH64 ? "long unsigned int" : "unsigned int")
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
#define PTRDIFF_TYPE (TARGET_ARCH64 ? "long int" : "int")
|
||||
|
||||
/* Undefined some symbols which are defined in "svr4.h" but which are
|
||||
appropriate only for typical svr4 systems, but not for the specific
|
||||
case of svr4 running on a Sparc. */
|
||||
|
||||
#undef INIT_SECTION_ASM_OP
|
||||
#undef FINI_SECTION_ASM_OP
|
||||
#undef CONST_SECTION_ASM_OP
|
||||
#undef TYPE_OPERAND_FMT
|
||||
#undef PUSHSECTION_FORMAT
|
||||
#undef STRING_ASM_OP
|
||||
#undef COMMON_ASM_OP
|
||||
#undef SKIP_ASM_OP
|
||||
#undef SET_ASM_OP /* Has no equivalent. See ASM_OUTPUT_DEF below. */
|
||||
|
||||
/* Provide a set of pre-definitions and pre-assertions appropriate for
|
||||
the Sparc running svr4. __svr4__ is our extension. */
|
||||
|
||||
#define CPP_PREDEFINES \
|
||||
"-Dsparc -Dunix -D__svr4__ -Asystem(unix) -Asystem(svr4)"
|
||||
|
||||
/* The native assembler can't compute differences between symbols in different
|
||||
sections when generating pic code, so we must put jump tables in the
|
||||
text section. */
|
||||
/* But we now defer the tables to the end of the function, so we make
|
||||
this 0 to not confuse the branch shortening code. */
|
||||
#define JUMP_TABLES_IN_TEXT_SECTION 0
|
||||
|
||||
/* Pass -K to the assembler when PIC. */
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC \
|
||||
"%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
|
||||
%{fpic:-K PIC} %{fPIC:-K PIC} %(asm_cpu)"
|
||||
|
||||
/* Must use data section for relocatable constants when pic. */
|
||||
#undef SELECT_RTX_SECTION
|
||||
#define SELECT_RTX_SECTION(MODE,RTX) \
|
||||
{ \
|
||||
if (flag_pic && symbolic_operand (RTX)) \
|
||||
data_section (); \
|
||||
else \
|
||||
const_section (); \
|
||||
}
|
||||
|
||||
/* Define the names of various pseudo-op used by the Sparc/svr4 assembler.
|
||||
Note that many of these are different from the typical pseudo-ops used
|
||||
by most svr4 assemblers. That is probably due to a (misguided?) attempt
|
||||
to keep the Sparc/svr4 assembler somewhat compatible with the Sparc/SunOS
|
||||
assembler. */
|
||||
|
||||
#define STRING_ASM_OP ".asciz"
|
||||
#define COMMON_ASM_OP ".common"
|
||||
#define SKIP_ASM_OP ".skip"
|
||||
#define UNALIGNED_DOUBLE_INT_ASM_OP ".uaxword"
|
||||
#define UNALIGNED_INT_ASM_OP ".uaword"
|
||||
#define UNALIGNED_SHORT_ASM_OP ".uahalf"
|
||||
#define PUSHSECTION_ASM_OP ".pushsection"
|
||||
#define POPSECTION_ASM_OP ".popsection"
|
||||
|
||||
/* This is defined in sparc.h but is not used by svr4.h. */
|
||||
#undef ASM_LONG
|
||||
#define ASM_LONG ".long"
|
||||
|
||||
/* This is the format used to print the second operand of a .type pseudo-op
|
||||
for the Sparc/svr4 assembler. */
|
||||
|
||||
#define TYPE_OPERAND_FMT "#%s"
|
||||
|
||||
/* This is the format used to print a .pushsection pseudo-op (and its operand)
|
||||
for the Sparc/svr4 assembler. */
|
||||
|
||||
#define PUSHSECTION_FORMAT "\t%s\t\"%s\"\n"
|
||||
|
||||
#undef ASM_OUTPUT_CASE_LABEL
|
||||
#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \
|
||||
do { ASM_OUTPUT_ALIGN ((FILE), Pmode == SImode ? 2 : 3); \
|
||||
ASM_OUTPUT_INTERNAL_LABEL ((FILE), PREFIX, NUM); \
|
||||
} while (0)
|
||||
|
||||
/* This is how to equate one symbol to another symbol. The syntax used is
|
||||
`SYM1=SYM2'. Note that this is different from the way equates are done
|
||||
with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'. */
|
||||
|
||||
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
|
||||
do { fprintf ((FILE), "\t"); \
|
||||
assemble_name (FILE, LABEL1); \
|
||||
fprintf (FILE, " = "); \
|
||||
assemble_name (FILE, LABEL2); \
|
||||
fprintf (FILE, "\n"); \
|
||||
} while (0)
|
||||
|
||||
/* Define how the Sparc registers should be numbered for Dwarf output.
|
||||
The numbering provided here should be compatible with the native
|
||||
svr4 SDB debugger in the Sparc/svr4 reference port. The numbering
|
||||
is as follows:
|
||||
|
||||
Assembly name gcc internal regno Dwarf regno
|
||||
----------------------------------------------------------
|
||||
g0-g7 0-7 0-7
|
||||
o0-o7 8-15 8-15
|
||||
l0-l7 16-23 16-23
|
||||
i0-i7 24-31 24-31
|
||||
f0-f31 32-63 40-71
|
||||
*/
|
||||
|
||||
#define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 32 ? (REGNO) : (REGNO) + 8)
|
||||
|
||||
/* A set of symbol definitions for assembly pseudo-ops which will
|
||||
get us switched to various sections of interest. These are used
|
||||
in all places where we simply want to switch to a section, and
|
||||
*not* to push the previous section name onto the assembler's
|
||||
section names stack (as we do often in dwarfout.c). */
|
||||
|
||||
#define TEXT_SECTION_ASM_OP ".section\t\".text\""
|
||||
#define DATA_SECTION_ASM_OP ".section\t\".data\""
|
||||
#define BSS_SECTION_ASM_OP ".section\t\".bss\""
|
||||
#define CONST_SECTION_ASM_OP ".section\t\".rodata\""
|
||||
#define INIT_SECTION_ASM_OP ".section\t\".init\""
|
||||
#define FINI_SECTION_ASM_OP ".section\t\".fini\""
|
||||
|
||||
/* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
|
||||
|
||||
Note that we want to give these sections the SHF_WRITE attribute
|
||||
because these sections will actually contain data (i.e. tables of
|
||||
addresses of functions in the current root executable or shared library
|
||||
file) and, in the case of a shared library, the relocatable addresses
|
||||
will have to be properly resolved/relocated (and then written into) by
|
||||
the dynamic linker when it actually attaches the given shared library
|
||||
to the executing process. (Note that on SVR4, you may wish to use the
|
||||
`-z text' option to the ELF linker, when building a shared library, as
|
||||
an additional check that you are doing everything right. But if you do
|
||||
use the `-z text' option when building a shared library, you will get
|
||||
errors unless the .ctors and .dtors sections are marked as writable
|
||||
via the SHF_WRITE attribute.) */
|
||||
|
||||
#undef CTORS_SECTION_ASM_OP
|
||||
#define CTORS_SECTION_ASM_OP ".section\t\".ctors\",#alloc,#write"
|
||||
#undef DTORS_SECTION_ASM_OP
|
||||
#define DTORS_SECTION_ASM_OP ".section\t\".dtors\",#alloc,#write"
|
||||
#undef EH_FRAME_SECTION_ASM_OP
|
||||
#define EH_FRAME_SECTION_ASM_OP ".section\t\".eh_frame\",#alloc,#write"
|
||||
|
||||
/* A C statement to output something to the assembler file to switch to section
|
||||
NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
|
||||
NULL_TREE. Some target formats do not support arbitrary sections. Do not
|
||||
define this macro in such cases. */
|
||||
|
||||
#undef ASM_OUTPUT_SECTION_NAME /* Override svr4.h's definition. */
|
||||
#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
|
||||
do { \
|
||||
if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
|
||||
fprintf (FILE, ".section\t\"%s\",#alloc,#execinstr\n", \
|
||||
(NAME)); \
|
||||
else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
|
||||
fprintf (FILE, ".section\t\"%s\",#alloc\n", (NAME)); \
|
||||
else \
|
||||
fprintf (FILE, ".section\t\"%s\",#alloc,#write\n", (NAME)); \
|
||||
} while (0)
|
||||
|
||||
/* A C statement (sans semicolon) to output to the stdio stream
|
||||
FILE the assembler definition of uninitialized global DECL named
|
||||
NAME whose size is SIZE bytes and alignment is ALIGN bytes.
|
||||
Try to use asm_output_aligned_bss to implement this macro. */
|
||||
|
||||
#undef ASM_OUTPUT_ALIGNED_BSS
|
||||
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
|
||||
asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
|
||||
|
||||
/* Override the name of the mcount profiling function. */
|
||||
|
||||
#undef MCOUNT_FUNCTION
|
||||
#define MCOUNT_FUNCTION "*_mcount"
|
||||
@@ -1,39 +0,0 @@
|
||||
# we need to supply our own assembly versions of libgcc1.c files,
|
||||
# since the user may not have native 'cc' available
|
||||
|
||||
CROSS_LIBGCC1 = libgcc1-asm.a
|
||||
LIB1ASMSRC = sparc/lb1spc.asm
|
||||
LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
|
||||
|
||||
# crt0 is built elsewhere
|
||||
LIBGCC1_TEST =
|
||||
|
||||
# These are really part of libgcc1, but this will cause them to be
|
||||
# built correctly, so...
|
||||
|
||||
LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
|
||||
|
||||
dp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c > dp-bit.c
|
||||
|
||||
fp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#define FLOAT' > fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
|
||||
|
||||
# MULTILIB_OPTIONS should have msparclite too, but we'd have to make
|
||||
# gas build...
|
||||
#MULTILIB_OPTIONS = msoft-float mcpu=v8
|
||||
MULTILIB_OPTIONS = msoft-float
|
||||
#MULTILIB_DIRNAMES = soft v8
|
||||
MULTILIB_DIRNAMES = soft
|
||||
#MULTILIB_MATCHES = msoft-float=mno-fpu mcpu?v8=mv8
|
||||
MULTILIB_MATCHES = msoft-float=mno-fpu
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
||||
|
||||
# Assemble startup files.
|
||||
crti.o: $(srcdir)/config/sparc/sol2-ci.asm $(GCC_PASSES)
|
||||
$(GCC_FOR_TARGET) -c -o crti.o -x assembler $(srcdir)/config/sparc/sol2-ci.asm
|
||||
crtn.o: $(srcdir)/config/sparc/sol2-cn.asm $(GCC_PASSES)
|
||||
$(GCC_FOR_TARGET) -c -o crtn.o -x assembler $(srcdir)/config/sparc/sol2-cn.asm
|
||||
@@ -1,2 +0,0 @@
|
||||
# For a native HALOS compile, we need to set -e1 for the assembler
|
||||
AS=as -e1
|
||||
@@ -1,21 +0,0 @@
|
||||
MULTILIB_OPTIONS = m64/m32
|
||||
MULTILIB_DIRNAMES = 64 32
|
||||
MULTILIB_MATCHES =
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
||||
|
||||
EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o
|
||||
|
||||
tcrtbeginS.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \
|
||||
defaults.h frame.h gbl-ctors.h
|
||||
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
|
||||
-finhibit-size-directive -fno-inline-functions -fno-exceptions $(CRTSTUFF_T_CFLAGS_S) \
|
||||
-c $(srcdir)/crtstuff.c -DCRT_BEGIN -o tcrtbeginS$(objext)
|
||||
|
||||
tcrtendS.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \
|
||||
defaults.h frame.h gbl-ctors.h
|
||||
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
|
||||
-finhibit-size-directive -fno-inline-functions -fno-exceptions $(CRTSTUFF_T_CFLAGS_S) \
|
||||
-c $(srcdir)/crtstuff.c -DCRT_END -o tcrtendS$(objext)
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
# we need to supply our own assembly versions of libgcc1.c files,
|
||||
# since the user may not have native 'cc' available
|
||||
|
||||
LIBGCC1 =
|
||||
CROSS_LIBGCC1 =
|
||||
LIBGCC1_TEST =
|
||||
|
||||
# gmon build rule:
|
||||
$(T)gmon.o: $(srcdir)/config/sparc/gmon-sol2.c $(GCC_PASSES) $(CONFIG_H) stmp-int-hdrs
|
||||
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) \
|
||||
-c $(srcdir)/config/sparc/gmon-sol2.c -o $(T)gmon.o
|
||||
|
||||
# Assemble startup files.
|
||||
$(T)crt1.o: $(srcdir)/config/sparc/sol2-c1.asm $(GCC_PASSES)
|
||||
$(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crt1.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-c1.asm
|
||||
$(T)crti.o: $(srcdir)/config/sparc/sol2-ci.asm $(GCC_PASSES)
|
||||
$(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-ci.asm
|
||||
$(T)crtn.o: $(srcdir)/config/sparc/sol2-cn.asm $(GCC_PASSES)
|
||||
$(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-cn.asm
|
||||
$(T)gcrt1.o: $(srcdir)/config/sparc/sol2-c1.asm $(GCC_PASSES)
|
||||
$(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -DGCRT1 -o $(T)gcrt1.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-c1.asm
|
||||
|
||||
# We need to use -fPIC when we are using gcc to compile the routines in
|
||||
# crtstuff.c. This is only really needed when we are going to use gcc/g++
|
||||
# to produce a shared library, but since we don't know ahead of time when
|
||||
# we will be doing that, we just always use -fPIC when compiling the
|
||||
# routines in crtstuff.c.
|
||||
|
||||
CRTSTUFF_T_CFLAGS = -fPIC
|
||||
TARGET_LIBGCC2_CFLAGS = -fPIC
|
||||
@@ -1,8 +0,0 @@
|
||||
MULTILIB_OPTIONS = m32/m64
|
||||
MULTILIB_DIRNAMES = sparcv7 sparcv9
|
||||
MULTILIB_MATCHES =
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
||||
|
||||
EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o gmon.o crt1.o crti.o crtn.o gcrt1.o
|
||||
@@ -1,2 +0,0 @@
|
||||
LIBGCC1 =
|
||||
CROSS_LIBGCC1 =
|
||||
@@ -1,26 +0,0 @@
|
||||
# configuration file for a bare sparc cpu
|
||||
|
||||
CROSS_LIBGCC1 = libgcc1-asm.a
|
||||
LIB1ASMSRC = sparc/lb1spc.asm
|
||||
LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
|
||||
|
||||
# These are really part of libgcc1, but this will cause them to be
|
||||
# built correctly, so...
|
||||
|
||||
LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
|
||||
|
||||
dp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c > dp-bit.c
|
||||
|
||||
fp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#define FLOAT' > fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
|
||||
|
||||
# MULTILIB_OPTIONS should have msparclite too, but we'd have to make
|
||||
# gas build...
|
||||
MULTILIB_OPTIONS = msoft-float mcpu=v8
|
||||
MULTILIB_DIRNAMES = soft v8
|
||||
MULTILIB_MATCHES = msoft-float=mno-fpu mcpu?v8=mv8
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
||||
@@ -1,24 +0,0 @@
|
||||
CROSS_LIBGCC1 = libgcc1-asm.a
|
||||
LIB1ASMSRC = sparc/lb1spl.asm
|
||||
LIB1ASMFUNCS = _divsi3 _udivsi3 _modsi3 _umodsi3
|
||||
|
||||
# These are really part of libgcc1, but this will cause them to be
|
||||
# built correctly, so...
|
||||
|
||||
LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
|
||||
|
||||
dp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#define US_SOFTWARE_GOFAST' > dp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> dp-bit.c
|
||||
|
||||
fp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#define FLOAT' > fp-bit.c
|
||||
echo '#define US_SOFTWARE_GOFAST' >> fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
|
||||
|
||||
MULTILIB_OPTIONS = mfpu mflat
|
||||
MULTILIB_DIRNAMES =
|
||||
MULTILIB_MATCHES = mfpu=mhard-float mfpu=mcpu?f934
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
||||
@@ -1,22 +0,0 @@
|
||||
# configuration file for a bare sparclet cpu, aout format files
|
||||
|
||||
CROSS_LIBGCC1 = libgcc1-asm.a
|
||||
LIB1ASMSRC = sparc/lb1spc.asm
|
||||
LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
|
||||
|
||||
# These are really part of libgcc1, but this will cause them to be
|
||||
# built correctly, so...
|
||||
|
||||
LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
|
||||
|
||||
dp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c > dp-bit.c
|
||||
|
||||
fp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#define FLOAT' > fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
|
||||
|
||||
MULTILIB_OPTIONS = mlittle-endian mflat
|
||||
MULTILIB_DIRNAMES = little flat
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
||||
@@ -1,7 +0,0 @@
|
||||
# SunOS 4.0.*
|
||||
# /bin/as doesn't recognize the v8 instructions, so we can't do a v8
|
||||
# multilib build.
|
||||
|
||||
LIBGCC1 =
|
||||
CROSS_LIBGCC1 =
|
||||
LIBGCC1_TEST =
|
||||
@@ -1,16 +0,0 @@
|
||||
# SunOS 4.1.*
|
||||
|
||||
LIBGCC1 =
|
||||
CROSS_LIBGCC1 =
|
||||
LIBGCC1_TEST =
|
||||
|
||||
MULTILIB_OPTIONS = fpic/fPIC mcpu=v8
|
||||
MULTILIB_DIRNAMES = pic ucpic v8
|
||||
MULTILIB_MATCHES = mcpu?v8=mv8
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
||||
|
||||
# The native linker doesn't handle linking -fpic code with -fPIC code. Ugh.
|
||||
# We cope by building both variants of libgcc.
|
||||
#TARGET_LIBGCC2_CFLAGS = -fPIC
|
||||
@@ -1,17 +0,0 @@
|
||||
LIBGCC1 =
|
||||
CROSS_LIBGCC1 =
|
||||
|
||||
# We don't want to build .umul, etc., because VxWorks provides them,
|
||||
# which means that libgcc1-test will fail.
|
||||
LIBGCC1_TEST =
|
||||
|
||||
# We don't want to put exit in libgcc.a for VxWorks, because VxWorks
|
||||
# does not have _exit.
|
||||
TARGET_LIBGCC2_CFLAGS = -Dexit=unused_exit
|
||||
|
||||
MULTILIB_OPTIONS=msoft-float mv8
|
||||
MULTILIB_DIRNAMES=soft v8
|
||||
MULTILIB_MATCHES=msoft-float=mno-fpu
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
||||
@@ -1,131 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SPARC VxSim
|
||||
Copyright 1996 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Supposedly the same as vanilla sparc svr4, except for the stuff below: */
|
||||
#include "sparc/sysv4.h"
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES \
|
||||
"-DCPU=SIMSPARCSOLARIS -D__vxworks -D__vxworks__ -Dsparc -D__svr4__ -D__SVR4 \
|
||||
-Asystem(embedded) -Asystem(svr4) -Acpu(sparc) -Amachine(sparc)\
|
||||
-D__GCC_NEW_VARARGS__"
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC ""
|
||||
|
||||
#undef CC1_SPEC
|
||||
#define CC1_SPEC "-fno-builtin %{sun4:} %{target:}"
|
||||
|
||||
/* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
|
||||
It's safe to pass -s always, even if -g is not used. */
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC \
|
||||
"%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
|
||||
%{fpic:-K PIC} %{fPIC:-K PIC}"
|
||||
|
||||
/* However it appears that Solaris 2.0 uses the same reg numbering as
|
||||
the old BSD-style system did. */
|
||||
|
||||
#undef DBX_REGISTER_NUMBER
|
||||
/* Same as sparc.h */
|
||||
#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
|
||||
|
||||
/* We use stabs-in-elf for debugging, because that is what the native
|
||||
toolchain uses. */
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
|
||||
/* The Solaris 2 assembler uses .skip, not .zero, so put this back. */
|
||||
#undef ASM_OUTPUT_SKIP
|
||||
#define ASM_OUTPUT_SKIP(FILE,SIZE) \
|
||||
fprintf (FILE, "\t.skip %u\n", (SIZE))
|
||||
|
||||
#undef ASM_OUTPUT_ALIGNED_LOCAL
|
||||
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
|
||||
do { \
|
||||
fputs ("\t.local\t", (FILE)); \
|
||||
assemble_name ((FILE), (NAME)); \
|
||||
putc ('\n', (FILE)); \
|
||||
ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
|
||||
} while (0)
|
||||
|
||||
#undef COMMON_ASM_OP
|
||||
#define COMMON_ASM_OP "\t.common"
|
||||
|
||||
/* This is how to output a definition of an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class. */
|
||||
|
||||
#undef ASM_OUTPUT_INTERNAL_LABEL
|
||||
#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
|
||||
fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
|
||||
|
||||
/* This is how to output a reference to an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class. */
|
||||
|
||||
#undef ASM_OUTPUT_INTERNAL_LABELREF
|
||||
#define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \
|
||||
fprintf (FILE, ".L%s%d", PREFIX, NUM)
|
||||
|
||||
/* This is how to store into the string LABEL
|
||||
the symbol_ref name of an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class.
|
||||
This is suitable for output with `assemble_name'. */
|
||||
|
||||
#undef ASM_GENERATE_INTERNAL_LABEL
|
||||
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
|
||||
sprintf (LABEL, "*.L%s%d", PREFIX, NUM)
|
||||
|
||||
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC ""
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC ""
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "-r"
|
||||
|
||||
/* This defines which switch letters take arguments.
|
||||
It is as in svr4.h but with -R added. */
|
||||
|
||||
#undef SWITCH_TAKES_ARG
|
||||
#define SWITCH_TAKES_ARG(CHAR) \
|
||||
( (CHAR) == 'D' \
|
||||
|| (CHAR) == 'U' \
|
||||
|| (CHAR) == 'o' \
|
||||
|| (CHAR) == 'e' \
|
||||
|| (CHAR) == 'u' \
|
||||
|| (CHAR) == 'I' \
|
||||
|| (CHAR) == 'm' \
|
||||
|| (CHAR) == 'L' \
|
||||
|| (CHAR) == 'R' \
|
||||
|| (CHAR) == 'A' \
|
||||
|| (CHAR) == 'h' \
|
||||
|| (CHAR) == 'z')
|
||||
|
||||
/* ??? This does not work in SunOS 4.x, so it is not enabled in sparc.h.
|
||||
Instead, it is enabled here, because it does work under Solaris. */
|
||||
/* Define for support of TFmode long double and REAL_ARITHMETIC.
|
||||
Sparc ABI says that long double is 4 words. */
|
||||
#define LONG_DOUBLE_TYPE_SIZE 64
|
||||
@@ -1,61 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler. Vxworks SPARC version.
|
||||
Copyright (C) 1994, 1996 Free Software Foundation, Inc.
|
||||
Contributed by David Henkel-Wallace (gumby@cygnus.com)
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "sparc/aout.h"
|
||||
|
||||
/* Specify what to link with. */
|
||||
/* VxWorks does all the library stuff itself. */
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC ""
|
||||
|
||||
/* Provide required defaults for linker -e. */
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "%{!nostdlib:%{!r*:%{!e*:-e start}}}"
|
||||
|
||||
/* VxWorks provides the functionality of crt0.o and friends itself. */
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dsparc -Acpu(sparc) -Amachine(sparc)"
|
||||
|
||||
/* Note that we define CPU here even if the user has specified -ansi.
|
||||
This violates user namespace, but the VxWorks headers, and potentially
|
||||
user code, all explicitly rely upon the definition of CPU in order to get
|
||||
the proper processor information. */
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%(cpp_cpu) -DCPU=SPARC"
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
#undef SIZE_TYPE
|
||||
#undef WCHAR_TYPE
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
|
||||
#define PTRDIFF_TYPE "long int"
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
#define WCHAR_TYPE "char"
|
||||
#define WCHAR_TYPE_SIZE 8
|
||||
|
||||
/* US Software GOFAST library support. */
|
||||
#include "gofast.h"
|
||||
#undef INIT_SUBTARGET_OPTABS
|
||||
#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS
|
||||
@@ -1,2 +0,0 @@
|
||||
X_CFLAGS=-DSVR4
|
||||
ALLOCA=alloca.o
|
||||
Loaded 100 of 1760 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user