summaryrefslogtreecommitdiff
path: root/cross/i386-netbsdpe/patches
diff options
context:
space:
mode:
authorminoura <minoura>2001-01-30 03:08:56 +0000
committerminoura <minoura>2001-01-30 03:08:56 +0000
commit16276a8fcd8122d8a6554ee46e4e8c4eb479f65a (patch)
treed6073b065630f5db10015d370a9c3cee681396c3 /cross/i386-netbsdpe/patches
parentd30c4b3cace93a9a4884939f02b212399c605666 (diff)
downloadpkgsrc-16276a8fcd8122d8a6554ee46e4e8c4eb479f65a.tar.gz
Updated to gcc-2.95.2, from PEACE repository.
http://cvs.kshosen.ac.jp/cvsweb.cgi/peace/pkgsrc/cross/i386-netbsdpe/
Diffstat (limited to 'cross/i386-netbsdpe/patches')
-rw-r--r--cross/i386-netbsdpe/patches/patch-aa763
-rw-r--r--cross/i386-netbsdpe/patches/patch-ae13
-rw-r--r--cross/i386-netbsdpe/patches/patch-af23
-rw-r--r--cross/i386-netbsdpe/patches/patch-co78
-rw-r--r--cross/i386-netbsdpe/patches/patch-cp44
-rw-r--r--cross/i386-netbsdpe/patches/patch-cq44
-rw-r--r--cross/i386-netbsdpe/patches/patch-ma14
-rw-r--r--cross/i386-netbsdpe/patches/patch-pe (renamed from cross/i386-netbsdpe/patches/patch-ag)170
8 files changed, 1070 insertions, 79 deletions
diff --git a/cross/i386-netbsdpe/patches/patch-aa b/cross/i386-netbsdpe/patches/patch-aa
new file mode 100644
index 00000000000..11dfa8ac410
--- /dev/null
+++ b/cross/i386-netbsdpe/patches/patch-aa
@@ -0,0 +1,763 @@
+$NetBSD: patch-aa,v 1.1 2001/01/30 03:08:59 minoura Exp $
+
+diff -urN gcc-2.95.2/gcc/collect2.c gcc-patched/gcc/collect2.c
+--- gcc/collect2.c Wed Oct 13 06:16:52 1999
++++ gcc/collect2.c Thu Dec 14 20:00:19 2000
+@@ -53,7 +53,6 @@
+ #define obstack_chunk_alloc xmalloc
+ #define obstack_chunk_free free
+
+-extern char *make_temp_file PROTO ((char *));
+
+ /* On certain systems, we have code that works by scanning the object file
+ directly. But this code uses system-specific header files and library
+diff -urN gcc-2.95.2/gcc/config/elfos.h gcc-patched/gcc/config/elfos.h
+--- gcc/config/elfos.h Fri Mar 26 19:45:26 1999
++++ gcc/config/elfos.h Thu Dec 14 20:00:19 2000
+@@ -48,6 +48,7 @@
+
+ /* Output #ident as a .ident. */
+
++#undef ASM_OUTPUT_IDENT
+ #define ASM_OUTPUT_IDENT(FILE, NAME) \
+ fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME);
+
+@@ -92,6 +93,10 @@
+ #undef SET_ASM_OP
+ #define SET_ASM_OP ".set"
+
++/* We want local labels to start with period if made with asm_fprintf. */
++#undef LOCAL_LABEL_PREFIX
++#define LOCAL_LABEL_PREFIX "."
++
+ /* This is how to begin an assembly language file. Most svr4 assemblers want
+ at least a .file directive to come first, and some want to see a .version
+ directive come right after that. Here we just establish a default
+@@ -130,7 +135,7 @@
+ #undef ASM_OUTPUT_INTERNAL_LABEL
+ #define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \
+ do { \
+- fprintf (FILE, ".%s%d:\n", PREFIX, NUM); \
++ fprintf (FILE, "%s%s%d:\n", LOCAL_LABEL_PREFIX, PREFIX, NUM); \
+ } while (0)
+
+ /* This is how to store into the string LABEL
+@@ -144,7 +149,7 @@
+ #undef ASM_GENERATE_INTERNAL_LABEL
+ #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
+ do { \
+- sprintf (LABEL, "*.%s%d", PREFIX, NUM); \
++ sprintf (LABEL, "*%s%s%d", LOCAL_LABEL_PREFIX, PREFIX, NUM); \
+ } while (0)
+
+ /* Output the label which precedes a jumptable. Note that for all svr4
+@@ -461,6 +466,7 @@
+
+ /* This is how we tell the assembler that a symbol is weak. */
+
++#undef ASM_WEAKEN_LABEL
+ #define ASM_WEAKEN_LABEL(FILE,NAME) \
+ do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
+ fputc ('\n', FILE); } while (0)
+diff -urN gcc-2.95.2/gcc/config/i386/netbsd-elf.h gcc-patched/gcc/config/i386/netbsd-elf.h
+--- gcc/config/i386/netbsd-elf.h Thu Jan 1 09:00:00 1970
++++ gcc/config/i386/netbsd-elf.h Thu Dec 14 20:00:18 2000
+@@ -0,0 +1,161 @@
++/* Definitions of target machine for GNU compiler,
++ for i386 NetBSD systems.
++ Copyright (C) 1998 Free Software Foundation, Inc.
++
++This file is part of GNU CC.
++
++GNU CC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2, or (at your option)
++any later version.
++
++GNU CC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with GNU CC; see the file COPYING. If not, write to
++the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
++
++/* This is used on i386 platforms that use the ELF format.
++ This was taken from the NetBSD/alpha configuration, and modified
++ for NetBSD/i386 by Christos Zoulas <christos@netbsd.org> */
++
++/* Get generic i386 definitions. */
++
++/* This goes away when the math-emulator is fixed */
++#define TARGET_CPU_DEFAULT 0400 /* TARGET_NO_FANCY_MATH_387 */
++
++#include <i386/gstabs.h>
++
++/* Get perform_* macros to build libgcc.a. */
++#include <i386/perform.h>
++
++/* Get generic NetBSD ELF definitions. We will override these if necessary. */
++
++#define NETBSD_ELF
++#include <netbsd.h>
++
++#undef ASM_FINAL_SPEC
++
++/* Names to predefine in the preprocessor for this target machine. */
++
++#undef CPP_PREDEFINES
++#define CPP_PREDEFINES "\
++-Dunix -Di386 -D__NetBSD__ -D__ELF__ \
++-Asystem(unix) -Asystem(NetBSD) -Acpu(i386) -Amachine(i386)"
++
++/* Make gcc agree with <machine/ansi.h> */
++
++#undef SIZE_TYPE
++#define SIZE_TYPE "unsigned int"
++
++#undef PTRDIFF_TYPE
++#define PTRDIFF_TYPE "int"
++
++#undef WCHAR_TYPE
++#define WCHAR_TYPE "int"
++
++#undef WCHAR_UNSIGNED
++#define WCHAR_UNSIGNED 0
++
++#undef WCHAR_TYPE_SIZE
++#define WCHAR_TYPE_SIZE 32
++
++/* Output assembler code to FILE to increment profiler label # LABELNO
++ for profiling a function entry. Under NetBSD/i386, the assembler does
++ nothing special with -pg. */
++
++#undef ASM_APP_ON
++#define ASM_APP_ON "#APP\n"
++
++#undef ASM_APP_OFF
++#define ASM_APP_OFF "#NO_APP\n"
++
++#define bsd4_4
++#undef HAS_INIT_SECTION
++
++/* Provide a LINK_SPEC appropriate for a NetBSD/alpha ELF target. Only
++ the linker emulation is i386-specific. The rest are
++ common to all ELF targets, except for the name of the start function. */
++
++#undef LINK_SPEC
++#define LINK_SPEC \
++ "-m elf_i386 \
++ %{assert*} %{R*} \
++ %{shared:-shared} \
++ %{!shared: \
++ -dc -dp \
++ %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
++ %{!static: \
++ %{rdynamic:-export-dynamic} \
++ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
++ %{static:-static}}"
++
++#undef DEFAULT_VTABLE_THUNKS
++#define DEFAULT_VTABLE_THUNKS 1
++
++#undef ASM_OUTPUT_ALIGN
++#define ASM_OUTPUT_ALIGN(FILE,LOG) \
++ if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1 << (LOG))
++
++/* This is how we tell the assembler that two symbols have the same value. */
++
++#define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
++ do { assemble_name(FILE, NAME1); \
++ fputs(" = ", FILE); \
++ assemble_name(FILE, NAME2); \
++ fputc('\n', FILE); } while (0)
++
++/*
++ * We always use gas here, so we don't worry about ECOFF assembler problems.
++ */
++#undef TARGET_GAS
++#define TARGET_GAS (1)
++
++/* The following macros are stolen from i386v4.h */
++/* These have to be defined to get PIC code correct */
++
++/* This is how to output an element of a case-vector that is relative.
++ This is only used for PIC code. See comments by the `casesi' insn in
++ i386.md for an explanation of the expression this outputs. */
++
++#undef ASM_OUTPUT_ADDR_DIFF_ELT
++#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
++ fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
++
++/* Indicate that jump tables go in the text section. This is
++ necessary when compiling PIC code. */
++
++#define JUMP_TABLES_IN_TEXT_SECTION 1
++
++/* Default to pcc-struct-return, because this is the ELF abi and
++ we don't care about compatibility with older gcc versions. */
++#define DEFAULT_PCC_STRUCT_RETURN 1
++
++/* Profiling routines, partially copied from i386/osfrose.h. */
++
++/* Redefine this to use %eax instead of %edx. */
++#undef FUNCTION_PROFILER
++#define FUNCTION_PROFILER(FILE, LABELNO) \
++{ \
++ if (flag_pic) \
++ { \
++ fprintf (FILE, "\tcall __mcount@PLT\n"); \
++ } \
++ else \
++ { \
++ fprintf (FILE, "\tcall __mcount\n"); \
++ } \
++}
++
++/* Put relocations in the constant pool in the writable data section. */
++#undef SELECT_RTX_SECTION
++#define SELECT_RTX_SECTION(MODE,RTX) \
++{ \
++ if (flag_pic && symbolic_operand (RTX)) \
++ data_section (); \
++ else \
++ readonly_data_section (); \
++}
+diff -urN gcc-2.95.2/gcc/config/i386/xm-netbsd.h gcc-patched/gcc/config/i386/xm-netbsd.h
+--- gcc/config/i386/xm-netbsd.h Thu Jan 1 09:00:00 1970
++++ gcc/config/i386/xm-netbsd.h Thu Dec 14 20:00:18 2000
+@@ -0,0 +1,23 @@
++/* Configuration file for i386 hosts running NetBSD.
++ Copyright (C) 1999 Free Software Foundation, Inc.
++
++This file is part of GNU CC.
++
++GNU CC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2, or (at your option)
++any later version.
++
++GNU CC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with GNU CC; see the file COPYING. If not, write to
++the Free Software Foundation, 59 Temple Place - Suite 330,
++Boston, MA 02111-1307, USA. */
++
++#include <xm-netbsd.h>
++#include <i386/xm-i386.h>
++
+diff -urN gcc-2.95.2/gcc/config/netbsd.h gcc-patched/gcc/config/netbsd.h
+--- gcc/config/netbsd.h Thu Dec 17 05:59:58 1998
++++ gcc/config/netbsd.h Thu Dec 14 20:00:19 2000
+@@ -48,17 +48,31 @@
+ #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}"
++
++/* #ifdef NETBSD_AOUT */
++
++/* Provide a STARTFILE_SPEC appropriate for NetBSD a.out. 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}}}} %{shared:c++rt0%O%s}"
+
+ /* 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 %{R*} %{static:-Bstatic} %{assert*}"
++ "%{nostdlib:-nostdlib} %{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic}} %{shared:-Bshareable} %{R*} %{assert*}"
++
++/* #endif NETBSD_AOUT */
+
+ /* This defines which switch letters take arguments. */
+ #undef SWITCH_TAKES_ARG
+@@ -127,6 +141,9 @@
+ entries in an ELF object file under SVR4. These macros also output
+ the starting labels for the relevant functions/objects. */
+
++/* XXX. This is WRONG for alpha. Needs to be verified on other ELF ports. */
++#ifndef NETBSD_ELF
++
+ /* 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. */
+@@ -207,3 +224,54 @@
+ putc ('\n', FILE); \
+ } \
+ } while (0)
++
++#endif /* ! NETBSD_ELF */
++
++/* NetBSD ELF support begins here. */
++
++#ifdef NETBSD_ELF
++
++/* Start with generic ELF definitions. */
++#include "elfos.h"
++
++#undef DWARF_DEBUGGING_INFO /* XXX */
++#undef DWARF2_DEBUGGING_INFO /* XXX */
++
++/* Provide a STARTFILE_SPEC appropriate for NetBSD ELF targets. Here we
++ provide support for the special GCC option -static. On ELF targets,
++ we also add the crtbegin.o file which provides part of the support
++ for getting C++ file-scope static objects constructed before entering
++ `main'. */
++
++#undef STARTFILE_SPEC
++#define STARTFILE_SPEC \
++ "%{!shared: \
++ %{pg:gcrt0%O%s} \
++ %{!pg: \
++ %{p:gcrt0%O%s} \
++ %{!p:crt0%O%s}}} \
++ %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}"
++
++/* Provide an ENDFILE_SPEC appropriate for NetBSD ELF targets. Here we
++ add crtend.o, which provides part of the support for getting C++
++ file-scope static objects deconstructed after exiting `main'. */
++
++#undef ENDFILE_SPEC
++#define ENDFILE_SPEC \
++ "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
++
++/* Provide a LINK_SPEC appropriate for a NetBSD ELF target. */
++
++#undef LINK_SPEC
++#define LINK_SPEC \
++ "%{assert*} \
++ %{shared:-shared} \
++ %{!shared: \
++ -dc -dp \
++ %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
++ %{!static: \
++ %{rdynamic:-export-dynamic} \
++ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
++ %{static:-static}}"
++
++#endif /* NETBSD_ELF */
+diff -urN gcc-2.95.2/gcc/config/sparc/netbsd-elf.h gcc-patched/gcc/config/sparc/netbsd-elf.h
+--- gcc/config/sparc/netbsd-elf.h Thu Jan 1 09:00:00 1970
++++ gcc/config/sparc/netbsd-elf.h Thu Dec 14 20:00:18 2000
+@@ -0,0 +1,42 @@
++/* NetBSD/sparc ELF configuration */
++
++/*
++ * Pull in generic SPARC ELF configuration, and then clean up
++ * afterwards
++ */
++#include <sparc/elf.h>
++
++/* Name the target CPU. */
++#ifndef TARGET_CPU_DEFAULT
++#define TARGET_CPU_DEFAULT TARGET_CPU_sparc
++#endif
++
++#undef MULDI3_LIBCALL
++#undef DIVDI3_LIBCALL
++#undef UDIVDI3_LIBCALL
++#undef MODDI3_LIBCALL
++#undef UMODDI3_LIBCALL
++#undef INIT_SUBTARGET_OPTABS
++#define INIT_SUBTARGET_OPTABS
++
++#undef CPP_SUBTARGET_SPEC
++#define CPP_SUBTARGET_SPEC "-D__sparc"
++
++#include <sparc/netbsd-elf-common.h>
++
++#undef LINK_SPEC
++#define LINK_SPEC \
++ "-m elf32_sparc \
++ %{assert*} %{R*} \
++ %{shared:-shared} \
++ %{!shared: \
++ -dy -dc -dp \
++ %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
++ %{!static: \
++ %{rdynamic:-export-dynamic} \
++ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
++ %{static:-static}}"
++
++/* Name the port. */
++#undef TARGET_NAME
++#define TARGET_NAME "sparc-netbsdelf"
+diff -urN gcc-2.95.2/gcc/config/sparc/netbsd64.h gcc-patched/gcc/config/sparc/netbsd64.h
+--- gcc/config/sparc/netbsd64.h Thu Jan 1 09:00:00 1970
++++ gcc/config/sparc/netbsd64.h Thu Dec 14 20:00:18 2000
+@@ -0,0 +1,169 @@
++/* NetBSD/sparc64 ELF configuration */
++
++/*
++ * Pull in generic SPARC64 ELF configuration, and then clean up
++ * afterwards
++ */
++
++/* Let us output 32 bit code as well */
++#define SPARC_BI_ARCH
++
++/* Name the target CPU. This must be before <sparc/sparc.h>. */
++#ifndef TARGET_CPU_DEFAULT
++#define TARGET_CPU_DEFAULT TARGET_CPU_ultrasparc
++#endif
++
++#include <sparc/sp64-elf.h>
++
++#include <sparc/netbsd-elf-common.h>
++
++#undef CPP_SUBTARGET_SPEC
++#define CPP_SUBTARGET_SPEC "-D__sparc64__"
++
++#undef LINK_SPEC64
++#define LINK_SPEC64 \
++ "-m elf64_sparc \
++ %{assert*} %{R*} \
++ %{shared:-shared} \
++ %{!shared: \
++ -dy -dc -dp \
++ %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
++ %{!static: \
++ %{rdynamic:-export-dynamic} \
++ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
++ %{static:-static}}"
++
++#undef LINK_SPEC
++#define LINK_SPEC LINK_SPEC64
++
++#ifdef SPARC_BI_ARCH
++
++#undef STARTFILE_SPEC64
++#define STARTFILE_SPEC64 \
++ "%{!shared: \
++ %{pg:gcrt0%O%s} \
++ %{!pg: \
++ %{p:gcrt0%O%s} \
++ %{!p:crt0%O%s}}} \
++ %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}"
++
++#undef STARTFILE_SPEC32
++#define STARTFILE_SPEC32 \
++ "%{!shared: \
++ %{pg:/emul/netbsd32/usr/lib/gcrt0%O%s} \
++ %{!pg: \
++ %{p:/emul/netbsd32/usr/lib/gcrt0%O%s} \
++ %{!p:/emul/netbsd32/usr/lib/crt0%O%s}}} \
++ %{!shared:/emul/netbsd32/usr/lib/crtbegin%O%s} %{shared:/emul/netbsd32/usr/lib/crtbeginS%O%s}"
++
++#undef STARTFILE_SPEC
++#if DEFAULT_ARCH32_P
++#define STARTFILE_SPEC "\
++%{m32:" STARTFILE_SPEC32 "} \
++%{m64:" STARTFILE_SPEC64 "} \
++%{!m32:%{!m64:" STARTFILE_SPEC32 "}}"
++#else
++#define STARTFILE_SPEC "\
++%{m32:" STARTFILE_SPEC32 "} \
++%{m64:" STARTFILE_SPEC64 "} \
++%{!m32:%{!m64:" STARTFILE_SPEC64 "}}"
++#endif
++
++#undef ENDFILE_SPEC64
++#define ENDFILE_SPEC64 \
++ "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
++
++#undef ENDFILE_SPEC32
++#define ENDFILE_SPEC32 \
++ "%{!shared:/emul/netbsd32/usr/lib/crtend%O%s} %{shared:/emul/netbsd32/usr/lib/crtendS%O%s}"
++
++#undef ENDFILE_SPEC
++#if DEFAULT_ARCH32_P
++#define ENDFILE_SPEC "\
++%{m32:" ENDFILE_SPEC32 "} \
++%{m64:" ENDFILE_SPEC64 "} \
++%{!m32:%{!m64:" ENDFILE_SPEC32 "}}"
++#else
++#define ENDFILE_SPEC "\
++%{m32:" ENDFILE_SPEC32 "} \
++%{m64:" ENDFILE_SPEC64 "} \
++%{!m32:%{!m64:" ENDFILE_SPEC64 "}}"
++#endif
++
++#undef SUBTARGET_EXTRA_SPECS
++#define SUBTARGET_EXTRA_SPECS \
++ { "link_arch32", LINK_ARCH32_SPEC }, \
++ { "link_arch64", LINK_ARCH64_SPEC }, \
++ { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
++ { "link_arch", LINK_ARCH_SPEC },
++
++#undef LINK_ARCH32_SPEC
++#define LINK_ARCH32_SPEC \
++ "-m elf32_sparc \
++ -Y P,/emul/netbsd32/usr/lib \
++ %{assert*} %{R*} \
++ %{shared:-shared} \
++ %{!shared: \
++ -dy -dc -dp \
++ %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
++ %{!static: \
++ %{rdynamic:-export-dynamic} \
++ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
++ %{static:-static}}"
++
++#undef LINK_ARCH64_SPEC
++#define LINK_ARCH64_SPEC LINK_SPEC64
++
++#define LINK_ARCH_SPEC "\
++%{m32:%(link_arch32)} \
++%{m64:%(link_arch64)} \
++%{!m32:%{!m64:%(link_arch_default)}} \
++"
++
++#define LINK_ARCH_DEFAULT_SPEC \
++(DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
++
++#undef LINK_SPEC
++#define LINK_SPEC "\
++%(link_arch) \
++%{mlittle-endian:-EL} \
++"
++
++#undef CC1_SPEC
++#if DEFAULT_ARCH32_P
++#define CC1_SPEC "\
++%{sun4:} %{target:} \
++%{mcypress:-mcpu=cypress} \
++%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
++%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
++%{m64:-mptr64 -mcpu=ultrasparc -mstack-bias} \
++"
++#else
++#define CC1_SPEC "\
++%{sun4:} %{target:} \
++%{mcypress:-mcpu=cypress} \
++%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
++%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
++%{m32:-mptr32 -mcpu=cypress -mno-stack-bias} \
++"
++#endif
++
++#if DEFAULT_ARCH32_P
++#define MULTILIB_DEFAULTS { "m32" }
++#else
++#define MULTILIB_DEFAULTS { "m64" }
++#endif
++
++#undef CPP_SUBTARGET_SPEC
++#define CPP_SUBTARGET_SPEC \
++(DEFAULT_ARCH32_P ? "\
++%{m64:-D__sparc64__}%{!m64:-D__sparc} \
++" : "\
++%{!m32:-D__sparc64__}%{m32:-D__sparc} \
++")
++
++#endif /* SPARC_BI_ARCH */
++
++/* Name the port. */
++#undef TARGET_NAME
++#define TARGET_NAME "sparc64-netbsd"
+diff -urN gcc-2.95.2/gcc/config/sparc/sparc.md gcc-patched/gcc/config/sparc/sparc.md
+--- gcc/config/sparc/sparc.md Thu Oct 21 14:35:40 1999
++++ gcc/config/sparc/sparc.md Thu Dec 14 20:00:18 2000
+@@ -3472,10 +3472,7 @@
+ (define_split
+ [(set (match_operand:TF 0 "register_operand" "")
+ (match_operand:TF 1 "register_operand" ""))]
+- "reload_completed
+- && (! TARGET_ARCH64
+- || (TARGET_FPU
+- && ! TARGET_HARD_QUAD))"
++ "reload_completed"
+ [(clobber (const_int 0))]
+ "
+ {
+diff -urN gcc-2.95.2/gcc/config/sparc/sysv4.h gcc-patched/gcc/config/sparc/sysv4.h
+--- gcc/config/sparc/sysv4.h Tue Jun 22 02:48:53 1999
++++ gcc/config/sparc/sysv4.h Thu Dec 14 20:00:19 2000
+@@ -210,6 +210,29 @@
+ #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
+ asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
+
++/* A C statement (sans semicolon) to output an element in the table of
++ global constructors. */
++#undef ASM_OUTPUT_CONSTRUCTOR
++#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
++ do { \
++ ctors_section (); \
++ fprintf (FILE, "\t%s\t ", TARGET_ARCH64 ? ASM_LONGLONG : INT_ASM_OP); \
++ assemble_name (FILE, NAME); \
++ fprintf (FILE, "\n"); \
++ } while (0)
++
++/* A C statement (sans semicolon) to output an element in the table of
++ global destructors. */
++#undef ASM_OUTPUT_DESTRUCTOR
++#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
++ do { \
++ dtors_section (); \
++ fprintf (FILE, "\t%s\t ", TARGET_ARCH64 ? ASM_LONGLONG : INT_ASM_OP); \
++ assemble_name (FILE, NAME); \
++ fprintf (FILE, "\n"); \
++ } while (0)
++
++
+ /* Override the name of the mcount profiling function. */
+
+ #undef MCOUNT_FUNCTION
+diff -urN gcc-2.95.2/gcc/config/sparc/xm-netbsd.h gcc-patched/gcc/config/sparc/xm-netbsd.h
+--- gcc/config/sparc/xm-netbsd.h Thu Jan 1 09:00:00 1970
++++ gcc/config/sparc/xm-netbsd.h Thu Dec 14 20:00:19 2000
+@@ -0,0 +1,4 @@
++/* Configuration for GCC for Sun SPARC running NetBSD as host. */
++
++#include <sparc/xm-sparc.h>
++#include <xm-netbsd.h>
+diff -urN gcc-2.95.2/gcc/config/sparc/xm-netbsd64.h gcc-patched/gcc/config/sparc/xm-netbsd64.h
+--- gcc/config/sparc/xm-netbsd64.h Thu Jan 1 09:00:00 1970
++++ gcc/config/sparc/xm-netbsd64.h Thu Dec 14 20:00:19 2000
+@@ -0,0 +1,4 @@
++/* Configuration for GCC for Sun SPARC V9 running NetBSD as host. */
++
++#include <xm-netbsd.h>
++#include <sparc/xm-sp64.h>
+diff -urN gcc-2.95.2/gcc/config/xm-netbsd.h gcc-patched/gcc/config/xm-netbsd.h
+--- gcc/config/xm-netbsd.h Thu Jan 1 09:00:00 1970
++++ gcc/config/xm-netbsd.h Thu Dec 14 20:00:19 2000
+@@ -0,0 +1,32 @@
++/* Configuration for GNU C-compiler for hosts running NetBSD.
++ Copyright (C) 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. */
++
++/* This file defines machine-independent things specific to a host
++ running NetBSD. This file should not be specified as $xm_file itself;
++ instead $xm_file should be CPU/xm-netbsd.h, which should include both
++ CPU/xm-CPU.h and this file xm-netbsd.h. */
++
++#undef POSIX
++#define POSIX
++
++/* Ensure we get gnu C's defaults. */
++#ifdef __GNUC__
++#define alloca __builtin_alloca
++#endif
+diff -urN gcc-2.95.2/gcc/config/xm-target64.h gcc-patched/gcc/config/xm-target64.h
+--- gcc/config/xm-target64.h Thu Jan 1 09:00:00 1970
++++ gcc/config/xm-target64.h Thu Dec 14 20:00:19 2000
+@@ -0,0 +1,6 @@
++/* Hack to extend HOST_WIDE_INT on 64-bit target cross compilers. */
++
++#ifdef __GNUC__
++#define HOST_WIDE_INT long long
++#define HOST_BITS_PER_WIDE_INT 64
++#endif
+diff -urN gcc-2.95.2/gcc/emit-rtl.c gcc-patched/gcc/emit-rtl.c
+--- gcc/emit-rtl.c Wed Aug 11 16:28:52 1999
++++ gcc/emit-rtl.c Thu Dec 14 20:00:20 2000
+@@ -1378,6 +1378,15 @@
+ val = ((val & 0xffffffff) ^ 0x80000000) - 0x80000000;
+ return GEN_INT (val);
+ }
++#if HOST_BITS_PER_WIDE_INT >= 64
++ else if (BITS_PER_WORD >= 64 && i <= 1)
++ {
++ val = k[i*2 + ! WORDS_BIG_ENDIAN];
++ val = (((val & 0xffffffff) ^ 0x80000000) - 0x80000000) << 32;
++ val |= (HOST_WIDE_INT) k[i*2 + WORDS_BIG_ENDIAN] & 0xffffffff;
++ return GEN_INT (val);
++ }
++#endif
+ else
+ abort ();
+ }
+diff -urN gcc-2.95.2/gcc/ginclude/stddef.h gcc-patched/gcc/ginclude/stddef.h
+--- gcc/ginclude/stddef.h Thu Dec 17 06:19:25 1998
++++ gcc/ginclude/stddef.h Thu Dec 14 20:00:20 2000
+@@ -45,6 +45,12 @@
+ #define _WCHAR_T
+ #endif
+ #endif
++/* On NetBSD, machine/ansi.h defines _BSD_WINT_T_ instead of _WINT_T. */
++#if !defined(_WINT_T_) && !defined(_BSD_WINT_T_)
++#ifndef _BSD_WINT_T_
++#define _WINT_T
++#endif
++#endif
+ /* Undef _FOO_T_ if we are supposed to define foo_t. */
+ #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
+ #undef _PTRDIFF_T_
+@@ -58,6 +64,10 @@
+ #undef _WCHAR_T_
+ #undef _BSD_WCHAR_T_
+ #endif
++#if defined (__need_wint_t) || defined (_STDDEF_H_)
++#undef _WINT_T_
++#undef _BSD_WINT_T_
++#endif
+ #endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */
+
+ /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
+@@ -272,12 +282,14 @@
+
+ #if defined (_STDDEF_H) || defined (__need_wint_t)
+ #ifndef _WINT_T
++#ifndef _BSD_WINT_T_
+ #define _WINT_T
+
+ #ifndef __WINT_TYPE__
+ #define __WINT_TYPE__ unsigned int
+ #endif
+ typedef __WINT_TYPE__ wint_t;
++#endif
+ #endif
+ #undef __need_wint_t
+ #endif
+diff -urN gcc-2.95.2/gcc/objc/objc-act.c gcc-patched/gcc/objc/objc-act.c
+--- gcc/objc/objc-act.c Thu Apr 15 05:28:54 1999
++++ gcc/objc/objc-act.c Thu Dec 14 20:00:19 2000
+@@ -8399,8 +8399,11 @@
+ pushdecl (decl);
+ rest_of_decl_compilation (decl, 0, 0, 0);
+
+- /* Make following constant read-only (why not)? */
+- readonly_data_section ();
++ /* Make following constant read-only, if not compiling PIC. */
++ if (flag_pic)
++ data_section();
++ else
++ readonly_data_section ();
+
+ exp = build1 (ADDR_EXPR, string_type_node, decl);
+
diff --git a/cross/i386-netbsdpe/patches/patch-ae b/cross/i386-netbsdpe/patches/patch-ae
deleted file mode 100644
index c01ecfbc0e8..00000000000
--- a/cross/i386-netbsdpe/patches/patch-ae
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD: patch-ae,v 1.1.1.1 2000/11/06 03:15:15 minoura Exp $
-
---- gcc/config.sub.dist Sun Oct 1 07:57:03 2000
-+++ gcc/config.sub Sun Oct 1 07:57:51 2000
-@@ -732,7 +732,7 @@
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-- | -mingw32* | -linux-gnu* | -uxpv* | -beos* )
-+ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -netbsdpe* )
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -linux*)
diff --git a/cross/i386-netbsdpe/patches/patch-af b/cross/i386-netbsdpe/patches/patch-af
deleted file mode 100644
index 9f9dab2cf52..00000000000
--- a/cross/i386-netbsdpe/patches/patch-af
+++ /dev/null
@@ -1,23 +0,0 @@
-$NetBSD: patch-af,v 1.1.1.1 2000/11/06 03:15:15 minoura Exp $
-
---- gcc/configure.in.dist Sun Oct 1 07:58:07 2000
-+++ gcc/configure.in Sun Oct 1 08:36:41 2000
-@@ -869,6 +869,18 @@
- fixincludes=fixinc.wrap
- tmake_file=t-netbsd
- ;;
-+ i[[34567]]86-*-netbsdpe* )
-+ xm_file="${xm_file} i386/xm-cygwin32.h"
-+ tmake_file=i386/t-cygwin32
-+ tm_file=i386/netbsd-pe.h
-+ xmake_file=i386/x-cygwin32
-+ extra_objs=winnt.o
-+ fixincludes=Makefile.in
-+ if [[ x$enable_threads = xyes ]]; then
-+ thread_file='win32'
-+ fi
-+ exeext=.exe
-+ ;;
- i[[34567]]86-*-netbsd*)
- tm_file=i386/netbsd.h
- xm_file=i386/xm-netbsd.h
diff --git a/cross/i386-netbsdpe/patches/patch-co b/cross/i386-netbsdpe/patches/patch-co
new file mode 100644
index 00000000000..332aee3da39
--- /dev/null
+++ b/cross/i386-netbsdpe/patches/patch-co
@@ -0,0 +1,78 @@
+$NetBSD: patch-co,v 1.1 2001/01/30 03:09:00 minoura Exp $
+
+--- gcc/configure.in.pre-patch Tue Jan 16 21:47:25 2001
++++ gcc/configure.in
+@@ -1156,9 +1156,34 @@
+ tmake_file=t-freebsd
+ ;;
+ changequote(,)dnl
++ i[34567]86-*-netbsdelf* | \
++ i[34567]86-*-netbsd1.4[I-Z]* | \
++ i[34567]86-*-netbsd1.[5-9]* | \
++ i[34567]86-*-netbsd2*)
++changequote([,])dnl
++ tm_file=i386/netbsd-elf.h
++ xm_file=i386/xm-netbsd.h
++ tmake_file=t-netbsd
++ ;;
++changequote(,)dnl
++ i[34567]86-*-netbsdpe* )
++changequote([,])dnl
++ xm_file="${xm_file} i386/xm-cygwin.h"
++ tmake_file=i386/t-cygwin
++ tm_file=i386/netbsd-pe.h
++ xmake_file=i386/x-cygwin
++ extra_objs=winnt.o
++ fixincludes=Makefile.in
++ if [[ x$enable_threads = xyes ]]; then
++ thread_file='posix'
++ fi
++ exeext=.exe
++ ;;
++changequote(,)dnl
+ i[34567]86-*-netbsd*)
+ changequote([,])dnl
+ tm_file=i386/netbsd.h
++ xm_file=i386/xm-netbsd.h
+ tmake_file=t-netbsd
+ use_collect2=yes
+ ;;
+@@ -3021,6 +3046,12 @@
+ tmake_file=sparc/t-sparcbare
+ tm_file="sparc/aout.h libgloss.h"
+ ;;
++ sparc-*-netbsd*elf*)
++ tm_file=sparc/netbsdelf.h
++ xm_file=sparc/xm-netbsd.h
++ tmake_file=t-netbsd
++ use_collect2=yes
++ ;;
+ sparc-*-netbsd*)
+ tm_file=sparc/netbsd.h
+ tmake_file=t-netbsd
+@@ -3216,6 +3247,12 @@
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+ gnu_ld=yes
+ ;;
++ sparc64-*-netbsd*)
++ tm_file=sparc/netbsd64.h
++ xm_file=sparc/xm-netbsd64.h
++ tmake_file=t-netbsd
++ use_collect2=yes
++ ;;
+ # This hasn't been upgraded to GCC 2.
+ # tahoe-harris-*) # Harris tahoe, using COFF.
+ # tm_file=tahoe/harris.h
+@@ -3557,6 +3594,12 @@
+ esac
+ fi
+
++case $target in
++ alpha*|sparc64*)
++ build_xm_file="${build_xm_file} xm-target64.h"
++ host_xm_file="${host_xm_file} xm-target64.h";;
++esac
++
+ # Handle cpp installation.
+ if test x$enable_cpp != xno
+ then
diff --git a/cross/i386-netbsdpe/patches/patch-cp b/cross/i386-netbsdpe/patches/patch-cp
new file mode 100644
index 00000000000..df74d2f16ab
--- /dev/null
+++ b/cross/i386-netbsdpe/patches/patch-cp
@@ -0,0 +1,44 @@
+$NetBSD: patch-cp,v 1.1 2001/01/30 03:09:00 minoura Exp $
+
+--- gcc/cccp.c.orig Wed Jan 17 20:59:27 2001
++++ gcc/cccp.c
+@@ -393,16 +393,23 @@
+ /* Pick up GNU C++ specific include files. */
+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 0 },
+ #ifdef CROSS_COMPILE
++#if 0
+ /* This is the dir for fixincludes. Put it just before
+ the files that we fix. */
+ { GCC_INCLUDE_DIR, "GCC", 0, 0, 0 },
+- /* For cross-compilation, this dir name is generated
+- automatically in Makefile.in. */
+- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0 },
++#endif
+ #ifdef TOOL_INCLUDE_DIR
+ /* This is another place that the target system's headers might be. */
+ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 0, 0 },
+ #endif
++ /* For cross-compilation, this dir name is generated
++ automatically in Makefile.in. */
++ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0 },
++#ifdef LOCAL_INCLUDE_DIR
++ /* This should be /usr/local/include and should come before
++ the fixincludes-fixed header files. */
++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 0 },
++#endif
+ #else /* not CROSS_COMPILE */
+ #ifdef LOCAL_INCLUDE_DIR
+ /* This should be /usr/local/include and should come before
+@@ -421,11 +428,11 @@
+ #ifdef SYSTEM_INCLUDE_DIR
+ { SYSTEM_INCLUDE_DIR, 0, 0, 0, 0 },
+ #endif
++#endif /* not CROSS_COMPILE */
+ #ifndef STANDARD_INCLUDE_COMPONENT
+ #define STANDARD_INCLUDE_COMPONENT 0
+ #endif
+ { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0, 0 },
+-#endif /* not CROSS_COMPILE */
+ { 0, 0, 0, 0, 0 }
+ };
+ #endif /* no INCLUDE_DEFAULTS */
diff --git a/cross/i386-netbsdpe/patches/patch-cq b/cross/i386-netbsdpe/patches/patch-cq
new file mode 100644
index 00000000000..8a0e78b4acc
--- /dev/null
+++ b/cross/i386-netbsdpe/patches/patch-cq
@@ -0,0 +1,44 @@
+$NetBSD: patch-cq,v 1.1 2001/01/30 03:09:01 minoura Exp $
+
+--- gcc/cppinit.c.orig Tue Oct 12 15:31:11 1999
++++ gcc/cppinit.c
+@@ -129,16 +129,23 @@
+ /* Pick up GNU C++ specific include files. */
+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },
+ #ifdef CROSS_COMPILE
++#if 0
+ /* This is the dir for fixincludes. Put it just before
+ the files that we fix. */
+ { GCC_INCLUDE_DIR, "GCC", 0, 0 },
+- /* For cross-compilation, this dir name is generated
+- automatically in Makefile.in. */
+- { CROSS_INCLUDE_DIR, "GCC", 0, 0 },
++#endif
+ #ifdef TOOL_INCLUDE_DIR
+ /* This is another place that the target system's headers might be. */
+ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1 },
+ #endif
++ /* For cross-compilation, this dir name is generated
++ automatically in Makefile.in. */
++ { CROSS_INCLUDE_DIR, "GCC", 0, 0 },
++#ifdef LOCAL_INCLUDE_DIR
++ /* This should be /usr/local/include and should come before
++ the fixincludes-fixed header files. */
++ { LOCAL_INCLUDE_DIR, 0, 0, 1 },
++#endif
+ #else /* not CROSS_COMPILE */
+ #ifdef LOCAL_INCLUDE_DIR
+ /* This should be /usr/local/include and should come before
+@@ -157,11 +164,11 @@
+ #ifdef SYSTEM_INCLUDE_DIR
+ { SYSTEM_INCLUDE_DIR, 0, 0, 0 },
+ #endif
++#endif /* not CROSS_COMPILE */
+ #ifndef STANDARD_INCLUDE_COMPONENT
+ #define STANDARD_INCLUDE_COMPONENT 0
+ #endif
+ { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0 },
+-#endif /* not CROSS_COMPILE */
+ { 0, 0, 0, 0 }
+ };
+ #endif /* no INCLUDE_DEFAULTS */
diff --git a/cross/i386-netbsdpe/patches/patch-ma b/cross/i386-netbsdpe/patches/patch-ma
new file mode 100644
index 00000000000..21d5d341ffe
--- /dev/null
+++ b/cross/i386-netbsdpe/patches/patch-ma
@@ -0,0 +1,14 @@
+$NetBSD: patch-ma,v 1.1 2001/01/30 03:09:01 minoura Exp $
+
+--- gcc/Makefile.in.pre-patch Tue Jan 16 21:47:24 2001
++++ gcc/Makefile.in
+@@ -276,7 +276,8 @@
+ # Directory in which to find other cross-compilation tools and headers.
+ dollar = @dollar@
+ # Used in install-cross.
+-gcc_tooldir = @gcc_tooldir@
++#gcc_tooldir = @gcc_tooldir@
++gcc_tooldir = $(prefix)/$(target_alias)
+ # Since tooldir does not exist at build-time, use -B$(build_tooldir)/bin/
+ build_tooldir = $(exec_prefix)/$(target_alias)
+ # Directory in which the compiler finds g++ includes.
diff --git a/cross/i386-netbsdpe/patches/patch-ag b/cross/i386-netbsdpe/patches/patch-pe
index f69ae7d51e9..f1f94eb698b 100644
--- a/cross/i386-netbsdpe/patches/patch-ag
+++ b/cross/i386-netbsdpe/patches/patch-pe
@@ -1,13 +1,13 @@
-$NetBSD: patch-ag,v 1.1.1.1 2000/11/06 03:15:16 minoura Exp $
+$NetBSD: patch-pe,v 1.1 2001/01/30 03:09:01 minoura Exp $
---- /dev/null Sun Oct 1 23:26:03 2000
-+++ gcc/config/i386/netbsd-pe.h Sun Oct 1 23:31:12 2000
-@@ -0,0 +1,454 @@
+--- /dev/null Fri Jan 26 01:33:46 2001
++++ gcc/config/i386/netbsd-pe.h
+@@ -0,0 +1,538 @@
+/* Operating system specific defines to be used when targeting GCC for
+ hosting on Windows NT 3.x, using a Unix style C library and tools,
+ as distinct from winnt.h, which is used to build GCC for use with a
+ windows style library and tool set and uses the Microsoft tools.
-+ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
++ Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
@@ -28,6 +28,8 @@ $NetBSD: patch-ag,v 1.1.1.1 2000/11/06 03:15:16 minoura Exp $
+
+#define YES_UNDERSCORES
+
++#define BIGGEST_FIELD_ALIGNMENT 32
++
+#define DBX_DEBUGGING_INFO
+#define SDB_DEBUGGING_INFO
+#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
@@ -35,6 +37,31 @@ $NetBSD: patch-ag,v 1.1.1.1 2000/11/06 03:15:16 minoura Exp $
+#include "i386/gas.h"
+#include "dbxcoff.h"
+
++/* Augment TARGET_SWITCHES with the cygwin/no-cygwin options. */
++/*#define MASK_WIN32 0x40000000 Use -lming32 interface */
++/*#define MASK_CYGWIN 0x20000000 Use -lcygwin interface */
++#define MASK_WINDOWS 0x10000000 /* Use windows interface */
++#define MASK_DLL 0x08000000 /* Use dll interface */
++#define MASK_NOP_FUN_DLLIMPORT 0x20000 /* Ignore dllimport for functions */
++
++/*#define TARGET_WIN32 (target_flags & MASK_WIN32)*/
++/*#define TARGET_CYGWIN (target_flags & MASK_CYGWIN)*/
++#define TARGET_WINDOWS (target_flags & MASK_WINDOWS)
++#define TARGET_DLL (target_flags & MASK_DLL)
++#define TARGET_NOP_FUN_DLLIMPORT (target_flags & MASK_NOP_FUN_DLLIMPORT)
++
++#undef SUBTARGET_SWITCHES
++#define SUBTARGET_SWITCHES \
++/*{ "cygwin", MASK_CYGWIN, "Use the Cygwin interface" },*/ \
++/*{ "no-cygwin", MASK_WIN32, "Use the Mingw32 interface" }, */\
++{ "windows", MASK_WINDOWS, "Create GUI application" }, \
++{ "console", -MASK_WINDOWS, "Create console application" }, \
++{ "dll", MASK_DLL, "Generate code for a DLL" }, \
++{ "nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT, "Ignore dllimport for functions" }, \
++{ "no-nop-fun-dllimport", -MASK_NOP_FUN_DLLIMPORT, "" }, \
++/*{ "threads", 0, "Use Mingw-specific thread support" },*/
++
++
+/* Support the __declspec keyword by turning them into attributes.
+ We currently only support: dllimport and dllexport.
+ Note that the current way we do this may result in a collision with
@@ -47,18 +74,42 @@ $NetBSD: patch-ag,v 1.1.1.1 2000/11/06 03:15:16 minoura Exp $
+#undef CPP_PREDEFINES
+#endif
+
-+#define CPP_PREDEFINES "-Di386 -D__CYGWIN32__ -D__PEACE__ \
-+ -D_X86_=1 -D__STDC__=1 \
++#define CPP_PREDEFINES "-Di386 -D__PEACE__ -D__CYGWIN32__ \
++ -D_X86_=1 -D__STDC__=1\
+ -D__stdcall=__attribute__((__stdcall__)) \
+ -D__cdecl=__attribute__((__cdecl__)) \
+ -D__declspec(x)=__attribute__((x)) \
+ -Asystem(winnt) -Acpu(i386) -Amachine(i386)"
+
++/* Normally, -lgcc is not needed since everything in it is in the DLL, but we
++ want to allow things to be added to it when installing new versions of
++ GCC without making a new CYGWIN.DLL, so we leave it. Profiling is handled
++ by calling the init function from the prologue. */
++
++#undef STARTFILE_SPEC
++#define STARTFILE_SPEC "%{mdll:crt0dll%o%s} \
++ %{!mdll: %{!mwindows:crt0%O%s} \
++ %{mwindows:crt0win%O%s}}"
++
+#undef CPP_SPEC
+#define CPP_SPEC "-remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
-+ %{!mwindows:-D__NetBSD__ -D__PECOFF__} \
++ %{!mwindows:-D__NetBSD__ -D__PECOFF__ -D__NetBSDPE__} \
+ %{mwindows:-D_WIN32 -DWINNT}"
+
++/* This macro defines names of additional specifications to put in the specs
++ that can be used in various specifications like CC1_SPEC. Its definition
++ is an initializer with a subgrouping for each command option.
++
++ Each subgrouping contains a string constant, that defines the
++ specification name, and a string constant that used by the GNU CC driver
++ program.
++
++ Do not define this macro if it does not need to do anything. */
++
++/*#undef SUBTARGET_EXTRA_SPECS
++#define SUBTARGET_EXTRA_SPECS \
++ { "mingw_include_path", DEFAULT_TARGET_MACHINE }*/
++
+/* We have to dynamic link to get to the system DLLs. All of libc, libm and
+ the Unix stuff is in cygwin.dll. The import library is called
+ 'libcygwin.a'. For Windows applications, include more libraries, but
@@ -66,33 +117,26 @@ $NetBSD: patch-ag,v 1.1.1.1 2000/11/06 03:15:16 minoura Exp $
+ ld, but that doesn't work just yet. */
+
+#undef LIB_SPEC
-+#define LIB_SPEC "%{mwindows:-luser32 -lgdi32 -lcomdlg32 -ladvapi32 -lshell32 \
-+ -lkernel32 -lm} -lc"
-+#define LINK_SPEC "%{mwindows:--subsystem windows}"
++#define LIB_SPEC "-lkernel32 \
++ %{mwindows:-luser32 -lgdi32 -lcomdlg32 -ladvapi32 -lshell32 -lm} \
++ -lpthread -lc"
+
-+/* Normally, -lgcc is not needed since everything in it is in the DLL, but we
-+ want to allow things to be added to it when installing new versions of
-+ GCC without making a new CYGWIN.DLL, so we leave it. */
++#define LINK_SPEC "%{mwindows:--subsystem windows} \
++ %{mconsole:--subsystem console} \
++ %{mdll:--dll -e _DllMainCRTStartup@12}"
+
-+#undef STARTFILE_SPEC
-+#define STARTFILE_SPEC "crt0%O%s"
+
+#define SIZE_TYPE "unsigned int"
+#define PTRDIFF_TYPE "int"
+#define WCHAR_UNSIGNED 1
+#define WCHAR_TYPE_SIZE 16
+#define WCHAR_TYPE "short unsigned int"
++
+#define HAVE_ATEXIT 1
+
+
-+/* Ignore dllimport for functions. */
-+#define TARGET_NOP_FUN_DLLIMPORT (target_flags & 0x20000)
-+
-+#undef SUBTARGET_SWITCHES
-+#define SUBTARGET_SWITCHES \
-+ { "nop-fun-dllimport", 0x20000 }, \
-+ { "no-nop-fun-dllimport", -0x20000 }, \
-+ { "windows", 0x0 },
++/* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop). */
++#define HANDLE_PRAGMA_PACK_PUSH_POP 1
+
+/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
+ is a valid machine specific attribute for DECL.
@@ -212,6 +256,20 @@ $NetBSD: patch-ag,v 1.1.1.1 2000/11/06 03:15:16 minoura Exp $
+ fprintf (FILE, "\n"); \
+ } while (0)
+
++/* Don't allow flag_pic to propagate since gas may produce invalid code
++ otherwise. */
++
++#undef SUBTARGET_OVERRIDE_OPTIONS
++#define SUBTARGET_OVERRIDE_OPTIONS \
++do { \
++ if (flag_pic) \
++ { \
++ warning ("-f%s ignored for target (all code is position independent)",\
++ (flag_pic > 1) ? "PIC" : "pic"); \
++ flag_pic = 0; \
++ } \
++} while (0) \
++
+/* Define this macro if references to a symbol must be treated
+ differently depending on something about the variable or
+ function named by the symbol (such as what section it is in).
@@ -273,11 +331,7 @@ $NetBSD: patch-ag,v 1.1.1.1 2000/11/06 03:15:16 minoura Exp $
+#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
+do { \
+ if (i386_pe_dllexport_name_p (NAME)) \
-+ { \
-+ drectve_section (); \
-+ fprintf ((STREAM), "\t.ascii \" -export:%s\"\n", \
-+ I386_PE_STRIP_ENCODING (NAME)); \
-+ } \
++ i386_pe_record_exported_symbol (NAME, 1); \
+ if (! i386_pe_dllimport_name_p (NAME)) \
+ { \
+ fprintf ((STREAM), "\t.comm\t"); \
@@ -292,13 +346,7 @@ $NetBSD: patch-ag,v 1.1.1.1 2000/11/06 03:15:16 minoura Exp $
+#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
+do { \
+ if (i386_pe_dllexport_name_p (NAME)) \
-+ { \
-+ enum in_section save_section = in_section; \
-+ drectve_section (); \
-+ fprintf ((STREAM), "\t.ascii \" -export:%s\"\n", \
-+ I386_PE_STRIP_ENCODING (NAME)); \
-+ switch_to_section (save_section, (DECL)); \
-+ } \
++ i386_pe_record_exported_symbol (NAME, 1); \
+ ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
+} while (0)
+
@@ -361,7 +409,14 @@ $NetBSD: patch-ag,v 1.1.1.1 2000/11/06 03:15:16 minoura Exp $
+ else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
+ type = SECT_RO, mode = ""; \
+ else \
-+ type = SECT_RW, mode = "w"; \
++ { \
++ type = SECT_RW; \
++ if (TREE_CODE (DECL) == VAR_DECL \
++ && lookup_attribute ("shared", DECL_MACHINE_ATTRIBUTES (DECL))) \
++ mode = "ws"; \
++ else \
++ mode = "w"; \
++ } \
+ \
+ if (s == 0) \
+ { \
@@ -394,12 +449,7 @@ $NetBSD: patch-ag,v 1.1.1.1 2000/11/06 03:15:16 minoura Exp $
+ do \
+ { \
+ if (i386_pe_dllexport_name_p (NAME)) \
-+ { \
-+ drectve_section (); \
-+ fprintf ((FILE), "\t.ascii \" -export:%s\"\n", \
-+ I386_PE_STRIP_ENCODING (NAME)); \
-+ function_section (DECL); \
-+ } \
++ i386_pe_record_exported_symbol (NAME, 0); \
+ if (write_symbols != SDB_DEBUG) \
+ i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL)); \
+ ASM_OUTPUT_LABEL (FILE, NAME); \
@@ -420,6 +470,11 @@ $NetBSD: patch-ag,v 1.1.1.1 2000/11/06 03:15:16 minoura Exp $
+#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
+ i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
+
++/* This says out to put a global symbol in the BSS section. */
++#undef ASM_OUTPUT_ALIGNED_BSS
++#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
++ asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
++
+/* Output function declarations at the end of the file. */
+#define ASM_FILE_END(FILE) \
+ i386_pe_asm_file_end (FILE)
@@ -433,6 +488,20 @@ $NetBSD: patch-ag,v 1.1.1.1 2000/11/06 03:15:16 minoura Exp $
+/* Don't assume anything about the header files. */
+#define NO_IMPLICIT_EXTERN_C
+
++#define SUBTARGET_PROLOGUE \
++ if (profile_flag \
++ && strcmp (IDENTIFIER_POINTER (DECL_NAME (current_function_decl)),\
++ "main") == 0) \
++ { \
++ rtx xops[1]; \
++ xops[0] = gen_rtx_MEM (FUNCTION_MODE, \
++ gen_rtx (SYMBOL_REF, Pmode, "_monstartup")); \
++ if (do_rtl) \
++ emit_call_insn (gen_rtx (CALL, VOIDmode, xops[0], const0_rtx)); \
++ else \
++ output_asm_insn (AS1 (call,%P1), xops); \
++ }
++
+/* External function declarations. */
+
+#ifndef PROTO
@@ -451,9 +520,24 @@ $NetBSD: patch-ag,v 1.1.1.1 2000/11/06 03:15:16 minoura Exp $
+
+extern void i386_pe_record_external_function PROTO((char *));
+extern void i386_pe_declare_function_type STDIO_PROTO((FILE *, char *, int));
++extern void i386_pe_record_exported_symbol PROTO((char *, int));
+extern void i386_pe_asm_file_end STDIO_PROTO((FILE *));
+
+/* For Win32 ABI compatibility */
+#undef DEFAULT_PCC_STRUCT_RETURN
+#define DEFAULT_PCC_STRUCT_RETURN 0
+
++/* No data type wants to be aligned rounder than this. */
++#undef BIGGEST_ALIGNMENT
++#define BIGGEST_ALIGNMENT 128
++
++/* A bitfield declared as `int' forces `int' alignment for the struct. */
++#undef PCC_BITFIELD_TYPE_MATTERS
++#define PCC_BITFIELD_TYPE_MATTERS 1
++#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec)
++
++/* Enable alias attribute support. */
++#ifndef SET_ASM_OP
++#define SET_ASM_OP "\t.set"
++#endif
++