NetBSD/gnu/usr.bin/gcc/gcc2netbsd

2912 lines
94 KiB
Plaintext
Raw Normal View History

#!/usr/gnu/bin/perl
#
# $NetBSD: gcc2netbsd,v 1.32 1998/04/09 00:32:34 tv Exp $
#
# Perl script to convert a standard distribution directory for gcc into
# a NetBSD source tree.
#
# This is done as a script so that as each distribution is released,
# only changes from the previous one need to be dealt with as
# modifications to this script and related files. This should
# reduce the cost of updating from a new release of gcc by an
# order of magnitude (or more?)
#
# This script requires two environment variables set:
# SRCDIR - gcc source directory from FSF
# TARGETDIR - name of the high level directory to make
#
# Written by Phil Nelson, November 22, 1995. (for gcc-2.7.1)
#
# Updated November 29, 1995 for gcc-2.7.2
1997-05-14 10:44:20 +04:00
# Updated May 13, 1997 for gcc-2.7.2.1
1997-05-14 23:26:32 +04:00
# Updated May 14, 1997 for gcc-2.7.2.2
# Updated Oct 21, 1997 to complete objc-support (Ignatios Souvatzis)
# Updated Oct 24, 1997 to fix the m68k trampolines (Ignatios Souvatzis)
#
1997-05-14 23:26:32 +04:00
# This is currently updated for gcc-2.7.2.2. Newer versions of gcc
# should have this script and related files updated.
#
1997-05-14 23:26:32 +04:00
$version = "2.7.2.2";
# definitions ...
@subdirs = ("arch", "common", "cc", "cc1", "cc1obj", "cc1plus", "cpp",
"g++", "libgcc", "libobjc");
# The following should include: "alpha"
@archlist = ("arm32", "i386", "m68k", "mips", "ns32k", "sparc", "vax");
@obver = ("obstack.c", "version.c");
@archf = ("netbsd.h", "xm-netbsd.h");
@ccf = ("gcc.c");
@ccof = ("gcc.1");
@cc1f = ("c-lang.c");
@cc1of = ();
@cc1objf = ("objc-act.c");
@cc1objof = ("objc-tree.def", "objc-act.h", "objc-parse.y");
@cc1plusf = ("call.c", "decl.c", "errfn.c", "expr.c", "pt.c", "sig.c",
"typeck2.c", "class.c", "decl2.c", "error.c", "gc.c",
"lex.c", "ptree.c", "spew.c", "typeck.c",
"cvt.c", "edsel.c", "except.c", "init.c", "method.c",
"search.c", "tree.c", "xref.c", "repo.c");
@cc1plusof = ("tree.def", "class.h", "cp-tree.h", "decl.h", "hash.h",
"lex.h", "input.c", "parse.y");
@commonf = ("bc-emit.c", "bc-optab.c", "bi-reverse.c", "c-aux-info.c",
"c-common.c", "c-convert.c", "c-decl.c", "c-iterate.c",
"c-lex.c", "c-pragma.c", "c-typeck.c", "caller-save.c",
"calls.c", "combine.c", "convert.c", "cse.c", "dbxout.c",
"dwarfout.c", "emit-rtl.c", "explow.c", "expmed.c",
"expr.c", "final.c", "flow.c", "fold-const.c",
"function.c", "getpwd.c", "global.c", "integrate.c",
"jump.c", "local-alloc.c", "loop.c", "obstack.c",
"optabs.c", "print-rtl.c", "print-tree.c", "real.c",
"recog.c", "reg-stack.c", "regclass.c", "reload.c",
"reload1.c", "reorg.c", "rtl.c", "rtlanal.c", "sched.c",
"sdbout.c", "stmt.c", "stor-layout.c", "stupid.c",
"toplev.c", "tree.c", "unroll.c", "varasm.c", "version.c",
"xcoffout.c");
@commonof = ("bc-typecd.def", "bytecode.def", "machmode.def",
"modemap.def", "rtl.def", "stab.def", "tree.def",
"assert.h", "basic-block.h", "bc-emit.h", "bc-optab.h",
"bc-typecd.h", "bi-defs.h", "bi-run.h",
"bytecode.h", "bytetypes.h", "c-gperf.h", "c-lex.h",
"c-parse.y", "c-pragma.h", "c-tree.h", "conditions.h",
"convert.h", "defaults.h", "dwarf.h", "expr.h",
"flags.h", "function.h", "gstab.h", "gsyms.h",
"hard-reg-set.h", "input.h", "integrate.h", "loop.h",
"machmode.h", "obstack.h", "output.h", "real.h",
"recog.h", "regs.h", "reload.h", "rtl.h", "stack.h",
"tree.h", "typeclass.h", "xcoffout.h", "bi-parser.y");
@commonplus = ("lang-specs.h", "lang-options.h");
@genf = ("bi-opcode.c", "bi-arity.c", "bi-opname.c",
"bi-lexer.c", "genattr.c", "genattrtab.c", "gencodes.c",
"genconfig.c", "genemit.c", "genextract.c", "genflags.c",
"genopinit.c", "genoutput.c", "genpeep.c", "genrecog.c" );
1996-05-11 15:37:59 +04:00
@cppf = ("cccp.c");
@cppof = ("pcp.h", "cexp.y");
@gplusf = ("g++.c");
@gplusof = ("g++.1");
@libgccf = ("libgcc1.c", "libgcc2.c");
@libgccof = ("gbl-ctors.h");
@libobjcf = ("NXConstStr.m", "Object.m", "Protocol.m",
"archive.c", "class.c", "encoding.c", "hash.c", "init.c",
"misc.c", "objects.c", "sarray.c", "selector.c",
"sendmsg.c");
@libobjcof = ("NXConstStr.h", "Object.h", "Protocol.h",
"encoding.h", "hash.h", "list.h", "objc-api.h",
"objc.h", "runtime.h", "sarray.h", "typedstream.h");
@genh = ("attr", "flags", "codes", "config");
@genbc = ("opcode", "opname", "arity");
@genc =("peep", "opinit", "recog", "extract", "output", "emit", "attrtab");
$gendep = "rtl.o obstack.o";
$bcdep = "bi-parser.o bi-lexer.o bi-reverse.o obstack.o";
%sedlist = ("libobjc/objects.c","'s/\\.\\.\\///g'",
"libobjc/sendmsg.c","'s/\\.\\.\\///g'");
#
# Utility Subroutines
#
# &copyfiles (fromdir, todir, list of files);
sub copyfiles {
local ($fdir, $tdir, @list) = @_;
local ($f);
foreach $f (@list) {
($sf,$tf) = split(/:/, $f);
if (!$tf) { $tf = $sf; };
print " $fdir/$sf --> $tdir/$tf\n";
system ("cp $fdir/$sf $tdir/$tf");
}
}
sub uniq {
local (@inlist) = @_;
local (@outlist);
@outlist = ($inlist[0]);
for ( $i=1; $i < @inlist; $i++ ) {
if ($inlist[$i] ne $inlist[$i-1]) {
push (@outlist, $inlist[$i]);
}
}
@outlist;
}
sub dumpsrcs {
local (@names) = @_;
local ($count);
print ODATA "SRCS=\t";
$count = 0;
foreach $f (@names) {
print ODATA "$f ";
if ($count == 4) {
print ODATA "\\\n\t";
$count = 0;
} else {
$count += 1;
}
}
if ($count != 0) {
print ODATA "\n";
}
}
# dump the rules for the generation programs.
sub dumpgens {
print ODATA "all: lib\$(LIB).a\n\n";
# print ODATA "beforedepend: ";
# foreach $n (@genh) { print ODATA "insn-$n.h "; };
# foreach $n (@genbc) { print ODATA "bc-$n.h "; };
#
# print ODATA "beforedepend: ";
# foreach $n (@genh) { print ODATA "insn-$n.h "; };
# foreach $n (@genbc) { print ODATA "bc-$n.h "; };
# print ODATA "c-parse.h\n\n";
foreach $n (@genh) {
print ODATA "insn-$n.h: gen$n \$(MD)\n";
print ODATA "\t./gen$n \$(MD) > insn-$n.h\n";
print ODATA "CLEANFILES += insn-$n.h gen$n gen$n.o\n\n";
}
foreach $n (@genbc) {
print ODATA "bc-$n.h: bi-$n \$(BCDEF)\n";
print ODATA "\t./bi-$n < \$(BCDEF) > bc-$n.h\n";
print ODATA "CLEANFILES += bc-$n.h bi-$n bi-$n.o\n\n";
}
foreach $n (@genc) {
print ODATA "insn-$n.c: gen$n \$(MD)\n";
print ODATA "\t./gen$n \$(MD) > insn-$n.c\n";
print ODATA "CLEANFILES += insn-$n.c gen$n gen$n.o\n\n";
}
foreach $n (@genh, @genc) {
print ODATA "gen$n.o: gen$n.c\n\n";
print ODATA "gen$n: gen$n.o $gendep";
if ($n eq "attrtab") {
print ODATA " print-rtl.o rtlanal.o";
print ODATA "\n\t\$(CC) -o gen$n gen$n.o $gendep".
" print-rtl.o rtlanal.o\n\n";
} else {
print ODATA "\n\t\$(CC) -o gen$n gen$n.o $gendep\n\n";
}
}
foreach $n (@genbc) {
print ODATA "bi-$n.o: bi-$n.c\n\n";
print ODATA "bi-$n: bi-$n.o $bcdep\n";
print ODATA "\t\$(CC) -o bi-$n bi-$n.o $bcdep\n\n";
}
# special clean files ...
print ODATA
"CLEANFILES += bi-lexer.o bi-parser.o bi-parser.c bi-parser.h\n\n";
}
#
# Main progarm.
#
$srcdir = $ENV{'SRCDIR'};
$targetdir = $ENV{'TARGETDIR'};
$incdirs = "-I. -I$srcdir/config -I$srcdir";
if (!$srcdir | !$targetdir) {
die "You must define the environment variables SRCDIR and TARGETDIR.\n"
}
print "Making the NetBSD directory tree.\n";
mkdir ($targetdir,0777);
foreach $f (@subdirs) {
print " -->$f\n";
mkdir ("$targetdir/$f",0777);
}
foreach $f(@archlist) {
print " -->arch/$f\n";
mkdir ("$targetdir/arch/$f",0777);
}
print "Populating $targetdir.\n";
&copyfiles ($srcdir, $targetdir, "COPYING");
print "Populating the arch directory.\n";
&copyfiles ("$srcdir/config", "$targetdir/arch", @archf);
foreach $arch (@archlist) {
if ($arch eq "arm32") {
&copyfiles ("$srcdir/config/arm", "$targetdir/arch/arm32",
"arm.c:arm32.c", "arm.h:arm32.h",
"arm.md:arm32.md", "xm-arm.h:xm-arm32.h");
} else {
system ("echo '#include \"$arch/xm-netbsd.h\"\n' > config.h");
system ("echo '#include \"$arch/netbsd.h\"\n' > tm.h");
print " cpp -M $incdirs tm.h config.h\n";
$results = `cpp -M $incdirs tm.h config.h`;
$results =~ tr/\n/ /;
@list = ();
foreach $item (split (/ /, $results)) {
if (index ($item, "$arch/") >= 0) {
push (@list, substr ($item, rindex ($item, '/')+1, 1000));
};
};
@list = sort (@list);
@list = &uniq (@list);
&copyfiles ("$srcdir/config/$arch", "$targetdir/arch/$arch",
"$arch.c", "$arch.md", @list);
}
# Config files
system ("printf \"#define NETBSD_NATIVE\n".
"#define DEFAULT_TARGET_VERSION \\\"$version\\\"\n".
"#define DEFAULT_TARGET_MACHINE \\\"NetBSD/$arch\\\"\n".
"#include \\\"$arch/xm-netbsd.h\\\"\n\"".
"> $targetdir/arch/$arch/config.h");
system ("printf \"#include \\\"$arch/xm-netbsd.h\\\"\\\n\"".
"> $targetdir/arch/$arch/hconfig.h");
system ("printf \"#include \\\"$arch/xm-netbsd.h\\\"\\\n\"".
"> $targetdir/arch/$arch/tconfig.h");
system ("printf \"#include \\\"$arch/netbsd.h\\\"\\\n\"".
"> $targetdir/arch/$arch/tm.h");
}
unlink ("config.h");
unlink ("tm.h");
# hack to allow mips/xm-netbsd.h to be changed later ...
chmod (0644, "$targetdir/arch/mips/xm-netbsd.h");
# and similarly for mips/netbsd.h.
chmod (0644, "$targetdir/arch/mips/netbsd.h");
print "Populating the top level directory.\n";
&copyfiles ($srcdir, $targetdir, "COPYING");
print "Populating the cc directory.\n";
&copyfiles ($srcdir, "$targetdir/cc", @ccf, @ccof);
print "Populating the cc1 directory.\n";
&copyfiles ($srcdir, "$targetdir/cc1", @cc1f, @cc1of);
print "Populating the cc1obj directory.\n";
&copyfiles ($srcdir, "$targetdir/cc1obj", @cc1objf, @cc1objof);
print "Populating the cc1plus directory.\n";
&copyfiles ("$srcdir/cp", "$targetdir/cc1plus", @cc1plusf, @cc1plusof);
print "Populating the common directory.\n";
&copyfiles ($srcdir, "$targetdir/common", @commonf, @commonof, @genf);
&copyfiles ("$srcdir/cp", "$targetdir/common", @commonplus);
print "Populating the cpp directory.\n";
&copyfiles ($srcdir, "$targetdir/cpp", @cppf, @cppof);
system ("cp $srcdir/cccp.1 $targetdir/cpp/cpp.1");
print "Populating the g++ directory.\n";
&copyfiles ("$srcdir/cp", "$targetdir/g++", @gplusf, @gplusof);
print "Populating the libgcc directory.\n";
&copyfiles ("$srcdir", "$targetdir/libgcc", @libgccf, @libgccof);
print "Populating the libobjc directory.\n";
&copyfiles ("$srcdir/objc", "$targetdir/libobjc", @libobjcf, @libobjcof);
#
# Build makefiles and other things.
#
$first = "True";
while ($line = <DATA>) {
chop ($line);
if (substr($line,0,2) eq "%%") {
@cmd = split (/ /,$line);
if ($cmd[1] eq "file") {
print "Building $targetdir/$cmd[2]\n";
if ($first eq "") {
close (ODATA);
} else {
$first = "";
}
open (ODATA, ">$targetdir/$cmd[2]") ||
die "Could not create $targetdir/$cmd[2]";
} elsif ($cmd[1] eq "srcs") {
print " Defining SRCS for $cmd[2]\n";
if ($first) {
die "Data file must start with a %% file!";
}
if ($cmd[2] eq "cc") {
&dumpsrcs (@ccf, @obver);
} elsif ($cmd[2] eq "cc1") {
&dumpsrcs ("c-parse.c", @cc1f);
} elsif ($cmd[2] eq "cc1plus") {
&dumpsrcs ("parse.c", @cc1plusf);
} elsif ($cmd[2] eq "cc1obj") {
&dumpsrcs ("objc-parse.c", "objc-act.c");
} elsif ($cmd[2] eq "cpp") {
1996-05-11 15:37:59 +04:00
&dumpsrcs (@cppf, "cexp.c", @obver);
} elsif ($cmd[2] eq "g++") {
&dumpsrcs (@gplusf, @obver);
} elsif ($cmd[2] eq "common") {
@flist = ();
foreach $n (@genc) { push (@flist, "insn-$n.c"); }
&dumpsrcs ("bc-arity.h", "bc-opcode.h", "bc-opname.h",
"c-parse.h", @commonf, "\$(MACHINE_ARCH).c",
"insn-attr.h", "insn-codes.h", "insn-config.h",
"insn-flags.h", @flist);
} elsif ($cmd[2] eq "objc") {
&dumpsrcs (@libobjcf);
} else {
die "Unknown SRCS command";
}
} elsif ($cmd[1] eq "gens") {
if ($first) {
die "Data file must start with a %% file!";
}
&dumpgens;
} elsif ($cmd[1] eq "NetBSD") {
if ($first) {
die "Data section must start with a %% file!";
}
print ODATA "# \$"."NetBSD".": \$\n";
} elsif ($cmd[1] eq "patch") {
print "Patching in directory $cmd[2]\n";
$cwd = `pwd`;
chop($cwd);
chdir ("$targetdir/$cmd[2]")
|| die "Can't connect to $targetdir/$cmd[2] in patch.\n";
if (!$first) {
close (ODATA);
$first = "True";
}
open (ODATA, ">PATCH") ||
die "Could not create PATCH file";
$more = "True";
while ($more) {
$line = <DATA>;
if (substr($line,0,2) eq "%%") {
$more = "";
close (ODATA);
} else {
print ODATA $line;
}
}
system ("patch < PATCH");
system ("rm -f *.orig PATCH");
chdir($cwd);
}
} else {
if ($first) {
die "Data file must start with a %% command!";
}
print ODATA "$line\n";
}
}
if (!$first) {
close (ODATA);
}
#
# Sed transformations of files
#
foreach $n (keys(%sedlist)) {
print "Modifying $n\n";
system ("cd $targetdir; sed $sedlist{$n} $n > tmp; mv -f tmp $n");
}
#
# end of the script
#
# what follows is the data for makefiles and other special files
# that need to be created.
__END__
1997-05-14 10:44:20 +04:00
%% file README
This is the NetBSD version of the GNU C compiler (gcc).
This tree is the output of the PERL script gcc2netbsd.
Full source code for gcc is available in its original form
from the Free Software Foundation at the following URL.
ftp://prep.ai.mit.edu/pub/gnu
or at most GNU software mirrors.
%% file Makefile
%% NetBSD
.if (${MACHINE_ARCH} == "arm32") || \
(${MACHINE_ARCH} == "i386") || \
(${MACHINE_ARCH} == "mips") || \
(${MACHINE_ARCH} == "m68k") || \
(${MACHINE_ARCH} == "ns32k") || \
(${MACHINE_ARCH} == "sparc") || \
(${MACHINE_ARCH} == "vax")
SUBDIR+= common cc1 cc1plus cc1obj libgcc libobjc
all-cc1 all-cc1plus all-cc1obj: all-common
.endif
SUBDIR+= cc cpp g++
.include <bsd.subdir.mk>
%% file Makefile.cc1
%% NetBSD
NOMAN=
BINDIR= /usr/libexec
COMMON!=cd $(.CURDIR)/../common; \
printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}\n" | ${MAKE} -s -f-
1997-10-25 14:10:19 +04:00
CPPFLAGS+=-I. -I${.CURDIR} -I${.CURDIR}/../common -I${.CURDIR}/../arch \
-I${.CURDIR}/../arch/$(MACHINE_ARCH) -I$(COMMON)
YFLAGS=
LDADD+= -L${COMMON} -lcc1 -lgnumalloc
DPADD+= ${COMMON}/libcc1.a ${LIBGNUMALLOC}
1996-04-03 12:18:16 +04:00
.include <bsd.prog.mk>
%% file common/Makefile
%% NetBSD
LIB= cc1
NOMAN=
NOPIC=
NOPROFILE=
COMMON!=cd $(.CURDIR)/../common; \
printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}\n" | ${MAKE} -s -f-
1997-10-25 14:10:19 +04:00
CPPFLAGS+=-I${.CURDIR} -I${.CURDIR}/../arch \
-I${.CURDIR}/../arch/$(MACHINE_ARCH) -I$(COMMON)
MD= ${.CURDIR}/../arch/${MACHINE_ARCH}/${MACHINE_ARCH}.md
BCDEF= ${.CURDIR}/bytecode.def
.PATH: ${.CURDIR}/../arch/${MACHINE_ARCH}
%% srcs common
%% gens
bi-lexer.o: bi-parser.h
bi-parser.h: bi-parser.c
bi-parser.c: bi-parser.y
$(YACC) -b bi -d $(.IMPSRC)
mv -f bi.tab.c bi-parser.c
mv -f bi.tab.h bi-parser.h
CLEANFILES += c-parse.c c-parse.h
c-lex.o: c-parse.h
c-parse.h: c-parse.c
c-parse.c: c-parse.y
$(YACC) -b c -d $(.IMPSRC)
mv -f c.tab.c c-parse.c
mv -f c.tab.h c-parse.h
# only needed during build
libinstall::
.include <bsd.lib.mk>
%% file cc/Makefile
# from: @(#)Makefile 6.2 (Berkeley) 3/25/91
%% NetBSD
.if (${MACHINE_ARCH} == "i386") || \
(${MACHINE_ARCH} == "m68k") || \
(${MACHINE_ARCH} == "ns32k") || \
(${MACHINE_ARCH} == "sparc") || \
(${MACHINE_ARCH} == "vax") || \
(${MACHINE_ARCH} == "arm32") || \
(${MACHINE_ARCH} == "mips")
PROG= gcc
%% srcs cc
BINDIR= /usr/bin
1997-10-25 14:10:19 +04:00
CPPFLAGS+=-I${.CURDIR} -I${.CURDIR}/../common -I${.CURDIR}/../arch \
-I${.CURDIR}/../arch/$(MACHINE_ARCH) \
-DMD_EXEC_PREFIX=\"/usr/libexec/\" \
-DMD_STARTFILE_PREFIX=\"/usr/lib/\"
LDADD+= -lgnumalloc
1997-03-27 08:13:52 +03:00
DPADD+= ${LIBGNUMALLOC}
LINKS+= ${BINDIR}/gcc ${BINDIR}/cc
.PATH: $(.CURDIR)/../common
.endif
MAN= gcc.1
MLINKS= gcc.1 cc.1
.include <bsd.prog.mk>
%% file cc1/Makefile
%% NetBSD
PROG= cc1
%% srcs cc1
CLEANFILES+= c-parse.c
.PATH: ${.CURDIR}/../common
.include "../Makefile.cc1"
%% file cc1plus/Makefile
%% NetBSD
PROG= cc1plus
%% srcs cc1plus
YHEADER=1
lex.c pt.c spew.c: parse-h
parse-h: parse.h
grep '^#define[ ]*YYEMPTY' parse.c >>parse.h
@touch parse-h
CLEANFILES+= parse-h
.include "../Makefile.cc1"
%% file cc1obj/Makefile
%% NetBSD
PROG= cc1obj
%% srcs cc1obj
CLEANFILES+= objc-parse.c
.include "../Makefile.cc1"
%% file cpp/Makefile
# from: @(#)Makefile 6.4 (Berkeley) 2/21/91
%% NetBSD
.if (${MACHINE_ARCH} == "i386") || \
(${MACHINE_ARCH} == "m68k") || \
(${MACHINE_ARCH} == "ns32k") || \
(${MACHINE_ARCH} == "sparc") || \
(${MACHINE_ARCH} == "vax") || \
(${MACHINE_ARCH} == "arm32") || \
(${MACHINE_ARCH} == "mips")
PROG= cpp
BINDIR= /usr/libexec
%% srcs cpp
1997-10-25 14:10:19 +04:00
CPPFLAGS+=-I. -I$(.CURDIR) -I$(.CURDIR)/../common -I$(.CURDIR)/../arch \
-I$(.CURDIR)/../arch/$(MACHINE_ARCH) \
-DGCC_INCLUDE_DIR=\"\" \
-DTOOL_INCLUDE_DIR=\"\" \
-DGPLUSPLUS_INCLUDE_DIR=\"/usr/include/g++\"
LDADD+= -lgnumalloc
DPADD+= ${LIBGNUMALLOC}
YFLAGS=
1996-05-11 15:37:59 +04:00
CLEANFILES+= cexp.c
.PATH: $(.CURDIR)/../common
.endif
LINKS= /usr/bin/cpp /usr/bin/gcpp
1997-03-25 01:02:40 +03:00
FILES=usr.bin.cpp.sh
FILESNAME=cpp
1997-03-25 01:02:40 +03:00
FILESDIR=/usr/bin
FILESMODE=${BINMODE}
MAN= cpp.1
MLINKS= cpp.1 cccp.1 cpp.1 gcpp.1
.include <bsd.prog.mk>
%% file g++/Makefile
# from: @(#)Makefile 6.2 (Berkeley) 3/25/91
%% NetBSD
.if (${MACHINE_ARCH} == "i386") || \
(${MACHINE_ARCH} == "m68k") || \
(${MACHINE_ARCH} == "ns32k") || \
(${MACHINE_ARCH} == "sparc") || \
(${MACHINE_ARCH} == "vax") || \
(${MACHINE_ARCH} == "arm32") || \
(${MACHINE_ARCH} == "mips")
PROG= g++
%% srcs g++
BINDIR= /usr/bin
1997-10-25 14:10:19 +04:00
CPPFLAGS+=-I$(.CURDIR) -I$(.CURDIR)/../common \
-I$(.CURDIR)/../arch -I$(.CURDIR)/../arch/$(MACHINE_ARCH) \
-DGCC_NAME=\"/usr/bin/cc\"
LDADD+= -lgnumalloc
DPADD+= ${LIBGNUMALLOC}
LINKS+= ${BINDIR}/g++ ${BINDIR}/c++
.PATH: $(.CURDIR)/../common
.endif
MAN= g++.1
MLINKS= g++.1 c++.1
.include <bsd.prog.mk>
%% file libgcc/Makefile
%% NetBSD
LIB= gcc
NOLINT=
NOPROFILE=
NOPIC=
1997-10-25 14:10:19 +04:00
CPPFLAGS+=-I${.CURDIR}/../common -I${.CURDIR}/../arch \
-I${.CURDIR}/../arch/${MACHINE_ARCH}
#LIB1OBJS= _mulsi3.o _udivsi3.o _divsi3.o _umodsi3.o _modsi3.o _lshrsi3.o \
# _lshlsi3.o _ashrsi3.o _ashlsi3.o _divdf3.o _muldf3.o _negdf2.o \
# _adddf3.o _subdf3.o _fixdfsi.o _fixsfsi.o _floatsidf.o _floatsisf.o \
# _truncdfsf2.o _extendsfdf2.o _addsf3.o _negsf2.o _subsf3.o \
# _mulsf3.o _divsf3.o _eqdf2.o _nedf2.o _gtdf2.o _gedf2.o _ltdf2.o \
# _ledf2.o _eqsf2.o _nesf2.o _gtsf2.o _gesf2.o _ltsf2.o _lesf2.o
#LIB2OBJS= _muldi3.o _divdi3.o _moddi3.o _udivdi3.o _umoddi3.o _negdi2.o \
# _lshrdi3.o _lshldi3.o _ashldi3.o _ashrdi3.o _ffsdi2.o \
# _udiv_w_sdiv.o _udivmoddi4.o _cmpdi2.o _ucmpdi2.o _floatdidf.o \
# _floatdisf.o _fixunsdfsi.o _fixunssfsi.o _fixunsdfdi.o _fixdfdi.o \
# _fixunssfdi.o _fixsfdi.o _fixxfdi.o _fixunsxfdi.o _floatdixf.o \
# _fixunsxfsi.o
LIB2OBJS+=__gcc_bcmp.o _varargs.o _eprintf.o _op_new.o _new_handler.o \
_op_delete.o _bb.o _shtab.o _clear_cache.o _trampoline.o __main.o \
_exit.o _ctors.o _op_vdel.o _op_vnew.o _pure.o _eh.o
.if (${MACHINE_ARCH} == "m68k") || (${MACHINE_ARCH} == "i386")
LIB2OBJS+=_fixxfdi.o _fixunsxfdi.o _floatdixf.o _fixunsxfsi.o
.endif
OBJS= ${LIB1OBJS} ${LIB2OBJS}
#LIB1SOBJS=${LIB1OBJS:.o=.so}
LIB2SOBJS=${LIB2OBJS:.o=.so}
#${LIB1OBJS}: libgcc1.c
# ${COMPILE.c} -DL${.PREFIX} -o ${.TARGET} ${.CURDIR}/libgcc1.c
# @${LD} -x -r ${.TARGET}
# @mv a.out ${.TARGET}
${LIB2OBJS}: libgcc2.c
${COMPILE.c} -DL${.PREFIX} -o ${.TARGET} ${.CURDIR}/libgcc2.c
@${LD} -x -r ${.TARGET}
@mv a.out ${.TARGET}
#${LIB1SOBJS}: libgcc1.c
# ${COMPILE.c} -fpic -DL${.PREFIX} -o ${.TARGET} ${.CURDIR}/libgcc1.c
${LIB2SOBJS}: libgcc2.c
${COMPILE.c} -fpic -DL${.PREFIX} -o ${.TARGET} ${.CURDIR}/libgcc2.c
.include <bsd.lib.mk>
%% file libobjc/Makefile
%% NetBSD
LIB= objc
INCSDIR=/usr/include/objc
INCS= NXConstStr.h Object.h Protocol.h \
encoding.h hash.h list.h objc.h objc-api.h sarray.h typedstream.h
NOLINT=
NOPROFILE=
NOPIC=
.SUFFIXES: .o .m
1997-10-25 14:10:19 +04:00
.m.o: ; ${CC} -c ${CFLAGS} ${CPPFLAGS} -o ${.TARGET} ${.IMPSRC}
1997-10-25 14:10:19 +04:00
CPPFLAGS+=-I${.CURDIR}/../common -I${.CURDIR}/../arch \
-I${.CURDIR}/../arch/${MACHINE_ARCH}
%% srcs objc
.include <bsd.lib.mk>
%% file cpp/usr.bin.cpp.sh
#!/bin/sh
#
# Copyright (c) 1990 The Regents of the University of California.
# All rights reserved.
#
# This code is derived from software contributed to Berkeley by
# the Systems Programming Group of the University of Utah Computer
# Science Department.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by the University of
# California, Berkeley and its contributors.
# 4. Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# @(#)usr.bin.cpp.sh 6.5 (Berkeley) 4/1/91
#
# Transitional front end to CCCP to make it behave like (Reiser) CCP:
# specifies -traditional
# doesn't search gcc-include
#
PATH=/usr/bin:/bin
CPP=/usr/libexec/cpp
ALST="-traditional -D__GNUC__ -$ "
NSI=no
OPTS=""
INCS="-nostdinc"
FOUNDFILES=no
while [ $# -gt 0 ]
do
A="$1"
shift
case $A in
-nostdinc)
NSI=yes
;;
-traditional)
;;
-I*)
INCS="$INCS $A"
;;
-U__GNUC__)
ALST=`echo $ALST | sed -e 's/-D__GNUC__//'`
;;
-imacros|-include|-idirafter|-iprefix|-iwithprefix)
INCS="$INCS '$A' '$1'"
shift
;;
-*)
OPTS="$OPTS '$A'"
;;
*)
FOUNDFILES=yes
if [ $NSI = "no" ]
then
INCS="$INCS -I/usr/include"
NSI=skip
fi
eval $CPP $ALST $INCS $OPTS $A || exit $?
;;
esac
done
if [ $FOUNDFILES = "no" ]
then
# read standard input
if [ $NSI = "no" ]
then
INCS="$INCS -I/usr/include"
fi
eval exec $CPP $ALST $INCS $OPTS
fi
exit 0
%% file cc/specs.h
#include "lang-specs.h"
%% file cc/multilib.h
#define MULTILIB_SELECT ". ;"
%% file common/options.h
#include "lang-options.h"
%% file arch/mips/xm-netbsd.h
#include <mips/xm-mips.h>
#include <xm-netbsd.h>
%%file arch/mips/netbsd.h
/* Definitions for DECstation running BSD as target machine for GNU compiler.
Copyright (C) 1993, 1995 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* We settle for little endian for now */
#define TARGET_ENDIAN_DEFAULT 0
/* Look for the include files in the system-defined places. */
#ifndef CROSS_COMPILE
#undef GPLUSPLUS_INCLUDE_DIR
#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++"
#undef GCC_INCLUDE_DIR
#define GCC_INCLUDE_DIR "/usr/include"
#undef INCLUDE_DEFAULTS
#define INCLUDE_DEFAULTS \
{ \
{ GPLUSPLUS_INCLUDE_DIR, 1, 1 }, \
{ GCC_INCLUDE_DIR, 0, 0 }, \
{ 0, 0, 0 } \
}
/* Under NetBSD, the normal location of the various *crt*.o files is the
/usr/lib directory. */
#undef STANDARD_STARTFILE_PREFIX
#define STANDARD_STARTFILE_PREFIX "/usr/lib/"
#endif
/* Provide a LINK_SPEC appropriate for NetBSD. Here we provide support
for the special GCC options -static, -assert, and -nostdlib. */
#undef LINK_SPEC
#define LINK_SPEC \
"%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
%{bestGnum} %{shared} %{non_shared} \
%{call_shared} %{no_archive} %{exact_version} \
%{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} \
%{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \
%{static:-Bstatic} %{!static:-Bdynamic} %{assert*}"
/* We have atexit(3). */
#define HAVE_ATEXIT
/* Implicit library calls should use memcpy, not bcopy, etc. */
#define TARGET_MEM_FUNCTIONS
/* Define mips-specific netbsd predefines... */
#ifndef CPP_PREDEFINES
#define CPP_PREDEFINES "-D__ANSI_COMPAT \
-DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__NetBSD__ -Dmips \
-D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ \
-Dunix -D_R3000 -D__KPRINTF_ATTRIBUTE__ \
-Asystem(unix) -Asystem(NetBSD) -Amachine(mips)"
#endif
#ifndef CC1_SPEC
#define CC1_SPEC "\
%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
%{mips1:-mfp32 -mgp32}%{mips2:-mfp32 -mgp32}\
%{mips3:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \
%{mips4:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \
%{mfp64:%{msingle-float:%emay not use both -mfp64 and -msingle-float}} \
%{mfp64:%{m4650:%emay not use both -mfp64 and -m4650}} \
%{m4650:-mcpu=r4650} \
%{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \
%{pic-none: -mno-half-pic} \
%{pic-lib: -mhalf-pic} \
%{pic-extern: -mhalf-pic} \
%{pic-calls: -mhalf-pic} \
%{save-temps: } \
%{!mno-abicalls: -mabicalls}"
#endif
/* Always uses gas. */
#ifndef ASM_SPEC
#define ASM_SPEC "\
%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{v} \
%{noasmopt:-O0} \
%{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}} \
%{g} %{g0} %{g1} %{g2} %{g3} \
%{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \
%{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} \
%{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \
%{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3} \
%{membedded-pic} %{fPIC:-KPIC}"
#endif
#ifndef CPP_SPEC
#define CPP_SPEC "\
%{posix:-D_POSIX_SOURCE} \
%{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
%{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
%{mips3:-U__mips -D__mips=3 -D__mips64} \
%{mgp32:-U__mips64} %{mgp64:-D__mips64}"
#endif
#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
#undef LIB_SPEC
#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc /usr/lib/crtn.o%s"
#define STARTFILE_SPEC \
"%{!shared:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}}"
#ifndef MACHINE_TYPE
#define MACHINE_TYPE "NetBSD/mips"
#endif
#define TARGET_DEFAULT MASK_GAS
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
#define LOCAL_LABEL_PREFIX "."
/* -G is incompatible with -KPIC which is the default, so only allow objects
in the small data section if the user explicitly asks for it. */
#undef MIPS_DEFAULT_GVALUE
#define MIPS_DEFAULT_GVALUE 0
#include "mips/mips.h"
/*
* Some imports from svr4.h in support of shared libraries.
* Currently, we need the DECLARE_OBJECT_SIZE stuff.
*/
/* Define the strings used for the special svr4 .type and .size directives.
These strings generally do not vary from one system running svr4 to
another, but if a given system (e.g. m88k running svr) needs to use
different pseudo-op names for these, they may be overridden in the
file which includes this one. */
#undef TYPE_ASM_OP
#undef SIZE_ASM_OP
#undef WEAK_ASM_OP
#define TYPE_ASM_OP ".type"
#define SIZE_ASM_OP ".size"
#define WEAK_ASM_OP ".weak"
/* This is how to equate one symbol to another symbol. The syntax used is
`SYM1=SYM2'. Note that this is different from the way equates are done
with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'. */
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
do { fprintf ((FILE), "\t"); \
assemble_name (FILE, LABEL1); \
fprintf (FILE, " = "); \
assemble_name (FILE, LABEL2); \
fprintf (FILE, "\n"); \
} while (0)
/* The following macro defines the format used to output the second
operand of the .type assembler directive. Different svr4 assemblers
expect various different forms for this operand. The one given here
is just a default. You may need to override it in your machine-
specific tm.h file (depending upon the particulars of your assembler). */
#undef TYPE_OPERAND_FMT
#define TYPE_OPERAND_FMT "@%s"
/* Write the extra assembler code needed to declare a function's result.
Most svr4 assemblers don't require any special declaration of the
result value, but there are exceptions. */
#ifndef ASM_DECLARE_RESULT
#define ASM_DECLARE_RESULT(FILE, RESULT)
#endif
/* These macros generate the special .type and .size directives which
are used to set the corresponding fields of the linker symbol table
entries in an ELF object file under SVR4. These macros also output
the starting labels for the relevant functions/objects. */
/* Write the extra assembler code needed to declare a function properly.
Some svr4 assemblers need to also have something extra said about the
function's return value. We allow for that here. */
#undef ASM_DECLARE_FUNCTION_NAME
#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
do { \
extern FILE *asm_out_text_file; \
\
if (TARGET_GP_OPT) \
{ \
int align; \
STREAM = asm_out_text_file; \
/* Output ALIGN again to the new stream. XXX */ \
align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT); \
if (align > 0) \
{ \
if (output_bytecode) \
BC_OUTPUT_ALIGN (STREAM, align); \
else \
ASM_OUTPUT_ALIGN (STREAM, align); \
} \
} \
fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \
assemble_name (STREAM, NAME); \
putc (',', STREAM); \
fprintf (STREAM, TYPE_OPERAND_FMT, "function"); \
putc ('\n', STREAM); \
ASM_DECLARE_RESULT (STREAM, DECL_RESULT (DECL)); \
HALF_PIC_DECLARE (NAME); \
} while (0)
/* Assemble generic sections.
/* Write the extra assembler code needed to declare an object properly. */
#undef ASM_DECLARE_OBJECT_NAME
#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
do { \
fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
assemble_name (FILE, NAME); \
putc (',', FILE); \
fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
putc ('\n', FILE); \
size_directive_output = 0; \
if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
{ \
size_directive_output = 1; \
fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
assemble_name (FILE, NAME); \
fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
} \
ASM_OUTPUT_LABEL(FILE, NAME); \
} while (0)
/* Output the size directive for a decl in rest_of_decl_compilation
in the case where we did not do so before the initializer.
Once we find the error_mark_node, we know that the value of
size_directive_output was set
by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
#undef ASM_FINISH_DECLARE_OBJECT
#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
do { \
char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
&& ! AT_END && TOP_LEVEL \
&& DECL_INITIAL (DECL) == error_mark_node \
&& !size_directive_output) \
{ \
size_directive_output = 1; \
fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
assemble_name (FILE, name); \
fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
} \
} while (0)
/* This is how to declare the size of a function. */
#undef ASM_DECLARE_FUNCTION_SIZE
#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
do { \
if (!flag_inhibit_size_directive) \
{ \
char label[256]; \
static int labelno; \
labelno++; \
ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
assemble_name (FILE, (FNAME)); \
fprintf (FILE, ","); \
assemble_name (FILE, label); \
fprintf (FILE, "-"); \
assemble_name (FILE, (FNAME)); \
putc ('\n', FILE); \
} \
} while (0)
/* Since gas and gld are standard on NetBSD, we don't need these */
#undef ASM_FINAL_SPEC
#undef STARTFILE_SPEC
%% file arch/arm32/netbsd.h
/* Definitions of target machine for GNU compiler.
NetBSD/arm (RiscBSD) version.
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
Contributed by Mark Brinicombe (amb@physig.ph.kcl.ac.uk)
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, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Ok it either ARM2 or ARM3 code is produced we need to define the
* appropriate symbol and delete the ARM6 symbol
*/
/* Run-time Target Specification. */
#define TARGET_VERSION fputs (" (ARM/NetBSD)", stderr);
/* This is used in ASM_FILE_START */
#define ARM_OS_NAME "NetBSD"
/* Unsigned chars produces much better code than signed. */
#define DEFAULT_SIGNED_CHAR 0
/* ARM600 default cpu */
#define TARGET_DEFAULT 8
/* Since we always use GAS as our assembler we support stabs */
#define DBX_DEBUGGING_INFO 1
/*#undef ASM_DECLARE_FUNCTION_NAME*/
#include "arm32/arm32.h"
/* Gets redefined in config/netbsd.h */
#undef TARGET_MEM_FUNCTIONS
#include <netbsd.h>
/* Ok some nice defines for CPP
By default we define arm32 __arm32__ and __arm6__
However if we are compiling 26 bit code -m2 or -m3 then
we remove all these definitions.
The arm32 and __arm32__ defines indication that the compiler
is generating 32 bit address space code.
The __arm2__ __arm3__ and __arm6__ are obvious. */
#undef CPP_PREDEFINES
#define CPP_PREDEFINES "-Dunix -Darm32 -D__arm32__ -D__arm6__ -Driscbsd -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__ -Asystem(unix) -Asystem(NetBSD) -Acpu(arm) -Amachine(arm)"
#undef CPP_SPEC
#define CPP_SPEC "%{m2:-D__arm2__} %{m3:-D__arm3__} %{m2:-U__arm6__} \
%{m3:-U__arm6__} %{m2:-U__arm32__} %{m3:-U__arm32__} \
%{m2:-Uarm32} %{m3:-Uarm32} \
%{posix:-D_POSIX_SOURCE}"
#undef SIZE_TYPE
#define SIZE_TYPE "unsigned int"
#undef PTRDIFF_TYPE
#define PTRDIFF_TYPE "int"
#undef WCHAR_TYPE
#define WCHAR_TYPE "int"
#undef WCHAR_UNSIGNED
#define WCHAR_UNSIGNED 0
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32
#define HANDLE_SYSV_PRAGMA
/* We don't have any limit on the length as out debugger is GDB */
#undef DBX_CONTIN_LENGTH
/* NetBSD does its profiling differently to the Acorn compiler. We don't need
a word following mcount call and to skip if requires an assembly stub of
use of fomit-frame-pointer when compiling the profiling functions.
Since we break Acorn CC compatibility below a little more won't hurt */
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(STREAM,LABELNO) \
{ \
fprintf(STREAM, "\tmov\t%sip, %slr\n", REGISTER_PREFIX, REGISTER_PREFIX); \
fprintf(STREAM, "\tbl\tmcount\n"); \
}
/* VERY BIG NOTE : Change of structure alignment for RiscBSD.
There are consequences you should be aware of */
/* Normally GCC/arm uses a structure alignment of 32. This means that
structures are padded to a word boundry. However this causes
problems with bugged NetBSD kernel code (possible userland code
as well - I have not checked every binary).
The nature of this the bugged code is to rely on sizeof() returning
the correct size of various structures rounded to the nearest byte
(SCSI and ether code are two examples, the vm system is another)
This code starts to break when the structure alignment is 32 as sizeof()
will report a word rounded size.
By changing the structure alignment to 8. GCC will conform to what
is expected by NetBSD.
This has several side effects that should be considered.
1. Structures will only be aligned to the size of the largest member.
i.e. structures containing only bytes will be byte aligned.
structures containing shorts will be half word alinged.
structures containing ints will be word aligned.
This means structures should be padded to a word boundry if
alignment of 32 is require for byte structures etc.
2. A potential performance penalty may exist if strings are no longer
word aligned. GCC will not be able to use word load/stores for copy
short strings.
This modification is not encouraged but with the present state of the
NetBSD source tree it is currently the only solution to meet the
requirements.
*/
#undef STRUCTURE_SIZE_BOUNDARY
#define STRUCTURE_SIZE_BOUNDARY 8
%% file arch/arm32/xm-netbsd.h
/* Configuration for GCC for ARM running NetBSD as host. */
#include <arm32/xm-arm32.h>
/* xm-netbsd.h defines this */
#ifdef HAVE_VPRINTF
#undef HAVE_VPRINTF
#endif
#include <xm-netbsd.h>
%% patch arch/arm32
--- gcc/arch/arm32/xm-arm32.h Tue May 13 10:58:09 1997
+++ gcc.current/arch/arm32/xm-arm32.h Tue May 13 09:23:00 1997
@@ -69,6 +69,6 @@
#define HAVE_GETWD 1
#endif
-/* EOF xm-arm.h */
+/* EOF xm-arm32.h */
%% end patch
%% patch arch/i386
--- gcc/arch/i386/netbsd.h Tue May 13 11:47:19 1997
+++ gcc.current/arch/i386/netbsd.h Tue May 13 09:22:42 1997
@@ -13,7 +13,7 @@
#include <netbsd.h>
#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Di386 -D__NetBSD__ -Asystem(unix) -Asystem(NetBSD) -Acpu(i386) -Amachine(i386)"
+#define CPP_PREDEFINES "-Dunix -Di386 -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__ -Asystem(unix) -Asystem(NetBSD) -Acpu(i386) -Amachine(i386)"
#undef SIZE_TYPE
#define SIZE_TYPE "unsigned int"
@@ -29,8 +29,6 @@
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32
-
-#define HANDLE_SYSV_PRAGMA
/* There are conflicting reports about whether this system uses
a different assembler syntax. wilson@cygnus.com says # is right. */
%% end patch
%% patch arch/m68k
diff -u /usr/local/src/gcc-2.7.2.2/config/m68k/m68k.h gcc/arch/m68k/m68k.h
--- /usr/local/src/gcc-2.7.2.2/config/m68k/m68k.h Wed Oct 22 10:02:52 1997
+++ gcc/arch/m68k/m68k.h Fri Oct 24 22:56:25 1997
@@ -90,9 +90,17 @@
run on a 68030 and 68881/2. */
#define TARGET_68040 (target_flags & 01400)
-/* Use the 68040-only fp instructions (-m68040). */
+/* Use the 68040-only fp instructions (-m68040 or -m68060). */
#define TARGET_68040_ONLY (target_flags & 01000)
+/* Optimize for 68060, but still allow execution on 68020
+ (-m68060).
+ The 68060 will execute all 68030 and 68881/2 instructions, but some
+ of them must be emulated in software by the OS. When TARGET_68060 is
+ turned on, these instructions won't be used. This code will still
+ run on a 68030 and 68881/2. */
+#define TARGET_68060 (target_flags & 02000)
+
/* Macro to define tables used to set the flags.
This is a list in braces of pairs in braces,
each pair being { "NAME", VALUE }
@@ -100,14 +108,14 @@
An empty string NAME is used to identify the default VALUE. */
#define TARGET_SWITCHES \
- { { "68020", -01400}, \
- { "c68020", -01400}, \
+ { { "68020", -03400}, \
+ { "c68020", -03400}, \
{ "68020", 5}, \
{ "c68020", 5}, \
{ "68881", 2}, \
{ "bitfield", 4}, \
- { "68000", -01405}, \
- { "c68000", -01405}, \
+ { "68000", -03405}, \
+ { "c68000", -03405}, \
{ "soft-float", -01102}, \
{ "nobitfield", -4}, \
{ "rtd", 8}, \
@@ -119,9 +127,10 @@
{ "sky", 0200}, \
{ "nosky", -0200}, \
{ "68020-40", 0407}, \
- { "68030", -01400}, \
+ { "68030", -03400}, \
{ "68030", 5}, \
{ "68040", 01007}, \
+ { "68060", 03007}, \
{ "68851", 0}, /* Affects *_SPEC and/or GAS. */ \
{ "no-68851", 0}, /* Affects *_SPEC and/or GAS. */ \
{ "68302", 0}, /* Affects *_SPEC and/or GAS. */ \
@@ -935,41 +944,36 @@
of a trampoline, leaving space for the variable parts. */
/* On the 68k, the trampoline looks like this:
- mov @#.,a0
- jsr @#___trampoline
- jsr @#___trampoline
- .long STATIC
- .long FUNCTION
-The reason for having three jsr insns is so that an entire line
-of the instruction cache is filled in a predictable way
-that will always be the same.
+ movl #STATIC,a0
+ jmp FUNCTION
-We always use the assembler label ___trampoline
-regardless of whether the system adds underscores. */
+ WARNING: Targets that may run on 68040+ cpus must arrange for
+ the instruction cache to be flushed. Previous incarnations of
+ the m68k trampoline code attempted to get around this by either
+ using an out-of-line transfer function or pc-relative data, but
+ the fact remains that the code to jump to the transfer function
+ or the code to load the pc-relative data needs to be flushed
+ just as much as the "variable" portion of the trampoline.
+ Recognizing that a cache flush is going to be required anyway,
+ dispense with such notions and build a smaller trampoline. */
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x207c)); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x4eb9)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (SYMBOL_REF, SImode, "*___trampoline"));\
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x4eb9)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (SYMBOL_REF, SImode, "*___trampoline"));\
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
-}
+/* Since more instructions are required to move a template into
+ place than to create it on the spot, don't use a template. */
/* Length in units of the trampoline for entering a nested function. */
-#define TRAMPOLINE_SIZE 26
+#define TRAMPOLINE_SIZE 12
+
+/* Alignment required for a trampoline in bytes. */
-/* Alignment required for a trampoline. 16 is used to find the
- beginning of a line in the instruction cache. */
+#define TRAMPOLINE_ALIGNMENT 2
-#define TRAMPOLINE_ALIGN 16
+/* Targets redefine this to invoke code to either flush the cache,
+ or enable stack execution (or both). */
+
+#ifndef FINALIZE_TRAMPOLINE
+#define FINALIZE_TRAMPOLINE(TRAMP)
+#endif
/* Emit RTL insns to initialize the variable parts of a trampoline.
FNADDR is an RTX for the address of the function's pure code.
@@ -977,14 +981,22 @@
#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
{ \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 2)), TRAMP); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 18)), CXT); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 22)), FNADDR); \
+ emit_move_insn (gen_rtx (MEM, HImode, TRAMP), GEN_INT(0x207C)); \
+ emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 2)), CXT); \
+ emit_move_insn (gen_rtx (MEM, HImode, plus_constant (TRAMP, 6)), \
+ GEN_INT(0x4EF9)); \
+ emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 8)), FNADDR); \
+ FINALIZE_TRAMPOLINE(TRAMP); \
}
+#define TRAMPOLINE_TEMPLATE(x)
+
/* This is the library routine that is used
to transfer control from the trampoline
- to the actual nested function. */
+ to the actual nested function.
+ It is defined for backward compatibility,
+ for linking with object code that used the old
+ trampoline definition. */
/* A colon is used with no explicit operands
to cause the template string to be scanned for %-constructs. */
diff -u /usr/local/src/gcc-2.7.2.2/config/m68k/m68k.md gcc/arch/m68k/m68k.md
--- /usr/local/src/gcc-2.7.2.2/config/m68k/m68k.md Wed Oct 22 10:02:52 1997
+++ gcc/arch/m68k/m68k.md Fri Mar 14 19:06:23 1997
@@ -92,6 +92,16 @@
;;- into play by defining "%$" and "%&" to expand to "s" and "d" rather
;;- than "".
+;;- Information about 68060 port.
+
+;;- The 68060 executes all 68030 and 68881/2 instructions, but some must
+;;- be emulated in software by the OS. It is faster to avoid these
+;;- instructions and issue a library call rather than trapping into
+;;- the kernel. The affected instructions are: divs.l <ea>,Dr:Dq;
+;;- divu.l <ea>,Dr:Dq; muls.l <ea>,Dr:Dq; mulu.l <ea>,Dr:Dq, fintrz;
+;;- and fscale. The TARGET_68060 flag turns the use of the opcodes
+;;- off.
+
;;- FPA port explanation:
@@ -404,32 +414,6 @@
;; compare instructions.
-(define_expand "cmpdi"
- [(parallel
- [(set (cc0)
- (compare (match_operand:DI 0 "nonimmediate_operand" "")
- (match_operand:DI 1 "general_operand" "")))
- (clobber (match_dup 2))])]
- ""
- "operands[2] = gen_reg_rtx (DImode);")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:DI 1 "nonimmediate_operand" "0,d")
- (match_operand:DI 2 "general_operand" "d,0")))
- (clobber (match_operand:DI 0 "register_operand" "=d,d"))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"sub%.l %R2,%R0\;subx%.l %2,%0\";
- else
- {
- cc_status.flags |= CC_REVERSED;
- return \"sub%.l %R1,%R0\;subx%.l %1,%0\";
- }
-}")
-
;; This is the second "hook" for PIC code (in addition to movsi). See
;; comment of movsi for a description of PIC handling.
(define_expand "cmpsi"
@@ -1662,7 +1646,7 @@
;; result of the SI tree to be in the lower register of the DI target
(define_insn "extendplussidi"
- [(set (match_operand:DI 0 "register_operand" "=d")
+ [(set (match_operand:DI 0 "register_operand" "=&d")
(sign_extend:DI (plus:SI (match_operand:SI 1 "general_operand" "%rmn")
(match_operand:SI 2 "general_operand" "rmn"))))]
""
@@ -1906,7 +1890,7 @@
(define_insn "ftruncdf2"
[(set (match_operand:DF 0 "general_operand" "=f")
(fix:DF (match_operand:DF 1 "general_operand" "fFm")))]
- "TARGET_68881 && !TARGET_68040"
+ "TARGET_68881 && !TARGET_68040 && !TARGET_68060"
"*
{
if (FP_REG_P (operands[1]))
@@ -1917,7 +1901,7 @@
(define_insn "ftruncsf2"
[(set (match_operand:SF 0 "general_operand" "=f")
(fix:SF (match_operand:SF 1 "general_operand" "dfFm")))]
- "TARGET_68881 && !TARGET_68040"
+ "TARGET_68881 && !TARGET_68040 && !TARGET_68060"
"*
{
if (FP_REG_P (operands[1]))
@@ -2939,7 +2923,7 @@
(truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
(zero_extend:DI (match_dup 2)))
(const_int 32))))])]
- "TARGET_68020"
+ "TARGET_68020 && !TARGET_68060"
"")
(define_insn ""
@@ -2950,7 +2934,7 @@
(truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
(zero_extend:DI (match_dup 2)))
(const_int 32))))]
- "TARGET_68020"
+ "TARGET_68020 && !TARGET_68060"
"mulu%.l %2,%3:%0")
; Match immediate case. For 2.4 only match things < 2^31.
@@ -2965,7 +2949,7 @@
(truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
(match_dup 2))
(const_int 32))))]
- "TARGET_68020
+ "TARGET_68020 && !TARGET_68060
&& (unsigned) INTVAL (operands[2]) <= 0x7fffffff"
"mulu%.l %2,%3:%0")
@@ -2978,7 +2962,7 @@
(truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
(sign_extend:DI (match_dup 2)))
(const_int 32))))])]
- "TARGET_68020"
+ "TARGET_68020 && !TARGET_68060"
"")
(define_insn ""
@@ -2989,7 +2973,7 @@
(truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
(sign_extend:DI (match_dup 2)))
(const_int 32))))]
- "TARGET_68020"
+ "TARGET_68020 && !TARGET_68060"
"muls%.l %2,%3:%0")
(define_insn ""
@@ -3000,7 +2984,7 @@
(truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
(match_dup 2))
(const_int 32))))]
- "TARGET_68020
+ "TARGET_68020 && !TARGET_68060
/* This test is a noop on 32 bit machines,
but important for a cross-compiler hosted on 64-bit machines. */
&& INTVAL (operands[2]) <= 0x7fffffff
@@ -3016,7 +3000,7 @@
(zero_extend:DI (match_operand:SI 2 "general_operand" "")))
(const_int 32))))
(clobber (match_dup 3))])]
- "TARGET_68020"
+ "TARGET_68020 && !TARGET_68060"
"
{
operands[3] = gen_reg_rtx (SImode);
@@ -3040,7 +3024,7 @@
(zero_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
(const_int 32))))
(clobber (match_operand:SI 1 "register_operand" "=d"))]
- "TARGET_68020"
+ "TARGET_68020 && !TARGET_68060"
"mulu%.l %3,%0:%1")
(define_insn "const_umulsi3_highpart"
@@ -3051,7 +3035,7 @@
(match_operand 3 "const_uint32_operand" ""))
(const_int 32))))
(clobber (match_operand:SI 1 "register_operand" "=d"))]
- "TARGET_68020"
+ "TARGET_68020 && !TARGET_68060"
"mulu%.l %3,%0:%1")
(define_expand "smulsi3_highpart"
@@ -3063,7 +3047,7 @@
(sign_extend:DI (match_operand:SI 2 "general_operand" "")))
(const_int 32))))
(clobber (match_dup 3))])]
- "TARGET_68020"
+ "TARGET_68020 && !TARGET_68060"
"
{
operands[3] = gen_reg_rtx (SImode);
@@ -3087,7 +3071,7 @@
(sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
(const_int 32))))
(clobber (match_operand:SI 1 "register_operand" "=d"))]
- "TARGET_68020"
+ "TARGET_68020 && !TARGET_68060"
"muls%.l %3,%0:%1")
(define_insn "const_smulsi3_highpart"
@@ -3098,7 +3082,7 @@
(match_operand 3 "const_sint32_operand" ""))
(const_int 32))))
(clobber (match_operand:SI 1 "register_operand" "=d"))]
- "TARGET_68020"
+ "TARGET_68020 && !TARGET_68060"
"muls%.l %3,%0:%1")
(define_expand "muldf3"
@@ -3155,7 +3139,7 @@
"*
{
if (GET_CODE (operands[2]) == CONST_DOUBLE
- && floating_exact_log2 (operands[2]) && !TARGET_68040)
+ && floating_exact_log2 (operands[2]) && !TARGET_68040 && !TARGET_68060)
{
int i = floating_exact_log2 (operands[2]);
operands[2] = gen_rtx (CONST_INT, VOIDmode, i);
diff -u /usr/local/src/gcc-2.7.2.2/config/m68k/netbsd.h gcc/arch/m68k/netbsd.h
--- /usr/local/src/gcc-2.7.2.2/config/m68k/netbsd.h Thu Sep 28 19:00:52 1995
+++ gcc/arch/m68k/netbsd.h Fri Oct 24 22:56:25 1997
@@ -15,9 +15,12 @@
#undef CPP_SPEC
#define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__ -D__HAVE_FPU__} %{posix:-D_POSIX_SOURCE}"
+#undef ASM_SPEC
+#define ASM_SPEC " %| %{m68030} %{m68040} %{m68060} %{fpic:-k} %{fPIC:-k -K}"
+
/* Names to predefine in the preprocessor for this target machine. */
-#define CPP_PREDEFINES "-Dunix -Dm68k -Dmc68000 -Dmc68020 -D__NetBSD__ -Asystem(unix) -Asystem(NetBSD) -Acpu(m68k) -Amachine(m68k)"
+#define CPP_PREDEFINES "-Dunix -Dm68k -Dmc68000 -Dmc68020 -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__ -Asystem(unix) -Asystem(NetBSD) -Acpu(m68k) -Amachine(m68k)"
/* Make gcc agree with <machine/ansi.h> */
@@ -53,11 +56,38 @@
#define DBX_CONTIN_CHAR '?'
-/* Don't use the `xsfoo;' construct in DBX output; this system
- doesn't support it. */
-
-#define DBX_NO_XREFS
-
/* Don't default to pcc-struct-return, because gcc is the only compiler, and
we want to retain compatibility with older gcc versions. */
#define DEFAULT_PCC_STRUCT_RETURN 0
+
+/* Finalize the trampoline by flushing the insn cache. */
+
+#undef FINALIZE_TRAMPOLINE
+#define FINALIZE_TRAMPOLINE(TRAMP) \
+ emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__cachectl"), \
+ 0, VOIDmode, 2, TRAMP, Pmode, \
+ GEN_INT(TRAMPOLINE_SIZE), SImode);
+
+#undef TRANSFER_FROM_TRAMPOLINE
+#define TRANSFER_FROM_TRAMPOLINE \
+asm ( \
+ GLOBAL_ASM_OP " ___cachectl; \
+___cachectl: \
+ movel sp@(4),a1; \
+ movel sp@(8),d1; \
+ movel #0x80000004,d0; \
+ trap #12; \
+ rts"); \
+ \
+void \
+__transfer_from_trampoline () \
+{ \
+ register char *a0 asm ("%a0"); \
+ asm (GLOBAL_ASM_OP " ___trampoline"); \
+ asm ("___trampoline:"); \
+ asm volatile ("move%.l %0,%@" : : "m" (a0[22])); \
+ asm volatile ("move%.l %1,%0" : "=a" (a0) : "m" (a0[18])); \
+ asm ("rts":); \
+}
+
+
%% end patch
%% patch arch/mips
--- gcc/arch/mips/mips.h Tue May 13 11:47:32 1997
+++ gcc.current/arch/mips/mips.h Tue May 13 09:22:53 1997
@@ -3811,3 +3811,19 @@
#define NO_BUILTIN_PTRDIFF_TYPE
#define PTRDIFF_TYPE (TARGET_LONG64 ? "long int" : "int")
#endif
+
+/* A C statement to output something to the assembler file to switch to section
+ NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
+ NULL_TREE. Some target formats do not support arbitrary sections. Do not
+ define this macro in such cases. */
+
+#define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME) \
+do { \
+ extern FILE *asm_out_text_file; \
+ if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
+ fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n", (NAME)); \
+ else if ((DECL) && TREE_READONLY (DECL)) \
+ fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME)); \
+ else \
+ fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME)); \
+} while (0)
--- gcc/arch/mips/netbsd.h Tue May 13 11:47:32 1997
+++ gcc.current/arch/mips/netbsd.h Tue May 13 09:22:55 1997
@@ -18,7 +18,10 @@
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#define DECSTATION
+/* We settle for little endian for now */
+
+#define TARGET_ENDIAN_DEFAULT 0
+
/* Look for the include files in the system-defined places. */
@@ -50,7 +53,12 @@
#undef LINK_SPEC
#define LINK_SPEC \
"%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
- %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp %{static:-Bstatic} %{assert*}"
+ %{bestGnum} %{shared} %{non_shared} \
+ %{call_shared} %{no_archive} %{exact_version} \
+ %{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} \
+ %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \
+ %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}"
/* We have atexit(3). */
@@ -65,10 +73,28 @@
#define CPP_PREDEFINES "-D__ANSI_COMPAT \
-DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__NetBSD__ -Dmips \
-D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ \
--Dunix -D_R3000 \
+-Dunix -D_R3000 -D__KPRINTF_ATTRIBUTE__ \
-Asystem(unix) -Asystem(NetBSD) -Amachine(mips)"
#endif
+#ifndef CC1_SPEC
+#define CC1_SPEC "\
+%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
+%{mips1:-mfp32 -mgp32}%{mips2:-mfp32 -mgp32}\
+%{mips3:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \
+%{mips4:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \
+%{mfp64:%{msingle-float:%emay not use both -mfp64 and -msingle-float}} \
+%{mfp64:%{m4650:%emay not use both -mfp64 and -m4650}} \
+%{m4650:-mcpu=r4650} \
+%{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \
+%{pic-none: -mno-half-pic} \
+%{pic-lib: -mhalf-pic} \
+%{pic-extern: -mhalf-pic} \
+%{pic-calls: -mhalf-pic} \
+%{save-temps: } \
+%{!mno-abicalls: -mabicalls}"
+#endif
+
/* Always uses gas. */
#ifndef ASM_SPEC
#define ASM_SPEC "\
@@ -79,7 +105,8 @@
%{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \
%{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} \
%{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \
-%{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3}"
+%{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3} \
+%{membedded-pic} %{fPIC:-KPIC}"
#endif
#ifndef CPP_SPEC
@@ -92,10 +119,14 @@
#endif
#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
-#define STARTFILE_SPEC ""
+
+#undef LIB_SPEC
+#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc /usr/lib/crtn.o%s"
+#define STARTFILE_SPEC \
+ "%{!shared:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}}"
#ifndef MACHINE_TYPE
-#define MACHINE_TYPE "NetBSD/pmax"
+#define MACHINE_TYPE "NetBSD/mips"
#endif
#define TARGET_DEFAULT MASK_GAS
@@ -103,6 +134,11 @@
#define LOCAL_LABEL_PREFIX "."
+/* -G is incompatible with -KPIC which is the default, so only allow objects
+ in the small data section if the user explicitly asks for it. */
+#undef MIPS_DEFAULT_GVALUE
+#define MIPS_DEFAULT_GVALUE 0
+
#include "mips/mips.h"
/*
@@ -123,6 +159,19 @@
#define SIZE_ASM_OP ".size"
#define WEAK_ASM_OP ".weak"
+/* This is how to equate one symbol to another symbol. The syntax used is
+ `SYM1=SYM2'. Note that this is different from the way equates are done
+ with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'. */
+
+#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
+ do { fprintf ((FILE), "\t"); \
+ assemble_name (FILE, LABEL1); \
+ fprintf (FILE, " = "); \
+ assemble_name (FILE, LABEL2); \
+ fprintf (FILE, "\n"); \
+ } while (0)
+
+
/* The following macro defines the format used to output the second
operand of the .type assembler directive. Different svr4 assemblers
expect various different forms for this operand. The one given here
@@ -150,16 +199,34 @@
function's return value. We allow for that here. */
#undef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
+#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
do { \
- fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
- putc ('\n', FILE); \
- ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
+ extern FILE *asm_out_text_file; \
+ \
+ if (TARGET_GP_OPT) \
+ { \
+ int align; \
+ STREAM = asm_out_text_file; \
+ /* Output ALIGN again to the new stream. XXX */ \
+ align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT); \
+ if (align > 0) \
+ { \
+ if (output_bytecode) \
+ BC_OUTPUT_ALIGN (STREAM, align); \
+ else \
+ ASM_OUTPUT_ALIGN (STREAM, align); \
+ } \
+ } \
+ fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \
+ assemble_name (STREAM, NAME); \
+ putc (',', STREAM); \
+ fprintf (STREAM, TYPE_OPERAND_FMT, "function"); \
+ putc ('\n', STREAM); \
+ ASM_DECLARE_RESULT (STREAM, DECL_RESULT (DECL)); \
+ HALF_PIC_DECLARE (NAME); \
} while (0)
+/* Assemble generic sections.
/* Write the extra assembler code needed to declare an object properly. */
#undef ASM_DECLARE_OBJECT_NAME
--- gcc/arch/mips/xm-netbsd.h Tue May 13 11:48:53 1997
+++ gcc.current/arch/mips/xm-netbsd.h Tue May 13 09:22:55 1997
@@ -1,299 +1,2 @@
#include <mips/xm-mips.h>
#include <xm-netbsd.h>
-/* Definitions for DECstation running BSD as target machine for GNU compiler.
- Copyright (C) 1993, 1995 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* We settle for little endian for now */
-
-#define TARGET_ENDIAN_DEFAULT 0
-
-
-/* Look for the include files in the system-defined places. */
-
-#ifndef CROSS_COMPILE
-#undef GPLUSPLUS_INCLUDE_DIR
-#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++"
-
-#undef GCC_INCLUDE_DIR
-#define GCC_INCLUDE_DIR "/usr/include"
-
-#undef INCLUDE_DEFAULTS
-#define INCLUDE_DEFAULTS \
- { \
- { GPLUSPLUS_INCLUDE_DIR, 1, 1 }, \
- { GCC_INCLUDE_DIR, 0, 0 }, \
- { 0, 0, 0 } \
- }
-
-/* Under NetBSD, the normal location of the various *crt*.o files is the
- /usr/lib directory. */
-
-#undef STANDARD_STARTFILE_PREFIX
-#define STANDARD_STARTFILE_PREFIX "/usr/lib/"
-#endif
-
-/* Provide a LINK_SPEC appropriate for NetBSD. Here we provide support
- for the special GCC options -static, -assert, and -nostdlib. */
-
-#undef LINK_SPEC
-#define LINK_SPEC \
- "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
- %{bestGnum} %{shared} %{non_shared} \
- %{call_shared} %{no_archive} %{exact_version} \
- %{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
- %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} \
- %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \
- %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}"
-
-/* We have atexit(3). */
-
-#define HAVE_ATEXIT
-
-/* Implicit library calls should use memcpy, not bcopy, etc. */
-
-#define TARGET_MEM_FUNCTIONS
-
-/* Define mips-specific netbsd predefines... */
-#ifndef CPP_PREDEFINES
-#define CPP_PREDEFINES "-D__ANSI_COMPAT \
--DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__NetBSD__ -Dmips \
--D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ \
--Dunix -D_R3000 -D__KPRINTF_ATTRIBUTE__ \
--Asystem(unix) -Asystem(NetBSD) -Amachine(mips)"
-#endif
-
-#ifndef CC1_SPEC
-#define CC1_SPEC "\
-%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
-%{mips1:-mfp32 -mgp32}%{mips2:-mfp32 -mgp32}\
-%{mips3:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \
-%{mips4:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \
-%{mfp64:%{msingle-float:%emay not use both -mfp64 and -msingle-float}} \
-%{mfp64:%{m4650:%emay not use both -mfp64 and -m4650}} \
-%{m4650:-mcpu=r4650} \
-%{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \
-%{pic-none: -mno-half-pic} \
-%{pic-lib: -mhalf-pic} \
-%{pic-extern: -mhalf-pic} \
-%{pic-calls: -mhalf-pic} \
-%{save-temps: } \
-%{!mno-abicalls: -mabicalls}"
-#endif
-
-/* Always uses gas. */
-#ifndef ASM_SPEC
-#define ASM_SPEC "\
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{v} \
-%{noasmopt:-O0} \
-%{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}} \
-%{g} %{g0} %{g1} %{g2} %{g3} \
-%{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \
-%{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} \
-%{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \
-%{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3} \
-%{membedded-pic} %{fPIC:-KPIC}"
-#endif
-
-#ifndef CPP_SPEC
-#define CPP_SPEC "\
-%{posix:-D_POSIX_SOURCE} \
-%{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
-%{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-%{mips3:-U__mips -D__mips=3 -D__mips64} \
-%{mgp32:-U__mips64} %{mgp64:-D__mips64}"
-#endif
-
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc /usr/lib/crtn.o%s"
-#define STARTFILE_SPEC \
- "%{!shared:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}}"
-
-#ifndef MACHINE_TYPE
-#define MACHINE_TYPE "NetBSD/mips"
-#endif
-
-#define TARGET_DEFAULT MASK_GAS
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#define LOCAL_LABEL_PREFIX "."
-
-/* -G is incompatible with -KPIC which is the default, so only allow objects
- in the small data section if the user explicitly asks for it. */
-#undef MIPS_DEFAULT_GVALUE
-#define MIPS_DEFAULT_GVALUE 0
-
-#include "mips/mips.h"
-
-/*
- * Some imports from svr4.h in support of shared libraries.
- * Currently, we need the DECLARE_OBJECT_SIZE stuff.
- */
-
-/* Define the strings used for the special svr4 .type and .size directives.
- These strings generally do not vary from one system running svr4 to
- another, but if a given system (e.g. m88k running svr) needs to use
- different pseudo-op names for these, they may be overridden in the
- file which includes this one. */
-
-#undef TYPE_ASM_OP
-#undef SIZE_ASM_OP
-#undef WEAK_ASM_OP
-#define TYPE_ASM_OP ".type"
-#define SIZE_ASM_OP ".size"
-#define WEAK_ASM_OP ".weak"
-
-/* This is how to equate one symbol to another symbol. The syntax used is
- `SYM1=SYM2'. Note that this is different from the way equates are done
- with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'. */
-
-#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "\t"); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, " = "); \
- assemble_name (FILE, LABEL2); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-
-/* The following macro defines the format used to output the second
- operand of the .type assembler directive. Different svr4 assemblers
- expect various different forms for this operand. The one given here
- is just a default. You may need to override it in your machine-
- specific tm.h file (depending upon the particulars of your assembler). */
-
-#undef TYPE_OPERAND_FMT
-#define TYPE_OPERAND_FMT "@%s"
-
-/* Write the extra assembler code needed to declare a function's result.
- Most svr4 assemblers don't require any special declaration of the
- result value, but there are exceptions. */
-
-#ifndef ASM_DECLARE_RESULT
-#define ASM_DECLARE_RESULT(FILE, RESULT)
-#endif
-
-/* These macros generate the special .type and .size directives which
- are used to set the corresponding fields of the linker symbol table
- entries in an ELF object file under SVR4. These macros also output
- the starting labels for the relevant functions/objects. */
-
-/* Write the extra assembler code needed to declare a function properly.
- Some svr4 assemblers need to also have something extra said about the
- function's return value. We allow for that here. */
-
-#undef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
- do { \
- extern FILE *asm_out_text_file; \
- \
- if (TARGET_GP_OPT) \
- { \
- int align; \
- STREAM = asm_out_text_file; \
- /* Output ALIGN again to the new stream. XXX */ \
- align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT); \
- if (align > 0) \
- { \
- if (output_bytecode) \
- BC_OUTPUT_ALIGN (STREAM, align); \
- else \
- ASM_OUTPUT_ALIGN (STREAM, align); \
- } \
- } \
- fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (STREAM, NAME); \
- putc (',', STREAM); \
- fprintf (STREAM, TYPE_OPERAND_FMT, "function"); \
- putc ('\n', STREAM); \
- ASM_DECLARE_RESULT (STREAM, DECL_RESULT (DECL)); \
- HALF_PIC_DECLARE (NAME); \
- } while (0)
-
-/* Assemble generic sections.
-/* Write the extra assembler code needed to declare an object properly. */
-
-#undef ASM_DECLARE_OBJECT_NAME
-#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
- do { \
- fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
- putc ('\n', FILE); \
- size_directive_output = 0; \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- ASM_OUTPUT_LABEL(FILE, NAME); \
- } while (0)
-
-/* Output the size directive for a decl in rest_of_decl_compilation
- in the case where we did not do so before the initializer.
- Once we find the error_mark_node, we know that the value of
- size_directive_output was set
- by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
-
-#undef ASM_FINISH_DECLARE_OBJECT
-#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
-do { \
- char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
- && ! AT_END && TOP_LEVEL \
- && DECL_INITIAL (DECL) == error_mark_node \
- && !size_directive_output) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, name); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- } while (0)
-
-/* This is how to declare the size of a function. */
-
-#undef ASM_DECLARE_FUNCTION_SIZE
-#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
- do { \
- if (!flag_inhibit_size_directive) \
- { \
- char label[256]; \
- static int labelno; \
- labelno++; \
- ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, (FNAME)); \
- fprintf (FILE, ","); \
- assemble_name (FILE, label); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, (FNAME)); \
- putc ('\n', FILE); \
- } \
- } while (0)
-
-/* Since gas and gld are standard on NetBSD, we don't need these */
-#undef ASM_FINAL_SPEC
-#undef STARTFILE_SPEC
%% end patch
%% patch arch
1997-05-15 04:33:59 +04:00
--- /sd0f/phil/gcc-2.7.2.2/config/netbsd.h Mon Jun 12 11:49:50 1995
+++ arch/netbsd.h Wed May 14 17:21:06 1997
@@ -35,6 +35,13 @@
#endif
+/* Provide a STARTFILE_SPEC appropriate for NetBSD. Here we provide
+ support for the special GCC option -static. */
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC \
+ "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:%{!static:crt0%O%s}%{static:scrt0%O%s}}}}"
+
/* Provide a CPP_SPEC appropriate for NetBSD. Current we just deal with
the GCC option `-posix'. */
@@ -48,18 +55,26 @@
#define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k -K}"
/* Provide a LIB_SPEC appropriate for NetBSD. Just select the appropriate
- libc, depending on whether we're doing profiling. */
+ libc, depending on whether we're doing profiling; if `-posix' is specified,
+ link against the appropriate libposix first. */
#undef LIB_SPEC
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
+#define LIB_SPEC \
+ "%{posix:%{!p:%{!pg:-lposix}}%{p:-lposix_p}%{pg:-lposix_p}} \
+ %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
/* Provide a LINK_SPEC appropriate for NetBSD. Here we provide support
for the special GCC options -static, -assert, and -nostdlib. */
#undef LINK_SPEC
#define LINK_SPEC \
- "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
+ "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}"
+/* This defines which switch letters take arguments. */
+#undef SWITCH_TAKES_ARG
+#define SWITCH_TAKES_ARG(CHAR) \
+ (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
+ || (CHAR) == 'R')
/* We have atexit(3). */
@@ -68,22 +83,28 @@
/* Implicit library calls should use memcpy, not bcopy, etc. */
#define TARGET_MEM_FUNCTIONS
+
+/* Handle #pragma weak and #pragma pack. */
+
+#define HANDLE_SYSV_PRAGMA
/*
* Some imports from svr4.h in support of shared libraries.
* Currently, we need the DECLARE_OBJECT_SIZE stuff.
*/
-/* Define the strings used for the special svr4 .type and .size directives.
- These strings generally do not vary from one system running svr4 to
- another, but if a given system (e.g. m88k running svr) needs to use
- different pseudo-op names for these, they may be overridden in the
- file which includes this one. */
+/* Define the strings used for the .type, .size, and .set directives.
+ These strings generally do not vary from one system running netbsd
+ to another, but if a given system needs to use different pseudo-op
+ names for these, they may be overridden in the file which includes
+ this one. */
#undef TYPE_ASM_OP
#undef SIZE_ASM_OP
+#undef SET_ASM_OP
#define TYPE_ASM_OP ".type"
#define SIZE_ASM_OP ".size"
+#define SET_ASM_OP ".set"
/* This is how we tell the assembler that a symbol is weak. */
%% end patch
%% patch arch/ns32k
--- gcc/arch/ns32k/netbsd.h Tue May 13 11:47:36 1997
+++ gcc.current/arch/ns32k/netbsd.h Tue May 13 09:22:56 1997
@@ -68,7 +68,7 @@
/* Names to predefine in the preprocessor for this target machine. */
#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Dns32k -Dns32000 -Dns32532 -D__NetBSD__ -Dpc532 -D__ns32k__ -Asystem(unix) -Asystem(NetBSD) -Acpu(ns32k) -Amachine(ns32k)"
+#define CPP_PREDEFINES "-Dunix -Dns32k -Dns32000 -Dns32532 -D__NetBSD__ -Dpc532 -D__ns32k__ -D__KPRINTF_ATTRIBUTE__ -Asystem(unix) -Asystem(NetBSD) -Acpu(ns32k) -Amachine(ns32k)"
/* Make gcc agree with <machine/ansi.h> */
@@ -99,11 +99,6 @@
continuation back on). */
#define DBX_CONTIN_CHAR '?'
-
-/* Don't use the `xsfoo;' construct in DBX output; this system
- doesn't support it. */
-
-#define DBX_NO_XREFS
/* Don't default to pcc-struct-return, because gcc is the only compiler, and
we want to retain compatibility with older gcc versions. */
--- gcc/arch/ns32k/ns32k.md Tue May 13 11:47:36 1997
+++ gcc.current/arch/ns32k/ns32k.md Tue May 13 09:22:57 1997
@@ -2607,32 +2607,33 @@
;; ffs instructions
-(define_insn "ffsqi2"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (ffs:QI (match_operand:SI 1 "general_operand" "g")))]
+(define_insn ""
+ [(set (match_operand:SI 0 "general_operand" "ro")
+ (minus:SI
+ (plus:SI (ffs:SI (zero_extract:SI
+ (match_operand:SI 1 "general_operand" "g")
+ (minus:SI (const_int 32) (match_dup 0))
+ (match_dup 0)))
+ (match_dup 0))
+ (const_int 1)))]
""
- "*
-{
- return \"movqb 0,%0; ffsd %1,%0; bfs 1f; addqb 1,%0; 1:\";
-}")
+ "ffsd %1,%0; bfc 1f; addqd %$-1,%0; 1:")
-(define_insn "ffshi2"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (ffs:HI (match_operand:SI 1 "general_operand" "g")))]
+(define_expand "ffssi2"
+ [(set (match_operand:SI 0 "general_operand" "=g") (const_int 0))
+ (set (match_dup 0)
+ (minus:SI
+ (plus:SI (ffs:SI (zero_extract:SI
+ (match_operand:SI 1 "general_operand" "g")
+ (minus:SI (const_int 32) (match_dup 0))
+ (match_dup 0)))
+ (match_dup 0))
+ (const_int 1)))
+ (set (match_dup 0)
+ (plus:SI (match_dup 0)
+ (const_int 1)))]
""
- "*
-{
- return \"movqw 0,%0; ffsd %1,%0; bfs 1f; addqw 1,%0; 1:\";
-}")
-
-(define_insn "ffssi2"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (ffs:SI (match_operand:SI 1 "general_operand" "g")))]
- ""
- "*
-{
- return \"movqd 0,%0; ffsd %1,%0; bfs 1f; addqd 1,%0; 1:\";
-}")
+ "operands[1] = make_safe_from(operands[1], operands[0]);")
;; Speed up stack adjust followed by a HI fixedpoint push.
%% end patch
%% patch arch/sparc
--- gcc/arch/sparc/netbsd.h Tue May 13 11:47:41 1997
+++ gcc.current/arch/sparc/netbsd.h Tue May 13 09:22:44 1997
@@ -7,7 +7,7 @@
/* Names to predefine in the preprocessor for this target machine. */
#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Dsparc -D__NetBSD__ -Asystem(unix) -Asystem(NetBSD) -Acpu(sparc) -Amachine(sparc)"
+#define CPP_PREDEFINES "-Dunix -Dsparc -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__ -Asystem(unix) -Asystem(NetBSD) -Acpu(sparc) -Amachine(sparc)"
/* Make gcc agree with <machine/ansi.h> */
@@ -34,11 +34,6 @@
continuation back on). */
#define DBX_CONTIN_CHAR '?'
-
-/* Don't use the `xsfoo;' construct in DBX output; this system
- doesn't support it. */
-
-#define DBX_NO_XREFS
/* Don't default to pcc-struct-return, because gcc is the only compiler, and
we want to retain compatibility with older gcc versions. */
%% end patch
%% patch arch/vax
--- gcc/arch/vax/netbsd.h Tue May 13 11:47:44 1997
+++ gcc.current/arch/vax/netbsd.h Tue May 13 09:22:42 1997
@@ -2,7 +2,7 @@
#include <netbsd.h>
#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Dvax -D__NetBSD__ -Asystem(unix) -Asystem(NetBSD) -Acpu(vax) -Amachine(vax)"
+#define CPP_PREDEFINES "-Dunix -Dvax -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__ -Asystem(unix) -Asystem(NetBSD) -Acpu(vax) -Amachine(vax)"
/* Make gcc agree with <machine/ansi.h> */
--- gcc/arch/vax/vax.md Tue May 13 11:47:44 1997
+++ gcc.current/arch/vax/vax.md Tue May 13 09:22:43 1997
@@ -1298,7 +1298,7 @@
(rotatert:SI (match_operand:SI 1 "general_operand" "g")
(match_operand:QI 2 "const_int_operand" "n")))]
""
- "rotl $%R2,%1,%0")
+ "rotl %R2,%1,%0")
(define_insn ""
[(set (match_operand:SI 0 "general_operand" "=g")
%% end patch
%% patch cc
--- gcc/cc/gcc.1 Tue May 13 11:47:47 1997
+++ gcc.current/cc/gcc.1 Tue May 13 09:23:11 1997
@@ -683,7 +683,7 @@
.B $\c
\&\|' as part of identifiers.
.Sp
-The alternate keywords \c
+The alternative keywords \c
.B _\|_asm_\|_\c
\&, \c
.B _\|_extension_\|_\c
@@ -698,7 +698,7 @@
course, but it is useful to put them in header files that might be included
in compilations done with `\|\c
.B \-ansi\c
-\&\|'. Alternate predefined macros
+\&\|'. Alternative predefined macros
such as \c
.B _\|_unix_\|_\c
\& and \c
@@ -1622,7 +1622,7 @@
`\|\c
.B \-pedantic\c
\&\|' does not cause warning messages for use of the
-alternate keywords whose names begin and end with `\|\c
+alternative keywords whose names begin and end with `\|\c
.B _\|_\c
\&\|'. Pedantic
warnings are also disabled in the expression that follows
@@ -4064,7 +4064,7 @@
comes from the environment variable
.B TMPDIR
(default
-.B /usr/tmp
+.B /var/tmp
if available, else
.B /tmp\c
\&).
--- gcc/cc/gcc.c Tue May 13 11:47:47 1997
+++ gcc.current/cc/gcc.c Tue May 13 09:23:11 1997
@@ -548,12 +548,14 @@
/* This defines which switch letters take arguments. */
-#ifndef SWITCH_TAKES_ARG
-#define SWITCH_TAKES_ARG(CHAR) \
+#define DEFAULT_SWITCH_TAKES_ARG(CHAR) \
((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
|| (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
|| (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \
|| (CHAR) == 'L' || (CHAR) == 'A')
+
+#ifndef SWITCH_TAKES_ARG
+#define SWITCH_TAKES_ARG(CHAR) DEFAULT_SWITCH_TAKES_ARG(CHAR)
#endif
/* This defines which multi-letter switches take arguments. */
%% end patch
%% patch common
--- gcc/common/c-common.c Tue May 13 11:48:05 1997
+++ gcc.current/common/c-common.c Tue May 13 09:23:30 1997
@@ -38,6 +38,14 @@
int, int, int));
static void init_attributes PROTO((void));
+/* Format kinds */
+#define F_USER 0x1 /* Format used in user-land printf/scanf */
+#define F_KERN 0x2 /* Format used in kprintf/scanf etc. */
+#define F_SCAN 0x80000000 /* Format is scan* instead of print* */
+
+#define FORMAT_IS_SCAN(p) (((p)->format_kind & F_SCAN) == F_SCAN)
+#define FORMAT_CONTEXT(p) (((p)->format_kind & (F_USER|F_KERN)))
+
/* Make bindings for __FUNCTION__ and __PRETTY_FUNCTION__. */
void
@@ -535,7 +543,7 @@
= TREE_VALUE (TREE_CHAIN (TREE_CHAIN (args)));
int format_num;
int first_arg_num;
- int is_scan;
+ int format_kind;
tree argument;
int arg_num;
@@ -550,15 +558,21 @@
&& (!strcmp (IDENTIFIER_POINTER (format_type), "printf")
|| !strcmp (IDENTIFIER_POINTER (format_type),
"__printf__")))
- is_scan = 0;
+ format_kind = F_USER;
+ else if (TREE_CODE (format_type) == IDENTIFIER_NODE
+ && (!strcmp (IDENTIFIER_POINTER (format_type), "kprintf")
+ || !strcmp (IDENTIFIER_POINTER (format_type),
+ "__kprintf__")))
+ format_kind = F_KERN;
else if (TREE_CODE (format_type) == IDENTIFIER_NODE
&& (!strcmp (IDENTIFIER_POINTER (format_type), "scanf")
|| !strcmp (IDENTIFIER_POINTER (format_type),
"__scanf__")))
- is_scan = 1;
+ format_kind = F_USER|F_SCAN;
else
{
- error ("unrecognized format specifier for `%s'");
+ error_with_decl (decl,
+ "unrecognized format specifier for `%s'");
continue;
}
@@ -625,7 +639,7 @@
record_function_format (DECL_NAME (decl),
DECL_ASSEMBLER_NAME (decl),
- is_scan, format_num, first_arg_num);
+ format_kind, format_num, first_arg_num);
break;
}
@@ -674,8 +688,10 @@
#define T_W &wchar_type_node
#define T_ST &sizetype
+
typedef struct {
char *format_chars;
+ int format_kind;
int pointer_count;
/* Type of argument if no length modifier is used. */
tree *nolen;
@@ -696,32 +712,38 @@
} format_char_info;
static format_char_info print_char_table[] = {
- { "di", 0, T_I, T_I, T_L, T_LL, T_LL, "-wp0 +" },
- { "oxX", 0, T_UI, T_UI, T_UL, T_ULL, T_ULL, "-wp0#" },
- { "u", 0, T_UI, T_UI, T_UL, T_ULL, T_ULL, "-wp0" },
+ { "di", F_USER|F_KERN, 0, T_I, T_I, T_L, T_LL, T_LL, "-wp0 +" },
+ { "oxX", F_USER|F_KERN, 0, T_UI,T_UI, T_UL, T_ULL, T_ULL, "-wp0#" },
+ { "u", F_USER|F_KERN, 0, T_UI,T_UI, T_UL, T_ULL, T_ULL, "-wp0" },
/* Two GNU extensions. */
- { "Z", 0, T_ST, NULL, NULL, NULL, NULL, "-wp0" },
- { "m", 0, T_V, NULL, NULL, NULL, NULL, "-wp" },
- { "feEgG", 0, T_D, NULL, NULL, NULL, T_LD, "-wp0 +#" },
- { "c", 0, T_I, NULL, T_W, NULL, NULL, "-w" },
- { "C", 0, T_W, NULL, NULL, NULL, NULL, "-w" },
- { "s", 1, T_C, NULL, T_W, NULL, NULL, "-wp" },
- { "S", 1, T_W, NULL, NULL, NULL, NULL, "-wp" },
- { "p", 1, T_V, NULL, NULL, NULL, NULL, "-w" },
- { "n", 1, T_I, T_S, T_L, T_LL, NULL, "" },
+ { "Z", F_USER, 0, T_ST,NULL, NULL, NULL, NULL, "-wp0" },
+ { "m", F_USER, 0, T_V, NULL, NULL, NULL, NULL, "-wp" },
+ { "feEgG", F_USER, 0, T_D, NULL, NULL, NULL, T_LD, "-wp0 +#" },
+ { "c", F_USER|F_KERN, 0, T_I, NULL, T_W, NULL, NULL, "-w" },
+ { "C", F_USER, 0, T_W, NULL, NULL, NULL, NULL, "-w" },
+ { "s", F_USER|F_KERN, 1, T_C, NULL, T_W, NULL, NULL, "-wp" },
+ { "S", F_USER, 1, T_W, NULL, NULL, NULL, NULL, "-wp" },
+ { "p", F_USER|F_KERN, 1, T_V, NULL, NULL, NULL, NULL, "-w" },
+ { "n", F_USER, 1, T_I, T_S, T_L, T_LL, NULL, "" },
+/* Kernel bitmap formatting */
+ { "b", F_KERN, 1, T_C, NULL, NULL, NULL, NULL, "" },
+/* Kernel recursive format */
+ { ":", F_KERN, 1, T_V, NULL, NULL, NULL, NULL, "" },
+/* Kernel debugger auto-radix printing */
+ { "nrz", F_KERN, 0, T_I, T_I, T_L, T_LL, T_LL, "-wp0# +" },
{ NULL }
};
static format_char_info scan_char_table[] = {
- { "di", 1, T_I, T_S, T_L, T_LL, T_LL, "*" },
- { "ouxX", 1, T_UI, T_US, T_UL, T_ULL, T_ULL, "*" },
- { "efgEG", 1, T_F, NULL, T_D, NULL, T_LD, "*" },
- { "sc", 1, T_C, NULL, T_W, NULL, NULL, "*a" },
- { "[", 1, T_C, NULL, NULL, NULL, NULL, "*a" },
- { "C", 1, T_W, NULL, NULL, NULL, NULL, "*" },
- { "S", 1, T_W, NULL, NULL, NULL, NULL, "*" },
- { "p", 2, T_V, NULL, NULL, NULL, NULL, "*" },
- { "n", 1, T_I, T_S, T_L, T_LL, NULL, "" },
+ { "di", F_SCAN|F_USER, 1, T_I, T_S, T_L, T_LL, T_LL, "*" },
+ { "ouxX", F_SCAN|F_USER, 1, T_UI,T_US, T_UL, T_ULL, T_ULL, "*" },
+ { "efgEG", F_SCAN|F_USER, 1, T_F, NULL, T_D, NULL, T_LD, "*" },
+ { "sc", F_SCAN|F_USER, 1, T_C, NULL, T_W, NULL, NULL, "*a" },
+ { "[", F_SCAN|F_USER, 1, T_C, NULL, NULL, NULL, NULL, "*a" },
+ { "C", F_SCAN|F_USER, 1, T_W, NULL, NULL, NULL, NULL, "*" },
+ { "S", F_SCAN|F_USER, 1, T_W, NULL, NULL, NULL, NULL, "*" },
+ { "p", F_SCAN|F_USER, 2, T_V, NULL, NULL, NULL, NULL, "*" },
+ { "n", F_SCAN|F_USER, 1, T_I, T_S, T_L, T_LL, NULL, "" },
{ NULL }
};
@@ -729,7 +751,7 @@
struct function_format_info *next; /* next structure on the list */
tree name; /* identifier such as "printf" */
tree assembler_name; /* optional mangled identifier (for C++) */
- int is_scan; /* TRUE if *scanf */
+ int format_kind; /* user/kernel/print/scan */
int format_num; /* number of format argument */
int first_arg_num; /* number of first arg (zero for varargs) */
} function_format_info;
@@ -748,32 +770,32 @@
void
init_function_format_info ()
{
- record_function_format (get_identifier ("printf"), NULL_TREE, 0, 1, 2);
- record_function_format (get_identifier ("fprintf"), NULL_TREE, 0, 2, 3);
- record_function_format (get_identifier ("sprintf"), NULL_TREE, 0, 2, 3);
- record_function_format (get_identifier ("scanf"), NULL_TREE, 1, 1, 2);
- record_function_format (get_identifier ("fscanf"), NULL_TREE, 1, 2, 3);
- record_function_format (get_identifier ("sscanf"), NULL_TREE, 1, 2, 3);
- record_function_format (get_identifier ("vprintf"), NULL_TREE, 0, 1, 0);
- record_function_format (get_identifier ("vfprintf"), NULL_TREE, 0, 2, 0);
- record_function_format (get_identifier ("vsprintf"), NULL_TREE, 0, 2, 0);
+ record_function_format (get_identifier ("printf"), NULL_TREE, F_USER, 1, 2);
+ record_function_format (get_identifier ("fprintf"), NULL_TREE, F_USER, 2, 3);
+ record_function_format (get_identifier ("sprintf"), NULL_TREE, F_USER, 2, 3);
+ record_function_format (get_identifier ("scanf"), NULL_TREE, F_SCAN|F_USER, 1, 2);
+ record_function_format (get_identifier ("fscanf"), NULL_TREE, F_SCAN|F_USER, 2, 3);
+ record_function_format (get_identifier ("sscanf"), NULL_TREE, F_SCAN|F_USER, 2, 3);
+ record_function_format (get_identifier ("vprintf"), NULL_TREE, F_USER, 1, 0);
+ record_function_format (get_identifier ("vfprintf"), NULL_TREE, F_USER, 2, 0);
+ record_function_format (get_identifier ("vsprintf"), NULL_TREE, F_USER, 2, 0);
}
/* Record information for argument format checking. FUNCTION_IDENT is
the identifier node for the name of the function to check (its decl
- need not exist yet). IS_SCAN is true for scanf-type format checking;
- false indicates printf-style format checking. FORMAT_NUM is the number
- of the argument which is the format control string (starting from 1).
- FIRST_ARG_NUM is the number of the first actual argument to check
- against teh format string, or zero if no checking is not be done
- (e.g. for varargs such as vfprintf). */
+ need not exist yet). FORMAT_KIND specifies if the it is a user or
+ kernel printing function or a user scanning function. FORMAT_NUM
+ is the number of the argument which is the format control string
+ (starting from 1). FIRST_ARG_NUM is the number of the first
+ actual argument to check against the format string, or zero if
+ no checking is not be done (e.g. for varargs such as vfprintf). */
void
-record_function_format (name, assembler_name, is_scan,
+record_function_format (name, assembler_name, format_kind,
format_num, first_arg_num)
tree name;
tree assembler_name;
- int is_scan;
+ int format_kind;
int format_num;
int first_arg_num;
{
@@ -796,7 +818,7 @@
info->assembler_name = assembler_name;
}
- info->is_scan = is_scan;
+ info->format_kind = format_kind;
info->format_num = format_num;
info->first_arg_num = first_arg_num;
}
@@ -928,7 +950,7 @@
}
flag_chars[0] = 0;
suppressed = wide = precise = FALSE;
- if (info->is_scan)
+ if (FORMAT_IS_SCAN(info))
{
suppressed = *format_chars == '*';
if (suppressed)
@@ -1021,6 +1043,82 @@
}
}
}
+ else if ((FORMAT_CONTEXT(info) & F_KERN) != 0)
+ {
+ switch (*format_chars)
+ {
+ case 'b':
+ if (params == 0)
+ {
+ warning (tfaff);
+ return;
+ }
+ if (info->first_arg_num != 0)
+ {
+ cur_param = TREE_VALUE (params);
+ cur_type = TREE_TYPE (cur_param);
+ params = TREE_CHAIN (params);
+ ++arg_num;
+ /*
+ * `%b' takes two arguments:
+ * an integer type (the bits), type-checked here
+ * a string (the bit names), checked for in mainstream
+ * code below (see `%b' entry in print_char_table[])
+ */
+
+ if (TREE_CODE (TYPE_MAIN_VARIANT (cur_type)) != INTEGER_TYPE)
+ {
+ sprintf (message,
+ "bitfield is not an integer type (arg %d)",
+ arg_num);
+ warning (message);
+ }
+ }
+ break;
+
+ case ':':
+ if (params == 0)
+ {
+ warning (tfaff);
+ return;
+ }
+ if (info->first_arg_num != 0)
+ {
+ cur_param = TREE_VALUE (params);
+ cur_type = TREE_TYPE (cur_param);
+ params = TREE_CHAIN (params);
+ ++arg_num;
+ /*
+ * `%r' takes two arguments:
+ * a string (the recursive format), type-checked here
+ * a pointer (va_list of format arguments), checked for
+ * in mainstream code below (see `%r' entry in
+ * print_char_table[])
+ */
+ if (TREE_CODE (cur_type) == POINTER_TYPE)
+ {
+ cur_type = TREE_TYPE (cur_type);
+ if (TYPE_MAIN_VARIANT (cur_type) == char_type_node)
+ {
+ break;
+ }
+ }
+ sprintf (message,
+ "format argument is not a string (arg %d)",
+ arg_num);
+ warning (message);
+ }
+ break;
+
+ default:
+ while (isdigit (*format_chars))
+ {
+ wide = TRUE;
+ ++format_chars;
+ }
+ break;
+ }
+ }
else
{
while (isdigit (*format_chars))
@@ -1067,13 +1165,23 @@
}
}
}
- if (*format_chars == 'h' || *format_chars == 'l' || *format_chars == 'q' ||
- *format_chars == 'L')
+ if (*format_chars == 'h' || *format_chars == 'l')
length_char = *format_chars++;
+ else if (*format_chars == 'q' || *format_chars == 'L')
+ {
+ length_char = *format_chars++;
+ if (pedantic)
+ pedwarn ("ANSI C does not support the `%c' length modifier",
+ length_char);
+ }
else
length_char = 0;
if (length_char == 'l' && *format_chars == 'l')
- length_char = 'q', format_chars++;
+ {
+ length_char = 'q', format_chars++;
+ if (pedantic)
+ pedwarn ("ANSI C does not support the `ll' length modifier");
+ }
aflag = 0;
if (*format_chars == 'a')
{
@@ -1094,9 +1202,10 @@
continue;
}
format_chars++;
- fci = info->is_scan ? scan_char_table : print_char_table;
+ fci = FORMAT_IS_SCAN(info) ? scan_char_table : print_char_table;
while (fci->format_chars != 0
- && index (fci->format_chars, format_char) == 0)
+ && ((FORMAT_CONTEXT(fci) & FORMAT_CONTEXT(info)) == 0
+ || index (fci->format_chars, format_char) == 0))
++fci;
if (fci->format_chars == 0)
{
@@ -1129,7 +1238,7 @@
format_char);
warning (message);
}
- if (info->is_scan && format_char == '[')
+ if (FORMAT_IS_SCAN(info) && format_char == '[')
{
/* Skip over scan set, in case it happens to have '%' in it. */
if (*format_chars == '^')
--- gcc/common/expmed.c Tue May 13 11:48:15 1997
+++ gcc.current/common/expmed.c Tue May 13 09:23:41 1997
@@ -188,6 +188,9 @@
if (GET_CODE (x) == CONST_INT)
{
HOST_WIDE_INT val = - INTVAL (x);
+ if (GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT
+ && INTVAL (x) < 0 && val < 0)
+ return expand_unop (mode, neg_optab, x, NULL_RTX, 0);
if (GET_MODE_BITSIZE (mode) < HOST_BITS_PER_WIDE_INT)
{
/* Sign extend the value from the bits that are significant. */
--- gcc/common/stupid.c Tue May 13 11:48:31 1997
+++ gcc.current/common/stupid.c Tue May 13 09:23:59 1997
@@ -450,13 +450,13 @@
/* The following line is for unused outputs;
they do get stored even though never used again. */
- MARK_LIVE_AFTER (insn, regno);
+ MARK_LIVE_AFTER (insn, regno+j);
/* When a hard reg is clobbered, mark it in use
just before this insn, so it is live all through. */
if (code == CLOBBER && INSN_SUID (insn) > 0)
SET_HARD_REG_BIT (after_insn_hard_regs[INSN_SUID (insn) - 1],
- regno);
+ regno+j);
}
}
/* For pseudo regs, record where born, where dead, number of
%% end patch
%% patch g++
--- gcc/g++/g++.1 Tue May 13 11:48:47 1997
+++ gcc.current/g++/g++.1 Tue May 13 09:23:01 1997
@@ -619,7 +619,7 @@
comes from the environment variable
.B TMPDIR
(default
-.B /usr/tmp
+.B /var/tmp
if available, else
.B /tmp\c
\&).
--- gcc/g++/g++.c Tue May 13 11:48:47 1997
+++ gcc.current/g++/g++.c Tue May 13 09:23:01 1997
@@ -422,7 +422,7 @@
is. If they ran us as /usr/local/bin/g++, then we will look
for /usr/local/bin/gcc; similarly, if they just ran us as `g++',
we'll just look for `gcc'. */
- if (p != argv[0])
+ if (p != argv[0] && *gcc != '/')
{
*--p = '\0';
gcc = (char *) malloc ((strlen (argv[0]) + 1 + strlen (GCC_NAME) + 1)
%% end patch