mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-29 11:54:38 +01:00
Compare commits
51
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
148a348454 | ||
|
|
db0a3b0996 | ||
|
|
b8fd368d37 | ||
|
|
4ffec030cc | ||
|
|
b6b197f3ec | ||
|
|
94bc73d703 | ||
|
|
8b16a3e13f | ||
|
|
0530043136 | ||
|
|
23f4913235 | ||
|
|
1972241807 | ||
|
|
77897c7469 | ||
|
|
1c9e602cfc | ||
|
|
db7425715e | ||
|
|
c5da444134 | ||
|
|
bc3f1177e9 | ||
|
|
ccb3cc5657 | ||
|
|
5ce1ad7a0c | ||
|
|
cea81f798b | ||
|
|
e386cb2e50 | ||
|
|
0c4ed717bc | ||
|
|
42a7770592 | ||
|
|
b7c917e9fa | ||
|
|
806fe6d23c | ||
|
|
fc9e8f4340 | ||
|
|
7fde5307de | ||
|
|
87e637e2df | ||
|
|
43b09ad426 | ||
|
|
0bc95402c8 | ||
|
|
212d3e48d9 | ||
|
|
99b47403d8 | ||
|
|
2a92ef7ded | ||
|
|
4a08d5ba45 | ||
|
|
e8e9a92bbd | ||
|
|
775326df3d | ||
|
|
d6ff0fd311 | ||
|
|
ad65ee2a34 | ||
|
|
d155565e32 | ||
|
|
4804a5ef45 | ||
|
|
9851eed6f3 | ||
|
|
eeaeb5b79a | ||
|
|
c52ce4bcc2 | ||
|
|
151e79b844 | ||
|
|
21eca5f815 | ||
|
|
5205c1aaa2 | ||
|
|
1ed30f6426 | ||
|
|
0a379c9386 | ||
|
|
5ebecde547 | ||
|
|
e4de098331 | ||
|
|
423c6ff15d | ||
|
|
26859bad80 | ||
|
|
b7a5a03069 |
No files matched your search
+4
-8
@@ -744,7 +744,6 @@ includes:
|
||||
# libradius: libmd
|
||||
# libreadline: libncurses
|
||||
# libskey: libcrypt libmd
|
||||
# libssh: libcrypto libz
|
||||
# libstc++: msun
|
||||
# libtacplus: libmd
|
||||
#
|
||||
@@ -754,7 +753,7 @@ includes:
|
||||
# kerberosIV/lib kerberos5/lib: lib/libcrypt
|
||||
# lib/libpam: secure/lib/libcrypto kerberosIV/lib/libkrb \
|
||||
# secure/lib/libssh lib/libz
|
||||
# secure/lib: secure/lib/libcrypto lib/libmd lib/libz
|
||||
# secure/lib: lib/libmd
|
||||
#
|
||||
.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}.pcc)
|
||||
_csu= lib/csu/${MACHINE_ARCH}.pcc
|
||||
@@ -764,11 +763,8 @@ _csu= lib/csu/i386-elf
|
||||
_csu= lib/csu/${MACHINE_ARCH}
|
||||
.endif
|
||||
|
||||
.if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
|
||||
.if !defined(NOSECURE) && !defined(NOCRYPT)
|
||||
_secure_lib= secure/lib
|
||||
.if exists(${.CURDIR}/secure/lib/libcrypto)
|
||||
_libcrypto= secure/lib/libcrypto
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
|
||||
@@ -789,10 +785,10 @@ _libkeycap= usr.sbin/pcvt/keycap
|
||||
|
||||
libraries:
|
||||
.for _lib in ${_csu} gnu/lib/csu gnu/lib/libgcc lib/libmd lib/libcrypt \
|
||||
lib/libz ${_libcrypto} ${_secure_lib} ${_kerberosIV_lib} \
|
||||
${_secure_lib} ${_kerberosIV_lib} \
|
||||
${_kerberos5_lib} lib/libcom_err lib/msun lib/libncurses \
|
||||
lib/libopie lib/libradius lib/libskey lib/libtacplus lib/libutil \
|
||||
lib gnu/lib ${_libperl} usr.bin/lex/lib ${_libkeycap}
|
||||
lib/libz lib gnu/lib ${_libperl} usr.bin/lex/lib ${_libkeycap}
|
||||
.if exists(${.CURDIR}/${_lib})
|
||||
cd ${.CURDIR}/${_lib}; \
|
||||
${MAKE} depend; \
|
||||
|
||||
@@ -8,14 +8,6 @@ A reverse chronology since 4.0 was released is included, followed by
|
||||
the common items quick how-tos, followed by entries for versions of
|
||||
-current prior to 4.0 Release.
|
||||
|
||||
20020703:
|
||||
The install(1) utility no longer allows the -d and -C options
|
||||
to be specified together. "INSTALL=install -C" in make.conf
|
||||
should be replaced with "COPY=-C".
|
||||
|
||||
20020615:
|
||||
FreeBSD 4.6-RELEASE.
|
||||
|
||||
20020515:
|
||||
The k5su utility installed as part of Kerberos 5 is no longer
|
||||
installed with the set-user-ID bit set by default. Add
|
||||
|
||||
+5
-15
@@ -135,14 +135,13 @@ scanfiles(argv, cooked)
|
||||
{
|
||||
int i = 0;
|
||||
char *path;
|
||||
FILE *fp;
|
||||
|
||||
while ((path = argv[i]) != NULL || i == 0) {
|
||||
int fd;
|
||||
|
||||
if (path == NULL || strcmp(path, "-") == 0) {
|
||||
filename = "stdin";
|
||||
fd = STDIN_FILENO;
|
||||
fd = 0;
|
||||
} else {
|
||||
filename = path;
|
||||
fd = open(path, O_RDONLY);
|
||||
@@ -155,17 +154,12 @@ scanfiles(argv, cooked)
|
||||
warn("%s", path);
|
||||
rval = 1;
|
||||
} else if (cooked) {
|
||||
if (fd == STDIN_FILENO)
|
||||
cook_cat(stdin);
|
||||
else {
|
||||
fp = fdopen(fd, "r");
|
||||
cook_cat(fp);
|
||||
fclose(fp);
|
||||
}
|
||||
FILE *fp = fdopen(fd, "r");
|
||||
cook_cat(fp);
|
||||
fclose(fp);
|
||||
} else {
|
||||
raw_cat(fd);
|
||||
if (fd != STDIN_FILENO)
|
||||
close(fd);
|
||||
close(fd);
|
||||
}
|
||||
if (path == NULL)
|
||||
break;
|
||||
@@ -179,10 +173,6 @@ cook_cat(fp)
|
||||
{
|
||||
register int ch, gobble, line, prev;
|
||||
|
||||
/* Reset EOF condition on stdin. */
|
||||
if (fp == stdin && feof(stdin))
|
||||
clearerr(stdin);
|
||||
|
||||
line = gobble = 0;
|
||||
for (prev = '\n'; (ch = getc(fp)) != EOF; prev = ch) {
|
||||
if (prev == '\n') {
|
||||
|
||||
+5
-3
@@ -209,9 +209,11 @@ main(int argc, char *argv[])
|
||||
rv = 0;
|
||||
if (!*argv) {
|
||||
mntsize = regetmntinfo(&mntbuf, mntsize, vfslist);
|
||||
bzero(&maxwidths, sizeof(maxwidths));
|
||||
for (i = 0; i < mntsize; i++)
|
||||
update_maxwidths(&maxwidths, &mntbuf[i]);
|
||||
if (vfslist != NULL) {
|
||||
bzero(&maxwidths, sizeof(maxwidths));
|
||||
for (i = 0; i < mntsize; i++)
|
||||
update_maxwidths(&maxwidths, &mntbuf[i]);
|
||||
}
|
||||
for (i = 0; i < mntsize; i++) {
|
||||
if (aflag || (mntbuf[i].f_flags & MNT_IGNORE) == 0)
|
||||
prtstat(&mntbuf[i], &maxwidths);
|
||||
|
||||
+7
-24
@@ -12,36 +12,19 @@
|
||||
.Op Fl sx
|
||||
.Op Fl p Ar string
|
||||
.Op Ar file
|
||||
.LP
|
||||
.Nm red
|
||||
.Op Fl
|
||||
.Op Fl sx
|
||||
.Op Fl p Ar string
|
||||
.Op Ar file
|
||||
.\" .LP
|
||||
.\" red [-] [-sx] [-p \fIstring\fR] [\fIfile\fR]
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility is a line-oriented text editor.
|
||||
It is used to create, display, modify and otherwise manipulate text
|
||||
files.
|
||||
When invoked as
|
||||
.Nm red ,
|
||||
the editor runs in
|
||||
.Qq restricted
|
||||
mode, in which the only difference is that the editor restricts the
|
||||
use of filenames which start with
|
||||
.Ql \&!
|
||||
(interpreted as shell commands by
|
||||
.Nm ed )
|
||||
or contain a
|
||||
.Ql \&/ .
|
||||
Note that editing outside of the current directory is only prohibited
|
||||
if the user does not have write access to the current directory.
|
||||
If a user has write access to the current directory, then symbolic
|
||||
links can be created in the current directory, in which case
|
||||
.Nm red
|
||||
will not stop the user from editing the file that the symbolic link
|
||||
points to.
|
||||
.\" .B red
|
||||
.\" is a restricted
|
||||
.\" .BR ed :
|
||||
.\" it can only edit files in the current
|
||||
.\" directory and cannot execute shell commands.
|
||||
.Pp
|
||||
If invoked with a
|
||||
.Ar file
|
||||
|
||||
+2
-2
@@ -331,7 +331,7 @@ copy(from, to)
|
||||
int pid, status;
|
||||
|
||||
if ((pid = fork()) == 0) {
|
||||
execl(_PATH_CP, "mv", vflg ? "-PRpv" : "-PRp", "--", from, to,
|
||||
execl(_PATH_CP, "mv", vflg ? "-PRpv" : "-PRp", from, to,
|
||||
(char *)NULL);
|
||||
warn("%s", _PATH_CP);
|
||||
_exit(1);
|
||||
@@ -350,7 +350,7 @@ copy(from, to)
|
||||
return (1);
|
||||
}
|
||||
if (!(pid = vfork())) {
|
||||
execl(_PATH_RM, "mv", "-rf", "--", from, (char *)NULL);
|
||||
execl(_PATH_RM, "mv", "-rf", from, (char *)NULL);
|
||||
warn("%s", _PATH_RM);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
+20
-22
@@ -179,9 +179,8 @@
|
||||
.Op Ar
|
||||
.Ar directory
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility will read, write, and list the members of an archive file,
|
||||
.Nm Pax
|
||||
will read, write, and list the members of an archive file,
|
||||
and will copy directory hierarchies.
|
||||
.Nm Pax
|
||||
operation is independent of the specific archive format,
|
||||
@@ -203,7 +202,8 @@ and
|
||||
.Bl -tag -width 6n
|
||||
.It <none>
|
||||
.Em List .
|
||||
Write to
|
||||
.Nm Pax
|
||||
will write to
|
||||
.Dv standard output
|
||||
a table of contents of the members of the archive file read from
|
||||
.Dv standard input ,
|
||||
@@ -213,7 +213,8 @@ The table of contents contains one filename per line
|
||||
and is written using single line buffering.
|
||||
.It Fl r
|
||||
.Em Read .
|
||||
Extract the members of the archive file read from the
|
||||
.Nm Pax
|
||||
extracts the members of the archive file read from the
|
||||
.Dv standard input ,
|
||||
with pathnames matching the specified
|
||||
.Ar patterns .
|
||||
@@ -227,7 +228,8 @@ the extracted files are discussed in more detail under the
|
||||
option.
|
||||
.It Fl w
|
||||
.Em Write .
|
||||
Write an archive containing the
|
||||
.Nm Pax
|
||||
writes an archive containing the
|
||||
.Ar file
|
||||
operands to
|
||||
.Dv standard output
|
||||
@@ -242,7 +244,8 @@ operand is also a directory, the entire file hierarchy rooted
|
||||
at that directory will be included.
|
||||
.It Fl r Fl w
|
||||
.Em Copy .
|
||||
Copy the
|
||||
.Nm Pax
|
||||
copies the
|
||||
.Ar file
|
||||
operands to the destination
|
||||
.Ar directory .
|
||||
@@ -462,17 +465,15 @@ operand,
|
||||
will prompt to
|
||||
.Pa /dev/tty
|
||||
giving the name of the file, its file mode and its modification time.
|
||||
The
|
||||
.Nm
|
||||
utility will then read a line from
|
||||
.Nm Pax
|
||||
will then read a line from
|
||||
.Pa /dev/tty .
|
||||
If this line is blank, the file or archive member is skipped.
|
||||
If this line consists of a single period, the
|
||||
file or archive member is processed with no modification to its name.
|
||||
Otherwise, its name is replaced with the contents of the line.
|
||||
The
|
||||
.Nm
|
||||
utility will immediately exit with a non-zero exit status if
|
||||
.Nm Pax
|
||||
will immediately exit with a non-zero exit status if
|
||||
.Dv <EOF>
|
||||
is encountered when reading a response or if
|
||||
.Pa /dev/tty
|
||||
@@ -690,9 +691,8 @@ is not buffered, and is written only after the file has been read or written.
|
||||
.It Fl x Ar format
|
||||
Specify the output archive format, with the default format being
|
||||
.Ar ustar .
|
||||
The
|
||||
.Nm
|
||||
utility currently supports the following formats:
|
||||
.Nm Pax
|
||||
currently supports the following formats:
|
||||
.Bl -tag -width "sv4cpio"
|
||||
.It Ar cpio
|
||||
The extended cpio interchange format specified in the
|
||||
@@ -753,9 +753,8 @@ The default blocksize for this format is 10240 bytes.
|
||||
Pathnames stored by this format must be 250 characters or less in length.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
utility will detect and report any file that it is unable to store or extract
|
||||
.Nm Pax
|
||||
will detect and report any file that it is unable to store or extract
|
||||
as the result of any specific archive format restrictions.
|
||||
The individual archive formats may impose additional restrictions on use.
|
||||
Typical archive format restrictions include (but are not limited to):
|
||||
@@ -1146,9 +1145,8 @@ utility appeared in
|
||||
.An Keith Muller
|
||||
at the University of California, San Diego
|
||||
.Sh DIAGNOSTICS
|
||||
The
|
||||
.Nm
|
||||
utility will exit with one of the following values:
|
||||
.Nm Pax
|
||||
will exit with one of the following values:
|
||||
.Bl -tag -width 2n
|
||||
.It 0
|
||||
All files were processed successfully.
|
||||
|
||||
+2
-6
@@ -51,9 +51,7 @@
|
||||
.Nm
|
||||
.Op Fl L
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility
|
||||
.Nm Ps
|
||||
displays a header line followed by lines containing information about your
|
||||
processes that have controlling terminals.
|
||||
This information is sorted by controlling terminal, then by process
|
||||
@@ -327,9 +325,7 @@ When printing using the command keyword, a process that has exited and
|
||||
has a parent that has not yet waited for the process (in other words, a zombie)
|
||||
is listed as ``<defunct>'', and a process which is blocked while trying
|
||||
to exit is listed as ``<exiting>''.
|
||||
The
|
||||
.Nm
|
||||
utility
|
||||
.Nm Ps
|
||||
makes an educated guess as to the file name and arguments given when the
|
||||
process was created by examining memory or the swap area.
|
||||
The method is inherently somewhat unreliable and in any event a process
|
||||
|
||||
+9
-32
@@ -35,7 +35,7 @@
|
||||
.\" @(#)pwd.1 8.2 (Berkeley) 4/28/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd February 4, 2002
|
||||
.Dd April 28, 1995
|
||||
.Dt PWD 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -43,11 +43,9 @@
|
||||
.Nd return working directory name
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl LP
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility writes the absolute pathname of the current working directory to
|
||||
.Nm Pwd
|
||||
writes the absolute pathname of the current working directory to
|
||||
the standard output.
|
||||
.Pp
|
||||
Some shells may provide a builtin
|
||||
@@ -56,32 +54,17 @@ command which is similar or identical to this utility.
|
||||
Consult the
|
||||
.Xr builtin 1
|
||||
manual page.
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width indent
|
||||
.It Fl L
|
||||
Display the logical current working directory.
|
||||
.It Fl P
|
||||
Display the physical current working directory (all symbolic links resolved).
|
||||
.El
|
||||
.Pp
|
||||
If no options are specified, the
|
||||
.Fl P
|
||||
option is assumed.
|
||||
.Sh ENVIRONMENT
|
||||
Environment variables used by
|
||||
.Nm :
|
||||
.Bl -tag -width ".Ev PWD"
|
||||
.It Ev PWD
|
||||
Logical current working directory.
|
||||
.El
|
||||
.Sh DIAGNOSTICS
|
||||
.Ex -std
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Nm
|
||||
utility conforms to
|
||||
.St -p1003.1-2001 .
|
||||
utility is expected to be
|
||||
.St -p1003.2
|
||||
compatible.
|
||||
The
|
||||
.Fl L
|
||||
flag is not supported.
|
||||
.Sh SEE ALSO
|
||||
.Xr builtin 1 ,
|
||||
.Xr cd 1 ,
|
||||
@@ -97,9 +80,3 @@ is always faster because it is built into that shell.
|
||||
However, it can give a different answer in the rare case
|
||||
that the current directory or a containing directory was moved after
|
||||
the shell descended into it.
|
||||
.Pp
|
||||
The
|
||||
.Fl L
|
||||
option does not work unless the
|
||||
.Ev PWD
|
||||
environment variable is exported by the shell.
|
||||
+27
-61
@@ -45,45 +45,34 @@ static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
static char *getcwd_logical(void);
|
||||
void usage(void);
|
||||
int main __P((int, char *[]));
|
||||
void usage __P((void));
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int physical;
|
||||
int ch;
|
||||
char *p;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
if (strcmp(getprogname(), "realpath") == 0) {
|
||||
if (argc != 2)
|
||||
usage();
|
||||
if ((p = realpath(argv[1], buf)) == NULL)
|
||||
err(1, "%s", argv[1]);
|
||||
(void)printf("%s\n", p);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
physical = 1;
|
||||
while ((ch = getopt(argc, argv, "LP")) != -1)
|
||||
/*
|
||||
* Flags for pwd are a bit strange. The POSIX 1003.2B/D9 document
|
||||
* has an optional -P flag for physical, which is what this program
|
||||
* will produce by default. The logical flag, -L, should fail, as
|
||||
* there's no way to display a logical path after forking.
|
||||
*/
|
||||
while ((ch = getopt(argc, argv, "P")) != -1)
|
||||
switch (ch) {
|
||||
case 'L':
|
||||
physical = 0;
|
||||
break;
|
||||
case 'P':
|
||||
physical = 1;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
@@ -92,50 +81,27 @@ main(int argc, char *argv[])
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc != 0)
|
||||
if (argc == 1) {
|
||||
p = realpath(argv[0], buf);
|
||||
if (p == NULL)
|
||||
err(1, "%s", argv[0]);
|
||||
(void)printf("%s\n", p);
|
||||
} else if (argc == 0) {
|
||||
p = getcwd(NULL, (size_t)0);
|
||||
if (p == NULL)
|
||||
err(1, ".");
|
||||
(void)printf("%s\n", p);
|
||||
} else {
|
||||
usage();
|
||||
|
||||
/*
|
||||
* If we're trying to find the logical current directory and that
|
||||
* fails, behave as if -P was specified.
|
||||
*/
|
||||
if ((!physical && (p = getcwd_logical()) != NULL) ||
|
||||
(p = getcwd(NULL, 0)) != NULL)
|
||||
printf("%s\n", p);
|
||||
else
|
||||
err(1, ".");
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void
|
||||
usage(void)
|
||||
usage()
|
||||
{
|
||||
|
||||
if (strcmp(getprogname(), "realpath") == 0)
|
||||
(void)fprintf(stderr, "usage: realpath [path]\n");
|
||||
else
|
||||
(void)fprintf(stderr, "usage: pwd [-LP]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static char *
|
||||
getcwd_logical(void)
|
||||
{
|
||||
struct stat log, phy;
|
||||
char *pwd;
|
||||
|
||||
/*
|
||||
* Check that $PWD is an absolute logical pathname referring to
|
||||
* the current working directory.
|
||||
*/
|
||||
if ((pwd = getenv("PWD")) != NULL && *pwd == '/') {
|
||||
if (stat(pwd, &log) == -1 || stat(".", &phy) == -1)
|
||||
return (NULL);
|
||||
if (log.st_dev == phy.st_dev && log.st_ino == phy.st_ino)
|
||||
return (pwd);
|
||||
}
|
||||
|
||||
errno = ENOENT;
|
||||
return (NULL);
|
||||
(void)fprintf(stderr, "usage: pwd\n");
|
||||
exit(1);
|
||||
}
|
||||
+1
-1
@@ -367,7 +367,7 @@ ulimitcmd(argc, argv)
|
||||
struct rlimit limit;
|
||||
|
||||
what = 'f';
|
||||
while ((optc = nextopt("HSatfdsmcnuvlb")) != '\0')
|
||||
while ((optc = nextopt("HSatfdsmcnulb")) != '\0')
|
||||
switch (optc) {
|
||||
case 'H':
|
||||
how = HARD;
|
||||
|
||||
+6
-10
@@ -1331,19 +1331,17 @@ environment variable if no
|
||||
is specified.
|
||||
If
|
||||
.Ar directory
|
||||
does not begin with
|
||||
.Pa / ,
|
||||
.Pa \&. ,
|
||||
is not found as a subdirectory of the current directory
|
||||
(and does not begin with
|
||||
.Dq Li / ,
|
||||
.Dq Li ./ ,
|
||||
or
|
||||
.Pa .. ,
|
||||
.Dq Li ../ ) ,
|
||||
then the directories listed in the
|
||||
.Ev CDPATH
|
||||
variable will be
|
||||
searched for the specified
|
||||
.Ar directory .
|
||||
If
|
||||
.Ev CDPATH
|
||||
is unset, the current directory is searched.
|
||||
The format of
|
||||
.Ar CDPATH
|
||||
is the same as that of
|
||||
@@ -1817,7 +1815,7 @@ for commands and tracked aliases
|
||||
the complete pathname of the command is printed.
|
||||
.It Xo
|
||||
.Ic ulimit
|
||||
.Op Fl HSabcdflmnstuv
|
||||
.Op Fl HSabcdflmnust
|
||||
.Op Ar limit
|
||||
.Xc
|
||||
Set or display resource limits (see
|
||||
@@ -1878,8 +1876,6 @@ The maximal size of the stack segment, in kilobytes.
|
||||
The maximal amount of CPU time to be used by each process, in seconds.
|
||||
.It Fl u Ar userproc
|
||||
The maximal number of simultaneous processes for this user ID.
|
||||
.It Fl v Ar virtualmem
|
||||
The maximal virtual size of a process, in kilobytes.
|
||||
.El
|
||||
.It Ic umask Op Ar mask
|
||||
Set the file creation mask (see
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
Message-Id: <[email protected]>
|
||||
To: ...
|
||||
Subject: Notes on RFC-2317
|
||||
Date: Mon, 22 May 2000 22:46:55 -0400
|
||||
From: Kimmo Suominen <[email protected]>
|
||||
|
||||
Hi!
|
||||
|
||||
I wrote down some notes on RFC-2317. I've had discussions with all of
|
||||
you regarding classless IN-ADDR.ARPA delegations, and I would very much
|
||||
appreciate any comments you may have. Please feel free to forward this
|
||||
to other parties as you see necessary or appropriate.
|
||||
|
||||
The goal of these notes is to try and clarify the reasoning behind the
|
||||
recommendations I've been making on implementing RFC-2317 delegations.
|
||||
In particular the following issues keep coming up with again and again
|
||||
with each vendor:
|
||||
|
||||
- why use "-" instead of "/"
|
||||
- why use particular NS records
|
||||
- why delegate within IN-ADDR.ARPA
|
||||
|
||||
I am hoping that the these notes could eventually be used to convince
|
||||
ISPs to provide an efficient and smooth implementation of RFC-2317 with
|
||||
the least amount of headache for the end-user.
|
||||
|
||||
Regards,
|
||||
+ Kim
|
||||
|
||||
|
||||
|
||||
NOTES ON IMPLEMENTING CLASSLESS IN-ADDR.ARPA DELEGATION PER RFC-2317
|
||||
|
||||
1. Selecting the CNAME target zone
|
||||
|
||||
RFC-2317 shows an example case where the target zone is a delegated
|
||||
sub-zone of the IN-ADDR.ARPA zone for the natural class C network.
|
||||
This will allow for the NS records for the zone can be independently
|
||||
selected (see benefits described below). An example of such a zone
|
||||
would be 0-28.150.80.204.IN-ADDR.ARPA.
|
||||
|
||||
Now pay careful attention to the last paragraph of RFC-2317. There
|
||||
are broken resolver implementations that apply the "valid host name"
|
||||
restrictions on the CNAME target (it should only be applied to the
|
||||
PTR target name). To avoid problems with such implementations it
|
||||
is best to use a character that is allowed in a hostname. I prefer
|
||||
using a hyphen, as I did in the example above.
|
||||
|
||||
Some ISPs may at first refuse to delegate these zones (without any
|
||||
explanation). Approach such ISPs with the reasoning in here first,
|
||||
but if that fails consider using your "forward" zone as a fallback.
|
||||
|
||||
There is nothing magic about the IN-ADDR.ARPA zone for RFC-2317
|
||||
delegations. You will have to sacrifice the optimization provided
|
||||
by a correct IN-ADDR.ARPA delegation, but you will still retain
|
||||
the ease of local administration for all name changes.
|
||||
|
||||
I recommend using a dedicated subdomain for the PTR records, e.g. if
|
||||
your "forward" domain is "HOME.GW.COM" use "REV.HOME.GW.COM" for the
|
||||
PTR records.
|
||||
|
||||
2. Selecting the NS records
|
||||
|
||||
The NS records for the delegated zone should include all the NS
|
||||
records of the parent zone, in addition to any NS records pointing
|
||||
to the public name servers the delegate may want to use. Having the
|
||||
name servers of the parent zone secondary the delegated zone allows
|
||||
them to have the necessary authoritative data to return the CNAME
|
||||
target in the additional records of a response to a PTR record query
|
||||
(minimizing the number of queries needed to resolve an address).
|
||||
|
||||
This can be achieved using any zone (i.e. even a subdomain of your
|
||||
"forward" domain), of course. However, having the ISP delegate an
|
||||
IN-ADDR.ARPA zone for your PTR records rather than you delegating a
|
||||
zone to your ISP maintains the logical "owner" and "delegate" roles.
|
||||
|
||||
If the primary server for the delegated zone is not permanently on
|
||||
the Internet (e.g. a dial-on-demand connection) then you would not
|
||||
want to advertise it in the NS records. It would just be a stealth
|
||||
server which the advertised secondaries poll for updates.
|
||||
|
||||
3. Example delegation
|
||||
|
||||
To delegate our example zone 0-28.150.80.204.IN-ADDR.ARPA first look
|
||||
at the NS records of the parent zone 150.80.204.IN-ADDR.ARPA. Let's
|
||||
say they are the following:
|
||||
|
||||
$ORIGIN 150.80.204.IN-ADDR.ARPA.
|
||||
@ IN NS GRENDEL.GW.COM.
|
||||
IN NS PYRY.GW.COM.
|
||||
|
||||
To delegate 204.80.150.0/28 to SRV.HOME.GW.COM you would then insert
|
||||
these records in the parent zone data:
|
||||
|
||||
$ORIGIN 150.80.204.IN-ADDR.ARPA.
|
||||
0-28 IN NS SRV.HOME.GW.COM.
|
||||
IN NS GRENDEL.GW.COM.
|
||||
IN NS PYRY.GW.COM.
|
||||
$GENERATE 0-15 $ IN CNAME $.0-28.150.80.204.IN-ADDR.ARPA.
|
||||
|
||||
The necessary modifications to /etc/named.conf will be left as an
|
||||
exercise to the reader.
|
||||
|
||||
Kimmo Suominen
|
||||
Global Wire Oy
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,245 +0,0 @@
|
||||
/* MIPS-specific support for 64-bit ELF
|
||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
Ian Lance Taylor, Cygnus Support
|
||||
Linker support added by Mark Mitchell, CodeSourcery, LLC.
|
||||
<[email protected]>
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This file supports the 64-bit (MIPS) ELF archives. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "aout/ar.h"
|
||||
|
||||
/* Irix 6 defines a 64bit archive map format, so that they can
|
||||
have archives more than 4 GB in size. */
|
||||
|
||||
boolean bfd_elf64_archive_slurp_armap PARAMS ((bfd *));
|
||||
boolean bfd_elf64_archive_write_armap
|
||||
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
|
||||
|
||||
/* Read an Irix 6 armap. */
|
||||
|
||||
boolean
|
||||
bfd_elf64_archive_slurp_armap (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct artdata *ardata = bfd_ardata (abfd);
|
||||
char nextname[17];
|
||||
file_ptr arhdrpos;
|
||||
bfd_size_type i, parsed_size, nsymz, stringsize, carsym_size, ptrsize;
|
||||
struct areltdata *mapdata;
|
||||
bfd_byte int_buf[8];
|
||||
char *stringbase;
|
||||
bfd_byte *raw_armap = NULL;
|
||||
carsym *carsyms;
|
||||
bfd_size_type amt;
|
||||
|
||||
ardata->symdefs = NULL;
|
||||
|
||||
/* Get the name of the first element. */
|
||||
arhdrpos = bfd_tell (abfd);
|
||||
i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd);
|
||||
if (i == 0)
|
||||
return true;
|
||||
if (i != 16)
|
||||
return false;
|
||||
|
||||
if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0)
|
||||
return false;
|
||||
|
||||
/* Archives with traditional armaps are still permitted. */
|
||||
if (strncmp (nextname, "/ ", 16) == 0)
|
||||
return bfd_slurp_armap (abfd);
|
||||
|
||||
if (strncmp (nextname, "/SYM64/ ", 16) != 0)
|
||||
{
|
||||
bfd_has_map (abfd) = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
|
||||
if (mapdata == NULL)
|
||||
return false;
|
||||
parsed_size = mapdata->parsed_size;
|
||||
bfd_release (abfd, (PTR) mapdata);
|
||||
|
||||
if (bfd_bread (int_buf, (bfd_size_type) 8, abfd) != 8)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_malformed_archive);
|
||||
return false;
|
||||
}
|
||||
|
||||
nsymz = bfd_getb64 (int_buf);
|
||||
stringsize = parsed_size - 8 * nsymz - 8;
|
||||
|
||||
carsym_size = nsymz * sizeof (carsym);
|
||||
ptrsize = 8 * nsymz;
|
||||
|
||||
amt = carsym_size + stringsize + 1;
|
||||
ardata->symdefs = (carsym *) bfd_zalloc (abfd, amt);
|
||||
if (ardata->symdefs == NULL)
|
||||
return false;
|
||||
carsyms = ardata->symdefs;
|
||||
stringbase = ((char *) ardata->symdefs) + carsym_size;
|
||||
|
||||
raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize);
|
||||
if (raw_armap == NULL)
|
||||
goto release_symdefs;
|
||||
|
||||
if (bfd_bread (raw_armap, ptrsize, abfd) != ptrsize
|
||||
|| bfd_bread (stringbase, stringsize, abfd) != stringsize)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_malformed_archive);
|
||||
goto release_raw_armap;
|
||||
}
|
||||
|
||||
for (i = 0; i < nsymz; i++)
|
||||
{
|
||||
carsyms->file_offset = bfd_getb64 (raw_armap + i * 8);
|
||||
carsyms->name = stringbase;
|
||||
stringbase += strlen (stringbase) + 1;
|
||||
++carsyms;
|
||||
}
|
||||
*stringbase = '\0';
|
||||
|
||||
ardata->symdef_count = nsymz;
|
||||
ardata->first_file_filepos = bfd_tell (abfd);
|
||||
/* Pad to an even boundary if you have to. */
|
||||
ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
|
||||
|
||||
bfd_has_map (abfd) = true;
|
||||
bfd_release (abfd, raw_armap);
|
||||
|
||||
return true;
|
||||
|
||||
release_raw_armap:
|
||||
bfd_release (abfd, raw_armap);
|
||||
release_symdefs:
|
||||
bfd_release (abfd, ardata->symdefs);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Write out an Irix 6 armap. The Irix 6 tools are supposed to be
|
||||
able to handle ordinary ELF armaps, but at least on Irix 6.2 the
|
||||
linker crashes. */
|
||||
|
||||
boolean
|
||||
bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
|
||||
bfd *arch;
|
||||
unsigned int elength;
|
||||
struct orl *map;
|
||||
unsigned int symbol_count;
|
||||
int stridx;
|
||||
{
|
||||
unsigned int ranlibsize = (symbol_count * 8) + 8;
|
||||
unsigned int stringsize = stridx;
|
||||
unsigned int mapsize = stringsize + ranlibsize;
|
||||
file_ptr archive_member_file_ptr;
|
||||
bfd *current = arch->archive_head;
|
||||
unsigned int count;
|
||||
struct ar_hdr hdr;
|
||||
unsigned int i;
|
||||
int padding;
|
||||
bfd_byte buf[8];
|
||||
|
||||
padding = BFD_ALIGN (mapsize, 8) - mapsize;
|
||||
mapsize += padding;
|
||||
|
||||
/* work out where the first object file will go in the archive */
|
||||
archive_member_file_ptr = (mapsize
|
||||
+ elength
|
||||
+ sizeof (struct ar_hdr)
|
||||
+ SARMAG);
|
||||
|
||||
memset ((char *) (&hdr), 0, sizeof (struct ar_hdr));
|
||||
strcpy (hdr.ar_name, "/SYM64/");
|
||||
sprintf (hdr.ar_size, "%-10d", (int) mapsize);
|
||||
sprintf (hdr.ar_date, "%ld", (long) time (NULL));
|
||||
/* This, at least, is what Intel coff sets the values to.: */
|
||||
sprintf ((hdr.ar_uid), "%d", 0);
|
||||
sprintf ((hdr.ar_gid), "%d", 0);
|
||||
sprintf ((hdr.ar_mode), "%-7o", (unsigned) 0);
|
||||
strncpy (hdr.ar_fmag, ARFMAG, 2);
|
||||
|
||||
for (i = 0; i < sizeof (struct ar_hdr); i++)
|
||||
if (((char *) (&hdr))[i] == '\0')
|
||||
(((char *) (&hdr))[i]) = ' ';
|
||||
|
||||
/* Write the ar header for this item and the number of symbols */
|
||||
|
||||
if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch)
|
||||
!= sizeof (struct ar_hdr))
|
||||
return false;
|
||||
|
||||
bfd_putb64 ((bfd_vma) symbol_count, buf);
|
||||
if (bfd_bwrite (buf, (bfd_size_type) 8, arch) != 8)
|
||||
return false;
|
||||
|
||||
/* Two passes, first write the file offsets for each symbol -
|
||||
remembering that each offset is on a two byte boundary. */
|
||||
|
||||
/* Write out the file offset for the file associated with each
|
||||
symbol, and remember to keep the offsets padded out. */
|
||||
|
||||
current = arch->archive_head;
|
||||
count = 0;
|
||||
while (current != (bfd *) NULL && count < symbol_count)
|
||||
{
|
||||
/* For each symbol which is used defined in this object, write out
|
||||
the object file's address in the archive */
|
||||
|
||||
while (map[count].u.abfd == current)
|
||||
{
|
||||
bfd_putb64 ((bfd_vma) archive_member_file_ptr, buf);
|
||||
if (bfd_bwrite (buf, (bfd_size_type) 8, arch) != 8)
|
||||
return false;
|
||||
count++;
|
||||
}
|
||||
/* Add size of this archive entry */
|
||||
archive_member_file_ptr += (arelt_size (current)
|
||||
+ sizeof (struct ar_hdr));
|
||||
/* remember about the even alignment */
|
||||
archive_member_file_ptr += archive_member_file_ptr % 2;
|
||||
current = current->next;
|
||||
}
|
||||
|
||||
/* now write the strings themselves */
|
||||
for (count = 0; count < symbol_count; count++)
|
||||
{
|
||||
size_t len = strlen (*map[count].name) + 1;
|
||||
|
||||
if (bfd_bwrite (*map[count].name, (bfd_size_type) len, arch) != len)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* The spec says that this should be padded to an 8 byte boundary.
|
||||
However, the Irix 6.2 tools do not appear to do this. */
|
||||
while (padding != 0)
|
||||
{
|
||||
if (bfd_bwrite ("", (bfd_size_type) 1, arch) != 1)
|
||||
return false;
|
||||
--padding;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
s|\(.*\) [^ ]*header.sed.*|\1|
|
||||
s|[^ ]*/||g
|
||||
s|^ *|"|
|
||||
s| |", "|g
|
||||
s|$|"|
|
||||
s|, \([^ ]*\)$| and \1|
|
||||
s|^|/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically generated from |
|
||||
s|\(.\{60\}[^ ]* \)|\1\
|
||||
|g
|
||||
s|$|.\
|
||||
Run "make headers" in your build bfd/ to regenerate. */\
|
||||
|
|
||||
@@ -1,449 +0,0 @@
|
||||
/* ELF strtab with GC and suffix merging support.
|
||||
Copyright 2001 Free Software Foundation, Inc.
|
||||
Written by Jakub Jelinek <[email protected]>.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "elf-bfd.h"
|
||||
#include "hashtab.h"
|
||||
|
||||
/* An entry in the strtab hash table. */
|
||||
|
||||
struct elf_strtab_hash_entry
|
||||
{
|
||||
struct bfd_hash_entry root;
|
||||
/* Length of this entry. */
|
||||
unsigned int len;
|
||||
unsigned int refcount;
|
||||
union {
|
||||
/* Index within the merged section. */
|
||||
bfd_size_type index;
|
||||
/* Entry this is a suffix of (if len is 0). */
|
||||
struct elf_strtab_hash_entry *suffix;
|
||||
struct elf_strtab_hash_entry *next;
|
||||
} u;
|
||||
};
|
||||
|
||||
/* The strtab hash table. */
|
||||
|
||||
struct elf_strtab_hash
|
||||
{
|
||||
struct bfd_hash_table table;
|
||||
/* Next available index. */
|
||||
bfd_size_type size;
|
||||
/* Number of array entries alloced. */
|
||||
bfd_size_type alloced;
|
||||
/* Final strtab size. */
|
||||
bfd_size_type sec_size;
|
||||
/* Array of pointers to strtab entries. */
|
||||
struct elf_strtab_hash_entry **array;
|
||||
};
|
||||
|
||||
static struct bfd_hash_entry *elf_strtab_hash_newfunc
|
||||
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
|
||||
static int cmplengthentry PARAMS ((const PTR, const PTR));
|
||||
static int last4_eq PARAMS ((const PTR, const PTR));
|
||||
|
||||
/* Routine to create an entry in a section merge hashtab. */
|
||||
|
||||
static struct bfd_hash_entry *
|
||||
elf_strtab_hash_newfunc (entry, table, string)
|
||||
struct bfd_hash_entry *entry;
|
||||
struct bfd_hash_table *table;
|
||||
const char *string;
|
||||
{
|
||||
struct elf_strtab_hash_entry *ret = (struct elf_strtab_hash_entry *) entry;
|
||||
|
||||
/* Allocate the structure if it has not already been allocated by a
|
||||
subclass. */
|
||||
if (ret == (struct elf_strtab_hash_entry *) NULL)
|
||||
ret = ((struct elf_strtab_hash_entry *)
|
||||
bfd_hash_allocate (table, sizeof (struct elf_strtab_hash_entry)));
|
||||
if (ret == (struct elf_strtab_hash_entry *) NULL)
|
||||
return NULL;
|
||||
|
||||
/* Call the allocation method of the superclass. */
|
||||
ret = ((struct elf_strtab_hash_entry *)
|
||||
bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
|
||||
|
||||
if (ret)
|
||||
{
|
||||
/* Initialize the local fields. */
|
||||
ret->u.index = -1;
|
||||
ret->refcount = 0;
|
||||
ret->len = 0;
|
||||
}
|
||||
|
||||
return (struct bfd_hash_entry *)ret;
|
||||
}
|
||||
|
||||
/* Create a new hash table. */
|
||||
|
||||
struct elf_strtab_hash *
|
||||
_bfd_elf_strtab_init ()
|
||||
{
|
||||
struct elf_strtab_hash *table;
|
||||
bfd_size_type amt = sizeof (struct elf_strtab_hash);
|
||||
|
||||
table = (struct elf_strtab_hash *) bfd_malloc (amt);
|
||||
if (table == NULL)
|
||||
return NULL;
|
||||
|
||||
if (! bfd_hash_table_init (&table->table, elf_strtab_hash_newfunc))
|
||||
{
|
||||
free (table);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
table->sec_size = 0;
|
||||
table->size = 1;
|
||||
table->alloced = 64;
|
||||
amt = sizeof (struct elf_strtab_hasn_entry *);
|
||||
table->array = (struct elf_strtab_hash_entry **)
|
||||
bfd_malloc (table->alloced * amt);
|
||||
if (table->array == NULL)
|
||||
{
|
||||
free (table);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
table->array[0] = NULL;
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
/* Free a strtab. */
|
||||
|
||||
void
|
||||
_bfd_elf_strtab_free (tab)
|
||||
struct elf_strtab_hash *tab;
|
||||
{
|
||||
bfd_hash_table_free (&tab->table);
|
||||
free (tab->array);
|
||||
free (tab);
|
||||
}
|
||||
|
||||
/* Get the index of an entity in a hash table, adding it if it is not
|
||||
already present. */
|
||||
|
||||
bfd_size_type
|
||||
_bfd_elf_strtab_add (tab, str, copy)
|
||||
struct elf_strtab_hash *tab;
|
||||
const char *str;
|
||||
boolean copy;
|
||||
{
|
||||
register struct elf_strtab_hash_entry *entry;
|
||||
|
||||
/* We handle this specially, since we don't want to do refcounting
|
||||
on it. */
|
||||
if (*str == '\0')
|
||||
return 0;
|
||||
|
||||
BFD_ASSERT (tab->sec_size == 0);
|
||||
entry = (struct elf_strtab_hash_entry *)
|
||||
bfd_hash_lookup (&tab->table, str, true, copy);
|
||||
|
||||
if (entry == NULL)
|
||||
return (bfd_size_type) -1;
|
||||
|
||||
entry->refcount++;
|
||||
if (entry->len == 0)
|
||||
{
|
||||
entry->len = strlen (str) + 1;
|
||||
if (tab->size == tab->alloced)
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct elf_strtab_hash_entry *);
|
||||
tab->alloced *= 2;
|
||||
tab->array = (struct elf_strtab_hash_entry **)
|
||||
bfd_realloc (tab->array, tab->alloced * amt);
|
||||
if (tab->array == NULL)
|
||||
return (bfd_size_type) -1;
|
||||
}
|
||||
|
||||
entry->u.index = tab->size++;
|
||||
tab->array[entry->u.index] = entry;
|
||||
}
|
||||
return entry->u.index;
|
||||
}
|
||||
|
||||
void
|
||||
_bfd_elf_strtab_addref (tab, idx)
|
||||
struct elf_strtab_hash *tab;
|
||||
bfd_size_type idx;
|
||||
{
|
||||
if (idx == 0 || idx == (bfd_size_type) -1)
|
||||
return;
|
||||
BFD_ASSERT (tab->sec_size == 0);
|
||||
BFD_ASSERT (idx < tab->size);
|
||||
++tab->array[idx]->refcount;
|
||||
}
|
||||
|
||||
void
|
||||
_bfd_elf_strtab_delref (tab, idx)
|
||||
struct elf_strtab_hash *tab;
|
||||
bfd_size_type idx;
|
||||
{
|
||||
if (idx == 0 || idx == (bfd_size_type) -1)
|
||||
return;
|
||||
BFD_ASSERT (tab->sec_size == 0);
|
||||
BFD_ASSERT (idx < tab->size);
|
||||
BFD_ASSERT (tab->array[idx]->refcount > 0);
|
||||
--tab->array[idx]->refcount;
|
||||
}
|
||||
|
||||
void
|
||||
_bfd_elf_strtab_clear_all_refs (tab)
|
||||
struct elf_strtab_hash *tab;
|
||||
{
|
||||
bfd_size_type idx;
|
||||
|
||||
for (idx = 1; idx < tab->size; ++idx)
|
||||
tab->array[idx]->refcount = 0;
|
||||
}
|
||||
|
||||
bfd_size_type
|
||||
_bfd_elf_strtab_size (tab)
|
||||
struct elf_strtab_hash *tab;
|
||||
{
|
||||
return tab->sec_size ? tab->sec_size : tab->size;
|
||||
}
|
||||
|
||||
bfd_size_type
|
||||
_bfd_elf_strtab_offset (tab, idx)
|
||||
struct elf_strtab_hash *tab;
|
||||
bfd_size_type idx;
|
||||
{
|
||||
struct elf_strtab_hash_entry *entry;
|
||||
|
||||
if (idx == 0)
|
||||
return 0;
|
||||
BFD_ASSERT (idx < tab->size);
|
||||
BFD_ASSERT (tab->sec_size);
|
||||
entry = tab->array[idx];
|
||||
BFD_ASSERT (entry->refcount > 0);
|
||||
entry->refcount--;
|
||||
return tab->array[idx]->u.index;
|
||||
}
|
||||
|
||||
boolean
|
||||
_bfd_elf_strtab_emit (abfd, tab)
|
||||
register bfd *abfd;
|
||||
struct elf_strtab_hash *tab;
|
||||
{
|
||||
bfd_size_type off = 1, i;
|
||||
|
||||
if (bfd_bwrite ("", 1, abfd) != 1)
|
||||
return false;
|
||||
|
||||
for (i = 1; i < tab->size; ++i)
|
||||
{
|
||||
register const char *str;
|
||||
register size_t len;
|
||||
|
||||
str = tab->array[i]->root.string;
|
||||
len = tab->array[i]->len;
|
||||
BFD_ASSERT (tab->array[i]->refcount == 0);
|
||||
if (len == 0)
|
||||
continue;
|
||||
|
||||
if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len)
|
||||
return false;
|
||||
|
||||
off += len;
|
||||
}
|
||||
|
||||
BFD_ASSERT (off == tab->sec_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Compare two elf_strtab_hash_entry structures. This is called via qsort. */
|
||||
|
||||
static int
|
||||
cmplengthentry (a, b)
|
||||
const PTR a;
|
||||
const PTR b;
|
||||
{
|
||||
struct elf_strtab_hash_entry * A = *(struct elf_strtab_hash_entry **) a;
|
||||
struct elf_strtab_hash_entry * B = *(struct elf_strtab_hash_entry **) b;
|
||||
|
||||
if (A->len < B->len)
|
||||
return 1;
|
||||
else if (A->len > B->len)
|
||||
return -1;
|
||||
|
||||
return memcmp (A->root.string, B->root.string, A->len);
|
||||
}
|
||||
|
||||
static int
|
||||
last4_eq (a, b)
|
||||
const PTR a;
|
||||
const PTR b;
|
||||
{
|
||||
struct elf_strtab_hash_entry * A = (struct elf_strtab_hash_entry *) a;
|
||||
struct elf_strtab_hash_entry * B = (struct elf_strtab_hash_entry *) b;
|
||||
|
||||
if (memcmp (A->root.string + A->len - 5, B->root.string + B->len - 5, 4)
|
||||
!= 0)
|
||||
/* This was a hashtable collision. */
|
||||
return 0;
|
||||
|
||||
if (A->len <= B->len)
|
||||
/* B cannot be a suffix of A unless A is equal to B, which is guaranteed
|
||||
not to be equal by the hash table. */
|
||||
return 0;
|
||||
|
||||
return memcmp (A->root.string + (A->len - B->len),
|
||||
B->root.string, B->len - 5) == 0;
|
||||
}
|
||||
|
||||
/* This function assigns final string table offsets for used strings,
|
||||
merging strings matching suffixes of longer strings if possible. */
|
||||
|
||||
void
|
||||
_bfd_elf_strtab_finalize (tab)
|
||||
struct elf_strtab_hash *tab;
|
||||
{
|
||||
struct elf_strtab_hash_entry **array, **a, **end, *e;
|
||||
htab_t last4tab = NULL;
|
||||
bfd_size_type size, amt;
|
||||
struct elf_strtab_hash_entry *last[256], **last_ptr[256];
|
||||
|
||||
/* GCC 2.91.66 (egcs-1.1.2) on i386 miscompiles this function when i is
|
||||
a 64-bit bfd_size_type: a 64-bit target or --enable-64-bit-bfd.
|
||||
Besides, indexing with a long long wouldn't give anything but extra
|
||||
cycles. */
|
||||
size_t i;
|
||||
|
||||
/* Now sort the strings by length, longest first. */
|
||||
array = NULL;
|
||||
amt = tab->size * sizeof (struct elf_strtab_hash_entry *);
|
||||
array = (struct elf_strtab_hash_entry **) bfd_malloc (amt);
|
||||
if (array == NULL)
|
||||
goto alloc_failure;
|
||||
|
||||
memset (last, 0, sizeof (last));
|
||||
for (i = 0; i < 256; ++i)
|
||||
last_ptr[i] = &last[i];
|
||||
for (i = 1, a = array; i < tab->size; ++i)
|
||||
if (tab->array[i]->refcount)
|
||||
*a++ = tab->array[i];
|
||||
else
|
||||
tab->array[i]->len = 0;
|
||||
|
||||
size = a - array;
|
||||
|
||||
qsort (array, size, sizeof (struct elf_strtab_hash_entry *), cmplengthentry);
|
||||
|
||||
last4tab = htab_create (size * 4, NULL, last4_eq, NULL);
|
||||
if (last4tab == NULL)
|
||||
goto alloc_failure;
|
||||
|
||||
/* Now insert the strings into hash tables (strings with last 4 characters
|
||||
and strings with last character equal), look for longer strings which
|
||||
we're suffix of. */
|
||||
for (a = array, end = array + size; a < end; a++)
|
||||
{
|
||||
register hashval_t hash;
|
||||
unsigned int c;
|
||||
unsigned int j;
|
||||
const unsigned char *s;
|
||||
PTR *p;
|
||||
|
||||
e = *a;
|
||||
if (e->len > 4)
|
||||
{
|
||||
s = e->root.string + e->len - 1;
|
||||
hash = 0;
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
c = *--s;
|
||||
hash += c + (c << 17);
|
||||
hash ^= hash >> 2;
|
||||
}
|
||||
p = htab_find_slot_with_hash (last4tab, e, hash, INSERT);
|
||||
if (p == NULL)
|
||||
goto alloc_failure;
|
||||
if (*p)
|
||||
{
|
||||
struct elf_strtab_hash_entry *ent;
|
||||
|
||||
ent = (struct elf_strtab_hash_entry *) *p;
|
||||
e->u.suffix = ent;
|
||||
e->len = 0;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
*p = (PTR) e;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct elf_strtab_hash_entry *tem;
|
||||
|
||||
c = e->root.string[e->len - 2] & 0xff;
|
||||
|
||||
for (tem = last[c]; tem; tem = tem->u.next)
|
||||
if (tem->len > e->len
|
||||
&& memcmp (tem->root.string + (tem->len - e->len),
|
||||
e->root.string, e->len - 1) == 0)
|
||||
break;
|
||||
if (tem)
|
||||
{
|
||||
e->u.suffix = tem;
|
||||
e->len = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
c = e->root.string[e->len - 2] & 0xff;
|
||||
/* Put longest strings first. */
|
||||
*last_ptr[c] = e;
|
||||
last_ptr[c] = &e->u.next;
|
||||
e->u.next = NULL;
|
||||
}
|
||||
|
||||
alloc_failure:
|
||||
if (array)
|
||||
free (array);
|
||||
if (last4tab)
|
||||
htab_delete (last4tab);
|
||||
|
||||
/* Now assign positions to the strings we want to keep. */
|
||||
size = 1;
|
||||
for (i = 1; i < tab->size; ++i)
|
||||
{
|
||||
e = tab->array[i];
|
||||
if (e->refcount && e->len)
|
||||
{
|
||||
e->u.index = size;
|
||||
size += e->len;
|
||||
}
|
||||
}
|
||||
|
||||
tab->sec_size = size;
|
||||
|
||||
/* And now adjust the rest. */
|
||||
for (i = 1; i < tab->size; ++i)
|
||||
{
|
||||
e = tab->array[i];
|
||||
if (e->refcount && ! e->len)
|
||||
e->u.index = e->u.suffix->u.index
|
||||
+ (e->u.suffix->len - strlen (e->root.string) - 1);
|
||||
}
|
||||
}
|
||||
@@ -1,335 +0,0 @@
|
||||
/* Support for the generic parts of PE/PEI; common header information.
|
||||
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
Written by Cygnus Solutions.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/*
|
||||
Most of this hacked by Steve Chamberlain,
|
||||
[email protected]
|
||||
|
||||
PE/PEI rearrangement (and code added): Donn Terry
|
||||
Softway Systems, Inc.
|
||||
*/
|
||||
|
||||
/* Hey look, some documentation [and in a place you expect to find it]!
|
||||
|
||||
The main reference for the pei format is "Microsoft Portable Executable
|
||||
and Common Object File Format Specification 4.1". Get it if you need to
|
||||
do some serious hacking on this code.
|
||||
|
||||
Another reference:
|
||||
"Peering Inside the PE: A Tour of the Win32 Portable Executable
|
||||
File Format", MSJ 1994, Volume 9.
|
||||
|
||||
The *sole* difference between the pe format and the pei format is that the
|
||||
latter has an MSDOS 2.0 .exe header on the front that prints the message
|
||||
"This app must be run under Windows." (or some such).
|
||||
(FIXME: Whether that statement is *really* true or not is unknown.
|
||||
Are there more subtle differences between pe and pei formats?
|
||||
For now assume there aren't. If you find one, then for God sakes
|
||||
document it here!)
|
||||
|
||||
The Microsoft docs use the word "image" instead of "executable" because
|
||||
the former can also refer to a DLL (shared library). Confusion can arise
|
||||
because the `i' in `pei' also refers to "image". The `pe' format can
|
||||
also create images (i.e. executables), it's just that to run on a win32
|
||||
system you need to use the pei format.
|
||||
|
||||
FIXME: Please add more docs here so the next poor fool that has to hack
|
||||
on this code has a chance of getting something accomplished without
|
||||
wasting too much time.
|
||||
*/
|
||||
|
||||
#ifndef GET_FCN_LNNOPTR
|
||||
#define GET_FCN_LNNOPTR(abfd, ext) \
|
||||
H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
|
||||
#endif
|
||||
|
||||
#ifndef GET_FCN_ENDNDX
|
||||
#define GET_FCN_ENDNDX(abfd, ext) \
|
||||
H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx)
|
||||
#endif
|
||||
|
||||
#ifndef PUT_FCN_LNNOPTR
|
||||
#define PUT_FCN_LNNOPTR(abfd, in, ext) \
|
||||
H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
|
||||
#endif
|
||||
#ifndef PUT_FCN_ENDNDX
|
||||
#define PUT_FCN_ENDNDX(abfd, in, ext) \
|
||||
H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_endndx)
|
||||
#endif
|
||||
#ifndef GET_LNSZ_LNNO
|
||||
#define GET_LNSZ_LNNO(abfd, ext) \
|
||||
H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno)
|
||||
#endif
|
||||
#ifndef GET_LNSZ_SIZE
|
||||
#define GET_LNSZ_SIZE(abfd, ext) \
|
||||
H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size)
|
||||
#endif
|
||||
#ifndef PUT_LNSZ_LNNO
|
||||
#define PUT_LNSZ_LNNO(abfd, in, ext) \
|
||||
H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno)
|
||||
#endif
|
||||
#ifndef PUT_LNSZ_SIZE
|
||||
#define PUT_LNSZ_SIZE(abfd, in, ext) \
|
||||
H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_size)
|
||||
#endif
|
||||
#ifndef GET_SCN_SCNLEN
|
||||
#define GET_SCN_SCNLEN(abfd, ext) \
|
||||
H_GET_32 (abfd, ext->x_scn.x_scnlen)
|
||||
#endif
|
||||
#ifndef GET_SCN_NRELOC
|
||||
#define GET_SCN_NRELOC(abfd, ext) \
|
||||
H_GET_16 (abfd, ext->x_scn.x_nreloc)
|
||||
#endif
|
||||
#ifndef GET_SCN_NLINNO
|
||||
#define GET_SCN_NLINNO(abfd, ext) \
|
||||
H_GET_16 (abfd, ext->x_scn.x_nlinno)
|
||||
#endif
|
||||
#ifndef PUT_SCN_SCNLEN
|
||||
#define PUT_SCN_SCNLEN(abfd, in, ext) \
|
||||
H_PUT_32(abfd, in, ext->x_scn.x_scnlen)
|
||||
#endif
|
||||
#ifndef PUT_SCN_NRELOC
|
||||
#define PUT_SCN_NRELOC(abfd, in, ext) \
|
||||
H_PUT_16(abfd, in, ext->x_scn.x_nreloc)
|
||||
#endif
|
||||
#ifndef PUT_SCN_NLINNO
|
||||
#define PUT_SCN_NLINNO(abfd, in, ext) \
|
||||
H_PUT_16(abfd,in, ext->x_scn.x_nlinno)
|
||||
#endif
|
||||
#ifndef GET_LINENO_LNNO
|
||||
#define GET_LINENO_LNNO(abfd, ext) \
|
||||
H_GET_16 (abfd, ext->l_lnno);
|
||||
#endif
|
||||
#ifndef PUT_LINENO_LNNO
|
||||
#define PUT_LINENO_LNNO(abfd, val, ext) \
|
||||
H_PUT_16(abfd,val, ext->l_lnno);
|
||||
#endif
|
||||
|
||||
/* The f_symptr field in the filehdr is sometimes 64 bits. */
|
||||
#ifndef GET_FILEHDR_SYMPTR
|
||||
#define GET_FILEHDR_SYMPTR H_GET_32
|
||||
#endif
|
||||
#ifndef PUT_FILEHDR_SYMPTR
|
||||
#define PUT_FILEHDR_SYMPTR H_PUT_32
|
||||
#endif
|
||||
|
||||
/* Some fields in the aouthdr are sometimes 64 bits. */
|
||||
#ifndef GET_AOUTHDR_TSIZE
|
||||
#define GET_AOUTHDR_TSIZE H_GET_32
|
||||
#endif
|
||||
#ifndef PUT_AOUTHDR_TSIZE
|
||||
#define PUT_AOUTHDR_TSIZE H_PUT_32
|
||||
#endif
|
||||
#ifndef GET_AOUTHDR_DSIZE
|
||||
#define GET_AOUTHDR_DSIZE H_GET_32
|
||||
#endif
|
||||
#ifndef PUT_AOUTHDR_DSIZE
|
||||
#define PUT_AOUTHDR_DSIZE H_PUT_32
|
||||
#endif
|
||||
#ifndef GET_AOUTHDR_BSIZE
|
||||
#define GET_AOUTHDR_BSIZE H_GET_32
|
||||
#endif
|
||||
#ifndef PUT_AOUTHDR_BSIZE
|
||||
#define PUT_AOUTHDR_BSIZE H_PUT_32
|
||||
#endif
|
||||
#ifndef GET_AOUTHDR_ENTRY
|
||||
#define GET_AOUTHDR_ENTRY H_GET_32
|
||||
#endif
|
||||
#ifndef PUT_AOUTHDR_ENTRY
|
||||
#define PUT_AOUTHDR_ENTRY H_PUT_32
|
||||
#endif
|
||||
#ifndef GET_AOUTHDR_TEXT_START
|
||||
#define GET_AOUTHDR_TEXT_START H_GET_32
|
||||
#endif
|
||||
#ifndef PUT_AOUTHDR_TEXT_START
|
||||
#define PUT_AOUTHDR_TEXT_START H_PUT_32
|
||||
#endif
|
||||
#ifndef GET_AOUTHDR_DATA_START
|
||||
#define GET_AOUTHDR_DATA_START H_GET_32
|
||||
#endif
|
||||
#ifndef PUT_AOUTHDR_DATA_START
|
||||
#define PUT_AOUTHDR_DATA_START H_PUT_32
|
||||
#endif
|
||||
|
||||
/* Some fields in the scnhdr are sometimes 64 bits. */
|
||||
#ifndef GET_SCNHDR_PADDR
|
||||
#define GET_SCNHDR_PADDR H_GET_32
|
||||
#endif
|
||||
#ifndef PUT_SCNHDR_PADDR
|
||||
#define PUT_SCNHDR_PADDR H_PUT_32
|
||||
#endif
|
||||
#ifndef GET_SCNHDR_VADDR
|
||||
#define GET_SCNHDR_VADDR H_GET_32
|
||||
#endif
|
||||
#ifndef PUT_SCNHDR_VADDR
|
||||
#define PUT_SCNHDR_VADDR H_PUT_32
|
||||
#endif
|
||||
#ifndef GET_SCNHDR_SIZE
|
||||
#define GET_SCNHDR_SIZE H_GET_32
|
||||
#endif
|
||||
#ifndef PUT_SCNHDR_SIZE
|
||||
#define PUT_SCNHDR_SIZE H_PUT_32
|
||||
#endif
|
||||
#ifndef GET_SCNHDR_SCNPTR
|
||||
#define GET_SCNHDR_SCNPTR H_GET_32
|
||||
#endif
|
||||
#ifndef PUT_SCNHDR_SCNPTR
|
||||
#define PUT_SCNHDR_SCNPTR H_PUT_32
|
||||
#endif
|
||||
#ifndef GET_SCNHDR_RELPTR
|
||||
#define GET_SCNHDR_RELPTR H_GET_32
|
||||
#endif
|
||||
#ifndef PUT_SCNHDR_RELPTR
|
||||
#define PUT_SCNHDR_RELPTR H_PUT_32
|
||||
#endif
|
||||
#ifndef GET_SCNHDR_LNNOPTR
|
||||
#define GET_SCNHDR_LNNOPTR H_GET_32
|
||||
#endif
|
||||
#ifndef PUT_SCNHDR_LNNOPTR
|
||||
#define PUT_SCNHDR_LNNOPTR H_PUT_32
|
||||
#endif
|
||||
|
||||
#ifdef COFF_WITH_pep
|
||||
|
||||
#define GET_OPTHDR_IMAGE_BASE H_GET_64
|
||||
#define PUT_OPTHDR_IMAGE_BASE H_PUT_64
|
||||
#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_64
|
||||
#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_64
|
||||
#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_64
|
||||
#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_64
|
||||
#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_64
|
||||
#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_64
|
||||
#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_64
|
||||
#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_64
|
||||
#define GET_PDATA_ENTRY bfd_get_64
|
||||
|
||||
#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pep_bfd_copy_private_bfd_data_common
|
||||
#define _bfd_XX_bfd_copy_private_section_data _bfd_pep_bfd_copy_private_section_data
|
||||
#define _bfd_XX_get_symbol_info _bfd_pep_get_symbol_info
|
||||
#define _bfd_XX_only_swap_filehdr_out _bfd_pep_only_swap_filehdr_out
|
||||
#define _bfd_XX_print_private_bfd_data_common _bfd_pep_print_private_bfd_data_common
|
||||
#define _bfd_XXi_final_link_postscript _bfd_pepi_final_link_postscript
|
||||
#define _bfd_XXi_final_link_postscript _bfd_pepi_final_link_postscript
|
||||
#define _bfd_XXi_only_swap_filehdr_out _bfd_pepi_only_swap_filehdr_out
|
||||
#define _bfd_XXi_swap_aouthdr_in _bfd_pepi_swap_aouthdr_in
|
||||
#define _bfd_XXi_swap_aouthdr_out _bfd_pepi_swap_aouthdr_out
|
||||
#define _bfd_XXi_swap_aux_in _bfd_pepi_swap_aux_in
|
||||
#define _bfd_XXi_swap_aux_out _bfd_pepi_swap_aux_out
|
||||
#define _bfd_XXi_swap_lineno_in _bfd_pepi_swap_lineno_in
|
||||
#define _bfd_XXi_swap_lineno_out _bfd_pepi_swap_lineno_out
|
||||
#define _bfd_XXi_swap_scnhdr_out _bfd_pepi_swap_scnhdr_out
|
||||
#define _bfd_XXi_swap_sym_in _bfd_pepi_swap_sym_in
|
||||
#define _bfd_XXi_swap_sym_out _bfd_pepi_swap_sym_out
|
||||
|
||||
#else /* !COFF_WITH_pep */
|
||||
|
||||
#define GET_OPTHDR_IMAGE_BASE H_GET_32
|
||||
#define PUT_OPTHDR_IMAGE_BASE H_PUT_32
|
||||
#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_32
|
||||
#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_32
|
||||
#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_32
|
||||
#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_32
|
||||
#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_32
|
||||
#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_32
|
||||
#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_32
|
||||
#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_32
|
||||
#define GET_PDATA_ENTRY bfd_get_32
|
||||
|
||||
#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pe_bfd_copy_private_bfd_data_common
|
||||
#define _bfd_XX_bfd_copy_private_section_data _bfd_pe_bfd_copy_private_section_data
|
||||
#define _bfd_XX_get_symbol_info _bfd_pe_get_symbol_info
|
||||
#define _bfd_XX_only_swap_filehdr_out _bfd_pe_only_swap_filehdr_out
|
||||
#define _bfd_XX_print_private_bfd_data_common _bfd_pe_print_private_bfd_data_common
|
||||
#define _bfd_XXi_final_link_postscript _bfd_pei_final_link_postscript
|
||||
#define _bfd_XXi_final_link_postscript _bfd_pei_final_link_postscript
|
||||
#define _bfd_XXi_only_swap_filehdr_out _bfd_pei_only_swap_filehdr_out
|
||||
#define _bfd_XXi_swap_aouthdr_in _bfd_pei_swap_aouthdr_in
|
||||
#define _bfd_XXi_swap_aouthdr_out _bfd_pei_swap_aouthdr_out
|
||||
#define _bfd_XXi_swap_aux_in _bfd_pei_swap_aux_in
|
||||
#define _bfd_XXi_swap_aux_out _bfd_pei_swap_aux_out
|
||||
#define _bfd_XXi_swap_lineno_in _bfd_pei_swap_lineno_in
|
||||
#define _bfd_XXi_swap_lineno_out _bfd_pei_swap_lineno_out
|
||||
#define _bfd_XXi_swap_scnhdr_out _bfd_pei_swap_scnhdr_out
|
||||
#define _bfd_XXi_swap_sym_in _bfd_pei_swap_sym_in
|
||||
#define _bfd_XXi_swap_sym_out _bfd_pei_swap_sym_out
|
||||
|
||||
#endif /* !COFF_WITH_pep */
|
||||
|
||||
/* These functions are architecture dependent, and are in peicode.h:
|
||||
coff_swap_reloc_in
|
||||
int coff_swap_reloc_out
|
||||
coff_swap_filehdr_in
|
||||
coff_swap_scnhdr_in
|
||||
pe_mkobject
|
||||
pe_mkobject_hook */
|
||||
|
||||
/* The functions described below are common across all PE/PEI
|
||||
implementations architecture types, and actually appear in
|
||||
peigen.c. */
|
||||
|
||||
void _bfd_XXi_swap_sym_in PARAMS ((bfd*, PTR, PTR));
|
||||
#define coff_swap_sym_in _bfd_XXi_swap_sym_in
|
||||
|
||||
unsigned int _bfd_XXi_swap_sym_out PARAMS ((bfd*, PTR, PTR));
|
||||
#define coff_swap_sym_out _bfd_XXi_swap_sym_out
|
||||
|
||||
void _bfd_XXi_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
|
||||
#define coff_swap_aux_in _bfd_XXi_swap_aux_in
|
||||
|
||||
unsigned int _bfd_XXi_swap_aux_out \
|
||||
PARAMS ((bfd *, PTR, int, int, int, int, PTR));
|
||||
#define coff_swap_aux_out _bfd_XXi_swap_aux_out
|
||||
|
||||
void _bfd_XXi_swap_lineno_in PARAMS ((bfd*, PTR, PTR));
|
||||
#define coff_swap_lineno_in _bfd_XXi_swap_lineno_in
|
||||
|
||||
unsigned int _bfd_XXi_swap_lineno_out PARAMS ((bfd*, PTR, PTR));
|
||||
#define coff_swap_lineno_out _bfd_XXi_swap_lineno_out
|
||||
|
||||
void _bfd_XXi_swap_aouthdr_in PARAMS ((bfd*, PTR, PTR));
|
||||
#define coff_swap_aouthdr_in _bfd_XXi_swap_aouthdr_in
|
||||
|
||||
unsigned int _bfd_XXi_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR));
|
||||
#define coff_swap_aouthdr_out _bfd_XXi_swap_aouthdr_out
|
||||
|
||||
unsigned int _bfd_XXi_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR));
|
||||
#define coff_swap_scnhdr_out _bfd_XXi_swap_scnhdr_out
|
||||
|
||||
boolean _bfd_XX_print_private_bfd_data_common PARAMS ((bfd *, PTR));
|
||||
|
||||
boolean _bfd_XX_bfd_copy_private_bfd_data_common PARAMS ((bfd *, bfd *));
|
||||
|
||||
void _bfd_XX_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
|
||||
|
||||
boolean _bfd_XXi_final_link_postscript
|
||||
PARAMS ((bfd *, struct coff_final_link_info *));
|
||||
|
||||
#ifndef coff_final_link_postscript
|
||||
#define coff_final_link_postscript _bfd_XXi_final_link_postscript
|
||||
#endif
|
||||
/* The following are needed only for ONE of pe or pei, but don't
|
||||
otherwise vary; peicode.h fixes up ifdefs but we provide the
|
||||
prototype. */
|
||||
|
||||
unsigned int _bfd_XX_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
|
||||
unsigned int _bfd_XXi_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
|
||||
boolean _bfd_XX_bfd_copy_private_section_data
|
||||
PARAMS ((bfd *, asection *, bfd *, asection *));
|
||||
@@ -1,958 +0,0 @@
|
||||
/* SEC_MERGE support.
|
||||
Copyright 2001 Free Software Foundation, Inc.
|
||||
Written by Jakub Jelinek <[email protected]>.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This file contains support for merging duplicate entities within sections,
|
||||
as used in ELF SHF_MERGE. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "hashtab.h"
|
||||
|
||||
struct sec_merge_sec_info;
|
||||
|
||||
/* An entry in the section merge hash table. */
|
||||
|
||||
struct sec_merge_hash_entry
|
||||
{
|
||||
struct bfd_hash_entry root;
|
||||
/* Length of this entry. */
|
||||
unsigned int len;
|
||||
/* Start of this string needs to be aligned to
|
||||
alignment octets (not 1 << align). */
|
||||
unsigned int alignment;
|
||||
union {
|
||||
/* Index within the merged section. */
|
||||
bfd_size_type index;
|
||||
/* Entity size (if present in suffix hash tables). */
|
||||
unsigned int entsize;
|
||||
/* Entry this is a suffix of (if alignment is 0). */
|
||||
struct sec_merge_hash_entry *suffix;
|
||||
} u;
|
||||
/* Which section is it in. */
|
||||
struct sec_merge_sec_info *secinfo;
|
||||
/* Next entity in the hash table. */
|
||||
struct sec_merge_hash_entry *next;
|
||||
};
|
||||
|
||||
/* The section merge hash table. */
|
||||
|
||||
struct sec_merge_hash
|
||||
{
|
||||
struct bfd_hash_table table;
|
||||
/* Next available index. */
|
||||
bfd_size_type size;
|
||||
/* First entity in the SEC_MERGE sections of this type. */
|
||||
struct sec_merge_hash_entry *first;
|
||||
/* Last entity in the SEC_MERGE sections of this type. */
|
||||
struct sec_merge_hash_entry *last;
|
||||
/* Entity size. */
|
||||
unsigned int entsize;
|
||||
/* Are entries fixed size or zero terminated strings? */
|
||||
boolean strings;
|
||||
};
|
||||
|
||||
struct sec_merge_info
|
||||
{
|
||||
/* Chain of sec_merge_infos. */
|
||||
struct sec_merge_info *next;
|
||||
/* Chain of sec_merge_sec_infos. */
|
||||
struct sec_merge_sec_info *chain;
|
||||
/* A hash table used to hold section content. */
|
||||
struct sec_merge_hash *htab;
|
||||
};
|
||||
|
||||
struct sec_merge_sec_info
|
||||
{
|
||||
/* Chain of sec_merge_sec_infos. */
|
||||
struct sec_merge_sec_info *next;
|
||||
/* The corresponding section. */
|
||||
asection *sec;
|
||||
/* Pointer to merge_info pointing to us. */
|
||||
PTR *psecinfo;
|
||||
/* A hash table used to hold section content. */
|
||||
struct sec_merge_hash *htab;
|
||||
/* First string in this section. */
|
||||
struct sec_merge_hash_entry *first;
|
||||
/* Original section content. */
|
||||
unsigned char contents[1];
|
||||
};
|
||||
|
||||
static struct bfd_hash_entry *sec_merge_hash_newfunc
|
||||
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
|
||||
static struct sec_merge_hash_entry *sec_merge_hash_lookup
|
||||
PARAMS ((struct sec_merge_hash *, const char *, unsigned int, boolean));
|
||||
static struct sec_merge_hash *sec_merge_init
|
||||
PARAMS ((unsigned int, boolean));
|
||||
static struct sec_merge_hash_entry *sec_merge_add
|
||||
PARAMS ((struct sec_merge_hash *, const char *, unsigned int,
|
||||
struct sec_merge_sec_info *));
|
||||
static boolean sec_merge_emit
|
||||
PARAMS ((bfd *, struct sec_merge_hash_entry *));
|
||||
static int cmplengthentry PARAMS ((const PTR, const PTR));
|
||||
static int last4_eq PARAMS ((const PTR, const PTR));
|
||||
static int last_eq PARAMS ((const PTR, const PTR));
|
||||
static boolean record_section
|
||||
PARAMS ((struct sec_merge_info *, struct sec_merge_sec_info *));
|
||||
static void merge_strings PARAMS ((struct sec_merge_info *));
|
||||
|
||||
/* Routine to create an entry in a section merge hashtab. */
|
||||
|
||||
static struct bfd_hash_entry *
|
||||
sec_merge_hash_newfunc (entry, table, string)
|
||||
struct bfd_hash_entry *entry;
|
||||
struct bfd_hash_table *table;
|
||||
const char *string;
|
||||
{
|
||||
struct sec_merge_hash_entry *ret = (struct sec_merge_hash_entry *) entry;
|
||||
|
||||
/* Allocate the structure if it has not already been allocated by a
|
||||
subclass. */
|
||||
if (ret == (struct sec_merge_hash_entry *) NULL)
|
||||
ret = ((struct sec_merge_hash_entry *)
|
||||
bfd_hash_allocate (table, sizeof (struct sec_merge_hash_entry)));
|
||||
if (ret == (struct sec_merge_hash_entry *) NULL)
|
||||
return NULL;
|
||||
|
||||
/* Call the allocation method of the superclass. */
|
||||
ret = ((struct sec_merge_hash_entry *)
|
||||
bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
|
||||
|
||||
if (ret)
|
||||
{
|
||||
/* Initialize the local fields. */
|
||||
ret->u.suffix = NULL;
|
||||
ret->alignment = 0;
|
||||
ret->secinfo = NULL;
|
||||
ret->next = NULL;
|
||||
}
|
||||
|
||||
return (struct bfd_hash_entry *)ret;
|
||||
}
|
||||
|
||||
/* Look up an entry in a section merge hash table. */
|
||||
|
||||
static struct sec_merge_hash_entry *
|
||||
sec_merge_hash_lookup (table, string, alignment, create)
|
||||
struct sec_merge_hash *table;
|
||||
const char *string;
|
||||
unsigned int alignment;
|
||||
boolean create;
|
||||
{
|
||||
register const unsigned char *s;
|
||||
register unsigned long hash;
|
||||
register unsigned int c;
|
||||
struct sec_merge_hash_entry *hashp;
|
||||
unsigned int len, i;
|
||||
unsigned int index;
|
||||
|
||||
hash = 0;
|
||||
len = 0;
|
||||
s = (const unsigned char *) string;
|
||||
if (table->strings)
|
||||
{
|
||||
if (table->entsize == 1)
|
||||
{
|
||||
while ((c = *s++) != '\0')
|
||||
{
|
||||
hash += c + (c << 17);
|
||||
hash ^= hash >> 2;
|
||||
++len;
|
||||
}
|
||||
hash += len + (len << 17);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
for (i = 0; i < table->entsize; ++i)
|
||||
if (s[i] != '\0')
|
||||
break;
|
||||
if (i == table->entsize)
|
||||
break;
|
||||
for (i = 0; i < table->entsize; ++i)
|
||||
{
|
||||
c = *s++;
|
||||
hash += c + (c << 17);
|
||||
hash ^= hash >> 2;
|
||||
}
|
||||
++len;
|
||||
}
|
||||
hash += len + (len << 17);
|
||||
len *= table->entsize;
|
||||
}
|
||||
hash ^= hash >> 2;
|
||||
len += table->entsize;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < table->entsize; ++i)
|
||||
{
|
||||
c = *s++;
|
||||
hash += c + (c << 17);
|
||||
hash ^= hash >> 2;
|
||||
}
|
||||
len = table->entsize;
|
||||
}
|
||||
|
||||
index = hash % table->table.size;
|
||||
for (hashp = (struct sec_merge_hash_entry *) table->table.table[index];
|
||||
hashp != (struct sec_merge_hash_entry *) NULL;
|
||||
hashp = (struct sec_merge_hash_entry *) hashp->root.next)
|
||||
{
|
||||
if (hashp->root.hash == hash
|
||||
&& len == hashp->len
|
||||
&& memcmp (hashp->root.string, string, len) == 0)
|
||||
{
|
||||
/* If the string we found does not have at least the required
|
||||
alignment, we need to insert another copy. */
|
||||
if (hashp->alignment < alignment)
|
||||
{
|
||||
/* Mark the less aligned copy as deleted. */
|
||||
hashp->len = 0;
|
||||
hashp->alignment = 0;
|
||||
break;
|
||||
}
|
||||
return hashp;
|
||||
}
|
||||
}
|
||||
|
||||
if (! create)
|
||||
return (struct sec_merge_hash_entry *) NULL;
|
||||
|
||||
hashp = (struct sec_merge_hash_entry *)
|
||||
sec_merge_hash_newfunc ((struct bfd_hash_entry *) NULL,
|
||||
(struct bfd_hash_table *) table, string);
|
||||
if (hashp == (struct sec_merge_hash_entry *) NULL)
|
||||
return (struct sec_merge_hash_entry *) NULL;
|
||||
hashp->root.string = string;
|
||||
hashp->root.hash = hash;
|
||||
hashp->len = len;
|
||||
hashp->alignment = alignment;
|
||||
hashp->root.next = table->table.table[index];
|
||||
table->table.table[index] = (struct bfd_hash_entry *) hashp;
|
||||
|
||||
return hashp;
|
||||
}
|
||||
|
||||
/* Create a new hash table. */
|
||||
|
||||
static struct sec_merge_hash *
|
||||
sec_merge_init (entsize, strings)
|
||||
unsigned int entsize;
|
||||
boolean strings;
|
||||
{
|
||||
struct sec_merge_hash *table;
|
||||
bfd_size_type amt = sizeof (struct sec_merge_hash);
|
||||
|
||||
table = (struct sec_merge_hash *) bfd_malloc (amt);
|
||||
if (table == NULL)
|
||||
return NULL;
|
||||
|
||||
if (! bfd_hash_table_init (&table->table, sec_merge_hash_newfunc))
|
||||
{
|
||||
free (table);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
table->size = 0;
|
||||
table->first = NULL;
|
||||
table->last = NULL;
|
||||
table->entsize = entsize;
|
||||
table->strings = strings;
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
/* Get the index of an entity in a hash table, adding it if it is not
|
||||
already present. */
|
||||
|
||||
static struct sec_merge_hash_entry *
|
||||
sec_merge_add (tab, str, alignment, secinfo)
|
||||
struct sec_merge_hash *tab;
|
||||
const char *str;
|
||||
unsigned int alignment;
|
||||
struct sec_merge_sec_info *secinfo;
|
||||
{
|
||||
register struct sec_merge_hash_entry *entry;
|
||||
|
||||
entry = sec_merge_hash_lookup (tab, str, alignment, true);
|
||||
if (entry == NULL)
|
||||
return NULL;
|
||||
|
||||
if (entry->secinfo == NULL)
|
||||
{
|
||||
tab->size++;
|
||||
entry->secinfo = secinfo;
|
||||
if (tab->first == NULL)
|
||||
tab->first = entry;
|
||||
else
|
||||
tab->last->next = entry;
|
||||
tab->last = entry;
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static boolean
|
||||
sec_merge_emit (abfd, entry)
|
||||
register bfd *abfd;
|
||||
struct sec_merge_hash_entry *entry;
|
||||
{
|
||||
struct sec_merge_sec_info *secinfo = entry->secinfo;
|
||||
asection *sec = secinfo->sec;
|
||||
char *pad = "";
|
||||
bfd_size_type off = 0;
|
||||
int alignment_power = bfd_get_section_alignment (abfd, sec->output_section);
|
||||
|
||||
if (alignment_power)
|
||||
pad = bfd_zmalloc ((bfd_size_type) 1 << alignment_power);
|
||||
|
||||
for (; entry != NULL && entry->secinfo == secinfo; entry = entry->next)
|
||||
{
|
||||
register const char *str;
|
||||
register size_t len;
|
||||
|
||||
len = off & (entry->alignment - 1);
|
||||
if (len)
|
||||
{
|
||||
len = entry->alignment - len;
|
||||
if (bfd_bwrite ((PTR) pad, (bfd_size_type) len, abfd) != len)
|
||||
break;
|
||||
off += len;
|
||||
}
|
||||
|
||||
str = entry->root.string;
|
||||
len = entry->len;
|
||||
|
||||
if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len)
|
||||
break;
|
||||
|
||||
off += len;
|
||||
}
|
||||
|
||||
if (alignment_power)
|
||||
free (pad);
|
||||
|
||||
return entry == NULL || entry->secinfo != secinfo;
|
||||
}
|
||||
|
||||
/* This function is called for each input file from the add_symbols
|
||||
pass of the linker. */
|
||||
|
||||
boolean
|
||||
_bfd_merge_section (abfd, psinfo, sec, psecinfo)
|
||||
bfd *abfd;
|
||||
PTR *psinfo;
|
||||
asection *sec;
|
||||
PTR *psecinfo;
|
||||
{
|
||||
struct sec_merge_info *sinfo;
|
||||
struct sec_merge_sec_info *secinfo;
|
||||
unsigned int align;
|
||||
bfd_size_type amt;
|
||||
|
||||
if (sec->_raw_size == 0
|
||||
|| (sec->flags & SEC_EXCLUDE)
|
||||
|| (sec->flags & SEC_MERGE) == 0
|
||||
|| sec->entsize == 0)
|
||||
return true;
|
||||
|
||||
if ((sec->flags & SEC_RELOC) != 0)
|
||||
{
|
||||
/* We aren't prepared to handle relocations in merged sections. */
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sec->output_section != NULL
|
||||
&& bfd_is_abs_section (sec->output_section))
|
||||
{
|
||||
/* The section is being discarded from the link, so we should
|
||||
just ignore it. */
|
||||
return true;
|
||||
}
|
||||
|
||||
align = bfd_get_section_alignment (sec->owner, sec);
|
||||
if ((sec->entsize < (unsigned int)(1 << align)
|
||||
&& ((sec->entsize & (sec->entsize - 1))
|
||||
|| !(sec->flags & SEC_STRINGS)))
|
||||
|| (sec->entsize > (unsigned int)(1 << align)
|
||||
&& (sec->entsize & ((1 << align) - 1))))
|
||||
{
|
||||
/* Sanity check. If string character size is smaller than
|
||||
alignment, then we require character size to be a power
|
||||
of 2, otherwise character size must be integer multiple
|
||||
of alignment. For non-string constants, alignment must
|
||||
be smaller than or equal to entity size and entity size
|
||||
must be integer multiple of alignment. */
|
||||
return true;
|
||||
}
|
||||
|
||||
for (sinfo = (struct sec_merge_info *) *psinfo; sinfo; sinfo = sinfo->next)
|
||||
if ((secinfo = sinfo->chain)
|
||||
&& ! ((secinfo->sec->flags ^ sec->flags) & (SEC_MERGE | SEC_STRINGS))
|
||||
&& secinfo->sec->entsize == sec->entsize
|
||||
&& ! strcmp (secinfo->sec->name, sec->name))
|
||||
break;
|
||||
|
||||
if (sinfo == NULL)
|
||||
{
|
||||
/* Initialize the information we need to keep track of. */
|
||||
sinfo = (struct sec_merge_info *)
|
||||
bfd_alloc (abfd, (bfd_size_type) sizeof (struct sec_merge_info));
|
||||
if (sinfo == NULL)
|
||||
goto error_return;
|
||||
sinfo->next = (struct sec_merge_info *) *psinfo;
|
||||
sinfo->chain = NULL;
|
||||
*psinfo = (PTR) sinfo;
|
||||
sinfo->htab =
|
||||
sec_merge_init (sec->entsize, (sec->flags & SEC_STRINGS));
|
||||
if (sinfo->htab == NULL)
|
||||
goto error_return;
|
||||
}
|
||||
|
||||
/* Read the section from abfd. */
|
||||
|
||||
amt = sizeof (struct sec_merge_sec_info) + sec->_raw_size - 1;
|
||||
*psecinfo = bfd_alloc (abfd, amt);
|
||||
if (*psecinfo == NULL)
|
||||
goto error_return;
|
||||
|
||||
secinfo = (struct sec_merge_sec_info *)*psecinfo;
|
||||
if (sinfo->chain)
|
||||
{
|
||||
secinfo->next = sinfo->chain->next;
|
||||
sinfo->chain->next = secinfo;
|
||||
}
|
||||
else
|
||||
secinfo->next = secinfo;
|
||||
sinfo->chain = secinfo;
|
||||
secinfo->sec = sec;
|
||||
secinfo->psecinfo = psecinfo;
|
||||
secinfo->htab = sinfo->htab;
|
||||
secinfo->first = NULL;
|
||||
|
||||
if (! bfd_get_section_contents (sec->owner, sec, secinfo->contents,
|
||||
(bfd_vma) 0, sec->_raw_size))
|
||||
goto error_return;
|
||||
|
||||
return true;
|
||||
|
||||
error_return:
|
||||
*psecinfo = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Compare two sec_merge_hash_entry structures. This is called via qsort. */
|
||||
|
||||
static int
|
||||
cmplengthentry (a, b)
|
||||
const PTR a;
|
||||
const PTR b;
|
||||
{
|
||||
struct sec_merge_hash_entry * A = *(struct sec_merge_hash_entry **) a;
|
||||
struct sec_merge_hash_entry * B = *(struct sec_merge_hash_entry **) b;
|
||||
|
||||
if (A->len < B->len)
|
||||
return 1;
|
||||
else if (A->len > B->len)
|
||||
return -1;
|
||||
|
||||
return memcmp (A->root.string, B->root.string, A->len);
|
||||
}
|
||||
|
||||
static int
|
||||
last4_eq (a, b)
|
||||
const PTR a;
|
||||
const PTR b;
|
||||
{
|
||||
struct sec_merge_hash_entry * A = (struct sec_merge_hash_entry *) a;
|
||||
struct sec_merge_hash_entry * B = (struct sec_merge_hash_entry *) b;
|
||||
|
||||
if (memcmp (A->root.string + A->len - 5 * A->u.entsize,
|
||||
B->root.string + B->len - 5 * A->u.entsize,
|
||||
4 * A->u.entsize) != 0)
|
||||
/* This was a hashtable collision. */
|
||||
return 0;
|
||||
|
||||
if (A->len <= B->len)
|
||||
/* B cannot be a suffix of A unless A is equal to B, which is guaranteed
|
||||
not to be equal by the hash table. */
|
||||
return 0;
|
||||
|
||||
if (A->alignment < B->alignment
|
||||
|| ((A->len - B->len) & (B->alignment - 1)))
|
||||
/* The suffix is not sufficiently aligned. */
|
||||
return 0;
|
||||
|
||||
return memcmp (A->root.string + (A->len - B->len),
|
||||
B->root.string, B->len - 5 * A->u.entsize) == 0;
|
||||
}
|
||||
|
||||
static int
|
||||
last_eq (a, b)
|
||||
const PTR a;
|
||||
const PTR b;
|
||||
{
|
||||
struct sec_merge_hash_entry * A = (struct sec_merge_hash_entry *) a;
|
||||
struct sec_merge_hash_entry * B = (struct sec_merge_hash_entry *) b;
|
||||
|
||||
if (B->len >= 5 * A->u.entsize)
|
||||
/* Longer strings are just pushed into the hash table,
|
||||
they'll be used when looking up for very short strings. */
|
||||
return 0;
|
||||
|
||||
if (memcmp (A->root.string + A->len - 2 * A->u.entsize,
|
||||
B->root.string + B->len - 2 * A->u.entsize,
|
||||
A->u.entsize) != 0)
|
||||
/* This was a hashtable collision. */
|
||||
return 0;
|
||||
|
||||
if (A->len <= B->len)
|
||||
/* B cannot be a suffix of A unless A is equal to B, which is guaranteed
|
||||
not to be equal by the hash table. */
|
||||
return 0;
|
||||
|
||||
if (A->alignment < B->alignment
|
||||
|| ((A->len - B->len) & (B->alignment - 1)))
|
||||
/* The suffix is not sufficiently aligned. */
|
||||
return 0;
|
||||
|
||||
return memcmp (A->root.string + (A->len - B->len),
|
||||
B->root.string, B->len - 2 * A->u.entsize) == 0;
|
||||
}
|
||||
|
||||
/* Record one section into the hash table. */
|
||||
static boolean
|
||||
record_section (sinfo, secinfo)
|
||||
struct sec_merge_info *sinfo;
|
||||
struct sec_merge_sec_info *secinfo;
|
||||
{
|
||||
asection *sec = secinfo->sec;
|
||||
struct sec_merge_hash_entry *entry;
|
||||
boolean nul;
|
||||
unsigned char *p, *end;
|
||||
bfd_vma mask, eltalign;
|
||||
unsigned int align, i;
|
||||
|
||||
align = bfd_get_section_alignment (sec->owner, sec);
|
||||
end = secinfo->contents + sec->_raw_size;
|
||||
nul = false;
|
||||
mask = ((bfd_vma) 1 << align) - 1;
|
||||
if (sec->flags & SEC_STRINGS)
|
||||
{
|
||||
for (p = secinfo->contents; p < end; )
|
||||
{
|
||||
eltalign = p - secinfo->contents;
|
||||
eltalign = ((eltalign ^ (eltalign - 1)) + 1) >> 1;
|
||||
if (!eltalign || eltalign > mask)
|
||||
eltalign = mask + 1;
|
||||
entry = sec_merge_add (sinfo->htab, p, (unsigned) eltalign, secinfo);
|
||||
if (! entry)
|
||||
goto error_return;
|
||||
p += entry->len;
|
||||
if (sec->entsize == 1)
|
||||
{
|
||||
while (p < end && *p == 0)
|
||||
{
|
||||
if (!nul && !((p - secinfo->contents) & mask))
|
||||
{
|
||||
nul = true;
|
||||
entry = sec_merge_add (sinfo->htab, "",
|
||||
(unsigned) mask + 1, secinfo);
|
||||
if (! entry)
|
||||
goto error_return;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (p < end)
|
||||
{
|
||||
for (i = 0; i < sec->entsize; i++)
|
||||
if (p[i] != '\0')
|
||||
break;
|
||||
if (i != sec->entsize)
|
||||
break;
|
||||
if (!nul && !((p - secinfo->contents) & mask))
|
||||
{
|
||||
nul = true;
|
||||
entry = sec_merge_add (sinfo->htab, p,
|
||||
(unsigned) mask + 1, secinfo);
|
||||
if (! entry)
|
||||
goto error_return;
|
||||
}
|
||||
p += sec->entsize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (p = secinfo->contents; p < end; p += sec->entsize)
|
||||
{
|
||||
entry = sec_merge_add (sinfo->htab, p, 1, secinfo);
|
||||
if (! entry)
|
||||
goto error_return;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
error_return:
|
||||
for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
|
||||
*secinfo->psecinfo = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* This is a helper function for _bfd_merge_sections. It attempts to
|
||||
merge strings matching suffixes of longer strings. */
|
||||
static void
|
||||
merge_strings (sinfo)
|
||||
struct sec_merge_info *sinfo;
|
||||
{
|
||||
struct sec_merge_hash_entry **array, **a, **end, *e;
|
||||
struct sec_merge_sec_info *secinfo;
|
||||
htab_t lasttab = NULL, last4tab = NULL;
|
||||
bfd_size_type size, amt;
|
||||
|
||||
/* Now sort the strings by length, longest first. */
|
||||
array = NULL;
|
||||
amt = sinfo->htab->size * sizeof (struct sec_merge_hash_entry *);
|
||||
array = (struct sec_merge_hash_entry **) bfd_malloc (amt);
|
||||
if (array == NULL)
|
||||
goto alloc_failure;
|
||||
|
||||
for (e = sinfo->htab->first, a = array; e; e = e->next)
|
||||
if (e->alignment)
|
||||
*a++ = e;
|
||||
|
||||
sinfo->htab->size = a - array;
|
||||
|
||||
qsort (array, (size_t) sinfo->htab->size,
|
||||
sizeof (struct sec_merge_hash_entry *), cmplengthentry);
|
||||
|
||||
last4tab = htab_create ((size_t) sinfo->htab->size * 4, NULL, last4_eq, NULL);
|
||||
lasttab = htab_create ((size_t) sinfo->htab->size * 4, NULL, last_eq, NULL);
|
||||
if (lasttab == NULL || last4tab == NULL)
|
||||
goto alloc_failure;
|
||||
|
||||
/* Now insert the strings into hash tables (strings with last 4 characters
|
||||
and strings with last character equal), look for longer strings which
|
||||
we're suffix of. */
|
||||
for (a = array, end = array + sinfo->htab->size; a < end; a++)
|
||||
{
|
||||
register hashval_t hash;
|
||||
unsigned int c;
|
||||
unsigned int i;
|
||||
const unsigned char *s;
|
||||
PTR *p;
|
||||
|
||||
e = *a;
|
||||
e->u.entsize = sinfo->htab->entsize;
|
||||
if (e->len <= e->u.entsize)
|
||||
break;
|
||||
if (e->len > 4 * e->u.entsize)
|
||||
{
|
||||
s = e->root.string + e->len - e->u.entsize;
|
||||
hash = 0;
|
||||
for (i = 0; i < 4 * e->u.entsize; i++)
|
||||
{
|
||||
c = *--s;
|
||||
hash += c + (c << 17);
|
||||
hash ^= hash >> 2;
|
||||
}
|
||||
p = htab_find_slot_with_hash (last4tab, e, hash, INSERT);
|
||||
if (p == NULL)
|
||||
goto alloc_failure;
|
||||
if (*p)
|
||||
{
|
||||
struct sec_merge_hash_entry *ent;
|
||||
|
||||
ent = (struct sec_merge_hash_entry *) *p;
|
||||
e->u.suffix = ent;
|
||||
e->alignment = 0;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
*p = (PTR) e;
|
||||
}
|
||||
s = e->root.string + e->len - e->u.entsize;
|
||||
hash = 0;
|
||||
for (i = 0; i < e->u.entsize; i++)
|
||||
{
|
||||
c = *--s;
|
||||
hash += c + (c << 17);
|
||||
hash ^= hash >> 2;
|
||||
}
|
||||
p = htab_find_slot_with_hash (lasttab, e, hash, INSERT);
|
||||
if (p == NULL)
|
||||
goto alloc_failure;
|
||||
if (*p)
|
||||
{
|
||||
struct sec_merge_hash_entry *ent;
|
||||
|
||||
ent = (struct sec_merge_hash_entry *) *p;
|
||||
e->u.suffix = ent;
|
||||
e->alignment = 0;
|
||||
}
|
||||
else
|
||||
*p = (PTR) e;
|
||||
}
|
||||
|
||||
alloc_failure:
|
||||
if (array)
|
||||
free (array);
|
||||
if (lasttab)
|
||||
htab_delete (lasttab);
|
||||
if (last4tab)
|
||||
htab_delete (last4tab);
|
||||
|
||||
/* Now assign positions to the strings we want to keep. */
|
||||
size = 0;
|
||||
secinfo = sinfo->htab->first->secinfo;
|
||||
for (e = sinfo->htab->first; e; e = e->next)
|
||||
{
|
||||
if (e->secinfo != secinfo)
|
||||
{
|
||||
secinfo->sec->_cooked_size = size;
|
||||
secinfo = e->secinfo;
|
||||
}
|
||||
if (e->alignment)
|
||||
{
|
||||
if (e->secinfo->first == NULL)
|
||||
{
|
||||
e->secinfo->first = e;
|
||||
size = 0;
|
||||
}
|
||||
size = (size + e->alignment - 1) & ~((bfd_vma) e->alignment - 1);
|
||||
e->u.index = size;
|
||||
size += e->len;
|
||||
}
|
||||
}
|
||||
secinfo->sec->_cooked_size = size;
|
||||
|
||||
/* And now adjust the rest, removing them from the chain (but not hashtable)
|
||||
at the same time. */
|
||||
for (a = &sinfo->htab->first, e = *a; e; e = e->next)
|
||||
if (e->alignment)
|
||||
a = &e->next;
|
||||
else
|
||||
{
|
||||
*a = e->next;
|
||||
if (e->len)
|
||||
{
|
||||
e->secinfo = e->u.suffix->secinfo;
|
||||
e->alignment = e->u.suffix->alignment;
|
||||
e->u.index = e->u.suffix->u.index + (e->u.suffix->len - e->len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* This function is called once after all SEC_MERGE sections are registered
|
||||
with _bfd_merge_section. */
|
||||
|
||||
boolean
|
||||
_bfd_merge_sections (abfd, xsinfo, remove_hook)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
PTR xsinfo;
|
||||
void (*remove_hook) PARAMS((bfd *, asection *));
|
||||
{
|
||||
struct sec_merge_info *sinfo;
|
||||
|
||||
for (sinfo = (struct sec_merge_info *) xsinfo; sinfo; sinfo = sinfo->next)
|
||||
{
|
||||
struct sec_merge_sec_info * secinfo;
|
||||
|
||||
if (! sinfo->chain)
|
||||
continue;
|
||||
|
||||
/* Move sinfo->chain to head of the chain, terminate it. */
|
||||
secinfo = sinfo->chain;
|
||||
sinfo->chain = secinfo->next;
|
||||
secinfo->next = NULL;
|
||||
|
||||
/* Record the sections into the hash table. */
|
||||
for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
|
||||
if (secinfo->sec->flags & SEC_EXCLUDE)
|
||||
{
|
||||
*secinfo->psecinfo = NULL;
|
||||
if (remove_hook)
|
||||
(*remove_hook) (abfd, secinfo->sec);
|
||||
}
|
||||
else if (! record_section (sinfo, secinfo))
|
||||
break;
|
||||
|
||||
if (secinfo)
|
||||
continue;
|
||||
|
||||
if (sinfo->htab->first == NULL)
|
||||
continue;
|
||||
|
||||
if (sinfo->htab->strings)
|
||||
merge_strings (sinfo);
|
||||
else
|
||||
{
|
||||
struct sec_merge_hash_entry *e;
|
||||
bfd_size_type size = 0;
|
||||
|
||||
/* Things are much simpler for non-strings.
|
||||
Just assign them slots in the section. */
|
||||
secinfo = NULL;
|
||||
for (e = sinfo->htab->first; e; e = e->next)
|
||||
{
|
||||
if (e->secinfo->first == NULL)
|
||||
{
|
||||
if (secinfo)
|
||||
secinfo->sec->_cooked_size = size;
|
||||
e->secinfo->first = e;
|
||||
size = 0;
|
||||
}
|
||||
size = (size + e->alignment - 1)
|
||||
& ~((bfd_vma) e->alignment - 1);
|
||||
e->u.index = size;
|
||||
size += e->len;
|
||||
secinfo = e->secinfo;
|
||||
}
|
||||
secinfo->sec->_cooked_size = size;
|
||||
}
|
||||
|
||||
/* Finally shrink all input sections which have not made it into
|
||||
the hash table at all. */
|
||||
for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
|
||||
if (secinfo->first == NULL)
|
||||
{
|
||||
secinfo->sec->_cooked_size = 0;
|
||||
secinfo->sec->flags |= SEC_EXCLUDE;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Write out the merged section. */
|
||||
|
||||
boolean
|
||||
_bfd_write_merged_section (output_bfd, sec, psecinfo)
|
||||
bfd *output_bfd;
|
||||
asection *sec;
|
||||
PTR psecinfo;
|
||||
{
|
||||
struct sec_merge_sec_info *secinfo;
|
||||
file_ptr pos;
|
||||
|
||||
secinfo = (struct sec_merge_sec_info *) psecinfo;
|
||||
|
||||
if (!secinfo->first)
|
||||
return true;
|
||||
|
||||
pos = sec->output_section->filepos + sec->output_offset;
|
||||
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0)
|
||||
return false;
|
||||
|
||||
if (! sec_merge_emit (output_bfd, secinfo->first))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Adjust an address in the SEC_MERGE section. Given OFFSET within
|
||||
*PSEC, this returns the new offset in the adjusted SEC_MERGE
|
||||
section and writes the new section back into *PSEC. */
|
||||
|
||||
bfd_vma
|
||||
_bfd_merged_section_offset (output_bfd, psec, psecinfo, offset, addend)
|
||||
bfd *output_bfd ATTRIBUTE_UNUSED;
|
||||
asection **psec;
|
||||
PTR psecinfo;
|
||||
bfd_vma offset, addend;
|
||||
{
|
||||
struct sec_merge_sec_info *secinfo;
|
||||
struct sec_merge_hash_entry *entry;
|
||||
unsigned char *p;
|
||||
asection *sec = *psec;
|
||||
|
||||
secinfo = (struct sec_merge_sec_info *) psecinfo;
|
||||
|
||||
if (offset + addend >= sec->_raw_size)
|
||||
{
|
||||
if (offset + addend > sec->_raw_size)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
(_("%s: access beyond end of merged section (%ld + %ld)"),
|
||||
bfd_get_filename (sec->owner), (long) offset, (long) addend);
|
||||
}
|
||||
return (secinfo->first ? sec->_cooked_size : 0);
|
||||
}
|
||||
|
||||
if (secinfo->htab->strings)
|
||||
{
|
||||
if (sec->entsize == 1)
|
||||
{
|
||||
p = secinfo->contents + offset + addend - 1;
|
||||
while (*p && p >= secinfo->contents)
|
||||
--p;
|
||||
++p;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = secinfo->contents
|
||||
+ ((offset + addend) / sec->entsize) * sec->entsize;
|
||||
p -= sec->entsize;
|
||||
while (p >= secinfo->contents)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < sec->entsize; ++i)
|
||||
if (p[i] != '\0')
|
||||
break;
|
||||
if (i == sec->entsize)
|
||||
break;
|
||||
p -= sec->entsize;
|
||||
}
|
||||
p += sec->entsize;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
p = secinfo->contents
|
||||
+ ((offset + addend) / sec->entsize) * sec->entsize;
|
||||
}
|
||||
entry = sec_merge_hash_lookup (secinfo->htab, p, 0, false);
|
||||
if (!entry)
|
||||
{
|
||||
if (! secinfo->htab->strings)
|
||||
abort ();
|
||||
/* This should only happen if somebody points into the padding
|
||||
after a NUL character but before next entity. */
|
||||
if (*p)
|
||||
abort ();
|
||||
if (! secinfo->htab->first)
|
||||
abort ();
|
||||
entry = secinfo->htab->first;
|
||||
p = secinfo->contents
|
||||
+ ((offset + addend) / sec->entsize + 1) * sec->entsize
|
||||
- entry->len;
|
||||
}
|
||||
|
||||
*psec = entry->secinfo->sec;
|
||||
return entry->u.index + (secinfo->contents + offset - p);
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,195 +0,0 @@
|
||||
/* Common definitions for backends based on IBM RS/6000 "XCOFF64" files.
|
||||
Copyright 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Internalcoff.h and coffcode.h modify themselves based on this flag. */
|
||||
#define RS6000COFF_C 1
|
||||
|
||||
#define SELECT_RELOC(internal, howto) \
|
||||
{ \
|
||||
internal.r_type = howto->type; \
|
||||
internal.r_size = \
|
||||
((howto->complain_on_overflow == complain_overflow_signed \
|
||||
? 0x80 \
|
||||
: 0) \
|
||||
| (howto->bitsize - 1)); \
|
||||
}
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
|
||||
|
||||
#define COFF_LONG_FILENAMES
|
||||
|
||||
#define NO_COFF_SYMBOLS
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) _bfd_xcoff_rtype2howto (cache_ptr, dst)
|
||||
|
||||
#define coff_mkobject _bfd_xcoff_mkobject
|
||||
#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data
|
||||
#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
|
||||
#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup
|
||||
#define coff_relocate_section _bfd_ppc_xcoff_relocate_section
|
||||
|
||||
#define CORE_FILE_P _bfd_dummy_target
|
||||
|
||||
#define coff_core_file_failing_command _bfd_nocore_core_file_failing_command
|
||||
#define coff_core_file_failing_signal _bfd_nocore_core_file_failing_signal
|
||||
#define coff_core_file_matches_executable_p \
|
||||
_bfd_nocore_core_file_matches_executable_p
|
||||
|
||||
#ifdef AIX_CORE
|
||||
#undef CORE_FILE_P
|
||||
#define CORE_FILE_P rs6000coff_core_p
|
||||
extern const bfd_target * rs6000coff_core_p ();
|
||||
extern boolean rs6000coff_core_file_matches_executable_p ();
|
||||
|
||||
#undef coff_core_file_matches_executable_p
|
||||
#define coff_core_file_matches_executable_p \
|
||||
rs6000coff_core_file_matches_executable_p
|
||||
|
||||
extern char *rs6000coff_core_file_failing_command PARAMS ((bfd *abfd));
|
||||
#undef coff_core_file_failing_command
|
||||
#define coff_core_file_failing_command rs6000coff_core_file_failing_command
|
||||
|
||||
extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd));
|
||||
#undef coff_core_file_failing_signal
|
||||
#define coff_core_file_failing_signal rs6000coff_core_file_failing_signal
|
||||
#endif /* AIX_CORE */
|
||||
|
||||
#ifdef LYNX_CORE
|
||||
|
||||
#undef CORE_FILE_P
|
||||
#define CORE_FILE_P lynx_core_file_p
|
||||
extern const bfd_target *lynx_core_file_p PARAMS ((bfd *abfd));
|
||||
|
||||
extern boolean lynx_core_file_matches_executable_p PARAMS ((bfd *core_bfd,
|
||||
bfd *exec_bfd));
|
||||
#undef coff_core_file_matches_executable_p
|
||||
#define coff_core_file_matches_executable_p lynx_core_file_matches_executable_p
|
||||
|
||||
extern char *lynx_core_file_failing_command PARAMS ((bfd *abfd));
|
||||
#undef coff_core_file_failing_command
|
||||
#define coff_core_file_failing_command lynx_core_file_failing_command
|
||||
|
||||
extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd));
|
||||
#undef coff_core_file_failing_signal
|
||||
#define coff_core_file_failing_signal lynx_core_file_failing_signal
|
||||
|
||||
#endif /* LYNX_CORE */
|
||||
|
||||
#define _bfd_xcoff_bfd_get_relocated_section_contents \
|
||||
coff_bfd_get_relocated_section_contents
|
||||
#define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section
|
||||
#define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections
|
||||
#define _bfd_xcoff_bfd_merge_sections coff_bfd_merge_sections
|
||||
#define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section
|
||||
|
||||
/* XCOFF archives do not have anything which corresponds to an
|
||||
extended name table. */
|
||||
|
||||
#define _bfd_xcoff_slurp_extended_name_table bfd_false
|
||||
#define _bfd_xcoff_construct_extended_name_table \
|
||||
((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
|
||||
bfd_false)
|
||||
#define _bfd_xcoff_truncate_arname bfd_dont_truncate_arname
|
||||
|
||||
/* We can use the standard get_elt_at_index routine. */
|
||||
|
||||
#define _bfd_xcoff_get_elt_at_index _bfd_generic_get_elt_at_index
|
||||
|
||||
/* XCOFF archives do not have a timestamp. */
|
||||
|
||||
#define _bfd_xcoff_update_armap_timestamp bfd_true
|
||||
|
||||
extern boolean _bfd_xcoff_mkobject PARAMS ((bfd *));
|
||||
extern boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *));
|
||||
extern boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *));
|
||||
extern void _bfd_xcoff_rtype2howto
|
||||
PARAMS ((arelent *, struct internal_reloc *));
|
||||
extern reloc_howto_type *_bfd_xcoff_reloc_type_lookup
|
||||
PARAMS ((bfd *, bfd_reloc_code_real_type));
|
||||
extern boolean _bfd_xcoff_slurp_armap PARAMS ((bfd *));
|
||||
extern const bfd_target *_bfd_xcoff_archive_p PARAMS ((bfd *));
|
||||
extern PTR _bfd_xcoff_read_ar_hdr PARAMS ((bfd *));
|
||||
extern bfd *_bfd_xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *));
|
||||
extern int _bfd_xcoff_generic_stat_arch_elt PARAMS ((bfd *, struct stat *));
|
||||
extern boolean _bfd_xcoff_write_armap
|
||||
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
|
||||
extern boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *));
|
||||
extern int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, boolean));
|
||||
extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR));
|
||||
extern unsigned int _bfd_xcoff_swap_sym_out PARAMS ((bfd *, PTR, PTR));
|
||||
extern void _bfd_xcoff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
|
||||
extern unsigned int _bfd_xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR));
|
||||
|
||||
#ifndef coff_SWAP_sym_in
|
||||
#define coff_SWAP_sym_in _bfd_xcoff_swap_sym_in
|
||||
#define coff_SWAP_sym_out _bfd_xcoff_swap_sym_out
|
||||
#define coff_SWAP_aux_in _bfd_xcoff_swap_aux_in
|
||||
#define coff_SWAP_aux_out _bfd_xcoff_swap_aux_out
|
||||
#endif
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
/* The transfer vector that leads the outside world to all of the above. */
|
||||
|
||||
const bfd_target TARGET_SYM =
|
||||
{
|
||||
TARGET_NAME,
|
||||
bfd_target_xcoff_flavour,
|
||||
BFD_ENDIAN_BIG, /* data byte order is big */
|
||||
BFD_ENDIAN_BIG, /* header byte order is big */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG | DYNAMIC |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading char */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen??? FIXMEmgo */
|
||||
|
||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
|
||||
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
_bfd_xcoff_archive_p, CORE_FILE_P},
|
||||
{bfd_false, coff_mkobject, /* bfd_set_format */
|
||||
_bfd_generic_mkarchive, bfd_false},
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_xcoff_write_archive_contents, bfd_false},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (coff),
|
||||
BFD_JUMP_TABLE_COPY (coff),
|
||||
BFD_JUMP_TABLE_CORE (coff),
|
||||
BFD_JUMP_TABLE_ARCHIVE (_bfd_xcoff),
|
||||
BFD_JUMP_TABLE_SYMBOLS (coff),
|
||||
BFD_JUMP_TABLE_RELOCS (coff),
|
||||
BFD_JUMP_TABLE_WRITE (coff),
|
||||
BFD_JUMP_TABLE_LINK (_bfd_xcoff),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_xcoff),
|
||||
|
||||
NULL,
|
||||
|
||||
COFF_SWAP_TABLE
|
||||
};
|
||||
@@ -1,165 +0,0 @@
|
||||
## Process this file with automake to generate Makefile.in
|
||||
|
||||
AUTOMAKE_OPTIONS = cygnus
|
||||
|
||||
# What version of the manual you want; "all" includes everything
|
||||
CONFIG=all
|
||||
|
||||
# Options to extract the man page from as.texinfo
|
||||
MANCONF = -Dman
|
||||
|
||||
TEXI2POD = perl $(top_srcdir)/../etc/texi2pod.pl
|
||||
|
||||
POD2MAN = pod2man --center="GNU Development Tools" \
|
||||
--release="binutils-$(VERSION)" --section=1
|
||||
|
||||
# List of man pages generated from binutils.texi
|
||||
man_MANS = \
|
||||
addr2line.1 \
|
||||
ar.1 \
|
||||
dlltool.1 \
|
||||
nlmconv.1 \
|
||||
nm.1 \
|
||||
objcopy.1 \
|
||||
objdump.1 \
|
||||
ranlib.1 \
|
||||
readelf.1 \
|
||||
size.1 \
|
||||
strings.1 \
|
||||
strip.1 \
|
||||
windres.1 \
|
||||
$(DEMANGLER_NAME).1
|
||||
|
||||
info_TEXINFOS = binutils.texi
|
||||
|
||||
config.texi: Makefile
|
||||
rm -f config.texi
|
||||
echo '@set VERSION $(VERSION)' > config.texi
|
||||
|
||||
binutils_TEXI = $(srcdir)/binutils.texi
|
||||
|
||||
binutils.dvi: $(binutils_TEXI) config.texi
|
||||
|
||||
binutils.info: $(binutils_TEXI) config.texi
|
||||
|
||||
# Man page generation from texinfo
|
||||
addr2line.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Daddr2line < $< > addr2line.pod
|
||||
-($(POD2MAN) addr2line.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f addr2line.pod
|
||||
|
||||
ar.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dar < $< > ar.pod
|
||||
-($(POD2MAN) ar.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f ar.pod
|
||||
|
||||
dlltool.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Ddlltool < $< > dlltool.pod
|
||||
-($(POD2MAN) dlltool.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f dlltool.pod
|
||||
|
||||
nlmconv.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dnlmconv < $< > nlmconv.pod
|
||||
-($(POD2MAN) nlmconv.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f nlmconv.pod
|
||||
|
||||
nm.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dnm < $< > nm.pod
|
||||
-($(POD2MAN) nm.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f nm.pod
|
||||
|
||||
objcopy.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dobjcopy < $< > objcopy.pod
|
||||
-($(POD2MAN) objcopy.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f objcopy.pod
|
||||
|
||||
objdump.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dobjdump < $< > objdump.pod
|
||||
-($(POD2MAN) objdump.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f objdump.pod
|
||||
|
||||
ranlib.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dranlib < $< > ranlib.pod
|
||||
-($(POD2MAN) ranlib.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f ranlib.pod
|
||||
|
||||
readelf.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dreadelf < $< > readelf.pod
|
||||
-($(POD2MAN) readelf.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f readelf.pod
|
||||
|
||||
size.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dsize < $< > size.pod
|
||||
-($(POD2MAN) size.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f size.pod
|
||||
|
||||
strings.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dstrings < $< > strings.pod
|
||||
-($(POD2MAN) strings.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f strings.pod
|
||||
|
||||
strip.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dstrip < $< > strip.pod
|
||||
-($(POD2MAN) strip.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f strip.pod
|
||||
|
||||
windres.1: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dwindres < $< > windres.pod
|
||||
-($(POD2MAN) windres.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f windres.pod
|
||||
|
||||
cxxfilt.man: $(binutils_TEXI)
|
||||
touch $@
|
||||
-$(TEXI2POD) $(MANCONF) -Dcxxfilt < $< > $(DEMANGLER_NAME).pod
|
||||
-($(POD2MAN) $(DEMANGLER_NAME).pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
|
||||
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
|
||||
rm -f $(DEMANGLER_NAME).pod
|
||||
|
||||
MAINTAINERCLEANFILES = config.texi
|
||||
DISTCLEANFILES = config.texi
|
||||
MOSTLYCLEANFILES = $(DEMANGLER_NAME).1
|
||||
|
||||
$(DEMANGLER_NAME).1: cxxfilt.man Makefile
|
||||
if test -f cxxfilt.man; then \
|
||||
man=cxxfilt.man; \
|
||||
else \
|
||||
man=$(srcdir)/cxxfilt.man; \
|
||||
fi; \
|
||||
sed -e 's/@PROGRAM@/$(DEMANGLER_NAME)/' \
|
||||
-e 's/cxxfilt/$(DEMANGLER_NAME)/' < $$man \
|
||||
> $(DEMANGLER_NAME).1
|
||||
|
||||
# We want install to imply install-info as per GNU standards, despite the
|
||||
# cygnus option.
|
||||
install: install-info
|
||||
|
||||
# Maintenance
|
||||
|
||||
# We need it for the taz target in ../../Makefile.in.
|
||||
info: $(MANS)
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,396 +0,0 @@
|
||||
@c Copyright 2002
|
||||
@c Free Software Foundation, Inc.
|
||||
@c This is part of the GAS manual.
|
||||
@c For copying conditions, see the file as.texinfo.
|
||||
|
||||
@ifset GENERIC
|
||||
@page
|
||||
@node Alpha-Dependent
|
||||
@chapter Alpha Dependent Features
|
||||
@end ifset
|
||||
|
||||
@ifclear GENERIC
|
||||
@node Machine Dependencies
|
||||
@chapter Alpha Dependent Features
|
||||
@end ifclear
|
||||
|
||||
@cindex Alpha support
|
||||
@menu
|
||||
* Alpha Notes:: Notes
|
||||
* Alpha Options:: Options
|
||||
* Alpha Syntax:: Syntax
|
||||
* Alpha Floating Point:: Floating Point
|
||||
* Alpha Directives:: Alpha Machine Directives
|
||||
* Alpha Opcodes:: Opcodes
|
||||
@end menu
|
||||
|
||||
@node Alpha Notes
|
||||
@section Notes
|
||||
@cindex Alpha notes
|
||||
@cindex notes for Alpha
|
||||
|
||||
The documentation here is primarily for the ELF object format.
|
||||
@code{@value{AS}} also supports the ECOFF and EVAX formats, but
|
||||
features specific to these formats are not yet documented.
|
||||
|
||||
@node Alpha Options
|
||||
@section Options
|
||||
@cindex Alpha options
|
||||
@cindex options for Alpha
|
||||
|
||||
@table @option
|
||||
@cindex @code{-m@var{cpu}} command line option, Alpha
|
||||
@item -m@var{cpu}
|
||||
This option specifies the target processor. If an attempt is made to
|
||||
assemble an instruction which will not execute on the target processor,
|
||||
the assembler may either expand the instruction as a macro or issue an
|
||||
error message. This option is equivalent to the @code{.arch} directive.
|
||||
|
||||
The following processor names are recognized:
|
||||
@code{21064},
|
||||
@code{21064a},
|
||||
@code{21066},
|
||||
@code{21068},
|
||||
@code{21164},
|
||||
@code{21164a},
|
||||
@code{21164pc},
|
||||
@code{21264},
|
||||
@code{ev4},
|
||||
@code{ev5},
|
||||
@code{lca45},
|
||||
@code{ev5},
|
||||
@code{ev56},
|
||||
@code{pca56},
|
||||
@code{ev6}.
|
||||
The special name @code{all} may be used to allow the assembler to accept
|
||||
instructions valid for any Alpha processor.
|
||||
|
||||
In order to support existing practice in OSF/1 with respect to @code{.arch},
|
||||
and existing practice within @command{MILO} (the Linux ARC bootloader), the
|
||||
numbered processor names (e.g.@: 21064) enable the processor-specific PALcode
|
||||
instructions, while the ``electro-vlasic'' names (e.g.@: @code{ev4}) do not.
|
||||
|
||||
@cindex @code{-mdebug} command line option, Alpha
|
||||
@cindex @code{-no-mdebug} command line option, Alpha
|
||||
@item -mdebug
|
||||
@itemx -no-mdebug
|
||||
Enables or disables the generation of @code{.mdebug} encapsulation for
|
||||
stabs directives and procedure descriptors. The default is to automatically
|
||||
enable @code{.mdebug} when the first stabs directive is seen.
|
||||
|
||||
@cindex @code{-relax} command line option, Alpha
|
||||
@item -relax
|
||||
This option forces all relocations to be put into the object file, instead
|
||||
of saving space and resolving some relocations at assembly time. Note that
|
||||
this option does not propagate all symbol arithmetic into the object file,
|
||||
because not all symbol arithmetic can be represented. However, the option
|
||||
can still be useful in specific applications.
|
||||
|
||||
@cindex @code{-g} command line option, Alpha
|
||||
@item -g
|
||||
This option is used when the compiler generates debug information. When
|
||||
@command{gcc} is using @command{mips-tfile} to generate debug
|
||||
information for ECOFF, local labels must be passed through to the object
|
||||
file. Otherwise this option has no effect.
|
||||
|
||||
@cindex @code{-G} command line option, Alpha
|
||||
@item -G@var{size}
|
||||
A local common symbol larger than @var{size} is placed in @code{.bss},
|
||||
while smaller symbols are placed in @code{.sbss}.
|
||||
|
||||
@cindex @code{-F} command line option, Alpha
|
||||
@cindex @code{-32addr} command line option, Alpha
|
||||
@item -F
|
||||
@itemx -32addr
|
||||
These options are ignored for backward compatibility.
|
||||
@end table
|
||||
|
||||
@cindex Alpha Syntax
|
||||
@node Alpha Syntax
|
||||
@section Syntax
|
||||
The assembler syntax closely follow the Alpha Reference Manual;
|
||||
assembler directives and general syntax closely follow the OSF/1 and
|
||||
OpenVMS syntax, with a few differences for ELF.
|
||||
|
||||
@menu
|
||||
* Alpha-Chars:: Special Characters
|
||||
* Alpha-Regs:: Register Names
|
||||
* Alpha-Relocs:: Relocations
|
||||
@end menu
|
||||
|
||||
@node Alpha-Chars
|
||||
@subsection Special Characters
|
||||
|
||||
@cindex line comment character, Alpha
|
||||
@cindex Alpha line comment character
|
||||
@samp{#} is the line comment character.
|
||||
|
||||
@cindex line separator, Alpha
|
||||
@cindex statement separator, Alpha
|
||||
@cindex Alpha line separator
|
||||
@samp{;} can be used instead of a newline to separate statements.
|
||||
|
||||
@node Alpha-Regs
|
||||
@subsection Register Names
|
||||
@cindex Alpha registers
|
||||
@cindex register names, Alpha
|
||||
|
||||
The 32 integer registers are refered to as @samp{$@var{n}} or
|
||||
@samp{$r@var{n}}. In addition, registers 15, 28, 29, and 30 may
|
||||
be refered to by the symbols @samp{$fp}, @samp{$at}, @samp{$gp},
|
||||
and @samp{$sp} respectively.
|
||||
|
||||
The 32 floating-point registers are refered to as @samp{$f@var{n}}.
|
||||
|
||||
@node Alpha-Relocs
|
||||
@subsection Relocations
|
||||
@cindex Alpha relocations
|
||||
@cindex relocations, Alpha
|
||||
|
||||
Some of these relocations are available for ECOFF, but mostly
|
||||
only for ELF. They are modeled after the relocation format
|
||||
introduced in Digial Unix 4.0, but there are additions.
|
||||
|
||||
The format is @samp{!@var{tag}} or @samp{!@var{tag}!@var{number}}
|
||||
where @var{tag} is the name of the relocation. In some cases
|
||||
@var{number} is used to relate specific instructions.
|
||||
|
||||
The relocation is placed at the end of the instruction like so:
|
||||
|
||||
@example
|
||||
ldah $0,a($29) !gprelhigh
|
||||
lda $0,a($0) !gprellow
|
||||
ldq $1,b($29) !literal!100
|
||||
ldl $2,0($1) !lituse_base!100
|
||||
@end example
|
||||
|
||||
@table @code
|
||||
@item !literal
|
||||
@itemx !literal!@var{N}
|
||||
Used with an @code{ldq} instruction to load the address of a symbol
|
||||
from the GOT.
|
||||
|
||||
A sequence number @var{N} is optional, and if present is used to pair
|
||||
@code{lituse} relocations with this @code{literal} relocation. The
|
||||
@code{lituse} relocations are used by the linker to optimize the code
|
||||
based on the final location of the symbol.
|
||||
|
||||
Note that these optimizations are dependent on the data flow of the
|
||||
program. Therefore, if @emph{any} @code{lituse} is paired with a
|
||||
@code{literal} relocation, then @emph{all} uses of the register set by
|
||||
the @code{literal} instruction must also be marked with @code{lituse}
|
||||
relocations. This is because the original @code{literal} instruction
|
||||
may be deleted or transformed into another instruction.
|
||||
|
||||
Also note that there may be a one-to-many relationship between
|
||||
@code{literal} and @code{lituse}, but not a many-to-one. That is, if
|
||||
there are two code paths that load up the same address and feed the
|
||||
value to a single use, then the use may not use a @code{lituse}
|
||||
relocation.
|
||||
|
||||
@item !lituse_base!@var{N}
|
||||
Used with any memory format instruction (e.g.@: @code{ldl}) to indicate
|
||||
that the literal is used for an address load. The offset field of the
|
||||
instruction must be zero. During relaxation, the code may be altered
|
||||
to use a gp-relative load.
|
||||
|
||||
@item !lituse_jsr!@var{N}
|
||||
Used with a register branch format instruction (e.g.@: @code{jsr}) to
|
||||
indicate that the literal is used for a call. During relaxation, the
|
||||
code may be altered to use a direct branch (e.g.@: @code{bsr}).
|
||||
|
||||
@item !lituse_bytoff!@var{N}
|
||||
Used with a byte mask instruction (e.g.@: @code{extbl}) to indicate
|
||||
that only the low 3 bits of the address are relevant. During relaxation,
|
||||
the code may be altered to use an immediate instead of a register shift.
|
||||
|
||||
@item !lituse_addr!@var{N}
|
||||
Used with any other instruction to indicate that the original address
|
||||
is in fact used, and the original @code{ldq} instruction may not be
|
||||
altered or deleted. This is useful in conjunction with @code{lituse_jsr}
|
||||
to test whether a weak symbol is defined.
|
||||
|
||||
@example
|
||||
ldq $27,foo($29) !literal!1
|
||||
beq $27,is_undef !lituse_addr!1
|
||||
jsr $26,($27),foo !lituse_jsr!1
|
||||
@end example
|
||||
|
||||
@item !gpdisp!@var{N}
|
||||
Used with @code{ldah} and @code{lda} to load the GP from the current
|
||||
address, a-la the @code{ldgp} macro. The source register for the
|
||||
@code{ldah} instruction must contain the address of the @code{ldah}
|
||||
instruction. There must be exactly one @code{lda} instruction paired
|
||||
with the @code{ldah} instruction, though it may appear anywhere in
|
||||
the instruction stream. The immediate operands must be zero.
|
||||
|
||||
@example
|
||||
bsr $26,foo
|
||||
ldah $29,0($26) !gpdisp!1
|
||||
lda $29,0($29) !gpdisp!1
|
||||
@end example
|
||||
|
||||
@item !gprelhigh
|
||||
Used with an @code{ldah} instruction to add the high 16 bits of a
|
||||
32-bit displacement from the GP.
|
||||
|
||||
@item !gprellow
|
||||
Used with any memory format instruction to add the low 16 bits of a
|
||||
32-bit displacement from the GP.
|
||||
|
||||
@item !gprel
|
||||
Used with any memory format instruction to add a 16-bit displacement
|
||||
from the GP.
|
||||
|
||||
@item !samegp
|
||||
Used with any branch format instruction to skip the GP load at the
|
||||
target address. The referenced symbol must have the same GP as the
|
||||
source object file, and it must be declared to either not use @code{$27}
|
||||
or perform a standard GP load in the first two instructions via the
|
||||
@code{.prologue} directive.
|
||||
@end table
|
||||
|
||||
@node Alpha Floating Point
|
||||
@section Floating Point
|
||||
@cindex floating point, Alpha (@sc{ieee})
|
||||
@cindex Alpha floating point (@sc{ieee})
|
||||
The Alpha family uses both @sc{ieee} and VAX floating-point numbers.
|
||||
|
||||
@node Alpha Directives
|
||||
@section Alpha Assembler Directives
|
||||
|
||||
@command{@value{AS}} for the Alpha supports many additional directives for
|
||||
compatibility with the native assembler. This section describes them only
|
||||
briefly.
|
||||
|
||||
@cindex Alpha-only directives
|
||||
These are the additional directives in @code{@value{AS}} for the Alpha:
|
||||
|
||||
@table @code
|
||||
@item .arch @var{cpu}
|
||||
Specifies the target processor. This is equivalent to the
|
||||
@option{-m@var{cpu}} command-line option. @xref{Alpha Options, Options},
|
||||
for a list of values for @var{cpu}.
|
||||
|
||||
@item .ent @var{function}[, @var{n}]
|
||||
Mark the beginning of @var{function}. An optional number may follow for
|
||||
compatibility with the OSF/1 assembler, but is ignored. When generating
|
||||
@code{.mdebug} information, this will create a procedure descriptor for
|
||||
the function. In ELF, it will mark the symbol as a function a-la the
|
||||
generic @code{.type} directive.
|
||||
|
||||
@item .end @var{function}
|
||||
Mark the end of @var{function}. In ELF, it will set the size of the symbol
|
||||
a-la the generic @code{.size} directive.
|
||||
|
||||
@item .mask @var{mask}, @var{offset}
|
||||
Indicate which of the integer registers are saved in the current
|
||||
function's stack frame. @var{mask} is interpreted a bit mask in which
|
||||
bit @var{n} set indicates that register @var{n} is saved. The registers
|
||||
are saved in a block located @var{offset} bytes from the @dfn{canonical
|
||||
frame address} (CFA) which is the value of the stack pointer on entry to
|
||||
the function. The registers are saved sequentially, except that the
|
||||
return address register (normally @code{$26}) is saved first.
|
||||
|
||||
This and the other directives that describe the stack frame are
|
||||
currently only used when generating @code{.mdebug} information. They
|
||||
may in the future be used to generate DWARF2 @code{.debug_frame} unwind
|
||||
information for hand written assembly.
|
||||
|
||||
@item .fmask @var{mask}, @var{offset}
|
||||
Indicate which of the floating-point registers are saved in the current
|
||||
stack frame. The @var{mask} and @var{offset} parameters are interpreted
|
||||
as with @code{.mask}.
|
||||
|
||||
@item .frame @var{framereg}, @var{frameoffset}, @var{retreg}[, @var{argoffset}]
|
||||
Describes the shape of the stack frame. The frame pointer in use is
|
||||
@var{framereg}; normally this is either @code{$fp} or @code{$sp}. The
|
||||
frame pointer is @var{frameoffset} bytes below the CFA. The return
|
||||
address is initially located in @var{retreg} until it is saved as
|
||||
indicated in @code{.mask}. For compatibility with OSF/1 an optional
|
||||
@var{argoffset} parameter is accepted and ignored. It is believed to
|
||||
indicate the offset from the CFA to the saved argument registers.
|
||||
|
||||
@item .prologue @var{n}
|
||||
Indicate that the stack frame is set up and all registers have been
|
||||
spilled. The argument @var{n} indicates whether and how the function
|
||||
uses the incoming @dfn{procedure vector} (the address of the called
|
||||
function) in @code{$27}. 0 indicates that @code{$27} is not used; 1
|
||||
indicates that the first two instructions of the function use @code{$27}
|
||||
to perform a load of the GP register; 2 indicates that @code{$27} is
|
||||
used in some non-standard way and so the linker cannot elide the load of
|
||||
the procedure vector during relaxation.
|
||||
|
||||
@item .gprel32 @var{expression}
|
||||
Computes the difference between the address in @var{expression} and the
|
||||
GP for the current object file, and stores it in 4 bytes. In addition
|
||||
to being smaller than a full 8 byte address, this also does not require
|
||||
a dynamic relocation when used in a shared library.
|
||||
|
||||
@item .t_floating @var{expression}
|
||||
Stores @var{expression} as an @sc{ieee} double precision value.
|
||||
|
||||
@item .s_floating @var{expression}
|
||||
Stores @var{expression} as an @sc{ieee} single precision value.
|
||||
|
||||
@item .f_floating @var{expression}
|
||||
Stores @var{expression} as a VAX F format value.
|
||||
|
||||
@item .g_floating @var{expression}
|
||||
Stores @var{expression} as a VAX G format value.
|
||||
|
||||
@item .d_floating @var{expression}
|
||||
Stores @var{expression} as a VAX D format value.
|
||||
|
||||
@item .set @var{feature}
|
||||
Enables or disables various assembler features. Using the positive
|
||||
name of the feature enables while using @samp{no@var{feature}} disables.
|
||||
|
||||
@table @code
|
||||
@item at
|
||||
Indicates that macro expansions may clobber the @dfn{assembler
|
||||
temporary} (@code{$at} or @code{$28}) register. Some macros may not be
|
||||
expanded without this and will generate an error message if @code{noat}
|
||||
is in effect. When @code{at} is in effect, a warning will be generated
|
||||
if @code{$at} is used by the programmer.
|
||||
|
||||
@item macro
|
||||
Enables the expasion of macro instructions. Note that variants of real
|
||||
instructions, such as @code{br label} vs @code{br $31,label} are
|
||||
considered alternate forms and not macros.
|
||||
|
||||
@item move
|
||||
@itemx reorder
|
||||
@itemx volatile
|
||||
These control whether and how the assembler may re-order instructions.
|
||||
Accepted for compatibility with the OSF/1 assembler, but @command{@value{AS}}
|
||||
does not do instruction scheduling, so these features are ignored.
|
||||
@end table
|
||||
@end table
|
||||
|
||||
The following directives are recognized for compatibility with the OSF/1
|
||||
assembler but are ignored.
|
||||
|
||||
@example
|
||||
.proc .aproc
|
||||
.reguse .livereg
|
||||
.option .aent
|
||||
.ugen .eflag
|
||||
.alias .noalias
|
||||
@end example
|
||||
|
||||
@node Alpha Opcodes
|
||||
@section Opcodes
|
||||
For detailed information on the Alpha machine instruction set, see the
|
||||
@c Attempt to work around a very overfull hbox.
|
||||
@iftex
|
||||
Alpha Architecture Handbook located at
|
||||
@smallfonts
|
||||
@example
|
||||
ftp://ftp.digital.com/pub/Digital/info/semiconductor/literature/alphaahb.pdf
|
||||
@end example
|
||||
@textfonts
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@uref{ftp://ftp.digital.com/pub/Digital/info/semiconductor/literature/alphaahb.pdf,Alpha Architecture Handbook}.
|
||||
@end ifnottex
|
||||
@@ -1,207 +0,0 @@
|
||||
@c Copyright 2000, 2001 Free Software Foundation, Inc.
|
||||
@c This is part of the GAS manual.
|
||||
@c For copying conditions, see the file as.texinfo.
|
||||
|
||||
@ifset GENERIC
|
||||
@page
|
||||
@node ARC-Dependent
|
||||
@chapter ARC Dependent Features
|
||||
@end ifset
|
||||
|
||||
@ifclear GENERIC
|
||||
@node Machine Dependencies
|
||||
@chapter ARC Dependent Features
|
||||
@end ifclear
|
||||
|
||||
@set ARC_CORE_DEFAULT 6
|
||||
|
||||
@cindex ARC support
|
||||
@menu
|
||||
* ARC Options:: Options
|
||||
* ARC Syntax:: Syntax
|
||||
* ARC Floating Point:: Floating Point
|
||||
* ARC Directives:: ARC Machine Directives
|
||||
* ARC Opcodes:: Opcodes
|
||||
@end menu
|
||||
|
||||
|
||||
@node ARC Options
|
||||
@section Options
|
||||
@cindex ARC options (none)
|
||||
@cindex options for ARC (none)
|
||||
|
||||
@table @code
|
||||
|
||||
@cindex @code{-marc[5|6|7|8]} command line option, ARC
|
||||
@item -marc[5|6|7|8]
|
||||
This option selects the core processor variant. Using
|
||||
@code{-marc} is the same as @code{-marc@value{ARC_CORE_DEFAULT}}, which
|
||||
is also the default.
|
||||
|
||||
@table @code
|
||||
|
||||
@cindex @code{arc5} arc5, ARC
|
||||
@item arc5
|
||||
Base instruction set.
|
||||
|
||||
@cindex @code{arc6} arc6, ARC
|
||||
@item arc6
|
||||
Jump-and-link (jl) instruction. No requirement of an instruction between
|
||||
setting flags and conditional jump. For example:
|
||||
|
||||
@smallexample
|
||||
mov.f r0,r1
|
||||
beq foo
|
||||
@end smallexample
|
||||
|
||||
@cindex @code{arc7} arc7, ARC
|
||||
@item arc7
|
||||
Break (brk) and sleep (sleep) instructions.
|
||||
|
||||
@cindex @code{arc8} arc8, ARC
|
||||
@item arc8
|
||||
Software interrupt (swi) instruction.
|
||||
|
||||
@end table
|
||||
|
||||
Note: the @code{.option} directive can to be used to select a core
|
||||
variant from within assembly code.
|
||||
|
||||
@cindex @code{-EB} command line option, ARC
|
||||
@item -EB
|
||||
This option specifies that the output generated by the assembler should
|
||||
be marked as being encoded for a big-endian processor.
|
||||
|
||||
@cindex @code{-EL} command line option, ARC
|
||||
@item -EL
|
||||
This option specifies that the output generated by the assembler should
|
||||
be marked as being encoded for a little-endian processor - this is the
|
||||
default.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@node ARC Syntax
|
||||
@section Syntax
|
||||
@menu
|
||||
* ARC-Chars:: Special Characters
|
||||
* ARC-Regs:: Register Names
|
||||
@end menu
|
||||
|
||||
@node ARC-Chars
|
||||
@subsection Special Characters
|
||||
|
||||
@cindex ARC special characters
|
||||
@cindex special characters, ARC
|
||||
*TODO*
|
||||
|
||||
@node ARC-Regs
|
||||
@subsection Register Names
|
||||
|
||||
@cindex ARC register names
|
||||
@cindex register names, ARC
|
||||
*TODO*
|
||||
|
||||
|
||||
@node ARC Floating Point
|
||||
@section Floating Point
|
||||
|
||||
@cindex floating point, ARC (@sc{ieee})
|
||||
@cindex ARC floating point (@sc{ieee})
|
||||
The ARC core does not currently have hardware floating point
|
||||
support. Software floating point support is provided by @code{GCC}
|
||||
and uses @sc{ieee} floating-point numbers.
|
||||
|
||||
|
||||
@node ARC Directives
|
||||
@section ARC Machine Directives
|
||||
|
||||
@cindex machine directives, ARC
|
||||
@cindex ARC machine directives
|
||||
The ARC version of @code{@value{AS}} supports the following additional
|
||||
machine directives:
|
||||
|
||||
@table @code
|
||||
|
||||
@cindex @code{2byte} directive, ARC
|
||||
@item .2byte @var{expressions}
|
||||
*TODO*
|
||||
|
||||
@cindex @code{3byte} directive, ARC
|
||||
@item .3byte @var{expressions}
|
||||
*TODO*
|
||||
|
||||
@cindex @code{4byte} directive, ARC
|
||||
@item .4byte @var{expressions}
|
||||
*TODO*
|
||||
|
||||
@cindex @code{extAuxRegister} directive, ARC
|
||||
@item .extAuxRegister @var{name},@var{address},@var{mode}
|
||||
*TODO*
|
||||
|
||||
@smallexample
|
||||
.extAuxRegister mulhi,0x12,w
|
||||
@end smallexample
|
||||
|
||||
@cindex @code{extCondCode} directive, ARC
|
||||
@item .extCondCode @var{suffix},@var{value}
|
||||
*TODO*
|
||||
|
||||
@smallexample
|
||||
.extCondCode is_busy,0x14
|
||||
@end smallexample
|
||||
|
||||
@cindex @code{extCoreRegister} directive, ARC
|
||||
@item .extCoreRegister @var{name},@var{regnum},@var{mode},@var{shortcut}
|
||||
*TODO*
|
||||
|
||||
@smallexample
|
||||
.extCoreRegister mlo,57,r,can_shortcut
|
||||
@end smallexample
|
||||
|
||||
@cindex @code{extInstruction} directive, ARC
|
||||
@item .extInstruction @var{name},@var{opcode},@var{subopcode},@var{suffixclass},@var{syntaxclass}
|
||||
*TODO*
|
||||
|
||||
@smallexample
|
||||
.extInstruction mul64,0x14,0x0,SUFFIX_COND,SYNTAX_3OP|OP1_MUST_BE_IMM
|
||||
@end smallexample
|
||||
|
||||
@cindex @code{half} directive, ARC
|
||||
@item .half @var{expressions}
|
||||
*TODO*
|
||||
|
||||
@cindex @code{long} directive, ARC
|
||||
@item .long @var{expressions}
|
||||
*TODO*
|
||||
|
||||
@cindex @code{option} directive, ARC
|
||||
@item .option @var{arc|arc5|arc6|arc7|arc8}
|
||||
The @code{.option} directive must be followed by the desired core
|
||||
version. Again @code{arc} is an alias for
|
||||
@code{arc@value{ARC_CORE_DEFAULT}}.
|
||||
|
||||
Note: the @code{.option} directive overrides the command line option
|
||||
@code{-marc}; a warning is emitted when the version is not consistent
|
||||
between the two - even for the implicit default core version
|
||||
(arc@value{ARC_CORE_DEFAULT}).
|
||||
|
||||
@cindex @code{short} directive, ARC
|
||||
@item .short @var{expressions}
|
||||
*TODO*
|
||||
|
||||
@cindex @code{word} directive, ARC
|
||||
@item .word @var{expressions}
|
||||
*TODO*
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@node ARC Opcodes
|
||||
@section Opcodes
|
||||
|
||||
@cindex ARC opcodes
|
||||
@cindex opcodes for ARC
|
||||
|
||||
For information on the ARC instruction set, see @cite{ARC Programmers
|
||||
Reference Manual}, ARC Cores Ltd.
|
||||
@@ -1,104 +0,0 @@
|
||||
@c Copyright 2001, 2002
|
||||
@c Free Software Foundation, Inc.
|
||||
@c This is part of the GAS manual.
|
||||
@c For copying conditions, see the file as.texinfo.
|
||||
@ifset GENERIC
|
||||
@page
|
||||
@node PPC-Dependent
|
||||
@chapter PowerPC Dependent Features
|
||||
@end ifset
|
||||
@ifclear GENERIC
|
||||
@node Machine Dependencies
|
||||
@chapter PowerPC Dependent Features
|
||||
@end ifclear
|
||||
|
||||
@cindex PowerPC support
|
||||
@menu
|
||||
* PowerPC-Opts:: Options
|
||||
@end menu
|
||||
|
||||
@node PowerPC-Opts
|
||||
@section Options
|
||||
|
||||
@cindex options for PowerPC
|
||||
@cindex PowerPC options
|
||||
@cindex architectures, PowerPC
|
||||
@cindex PowerPC architectures
|
||||
The PowerPC chip family includes several successive levels, using the same
|
||||
core instruction set, but including a few additional instructions at
|
||||
each level. There are exceptions to this however. For details on what
|
||||
instructions each variant supports, please see the chip's architecture
|
||||
reference manual.
|
||||
|
||||
The following table lists all available PowerPC options.
|
||||
|
||||
@table @code
|
||||
@item -mpwrx | -mpwr2
|
||||
Generate code for POWER/2 (RIOS2).
|
||||
|
||||
@item -mpwr
|
||||
Generate code for POWER (RIOS1)
|
||||
|
||||
@item -m601
|
||||
Generate code for PowerPC 601.
|
||||
|
||||
@item -mppc, -mppc32, -m603, -m604
|
||||
Generate code for PowerPC 603/604.
|
||||
|
||||
@item -m403, -m405
|
||||
Generate code for PowerPC 403/405.
|
||||
|
||||
@item -m7400, -m7410, -m7450, -m7455
|
||||
Generate code for PowerPC 7400/7410/7450/7455.
|
||||
|
||||
@item -mppc64, -m620
|
||||
Generate code for PowerPC 620/625/630.
|
||||
|
||||
@item -mppc64bridge
|
||||
Generate code for PowerPC 64, including bridge insns.
|
||||
|
||||
@item -mbooke64
|
||||
Generate code for 64-bit BookE.
|
||||
|
||||
@item -mbooke, mbooke32
|
||||
Generate code for 32-bit BookE.
|
||||
|
||||
@item -maltivec
|
||||
Generate code for processors with AltiVec instructions.
|
||||
|
||||
@item -mpower4
|
||||
Generate code for Power4 architecture.
|
||||
|
||||
@item -mcom
|
||||
Generate code Power/PowerPC common instructions.
|
||||
|
||||
@item -many
|
||||
Generate code for any architecture (PWR/PWRX/PPC).
|
||||
|
||||
@item -mregnames
|
||||
Allow symbolic names for registers.
|
||||
|
||||
@item -mno-regnames
|
||||
Do not allow symbolic names for registers.
|
||||
|
||||
@item -mrelocatable
|
||||
Support for GCC's -mrelocatble option.
|
||||
|
||||
@item -mrelocatable-lib
|
||||
Support for GCC's -mrelocatble-lib option.
|
||||
|
||||
@item -memb
|
||||
Set PPC_EMB bit in ELF flags.
|
||||
|
||||
@item -mlittle, -mlittle-endian
|
||||
Generate code for a little endian machine.
|
||||
|
||||
@item -mbig, -mbig-endian
|
||||
Generate code for a big endian machine.
|
||||
|
||||
@item -msolaris
|
||||
Generate code for Solaris.
|
||||
|
||||
@item -mno-solaris
|
||||
Do not generate code for Solaris.
|
||||
@end table
|
||||
@@ -1,254 +0,0 @@
|
||||
/* external.h -- External COFF structures
|
||||
|
||||
Copyright 2001 Free Software Foundation, Inc.
|
||||
|
||||
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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef COFF_EXTERNAL_H
|
||||
#define COFF_EXTERNAL_H
|
||||
|
||||
#ifndef DO_NOT_DEFINE_FILHDR
|
||||
/********************** FILE HEADER **********************/
|
||||
|
||||
struct external_filehdr
|
||||
{
|
||||
char f_magic[2]; /* magic number */
|
||||
char f_nscns[2]; /* number of sections */
|
||||
char f_timdat[4]; /* time & date stamp */
|
||||
char f_symptr[4]; /* file pointer to symtab */
|
||||
char f_nsyms[4]; /* number of symtab entries */
|
||||
char f_opthdr[2]; /* sizeof(optional hdr) */
|
||||
char f_flags[2]; /* flags */
|
||||
};
|
||||
|
||||
#define FILHDR struct external_filehdr
|
||||
#define FILHSZ 20
|
||||
#endif
|
||||
|
||||
#ifndef DO_NOT_DEFINE_AOUTHDR
|
||||
/********************** AOUT "OPTIONAL HEADER" **********************/
|
||||
|
||||
typedef struct external_aouthdr
|
||||
{
|
||||
char magic[2]; /* type of file */
|
||||
char vstamp[2]; /* version stamp */
|
||||
char tsize[4]; /* text size in bytes, padded to FW bdry*/
|
||||
char dsize[4]; /* initialized data " " */
|
||||
char bsize[4]; /* uninitialized data " " */
|
||||
char entry[4]; /* entry pt. */
|
||||
char text_start[4]; /* base of text used for this file */
|
||||
char data_start[4]; /* base of data used for this file */
|
||||
}
|
||||
AOUTHDR;
|
||||
|
||||
#define AOUTHDRSZ 28
|
||||
#define AOUTSZ 28
|
||||
#endif
|
||||
|
||||
#ifndef DO_NOT_DEFINE_SCNHDR
|
||||
/********************** SECTION HEADER **********************/
|
||||
|
||||
struct external_scnhdr
|
||||
{
|
||||
char s_name[8]; /* section name */
|
||||
char s_paddr[4]; /* physical address, aliased s_nlib */
|
||||
char s_vaddr[4]; /* virtual address */
|
||||
char s_size[4]; /* section size */
|
||||
char s_scnptr[4]; /* file ptr to raw data for section */
|
||||
char s_relptr[4]; /* file ptr to relocation */
|
||||
char s_lnnoptr[4]; /* file ptr to line numbers */
|
||||
char s_nreloc[2]; /* number of relocation entries */
|
||||
char s_nlnno[2]; /* number of line number entries */
|
||||
char s_flags[4]; /* flags */
|
||||
};
|
||||
|
||||
#define SCNHDR struct external_scnhdr
|
||||
#define SCNHSZ 40
|
||||
|
||||
/* Names of "special" sections. */
|
||||
|
||||
#define _TEXT ".text"
|
||||
#define _DATA ".data"
|
||||
#define _BSS ".bss"
|
||||
#define _COMMENT ".comment"
|
||||
#define _LIB ".lib"
|
||||
#endif /* not DO_NOT_DEFINE_SCNHDR */
|
||||
|
||||
#ifndef DO_NOT_DEFINE_LINENO
|
||||
|
||||
/********************** LINE NUMBERS **********************/
|
||||
|
||||
#ifndef L_LNNO_SIZE
|
||||
#error L_LNNO_SIZE needs to be defined
|
||||
#endif
|
||||
|
||||
/* 1 line number entry for every "breakpointable" source line in a section.
|
||||
Line numbers are grouped on a per function basis; first entry in a function
|
||||
grouping will have l_lnno = 0 and in place of physical address will be the
|
||||
symbol table index of the function name. */
|
||||
struct external_lineno
|
||||
{
|
||||
union
|
||||
{
|
||||
char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
|
||||
char l_paddr[4]; /* (physical) address of line number */
|
||||
} l_addr;
|
||||
|
||||
char l_lnno[L_LNNO_SIZE]; /* line number */
|
||||
};
|
||||
|
||||
#define LINENO struct external_lineno
|
||||
#define LINESZ (4 + L_LNNO_SIZE)
|
||||
|
||||
#if L_LNNO_SIZE == 4
|
||||
#define GET_LINENO_LNNO(abfd, ext) H_GET_32 (abfd, (ext->l_lnno))
|
||||
#define PUT_LINENO_LNNO(abfd, val, ext) H_PUT_32 (abfd, val, (ext->l_lnno))
|
||||
#endif
|
||||
#if L_LNNO_SIZE == 2
|
||||
#define GET_LINENO_LNNO(abfd, ext) H_GET_16 (abfd, (ext->l_lnno))
|
||||
#define PUT_LINENO_LNNO(abfd, val, ext) H_PUT_16 (abfd, val, (ext->l_lnno))
|
||||
#endif
|
||||
|
||||
#endif /* not DO_NOT_DEFINE_LINENO */
|
||||
|
||||
#ifndef DO_NOT_DEFINE_SYMENT
|
||||
/********************** SYMBOLS **********************/
|
||||
|
||||
#define E_SYMNMLEN 8 /* # characters in a symbol name */
|
||||
#ifndef E_FILNMLEN
|
||||
#define E_FILNMLEN 14
|
||||
#endif
|
||||
#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
|
||||
|
||||
struct external_syment
|
||||
{
|
||||
union
|
||||
{
|
||||
char e_name[E_SYMNMLEN];
|
||||
|
||||
struct
|
||||
{
|
||||
char e_zeroes[4];
|
||||
char e_offset[4];
|
||||
} e;
|
||||
} e;
|
||||
|
||||
char e_value[4];
|
||||
char e_scnum[2];
|
||||
char e_type[2];
|
||||
char e_sclass[1];
|
||||
char e_numaux[1];
|
||||
};
|
||||
|
||||
#define SYMENT struct external_syment
|
||||
#define SYMESZ 18
|
||||
|
||||
#ifndef N_BTMASK
|
||||
#define N_BTMASK 0xf
|
||||
#endif
|
||||
|
||||
#ifndef N_TMASK
|
||||
#define N_TMASK 0x30
|
||||
#endif
|
||||
|
||||
#ifndef N_BTSHFT
|
||||
#define N_BTSHFT 4
|
||||
#endif
|
||||
|
||||
#ifndef N_TSHIFT
|
||||
#define N_TSHIFT 2
|
||||
#endif
|
||||
|
||||
#endif /* not DO_NOT_DEFINE_SYMENT */
|
||||
|
||||
#ifndef DO_NOT_DEFINE_AUXENT
|
||||
|
||||
union external_auxent
|
||||
{
|
||||
struct
|
||||
{
|
||||
char x_tagndx[4]; /* str, un, or enum tag indx */
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
char x_lnno[2]; /* declaration line number */
|
||||
char x_size[2]; /* str/union/array size */
|
||||
} x_lnsz;
|
||||
|
||||
char x_fsize[4]; /* size of function */
|
||||
|
||||
} x_misc;
|
||||
|
||||
union
|
||||
{
|
||||
struct /* if ISFCN, tag, or .bb */
|
||||
{
|
||||
char x_lnnoptr[4]; /* ptr to fcn line # */
|
||||
char x_endndx[4]; /* entry ndx past block end */
|
||||
} x_fcn;
|
||||
|
||||
struct /* if ISARY, up to 4 dimen. */
|
||||
{
|
||||
char x_dimen[E_DIMNUM][2];
|
||||
} x_ary;
|
||||
|
||||
} x_fcnary;
|
||||
|
||||
char x_tvndx[2]; /* tv index */
|
||||
|
||||
} x_sym;
|
||||
|
||||
union
|
||||
{
|
||||
char x_fname[E_FILNMLEN];
|
||||
|
||||
struct
|
||||
{
|
||||
char x_zeroes[4];
|
||||
char x_offset[4];
|
||||
} x_n;
|
||||
|
||||
} x_file;
|
||||
|
||||
struct
|
||||
{
|
||||
char x_scnlen[4]; /* section length */
|
||||
char x_nreloc[2]; /* # relocation entries */
|
||||
char x_nlinno[2]; /* # line numbers */
|
||||
#ifdef INCLUDE_COMDAT_FIELDS_IN_AUXENT
|
||||
char x_checksum[4]; /* section COMDAT checksum */
|
||||
char x_associated[2]; /* COMDAT associated section index */
|
||||
char x_comdat[1]; /* COMDAT selection number */
|
||||
#endif
|
||||
} x_scn;
|
||||
|
||||
struct
|
||||
{
|
||||
char x_tvfill[4]; /* tv fill value */
|
||||
char x_tvlen[2]; /* length of .tv */
|
||||
char x_tvran[2][2]; /* tv range */
|
||||
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */
|
||||
};
|
||||
|
||||
#define AUXENT union external_auxent
|
||||
#define AUXESZ 18
|
||||
|
||||
#define _ETEXT "etext"
|
||||
|
||||
#endif /* not DO_NOT_DEFINE_AUXENT */
|
||||
|
||||
#endif /* COFF_EXTERNAL_H */
|
||||
@@ -1,96 +0,0 @@
|
||||
/* H8300/h8500 ELF support for BFD.
|
||||
Copyright 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _ELF_H8_H
|
||||
#define _ELF_H8_H
|
||||
|
||||
#include "elf/reloc-macros.h"
|
||||
|
||||
/* Relocations. */
|
||||
/* Relocations 59..63 are GNU extensions. */
|
||||
START_RELOC_NUMBERS (elf_h8_reloc_type)
|
||||
RELOC_NUMBER (R_H8_NONE, 0)
|
||||
RELOC_NUMBER (R_H8_DIR32, 1)
|
||||
RELOC_NUMBER (R_H8_DIR32_28, 2)
|
||||
RELOC_NUMBER (R_H8_DIR32_24, 3)
|
||||
RELOC_NUMBER (R_H8_DIR32_16, 4)
|
||||
RELOC_NUMBER (R_H8_DIR32U, 6)
|
||||
RELOC_NUMBER (R_H8_DIR32U_28, 7)
|
||||
RELOC_NUMBER (R_H8_DIR32U_24, 8)
|
||||
RELOC_NUMBER (R_H8_DIR32U_20, 9)
|
||||
RELOC_NUMBER (R_H8_DIR32U_16, 10)
|
||||
RELOC_NUMBER (R_H8_DIR24, 11)
|
||||
RELOC_NUMBER (R_H8_DIR24_20, 12)
|
||||
RELOC_NUMBER (R_H8_DIR24_16, 13)
|
||||
RELOC_NUMBER (R_H8_DIR24U, 14)
|
||||
RELOC_NUMBER (R_H8_DIR24U_20, 15)
|
||||
RELOC_NUMBER (R_H8_DIR24U_16, 16)
|
||||
RELOC_NUMBER (R_H8_DIR16, 17)
|
||||
RELOC_NUMBER (R_H8_DIR16U, 18)
|
||||
RELOC_NUMBER (R_H8_DIR16S_32, 19)
|
||||
RELOC_NUMBER (R_H8_DIR16S_28, 20)
|
||||
RELOC_NUMBER (R_H8_DIR16S_24, 21)
|
||||
RELOC_NUMBER (R_H8_DIR16S_20, 22)
|
||||
RELOC_NUMBER (R_H8_DIR16S, 23)
|
||||
RELOC_NUMBER (R_H8_DIR8, 24)
|
||||
RELOC_NUMBER (R_H8_DIR8U, 25)
|
||||
RELOC_NUMBER (R_H8_DIR8Z_32, 26)
|
||||
RELOC_NUMBER (R_H8_DIR8Z_28, 27)
|
||||
RELOC_NUMBER (R_H8_DIR8Z_24, 28)
|
||||
RELOC_NUMBER (R_H8_DIR8Z_20, 29)
|
||||
RELOC_NUMBER (R_H8_DIR8Z_16, 30)
|
||||
RELOC_NUMBER (R_H8_PCREL16, 31)
|
||||
RELOC_NUMBER (R_H8_PCREL8, 32)
|
||||
RELOC_NUMBER (R_H8_BPOS, 33)
|
||||
FAKE_RELOC (R_H8_FIRST_INVALID_DIR_RELOC, 34)
|
||||
FAKE_RELOC (R_H8_LAST_INVALID_DIR_RELOC, 58)
|
||||
RELOC_NUMBER (R_H8_DIR16A8, 59)
|
||||
RELOC_NUMBER (R_H8_DIR16R8, 60)
|
||||
RELOC_NUMBER (R_H8_DIR24A8, 61)
|
||||
RELOC_NUMBER (R_H8_DIR24R8, 62)
|
||||
RELOC_NUMBER (R_H8_DIR32A16, 63)
|
||||
RELOC_NUMBER (R_H8_ABS32, 65)
|
||||
RELOC_NUMBER (R_H8_ABS32A16, 127)
|
||||
RELOC_NUMBER (R_H8_SYM, 128)
|
||||
RELOC_NUMBER (R_H8_OPneg, 129)
|
||||
RELOC_NUMBER (R_H8_OPadd, 130)
|
||||
RELOC_NUMBER (R_H8_OPsub, 131)
|
||||
RELOC_NUMBER (R_H8_OPmul, 132)
|
||||
RELOC_NUMBER (R_H8_OPdiv, 133)
|
||||
RELOC_NUMBER (R_H8_OPshla, 134)
|
||||
RELOC_NUMBER (R_H8_OPshra, 135)
|
||||
RELOC_NUMBER (R_H8_OPsctsize, 136)
|
||||
RELOC_NUMBER (R_H8_OPhword, 137)
|
||||
RELOC_NUMBER (R_H8_OPlword, 138)
|
||||
RELOC_NUMBER (R_H8_OPhigh, 139)
|
||||
RELOC_NUMBER (R_H8_OPlow, 140)
|
||||
RELOC_NUMBER (R_H8_OPscttop, 141)
|
||||
END_RELOC_NUMBERS (R_H8_max)
|
||||
|
||||
/* Machine variant if we know it. This field was invented at Cygnus,
|
||||
but it is hoped that other vendors will adopt it. If some standard
|
||||
is developed, this code should be changed to follow it. */
|
||||
|
||||
#define EF_H8_MACH 0x00FF0000
|
||||
|
||||
#define E_H8_MACH_H8300 0x00800000
|
||||
#define E_H8_MACH_H8300H 0x00810000
|
||||
#define E_H8_MACH_H8300S 0x00820000
|
||||
|
||||
#endif
|
||||
@@ -1,168 +0,0 @@
|
||||
/* MMIX support for BFD.
|
||||
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This file holds definitions specific to the MMIX ELF ABI. */
|
||||
#ifndef ELF_MMIX_H
|
||||
#define ELF_MMIX_H
|
||||
|
||||
#include "elf/reloc-macros.h"
|
||||
|
||||
/* Relocations. */
|
||||
START_RELOC_NUMBERS (elf_mmix_reloc_type)
|
||||
RELOC_NUMBER (R_MMIX_NONE, 0)
|
||||
|
||||
/* Standard absolute relocations. */
|
||||
RELOC_NUMBER (R_MMIX_8, 1)
|
||||
RELOC_NUMBER (R_MMIX_16, 2)
|
||||
RELOC_NUMBER (R_MMIX_24, 3)
|
||||
RELOC_NUMBER (R_MMIX_32, 4)
|
||||
RELOC_NUMBER (R_MMIX_64, 5)
|
||||
|
||||
/* Standard relative relocations. */
|
||||
RELOC_NUMBER (R_MMIX_PC_8, 6)
|
||||
RELOC_NUMBER (R_MMIX_PC_16, 7)
|
||||
RELOC_NUMBER (R_MMIX_PC_24, 8)
|
||||
RELOC_NUMBER (R_MMIX_PC_32, 9)
|
||||
RELOC_NUMBER (R_MMIX_PC_64, 10)
|
||||
|
||||
/* GNU extensions for C++ vtables. */
|
||||
RELOC_NUMBER (R_MMIX_GNU_VTINHERIT, 11)
|
||||
RELOC_NUMBER (R_MMIX_GNU_VTENTRY, 12)
|
||||
|
||||
/* A GETA instruction. */
|
||||
RELOC_NUMBER (R_MMIX_GETA, 13)
|
||||
RELOC_NUMBER (R_MMIX_GETA_1, 14)
|
||||
RELOC_NUMBER (R_MMIX_GETA_2, 15)
|
||||
RELOC_NUMBER (R_MMIX_GETA_3, 16)
|
||||
|
||||
/* A conditional branch instruction. */
|
||||
RELOC_NUMBER (R_MMIX_CBRANCH, 17)
|
||||
RELOC_NUMBER (R_MMIX_CBRANCH_J, 18)
|
||||
RELOC_NUMBER (R_MMIX_CBRANCH_1, 19)
|
||||
RELOC_NUMBER (R_MMIX_CBRANCH_2, 20)
|
||||
RELOC_NUMBER (R_MMIX_CBRANCH_3, 21)
|
||||
|
||||
/* A PUSHJ instruction. */
|
||||
RELOC_NUMBER (R_MMIX_PUSHJ, 22)
|
||||
RELOC_NUMBER (R_MMIX_PUSHJ_1, 23)
|
||||
RELOC_NUMBER (R_MMIX_PUSHJ_2, 24)
|
||||
RELOC_NUMBER (R_MMIX_PUSHJ_3, 25)
|
||||
|
||||
/* A JMP instruction. */
|
||||
RELOC_NUMBER (R_MMIX_JMP, 26)
|
||||
RELOC_NUMBER (R_MMIX_JMP_1, 27)
|
||||
RELOC_NUMBER (R_MMIX_JMP_2, 28)
|
||||
RELOC_NUMBER (R_MMIX_JMP_3, 29)
|
||||
|
||||
/* A relative address such as in a GETA or a branch. */
|
||||
RELOC_NUMBER (R_MMIX_ADDR19, 30)
|
||||
|
||||
/* A relative address such as in a JMP (only). */
|
||||
RELOC_NUMBER (R_MMIX_ADDR27, 31)
|
||||
|
||||
/* A general register or a number 0..255. */
|
||||
RELOC_NUMBER (R_MMIX_REG_OR_BYTE, 32)
|
||||
|
||||
/* A general register. */
|
||||
RELOC_NUMBER (R_MMIX_REG, 33)
|
||||
|
||||
/* A global register and an offset, the global register (allocated at
|
||||
link time) contents plus the offset made equivalent to the relocation
|
||||
expression at link time. The relocation must point at the Y field of
|
||||
an instruction. */
|
||||
RELOC_NUMBER (R_MMIX_BASE_PLUS_OFFSET, 34)
|
||||
|
||||
/* A LOCAL assertion. */
|
||||
RELOC_NUMBER (R_MMIX_LOCAL, 35)
|
||||
END_RELOC_NUMBERS (R_MMIX_max)
|
||||
|
||||
|
||||
/* Section Attributes. */
|
||||
/* A section containing necessary information for relaxation. */
|
||||
#define SHF_MMIX_CANRELAX 0x80000000
|
||||
|
||||
/* Symbol attributes. */
|
||||
/* A symbol with this section-index is a register. */
|
||||
#define SHN_REGISTER SHN_LOPROC
|
||||
|
||||
/* This section holds contents for each initialized register, at VMA
|
||||
regno*8. A symbol relative to this section will be transformed to an
|
||||
absolute symbol with the value corresponding to the register number at
|
||||
final link time. A symbol with a value outside the inclusive range
|
||||
32*8 .. 254*8 is an error. It is highly recommended to only use an
|
||||
upper bound of 253*8 or lower as specified in the (currently
|
||||
unspecified) ABI. */
|
||||
#define MMIX_REG_CONTENTS_SECTION_NAME ".MMIX.reg_contents"
|
||||
|
||||
/* At link time, a section by this name is created, expected to be
|
||||
included in MMIX_REG_CONTENTS_SECTION_NAME in the output. */
|
||||
#define MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME \
|
||||
".MMIX.reg_contents.linker_allocated"
|
||||
|
||||
/* This is a faked section holding symbols with SHN_REGISTER. Don't
|
||||
confuse it with MMIX_REG_CONTENTS_SECTION_NAME; this one has no
|
||||
contents, just values. It is an error for a value in this section to
|
||||
be outside the range 32..255 and it must never become an actual section
|
||||
in an object file. */
|
||||
#define MMIX_REG_SECTION_NAME "*REG*"
|
||||
|
||||
/* Appended with a number N=0..65535, this is a representation of the
|
||||
mmixal "BSPEC N" ... "ESPEC" directive pair; the contents go into an
|
||||
ELF section by name ".MMIX.spec_data.N". */
|
||||
#define MMIX_OTHER_SPEC_SECTION_PREFIX ".MMIX.spec_data."
|
||||
|
||||
/* A section SECNAME is noted to start at "__.MMIX.start.SECNAME" by the
|
||||
presence of this symbol. Currently only implemented for ".text"
|
||||
through the symbol "__.MMIX.start..text". */
|
||||
#define MMIX_LOC_SECTION_START_SYMBOL_PREFIX "__.MMIX.start."
|
||||
|
||||
/* This symbol is always a function. */
|
||||
#define MMIX_START_SYMBOL_NAME "Main"
|
||||
|
||||
|
||||
/* We smuggle in a few MMO specifics here. We don't make a specific MMO
|
||||
file, since we can't reasonably support MMO without ELF; we have to
|
||||
include this file anyway. */
|
||||
|
||||
#define MMO_TEXT_SECTION_NAME ".text"
|
||||
#define MMO_DATA_SECTION_NAME ".data"
|
||||
|
||||
/* A definition for the flags we put in spec data in files. A copy of our
|
||||
own of some flags to keep immune to BFD flag changes. See section.c of
|
||||
2001-07-18 for flag documentation. */
|
||||
#define MMO_SEC_ALLOC 0x001
|
||||
#define MMO_SEC_LOAD 0x002
|
||||
#define MMO_SEC_RELOC 0x004
|
||||
#define MMO_SEC_READONLY 0x010
|
||||
#define MMO_SEC_CODE 0x020
|
||||
#define MMO_SEC_DATA 0x040
|
||||
#define MMO_SEC_NEVER_LOAD 0x400
|
||||
#define MMO_SEC_IS_COMMON 0x8000
|
||||
#define MMO_SEC_DEBUGGING 0x10000
|
||||
|
||||
#ifdef BFD_ARCH_SIZE
|
||||
extern boolean _bfd_mmix_prepare_linker_allocated_gregs
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean _bfd_mmix_finalize_linker_allocated_gregs
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean _bfd_mmix_check_all_relocs
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
#endif
|
||||
|
||||
#endif /* ELF_MMIX_H */
|
||||
@@ -1,39 +0,0 @@
|
||||
/* OpenRISC ELF support for BFD.
|
||||
Copyright 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _ELF_OPENRISC_H
|
||||
#define _ELF_OPENRISC_H
|
||||
|
||||
#include "elf/reloc-macros.h"
|
||||
|
||||
/* Relocations. */
|
||||
START_RELOC_NUMBERS (elf_openrisc_reloc_type)
|
||||
RELOC_NUMBER (R_OPENRISC_NONE, 0)
|
||||
RELOC_NUMBER (R_OPENRISC_INSN_REL_26, 1)
|
||||
RELOC_NUMBER (R_OPENRISC_INSN_ABS_26, 2)
|
||||
RELOC_NUMBER (R_OPENRISC_LO_16_IN_INSN, 3)
|
||||
RELOC_NUMBER (R_OPENRISC_HI_16_IN_INSN, 4)
|
||||
RELOC_NUMBER (R_OPENRISC_8, 5)
|
||||
RELOC_NUMBER (R_OPENRISC_16, 6)
|
||||
RELOC_NUMBER (R_OPENRISC_32, 7)
|
||||
RELOC_NUMBER (R_OPENRISC_GNU_VTINHERIT, 8)
|
||||
RELOC_NUMBER (R_OPENRISC_GNU_VTENTRY, 9)
|
||||
END_RELOC_NUMBERS (R_OPENRISC_max)
|
||||
|
||||
#endif /* _ELF_OPENRISC_H */
|
||||
@@ -1,62 +0,0 @@
|
||||
/* OR1K ELF support for BFD. Derived from ppc.h.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Ivan Guzvinec <[email protected]>
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _ELF_OR1K_H
|
||||
#define _ELF_OR1K_H
|
||||
|
||||
#include "elf/reloc-macros.h"
|
||||
|
||||
/* Relocations. */
|
||||
START_RELOC_NUMBERS (elf_or32_reloc_type)
|
||||
RELOC_NUMBER (R_OR32_NONE, 0)
|
||||
RELOC_NUMBER (R_OR32_32, 1)
|
||||
RELOC_NUMBER (R_OR32_16, 2)
|
||||
RELOC_NUMBER (R_OR32_8, 3)
|
||||
RELOC_NUMBER (R_OR32_CONST, 4)
|
||||
RELOC_NUMBER (R_OR32_CONSTH, 5)
|
||||
RELOC_NUMBER (R_OR32_JUMPTARG, 6)
|
||||
RELOC_NUMBER (R_OR32_GNU_VTENTRY, 7)
|
||||
RELOC_NUMBER (R_OR32_GNU_VTINHERIT, 8)
|
||||
END_RELOC_NUMBERS (R_OR32_max)
|
||||
|
||||
/* Four bit OR32 machine type field. */
|
||||
#define EF_OR32_MACH 0x0000000f
|
||||
|
||||
/* Various CPU types. */
|
||||
#define E_OR32_MACH_BASE 0x00000000
|
||||
#define E_OR32_MACH_UNUSED1 0x00000001
|
||||
#define E_OR32_MACH_UNUSED2 0x00000002
|
||||
#define E_OR32_MACH_UNUSED4 0x00000003
|
||||
|
||||
/* Processor specific section headers, sh_type field */
|
||||
#define SHT_ORDERED SHT_HIPROC /* Link editor is to sort the \
|
||||
entries in this section \
|
||||
based on the address \
|
||||
specified in the associated \
|
||||
symbol table entry. */
|
||||
|
||||
/* Processor specific section flags, sh_flags field */
|
||||
#define SHF_EXCLUDE 0x80000000 /* Link editor is to exclude \
|
||||
this section from executable \
|
||||
and shared objects that it \
|
||||
builds when those objects \
|
||||
are not to be furhter \
|
||||
relocated. */
|
||||
#endif /* _ELF_OR1K_H */
|
||||
@@ -1,73 +0,0 @@
|
||||
/* 390 ELF support for BFD.
|
||||
Copyright 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Carl B. Pedersen and Martin Schwidefsky.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifndef _ELF_390_H
|
||||
#define _ELF_390_H
|
||||
|
||||
/* Processor specific flags for the ELF header e_flags field. */
|
||||
|
||||
/* Symbol types. */
|
||||
|
||||
#define STACK_REG 15 /* Global Stack reg */
|
||||
#define BACKL_REG 14 /* Global Backlink reg */
|
||||
#define BASE_REG 13 /* Global Base reg */
|
||||
#define GOT_REG 12 /* Holds addr of GOT */
|
||||
|
||||
#include "elf/reloc-macros.h"
|
||||
|
||||
/* Relocation types. */
|
||||
|
||||
START_RELOC_NUMBERS (elf_s390_reloc_type)
|
||||
RELOC_NUMBER (R_390_NONE, 0) /* No reloc. */
|
||||
RELOC_NUMBER (R_390_8, 1) /* Direct 8 bit. */
|
||||
RELOC_NUMBER (R_390_12, 2) /* Direct 12 bit. */
|
||||
RELOC_NUMBER (R_390_16, 3) /* Direct 16 bit. */
|
||||
RELOC_NUMBER (R_390_32, 4) /* Direct 32 bit. */
|
||||
RELOC_NUMBER (R_390_PC32, 5) /* PC relative 32 bit. */
|
||||
RELOC_NUMBER (R_390_GOT12, 6) /* 12 bit GOT offset. */
|
||||
RELOC_NUMBER (R_390_GOT32, 7) /* 32 bit GOT offset. */
|
||||
RELOC_NUMBER (R_390_PLT32, 8) /* 32 bit PC relative PLT address. */
|
||||
RELOC_NUMBER (R_390_COPY, 9) /* Copy symbol at runtime. */
|
||||
RELOC_NUMBER (R_390_GLOB_DAT, 10) /* Create GOT entry. */
|
||||
RELOC_NUMBER (R_390_JMP_SLOT, 11) /* Create PLT entry. */
|
||||
RELOC_NUMBER (R_390_RELATIVE, 12) /* Adjust by program base. */
|
||||
RELOC_NUMBER (R_390_GOTOFF, 13) /* 32 bit offset to GOT. */
|
||||
RELOC_NUMBER (R_390_GOTPC, 14) /* 32 bit PC relative offset to GOT. */
|
||||
RELOC_NUMBER (R_390_GOT16, 15) /* 16 bit GOT offset. */
|
||||
RELOC_NUMBER (R_390_PC16, 16) /* PC relative 16 bit. */
|
||||
RELOC_NUMBER (R_390_PC16DBL, 17) /* PC relative 16 bit shifted by 1. */
|
||||
RELOC_NUMBER (R_390_PLT16DBL, 18) /* 16 bit PC rel. PLT shifted by 1. */
|
||||
RELOC_NUMBER (R_390_PC32DBL, 19) /* PC relative 32 bit shifted by 1. */
|
||||
RELOC_NUMBER (R_390_PLT32DBL, 20) /* 32 bit PC rel. PLT shifted by 1. */
|
||||
RELOC_NUMBER (R_390_GOTPCDBL, 21) /* 32 bit PC rel. GOT shifted by 1. */
|
||||
RELOC_NUMBER (R_390_64, 22) /* Direct 64 bit. */
|
||||
RELOC_NUMBER (R_390_PC64, 23) /* PC relative 64 bit. */
|
||||
RELOC_NUMBER (R_390_GOT64, 24) /* 64 bit GOT offset. */
|
||||
RELOC_NUMBER (R_390_PLT64, 25) /* 64 bit PC relative PLT address. */
|
||||
RELOC_NUMBER (R_390_GOTENT, 26) /* 32 bit PC rel. to GOT entry >> 1. */
|
||||
/* These are GNU extensions to enable C++ vtable garbage collection. */
|
||||
RELOC_NUMBER (R_390_GNU_VTINHERIT, 250)
|
||||
RELOC_NUMBER (R_390_GNU_VTENTRY, 251)
|
||||
END_RELOC_NUMBERS (R_390_max)
|
||||
|
||||
#endif /* _ELF_390_H */
|
||||
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/* XSTORMY16 ELF support for BFD.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _ELF_XSTORMY16_H
|
||||
#define _ELF_XSTORMY16_H
|
||||
|
||||
#include "elf/reloc-macros.h"
|
||||
|
||||
/* Relocations. */
|
||||
START_RELOC_NUMBERS (elf_xstormy16_reloc_type)
|
||||
RELOC_NUMBER (R_XSTORMY16_NONE, 0)
|
||||
|
||||
RELOC_NUMBER (R_XSTORMY16_32, 1)
|
||||
RELOC_NUMBER (R_XSTORMY16_16, 2)
|
||||
RELOC_NUMBER (R_XSTORMY16_8, 3)
|
||||
RELOC_NUMBER (R_XSTORMY16_PC32, 4)
|
||||
RELOC_NUMBER (R_XSTORMY16_PC16, 5)
|
||||
RELOC_NUMBER (R_XSTORMY16_PC8, 6)
|
||||
|
||||
RELOC_NUMBER (R_XSTORMY16_REL_12, 7)
|
||||
RELOC_NUMBER (R_XSTORMY16_24, 8)
|
||||
RELOC_NUMBER (R_XSTORMY16_FPTR16, 9)
|
||||
|
||||
RELOC_NUMBER (R_XSTORMY16_GNU_VTINHERIT, 128)
|
||||
RELOC_NUMBER (R_XSTORMY16_GNU_VTENTRY, 129)
|
||||
END_RELOC_NUMBERS (R_XSTORMY16_max)
|
||||
|
||||
/* Define the data & instruction memory discriminator. In a linked
|
||||
executable, an symbol should be deemed to point to an instruction
|
||||
if ((address & XSTORMY16_INSN_MASK) == XSTORMY16_INSN_VALUE), and similarly
|
||||
for the data space. See also `ld/emulparams/elf32xstormy16.sh'. */
|
||||
#define XSTORMY16_DATA_MASK 0xffc00000
|
||||
#define XSTORMY16_DATA_VALUE 0x00000000
|
||||
#define XSTORMY16_INSN_MASK 0xffc00000
|
||||
#define XSTORMY16_INSN_VALUE 0x00400000
|
||||
|
||||
#endif /* _ELF_XSTORMY16_H */
|
||||
@@ -1,81 +0,0 @@
|
||||
/* A Fibonacci heap datatype.
|
||||
Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Daniel Berlin ([email protected]).
|
||||
|
||||
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. */
|
||||
|
||||
/* Fibonacci heaps are somewhat complex, but, there's an article in
|
||||
DDJ that explains them pretty well:
|
||||
|
||||
http://www.ddj.com/articles/1997/9701/9701o/9701o.htm?topic=algoritms
|
||||
|
||||
Introduction to algorithms by Corman and Rivest also goes over them.
|
||||
|
||||
The original paper that introduced them is "Fibonacci heaps and their
|
||||
uses in improved network optimization algorithms" by Tarjan and
|
||||
Fredman (JACM 34(3), July 1987).
|
||||
|
||||
Amortized and real worst case time for operations:
|
||||
|
||||
ExtractMin: O(lg n) amortized. O(n) worst case.
|
||||
DecreaseKey: O(1) amortized. O(lg n) worst case.
|
||||
Insert: O(2) amortized. O(1) actual.
|
||||
Union: O(1) amortized. O(1) actual. */
|
||||
|
||||
#ifndef _FIBHEAP_H_
|
||||
#define _FIBHEAP_H_
|
||||
|
||||
#include <ansidecl.h>
|
||||
|
||||
typedef long fibheapkey_t;
|
||||
|
||||
typedef struct fibheap
|
||||
{
|
||||
size_t nodes;
|
||||
struct fibnode *min;
|
||||
struct fibnode *root;
|
||||
} *fibheap_t;
|
||||
|
||||
typedef struct fibnode
|
||||
{
|
||||
struct fibnode *parent;
|
||||
struct fibnode *child;
|
||||
struct fibnode *left;
|
||||
struct fibnode *right;
|
||||
fibheapkey_t key;
|
||||
void *data;
|
||||
unsigned int degree : 31;
|
||||
unsigned int mark : 1;
|
||||
} *fibnode_t;
|
||||
|
||||
extern fibheap_t fibheap_new PARAMS ((void));
|
||||
extern fibnode_t fibheap_insert PARAMS ((fibheap_t, fibheapkey_t, void *));
|
||||
extern int fibheap_empty PARAMS ((fibheap_t));
|
||||
extern fibheapkey_t fibheap_min_key PARAMS ((fibheap_t));
|
||||
extern fibheapkey_t fibheap_replace_key PARAMS ((fibheap_t, fibnode_t,
|
||||
fibheapkey_t));
|
||||
extern void *fibheap_replace_key_data PARAMS ((fibheap_t, fibnode_t,
|
||||
fibheapkey_t, void *));
|
||||
extern void *fibheap_extract_min PARAMS ((fibheap_t));
|
||||
extern void *fibheap_min PARAMS ((fibheap_t));
|
||||
extern void *fibheap_replace_data PARAMS ((fibheap_t, fibnode_t, void *));
|
||||
extern void *fibheap_delete_node PARAMS ((fibheap_t, fibnode_t));
|
||||
extern void fibheap_delete PARAMS ((fibheap_t));
|
||||
extern fibheap_t fibheap_union PARAMS ((fibheap_t, fibheap_t));
|
||||
|
||||
#endif /* _FIBHEAP_H_ */
|
||||
@@ -1,51 +0,0 @@
|
||||
/* ternary.h - Ternary Search Trees
|
||||
Copyright 2001 Free Software Foundation, Inc.
|
||||
|
||||
Contributed by Daniel Berlin ([email protected])
|
||||
|
||||
|
||||
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 TERNARY_H_
|
||||
#define TERNARY_H_
|
||||
/* Ternary search trees */
|
||||
|
||||
typedef struct ternary_node_def *ternary_tree;
|
||||
|
||||
typedef struct ternary_node_def
|
||||
{
|
||||
char splitchar;
|
||||
ternary_tree lokid;
|
||||
ternary_tree eqkid;
|
||||
ternary_tree hikid;
|
||||
}
|
||||
ternary_node;
|
||||
|
||||
/* Insert string S into tree P, associating it with DATA.
|
||||
Return the data in the tree associated with the string if it's
|
||||
already there, and replace is 0.
|
||||
Otherwise, replaces if it it exists, inserts if it doesn't, and
|
||||
returns the data you passed in. */
|
||||
PTR ternary_insert PARAMS ((ternary_tree *p, const char *s,
|
||||
PTR data, int replace));
|
||||
|
||||
/* Delete the ternary search tree rooted at P.
|
||||
Does NOT delete the data you associated with the strings. */
|
||||
void ternary_cleanup PARAMS ((ternary_tree p));
|
||||
|
||||
/* Search the ternary tree for string S, returning the data associated
|
||||
with it if found. */
|
||||
PTR ternary_search PARAMS ((const ternary_node *p, const char *s));
|
||||
#endif
|
||||
@@ -1,28 +0,0 @@
|
||||
/* This file redefines all regex external names before including
|
||||
a renamed copy of glibc's regex.h. */
|
||||
|
||||
#ifndef _XREGEX_H
|
||||
#define _XREGEX_H 1
|
||||
|
||||
# define regfree xregfree
|
||||
# define regexec xregexec
|
||||
# define regcomp xregcomp
|
||||
# define regerror xregerror
|
||||
# define re_set_registers xre_set_registers
|
||||
# define re_match_2 xre_match_2
|
||||
# define re_match xre_match
|
||||
# define re_search xre_search
|
||||
# define re_compile_pattern xre_compile_pattern
|
||||
# define re_set_syntax xre_set_syntax
|
||||
# define re_search_2 xre_search_2
|
||||
# define re_compile_fastmap xre_compile_fastmap
|
||||
# define re_syntax_options xre_syntax_options
|
||||
# define re_max_failures xre_max_failures
|
||||
|
||||
# define _REGEX_RE_COMP
|
||||
# define re_comp xre_comp
|
||||
# define re_exec xre_exec
|
||||
|
||||
#include "xregex2.h"
|
||||
|
||||
#endif /* xregex.h */
|
||||
@@ -1,565 +0,0 @@
|
||||
/* Definitions for data structures and routines for the regular
|
||||
expression library, version 0.12.
|
||||
Copyright (C) 1985,1989-1993,1995-1998, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#ifndef _REGEX_H
|
||||
#define _REGEX_H 1
|
||||
|
||||
/* Allow the use in C++ code. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* POSIX says that <sys/types.h> must be included (by the caller) before
|
||||
<regex.h>. */
|
||||
|
||||
#if !defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE && defined VMS
|
||||
/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
|
||||
should be there. */
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
|
||||
/* The following two types have to be signed and unsigned integer type
|
||||
wide enough to hold a value of a pointer. For most ANSI compilers
|
||||
ptrdiff_t and size_t should be likely OK. Still size of these two
|
||||
types is 2 for Microsoft C. Ugh... */
|
||||
typedef long int s_reg_t;
|
||||
typedef unsigned long int active_reg_t;
|
||||
|
||||
/* The following bits are used to determine the regexp syntax we
|
||||
recognize. The set/not-set meanings are chosen so that Emacs syntax
|
||||
remains the value 0. The bits are given in alphabetical order, and
|
||||
the definitions shifted by one from the previous bit; thus, when we
|
||||
add or remove a bit, only one other definition need change. */
|
||||
typedef unsigned long int reg_syntax_t;
|
||||
|
||||
/* If this bit is not set, then \ inside a bracket expression is literal.
|
||||
If set, then such a \ quotes the following character. */
|
||||
#define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
|
||||
|
||||
/* If this bit is not set, then + and ? are operators, and \+ and \? are
|
||||
literals.
|
||||
If set, then \+ and \? are operators and + and ? are literals. */
|
||||
#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
|
||||
|
||||
/* If this bit is set, then character classes are supported. They are:
|
||||
[:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
|
||||
[:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
|
||||
If not set, then character classes are not supported. */
|
||||
#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
|
||||
|
||||
/* If this bit is set, then ^ and $ are always anchors (outside bracket
|
||||
expressions, of course).
|
||||
If this bit is not set, then it depends:
|
||||
^ is an anchor if it is at the beginning of a regular
|
||||
expression or after an open-group or an alternation operator;
|
||||
$ is an anchor if it is at the end of a regular expression, or
|
||||
before a close-group or an alternation operator.
|
||||
|
||||
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
|
||||
POSIX draft 11.2 says that * etc. in leading positions is undefined.
|
||||
We already implemented a previous draft which made those constructs
|
||||
invalid, though, so we haven't changed the code back. */
|
||||
#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
|
||||
|
||||
/* If this bit is set, then special characters are always special
|
||||
regardless of where they are in the pattern.
|
||||
If this bit is not set, then special characters are special only in
|
||||
some contexts; otherwise they are ordinary. Specifically,
|
||||
* + ? and intervals are only special when not after the beginning,
|
||||
open-group, or alternation operator. */
|
||||
#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
|
||||
|
||||
/* If this bit is set, then *, +, ?, and { cannot be first in an re or
|
||||
immediately after an alternation or begin-group operator. */
|
||||
#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
|
||||
|
||||
/* If this bit is set, then . matches newline.
|
||||
If not set, then it doesn't. */
|
||||
#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
|
||||
|
||||
/* If this bit is set, then . doesn't match NUL.
|
||||
If not set, then it does. */
|
||||
#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
|
||||
|
||||
/* If this bit is set, nonmatching lists [^...] do not match newline.
|
||||
If not set, they do. */
|
||||
#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
|
||||
|
||||
/* If this bit is set, either \{...\} or {...} defines an
|
||||
interval, depending on RE_NO_BK_BRACES.
|
||||
If not set, \{, \}, {, and } are literals. */
|
||||
#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
|
||||
|
||||
/* If this bit is set, +, ? and | aren't recognized as operators.
|
||||
If not set, they are. */
|
||||
#define RE_LIMITED_OPS (RE_INTERVALS << 1)
|
||||
|
||||
/* If this bit is set, newline is an alternation operator.
|
||||
If not set, newline is literal. */
|
||||
#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
|
||||
|
||||
/* If this bit is set, then `{...}' defines an interval, and \{ and \}
|
||||
are literals.
|
||||
If not set, then `\{...\}' defines an interval. */
|
||||
#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
|
||||
|
||||
/* If this bit is set, (...) defines a group, and \( and \) are literals.
|
||||
If not set, \(...\) defines a group, and ( and ) are literals. */
|
||||
#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
|
||||
|
||||
/* If this bit is set, then \<digit> matches <digit>.
|
||||
If not set, then \<digit> is a back-reference. */
|
||||
#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
|
||||
|
||||
/* If this bit is set, then | is an alternation operator, and \| is literal.
|
||||
If not set, then \| is an alternation operator, and | is literal. */
|
||||
#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
|
||||
|
||||
/* If this bit is set, then an ending range point collating higher
|
||||
than the starting range point, as in [z-a], is invalid.
|
||||
If not set, then when ending range point collates higher than the
|
||||
starting range point, the range is ignored. */
|
||||
#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
|
||||
|
||||
/* If this bit is set, then an unmatched ) is ordinary.
|
||||
If not set, then an unmatched ) is invalid. */
|
||||
#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
|
||||
|
||||
/* If this bit is set, succeed as soon as we match the whole pattern,
|
||||
without further backtracking. */
|
||||
#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
|
||||
|
||||
/* If this bit is set, do not process the GNU regex operators.
|
||||
If not set, then the GNU regex operators are recognized. */
|
||||
#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
|
||||
|
||||
/* If this bit is set, turn on internal regex debugging.
|
||||
If not set, and debugging was on, turn it off.
|
||||
This only works if regex.c is compiled -DDEBUG.
|
||||
We define this bit always, so that all that's needed to turn on
|
||||
debugging is to recompile regex.c; the calling code can always have
|
||||
this bit set, and it won't affect anything in the normal case. */
|
||||
#define RE_DEBUG (RE_NO_GNU_OPS << 1)
|
||||
|
||||
/* If this bit is set, a syntactically invalid interval is treated as
|
||||
a string of ordinary characters. For example, the ERE 'a{1' is
|
||||
treated as 'a\{1'. */
|
||||
#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
|
||||
|
||||
/* This global variable defines the particular regexp syntax to use (for
|
||||
some interfaces). When a regexp is compiled, the syntax used is
|
||||
stored in the pattern buffer, so changing this does not affect
|
||||
already-compiled regexps. */
|
||||
extern reg_syntax_t re_syntax_options;
|
||||
|
||||
/* Define combinations of the above bits for the standard possibilities.
|
||||
(The [[[ comments delimit what gets put into the Texinfo file, so
|
||||
don't delete them!) */
|
||||
/* [[[begin syntaxes]]] */
|
||||
#define RE_SYNTAX_EMACS 0
|
||||
|
||||
#define RE_SYNTAX_AWK \
|
||||
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
|
||||
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
|
||||
| RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
|
||||
|
||||
#define RE_SYNTAX_GNU_AWK \
|
||||
((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \
|
||||
& ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS))
|
||||
|
||||
#define RE_SYNTAX_POSIX_AWK \
|
||||
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
|
||||
| RE_INTERVALS | RE_NO_GNU_OPS)
|
||||
|
||||
#define RE_SYNTAX_GREP \
|
||||
(RE_BK_PLUS_QM | RE_CHAR_CLASSES \
|
||||
| RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
|
||||
| RE_NEWLINE_ALT)
|
||||
|
||||
#define RE_SYNTAX_EGREP \
|
||||
(RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
|
||||
| RE_NEWLINE_ALT | RE_NO_BK_PARENS \
|
||||
| RE_NO_BK_VBAR)
|
||||
|
||||
#define RE_SYNTAX_POSIX_EGREP \
|
||||
(RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES \
|
||||
| RE_INVALID_INTERVAL_ORD)
|
||||
|
||||
/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
|
||||
#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
|
||||
|
||||
#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
|
||||
|
||||
/* Syntax bits common to both basic and extended POSIX regex syntax. */
|
||||
#define _RE_SYNTAX_POSIX_COMMON \
|
||||
(RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
|
||||
| RE_INTERVALS | RE_NO_EMPTY_RANGES)
|
||||
|
||||
#define RE_SYNTAX_POSIX_BASIC \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
|
||||
|
||||
/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
|
||||
RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
|
||||
isn't minimal, since other operators, such as \`, aren't disabled. */
|
||||
#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
|
||||
|
||||
#define RE_SYNTAX_POSIX_EXTENDED \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_VBAR \
|
||||
| RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||
|
||||
/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is
|
||||
removed and RE_NO_BK_REFS is added. */
|
||||
#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
|
||||
| RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||
/* [[[end syntaxes]]] */
|
||||
|
||||
/* Maximum number of duplicates an interval can allow. Some systems
|
||||
(erroneously) define this in other header files, but we want our
|
||||
value, so remove any previous define. */
|
||||
#ifdef RE_DUP_MAX
|
||||
# undef RE_DUP_MAX
|
||||
#endif
|
||||
/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */
|
||||
#define RE_DUP_MAX (0x7fff)
|
||||
|
||||
|
||||
/* POSIX `cflags' bits (i.e., information for `regcomp'). */
|
||||
|
||||
/* If this bit is set, then use extended regular expression syntax.
|
||||
If not set, then use basic regular expression syntax. */
|
||||
#define REG_EXTENDED 1
|
||||
|
||||
/* If this bit is set, then ignore case when matching.
|
||||
If not set, then case is significant. */
|
||||
#define REG_ICASE (REG_EXTENDED << 1)
|
||||
|
||||
/* If this bit is set, then anchors do not match at newline
|
||||
characters in the string.
|
||||
If not set, then anchors do match at newlines. */
|
||||
#define REG_NEWLINE (REG_ICASE << 1)
|
||||
|
||||
/* If this bit is set, then report only success or fail in regexec.
|
||||
If not set, then returns differ between not matching and errors. */
|
||||
#define REG_NOSUB (REG_NEWLINE << 1)
|
||||
|
||||
|
||||
/* POSIX `eflags' bits (i.e., information for regexec). */
|
||||
|
||||
/* If this bit is set, then the beginning-of-line operator doesn't match
|
||||
the beginning of the string (presumably because it's not the
|
||||
beginning of a line).
|
||||
If not set, then the beginning-of-line operator does match the
|
||||
beginning of the string. */
|
||||
#define REG_NOTBOL 1
|
||||
|
||||
/* Like REG_NOTBOL, except for the end-of-line. */
|
||||
#define REG_NOTEOL (1 << 1)
|
||||
|
||||
|
||||
/* If any error codes are removed, changed, or added, update the
|
||||
`re_error_msg' table in regex.c. */
|
||||
typedef enum
|
||||
{
|
||||
#ifdef _XOPEN_SOURCE
|
||||
REG_ENOSYS = -1, /* This will never happen for this implementation. */
|
||||
#endif
|
||||
|
||||
REG_NOERROR = 0, /* Success. */
|
||||
REG_NOMATCH, /* Didn't find a match (for regexec). */
|
||||
|
||||
/* POSIX regcomp return error codes. (In the order listed in the
|
||||
standard.) */
|
||||
REG_BADPAT, /* Invalid pattern. */
|
||||
REG_ECOLLATE, /* Not implemented. */
|
||||
REG_ECTYPE, /* Invalid character class name. */
|
||||
REG_EESCAPE, /* Trailing backslash. */
|
||||
REG_ESUBREG, /* Invalid back reference. */
|
||||
REG_EBRACK, /* Unmatched left bracket. */
|
||||
REG_EPAREN, /* Parenthesis imbalance. */
|
||||
REG_EBRACE, /* Unmatched \{. */
|
||||
REG_BADBR, /* Invalid contents of \{\}. */
|
||||
REG_ERANGE, /* Invalid range end. */
|
||||
REG_ESPACE, /* Ran out of memory. */
|
||||
REG_BADRPT, /* No preceding re for repetition op. */
|
||||
|
||||
/* Error codes we've added. */
|
||||
REG_EEND, /* Premature end. */
|
||||
REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
|
||||
REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
|
||||
} reg_errcode_t;
|
||||
|
||||
/* This data structure represents a compiled pattern. Before calling
|
||||
the pattern compiler, the fields `buffer', `allocated', `fastmap',
|
||||
`translate', and `no_sub' can be set. After the pattern has been
|
||||
compiled, the `re_nsub' field is available. All other fields are
|
||||
private to the regex routines. */
|
||||
|
||||
#ifndef RE_TRANSLATE_TYPE
|
||||
# define RE_TRANSLATE_TYPE char *
|
||||
#endif
|
||||
|
||||
struct re_pattern_buffer
|
||||
{
|
||||
/* [[[begin pattern_buffer]]] */
|
||||
/* Space that holds the compiled pattern. It is declared as
|
||||
`unsigned char *' because its elements are
|
||||
sometimes used as array indexes. */
|
||||
unsigned char *buffer;
|
||||
|
||||
/* Number of bytes to which `buffer' points. */
|
||||
unsigned long int allocated;
|
||||
|
||||
/* Number of bytes actually used in `buffer'. */
|
||||
unsigned long int used;
|
||||
|
||||
/* Syntax setting with which the pattern was compiled. */
|
||||
reg_syntax_t syntax;
|
||||
|
||||
/* Pointer to a fastmap, if any, otherwise zero. re_search uses
|
||||
the fastmap, if there is one, to skip over impossible
|
||||
starting points for matches. */
|
||||
char *fastmap;
|
||||
|
||||
/* Either a translate table to apply to all characters before
|
||||
comparing them, or zero for no translation. The translation
|
||||
is applied to a pattern when it is compiled and to a string
|
||||
when it is matched. */
|
||||
RE_TRANSLATE_TYPE translate;
|
||||
|
||||
/* Number of subexpressions found by the compiler. */
|
||||
size_t re_nsub;
|
||||
|
||||
/* Zero if this pattern cannot match the empty string, one else.
|
||||
Well, in truth it's used only in `re_search_2', to see
|
||||
whether or not we should use the fastmap, so we don't set
|
||||
this absolutely perfectly; see `re_compile_fastmap' (the
|
||||
`duplicate' case). */
|
||||
unsigned can_be_null : 1;
|
||||
|
||||
/* If REGS_UNALLOCATED, allocate space in the `regs' structure
|
||||
for `max (RE_NREGS, re_nsub + 1)' groups.
|
||||
If REGS_REALLOCATE, reallocate space if necessary.
|
||||
If REGS_FIXED, use what's there. */
|
||||
#define REGS_UNALLOCATED 0
|
||||
#define REGS_REALLOCATE 1
|
||||
#define REGS_FIXED 2
|
||||
unsigned regs_allocated : 2;
|
||||
|
||||
/* Set to zero when `regex_compile' compiles a pattern; set to one
|
||||
by `re_compile_fastmap' if it updates the fastmap. */
|
||||
unsigned fastmap_accurate : 1;
|
||||
|
||||
/* If set, `re_match_2' does not return information about
|
||||
subexpressions. */
|
||||
unsigned no_sub : 1;
|
||||
|
||||
/* If set, a beginning-of-line anchor doesn't match at the
|
||||
beginning of the string. */
|
||||
unsigned not_bol : 1;
|
||||
|
||||
/* Similarly for an end-of-line anchor. */
|
||||
unsigned not_eol : 1;
|
||||
|
||||
/* If true, an anchor at a newline matches. */
|
||||
unsigned newline_anchor : 1;
|
||||
|
||||
/* [[[end pattern_buffer]]] */
|
||||
};
|
||||
|
||||
typedef struct re_pattern_buffer regex_t;
|
||||
|
||||
/* Type for byte offsets within the string. POSIX mandates this. */
|
||||
typedef int regoff_t;
|
||||
|
||||
|
||||
/* This is the structure we store register match data in. See
|
||||
regex.texinfo for a full description of what registers match. */
|
||||
struct re_registers
|
||||
{
|
||||
unsigned num_regs;
|
||||
regoff_t *start;
|
||||
regoff_t *end;
|
||||
};
|
||||
|
||||
|
||||
/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
|
||||
`re_match_2' returns information about at least this many registers
|
||||
the first time a `regs' structure is passed. */
|
||||
#ifndef RE_NREGS
|
||||
# define RE_NREGS 30
|
||||
#endif
|
||||
|
||||
|
||||
/* POSIX specification for registers. Aside from the different names than
|
||||
`re_registers', POSIX uses an array of structures, instead of a
|
||||
structure of arrays. */
|
||||
typedef struct
|
||||
{
|
||||
regoff_t rm_so; /* Byte offset from string's start to substring's start. */
|
||||
regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
|
||||
} regmatch_t;
|
||||
|
||||
/* Declarations for routines. */
|
||||
|
||||
/* To avoid duplicating every routine declaration -- once with a
|
||||
prototype (if we are ANSI), and once without (if we aren't) -- we
|
||||
use the following macro to declare argument types. This
|
||||
unfortunately clutters up the declarations a bit, but I think it's
|
||||
worth it. */
|
||||
|
||||
#if __STDC__
|
||||
|
||||
# define _RE_ARGS(args) args
|
||||
|
||||
#else /* not __STDC__ */
|
||||
|
||||
# define _RE_ARGS(args) ()
|
||||
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
/* Sets the current default syntax to SYNTAX, and return the old syntax.
|
||||
You can also simply assign to the `re_syntax_options' variable. */
|
||||
extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
|
||||
|
||||
/* Compile the regular expression PATTERN, with length LENGTH
|
||||
and syntax given by the global `re_syntax_options', into the buffer
|
||||
BUFFER. Return NULL if successful, and an error string if not. */
|
||||
extern const char *re_compile_pattern
|
||||
_RE_ARGS ((const char *pattern, size_t length,
|
||||
struct re_pattern_buffer *buffer));
|
||||
|
||||
|
||||
/* Compile a fastmap for the compiled pattern in BUFFER; used to
|
||||
accelerate searches. Return 0 if successful and -2 if was an
|
||||
internal error. */
|
||||
extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
|
||||
|
||||
|
||||
/* Search in the string STRING (with length LENGTH) for the pattern
|
||||
compiled into BUFFER. Start searching at position START, for RANGE
|
||||
characters. Return the starting position of the match, -1 for no
|
||||
match, or -2 for an internal error. Also return register
|
||||
information in REGS (if REGS and BUFFER->no_sub are nonzero). */
|
||||
extern int re_search
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
|
||||
int length, int start, int range, struct re_registers *regs));
|
||||
|
||||
|
||||
/* Like `re_search', but search in the concatenation of STRING1 and
|
||||
STRING2. Also, stop searching at index START + STOP. */
|
||||
extern int re_search_2
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
|
||||
int length1, const char *string2, int length2,
|
||||
int start, int range, struct re_registers *regs, int stop));
|
||||
|
||||
|
||||
/* Like `re_search', but return how many characters in STRING the regexp
|
||||
in BUFFER matched, starting at position START. */
|
||||
extern int re_match
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
|
||||
int length, int start, struct re_registers *regs));
|
||||
|
||||
|
||||
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
|
||||
extern int re_match_2
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
|
||||
int length1, const char *string2, int length2,
|
||||
int start, struct re_registers *regs, int stop));
|
||||
|
||||
|
||||
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
|
||||
ENDS. Subsequent matches using BUFFER and REGS will use this memory
|
||||
for recording register information. STARTS and ENDS must be
|
||||
allocated with malloc, and must each be at least `NUM_REGS * sizeof
|
||||
(regoff_t)' bytes long.
|
||||
|
||||
If NUM_REGS == 0, then subsequent matches should allocate their own
|
||||
register data.
|
||||
|
||||
Unless this function is called, the first search or match using
|
||||
PATTERN_BUFFER will allocate its own register data, without
|
||||
freeing the old data. */
|
||||
extern void re_set_registers
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
|
||||
unsigned num_regs, regoff_t *starts, regoff_t *ends));
|
||||
|
||||
#if defined _REGEX_RE_COMP || defined _LIBC
|
||||
# ifndef _CRAY
|
||||
/* 4.2 bsd compatibility. */
|
||||
extern char *re_comp _RE_ARGS ((const char *));
|
||||
extern int re_exec _RE_ARGS ((const char *));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* GCC 2.95 and later have "__restrict"; C99 compilers have
|
||||
"restrict", and "configure" may have defined "restrict". */
|
||||
#ifndef __restrict
|
||||
# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
|
||||
# if defined restrict || 199901L <= __STDC_VERSION__
|
||||
# define __restrict restrict
|
||||
# else
|
||||
# define __restrict
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
/* For now unconditionally define __restrict_arr to expand to nothing.
|
||||
Ideally we would have a test for the compiler which allows defining
|
||||
it to restrict. */
|
||||
#define __restrict_arr
|
||||
|
||||
/* POSIX compatibility. */
|
||||
extern int regcomp _RE_ARGS ((regex_t *__restrict __preg,
|
||||
const char *__restrict __pattern,
|
||||
int __cflags));
|
||||
|
||||
extern int regexec _RE_ARGS ((const regex_t *__restrict __preg,
|
||||
const char *__restrict __string, size_t __nmatch,
|
||||
regmatch_t __pmatch[__restrict_arr],
|
||||
int __eflags));
|
||||
|
||||
extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg,
|
||||
char *__errbuf, size_t __errbuf_size));
|
||||
|
||||
extern void regfree _RE_ARGS ((regex_t *__preg));
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* C++ */
|
||||
|
||||
#endif /* regex.h */
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
make-backup-files: t
|
||||
version-control: t
|
||||
trim-versions-without-asking: nil
|
||||
End:
|
||||
*/
|
||||
@@ -1,2 +0,0 @@
|
||||
. ${srcdir}/emulparams/elf64alpha.sh
|
||||
. ${srcdir}/emulparams/elf_fbsd.sh
|
||||
@@ -1,2 +0,0 @@
|
||||
. ${srcdir}/emulparams/elf64alpha.sh
|
||||
ENTRY=__start
|
||||
@@ -1 +0,0 @@
|
||||
ELF_INTERPRETER_NAME=\"/usr/libexec/ld-elf.so.1\"
|
||||
@@ -1,2 +0,0 @@
|
||||
. ${srcdir}/emulparams/elf_i386.sh
|
||||
. ${srcdir}/emulparams/elf_fbsd.sh
|
||||
@@ -1,12 +0,0 @@
|
||||
SCRIPT_NAME=elf
|
||||
OUTPUT_FORMAT="elf32-i386"
|
||||
TEXT_START_ADDR=0x08048000
|
||||
MAXPAGESIZE=0x1000
|
||||
NONPAGED_TEXT_START_ADDR=0x08048000
|
||||
ARCH=i386
|
||||
MACHINE=
|
||||
NOP=0x90909090
|
||||
TEMPLATE_NAME=elf32
|
||||
GENERATE_SHLIB_SCRIPT=yes
|
||||
ELF_INTERPRETER_NAME=\"/usr/lib/ld.so.1\"
|
||||
NO_SMALL_DATA=yes
|
||||
@@ -1,40 +0,0 @@
|
||||
# This shell script emits a C file. -*- C -*-
|
||||
# Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GLD, the Gnu Linker.
|
||||
#
|
||||
# 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 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
|
||||
# This file is sourced from elf32.em. It is used by targets for
|
||||
# which relaxation is not just an optimization, but for correctness.
|
||||
|
||||
LDEMUL_BEFORE_ALLOCATION=need_relax_${EMULATION_NAME}_before_allocation
|
||||
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
|
||||
static void need_relax_${EMULATION_NAME}_before_allocation PARAMS ((void));
|
||||
|
||||
static void
|
||||
need_relax_${EMULATION_NAME}_before_allocation ()
|
||||
{
|
||||
/* Call main function; we're just extending it. */
|
||||
gld${EMULATION_NAME}_before_allocation ();
|
||||
|
||||
/* Force -relax on if not doing a relocatable link. */
|
||||
if (! link_info.relocateable)
|
||||
command_line.relax = true;
|
||||
}
|
||||
EOF
|
||||
@@ -1,303 +0,0 @@
|
||||
/* Provide a version of _doprnt in terms of fprintf.
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
Contributed by Kaveh Ghazi ([email protected]) 3/29/98
|
||||
|
||||
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. */
|
||||
|
||||
#include "config.h"
|
||||
#include "ansidecl.h"
|
||||
#include "safe-ctype.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#undef _doprnt
|
||||
|
||||
#ifdef HAVE__DOPRNT
|
||||
#define TEST
|
||||
#endif
|
||||
|
||||
#ifdef TEST /* Make sure to use the internal one. */
|
||||
#define _doprnt my_doprnt
|
||||
#endif
|
||||
|
||||
#define COPY_VA_INT \
|
||||
do { \
|
||||
const int value = abs (va_arg (ap, int)); \
|
||||
char buf[32]; \
|
||||
ptr++; /* Go past the asterisk. */ \
|
||||
*sptr = '\0'; /* NULL terminate sptr. */ \
|
||||
sprintf(buf, "%d", value); \
|
||||
strcat(sptr, buf); \
|
||||
while (*sptr) sptr++; \
|
||||
} while (0)
|
||||
|
||||
#define PRINT_CHAR(CHAR) \
|
||||
do { \
|
||||
putc(CHAR, stream); \
|
||||
ptr++; \
|
||||
total_printed++; \
|
||||
continue; \
|
||||
} while (0)
|
||||
|
||||
#define PRINT_TYPE(TYPE) \
|
||||
do { \
|
||||
int result; \
|
||||
TYPE value = va_arg (ap, TYPE); \
|
||||
*sptr++ = *ptr++; /* Copy the type specifier. */ \
|
||||
*sptr = '\0'; /* NULL terminate sptr. */ \
|
||||
result = fprintf(stream, specifier, value); \
|
||||
if (result == -1) \
|
||||
return -1; \
|
||||
else \
|
||||
{ \
|
||||
total_printed += result; \
|
||||
continue; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
int
|
||||
_doprnt (format, ap, stream)
|
||||
const char * format;
|
||||
va_list ap;
|
||||
FILE * stream;
|
||||
{
|
||||
const char * ptr = format;
|
||||
char specifier[128];
|
||||
int total_printed = 0;
|
||||
|
||||
while (*ptr != '\0')
|
||||
{
|
||||
if (*ptr != '%') /* While we have regular characters, print them. */
|
||||
PRINT_CHAR(*ptr);
|
||||
else /* We got a format specifier! */
|
||||
{
|
||||
char * sptr = specifier;
|
||||
int wide_width = 0, short_width = 0;
|
||||
|
||||
*sptr++ = *ptr++; /* Copy the % and move forward. */
|
||||
|
||||
while (strchr ("-+ #0", *ptr)) /* Move past flags. */
|
||||
*sptr++ = *ptr++;
|
||||
|
||||
if (*ptr == '*')
|
||||
COPY_VA_INT;
|
||||
else
|
||||
while (ISDIGIT(*ptr)) /* Handle explicit numeric value. */
|
||||
*sptr++ = *ptr++;
|
||||
|
||||
if (*ptr == '.')
|
||||
{
|
||||
*sptr++ = *ptr++; /* Copy and go past the period. */
|
||||
if (*ptr == '*')
|
||||
COPY_VA_INT;
|
||||
else
|
||||
while (ISDIGIT(*ptr)) /* Handle explicit numeric value. */
|
||||
*sptr++ = *ptr++;
|
||||
}
|
||||
while (strchr ("hlL", *ptr))
|
||||
{
|
||||
switch (*ptr)
|
||||
{
|
||||
case 'h':
|
||||
short_width = 1;
|
||||
break;
|
||||
case 'l':
|
||||
wide_width++;
|
||||
break;
|
||||
case 'L':
|
||||
wide_width = 2;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
*sptr++ = *ptr++;
|
||||
}
|
||||
|
||||
switch (*ptr)
|
||||
{
|
||||
case 'd':
|
||||
case 'i':
|
||||
case 'o':
|
||||
case 'u':
|
||||
case 'x':
|
||||
case 'X':
|
||||
case 'c':
|
||||
{
|
||||
/* Short values are promoted to int, so just copy it
|
||||
as an int and trust the C library printf to cast it
|
||||
to the right width. */
|
||||
if (short_width)
|
||||
PRINT_TYPE(int);
|
||||
else
|
||||
{
|
||||
switch (wide_width)
|
||||
{
|
||||
case 0:
|
||||
PRINT_TYPE(int);
|
||||
break;
|
||||
case 1:
|
||||
PRINT_TYPE(long);
|
||||
break;
|
||||
case 2:
|
||||
default:
|
||||
#if defined(__GNUC__) || defined(HAVE_LONG_LONG)
|
||||
PRINT_TYPE(long long);
|
||||
#else
|
||||
PRINT_TYPE(long); /* Fake it and hope for the best. */
|
||||
#endif
|
||||
break;
|
||||
} /* End of switch (wide_width) */
|
||||
} /* End of else statement */
|
||||
} /* End of integer case */
|
||||
break;
|
||||
case 'f':
|
||||
case 'e':
|
||||
case 'E':
|
||||
case 'g':
|
||||
case 'G':
|
||||
{
|
||||
if (wide_width == 0)
|
||||
PRINT_TYPE(double);
|
||||
else
|
||||
{
|
||||
#if defined(__GNUC__) || defined(HAVE_LONG_DOUBLE)
|
||||
PRINT_TYPE(long double);
|
||||
#else
|
||||
PRINT_TYPE(double); /* Fake it and hope for the best. */
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
PRINT_TYPE(char *);
|
||||
break;
|
||||
case 'p':
|
||||
PRINT_TYPE(void *);
|
||||
break;
|
||||
case '%':
|
||||
PRINT_CHAR('%');
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
} /* End of switch (*ptr) */
|
||||
} /* End of else statement */
|
||||
}
|
||||
|
||||
return total_printed;
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
#include <math.h>
|
||||
#ifndef M_PI
|
||||
#define M_PI (3.1415926535897932385)
|
||||
#endif
|
||||
|
||||
#define RESULT(x) do \
|
||||
{ \
|
||||
int i = (x); \
|
||||
printf ("printed %d characters\n", i); \
|
||||
fflush(stdin); \
|
||||
} while (0)
|
||||
|
||||
static int checkit PARAMS ((const char * format, ...)) ATTRIBUTE_PRINTF_1;
|
||||
|
||||
static int
|
||||
checkit VPARAMS ((const char* format, ...))
|
||||
{
|
||||
int result;
|
||||
VA_OPEN (args, format);
|
||||
VA_FIXEDARG (args, char *, format);
|
||||
|
||||
result = _doprnt (format, args, stdout);
|
||||
VA_CLOSE (args);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
RESULT(checkit ("<%d>\n", 0x12345678));
|
||||
RESULT(printf ("<%d>\n", 0x12345678));
|
||||
|
||||
RESULT(checkit ("<%200d>\n", 5));
|
||||
RESULT(printf ("<%200d>\n", 5));
|
||||
|
||||
RESULT(checkit ("<%.300d>\n", 6));
|
||||
RESULT(printf ("<%.300d>\n", 6));
|
||||
|
||||
RESULT(checkit ("<%100.150d>\n", 7));
|
||||
RESULT(printf ("<%100.150d>\n", 7));
|
||||
|
||||
RESULT(checkit ("<%s>\n",
|
||||
"jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
|
||||
777777777777777777333333333333366666666666622222222222777777777777733333"));
|
||||
RESULT(printf ("<%s>\n",
|
||||
"jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
|
||||
777777777777777777333333333333366666666666622222222222777777777777733333"));
|
||||
|
||||
RESULT(checkit ("<%f><%0+#f>%s%d%s>\n",
|
||||
1.0, 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx"));
|
||||
RESULT(printf ("<%f><%0+#f>%s%d%s>\n",
|
||||
1.0, 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx"));
|
||||
|
||||
RESULT(checkit ("<%4f><%.4f><%%><%4.4f>\n", M_PI, M_PI, M_PI));
|
||||
RESULT(printf ("<%4f><%.4f><%%><%4.4f>\n", M_PI, M_PI, M_PI));
|
||||
|
||||
RESULT(checkit ("<%*f><%.*f><%%><%*.*f>\n", 3, M_PI, 3, M_PI, 3, 3, M_PI));
|
||||
RESULT(printf ("<%*f><%.*f><%%><%*.*f>\n", 3, M_PI, 3, M_PI, 3, 3, M_PI));
|
||||
|
||||
RESULT(checkit ("<%d><%i><%o><%u><%x><%X><%c>\n",
|
||||
75, 75, 75, 75, 75, 75, 75));
|
||||
RESULT(printf ("<%d><%i><%o><%u><%x><%X><%c>\n",
|
||||
75, 75, 75, 75, 75, 75, 75));
|
||||
|
||||
RESULT(checkit ("<%d><%i><%o><%u><%x><%X><%c>\n",
|
||||
75, 75, 75, 75, 75, 75, 75));
|
||||
RESULT(printf ("<%d><%i><%o><%u><%x><%X><%c>\n",
|
||||
75, 75, 75, 75, 75, 75, 75));
|
||||
|
||||
RESULT(checkit ("Testing (hd) short: <%d><%ld><%hd><%hd><%d>\n", 123, (long)234, 345, 123456789, 456));
|
||||
RESULT(printf ("Testing (hd) short: <%d><%ld><%hd><%hd><%d>\n", 123, (long)234, 345, 123456789, 456));
|
||||
|
||||
#if defined(__GNUC__) || defined (HAVE_LONG_LONG)
|
||||
RESULT(checkit ("Testing (lld) long long: <%d><%lld><%d>\n", 123, 234234234234234234LL, 345));
|
||||
RESULT(printf ("Testing (lld) long long: <%d><%lld><%d>\n", 123, 234234234234234234LL, 345));
|
||||
RESULT(checkit ("Testing (Ld) long long: <%d><%Ld><%d>\n", 123, 234234234234234234LL, 345));
|
||||
RESULT(printf ("Testing (Ld) long long: <%d><%Ld><%d>\n", 123, 234234234234234234LL, 345));
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined (HAVE_LONG_DOUBLE)
|
||||
RESULT(checkit ("Testing (Lf) long double: <%.20f><%.20Lf><%0+#.20f>\n",
|
||||
1.23456, 1.234567890123456789L, 1.23456));
|
||||
RESULT(printf ("Testing (Lf) long double: <%.20f><%.20Lf><%0+#.20f>\n",
|
||||
1.23456, 1.234567890123456789L, 1.23456));
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST */
|
||||
@@ -1,565 +0,0 @@
|
||||
@node Library Copying
|
||||
@appendixsec GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
@cindex LGPL, Lesser General Public License
|
||||
@center Version 2.1, February 1999
|
||||
|
||||
@display
|
||||
Copyright @copyright{} 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place -- Suite 330, Boston, MA 02111-1307, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence the
|
||||
version number 2.1.]
|
||||
@end display
|
||||
|
||||
@appendixsubsec Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software---to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software---typically libraries---of the Free
|
||||
Software Foundation and other authors who decide to use it. You can use
|
||||
it too, but we suggest you first think carefully about whether this
|
||||
license or the ordinary General Public License is the better strategy to
|
||||
use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of it
|
||||
in new free programs; and that you are informed that you can do these
|
||||
things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the @dfn{Lesser} General Public License because it
|
||||
does @emph{Less} to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
``work based on the library'' and a ``work that uses the library''. The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
@iftex
|
||||
@appendixsubsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center GNU LESSER GENERAL PUBLIC LICENSE
|
||||
@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
@end ifinfo
|
||||
|
||||
@enumerate 0
|
||||
@item
|
||||
This License Agreement applies to any software library or other program
|
||||
which contains a notice placed by the copyright holder or other
|
||||
authorized party saying it may be distributed under the terms of this
|
||||
Lesser General Public License (also called ``this License''). Each
|
||||
licensee is addressed as ``you''.
|
||||
|
||||
A ``library'' means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The ``Library'', below, refers to any such software library or work
|
||||
which has been distributed under these terms. A ``work based on the
|
||||
Library'' means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term ``modification''.)
|
||||
|
||||
``Source code'' for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
@item
|
||||
You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
@item
|
||||
You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
The modified work must itself be a software library.
|
||||
|
||||
@item
|
||||
You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
@item
|
||||
You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
@item
|
||||
If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
@end enumerate
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
@item
|
||||
You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
@item
|
||||
You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
@item
|
||||
A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a ``work that uses the Library''. Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a ``work that uses the Library'' with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a ``work that uses the
|
||||
library''. The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a ``work that uses the Library'' uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
@item
|
||||
As an exception to the Sections above, you may also combine or
|
||||
link a ``work that uses the Library'' with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable ``work that
|
||||
uses the Library'', as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
@item
|
||||
Use a suitable shared library mechanism for linking with the Library. A
|
||||
suitable mechanism is one that (1) uses at run time a copy of the
|
||||
library already present on the user's computer system, rather than
|
||||
copying library functions into the executable, and (2) will operate
|
||||
properly with a modified version of the library, if the user installs
|
||||
one, as long as the modified version is interface-compatible with the
|
||||
version that the work was made with.
|
||||
|
||||
@item
|
||||
Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
@item
|
||||
If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
@item
|
||||
Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
@end enumerate
|
||||
|
||||
For an executable, the required form of the ``work that uses the
|
||||
Library'' must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies the
|
||||
executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
@item
|
||||
You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
@item
|
||||
Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
@end enumerate
|
||||
|
||||
@item
|
||||
You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
@item
|
||||
You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
@item
|
||||
Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
@item
|
||||
If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
@item
|
||||
If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
@item
|
||||
The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
``any later version'', you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
@item
|
||||
If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
@iftex
|
||||
@heading NO WARRANTY
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center NO WARRANTY
|
||||
@end ifinfo
|
||||
|
||||
@item
|
||||
BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY ``AS IS'' WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
@item
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
@end enumerate
|
||||
|
||||
@iftex
|
||||
@heading END OF TERMS AND CONDITIONS
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center END OF TERMS AND CONDITIONS
|
||||
@end ifinfo
|
||||
|
||||
@page
|
||||
@appendixsubsec How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
``copyright'' line and a pointer to where the full notice is found.
|
||||
|
||||
@smallexample
|
||||
@var{one line to give the library's name and an idea of what it does.}
|
||||
Copyright (C) @var{year} @var{name of author}
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
|
||||
USA.
|
||||
@end smallexample
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a ``copyright disclaimer'' for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
@smallexample
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the library
|
||||
`Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
@var{signature of Ty Coon}, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
@end smallexample
|
||||
|
||||
That's all there is to it!
|
||||
@@ -1,27 +0,0 @@
|
||||
/* ffs -- Find the first bit set in the parameter
|
||||
|
||||
@deftypefn Supplemental int ffs (int @var{valu})
|
||||
|
||||
Find the first (least significant) bit set in @var{valu}. Bits are
|
||||
numbered from right to left, starting with bit 1 (corresponding to the
|
||||
value 1). If @var{valu} is zero, zero is returned.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
*/
|
||||
|
||||
int
|
||||
ffs (valu)
|
||||
register int valu;
|
||||
{
|
||||
register int bit;
|
||||
|
||||
if (valu == 0)
|
||||
return 0;
|
||||
|
||||
for (bit = 1; !(valu & 1); bit++)
|
||||
valu >>= 1;
|
||||
|
||||
return bit;
|
||||
}
|
||||
|
||||
@@ -1,523 +0,0 @@
|
||||
/* A Fibonacci heap datatype.
|
||||
Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Daniel Berlin ([email protected]).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU CC is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#include "libiberty.h"
|
||||
#include "fibheap.h"
|
||||
|
||||
|
||||
#define FIBHEAPKEY_MIN LONG_MIN
|
||||
|
||||
static void fibheap_ins_root PARAMS ((fibheap_t, fibnode_t));
|
||||
static void fibheap_rem_root PARAMS ((fibheap_t, fibnode_t));
|
||||
static void fibheap_consolidate PARAMS ((fibheap_t));
|
||||
static void fibheap_link PARAMS ((fibheap_t, fibnode_t, fibnode_t));
|
||||
static void fibheap_cut PARAMS ((fibheap_t, fibnode_t, fibnode_t));
|
||||
static void fibheap_cascading_cut PARAMS ((fibheap_t, fibnode_t));
|
||||
static fibnode_t fibheap_extr_min_node PARAMS ((fibheap_t));
|
||||
static int fibheap_compare PARAMS ((fibheap_t, fibnode_t, fibnode_t));
|
||||
static int fibheap_comp_data PARAMS ((fibheap_t, fibheapkey_t, void *,
|
||||
fibnode_t));
|
||||
static fibnode_t fibnode_new PARAMS ((void));
|
||||
static void fibnode_insert_after PARAMS ((fibnode_t, fibnode_t));
|
||||
#define fibnode_insert_before(a, b) fibnode_insert_after (a->left, b)
|
||||
static fibnode_t fibnode_remove PARAMS ((fibnode_t));
|
||||
|
||||
|
||||
/* Create a new fibonacci heap. */
|
||||
fibheap_t
|
||||
fibheap_new ()
|
||||
{
|
||||
return (fibheap_t) xcalloc (1, sizeof (struct fibheap));
|
||||
}
|
||||
|
||||
/* Create a new fibonacci heap node. */
|
||||
static fibnode_t
|
||||
fibnode_new ()
|
||||
{
|
||||
fibnode_t node;
|
||||
|
||||
node = xcalloc (1, sizeof *node);
|
||||
node->left = node;
|
||||
node->right = node;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static inline int
|
||||
fibheap_compare (heap, a, b)
|
||||
fibheap_t heap ATTRIBUTE_UNUSED;
|
||||
fibnode_t a;
|
||||
fibnode_t b;
|
||||
{
|
||||
if (a->key < b->key)
|
||||
return -1;
|
||||
if (a->key > b->key)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
fibheap_comp_data (heap, key, data, b)
|
||||
fibheap_t heap;
|
||||
fibheapkey_t key;
|
||||
void *data;
|
||||
fibnode_t b;
|
||||
{
|
||||
struct fibnode a;
|
||||
|
||||
a.key = key;
|
||||
a.data = data;
|
||||
|
||||
return fibheap_compare (heap, &a, b);
|
||||
}
|
||||
|
||||
/* Insert DATA, with priority KEY, into HEAP. */
|
||||
fibnode_t
|
||||
fibheap_insert (heap, key, data)
|
||||
fibheap_t heap;
|
||||
fibheapkey_t key;
|
||||
void *data;
|
||||
{
|
||||
fibnode_t node;
|
||||
|
||||
/* Create the new node. */
|
||||
node = fibnode_new ();
|
||||
|
||||
/* Set the node's data. */
|
||||
node->data = data;
|
||||
node->key = key;
|
||||
|
||||
/* Insert it into the root list. */
|
||||
fibheap_ins_root (heap, node);
|
||||
|
||||
/* If their was no minimum, or this key is less than the min,
|
||||
it's the new min. */
|
||||
if (heap->min == NULL || node->key < heap->min->key)
|
||||
heap->min = node;
|
||||
|
||||
heap->nodes++;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
/* Return the data of the minimum node (if we know it). */
|
||||
void *
|
||||
fibheap_min (heap)
|
||||
fibheap_t heap;
|
||||
{
|
||||
/* If there is no min, we can't easily return it. */
|
||||
if (heap->min == NULL)
|
||||
return NULL;
|
||||
return heap->min->data;
|
||||
}
|
||||
|
||||
/* Return the key of the minimum node (if we know it). */
|
||||
fibheapkey_t
|
||||
fibheap_min_key (heap)
|
||||
fibheap_t heap;
|
||||
{
|
||||
/* If there is no min, we can't easily return it. */
|
||||
if (heap->min == NULL)
|
||||
return 0;
|
||||
return heap->min->key;
|
||||
}
|
||||
|
||||
/* Union HEAPA and HEAPB into a new heap. */
|
||||
fibheap_t
|
||||
fibheap_union (heapa, heapb)
|
||||
fibheap_t heapa;
|
||||
fibheap_t heapb;
|
||||
{
|
||||
fibnode_t a_root, b_root, temp;
|
||||
|
||||
/* If one of the heaps is empty, the union is just the other heap. */
|
||||
if ((a_root = heapa->root) == NULL)
|
||||
{
|
||||
free (heapa);
|
||||
return heapb;
|
||||
}
|
||||
if ((b_root = heapb->root) == NULL)
|
||||
{
|
||||
free (heapb);
|
||||
return heapa;
|
||||
}
|
||||
|
||||
/* Merge them to the next nodes on the opposite chain. */
|
||||
a_root->left->right = b_root;
|
||||
b_root->left->right = a_root;
|
||||
temp = a_root->left;
|
||||
a_root->left = b_root->left;
|
||||
b_root->left = temp;
|
||||
heapa->nodes += heapb->nodes;
|
||||
|
||||
/* And set the new minimum, if it's changed. */
|
||||
if (fibheap_compare (heapa, heapb->min, heapa->min) < 0)
|
||||
heapa->min = heapb->min;
|
||||
|
||||
free (heapb);
|
||||
return heapa;
|
||||
}
|
||||
|
||||
/* Extract the data of the minimum node from HEAP. */
|
||||
void *
|
||||
fibheap_extract_min (heap)
|
||||
fibheap_t heap;
|
||||
{
|
||||
fibnode_t z;
|
||||
void *ret = NULL;
|
||||
|
||||
/* If we don't have a min set, it means we have no nodes. */
|
||||
if (heap->min != NULL)
|
||||
{
|
||||
/* Otherwise, extract the min node, free the node, and return the
|
||||
node's data. */
|
||||
z = fibheap_extr_min_node (heap);
|
||||
ret = z->data;
|
||||
free (z);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Replace both the KEY and the DATA associated with NODE. */
|
||||
void *
|
||||
fibheap_replace_key_data (heap, node, key, data)
|
||||
fibheap_t heap;
|
||||
fibnode_t node;
|
||||
fibheapkey_t key;
|
||||
void *data;
|
||||
{
|
||||
void *odata;
|
||||
int okey;
|
||||
fibnode_t y;
|
||||
|
||||
/* If we wanted to, we could actually do a real increase by redeleting and
|
||||
inserting. However, this would require O (log n) time. So just bail out
|
||||
for now. */
|
||||
if (fibheap_comp_data (heap, key, data, node) > 0)
|
||||
return NULL;
|
||||
|
||||
odata = node->data;
|
||||
okey = node->key;
|
||||
node->data = data;
|
||||
node->key = key;
|
||||
y = node->parent;
|
||||
|
||||
if (okey == key)
|
||||
return odata;
|
||||
|
||||
/* These two compares are specifically <= 0 to make sure that in the case
|
||||
of equality, a node we replaced the data on, becomes the new min. This
|
||||
is needed so that delete's call to extractmin gets the right node. */
|
||||
if (y != NULL && fibheap_compare (heap, node, y) <= 0)
|
||||
{
|
||||
fibheap_cut (heap, node, y);
|
||||
fibheap_cascading_cut (heap, y);
|
||||
}
|
||||
|
||||
if (fibheap_compare (heap, node, heap->min) <= 0)
|
||||
heap->min = node;
|
||||
|
||||
return odata;
|
||||
}
|
||||
|
||||
/* Replace the DATA associated with NODE. */
|
||||
void *
|
||||
fibheap_replace_data (heap, node, data)
|
||||
fibheap_t heap;
|
||||
fibnode_t node;
|
||||
void *data;
|
||||
{
|
||||
return fibheap_replace_key_data (heap, node, node->key, data);
|
||||
}
|
||||
|
||||
/* Replace the KEY associated with NODE. */
|
||||
fibheapkey_t
|
||||
fibheap_replace_key (heap, node, key)
|
||||
fibheap_t heap;
|
||||
fibnode_t node;
|
||||
fibheapkey_t key;
|
||||
{
|
||||
int okey = node->key;
|
||||
fibheap_replace_key_data (heap, node, key, node->data);
|
||||
return okey;
|
||||
}
|
||||
|
||||
/* Delete NODE from HEAP. */
|
||||
void *
|
||||
fibheap_delete_node (heap, node)
|
||||
fibheap_t heap;
|
||||
fibnode_t node;
|
||||
{
|
||||
void *ret = node->data;
|
||||
|
||||
/* To perform delete, we just make it the min key, and extract. */
|
||||
fibheap_replace_key (heap, node, FIBHEAPKEY_MIN);
|
||||
fibheap_extract_min (heap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Delete HEAP. */
|
||||
void
|
||||
fibheap_delete (heap)
|
||||
fibheap_t heap;
|
||||
{
|
||||
while (heap->min != NULL)
|
||||
free (fibheap_extr_min_node (heap));
|
||||
|
||||
free (heap);
|
||||
}
|
||||
|
||||
/* Determine if HEAP is empty. */
|
||||
int
|
||||
fibheap_empty (heap)
|
||||
fibheap_t heap;
|
||||
{
|
||||
return heap->nodes == 0;
|
||||
}
|
||||
|
||||
/* Extract the minimum node of the heap. */
|
||||
static fibnode_t
|
||||
fibheap_extr_min_node (heap)
|
||||
fibheap_t heap;
|
||||
{
|
||||
fibnode_t ret = heap->min;
|
||||
fibnode_t x, y, orig;
|
||||
|
||||
/* Attach the child list of the minimum node to the root list of the heap.
|
||||
If there is no child list, we don't do squat. */
|
||||
for (x = ret->child, orig = NULL; x != orig && x != NULL; x = y)
|
||||
{
|
||||
if (orig == NULL)
|
||||
orig = x;
|
||||
y = x->right;
|
||||
x->parent = NULL;
|
||||
fibheap_ins_root (heap, x);
|
||||
}
|
||||
|
||||
/* Remove the old root. */
|
||||
fibheap_rem_root (heap, ret);
|
||||
heap->nodes--;
|
||||
|
||||
/* If we are left with no nodes, then the min is NULL. */
|
||||
if (heap->nodes == 0)
|
||||
heap->min = NULL;
|
||||
else
|
||||
{
|
||||
/* Otherwise, consolidate to find new minimum, as well as do the reorg
|
||||
work that needs to be done. */
|
||||
heap->min = ret->right;
|
||||
fibheap_consolidate (heap);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Insert NODE into the root list of HEAP. */
|
||||
static void
|
||||
fibheap_ins_root (heap, node)
|
||||
fibheap_t heap;
|
||||
fibnode_t node;
|
||||
{
|
||||
/* If the heap is currently empty, the new node becomes the singleton
|
||||
circular root list. */
|
||||
if (heap->root == NULL)
|
||||
{
|
||||
heap->root = node;
|
||||
node->left = node;
|
||||
node->right = node;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Otherwise, insert it in the circular root list between the root
|
||||
and it's right node. */
|
||||
fibnode_insert_after (heap->root, node);
|
||||
}
|
||||
|
||||
/* Remove NODE from the rootlist of HEAP. */
|
||||
static void
|
||||
fibheap_rem_root (heap, node)
|
||||
fibheap_t heap;
|
||||
fibnode_t node;
|
||||
{
|
||||
if (node->left == node)
|
||||
heap->root = NULL;
|
||||
else
|
||||
heap->root = fibnode_remove (node);
|
||||
}
|
||||
|
||||
/* Consolidate the heap. */
|
||||
static void
|
||||
fibheap_consolidate (heap)
|
||||
fibheap_t heap;
|
||||
{
|
||||
fibnode_t a[1 + 8 * sizeof (long)];
|
||||
fibnode_t w;
|
||||
fibnode_t y;
|
||||
fibnode_t x;
|
||||
int i;
|
||||
int d;
|
||||
int D;
|
||||
|
||||
D = 1 + 8 * sizeof (long);
|
||||
|
||||
memset (a, 0, sizeof (fibnode_t) * D);
|
||||
|
||||
while ((w = heap->root) != NULL)
|
||||
{
|
||||
x = w;
|
||||
fibheap_rem_root (heap, w);
|
||||
d = x->degree;
|
||||
while (a[d] != NULL)
|
||||
{
|
||||
y = a[d];
|
||||
if (fibheap_compare (heap, x, y) > 0)
|
||||
{
|
||||
fibnode_t temp;
|
||||
temp = x;
|
||||
x = y;
|
||||
y = temp;
|
||||
}
|
||||
fibheap_link (heap, y, x);
|
||||
a[d] = NULL;
|
||||
d++;
|
||||
}
|
||||
a[d] = x;
|
||||
}
|
||||
heap->min = NULL;
|
||||
for (i = 0; i < D; i++)
|
||||
if (a[i] != NULL)
|
||||
{
|
||||
fibheap_ins_root (heap, a[i]);
|
||||
if (heap->min == NULL || fibheap_compare (heap, a[i], heap->min) < 0)
|
||||
heap->min = a[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* Make NODE a child of PARENT. */
|
||||
static void
|
||||
fibheap_link (heap, node, parent)
|
||||
fibheap_t heap ATTRIBUTE_UNUSED;
|
||||
fibnode_t node;
|
||||
fibnode_t parent;
|
||||
{
|
||||
if (parent->child == NULL)
|
||||
parent->child = node;
|
||||
else
|
||||
fibnode_insert_before (parent->child, node);
|
||||
node->parent = parent;
|
||||
parent->degree++;
|
||||
node->mark = 0;
|
||||
}
|
||||
|
||||
/* Remove NODE from PARENT's child list. */
|
||||
static void
|
||||
fibheap_cut (heap, node, parent)
|
||||
fibheap_t heap;
|
||||
fibnode_t node;
|
||||
fibnode_t parent;
|
||||
{
|
||||
fibnode_remove (node);
|
||||
parent->degree--;
|
||||
fibheap_ins_root (heap, node);
|
||||
node->parent = NULL;
|
||||
node->mark = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
fibheap_cascading_cut (heap, y)
|
||||
fibheap_t heap;
|
||||
fibnode_t y;
|
||||
{
|
||||
fibnode_t z;
|
||||
|
||||
while ((z = y->parent) != NULL)
|
||||
{
|
||||
if (y->mark == 0)
|
||||
{
|
||||
y->mark = 1;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
fibheap_cut (heap, y, z);
|
||||
y = z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fibnode_insert_after (a, b)
|
||||
fibnode_t a;
|
||||
fibnode_t b;
|
||||
{
|
||||
if (a == a->right)
|
||||
{
|
||||
a->right = b;
|
||||
a->left = b;
|
||||
b->right = a;
|
||||
b->left = a;
|
||||
}
|
||||
else
|
||||
{
|
||||
b->right = a->right;
|
||||
a->right->left = b;
|
||||
a->right = b;
|
||||
b->left = a;
|
||||
}
|
||||
}
|
||||
|
||||
static fibnode_t
|
||||
fibnode_remove (node)
|
||||
fibnode_t node;
|
||||
{
|
||||
fibnode_t ret;
|
||||
|
||||
if (node == node->left)
|
||||
ret = NULL;
|
||||
else
|
||||
ret = node->left;
|
||||
|
||||
if (node->parent != NULL && node->parent->child == node)
|
||||
node->parent->child = ret;
|
||||
|
||||
node->right->left = node->left;
|
||||
node->left->right = node->right;
|
||||
|
||||
node->parent = NULL;
|
||||
node->left = node;
|
||||
node->right = node;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
@deftypefn Replacement int fnmatch (const char *@var{pattern}, const char *@var{string}, int @var{flags})
|
||||
|
||||
Matches @var{string} against @var{pattern}, returning zero if it
|
||||
matches, @code{FNM_NOMATCH} if not. @var{pattern} may contain the
|
||||
wildcards @code{?} to match any one character, @code{*} to match any
|
||||
zero or more characters, or a set of alternate characters in square
|
||||
brackets, like @samp{[a-gt8]}, which match one character (@code{a}
|
||||
through @code{g}, or @code{t}, or @code{8}, in this example) if that one
|
||||
character is in the set. A set may be inverted (i.e., match anything
|
||||
except what's in the set) by giving @code{^} or @code{!} as the first
|
||||
character in the set. To include those characters in the set, list them
|
||||
as anything other than the first character of the set. To include a
|
||||
dash in the set, list it last in the set. A backslash character makes
|
||||
the following character not special, so for example you could match
|
||||
against a literal asterisk with @samp{\*}. To match a literal
|
||||
backslash, use @samp{\\}.
|
||||
|
||||
@code{flags} controls various aspects of the matching process, and is a
|
||||
boolean OR of zero or more of the following values (defined in
|
||||
@code{<fnmatch.h>}):
|
||||
|
||||
@table @code
|
||||
|
||||
@item FNM_PATHNAME
|
||||
@itemx FNM_FILE_NAME
|
||||
@var{string} is assumed to be a path name. No wildcard will ever match
|
||||
@code{/}.
|
||||
|
||||
@item FNM_NOESCAPE
|
||||
Do not interpret backslashes as quoting the following special character.
|
||||
|
||||
@item FNM_PERIOD
|
||||
A leading period (at the beginning of @var{string}, or if
|
||||
@code{FNM_PATHNAME} after a slash) is not matched by @code{*} or
|
||||
@code{?} but must be matched explicitly.
|
||||
|
||||
@item FNM_LEADING_DIR
|
||||
Means that @var{string} also matches @var{pattern} if some initial part
|
||||
of @var{string} matches, and is followed by @code{/} and zero or more
|
||||
characters. For example, @samp{foo*} would match either @samp{foobar}
|
||||
or @samp{foobar/grill}.
|
||||
|
||||
@item FNM_CASEFOLD
|
||||
Ignores case when performing the comparison.
|
||||
|
||||
@end table
|
||||
|
||||
@end deftypefn
|
||||
@@ -1,937 +0,0 @@
|
||||
@c Automatically generated from *.c and others (the comments before
|
||||
@c each entry tell you which file and where in that file). DO NOT EDIT!
|
||||
@c Edit the *.c files, configure with --enable-maintainer-mode,
|
||||
@c and let gather-docs build you a new copy.
|
||||
|
||||
@c alloca.c:26
|
||||
@deftypefn Replacement void* alloca (size_t @var{size})
|
||||
|
||||
This function allocates memory which will be automatically reclaimed
|
||||
after the procedure exits. The @libib{} implementation does not free
|
||||
the memory immediately but will do so eventually during subsequent
|
||||
calls to this function. Memory is allocated using @code{xmalloc} under
|
||||
normal circumstances.
|
||||
|
||||
The header file @file{alloca-conf.h} can be used in conjunction with the
|
||||
GNU Autoconf test @code{AC_FUNC_ALLOCA} to test for and properly make
|
||||
available this function. The @code{AC_FUNC_ALLOCA} test requires that
|
||||
client code use a block of preprocessor code to be safe (see the Autoconf
|
||||
manual for more); this header incorporates that logic and more, including
|
||||
the possibility of a GCC built-in function.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c asprintf.c:33
|
||||
@deftypefn Extension int asprintf (char **@var{resptr}, const char *@var{format}, ...)
|
||||
|
||||
Like @code{sprintf}, but instead of passing a pointer to a buffer, you
|
||||
pass a pointer to a pointer. This function will compute the size of
|
||||
the buffer needed, allocate memory with @code{malloc}, and store a
|
||||
pointer to the allocated memory in @code{*@var{resptr}}. The value
|
||||
returned is the same as @code{sprintf} would return. If memory could
|
||||
not be allocated, zero is returned and @code{NULL} is stored in
|
||||
@code{*@var{resptr}}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c atexit.c:6
|
||||
@deftypefn Supplemental int atexit (void (*@var{f})())
|
||||
|
||||
Causes function @var{f} to be called at exit. Returns 0.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c basename.c:6
|
||||
@deftypefn Supplemental char* basename (const char *@var{name})
|
||||
|
||||
Returns a pointer to the last component of pathname @var{name}.
|
||||
Behavior is undefined if the pathname ends in a directory separator.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c bcmp.c:6
|
||||
@deftypefn Supplemental int bcmp (char *@var{x}, char *@var{y}, int @var{count})
|
||||
|
||||
Compares the first @var{count} bytes of two areas of memory. Returns
|
||||
zero if they are the same, nonzero otherwise. Returns zero if
|
||||
@var{count} is zero. A nonzero result only indicates a difference,
|
||||
it does not indicate any sorting order (say, by having a positive
|
||||
result mean @var{x} sorts before @var{y}).
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c bcopy.c:3
|
||||
@deftypefn Supplemental void bcopy (char *@var{in}, char *@var{out}, int @var{length})
|
||||
|
||||
Copies @var{length} bytes from memory region @var{in} to region
|
||||
@var{out}. The use of @code{bcopy} is deprecated in new programs.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c bsearch.c:33
|
||||
@deftypefn Supplemental void* bsearch (const void *@var{key}, const void *@var{base}, size_t @var{nmemb}, size_t @var{size}, int (*@var{compar})(const void *, const void *))
|
||||
|
||||
Performs a search over an array of @var{nmemb} elements pointed to by
|
||||
@var{base} for a member that matches the object pointed to by @var{key}.
|
||||
The size of each member is specified by @var{size}. The array contents
|
||||
should be sorted in ascending order according to the @var{compar}
|
||||
comparison function. This routine should take two arguments pointing to
|
||||
the @var{key} and to an array member, in that order, and should return an
|
||||
integer less than, equal to, or greater than zero if the @var{key} object
|
||||
is respectively less than, matching, or greater than the array member.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c argv.c:139
|
||||
@deftypefn Extension char** buildargv (char *@var{sp})
|
||||
|
||||
Given a pointer to a string, parse the string extracting fields
|
||||
separated by whitespace and optionally enclosed within either single
|
||||
or double quotes (which are stripped off), and build a vector of
|
||||
pointers to copies of the string for each field. The input string
|
||||
remains unchanged. The last element of the vector is followed by a
|
||||
@code{NULL} element.
|
||||
|
||||
All of the memory for the pointer array and copies of the string
|
||||
is obtained from @code{malloc}. All of the memory can be returned to the
|
||||
system with the single function call @code{freeargv}, which takes the
|
||||
returned result of @code{buildargv}, as it's argument.
|
||||
|
||||
Returns a pointer to the argument vector if successful. Returns
|
||||
@code{NULL} if @var{sp} is @code{NULL} or if there is insufficient
|
||||
memory to complete building the argument vector.
|
||||
|
||||
If the input is a null string (as opposed to a @code{NULL} pointer),
|
||||
then buildarg returns an argument vector that has one arg, a null
|
||||
string.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c bzero.c:6
|
||||
@deftypefn Supplemental void bzero (char *@var{mem}, int @var{count})
|
||||
|
||||
Zeros @var{count} bytes starting at @var{mem}. Use of this function
|
||||
is deprecated in favor of @code{memset}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c calloc.c:6
|
||||
@deftypefn Supplemental void* calloc (size_t @var{nelem}, size_t @var{elsize})
|
||||
|
||||
Uses @code{malloc} to allocate storage for @var{nelem} objects of
|
||||
@var{elsize} bytes each, then zeros the memory.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c choose-temp.c:42
|
||||
@deftypefn Extension char* choose_temp_base (void)
|
||||
|
||||
Return a prefix for temporary file names or @code{NULL} if unable to
|
||||
find one. The current directory is chosen if all else fails so the
|
||||
program is exited if a temporary directory can't be found (@code{mktemp}
|
||||
fails). The buffer for the result is obtained with @code{xmalloc}.
|
||||
|
||||
This function is provided for backwards compatability only. Its use is
|
||||
not recommended.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c make-temp-file.c:88
|
||||
@deftypefn Replacement char* choose_tmpdir ()
|
||||
|
||||
Returns a pointer to a directory path suitable for creating temporary
|
||||
files in.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c clock.c:27
|
||||
@deftypefn Supplemental long clock (void)
|
||||
|
||||
Returns an approximation of the CPU time used by the process as a
|
||||
@code{clock_t}; divide this number by @samp{CLOCKS_PER_SEC} to get the
|
||||
number of seconds used.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c concat.c:24
|
||||
@deftypefn Extension char* concat (const char *@var{s1}, const char *@var{s2}, @dots{}, @code{NULL})
|
||||
|
||||
Concatenate zero or more of strings and return the result in freshly
|
||||
@code{xmalloc}ed memory. Returns @code{NULL} if insufficient memory is
|
||||
available. The argument list is terminated by the first @code{NULL}
|
||||
pointer encountered. Pointers to empty strings are ignored.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c argv.c:65
|
||||
@deftypefn Extension char** dupargv (char **@var{vector})
|
||||
|
||||
Duplicate an argument vector. Simply scans through @var{vector},
|
||||
duplicating each argument until the terminating @code{NULL} is found.
|
||||
Returns a pointer to the argument vector if successful. Returns
|
||||
@code{NULL} if there is insufficient memory to complete building the
|
||||
argument vector.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strerror.c:566
|
||||
@deftypefn Extension int errno_max (void)
|
||||
|
||||
Returns the maximum @code{errno} value for which a corresponding
|
||||
symbolic name or message is available. Note that in the case where we
|
||||
use the @code{sys_errlist} supplied by the system, it is possible for
|
||||
there to be more symbolic names than messages, or vice versa. In
|
||||
fact, the manual page for @code{perror(3C)} explicitly warns that one
|
||||
should check the size of the table (@code{sys_nerr}) before indexing
|
||||
it, since new error codes may be added to the system before they are
|
||||
added to the table. Thus @code{sys_nerr} might be smaller than value
|
||||
implied by the largest @code{errno} value defined in @code{<errno.h>}.
|
||||
|
||||
We return the maximum value that can be used to obtain a meaningful
|
||||
symbolic name or message.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c fdmatch.c:23
|
||||
@deftypefn Extension int fdmatch (int @var{fd1}, int @var{fd2})
|
||||
|
||||
Check to see if two open file descriptors refer to the same file.
|
||||
This is useful, for example, when we have an open file descriptor for
|
||||
an unnamed file, and the name of a file that we believe to correspond
|
||||
to that fd. This can happen when we are exec'd with an already open
|
||||
file (@code{stdout} for example) or from the SVR4 @file{/proc} calls
|
||||
that return open file descriptors for mapped address spaces. All we
|
||||
have to do is open the file by name and check the two file descriptors
|
||||
for a match, which is done by comparing major and minor device numbers
|
||||
and inode numbers.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c ffs.c:3
|
||||
@deftypefn Supplemental int ffs (int @var{valu})
|
||||
|
||||
Find the first (least significant) bit set in @var{valu}. Bits are
|
||||
numbered from right to left, starting with bit 1 (corresponding to the
|
||||
value 1). If @var{valu} is zero, zero is returned.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c fnmatch.txh:1
|
||||
@deftypefn Replacement int fnmatch (const char *@var{pattern}, const char *@var{string}, int @var{flags})
|
||||
|
||||
Matches @var{string} against @var{pattern}, returning zero if it
|
||||
matches, @code{FNM_NOMATCH} if not. @var{pattern} may contain the
|
||||
wildcards @code{?} to match any one character, @code{*} to match any
|
||||
zero or more characters, or a set of alternate characters in square
|
||||
brackets, like @samp{[a-gt8]}, which match one character (@code{a}
|
||||
through @code{g}, or @code{t}, or @code{8}, in this example) if that one
|
||||
character is in the set. A set may be inverted (i.e., match anything
|
||||
except what's in the set) by giving @code{^} or @code{!} as the first
|
||||
character in the set. To include those characters in the set, list them
|
||||
as anything other than the first character of the set. To include a
|
||||
dash in the set, list it last in the set. A backslash character makes
|
||||
the following character not special, so for example you could match
|
||||
against a literal asterisk with @samp{\*}. To match a literal
|
||||
backslash, use @samp{\\}.
|
||||
|
||||
@code{flags} controls various aspects of the matching process, and is a
|
||||
boolean OR of zero or more of the following values (defined in
|
||||
@code{<fnmatch.h>}):
|
||||
|
||||
@table @code
|
||||
|
||||
@item FNM_PATHNAME
|
||||
@itemx FNM_FILE_NAME
|
||||
@var{string} is assumed to be a path name. No wildcard will ever match
|
||||
@code{/}.
|
||||
|
||||
@item FNM_NOESCAPE
|
||||
Do not interpret backslashes as quoting the following special character.
|
||||
|
||||
@item FNM_PERIOD
|
||||
A leading period (at the beginning of @var{string}, or if
|
||||
@code{FNM_PATHNAME} after a slash) is not matched by @code{*} or
|
||||
@code{?} but must be matched explicitly.
|
||||
|
||||
@item FNM_LEADING_DIR
|
||||
Means that @var{string} also matches @var{pattern} if some initial part
|
||||
of @var{string} matches, and is followed by @code{/} and zero or more
|
||||
characters. For example, @samp{foo*} would match either @samp{foobar}
|
||||
or @samp{foobar/grill}.
|
||||
|
||||
@item FNM_CASEFOLD
|
||||
Ignores case when performing the comparison.
|
||||
|
||||
@end table
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c argv.c:111
|
||||
@deftypefn Extension void freeargv (char **@var{vector})
|
||||
|
||||
Free an argument vector that was built using @code{buildargv}. Simply
|
||||
scans through @var{vector}, freeing the memory for each argument until
|
||||
the terminating @code{NULL} is found, and then frees @var{vector}
|
||||
itself.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c getruntime.c:78
|
||||
@deftypefn Replacement long get_run_time (void)
|
||||
|
||||
Returns the time used so far, in microseconds. If possible, this is
|
||||
the time used by this process, else it is the elapsed time since the
|
||||
process started.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c getcwd.c:6
|
||||
@deftypefn Supplemental char* getcwd (char *@var{pathname}, int @var{len})
|
||||
|
||||
Copy the absolute pathname for the current working directory into
|
||||
@var{pathname}, which is assumed to point to a buffer of at least
|
||||
@var{len} bytes, and return a pointer to the buffer. If the current
|
||||
directory's path doesn't fit in @var{len} characters, the result is
|
||||
@code{NULL} and @code{errno} is set. If @var{pathname} is a null pointer,
|
||||
@code{getcwd} will obtain @var{len} bytes of space using
|
||||
@code{malloc}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c getpagesize.c:5
|
||||
@deftypefn Supplemental int getpagesize (void)
|
||||
|
||||
Returns the number of bytes in a page of memory. This is the
|
||||
granularity of many of the system memory management routines. No
|
||||
guarantee is made as to whether or not it is the same as the basic
|
||||
memory management hardware page size.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c getpwd.c:5
|
||||
@deftypefn Supplemental char* getpwd (void)
|
||||
|
||||
Returns the current working directory. This implementation caches the
|
||||
result on the assumption that the process will not call @code{chdir}
|
||||
between calls to @code{getpwd}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c index.c:5
|
||||
@deftypefn Supplemental char* index (char *@var{s}, int @var{c})
|
||||
|
||||
Returns a pointer to the first occurrence of the character @var{c} in
|
||||
the string @var{s}, or @code{NULL} if not found. The use of @code{index} is
|
||||
deprecated in new programs in favor of @code{strchr}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c insque.c:6
|
||||
@deftypefn Supplemental void insque (struct qelem *@var{elem}, struct qelem *@var{pred})
|
||||
@deftypefnx Supplemental void remque (struct qelem *@var{elem})
|
||||
|
||||
Routines to manipulate queues built from doubly linked lists. The
|
||||
@code{insque} routine inserts @var{elem} in the queue immediately
|
||||
after @var{pred}. The @code{remque} routine removes @var{elem} from
|
||||
its containing queue. These routines expect to be passed pointers to
|
||||
structures which have as their first members a forward pointer and a
|
||||
back pointer, like this prototype (although no prototype is provided):
|
||||
|
||||
@example
|
||||
struct qelem @{
|
||||
struct qelem *q_forw;
|
||||
struct qelem *q_back;
|
||||
char q_data[];
|
||||
@};
|
||||
@end example
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c lbasename.c:23
|
||||
@deftypefn Replacement {const char*} lbasename (const char *@var{name})
|
||||
|
||||
Given a pointer to a string containing a typical pathname
|
||||
(@samp{/usr/src/cmd/ls/ls.c} for example), returns a pointer to the
|
||||
last component of the pathname (@samp{ls.c} in this case). The
|
||||
returned pointer is guaranteed to lie within the original
|
||||
string. This latter fact is not true of many vendor C
|
||||
libraries, which return special strings or modify the passed
|
||||
strings for particular input.
|
||||
|
||||
In particular, the empty string returns the same empty string,
|
||||
and a path ending in @code{/} returns the empty string after it.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c make-temp-file.c:138
|
||||
@deftypefn Replacement char* make_temp_file (const char *@var{suffix})
|
||||
|
||||
Return a temporary file name (as a string) or @code{NULL} if unable to
|
||||
create one. @var{suffix} is a suffix to append to the file name. The
|
||||
string is @code{malloc}ed, and the temporary file has been created.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c memchr.c:3
|
||||
@deftypefn Supplemental void* memchr (const void *@var{s}, int @var{c}, size_t @var{n})
|
||||
|
||||
This function searches memory starting at @code{*@var{s}} for the
|
||||
character @var{c}. The search only ends with the first occurrence of
|
||||
@var{c}, or after @var{length} characters; in particular, a null
|
||||
character does not terminate the search. If the character @var{c} is
|
||||
found within @var{length} characters of @code{*@var{s}}, a pointer
|
||||
to the character is returned. If @var{c} is not found, then @code{NULL} is
|
||||
returned.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c memcmp.c:6
|
||||
@deftypefn Supplemental int memcmp (const void *@var{x}, const void *@var{y}, size_t @var{count})
|
||||
|
||||
Compares the first @var{count} bytes of two areas of memory. Returns
|
||||
zero if they are the same, a value less than zero if @var{x} is
|
||||
lexically less than @var{y}, or a value greater than zero if @var{x}
|
||||
is lexically greater than @var{y}. Note that lexical order is determined
|
||||
as if comparing unsigned char arrays.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c memcpy.c:6
|
||||
@deftypefn Supplemental void* memcpy (void *@var{out}, const void *@var{in}, size_t @var{length})
|
||||
|
||||
Copies @var{length} bytes from memory region @var{in} to region
|
||||
@var{out}. Returns a pointer to @var{out}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c memmove.c:6
|
||||
@deftypefn Supplemental void* memmove (void *@var{from}, const void *@var{to}, size_t @var{count})
|
||||
|
||||
Copies @var{count} bytes from memory area @var{from} to memory area
|
||||
@var{to}, returning a pointer to @var{to}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c memset.c:6
|
||||
@deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count})
|
||||
|
||||
Sets the first @var{count} bytes of @var{s} to the constant byte
|
||||
@var{c}, returning a pointer to @var{s}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c mkstemps.c:54
|
||||
@deftypefn Replacement int mkstemps (char *@var{template}, int @var{suffix_len})
|
||||
|
||||
Generate a unique temporary file name from @var{template}.
|
||||
@var{template} has the form:
|
||||
|
||||
@example
|
||||
@var{path}/ccXXXXXX@var{suffix}
|
||||
@end example
|
||||
|
||||
@var{suffix_len} tells us how long @var{suffix} is (it can be zero
|
||||
length). The last six characters of @var{template} before @var{suffix}
|
||||
must be @samp{XXXXXX}; they are replaced with a string that makes the
|
||||
filename unique. Returns a file descriptor open on the file for
|
||||
reading and writing.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c pexecute.c:67
|
||||
@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
|
||||
|
||||
@c strsignal.c:547
|
||||
@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message})
|
||||
|
||||
Print @var{message} to the standard error, followed by a colon,
|
||||
followed by the description of the signal specified by @var{signo},
|
||||
followed by a newline.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c putenv.c:21
|
||||
@deftypefn Supplemental int putenv (const char *@var{string})
|
||||
|
||||
Uses @code{setenv} or @code{unsetenv} to put @var{string} into
|
||||
the environment or remove it. If @var{string} is of the form
|
||||
@samp{name=value} the string is added; if no @samp{=} is present the
|
||||
name is unset/removed.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c pexecute.c:104
|
||||
@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
|
||||
|
||||
@c random.c:39
|
||||
@deftypefn Supplement {long int} random (void)
|
||||
@deftypefnx Supplement void srandom (unsigned int @var{seed})
|
||||
@deftypefnx Supplement void* initstate (unsigned int @var{seed}, void *@var{arg_state}, unsigned long @var{n})
|
||||
@deftypefnx Supplement void* setstate (void *@var{arg_state})
|
||||
|
||||
Random number functions. @code{random} returns a random number in the
|
||||
range 0 to @code{LONG_MAX}. @code{srandom} initializes the random
|
||||
number generator to some starting point determined by @var{seed}
|
||||
(else, the values returned by @code{random} are always the same for each
|
||||
run of the program). @code{initstate} and @code{setstate} allow fine-grained
|
||||
control over the state of the random number generator.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c concat.c:177
|
||||
@deftypefn Extension char* reconcat (char *@var{optr}, const char *@var{s1}, @dots{}, @code{NULL})
|
||||
|
||||
Same as @code{concat}, except that if @var{optr} is not @code{NULL} it
|
||||
is freed after the string is created. This is intended to be useful
|
||||
when you're extending an existing string or building up a string in a
|
||||
loop:
|
||||
|
||||
@example
|
||||
str = reconcat (str, "pre-", str, NULL);
|
||||
@end example
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c rename.c:6
|
||||
@deftypefn Supplemental int rename (const char *@var{old}, const char *@var{new})
|
||||
|
||||
Renames a file from @var{old} to @var{new}. If @var{new} already
|
||||
exists, it is removed.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c rindex.c:5
|
||||
@deftypefn Supplemental char* rindex (const char *@var{s}, int @var{c})
|
||||
|
||||
Returns a pointer to the last occurrence of the character @var{c} in
|
||||
the string @var{s}, or @code{NULL} if not found. The use of @code{rindex} is
|
||||
deprecated in new programs in favor of @code{strrchr}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c setenv.c:22
|
||||
@deftypefn Supplemental int setenv (const char *@var{name}, const char *@var{value}, int @var{overwrite})
|
||||
@deftypefnx Supplemental void unsetenv (const char *@var{name})
|
||||
|
||||
@code{setenv} adds @var{name} to the environment with value
|
||||
@var{value}. If the name was already present in the environment,
|
||||
the new value will be stored only if @var{overwrite} is nonzero.
|
||||
The companion @code{unsetenv} function removes @var{name} from the
|
||||
environment. This implementation is not safe for multithreaded code.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strsignal.c:353
|
||||
@deftypefn Extension int signo_max (void)
|
||||
|
||||
Returns the maximum signal value for which a corresponding symbolic
|
||||
name or message is available. Note that in the case where we use the
|
||||
@code{sys_siglist} supplied by the system, it is possible for there to
|
||||
be more symbolic names than messages, or vice versa. In fact, the
|
||||
manual page for @code{psignal(3b)} explicitly warns that one should
|
||||
check the size of the table (@code{NSIG}) before indexing it, since
|
||||
new signal codes may be added to the system before they are added to
|
||||
the table. Thus @code{NSIG} might be smaller than value implied by
|
||||
the largest signo value defined in @code{<signal.h>}.
|
||||
|
||||
We return the maximum value that can be used to obtain a meaningful
|
||||
symbolic name or message.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c sigsetmask.c:8
|
||||
@deftypefn Supplemental int sigsetmask (int @var{set})
|
||||
|
||||
Sets the signal mask to the one provided in @var{set} and returns
|
||||
the old mask (which, for libiberty's implementation, will always
|
||||
be the value @code{1}).
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c spaces.c:22
|
||||
@deftypefn Extension char* spaces (int @var{count})
|
||||
|
||||
Returns a pointer to a memory region filled with the specified
|
||||
number of spaces and null terminated. The returned pointer is
|
||||
valid until at least the next call.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strcasecmp.c:15
|
||||
@deftypefn Supplemental int strcasecmp (const char *@var{s1}, const char *@var{s2})
|
||||
|
||||
A case-insensitive @code{strcmp}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strchr.c:6
|
||||
@deftypefn Supplemental char* strchr (const char *@var{s}, int @var{c})
|
||||
|
||||
Returns a pointer to the first occurrence of the character @var{c} in
|
||||
the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the
|
||||
null character, the results are undefined.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strdup.c:3
|
||||
@deftypefn Supplemental char* strdup (const char *@var{s})
|
||||
|
||||
Returns a pointer to a copy of @var{s} in memory obtained from
|
||||
@code{malloc}, or @code{NULL} if insufficient memory was available.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strerror.c:670
|
||||
@deftypefn Replacement {const char*} strerrno (int @var{errnum})
|
||||
|
||||
Given an error number returned from a system call (typically returned
|
||||
in @code{errno}), returns a pointer to a string containing the
|
||||
symbolic name of that error number, as found in @code{<errno.h>}.
|
||||
|
||||
If the supplied error number is within the valid range of indices for
|
||||
symbolic names, but no name is available for the particular error
|
||||
number, then returns the string @samp{Error @var{num}}, where @var{num}
|
||||
is the error number.
|
||||
|
||||
If the supplied error number is not within the range of valid
|
||||
indices, then returns @code{NULL}.
|
||||
|
||||
The contents of the location pointed to are only guaranteed to be
|
||||
valid until the next call to @code{strerrno}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strerror.c:602
|
||||
@deftypefn Supplemental char* strerror (int @var{errnoval})
|
||||
|
||||
Maps an @code{errno} number to an error message string, the contents
|
||||
of which are implementation defined. On systems which have the
|
||||
external variables @code{sys_nerr} and @code{sys_errlist}, these
|
||||
strings will be the same as the ones used by @code{perror}.
|
||||
|
||||
If the supplied error number is within the valid range of indices for
|
||||
the @code{sys_errlist}, but no message is available for the particular
|
||||
error number, then returns the string @samp{Error @var{num}}, where
|
||||
@var{num} is the error number.
|
||||
|
||||
If the supplied error number is not a valid index into
|
||||
@code{sys_errlist}, returns @code{NULL}.
|
||||
|
||||
The returned string is only guaranteed to be valid only until the
|
||||
next call to @code{strerror}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strncasecmp.c:15
|
||||
@deftypefn Supplemental int strncasecmp (const char *@var{s1}, const char *@var{s2})
|
||||
|
||||
A case-insensitive @code{strncmp}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strncmp.c:6
|
||||
@deftypefn Supplemental int strncmp (const char *@var{s1}, const char *@var{s2}, size_t @var{n})
|
||||
|
||||
Compares the first @var{n} bytes of two strings, returning a value as
|
||||
@code{strcmp}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strrchr.c:6
|
||||
@deftypefn Supplemental char* strrchr (const char *@var{s}, int @var{c})
|
||||
|
||||
Returns a pointer to the last occurrence of the character @var{c} in
|
||||
the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the
|
||||
null character, the results are undefined.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strsignal.c:388
|
||||
@deftypefn Supplemental {const char *} strsignal (int @var{signo})
|
||||
|
||||
Maps an signal number to an signal message string, the contents of
|
||||
which are implementation defined. On systems which have the external
|
||||
variable @code{sys_siglist}, these strings will be the same as the
|
||||
ones used by @code{psignal()}.
|
||||
|
||||
If the supplied signal number is within the valid range of indices for
|
||||
the @code{sys_siglist}, but no message is available for the particular
|
||||
signal number, then returns the string @samp{Signal @var{num}}, where
|
||||
@var{num} is the signal number.
|
||||
|
||||
If the supplied signal number is not a valid index into
|
||||
@code{sys_siglist}, returns @code{NULL}.
|
||||
|
||||
The returned string is only guaranteed to be valid only until the next
|
||||
call to @code{strsignal}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strsignal.c:452
|
||||
@deftypefn Extension {const char*} strsigno (int @var{signo})
|
||||
|
||||
Given an signal number, returns a pointer to a string containing the
|
||||
symbolic name of that signal number, as found in @code{<signal.h>}.
|
||||
|
||||
If the supplied signal number is within the valid range of indices for
|
||||
symbolic names, but no name is available for the particular signal
|
||||
number, then returns the string @samp{Signal @var{num}}, where
|
||||
@var{num} is the signal number.
|
||||
|
||||
If the supplied signal number is not within the range of valid
|
||||
indices, then returns @code{NULL}.
|
||||
|
||||
The contents of the location pointed to are only guaranteed to be
|
||||
valid until the next call to @code{strsigno}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strstr.c:6
|
||||
@deftypefn Supplemental char* strstr (const char *@var{string}, const char *@var{sub})
|
||||
|
||||
This function searches for the substring @var{sub} in the string
|
||||
@var{string}, not including the terminating null characters. A pointer
|
||||
to the first occurrence of @var{sub} is returned, or @code{NULL} if the
|
||||
substring is absent. If @var{sub} points to a string with zero
|
||||
length, the function returns @var{string}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strtod.c:27
|
||||
@deftypefn Supplemental double strtod (const char *@var{string}, char **@var{endptr})
|
||||
|
||||
This ISO C function converts the initial portion of @var{string} to a
|
||||
@code{double}. If @var{endptr} is not @code{NULL}, a pointer to the
|
||||
character after the last character used in the conversion is stored in
|
||||
the location referenced by @var{endptr}. If no conversion is
|
||||
performed, zero is returned and the value of @var{string} is stored in
|
||||
the location referenced by @var{endptr}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strerror.c:730
|
||||
@deftypefn Extension int strtoerrno (const char *@var{name})
|
||||
|
||||
Given the symbolic name of a error number (e.g., @code{EACCES}), map it
|
||||
to an errno value. If no translation is found, returns 0.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strtol.c:33
|
||||
@deftypefn Supplemental {long int} strtol (const char *@var{string}, char **@var{endptr}, int @var{base})
|
||||
@deftypefnx Supplemental {unsigned long int} strtoul (const char *@var{string}, char **@var{endptr}, int @var{base})
|
||||
|
||||
The @code{strtol} function converts the string in @var{string} to a
|
||||
long integer value according to the given @var{base}, which must be
|
||||
between 2 and 36 inclusive, or be the special value 0. If @var{base}
|
||||
is 0, @code{strtol} will look for the prefixes @code{0} and @code{0x}
|
||||
to indicate bases 8 and 16, respectively, else default to base 10.
|
||||
When the base is 16 (either explicitly or implicitly), a prefix of
|
||||
@code{0x} is allowed. The handling of @var{endptr} is as that of
|
||||
@code{strtod} above. The @code{strtoul} function is the same, except
|
||||
that the converted value is unsigned.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strsignal.c:507
|
||||
@deftypefn Extension int strtosigno (const char *@var{name})
|
||||
|
||||
Given the symbolic name of a signal, map it to a signal number. If no
|
||||
translation is found, returns 0.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c tmpnam.c:3
|
||||
@deftypefn Supplemental char* tmpnam (char *@var{s})
|
||||
|
||||
This function attempts to create a name for a temporary file, which
|
||||
will be a valid file name yet not exist when @code{tmpnam} checks for
|
||||
it. @var{s} must point to a buffer of at least @code{L_tmpnam} bytes,
|
||||
or be @code{NULL}. Use of this function creates a security risk, and it must
|
||||
not be used in new projects. Use @code{mkstemp} instead.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c vasprintf.c:48
|
||||
@deftypefn Extension int vasprintf (char **@var{resptr}, const char *@var{format}, va_list @var{args})
|
||||
|
||||
Like @code{vsprintf}, but instead of passing a pointer to a buffer,
|
||||
you pass a pointer to a pointer. This function will compute the size
|
||||
of the buffer needed, allocate memory with @code{malloc}, and store a
|
||||
pointer to the allocated memory in @code{*@var{resptr}}. The value
|
||||
returned is the same as @code{vsprintf} would return. If memory could
|
||||
not be allocated, zero is returned and @code{NULL} is stored in
|
||||
@code{*@var{resptr}}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c vfork.c:6
|
||||
@deftypefn Supplemental int vfork (void)
|
||||
|
||||
Emulates @code{vfork} by calling @code{fork} and returning its value.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c vprintf.c:3
|
||||
@deftypefn Supplemental int vprintf (const char *@var{format}, va_list @var{ap})
|
||||
@deftypefnx Supplemental int vfprintf (FILE *@var{stream}, const char *@var{format}, va_list @var{ap})
|
||||
@deftypefnx Supplemental int vsprintf (char *@var{str}, const char *@var{format}, va_list @var{ap})
|
||||
|
||||
These functions are the same as @code{printf}, @code{fprintf}, and
|
||||
@code{sprintf}, respectively, except that they are called with a
|
||||
@code{va_list} instead of a variable number of arguments. Note that
|
||||
they do not call @code{va_end}; this is the application's
|
||||
responsibility. In @libib{} they are implemented in terms of the
|
||||
nonstandard but common function @code{_doprnt}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c waitpid.c:3
|
||||
@deftypefn Supplemental int waitpid (int @var{pid}, int *@var{status}, int)
|
||||
|
||||
This is a wrapper around the @code{wait} function. Any ``special''
|
||||
values of @var{pid} depend on your implementation of @code{wait}, as
|
||||
does the return value. The third argument is unused in @libib{}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xatexit.c:11
|
||||
@deftypefun int xatexit (void (*@var{fn}) (void))
|
||||
|
||||
Behaves as the standard @code{atexit} function, but with no limit on
|
||||
the number of registered functions. Returns 0 on success, or @minus{}1 on
|
||||
failure. If you use @code{xatexit} to register functions, you must use
|
||||
@code{xexit} to terminate your program.
|
||||
|
||||
@end deftypefun
|
||||
|
||||
@c xmalloc.c:38
|
||||
@deftypefn Replacement void* xcalloc (size_t @var{nelem}, size_t @var{elsize})
|
||||
|
||||
Allocate memory without fail, and set it to zero. This routine functions
|
||||
like @code{calloc}, but will behave the same as @code{xmalloc} if memory
|
||||
cannot be found.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xexit.c:22
|
||||
@deftypefn Replacement void xexit (int @var{code})
|
||||
|
||||
Terminates the program. If any functions have been registered with
|
||||
the @code{xatexit} replacement function, they will be called first.
|
||||
Termination is handled via the system's normal @code{exit} call.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xmalloc.c:22
|
||||
@deftypefn Replacement void* xmalloc (size_t)
|
||||
|
||||
Allocate memory without fail. If @code{malloc} fails, this will print
|
||||
a message to @code{stderr} (using the name set by
|
||||
@code{xmalloc_set_program_name},
|
||||
if any) and then call @code{xexit}. Note that it is therefore safe for
|
||||
a program to contain @code{#define malloc xmalloc} in its source.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xmalloc.c:53
|
||||
@deftypefn Replacement void xmalloc_failed (size_t)
|
||||
|
||||
This function is not meant to be called by client code, and is listed
|
||||
here for completeness only. If any of the allocation routines fail, this
|
||||
function will be called to print an error message and terminate execution.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xmalloc.c:46
|
||||
@deftypefn Replacement void xmalloc_set_program_name (const char *@var{name})
|
||||
|
||||
You can use this to set the name of the program used by
|
||||
@code{xmalloc_failed} when printing a failure message.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xmemdup.c:7
|
||||
@deftypefn Replacement void* xmemdup (void *@var{input}, size_t @var{copy_size}, size_t @var{alloc_size})
|
||||
|
||||
Duplicates a region of memory without fail. First, @var{alloc_size} bytes
|
||||
are allocated, then @var{copy_size} bytes from @var{input} are copied into
|
||||
it, and the new memory is returned. If fewer bytes are copied than were
|
||||
allocated, the remaining memory is zeroed.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xmalloc.c:32
|
||||
@deftypefn Replacement void* xrealloc (void *@var{ptr}, size_t @var{size})
|
||||
Reallocate memory without fail. This routine functions like @code{realloc},
|
||||
but will behave the same as @code{xmalloc} if memory cannot be found.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xstrdup.c:7
|
||||
@deftypefn Replacement char* xstrdup (const char *@var{s})
|
||||
|
||||
Duplicates a character string without fail, using @code{xmalloc} to
|
||||
obtain memory.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xstrerror.c:7
|
||||
@deftypefn Replacement char* xstrerror (int @var{errnum})
|
||||
|
||||
Behaves exactly like the standard @code{strerror} function, but
|
||||
will never return a @code{NULL} pointer.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# -*- perl -*-
|
||||
|
||||
# Copyright (C) 2001
|
||||
# Free Software Foundation
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# Originally written by DJ Delorie <[email protected]>
|
||||
|
||||
|
||||
|
||||
# This program looks for texinfo snippets in source files and other
|
||||
# files, and builds per-category files with entries sorted in
|
||||
# alphabetical order.
|
||||
|
||||
# The syntax it looks for is lines starting with '@def' in *.c and
|
||||
# other files (see TEXIFILES in Makefile.in). Entries are terminated
|
||||
# at the next @def* (which begins a new entry) or, for C files, a line
|
||||
# that begins with '*/' without leading spaces (this assumes that the
|
||||
# texinfo snippet is within a C-style /* */ comment).
|
||||
|
||||
#
|
||||
|
||||
|
||||
|
||||
if ($ARGV[0] eq "-v") {
|
||||
$verbose = 1;
|
||||
shift;
|
||||
}
|
||||
|
||||
$srcdir = shift;
|
||||
$outfile = shift;
|
||||
|
||||
if ($outfile !~ /\S/ || ! -f "$srcdir/Makefile.in" ) {
|
||||
print STDERR "Usage: gather-docs [-v] srcdir outfile.txi [files with snippets in them ...]\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
$errors = 0;
|
||||
|
||||
for $in (@ARGV) {
|
||||
|
||||
if (!open(IN, "$srcdir/$in")) {
|
||||
print STDERR "Cannot open $srcdir/$in for reading: $!\n";
|
||||
$errors ++;
|
||||
|
||||
} else {
|
||||
$first = 1;
|
||||
$pertinent = 0;
|
||||
$man_mode = 0;
|
||||
$line = 0;
|
||||
|
||||
while (<IN>) {
|
||||
$line ++;
|
||||
$pertinent = 1 if /^\@def[a-z]*[a-wyz] /;
|
||||
$pertinent = 0 if /^\*\//;
|
||||
next unless $pertinent;
|
||||
|
||||
if (/^\@def[a-z]*[a-wyz] /) {
|
||||
|
||||
($name) = m/[^\(]* ([^\( \t\r\n]+) *\(/;
|
||||
$name =~ s/[ ]*$//;
|
||||
$key = $name;
|
||||
$key =~ tr/A-Z/a-z/;
|
||||
$key =~ s/[^a-z0-9]+/ /g;
|
||||
$name{$key} = $node;
|
||||
$lines{$key} = '';
|
||||
$src_file{$key} = $in;
|
||||
$src_line{$key} = $line;
|
||||
print "\nReading $in :" if $verbose && $first;
|
||||
$first = 0;
|
||||
print " $name" if $verbose;
|
||||
$node_lines{$key} .= $_;
|
||||
|
||||
} else {
|
||||
$node_lines{$key} .= $_;
|
||||
}
|
||||
|
||||
$pertinent = 0 if /^\@end def/;
|
||||
}
|
||||
close (IN);
|
||||
}
|
||||
}
|
||||
|
||||
print "\n" if $verbose;
|
||||
exit $errors if $errors;
|
||||
|
||||
if (!open (OUT, "> $outfile")) {
|
||||
print STDERR "Cannot open $outfile for writing: $!\n";
|
||||
$errors ++;
|
||||
next;
|
||||
}
|
||||
print "Writing $outfile\n" if $verbose;
|
||||
|
||||
print OUT "\@c Automatically generated from *.c and others (the comments before\n";
|
||||
print OUT "\@c each entry tell you which file and where in that file). DO NOT EDIT!\n";
|
||||
print OUT "\@c Edit the *.c files, configure with --enable-maintainer-mode,\n";
|
||||
print OUT "\@c and let gather-docs build you a new copy.\n\n";
|
||||
|
||||
for $key (sort keys %name) {
|
||||
print OUT "\@c $src_file{$key}:$src_line{$key}\n";
|
||||
print OUT $node_lines{$key};
|
||||
print OUT "\n";
|
||||
}
|
||||
|
||||
if (! print OUT "\n") {
|
||||
print STDERR "Disk full writing $srcdir/$cat.texi\n";
|
||||
$errors ++;
|
||||
}
|
||||
|
||||
close (OUT);
|
||||
|
||||
exit $errors;
|
||||
@@ -1,324 +0,0 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename libiberty.info
|
||||
@settitle @sc{gnu} libiberty
|
||||
@c %**end of header
|
||||
|
||||
@syncodeindex fn cp
|
||||
@syncodeindex vr cp
|
||||
@syncodeindex pg cp
|
||||
|
||||
@finalout
|
||||
@c %**end of header
|
||||
|
||||
@dircategory GNU libraries
|
||||
@direntry
|
||||
* Libiberty: (libiberty). Library of utility functions which
|
||||
are missing or broken on some systems.
|
||||
@end direntry
|
||||
|
||||
@macro libib
|
||||
@code{libiberty}
|
||||
@end macro
|
||||
|
||||
@c The edition date is written in three locations. Search for 'thedate'.
|
||||
@ifinfo
|
||||
This manual describes the GNU @libib library of utility subroutines.
|
||||
This edition accompanies GCC 3, September 2001.
|
||||
|
||||
Copyright @copyright{} 2001 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.1
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, with no Front-Cover Texts, and with no
|
||||
Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled ``GNU Free Documentation License''.
|
||||
|
||||
@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
|
||||
@end ifinfo
|
||||
|
||||
|
||||
@c The edition date is written in three locations. Search for 'thedate'.
|
||||
@titlepage
|
||||
@title @sc{gnu} libiberty
|
||||
@subtitle September 2001
|
||||
@subtitle for GCC 3
|
||||
@author Phil Edwards et al.
|
||||
@page
|
||||
|
||||
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 2001 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.1
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, with no Front-Cover Texts, and with no
|
||||
Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled ``GNU Free Documentation License''.
|
||||
|
||||
@end titlepage
|
||||
@contents
|
||||
@page
|
||||
|
||||
@ifnottex
|
||||
@node Top,Using,,
|
||||
@top Introduction
|
||||
|
||||
The @libib{} library is a collection of subroutines used by various
|
||||
GNU programs. It is available under the Library General Public
|
||||
License; for more information, see @ref{Library Copying}.
|
||||
|
||||
@c The edition date is written in three locations. Search for 'thedate'.
|
||||
This edition accompanies GCC 3, September 2001.
|
||||
|
||||
@end ifnottex
|
||||
|
||||
@menu
|
||||
* Using:: How to use libiberty in your code.
|
||||
|
||||
* Overview:: Overview of available function groups.
|
||||
|
||||
* Functions:: Available functions, macros, and global variables.
|
||||
|
||||
* Obstacks:: Object Stacks.
|
||||
|
||||
* Licenses:: The various licenses under which libiberty sources are
|
||||
distributed.
|
||||
|
||||
* Index:: Index of functions and categories.
|
||||
@end menu
|
||||
|
||||
@node Using
|
||||
@chapter Using
|
||||
@cindex using libiberty
|
||||
@cindex libiberty usage
|
||||
@cindex how to use
|
||||
|
||||
@c THIS SECTION IS CRAP AND NEEDS REWRITING BADLY.
|
||||
|
||||
To date, @libib{} is generally not installed on its own. It has evolved
|
||||
over years but does not have its own version number nor release schedule.
|
||||
|
||||
Possibly the easiest way to use @libib{} in your projects is to drop the
|
||||
@libib{} code into your project's sources, and to build the library along
|
||||
with your own sources; the library would then be linked in at the end. This
|
||||
prevents any possible version mismatches with other copies of libiberty
|
||||
elsewhere on the system.
|
||||
|
||||
Passing @option{--enable-install-libiberty} to the @command{configure}
|
||||
script when building @libib{} causes the header files and archive library
|
||||
to be installed when @kbd{make install} is run. This option also takes
|
||||
an (optional) argument to specify the installation location, in the same
|
||||
manner as @option{--prefix}.
|
||||
|
||||
For your own projects, an approach which offers stability and flexibility
|
||||
is to include @libib{} with your code, but allow the end user to optionally
|
||||
choose to use a previously-installed version instead. In this way the
|
||||
user may choose (for example) to install @libib{} as part of GCC, and use
|
||||
that version for all software built with that compiler. (This approach
|
||||
has proven useful with software using the GNU @code{readline} library.)
|
||||
|
||||
Making use of @libib{} code usually requires that you include one or more
|
||||
header files from the @libib{} distribution. (They will be named as
|
||||
necessary in the function descriptions.) At link time, you will need to
|
||||
add @option{-liberty} to your link command invocation.
|
||||
|
||||
|
||||
@node Overview
|
||||
@chapter Overview
|
||||
|
||||
Functions contained in @libib{} can be divided into three general categories.
|
||||
|
||||
|
||||
@menu
|
||||
* Supplemental Functions:: Providing functions which don't exist
|
||||
on older operating systems.
|
||||
|
||||
* Replacement Functions:: These functions are sometimes buggy or
|
||||
unpredictable on some operating systems.
|
||||
|
||||
* Extensions:: Functions which provide useful extensions
|
||||
or safety wrappers around existing code.
|
||||
@end menu
|
||||
|
||||
@node Supplemental Functions
|
||||
@section Supplemental Functions
|
||||
@cindex supplemental functions
|
||||
@cindex functions, supplemental
|
||||
@cindex functions, missing
|
||||
|
||||
Certain operating systems do not provide functions which have since
|
||||
become standardized, or at least common. For example, the Single
|
||||
Unix Specification Version 2 requires that the @code{basename}
|
||||
function be provided, but an OS which predates that specification
|
||||
might not have this function. This should not prevent well-written
|
||||
code from running on such a system.
|
||||
|
||||
Similarly, some functions exist only among a particular ``flavor''
|
||||
or ``family'' of operating systems. As an example, the @code{bzero}
|
||||
function is often not present on systems outside the BSD-derived
|
||||
family of systems.
|
||||
|
||||
Many such functions are provided in @libib{}. They are quickly
|
||||
listed here with little description, as systems which lack them
|
||||
become less and less common. Each function @var{foo} is implemented
|
||||
in @file{@var{foo}.c} but not declared in any @libib{} header file; more
|
||||
comments and caveats for each function's implementation are often
|
||||
available in the source file. Generally, the function can simply
|
||||
be declared as @code{extern}.
|
||||
|
||||
|
||||
|
||||
@node Replacement Functions
|
||||
@section Replacement Functions
|
||||
@cindex replacement functions
|
||||
@cindex functions, replacement
|
||||
|
||||
Some functions have extremely limited implementations on different
|
||||
platforms. Other functions are tedious to use correctly; for example,
|
||||
proper use of @code{malloc} calls for the return value to be checked and
|
||||
appropriate action taken if memory has been exhausted. A group of
|
||||
``replacement functions'' is available in @libib{} to address these issues
|
||||
for some of the most commonly used subroutines.
|
||||
|
||||
All of these functions are declared in the @file{libiberty.h} header
|
||||
file. Many of the implementations will use preprocessor macros set by
|
||||
GNU Autoconf, if you decide to make use of that program. Some of these
|
||||
functions may call one another.
|
||||
|
||||
|
||||
@menu
|
||||
* Memory Allocation:: Testing and handling failed memory
|
||||
requests automatically.
|
||||
* Exit Handlers:: Calling routines on program exit.
|
||||
* Error Reporting:: Mapping errno and signal numbers to
|
||||
more useful string formats.
|
||||
@end menu
|
||||
|
||||
@node Memory Allocation
|
||||
@subsection Memory Allocation
|
||||
@cindex memory allocation
|
||||
|
||||
The functions beginning with the letter @samp{x} are wrappers around
|
||||
standard functions; the functions provided by the system environment
|
||||
are called and their results checked before the results are passed back
|
||||
to client code. If the standard functions fail, these wrappers will
|
||||
terminate the program. Thus, these versions can be used with impunity.
|
||||
|
||||
|
||||
@node Exit Handlers
|
||||
@subsection Exit Handlers
|
||||
@cindex exit handlers
|
||||
|
||||
The existence and implementation of the @code{atexit} routine varies
|
||||
amongst the flavors of Unix. @libib{} provides an unvarying dependable
|
||||
implementation via @code{xatexit} and @code{xexit}.
|
||||
|
||||
|
||||
@node Error Reporting
|
||||
@subsection Error Reporting
|
||||
@cindex error reporting
|
||||
|
||||
These are a set of routines to facilitate programming with the system
|
||||
@code{errno} interface. The @libib{} source file @file{strerror.c}
|
||||
contains a good deal of documentation for these functions.
|
||||
|
||||
@c signal stuff
|
||||
|
||||
|
||||
@node Extensions
|
||||
@section Extensions
|
||||
@cindex extensions
|
||||
@cindex functions, extension
|
||||
|
||||
@libib{} includes additional functionality above and beyond standard
|
||||
functions, which has proven generically useful in GNU programs, such as
|
||||
obstacks and regex. These functions are often copied from other
|
||||
projects as they gain popularity, and are included here to provide a
|
||||
central location from which to use, maintain, and distribute them.
|
||||
|
||||
@menu
|
||||
* Obstacks:: Stacks of arbitrary objects.
|
||||
@end menu
|
||||
|
||||
@c This is generated from the glibc manual using a make-obstacks-texi.sh
|
||||
@c script of Phil's. Hope it's accurate.
|
||||
@include obstacks.texi
|
||||
|
||||
@node Functions
|
||||
@chapter Function, Variable, and Macro Listing.
|
||||
@include functions.texi
|
||||
|
||||
@node Licenses
|
||||
@appendix Licenses
|
||||
|
||||
@menu
|
||||
|
||||
* Library Copying:: The GNU Library General Public License
|
||||
* BSD:: Regents of the University of California
|
||||
|
||||
@end menu
|
||||
|
||||
@c This takes care of Library Copying. It is the copying-lib.texi from the
|
||||
@c GNU web site, with its @node line altered to make makeinfo shut up.
|
||||
@include copying-lib.texi
|
||||
|
||||
@page
|
||||
@node BSD
|
||||
@appendixsec BSD
|
||||
|
||||
Copyright @copyright{} 1990 Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
@enumerate
|
||||
|
||||
@item
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
@item
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
@item
|
||||
[rescinded 22 July 1999]
|
||||
|
||||
@item
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
@end enumerate
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
@node Index
|
||||
@unnumbered Index
|
||||
|
||||
@printindex cp
|
||||
|
||||
@bye
|
||||
|
||||
@@ -1,278 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# -*- perl -*-
|
||||
|
||||
# Copyright (C) 2001
|
||||
# Free Software Foundation
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# Originally written by DJ Delorie <[email protected]>
|
||||
|
||||
|
||||
# This is a trivial script which checks the lists of C and O files in
|
||||
# the Makefile for consistency.
|
||||
|
||||
$mode = shift;
|
||||
$srcdir = ".";
|
||||
|
||||
if ($mode eq "-s") {
|
||||
$srcdir = shift;
|
||||
$mode = shift;
|
||||
}
|
||||
|
||||
&missing() if $mode eq "missing";
|
||||
&undoc() if $mode eq "undoc";
|
||||
&deps() if $mode eq "deps";
|
||||
|
||||
exit 0;
|
||||
|
||||
format STDOUT =
|
||||
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~
|
||||
$out
|
||||
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~
|
||||
$out
|
||||
.
|
||||
|
||||
######################################################################
|
||||
|
||||
sub missing {
|
||||
|
||||
opendir(S, $srcdir);
|
||||
while ($f = readdir S) {
|
||||
$have{$f} = 1;
|
||||
}
|
||||
closedir(S);
|
||||
opendir(S, ".");
|
||||
while ($f = readdir S) {
|
||||
$have{$f} = 1;
|
||||
}
|
||||
closedir(S);
|
||||
|
||||
for $a (@ARGV) {
|
||||
$listed{$a} = 1;
|
||||
$have{$a} = 0;
|
||||
}
|
||||
|
||||
for $f (sort keys %have) {
|
||||
next unless $have{$f};
|
||||
if ($f =~ /\.c$/) {
|
||||
print "S $f\n";
|
||||
}
|
||||
}
|
||||
for $f (sort keys %listed) {
|
||||
if ($f =~ /(.*)\.c$/) {
|
||||
$base = $1;
|
||||
if (! $listed{"$base.o"}) {
|
||||
print "O $f\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
|
||||
sub undoc {
|
||||
|
||||
opendir(S, $srcdir);
|
||||
while ($file = readdir S) {
|
||||
if ($file =~ /\.texi$/) {
|
||||
open(T, "$srcdir/$file");
|
||||
while (<T>) {
|
||||
if (/^\@deftype[^\(]* ([^\s\(]+) *\(/) {
|
||||
$documented{$1} = 1;
|
||||
}
|
||||
}
|
||||
close(T);
|
||||
}
|
||||
if ($file =~ /\.c$/) {
|
||||
open(C, "$srcdir/$file");
|
||||
while (<C>) {
|
||||
if (/\@undocumented (\S+)/) {
|
||||
$documented{$1} = 1;
|
||||
}
|
||||
if (/^static /) {
|
||||
if (! /[\(;]/) {
|
||||
s/[\r\n]+$/ /;
|
||||
$_ .= <C>;
|
||||
}
|
||||
while ($_ =~ /\([^\)]*$/) {
|
||||
s/[\r\n]+$/ /;
|
||||
$_ .= <C>;
|
||||
}
|
||||
}
|
||||
s/ VPARAMS([ \(])/$1/;
|
||||
s/PREFIX\(([^\)]*)\)/byte_$1/;
|
||||
if (/^static [^\(]* ([^\s\(]+) *\(.*\)$/) {
|
||||
$documented{$1} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(D);
|
||||
|
||||
# $out = join(' ', sort keys %documented);
|
||||
# write;
|
||||
# print "\n";
|
||||
|
||||
system "etags $srcdir/*.c $srcdir/../include/*.h";
|
||||
open(TAGS, "TAGS");
|
||||
while (<TAGS>) {
|
||||
s/[\r\n]+$//;
|
||||
if (/^\014$/) {
|
||||
$filename = <TAGS>;
|
||||
$filename =~ s/[\r\n]+$//;
|
||||
$filename =~ s/,\d+$//;
|
||||
$filename =~ s@.*[/\\]@@;
|
||||
next;
|
||||
}
|
||||
if ($filename =~ /\.c$/ ) {
|
||||
next unless /^[_a-zA-Z]/;
|
||||
} else {
|
||||
next unless /^\# *define/;
|
||||
s/\# *define *//;
|
||||
}
|
||||
next if $filename =~ /mpw\.c/;
|
||||
|
||||
s/ VPARAMS//;
|
||||
s/ *\177.*//;
|
||||
s/,$//;
|
||||
s/DEFUN\(//;
|
||||
s/\(//;
|
||||
|
||||
next if /^static /;
|
||||
next if /\s/;
|
||||
next if /^_/;
|
||||
next if $documented{$_};
|
||||
next if /_H_?$/;
|
||||
|
||||
if ($seen_in{$_} ne $filename) {
|
||||
$saw{$_} ++;
|
||||
}
|
||||
$seen_in{$_} = $filename;
|
||||
}
|
||||
|
||||
for $k (keys %saw) {
|
||||
delete $saw{$k} if $saw{$k} > 1;
|
||||
}
|
||||
|
||||
for $k (sort keys %saw) {
|
||||
$fromfile{$seen_in{$k}} .= " " if $fromfile{$seen_in{$k}};
|
||||
$fromfile{$seen_in{$k}} .= $k;
|
||||
}
|
||||
|
||||
for $f (sort keys %fromfile) {
|
||||
$out = "$f: $fromfile{$f}";
|
||||
write;
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
|
||||
sub deps_for {
|
||||
my($f) = @_;
|
||||
my(%d);
|
||||
open(F, $f);
|
||||
%d = ();
|
||||
while (<F>) {
|
||||
if (/^#\s*include\s+["<](.*)[">]/) {
|
||||
$d{$1} = 1;
|
||||
}
|
||||
}
|
||||
close(F);
|
||||
return keys %d;
|
||||
}
|
||||
|
||||
sub canonicalize {
|
||||
my ($p) = @_;
|
||||
0 while $p =~ s@/\./@/@g;
|
||||
0 while $p =~ s@^\./@@g;
|
||||
0 while $p =~ s@/[^/]+/\.\./@/@g;
|
||||
return $p;
|
||||
}
|
||||
|
||||
sub locals_first {
|
||||
my ($a,$b) = @_;
|
||||
return -1 if $a eq "config.h";
|
||||
return 1 if $b eq "config.h";
|
||||
return $a cmp $b;
|
||||
}
|
||||
|
||||
sub deps {
|
||||
|
||||
$incdir = shift @ARGV;
|
||||
|
||||
opendir(INC, $incdir);
|
||||
while ($f = readdir INC) {
|
||||
next unless $f =~ /\.h$/;
|
||||
$mine{$f} = "\$(INCDIR)/$f";
|
||||
$deps{$f} = join(' ', &deps_for("$incdir/$f"));
|
||||
}
|
||||
$mine{'config.h'} = "config.h";
|
||||
|
||||
open(IN, "$srcdir/Makefile.in");
|
||||
open(OUT, ">$srcdir/Makefile.tmp");
|
||||
while (<IN>) {
|
||||
last if /remainder of this file/;
|
||||
print OUT;
|
||||
}
|
||||
print OUT "# The dependencies in the remainder of this file are automatically\n";
|
||||
print OUT "# generated by \"make maint-deps\". Manual edits will be lost.\n\n";
|
||||
|
||||
opendir(S, $srcdir);
|
||||
for $f (sort readdir S) {
|
||||
if ($f =~ /\.c$/) {
|
||||
|
||||
%scanned = ();
|
||||
@pending = &deps_for("$srcdir/$f");
|
||||
while (@pending) {
|
||||
@tmp = @pending;
|
||||
@pending = ();
|
||||
for $p (@tmp) {
|
||||
next unless $mine{$p};
|
||||
if (!$scanned{$p}) {
|
||||
push(@pending, split(' ', $deps{$p}));
|
||||
$scanned{$p} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@deps = sort { &locals_first($a,$b) } keys %scanned;
|
||||
$obj = $f;
|
||||
$obj =~ s/\.c$/.o/;
|
||||
$obj = "$obj:";
|
||||
if ($#deps >= 0) {
|
||||
print OUT $obj;
|
||||
$len = length($obj);
|
||||
for $dt (@deps) {
|
||||
$d = $mine{$dt};
|
||||
if ($len + length($d) > 70) {
|
||||
printf OUT " \\\n\t$d";
|
||||
$len = 8 + length($d);
|
||||
} else {
|
||||
print OUT " $d";
|
||||
$len += length($d) + 1;
|
||||
}
|
||||
}
|
||||
print OUT "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(S);
|
||||
close(IN);
|
||||
close(OUT);
|
||||
|
||||
rename("$srcdir/Makefile.tmp", "$srcdir/Makefile.in");
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
/* Utility to pick a temporary filename prefix.
|
||||
Copyright (C) 1996, 1997, 1998, 2001 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. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h> /* May get P_tmpdir. */
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h> /* May get R_OK, etc. on some systems. */
|
||||
#endif
|
||||
|
||||
#ifndef R_OK
|
||||
#define R_OK 4
|
||||
#define W_OK 2
|
||||
#define X_OK 1
|
||||
#endif
|
||||
|
||||
#include "libiberty.h"
|
||||
extern int mkstemps PARAMS ((char *, int));
|
||||
|
||||
/* '/' works just fine on MS-DOS based systems. */
|
||||
#ifndef DIR_SEPARATOR
|
||||
#define DIR_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
/* Name of temporary file.
|
||||
mktemp requires 6 trailing X's. */
|
||||
#define TEMP_FILE "ccXXXXXX"
|
||||
#define TEMP_FILE_LEN (sizeof(TEMP_FILE) - 1)
|
||||
|
||||
/* Subroutine of choose_tmpdir.
|
||||
If BASE is non-NULL, return it.
|
||||
Otherwise it checks if DIR is a usable directory.
|
||||
If success, DIR is returned.
|
||||
Otherwise NULL is returned. */
|
||||
|
||||
static inline const char *try PARAMS ((const char *, const char *));
|
||||
|
||||
static inline const char *
|
||||
try (dir, base)
|
||||
const char *dir, *base;
|
||||
{
|
||||
if (base != 0)
|
||||
return base;
|
||||
if (dir != 0
|
||||
&& access (dir, R_OK | W_OK | X_OK) == 0)
|
||||
return dir;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 };
|
||||
static const char usrtmp[] =
|
||||
{ DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
|
||||
static const char vartmp[] =
|
||||
{ DIR_SEPARATOR, 'v', 'a', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
|
||||
|
||||
static char *memoized_tmpdir;
|
||||
|
||||
/*
|
||||
|
||||
@deftypefn Replacement char* choose_tmpdir ()
|
||||
|
||||
Returns a pointer to a directory path suitable for creating temporary
|
||||
files in.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
*/
|
||||
|
||||
char *
|
||||
choose_tmpdir ()
|
||||
{
|
||||
const char *base = 0;
|
||||
char *tmpdir;
|
||||
unsigned int len;
|
||||
|
||||
if (memoized_tmpdir)
|
||||
return memoized_tmpdir;
|
||||
|
||||
base = try (getenv ("TMPDIR"), base);
|
||||
base = try (getenv ("TMP"), base);
|
||||
base = try (getenv ("TEMP"), base);
|
||||
|
||||
#ifdef P_tmpdir
|
||||
base = try (P_tmpdir, base);
|
||||
#endif
|
||||
|
||||
/* Try /var/tmp, /usr/tmp, then /tmp. */
|
||||
base = try (vartmp, base);
|
||||
base = try (usrtmp, base);
|
||||
base = try (tmp, base);
|
||||
|
||||
/* If all else fails, use the current directory! */
|
||||
if (base == 0)
|
||||
base = ".";
|
||||
|
||||
/* Append DIR_SEPARATOR to the directory we've chosen
|
||||
and return it. */
|
||||
len = strlen (base);
|
||||
tmpdir = xmalloc (len + 2);
|
||||
strcpy (tmpdir, base);
|
||||
tmpdir[len] = DIR_SEPARATOR;
|
||||
tmpdir[len+1] = '\0';
|
||||
|
||||
memoized_tmpdir = tmpdir;
|
||||
return tmpdir;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@deftypefn Replacement char* make_temp_file (const char *@var{suffix})
|
||||
|
||||
Return a temporary file name (as a string) or @code{NULL} if unable to
|
||||
create one. @var{suffix} is a suffix to append to the file name. The
|
||||
string is @code{malloc}ed, and the temporary file has been created.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
*/
|
||||
|
||||
char *
|
||||
make_temp_file (suffix)
|
||||
const char *suffix;
|
||||
{
|
||||
const char *base = choose_tmpdir ();
|
||||
char *temp_filename;
|
||||
int base_len, suffix_len;
|
||||
int fd;
|
||||
|
||||
if (suffix == 0)
|
||||
suffix = "";
|
||||
|
||||
base_len = strlen (base);
|
||||
suffix_len = strlen (suffix);
|
||||
|
||||
temp_filename = xmalloc (base_len
|
||||
+ TEMP_FILE_LEN
|
||||
+ suffix_len + 1);
|
||||
strcpy (temp_filename, base);
|
||||
strcpy (temp_filename + base_len, TEMP_FILE);
|
||||
strcpy (temp_filename + base_len + TEMP_FILE_LEN, suffix);
|
||||
|
||||
fd = mkstemps (temp_filename, suffix_len);
|
||||
/* If mkstemps failed, then something bad is happening. Maybe we should
|
||||
issue a message about a possible security attack in progress? */
|
||||
if (fd == -1)
|
||||
abort ();
|
||||
/* Similarly if we can not close the file. */
|
||||
if (close (fd))
|
||||
abort ();
|
||||
return temp_filename;
|
||||
}
|
||||
@@ -1,758 +0,0 @@
|
||||
@node Obstacks,Licenses,Functions,Top
|
||||
@chapter Obstacks
|
||||
@cindex obstacks
|
||||
|
||||
An @dfn{obstack} is a pool of memory containing a stack of objects. You
|
||||
can create any number of separate obstacks, and then allocate objects in
|
||||
specified obstacks. Within each obstack, the last object allocated must
|
||||
always be the first one freed, but distinct obstacks are independent of
|
||||
each other.
|
||||
|
||||
Aside from this one constraint of order of freeing, obstacks are totally
|
||||
general: an obstack can contain any number of objects of any size. They
|
||||
are implemented with macros, so allocation is usually very fast as long as
|
||||
the objects are usually small. And the only space overhead per object is
|
||||
the padding needed to start each object on a suitable boundary.
|
||||
|
||||
@menu
|
||||
* Creating Obstacks:: How to declare an obstack in your program.
|
||||
* Preparing for Obstacks:: Preparations needed before you can
|
||||
use obstacks.
|
||||
* Allocation in an Obstack:: Allocating objects in an obstack.
|
||||
* Freeing Obstack Objects:: Freeing objects in an obstack.
|
||||
* Obstack Functions:: The obstack functions are both
|
||||
functions and macros.
|
||||
* Growing Objects:: Making an object bigger by stages.
|
||||
* Extra Fast Growing:: Extra-high-efficiency (though more
|
||||
complicated) growing objects.
|
||||
* Status of an Obstack:: Inquiries about the status of an obstack.
|
||||
* Obstacks Data Alignment:: Controlling alignment of objects in obstacks.
|
||||
* Obstack Chunks:: How obstacks obtain and release chunks;
|
||||
efficiency considerations.
|
||||
* Summary of Obstacks::
|
||||
@end menu
|
||||
|
||||
@node Creating Obstacks
|
||||
@section Creating Obstacks
|
||||
|
||||
The utilities for manipulating obstacks are declared in the header
|
||||
file @file{obstack.h}.
|
||||
@pindex obstack.h
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftp {Data Type} {struct obstack}
|
||||
An obstack is represented by a data structure of type @code{struct
|
||||
obstack}. This structure has a small fixed size; it records the status
|
||||
of the obstack and how to find the space in which objects are allocated.
|
||||
It does not contain any of the objects themselves. You should not try
|
||||
to access the contents of the structure directly; use only the functions
|
||||
described in this chapter.
|
||||
@end deftp
|
||||
|
||||
You can declare variables of type @code{struct obstack} and use them as
|
||||
obstacks, or you can allocate obstacks dynamically like any other kind
|
||||
of object. Dynamic allocation of obstacks allows your program to have a
|
||||
variable number of different stacks. (You can even allocate an
|
||||
obstack structure in another obstack, but this is rarely useful.)
|
||||
|
||||
All the functions that work with obstacks require you to specify which
|
||||
obstack to use. You do this with a pointer of type @code{struct obstack
|
||||
*}. In the following, we often say ``an obstack'' when strictly
|
||||
speaking the object at hand is such a pointer.
|
||||
|
||||
The objects in the obstack are packed into large blocks called
|
||||
@dfn{chunks}. The @code{struct obstack} structure points to a chain of
|
||||
the chunks currently in use.
|
||||
|
||||
The obstack library obtains a new chunk whenever you allocate an object
|
||||
that won't fit in the previous chunk. Since the obstack library manages
|
||||
chunks automatically, you don't need to pay much attention to them, but
|
||||
you do need to supply a function which the obstack library should use to
|
||||
get a chunk. Usually you supply a function which uses @code{malloc}
|
||||
directly or indirectly. You must also supply a function to free a chunk.
|
||||
These matters are described in the following section.
|
||||
|
||||
@node Preparing for Obstacks
|
||||
@section Preparing for Using Obstacks
|
||||
|
||||
Each source file in which you plan to use the obstack functions
|
||||
must include the header file @file{obstack.h}, like this:
|
||||
|
||||
@smallexample
|
||||
#include <obstack.h>
|
||||
@end smallexample
|
||||
|
||||
@findex obstack_chunk_alloc
|
||||
@findex obstack_chunk_free
|
||||
Also, if the source file uses the macro @code{obstack_init}, it must
|
||||
declare or define two functions or macros that will be called by the
|
||||
obstack library. One, @code{obstack_chunk_alloc}, is used to allocate
|
||||
the chunks of memory into which objects are packed. The other,
|
||||
@code{obstack_chunk_free}, is used to return chunks when the objects in
|
||||
them are freed. These macros should appear before any use of obstacks
|
||||
in the source file.
|
||||
|
||||
Usually these are defined to use @code{malloc} via the intermediary
|
||||
@code{xmalloc} (@pxref{Unconstrained Allocation, , , libc, The GNU C Library Reference Manual}). This is done with
|
||||
the following pair of macro definitions:
|
||||
|
||||
@smallexample
|
||||
#define obstack_chunk_alloc xmalloc
|
||||
#define obstack_chunk_free free
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Though the memory you get using obstacks really comes from @code{malloc},
|
||||
using obstacks is faster because @code{malloc} is called less often, for
|
||||
larger blocks of memory. @xref{Obstack Chunks}, for full details.
|
||||
|
||||
At run time, before the program can use a @code{struct obstack} object
|
||||
as an obstack, it must initialize the obstack by calling
|
||||
@code{obstack_init}.
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun int obstack_init (struct obstack *@var{obstack-ptr})
|
||||
Initialize obstack @var{obstack-ptr} for allocation of objects. This
|
||||
function calls the obstack's @code{obstack_chunk_alloc} function. If
|
||||
allocation of memory fails, the function pointed to by
|
||||
@code{obstack_alloc_failed_handler} is called. The @code{obstack_init}
|
||||
function always returns 1 (Compatibility notice: Former versions of
|
||||
obstack returned 0 if allocation failed).
|
||||
@end deftypefun
|
||||
|
||||
Here are two examples of how to allocate the space for an obstack and
|
||||
initialize it. First, an obstack that is a static variable:
|
||||
|
||||
@smallexample
|
||||
static struct obstack myobstack;
|
||||
@dots{}
|
||||
obstack_init (&myobstack);
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Second, an obstack that is itself dynamically allocated:
|
||||
|
||||
@smallexample
|
||||
struct obstack *myobstack_ptr
|
||||
= (struct obstack *) xmalloc (sizeof (struct obstack));
|
||||
|
||||
obstack_init (myobstack_ptr);
|
||||
@end smallexample
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@defvar obstack_alloc_failed_handler
|
||||
The value of this variable is a pointer to a function that
|
||||
@code{obstack} uses when @code{obstack_chunk_alloc} fails to allocate
|
||||
memory. The default action is to print a message and abort.
|
||||
You should supply a function that either calls @code{exit}
|
||||
(@pxref{Program Termination, , , libc, The GNU C Library Reference Manual}) or @code{longjmp} (@pxref{Non-Local
|
||||
Exits, , , libc, The GNU C Library Reference Manual}) and doesn't return.
|
||||
|
||||
@smallexample
|
||||
void my_obstack_alloc_failed (void)
|
||||
@dots{}
|
||||
obstack_alloc_failed_handler = &my_obstack_alloc_failed;
|
||||
@end smallexample
|
||||
|
||||
@end defvar
|
||||
|
||||
@node Allocation in an Obstack
|
||||
@section Allocation in an Obstack
|
||||
@cindex allocation (obstacks)
|
||||
|
||||
The most direct way to allocate an object in an obstack is with
|
||||
@code{obstack_alloc}, which is invoked almost like @code{malloc}.
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun {void *} obstack_alloc (struct obstack *@var{obstack-ptr}, int @var{size})
|
||||
This allocates an uninitialized block of @var{size} bytes in an obstack
|
||||
and returns its address. Here @var{obstack-ptr} specifies which obstack
|
||||
to allocate the block in; it is the address of the @code{struct obstack}
|
||||
object which represents the obstack. Each obstack function or macro
|
||||
requires you to specify an @var{obstack-ptr} as the first argument.
|
||||
|
||||
This function calls the obstack's @code{obstack_chunk_alloc} function if
|
||||
it needs to allocate a new chunk of memory; it calls
|
||||
@code{obstack_alloc_failed_handler} if allocation of memory by
|
||||
@code{obstack_chunk_alloc} failed.
|
||||
@end deftypefun
|
||||
|
||||
For example, here is a function that allocates a copy of a string @var{str}
|
||||
in a specific obstack, which is in the variable @code{string_obstack}:
|
||||
|
||||
@smallexample
|
||||
struct obstack string_obstack;
|
||||
|
||||
char *
|
||||
copystring (char *string)
|
||||
@{
|
||||
size_t len = strlen (string) + 1;
|
||||
char *s = (char *) obstack_alloc (&string_obstack, len);
|
||||
memcpy (s, string, len);
|
||||
return s;
|
||||
@}
|
||||
@end smallexample
|
||||
|
||||
To allocate a block with specified contents, use the function
|
||||
@code{obstack_copy}, declared like this:
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun {void *} obstack_copy (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
|
||||
This allocates a block and initializes it by copying @var{size}
|
||||
bytes of data starting at @var{address}. It calls
|
||||
@code{obstack_alloc_failed_handler} if allocation of memory by
|
||||
@code{obstack_chunk_alloc} failed.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun {void *} obstack_copy0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
|
||||
Like @code{obstack_copy}, but appends an extra byte containing a null
|
||||
character. This extra byte is not counted in the argument @var{size}.
|
||||
@end deftypefun
|
||||
|
||||
The @code{obstack_copy0} function is convenient for copying a sequence
|
||||
of characters into an obstack as a null-terminated string. Here is an
|
||||
example of its use:
|
||||
|
||||
@smallexample
|
||||
char *
|
||||
obstack_savestring (char *addr, int size)
|
||||
@{
|
||||
return obstack_copy0 (&myobstack, addr, size);
|
||||
@}
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Contrast this with the previous example of @code{savestring} using
|
||||
@code{malloc} (@pxref{Basic Allocation, , , libc, The GNU C Library Reference Manual}).
|
||||
|
||||
@node Freeing Obstack Objects
|
||||
@section Freeing Objects in an Obstack
|
||||
@cindex freeing (obstacks)
|
||||
|
||||
To free an object allocated in an obstack, use the function
|
||||
@code{obstack_free}. Since the obstack is a stack of objects, freeing
|
||||
one object automatically frees all other objects allocated more recently
|
||||
in the same obstack.
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_free (struct obstack *@var{obstack-ptr}, void *@var{object})
|
||||
If @var{object} is a null pointer, everything allocated in the obstack
|
||||
is freed. Otherwise, @var{object} must be the address of an object
|
||||
allocated in the obstack. Then @var{object} is freed, along with
|
||||
everything allocated in @var{obstack} since @var{object}.
|
||||
@end deftypefun
|
||||
|
||||
Note that if @var{object} is a null pointer, the result is an
|
||||
uninitialized obstack. To free all memory in an obstack but leave it
|
||||
valid for further allocation, call @code{obstack_free} with the address
|
||||
of the first object allocated on the obstack:
|
||||
|
||||
@smallexample
|
||||
obstack_free (obstack_ptr, first_object_allocated_ptr);
|
||||
@end smallexample
|
||||
|
||||
Recall that the objects in an obstack are grouped into chunks. When all
|
||||
the objects in a chunk become free, the obstack library automatically
|
||||
frees the chunk (@pxref{Preparing for Obstacks}). Then other
|
||||
obstacks, or non-obstack allocation, can reuse the space of the chunk.
|
||||
|
||||
@node Obstack Functions
|
||||
@section Obstack Functions and Macros
|
||||
@cindex macros
|
||||
|
||||
The interfaces for using obstacks may be defined either as functions or
|
||||
as macros, depending on the compiler. The obstack facility works with
|
||||
all C compilers, including both @w{ISO C} and traditional C, but there are
|
||||
precautions you must take if you plan to use compilers other than GNU C.
|
||||
|
||||
If you are using an old-fashioned @w{non-ISO C} compiler, all the obstack
|
||||
``functions'' are actually defined only as macros. You can call these
|
||||
macros like functions, but you cannot use them in any other way (for
|
||||
example, you cannot take their address).
|
||||
|
||||
Calling the macros requires a special precaution: namely, the first
|
||||
operand (the obstack pointer) may not contain any side effects, because
|
||||
it may be computed more than once. For example, if you write this:
|
||||
|
||||
@smallexample
|
||||
obstack_alloc (get_obstack (), 4);
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
you will find that @code{get_obstack} may be called several times.
|
||||
If you use @code{*obstack_list_ptr++} as the obstack pointer argument,
|
||||
you will get very strange results since the incrementation may occur
|
||||
several times.
|
||||
|
||||
In @w{ISO C}, each function has both a macro definition and a function
|
||||
definition. The function definition is used if you take the address of the
|
||||
function without calling it. An ordinary call uses the macro definition by
|
||||
default, but you can request the function definition instead by writing the
|
||||
function name in parentheses, as shown here:
|
||||
|
||||
@smallexample
|
||||
char *x;
|
||||
void *(*funcp) ();
|
||||
/* @r{Use the macro}. */
|
||||
x = (char *) obstack_alloc (obptr, size);
|
||||
/* @r{Call the function}. */
|
||||
x = (char *) (obstack_alloc) (obptr, size);
|
||||
/* @r{Take the address of the function}. */
|
||||
funcp = obstack_alloc;
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
This is the same situation that exists in @w{ISO C} for the standard library
|
||||
functions. @xref{Macro Definitions, , , libc, The GNU C Library Reference Manual}.
|
||||
|
||||
@strong{Warning:} When you do use the macros, you must observe the
|
||||
precaution of avoiding side effects in the first operand, even in @w{ISO C}.
|
||||
|
||||
If you use the GNU C compiler, this precaution is not necessary, because
|
||||
various language extensions in GNU C permit defining the macros so as to
|
||||
compute each argument only once.
|
||||
|
||||
@node Growing Objects
|
||||
@section Growing Objects
|
||||
@cindex growing objects (in obstacks)
|
||||
@cindex changing the size of a block (obstacks)
|
||||
|
||||
Because memory in obstack chunks is used sequentially, it is possible to
|
||||
build up an object step by step, adding one or more bytes at a time to the
|
||||
end of the object. With this technique, you do not need to know how much
|
||||
data you will put in the object until you come to the end of it. We call
|
||||
this the technique of @dfn{growing objects}. The special functions
|
||||
for adding data to the growing object are described in this section.
|
||||
|
||||
You don't need to do anything special when you start to grow an object.
|
||||
Using one of the functions to add data to the object automatically
|
||||
starts it. However, it is necessary to say explicitly when the object is
|
||||
finished. This is done with the function @code{obstack_finish}.
|
||||
|
||||
The actual address of the object thus built up is not known until the
|
||||
object is finished. Until then, it always remains possible that you will
|
||||
add so much data that the object must be copied into a new chunk.
|
||||
|
||||
While the obstack is in use for a growing object, you cannot use it for
|
||||
ordinary allocation of another object. If you try to do so, the space
|
||||
already added to the growing object will become part of the other object.
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_blank (struct obstack *@var{obstack-ptr}, int @var{size})
|
||||
The most basic function for adding to a growing object is
|
||||
@code{obstack_blank}, which adds space without initializing it.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_grow (struct obstack *@var{obstack-ptr}, void *@var{data}, int @var{size})
|
||||
To add a block of initialized space, use @code{obstack_grow}, which is
|
||||
the growing-object analogue of @code{obstack_copy}. It adds @var{size}
|
||||
bytes of data to the growing object, copying the contents from
|
||||
@var{data}.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_grow0 (struct obstack *@var{obstack-ptr}, void *@var{data}, int @var{size})
|
||||
This is the growing-object analogue of @code{obstack_copy0}. It adds
|
||||
@var{size} bytes copied from @var{data}, followed by an additional null
|
||||
character.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_1grow (struct obstack *@var{obstack-ptr}, char @var{c})
|
||||
To add one character at a time, use the function @code{obstack_1grow}.
|
||||
It adds a single byte containing @var{c} to the growing object.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_ptr_grow (struct obstack *@var{obstack-ptr}, void *@var{data})
|
||||
Adding the value of a pointer one can use the function
|
||||
@code{obstack_ptr_grow}. It adds @code{sizeof (void *)} bytes
|
||||
containing the value of @var{data}.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_int_grow (struct obstack *@var{obstack-ptr}, int @var{data})
|
||||
A single value of type @code{int} can be added by using the
|
||||
@code{obstack_int_grow} function. It adds @code{sizeof (int)} bytes to
|
||||
the growing object and initializes them with the value of @var{data}.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun {void *} obstack_finish (struct obstack *@var{obstack-ptr})
|
||||
When you are finished growing the object, use the function
|
||||
@code{obstack_finish} to close it off and return its final address.
|
||||
|
||||
Once you have finished the object, the obstack is available for ordinary
|
||||
allocation or for growing another object.
|
||||
|
||||
This function can return a null pointer under the same conditions as
|
||||
@code{obstack_alloc} (@pxref{Allocation in an Obstack}).
|
||||
@end deftypefun
|
||||
|
||||
When you build an object by growing it, you will probably need to know
|
||||
afterward how long it became. You need not keep track of this as you grow
|
||||
the object, because you can find out the length from the obstack just
|
||||
before finishing the object with the function @code{obstack_object_size},
|
||||
declared as follows:
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun int obstack_object_size (struct obstack *@var{obstack-ptr})
|
||||
This function returns the current size of the growing object, in bytes.
|
||||
Remember to call this function @emph{before} finishing the object.
|
||||
After it is finished, @code{obstack_object_size} will return zero.
|
||||
@end deftypefun
|
||||
|
||||
If you have started growing an object and wish to cancel it, you should
|
||||
finish it and then free it, like this:
|
||||
|
||||
@smallexample
|
||||
obstack_free (obstack_ptr, obstack_finish (obstack_ptr));
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
This has no effect if no object was growing.
|
||||
|
||||
@cindex shrinking objects
|
||||
You can use @code{obstack_blank} with a negative size argument to make
|
||||
the current object smaller. Just don't try to shrink it beyond zero
|
||||
length---there's no telling what will happen if you do that.
|
||||
|
||||
@node Extra Fast Growing
|
||||
@section Extra Fast Growing Objects
|
||||
@cindex efficiency and obstacks
|
||||
|
||||
The usual functions for growing objects incur overhead for checking
|
||||
whether there is room for the new growth in the current chunk. If you
|
||||
are frequently constructing objects in small steps of growth, this
|
||||
overhead can be significant.
|
||||
|
||||
You can reduce the overhead by using special ``fast growth''
|
||||
functions that grow the object without checking. In order to have a
|
||||
robust program, you must do the checking yourself. If you do this checking
|
||||
in the simplest way each time you are about to add data to the object, you
|
||||
have not saved anything, because that is what the ordinary growth
|
||||
functions do. But if you can arrange to check less often, or check
|
||||
more efficiently, then you make the program faster.
|
||||
|
||||
The function @code{obstack_room} returns the amount of room available
|
||||
in the current chunk. It is declared as follows:
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun int obstack_room (struct obstack *@var{obstack-ptr})
|
||||
This returns the number of bytes that can be added safely to the current
|
||||
growing object (or to an object about to be started) in obstack
|
||||
@var{obstack} using the fast growth functions.
|
||||
@end deftypefun
|
||||
|
||||
While you know there is room, you can use these fast growth functions
|
||||
for adding data to a growing object:
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_1grow_fast (struct obstack *@var{obstack-ptr}, char @var{c})
|
||||
The function @code{obstack_1grow_fast} adds one byte containing the
|
||||
character @var{c} to the growing object in obstack @var{obstack-ptr}.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_ptr_grow_fast (struct obstack *@var{obstack-ptr}, void *@var{data})
|
||||
The function @code{obstack_ptr_grow_fast} adds @code{sizeof (void *)}
|
||||
bytes containing the value of @var{data} to the growing object in
|
||||
obstack @var{obstack-ptr}.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_int_grow_fast (struct obstack *@var{obstack-ptr}, int @var{data})
|
||||
The function @code{obstack_int_grow_fast} adds @code{sizeof (int)} bytes
|
||||
containing the value of @var{data} to the growing object in obstack
|
||||
@var{obstack-ptr}.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_blank_fast (struct obstack *@var{obstack-ptr}, int @var{size})
|
||||
The function @code{obstack_blank_fast} adds @var{size} bytes to the
|
||||
growing object in obstack @var{obstack-ptr} without initializing them.
|
||||
@end deftypefun
|
||||
|
||||
When you check for space using @code{obstack_room} and there is not
|
||||
enough room for what you want to add, the fast growth functions
|
||||
are not safe. In this case, simply use the corresponding ordinary
|
||||
growth function instead. Very soon this will copy the object to a
|
||||
new chunk; then there will be lots of room available again.
|
||||
|
||||
So, each time you use an ordinary growth function, check afterward for
|
||||
sufficient space using @code{obstack_room}. Once the object is copied
|
||||
to a new chunk, there will be plenty of space again, so the program will
|
||||
start using the fast growth functions again.
|
||||
|
||||
Here is an example:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
void
|
||||
add_string (struct obstack *obstack, const char *ptr, int len)
|
||||
@{
|
||||
while (len > 0)
|
||||
@{
|
||||
int room = obstack_room (obstack);
|
||||
if (room == 0)
|
||||
@{
|
||||
/* @r{Not enough room. Add one character slowly,}
|
||||
@r{which may copy to a new chunk and make room.} */
|
||||
obstack_1grow (obstack, *ptr++);
|
||||
len--;
|
||||
@}
|
||||
else
|
||||
@{
|
||||
if (room > len)
|
||||
room = len;
|
||||
/* @r{Add fast as much as we have room for.} */
|
||||
len -= room;
|
||||
while (room-- > 0)
|
||||
obstack_1grow_fast (obstack, *ptr++);
|
||||
@}
|
||||
@}
|
||||
@}
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
@node Status of an Obstack
|
||||
@section Status of an Obstack
|
||||
@cindex obstack status
|
||||
@cindex status of obstack
|
||||
|
||||
Here are functions that provide information on the current status of
|
||||
allocation in an obstack. You can use them to learn about an object while
|
||||
still growing it.
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun {void *} obstack_base (struct obstack *@var{obstack-ptr})
|
||||
This function returns the tentative address of the beginning of the
|
||||
currently growing object in @var{obstack-ptr}. If you finish the object
|
||||
immediately, it will have that address. If you make it larger first, it
|
||||
may outgrow the current chunk---then its address will change!
|
||||
|
||||
If no object is growing, this value says where the next object you
|
||||
allocate will start (once again assuming it fits in the current
|
||||
chunk).
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun {void *} obstack_next_free (struct obstack *@var{obstack-ptr})
|
||||
This function returns the address of the first free byte in the current
|
||||
chunk of obstack @var{obstack-ptr}. This is the end of the currently
|
||||
growing object. If no object is growing, @code{obstack_next_free}
|
||||
returns the same value as @code{obstack_base}.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun int obstack_object_size (struct obstack *@var{obstack-ptr})
|
||||
This function returns the size in bytes of the currently growing object.
|
||||
This is equivalent to
|
||||
|
||||
@smallexample
|
||||
obstack_next_free (@var{obstack-ptr}) - obstack_base (@var{obstack-ptr})
|
||||
@end smallexample
|
||||
@end deftypefun
|
||||
|
||||
@node Obstacks Data Alignment
|
||||
@section Alignment of Data in Obstacks
|
||||
@cindex alignment (in obstacks)
|
||||
|
||||
Each obstack has an @dfn{alignment boundary}; each object allocated in
|
||||
the obstack automatically starts on an address that is a multiple of the
|
||||
specified boundary. By default, this boundary is 4 bytes.
|
||||
|
||||
To access an obstack's alignment boundary, use the macro
|
||||
@code{obstack_alignment_mask}, whose function prototype looks like
|
||||
this:
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefn Macro int obstack_alignment_mask (struct obstack *@var{obstack-ptr})
|
||||
The value is a bit mask; a bit that is 1 indicates that the corresponding
|
||||
bit in the address of an object should be 0. The mask value should be one
|
||||
less than a power of 2; the effect is that all object addresses are
|
||||
multiples of that power of 2. The default value of the mask is 3, so that
|
||||
addresses are multiples of 4. A mask value of 0 means an object can start
|
||||
on any multiple of 1 (that is, no alignment is required).
|
||||
|
||||
The expansion of the macro @code{obstack_alignment_mask} is an lvalue,
|
||||
so you can alter the mask by assignment. For example, this statement:
|
||||
|
||||
@smallexample
|
||||
obstack_alignment_mask (obstack_ptr) = 0;
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
has the effect of turning off alignment processing in the specified obstack.
|
||||
@end deftypefn
|
||||
|
||||
Note that a change in alignment mask does not take effect until
|
||||
@emph{after} the next time an object is allocated or finished in the
|
||||
obstack. If you are not growing an object, you can make the new
|
||||
alignment mask take effect immediately by calling @code{obstack_finish}.
|
||||
This will finish a zero-length object and then do proper alignment for
|
||||
the next object.
|
||||
|
||||
@node Obstack Chunks
|
||||
@section Obstack Chunks
|
||||
@cindex efficiency of chunks
|
||||
@cindex chunks
|
||||
|
||||
Obstacks work by allocating space for themselves in large chunks, and
|
||||
then parceling out space in the chunks to satisfy your requests. Chunks
|
||||
are normally 4096 bytes long unless you specify a different chunk size.
|
||||
The chunk size includes 8 bytes of overhead that are not actually used
|
||||
for storing objects. Regardless of the specified size, longer chunks
|
||||
will be allocated when necessary for long objects.
|
||||
|
||||
The obstack library allocates chunks by calling the function
|
||||
@code{obstack_chunk_alloc}, which you must define. When a chunk is no
|
||||
longer needed because you have freed all the objects in it, the obstack
|
||||
library frees the chunk by calling @code{obstack_chunk_free}, which you
|
||||
must also define.
|
||||
|
||||
These two must be defined (as macros) or declared (as functions) in each
|
||||
source file that uses @code{obstack_init} (@pxref{Creating Obstacks}).
|
||||
Most often they are defined as macros like this:
|
||||
|
||||
@smallexample
|
||||
#define obstack_chunk_alloc malloc
|
||||
#define obstack_chunk_free free
|
||||
@end smallexample
|
||||
|
||||
Note that these are simple macros (no arguments). Macro definitions with
|
||||
arguments will not work! It is necessary that @code{obstack_chunk_alloc}
|
||||
or @code{obstack_chunk_free}, alone, expand into a function name if it is
|
||||
not itself a function name.
|
||||
|
||||
If you allocate chunks with @code{malloc}, the chunk size should be a
|
||||
power of 2. The default chunk size, 4096, was chosen because it is long
|
||||
enough to satisfy many typical requests on the obstack yet short enough
|
||||
not to waste too much memory in the portion of the last chunk not yet used.
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefn Macro int obstack_chunk_size (struct obstack *@var{obstack-ptr})
|
||||
This returns the chunk size of the given obstack.
|
||||
@end deftypefn
|
||||
|
||||
Since this macro expands to an lvalue, you can specify a new chunk size by
|
||||
assigning it a new value. Doing so does not affect the chunks already
|
||||
allocated, but will change the size of chunks allocated for that particular
|
||||
obstack in the future. It is unlikely to be useful to make the chunk size
|
||||
smaller, but making it larger might improve efficiency if you are
|
||||
allocating many objects whose size is comparable to the chunk size. Here
|
||||
is how to do so cleanly:
|
||||
|
||||
@smallexample
|
||||
if (obstack_chunk_size (obstack_ptr) < @var{new-chunk-size})
|
||||
obstack_chunk_size (obstack_ptr) = @var{new-chunk-size};
|
||||
@end smallexample
|
||||
|
||||
@node Summary of Obstacks
|
||||
@section Summary of Obstack Functions
|
||||
|
||||
Here is a summary of all the functions associated with obstacks. Each
|
||||
takes the address of an obstack (@code{struct obstack *}) as its first
|
||||
argument.
|
||||
|
||||
@table @code
|
||||
@item void obstack_init (struct obstack *@var{obstack-ptr})
|
||||
Initialize use of an obstack. @xref{Creating Obstacks}.
|
||||
|
||||
@item void *obstack_alloc (struct obstack *@var{obstack-ptr}, int @var{size})
|
||||
Allocate an object of @var{size} uninitialized bytes.
|
||||
@xref{Allocation in an Obstack}.
|
||||
|
||||
@item void *obstack_copy (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
|
||||
Allocate an object of @var{size} bytes, with contents copied from
|
||||
@var{address}. @xref{Allocation in an Obstack}.
|
||||
|
||||
@item void *obstack_copy0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
|
||||
Allocate an object of @var{size}+1 bytes, with @var{size} of them copied
|
||||
from @var{address}, followed by a null character at the end.
|
||||
@xref{Allocation in an Obstack}.
|
||||
|
||||
@item void obstack_free (struct obstack *@var{obstack-ptr}, void *@var{object})
|
||||
Free @var{object} (and everything allocated in the specified obstack
|
||||
more recently than @var{object}). @xref{Freeing Obstack Objects}.
|
||||
|
||||
@item void obstack_blank (struct obstack *@var{obstack-ptr}, int @var{size})
|
||||
Add @var{size} uninitialized bytes to a growing object.
|
||||
@xref{Growing Objects}.
|
||||
|
||||
@item void obstack_grow (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
|
||||
Add @var{size} bytes, copied from @var{address}, to a growing object.
|
||||
@xref{Growing Objects}.
|
||||
|
||||
@item void obstack_grow0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
|
||||
Add @var{size} bytes, copied from @var{address}, to a growing object,
|
||||
and then add another byte containing a null character. @xref{Growing
|
||||
Objects}.
|
||||
|
||||
@item void obstack_1grow (struct obstack *@var{obstack-ptr}, char @var{data-char})
|
||||
Add one byte containing @var{data-char} to a growing object.
|
||||
@xref{Growing Objects}.
|
||||
|
||||
@item void *obstack_finish (struct obstack *@var{obstack-ptr})
|
||||
Finalize the object that is growing and return its permanent address.
|
||||
@xref{Growing Objects}.
|
||||
|
||||
@item int obstack_object_size (struct obstack *@var{obstack-ptr})
|
||||
Get the current size of the currently growing object. @xref{Growing
|
||||
Objects}.
|
||||
|
||||
@item void obstack_blank_fast (struct obstack *@var{obstack-ptr}, int @var{size})
|
||||
Add @var{size} uninitialized bytes to a growing object without checking
|
||||
that there is enough room. @xref{Extra Fast Growing}.
|
||||
|
||||
@item void obstack_1grow_fast (struct obstack *@var{obstack-ptr}, char @var{data-char})
|
||||
Add one byte containing @var{data-char} to a growing object without
|
||||
checking that there is enough room. @xref{Extra Fast Growing}.
|
||||
|
||||
@item int obstack_room (struct obstack *@var{obstack-ptr})
|
||||
Get the amount of room now available for growing the current object.
|
||||
@xref{Extra Fast Growing}.
|
||||
|
||||
@item int obstack_alignment_mask (struct obstack *@var{obstack-ptr})
|
||||
The mask used for aligning the beginning of an object. This is an
|
||||
lvalue. @xref{Obstacks Data Alignment}.
|
||||
|
||||
@item int obstack_chunk_size (struct obstack *@var{obstack-ptr})
|
||||
The size for allocating chunks. This is an lvalue. @xref{Obstack Chunks}.
|
||||
|
||||
@item void *obstack_base (struct obstack *@var{obstack-ptr})
|
||||
Tentative starting address of the currently growing object.
|
||||
@xref{Status of an Obstack}.
|
||||
|
||||
@item void *obstack_next_free (struct obstack *@var{obstack-ptr})
|
||||
Address just after the end of the currently growing object.
|
||||
@xref{Status of an Obstack}.
|
||||
@end table
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,166 +0,0 @@
|
||||
/* ternary.c - Ternary Search Trees
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
|
||||
Contributed by Daniel Berlin (dan@cgsoftware.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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "libiberty.h"
|
||||
#include "ternary.h"
|
||||
|
||||
/* Non-recursive so we don't waste stack space/time on large
|
||||
insertions. */
|
||||
|
||||
PTR
|
||||
ternary_insert (root, s, data, replace)
|
||||
ternary_tree *root;
|
||||
const char *s;
|
||||
PTR data;
|
||||
int replace;
|
||||
{
|
||||
int diff;
|
||||
ternary_tree curr, *pcurr;
|
||||
|
||||
/* Start at the root. */
|
||||
pcurr = root;
|
||||
/* Loop until we find the right position */
|
||||
while ((curr = *pcurr))
|
||||
{
|
||||
/* Calculate the difference */
|
||||
diff = *s - curr->splitchar;
|
||||
/* Handle current char equal to node splitchar */
|
||||
if (diff == 0)
|
||||
{
|
||||
/* Handle the case of a string we already have */
|
||||
if (*s++ == 0)
|
||||
{
|
||||
if (replace)
|
||||
curr->eqkid = (ternary_tree) data;
|
||||
return (PTR) curr->eqkid;
|
||||
}
|
||||
pcurr = &(curr->eqkid);
|
||||
}
|
||||
/* Handle current char less than node splitchar */
|
||||
else if (diff < 0)
|
||||
{
|
||||
pcurr = &(curr->lokid);
|
||||
}
|
||||
/* Handle current char greater than node splitchar */
|
||||
else
|
||||
{
|
||||
pcurr = &(curr->hikid);
|
||||
}
|
||||
}
|
||||
/* It's not a duplicate string, and we should insert what's left of
|
||||
the string, into the tree rooted at curr */
|
||||
for (;;)
|
||||
{
|
||||
/* Allocate the memory for the node, and fill it in */
|
||||
*pcurr = (ternary_tree) xmalloc (sizeof (ternary_node));
|
||||
curr = *pcurr;
|
||||
curr->splitchar = *s;
|
||||
curr->lokid = curr->hikid = curr->eqkid = 0;
|
||||
|
||||
/* Place nodes until we hit the end of the string.
|
||||
When we hit it, place the data in the right place, and
|
||||
return.
|
||||
*/
|
||||
if (*s++ == 0)
|
||||
{
|
||||
curr->eqkid = (ternary_tree) data;
|
||||
return data;
|
||||
}
|
||||
pcurr = &(curr->eqkid);
|
||||
}
|
||||
}
|
||||
|
||||
/* Free the ternary search tree rooted at p. */
|
||||
void
|
||||
ternary_cleanup (p)
|
||||
ternary_tree p;
|
||||
{
|
||||
if (p)
|
||||
{
|
||||
ternary_cleanup (p->lokid);
|
||||
if (p->splitchar)
|
||||
ternary_cleanup (p->eqkid);
|
||||
ternary_cleanup (p->hikid);
|
||||
free (p);
|
||||
}
|
||||
}
|
||||
|
||||
/* Non-recursive find of a string in the ternary tree */
|
||||
PTR
|
||||
ternary_search (p, s)
|
||||
const ternary_node *p;
|
||||
const char *s;
|
||||
{
|
||||
const ternary_node *curr;
|
||||
int diff, spchar;
|
||||
spchar = *s;
|
||||
curr = p;
|
||||
/* Loop while we haven't hit a NULL node or returned */
|
||||
while (curr)
|
||||
{
|
||||
/* Calculate the difference */
|
||||
diff = spchar - curr->splitchar;
|
||||
/* Handle the equal case */
|
||||
if (diff == 0)
|
||||
{
|
||||
if (spchar == 0)
|
||||
return (PTR) curr->eqkid;
|
||||
spchar = *++s;
|
||||
curr = curr->eqkid;
|
||||
}
|
||||
/* Handle the less than case */
|
||||
else if (diff < 0)
|
||||
curr = curr->lokid;
|
||||
/* All that's left is greater than */
|
||||
else
|
||||
curr = curr->hikid;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* For those who care, the recursive version of the search. Useful if
|
||||
you want a starting point for pmsearch or nearsearch. */
|
||||
static PTR
|
||||
ternary_recursivesearch (p, s)
|
||||
const ternary_node *p;
|
||||
const char *s;
|
||||
{
|
||||
if (!p)
|
||||
return 0;
|
||||
if (*s < p->splitchar)
|
||||
return ternary_recursivesearch (p->lokid, s);
|
||||
else if (*s > p->splitchar)
|
||||
return ternary_recursivesearch (p->hikid, s);
|
||||
else
|
||||
{
|
||||
if (*s == 0)
|
||||
return (PTR) p->eqkid;
|
||||
return ternary_recursivesearch (p->eqkid, ++s);
|
||||
}
|
||||
}
|
||||
Vendored
-879
@@ -1,879 +0,0 @@
|
||||
## libtool.m4 - Configure libtool for the host system. -*-Shell-script-*-
|
||||
## Copyright 1996, 1997, 1998, 1999, 2000, 2001
|
||||
## Free Software Foundation, Inc.
|
||||
## Originally by Gordon Matzigkeit <[email protected]>, 1996
|
||||
##
|
||||
## 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 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but
|
||||
## WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## As a special exception to the GNU General Public License, if you
|
||||
## distribute this file as part of a program that contains a
|
||||
## configuration script generated by Autoconf, you may include it under
|
||||
## the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# serial 46 AC_PROG_LIBTOOL
|
||||
AC_DEFUN([AC_PROG_LIBTOOL],
|
||||
[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
|
||||
dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
|
||||
dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[AC_LIBTOOL_CXX],
|
||||
[define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
|
||||
])])
|
||||
|
||||
dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
|
||||
dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
|
||||
dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
|
||||
AC_PROVIDE_IFELSE([AC_PROG_GCJ],
|
||||
[AC_LIBTOOL_GCJ],
|
||||
[AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
|
||||
[AC_LIBTOOL_GCJ],
|
||||
[AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
|
||||
[AC_LIBTOOL_GCJ],
|
||||
[ifdef([AC_PROG_GCJ],
|
||||
[define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ
|
||||
])])
|
||||
ifdef([A][M_PROG_GCJ],
|
||||
[define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ
|
||||
])])
|
||||
ifdef([LT_AC_PROG_GCJ],
|
||||
[define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ
|
||||
])])])])])])
|
||||
|
||||
AC_DEFUN([_AC_PROG_LIBTOOL],
|
||||
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
|
||||
AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
|
||||
AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
|
||||
|
||||
# Save cache, so that ltconfig can load it
|
||||
AC_CACHE_SAVE
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
|
||||
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
|
||||
AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
|
||||
objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
|
||||
deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
|
||||
$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
|
||||
# Reload cache, that may have been modified by ltconfig
|
||||
AC_CACHE_LOAD
|
||||
|
||||
# This can be used to rebuild libtool when needed
|
||||
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
|
||||
|
||||
# Always use our own libtool.
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
||||
AC_SUBST(LIBTOOL)dnl
|
||||
|
||||
# Redirect the config.log output again, so that the ltconfig log is not
|
||||
# clobbered by the next message.
|
||||
exec 5>>./config.log
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_LIBTOOL_SETUP],
|
||||
[AC_PREREQ(2.13)dnl
|
||||
AC_REQUIRE([AC_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AC_ENABLE_STATIC])dnl
|
||||
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_LD])dnl
|
||||
AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
|
||||
AC_REQUIRE([AC_PROG_NM])dnl
|
||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
||||
AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
|
||||
# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
|
||||
AC_REQUIRE([AC_OBJEXT])dnl
|
||||
AC_REQUIRE([AC_EXEEXT])dnl
|
||||
dnl
|
||||
|
||||
# Only perform the check for file, if the check method requires it
|
||||
case $deplibs_check_method in
|
||||
file_magic*)
|
||||
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
|
||||
AC_PATH_MAGIC
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_CHECK_TOOL(RANLIB, ranlib, :)
|
||||
AC_CHECK_TOOL(STRIP, strip, :)
|
||||
|
||||
# Check for any special flags to pass to ltconfig.
|
||||
libtool_flags="--cache-file=$cache_file"
|
||||
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
|
||||
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
|
||||
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
|
||||
test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc"
|
||||
test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
|
||||
[libtool_flags="$libtool_flags --enable-dlopen"])
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[libtool_flags="$libtool_flags --enable-win32-dll"])
|
||||
AC_ARG_ENABLE(libtool-lock,
|
||||
[ --disable-libtool-lock avoid locking (might break parallel builds)])
|
||||
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
|
||||
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
|
||||
|
||||
AC_ARG_WITH(pic,
|
||||
[ --with-pic try to use only PIC/non-PIC objects [default=use both]],
|
||||
pic_mode="$withval", pic_mode=default)
|
||||
test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
|
||||
test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
|
||||
|
||||
# Some flags need to be propagated to the compiler or linker for good
|
||||
# libtool support.
|
||||
case $host in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
case `/usr/bin/file conftest.$ac_objext` in
|
||||
*32-bit*)
|
||||
LD="${LD-ld} -32"
|
||||
;;
|
||||
*N32*)
|
||||
LD="${LD-ld} -n32"
|
||||
;;
|
||||
*64-bit*)
|
||||
LD="${LD-ld} -64"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -rf conftest*
|
||||
;;
|
||||
|
||||
ia64-*-hpux*)
|
||||
# Find out which ABI we are using.
|
||||
echo 'int i;' > conftest.$ac_ext
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
case "`/usr/bin/file conftest.o`" in
|
||||
*ELF-32*)
|
||||
HPUX_IA64_MODE="32"
|
||||
;;
|
||||
*ELF-64*)
|
||||
HPUX_IA64_MODE="64"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -rf conftest*
|
||||
;;
|
||||
|
||||
*-*-sco3.2v5*)
|
||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -belf"
|
||||
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
|
||||
[AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
|
||||
AC_LANG_RESTORE])
|
||||
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
|
||||
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
fi
|
||||
;;
|
||||
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
|
||||
# recent cygwin and mingw systems supply a stub DllMain which the user
|
||||
# can override, but on older systems we have to supply one
|
||||
AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
|
||||
[AC_TRY_LINK([],
|
||||
[extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
|
||||
DllMain (0, 0, 0);],
|
||||
[lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
|
||||
|
||||
case $host/$CC in
|
||||
*-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
|
||||
# old mingw systems require "-dll" to link a DLL, while more recent ones
|
||||
# require "-mdll"
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -mdll"
|
||||
AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
|
||||
[AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
|
||||
CFLAGS="$SAVE_CFLAGS" ;;
|
||||
*-*-cygwin* | *-*-pw32*)
|
||||
# cygwin systems need to pass --dll to the linker, and not link
|
||||
# crt.o which will require a WinMain@16 definition.
|
||||
lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
|
||||
esac
|
||||
;;
|
||||
])
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
|
||||
AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
|
||||
AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_ENABLE_SHARED - implement the --enable-shared flag
|
||||
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN([AC_ENABLE_SHARED],
|
||||
[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(shared,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
|
||||
AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_SHARED(no)])
|
||||
|
||||
# AC_ENABLE_STATIC - implement the --enable-static flag
|
||||
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN([AC_ENABLE_STATIC],
|
||||
[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(static,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_STATIC - set the default static flag to --disable-static
|
||||
AC_DEFUN([AC_DISABLE_STATIC],
|
||||
[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_STATIC(no)])
|
||||
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
|
||||
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN([AC_ENABLE_FAST_INSTALL],
|
||||
[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(fast-install,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
|
||||
AC_DEFUN([AC_DISABLE_FAST_INSTALL],
|
||||
[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_FAST_INSTALL(no)])
|
||||
|
||||
# AC_LIBTOOL_PICMODE - implement the --with-pic flag
|
||||
# Usage: AC_LIBTOOL_PICMODE[(MODE)]
|
||||
# Where MODE is either `yes' or `no'. If omitted, it defaults to
|
||||
# `both'.
|
||||
AC_DEFUN([AC_LIBTOOL_PICMODE],
|
||||
[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
pic_mode=ifelse($#,1,$1,default)])
|
||||
|
||||
|
||||
# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
|
||||
AC_DEFUN([AC_PATH_TOOL_PREFIX],
|
||||
[AC_MSG_CHECKING([for $1])
|
||||
AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
|
||||
[case $MAGIC_CMD in
|
||||
/*)
|
||||
lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
|
||||
;;
|
||||
?:/*)
|
||||
lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
|
||||
;;
|
||||
*)
|
||||
ac_save_MAGIC_CMD="$MAGIC_CMD"
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
|
||||
dnl $ac_dummy forces splitting on constant user-supplied paths.
|
||||
dnl POSIX.2 word splitting is done only on the output of word expansions,
|
||||
dnl not every word. This closes a longstanding sh security hole.
|
||||
ac_dummy="ifelse([$2], , $PATH, [$2])"
|
||||
for ac_dir in $ac_dummy; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$1; then
|
||||
lt_cv_path_MAGIC_CMD="$ac_dir/$1"
|
||||
if test -n "$file_magic_test_file"; then
|
||||
case $deplibs_check_method in
|
||||
"file_magic "*)
|
||||
file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
|
||||
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
|
||||
if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
|
||||
egrep "$file_magic_regex" > /dev/null; then
|
||||
:
|
||||
else
|
||||
cat <<EOF 1>&2
|
||||
|
||||
*** Warning: the command libtool uses to detect shared libraries,
|
||||
*** $file_magic_cmd, produces output that libtool cannot recognize.
|
||||
*** The result is that libtool may fail to recognize shared libraries
|
||||
*** as such. This will affect the creation of libtool libraries that
|
||||
*** depend on shared libraries, but programs linked with such libtool
|
||||
*** libraries will work regardless of this problem. Nevertheless, you
|
||||
*** may want to report the problem to your system manager and/or to
|
||||
*** [email protected]
|
||||
|
||||
EOF
|
||||
fi ;;
|
||||
esac
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
MAGIC_CMD="$ac_save_MAGIC_CMD"
|
||||
;;
|
||||
esac])
|
||||
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
|
||||
if test -n "$MAGIC_CMD"; then
|
||||
AC_MSG_RESULT($MAGIC_CMD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
# AC_PATH_MAGIC - find a file program which can recognise a shared library
|
||||
AC_DEFUN([AC_PATH_MAGIC],
|
||||
[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
|
||||
AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
|
||||
if test -z "$lt_cv_path_MAGIC_CMD"; then
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
|
||||
else
|
||||
MAGIC_CMD=:
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
# AC_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN([AC_PROG_LD],
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
ac_prog=ld
|
||||
if test "$GCC" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by GCC])
|
||||
case $host in
|
||||
*-*-mingw*)
|
||||
# gcc leaves a trailing carriage return which upsets mingw
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
|
||||
*)
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
|
||||
esac
|
||||
case $ac_prog in
|
||||
# Accept absolute paths.
|
||||
[[\\/]* | [A-Za-z]:[\\/]*)]
|
||||
re_direlt=['/[^/][^/]*/\.\./']
|
||||
# Canonicalize the path of ld
|
||||
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
|
||||
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
||||
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
||||
done
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
# If it is relative, then search for the first ld in PATH.
|
||||
with_gnu_ld=unknown
|
||||
;;
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
AC_MSG_CHECKING([for GNU ld])
|
||||
else
|
||||
AC_MSG_CHECKING([for non-GNU ld])
|
||||
fi
|
||||
AC_CACHE_VAL(lt_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
|
||||
lt_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||
if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
test "$with_gnu_ld" != no && break
|
||||
else
|
||||
test "$with_gnu_ld" != yes && break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
else
|
||||
lt_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
fi])
|
||||
LD="$lt_cv_path_LD"
|
||||
if test -n "$LD"; then
|
||||
AC_MSG_RESULT($LD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_PROG_LD_GNU
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_PROG_LD_GNU],
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
|
||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
||||
lt_cv_prog_gnu_ld=yes
|
||||
else
|
||||
lt_cv_prog_gnu_ld=no
|
||||
fi])
|
||||
with_gnu_ld=$lt_cv_prog_gnu_ld
|
||||
])
|
||||
|
||||
# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
|
||||
# -- PORTME Some linkers may need a different reload flag.
|
||||
AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
|
||||
[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
|
||||
[lt_cv_ld_reload_flag='-r'])
|
||||
reload_flag=$lt_cv_ld_reload_flag
|
||||
test -n "$reload_flag" && reload_flag=" $reload_flag"
|
||||
])
|
||||
|
||||
# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
|
||||
# -- PORTME fill in with the dynamic library characteristics
|
||||
AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
|
||||
[AC_CACHE_CHECK([how to recognise dependant libraries],
|
||||
lt_cv_deplibs_check_method,
|
||||
[lt_cv_file_magic_cmd='$MAGIC_CMD'
|
||||
lt_cv_file_magic_test_file=
|
||||
lt_cv_deplibs_check_method='unknown'
|
||||
# Need to set the preceding variable on all platforms that support
|
||||
# interlibrary dependencies.
|
||||
# 'none' -- dependencies not supported.
|
||||
# `unknown' -- same as none, but documents that we really don't know.
|
||||
# 'pass_all' -- all dependencies passed with no checks.
|
||||
# 'test_compile' -- check by making test program.
|
||||
# 'file_magic [regex]' -- check by looking for files in library path
|
||||
# which responds to the $file_magic_cmd with a given egrep regex.
|
||||
# If you have `file' or equivalent on your system and you're not sure
|
||||
# whether `pass_all' will *always* work, you probably want this one.
|
||||
|
||||
case $host_os in
|
||||
aix*)
|
||||
lt_cv_deplibs_check_method=pass_all
|
||||
;;
|
||||
|
||||
beos*)
|
||||
lt_cv_deplibs_check_method=pass_all
|
||||
;;
|
||||
|
||||
bsdi4*)
|
||||
lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)']
|
||||
lt_cv_file_magic_cmd='/usr/bin/file -L'
|
||||
lt_cv_file_magic_test_file=/shlib/libc.so
|
||||
;;
|
||||
|
||||
cygwin* | mingw* |pw32*)
|
||||
lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
|
||||
lt_cv_file_magic_cmd='$OBJDUMP -f'
|
||||
;;
|
||||
|
||||
darwin* | rhapsody*)
|
||||
lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
|
||||
lt_cv_file_magic_cmd='/usr/bin/file -L'
|
||||
case "$host_os" in
|
||||
rhapsody* | darwin1.[012])
|
||||
lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System'
|
||||
;;
|
||||
*) # Darwin 1.3 on
|
||||
lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
freebsd* )
|
||||
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
|
||||
case $host_cpu in
|
||||
i*86 )
|
||||
# Not sure whether the presence of OpenBSD here was a mistake.
|
||||
# Let's accept both of them until this is cleared up.
|
||||
lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library']
|
||||
lt_cv_file_magic_cmd=/usr/bin/file
|
||||
lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
|
||||
;;
|
||||
esac
|
||||
else
|
||||
lt_cv_deplibs_check_method=pass_all
|
||||
fi
|
||||
;;
|
||||
|
||||
gnu*)
|
||||
lt_cv_deplibs_check_method=pass_all
|
||||
;;
|
||||
|
||||
hpux10.20*|hpux11*)
|
||||
case $host_cpu in
|
||||
hppa*)
|
||||
[lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library']
|
||||
lt_cv_file_magic_cmd=/usr/bin/file
|
||||
lt_cv_file_magic_test_file=/usr/lib/libc.sl
|
||||
;;
|
||||
ia64*)
|
||||
[lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64']
|
||||
lt_cv_file_magic_cmd=/usr/bin/file
|
||||
lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
irix5* | irix6*)
|
||||
case $host_os in
|
||||
irix5*)
|
||||
# this will be overridden with pass_all, but let us keep it just in case
|
||||
lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
|
||||
;;
|
||||
*)
|
||||
case $LD in
|
||||
*-32|*"-32 ") libmagic=32-bit;;
|
||||
*-n32|*"-n32 ") libmagic=N32;;
|
||||
*-64|*"-64 ") libmagic=64-bit;;
|
||||
*) libmagic=never-match;;
|
||||
esac
|
||||
# this will be overridden with pass_all, but let us keep it just in case
|
||||
lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"]
|
||||
;;
|
||||
esac
|
||||
lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
|
||||
lt_cv_deplibs_check_method=pass_all
|
||||
;;
|
||||
|
||||
# This must be Linux ELF.
|
||||
linux-gnu*)
|
||||
case $host_cpu in
|
||||
alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
|
||||
lt_cv_deplibs_check_method=pass_all ;;
|
||||
*)
|
||||
# glibc up to 2.1.1 does not perform some relocations on ARM
|
||||
lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;;
|
||||
esac
|
||||
lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
|
||||
;;
|
||||
|
||||
netbsd*)
|
||||
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
|
||||
[lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
|
||||
else
|
||||
[lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$']
|
||||
fi
|
||||
;;
|
||||
|
||||
newsos6)
|
||||
[lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)']
|
||||
lt_cv_file_magic_cmd=/usr/bin/file
|
||||
lt_cv_file_magic_test_file=/usr/lib/libnls.so
|
||||
;;
|
||||
|
||||
osf3* | osf4* | osf5*)
|
||||
# this will be overridden with pass_all, but let us keep it just in case
|
||||
lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
|
||||
lt_cv_file_magic_test_file=/shlib/libc.so
|
||||
lt_cv_deplibs_check_method=pass_all
|
||||
;;
|
||||
|
||||
sco3.2v5*)
|
||||
lt_cv_deplibs_check_method=pass_all
|
||||
;;
|
||||
|
||||
solaris*)
|
||||
lt_cv_deplibs_check_method=pass_all
|
||||
lt_cv_file_magic_test_file=/lib/libc.so
|
||||
;;
|
||||
|
||||
[sysv5uw[78]* | sysv4*uw2*)]
|
||||
lt_cv_deplibs_check_method=pass_all
|
||||
;;
|
||||
|
||||
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
||||
case $host_vendor in
|
||||
ncr)
|
||||
lt_cv_deplibs_check_method=pass_all
|
||||
;;
|
||||
motorola)
|
||||
lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]']
|
||||
lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
])
|
||||
file_magic_cmd=$lt_cv_file_magic_cmd
|
||||
deplibs_check_method=$lt_cv_deplibs_check_method
|
||||
])
|
||||
|
||||
|
||||
# AC_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN([AC_PROG_NM],
|
||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
||||
AC_CACHE_VAL(lt_cv_path_NM,
|
||||
[if test -n "$NM"; then
|
||||
# Let the user override the test.
|
||||
lt_cv_path_NM="$NM"
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
tmp_nm=$ac_dir/${ac_tool_prefix}nm
|
||||
if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
||||
# nm: unknown option "B" ignored
|
||||
# Tru64's nm complains that /dev/null is an invalid object file
|
||||
if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
|
||||
lt_cv_path_NM="$tmp_nm -B"
|
||||
break
|
||||
elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
lt_cv_path_NM="$tmp_nm -p"
|
||||
break
|
||||
else
|
||||
lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
|
||||
continue # so that we can try to find one that supports BSD flags
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
|
||||
fi])
|
||||
NM="$lt_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
])
|
||||
|
||||
# AC_CHECK_LIBM - check for math library
|
||||
AC_DEFUN([AC_CHECK_LIBM],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
LIBM=
|
||||
case $host in
|
||||
*-*-beos* | *-*-cygwin* | *-*-pw32*)
|
||||
# These system don't have libm
|
||||
;;
|
||||
*-ncr-sysv4.3*)
|
||||
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
|
||||
AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_LIB(m, main, LIBM="-lm")
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl convenience library and INCLTDL to the include flags for
|
||||
# the libltdl header and adds --enable-ltdl-convenience to the
|
||||
# configure arguments. Note that LIBLTDL and INCLTDL are not
|
||||
# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not
|
||||
# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed
|
||||
# with '${top_builddir}/' and INCLTDL will be prefixed with
|
||||
# '${top_srcdir}/' (note the single quotes!). If your package is not
|
||||
# flat and you're not using automake, define top_builddir and
|
||||
# top_srcdir appropriately in the Makefiles.
|
||||
AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
|
||||
[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
case $enable_ltdl_convenience in
|
||||
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
|
||||
"") enable_ltdl_convenience=yes
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
|
||||
esac
|
||||
LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
|
||||
INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl installable library and INCLTDL to the include flags for
|
||||
# the libltdl header and adds --enable-ltdl-install to the configure
|
||||
# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
|
||||
# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed
|
||||
# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will
|
||||
# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
|
||||
# with '${top_srcdir}/' (note the single quotes!). If your package is
|
||||
# not flat and you're not using automake, define top_builddir and
|
||||
# top_srcdir appropriately in the Makefiles.
|
||||
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
|
||||
AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
|
||||
[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_CHECK_LIB(ltdl, main,
|
||||
[test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
|
||||
[if test x"$enable_ltdl_install" = xno; then
|
||||
AC_MSG_WARN([libltdl not installed, but installation disabled])
|
||||
else
|
||||
enable_ltdl_install=yes
|
||||
fi
|
||||
])
|
||||
if test x"$enable_ltdl_install" = x"yes"; then
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install"
|
||||
LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
|
||||
INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
|
||||
else
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
|
||||
LIBLTDL="-lltdl"
|
||||
INCLTDL=
|
||||
fi
|
||||
])
|
||||
|
||||
# If this macro is not defined by Autoconf, define it here.
|
||||
ifdef([AC_PROVIDE_IFELSE],
|
||||
[],
|
||||
[define([AC_PROVIDE_IFELSE],
|
||||
[ifdef([AC_PROVIDE_$1],
|
||||
[$2], [$3])])])
|
||||
|
||||
# AC_LIBTOOL_CXX - enable support for C++ libraries
|
||||
AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])])
|
||||
|
||||
AC_DEFUN([_AC_LIBTOOL_CXX],
|
||||
[AC_REQUIRE([AC_PROG_CXX])
|
||||
AC_REQUIRE([AC_PROG_CXXCPP])
|
||||
LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh"
|
||||
lt_save_CC="$CC"
|
||||
lt_save_CFLAGS="$CFLAGS"
|
||||
dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
|
||||
dnl is set to the C++ compiler.
|
||||
AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
|
||||
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
|
||||
AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
|
||||
objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
|
||||
deplibs_check_method="$deplibs_check_method" \
|
||||
file_magic_cmd="$file_magic_cmd" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
|
||||
--build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \
|
||||
|| AC_MSG_ERROR([libtool tag configuration failed])
|
||||
CC="$lt_save_CC"
|
||||
CFLAGS="$lt_save_CFLAGS"
|
||||
|
||||
# Redirect the config.log output again, so that the ltconfig log is not
|
||||
# clobbered by the next message.
|
||||
exec 5>>./config.log
|
||||
])
|
||||
|
||||
# AC_LIBTOOL_GCJ - enable support for GCJ libraries
|
||||
AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])])
|
||||
|
||||
AC_DEFUN([_AC_LIBTOOL_GCJ],
|
||||
[AC_REQUIRE([AC_PROG_LIBTOOL])
|
||||
AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
|
||||
[AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
|
||||
[AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
|
||||
[ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
|
||||
[ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
|
||||
[AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
|
||||
LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh"
|
||||
lt_save_CC="$CC"
|
||||
lt_save_CFLAGS="$CFLAGS"
|
||||
dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
|
||||
dnl is set to the C++ compiler.
|
||||
AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
|
||||
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
|
||||
AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
|
||||
objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
|
||||
deplibs_check_method="$deplibs_check_method" \
|
||||
file_magic_cmd="$file_magic_cmd" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
|
||||
--build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \
|
||||
|| AC_MSG_ERROR([libtool tag configuration failed])
|
||||
CC="$lt_save_CC"
|
||||
CFLAGS="$lt_save_CFLAGS"
|
||||
|
||||
# Redirect the config.log output again, so that the ltconfig log is not
|
||||
# clobbered by the next message.
|
||||
exec 5>>./config.log
|
||||
])
|
||||
|
||||
dnl old names
|
||||
AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL])
|
||||
AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
|
||||
AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
|
||||
AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
|
||||
AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
|
||||
AC_DEFUN([AM_PROG_LD], [AC_PROG_LD])
|
||||
AC_DEFUN([AM_PROG_NM], [AC_PROG_NM])
|
||||
|
||||
dnl This is just to silence aclocal about the macro not being used
|
||||
ifelse([AC_DISABLE_FAST_INSTALL])dnl
|
||||
|
||||
AC_DEFUN([LT_AC_PROG_GCJ],
|
||||
[AC_CHECK_TOOL(GCJ, gcj, no)
|
||||
test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
|
||||
AC_SUBST(GCJFLAGS)
|
||||
])
|
||||
@@ -1,824 +0,0 @@
|
||||
#### This script is meant to be sourced by ltconfig.
|
||||
|
||||
# ltcf-c.sh - Create a C compiler specific configuration
|
||||
#
|
||||
# Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc.
|
||||
# Originally by Gordon Matzigkeit <[email protected]>, 1996
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
|
||||
# Source file extension for C test sources.
|
||||
ac_ext=c
|
||||
|
||||
# Object file extension for compiled C test sources.
|
||||
objext=o
|
||||
|
||||
# Code to be used in simple compile tests
|
||||
lt_simple_compile_test_code="int some_variable = 0;"
|
||||
|
||||
# Code to be used in simple link tests
|
||||
lt_simple_link_test_code='main(){return(0);}'
|
||||
|
||||
## Linker Characteristics
|
||||
case $host_os in
|
||||
cygwin* | mingw*)
|
||||
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
if test "$with_gcc" != yes; then
|
||||
with_gnu_ld=no
|
||||
fi
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
ld_shlibs=yes
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
# If archive_cmds runs LD, not CC, wlarc should be empty
|
||||
wlarc='${wl}'
|
||||
|
||||
# See if GNU ld supports shared libraries.
|
||||
case $host_os in
|
||||
aix3* | aix4* | aix5*)
|
||||
# On AIX/PPC, the GNU linker is very broken
|
||||
if test "$host_cpu" != ia64; then
|
||||
ld_shlibs=no
|
||||
cat <<EOF 1>&2
|
||||
|
||||
*** Warning: the GNU linker, at least up to release 2.9.1, is reported
|
||||
*** to be unable to reliably create shared libraries on AIX.
|
||||
*** Therefore, libtool is disabling shared libraries support. If you
|
||||
*** really care for shared libraries, you may want to modify your PATH
|
||||
*** so that a non-GNU linker is found, and then restart.
|
||||
|
||||
EOF
|
||||
fi
|
||||
;;
|
||||
|
||||
amigaos*)
|
||||
archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
|
||||
# Samuel A. Falvo II <[email protected]> reports
|
||||
# that the semantics of dynamic libraries on AmigaOS, at least up
|
||||
# to version 4, is to share data among multiple programs linked
|
||||
# with the same dynamic library. Since this doesn't match the
|
||||
# behavior of shared libraries on other platforms, we can use
|
||||
# them.
|
||||
ld_shlibs=no
|
||||
;;
|
||||
|
||||
beos*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
allow_undefined_flag=unsupported
|
||||
# Joseph Beckenbach <[email protected]> says some releases of gcc
|
||||
# support --undefined. This deserves some investigation. FIXME
|
||||
archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
|
||||
cygwin* | mingw*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
allow_undefined_flag=unsupported
|
||||
always_export_symbols=yes
|
||||
|
||||
extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
|
||||
sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~
|
||||
test -f $output_objdir/impgen.exe || (cd $output_objdir && \
|
||||
if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
|
||||
else $CC -o impgen impgen.c ; fi)~
|
||||
$output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
|
||||
|
||||
old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
|
||||
|
||||
# cygwin and mingw dlls have different entry points and sets of symbols
|
||||
# to exclude.
|
||||
# FIXME: what about values for MSVC?
|
||||
dll_entry=__cygwin_dll_entry@12
|
||||
dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
|
||||
case $host_os in
|
||||
mingw*)
|
||||
# mingw values
|
||||
dll_entry=_DllMainCRTStartup@12
|
||||
dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
|
||||
;;
|
||||
esac
|
||||
|
||||
# mingw and cygwin differ, and it's simplest to just exclude the union
|
||||
# of the two symbol sets.
|
||||
dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
|
||||
|
||||
# recent cygwin and mingw systems supply a stub DllMain which the user
|
||||
# can override, but on older systems we have to supply one (in ltdll.c)
|
||||
if test "x$lt_cv_need_dllmain" = "xyes"; then
|
||||
ltdll_obj='$output_objdir/$soname-ltdll.'"$objext "
|
||||
ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/$soname-ltdll.c~
|
||||
test -f $output_objdir/$soname-ltdll.$objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
|
||||
else
|
||||
ltdll_obj=
|
||||
ltdll_cmds=
|
||||
fi
|
||||
|
||||
# Extract the symbol export list from an `--export-all' def file,
|
||||
# then regenerate the def file from the symbol export list, so that
|
||||
# the compiled dll only exports the symbol export list.
|
||||
# Be careful not to strip the DATA tag left be newer dlltools.
|
||||
export_symbols_cmds="$ltdll_cmds"'
|
||||
$DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
|
||||
sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
|
||||
|
||||
# If the export-symbols file already is a .def file (1st line
|
||||
# is EXPORTS), use it as is.
|
||||
# If DATA tags from a recent dlltool are present, honour them!
|
||||
archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
|
||||
cp $export_symbols $output_objdir/$soname-def;
|
||||
else
|
||||
echo EXPORTS > $output_objdir/$soname-def;
|
||||
_lt_hint=1;
|
||||
cat $export_symbols | while read symbol; do
|
||||
set dummy \$symbol;
|
||||
case \[$]# in
|
||||
2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
|
||||
*) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;;
|
||||
esac;
|
||||
_lt_hint=`expr 1 + \$_lt_hint`;
|
||||
done;
|
||||
fi~
|
||||
'"$ltdll_cmds"'
|
||||
$CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
|
||||
$DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
|
||||
$CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
|
||||
$DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
|
||||
$CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
|
||||
;;
|
||||
|
||||
darwin* | rhapsody*)
|
||||
allow_undefined_flag='-undefined suppress'
|
||||
archive_cmds='$CC `test .$module = .yes && echo -bundle || echo -dynamiclib` $allow_undefined_flag -o $lib $libobjs $deplibs $linkopts -install_name $rpath/$soname `test -n "$verstring" -a x$verstring != x0.0 && echo $verstring`'
|
||||
# We need to add '_' to the symbols in $export_symbols first
|
||||
#archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
whole_archive_flag_spec='-all_load $convenience'
|
||||
;;
|
||||
|
||||
netbsd*)
|
||||
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
|
||||
archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
|
||||
wlarc=
|
||||
else
|
||||
archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
|
||||
archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
|
||||
fi
|
||||
;;
|
||||
|
||||
solaris* | sysv5*)
|
||||
if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
|
||||
ld_shlibs=no
|
||||
cat <<EOF 1>&2
|
||||
|
||||
*** Warning: The releases 2.8.* of the GNU linker cannot reliably
|
||||
*** create shared libraries on Solaris systems. Therefore, libtool
|
||||
*** is disabling shared libraries support. We urge you to upgrade GNU
|
||||
*** binutils to release 2.9.1 or newer. Another option is to modify
|
||||
*** your PATH or compiler configuration so that the native linker is
|
||||
*** used, and then restart.
|
||||
|
||||
EOF
|
||||
elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
|
||||
archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
|
||||
sunos4*)
|
||||
archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
|
||||
wlarc=
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
|
||||
archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "$ld_shlibs" = yes; then
|
||||
runpath_var=LD_RUN_PATH
|
||||
hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
|
||||
export_dynamic_flag_spec='${wl}--export-dynamic'
|
||||
case $host_os in
|
||||
cygwin* | mingw*)
|
||||
# dlltool doesn't understand --whole-archive et. al.
|
||||
whole_archive_flag_spec=
|
||||
;;
|
||||
*)
|
||||
# ancient GNU ld didn't support --whole-archive et. al.
|
||||
if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
|
||||
whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
|
||||
else
|
||||
whole_archive_flag_spec=
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
# PORTME fill in a description of your system's linker (not GNU ld)
|
||||
case $host_os in
|
||||
aix3*)
|
||||
allow_undefined_flag=unsupported
|
||||
always_export_symbols=yes
|
||||
archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
|
||||
# Note: this linker hardcodes the directories in LIBPATH if there
|
||||
# are no directories specified by -L.
|
||||
hardcode_minus_L=yes
|
||||
if test "$with_gcc" = yes && test -z "$link_static_flag"; then
|
||||
# Neither direct hardcoding nor static linking is supported with a
|
||||
# broken collect2.
|
||||
hardcode_direct=unsupported
|
||||
fi
|
||||
;;
|
||||
|
||||
aix4* | aix5*)
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_separator=':'
|
||||
link_all_deplibs=yes
|
||||
# When large executables or shared objects are built, AIX ld can
|
||||
# have problems creating the table of contents. If linking a library
|
||||
# or program results in "error TOC overflow" add -mminimal-toc to
|
||||
# CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
|
||||
# enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
|
||||
if test "$with_gcc" = yes; then
|
||||
case $host_os in aix4.[012]|aix4.[012].*)
|
||||
# We only want to do this on AIX 4.2 and lower, the check
|
||||
# below for broken collect2 doesn't work under 4.3+
|
||||
collect2name=`${CC} -print-prog-name=collect2`
|
||||
if test -f "$collect2name" && \
|
||||
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
||||
then
|
||||
# We have reworked collect2
|
||||
hardcode_direct=yes
|
||||
else
|
||||
# We have old collect2
|
||||
hardcode_direct=unsupported
|
||||
# It fails to find uninstalled libraries when the uninstalled
|
||||
# path is not listed in the libpath. Setting hardcode_minus_L
|
||||
# to unsupported forces relinking
|
||||
hardcode_minus_L=yes
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_libdir_separator=
|
||||
fi
|
||||
esac
|
||||
shared_flag='-shared'
|
||||
else
|
||||
# not using gcc
|
||||
if test "$host_cpu" = ia64; then
|
||||
shared_flag='${wl}-G'
|
||||
else
|
||||
shared_flag='${wl}-bM:SRE'
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$host_cpu" = ia64; then
|
||||
# On IA64, the linker does run time linking by default, so we don't
|
||||
# have to do anything special.
|
||||
aix_use_runtimelinking=no
|
||||
if test $with_gnu_ld = no; then
|
||||
exp_sym_flag='-Bexport'
|
||||
no_entry_flag=""
|
||||
fi
|
||||
else
|
||||
# Test if we are trying to use run time linking, or normal AIX style linking.
|
||||
# If -brtl is somewhere in LDFLAGS, we need to do run time linking.
|
||||
aix_use_runtimelinking=no
|
||||
for ld_flag in $LDFLAGS; do
|
||||
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
|
||||
aix_use_runtimelinking=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
exp_sym_flag='-bexport'
|
||||
no_entry_flag='-bnoentry'
|
||||
fi
|
||||
# -bexpall does not export symbols beginning with underscore (_)
|
||||
always_export_symbols=yes
|
||||
if test "$aix_use_runtimelinking" = yes; then
|
||||
# Warning - without using the other run time loading flags (-brtl), -berok will
|
||||
# link without error, but may produce a broken library.
|
||||
allow_undefined_flag=' ${wl}-berok'
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
|
||||
archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
|
||||
else
|
||||
if test "$host_cpu" = ia64; then
|
||||
if test $with_gnu_ld = no; then
|
||||
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
|
||||
allow_undefined_flag="-z nodefs"
|
||||
archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
|
||||
fi
|
||||
else
|
||||
allow_undefined_flag=' ${wl}-berok'
|
||||
# -bexpall does not export symbols beginning with underscore (_)
|
||||
always_export_symbols=yes
|
||||
# Exported symbols can be pulled into shared objects from archives
|
||||
whole_archive_flag_spec=' '
|
||||
build_libtool_need_lc=yes
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
|
||||
# This is similar to how AIX traditionally builds it's shared libraries.
|
||||
archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
amigaos*)
|
||||
archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# see comment about different semantics on the GNU ld section
|
||||
ld_shlibs=no
|
||||
;;
|
||||
|
||||
cygwin* | mingw*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec=' '
|
||||
allow_undefined_flag=unsupported
|
||||
# Tell ltmain to make .lib files, not .a files.
|
||||
libext=lib
|
||||
# FIXME: Setting linknames here is a bad hack.
|
||||
archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
|
||||
# The linker will automatically build a .lib file if we build a DLL.
|
||||
old_archive_from_new_cmds='true'
|
||||
# FIXME: Should let the user specify the lib program.
|
||||
old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
|
||||
fix_srcfile_path='`cygpath -w "$srcfile"`'
|
||||
;;
|
||||
|
||||
freebsd1*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
|
||||
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
|
||||
# support. Future versions do this automatically, but an explicit c++rt0.o
|
||||
# does not break anything, and helps significantly (at the cost of a little
|
||||
# extra space).
|
||||
freebsd2.2*)
|
||||
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
|
||||
freebsd2*)
|
||||
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
|
||||
freebsd*)
|
||||
archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
case "$host_cpu" in
|
||||
ia64*)
|
||||
hardcode_direct=no
|
||||
hardcode_shlibpath_var=no
|
||||
archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_libdir_flag_spec='-L$libdir' ;;
|
||||
*)
|
||||
if test $with_gcc = yes; then
|
||||
case "$host_os" in
|
||||
hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
|
||||
*) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;;
|
||||
esac
|
||||
else
|
||||
case $host_os in
|
||||
hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
|
||||
*) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
|
||||
esac
|
||||
fi
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_minus_L=yes # Not in the search PATH, but as the default
|
||||
# location of the library.
|
||||
;;
|
||||
esac
|
||||
export_dynamic_flag_spec='${wl}-E'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
|
||||
irix5* | irix6*)
|
||||
if test "$with_gcc" = yes; then
|
||||
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
|
||||
else
|
||||
archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
|
||||
fi
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
link_all_deplibs=yes
|
||||
;;
|
||||
|
||||
netbsd*)
|
||||
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
|
||||
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
|
||||
else
|
||||
archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
|
||||
fi
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
newsos6)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
openbsd*)
|
||||
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
os2*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
allow_undefined_flag=unsupported
|
||||
archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
|
||||
old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
|
||||
;;
|
||||
|
||||
osf3*)
|
||||
if test "$with_gcc" = yes; then
|
||||
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
|
||||
archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
|
||||
else
|
||||
allow_undefined_flag=' -expect_unresolved \*'
|
||||
archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
|
||||
fi
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
|
||||
osf4* | osf5*) # as osf3* with the addition of -msym flag
|
||||
if test "$with_gcc" = yes; then
|
||||
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
|
||||
archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
else
|
||||
allow_undefined_flag=' -expect_unresolved \*'
|
||||
archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
|
||||
archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
|
||||
$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
|
||||
|
||||
# cc supports -rpath directly
|
||||
hardcode_libdir_flag_spec='-rpath $libdir'
|
||||
fi
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
|
||||
sco3.2v5*)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_shlibpath_var=no
|
||||
runpath_var=LD_RUN_PATH
|
||||
hardcode_runpath_var=yes
|
||||
;;
|
||||
|
||||
solaris*)
|
||||
no_undefined_flag=' -z defs'
|
||||
if test "$with_gcc" = yes; then
|
||||
archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
|
||||
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
|
||||
$CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
|
||||
else
|
||||
archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
|
||||
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
|
||||
fi
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_shlibpath_var=no
|
||||
case $host_os in
|
||||
solaris2.[0-5] | solaris2.[0-5].*) ;;
|
||||
*) # Supported since Solaris 2.6 (maybe 2.5.1?)
|
||||
whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
|
||||
esac
|
||||
link_all_deplibs=yes
|
||||
;;
|
||||
|
||||
sunos4*)
|
||||
archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
sysv4)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
runpath_var='LD_RUN_PATH'
|
||||
hardcode_shlibpath_var=no
|
||||
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
|
||||
;;
|
||||
|
||||
sysv4.3*)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_shlibpath_var=no
|
||||
export_dynamic_flag_spec='-Bexport'
|
||||
;;
|
||||
|
||||
sysv5*)
|
||||
no_undefined_flag=' -z text'
|
||||
# $CC -shared without GNU ld will not create a library from C++
|
||||
# object files and a static libstdc++, better avoid it by now
|
||||
archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
|
||||
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
|
||||
hardcode_libdir_flag_spec=
|
||||
hardcode_shlibpath_var=no
|
||||
runpath_var='LD_RUN_PATH'
|
||||
;;
|
||||
|
||||
uts4*)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
dgux*)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_shlibpath_var=no
|
||||
runpath_var=LD_RUN_PATH
|
||||
hardcode_runpath_var=yes
|
||||
ld_shlibs=yes
|
||||
fi
|
||||
;;
|
||||
|
||||
sysv4.2uw2*)
|
||||
archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=no
|
||||
hardcode_shlibpath_var=no
|
||||
hardcode_runpath_var=yes
|
||||
runpath_var=LD_RUN_PATH
|
||||
;;
|
||||
|
||||
sysv5uw7* | unixware7*)
|
||||
no_undefined_flag='${wl}-z ${wl}text'
|
||||
if test "$GCC" = yes; then
|
||||
archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
|
||||
else
|
||||
archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
|
||||
fi
|
||||
runpath_var='LD_RUN_PATH'
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
## Compiler Characteristics: PIC flags, static flags, etc
|
||||
if test "X${ac_cv_prog_cc_pic+set}" = Xset; then
|
||||
:
|
||||
else
|
||||
ac_cv_prog_cc_pic=
|
||||
ac_cv_prog_cc_shlib=
|
||||
ac_cv_prog_cc_wl=
|
||||
ac_cv_prog_cc_static=
|
||||
ac_cv_prog_cc_no_builtin=
|
||||
ac_cv_prog_cc_can_build_shared=$can_build_shared
|
||||
|
||||
if test "$with_gcc" = yes; then
|
||||
ac_cv_prog_cc_wl='-Wl,'
|
||||
ac_cv_prog_cc_static='-static'
|
||||
|
||||
case $host_os in
|
||||
aix*)
|
||||
# All AIX code is PIC.
|
||||
if test "$host_cpu" = ia64; then
|
||||
# AIX 5 now supports IA64 processor
|
||||
lt_cv_prog_cc_static='-Bstatic'
|
||||
else
|
||||
lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
# FIXME: we need at least 68020 code to build shared libraries, but
|
||||
# adding the `-m68020' flag to GCC prevents building anything better,
|
||||
# like `-m68040'.
|
||||
ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
|
||||
;;
|
||||
beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
|
||||
# PIC is the default for these OSes.
|
||||
;;
|
||||
cygwin* | mingw* | os2*)
|
||||
# This hack is so that the source file can tell whether it is being
|
||||
# built for inclusion in a dll (and should export symbols for example).
|
||||
ac_cv_prog_cc_pic='-DDLL_EXPORT'
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
# PIC is the default on this platform
|
||||
# Common symbols not allowed in MH_DYLIB files
|
||||
lt_cv_prog_cc_pic='-fno-common'
|
||||
;;
|
||||
*djgpp*)
|
||||
# DJGPP does not support shared libraries at all
|
||||
ac_cv_prog_cc_pic=
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
ac_cv_prog_cc_pic=-Kconform_pic
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
ac_cv_prog_cc_pic='-fPIC'
|
||||
;;
|
||||
esac
|
||||
else
|
||||
# PORTME Check for PIC flags for the system compiler.
|
||||
case $host_os in
|
||||
aix*)
|
||||
# All AIX code is PIC.
|
||||
ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
|
||||
;;
|
||||
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
# Is there a better ac_cv_prog_cc_static that works with the bundled CC?
|
||||
ac_cv_prog_cc_wl='-Wl,'
|
||||
ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
|
||||
ac_cv_prog_cc_pic='+Z'
|
||||
;;
|
||||
|
||||
irix5* | irix6*)
|
||||
ac_cv_prog_cc_wl='-Wl,'
|
||||
ac_cv_prog_cc_static='-non_shared'
|
||||
# PIC (with -KPIC) is the default.
|
||||
;;
|
||||
|
||||
cygwin* | mingw* | os2*)
|
||||
# This hack is so that the source file can tell whether it is being
|
||||
# built for inclusion in a dll (and should export symbols for example).
|
||||
ac_cv_prog_cc_pic='-DDLL_EXPORT'
|
||||
;;
|
||||
|
||||
newsos6)
|
||||
ac_cv_prog_cc_pic='-KPIC'
|
||||
ac_cv_prog_cc_static='-Bstatic'
|
||||
;;
|
||||
|
||||
osf3* | osf4* | osf5*)
|
||||
# All OSF/1 code is PIC.
|
||||
ac_cv_prog_cc_wl='-Wl,'
|
||||
ac_cv_prog_cc_static='-non_shared'
|
||||
;;
|
||||
|
||||
sco3.2v5*)
|
||||
ac_cv_prog_cc_pic='-Kpic'
|
||||
ac_cv_prog_cc_static='-dn'
|
||||
ac_cv_prog_cc_shlib='-belf'
|
||||
;;
|
||||
|
||||
solaris*)
|
||||
ac_cv_prog_cc_pic='-KPIC'
|
||||
ac_cv_prog_cc_static='-Bstatic'
|
||||
ac_cv_prog_cc_wl='-Wl,'
|
||||
;;
|
||||
|
||||
sunos4*)
|
||||
ac_cv_prog_cc_pic='-PIC'
|
||||
ac_cv_prog_cc_static='-Bstatic'
|
||||
ac_cv_prog_cc_wl='-Qoption ld '
|
||||
;;
|
||||
|
||||
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
||||
ac_cv_prog_cc_pic='-KPIC'
|
||||
ac_cv_prog_cc_static='-Bstatic'
|
||||
ac_cv_prog_cc_wl='-Wl,'
|
||||
;;
|
||||
|
||||
uts4*)
|
||||
ac_cv_prog_cc_pic='-pic'
|
||||
ac_cv_prog_cc_static='-Bstatic'
|
||||
;;
|
||||
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec ;then
|
||||
ac_cv_prog_cc_pic='-Kconform_pic'
|
||||
ac_cv_prog_cc_static='-Bstatic'
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
ac_cv_prog_cc_can_build_shared=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case "$host_os" in
|
||||
# Platforms which do not suport PIC and -DPIC is meaningless
|
||||
# on them:
|
||||
*djgpp*)
|
||||
ac_cv_prog_cc_pic=
|
||||
;;
|
||||
*)
|
||||
ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
need_lc=yes
|
||||
if test "$enable_shared" = yes && test "$with_gcc" = yes; then
|
||||
case $archive_cmds in
|
||||
*'~'*)
|
||||
# FIXME: we may have to deal with multi-command sequences.
|
||||
;;
|
||||
'$CC '*)
|
||||
# Test whether the compiler implicitly links with -lc since on some
|
||||
# systems, -lgcc has to come before -lc. If gcc already passes -lc
|
||||
# to ld, don't add -lc before -lgcc.
|
||||
echo $ac_n "checking whether -lc should be explicitly linked in... $ac_c" 1>&6
|
||||
if eval "test \"`echo '$''{'ac_cv_archive_cmds_needs_lc'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
need_lc=$ac_cv_archive_cmds_needs_lc
|
||||
else
|
||||
$rm conftest*
|
||||
echo "static int dummy;" > conftest.$ac_ext
|
||||
if { (eval echo ltcf-c.sh:need_lc: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
|
||||
# Append any warnings to the config.log.
|
||||
cat conftest.err 1>&5
|
||||
soname=conftest
|
||||
lib=conftest
|
||||
libobjs=conftest.$objext
|
||||
deplibs=
|
||||
wl=$ac_cv_prog_cc_wl
|
||||
compiler_flags=-v
|
||||
linker_flags=-v
|
||||
verstring=
|
||||
output_objdir=.
|
||||
libname=conftest
|
||||
save_allow_undefined_flag=$allow_undefined_flag
|
||||
allow_undefined_flag=
|
||||
if { (eval echo ltcf-c.sh:need_lc: \"$archive_cmds\") 1>&5; (eval $archive_cmds) 2>&1 | grep " -lc " 1>&5 ; }; then
|
||||
need_lc=no
|
||||
fi
|
||||
allow_undefined_flag=$save_allow_undefined_flag
|
||||
else
|
||||
cat conftest.err 1>&5
|
||||
fi
|
||||
fi
|
||||
$rm conftest*
|
||||
echo "$ac_t$need_lc" 1>&6
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
ac_cv_archive_cmds_needs_lc=$need_lc
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,651 +0,0 @@
|
||||
#### This script is meant to be sourced by ltconfig.
|
||||
|
||||
# ltcf-gcj.sh - Create a GCJ compiler specific configuration
|
||||
#
|
||||
# Copyright (C) 1996-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
# Originally by Gordon Matzigkeit <[email protected]>, 1996
|
||||
#
|
||||
# Original GCJ support by:
|
||||
# Alexandre Oliva <[email protected]>
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
|
||||
# Source file extension for Java test sources.
|
||||
ac_ext=java
|
||||
|
||||
# Object file extension for compiled Java test sources.
|
||||
objext=o
|
||||
|
||||
# Code to be used in simple compile tests
|
||||
lt_simple_compile_test_code="class foo {}"
|
||||
|
||||
# Code to be used in simple link tests
|
||||
lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }'
|
||||
|
||||
## Linker Characteristics
|
||||
case $host_os in
|
||||
cygwin* | mingw*)
|
||||
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
if test "$with_gcc" != yes; then
|
||||
with_gnu_ld=no
|
||||
fi
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
ld_shlibs=yes
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
# If archive_cmds runs LD, not CC, wlarc should be empty
|
||||
wlarc='${wl}'
|
||||
|
||||
# See if GNU ld supports shared libraries.
|
||||
case $host_os in
|
||||
aix3* | aix4* | aix5*)
|
||||
# On AIX/PPC, the GNU linker is very broken
|
||||
if test "$host_cpu" != ia64; then
|
||||
ld_shlibs=no
|
||||
cat <<EOF 1>&2
|
||||
|
||||
*** Warning: the GNU linker, at least up to release 2.9.1, is reported
|
||||
*** to be unable to reliably create shared libraries on AIX.
|
||||
*** Therefore, libtool is disabling shared libraries support. If you
|
||||
*** really care for shared libraries, you may want to modify your PATH
|
||||
*** so that a non-GNU linker is found, and then restart.
|
||||
|
||||
EOF
|
||||
fi
|
||||
;;
|
||||
|
||||
amigaos*)
|
||||
archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
|
||||
# Samuel A. Falvo II <[email protected]> reports
|
||||
# that the semantics of dynamic libraries on AmigaOS, at least up
|
||||
# to version 4, is to share data among multiple programs linked
|
||||
# with the same dynamic library. Since this doesn't match the
|
||||
# behavior of shared libraries on other platforms, we can use
|
||||
# them.
|
||||
ld_shlibs=no
|
||||
;;
|
||||
|
||||
beos*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
allow_undefined_flag=unsupported
|
||||
# Joseph Beckenbach <[email protected]> says some releases of gcc
|
||||
# support --undefined. This deserves some investigation. FIXME
|
||||
archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
|
||||
cygwin* | mingw*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
allow_undefined_flag=unsupported
|
||||
always_export_symbols=yes
|
||||
|
||||
extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
|
||||
sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~
|
||||
test -f $output_objdir/impgen.exe || (cd $output_objdir && \
|
||||
if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
|
||||
else $CC -o impgen impgen.c ; fi)~
|
||||
$output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
|
||||
|
||||
old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
|
||||
|
||||
# cygwin and mingw dlls have different entry points and sets of symbols
|
||||
# to exclude.
|
||||
# FIXME: what about values for MSVC?
|
||||
dll_entry=__cygwin_dll_entry@12
|
||||
dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
|
||||
case $host_os in
|
||||
mingw*)
|
||||
# mingw values
|
||||
dll_entry=_DllMainCRTStartup@12
|
||||
dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
|
||||
;;
|
||||
esac
|
||||
|
||||
# mingw and cygwin differ, and it's simplest to just exclude the union
|
||||
# of the two symbol sets.
|
||||
dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
|
||||
|
||||
# recent cygwin and mingw systems supply a stub DllMain which the user
|
||||
# can override, but on older systems we have to supply one (in ltdll.c)
|
||||
if test "x$lt_cv_need_dllmain" = "xyes"; then
|
||||
ltdll_obj='$output_objdir/$soname-ltdll.'"$objext "
|
||||
ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/$soname-ltdll.c~
|
||||
test -f $output_objdir/$soname-ltdll.$objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
|
||||
else
|
||||
ltdll_obj=
|
||||
ltdll_cmds=
|
||||
fi
|
||||
|
||||
# Extract the symbol export list from an `--export-all' def file,
|
||||
# then regenerate the def file from the symbol export list, so that
|
||||
# the compiled dll only exports the symbol export list.
|
||||
# Be careful not to strip the DATA tag left be newer dlltools.
|
||||
export_symbols_cmds="$ltdll_cmds"'
|
||||
$DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
|
||||
sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
|
||||
|
||||
# If the export-symbols file already is a .def file (1st line
|
||||
# is EXPORTS), use it as is.
|
||||
# If DATA tags from a recent dlltool are present, honour them!
|
||||
archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
|
||||
cp $export_symbols $output_objdir/$soname-def;
|
||||
else
|
||||
echo EXPORTS > $output_objdir/$soname-def;
|
||||
_lt_hint=1;
|
||||
cat $export_symbols | while read symbol; do
|
||||
set dummy \$symbol;
|
||||
case \[$]# in
|
||||
2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
|
||||
*) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;;
|
||||
esac;
|
||||
_lt_hint=`expr 1 + \$_lt_hint`;
|
||||
done;
|
||||
fi~
|
||||
'"$ltdll_cmds"'
|
||||
$CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
|
||||
$DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
|
||||
$CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
|
||||
$DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
|
||||
$CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
|
||||
;;
|
||||
|
||||
netbsd*)
|
||||
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
|
||||
archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
|
||||
wlarc=
|
||||
else
|
||||
archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
|
||||
archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
|
||||
fi
|
||||
;;
|
||||
|
||||
solaris* | sysv5*)
|
||||
if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
|
||||
ld_shlibs=no
|
||||
cat <<EOF 1>&2
|
||||
|
||||
*** Warning: The releases 2.8.* of the GNU linker cannot reliably
|
||||
*** create shared libraries on Solaris systems. Therefore, libtool
|
||||
*** is disabling shared libraries support. We urge you to upgrade GNU
|
||||
*** binutils to release 2.9.1 or newer. Another option is to modify
|
||||
*** your PATH or compiler configuration so that the native linker is
|
||||
*** used, and then restart.
|
||||
|
||||
EOF
|
||||
elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
|
||||
archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
|
||||
sunos4*)
|
||||
archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
|
||||
wlarc=
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
|
||||
archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "$ld_shlibs" = yes; then
|
||||
runpath_var=LD_RUN_PATH
|
||||
hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
|
||||
export_dynamic_flag_spec='${wl}--export-dynamic'
|
||||
case $host_os in
|
||||
cygwin* | mingw*)
|
||||
# dlltool doesn't understand --whole-archive et. al.
|
||||
whole_archive_flag_spec=
|
||||
;;
|
||||
*)
|
||||
# ancient GNU ld didn't support --whole-archive et. al.
|
||||
if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
|
||||
whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
|
||||
else
|
||||
whole_archive_flag_spec=
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
# PORTME fill in a description of your system's linker (not GNU ld)
|
||||
case $host_os in
|
||||
aix3*)
|
||||
allow_undefined_flag=unsupported
|
||||
always_export_symbols=yes
|
||||
archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
|
||||
# Note: this linker hardcodes the directories in LIBPATH if there
|
||||
# are no directories specified by -L.
|
||||
hardcode_minus_L=yes
|
||||
if test "$with_gcc" = yes && test -z "$link_static_flag"; then
|
||||
# Neither direct hardcoding nor static linking is supported with a
|
||||
# broken collect2.
|
||||
hardcode_direct=unsupported
|
||||
fi
|
||||
;;
|
||||
|
||||
aix4* | aix5*)
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_separator=':'
|
||||
link_all_deplibs=yes
|
||||
# When large executables or shared objects are built, AIX ld can
|
||||
# have problems creating the table of contents. If linking a library
|
||||
# or program results in "error TOC overflow" add -mminimal-toc to
|
||||
# CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
|
||||
# enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
|
||||
if test "$with_gcc" = yes; then
|
||||
case $host_os in aix4.[012]|aix4.[012].*)
|
||||
# We only want to do this on AIX 4.2 and lower, the check
|
||||
# below for broken collect2 doesn't work under 4.3+
|
||||
collect2name=`${CC} -print-prog-name=collect2`
|
||||
if test -f "$collect2name" && \
|
||||
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
||||
then
|
||||
# We have reworked collect2
|
||||
hardcode_direct=yes
|
||||
else
|
||||
# We have old collect2
|
||||
hardcode_direct=unsupported
|
||||
# It fails to find uninstalled libraries when the uninstalled
|
||||
# path is not listed in the libpath. Setting hardcode_minus_L
|
||||
# to unsupported forces relinking
|
||||
hardcode_minus_L=yes
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_libdir_separator=
|
||||
fi
|
||||
esac
|
||||
shared_flag='-shared'
|
||||
else
|
||||
# not using gcc
|
||||
if test "$host_cpu" = ia64; then
|
||||
shared_flag='${wl}-G'
|
||||
else
|
||||
shared_flag='${wl}-bM:SRE'
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$host_cpu" = ia64; then
|
||||
# On IA64, the linker does run time linking by default, so we don't
|
||||
# have to do anything special.
|
||||
aix_use_runtimelinking=no
|
||||
if test $with_gnu_ld = no; then
|
||||
exp_sym_flag='-Bexport'
|
||||
no_entry_flag=""
|
||||
fi
|
||||
else
|
||||
# Test if we are trying to use run time linking, or normal AIX style linking.
|
||||
# If -brtl is somewhere in LDFLAGS, we need to do run time linking.
|
||||
aix_use_runtimelinking=no
|
||||
for ld_flag in $LDFLAGS; do
|
||||
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
|
||||
aix_use_runtimelinking=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
exp_sym_flag='-bexport'
|
||||
no_entry_flag='-bnoentry'
|
||||
fi
|
||||
# -bexpall does not export symbols beginning with underscore (_)
|
||||
always_export_symbols=yes
|
||||
if test "$aix_use_runtimelinking" = yes; then
|
||||
# Warning - without using the other run time loading flags (-brtl), -berok will
|
||||
# link without error, but may produce a broken library.
|
||||
allow_undefined_flag=' ${wl}-berok'
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
|
||||
archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
|
||||
else
|
||||
if test "$host_cpu" = ia64; then
|
||||
if test $with_gnu_ld = no; then
|
||||
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
|
||||
allow_undefined_flag="-z nodefs"
|
||||
archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
|
||||
fi
|
||||
else
|
||||
allow_undefined_flag=' ${wl}-berok'
|
||||
# -bexpall does not export symbols beginning with underscore (_)
|
||||
always_export_symbols=yes
|
||||
# Exported symbols can be pulled into shared objects from archives
|
||||
whole_archive_flag_spec=' '
|
||||
build_libtool_need_lc=yes
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
|
||||
# This is similar to how AIX traditionally builds it's shared libraries.
|
||||
archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
amigaos*)
|
||||
archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# see comment about different semantics on the GNU ld section
|
||||
ld_shlibs=no
|
||||
;;
|
||||
|
||||
cygwin* | mingw*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec=' '
|
||||
allow_undefined_flag=unsupported
|
||||
# Tell ltmain to make .lib files, not .a files.
|
||||
libext=lib
|
||||
# FIXME: Setting linknames here is a bad hack.
|
||||
archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
|
||||
# The linker will automatically build a .lib file if we build a DLL.
|
||||
old_archive_from_new_cmds='true'
|
||||
# FIXME: Should let the user specify the lib program.
|
||||
old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
|
||||
fix_srcfile_path='`cygpath -w "$srcfile"`'
|
||||
;;
|
||||
|
||||
freebsd1*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
|
||||
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
|
||||
# support. Future versions do this automatically, but an explicit c++rt0.o
|
||||
# does not break anything, and helps significantly (at the cost of a little
|
||||
# extra space).
|
||||
freebsd2.2*)
|
||||
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
|
||||
freebsd2*)
|
||||
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
|
||||
freebsd*)
|
||||
archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
case $host_os in
|
||||
hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
|
||||
*) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
|
||||
esac
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes # Not in the search PATH, but as the default
|
||||
# location of the library.
|
||||
export_dynamic_flag_spec='${wl}-E'
|
||||
;;
|
||||
|
||||
irix5* | irix6*)
|
||||
if test "$with_gcc" = yes; then
|
||||
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
|
||||
else
|
||||
archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
|
||||
fi
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
link_all_deplibs=yes
|
||||
;;
|
||||
|
||||
netbsd*)
|
||||
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
|
||||
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
|
||||
else
|
||||
archive_cmds='$LD -shared -nodefaultlibs -o $lib $libobjs $deplibs $linker_flags' # ELF
|
||||
fi
|
||||
hardcode_libdir_flag_spec='${wl}-R$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
openbsd*)
|
||||
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
os2*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
allow_undefined_flag=unsupported
|
||||
archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
|
||||
old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
|
||||
;;
|
||||
|
||||
osf3*)
|
||||
if test "$with_gcc" = yes; then
|
||||
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
|
||||
archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
|
||||
else
|
||||
allow_undefined_flag=' -expect_unresolved \*'
|
||||
archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
|
||||
fi
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
|
||||
osf4* | osf5*) # as osf3* with the addition of -msym flag
|
||||
if test "$with_gcc" = yes; then
|
||||
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
|
||||
archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
|
||||
else
|
||||
allow_undefined_flag=' -expect_unresolved \*'
|
||||
archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
|
||||
fi
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
|
||||
sco3.2v5*)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_shlibpath_var=no
|
||||
runpath_var=LD_RUN_PATH
|
||||
hardcode_runpath_var=yes
|
||||
;;
|
||||
|
||||
solaris*)
|
||||
no_undefined_flag=' ${wl}-z ${wl}defs'
|
||||
archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
|
||||
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
|
||||
$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
|
||||
|
||||
# Commands to make compiler produce verbose output that lists
|
||||
# what "hidden" libraries, object files and flags are used when
|
||||
# linking a shared library.
|
||||
output_verbose_link_cmds="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
|
||||
|
||||
hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
|
||||
hardcode_shlibpath_var=no
|
||||
case $host_os in
|
||||
solaris2.[0-5] | solaris2.[0-5].*) ;;
|
||||
*) # Supported since Solaris 2.6 (maybe 2.5.1?)
|
||||
whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;;
|
||||
esac
|
||||
link_all_deplibs=yes
|
||||
;;
|
||||
|
||||
sunos4*)
|
||||
archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
sysv4)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
runpath_var='LD_RUN_PATH'
|
||||
hardcode_shlibpath_var=no
|
||||
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
|
||||
;;
|
||||
|
||||
sysv4.3*)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_shlibpath_var=no
|
||||
export_dynamic_flag_spec='-Bexport'
|
||||
;;
|
||||
|
||||
sysv5*)
|
||||
no_undefined_flag=' -z text'
|
||||
# $CC -shared without GNU ld will not create a library from C++
|
||||
# object files and a static libstdc++, better avoid it by now
|
||||
archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
|
||||
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
|
||||
hardcode_libdir_flag_spec=
|
||||
hardcode_shlibpath_var=no
|
||||
runpath_var='LD_RUN_PATH'
|
||||
;;
|
||||
|
||||
uts4*)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
dgux*)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_shlibpath_var=no
|
||||
runpath_var=LD_RUN_PATH
|
||||
hardcode_runpath_var=yes
|
||||
ld_shlibs=yes
|
||||
fi
|
||||
;;
|
||||
|
||||
sysv4.2uw2*)
|
||||
archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=no
|
||||
hardcode_shlibpath_var=no
|
||||
hardcode_runpath_var=yes
|
||||
runpath_var=LD_RUN_PATH
|
||||
;;
|
||||
|
||||
sysv5uw7* | unixware7*)
|
||||
no_undefined_flag='${wl}-z ${wl}text'
|
||||
if test "$GCC" = yes; then
|
||||
archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
|
||||
else
|
||||
archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
|
||||
fi
|
||||
runpath_var='LD_RUN_PATH'
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
## Compiler Characteristics: PIC flags, static flags, etc
|
||||
|
||||
# We don't use cached values here since only the C compiler
|
||||
# characteristics should be cached.
|
||||
ac_cv_prog_cc_pic=
|
||||
ac_cv_prog_cc_shlib=
|
||||
ac_cv_prog_cc_wl=
|
||||
ac_cv_prog_cc_static=
|
||||
ac_cv_prog_cc_no_builtin=
|
||||
ac_cv_prog_cc_can_build_shared=$can_build_shared
|
||||
|
||||
ac_cv_prog_cc_wl='-Wl,'
|
||||
ac_cv_prog_cc_static='-static'
|
||||
|
||||
case $host_os in
|
||||
beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
|
||||
# PIC is the default for these OSes.
|
||||
;;
|
||||
aix*)
|
||||
# Below there is a dirty hack to force normal static linking with -ldl
|
||||
# The problem is because libdl dynamically linked with both libc and
|
||||
# libC (AIX C++ library), which obviously doesn't included in libraries
|
||||
# list by gcc. This cause undefined symbols with -static flags.
|
||||
# This hack allows C programs to be linked with "-static -ldl", but
|
||||
# we not sure about C++ programs.
|
||||
ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
|
||||
;;
|
||||
*djgpp*)
|
||||
# DJGPP does not suppot shared libraries at all
|
||||
ac_cv_prog_cc_pic=
|
||||
;;
|
||||
cygwin* | mingw* | os2*)
|
||||
# This hack is so that the source file can tell whether it is being
|
||||
# built for inclusion in a dll (and should export symbols for example).
|
||||
ac_cv_prog_cc_pic='-DDLL_EXPORT'
|
||||
;;
|
||||
amigaos*)
|
||||
# FIXME: we need at least 68020 code to build shared libraries, but
|
||||
# adding the `-m68020' flag to GCC prevents building anything better,
|
||||
# like `-m68040'.
|
||||
ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
ac_cv_prog_cc_pic=-Kconform_pic
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
ac_cv_prog_cc_pic='-fPIC'
|
||||
;;
|
||||
esac
|
||||
|
||||
# GCJ did not exist at the time GCC didn't implicitly link libc in.
|
||||
need_lc=no
|
||||
|
||||
# All existing releases of GCJ support `-c -o'.
|
||||
lt_cv_compiler_c_o=yes
|
||||
@@ -1,6 +0,0 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# citrus locale declaration
|
||||
#
|
||||
|
||||
0 string RuneCT Citrus locale declaration for LC_CTYPE
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# natinst: file(1) magic for National Instruments Code Files
|
||||
|
||||
#
|
||||
# From <[email protected]> Enrique Gámez-Flores
|
||||
# version 1
|
||||
# Many formats still missing, we use, for the moment LabVIEW
|
||||
# We guess VXI format file. VISA, LabWindowsCVI, BridgeVIEW, etc, are missing
|
||||
#
|
||||
0 string RSRC National Instruments,
|
||||
# Check if it's a LabVIEW File
|
||||
>8 string LV LabVIEW File,
|
||||
# Check wich kind of file is
|
||||
>>10 string SB Code Resource File, data
|
||||
>>10 string IN Virtual Instrument Program, data
|
||||
>>10 string AR VI Library, data
|
||||
# This is for Menu Libraries
|
||||
>8 string LMNULBVW Portable File Names, data
|
||||
# This is for General Resources
|
||||
>8 string rsc Resources File, data
|
||||
# This is for VXI Package
|
||||
0 string VMAP National Instruments, VXI File, data
|
||||
@@ -1,169 +1,3 @@
|
||||
2001-10-02 Zack Weinberg <[email protected]>
|
||||
|
||||
* gcc.c (main): Set this_file_error if the appropriate
|
||||
compiler for a language has not been installed.
|
||||
|
||||
2001-09-17 Philip Blundell <[email protected]>
|
||||
|
||||
* cccp.c (print_help): Fix typos.
|
||||
|
||||
2001-08-29 David O'Brien <[email protected]>
|
||||
|
||||
* config/alpha/crtbegin.asm: The normal calling convention for alpha is
|
||||
to re-initialize gp using 'ldgp gp,0(ra)' after a jsr instruction.
|
||||
|
||||
2001-06-19 Bernd Schmidt <[email protected]>
|
||||
|
||||
* regmove.c (optimize_reg_copy_3): Do nothing if previous insn
|
||||
carries a REG_EQUIV note. If it carries REG_EQUAL, delete the
|
||||
note.
|
||||
|
||||
2001-05-22 Bernd Schmidt <[email protected]>
|
||||
|
||||
* sparc.md (movsf, movdf): Allow constant to integer reg moves.
|
||||
(movsf, movdf splitters): Always split if there's an alignment
|
||||
problem.
|
||||
|
||||
2001-05-22 David Edelsohn <[email protected]>
|
||||
|
||||
* rs6000.md (movsfcc,movdfcc): Remove NE case.
|
||||
|
||||
2001-05-17 Bernd Schmidt <[email protected]>
|
||||
|
||||
* function.c: Small formatting change to prevent compilation errors
|
||||
on broken hpux systems.
|
||||
|
||||
* expr.c (protect_from_queue): Protect against subsequent calls to
|
||||
emit_queue.
|
||||
(expand_expr, case ADDR_EXPR): Prevent protect_from_queue from being
|
||||
too clever.
|
||||
|
||||
2001-04-06 Bernd Schmidt <[email protected]>
|
||||
|
||||
2000-10-17 Franz Sirl <[email protected]>
|
||||
* function.c (locate_and_pad_parm): Don't align stack unconditionally.
|
||||
|
||||
Thu Oct 28 10:20:02 1999 Geoffrey Keating <[email protected]>
|
||||
* config/rs6000/rs6000.md (movsf): Don't convert a SUBREG
|
||||
of the function return register into a plain REG until
|
||||
after function inlining is done.
|
||||
|
||||
2001-04-04 Bernd Schmidt <[email protected]>
|
||||
|
||||
Fri Nov 5 10:07:25 1999 Nick Clifton <[email protected]>
|
||||
* function.c (is_addressof): New function. Returns true if
|
||||
the given piece of RTL is an ADDRESSOF.
|
||||
(purge_addressof_1): Make boolean. Return false if the
|
||||
ADDRESSOFs could not be purged.
|
||||
(purge_addressof): If ADDRESSOFs could not be purged from the
|
||||
notes attached to an insn, remove the offending note(s),
|
||||
unless they are attached to a libcall.
|
||||
|
||||
2001-04-03 Bernd Schmidt <[email protected]>
|
||||
|
||||
2001-03-16 Jakub Jelinek <[email protected]>
|
||||
* crtstuff.c (init_dummy): Use CRT_END_INIT_DUMMY if defined.
|
||||
Remove ia32 linux PIC kludge and move it...
|
||||
* config/i386/linux.h (CRT_END_INIT_DUMMY): ...here.
|
||||
|
||||
* loop.c (combine_movables): Restrict combinations of constants with
|
||||
different modes so that we don't introduce SUBREGs into memory
|
||||
addresses.
|
||||
|
||||
2001-02-02 Philip Blundell <[email protected]>
|
||||
* arm/linux-elf.h (MAKE_DECL_ONE_ONLY, UNIQUE_SECTION_P): Define.
|
||||
(UNIQUE_SECTION): Define.
|
||||
|
||||
Wed Aug 25 15:27:22 1999 Gavin Romig-Koch <[email protected]>
|
||||
* combine.c (nonzero_bits) : Allow single-ly set registers to be
|
||||
anywere in the function only if they are pseudos and set before
|
||||
being used (not live at the start of the function).
|
||||
(num_sign_bit_copies) : Same.
|
||||
(get_last_value_validate) : Same.
|
||||
(get_last_value) : Same.
|
||||
|
||||
Fri Mar 3 12:49:28 2000 J"orn Rennecke <[email protected]>
|
||||
* reload1.c (reload_combine_note_use): Handle return register USEs.
|
||||
REG case: Handle multi-hard-register hard regs.
|
||||
|
||||
2001-03-30 Bernd Schmidt <[email protected]>
|
||||
|
||||
* jump.c (delete_barrier_successors): Fix error in last change.
|
||||
|
||||
* reload1.c (delete_output_reload): Call eliminate_regs on substed.
|
||||
(reload_as_needed): Call update_eliminable_offsets a bit later.
|
||||
|
||||
* final.c (cleanup_subreg_operands): Also clean up inside MEMs.
|
||||
|
||||
Mon Oct 4 02:31:20 1999 Mark Mitchell <[email protected]>
|
||||
* mips.md: Define conditional move patterns for floating point
|
||||
operands and DI mode conditions.
|
||||
|
||||
2000-11-25 Jakub Jelinek <[email protected]>
|
||||
* config/sparc/sparc.md (muldi3_v8plus): Remove H constraint.
|
||||
Handle CONST_INT as second argument.
|
||||
|
||||
2001-03-28 Bernd Schmidt <[email protected]>
|
||||
|
||||
* flow.c (propagate_block): When trying to delete a case vector, cope
|
||||
if its label has LABEL_PRESERVE_P set.
|
||||
* jump.c (jump_optimize_1): Move call to delete_barrier_successors to
|
||||
a point where JUMP_LABELS and LABEL_NUSES are set up properly.
|
||||
(delete_barrier_successors): If deleting a table jump, delete the case
|
||||
vector as well.
|
||||
* varasm.c (force_const_mem): If we have a label, set LABEL_PRESERVE_P
|
||||
so it won't get deleted.
|
||||
|
||||
Tue Mar 20 18:31:48 2001 Kaveh R. Ghazi <[email protected]>
|
||||
|
||||
1999-11-30 Kaveh R. Ghazi <[email protected]>
|
||||
* c-lex.c (yylex): With -Wtraditional, when the ANSI type of an
|
||||
integer constant does not match the traditional type, limit the
|
||||
warnings to cases where the base of the type is ten.
|
||||
|
||||
* invoke.texi (-Wtraditional): Document it.
|
||||
|
||||
2001-03-20 David O'Brien <[email protected]>
|
||||
|
||||
from 2000-07-12 Zack Weinberg <[email protected]>
|
||||
* final.c (profile_function): Do not emit profile counters in
|
||||
the data section, if NO_PROFILE_COUNTERS is defined.
|
||||
* tm.texi: Document NO_PROFILE_COUNTERS. Update doc for
|
||||
FUNCTION_PROFILER.
|
||||
|
||||
from 2000-10-02 David O'Brien <[email protected]>
|
||||
* config/i386/freebsd.h (NO_PROFILE_COUNTERS): Define.
|
||||
|
||||
2001-03-19 Bernd Schmidt <[email protected]>
|
||||
|
||||
* version.c: Bump.
|
||||
|
||||
2000-01-18 Martin v. Löwis <[email protected]>
|
||||
* c-parse.in (SAVE_WARN_FLAGS): Create an INTEGER_CST.
|
||||
(RESTORE_WARN_FLAGS): Unpack it.
|
||||
Change semantic type of extension to ttype.
|
||||
* c-common.c (split_specs_attrs): Expect an INTEGER_CST.
|
||||
* c-parse.y, c-parse.c, objc/objc-parse.y,
|
||||
objc/objc-parse.c: Regenerate.
|
||||
|
||||
Wed Sep 1 09:12:02 1999 Jim Kingdon <http://developer.redhat.com>
|
||||
* c-parse.in: save and restore warn_pointer_arith on __extension__
|
||||
along with pedantic.
|
||||
(SAVE_WARN_FLAGS, RESTORE_WARN_FLAGS): Added.
|
||||
Set the type of extension to itype rather than $<itype>1 kludge.
|
||||
* extend.texi (Alternate Keywords): Adjust documentation.
|
||||
|
||||
Bring back the sjlj eh fixes.
|
||||
* expr.c (expand_builtin_setjmp_setup): New.
|
||||
(expand_builtin_setjmp_receiver): New.
|
||||
(expand_builtin_setjmp): Split out _setup and _receiver functions.
|
||||
Move argument parsing in from ...
|
||||
(expand_builtin): ... here.
|
||||
* except.c (receive_exception_label): Branch around receiver
|
||||
unless new-style exceptions. Call expand_builtin_setjmp_receiver.
|
||||
(start_dynamic_handler): Call expand_builtin_setjmp_setup.
|
||||
* expr.h: Update builtin setjmp decls.
|
||||
|
||||
Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt ([email protected])
|
||||
|
||||
* gcc-2.95.3 Released.
|
||||
|
||||
@@ -983,15 +983,6 @@ split_specs_attrs (specs_attrs, declspecs, prefix_attributes)
|
||||
{
|
||||
tree t, s, a, next, specs, attrs;
|
||||
|
||||
/* This can happen after an __extension__ in pedantic mode. */
|
||||
if (specs_attrs != NULL_TREE
|
||||
&& TREE_CODE (specs_attrs) == INTEGER_CST)
|
||||
{
|
||||
*declspecs = NULL_TREE;
|
||||
*prefix_attributes = NULL_TREE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* This can happen in c++ (eg: decl: typespec initdecls ';'). */
|
||||
if (specs_attrs != NULL_TREE
|
||||
&& TREE_CODE (specs_attrs) != TREE_LIST)
|
||||
@@ -1941,7 +1932,6 @@ check_format_info (info, params)
|
||||
warning ("use of `%c' length character with `%c' type character",
|
||||
length_char, format_char);
|
||||
|
||||
/* Finally. . .check type of argument against desired type! */
|
||||
if (info->first_arg_num == 0)
|
||||
continue;
|
||||
if (fci->pointer_count == 0 && wanted_type == void_type_node)
|
||||
|
||||
@@ -864,26 +864,6 @@ c_decode_option (argc, argv)
|
||||
warn_missing_braces = 0;
|
||||
else if (!strcmp (p, "-Wmain"))
|
||||
warn_main = 1;
|
||||
else if (!strncmp (p, "-Wframe-size-", 13))
|
||||
{
|
||||
const char *argstart = &p[13];
|
||||
const int larger_than_val = read_integral_parameter (argstart, p, -1);
|
||||
if (larger_than_val != -1)
|
||||
{
|
||||
warn_frame_size = larger_than_val;
|
||||
warn_frame_size_flag = 1;
|
||||
}
|
||||
}
|
||||
else if (!strncmp (p, "-Warglist-size-", 15))
|
||||
{
|
||||
const char *argstart = &p[15];
|
||||
const int larger_than_val = read_integral_parameter (argstart, p, -1);
|
||||
if (larger_than_val != -1)
|
||||
{
|
||||
warn_arglist_size = larger_than_val;
|
||||
warn_arglist_size_flag = 1;
|
||||
}
|
||||
}
|
||||
else if (!strcmp (p, "-Wno-main"))
|
||||
warn_main = -1;
|
||||
else if (!strcmp (p, "-Wsign-compare"))
|
||||
|
||||
+1
-5
@@ -1812,11 +1812,7 @@ yylex ()
|
||||
|
||||
type = flag_traditional ? traditional_type : ansi_type;
|
||||
|
||||
/* We assume that constants specified in a non-decimal
|
||||
base are bit patterns, and that the programmer really
|
||||
meant what they wrote. */
|
||||
if (warn_traditional && base == 10
|
||||
&& traditional_type != ansi_type)
|
||||
if (warn_traditional && traditional_type != ansi_type)
|
||||
{
|
||||
if (TYPE_PRECISION (traditional_type)
|
||||
!= TYPE_PRECISION (ansi_type))
|
||||
|
||||
+7
-19
@@ -186,7 +186,7 @@ end ifc
|
||||
%type <ttype> init maybeasm
|
||||
%type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
|
||||
%type <ttype> maybe_attribute attributes attribute attribute_list attrib
|
||||
%type <ttype> any_word extension
|
||||
%type <ttype> any_word
|
||||
|
||||
%type <ttype> compstmt
|
||||
|
||||
@@ -247,17 +247,6 @@ static tree declspec_stack;
|
||||
/* 1 if we explained undeclared var errors. */
|
||||
static int undeclared_variable_notice;
|
||||
|
||||
/* For __extension__, save/restore the warning flags which are
|
||||
controlled by __extension__. */
|
||||
#define SAVE_WARN_FLAGS() \
|
||||
build_int_2 (pedantic | (warn_pointer_arith << 1), 0)
|
||||
#define RESTORE_WARN_FLAGS(tval) \
|
||||
do { \
|
||||
int val = TREE_INT_CST_LOW (tval); \
|
||||
pedantic = val & 1; \
|
||||
warn_pointer_arith = (val >> 1) & 1; \
|
||||
} while (0)
|
||||
|
||||
ifobjc
|
||||
/* Objective-C specific information */
|
||||
|
||||
@@ -318,7 +307,7 @@ end ifobjc
|
||||
else
|
||||
error ("argument of `asm' is not a constant string"); }
|
||||
| extension extdef
|
||||
{ RESTORE_WARN_FLAGS ($1); }
|
||||
{ pedantic = $<itype>1; }
|
||||
;
|
||||
|
||||
datadef:
|
||||
@@ -459,7 +448,7 @@ unary_expr:
|
||||
/* __extension__ turns off -pedantic for following primary. */
|
||||
| extension cast_expr %prec UNARY
|
||||
{ $$ = $2;
|
||||
RESTORE_WARN_FLAGS ($1); }
|
||||
pedantic = $<itype>1; }
|
||||
| unop cast_expr %prec UNARY
|
||||
{ $$ = build_unary_op ($1, $2, 0);
|
||||
overflow_warning ($$); }
|
||||
@@ -1026,7 +1015,7 @@ decl:
|
||||
| declmods ';'
|
||||
{ pedwarn ("empty declaration"); }
|
||||
| extension decl
|
||||
{ RESTORE_WARN_FLAGS ($1); }
|
||||
{ pedantic = $<itype>1; }
|
||||
;
|
||||
|
||||
/* Declspecs which contain at least one type specifier or typedef name.
|
||||
@@ -1625,7 +1614,7 @@ component_decl:
|
||||
{ $$ = NULL_TREE; }
|
||||
| extension component_decl
|
||||
{ $$ = $2;
|
||||
RESTORE_WARN_FLAGS ($1); }
|
||||
pedantic = $<itype>1; }
|
||||
;
|
||||
|
||||
components:
|
||||
@@ -2437,9 +2426,8 @@ identifiers_or_typenames:
|
||||
|
||||
extension:
|
||||
EXTENSION
|
||||
{ $$ = SAVE_WARN_FLAGS();
|
||||
pedantic = 0;
|
||||
warn_pointer_arith = 0; }
|
||||
{ $<itype>$ = pedantic;
|
||||
pedantic = 0; }
|
||||
;
|
||||
|
||||
ifobjc
|
||||
|
||||
@@ -2293,14 +2293,6 @@ expand_call (exp, target, ignore)
|
||||
|
||||
/* All arguments and registers used for the call must be set up by now! */
|
||||
|
||||
if (warn_arglist_size_flag)
|
||||
if (unadjusted_args_size > warn_arglist_size)
|
||||
{
|
||||
warning ("%d byte arglist in function call", unadjusted_args_size);
|
||||
warning ("exceeds user specified limit (%d bytes)",
|
||||
warn_arglist_size);
|
||||
}
|
||||
|
||||
/* Generate the actual call instruction. */
|
||||
emit_call_1 (funexp, fndecl, funtype, unadjusted_args_size,
|
||||
args_size.constant, struct_value_size,
|
||||
|
||||
+2
-4
@@ -1127,7 +1127,7 @@ print_help ()
|
||||
printf ("Usage: %s [switches] input output\n", progname);
|
||||
printf ("Switches:\n");
|
||||
printf (" -include <file> Include the contents of <file> before other files\n");
|
||||
printf (" -imacros <file> Accept definition of macros in <file>\n");
|
||||
printf (" -imacros <file> Accept definition of marcos in <file>\n");
|
||||
printf (" -iprefix <path> Specify <path> as a prefix for next two options\n");
|
||||
printf (" -iwithprefix <dir> Add <dir> to the end of the system include paths\n");
|
||||
printf (" -iwithprefixbefore <dir> Add <dir> to the end of the main include paths\n");
|
||||
@@ -1141,7 +1141,7 @@ print_help ()
|
||||
printf (" -traditional Follow K&R pre-processor behaviour\n");
|
||||
printf (" -trigraphs Support ANSI C trigraphs\n");
|
||||
printf (" -lang-c Assume that the input sources are in C\n");
|
||||
printf (" -lang-c89 Assume that the input is C89; deprecated\n");
|
||||
printf (" -lang-c89 Assume that the input is C89; depricated\n");
|
||||
printf (" -lang-c++ Assume that the input sources are in C++\n");
|
||||
printf (" -lang-objc Assume that the input sources are in ObjectiveC\n");
|
||||
printf (" -lang-objc++ Assume that the input sources are in ObjectiveC++\n");
|
||||
@@ -4757,14 +4757,12 @@ static int
|
||||
is_system_include (filename)
|
||||
register char *filename;
|
||||
{
|
||||
#ifndef FREEBSD_NATIVE
|
||||
struct file_name_list *searchptr;
|
||||
|
||||
for (searchptr = first_system_include; searchptr;
|
||||
searchptr = searchptr->next)
|
||||
if (! strncmp (searchptr->fname, filename, strlen (searchptr->fname)))
|
||||
return searchptr->c_system_include_path + 1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+11
-28
@@ -7580,11 +7580,8 @@ nonzero_bits (x, mode)
|
||||
|
||||
if (reg_last_set_value[REGNO (x)] != 0
|
||||
&& reg_last_set_mode[REGNO (x)] == mode
|
||||
&& (reg_last_set_label[REGNO (x)] == label_tick
|
||||
|| (REGNO (x) >= FIRST_PSEUDO_REGISTER
|
||||
&& REG_N_SETS (REGNO (x)) == 1
|
||||
&& ! REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start,
|
||||
REGNO (x))))
|
||||
&& (REG_N_SETS (REGNO (x)) == 1
|
||||
|| reg_last_set_label[REGNO (x)] == label_tick)
|
||||
&& INSN_CUID (reg_last_set[REGNO (x)]) < subst_low_cuid)
|
||||
return reg_last_set_nonzero_bits[REGNO (x)];
|
||||
|
||||
@@ -7973,11 +7970,8 @@ num_sign_bit_copies (x, mode)
|
||||
|
||||
if (reg_last_set_value[REGNO (x)] != 0
|
||||
&& reg_last_set_mode[REGNO (x)] == mode
|
||||
&& (reg_last_set_label[REGNO (x)] == label_tick
|
||||
|| (REGNO (x) >= FIRST_PSEUDO_REGISTER
|
||||
&& REG_N_SETS (REGNO (x)) == 1
|
||||
&& ! REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start,
|
||||
REGNO (x))))
|
||||
&& (REG_N_SETS (REGNO (x)) == 1
|
||||
|| reg_last_set_label[REGNO (x)] == label_tick)
|
||||
&& INSN_CUID (reg_last_set[REGNO (x)]) < subst_low_cuid)
|
||||
return reg_last_set_sign_bit_copies[REGNO (x)];
|
||||
|
||||
@@ -10825,11 +10819,9 @@ get_last_value_validate (loc, insn, tick, replace)
|
||||
|
||||
for (j = regno; j < endregno; j++)
|
||||
if (reg_last_set_invalid[j]
|
||||
/* If this is a pseudo-register that was only set once and not
|
||||
live at the beginning of the function, it is always valid. */
|
||||
|| (! (regno >= FIRST_PSEUDO_REGISTER
|
||||
&& REG_N_SETS (regno) == 1
|
||||
&& ! REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, regno))
|
||||
/* If this is a pseudo-register that was only set once, it is
|
||||
always valid. */
|
||||
|| (! (regno >= FIRST_PSEUDO_REGISTER && REG_N_SETS (regno) == 1)
|
||||
&& reg_last_set_label[j] > tick))
|
||||
{
|
||||
if (replace)
|
||||
@@ -10888,21 +10880,12 @@ get_last_value (x)
|
||||
regno = REGNO (x);
|
||||
value = reg_last_set_value[regno];
|
||||
|
||||
/* If we don't have a value, or if it isn't for this basic block and
|
||||
it's either a hard register, set more than once, or it's a live
|
||||
at the beginning of the function, return 0.
|
||||
|
||||
Because if it's not live at the beginnning of the function then the reg
|
||||
is always set before being used (is never used without being set).
|
||||
And, if it's set only once, and it's always set before use, then all
|
||||
uses must have the same last value, even if it's not from this basic
|
||||
block. */
|
||||
/* If we don't have a value or if it isn't for this basic block,
|
||||
return 0. */
|
||||
|
||||
if (value == 0
|
||||
|| (reg_last_set_label[regno] != label_tick
|
||||
&& (regno < FIRST_PSEUDO_REGISTER
|
||||
|| REG_N_SETS (regno) != 1
|
||||
|| REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, regno))))
|
||||
|| (REG_N_SETS (regno) != 1
|
||||
&& reg_last_set_label[regno] != label_tick))
|
||||
return 0;
|
||||
|
||||
/* If the value was set in a later insn than the ones we are processing,
|
||||
|
||||
@@ -116,6 +116,14 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#undef HAS_INIT_SECTION
|
||||
|
||||
/* Output assembler code to FILE to increment profiler label # LABELNO
|
||||
for profiling a function entry. Under FreeBSD/Alpha, the assembler does
|
||||
nothing special with -pg. */
|
||||
|
||||
#undef FUNCTION_PROFILER
|
||||
#define FUNCTION_PROFILER(FILE, LABELNO) \
|
||||
fputs ("\tjsr $28,_mcount\n", (FILE)) /* at */
|
||||
|
||||
/* Show that we need a GP when profiling. */
|
||||
#undef TARGET_PROFILING_NEEDS_GP
|
||||
#define TARGET_PROFILING_NEEDS_GP
|
||||
|
||||
@@ -60,7 +60,7 @@ Boston, MA 02111-1307, USA. */
|
||||
the final CPP_PREDEFINES value. */
|
||||
|
||||
#define FBSD_CPP_PREDEFINES \
|
||||
" -D__FreeBSD__=4 -D__FreeBSD_cc_version=460001 -Dunix -Asystem(unix) -Asystem(FreeBSD) "
|
||||
" -D__FreeBSD__=4 -D__FreeBSD_cc_version=440000 -Dunix -Asystem(unix) -Asystem(FreeBSD) "
|
||||
|
||||
#define FBSD_CPP_SPEC " \
|
||||
%(cpp_cpu) \
|
||||
@@ -83,11 +83,11 @@ Boston, MA 02111-1307, USA. */
|
||||
#undef LIB_SPEC
|
||||
#include <sys/param.h>
|
||||
#if __FreeBSD_version >= 500016
|
||||
#define LIB_SPEC " \
|
||||
%{!shared: \
|
||||
%{!pg: %{pthread:-lc_r} -lc} \
|
||||
%{pg: %{pthread:-lc_r_p} -lc_p} \
|
||||
}"
|
||||
#define LIB_SPEC " \
|
||||
%{!shared: \
|
||||
%{!pg: %{pthread:-lc_r} -lc} \
|
||||
%{pg: %{pthread:-lc_r_p} -lc_p} \
|
||||
}"
|
||||
#else
|
||||
#define LIB_SPEC " \
|
||||
%{!shared: \
|
||||
@@ -204,7 +204,7 @@ Boston, MA 02111-1307, USA. */
|
||||
do { \
|
||||
if (!flag_no_ident) \
|
||||
fprintf ((FILE), "%s\"GCC: (GNU) %s %s\"\n", \
|
||||
IDENT_ASM_OP, lang_identify(), version_string); \
|
||||
IDENT_ASM_OP, lang_identify(), version_string); \
|
||||
} while (0)
|
||||
|
||||
/* This is the pseudo-op used to generate a contiguous sequence of byte
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Definitions for Intel 386 running FreeBSD with either a.out or ELF format
|
||||
Copyright (C) 1996, 2000, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996-2000 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.
|
||||
@@ -38,7 +38,7 @@ Boston, MA 02111-1307, USA. */
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC "%{v*: -v} %{maout: %{fpic:-k} %{fPIC:-k}}"
|
||||
|
||||
#undef ASM_FINAL_SPEC
|
||||
#undef ASM_FINAL_SPEC
|
||||
#define ASM_FINAL_SPEC "%|"
|
||||
|
||||
/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support
|
||||
@@ -49,6 +49,9 @@ Boston, MA 02111-1307, USA. */
|
||||
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. */
|
||||
|
||||
@@ -61,19 +64,14 @@ Boston, MA 02111-1307, USA. */
|
||||
%{assert*} %{R*}} \
|
||||
%{!maout: \
|
||||
%{Wl,*:%*} \
|
||||
%{v:-V} \
|
||||
%{assert*} %{R*} %{rpath*} %{defsym*} \
|
||||
%{shared:-Bshareable %{h*} %{soname*}} \
|
||||
%{symbolic:-Bsymbolic} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
%{rdynamic: -export-dynamic} \
|
||||
%{!dynamic-linker: -dynamic-linker /usr/libexec/ld-elf.so.1}} \
|
||||
%{static:-Bstatic}} \
|
||||
%{symbolic:-Bsymbolic}}"
|
||||
|
||||
/* 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'. */
|
||||
%{static:-Bstatic}}}"
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC "\
|
||||
@@ -88,12 +86,10 @@ Boston, MA 02111-1307, USA. */
|
||||
%{!pg: \
|
||||
%{p:gcrt1.o%s} \
|
||||
%{!p:crt1.o%s}}} \
|
||||
crti.o%s \
|
||||
%{!shared:crtbegin.o%s} \
|
||||
%{shared:crtbeginS.o%s}}"
|
||||
crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"
|
||||
|
||||
/* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386. Here we tack on our
|
||||
own magical crtend.o file (see crtstuff.c) which provides part of the
|
||||
own magical crtend.o file (compare w/crtstuff.c) which provides part of the
|
||||
support for getting C++ file-scope static object constructed before
|
||||
entering `main', followed by the normal "finalizer" file, `crtn.o'. */
|
||||
|
||||
@@ -106,23 +102,20 @@ Boston, MA 02111-1307, USA. */
|
||||
|
||||
/************************[ Target stuff ]***********************************/
|
||||
|
||||
/* Define the actual types of some ANSI-mandated types.
|
||||
/* Define the actual types of some ANSI-mandated types.
|
||||
Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c,
|
||||
c-common.c, and config/<arch>/<arch>.h. */
|
||||
|
||||
#undef SIZE_TYPE
|
||||
#undef SIZE_TYPE
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
#define PTRDIFF_TYPE "int"
|
||||
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
#define WCHAR_TYPE_SIZE BITS_PER_WORD
|
||||
|
||||
/* This is the pseudo-op used to generate a 32-bit word of data with a
|
||||
specific value in some section. */
|
||||
|
||||
#undef INT_ASM_OP
|
||||
#undef INT_ASM_OP
|
||||
#define INT_ASM_OP ".long"
|
||||
|
||||
/* Biggest alignment supported by the object file format of this
|
||||
@@ -158,23 +151,27 @@ Boston, MA 02111-1307, USA. */
|
||||
#define TARGET_DEFAULT \
|
||||
(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
|
||||
|
||||
/* Don't default to pcc-struct-return, we want to retain compatibility with
|
||||
older gcc versions AND pcc-struct-return is nonreentrant.
|
||||
(even though the SVR4 ABI for the i386 says that records and unions are
|
||||
returned in memory). */
|
||||
|
||||
#undef DEFAULT_PCC_STRUCT_RETURN
|
||||
#define DEFAULT_PCC_STRUCT_RETURN 0
|
||||
/* Prefix for internally generated assembler labels. If we aren't using
|
||||
underscores, we are using prefix `.'s to identify labels that should
|
||||
be ignored, as in `i386/gas.h' --karl@cs.umb.edu */
|
||||
#undef LPREFIX
|
||||
#define LPREFIX ((TARGET_UNDERSCORES) ? "L" : ".L")
|
||||
|
||||
/* The a.out tools do not support "linkonce" sections. */
|
||||
#undef SUPPORTS_ONE_ONLY
|
||||
#define SUPPORTS_ONE_ONLY TARGET_ELF
|
||||
|
||||
/* Prefix for internally generated assembler labels. If we aren't using
|
||||
underscores, we are using prefix `.'s to identify labels that should
|
||||
be ignored, as in `i386/gas.h' --karl@cs.umb.edu */
|
||||
#undef LPREFIX
|
||||
#define LPREFIX ((TARGET_UNDERSCORES) ? "L" : ".L")
|
||||
/* Enable alias attribute support. */
|
||||
#undef SET_ASM_OP
|
||||
#define SET_ASM_OP ".set"
|
||||
|
||||
/* The a.out tools do not support "Lscope" .stabs symbols. */
|
||||
#undef NO_DBX_FUNCTION_END
|
||||
#define NO_DBX_FUNCTION_END TARGET_AOUT
|
||||
|
||||
/* In ELF, the function stabs come first, before the relative offsets. */
|
||||
#undef DBX_FUNCTION_FIRST
|
||||
#define DBX_CHECK_FUNCTION_FIRST TARGET_ELF
|
||||
|
||||
/* supply our own hook for calling __main() from main() */
|
||||
#undef INVOKE__main
|
||||
@@ -258,19 +255,11 @@ Boston, MA 02111-1307, USA. */
|
||||
|
||||
/************************[ Assembler stuff ]********************************/
|
||||
|
||||
/* Override the default comment-starter of "/" from unix.h. */
|
||||
#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"
|
||||
|
||||
/* Enable alias attribute support. */
|
||||
#undef SET_ASM_OP
|
||||
#define SET_ASM_OP ".set"
|
||||
#define ASM_APP_OFF "#NO_APP\n"
|
||||
|
||||
/* This is how to begin an assembly language file.
|
||||
The .file command should always begin the output.
|
||||
@@ -285,8 +274,8 @@ Boston, MA 02111-1307, USA. */
|
||||
} while (0)
|
||||
|
||||
/* This is how to store into the string BUF
|
||||
the symbol_ref name of an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class.
|
||||
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(BUF, PREFIX, NUMBER) \
|
||||
@@ -416,6 +405,7 @@ Boston, MA 02111-1307, USA. */
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
#undef ASM_OUTPUT_SOURCE_LINE
|
||||
#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
|
||||
do { \
|
||||
@@ -513,10 +503,10 @@ Boston, MA 02111-1307, USA. */
|
||||
} while (0)
|
||||
|
||||
/* Switch into a generic section.
|
||||
|
||||
|
||||
We make the section read-only and executable for a function decl,
|
||||
read-only for a const data decl, and writable for a non-const data decl.
|
||||
|
||||
|
||||
If the section has already been defined, we must not
|
||||
emit the attributes here. The SVR4 assembler does not
|
||||
recognize section redefinitions.
|
||||
@@ -676,21 +666,13 @@ Boston, MA 02111-1307, USA. */
|
||||
some don't.
|
||||
|
||||
*OLD* GAS requires the %cl argument, so override i386/unix.h. */
|
||||
|
||||
|
||||
#undef AS3_SHIFT_DOUBLE
|
||||
#define AS3_SHIFT_DOUBLE(a,b,c,d) AS3 (a,b,c,d)
|
||||
|
||||
|
||||
/************************[ Debugger stuff ]*********************************/
|
||||
|
||||
/* The a.out tools do not support "Lscope" .stabs symbols. */
|
||||
#undef NO_DBX_FUNCTION_END
|
||||
#define NO_DBX_FUNCTION_END TARGET_AOUT
|
||||
|
||||
/* In ELF, the function stabs come first, before the relative offsets. */
|
||||
#undef DBX_FUNCTION_FIRST
|
||||
#define DBX_CHECK_FUNCTION_FIRST TARGET_ELF
|
||||
|
||||
/* 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
|
||||
@@ -773,8 +755,7 @@ Boston, MA 02111-1307, USA. */
|
||||
(n) + 4)
|
||||
|
||||
#undef DBX_REGISTER_NUMBER
|
||||
#define DBX_REGISTER_NUMBER(n) ((write_symbols == DWARF2_DEBUG \
|
||||
|| write_symbols == DWARF_DEBUG) \
|
||||
#define DBX_REGISTER_NUMBER(n) ((write_symbols == DWARF_DEBUG) \
|
||||
? DWARF_DBX_REGISTER_NUMBER(n) \
|
||||
: STABS_DBX_REGISTER_NUMBER(n))
|
||||
|
||||
|
||||
@@ -234,21 +234,3 @@ Boston, MA 02111-1307, USA. */
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#if defined(__PIC__) && defined (USE_GNULIBC_1)
|
||||
/* This is a kludge. The i386 GNU/Linux dynamic linker needs ___brk_addr,
|
||||
__environ and atexit (). We have to make sure they are in the .dynsym
|
||||
section. We accomplish it by making a dummy call here. This
|
||||
code is never reached. */
|
||||
|
||||
#define CRT_END_INIT_DUMMY \
|
||||
do \
|
||||
{ \
|
||||
extern void *___brk_addr; \
|
||||
extern char **__environ; \
|
||||
\
|
||||
___brk_addr = __environ; \
|
||||
atexit (0); \
|
||||
} \
|
||||
while (0)
|
||||
#endif
|
||||
+13
-2
@@ -380,8 +380,19 @@ init_dummy (void)
|
||||
#endif
|
||||
asm (TEXT_SECTION_ASM_OP);
|
||||
|
||||
#ifdef CRT_END_INIT_DUMMY
|
||||
CRT_END_INIT_DUMMY;
|
||||
/* This is a kludge. The i386 GNU/Linux dynamic linker needs ___brk_addr,
|
||||
__environ and atexit (). We have to make sure they are in the .dynsym
|
||||
section. We accomplish it by making a dummy call here. This
|
||||
code is never reached. */
|
||||
|
||||
#if defined(__linux__) && defined(__PIC__) && defined(__i386__)
|
||||
{
|
||||
extern void *___brk_addr;
|
||||
extern char **__environ;
|
||||
|
||||
___brk_addr = __environ;
|
||||
atexit ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -695,6 +695,8 @@ static void check_fold_consts PROTO((PTR));
|
||||
static struct cse_reg_info* get_cse_reg_info PROTO((int));
|
||||
static void free_cse_reg_info PROTO((splay_tree_value));
|
||||
static void flush_hash_table PROTO((void));
|
||||
|
||||
extern int rtx_equal_function_value_matters;
|
||||
|
||||
/* Dump the expressions in the equivalence class indicated by CLASSP.
|
||||
This function is used only for debugging. */
|
||||
|
||||
@@ -733,20 +733,20 @@ receive_exception_label (handler_label)
|
||||
}
|
||||
|
||||
emit_label (handler_label);
|
||||
|
||||
|
||||
if (! exceptions_via_longjmp)
|
||||
{
|
||||
#ifdef HAVE_exception_receiver
|
||||
if (HAVE_exception_receiver)
|
||||
emit_insn (gen_exception_receiver ());
|
||||
emit_insn (gen_exception_receiver ());
|
||||
else
|
||||
#endif
|
||||
#ifdef HAVE_nonlocal_goto_receiver
|
||||
if (HAVE_nonlocal_goto_receiver)
|
||||
emit_insn (gen_nonlocal_goto_receiver ());
|
||||
emit_insn (gen_nonlocal_goto_receiver ());
|
||||
else
|
||||
#endif
|
||||
{ /* Nothing */ }
|
||||
{ /* Nothing */ }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+5
-12
@@ -450,9 +450,6 @@ protect_from_queue (x, modify)
|
||||
QUEUED_INSN (y));
|
||||
return temp;
|
||||
}
|
||||
/* Copy the address into a pseudo, so that the returned value
|
||||
remains correct across calls to emit_queue. */
|
||||
XEXP (new, 0) = copy_to_reg (XEXP (new, 0));
|
||||
return new;
|
||||
}
|
||||
/* Otherwise, recursively protect the subexpressions of all
|
||||
@@ -479,11 +476,9 @@ protect_from_queue (x, modify)
|
||||
}
|
||||
return x;
|
||||
}
|
||||
/* If the increment has not happened, use the variable itself. Copy it
|
||||
into a new pseudo so that the value remains correct across calls to
|
||||
emit_queue. */
|
||||
/* If the increment has not happened, use the variable itself. */
|
||||
if (QUEUED_INSN (x) == 0)
|
||||
return copy_to_reg (QUEUED_VAR (x));
|
||||
return QUEUED_VAR (x);
|
||||
/* If the increment has happened and a pre-increment copy exists,
|
||||
use that copy. */
|
||||
if (QUEUED_COPY (x) != 0)
|
||||
@@ -8082,9 +8077,7 @@ expand_expr (exp, target, tmode, modifier)
|
||||
if (ignore)
|
||||
return op0;
|
||||
|
||||
/* Pass 1 for MODIFY, so that protect_from_queue doesn't get
|
||||
clever and returns a REG when given a MEM. */
|
||||
op0 = protect_from_queue (op0, 1);
|
||||
op0 = protect_from_queue (op0, 0);
|
||||
|
||||
/* We would like the object in memory. If it is a constant,
|
||||
we can have it be statically allocated into memory. For
|
||||
@@ -8610,7 +8603,7 @@ expand_builtin_setjmp_setup (buf_addr, receiver_label)
|
||||
|
||||
/* Construct the trailing part of a __builtin_setjmp call.
|
||||
This is used directly by sjlj exception handling code. */
|
||||
|
||||
|
||||
void
|
||||
expand_builtin_setjmp_receiver (receiver_label)
|
||||
rtx receiver_label ATTRIBUTE_UNUSED;
|
||||
@@ -8733,7 +8726,7 @@ expand_builtin_setjmp (arglist, target)
|
||||
current_function_has_nonlocal_label = 1;
|
||||
nonlocal_goto_handler_labels
|
||||
= gen_rtx_EXPR_LIST (VOIDmode, next_lab, nonlocal_goto_handler_labels);
|
||||
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
const char *ffe_version_string = "0.5.25 20020320 (prerelease)";
|
||||
const char *ffe_version_string = "0.5.25 20010315 (release)";
|
||||
+2
-4
@@ -3055,8 +3055,7 @@ cleanup_subreg_operands (insn)
|
||||
if (GET_CODE (recog_operand[i]) == SUBREG)
|
||||
recog_operand[i] = alter_subreg (recog_operand[i]);
|
||||
else if (GET_CODE (recog_operand[i]) == PLUS
|
||||
|| GET_CODE (recog_operand[i]) == MULT
|
||||
|| GET_CODE (recog_operand[i]) == MEM)
|
||||
|| GET_CODE (recog_operand[i]) == MULT)
|
||||
recog_operand[i] = walk_alter_subreg (recog_operand[i]);
|
||||
}
|
||||
|
||||
@@ -3065,8 +3064,7 @@ cleanup_subreg_operands (insn)
|
||||
if (GET_CODE (*recog_dup_loc[i]) == SUBREG)
|
||||
*recog_dup_loc[i] = alter_subreg (*recog_dup_loc[i]);
|
||||
else if (GET_CODE (*recog_dup_loc[i]) == PLUS
|
||||
|| GET_CODE (*recog_dup_loc[i]) == MULT
|
||||
|| GET_CODE (*recog_dup_loc[i]) == MEM)
|
||||
|| GET_CODE (*recog_dup_loc[i]) == MULT)
|
||||
*recog_dup_loc[i] = walk_alter_subreg (*recog_dup_loc[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,18 +121,6 @@ extern int warn_cast_align;
|
||||
|
||||
extern int warn_template_debugging;
|
||||
|
||||
/* Nonzero means warn if a frame is larger that N bytes. The value
|
||||
of N is warn_frame_size. */
|
||||
|
||||
extern int warn_frame_size_flag;
|
||||
extern int warn_frame_size;
|
||||
|
||||
/* Nonzero means warn if a function call pushes more than N bytes
|
||||
onto the stack. The value of N is warn_arglist_size. */
|
||||
|
||||
extern int warn_arglist_size_flag;
|
||||
extern int warn_arglist_size;
|
||||
|
||||
/* Nonzero means warn about any identifiers that match in the first N
|
||||
characters. The value N is in `id_clash_len'. */
|
||||
|
||||
|
||||
+1
-9
@@ -2744,23 +2744,15 @@ propagate_block (old, first, last, final, significant, bnum, remove_dead_code)
|
||||
{
|
||||
if (REG_NOTE_KIND (inote) == REG_LABEL)
|
||||
{
|
||||
int n_forced;
|
||||
rtx label = XEXP (inote, 0);
|
||||
rtx next;
|
||||
LABEL_NUSES (label)--;
|
||||
|
||||
/* The label may be forced if it has been put in the
|
||||
constant pool. We can't delete it in this case, but
|
||||
we still must discard a jump table following it. */
|
||||
n_forced = 0;
|
||||
if (LABEL_PRESERVE_P (label))
|
||||
n_forced++;
|
||||
|
||||
/* If this label was attached to an ADDR_VEC, it's
|
||||
safe to delete the ADDR_VEC. In fact, it's pretty much
|
||||
mandatory to delete it, because the ADDR_VEC may
|
||||
be referencing labels that no longer exist. */
|
||||
if (LABEL_NUSES (label) == n_forced
|
||||
if (LABEL_NUSES (label) == 0
|
||||
&& (next = next_nonnote_insn (label)) != NULL
|
||||
&& GET_CODE (next) == JUMP_INSN
|
||||
&& (GET_CODE (PATTERN (next)) == ADDR_VEC
|
||||
|
||||
+25
-78
@@ -515,9 +515,8 @@ static int *record_insns PROTO((rtx));
|
||||
static int contains PROTO((rtx, int *));
|
||||
#endif /* HAVE_prologue || HAVE_epilogue */
|
||||
static void put_addressof_into_stack PROTO((rtx, struct hash_table *));
|
||||
static boolean purge_addressof_1 PROTO((rtx *, rtx, int, int,
|
||||
static void purge_addressof_1 PROTO((rtx *, rtx, int, int,
|
||||
struct hash_table *));
|
||||
static int is_addressof PROTO ((rtx *, void *));
|
||||
static struct hash_entry *insns_for_mem_newfunc PROTO((struct hash_entry *,
|
||||
struct hash_table *,
|
||||
hash_table_key));
|
||||
@@ -3058,10 +3057,9 @@ static rtx purge_addressof_replacements;
|
||||
|
||||
/* Helper function for purge_addressof. See if the rtx expression at *LOC
|
||||
in INSN needs to be changed. If FORCE, always put any ADDRESSOFs into
|
||||
the stack. If the function returns FALSE then the replacement could not
|
||||
be made. */
|
||||
the stack. */
|
||||
|
||||
static boolean
|
||||
static void
|
||||
purge_addressof_1 (loc, insn, force, store, ht)
|
||||
rtx *loc;
|
||||
rtx insn;
|
||||
@@ -3072,14 +3070,13 @@ purge_addressof_1 (loc, insn, force, store, ht)
|
||||
RTX_CODE code;
|
||||
int i, j;
|
||||
char *fmt;
|
||||
boolean result = true;
|
||||
|
||||
/* Re-start here to avoid recursion in common cases. */
|
||||
restart:
|
||||
|
||||
x = *loc;
|
||||
if (x == 0)
|
||||
return true;
|
||||
return;
|
||||
|
||||
code = GET_CODE (x);
|
||||
|
||||
@@ -3092,7 +3089,7 @@ purge_addressof_1 (loc, insn, force, store, ht)
|
||||
|
||||
if (validate_change (insn, loc, sub, 0)
|
||||
|| validate_replace_rtx (x, sub, insn))
|
||||
return true;
|
||||
return;
|
||||
|
||||
start_sequence ();
|
||||
sub = force_operand (sub, NULL_RTX);
|
||||
@@ -3103,7 +3100,7 @@ purge_addressof_1 (loc, insn, force, store, ht)
|
||||
insns = gen_sequence ();
|
||||
end_sequence ();
|
||||
emit_insn_before (insns, insn);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
else if (code == MEM && GET_CODE (XEXP (x, 0)) == ADDRESSOF && ! force)
|
||||
{
|
||||
@@ -3122,7 +3119,7 @@ purge_addressof_1 (loc, insn, force, store, ht)
|
||||
&& (MEM_VOLATILE_P (x) || GET_MODE (x) == BLKmode))
|
||||
{
|
||||
put_addressof_into_stack (XEXP (x, 0), ht);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
else if (GET_CODE (sub) == REG && GET_MODE (x) != GET_MODE (sub))
|
||||
{
|
||||
@@ -3141,7 +3138,7 @@ purge_addressof_1 (loc, insn, force, store, ht)
|
||||
if (rtx_equal_p (x, XEXP (tem, 0)))
|
||||
{
|
||||
*loc = XEXP (XEXP (tem, 1), 0);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
/* See comment for purge_addressof_replacements. */
|
||||
@@ -3181,17 +3178,11 @@ purge_addressof_1 (loc, insn, force, store, ht)
|
||||
z = gen_lowpart (GET_MODE (x), z);
|
||||
|
||||
*loc = z;
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Sometimes we may not be able to find the replacement. For
|
||||
example when the original insn was a MEM in a wider mode,
|
||||
and the note is part of a sign extension of a narrowed
|
||||
version of that MEM. Gcc testcase compile/990829-1.c can
|
||||
generate an example of this siutation. Rather than complain
|
||||
we return false, which will prompt our caller to remove the
|
||||
offending note. */
|
||||
return false;
|
||||
/* There should always be such a replacement. */
|
||||
abort ();
|
||||
}
|
||||
|
||||
size_x = GET_MODE_BITSIZE (GET_MODE (x));
|
||||
@@ -3277,7 +3268,7 @@ purge_addressof_1 (loc, insn, force, store, ht)
|
||||
purge_bitfield_addressof_replacements));
|
||||
|
||||
/* We replaced with a reg -- all done. */
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (validate_change (insn, loc, sub, 0))
|
||||
@@ -3294,13 +3285,13 @@ purge_addressof_1 (loc, insn, force, store, ht)
|
||||
if (rtx_equal_p (XEXP (x, 0), XEXP (tem, 0)))
|
||||
{
|
||||
XEXP (XEXP (tem, 1), 0) = sub;
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
purge_addressof_replacements
|
||||
= gen_rtx (EXPR_LIST, VOIDmode, XEXP (x, 0),
|
||||
gen_rtx_EXPR_LIST (VOIDmode, sub,
|
||||
purge_addressof_replacements));
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
goto restart;
|
||||
}
|
||||
@@ -3310,13 +3301,13 @@ purge_addressof_1 (loc, insn, force, store, ht)
|
||||
else if (code == ADDRESSOF)
|
||||
{
|
||||
put_addressof_into_stack (x, ht);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
else if (code == SET)
|
||||
{
|
||||
result = purge_addressof_1 (&SET_DEST (x), insn, force, 1, ht);
|
||||
result &= purge_addressof_1 (&SET_SRC (x), insn, force, 0, ht);
|
||||
return result;
|
||||
purge_addressof_1 (&SET_DEST (x), insn, force, 1, ht);
|
||||
purge_addressof_1 (&SET_SRC (x), insn, force, 0, ht);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Scan all subexpressions. */
|
||||
@@ -3324,13 +3315,11 @@ purge_addressof_1 (loc, insn, force, store, ht)
|
||||
for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
|
||||
{
|
||||
if (*fmt == 'e')
|
||||
result &= purge_addressof_1 (&XEXP (x, i), insn, force, 0, ht);
|
||||
purge_addressof_1 (&XEXP (x, i), insn, force, 0, ht);
|
||||
else if (*fmt == 'E')
|
||||
for (j = 0; j < XVECLEN (x, i); j++)
|
||||
result &= purge_addressof_1 (&XVECEXP (x, i, j), insn, force, 0, ht);
|
||||
purge_addressof_1 (&XVECEXP (x, i, j), insn, force, 0, ht);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Return a new hash table entry in HT. */
|
||||
@@ -3450,16 +3439,6 @@ compute_insns_for_mem (insns, last_insn, ht)
|
||||
}
|
||||
}
|
||||
|
||||
/* Helper function for purge_addressof called through for_each_rtx.
|
||||
Returns true iff the rtl is an ADDRESSOF. */
|
||||
static int
|
||||
is_addressof (rtl, data)
|
||||
rtx * rtl;
|
||||
void * data ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return GET_CODE (* rtl) == ADDRESSOF;
|
||||
}
|
||||
|
||||
/* Eliminate all occurrences of ADDRESSOF from INSNS. Elide any remaining
|
||||
(MEM (ADDRESSOF)) patterns, and force any needed registers into the
|
||||
stack. */
|
||||
@@ -3488,30 +3467,9 @@ purge_addressof (insns)
|
||||
if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
|
||||
|| GET_CODE (insn) == CALL_INSN)
|
||||
{
|
||||
if (! purge_addressof_1 (&PATTERN (insn), insn,
|
||||
asm_noperands (PATTERN (insn)) > 0, 0, &ht))
|
||||
/* If we could not replace the ADDRESSOFs in the insn,
|
||||
something is wrong. */
|
||||
abort ();
|
||||
|
||||
if (! purge_addressof_1 (®_NOTES (insn), NULL_RTX, 0, 0, &ht))
|
||||
{
|
||||
/* If we could not replace the ADDRESSOFs in the insn's notes,
|
||||
we can just remove the offending notes instead. */
|
||||
rtx note;
|
||||
|
||||
for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
|
||||
{
|
||||
/* If we find a REG_RETVAL note then the insn is a libcall.
|
||||
Such insns must have REG_EQUAL notes as well, in order
|
||||
for later passes of the compiler to work. So it is not
|
||||
safe to delete the notes here, and instead we abort. */
|
||||
if (REG_NOTE_KIND (note) == REG_RETVAL)
|
||||
abort ();
|
||||
if (for_each_rtx (& note, is_addressof, NULL))
|
||||
remove_note (insn, note);
|
||||
}
|
||||
}
|
||||
purge_addressof_1 (&PATTERN (insn), insn,
|
||||
asm_noperands (PATTERN (insn)) > 0, 0, &ht);
|
||||
purge_addressof_1 (®_NOTES (insn), NULL_RTX, 0, 0, &ht);
|
||||
}
|
||||
|
||||
/* Clean up. */
|
||||
@@ -5336,18 +5294,7 @@ locate_and_pad_parm (passed_mode, type, in_regs, fndecl,
|
||||
- offset_ptr->constant);
|
||||
}
|
||||
#else /* !ARGS_GROW_DOWNWARD */
|
||||
if (!in_regs
|
||||
#ifdef REG_PARM_STACK_SPACE
|
||||
|| REG_PARM_STACK_SPACE (fndecl) > 0
|
||||
#else
|
||||
/* For the gcc-2_95-branch we want to make sure not to break something
|
||||
on platforms which pass argument in registers but don't define
|
||||
REG_PARM_STACK_SPACE. So we force the original behaviour here. */
|
||||
|| 1
|
||||
#endif
|
||||
)
|
||||
pad_to_arg_alignment (initial_offset_ptr, boundary);
|
||||
|
||||
pad_to_arg_alignment (initial_offset_ptr, boundary);
|
||||
*offset_ptr = *initial_offset_ptr;
|
||||
|
||||
#ifdef PUSH_ROUNDING
|
||||
@@ -6989,7 +6936,7 @@ thread_prologue_and_epilogue_insns (f)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Reposition the prologue-end and epilogue-begin notes after instruction
|
||||
|
||||
+36
-42
@@ -3141,7 +3141,6 @@ process_command (argc, argv)
|
||||
fatal ("object format unknown");
|
||||
}
|
||||
#endif /* FREEBSD_NATIVE */
|
||||
|
||||
#ifndef OS2
|
||||
add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS",
|
||||
0, 2, warn_std_ptr);
|
||||
@@ -4992,7 +4991,7 @@ main (argc, argv)
|
||||
"BINUTILS", 0, 0, NULL_PTR);
|
||||
add_prefix (&startfile_prefixes, standard_startfile_prefix_2,
|
||||
"BINUTILS", 0, 0, NULL_PTR);
|
||||
#endif /* FREEBSD_NATIVE */
|
||||
#endif /* FREEBSD_NATIVE */
|
||||
#if 0 /* Can cause surprises, and one can use -B./ instead. */
|
||||
add_prefix (&startfile_prefixes, "./", NULL_PTR, 0, 1, NULL_PTR);
|
||||
#endif
|
||||
@@ -5168,53 +5167,48 @@ main (argc, argv)
|
||||
int len;
|
||||
|
||||
if (cp->spec[0][0] == '#')
|
||||
error ("%s: %s compiler not installed on this system",
|
||||
input_filename, &cp->spec[0][1]);
|
||||
|
||||
input_basename = input_filename;
|
||||
for (p = input_filename; *p; p++)
|
||||
if (IS_DIR_SEPARATOR (*p))
|
||||
input_basename = p + 1;
|
||||
|
||||
/* Find a suffix starting with the last period,
|
||||
and set basename_length to exclude that suffix. */
|
||||
basename_length = strlen (input_basename);
|
||||
p = input_basename + basename_length;
|
||||
while (p != input_basename && *p != '.') --p;
|
||||
if (*p == '.' && p != input_basename)
|
||||
{
|
||||
error ("%s: %s compiler not installed on this system",
|
||||
input_filename, &cp->spec[0][1]);
|
||||
this_file_error = 1;
|
||||
basename_length = p - input_basename;
|
||||
input_suffix = p + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
input_basename = input_filename;
|
||||
for (p = input_filename; *p; p++)
|
||||
if (IS_DIR_SEPARATOR (*p))
|
||||
input_basename = p + 1;
|
||||
input_suffix = "";
|
||||
|
||||
/* Find a suffix starting with the last period,
|
||||
and set basename_length to exclude that suffix. */
|
||||
basename_length = strlen (input_basename);
|
||||
p = input_basename + basename_length;
|
||||
while (p != input_basename && *p != '.') --p;
|
||||
if (*p == '.' && p != input_basename)
|
||||
len = 0;
|
||||
for (j = 0; j < sizeof cp->spec / sizeof cp->spec[0]; j++)
|
||||
if (cp->spec[j])
|
||||
len += strlen (cp->spec[j]);
|
||||
|
||||
{
|
||||
char *p1 = (char *) xmalloc (len + 1);
|
||||
|
||||
len = 0;
|
||||
for (j = 0; j < sizeof cp->spec / sizeof cp->spec[0]; j++)
|
||||
if (cp->spec[j])
|
||||
{
|
||||
basename_length = p - input_basename;
|
||||
input_suffix = p + 1;
|
||||
}
|
||||
else
|
||||
input_suffix = "";
|
||||
|
||||
len = 0;
|
||||
for (j = 0; j < sizeof cp->spec / sizeof cp->spec[0]; j++)
|
||||
if (cp->spec[j])
|
||||
strcpy (p1 + len, cp->spec[j]);
|
||||
len += strlen (cp->spec[j]);
|
||||
|
||||
{
|
||||
char *p1 = (char *) xmalloc (len + 1);
|
||||
}
|
||||
|
||||
len = 0;
|
||||
for (j = 0; j < sizeof cp->spec / sizeof cp->spec[0]; j++)
|
||||
if (cp->spec[j])
|
||||
{
|
||||
strcpy (p1 + len, cp->spec[j]);
|
||||
len += strlen (cp->spec[j]);
|
||||
}
|
||||
|
||||
value = do_spec (p1);
|
||||
free (p1);
|
||||
}
|
||||
if (value < 0)
|
||||
this_file_error = 1;
|
||||
}
|
||||
value = do_spec (p1);
|
||||
free (p1);
|
||||
}
|
||||
if (value < 0)
|
||||
this_file_error = 1;
|
||||
}
|
||||
|
||||
/* If this file's name does not contain a recognized suffix,
|
||||
|
||||
+52
-127
@@ -1,4 +1,4 @@
|
||||
@c Copyright (C) 1988, 89, 92-98, 1999 Free Software Foundation, Inc.
|
||||
@c Copyright (C) 1988,89,92,93,94,95,96,97,1998 Free Software Foundation, Inc.
|
||||
@c This is part of the GCC manual.
|
||||
@c For copying conditions, see the file gcc.texi.
|
||||
|
||||
@@ -15,7 +15,6 @@ install procedures. It is provided for historical reference only.
|
||||
@cindex installing GNU CC
|
||||
|
||||
@menu
|
||||
* Configuration Files:: Files created by running @code{configure}.
|
||||
* Configurations:: Configurations Supported by GNU CC.
|
||||
* Other Dir:: Compiling in a separate directory (not where the source is).
|
||||
* Cross-Compiler:: Building and installing a cross-compiler.
|
||||
@@ -25,11 +24,11 @@ install procedures. It is provided for historical reference only.
|
||||
* Header Dirs:: Understanding the standard header file directories.
|
||||
@end menu
|
||||
|
||||
Here is the procedure for installing GNU CC on a GNU or Unix system.
|
||||
See @ref{VMS Install}, for VMS systems. In this section we assume you
|
||||
Here is the procedure for installing GNU CC on a Unix system. See
|
||||
@ref{VMS Install}, for VMS systems. In this section we assume you
|
||||
compile in the same directory that contains the source files; see
|
||||
@ref{Other Dir}, to find out how to compile in a separate directory on
|
||||
Unix systems.
|
||||
@ref{Other Dir}, to find out how to compile in a separate directory on Unix
|
||||
systems.
|
||||
|
||||
You cannot install GNU C by itself on MSDOS; it will not compile under
|
||||
any MSDOS compiler except itself. You need to get the complete
|
||||
@@ -50,32 +49,9 @@ On a System V release 4 system, make sure @file{/usr/bin} precedes
|
||||
@file{/usr/ucb} in @code{PATH}. The @code{cc} command in
|
||||
@file{/usr/ucb} uses libraries which have bugs.
|
||||
|
||||
@cindex Bison parser generator
|
||||
@cindex parser generator, Bison
|
||||
@item
|
||||
Make sure the Bison parser generator is installed. (This is
|
||||
unnecessary if the Bison output files @file{c-parse.c} and
|
||||
@file{cexp.c} are more recent than @file{c-parse.y} and @file{cexp.y}
|
||||
and you do not plan to change the @samp{.y} files.)
|
||||
|
||||
Bison versions older than Sept 8, 1988 will produce incorrect output
|
||||
for @file{c-parse.c}.
|
||||
|
||||
@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.
|
||||
by running the file @file{configure}.
|
||||
|
||||
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
|
||||
@@ -124,11 +100,10 @@ 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.
|
||||
|
||||
@item
|
||||
When running @code{configure}, you may also need to specify certain
|
||||
additional options that describe variant hardware and software
|
||||
configurations. These are @samp{--with-gnu-as}, @samp{--with-gnu-ld},
|
||||
@samp{--with-stabs} and @samp{--nfp}.
|
||||
There are four additional options you can specify independently to
|
||||
describe variant hardware and software configurations. These are
|
||||
@samp{--with-gnu-as}, @samp{--with-gnu-ld}, @samp{--with-stabs} and
|
||||
@samp{--nfp}.
|
||||
|
||||
@table @samp
|
||||
@item --with-gnu-as
|
||||
@@ -232,6 +207,7 @@ of tree node types when referencing fields of that node. This does not
|
||||
change the generated code, but adds error checking within the compiler.
|
||||
This will slow down the compiler and may only work properly if you
|
||||
are building the compiler with GNU C.
|
||||
@end table
|
||||
|
||||
The @file{configure} script searches subdirectories of the source
|
||||
directory for other compilers that are to be integrated into GNU CC.
|
||||
@@ -276,42 +252,16 @@ A file named @file{tm.h} is created which includes the
|
||||
machine-description macro file for your target machine. It should be in
|
||||
the subdirectory @file{config} and its name is often
|
||||
@file{@var{machine}.h}.
|
||||
@end itemize
|
||||
|
||||
@cindex Native Language Support
|
||||
@cindex NLS
|
||||
@item --enable-nls
|
||||
@itemx --disable-nls
|
||||
The @samp{--enable-nls} option enables Native Language Support (NLS),
|
||||
which lets GCC output diagnostics in languages other than American
|
||||
English. No translations are available yet, so the main users of this
|
||||
option now are those translating GCC's diagnostics who want to test
|
||||
their work. Once translations become available, Native Language Support
|
||||
will become enabled by default. The @samp{--disable-nls} option
|
||||
disables NLS.
|
||||
|
||||
@cindex @code{gettext}
|
||||
@item --with-included-gettext
|
||||
If NLS is enabled, the GCC build procedure normally attempts to use the
|
||||
host's @code{gettext} libraries, and falls back on GCC's copy of the GNU
|
||||
@code{gettext} library only if the host libraries do not suffice. The
|
||||
@samp{--with-included-gettext} option causes the build procedure to
|
||||
prefer its copy of GNU @code{gettext}.
|
||||
|
||||
@cindex @code{catgets}
|
||||
@item --with-catgets
|
||||
If NLS is enabled, and if the host lacks @code{gettext} but has the
|
||||
inferior @code{catgets} interface, the GCC build procedure normally
|
||||
ignores @code{catgets} and instead uses GCC's copy of the GNU
|
||||
@code{gettext} library. The @samp{--with-catgets} option causes the
|
||||
build procedure to use the host's @code{catgets} in this situation.
|
||||
@end table
|
||||
|
||||
@item
|
||||
In certain cases, you should specify certain other options when you run
|
||||
@code{configure}.
|
||||
The command file @file{configure} also constructs the file
|
||||
@file{Makefile} by adding some text to the template file
|
||||
@file{Makefile.in}. The additional text comes from files in the
|
||||
@file{config} directory, named @file{t-@var{target}} and
|
||||
@file{x-@var{host}}. If these files do not exist, it means nothing
|
||||
needs to be added for a given target or host.
|
||||
@end itemize
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
The standard directory for installing GNU CC is @file{/usr/local/lib}.
|
||||
If you want to install its files somewhere else, specify
|
||||
@@ -353,7 +303,29 @@ Indications are that people who use this option use it based on
|
||||
mistaken ideas of what it is for. People use it as if it specified
|
||||
where to install part of GNU CC. Perhaps they make this assumption
|
||||
because installing GNU CC creates the directory.
|
||||
@end itemize
|
||||
|
||||
@cindex Bison parser generator
|
||||
@cindex parser generator, Bison
|
||||
@item
|
||||
Make sure the Bison parser generator is installed. (This is
|
||||
unnecessary if the Bison output files @file{c-parse.c} and
|
||||
@file{cexp.c} are more recent than @file{c-parse.y} and @file{cexp.y}
|
||||
and you do not plan to change the @samp{.y} files.)
|
||||
|
||||
Bison versions older than Sept 8, 1988 will produce incorrect output
|
||||
for @file{c-parse.c}.
|
||||
|
||||
@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
|
||||
Build the compiler. Just type @samp{make LANGUAGES=c} in the compiler
|
||||
@@ -388,9 +360,9 @@ should be investigated and reported (@pxref{Bugs}).
|
||||
should be investigated and reported.
|
||||
@end ifset
|
||||
|
||||
Some compilers fail to compile GNU CC because they have bugs or
|
||||
limitations. For example, the Microsoft compiler is said to run out of
|
||||
macro space. Some Ultrix compilers run out of expression space; then
|
||||
Some commercial compilers fail to compile GNU CC because they have bugs
|
||||
or limitations. For example, the Microsoft compiler is said to run out
|
||||
of macro space. Some Ultrix compilers run out of expression space; then
|
||||
you need to break up the statement where the problem happens.
|
||||
|
||||
@item
|
||||
@@ -485,8 +457,8 @@ instead of making @file{stage1}, @file{stage2}, and performing
|
||||
the two compiler builds.
|
||||
|
||||
@item
|
||||
Compare the latest object files with the stage 2 object files---they
|
||||
ought to be identical, aside from time stamps (if any).
|
||||
Then compare the latest object files with the stage 2 object
|
||||
files---they ought to be identical, aside from time stamps (if any).
|
||||
|
||||
On some systems, meaningful comparison of object files is impossible;
|
||||
they always appear ``different.'' This is currently true on Solaris and
|
||||
@@ -574,8 +546,11 @@ compiler.)
|
||||
@item
|
||||
@cindex C++ runtime library
|
||||
@cindex @code{libstdc++}
|
||||
If you're going to use C++, you need to install the C++ runtime library.
|
||||
This includes all I/O functionality, special class libraries, etc.
|
||||
If you're going to use C++, it's likely that you need to also install
|
||||
a C++ runtime library. Just as GNU C does not
|
||||
distribute a C runtime library, it also does not include a C++ runtime
|
||||
library. All I/O functionality, special class libraries, etc., are
|
||||
provided by the C++ runtime library.
|
||||
|
||||
The standard C++ runtime library for GNU CC is called @samp{libstdc++}.
|
||||
An obsolescent library @samp{libg++} may also be available, but it's
|
||||
@@ -668,56 +643,6 @@ Microsoft Win32 API thread support.
|
||||
@end itemize
|
||||
@end enumerate
|
||||
|
||||
@node Configuration Files
|
||||
@section Files Created by @code{configure}
|
||||
|
||||
Here we spell out what files will be set up by @code{configure}. Normally
|
||||
you need not be concerned with these files.
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
@ifset INTERNALS
|
||||
A file named @file{config.h} is created that contains a @samp{#include}
|
||||
of the top-level config file for the machine you will run the compiler
|
||||
on (@pxref{Config}). This file is responsible for defining information
|
||||
about the host machine. It includes @file{tm.h}.
|
||||
@end ifset
|
||||
@ifclear INTERNALS
|
||||
A file named @file{config.h} is created that contains a @samp{#include}
|
||||
of the top-level config file for the machine you will run the compiler
|
||||
on (@pxref{Config,,The Configuration File, gcc.info, Using and Porting
|
||||
GCC}). This file is responsible for defining information about the host
|
||||
machine. It includes @file{tm.h}.
|
||||
@end ifclear
|
||||
|
||||
The top-level config file is located in the subdirectory @file{config}.
|
||||
Its name is always @file{xm-@var{something}.h}; usually
|
||||
@file{xm-@var{machine}.h}, but there are some exceptions.
|
||||
|
||||
If your system does not support symbolic links, you might want to
|
||||
set up @file{config.h} to contain a @samp{#include} command which
|
||||
refers to the appropriate file.
|
||||
|
||||
@item
|
||||
A file named @file{tconfig.h} is created which includes the top-level config
|
||||
file for your target machine. This is used for compiling certain
|
||||
programs to run on that machine.
|
||||
|
||||
@item
|
||||
A file named @file{tm.h} is created which includes the
|
||||
machine-description macro file for your target machine. It should be in
|
||||
the subdirectory @file{config} and its name is often
|
||||
@file{@var{machine}.h}.
|
||||
|
||||
@item
|
||||
The command file @file{configure} also constructs the file
|
||||
@file{Makefile} by adding some text to the template file
|
||||
@file{Makefile.in}. The additional text comes from files in the
|
||||
@file{config} directory, named @file{t-@var{target}} and
|
||||
@file{x-@var{host}}. If these files do not exist, it means nothing
|
||||
needs to be added for a given target or host.
|
||||
@end itemize
|
||||
|
||||
@node Configurations
|
||||
@section Configurations Supported by GNU CC
|
||||
@cindex configurations supported by GNU CC
|
||||
@@ -2438,7 +2363,7 @@ installed before GNU CC is built. If the cross compilation header files
|
||||
are already suitable for ANSI C and GNU CC, nothing special need be
|
||||
done).
|
||||
|
||||
@code{GPLUSPLUS_INCLUDE_DIR} means the same thing for native and cross. It
|
||||
@code{GPLUS_INCLUDE_DIR} means the same thing for native and cross. It
|
||||
is where @code{g++} looks first for header files. The C++ library
|
||||
installs only target independent header files in that directory.
|
||||
|
||||
|
||||
+2
-19
@@ -122,12 +122,12 @@ in the following sections.
|
||||
@xref{Warning Options,,Options to Request or Suppress Warnings}.
|
||||
@smallexample
|
||||
-fsyntax-only -pedantic -pedantic-errors
|
||||
-w -W -Wall -Waggregate-return -Warglist-size-@var{n} -Wbad-function-cast
|
||||
-w -W -Wall -Waggregate-return -Wbad-function-cast
|
||||
-Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment
|
||||
-Wconversion -Werror -Wformat
|
||||
-Wid-clash-@var{len} -Wimplicit -Wimplicit-int
|
||||
-Wimplicit-function-declaration -Wimport
|
||||
-Werror-implicit-function-declaration -Wframe-size-@var{n} -Winline
|
||||
-Werror-implicit-function-declaration -Winline
|
||||
-Wlarger-than-@var{len} -Wlong-long
|
||||
-Wmain -Wmissing-declarations -Wmissing-noreturn
|
||||
-Wmissing-prototypes -Wmultichar -Wnested-externs -Wno-import
|
||||
@@ -1698,12 +1698,6 @@ A @code{switch} statement has an operand of type @code{long}.
|
||||
@item
|
||||
A non-@code{static} function declaration follows a @code{static} one.
|
||||
This construct is not accepted by some traditional C compilers.
|
||||
|
||||
@item
|
||||
The ANSI type of an integer constant has a different width or signedness
|
||||
from its traditional type. This warning is only issued if the base of
|
||||
the constant is ten. I.e. hexadecimal or octal values, which typically
|
||||
represent bit patterns, are not warned about.
|
||||
@end itemize
|
||||
|
||||
@item -Wundef
|
||||
@@ -1818,17 +1812,6 @@ the warning messages, use @samp{-Wno-long-long}. Flags
|
||||
@samp{-Wlong-long} and @samp{-Wno-long-long} are taken into account
|
||||
only when @samp{-pedantic} flag is used.
|
||||
|
||||
@item -Wframe-size-@var{n}
|
||||
Warn if a frame uses greater than @var{n} bytes. This warning can be useful
|
||||
when stack space is limited, as is typical in embedded environments. This
|
||||
warning, and also @samp{-Warglist-size-@var{n}}, can help locate functions
|
||||
who may contribute to a stack overrun.
|
||||
|
||||
@item -Warglist-size-@var{n}
|
||||
Warn if function argument list uses greater than @var{n} bytes. As with
|
||||
@samp{-Wframe-size-@var{n}}, this warning can help locate functions who
|
||||
may contribute to a stack overrun.
|
||||
|
||||
@item -Werror
|
||||
Make all warnings into errors.
|
||||
@end table
|
||||
|
||||
+3
-20
@@ -200,6 +200,8 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
|
||||
if (flag_exceptions && cross_jump)
|
||||
init_insn_eh_region (f, max_uid);
|
||||
|
||||
delete_barrier_successors (f);
|
||||
|
||||
/* Leave some extra room for labels and duplicate exit test insns
|
||||
we make. */
|
||||
max_jump_chain = max_uid * 14 / 10;
|
||||
@@ -222,8 +224,6 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
|
||||
for (insn = exception_handler_labels; insn; insn = XEXP (insn, 1))
|
||||
LABEL_NUSES (XEXP (insn, 0))++;
|
||||
|
||||
delete_barrier_successors (f);
|
||||
|
||||
/* Quit now if we just wanted to rebuild the JUMP_LABEL and REG_LABEL
|
||||
notes and recompute LABEL_NUSES. */
|
||||
if (mark_labels_only)
|
||||
@@ -2139,24 +2139,7 @@ delete_barrier_successors (f)
|
||||
insn = NEXT_INSN (insn);
|
||||
while (insn != 0 && GET_CODE (insn) != CODE_LABEL)
|
||||
{
|
||||
if (GET_CODE (insn) == JUMP_INSN)
|
||||
{
|
||||
/* Detect when we're deleting a tablejump; get rid of
|
||||
the jump table as well. */
|
||||
rtx next1 = next_nonnote_insn (insn);
|
||||
rtx next2 = next1 ? next_nonnote_insn (next1) : 0;
|
||||
if (next2 && GET_CODE (next1) == CODE_LABEL
|
||||
&& GET_CODE (next2) == JUMP_INSN
|
||||
&& (GET_CODE (PATTERN (next2)) == ADDR_VEC
|
||||
|| GET_CODE (PATTERN (next2)) == ADDR_DIFF_VEC))
|
||||
{
|
||||
delete_insn (insn);
|
||||
insn = next2;
|
||||
}
|
||||
else
|
||||
insn = delete_insn (insn);
|
||||
}
|
||||
else if (GET_CODE (insn) == NOTE
|
||||
if (GET_CODE (insn) == NOTE
|
||||
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_END)
|
||||
insn = NEXT_INSN (insn);
|
||||
else
|
||||
|
||||
+1
-7
@@ -1481,16 +1481,10 @@ combine_movables (movables, nregs)
|
||||
width as M1. The check for integer is redundant, but
|
||||
safe, since the only case of differing destination
|
||||
modes with equal sources is when both sources are
|
||||
VOIDmode, i.e., CONST_INT.
|
||||
|
||||
For 2.95, don't do this if the mode of M1 is Pmode.
|
||||
This prevents us from substituting SUBREGs for REGs
|
||||
in memory accesses; not all targets are prepared to
|
||||
handle this properly. */
|
||||
VOIDmode, i.e., CONST_INT. */
|
||||
(GET_MODE (m->set_dest) == GET_MODE (m1->set_dest)
|
||||
|| (GET_MODE_CLASS (GET_MODE (m->set_dest)) == MODE_INT
|
||||
&& GET_MODE_CLASS (GET_MODE (m1->set_dest)) == MODE_INT
|
||||
&& GET_MODE (m1->set_dest) != Pmode
|
||||
&& (GET_MODE_BITSIZE (GET_MODE (m->set_dest))
|
||||
>= GET_MODE_BITSIZE (GET_MODE (m1->set_dest)))))
|
||||
/* See if the source of M1 says it matches M. */
|
||||
|
||||
@@ -693,9 +693,6 @@ optimize_reg_copy_3 (insn, dest, src)
|
||||
}
|
||||
if (! (set = single_set (p))
|
||||
|| GET_CODE (SET_SRC (set)) != MEM
|
||||
/* If there's a REG_EQUIV note, this must be an insn that loads an
|
||||
argument. Prefer keeping the note over doing this optimization. */
|
||||
|| find_reg_note (p, REG_EQUIV, NULL_RTX)
|
||||
|| SET_DEST (set) != src_reg)
|
||||
return;
|
||||
|
||||
@@ -740,12 +737,6 @@ optimize_reg_copy_3 (insn, dest, src)
|
||||
PUT_MODE (src_reg, old_mode);
|
||||
XEXP (src, 0) = src_reg;
|
||||
}
|
||||
else
|
||||
{
|
||||
rtx note = find_reg_note (p, REG_EQUAL, NULL_RTX);
|
||||
if (note)
|
||||
remove_note (p, note);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+4
-33
@@ -4278,6 +4278,9 @@ reload_as_needed (live_known)
|
||||
spill_reg_order);
|
||||
}
|
||||
|
||||
if (num_eliminable && chain->need_elim)
|
||||
update_eliminable_offsets ();
|
||||
|
||||
if (n_reloads > 0)
|
||||
{
|
||||
rtx next = NEXT_INSN (insn);
|
||||
@@ -4324,10 +4327,6 @@ reload_as_needed (live_known)
|
||||
NOTE_LINE_NUMBER (p) = NOTE_INSN_DELETED;
|
||||
}
|
||||
}
|
||||
|
||||
if (num_eliminable && chain->need_elim)
|
||||
update_eliminable_offsets ();
|
||||
|
||||
/* Any previously reloaded spilled pseudo reg, stored in this insn,
|
||||
is no longer validly lying around to save a future reload.
|
||||
Note that this does not detect pseudos that were reloaded
|
||||
@@ -8072,9 +8071,7 @@ delete_output_reload (insn, j, last_reload_reg)
|
||||
}
|
||||
n_occurrences = count_occurrences (PATTERN (insn), reg);
|
||||
if (substed)
|
||||
n_occurrences += count_occurrences (PATTERN (insn),
|
||||
eliminate_regs (substed, 0,
|
||||
NULL_RTX));
|
||||
n_occurrences += count_occurrences (PATTERN (insn), substed);
|
||||
if (n_occurrences > n_inherited)
|
||||
return;
|
||||
|
||||
@@ -9970,21 +9967,6 @@ reload_combine_note_use (xp, insn)
|
||||
}
|
||||
break;
|
||||
|
||||
case USE:
|
||||
/* If this is the USE of a return value, we can't change it. */
|
||||
if (GET_CODE (XEXP (x, 0)) == REG && REG_FUNCTION_VALUE_P (XEXP (x, 0)))
|
||||
{
|
||||
/* Mark the return register as used in an unknown fashion. */
|
||||
rtx reg = XEXP (x, 0);
|
||||
int regno = REGNO (reg);
|
||||
int nregs = HARD_REGNO_NREGS (regno, GET_MODE (reg));
|
||||
|
||||
while (--nregs >= 0)
|
||||
reg_state[regno + nregs].use_index = -1;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case CLOBBER:
|
||||
if (GET_CODE (SET_DEST (x)) == REG)
|
||||
return;
|
||||
@@ -10001,23 +9983,12 @@ reload_combine_note_use (xp, insn)
|
||||
{
|
||||
int regno = REGNO (x);
|
||||
int use_index;
|
||||
int nregs;
|
||||
|
||||
/* Some spurious USEs of pseudo registers might remain.
|
||||
Just ignore them. */
|
||||
if (regno >= FIRST_PSEUDO_REGISTER)
|
||||
return;
|
||||
|
||||
nregs = HARD_REGNO_NREGS (regno, GET_MODE (x));
|
||||
|
||||
/* We can't substitute into multi-hard-reg uses. */
|
||||
if (nregs > 1)
|
||||
{
|
||||
while (--nregs >= 0)
|
||||
reg_state[regno + nregs].use_index = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
/* If this register is already used in some unknown fashion, we
|
||||
can't do anything.
|
||||
If we decrement the index from zero to -1, we can't store more
|
||||
|
||||
@@ -888,12 +888,6 @@ extern char *note_insn_name[];
|
||||
/* For a NOTE_INSN_LIVE note, the original basic block number. */
|
||||
#define RANGE_LIVE_ORIG_BLOCK(INSN) (XINT (INSN, 1))
|
||||
|
||||
/* Nonzero if we need to distinguish between the return value of this function
|
||||
and the return value of a function called by this function. This helps
|
||||
integrate.c.
|
||||
This is 1 until after the rtl generation pass. */
|
||||
extern int rtx_equal_function_value_matters;
|
||||
|
||||
/* Generally useful functions. */
|
||||
|
||||
/* The following functions accept a wide integer argument. Rather than
|
||||
|
||||
@@ -3464,13 +3464,6 @@ figure them out, compile a small program for profiling using the
|
||||
system's installed C compiler and look at the assembler code that
|
||||
results.
|
||||
|
||||
@findex NO_PROFILE_COUNTERS
|
||||
@item NO_PROFILE_COUNTERS
|
||||
Define this macro if the @code{mcount} subroutine on your system does
|
||||
not need a counter variable allocated for each function. This is true
|
||||
for almost all modern implementations. If you define this macro, you
|
||||
must not use the @var{labelno} argument to @code{FUNCTION_PROFILER}.
|
||||
|
||||
@findex PROFILE_BEFORE_PROLOGUE
|
||||
@item PROFILE_BEFORE_PROLOGUE
|
||||
Define this macro if the code for function profiling should come before
|
||||
|
||||
+9
-33
@@ -139,6 +139,8 @@ You Lose! You must define PREFERRED_DEBUGGING_TYPE!
|
||||
#define DIR_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
extern int rtx_equal_function_value_matters;
|
||||
|
||||
#if ! (defined (VMS) || defined (OS2))
|
||||
extern char **environ;
|
||||
#endif
|
||||
@@ -1073,10 +1075,6 @@ documented_lang_options[] =
|
||||
{ "-Wlong-long","" },
|
||||
{ "-Wno-long-long", "Do not warn about using 'long long' when -pedantic" },
|
||||
{ "-Wmain", "Warn about suspicious declarations of main" },
|
||||
{ "-Wframe-size-<N>",
|
||||
"Warn if frame uses greater than <N> bytes." },
|
||||
{ "-Wlarglist-size-<N>",
|
||||
"Warn if function argument list uses greater than <N> bytes." },
|
||||
{ "-Wno-main", "" },
|
||||
{ "-Wmissing-braces",
|
||||
"Warn about possibly missing braces around initialisers" },
|
||||
@@ -1231,18 +1229,6 @@ int warn_return_type;
|
||||
|
||||
int warn_cast_align;
|
||||
|
||||
/* Nonzero means warn if a frame is larger that N bytes. The value
|
||||
of N is warn_frame_size. */
|
||||
|
||||
int warn_frame_size_flag = 0;
|
||||
int warn_frame_size;
|
||||
|
||||
/* Nonzero means warn if a function call pushes more than N bytes
|
||||
onto the stack. The value of N is warn_arglist_size. */
|
||||
|
||||
int warn_arglist_size_flag = 0;
|
||||
int warn_arglist_size;
|
||||
|
||||
/* Nonzero means warn about any identifiers that match in the first N
|
||||
characters. The value N is in `id_clash_len'. */
|
||||
|
||||
@@ -4396,11 +4382,6 @@ rest_of_compilation (decl)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (warn_frame_size_flag)
|
||||
if (get_frame_size () > warn_frame_size)
|
||||
warning ("%d byte frame exceeds user specified limit (%d bytes)",
|
||||
get_frame_size (), warn_frame_size);
|
||||
|
||||
/* Now turn the rtl into assembler code. */
|
||||
|
||||
TIMEVAR (final_time,
|
||||
@@ -4872,22 +4853,17 @@ main (argc, argv)
|
||||
if (optimize_val != -1)
|
||||
{
|
||||
optimize = optimize_val;
|
||||
#ifdef FORCE_OPTIMIZATION_DOWNGRADE
|
||||
#warning FORCE_OPTIMIZATION_DOWNGRADE
|
||||
if (optimize > FORCE_OPTIMIZATION_DOWNGRADE)
|
||||
{
|
||||
optimize = FORCE_OPTIMIZATION_DOWNGRADE;
|
||||
warning ("\n***\n***\t-O%d converted to \"-O%d\" due to optimizer bugs on this platform\n***",
|
||||
optimize_val,
|
||||
FORCE_OPTIMIZATION_DOWNGRADE);
|
||||
|
||||
}
|
||||
#endif /*FORCE_OPTIMIZATION_DOWNGRADE*/
|
||||
#if defined(__alpha__)
|
||||
#ifdef __alpha__
|
||||
if (optimize > 1)
|
||||
{
|
||||
#ifdef FORCE_OPTIMIZATION_DOWNGRADE
|
||||
optimize = 1;
|
||||
warning ("\n***\n***\t-O%d converted to \"-O1\" due to optimizer bugs on this platform\n***",
|
||||
optimize_val);
|
||||
#else
|
||||
warning ("\n***\n***\tThe -O%d flag TRIGGERS KNOWN OPTIMIZER BUGS ON THIS PLATFORM\n***",
|
||||
optimize_val);
|
||||
#endif
|
||||
}
|
||||
#endif /*__alpha__*/
|
||||
optimize_size = 0;
|
||||
|
||||
+11
-2
@@ -3494,9 +3494,18 @@ force_const_mem (mode, x)
|
||||
|
||||
pop_obstacks ();
|
||||
}
|
||||
|
||||
if (GET_CODE (x) == LABEL_REF)
|
||||
LABEL_PRESERVE_P (XEXP (x, 0)) = 1;
|
||||
{
|
||||
extern rtx forced_labels;
|
||||
|
||||
push_obstacks_nochange ();
|
||||
rtl_in_saveable_obstack ();
|
||||
|
||||
forced_labels = gen_rtx_EXPR_LIST (VOIDmode,
|
||||
XEXP (x, 0),
|
||||
forced_labels);
|
||||
pop_obstacks ();
|
||||
}
|
||||
|
||||
/* Allocate a pool constant descriptor, fill it in, and chain it in. */
|
||||
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
/* $FreeBSD$ */
|
||||
|
||||
char *version_string = "2.95.4 20020320 [FreeBSD]";
|
||||
char *version_string = "2.95.3 20010315 (release) [FreeBSD]";
|
||||
@@ -419,7 +419,6 @@
|
||||
.ds doc-operating-system-FreeBSD-4.3 4.3
|
||||
.ds doc-operating-system-FreeBSD-4.4 4.4
|
||||
.ds doc-operating-system-FreeBSD-4.5 4.5
|
||||
.ds doc-operating-system-FreeBSD-4.6 4.6
|
||||
.ds doc-operating-system-FreeBSD-5.0 5.0
|
||||
.
|
||||
.de Os
|
||||
|
||||
@@ -45,8 +45,6 @@
|
||||
.\" times and is guaranteed to give a worst case performance
|
||||
.\" for an already extremely slow package.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.
|
||||
.Dd July 20, 2001
|
||||
.Os
|
||||
@@ -837,7 +835,7 @@ the release ID.
|
||||
.It FreeBSD
|
||||
1.0, 1.1, 1.1.5, 1.1.5.1, 2.0, 2.0.5, 2.1, 2.1.5, 2.1.6, 2.1.7, 2.2, 2.2.1,
|
||||
2.2.2, 2.2.5, 2.2.6, 2.2.7, 2.2.8, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 4.0, 4.1,
|
||||
4.2, 4.3, 4.4, 4.5, 4.6, 5.0
|
||||
4.2, 4.3, 4.4, 4.5, 5.0
|
||||
.El
|
||||
.Ed
|
||||
.Pp
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/sh
|
||||
if [ -f /usr/ucb/touch ] ; then
|
||||
TOUCH=/usr/ucb/touch
|
||||
else
|
||||
if [ -f /usr/bin/touch ] ; then
|
||||
TOUCH=/usr/bin/touch
|
||||
else
|
||||
if [ -f /bin/touch ] ; then
|
||||
TOUCH=/bin/touch
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo "$1...";
|
||||
/bin/cp /dev/null results/$1
|
||||
../ipftest -6 -r /dev/null -i /dev/null >/dev/null 2>&1
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "skipping IPv6 tests"
|
||||
$TOUCH $1
|
||||
exit 0
|
||||
fi
|
||||
( while read rule; do
|
||||
echo "$rule" | ../ipftest -6Hbr - -i input/$1 >> results/$1;
|
||||
if [ $? -ne 0 ] ; then
|
||||
exit 1;
|
||||
fi
|
||||
echo "--------" >> results/$1
|
||||
done ) < regress/$1
|
||||
cmp expected/$1 results/$1
|
||||
status=$?
|
||||
if [ $status = 0 ] ; then
|
||||
$TOUCH $1
|
||||
fi
|
||||
exit $status
|
||||
@@ -1,4 +0,0 @@
|
||||
block in on eri0(!) from any to any head 1
|
||||
pass in on eri0(!) proto icmp from any to any group 1
|
||||
pass out on ed0(!) from any to any head 1000000
|
||||
block out on ed0(!) proto udp from any to any group 1000000
|
||||
Loaded 100 of 1184 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user