mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-28 11:57:28 +00:00
Remove files that are not part of GCC 3.4.x from the vendor branch.
This commit is contained in:
parent
025ee8b5ee
commit
292f200484
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/gcc/dist/; revision=133582
14448
contrib/gcc/.brik
14448
contrib/gcc/.brik
File diff suppressed because it is too large
Load Diff
@ -1,32 +0,0 @@
|
||||
*-all
|
||||
*-co
|
||||
*-dirs
|
||||
*-done
|
||||
*-install-info
|
||||
*-src
|
||||
*-stamp-*
|
||||
*-tagged
|
||||
blockit
|
||||
cfg-paper.info
|
||||
config.status
|
||||
configure.aux
|
||||
configure.cp
|
||||
configure.cps
|
||||
configure.dvi
|
||||
configure.fn
|
||||
configure.fns
|
||||
configure.ky
|
||||
configure.kys
|
||||
configure.log
|
||||
configure.pg
|
||||
configure.pgs
|
||||
configure.toc
|
||||
configure.tp
|
||||
configure.tps
|
||||
configure.vr
|
||||
configure.vrs
|
||||
Makefile
|
||||
dir.info
|
||||
lost+found
|
||||
update.out
|
||||
LAST_UPDATED
|
594
contrib/gcc/BUGS
594
contrib/gcc/BUGS
@ -1,594 +0,0 @@
|
||||
|
||||
GCC Bugs
|
||||
|
||||
The latest version of this document is always available at
|
||||
[1]http://www.gnu.org/software/gcc/bugs.html.
|
||||
_________________________________________________________________
|
||||
|
||||
Table of Contents
|
||||
|
||||
* [2]Reporting Bugs
|
||||
+ [3]What we need
|
||||
+ [4]What we DON'T want
|
||||
+ [5]Where to post it
|
||||
+ [6]Detailed bug reporting instructions
|
||||
+ [7]Detailed bug reporting instructions for GNAT
|
||||
* [8]Managing Bugs (GNATS and the test-suite)
|
||||
* [9]Frequently Reported Bugs in GCC
|
||||
+ [10]General
|
||||
+ [11]Fortran
|
||||
+ [12]C
|
||||
+ [13]C++
|
||||
o [14]Common problems updating from G++ 2.95 to G++ 3.0
|
||||
o [15]Non-bugs
|
||||
o [16]Missing features
|
||||
o [17]Parse errors for "simple" code
|
||||
o [18]Optimization at -O3 takes a very long time
|
||||
_________________________________________________________________
|
||||
|
||||
Reporting Bugs
|
||||
|
||||
Our preferred way of receiving bugs is via the [19]GCC GNATS bug
|
||||
reporting system.
|
||||
|
||||
Before you report a bug, please check the [20]list of well-known bugs
|
||||
and, if possible in any way, try a current development snapshot. If
|
||||
you want to report a bug with versions of GCC before 3.1 we strongly
|
||||
recommend upgrading to the current release first.
|
||||
|
||||
Before reporting that GCC compiles your code incorrectly, please
|
||||
compile it with gcc -Wall and see whether this shows anything wrong
|
||||
with your code that could be the cause instead of a bug in GCC.
|
||||
|
||||
Summarized bug reporting instructions
|
||||
|
||||
After this summary, you'll find detailed bug reporting instructions,
|
||||
that explain how to obtain some of the information requested in this
|
||||
summary.
|
||||
|
||||
What we need
|
||||
|
||||
Please include in your bug report all of the following items, the
|
||||
first three of which can be obtained from the output of gcc -v:
|
||||
* the exact version of GCC;
|
||||
* the system type;
|
||||
* the options given when GCC was configured/built;
|
||||
* the complete command line that triggers the bug;
|
||||
* the compiler output (error messages, warnings, etc.); and
|
||||
* the preprocessed file (*.i*) that triggers the bug, generated by
|
||||
adding -save-temps to the complete compilation command, or, in the
|
||||
case of a bug report for the GNAT front end, a complete set of
|
||||
source files (see below).
|
||||
|
||||
What we do not want
|
||||
|
||||
* A source file that #includes header files that are left out of the
|
||||
bug report (see above)
|
||||
* That source file and a collection of header files.
|
||||
* An attached archive (tar, zip, shar, whatever) containing all (or
|
||||
some :-) of the above.
|
||||
* A code snippet that won't cause the compiler to produce the exact
|
||||
output mentioned in the bug report (e.g., a snippet with just a
|
||||
few lines around the one that apparently triggers the bug, with
|
||||
some pieces replaced with ellipses or comments for extra
|
||||
obfuscation :-)
|
||||
* The location (URL) of the package that failed to build (we won't
|
||||
download it, anyway, since you've already given us what we need to
|
||||
duplicate the bug, haven't you? :-)
|
||||
* An error that occurs only some of the times a certain file is
|
||||
compiled, such that retrying a sufficient number of times results
|
||||
in a successful compilation; this is a symptom of a hardware
|
||||
problem, not of a compiler bug (sorry)
|
||||
* E-mail messages that complement previous, incomplete bug reports.
|
||||
Post a new, self-contained, full bug report instead, if possible
|
||||
as a follow-up to the original bug report
|
||||
* Assembly files (*.s) produced by the compiler, or any binary
|
||||
files, such as object files, executables or core files
|
||||
* Duplicate bug reports, or reports of bugs already fixed in the
|
||||
development tree, especially those that have already been reported
|
||||
as fixed last week :-)
|
||||
* Bugs in the assembler, the linker or the C library. These are
|
||||
separate projects, with separate mailing lists and different bug
|
||||
reporting procedures
|
||||
* Bugs in releases or snapshots of GCC not issued by the GNU
|
||||
Project. Report them to whoever provided you with the release
|
||||
* Questions about the correctness or the expected behavior of
|
||||
certain constructs that are not GCC extensions. Ask them in forums
|
||||
dedicated to the discussion of the programming language
|
||||
|
||||
Where to post it
|
||||
|
||||
Please submit your bug report directly to the [21]GCC GNATS bug
|
||||
database. Only if this is not possible, mail all information to
|
||||
[22]bug-gcc@gnu.org or [23]gcc-bugs@gcc.gnu.org.
|
||||
|
||||
The GCC lists have message size limits (200 kbytes) and bug reports
|
||||
over those limits will currently be bounced. If your bug is larger
|
||||
than that, please post it using the [24]GCC GNATS bug database.
|
||||
|
||||
Detailed bug reporting instructions
|
||||
|
||||
Please refer to the [25]next section when reporting bugs in GNAT, the
|
||||
Ada compiler.
|
||||
|
||||
In general, all the information we need can be obtained by collecting
|
||||
the command line below, as well as its output and the preprocessed
|
||||
file it generates.
|
||||
|
||||
gcc -v -save-temps all-your-options source-file
|
||||
|
||||
Typically the preprocessed file (extension .i for C or .ii for C++)
|
||||
will be large, so please compress the resulting file with one of the
|
||||
popular compression programs such as bzip2, gzip, zip or compress (in
|
||||
decreasing order of preference). Use maximum compression (-9) if
|
||||
available. Please include the compressed preprocessor output in your
|
||||
bug report, even if the source code is freely available elsewhere; it
|
||||
makes the job of our volunteer testers much easier.
|
||||
|
||||
The only excuses to not send us the preprocessed sources are (i) if
|
||||
you've found a bug in the preprocessor, or (ii) if you've reduced the
|
||||
testcase to a small file that doesn't include any other file. If you
|
||||
can't post the preprocessed sources because they're proprietary code,
|
||||
then try to create a small file that triggers the same problem.
|
||||
|
||||
Since we're supposed to be able to re-create the assembly output
|
||||
(extension .s), you usually should not include it in the bug report,
|
||||
although you may want to post parts of it to point out assembly code
|
||||
you consider to be wrong.
|
||||
|
||||
Whether to use MIME attachments or uuencode is up to you. In any case,
|
||||
make sure the compiler command line, version and error output are in
|
||||
plain text, so that we don't have to decode the bug report in order to
|
||||
tell who should take care of it. A meaningful subject indicating
|
||||
language and platform also helps.
|
||||
|
||||
Please avoid posting an archive (.tar, .shar or .zip); we generally
|
||||
need just a single file to reproduce the bug (the .i/.ii preprocessed
|
||||
file), and, by storing it in an archive, you're just making our
|
||||
volunteers' jobs harder. Only when your bug report requires multiple
|
||||
source files to be reproduced should you use an archive. In any case,
|
||||
make sure the compiler version, error message, etc, are included in
|
||||
the body of your bug report as plain text, even if needlessly
|
||||
duplicated as part of an archive.
|
||||
|
||||
If you fail to supply enough information for a bug report to be
|
||||
reproduced, someone will probably ask you to post additional
|
||||
information (or just ignore your bug report, if they're in a bad day,
|
||||
so try to get it right on the first posting :-). In this case, please
|
||||
post the additional information to the bug reporting mailing list, not
|
||||
just to the person who requested it, unless explicitly told so. If
|
||||
possible, please include in this follow-up all the information you had
|
||||
supplied in the incomplete bug report (including the preprocessor
|
||||
output), so that the new bug report is self-contained.
|
||||
|
||||
Detailed bug reporting instructions for GNAT
|
||||
|
||||
See the [26]previous section for bug reporting instructions for GCC
|
||||
language implementations other than Ada.
|
||||
|
||||
Bug reports have to contain at least the following information in
|
||||
order to be useful:
|
||||
* the exact version of GCC, as shown by "gcc -v";
|
||||
* the system type;
|
||||
* the options when GCC was configured/built;
|
||||
* the exact command line passed to the gcc program triggering the
|
||||
bug (not just the flags passed to gnatmake, but gnatmake prints
|
||||
the parameters it passed to gcc)
|
||||
* a collection of source files for reproducing the bug, preferably a
|
||||
minimal set (see below);
|
||||
* a description of the expected behavior;
|
||||
* a description of actual behavior.
|
||||
|
||||
If your code depends on additional source files (usually package
|
||||
specifications), submit the source code for these compilation units in
|
||||
a single file that is acceptable input to gnatchop, i.e. contains no
|
||||
non-Ada text. If the compilation terminated normally, you can usually
|
||||
obtain a list of dependencies using the "gnatls -d main_unit" command,
|
||||
where main_unit is the file name of the main compilation unit (which
|
||||
is also passed to gcc).
|
||||
|
||||
If you report a bug which causes the compiler to print a bug box,
|
||||
include that bug box in your report, and do not forget to send all the
|
||||
source files listed after the bug box along with your report.
|
||||
|
||||
If you use gnatprep, be sure to send in preprocessed sources (unless
|
||||
you have to report a bug in gnatprep).
|
||||
|
||||
When you have checked that your report meets these criteria, please
|
||||
submit it accoding to our [27]generic instructions. (If you use a
|
||||
mailing list for reporting, please include an "[Ada]" tag in the
|
||||
subject.)
|
||||
|
||||
Managing Bugs (GNATS and the test-suite)
|
||||
|
||||
This section contains information mostly intended for GCC
|
||||
contributors.
|
||||
|
||||
If you find a bug, but you are not fixing it (yet):
|
||||
1. Create a (minimal) test-case.
|
||||
2. Add the test-case to our test-suite, marking it as XFAIL unless
|
||||
the bug is a regression.
|
||||
3. Add a bug report referencing the test-case to GNATS.
|
||||
|
||||
If you fix a bug for which there is already a GNATS entry:
|
||||
1. Remove the XFAIL on the test-case.
|
||||
2. Close the bug report in GNATS.
|
||||
|
||||
If you find a bug, and you are fixing it right then:
|
||||
1. Create a (minimal) test-case.
|
||||
2. Add the test-case to our test-suite, marking it as PASS.
|
||||
3. Check in your fixes.
|
||||
_________________________________________________________________
|
||||
|
||||
Frequently Reported Bugs in GCC
|
||||
|
||||
Fortran
|
||||
|
||||
Fortran bugs are documented in the G77 manual rather than explicitly
|
||||
listed here. Please see [28]Known Causes of Trouble with GNU Fortran
|
||||
in the G77 manual.
|
||||
_________________________________________________________________
|
||||
|
||||
C
|
||||
|
||||
The following are not bugs in the C compiler, but are reported often
|
||||
enough to warrant a mention here.
|
||||
|
||||
Cannot initialize a static variable with stdin.
|
||||
This has nothing to do with GCC, but people ask us about it a
|
||||
lot. Code like this:
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
FILE *yyin = stdin;
|
||||
|
||||
will not compile with GNU libc (GNU/Linux libc6), because stdin
|
||||
is not a constant. This was done deliberately, to make it
|
||||
easier to maintain binary compatibility when the type FILE
|
||||
needs to be changed. It is surprising for people used to
|
||||
traditional Unix C libraries, but it is permitted by the C
|
||||
standard.
|
||||
|
||||
This construct commonly occurs in code generated by old
|
||||
versions of lex or yacc. We suggest you try regenerating the
|
||||
parser with a current version of flex or bison, respectively.
|
||||
In your own code, the appropriate fix is to move the
|
||||
initialization to the beginning of main.
|
||||
|
||||
There is a common misconception that the GCC developers are
|
||||
responsible for GNU libc. These are in fact two entirely
|
||||
separate projects; please check the [29]GNU libc web pages for
|
||||
details.
|
||||
|
||||
Cannot use preprocessor directive in macro arguments.
|
||||
Let me guess... you wrote code that looks something like this:
|
||||
|
||||
memcpy(dest, src,
|
||||
#ifdef PLATFORM1
|
||||
12
|
||||
#else
|
||||
24
|
||||
#endif
|
||||
);
|
||||
|
||||
and you got a whole pile of error messages:
|
||||
|
||||
test.c:11: warning: preprocessing directive not recognized within
|
||||
macro arg
|
||||
test.c:11: warning: preprocessing directive not recognized within
|
||||
macro arg
|
||||
test.c:11: warning: preprocessing directive not recognized within
|
||||
macro arg
|
||||
test.c: In function `foo':
|
||||
test.c:6: undefined or invalid # directive
|
||||
test.c:8: undefined or invalid # directive
|
||||
test.c:9: parse error before `24'
|
||||
test.c:10: undefined or invalid # directive
|
||||
test.c:11: parse error before `#'
|
||||
|
||||
Update: As of GCC 3.2 this kind of construct is always accepted
|
||||
and CPP will probably do what you expect, but see the manual
|
||||
for detailed semantics.
|
||||
|
||||
However, versions of GCC prior to 3.2 did not allow you to put
|
||||
#ifdef (or any other directive) inside the arguments of a
|
||||
macro. Your C library's <string.h> happens to define memcpy as
|
||||
a macro - this is perfectly legitimate. The code therefore
|
||||
would not compile.
|
||||
|
||||
This kind of code is not portable. It is "undefined behavior"
|
||||
according to the C standard; that means different compilers
|
||||
will do different things with it. It is always possible to
|
||||
rewrite code which uses conditionals inside macros so that it
|
||||
doesn't. You could write the above example
|
||||
|
||||
#ifdef PLATFORM1
|
||||
memcpy(dest, src, 12);
|
||||
#else
|
||||
memcpy(dest, src, 24);
|
||||
#endif
|
||||
|
||||
This is a bit more typing, but I personally think it's better
|
||||
style in addition to being more portable.
|
||||
|
||||
In recent versions of glibc, printf is among the functions
|
||||
which are implemented as macros.
|
||||
_________________________________________________________________
|
||||
|
||||
C++
|
||||
|
||||
This is the list of bugs (and non-bugs) in g++ (aka GNU C++) that are
|
||||
reported very often, but not yet fixed. While it is certainly better
|
||||
to fix bugs instead of documenting them, this document might save
|
||||
people the effort of writing a bug report when the bug is already
|
||||
well-known. [30]How to report bugs tells you how to report a bug.
|
||||
|
||||
There are many reasons why reported bugs don't get fixed. It might be
|
||||
difficult to fix, or fixing it might break compatibility. Often,
|
||||
reports get a low priority when there is a simple work-around. In
|
||||
particular, bugs caused by invalid C++ code have a simple work-around,
|
||||
fix the code. Now that there is an agreed ISO/ANSI standard for C++,
|
||||
the compiler has a definitive document to adhere to. Earlier versions
|
||||
might have accepted source code that is no longer C++. This means that
|
||||
code which might have `worked' in a previous version, is now rejected.
|
||||
You should update your code to be C++.
|
||||
|
||||
You should try to use the latest stable release of the GNU C++
|
||||
compiler.
|
||||
|
||||
Common problems updating from G++ 2.95 to G++ 3.0
|
||||
|
||||
G++ 3.0 conforms much closer to the ISO C++ standard (available at
|
||||
[31]http://www.ncits.org/cplusplus.htm).
|
||||
|
||||
We have also implemented some of the core and library defect reports
|
||||
(available at
|
||||
[32]http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html &
|
||||
[33]http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html
|
||||
respectively).
|
||||
* The ABI has changed. This means that both class layout and name
|
||||
mangling is different. You must recompile all c++ libraries (if
|
||||
you don't you will get link errors).
|
||||
* The standard library is much more conformant, and uses the std::
|
||||
namespace.
|
||||
* std:: is now a real namespace, not an alias for ::.
|
||||
* The standard header files for the c library don't end with .h, but
|
||||
begin with c (i.e. <cstdlib> rather than <stdlib.h>). The .h names
|
||||
are still available, but are deprecated.
|
||||
* <strstream> is deprecated, use <sstream> instead.
|
||||
* streambuf::seekoff & streambuf::seekpos are private, instead use
|
||||
streambuf::pubseekoff & streambuf::pubseekpos respectively.
|
||||
* If std::operator << (std::ostream &, long long) doesn't exist, you
|
||||
need to recompile libstdc++ with --enable-long-long.
|
||||
|
||||
This means you may get lots of errors about things like strcmp not
|
||||
being found. You've most likely forgotton to tell the compiler to look
|
||||
in the std:: namespace. There are several ways to do this,
|
||||
* Say, std::strcmp at the call. This is the most explicit way of
|
||||
saying what you mean.
|
||||
* Say, using std::strcmp; somewhere before the call. You will need
|
||||
to do this for each function or type you wish to use from the
|
||||
standard library.
|
||||
* Say, using namespace std; somewhere before the call. This is the
|
||||
quick-but-dirty fix. This brings the whole of the std:: namespace
|
||||
into scope. Never do this in a header file, as you will be forcing
|
||||
users of your header file to do the same.
|
||||
|
||||
ABI bugs
|
||||
|
||||
3.0 had a new ABI, which affected class layout, function mangling and
|
||||
calling conventions. We had intended it to be complete, unfortunately
|
||||
some issues came to light, too late to fix in the 3.0 series. The ABI
|
||||
should not change in dot releases, so we addressed most issues in GCC
|
||||
3.1.
|
||||
|
||||
Covariant return types
|
||||
We do not implement non-trivial covariant returns. We also
|
||||
generate incorrect virtual function tables for trivial
|
||||
covariance. Although trivial covariance will work, it is
|
||||
incompatible with the ABI. GNATS PR 3706 tracks this problem.
|
||||
|
||||
Non-bugs
|
||||
|
||||
Here are some features that have been reported as bugs, but are not.
|
||||
|
||||
Nested classes can access private types of the containing class.
|
||||
G++ now implements type access control on member types. Defect
|
||||
report 45 clarifies that nested classes are members of the
|
||||
class they are nested in, and so are granted access to private
|
||||
members of that class.
|
||||
|
||||
Classes in exception specifiers must be complete types.
|
||||
[15.4]/1 tells you that you cannot have an incomplete type, or
|
||||
pointer to incomplete (other than cv void *) in an exception
|
||||
specification.
|
||||
|
||||
G++ emits two copies of constructors and destructors.
|
||||
In general there are three types of constructors (and
|
||||
destructors).
|
||||
|
||||
1. The complete object constructor/destructor.
|
||||
2. The base object constructor/destructor.
|
||||
3. The allocating destructor/deallocating destructor.
|
||||
|
||||
The first two are different, when virtual base classes are
|
||||
involved. In some cases we can do better, and this is logged in
|
||||
GNATS.
|
||||
|
||||
Exceptions don't work in multithreaded applications.
|
||||
You need to rebuild g++ and libstdc++ with --enable-threads.
|
||||
Remember, c++ exceptions are not like hardware interrupts. You
|
||||
cannot throw an exception in one thread and catch it in
|
||||
another. You cannot throw an exception from a signal handler,
|
||||
and catch it in the main thread.
|
||||
|
||||
Global destructors are not run in the correct order.
|
||||
Global destructors should be run in the reverse order of their
|
||||
constructors completing. In most cases this is the same as the
|
||||
reverse order of constructors starting, but sometimes it is
|
||||
different, and that is important. You need to compile and link
|
||||
your programs with --use-cxa-atexit. We have not turned this
|
||||
switch on by default, as it requires a cxa aware runtime
|
||||
library (libc, glibc, or equivalent).
|
||||
|
||||
Problems with floating point computations.
|
||||
In a number of cases, GCC appears to perform floating point
|
||||
computations incorrectly. For example, the program
|
||||
|
||||
#include <iostream>
|
||||
int main() {
|
||||
double min = 0.0;
|
||||
double max = 0.5;
|
||||
double width = 0.01;
|
||||
std::cout << (int)(((max - min) / width) - 1) << std::endl;
|
||||
}
|
||||
|
||||
might print 50 on some systems and optimization levels, and 51
|
||||
on others.
|
||||
|
||||
The is the result of rounding: The computer cannot represent
|
||||
all real numbers exactly, so it has to use approximations. When
|
||||
computing with approximation, the computer needs to round to
|
||||
the nearest representable number.
|
||||
|
||||
This is not a bug in the compiler, but an inherent limitation
|
||||
of the float and double types. Please study [34]this paper for
|
||||
more information.
|
||||
|
||||
Templates, scoping, and digraphs.
|
||||
If you have a class in global namespace, say named X, and want
|
||||
to give it as a template argument to some other class, say
|
||||
std::vector, then this here fails with a parser error:
|
||||
std::vector<::X>.
|
||||
|
||||
The reason is that the standard mandates that the sequence <:
|
||||
is treated as if it were the token [, and the parser then
|
||||
reports a parse error before the character : (by which it means
|
||||
the second colon). There are several such combinations of
|
||||
characters, and they are called digraphs.
|
||||
|
||||
The simplest way to avoid this is to write std::vector< ::X>,
|
||||
i.e. place a space between the opening angle bracket and the
|
||||
scope operator.
|
||||
|
||||
Missing features
|
||||
|
||||
We know some things are missing from G++.
|
||||
|
||||
The export keyword is not implemented.
|
||||
Most C++ compilers (G++ included) do not yet implement export,
|
||||
which is necessary for separate compilation of template
|
||||
declarations and definitions. Without export, a template
|
||||
definition must be in scope to be used. The obvious workaround
|
||||
is simply to place all definitions in the header itself.
|
||||
Alternatively, the compilation unit containing template
|
||||
definitions may be included from the header.
|
||||
|
||||
Two stage lookup in templates is not implemented.
|
||||
[14.6] specifies how names are looked up inside a template. G++
|
||||
does not do this correctly, but for most templates this will
|
||||
not be noticeable.
|
||||
|
||||
Parse errors for "simple" code
|
||||
|
||||
Up to and including GCC 3.0, the compiler will give "parse error" for
|
||||
seemingly simple code, such as
|
||||
struct A{
|
||||
A();
|
||||
A(int);
|
||||
void func();
|
||||
};
|
||||
|
||||
struct B{
|
||||
B(A);
|
||||
B(A,A);
|
||||
void func();
|
||||
};
|
||||
|
||||
void foo(){
|
||||
B b(A(),A(1)); //Variable b, initialized with two temporaries
|
||||
B(A(2)).func(); //B temporary, initialized with A temporary
|
||||
}
|
||||
|
||||
The problem is that GCC starts to parse the declaration of b as a
|
||||
function b returning B, taking a function returning A as an argument.
|
||||
When it sees the 1, it is too late. The work-around in these cases is
|
||||
to add additional parentheses around the expressions that are mistaken
|
||||
as declarations:
|
||||
(B(A(2))).func();
|
||||
|
||||
Sometimes, even that is not enough; to show the compiler that this
|
||||
should be really an expression, a comma operator with a dummy argument
|
||||
can be used:
|
||||
B b((0,A()),A(1));
|
||||
|
||||
Another example is the parse error for the return statement in
|
||||
struct A{};
|
||||
|
||||
struct B{
|
||||
A a;
|
||||
A f1(bool);
|
||||
};
|
||||
|
||||
A B::f1(bool b)
|
||||
{
|
||||
if (b)
|
||||
return (A());
|
||||
return a;
|
||||
}
|
||||
|
||||
The problem is that the compiler interprets A() as a function (taking
|
||||
no arguments, returning A), and (A()) as a cast - with a missing
|
||||
expression, hence the parse error. The work-around is to omit the
|
||||
parentheses:
|
||||
if (b)
|
||||
return A();
|
||||
|
||||
This problem occurs in a number of variants; in throw statements,
|
||||
people also frequently put the object in parentheses. The exact error
|
||||
also somewhat varies with the compiler version. The work-arounds
|
||||
proposed do not change the semantics of the program at all; they make
|
||||
them perhaps less readable.
|
||||
|
||||
Optimization at -O3 takes a very long time
|
||||
|
||||
At -O3, all functions are candidates for inlining. The heuristic used
|
||||
has some deficiencies which show up when allowed such freedom. This is
|
||||
g++ specific, as it has an earlier inliner than gcc.
|
||||
|
||||
References
|
||||
|
||||
1. http://www.gnu.org/software/gcc/bugs.html
|
||||
2. http://gcc.gnu.org/bugs.html#report
|
||||
3. http://gcc.gnu.org/bugs.html#need
|
||||
4. http://gcc.gnu.org/bugs.html#dontwant
|
||||
5. http://gcc.gnu.org/bugs.html#where
|
||||
6. http://gcc.gnu.org/bugs.html#detailed
|
||||
7. http://gcc.gnu.org/bugs.html#gnat
|
||||
8. http://gcc.gnu.org/bugs.html#manage
|
||||
9. http://gcc.gnu.org/bugs.html#known
|
||||
10. http://gcc.gnu.org/bugs.html#general
|
||||
11. http://gcc.gnu.org/bugs.html#fortran
|
||||
12. http://gcc.gnu.org/bugs.html#c
|
||||
13. http://gcc.gnu.org/bugs.html#cplusplus
|
||||
14. http://gcc.gnu.org/bugs.html#updating
|
||||
15. http://gcc.gnu.org/bugs.html#nonbugs
|
||||
16. http://gcc.gnu.org/bugs.html#missing
|
||||
17. http://gcc.gnu.org/bugs.html#parsing
|
||||
18. http://gcc.gnu.org/bugs.html#-O3
|
||||
19. http://gcc.gnu.org/gnats.html
|
||||
20. http://gcc.gnu.org/bugs.html#known
|
||||
21. http://gcc.gnu.org/gnats.html
|
||||
22. mailto:bug-gcc@gnu.org
|
||||
23. mailto:gcc-bugs@gcc.gnu.org
|
||||
24. http://gcc.gnu.org/gnats.html
|
||||
25. http://gcc.gnu.org/bugs.html#gnat
|
||||
26. http://gcc.gnu.org/bugs.html#detailed
|
||||
27. http://gcc.gnu.org/bugs.html#where
|
||||
28. http://gcc.gnu.org/onlinedocs/g77/Trouble.html
|
||||
29. http://www.gnu.org/software/glibc/
|
||||
30. http://gcc.gnu.org/bugs.html#report
|
||||
31. http://www.ncits.org/cplusplus.htm
|
||||
32. http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html
|
||||
33. http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html
|
||||
34. http://www.validlab.com/goldberg/paper.ps
|
2446
contrib/gcc/NEWS
2446
contrib/gcc/NEWS
File diff suppressed because it is too large
Load Diff
@ -1,17 +0,0 @@
|
||||
This directory contains the GNU Compiler Collection (GCC).
|
||||
|
||||
The GNU Compiler Collection is free software. See the file COPYING
|
||||
for copying permission. The manuals, and some of the runtime
|
||||
libraries, are under different terms; see the individual source files
|
||||
for details.
|
||||
|
||||
The directory INSTALL contains copies of the installation information
|
||||
as HTML and plain text. The source of this information is
|
||||
gcc/doc/install.texi. The installation information includes details
|
||||
of what is included in the GCC sources and what files GCC installs.
|
||||
|
||||
See the file gcc/doc/gcc.texi (together with other files that it
|
||||
includes) for usage and porting information. An online readable
|
||||
version of the manual is in the files gcc/doc/gcc.info*.
|
||||
|
||||
See http://gcc.gnu.org/bugs.html for how to report bugs usefully.
|
@ -1,44 +0,0 @@
|
||||
/* Define to 1 if NLS is requested. */
|
||||
#undef ENABLE_NLS
|
||||
|
||||
/* Define as 1 if you have catgets and don't want to use GNU gettext. */
|
||||
#undef HAVE_CATGETS
|
||||
|
||||
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
|
||||
#undef HAVE_GETTEXT
|
||||
|
||||
/* Define if your locale.h file contains LC_MESSAGES. */
|
||||
#undef HAVE_LC_MESSAGES
|
||||
|
||||
/* Define as 1 if you have the stpcpy function. */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/* Define if your assembler supports specifying the maximum number
|
||||
of bytes to skip when using the GAS .p2align command. */
|
||||
#undef HAVE_GAS_MAX_SKIP_P2ALIGN
|
||||
|
||||
/* Define if your assembler supports .balign and .p2align. */
|
||||
#undef HAVE_GAS_BALIGN_AND_P2ALIGN
|
||||
|
||||
/* Define if your assembler uses the old HImode fild and fist notation. */
|
||||
#undef HAVE_GAS_FILDS_FISTS
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef ssize_t
|
||||
|
||||
/* Define if cpp should also search $prefix/include. */
|
||||
#undef PREFIX_INCLUDE_DIR
|
||||
|
||||
@BOTTOM@
|
||||
|
||||
/* Bison unconditionally undefines `const' if neither `__STDC__' nor
|
||||
__cplusplus are defined. That's a problem since we use `const' in
|
||||
the GCC headers, and the resulting bison code is therefore type
|
||||
unsafe. Thus, we must match the bison behavior here. */
|
||||
|
||||
#ifndef __STDC__
|
||||
#ifndef __cplusplus
|
||||
#undef const
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
@ -1,674 +0,0 @@
|
||||
.\" Copyright (c) 1991, 1992, 1993 Free Software Foundation \-*-Text-*-
|
||||
.\" See section COPYING for conditions for redistribution
|
||||
.TH cpp 1 "30apr1993" "GNU Tools" "GNU Tools"
|
||||
.SH NAME
|
||||
cccp, cpp \- The GNU C-Compatible Compiler Preprocessor.
|
||||
.SH SYNOPSIS
|
||||
.hy 0
|
||||
.na
|
||||
.TP
|
||||
.B cccp
|
||||
.RB "[\|" \-$ "\|]"
|
||||
.RB "[\|" \-A \c
|
||||
.I predicate\c
|
||||
.RB [ (\c
|
||||
.I value\c
|
||||
.BR ) ]\|]
|
||||
.RB "[\|" \-C "\|]"
|
||||
.RB "[\|" \-D \c
|
||||
.I name\c
|
||||
.RB [ =\c
|
||||
.I definition\c
|
||||
\&]\|]
|
||||
.RB "[\|" \-dD "\|]"
|
||||
.RB "[\|" \-dM "\|]"
|
||||
.RB "[\|" "\-I\ "\c
|
||||
.I directory\c
|
||||
\&\|]
|
||||
.RB "[\|" \-H "\|]"
|
||||
.RB "[\|" \-I\- "\|]"
|
||||
.RB "[\|" "\-imacros\ "\c
|
||||
.I file\c
|
||||
\&\|]
|
||||
.RB "[\|" "\-include\ "\c
|
||||
.I file\c
|
||||
\&\|]
|
||||
.RB "[\|" "\-idirafter\ "\c
|
||||
.I dir\c
|
||||
\&\|]
|
||||
.RB "[\|" "\-iprefix\ "\c
|
||||
.I prefix\c
|
||||
\&\|]
|
||||
.RB "[\|" "\-iwithprefix\ "\c
|
||||
.I dir\c
|
||||
\&\|]
|
||||
.RB "[\|" \-lang\-c "\|]"
|
||||
.RB "[\|" \-lang\-c++ "\|]"
|
||||
.RB "[\|" \-lang\-objc "\|]"
|
||||
.RB "[\|" \-lang\-objc++ "\|]"
|
||||
.RB "[\|" \-lint "\|]"
|
||||
.RB "[\|" \-M\ [ \-MG "\|]]"
|
||||
.RB "[\|" \-MM\ [ \-MG "\|]]"
|
||||
.RB "[\|" \-MD\ \c
|
||||
.I file\ \c
|
||||
\&\|]
|
||||
.RB "[\|" \-MMD\ \c
|
||||
.I file\ \c
|
||||
\&\|]
|
||||
.RB "[\|" \-nostdinc "\|]"
|
||||
.RB "[\|" \-nostdinc++ "\|]"
|
||||
.RB "[\|" \-P "\|]"
|
||||
.RB "[\|" \-pedantic "\|]"
|
||||
.RB "[\|" \-pedantic\-errors "\|]"
|
||||
.RB "[\|" \-traditional "\|]"
|
||||
.RB "[\|" \-trigraphs "\|]"
|
||||
.RB "[\|" \-U \c
|
||||
.I name\c
|
||||
\&\|]
|
||||
.RB "[\|" \-undef "\|]"
|
||||
.RB "[\|" \-Wtrigraphs "\|]"
|
||||
.RB "[\|" \-Wcomment "\|]"
|
||||
.RB "[\|" \-Wall "\|]"
|
||||
.RB "[\|" \-Wtraditional "\|]"
|
||||
.br
|
||||
.RB "[\|" \c
|
||||
.I infile\c
|
||||
.RB | \- "\|]"
|
||||
.RB "[\|" \c
|
||||
.I outfile\c
|
||||
.RB | \- "\|]"
|
||||
.ad b
|
||||
.hy 1
|
||||
.SH DESCRIPTION
|
||||
The C preprocessor is a \c
|
||||
.I macro processor\c
|
||||
\& that is used automatically by
|
||||
the C compiler to transform your program before actual compilation. It is
|
||||
called a macro processor because it allows you to define \c
|
||||
.I macros\c
|
||||
\&,
|
||||
which are brief abbreviations for longer constructs.
|
||||
|
||||
The C preprocessor provides four separate facilities that you can use as
|
||||
you see fit:
|
||||
.TP
|
||||
\(bu
|
||||
Inclusion of header files. These are files of declarations that can be
|
||||
substituted into your program.
|
||||
.TP
|
||||
\(bu
|
||||
Macro expansion. You can define \c
|
||||
.I macros\c
|
||||
\&, which are abbreviations
|
||||
for arbitrary fragments of C code, and then the C preprocessor will
|
||||
replace the macros with their definitions throughout the program.
|
||||
.TP
|
||||
\(bu
|
||||
Conditional compilation. Using special preprocessing directives, you
|
||||
can include or exclude parts of the program according to various
|
||||
conditions.
|
||||
.TP
|
||||
\(bu
|
||||
Line control. If you use a program to combine or rearrange source files into
|
||||
an intermediate file which is then compiled, you can use line control
|
||||
to inform the compiler of where each source line originally came from.
|
||||
.PP
|
||||
C preprocessors vary in some details. For a full explanation of the
|
||||
GNU C preprocessor, see the
|
||||
.B info
|
||||
file `\|\c
|
||||
.B cpp.info\c
|
||||
\&\|', or the manual
|
||||
.I The C Preprocessor\c
|
||||
\&. Both of these are built from the same documentation source file, `\|\c
|
||||
.B cpp.texinfo\c
|
||||
\&\|'. The GNU C
|
||||
preprocessor provides a superset of the features of ANSI Standard C.
|
||||
|
||||
ANSI Standard C requires the rejection of many harmless constructs commonly
|
||||
used by today's C programs. Such incompatibility would be inconvenient for
|
||||
users, so the GNU C preprocessor is configured to accept these constructs
|
||||
by default. Strictly speaking, to get ANSI Standard C, you must use the
|
||||
options `\|\c
|
||||
.B \-trigraphs\c
|
||||
\&\|', `\|\c
|
||||
.B \-undef\c
|
||||
\&\|' and `\|\c
|
||||
.B \-pedantic\c
|
||||
\&\|', but in
|
||||
practice the consequences of having strict ANSI Standard C make it
|
||||
undesirable to do this.
|
||||
|
||||
Most often when you use the C preprocessor you will not have to invoke it
|
||||
explicitly: the C compiler will do so automatically. However, the
|
||||
preprocessor is sometimes useful individually.
|
||||
|
||||
When you call the preprocessor individually, either name
|
||||
(\c
|
||||
.B cpp\c
|
||||
\& or \c
|
||||
.B cccp\c
|
||||
\&) will do\(em\&they are completely synonymous.
|
||||
|
||||
The C preprocessor expects two file names as arguments, \c
|
||||
.I infile\c
|
||||
\& and
|
||||
\c
|
||||
.I outfile\c
|
||||
\&. The preprocessor reads \c
|
||||
.I infile\c
|
||||
\& together with any other
|
||||
files it specifies with `\|\c
|
||||
.B #include\c
|
||||
\&\|'. All the output generated by the
|
||||
combined input files is written in \c
|
||||
.I outfile\c
|
||||
\&.
|
||||
|
||||
Either \c
|
||||
.I infile\c
|
||||
\& or \c
|
||||
.I outfile\c
|
||||
\& may be `\|\c
|
||||
.B \-\c
|
||||
\&\|', which as \c
|
||||
.I infile\c
|
||||
\&
|
||||
means to read from standard input and as \c
|
||||
.I outfile\c
|
||||
\& means to write to
|
||||
standard output. Also, if \c
|
||||
.I outfile\c
|
||||
\& or both file names are omitted,
|
||||
the standard output and standard input are used for the omitted file names.
|
||||
.SH OPTIONS
|
||||
Here is a table of command options accepted by the C preprocessor.
|
||||
These options can also be given when compiling a C program; they are
|
||||
passed along automatically to the preprocessor when it is invoked by
|
||||
the compiler.
|
||||
.TP
|
||||
.B \-P
|
||||
Inhibit generation of `\|\c
|
||||
.B #\c
|
||||
\&\|'-lines with line-number information in
|
||||
the output from the preprocessor. This might be
|
||||
useful when running the preprocessor on something that is not C code
|
||||
and will be sent to a program which might be confused by the
|
||||
`\|\c
|
||||
.B #\c
|
||||
\&\|'-lines.
|
||||
.TP
|
||||
.B \-C
|
||||
Do not discard comments: pass them through to the output file.
|
||||
Comments appearing in arguments of a macro call will be copied to the
|
||||
output before the expansion of the macro call.
|
||||
.TP
|
||||
.B \-traditional
|
||||
Try to imitate the behavior of old-fashioned C, as opposed to ANSI C.
|
||||
.TP
|
||||
.B \-trigraphs
|
||||
Process ANSI standard trigraph sequences. These are three-character
|
||||
sequences, all starting with `\|\c
|
||||
.B ??\c
|
||||
\&\|', that are defined by ANSI C to
|
||||
stand for single characters. For example, `\|\c
|
||||
.B ??/\c
|
||||
\&\|' stands for
|
||||
`\|\c
|
||||
.BR "\e" "\|',"
|
||||
so `\|\c
|
||||
.B '??/n'\c
|
||||
\&\|' is a character constant for a newline.
|
||||
Strictly speaking, the GNU C preprocessor does not support all
|
||||
programs in ANSI Standard C unless `\|\c
|
||||
.B \-trigraphs\c
|
||||
\&\|' is used, but if
|
||||
you ever notice the difference it will be with relief.
|
||||
|
||||
You don't want to know any more about trigraphs.
|
||||
.TP
|
||||
.B \-pedantic
|
||||
Issue warnings required by the ANSI C standard in certain cases such
|
||||
as when text other than a comment follows `\|\c
|
||||
.B #else\c
|
||||
\&\|' or `\|\c
|
||||
.B #endif\c
|
||||
\&\|'.
|
||||
.TP
|
||||
.B \-pedantic\-errors
|
||||
Like `\|\c
|
||||
.B \-pedantic\c
|
||||
\&\|', except that errors are produced rather than
|
||||
warnings.
|
||||
.TP
|
||||
.B \-Wtrigraphs
|
||||
Warn if any trigraphs are encountered (assuming they are enabled).
|
||||
.TP
|
||||
.B \-Wcomment
|
||||
.TP
|
||||
.B \-Wcomments
|
||||
Warn whenever a comment-start sequence `\|\c
|
||||
.B /*\c
|
||||
\&\|' appears in a comment.
|
||||
(Both forms have the same effect).
|
||||
.TP
|
||||
.B \-Wall
|
||||
Requests both `\|\c
|
||||
.B \-Wtrigraphs\c
|
||||
\&\|' and `\|\c
|
||||
.B \-Wcomment\c
|
||||
\&\|' (but not
|
||||
`\|\c
|
||||
.B \-Wtraditional\c
|
||||
\&\|').
|
||||
.TP
|
||||
.B \-Wtraditional
|
||||
Warn about certain constructs that behave differently in traditional and
|
||||
ANSI C.
|
||||
.TP
|
||||
.BI "\-I " directory\c
|
||||
\&
|
||||
Add the directory \c
|
||||
.I directory\c
|
||||
\& to the end of the list of
|
||||
directories to be searched for header files.
|
||||
This can be used to override a system header file, substituting your
|
||||
own version, since these directories are searched before the system
|
||||
header file directories. If you use more than one `\|\c
|
||||
.B \-I\c
|
||||
\&\|' option,
|
||||
the directories are scanned in left-to-right order; the standard
|
||||
system directories come after.
|
||||
.TP
|
||||
.B \-I\-
|
||||
Any directories specified with `\|\c
|
||||
.B \-I\c
|
||||
\&\|' options before the `\|\c
|
||||
.B \-I\-\c
|
||||
\&\|'
|
||||
option are searched only for the case of `\|\c
|
||||
.B #include "\c
|
||||
.I file\c
|
||||
\&"\c
|
||||
\&\|';
|
||||
they are not searched for `\|\c
|
||||
.B #include <\c
|
||||
.I file\c
|
||||
\&>\c
|
||||
\&\|'.
|
||||
|
||||
If additional directories are specified with `\|\c
|
||||
.B \-I\c
|
||||
\&\|' options after
|
||||
the `\|\c
|
||||
.B \-I\-\c
|
||||
\&\|', these directories are searched for all `\|\c
|
||||
.B #include\c
|
||||
\&\|'
|
||||
directives.
|
||||
|
||||
In addition, the `\|\c
|
||||
.B \-I\-\c
|
||||
\&\|' option inhibits the use of the current
|
||||
directory as the first search directory for `\|\c
|
||||
.B #include "\c
|
||||
.I file\c
|
||||
\&"\c
|
||||
\&\|'.
|
||||
Therefore, the current directory is searched only if it is requested
|
||||
explicitly with `\|\c
|
||||
.B \-I.\c
|
||||
\&\|'. Specifying both `\|\c
|
||||
.B \-I\-\c
|
||||
\&\|' and `\|\c
|
||||
.B \-I.\c
|
||||
\&\|'
|
||||
allows you to control precisely which directories are searched before
|
||||
the current one and which are searched after.
|
||||
.TP
|
||||
.B \-nostdinc
|
||||
Do not search the standard system directories for header files.
|
||||
Only the directories you have specified with `\|\c
|
||||
.B \-I\c
|
||||
\&\|' options
|
||||
(and the current directory, if appropriate) are searched.
|
||||
.TP
|
||||
.B \-nostdinc++
|
||||
Do not search for header files in the C++ specific standard
|
||||
directories, but do still search the other standard directories.
|
||||
(This option is used when building libg++.)
|
||||
.TP
|
||||
.BI "\-D " "name"\c
|
||||
\&
|
||||
Predefine \c
|
||||
.I name\c
|
||||
\& as a macro, with definition `\|\c
|
||||
.B 1\c
|
||||
\&\|'.
|
||||
.TP
|
||||
.BI "\-D " "name" = definition
|
||||
\&
|
||||
Predefine \c
|
||||
.I name\c
|
||||
\& as a macro, with definition \c
|
||||
.I definition\c
|
||||
\&.
|
||||
There are no restrictions on the contents of \c
|
||||
.I definition\c
|
||||
\&, but if
|
||||
you are invoking the preprocessor from a shell or shell-like program
|
||||
you may need to use the shell's quoting syntax to protect characters
|
||||
such as spaces that have a meaning in the shell syntax. If you use more than
|
||||
one `\|\c
|
||||
.B \-D\c
|
||||
\&\|' for the same
|
||||
.I name\c
|
||||
\&, the rightmost definition takes effect.
|
||||
.TP
|
||||
.BI "\-U " "name"\c
|
||||
\&
|
||||
Do not predefine \c
|
||||
.I name\c
|
||||
\&. If both `\|\c
|
||||
.B \-U\c
|
||||
\&\|' and `\|\c
|
||||
.B \-D\c
|
||||
\&\|' are
|
||||
specified for one name, the `\|\c
|
||||
.B \-U\c
|
||||
\&\|' beats the `\|\c
|
||||
.B \-D\c
|
||||
\&\|' and the name
|
||||
is not predefined.
|
||||
.TP
|
||||
.B \-undef
|
||||
Do not predefine any nonstandard macros.
|
||||
.TP
|
||||
.BI "\-A " "name(" value )
|
||||
Assert (in the same way as the \c
|
||||
.B #assert\c
|
||||
\& directive)
|
||||
the predicate \c
|
||||
.I name\c
|
||||
\& with tokenlist \c
|
||||
.I value\c
|
||||
\&. Remember to escape or quote the parentheses on
|
||||
shell command lines.
|
||||
|
||||
You can use `\|\c
|
||||
.B \-A-\c
|
||||
\&\|' to disable all predefined assertions; it also
|
||||
undefines all predefined macros.
|
||||
.TP
|
||||
.B \-dM
|
||||
Instead of outputting the result of preprocessing, output a list of
|
||||
`\|\c
|
||||
.B #define\c
|
||||
\&\|' directives for all the macros defined during the
|
||||
execution of the preprocessor, including predefined macros. This gives
|
||||
you a way of finding out what is predefined in your version of the
|
||||
preprocessor; assuming you have no file `\|\c
|
||||
.B foo.h\c
|
||||
\&\|', the command
|
||||
.sp
|
||||
.br
|
||||
touch\ foo.h;\ cpp\ \-dM\ foo.h
|
||||
.br
|
||||
.sp
|
||||
will show the values of any predefined macros.
|
||||
.TP
|
||||
.B \-dD
|
||||
Like `\|\c
|
||||
.B \-dM\c
|
||||
\&\|' except in two respects: it does \c
|
||||
.I not\c
|
||||
\& include the
|
||||
predefined macros, and it outputs \c
|
||||
.I both\c
|
||||
\& the `\|\c
|
||||
.B #define\c
|
||||
\&\|'
|
||||
directives and the result of preprocessing. Both kinds of output go to
|
||||
the standard output file.
|
||||
.PP
|
||||
.TP
|
||||
.BR \-M\ [ \-MG ]
|
||||
Instead of outputting the result of preprocessing, output a rule
|
||||
suitable for \c
|
||||
.B make\c
|
||||
\& describing the dependencies of the main
|
||||
source file. The preprocessor outputs one \c
|
||||
.B make\c
|
||||
\& rule containing
|
||||
the object file name for that source file, a colon, and the names of
|
||||
all the included files. If there are many included files then the
|
||||
rule is split into several lines using `\|\c
|
||||
.B \\\\\c
|
||||
\&\|'-newline.
|
||||
|
||||
`\|\c
|
||||
.B \-MG\c
|
||||
\&\|' says to treat missing header files as generated files and assume \c
|
||||
they live in the same directory as the source file. It must be specified \c
|
||||
in addition to `\|\c
|
||||
.B \-M\c
|
||||
\&\|'.
|
||||
|
||||
This feature is used in automatic updating of makefiles.
|
||||
.TP
|
||||
.BR \-MM\ [ \-MG ]
|
||||
Like `\|\c
|
||||
.B \-M\c
|
||||
\&\|' but mention only the files included with `\|\c
|
||||
.B #include
|
||||
"\c
|
||||
.I file\c
|
||||
\&"\c
|
||||
\&\|'. System header files included with `\|\c
|
||||
.B #include
|
||||
<\c
|
||||
.I file\c
|
||||
\&>\c
|
||||
\&\|' are omitted.
|
||||
.TP
|
||||
.BI \-MD\ file
|
||||
Like `\|\c
|
||||
.B \-M\c
|
||||
\&\|' but the dependency information is written to `\|\c
|
||||
.I file\c
|
||||
\&\|'. This is in addition to compiling the file as
|
||||
specified\(em\&`\|\c
|
||||
.B \-MD\c
|
||||
\&\|' does not inhibit ordinary compilation the way
|
||||
`\|\c
|
||||
.B \-M\c
|
||||
\&\|' does.
|
||||
|
||||
When invoking gcc, do not specify the `\|\c
|
||||
.I file\c
|
||||
\&\|' argument. Gcc will create file names made by replacing `\|\c
|
||||
.B .c\c
|
||||
\&\|' with `\|\c
|
||||
.B .d\c
|
||||
\&\|' at the end of the input file names.
|
||||
|
||||
In Mach, you can use the utility \c
|
||||
.B md\c
|
||||
\& to merge multiple files
|
||||
into a single dependency file suitable for using with the `\|\c
|
||||
.B make\c
|
||||
\&\|'
|
||||
command.
|
||||
.TP
|
||||
.BI \-MMD\ file
|
||||
Like `\|\c
|
||||
.B \-MD\c
|
||||
\&\|' except mention only user header files, not system
|
||||
header files.
|
||||
.TP
|
||||
.B \-H
|
||||
Print the name of each header file used, in addition to other normal
|
||||
activities.
|
||||
.TP
|
||||
.BI "\-imacros " "file"\c
|
||||
\&
|
||||
Process \c
|
||||
.I file\c
|
||||
\& as input, discarding the resulting output, before
|
||||
processing the regular input file. Because the output generated from
|
||||
\c
|
||||
.I file\c
|
||||
\& is discarded, the only effect of `\|\c
|
||||
.B \-imacros \c
|
||||
.I file\c
|
||||
\&\c
|
||||
\&\|' is to
|
||||
make the macros defined in \c
|
||||
.I file\c
|
||||
\& available for use in the main
|
||||
input. The preprocessor evaluates any `\|\c
|
||||
.B \-D\c
|
||||
\&\|' and `\|\c
|
||||
.B \-U\c
|
||||
\&\|' options
|
||||
on the command line before processing `\|\c
|
||||
.B \-imacros \c
|
||||
.I file\c
|
||||
\&\|' \c
|
||||
\&.
|
||||
.TP
|
||||
.BI "\-include " "file"
|
||||
Process
|
||||
.I file
|
||||
as input, and include all the resulting output,
|
||||
before processing the regular input file.
|
||||
.TP
|
||||
.BI "-idirafter " "dir"\c
|
||||
\&
|
||||
Add the directory \c
|
||||
.I dir\c
|
||||
\& to the second include path. The directories
|
||||
on the second include path are searched when a header file is not found
|
||||
in any of the directories in the main include path (the one that
|
||||
`\|\c
|
||||
.B \-I\c
|
||||
\&\|' adds to).
|
||||
.TP
|
||||
.BI "-iprefix " "prefix"\c
|
||||
\&
|
||||
Specify \c
|
||||
.I prefix\c
|
||||
\& as the prefix for subsequent `\|\c
|
||||
.B \-iwithprefix\c
|
||||
\&\|'
|
||||
options.
|
||||
.TP
|
||||
.BI "-iwithprefix " "dir"\c
|
||||
\&
|
||||
Add a directory to the second include path. The directory's name is
|
||||
made by concatenating \c
|
||||
.I prefix\c
|
||||
\& and \c
|
||||
.I dir\c
|
||||
\&, where \c
|
||||
.I prefix\c
|
||||
\&
|
||||
was specified previously with `\|\c
|
||||
.B \-iprefix\c
|
||||
\&\|'.
|
||||
.TP
|
||||
.B \-lang-c
|
||||
.TP
|
||||
.B \-lang-c++
|
||||
.TP
|
||||
.B \-lang-objc
|
||||
.TP
|
||||
.B \-lang-objc++
|
||||
Specify the source language. `\|\c
|
||||
.B \-lang-c++\c
|
||||
\&\|' makes the preprocessor
|
||||
handle C++ comment syntax, and includes extra default include
|
||||
directories for C++, and `\|\c
|
||||
.B \-lang-objc\c
|
||||
\&\|' enables the Objective C
|
||||
`\|\c
|
||||
.B #import\c
|
||||
\&\|' directive. `\|\c
|
||||
.B \-lang-c\c
|
||||
\&\|' explicitly turns off both of
|
||||
these extensions, and `\|\c
|
||||
.B \-lang-objc++\c
|
||||
\&\|' enables both.
|
||||
|
||||
These options are generated by the compiler driver \c
|
||||
.B gcc\c
|
||||
\&, but not
|
||||
passed from the `\|\c
|
||||
.B gcc\c
|
||||
\&\|' command line.
|
||||
.TP
|
||||
.B \-lint
|
||||
Look for commands to the program checker \c
|
||||
.B lint\c
|
||||
\& embedded in
|
||||
comments, and emit them preceded by `\|\c
|
||||
.B #pragma lint\c
|
||||
\&\|'. For example,
|
||||
the comment `\|\c
|
||||
.B /* NOTREACHED */\c
|
||||
\&\|' becomes `\|\c
|
||||
.B #pragma lint
|
||||
NOTREACHED\c
|
||||
\&\|'.
|
||||
|
||||
This option is available only when you call \c
|
||||
.B cpp\c
|
||||
\& directly;
|
||||
\c
|
||||
.B gcc\c
|
||||
\& will not pass it from its command line.
|
||||
.TP
|
||||
.B \-$
|
||||
Forbid the use of `\|\c
|
||||
.B $\c
|
||||
\&\|' in identifiers. This was formerly required for strict conformance
|
||||
to the C Standard before the standard was corrected. \c
|
||||
|
||||
This option is available only when you call \c
|
||||
.B cpp\c
|
||||
\& directly;
|
||||
.B gcc\c
|
||||
\& will not pass it from its command line.
|
||||
.SH "SEE ALSO"
|
||||
.RB "`\|" Cpp "\|'"
|
||||
entry in
|
||||
.B info\c
|
||||
\&;
|
||||
.I The C Preprocessor\c
|
||||
, Richard M. Stallman.
|
||||
.br
|
||||
.BR gcc "(" 1 ");"
|
||||
.RB "`\|" Gcc "\|'"
|
||||
entry in
|
||||
.B info\c
|
||||
\&;
|
||||
.I
|
||||
Using and Porting GNU CC (for version 2.0)\c
|
||||
, Richard M. Stallman.
|
||||
.SH COPYING
|
||||
Copyright (c) 1991, 1992, 1993 Free Software Foundation, Inc.
|
||||
.PP
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
.PP
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
.PP
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions, except that this permission notice may be included in
|
||||
translations approved by the Free Software Foundation instead of in
|
||||
the original English.
|
4
contrib/gcc/config.guess
vendored
4
contrib/gcc/config.guess
vendored
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Use the top-level config.guess so that we don't have two of them.
|
||||
guesssys=`echo $0 | sed 's|config.guess|../config.guess|'`
|
||||
exec ${guesssys} "$@"
|
@ -1,150 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for DEC Alpha
|
||||
running Windows/NT.
|
||||
Copyright (C) 1995, 1996, 1999, 2000, 2002 Free Software Foundation, Inc.
|
||||
|
||||
Donn Terry, Softway Systems, Inc.
|
||||
From code
|
||||
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
|
||||
|
||||
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. */
|
||||
|
||||
/* cpp handles __STDC__ */
|
||||
/* The three "Alpha" defines on the first such line are from the CLAXP spec */
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do { \
|
||||
builtin_define ("__INTERIX"); \
|
||||
builtin_define ("__OPENNT"); \
|
||||
builtin_define ("__Alpha_AXP"); \
|
||||
builtin_define ("_M_ALPHA"); \
|
||||
builtin_define ("_ALPHA_"); \
|
||||
builtin_define ("__stdcall="); \
|
||||
builtin_define ("__cdecl="); \
|
||||
builtin_assert ("system=unix"); \
|
||||
builtin_assert ("system=interix"); \
|
||||
} while (0)
|
||||
|
||||
#undef CPP_SUBTARGET_SPEC
|
||||
#define CPP_SUBTARGET_SPEC "\
|
||||
-remap \
|
||||
%{posix:-D_POSIX_SOURCE} \
|
||||
-isystem %$INTERIX_ROOT/usr/include"
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (alpha Interix)");
|
||||
|
||||
/* alpha.h sets this, but it doesn't apply to us */
|
||||
#undef OBJECT_FORMAT_ECOFF
|
||||
#undef OBJECT_FORMAT_COFF
|
||||
|
||||
/* LINK_SPEC */
|
||||
|
||||
/* MD_STARTFILE_PREFIX */
|
||||
|
||||
/* ASM_OUTPUT_LOOP_ALIGN; ASM_OUTPUT_ALIGN_CODE */
|
||||
|
||||
/* Codegen macro overrides for NT internal conventions */
|
||||
|
||||
/* the below are ecoff specific... we don't need them, so
|
||||
undef them (they'll get a default later) */
|
||||
|
||||
#undef PUT_SDB_BLOCK_START
|
||||
#undef PUT_SDB_BLOCK_END
|
||||
|
||||
/* The following are needed for C++, but also needed for profiling */
|
||||
|
||||
/* Support const sections and the ctors and dtors sections for g++. */
|
||||
|
||||
#define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
|
||||
|
||||
/* 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.) */
|
||||
|
||||
#define CTORS_SECTION_ASM_OP "\t.ctors"
|
||||
#define DTORS_SECTION_ASM_OP "\t.dtors"
|
||||
|
||||
/* The linker will take care of this, and having them causes problems with
|
||||
ld -r (specifically -rU). */
|
||||
#define CTOR_LISTS_DEFINED_EXTERNALLY 1
|
||||
|
||||
#define SET_ASM_OP "\t.set\t"
|
||||
/* Output a definition (implements alias) */
|
||||
#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)
|
||||
|
||||
/* We use the defaults, so undef the null definitions */
|
||||
#undef PUT_SDB_FUNCTION_START
|
||||
#undef PUT_SDB_FUNCTION_END
|
||||
#undef PUT_SDB_EPILOGUE_END
|
||||
|
||||
#define HOST_PTR_PRINTF "%p"
|
||||
#define HOST_PTR_AS_INT unsigned long
|
||||
|
||||
#define PCC_BITFIELD_TYPE_MATTERS 1
|
||||
#define PCC_BITFIELD_TYPE_TEST TYPE_NATIVE(rec)
|
||||
#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec)
|
||||
|
||||
/* DWARF2 Unwinding doesn't work with exception handling yet. */
|
||||
#undef DWARF2_UNWIND_INFO
|
||||
#define DWARF2_UNWIND_INFO 0
|
||||
|
||||
/* Don't assume anything about the header files. */
|
||||
#define NO_IMPLICIT_EXTERN_C
|
||||
|
||||
/* The definition of this macro implies that there are cases where
|
||||
a scalar value cannot be returned in registers.
|
||||
|
||||
On NT (according to the spec) anything except strings/array that fits
|
||||
in 64 bits is returned in the registers (this appears to differ from
|
||||
the rest of the Alpha family). */
|
||||
|
||||
#undef RETURN_IN_MEMORY
|
||||
#define RETURN_IN_MEMORY(TYPE) \
|
||||
(TREE_CODE (TYPE) == ARRAY_TYPE || int_size_in_bytes(TYPE) > 8)
|
||||
|
||||
#define ASM_LOAD_ADDR(loc, reg) " lda " #reg "," #loc "\n"
|
||||
|
||||
#undef ASM_FILE_START
|
||||
#define ASM_FILE_START(FILE) \
|
||||
{ \
|
||||
alpha_write_verstamp (FILE); \
|
||||
fprintf (FILE, "\t.set noreorder\n"); \
|
||||
fprintf (FILE, "\t.set volatile\n"); \
|
||||
fprintf (FILE, "\t.set noat\n"); \
|
||||
fprintf (FILE, "\t.globl\t__fltused\n"); \
|
||||
ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for DEC Alpha
|
||||
running Windows/NT.
|
||||
Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
Derived from code
|
||||
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
|
||||
|
||||
Donn Terry, Softway Systems, Inc.
|
||||
|
||||
This file contains the code-generation stuff common to the 32-bit
|
||||
versions of the DEC/Compaq Alpha architecture. It is shared by
|
||||
Interix and NT/Win32 ports. It should not contain compile-time
|
||||
or run-time dependent environment values (such as compiler options
|
||||
or anything containing a file or pathname.)
|
||||
|
||||
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. */
|
||||
|
||||
#undef TARGET_ABI_WINDOWS_NT
|
||||
#define TARGET_ABI_WINDOWS_NT 1
|
||||
|
||||
/* WinNT (and thus Interix) use unsigned int */
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
|
||||
/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
|
||||
#undef POINTER_SIZE
|
||||
#define POINTER_SIZE 32
|
||||
#define POINTERS_EXTEND_UNSIGNED 0
|
||||
|
||||
/* We don't change Pmode to the "obvious" SI mode... the above appears
|
||||
to affect the in-memory size; we want the registers to stay DImode
|
||||
to match the md file */
|
||||
|
||||
/* "long" is 32 bits. */
|
||||
#undef LONG_TYPE_SIZE
|
||||
#define LONG_TYPE_SIZE 32
|
||||
|
||||
|
||||
/* Output assembler code for a block containing the constant parts
|
||||
of a trampoline, leaving space for the variable parts.
|
||||
|
||||
The trampoline should set the static chain pointer to value placed
|
||||
into the trampoline and should branch to the specified routine. */
|
||||
|
||||
#undef TRAMPOLINE_TEMPLATE
|
||||
#define TRAMPOLINE_TEMPLATE(FILE) \
|
||||
{ \
|
||||
fprintf (FILE, "\tbr $27,$LTRAMPP\n"); \
|
||||
fprintf (FILE, "$LTRAMPP:\n\tldl $1,12($27)\n"); \
|
||||
fprintf (FILE, "\tldl $27,16($27)\n"); \
|
||||
fprintf (FILE, "\tjmp $31,($27),0\n"); \
|
||||
fprintf (FILE, "\t.long 0,0\n"); \
|
||||
}
|
||||
|
||||
/* Length in units of the trampoline for entering a nested function. */
|
||||
|
||||
#undef TRAMPOLINE_SIZE
|
||||
#define TRAMPOLINE_SIZE 24
|
||||
|
||||
/* The alignment of a trampoline, in bits. */
|
||||
|
||||
#undef TRAMPOLINE_ALIGNMENT
|
||||
#define TRAMPOLINE_ALIGNMENT 32
|
||||
|
||||
/* Emit RTL insns to initialize the variable parts of a trampoline.
|
||||
FNADDR is an RTX for the address of the function's pure code.
|
||||
CXT is an RTX for the static chain value for the function. */
|
||||
|
||||
#undef INITIALIZE_TRAMPOLINE
|
||||
#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
|
||||
alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 20, 16, 12)
|
@ -1,192 +0,0 @@
|
||||
# Copyright (C) 1996, 1998 Free Software Foundation, Inc.
|
||||
# Contributed by Richard Henderson (rth@tamu.edu)
|
||||
#
|
||||
# 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.
|
||||
|
||||
#
|
||||
# Heads of the constructor/destructor lists.
|
||||
#
|
||||
|
||||
# The __*TOR_LIST__ symbols are not global because when this file is used
|
||||
# in a shared library, we do not want the symbol to fall over to the
|
||||
# application's lists.
|
||||
|
||||
.section .ctors,"aw"
|
||||
|
||||
.align 3
|
||||
__CTOR_LIST__:
|
||||
.quad -1
|
||||
|
||||
.section .dtors,"aw"
|
||||
|
||||
.align 3
|
||||
__DTOR_LIST__:
|
||||
.quad -1
|
||||
|
||||
.section .eh_frame,"aw"
|
||||
__EH_FRAME_BEGIN__:
|
||||
|
||||
#
|
||||
# Fragment of the ELF _fini routine that invokes our dtor cleanup.
|
||||
#
|
||||
|
||||
.section .fini,"ax"
|
||||
|
||||
# Since the bits of the _fini function are spread across many
|
||||
# object files, each potentially with its own GP, we must
|
||||
# assume we need to load ours. Further, our .fini section
|
||||
# can easily be more than 4MB away from our .text bits so we
|
||||
# can't use bsr.
|
||||
|
||||
br $29,1f
|
||||
1: ldgp $29,0($29)
|
||||
jsr $26,__do_global_dtors_aux
|
||||
|
||||
# Ideally this call would go in crtend.o, except that we can't
|
||||
# get hold of __EH_FRAME_BEGIN__ there.
|
||||
|
||||
jsr $26,__do_frame_takedown
|
||||
|
||||
# Must match the alignment we got from crti.o else we get
|
||||
# zero-filled holes in our _fini function and then SIGILL.
|
||||
.align 3
|
||||
|
||||
#
|
||||
# Fragment of the ELF _init routine that sets up the frame info.
|
||||
#
|
||||
|
||||
.section .init,"ax"
|
||||
br $29,1f
|
||||
1: ldgp $29,0($29)
|
||||
jsr $26,__do_frame_setup
|
||||
.align 3
|
||||
|
||||
#
|
||||
# Invoke our destructors in order.
|
||||
#
|
||||
|
||||
.data
|
||||
|
||||
# Support recursive calls to exit.
|
||||
$ptr: .quad __DTOR_LIST__
|
||||
|
||||
.text
|
||||
|
||||
.align 3
|
||||
.ent __do_global_dtors_aux
|
||||
|
||||
__do_global_dtors_aux:
|
||||
lda $30,-16($30)
|
||||
.frame $30,16,$26,0
|
||||
stq $9,8($30)
|
||||
stq $26,0($30)
|
||||
.mask 0x4000200,-16
|
||||
.prologue 0
|
||||
|
||||
lda $9,$ptr
|
||||
br 1f
|
||||
0: stq $1,0($9)
|
||||
jsr $26,($27)
|
||||
1: ldq $1,0($9)
|
||||
ldq $27,8($1)
|
||||
addq $1,8,$1
|
||||
bne $27,0b
|
||||
|
||||
ldq $26,0($30)
|
||||
ldq $9,8($30)
|
||||
lda $30,16($30)
|
||||
ret
|
||||
|
||||
.end __do_global_dtors_aux
|
||||
|
||||
#
|
||||
# Install our frame info.
|
||||
#
|
||||
|
||||
# ??? How can we rationally keep this size correct?
|
||||
|
||||
.section .bss
|
||||
.type $object,@object
|
||||
.align 3
|
||||
$object:
|
||||
.zero 48
|
||||
.size $object, 48
|
||||
|
||||
.text
|
||||
|
||||
.align 3
|
||||
.ent __do_frame_setup
|
||||
|
||||
__do_frame_setup:
|
||||
ldgp $29,0($27)
|
||||
lda $30,-16($30)
|
||||
.frame $30,16,$26,0
|
||||
stq $26,0($30)
|
||||
.mask 0x4000000,-16
|
||||
.prologue 1
|
||||
|
||||
lda $1,__register_frame_info
|
||||
beq $1,0f
|
||||
lda $16,__EH_FRAME_BEGIN__
|
||||
lda $17,$object
|
||||
jsr $26,__register_frame_info
|
||||
ldq $26,0($30)
|
||||
0: lda $30,16($30)
|
||||
ret
|
||||
|
||||
.end __do_frame_setup
|
||||
|
||||
#
|
||||
# Remove our frame info.
|
||||
#
|
||||
|
||||
.align 3
|
||||
.ent __do_frame_takedown
|
||||
|
||||
__do_frame_takedown:
|
||||
ldgp $29,0($27)
|
||||
lda $30,-16($30)
|
||||
.frame $30,16,$26,0
|
||||
stq $26,0($30)
|
||||
.mask 0x4000000,-16
|
||||
.prologue 1
|
||||
|
||||
lda $1,__deregister_frame_info
|
||||
beq $1,0f
|
||||
lda $16,__EH_FRAME_BEGIN__
|
||||
jsr $26,__deregister_frame_info
|
||||
ldq $26,0($30)
|
||||
0: lda $30,16($30)
|
||||
ret
|
||||
|
||||
.end __do_frame_takedown
|
||||
|
||||
.weak __register_frame_info
|
||||
.weak __deregister_frame_info
|
@ -1,108 +0,0 @@
|
||||
# Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
# Contributed by Richard Henderson (rth@tamu.edu)
|
||||
#
|
||||
# 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.
|
||||
|
||||
#
|
||||
# Tails of the constructor/destructor lists.
|
||||
#
|
||||
|
||||
# The __*TOR_END__ symbols are not global because when this file is used
|
||||
# in a shared library, we do not want the symbol to fall over to the
|
||||
# application's lists.
|
||||
|
||||
.section .ctors,"aw"
|
||||
|
||||
.align 3
|
||||
__CTOR_END__:
|
||||
.quad 0
|
||||
|
||||
.section .dtors,"aw"
|
||||
|
||||
.align 3
|
||||
__DTOR_END__:
|
||||
.quad 0
|
||||
|
||||
.section .eh_frame,"aw"
|
||||
__FRAME_END__:
|
||||
.quad 0
|
||||
|
||||
#
|
||||
# Fragment of the ELF _init routine that invokes our ctor startup
|
||||
#
|
||||
|
||||
.section .init,"ax"
|
||||
|
||||
# Since the bits of the _init function are spread across many
|
||||
# object files, each potentially with its own GP, we must
|
||||
# assume we need to load ours. Further, our .init section
|
||||
# can easily be more than 4MB away from our .text bits so we
|
||||
# can't use bsr.
|
||||
|
||||
br $29,1f
|
||||
1: ldgp $29,0($29)
|
||||
jsr $26,__do_global_ctors_aux
|
||||
|
||||
# Must match the alignment we got from crti.o else we get
|
||||
# zero-filled holes in our _init function and thense SIGILL.
|
||||
.align 3
|
||||
|
||||
#
|
||||
# Invoke our destructors in order.
|
||||
#
|
||||
|
||||
.text
|
||||
|
||||
.align 3
|
||||
.ent __do_global_ctors_aux
|
||||
|
||||
__do_global_ctors_aux:
|
||||
ldgp $29,0($27)
|
||||
lda $30,-16($30)
|
||||
.frame $30,16,$26,0
|
||||
stq $9,8($30)
|
||||
stq $26,0($30)
|
||||
.mask 0x4000200,-16
|
||||
.prologue 1
|
||||
|
||||
lda $9,__CTOR_END__
|
||||
br 1f
|
||||
0: jsr $26,($27)
|
||||
1: ldq $27,-8($9)
|
||||
subq $9,8,$9
|
||||
not $27,$0
|
||||
bne $0,0b
|
||||
|
||||
ldq $26,0($30)
|
||||
ldq $9,8($30)
|
||||
lda $30,16($30)
|
||||
ret
|
||||
|
||||
.end __do_global_ctors_aux
|
@ -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 (kenner@vlsi1.ultra.nyu.edu)
|
||||
|
||||
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 (pes@regent.e-technik.tu-muenchen.de).
|
||||
|
||||
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 (pes@regent.e-technik.tu-muenchen.de).
|
||||
|
||||
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 (kenner@vlsi1.ultra.nyu.edu)
|
||||
|
||||
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,7 +0,0 @@
|
||||
# t-interix
|
||||
|
||||
# System headers will track gcc's needs.
|
||||
USER_H=
|
||||
|
||||
LIB1ASMSRC = alpha/lib1funcs.asm
|
||||
LIB1ASMFUNCS = _divqu _divq _divlu _divl _remqu _remq _remlu _reml
|
@ -1,55 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler. Vxworks Alpha version.
|
||||
Copyright (C) 1998 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. */
|
||||
|
||||
/* This file just exists to give specs for the Alpha running on VxWorks. */
|
||||
|
||||
#undef CPP_SUBTARGET_SPEC
|
||||
#define CPP_SUBTARGET_SPEC "\
|
||||
%{mvxsim:-DCPU=SIMALPHADUNIX} \
|
||||
%{!mvxsim: %{!mcpu*|mcpu=21064:-DCPU=21064} %{mcpu=21164:-DCPU=21164}} \
|
||||
%{posix: -D_POSIX_SOURCE}"
|
||||
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do { \
|
||||
builtin_define ("__vxworks"); \
|
||||
builtin_define ("__alpha_vxworks"); \
|
||||
builtin_define ("_LONGLONG"); \
|
||||
builtin_assert ("system=vxworks"); \
|
||||
builtin_assert ("system=embedded"); \
|
||||
} while (0)
|
||||
|
||||
/* VxWorks does all the library stuff itself. */
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC ""
|
||||
|
||||
/* VxWorks uses object files, not loadable images. Make linker just combine
|
||||
objects. Also show using 32 bit mode and set start of text to 0. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "-r -taso -T 0"
|
||||
|
||||
/* VxWorks provides the functionality of crt0.o and friends itself. */
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC ""
|
@ -1,39 +0,0 @@
|
||||
/* Configuration for GNU compiler
|
||||
for an DEC/Compaq Alpha
|
||||
Copyright (C) 1999, 2001 Free Software Foundation, Inc.
|
||||
Donn Terry, Softway Systems, Inc.
|
||||
derived from code by Douglas B. Rupp (drupp@cs.washington.edu)
|
||||
|
||||
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 HOST_BITS_PER_WIDE_INT 64
|
||||
#ifdef __GNUC__
|
||||
# define HOST_WIDE_INT long long
|
||||
#else
|
||||
# define HOST_WIDE_INT __int64
|
||||
#endif
|
||||
|
||||
#define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG
|
||||
#ifdef __GNUC__
|
||||
# define HOST_WIDEST_INT long long
|
||||
#else
|
||||
# define HOST_WIDEST_INT __int64
|
||||
#endif
|
||||
#define HOST_WIDEST_INT_PRINT_DEC "%lld"
|
||||
#define HOST_WIDEST_INT_PRINT_UNSIGNED "%llu"
|
||||
#define HOST_WIDEST_INT_PRINT_HEX "0x%llx"
|
@ -1,29 +0,0 @@
|
||||
/* Configuration for GNU C-compiler for openVMS/Alpha.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
Contributed by Douglas Rupp (rupp@gnat.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. */
|
||||
|
||||
#undef HOST_WIDE_INT
|
||||
|
||||
/* Since DEC C long != Gnu C long */
|
||||
#define HOST_PTR_PRINTF "%llx"
|
||||
#define HOST_WIDE_INT_PRINT_DEC "%lld"
|
||||
#define HOST_WIDE_INT_PRINT_UNSIGNED "%llu"
|
||||
#define HOST_WIDE_INT_PRINT_HEX "0x%llx"
|
||||
#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%016llx"
|
@ -1,41 +0,0 @@
|
||||
/* aoutos.h -- operating system specific defines to be used when
|
||||
targeting GCC for some system that uses a.out file format.
|
||||
Copyright (C) 1992 Free Software Foundation, Inc.
|
||||
|
||||
Written by Ron Guilmette (rfg@netcom.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. */
|
||||
|
||||
/* To use this file, make up a file with a name like:
|
||||
|
||||
?????aout.h
|
||||
|
||||
where ????? is replaced by the name of the basic hardware that you
|
||||
are targeting for. Then, in the file ?????aout.h, put something
|
||||
like:
|
||||
|
||||
#include "?????.h"
|
||||
#include "aoutos.h"
|
||||
|
||||
followed by any really system-specific defines (or overrides of
|
||||
defines) which you find that you need. Now, modify the configure
|
||||
or configure.in script to properly use the new ?????aout.h file
|
||||
when configuring for the system. */
|
||||
|
||||
/* Define a symbol indicating that we are using aoutos.h. */
|
||||
#define USING_AOUTOS_H
|
@ -1,46 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler,
|
||||
for ARM with ConiX OS.
|
||||
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Philip Blundell <pb@futuretv.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. */
|
||||
|
||||
/* elfos.h should have already been included. Now just override
|
||||
any conflicting definitions and add any extras. */
|
||||
|
||||
/* Run-time Target Specification. */
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fputs (" (ARM/ELF ConiX)", stderr);
|
||||
|
||||
/* Default to using APCS-32 and software floating point. */
|
||||
#undef TARGET_DEFAULT
|
||||
#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32)
|
||||
|
||||
#ifndef CPP_APCS_PC_DEFAULT_SPEC
|
||||
#define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
|
||||
#endif
|
||||
|
||||
#ifndef SUBTARGET_CPU_DEFAULT
|
||||
#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm7tdmi
|
||||
#endif
|
||||
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do { \
|
||||
builtin_define ("__CONIX__"); \
|
||||
builtin_define ("__ELF__"); \
|
||||
} while (0)
|
@ -1,29 +0,0 @@
|
||||
LIB1ASMSRC = arm/lib1funcs.asm
|
||||
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX _interwork_call_via_rX
|
||||
|
||||
# We want fine grained libraries, so use the new code to build the
|
||||
# floating point emulation libraries.
|
||||
FPBIT = fp-bit.c
|
||||
DPBIT = dp-bit.c
|
||||
|
||||
fp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#define FLOAT' > fp-bit.c
|
||||
echo '#ifndef __ARMEB__' >> fp-bit.c
|
||||
echo '#define FLOAT_BIT_ORDER_MISMATCH' >> fp-bit.c
|
||||
echo '#endif' >> fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
|
||||
|
||||
dp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#ifndef __ARMEB__' > dp-bit.c
|
||||
echo '#define FLOAT_BIT_ORDER_MISMATCH' >> dp-bit.c
|
||||
echo '#define FLOAT_WORD_ORDER_MISMATCH' >> dp-bit.c
|
||||
echo '#endif' >> dp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> dp-bit.c
|
||||
|
||||
# MULTILIB_OPTIONS = mhard-float/msoft-float mapcs-32/mapcs-26 mno-thumb-interwork/mthumb-interwork arm/thumb
|
||||
# MULTILIB_DIRNAMES = le be fpu soft 32bit 26bit normal interwork arm thumb
|
||||
# MULTILIB_MATCHES =
|
||||
# MULTILIB_EXCEPTIONS = *mapcs-26/*mthumb-interwork* *mpacs-26/*mthumb*
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
@ -1,34 +0,0 @@
|
||||
LIB1ASMSRC = arm/lib1funcs.asm
|
||||
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func
|
||||
|
||||
# We want fine grained libraries, so use the new code to build the
|
||||
# floating point emulation libraries.
|
||||
FPBIT = fp-bit.c
|
||||
DPBIT = dp-bit.c
|
||||
|
||||
fp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#define FLOAT' > fp-bit.c
|
||||
echo '#ifndef __ARMEB__' >> fp-bit.c
|
||||
echo '#define FLOAT_BIT_ORDER_MISMATCH' >> fp-bit.c
|
||||
echo '#endif' >> fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
|
||||
|
||||
dp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#ifndef __ARMEB__' > dp-bit.c
|
||||
echo '#define FLOAT_BIT_ORDER_MISMATCH' >> dp-bit.c
|
||||
echo '#define FLOAT_WORD_ORDER_MISMATCH' >> dp-bit.c
|
||||
echo '#endif' >> dp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> dp-bit.c
|
||||
|
||||
MULTILIB_OPTIONS = mlittle-endian/mbig-endian mhard-float/msoft-float
|
||||
MULTILIB_DIRNAMES = le be fpu soft
|
||||
MULTILIB_MATCHES =
|
||||
EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
||||
|
||||
# Currently there is a bug somwehere in GCC's alias analysis
|
||||
# or scheduling code that is breaking _fpmul_parts in fp-bit.c.
|
||||
# Disabling function inlining is a workaround for this problem.
|
||||
TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc -fno-inline
|
@ -1,29 +0,0 @@
|
||||
/* Definitions for non-Linux based ARM systems using ELF old abi
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
Contributed by Catherine Moore <clm@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 this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Run-time Target Specification. */
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fputs (" (ARM/ELF non-Linux old abi)", stderr);
|
||||
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC "-moabi %{mbig-endian:-EB} %{mcpu=*:-mcpu=%*} %{march=*:-march=%*} \
|
||||
%{mapcs-*:-mapcs-%*} %{mthumb-interwork:-mthumb-interwork}"
|
||||
|
@ -1,71 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler,
|
||||
for ARM with targetting the VXWorks run time environment.
|
||||
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Contributed by: Mike Stump <mrs@wrs.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. */
|
||||
|
||||
#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm710
|
||||
|
||||
#undef SUBTARGET_CPP_SPEC
|
||||
#define SUBTARGET_CPP_SPEC \
|
||||
"%{march=arm710:-DCPU=ARM710A} \
|
||||
%{march=arm7tdmi:-DCPU=ARM7TDMI} \
|
||||
%{march=arm810:-DCPU=ARM810} \
|
||||
%{march=strongarm110:-DCPU=ARMSA110} \
|
||||
%{!march=*: \
|
||||
%{mcpu=arm710:-DCPU=ARM710A} \
|
||||
%{mcpu=arm7tdmi:-DCPU=ARM7TDMI} \
|
||||
%{mcpu=arm810:-DCPU=ARM810} \
|
||||
%{mcpu=strongarm110:-DCPU=ARMSA110}} \
|
||||
%{!mcpu*:%{!march=*:-DCPU=ARM710A}} \
|
||||
"
|
||||
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do { \
|
||||
builtin_define ("__vxworks"); \
|
||||
} while (0)
|
||||
|
||||
/* VxWorks does all the library stuff itself. */
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC ""
|
||||
|
||||
/* VxWorks uses object files, not loadable images. make linker just
|
||||
combine objects. */
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "-r"
|
||||
|
||||
/* VxWorks provides the functionality of crt0.o and friends itself. */
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC ""
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fputs (" (ARM/VxWorks)", stderr);
|
||||
|
||||
#undef ASM_FILE_START
|
||||
#define ASM_FILE_START(STREAM) \
|
||||
do \
|
||||
{ \
|
||||
fprintf (STREAM, "%s Generated by gcc %s for ARM/VxWorks\n", \
|
||||
ASM_COMMENT_START, version_string); \
|
||||
} \
|
||||
while (0)
|
@ -1,22 +0,0 @@
|
||||
/* FreeBSD version number setting for FreeBSD 3.x systems.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
|
||||
|
||||
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 FBSD_MAJOR 3
|
@ -1,22 +0,0 @@
|
||||
/* FreeBSD version number setting for FreeBSD 4.x systems.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
|
||||
|
||||
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 FBSD_MAJOR 4
|
@ -1,22 +0,0 @@
|
||||
/* FreeBSD version number setting for FreeBSD 5.x systems.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
|
||||
|
||||
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 FBSD_MAJOR 5
|
@ -1,22 +0,0 @@
|
||||
/* FreeBSD version number setting for FreeBSD 6.x systems.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
|
||||
|
||||
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 FBSD_MAJOR 6
|
@ -1,257 +0,0 @@
|
||||
/* Definitions for Intel 386 running FreeBSD with ELF format
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
Contributed by Eric Youngdale.
|
||||
Modified for stabs-in-ELF by H.J. Lu.
|
||||
Adapted from GNU/Linux version by John Polstra.
|
||||
Continued development by David O'Brien <obrien@freebsd.org>
|
||||
|
||||
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. */
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)");
|
||||
|
||||
/* The svr4 ABI for the i386 says that records and unions are returned
|
||||
in memory. */
|
||||
/* On FreeBSD, we do not. */
|
||||
#undef DEFAULT_PCC_STRUCT_RETURN
|
||||
#define DEFAULT_PCC_STRUCT_RETURN 0
|
||||
|
||||
/* This gets defined in tm.h->linux.h->svr4.h, and keeps us from using
|
||||
libraries compiled with the native cc, so undef it. */
|
||||
#undef NO_DOLLAR_IN_LABEL
|
||||
|
||||
/* Use more efficient ``thunks'' to implement C++ vtables. */
|
||||
#undef DEFAULT_VTABLE_THUNKS
|
||||
#define DEFAULT_VTABLE_THUNKS 1
|
||||
|
||||
/* Override the default comment-starter of "/". */
|
||||
#undef ASM_COMMENT_START
|
||||
#define ASM_COMMENT_START "#"
|
||||
|
||||
#undef ASM_APP_ON
|
||||
#define ASM_APP_ON "#APP\n"
|
||||
|
||||
#undef ASM_APP_OFF
|
||||
#define ASM_APP_OFF "#NO_APP\n"
|
||||
|
||||
#undef SET_ASM_OP
|
||||
#define SET_ASM_OP ".set"
|
||||
|
||||
/* This is how to output an element of a case-vector that is relative.
|
||||
This is only used for PIC code. See comments by the `casesi' insn in
|
||||
i386.md for an explanation of the expression this outputs. */
|
||||
#undef ASM_OUTPUT_ADDR_DIFF_ELT
|
||||
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
|
||||
fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
|
||||
|
||||
/* Indicate that jump tables go in the text section. This is
|
||||
necessary when compiling PIC code. */
|
||||
#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
|
||||
|
||||
/* Use stabs instead of DWARF debug format. */
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
|
||||
/* Copy this from the svr4 specifications... */
|
||||
/* Define the register numbers to be used in Dwarf debugging information.
|
||||
The SVR4 reference port C compiler uses the following register numbers
|
||||
in its Dwarf output code:
|
||||
0 for %eax (gnu regno = 0)
|
||||
1 for %ecx (gnu regno = 2)
|
||||
2 for %edx (gnu regno = 1)
|
||||
3 for %ebx (gnu regno = 3)
|
||||
4 for %esp (gnu regno = 7)
|
||||
5 for %ebp (gnu regno = 6)
|
||||
6 for %esi (gnu regno = 4)
|
||||
7 for %edi (gnu regno = 5)
|
||||
The following three DWARF register numbers are never generated by
|
||||
the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4
|
||||
believes these numbers have these meanings.
|
||||
8 for %eip (no gnu equivalent)
|
||||
9 for %eflags (no gnu equivalent)
|
||||
10 for %trapno (no gnu equivalent)
|
||||
It is not at all clear how we should number the FP stack registers
|
||||
for the x86 architecture. If the version of SDB on x86/svr4 were
|
||||
a bit less brain dead with respect to floating-point then we would
|
||||
have a precedent to follow with respect to DWARF register numbers
|
||||
for x86 FP registers, but the SDB on x86/svr4 is so completely
|
||||
broken with respect to FP registers that it is hardly worth thinking
|
||||
of it as something to strive for compatibility with.
|
||||
The version of x86/svr4 SDB I have at the moment does (partially)
|
||||
seem to believe that DWARF register number 11 is associated with
|
||||
the x86 register %st(0), but that's about all. Higher DWARF
|
||||
register numbers don't seem to be associated with anything in
|
||||
particular, and even for DWARF regno 11, SDB only seems to under-
|
||||
stand that it should say that a variable lives in %st(0) (when
|
||||
asked via an `=' command) if we said it was in DWARF regno 11,
|
||||
but SDB still prints garbage when asked for the value of the
|
||||
variable in question (via a `/' command).
|
||||
(Also note that the labels SDB prints for various FP stack regs
|
||||
when doing an `x' command are all wrong.)
|
||||
Note that these problems generally don't affect the native SVR4
|
||||
C compiler because it doesn't allow the use of -O with -g and
|
||||
because when it is *not* optimizing, it allocates a memory
|
||||
location for each floating-point variable, and the memory
|
||||
location is what gets described in the DWARF AT_location
|
||||
attribute for the variable in question.
|
||||
Regardless of the severe mental illness of the x86/svr4 SDB, we
|
||||
do something sensible here and we use the following DWARF
|
||||
register numbers. Note that these are all stack-top-relative
|
||||
numbers.
|
||||
11 for %st(0) (gnu regno = 8)
|
||||
12 for %st(1) (gnu regno = 9)
|
||||
13 for %st(2) (gnu regno = 10)
|
||||
14 for %st(3) (gnu regno = 11)
|
||||
15 for %st(4) (gnu regno = 12)
|
||||
16 for %st(5) (gnu regno = 13)
|
||||
17 for %st(6) (gnu regno = 14)
|
||||
18 for %st(7) (gnu regno = 15)
|
||||
*/
|
||||
#undef DBX_REGISTER_NUMBER
|
||||
#define DBX_REGISTER_NUMBER(n) \
|
||||
((n) == 0 ? 0 \
|
||||
: (n) == 1 ? 2 \
|
||||
: (n) == 2 ? 1 \
|
||||
: (n) == 3 ? 3 \
|
||||
: (n) == 4 ? 6 \
|
||||
: (n) == 5 ? 7 \
|
||||
: (n) == 6 ? 5 \
|
||||
: (n) == 7 ? 4 \
|
||||
: ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
|
||||
: (-1))
|
||||
|
||||
/* Tell final.c that we don't need a label passed to mcount. */
|
||||
|
||||
#undef FUNCTION_PROFILER
|
||||
#define FUNCTION_PROFILER(FILE, LABELNO) \
|
||||
{ \
|
||||
if (flag_pic) \
|
||||
fprintf (FILE, "\tcall *.mcount@GOT(%%ebx)\n"); \
|
||||
else \
|
||||
fprintf (FILE, "\tcall .mcount\n"); \
|
||||
}
|
||||
|
||||
#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 BITS_PER_WORD
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Di386 -Dunix -D__ELF__ -D__FreeBSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
|
||||
|
||||
/* This defines which switch letters take arguments. On FreeBSD, most of
|
||||
the normal cases (defined in gcc.c) apply, and we also have -h* and
|
||||
-z* options (for the linker) (comming from svr4).
|
||||
We also have -R (alias --rpath), no -z, --soname (-h), --assert etc. */
|
||||
|
||||
#undef SWITCH_TAKES_ARG
|
||||
#define SWITCH_TAKES_ARG(CHAR) \
|
||||
(DEFAULT_SWITCH_TAKES_ARG (CHAR) \
|
||||
|| (CHAR) == 'h' \
|
||||
|| (CHAR) == 'z' \
|
||||
|| (CHAR) == 'R')
|
||||
|
||||
/* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add
|
||||
the 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:%{profile:gcrt1.o%s} \
|
||||
%{!profile:crt1.o%s}}}} \
|
||||
crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
|
||||
|
||||
/* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on
|
||||
the 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 "finalizer" file,
|
||||
`crtn.o'. */
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC \
|
||||
"%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
|
||||
|
||||
/* Provide a LIB_SPEC appropriate for FreeBSD. Just select the appropriate
|
||||
libc, depending on whether we're doing profiling or need threads support.
|
||||
(simular to the default, except no -lg, and no -p. */
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC "%{!shared: \
|
||||
%{!pg:%{!pthread:%{!kthread:-lc} \
|
||||
%{kthread:-lpthread -lc}} \
|
||||
%{pthread:-lc_r}} \
|
||||
%{pg:%{!pthread:%{!kthread:-lc_p} \
|
||||
%{kthread:-lpthread_p -lc_p}} \
|
||||
%{pthread:-lc_r_p}}}"
|
||||
|
||||
/* Provide a LINK_SPEC appropriate for FreeBSD. 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. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "-m elf_i386 \
|
||||
%{Wl,*:%*} \
|
||||
%{v:-V} \
|
||||
%{assert*} %{R*} %{rpath*} %{defsym*} \
|
||||
%{shared:-Bshareable %{h*} %{soname*}} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
%{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}} \
|
||||
%{static:-Bstatic}} \
|
||||
%{symbolic:-Bsymbolic}"
|
||||
|
||||
/* A C statement to output to the stdio stream FILE an assembler
|
||||
command to advance the location counter to a multiple of 1<<LOG
|
||||
bytes if it is within MAX_SKIP bytes.
|
||||
|
||||
This is used to align code labels according to Intel recommendations. */
|
||||
|
||||
#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
|
||||
#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
|
||||
if ((LOG) != 0) {\
|
||||
if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
|
||||
else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
|
||||
}
|
||||
#endif
|
@ -1,257 +0,0 @@
|
||||
/* Definitions for Intel 386 running FreeBSD with ELF format
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
Contributed by Eric Youngdale.
|
||||
Modified for stabs-in-ELF by H.J. Lu.
|
||||
Adapted from GNU/Linux version by John Polstra.
|
||||
Continued development by David O'Brien <obrien@freebsd.org>
|
||||
|
||||
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. */
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)");
|
||||
|
||||
/* The svr4 ABI for the i386 says that records and unions are returned
|
||||
in memory. */
|
||||
/* On FreeBSD, we do not. */
|
||||
#undef DEFAULT_PCC_STRUCT_RETURN
|
||||
#define DEFAULT_PCC_STRUCT_RETURN 0
|
||||
|
||||
/* This gets defined in tm.h->linux.h->svr4.h, and keeps us from using
|
||||
libraries compiled with the native cc, so undef it. */
|
||||
#undef NO_DOLLAR_IN_LABEL
|
||||
|
||||
/* Use more efficient ``thunks'' to implement C++ vtables. */
|
||||
#undef DEFAULT_VTABLE_THUNKS
|
||||
#define DEFAULT_VTABLE_THUNKS 1
|
||||
|
||||
/* Override the default comment-starter of "/". */
|
||||
#undef ASM_COMMENT_START
|
||||
#define ASM_COMMENT_START "#"
|
||||
|
||||
#undef ASM_APP_ON
|
||||
#define ASM_APP_ON "#APP\n"
|
||||
|
||||
#undef ASM_APP_OFF
|
||||
#define ASM_APP_OFF "#NO_APP\n"
|
||||
|
||||
#undef SET_ASM_OP
|
||||
#define SET_ASM_OP ".set"
|
||||
|
||||
/* This is how to output an element of a case-vector that is relative.
|
||||
This is only used for PIC code. See comments by the `casesi' insn in
|
||||
i386.md for an explanation of the expression this outputs. */
|
||||
#undef ASM_OUTPUT_ADDR_DIFF_ELT
|
||||
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
|
||||
fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
|
||||
|
||||
/* Indicate that jump tables go in the text section. This is
|
||||
necessary when compiling PIC code. */
|
||||
#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
|
||||
|
||||
/* Use stabs instead of DWARF debug format. */
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
|
||||
/* Copy this from the svr4 specifications... */
|
||||
/* Define the register numbers to be used in Dwarf debugging information.
|
||||
The SVR4 reference port C compiler uses the following register numbers
|
||||
in its Dwarf output code:
|
||||
0 for %eax (gnu regno = 0)
|
||||
1 for %ecx (gnu regno = 2)
|
||||
2 for %edx (gnu regno = 1)
|
||||
3 for %ebx (gnu regno = 3)
|
||||
4 for %esp (gnu regno = 7)
|
||||
5 for %ebp (gnu regno = 6)
|
||||
6 for %esi (gnu regno = 4)
|
||||
7 for %edi (gnu regno = 5)
|
||||
The following three DWARF register numbers are never generated by
|
||||
the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4
|
||||
believes these numbers have these meanings.
|
||||
8 for %eip (no gnu equivalent)
|
||||
9 for %eflags (no gnu equivalent)
|
||||
10 for %trapno (no gnu equivalent)
|
||||
It is not at all clear how we should number the FP stack registers
|
||||
for the x86 architecture. If the version of SDB on x86/svr4 were
|
||||
a bit less brain dead with respect to floating-point then we would
|
||||
have a precedent to follow with respect to DWARF register numbers
|
||||
for x86 FP registers, but the SDB on x86/svr4 is so completely
|
||||
broken with respect to FP registers that it is hardly worth thinking
|
||||
of it as something to strive for compatibility with.
|
||||
The version of x86/svr4 SDB I have at the moment does (partially)
|
||||
seem to believe that DWARF register number 11 is associated with
|
||||
the x86 register %st(0), but that's about all. Higher DWARF
|
||||
register numbers don't seem to be associated with anything in
|
||||
particular, and even for DWARF regno 11, SDB only seems to under-
|
||||
stand that it should say that a variable lives in %st(0) (when
|
||||
asked via an `=' command) if we said it was in DWARF regno 11,
|
||||
but SDB still prints garbage when asked for the value of the
|
||||
variable in question (via a `/' command).
|
||||
(Also note that the labels SDB prints for various FP stack regs
|
||||
when doing an `x' command are all wrong.)
|
||||
Note that these problems generally don't affect the native SVR4
|
||||
C compiler because it doesn't allow the use of -O with -g and
|
||||
because when it is *not* optimizing, it allocates a memory
|
||||
location for each floating-point variable, and the memory
|
||||
location is what gets described in the DWARF AT_location
|
||||
attribute for the variable in question.
|
||||
Regardless of the severe mental illness of the x86/svr4 SDB, we
|
||||
do something sensible here and we use the following DWARF
|
||||
register numbers. Note that these are all stack-top-relative
|
||||
numbers.
|
||||
11 for %st(0) (gnu regno = 8)
|
||||
12 for %st(1) (gnu regno = 9)
|
||||
13 for %st(2) (gnu regno = 10)
|
||||
14 for %st(3) (gnu regno = 11)
|
||||
15 for %st(4) (gnu regno = 12)
|
||||
16 for %st(5) (gnu regno = 13)
|
||||
17 for %st(6) (gnu regno = 14)
|
||||
18 for %st(7) (gnu regno = 15)
|
||||
*/
|
||||
#undef DBX_REGISTER_NUMBER
|
||||
#define DBX_REGISTER_NUMBER(n) \
|
||||
((n) == 0 ? 0 \
|
||||
: (n) == 1 ? 2 \
|
||||
: (n) == 2 ? 1 \
|
||||
: (n) == 3 ? 3 \
|
||||
: (n) == 4 ? 6 \
|
||||
: (n) == 5 ? 7 \
|
||||
: (n) == 6 ? 5 \
|
||||
: (n) == 7 ? 4 \
|
||||
: ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
|
||||
: (-1))
|
||||
|
||||
/* Tell final.c that we don't need a label passed to mcount. */
|
||||
|
||||
#undef FUNCTION_PROFILER
|
||||
#define FUNCTION_PROFILER(FILE, LABELNO) \
|
||||
{ \
|
||||
if (flag_pic) \
|
||||
fprintf (FILE, "\tcall *.mcount@GOT(%%ebx)\n"); \
|
||||
else \
|
||||
fprintf (FILE, "\tcall .mcount\n"); \
|
||||
}
|
||||
|
||||
#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 BITS_PER_WORD
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Di386 -Dunix -D__ELF__ -D__FreeBSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
|
||||
|
||||
/* This defines which switch letters take arguments. On FreeBSD, most of
|
||||
the normal cases (defined in gcc.c) apply, and we also have -h* and
|
||||
-z* options (for the linker) (comming from svr4).
|
||||
We also have -R (alias --rpath), no -z, --soname (-h), --assert etc. */
|
||||
|
||||
#undef SWITCH_TAKES_ARG
|
||||
#define SWITCH_TAKES_ARG(CHAR) \
|
||||
(DEFAULT_SWITCH_TAKES_ARG (CHAR) \
|
||||
|| (CHAR) == 'h' \
|
||||
|| (CHAR) == 'z' \
|
||||
|| (CHAR) == 'R')
|
||||
|
||||
/* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add
|
||||
the 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:%{profile:gcrt1.o%s} \
|
||||
%{!profile:crt1.o%s}}}} \
|
||||
crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
|
||||
|
||||
/* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on
|
||||
the 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 "finalizer" file,
|
||||
`crtn.o'. */
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC \
|
||||
"%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
|
||||
|
||||
/* Provide a LIB_SPEC appropriate for FreeBSD. Just select the appropriate
|
||||
libc, depending on whether we're doing profiling or need threads support.
|
||||
(simular to the default, except no -lg, and no -p. */
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC "%{!shared: \
|
||||
%{!pg:%{!pthread:%{!kthread:-lc} \
|
||||
%{kthread:-lpthread -lc}} \
|
||||
%{pthread:-lc_r}} \
|
||||
%{pg:%{!pthread:%{!kthread:-lc_p} \
|
||||
%{kthread:-lpthread_p -lc_p}} \
|
||||
%{pthread:-lc_r_p}}}"
|
||||
|
||||
/* Provide a LINK_SPEC appropriate for FreeBSD. 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. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "-m elf_i386 \
|
||||
%{Wl,*:%*} \
|
||||
%{v:-V} \
|
||||
%{assert*} %{R*} %{rpath*} %{defsym*} \
|
||||
%{shared:-Bshareable %{h*} %{soname*}} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
%{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}} \
|
||||
%{static:-Bstatic}} \
|
||||
%{symbolic:-Bsymbolic}"
|
||||
|
||||
/* A C statement to output to the stdio stream FILE an assembler
|
||||
command to advance the location counter to a multiple of 1<<LOG
|
||||
bytes if it is within MAX_SKIP bytes.
|
||||
|
||||
This is used to align code labels according to Intel recommendations. */
|
||||
|
||||
#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
|
||||
#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
|
||||
if ((LOG) != 0) {\
|
||||
if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
|
||||
else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
|
||||
}
|
||||
#endif
|
@ -1,66 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler. VxWorks i386 version.
|
||||
Copyright (C) 1998, 2002 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. */
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (80386, VxWorks BSD syntax)");
|
||||
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("__vxworks"); \
|
||||
builtin_assert ("system=unix"); \
|
||||
\
|
||||
if (TARGET_386) \
|
||||
builtin_define ("CPU=I80386"); \
|
||||
else if (TARGET_486) \
|
||||
builtin_define ("CPU=I80486"); \
|
||||
else if (TARGET_PENTIUM) \
|
||||
{ \
|
||||
builtin_define ("CPU=PENTIUM"); \
|
||||
builtin_define ("CPU_VARIANT=PENTIUM"); \
|
||||
} \
|
||||
else if (TARGET_PENTIUMPRO) \
|
||||
{ \
|
||||
builtin_define ("CPU=PENTIUM"); \
|
||||
builtin_define ("CPU_VARIANT=PENTIUMPRO"); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define HANDLE_SYSV_PRAGMA 1
|
||||
|
||||
/* VxWorks does all the library stuff itself. */
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC ""
|
||||
|
||||
/* VxWorks uses object files, not loadable images. make linker just
|
||||
combine objects. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "-r"
|
||||
|
||||
/* VxWorks provides the functionality of crt0.o and friends itself. */
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC ""
|
@ -1,173 +0,0 @@
|
||||
/* Operating system specific defines to be used when targeting GCC for
|
||||
hosting on Windows NT 3.x, using a Unix style C library and tools,
|
||||
as distinct from winnt.h, which is used to build GCC for use with a
|
||||
windows style library and tool set and uses the Microsoft tools.
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2002
|
||||
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. */
|
||||
|
||||
/* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop). */
|
||||
#define HANDLE_PRAGMA_PACK_PUSH_POP 1
|
||||
|
||||
#define DBX_DEBUGGING_INFO 1
|
||||
#define SDB_DEBUGGING_INFO 1
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
|
||||
#include "i386/unix.h"
|
||||
#include "i386/bsd.h"
|
||||
#include "i386/gas.h"
|
||||
#include "dbxcoff.h"
|
||||
|
||||
/* Augment TARGET_SWITCHES with the cygwin/win32 options. */
|
||||
#define MASK_WIN32 0x40000000 /* Use -lming32 interface */
|
||||
#define MASK_CYGWIN 0x20000000 /* Use -lcygwin interface */
|
||||
#define MASK_WINDOWS 0x10000000 /* Use windows interface */
|
||||
#define MASK_DLL 0x08000000 /* Use dll interface */
|
||||
#define MASK_NOP_FUN_DLLIMPORT 0x20000 /* Ignore dllimport for functions */
|
||||
|
||||
#define TARGET_WIN32 (target_flags & MASK_WIN32)
|
||||
#define TARGET_CYGWIN (target_flags & MASK_CYGWIN)
|
||||
#define TARGET_WINDOWS (target_flags & MASK_WINDOWS)
|
||||
#define TARGET_DLL (target_flags & MASK_DLL)
|
||||
#define TARGET_NOP_FUN_DLLIMPORT (target_flags & MASK_NOP_FUN_DLLIMPORT)
|
||||
|
||||
#undef SUBTARGET_SWITCHES
|
||||
#define SUBTARGET_SWITCHES \
|
||||
{ "win32", MASK_WIN32, \
|
||||
N_("Use Mingw32 interface") }, \
|
||||
{ "cygwin", MASK_CYGWIN, \
|
||||
N_("Use Cygwin interface") }, \
|
||||
{ "windows", MASK_WINDOWS, \
|
||||
N_("Use bare Windows interface") }, \
|
||||
{ "dll", MASK_DLL, \
|
||||
N_("Generate code for a DLL") }, \
|
||||
{ "nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT, \
|
||||
N_("Ignore dllimport for functions") }, \
|
||||
{ "no-nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT, "" },
|
||||
|
||||
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("_WIN32"); \
|
||||
builtin_define_std ("WINNT"); \
|
||||
builtin_define ("_X86_"); \
|
||||
builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
|
||||
builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
|
||||
builtin_assert ("system=winnt"); \
|
||||
if (TARGET_CYGWIN) \
|
||||
{ \
|
||||
builtin_define ("__CYGWIN32__"); \
|
||||
builtin_define ("__CYGWIN__"); \
|
||||
} \
|
||||
else \
|
||||
builtin_define ("__MINGW32__"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
|
||||
#define STARTFILE_SPEC "%{mdll:dllcrt0%O%s} %{!mdll: %{!mcygwin:mcrt0%O%s} \
|
||||
%{mcygwin:crt0%O%s} %{pg:gcrt0%O%s}}"
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} \
|
||||
%{!mcygwin:-iwithprefixbefore include/mingw32}"
|
||||
|
||||
/* We have to dynamic link to get to the system DLLs. All of libc, libm and
|
||||
the Unix stuff is in cygwin.dll. The import library is called
|
||||
'libcygwin.a'. For Windows applications, include more libraries, but
|
||||
always include kernel32. We'd like to specific subsystem windows to
|
||||
ld, but that doesn't work just yet. */
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC "%{pg:-lgmon} \
|
||||
%{!mcygwin:-lmingw32 -lmoldname -lmsvcrt -lcrtdll} \
|
||||
%{mcygwin:-lcygwin} %{mwindows:-luser32 -lgdi32 -lcomdlg32} \
|
||||
-lkernel32 -ladvapi32 -lshell32"
|
||||
|
||||
#define LINK_SPEC "%{mwindows:--subsystem windows} \
|
||||
%{mdll:--dll -e _DllMainCRTStartup@12}"
|
||||
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
#define PTRDIFF_TYPE "int"
|
||||
#define WCHAR_TYPE_SIZE 16
|
||||
#define WCHAR_TYPE "short unsigned int"
|
||||
/* Currently we do not have the atexit() function,
|
||||
so take that from libgcc2.c */
|
||||
|
||||
#define NEED_ATEXIT 1
|
||||
|
||||
#undef TARGET_ENCODE_SECTION_INFO
|
||||
#define TARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info
|
||||
#undef TARGET_STRIP_NAME_ENCODING
|
||||
#define TARGET_STRIP_NAME_ENCODING i386_pe_strip_name_encoding_full
|
||||
|
||||
/* Emit code to check the stack when allocating more that 4000
|
||||
bytes in one go. */
|
||||
|
||||
#define CHECK_STACK_LIMIT 4000
|
||||
|
||||
/* By default, target has a 80387, uses IEEE compatible arithmetic,
|
||||
and returns float values in the 387 and needs stack probes */
|
||||
#undef TARGET_SUBTARGET_DEFAULT
|
||||
|
||||
#define TARGET_SUBTARGET_DEFAULT \
|
||||
(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE)
|
||||
|
||||
/* 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.align %d\n", 1<<(LOG))
|
||||
|
||||
/* Define this macro if in some cases global symbols from one translation
|
||||
unit may not be bound to undefined symbols in another translation unit
|
||||
without user intervention. For instance, under Microsoft Windows
|
||||
symbols must be explicitly imported from shared libraries (DLLs). */
|
||||
#define MULTIPLE_SYMBOL_SPACES
|
||||
|
||||
extern void i386_pe_unique_section PARAMS ((tree, int));
|
||||
#define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
|
||||
|
||||
#define SUPPORTS_ONE_ONLY 1
|
||||
|
||||
/* Switch into a generic section. */
|
||||
#define TARGET_ASM_NAMED_SECTION i386_pe_asm_named_section
|
||||
|
||||
/* Select attributes for named sections. */
|
||||
#define TARGET_SECTION_TYPE_FLAGS i386_pe_section_type_flags
|
||||
|
||||
#undef ASM_COMMENT_START
|
||||
#define ASM_COMMENT_START " #"
|
||||
|
||||
/* Don't assume anything about the header files. */
|
||||
#define NO_IMPLICIT_EXTERN_C
|
||||
|
||||
#define SUBTARGET_PROLOGUE \
|
||||
if (current_function_profile \
|
||||
&& MAIN_NAME_P (DECL_NAME (current_function_decl)) \
|
||||
{ \
|
||||
rtx xops[1]; \
|
||||
xops[0] = gen_rtx_MEM (FUNCTION_MODE, \
|
||||
gen_rtx (SYMBOL_REF, Pmode, "_monstartup")); \
|
||||
emit_call_insn (gen_rtx (CALL, VOIDmode, xops[0], const0_rtx)); \
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
# Don't run fixproto
|
||||
STMP_FIXPROTO =
|
||||
CLIB=-lgnumalloc
|
@ -1,32 +0,0 @@
|
||||
/* Configuration for GNU compiler
|
||||
for an Intel i386 or later processor running Interix.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Contributed by Donn Terry (donn@interix.com)
|
||||
Derived from code by Douglas B. Rupp (drupp@cs.washington.edu)
|
||||
|
||||
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 HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG
|
||||
#ifdef __GNUC__
|
||||
# define HOST_WIDEST_INT long long
|
||||
#else
|
||||
# define HOST_WIDEST_INT __int64
|
||||
#endif
|
||||
#define HOST_WIDEST_INT_PRINT_DEC "%lld"
|
||||
#define HOST_WIDEST_INT_PRINT_UNSIGNED "%llu"
|
||||
#define HOST_WIDEST_INT_PRINT_HEX "0x%llx"
|
@ -1,11 +0,0 @@
|
||||
/* Use semicolons to separate elements of a path. */
|
||||
#define PATH_SEPARATOR ';'
|
||||
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define_std ("unix"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
|
@ -1,159 +0,0 @@
|
||||
/* Definitions of target machine GNU compiler. IA-64/AIX version.
|
||||
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
Contributed by Timothy Wall (twall@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. */
|
||||
|
||||
/* AIX5 (aka Monterey): a mix of AIX and UnixWare.
|
||||
This file is loosely based on ia64/linux.h. */
|
||||
|
||||
/* This macro is a C statement to print on `stderr' a string describing the
|
||||
particular machine description choice. */
|
||||
|
||||
#define TARGET_VERSION fprintf (stderr, " (IA-64) AIX");
|
||||
|
||||
#undef ASM_APP_ON
|
||||
#define ASM_APP_ON "#APP\n"
|
||||
|
||||
#undef ASM_APP_OFF
|
||||
#define ASM_APP_OFF "#NO_APP\n"
|
||||
|
||||
#define SET_ASM_OP "\t.set\t"
|
||||
|
||||
#undef MD_EXEC_PREFIX
|
||||
#undef MD_STARTFILE_PREFIX
|
||||
#define MD_STARTFILE_PREFIX "/usr/lib/ia64l64/"
|
||||
|
||||
/* 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 AIX. Here we add
|
||||
the crti C++ startup files file which provide part of the support
|
||||
for getting C++ file-scope static object constructed before entering
|
||||
`main'. */
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC \
|
||||
"%{!shared: \
|
||||
%{pg:gcrt1_64.o%s} %{!pg:%{p:mcrt1_64.o%s} \
|
||||
%{!p:%{profile:gcrt1_64.o%s} \
|
||||
%{!profile:crt1_64.o%s}}}} \
|
||||
crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
|
||||
|
||||
/* Provide a ENDFILE_SPEC appropriate for AIX. Here we tack on
|
||||
the crtn file which provides termination of the support for getting C++
|
||||
file-scope static object constructed before entering `main'. */
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
|
||||
|
||||
/* Define this so we can compile MS code for use with WINE. */
|
||||
#define HANDLE_PRAGMA_PACK_PUSH_POP
|
||||
|
||||
/* Target OS builtins. */
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do { \
|
||||
if (flag_iso) \
|
||||
builtin_define("_ANSI_C_SOURCE"); \
|
||||
builtin_define("_AIX"); \
|
||||
builtin_define("_AIX64"); \
|
||||
builtin_define("unix"); \
|
||||
builtin_assert("system=unix"); \
|
||||
builtin_assert("system=aix"); \
|
||||
builtin_define("__64BIT__"); \
|
||||
builtin_define("_LONG_LONG"); \
|
||||
builtin_define("_IA64"); \
|
||||
builtin_define("__int128=__size128_t"); \
|
||||
if (c_language == clk_cplusplus) \
|
||||
{ \
|
||||
builtin_define("_XOPEN_SOURCE=500"); \
|
||||
builtin_define("_XOPEN_SOURCE_EXTENDED=1"); \
|
||||
builtin_define("_LARGE_FILE_API"); \
|
||||
builtin_define("_ALL_SOURCE"); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* A C string constant that tells the GNU CC driver program options to pass to
|
||||
CPP. It can also specify how to translate options you give to GNU CC into
|
||||
options for GNU CC to pass to the CPP. */
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "\
|
||||
%{posix:-D_POSIX_SOURCE}"
|
||||
|
||||
/* Define this for shared library support. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "\
|
||||
%{shared:-shared} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
%{!dynamic-linker:-dynamic-linker /usr/lib/ia64l64/libc.so.1}} \
|
||||
%{static:-static}}"
|
||||
|
||||
#define JMP_BUF_SIZE 85
|
||||
|
||||
/* A C statement or compound statement to output to FILE some assembler code to
|
||||
call the profiling subroutine `mcount'.
|
||||
|
||||
FIXME this is not supported until xlC supports it and can thus tell us
|
||||
how to do it.
|
||||
*/
|
||||
|
||||
#undef FUNCTION_PROFILER
|
||||
#define FUNCTION_PROFILER(FILE, LABELNO) \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
/* Tell the linker where to find the crt*.o files. */
|
||||
|
||||
#ifndef CROSS_COMPILE
|
||||
#undef STANDARD_STARTFILE_PREFIX
|
||||
#define STANDARD_STARTFILE_PREFIX "/usr/lib/ia64l64/"
|
||||
#endif
|
||||
|
||||
/* It is illegal to have relocations in shared segments on AIX.
|
||||
Pretend flag_pic is always set. */
|
||||
#undef TARGET_ASM_SELECT_SECTION
|
||||
#define TARGET_ASM_SELECT_SECTION ia64_rwreloc_select_section
|
||||
#undef TARGET_ASM_UNIQUE_SECTION
|
||||
#define TARGET_ASM_UNIQUE_SECTION ia64_rwreloc_unique_section
|
||||
#undef TARGET_ASM_SELECT_RTX_SECTION
|
||||
#define TARGET_ASM_SELECT_RTX_SECTION ia64_rwreloc_select_rtx_section
|
||||
|
||||
/* Override ia64/sysv4.h setting with that used by AIX5. */
|
||||
#undef WCHAR_TYPE
|
||||
#ifdef __64BIT__
|
||||
#define WCHAR_TYPE "unsigned int"
|
||||
#else
|
||||
#define WCHAR_TYPE "unsigned short"
|
||||
#endif
|
||||
|
||||
/* Define the `__builtin_va_list' type for AIX. Use char* b/c that's what the
|
||||
system headers expect. */
|
||||
#define BUILD_VA_LIST_TYPE(VALIST) \
|
||||
(VALIST) = build_pointer_type(char_type_node)
|
||||
|
||||
/* End of aix.h */
|
@ -1,99 +0,0 @@
|
||||
/* Definitions of long double support for GNU compiler.
|
||||
Copyright (C) 2000, 2001 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. */
|
||||
|
||||
/* We are using IEEE quad precision, not a double-extended with padding. */
|
||||
#undef INTEL_EXTENDED_IEEE_FORMAT
|
||||
#define INTEL_EXTENDED_IEEE_FORMAT 0
|
||||
|
||||
/* Define library calls for quad FP operations. These are all part of the
|
||||
IA32 and IA64 ABIs. */
|
||||
|
||||
#define ADDTF3_LIBCALL "_U_Qfadd"
|
||||
#define SUBTF3_LIBCALL "_U_Qfsub"
|
||||
#define MULTF3_LIBCALL "_U_Qfmpy"
|
||||
#define DIVTF3_LIBCALL "_U_Qfdiv"
|
||||
#define NEGTF2_LIBCALL "_U_Qfneg"
|
||||
#define ABSTF2_LIBCALL "_U_Qfabs"
|
||||
#define SMINTF3_LIBCALL "_U_Qfmin"
|
||||
#define SMAXTF3_LIBCALL "_U_Qfmax"
|
||||
#define EXTENDSFTF2_LIBCALL "_U_Qfcnvff_sgl_to_quad"
|
||||
#define EXTENDDFTF2_LIBCALL "_U_Qfcnvff_dbl_to_quad"
|
||||
#define TRUNCTFSF2_LIBCALL "_U_Qfcnvff_quad_to_sgl"
|
||||
#define TRUNCTFDF2_LIBCALL "_U_Qfcnvff_quad_to_dbl"
|
||||
#define FLOATSITF2_LIBCALL "_U_Qfcnvxf_sgl_to_quad"
|
||||
#define FLOATDITF2_LIBCALL "_U_Qfcnvxf_dbl_to_quad"
|
||||
#define FIX_TRUNCTFSI2_LIBCALL "_U_Qfcnvfxt_quad_to_sgl"
|
||||
#define FIX_TRUNCTFDI2_LIBCALL "_U_Qfcnvfxt_quad_to_dbl"
|
||||
#define FIXUNS_TRUNCTFSI2_LIBCALL "_U_Qfcnvfxut_quad_to_sgl"
|
||||
#define FIXUNS_TRUNCTFDI2_LIBCALL "_U_Qfcnvfxut_quad_to_dbl"
|
||||
#define EQTF2_LIBCALL "_U_Qfeq"
|
||||
#define NETF2_LIBCALL "_U_Qfne"
|
||||
#define GTTF2_LIBCALL "_U_Qfgt"
|
||||
#define GETF2_LIBCALL "_U_Qfge"
|
||||
#define LTTF2_LIBCALL "_U_Qflt"
|
||||
#define LETF2_LIBCALL "_U_Qfle"
|
||||
|
||||
|
||||
#undef INIT_TARGET_OPTABS
|
||||
#define INIT_TARGET_OPTABS \
|
||||
do { \
|
||||
add_optab->handlers[(int) TFmode].libfunc \
|
||||
= gen_rtx_SYMBOL_REF (Pmode, ADDTF3_LIBCALL); \
|
||||
sub_optab->handlers[(int) TFmode].libfunc \
|
||||
= gen_rtx_SYMBOL_REF (Pmode, SUBTF3_LIBCALL); \
|
||||
smul_optab->handlers[(int) TFmode].libfunc \
|
||||
= gen_rtx_SYMBOL_REF (Pmode, MULTF3_LIBCALL); \
|
||||
sdiv_optab->handlers[(int) TFmode].libfunc \
|
||||
= gen_rtx_SYMBOL_REF (Pmode, DIVTF3_LIBCALL); \
|
||||
smin_optab->handlers[(int) TFmode].libfunc \
|
||||
= gen_rtx_SYMBOL_REF (Pmode, SMINTF3_LIBCALL); \
|
||||
smax_optab->handlers[(int) TFmode].libfunc \
|
||||
= gen_rtx_SYMBOL_REF (Pmode, SMAXTF3_LIBCALL); \
|
||||
abs_optab->handlers[(int) TFmode].libfunc \
|
||||
= gen_rtx_SYMBOL_REF (Pmode, ABSTF2_LIBCALL); \
|
||||
neg_optab->handlers[(int) TFmode].libfunc \
|
||||
= gen_rtx_SYMBOL_REF (Pmode, NEGTF2_LIBCALL); \
|
||||
extendsftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDSFTF2_LIBCALL); \
|
||||
extenddftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDDFTF2_LIBCALL); \
|
||||
trunctfsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFSF2_LIBCALL); \
|
||||
trunctfdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFDF2_LIBCALL); \
|
||||
floatsitf_libfunc = gen_rtx_SYMBOL_REF (Pmode, FLOATSITF2_LIBCALL); \
|
||||
floatditf_libfunc = gen_rtx_SYMBOL_REF (Pmode, FLOATDITF2_LIBCALL); \
|
||||
fixtfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIX_TRUNCTFSI2_LIBCALL);\
|
||||
fixtfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIX_TRUNCTFDI2_LIBCALL);\
|
||||
fixunstfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIXUNS_TRUNCTFSI2_LIBCALL); \
|
||||
fixunstfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIXUNS_TRUNCTFDI2_LIBCALL); \
|
||||
eqtf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EQTF2_LIBCALL); \
|
||||
netf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, NETF2_LIBCALL); \
|
||||
gttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GTTF2_LIBCALL); \
|
||||
getf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GETF2_LIBCALL); \
|
||||
lttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LTTF2_LIBCALL); \
|
||||
letf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LETF2_LIBCALL); \
|
||||
\
|
||||
INIT_SUBTARGET_OPTABS; \
|
||||
} while (0)
|
||||
|
||||
/* This is meant to be redefined in the host dependent files */
|
||||
#define INIT_SUBTARGET_OPTABS
|
||||
|
||||
/* Nonzero if a floating point comparison library call for
|
||||
mode MODE that will return a boolean value. Zero if one
|
||||
of the libgcc2 functions is used. */
|
||||
#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode)
|
@ -1,15 +0,0 @@
|
||||
# AIX support
|
||||
|
||||
# Compile crtbeginS.o and crtendS.o with pic.
|
||||
CRTSTUFF_T_CFLAGS_S = -fPIC
|
||||
# Compile libgcc2.a with pic and defines required by AIX headers
|
||||
TARGET_LIBGCC2_CFLAGS = -fPIC -D__64BIT__ -D_LONG_LONG -D_IA64 -D__int128=__size128_t
|
||||
LIB2ADDEH += $(srcdir)/config/ia64/unwind-aix.c
|
||||
|
||||
# Assemble startup files.
|
||||
crti.o: $(srcdir)/config/ia64/crti.asm $(GCC_PASSES)
|
||||
$(GCC_FOR_TARGET) -c -o crti.o -x assembler $(srcdir)/config/ia64/crti.asm
|
||||
crtn.o: $(srcdir)/config/ia64/crtn.asm $(GCC_PASSES)
|
||||
$(GCC_FOR_TARGET) -c -o crtn.o -x assembler $(srcdir)/config/ia64/crtn.asm
|
||||
|
||||
# end t-aix
|
@ -1,120 +0,0 @@
|
||||
/* Implements unwind table entry lookup for AIX (cf. fde-glibc.c).
|
||||
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
Contributed by Timothy Wall <twall@redhat.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 "tconfig.h"
|
||||
#include "tsystem.h"
|
||||
#include "unwind.h"
|
||||
#include "unwind-ia64.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <link.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
static struct unw_table_entry *
|
||||
find_fde_for_dso (Elf64_Addr pc, rt_link_map *map,
|
||||
unsigned long* pseg_base, unsigned long* pgp)
|
||||
{
|
||||
rt_segment *seg;
|
||||
Elf64_Addr seg_base;
|
||||
struct unw_table_entry *f_base;
|
||||
size_t lo, hi;
|
||||
|
||||
/* See if PC falls into one of the loaded segments. */
|
||||
for (seg = map->l_segments; seg; seg = (rt_segment *)seg->s_next)
|
||||
{
|
||||
if (pc >= seg->s_map_addr && pc < seg->s_map_addr + seg->s_mapsz)
|
||||
break;
|
||||
}
|
||||
if (!seg)
|
||||
return NULL;
|
||||
|
||||
/* Search for the entry within the unwind table. */
|
||||
f_base = (struct unw_table_entry *) (map->l_unwind_table);
|
||||
seg_base = (Elf64_Addr) seg->s_map_addr;
|
||||
lo = 0;
|
||||
hi = map->l_unwind_sz / sizeof (struct unw_table_entry);
|
||||
|
||||
while (lo < hi)
|
||||
{
|
||||
size_t mid = (lo + hi) / 2;
|
||||
struct unw_table_entry *f = f_base + mid;
|
||||
|
||||
if (pc < f->start_offset + seg_base)
|
||||
hi = mid;
|
||||
else if (pc >= f->end_offset + seg_base)
|
||||
lo = mid + 1;
|
||||
else {
|
||||
/* AIX executables are *always* dynamic. Look up GP for this
|
||||
object. */
|
||||
Elf64_Dyn *dyn = map->l_ld;
|
||||
*pgp = 0;
|
||||
for (; dyn->d_tag != DT_NULL ; dyn++)
|
||||
{
|
||||
if (dyn->d_tag == DT_PLTGOT)
|
||||
{
|
||||
*pgp = dyn->d_un.d_ptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*pseg_base = seg_base;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return a pointer to the unwind table entry for the function containing
|
||||
PC. */
|
||||
struct unw_table_entry *
|
||||
_Unwind_FindTableEntry (void *pc, unsigned long *pseg_base, unsigned long *pgp)
|
||||
{
|
||||
extern rt_r_debug _r_debug;
|
||||
struct unw_table_entry *ret;
|
||||
rt_link_map *map = _r_debug.r_map; /* address of link map */
|
||||
|
||||
/* Check the main application first, hoping that most of the user's
|
||||
code is there instead of in some library. */
|
||||
ret = find_fde_for_dso ((Elf64_Addr)pc, map, pseg_base, pgp);
|
||||
if (ret)
|
||||
{
|
||||
/* If we're in the main application, use the current GP value. */
|
||||
register unsigned long gp __asm__("gp");
|
||||
*pgp = gp;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* FIXME need a DSO lock mechanism for AIX here, to ensure shared
|
||||
libraries aren't changed while we're examining them. */
|
||||
|
||||
for (map = _r_debug.r_map; map; map = map->l_next)
|
||||
{
|
||||
/* Skip the main application's entry. */
|
||||
if (!map->l_name)
|
||||
continue;
|
||||
ret = find_fde_for_dso ((Elf64_Addr)pc, map, pseg_base, pgp);
|
||||
if (ret)
|
||||
break;
|
||||
}
|
||||
|
||||
/* FIXME need a DSO unlock mechanism for AIX here. */
|
||||
|
||||
return ret;
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
/* Operating system specific defines to be used when targeting GCC for some
|
||||
embedded system running pSOS. We assume GNU tools with ELF, but
|
||||
try to maintain compatibility with the MRI tools. Based on svr4.h.
|
||||
Copyright (C) 1996, 1999, 2000 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.
|
||||
|
||||
To use this file, make up a file with a name like:
|
||||
|
||||
?????-psos.h
|
||||
|
||||
where ????? is replaced by the name of the basic hardware that you
|
||||
are targeting for. Then, in the file ?????-psos.h, put something
|
||||
like:
|
||||
|
||||
#include "?????.h"
|
||||
#include "psos.h"
|
||||
|
||||
followed by any really system-specific defines (or overrides of
|
||||
defines) which you find that you need.
|
||||
*/
|
||||
|
||||
|
||||
/* Define a symbol indicating that we are using psos.h. */
|
||||
|
||||
#define USING_PSOS_H
|
||||
|
||||
|
||||
/* All pSOS targets currently use the ELF object file format. */
|
||||
|
||||
#define OBJECT_FORMAT_ELF
|
||||
|
||||
|
||||
/* Provide a NULL STARTFILE_SPEC. The startfile cannot be specified
|
||||
here because it depends on the architecture (e.g. 68K), the
|
||||
board-support package (e.g. M162) and the run-time configuration
|
||||
(e.g. application vs. ram-image vs. rom-image). Specify the
|
||||
startfile in a linker-script created from the generic
|
||||
architecture-specific linker-scripts. */
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
|
||||
|
||||
/* Predefined macros (independent of processor type). */
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dpsos"
|
||||
|
||||
|
||||
/* Implicit library calls should use ANSI memcpy rather than BSD
|
||||
bcopy, etc. */
|
||||
|
||||
#define TARGET_MEM_FUNCTIONS
|
||||
|
||||
/* This is how we tell the assembler that a symbol is weak. */
|
||||
|
||||
#define ASM_WEAKEN_LABEL(FILE,NAME) \
|
||||
do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
|
||||
fputc ('\n', FILE); } while (0)
|
||||
|
||||
/* Switch into a generic section. */
|
||||
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
|
||||
|
||||
/* Use DBX debugging info by default. */
|
||||
|
||||
#ifndef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
#endif
|
||||
|
||||
/* For pSOS we use DBX debugging info. */
|
||||
|
||||
#define DBX_DEBUGGING_INFO 1
|
@ -1,87 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler,
|
||||
for IBM RS/6000 running AIX version 3.1.
|
||||
Copyright (C) 1993,1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Richard Kenner (kenner@nyu.edu)
|
||||
|
||||
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. */
|
||||
|
||||
|
||||
/* Output something to declare an external symbol to the assembler. Most
|
||||
assemblers don't need this.
|
||||
|
||||
If we haven't already, add "[RW]" (or "[DS]" for a function) to the
|
||||
name. Normally we write this out along with the name. In the few cases
|
||||
where we can't, it gets stripped off. */
|
||||
|
||||
#undef ASM_OUTPUT_EXTERNAL
|
||||
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
|
||||
{ rtx _symref = XEXP (DECL_RTL (DECL), 0); \
|
||||
if ((TREE_CODE (DECL) == VAR_DECL \
|
||||
|| TREE_CODE (DECL) == FUNCTION_DECL) \
|
||||
&& (NAME)[strlen (NAME) - 1] != ']') \
|
||||
{ \
|
||||
XSTR (_symref, 0) = concat (XSTR (_symref, 0), \
|
||||
(TREE_CODE (DECL) == FUNCTION_DECL \
|
||||
? "[DS]" : "[RW]"), \
|
||||
NULL); \
|
||||
} \
|
||||
fputs ("\t.extern ", FILE); \
|
||||
assemble_name (FILE, XSTR (_symref, 0)); \
|
||||
if (TREE_CODE (DECL) == FUNCTION_DECL) \
|
||||
{ \
|
||||
fputs ("\n\t.extern .", FILE); \
|
||||
RS6000_OUTPUT_BASENAME (FILE, XSTR (_symref, 0)); \
|
||||
} \
|
||||
putc ('\n', FILE); \
|
||||
}
|
||||
|
||||
/* Similar, but for libcall. We only have to worry about the function name,
|
||||
not that of the descriptor. */
|
||||
|
||||
#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
|
||||
{ fputs ("\t.extern .", FILE); \
|
||||
assemble_name (FILE, XSTR (FUN, 0)); \
|
||||
putc ('\n', FILE); \
|
||||
}
|
||||
|
||||
/* AIX 3.2 defined _AIX32, but older versions do not. */
|
||||
#undef TARGET_OS_CPP_BUILTINS
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("_IBMR2"); \
|
||||
builtin_define ("_AIX"); \
|
||||
builtin_assert ("system=unix"); \
|
||||
builtin_assert ("system=aix"); \
|
||||
builtin_assert ("cpu=rs6000"); \
|
||||
builtin_assert ("machine=rs6000"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* AIX 3.1 uses bit 15 in CROR as the magic nop. */
|
||||
#undef RS6000_CALL_GLUE
|
||||
#define RS6000_CALL_GLUE "cror 15,15,15"
|
||||
|
||||
/* AIX 3.1 does not prepend underscores to itrunc, uitrunc, or mcount. */
|
||||
#undef RS6000_ITRUNC
|
||||
#define RS6000_ITRUNC "itrunc"
|
||||
#undef RS6000_UITRUNC
|
||||
#define RS6000_UITRUNC "uitrunc"
|
||||
#undef RS6000_MCOUNT
|
||||
#define RS6000_MCOUNT ".mcount"
|
||||
|
@ -1,60 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler,
|
||||
for IBM RS/6000 POWER running AIX version 3.x with the fixed assembler.
|
||||
Copyright (C) 1995, 1996, 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Jason Merrill (jason@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. */
|
||||
|
||||
|
||||
/* Tell the assembler to assume that all undefined names are external. */
|
||||
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC "-u %(asm_cpu)"
|
||||
|
||||
#undef ASM_DEFAULT_SPEC
|
||||
#define ASM_DEFAULT_SPEC "-mpwr"
|
||||
|
||||
/* Define the options for the binder: Start text at 512, align all segments
|
||||
to 512 bytes, and warn if there is text relocation.
|
||||
|
||||
The -bhalt:4 option supposedly changes the level at which ld will abort,
|
||||
but it also suppresses warnings about multiply defined symbols and is
|
||||
used by the AIX cc command. So we use it here.
|
||||
|
||||
-bnodelcsect undoes a poor choice of default relating to multiply-defined
|
||||
csects. See AIX documentation for more information about this.
|
||||
|
||||
-bM:SRE tells the linker that the output file is Shared REusable. Note
|
||||
that to actually build a shared library you will also need to specify an
|
||||
export list with the -Wl,-bE option.
|
||||
|
||||
If -mcpu=common, export the architecture dependent multiply/divide routines
|
||||
as per README.RS6000. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#ifndef CROSS_COMPILE
|
||||
#define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
|
||||
%{static:-bnso -bI:/lib/syscalls.exp} \
|
||||
%{mcpu=common: milli.exp%s} \
|
||||
%{!shared:%{g*:-bexport:/usr/lib/libg.exp}} %{shared:-bM:SRE}"
|
||||
#else
|
||||
#define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
|
||||
%{static:-bnso} \
|
||||
%{mcpu=common: milli.exp%s} \
|
||||
%{shared:-bM:SRE}"
|
||||
#endif
|
@ -1,36 +0,0 @@
|
||||
/* Embedded ELF system support, using old AIX based calling sequence.
|
||||
Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support.
|
||||
|
||||
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. */
|
||||
|
||||
/* Default ABI to use */
|
||||
#undef RS6000_ABI_NAME
|
||||
#define RS6000_ABI_NAME "aix"
|
||||
|
||||
/* Define this macro as a C expression for the initializer of an
|
||||
array of string to tell the driver program which options are
|
||||
defaults for this target and thus do not need to be handled
|
||||
specially when using `MULTILIB_OPTIONS'.
|
||||
|
||||
Do not define this macro if `MULTILIB_OPTIONS' is not defined in
|
||||
the target makefile fragment or if none of the options listed in
|
||||
`MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
|
||||
|
||||
#undef MULTILIB_DEFAULTS
|
||||
#define MULTILIB_DEFAULTS { "mbig", "mcall-aix" }
|
@ -1,54 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler,
|
||||
for IBM RS/6000 running MACH.
|
||||
Copyright (C) 1992, 1999 Free Software Foundation, Inc.
|
||||
Contributed by Richard Kenner (kenner@nyu.edu)
|
||||
|
||||
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 TARGET_AIX 0
|
||||
|
||||
/* Print subsidiary information on the compiler version in use. */
|
||||
#define TARGET_VERSION fprintf (stderr, " (Mach-RS/6000)");
|
||||
|
||||
/* We don't define AIX under MACH; instead we define `unix'. */
|
||||
#undef TARGET_OS_CPP_BUILTINS
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define_std ("rios"); \
|
||||
builtin_define ("_IBMR2"); \
|
||||
builtin_define_std ("unix"); \
|
||||
builtin_assert ("system=unix"); \
|
||||
builtin_assert ("system=mach"); \
|
||||
builtin_assert ("cpu=rs6000"); \
|
||||
builtin_assert ("machine=rs6000"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Define different binder options for MACH. */
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC \
|
||||
"-T0x10000000 -D0x20000000 -K %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
|
||||
-bnoso -berrmsg -btextro -bhalt:4 -bnodelcsect"
|
||||
|
||||
/* MACH doesn't have atexit. */
|
||||
#define NEED_ATEXIT
|
||||
|
||||
/* 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
|
@ -1,4 +0,0 @@
|
||||
rs6000-c.o: $(srcdir)/config/rs6000/rs6000-c.c \
|
||||
$(srcdir)/config/rs6000/rs6000-protos.h \
|
||||
$(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(CPPLIB_H) $(TM_P_H) c-pragma.h errors.h
|
||||
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
|
@ -1,57 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler. Vxworks PowerPC version.
|
||||
Copyright (C) 1996, 2000 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. */
|
||||
|
||||
/* This file just exists to give specs for the PowerPC running on VxWorks. */
|
||||
|
||||
/* Reset defaults */
|
||||
#undef CPP_OS_DEFAULT_SPEC
|
||||
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_vxworks)"
|
||||
|
||||
#undef LIB_DEFAULT_SPEC
|
||||
#define LIB_DEFAULT_SPEC "%(lib_vxworks)"
|
||||
|
||||
#undef STARTFILE_DEFAULT_SPEC
|
||||
#define STARTFILE_DEFAULT_SPEC "%(startfile_vxworks)"
|
||||
|
||||
#undef ENDFILE_DEFAULT_SPEC
|
||||
#define ENDFILE_DEFAULT_SPEC "%(endfile_vxworks)"
|
||||
|
||||
#undef LINK_START_DEFAULT_SPEC
|
||||
#define LINK_START_DEFAULT_SPEC "%(link_start_vxworks)"
|
||||
|
||||
#undef LINK_OS_DEFAULT_SPEC
|
||||
#define LINK_OS_DEFAULT_SPEC "%(link_os_vxworks)"
|
||||
|
||||
#undef TARGET_OS_CPP_BUILTINS
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("__vxworks"); \
|
||||
builtin_define ("__vxworks__"); \
|
||||
builtin_assert ("system=vxworks"); \
|
||||
builtin_assert ("system=embedded"); \
|
||||
builtin_assert ("cpu=powerpc"); \
|
||||
builtin_assert ("machine=powerpc"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* We use stabs-in-elf for debugging */
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
@ -1,5 +0,0 @@
|
||||
#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,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 (carolo@hal.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. */
|
||||
|
||||
/* 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,96 +0,0 @@
|
||||
/* Definitions for SPARC running Linux-based GNU systems with a.out.
|
||||
Copyright (C) 1996, 1997, 1999, 2002 Free Software Foundation, Inc.
|
||||
Contributed by Eddie C. Dost (ecd@skynet.be)
|
||||
|
||||
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. */
|
||||
|
||||
/* Don't assume anything about the header files. */
|
||||
#define NO_IMPLICIT_EXTERN_C
|
||||
|
||||
/* 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 1
|
||||
|
||||
#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) output_file_directive (FILE, main_input_filename)
|
||||
|
||||
#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 "int"
|
||||
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
#define WCHAR_TYPE_SIZE 32
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dunix -Dsparc -D__gnu_linux__ -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. */
|
||||
#undef DEFAULT_PCC_STRUCT_RETURN
|
||||
#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}"
|
||||
|
@ -1,38 +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. */
|
||||
|
||||
/* ??? 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,47 +0,0 @@
|
||||
/* Definitions for SPARC running LynxOS.
|
||||
Copyright (C) 1993, 1995, 1996, 2000 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. */
|
||||
|
||||
#undef ASM_OUTPUT_IDENT
|
||||
|
||||
#define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
|
||||
|
||||
/* ??? 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,49 +0,0 @@
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
NETBSD_OS_CPP_BUILTINS_AOUT(); \
|
||||
builtin_define_std ("sparc"); \
|
||||
builtin_assert ("cpu=sparc"); \
|
||||
builtin_assert ("machine=sparc"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Make sure this is undefined. */
|
||||
#undef CPP_PREDEFINES
|
||||
|
||||
/* What extra spec entries do we need? */
|
||||
#undef SUBTARGET_EXTRA_SPECS
|
||||
#define SUBTARGET_EXTRA_SPECS \
|
||||
{ "netbsd_cpp_spec", NETBSD_CPP_SPEC },
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%(cpp_cpu) %(netbsd_cpp_spec)"
|
||||
|
||||
/* Make gcc agree with <machine/ansi.h> */
|
||||
|
||||
#undef SIZE_TYPE
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
#define PTRDIFF_TYPE "int"
|
||||
|
||||
/* This is BSD, so it wants DBX format. */
|
||||
|
||||
#define DBX_DEBUGGING_INFO 1
|
||||
|
||||
/* 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
|
||||
|
||||
/* Attempt to enable execute permissions on the stack. */
|
||||
#define TRANSFER_FROM_TRAMPOLINE NETBSD_ENABLE_EXECUTE_STACK
|
@ -1,51 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for sparclite 86x w/o FPU.
|
||||
Copyright (C) 1998, 1999, 2000 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. */
|
||||
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-D__sparc__ -D__sparclite86x__ -Acpu=sparc -Amachine=sparc"
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (sparclite 86x)");
|
||||
|
||||
/* Enable app-regs and epilogue options. Do not enable the fpu. */
|
||||
|
||||
#undef TARGET_DEFAULT
|
||||
#define TARGET_DEFAULT MASK_APP_REGS
|
||||
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC "%{v:-v} %{mlittle-endian-data:--little-endian-data} %(asm_cpu)"
|
||||
|
||||
/* US Software GOFAST library support. */
|
||||
#undef INIT_SUBTARGET_OPTABS
|
||||
#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "%{v:-V}"
|
||||
|
||||
#undef BYTES_BIG_ENDIAN
|
||||
#define BYTES_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN_DATA)
|
||||
#undef WORDS_BIG_ENDIAN
|
||||
#define WORDS_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN_DATA)
|
||||
|
||||
#define TARGET_LITTLE_ENDIAN_DATA (target_flags & MASK_LITTLE_ENDIAN)
|
||||
#undef SUBTARGET_SWITCHES
|
||||
#define SUBTARGET_SWITCHES \
|
||||
{ "little-endian-data", MASK_LITTLE_ENDIAN, N_("Use little-endian byte order for data")},
|
@ -1,46 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SPARClet.
|
||||
Copyright (C) 1996, 1997, 2000 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. */
|
||||
|
||||
#undef TARGET_DEFAULT
|
||||
#define TARGET_DEFAULT MASK_APP_REGS
|
||||
|
||||
#define CPP_PREDEFINES "-Dsparc -Acpu=sparc -Amachine=sparc"
|
||||
|
||||
#undef SUBTARGET_SWITCHES
|
||||
#define SUBTARGET_SWITCHES \
|
||||
{"big-endian", -MASK_LITTLE_ENDIAN, N_("Generate code for big endian") }, \
|
||||
{"little-endian", MASK_LITTLE_ENDIAN, N_("Generate code for little endian") },
|
||||
|
||||
#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)
|
@ -1,22 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SunOS 4.x with gas
|
||||
Copyright (C) 1997, 2000 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. */
|
||||
|
||||
/* defaults.h will define DWARF2_UNWIND_INFO for us. */
|
||||
#undef DWARF2_UNWIND_INFO
|
@ -1,11 +0,0 @@
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dsparc -Dsun -Dunix -Asystem=unix -Asystem=bsd"
|
||||
|
||||
/* 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
|
@ -1,48 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SunOS 4.x
|
||||
Copyright (C) 1994, 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. */
|
||||
|
||||
#undef SUNOS4_SHARED_LIBRARIES
|
||||
#define SUNOS4_SHARED_LIBRARIES 1
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dsparc -Dsun -Dunix -Asystem=unix -Asystem=bsd"
|
||||
|
||||
#define LIB_SPEC "%{!shared:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} %{g:-lg}}"
|
||||
|
||||
/* Provide required defaults for linker -e and -d switches. */
|
||||
|
||||
#define LINK_SPEC \
|
||||
"%{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp} %{static:-Bstatic} \
|
||||
%{assert*} %{shared:%{!mimpure-text:-assert pure-text}}"
|
||||
|
||||
/* Use N_BINCL stabs. */
|
||||
|
||||
#define DBX_USE_BINCL
|
||||
|
||||
/* The Sun as doesn't like unaligned data. */
|
||||
#define DWARF2_UNWIND_INFO 0
|
||||
|
||||
/* SunOS has on_exit instead of atexit. */
|
||||
/* The man page says it returns int. */
|
||||
#ifdef IN_LIBGCC2
|
||||
extern int on_exit PARAMS ((void *, void *));
|
||||
#endif
|
||||
#define ON_EXIT(FUNC) on_exit ((FUNC), 0)
|
||||
#define NEED_ATEXIT
|
@ -1,29 +0,0 @@
|
||||
LIB1ASMSRC = sparc/lb1spc.asm
|
||||
LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
|
||||
|
||||
# We want fine grained libraries, so use the new code to build the
|
||||
# floating point emulation libraries.
|
||||
FPBIT = fp-bit.c
|
||||
DPBIT = 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 =
|
||||
MULTILIB_DIRNAMES =
|
||||
MULTILIB_MATCHES =
|
||||
|
||||
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,25 +0,0 @@
|
||||
# configuration file for a bare sparc cpu
|
||||
|
||||
LIB1ASMSRC = sparc/lb1spc.asm
|
||||
LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
|
||||
|
||||
# We want fine grained libraries, so use the new code to build the
|
||||
# floating point emulation libraries.
|
||||
FPBIT = fp-bit.c
|
||||
DPBIT = 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,21 +0,0 @@
|
||||
# configuration file for a bare sparclet cpu, aout format files
|
||||
|
||||
LIB1ASMSRC = sparc/lb1spc.asm
|
||||
LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
|
||||
|
||||
# We want fine grained libraries, so use the new code to build the
|
||||
# floating point emulation libraries.
|
||||
FPBIT = fp-bit.c
|
||||
DPBIT = 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,12 +0,0 @@
|
||||
# SunOS 4.1.*
|
||||
|
||||
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,10 +0,0 @@
|
||||
# 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,23 +0,0 @@
|
||||
# We don't want to put exit in libgcc.a for VxWorks, because VxWorks
|
||||
# does not have _exit.
|
||||
TARGET_LIBGCC2_CFLAGS = -Dexit=unused_exit
|
||||
|
||||
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=O0
|
||||
MULTILIB_DIRNAMES=O0
|
||||
MULTILIB_MATCHES=
|
||||
MULTILIB_EXCEPTIONS=
|
||||
MULTILIB_EXTRA_OPTS=m64 mcpu=ultrasparc
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
@ -1,136 +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. */
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (sparc VxSim)");
|
||||
|
||||
/* Supposedly the same as vanilla sparc svr4, except for the stuff below: */
|
||||
|
||||
#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\t"
|
||||
|
||||
#undef LOCAL_LABEL_PREFIX
|
||||
#define LOCAL_LABEL_PREFIX "."
|
||||
|
||||
/* 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))
|
||||
|
||||
|
||||
|
||||
#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.
|
||||
SPARC ABI says that long double is 4 words. */
|
||||
#define LONG_DOUBLE_TYPE_SIZE 64
|
@ -1,59 +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. */
|
||||
|
||||
|
||||
/* 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. */
|
||||
#undef INIT_SUBTARGET_OPTABS
|
||||
#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS
|
@ -1,92 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler.
|
||||
64-bit VxWorks SPARC version.
|
||||
Copyright (C) 2001 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. */
|
||||
|
||||
|
||||
/* Specify what to link with. */
|
||||
/* VxWorks does all the library stuff itself. */
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC "-r"
|
||||
|
||||
/* VxWorks provides the functionality of crt0.o and friends itself. */
|
||||
#undef STARTFILE_SPEC
|
||||
#undef ENDFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
#define ENDFILE_SPEC ""
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC ""
|
||||
|
||||
/* We need to prohibit dots in constructor labels so that we can build a
|
||||
table of { string, address } entries for each non-static name in a
|
||||
program. The address, being of the form &name, it cannot contain a dot or
|
||||
C will try to parse it as a &struct.field phrase. */
|
||||
#undef NO_DOLLAR_IN_LABEL
|
||||
#undef DOLLARS_IN_IDENTIFIERS
|
||||
#define DOLLARS_IN_IDENTIFIERS 1
|
||||
#define NO_DOT_IN_LABEL
|
||||
|
||||
/* Enable #pragma pack(n) */
|
||||
#define HANDLE_SYSV_PRAGMA 1
|
||||
|
||||
/* We use stabs for debugging */
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
|
||||
/* Longs are still only 32bits for vxWorks, even for UltraSPARC */
|
||||
#undef LONG_TYPE_SIZE
|
||||
#define LONG_TYPE_SIZE 32
|
||||
|
||||
#undef CPP_ARCH32_SPEC
|
||||
#define CPP_ARCH32_SPEC "-Acpu(sparc) -Amachine(sparc)"
|
||||
#undef CPP_ARCH64_SPEC
|
||||
#define CPP_ARCH64_SPEC \
|
||||
"-Dsparc64 -D__arch64__ -Acpu(sparc64) -Amachine(sparc64)"
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-D__vxworks -D__sparc__ -Dsparc -D__GCC_NEW_VARARGS__"
|
||||
|
||||
/* 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) %(cpp_arch) -DCPU=ULTRASPARC -D__CPU__=CPU"
|
||||
|
||||
#undef TARGET_DEFAULT
|
||||
#define TARGET_DEFAULT (MASK_APP_REGS | MASK_FPU \
|
||||
| MASK_LONG_DOUBLE_128 | MASK_64BIT)
|
||||
|
||||
#undef SPARC_DEFAULT_CMODEL
|
||||
#define SPARC_DEFAULT_CMODEL CM_MEDLOW
|
||||
|
||||
#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. */
|
||||
#undef INIT_SUBTARGET_OPTABS
|
||||
#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS
|
@ -1,2 +0,0 @@
|
||||
# Don't run fixproto
|
||||
STMP_FIXPROTO =
|
@ -1,2 +0,0 @@
|
||||
# Don't run fixproto
|
||||
STMP_FIXPROTO =
|
@ -1,77 +0,0 @@
|
||||
# configure.frag for GCC
|
||||
# Process the host/target/language Makefile fragments.
|
||||
|
||||
# Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
|
||||
#This file is part of GCC.
|
||||
|
||||
#GCC 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.
|
||||
|
||||
#GCC 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 GCC; see the file COPYING. If not, write to the Free
|
||||
#Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
#02111-1307, USA.
|
||||
|
||||
# First parameter is the source directory, second is list of subdirectories,
|
||||
# third is list of host makefile fragments, fourth is list of target makefile
|
||||
# fragments.
|
||||
|
||||
srcdir=$1
|
||||
subdirs=$2
|
||||
xmake_files=$3
|
||||
tmake_files=$4
|
||||
|
||||
# Copy all the host makefile fragments into Make-host.
|
||||
|
||||
rm -f Make-host
|
||||
touch Make-host
|
||||
for f in .. $xmake_files
|
||||
do
|
||||
if [ -f $f ]
|
||||
then
|
||||
cat $f >> Make-host
|
||||
fi
|
||||
done
|
||||
|
||||
# Copy all the target makefile fragments into Make-target.
|
||||
|
||||
rm -f Make-target
|
||||
touch Make-target
|
||||
for f in .. $tmake_files
|
||||
do
|
||||
if [ -f $f ]
|
||||
then
|
||||
cat $f >> Make-target
|
||||
fi
|
||||
done
|
||||
|
||||
# Ensure the language build subdirectories exist.
|
||||
|
||||
for subdir in . $subdirs
|
||||
do
|
||||
if [ $subdir != . ]
|
||||
then
|
||||
test -d $subdir || mkdir $subdir
|
||||
fi
|
||||
done
|
||||
|
||||
# Now copy each language's Make-lang.in file to Make-lang.
|
||||
|
||||
rm -f Make-lang
|
||||
touch Make-lang
|
||||
|
||||
for subdir in . $subdirs
|
||||
do
|
||||
if [ $subdir != . ]
|
||||
then
|
||||
cat $srcdir/$subdir/Make-lang.in >> Make-lang
|
||||
fi
|
||||
done
|
File diff suppressed because it is too large
Load Diff
@ -1,467 +0,0 @@
|
||||
/* C code produced by gperf version 2.7 */
|
||||
/* Command-line: gperf -o -C -E -k 1-6,$ -j1 -D -N libc_name_p ../../../egcs-CVS20000404/gcc/cp/cfns.gperf */
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
static unsigned int hash PARAMS ((const char *, unsigned int));
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
const char * libc_name_p PARAMS ((const char *, unsigned int));
|
||||
/* maximum key range = 1020, duplicates = 1 */
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
static unsigned int
|
||||
hash (str, len)
|
||||
register const char *str;
|
||||
register unsigned int len;
|
||||
{
|
||||
static const unsigned short asso_values[] =
|
||||
{
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 0, 1,
|
||||
0, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 247, 218, 144,
|
||||
0, 0, 40, 7, 126, 184, 2, 15, 146, 67,
|
||||
9, 60, 0, 0, 3, 0, 7, 8, 197, 1,
|
||||
40, 8, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
|
||||
1038, 1038, 1038, 1038, 1038, 1038
|
||||
};
|
||||
register int hval = len;
|
||||
|
||||
switch (hval)
|
||||
{
|
||||
default:
|
||||
case 6:
|
||||
hval += asso_values[(unsigned char)str[5]];
|
||||
case 5:
|
||||
hval += asso_values[(unsigned char)str[4]];
|
||||
case 4:
|
||||
hval += asso_values[(unsigned char)str[3]];
|
||||
case 3:
|
||||
hval += asso_values[(unsigned char)str[2]];
|
||||
case 2:
|
||||
hval += asso_values[(unsigned char)str[1]];
|
||||
case 1:
|
||||
hval += asso_values[(unsigned char)str[0]];
|
||||
break;
|
||||
}
|
||||
return hval + asso_values[(unsigned char)str[len - 1]];
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
const char *
|
||||
libc_name_p (str, len)
|
||||
register const char *str;
|
||||
register unsigned int len;
|
||||
{
|
||||
enum
|
||||
{
|
||||
TOTAL_KEYWORDS = 207,
|
||||
MIN_WORD_LENGTH = 3,
|
||||
MAX_WORD_LENGTH = 10,
|
||||
MIN_HASH_VALUE = 18,
|
||||
MAX_HASH_VALUE = 1037
|
||||
};
|
||||
|
||||
static const char * const wordlist[] =
|
||||
{
|
||||
"gets",
|
||||
"puts",
|
||||
"sqrt",
|
||||
"strerror",
|
||||
"strstr",
|
||||
"strspn",
|
||||
"exp",
|
||||
"free",
|
||||
"fgets",
|
||||
"fputs",
|
||||
"fgetws",
|
||||
"fputws",
|
||||
"pow",
|
||||
"fseek",
|
||||
"perror",
|
||||
"strtod",
|
||||
"toupper",
|
||||
"towupper",
|
||||
"frexp",
|
||||
"strtok",
|
||||
"fsetpos",
|
||||
"ferror",
|
||||
"freopen",
|
||||
"fgetpos",
|
||||
"fopen",
|
||||
"wmemset",
|
||||
"memset",
|
||||
"system",
|
||||
"wcsstr",
|
||||
"wctype",
|
||||
"strxfrm",
|
||||
"wcsspn",
|
||||
"strcspn",
|
||||
"fmod",
|
||||
"strcpy",
|
||||
"strncpy",
|
||||
"strlen",
|
||||
"ungetwc",
|
||||
"feof",
|
||||
"ldexp",
|
||||
"isupper",
|
||||
"rewind",
|
||||
"iswupper",
|
||||
"sin",
|
||||
"cos",
|
||||
"modf",
|
||||
"iswpunct",
|
||||
"wcstod",
|
||||
"log10",
|
||||
"log",
|
||||
"wcsrtombs",
|
||||
"strcmp",
|
||||
"fwide",
|
||||
"towctrans",
|
||||
"strncmp",
|
||||
"strtoul",
|
||||
"fwrite",
|
||||
"exit",
|
||||
"swprintf",
|
||||
"wcstok",
|
||||
"strftime",
|
||||
"sprintf",
|
||||
"wprintf",
|
||||
"strpbrk",
|
||||
"time",
|
||||
"rand",
|
||||
"srand",
|
||||
"wmemmove",
|
||||
"tan",
|
||||
"tolower",
|
||||
"fwprintf",
|
||||
"towlower",
|
||||
"wcstombs",
|
||||
"printf",
|
||||
"fprintf",
|
||||
"strchr",
|
||||
"strrchr",
|
||||
"wmemcpy",
|
||||
"fread",
|
||||
"getwchar",
|
||||
"putwchar",
|
||||
"longjmp",
|
||||
"memcpy",
|
||||
"wcsxfrm",
|
||||
"wcscspn",
|
||||
"getc",
|
||||
"putc",
|
||||
"getwc",
|
||||
"putwc",
|
||||
"wcscpy",
|
||||
"wcsncpy",
|
||||
"wcslen",
|
||||
"floor",
|
||||
"setbuf",
|
||||
"ungetc",
|
||||
"rename",
|
||||
"remove",
|
||||
"gmtime",
|
||||
"mktime",
|
||||
"fgetc",
|
||||
"fputc",
|
||||
"fgetwc",
|
||||
"fputwc",
|
||||
"memcmp",
|
||||
"iswctype",
|
||||
"wmemcmp",
|
||||
"ispunct",
|
||||
"mbstowcs",
|
||||
"wcscmp",
|
||||
"mbsrtowcs",
|
||||
"setlocale",
|
||||
"wcsncmp",
|
||||
"wcstoul",
|
||||
"strtol",
|
||||
"wcsftime",
|
||||
"iswprint",
|
||||
"wcspbrk",
|
||||
"iswdigit",
|
||||
"isprint",
|
||||
"fclose",
|
||||
"atof",
|
||||
"islower",
|
||||
"iswlower",
|
||||
"ctime",
|
||||
"wmemchr",
|
||||
"memchr",
|
||||
"wctrans",
|
||||
"strcat",
|
||||
"getenv",
|
||||
"strncat",
|
||||
"iswxdigit",
|
||||
"wcschr",
|
||||
"wcsrchr",
|
||||
"isxdigit",
|
||||
"vswprintf",
|
||||
"raise",
|
||||
"iswspace",
|
||||
"vsprintf",
|
||||
"vwprintf",
|
||||
"vprintf",
|
||||
"swscanf",
|
||||
"sinh",
|
||||
"tmpfile",
|
||||
"asin",
|
||||
"mblen",
|
||||
"acos",
|
||||
"mbrlen",
|
||||
"cosh",
|
||||
"difftime",
|
||||
"memmove",
|
||||
"abs",
|
||||
"tmpnam",
|
||||
"vfwprintf",
|
||||
"setvbuf",
|
||||
"vfprintf",
|
||||
"scanf",
|
||||
"sscanf",
|
||||
"wscanf",
|
||||
"fwscanf",
|
||||
"ftell",
|
||||
"fflush",
|
||||
"atexit",
|
||||
"iswcntrl",
|
||||
"iscntrl",
|
||||
"mbrtowc",
|
||||
"wcrtomb",
|
||||
"fabs",
|
||||
"wcstol",
|
||||
"strcoll",
|
||||
"atan2",
|
||||
"tanh",
|
||||
"atan",
|
||||
"fscanf",
|
||||
"clock",
|
||||
"getchar",
|
||||
"putchar",
|
||||
"abort",
|
||||
"clearerr",
|
||||
"wcscat",
|
||||
"wcsncat",
|
||||
"isdigit",
|
||||
"isgraph",
|
||||
"iswgraph",
|
||||
"btowc",
|
||||
"div",
|
||||
"isspace",
|
||||
"atol",
|
||||
"labs",
|
||||
"ceil",
|
||||
"mbtowc",
|
||||
"wcscoll",
|
||||
"wctob",
|
||||
"asctime",
|
||||
"iswalnum",
|
||||
"isalnum",
|
||||
"mbsinit",
|
||||
"atoi",
|
||||
"wctomb",
|
||||
"ldiv",
|
||||
"signal",
|
||||
"realloc",
|
||||
"localtime",
|
||||
"iswalpha",
|
||||
"localeconv",
|
||||
"isalpha",
|
||||
"malloc",
|
||||
"calloc"
|
||||
};
|
||||
|
||||
static const short lookup[] =
|
||||
{
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, 0, 1, -1, 2, -1, -1,
|
||||
-1, -1, -1, 3, -1, 4, -1, -1,
|
||||
-1, -1, 5, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, 6, -1, -1, -1, 7,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, 8, 9, 10, 11, -1,
|
||||
-1, 12, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, 13, -1, -1, 14, -1,
|
||||
-1, -1, -1, 15, -1, 16, -1, 17,
|
||||
18, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, 19, 20, -1, -1, -1, 21, 22,
|
||||
-1, 23, -1, 24, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, 25, -1, -1,
|
||||
-1, -1, 26, 27, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, 28, -1, 29, 30,
|
||||
-1, 31, 32, 33, -1, -1, -1, -1,
|
||||
34, -1, 35, -1, 36, -1, -1, 37,
|
||||
38, -1, -1, -1, -1, -1, -1, 39,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, 40, 41, 42, 43, -1, 44,
|
||||
-1, -1, -1, 45, -1, -1, -1, -1,
|
||||
-1, 46, 47, 48, -1, -1, -1, 49,
|
||||
50, -1, -1, 51, -1, -1, 52, 53,
|
||||
-1, -1, -1, -1, -1, 54, 55, -1,
|
||||
-1, 56, 57, -1, -1, 58, -1, -1,
|
||||
59, 60, 61, 62, -1, 63, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, 64, 65,
|
||||
66, -1, -1, -1, -1, -1, 67, -1,
|
||||
-1, -1, -1, 68, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, 69, 70, 71, 72,
|
||||
-1, 73, 74, -1, 75, 76, 77, 78,
|
||||
79, 80, 81, -1, 82, -1, 83, -1,
|
||||
-1, 84, 85, 86, 87, 88, -1, 89,
|
||||
-1, 90, -1, 91, -1, 92, -1, 93,
|
||||
-1, -1, -1, -1, -1, 94, -1, -1,
|
||||
-1, -1, -1, -1, 95, 96, -1, -1,
|
||||
-1, -1, 97, -1, -1, -1, -1, -1,
|
||||
-1, -1, 98, 99, 100, 101, 102, 103,
|
||||
104, 105, -1, -1, -1, -1, -1, 106,
|
||||
-1, 107, 108, -1, 109, -1, 110, -1,
|
||||
-1, -1, -1, -1, 111, 112, -1, 113,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
114, -1, -1, 115, 116, -1, -1, 117,
|
||||
-1, -1, 118, -1, 119, -1, 120, -1,
|
||||
-1, 121, -1, 122, -1, -1, -1, 123,
|
||||
-1, -1, -1, -1, -1, -1, -1, 124,
|
||||
125, -1, 126, -1, -1, 127, -1, 128,
|
||||
129, 130, -1, 131, 132, -1, 133, -1,
|
||||
-1, -1, 134, -1, -1, -1, -1, 135,
|
||||
136, 137, 138, -1, -1, -1, -1, 139,
|
||||
140, 141, -1, 142, -1, 143, 144, 145,
|
||||
-1, -1, 146, -1, 147, -1, -1, 148,
|
||||
-1, 149, -1, -1, 150, -1, 151, -1,
|
||||
-1, -1, 152, -1, -1, 153, -1, -1,
|
||||
-1, 154, -1, -1, -1, 155, 156, 157,
|
||||
158, -1, 159, -1, 160, -1, -1, -1,
|
||||
-1, -1, 161, 162, 163, -1, -1, -1,
|
||||
-1, -1, -1, -719, -1, 166, 167, -43,
|
||||
-2, 168, -1, 169, -1, -1, -1, 170,
|
||||
-1, -1, -1, 171, -1, -1, 172, -1,
|
||||
-1, 173, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, 174, 175, -1,
|
||||
-1, -1, -1, 176, -1, -1, -1, 177,
|
||||
-1, -1, -1, -1, 178, -1, -1, 179,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, 180, 181, -1,
|
||||
182, -1, -1, 183, -1, 184, 185, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, 186, -1, -1, -1, -1, 187,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
188, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, 189,
|
||||
190, -1, -1, -1, -1, 191, -1, -1,
|
||||
192, -1, -1, -1, -1, -1, 193, -1,
|
||||
-1, -1, -1, -1, 194, -1, -1, -1,
|
||||
-1, -1, -1, -1, 195, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, 196, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, 197, -1, -1, -1, -1, -1, -1,
|
||||
198, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, 199, -1, -1, -1, -1, -1, -1,
|
||||
-1, 200, -1, -1, -1, -1, -1, 201,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, 202, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, 203, -1,
|
||||
-1, -1, -1, -1, -1, 204, -1, -1,
|
||||
205, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, 206
|
||||
};
|
||||
|
||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||
{
|
||||
register int key = hash (str, len);
|
||||
|
||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
||||
{
|
||||
register int index = lookup[key];
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
register const char *s = wordlist[index];
|
||||
|
||||
if (*str == *s && !strcmp (str + 1, s + 1))
|
||||
return s;
|
||||
}
|
||||
else if (index < -TOTAL_KEYWORDS)
|
||||
{
|
||||
register int offset = - 1 - TOTAL_KEYWORDS - index;
|
||||
register const char * const *wordptr = &wordlist[TOTAL_KEYWORDS + lookup[offset]];
|
||||
register const char * const *wordendptr = wordptr + -lookup[offset + 1];
|
||||
|
||||
while (wordptr < wordendptr)
|
||||
{
|
||||
register const char *s = *wordptr;
|
||||
|
||||
if (*str == *s && !strcmp (str + 1, s + 1))
|
||||
return s;
|
||||
wordptr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -1,582 +0,0 @@
|
||||
/* G++ preliminary semantic processing for the compiler driver.
|
||||
Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
Contributed by Brendan Kehoe (brendan@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. */
|
||||
|
||||
/* This program is a wrapper to the main `gcc' driver. For GNU C++,
|
||||
we need to do two special things: a) append `-lg++' in situations
|
||||
where it's appropriate, to link in libg++, and b) add `-xc++'..`-xnone'
|
||||
around file arguments named `foo.c' or `foo.i'. So, we do all of
|
||||
this semantic processing then just exec gcc with the new argument
|
||||
list.
|
||||
|
||||
We used to do all of this in a small shell script, but many users
|
||||
found the performance of this as a shell script to be unacceptable.
|
||||
In situations where your PATH has a lot of NFS-mounted directories,
|
||||
using a script that runs sed and other things would be a nasty
|
||||
performance hit. With this program, we never search the PATH at all. */
|
||||
|
||||
#include "config.h"
|
||||
#ifdef __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#if !defined(_WIN32)
|
||||
#include <sys/file.h> /* May get R_OK, etc. on some systems. */
|
||||
#else
|
||||
#include <process.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
/* Defined to the name of the compiler; if using a cross compiler, the
|
||||
Makefile should compile this file with the proper name
|
||||
(e.g., "i386-aout-gcc"). */
|
||||
#ifndef GCC_NAME
|
||||
#define GCC_NAME "gcc"
|
||||
#endif
|
||||
|
||||
/* This bit is set if we saw a `-xfoo' language specification. */
|
||||
#define LANGSPEC (1<<1)
|
||||
/* This bit is set if they did `-lm' or `-lmath'. */
|
||||
#define MATHLIB (1<<2)
|
||||
|
||||
#ifndef MATH_LIBRARY
|
||||
#define MATH_LIBRARY "-lm"
|
||||
#endif
|
||||
|
||||
/* On MSDOS, write temp files in current dir
|
||||
because there's no place else we can expect to use. */
|
||||
#ifdef __MSDOS__
|
||||
#ifndef P_tmpdir
|
||||
#define P_tmpdir "."
|
||||
#endif
|
||||
#ifndef R_OK
|
||||
#define R_OK 4
|
||||
#define W_OK 2
|
||||
#define X_OK 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef VPROTO
|
||||
#ifdef __STDC__
|
||||
#define PVPROTO(ARGS) ARGS
|
||||
#define VPROTO(ARGS) ARGS
|
||||
#define VA_START(va_list,var) va_start(va_list,var)
|
||||
#else
|
||||
#define PVPROTO(ARGS) ()
|
||||
#define VPROTO(ARGS) (va_alist) va_dcl
|
||||
#define VA_START(va_list,var) va_start(va_list)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
extern int sys_nerr;
|
||||
#ifndef HAVE_STRERROR
|
||||
#if defined(bsd4_4)
|
||||
extern const char *const sys_errlist[];
|
||||
#else
|
||||
extern char *sys_errlist[];
|
||||
#endif
|
||||
#else
|
||||
extern char *strerror();
|
||||
#endif
|
||||
|
||||
/* Name with which this program was invoked. */
|
||||
static char *programname;
|
||||
|
||||
char *
|
||||
my_strerror(e)
|
||||
int e;
|
||||
{
|
||||
|
||||
#ifdef HAVE_STRERROR
|
||||
return strerror(e);
|
||||
|
||||
#else
|
||||
|
||||
static char buffer[30];
|
||||
if (!e)
|
||||
return "";
|
||||
|
||||
if (e > 0 && e < sys_nerr)
|
||||
return sys_errlist[e];
|
||||
|
||||
sprintf (buffer, "Unknown error %d", e);
|
||||
return buffer;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_VPRINTF
|
||||
/* Output an error message and exit */
|
||||
|
||||
static void
|
||||
fatal VPROTO((char *format, ...))
|
||||
{
|
||||
#ifndef __STDC__
|
||||
char *format;
|
||||
#endif
|
||||
va_list ap;
|
||||
|
||||
VA_START (ap, format);
|
||||
|
||||
#ifndef __STDC__
|
||||
format = va_arg (ap, char*);
|
||||
#endif
|
||||
|
||||
fprintf (stderr, "%s: ", programname);
|
||||
vfprintf (stderr, format, ap);
|
||||
va_end (ap);
|
||||
fprintf (stderr, "\n");
|
||||
#if 0
|
||||
/* XXX Not needed for g++ driver. */
|
||||
delete_temp_files ();
|
||||
#endif
|
||||
exit (1);
|
||||
}
|
||||
|
||||
static void
|
||||
error VPROTO((char *format, ...))
|
||||
{
|
||||
#ifndef __STDC__
|
||||
char *format;
|
||||
#endif
|
||||
va_list ap;
|
||||
|
||||
VA_START (ap, format);
|
||||
|
||||
#ifndef __STDC__
|
||||
format = va_arg (ap, char*);
|
||||
#endif
|
||||
|
||||
fprintf (stderr, "%s: ", programname);
|
||||
vfprintf (stderr, format, ap);
|
||||
va_end (ap);
|
||||
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
|
||||
#else /* not HAVE_VPRINTF */
|
||||
|
||||
static void
|
||||
error (msg, arg1, arg2)
|
||||
char *msg, *arg1, *arg2;
|
||||
{
|
||||
fprintf (stderr, "%s: ", programname);
|
||||
fprintf (stderr, msg, arg1, arg2);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
|
||||
static void
|
||||
fatal (msg, arg1, arg2)
|
||||
char *msg, *arg1, *arg2;
|
||||
{
|
||||
error (msg, arg1, arg2);
|
||||
#if 0
|
||||
/* XXX Not needed for g++ driver. */
|
||||
delete_temp_files ();
|
||||
#endif
|
||||
exit (1);
|
||||
}
|
||||
|
||||
#endif /* not HAVE_VPRINTF */
|
||||
|
||||
/* More 'friendly' abort that prints the line and file.
|
||||
config.h can #define abort fancy_abort if you like that sort of thing. */
|
||||
|
||||
void
|
||||
fancy_abort ()
|
||||
{
|
||||
fatal ("Internal g++ abort.");
|
||||
}
|
||||
|
||||
char *
|
||||
xmalloc (size)
|
||||
unsigned size;
|
||||
{
|
||||
register char *value = (char *) malloc (size);
|
||||
if (value == 0)
|
||||
fatal ("virtual memory exhausted");
|
||||
return value;
|
||||
}
|
||||
|
||||
/* Return a newly-allocated string whose contents concatenate those
|
||||
of s1, s2, s3. */
|
||||
static char *
|
||||
concat (s1, s2, s3)
|
||||
char *s1, *s2, *s3;
|
||||
{
|
||||
int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
|
||||
char *result = xmalloc (len1 + len2 + len3 + 1);
|
||||
|
||||
strcpy (result, s1);
|
||||
strcpy (result + len1, s2);
|
||||
strcpy (result + len1 + len2, s3);
|
||||
*(result + len1 + len2 + len3) = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
pfatal_with_name (name)
|
||||
char *name;
|
||||
{
|
||||
fatal (concat ("%s: ", my_strerror (errno), ""), name);
|
||||
}
|
||||
|
||||
#ifdef __MSDOS__
|
||||
/* This is the common prefix we use to make temp file names. */
|
||||
char *temp_filename;
|
||||
|
||||
/* Length of the prefix. */
|
||||
int temp_filename_length;
|
||||
|
||||
/* Compute a string to use as the base of all temporary file names. */
|
||||
static char *
|
||||
choose_temp_base_try (try, base)
|
||||
char *try;
|
||||
char *base;
|
||||
{
|
||||
char *rv;
|
||||
if (base)
|
||||
rv = base;
|
||||
else if (try == (char *)0)
|
||||
rv = 0;
|
||||
else if (access (try, R_OK | W_OK) != 0)
|
||||
rv = 0;
|
||||
else
|
||||
rv = try;
|
||||
return rv;
|
||||
}
|
||||
|
||||
static void
|
||||
choose_temp_base ()
|
||||
{
|
||||
char *base = 0;
|
||||
int len;
|
||||
|
||||
base = choose_temp_base_try (getenv ("TMPDIR"), base);
|
||||
base = choose_temp_base_try (getenv ("TMP"), base);
|
||||
base = choose_temp_base_try (getenv ("TEMP"), base);
|
||||
|
||||
#ifdef P_tmpdir
|
||||
base = choose_temp_base_try (P_tmpdir, base);
|
||||
#endif
|
||||
|
||||
base = choose_temp_base_try ("/usr/tmp", base);
|
||||
base = choose_temp_base_try ("/tmp", base);
|
||||
|
||||
/* If all else fails, use the current directory! */
|
||||
if (base == (char *)0)
|
||||
base = "./";
|
||||
|
||||
len = strlen (base);
|
||||
temp_filename = xmalloc (len + sizeof("/ccXXXXXX"));
|
||||
strcpy (temp_filename, base);
|
||||
if (len > 0 && temp_filename[len-1] != '/')
|
||||
temp_filename[len++] = '/';
|
||||
strcpy (temp_filename + len, "ccXXXXXX");
|
||||
|
||||
mktemp (temp_filename);
|
||||
temp_filename_length = strlen (temp_filename);
|
||||
if (temp_filename_length == 0)
|
||||
abort ();
|
||||
}
|
||||
|
||||
static void
|
||||
perror_exec (name)
|
||||
char *name;
|
||||
{
|
||||
char *s;
|
||||
|
||||
if (errno < sys_nerr)
|
||||
s = concat ("installation problem, cannot exec %s: ",
|
||||
my_strerror( errno ), "");
|
||||
else
|
||||
s = "installation problem, cannot exec %s";
|
||||
error (s, name);
|
||||
}
|
||||
|
||||
/* This is almost exactly what's in gcc.c:pexecute for MSDOS. */
|
||||
void
|
||||
run_dos (program, argv)
|
||||
char *program;
|
||||
char *argv[];
|
||||
{
|
||||
char *scmd, *rf;
|
||||
FILE *argfile;
|
||||
int i;
|
||||
|
||||
choose_temp_base (); /* not in gcc.c */
|
||||
|
||||
scmd = (char *) malloc (strlen (program) + strlen (temp_filename) + 10);
|
||||
rf = scmd + strlen (program) + 6;
|
||||
sprintf (scmd, "%s.exe @%s.gp", program, temp_filename);
|
||||
|
||||
argfile = fopen (rf, "w");
|
||||
if (argfile == 0)
|
||||
pfatal_with_name (rf);
|
||||
|
||||
for (i=1; argv[i]; i++)
|
||||
{
|
||||
char *cp;
|
||||
for (cp = argv[i]; *cp; cp++)
|
||||
{
|
||||
if (*cp == '"' || *cp == '\'' || *cp == '\\' || isspace (*cp))
|
||||
fputc ('\\', argfile);
|
||||
fputc (*cp, argfile);
|
||||
}
|
||||
fputc ('\n', argfile);
|
||||
}
|
||||
fclose (argfile);
|
||||
|
||||
i = system (scmd);
|
||||
|
||||
remove (rf);
|
||||
|
||||
if (i == -1)
|
||||
perror_exec (program);
|
||||
}
|
||||
#endif /* __MSDOS__ */
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
register int i, j = 0;
|
||||
register char *p;
|
||||
int verbose = 0;
|
||||
|
||||
/* This will be 0 if we encounter a situation where we should not
|
||||
link in libstdc++, or 2 if we should link in libg++ as well. */
|
||||
int library = 1;
|
||||
|
||||
/* Used to track options that take arguments, so we don't go wrapping
|
||||
those with -xc++/-xnone. */
|
||||
char *quote = NULL;
|
||||
|
||||
/* The new argument list will be contained in this. */
|
||||
char **arglist;
|
||||
|
||||
/* The name of the compiler we will want to run---by default, it
|
||||
will be the definition of `GCC_NAME', e.g., `gcc'. */
|
||||
char *gcc = GCC_NAME;
|
||||
|
||||
/* Non-zero if we saw a `-xfoo' language specification on the
|
||||
command line. Used to avoid adding our own -xc++ if the user
|
||||
already gave a language for the file. */
|
||||
int saw_speclang = 0;
|
||||
|
||||
/* Non-zero if we saw `-lm' or `-lmath' on the command line. */
|
||||
char *saw_math = 0;
|
||||
|
||||
/* The number of arguments being added to what's in argv, other than
|
||||
libraries. We use this to track the number of times we've inserted
|
||||
-xc++/-xnone. */
|
||||
int added = 0;
|
||||
|
||||
/* An array used to flag each argument that needs a bit set for
|
||||
LANGSPEC or MATHLIB. */
|
||||
int *args;
|
||||
|
||||
p = argv[0] + strlen (argv[0]);
|
||||
|
||||
/* If we're called as g++ (or i386-aout-g++), link in libg++ as well. */
|
||||
|
||||
if (strcmp (p - 3, "g++") == 0)
|
||||
{
|
||||
library = 2;
|
||||
}
|
||||
|
||||
while (p != argv[0] && p[-1] != '/')
|
||||
--p;
|
||||
programname = p;
|
||||
|
||||
if (argc == 1)
|
||||
fatal ("No input files specified.\n");
|
||||
|
||||
#ifndef __MSDOS__
|
||||
/* We do a little magic to find out where the main gcc executable
|
||||
is. If they ran us as /usr/local/bin/g++, then we will look
|
||||
for /usr/local/bin/gcc; similarly, if they just ran us as `g++',
|
||||
we'll just look for `gcc'. */
|
||||
if (p != argv[0])
|
||||
{
|
||||
*--p = '\0';
|
||||
gcc = (char *) malloc ((strlen (argv[0]) + 1 + strlen (GCC_NAME) + 1)
|
||||
* sizeof (char));
|
||||
sprintf (gcc, "%s/%s", argv[0], GCC_NAME);
|
||||
}
|
||||
#endif
|
||||
|
||||
args = (int *) malloc (argc * sizeof (int));
|
||||
bzero ((char *) args, argc * sizeof (int));
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
/* If the previous option took an argument, we swallow it here. */
|
||||
if (quote)
|
||||
{
|
||||
quote = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (argv[i][0] == '\0' || argv[i][1] == '\0')
|
||||
continue;
|
||||
|
||||
if (argv[i][0] == '-')
|
||||
{
|
||||
if (library != 0 && strcmp (argv[i], "-nostdlib") == 0)
|
||||
{
|
||||
library = 0;
|
||||
}
|
||||
else if (strcmp (argv[i], "-lm") == 0
|
||||
|| strcmp (argv[i], "-lmath") == 0)
|
||||
args[i] |= MATHLIB;
|
||||
else if (strcmp (argv[i], "-v") == 0)
|
||||
{
|
||||
verbose = 1;
|
||||
if (argc == 2)
|
||||
{
|
||||
/* If they only gave us `-v', don't try to link
|
||||
in libg++. */
|
||||
library = 0;
|
||||
}
|
||||
}
|
||||
else if (strncmp (argv[i], "-x", 2) == 0)
|
||||
saw_speclang = 1;
|
||||
else if (((argv[i][2] == '\0'
|
||||
&& (char *)strchr ("bBVDUoeTuIYmLiA", argv[i][1]) != NULL)
|
||||
|| strcmp (argv[i], "-Tdata") == 0))
|
||||
quote = argv[i];
|
||||
else if (library != 0 && ((argv[i][2] == '\0'
|
||||
&& (char *) strchr ("cSEM", argv[i][1]) != NULL)
|
||||
|| strcmp (argv[i], "-MM") == 0))
|
||||
{
|
||||
/* Don't specify libraries if we won't link, since that would
|
||||
cause a warning. */
|
||||
library = 0;
|
||||
}
|
||||
else
|
||||
/* Pass other options through. */
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
int len;
|
||||
|
||||
if (saw_speclang)
|
||||
{
|
||||
saw_speclang = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If the filename ends in .c or .i, put options around it.
|
||||
But not if a specified -x option is currently active. */
|
||||
len = strlen (argv[i]);
|
||||
if (len > 2
|
||||
&& (argv[i][len - 1] == 'c' || argv[i][len - 1] == 'i')
|
||||
&& argv[i][len - 2] == '.')
|
||||
{
|
||||
args[i] |= LANGSPEC;
|
||||
added += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (quote)
|
||||
fatal ("argument to `%s' missing\n", quote);
|
||||
|
||||
if (added || library)
|
||||
{
|
||||
arglist = (char **) malloc ((argc + added + 4) * sizeof (char *));
|
||||
|
||||
for (i = 1, j = 1; i < argc; i++, j++)
|
||||
{
|
||||
arglist[j] = argv[i];
|
||||
|
||||
/* Make sure -lg++ is before the math library, since libg++
|
||||
itself uses those math routines. */
|
||||
if (!saw_math && (args[i] & MATHLIB) && library)
|
||||
{
|
||||
--j;
|
||||
saw_math = argv[i];
|
||||
}
|
||||
|
||||
/* Wrap foo.c and foo.i files in a language specification to
|
||||
force the gcc compiler driver to run cc1plus on them. */
|
||||
if (args[i] & LANGSPEC)
|
||||
{
|
||||
int len = strlen (argv[i]);
|
||||
if (argv[i][len - 1] == 'i')
|
||||
arglist[j++] = "-xc++-cpp-output";
|
||||
else
|
||||
arglist[j++] = "-xc++";
|
||||
arglist[j++] = argv[i];
|
||||
arglist[j] = "-xnone";
|
||||
}
|
||||
}
|
||||
|
||||
/* Add `-lg++' if we haven't already done so. */
|
||||
if (library == 2)
|
||||
arglist[j++] = "-lg++";
|
||||
if (library)
|
||||
arglist[j++] = "-lstdc++";
|
||||
if (saw_math)
|
||||
arglist[j++] = saw_math;
|
||||
else if (library)
|
||||
arglist[j++] = MATH_LIBRARY;
|
||||
|
||||
arglist[j] = NULL;
|
||||
}
|
||||
else
|
||||
/* No need to copy 'em all. */
|
||||
arglist = argv;
|
||||
|
||||
arglist[0] = gcc;
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
if (j == 0)
|
||||
j = argc;
|
||||
|
||||
for (i = 0; i < j; i++)
|
||||
fprintf (stderr, " %s", arglist[i]);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
#if !defined(OS2) && !defined (_WIN32)
|
||||
#ifdef __MSDOS__
|
||||
run_dos (gcc, arglist);
|
||||
#else /* !__MSDOS__ */
|
||||
if (execvp (gcc, arglist) < 0)
|
||||
pfatal_with_name (gcc);
|
||||
#endif /* __MSDOS__ */
|
||||
#else /* OS2 or _WIN32 */
|
||||
if (spawnvp (1, gcc, arglist) < 0)
|
||||
pfatal_with_name (gcc);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,159 +0,0 @@
|
||||
/* Definitions for switches for C++.
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
|
||||
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_LANG_NAME ("C++")
|
||||
|
||||
/* This is the contribution to the `documented_lang_options' array in
|
||||
toplev.c for g++. */
|
||||
|
||||
{ "-faccess-control", "" },
|
||||
{ "-fno-access-control",
|
||||
N_("Do not obey access control semantics") },
|
||||
{ "-falt-external-templates",
|
||||
N_("Change when template instances are emitted") },
|
||||
{ "-fno-alt-external-templates", "" },
|
||||
{ "-fansi-overloading", "" },
|
||||
{ "-fno-ansi-overloading", "" },
|
||||
{ "-fcheck-new",
|
||||
N_("Check the return value of new") },
|
||||
{ "-fno-check-new", "" },
|
||||
{ "-fconserve-space",
|
||||
N_("Reduce size of object files") },
|
||||
{ "-fno-conserve-space", "" },
|
||||
{ "-fconst-strings", "" },
|
||||
{ "-fno-const-strings",
|
||||
N_("Make string literals `char[]' instead of `const char[]'") },
|
||||
{ "-fdefault-inline", "" },
|
||||
{ "-fdump-translation-unit-",
|
||||
N_("Dump the entire translation unit to a file") },
|
||||
{ "-fno-default-inline",
|
||||
N_("Do not inline member functions by default") },
|
||||
{ "-frtti", "" },
|
||||
{ "-fno-rtti",
|
||||
N_("Do not generate run time type descriptor information") },
|
||||
{ "-felide-constructors", "" },
|
||||
{ "-fno-elide-constructors", "" },
|
||||
{ "-fenforce-eh-specs", "" },
|
||||
{ "-fno-enforce-eh-specs",
|
||||
N_("Do not generate code to check exception specifications") },
|
||||
{ "-fexternal-templates", "" },
|
||||
{ "-fno-external-templates", "" },
|
||||
{ "-ffor-scope", "" },
|
||||
{ "-fno-for-scope",
|
||||
N_("Scope of for-init-statement vars extends outside") },
|
||||
{ "-fgnu-keywords", "" },
|
||||
{ "-fno-gnu-keywords",
|
||||
N_("Do not recognize GNU defined keywords") },
|
||||
{ "-fhandle-exceptions", "" },
|
||||
{ "-fno-handle-exceptions", "" },
|
||||
{ "-fhuge-objects",
|
||||
N_("Enable support for huge objects") },
|
||||
{ "-fno-huge-objects", "" },
|
||||
{ "-fimplement-inlines", "" },
|
||||
{ "-fno-implement-inlines",
|
||||
N_("Export functions even if they can be inlined") },
|
||||
{ "-fimplicit-templates", "" },
|
||||
{ "-fno-implicit-templates",
|
||||
N_("Only emit explicit template instantiations") },
|
||||
{ "-fimplicit-inline-templates", "" },
|
||||
{ "-fno-implicit-inline-templates",
|
||||
N_("Only emit explicit instantiations of inline templates") },
|
||||
{ "-finit-priority", "" },
|
||||
{ "-fno-init-priority", "" },
|
||||
{ "-fmemoize-lookups", "" },
|
||||
{ "-fno-memoize-lookups", "" },
|
||||
{ "-fms-extensions",
|
||||
N_("Don't pedwarn about uses of Microsoft extensions") },
|
||||
{ "-fno-ms-extensions", "" },
|
||||
{ "-foperator-names",
|
||||
N_("Recognize and/bitand/bitor/compl/not/or/xor") },
|
||||
{ "-fno-operator-names", "" },
|
||||
{ "-foptional-diags", "" },
|
||||
{ "-fno-optional-diags",
|
||||
N_("Disable optional diagnostics") },
|
||||
{ "-fpermissive",
|
||||
N_("Downgrade conformance errors to warnings") },
|
||||
{ "-fno-permissive", "" },
|
||||
{ "-frepo",
|
||||
N_("Enable automatic template instantiation") },
|
||||
{ "-fno-repo", "" },
|
||||
{ "-fsave-memoized", "" },
|
||||
{ "-fno-save-memoized", "" },
|
||||
{ "-fstats",
|
||||
N_("Display statistics accumulated during compilation") },
|
||||
{ "-fno-stats", "" },
|
||||
{ "-ftemplate-depth-",
|
||||
N_("Specify maximum template instantiation depth") },
|
||||
{ "-fuse-cxa-atexit",
|
||||
N_("Use __cxa_atexit to register destructors") },
|
||||
{ "-fno-use-cxa-atexit", "" },
|
||||
{ "-fvtable-gc",
|
||||
N_("Discard unused virtual functions") },
|
||||
{ "-fno-vtable-gc", "" },
|
||||
{ "-fvtable-thunks",
|
||||
N_("Implement vtables using thunks") },
|
||||
{ "-fno-vtable-thunks", "" },
|
||||
{ "-fweak",
|
||||
N_("Emit common-like symbols as weak symbols") },
|
||||
{ "-fno-weak", "" },
|
||||
{ "-fxref",
|
||||
N_("Emit cross referencing information") },
|
||||
{ "-fno-xref", "" },
|
||||
|
||||
{ "-Wreturn-type",
|
||||
N_("Warn about inconsistent return types") },
|
||||
{ "-Wno-return-type", "" },
|
||||
{ "-Woverloaded-virtual",
|
||||
N_("Warn about overloaded virtual function names") },
|
||||
{ "-Wno-overloaded-virtual", "" },
|
||||
{ "-Wctor-dtor-privacy", "" },
|
||||
{ "-Wno-ctor-dtor-privacy",
|
||||
N_("Don't warn when all ctors/dtors are private") },
|
||||
{ "-Wnon-virtual-dtor",
|
||||
N_("Warn about non virtual destructors") },
|
||||
{ "-Wno-non-virtual-dtor", "" },
|
||||
{ "-Wextern-inline",
|
||||
N_("Warn when a function is declared extern, then inline") },
|
||||
{ "-Wno-extern-inline", "" },
|
||||
{ "-Wreorder",
|
||||
N_("Warn when the compiler reorders code") },
|
||||
{ "-Wno-reorder", "" },
|
||||
{ "-Wsynth",
|
||||
N_("Warn when synthesis behavior differs from Cfront") },
|
||||
{ "-Wno-synth", "" },
|
||||
{ "-Wpmf-conversions", "" },
|
||||
{ "-Wno-pmf-conversions",
|
||||
N_("Don't warn when type converting pointers to member functions") },
|
||||
{ "-Weffc++",
|
||||
N_("Warn about violations of Effective C++ style rules") },
|
||||
{ "-Wno-effc++", "" },
|
||||
{ "-Wsign-promo",
|
||||
N_("Warn when overload promotes from unsigned to signed") },
|
||||
{ "-Wno-sign-promo", "" },
|
||||
{ "-Wold-style-cast",
|
||||
N_("Warn if a C style cast is used in a program") },
|
||||
{ "-Wno-old-style-cast", "" },
|
||||
{ "-Wnon-template-friend", "" },
|
||||
{ "-Wno-non-template-friend",
|
||||
N_("Don't warn when non-templatized friend functions are declared within a template") },
|
||||
{ "-Wdeprecated", "" },
|
||||
{ "-Wno-deprecated",
|
||||
N_("Don't announce deprecation of compiler features") },
|
File diff suppressed because it is too large
Load Diff
@ -1,752 +0,0 @@
|
||||
\input texinfo @c -*- Texinfo -*-
|
||||
@setfilename reno-1.info
|
||||
|
||||
@ifinfo
|
||||
@format
|
||||
START-INFO-DIR-ENTRY
|
||||
* Reno 1: (reno-1). The GNU C++ Renovation Project, Phase 1.
|
||||
END-INFO-DIR-ENTRY
|
||||
@end format
|
||||
@end ifinfo
|
||||
|
||||
@ifinfo
|
||||
Copyright @copyright{} 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
@ignore
|
||||
Permission is granted to process this file through TeX and print the
|
||||
results, provided the printed document carries a copying permission
|
||||
notice identical to this one except for the removal of this paragraph
|
||||
(this paragraph not being relevant to the printed manual).
|
||||
|
||||
@end ignore
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided also that
|
||||
the entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions.
|
||||
@end ifinfo
|
||||
|
||||
@setchapternewpage odd
|
||||
@settitle GNU C++ Renovation Project
|
||||
@c @smallbook
|
||||
|
||||
@titlepage
|
||||
@finalout
|
||||
@title GNU C++ Renovation Project
|
||||
@subtitle Phase 1.3
|
||||
@author Brendan Kehoe, Jason Merrill,
|
||||
@author Mike Stump, Michael Tiemann
|
||||
@page
|
||||
|
||||
Edited March, 1994 by Roland Pesch (@code{pesch@@cygnus.com})
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
@ignore
|
||||
Permission is granted to process this file through Tex and print the
|
||||
results, provided the printed document carries copying permission
|
||||
notice identical to this one except for the removal of this paragraph
|
||||
(this paragraph not being relevant to the printed manual).
|
||||
@end ignore
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided also that
|
||||
the entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions.
|
||||
@end titlepage
|
||||
|
||||
@ifinfo
|
||||
@node Top
|
||||
@top @sc{gnu} C++ Renovation Project
|
||||
|
||||
This file describes the goals of the @sc{gnu} C++ Renovation Project,
|
||||
and its accomplishments to date (as of Phase 1.3).
|
||||
|
||||
It also discusses the remaining divergences from @sc{gnu} C++, and how the
|
||||
name encoding in @sc{gnu} C++ differs from the sample encoding in
|
||||
@cite{The Annotated C++ Reference Manual}.
|
||||
@c This is not a good place to introduce the acronym ARM because it's
|
||||
@c info-only.
|
||||
|
||||
@menu
|
||||
* Introduction:: What is the GNU C++ Renovation Project?
|
||||
* Changes:: Summary of changes since previous GNU C++ releases.
|
||||
* Plans:: Plans for Reno-2.
|
||||
* Templates:: The template implementation.
|
||||
* ANSI:: GNU C++ conformance to ANSI C++.
|
||||
* Encoding:: Name encoding in GNU C++.
|
||||
@end menu
|
||||
|
||||
@end ifinfo
|
||||
|
||||
@node Introduction
|
||||
@chapter Introduction
|
||||
|
||||
As you may remember, @sc{gnu} C++ was the first native-code C++
|
||||
compiler available under Unix (December 1987). In November 1988, it was
|
||||
judged superior to the AT&T compiler in a Unix World review. In 1990 it
|
||||
won a Sun Observer ``Best-Of'' award. But now, with new requirements
|
||||
coming out of the @sc{ansi} C++ committee and a growing backlog of bugs, it's
|
||||
clear that @sc{gnu} C++ needs an overhaul.
|
||||
|
||||
The C++ language has been under development since 1982. It has
|
||||
evolved significantly since its original incarnation (C with Classes),
|
||||
addressing many commercial needs and incorporating many lessons
|
||||
learned as more and more people started using ``object-oriented''
|
||||
programming techniques. In 1989, the first X3J16 committee meeting
|
||||
was held in Washington DC; in the interest of users, C++ was going to
|
||||
be standardized.
|
||||
|
||||
As C++ has become more popular, more demands have been placed on its
|
||||
compilers. Some compilers are up to the demands, others are not.
|
||||
@sc{gnu} C++ was used to prototype several features which have since
|
||||
been incorporated into the standard, most notably exception handling.
|
||||
While @sc{gnu} C++ has been an excellent experimental vehicle, it did
|
||||
not have the resources that AT&T, Borland, or Microsoft have at their
|
||||
disposal.
|
||||
|
||||
We believe that @sc{gnu} C++ is an important compiler, providing users with
|
||||
many of the features that have made @sc{gnu} C so popular: fast compilation,
|
||||
good error messages, innovative features, and full sources that may be
|
||||
freely redistributed. The purpose of this overhaul, dubbed the @var{@sc{gnu}
|
||||
C++ Renovation Project}, is to take advantage of the functionality that
|
||||
@sc{gnu} C++ offers today, to strengthen its base technology, and put it in a
|
||||
position to remain---as other @sc{gnu} software currently is---the technical
|
||||
leader in the field.
|
||||
|
||||
This release represents the latest phase of work in strengthening the
|
||||
compiler on a variety of points. It includes many months of
|
||||
work concentrated on fixing many of the more egregious bugs that
|
||||
presented themselves in the compiler recently.
|
||||
@ignore
|
||||
@c FIXME-- update?
|
||||
Nearly 85% of all bugs reported in the period of February to September
|
||||
of 1992 were fixed as part of the work in the first phase.
|
||||
@end ignore
|
||||
In the coming months, we hope to continue expanding and enhancing the
|
||||
quality and dependability of the industry's only freely redistributable
|
||||
C++ compiler.
|
||||
|
||||
@node Changes
|
||||
@chapter Changes in Behavior in @sc{gnu} C++
|
||||
|
||||
The @sc{gnu} C++ compiler continues to improve and change. A major goal
|
||||
of our work has been to continue to bring the compiler into compliance
|
||||
with the draft @sc{ansi} C++ standard, and with @cite{The Annotated C++
|
||||
Reference Manual} (the @sc{arm}). This section outlines most of the
|
||||
user-noticeable changes that might be encountered during the normal
|
||||
course of use.
|
||||
|
||||
@menu
|
||||
* Summary of Phase 1.3::
|
||||
* Major changes::
|
||||
* New features::
|
||||
* Enhancements and bug fixes::
|
||||
* Problems with debugging::
|
||||
@end menu
|
||||
|
||||
@node Summary of Phase 1.3
|
||||
@section Summary of Changes in Phase 1.3
|
||||
|
||||
The bulk of this note discusses the cumulative effects of the @sc{gnu} C++
|
||||
Renovation Project to date. The work during its most recent phase (1.3)
|
||||
had these major effects:
|
||||
|
||||
@itemize @bullet
|
||||
@item The standard compiler driver @code{g++} is now the faster compiled
|
||||
version, rather than a shell script.
|
||||
|
||||
@item Nested types work much better; notably, nesting is no longer
|
||||
restricted to nine levels.
|
||||
|
||||
@item Better @sc{arm} conformance on member access control.
|
||||
|
||||
@item The compiler now always generates default assignment operators
|
||||
(@samp{operator =}), copy constructors (@samp{X::X(X&)}), and default
|
||||
constructors (@samp{X::X()}) whenever they are required.
|
||||
|
||||
@item The new draft @sc{ansi} standard keyword @code{mutable} is supported.
|
||||
|
||||
@item @samp{-fansi-overloading} is the default, to comply better with
|
||||
the @sc{arm} (at some cost in compatibility to earlier versions of @sc{gnu} C++).
|
||||
|
||||
@item More informative error messages.
|
||||
|
||||
@item System include files are automatically treated as if they were
|
||||
wrapped in @samp{extern "C" @{ @}}.
|
||||
|
||||
@item The new option @samp{-falt-external-templates} provides alternate
|
||||
template instantiation semantics.
|
||||
|
||||
@item Operator declarations are now checked more strictly.
|
||||
|
||||
@item You can now use template type arguments in the template parameter list.
|
||||
|
||||
@item You can call the destructor for any type.
|
||||
|
||||
@item The compiler source code is better organized.
|
||||
|
||||
@item You can specify where to instantiate template definitions explicitly.
|
||||
@end itemize
|
||||
|
||||
Much of the work in Phase 1.3 went to elimination of known bugs, as well
|
||||
as the major items above.
|
||||
|
||||
During the span of Phase 1.3, there were also two changes associated
|
||||
with the compiler that, while not specifically part of the C++
|
||||
Renovation project, may be of interest:
|
||||
|
||||
@itemize @bullet
|
||||
@item @code{gcov}, a code coverage tool for @sc{gnu cc}, is now available
|
||||
from Cygnus Support. (@code{gcov} is free software, but the @sc{fsf} has not
|
||||
yet accepted it.) @xref{Gcov,, @code{gcov}: a Test Coverage Program,
|
||||
gcc.info, Using GNU CC}, for more information (in Cygnus releases of
|
||||
that manual).
|
||||
|
||||
@item @sc{gnu} C++ now supports @dfn{signatures}, a language extension to
|
||||
provide more flexibility in abstract type definitions. @xref{C++
|
||||
Signatures,, Type Abstraction using Signatures, gcc.info, Using GNU CC}.
|
||||
@end itemize
|
||||
|
||||
@node Major changes
|
||||
@section Major Changes
|
||||
|
||||
This release includes four wholesale rewrites of certain areas of
|
||||
compiler functionality:
|
||||
|
||||
@enumerate 1
|
||||
@item Argument matching. @sc{gnu} C++ is more compliant with the rules
|
||||
described in Chapter 13, ``Overloading'', of the @sc{arm}. This behavior is
|
||||
the default, though you can specify it explicitly with
|
||||
@samp{-fansi-overloading}. For compatibility with earlier releases of
|
||||
@sc{gnu} C++, specify @samp{-fno-ansi-overloading}; this makes the compiler
|
||||
behave as it used to with respect to argument matching and name overloading.
|
||||
|
||||
@item Default constructors/destructors. Section 12.8 of the @sc{arm}, ``Copying
|
||||
Class Objects'', and Section 12.1, ``Constructors'', state that a
|
||||
compiler must declare such default functions if the user does not
|
||||
specify them. @sc{gnu} C++ now declares, and generates when necessary,
|
||||
the defaults for constructors and destructors you might omit. In
|
||||
particular, assignment operators (@samp{operator =}) behave the same way
|
||||
whether you define them, or whether the compiler generates them by
|
||||
default; taking the address of the default @samp{operator =} is now
|
||||
guaranteed to work. Default copy constructors (@samp{X::X(X&)}) now
|
||||
function correctly, rather than calling the copy assignment operator for
|
||||
the base class. Finally, constructors (@samp{X::X()}), as well as
|
||||
assignment operators and copy constructors, are now available whenever
|
||||
they are required.
|
||||
|
||||
@c XXX This may be taken out eventually...
|
||||
@item Binary incompatibility. There are no new binary incompatibilities
|
||||
in Phase 1.3, but Phase 1.2 introduced two binary incompatibilities with
|
||||
earlier releases. First, the functionality of @samp{operator
|
||||
new} and @samp{operator delete} changed. Name encoding
|
||||
(``mangling'') of virtual table names changed as well. Libraries
|
||||
built with versions of the compiler earlier than Phase 1.2 must be
|
||||
compiled with the new compiler. (This includes the Cygnus Q2
|
||||
progressive release and the FSF 2.4.5 release.)
|
||||
|
||||
@item New @code{g++} driver.
|
||||
A new binary @code{g++} compiler driver replaces the shell script.
|
||||
The new driver executes faster.
|
||||
@end enumerate
|
||||
|
||||
@node New features
|
||||
@section New features
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
The compiler warns when a class contains only private constructors
|
||||
or destructors, and has no friends. At the request of some of our
|
||||
customers, we have added a new option, @samp{-Wctor-dtor-privacy} (on by
|
||||
default), and its negation, @samp{-Wno-ctor-dtor-privacy}, to control
|
||||
the emission of this warning. If, for example, you are working towards
|
||||
making your code compile warning-free, you can use @w{@samp{-Wall
|
||||
-Wno-ctor-dtor-privacy}} to find the most common warnings.
|
||||
|
||||
@item
|
||||
There is now a mechanism which controls exactly when templates are
|
||||
expanded, so that you can reduce memory usage and program size and also
|
||||
instantiate them exactly once. You can control this mechanism with the
|
||||
option @samp{-fexternal-templates} and its corresponding negation
|
||||
@samp{-fno-external-templates}. Without this feature, space consumed by
|
||||
template instantiations can grow unacceptably in large-scale projects
|
||||
with many different source files. The default is
|
||||
@samp{-fno-external-templates}.
|
||||
|
||||
You do not need to use the @samp{-fexternal-templates} option when
|
||||
compiling a file that does not define and instantiate templates used in
|
||||
other files, even if those files @emph{are} compiled with
|
||||
@samp{-fexternal-templates}. The only side effect is an increase in
|
||||
object size for each file that was compiled without
|
||||
@samp{-fexternal-templates}.
|
||||
|
||||
When your code is compiled with @samp{-fexternal-templates}, all
|
||||
template instantiations are external; this requires that the templates
|
||||
be under the control of @samp{#pragma interface} and @samp{#pragma
|
||||
implementation}. All instantiations that will be needed should be in
|
||||
the implementation file; you can do this with a @code{typedef} that
|
||||
references the instantiation needed. Conversely, when you compile using
|
||||
the option @samp{-fno-external-templates}, all template instantiations are
|
||||
explicitly internal.
|
||||
|
||||
@samp{-fexternal-templates} also allows you to finally separate class
|
||||
template function definitions from their declarations, thus speeding up
|
||||
compilation times for every file that includes the template declaration.
|
||||
Now you can have tens or even hundreds of lines in template
|
||||
declarations, and thousands or tens of thousands of lines in template
|
||||
definitions, with the definitions only going through the compiler once
|
||||
instead of once for each source file. It is important to note that you
|
||||
must remember to externally instantiate @emph{all} templates that are
|
||||
used from template declarations in interface files. If you forget to do
|
||||
this, unresolved externals will occur.
|
||||
|
||||
In the example below, the object file generated (@file{example.o}) will
|
||||
contain the global instantiation for @samp{Stack<int>}. If other types
|
||||
of @samp{Stack} are needed, they can be added to @file{example.cc} or
|
||||
placed in a new file, in the same spirit as @file{example.cc}.
|
||||
|
||||
@code{foo.h}:
|
||||
@smallexample
|
||||
@group
|
||||
#pragma interface "foo.h"
|
||||
template<class T>
|
||||
class Stack @{
|
||||
static int statc;
|
||||
static T statc2;
|
||||
Stack() @{ @}
|
||||
virtual ~Stack() @{ @}
|
||||
int bar();
|
||||
@};
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
@code{example.cc}:
|
||||
@smallexample
|
||||
@group
|
||||
#pragma implementation "foo.h"
|
||||
#include "foo.h"
|
||||
|
||||
typedef Stack<int> t;
|
||||
int Stack<int>::statc;
|
||||
int Stack<int>::statc2;
|
||||
int Stack<int>::bar() @{ @}
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
Note that using @samp{-fexternal-templates} does not reduce memory usage
|
||||
from completely different instantiations (@samp{Stack<Name>} vs.
|
||||
@samp{Stack<Net_Connection>}), but only collapses different occurrences
|
||||
of @samp{Stack<Name>} so that only one @samp{Stack<Name>} is generated.
|
||||
|
||||
@samp{-falt-external-templates} selects a slight variation in the
|
||||
semantics described above (incidentally, you need not specify both
|
||||
options; @samp{-falt-external-templates} implies
|
||||
@samp{-fexternal-templates}).
|
||||
|
||||
With @samp{-fexternal-templates}, the compiler emits a definition in the
|
||||
implementation file that includes the header definition, @emph{even if}
|
||||
instantiation is triggered from a @emph{different} implementation file
|
||||
(e.g. with a template that uses another template).
|
||||
|
||||
With @samp{-falt-external-templates}, the definition always goes in the
|
||||
implementation file that triggers instantiation.
|
||||
|
||||
For instance, with these two header files---
|
||||
|
||||
@example
|
||||
@exdent @file{a.h}:
|
||||
#pragma interface
|
||||
template <class T> class A @{ @dots{} @};
|
||||
|
||||
@exdent @file{b.h}:
|
||||
#pragma interface
|
||||
class B @{ @dots{} @};
|
||||
void f (A<B>);
|
||||
@end example
|
||||
|
||||
Under @samp{-fexternal-templates}, the definition of @samp{A<B>} ends up
|
||||
in the implementation file that includes @file{a.h}. Under
|
||||
@samp{-falt-external-templates}, the same definition ends up in the
|
||||
implementation file that includes @file{b.h}.
|
||||
|
||||
@item
|
||||
You can control explicitly where a template is instantiated, without
|
||||
having to @emph{use} the template to get an instantiation.
|
||||
|
||||
To instantiate a class template explicitly, write @samp{template
|
||||
class @var{name}<paramvals>}, where @var{paramvals} is a list of values
|
||||
for the template parameters. For example, you might write
|
||||
|
||||
@example
|
||||
template class A<int>
|
||||
@end example
|
||||
|
||||
Similarly, to instantiate a function template explicitly, write
|
||||
@samp{template @var{fnsign}} where @var{fnsign} is the particular
|
||||
function signature you need. For example, you might write
|
||||
|
||||
@example
|
||||
template void foo (int, int)
|
||||
@end example
|
||||
|
||||
This syntax for explicit template instantiation agrees with recent
|
||||
extensions to the draft @sc{ansi} standard.
|
||||
|
||||
@item
|
||||
The compiler's actions on @sc{ansi}-related warnings and errors have
|
||||
been further enhanced. The @samp{-pedantic-errors} option produces
|
||||
error messages in a number of new situations: using @code{return} in a
|
||||
non-@code{void} function (one returning a value); declaring a local
|
||||
variable that shadows a parameter (e.g., the function takes an argument
|
||||
@samp{a}, and has a local variable @samp{a}); and use of the @samp{asm}
|
||||
keyword. Finally, the compiler by default now issues a warning when
|
||||
converting from an @code{int} to an enumerated type. This is likely to
|
||||
cause many new warnings in code that hadn't triggered them before. For
|
||||
example, when you compile this code,
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
enum boolean @{ false, true @};
|
||||
void
|
||||
f ()
|
||||
@{
|
||||
boolean x;
|
||||
|
||||
x = 1; //@i{assigning an @code{int} to an @code{enum} now triggers a warning}
|
||||
@}
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
you should see the warning ``@code{anachronistic conversion from integer
|
||||
type to enumeral type `boolean'}''. Instead of assigning the value 1,
|
||||
assign the original enumerated value @samp{true}.
|
||||
@end itemize
|
||||
|
||||
@node Enhancements and bug fixes
|
||||
@section Enhancements and bug fixes
|
||||
|
||||
@itemize @bullet
|
||||
@cindex nested types in template parameters
|
||||
@item
|
||||
You can now use nested types in a template parameter list, even if the nested
|
||||
type is defined within the same class that attempts to use the template.
|
||||
For example, given a template @code{list}, the following now works:
|
||||
|
||||
@smallexample
|
||||
struct glyph @{
|
||||
@dots{}
|
||||
struct stroke @{ @dots{} @};
|
||||
list<stroke> l;
|
||||
@dots{}
|
||||
@}
|
||||
@end smallexample
|
||||
|
||||
@cindex function pointers vs template parameters
|
||||
@item
|
||||
Function pointers now work in template parameter lists. For
|
||||
example, you might want to instantiate a parameterized @code{list} class
|
||||
in terms of a pointer to a function like this:
|
||||
|
||||
@smallexample
|
||||
list<int (*)(int, void *)> fnlist;
|
||||
@end smallexample
|
||||
|
||||
@item
|
||||
@c FIXME! Really no limit? Jason said "deeper than 9" now OK...
|
||||
Nested types are now handled correctly. In particular, there is no
|
||||
longer a limit to how deeply you can nest type definitions.
|
||||
|
||||
@item
|
||||
@sc{gnu} C++ now conforms to the specifications in Chapter 11 of the
|
||||
@sc{arm}, ``Member Access Control''.
|
||||
|
||||
@item
|
||||
The @sc{ansi} C++ committee has introduced a new keyword @code{mutable}.
|
||||
@sc{gnu} C++ supports it. Use @code{mutable} to specify that some
|
||||
particular members of a @code{const} class are @emph{not} constant. For
|
||||
example, you can use this to include a cache in a data structure that
|
||||
otherwise represents a read-only database.
|
||||
|
||||
@item
|
||||
Error messages now explicitly specify the declaration, type, or
|
||||
expression that contains an error.
|
||||
|
||||
@item
|
||||
To avoid copying and editing all system include files during @sc{gnu}
|
||||
C++ installation, the compiler now automatically recognizes system
|
||||
include files as C language definitions, as if they were wrapped in
|
||||
@samp{extern "C" @{ @dots{} @}}.
|
||||
|
||||
@item
|
||||
The compiler checks operator declarations more strictly. For example,
|
||||
you may no longer declare an @samp{operator +} with three arguments.
|
||||
|
||||
@item
|
||||
You can now use template type arguments in the same template
|
||||
parameter list where the type argument is specified (as well as in the
|
||||
template body). For example, you may write
|
||||
|
||||
@example
|
||||
template <class T, T t> class A @{ @dots{} @};
|
||||
@end example
|
||||
|
||||
@item
|
||||
Destructors are now available for all types, even built-in ones; for
|
||||
example, you can call @samp{int::~int}. (Destructors for types like
|
||||
@code{int} do not actually do anything, but their existence provides a
|
||||
level of generality that permits smooth template expansion in more
|
||||
cases.)
|
||||
|
||||
@item
|
||||
Enumerated types declared inside a class are now handled correctly.
|
||||
|
||||
@item
|
||||
An argument list for a function may not use an initializer list for its default
|
||||
value. For example, @w{@samp{void foo ( T x = @{ 1, 2 @} )}} is not permitted.
|
||||
|
||||
@item
|
||||
A significant amount of work went into improving the ability of the
|
||||
compiler to act accurately on multiple inheritance and virtual
|
||||
functions. Virtual function dispatch has been enhanced as well.
|
||||
|
||||
@item
|
||||
The warning concerning a virtual inheritance environment with a
|
||||
non-virtual destructor has been disabled, since it is not clear that
|
||||
such a warning is warranted.
|
||||
|
||||
@item
|
||||
Until exception handling is fully implemented in the Reno-2 release, use
|
||||
of the identifiers @samp{catch}, @samp{throw}, or @samp{try} results
|
||||
in the warning:
|
||||
|
||||
@smallexample
|
||||
t.C:1: warning: `catch', `throw', and `try'
|
||||
are all C++ reserved words
|
||||
@end smallexample
|
||||
|
||||
@item
|
||||
When giving a warning or error concerning initialization of a member in a
|
||||
class, the compiler gives the name of the member if it has one.
|
||||
|
||||
@item
|
||||
Detecting friendship between classes is more accurately checked.
|
||||
|
||||
@item
|
||||
The syntaxes of @w{@samp{#pragma implementation "file.h"}} and
|
||||
@samp{#pragma interface} are now more strictly controlled. The compiler
|
||||
notices (and warns) when any text follows @file{file.h} in the
|
||||
implementation pragma, or follows the word @samp{interface}. Any such
|
||||
text is otherwise ignored.
|
||||
|
||||
@item
|
||||
Trying to declare a template on a variable or type is now considered an
|
||||
error, not an unimplemented feature.
|
||||
|
||||
@item
|
||||
When an error occurs involving a template, the compiler attempts to
|
||||
tell you at which point of instantiation the error occurred, in
|
||||
addition to noting the line in the template declaration which had the
|
||||
actual error.
|
||||
|
||||
@item
|
||||
The symbol names for function templates in the resulting assembly file
|
||||
are now encoded according to the arguments, rather than just being
|
||||
emitted as, for example, two definitions of a function @samp{foo}.
|
||||
|
||||
@item
|
||||
Template member functions that are declared @code{static} no longer
|
||||
receive a @code{this} pointer.
|
||||
|
||||
@item
|
||||
Case labels are no longer allowed to have commas to make up their
|
||||
expressions.
|
||||
|
||||
@item
|
||||
Warnings concerning the shift count of a left or right shift now tell
|
||||
you if it was a @samp{left} or @samp{right} shift.
|
||||
|
||||
@item
|
||||
The compiler now warns when a decimal constant is so large that it
|
||||
becomes @code{unsigned}.
|
||||
|
||||
@item
|
||||
Union initializers which are raw constructors are now handled properly.
|
||||
|
||||
@item
|
||||
The compiler no longer gives incorrect errors when initializing a
|
||||
union with an empty initializer list.
|
||||
|
||||
@item
|
||||
Anonymous unions are now correctly used when nested inside a class.
|
||||
|
||||
@item
|
||||
Anonymous unions declared as static class members are now handled
|
||||
properly.
|
||||
|
||||
@item
|
||||
The compiler now notices when a field in a class is declared both as
|
||||
a type and a non-type.
|
||||
|
||||
@item
|
||||
The compiler now warns when a user-defined function shadows a
|
||||
built-in function, rather than emitting an error.
|
||||
|
||||
@item
|
||||
A conflict between two function declarations now produces an error
|
||||
regardless of their language context.
|
||||
|
||||
@item
|
||||
Duplicate definitions of variables with @samp{extern "C"} linkage are no
|
||||
longer considered in error. (Note in C++ linkage---the default---you may
|
||||
not have more than one definition of a variable.)
|
||||
|
||||
@item
|
||||
Referencing a label that is not defined in any function is now an error.
|
||||
|
||||
@item
|
||||
The syntax for pointers to methods has been improved; there are still
|
||||
some minor bugs, but a number of cases should now be accepted by the
|
||||
compiler.
|
||||
|
||||
@item
|
||||
In error messages, arguments are now numbered starting at 1, instead of
|
||||
0. Therefore, in the function @samp{void foo (int a, int b)}, the
|
||||
argument @samp{a} is argument 1, and @samp{b} is argument 2. There is
|
||||
no longer an argument 0.
|
||||
|
||||
@item
|
||||
The tag for an enumerator, rather than its value, used as a default
|
||||
argument is now shown in all error messages. For example, @w{@samp{void
|
||||
foo (enum x (= true))}} is shown instead of @w{@samp{void foo (enum x (=
|
||||
1))}}.
|
||||
|
||||
@item
|
||||
The @samp{__asm__} keyword is now accepted by the C++ front-end.
|
||||
|
||||
@item
|
||||
Expressions of the form @samp{foo->~Class()} are now handled properly.
|
||||
|
||||
@item
|
||||
The compiler now gives better warnings for situations which result in
|
||||
integer overflows (e.g., in storage sizes, enumerators, unary
|
||||
expressions, etc).
|
||||
|
||||
@item
|
||||
@code{unsigned} bitfields are now promoted to @code{signed int} if the
|
||||
field isn't as wide as an @code{int}.
|
||||
|
||||
@item
|
||||
Declaration and usage of prefix and postfix @samp{operator ++} and
|
||||
@samp{operator --} are now handled correctly. For example,
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
class foo
|
||||
@{
|
||||
public:
|
||||
operator ++ ();
|
||||
operator ++ (int);
|
||||
operator -- ();
|
||||
operator -- (int);
|
||||
@};
|
||||
|
||||
void
|
||||
f (foo *f)
|
||||
@{
|
||||
f++; // @i{call @code{f->operator++(int)}}
|
||||
++f; // @i{call @code{f->operator++()}}
|
||||
f--; // @i{call @code{f->operator++(int)}}
|
||||
--f; // @i{call @code{f->operator++()}}
|
||||
@}
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
@item
|
||||
In accordance with @sc{arm} section 10.1.1, ambiguities and dominance are now
|
||||
handled properly. The rules described in section 10.1.1 are now fully
|
||||
implemented.
|
||||
|
||||
@end itemize
|
||||
|
||||
@node Problems with debugging
|
||||
@section Problems with debugging
|
||||
|
||||
Two problems remain with regard to debugging:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Debugging of anonymous structures on the IBM RS/6000 host is incorrect.
|
||||
|
||||
@item
|
||||
Symbol table size is overly large due to redundant symbol information;
|
||||
this can make @code{gdb} coredump under certain circumstances. This
|
||||
problem is not host-specific.
|
||||
@end itemize
|
||||
|
||||
@node Plans
|
||||
@chapter Plans for Reno-2
|
||||
|
||||
The overall goal for the second phase of the @sc{gnu} C++ Renovation
|
||||
Project is to bring @sc{gnu} C++ to a new level of reliability, quality,
|
||||
and competitiveness. As particular elements of this strategy, we intend
|
||||
to:
|
||||
|
||||
@enumerate 0
|
||||
@item
|
||||
Fully implement @sc{ansi} exception handling.
|
||||
|
||||
@item
|
||||
With the exception handling, add Runtime Type Identification
|
||||
(@sc{rtti}), if the @sc{ansi} committee adopts it into the standard.
|
||||
|
||||
@item
|
||||
Bring the compiler into closer compliance with the @sc{arm} and the draft
|
||||
@sc{ansi} standard, and document what points in the @sc{arm} we do not yet comply,
|
||||
or agree, with.
|
||||
|
||||
@item
|
||||
Add further support for the @sc{dwarf} debugging format.
|
||||
|
||||
@item
|
||||
Finish the work to make the compiler compliant with @sc{arm} Section 12.6.2,
|
||||
initializing base classes in declaration order, rather than in the order
|
||||
that you specify them in a @var{mem-initializer} list.
|
||||
|
||||
@item
|
||||
Perform a full coverage analysis on the compiler, and weed out unused
|
||||
code, for a gain in performance and a reduction in the size of the compiler.
|
||||
|
||||
@item
|
||||
Further improve the multiple inheritance implementation in the
|
||||
compiler to make it cleaner and more complete.
|
||||
@end enumerate
|
||||
|
||||
@noindent
|
||||
As always, we encourage you to make suggestions and ask questions about
|
||||
@sc{gnu} C++ as a whole, so we can be sure that the end of this project
|
||||
will bring a compiler that everyone will find essential for C++ and will
|
||||
meet the needs of the world's C++ community.
|
||||
|
||||
@include templates.texi
|
||||
|
||||
@include gpcompare.texi
|
||||
|
||||
@contents
|
||||
|
||||
@bye
|
File diff suppressed because it is too large
Load Diff
@ -1,432 +0,0 @@
|
||||
/* Preprocess only, using cpplib.
|
||||
Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
Free Software Foundation, Inc.
|
||||
Written by Per Bothner, 1994-95.
|
||||
|
||||
This program 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.
|
||||
|
||||
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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
In other words, you are welcome to use, share and improve this program.
|
||||
You are forbidden to forbid anyone else to use, share and improve
|
||||
what you give them. Help stamp out software-hoarding! */
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "cpplib.h"
|
||||
#include "cpphash.h"
|
||||
|
||||
static void setup_callbacks PARAMS ((cpp_reader *));
|
||||
|
||||
/* General output routines. */
|
||||
static void scan_translation_unit PARAMS ((cpp_reader *));
|
||||
static void scan_translation_unit_trad PARAMS ((cpp_reader *));
|
||||
static void account_for_newlines PARAMS ((cpp_reader *, const uchar *,
|
||||
size_t));
|
||||
static int dump_macro PARAMS ((cpp_reader *, cpp_hashnode *, void *));
|
||||
|
||||
static void print_line PARAMS ((cpp_reader *, const struct line_map *,
|
||||
unsigned int, const char *));
|
||||
static void maybe_print_line PARAMS ((cpp_reader *, const struct line_map *,
|
||||
unsigned int));
|
||||
|
||||
/* Callback routines for the parser. Most of these are active only
|
||||
in specific modes. */
|
||||
static void cb_line_change PARAMS ((cpp_reader *, const cpp_token *, int));
|
||||
static void cb_define PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
|
||||
static void cb_undef PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
|
||||
static void cb_include PARAMS ((cpp_reader *, unsigned int,
|
||||
const unsigned char *, const cpp_token *));
|
||||
static void cb_ident PARAMS ((cpp_reader *, unsigned int,
|
||||
const cpp_string *));
|
||||
static void cb_file_change PARAMS ((cpp_reader *, const struct line_map *));
|
||||
static void cb_def_pragma PARAMS ((cpp_reader *, unsigned int));
|
||||
|
||||
/* Preprocess and output. */
|
||||
void
|
||||
cpp_preprocess_file (pfile, in_fname, out_stream)
|
||||
cpp_reader *pfile;
|
||||
const char *in_fname;
|
||||
FILE *out_stream;
|
||||
{
|
||||
/* Initialize the printer structure. Setting print.line to -1 here
|
||||
is a trick to guarantee that the first token of the file will
|
||||
cause a linemarker to be output by maybe_print_line. */
|
||||
pfile->print.line = (unsigned int) -1;
|
||||
pfile->print.printed = 0;
|
||||
pfile->print.prev = 0;
|
||||
pfile->print.map = 0;
|
||||
pfile->print.outf = out_stream;
|
||||
|
||||
setup_callbacks (pfile);
|
||||
|
||||
if (cpp_read_main_file (pfile, in_fname, NULL))
|
||||
{
|
||||
cpp_options *options = &pfile->opts;
|
||||
cpp_finish_options (pfile);
|
||||
|
||||
/* A successful cpp_read_main_file guarantees that we can call
|
||||
cpp_scan_nooutput or cpp_get_token next. */
|
||||
if (options->no_output)
|
||||
{
|
||||
/* Scan -included buffers, then the main file. */
|
||||
while (pfile->buffer->prev)
|
||||
cpp_scan_nooutput (pfile);
|
||||
cpp_scan_nooutput (pfile);
|
||||
}
|
||||
else if (options->traditional)
|
||||
scan_translation_unit_trad (pfile);
|
||||
else
|
||||
scan_translation_unit (pfile);
|
||||
|
||||
/* -dM command line option. Should this be in cpp_finish? */
|
||||
if (options->dump_macros == dump_only)
|
||||
cpp_forall_identifiers (pfile, dump_macro, NULL);
|
||||
}
|
||||
|
||||
/* Flush any pending output. */
|
||||
if (pfile->print.printed)
|
||||
putc ('\n', pfile->print.outf);
|
||||
}
|
||||
|
||||
/* Set up the callbacks as appropriate. */
|
||||
static void
|
||||
setup_callbacks (pfile)
|
||||
cpp_reader *pfile;
|
||||
{
|
||||
cpp_options *options = &pfile->opts;
|
||||
cpp_callbacks *cb = cpp_get_callbacks (pfile);
|
||||
|
||||
if (! options->no_output)
|
||||
{
|
||||
cb->line_change = cb_line_change;
|
||||
/* Don't emit #pragma or #ident directives if we are processing
|
||||
assembly language; the assembler may choke on them. */
|
||||
if (options->lang != CLK_ASM)
|
||||
{
|
||||
cb->ident = cb_ident;
|
||||
cb->def_pragma = cb_def_pragma;
|
||||
}
|
||||
if (! options->no_line_commands)
|
||||
cb->file_change = cb_file_change;
|
||||
}
|
||||
|
||||
if (options->dump_includes)
|
||||
cb->include = cb_include;
|
||||
|
||||
if (options->dump_macros == dump_names
|
||||
|| options->dump_macros == dump_definitions)
|
||||
{
|
||||
cb->define = cb_define;
|
||||
cb->undef = cb_undef;
|
||||
}
|
||||
}
|
||||
|
||||
/* Writes out the preprocessed file, handling spacing and paste
|
||||
avoidance issues. */
|
||||
static void
|
||||
scan_translation_unit (pfile)
|
||||
cpp_reader *pfile;
|
||||
{
|
||||
bool avoid_paste = false;
|
||||
|
||||
pfile->print.source = NULL;
|
||||
for (;;)
|
||||
{
|
||||
const cpp_token *token = cpp_get_token (pfile);
|
||||
|
||||
if (token->type == CPP_PADDING)
|
||||
{
|
||||
avoid_paste = true;
|
||||
if (pfile->print.source == NULL
|
||||
|| (!(pfile->print.source->flags & PREV_WHITE)
|
||||
&& token->val.source == NULL))
|
||||
pfile->print.source = token->val.source;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (token->type == CPP_EOF)
|
||||
break;
|
||||
|
||||
/* Subtle logic to output a space if and only if necessary. */
|
||||
if (avoid_paste)
|
||||
{
|
||||
if (pfile->print.source == NULL)
|
||||
pfile->print.source = token;
|
||||
if (pfile->print.source->flags & PREV_WHITE
|
||||
|| (pfile->print.prev
|
||||
&& cpp_avoid_paste (pfile, pfile->print.prev, token))
|
||||
|| (pfile->print.prev == NULL && token->type == CPP_HASH))
|
||||
putc (' ', pfile->print.outf);
|
||||
}
|
||||
else if (token->flags & PREV_WHITE)
|
||||
putc (' ', pfile->print.outf);
|
||||
|
||||
avoid_paste = false;
|
||||
pfile->print.source = NULL;
|
||||
pfile->print.prev = token;
|
||||
cpp_output_token (token, pfile->print.outf);
|
||||
|
||||
if (token->type == CPP_COMMENT)
|
||||
account_for_newlines (pfile, token->val.str.text, token->val.str.len);
|
||||
}
|
||||
}
|
||||
|
||||
/* Adjust pfile->print.line for newlines embedded in output. */
|
||||
static void
|
||||
account_for_newlines (pfile, str, len)
|
||||
cpp_reader *pfile;
|
||||
const uchar *str;
|
||||
size_t len;
|
||||
{
|
||||
while (len--)
|
||||
if (*str++ == '\n')
|
||||
pfile->print.line++;
|
||||
}
|
||||
|
||||
/* Writes out a traditionally preprocessed file. */
|
||||
static void
|
||||
scan_translation_unit_trad (pfile)
|
||||
cpp_reader *pfile;
|
||||
{
|
||||
while (_cpp_read_logical_line_trad (pfile))
|
||||
{
|
||||
size_t len = pfile->out.cur - pfile->out.base;
|
||||
maybe_print_line (pfile, pfile->print.map, pfile->out.first_line);
|
||||
fwrite (pfile->out.base, 1, len, pfile->print.outf);
|
||||
pfile->print.printed = 1;
|
||||
if (!CPP_OPTION (pfile, discard_comments))
|
||||
account_for_newlines (pfile, pfile->out.base, len);
|
||||
}
|
||||
}
|
||||
|
||||
/* If the token read on logical line LINE needs to be output on a
|
||||
different line to the current one, output the required newlines or
|
||||
a line marker, and return 1. Otherwise return 0. */
|
||||
static void
|
||||
maybe_print_line (pfile, map, line)
|
||||
cpp_reader *pfile;
|
||||
const struct line_map *map;
|
||||
unsigned int line;
|
||||
{
|
||||
/* End the previous line of text. */
|
||||
if (pfile->print.printed)
|
||||
{
|
||||
putc ('\n', pfile->print.outf);
|
||||
pfile->print.line++;
|
||||
pfile->print.printed = 0;
|
||||
}
|
||||
|
||||
if (line >= pfile->print.line && line < pfile->print.line + 8)
|
||||
{
|
||||
while (line > pfile->print.line)
|
||||
{
|
||||
putc ('\n', pfile->print.outf);
|
||||
pfile->print.line++;
|
||||
}
|
||||
}
|
||||
else
|
||||
print_line (pfile, map, line, "");
|
||||
}
|
||||
|
||||
/* Output a line marker for logical line LINE. Special flags are "1"
|
||||
or "2" indicating entering or leaving a file. */
|
||||
static void
|
||||
print_line (pfile, map, line, special_flags)
|
||||
cpp_reader *pfile;
|
||||
const struct line_map *map;
|
||||
unsigned int line;
|
||||
const char *special_flags;
|
||||
{
|
||||
/* End any previous line of text. */
|
||||
if (pfile->print.printed)
|
||||
putc ('\n', pfile->print.outf);
|
||||
pfile->print.printed = 0;
|
||||
|
||||
pfile->print.line = line;
|
||||
if (! CPP_OPTION (pfile, no_line_commands))
|
||||
{
|
||||
size_t to_file_len = strlen (map->to_file);
|
||||
unsigned char *to_file_quoted = alloca (to_file_len * 4 + 1);
|
||||
unsigned char *p;
|
||||
|
||||
/* cpp_quote_string does not nul-terminate, so we have to do it
|
||||
ourselves. */
|
||||
p = cpp_quote_string (to_file_quoted,
|
||||
(unsigned char *)map->to_file, to_file_len);
|
||||
*p = '\0';
|
||||
fprintf (pfile->print.outf, "# %u \"%s\"%s",
|
||||
SOURCE_LINE (map, pfile->print.line),
|
||||
to_file_quoted, special_flags);
|
||||
|
||||
if (map->sysp == 2)
|
||||
fputs (" 3 4", pfile->print.outf);
|
||||
else if (map->sysp == 1)
|
||||
fputs (" 3", pfile->print.outf);
|
||||
|
||||
putc ('\n', pfile->print.outf);
|
||||
}
|
||||
}
|
||||
|
||||
/* Called when a line of output is started. TOKEN is the first token
|
||||
of the line, and at end of file will be CPP_EOF. */
|
||||
static void
|
||||
cb_line_change (pfile, token, parsing_args)
|
||||
cpp_reader *pfile;
|
||||
const cpp_token *token;
|
||||
int parsing_args;
|
||||
{
|
||||
if (token->type == CPP_EOF || parsing_args)
|
||||
return;
|
||||
|
||||
maybe_print_line (pfile, pfile->print.map, token->line);
|
||||
pfile->print.prev = 0;
|
||||
pfile->print.source = 0;
|
||||
|
||||
/* Supply enough spaces to put this token in its original column,
|
||||
one space per column greater than 2, since scan_translation_unit
|
||||
will provide a space if PREV_WHITE. Don't bother trying to
|
||||
reconstruct tabs; we can't get it right in general, and nothing
|
||||
ought to care. Some things do care; the fault lies with them. */
|
||||
if (!CPP_OPTION (pfile, traditional))
|
||||
{
|
||||
pfile->print.printed = 1;
|
||||
if (token->col > 2)
|
||||
{
|
||||
unsigned int spaces = token->col - 2;
|
||||
|
||||
while (spaces--)
|
||||
putc (' ', pfile->print.outf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cb_ident (pfile, line, str)
|
||||
cpp_reader *pfile;
|
||||
unsigned int line;
|
||||
const cpp_string * str;
|
||||
{
|
||||
maybe_print_line (pfile, pfile->print.map, line);
|
||||
fprintf (pfile->print.outf, "#ident \"%s\"\n", str->text);
|
||||
pfile->print.line++;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_define (pfile, line, node)
|
||||
cpp_reader *pfile;
|
||||
unsigned int line;
|
||||
cpp_hashnode *node;
|
||||
{
|
||||
maybe_print_line (pfile, pfile->print.map, line);
|
||||
fputs ("#define ", pfile->print.outf);
|
||||
|
||||
/* -dD command line option. */
|
||||
if (CPP_OPTION (pfile, dump_macros) == dump_definitions)
|
||||
fputs ((const char *) cpp_macro_definition (pfile, node),
|
||||
pfile->print.outf);
|
||||
else
|
||||
fputs ((const char *) NODE_NAME (node), pfile->print.outf);
|
||||
|
||||
putc ('\n', pfile->print.outf);
|
||||
pfile->print.line++;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_undef (pfile, line, node)
|
||||
cpp_reader *pfile;
|
||||
unsigned int line;
|
||||
cpp_hashnode *node;
|
||||
{
|
||||
maybe_print_line (pfile, pfile->print.map, line);
|
||||
fprintf (pfile->print.outf, "#undef %s\n", NODE_NAME (node));
|
||||
pfile->print.line++;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_include (pfile, line, dir, header)
|
||||
cpp_reader *pfile;
|
||||
unsigned int line;
|
||||
const unsigned char *dir;
|
||||
const cpp_token *header;
|
||||
{
|
||||
maybe_print_line (pfile, pfile->print.map, line);
|
||||
fprintf (pfile->print.outf, "#%s %s\n", dir,
|
||||
cpp_token_as_text (pfile, header));
|
||||
pfile->print.line++;
|
||||
}
|
||||
|
||||
/* The file name, line number or system header flags have changed, as
|
||||
described in MAP. From this point on, the old pfile->print.map might be
|
||||
pointing to freed memory, and so must not be dereferenced. */
|
||||
|
||||
static void
|
||||
cb_file_change (pfile, map)
|
||||
cpp_reader *pfile;
|
||||
const struct line_map *map;
|
||||
{
|
||||
const char *flags = "";
|
||||
|
||||
/* First time? */
|
||||
if (pfile->print.map == NULL)
|
||||
{
|
||||
/* Avoid printing foo.i when the main file is foo.c. */
|
||||
if (!CPP_OPTION (pfile, preprocessed))
|
||||
print_line (pfile, map, map->from_line, flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Bring current file to correct line when entering a new file. */
|
||||
if (map->reason == LC_ENTER)
|
||||
maybe_print_line (pfile, map - 1, map->from_line - 1);
|
||||
|
||||
if (map->reason == LC_ENTER)
|
||||
flags = " 1";
|
||||
else if (map->reason == LC_LEAVE)
|
||||
flags = " 2";
|
||||
print_line (pfile, map, map->from_line, flags);
|
||||
}
|
||||
|
||||
pfile->print.map = map;
|
||||
}
|
||||
|
||||
/* Copy a #pragma directive to the preprocessed output. */
|
||||
static void
|
||||
cb_def_pragma (pfile, line)
|
||||
cpp_reader *pfile;
|
||||
unsigned int line;
|
||||
{
|
||||
maybe_print_line (pfile, pfile->print.map, line);
|
||||
fputs ("#pragma ", pfile->print.outf);
|
||||
cpp_output_line (pfile, pfile->print.outf);
|
||||
pfile->print.line++;
|
||||
}
|
||||
|
||||
/* Dump out the hash table. */
|
||||
static int
|
||||
dump_macro (pfile, node, v)
|
||||
cpp_reader *pfile;
|
||||
cpp_hashnode *node;
|
||||
void *v ATTRIBUTE_UNUSED;
|
||||
{
|
||||
if (node->type == NT_MACRO && !(node->flags & NODE_BUILTIN))
|
||||
{
|
||||
fputs ("#define ", pfile->print.outf);
|
||||
fputs ((const char *) cpp_macro_definition (pfile, node),
|
||||
pfile->print.outf);
|
||||
putc ('\n', pfile->print.outf);
|
||||
pfile->print.line++;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/* Storage classes in XCOFF object file format designed for DBX's use.
|
||||
This info is from the `Files Reference' manual for IBM's AIX version 3
|
||||
for the RS6000. */
|
||||
|
||||
#define C_GSYM 0x80
|
||||
#define C_LSYM 0x81
|
||||
#define C_PSYM 0x82
|
||||
#define C_RSYM 0x83
|
||||
#define C_RPSYM 0x84
|
||||
#define C_STSYM 0x85
|
||||
|
||||
#define C_BCOMM 0x87
|
||||
#define C_ECOML 0x88
|
||||
#define C_ECOMM 0x89
|
||||
#define C_DECL 0x8c
|
||||
#define C_ENTRY 0x8d
|
||||
#define C_FUN 0x8e
|
@ -1,725 +0,0 @@
|
||||
@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
@c This is part of the GCC manual.
|
||||
@c For copying conditions, see the file install.texi.
|
||||
|
||||
@ifnothtml
|
||||
@comment node-name, next, previous, up
|
||||
@node Old, GNU Free Documentation License, Specific, Top
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h1 align="center">Old installation documentation</h1>
|
||||
@end html
|
||||
@ifnothtml
|
||||
@chapter Old installation documentation
|
||||
@end ifnothtml
|
||||
|
||||
Note most of this information is out of date and superseded by the
|
||||
previous chapters of this manual. It is provided for historical
|
||||
reference only, because of a lack of volunteers to merge it into the
|
||||
main manual.
|
||||
|
||||
@ifnothtml
|
||||
@menu
|
||||
* Configurations:: Configurations Supported by GNU CC.
|
||||
* Cross-Compiler:: Building and installing a cross-compiler.
|
||||
* VMS Install:: See below for installation on VMS.
|
||||
@end menu
|
||||
@end ifnothtml
|
||||
|
||||
Here is the procedure for installing GNU CC on a GNU or Unix system.
|
||||
See @ref{VMS Install}, for VMS systems.
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
If you have chosen a configuration for GNU CC which requires other GNU
|
||||
tools (such as GAS or the GNU linker) instead of the standard system
|
||||
tools, install the required tools in the build directory under the names
|
||||
@file{as}, @file{ld} or whatever is appropriate. This will enable the
|
||||
compiler to find the proper tools for compilation of the program
|
||||
@file{enquire}.
|
||||
|
||||
Alternatively, you can do subsequent compilation using a value of the
|
||||
@code{PATH} environment variable such that the necessary GNU tools come
|
||||
before the standard system tools.
|
||||
|
||||
@item
|
||||
Specify the host, build and target machine configurations. You do this
|
||||
when you run the @file{configure} script.
|
||||
|
||||
The @dfn{build} machine is the system which you are using, the
|
||||
@dfn{host} machine is the system where you want to run the resulting
|
||||
compiler (normally the build machine), and the @dfn{target} machine is
|
||||
the system for which you want the compiler to generate code.
|
||||
|
||||
If you are building a compiler to produce code for the machine it runs
|
||||
on (a native compiler), you normally do not need to specify any operands
|
||||
to @file{configure}; it will try to guess the type of machine you are on
|
||||
and use that as the build, host and target machines. So you don't need
|
||||
to specify a configuration when building a native compiler unless
|
||||
@file{configure} cannot figure out what your configuration is or guesses
|
||||
wrong.
|
||||
|
||||
In those cases, specify the build machine's @dfn{configuration name}
|
||||
with the @option{--host} option; the host and target will default to be
|
||||
the same as the host machine. (If you are building a cross-compiler,
|
||||
see @ref{Cross-Compiler}.)
|
||||
|
||||
Here is an example:
|
||||
|
||||
@smallexample
|
||||
./configure --host=sparc-sun-sunos4.1
|
||||
@end smallexample
|
||||
|
||||
A configuration name may be canonical or it may be more or less
|
||||
abbreviated.
|
||||
|
||||
A canonical configuration name has three parts, separated by dashes.
|
||||
It looks like this: @samp{@var{cpu}-@var{company}-@var{system}}.
|
||||
(The three parts may themselves contain dashes; @file{configure}
|
||||
can figure out which dashes serve which purpose.) For example,
|
||||
@samp{m68k-sun-sunos4.1} specifies a Sun 3.
|
||||
|
||||
You can also replace parts of the configuration by nicknames or aliases.
|
||||
For example, @samp{sun3} stands for @samp{m68k-sun}, so
|
||||
@samp{sun3-sunos4.1} is another way to specify a Sun 3.
|
||||
|
||||
You can specify a version number after any of the system types, and some
|
||||
of the CPU types. In most cases, the version is irrelevant, and will be
|
||||
ignored. So you might as well specify the version if you know it.
|
||||
|
||||
See @ref{Configurations}, for a list of supported configuration names and
|
||||
notes on many of the configurations. You should check the notes in that
|
||||
section before proceeding any further with the installation of GNU CC@.
|
||||
|
||||
@end enumerate
|
||||
|
||||
@ifnothtml
|
||||
@node Configurations, Cross-Compiler, , Old
|
||||
@section Configurations Supported by GNU CC
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h2>@anchor{Configurations}Configurations Supported by GNU CC</h2>
|
||||
@end html
|
||||
@cindex configurations supported by GNU CC
|
||||
|
||||
Here are the possible CPU types:
|
||||
|
||||
@quotation
|
||||
@c gmicro, fx80, spur and tahoe omitted since they don't work.
|
||||
1750a, a29k, alpha, arm, avr, c@var{n}, clipper, dsp16xx, elxsi, fr30, h8300,
|
||||
hppa1.0, hppa1.1, i370, i386, i486, i586, i686, i786, i860, i960, m32r,
|
||||
m68000, m68k, m6811, m6812, m88k, mcore, mips, mipsel, mips64, mips64el,
|
||||
mn10200, mn10300, ns32k, pdp11, powerpc, powerpcle, romp, rs6000, sh, sparc,
|
||||
sparclite, sparc64, v850, vax, we32k.
|
||||
@end quotation
|
||||
|
||||
Here are the recognized company names. As you can see, customary
|
||||
abbreviations are used rather than the longer official names.
|
||||
|
||||
@c What should be done about merlin, tek*, dolphin?
|
||||
@quotation
|
||||
acorn, alliant, altos, apollo, apple, att, bull,
|
||||
cbm, convergent, convex, crds, dec, dg, dolphin,
|
||||
elxsi, encore, harris, hitachi, hp, ibm, intergraph, isi,
|
||||
mips, motorola, ncr, next, ns, omron, plexus,
|
||||
sequent, sgi, sony, sun, tti, unicom, wrs.
|
||||
@end quotation
|
||||
|
||||
The company name is meaningful only to disambiguate when the rest of
|
||||
the information supplied is insufficient. You can omit it, writing
|
||||
just @samp{@var{cpu}-@var{system}}, if it is not needed. For example,
|
||||
@samp{vax-ultrix4.2} is equivalent to @samp{vax-dec-ultrix4.2}.
|
||||
|
||||
Here is a list of system types:
|
||||
|
||||
@quotation
|
||||
386bsd, aix, acis, amigaos, aos, aout, aux, bosx, bsd, clix, coff, ctix, cxux,
|
||||
dgux, dynix, ebmon, ecoff, elf, esix, freebsd, hms, genix, gnu, linux,
|
||||
linux-gnu, hiux, hpux, iris, irix, isc, luna, lynxos, mach, minix, msdos, mvs,
|
||||
netbsd, newsos, nindy, ns, osf, osfrose, ptx, riscix, riscos, rtu, sco, sim,
|
||||
solaris, sunos, sym, sysv, udi, ultrix, unicos, uniplus, unos, vms, vsta,
|
||||
vxworks, winnt, xenix.
|
||||
@end quotation
|
||||
|
||||
@noindent
|
||||
You can omit the system type; then @file{configure} guesses the
|
||||
operating system from the CPU and company.
|
||||
|
||||
You can add a version number to the system type; this may or may not
|
||||
make a difference. For example, you can write @samp{bsd4.3} or
|
||||
@samp{bsd4.4} to distinguish versions of BSD@. In practice, the version
|
||||
number is most needed for @samp{sysv3} and @samp{sysv4}, which are often
|
||||
treated differently.
|
||||
|
||||
@samp{linux-gnu} is the canonical name for the GNU/Linux target; however
|
||||
GNU CC will also accept @samp{linux}. The version of the kernel in use is
|
||||
not relevant on these systems. A suffix such as @samp{libc1} or @samp{aout}
|
||||
distinguishes major versions of the C library; all of the suffixed versions
|
||||
are obsolete.
|
||||
|
||||
If you specify an impossible combination such as @samp{i860-dg-vms},
|
||||
then you may get an error message from @file{configure}, or it may
|
||||
ignore part of the information and do the best it can with the rest.
|
||||
@file{configure} always prints the canonical name for the alternative
|
||||
that it used. GNU CC does not support all possible alternatives.
|
||||
|
||||
Often a particular model of machine has a name. Many machine names are
|
||||
recognized as aliases for CPU/company combinations. Thus, the machine
|
||||
name @samp{sun3}, mentioned above, is an alias for @samp{m68k-sun}.
|
||||
Sometimes we accept a company name as a machine name, when the name is
|
||||
popularly used for a particular machine. Here is a table of the known
|
||||
machine names:
|
||||
|
||||
@quotation
|
||||
3300, 3b1, 3b@var{n}, 7300, altos3068, altos,
|
||||
apollo68, att-7300, balance,
|
||||
convex-c@var{n}, crds, decstation-3100,
|
||||
decstation, delta, encore,
|
||||
fx2800, gmicro, hp7@var{nn}, hp8@var{nn},
|
||||
hp9k2@var{nn}, hp9k3@var{nn}, hp9k7@var{nn},
|
||||
hp9k8@var{nn}, iris4d, iris, isi68,
|
||||
m3230, magnum, merlin, miniframe,
|
||||
mmax, news-3600, news800, news, next,
|
||||
pbd, pc532, pmax, powerpc, powerpcle, ps2, risc-news,
|
||||
rtpc, sun2, sun386i, sun386, sun3,
|
||||
sun4, symmetry, tower-32, tower.
|
||||
@end quotation
|
||||
|
||||
@noindent
|
||||
Remember that a machine name specifies both the cpu type and the company
|
||||
name.
|
||||
If you want to install your own homemade configuration files, you can
|
||||
use @samp{local} as the company name to access them. If you use
|
||||
configuration @samp{@var{cpu}-local}, the configuration name
|
||||
without the cpu prefix
|
||||
is used to form the configuration file names.
|
||||
|
||||
Thus, if you specify @samp{m68k-local}, configuration uses
|
||||
files @file{m68k.md}, @file{local.h}, @file{m68k.c},
|
||||
@file{xm-local.h}, @file{t-local}, and @file{x-local}, all in the
|
||||
directory @file{config/m68k}.
|
||||
|
||||
Here is a list of configurations that have special treatment or special
|
||||
things you must know:
|
||||
|
||||
@table @samp
|
||||
@item vax-dec-vms
|
||||
See @ref{VMS Install}, for details on how to install GNU CC on VMS@.
|
||||
@end table
|
||||
|
||||
@ifnothtml
|
||||
@node Cross-Compiler, VMS Install, Configurations, Old
|
||||
@section Building and Installing a Cross-Compiler
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h2>@anchor{Cross-Compiler}Building and Installing a Cross-Compiler</h2>
|
||||
@end html
|
||||
@cindex cross-compiler, installation
|
||||
|
||||
GNU CC can function as a cross-compiler for many machines, but not all.
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Cross-compilers for the Mips as target using the Mips assembler
|
||||
currently do not work, because the auxiliary programs
|
||||
@file{mips-tdump.c} and @file{mips-tfile.c} can't be compiled on
|
||||
anything but a Mips. It does work to cross compile for a Mips
|
||||
if you use the GNU assembler and linker.
|
||||
|
||||
@item
|
||||
Cross-compilers between machines with different floating point formats
|
||||
have not all been made to work. GNU CC now has a floating point
|
||||
emulator with which these can work, but each target machine description
|
||||
needs to be updated to take advantage of it.
|
||||
|
||||
@item
|
||||
Cross-compilation between machines of different word sizes is
|
||||
somewhat problematic and sometimes does not work.
|
||||
@end itemize
|
||||
|
||||
Since GNU CC generates assembler code, you probably need a
|
||||
cross-assembler that GNU CC can run, in order to produce object files.
|
||||
If you want to link on other than the target machine, you need a
|
||||
cross-linker as well. You also need header files and libraries suitable
|
||||
for the target machine that you can install on the host machine.
|
||||
|
||||
@ifnothtml
|
||||
@menu
|
||||
* Steps of Cross:: Using a cross-compiler involves several steps
|
||||
that may be carried out on different machines.
|
||||
* Configure Cross:: Configuring a cross-compiler.
|
||||
* Tools and Libraries:: Where to put the linker and assembler, and the C library.
|
||||
* Cross Headers:: Finding and installing header files
|
||||
for a cross-compiler.
|
||||
* Build Cross:: Actually compiling the cross-compiler.
|
||||
@end menu
|
||||
@end ifnothtml
|
||||
|
||||
@ifnothtml
|
||||
@node Steps of Cross, Configure Cross, , Cross-Compiler
|
||||
@subsection Steps of Cross-Compilation
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h2>Steps of Cross-Compilation</h2>
|
||||
@end html
|
||||
|
||||
To compile and run a program using a cross-compiler involves several
|
||||
steps:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Run the cross-compiler on the host machine to produce assembler files
|
||||
for the target machine. This requires header files for the target
|
||||
machine.
|
||||
|
||||
@item
|
||||
Assemble the files produced by the cross-compiler. You can do this
|
||||
either with an assembler on the target machine, or with a
|
||||
cross-assembler on the host machine.
|
||||
|
||||
@item
|
||||
Link those files to make an executable. You can do this either with a
|
||||
linker on the target machine, or with a cross-linker on the host
|
||||
machine. Whichever machine you use, you need libraries and certain
|
||||
startup files (typically @file{crt@dots{}.o}) for the target machine.
|
||||
@end itemize
|
||||
|
||||
It is most convenient to do all of these steps on the same host machine,
|
||||
since then you can do it all with a single invocation of GNU CC@. This
|
||||
requires a suitable cross-assembler and cross-linker. For some targets,
|
||||
the GNU assembler and linker are available.
|
||||
|
||||
@ifnothtml
|
||||
@node Configure Cross, Tools and Libraries, Steps of Cross, Cross-Compiler
|
||||
@subsection Configuring a Cross-Compiler
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h2>Configuring a Cross-Compiler</h2>
|
||||
@end html
|
||||
|
||||
To build GNU CC as a cross-compiler, you start out by running
|
||||
@file{configure}. Use the @option{--target=@var{target}} to specify the
|
||||
target type. If @file{configure} was unable to correctly identify the
|
||||
system you are running on, also specify the @option{--build=@var{build}}
|
||||
option. For example, here is how to configure for a cross-compiler that
|
||||
produces code for an HP 68030 system running BSD on a system that
|
||||
@file{configure} can correctly identify:
|
||||
|
||||
@smallexample
|
||||
./configure --target=m68k-hp-bsd4.3
|
||||
@end smallexample
|
||||
|
||||
@ifnothtml
|
||||
@node Tools and Libraries, Cross Headers, Configure Cross, Cross-Compiler
|
||||
@subsection Tools and Libraries for a Cross-Compiler
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h2>Tools and Libraries for a Cross-Compiler</h2>
|
||||
@end html
|
||||
|
||||
If you have a cross-assembler and cross-linker available, you should
|
||||
install them now. Put them in the directory
|
||||
@file{/usr/local/@var{target}/bin}. Here is a table of the tools
|
||||
you should put in this directory:
|
||||
|
||||
@table @file
|
||||
@item as
|
||||
This should be the cross-assembler.
|
||||
|
||||
@item ld
|
||||
This should be the cross-linker.
|
||||
|
||||
@item ar
|
||||
This should be the cross-archiver: a program which can manipulate
|
||||
archive files (linker libraries) in the target machine's format.
|
||||
|
||||
@item ranlib
|
||||
This should be a program to construct a symbol table in an archive file.
|
||||
@end table
|
||||
|
||||
The installation of GNU CC will find these programs in that directory,
|
||||
and copy or link them to the proper place to for the cross-compiler to
|
||||
find them when run later.
|
||||
|
||||
The easiest way to provide these files is to build the Binutils package
|
||||
and GAS@. Configure them with the same @option{--host} and @option{--target}
|
||||
options that you use for configuring GNU CC, then build and install
|
||||
them. They install their executables automatically into the proper
|
||||
directory. Alas, they do not support all the targets that GNU CC
|
||||
supports.
|
||||
|
||||
If you want to install libraries to use with the cross-compiler, such as
|
||||
a standard C library, put them in the directory
|
||||
@file{/usr/local/@var{target}/lib}; installation of GNU CC copies
|
||||
all the files in that subdirectory into the proper place for GNU CC to
|
||||
find them and link with them. Here's an example of copying some
|
||||
libraries from a target machine:
|
||||
|
||||
@example
|
||||
ftp @var{target-machine}
|
||||
lcd /usr/local/@var{target}/lib
|
||||
cd /lib
|
||||
get libc.a
|
||||
cd /usr/lib
|
||||
get libg.a
|
||||
get libm.a
|
||||
quit
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
The precise set of libraries you'll need, and their locations on
|
||||
the target machine, vary depending on its operating system.
|
||||
|
||||
@cindex start files
|
||||
Many targets require ``start files'' such as @file{crt0.o} and
|
||||
@file{crtn.o} which are linked into each executable; these too should be
|
||||
placed in @file{/usr/local/@var{target}/lib}. There may be several
|
||||
alternatives for @file{crt0.o}, for use with profiling or other
|
||||
compilation options. Check your target's definition of
|
||||
@code{STARTFILE_SPEC} to find out what start files it uses.
|
||||
Here's an example of copying these files from a target machine:
|
||||
|
||||
@example
|
||||
ftp @var{target-machine}
|
||||
lcd /usr/local/@var{target}/lib
|
||||
prompt
|
||||
cd /lib
|
||||
mget *crt*.o
|
||||
cd /usr/lib
|
||||
mget *crt*.o
|
||||
quit
|
||||
@end example
|
||||
|
||||
@ifnothtml
|
||||
@node Cross Headers, Build Cross, Tools and Libraries, Cross-Compiler
|
||||
@subsection Cross-Compilers and Header Files
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h2>Cross-Compilers and Header Files</h2>
|
||||
@end html
|
||||
|
||||
If you are cross-compiling a standalone program or a program for an
|
||||
embedded system, then you may not need any header files except the few
|
||||
that are part of GNU CC (and those of your program). However, if you
|
||||
intend to link your program with a standard C library such as
|
||||
@file{libc.a}, then you probably need to compile with the header files
|
||||
that go with the library you use.
|
||||
|
||||
The GNU C compiler does not come with these files, because (1) they are
|
||||
system-specific, and (2) they belong in a C library, not in a compiler.
|
||||
|
||||
If the GNU C library supports your target machine, then you can get the
|
||||
header files from there (assuming you actually use the GNU library when
|
||||
you link your program).
|
||||
|
||||
If your target machine comes with a C compiler, it probably comes with
|
||||
suitable header files also. If you make these files accessible from the host
|
||||
machine, the cross-compiler can use them also.
|
||||
|
||||
Otherwise, you're on your own in finding header files to use when
|
||||
cross-compiling.
|
||||
|
||||
When you have found suitable header files, you should put them in the
|
||||
directory @file{/usr/local/@var{target}/include}, before building the
|
||||
cross compiler. Then installation will run fixincludes properly and
|
||||
install the corrected versions of the header files where the compiler
|
||||
will use them.
|
||||
|
||||
Provide the header files before you build the cross-compiler, because
|
||||
the build stage actually runs the cross-compiler to produce parts of
|
||||
@file{libgcc.a}. (These are the parts that @emph{can} be compiled with
|
||||
GNU CC@.) Some of them need suitable header files.
|
||||
|
||||
Here's an example showing how to copy the header files from a target
|
||||
machine. On the target machine, do this:
|
||||
|
||||
@example
|
||||
(cd /usr/include; tar cf - .) > tarfile
|
||||
@end example
|
||||
|
||||
Then, on the host machine, do this:
|
||||
|
||||
@example
|
||||
ftp @var{target-machine}
|
||||
lcd /usr/local/@var{target}/include
|
||||
get tarfile
|
||||
quit
|
||||
tar xf tarfile
|
||||
@end example
|
||||
|
||||
@ifnothtml
|
||||
@node Build Cross, , Cross Headers, Cross-Compiler
|
||||
@subsection Actually Building the Cross-Compiler
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h2>Actually Building the Cross-Compiler</h2>
|
||||
@end html
|
||||
|
||||
Now you can proceed just as for compiling a single-machine compiler
|
||||
through the step of building stage 1.
|
||||
|
||||
If your target is exotic, you may need to provide the header file
|
||||
@file{float.h}.One way to do this is to compile @file{enquire} and run
|
||||
it on your target machine. The job of @file{enquire} is to run on the
|
||||
target machine and figure out by experiment the nature of its floating
|
||||
point representation. @file{enquire} records its findings in the header
|
||||
file @file{float.h}. If you can't produce this file by running
|
||||
@file{enquire} on the target machine, then you will need to come up with
|
||||
a suitable @file{float.h} in some other way (or else, avoid using it in
|
||||
your programs).
|
||||
|
||||
Do not try to build stage 2 for a cross-compiler. It doesn't work to
|
||||
rebuild GNU CC as a cross-compiler using the cross-compiler, because
|
||||
that would produce a program that runs on the target machine, not on the
|
||||
host. For example, if you compile a 386-to-68030 cross-compiler with
|
||||
itself, the result will not be right either for the 386 (because it was
|
||||
compiled into 68030 code) or for the 68030 (because it was configured
|
||||
for a 386 as the host). If you want to compile GNU CC into 68030 code,
|
||||
whether you compile it on a 68030 or with a cross-compiler on a 386, you
|
||||
must specify a 68030 as the host when you configure it.
|
||||
|
||||
To install the cross-compiler, use @samp{make install}, as usual.
|
||||
|
||||
@ifnothtml
|
||||
@node VMS Install, , Cross-Compiler, Old
|
||||
@section Installing GNU CC on VMS
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h2>@anchor{VMS Install}Installing GNU CC on VMS</h2>
|
||||
@end html
|
||||
@cindex VMS installation
|
||||
@cindex installing GNU CC on VMS
|
||||
|
||||
The VMS version of GNU CC is distributed in a backup saveset containing
|
||||
both source code and precompiled binaries.
|
||||
|
||||
To install the @file{gcc} command so you can use the compiler easily, in
|
||||
the same manner as you use the VMS C compiler, you must install the VMS CLD
|
||||
file for GNU CC as follows:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Define the VMS logical names @samp{GNU_CC} and @samp{GNU_CC_INCLUDE}
|
||||
to point to the directories where the GNU CC executables
|
||||
(@file{gcc-cpp.exe}, @file{gcc-cc1.exe}, etc.) and the C include files are
|
||||
kept respectively. This should be done with the commands:
|
||||
|
||||
@smallexample
|
||||
$ assign /system /translation=concealed -
|
||||
disk:[gcc.] gnu_cc
|
||||
$ assign /system /translation=concealed -
|
||||
disk:[gcc.include.] gnu_cc_include
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
with the appropriate disk and directory names. These commands can be
|
||||
placed in your system startup file so they will be executed whenever
|
||||
the machine is rebooted. You may, if you choose, do this via the
|
||||
@file{GCC_INSTALL.COM} script in the @file{[GCC]} directory.
|
||||
|
||||
@item
|
||||
Install the @file{GCC} command with the command line:
|
||||
|
||||
@smallexample
|
||||
$ set command /table=sys$common:[syslib]dcltables -
|
||||
/output=sys$common:[syslib]dcltables gnu_cc:[000000]gcc
|
||||
$ install replace sys$common:[syslib]dcltables
|
||||
@end smallexample
|
||||
|
||||
@item
|
||||
To install the help file, do the following:
|
||||
|
||||
@smallexample
|
||||
$ library/help sys$library:helplib.hlb gcc.hlp
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Now you can invoke the compiler with a command like @samp{gcc /verbose
|
||||
file.c}, which is equivalent to the command @samp{gcc -v -c file.c} in
|
||||
Unix.
|
||||
@end enumerate
|
||||
|
||||
If you wish to use GNU C++ you must first install GNU CC, and then
|
||||
perform the following steps:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Define the VMS logical name @samp{GNU_GXX_INCLUDE} to point to the
|
||||
directory where the preprocessor will search for the C++ header files.
|
||||
This can be done with the command:
|
||||
|
||||
@smallexample
|
||||
$ assign /system /translation=concealed -
|
||||
disk:[gcc.gxx_include.] gnu_gxx_include
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
with the appropriate disk and directory name. If you are going to be
|
||||
using a C++ runtime library, this is where its install procedure will install
|
||||
its header files.
|
||||
|
||||
@item
|
||||
Obtain the file @file{gcc-cc1plus.exe}, and place this in the same
|
||||
directory that @file{gcc-cc1.exe} is kept.
|
||||
|
||||
The GNU C++ compiler can be invoked with a command like @samp{gcc /plus
|
||||
/verbose file.cc}, which is equivalent to the command @samp{g++ -v -c
|
||||
file.cc} in Unix.
|
||||
@end enumerate
|
||||
|
||||
We try to put corresponding binaries and sources on the VMS distribution
|
||||
tape. But sometimes the binaries will be from an older version than the
|
||||
sources, because we don't always have time to update them. (Use the
|
||||
@samp{/version} option to determine the version number of the binaries and
|
||||
compare it with the source file @file{version.c} to tell whether this is
|
||||
so.) In this case, you should use the binaries you get to recompile the
|
||||
sources. If you must recompile, here is how:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Execute the command procedure @file{vmsconfig.com} to set up the files
|
||||
@file{tm.h}, @file{config.h}, @file{aux-output.c}, and @file{md.}, and
|
||||
to create files @file{tconfig.h} and @file{hconfig.h}. This procedure
|
||||
also creates several linker option files used by @file{make-cc1.com} and
|
||||
a data file used by @file{make-l2.com}.
|
||||
|
||||
@smallexample
|
||||
$ @@vmsconfig.com
|
||||
@end smallexample
|
||||
|
||||
@item
|
||||
Setup the logical names and command tables as defined above. In
|
||||
addition, define the VMS logical name @samp{GNU_BISON} to point at the
|
||||
to the directories where the Bison executable is kept. This should be
|
||||
done with the command:
|
||||
|
||||
@smallexample
|
||||
$ assign /system /translation=concealed -
|
||||
disk:[bison.] gnu_bison
|
||||
@end smallexample
|
||||
|
||||
You may, if you choose, use the @file{INSTALL_BISON.COM} script in the
|
||||
@file{[BISON]} directory.
|
||||
|
||||
@item
|
||||
Install the @samp{BISON} command with the command line:
|
||||
|
||||
@smallexample
|
||||
$ set command /table=sys$common:[syslib]dcltables -
|
||||
/output=sys$common:[syslib]dcltables -
|
||||
gnu_bison:[000000]bison
|
||||
$ install replace sys$common:[syslib]dcltables
|
||||
@end smallexample
|
||||
|
||||
@item
|
||||
Type @samp{@@make-gcc} to recompile everything, or submit the file
|
||||
@file{make-gcc.com} to a batch queue. If you wish to build the GNU C++
|
||||
compiler as well as the GNU CC compiler, you must first edit
|
||||
@file{make-gcc.com} and follow the instructions that appear in the
|
||||
comments.
|
||||
|
||||
@item
|
||||
In order to use GCC, you need a library of functions which GCC compiled code
|
||||
will call to perform certain tasks, and these functions are defined in the
|
||||
file @file{libgcc2.c}. To compile this you should use the command procedure
|
||||
@file{make-l2.com}, which will generate the library @file{libgcc2.olb}.
|
||||
@file{libgcc2.olb} should be built using the compiler built from
|
||||
the same distribution that @file{libgcc2.c} came from, and
|
||||
@file{make-gcc.com} will automatically do all of this for you.
|
||||
|
||||
To install the library, use the following commands:
|
||||
|
||||
@smallexample
|
||||
$ library gnu_cc:[000000]gcclib/delete=(new,eprintf)
|
||||
$ library gnu_cc:[000000]gcclib/delete=L_*
|
||||
$ library libgcc2/extract=*/output=libgcc2.obj
|
||||
$ library gnu_cc:[000000]gcclib libgcc2.obj
|
||||
@end smallexample
|
||||
|
||||
The first command simply removes old modules that will be replaced with
|
||||
modules from @file{libgcc2} under different module names. The modules
|
||||
@code{new} and @code{eprintf} may not actually be present in your
|
||||
@file{gcclib.olb}---if the VMS librarian complains about those modules
|
||||
not being present, simply ignore the message and continue on with the
|
||||
next command. The second command removes the modules that came from the
|
||||
previous version of the library @file{libgcc2.c}.
|
||||
|
||||
Whenever you update the compiler on your system, you should also update the
|
||||
library with the above procedure.
|
||||
|
||||
@item
|
||||
You may wish to build GCC in such a way that no files are written to the
|
||||
directory where the source files reside. An example would be the when
|
||||
the source files are on a read-only disk. In these cases, execute the
|
||||
following DCL commands (substituting your actual path names):
|
||||
|
||||
@smallexample
|
||||
$ assign dua0:[gcc.build_dir.]/translation=concealed, -
|
||||
dua1:[gcc.source_dir.]/translation=concealed gcc_build
|
||||
$ set default gcc_build:[000000]
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
where the directory @file{dua1:[gcc.source_dir]} contains the source
|
||||
code, and the directory @file{dua0:[gcc.build_dir]} is meant to contain
|
||||
all of the generated object files and executables. Once you have done
|
||||
this, you can proceed building GCC as described above. (Keep in mind
|
||||
that @file{gcc_build} is a rooted logical name, and thus the device
|
||||
names in each element of the search list must be an actual physical
|
||||
device name rather than another rooted logical name).
|
||||
|
||||
@item
|
||||
@strong{If you are building GNU CC with a previous version of GNU CC,
|
||||
you also should check to see that you have the newest version of the
|
||||
assembler}. In particular, GNU CC version 2 treats global constant
|
||||
variables slightly differently from GNU CC version 1, and GAS version
|
||||
1.38.1 does not have the patches required to work with GCC version 2.
|
||||
If you use GAS 1.38.1, then @code{extern const} variables will not have
|
||||
the read-only bit set, and the linker will generate warning messages
|
||||
about mismatched psect attributes for these variables. These warning
|
||||
messages are merely a nuisance, and can safely be ignored.
|
||||
|
||||
@item
|
||||
If you want to build GNU CC with the VAX C compiler, you will need to
|
||||
make minor changes in @file{make-cccp.com} and @file{make-cc1.com}
|
||||
to choose alternate definitions of @code{CC}, @code{CFLAGS}, and
|
||||
@code{LIBS}. See comments in those files. However, you must
|
||||
also have a working version of the GNU assembler (GNU as, aka GAS) as
|
||||
it is used as the back end for GNU CC to produce binary object modules
|
||||
and is not included in the GNU CC sources. GAS is also needed to
|
||||
compile @file{libgcc2} in order to build @file{gcclib} (see above);
|
||||
@file{make-l2.com} expects to be able to find it operational in
|
||||
@file{gnu_cc:[000000]gnu-as.exe}.
|
||||
|
||||
To use GNU CC on VMS, you need the VMS driver programs
|
||||
@file{gcc.exe}, @file{gcc.com}, and @file{gcc.cld}. They are
|
||||
distributed with the VMS binaries (@file{gcc-vms}) rather than the
|
||||
GNU CC sources. GAS is also included in @file{gcc-vms}, as is Bison.
|
||||
|
||||
Once you have successfully built GNU CC with VAX C, you should use the
|
||||
resulting compiler to rebuild itself. Before doing this, be sure to
|
||||
restore the @code{CC}, @code{CFLAGS}, and @code{LIBS} definitions in
|
||||
@file{make-cccp.com} and @file{make-cc1.com}. The second generation
|
||||
compiler will be able to take advantage of many optimizations that must
|
||||
be suppressed when building with other compilers.
|
||||
@end enumerate
|
||||
|
||||
Under previous versions of GNU CC, the generated code would occasionally
|
||||
give strange results when linked with the sharable @file{VAXCRTL} library.
|
||||
Now this should work.
|
||||
|
||||
Even with this version, however, GNU CC itself should not be linked with
|
||||
the sharable @file{VAXCRTL}. The version of @code{qsort} in
|
||||
@file{VAXCRTL} has a bug (known to be present in VMS versions V4.6
|
||||
through V5.5) which causes the compiler to fail.
|
||||
|
||||
The executables are generated by @file{make-cc1.com} and
|
||||
@file{make-cccp.com} use the object library version of @file{VAXCRTL} in
|
||||
order to make use of the @code{qsort} routine in @file{gcclib.olb}. If
|
||||
you wish to link the compiler executables with the shareable image
|
||||
version of @file{VAXCRTL}, you should edit the file @file{tm.h} (created
|
||||
by @file{vmsconfig.com}) to define the macro @code{QSORT_WORKAROUND}.
|
||||
|
||||
@code{QSORT_WORKAROUND} is always defined when GNU CC is compiled with
|
||||
VAX C, to avoid a problem in case @file{gcclib.olb} is not yet
|
||||
available.
|
File diff suppressed because it is too large
Load Diff
@ -1,31 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Convert the GCC install documentation from texinfo format to HTML.
|
||||
#
|
||||
# $SOURCEDIR and $DESTDIR, resp., refer to the directory containing
|
||||
# the texinfo source and the directory to put the HTML version in.
|
||||
#
|
||||
# (C) 2001 Free Software Foundation
|
||||
# Originally by Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>, June 2001.
|
||||
#
|
||||
# This script is Free Software, and it can be copied, distributed and
|
||||
# modified as defined in the GNU General Public License. A copy of
|
||||
# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
SOURCEDIR=${SOURCEDIR-.}
|
||||
DESTDIR=${DESTDIR-HTML}
|
||||
|
||||
MAKEINFO=${MAKEINFO-makeinfo}
|
||||
|
||||
if [ ! -d $DESTDIR ]; then
|
||||
mkdir -p $DESTDIR
|
||||
fi
|
||||
|
||||
for x in index.html specific.html download.html configure.html \
|
||||
build.html test.html finalinstall.html binaries.html old.html \
|
||||
gfdl.html
|
||||
do
|
||||
define=`echo $x | sed -e 's/\.//g'`
|
||||
echo "define = $define"
|
||||
$MAKEINFO -I $SOURCEDIR -I $SOURCEDIR/include $SOURCEDIR/install.texi --html --no-split -D$define -o$DESTDIR/$x
|
||||
done
|
@ -1,360 +0,0 @@
|
||||
/*
|
||||
** DosFCheck - check file names for DOS consistency
|
||||
**
|
||||
** Distribute freely, it only encourages DOS compatibility!
|
||||
** - DJ Delorie
|
||||
*/
|
||||
|
||||
/* This file is not part of GCC. */
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef __MSDOS__
|
||||
#include <alloc.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct ENT
|
||||
{
|
||||
struct ENT *next;
|
||||
char *dos_name;
|
||||
char *full_name;
|
||||
char *path;
|
||||
int tagged;
|
||||
} ENT;
|
||||
|
||||
ENT *eroot = 0;
|
||||
|
||||
int first_inv = 1;
|
||||
int first_msg = 1;
|
||||
|
||||
/****************************************************************\
|
||||
* Utility routines *
|
||||
\****************************************************************/
|
||||
|
||||
void
|
||||
invalid_msg ()
|
||||
{
|
||||
if (first_inv)
|
||||
{
|
||||
if (first_msg)
|
||||
first_msg = 0;
|
||||
else
|
||||
putchar ('\n');
|
||||
printf ("The following files are not valid DOS file names:\n");
|
||||
first_inv = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ENT *
|
||||
alloc_ent ()
|
||||
{
|
||||
ENT *rv = (ENT *)malloc (sizeof (ENT));
|
||||
if (rv == 0)
|
||||
{
|
||||
fprintf (stderr, "Unable to allocate memory for an ENT\n");
|
||||
exit (1);
|
||||
}
|
||||
memset (rv, 0, sizeof (ENT));
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
fill_ent (ent, path)
|
||||
ENT *ent;
|
||||
char *path;
|
||||
{
|
||||
char *first = path;
|
||||
char *null = path+strlen (path);
|
||||
char *last_slash = strrchr (path, '/');
|
||||
char *cp, *dp;
|
||||
int dots_seen, chars_seen;
|
||||
|
||||
if (last_slash+1 == null)
|
||||
{
|
||||
* --null = '\0';
|
||||
last_slash = strrchr (path, '/');
|
||||
}
|
||||
|
||||
if (!last_slash)
|
||||
{
|
||||
last_slash = first-1;
|
||||
}
|
||||
|
||||
if (null-last_slash < 13)
|
||||
ent->dos_name = (char *)malloc (null-last_slash);
|
||||
else
|
||||
ent->dos_name = (char *)malloc (13);
|
||||
ent->full_name = (char *)malloc (null-last_slash);
|
||||
ent->path = (char *)malloc (last_slash-first+1);
|
||||
|
||||
strcpy (ent->full_name, last_slash+1);
|
||||
if (last_slash > first)
|
||||
{
|
||||
strncpy (ent->path, first, last_slash-first);
|
||||
ent->path[last_slash-first] = '\0';
|
||||
}
|
||||
else
|
||||
*ent->path = '\0';
|
||||
|
||||
cp = last_slash+1;
|
||||
dp = ent->dos_name;
|
||||
dots_seen = 0;
|
||||
chars_seen = 0;
|
||||
while (1)
|
||||
{
|
||||
if (! *cp)
|
||||
break;
|
||||
switch (*cp)
|
||||
{
|
||||
case '.':
|
||||
if (cp == last_slash+1 && strcmp (last_slash+1, "."))
|
||||
{
|
||||
invalid_msg ();
|
||||
printf ("%s - file name cannot start with dot\n", path);
|
||||
*dp = 0;
|
||||
break;
|
||||
}
|
||||
if (dots_seen == 1)
|
||||
{
|
||||
invalid_msg ();
|
||||
printf ("%s - too many dots\n", path);
|
||||
*dp = '\0';
|
||||
break;
|
||||
}
|
||||
*dp++ = '.';
|
||||
chars_seen = 0;
|
||||
dots_seen++;
|
||||
break;
|
||||
case '"':
|
||||
case '*':
|
||||
case '+':
|
||||
case ',':
|
||||
case ';':
|
||||
case '<':
|
||||
case '=':
|
||||
case '>':
|
||||
case '?':
|
||||
case '[':
|
||||
case '\\':
|
||||
case ']':
|
||||
case '|':
|
||||
invalid_msg ();
|
||||
printf ("%s - invalid character `%c'\n", path, *cp);
|
||||
*dp++ = '?';
|
||||
chars_seen++;
|
||||
break;
|
||||
default:
|
||||
if (dots_seen)
|
||||
{
|
||||
if (chars_seen >= 3)
|
||||
break;
|
||||
}
|
||||
else
|
||||
if (chars_seen >= 8)
|
||||
break;
|
||||
if ((*cp <= ' ') || (*cp >= 0x7f))
|
||||
{
|
||||
invalid_msg ();
|
||||
printf ("%s - invalid character `%c'\n", path, *cp);
|
||||
*dp++ = '?';
|
||||
chars_seen++;
|
||||
break;
|
||||
}
|
||||
if (islower (*cp))
|
||||
*dp++ = toupper (*cp);
|
||||
else
|
||||
*dp++ = *cp;
|
||||
chars_seen++;
|
||||
break;
|
||||
}
|
||||
cp++;
|
||||
}
|
||||
*dp++ = '\0';
|
||||
}
|
||||
|
||||
int
|
||||
compare_ent_dosname (e1, e2)
|
||||
ENT **e1;
|
||||
ENT **e2;
|
||||
{
|
||||
int r = strcmp ((*e1)->dos_name, (*e2)->dos_name);
|
||||
if (r == 0)
|
||||
r = strcmp ((*e1)->path, (*e2)->path);
|
||||
if (r == 0)
|
||||
r = strcmp ((*e1)->full_name, (*e2)->full_name);
|
||||
return r;
|
||||
}
|
||||
|
||||
int
|
||||
compare_ent_fullname (e1, e2)
|
||||
ENT **e1;
|
||||
ENT **e2;
|
||||
{
|
||||
int r = strncmp ((*e1)->full_name, (*e2)->full_name, 14);
|
||||
if (r == 0)
|
||||
r = strcmp ((*e1)->path, (*e2)->path);
|
||||
if (r == 0)
|
||||
r = strcmp ((*e1)->full_name, (*e2)->full_name);
|
||||
return r;
|
||||
}
|
||||
|
||||
char *
|
||||
mpath (ent)
|
||||
ENT *ent;
|
||||
{
|
||||
static char buf[500];
|
||||
if (ent->path && ent->path[0])
|
||||
sprintf (buf, "%s/%s", ent->path, ent->full_name);
|
||||
else
|
||||
return ent->full_name;
|
||||
return buf;
|
||||
}
|
||||
|
||||
/****************************************************************\
|
||||
* List handling routines *
|
||||
\****************************************************************/
|
||||
|
||||
void
|
||||
add_ent (ent)
|
||||
ENT *ent;
|
||||
{
|
||||
ent->next = eroot;
|
||||
eroot = ent;
|
||||
}
|
||||
|
||||
void
|
||||
handle_input (line)
|
||||
char *line;
|
||||
{
|
||||
ENT *ent = alloc_ent ();
|
||||
fill_ent (ent, line);
|
||||
add_ent (ent);
|
||||
}
|
||||
|
||||
void
|
||||
display_problems ()
|
||||
{
|
||||
ENT **elist, *ent;
|
||||
int ecount, i, first, first_err;
|
||||
|
||||
for (ecount=0, ent=eroot; ent; ent=ent->next, ecount++);
|
||||
elist = (ENT **)malloc (sizeof (ENT *) * ecount);
|
||||
for (ecount=0, ent=eroot; ent; ent=ent->next, ecount++)
|
||||
elist[ecount] = ent;
|
||||
|
||||
qsort (elist, ecount, sizeof (ENT *), compare_ent_dosname);
|
||||
|
||||
first = 1;
|
||||
first_err = 1;
|
||||
for (i=0; i<ecount-1; i++)
|
||||
{
|
||||
if ((strcmp (elist[i]->dos_name, elist[i+1]->dos_name) == 0)
|
||||
&& (strcmp (elist[i]->path, elist[i+1]->path) == 0))
|
||||
{
|
||||
if (first_err)
|
||||
{
|
||||
if (first_msg)
|
||||
first_msg = 0;
|
||||
else
|
||||
putchar ('\n');
|
||||
printf ("The following resolve to the same DOS file names:\n");
|
||||
first_err = 0;
|
||||
}
|
||||
if (first)
|
||||
{
|
||||
printf ("%14s : %s\n", elist[i]->dos_name, mpath (elist[i]));
|
||||
first = 0;
|
||||
}
|
||||
printf ("\t\t %s\n", mpath (elist[i+1]));
|
||||
}
|
||||
else
|
||||
first = 1;
|
||||
}
|
||||
|
||||
qsort (elist, ecount, sizeof (ENT *), compare_ent_fullname);
|
||||
|
||||
first = 1;
|
||||
first_err = 1;
|
||||
for (i=0; i<ecount-1; i++)
|
||||
{
|
||||
if ((strncmp (elist[i]->full_name, elist[i+1]->full_name, 14) == 0)
|
||||
&& (strcmp (elist[i]->path, elist[i+1]->path) == 0))
|
||||
{
|
||||
if (first_err)
|
||||
{
|
||||
if (first_msg)
|
||||
first_msg = 0;
|
||||
else
|
||||
putchar ('\n');
|
||||
printf ("The following resolve to the same SysV file names:\n");
|
||||
first_err = 0;
|
||||
}
|
||||
if (first)
|
||||
{
|
||||
printf ("%.14s : %s\n", elist[i]->full_name, mpath (elist[i]));
|
||||
first = 0;
|
||||
elist[i]->tagged = 1;
|
||||
}
|
||||
printf ("\t\t %s\n", mpath (elist[i+1]));
|
||||
elist[i+1]->tagged = 1;
|
||||
}
|
||||
else
|
||||
first = 1;
|
||||
}
|
||||
|
||||
first_err = 1;
|
||||
for (i=0; i<ecount; i++)
|
||||
{
|
||||
if ((strlen (elist[i]->full_name) > 14) && !elist[i]->tagged)
|
||||
{
|
||||
if (first_err)
|
||||
{
|
||||
if (first_msg)
|
||||
first_msg = 0;
|
||||
else
|
||||
putchar ('\n');
|
||||
printf ("The following file names are too long for SysV:\n");
|
||||
first_err = 0;
|
||||
}
|
||||
printf ("%.14s : %s\n", elist[i]->full_name, mpath (elist[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************\
|
||||
* Main entry point *
|
||||
\****************************************************************/
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
FILE *input = stdin;
|
||||
if (argc > 1)
|
||||
{
|
||||
input = fopen (argv[1], "r");
|
||||
if (!input)
|
||||
{
|
||||
perror (argv[1]);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
char line[500];
|
||||
char *lp;
|
||||
fgets (line, 500, input);
|
||||
if (feof (input))
|
||||
break;
|
||||
lp = line+strlen (line);
|
||||
while ((lp != line) && (*lp <= ' '))
|
||||
lp--;
|
||||
lp[1] = 0;
|
||||
handle_input (line);
|
||||
}
|
||||
display_problems ();
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
||||
1995-02-15
|
||||
|
||||
This directory is the f/ subdirectory, which is designed to
|
||||
be a subdirectory in a gcc development tree, i.e. named gcc/f/.
|
||||
|
||||
Please see gcc/README.g77 for information on the contents of this
|
||||
directory.
|
@ -1,239 +0,0 @@
|
||||
/* lang-options.h file for Fortran
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
Contributed by James Craig Burley.
|
||||
|
||||
This file is part of GNU Fortran.
|
||||
|
||||
GNU Fortran 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 Fortran 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 Fortran; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
/* This is the contribution to the `documented_lang_options' array in
|
||||
toplev.c for g77. */
|
||||
|
||||
#ifdef __STDC__ /* To be consistent with lang-specs.h. Maybe avoid
|
||||
overflowing some old compiler's tables, etc. */
|
||||
|
||||
DEFINE_LANG_NAME ("Fortran")
|
||||
|
||||
{ "-fversion",
|
||||
N_("Print g77-specific compiler version info, run internal tests") },
|
||||
/*"-fident",*/
|
||||
/*"-fno-ident",*/
|
||||
{ "-ff66",
|
||||
N_("Program is written in typical FORTRAN 66 dialect") },
|
||||
{ "-fno-f66", "" },
|
||||
{ "-ff77",
|
||||
N_("Program is written in typical Unix f77 dialect") },
|
||||
{ "-fno-f77",
|
||||
N_("Program does not use Unix-f77 dialectal features") },
|
||||
{ "-ff90",
|
||||
N_("Program is written in Fortran-90-ish dialect") },
|
||||
{ "-fno-f90", "" },
|
||||
{ "-fautomatic", "" },
|
||||
{ "-fno-automatic",
|
||||
N_("Treat local vars and COMMON blocks as if they were named in SAVE statements") },
|
||||
{ "-fdollar-ok",
|
||||
N_("Allow $ in symbol names") },
|
||||
{ "-fno-dollar-ok", "" },
|
||||
{ "-ff2c", "" },
|
||||
{ "-fno-f2c",
|
||||
N_("f2c-compatible code need not be generated") },
|
||||
{ "-ff2c-library", "" },
|
||||
{ "-fno-f2c-library",
|
||||
N_("Unsupported; do not generate libf2c-calling code") },
|
||||
{ "-fflatten-arrays",
|
||||
N_("Unsupported; affects code-generation of arrays") },
|
||||
{ "-fno-flatten-arrays", "" },
|
||||
{ "-ffree-form",
|
||||
N_("Program is written in Fortran-90-ish free form") },
|
||||
{ "-fno-free-form", "" },
|
||||
{ "-ffixed-form", "" },
|
||||
{ "-fno-fixed-form", "" },
|
||||
{ "-fpedantic",
|
||||
N_("Warn about use of (only a few for now) Fortran extensions") },
|
||||
{ "-fno-pedantic", "" },
|
||||
{ "-fvxt",
|
||||
N_("Program is written in VXT (Digital-like) FORTRAN") },
|
||||
{ "-fno-vxt", "" },
|
||||
{ "-fno-ugly",
|
||||
N_("Disallow all ugly features") },
|
||||
{ "-fugly-args", "" },
|
||||
{ "-fno-ugly-args",
|
||||
N_("Hollerith and typeless constants not passed as arguments") },
|
||||
{ "-fugly-assign",
|
||||
N_("Allow ordinary copying of ASSIGN'ed vars") },
|
||||
{ "-fno-ugly-assign", "" },
|
||||
{ "-fugly-assumed",
|
||||
N_("Dummy array dimensioned to (1) is assumed-size") },
|
||||
{ "-fno-ugly-assumed", "" },
|
||||
{ "-fugly-comma",
|
||||
N_("Trailing comma in procedure call denotes null argument") },
|
||||
{ "-fno-ugly-comma", "" },
|
||||
{ "-fugly-complex",
|
||||
N_("Allow REAL(Z) and AIMAG(Z) given DOUBLE COMPLEX Z") },
|
||||
{ "-fno-ugly-complex", "" },
|
||||
{ "-fugly-init", "" },
|
||||
{ "-fno-ugly-init",
|
||||
N_("Initialization via DATA and PARAMETER is type-compatible") },
|
||||
{ "-fugly-logint",
|
||||
N_("Allow INTEGER and LOGICAL interchangeability") },
|
||||
{ "-fno-ugly-logint", "" },
|
||||
{ "-fxyzzy",
|
||||
N_("Print internal debugging-related info") },
|
||||
{ "-fno-xyzzy", "" },
|
||||
{ "-finit-local-zero",
|
||||
N_("Initialize local vars and arrays to zero") },
|
||||
{ "-fno-init-local-zero", "" },
|
||||
{ "-fbackslash", "" },
|
||||
{ "-fno-backslash",
|
||||
N_("Backslashes in character/hollerith constants not special (C-style)") },
|
||||
{ "-femulate-complex",
|
||||
N_("Have front end emulate COMPLEX arithmetic to avoid bugs") },
|
||||
{ "-fno-emulate-complex", "" },
|
||||
{ "-funderscoring", "" },
|
||||
{ "-fno-underscoring",
|
||||
N_("Disable the appending of underscores to externals") },
|
||||
{ "-fsecond-underscore", "" },
|
||||
{ "-fno-second-underscore",
|
||||
N_("Never append a second underscore to externals") },
|
||||
{ "-fintrin-case-initcap",
|
||||
N_("Intrinsics spelled as e.g. SqRt") },
|
||||
{ "-fintrin-case-upper",
|
||||
N_("Intrinsics in uppercase") },
|
||||
{ "-fintrin-case-lower", "" },
|
||||
{ "-fintrin-case-any",
|
||||
N_("Intrinsics letters in arbitrary cases") },
|
||||
{ "-fmatch-case-initcap",
|
||||
N_("Language keywords spelled as e.g. IOStat") },
|
||||
{ "-fmatch-case-upper",
|
||||
N_("Language keywords in uppercase") },
|
||||
{ "-fmatch-case-lower", "" },
|
||||
{ "-fmatch-case-any",
|
||||
N_("Language keyword letters in arbitrary cases") },
|
||||
{ "-fsource-case-upper",
|
||||
N_("Internally convert most source to uppercase") },
|
||||
{ "-fsource-case-lower", "" },
|
||||
{ "-fsource-case-preserve",
|
||||
N_("Internally preserve source case") },
|
||||
{ "-fsymbol-case-initcap",
|
||||
N_("Symbol names spelled in mixed case") },
|
||||
{ "-fsymbol-case-upper",
|
||||
N_("Symbol names in uppercase") },
|
||||
{ "-fsymbol-case-lower",
|
||||
N_("Symbol names in lowercase") },
|
||||
{ "-fsymbol-case-any", "" },
|
||||
{ "-fcase-strict-upper",
|
||||
N_("Program written in uppercase") },
|
||||
{ "-fcase-strict-lower",
|
||||
N_("Program written in lowercase") },
|
||||
{ "-fcase-initcap",
|
||||
N_("Program written in strict mixed-case") },
|
||||
{ "-fcase-upper",
|
||||
N_("Compile as if program written in uppercase") },
|
||||
{ "-fcase-lower",
|
||||
N_("Compile as if program written in lowercase") },
|
||||
{ "-fcase-preserve",
|
||||
N_("Preserve all spelling (case) used in program") },
|
||||
{ "-fbadu77-intrinsics-delete",
|
||||
N_("Delete libU77 intrinsics with bad interfaces") },
|
||||
{ "-fbadu77-intrinsics-disable",
|
||||
N_("Disable libU77 intrinsics with bad interfaces") },
|
||||
{ "-fbadu77-intrinsics-enable", "" },
|
||||
{ "-fbadu77-intrinsics-hide",
|
||||
N_("Hide libU77 intrinsics with bad interfaces") },
|
||||
{ "-ff2c-intrinsics-delete",
|
||||
N_("Delete non-FORTRAN-77 intrinsics f2c supports") },
|
||||
{ "-ff2c-intrinsics-disable",
|
||||
N_("Disable non-FORTRAN-77 intrinsics f2c supports") },
|
||||
{ "-ff2c-intrinsics-enable", "" },
|
||||
{ "-ff2c-intrinsics-hide",
|
||||
N_("Hide non-FORTRAN-77 intrinsics f2c supports") },
|
||||
{ "-ff90-intrinsics-delete",
|
||||
N_("Delete non-FORTRAN-77 intrinsics F90 supports") },
|
||||
{ "-ff90-intrinsics-disable",
|
||||
N_("Disable non-FORTRAN-77 intrinsics F90 supports") },
|
||||
{ "-ff90-intrinsics-enable", "" },
|
||||
{ "-ff90-intrinsics-hide",
|
||||
N_("Hide non-FORTRAN-77 intrinsics F90 supports") },
|
||||
{ "-fgnu-intrinsics-delete",
|
||||
N_("Delete non-FORTRAN-77 intrinsics g77 supports") },
|
||||
{ "-fgnu-intrinsics-disable",
|
||||
N_("Disable non-FORTRAN 77 intrinsics F90 supports") },
|
||||
{ "-fgnu-intrinsics-enable", "" },
|
||||
{ "-fgnu-intrinsics-hide",
|
||||
N_("Hide non-FORTRAN 77 intrinsics F90 supports") },
|
||||
{ "-fmil-intrinsics-delete",
|
||||
N_("Delete MIL-STD 1753 intrinsics") },
|
||||
{ "-fmil-intrinsics-disable",
|
||||
N_("Disable MIL-STD 1753 intrinsics") },
|
||||
{ "-fmil-intrinsics-enable", "" },
|
||||
{ "-fmil-intrinsics-hide",
|
||||
N_("Hide MIL-STD 1753 intrinsics") },
|
||||
{ "-funix-intrinsics-delete",
|
||||
N_("Delete libU77 intrinsics") },
|
||||
{ "-funix-intrinsics-disable",
|
||||
N_("Disable libU77 intrinsics") },
|
||||
{ "-funix-intrinsics-enable", "" },
|
||||
{ "-funix-intrinsics-hide",
|
||||
N_("Hide libU77 intrinsics") },
|
||||
{ "-fvxt-intrinsics-delete",
|
||||
N_("Delete non-FORTRAN-77 intrinsics VXT FORTRAN supports") },
|
||||
{ "-fvxt-intrinsics-disable",
|
||||
N_("Disable non-FORTRAN-77 intrinsics VXT FORTRAN supports") },
|
||||
{ "-fvxt-intrinsics-enable", "" },
|
||||
{ "-fvxt-intrinsics-hide",
|
||||
N_("Hide non-FORTRAN-77 intrinsics VXT FORTRAN supports") },
|
||||
{ "-fzeros",
|
||||
N_("Treat initial values of 0 like non-zero values") },
|
||||
{ "-fno-zeros", "" },
|
||||
{ "-fdebug-kludge",
|
||||
N_("Emit special debugging information for COMMON and EQUIVALENCE (disabled)") },
|
||||
{ "-fno-debug-kludge", "" },
|
||||
{ "-fonetrip",
|
||||
N_("Take at least one trip through each iterative DO loop") },
|
||||
{ "-fno-onetrip", "" },
|
||||
{ "-fsilent", "" },
|
||||
{ "-fno-silent",
|
||||
N_("Print names of program units as they are compiled") },
|
||||
{ "-fglobals", "" },
|
||||
{ "-fno-globals",
|
||||
N_("Disable fatal diagnostics about inter-procedural problems") },
|
||||
{ "-ftypeless-boz",
|
||||
N_("Make prefix-radix non-decimal constants be typeless") },
|
||||
{ "-fno-typeless-boz", "" },
|
||||
{ "-fbounds-check",
|
||||
N_("Generate code to check subscript and substring bounds") },
|
||||
{ "-fno-bounds-check", "" },
|
||||
{ "-ffortran-bounds-check",
|
||||
N_("Fortran-specific form of -fbounds-check") },
|
||||
{ "-fno-fortran-bounds-check", "" },
|
||||
{ "-Wglobals", "" },
|
||||
{ "-Wno-globals",
|
||||
N_("Disable warnings about inter-procedural problems") },
|
||||
/*"-Wimplicit",*/
|
||||
/*"-Wno-implicit",*/
|
||||
{ "-Wsurprising",
|
||||
N_("Warn about constructs with surprising meanings") },
|
||||
{ "-Wno-surprising", "" },
|
||||
/*"-Wall",*/
|
||||
/* Prefix options. */
|
||||
{ "-I",
|
||||
N_("Add a directory for INCLUDE searching") },
|
||||
{ "-ffixed-line-length-",
|
||||
N_("Set the maximum line length") },
|
||||
|
||||
#endif
|
@ -1,944 +0,0 @@
|
||||
/*
|
||||
** libgcc support for software floating point.
|
||||
** Copyright (C) 1991 by Pipeline Associates, Inc. All rights reserved.
|
||||
** Permission is granted to do *anything* you want with this file,
|
||||
** commercial or otherwise, provided this message remains intact. So there!
|
||||
** I would appreciate receiving any updates/patches/changes that anyone
|
||||
** makes, and am willing to be the repository for said changes (am I
|
||||
** making a big mistake?).
|
||||
|
||||
Warning! Only single-precision is actually implemented. This file
|
||||
won't really be much use until double-precision is supported.
|
||||
|
||||
However, once that is done, this file might make possible
|
||||
cross-compilation for an IEEE target machine from a non-IEEE
|
||||
host such as a VAX.
|
||||
|
||||
If you'd like to work on completing this, please talk to rms@gnu.ai.mit.edu.
|
||||
|
||||
--> Double precision floating support added by James Carlson on 20 April 1998.
|
||||
|
||||
**
|
||||
** Pat Wood
|
||||
** Pipeline Associates, Inc.
|
||||
** pipeline!phw@motown.com or
|
||||
** sun!pipeline!phw or
|
||||
** uunet!motown!pipeline!phw
|
||||
**
|
||||
** 05/01/91 -- V1.0 -- first release to gcc mailing lists
|
||||
** 05/04/91 -- V1.1 -- added float and double prototypes and return values
|
||||
** -- fixed problems with adding and subtracting zero
|
||||
** -- fixed rounding in truncdfsf2
|
||||
** -- fixed SWAP define and tested on 386
|
||||
*/
|
||||
|
||||
/*
|
||||
** The following are routines that replace the libgcc soft floating point
|
||||
** routines that are called automatically when -msoft-float is selected.
|
||||
** The support single and double precision IEEE format, with provisions
|
||||
** for byte-swapped machines (tested on 386). Some of the double-precision
|
||||
** routines work at full precision, but most of the hard ones simply punt
|
||||
** and call the single precision routines, producing a loss of accuracy.
|
||||
** long long support is not assumed or included.
|
||||
** Overall accuracy is close to IEEE (actually 68882) for single-precision
|
||||
** arithmetic. I think there may still be a 1 in 1000 chance of a bit
|
||||
** being rounded the wrong way during a multiply. I'm not fussy enough to
|
||||
** bother with it, but if anyone is, knock yourself out.
|
||||
**
|
||||
** Efficiency has only been addressed where it was obvious that something
|
||||
** would make a big difference. Anyone who wants to do this right for
|
||||
** best speed should go in and rewrite in assembler.
|
||||
**
|
||||
** I have tested this only on a 68030 workstation and 386/ix integrated
|
||||
** in with -msoft-float.
|
||||
*/
|
||||
|
||||
/* the following deal with IEEE single-precision numbers */
|
||||
#define EXCESS 126
|
||||
#define SIGNBIT 0x80000000
|
||||
#define HIDDEN (1 << 23)
|
||||
#define SIGN(fp) ((fp) & SIGNBIT)
|
||||
#define EXP(fp) (((fp) >> 23) & 0xFF)
|
||||
#define MANT(fp) (((fp) & 0x7FFFFF) | HIDDEN)
|
||||
#define PACK(s,e,m) ((s) | ((e) << 23) | (m))
|
||||
|
||||
/* the following deal with IEEE double-precision numbers */
|
||||
#define EXCESSD 1022
|
||||
#define HIDDEND (1 << 20)
|
||||
#define EXPD(fp) (((fp.l.upper) >> 20) & 0x7FF)
|
||||
#define SIGND(fp) ((fp.l.upper) & SIGNBIT)
|
||||
#define MANTD(fp) (((((fp.l.upper) & 0xFFFFF) | HIDDEND) << 10) | \
|
||||
(fp.l.lower >> 22))
|
||||
#define HIDDEND_LL ((long long)1 << 52)
|
||||
#define MANTD_LL(fp) ((fp.ll & (HIDDEND_LL-1)) | HIDDEND_LL)
|
||||
#define PACKD_LL(s,e,m) (((long long)((s)+((e)<<20))<<32)|(m))
|
||||
|
||||
/* define SWAP for 386/960 reverse-byte-order brain-damaged CPUs */
|
||||
union double_long {
|
||||
double d;
|
||||
#ifdef SWAP
|
||||
struct {
|
||||
unsigned long lower;
|
||||
long upper;
|
||||
} l;
|
||||
#else
|
||||
struct {
|
||||
long upper;
|
||||
unsigned long lower;
|
||||
} l;
|
||||
#endif
|
||||
long long ll;
|
||||
};
|
||||
|
||||
union float_long
|
||||
{
|
||||
float f;
|
||||
long l;
|
||||
};
|
||||
|
||||
/* add two floats */
|
||||
float
|
||||
__addsf3 (float a1, float a2)
|
||||
{
|
||||
long mant1, mant2;
|
||||
union float_long fl1, fl2;
|
||||
int exp1, exp2;
|
||||
int sign = 0;
|
||||
|
||||
fl1.f = a1;
|
||||
fl2.f = a2;
|
||||
|
||||
/* check for zero args */
|
||||
if (!fl1.l) {
|
||||
fl1.f = fl2.f;
|
||||
goto test_done;
|
||||
}
|
||||
if (!fl2.l)
|
||||
goto test_done;
|
||||
|
||||
exp1 = EXP (fl1.l);
|
||||
exp2 = EXP (fl2.l);
|
||||
|
||||
if (exp1 > exp2 + 25)
|
||||
goto test_done;
|
||||
if (exp2 > exp1 + 25) {
|
||||
fl1.f = fl2.f;
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
/* do everything in excess precision so's we can round later */
|
||||
mant1 = MANT (fl1.l) << 6;
|
||||
mant2 = MANT (fl2.l) << 6;
|
||||
|
||||
if (SIGN (fl1.l))
|
||||
mant1 = -mant1;
|
||||
if (SIGN (fl2.l))
|
||||
mant2 = -mant2;
|
||||
|
||||
if (exp1 > exp2)
|
||||
{
|
||||
mant2 >>= exp1 - exp2;
|
||||
}
|
||||
else
|
||||
{
|
||||
mant1 >>= exp2 - exp1;
|
||||
exp1 = exp2;
|
||||
}
|
||||
mant1 += mant2;
|
||||
|
||||
if (mant1 < 0)
|
||||
{
|
||||
mant1 = -mant1;
|
||||
sign = SIGNBIT;
|
||||
}
|
||||
else if (!mant1) {
|
||||
fl1.f = 0;
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
/* normalize up */
|
||||
while (!(mant1 & 0xE0000000))
|
||||
{
|
||||
mant1 <<= 1;
|
||||
exp1--;
|
||||
}
|
||||
|
||||
/* normalize down? */
|
||||
if (mant1 & (1 << 30))
|
||||
{
|
||||
mant1 >>= 1;
|
||||
exp1++;
|
||||
}
|
||||
|
||||
/* round to even */
|
||||
mant1 += (mant1 & 0x40) ? 0x20 : 0x1F;
|
||||
|
||||
/* normalize down? */
|
||||
if (mant1 & (1 << 30))
|
||||
{
|
||||
mant1 >>= 1;
|
||||
exp1++;
|
||||
}
|
||||
|
||||
/* lose extra precision */
|
||||
mant1 >>= 6;
|
||||
|
||||
/* turn off hidden bit */
|
||||
mant1 &= ~HIDDEN;
|
||||
|
||||
/* pack up and go home */
|
||||
fl1.l = PACK (sign, exp1, mant1);
|
||||
test_done:
|
||||
return (fl1.f);
|
||||
}
|
||||
|
||||
/* subtract two floats */
|
||||
float
|
||||
__subsf3 (float a1, float a2)
|
||||
{
|
||||
union float_long fl1, fl2;
|
||||
|
||||
fl1.f = a1;
|
||||
fl2.f = a2;
|
||||
|
||||
/* check for zero args */
|
||||
if (!fl2.l)
|
||||
return (fl1.f);
|
||||
if (!fl1.l)
|
||||
return (-fl2.f);
|
||||
|
||||
/* twiddle sign bit and add */
|
||||
fl2.l ^= SIGNBIT;
|
||||
return __addsf3 (a1, fl2.f);
|
||||
}
|
||||
|
||||
/* compare two floats */
|
||||
long
|
||||
__cmpsf2 (float a1, float a2)
|
||||
{
|
||||
union float_long fl1, fl2;
|
||||
|
||||
fl1.f = a1;
|
||||
fl2.f = a2;
|
||||
|
||||
if (SIGN (fl1.l) && SIGN (fl2.l))
|
||||
{
|
||||
fl1.l ^= SIGNBIT;
|
||||
fl2.l ^= SIGNBIT;
|
||||
}
|
||||
if (fl1.l < fl2.l)
|
||||
return (-1);
|
||||
if (fl1.l > fl2.l)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* multiply two floats */
|
||||
float
|
||||
__mulsf3 (float a1, float a2)
|
||||
{
|
||||
union float_long fl1, fl2;
|
||||
unsigned long result;
|
||||
int exp;
|
||||
int sign;
|
||||
|
||||
fl1.f = a1;
|
||||
fl2.f = a2;
|
||||
|
||||
if (!fl1.l || !fl2.l) {
|
||||
fl1.f = 0;
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
/* compute sign and exponent */
|
||||
sign = SIGN (fl1.l) ^ SIGN (fl2.l);
|
||||
exp = EXP (fl1.l) - EXCESS;
|
||||
exp += EXP (fl2.l);
|
||||
|
||||
fl1.l = MANT (fl1.l);
|
||||
fl2.l = MANT (fl2.l);
|
||||
|
||||
/* the multiply is done as one 16x16 multiply and two 16x8 multiples */
|
||||
result = (fl1.l >> 8) * (fl2.l >> 8);
|
||||
result += ((fl1.l & 0xFF) * (fl2.l >> 8)) >> 8;
|
||||
result += ((fl2.l & 0xFF) * (fl1.l >> 8)) >> 8;
|
||||
|
||||
result >>= 2;
|
||||
if (result & 0x20000000)
|
||||
{
|
||||
/* round */
|
||||
result += 0x20;
|
||||
result >>= 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* round */
|
||||
result += 0x10;
|
||||
result >>= 5;
|
||||
exp--;
|
||||
}
|
||||
if (result & (HIDDEN<<1)) {
|
||||
result >>= 1;
|
||||
exp++;
|
||||
}
|
||||
|
||||
result &= ~HIDDEN;
|
||||
|
||||
/* pack up and go home */
|
||||
fl1.l = PACK (sign, exp, result);
|
||||
test_done:
|
||||
return (fl1.f);
|
||||
}
|
||||
|
||||
/* divide two floats */
|
||||
float
|
||||
__divsf3 (float a1, float a2)
|
||||
{
|
||||
union float_long fl1, fl2;
|
||||
int result;
|
||||
int mask;
|
||||
int exp, sign;
|
||||
|
||||
fl1.f = a1;
|
||||
fl2.f = a2;
|
||||
|
||||
/* subtract exponents */
|
||||
exp = EXP (fl1.l) - EXP (fl2.l) + EXCESS;
|
||||
|
||||
/* compute sign */
|
||||
sign = SIGN (fl1.l) ^ SIGN (fl2.l);
|
||||
|
||||
/* divide by zero??? */
|
||||
if (!fl2.l)
|
||||
/* return NaN or -NaN */
|
||||
return (sign ? 0xFFFFFFFF : 0x7FFFFFFF);
|
||||
|
||||
/* numerator zero??? */
|
||||
if (!fl1.l)
|
||||
return (0);
|
||||
|
||||
/* now get mantissas */
|
||||
fl1.l = MANT (fl1.l);
|
||||
fl2.l = MANT (fl2.l);
|
||||
|
||||
/* this assures we have 25 bits of precision in the end */
|
||||
if (fl1.l < fl2.l)
|
||||
{
|
||||
fl1.l <<= 1;
|
||||
exp--;
|
||||
}
|
||||
|
||||
/* now we perform repeated subtraction of fl2.l from fl1.l */
|
||||
mask = 0x1000000;
|
||||
result = 0;
|
||||
while (mask)
|
||||
{
|
||||
if (fl1.l >= fl2.l)
|
||||
{
|
||||
result |= mask;
|
||||
fl1.l -= fl2.l;
|
||||
}
|
||||
fl1.l <<= 1;
|
||||
mask >>= 1;
|
||||
}
|
||||
|
||||
/* round */
|
||||
result += 1;
|
||||
|
||||
/* normalize down */
|
||||
exp++;
|
||||
result >>= 1;
|
||||
|
||||
result &= ~HIDDEN;
|
||||
|
||||
/* pack up and go home */
|
||||
fl1.l = PACK (sign, exp, result);
|
||||
return (fl1.f);
|
||||
}
|
||||
|
||||
/* convert int to double */
|
||||
double
|
||||
__floatsidf (long a1)
|
||||
{
|
||||
int sign = 0, exp = 31 + EXCESSD;
|
||||
union double_long dl;
|
||||
|
||||
if (!a1)
|
||||
{
|
||||
dl.l.upper = dl.l.lower = 0;
|
||||
return (dl.d);
|
||||
}
|
||||
|
||||
if (a1 < 0)
|
||||
{
|
||||
sign = SIGNBIT;
|
||||
a1 = -a1;
|
||||
}
|
||||
|
||||
while (a1 < 0x1000000)
|
||||
{
|
||||
a1 <<= 4;
|
||||
exp -= 4;
|
||||
}
|
||||
|
||||
while (a1 < 0x40000000)
|
||||
{
|
||||
a1 <<= 1;
|
||||
exp--;
|
||||
}
|
||||
|
||||
/* pack up and go home */
|
||||
dl.l.upper = sign;
|
||||
dl.l.upper |= exp << 20;
|
||||
dl.l.upper |= (a1 >> 10) & ~HIDDEND;
|
||||
dl.l.lower = a1 << 22;
|
||||
|
||||
return (dl.d);
|
||||
}
|
||||
|
||||
double
|
||||
__floatdidf (long long a1)
|
||||
{
|
||||
int exp = 63 + EXCESSD;
|
||||
union double_long dl;
|
||||
|
||||
dl.l.upper = dl.l.lower = 0;
|
||||
if (a1 == 0)
|
||||
return (dl.d);
|
||||
|
||||
if (a1 < 0) {
|
||||
dl.l.upper = SIGNBIT;
|
||||
a1 = -a1;
|
||||
}
|
||||
|
||||
while (a1 < (long long)1<<54) {
|
||||
a1 <<= 8;
|
||||
exp -= 8;
|
||||
}
|
||||
while (a1 < (long long)1<<62) {
|
||||
a1 <<= 1;
|
||||
exp -= 1;
|
||||
}
|
||||
|
||||
/* pack up and go home */
|
||||
dl.ll |= (a1 >> 10) & ~HIDDEND_LL;
|
||||
dl.l.upper |= exp << 20;
|
||||
|
||||
return (dl.d);
|
||||
}
|
||||
|
||||
float
|
||||
__floatsisf (long a1)
|
||||
{
|
||||
(float)__floatsidf(a1);
|
||||
}
|
||||
|
||||
float
|
||||
__floatdisf (long long a1)
|
||||
{
|
||||
(float)__floatdidf(a1);
|
||||
}
|
||||
|
||||
/* negate a float */
|
||||
float
|
||||
__negsf2 (float a1)
|
||||
{
|
||||
union float_long fl1;
|
||||
|
||||
fl1.f = a1;
|
||||
if (!fl1.l)
|
||||
return (0);
|
||||
|
||||
fl1.l ^= SIGNBIT;
|
||||
return (fl1.f);
|
||||
}
|
||||
|
||||
/* negate a double */
|
||||
double
|
||||
__negdf2 (double a1)
|
||||
{
|
||||
union double_long dl1;
|
||||
|
||||
dl1.d = a1;
|
||||
|
||||
if (!dl1.l.upper && !dl1.l.lower)
|
||||
return (dl1.d);
|
||||
|
||||
dl1.l.upper ^= SIGNBIT;
|
||||
return (dl1.d);
|
||||
}
|
||||
|
||||
/* convert float to double */
|
||||
double
|
||||
__extendsfdf2 (float a1)
|
||||
{
|
||||
union float_long fl1;
|
||||
union double_long dl;
|
||||
int exp;
|
||||
|
||||
fl1.f = a1;
|
||||
|
||||
if (!fl1.l)
|
||||
{
|
||||
dl.l.upper = dl.l.lower = 0;
|
||||
return (dl.d);
|
||||
}
|
||||
|
||||
dl.l.upper = SIGN (fl1.l);
|
||||
exp = EXP (fl1.l) - EXCESS + EXCESSD;
|
||||
dl.l.upper |= exp << 20;
|
||||
dl.l.upper |= (MANT (fl1.l) & ~HIDDEN) >> 3;
|
||||
dl.l.lower = MANT (fl1.l) << 29;
|
||||
|
||||
return (dl.d);
|
||||
}
|
||||
|
||||
/* convert double to float */
|
||||
float
|
||||
__truncdfsf2 (double a1)
|
||||
{
|
||||
int exp;
|
||||
long mant;
|
||||
union float_long fl;
|
||||
union double_long dl1;
|
||||
|
||||
dl1.d = a1;
|
||||
|
||||
if (!dl1.l.upper && !dl1.l.lower)
|
||||
return (float)(0);
|
||||
|
||||
exp = EXPD (dl1) - EXCESSD + EXCESS;
|
||||
|
||||
/* shift double mantissa 6 bits so we can round */
|
||||
mant = MANTD (dl1) >> 6;
|
||||
|
||||
/* now round and shift down */
|
||||
mant += 1;
|
||||
mant >>= 1;
|
||||
|
||||
/* did the round overflow? */
|
||||
if (mant & 0xFE000000)
|
||||
{
|
||||
mant >>= 1;
|
||||
exp++;
|
||||
}
|
||||
|
||||
mant &= ~HIDDEN;
|
||||
|
||||
/* pack up and go home */
|
||||
fl.l = PACK (SIGND (dl1), exp, mant);
|
||||
return (fl.f);
|
||||
}
|
||||
|
||||
/* compare two doubles */
|
||||
long
|
||||
__cmpdf2 (double a1, double a2)
|
||||
{
|
||||
union double_long dl1, dl2;
|
||||
|
||||
dl1.d = a1;
|
||||
dl2.d = a2;
|
||||
|
||||
if (SIGND (dl1) && SIGND (dl2))
|
||||
{
|
||||
dl1.l.upper ^= SIGNBIT;
|
||||
dl2.l.upper ^= SIGNBIT;
|
||||
}
|
||||
if (dl1.l.upper < dl2.l.upper)
|
||||
return (-1);
|
||||
if (dl1.l.upper > dl2.l.upper)
|
||||
return (1);
|
||||
if (dl1.l.lower < dl2.l.lower)
|
||||
return (-1);
|
||||
if (dl1.l.lower > dl2.l.lower)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* convert double to int */
|
||||
long
|
||||
__fixdfsi (double a1)
|
||||
{
|
||||
union double_long dl1;
|
||||
int exp;
|
||||
long l;
|
||||
|
||||
dl1.d = a1;
|
||||
|
||||
if (!dl1.l.upper && !dl1.l.lower)
|
||||
return (0);
|
||||
|
||||
exp = EXPD (dl1) - EXCESSD - 31;
|
||||
l = MANTD (dl1);
|
||||
|
||||
if (exp > 0)
|
||||
return SIGND(dl1) ? (1<<31) : ((1ul<<31)-1);
|
||||
|
||||
/* shift down until exp = 0 or l = 0 */
|
||||
if (exp < 0 && exp > -32 && l)
|
||||
l >>= -exp;
|
||||
else
|
||||
return (0);
|
||||
|
||||
return (SIGND (dl1) ? -l : l);
|
||||
}
|
||||
|
||||
/* convert double to int */
|
||||
long long
|
||||
__fixdfdi (double a1)
|
||||
{
|
||||
union double_long dl1;
|
||||
int exp;
|
||||
long long l;
|
||||
|
||||
dl1.d = a1;
|
||||
|
||||
if (!dl1.l.upper && !dl1.l.lower)
|
||||
return (0);
|
||||
|
||||
exp = EXPD (dl1) - EXCESSD - 64;
|
||||
l = MANTD_LL(dl1);
|
||||
|
||||
if (exp > 0) {
|
||||
l = (long long)1<<63;
|
||||
if (!SIGND(dl1))
|
||||
l--;
|
||||
return l;
|
||||
}
|
||||
|
||||
/* shift down until exp = 0 or l = 0 */
|
||||
if (exp < 0 && exp > -64 && l)
|
||||
l >>= -exp;
|
||||
else
|
||||
return (0);
|
||||
|
||||
return (SIGND (dl1) ? -l : l);
|
||||
}
|
||||
|
||||
/* convert double to unsigned int */
|
||||
unsigned long
|
||||
__fixunsdfsi (double a1)
|
||||
{
|
||||
union double_long dl1;
|
||||
int exp;
|
||||
unsigned long l;
|
||||
|
||||
dl1.d = a1;
|
||||
|
||||
if (!dl1.l.upper && !dl1.l.lower)
|
||||
return (0);
|
||||
|
||||
exp = EXPD (dl1) - EXCESSD - 32;
|
||||
l = (((((dl1.l.upper) & 0xFFFFF) | HIDDEND) << 11) | (dl1.l.lower >> 21));
|
||||
|
||||
if (exp > 0)
|
||||
return (0xFFFFFFFFul); /* largest integer */
|
||||
|
||||
/* shift down until exp = 0 or l = 0 */
|
||||
if (exp < 0 && exp > -32 && l)
|
||||
l >>= -exp;
|
||||
else
|
||||
return (0);
|
||||
|
||||
return (l);
|
||||
}
|
||||
|
||||
/* convert double to unsigned int */
|
||||
unsigned long long
|
||||
__fixunsdfdi (double a1)
|
||||
{
|
||||
union double_long dl1;
|
||||
int exp;
|
||||
unsigned long long l;
|
||||
|
||||
dl1.d = a1;
|
||||
|
||||
if (dl1.ll == 0)
|
||||
return (0);
|
||||
|
||||
exp = EXPD (dl1) - EXCESSD - 64;
|
||||
|
||||
l = dl1.ll;
|
||||
|
||||
if (exp > 0)
|
||||
return (unsigned long long)-1;
|
||||
|
||||
/* shift down until exp = 0 or l = 0 */
|
||||
if (exp < 0 && exp > -64 && l)
|
||||
l >>= -exp;
|
||||
else
|
||||
return (0);
|
||||
|
||||
return (l);
|
||||
}
|
||||
|
||||
/* addtwo doubles */
|
||||
double
|
||||
__adddf3 (double a1, double a2)
|
||||
{
|
||||
long long mant1, mant2;
|
||||
union double_long fl1, fl2;
|
||||
int exp1, exp2;
|
||||
int sign = 0;
|
||||
|
||||
fl1.d = a1;
|
||||
fl2.d = a2;
|
||||
|
||||
/* check for zero args */
|
||||
if (!fl2.ll)
|
||||
goto test_done;
|
||||
if (!fl1.ll) {
|
||||
fl1.d = fl2.d;
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
exp1 = EXPD(fl1);
|
||||
exp2 = EXPD(fl2);
|
||||
|
||||
if (exp1 > exp2 + 54)
|
||||
goto test_done;
|
||||
if (exp2 > exp1 + 54) {
|
||||
fl1.d = fl2.d;
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
/* do everything in excess precision so's we can round later */
|
||||
mant1 = MANTD_LL(fl1) << 9;
|
||||
mant2 = MANTD_LL(fl2) << 9;
|
||||
|
||||
if (SIGND(fl1))
|
||||
mant1 = -mant1;
|
||||
if (SIGND(fl2))
|
||||
mant2 = -mant2;
|
||||
|
||||
if (exp1 > exp2)
|
||||
mant2 >>= exp1 - exp2;
|
||||
else {
|
||||
mant1 >>= exp2 - exp1;
|
||||
exp1 = exp2;
|
||||
}
|
||||
mant1 += mant2;
|
||||
|
||||
if (mant1 < 0) {
|
||||
mant1 = -mant1;
|
||||
sign = SIGNBIT;
|
||||
} else if (!mant1) {
|
||||
fl1.d = 0;
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
/* normalize up */
|
||||
while (!(mant1 & ((long long)7<<61))) {
|
||||
mant1 <<= 1;
|
||||
exp1--;
|
||||
}
|
||||
|
||||
/* normalize down? */
|
||||
if (mant1 & ((long long)3<<62)) {
|
||||
mant1 >>= 1;
|
||||
exp1++;
|
||||
}
|
||||
|
||||
/* round to even */
|
||||
mant1 += (mant1 & (1<<9)) ? (1<<8) : ((1<<8)-1);
|
||||
|
||||
/* normalize down? */
|
||||
if (mant1 & ((long long)3<<62)) {
|
||||
mant1 >>= 1;
|
||||
exp1++;
|
||||
}
|
||||
|
||||
/* lose extra precision */
|
||||
mant1 >>= 9;
|
||||
|
||||
/* turn off hidden bit */
|
||||
mant1 &= ~HIDDEND_LL;
|
||||
|
||||
/* pack up and go home */
|
||||
fl1.ll = PACKD_LL(sign,exp1,mant1);
|
||||
|
||||
test_done:
|
||||
return (fl1.d);
|
||||
}
|
||||
|
||||
/* subtract two doubles */
|
||||
double
|
||||
__subdf3 (double a1, double a2)
|
||||
{
|
||||
union double_long fl1, fl2;
|
||||
|
||||
fl1.d = a1;
|
||||
fl2.d = a2;
|
||||
|
||||
/* check for zero args */
|
||||
if (!fl2.ll)
|
||||
return (fl1.d);
|
||||
/* twiddle sign bit and add */
|
||||
fl2.l.upper ^= SIGNBIT;
|
||||
if (!fl1.ll)
|
||||
return (fl2.d);
|
||||
return __adddf3 (a1, fl2.d);
|
||||
}
|
||||
|
||||
/* multiply two doubles */
|
||||
double
|
||||
__muldf3 (double a1, double a2)
|
||||
{
|
||||
union double_long fl1, fl2;
|
||||
unsigned long long result;
|
||||
int exp;
|
||||
int sign;
|
||||
|
||||
fl1.d = a1;
|
||||
fl2.d = a2;
|
||||
|
||||
if (!fl1.ll || !fl2.ll) {
|
||||
fl1.d = 0;
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
/* compute sign and exponent */
|
||||
sign = SIGND(fl1) ^ SIGND(fl2);
|
||||
exp = EXPD(fl1) - EXCESSD;
|
||||
exp += EXPD(fl2);
|
||||
|
||||
fl1.ll = MANTD_LL(fl1);
|
||||
fl2.ll = MANTD_LL(fl2);
|
||||
|
||||
/* the multiply is done as one 31x31 multiply and two 31x21 multiples */
|
||||
result = (fl1.ll >> 21) * (fl2.ll >> 21);
|
||||
result += ((fl1.ll & 0x1FFFFF) * (fl2.ll >> 21)) >> 21;
|
||||
result += ((fl2.ll & 0x1FFFFF) * (fl1.ll >> 21)) >> 21;
|
||||
|
||||
result >>= 2;
|
||||
if (result & ((long long)1<<61)) {
|
||||
/* round */
|
||||
result += 1<<8;
|
||||
result >>= 9;
|
||||
} else {
|
||||
/* round */
|
||||
result += 1<<7;
|
||||
result >>= 8;
|
||||
exp--;
|
||||
}
|
||||
if (result & (HIDDEND_LL<<1)) {
|
||||
result >>= 1;
|
||||
exp++;
|
||||
}
|
||||
|
||||
result &= ~HIDDEND_LL;
|
||||
|
||||
/* pack up and go home */
|
||||
fl1.ll = PACKD_LL(sign,exp,result);
|
||||
test_done:
|
||||
return (fl1.d);
|
||||
}
|
||||
|
||||
/* divide two doubles */
|
||||
double
|
||||
__divdf3 (double a1, double a2)
|
||||
{
|
||||
union double_long fl1, fl2;
|
||||
long long mask,result;
|
||||
int exp, sign;
|
||||
|
||||
fl1.d = a1;
|
||||
fl2.d = a2;
|
||||
|
||||
/* subtract exponents */
|
||||
exp = EXPD(fl1) - EXPD(fl2) + EXCESSD;
|
||||
|
||||
/* compute sign */
|
||||
sign = SIGND(fl1) ^ SIGND(fl2);
|
||||
|
||||
/* numerator zero??? */
|
||||
if (fl1.ll == 0) {
|
||||
/* divide by zero??? */
|
||||
if (fl2.ll == 0)
|
||||
fl1.ll = ((unsigned long long)1<<63)-1; /* NaN */
|
||||
else
|
||||
fl1.ll = 0;
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
/* return +Inf or -Inf */
|
||||
if (fl2.ll == 0) {
|
||||
fl1.ll = PACKD_LL(SIGND(fl1),2047,0);
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
|
||||
/* now get mantissas */
|
||||
fl1.ll = MANTD_LL(fl1);
|
||||
fl2.ll = MANTD_LL(fl2);
|
||||
|
||||
/* this assures we have 54 bits of precision in the end */
|
||||
if (fl1.ll < fl2.ll) {
|
||||
fl1.ll <<= 1;
|
||||
exp--;
|
||||
}
|
||||
|
||||
/* now we perform repeated subtraction of fl2.ll from fl1.ll */
|
||||
mask = (long long)1<<53;
|
||||
result = 0;
|
||||
while (mask) {
|
||||
if (fl1.ll >= fl2.ll)
|
||||
{
|
||||
result |= mask;
|
||||
fl1.ll -= fl2.ll;
|
||||
}
|
||||
fl1.ll <<= 1;
|
||||
mask >>= 1;
|
||||
}
|
||||
|
||||
/* round */
|
||||
result += 1;
|
||||
|
||||
/* normalize down */
|
||||
exp++;
|
||||
result >>= 1;
|
||||
|
||||
result &= ~HIDDEND_LL;
|
||||
|
||||
/* pack up and go home */
|
||||
fl1.ll = PACKD_LL(sign, exp, result);
|
||||
|
||||
test_done:
|
||||
return (fl1.d);
|
||||
}
|
||||
|
||||
int
|
||||
__gtdf2 (double a1, double a2)
|
||||
{
|
||||
return __cmpdf2 ((float) a1, (float) a2) > 0;
|
||||
}
|
||||
|
||||
int
|
||||
__gedf2 (double a1, double a2)
|
||||
{
|
||||
return (__cmpdf2 ((float) a1, (float) a2) >= 0) - 1;
|
||||
}
|
||||
|
||||
int
|
||||
__ltdf2 (double a1, double a2)
|
||||
{
|
||||
return - (__cmpdf2 ((float) a1, (float) a2) < 0);
|
||||
}
|
||||
|
||||
int
|
||||
__ledf2 (double a1, double a2)
|
||||
{
|
||||
return __cmpdf2 ((float) a1, (float) a2) > 0;
|
||||
}
|
||||
|
||||
int
|
||||
__eqdf2 (double a1, double a2)
|
||||
{
|
||||
return *(long long *) &a1 == *(long long *) &a2;
|
||||
}
|
||||
|
||||
int
|
||||
__nedf2 (double a1, double a2)
|
||||
{
|
||||
return *(long long *) &a1 != *(long long *) &a2;
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
From: friedman@gnu.ai.mit.edu (Noah Friedman)
|
||||
To: roland@gnu.ai.mit.edu (Roland McGrath),
|
||||
rms@gnu.ai.mit.edu (Richard Stallman),
|
||||
jimb@gnu.ai.mit.edu (Jim Blandy),
|
||||
mib@gnu.ai.mit.edu (Michael Bushnell)
|
||||
Cc: cgw@sol.acs.unt.edu (chris williams),
|
||||
clc@gnu.ai.mit.edu (Christian Longshore Claiborn)
|
||||
Subject: Some gcc options we'd like to see.
|
||||
Date: Mon, 28 Jun 93 00:45:09 EST
|
||||
Reply-To: friedman@gnu.ai.mit.edu
|
||||
|
||||
-Waggravate-return
|
||||
-Wcast-spell
|
||||
-Wcaste-align
|
||||
-Win
|
||||
-Wmissing-protons
|
||||
-Wredundant-repetitions
|
||||
-antsy
|
||||
-fbungee-jump
|
||||
-fexpensive-operations
|
||||
-fextra-strength
|
||||
-fjesus-saves
|
||||
-fkeep-programmers-inline
|
||||
-fno-peeping-toms
|
||||
-fruit-roll-ups
|
||||
-fshort-enough
|
||||
-mno-dialogue
|
||||
-pedophile
|
||||
-vomit-frame-pointer
|
||||
|
||||
From: Alexandre Oliva <aoliva@redhat.com>
|
||||
Date: 06 Jan 2002 17:37:07 -0200
|
||||
|
||||
On Jan 2, 2002, in a long, heated thread concerning the interpretation
|
||||
of certain passages of the C standard, jtv <jtv@xs4all.nl> wrote:
|
||||
|
||||
> (Yes, I'm a pedant. I'm pining for the day when gcc will support the
|
||||
> options "-ffascist -Wanal")
|
||||
|
||||
How about introducing the options `-flame -War' :-)
|
1056
contrib/gcc/getopt.c
1056
contrib/gcc/getopt.c
File diff suppressed because it is too large
Load Diff
@ -1,144 +0,0 @@
|
||||
/* Declarations for getopt.
|
||||
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 2000,
|
||||
2002 Free Software Foundation, Inc.
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
Bugs can be reported to bug-glibc@gnu.org.
|
||||
|
||||
This program 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.
|
||||
|
||||
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. */
|
||||
|
||||
#ifndef _GETOPT_H
|
||||
#define _GETOPT_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* For communication from `getopt' to the caller.
|
||||
When `getopt' finds an option that takes an argument,
|
||||
the argument value is returned here.
|
||||
Also, when `ordering' is RETURN_IN_ORDER,
|
||||
each non-option ARGV-element is returned here. */
|
||||
|
||||
extern char *optarg;
|
||||
|
||||
/* Index in ARGV of the next element to be scanned.
|
||||
This is used for communication to and from the caller
|
||||
and for communication between successive calls to `getopt'.
|
||||
|
||||
On entry to `getopt', zero means this is the first call; initialize.
|
||||
|
||||
When `getopt' returns -1, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, `optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
extern int optind;
|
||||
|
||||
/* Callers store zero here to inhibit the error message `getopt' prints
|
||||
for unrecognized options. */
|
||||
|
||||
extern int opterr;
|
||||
|
||||
/* Set to an option character which was unrecognized. */
|
||||
|
||||
extern int optopt;
|
||||
|
||||
/* Describe the long-named options requested by the application.
|
||||
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
||||
of `struct option' terminated by an element containing a name which is
|
||||
zero.
|
||||
|
||||
The field `has_arg' is:
|
||||
no_argument (or 0) if the option does not take an argument,
|
||||
required_argument (or 1) if the option requires an argument,
|
||||
optional_argument (or 2) if the option takes an optional argument.
|
||||
|
||||
If the field `flag' is not NULL, it points to a variable that is set
|
||||
to the value given in the field `val' when the option is found, but
|
||||
left unchanged if the option is not found.
|
||||
|
||||
To have a long-named option do something other than set an `int' to
|
||||
a compiled-in constant, such as set a value from `optarg', set the
|
||||
option's `flag' field to zero and its `val' field to a nonzero
|
||||
value (the equivalent single-letter option character, if there is
|
||||
one). For long options that have a zero `flag' field, `getopt'
|
||||
returns the contents of the `val' field. */
|
||||
|
||||
struct option
|
||||
{
|
||||
#if defined (__STDC__) && __STDC__
|
||||
const char *name;
|
||||
#else
|
||||
char *name;
|
||||
#endif
|
||||
/* has_arg can't be an enum because some compilers complain about
|
||||
type mismatches in all the code that assumes it is an int. */
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
|
||||
/* Names for the values of the `has_arg' field of `struct option'. */
|
||||
|
||||
#define no_argument 0
|
||||
#define required_argument 1
|
||||
#define optional_argument 2
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is
|
||||
undefined, we haven't run the autoconf check so provide the
|
||||
declaration without arguments. If it is 0, we checked and failed
|
||||
to find the declaration so provide a fully prototyped one. If it
|
||||
is 1, we found it so don't provide any declaration at all. */
|
||||
#if !HAVE_DECL_GETOPT
|
||||
#if defined (__GNU_LIBRARY__) || defined (HAVE_DECL_GETOPT)
|
||||
/* Many other libraries have conflicting prototypes for getopt, with
|
||||
differences in the consts, in unistd.h. To avoid compilation
|
||||
errors, only prototype getopt for the GNU C library. */
|
||||
extern int getopt (int argc, char *const *argv, const char *shortopts);
|
||||
#else
|
||||
#ifndef __cplusplus
|
||||
extern int getopt ();
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
#endif /* !HAVE_DECL_GETOPT */
|
||||
|
||||
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
|
||||
const struct option *longopts, int *longind);
|
||||
extern int getopt_long_only (int argc, char *const *argv,
|
||||
const char *shortopts,
|
||||
const struct option *longopts, int *longind);
|
||||
|
||||
/* Internal only. Users should not call this directly. */
|
||||
extern int _getopt_internal (int argc, char *const *argv,
|
||||
const char *shortopts,
|
||||
const struct option *longopts, int *longind,
|
||||
int long_only);
|
||||
#else /* not __STDC__ */
|
||||
extern int getopt ();
|
||||
extern int getopt_long ();
|
||||
extern int getopt_long_only ();
|
||||
|
||||
extern int _getopt_internal ();
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* getopt.h */
|
@ -1,190 +0,0 @@
|
||||
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||||
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
NOTE: This source is derived from an old version taken from the GNU C
|
||||
Library (glibc).
|
||||
|
||||
This program 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.
|
||||
|
||||
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. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
#if !defined __STDC__ || !__STDC__
|
||||
/* This is a separate conditional since some stdc systems
|
||||
reject `defined (const)'. */
|
||||
#ifndef const
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#define GETOPT_INTERFACE_VERSION 2
|
||||
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
|
||||
#include <gnu-versions.h>
|
||||
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
|
||||
#define ELIDE_CODE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ELIDE_CODE
|
||||
|
||||
|
||||
/* This needs to come after some library #include
|
||||
to get __GNU_LIBRARY__ defined. */
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
int
|
||||
getopt_long (argc, argv, options, long_options, opt_index)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
const char *options;
|
||||
const struct option *long_options;
|
||||
int *opt_index;
|
||||
{
|
||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
|
||||
}
|
||||
|
||||
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
||||
If an option that starts with '-' (not '--') doesn't match a long option,
|
||||
but does match a short option, it is parsed as a short option
|
||||
instead. */
|
||||
|
||||
int
|
||||
getopt_long_only (argc, argv, options, long_options, opt_index)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
const char *options;
|
||||
const struct option *long_options;
|
||||
int *opt_index;
|
||||
{
|
||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
|
||||
}
|
||||
|
||||
|
||||
#endif /* Not ELIDE_CODE. */
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int c;
|
||||
int digit_optind = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int this_option_optind = optind ? optind : 1;
|
||||
int option_index = 0;
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"add", 1, 0, 0},
|
||||
{"append", 0, 0, 0},
|
||||
{"delete", 1, 0, 0},
|
||||
{"verbose", 0, 0, 0},
|
||||
{"create", 0, 0, 0},
|
||||
{"file", 1, 0, 0},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
c = getopt_long (argc, argv, "abc:d:0123456789",
|
||||
long_options, &option_index);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 0:
|
||||
printf ("option %s", long_options[option_index].name);
|
||||
if (optarg)
|
||||
printf (" with arg %s", optarg);
|
||||
printf ("\n");
|
||||
break;
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
||||
printf ("digits occur in two different argv-elements.\n");
|
||||
digit_optind = this_option_optind;
|
||||
printf ("option %c\n", c);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
printf ("option a\n");
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
printf ("option b\n");
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
printf ("option c with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
printf ("option d with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("?? getopt returned character code 0%o ??\n", c);
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
{
|
||||
printf ("non-option ARGV-elements: ");
|
||||
while (optind < argc)
|
||||
printf ("%s ", argv[optind++]);
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
@ -1,38 +0,0 @@
|
||||
/* Definition of location data type used in various part of GCC
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
|
||||
|
||||
This program 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.
|
||||
|
||||
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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
In other words, you are welcome to use, share and improve this program.
|
||||
You are forbidden to forbid anyone else to use, share and improve
|
||||
what you give them. Help stamp out software-hoarding! */
|
||||
|
||||
#ifndef GCC_LOCATION_H
|
||||
#define GCC_LOCATION_H
|
||||
|
||||
/* The data structure used to record a location in a translation unit. */
|
||||
struct location_s GTY (())
|
||||
{
|
||||
/* The name of the source file involved. */
|
||||
const char *file;
|
||||
|
||||
/* The line-location in the source file. */
|
||||
int line;
|
||||
};
|
||||
typedef struct location_s location_t;
|
||||
|
||||
#endif
|
||||
|
@ -1,334 +0,0 @@
|
||||
/* Multibyte Character Functions.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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.
|
||||
|
||||
GCC 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 GCC; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
/* Note regarding cross compilation:
|
||||
|
||||
In general, translation of multibyte characters to wide characters can
|
||||
only work in a native compiler since the translation function (mbtowc)
|
||||
needs to know about both the source and target character encoding. However,
|
||||
this particular implementation for JIS, SJIS and EUCJP source characters
|
||||
will work for any compiler with a newlib target. Other targets may also
|
||||
work provided that their wchar_t implementation is 2 bytes and the encoding
|
||||
leaves the source character values unchanged (except for removing the
|
||||
state shifting markers). */
|
||||
|
||||
#include "config.h"
|
||||
#ifdef MULTIBYTE_CHARS
|
||||
#include "system.h"
|
||||
#include "mbchar.h"
|
||||
#include <locale.h>
|
||||
|
||||
typedef enum {ESCAPE, DOLLAR, BRACKET, AT, B, J, NUL, JIS_CHAR, OTHER,
|
||||
JIS_C_NUM} JIS_CHAR_TYPE;
|
||||
|
||||
typedef enum {ASCII, A_ESC, A_ESC_DL, JIS, JIS_1, JIS_2, J_ESC, J_ESC_BR,
|
||||
J2_ESC, J2_ESC_BR, INV, JIS_S_NUM} JIS_STATE;
|
||||
|
||||
typedef enum {COPYA, COPYJ, COPYJ2, MAKE_A, MAKE_J, NOOP,
|
||||
EMPTY, ERROR} JIS_ACTION;
|
||||
|
||||
/* State/action tables for processing JIS encoding:
|
||||
|
||||
Where possible, switches to JIS are grouped with proceding JIS characters
|
||||
and switches to ASCII are grouped with preceding JIS characters.
|
||||
Thus, maximum returned length is:
|
||||
2 (switch to JIS) + 2 (JIS characters) + 2 (switch back to ASCII) = 6. */
|
||||
|
||||
static const JIS_STATE JIS_state_table[JIS_S_NUM][JIS_C_NUM] = {
|
||||
/* ESCAPE DOLLAR BRACKET AT B J NUL JIS_CHAR OTH*/
|
||||
/*ASCII*/ { A_ESC, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII,ASCII,ASCII},
|
||||
/*A_ESC*/ { ASCII, A_ESC_DL,ASCII, ASCII, ASCII, ASCII, ASCII,ASCII,ASCII},
|
||||
/*A_ESC_DL*/{ ASCII, ASCII, ASCII, JIS, JIS, ASCII, ASCII,ASCII,ASCII},
|
||||
/*JIS*/ { J_ESC, JIS_1, JIS_1, JIS_1, JIS_1, JIS_1, INV, JIS_1,INV },
|
||||
/*JIS_1*/ { INV, JIS_2, JIS_2, JIS_2, JIS_2, JIS_2, INV, JIS_2,INV },
|
||||
/*JIS_2*/ { J2_ESC,JIS, JIS, JIS, JIS, JIS, INV, JIS, JIS },
|
||||
/*J_ESC*/ { INV, INV, J_ESC_BR, INV, INV, INV, INV, INV, INV },
|
||||
/*J_ESC_BR*/{ INV, INV, INV, INV, ASCII, ASCII, INV, INV, INV },
|
||||
/*J2_ESC*/ { INV, INV, J2_ESC_BR,INV, INV, INV, INV, INV, INV },
|
||||
/*J2_ESC_BR*/{INV, INV, INV, INV, ASCII, ASCII, INV, INV, INV },
|
||||
};
|
||||
|
||||
static const JIS_ACTION JIS_action_table[JIS_S_NUM][JIS_C_NUM] = {
|
||||
/* ESCAPE DOLLAR BRACKET AT B J NUL JIS_CHAR OTH */
|
||||
/*ASCII */ {NOOP, COPYA, COPYA, COPYA, COPYA, COPYA, EMPTY, COPYA, COPYA},
|
||||
/*A_ESC */ {COPYA, NOOP, COPYA, COPYA, COPYA, COPYA, COPYA, COPYA, COPYA},
|
||||
/*A_ESC_DL */{COPYA, COPYA, COPYA, MAKE_J, MAKE_J, COPYA, COPYA, COPYA, COPYA},
|
||||
/*JIS */ {NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, ERROR, NOOP, ERROR},
|
||||
/*JIS_1 */ {ERROR, NOOP, NOOP, NOOP, NOOP, NOOP, ERROR, NOOP, ERROR},
|
||||
/*JIS_2 */ {NOOP, COPYJ2,COPYJ2,COPYJ2, COPYJ2, COPYJ2,ERROR, COPYJ2,COPYJ2},
|
||||
/*J_ESC */ {ERROR, ERROR, NOOP, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR},
|
||||
/*J_ESC_BR */{ERROR, ERROR, ERROR, ERROR, NOOP, NOOP, ERROR, ERROR, ERROR},
|
||||
/*J2_ESC */ {ERROR, ERROR, NOOP, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR},
|
||||
/*J2_ESC_BR*/{ERROR, ERROR, ERROR, ERROR, COPYJ, COPYJ, ERROR, ERROR, ERROR},
|
||||
};
|
||||
|
||||
|
||||
const char *literal_codeset = NULL;
|
||||
|
||||
/* Store into *PWC (if PWC is not null) the wide character
|
||||
corresponding to the multibyte character at the start of the
|
||||
buffer S of size N. Return the number of bytes in the multibyte
|
||||
character. Return -1 if the bytes do not form a valid character,
|
||||
or 0 if S is null or points to a null byte.
|
||||
|
||||
This function behaves like the Standard C function mbtowc, except
|
||||
it treats locale names of the form "C-..." specially. */
|
||||
|
||||
int
|
||||
local_mbtowc (pwc, s, n)
|
||||
wchar_t *pwc;
|
||||
const char *s;
|
||||
size_t n;
|
||||
{
|
||||
static JIS_STATE save_state = ASCII;
|
||||
JIS_STATE curr_state = save_state;
|
||||
const unsigned char *t = (const unsigned char *) s;
|
||||
|
||||
if (s != NULL && n == 0)
|
||||
return -1;
|
||||
|
||||
if (literal_codeset == NULL || strlen (literal_codeset) <= 1)
|
||||
/* This must be the "C" locale or unknown locale -- fall thru */
|
||||
;
|
||||
else if (! strcmp (literal_codeset, "C-SJIS"))
|
||||
{
|
||||
int char1;
|
||||
if (s == NULL)
|
||||
/* Not state-dependent. */
|
||||
return 0;
|
||||
|
||||
char1 = *t;
|
||||
if (ISSJIS1 (char1))
|
||||
{
|
||||
int char2 = t[1];
|
||||
|
||||
if (n <= 1)
|
||||
return -1;
|
||||
|
||||
if (ISSJIS2 (char2))
|
||||
{
|
||||
if (pwc != NULL)
|
||||
*pwc = (((wchar_t) *t) << 8) + (wchar_t) (*(t + 1));
|
||||
return 2;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pwc != NULL)
|
||||
*pwc = (wchar_t) *t;
|
||||
|
||||
if (*t == '\0')
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
else if (! strcmp (literal_codeset, "C-EUCJP"))
|
||||
{
|
||||
int char1;
|
||||
|
||||
if (s == NULL)
|
||||
/* Not state-dependent. */
|
||||
return 0;
|
||||
|
||||
char1 = *t;
|
||||
if (ISEUCJP (char1))
|
||||
{
|
||||
int char2 = t[1];
|
||||
|
||||
if (n <= 1)
|
||||
return -1;
|
||||
|
||||
if (ISEUCJP (char2))
|
||||
{
|
||||
if (pwc != NULL)
|
||||
*pwc = (((wchar_t) *t) << 8) + (wchar_t) (*(t + 1));
|
||||
return 2;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pwc != NULL)
|
||||
*pwc = (wchar_t) *t;
|
||||
|
||||
if (*t == '\0')
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
else if (! strcmp (literal_codeset, "C-JIS"))
|
||||
{
|
||||
JIS_ACTION action;
|
||||
JIS_CHAR_TYPE ch;
|
||||
const unsigned char *ptr;
|
||||
size_t i, curr_ch;
|
||||
|
||||
if (s == NULL)
|
||||
{
|
||||
save_state = ASCII;
|
||||
/* State-dependent. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
ptr = t;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
curr_ch = t[i];
|
||||
switch (curr_ch)
|
||||
{
|
||||
case JIS_ESC_CHAR:
|
||||
ch = ESCAPE;
|
||||
break;
|
||||
case '$':
|
||||
ch = DOLLAR;
|
||||
break;
|
||||
case '@':
|
||||
ch = AT;
|
||||
break;
|
||||
case '(':
|
||||
ch = BRACKET;
|
||||
break;
|
||||
case 'B':
|
||||
ch = B;
|
||||
break;
|
||||
case 'J':
|
||||
ch = J;
|
||||
break;
|
||||
case '\0':
|
||||
ch = NUL;
|
||||
break;
|
||||
default:
|
||||
if (ISJIS (curr_ch))
|
||||
ch = JIS_CHAR;
|
||||
else
|
||||
ch = OTHER;
|
||||
}
|
||||
|
||||
action = JIS_action_table[curr_state][ch];
|
||||
curr_state = JIS_state_table[curr_state][ch];
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case NOOP:
|
||||
break;
|
||||
|
||||
case EMPTY:
|
||||
if (pwc != NULL)
|
||||
*pwc = (wchar_t) 0;
|
||||
|
||||
save_state = curr_state;
|
||||
return i;
|
||||
|
||||
case COPYA:
|
||||
if (pwc != NULL)
|
||||
*pwc = (wchar_t) *ptr;
|
||||
save_state = curr_state;
|
||||
return i + 1;
|
||||
|
||||
case COPYJ:
|
||||
if (pwc != NULL)
|
||||
*pwc = (((wchar_t) *ptr) << 8) + (wchar_t) (*(ptr + 1));
|
||||
|
||||
save_state = curr_state;
|
||||
return i + 1;
|
||||
|
||||
case COPYJ2:
|
||||
if (pwc != NULL)
|
||||
*pwc = (((wchar_t) *ptr) << 8) + (wchar_t) (*(ptr + 1));
|
||||
|
||||
save_state = curr_state;
|
||||
return ptr - t + 2;
|
||||
|
||||
case MAKE_A:
|
||||
case MAKE_J:
|
||||
ptr = (const unsigned char *) (t + i + 1);
|
||||
break;
|
||||
|
||||
case ERROR:
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* More than n bytes needed. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef CROSS_COMPILE
|
||||
if (s == NULL)
|
||||
/* Not state-dependent. */
|
||||
return 0;
|
||||
|
||||
if (pwc != NULL)
|
||||
*pwc = *s;
|
||||
return 1;
|
||||
#else
|
||||
|
||||
/* This must be the "C" locale or unknown locale. */
|
||||
return mbtowc (pwc, s, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Return the number of bytes in the multibyte character at the start
|
||||
of the buffer S of size N. Return -1 if the bytes do not form a
|
||||
valid character, or 0 if S is null or points to a null byte.
|
||||
|
||||
This function behaves like the Standard C function mblen, except
|
||||
it treats locale names of the form "C-..." specially. */
|
||||
|
||||
int
|
||||
local_mblen (s, n)
|
||||
const char *s;
|
||||
size_t n;
|
||||
{
|
||||
return local_mbtowc (NULL, s, n);
|
||||
}
|
||||
|
||||
/* Return the maximum mumber of bytes in a multibyte character.
|
||||
|
||||
This function returns the same value as the Standard C macro MB_CUR_MAX,
|
||||
except it treats locale names of the form "C-..." specially. */
|
||||
|
||||
int
|
||||
local_mb_cur_max ()
|
||||
{
|
||||
if (literal_codeset == NULL || strlen (literal_codeset) <= 1)
|
||||
;
|
||||
else if (! strcmp (literal_codeset, "C-SJIS"))
|
||||
return 2;
|
||||
else if (! strcmp (literal_codeset, "C-EUCJP"))
|
||||
return 2;
|
||||
else if (! strcmp (literal_codeset, "C-JIS"))
|
||||
return 8; /* 3 + 2 + 3 */
|
||||
|
||||
#ifdef CROSS_COMPILE
|
||||
return 1;
|
||||
#else
|
||||
if (MB_CUR_MAX > 0)
|
||||
return MB_CUR_MAX;
|
||||
|
||||
return 1; /* default */
|
||||
#endif
|
||||
}
|
||||
#else /* MULTIBYTE_CHARS */
|
||||
extern int dummy; /* silence 'ANSI C forbids an empty source file' warning */
|
||||
#endif /* MULTIBYTE_CHARS */
|
@ -1,41 +0,0 @@
|
||||
/* Various declarations for functions found in mbchar.c
|
||||
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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.
|
||||
|
||||
GCC 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 GCC; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifndef GCC_MBCHAR_H
|
||||
#define GCC_MBCHAR_H
|
||||
|
||||
#ifdef MULTIBYTE_CHARS
|
||||
|
||||
/* Escape character used for JIS encoding */
|
||||
#define JIS_ESC_CHAR 0x1b
|
||||
|
||||
#define ISSJIS1(c) (((c) >= 0x81 && (c) <= 0x9f) || ((c) >= 0xe0 && (c) <= 0xef))
|
||||
#define ISSJIS2(c) (((c) >= 0x40 && (c) <= 0x7e) || ((c) >= 0x80 && (c) <= 0xfc))
|
||||
#define ISEUCJP(c) ((c) >= 0xa1 && (c) <= 0xfe)
|
||||
#define ISJIS(c) ((c) >= 0x21 && (c) <= 0x7e)
|
||||
|
||||
extern int local_mbtowc PARAMS ((wchar_t *, const char *, size_t));
|
||||
extern int local_mblen PARAMS ((const char *, size_t));
|
||||
extern int local_mb_cur_max PARAMS ((void));
|
||||
|
||||
/* The locale being used for multibyte characters in string/char literals. */
|
||||
extern const char *literal_codeset;
|
||||
#endif /* MULTIBYTE_CHARS */
|
||||
#endif /* ! GCC_MBCHAR_H */
|
@ -1,43 +0,0 @@
|
||||
/* Switch definitions for the GNU compiler for the Objective-C language.
|
||||
Copyright (C) 2000 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. */
|
||||
|
||||
/* This is the contribution to the `documented_lang_options' array in
|
||||
toplev.c for Objective-C. */
|
||||
|
||||
DEFINE_LANG_NAME ("Objective C")
|
||||
|
||||
{ "-gen-decls",
|
||||
N_("Dump decls to a .decl file") },
|
||||
{ "-fgnu-runtime",
|
||||
N_("Generate code for GNU runtime environment") },
|
||||
{ "-fno-gnu-runtime", "" },
|
||||
{ "-fnext-runtime",
|
||||
N_("Generate code for NeXT runtime environment") },
|
||||
{ "-fno-next-runtime", "" },
|
||||
{ "-Wselector",
|
||||
N_("Warn if a selector has multiple methods") },
|
||||
{ "-Wno-selector", "" },
|
||||
{ "-Wprotocol", "" },
|
||||
{ "-Wno-protocol",
|
||||
N_("Do not warn if inherited methods are unimplemented") },
|
||||
{ "-print-objc-runtime-info",
|
||||
N_("Generate C header of platform specific features") },
|
||||
{ "-fconstant-string-class",
|
||||
N_("Specify the name of the class for constant strings") },
|
@ -1,651 +0,0 @@
|
||||
/* GNU Objective C Runtime message lookup
|
||||
Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Contributed by Kresten Krab Thorup
|
||||
|
||||
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. */
|
||||
|
||||
/* 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. */
|
||||
|
||||
#include "../tconfig.h"
|
||||
#include "runtime.h"
|
||||
#include "sarray.h"
|
||||
#include "encoding.h"
|
||||
#include "runtime-info.h"
|
||||
|
||||
/* this is how we hack STRUCT_VALUE to be 1 or 0 */
|
||||
#define gen_rtx(args...) 1
|
||||
#define gen_rtx_MEM(args...) 1
|
||||
#define rtx int
|
||||
|
||||
#if !defined(STRUCT_VALUE) || STRUCT_VALUE == 0
|
||||
#define INVISIBLE_STRUCT_RETURN 1
|
||||
#else
|
||||
#define INVISIBLE_STRUCT_RETURN 0
|
||||
#endif
|
||||
|
||||
/* The uninstalled dispatch table */
|
||||
struct sarray* __objc_uninstalled_dtable = 0; /* !T:MUTEX */
|
||||
|
||||
/* Send +initialize to class */
|
||||
static void __objc_send_initialize(Class);
|
||||
|
||||
static void __objc_install_dispatch_table_for_class (Class);
|
||||
|
||||
/* Forward declare some functions */
|
||||
static void __objc_init_install_dtable(id, SEL);
|
||||
|
||||
/* Various forwarding functions that are used based upon the
|
||||
return type for the selector.
|
||||
__objc_block_forward for structures.
|
||||
__objc_double_forward for floats/doubles.
|
||||
__objc_word_forward for pointers or types that fit in registers.
|
||||
*/
|
||||
static double __objc_double_forward(id, SEL, ...);
|
||||
static id __objc_word_forward(id, SEL, ...);
|
||||
typedef struct { id many[8]; } __big;
|
||||
#if INVISIBLE_STRUCT_RETURN
|
||||
static __big
|
||||
#else
|
||||
static id
|
||||
#endif
|
||||
__objc_block_forward(id, SEL, ...);
|
||||
static Method_t search_for_method_in_hierarchy (Class class, SEL sel);
|
||||
Method_t search_for_method_in_list(MethodList_t list, SEL op);
|
||||
id nil_method(id, SEL, ...);
|
||||
|
||||
/* Given a selector, return the proper forwarding implementation. */
|
||||
__inline__
|
||||
IMP
|
||||
__objc_get_forward_imp (SEL sel)
|
||||
{
|
||||
const char *t = sel->sel_types;
|
||||
|
||||
if (t && (*t == '[' || *t == '(' || *t == '{')
|
||||
#ifdef OBJC_MAX_STRUCT_BY_VALUE
|
||||
&& objc_sizeof_type(t) > OBJC_MAX_STRUCT_BY_VALUE
|
||||
#endif
|
||||
)
|
||||
return (IMP)__objc_block_forward;
|
||||
else if (t && (*t == 'f' || *t == 'd'))
|
||||
return (IMP)__objc_double_forward;
|
||||
else
|
||||
return (IMP)__objc_word_forward;
|
||||
}
|
||||
|
||||
/* Given a class and selector, return the selector's implementation. */
|
||||
__inline__
|
||||
IMP
|
||||
get_imp (Class class, SEL sel)
|
||||
{
|
||||
void* res = sarray_get_safe (class->dtable, (size_t) sel->sel_id);
|
||||
if (res == 0)
|
||||
{
|
||||
/* Not a valid method */
|
||||
if(class->dtable == __objc_uninstalled_dtable)
|
||||
{
|
||||
/* The dispatch table needs to be installed. */
|
||||
objc_mutex_lock(__objc_runtime_mutex);
|
||||
__objc_install_dispatch_table_for_class (class);
|
||||
objc_mutex_unlock(__objc_runtime_mutex);
|
||||
/* Call ourselves with the installed dispatch table
|
||||
and get the real method */
|
||||
res = get_imp(class, sel);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The dispatch table has been installed so the
|
||||
method just doesn't exist for the class.
|
||||
Return the forwarding implementation. */
|
||||
res = __objc_get_forward_imp(sel);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Query if an object can respond to a selector, returns YES if the
|
||||
object implements the selector otherwise NO. Does not check if the
|
||||
method can be forwarded. */
|
||||
__inline__
|
||||
BOOL
|
||||
__objc_responds_to (id object, SEL sel)
|
||||
{
|
||||
void* res;
|
||||
|
||||
/* Install dispatch table if need be */
|
||||
if (object->class_pointer->dtable == __objc_uninstalled_dtable)
|
||||
{
|
||||
objc_mutex_lock(__objc_runtime_mutex);
|
||||
__objc_install_dispatch_table_for_class (object->class_pointer);
|
||||
objc_mutex_unlock(__objc_runtime_mutex);
|
||||
}
|
||||
|
||||
/* Get the method from the dispatch table */
|
||||
res = sarray_get_safe (object->class_pointer->dtable, (size_t) sel->sel_id);
|
||||
return (res != 0);
|
||||
}
|
||||
|
||||
/* This is the lookup function. All entries in the table are either a
|
||||
valid method *or* zero. If zero then either the dispatch table
|
||||
needs to be installed or it doesn't exist and forwarding is attempted. */
|
||||
__inline__
|
||||
IMP
|
||||
objc_msg_lookup(id receiver, SEL op)
|
||||
{
|
||||
IMP result;
|
||||
if(receiver)
|
||||
{
|
||||
result = sarray_get_safe (receiver->class_pointer->dtable,
|
||||
(sidx)op->sel_id);
|
||||
if (result == 0)
|
||||
{
|
||||
/* Not a valid method */
|
||||
if(receiver->class_pointer->dtable == __objc_uninstalled_dtable)
|
||||
{
|
||||
/* The dispatch table needs to be installed.
|
||||
This happens on the very first method call to the class. */
|
||||
__objc_init_install_dtable(receiver, op);
|
||||
|
||||
/* Get real method for this in newly installed dtable */
|
||||
result = get_imp(receiver->class_pointer, op);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The dispatch table has been installed so the
|
||||
method just doesn't exist for the class.
|
||||
Attempt to forward the method. */
|
||||
result = __objc_get_forward_imp(op);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
else
|
||||
return nil_method;
|
||||
}
|
||||
|
||||
IMP
|
||||
objc_msg_lookup_super (Super_t super, SEL sel)
|
||||
{
|
||||
if (super->self)
|
||||
return get_imp (super->class, sel);
|
||||
else
|
||||
return nil_method;
|
||||
}
|
||||
|
||||
int method_get_sizeof_arguments (Method*);
|
||||
|
||||
retval_t
|
||||
objc_msg_sendv(id object, SEL op, arglist_t arg_frame)
|
||||
{
|
||||
Method* m = class_get_instance_method(object->class_pointer, op);
|
||||
const char *type;
|
||||
*((id*)method_get_first_argument (m, arg_frame, &type)) = object;
|
||||
*((SEL*)method_get_next_argument (arg_frame, &type)) = op;
|
||||
return __builtin_apply((apply_t)m->method_imp,
|
||||
arg_frame,
|
||||
method_get_sizeof_arguments (m));
|
||||
}
|
||||
|
||||
void
|
||||
__objc_init_dispatch_tables()
|
||||
{
|
||||
__objc_uninstalled_dtable
|
||||
= sarray_new(200, 0);
|
||||
}
|
||||
|
||||
/* This function is called by objc_msg_lookup when the
|
||||
dispatch table needs to be installed; thus it is called once
|
||||
for each class, namely when the very first message is sent to it. */
|
||||
static void
|
||||
__objc_init_install_dtable(id receiver, SEL op)
|
||||
{
|
||||
/* This may happen, if the programmer has taken the address of a
|
||||
method before the dtable was initialized... too bad for him! */
|
||||
if(receiver->class_pointer->dtable != __objc_uninstalled_dtable)
|
||||
return;
|
||||
|
||||
objc_mutex_lock(__objc_runtime_mutex);
|
||||
|
||||
if(CLS_ISCLASS(receiver->class_pointer))
|
||||
{
|
||||
/* receiver is an ordinary object */
|
||||
assert(CLS_ISCLASS(receiver->class_pointer));
|
||||
|
||||
/* install instance methods table */
|
||||
__objc_install_dispatch_table_for_class (receiver->class_pointer);
|
||||
|
||||
/* call +initialize -- this will in turn install the factory
|
||||
dispatch table if not already done :-) */
|
||||
__objc_send_initialize(receiver->class_pointer);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* receiver is a class object */
|
||||
assert(CLS_ISCLASS((Class)receiver));
|
||||
assert(CLS_ISMETA(receiver->class_pointer));
|
||||
|
||||
/* Install real dtable for factory methods */
|
||||
__objc_install_dispatch_table_for_class (receiver->class_pointer);
|
||||
|
||||
if (strcmp (sel_get_name (op), "initialize"))
|
||||
__objc_send_initialize((Class)receiver);
|
||||
else
|
||||
CLS_SETINITIALIZED((Class)receiver);
|
||||
}
|
||||
objc_mutex_unlock(__objc_runtime_mutex);
|
||||
}
|
||||
|
||||
/* Install dummy table for class which causes the first message to
|
||||
that class (or instances hereof) to be initialized properly */
|
||||
void
|
||||
__objc_install_premature_dtable(Class class)
|
||||
{
|
||||
assert(__objc_uninstalled_dtable);
|
||||
class->dtable = __objc_uninstalled_dtable;
|
||||
}
|
||||
|
||||
/* Send +initialize to class if not already done */
|
||||
static void
|
||||
__objc_send_initialize(Class class)
|
||||
{
|
||||
/* This *must* be a class object */
|
||||
assert(CLS_ISCLASS(class));
|
||||
assert(!CLS_ISMETA(class));
|
||||
|
||||
if (!CLS_ISINITIALIZED(class))
|
||||
{
|
||||
CLS_SETINITIALIZED(class);
|
||||
CLS_SETINITIALIZED(class->class_pointer);
|
||||
|
||||
if(class->super_class)
|
||||
__objc_send_initialize(class->super_class);
|
||||
|
||||
{
|
||||
SEL op = sel_register_name ("initialize");
|
||||
Class tmpclass = class;
|
||||
IMP imp = 0;
|
||||
|
||||
while (!imp && tmpclass) {
|
||||
MethodList_t method_list = tmpclass->class_pointer->methods;
|
||||
|
||||
while(!imp && method_list) {
|
||||
int i;
|
||||
Method_t method;
|
||||
|
||||
for (i=0;i<method_list->method_count;i++) {
|
||||
method = &(method_list->method_list[i]);
|
||||
if (method->method_name
|
||||
&& method->method_name->sel_id == op->sel_id) {
|
||||
imp = method->method_imp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
method_list = method_list->method_next;
|
||||
|
||||
}
|
||||
|
||||
tmpclass = tmpclass->super_class;
|
||||
}
|
||||
if (imp)
|
||||
(*imp)((id)class, op);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Walk on the methods list of class and install the methods in the reverse
|
||||
order of the lists. Since methods added by categories are before the methods
|
||||
of class in the methods list, this allows categories to substitute methods
|
||||
declared in class. However if more than one category replaces the same
|
||||
method nothing is guaranteed about what method will be used.
|
||||
Assumes that __objc_runtime_mutex is locked down. */
|
||||
static void
|
||||
__objc_install_methods_in_dtable (Class class, MethodList_t method_list)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!method_list)
|
||||
return;
|
||||
|
||||
if (method_list->method_next)
|
||||
__objc_install_methods_in_dtable (class, method_list->method_next);
|
||||
|
||||
for (i = 0; i < method_list->method_count; i++)
|
||||
{
|
||||
Method_t method = &(method_list->method_list[i]);
|
||||
sarray_at_put_safe (class->dtable,
|
||||
(sidx) method->method_name->sel_id,
|
||||
method->method_imp);
|
||||
}
|
||||
}
|
||||
|
||||
/* Assumes that __objc_runtime_mutex is locked down. */
|
||||
static void
|
||||
__objc_install_dispatch_table_for_class (Class class)
|
||||
{
|
||||
Class super;
|
||||
|
||||
/* If the class has not yet had its class links resolved, we must
|
||||
re-compute all class links */
|
||||
if(!CLS_ISRESOLV(class))
|
||||
__objc_resolve_class_links();
|
||||
|
||||
super = class->super_class;
|
||||
|
||||
if (super != 0 && (super->dtable == __objc_uninstalled_dtable))
|
||||
__objc_install_dispatch_table_for_class (super);
|
||||
|
||||
/* Allocate dtable if necessary */
|
||||
if (super == 0)
|
||||
{
|
||||
objc_mutex_lock(__objc_runtime_mutex);
|
||||
class->dtable = sarray_new (__objc_selector_max_index, 0);
|
||||
objc_mutex_unlock(__objc_runtime_mutex);
|
||||
}
|
||||
else
|
||||
class->dtable = sarray_lazy_copy (super->dtable);
|
||||
|
||||
__objc_install_methods_in_dtable (class, class->methods);
|
||||
}
|
||||
|
||||
void
|
||||
__objc_update_dispatch_table_for_class (Class class)
|
||||
{
|
||||
Class next;
|
||||
struct sarray *arr;
|
||||
|
||||
/* not yet installed -- skip it */
|
||||
if (class->dtable == __objc_uninstalled_dtable)
|
||||
return;
|
||||
|
||||
objc_mutex_lock(__objc_runtime_mutex);
|
||||
|
||||
arr = class->dtable;
|
||||
__objc_install_premature_dtable (class); /* someone might require it... */
|
||||
sarray_free (arr); /* release memory */
|
||||
|
||||
/* could have been lazy... */
|
||||
__objc_install_dispatch_table_for_class (class);
|
||||
|
||||
if (class->subclass_list) /* Traverse subclasses */
|
||||
for (next = class->subclass_list; next; next = next->sibling_class)
|
||||
__objc_update_dispatch_table_for_class (next);
|
||||
|
||||
objc_mutex_unlock(__objc_runtime_mutex);
|
||||
}
|
||||
|
||||
|
||||
/* This function adds a method list to a class. This function is
|
||||
typically called by another function specific to the run-time. As
|
||||
such this function does not worry about thread safe issues.
|
||||
|
||||
This one is only called for categories. Class objects have their
|
||||
methods installed right away, and their selectors are made into
|
||||
SEL's by the function __objc_register_selectors_from_class. */
|
||||
void
|
||||
class_add_method_list (Class class, MethodList_t list)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Passing of a linked list is not allowed. Do multiple calls. */
|
||||
assert (!list->method_next);
|
||||
|
||||
/* Check for duplicates. */
|
||||
for (i = 0; i < list->method_count; ++i)
|
||||
{
|
||||
Method_t method = &list->method_list[i];
|
||||
|
||||
if (method->method_name) /* Sometimes these are NULL */
|
||||
{
|
||||
/* This is where selector names are transmogrified to SEL's */
|
||||
method->method_name =
|
||||
sel_register_typed_name ((const char*)method->method_name,
|
||||
method->method_types);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add the methods to the class's method list. */
|
||||
list->method_next = class->methods;
|
||||
class->methods = list;
|
||||
|
||||
/* Update the dispatch table of class */
|
||||
__objc_update_dispatch_table_for_class (class);
|
||||
}
|
||||
|
||||
Method_t
|
||||
class_get_instance_method(Class class, SEL op)
|
||||
{
|
||||
return search_for_method_in_hierarchy(class, op);
|
||||
}
|
||||
|
||||
Method_t
|
||||
class_get_class_method(MetaClass class, SEL op)
|
||||
{
|
||||
return search_for_method_in_hierarchy(class, op);
|
||||
}
|
||||
|
||||
|
||||
/* Search for a method starting from the current class up its hierarchy.
|
||||
Return a pointer to the method's method structure if found. NULL
|
||||
otherwise. */
|
||||
|
||||
static Method_t
|
||||
search_for_method_in_hierarchy (Class cls, SEL sel)
|
||||
{
|
||||
Method_t method = NULL;
|
||||
Class class;
|
||||
|
||||
if (! sel_is_mapped (sel))
|
||||
return NULL;
|
||||
|
||||
/* Scan the method list of the class. If the method isn't found in the
|
||||
list then step to its super class. */
|
||||
for (class = cls; ((! method) && class); class = class->super_class)
|
||||
method = search_for_method_in_list (class->methods, sel);
|
||||
|
||||
return method;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Given a linked list of method and a method's name. Search for the named
|
||||
method's method structure. Return a pointer to the method's method
|
||||
structure if found. NULL otherwise. */
|
||||
Method_t
|
||||
search_for_method_in_list (MethodList_t list, SEL op)
|
||||
{
|
||||
MethodList_t method_list = list;
|
||||
|
||||
if (! sel_is_mapped (op))
|
||||
return NULL;
|
||||
|
||||
/* If not found then we'll search the list. */
|
||||
while (method_list)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Search the method list. */
|
||||
for (i = 0; i < method_list->method_count; ++i)
|
||||
{
|
||||
Method_t method = &method_list->method_list[i];
|
||||
|
||||
if (method->method_name)
|
||||
if (method->method_name->sel_id == op->sel_id)
|
||||
return method;
|
||||
}
|
||||
|
||||
/* The method wasn't found. Follow the link to the next list of
|
||||
methods. */
|
||||
method_list = method_list->method_next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static retval_t __objc_forward (id object, SEL sel, arglist_t args);
|
||||
|
||||
/* Forwarding pointers/integers through the normal registers */
|
||||
static id
|
||||
__objc_word_forward (id rcv, SEL op, ...)
|
||||
{
|
||||
void *args, *res;
|
||||
|
||||
args = __builtin_apply_args ();
|
||||
res = __objc_forward (rcv, op, args);
|
||||
if (res)
|
||||
__builtin_return (res);
|
||||
else
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Specific routine for forwarding floats/double because of
|
||||
architectural differences on some processors. i386s for
|
||||
example which uses a floating point stack versus general
|
||||
registers for floating point numbers. This forward routine
|
||||
makes sure that GCC restores the proper return values */
|
||||
static double
|
||||
__objc_double_forward (id rcv, SEL op, ...)
|
||||
{
|
||||
void *args, *res;
|
||||
|
||||
args = __builtin_apply_args ();
|
||||
res = __objc_forward (rcv, op, args);
|
||||
__builtin_return (res);
|
||||
}
|
||||
|
||||
#if INVISIBLE_STRUCT_RETURN
|
||||
static __big
|
||||
#else
|
||||
static id
|
||||
#endif
|
||||
__objc_block_forward (id rcv, SEL op, ...)
|
||||
{
|
||||
void *args, *res;
|
||||
|
||||
args = __builtin_apply_args ();
|
||||
res = __objc_forward (rcv, op, args);
|
||||
if (res)
|
||||
__builtin_return (res);
|
||||
else
|
||||
#if INVISIBLE_STRUCT_RETURN
|
||||
return (__big) {{0, 0, 0, 0, 0, 0, 0, 0}};
|
||||
#else
|
||||
return nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* This function is installed in the dispatch table for all methods which are
|
||||
not implemented. Thus, it is called when a selector is not recognized. */
|
||||
static retval_t
|
||||
__objc_forward (id object, SEL sel, arglist_t args)
|
||||
{
|
||||
IMP imp;
|
||||
static SEL frwd_sel = 0; /* !T:SAFE2 */
|
||||
SEL err_sel;
|
||||
|
||||
/* first try if the object understands forward:: */
|
||||
if (!frwd_sel)
|
||||
frwd_sel = sel_get_any_uid("forward::");
|
||||
|
||||
if (__objc_responds_to (object, frwd_sel))
|
||||
{
|
||||
imp = get_imp(object->class_pointer, frwd_sel);
|
||||
return (*imp)(object, frwd_sel, sel, args);
|
||||
}
|
||||
|
||||
/* If the object recognizes the doesNotRecognize: method then we're going
|
||||
to send it. */
|
||||
err_sel = sel_get_any_uid ("doesNotRecognize:");
|
||||
if (__objc_responds_to (object, err_sel))
|
||||
{
|
||||
imp = get_imp (object->class_pointer, err_sel);
|
||||
return (*imp) (object, err_sel, sel);
|
||||
}
|
||||
|
||||
/* The object doesn't recognize the method. Check for responding to
|
||||
error:. If it does then sent it. */
|
||||
{
|
||||
size_t strlen (const char*);
|
||||
char msg[256 + strlen ((const char*)sel_get_name (sel))
|
||||
+ strlen ((const char*)object->class_pointer->name)];
|
||||
|
||||
sprintf (msg, "(%s) %s does not recognize %s",
|
||||
(CLS_ISMETA(object->class_pointer)
|
||||
? "class"
|
||||
: "instance" ),
|
||||
object->class_pointer->name, sel_get_name (sel));
|
||||
|
||||
err_sel = sel_get_any_uid ("error:");
|
||||
if (__objc_responds_to (object, err_sel))
|
||||
{
|
||||
imp = get_imp (object->class_pointer, err_sel);
|
||||
return (*imp) (object, sel_get_any_uid ("error:"), msg);
|
||||
}
|
||||
|
||||
/* The object doesn't respond to doesNotRecognize: or error:; Therefore,
|
||||
a default action is taken. */
|
||||
objc_error (object, OBJC_ERR_UNIMPLEMENTED, "%s\n", msg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__objc_print_dtable_stats()
|
||||
{
|
||||
int total = 0;
|
||||
|
||||
objc_mutex_lock(__objc_runtime_mutex);
|
||||
|
||||
printf("memory usage: (%s)\n",
|
||||
#ifdef OBJC_SPARSE2
|
||||
"2-level sparse arrays"
|
||||
#else
|
||||
"3-level sparse arrays"
|
||||
#endif
|
||||
);
|
||||
|
||||
printf("arrays: %d = %ld bytes\n", narrays,
|
||||
(long)narrays*sizeof(struct sarray));
|
||||
total += narrays*sizeof(struct sarray);
|
||||
printf("buckets: %d = %ld bytes\n", nbuckets,
|
||||
(long)nbuckets*sizeof(struct sbucket));
|
||||
total += nbuckets*sizeof(struct sbucket);
|
||||
|
||||
printf("idxtables: %d = %ld bytes\n", idxsize, (long)idxsize*sizeof(void*));
|
||||
total += idxsize*sizeof(void*);
|
||||
printf("-----------------------------------\n");
|
||||
printf("total: %d bytes\n", total);
|
||||
printf("===================================\n");
|
||||
|
||||
objc_mutex_unlock(__objc_runtime_mutex);
|
||||
}
|
||||
|
||||
/* Returns the uninstalled dispatch table indicator.
|
||||
If a class' dispatch table points to __objc_uninstalled_dtable
|
||||
then that means it needs its dispatch table to be installed. */
|
||||
__inline__
|
||||
struct sarray*
|
||||
objc_get_uninstalled_dtable()
|
||||
{
|
||||
return __objc_uninstalled_dtable;
|
||||
}
|
@ -1,792 +0,0 @@
|
||||
/* Utilities to execute a program in a subprocess (possibly linked by pipes
|
||||
with other subprocesses), and wait for it.
|
||||
Copyright (C) 1996-2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the libiberty library.
|
||||
Libiberty is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
Libiberty 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with libiberty; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This file exports two functions: pexecute and pwait. */
|
||||
|
||||
/* This file lives in at least two places: libiberty and gcc.
|
||||
Don't change one without the other. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#ifdef NEED_DECLARATION_ERRNO
|
||||
extern int errno;
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#include "libiberty.h"
|
||||
#include "safe-ctype.h"
|
||||
|
||||
/* stdin file number. */
|
||||
#define STDIN_FILE_NO 0
|
||||
|
||||
/* stdout file number. */
|
||||
#define STDOUT_FILE_NO 1
|
||||
|
||||
/* value of `pipe': port index for reading. */
|
||||
#define READ_PORT 0
|
||||
|
||||
/* value of `pipe': port index for writing. */
|
||||
#define WRITE_PORT 1
|
||||
|
||||
static char *install_error_msg = "installation problem, cannot exec `%s'";
|
||||
|
||||
/* pexecute: execute a program.
|
||||
|
||||
@deftypefn Extension int pexecute (const char *@var{program}, char * const *@var{argv}, const char *@var{this_pname}, const char *@var{temp_base}, char **@var{errmsg_fmt}, char **@var{errmsg_arg}, int flags)
|
||||
|
||||
Executes a program.
|
||||
|
||||
@var{program} and @var{argv} are the arguments to
|
||||
@code{execv}/@code{execvp}.
|
||||
|
||||
@var{this_pname} is name of the calling program (i.e., @code{argv[0]}).
|
||||
|
||||
@var{temp_base} is the path name, sans suffix, of a temporary file to
|
||||
use if needed. This is currently only needed for MS-DOS ports that
|
||||
don't use @code{go32} (do any still exist?). Ports that don't need it
|
||||
can pass @code{NULL}.
|
||||
|
||||
(@code{@var{flags} & PEXECUTE_SEARCH}) is non-zero if @env{PATH} should be searched
|
||||
(??? It's not clear that GCC passes this flag correctly). (@code{@var{flags} &
|
||||
PEXECUTE_FIRST}) is nonzero for the first process in chain.
|
||||
(@code{@var{flags} & PEXECUTE_FIRST}) is nonzero for the last process
|
||||
in chain. The first/last flags could be simplified to only mark the
|
||||
last of a chain of processes but that requires the caller to always
|
||||
mark the last one (and not give up early if some error occurs).
|
||||
It's more robust to require the caller to mark both ends of the chain.
|
||||
|
||||
The result is the pid on systems like Unix where we
|
||||
@code{fork}/@code{exec} and on systems like WIN32 and OS/2 where we
|
||||
use @code{spawn}. It is up to the caller to wait for the child.
|
||||
|
||||
The result is the @code{WEXITSTATUS} on systems like MS-DOS where we
|
||||
@code{spawn} and wait for the child here.
|
||||
|
||||
Upon failure, @var{errmsg_fmt} and @var{errmsg_arg} are set to the
|
||||
text of the error message with an optional argument (if not needed,
|
||||
@var{errmsg_arg} is set to @code{NULL}), and @minus{}1 is returned.
|
||||
@code{errno} is available to the caller to use.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags})
|
||||
|
||||
Waits for a program started by @code{pexecute} to finish.
|
||||
|
||||
@var{pid} is the process id of the task to wait for. @var{status} is
|
||||
the `status' argument to wait. @var{flags} is currently unused (allows
|
||||
future enhancement without breaking upward compatibility). Pass 0 for now.
|
||||
|
||||
The result is the pid of the child reaped, or -1 for failure
|
||||
(@code{errno} says why).
|
||||
|
||||
On systems that don't support waiting for a particular child, @var{pid} is
|
||||
ignored. On systems like MS-DOS that don't really multitask @code{pwait}
|
||||
is just a mechanism to provide a consistent interface for the caller.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@undocumented pfinish
|
||||
|
||||
pfinish: finish generation of script
|
||||
|
||||
pfinish is necessary for systems like MPW where a script is generated that
|
||||
runs the requested programs. */
|
||||
|
||||
#ifdef __MSDOS__
|
||||
|
||||
/* MSDOS doesn't multitask, but for the sake of a consistent interface
|
||||
the code behaves like it does. pexecute runs the program, tucks the
|
||||
exit code away, and returns a "pid". pwait must be called to fetch the
|
||||
exit code. */
|
||||
|
||||
#include <process.h>
|
||||
|
||||
/* For communicating information from pexecute to pwait. */
|
||||
static int last_pid = 0;
|
||||
static int last_status = 0;
|
||||
static int last_reaped = 0;
|
||||
|
||||
int
|
||||
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
|
||||
const char *program;
|
||||
char * const *argv;
|
||||
const char *this_pname;
|
||||
const char *temp_base;
|
||||
char **errmsg_fmt, **errmsg_arg;
|
||||
int flags;
|
||||
{
|
||||
int rc;
|
||||
|
||||
last_pid++;
|
||||
if (last_pid < 0)
|
||||
last_pid = 1;
|
||||
|
||||
if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
|
||||
abort ();
|
||||
|
||||
#ifdef __DJGPP__
|
||||
/* ??? What are the possible return values from spawnv? */
|
||||
rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (P_WAIT, program, argv);
|
||||
#else
|
||||
char *scmd, *rf;
|
||||
FILE *argfile;
|
||||
int i, el = flags & PEXECUTE_SEARCH ? 4 : 0;
|
||||
|
||||
if (temp_base == 0)
|
||||
temp_base = choose_temp_base ();
|
||||
scmd = (char *) xmalloc (strlen (program) + strlen (temp_base) + 6 + el);
|
||||
rf = scmd + strlen(program) + 2 + el;
|
||||
sprintf (scmd, "%s%s @%s.gp", program,
|
||||
(flags & PEXECUTE_SEARCH ? ".exe" : ""), temp_base);
|
||||
argfile = fopen (rf, "w");
|
||||
if (argfile == 0)
|
||||
{
|
||||
int errno_save = errno;
|
||||
free (scmd);
|
||||
errno = errno_save;
|
||||
*errmsg_fmt = "cannot open `%s.gp'";
|
||||
*errmsg_arg = temp_base;
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i=1; argv[i]; i++)
|
||||
{
|
||||
char *cp;
|
||||
for (cp = argv[i]; *cp; cp++)
|
||||
{
|
||||
if (*cp == '"' || *cp == '\'' || *cp == '\\' || ISSPACE (*cp))
|
||||
fputc ('\\', argfile);
|
||||
fputc (*cp, argfile);
|
||||
}
|
||||
fputc ('\n', argfile);
|
||||
}
|
||||
fclose (argfile);
|
||||
|
||||
rc = system (scmd);
|
||||
|
||||
{
|
||||
int errno_save = errno;
|
||||
remove (rf);
|
||||
free (scmd);
|
||||
errno = errno_save;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (rc == -1)
|
||||
{
|
||||
*errmsg_fmt = install_error_msg;
|
||||
*errmsg_arg = (char *)program;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Tuck the status away for pwait, and return a "pid". */
|
||||
last_status = rc << 8;
|
||||
return last_pid;
|
||||
}
|
||||
|
||||
/* Use ECHILD if available, otherwise use EINVAL. */
|
||||
#ifdef ECHILD
|
||||
#define PWAIT_ERROR ECHILD
|
||||
#else
|
||||
#define PWAIT_ERROR EINVAL
|
||||
#endif
|
||||
|
||||
int
|
||||
pwait (pid, status, flags)
|
||||
int pid;
|
||||
int *status;
|
||||
int flags;
|
||||
{
|
||||
/* On MSDOS each pexecute must be followed by it's associated pwait. */
|
||||
if (pid != last_pid
|
||||
/* Called twice for the same child? */
|
||||
|| pid == last_reaped)
|
||||
{
|
||||
errno = PWAIT_ERROR;
|
||||
return -1;
|
||||
}
|
||||
/* ??? Here's an opportunity to canonicalize the values in STATUS.
|
||||
Needed? */
|
||||
#ifdef __DJGPP__
|
||||
*status = (last_status >> 8);
|
||||
#else
|
||||
*status = last_status;
|
||||
#endif
|
||||
last_reaped = last_pid;
|
||||
return last_pid;
|
||||
}
|
||||
|
||||
#endif /* MSDOS */
|
||||
|
||||
#if defined (_WIN32) && ! defined (_UWIN)
|
||||
|
||||
#include <process.h>
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
|
||||
#define fix_argv(argvec) (argvec)
|
||||
|
||||
extern int _spawnv ();
|
||||
extern int _spawnvp ();
|
||||
|
||||
#else /* ! __CYGWIN__ */
|
||||
|
||||
/* This is a kludge to get around the Microsoft C spawn functions' propensity
|
||||
to remove the outermost set of double quotes from all arguments. */
|
||||
|
||||
static const char * const *
|
||||
fix_argv (argvec)
|
||||
char **argvec;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 1; argvec[i] != 0; i++)
|
||||
{
|
||||
int len, j;
|
||||
char *temp, *newtemp;
|
||||
|
||||
temp = argvec[i];
|
||||
len = strlen (temp);
|
||||
for (j = 0; j < len; j++)
|
||||
{
|
||||
if (temp[j] == '"')
|
||||
{
|
||||
newtemp = xmalloc (len + 2);
|
||||
strncpy (newtemp, temp, j);
|
||||
newtemp [j] = '\\';
|
||||
strncpy (&newtemp [j+1], &temp [j], len-j);
|
||||
newtemp [len+1] = 0;
|
||||
temp = newtemp;
|
||||
len++;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
argvec[i] = temp;
|
||||
}
|
||||
|
||||
for (i = 0; argvec[i] != 0; i++)
|
||||
{
|
||||
if (strpbrk (argvec[i], " \t"))
|
||||
{
|
||||
int len, trailing_backslash;
|
||||
char *temp;
|
||||
|
||||
len = strlen (argvec[i]);
|
||||
trailing_backslash = 0;
|
||||
|
||||
/* There is an added complication when an arg with embedded white
|
||||
space ends in a backslash (such as in the case of -iprefix arg
|
||||
passed to cpp). The resulting quoted strings gets misinterpreted
|
||||
by the command interpreter -- it thinks that the ending quote
|
||||
is escaped by the trailing backslash and things get confused.
|
||||
We handle this case by escaping the trailing backslash, provided
|
||||
it was not escaped in the first place. */
|
||||
if (len > 1
|
||||
&& argvec[i][len-1] == '\\'
|
||||
&& argvec[i][len-2] != '\\')
|
||||
{
|
||||
trailing_backslash = 1;
|
||||
++len; /* to escape the final backslash. */
|
||||
}
|
||||
|
||||
len += 2; /* and for the enclosing quotes. */
|
||||
|
||||
temp = xmalloc (len + 1);
|
||||
temp[0] = '"';
|
||||
strcpy (temp + 1, argvec[i]);
|
||||
if (trailing_backslash)
|
||||
temp[len-2] = '\\';
|
||||
temp[len-1] = '"';
|
||||
temp[len] = '\0';
|
||||
|
||||
argvec[i] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
return (const char * const *) argvec;
|
||||
}
|
||||
#endif /* __CYGWIN__ */
|
||||
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
|
||||
/* mingw32 headers may not define the following. */
|
||||
|
||||
#ifndef _P_WAIT
|
||||
# define _P_WAIT 0
|
||||
# define _P_NOWAIT 1
|
||||
# define _P_OVERLAY 2
|
||||
# define _P_NOWAITO 3
|
||||
# define _P_DETACH 4
|
||||
|
||||
# define WAIT_CHILD 0
|
||||
# define WAIT_GRANDCHILD 1
|
||||
#endif
|
||||
|
||||
/* Win32 supports pipes */
|
||||
int
|
||||
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
|
||||
const char *program;
|
||||
char * const *argv;
|
||||
const char *this_pname;
|
||||
const char *temp_base;
|
||||
char **errmsg_fmt, **errmsg_arg;
|
||||
int flags;
|
||||
{
|
||||
int pid;
|
||||
int pdes[2], org_stdin, org_stdout;
|
||||
int input_desc, output_desc;
|
||||
int retries, sleep_interval;
|
||||
|
||||
/* Pipe waiting from last process, to be used as input for the next one.
|
||||
Value is STDIN_FILE_NO if no pipe is waiting
|
||||
(i.e. the next command is the first of a group). */
|
||||
static int last_pipe_input;
|
||||
|
||||
/* If this is the first process, initialize. */
|
||||
if (flags & PEXECUTE_FIRST)
|
||||
last_pipe_input = STDIN_FILE_NO;
|
||||
|
||||
input_desc = last_pipe_input;
|
||||
|
||||
/* If this isn't the last process, make a pipe for its output,
|
||||
and record it as waiting to be the input to the next process. */
|
||||
if (! (flags & PEXECUTE_LAST))
|
||||
{
|
||||
if (_pipe (pdes, 256, O_BINARY) < 0)
|
||||
{
|
||||
*errmsg_fmt = "pipe";
|
||||
*errmsg_arg = NULL;
|
||||
return -1;
|
||||
}
|
||||
output_desc = pdes[WRITE_PORT];
|
||||
last_pipe_input = pdes[READ_PORT];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Last process. */
|
||||
output_desc = STDOUT_FILE_NO;
|
||||
last_pipe_input = STDIN_FILE_NO;
|
||||
}
|
||||
|
||||
if (input_desc != STDIN_FILE_NO)
|
||||
{
|
||||
org_stdin = dup (STDIN_FILE_NO);
|
||||
dup2 (input_desc, STDIN_FILE_NO);
|
||||
close (input_desc);
|
||||
}
|
||||
|
||||
if (output_desc != STDOUT_FILE_NO)
|
||||
{
|
||||
org_stdout = dup (STDOUT_FILE_NO);
|
||||
dup2 (output_desc, STDOUT_FILE_NO);
|
||||
close (output_desc);
|
||||
}
|
||||
|
||||
pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv)
|
||||
(_P_NOWAIT, program, fix_argv(argv));
|
||||
|
||||
if (input_desc != STDIN_FILE_NO)
|
||||
{
|
||||
dup2 (org_stdin, STDIN_FILE_NO);
|
||||
close (org_stdin);
|
||||
}
|
||||
|
||||
if (output_desc != STDOUT_FILE_NO)
|
||||
{
|
||||
dup2 (org_stdout, STDOUT_FILE_NO);
|
||||
close (org_stdout);
|
||||
}
|
||||
|
||||
if (pid == -1)
|
||||
{
|
||||
*errmsg_fmt = install_error_msg;
|
||||
*errmsg_arg = program;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return pid;
|
||||
}
|
||||
|
||||
/* MS CRTDLL doesn't return enough information in status to decide if the
|
||||
child exited due to a signal or not, rather it simply returns an
|
||||
integer with the exit code of the child; eg., if the child exited with
|
||||
an abort() call and didn't have a handler for SIGABRT, it simply returns
|
||||
with status = 3. We fix the status code to conform to the usual WIF*
|
||||
macros. Note that WIFSIGNALED will never be true under CRTDLL. */
|
||||
|
||||
int
|
||||
pwait (pid, status, flags)
|
||||
int pid;
|
||||
int *status;
|
||||
int flags;
|
||||
{
|
||||
#ifdef __CYGWIN__
|
||||
return wait (status);
|
||||
#else
|
||||
int termstat;
|
||||
|
||||
pid = _cwait (&termstat, pid, WAIT_CHILD);
|
||||
|
||||
/* ??? Here's an opportunity to canonicalize the values in STATUS.
|
||||
Needed? */
|
||||
|
||||
/* cwait returns the child process exit code in termstat.
|
||||
A value of 3 indicates that the child caught a signal, but not
|
||||
which one. Since only SIGABRT, SIGFPE and SIGINT do anything, we
|
||||
report SIGABRT. */
|
||||
if (termstat == 3)
|
||||
*status = SIGABRT;
|
||||
else
|
||||
*status = (((termstat) & 0xff) << 8);
|
||||
|
||||
return pid;
|
||||
#endif /* __CYGWIN__ */
|
||||
}
|
||||
|
||||
#endif /* _WIN32 && ! _UWIN */
|
||||
|
||||
#ifdef OS2
|
||||
|
||||
/* ??? Does OS2 have process.h? */
|
||||
extern int spawnv ();
|
||||
extern int spawnvp ();
|
||||
|
||||
int
|
||||
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
|
||||
const char *program;
|
||||
char * const *argv;
|
||||
const char *this_pname;
|
||||
const char *temp_base;
|
||||
char **errmsg_fmt, **errmsg_arg;
|
||||
int flags;
|
||||
{
|
||||
int pid;
|
||||
|
||||
if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
|
||||
abort ();
|
||||
/* ??? Presumably 1 == _P_NOWAIT. */
|
||||
pid = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (1, program, argv);
|
||||
if (pid == -1)
|
||||
{
|
||||
*errmsg_fmt = install_error_msg;
|
||||
*errmsg_arg = program;
|
||||
return -1;
|
||||
}
|
||||
return pid;
|
||||
}
|
||||
|
||||
int
|
||||
pwait (pid, status, flags)
|
||||
int pid;
|
||||
int *status;
|
||||
int flags;
|
||||
{
|
||||
/* ??? Here's an opportunity to canonicalize the values in STATUS.
|
||||
Needed? */
|
||||
int pid = wait (status);
|
||||
return pid;
|
||||
}
|
||||
|
||||
#endif /* OS2 */
|
||||
|
||||
#ifdef MPW
|
||||
|
||||
/* MPW pexecute doesn't actually run anything; instead, it writes out
|
||||
script commands that, when run, will do the actual executing.
|
||||
|
||||
For example, in GCC's case, GCC will write out several script commands:
|
||||
|
||||
cpp ...
|
||||
cc1 ...
|
||||
as ...
|
||||
ld ...
|
||||
|
||||
and then exit. None of the above programs will have run yet. The task
|
||||
that called GCC will then execute the script and cause cpp,etc. to run.
|
||||
The caller must invoke pfinish before calling exit. This adds
|
||||
the finishing touches to the generated script. */
|
||||
|
||||
static int first_time = 1;
|
||||
|
||||
int
|
||||
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
|
||||
const char *program;
|
||||
char * const *argv;
|
||||
const char *this_pname;
|
||||
const char *temp_base;
|
||||
char **errmsg_fmt, **errmsg_arg;
|
||||
int flags;
|
||||
{
|
||||
char tmpprogram[255];
|
||||
char *cp, *tmpname;
|
||||
int i;
|
||||
|
||||
mpwify_filename (program, tmpprogram);
|
||||
if (first_time)
|
||||
{
|
||||
printf ("Set Failed 0\n");
|
||||
first_time = 0;
|
||||
}
|
||||
|
||||
fputs ("If {Failed} == 0\n", stdout);
|
||||
/* If being verbose, output a copy of the command. It should be
|
||||
accurate enough and escaped enough to be "clickable". */
|
||||
if (flags & PEXECUTE_VERBOSE)
|
||||
{
|
||||
fputs ("\tEcho ", stdout);
|
||||
fputc ('\'', stdout);
|
||||
fputs (tmpprogram, stdout);
|
||||
fputc ('\'', stdout);
|
||||
fputc (' ', stdout);
|
||||
for (i=1; argv[i]; i++)
|
||||
{
|
||||
fputc ('\'', stdout);
|
||||
/* See if we have an argument that needs fixing. */
|
||||
if (strchr(argv[i], '/'))
|
||||
{
|
||||
tmpname = (char *) xmalloc (256);
|
||||
mpwify_filename (argv[i], tmpname);
|
||||
argv[i] = tmpname;
|
||||
}
|
||||
for (cp = argv[i]; *cp; cp++)
|
||||
{
|
||||
/* Write an Option-d escape char in front of special chars. */
|
||||
if (strchr("'+", *cp))
|
||||
fputc ('\266', stdout);
|
||||
fputc (*cp, stdout);
|
||||
}
|
||||
fputc ('\'', stdout);
|
||||
fputc (' ', stdout);
|
||||
}
|
||||
fputs ("\n", stdout);
|
||||
}
|
||||
fputs ("\t", stdout);
|
||||
fputs (tmpprogram, stdout);
|
||||
fputc (' ', stdout);
|
||||
|
||||
for (i=1; argv[i]; i++)
|
||||
{
|
||||
/* See if we have an argument that needs fixing. */
|
||||
if (strchr(argv[i], '/'))
|
||||
{
|
||||
tmpname = (char *) xmalloc (256);
|
||||
mpwify_filename (argv[i], tmpname);
|
||||
argv[i] = tmpname;
|
||||
}
|
||||
if (strchr (argv[i], ' '))
|
||||
fputc ('\'', stdout);
|
||||
for (cp = argv[i]; *cp; cp++)
|
||||
{
|
||||
/* Write an Option-d escape char in front of special chars. */
|
||||
if (strchr("'+", *cp))
|
||||
fputc ('\266', stdout);
|
||||
fputc (*cp, stdout);
|
||||
}
|
||||
if (strchr (argv[i], ' '))
|
||||
fputc ('\'', stdout);
|
||||
fputc (' ', stdout);
|
||||
}
|
||||
|
||||
fputs ("\n", stdout);
|
||||
|
||||
/* Output commands that arrange to clean up and exit if a failure occurs.
|
||||
We have to be careful to collect the status from the program that was
|
||||
run, rather than some other script command. Also, we don't exit
|
||||
immediately, since necessary cleanups are at the end of the script. */
|
||||
fputs ("\tSet TmpStatus {Status}\n", stdout);
|
||||
fputs ("\tIf {TmpStatus} != 0\n", stdout);
|
||||
fputs ("\t\tSet Failed {TmpStatus}\n", stdout);
|
||||
fputs ("\tEnd\n", stdout);
|
||||
fputs ("End\n", stdout);
|
||||
|
||||
/* We're just composing a script, can't fail here. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pwait (pid, status, flags)
|
||||
int pid;
|
||||
int *status;
|
||||
int flags;
|
||||
{
|
||||
*status = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Write out commands that will exit with the correct error code
|
||||
if something in the script failed. */
|
||||
|
||||
void
|
||||
pfinish ()
|
||||
{
|
||||
printf ("\tExit \"{Failed}\"\n");
|
||||
}
|
||||
|
||||
#endif /* MPW */
|
||||
|
||||
/* include for Unix-like environments but not for Dos-like environments */
|
||||
#if ! defined (__MSDOS__) && ! defined (OS2) && ! defined (MPW) \
|
||||
&& ! (defined (_WIN32) && ! defined (_UWIN))
|
||||
|
||||
extern int execv ();
|
||||
extern int execvp ();
|
||||
|
||||
int
|
||||
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
|
||||
const char *program;
|
||||
char * const *argv;
|
||||
const char *this_pname;
|
||||
const char *temp_base ATTRIBUTE_UNUSED;
|
||||
char **errmsg_fmt, **errmsg_arg;
|
||||
int flags;
|
||||
{
|
||||
int (*func)() = (flags & PEXECUTE_SEARCH ? execvp : execv);
|
||||
int pid;
|
||||
int pdes[2];
|
||||
int input_desc, output_desc;
|
||||
int retries, sleep_interval;
|
||||
/* Pipe waiting from last process, to be used as input for the next one.
|
||||
Value is STDIN_FILE_NO if no pipe is waiting
|
||||
(i.e. the next command is the first of a group). */
|
||||
static int last_pipe_input;
|
||||
|
||||
/* If this is the first process, initialize. */
|
||||
if (flags & PEXECUTE_FIRST)
|
||||
last_pipe_input = STDIN_FILE_NO;
|
||||
|
||||
input_desc = last_pipe_input;
|
||||
|
||||
/* If this isn't the last process, make a pipe for its output,
|
||||
and record it as waiting to be the input to the next process. */
|
||||
if (! (flags & PEXECUTE_LAST))
|
||||
{
|
||||
if (pipe (pdes) < 0)
|
||||
{
|
||||
*errmsg_fmt = "pipe";
|
||||
*errmsg_arg = NULL;
|
||||
return -1;
|
||||
}
|
||||
output_desc = pdes[WRITE_PORT];
|
||||
last_pipe_input = pdes[READ_PORT];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Last process. */
|
||||
output_desc = STDOUT_FILE_NO;
|
||||
last_pipe_input = STDIN_FILE_NO;
|
||||
}
|
||||
|
||||
/* Fork a subprocess; wait and retry if it fails. */
|
||||
sleep_interval = 1;
|
||||
pid = -1;
|
||||
for (retries = 0; retries < 4; retries++)
|
||||
{
|
||||
pid = fork ();
|
||||
if (pid >= 0)
|
||||
break;
|
||||
sleep (sleep_interval);
|
||||
sleep_interval *= 2;
|
||||
}
|
||||
|
||||
switch (pid)
|
||||
{
|
||||
case -1:
|
||||
*errmsg_fmt = "fork";
|
||||
*errmsg_arg = NULL;
|
||||
return -1;
|
||||
|
||||
case 0: /* child */
|
||||
/* Move the input and output pipes into place, if necessary. */
|
||||
if (input_desc != STDIN_FILE_NO)
|
||||
{
|
||||
close (STDIN_FILE_NO);
|
||||
dup (input_desc);
|
||||
close (input_desc);
|
||||
}
|
||||
if (output_desc != STDOUT_FILE_NO)
|
||||
{
|
||||
close (STDOUT_FILE_NO);
|
||||
dup (output_desc);
|
||||
close (output_desc);
|
||||
}
|
||||
|
||||
/* Close the parent's descs that aren't wanted here. */
|
||||
if (last_pipe_input != STDIN_FILE_NO)
|
||||
close (last_pipe_input);
|
||||
|
||||
/* Exec the program. */
|
||||
(*func) (program, argv);
|
||||
|
||||
fprintf (stderr, "%s: ", this_pname);
|
||||
fprintf (stderr, install_error_msg, program);
|
||||
fprintf (stderr, ": %s\n", xstrerror (errno));
|
||||
exit (-1);
|
||||
/* NOTREACHED */
|
||||
return 0;
|
||||
|
||||
default:
|
||||
/* In the parent, after forking.
|
||||
Close the descriptors that we made for this child. */
|
||||
if (input_desc != STDIN_FILE_NO)
|
||||
close (input_desc);
|
||||
if (output_desc != STDOUT_FILE_NO)
|
||||
close (output_desc);
|
||||
|
||||
/* Return child's process number. */
|
||||
return pid;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
pwait (pid, status, flags)
|
||||
int pid;
|
||||
int *status;
|
||||
int flags ATTRIBUTE_UNUSED;
|
||||
{
|
||||
/* ??? Here's an opportunity to canonicalize the values in STATUS.
|
||||
Needed? */
|
||||
#ifdef VMS
|
||||
pid = waitpid (-1, status, 0);
|
||||
#else
|
||||
pid = wait (status);
|
||||
#endif
|
||||
return pid;
|
||||
}
|
||||
|
||||
#endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! (_WIN32 && ! _UWIN) */
|
@ -1,54 +0,0 @@
|
||||
/* profile.h - Defines data exported from profile.c to other passes.
|
||||
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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.
|
||||
|
||||
GCC 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 GCC; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifndef GCC_PROFILE_H
|
||||
#define GCC_PROFILE_H
|
||||
|
||||
struct profile_info
|
||||
{
|
||||
/* Used by final, for allocating the proper amount of storage for the
|
||||
instrumented arc execution counts. */
|
||||
|
||||
int count_instrumented_edges;
|
||||
|
||||
/* Used by final, for writing correct # of instrumented edges
|
||||
in this function. */
|
||||
|
||||
int count_edges_instrumented_now;
|
||||
|
||||
/* Checksum of the cfg. Used for 'identification' of code.
|
||||
Used by final. */
|
||||
|
||||
long current_function_cfg_checksum;
|
||||
|
||||
/* Max. value of counter in program corresponding to the profile data
|
||||
for the current function. */
|
||||
|
||||
gcov_type max_counter_in_program;
|
||||
|
||||
/* The number of profiles merged to form the profile data for the current
|
||||
function. */
|
||||
int count_profiles_merged;
|
||||
|
||||
};
|
||||
|
||||
extern struct profile_info profile_info;
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user