Sprout from master 2005-11-30 19:13:11 UTC Paweł Sikora <pluto@pld-linux.org> '- fix target bug on ppc (and kernel build too).'
Cherrypick from master 2005-02-06 22:51:00 UTC Paweł Sikora <pluto@pld-linux.org> '- PR ada/13470.':
gcc-ada-bootstrap.patch -> 1.1
gcc-ada-link.patch -> 1.3
gcc-info.patch -> 1.8
gcc-nodebug.patch -> 1.1
gcc-pr13470.patch -> 1.1
gcc-pr15666.patch -> 1.1
gcc-pr16276.patch -> 1.3
gcc-pr18185.patch -> 1.1
gcc-ssp.patch -> 1.3
gcc-visibility.patch -> 1.1
gcc_visibility.m4 -> 1.1
Delete:
c++filt.1
gcc-O2-bug.patch
gcc-alpha-complex-float.patch
gcc-amd64-thunk.patch
gcc-bootstrap.patch
gcc-builtin-apply.patch
gcc-cmpi.patch
gcc-cpp-dos-newlines.patch
gcc-cpp-macro-doc.patch
gcc-crtendS.patch
gcc-cse-find_best_addr.patch
gcc-default-arch.patch
gcc-disableshared.patch
gcc-enable-java-awt-qt.patch
gcc-ffi64.patch
gcc-gcc-page.c.patch
gcc-gcj-vs-iconv.patch
gcc-gpc.patch
gcc-libobjc.patch
gcc-libstdc++-bastring.patch
gcc-libstdc++-out-of-mem.patch
gcc-libstdc++-wstring.patch
gcc-libstdc++.patch
gcc-m68k-pic.patch
gcc-manpage.patch
gcc-march-i686-fix.patch
gcc-paths.patch
gcc-pld-linux.patch
gcc-pointer-arith.patch
gcc-ppc-ada-hack.patch
gcc-ppc-descriptions.patch
gcc-ppc-ice.patch
gcc-pr19664.patch
gcc-sparc32-rfi.patch
gcc-x87-mmx-eh.patch
gcc-x87-mmx-switch.patch
gcc.spec
gcc32-ada-link.patch
gcc32-attr-visibility.patch
gcc32-attr-visibility2.patch
gcc32-attr-visibility3.patch
gcc32-attr-visibility4.patch
gcc32-attr-visibility5.patch
gcc32-boehm-gc-libs.patch
gcc32-bogus-inline.patch
gcc32-c++-nrv-test.patch
gcc32-c++-pretty_function.patch
gcc32-c++-tsubst-asm.patch
gcc32-cfg-eh.patch
gcc32-debug-pr7241.patch
gcc32-doc-gcov.patch
gcc32-duplicate-decl.patch
gcc32-dwarf2-pr6381.patch
gcc32-dwarf2-pr6436-test.patch
gcc32-fde-merge-compat.patch
gcc32-hard-reg-sharing.patch
gcc32-hard-reg-sharing2.patch
gcc32-i386-default-momit-leaf-frame-pointer.patch
gcc32-i386-memtest-test.patch
gcc32-i386-no-default-momit-leaf-frame-pointer.patch
gcc32-i386-pic-label-thunk.patch
gcc32-i386-profile-olfp.patch
gcc32-inline-label.patch
gcc32-java-no-rpath.patch
gcc32-libstdc++-glibc.patch
gcc32-locale_in_ctype_members.patch
gcc32-locale_in_ctype_members_header.patch
gcc32-locale_in_monetary_members.patch
gcc32-pr6842.patch
gcc32-sparc-sll1.patch
gcc32-test-rh65771.patch
gcc32-test-rotate.patch
gcc32-tls-dwarf2.patch
gcc32-tls.patch
gcc32-tls2.patch
gcc32-tls3.patch
gcc32-tls4.patch
gcc32-tls5.patch
gcc33-multi32-hack.patch
gcov.1
+++ /dev/null
-.\" Automatically generated by Pod::Man version 1.15
-.\" Tue Sep 18 12:11:39 2001
-.\"
-.\" Standard preamble:
-.\" ======================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Ip \" List item
-.br
-.ie \\n(.$>=3 .ne \\$3
-.el .ne 3
-.IP "\\$1" \\$2
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
-.\" to do unbreakable dashes and therefore won't be available. \*(C` and
-.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr
-.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
-.\" index entries marked with X<> in POD. Of course, you'll have to process
-.\" the output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it
-.\" makes way too many mistakes in technical documents.
-.hy 0
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-.bd B 3
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ======================================================================
-.\"
-.IX Title "C++FILT 1"
-.TH C++FILT 1 "binutils-2.11.90.0.27" "2001-09-18" "GNU"
-.UC
-.SH "NAME"
-c++filt \- Demangle \*(C+ and Java symbols.
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-c++filt [\fB\-_\fR|\fB\*(--strip-underscores\fR]
- [\fB\-j\fR|\fB\*(--java\fR]
- [\fB\-n\fR|\fB\*(--no-strip-underscores\fR]
- [\fB\-s\fR \fIformat\fR|\fB\*(--format=\fR\fIformat\fR]
- [\fB\*(--help\fR] [\fB\*(--version\fR] [\fIsymbol\fR...]
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \*(C+ and Java languages provides function overloading, which means
-that you can write many functions with the same name (providing each
-takes parameters of different types). All \*(C+ and Java function names
-are encoded into a low-level assembly label (this process is known as
-\&\fImangling\fR). The \fBc++filt\fR
-[1]
-program does the inverse mapping: it decodes (\fIdemangles\fR) low-level
-names into user-level names so that the linker can keep these overloaded
-functions from clashing.
-.PP
-Every alphanumeric word (consisting of letters, digits, underscores,
-dollars, or periods) seen in the input is a potential label. If the
-label decodes into a \*(C+ name, the \*(C+ name replaces the low-level
-name in the output.
-.PP
-You can use \fBc++filt\fR to decipher individual symbols:
-.PP
-.Vb 1
-\& c++filt I<symbol>
-.Ve
-If no \fIsymbol\fR arguments are given, \fBc++filt\fR reads symbol
-names from the standard input and writes the demangled names to the
-standard output. All results are printed on the standard output.
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.Ip "\fB\-_\fR" 4
-.IX Item "-_"
-.PD 0
-.Ip "\fB\*(--strip-underscores\fR" 4
-.IX Item "strip-underscores"
-.PD
-On some systems, both the C and \*(C+ compilers put an underscore in front
-of every name. For example, the C name \f(CW\*(C`foo\*(C'\fR gets the low-level
-name \f(CW\*(C`_foo\*(C'\fR. This option removes the initial underscore. Whether
-\&\fBc++filt\fR removes the underscore by default is target dependent.
-.Ip "\fB\-j\fR" 4
-.IX Item "-j"
-.PD 0
-.Ip "\fB\*(--java\fR" 4
-.IX Item "java"
-.PD
-Prints demangled names using Java syntax. The default is to use \*(C+
-syntax.
-.Ip "\fB\-n\fR" 4
-.IX Item "-n"
-.PD 0
-.Ip "\fB\*(--no-strip-underscores\fR" 4
-.IX Item "no-strip-underscores"
-.PD
-Do not remove the initial underscore.
-.Ip "\fB\-s\fR \fIformat\fR" 4
-.IX Item "-s format"
-.PD 0
-.Ip "\fB\*(--format=\fR\fIformat\fR" 4
-.IX Item "format=format"
-.PD
-\&\s-1GNU\s0 \fBnm\fR can decode three different methods of mangling, used by
-different \*(C+ compilers. The argument to this option selects which
-method it uses:
-.RS 4
-.if n .Ip "\f(CW""""gnu""""\fR" 4
-.el .Ip "\f(CWgnu\fR" 4
-.IX Item "gnu"
-the one used by the \s-1GNU\s0 compiler (the default method)
-.if n .Ip "\f(CW""""lucid""""\fR" 4
-.el .Ip "\f(CWlucid\fR" 4
-.IX Item "lucid"
-the one used by the Lucid compiler
-.if n .Ip "\f(CW""""arm""""\fR" 4
-.el .Ip "\f(CWarm\fR" 4
-.IX Item "arm"
-the one specified by the \*(C+ Annotated Reference Manual
-.if n .Ip "\f(CW""""hp""""\fR" 4
-.el .Ip "\f(CWhp\fR" 4
-.IX Item "hp"
-the one used by the \s-1HP\s0 compiler
-.if n .Ip "\f(CW""""edg""""\fR" 4
-.el .Ip "\f(CWedg\fR" 4
-.IX Item "edg"
-the one used by the \s-1EDG\s0 compiler
-.if n .Ip "\f(CW""""gnu\-new\-abi""""\fR" 4
-.el .Ip "\f(CWgnu\-new\-abi\fR" 4
-.IX Item "gnu-new-abi"
-the one used by the \s-1GNU\s0 compiler with the new \s-1ABI\s0.
-.RE
-.RS 4
-.RE
-.Ip "\fB\*(--help\fR" 4
-.IX Item "help"
-Print a summary of the options to \fBc++filt\fR and exit.
-.Ip "\fB\*(--version\fR" 4
-.IX Item "version"
-Print the version number of \fBc++filt\fR and exit.
-.SH "FOOTNOTES"
-.IX Header "FOOTNOTES"
-.Ip "1." 4
-\&\s-1MS-DOS\s0 does not allow \f(CW\*(C`+\*(C'\fR characters in file names, so on
-\&\s-1MS-DOS\s0 this program is named \fBc++filt\fR.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-the Info entries for \fIbinutils\fR.
-.SH "COPYRIGHT"
-.IX Header "COPYRIGHT"
-Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001 Free Software Foundation, Inc.
-.PP
-Permission is granted to copy, distribute and/or modify this document
-under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1
-or any later version published by the Free Software Foundation;
-with no Invariant Sections, with no Front-Cover Texts, and with no
-Back-Cover Texts. A copy of the license is included in the
-section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".
+++ /dev/null
-diff -urN gcc-2.95.2.org/gcc/reload1.c gcc-2.95.2/gcc/reload1.c
---- gcc-2.95.2.org/gcc/reload1.c Sat Nov 25 01:48:15 2000
-+++ gcc-2.95.2/gcc/reload1.c Sat Nov 25 01:52:07 2000
-@@ -423,6 +423,7 @@
- static int reload_reg_reaches_end_p PROTO((int, int, enum reload_type));
- static int allocate_reload_reg PROTO((struct insn_chain *, int, int,
- int));
-+static int conflicts_with_override PROTO((rtx));
- static void choose_reload_regs PROTO((struct insn_chain *));
- static void merge_assigned_reloads PROTO((rtx));
- static void emit_reload_insns PROTO((struct insn_chain *));
-@@ -5594,6 +5595,21 @@
-
- return 1;
- }
-+
-+/* Determine whether the reload reg X overlaps any rtx'es used for
-+ overriding inheritance. Return nonzero if so. */
-+
-+static int
-+conflicts_with_override (x)
-+ rtx x;
-+{
-+ int i;
-+ for (i = 0; i < n_reloads; i++)
-+ if (reload_override_in[i]
-+ && reg_overlap_mentioned_p (x, reload_override_in[i]))
-+ return 1;
-+ return 0;
-+}
- \f
- /* Assign hard reg targets for the pseudo-registers we must reload
- into hard regs for this insn.
-@@ -6791,6 +6807,7 @@
- && dead_or_set_p (insn, old)
- /* This is unsafe if some other reload
- uses the same reg first. */
-+ && ! conflicts_with_override (reloadreg)
- && reload_reg_free_for_value_p (REGNO (reloadreg),
- reload_opnum[j],
- reload_when_needed[j],
-
---- gcc/ada/sinfo.h 1970-01-01 01:00:00.000000000 +0100
-+++ gcc/ada/sinfo.h 2004-06-02 00:54:16.000000000 +0200
+--- gcc-3.4.0/obj-amd64-pld-linux/gcc/ada/sinfo.h.orig 1970-01-01 01:00:00.000000000 +0100
++++ gcc-3.4.0/obj-amd64-pld-linux/gcc/ada/sinfo.h 2004-06-02 00:54:16.000000000 +0200
@@ -0,0 +1,847 @@
+/*--------------------------------------------------------------------------*/
+/* */
+ INLINE Boolean Zero_Cost_Handling (Node_Id N)
+ { return Flag5 (N); }
+
---- gcc/ada/einfo.h 1970-01-01 01:00:00.000000000 +0100
-+++ gcc/ada/einfo.h 2004-06-02 00:54:19.000000000 +0200
+--- gcc-3.4.0/obj-amd64-pld-linux/gcc/ada/einfo.h.orig 1970-01-01 01:00:00.000000000 +0100
++++ gcc-3.4.0/obj-amd64-pld-linux/gcc/ada/einfo.h 2004-06-02 00:54:19.000000000 +0200
@@ -0,0 +1,1814 @@
+/*--------------------------------------------------------------------------*/
+/* */
+ { return Ekind (Id); }
+
+/* End of einfo.h (C version of Einfo package specification) */
---- gcc/ada/nmake.adb 1970-01-01 01:00:00.000000000 +0100
-+++ gcc/ada/nmake.adb 2004-06-02 00:52:35.000000000 +0200
+--- gcc-3.4.0/obj-amd64-pld-linux/gcc/ada/nmake.adb.orig 1970-01-01 01:00:00.000000000 +0100
++++ gcc-3.4.0/obj-amd64-pld-linux/gcc/ada/nmake.adb 2004-06-02 00:52:35.000000000 +0200
@@ -0,0 +1,2867 @@
+------------------------------------------------------------------------------
+-- --
+ end Make_Validate_Unchecked_Conversion;
+
+end Nmake;
---- gcc/ada/nmake.ads 1970-01-01 01:00:00.000000000 +0100
-+++ gcc/ada/nmake.ads 2004-06-02 00:52:35.000000000 +0200
+--- gcc-3.4.0/obj-amd64-pld-linux/gcc/ada/nmake.ads.orig 1970-01-01 01:00:00.000000000 +0100
++++ gcc-3.4.0/obj-amd64-pld-linux/gcc/ada/nmake.ads 2004-06-02 00:52:35.000000000 +0200
@@ -0,0 +1,1351 @@
+------------------------------------------------------------------------------
+-- --
+ pragma Inline (Make_Validate_Unchecked_Conversion);
+
+end Nmake;
---- gcc/ada/treeprs.ads 1970-01-01 01:00:00.000000000 +0100
-+++ gcc/ada/treeprs.ads 2004-06-02 00:54:11.000000000 +0200
+--- gcc-3.4.0/obj-amd64-pld-linux/gcc/ada/treeprs.ads.orig 1970-01-01 01:00:00.000000000 +0100
++++ gcc-3.4.0/obj-amd64-pld-linux/gcc/ada/treeprs.ads 2004-06-02 00:54:11.000000000 +0200
@@ -0,0 +1,801 @@
+------------------------------------------------------------------------------
+-- --
---- gcc-4.0-20040919/gcc/ada/link.c.orig 2004-09-13 12:18:40.000000000 +0200
-+++ gcc-4.0-20040919/gcc/ada/link.c 2004-09-26 12:24:29.079704096 +0200
-@@ -164,9 +164,9 @@
+--- gcc-3.4.0/gcc/ada/link.c.orig Mon Jan 12 12:45:24 2004
++++ gcc-3.4.0/gcc/ada/link.c Tue Jun 1 15:57:42 2004
+@@ -165,9 +165,9 @@
#elif defined (linux)
- const char *__gnat_object_file_option = "";
--const char *__gnat_run_path_option = "-Wl,-rpath,";
--char __gnat_shared_libgnat_default = STATIC;
--int __gnat_link_max = 8192;
-+const char *__gnat_run_path_option = "";
-+char __gnat_shared_libgnat_default = SHARED;
-+int __gnat_link_max = 131072;
- unsigned char __gnat_objlist_file_supported = 1;
- unsigned char __gnat_using_gnu_linker = 1;
- const char *__gnat_object_library_extension = ".a";
---- gcc-4.1-20050522/gcc/ada/Makefile.in.orig 2005-05-26 10:48:40.000000000 +0000
-+++ gcc-4.1-20050522/gcc/ada/Makefile.in 2005-05-26 10:59:25.000000000 +0000
-@@ -139,7 +139,7 @@
+ const char *object_file_option = "";
+-const char *run_path_option = "-Wl,-rpath,";
+-char shared_libgnat_default = STATIC;
+-int link_max = 8192;
++const char *run_path_option = "";
++char shared_libgnat_default = SHARED;
++int link_max = 131072;
+ unsigned char objlist_file_supported = 1;
+ unsigned char using_gnu_linker = 1;
+ const char *object_library_extension = ".a";
+--- gcc-3.4.0/gcc/ada/Makefile.in.orig Mon Apr 26 11:19:09 2004
++++ gcc-3.4.0/gcc/ada/Makefile.in Tue Jun 1 15:58:33 2004
+@@ -142,7 +142,7 @@
objext = .o
exeext =
arext = .a
-soext = .so
+soext = .so.1
shext =
- hyphen = -
-@@ -1180,6 +1180,31 @@
+ # Define this as & to perform parallel make on a Sequent.
+@@ -1269,6 +1269,90 @@
LIBRARY_VERSION := $(LIB_VERSION)
endif
-+ifeq ($(strip $(filter-out sparc64% linux%,$(arch) $(osys))),)
++ifeq ($(strip $(filter-out alpha% linux%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
-+ a-intnam.ads<a-intnam-linux.ads \
-+ s-inmaop.adb<s-inmaop-posix.adb \
-+ s-intman.adb<s-intman-posix.adb \
-+ s-osinte.adb<s-osinte-posix.adb \
-+ s-osinte.ads<s-osinte-linux.ads \
-+ s-osprim.adb<s-osprim-posix.adb \
-+ s-taprop.adb<s-taprop-linux.adb \
-+ s-taspri.ads<s-taspri-linux.ads \
-+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
-+ s-parame.adb<s-parame-linux.adb \
-+ system.ads<system-linux-sparc64.ads
-+
-+ TOOLS_TARGET_PAIRS = \
-+ mlib-tgt.adb<mlib-tgt-linux.adb \
-+ indepsw.adb<indepsw-linux.adb
-+
-+ THREADSLIB = -lpthread
-+ GNATLIB_SHARED = gnatlib-shared-dual
-+ GMEM_LIB = gmemlib
-+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
++ a-intnam.ads<4lintnam.ads \
++ s-inmaop.adb<7sinmaop.adb \
++ s-intman.adb<7sintman.adb \
++ s-osinte.ads<5iosinte.ads \
++ s-osinte.adb<5iosinte.adb \
++ s-osprim.adb<7sosprim.adb \
++ s-taprop.adb<5itaprop.adb \
++ s-tpopsp.adb<5atpopsp.adb \
++ s-taspri.ads<5itaspri.ads \
++ system.ads<5nsystem.ads
++ TOOLS_TARGET_PAIRS=mlib-tgt.adb<5lml-tgt.adb
++ THREADSLIB=-lpthread
++ GNATLIB_SHARED=gnatlib-shared-dual
++ PREFIX_OBJS=$(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
- ifeq ($(strip $(filter-out hppa% linux%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-linux.ads \
-@@ -1287,6 +1312,31 @@
- LIBRARY_VERSION := $(LIB_VERSION)
- endif
-
+ifeq ($(strip $(filter-out sparc% linux%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
-+ a-intnam.ads<a-intnam-linux.ads \
-+ s-inmaop.adb<s-inmaop-posix.adb \
-+ s-intman.adb<s-intman-posix.adb \
-+ s-osinte.adb<s-osinte-posix.adb \
-+ s-osinte.ads<s-osinte-linux.ads \
-+ s-osprim.adb<s-osprim-posix.adb \
-+ s-taprop.adb<s-taprop-linux.adb \
-+ s-taspri.ads<s-taspri-linux.ads \
-+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
-+ s-parame.adb<s-parame-linux.adb \
-+ system.ads<system-linux-sparc.ads
++ a-intnam.ads<4lintnam.ads \
++ s-inmaop.adb<7sinmaop.adb \
++ s-intman.adb<7sintman.adb \
++ s-osinte.ads<5iosinte.ads \
++ s-osinte.adb<5iosinte.adb \
++ s-osprim.adb<7sosprim.adb \
++ s-taprop.adb<5itaprop.adb \
++ s-tpopsp.adb<5atpopsp.adb \
++ s-taspri.ads<5itaspri.ads
++# system.ads<5ssystem.ads (Tick and Stack_Check_Probes differ)
++ TOOLS_TARGET_PAIRS=mlib-tgt.adb<5lml-tgt.adb
++ THREADSLIB=-lpthread
++ GNATLIB_SHARED=gnatlib-shared-dual
++ PREFIX_OBJS=$(PREFIX_REAL_OBJS)
++ LIBRARY_VERSION := $(LIB_VERSION)
++endif
+
-+ TOOLS_TARGET_PAIRS = \
-+ mlib-tgt.adb<mlib-tgt-linux.adb \
-+ indepsw.adb<indepsw-linux.adb
++ifeq ($(strip $(filter-out ppc% linux%,$(arch) $(osys))),)
++ LIBGNAT_TARGET_PAIRS = \
++ a-intnam.ads<4lintnam.ads \
++ s-inmaop.adb<7sinmaop.adb \
++ s-intman.adb<7sintman.adb \
++ s-osinte.ads<5iosinte.ads \
++ s-osinte.adb<5iosinte.adb \
++ s-osprim.adb<7sosprim.adb \
++ s-taprop.adb<5itaprop.adb \
++ s-tpopsp.adb<5atpopsp.adb \
++ s-taspri.ads<5itaspri.ads
++# system.ads<59system.ads (???)
++ TOOLS_TARGET_PAIRS=mlib-tgt.adb<5lml-tgt.adb
++ THREADSLIB=-lpthread
++ GNATLIB_SHARED=gnatlib-shared-dual
++ PREFIX_OBJS=$(PREFIX_REAL_OBJS)
++ LIBRARY_VERSION := $(LIB_VERSION)
++endif
+
-+ THREADSLIB = -lpthread
-+ GNATLIB_SHARED = gnatlib-shared-dual
-+ GMEM_LIB = gmemlib
-+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
++ifeq ($(strip $(filter-out powerpc% linux%,$(arch) $(osys))),)
++ LIBGNAT_TARGET_PAIRS = \
++ a-intnam.ads<4lintnam.ads \
++ s-inmaop.adb<7sinmaop.adb \
++ s-intman.adb<7sintman.adb \
++ s-osinte.ads<5iosinte.ads \
++ s-osinte.adb<5iosinte.adb \
++ s-osprim.adb<7sosprim.adb \
++ s-taprop.adb<5itaprop.adb \
++ s-tpopsp.adb<5atpopsp.adb \
++ s-taspri.ads<5itaspri.ads
++# system.ads<59system.ads (???)
++ TOOLS_TARGET_PAIRS=mlib-tgt.adb<5lml-tgt.adb
++ THREADSLIB=-lpthread
++ GNATLIB_SHARED=gnatlib-shared-dual
++ PREFIX_OBJS=$(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
- ifeq ($(strip $(filter-out powerpc darwin%,$(arch) $(osys))),)
++ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
++ TOOLS_TARGET_PAIRS=mlib-tgt.adb<5lml-tgt.adb
++ THREADSLIB=-lpthread
++ GNATLIB_SHARED=gnatlib-shared-dual
++ PREFIX_OBJS=$(PREFIX_REAL_OBJS)
++ LIBRARY_VERSION := $(LIB_VERSION)
++endif
++
+ ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),)
LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-darwin.ads \
-@@ -1364,7 +1414,7 @@
- s-[a-o]*.adb s-[p-z]*.adb s-[a-o]*.ads s-[p-z]*.ads
-
- LIBGNAT=../rts/libgnat.a
--GCC_LINK="$(CC) -static-libgcc $(ADA_INCLUDES)"
-+GCC_LINK="$(CC) $(ADA_INCLUDES)"
+ a-intnam.ads<4lintnam.ads \
+@@ -1767,6 +1840,9 @@
+ # is guaranteed to overflow the buffer.
- # when compiling the tools, the runtime has to be first on the path so that
- # it hides the runtime files lying with the rest of the sources
-@@ -1644,7 +1694,8 @@
- -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(GNATRTL_TASKING_OBJS) \
- $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
-- $(THREADSLIB)
-+ $(THREADSLIB) \
-+ ./libgnat-$(LIBRARY_VERSION)$(soext)
- cd rts; $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
- libgnat$(soext)
- cd rts; $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
-@@ -1691,7 +1742,7 @@
+ gnatlib: ../stamp-gnatlib1 ../stamp-gnatlib2
++ $(RMDIR) save
++ $(MKDIR) save
++ $(MV) *.o save/
+ $(MAKE) -C rts CC="../../xgcc -B../../" \
+ INCLUDES="$(INCLUDES_FOR_SUBDIR) -I./../.." \
+ CFLAGS="$(GNATLIBCFLAGS_FOR_C)" \
+@@ -1779,6 +1855,8 @@
+ srcdir=$(fsrcdir) \
+ -f ../Makefile \
+ $(GNATRTL_OBJS)
++ $(MV) save/*.o .
++ $(RMDIR) save
+ $(RM) rts/libgnat$(arext) rts/libgnarl$(arext)
+ $(AR) $(AR_FLAGS) rts/libgnat$(arext) \
+ $(addprefix rts/,$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS))
+@@ -1891,14 +1969,15 @@
THREAD_KIND="$(THREAD_KIND)" \
gnatlib
- $(RM) rts/libgna*$(soext)
+ $(RM) rts/libgnat$(soext) rts/libgnarl$(soext)
- cd rts; ../../xgcc -B../../ -shared $(TARGET_LIBGCC2_CFLAGS) \
+ cd rts; ../../xgcc -B../../ -shared -shared-libgcc $(TARGET_LIBGCC2_CFLAGS) \
- -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ -o libgnat-$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
- $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB)
---- gcc-4.0-20050514/gcc/ada.orig/system-linux-sparc64.ads 1970-01-01 00:00:00.000000000 +0000
-+++ gcc-4.0-20050514/gcc/ada/system-linux-sparc64.ads 2005-05-21 18:34:52.000000000 +0000
-@@ -0,0 +1,151 @@
-+------------------------------------------------------------------------------
-+-- --
-+-- GNAT RUN-TIME COMPONENTS --
-+-- --
-+-- S Y S T E M --
-+-- --
-+-- S p e c --
-+-- (GNU/Linux-SPARC64 Version) --
-+-- --
-+-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-+-- --
-+-- This specification is derived from the Ada Reference Manual for use with --
-+-- GNAT. The copyright notice above, and the license provisions that follow --
-+-- apply solely to the contents of the part following the private keyword. --
-+-- --
-+-- GNAT is free software; you can redistribute it and/or modify it under --
-+-- terms of the GNU General Public License as published by the Free Soft- --
-+-- ware Foundation; either version 2, or (at your option) any later ver- --
-+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
-+-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-+-- MA 02111-1307, USA. --
-+-- --
-+-- As a special exception, if other files instantiate generics from this --
-+-- unit, or you link this unit with other files to produce an executable, --
-+-- this unit does not by itself cause the resulting executable to be --
-+-- covered by the GNU General Public License. This exception does not --
-+-- however invalidate any other reasons why the executable file might be --
-+-- covered by the GNU Public License. --
-+-- --
-+-- GNAT was originally developed by the GNAT team at New York University. --
-+-- Extensive contributions were provided by Ada Core Technologies Inc. --
-+-- --
-+------------------------------------------------------------------------------
-+
-+package System is
-+pragma Pure (System);
-+-- Note that we take advantage of the implementation permission to
-+-- make this unit Pure instead of Preelaborable, see RM 13.7(36)
-+
-+ type Name is (SYSTEM_NAME_GNAT);
-+ System_Name : constant Name := SYSTEM_NAME_GNAT;
-+
-+ -- System-Dependent Named Numbers
-+
-+ Min_Int : constant := Long_Long_Integer'First;
-+ Max_Int : constant := Long_Long_Integer'Last;
-+
-+ Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
-+ Max_Nonbinary_Modulus : constant := Integer'Last;
-+
-+ Max_Base_Digits : constant := Long_Long_Float'Digits;
-+ Max_Digits : constant := Long_Long_Float'Digits;
-+
-+ Max_Mantissa : constant := 63;
-+ Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
-+
-+ Tick : constant := 0.000_001;
-+
-+ -- Storage-related Declarations
-+
-+ type Address is private;
-+ Null_Address : constant Address;
-+
-+ Storage_Unit : constant := 8;
-+ Word_Size : constant := 64;
-+ Memory_Size : constant := 2 ** 64;
-+
-+ -- Address comparison
-+
-+ function "<" (Left, Right : Address) return Boolean;
-+ function "<=" (Left, Right : Address) return Boolean;
-+ function ">" (Left, Right : Address) return Boolean;
-+ function ">=" (Left, Right : Address) return Boolean;
-+ function "=" (Left, Right : Address) return Boolean;
-+
-+ pragma Import (Intrinsic, "<");
-+ pragma Import (Intrinsic, "<=");
-+ pragma Import (Intrinsic, ">");
-+ pragma Import (Intrinsic, ">=");
-+ pragma Import (Intrinsic, "=");
-+
-+ -- Other System-Dependent Declarations
-+
-+ type Bit_Order is (High_Order_First, Low_Order_First);
-+ Default_Bit_Order : constant Bit_Order := High_Order_First;
-+
-+ -- Priority-related Declarations (RM D.1)
-+
-+ Max_Priority : constant Positive := 30;
-+ Max_Interrupt_Priority : constant Positive := 31;
-+
-+ subtype Any_Priority is Integer range 0 .. 31;
-+ subtype Priority is Any_Priority range 0 .. 30;
-+ subtype Interrupt_Priority is Any_Priority range 31 .. 31;
-+
-+ Default_Priority : constant Priority := 15;
-+
-+private
-+
-+ type Address is mod Memory_Size;
-+ Null_Address : constant Address := 0;
-+
-+ --------------------------------------
-+ -- System Implementation Parameters --
-+ --------------------------------------
-+
-+ -- These parameters provide information about the target that is used
-+ -- by the compiler. They are in the private part of System, where they
-+ -- can be accessed using the special circuitry in the Targparm unit
-+ -- whose source should be consulted for more detailed descriptions
-+ -- of the individual switch values.
-+
-+ AAMP : constant Boolean := False;
-+ Backend_Divide_Checks : constant Boolean := False;
-+ Backend_Overflow_Checks : constant Boolean := False;
-+ Command_Line_Args : constant Boolean := True;
-+ Configurable_Run_Time : constant Boolean := False;
-+ Denorm : constant Boolean := True;
-+ Duration_32_Bits : constant Boolean := False;
-+ Exit_Status_Supported : constant Boolean := True;
-+ Fractional_Fixed_Ops : constant Boolean := False;
-+ Frontend_Layout : constant Boolean := False;
-+ Functions_Return_By_DSP : constant Boolean := False;
-+ Machine_Overflows : constant Boolean := False;
-+ Machine_Rounds : constant Boolean := True;
-+ OpenVMS : constant Boolean := False;
-+ Preallocated_Stacks : constant Boolean := False;
-+ Signed_Zeros : constant Boolean := True;
-+ Stack_Check_Default : constant Boolean := False;
-+ Stack_Check_Probes : constant Boolean := False;
-+ Support_64_Bit_Divides : constant Boolean := True;
-+ Support_Aggregates : constant Boolean := True;
-+ Support_Composite_Assign : constant Boolean := True;
-+ Support_Composite_Compare : constant Boolean := True;
-+ Support_Long_Shifts : constant Boolean := True;
-+ Suppress_Standard_Library : constant Boolean := False;
-+ Use_Ada_Main_Program_Name : constant Boolean := False;
-+ ZCX_By_Default : constant Boolean := True;
-+ GCC_ZCX_Support : constant Boolean := True;
-+ Front_End_ZCX_Support : constant Boolean := False;
-+
-+ -- Obsolete entries, to be removed eventually (bootstrap issues!)
-+
-+ High_Integrity_Mode : constant Boolean := False;
-+ Long_Shifts_Inlined : constant Boolean := True;
-+
-+end System;
+ $(SO_OPTS)libgnat-$(LIBRARY_VERSION)$(soext) $(MISCLIB) -lm
+ cd rts; ../../xgcc -B../../ -shared $(TARGET_LIBGCC2_CFLAGS) \
+ -o libgnarl-$(LIBRARY_VERSION)$(soext) \
+ $(GNATRTL_TASKING_OBJS) \
+- $(SO_OPTS)libgnarl-$(LIBRARY_VERSION)$(soext) $(THREADSLIB)
++ $(SO_OPTS)libgnarl-$(LIBRARY_VERSION)$(soext) $(THREADSLIB) \
++ ./libgnat-$(LIBRARY_VERSION)$(soext)
+ cd rts; $(LN_S) libgnat-$(LIBRARY_VERSION)$(soext) libgnat$(soext)
+ cd rts; $(LN_S) libgnarl-$(LIBRARY_VERSION)$(soext) libgnarl$(soext)
+
+++ /dev/null
-#! /bin/sh -e
-
-# All lines beginning with `# DP:' are a description of the patch.
-# DP: Fix for complex math on alpha
-
-if [ $# -eq 3 -a "$2" = '-d' ]; then
- pdir="-d $3"
-elif [ $# -ne 1 ]; then
- echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
- exit 1
-fi
-case "$1" in
- -patch) patch $pdir -f --no-backup-if-mismatch -p1 < $0;;
- -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p1 < $0;;
- *)
- echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
- exit 1
-esac
-exit 0
-
-(from Joel Klecker's original message):
-
- I've tested this patch with building glibc and it enables it to compile, I
- haven't been able to test the resulting binaries yet, however. I assume
- this will fix the g77 problems too.
-
- * flow.c (insn_dead_p): Don't kill part of a complex number.
- * emit-rtl.c (gen_lowpart_common): Handle narrow complex reg values.
- (gen_highpart): Likewise.
- * calls.c (expand_call): Narrow complex variable uses two regs.
- * alpha/alpha.h (ALPHA_ARG_SIZE): Likewise.
- (HARD_REGNO_NREGS): Likewise.
-
-diff -ur gcc-2.95.2/gcc/calls.c gcc-2.95.2.patched/gcc/calls.c
---- gcc-2.95.2/gcc/calls.c Fri May 7 21:58:39 1999
-+++ gcc-2.95.2.patched/gcc/calls.c Sat Feb 19 14:26:21 2000
-@@ -1499,6 +1499,11 @@
- validize_mem (args[i].value), nregs,
- args[i].mode);
-
-+ /* Indicate two regs used to hold a short complex arg. */
-+ if (GET_MODE_CLASS (args[i].mode) == MODE_COMPLEX_FLOAT
-+ && GET_MODE_SIZE (args[i].mode) <= UNITS_PER_WORD)
-+ nregs = 2;
-+
- /* Handle calls that pass values in multiple non-contiguous
- locations. The Irix 6 ABI has examples of this. */
- if (GET_CODE (reg) == PARALLEL)
-diff -ur gcc-2.95.2/gcc/config/alpha/alpha.h gcc-2.95.2.patched/gcc/config/alpha/alpha.h
---- gcc-2.95.2/gcc/config/alpha/alpha.h Fri Jun 25 01:09:12 1999
-+++ gcc-2.95.2.patched/gcc/config/alpha/alpha.h Sat Feb 19 14:28:45 2000
-@@ -622,7 +622,10 @@
- but can be less for certain modes in special long registers. */
-
- #define HARD_REGNO_NREGS(REGNO, MODE) \
-- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-+ ((GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT \
-+ && GET_MODE_SIZE (MODE) <= UNITS_PER_WORD) \
-+ ? 2 \
-+ : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
- /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On Alpha, the integer registers can hold any mode. The floating-point
-@@ -1070,12 +1073,16 @@
- #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) (CUM) = 0
-
- /* Define intermediate macro to compute the size (in registers) of an argument
-- for the Alpha. */
-+ for the Alpha.
-+ A short complex arg takes two registers. */
-
- #define ALPHA_ARG_SIZE(MODE, TYPE, NAMED) \
--((MODE) != BLKmode \
-- ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \
-- : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
-+ ((GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT \
-+ && GET_MODE_SIZE (MODE) <= UNITS_PER_WORD) \
-+ ? 2 \
-+ : ((MODE) != BLKmode \
-+ ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \
-+ : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD))
-
- /* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
-diff -ur gcc-2.95.2/gcc/emit-rtl.c gcc-2.95.2.patched/gcc/emit-rtl.c
---- gcc-2.95.2/gcc/emit-rtl.c Wed Aug 11 03:28:52 1999
-+++ gcc-2.95.2.patched/gcc/emit-rtl.c Sat Feb 19 14:31:19 2000
-@@ -749,6 +749,15 @@
- && ! HARD_REGNO_MODE_OK (REGNO (x) + word, mode)
- && HARD_REGNO_MODE_OK (REGNO (x), GET_MODE (x)))
- return 0;
-+ else if (GET_MODE_CLASS (GET_MODE (x)) == MODE_COMPLEX_FLOAT
-+ && GET_MODE_SIZE (GET_MODE (x)) <= UNITS_PER_WORD
-+ && REGNO (x) < FIRST_PSEUDO_REGISTER)
-+ {
-+ if (REG_FUNCTION_VALUE_P (x))
-+ return gen_rtx (SUBREG, mode, x, 0);
-+ else
-+ return gen_rtx (REG, mode, REGNO (x));
-+ }
- else if (REGNO (x) < FIRST_PSEUDO_REGISTER
- /* integrate.c can't handle parts of a return value register. */
- && (! REG_FUNCTION_VALUE_P (x)
-@@ -972,11 +981,6 @@
- {
- if (GET_CODE (x) == CONCAT && GET_MODE (XEXP (x, 0)) == mode)
- return XEXP (x, 0);
-- else if (WORDS_BIG_ENDIAN
-- && GET_MODE_BITSIZE (mode) < BITS_PER_WORD
-- && REG_P (x)
-- && REGNO (x) < FIRST_PSEUDO_REGISTER)
-- fatal ("Unable to access real part of complex value in a hard register on this target");
- else if (WORDS_BIG_ENDIAN)
- return gen_highpart (mode, x);
- else
-@@ -995,11 +999,6 @@
- return XEXP (x, 1);
- else if (WORDS_BIG_ENDIAN)
- return gen_lowpart (mode, x);
-- else if (!WORDS_BIG_ENDIAN
-- && GET_MODE_BITSIZE (mode) < BITS_PER_WORD
-- && REG_P (x)
-- && REGNO (x) < FIRST_PSEUDO_REGISTER)
-- fatal ("Unable to access imaginary part of complex value in a hard register on this target");
- else
- return gen_highpart (mode, x);
- }
-@@ -1134,6 +1133,16 @@
- word = ((GET_MODE_SIZE (GET_MODE (x))
- - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD))
- / UNITS_PER_WORD);
-+
-+ if (GET_MODE_CLASS (GET_MODE (x)) == MODE_COMPLEX_FLOAT
-+ && GET_MODE_SIZE (GET_MODE (x)) <= UNITS_PER_WORD
-+ && REGNO (x) < FIRST_PSEUDO_REGISTER)
-+ {
-+ if (REG_FUNCTION_VALUE_P (x))
-+ return gen_rtx (SUBREG, mode, x, 1);
-+ else
-+ return gen_rtx (REG, mode, REGNO (x) + 1);
-+ }
-
- if (REGNO (x) < FIRST_PSEUDO_REGISTER
- /* integrate.c can't handle parts of a return value register. */
-diff -ur gcc-2.95.2/gcc/flow.c gcc-2.95.2.patched/gcc/flow.c
---- gcc-2.95.2/gcc/flow.c Wed Aug 4 03:09:48 1999
-+++ gcc-2.95.2.patched/gcc/flow.c Sat Feb 19 14:34:02 2000
-@@ -2995,6 +2995,10 @@
- while (--n > 0)
- if (REGNO_REG_SET_P (needed, regno+n))
- return 0;
-+
-+ /* Don't allow part of a complex number to be deleted. */
-+ if (GET_MODE_CLASS (GET_MODE (r)) == MODE_COMPLEX_FLOAT)
-+ return 0;
- }
-
- return 1;
-
-
+++ /dev/null
-PR target/16092 fix backport from gcc 3.4.0
---- gcc-3.3.4/gcc/config/i386/i386.c.orig 2004-05-18 07:07:52.000000000 +0200
-+++ gcc-3.3.4/gcc/config/i386/i386.c 2004-06-20 19:17:22.244016950 +0200
-@@ -14673,15 +14673,14 @@
- output_asm_insn ("mov{l}\t{%0, %1|%1, %0}", xops);
- }
-
-- xops[0] = DECL_RTL (function);
-+ xops[0] = XEXP (DECL_RTL (function), 0);
- if (TARGET_64BIT)
- {
- if (!flag_pic || (*targetm.binds_local_p) (function))
- output_asm_insn ("jmp\t%P0", xops);
- else
- {
-- tmp = XEXP (xops[0], 0);
-- tmp = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, tmp), UNSPEC_GOTPCREL);
-+ tmp = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, xops[0]), UNSPEC_GOTPCREL);
- tmp = gen_rtx_CONST (Pmode, tmp);
- tmp = gen_rtx_MEM (QImode, tmp);
- xops[0] = tmp;
+++ /dev/null
-# DP: Make bootstrap: restartable at any point
-# DP: From: Donn Terry <donn@interix.com>
-
-Make bootstrap: restartable at any point.
-
-This is in response to a discussion on this topic. This is "take 2" |
-which should work with parallel builds, though I haven't tested that. |
-
-When doing a make bootstrap, it's hard to know (at least when
-not throughly versed in the process details) how to restart
-after making a fix. In general, retyping "make bootstrap"
-will do the wrong thing (particularly if the host and target
-compilers object files are incompatible!)
-
-This change keeps track of the stages completed. The old
-bootstrap2[234] (and *-lean) targets are rewritten, but work the
-same.
-
-I've tested this by doing a make bootstrap (on CVS sources as of |
-last night) and by typing 'make bootstrap' after it's done, |
-in which case it thinks a moment and does nothing. (Which is exactly
-the right answer.)
-
-I've also done a complete regression, with no surprises. |
-
-I tested whether stopping/restarting at a few arbitrary points along the
-way works with older sources, but haven't tested it real recently,
-except to do a ^C halfway through a testbuild at one point. |
-Again, if it works at all, it should work as well as it ever did.
-I specficially did test it during the period where make bootstrap
-wasn't succeeding for me, and it helped a LOT in being able to pick up
-where I left off.
-
-An interesting side-effect: make bootstrap-lean after a make bootstrap |
-JUST cleans out stage1, with no unwanted consequences. |
-
-
-Fri May 28 15:27:02 1999 Donn Terry (donn@interix.com)
- * Makefile.in: restructure bootstrap stages to allow
- clean restart after failure.
-
-diff -urP egcs.source.old/gcc/Makefile.in egcs.source/gcc/Makefile.in
---- egcs.source.old/gcc/Makefile.in Sun May 23 13:39:21 1999
-+++ egcs.source/gcc/Makefile.in Thu May 27 16:59:42 1999
-@@ -2360,6 +2360,8 @@ clean: mostlyclean intl.clean lang.clean
- rm -rf `echo $(MULTILIB_OPTIONS) | sed -e 's/\// /g'`; \
- fi ; fi
- -rm -fr stage1 stage2 stage3 stage4
-+ -rm -f boot_stage_a boot_stage_b boot_stage_c boot_stage_d
-+ -rm -f boot_stage_e boot_stage_f
-
- # Delete all files that users would normally create
- # while building and installing GCC.
-@@ -2924,33 +2926,83 @@ diff:
- $(LANG_DIFF_EXCLUDES) \
- gcc-$(oldversion) gcc-$(version) > gcc-$(oldversion)-$(version).diff
-
--bootstrap bootstrap-lean: force
-+
- # Only build the C compiler for stage1, because that is the only one that
- # we can guarantee will build with the native compiler, and also it is the
- # only thing useful for building stage2.
-- $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)"
-- $(MAKE) stage1
-+boot_stage_a:
-+ +$(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)"
-+ touch boot_stage_a
-+ echo ---------------------- stage a complete ---------------------
-+
-+boot_stage_b:
-+ +$(MAKE) stage1
-+ touch boot_stage_b
-+ echo ---------------------- stage b complete ---------------------
-+
- # This used to define ALLOCA as empty, but that would lead to bad results
- # for a subsequent `make install' since that would not have ALLOCA empty.
- # To prevent `make install' from compiling alloca.o and then relinking cc1
- # because alloca.o is newer, we permit these recursive makes to compile
- # alloca.o. Then cc1 is newer, so it won't have to be relinked.
-- $(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
-- $(MAKE) stage2
-- -if test $@ = bootstrap-lean; then rm -rf stage1; else true; fi
-- $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
-+boot_stage_c:
-+ +$(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
-+ touch boot_stage_c
-+ echo ---------------------- stage c complete ---------------------
-
--bootstrap2 bootstrap2-lean: force
-- $(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
-- $(MAKE) stage2
-- -if test $@ = bootstrap2-lean; then rm -rf stage1; else true; fi
-- $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
-+boot_stage_d:
-+ +$(MAKE) stage2
-+ touch boot_stage_d
-+ echo ---------------------- stage d complete ---------------------
-
--bootstrap3 bootstrap3-lean: force
-- $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
-+boot_stage_e:
-+ +$(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
-+ touch boot_stage_e
-+ echo ---------------------- stage e complete ---------------------
-+
-+# Only bootstrap4 uses stage f.
-+boot_stage_f:
-+ +$(MAKE) CC="stage3/xgcc$(exeext) -Bstage3/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage3/ LANGUAGES="$(LANGUAGES)"
-+ touch boot_stage_f
-+ echo ---------------------- stage f complete ---------------------
-+
-+boot_clean_stage1:
-+ rm -rf stage1
-+
-+# This next little bit is the way it is for parallel builds. It's simply
-+# a chain of stages which DO have to be done sequentially.
-+
-+bootstrap_a: boot_stage_a
-+bootstrap_b: bootstrap_a boot_stage_b
-+bootstrap_c: bootstrap_b boot_stage_c
-+bootstrap_d: bootstrap_c boot_stage_d
-+bootstrap_e: bootstrap_d boot_stage_e
-+bootstrap: force bootstrap_e
-+
-+bootstrap-lean_a: boot_stage_a
-+bootstrap-lean_b: bootstrap-lean_a boot_stage_b
-+bootstrap-lean_c: bootstrap-lean_b boot_stage_c
-+bootstrap-lean_d: bootstrap-lean_c boot_stage_d
-+bootstrap-lean_e: bootstrap-lean_d boot_clean_stage1
-+bootstrap-lean_f: bootstrap-lean_e boot_stage_e
-+bootstrap-lean: force bootstrap-lean_f
-+
-+bootstrap2_c: boot_stage_c
-+bootstrap2_d: bootstrap2_c boot_stage_d
-+bootstrap2_e: bootstrap2_d boot_stage_e
-+bootstrap2: force bootstrap2_e
-+
-+bootstrap2-lean_c: boot_stage_c
-+bootstrap2-lean_d: bootstrap2-lean_c boot_stage_d
-+bootstrap2-lean_e: bootstrap2-lean_d boot_clean_stage1
-+bootstrap2-lean_f: bootstrap2-lean_e boot_stage_e
-+bootstrap2-lean: force bootstrap2-lean_f
-+
-+bootstrap3 bootstrap3-lean: force boot_stage_e
-+
-+# Only bootstrap4 uses stage f.
-+bootstrap4 bootstrap4-lean: force boot_stage_f
-
--bootstrap4 bootstrap4-lean: force
-- $(MAKE) CC="stage3/xgcc$(exeext) -Bstage3/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage3/ LANGUAGES="$(LANGUAGES)"
-
- # Compare the object files in the current directory with those in the
- # stage2 directory.
+++ /dev/null
-# DP: On Sparc, message forwarding in the GNUstep framework
-# DP: (gstep-base) relies on this patch. I didn't experience any side
-# DP: effects of this "workaround" on a sparc Solaris platform. However
-# DP: this workaround affects the all compilers of the egcs package.
-
-From: Richard Henderson <rth@dot.cygnus.com>
-To: Matthias.Klose@cs.tu-berlin.de, scottc@net-community.com
-Subject: Re: patch for expand_builtin_apply for sparc architecture
-Date: Mon, 16 Feb 1998 05:11:32 -0800
-
-In article <199802160833.JAA11275.cygnus.egcs.bugs@gargleblaster.cs.tu-berlin.de>,
-Matthias Klose <Matthias.Klose@cs.tu-berlin.de> wrote:
->The following patch fixes the generation of an 'unimp 4095'
->instruction for the expansion of __builtin_apply on the sparc
->architecture; fix by Scott Christley (<scottc@net-community.com>), but
->doesn't seem to be submitted to the the egcs list.
-
-You'll have to submit a test case and an explanation of why you think
-this is correct. The Sparc32 ABI calls for an unimp instruction to
-be emitted following calls to functions that return structures. The
-0-4095 immediate is commentary, but that's all the room in that field
-so we cannot simply remove the mask.
-
-My guess is that it is yet another example of why __builtin_apply
-is inadequate for the needs of all but completely stack-based calling
-conventions and should not be used.
-
-
-r~
-
-diff -c gcc/config/sparc/sparc.md~ gcc/config/sparc/sparc.md
-*** gcc/config/sparc/sparc.md~ Mon Nov 16 12:31:32 1998
---- gcc/config/sparc/sparc.md Mon Nov 16 12:35:56 1998
-***************
-*** 7294,7299 ****
---- 7294,7300 ----
- Why cannot we have delay slots filled if it were a CALL? */
-
- if (! TARGET_ARCH64 && INTVAL (operands[3]) != 0)
-+ #if 0
- emit_jump_insn
- (gen_rtx_PARALLEL (VOIDmode,
- gen_rtvec (3,
-***************
-*** 7302,7307 ****
---- 7303,7318 ----
- GEN_INT (INTVAL (operands[3]) & 0xfff),
- gen_rtx_CLOBBER (VOIDmode,
- gen_rtx_REG (Pmode, 15)))));
-+ #else
-+ emit_jump_insn
-+ (gen_rtx_PARALLEL (VOIDmode,
-+ gen_rtvec (3,
-+ gen_rtx_SET (VOIDmode, pc_rtx,
-+ XEXP (operands[0], 0)),
-+ operands[3],
-+ gen_rtx_CLOBBER (VOIDmode,
-+ gen_rtx_REG (Pmode, 15)))));
-+ #endif
- else
- emit_jump_insn
- (gen_rtx_PARALLEL (VOIDmode,
+++ /dev/null
---- gcc-3.3.5/gcc/config/rs6000/eabi.asm~ Fri Oct 8 15:13:48 2004
-+++ gcc-3.3.5/gcc/config/rs6000/eabi.asm Fri Oct 8 15:13:48 2004
-@@ -252,7 +252,7 @@
-
- .Lcvt:
- lwzu 6,4(3) /* pointer to convert */
-- cmpi 0,6,0
-+ cmpwi 0,6,0
- beq- .Lcvt2 /* if pointer is null, don't convert */
-
- add 6,6,12 /* convert pointer */
+++ /dev/null
-# DP: Handle DOS newlines after backslashes.
-# DP: Patch from http://www.cygnus.com/ml/egcs/1999-Jan/0784.html
-
---- gcc/cccp.c.orig Thu Jun 24 15:11:40 1999
-+++ gcc/cccp.c Mon Aug 9 12:21:55 1999
-@@ -1023,7 +1023,8 @@
- retrying if necessary. If MAX_READ_LEN is defined, read at most
- that bytes at a time. Return a negative value if an error occurs,
- otherwise return the actual number of bytes read,
-- which must be LEN unless end-of-file was reached. */
-+ which may be < LEN if CRs have been skipped, though we try not to do
-+ that. */
-
- static int
- safe_read (desc, ptr, len)
-@@ -1032,6 +1033,7 @@
- int len;
- {
- int left, rcount, nchars;
-+ char *rptr;
-
- left = len;
- while (left > 0) {
-@@ -1051,8 +1053,20 @@
- }
- if (nchars == 0)
- break;
-- ptr += nchars;
-+
-+ /* CRLF pairs, found with Unix when processing DOS files,
-+ throw off backslash-newline removal.
-+ Therefore, CRs are thrown away here. */
- left -= nchars;
-+ rptr = ptr;
-+ while(nchars--)
-+ {
-+ if(*rptr == '\r' && *(rptr+1) == '\n')
-+ left++;
-+ else
-+ *ptr++ = *rptr;
-+ rptr++;
-+ }
- }
- return len - left;
- }
-@@ -2085,8 +2099,8 @@
- for (;;) {
- cnt = safe_read (f, (char *) fp->buf + size, bsize - size);
- if (cnt < 0) goto perror; /* error! */
-+ if (cnt == 0) break; /* End of file */
- size += cnt;
-- if (size != bsize) break; /* End of file */
- bsize *= 2;
- fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2);
- }
-@@ -5024,6 +5038,8 @@
- map_list_ptr->map_list_map = ptr;
-
- while ((ch = getc (f)) != '\n')
-+ if (ch == '\r')
-+ continue;
- if (ch == EOF)
- break;
- }
-@@ -5256,9 +5272,9 @@
- i = safe_read (f, (char *) fp->buf + st_size, bsize - st_size);
- if (i < 0)
- goto nope; /* error! */
-- st_size += i;
-- if (st_size != bsize)
-+ if (i == 0)
- break; /* End of file */
-+ st_size += i;
- bsize *= 2;
- fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2);
- }
+++ /dev/null
-# DP: cpp.texi: add a node documenting macro varargs.
-
-Sat Aug 7 14:56:50 1999 Matthias Klose <doko@cs.tu-berlin.de>
-
- * cpp.texi: cpp.texi: add a node documenting macro varargs (copied
- from extend.texi.
-
---- gcc/cpp.texi~ Wed May 19 13:22:57 1999
-+++ gcc/cpp.texi Sat Aug 7 14:53:42 1999
-@@ -542,6 +542,7 @@
- * Simple Macros:: Macros that always expand the same way.
- * Argument Macros:: Macros that accept arguments that are substituted
- into the macro expansion.
-+* Macro Varargs:: Macros with variable number of arguments.
- * Predefined:: Predefined macros that are always available.
- * Stringification:: Macro arguments converted into string constants.
- * Concatenation:: Building tokens from parts taken from macro arguments.
-@@ -645,7 +646,7 @@
- that the result of its expansion is checked for more macro names.
- @xref{Cascaded Macros}.
-
--@node Argument Macros, Predefined, Simple Macros, Macros
-+@node Argument Macros, Macro Varargs, Simple Macros, Macros
- @subsection Macros with Arguments
- @cindex macros with argument
- @cindex arguments in macro definitions
-@@ -799,7 +800,68 @@
- the left parenthesis; it's the @emph{definition} where it matters whether
- there is a space.
-
--@node Predefined, Stringification, Argument Macros, Macros
-+@node Macro Varargs, Predefined, Argument Macros, Macros
-+@subsection Macros with Variable Numbers of Arguments
-+@cindex variable number of arguments
-+@cindex macro with variable arguments
-+@cindex rest argument (in macro)
-+
-+In GNU C, a macro can accept a variable number of arguments, much as a
-+function can. The syntax for defining the macro looks much like that
-+used for a function. Here is an example:
-+
-+@example
-+#define eprintf(format, args...) \
-+ fprintf (stderr, format , ## args)
-+@end example
-+
-+Here @code{args} is a @dfn{rest argument}: it takes in zero or more
-+arguments, as many as the call contains. All of them plus the commas
-+between them form the value of @code{args}, which is substituted into
-+the macro body where @code{args} is used. Thus, we have this expansion:
-+
-+@example
-+eprintf ("%s:%d: ", input_file_name, line_number)
-+@expansion{}
-+fprintf (stderr, "%s:%d: " , input_file_name, line_number)
-+@end example
-+
-+@noindent
-+Note that the comma after the string constant comes from the definition
-+of @code{eprintf}, whereas the last comma comes from the value of
-+@code{args}.
-+
-+The reason for using @samp{##} is to handle the case when @code{args}
-+matches no arguments at all. In this case, @code{args} has an empty
-+value. In this case, the second comma in the definition becomes an
-+embarrassment: if it got through to the expansion of the macro, we would
-+get something like this:
-+
-+@example
-+fprintf (stderr, "success!\n" , )
-+@end example
-+
-+@noindent
-+which is invalid C syntax. @samp{##} gets rid of the comma, so we get
-+the following instead:
-+
-+@example
-+fprintf (stderr, "success!\n")
-+@end example
-+
-+This is a special feature of the GNU C preprocessor: @samp{##} before a
-+rest argument that is empty discards the preceding sequence of
-+non-whitespace characters from the macro definition. (If another macro
-+argument precedes, none of it is discarded.)
-+
-+It might be better to discard the last preprocessor token instead of the
-+last preceding sequence of non-whitespace characters; in fact, we may
-+someday change this feature to do so. We advise you to write the macro
-+definition so that the preceding sequence of non-whitespace characters
-+is just a single token, so that the meaning will not change if we change
-+the definition of this feature.
-+
-+@node Predefined, Stringification, Macro Varargs, Macros
- @subsection Predefined Macros
-
- @cindex predefined macros
+++ /dev/null
-diff -urN gcc-2.95.3.org/gcc/config/i386/linux.h gcc-2.95.3/gcc/config/i386/linux.h
---- gcc-2.95.3.org/gcc/config/i386/linux.h Mon Mar 19 19:35:22 2001
-+++ gcc-2.95.3/gcc/config/i386/linux.h Mon Mar 19 19:36:46 2001
-@@ -234,3 +234,21 @@
- } \
- } while (0)
- #endif
-+
-+#if defined(__PIC__) && defined (USE_GNULIBC_1)
-+/* This is a kludge. The i386 GNU/Linux dynamic linker needs ___brk_addr,
-+ __environ and atexit (). We have to make sure they are in the .dynsym
-+ section. We accomplish it by making a dummy call here. This
-+ code is never reached. */
-+
-+#define CRT_END_INIT_DUMMY \
-+ do \
-+ { \
-+ extern void *___brk_addr; \
-+ extern char **__environ; \
-+ \
-+ ___brk_addr = __environ; \
-+ atexit (0); \
-+ } \
-+ while (0)
-+#endif
-diff -urN gcc-2.95.3.org/gcc/crtstuff.c gcc-2.95.3/gcc/crtstuff.c
---- gcc-2.95.3.org/gcc/crtstuff.c Mon Mar 19 19:35:22 2001
-+++ gcc-2.95.3/gcc/crtstuff.c Mon Mar 19 19:37:56 2001
-@@ -379,20 +379,8 @@
- FORCE_INIT_SECTION_ALIGN;
- #endif
- asm (TEXT_SECTION_ASM_OP);
--
--/* This is a kludge. The i386 GNU/Linux dynamic linker needs ___brk_addr,
-- __environ and atexit (). We have to make sure they are in the .dynsym
-- section. We accomplish it by making a dummy call here. This
-- code is never reached. */
--
--#if defined(__linux__) && defined(__PIC__) && defined(__i386__)
-- {
-- extern void *___brk_addr;
-- extern char **__environ;
--
-- ___brk_addr = __environ;
-- atexit ();
-- }
-+#ifdef CRT_END_INIT_DUMMY
-+ CRT_END_INIT_DUMMY;
- #endif
- }
-
+++ /dev/null
-> On Thu, Jun 19, 2003 at 08:31:03AM +0200, Jan Hubicka wrote:
-> > > Nathan Myers <ncm-nospam@cantrip.org> writes:
-> > >
-> > > > gnu/include/c++/3.4/x86_64-unknown-linux-gnu/bits/atomicity.h: In
-> > > > function `int main()':
-> > > > /amd/ncm/gnu/include/c++/3.4/x86_64-unknown-linux-gnu/bits/atomicity.h:43: error: inconsistent
-> > > > operand constraints in an `asm'
-> > >
-> > > Honza, isn't this the bug in gcse that you're hunting down?
-> > Yes, that looks like the same CSE problem. I will try to give it
-> > priority this afternoon so it gets fixed.
->
-> I take it, then, that this is a core compiler bug and not a std headers bug?
-This patch should fix the problem. (at least it fixes it for the
-similar testcase that comes from proprietary program. Do you think you
-can simplify your code into small enought testcase for testsuite?)
-
-Bootstrap passed on x86-64, regtest in progress, OK if it suceeds?
-
-Honza
-
-Sat Jun 21 14:51:44 CEST 2003 Jan Hubicka <jh@suse.cz>
- * cse.c (find_best_addr): Fold the best address discovered.
-Index: cse.c
-===================================================================
-RCS file: /cvs/gcc/gcc/gcc/cse.c,v
-retrieving revision 1.243.2.4
-diff -c -3 -p -r1.243.2.4 cse.c
-*** gcc/gcc/cse.c 6 Jun 2003 10:09:09 -0000 1.243.2.4
---- gcc/gcc/cse.c 21 Jun 2003 12:49:18 -0000
-*************** find_best_addr (insn, loc, mode)
-*** 3021,3029 ****
-
- if (found_better)
- {
-! if (validate_change (insn, loc,
-! canon_reg (copy_rtx (best_elt->exp),
-! NULL_RTX), 0))
- return;
- else
- best_elt->flag = 1;
---- 3021,3049 ----
-
- if (found_better)
- {
-! /* Avoid find_best_addr from touching this address again:
-! at the beggining of this function we attempt to fold
-! the address. Do it now as well. Not doing so would mean
-! that we will create multiple versions of the address in the
-! insn chain that may result in "+m" ASM constraint from not
-! being matched. */
-!
-! rtx best = canon_reg (copy_rtx (best_elt->exp), NULL_RTX);
-! rtx folded = fold_rtx (copy_rtx (best), NULL_RTX);
-! int addr_folded_cost = address_cost (folded, mode);
-! int addr_cost = address_cost (best, mode);
-!
-! if ((addr_folded_cost < addr_cost
-! || (addr_folded_cost == addr_cost
-! /* ??? The rtx_cost comparison is left over from an
-! older version of this code. It is probably no
-! longer helpful. */
-! && (rtx_cost (folded, MEM) > rtx_cost (addr, MEM)
-! || (approx_reg_cost (folded)
-! < approx_reg_cost (addr)))))
-! && validate_change (insn, loc, folded, 0))
-! return;
-! if (validate_change (insn, loc, best, 0))
- return;
- else
- best_elt->flag = 1;
+++ /dev/null
-# DP: set the default architecture to i386; even if gcc is configured
-# DP: with i386-linux, it builds with Pentium instructions, tuned for i386.
-
-From: Joel Klecker <jk@espy.org>
-To: Matthias Klose <doko@cs.tu-berlin.de>
-Subject: Re: gcc: forwarded message from Markus F.X.J. Oberhumer
-Date: Wed, 11 Aug 1999 08:48:54 -0700
-
-Found it, and fixed it.
-
---- gcc/config/i386/i386.c~ Sat Aug 14 19:35:24 1999
-+++ gcc/config/i386/i386.c Sat Aug 14 19:37:00 1999
-@@ -291,7 +291,7 @@
-
- if (ix86_arch_string == 0)
- {
-- ix86_arch_string = PROCESSOR_PENTIUM_STRING;
-+ ix86_arch_string = PROCESSOR_DEFAULT_STRING;
- if (ix86_cpu_string == 0)
- ix86_cpu_string = PROCESSOR_DEFAULT_STRING;
- }
-@@ -308,7 +308,7 @@
- if (i == ptt_size)
- {
- error ("bad value (%s) for -march= switch", ix86_arch_string);
-- ix86_arch_string = PROCESSOR_PENTIUM_STRING;
-+ ix86_arch_string = PROCESSOR_DEFAULT_STRING;
- ix86_arch = PROCESSOR_DEFAULT;
- }
-
+++ /dev/null
-diff -urN gcc-20010319.org/gcc/configure.in gcc-20010319/gcc/configure.in
---- gcc-20010319.org/gcc/configure.in Thu Mar 22 20:30:21 2001
-+++ gcc-20010319/gcc/configure.in Thu Mar 22 20:32:01 2001
-@@ -329,6 +329,7 @@
- ;;
- esac
- ], [enable_shared=yes])
-+enable_shared=no
- AC_SUBST(enable_shared)
-
- # Determine the host, build, and target systems
+++ /dev/null
---- gcc/libjava/classpath/native/jni/qt-peer/componentevent.cpp.ark 2005-11-02 22:57:59.000000000 +0100
-+++ gcc/libjava/classpath/native/jni/qt-peer/componentevent.cpp 2005-11-02 22:58:07.000000000 +0100
-@@ -38,6 +38,8 @@
- #include <QWidget>
- #include <QPoint>
-
-+#include <assert.h>
-+
- #include "componentevent.h"
-
- AWTInitEvent::AWTInitEvent(JNIEnv *env, jobject obj) : AWTEvent()
---- gcc/libjava/classpath/configure.ac.ark 2005-11-02 23:02:44.000000000 +0100
-+++ gcc/libjava/classpath/configure.ac 2005-11-02 23:06:39.000000000 +0100
-@@ -311,6 +311,7 @@
- AC_CHECK_FILE([$EXTRA_QT_INCLUDE_DIR/QWidget],
- QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR",
- AC_MSG_WARN([QWidget not found])))
-+ QT_CFLAGS="$QT_CFLAGS -I\$(top_srcdir)/../../build/\$(shell cat \$(top_srcdir)/../../build/Makefile |grep ^TARGET_SUBDIR |awk '{ print \$\$3; }')/libstdc++-v3/include -I\$(top_srcdir)/../../build/\$(shell cat \$(top_srcdir)/../../build/Makefile |grep ^TARGET_SUBDIR |awk '{ print \$\$3; }')/libstdc++-v3/include/\$(shell cat \$(top_srcdir)/../../build/Makefile |grep ^TARGET_SUBDIR |awk '{ print \$\$3; }') -I\$(top_srcdir)/../../libstdc++-v3/libsupc++"
- AC_MSG_NOTICE([Set QT_CFLAGS... $QT_CFLAGS])
- AC_CHECK_PROG(MOC, [moc], [moc])
- AC_SUBST(QT_CFLAGS)
---- gcc/libjava/classpath/configure.ark 2005-11-02 23:03:14.000000000 +0100
-+++ gcc/libjava/classpath/configure 2005-11-02 23:05:47.000000000 +0100
-@@ -10661,7 +10661,7 @@
- fi
-
- fi
--
-+QT_CFLAGS="$QT_CFLAGS -I\$(top_srcdir)/../../build/\$(shell cat \$(top_srcdir)/../../build/Makefile |grep ^TARGET_SUBDIR |awk '{ print \$\$3; }')/libstdc++-v3/include -I\$(top_srcdir)/../../build/\$(shell cat \$(top_srcdir)/../../build/Makefile |grep ^TARGET_SUBDIR |awk '{ print \$\$3; }')/libstdc++-v3/include/\$(shell cat \$(top_srcdir)/../../build/Makefile |grep ^TARGET_SUBDIR |awk '{ print \$\$3; }') -I\$(top_srcdir)/../../libstdc++-v3/libsupc++"
- { echo "$as_me:$LINENO: Set QT_CFLAGS... $QT_CFLAGS" >&5
- echo "$as_me: Set QT_CFLAGS... $QT_CFLAGS" >&6;}
- # Extract the first word of "moc", so it can be a program name with args.
---- gcc/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java.ark 2005-11-03 09:57:52.000000000 +0100
-+++ gcc/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java 2005-11-03 09:58:05.000000000 +0100
-@@ -135,7 +135,7 @@
- {
- eventQueue = new EventQueue();
- repaintThread = new QtRepaintThread();
-- System.loadLibrary("qtpeer");
-+ System.loadLibrary("-gnu-java-awt-peer-qt");
-
- String theme = null;
- try
+++ /dev/null
---- gcc/gcc/libffi/src/x86/ffi64.c 2004/01/21 06:11:08 1.6
-+++ gcc/gcc/libffi/src/x86/ffi64.c 2004/10/12 16:47:26 1.6.6.1
-@@ -341,6 +341,8 @@
- {
- /* Pass this argument in memory. */
- argp = (void *)ALIGN(argp, (*p_arg)->alignment);
-+ /* Stack arguments are *always* at least 8 byte aligned. */
-+ argp = (void *)ALIGN(argp, 8);
- memcpy (argp, *p_argv, (*p_arg)->size);
- argp += (*p_arg)->size;
- }
+++ /dev/null
-diff -urN gcc-3.2.2.org/gcc/ggc-page.c gcc-3.2.2/gcc/ggc-page.c
---- gcc-3.2.2.org/gcc/ggc-page.c Tue Feb 18 14:27:56 2003
-+++ gcc-3.2.2/gcc/ggc-page.c Tue Feb 18 14:28:16 2003
-@@ -346,9 +346,9 @@
- one) before collection is performed. */
- #define GGC_MIN_EXPAND_FOR_GC (1.3)
-
--/* Bound `allocated_last_gc' to 4MB, to prevent the memory expansion
-+/* Bound `allocated_last_gc' to 16MB, to prevent the memory expansion
- test from triggering too often when the heap is small. */
--#define GGC_MIN_LAST_ALLOCATED (4 * 1024 * 1024)
-+#define GGC_MIN_LAST_ALLOCATED (16 * 1024 * 1024)
-
- /* Allocate pages in chunks of this size, to throttle calls to memory
- allocation routines. The first page is used, the rest go onto the
+++ /dev/null
-#! /bin/sh -e
-
-if [ $# -eq 3 -a "$2" = '-d' ]; then
- pdir="-d $3"
-elif [ $# -ne 1 ]; then
- echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
- exit 1
-fi
-case "$1" in
- -patch) patch $pdir -f --no-backup-if-mismatch -p0 -l < $0;;
- -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p0 -l < $0;;
- *)
- echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
- exit 1
-esac
-exit 0
-
-Patch: gcj -vs- iconv
-
-To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
-Subject: Patch: gcj -vs- iconv
-From: Tom Tromey <tromey at cygnus dot com>
-Date: 06 Mar 2000 14:39:01 -0700
-Reply-To: tromey at cygnus dot com
-
-# DP: This patch changes gcj to use iconv(), when available, to read Java
-# DP: source files. It adds a new `--encoding' option that lets the user
-# DP: choose what encoding to use. For systems without iconv(), gcj still
-# DP: assumes that the input is UTF-8, but it no longer ignores encoding
-# DP: errors.
-# DP:
-# DP: This patch does have one minor problem, which is that if --encoding is
-# DP: not specified we default to UTF-8 instead of the encoding the user has
-# DP: chosen (as part of his locale). I don't know how to find that
-# DP: information. Anyway, that is an addition which shouldn't affect
-# DP: whether or not this patch goes in, since this patch doesn't make the
-# DP: situation any worse than it is right now.
-
-Alex, I'm not sure I really understand how the parser context stack
-works, so it is possible that some of my changes there are wrong.
-Could you look at it? Is this ok to check in?
-# DP:
-# DP: This fixes PR gcj/33; I can now compile a Latin-1 encoded file on my
-# DP: PPC Linux box with `gcj --encoding=Latin1 ...'.
-
-2000-03-06 Tom Tromey <tromey@cygnus.com>
-
- Fix for PR gcj/33:
- * jv-scan.c (help): Document --encoding.
- (options): Added `encoding' entry.
- (OPT_ENCODING): New define.
- (main): Handle --encoding.
- * lang-options.h: Document --classpath, --CLASSPATH, --main, and
- --encoding.
- * jcf-parse.c (parse_source_file): Correctly call java_init_lex.
- Added `finput' argument.
- * java-tree.h (current_encoding): Declare.
- * parse.y (java_parser_context_restore_global): Don't restore
- `finput'.
- (java_parser_context_save_global): Don't set `finput' field.
- (java_pop_parser_context): Don't restore `finput'. Free old lexer
- if required.
- * lang.c (current_encoding): New global.
- (lang_decode_option): Recognize `-fencoding='.
- (finish_parse): Don't close finput.
- * parse.h (struct parser_ctxt): Removed `finput' and
- `unget_utf8_value' fields. Added `lexer' field.
- (java_init_lex): Fixed declaration.
- * lex.c (java_new_lexer): New function.
- (java_destroy_lexer): Likewise.
- (java_read_char): Added `lex' argument. Handle iconv case.
- (java_read_unicode): Added `lex' argument. Count backslashes in
- lexer structure.
- (java_init_lex): Added `finput' and `encoding' arguments. Set
- `lexer' field in ctxp.
- (BAD_UTF8_VALUE): Removed.
- * lex.h: Include <iconv.h> if HAVE_ICONV defined.
- (java_lexer): New structure.
- (UNGETC): Removed.
- (GETC): Removed.
- (DEFAULT_ENCODING): New define.
- (java_destroy_lexer): Declare.
-
-Tom
-
---- gcc/java/java-tree.h.orig Sat Apr 8 23:03:03 2000
-+++ gcc/java/java-tree.h Sat Apr 8 23:03:56 2000
-@@ -141,6 +141,9 @@
- extern int flag_not_overriding;
- extern int flag_static_local_jdk1_1;
-
-+/* Encoding used for source files. */
-+extern char *current_encoding;
-+
- /* The Java .class file that provides main_class; the main input file. */
- extern struct JCF *current_jcf;
-
---- gcc/java/jcf-parse.c.orig Sat Apr 8 23:03:03 2000
-+++ gcc/java/jcf-parse.c Sat Apr 8 23:05:39 2000
-@@ -84,7 +84,7 @@
- static tree give_name_to_class PROTO ((JCF *jcf, int index));
- static void parse_zip_file_entries PROTO ((void));
- static void process_zip_dir PROTO ((void));
--static void parse_source_file PROTO ((tree));
-+static void parse_source_file PARAMS ((tree, FILE *));
- static void jcf_parse_source PROTO ((void));
- static int jcf_figure_file_type PROTO ((JCF *));
- static int find_in_current_zip PROTO ((char *, struct JCF **));
-@@ -570,6 +570,7 @@
- jcf_parse_source ()
- {
- tree file;
-+ FILE *finput;
-
- java_parser_context_save_global ();
- java_push_parser_context ();
-@@ -580,7 +581,7 @@
- if (!(finput = fopen (input_filename, "r")))
- fatal ("input file `%s' just disappeared - jcf_parse_source",
- input_filename);
-- parse_source_file (file);
-+ parse_source_file (file, finput);
- if (fclose (finput))
- fatal ("can't close input file `%s' stream - jcf_parse_source",
- input_filename);
-@@ -741,8 +742,9 @@
- /* Parse a source file, as pointed by the current value of INPUT_FILENAME. */
-
- static void
--parse_source_file (file)
-+parse_source_file (file, finput)
- tree file;
-+ FILE *finput;
- {
- int save_error_count = java_error_count;
- /* Mark the file as parsed */
-@@ -750,7 +752,9 @@
-
- lang_init_source (1); /* Error msgs have no method prototypes */
-
-- java_init_lex (); /* Initialize the parser */
-+ /* Initialize the parser */
-+ java_init_lex (finput,
-+ current_encoding ? current_encoding : DEFAULT_ENCODING);
- java_parse_abort_on_error ();
-
- java_parse (); /* Parse and build partial tree nodes. */
-@@ -778,6 +782,7 @@
- int several_files = 0;
- char *list = strdup (input_filename), *next;
- tree node, current_file_list = NULL_TREE;
-+ FILE *finput;
-
- do
- {
-@@ -888,7 +893,7 @@
- case JCF_SOURCE:
- java_push_parser_context ();
- java_parser_context_save_global ();
-- parse_source_file (name);
-+ parse_source_file (name, finput);
- java_parser_context_restore_global ();
- java_pop_parser_context (1);
- break;
---- gcc/java/jv-scan.c.orig Sat Apr 8 23:03:03 2000
-+++ gcc/java/jv-scan.c Sat Apr 8 23:11:41 2000
-@@ -53,6 +53,7 @@
- {
- int i = 1;
- char *output_file = NULL;
-+ char *encoding = NULL;
- long ft;
-
- exec_name = argv[0];
-@@ -73,6 +74,14 @@
- argv [i] = NULL;
- }
-
-+ /* file encoding */
-+ else if (!strcmp (argv [i], "--encoding") && i+1 < argc)
-+ {
-+ argv [i] = NULL;
-+ encoding = argv [++i];
-+ argv [i] = NULL;
-+ }
-+
- /* Print the name of the class that contains main */
- else if (!strcmp (argv [i], "--print-main"))
- flag_find_main = 1;
-@@ -116,7 +125,7 @@
- input_filename = argv [i];
- if ( (finput = fopen (argv [i], "r")) )
- {
-- java_init_lex ();
-+ java_init_lex (finput, encoding ? encoding : DEFAULT_ENCODING);
- yyparse ();
- if (ftell (out) != ft)
- fputc ('\n', out);
---- gcc/java/lang-options.h.orig Sat Apr 8 23:03:03 2000
-+++ gcc/java/lang-options.h Sat Apr 8 23:03:56 2000
-@@ -39,8 +39,10 @@
- { "-M", "Print dependencies to stdout" },
- { "-MM", "Print dependencies to stdout" },
- #endif /* ! USE_CPPLIB */
-- { "-fclasspath", "Set class path and suppress system path" },
-- { "-fCLASSPATH", "Set class path" },
-+ { "--classpath", "Set class path and suppress system path" },
-+ { "--CLASSPATH", "Set class path" },
-+ { "--main", "Choose class whose main method should be used" },
-+ { "--encoding", "Choose input encoding (default is UTF-8)" },
- { "-I", "Add directory to class path" },
- { "-foutput-class-dir", "Directory where class files should be written" },
- { "-Wredundant-modifiers",
---- gcc/java/lang.c.orig Sat Apr 8 23:03:03 2000
-+++ gcc/java/lang.c Sat Apr 8 23:03:56 2000
-@@ -105,6 +105,9 @@
- /* When non zero, warns that final local are treated as non final. */
- int flag_static_local_jdk1_1 = 0;
-
-+/* The encoding of the source file. */
-+char *current_encoding = NULL;
-+
- /* From gcc/flags.h, and indicates if exceptions are turned on or not. */
-
- extern int flag_new_exceptions;
-@@ -172,6 +175,13 @@
- return 1;
- }
- #undef ARG
-+#define ARG "-fencoding="
-+ if (strncmp (p, ARG, sizeof (ARG) - 1) == 0)
-+ {
-+ current_encoding = p + sizeof (ARG) - 1;
-+ return 1;
-+ }
-+#undef ARG
-
- if (p[0] == '-' && p[1] == 'f')
- {
-@@ -252,7 +262,9 @@
- return 0;
- }
-
-+/* Global open file. */
- FILE *finput;
-+
- char *
- init_parse (filename)
- char *filename;
-@@ -313,7 +326,6 @@
- void
- finish_parse ()
- {
-- fclose (finput);
- jcf_dependency_write ();
- }
-
---- gcc/java/lex.c.orig Sat Apr 8 23:03:03 2000
-+++ gcc/java/lex.c Sat Apr 8 23:14:41 2000
-@@ -24,15 +24,15 @@
- The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
- /* It defines java_lex (yylex) that reads a Java ASCII source file
--possibly containing Unicode escape sequence or utf8 encoded characters
--and returns a token for everything found but comments, white spaces
--and line terminators. When necessary, it also fills the java_lval
--(yylval) union. It's implemented to be called by a re-entrant parser
--generated by Bison.
--
--The lexical analysis conforms to the Java grammar described in "The
--Java(TM) Language Specification. J. Gosling, B. Joy, G. Steele.
--Addison Wesley 1996" (http://java.sun.com/docs/books/jls/html/3.doc.html) */
-+ possibly containing Unicode escape sequence or utf8 encoded
-+ characters and returns a token for everything found but comments,
-+ white spaces and line terminators. When necessary, it also fills
-+ the java_lval (yylval) union. It's implemented to be called by a
-+ re-entrant parser generated by Bison.
-+
-+ The lexical analysis conforms to the Java grammar described in "The
-+ Java(TM) Language Specification. J. Gosling, B. Joy, G. Steele.
-+ Addison Wesley 1996" (http://java.sun.com/docs/books/jls/html/3.doc.html) */
-
- #include "keyword.h"
-
-@@ -55,15 +55,18 @@
- static int java_parse_doc_section PROTO ((unicode_t));
- static void java_parse_end_comment PROTO ((unicode_t));
- static unicode_t java_get_unicode PROTO (());
--static unicode_t java_read_unicode PROTO ((int, int *));
--static void java_store_unicode PROTO ((struct java_line *, unicode_t, int));
--static unicode_t java_read_char PROTO (());
-+static unicode_t java_read_unicode PARAMS ((java_lexer *, int, int *));
-+static void java_store_unicode PARAMS ((struct java_line *, unicode_t, int));
-+static unicode_t java_read_char PARAMS ((java_lexer *));
- static void java_allocate_new_line PROTO (());
- static void java_unget_unicode PROTO (());
- static unicode_t java_sneak_unicode PROTO (());
-+java_lexer *java_new_lexer PARAMS ((FILE *, const char *));
-
- void
--java_init_lex ()
-+java_init_lex (finput, encoding)
-+ FILE *finput;
-+ const char *encoding;
- {
- #ifndef JC1_LITE
- int java_lang_imported = 0;
-@@ -108,9 +111,9 @@
- ctxp->lineno = lineno = 0;
- ctxp->p_line = NULL;
- ctxp->c_line = NULL;
-- ctxp->unget_utf8_value = 0;
- ctxp->minus_seen = 0;
- ctxp->java_error_flag = 0;
-+ ctxp->lexer = java_new_lexer (finput, encoding);
- }
-
- static char *
-@@ -188,22 +191,142 @@
- ctxp->c_line->white_space_only = 1;
- }
-
--#define BAD_UTF8_VALUE 0xFFFE
-+/* Create a new lexer object. */
-+java_lexer *
-+java_new_lexer (finput, encoding)
-+ FILE *finput;
-+ const char *encoding;
-+{
-+ java_lexer *lex = (java_lexer *) xmalloc (sizeof (java_lexer));
-+ int enc_error = 0;
-+
-+ lex->finput = finput;
-+ lex->bs_count = 0;
-+ lex->unget_value = 0;
-+
-+#ifdef HAVE_ICONV
-+ lex->handle = iconv_open ("UCS-2", encoding);
-+ if (lex->handle == (iconv_t) -1)
-+ {
-+ /* FIXME: we should give a nice error based on errno here. */
-+ enc_error = 1;
-+ }
-+ lex->first = -1;
-+ lex->last = -1;
-+#else /* HAVE_ICONV */
-+ if (strcmp (encoding, DEFAULT_ENCODING))
-+ enc_error = 1;
-+#endif /* HAVE_ICONV */
-+
-+ if (enc_error)
-+ fatal ("unknown encoding: `%s'", encoding);
-+
-+ return lex;
-+}
-+
-+void
-+java_destroy_lexer (lex)
-+ java_lexer *lex;
-+{
-+ fclose (lex->finput);
-+#ifdef HAVE_ICONV
-+ iconv_close (lex->handle);
-+#endif
-+ free (lex);
-+}
-
- static unicode_t
--java_read_char ()
-+java_read_char (lex)
-+ java_lexer *lex;
- {
-- int c;
-- int c1, c2;
-+ if (lex->unget_value)
-+ {
-+ unicode_t r = lex->unget_value;
-+ lex->unget_value = 0;
-+ return r;
-+ }
-+
-+#ifdef HAVE_ICONV
-+ {
-+ char out[2];
-+ size_t ir, inbytesleft, in_save, out_count;
-+ char *inp, *outp;
-
-- if (ctxp->unget_utf8_value)
-+ while (1)
- {
-- int to_return = ctxp->unget_utf8_value;
-- ctxp->unget_utf8_value = 0;
-- return (to_return);
-+ /* See if we need to read more data. If FIRST == 0 then the
-+ previous conversion attempt ended in the middle of a
-+ character at the end of the buffer. Otherwise we only have
-+ to read if the buffer is empty. */
-+ if (lex->first == 0 || lex->first >= lex->last)
-+ {
-+ int r;
-+
-+ if (lex->first >= lex->last)
-+ {
-+ lex->first = 0;
-+ lex->last = 0;
-+ }
-+ if (feof (lex->finput))
-+ return UEOF;
-+ r = fread (&lex->buffer[lex->last], 1,
-+ sizeof (lex->buffer) - lex->last,
-+ lex->finput);
-+ lex->last += r;
- }
-
-- c = GETC ();
-+ inbytesleft = lex->last - lex->first;
-+
-+ if (inbytesleft == 0)
-+ {
-+ /* We've tried to read and there is nothing left. */
-+ return UEOF;
-+ }
-+
-+ in_save = inbytesleft;
-+ out_count = 2;
-+ inp = &lex->buffer[lex->first];
-+ outp = out;
-+ ir = iconv (lex->handle, (const char **) &inp, &inbytesleft,
-+ &outp, &out_count);
-+ lex->first += in_save - inbytesleft;
-+
-+ if (out_count == 0)
-+ {
-+ /* Success. We assume that UCS-2 is big-endian. This
-+ appears to be an ok assumption. */
-+ unicode_t result;
-+ result = (((unsigned char) out[0]) << 8) | (unsigned char) out[1];
-+ return result;
-+ }
-+
-+ if (ir == (size_t) -1)
-+ {
-+ if (errno == EINVAL)
-+ {
-+ /* This is ok. This means that the end of our buffer
-+ is in the middle of a character sequence. We just
-+ move the valid part of the buffer to the beginning
-+ to force a read. */
-+ /* We use bcopy() because it should work for
-+ overlapping strings. Use memmove() instead... */
-+ bcopy (&lex->buffer[lex->first], &lex->buffer[0],
-+ lex->last - lex->first);
-+ lex->last -= lex->first;
-+ lex->first = 0;
-+ }
-+ else
-+ {
-+ /* A more serious error. */
-+ java_lex_error ("unrecognized character in input stream", 0);
-+ }
-+ }
-+ }
-+ }
-+#else /* HAVE_ICONV */
-+ {
-+ int c, c1, c2;
-+ c = getc (lex->finput);
-
- if (c < 128)
- return (unicode_t)c;
-@@ -213,17 +336,17 @@
- {
- if ((c & 0xe0) == 0xc0)
- {
-- c1 = GETC ();
-+ c1 = getc (lex->finput);
- if ((c1 & 0xc0) == 0x80)
- return (unicode_t)(((c &0x1f) << 6) + (c1 & 0x3f));
- c = c1;
- }
- else if ((c & 0xf0) == 0xe0)
- {
-- c1 = GETC ();
-+ c1 = getc (lex->finput);
- if ((c1 & 0xc0) == 0x80)
- {
-- c2 = GETC ();
-+ c2 = getc (lex->finput);
- if ((c2 & 0xc0) == 0x80)
- return (unicode_t)(((c & 0xf) << 12) +
- (( c1 & 0x3f) << 6) + (c2 & 0x3f));
-@@ -233,14 +356,15 @@
- else
- c = c1;
- }
-- /* We looked for a UTF8 multi-byte sequence (since we saw an initial
-- byte with the high bit set), but found invalid bytes instead.
-- If the most recent byte was Ascii (and not EOF), we should
-- unget it, in case it was a comment terminator or other delimitor. */
-- if ((c & 0x80) == 0)
-- UNGETC (c);
-- return BAD_UTF8_VALUE;
-+
-+ /* We simply don't support invalid characters. */
-+ java_lex_error ("malformed UTF-8 character", 0);
-+ }
- }
-+#endif /* HAVE_ICONV */
-+
-+ /* We only get here on error. */
-+ return UEOF;
- }
-
- static void
-@@ -261,56 +385,54 @@
- }
-
- static unicode_t
--java_read_unicode (term_context, unicode_escape_p)
-+java_read_unicode (lex, term_context, unicode_escape_p)
-+ java_lexer *lex;
- int term_context;
- int *unicode_escape_p;
- {
- unicode_t c;
-- long i, base;
-
-- c = java_read_char ();
-+ c = java_read_char (lex);
- *unicode_escape_p = 0;
-
- if (c != '\\')
-- return ((term_context ? c :
-- java_lineterminator (c) ? '\n' : (unicode_t)c));
--
-- /* Count the number of preceeding '\' */
-- for (base = ftell (finput), i = base-2; c == '\\';)
- {
-- fseek (finput, i--, SEEK_SET);
-- c = java_read_char (); /* Will fail if reading utf8 stream. FIXME */
-+ lex->bs_count = 0;
-+ return (term_context ? c : (java_lineterminator (c)
-+ ? '\n'
-+ : (unicode_t) c));
- }
-- fseek (finput, base, SEEK_SET);
-- if ((base-i-3)%2 == 0) /* If odd number of \ seen */
-+
-+ ++lex->bs_count;
-+ if ((lex->bs_count) % 2 == 1)
- {
-- c = java_read_char ();
-+ /* Odd number of \ seen. */
-+ c = java_read_char (lex);
- if (c == 'u')
- {
-- unsigned short unicode = 0;
-+ unicode_t unicode = 0;
- int shift = 12;
- /* Next should be 4 hex digits, otherwise it's an error.
- The hex value is converted into the unicode, pushed into
- the Unicode stream. */
- for (shift = 12; shift >= 0; shift -= 4)
- {
-- if ((c = java_read_char ()) == UEOF)
-+ if ((c = java_read_char (lex)) == UEOF)
- return UEOF;
- if (c >= '0' && c <= '9')
- unicode |= (unicode_t)((c-'0') << shift);
- else if ((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))
- unicode |= (unicode_t)((10+(c | 0x20)-'a') << shift);
- else
-- java_lex_error
-- ("Non hex digit in Unicode escape sequence", 0);
-+ java_lex_error ("Non hex digit in Unicode escape sequence", 0);
- }
- *unicode_escape_p = 1;
-- return (term_context ? unicode :
-- (java_lineterminator (c) ? '\n' : unicode));
-+ return (term_context
-+ ? unicode : (java_lineterminator (c) ? '\n' : unicode));
- }
-- ctxp->unget_utf8_value = c;
-+ lex->unget_value = c;
- }
-- return (unicode_t)'\\';
-+ return (unicode_t) '\\';
- }
-
- static unicode_t
-@@ -325,7 +447,7 @@
- for (;;)
- {
- int unicode_escape_p;
-- c = java_read_unicode (0, &unicode_escape_p);
-+ c = java_read_unicode (ctxp->lexer, 0, &unicode_escape_p);
- java_store_unicode (ctxp->c_line, c, unicode_escape_p);
- if (ctxp->c_line->white_space_only
- && !JAVA_WHITE_SPACE_P (c) && c!='\n')
-@@ -346,7 +468,7 @@
- int unicode_escape_p;
- if (c == '\n') /* CR */
- {
-- if ((c = java_read_unicode (1, &unicode_escape_p)) != '\r')
-+ if ((c = java_read_unicode (ctxp->lexer, 1, &unicode_escape_p)) != '\r')
- {
- ctxp->c_line->ahead [0] = c;
- ctxp->c_line->unicode_escape_ahead_p = unicode_escape_p;
-@@ -355,7 +477,7 @@
- }
- else if (c == '\r') /* LF */
- {
-- if ((c = java_read_unicode (1, &unicode_escape_p)) != '\n')
-+ if ((c = java_read_unicode (ctxp->lexer, 1, &unicode_escape_p)) != '\n')
- {
- ctxp->c_line->ahead [0] = c;
- ctxp->c_line->unicode_escape_ahead_p = unicode_escape_p;
---- gcc/java/lex.h.orig Sat Apr 8 23:03:03 2000
-+++ gcc/java/lex.h Sat Apr 8 23:03:56 2000
-@@ -35,6 +35,13 @@
- /* A Unicode character, as read from the input file */
- typedef unsigned short unicode_t;
-
-+#ifdef HAVE_ICONV
-+#include <iconv.h>
-+#endif /* HAVE_ICONV */
-+
-+/* Default encoding to use if no encoding is specified. */
-+#define DEFAULT_ENCODING "UTF-8"
-+
- /* Debug macro to print-out what we match */
- #ifdef JAVA_LEX_DEBUG
- #ifdef JAVA_LEX_DEBUG_CHAR
-@@ -96,12 +103,38 @@
- int col;
- } java_lc;
-
-+typedef struct java_lexer
-+{
-+ /* The file from which we're reading. */
-+ FILE *finput;
-+
-+ /* Number of consecutive backslashes we've read. */
-+ int bs_count;
-+
-+ /* If nonzero, a value that was pushed back. */
-+ unicode_t unget_value;
-+
-+#ifdef HAVE_ICONV
-+ /* The handle for the iconv converter we're using. */
-+ iconv_t handle;
-+
-+ /* Bytes we've read from the file but have not sent to iconv. */
-+ char buffer[1024];
-+
-+ /* Index of first valid character in buffer, -1 if no valid
-+ characters. */
-+ int first;
-+
-+ /* Index of last valid character in buffer, plus one. -1 if no
-+ valid characters in buffer. */
-+ int last;
-+#endif /* HAVE_ICONV */
-+} java_lexer;
-
--#define JAVA_LINE_MAX 80
-+/* Destroy a lexer object. */
-+extern void java_destroy_lexer PARAMS ((java_lexer *));
-
--/* Macro to read and unread bytes */
--#define UNGETC(c) ungetc(c, finput)
--#define GETC() getc(finput)
-+#define JAVA_LINE_MAX 80
-
- /* Build a location compound integer */
- #define BUILD_LOCATION() ((ctxp->elc.line << 12) | (ctxp->elc.col & 0xfff))
---- gcc/java/parse.h.orig Sat Apr 8 23:03:03 2000
-+++ gcc/java/parse.h Sat Apr 8 23:15:36 2000
-@@ -586,12 +586,11 @@
- struct parser_ctxt {
-
- char *filename; /* Current filename */
-- FILE *finput; /* Current file input stream */
- struct parser_ctxt *next;
-
-+ java_lexer *lexer; /* Current lexer state */
- struct java_line *p_line, *c_line; /* Previous and current line */
- java_lc elc; /* Error's line column info */
-- unicode_t unget_utf8_value; /* An unget utf8 value */
- int ccb_indent; /* Keep track of {} indent, lexer */
- int first_ccb_indent1; /* First { at ident level 1 */
- int last_ccb_indent1; /* Last } at ident level 1 */
-@@ -668,7 +667,7 @@
- /* Always in use, no matter what you compile */
- void java_push_parser_context PROTO ((void));
- void java_pop_parser_context PROTO ((int));
--void java_init_lex PROTO ((void));
-+void java_init_lex PARAMS ((FILE *, const char *));
- extern void java_parser_context_save_global PROTO ((void));
- extern void java_parser_context_restore_global PROTO ((void));
- int yyparse PROTO ((void));
---- gcc/java/parse.y.orig Sat Apr 8 23:03:03 2000
-+++ gcc/java/parse.y Sat Apr 8 23:03:56 2000
-@@ -2347,7 +2347,6 @@
- java_push_parser_context ();
- extra_ctxp_pushed_p = 1;
- }
-- ctxp->finput = finput;
- ctxp->lineno = lineno;
- ctxp->current_class = current_class;
- ctxp->filename = input_filename;
-@@ -2357,7 +2356,6 @@
- void
- java_parser_context_restore_global ()
- {
-- finput = ctxp->finput;
- lineno = ctxp->lineno;
- current_class = ctxp->current_class;
- input_filename = ctxp->filename;
-@@ -2386,9 +2384,12 @@
- next->incomplete_class = ctxp->incomplete_class;
- next->gclass_list = ctxp->gclass_list;
- lineno = ctxp->lineno;
-- finput = ctxp->finput;
- current_class = ctxp->current_class;
- }
-+
-+ /* If the old and new lexers differ, then free the old one. */
-+ if (ctxp->lexer && next && ctxp->lexer != next->lexer)
-+ java_destroy_lexer (ctxp->lexer);
-
- /* Set the single import class file flag to 0 for the current list
- of imported things */
+++ /dev/null
-Changes for GCC version 2.95.1 for GNU Pascal 2.1
-
-Before applying these diffs, go to the directory gcc-2.95.1
-and use the command
-
- patch -p1
-
-feeding it the following diffs as input.
-
-*** gcc-2.95.1/gcc/expr.c.orig Thu Jul 1 00:59:55 1999
---- gcc-2.95.1/gcc/expr.c Sun Oct 24 14:01:38 1999
-*************** store_constructor (exp, target, cleared)
-*** 4430,4435 ****
---- 4430,4444 ----
-
- domain_min = convert (sizetype, TYPE_MIN_VALUE (domain));
- domain_max = convert (sizetype, TYPE_MAX_VALUE (domain));
-+
-+ #ifdef GPC
-+ /* Align the set. */
-+ if (set_alignment)
-+ domain_min = size_binop (MINUS_EXPR, domain_min,
-+ size_binop (TRUNC_MOD_EXPR, domain_min,
-+ size_int (set_alignment)));
-+ #endif /* GPC */
-+
- bitlength = size_binop (PLUS_EXPR,
- size_binop (MINUS_EXPR, domain_max, domain_min),
- size_one_node);
-*************** store_constructor (exp, target, cleared)
-*** 4444,4450 ****
---- 4453,4461 ----
- if (GET_MODE (target) != BLKmode || nbits <= 2 * BITS_PER_WORD
- || (nbytes <= 32 && TREE_CHAIN (elt) != NULL_TREE))
- {
-+ #ifndef GPC
- int set_word_size = TYPE_ALIGN (TREE_TYPE (exp));
-+ #endif /* not GPC */
- enum machine_mode mode = mode_for_size (set_word_size, MODE_INT, 1);
- char *bit_buffer = (char *) alloca (nbits);
- HOST_WIDE_INT word = 0;
-*************** store_constructor (exp, target, cleared)
-*** 4456,4462 ****
---- 4467,4477 ----
- {
- if (bit_buffer[ibit])
- {
-+ #ifdef GPC
-+ if (set_words_big_endian)
-+ #else /* not GPC */
- if (BYTES_BIG_ENDIAN)
-+ #endif /* not GPC */
- word |= (1 << (set_word_size - 1 - bit_pos));
- else
- word |= 1 << bit_pos;
-*************** store_constructor (exp, target, cleared)
-*** 4570,4575 ****
---- 4585,4596 ----
- else
- #endif
- {
-+ #ifdef GPC
-+ /* The language-specific run time library must provide
-+ a suitable `__setbits()' function whose action coincides
-+ with the values of `set_word_size', `set_alignment', and
-+ `set_words_big_endian'. */
-+ #endif /* GPC */
- emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__setbits"),
- 0, VOIDmode, 4, XEXP (targetx, 0), Pmode,
- bitlength_rtx, TYPE_MODE (sizetype),
-*** gcc-2.95.1/gcc/stor-layout.c.orig Thu Mar 11 14:56:20 1999
---- gcc-2.95.1/gcc/stor-layout.c Wed Oct 27 16:39:10 1999
-*************** int maximum_field_alignment;
-*** 53,58 ****
---- 53,69 ----
- May be overridden by front-ends. */
- int set_alignment = 0;
-
-+ #ifdef GPC
-+ /* The word size of a bitstring or (power-)set value, in bits.
-+ Must be non-zero.
-+ May be overridden by front-ends. */
-+ int set_word_size = BITS_PER_UNIT;
-+
-+ /* If non-zero, bits in (power-)sets start with the highest bit.
-+ May be overridden by front-ends. */
-+ int set_words_big_endian /*= BYTES_BIG_ENDIAN*/; /* @@@ Needn't be a constant! */
-+ #endif /* GPC */
-+
- static tree layout_record PROTO((tree));
- static void layout_union PROTO((tree));
- \f
-*************** static tree pending_sizes;
-*** 65,70 ****
---- 76,88 ----
-
- int immediate_size_expand;
-
-+ #ifdef GPC
-+ /* Nonzero means that the size of a type may vary
-+ within one function context. */
-+
-+ int size_volatile = 0;
-+ #endif /* GPC */
-+
- tree
- get_pending_sizes ()
- {
-*************** variable_size (size)
-*** 102,108 ****
---- 120,131 ----
- || global_bindings_p () < 0 || contains_placeholder_p (size))
- return size;
-
-+ #ifdef GPC
-+ if (! size_volatile)
-+ size = save_expr (size);
-+ #else /* not GPC */
- size = save_expr (size);
-+ #endif
-
- if (global_bindings_p ())
- {
-*************** variable_size (size)
-*** 119,125 ****
---- 142,152 ----
- Also, we would like to pass const0_rtx here, but don't have it. */
- expand_expr (size, expand_expr (integer_zero_node, NULL_PTR, VOIDmode, 0),
- VOIDmode, 0);
-+ #ifdef GPC
-+ else if (! size_volatile)
-+ #else /* not GPC */
- else
-+ #endif
- pending_sizes = tree_cons (NULL_TREE, size, pending_sizes);
-
- return size;
-*************** layout_type (type)
-*** 1040,1045 ****
---- 1067,1086 ----
- abort();
- else
- {
-+ #ifdef GPC
-+ int alignment = set_alignment ? set_alignment : set_word_size;
-+ int lower_bound = TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (type)));
-+ int upper_bound = TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (type)));
-+ int size_in_bits, rounded_size;
-+ if (set_alignment)
-+ size_in_bits = upper_bound - (lower_bound / alignment) * alignment + 1;
-+ else
-+ size_in_bits
-+ = (TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))
-+ - TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) + 1);
-+ rounded_size
-+ = ((size_in_bits + alignment - 1) / alignment) * alignment;
-+ #else /* not GPC */
- #ifndef SET_WORD_SIZE
- #define SET_WORD_SIZE BITS_PER_WORD
- #endif
-*************** layout_type (type)
-*** 1049,1054 ****
---- 1090,1096 ----
- - TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) + 1);
- int rounded_size
- = ((size_in_bits + alignment - 1) / alignment) * alignment;
-+ #endif /* not GPC */
- if (rounded_size > alignment)
- TYPE_MODE (type) = BLKmode;
- else
-*** gcc-2.95.1/gcc/tree.c.orig Wed Sep 29 19:41:05 1999
---- gcc-2.95.1/gcc/tree.c Tue Oct 19 00:04:25 1999
-*************** get_set_constructor_bits (init, buffer,
-*** 4986,4991 ****
---- 4986,4998 ----
- HOST_WIDE_INT domain_min
- = TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (init))));
- tree non_const_bits = NULL_TREE;
-+
-+ #ifdef GPC
-+ /* Align the set. */
-+ if (set_alignment)
-+ domain_min -= domain_min % set_alignment;
-+ #endif /* GPC */
-+
- for (i = 0; i < bit_size; i++)
- buffer[i] = 0;
-
-*************** get_set_constructor_bytes (init, buffer,
-*** 5038,5045 ****
---- 5045,5056 ----
- int wd_size;
- {
- int i;
-+ #ifdef GPC
-+ int bit_size = wd_size * BITS_PER_UNIT;
-+ #else /* not GPC */
- int set_word_size = BITS_PER_UNIT;
- int bit_size = wd_size * set_word_size;
-+ #endif /* not GPC */
- int bit_pos = 0;
- unsigned char *bytep = buffer;
- char *bit_buffer = (char *) alloca(bit_size);
-*************** get_set_constructor_bytes (init, buffer,
-*** 5050,5055 ****
---- 5061,5084 ----
-
- for (i = 0; i < bit_size; i++)
- {
-+ #ifdef GPC
-+ if (bit_buffer[i])
-+ {
-+ int k = bit_pos / BITS_PER_UNIT;
-+ if (WORDS_BIG_ENDIAN)
-+ k = set_word_size / BITS_PER_UNIT - 1 - k;
-+ if (set_words_big_endian)
-+ bytep[k] |= (1 << (BITS_PER_UNIT - 1 - bit_pos % BITS_PER_UNIT));
-+ else
-+ bytep[k] |= 1 << (bit_pos % BITS_PER_UNIT);
-+ }
-+ bit_pos++;
-+ if (bit_pos >= set_word_size)
-+ {
-+ bit_pos = 0;
-+ bytep += set_word_size / BITS_PER_UNIT;
-+ }
-+ #else /* not GPC */
- if (bit_buffer[i])
- {
- if (BYTES_BIG_ENDIAN)
-*************** get_set_constructor_bytes (init, buffer,
-*** 5060,5065 ****
---- 5089,5095 ----
- bit_pos++;
- if (bit_pos >= set_word_size)
- bit_pos = 0, bytep++;
-+ #endif /* not GPC */
- }
- return non_const_bits;
- }
-*** gcc-2.95.1/gcc/tree.h.orig Mon Oct 18 12:19:46 1999
---- gcc-2.95.1/gcc/tree.h Mon Oct 18 12:36:04 1999
-*************** extern int maximum_field_alignment;
-*** 1630,1635 ****
---- 1630,1643 ----
- /* If non-zero, the alignment of a bitstring or (power-)set value, in bits. */
- extern int set_alignment;
-
-+ #ifdef GPC
-+ /* The word size of a bitstring or (power-)set value, in bits. */
-+ extern int set_word_size;
-+
-+ /* If non-zero, bits in (power-)sets start with the highest bit. */
-+ extern int set_words_big_endian;
-+ #endif /* GPC */
-+
- /* Concatenate two lists (chains of TREE_LIST nodes) X and Y
- by making the last node in X point to Y.
- Returns X, except if X is 0 returns Y. */
-*** gcc-2.95.1/gcc/tree.def.orig Mon May 17 09:21:12 1999
---- gcc-2.95.1/gcc/tree.def Tue Oct 26 04:16:43 1999
-*************** DEFTREECODE (WITH_CLEANUP_EXPR, "with_cl
-*** 490,528 ****
- DEFTREECODE (CLEANUP_POINT_EXPR, "cleanup_point_expr", 'e', 1)
-
- /* The following two codes are used in languages that have types where
-! the position and/or sizes of fields vary from object to object of the
-! same type, i.e., where some other field in the object contains a value
-! that is used in the computation of another field's offset or size.
-!
-! For example, a record type with a discriminant in Ada is such a type.
-! This mechanism is also used to create "fat pointers" for unconstrained
-! array types in Ada; the fat pointer is a structure one of whose fields is
-! a pointer to the actual array type and the other field is a pointer to a
-! template, which is a structure containing the bounds of the array. The
-! bounds in the type pointed to by the first field in the fat pointer refer
-! to the values in the template.
-!
-! These "self-references" are doing using a PLACEHOLDER_EXPR. This is a
-! node that will later be replaced with the object being referenced. Its type
-! is that of the object and selects which object to use from a chain of
-! references (see below).
-!
-! When we wish to evaluate a size or offset, we check it is contains a
-! placeholder. If it does, we construct a WITH_RECORD_EXPR that contains
-! both the expression we wish to evaluate and an expression within which the
-! object may be found. The latter expression is the object itself in
-! the simple case of an Ada record with discriminant, but it can be the
-! array in the case of an unconstrained array.
-!
-! In the latter case, we need the fat pointer, because the bounds of the
-! array can only be accessed from it. However, we rely here on the fact that
-! the expression for the array contains the dereference of the fat pointer
-! that obtained the array pointer.
-
- Accordingly, when looking for the object to substitute in place of
- a PLACEHOLDER_EXPR, we look down the first operand of the expression
-! passed as the second operand to WITH_RECORD_EXPR until we find something
-! of the desired type or reach a constant. */
-
- /* Denotes a record to later be supplied with a WITH_RECORD_EXPR when
- evaluating this expression. The type of this expression is used to
---- 490,547 ----
- DEFTREECODE (CLEANUP_POINT_EXPR, "cleanup_point_expr", 'e', 1)
-
- /* The following two codes are used in languages that have types where
-! some field in an object of the type contains a value that is used in
-! the computation of another field's offset or size and/or the size of
-! the type. The positions and/or sizes of fields can vary from object
-! to object of the same type or even for one and the same object within
-! its scope.
-!
-! Record types with discriminants in Ada or schema types in Pascal are
-! examples of such types. This mechanism is also used to create "fat
-! pointers" for unconstrained array types in Ada; the fat pointer is a
-! structure one of whose fields is a pointer to the actual array type
-! and the other field is a pointer to a template, which is a structure
-! containing the bounds of the array. The bounds in the type pointed
-! to by the first field in the fat pointer refer to the values in the
-! template.
-!
-! When you wish to construct such a type you need "self-references"
-! that allow you to reference the object having this type from the
-! TYPE node, i.e. without having a variable instantiating this type.
-!
-! Such a "self-references" is done using a PLACEHOLDER_EXPR. This is
-! a node that will later be replaced with the object being referenced.
-! Its type is that of the object and selects which object to use from
-! a chain of references (see below). No other slots are used in the
-! PLACEHOLDER_EXPR.
-!
-! For example, if your type FOO is a RECORD_TYPE with a field BAR,
-! and you need the value of <variable>.BAR to calculate TYPE_SIZE
-! (FOO), just substitute <variable> above with a PLACEHOLDER_EXPR
-! whose TREE_TYPE is FOO. Then construct your COMPONENT_REF with
-! the PLACEHOLDER_EXPR as the first operand (which has the correct
-! type). Later, when the size is needed in the program, the back-end
-! will find this PLACEHOLDER_EXPR and generate code to calculate the
-! actual size at run-time. In the following, we describe how this
-! calculation is done.
-!
-! When we wish to evaluate a size or offset, we check whether it
-! contains a PLACEHOLDER_EXPR. If it does, we construct a
-! WITH_RECORD_EXPR that contains both the expression we wish to
-! evaluate and an expression within which the object may be found.
-! The latter expression is the object itself in the simple case of an
-! Ada record with discriminant, but it can be the array in the case of
-! an unconstrained array.
-!
-! In the latter case, we need the fat pointer, because the bounds of
-! the array can only be accessed from it. However, we rely here on the
-! fact that the expression for the array contains the dereference of
-! the fat pointer that obtained the array pointer.
-
- Accordingly, when looking for the object to substitute in place of
- a PLACEHOLDER_EXPR, we look down the first operand of the expression
-! passed as the second operand to WITH_RECORD_EXPR until we find
-! something of the desired type or reach a constant. */
-
- /* Denotes a record to later be supplied with a WITH_RECORD_EXPR when
- evaluating this expression. The type of this expression is used to
---- gcc-4.0-20040919.orig/gcc/doc/cpp.texi 2004-09-17 10:22:36.000000000 +0200
-+++ gcc-4.0-20040919/gcc/doc/cpp.texi 2004-09-26 10:58:58.166721432 +0200
+--- gcc-3.4-20040611/gcc/doc/cpp.texi.orig 2004-01-18 12:59:03.000000000 +0100
++++ gcc-3.4-20040611/gcc/doc/cpp.texi 2004-06-12 03:49:21.959450032 +0200
@@ -52,9 +52,9 @@
@set cppmanual
@end direntry
@end ifinfo
---- gcc-4.0-20040919.orig/gcc/doc/cppinternals.texi 2004-07-03 01:57:11.000000000 +0200
-+++ gcc-4.0-20040919/gcc/doc/cppinternals.texi 2004-09-26 10:58:58.208715048 +0200
+--- gcc-3.4-20040611/gcc/doc/cppinternals.texi.orig 2002-01-07 20:03:36.000000000 +0100
++++ gcc-3.4-20040611/gcc/doc/cppinternals.texi 2004-06-12 03:50:08.394390848 +0200
@@ -3,9 +3,9 @@
@settitle The GNU C Preprocessor Internals
@end direntry
@end ifinfo
---- gcc-4.0-20040919.orig/gcc/doc/gcc.texi 2004-07-22 22:12:20.000000000 +0200
-+++ gcc-4.0-20040919/gcc/doc/gcc.texi 2004-09-26 10:58:58.218713528 +0200
-@@ -62,9 +62,9 @@
- funds for GNU development.
- @end copying
+--- gcc-3.2/gcc/doc/gcc.texi.orig Fri Nov 1 22:58:48 2002
++++ gcc-3.2/gcc/doc/gcc.texi Fri Nov 1 23:06:12 2002
+@@ -65,9 +65,9 @@
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ @end macro
@ifnottex
-@dircategory Programming
+@dircategory Programming Languages:
@end direntry
This file documents the use of the GNU compilers.
@sp 1
---- gcc-4.0-20040919.orig/gcc/doc/gccint.texi 2004-05-24 00:54:29.000000000 +0200
-+++ gcc-4.0-20040919/gcc/doc/gccint.texi 2004-09-26 10:58:58.222712920 +0200
-@@ -46,9 +46,9 @@
- funds for GNU development.
- @end copying
+--- gcc-3.2/gcc/doc/gccint.texi.orig Wed Jan 23 18:30:28 2002
++++ gcc-3.2/gcc/doc/gccint.texi Fri Nov 1 23:06:57 2002
+@@ -51,9 +51,9 @@
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ @end macro
@ifnottex
-@dircategory Programming
+@dircategory Programming Languages:
@end direntry
This file documents the internals of the GNU compilers.
@sp 1
---- gcc-4.0-20040919.orig/gcc/ada/gnat-style.texi 2004-09-01 13:51:52.000000000 +0200
-+++ gcc-4.0-20040919/gcc/ada/gnat-style.texi 2004-09-26 10:58:58.342694680 +0200
+--- gcc-3.4-20040611/gcc/ada/gnat-style.texi.orig 2004-06-09 11:20:43.000000000 +0200
++++ gcc-3.4-20040611/gcc/ada/gnat-style.texi 2004-06-12 03:22:07.287957872 +0200
@@ -28,9 +28,9 @@
@setchapternewpage odd
@end direntry
@macro syntax{element}
---- gcc-4.0-20040919.orig/gcc/ada/gnat_ugn.texi 2004-09-13 12:18:41.000000000 +0200
-+++ gcc-4.0-20040919/gcc/ada/gnat_ugn.texi 2004-09-26 10:58:58.509669296 +0200
-@@ -124,6 +124,11 @@
- ``GNU Free Documentation License''.
- @end copying
+--- gcc-3.4-20040611/gcc/ada/gnat_ugn.texi.orig Fri Nov 1 22:58:52 2002
++++ gcc-3.4-20040611/gcc/ada/gnat_ugn.texi Fri Nov 1 23:10:20 2002
+@@ -75,6 +75,11 @@
+ @syncodeindex fn cp
+ @c %**end of header
+@dircategory Programming Languages:
+@direntry
+
@titlepage
- @title @value{EDITION} User's Guide
---- gcc-4.0-20040919.orig/gcc/fortran/gfortran.texi 2004-09-16 15:13:39.000000000 +0200
-+++ gcc-4.0-20040919/gcc/fortran/gfortran.texi 2004-09-26 11:05:50.258074024 +0200
-@@ -62,9 +62,9 @@
- @end copying
+ @ifset vms
+--- gcc-3.2/gcc/f/g77.texi.orig Mon Apr 29 09:58:32 2002
++++ gcc-3.2/gcc/f/g77.texi Fri Nov 1 23:11:56 2002
+@@ -90,9 +90,9 @@
+ @c @end tex
@ifinfo
-@dircategory Programming
+@dircategory Programming Languages:
@direntry
--* gfortran: (gfortran). The GNU Fortran 95 Compiler.
-+* gfortran: (gfortran). The GNU Fortran 95 Compiler.
+-* g77: (g77). The GNU Fortran compiler.
++* g77: (g77). The GNU Fortran compiler
@end direntry
- This file documents the use and the internals of
- the GNU Fortran 95 compiler, (@command{gfortran}).
---- gcc-4.0-20050507/gcc/java/gcj.texi.orig 2005-05-07 00:53:37.000000000 +0200
-+++ gcc-4.0-20050507/gcc/java/gcj.texi 2005-05-08 13:09:27.000000000 +0200
-@@ -50,30 +50,22 @@
+ @ifset INTERNALS
+ @ifset USING
+--- gcc-3.2/gcc/java/gcj.texi.orig Sun Aug 4 18:55:55 2002
++++ gcc-3.2/gcc/java/gcj.texi Fri Nov 1 23:16:39 2002
+@@ -20,26 +20,20 @@
@ifinfo
@format
@direntry
-* gcjh: (gcj)Invoking gcjh.
- Generate header files from Java class files
--* gjnih: (gcj)Invoking gjnih.
-- Generate JNI header files from Java class files
-* jv-scan: (gcj)Invoking jv-scan.
- Print information about Java source files
-* jcf-dump: (gcj)Invoking jcf-dump.
- Print information about Java class files
-* gij: (gcj)Invoking gij. GNU interpreter for Java bytecode
--* gcj-dbtool: (gcj)Invoking gcj-dbtool.
-- Tool for manipulating class file databases.
-* jv-convert: (gcj)Invoking jv-convert.
- Convert file from one encoding to another
--* grmic: (gcj)Invoking grmic.
+-* rmic: (gcj)Invoking rmic.
- Generate stubs for Remote Method Invocation.
--* grmiregistry: (gcj)Invoking grmiregistry.
+-* rmiregistry: (gcj)Invoking rmiregistry.
- The remote object registry.
+* gcjh: (gcj)gcjh. Generate header files from Java class files
-+* gjnih: (gcj)Invoking gjnih. Generate JNI header files from Java class files
+* jv-scan: (gcj)jv-scan. Print information about Java source files
+* jcf-dump: (gcj)jcf-dump. Print information about Java class files
+* gij: (gcj)gij. GNU interpreter for Java bytecode
+* jv-convert: (gcj)jv-convert. Convert file from one encoding to another
-+* gcj-dbtool: (gcj)gcj-dbtool. Db tool.
-+* grmic: (gcj)grmic. Generate stubs for Remote Method Invocation.
-+* grmiregistry: (gcj)grmiregistry. The remote object registry.
++* rmic: (gcj)rmic. Generate stubs for Remote Method Invocation.
++* rmiregistry: (gcj)rmiregistry. The remote object registry
@end direntry
@end format
-@@ -107,20 +99,20 @@
- @file{.class} files.
-
- @menu
--* Copying:: The GNU General Public License
-+* Copying:: The GNU General Public License
+@@ -120,15 +114,15 @@
+ * Copying:: The GNU General Public License
* GNU Free Documentation License::
How you can share and copy this manual
-* Invoking gcj:: Compiler options supported by @command{gcj}
-+* gcj:: Compiler options supported by @command{gcj}
++* gcj:: Compiler options supported by @command{gcj}
* Compatibility:: Compatibility between gcj and other tools for Java
-* Invoking gcjh:: Generate header files from class files
--* Invoking gjnih:: Generate JNI header files from class files
-* Invoking jv-scan:: Print information about source files
-* Invoking jcf-dump:: Print information about class files
-* Invoking gij:: Interpreting Java bytecodes
--* Invoking gcj-dbtool:: Tool for manipulating class file databases.
-* Invoking jv-convert:: Converting from one encoding to another
--* Invoking grmic:: Generate stubs for Remote Method Invocation.
--* Invoking grmiregistry:: The remote object registry.
-+* gcjh:: Generate header files from class files
-+* gjnih:: Generate JNI header files from class files
-+* jv-scan:: Print information about source files
-+* jcf-dump:: Print information about class files
-+* gij:: Interpreting Java bytecodes
-+* jv-convert:: Converting from one encoding to another
-+* gcj-dbtool:: Db tool.
-+* grmic:: Generate stubs for Remote Method Invocation.
-+* grmiregistry:: The remote object registry.
+-* Invoking rmic:: Generate stubs for Remote Method Invocation.
+-* Invoking rmiregistry:: The remote object registry.
++* gcjh:: Generate header files from class files
++* jv-scan:: Print information about source files
++* jcf-dump:: Print information about class files
++* gij:: Interpreting Java bytecodes
++* jv-convert:: Converting from one encoding to another
++* rmic:: Generate stubs for Remote Method Invocation.
++* rmiregistry:: The remote object registry.
* About CNI:: Description of the Compiled Native Interface
* System properties:: Modifying runtime behavior of the libgcj library
* Resources:: Where to look for more information
-@@ -132,7 +124,7 @@
+@@ -139,7 +133,7 @@
@include fdl.texi
@chapter Invoking gcj
@c man title gcj Ahead-of-time compiler for the Java language
-@@ -659,7 +651,7 @@
+@@ -506,7 +500,7 @@
@end itemize
@chapter Invoking gcjh
@c man title gcjh generate header files from Java class files
-@@ -775,7 +767,7 @@
-
- @c man end
-
--@node Invoking gjnih
-+@node gjnih
- @chapter Invoking gjnih
-
- @c man title gjnih generate JNI header files from Java class files
-@@ -889,7 +881,7 @@
+@@ -607,7 +601,7 @@
@c man end
@chapter Invoking jv-scan
@c man title jv-scan print information about Java source file
-@@ -952,7 +944,7 @@
+@@ -665,7 +659,7 @@
@c man end
@chapter Invoking jcf-dump
@c man title jcf-dump print information about Java class files
-@@ -1012,7 +1004,7 @@
+@@ -720,7 +714,7 @@
@c man end
@chapter Invoking gij
@c man title gij GNU interpreter for Java bytecode
-@@ -1132,7 +1124,7 @@
-
- @c man end
-
--@node Invoking gcj-dbtool
-+@node gcj-dbtool
- @chapter Invoking gcj-dbtool.
-
- @c man title gcj-dbtool Manipulate class file mapping databases for libgcj
-@@ -1223,7 +1215,7 @@
+@@ -798,7 +792,7 @@
@c man end
@chapter Invoking jv-convert
@c man title jv-convert Convert file from one encoding to another
-@@ -1282,7 +1274,7 @@
+@@ -857,7 +851,7 @@
@c man end
--@node Invoking grmic
-+@node grmic
- @chapter Invoking grmic
+-@node Invoking rmic
++@node rmic
+ @chapter Invoking rmic
- @c man title grmic Generate stubs for Remote Method Invocation
-@@ -1361,7 +1353,7 @@
+ @c man title rmic Generate stubs for Remote Method Invocation
+@@ -936,7 +930,7 @@
@c man end
--@node Invoking grmiregistry
-+@node grmiregistry
- @chapter Invoking grmiregistry
+-@node Invoking rmiregistry
++@node rmiregistry
+ @chapter Invoking rmiregistry
- @c man title grmiregistry Remote object registry
+ @c man title rmiregistry Remote object registry
+++ /dev/null
-#! /bin/sh -e
-
-# DP: Find header file for Boehm garbage collector.
-
-if [ $# -eq 3 -a "$2" = '-d' ]; then
- pdir="-d $3"
-elif [ $# -ne 1 ]; then
- echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
- exit 1
-fi
-case "$1" in
- -patch) patch $pdir -f --no-backup-if-mismatch -p0 < $0;;
- -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p0 < $0;;
- *)
- echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
- exit 1
-esac
-exit 0
-
-*** libobjc/Makefile.in~ Tue Nov 10 15:25:36 1998
---- libobjc/Makefile.in Tue Nov 10 13:16:08 1998
-***************
-*** 65,71 ****
- -I$(srcdir)/$(MULTISRCTOP)../gcc/config -I$(MULTIBUILDTOP)../../gcc \
- -I$(srcdir)/$(MULTISRCTOP)../include
-
-! OBJC_GCFLAGS=-DOBJC_WITH_GC=1
- OBJC_THREAD_FILE=thr-@OBJC_THREAD_FILE@
-
- .SUFFIXES:
---- 65,71 ----
- -I$(srcdir)/$(MULTISRCTOP)../gcc/config -I$(MULTIBUILDTOP)../../gcc \
- -I$(srcdir)/$(MULTISRCTOP)../include
-
-! OBJC_GCFLAGS=-I/usr/include/gc -DOBJC_WITH_GC=1
- OBJC_THREAD_FILE=thr-@OBJC_THREAD_FILE@
-
- .SUFFIXES:
+++ /dev/null
-/*
-From: Richard Kettlewell <rjk@sfere.greenend.org.uk>
-To: submit@bugs.debian.org
-Subject: Bug#46550: basic_string<wchar_t> can't be instantiated
-Date: Sun, 3 Oct 1999 22:49:50 +0100
-
-Package: libstdc++2.9-dev
-Version: 2.91.60-5
-
-Hi,
-
-This ought to work, but it doesn't:
-
-------------------------------------------------------------------------
-lyonesse$ cat t.cc
-*/
-
-#include <string>
-
-template basic_string<wchar_t>;
-
-/*
-lyonesse$ c++ -c t.cc
-/usr/include/g++-2/std/bastring.h: In method `const __wchar_t * basic_string<__wchar_t,string_char_traits<__wchar_t>,__default_alloc_template<true,0> >::c_str<__wchar_t, string_char_traits<__wchar_t>, alloc>() const':
-t.cc:3: instantiated from here
-/usr/include/g++-2/std/bastring.h:301: return to `const __wchar_t *' from `char *'
-lyonesse$
-------------------------------------------------------------------------
-
-# DP: Here is a patch to /usr/include/g++-2/std/bastring.h which makes it
-# DP: work for me (though note that I have not tested the c_str() method as
-# DP: such):
-
-------------------------------------------------------------------------
---- libstdc++/std/bastring.h.orig Sun Oct 3 22:32:06 1999
-+++ libstdc++/std/bastring.h Sun Oct 3 22:36:17 1999
-@@ -332,7 +332,8 @@
-
- public:
- const charT* c_str () const
-- { if (length () == 0) return ""; terminate (); return data (); }
-+ { const charT* null_str = "";
-+ if (length () == 0) return null_str; terminate (); return data (); }
- void resize (size_type n, charT c);
- void resize (size_type n)
- { resize (n, eos ()); }
+++ /dev/null
-# DP: Throw exception instead of aborting when out of memory
-
-From: inaky@peloncho.fis.ucm.es
-To: submit@bugs.debian.org
-Subject: Bug#42622: libstdc++2.10-dev: stl_alloc.h: malloc_alloc out of memory handling abort()s instead of using exceptions
-Date: Sat, 7 Aug 1999 04:31:58 +0200
-
-Package: libstdc++2.10-dev
-Version: 1:2.95-2
-Severity: important
-
- Hi
-
- While coding some proof-of-concepts I've come around using a
-vector<> of a big lot of elements. Wanted to push the limits and try
-to recover possible failures. No way. The program was aborting on the
-library's own.
-
- That should not do. You want exceptions to be able to dictate
-how the program should behave on error situations. The thing is at
-stl_alloc.h, instead of throwing an exception on OOM, it was printing
-the message "out of memory" to stderr and aborting. It is also
-prepared for doing it via exceptions, so I think it should be the
-default way.
-
- I think that behaviour should be made extensible to the whole
-libstdc++ library, as as far as I know, exception support in GCC is
-mature enough as to handle it [and I hope so :)]. That's the only way
-to fully control a program's flow. Libraries should not dictate what
-to do on error [I'm sure I'm not telling you anything new].
-
- The changes to make stl_alloc work ok with exceptions are:
-
---- libstdc++/stl/stl_alloc.h~ Fri May 7 12:13:28 1999
-+++ libstdc++/stl/stl_alloc.h Sat Aug 7 04:16:22 1999
-@@ -38,7 +38,7 @@
- // The allocation primitives are intended to allocate individual objects,
- // not larger arenas as with the original STL allocators.
-
--#if 0
-+#ifdef __STL_USE_EXCEPTIONS
- # include <new>
- # define __THROW_BAD_ALLOC throw bad_alloc()
- #elif !defined(__THROW_BAD_ALLOC)
-
- Thanks, anyway, for such nice packages for GCC & Co.
-
- Your happy Debian user,
-
--- System Information
-Debian Release: potato
-Kernel Version: Linux jovian 2.2.7 #1 mar ago 3 02:24:40 CEST 1999 i586 unknown
-
-Versions of the packages libstdc++2.10-dev depends on:
-ii g++ 2.95-2 The GNU C++ compiler.
-ii libc6-dev 2.1.2-0pre4 GNU C Library: Development libraries and hea
-ii libstdc++2.10 2.95-2 The GNU stdc++ library
+++ /dev/null
-# DP: enable definition of wstring type, if __ENABLE_WSTRING is defined.
-
---- libstdc++/string~ Sat Feb 20 13:21:49 1999
-+++ libstdc++/string Sun Dec 5 16:35:27 1999
-@@ -7,7 +7,9 @@
-
- extern "C++" {
- typedef basic_string <char> string;
--// typedef basic_string <wchar_t> wstring;
-+#ifdef __ENABLE_WSTRING
-+typedef basic_string <wchar_t> wstring;
-+#endif
- } // extern "C++"
-
- #endif
+++ /dev/null
-diff -ur gcc-2.95.1.orig/libstdc++/config/linux.ml gcc-2.95.1/libstdc++/config/linux.ml
---- gcc-2.95.1.orig/libstdc++/config/linux.ml Sun Aug 30 23:18:46 1998
-+++ gcc-2.95.1/libstdc++/config/linux.ml Thu Aug 19 20:13:06 1999
-@@ -1,10 +1,5 @@
- # Elf with shared libm, so we can link it into the shared libstdc++.
-
--ARLIB = libstdc++-$(LIBSTDCXX_INTERFACE)$(LIBC_INTERFACE)$(CXX_INTERFACE)-$(VERSION).a
--MARLINK = libstdc++$(LIBC_INTERFACE)$(CXX_INTERFACE).a.$(LIBSTDCXX_INTERFACE)
--SHLIB = libstdc++-$(LIBSTDCXX_INTERFACE)$(LIBC_INTERFACE)$(CXX_INTERFACE)-$(VERSION).so
--MSHLINK = libstdc++$(LIBC_INTERFACE)$(CXX_INTERFACE).so.$(LIBSTDCXX_INTERFACE)
--
- LIBS = $(ARLIB) marlink $(ARLINK) $(SHLIB) mshlink $(SHLINK)
- SHFLAGS = -Wl,-soname,$(MSHLINK)
- SHDEPS = -lm
-diff -ur gcc-2.95.1.orig/libstdc++/configure.in gcc-2.95.1/libstdc++/configure.in
---- gcc-2.95.1.orig/libstdc++/configure.in Tue Jun 8 01:28:10 1999
-+++ gcc-2.95.1/libstdc++/configure.in Thu Aug 19 20:15:53 1999
-@@ -193,7 +193,7 @@
- if test x${enable_version_specific_runtime_libs} = xyes; then
- gxx_include_dir='${libsubdir}/include/g++'
- else
-- gxx_include_dir='${prefix}/include/g++'-${libstdcxx_interface}
-+ gxx_include_dir='${prefix}/include/g++'
- fi
- fi
-
---- gcc-2.95.1/libstdc++/Makefile.in~ Thu Aug 5 10:00:40 1999
-+++ gcc-2.95.1/libstdc++/Makefile.in Fri Aug 20 15:22:06 1999
-@@ -30,8 +30,8 @@
- memory numeric pthread_alloc queue rope set slist stack utility \
- vector fstream iomanip iostream strstream iosfwd bitset valarray
-
--ARLIB = libstdc++.a.$(VERSION)
--ARLINK = libstdc++.a
-+ARLIB = libstdc++.a
-+ARLINK = libstdc++.a.$(VERSION)
- MARLINK = libstdc++.a.`echo $(VERSION) | sed 's/\([0-9]*[.][0-9]*\).*/\1/'`
- SHLIB = libstdc++.so.$(VERSION)
- SHARLIB = libstdc++-sh.a
+++ /dev/null
-# DP: Two patches by Andreas Schwab to fix -fpic and loop optimization.
-# DP: Another patch by Andreas Schwab to fix %a5 restauration in some cases.
-
-------------------------------------------------------------------------------
---- gcc/config/m68k/m68k.c~ Mon Aug 2 06:51:08 1999
-+++ gcc/config/m68k/m68k.c Fri Oct 22 11:47:09 1999
-@@ -356,7 +356,7 @@
- mask &= ~ (1 << (15 - FRAME_POINTER_REGNUM));
- num_saved_regs--;
- }
-- if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM])
-+ if (flag_pic && current_function_uses_pic_offset_table)
- {
- mask |= 1 << (15 - PIC_OFFSET_TABLE_REGNUM);
- num_saved_regs++;
-@@ -493,7 +493,10 @@
- for (regno = 0 ; regno < FIRST_PSEUDO_REGISTER ; regno++)
- if (regs_ever_live[regno] && ! call_used_regs[regno])
- return 0;
--
-+
-+ if (flag_pic && current_function_uses_pic_offset_table)
-+ return 0;
-+
- return 1;
- }
-
-@@ -568,7 +571,7 @@
- nregs++;
- mask |= 1 << regno;
- }
-- if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM])
-+ if (flag_pic && current_function_uses_pic_offset_table)
- {
- nregs++;
- mask |= 1 << PIC_OFFSET_TABLE_REGNUM;
-@@ -1334,8 +1337,6 @@
- gen_rtx_PLUS (Pmode,
- pic_offset_table_rtx, orig));
- current_function_uses_pic_offset_table = 1;
-- if (reload_in_progress)
-- regs_ever_live[PIC_OFFSET_TABLE_REGNUM] = 1;
- RTX_UNCHANGING_P (pic_ref) = 1;
- emit_move_insn (reg, pic_ref);
- return reg;
---- gcc/loop.c~ Fri Jun 25 06:38:11 1999
-+++ gcc/loop.c Fri Oct 22 11:45:16 1999
-@@ -4046,11 +4046,11 @@
- in-between when biv_toal_increment returns nonzero both times
- but we test it here in case some day some real cfg analysis
- gets used to set always_computable. */
-- && ((loop_insn_first_p (bl2->biv->insn, bl->biv->insn)
-- && no_labels_between_p (bl2->biv->insn, bl->biv->insn))
-- || (! reg_used_between_p (bl->biv->src_reg, bl->biv->insn,
-- bl2->biv->insn)
-- && no_jumps_between_p (bl->biv->insn, bl2->biv->insn)))
-+ && (loop_insn_first_p (bl2->biv->insn, bl->biv->insn)
-+ ? no_labels_between_p (bl2->biv->insn, bl->biv->insn)
-+ : (! reg_used_between_p (bl->biv->src_reg, bl->biv->insn,
-+ bl2->biv->insn)
-+ && no_jumps_between_p (bl->biv->insn, bl2->biv->insn)))
- && validate_change (bl->biv->insn,
- &SET_SRC (single_set (bl->biv->insn)),
- copy_rtx (src), 0))
+++ /dev/null
-# DP: Document exit codes.
-
-Wed Oct 20 22:55:23 1999 Matthias Klose <doko@debian.org>
-
- * gcc.1: Document exit codes.
-
---- gcc/gcc.1.orig Thu Oct 21 12:52:54 1999
-+++ gcc/gcc.1 Thu Oct 21 12:53:15 1999
-@@ -4141,6 +4141,11 @@
- if available, else
- .B /tmp\c
- \&).
-+.SH "EXIT STATUS"
-+Normally the exit status is 0, if compilation or link edit are successful,
-+and nonzero else. The option
-+.B -Werror
-+treats each warning as an error.
- .SH "SEE ALSO"
- cpp(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1).
- .br
+++ /dev/null
-2002-08-17 H.J. Lu <hjl@gnu.org>
-
- * calls.c (PUSH_ARGS_REVERSED): Define only if not defined.
- * expr.c (PUSH_ARGS_REVERSED): Likewise.
-
-2002-07-26 H.J. Lu <hjl@gnu.org>
-
- * config/i386/i386.h (PUSH_ARGS_REVERSED): Set to 1.
-
---- gcc/calls.c.var Thu Apr 4 15:28:47 2002
-+++ gcc/calls.c Sat Aug 17 22:45:46 2002
-@@ -46,9 +46,11 @@ Software Foundation, 59 Temple Place - S
-
- #ifdef PUSH_ROUNDING
-
-+#ifndef PUSH_ARGS_REVERSED
- #if defined (STACK_GROWS_DOWNWARD) != defined (ARGS_GROW_DOWNWARD)
- #define PUSH_ARGS_REVERSED PUSH_ARGS
- #endif
-+#endif
-
- #endif
-
---- gcc/config/i386/i386.h.var Sun Jul 14 23:54:36 2002
-+++ gcc/config/i386/i386.h Sat Aug 17 19:03:21 2002
-@@ -1581,6 +1581,10 @@ enum reg_class
-
- #define PUSH_ARGS (TARGET_PUSH_ARGS && !ACCUMULATE_OUTGOING_ARGS)
-
-+/* We want the stack and args grow in opposite directions, even if
-+ PUSH_ARGS is 0. */
-+#define PUSH_ARGS_REVERSED 1
-+
- /* Offset of first parameter from the argument pointer register value. */
- #define FIRST_PARM_OFFSET(FNDECL) 0
-
---- gcc/expr.c.var Mon May 6 22:43:11 2002
-+++ gcc/expr.c Sat Aug 17 22:52:27 2002
-@@ -54,9 +54,11 @@ Software Foundation, 59 Temple Place - S
-
- #ifdef PUSH_ROUNDING
-
-+#ifndef PUSH_ARGS_REVERSED
- #if defined (STACK_GROWS_DOWNWARD) != defined (ARGS_GROW_DOWNWARD)
- #define PUSH_ARGS_REVERSED /* If it's last to first. */
- #endif
-+#endif
-
- #endif
-
-2002-08-18 H.J. Lu <hjl@gnu.org>
-
- * calls.c (store_one_arg): Remove ATTRIBUTE_UNUSED on
- variable_size. Mark any slots used for the argument as in-use
- only if we can't pass all arguments to a library call in
- registers.
-
---- gcc/calls.c.copy Sun Aug 18 07:35:11 2002
-+++ gcc/calls.c Sun Aug 18 08:27:29 2002
-@@ -4270,7 +4270,7 @@ store_one_arg (arg, argblock, flags, var
- struct arg_data *arg;
- rtx argblock;
- int flags;
-- int variable_size ATTRIBUTE_UNUSED;
-+ int variable_size;
- int reg_parm_stack_space;
- {
- tree pval = arg->tree_value;
-@@ -4345,14 +4345,22 @@ store_one_arg (arg, argblock, flags, var
- emit_move_insn (arg->save_area, stack_area);
- }
- }
-+
-+ /* Now that we have saved any slots that will be overwritten
-+ by this store, mark all slots this store will use. We
-+ must do this before we actually expand the argument since
-+ the expansion itself may trigger library calls which might
-+ need to use the same stack slot. We only do it if we can't
-+ pass all arguments to a library call in registers. */
-+ if (arg->partial)
-+ {
-+ for (i = lower_bound; i < upper_bound; i++)
-+ stack_usage_map[i] = 1;
-+
-+ /* Set it so that we don't do it again. */
-+ variable_size = 1;
-+ }
- }
-- /* Now that we have saved any slots that will be overwritten by this
-- store, mark all slots this store will use. We must do this before
-- we actually expand the argument since the expansion itself may
-- trigger library calls which might need to use the same stack slot. */
-- if (argblock && ! variable_size && arg->stack)
-- for (i = lower_bound; i < upper_bound; i++)
-- stack_usage_map[i] = 1;
- }
-
- /* If this isn't going to be placed on both the stack and in registers,
-@@ -4579,6 +4587,11 @@ store_one_arg (arg, argblock, flags, var
- arg->value = arg->stack_slot;
- }
-
-+ if (ACCUMULATE_OUTGOING_ARGS && !(flags & ECF_SIBCALL)
-+ && argblock && ! variable_size && arg->stack)
-+ for (i = lower_bound; i < upper_bound; i++)
-+ stack_usage_map[i] = 1;
-+
- /* Once we have pushed something, pops can't safely
- be deferred during the rest of the arguments. */
- NO_DEFER_POP;
---- gcc-4.1-20050522/gcc/Makefile.in.orig 2005-05-20 21:17:40.000000000 +0000
-+++ gcc-4.1-20050522/gcc/Makefile.in 2005-05-26 10:49:01.000000000 +0000
-@@ -148,10 +148,10 @@
+--- gcc-3.3.3/gcc/Makefile.in.orig 2004-02-16 18:57:42.824016056 +0100
++++ gcc-3.3.3/gcc/Makefile.in 2004-02-16 18:59:52.167352880 +0100
+@@ -65,9 +65,9 @@
# TCFLAGS is used for compilations with the GCC just built.
XCFLAGS =
TCFLAGS =
-CFLAGS = -g
-STAGE1_CFLAGS = -g @stage1_cflags@
+-BOOT_CFLAGS = -g -O2
+CFLAGS =
+STAGE1_CFLAGS = @stage1_cflags@
- STAGE1_CHECKING = -DENABLE_CHECKING -DENABLE_ASSERT_CHECKING
--BOOT_CFLAGS = -g -O2
+BOOT_CFLAGS = -O2
# Flags to determine code coverage. When coverage is disabled, this will
# contain the optimization flags, as you normally want code coverage
-@@ -520,7 +520,7 @@
+@@ -390,7 +390,7 @@
# Options to use when compiling libgcc2.a.
#
-LIBGCC2_DEBUG_CFLAGS = -g
+LIBGCC2_DEBUG_CFLAGS =
- LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) \
- $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \
- -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED @inhibit_libc@
---- gcc-4.0-20040919/gcc/ada/Makefile.in.orig 2004-09-13 12:18:40.000000000 +0200
-+++ gcc-4.0-20040919/gcc/ada/Makefile.in 2004-09-26 11:40:30.070894416 +0200
+ LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED @inhibit_libc@
+
+ # Additional options to use when compiling libgcc2.a.
+--- gcc-3.3.3/gcc/ada/Makefile.in.orig 2004-02-16 08:29:33.000000000 +0100
++++ gcc-3.3.3/gcc/ada/Makefile.in 2004-02-16 19:04:55.708207656 +0100
@@ -73,7 +73,7 @@
# to the stage2 and stage3 compilations
# XCFLAGS is used for most compilations but not when using the GCC just built.
BOOT_CFLAGS = -O $(CFLAGS)
# These exists to be overridden by the x-* and t-* files, respectively.
X_CFLAGS =
-@@ -118,9 +118,9 @@
- ADA_CFLAGS =
- ADAFLAGS = -W -Wall -gnatpg -gnata
+@@ -127,7 +127,7 @@
SOME_ADAFLAGS =-gnata
--FORCE_DEBUG_ADAFLAGS = -g
-+FORCE_DEBUG_ADAFLAGS =
- GNATLIBFLAGS = -gnatpg -nostdinc
+ FORCE_DEBUG_ADAFLAGS = -g
+ GNATLIBFLAGS = -gnatpg
-GNATLIBCFLAGS = -g -O2
+GNATLIBCFLAGS = -O2
GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -fexceptions \
-DIN_RTS
ALL_ADA_CFLAGS = $(X_ADA_CFLAGS) $(T_ADA_CFLAGS) $(ADA_CFLAGS)
---- gcc/libada/Makefile.in.orig 2005-11-04 13:49:08.000000000 +0000
-+++ gcc/libada/Makefile.in 2005-11-24 23:52:14.739531296 +0000
-@@ -54,7 +54,6 @@
- include $(GCC_DIR)/libada-mk
-
- TARGET_LIBGCC2_CFLAGS=
--GNATLIBCFLAGS= -g -O2
- # Get target-specific overrides for TARGET_LIBGCC2_CFLAGS
- # and possibly GNATLIBCFLAGS. Currently this uses files
- # in gcc/config. The 'subst' call is used to rerelativize them
---- gcc-4.0-20040919/libffi/Makefile.am.orig 2004-08-30 17:42:59.000000000 +0200
-+++ gcc-4.0-20040919/libffi/Makefile.am 2004-09-26 11:44:10.789340112 +0200
-@@ -138,7 +138,7 @@
- libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
- nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
-
--AM_CFLAGS = -Wall -g -fexceptions
-+AM_CFLAGS = -Wall -fexceptions
-
- libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
-
---- gcc-4.0-20040919/libffi/Makefile.in.orig 2004-09-19 19:47:04.000000000 +0200
-+++ gcc-4.0-20040919/libffi/Makefile.in 2004-09-26 11:44:17.253357432 +0200
-@@ -385,7 +385,7 @@
- nodist_libffi_la_SOURCES = $(am__append_1) $(am__append_2) $(am__append_3) $(am__append_4) $(am__append_5) $(am__append_6) $(am__append_7) $(am__append_8) $(am__append_9) $(am__append_10) $(am__append_11) $(am__append_12) $(am__append_13) $(am__append_14) $(am__append_15) $(am__append_16) $(am__append_17) $(am__append_18)
- libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
- nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
--AM_CFLAGS = -Wall -g -fexceptions
-+AM_CFLAGS = -Wall -fexceptions
- libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
- AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
- AM_CCASFLAGS = $(AM_CPPFLAGS)
---- gcc-4.0-20040919/libjava/Makefile.am.orig 2004-09-10 10:22:58.000000000 +0200
-+++ gcc-4.0-20040919/libjava/Makefile.am 2004-09-26 11:46:24.041082768 +0200
-@@ -179,7 +179,7 @@
- ## Extra CFLAGS used for JNI C sources shared with GNU Classpath.
- PEDANTIC_CFLAGS = -ansi -pedantic -Wall -Wno-long-long
+--- gcc-3.3.3/libjava/Makefile.am.orig 2004-02-16 08:29:34.000000000 +0100
++++ gcc-3.3.3/libjava/Makefile.am 2004-02-16 19:02:25.582030304 +0100
+@@ -95,7 +95,7 @@
+ AM_CFLAGS = @LIBGCJ_CFLAGS@
+ endif
-JCFLAGS = -g
+JCFLAGS =
JC1FLAGS = @LIBGCJ_JAVAFLAGS@ $(GCJFLAGS)
LIBFFIINCS = @LIBFFIINCS@
---- gcc-4.0-20040919/libjava/Makefile.in.orig 2004-09-19 19:47:04.000000000 +0200
-+++ gcc-4.0-20040919/libjava/Makefile.in 2004-09-26 11:47:02.431246576 +0200
-@@ -4167,7 +4167,7 @@
- @USING_GCC_FALSE@AM_CFLAGS = @LIBGCJ_CFLAGS@
- @USING_GCC_TRUE@AM_CFLAGS = @LIBGCJ_CFLAGS@ $(WARNINGS)
- PEDANTIC_CFLAGS = -ansi -pedantic -Wall -Wno-long-long
+--- gcc-3.3.3/libjava/Makefile.in.orig 2004-02-16 08:29:34.000000000 +0100
++++ gcc-3.3.3/libjava/Makefile.in 2004-02-16 19:02:31.196176824 +0100
+@@ -180,7 +180,7 @@
+ @USING_GCC_TRUE@AM_CFLAGS = @USING_GCC_TRUE@@LIBGCJ_CFLAGS@ $(WARNINGS)
+ @USING_GCC_FALSE@AM_CFLAGS = @USING_GCC_FALSE@@LIBGCJ_CFLAGS@
+
-JCFLAGS = -g
+JCFLAGS =
JC1FLAGS = @LIBGCJ_JAVAFLAGS@ $(GCJFLAGS)
- AM_CPPFLAGS = -I$(top_srcdir) -Iinclude -I$(top_srcdir)/include \
- $(GCINCS) $(THREADINCS) $(INCLTDL) \
+
+ LIBFFIINCS = @LIBFFIINCS@
+++ /dev/null
---- gcc-3.3.3/gcc/gcc.c Sat Dec 22 01:40:45 2001
-+++ gcc-3.3.3/gcc/gcc.c.new Sun Dec 23 18:43:36 2001
-@@ -1160,13 +1160,13 @@
- /* Supply defaults for the standard prefixes. */
-
- #ifndef STANDARD_EXEC_PREFIX
--#define STANDARD_EXEC_PREFIX "/usr/local/lib/gcc-lib/"
-+#define STANDARD_EXEC_PREFIX "/usr/lib/gcc-lib/"
- #endif
- #ifndef TOOLDIR_BASE_PREFIX
--#define TOOLDIR_BASE_PREFIX "/usr/local/"
-+#define TOOLDIR_BASE_PREFIX "/usr/"
- #endif
- #ifndef STANDARD_BINDIR_PREFIX
--#define STANDARD_BINDIR_PREFIX "/usr/local/bin"
-+#define STANDARD_BINDIR_PREFIX "/usr/bin"
- #endif
-
- static const char *standard_exec_prefix = STANDARD_EXEC_PREFIX;
+++ /dev/null
-diff -urN gcc-2.95.3.test1.org/gcc/Makefile.in gcc-2.95.3.test1/gcc/Makefile.in
---- gcc-2.95.3.test1.org/gcc/Makefile.in Wed Jan 3 20:34:29 2001
-+++ gcc-2.95.3.test1/gcc/Makefile.in Wed Jan 3 20:37:33 2001
-@@ -368,6 +368,9 @@
- # libgcc1-test target (must also be overridable for a target)
- LIBGCC1_TEST = libgcc1-test
-
-+# The libgcc symbol versioning map.
-+LIBGCC_MAP=
-+
- # List of extra executables that should be compiled for this target machine
- # that are used for compiling from source code to object code.
- # The rules for compiling them should be in the t-* file for the machine.
-@@ -838,14 +841,14 @@
- # Note that we can compile enquire using the cross-compiler just built,
- # although we can't run it on this machine.
- all.cross: native gcc-cross specs stmp-headers $(STMP_FIXPROTO) $(LIBGCC) \
-- $(LIBGCC1_TEST) $(EXTRA_PARTS) lang.all.cross doc
-+ $(LIBGCC_MAP) $(LIBGCC1_TEST) $(EXTRA_PARTS) lang.all.cross doc
- # This is what to compile if making gcc with a cross-compiler.
- all.build: native xgcc$(exeext) cpp$(exeext) $(EXTRA_PARTS) lang.all.build
- # This is what must be made before installing GCC and converting libraries.
- start.encap: native xgcc$(exeext) cpp$(exeext) specs $(LIBGCC1) \
- xlimits.h lang.start.encap
- # These can't be made until after GCC can run.
--rest.encap: stmp-headers $(STMP_FIXPROTO) $(LIBGCC) $(EXTRA_PARTS) lang.rest.encap
-+rest.encap: stmp-headers $(STMP_FIXPROTO) $(LIBGCC) $(LIBGCC_MAP) $(EXTRA_PARTS) lang.rest.encap
- # This is what is made with the host's compiler
- # whether making a cross compiler or not.
- native: config.status auto-host.h intl.all $(LANGUAGES) \
-@@ -860,7 +863,7 @@
-
- # On the target machine, finish building a cross compiler.
- # This does the things that can't be done on the host machine.
--rest.cross: $(LIBGCC) specs
-+rest.cross: $(LIBGCC) $(LIBGCC_MAP) specs
-
- # Verify that it works to compile and link libgcc1-test.
- # If it does, then there are sufficient replacements for libgcc1.a.
-@@ -2353,7 +2356,7 @@
- # Using unprotoize.c is not quite right in the first place,
- # but what better way is there?
- -rm -f libgcc.a libgcc1.a libgcc1-asm.a libgcc2.a libgcc2.ready
-- -rm -f libgcc1.null
-+ -rm -f libgcc1.null libgcc.map
- -rm -f *.dvi
- -rm -f */*.dvi
- -if [ -f md.pre-cpp ]; then \
-@@ -2526,6 +2529,12 @@
- $(INSTALL_DATA) specs $(libsubdir)/specs; \
- chmod a-x $(libsubdir)/specs; \
- fi
-+# Install libgcc.map if it exists.
-+ -if [ -n "$(LIBGCC_MAP)" -a -f libgcc.map ] ; then \
-+ rm -f $(libsubdir)/libgcc.map; \
-+ $(INSTALL_DATA) libgcc.map $(libsubdir)/libgcc.map; \
-+ chmod a-x $(libsubdir)/libgcc.map; \
-+ fi
- # Install protoize if it was compiled.
- -if [ -f protoize$(exeext) ]; \
- then \
-@@ -3032,7 +3041,10 @@
- do \
- if [ -d stage1/$$dir ] ; then true ; else mkdir stage1/$$dir ; fi ; \
- done
-- -mv $(STAGESTUFF) stage1
-+ -for i in $(STAGESTUFF) ; \
-+ do \
-+ mv $$i stage1 ; \
-+ done
- -mv intl/*$(objext) stage1/intl
- # Copy as/ld if they exist to stage dir, so that running xgcc from the stage
- # dir will work properly.
-@@ -3041,6 +3053,10 @@
- -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage1 ; else true ; fi
- -rm -f stage1/libgcc.a
- -cp libgcc.a stage1
-+ -if [ -n "$(LIBGCC_MAP)" -a -f libgcc.map ] ; then \
-+ rm -f stage1/libgcc.map; \
-+ cp libgcc.map stage1; \
-+ fi
- -if $(RANLIB_TEST_FOR_TARGET) ; then \
- $(RANLIB_FOR_TARGET) stage1/libgcc.a; \
- else true; fi
-@@ -3056,7 +3072,10 @@
- do \
- if [ -d stage2/$$dir ] ; then true ; else mkdir stage2/$$dir ; fi ; \
- done
-- -mv $(STAGESTUFF) stage2
-+ -for i in $(STAGESTUFF) ; \
-+ do \
-+ mv $$i stage2 ; \
-+ done
- -mv intl/*$(objext) stage2/intl
- # Copy as/ld if they exist to stage dir, so that running xgcc from the stage
- # dir will work properly.
-@@ -3065,6 +3084,10 @@
- -if [ -f collect-ld ] ; then $(LN_S) ../collect-ld$(exeext) stage2 ; else true ; fi
- -rm -f stage2/libgcc.a
- -cp libgcc.a stage2
-+ -if [ -n "$(LIBGCC_MAP)" -a -f libgcc.map ] ; then \
-+ rm -f stage2/libgcc.map; \
-+ cp libgcc.map stage2; \
-+ fi
- -if $(RANLIB_TEST_FOR_TARGET) ; then \
- $(RANLIB_FOR_TARGET) stage2/libgcc.a; \
- else true; fi
-@@ -3080,7 +3103,10 @@
- do \
- if [ -d stage3/$$dir ] ; then true ; else mkdir stage3/$$dir ; fi ; \
- done
-- -mv $(STAGESTUFF) stage3
-+ -for i in $(STAGESTUFF) ; \
-+ do \
-+ mv $$i stage3 ; \
-+ done
- -mv intl/*$(objext) stage3/intl
- # Copy as/ld if they exist to stage dir, so that running xgcc from the stage
- # dir will work properly.
-@@ -3089,6 +3115,10 @@
- -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage3 ; else true ; fi
- -rm -f stage3/libgcc.a
- -cp libgcc.a stage3
-+ -if [ -n "$(LIBGCC_MAP)" -a -f libgcc.map ] ; then \
-+ rm -f stage3/libgcc.map; \
-+ cp libgcc.map stage3; \
-+ fi
- -if $(RANLIB_TEST_FOR_TARGET) ; then \
- $(RANLIB_FOR_TARGET) stage3/libgcc.a; \
- else true; fi
-@@ -3104,7 +3134,10 @@
- do \
- if [ -d stage4/$$dir ] ; then true ; else mkdir stage4/$$dir ; fi ; \
- done
-- -mv $(STAGESTUFF) stage4
-+ -for i in $(STAGESTUFF) ; \
-+ do \
-+ mv $$i stage4 ; \
-+ done
- -mv intl/*$(objext) stage4/intl
- # Copy as/ld if they exist to stage dir, so that running xgcc from the stage
- # dir will work properly.
-@@ -3113,6 +3146,10 @@
- -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage4 ; else true ; fi
- -rm -f stage4/libgcc.a
- -cp libgcc.a stage4
-+ -if [ -n "$(LIBGCC_MAP)" -a -f libgcc.map ] ; then \
-+ rm -f stage4/libgcc.map; \
-+ cp libgcc.map stage4; \
-+ fi
- -if $(RANLIB_TEST_FOR_TARGET) ; then \
- $(RANLIB_FOR_TARGET) stage4/libgcc.a; \
- else true; fi
-@@ -3196,3 +3233,9 @@
- echo "#endif" >> t-float.h-cross
- mv t-float.h-cross float.h-cross
-
-+# Rule to generate the libgcc symbol versioning map.
-+libgcc.map:
-+ echo "GCC.INTERNAL {" > $@
-+ echo " local:" >> $@
-+ $(EXTRACT_LIBGCC) >> $@
-+ echo "};" >> $@
-diff -urN gcc-2.95.3.test1.org/gcc/config/i386/i386.md gcc-2.95.3.test1/gcc/config/i386/i386.md
---- gcc-2.95.3.test1.org/gcc/config/i386/i386.md Wed Jan 3 20:34:36 2001
-+++ gcc-2.95.3.test1/gcc/config/i386/i386.md Wed Jan 3 20:35:21 2001
-@@ -1345,7 +1345,8 @@
- else if ((reload_in_progress | reload_completed) == 0
- && GET_CODE (operands[0]) != MEM
- && GET_CODE (operands[1]) == CONST_DOUBLE
-- && !standard_80387_constant_p (operands[1]))
-+ && ((flag_pic && flag_omit_frame_pointer)
-+ || ! standard_80387_constant_p (operands[1])))
- {
- operands[1] = validize_mem (force_const_mem (SFmode, operands[1]));
- }
-@@ -1473,7 +1474,8 @@
- else if ((reload_in_progress | reload_completed) == 0
- && GET_CODE (operands[0]) != MEM
- && GET_CODE (operands[1]) == CONST_DOUBLE
-- && !standard_80387_constant_p (operands[1]))
-+ && ((flag_pic && flag_omit_frame_pointer)
-+ || ! standard_80387_constant_p (operands[1])))
- {
- operands[1] = validize_mem (force_const_mem (DFmode, operands[1]));
- }
-@@ -1601,7 +1603,8 @@
- else if ((reload_in_progress | reload_completed) == 0
- && GET_CODE (operands[0]) != MEM
- && GET_CODE (operands[1]) == CONST_DOUBLE
-- && !standard_80387_constant_p (operands[1]))
-+ && ((flag_pic && flag_omit_frame_pointer)
-+ || ! standard_80387_constant_p (operands[1])))
- {
- operands[1] = validize_mem (force_const_mem (XFmode, operands[1]));
- }
-diff -urN gcc-2.95.3.test1.org/gcc/config/linux.h gcc-2.95.3.test1/gcc/config/linux.h
---- gcc-2.95.3.test1.org/gcc/config/linux.h Wed Jan 3 20:34:33 2001
-+++ gcc-2.95.3.test1/gcc/config/linux.h Wed Jan 3 20:35:22 2001
-@@ -103,7 +103,7 @@
- %{!profile:%{!ggdb:-lc} %{ggdb:-lg}}}"
- #else
- #define LIB_SPEC \
-- "%{shared: -lc} \
-+ "%{shared: -lc --version-script libgcc.map%s} \
- %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \
- %{profile:-lc_p} %{!profile: -lc}}"
- #endif
-diff -urN gcc-2.95.3.test1.org/gcc/config/t-linux gcc-2.95.3.test1/gcc/config/t-linux
---- gcc-2.95.3.test1.org/gcc/config/t-linux Wed Jan 3 20:34:33 2001
-+++ gcc-2.95.3.test1/gcc/config/t-linux Wed Jan 3 20:35:22 2001
-@@ -14,3 +14,17 @@
- LIBGCC1 =
- CROSS_LIBGCC1 =
- LIBGCC1_TEST =
-+
-+# Make glocal functions in libgcc.a local to the shared library with
-+# symbol versioning.
-+LIBGCC_MAP=libgcc.map
-+# This list has to be maintained manually. It should cover the libgcc
-+# functions, which can be safely made local to a shared library, on
-+# all Linux platforms.
-+LIBGCC_MAP_LIST=__ashldi3 __ashrdi3 __builtin_saveregs __clear_cache \
-+ __cmpdi2 __divdi3 __dummy __eprintf __ffsdi2 __fixdfdi __fixsfdi \
-+ __fixunsdfdi __fixunsdfsi __fixunssfdi __fixunssfsi __fixunsxfdi \
-+ __fixunsxfsi __fixxfdi __floatdidf __floatdisf __floatdixf \
-+ __gcc_bcmp __lshrdi3 __moddi3 __muldi3 __negdi2 __pure_virtual \
-+ __ucmpdi2 __udiv_w_sdiv __udivdi3 __udivmoddi4 __umoddi3
-+EXTRACT_LIBGCC=for s in $(LIBGCC_MAP_LIST); do echo " $$s;"; done
-diff -urN gcc-2.95.3.test1.org/gcc/f/Make-lang.in gcc-2.95.3.test1/gcc/f/Make-lang.in
---- gcc-2.95.3.test1.org/gcc/f/Make-lang.in Wed Jan 3 20:34:42 2001
-+++ gcc-2.95.3.test1/gcc/f/Make-lang.in Wed Jan 3 20:35:22 2001
-@@ -212,7 +212,7 @@
-
- f77.all.build: g77$(exeext)
- f77.all.cross: g77-cross$(exeext)
--f77.start.encap: g77$(exeext)
-+f77.start.encap: g77$(exeext) $(srcdir)/f/intdoc.texi
- f77.rest.encap:
-
- f77.info: f/g77.info
-diff -urN gcc-2.95.3.test1.org/libf2c/Makefile.in gcc-2.95.3.test1/libf2c/Makefile.in
---- gcc-2.95.3.test1.org/libf2c/Makefile.in Wed Jan 3 20:34:47 2001
-+++ gcc-2.95.3.test1/libf2c/Makefile.in Wed Jan 3 20:35:22 2001
-@@ -61,18 +61,18 @@
- # Quote this way so that it can be used to set shell variables too.
- # Currently no use for PICFLAG, RUNTESTFLAGS -- check usage.
- FLAGS_TO_PASS= \
-- CC='$(CC)' \
-- CFLAGS='$(CFLAGS)' \
-- CPPFLAGS='$(CPPFLAGS)' \
-- AR='$(AR)' \
-- RANLIB='$(RANLIB)' \
-- PICFLAG='$(PICFLAG)' \
-- RUNTESTFLAGS='$(RUNTESTFLAGS)' \
-- prefix='$(prefix)' \
-- exec_prefix='$(exec_prefix)' \
-- libdir='$(libdir)' \
-- libsubdir='$(libsubdir)' \
-- tooldir='$(tooldir)'
-+ "CC=$(CC)" \
-+ "CFLAGS=$(CFLAGS)" \
-+ "CPPFLAGS=$(CPPFLAGS)" \
-+ "AR=$(AR)" \
-+ "RANLIB=$(RANLIB)" \
-+ "PICFLAG=$(PICFLAG)" \
-+ "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
-+ "prefix=$(prefix)" \
-+ "exec_prefix=$(exec_prefix)" \
-+ "libdir=$(libdir)" \
-+ "libsubdir=$(libsubdir)" \
-+ "tooldir=$(tooldir)"
-
- LIBG2C = libg2c.a
-
+++ /dev/null
-#! /bin/sh -e
-
-if [ $# -eq 3 -a "$2" = '-d' ]; then
- pdir="-d $3"
-elif [ $# -ne 1 ]; then
- echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
- exit 1
-fi
-case "$1" in
- -patch) patch $pdir -f --no-backup-if-mismatch -p0 < $0;;
- -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p0 < $0;;
- *)
- echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
- exit 1
-esac
-exit 0
-
-# append the patch here and adjust the -p? flag in the patch calls.
-
-From: Jim Kingdon <kingdon@redhat.com>
-To: rth@cygnus.com
-CC: gcc-patches@gcc.gnu.org
-Subject: Re: patch to make -Wpointer-arith work with glibc 2.1.2pre3
-Date: Tue, 21 Sep 1999 15:50:20 -0400
-
-Richard Henderson writes:
-
-> This could all be tidied a bit by creating a couple of macros near
-> the beginning of c-parse.in to do the encoding and decoding. Also,
-> setting the type of `extension' means $<itype>1 can be written $1.
-
-Here you go (sorry for the delay, I plead hurricanes and other
-causes).
-
-Let me know if you still aren't happy :-).
-
-# DP: Wed Sep 1 09:12:02 1999 Jim Kingdon <http://developer.redhat.com>
-# DP:
-# DP: * c-parse.in: save and restore warn_pointer_arith on __extension__
-# DP: along with pedantic.
-# DP: (SAVE_WARN_FLAGS, RESTORE_WARN_FLAGS): Added.
-# DP: Set the type of extension to itype rather than $<itype>1 kludge.
-# DP: * extend.texi (Alternate Keywords): Adjust documentation.
-
-Index: c-parse.in
-===================================================================
-RCS file: /cvs/egcs/egcs/gcc/c-parse.in,v
-retrieving revision 1.23
-diff -u -r1.23 c-parse.in
---- gcc/c-parse.in 1999/09/07 05:47:29 1.23
-+++ gcc/c-parse.in 1999/09/21 19:05:43
-@@ -185,6 +185,8 @@
- %type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
- %type <ttype> identifiers_or_typenames
-
-+%type <itype> extension
-+
- %type <itype> setspecs
-
- %type <ends_in_label> lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label
-@@ -227,6 +229,15 @@
- /* 1 if we explained undeclared var errors. */
- static int undeclared_variable_notice;
-
-+/* For __extension__, save/restore the warning flags which are
-+ controlled by __extension__. */
-+#define SAVE_WARN_FLAGS() (pedantic | (warn_pointer_arith << 1))
-+#define RESTORE_WARN_FLAGS(val) \
-+ do { \
-+ pedantic = val & 1; \
-+ warn_pointer_arith = (val >> 1) & 1; \
-+ } while (0)
-+
- ifobjc
- /* Objective-C specific information */
-
-@@ -297,7 +308,7 @@
- else
- error ("argument of `asm' is not a constant string"); }
- | extension extdef
-- { pedantic = $<itype>1; }
-+ { RESTORE_WARN_FLAGS ($1); }
- ;
-
- datadef:
-@@ -438,7 +449,7 @@
- /* __extension__ turns off -pedantic for following primary. */
- | extension cast_expr %prec UNARY
- { $$ = $2;
-- pedantic = $<itype>1; }
-+ RESTORE_WARN_FLAGS ($1); }
- | unop cast_expr %prec UNARY
- { $$ = build_unary_op ($1, $2, 0);
- overflow_warning ($$); }
-@@ -1002,7 +1013,7 @@
- | declmods ';'
- { pedwarn ("empty declaration"); }
- | extension decl
-- { pedantic = $<itype>1; }
-+ { RESTORE_WARN_FLAGS ($1); }
- ;
-
- /* Declspecs which contain at least one type specifier or typedef name.
-@@ -1607,7 +1618,7 @@
- { $$ = NULL_TREE; }
- | extension component_decl
- { $$ = $2;
-- pedantic = $<itype>1; }
-+ RESTORE_WARN_FLAGS ($1); }
- ;
-
- components:
-@@ -2441,8 +2452,9 @@
-
- extension:
- EXTENSION
-- { $<itype>$ = pedantic;
-- pedantic = 0; }
-+ { $$ = SAVE_WARN_FLAGS();
-+ pedantic = 0;
-+ warn_pointer_arith = 0; }
- ;
- \f
- ifobjc
+++ /dev/null
-diff -ur gcc-20020311/gcc/ada/targtyps.c gcc-20020311-/gcc/ada/targtyps.c
---- gcc-20020311/gcc/ada/targtyps.c Tue Oct 2 16:57:55 2001
-+++ gcc-20020311-/gcc/ada/targtyps.c Sat Mar 16 15:19:39 2002
-@@ -99,6 +99,8 @@
- #define WIDEST_HARDWARE_FP_SIZE LONG_DOUBLE_TYPE_SIZE
- #endif
-
-+static int rs6000_long_double_type_size = 64;
-+
- /* The following provide a functional interface for the front end Ada code
- to determine the sizes that are used for various C types. */
-
-Only in gcc-20020311-/gcc/ada: targtyps.c~
+++ /dev/null
-# DP: Add descriptions to rs6000.h and sysv4.h to quench warnings.
-# DP: by Franz Sirl
-
-Index: gcc/config/rs6000/rs6000.h
---- rs6000.h 1999/06/09 15:59:37 1.49.4.1
-+++ gcc/config/rs6000/rs6000.h 1999/06/12 18:55:36
-@@ -352,46 +352,81 @@ extern int target_flags;
- #endif
-
- #define TARGET_SWITCHES \
-- {{"power", MASK_POWER | MASK_MULTIPLE | MASK_STRING}, \
-+ {{"power", MASK_POWER | MASK_MULTIPLE | MASK_STRING, \
-+ "Use POWER instruction set"}, \
- {"power2", (MASK_POWER | MASK_MULTIPLE | MASK_STRING \
-- | MASK_POWER2)}, \
-- {"no-power2", - MASK_POWER2}, \
-+ | MASK_POWER2), \
-+ "Use POWER2 instruction set"}, \
-+ {"no-power2", - MASK_POWER2, \
-+ "Do not use POWER2 instruction set"}, \
- {"no-power", - (MASK_POWER | MASK_POWER2 | MASK_MULTIPLE \
-- | MASK_STRING)}, \
-- {"powerpc", MASK_POWERPC}, \
-+ | MASK_STRING), \
-+ "Do not use POWER instruction set"}, \
-+ {"powerpc", MASK_POWERPC, \
-+ "Use PowerPC instruction set"}, \
- {"no-powerpc", - (MASK_POWERPC | MASK_PPC_GPOPT \
-- | MASK_PPC_GFXOPT | MASK_POWERPC64)}, \
-- {"powerpc-gpopt", MASK_POWERPC | MASK_PPC_GPOPT}, \
-- {"no-powerpc-gpopt", - MASK_PPC_GPOPT}, \
-- {"powerpc-gfxopt", MASK_POWERPC | MASK_PPC_GFXOPT}, \
-- {"no-powerpc-gfxopt", - MASK_PPC_GFXOPT}, \
-- {"powerpc64", MASK_POWERPC64}, \
-- {"no-powerpc64", - MASK_POWERPC64}, \
-- {"new-mnemonics", MASK_NEW_MNEMONICS}, \
-- {"old-mnemonics", -MASK_NEW_MNEMONICS}, \
-+ | MASK_PPC_GFXOPT | MASK_POWERPC64), \
-+ "Do not use PowerPC instruction set"}, \
-+ {"powerpc-gpopt", MASK_POWERPC | MASK_PPC_GPOPT, \
-+ "Use PowerPC General Purpose group optional instructions"},\
-+ {"no-powerpc-gpopt", - MASK_PPC_GPOPT, \
-+ "Don't use PowerPC General Purpose group optional instructions"},\
-+ {"powerpc-gfxopt", MASK_POWERPC | MASK_PPC_GFXOPT, \
-+ "Use PowerPC Graphics group optional instructions"},\
-+ {"no-powerpc-gfxopt", - MASK_PPC_GFXOPT, \
-+ "Don't use PowerPC Graphics group optional instructions"},\
-+ {"powerpc64", MASK_POWERPC64, \
-+ "Use PowerPC-64 instruction set"}, \
-+ {"no-powerpc64", - MASK_POWERPC64, \
-+ "Don't use PowerPC-64 instruction set"}, \
-+ {"new-mnemonics", MASK_NEW_MNEMONICS, \
-+ "Use new mnemonics for PowerPC architecture"}, \
-+ {"old-mnemonics", -MASK_NEW_MNEMONICS, \
-+ "Use old mnemonics for PowerPC architecture"}, \
- {"full-toc", - (MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC \
-- | MASK_MINIMAL_TOC)}, \
-- {"fp-in-toc", - MASK_NO_FP_IN_TOC}, \
-- {"no-fp-in-toc", MASK_NO_FP_IN_TOC}, \
-- {"sum-in-toc", - MASK_NO_SUM_IN_TOC}, \
-- {"no-sum-in-toc", MASK_NO_SUM_IN_TOC}, \
-- {"minimal-toc", MASK_MINIMAL_TOC}, \
-- {"minimal-toc", - (MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC)}, \
-- {"no-minimal-toc", - MASK_MINIMAL_TOC}, \
-- {"hard-float", - MASK_SOFT_FLOAT}, \
-- {"soft-float", MASK_SOFT_FLOAT}, \
-- {"multiple", MASK_MULTIPLE | MASK_MULTIPLE_SET}, \
-- {"no-multiple", - MASK_MULTIPLE}, \
-- {"no-multiple", MASK_MULTIPLE_SET}, \
-- {"string", MASK_STRING | MASK_STRING_SET}, \
-- {"no-string", - MASK_STRING}, \
-- {"no-string", MASK_STRING_SET}, \
-- {"update", - MASK_NO_UPDATE}, \
-- {"no-update", MASK_NO_UPDATE}, \
-- {"fused-madd", - MASK_NO_FUSED_MADD}, \
-- {"no-fused-madd", MASK_NO_FUSED_MADD}, \
-+ | MASK_MINIMAL_TOC), \
-+ "no description yet"}, \
-+ {"fp-in-toc", - MASK_NO_FP_IN_TOC, \
-+ "Place floating point constants in TOC"}, \
-+ {"no-fp-in-toc", MASK_NO_FP_IN_TOC, \
-+ "Don't place floating point constants in TOC"}, \
-+ {"sum-in-toc", - MASK_NO_SUM_IN_TOC, \
-+ "Place symbol+offset constants in TOC"}, \
-+ {"no-sum-in-toc", MASK_NO_SUM_IN_TOC, \
-+ "Don't place symbol+offset constants in TOC"}, \
-+ {"minimal-toc", MASK_MINIMAL_TOC, \
-+ "no description yet"}, \
-+ {"minimal-toc", - (MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC), \
-+ "no description yet"}, \
-+ {"no-minimal-toc", - MASK_MINIMAL_TOC, \
-+ "no description yet"}, \
-+ {"hard-float", - MASK_SOFT_FLOAT, \
-+ "Use hardware fp"}, \
-+ {"soft-float", MASK_SOFT_FLOAT, \
-+ "Do not use hardware fp"}, \
-+ {"multiple", MASK_MULTIPLE | MASK_MULTIPLE_SET, \
-+ "Generate load/store multiple instructions"}, \
-+ {"no-multiple", - MASK_MULTIPLE, \
-+ "Do not generate load/store multiple instructions"},\
-+ {"no-multiple", MASK_MULTIPLE_SET, \
-+ "Do not generate load/store multiple instructions"},\
-+ {"string", MASK_STRING | MASK_STRING_SET, \
-+ "Generate string instructions for block moves"},\
-+ {"no-string", - MASK_STRING, \
-+ "Do not generate string instructions for block moves"},\
-+ {"no-string", MASK_STRING_SET, \
-+ "Do not generate string instructions for block moves"},\
-+ {"update", - MASK_NO_UPDATE, \
-+ "Generate load/store with update instructions"},\
-+ {"no-update", MASK_NO_UPDATE, \
-+ "Do not generate load/store with update instructions"},\
-+ {"fused-madd", - MASK_NO_FUSED_MADD, \
-+ "Generate fused multiply/add instructions"}, \
-+ {"no-fused-madd", MASK_NO_FUSED_MADD, \
-+ "Don't generate fused multiply/add instructions"},\
- SUBTARGET_SWITCHES \
-- {"", TARGET_DEFAULT}}
-+ {"", TARGET_DEFAULT, \
-+ ""}}
-
- #define TARGET_DEFAULT (MASK_POWER | MASK_MULTIPLE | MASK_STRING)
-
-@@ -449,13 +484,13 @@ extern enum processor_type rs6000_cpu;
- #define SUBTARGET_OPTIONS
- #endif
-
--#define TARGET_OPTIONS \
--{ \
-- {"cpu=", &rs6000_select[1].string}, \
-- {"tune=", &rs6000_select[2].string}, \
-- {"debug-", &rs6000_debug_name}, \
-- {"debug=", &rs6000_debug_name}, \
-- SUBTARGET_OPTIONS \
-+#define TARGET_OPTIONS \
-+{ \
-+ {"cpu=", &rs6000_select[1].string, "Use features of and schedule code for given CPU" },\
-+ {"tune=", &rs6000_select[2].string, "Schedule code for given CPU" }, \
-+ {"debug-", &rs6000_debug_name, "Enable debug output" }, \
-+ {"debug=", &rs6000_debug_name, "Enable debug output" }, \
-+ SUBTARGET_OPTIONS \
- }
-
- /* rs6000_select[0] is reserved for the default cpu defined via --with-cpu */
-Index: gcc/config/rs6000/sysv4.h
---- sysv4.h 1999/05/28 02:46:56 1.19.4.1
-+++ gcc/config/rs6000/sysv4.h 1999/06/12 18:55:38
-@@ -66,39 +66,39 @@ extern enum rs6000_sdata_type rs6000_sda
- the same as -mminimal-toc. */
- #undef SUBTARGET_SWITCHES
- #define SUBTARGET_SWITCHES \
-- { "bit-align", -MASK_NO_BITFIELD_TYPE }, \
-- { "no-bit-align", MASK_NO_BITFIELD_TYPE }, \
-- { "strict-align", MASK_STRICT_ALIGN }, \
-- { "no-strict-align", -MASK_STRICT_ALIGN }, \
-- { "relocatable", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC }, \
-- { "no-relocatable", -MASK_RELOCATABLE }, \
-- { "relocatable-lib", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC }, \
-- { "no-relocatable-lib", -MASK_RELOCATABLE }, \
-- { "little-endian", MASK_LITTLE_ENDIAN }, \
-- { "little", MASK_LITTLE_ENDIAN }, \
-- { "big-endian", -MASK_LITTLE_ENDIAN }, \
-- { "big", -MASK_LITTLE_ENDIAN }, \
-- { "no-toc", 0 }, \
-- { "toc", MASK_MINIMAL_TOC }, \
-- { "full-toc", MASK_MINIMAL_TOC }, \
-- { "prototype", MASK_PROTOTYPE }, \
-- { "no-prototype", -MASK_PROTOTYPE }, \
-- { "no-traceback", 0 }, \
-- { "eabi", MASK_EABI }, \
-- { "no-eabi", -MASK_EABI }, \
-- { "regnames", MASK_REGNAMES }, \
-- { "no-regnames", -MASK_REGNAMES }, \
-- { "sdata", 0 }, \
-- { "no-sdata", 0 }, \
-- { "sim", 0 }, \
-- { "ads", 0 }, \
-- { "yellowknife", 0 }, \
-- { "mvme", 0 }, \
-- { "emb", 0 }, \
-- { "solaris-cclib", 0 }, \
-- { "shlib", 0 }, \
-- EXTRA_SUBTARGET_SWITCHES \
-- { "newlib", 0 },
-+ { "bit-align", -MASK_NO_BITFIELD_TYPE, "Align to the base type of the bitfield." },\
-+ { "no-bit-align", MASK_NO_BITFIELD_TYPE, "Don't align to the base type of the bitfield." },\
-+ { "strict-align", MASK_STRICT_ALIGN, "Don't assume that unaligned accesses are handled by the system" },\
-+ { "no-strict-align", -MASK_STRICT_ALIGN, "Assume that unaligned accesses are handled by the system" },\
-+ { "relocatable", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC, "Produce code relocatable at runtime." },\
-+ { "no-relocatable", -MASK_RELOCATABLE, "Don't produce code relocatable at runtime." },\
-+ { "relocatable-lib", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC, "Produce code relocatable at runtime." },\
-+ { "no-relocatable-lib", -MASK_RELOCATABLE, "Don't produce code relocatable at runtime." },\
-+ { "little-endian", MASK_LITTLE_ENDIAN, "Produce little endian code." }, \
-+ { "little", MASK_LITTLE_ENDIAN, "Produce little endian code." }, \
-+ { "big-endian", -MASK_LITTLE_ENDIAN, "Produce big endian code." }, \
-+ { "big", -MASK_LITTLE_ENDIAN, "Produce big endian code." }, \
-+ { "no-toc", 0, "no description yet" }, \
-+ { "toc", MASK_MINIMAL_TOC, "no description yet" }, \
-+ { "full-toc", MASK_MINIMAL_TOC, "no description yet" }, \
-+ { "prototype", MASK_PROTOTYPE, "no description yet" }, \
-+ { "no-prototype", -MASK_PROTOTYPE, "no description yet" }, \
-+ { "no-traceback", 0, "no description yet" }, \
-+ { "eabi", MASK_EABI, "Use EABI." }, \
-+ { "no-eabi", -MASK_EABI, "Don't use EABI." }, \
-+ { "regnames", MASK_REGNAMES, "Use alternate register names." }, \
-+ { "no-regnames", -MASK_REGNAMES, "Don't use alternate register names." },\
-+ { "sdata", 0, "no description yet" }, \
-+ { "no-sdata", 0, "no description yet" }, \
-+ { "sim", 0, "Link with libsim.a, libc.a and sim-crt0.o." }, \
-+ { "ads", 0, "Link with libads.a, libc.a and crt0.o." }, \
-+ { "yellowknife", 0, "Link with libyk.a, libc.a and crt0.o." }, \
-+ { "mvme", 0, "Link with libmvme.a, libc.a and crt0.o." }, \
-+ { "emb", 0, "Set the PPC_EMB bit in the ELF flags header" }, \
-+ { "solaris-cclib", 0, "no description yet" }, \
-+ { "shlib", 0, "no description yet" }, \
-+ EXTRA_SUBTARGET_SWITCHES \
-+ { "newlib", 0, "no description yet" },
-
- /* This is meant to be redefined in the host dependent files */
- #define EXTRA_SUBTARGET_SWITCHES
-@@ -111,8 +111,8 @@ extern const char *rs6000_abi_name;
- extern const char *rs6000_sdata_name;
-
- #define SUBTARGET_OPTIONS \
-- { "call-", &rs6000_abi_name}, \
-- { "sdata=", &rs6000_sdata_name}
-+ { "call-", &rs6000_abi_name, "Select ABI calling convention." }, \
-+ { "sdata=", &rs6000_sdata_name, "Select method for sdata handling." }
-
- /* Max # of bytes for variables to automatically be put into the .sdata
- or .sdata2 sections. */
+++ /dev/null
-# DP: Add "Internal compiler error:" before some errors
-# DP: by Franz Sirl
-
-Index: gcc/toplev.c
---- toplev.c 1999/05/20 10:40:05 1.185.4.1
-+++ gcc/toplev.c 1999/06/12 18:55:32
-@@ -1467,6 +1467,8 @@ fatal_insn VPROTO((const char *msgid, rt
- #endif
- va_list ap;
-
-+ error ("Internal compiler error:");
-+
- VA_START (ap, insn);
-
- #ifndef ANSI_PROTOTYPES
-@@ -1943,6 +1945,8 @@ fatal VPROTO((const char *msgid, ...))
- const char *msgid;
- #endif
- va_list ap;
-+
-+ error ("Internal compiler error:");
-
- VA_START (ap, msgid);
-
--- /dev/null
+===================================================================
+RCS file: /cvs/gcc/gcc/gcc/ada/a-stunau.adb,v
+retrieving revision 1.5
+retrieving revision 1.6
+diff -u -r1.5 -r1.6
+--- gcc/gcc/ada/a-stunau.adb 2003/10/21 13:41:54 1.5
++++ gcc/gcc/ada/a-stunau.adb 2005/01/18 22:00:12 1.6
+@@ -48,16 +48,18 @@
+
+ U_Ptr : constant Unbounded_String_Access := U'Unrestricted_Access;
+ -- Unbounded_String is a controlled type which is always passed
+- -- by copy it is always safe to take the pointer to such object
+- -- here. This pointer is used to set the U.Reference value which
+- -- would not be possible otherwise as U is read-only.
++ -- by reference. It is always safe to take the pointer to such
++ -- object here. This pointer is used to set the U.Reference
++ -- value which would not be possible otherwise as U is read-only.
+
+ Old : String_Access := U.Reference;
++ Ret : String_Access;
+
+ begin
+- U_Ptr.Reference := new String'(U.Reference (1 .. U.Last));
++ Ret := new String'(U.Reference (1 .. U.Last));
++ U_Ptr.Reference := Ret;
+ Free (Old);
+- return U.Reference;
++ return Ret;
+ end;
+ end if;
+ end Get_String;
--- /dev/null
+Index: gcc/ChangeLog
+from Alexandre Oliva <aoliva@redhat.com>
+
+ PR middle-end/15666
+ * c-decl.c (finish_decl): Use change_decl_assembler_name for the
+ builtin decl as well.
+
+Index: gcc/c-decl.c
+===================================================================
+RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
+retrieving revision 1.504
+diff -u -p -r1.504 c-decl.c
+--- gcc/c-decl.c 31 May 2004 22:06:27 -0000 1.504
++++ gcc/c-decl.c 1 Jun 2004 04:03:41 -0000
+@@ -2886,7 +2886,7 @@ finish_decl (tree decl, tree init, tree
+ {
+ tree builtin = built_in_decls [DECL_FUNCTION_CODE (decl)];
+ SET_DECL_RTL (builtin, NULL_RTX);
+- SET_DECL_ASSEMBLER_NAME (builtin, get_identifier (starred));
++ change_decl_assembler_name (builtin, get_identifier (starred));
+ #ifdef TARGET_MEM_FUNCTIONS
+ if (DECL_FUNCTION_CODE (decl) == BUILT_IN_MEMCPY)
+ init_block_move_fn (starred);
--- /dev/null
+2004-12-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR c++/16276
+ * configure.ac: Check if assembler supports COMDAT group.
+ * configure: Regenerated.
+ * config.in: Likewise.
+
+ * final.c (final_scan_insn): When generating jump table, call
+ readonly_data_section_in_function_group instead of
+ readonly_data_section if HAVE_GAS_COMDAT_GROUP is defined.
+
+ * output.h (elf_comdat_group): New.
+ (readonly_data_section_in_function_group): Likewise.
+
+ * varasm.c (readonly_data_section_in_function_group): New.
+ (elf_comdat_group): Likewise.
+ (default_elf_asm_named_section): Use COMDAT group if
+ HAVE_GAS_COMDAT_GROUP is defined.
+ * config/arm/arm.c (arm_elf_asm_named_section): Likewise.
+
+ * config/sparc/sysv4.h (TARGET_ASM_NAMED_SECTION): Define only
+ if HAVE_GAS_COMDAT_GROUP is not defined.
+
+--- gcc/config.in.comdat 2004-12-03 09:15:49.000000000 -0800
++++ gcc/config.in 2004-12-03 09:15:50.000000000 -0800
+@@ -252,6 +252,9 @@
+ /* Define if your assembler supports .balign and .p2align. */
+ #undef HAVE_GAS_BALIGN_AND_P2ALIGN
+
++/* Define 0/1 if your assembler supports COMDAT group. */
++#undef HAVE_GAS_COMDAT_GROUP
++
+ /* Define if your assembler uses the new HImode fild and fist notation. */
+ #undef HAVE_GAS_FILDS_FISTS
+
+--- gcc/config/arm/arm.c.comdat 2004-04-30 10:36:39.000000000 -0700
++++ gcc/config/arm/arm.c 2004-12-03 09:15:50.000000000 -0800
+@@ -13156,12 +13156,15 @@ static void
+ arm_elf_asm_named_section (const char *name, unsigned int flags)
+ {
+ char flagchars[10], *f = flagchars;
++ const char *section_name = NULL, *group_name = NULL;
+
++#ifndef HAVE_GAS_COMDAT_GROUP
+ if (! named_section_first_declaration (name))
+ {
+ fprintf (asm_out_file, "\t.section\t%s\n", name);
+ return;
+ }
++#endif
+
+ if (!(flags & SECTION_DEBUG))
+ *f++ = 'a';
+@@ -13177,9 +13180,17 @@ arm_elf_asm_named_section (const char *n
+ *f++ = 'S';
+ if (flags & SECTION_TLS)
+ *f++ = 'T';
++#ifdef HAVE_GAS_COMDAT_GROUP
++ if (elf_comdat_group (name, §ion_name, &group_name))
++ *f++ = 'G';
++#endif
+ *f = '\0';
+
+- fprintf (asm_out_file, "\t.section\t%s,\"%s\"", name, flagchars);
++ if (section_name)
++ fprintf (asm_out_file, "\t.section\t%s,\"%s\"", section_name,
++ flagchars);
++ else
++ fprintf (asm_out_file, "\t.section\t%s,\"%s\"", name, flagchars);
+
+ if (!(flags & SECTION_NOTYPE))
+ {
+@@ -13196,6 +13207,9 @@ arm_elf_asm_named_section (const char *n
+ fprintf (asm_out_file, ",%d", flags & SECTION_ENTSIZE);
+ }
+
++ if (group_name)
++ fprintf (asm_out_file, ",%s,comdat", group_name);
++
+ putc ('\n', asm_out_file);
+ }
+ #endif
+--- gcc/config/sparc/sysv4.h.comdat 2003-06-17 17:03:32.000000000 -0700
++++ gcc/config/sparc/sysv4.h 2004-12-03 09:15:50.000000000 -0800
+@@ -150,9 +150,13 @@ do { ASM_OUTPUT_ALIGN ((FILE), Pmode ==
+ #undef DTORS_SECTION_ASM_OP
+ #define DTORS_SECTION_ASM_OP "\t.section\t\".dtors\",#alloc,#write"
+
++/* COMDAT group cannot be expressed in SPARC's section attributes
++ encoding style. */
++#ifndef HAVE_GAS_COMDAT_GROUP
+ /* Switch into a generic section. */
+ #undef TARGET_ASM_NAMED_SECTION
+ #define TARGET_ASM_NAMED_SECTION sparc_elf_asm_named_section
++#endif
+
+ #undef ASM_OUTPUT_ALIGNED_BSS
+ #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
+--- gcc/configure.ac.comdat 2004-12-03 09:15:49.000000000 -0800
++++ gcc/configure.ac 2004-12-03 09:22:29.000000000 -0800
+@@ -1913,8 +1913,12 @@ changequote(,)dnl
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \
+- -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p'`
++ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \
++ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p'`
+ ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
++ ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
++ ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
++ ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
+ if test 0"$ld_date" -lt 20020404; then
+ if test -n "$ld_date"; then
+ # If there was date string, but was earlier than 2002-04-04, fail
+@@ -1923,9 +1927,6 @@ changequote(,)dnl
+ # If there was no date string nor ld version number, something is wrong
+ gcc_cv_ld_hidden=no
+ else
+- ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
+- ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
+- ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
+ test -z "$ld_vers_patch" && ld_vers_patch=0
+ if test "$ld_vers_major" -lt 2; then
+ gcc_cv_ld_hidden=no
+@@ -2060,6 +2061,39 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
+ [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`],
+ [Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
+
++gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group,
++ [elf,2,15,92], [--fatal-warnings],
++ [.section .text,"axG",@progbits,.foo,comdat])
++if test $gcc_cv_as_comdat_group = yes; then
++ gcc_cv_as_comdat_group_percent=no
++else
++ gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group_percent,
++ [elf,2,15,92], [--fatal-warnings],
++ [.section .text,"axG",%progbits,.foo,comdat])
++fi
++if test $in_tree_ld != yes && test x"$ld_vers" != x; then
++ comdat_group=yes
++ if test 0"$ld_date" -lt 20040727; then
++ if test -n "$ld_date"; then
++ # If there was date string, but was earlier than 2002-07-27, fail
++ comdat_group=no
++ elif test "$ld_vers_major" -lt 2; then
++ comdat_group=no
++ elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 15; then
++ comdat_group=no
++ elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 15 -a "$ld_vers_patch" -lt 92; then
++ comdat_group=no
++ fi
++ fi
++ if test $comdat_group = no; then
++ gcc_cv_as_comdat_group=no
++ gcc_cv_as_comdat_group_percent=no
++ fi
++fi
++AC_DEFINE_UNQUOTED(HAVE_GAS_COMDAT_GROUP,
++ [`if test $gcc_cv_as_comdat_group = yes || test $gcc_cv_as_comdat_group_percent = yes; then echo 1; else echo 0; fi`],
++[Define 0/1 if your assembler supports COMDAT group.])
++
+ # Thread-local storage - the check is heavily parametrized.
+ conftest_s=
+ tls_first_major=
+--- gcc/final.c.comdat 2004-02-23 13:24:09.000000000 -0800
++++ gcc/final.c 2004-12-03 09:15:50.000000000 -0800
+@@ -1881,7 +1881,12 @@ final_scan_insn (rtx insn, FILE *file, i
+ {
+ int log_align;
+
++#ifdef HAVE_GAS_COMDAT_GROUP
++ readonly_data_section_in_function_group
++ (current_function_decl);
++#else
+ readonly_data_section ();
++#endif
+
+ #ifdef ADDR_VEC_ALIGN
+ log_align = ADDR_VEC_ALIGN (NEXT_INSN (insn));
+--- gcc/output.h.comdat 2004-03-26 09:25:41.000000000 -0800
++++ gcc/output.h 2004-12-03 09:15:50.000000000 -0800
+@@ -475,6 +475,9 @@ extern void no_asm_to_stream (FILE *);
+ #define SECTION_NOTYPE 0x80000 /* don't output @progbits */
+ #define SECTION_MACH_DEP 0x100000 /* subsequent bits reserved for target */
+
++extern const char *elf_comdat_group (const char *, const char **,
++ const char **);
++extern void readonly_data_section_in_function_group (tree);
+ extern unsigned int get_named_section_flags (const char *);
+ extern bool set_named_section_flags (const char *, unsigned int);
+ extern void named_section_flags (const char *, unsigned int);
+--- gcc/varasm.c.comdat 2004-11-01 14:04:58.000000000 -0800
++++ gcc/varasm.c 2004-12-03 09:30:54.005496029 -0800
+@@ -259,6 +259,35 @@ data_section (void)
+ }
+ }
+
++#ifdef HAVE_GAS_COMDAT_GROUP
++
++/* Tell assembler to switch to read-only data section in the same
++ comdat group as DECL. */
++
++void
++readonly_data_section_in_function_group (tree decl)
++{
++ if (decl == NULL_TREE || !DECL_P (decl))
++ abort ();
++
++ if (DECL_SECTION_NAME (decl) == NULL_TREE || ! DECL_ONE_ONLY (decl))
++ readonly_data_section ();
++ else
++ {
++ char *rodata;
++ const char *name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
++
++ if (strncmp (name, ".gnu.linkonce.t.", 16) != 0)
++ abort ();
++
++ rodata = xstrdup (name);
++ rodata [14] = 'r';
++ named_section_flags (rodata, 0);
++ free (rodata);
++ }
++}
++#endif
++
+ /* Tell assembler to switch to read-only data section. This is normally
+ the text section. */
+
+@@ -4651,16 +4680,97 @@ default_no_named_section (const char *na
+ abort ();
+ }
+
++/* Extract section name and group name from the linkonce section
++ name. */
++
++const char *
++elf_comdat_group (const char *name, const char **section,
++ const char **group)
++{
++ const char *p;
++ const char *sec = NULL;
++ static const char *one [] =
++ {
++ ".bss", /* 'b' */
++ NULL, /* 'c' */
++ ".data", /* 'd' */
++ NULL, /* 'e' */
++ NULL, /* 'f' */
++ NULL, /* 'q' */
++ NULL, /* 'h' */
++ NULL, /* 'i' */
++ NULL, /* 'j' */
++ NULL, /* 'k' */
++ NULL, /* 'l' */
++ NULL, /* 'm' */
++ NULL, /* 'n' */
++ NULL, /* 'o' */
++ NULL, /* 'p' */
++ NULL, /* 'q' */
++ ".rodata", /* 'r' */
++ ".sdata", /* 's' */
++ ".text" /* 't' */
++ };
++
++ if (strncmp (name, ".gnu.linkonce.", 14) != 0)
++ return sec;
++
++ p = name + 14;
++ if (p [1] == '.')
++ {
++ if (p [0] > 'a' && p [0] < 'u')
++ sec = one [p [0] - 'b'];
++
++ if (sec)
++ *group = p + 2;
++ }
++ else if (p [2] == '.')
++ {
++ if (p [0] == 's')
++ {
++ if (p [1] == '2')
++ sec = ".sdata2";
++ else if (p [1] == 'b')
++ sec = ".sbss";
++ }
++ else if (p [0] == 't')
++ {
++ if (p [1] == 'b')
++ sec = ".tbss";
++ else if (p [1] == 'd')
++ sec = ".tdata";
++ }
++ else if (p [0] == 'w' && p [1] == 'i')
++ sec = ".debug_info";
++
++ if (sec)
++ *group = p + 3;
++ }
++ else if (strncmp (p, "sb2.", 4) == 0)
++ {
++ sec = ".sbss2";
++ *group = p + 4;
++ }
++
++ if (sec)
++ *section = sec;
++
++ return sec;
++}
++
+ void
+ default_elf_asm_named_section (const char *name, unsigned int flags)
+ {
+ char flagchars[10], *f = flagchars;
++ const char *section_name = NULL, *group_name = NULL;
+
++#ifndef HAVE_GAS_COMDAT_GROUP
+ if (! named_section_first_declaration (name))
+ {
+ fprintf (asm_out_file, "\t.section\t%s\n", name);
+ return;
+ }
++#endif
+
+ if (!(flags & SECTION_DEBUG))
+ *f++ = 'a';
+@@ -4676,9 +4786,17 @@ default_elf_asm_named_section (const cha
+ *f++ = 'S';
+ if (flags & SECTION_TLS)
+ *f++ = 'T';
++#ifdef HAVE_GAS_COMDAT_GROUP
++ if (elf_comdat_group (name, §ion_name, &group_name))
++ *f++ = 'G';
++#endif
+ *f = '\0';
+
+- fprintf (asm_out_file, "\t.section\t%s,\"%s\"", name, flagchars);
++ if (section_name)
++ fprintf (asm_out_file, "\t.section\t%s,\"%s\"", section_name,
++ flagchars);
++ else
++ fprintf (asm_out_file, "\t.section\t%s,\"%s\"", name, flagchars);
+
+ if (!(flags & SECTION_NOTYPE))
+ {
+@@ -4695,6 +4813,9 @@ default_elf_asm_named_section (const cha
+ fprintf (asm_out_file, ",%d", flags & SECTION_ENTSIZE);
+ }
+
++ if (group_name)
++ fprintf (asm_out_file, ",%s,comdat", group_name);
++
+ putc ('\n', asm_out_file);
+ }
+
--- /dev/null
+
+ PR libstdc++/18185
+ * libsupc++/eh_globals.cc (get_globals_dtor): Delete unhandled exceptions.
+
+--- gcc/libstdc++-v3/libsupc++/eh_globals.cc 2004/04/30 04:20:24 1.4.16.1
++++ gcc/libstdc++-v3/libsupc++/eh_globals.cc 2004/11/08 17:41:19 1.4.16.2
+@@ -48,7 +48,17 @@
+ get_globals_dtor (void *ptr)
+ {
+ if (ptr)
+- std::free (ptr);
++ {
++ __cxa_exception *exn, *next;
++ exn = ((__cxa_eh_globals *) ptr)->caughtExceptions;
++ while (exn)
++ {
++ next = exn->nextException;
++ _Unwind_DeleteException (&exn->unwindHeader);
++ exn = next;
++ }
++ std::free (ptr);
++ }
+ }
+
+ static void
+++ /dev/null
-From: "H dot J dot Lu" <hjl at lucon dot org>
-Subject: PATCH: PR 19664: Don't change visibility if set by user
-
-This patch may fix visibility push(default)/pop. When visibility
-has been set by user, we shouldn't change it.
-
-
-2005-02-03 H.J. Lu <hongjiu.lu@intel.com>
-
- PR C++/19664
- * decl2.c (determine_visibility): Don't set visibility to
- hidden if it has been set explicitly by user.
-
---- gcc-4.0.0/gcc/cp/decl2.c.orig 2005-04-05 17:38:09.000000000 +0200
-+++ gcc-4.0.0/gcc/cp/decl2.c 2005-05-05 00:41:14.000000000 +0200
-@@ -1636,8 +1636,12 @@
- && DECL_DECLARED_INLINE_P (decl)
- && visibility_options.inlines_hidden)
- {
-- DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;
-- DECL_VISIBILITY_SPECIFIED (decl) = 1;
-+ /* Don't change it if it has been set explicitly by user. */
-+ if (!DECL_VISIBILITY_SPECIFIED (decl))
-+ {
-+ DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;
-+ DECL_VISIBILITY_SPECIFIED (decl) = 1;
-+ }
- }
- else if (CLASSTYPE_VISIBILITY_SPECIFIED (class_type))
- {
+++ /dev/null
-# DP: Makes it so sparc32 remains binary compatible with older releases
-
---- gcc/crtstuff.c.orig Mon Apr 26 20:11:08 1999
-+++ gcc/crtstuff.c Mon Apr 26 20:12:28 1999
-@@ -89,11 +89,12 @@
-
- /* References to __register_frame_info and __deregister_frame_info should
- be weak in this file if at all possible. */
--extern void __register_frame_info (void *, struct object *)
-- TARGET_ATTRIBUTE_WEAK;
-+extern void __register_frame_info (void *, struct object *);
-
--extern void *__deregister_frame_info (void *)
-- TARGET_ATTRIBUTE_WEAK;
-+extern void *__deregister_frame_info (void *);
-+/* DEBIAN/SPARC - Changed the references to the
-+ * previous for binary compatibility reasons
-+ */
-
- /* Provide default definitions for the pseudo-ops used to switch to the
- .ctors and .dtors sections.
--- /dev/null
+diff -uNr gcc-3.4.3.orig/gcc/calls.c gcc-3.4.3/gcc/calls.c
+--- gcc-3.4.3.orig/gcc/calls.c 2004-06-24 09:26:50.000000000 +0200
++++ gcc-3.4.3/gcc/calls.c 2004-11-24 18:35:31.000000000 +0100
+@@ -2321,8 +2321,12 @@
+ {
+ /* For variable-sized objects, we must be called with a target
+ specified. If we were to allocate space on the stack here,
+- we would have no way of knowing when to free it. */
+- rtx d = assign_temp (TREE_TYPE (exp), 1, 1, 1);
++ we would have no way of knowing when to free it.
++
++ This is the structure of a function return object and it isn't
++ a character array for the stack protection, so it is
++ marked using the assignment of the KEEP argument to 5. */
++ rtx d = assign_temp (TREE_TYPE (exp), 5, 1, 1);
+
+ mark_temp_addr_taken (d);
+ structure_value_addr = XEXP (d, 0);
+diff -uNr gcc-3.4.3.orig/gcc/c-cppbuiltin.c gcc-3.4.3/gcc/c-cppbuiltin.c
+--- gcc-3.4.3.orig/gcc/c-cppbuiltin.c 2004-03-04 11:24:54.000000000 +0100
++++ gcc-3.4.3/gcc/c-cppbuiltin.c 2004-11-24 18:35:31.000000000 +0100
+@@ -408,6 +408,12 @@
+ if (c_dialect_objc () && flag_next_runtime)
+ cpp_define (pfile, "__NEXT_RUNTIME__");
+
++ /* Make the choice of the stack protector runtime visible to source code. */
++ if (flag_propolice_protection)
++ cpp_define (pfile, "__SSP__=1");
++ if (flag_stack_protection)
++ cpp_define (pfile, "__SSP_ALL__=2");
++
+ /* A straightforward target hook doesn't work, because of problems
+ linking that hook's body when part of non-C front ends. */
+ # define preprocessing_asm_p() (cpp_get_options (pfile)->lang == CLK_ASM)
+diff -uNr gcc-3.4.3.orig/gcc/combine.c gcc-3.4.3/gcc/combine.c
+--- gcc-3.4.3.orig/gcc/combine.c 2004-10-13 01:35:29.000000000 +0200
++++ gcc-3.4.3/gcc/combine.c 2004-11-24 18:35:31.000000000 +0100
+@@ -1401,6 +1401,10 @@
+ && ! fixed_regs[REGNO (dest)]
+ && CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (REGNO (dest))))))
+ return 1;
++ /* Never combine loads and stores protecting argument that use set insn
++ with used flag on. */
++ if (SET_VOLATILE_P (set))
++ return 1;
+
+ return 0;
+ }
+@@ -3781,7 +3785,20 @@
+ rtx inner_op0 = XEXP (XEXP (x, 0), 1);
+ rtx inner_op1 = XEXP (x, 1);
+ rtx inner;
+-
++
++#ifndef FRAME_GROWS_DOWNWARD
++ /* For the case where the frame grows upward,
++ the stack protector keeps the offset of the frame pointer
++ positive integer. */
++ if (flag_propolice_protection
++ && code == PLUS
++ && other == frame_pointer_rtx
++ && GET_CODE (inner_op0) == CONST_INT
++ && GET_CODE (inner_op1) == CONST_INT
++ && INTVAL (inner_op0) > 0
++ && INTVAL (inner_op0) + INTVAL (inner_op1) <= 0)
++ return x;
++#endif
+ /* Make sure we pass the constant operand if any as the second
+ one if this is a commutative operation. */
+ if (CONSTANT_P (inner_op0) && GET_RTX_CLASS (code) == 'c')
+@@ -4146,6 +4163,13 @@
+ they are now checked elsewhere. */
+ if (GET_CODE (XEXP (x, 0)) == PLUS
+ && CONSTANT_ADDRESS_P (XEXP (XEXP (x, 0), 1)))
++#ifndef FRAME_GROWS_DOWNWARD
++ /* The stack protector keeps the addressing style of a local variable
++ to be able to change its stack position. */
++ if (! (flag_propolice_protection
++ && XEXP (XEXP (x, 0), 0) == frame_pointer_rtx
++ && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT))
++#endif
+ return gen_binary (PLUS, mode,
+ gen_binary (PLUS, mode, XEXP (XEXP (x, 0), 0),
+ XEXP (x, 1)),
+@@ -4273,8 +4297,14 @@
+ }
+
+ /* Canonicalize (minus A (plus B C)) to (minus (minus A B) C) for
+- integers. */
+- if (GET_CODE (XEXP (x, 1)) == PLUS && INTEGRAL_MODE_P (mode))
++ integers.
++
++ The stack protector keeps the addressing style of
++ a local variable. */
++ if (GET_CODE (XEXP (x, 1)) == PLUS && INTEGRAL_MODE_P (mode)
++ && (! (flag_propolice_protection
++ && XEXP (XEXP (x, 1), 0) == frame_pointer_rtx
++ && GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT)))
+ return gen_binary (MINUS, mode,
+ gen_binary (MINUS, mode, XEXP (x, 0),
+ XEXP (XEXP (x, 1), 0)),
+diff -uNr gcc-3.4.3.orig/gcc/common.opt gcc-3.4.3/gcc/common.opt
+--- gcc-3.4.3.orig/gcc/common.opt 2004-11-24 18:04:19.000000000 +0100
++++ gcc-3.4.3/gcc/common.opt 2004-11-24 18:35:31.000000000 +0100
+@@ -152,6 +152,10 @@
+ Common
+ Warn when a variable is unused
+
++Wstack-protector
++Common
++Warn when not issuing stack smashing protection for some reason
++
+ aux-info
+ Common Separate
+ -aux-info <file> Emit declaration information into <file>
+@@ -743,6 +747,14 @@
+ Common
+ Put zero initialized data in the bss section
+
++fstack-protector
++Common
++Enables stack protection
++
++fstack-protector-all
++Common
++Enables stack protection of every function
++
+ g
+ Common JoinedOrMissing
+ Generate debug information in default format
+diff -uNr gcc-3.4.3.orig/gcc/config/arm/arm.md gcc-3.4.3/gcc/config/arm/arm.md
+--- gcc-3.4.3.orig/gcc/config/arm/arm.md 2004-08-25 17:46:19.000000000 +0200
++++ gcc-3.4.3/gcc/config/arm/arm.md 2004-11-24 18:35:31.000000000 +0100
+@@ -3840,7 +3840,13 @@
+ (match_operand:DI 1 "general_operand" ""))]
+ "TARGET_EITHER"
+ "
+- if (TARGET_THUMB)
++ if (TARGET_ARM)
++ {
++ /* Everything except mem = const or mem = mem can be done easily */
++ if (GET_CODE (operands[0]) == MEM)
++ operands[1] = force_reg (DImode, operands[1]);
++ }
++ else /* TARGET_THUMB.... */
+ {
+ if (!no_new_pseudos)
+ {
+diff -uNr gcc-3.4.3.orig/gcc/config/t-linux gcc-3.4.3/gcc/config/t-linux
+--- gcc-3.4.3.orig/gcc/config/t-linux 2003-09-23 20:55:57.000000000 +0200
++++ gcc-3.4.3/gcc/config/t-linux 2004-11-24 18:35:31.000000000 +0100
+@@ -1,7 +1,7 @@
+ # Compile crtbeginS.o and crtendS.o with pic.
+ CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -fPIC
+ # Compile libgcc2.a with pic.
+-TARGET_LIBGCC2_CFLAGS = -fPIC
++TARGET_LIBGCC2_CFLAGS = -fPIC -DHAVE_SYSLOG
+
+ # Override t-slibgcc-elf-ver to export some libgcc symbols with
+ # the symbol versions that glibc used.
+diff -uNr gcc-3.4.3.orig/gcc/configure gcc-3.4.3/gcc/configure
+--- gcc-3.4.3.orig/gcc/configure 2004-11-05 05:14:05.000000000 +0100
++++ gcc-3.4.3/gcc/configure 2004-11-24 18:44:13.000000000 +0100
+@@ -4809,6 +4809,9 @@
+ fi;
+
+
++ENABLESSP=""
++
++
+ # -------------------------
+ # Checks for other programs
+ # -------------------------
+@@ -13036,6 +13039,7 @@
+ s,@TARGET_SYSTEM_ROOT_DEFINE@,$TARGET_SYSTEM_ROOT_DEFINE,;t t
+ s,@CROSS_SYSTEM_HEADER_DIR@,$CROSS_SYSTEM_HEADER_DIR,;t t
+ s,@onestep@,$onestep,;t t
++s,@ENABLESSP@,$ENABLESSP,;t t
+ s,@SET_MAKE@,$SET_MAKE,;t t
+ s,@AWK@,$AWK,;t t
+ s,@LN@,$LN,;t t
+diff -uNr gcc-3.4.3.orig/gcc/configure.ac gcc-3.4.3/gcc/configure.ac
+--- gcc-3.4.3.orig/gcc/configure.ac 2004-11-24 18:04:19.000000000 +0100
++++ gcc-3.4.3/gcc/configure.ac 2004-11-24 18:46:57.000000000 +0100
+@@ -613,6 +613,9 @@
+ [onestep=""])
+ AC_SUBST(onestep)
+
++ENABLESSP=""
++AC_SUBST(ENABLESSP)
++
+ # -------------------------
+ # Checks for other programs
+ # -------------------------
+diff -uNr gcc-3.4.3.orig/gcc/cse.c gcc-3.4.3/gcc/cse.c
+--- gcc-3.4.3.orig/gcc/cse.c 2004-10-26 20:05:42.000000000 +0200
++++ gcc-3.4.3/gcc/cse.c 2004-11-24 18:35:31.000000000 +0100
+@@ -4212,7 +4212,14 @@
+
+ if (new_const == 0)
+ break;
+-
++#ifndef FRAME_GROWS_DOWNWARD
++ if (flag_propolice_protection
++ && GET_CODE (y) == PLUS
++ && XEXP (y, 0) == frame_pointer_rtx
++ && INTVAL (inner_const) > 0
++ && INTVAL (new_const) <= 0)
++ break;
++#endif
+ /* If we are associating shift operations, don't let this
+ produce a shift of the size of the object or larger.
+ This could occur when we follow a sign-extend by a right
+@@ -4744,6 +4751,14 @@
+ if (SET_DEST (x) == pc_rtx
+ && GET_CODE (SET_SRC (x)) == LABEL_REF)
+ ;
++ /* cut the reg propagation of stack-protected argument. */
++ else if (SET_VOLATILE_P (x)) {
++ rtx x1 = SET_DEST (x);
++ if (GET_CODE (x1) == SUBREG && GET_CODE (SUBREG_REG (x1)) == REG)
++ x1 = SUBREG_REG (x1);
++ if (! REGNO_QTY_VALID_P(REGNO (x1)))
++ make_new_qty (REGNO (x1), GET_MODE (x1));
++ }
+
+ /* Don't count call-insns, (set (reg 0) (call ...)), as a set.
+ The hard function value register is used only once, to copy to
+diff -uNr gcc-3.4.3.orig/gcc/doc/invoke.texi gcc-3.4.3/gcc/doc/invoke.texi
+--- gcc-3.4.3.orig/gcc/doc/invoke.texi 2004-11-24 18:04:19.000000000 +0100
++++ gcc-3.4.3/gcc/doc/invoke.texi 2004-11-24 18:35:32.000000000 +0100
+@@ -228,7 +228,7 @@
+ -Wno-multichar -Wnonnull -Wpacked -Wpadded @gol
+ -Wparentheses -Wpointer-arith -Wredundant-decls @gol
+ -Wreturn-type -Wsequence-point -Wshadow @gol
+--Wsign-compare -Wstrict-aliasing @gol
++-Wsign-compare -Wstack-protector -Wstrict-aliasing @gol
+ -Wswitch -Wswitch-default -Wswitch-enum @gol
+ -Wsystem-headers -Wtrigraphs -Wundef -Wuninitialized @gol
+ -Wunknown-pragmas -Wunreachable-code @gol
+@@ -673,6 +673,7 @@
+ -fshort-double -fshort-wchar @gol
+ -fverbose-asm -fpack-struct -fstack-check @gol
+ -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
++-fstack-protector -fstack-protector-all @gol
+ -fargument-alias -fargument-noalias @gol
+ -fargument-noalias-global -fleading-underscore @gol
+ -ftls-model=@var{model} @gol
+@@ -3006,6 +3007,10 @@
+ complex; GCC will refuse to optimize programs when the optimization
+ itself is likely to take inordinate amounts of time.
+
++@item -Wstack-protector
++@opindex Wstack-protector
++Warn when not issuing stack smashing protection for some reason.
++
+ @item -Werror
+ @opindex Werror
+ Make all warnings into errors.
+@@ -11202,6 +11207,24 @@
+ @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
+ of 128KB@. Note that this may only work with the GNU linker.
+
++@item -fstack-protector
++@item -fstack-protector-all
++@opindex fstack-protector
++@opindex fstack-protector-all
++@opindex fno-stack-protector
++Generate code to protect an application from a stack smashing
++attack. The features are (1) the insertion of random value next to the
++frame pointer to detect the integrity of the stack, (2) the reordering
++of local variables to place buffers after pointers to avoid the
++corruption of pointers that could be used to further corrupt arbitrary
++memory locations, (3) the copying of pointers in function arguments to
++an area preceding local variable buffers to prevent the corruption of
++pointers that could be used to further corrupt arbitrary memory
++locations, and the (4) omission of instrumentation code from some
++functions to decrease the performance overhead. If the integrity
++would be broken, the program is aborted. If stack-protector-all is
++specified, instrumentation codes are generated at every functions.
++
+ @cindex aliasing of parameters
+ @cindex parameters, aliased
+ @item -fargument-alias
+diff -uNr gcc-3.4.3.orig/gcc/explow.c gcc-3.4.3/gcc/explow.c
+--- gcc-3.4.3.orig/gcc/explow.c 2004-04-03 01:05:26.000000000 +0200
++++ gcc-3.4.3/gcc/explow.c 2004-11-24 18:35:31.000000000 +0100
+@@ -84,7 +84,8 @@
+ rtx tem;
+ int all_constant = 0;
+
+- if (c == 0)
++ if (c == 0
++ && ! (flag_propolice_protection && x == virtual_stack_vars_rtx))
+ return x;
+
+ restart:
+@@ -185,7 +186,10 @@
+ break;
+ }
+
+- if (c != 0)
++ /* For the use of stack protection, keep the frame and offset pattern
++ even if the offset is zero. */
++ if (c != 0
++ || (flag_propolice_protection && x == virtual_stack_vars_rtx))
+ x = gen_rtx_PLUS (mode, x, GEN_INT (c));
+
+ if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
+@@ -474,6 +478,26 @@
+ if (memory_address_p (mode, oldx))
+ goto win2;
+
++ /* The stack protector keeps the addressing style of a local variable.
++ LEGITIMIZE_ADDRESS changes the addressing to the machine-dependent
++ style, so the protector split the frame address to a register using
++ force_reg. */
++ if (flag_propolice_protection)
++ {
++#define FRAMEADDR_P(X) (GET_CODE (X) == PLUS \
++ && XEXP (X, 0) == virtual_stack_vars_rtx \
++ && GET_CODE (XEXP (X, 1)) == CONST_INT)
++ rtx y;
++ if (FRAMEADDR_P (x))
++ goto win;
++ for (y = x; y != 0 && GET_CODE (y) == PLUS; y = XEXP (y, 0))
++ {
++ if (FRAMEADDR_P (XEXP (y, 0)))
++ XEXP (y, 0) = force_reg (GET_MODE (XEXP (y, 0)), XEXP (y, 0));
++ if (FRAMEADDR_P (XEXP (y, 1)))
++ XEXP (y, 1) = force_reg (GET_MODE (XEXP (y, 1)), XEXP (y, 1));
++ }
++ }
+ /* Perform machine-dependent transformations on X
+ in certain cases. This is not necessary since the code
+ below can handle all possible cases, but machine-dependent
+diff -uNr gcc-3.4.3.orig/gcc/expr.c gcc-3.4.3/gcc/expr.c
+--- gcc-3.4.3.orig/gcc/expr.c 2004-05-27 21:35:17.000000000 +0200
++++ gcc-3.4.3/gcc/expr.c 2004-11-24 18:35:31.000000000 +0100
+@@ -48,6 +48,7 @@
+ #include "intl.h"
+ #include "tm_p.h"
+ #include "target.h"
++#include "protector.h"
+
+ /* Decide whether a function's arguments should be processed
+ from first to last or from last to first.
+@@ -1060,7 +1061,11 @@
+
+ If ENDP is 0 return to, if ENDP is 1 return memory at the end ala
+ mempcpy, and if ENDP is 2 return memory the end minus one byte ala
+- stpcpy. */
++ stpcpy.
++
++ When the stack protector is used at the reverse move, it starts the move
++ instruction from the address within the region of a variable.
++ So it eliminates the first address decrement instruction. */
+
+ rtx
+ move_by_pieces (rtx to, rtx from, unsigned HOST_WIDE_INT len,
+@@ -1123,6 +1128,8 @@
+
+ if (USE_LOAD_PRE_DECREMENT (mode) && data.reverse && ! data.autinc_from)
+ {
++ if (flag_propolice_protection)
++ len = len - GET_MODE_SIZE (mode);
+ data.from_addr = copy_addr_to_reg (plus_constant (from_addr, len));
+ data.autinc_from = 1;
+ data.explicit_inc_from = -1;
+@@ -1137,6 +1144,8 @@
+ data.from_addr = copy_addr_to_reg (from_addr);
+ if (USE_STORE_PRE_DECREMENT (mode) && data.reverse && ! data.autinc_to)
+ {
++ if (flag_propolice_protection)
++ len = len - GET_MODE_SIZE (mode);
+ data.to_addr = copy_addr_to_reg (plus_constant (to_addr, len));
+ data.autinc_to = 1;
+ data.explicit_inc_to = -1;
+@@ -1280,11 +1289,15 @@
+ from1 = adjust_address (data->from, mode, data->offset);
+
+ if (HAVE_PRE_DECREMENT && data->explicit_inc_to < 0)
+- emit_insn (gen_add2_insn (data->to_addr,
+- GEN_INT (-(HOST_WIDE_INT)size)));
++ /* The stack protector skips the first address decrement instruction
++ at the reverse move. */
++ if (!flag_propolice_protection || data->explicit_inc_to < -1)
++ emit_insn (gen_add2_insn (data->to_addr,
++ GEN_INT (-(HOST_WIDE_INT)size)));
+ if (HAVE_PRE_DECREMENT && data->explicit_inc_from < 0)
+- emit_insn (gen_add2_insn (data->from_addr,
+- GEN_INT (-(HOST_WIDE_INT)size)));
++ if (!flag_propolice_protection || data->explicit_inc_from < -1)
++ emit_insn (gen_add2_insn (data->from_addr,
++ GEN_INT (-(HOST_WIDE_INT)size)));
+
+ if (data->to)
+ emit_insn ((*genfun) (to1, from1));
+@@ -2475,7 +2488,12 @@
+
+ if (USE_STORE_PRE_DECREMENT (mode) && data->reverse && ! data->autinc_to)
+ {
+- data->to_addr = copy_addr_to_reg (plus_constant (to_addr, data->len));
++ int len = data->len;
++ /* The stack protector starts the store instruction from
++ the address within the region of a variable. */
++ if (flag_propolice_protection)
++ len -= GET_MODE_SIZE (mode);
++ data->to_addr = copy_addr_to_reg (plus_constant (to_addr, len));
+ data->autinc_to = 1;
+ data->explicit_inc_to = -1;
+ }
+@@ -2544,8 +2562,11 @@
+ to1 = adjust_address (data->to, mode, data->offset);
+
+ if (HAVE_PRE_DECREMENT && data->explicit_inc_to < 0)
+- emit_insn (gen_add2_insn (data->to_addr,
+- GEN_INT (-(HOST_WIDE_INT) size)));
++ /* The stack protector skips the first address decrement instruction
++ at the reverse store. */
++ if (!flag_propolice_protection || data->explicit_inc_to < -1)
++ emit_insn (gen_add2_insn (data->to_addr,
++ GEN_INT (-(HOST_WIDE_INT) size)));
+
+ cst = (*data->constfun) (data->constfundata, data->offset, mode);
+ emit_insn ((*genfun) (to1, cst));
+@@ -5701,7 +5722,9 @@
+ && GET_CODE (XEXP (value, 0)) == PLUS
+ && GET_CODE (XEXP (XEXP (value, 0), 0)) == REG
+ && REGNO (XEXP (XEXP (value, 0), 0)) >= FIRST_VIRTUAL_REGISTER
+- && REGNO (XEXP (XEXP (value, 0), 0)) <= LAST_VIRTUAL_REGISTER)
++ && REGNO (XEXP (XEXP (value, 0), 0)) <= LAST_VIRTUAL_REGISTER
++ && (!flag_propolice_protection
++ || XEXP (XEXP (value, 0), 0) != virtual_stack_vars_rtx))
+ {
+ rtx temp = expand_simple_binop (GET_MODE (value), code,
+ XEXP (XEXP (value, 0), 0), op2,
+diff -uNr gcc-3.4.3.orig/gcc/flags.h gcc-3.4.3/gcc/flags.h
+--- gcc-3.4.3.orig/gcc/flags.h 2004-11-24 18:04:19.000000000 +0100
++++ gcc-3.4.3/gcc/flags.h 2004-11-24 18:35:31.492689688 +0100
+@@ -210,6 +210,10 @@
+
+ extern bool warn_strict_aliasing;
+
++/* Warn when not issuing stack smashing protection for some reason. */
++
++extern bool warn_stack_protector;
++
+ /* Nonzero if generating code to do profiling. */
+
+ extern int profile_flag;
+@@ -795,4 +799,12 @@
+ #define HONOR_SIGN_DEPENDENT_ROUNDING(MODE) \
+ (MODE_HAS_SIGN_DEPENDENT_ROUNDING (MODE) && flag_rounding_math)
+
++/* Nonzero means use propolice as a stack protection method. */
++
++extern int flag_propolice_protection;
++
++/* Nonzero means use a stack protection method for every function. */
++
++extern int flag_stack_protection;
++
+ #endif /* ! GCC_FLAGS_H */
+diff -uNr gcc-3.4.3.orig/gcc/function.c gcc-3.4.3/gcc/function.c
+--- gcc-3.4.3.orig/gcc/function.c 2004-10-14 01:18:13.000000000 +0200
++++ gcc-3.4.3/gcc/function.c 2004-11-24 18:35:31.542682088 +0100
+@@ -63,6 +63,7 @@
+ #include "integrate.h"
+ #include "langhooks.h"
+ #include "target.h"
++#include "protector.h"
+
+ #ifndef TRAMPOLINE_ALIGNMENT
+ #define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY
+@@ -155,6 +156,10 @@
+ /* Array of INSN_UIDs to hold the INSN_UIDs for each sibcall epilogue
+ in this function. */
+ static GTY(()) varray_type sibcall_epilogue;
++
++/* Current boundary mark for character arrays. */
++static int temp_boundary_mark = 0;
++
+ \f
+ /* In order to evaluate some expressions, such as function calls returning
+ structures in memory, we need to temporarily allocate stack locations.
+@@ -208,6 +213,8 @@
+ /* The size of the slot, including extra space for alignment. This
+ info is for combine_temp_slots. */
+ HOST_WIDE_INT full_size;
++ /* Boundary mark of a character array and the others. This info is for propolice. */
++ int boundary_mark;
+ };
+ \f
+ /* This structure is used to record MEMs or pseudos used to replace VAR, any
+@@ -638,6 +645,7 @@
+ whose lifetime is controlled by CLEANUP_POINT_EXPRs. KEEP is 3
+ if we are to allocate something at an inner level to be treated as
+ a variable in the block (e.g., a SAVE_EXPR).
++ KEEP is 5 if we allocate a place to return structure.
+
+ TYPE is the type that will be used for the stack slot. */
+
+@@ -648,6 +656,8 @@
+ unsigned int align;
+ struct temp_slot *p, *best_p = 0;
+ rtx slot;
++ int char_array = (flag_propolice_protection
++ && keep == 1 && search_string_def (type));
+
+ /* If SIZE is -1 it means that somebody tried to allocate a temporary
+ of a variable size. */
+@@ -673,7 +683,8 @@
+ && ! p->in_use
+ && objects_must_conflict_p (p->type, type)
+ && (best_p == 0 || best_p->size > p->size
+- || (best_p->size == p->size && best_p->align > p->align)))
++ || (best_p->size == p->size && best_p->align > p->align))
++ && (! char_array || p->boundary_mark != 0))
+ {
+ if (p->align == align && p->size == size)
+ {
+@@ -708,6 +719,7 @@
+ p->address = 0;
+ p->rtl_expr = 0;
+ p->type = best_p->type;
++ p->boundary_mark = best_p->boundary_mark;
+ p->next = temp_slots;
+ temp_slots = p;
+
+@@ -768,6 +780,7 @@
+ p->full_size = frame_offset - frame_offset_old;
+ #endif
+ p->address = 0;
++ p->boundary_mark = char_array ? ++temp_boundary_mark : 0;
+ p->next = temp_slots;
+ temp_slots = p;
+ }
+@@ -932,14 +945,16 @@
+ int delete_q = 0;
+ if (! q->in_use && GET_MODE (q->slot) == BLKmode)
+ {
+- if (p->base_offset + p->full_size == q->base_offset)
++ if (p->base_offset + p->full_size == q->base_offset &&
++ p->boundary_mark == q->boundary_mark)
+ {
+ /* Q comes after P; combine Q into P. */
+ p->size += q->size;
+ p->full_size += q->full_size;
+ delete_q = 1;
+ }
+- else if (q->base_offset + q->full_size == p->base_offset)
++ else if (q->base_offset + q->full_size == p->base_offset &&
++ p->boundary_mark == q->boundary_mark)
+ {
+ /* P comes after Q; combine P into Q. */
+ q->size += p->size;
+@@ -1449,7 +1464,9 @@
+ }
+
+ if (new == 0)
+- new = assign_stack_local_1 (decl_mode, GET_MODE_SIZE (decl_mode), 0, func);
++ new = function ?
++ assign_stack_local_1 (decl_mode, GET_MODE_SIZE (decl_mode), 0, func)
++ : assign_stack_local_for_pseudo_reg (decl_mode, GET_MODE_SIZE (decl_mode), 0);
+
+ PUT_CODE (reg, MEM);
+ PUT_MODE (reg, decl_mode);
+@@ -3937,10 +3954,13 @@
+ }
+
+ /* Otherwise copy the new constant into a register and replace
+- constant with that register. */
++ constant with that register.
++ At the use of stack protection, stop to replace the frame
++ offset with a register. */
+ temp = gen_reg_rtx (Pmode);
+ XEXP (x, 0) = new;
+- if (validate_change (object, &XEXP (x, 1), temp, 0))
++ if (validate_change (object, &XEXP (x, 1), temp, 0)
++ && !flag_propolice_protection)
+ emit_insn_before (gen_move_insn (temp, new_offset), object);
+ else
+ {
+diff -uNr gcc-3.4.3.orig/gcc/gcse.c gcc-3.4.3/gcc/gcse.c
+--- gcc-3.4.3.orig/gcc/gcse.c 2004-10-30 20:02:53.000000000 +0200
++++ gcc-3.4.3/gcc/gcse.c 2004-11-24 18:35:31.583675856 +0100
+@@ -4176,9 +4176,13 @@
+ continue;
+
+ /* Find an assignment that sets reg_used and is available
+- at the start of the block. */
++ at the start of the block.
++
++ Skip the copy propagation not to eliminate the register that is
++ the duplicated pointer of a function argument. It is used for
++ the function argument protection. */
+ set = find_avail_set (regno, insn);
+- if (! set)
++ if (! set || SET_VOLATILE_P (set->expr))
+ continue;
+
+ pat = set->expr;
+diff -uNr gcc-3.4.3.orig/gcc/integrate.c gcc-3.4.3/gcc/integrate.c
+--- gcc-3.4.3.orig/gcc/integrate.c 2004-01-24 00:36:00.000000000 +0100
++++ gcc-3.4.3/gcc/integrate.c 2004-11-24 18:35:31.603672816 +0100
+@@ -393,6 +393,11 @@
+ /* These args would always appear unused, if not for this. */
+ TREE_USED (copy) = 1;
+
++ /* The inlined variable is marked as INLINE not to change the location
++ by stack protector. */
++ if (flag_propolice_protection && TREE_CODE (copy) == VAR_DECL)
++ DECL_COPIED (copy) = 1;
++
+ /* Set the context for the new declaration. */
+ if (!DECL_CONTEXT (decl))
+ /* Globals stay global. */
+@@ -1970,6 +1975,12 @@
+
+ seq = get_insns ();
+ end_sequence ();
++#ifdef ARGS_GROWS_DOWNWARD
++ /* Mark this pointer as the top of the argument
++ block. The pointer minus one is in the block. */
++ if (flag_propolice_protection && GET_CODE (seq) == SET)
++ RTX_INTEGRATED_P (SET_SRC (seq)) = 1;
++#endif
+ emit_insn_after (seq, map->insns_at_start);
+ return temp;
+ }
+diff -uNr gcc-3.4.3.orig/gcc/libgcc2.c gcc-3.4.3/gcc/libgcc2.c
+--- gcc-3.4.3.orig/gcc/libgcc2.c 2004-09-26 22:47:14.000000000 +0200
++++ gcc-3.4.3/gcc/libgcc2.c 2004-11-24 18:35:31.627669168 +0100
+@@ -1678,3 +1678,124 @@
+ #endif /* no INIT_SECTION_ASM_OP and not CTOR_LISTS_DEFINED_EXTERNALLY */
+ #endif /* L_ctors */
+
++\f
++#ifdef L_stack_smash_handler
++#ifndef _LIBC_PROVIDES_SSP_
++#include <stdio.h>
++#include <string.h>
++#include <fcntl.h>
++#include <unistd.h>
++
++#ifdef _POSIX_SOURCE
++#include <signal.h>
++#endif
++
++#if defined(HAVE_SYSLOG)
++#include <sys/types.h>
++#include <sys/socket.h>
++#include <sys/un.h>
++
++#include <sys/syslog.h>
++#ifndef _PATH_LOG
++#define _PATH_LOG "/dev/log"
++#endif
++#endif
++
++long __guard[8] = {0, 0, 0, 0, 0, 0, 0, 0};
++static void __guard_setup (void) __attribute__ ((constructor));
++
++static void
++__guard_setup (void)
++{
++ int fd;
++ if (__guard[0] != 0)
++ return;
++ fd = open ("/dev/urandom", 0);
++ if (fd != -1) {
++ ssize_t size = read (fd, (char*)&__guard, sizeof(__guard));
++ close (fd) ;
++ if (size == sizeof(__guard))
++ return;
++ }
++ /* If a random generator can't be used, the protector switches the guard
++ to the "terminator canary". */
++ ((char*)__guard)[0] = 0;
++ ((char*)__guard)[1] = 0;
++ ((char*)__guard)[2] = '\n';
++ ((char*)__guard)[3] = 255;
++}
++
++extern void __stack_smash_handler (char func[], ATTRIBUTE_UNUSED int damaged);
++void
++__stack_smash_handler (char func[], ATTRIBUTE_UNUSED int damaged)
++{
++#if defined (__GNU_LIBRARY__)
++ extern char * __progname;
++#endif
++ const char message[] = ": stack smashing attack in function ";
++ int bufsz = 256, len;
++ char buf[bufsz];
++#if defined(HAVE_SYSLOG)
++ int log_file;
++ struct sockaddr_un sys_log_addr; /* AF_UNIX address of local logger. */
++#endif
++#ifdef _POSIX_SOURCE
++ {
++ sigset_t mask;
++ sigfillset (&mask);
++ /* Block all signal handlers except SIGABRT. */
++ sigdelset (&mask, SIGABRT);
++ sigprocmask (SIG_BLOCK, &mask, NULL);
++ }
++#endif
++
++ /* send LOG_CRIT. */
++ strcpy (buf, "<2>"); len=3;
++#if defined (__GNU_LIBRARY__)
++ strncat (buf, __progname, bufsz - len - 1);
++ len = strlen (buf);
++#endif
++ if (bufsz > len)
++ {
++ strncat (buf, message, bufsz - len - 1);
++ len = strlen (buf);
++ }
++ if (bufsz > len)
++ {
++ strncat (buf, func, bufsz - len - 1);
++ len = strlen (buf);
++ }
++
++ /* Print error message. */
++ write (STDERR_FILENO, buf + 3, len - 3);
++#if defined(HAVE_SYSLOG)
++ if ((log_file = socket (AF_UNIX, SOCK_DGRAM, 0)) != -1)
++ {
++
++ /* Send "found" message to the "/dev/log" path. */
++ sys_log_addr.sun_family = AF_UNIX;
++ (void)strncpy (sys_log_addr.sun_path, _PATH_LOG,
++ sizeof (sys_log_addr.sun_path) - 1);
++ sys_log_addr.sun_path[sizeof (sys_log_addr.sun_path) - 1] = '\0';
++ sendto(log_file, buf, len, 0, (struct sockaddr *)&sys_log_addr,
++ sizeof (sys_log_addr));
++ }
++#endif
++
++#ifdef _POSIX_SOURCE
++ {
++ /* Make sure the default handler is associated with SIGABRT. */
++ struct sigaction sa;
++
++ memset (&sa, 0, sizeof(struct sigaction));
++ sigfillset (&sa.sa_mask); /* Block all signals. */
++ sa.sa_flags = 0;
++ sa.sa_handler = SIG_DFL;
++ sigaction (SIGABRT, &sa, NULL);
++ (void)kill (getpid(), SIGABRT);
++ }
++#endif
++ _exit (127);
++}
++#endif /* _LIBC_PROVIDES_SSP_ */
++#endif /* L_stack_smash_handler */
+diff -uNr gcc-3.4.3.orig/gcc/libgcc-std.ver gcc-3.4.3/gcc/libgcc-std.ver
+--- gcc-3.4.3.orig/gcc/libgcc-std.ver 2004-09-01 21:14:33.000000000 +0200
++++ gcc-3.4.3/gcc/libgcc-std.ver 2004-11-24 18:35:31.620670232 +0100
+@@ -174,6 +174,12 @@
+ _Unwind_SjLj_RaiseException
+ _Unwind_SjLj_ForcedUnwind
+ _Unwind_SjLj_Resume
++
++%if !defined(_LIBC_PROVIDES_SSP_)
++ # stack smash handler symbols
++ __guard
++ __stack_smash_handler
++%endif
+ }
+
+ %inherit GCC_3.3 GCC_3.0
+diff -uNr gcc-3.4.3.orig/gcc/loop.c gcc-3.4.3/gcc/loop.c
+--- gcc-3.4.3.orig/gcc/loop.c 2004-07-13 17:29:08.000000000 +0200
++++ gcc-3.4.3/gcc/loop.c 2004-11-24 18:35:31.680661112 +0100
+@@ -6514,6 +6514,14 @@
+ if (GET_CODE (*mult_val) == USE)
+ *mult_val = XEXP (*mult_val, 0);
+
++#ifndef FRAME_GROWS_DOWNWARD
++ if (flag_propolice_protection
++ && GET_CODE (*add_val) == PLUS
++ && (XEXP (*add_val, 0) == frame_pointer_rtx
++ || XEXP (*add_val, 1) == frame_pointer_rtx))
++ return 0;
++#endif
++
+ if (is_addr)
+ *pbenefit += address_cost (orig_x, addr_mode) - reg_address_cost;
+ else
+diff -uNr gcc-3.4.3.orig/gcc/Makefile.in gcc-3.4.3/gcc/Makefile.in
+--- gcc-3.4.3.orig/gcc/Makefile.in 2004-11-24 18:04:18.000000000 +0100
++++ gcc-3.4.3/gcc/Makefile.in 2004-11-24 18:35:31.038758696 +0100
+@@ -867,7 +867,7 @@
+ sibcall.o simplify-rtx.o sreal.o stmt.o stor-layout.o stringpool.o \
+ targhooks.o timevar.o toplev.o tracer.o tree.o tree-dump.o unroll.o \
+ varasm.o varray.o version.o vmsdbgout.o xcoffout.o alloc-pool.o \
+- et-forest.o cfghooks.o bt-load.o pretty-print.o $(GGC) web.o
++ et-forest.o cfghooks.o bt-load.o pretty-print.o $(GGC) web.o protector.o
+
+ OBJS-md = $(out_object_file)
+ OBJS-archive = $(EXTRA_OBJS) $(host_hook_obj) hashtable.o tree-inline.o \
+@@ -1549,7 +1549,7 @@
+ langhooks.h insn-flags.h cfglayout.h real.h cfgloop.h \
+ hosthooks.h $(LANGHOOKS_DEF_H) cgraph.h $(COVERAGE_H) alloc-pool.h
+ $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+- -DTARGET_NAME=\"$(target_noncanonical)\" \
++ -DTARGET_NAME=\"$(target_noncanonical)\" @ENABLESSP@ \
+ -c $(srcdir)/toplev.c $(OUTPUT_OPTION)
+ main.o : main.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h
+
+@@ -1852,6 +1852,10 @@
+ params.o : params.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(PARAMS_H) toplev.h
+ hooks.o: hooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(HOOKS_H)
+ pretty-print.o: $(CONFIG_H) $(SYSTEM_H) pretty-print.c $(PRETTY_PRINT_H)
++protector.o : protector.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
++ flags.h function.h $(EXPR_H) $(OPTABS_H) $(REGS_H) toplev.h hard-reg-set.h \
++ insn-config.h insn-flags.h $(RECOG_H) output.h toplev.h except.h reload.h \
++ $(TM_P_H) conditions.h $(INSN_ATTR_H) real.h protector.h
+
+ $(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) $(GGC_H) \
+ $(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \
+diff -uNr gcc-3.4.3.orig/gcc/mklibgcc.in gcc-3.4.3/gcc/mklibgcc.in
+--- gcc-3.4.3.orig/gcc/mklibgcc.in 2004-10-18 18:00:43.000000000 +0200
++++ gcc-3.4.3/gcc/mklibgcc.in 2004-11-24 18:35:31.699658224 +0100
+@@ -57,7 +57,7 @@
+ _enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3
+ _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors
+ _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab
+- _popcountsi2 _popcountdi2 _paritysi2 _paritydi2'
++ _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _stack_smash_handler'
+
+ # Disable SHLIB_LINK if shared libgcc not enabled.
+ if [ "@enable_shared@" = "no" ]; then
+diff -uNr gcc-3.4.3.orig/gcc/optabs.c gcc-3.4.3/gcc/optabs.c
+--- gcc-3.4.3.orig/gcc/optabs.c 2004-03-03 01:45:01.000000000 +0100
++++ gcc-3.4.3/gcc/optabs.c 2004-11-24 18:35:31.739652144 +0100
+@@ -678,6 +678,27 @@
+ if (target)
+ target = protect_from_queue (target, 1);
+
++ /* Keep the frame and offset pattern at the use of stack protection. */
++ if (flag_propolice_protection
++ && binoptab->code == PLUS
++ && op0 == virtual_stack_vars_rtx
++ && GET_CODE(op1) == CONST_INT)
++ {
++ int icode = (int) binoptab->handlers[(int) mode].insn_code;
++ if (target)
++ temp = target;
++ else
++ temp = gen_reg_rtx (mode);
++
++ if (! (*insn_data[icode].operand[0].predicate) (temp, mode)
++ || GET_CODE (temp) != REG)
++ temp = gen_reg_rtx (mode);
++
++ emit_insn (gen_rtx_SET (VOIDmode, temp,
++ gen_rtx_PLUS (GET_MODE (op0), op0, op1)));
++ return temp;
++ }
++
+ if (flag_force_mem)
+ {
+ /* Load duplicate non-volatile operands once. */
+diff -uNr gcc-3.4.3.orig/gcc/opts.c gcc-3.4.3/gcc/opts.c
+--- gcc-3.4.3.orig/gcc/opts.c 2004-11-24 18:04:19.000000000 +0100
++++ gcc-3.4.3/gcc/opts.c 2004-11-24 18:35:31.762648648 +0100
+@@ -125,6 +125,9 @@
+ bool warn_unused_variable;
+ bool warn_unused_value;
+
++/* Warn when not issuing stack smashing protection for some reason */
++bool warn_stack_protector;
++
+ /* Hack for cooperation between set_Wunused and set_Wextra. */
+ static bool maybe_warn_unused_parameter;
+
+@@ -804,6 +807,10 @@
+ warn_unused_variable = value;
+ break;
+
++ case OPT_Wstack_protector:
++ warn_stack_protector = value;
++ break;
++
+ case OPT_aux_info:
+ case OPT_aux_info_:
+ aux_info_file_name = arg;
+@@ -1367,6 +1374,14 @@
+ stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (arg));
+ break;
+
++ case OPT_fstack_protector:
++ flag_propolice_protection = value;
++ break;
++
++ case OPT_fstack_protector_all:
++ flag_stack_protection = value;
++ break;
++
+ case OPT_fstrength_reduce:
+ flag_strength_reduce = value;
+ break;
+diff -uNr gcc-3.4.3.orig/gcc/protector.c gcc-3.4.3/gcc/protector.c
+--- gcc-3.4.3.orig/gcc/protector.c 1970-01-01 01:00:00.000000000 +0100
++++ gcc-3.4.3/gcc/protector.c 2004-09-02 11:36:11.000000000 +0200
+@@ -0,0 +1,2730 @@
++/* RTL buffer overflow protection function for GNU C compiler
++ Copyright (C) 2003 Free Software Foundation, Inc.
++
++This file is part of GCC.
++
++GCC is free software; you can redistribute it and/or modify it under
++the terms of the GNU General Public License as published by the Free
++Software Foundation; either version 2, or (at your option) any later
++version.
++
++GCC is distributed in the hope that it will be useful, but WITHOUT ANY
++WARRANTY; without even the implied warranty of MERCHANTABILITY or
++FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
++for more details.
++
++You should have received a copy of the GNU General Public License
++along with GCC; see the file COPYING. If not, write to the Free
++Software Foundation, 59 Temple Place - Suite 330, Boston, MA
++02111-1307, USA. */
++
++/* This file contains several memory arrangement functions to protect
++ the return address and the frame pointer of the stack
++ from a stack-smashing attack. It also
++ provides the function that protects pointer variables. */
++
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tm.h"
++#include "machmode.h"
++#include "real.h"
++#include "rtl.h"
++#include "tree.h"
++#include "regs.h"
++#include "flags.h"
++#include "insn-config.h"
++#include "insn-flags.h"
++#include "expr.h"
++#include "output.h"
++#include "recog.h"
++#include "hard-reg-set.h"
++#include "except.h"
++#include "function.h"
++#include "toplev.h"
++#include "tm_p.h"
++#include "conditions.h"
++#include "insn-attr.h"
++#include "optabs.h"
++#include "reload.h"
++#include "protector.h"
++
++
++/* Round a value to the lowest integer less than it that is a multiple of
++ the required alignment. Avoid using division in case the value is
++ negative. Assume the alignment is a power of two. */
++#define FLOOR_ROUND(VALUE,ALIGN) ((VALUE) & ~((ALIGN) - 1))
++
++/* Similar, but round to the next highest integer that meets the
++ alignment. */
++#define CEIL_ROUND(VALUE,ALIGN) (((VALUE) + (ALIGN) - 1) & ~((ALIGN)- 1))
++
++
++/* Nonzero if function being compiled can define string buffers that may be
++ damaged by the stack-smash attack. */
++static int current_function_defines_vulnerable_string;
++static int current_function_defines_short_string;
++static int current_function_has_variable_string;
++static int current_function_defines_vsized_array;
++static int current_function_is_inlinable;
++
++/* Nonzero if search_string_def finds the variable which contains an array. */
++static int is_array;
++
++/* Nonzero if search_string_def finds a byte-pointer variable,
++ which may be assigned to alloca output. */
++static int may_have_alloca_pointer;
++
++static rtx guard_area, _guard;
++static rtx function_first_insn, prologue_insert_point;
++
++/* Offset to end of sweeped area for gathering character arrays. */
++static HOST_WIDE_INT sweep_frame_offset;
++
++/* Offset to end of allocated area for instantiating pseudo registers. */
++static HOST_WIDE_INT push_allocated_offset = 0;
++
++/* Offset to end of assigned area for instantiating pseudo registers. */
++static HOST_WIDE_INT push_frame_offset = 0;
++
++/* Set to 1 after cse_not_expected becomes nonzero. it is used to identify
++ which stage assign_stack_local_for_pseudo_reg is called from. */
++static int saved_cse_not_expected = 0;
++
++static int search_string_from_argsandvars (int);
++static int search_string_from_local_vars (tree);
++static int search_pointer_def (tree);
++static int search_func_pointer (tree);
++static int check_used_flag (rtx);
++static void reset_used_flags_for_insns (rtx);
++static void reset_used_flags_for_decls (tree);
++static void reset_used_flags_of_plus (rtx);
++static void rtl_prologue (rtx);
++static void rtl_epilogue (rtx);
++static void arrange_var_order (tree);
++static void copy_args_for_protection (void);
++static void sweep_string_variable (rtx, HOST_WIDE_INT);
++static void sweep_string_in_decls (tree, HOST_WIDE_INT, HOST_WIDE_INT);
++static void sweep_string_in_args (tree, HOST_WIDE_INT, HOST_WIDE_INT);
++static void sweep_string_use_of_insns (rtx, HOST_WIDE_INT, HOST_WIDE_INT);
++static void sweep_string_in_operand (rtx, rtx *, HOST_WIDE_INT, HOST_WIDE_INT);
++static void move_arg_location (rtx, rtx, rtx, HOST_WIDE_INT);
++static void change_arg_use_of_insns (rtx, rtx, rtx *, HOST_WIDE_INT);
++static void change_arg_use_in_operand (rtx, rtx, rtx, rtx *, HOST_WIDE_INT);
++static void validate_insns_of_varrefs (rtx);
++static void validate_operand_of_varrefs (rtx, rtx *);
++
++/* Specify which size of buffers should be protected from a stack smashing
++ attack. Because small buffers are not used in situations which may
++ overflow buffer, the default size sets to the size of 64 bit register. */
++#ifndef SUSPICIOUS_BUF_SIZE
++#define SUSPICIOUS_BUF_SIZE 8
++#endif
++
++#define AUTO_BASEPTR(X) \
++ (GET_CODE (X) == PLUS ? XEXP (X, 0) : X)
++#define AUTO_OFFSET(X) \
++ (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0)
++#undef PARM_PASSED_IN_MEMORY
++#define PARM_PASSED_IN_MEMORY(PARM) \
++ (GET_CODE (DECL_INCOMING_RTL (PARM)) == MEM)
++#define TREE_VISITED(NODE) ((NODE)->common.unused_0)
++
++/* Argument values for calling search_string_from_argsandvars. */
++#define CALL_FROM_PREPARE_STACK_PROTECTION 0
++#define CALL_FROM_PUSH_FRAME 1
++
++
++/* Prepare several stack protection instruments for the current function
++ if the function has an array as a local variable, which may be vulnerable
++ from a stack smashing attack, and it is not inlinable.
++
++ The overall steps are as follows;
++ (1)search an array,
++ (2)insert guard_area on the stack,
++ (3)duplicate pointer arguments into local variables, and
++ (4)arrange the location of local variables. */
++void
++prepare_stack_protection (int inlinable)
++{
++ tree blocks = DECL_INITIAL (current_function_decl);
++ current_function_is_inlinable = inlinable && !flag_no_inline;
++ push_frame_offset = push_allocated_offset = 0;
++ saved_cse_not_expected = 0;
++
++ /* Skip the protection if the function has no block
++ or it is an inline function. */
++ if (current_function_is_inlinable)
++ validate_insns_of_varrefs (get_insns ());
++ if (! blocks || current_function_is_inlinable)
++ return;
++
++ current_function_defines_vulnerable_string
++ = search_string_from_argsandvars (CALL_FROM_PREPARE_STACK_PROTECTION);
++
++ if (current_function_defines_vulnerable_string
++ || flag_stack_protection)
++ {
++ function_first_insn = get_insns ();
++
++ if (current_function_contains_functions)
++ {
++ if (warn_stack_protector)
++ warning ("not protecting function: it contains functions");
++ return;
++ }
++
++ /* Initialize recognition, indicating that volatile is OK. */
++ init_recog ();
++
++ sweep_frame_offset = 0;
++
++#ifdef STACK_GROWS_DOWNWARD
++ /* frame_offset: offset to end of allocated area of stack frame.
++ It is defined in the function.c. */
++
++ /* the location must be before buffers. */
++ guard_area = assign_stack_local (BLKmode, UNITS_PER_GUARD, -1);
++ PUT_MODE (guard_area, GUARD_m);
++ MEM_VOLATILE_P (guard_area) = 1;
++
++#ifndef FRAME_GROWS_DOWNWARD
++ sweep_frame_offset = frame_offset;
++#endif
++
++ /* For making room for guard value, scan all insns and fix the offset
++ address of the variable that is based on frame pointer.
++ Scan all declarations of variables and fix the offset address
++ of the variable that is based on the frame pointer. */
++ sweep_string_variable (guard_area, UNITS_PER_GUARD);
++
++
++ /* the location of guard area moves to the beginning of stack frame. */
++ if (AUTO_OFFSET(XEXP (guard_area, 0)))
++ XEXP (XEXP (guard_area, 0), 1)
++ = gen_rtx_CONST_INT (VOIDmode, sweep_frame_offset);
++
++
++ /* Insert prologue rtl instructions. */
++ rtl_prologue (function_first_insn);
++
++ if (! current_function_has_variable_string)
++ {
++ /* Generate argument saving instruction. */
++ copy_args_for_protection ();
++
++#ifndef FRAME_GROWS_DOWNWARD
++ /* If frame grows upward, character arrays for protecting args
++ may copy to the top of the guard variable.
++ So sweep the guard variable again. */
++ sweep_frame_offset = CEIL_ROUND (frame_offset,
++ BIGGEST_ALIGNMENT / BITS_PER_UNIT);
++ sweep_string_variable (guard_area, UNITS_PER_GUARD);
++#endif
++ }
++ /* Variable can't be protected from the overflow of variable length
++ buffer. But variable reordering is still effective against
++ the overflow of fixed size character arrays. */
++ else if (warn_stack_protector)
++ warning ("not protecting variables: it has a variable length buffer");
++#endif
++#ifndef FRAME_GROWS_DOWNWARD
++ if (STARTING_FRAME_OFFSET == 0)
++ {
++ /* This part may be only for alpha. */
++ push_allocated_offset = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
++ assign_stack_local (BLKmode, push_allocated_offset, -1);
++ sweep_frame_offset = frame_offset;
++ sweep_string_variable (const0_rtx, -push_allocated_offset);
++ sweep_frame_offset = AUTO_OFFSET (XEXP (guard_area, 0));
++ }
++#endif
++
++ /* Arrange the order of local variables. */
++ arrange_var_order (blocks);
++
++#ifdef STACK_GROWS_DOWNWARD
++ /* Insert epilogue rtl instructions. */
++ rtl_epilogue (get_last_insn ());
++#endif
++ init_recog_no_volatile ();
++ }
++ else if (current_function_defines_short_string
++ && warn_stack_protector)
++ warning ("not protecting function: buffer is less than %d bytes long",
++ SUSPICIOUS_BUF_SIZE);
++}
++
++/*
++ Search string from arguments and local variables.
++ caller: CALL_FROM_PREPARE_STACK_PROTECTION (0)
++ CALL_FROM_PUSH_FRAME (1)
++*/
++static int
++search_string_from_argsandvars (int caller)
++{
++ tree blocks, parms;
++ int string_p;
++
++ /* Saves a latest search result as a cached infomation. */
++ static tree __latest_search_decl = 0;
++ static int __latest_search_result = FALSE;
++
++ if (__latest_search_decl == current_function_decl)
++ return __latest_search_result;
++ else
++ if (caller == CALL_FROM_PUSH_FRAME)
++ return FALSE;
++
++ __latest_search_decl = current_function_decl;
++ __latest_search_result = TRUE;
++
++ current_function_defines_short_string = FALSE;
++ current_function_has_variable_string = FALSE;
++ current_function_defines_vsized_array = FALSE;
++ may_have_alloca_pointer = FALSE;
++
++ /* Search a string variable from local variables. */
++ blocks = DECL_INITIAL (current_function_decl);
++ string_p = search_string_from_local_vars (blocks);
++
++ if (! current_function_defines_vsized_array
++ && may_have_alloca_pointer
++ && current_function_calls_alloca)
++ {
++ current_function_has_variable_string = TRUE;
++ return TRUE;
++ }
++
++ if (string_p)
++ return TRUE;
++
++#ifdef STACK_GROWS_DOWNWARD
++ /* Search a string variable from arguments. */
++ parms = DECL_ARGUMENTS (current_function_decl);
++
++ for (; parms; parms = TREE_CHAIN (parms))
++ if (DECL_NAME (parms) && TREE_TYPE (parms) != error_mark_node)
++ {
++ if (PARM_PASSED_IN_MEMORY (parms))
++ {
++ string_p = search_string_def (TREE_TYPE(parms));
++ if (string_p)
++ return TRUE;
++ }
++ }
++#endif
++
++ __latest_search_result = FALSE;
++ return FALSE;
++}
++
++
++/* Search string from local variables in the specified scope. */
++static int
++search_string_from_local_vars (tree block)
++{
++ tree types;
++ int found = FALSE;
++
++ while (block && TREE_CODE(block)==BLOCK)
++ {
++ for (types = BLOCK_VARS(block); types; types = TREE_CHAIN(types))
++ {
++ /* Skip the declaration that refers an external variable. */
++ /* name: types.decl.name.identifier.id */
++ if (! DECL_EXTERNAL (types) && ! TREE_STATIC (types)
++ && TREE_CODE (types) == VAR_DECL
++ && ! DECL_ARTIFICIAL (types)
++ && DECL_RTL_SET_P (types)
++ && GET_CODE (DECL_RTL (types)) == MEM
++
++ && search_string_def (TREE_TYPE (types)))
++ {
++ rtx home = DECL_RTL (types);
++
++ if (GET_CODE (home) == MEM
++ && (GET_CODE (XEXP (home, 0)) == MEM
++ || (GET_CODE (XEXP (home, 0)) == REG
++ && XEXP (home, 0) != virtual_stack_vars_rtx
++ && REGNO (XEXP (home, 0)) != HARD_FRAME_POINTER_REGNUM
++ && REGNO (XEXP (home, 0)) != STACK_POINTER_REGNUM
++#if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
++ && REGNO (XEXP (home, 0)) != ARG_POINTER_REGNUM
++#endif
++ )))
++ /* If the value is indirect by memory or by a register
++ that isn't the frame pointer then it means the object is
++ variable-sized and address through
++ that register or stack slot.
++ The protection has no way to hide pointer variables
++ behind the array, so all we can do is staying
++ the order of variables and arguments. */
++ {
++ current_function_has_variable_string = TRUE;
++ }
++
++ /* Found character array. */
++ found = TRUE;
++ }
++ }
++
++ if (search_string_from_local_vars (BLOCK_SUBBLOCKS (block)))
++ {
++ found = TRUE;
++ }
++
++ block = BLOCK_CHAIN (block);
++ }
++
++ return found;
++}
++
++
++/* Search a character array from the specified type tree. */
++int
++search_string_def (tree type)
++{
++ tree tem;
++
++ if (! type)
++ return FALSE;
++
++ switch (TREE_CODE (type))
++ {
++ case ARRAY_TYPE:
++ /* Check if the array is a variable-sized array. */
++ if (TYPE_DOMAIN (type) == 0
++ || (TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != 0
++ && TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) == NOP_EXPR))
++ current_function_defines_vsized_array = TRUE;
++
++ /* Check if the array is related to char array. */
++ if (TYPE_MAIN_VARIANT (TREE_TYPE(type)) == char_type_node
++ || TYPE_MAIN_VARIANT (TREE_TYPE(type)) == signed_char_type_node
++ || TYPE_MAIN_VARIANT (TREE_TYPE(type)) == unsigned_char_type_node)
++ {
++ /* Check if the string is a variable string. */
++ if (TYPE_DOMAIN (type) == 0
++ || (TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != 0
++ && TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) == NOP_EXPR))
++ return TRUE;
++
++ /* Check if the string size is greater than SUSPICIOUS_BUF_SIZE. */
++ if (TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != 0
++ && (TREE_INT_CST_LOW(TYPE_MAX_VALUE(TYPE_DOMAIN(type)))+1
++ >= SUSPICIOUS_BUF_SIZE))
++ return TRUE;
++
++ current_function_defines_short_string = TRUE;
++ }
++
++ /* to protect every functions, sweep any arrays to the frame top. */
++ is_array = TRUE;
++
++ return search_string_def(TREE_TYPE(type));
++
++ case UNION_TYPE:
++ case QUAL_UNION_TYPE:
++ case RECORD_TYPE:
++ /* Check if each field has character arrays. */
++ for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
++ {
++ /* Omit here local type decls until we know how to support them. */
++ if ((TREE_CODE (tem) == TYPE_DECL)
++ || (TREE_CODE (tem) == VAR_DECL && TREE_STATIC (tem)))
++ continue;
++
++ if (search_string_def(TREE_TYPE(tem)))
++ return TRUE;
++ }
++ break;
++
++ case POINTER_TYPE:
++ /* Check if pointer variables, which may be a pointer assigned
++ by alloca function call, are declared. */
++ if (TYPE_MAIN_VARIANT (TREE_TYPE(type)) == char_type_node
++ || TYPE_MAIN_VARIANT (TREE_TYPE(type)) == signed_char_type_node
++ || TYPE_MAIN_VARIANT (TREE_TYPE(type)) == unsigned_char_type_node)
++ may_have_alloca_pointer = TRUE;
++ break;
++
++ case REFERENCE_TYPE:
++ case OFFSET_TYPE:
++ default:
++ break;
++ }
++
++ return FALSE;
++}
++
++
++/* Examine whether the input contains frame pointer addressing. */
++int
++contains_fp (rtx op)
++{
++ enum rtx_code code;
++ rtx x;
++ int i, j;
++ const char *fmt;
++
++ x = op;
++ if (x == 0)
++ return FALSE;
++
++ code = GET_CODE (x);
++
++ switch (code)
++ {
++ case CONST_INT:
++ case CONST_DOUBLE:
++ case CONST:
++ case SYMBOL_REF:
++ case CODE_LABEL:
++ case REG:
++ case ADDRESSOF:
++ return FALSE;
++
++ case MEM:
++ /* This case is not generated at the stack protection.
++ see plus_constant_wide and simplify_plus_minus function. */
++ if (XEXP (x, 0) == virtual_stack_vars_rtx)
++ abort ();
++
++ case PLUS:
++ if (XEXP (x, 0) == virtual_stack_vars_rtx
++ && GET_CODE (XEXP (x, 1)) == CONST_INT)
++ return TRUE;
++
++ default:
++ break;
++ }
++
++ /* Scan all subexpressions. */
++ fmt = GET_RTX_FORMAT (code);
++ for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
++ if (*fmt == 'e')
++ {
++ if (contains_fp (XEXP (x, i)))
++ return TRUE;
++ }
++ else if (*fmt == 'E')
++ for (j = 0; j < XVECLEN (x, i); j++)
++ if (contains_fp (XVECEXP (x, i, j)))
++ return TRUE;
++
++ return FALSE;
++}
++
++
++/* Examine whether the input contains any pointer. */
++static int
++search_pointer_def (tree type)
++{
++ tree tem;
++
++ if (! type)
++ return FALSE;
++
++ switch (TREE_CODE (type))
++ {
++ case UNION_TYPE:
++ case QUAL_UNION_TYPE:
++ case RECORD_TYPE:
++ /* Check if each field has a pointer. */
++ for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
++ {
++ if ((TREE_CODE (tem) == TYPE_DECL)
++ || (TREE_CODE (tem) == VAR_DECL && TREE_STATIC (tem)))
++ continue;
++
++ if (search_pointer_def (TREE_TYPE(tem)))
++ return TRUE;
++ }
++ break;
++
++ case ARRAY_TYPE:
++ return search_pointer_def (TREE_TYPE(type));
++
++ case POINTER_TYPE:
++ case REFERENCE_TYPE:
++ case OFFSET_TYPE:
++ if (TYPE_READONLY (TREE_TYPE (type)))
++ {
++ /* If this pointer contains function pointer,
++ it should be protected. */
++ return search_func_pointer (TREE_TYPE (type));
++ }
++ return TRUE;
++
++ default:
++ break;
++ }
++
++ return FALSE;
++}
++
++
++/* Examine whether the input contains function pointer. */
++static int
++search_func_pointer (tree type)
++{
++ tree tem;
++
++ if (! type)
++ return FALSE;
++
++ switch (TREE_CODE (type))
++ {
++ case UNION_TYPE:
++ case QUAL_UNION_TYPE:
++ case RECORD_TYPE:
++ if (! TREE_VISITED (type))
++ {
++ /* Mark the type as having been visited already. */
++ TREE_VISITED (type) = 1;
++
++ /* Check if each field has a function pointer. */
++ for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
++ {
++ if (TREE_CODE (tem) == FIELD_DECL
++ && search_func_pointer (TREE_TYPE(tem)))
++ {
++ TREE_VISITED (type) = 0;
++ return TRUE;
++ }
++ }
++
++ TREE_VISITED (type) = 0;
++ }
++ break;
++
++ case ARRAY_TYPE:
++ return search_func_pointer (TREE_TYPE(type));
++
++ case POINTER_TYPE:
++ case REFERENCE_TYPE:
++ case OFFSET_TYPE:
++ if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
++ return TRUE;
++ return search_func_pointer (TREE_TYPE(type));
++
++ default:
++ break;
++ }
++
++ return FALSE;
++}
++
++
++/* Check whether the specified rtx contains PLUS rtx with used flag. */
++static int
++check_used_flag (rtx x)
++{
++ register int i, j;
++ register enum rtx_code code;
++ register const char *format_ptr;
++
++ if (x == 0)
++ return FALSE;
++
++ code = GET_CODE (x);
++
++ switch (code)
++ {
++ case REG:
++ case QUEUED:
++ case CONST_INT:
++ case CONST_DOUBLE:
++ case SYMBOL_REF:
++ case CODE_LABEL:
++ case PC:
++ case CC0:
++ return FALSE;
++
++ case PLUS:
++ if (x->used)
++ return TRUE;
++
++ default:
++ break;
++ }
++
++ format_ptr = GET_RTX_FORMAT (code);
++ for (i = 0; i < GET_RTX_LENGTH (code); i++)
++ {
++ switch (*format_ptr++)
++ {
++ case 'e':
++ if (check_used_flag (XEXP (x, i)))
++ return TRUE;
++ break;
++
++ case 'E':
++ for (j = 0; j < XVECLEN (x, i); j++)
++ if (check_used_flag (XVECEXP (x, i, j)))
++ return TRUE;
++ break;
++ }
++ }
++
++ return FALSE;
++}
++
++
++/* Reset used flag of every insns after the spcecified insn. */
++static void
++reset_used_flags_for_insns (rtx insn)
++{
++ int i, j;
++ enum rtx_code code;
++ const char *format_ptr;
++
++ for (; insn; insn = NEXT_INSN (insn))
++ if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
++ || GET_CODE (insn) == CALL_INSN)
++ {
++ code = GET_CODE (insn);
++ insn->used = 0;
++ format_ptr = GET_RTX_FORMAT (code);
++
++ for (i = 0; i < GET_RTX_LENGTH (code); i++)
++ {
++ switch (*format_ptr++)
++ {
++ case 'e':
++ reset_used_flags_of_plus (XEXP (insn, i));
++ break;
++
++ case 'E':
++ for (j = 0; j < XVECLEN (insn, i); j++)
++ reset_used_flags_of_plus (XVECEXP (insn, i, j));
++ break;
++ }
++ }
++ }
++}
++
++
++/* Reset used flag of every variables in the specified block. */
++static void
++reset_used_flags_for_decls (tree block)
++{
++ tree types;
++ rtx home;
++
++ while (block && TREE_CODE(block)==BLOCK)
++ {
++ types = BLOCK_VARS(block);
++
++ for (types= BLOCK_VARS(block); types; types = TREE_CHAIN(types))
++ {
++ /* Skip the declaration that refers an external variable and
++ also skip an global variable. */
++ if (! DECL_EXTERNAL (types))
++ {
++ if (! DECL_RTL_SET_P (types))
++ continue;
++ home = DECL_RTL (types);
++
++ if (GET_CODE (home) == MEM
++ && GET_CODE (XEXP (home, 0)) == PLUS
++ && GET_CODE (XEXP (XEXP (home, 0), 1)) == CONST_INT)
++ {
++ XEXP (home, 0)->used = 0;
++ }
++ }
++ }
++
++ reset_used_flags_for_decls (BLOCK_SUBBLOCKS (block));
++
++ block = BLOCK_CHAIN (block);
++ }
++}
++
++
++/* Reset the used flag of every PLUS rtx derived from the specified rtx. */
++static void
++reset_used_flags_of_plus (rtx x)
++{
++ int i, j;
++ enum rtx_code code;
++ const char *format_ptr;
++
++ if (x == 0)
++ return;
++
++ code = GET_CODE (x);
++
++ switch (code)
++ {
++ /* These types may be freely shared so we needn't do any resetting
++ for them. */
++ case REG:
++ case QUEUED:
++ case CONST_INT:
++ case CONST_DOUBLE:
++ case SYMBOL_REF:
++ case CODE_LABEL:
++ case PC:
++ case CC0:
++ return;
++
++ case INSN:
++ case JUMP_INSN:
++ case CALL_INSN:
++ case NOTE:
++ case LABEL_REF:
++ case BARRIER:
++ /* The chain of insns is not being copied. */
++ return;
++
++ case PLUS:
++ x->used = 0;
++ break;
++
++ case CALL_PLACEHOLDER:
++ reset_used_flags_for_insns (XEXP (x, 0));
++ reset_used_flags_for_insns (XEXP (x, 1));
++ reset_used_flags_for_insns (XEXP (x, 2));
++ break;
++
++ default:
++ break;
++ }
++
++ format_ptr = GET_RTX_FORMAT (code);
++ for (i = 0; i < GET_RTX_LENGTH (code); i++)
++ {
++ switch (*format_ptr++)
++ {
++ case 'e':
++ reset_used_flags_of_plus (XEXP (x, i));
++ break;
++
++ case 'E':
++ for (j = 0; j < XVECLEN (x, i); j++)
++ reset_used_flags_of_plus (XVECEXP (x, i, j));
++ break;
++ }
++ }
++}
++
++
++/* Generate the prologue insns of the protector into the specified insn. */
++static void
++rtl_prologue (rtx insn)
++{
++#if defined(INIT_SECTION_ASM_OP) && !defined(INVOKE__main)
++#undef HAS_INIT_SECTION
++#define HAS_INIT_SECTION
++#endif
++
++ rtx _val;
++
++ for (; insn; insn = NEXT_INSN (insn))
++ if (GET_CODE (insn) == NOTE
++ && NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_BEG)
++ break;
++
++#if !defined (HAS_INIT_SECTION)
++ /* If this function is `main', skip a call to `__main'
++ to run guard instruments after global initializers, etc. */
++ if (DECL_NAME (current_function_decl)
++ && MAIN_NAME_P (DECL_NAME (current_function_decl))
++ && DECL_CONTEXT (current_function_decl) == NULL_TREE)
++ {
++ rtx fbinsn = insn;
++ for (; insn; insn = NEXT_INSN (insn))
++ if (GET_CODE (insn) == NOTE
++ && NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG)
++ break;
++ if (insn == 0)
++ insn = fbinsn;
++ }
++#endif
++
++ /* Mark the next insn of FUNCTION_BEG insn. */
++ prologue_insert_point = NEXT_INSN (insn);
++
++ start_sequence ();
++
++ _guard = gen_rtx_MEM (GUARD_m, gen_rtx_SYMBOL_REF (Pmode, "__guard"));
++ emit_move_insn ( guard_area, _guard);
++
++ _val = get_insns ();
++ end_sequence ();
++
++ emit_insn_before (_val, prologue_insert_point);
++}
++
++
++/* Generate the epilogue insns of the protector into the specified insn. */
++static void
++rtl_epilogue (rtx insn)
++{
++ rtx if_false_label;
++ rtx _val;
++ rtx funcname;
++ tree funcstr;
++ int flag_have_return = FALSE;
++
++ start_sequence ();
++
++#ifdef HAVE_return
++ if (HAVE_return)
++ {
++ rtx insn;
++ return_label = gen_label_rtx ();
++
++ for (insn = prologue_insert_point; insn; insn = NEXT_INSN (insn))
++ if (GET_CODE (insn) == JUMP_INSN
++ && GET_CODE (PATTERN (insn)) == RETURN
++ && GET_MODE (PATTERN (insn)) == VOIDmode)
++ {
++ rtx pat = gen_rtx_SET (VOIDmode,
++ pc_rtx,
++ gen_rtx_LABEL_REF (VOIDmode,
++ return_label));
++ PATTERN (insn) = pat;
++ flag_have_return = TRUE;
++ }
++
++
++ emit_label (return_label);
++ }
++#endif
++
++ /* if (guard_area != _guard) */
++ compare_from_rtx (guard_area, _guard, NE, 0, GUARD_m, NULL_RTX);
++
++ if_false_label = gen_label_rtx (); /* { */
++ emit_jump_insn ( gen_beq(if_false_label));
++
++ /* generate string for the current function name */
++ funcstr = build_string (strlen(current_function_name ())+1,
++ current_function_name ());
++ TREE_TYPE (funcstr) = build_array_type (char_type_node, 0);
++ funcname = output_constant_def (funcstr, 1);
++
++ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__stack_smash_handler"),
++ 0, VOIDmode, 2,
++ XEXP (funcname, 0), Pmode, guard_area, GUARD_m);
++
++ /* generate RTL to return from the current function */
++
++ emit_barrier (); /* } */
++ emit_label (if_false_label);
++
++ /* generate RTL to return from the current function */
++ if (DECL_RTL_SET_P (DECL_RESULT (current_function_decl)))
++ use_return_register ();
++
++#ifdef HAVE_return
++ if (HAVE_return && flag_have_return)
++ {
++ emit_jump_insn (gen_return ());
++ emit_barrier ();
++ }
++#endif
++
++ _val = get_insns ();
++ end_sequence ();
++
++ emit_insn_after (_val, insn);
++}
++
++
++/* For every variable which type is character array, moves its location
++ in the stack frame to the sweep_frame_offset position. */
++static void
++arrange_var_order (tree block)
++{
++ tree types;
++ HOST_WIDE_INT offset;
++
++ while (block && TREE_CODE(block)==BLOCK)
++ {
++ /* arrange the location of character arrays in depth first. */
++ arrange_var_order (BLOCK_SUBBLOCKS (block));
++
++ for (types = BLOCK_VARS (block); types; types = TREE_CHAIN(types))
++ {
++ /* Skip the declaration that refers an external variable. */
++ if (! DECL_EXTERNAL (types) && ! TREE_STATIC (types)
++ && TREE_CODE (types) == VAR_DECL
++ && ! DECL_ARTIFICIAL (types)
++ && DECL_RTL_SET_P (types)
++ && GET_CODE (DECL_RTL (types)) == MEM
++ && GET_MODE (DECL_RTL (types)) == BLKmode
++
++ && (is_array=0,
++ search_string_def (TREE_TYPE (types))
++ || (! current_function_defines_vulnerable_string && is_array)))
++ {
++ rtx home = DECL_RTL (types);
++
++ if (!(GET_CODE (home) == MEM
++ && (GET_CODE (XEXP (home, 0)) == MEM
++ || (GET_CODE (XEXP (home, 0)) == REG
++ && XEXP (home, 0) != virtual_stack_vars_rtx
++ && REGNO (XEXP (home, 0)) != HARD_FRAME_POINTER_REGNUM
++ && REGNO (XEXP (home, 0)) != STACK_POINTER_REGNUM
++#if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
++ && REGNO (XEXP (home, 0)) != ARG_POINTER_REGNUM
++#endif
++ ))))
++ {
++ /* Found a string variable. */
++ HOST_WIDE_INT var_size =
++ ((TREE_INT_CST_LOW (DECL_SIZE (types)) + BITS_PER_UNIT - 1)
++ / BITS_PER_UNIT);
++
++ /* Confirmed it is BLKmode. */
++ int alignment = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
++ var_size = CEIL_ROUND (var_size, alignment);
++
++ /* Skip the variable if it is top of the region
++ specified by sweep_frame_offset. */
++ offset = AUTO_OFFSET (XEXP (DECL_RTL (types), 0));
++ if (offset == sweep_frame_offset - var_size)
++ sweep_frame_offset -= var_size;
++
++ else if (offset < sweep_frame_offset - var_size)
++ sweep_string_variable (DECL_RTL (types), var_size);
++ }
++ }
++ }
++
++ block = BLOCK_CHAIN (block);
++ }
++}
++
++
++/* To protect every pointer argument and move character arrays in the argument,
++ Copy those variables to the top of the stack frame and move the location of
++ character arrays to the posion of sweep_frame_offset. */
++static void
++copy_args_for_protection (void)
++{
++ tree parms = DECL_ARGUMENTS (current_function_decl);
++ rtx temp_rtx;
++
++ parms = DECL_ARGUMENTS (current_function_decl);
++ for (; parms; parms = TREE_CHAIN (parms))
++ if (DECL_NAME (parms) && TREE_TYPE (parms) != error_mark_node)
++ {
++ if (PARM_PASSED_IN_MEMORY (parms) && DECL_NAME (parms))
++ {
++ int string_p;
++ rtx seq;
++
++ string_p = search_string_def (TREE_TYPE(parms));
++
++ /* Check if it is a candidate to move. */
++ if (string_p || search_pointer_def (TREE_TYPE (parms)))
++ {
++ int arg_size
++ = ((TREE_INT_CST_LOW (DECL_SIZE (parms)) + BITS_PER_UNIT - 1)
++ / BITS_PER_UNIT);
++ tree passed_type = DECL_ARG_TYPE (parms);
++ tree nominal_type = TREE_TYPE (parms);
++
++ start_sequence ();
++
++ if (GET_CODE (DECL_RTL (parms)) == REG)
++ {
++ rtx safe = 0;
++
++ change_arg_use_of_insns (prologue_insert_point,
++ DECL_RTL (parms), &safe, 0);
++ if (safe)
++ {
++ /* Generate codes for copying the content. */
++ rtx movinsn = emit_move_insn (safe, DECL_RTL (parms));
++
++ /* Avoid register elimination in gcse.c. */
++ PATTERN (movinsn)->volatil = 1;
++
++ /* Save debugger info. */
++ SET_DECL_RTL (parms, safe);
++ }
++ }
++ else if (GET_CODE (DECL_RTL (parms)) == MEM
++ && GET_CODE (XEXP (DECL_RTL (parms), 0)) == ADDRESSOF)
++ {
++ rtx movinsn;
++ rtx safe = gen_reg_rtx (GET_MODE (DECL_RTL (parms)));
++
++ /* Generate codes for copying the content. */
++ movinsn = emit_move_insn (safe, DECL_INCOMING_RTL (parms));
++ /* Avoid register elimination in gcse.c. */
++ PATTERN (movinsn)->volatil = 1;
++
++ /* Change the addressof information to the newly
++ allocated pseudo register. */
++ emit_move_insn (DECL_RTL (parms), safe);
++
++ /* Save debugger info. */
++ SET_DECL_RTL (parms, safe);
++ }
++
++ /* See if the frontend wants to pass this by invisible
++ reference. */
++ else if (passed_type != nominal_type
++ && POINTER_TYPE_P (passed_type)
++ && TREE_TYPE (passed_type) == nominal_type)
++ {
++ rtx safe = 0, orig = XEXP (DECL_RTL (parms), 0);
++
++ change_arg_use_of_insns (prologue_insert_point,
++ orig, &safe, 0);
++ if (safe)
++ {
++ /* Generate codes for copying the content. */
++ rtx movinsn = emit_move_insn (safe, orig);
++
++ /* Avoid register elimination in gcse.c */
++ PATTERN (movinsn)->volatil = 1;
++
++ /* Save debugger info. */
++ SET_DECL_RTL (parms, safe);
++ }
++ }
++
++ else
++ {
++ /* Declare temporary local variable for parms. */
++ temp_rtx
++ = assign_stack_local (DECL_MODE (parms), arg_size,
++ DECL_MODE (parms) == BLKmode ?
++ -1 : 0);
++
++ MEM_IN_STRUCT_P (temp_rtx)
++ = AGGREGATE_TYPE_P (TREE_TYPE (parms));
++ set_mem_alias_set (temp_rtx, get_alias_set (parms));
++
++ /* Generate codes for copying the content. */
++ store_expr (parms, temp_rtx, 0);
++
++ /* Change the reference for each instructions. */
++ move_arg_location (prologue_insert_point, DECL_RTL (parms),
++ temp_rtx, arg_size);
++
++ /* Change the location of parms variable. */
++ SET_DECL_RTL (parms, temp_rtx);
++ }
++
++ seq = get_insns ();
++ end_sequence ();
++ emit_insn_before (seq, prologue_insert_point);
++
++#ifdef FRAME_GROWS_DOWNWARD
++ /* Process the string argument. */
++ if (string_p && DECL_MODE (parms) == BLKmode)
++ {
++ int alignment = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
++ arg_size = CEIL_ROUND (arg_size, alignment);
++
++ /* Change the reference for each instructions. */
++ sweep_string_variable (DECL_RTL (parms), arg_size);
++ }
++#endif
++ }
++ }
++ }
++}
++
++
++/* Sweep a string variable to the positon of sweep_frame_offset in the
++ stack frame, that is a last position of string variables. */
++static void
++sweep_string_variable (rtx sweep_var, HOST_WIDE_INT var_size)
++{
++ HOST_WIDE_INT sweep_offset;
++
++ switch (GET_CODE (sweep_var))
++ {
++ case MEM:
++ if (GET_CODE (XEXP (sweep_var, 0)) == ADDRESSOF
++ && GET_CODE (XEXP (XEXP (sweep_var, 0), 0)) == REG)
++ return;
++ sweep_offset = AUTO_OFFSET(XEXP (sweep_var, 0));
++ break;
++ case CONST_INT:
++ sweep_offset = INTVAL (sweep_var);
++ break;
++ default:
++ abort ();
++ }
++
++ /* Scan all declarations of variables and fix the offset address of
++ the variable based on the frame pointer. */
++ sweep_string_in_decls (DECL_INITIAL (current_function_decl),
++ sweep_offset, var_size);
++
++ /* Scan all argument variable and fix the offset address based on
++ the frame pointer. */
++ sweep_string_in_args (DECL_ARGUMENTS (current_function_decl),
++ sweep_offset, var_size);
++
++ /* For making room for sweep variable, scan all insns and
++ fix the offset address of the variable that is based on frame pointer. */
++ sweep_string_use_of_insns (function_first_insn, sweep_offset, var_size);
++
++
++ /* Clear all the USED bits in operands of all insns and declarations of
++ local variables. */
++ reset_used_flags_for_decls (DECL_INITIAL (current_function_decl));
++ reset_used_flags_for_insns (function_first_insn);
++
++ sweep_frame_offset -= var_size;
++}
++
++
++
++/* Move an argument to the local variable addressed by frame_offset. */
++static void
++move_arg_location (rtx insn, rtx orig, rtx new, HOST_WIDE_INT var_size)
++{
++ /* For making room for sweep variable, scan all insns and
++ fix the offset address of the variable that is based on frame pointer. */
++ change_arg_use_of_insns (insn, orig, &new, var_size);
++
++
++ /* Clear all the USED bits in operands of all insns and declarations
++ of local variables. */
++ reset_used_flags_for_insns (insn);
++}
++
++
++/* Sweep character arrays declared as local variable. */
++static void
++sweep_string_in_decls (tree block, HOST_WIDE_INT sweep_offset,
++ HOST_WIDE_INT sweep_size)
++{
++ tree types;
++ HOST_WIDE_INT offset;
++ rtx home;
++
++ while (block && TREE_CODE(block)==BLOCK)
++ {
++ for (types = BLOCK_VARS(block); types; types = TREE_CHAIN(types))
++ {
++ /* Skip the declaration that refers an external variable and
++ also skip an global variable. */
++ if (! DECL_EXTERNAL (types) && ! TREE_STATIC (types)) {
++
++ if (! DECL_RTL_SET_P (types))
++ continue;
++
++ home = DECL_RTL (types);
++
++ /* Process for static local variable. */
++ if (GET_CODE (home) == MEM
++ && GET_CODE (XEXP (home, 0)) == SYMBOL_REF)
++ continue;
++
++ if (GET_CODE (home) == MEM
++ && XEXP (home, 0) == virtual_stack_vars_rtx)
++ {
++ offset = 0;
++
++ /* the operand related to the sweep variable. */
++ if (sweep_offset <= offset
++ && offset < sweep_offset + sweep_size)
++ {
++ offset = sweep_frame_offset - sweep_size - sweep_offset;
++
++ XEXP (home, 0) = plus_constant (virtual_stack_vars_rtx,
++ offset);
++ XEXP (home, 0)->used = 1;
++ }
++ else if (sweep_offset <= offset
++ && offset < sweep_frame_offset)
++ {
++ /* the rest of variables under sweep_frame_offset,
++ shift the location. */
++ XEXP (home, 0) = plus_constant (virtual_stack_vars_rtx,
++ -sweep_size);
++ XEXP (home, 0)->used = 1;
++ }
++ }
++
++ if (GET_CODE (home) == MEM
++ && GET_CODE (XEXP (home, 0)) == MEM)
++ {
++ /* Process for dynamically allocated array. */
++ home = XEXP (home, 0);
++ }
++
++ if (GET_CODE (home) == MEM
++ && GET_CODE (XEXP (home, 0)) == PLUS
++ && XEXP (XEXP (home, 0), 0) == virtual_stack_vars_rtx
++ && GET_CODE (XEXP (XEXP (home, 0), 1)) == CONST_INT)
++ {
++ if (! XEXP (home, 0)->used)
++ {
++ offset = AUTO_OFFSET(XEXP (home, 0));
++
++ /* the operand related to the sweep variable. */
++ if (sweep_offset <= offset
++ && offset < sweep_offset + sweep_size)
++ {
++
++ offset
++ += sweep_frame_offset - sweep_size - sweep_offset;
++ XEXP (XEXP (home, 0), 1) = gen_rtx_CONST_INT (VOIDmode,
++ offset);
++
++ /* mark */
++ XEXP (home, 0)->used = 1;
++ }
++ else if (sweep_offset <= offset
++ && offset < sweep_frame_offset)
++ {
++ /* the rest of variables under sweep_frame_offset,
++ so shift the location. */
++
++ XEXP (XEXP (home, 0), 1)
++ = gen_rtx_CONST_INT (VOIDmode, offset - sweep_size);
++
++ /* mark */
++ XEXP (home, 0)->used = 1;
++ }
++ }
++ }
++ }
++ }
++
++ sweep_string_in_decls (BLOCK_SUBBLOCKS (block),
++ sweep_offset, sweep_size);
++
++ block = BLOCK_CHAIN (block);
++ }
++}
++
++
++/* Sweep character arrays declared as argument. */
++static void
++sweep_string_in_args (tree parms, HOST_WIDE_INT sweep_offset,
++ HOST_WIDE_INT sweep_size)
++{
++ rtx home;
++ HOST_WIDE_INT offset;
++
++ for (; parms; parms = TREE_CHAIN (parms))
++ if (DECL_NAME (parms) && TREE_TYPE (parms) != error_mark_node)
++ {
++ if (PARM_PASSED_IN_MEMORY (parms) && DECL_NAME (parms))
++ {
++ home = DECL_INCOMING_RTL (parms);
++
++ if (XEXP (home, 0)->used)
++ continue;
++
++ offset = AUTO_OFFSET(XEXP (home, 0));
++
++ /* the operand related to the sweep variable. */
++ if (AUTO_BASEPTR (XEXP (home, 0)) == virtual_stack_vars_rtx)
++ {
++ if (sweep_offset <= offset
++ && offset < sweep_offset + sweep_size)
++ {
++ offset += sweep_frame_offset - sweep_size - sweep_offset;
++ XEXP (XEXP (home, 0), 1) = gen_rtx_CONST_INT (VOIDmode,
++ offset);
++
++ /* mark */
++ XEXP (home, 0)->used = 1;
++ }
++ else if (sweep_offset <= offset
++ && offset < sweep_frame_offset)
++ {
++ /* the rest of variables under sweep_frame_offset,
++ shift the location. */
++ XEXP (XEXP (home, 0), 1)
++ = gen_rtx_CONST_INT (VOIDmode, offset - sweep_size);
++
++ /* mark */
++ XEXP (home, 0)->used = 1;
++ }
++ }
++ }
++ }
++}
++
++
++/* Set to 1 when the instruction contains virtual registers. */
++static int has_virtual_reg;
++
++/* Sweep the specified character array for every insns. The array starts from
++ the sweep_offset and its size is sweep_size. */
++static void
++sweep_string_use_of_insns (rtx insn, HOST_WIDE_INT sweep_offset,
++ HOST_WIDE_INT sweep_size)
++{
++ for (; insn; insn = NEXT_INSN (insn))
++ if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
++ || GET_CODE (insn) == CALL_INSN)
++ {
++ has_virtual_reg = FALSE;
++ sweep_string_in_operand (insn, &PATTERN (insn),
++ sweep_offset, sweep_size);
++ sweep_string_in_operand (insn, ®_NOTES (insn),
++ sweep_offset, sweep_size);
++ }
++}
++
++
++/* Sweep the specified character array, which starts from the sweep_offset and
++ its size is sweep_size.
++
++ When a pointer is given,
++ if it points the address higher than the array, it stays.
++ if it points the address inside the array, it changes to point inside
++ the sweeped array.
++ if it points the address lower than the array, it shifts higher address by
++ the sweep_size. */
++static void
++sweep_string_in_operand (rtx insn, rtx *loc,
++ HOST_WIDE_INT sweep_offset, HOST_WIDE_INT sweep_size)
++{
++ rtx x = *loc;
++ enum rtx_code code;
++ int i, j, k = 0;
++ HOST_WIDE_INT offset;
++ const char *fmt;
++
++ if (x == 0)
++ return;
++
++ code = GET_CODE (x);
++
++ switch (code)
++ {
++ case CONST_INT:
++ case CONST_DOUBLE:
++ case CONST:
++ case SYMBOL_REF:
++ case CODE_LABEL:
++ case PC:
++ case CC0:
++ case ASM_INPUT:
++ case ADDR_VEC:
++ case ADDR_DIFF_VEC:
++ case RETURN:
++ case ADDRESSOF:
++ return;
++
++ case REG:
++ if (x == virtual_incoming_args_rtx
++ || x == virtual_stack_vars_rtx
++ || x == virtual_stack_dynamic_rtx
++ || x == virtual_outgoing_args_rtx
++ || x == virtual_cfa_rtx)
++ has_virtual_reg = TRUE;
++ return;
++
++ case SET:
++ /*
++ skip setjmp setup insn and setjmp restore insn
++ Example:
++ (set (MEM (reg:SI xx)) (virtual_stack_vars_rtx)))
++ (set (virtual_stack_vars_rtx) (REG))
++ */
++ if (GET_CODE (XEXP (x, 0)) == MEM
++ && XEXP (x, 1) == virtual_stack_vars_rtx)
++ return;
++ if (XEXP (x, 0) == virtual_stack_vars_rtx
++ && GET_CODE (XEXP (x, 1)) == REG)
++ return;
++ break;
++
++ case PLUS:
++ /* Handle typical case of frame register plus constant. */
++ if (XEXP (x, 0) == virtual_stack_vars_rtx
++ && GET_CODE (XEXP (x, 1)) == CONST_INT)
++ {
++ if (x->used)
++ goto single_use_of_virtual_reg;
++
++ offset = AUTO_OFFSET(x);
++
++ /* When arguments grow downward, the virtual incoming
++ args pointer points to the top of the argument block,
++ so block is identified by the pointer - 1.
++ The flag is set at the copy_rtx_and_substitute in integrate.c */
++ if (RTX_INTEGRATED_P (x))
++ k = -1;
++
++ /* the operand related to the sweep variable. */
++ if (sweep_offset <= offset + k
++ && offset + k < sweep_offset + sweep_size)
++ {
++ offset += sweep_frame_offset - sweep_size - sweep_offset;
++
++ XEXP (x, 0) = virtual_stack_vars_rtx;
++ XEXP (x, 1) = gen_rtx_CONST_INT (VOIDmode, offset);
++ x->used = 1;
++ }
++ else if (sweep_offset <= offset + k
++ && offset + k < sweep_frame_offset)
++ {
++ /* the rest of variables under sweep_frame_offset,
++ shift the location. */
++ XEXP (x, 1) = gen_rtx_CONST_INT (VOIDmode, offset - sweep_size);
++ x->used = 1;
++ }
++
++ single_use_of_virtual_reg:
++ if (has_virtual_reg) {
++ /* excerpt from insn_invalid_p in recog.c */
++ int icode = recog_memoized (insn);
++
++ if (icode < 0 && asm_noperands (PATTERN (insn)) < 0)
++ {
++ rtx temp, seq;
++
++ start_sequence ();
++ temp = force_operand (x, NULL_RTX);
++ seq = get_insns ();
++ end_sequence ();
++
++ emit_insn_before (seq, insn);
++ if (! validate_change (insn, loc, temp, 0)
++ && !validate_replace_rtx (x, temp, insn))
++ fatal_insn ("sweep_string_in_operand", insn);
++ }
++ }
++
++ has_virtual_reg = TRUE;
++ return;
++ }
++
++#ifdef FRAME_GROWS_DOWNWARD
++ /* Alert the case of frame register plus constant given by reg. */
++ else if (XEXP (x, 0) == virtual_stack_vars_rtx
++ && GET_CODE (XEXP (x, 1)) == REG)
++ fatal_insn ("sweep_string_in_operand: unknown addressing", insn);
++#endif
++
++ /*
++ process further subtree:
++ Example: (plus:SI (mem/s:SI (plus:SI (reg:SI 17) (const_int 8)))
++ (const_int 5))
++ */
++ break;
++
++ case CALL_PLACEHOLDER:
++ for (i = 0; i < 3; i++)
++ {
++ rtx seq = XEXP (x, i);
++ if (seq)
++ {
++ push_to_sequence (seq);
++ sweep_string_use_of_insns (XEXP (x, i),
++ sweep_offset, sweep_size);
++ XEXP (x, i) = get_insns ();
++ end_sequence ();
++ }
++ }
++ break;
++
++ default:
++ break;
++ }
++
++ /* Scan all subexpressions. */
++ fmt = GET_RTX_FORMAT (code);
++ for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
++ if (*fmt == 'e')
++ {
++ /*
++ virtual_stack_vars_rtx without offset
++ Example:
++ (set (reg:SI xx) (reg:SI 78))
++ (set (reg:SI xx) (MEM (reg:SI 78)))
++ */
++ if (XEXP (x, i) == virtual_stack_vars_rtx)
++ fatal_insn ("sweep_string_in_operand: unknown fp usage", insn);
++ sweep_string_in_operand (insn, &XEXP (x, i), sweep_offset, sweep_size);
++ }
++ else if (*fmt == 'E')
++ for (j = 0; j < XVECLEN (x, i); j++)
++ sweep_string_in_operand (insn, &XVECEXP (x, i, j), sweep_offset, sweep_size);
++}
++
++
++/* Change the use of an argument to the use of the duplicated variable for
++ every insns, The variable is addressed by new rtx. */
++static void
++change_arg_use_of_insns (rtx insn, rtx orig, rtx *new, HOST_WIDE_INT size)
++{
++ for (; insn; insn = NEXT_INSN (insn))
++ if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
++ || GET_CODE (insn) == CALL_INSN)
++ {
++ rtx seq;
++
++ start_sequence ();
++ change_arg_use_in_operand (insn, PATTERN (insn), orig, new, size);
++
++ seq = get_insns ();
++ end_sequence ();
++ emit_insn_before (seq, insn);
++
++ /* load_multiple insn from virtual_incoming_args_rtx have several
++ load insns. If every insn change the load address of arg
++ to frame region, those insns are moved before the PARALLEL insn
++ and remove the PARALLEL insn. */
++ if (GET_CODE (PATTERN (insn)) == PARALLEL
++ && XVECLEN (PATTERN (insn), 0) == 0)
++ delete_insn (insn);
++ }
++}
++
++
++/* Change the use of an argument to the use of the duplicated variable for
++ every rtx derived from the x. */
++static void
++change_arg_use_in_operand (rtx insn, rtx x, rtx orig, rtx *new, HOST_WIDE_INT size)
++{
++ enum rtx_code code;
++ int i, j;
++ HOST_WIDE_INT offset;
++ const char *fmt;
++
++ if (x == 0)
++ return;
++
++ code = GET_CODE (x);
++
++ switch (code)
++ {
++ case CONST_INT:
++ case CONST_DOUBLE:
++ case CONST:
++ case SYMBOL_REF:
++ case CODE_LABEL:
++ case PC:
++ case CC0:
++ case ASM_INPUT:
++ case ADDR_VEC:
++ case ADDR_DIFF_VEC:
++ case RETURN:
++ case REG:
++ case ADDRESSOF:
++ return;
++
++ case MEM:
++ /* Handle special case of MEM (incoming_args). */
++ if (GET_CODE (orig) == MEM
++ && XEXP (x, 0) == virtual_incoming_args_rtx)
++ {
++ offset = 0;
++
++ /* the operand related to the sweep variable. */
++ if (AUTO_OFFSET(XEXP (orig, 0)) <= offset &&
++ offset < AUTO_OFFSET(XEXP (orig, 0)) + size) {
++
++ offset = AUTO_OFFSET(XEXP (*new, 0))
++ + (offset - AUTO_OFFSET(XEXP (orig, 0)));
++
++ XEXP (x, 0) = plus_constant (virtual_stack_vars_rtx, offset);
++ XEXP (x, 0)->used = 1;
++
++ return;
++ }
++ }
++ break;
++
++ case PLUS:
++ /* Handle special case of frame register plus constant. */
++ if (GET_CODE (orig) == MEM
++ && XEXP (x, 0) == virtual_incoming_args_rtx
++ && GET_CODE (XEXP (x, 1)) == CONST_INT
++ && ! x->used)
++ {
++ offset = AUTO_OFFSET(x);
++
++ /* the operand related to the sweep variable. */
++ if (AUTO_OFFSET(XEXP (orig, 0)) <= offset &&
++ offset < AUTO_OFFSET(XEXP (orig, 0)) + size)
++ {
++
++ offset = (AUTO_OFFSET(XEXP (*new, 0))
++ + (offset - AUTO_OFFSET(XEXP (orig, 0))));
++
++ XEXP (x, 0) = virtual_stack_vars_rtx;
++ XEXP (x, 1) = gen_rtx_CONST_INT (VOIDmode, offset);
++ x->used = 1;
++
++ return;
++ }
++
++ /*
++ process further subtree:
++ Example: (plus:SI (mem/s:SI (plus:SI (reg:SI 17) (const_int 8)))
++ (const_int 5))
++ */
++ }
++ break;
++
++ case SET:
++ /* Handle special case of "set (REG or MEM) (incoming_args)".
++ It means that the the address of the 1st argument is stored. */
++ if (GET_CODE (orig) == MEM
++ && XEXP (x, 1) == virtual_incoming_args_rtx)
++ {
++ offset = 0;
++
++ /* the operand related to the sweep variable. */
++ if (AUTO_OFFSET(XEXP (orig, 0)) <= offset &&
++ offset < AUTO_OFFSET(XEXP (orig, 0)) + size)
++ {
++ offset = (AUTO_OFFSET(XEXP (*new, 0))
++ + (offset - AUTO_OFFSET(XEXP (orig, 0))));
++
++ XEXP (x, 1) = force_operand (plus_constant (virtual_stack_vars_rtx,
++ offset), NULL_RTX);
++ XEXP (x, 1)->used = 1;
++
++ return;
++ }
++ }
++ break;
++
++ case CALL_PLACEHOLDER:
++ for (i = 0; i < 3; i++)
++ {
++ rtx seq = XEXP (x, i);
++ if (seq)
++ {
++ push_to_sequence (seq);
++ change_arg_use_of_insns (XEXP (x, i), orig, new, size);
++ XEXP (x, i) = get_insns ();
++ end_sequence ();
++ }
++ }
++ break;
++
++ case PARALLEL:
++ for (j = 0; j < XVECLEN (x, 0); j++)
++ {
++ change_arg_use_in_operand (insn, XVECEXP (x, 0, j), orig, new, size);
++ }
++ if (recog_memoized (insn) < 0)
++ {
++ for (i = 0, j = 0; j < XVECLEN (x, 0); j++)
++ {
++ /* if parallel insn has a insn used virtual_incoming_args_rtx,
++ the insn is removed from this PARALLEL insn. */
++ if (check_used_flag (XVECEXP (x, 0, j)))
++ {
++ emit_insn (XVECEXP (x, 0, j));
++ XVECEXP (x, 0, j) = NULL;
++ }
++ else
++ XVECEXP (x, 0, i++) = XVECEXP (x, 0, j);
++ }
++ PUT_NUM_ELEM (XVEC (x, 0), i);
++ }
++ return;
++
++ default:
++ break;
++ }
++
++ /* Scan all subexpressions. */
++ fmt = GET_RTX_FORMAT (code);
++ for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
++ if (*fmt == 'e')
++ {
++ if (XEXP (x, i) == orig)
++ {
++ if (*new == 0)
++ *new = gen_reg_rtx (GET_MODE (orig));
++ XEXP (x, i) = *new;
++ continue;
++ }
++ change_arg_use_in_operand (insn, XEXP (x, i), orig, new, size);
++ }
++ else if (*fmt == 'E')
++ for (j = 0; j < XVECLEN (x, i); j++)
++ {
++ if (XVECEXP (x, i, j) == orig)
++ {
++ if (*new == 0)
++ *new = gen_reg_rtx (GET_MODE (orig));
++ XVECEXP (x, i, j) = *new;
++ continue;
++ }
++ change_arg_use_in_operand (insn, XVECEXP (x, i, j), orig, new, size);
++ }
++}
++
++
++/* Validate every instructions from the specified instruction.
++
++ The stack protector prohibits to generate machine specific frame addressing
++ for the first rtl generation. The prepare_stack_protection must convert
++ machine independent frame addressing to machine specific frame addressing,
++ so instructions for inline functions, which skip the conversion of
++ the stack protection, validate every instructions. */
++static void
++validate_insns_of_varrefs (rtx insn)
++{
++ rtx next;
++
++ /* Initialize recognition, indicating that volatile is OK. */
++ init_recog ();
++
++ for (; insn; insn = next)
++ {
++ next = NEXT_INSN (insn);
++ if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
++ || GET_CODE (insn) == CALL_INSN)
++ {
++ /* excerpt from insn_invalid_p in recog.c */
++ int icode = recog_memoized (insn);
++
++ if (icode < 0 && asm_noperands (PATTERN (insn)) < 0)
++ validate_operand_of_varrefs (insn, &PATTERN (insn));
++ }
++ }
++
++ init_recog_no_volatile ();
++}
++
++
++/* Validate frame addressing of the rtx and covert it to machine specific one. */
++static void
++validate_operand_of_varrefs (rtx insn, rtx *loc)
++{
++ enum rtx_code code;
++ rtx x, temp, seq;
++ int i, j;
++ const char *fmt;
++
++ x = *loc;
++ if (x == 0)
++ return;
++
++ code = GET_CODE (x);
++
++ switch (code)
++ {
++ case USE:
++ case CONST_INT:
++ case CONST_DOUBLE:
++ case CONST:
++ case SYMBOL_REF:
++ case CODE_LABEL:
++ case PC:
++ case CC0:
++ case ASM_INPUT:
++ case ADDR_VEC:
++ case ADDR_DIFF_VEC:
++ case RETURN:
++ case REG:
++ case ADDRESSOF:
++ return;
++
++ case PLUS:
++ /* validate insn of frame register plus constant. */
++ if (GET_CODE (x) == PLUS
++ && XEXP (x, 0) == virtual_stack_vars_rtx
++ && GET_CODE (XEXP (x, 1)) == CONST_INT)
++ {
++ start_sequence ();
++
++ { /* excerpt from expand_binop in optabs.c */
++ optab binoptab = add_optab;
++ enum machine_mode mode = GET_MODE (x);
++ int icode = (int) binoptab->handlers[(int) mode].insn_code;
++ enum machine_mode mode1 = insn_data[icode].operand[2].mode;
++ rtx pat;
++ rtx xop0 = XEXP (x, 0), xop1 = XEXP (x, 1);
++ temp = gen_reg_rtx (mode);
++
++ /* Now, if insn's predicates don't allow offset operands,
++ put them into pseudo regs. */
++
++ if (! (*insn_data[icode].operand[2].predicate) (xop1, mode1)
++ && mode1 != VOIDmode)
++ xop1 = copy_to_mode_reg (mode1, xop1);
++
++ pat = GEN_FCN (icode) (temp, xop0, xop1);
++ if (pat)
++ emit_insn (pat);
++ else
++ abort (); /* there must be add_optab handler. */
++ }
++ seq = get_insns ();
++ end_sequence ();
++
++ emit_insn_before (seq, insn);
++ if (! validate_change (insn, loc, temp, 0))
++ abort ();
++ return;
++ }
++ break;
++
++
++ case CALL_PLACEHOLDER:
++ for (i = 0; i < 3; i++)
++ {
++ rtx seq = XEXP (x, i);
++ if (seq)
++ {
++ push_to_sequence (seq);
++ validate_insns_of_varrefs (XEXP (x, i));
++ XEXP (x, i) = get_insns ();
++ end_sequence ();
++ }
++ }
++ break;
++
++ default:
++ break;
++ }
++
++ /* Scan all subexpressions. */
++ fmt = GET_RTX_FORMAT (code);
++ for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
++ if (*fmt == 'e')
++ validate_operand_of_varrefs (insn, &XEXP (x, i));
++ else if (*fmt == 'E')
++ for (j = 0; j < XVECLEN (x, i); j++)
++ validate_operand_of_varrefs (insn, &XVECEXP (x, i, j));
++}
++
++
++
++/* Return size that is not allocated for stack frame. It will be allocated
++ to modify the home of pseudo registers called from global_alloc. */
++HOST_WIDE_INT
++get_frame_free_size (void)
++{
++ if (! flag_propolice_protection)
++ return 0;
++
++ return push_allocated_offset - push_frame_offset;
++}
++
++
++/* The following codes are invoked after the instantiation of pseudo registers.
++
++ Reorder local variables to place a peudo register after buffers to avoid
++ the corruption of local variables that could be used to further corrupt
++ arbitrary memory locations. */
++#if !defined(FRAME_GROWS_DOWNWARD) && defined(STACK_GROWS_DOWNWARD)
++static void push_frame (HOST_WIDE_INT, HOST_WIDE_INT);
++static void push_frame_in_decls (tree, HOST_WIDE_INT, HOST_WIDE_INT);
++static void push_frame_in_args (tree, HOST_WIDE_INT, HOST_WIDE_INT);
++static void push_frame_of_insns (rtx, HOST_WIDE_INT, HOST_WIDE_INT);
++static void push_frame_in_operand (rtx, rtx, HOST_WIDE_INT, HOST_WIDE_INT);
++static void push_frame_of_reg_equiv_memory_loc (HOST_WIDE_INT, HOST_WIDE_INT);
++static void push_frame_of_reg_equiv_constant (HOST_WIDE_INT, HOST_WIDE_INT);
++static void reset_used_flags_for_push_frame (void);
++static int check_out_of_frame_access (rtx, HOST_WIDE_INT);
++static int check_out_of_frame_access_in_operand (rtx, HOST_WIDE_INT);
++#endif
++
++
++/* Assign stack local at the stage of register allocater. if a pseudo reg is
++ spilled out from such an allocation, it is allocated on the stack.
++ The protector keep the location be lower stack region than the location of
++ sweeped arrays. */
++rtx
++assign_stack_local_for_pseudo_reg (enum machine_mode mode,
++ HOST_WIDE_INT size, int align)
++{
++#if defined(FRAME_GROWS_DOWNWARD) || !defined(STACK_GROWS_DOWNWARD)
++ return assign_stack_local (mode, size, align);
++#else
++ tree blocks = DECL_INITIAL (current_function_decl);
++ rtx new;
++ HOST_WIDE_INT saved_frame_offset, units_per_push, starting_frame;
++ int first_call_from_purge_addressof, first_call_from_global_alloc;
++
++ if (! flag_propolice_protection
++ || size == 0
++ || ! blocks
++ || current_function_is_inlinable
++ || ! search_string_from_argsandvars (CALL_FROM_PUSH_FRAME)
++ || current_function_contains_functions)
++ return assign_stack_local (mode, size, align);
++
++ first_call_from_purge_addressof = !push_frame_offset && !cse_not_expected;
++ first_call_from_global_alloc = !saved_cse_not_expected && cse_not_expected;
++ saved_cse_not_expected = cse_not_expected;
++
++ starting_frame = ((STARTING_FRAME_OFFSET)
++ ? STARTING_FRAME_OFFSET : BIGGEST_ALIGNMENT / BITS_PER_UNIT);
++ units_per_push = MAX (BIGGEST_ALIGNMENT / BITS_PER_UNIT,
++ GET_MODE_SIZE (mode));
++
++ if (first_call_from_purge_addressof)
++ {
++ push_frame_offset = push_allocated_offset;
++ if (check_out_of_frame_access (get_insns (), starting_frame))
++ {
++ /* After the purge_addressof stage, there may be an instruction which
++ have the pointer less than the starting_frame.
++ if there is an access below frame, push dummy region to seperate
++ the address of instantiated variables. */
++ push_frame (GET_MODE_SIZE (DImode), 0);
++ assign_stack_local (BLKmode, GET_MODE_SIZE (DImode), -1);
++ }
++ }
++
++ if (first_call_from_global_alloc)
++ {
++ push_frame_offset = push_allocated_offset = 0;
++ if (check_out_of_frame_access (get_insns (), starting_frame))
++ {
++ if (STARTING_FRAME_OFFSET)
++ {
++ /* if there is an access below frame, push dummy region
++ to seperate the address of instantiated variables. */
++ push_frame (GET_MODE_SIZE (DImode), 0);
++ assign_stack_local (BLKmode, GET_MODE_SIZE (DImode), -1);
++ }
++ else
++ push_allocated_offset = starting_frame;
++ }
++ }
++
++ saved_frame_offset = frame_offset;
++ frame_offset = push_frame_offset;
++
++ new = assign_stack_local (mode, size, align);
++
++ push_frame_offset = frame_offset;
++ frame_offset = saved_frame_offset;
++
++ if (push_frame_offset > push_allocated_offset)
++ {
++ push_frame (units_per_push,
++ push_allocated_offset + STARTING_FRAME_OFFSET);
++
++ assign_stack_local (BLKmode, units_per_push, -1);
++ push_allocated_offset += units_per_push;
++ }
++
++ /* At the second call from global alloc, alpha push frame and assign
++ a local variable to the top of the stack. */
++ if (first_call_from_global_alloc && STARTING_FRAME_OFFSET == 0)
++ push_frame_offset = push_allocated_offset = 0;
++
++ return new;
++#endif
++}
++
++
++#if !defined(FRAME_GROWS_DOWNWARD) && defined(STACK_GROWS_DOWNWARD)
++
++/* push frame infomation for instantiating pseudo register at the top of stack.
++ This is only for the "frame grows upward", it means FRAME_GROWS_DOWNWARD is
++ not defined.
++
++ It is called by purge_addressof function and global_alloc (or reload)
++ function. */
++static void
++push_frame (HOST_WIDE_INT var_size, HOST_WIDE_INT boundary)
++{
++ reset_used_flags_for_push_frame();
++
++ /* Scan all declarations of variables and fix the offset address of
++ the variable based on the frame pointer. */
++ push_frame_in_decls (DECL_INITIAL (current_function_decl),
++ var_size, boundary);
++
++ /* Scan all argument variable and fix the offset address based on
++ the frame pointer. */
++ push_frame_in_args (DECL_ARGUMENTS (current_function_decl),
++ var_size, boundary);
++
++ /* Scan all operands of all insns and fix the offset address
++ based on the frame pointer. */
++ push_frame_of_insns (get_insns (), var_size, boundary);
++
++ /* Scan all reg_equiv_memory_loc and reg_equiv_constant. */
++ push_frame_of_reg_equiv_memory_loc (var_size, boundary);
++ push_frame_of_reg_equiv_constant (var_size, boundary);
++
++ reset_used_flags_for_push_frame();
++}
++
++
++/* Reset used flag of every insns, reg_equiv_memory_loc,
++ and reg_equiv_constant. */
++static void
++reset_used_flags_for_push_frame(void)
++{
++ int i;
++ extern rtx *reg_equiv_memory_loc;
++ extern rtx *reg_equiv_constant;
++
++ /* Clear all the USED bits in operands of all insns and declarations of
++ local vars. */
++ reset_used_flags_for_decls (DECL_INITIAL (current_function_decl));
++ reset_used_flags_for_insns (get_insns ());
++
++
++ /* The following codes are processed if the push_frame is called from
++ global_alloc (or reload) function. */
++ if (reg_equiv_memory_loc == 0)
++ return;
++
++ for (i=LAST_VIRTUAL_REGISTER+1; i < max_regno; i++)
++ if (reg_equiv_memory_loc[i])
++ {
++ rtx x = reg_equiv_memory_loc[i];
++
++ if (GET_CODE (x) == MEM
++ && GET_CODE (XEXP (x, 0)) == PLUS
++ && AUTO_BASEPTR (XEXP (x, 0)) == frame_pointer_rtx)
++ {
++ /* reset */
++ XEXP (x, 0)->used = 0;
++ }
++ }
++
++
++ if (reg_equiv_constant == 0)
++ return;
++
++ for (i=LAST_VIRTUAL_REGISTER+1; i < max_regno; i++)
++ if (reg_equiv_constant[i])
++ {
++ rtx x = reg_equiv_constant[i];
++
++ if (GET_CODE (x) == PLUS
++ && AUTO_BASEPTR (x) == frame_pointer_rtx)
++ {
++ /* reset */
++ x->used = 0;
++ }
++ }
++}
++
++
++/* Push every variables declared as a local variable and make a room for
++ instantiated register. */
++static void
++push_frame_in_decls (tree block, HOST_WIDE_INT push_size,
++ HOST_WIDE_INT boundary)
++{
++ tree types;
++ HOST_WIDE_INT offset;
++ rtx home;
++
++ while (block && TREE_CODE(block)==BLOCK)
++ {
++ for (types = BLOCK_VARS(block); types; types = TREE_CHAIN(types))
++ {
++ /* Skip the declaration that refers an external variable and
++ also skip an global variable. */
++ if (! DECL_EXTERNAL (types) && ! TREE_STATIC (types))
++ {
++ if (! DECL_RTL_SET_P (types))
++ continue;
++
++ home = DECL_RTL (types);
++
++ /* Process for static local variable. */
++ if (GET_CODE (home) == MEM
++ && GET_CODE (XEXP (home, 0)) == SYMBOL_REF)
++ continue;
++
++ if (GET_CODE (home) == MEM
++ && GET_CODE (XEXP (home, 0)) == REG)
++ {
++ if (XEXP (home, 0) != frame_pointer_rtx
++ || boundary != 0)
++ continue;
++
++ XEXP (home, 0) = plus_constant (frame_pointer_rtx,
++ push_size);
++
++ /* mark */
++ XEXP (home, 0)->used = 1;
++ }
++
++ if (GET_CODE (home) == MEM
++ && GET_CODE (XEXP (home, 0)) == MEM)
++ {
++ /* Process for dynamically allocated array. */
++ home = XEXP (home, 0);
++ }
++
++ if (GET_CODE (home) == MEM
++ && GET_CODE (XEXP (home, 0)) == PLUS
++ && GET_CODE (XEXP (XEXP (home, 0), 1)) == CONST_INT)
++ {
++ offset = AUTO_OFFSET(XEXP (home, 0));
++
++ if (! XEXP (home, 0)->used
++ && offset >= boundary)
++ {
++ offset += push_size;
++ XEXP (XEXP (home, 0), 1)
++ = gen_rtx_CONST_INT (VOIDmode, offset);
++
++ /* mark */
++ XEXP (home, 0)->used = 1;
++ }
++ }
++ }
++ }
++
++ push_frame_in_decls (BLOCK_SUBBLOCKS (block), push_size, boundary);
++ block = BLOCK_CHAIN (block);
++ }
++}
++
++
++/* Push every variables declared as an argument and make a room for
++ instantiated register. */
++static void
++push_frame_in_args (tree parms, HOST_WIDE_INT push_size,
++ HOST_WIDE_INT boundary)
++{
++ rtx home;
++ HOST_WIDE_INT offset;
++
++ for (; parms; parms = TREE_CHAIN (parms))
++ if (DECL_NAME (parms) && TREE_TYPE (parms) != error_mark_node)
++ {
++ if (PARM_PASSED_IN_MEMORY (parms))
++ {
++ home = DECL_INCOMING_RTL (parms);
++ offset = AUTO_OFFSET(XEXP (home, 0));
++
++ if (XEXP (home, 0)->used || offset < boundary)
++ continue;
++
++ /* the operand related to the sweep variable. */
++ if (AUTO_BASEPTR (XEXP (home, 0)) == frame_pointer_rtx)
++ {
++ if (XEXP (home, 0) == frame_pointer_rtx)
++ XEXP (home, 0) = plus_constant (frame_pointer_rtx,
++ push_size);
++ else {
++ offset += push_size;
++ XEXP (XEXP (home, 0), 1) = gen_rtx_CONST_INT (VOIDmode,
++ offset);
++ }
++
++ /* mark */
++ XEXP (home, 0)->used = 1;
++ }
++ }
++ }
++}
++
++
++/* Set to 1 when the instruction has the reference to be pushed. */
++static int insn_pushed;
++
++/* Tables of equivalent registers with frame pointer. */
++static int *fp_equiv = 0;
++
++
++/* Push the frame region to make a room for allocated local variable. */
++static void
++push_frame_of_insns (rtx insn, HOST_WIDE_INT push_size, HOST_WIDE_INT boundary)
++{
++ /* init fp_equiv */
++ fp_equiv = (int *) xcalloc (max_reg_num (), sizeof (int));
++
++ for (; insn; insn = NEXT_INSN (insn))
++ if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
++ || GET_CODE (insn) == CALL_INSN)
++ {
++ rtx last;
++
++ insn_pushed = FALSE;
++
++ /* Push frame in INSN operation. */
++ push_frame_in_operand (insn, PATTERN (insn), push_size, boundary);
++
++ /* Push frame in NOTE. */
++ push_frame_in_operand (insn, REG_NOTES (insn), push_size, boundary);
++
++ /* Push frame in CALL EXPR_LIST. */
++ if (GET_CODE (insn) == CALL_INSN)
++ push_frame_in_operand (insn, CALL_INSN_FUNCTION_USAGE (insn),
++ push_size, boundary);
++
++ /* Pushed frame addressing style may not be machine specific one.
++ so the instruction should be converted to use the machine specific
++ frame addressing. */
++ if (insn_pushed
++ && (last = try_split (PATTERN (insn), insn, 1)) != insn)
++ {
++ rtx first = NEXT_INSN (insn);
++ rtx trial = NEXT_INSN (first);
++ rtx pattern = PATTERN (trial);
++ rtx set;
++
++ /* Update REG_EQUIV info to the first splitted insn. */
++ if ((set = single_set (insn))
++ && find_reg_note (insn, REG_EQUIV, SET_SRC (set))
++ && GET_CODE (PATTERN (first)) == SET)
++ {
++ REG_NOTES (first)
++ = gen_rtx_EXPR_LIST (REG_EQUIV,
++ SET_SRC (PATTERN (first)),
++ REG_NOTES (first));
++ }
++
++ /* copy the first insn of splitted insns to the original insn and
++ delete the first insn,
++ because the original insn is pointed from records:
++ insn_chain, reg_equiv_init, used for global_alloc. */
++ if (cse_not_expected)
++ {
++ add_insn_before (insn, first);
++
++ /* Copy the various flags, and other information. */
++ memcpy (insn, first, sizeof (struct rtx_def) - sizeof (rtunion));
++ PATTERN (insn) = PATTERN (first);
++ INSN_CODE (insn) = INSN_CODE (first);
++ LOG_LINKS (insn) = LOG_LINKS (first);
++ REG_NOTES (insn) = REG_NOTES (first);
++
++ /* then remove the first insn of splitted insns. */
++ remove_insn (first);
++ INSN_DELETED_P (first) = 1;
++ }
++
++ if (GET_CODE (pattern) == SET
++ && GET_CODE (XEXP (pattern, 0)) == REG
++ && GET_CODE (XEXP (pattern, 1)) == PLUS
++ && XEXP (pattern, 0) == XEXP (XEXP (pattern, 1), 0)
++ && GET_CODE (XEXP (XEXP (pattern, 1), 1)) == CONST_INT)
++ {
++ rtx offset = XEXP (XEXP (pattern, 1), 1);
++ fp_equiv[REGNO (XEXP (pattern, 0))] = INTVAL (offset);
++
++ delete_insn (trial);
++ }
++
++ insn = last;
++ }
++ }
++
++ /* Clean up. */
++ free (fp_equiv);
++}
++
++
++/* Push the frame region by changing the operand that points the frame. */
++static void
++push_frame_in_operand (rtx insn, rtx orig,
++ HOST_WIDE_INT push_size, HOST_WIDE_INT boundary)
++{
++ rtx x = orig;
++ enum rtx_code code;
++ int i, j;
++ HOST_WIDE_INT offset;
++ const char *fmt;
++
++ if (x == 0)
++ return;
++
++ code = GET_CODE (x);
++
++ switch (code)
++ {
++ case CONST_INT:
++ case CONST_DOUBLE:
++ case CONST:
++ case SYMBOL_REF:
++ case CODE_LABEL:
++ case PC:
++ case CC0:
++ case ASM_INPUT:
++ case ADDR_VEC:
++ case ADDR_DIFF_VEC:
++ case RETURN:
++ case REG:
++ case ADDRESSOF:
++ case USE:
++ return;
++
++ case SET:
++ /*
++ Skip setjmp setup insn and setjmp restore insn
++ alpha case:
++ (set (MEM (reg:SI xx)) (frame_pointer_rtx)))
++ (set (frame_pointer_rtx) (REG))
++ */
++ if (GET_CODE (XEXP (x, 0)) == MEM
++ && XEXP (x, 1) == frame_pointer_rtx)
++ return;
++ if (XEXP (x, 0) == frame_pointer_rtx
++ && GET_CODE (XEXP (x, 1)) == REG)
++ return;
++
++ /*
++ powerpc case: restores setjmp address
++ (set (frame_pointer_rtx) (plus frame_pointer_rtx const_int -n))
++ or
++ (set (reg) (plus frame_pointer_rtx const_int -n))
++ (set (frame_pointer_rtx) (reg))
++ */
++ if (GET_CODE (XEXP (x, 0)) == REG
++ && GET_CODE (XEXP (x, 1)) == PLUS
++ && XEXP (XEXP (x, 1), 0) == frame_pointer_rtx
++ && GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT
++ && INTVAL (XEXP (XEXP (x, 1), 1)) < 0)
++ {
++ x = XEXP (x, 1);
++ offset = AUTO_OFFSET(x);
++ if (x->used || -offset < boundary)
++ return;
++
++ XEXP (x, 1) = gen_rtx_CONST_INT (VOIDmode, offset - push_size);
++ x->used = 1; insn_pushed = TRUE;
++ return;
++ }
++
++ /* Reset fp_equiv register. */
++ else if (GET_CODE (XEXP (x, 0)) == REG
++ && fp_equiv[REGNO (XEXP (x, 0))])
++ fp_equiv[REGNO (XEXP (x, 0))] = 0;
++
++ /* Propagete fp_equiv register. */
++ else if (GET_CODE (XEXP (x, 0)) == REG
++ && GET_CODE (XEXP (x, 1)) == REG
++ && fp_equiv[REGNO (XEXP (x, 1))])
++ if (REGNO (XEXP (x, 0)) <= LAST_VIRTUAL_REGISTER
++ || reg_renumber[REGNO (XEXP (x, 0))] > 0)
++ fp_equiv[REGNO (XEXP (x, 0))] = fp_equiv[REGNO (XEXP (x, 1))];
++ break;
++
++ case MEM:
++ if (XEXP (x, 0) == frame_pointer_rtx
++ && boundary == 0)
++ {
++ XEXP (x, 0) = plus_constant (frame_pointer_rtx, push_size);
++ XEXP (x, 0)->used = 1; insn_pushed = TRUE;
++ return;
++ }
++ break;
++
++ case PLUS:
++ /* Handle special case of frame register plus constant. */
++ if (GET_CODE (XEXP (x, 1)) == CONST_INT
++ && XEXP (x, 0) == frame_pointer_rtx)
++ {
++ offset = AUTO_OFFSET(x);
++
++ if (x->used || offset < boundary)
++ return;
++
++ XEXP (x, 1) = gen_rtx_CONST_INT (VOIDmode, offset + push_size);
++ x->used = 1; insn_pushed = TRUE;
++
++ return;
++ }
++ /*
++ Handle alpha case:
++ (plus:SI (subreg:SI (reg:DI 63 FP) 0) (const_int 64 [0x40]))
++ */
++ if (GET_CODE (XEXP (x, 1)) == CONST_INT
++ && GET_CODE (XEXP (x, 0)) == SUBREG
++ && SUBREG_REG (XEXP (x, 0)) == frame_pointer_rtx)
++ {
++ offset = AUTO_OFFSET(x);
++
++ if (x->used || offset < boundary)
++ return;
++
++ XEXP (x, 1) = gen_rtx_CONST_INT (VOIDmode, offset + push_size);
++ x->used = 1; insn_pushed = TRUE;
++
++ return;
++ }
++ /*
++ Handle powerpc case:
++ (set (reg x) (plus fp const))
++ (set (.....) (... (plus (reg x) (const B))))
++ */
++ else if (GET_CODE (XEXP (x, 1)) == CONST_INT
++ && GET_CODE (XEXP (x, 0)) == REG
++ && fp_equiv[REGNO (XEXP (x, 0))])
++ {
++ offset = AUTO_OFFSET(x);
++
++ if (x->used)
++ return;
++
++ offset += fp_equiv[REGNO (XEXP (x, 0))];
++
++ XEXP (x, 1) = gen_rtx_CONST_INT (VOIDmode, offset);
++ x->used = 1; insn_pushed = TRUE;
++
++ return;
++ }
++ /*
++ Handle special case of frame register plus reg (constant).
++ (set (reg x) (const B))
++ (set (....) (...(plus fp (reg x))))
++ */
++ else if (XEXP (x, 0) == frame_pointer_rtx
++ && GET_CODE (XEXP (x, 1)) == REG
++ && PREV_INSN (insn)
++ && PATTERN (PREV_INSN (insn))
++ && SET_DEST (PATTERN (PREV_INSN (insn))) == XEXP (x, 1)
++ && GET_CODE (SET_SRC (PATTERN (PREV_INSN (insn)))) == CONST_INT)
++ {
++ offset = INTVAL (SET_SRC (PATTERN (PREV_INSN (insn))));
++
++ if (x->used || offset < boundary)
++ return;
++
++ SET_SRC (PATTERN (PREV_INSN (insn)))
++ = gen_rtx_CONST_INT (VOIDmode, offset + push_size);
++ x->used = 1;
++ XEXP (x, 1)->used = 1;
++
++ return;
++ }
++ /*
++ Handle special case of frame register plus reg (used).
++ The register already have a pushed offset, just mark this frame
++ addressing.
++ */
++ else if (XEXP (x, 0) == frame_pointer_rtx
++ && XEXP (x, 1)->used)
++ {
++ x->used = 1;
++ return;
++ }
++ /*
++ Process further subtree:
++ Example: (plus:SI (mem/s:SI (plus:SI (FP) (const_int 8)))
++ (const_int 5))
++ */
++ break;
++
++ case CALL_PLACEHOLDER:
++ push_frame_of_insns (XEXP (x, 0), push_size, boundary);
++ push_frame_of_insns (XEXP (x, 1), push_size, boundary);
++ push_frame_of_insns (XEXP (x, 2), push_size, boundary);
++ break;
++
++ default:
++ break;
++ }
++
++ /* Scan all subexpressions. */
++ fmt = GET_RTX_FORMAT (code);
++ for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
++ if (*fmt == 'e')
++ {
++ if (XEXP (x, i) == frame_pointer_rtx && boundary == 0)
++ fatal_insn ("push_frame_in_operand", insn);
++ push_frame_in_operand (insn, XEXP (x, i), push_size, boundary);
++ }
++ else if (*fmt == 'E')
++ for (j = 0; j < XVECLEN (x, i); j++)
++ push_frame_in_operand (insn, XVECEXP (x, i, j), push_size, boundary);
++}
++
++
++/* Change the location pointed in reg_equiv_memory_loc. */
++static void
++push_frame_of_reg_equiv_memory_loc (HOST_WIDE_INT push_size,
++ HOST_WIDE_INT boundary)
++{
++ int i;
++ extern rtx *reg_equiv_memory_loc;
++
++ /* This function is processed if the push_frame is called from
++ global_alloc (or reload) function. */
++ if (reg_equiv_memory_loc == 0)
++ return;
++
++ for (i=LAST_VIRTUAL_REGISTER+1; i < max_regno; i++)
++ if (reg_equiv_memory_loc[i])
++ {
++ rtx x = reg_equiv_memory_loc[i];
++ int offset;
++
++ if (GET_CODE (x) == MEM
++ && GET_CODE (XEXP (x, 0)) == PLUS
++ && XEXP (XEXP (x, 0), 0) == frame_pointer_rtx)
++ {
++ offset = AUTO_OFFSET(XEXP (x, 0));
++
++ if (! XEXP (x, 0)->used
++ && offset >= boundary)
++ {
++ offset += push_size;
++ XEXP (XEXP (x, 0), 1) = gen_rtx_CONST_INT (VOIDmode, offset);
++
++ /* mark */
++ XEXP (x, 0)->used = 1;
++ }
++ }
++ else if (GET_CODE (x) == MEM
++ && XEXP (x, 0) == frame_pointer_rtx
++ && boundary == 0)
++ {
++ XEXP (x, 0) = plus_constant (frame_pointer_rtx, push_size);
++ XEXP (x, 0)->used = 1; insn_pushed = TRUE;
++ }
++ }
++}
++
++
++/* Change the location pointed in reg_equiv_constant. */
++static void
++push_frame_of_reg_equiv_constant (HOST_WIDE_INT push_size,
++ HOST_WIDE_INT boundary)
++{
++ int i;
++ extern rtx *reg_equiv_constant;
++
++ /* This function is processed if the push_frame is called from
++ global_alloc (or reload) function. */
++ if (reg_equiv_constant == 0)
++ return;
++
++ for (i = LAST_VIRTUAL_REGISTER + 1; i < max_regno; i++)
++ if (reg_equiv_constant[i])
++ {
++ rtx x = reg_equiv_constant[i];
++ int offset;
++
++ if (GET_CODE (x) == PLUS
++ && XEXP (x, 0) == frame_pointer_rtx)
++ {
++ offset = AUTO_OFFSET(x);
++
++ if (! x->used
++ && offset >= boundary)
++ {
++ offset += push_size;
++ XEXP (x, 1) = gen_rtx_CONST_INT (VOIDmode, offset);
++
++ /* mark */
++ x->used = 1;
++ }
++ }
++ else if (x == frame_pointer_rtx
++ && boundary == 0)
++ {
++ reg_equiv_constant[i]
++ = plus_constant (frame_pointer_rtx, push_size);
++ reg_equiv_constant[i]->used = 1; insn_pushed = TRUE;
++ }
++ }
++}
++
++
++/* Check every instructions if insn's memory reference is out of frame. */
++static int
++check_out_of_frame_access (rtx insn, HOST_WIDE_INT boundary)
++{
++ for (; insn; insn = NEXT_INSN (insn))
++ if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
++ || GET_CODE (insn) == CALL_INSN)
++ {
++ if (check_out_of_frame_access_in_operand (PATTERN (insn), boundary))
++ return TRUE;
++ }
++ return FALSE;
++}
++
++
++/* Check every operands if the reference is out of frame. */
++static int
++check_out_of_frame_access_in_operand (rtx orig, HOST_WIDE_INT boundary)
++{
++ rtx x = orig;
++ enum rtx_code code;
++ int i, j;
++ const char *fmt;
++
++ if (x == 0)
++ return FALSE;
++
++ code = GET_CODE (x);
++
++ switch (code)
++ {
++ case CONST_INT:
++ case CONST_DOUBLE:
++ case CONST:
++ case SYMBOL_REF:
++ case CODE_LABEL:
++ case PC:
++ case CC0:
++ case ASM_INPUT:
++ case ADDR_VEC:
++ case ADDR_DIFF_VEC:
++ case RETURN:
++ case REG:
++ case ADDRESSOF:
++ return FALSE;
++
++ case MEM:
++ if (XEXP (x, 0) == frame_pointer_rtx)
++ if (0 < boundary)
++ return TRUE;
++ break;
++
++ case PLUS:
++ /* Handle special case of frame register plus constant. */
++ if (GET_CODE (XEXP (x, 1)) == CONST_INT
++ && XEXP (x, 0) == frame_pointer_rtx)
++ {
++ if (0 <= AUTO_OFFSET(x)
++ && AUTO_OFFSET(x) < boundary)
++ return TRUE;
++ return FALSE;
++ }
++ /*
++ Process further subtree:
++ Example: (plus:SI (mem/s:SI (plus:SI (reg:SI 17) (const_int 8)))
++ (const_int 5))
++ */
++ break;
++
++ case CALL_PLACEHOLDER:
++ if (check_out_of_frame_access (XEXP (x, 0), boundary))
++ return TRUE;
++ if (check_out_of_frame_access (XEXP (x, 1), boundary))
++ return TRUE;
++ if (check_out_of_frame_access (XEXP (x, 2), boundary))
++ return TRUE;
++ break;
++
++ default:
++ break;
++ }
++
++ /* Scan all subexpressions. */
++ fmt = GET_RTX_FORMAT (code);
++ for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
++ if (*fmt == 'e')
++ {
++ if (check_out_of_frame_access_in_operand (XEXP (x, i), boundary))
++ return TRUE;
++ }
++ else if (*fmt == 'E')
++ for (j = 0; j < XVECLEN (x, i); j++)
++ if (check_out_of_frame_access_in_operand (XVECEXP (x, i, j), boundary))
++ return TRUE;
++
++ return FALSE;
++}
++#endif
+diff -uNr gcc-3.4.3.orig/gcc/protector.h gcc-3.4.3/gcc/protector.h
+--- gcc-3.4.3.orig/gcc/protector.h 1970-01-01 01:00:00.000000000 +0100
++++ gcc-3.4.3/gcc/protector.h 2004-01-20 03:01:39.000000000 +0100
+@@ -0,0 +1,55 @@
++/* RTL buffer overflow protection function for GNU C compiler
++ Copyright (C) 2003 Free Software Foundation, Inc.
++
++This file is part of GCC.
++
++GCC is free software; you can redistribute it and/or modify it under
++the terms of the GNU General Public License as published by the Free
++Software Foundation; either version 2, or (at your option) any later
++version.
++
++GCC is distributed in the hope that it will be useful, but WITHOUT ANY
++WARRANTY; without even the implied warranty of MERCHANTABILITY or
++FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
++for more details.
++
++You should have received a copy of the GNU General Public License
++along with GCC; see the file COPYING. If not, write to the Free
++Software Foundation, 59 Temple Place - Suite 330, Boston, MA
++02111-1307, USA. */
++
++
++/* Declare GUARD variable. */
++#define GUARD_m Pmode
++#define UNITS_PER_GUARD \
++ MAX(BIGGEST_ALIGNMENT / BITS_PER_UNIT, GET_MODE_SIZE (GUARD_m))
++
++#ifndef L_stack_smash_handler
++
++/* Insert a guard variable before a character buffer and change the order
++ of pointer variables, character buffers and pointer arguments. */
++
++extern void prepare_stack_protection (int);
++
++#ifdef TREE_CODE
++/* Search a character array from the specified type tree. */
++
++extern int search_string_def (tree);
++#endif
++
++/* Examine whether the input contains frame pointer addressing. */
++
++extern int contains_fp (rtx);
++
++/* Return size that is not allocated for stack frame. It will be allocated
++ to modify the home of pseudo registers called from global_alloc. */
++
++extern HOST_WIDE_INT get_frame_free_size (void);
++
++/* Allocate a local variable in the stack area before character buffers
++ to avoid the corruption of it. */
++
++extern rtx assign_stack_local_for_pseudo_reg (enum machine_mode,
++ HOST_WIDE_INT, int);
++
++#endif
+diff -uNr gcc-3.4.3.orig/gcc/reload1.c gcc-3.4.3/gcc/reload1.c
+--- gcc-3.4.3.orig/gcc/reload1.c 2004-05-02 14:37:17.000000000 +0200
++++ gcc-3.4.3/gcc/reload1.c 2004-11-24 18:35:31.812641048 +0100
+@@ -43,6 +43,7 @@
+ #include "toplev.h"
+ #include "except.h"
+ #include "tree.h"
++#include "protector.h"
+
+ /* This file contains the reload pass of the compiler, which is
+ run after register allocation has been done. It checks that
+@@ -891,7 +892,7 @@
+ if (cfun->stack_alignment_needed)
+ assign_stack_local (BLKmode, 0, cfun->stack_alignment_needed);
+
+- starting_frame_size = get_frame_size ();
++ starting_frame_size = get_frame_size () - get_frame_free_size ();
+
+ set_initial_elim_offsets ();
+ set_initial_label_offsets ();
+@@ -955,7 +956,7 @@
+ setup_save_areas ();
+
+ /* If we allocated another stack slot, redo elimination bookkeeping. */
+- if (starting_frame_size != get_frame_size ())
++ if (starting_frame_size != get_frame_size () - get_frame_free_size ())
+ continue;
+
+ if (caller_save_needed)
+@@ -974,7 +975,7 @@
+
+ /* If we allocated any new memory locations, make another pass
+ since it might have changed elimination offsets. */
+- if (starting_frame_size != get_frame_size ())
++ if (starting_frame_size != get_frame_size () - get_frame_free_size ())
+ something_changed = 1;
+
+ {
+@@ -1066,11 +1067,11 @@
+ if (insns_need_reload != 0 || something_needs_elimination
+ || something_needs_operands_changed)
+ {
+- HOST_WIDE_INT old_frame_size = get_frame_size ();
++ HOST_WIDE_INT old_frame_size = get_frame_size () - get_frame_free_size ();
+
+ reload_as_needed (global);
+
+- if (old_frame_size != get_frame_size ())
++ if (old_frame_size != get_frame_size () - get_frame_free_size ())
+ abort ();
+
+ if (num_eliminable)
+@@ -1957,8 +1958,10 @@
+ inherent space, and no less total space, then the previous slot. */
+ if (from_reg == -1)
+ {
+- /* No known place to spill from => no slot to reuse. */
+- x = assign_stack_local (GET_MODE (regno_reg_rtx[i]), total_size,
++ /* No known place to spill from => no slot to reuse.
++ For the stack protection, an allocated slot should be placed in
++ the safe region from the stack smaching attack. */
++ x = assign_stack_local_for_pseudo_reg (GET_MODE (regno_reg_rtx[i]), total_size,
+ inherent_size == total_size ? 0 : -1);
+ if (BYTES_BIG_ENDIAN)
+ /* Cancel the big-endian correction done in assign_stack_local.
+diff -uNr gcc-3.4.3.orig/gcc/rtl.h gcc-3.4.3/gcc/rtl.h
+--- gcc-3.4.3.orig/gcc/rtl.h 2004-10-13 01:35:32.000000000 +0200
++++ gcc-3.4.3/gcc/rtl.h 2004-11-24 18:35:31.830638312 +0100
+@@ -473,6 +473,18 @@
+ __FUNCTION__); \
+ _rtx; })
+
++#define RTL_FLAG_CHECK9(NAME, RTX, C1, C2, C3, C4, C5, C6, C7, C8, C9) \
++ __extension__ \
++({ rtx const _rtx = (RTX); \
++ if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2 \
++ && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4 \
++ && GET_CODE(_rtx) != C5 && GET_CODE(_rtx) != C6 \
++ && GET_CODE(_rtx) != C7 && GET_CODE(_rtx) != C8 \
++ && GET_CODE(_rtx) != C9) \
++ rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
++ __FUNCTION__); \
++ _rtx; })
++
+ extern void rtl_check_failed_flag (const char *, rtx, const char *,
+ int, const char *)
+ ATTRIBUTE_NORETURN
+@@ -488,6 +500,7 @@
+ #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) (RTX)
+ #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) (RTX)
+ #define RTL_FLAG_CHECK8(NAME, RTX, C1, C2, C3, C4, C5, C6, C7, C8) (RTX)
++#define RTL_FLAG_CHECK9(NAME, RTX, C1, C2, C3, C4, C5, C6, C7, C8, C9) (RTX)
+ #endif
+
+ #define CLEAR_RTX_FLAGS(RTX) \
+@@ -583,9 +596,9 @@
+ #define LOG_LINKS(INSN) XEXP(INSN, 7)
+
+ #define RTX_INTEGRATED_P(RTX) \
+- (RTL_FLAG_CHECK8("RTX_INTEGRATED_P", (RTX), INSN, CALL_INSN, \
++ (RTL_FLAG_CHECK9("RTX_INTEGRATED_P", (RTX), INSN, CALL_INSN, \
+ JUMP_INSN, INSN_LIST, BARRIER, CODE_LABEL, CONST, \
+- NOTE)->integrated)
++ PLUS, NOTE)->integrated)
+ #define RTX_UNCHANGING_P(RTX) \
+ (RTL_FLAG_CHECK3("RTX_UNCHANGING_P", (RTX), REG, MEM, CONCAT)->unchanging)
+ #define RTX_FRAME_RELATED_P(RTX) \
+@@ -1125,6 +1138,10 @@
+ (RTL_FLAG_CHECK3("MEM_VOLATILE_P", (RTX), MEM, ASM_OPERANDS, \
+ ASM_INPUT)->volatil)
+
++/* 1 if RTX is an SET rtx that is not eliminated for the stack protection. */
++#define SET_VOLATILE_P(RTX) \
++ (RTL_FLAG_CHECK1("SET_VOLATILE_P", (RTX), SET)->volatil)
++
+ /* 1 if RTX is a mem that refers to an aggregate, either to the
+ aggregate itself of to a field of the aggregate. If zero, RTX may
+ or may not be such a reference. */
+diff -uNr gcc-3.4.3.orig/gcc/simplify-rtx.c gcc-3.4.3/gcc/simplify-rtx.c
+--- gcc-3.4.3.orig/gcc/simplify-rtx.c 2004-10-10 23:53:35.000000000 +0200
++++ gcc-3.4.3/gcc/simplify-rtx.c 2004-11-24 18:35:31.858634056 +0100
+@@ -2287,6 +2287,7 @@
+ int n_ops = 2, input_ops = 2, input_consts = 0, n_consts;
+ int first, changed;
+ int i, j;
++ HOST_WIDE_INT fp_offset = 0;
+
+ memset (ops, 0, sizeof ops);
+
+@@ -2312,6 +2313,10 @@
+ switch (this_code)
+ {
+ case PLUS:
++ if (flag_propolice_protection
++ && XEXP (this_op, 0) == virtual_stack_vars_rtx
++ && GET_CODE (XEXP (this_op, 1)) == CONST_INT)
++ fp_offset = INTVAL (XEXP (this_op, 1));
+ case MINUS:
+ if (n_ops == 7)
+ return NULL_RTX;
+@@ -2473,11 +2478,24 @@
+ && GET_CODE (ops[n_ops - 1].op) == CONST_INT
+ && CONSTANT_P (ops[n_ops - 2].op))
+ {
+- rtx value = ops[n_ops - 1].op;
+- if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg)
+- value = neg_const_int (mode, value);
+- ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, INTVAL (value));
+- n_ops--;
++ if (!flag_propolice_protection)
++ {
++ rtx value = ops[n_ops - 1].op;
++ if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg)
++ value = neg_const_int (mode, value);
++ ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, INTVAL (value));
++ n_ops--;
++ }
++ /* The stack protector keeps the addressing style of a local variable,
++ so it doesn't use neg_const_int function not to change
++ the offset value. */
++ else {
++ HOST_WIDE_INT value = INTVAL (ops[n_ops - 1].op);
++ if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg)
++ value = -value;
++ ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, value);
++ n_ops--;
++ }
+ }
+
+ /* Count the number of CONSTs that we generated. */
+@@ -2495,6 +2513,59 @@
+ || (n_ops + n_consts == input_ops && n_consts <= input_consts)))
+ return NULL_RTX;
+
++ if (flag_propolice_protection)
++ {
++ /* keep the addressing style of local variables
++ as (plus (virtual_stack_vars_rtx) (CONST_int x)).
++ For the case array[r-1],
++ converts from (+ (+VFP c1) (+r -1)) to (SET R (+VFP c1)) (+ R (+r -1)).
++
++ This loop finds ops[i] which is the register for the frame
++ addressing, Then, makes the frame addressing using the register and
++ the constant of ops[n_ops - 1]. */
++ for (i = 0; i < n_ops; i++)
++#ifdef FRAME_GROWS_DOWNWARD
++ if (ops[i].op == virtual_stack_vars_rtx)
++#else
++ if (ops[i].op == virtual_stack_vars_rtx
++ || ops[i].op == frame_pointer_rtx)
++#endif
++ {
++ if (GET_CODE (ops[n_ops - 1].op) == CONST_INT)
++ {
++ HOST_WIDE_INT value = INTVAL (ops[n_ops - 1].op);
++ if (value >= fp_offset)
++ {
++ ops[i].op = plus_constant (ops[i].op, value);
++ n_ops--;
++ }
++ else
++ {
++ if (!force
++ && (n_ops + 1 + n_consts > input_ops
++ || (n_ops + 1 + n_consts == input_ops
++ && n_consts <= input_consts)))
++ return NULL_RTX;
++ ops[n_ops - 1].op = GEN_INT (value-fp_offset);
++ ops[i].op = plus_constant (ops[i].op, fp_offset);
++ }
++ }
++ /* keep the following address pattern;
++ (1) buf[BUFSIZE] is the first assigned variable.
++ (+ (+ fp -BUFSIZE) BUFSIZE)
++ (2) ((+ (+ fp 1) r) -1). */
++ else if (fp_offset != 0)
++ return NULL_RTX;
++ /* keep the (+ fp 0) pattern for the following case;
++ (1) buf[i]: i: REG, buf: (+ fp 0) in !FRAME_GROWS_DOWNWARD
++ (2) argument: the address is (+ fp 0). */
++ else if (fp_offset == 0)
++ return NULL_RTX;
++
++ break;
++ }
++ }
++
+ /* Put a non-negated operand first, if possible. */
+
+ for (i = 0; i < n_ops && ops[i].neg; i++)
+diff -uNr gcc-3.4.3.orig/gcc/testsuite/gcc.dg/ssp-warn.c gcc-3.4.3/gcc/testsuite/gcc.dg/ssp-warn.c
+--- gcc-3.4.3.orig/gcc/testsuite/gcc.dg/ssp-warn.c 1970-01-01 01:00:00.000000000 +0100
++++ gcc-3.4.3/gcc/testsuite/gcc.dg/ssp-warn.c 2003-11-21 09:41:19.000000000 +0100
+@@ -0,0 +1,32 @@
++/* { dg-do compile } */
++/* { dg-options "-fstack-protector" } */
++void
++test1()
++{
++ void intest1(int *a)
++ {
++ *a ++;
++ }
++
++ char buf[80];
++
++ buf[0] = 0;
++} /* { dg-bogus "not protecting function: it contains functions" } */
++
++void
++test2(int n)
++{
++ char buf[80];
++ char vbuf[n];
++
++ buf[0] = 0;
++ vbuf[0] = 0;
++} /* { dg-bogus "not protecting variables: it has a variable length buffer" } */
++
++void
++test3()
++{
++ char buf[5];
++
++ buf[0] = 0;
++} /* { dg-bogus "not protecting function: buffer is less than 8 bytes long" } */
+diff -uNr gcc-3.4.3.orig/gcc/testsuite/gcc.misc-tests/ssp-execute1.c gcc-3.4.3/gcc/testsuite/gcc.misc-tests/ssp-execute1.c
+--- gcc-3.4.3.orig/gcc/testsuite/gcc.misc-tests/ssp-execute1.c 1970-01-01 01:00:00.000000000 +0100
++++ gcc-3.4.3/gcc/testsuite/gcc.misc-tests/ssp-execute1.c 2004-02-16 06:15:39.000000000 +0100
+@@ -0,0 +1,54 @@
++/* Test location changes of character array. */
++
++void
++test(int i)
++{
++ int ibuf1[10];
++ char buf[50];
++ int ibuf2[10];
++ char buf2[50000];
++ int ibuf3[10];
++ char *p;
++
++ /* c1: the frame offset of buf[0]
++ c2: the frame offset of buf2[0]
++ */
++ p= &buf[0]; *p=1; /* expected rtl: (+ fp -c1) */
++ if (*p != buf[0])
++ abort();
++ p= &buf[5]; *p=2; /* expected rtl: (+ fp -c1+5) */
++ if (*p != buf[5])
++ abort();
++ p= &buf[-1]; *p=3; /* expected rtl: (+ (+ fp -c1) -1) */
++ if (*p != buf[-1])
++ abort();
++ p= &buf[49]; *p=4; /* expected rtl: (+ fp -c1+49) */
++ if (*p != buf[49])
++ abort();
++ p = &buf[i+5]; *p=5; /* expected rtl: (+ (+ fp -c1) (+ i 5)) */
++ if (*p != buf[i+5])
++ abort ();
++ p = buf - 1; *p=6; /* expected rtl: (+ (+ fp -c1) -1) */
++ if (*p != buf[-1])
++ abort ();
++ p = 1 + buf; *p=7; /* expected rtl: (+ (+ fp -c1) 1) */
++ if (*p != buf[1])
++ abort ();
++ p = &buf[1] - 1; *p=8; /* expected rtl: (+ (+ fp -c1+1) -1) */
++ if (*p != buf[0])
++ abort ();
++
++ /* test big offset which is greater than the max value of signed 16 bit integer. */
++ p = &buf2[45555]; *p=9; /* expected rtl: (+ fp -c2+45555) */
++ if (*p != buf2[45555])
++ abort ();
++}
++
++int main()
++{
++ test(10);
++ exit(0);
++}
++
++
++
+diff -uNr gcc-3.4.3.orig/gcc/testsuite/gcc.misc-tests/ssp-execute2.c gcc-3.4.3/gcc/testsuite/gcc.misc-tests/ssp-execute2.c
+--- gcc-3.4.3.orig/gcc/testsuite/gcc.misc-tests/ssp-execute2.c 1970-01-01 01:00:00.000000000 +0100
++++ gcc-3.4.3/gcc/testsuite/gcc.misc-tests/ssp-execute2.c 2003-11-22 09:44:33.000000000 +0100
+@@ -0,0 +1,49 @@
++void
++test(int i, char *j, int k)
++{
++ int a[10];
++ char b;
++ int c;
++ long *d;
++ char buf[50];
++ long e[10];
++ int n;
++
++ a[0] = 4;
++ b = 5;
++ c = 6;
++ d = (long*)7;
++ e[0] = 8;
++
++ /* overflow buffer */
++ for (n = 0; n < 120; n++)
++ buf[n] = 0;
++
++ if (j == 0 || *j != 2)
++ abort ();
++ if (a[0] == 0)
++ abort ();
++ if (b == 0)
++ abort ();
++ if (c == 0)
++ abort ();
++ if (d == 0)
++ abort ();
++ if (e[0] == 0)
++ abort ();
++
++ exit (0);
++}
++
++int main()
++{
++ int i, k;
++ int j[40];
++ i = 1;
++ j[39] = 2;
++ k = 3;
++ test(i, &j[39], k);
++}
++
++
++
+diff -uNr gcc-3.4.3.orig/gcc/testsuite/gcc.misc-tests/ssp-execute.exp gcc-3.4.3/gcc/testsuite/gcc.misc-tests/ssp-execute.exp
+--- gcc-3.4.3.orig/gcc/testsuite/gcc.misc-tests/ssp-execute.exp 1970-01-01 01:00:00.000000000 +0100
++++ gcc-3.4.3/gcc/testsuite/gcc.misc-tests/ssp-execute.exp 2004-06-02 13:23:36.000000000 +0200
+@@ -0,0 +1,35 @@
++# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++if $tracelevel then {
++ strace $tracelevel
++}
++
++# Load support procs.
++load_lib c-torture.exp
++
++#
++# main test loop
++#
++
++foreach src [lsort [glob -nocomplain $srcdir/$subdir/ssp-execute*.c]] {
++ # If we're only testing specific files and this isn't one of them, skip it.
++ if ![runtest_file_p $runtests $src] then {
++ continue
++ }
++
++ c-torture-execute $src -fstack-protector
++}
+diff -uNr gcc-3.4.3.orig/gcc/toplev.c gcc-3.4.3/gcc/toplev.c
+--- gcc-3.4.3.orig/gcc/toplev.c 2004-07-26 16:42:11.000000000 +0200
++++ gcc-3.4.3/gcc/toplev.c 2004-11-24 18:35:31.000000000 +0100
+@@ -79,6 +79,7 @@
+ #include "coverage.h"
+ #include "value-prof.h"
+ #include "alloc-pool.h"
++#include "protector.h"
+
+ #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
+ #include "dwarf2out.h"
+@@ -97,6 +98,10 @@
+ declarations for e.g. AIX 4.x. */
+ #endif
+
++#ifdef STACK_PROTECTOR
++#include "protector.h"
++#endif
++
+ #ifndef HAVE_conditional_execution
+ #define HAVE_conditional_execution 0
+ #endif
+@@ -979,6 +984,15 @@
+ minimum function alignment. Zero means no alignment is forced. */
+ int force_align_functions_log;
+
++#if defined(STACK_PROTECTOR) && defined(STACK_GROWS_DOWNWARD)
++/* Nonzero means use propolice as a stack protection method */
++int flag_propolice_protection = 1;
++int flag_stack_protection = 0;
++#else
++int flag_propolice_protection = 0;
++int flag_stack_protection = 0;
++#endif
++
+ typedef struct
+ {
+ const char *const string;
+@@ -1154,7 +1168,9 @@
+ {"mem-report", &mem_report, 1 },
+ { "trapv", &flag_trapv, 1 },
+ { "wrapv", &flag_wrapv, 1 },
+- { "new-ra", &flag_new_regalloc, 1 }
++ { "new-ra", &flag_new_regalloc, 1 },
++ {"stack-protector", &flag_propolice_protection, 1 },
++ {"stack-protector-all", &flag_stack_protection, 1 }
+ };
+
+ /* Here is a table, controlled by the tm.h file, listing each -m switch
+@@ -2686,6 +2702,9 @@
+
+ insns = get_insns ();
+
++ if (flag_propolice_protection)
++ prepare_stack_protection (inlinable);
++
+ /* Dump the rtl code if we are dumping rtl. */
+
+ if (open_dump_file (DFI_rtl, decl))
+@@ -4483,6 +4502,12 @@
+ /* The presence of IEEE signaling NaNs, implies all math can trap. */
+ if (flag_signaling_nans)
+ flag_trapping_math = 1;
++
++ /* This combination makes optimized frame addressings and causes
++ a internal compilation error at prepare_stack_protection.
++ so don't allow it. */
++ if (flag_stack_protection && !flag_propolice_protection)
++ flag_propolice_protection = TRUE;
+ }
+
+ /* Initialize the compiler back end. */
+diff -uNr gcc-3.4.3.orig/gcc/tree.h gcc-3.4.3/gcc/tree.h
+--- gcc-3.4.3.orig/gcc/tree.h 2004-11-24 18:04:19.000000000 +0100
++++ gcc-3.4.3/gcc/tree.h 2004-11-24 18:35:31.000000000 +0100
+@@ -1489,6 +1489,10 @@
+ where it is called. */
+ #define DECL_INLINE(NODE) (FUNCTION_DECL_CHECK (NODE)->decl.inline_flag)
+
++/* In a VAR_DECL, nonzero if the declaration is copied for inlining.
++ The stack protector should keep its location in the stack. */
++#define DECL_COPIED(NODE) (VAR_DECL_CHECK (NODE)->decl.inline_flag)
++
+ /* Nonzero in a FUNCTION_DECL means that this function was declared inline,
+ such as via the `inline' keyword in C/C++. This flag controls the linkage
+ semantics of 'inline'; whether or not the function is inlined is
--- /dev/null
+diff -aur gcc-3.4.0orig/gcc/c-common.c gcc-3.4.0/gcc/c-common.c
+--- gcc-3.4.0orig/gcc/c-common.c 2004-03-19 01:32:59.000000000 +0000
++++ gcc-3.4.0/gcc/c-common.c 2004-05-10 21:05:33.000000000 +0100
+@@ -833,7 +833,7 @@
+ handle_deprecated_attribute },
+ { "vector_size", 1, 1, false, true, false,
+ handle_vector_size_attribute },
+- { "visibility", 1, 1, true, false, false,
++ { "visibility", 1, 1, false, false, false,
+ handle_visibility_attribute },
+ { "tls_model", 1, 1, true, false, false,
+ handle_tls_model_attribute },
+@@ -4886,7 +4886,16 @@
+
+ *no_add_attrs = true;
+
+- if (decl_function_context (decl) != 0 || ! TREE_PUBLIC (decl))
++ if (TYPE_P (*node))
++ {
++ if (TREE_CODE (*node) != RECORD_TYPE && TREE_CODE (*node) != UNION_TYPE)
++ {
++ warning ("`%s' attribute ignored on non-class types",
++ IDENTIFIER_POINTER (name));
++ return NULL_TREE;
++ }
++ }
++ else if (decl_function_context (decl) != 0 || ! TREE_PUBLIC (decl))
+ {
+ warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ return NULL_TREE;
+@@ -4897,6 +4906,14 @@
+ error ("visibility arg not a string");
+ return NULL_TREE;
+ }
++
++ /* If this is a type, set the visibility on the type decl. */
++ if (TYPE_P (decl))
++ {
++ decl = TYPE_NAME (decl);
++ if (! decl)
++ return NULL_TREE;
++ }
+
+ if (strcmp (TREE_STRING_POINTER (id), "default") == 0)
+ DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
+@@ -4908,6 +4925,14 @@
+ DECL_VISIBILITY (decl) = VISIBILITY_PROTECTED;
+ else
+ error ("visibility arg must be one of \"default\", \"hidden\", \"protected\" or \"internal\"");
++ DECL_VISIBILITYSPECIFIED (decl) = 1;
++
++ /* For decls only, go ahead and attach the attribute to the node as well.
++ This is needed so we can determine whether we have VISIBILITY_DEFAULT
++ because the visibility was not specified, or because it was explicitly
++ overridden from the class visibility. */
++ if (DECL_P (*node))
++ *no_add_attrs = false;
+
+ return NULL_TREE;
+ }
+
+diff -aur gcc-3.4.0orig/gcc/c-decl.c gcc-3.4.0/gcc/c-decl.c
+--- gcc-3.4.0orig/gcc/c-decl.c 2004-03-22 17:58:18.000000000 +0000
++++ gcc-3.4.0/gcc/c-decl.c 2004-05-10 15:16:27.000000000 +0100
+@@ -1164,9 +1164,8 @@
+ }
+
+ /* warnings */
+- /* All decls must agree on a non-default visibility. */
+- if (DECL_VISIBILITY (newdecl) != VISIBILITY_DEFAULT
+- && DECL_VISIBILITY (olddecl) != VISIBILITY_DEFAULT
++ /* All decls must agree on a visibility. */
++ if (DECL_VISIBILITYSPECIFIED (newdecl) && DECL_VISIBILITYSPECIFIED (olddecl)
+ && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
+ {
+ warning ("%Jredeclaration of '%D' with different visibility "
+@@ -1361,9 +1360,12 @@
+ Currently, it can only be defined in the prototype. */
+ COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl);
+
+- /* If either declaration has a nondefault visibility, use it. */
+- if (DECL_VISIBILITY (olddecl) != VISIBILITY_DEFAULT)
+- DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
++ /* Use visibility of whichever declaration had it specified */
++ if (DECL_VISIBILITYSPECIFIED (olddecl))
++ {
++ DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
++ DECL_VISIBILITYSPECIFIED (newdecl) = 1;
++ }
+
+ if (TREE_CODE (newdecl) == FUNCTION_DECL)
+ {
+
+diff -aur gcc-3.4.0orig/gcc/common.opt gcc-3.4.0/gcc/common.opt
+--- gcc-3.4.0orig/gcc/common.opt 2004-02-18 00:09:04.000000000 +0000
++++ gcc-3.4.0/gcc/common.opt 2004-05-09 08:10:50.000000000 +0100
+@@ -718,6 +718,11 @@
+ Common
+ Add extra commentary to assembler output
+
++fvisibility=
++Common Joined RejectNegative
++-fvisibility=[default|internal|hidden|protected] Set the default symbol visibility
++
++
+ fvpt
+ Common
+ Use expression value profiles in optimizations
+
+diff -aur gcc-3.4.0orig/gcc/c.opt gcc-3.4.0/gcc/c.opt
+--- gcc-3.4.0orig/gcc/c.opt 2004-02-18 00:09:03.000000000 +0000
++++ gcc-3.4.0/gcc/c.opt 2004-05-09 08:10:50.000000000 +0100
+@@ -656,6 +656,10 @@
+ C++ ObjC++
+ Use __cxa_atexit to register destructors
+
++fvisibility-inlines-hidden
++C++
++Marks all inlined methods as having hidden visibility
++
+ fvtable-gc
+ C++ ObjC++
+ Discard unused virtual functions
+diff -aur gcc-3.4.0orig/gcc/c-opts.c gcc-3.4.0/gcc/c-opts.c
+--- gcc-3.4.0orig/gcc/c-opts.c 2004-02-18 00:09:03.000000000 +0000
++++ gcc-3.4.0/gcc/c-opts.c 2004-05-09 08:10:50.000000000 +0100
+@@ -912,6 +912,10 @@
+ case OPT_fuse_cxa_atexit:
+ flag_use_cxa_atexit = value;
+ break;
++
++ case OPT_fvisibility_inlines_hidden:
++ visibility_options.inlineshidden = value;
++ break;
+
+ case OPT_fweak:
+ flag_weak = value;
+
+diff -aur gcc-3.4.0orig/gcc/cp/class.c gcc-3.4.0/gcc/cp/class.c
+--- gcc-3.4.0orig/gcc/cp/class.c 2004-03-09 07:27:23.000000000 +0000
++++ gcc-3.4.0/gcc/cp/class.c 2004-05-10 21:06:50.000000000 +0100
+@@ -524,6 +524,10 @@
+ DECL_ALIGN (decl) = MAX (TYPE_ALIGN (double_type_node),
+ DECL_ALIGN (decl));
+
++ /* The vtable's visibility is the class visibility. There is no way
++ to override the visibility for just the vtable. */
++ DECL_VISIBILITY (decl) = CLASSTYPE_VISIBILITY (class_type);
++ DECL_VISIBILITYSPECIFIED (decl) = CLASSTYPE_VISIBILITYSPECIFIED (class_type);
+ import_export_vtable (decl, class_type, 0);
+
+ return decl;
+@@ -2971,7 +2975,25 @@
+ continue;
+
+ if (TREE_CODE (x) == CONST_DECL || TREE_CODE (x) == VAR_DECL)
+- continue;
++ {
++ /* Apply the class's visibility attribute to static members
++ which do not have a visibility attribute. */
++ if (! lookup_attribute ("visibility", DECL_ATTRIBUTES (x)))
++ {
++ if (visibility_options.inlineshidden && DECL_INLINE (x))
++ {
++ DECL_VISIBILITY (x) = VISIBILITY_HIDDEN;
++ DECL_VISIBILITYSPECIFIED (x) = 1;
++ }
++ else
++ {
++ DECL_VISIBILITY (x) = CLASSTYPE_VISIBILITY (current_class_type);
++ DECL_VISIBILITYSPECIFIED (x) = CLASSTYPE_VISIBILITYSPECIFIED (current_class_type);
++ }
++ }
++
++ continue;
++ }
+
+ /* Now it can only be a FIELD_DECL. */
+
+@@ -3708,6 +3730,22 @@
+ check_for_override (x, t);
+ if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x))
+ cp_error_at ("initializer specified for non-virtual method `%D'", x);
++
++ /* Apply the class's visibility attribute to methods which do
++ not have a visibility attribute. */
++ if (! lookup_attribute ("visibility", DECL_ATTRIBUTES (x)))
++ {
++ if (visibility_options.inlineshidden && DECL_INLINE (x))
++ {
++ DECL_VISIBILITY (x) = VISIBILITY_HIDDEN;
++ DECL_VISIBILITYSPECIFIED (x) = 1;
++ }
++ else
++ {
++ DECL_VISIBILITY (x) = CLASSTYPE_VISIBILITY (current_class_type);
++ DECL_VISIBILITYSPECIFIED (x) = CLASSTYPE_VISIBILITYSPECIFIED (current_class_type);
++ }
++ }
+
+ /* The name of the field is the original field name
+ Save this in auxiliary field for later overloading. */
+@@ -7830,3 +7868,4 @@
+ *vid->last_init = build_tree_list (NULL_TREE, init);
+ vid->last_init = &TREE_CHAIN (*vid->last_init);
+ }
++
+
+diff -aur gcc-3.4.0orig/gcc/cp/cp-tree.h gcc-3.4.0/gcc/cp/cp-tree.h
+--- gcc-3.4.0orig/gcc/cp/cp-tree.h 2004-03-20 00:13:08.000000000 +0000
++++ gcc-3.4.0/gcc/cp/cp-tree.h 2004-05-10 20:56:56.000000000 +0100
+@@ -1008,7 +1008,12 @@
+ #define PUBLICLY_UNIQUELY_DERIVED_P(PARENT, TYPE) \
+ (lookup_base ((TYPE), (PARENT), ba_not_special | ba_quiet, NULL) \
+ != NULL_TREE)
+-\f
++
++/* Gives the visibility specification for a class type. */
++#define CLASSTYPE_VISIBILITY(TYPE) DECL_VISIBILITY (TYPE_NAME (TYPE))
++#define CLASSTYPE_VISIBILITYSPECIFIED(TYPE) DECL_VISIBILITYSPECIFIED (TYPE_NAME (TYPE))
++
++
+ /* This is a few header flags for 'struct lang_type'. Actually,
+ all but the first are used only for lang_type_class; they
+ are put in this structure to save space. */
+
+diff -aur gcc-3.4.0orig/gcc/cp/decl.c gcc-3.4.0/gcc/cp/decl.c
+--- gcc-3.4.0orig/gcc/cp/decl.c 2004-04-01 21:47:21.000000000 +0100
++++ gcc-3.4.0/gcc/cp/decl.c 2004-05-28 21:16:11.000000000 +0100
+@@ -1869,17 +1869,34 @@
+ DECL_COMMON (newdecl) = DECL_COMMON (olddecl);
+ COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl);
+
+- /* If either declaration has a nondefault visibility, use it. */
+- if (DECL_VISIBILITY (olddecl) != VISIBILITY_DEFAULT)
++ /* Warn about conflicting visibility specifications. */
++ if (DECL_VISIBILITYSPECIFIED (olddecl) && DECL_VISIBILITYSPECIFIED (newdecl)
++ && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
++ {
++ warning ("%J'%D': visibility attribute ignored because it",
++ newdecl, newdecl);
++ warning ("%Jconflicts with previous declaration here", olddecl);
++ }
++ /* Choose the declaration which specified visibility. */
++ if (DECL_VISIBILITYSPECIFIED (olddecl))
+ {
+- if (DECL_VISIBILITY (newdecl) != VISIBILITY_DEFAULT
+- && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
+- {
+- warning ("%J'%D': visibility attribute ignored because it",
+- newdecl, newdecl);
+- warning ("%Jconflicts with previous declaration here", olddecl);
+- }
+ DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
++ DECL_VISIBILITYSPECIFIED (newdecl) = 1;
++ }
++ /* If it's a definition of a global operator new or operator
++ delete, it must be default visibility. */
++ if (NEW_DELETE_OPNAME_P (DECL_NAME (newdecl)) && DECL_INITIAL (newdecl) != NULL_TREE)
++ {
++ if (!DECL_FUNCTION_MEMBER_P (newdecl) && VISIBILITY_DEFAULT != DECL_VISIBILITY (newdecl))
++ {
++ warning ("%J`%D': ignoring non-default symbol",
++ newdecl, newdecl);
++ warning ("%Jvisibility on global operator new or delete", newdecl);
++ DECL_VISIBILITY (olddecl) = VISIBILITY_DEFAULT;
++ DECL_VISIBILITYSPECIFIED (olddecl) = 1;
++ DECL_VISIBILITY (newdecl) = VISIBILITY_DEFAULT;
++ DECL_VISIBILITYSPECIFIED (newdecl) = 1;
++ }
+ }
+
+ if (TREE_CODE (newdecl) == FUNCTION_DECL)
+
+diff -aur gcc-3.4.0orig/gcc/cp/method.c gcc-3.4.0/gcc/cp/method.c
+--- gcc-3.4.0orig/gcc/cp/method.c 2004-04-08 23:15:58.000000000 +0100
++++ gcc-3.4.0/gcc/cp/method.c 2004-05-09 08:10:52.000000000 +0100
+@@ -394,6 +394,7 @@
+ rewrite. */
+ TREE_PUBLIC (thunk_fndecl) = TREE_PUBLIC (function);
+ DECL_VISIBILITY (thunk_fndecl) = DECL_VISIBILITY (function);
++ DECL_VISIBILITYSPECIFIED (thunk_fndecl) = DECL_VISIBILITYSPECIFIED (function);
+
+ if (flag_syntax_only)
+ {
+
+diff -aur gcc-3.4.0orig/gcc/cp/optimize.c gcc-3.4.0/gcc/cp/optimize.c
+--- gcc-3.4.0orig/gcc/cp/optimize.c 2004-02-08 01:52:50.000000000 +0000
++++ gcc-3.4.0/gcc/cp/optimize.c 2004-05-09 08:10:52.000000000 +0100
+@@ -155,6 +155,7 @@
+ DECL_NOT_REALLY_EXTERN (clone) = DECL_NOT_REALLY_EXTERN (fn);
+ TREE_PUBLIC (clone) = TREE_PUBLIC (fn);
+ DECL_VISIBILITY (clone) = DECL_VISIBILITY (fn);
++ DECL_VISIBILITYSPECIFIED (clone) = DECL_VISIBILITYSPECIFIED (fn);
+
+ /* Adjust the parameter names and locations. */
+ parm = DECL_ARGUMENTS (fn);
+
+diff -aur gcc-3.4.0orig/gcc/cp/rtti.c gcc-3.4.0/gcc/cp/rtti.c
+--- gcc-3.4.0orig/gcc/cp/rtti.c 2004-03-08 23:00:26.000000000 +0000
++++ gcc-3.4.0/gcc/cp/rtti.c 2004-05-10 21:09:21.000000000 +0100
+@@ -361,7 +361,11 @@
+ pushdecl_top_level_and_finish (d, NULL_TREE);
+
+ if (CLASS_TYPE_P (type))
+- CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)) = d;
++ {
++ CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)) = d;
++ DECL_VISIBILITY (d) = CLASSTYPE_VISIBILITY (type);
++ DECL_VISIBILITYSPECIFIED (d) = CLASSTYPE_VISIBILITYSPECIFIED (type);
++ }
+
+ /* Remember the type it is for. */
+ TREE_TYPE (name) = type;
+@@ -759,6 +763,11 @@
+ TREE_STATIC (name_decl) = 1;
+ DECL_EXTERNAL (name_decl) = 0;
+ TREE_PUBLIC (name_decl) = 1;
++ if (CLASS_TYPE_P (target))
++ {
++ DECL_VISIBILITY (name_decl) = CLASSTYPE_VISIBILITY (target);
++ DECL_VISIBILITYSPECIFIED (name_decl) = CLASSTYPE_VISIBILITYSPECIFIED (target);
++ }
+ import_export_tinfo (name_decl, target, typeinfo_in_lib_p (target));
+ /* External name of the string containing the type's name has a
+ special name. */
+
+diff -aur gcc-3.4.0orig/gcc/c-pragma.c gcc-3.4.0/gcc/c-pragma.c
+--- gcc-3.4.0orig/gcc/c-pragma.c 2004-01-23 23:35:53.000000000 +0000
++++ gcc-3.4.0/gcc/c-pragma.c 2004-05-09 08:10:52.000000000 +0100
+@@ -480,6 +480,86 @@
+ return asmname;
+ }
+
++
++#ifdef HANDLE_PRAGMA_VISIBILITY
++static void handle_pragma_visibility (cpp_reader *);
++
++/* Sets the default visibility for symbols to something other than that
++ specified on the command line. */
++static void
++handle_pragma_visibility (cpp_reader *dummy ATTRIBUTE_UNUSED)
++{ /* Form is #pragma GCC visibility push(hidden)|pop */
++ static int visstack [16], visidx;
++ tree x;
++ enum cpp_ttype token;
++ enum { bad, push, pop } action = bad;
++
++ token = c_lex (&x);
++ if (token == CPP_NAME)
++ {
++ const char *op = IDENTIFIER_POINTER (x);
++ if (!strcmp (op, "push"))
++ action = push;
++ else if (!strcmp (op, "pop"))
++ action = pop;
++ }
++ if (bad == action)
++ GCC_BAD ("#pragma GCC visibility must be followed by push or pop");
++ else
++ {
++ if (pop == action)
++ {
++ if (!visidx)
++ {
++ GCC_BAD ("No matching push for '#pragma GCC visibility pop'");
++ }
++ else
++ {
++ default_visibility = visstack[--visidx];
++ visibility_options.inpragma = (visidx>0);
++ }
++ }
++ else
++ {
++ if (c_lex (&x) != CPP_OPEN_PAREN)
++ GCC_BAD ("missing '(' after '#pragma GCC visibility push' - ignored");
++ token = c_lex (&x);
++ if (token != CPP_NAME)
++ {
++ GCC_BAD ("malformed #pragma GCC visibility push");
++ }
++ else if (visidx >= 16)
++ {
++ GCC_BAD ("No more than sixteen #pragma GCC visibility pushes allowed at once");
++ }
++ else
++ {
++ const char *str = IDENTIFIER_POINTER (x);
++ visstack[visidx++] = default_visibility;
++ if (!strcmp (str, "default"))
++ default_visibility = VISIBILITY_DEFAULT;
++ else if (!strcmp (str, "internal"))
++ default_visibility = VISIBILITY_INTERNAL;
++ else if (!strcmp (str, "hidden"))
++ default_visibility = VISIBILITY_HIDDEN;
++ else if (!strcmp (str, "protected"))
++ default_visibility = VISIBILITY_PROTECTED;
++ else
++ {
++ GCC_BAD ("#pragma GCC visibility push() must specify default, internal, hidden or protected");
++ }
++ visibility_options.inpragma = 1;
++ }
++ if (c_lex (&x) != CPP_CLOSE_PAREN)
++ GCC_BAD ("missing '(' after '#pragma GCC visibility push' - ignored");
++ }
++ }
++ if (c_lex (&x) != CPP_EOF)
++ warning ("junk at end of '#pragma GCC visibility'");
++}
++
++#endif
++
+ /* Front-end wrapper for pragma registration to avoid dragging
+ cpplib.h in almost everywhere. */
+ void
+@@ -505,6 +585,9 @@
+ #ifdef HANDLE_PRAGMA_EXTERN_PREFIX
+ c_register_pragma (0, "extern_prefix", handle_pragma_extern_prefix);
+ #endif
++#ifdef HANDLE_PRAGMA_VISIBILITY
++ c_register_pragma ("GCC", "visibility", handle_pragma_visibility);
++#endif
+
+ #ifdef REGISTER_TARGET_PRAGMAS
+ REGISTER_TARGET_PRAGMAS ();
+diff -aur gcc-3.4.0orig/gcc/c-pragma.h gcc-3.4.0/gcc/c-pragma.h
+--- gcc-3.4.0orig/gcc/c-pragma.h 2004-01-31 06:18:05.000000000 +0000
++++ gcc-3.4.0/gcc/c-pragma.h 2004-05-09 08:10:53.000000000 +0100
+@@ -44,6 +44,11 @@
+ #define HANDLE_PRAGMA_PACK 1
+ #endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
+
++/* It's safe to always leave visibility pragma enabled as if
++ visibility is not supported on the host OS platform the
++ statements are ignored. */
++#define HANDLE_PRAGMA_VISIBILITY 1
++
+ extern void init_pragma (void);
+
+ /* Front-end wrapper for pragma registration to avoid dragging
+
+
+diff -aur gcc-3.4.0orig/gcc/doc/invoke.texi gcc-3.4.0/gcc/doc/invoke.texi
+--- gcc-3.4.0orig/gcc/doc/invoke.texi 2004-04-19 00:05:36.000000000 +0100
++++ gcc-3.4.0/gcc/doc/invoke.texi 2004-05-28 21:29:36.000000000 +0100
+@@ -183,7 +183,8 @@
+ -fno-optional-diags -fpermissive @gol
+ -frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol
+ -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
+--fno-default-inline -Wabi -Wctor-dtor-privacy @gol
++-fno-default-inline -fvisibility-inlines-hidden @gol
++-Wabi -Wctor-dtor-privacy @gol
+ -Wnon-virtual-dtor -Wreorder @gol
+ -Weffc++ -Wno-deprecated @gol
+ -Wno-non-template-friend -Wold-style-cast @gol
+@@ -674,7 +675,8 @@
+ -fargument-alias -fargument-noalias @gol
+ -fargument-noalias-global -fleading-underscore @gol
+ -ftls-model=@var{model} @gol
+--ftrapv -fwrapv -fbounds-check}
++-ftrapv -fwrapv -fbounds-check @gol
++-fvisibility}
+ @end table
+
+ @menu
+@@ -1433,6 +1435,20 @@
+ destructors, but will only work if your C library supports
+ @code{__cxa_atexit}.
+
++@item -fvisibility-inlines-hidden
++@opindex fvisibility-inlines-hidden
++Causes all inlined methods to be marked with
++@code{__attribute__ ((visibility ("hidden")))} so that they do not
++appear in the export table of a DSO and do not require a PLT indirection
++when used within the DSO. Enabling this option can have a dramatic effect
++on load and link times of a DSO as it massively reduces the size of the
++dynamic export table when the library makes heavy use of templates. While
++it can cause bloating through duplication of code within each DSO where
++it is used, often the wastage is less than the considerable space occupied
++by a long symbol name in the export table which is typical when using
++templates and namespaces. For even more savings, combine with the
++@code{-fvisibility=hidden} switch.
++
+ @item -fno-weak
+ @opindex fno-weak
+ Do not use weak symbol support, even if it is provided by the linker.
+@@ -11198,6 +11214,54 @@
+
+ The default without @option{-fpic} is @code{initial-exec}; with
+ @option{-fpic} the default is @code{global-dynamic}.
++
++@item -fvisibility=@var{default|internal|hidden|protected}
++@opindex fvisibility
++Set the default ELF image symbol visibility to the specified option - all
++symbols will be marked with this unless overrided within the code.
++Using this feature can very substantially improve linking and
++load times of shared object libraries, produce more optimised
++code, provide near-perfect API export and prevent symbol clashes.
++It is @strong{strongly} recommended that you use this in any shared objects
++you distribute.
++
++Despite the nomenclature, @code{default} always means public ie;
++available to be linked against from outside the shared object.
++@code{protected} and @code{internal} are pretty useless in real-world
++usage so the only other commonly used option will be @code{hidden}.
++The default if -fvisibility isn't specified is @code{default} ie; make every
++symbol public - this causes the same behaviour as previous versions of
++GCC.
++
++A good explanation of the benefits offered by ensuring ELF
++symbols have the correct visibility is given by ``How To Write
++Shared Libraries'' by Ulrich Drepper (which can be found at
++@w{@uref{http://people.redhat.com/~drepper/}}) - however a superior
++solution made possible by this option to marking things hidden when
++the default is public is to make the default hidden and mark things
++public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
++and @code{__attribute__ ((visibility("default")))} instead of
++@code{__declspec(dllexport)} you get almost identical semantics with
++identical syntax. This is a great boon to those working with
++cross-platform projects.
++
++For those adding visibility support to existing code, you may find
++@samp{#pragma GCC visibility} of use. This works by you enclosing
++the declarations you wish to set visibility for with (for example)
++@samp{#pragma GCC visibility push(hidden)} and
++@samp{#pragma GCC visibility pop}. These can be nested up to sixteen
++times. Bear in mind that symbol visibility should be viewed @strong{as
++part of the API interface contract} and thus all new code should
++always specify visibility when it is not the default ie; declarations
++only for use within the local DSO should @strong{always} be marked explicitly
++as hidden as so to avoid PLT indirection overheads - making this
++abundantly clear also aids readability and self-documentation of the code.
++Note that due to ISO C++ specification requirements, operator new and
++operator delete must always be of default visibility.
++
++An overview of these techniques, their benefits and how to use them
++is at @w{@uref{http://www.nedprod.com/programs/gccvisibility.html}}.
++
+ @end table
+
+ @c man end
+
+diff -aur gcc-3.4.0orig/gcc/flags.h gcc-3.4.0/gcc/flags.h
+--- gcc-3.4.0orig/gcc/flags.h 2004-02-18 00:09:04.000000000 +0000
++++ gcc-3.4.0/gcc/flags.h 2004-05-09 08:10:53.000000000 +0100
+@@ -60,6 +60,30 @@
+ /* Nonzero means emit debugging information only for symbols which are used. */
+ extern int flag_debug_only_used_symbols;
+
++/* Enumerate visibility settings. */
++#ifndef SYMBOL_VISIBILITY_DEFINED
++#define SYMBOL_VISIBILITY_DEFINED
++enum symbol_visibility
++{
++ VISIBILITY_DEFAULT,
++ VISIBILITY_INTERNAL,
++ VISIBILITY_HIDDEN,
++ VISIBILITY_PROTECTED
++};
++#endif
++
++/* The default visibility for all symbols (unless overridden). */
++extern enum symbol_visibility default_visibility;
++
++struct visibility_flags
++{
++ unsigned inpragma : 1; /* True when in #pragma GCC visibility. */
++ unsigned inlineshidden : 1; /* True when -finlineshidden in effect. */
++};
++
++/* Global visibility options. */
++extern struct visibility_flags visibility_options;
++
+ /* Nonzero means do optimizations. -opt. */
+
+ extern int optimize;
+
+diff -aur gcc-3.4.0orig/gcc/opts.c gcc-3.4.0/gcc/opts.c
+--- gcc-3.4.0orig/gcc/opts.c 2004-02-18 00:09:04.000000000 +0000
++++ gcc-3.4.0/gcc/opts.c 2004-05-09 08:10:53.000000000 +0100
+@@ -142,6 +142,12 @@
+ write_symbols is set to DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
+ bool use_gnu_debug_info_extensions;
+
++/* The default visibility for all symbols (unless overridden) */
++enum symbol_visibility default_visibility = VISIBILITY_DEFAULT;
++
++/* Global visibility options. */
++struct visibility_flags visibility_options;
++
+ /* Columns of --help display. */
+ static unsigned int columns = 80;
+
+@@ -1440,6 +1446,21 @@
+ flag_verbose_asm = value;
+ break;
+
++ case OPT_fvisibility_:
++ {
++ if(!strcmp(arg, "default"))
++ default_visibility=VISIBILITY_DEFAULT;
++ else if(!strcmp(arg, "internal"))
++ default_visibility=VISIBILITY_INTERNAL;
++ else if(!strcmp(arg, "hidden"))
++ default_visibility=VISIBILITY_HIDDEN;
++ else if(!strcmp(arg, "protected"))
++ default_visibility=VISIBILITY_PROTECTED;
++ else
++ error("unrecognised visibility value \"%s\"", arg);
++ }
++ break;
++
+ case OPT_fweb:
+ flag_web = value;
+ break;
+
+diff -aur gcc-3.4.0orig/gcc/tree.c gcc-3.4.0/gcc/tree.c
+--- gcc-3.4.0orig/gcc/tree.c 2004-02-05 22:01:35.000000000 +0000
++++ gcc-3.4.0/gcc/tree.c 2004-05-10 15:22:52.000000000 +0100
+@@ -2563,6 +2563,11 @@
+ layout_decl (t, 0);
+ else if (code == FUNCTION_DECL)
+ DECL_MODE (t) = FUNCTION_MODE;
++
++ /* Set default visibility to whatever the user supplied with
++ visibility_specified depending on #pragma GCC visibility. */
++ DECL_VISIBILITY (t) = default_visibility;
++ DECL_VISIBILITYSPECIFIED (t) = visibility_options.inpragma;
+
+ return t;
+ }
+
+diff -aur gcc-3.4.0orig/gcc/tree.h gcc-3.4.0/gcc/tree.h
+--- gcc-3.4.0orig/gcc/tree.h 2004-02-08 01:52:43.000000000 +0000
++++ gcc-3.4.0/gcc/tree.h 2004-05-09 08:10:54.000000000 +0100
+@@ -1499,6 +1499,10 @@
+ /* Value of the decls's visibility attribute */
+ #define DECL_VISIBILITY(NODE) (DECL_CHECK (NODE)->decl.visibility)
+
++/* Nonzero means that the decl had its visibility specified rather than
++ being inferred. */
++#define DECL_VISIBILITYSPECIFIED(NODE) (DECL_CHECK (NODE)->decl.visibility_specified)
++
+ /* In a FUNCTION_DECL, nonzero if the function cannot be inlined. */
+ #define DECL_UNINLINABLE(NODE) (FUNCTION_DECL_CHECK (NODE)->decl.uninlinable)
+
+@@ -1633,7 +1637,8 @@
+ || TREE_CODE (DECL_CONTEXT (EXP)) == TRANSLATION_UNIT_DECL)
+
+ /* Enumerate visibility settings. */
+-
++#ifndef SYMBOL_VISIBILITY_DEFINED
++#define SYMBOL_VISIBILITY_DEFINED
+ enum symbol_visibility
+ {
+ VISIBILITY_DEFAULT,
+@@ -1641,6 +1646,7 @@
+ VISIBILITY_HIDDEN,
+ VISIBILITY_PROTECTED
+ };
++#endif
+
+ struct function;
+
+@@ -1684,8 +1690,7 @@
+ unsigned thread_local_flag : 1;
+ unsigned declared_inline_flag : 1;
+ ENUM_BITFIELD(symbol_visibility) visibility : 2;
+- unsigned unused : 1;
+- /* one unused bit. */
++ unsigned visibility_specified : 1;
+
+ unsigned lang_flag_0 : 1;
+ unsigned lang_flag_1 : 1;
+
+diff -aur gcc-3.4.0orig/gcc/varasm.c gcc-3.4.0/gcc/varasm.c
+--- gcc-3.4.0orig/gcc/varasm.c 2004-04-14 22:14:08.000000000 +0100
++++ gcc-3.4.0/gcc/varasm.c 2004-05-09 08:10:54.000000000 +0100
+@@ -5150,8 +5150,8 @@
+ /* Static variables are always local. */
+ else if (! TREE_PUBLIC (exp))
+ local_p = true;
+- /* A variable is local if the user tells us so. */
+- else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
++ /* A variable is local if the user explicitly tells us so. */
++ else if (DECL_VISIBILITYSPECIFIED (exp) && DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
+ local_p = true;
+ /* Otherwise, variables defined outside this object may not be local. */
+ else if (DECL_EXTERNAL (exp))
+@@ -5159,6 +5159,9 @@
+ /* Linkonce and weak data are never local. */
+ else if (DECL_ONE_ONLY (exp) || DECL_WEAK (exp))
+ local_p = false;
++ /* If none of the above and visibility is not default, make local. */
++ else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
++ local_p = true;
+ /* If PIC, then assume that any global name can be overridden by
+ symbols resolved from other modules. */
+ else if (shlib)
+
+++ /dev/null
-2005-08-19 Uros Bizjak <uros@kss-loka.si>
-
- * mode-switching.c (create_pre_exit): Skip assignments to
- EH_RETURN_STACKADJ_RTX when searching for return_copy insn.
- Add comment regarding use insn and simplify check for insns,
- generated by builtin_apply_return.
-
---- gcc/gcc/mode-switching.c 2005-07-05 18:20:07.000000000 +0200
-+++ gcc/gcc/mode-switching.c 2005-08-19 10:28:41.000000000 +0200
-@@ -250,6 +250,8 @@ create_pre_exit (int n_entities, int *en
-
- if (INSN_P (return_copy))
- {
-+ /* Skip USE patterns inserted by
-+ builtin_apply_return. */
- if (GET_CODE (PATTERN (return_copy)) == USE
- && GET_CODE (XEXP (PATTERN (return_copy), 0)) == REG
- && (FUNCTION_VALUE_REGNO_P
-@@ -270,6 +272,15 @@ create_pre_exit (int n_entities, int *en
- break;
- }
- copy_reg = SET_DEST (return_copy_pat);
-+
-+#ifdef EH_RETURN_STACKADJ_RTX
-+ /* Skip assignments to EH_RETURN_STACKADJ_RTX. */
-+ if (rtx_equal_p (copy_reg, EH_RETURN_STACKADJ_RTX))
-+ {
-+ last_insn = return_copy;
-+ continue;
-+ }
-+#endif
- if (GET_CODE (copy_reg) == REG)
- copy_start = REGNO (copy_reg);
- else if (GET_CODE (copy_reg) == SUBREG
-@@ -311,8 +322,8 @@ create_pre_exit (int n_entities, int *en
- if (copy_start >= ret_start
- && copy_start + copy_num <= ret_end)
- nregs -= copy_num;
-- else if (!maybe_builtin_apply
-- || !FUNCTION_VALUE_REGNO_P (copy_start))
-+ else if (!(maybe_builtin_apply
-+ && FUNCTION_VALUE_REGNO_P (copy_start)))
- break;
- last_insn = return_copy;
- }
+++ /dev/null
-diff -uNr gcc-4.1-20050818T1605UTC/gcc.orig/builtins.c gcc-4.1-20050818T1605UTC/gcc/builtins.c
---- gcc-4.1-20050818T1605UTC/gcc.orig/builtins.c 2005-08-18 16:22:46.000000000 +0000
-+++ gcc-4.1-20050818T1605UTC/gcc/builtins.c 2005-08-18 16:25:02.000000000 +0000
-@@ -52,6 +52,14 @@
- #define PAD_VARARGS_DOWN BYTES_BIG_ENDIAN
- #endif
-
-+#ifndef FUNCTION_VALUE_REGNO_P_APPLY_RESULT
-+#define FUNCTION_VALUE_REGNO_P_APPLY_RESULT FUNCTION_VALUE_REGNO_P
-+#endif
-+
-+#ifndef FUNCTION_ARG_REGNO_P_APPLY_ARGS
-+#define FUNCTION_ARG_REGNO_P_APPLY_ARGS FUNCTION_ARG_REGNO_P
-+#endif
-+
- /* Define the names of the builtin function types and codes. */
- const char *const built_in_class_names[4]
- = {"NOT_BUILT_IN", "BUILT_IN_FRONTEND", "BUILT_IN_MD", "BUILT_IN_NORMAL"};
-@@ -1079,7 +1087,7 @@
- size += GET_MODE_SIZE (Pmode);
-
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
-- if (FUNCTION_ARG_REGNO_P (regno))
-+ if (FUNCTION_ARG_REGNO_P_APPLY_ARGS (regno))
- {
- mode = reg_raw_mode[regno];
-
-@@ -1117,7 +1125,7 @@
- size = 0;
-
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
-- if (FUNCTION_VALUE_REGNO_P (regno))
-+ if (FUNCTION_VALUE_REGNO_P_APPLY_RESULT (regno))
- {
- mode = reg_raw_mode[regno];
-
-diff -uNr gcc-4.1-20050818T1605UTC/gcc.orig/caller-save.c gcc-4.1-20050818T1605UTC/gcc/caller-save.c
---- gcc-4.1-20050818T1605UTC/gcc.orig/caller-save.c 2005-06-28 08:15:34.000000000 +0000
-+++ gcc-4.1-20050818T1605UTC/gcc/caller-save.c 2005-08-18 16:25:02.000000000 +0000
-@@ -377,6 +377,7 @@
- {
- rtx insn = chain->insn;
- enum rtx_code code = GET_CODE (insn);
-+ rtx reg ATTRIBUTE_UNUSED;
-
- next = chain->next;
-
-@@ -450,6 +451,12 @@
- CLEAR_HARD_REG_SET (this_insn_sets);
- note_stores (PATTERN (insn), mark_set_regs, NULL);
-
-+#ifdef CALL_INSN_SETS
-+ reg = CALL_INSN_SETS (insn);
-+
-+ if (reg)
-+ mark_set_regs (reg, NULL_RTX, NULL);
-+#endif
- /* Compute which hard regs must be saved before this call. */
- AND_COMPL_HARD_REG_SET (hard_regs_to_save, call_fixed_reg_set);
- AND_COMPL_HARD_REG_SET (hard_regs_to_save, this_insn_sets);
-diff -uNr gcc-4.1-20050818T1605UTC/gcc.orig/config/i386/i386-modes.def gcc-4.1-20050818T1605UTC/gcc/config/i386/i386-modes.def
---- gcc-4.1-20050818T1605UTC/gcc.orig/config/i386/i386-modes.def 2005-06-28 08:16:53.000000000 +0000
-+++ gcc-4.1-20050818T1605UTC/gcc/config/i386/i386-modes.def 2005-08-18 16:25:02.000000000 +0000
-@@ -62,6 +62,9 @@
- CC_MODE (CCFP);
- CC_MODE (CCFPU);
-
-+/* This mode is used to cover all MMX and all x87 registers. */
-+RANDOM_MODE (ALLREGS);
-+
- /* Vector modes. */
- VECTOR_MODES (INT, 4); /* V4QI V2HI */
- VECTOR_MODES (INT, 8); /* V8QI V4HI V2SI */
-diff -uNr gcc-4.1-20050818T1605UTC/gcc.orig/config/i386/i386-protos.h gcc-4.1-20050818T1605UTC/gcc/config/i386/i386-protos.h
---- gcc-4.1-20050818T1605UTC/gcc.orig/config/i386/i386-protos.h 2005-08-18 16:01:16.000000000 +0000
-+++ gcc-4.1-20050818T1605UTC/gcc/config/i386/i386-protos.h 2005-08-18 16:25:02.000000000 +0000
-@@ -152,6 +152,9 @@
- extern bool ix86_expand_int_vcond (rtx[]);
- extern int ix86_expand_int_addcc (rtx[]);
- extern void ix86_expand_call (rtx, rtx, rtx, rtx, rtx, int);
-+extern bool ix86_epilogue_uses (int);
-+extern rtx ix86_call_insn_sets (rtx);
-+extern rtx ix86_call_insn_uses (rtx);
- extern void x86_initialize_trampoline (rtx, rtx, rtx);
- extern rtx ix86_zero_extend_to_Pmode (rtx);
- extern void ix86_split_long_move (rtx[]);
-@@ -168,8 +171,8 @@
- extern enum machine_mode ix86_fp_compare_mode (enum rtx_code);
-
- extern rtx ix86_libcall_value (enum machine_mode);
--extern bool ix86_function_value_regno_p (int);
--extern bool ix86_function_arg_regno_p (int);
-+extern bool ix86_function_value_regno_p (int, bool);
-+extern bool ix86_function_arg_regno_p (int, bool);
- extern int ix86_function_arg_boundary (enum machine_mode, tree);
- extern int ix86_return_in_memory (tree);
- extern void ix86_va_start (tree, rtx);
-@@ -190,7 +193,10 @@
- extern enum reg_class ix86_preferred_reload_class (rtx, enum reg_class);
- extern int ix86_memory_move_cost (enum machine_mode, enum reg_class, int);
- extern int ix86_mode_needed (int, rtx);
--extern void emit_i387_cw_initialization (int);
-+extern int ix86_mode_after (int, int, rtx);
-+extern int ix86_mode_entry (int);
-+extern int ix86_mode_exit (int);
-+extern void ix86_emit_mode_set (int, int);
- extern bool ix86_fp_jump_nontrivial_p (enum rtx_code);
- extern void x86_order_regs_for_local_alloc (void);
- extern void x86_function_profiler (FILE *, int);
-diff -uNr gcc-4.1-20050818T1605UTC/gcc.orig/config/i386/i386.c gcc-4.1-20050818T1605UTC/gcc/config/i386/i386.c
---- gcc-4.1-20050818T1605UTC/gcc.orig/config/i386/i386.c 2005-08-18 16:01:16.000000000 +0000
-+++ gcc-4.1-20050818T1605UTC/gcc/config/i386/i386.c 2005-08-18 16:25:02.000000000 +0000
-@@ -2273,12 +2273,13 @@
-
- /* Return true when register may be used to pass function parameters. */
- bool
--ix86_function_arg_regno_p (int regno)
-+ix86_function_arg_regno_p (int regno, bool from_builtin)
- {
- int i;
- if (!TARGET_64BIT)
- return (regno < REGPARM_MAX
-- || (TARGET_MMX && MMX_REGNO_P (regno)
-+ || (TARGET_MMX && !(TARGET_80387 && from_builtin)
-+ && MMX_REGNO_P (regno)
- && (regno < FIRST_MMX_REG + MMX_REGPARM_MAX))
- || (TARGET_SSE && SSE_REGNO_P (regno)
- && (regno < FIRST_SSE_REG + SSE_REGPARM_MAX)));
-@@ -3387,14 +3388,14 @@
-
- /* Return true if N is a possible register number of function value. */
- bool
--ix86_function_value_regno_p (int regno)
-+ix86_function_value_regno_p (int regno, bool from_builtin)
- {
- if (regno == 0
- || (regno == FIRST_FLOAT_REG && TARGET_FLOAT_RETURNS_IN_80387)
- || (regno == FIRST_SSE_REG && TARGET_SSE))
- return true;
-
-- if (!TARGET_64BIT
-+ if (!TARGET_64BIT && !(TARGET_80387 && from_builtin)
- && (regno == FIRST_MMX_REG && TARGET_MMX))
- return true;
-
-@@ -7714,12 +7715,152 @@
- return buf;
- }
-
--/* Return needed mode for entity in optimize_mode_switching pass. */
-+/* Return needed mode for entity in optimize_mode_switching pass.
-+ Returned mode should match ix86_mode_entry () for function calls. */
-
- int
- ix86_mode_needed (int entity, rtx insn)
- {
-- enum attr_i387_cw mode;
-+ int unit, mode;
-+
-+ if (entity == I387_FPU_MODE)
-+ {
-+ /* If a function call uses MMX registers, select MMX FPU mode and
-+ if function call uses x87 registers, select x87 FPU mode. */
-+ if (CALL_P (insn))
-+ {
-+ rtx link;
-+ rtx reg;
-+ bool mmx = false;
-+ bool x87 = false;
-+
-+ for (link = CALL_INSN_FUNCTION_USAGE (insn);
-+ link;
-+ link = XEXP (link, 1))
-+ {
-+ if (GET_CODE (XEXP (link, 0)) == USE)
-+ {
-+ reg = XEXP (XEXP (link, 0), 0);
-+
-+ if (reg)
-+ {
-+ if (MMX_REG_P (reg))
-+ mmx = true;
-+
-+ if (FP_REG_P (reg))
-+ x87 = true;
-+ }
-+ }
-+ }
-+
-+ /* Mixing of x87 and MMX registers is not allowed
-+ in function call. */
-+ gcc_assert (!mmx || !x87);
-+
-+ if (mmx)
-+ return FPU_MODE_MMX;
-+
-+ /* Fall back to default mode. */
-+ return FPU_MODE_X87;
-+ }
-+
-+ /* Parse ASM operands to check input and output constraints. If
-+ an ASM uses MMX registers, select MMX mode and if it uses x87
-+ registers, select x87 mode. Mixing of MMX and x87 constraints
-+ is not allowed. If no MMX or x87 input and output registers
-+ are used, switch to default mode. */
-+ if (NONJUMP_INSN_P (insn))
-+ {
-+ rtx pat = PATTERN (insn);
-+ int noperands = asm_noperands (pat);
-+
-+ if (noperands >= 0)
-+ {
-+ const char **constraints;
-+ int i;
-+ bool mmx = false;
-+ bool x87 = false;
-+
-+ constraints = alloca (noperands * sizeof (char *));
-+ decode_asm_operands (pat, NULL, NULL, constraints, NULL);
-+
-+ for (i = 0; i < noperands; i++)
-+ {
-+ const char *c = constraints[i];
-+ enum reg_class class;
-+
-+ if (c[0] == '%')
-+ c++;
-+ if (ISDIGIT ((unsigned char) c[0]) && c[1] == '\0')
-+ c = constraints[c[0] - '0'];
-+
-+ while (*c)
-+ {
-+ char cc = *c;
-+ int len;
-+ switch (cc)
-+ {
-+ case ',':
-+ cc++;
-+ continue;
-+ case '=':
-+ case '+':
-+ case '*':
-+ case '%':
-+ case '!':
-+ case '#':
-+ case '&':
-+ case '?':
-+ break;
-+
-+ default:
-+ class = REG_CLASS_FROM_LETTER (cc);
-+
-+ if (MMX_CLASS_P (class))
-+ mmx = true;
-+
-+ if (FLOAT_CLASS_P (class))
-+ x87 = true;
-+ }
-+
-+ len = CONSTRAINT_LEN (cc, c);
-+ do
-+ c++;
-+ while (--len && *c);
-+ }
-+ }
-+
-+ /* Mixing x87 and MMX registers in ASM is not allowed. */
-+ if (mmx && x87)
-+ error_for_asm (insn, "mixing of x87 and MMX registers "
-+ "is not allowed in %<asm%>");
-+
-+ if (mmx)
-+ return FPU_MODE_MMX;
-+
-+ /* Fall back to default mode. */
-+ return FPU_MODE_X87;
-+ }
-+ }
-+
-+ if (recog_memoized (insn) < 0)
-+ return FPU_MODE_ANY;
-+
-+ unit = get_attr_unit (insn);
-+
-+ switch (unit)
-+ {
-+ case UNIT_MMX:
-+ return FPU_MODE_MMX;
-+
-+ case UNIT_I387:
-+ return FPU_MODE_X87;
-+
-+ default:
-+ return FPU_MODE_ANY;
-+
-+ }
-+ }
-
- /* The mode UNINITIALIZED is used to store control word after a
- function call or ASM pattern. The mode ANY specify that function
-@@ -7766,21 +7907,132 @@
- return I387_CW_ANY;
- }
-
--/* Output code to initialize control word copies used by trunc?f?i and
-- rounding patterns. CURRENT_MODE is set to current control word,
-- while NEW_MODE is set to new control word. */
-+
-+/* Switch FPU mode to appropriate mode after function call in
-+ optimize_mode_switchig pass. Returned mode should match
-+ ix86_mode_exit (). */
-+
-+int
-+ix86_mode_after (int entity, int mode, rtx insn)
-+{
-+ if (entity == I387_FPU_MODE)
-+ {
-+ /* Switch FPU to MMX mode after funciton call if function value
-+ is returned in MMX register and similar for x87 reg.
-+ If no value is returned in MMX or x87 reg, fall back to
-+ default mode. */
-+ if (CALL_P (insn))
-+ {
-+ rtx reg = SET_DEST (PATTERN (insn));
-+
-+ int new_mode;
-+
-+ if (reg && MMX_REG_P (reg))
-+ new_mode = FPU_MODE_MMX;
-+ else
-+ new_mode = FPU_MODE_X87;
-+
-+ /* Call insn should never operate in FPU_MODE_ANY. */
-+ if ((mode != FPU_MODE_ANY) && (new_mode != mode))
-+ ix86_fpu_mode_changed = 1;
-+
-+ return new_mode;
-+ }
-+ }
-+
-+ return mode;
-+}
-+
-+/* Switch FPU mode of function entry to appropriate mode in
-+ optimize_mode_switchig pass. Returned mode should match
-+ ix86_mode_needed () for function calls. */
-+
-+int
-+ix86_mode_entry (int entity)
-+{
-+ if (entity == I387_FPU_MODE)
-+ {
-+ if (! current_function_args_info.maybe_vaarg)
-+ {
-+ if (current_function_args_info.mmx_nregs != MMX_REGPARM_MAX)
-+ return FPU_MODE_MMX;
-+
-+ /* ??? Handle x87 registers for fpregparm. */
-+ }
-+
-+ /* Fall back to default mode. */
-+ return FPU_MODE_X87;
-+ }
-+
-+ return I387_CW_ANY;
-+}
-+
-+/* Switch FPU mode of function exit to appropriate mode in
-+ optimize_mode_switchig pass. Returned mode should match
-+ ix86_mode_after () for function calls. */
-+
-+int
-+ix86_mode_exit (int entity)
-+{
-+ if (entity == I387_FPU_MODE)
-+ {
-+ rtx reg = current_function_return_rtx;
-+
-+ /* If MMX output register is specified, switch FPU mode
-+ of function exit to MMX mode. */
-+ if (reg && MMX_REG_P (reg))
-+ return FPU_MODE_MMX;
-+
-+ /* Fall back to default mode. */
-+ return FPU_MODE_X87;
-+ }
-+
-+ return I387_CW_ANY;
-+}
-+
-+/* Emit mode switching instructions in optimize_mode_switching pass. */
-
- void
--emit_i387_cw_initialization (int mode)
-+ix86_emit_mode_set (int entity, int mode)
- {
-- rtx stored_mode = assign_386_stack_local (HImode, SLOT_CW_STORED);
-- rtx new_mode;
-+ rtx stored_mode, new_mode;
-+ rtx reg;
-
- int slot;
-
-- rtx reg = gen_reg_rtx (HImode);
-+ if (entity == I387_FPU_MODE)
-+ {
-+ switch (mode)
-+ {
-+ case FPU_MODE_ANY:
-+ return;
-+
-+ case FPU_MODE_X87:
-+ emit_insn (gen_emms ());
-+ ix86_fpu_mode_changed = 1;
-+ return;
-+
-+ case FPU_MODE_MMX:
-+ emit_insn (gen_efpu ());
-+ ix86_fpu_mode_changed = 1;
-+ return;
-+
-+ default:
-+ gcc_unreachable ();
-+ }
-+ }
-+
-+ /* Output code to initialize control word copies used by trunc?f?i
-+ and rounding patterns. STORED_MODE is set to current control
-+ word, while NEW_MODE is set to new control word. */
-
-+ if ((mode == I387_CW_UNINITIALIZED) || (mode == I387_CW_ANY))
-+ return;
-+
-+ stored_mode = assign_386_stack_local (HImode, SLOT_CW_STORED);
- emit_insn (gen_x86_fnstcw_1 (stored_mode));
-+
-+ reg = gen_reg_rtx (HImode);
- emit_move_insn (reg, stored_mode);
-
- if (TARGET_64BIT || TARGET_PARTIAL_REG_STALL || optimize_size)
-@@ -12598,6 +12850,7 @@
-
- f = ggc_alloc_cleared (sizeof (struct machine_function));
- f->use_fast_prologue_epilogue_nregs = -1;
-+ f->optimize_mode_switching[I387_FPU_MODE] = TARGET_80387 && TARGET_MMX;
-
- return f;
- }
-@@ -13196,7 +13449,77 @@
- }
- return align;
- }
-+
- \f
-+
-+/* Return true to prevent register allocator from allocating registers
-+ from the unit that is not active. */
-+
-+bool
-+ix86_epilogue_uses (int regno)
-+{
-+ int mode;
-+
-+ if (! ix86_fpu_mode_changed)
-+ return false;
-+
-+ mode = ix86_mode_exit (I387_FPU_MODE);
-+
-+ if (mode == FPU_MODE_MMX)
-+ return FP_REGNO_P (regno);
-+ else
-+ return MMX_REGNO_P (regno);
-+}
-+
-+/* Return RTX code of additional register that CALL_INSN uses.
-+ This function is used to maintain correct register life
-+ information before CALL_INSN in case of MMX/x87 switching. */
-+
-+rtx
-+ix86_call_insn_uses (rtx insn)
-+{
-+ int mode;
-+
-+ if (! ix86_fpu_mode_changed)
-+ return NULL_RTX;
-+
-+ gcc_assert (CALL_P (insn));
-+
-+ mode = ix86_mode_needed (I387_FPU_MODE, insn);
-+ if (mode == FPU_MODE_MMX)
-+ return gen_rtx_REG (ALLREGSmode, FIRST_FLOAT_REG);
-+ else
-+ return gen_rtx_REG (ALLREGSmode, FIRST_MMX_REG);
-+
-+ return NULL_RTX;
-+}
-+
-+/* Return RTX code of additional register that CALL_INSN sets.
-+ This function is used to maintain correct register life
-+ information after CALL_INSN in case of MMX/x87 switching. */
-+
-+rtx
-+ix86_call_insn_sets (rtx insn)
-+{
-+ int mode;
-+
-+ if (! ix86_fpu_mode_changed)
-+ return NULL_RTX;
-+
-+ gcc_assert (CALL_P (insn));
-+
-+ /* Current mode in call to ix86_mode_after is set to FPU_MODE_ANY
-+ to prevent setting of ix86_fpu_mode_changed variable. */
-+ mode = ix86_mode_after (I387_FPU_MODE, FPU_MODE_ANY, insn);
-+ if (mode == FPU_MODE_MMX)
-+ return gen_rtx_REG (ALLREGSmode, FIRST_FLOAT_REG);
-+ else
-+ return gen_rtx_REG (ALLREGSmode, FIRST_MMX_REG);
-+
-+ return NULL_RTX;
-+}
-+
-+
- /* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-@@ -13676,9 +13999,11 @@
- IX86_BUILTIN_MONITOR,
- IX86_BUILTIN_MWAIT,
-
-+ IX86_BUILTIN_VEC_INIT_V2SF,
- IX86_BUILTIN_VEC_INIT_V2SI,
- IX86_BUILTIN_VEC_INIT_V4HI,
- IX86_BUILTIN_VEC_INIT_V8QI,
-+ IX86_BUILTIN_VEC_EXT_V2SF,
- IX86_BUILTIN_VEC_EXT_V2DF,
- IX86_BUILTIN_VEC_EXT_V2DI,
- IX86_BUILTIN_VEC_EXT_V4SF,
-@@ -13860,24 +14185,24 @@
- { MASK_SSE, CODE_FOR_sse_cvtsi2ss, 0, IX86_BUILTIN_CVTSI2SS, 0, 0 },
- { MASK_SSE | MASK_64BIT, CODE_FOR_sse_cvtsi2ssq, 0, IX86_BUILTIN_CVTSI642SS, 0, 0 },
-
-- { MASK_MMX, CODE_FOR_mmx_ashlv4hi3, 0, IX86_BUILTIN_PSLLW, 0, 0 },
-- { MASK_MMX, CODE_FOR_mmx_ashlv4hi3, 0, IX86_BUILTIN_PSLLWI, 0, 0 },
-- { MASK_MMX, CODE_FOR_mmx_ashlv2si3, 0, IX86_BUILTIN_PSLLD, 0, 0 },
-- { MASK_MMX, CODE_FOR_mmx_ashlv2si3, 0, IX86_BUILTIN_PSLLDI, 0, 0 },
-+ { MASK_MMX, CODE_FOR_ashlv4hi3, 0, IX86_BUILTIN_PSLLW, 0, 0 },
-+ { MASK_MMX, CODE_FOR_ashlv4hi3, 0, IX86_BUILTIN_PSLLWI, 0, 0 },
-+ { MASK_MMX, CODE_FOR_ashlv2si3, 0, IX86_BUILTIN_PSLLD, 0, 0 },
-+ { MASK_MMX, CODE_FOR_ashlv2si3, 0, IX86_BUILTIN_PSLLDI, 0, 0 },
- { MASK_MMX, CODE_FOR_mmx_ashldi3, 0, IX86_BUILTIN_PSLLQ, 0, 0 },
- { MASK_MMX, CODE_FOR_mmx_ashldi3, 0, IX86_BUILTIN_PSLLQI, 0, 0 },
-
-- { MASK_MMX, CODE_FOR_mmx_lshrv4hi3, 0, IX86_BUILTIN_PSRLW, 0, 0 },
-- { MASK_MMX, CODE_FOR_mmx_lshrv4hi3, 0, IX86_BUILTIN_PSRLWI, 0, 0 },
-- { MASK_MMX, CODE_FOR_mmx_lshrv2si3, 0, IX86_BUILTIN_PSRLD, 0, 0 },
-- { MASK_MMX, CODE_FOR_mmx_lshrv2si3, 0, IX86_BUILTIN_PSRLDI, 0, 0 },
-+ { MASK_MMX, CODE_FOR_lshrv4hi3, 0, IX86_BUILTIN_PSRLW, 0, 0 },
-+ { MASK_MMX, CODE_FOR_lshrv4hi3, 0, IX86_BUILTIN_PSRLWI, 0, 0 },
-+ { MASK_MMX, CODE_FOR_lshrv2si3, 0, IX86_BUILTIN_PSRLD, 0, 0 },
-+ { MASK_MMX, CODE_FOR_lshrv2si3, 0, IX86_BUILTIN_PSRLDI, 0, 0 },
- { MASK_MMX, CODE_FOR_mmx_lshrdi3, 0, IX86_BUILTIN_PSRLQ, 0, 0 },
- { MASK_MMX, CODE_FOR_mmx_lshrdi3, 0, IX86_BUILTIN_PSRLQI, 0, 0 },
-
-- { MASK_MMX, CODE_FOR_mmx_ashrv4hi3, 0, IX86_BUILTIN_PSRAW, 0, 0 },
-- { MASK_MMX, CODE_FOR_mmx_ashrv4hi3, 0, IX86_BUILTIN_PSRAWI, 0, 0 },
-- { MASK_MMX, CODE_FOR_mmx_ashrv2si3, 0, IX86_BUILTIN_PSRAD, 0, 0 },
-- { MASK_MMX, CODE_FOR_mmx_ashrv2si3, 0, IX86_BUILTIN_PSRADI, 0, 0 },
-+ { MASK_MMX, CODE_FOR_ashrv4hi3, 0, IX86_BUILTIN_PSRAW, 0, 0 },
-+ { MASK_MMX, CODE_FOR_ashrv4hi3, 0, IX86_BUILTIN_PSRAWI, 0, 0 },
-+ { MASK_MMX, CODE_FOR_ashrv2si3, 0, IX86_BUILTIN_PSRAD, 0, 0 },
-+ { MASK_MMX, CODE_FOR_ashrv2si3, 0, IX86_BUILTIN_PSRADI, 0, 0 },
-
- { MASK_SSE | MASK_3DNOW_A, CODE_FOR_mmx_psadbw, 0, IX86_BUILTIN_PSADBW, 0, 0 },
- { MASK_MMX, CODE_FOR_mmx_pmaddwd, 0, IX86_BUILTIN_PMADDWD, 0, 0 },
-@@ -14642,6 +14967,11 @@
- v16qi_ftype_pcchar, IX86_BUILTIN_LDDQU);
-
- /* Access to the vec_init patterns. */
-+ ftype = build_function_type_list (V2SF_type_node, float_type_node,
-+ integer_type_node, NULL_TREE);
-+ def_builtin (MASK_3DNOW, "__builtin_ia32_vec_init_v2sf",
-+ ftype, IX86_BUILTIN_VEC_INIT_V2SF);
-+
- ftype = build_function_type_list (V2SI_type_node, integer_type_node,
- integer_type_node, NULL_TREE);
- def_builtin (MASK_MMX, "__builtin_ia32_vec_init_v2si",
-@@ -14663,6 +14993,11 @@
- ftype, IX86_BUILTIN_VEC_INIT_V8QI);
-
- /* Access to the vec_extract patterns. */
-+ ftype = build_function_type_list (float_type_node, V2SF_type_node,
-+ integer_type_node, NULL_TREE);
-+ def_builtin (MASK_3DNOW, "__builtin_ia32_vec_ext_v2sf",
-+ ftype, IX86_BUILTIN_VEC_EXT_V2DF);
-+
- ftype = build_function_type_list (double_type_node, V2DF_type_node,
- integer_type_node, NULL_TREE);
- def_builtin (MASK_SSE, "__builtin_ia32_vec_ext_v2df",
-@@ -15137,7 +15472,7 @@
- switch (fcode)
- {
- case IX86_BUILTIN_EMMS:
-- emit_insn (gen_mmx_emms ());
-+ /* emms insn is emitted automatically. */
- return 0;
-
- case IX86_BUILTIN_SFENCE:
-@@ -15354,7 +15689,7 @@
- return target;
-
- case IX86_BUILTIN_FEMMS:
-- emit_insn (gen_mmx_femms ());
-+ /* femms insn is emitted automatically. */
- return NULL_RTX;
-
- case IX86_BUILTIN_PAVGUSB:
-@@ -15500,11 +15835,13 @@
- return ix86_expand_unop_builtin (CODE_FOR_sse3_lddqu, arglist,
- target, 1);
-
-+ case IX86_BUILTIN_VEC_INIT_V2SF:
- case IX86_BUILTIN_VEC_INIT_V2SI:
- case IX86_BUILTIN_VEC_INIT_V4HI:
- case IX86_BUILTIN_VEC_INIT_V8QI:
- return ix86_expand_vec_init_builtin (TREE_TYPE (exp), arglist, target);
-
-+ case IX86_BUILTIN_VEC_EXT_V2SF:
- case IX86_BUILTIN_VEC_EXT_V2DF:
- case IX86_BUILTIN_VEC_EXT_V2DI:
- case IX86_BUILTIN_VEC_EXT_V4SF:
-diff -uNr gcc-4.1-20050818T1605UTC/gcc.orig/config/i386/i386.h gcc-4.1-20050818T1605UTC/gcc/config/i386/i386.h
---- gcc-4.1-20050818T1605UTC/gcc.orig/config/i386/i386.h 2005-08-18 16:01:16.000000000 +0000
-+++ gcc-4.1-20050818T1605UTC/gcc/config/i386/i386.h 2005-08-18 16:25:02.000000000 +0000
-@@ -819,7 +819,9 @@
-
- #define HARD_REGNO_NREGS(REGNO, MODE) \
- (FP_REGNO_P (REGNO) || SSE_REGNO_P (REGNO) || MMX_REGNO_P (REGNO) \
-- ? (COMPLEX_MODE_P (MODE) ? 2 : 1) \
-+ ? ((MODE) == ALLREGSmode \
-+ ? 8 \
-+ : (COMPLEX_MODE_P (MODE) ? 2 : 1)) \
- : ((MODE) == XFmode \
- ? (TARGET_64BIT ? 2 : 3) \
- : (MODE) == XCmode \
-@@ -841,9 +843,8 @@
- ((MODE) == DImode || (MODE) == V8QImode || (MODE) == V4HImode \
- || (MODE) == V2SImode || (MODE) == SImode)
-
--/* ??? No autovectorization into MMX or 3DNOW until we can reliably
-- place emms and femms instructions. */
--#define UNITS_PER_SIMD_WORD (TARGET_SSE ? 16 : UNITS_PER_WORD)
-+#define UNITS_PER_SIMD_WORD \
-+ (TARGET_SSE ? 16 : TARGET_MMX ? 8 : UNITS_PER_WORD)
-
- #define VALID_FP_MODE_P(MODE) \
- ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode \
-@@ -1436,8 +1437,16 @@
- #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) \
- ix86_return_pops_args ((FUNDECL), (FUNTYPE), (SIZE))
-
-+/* 1 if N is the number of a register in which the values of
-+ called function may come back. */
- #define FUNCTION_VALUE_REGNO_P(N) \
-- ix86_function_value_regno_p (N)
-+ ix86_function_value_regno_p ((N), false)
-+
-+/* 1 if N is the number of a register in which the value of
-+ __builtin_return builtin function may come back. */
-+
-+#define FUNCTION_VALUE_REGNO_P_APPLY_RESULT(N) \
-+ ix86_function_value_regno_p ((N), true)
-
- /* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-@@ -1452,7 +1461,13 @@
- #define APPLY_RESULT_SIZE (8+108)
-
- /* 1 if N is a possible register number for function argument passing. */
--#define FUNCTION_ARG_REGNO_P(N) ix86_function_arg_regno_p (N)
-+#define FUNCTION_ARG_REGNO_P(N) ix86_function_arg_regno_p ((N), false)
-+
-+/* 1 if N is a possible register number for function argument passing
-+ from __builtin_apply_args and __builtin_apply builtin functions. */
-+
-+#define FUNCTION_ARG_REGNO_P_APPLY_ARGS(N) \
-+ ix86_function_arg_regno_p ((N), true)
-
- /* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
-@@ -1534,6 +1549,23 @@
-
- #define EXIT_IGNORE_STACK 1
-
-+/* Define this macro as a C expression that is nonzero for registers
-+ that are used by the epilogue or the return' pattern. The stack
-+ and frame pointer registers are already be assumed to be used as
-+ needed. */
-+
-+#define EPILOGUE_USES(REGNO) ix86_epilogue_uses (REGNO)
-+
-+/* Define this macro as a C expression that returns RTL expression of
-+ additional hard register set by call_insn. */
-+
-+#define CALL_INSN_SETS(INSN) ix86_call_insn_sets (INSN)
-+
-+/* Define this macro as a C expression that returns RTL expression of
-+ additional hard register used by call_insn. */
-+
-+#define CALL_INSN_USES(INSN) ix86_call_insn_uses (INSN)
-+
- /* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts. */
-
-@@ -2169,6 +2201,10 @@
- extern rtx ix86_compare_op1; /* operand 1 for comparisons */
- extern rtx ix86_compare_emitted;
- \f
-+
-+/* x87 FPU modes for x87/MMX switching. */
-+enum ix86_fpu_mode { FPU_MODE_X87, FPU_MODE_MMX, FPU_MODE_ANY };
-+
- /* To properly truncate FP values into integers, we need to set i387 control
- word. We can't emit proper mode switching code before reload, as spills
- generated by reload may truncate values incorrectly, but we still can avoid
-@@ -2190,6 +2226,7 @@
- I387_FLOOR,
- I387_CEIL,
- I387_MASK_PM,
-+ I387_FPU_MODE,
- MAX_386_ENTITIES
- };
-
-@@ -2219,7 +2256,12 @@
- refer to the mode-switched entity in question. */
-
- #define NUM_MODES_FOR_MODE_SWITCHING \
-- { I387_CW_ANY, I387_CW_ANY, I387_CW_ANY, I387_CW_ANY }
-+ { I387_CW_ANY, I387_CW_ANY, I387_CW_ANY, I387_CW_ANY, FPU_MODE_ANY }
-+
-+/* Define this macro if the port needs extra register life analysis
-+ after mode switching. */
-+
-+#define LIFE_ANALYSIS_AFTER_MODE_SWITCHING ix86_fpu_mode_changed
-
- /* ENTITY is an integer specifying a mode-switched entity. If
- `OPTIMIZE_MODE_SWITCHING' is defined, you must define this macro to
-@@ -2229,6 +2271,22 @@
-
- #define MODE_NEEDED(ENTITY, I) ix86_mode_needed ((ENTITY), (I))
-
-+/* This macro determines the mode that an INSN results in (if different
-+ from the incoming mode). */
-+
-+#define MODE_AFTER(ENTITY, MODE, I) \
-+ ix86_mode_after ((ENTITY), (MODE), (I))
-+
-+/* This macro specifies a mode that ENTITY is assumed to be
-+ switched to at function entry. */
-+
-+#define MODE_ENTRY(ENTITY) ix86_mode_entry (ENTITY)
-+
-+/* This macro specifies a mode that ENTITY is assumed to be
-+ switched to at function exit. */
-+
-+#define MODE_EXIT(ENTITY) ix86_mode_exit (ENTITY)
-+
- /* This macro specifies the order in which modes for ENTITY are
- processed. 0 is the highest priority. */
-
-@@ -2238,10 +2296,8 @@
- is the set of hard registers live at the point where the insn(s)
- are to be inserted. */
-
--#define EMIT_MODE_SET(ENTITY, MODE, HARD_REGS_LIVE) \
-- ((MODE) != I387_CW_ANY && (MODE) != I387_CW_UNINITIALIZED \
-- ? emit_i387_cw_initialization (MODE), 0 \
-- : 0)
-+#define EMIT_MODE_SET(ENTITY, MODE, HARD_REGS_LIVE) \
-+ ix86_emit_mode_set ((ENTITY), (MODE))
-
- \f
- /* Avoid renaming of stack registers, as doing so in combination with
-@@ -2265,6 +2321,7 @@
- int save_varrargs_registers;
- int accesses_prev_frame;
- int optimize_mode_switching[MAX_386_ENTITIES];
-+ int fpu_mode_changed;
- /* Set by ix86_compute_frame_layout and used by prologue/epilogue expander to
- determine the style used. */
- int use_fast_prologue_epilogue;
-@@ -2276,6 +2333,7 @@
- #define ix86_stack_locals (cfun->machine->stack_locals)
- #define ix86_save_varrargs_registers (cfun->machine->save_varrargs_registers)
- #define ix86_optimize_mode_switching (cfun->machine->optimize_mode_switching)
-+#define ix86_fpu_mode_changed (cfun->machine->fpu_mode_changed)
-
- /* Control behavior of x86_file_start. */
- #define X86_FILE_START_VERSION_DIRECTIVE false
-diff -uNr gcc-4.1-20050818T1605UTC/gcc.orig/config/i386/i386.md gcc-4.1-20050818T1605UTC/gcc/config/i386/i386.md
---- gcc-4.1-20050818T1605UTC/gcc.orig/config/i386/i386.md 2005-08-18 16:01:16.000000000 +0000
-+++ gcc-4.1-20050818T1605UTC/gcc/config/i386/i386.md 2005-08-18 16:25:02.000000000 +0000
-@@ -152,7 +152,7 @@
- (UNSPECV_EMMS 2)
- (UNSPECV_LDMXCSR 3)
- (UNSPECV_STMXCSR 4)
-- (UNSPECV_FEMMS 5)
-+ (UNSPECV_EFPU 5)
- (UNSPECV_CLFLUSH 6)
- (UNSPECV_ALIGN 7)
- (UNSPECV_MONITOR 8)
-@@ -167,9 +167,11 @@
- (define_constants
- [(BP_REG 6)
- (SP_REG 7)
-+ (FIRSTFP_REG 8)
- (FLAGS_REG 17)
- (FPSR_REG 18)
- (DIRFLAG_REG 19)
-+ (FIRSTMMX_REG 29)
- ])
-
- ;; Insns whose names begin with "x86_" are emitted by gen_FOO calls
-diff -uNr gcc-4.1-20050818T1605UTC/gcc.orig/config/i386/mm3dnow.h gcc-4.1-20050818T1605UTC/gcc/config/i386/mm3dnow.h
---- gcc-4.1-20050818T1605UTC/gcc.orig/config/i386/mm3dnow.h 2005-06-28 08:16:53.000000000 +0000
-+++ gcc-4.1-20050818T1605UTC/gcc/config/i386/mm3dnow.h 2005-08-18 16:25:02.000000000 +0000
-@@ -172,14 +172,13 @@
- static __inline __m64
- _m_from_float (float __A)
- {
-- return (__m64)(__v2sf){ __A, 0 };
-+ return (__m64) __builtin_ia32_vec_init_v2sf (__A, 0);
- }
-
- static __inline float
- _m_to_float (__m64 __A)
- {
-- union { __v2sf v; float a[2]; } __tmp = { (__v2sf)__A };
-- return __tmp.a[0];
-+ return __builtin_ia32_vec_ext_v2sf ((__v2sf)__A, 0);
- }
-
- #ifdef __3dNOW_A__
-diff -uNr gcc-4.1-20050818T1605UTC/gcc.orig/config/i386/mmx.md gcc-4.1-20050818T1605UTC/gcc/config/i386/mmx.md
---- gcc-4.1-20050818T1605UTC/gcc.orig/config/i386/mmx.md 2005-06-28 08:16:53.000000000 +0000
-+++ gcc-4.1-20050818T1605UTC/gcc/config/i386/mmx.md 2005-08-18 16:25:02.000000000 +0000
-@@ -23,14 +23,6 @@
- ;; the same register file, and 3dNOW! adds a number of extensions to
- ;; the base integer MMX isa.
-
--;; Note! Except for the basic move instructions, *all* of these
--;; patterns are outside the normal optabs namespace. This is because
--;; use of these registers requires the insertion of emms or femms
--;; instructions to return to normal fpu mode. The compiler doesn't
--;; know how to do that itself, which means it's up to the user. Which
--;; means that we should never use any of these patterns except at the
--;; direction of the user via a builtin.
--
- ;; 8 byte integral modes handled by MMX (and by extension, SSE)
- (define_mode_macro MMXMODEI [V8QI V4HI V2SI])
-
-@@ -481,7 +473,7 @@
- (match_operand 2 "const_int_operand" "")]
- "TARGET_MMX"
- {
-- ix86_expand_vector_set (false, operands[0], operands[1],
-+ ix86_expand_vector_set (true, operands[0], operands[1],
- INTVAL (operands[2]));
- DONE;
- })
-@@ -537,7 +529,7 @@
- (match_operand 2 "const_int_operand" "")]
- "TARGET_MMX"
- {
-- ix86_expand_vector_extract (false, operands[0], operands[1],
-+ ix86_expand_vector_extract (true, operands[0], operands[1],
- INTVAL (operands[2]));
- DONE;
- })
-@@ -547,7 +539,7 @@
- (match_operand 1 "" "")]
- "TARGET_SSE"
- {
-- ix86_expand_vector_init (false, operands[0], operands[1]);
-+ ix86_expand_vector_init (true, operands[0], operands[1]);
- DONE;
- })
-
-@@ -557,6 +549,21 @@
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-+(define_expand "neg<mode>2"
-+ [(set (match_operand:MMXMODEI 0 "register_operand" "")
-+ (minus:MMXMODEI
-+ (match_dup 2)
-+ (match_operand:MMXMODEI 1 "nonimmediate_operand" "")))]
-+ "TARGET_MMX"
-+ "operands[2] = force_reg (<MODE>mode, CONST0_RTX (<MODE>mode));")
-+
-+(define_expand "add<mode>3"
-+ [(set (match_operand:MMXMODEI 0 "register_operand" "")
-+ (plus:MMXMODEI (match_operand:MMXMODEI 1 "nonimmediate_operand" "")
-+ (match_operand:MMXMODEI 2 "nonimmediate_operand" "")))]
-+ "TARGET_MMX"
-+ "ix86_fixup_binary_operands_no_copy (PLUS, <MODE>mode, operands);")
-+
- (define_insn "mmx_add<mode>3"
- [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
- (plus:MMXMODEI
-@@ -598,6 +605,13 @@
- [(set_attr "type" "mmxadd")
- (set_attr "mode" "DI")])
-
-+(define_expand "sub<mode>3"
-+ [(set (match_operand:MMXMODEI 0 "register_operand" "")
-+ (minus:MMXMODEI (match_operand:MMXMODEI 1 "register_operand" "")
-+ (match_operand:MMXMODEI 2 "nonimmediate_operand" "")))]
-+ "TARGET_MMX"
-+ "ix86_fixup_binary_operands_no_copy (MINUS, <MODE>mode, operands);")
-+
- (define_insn "mmx_sub<mode>3"
- [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
- (minus:MMXMODEI
-@@ -639,6 +653,13 @@
- [(set_attr "type" "mmxadd")
- (set_attr "mode" "DI")])
-
-+(define_expand "mulv4hi3"
-+ [(set (match_operand:V4HI 0 "register_operand" "")
-+ (mult:V4HI (match_operand:V4HI 1 "nonimmediate_operand" "")
-+ (match_operand:V4HI 2 "nonimmediate_operand" "")))]
-+ "TARGET_MMX"
-+ "ix86_fixup_binary_operands_no_copy (MULT, V4HImode, operands);")
-+
- (define_insn "mmx_mulv4hi3"
- [(set (match_operand:V4HI 0 "register_operand" "=y")
- (mult:V4HI (match_operand:V4HI 1 "nonimmediate_operand" "%0")
-@@ -735,6 +756,13 @@
- [(set_attr "type" "mmxmul")
- (set_attr "mode" "DI")])
-
-+(define_expand "umaxv8qi3"
-+ [(set (match_operand:V8QI 0 "register_operand" "")
-+ (umax:V8QI (match_operand:V8QI 1 "nonimmediate_operand" "")
-+ (match_operand:V8QI 2 "nonimmediate_operand" "")))]
-+ "(TARGET_SSE || TARGET_3DNOW_A)"
-+ "ix86_fixup_binary_operands_no_copy (UMAX, V8QImode, operands);")
-+
- (define_insn "mmx_umaxv8qi3"
- [(set (match_operand:V8QI 0 "register_operand" "=y")
- (umax:V8QI (match_operand:V8QI 1 "nonimmediate_operand" "%0")
-@@ -745,6 +773,13 @@
- [(set_attr "type" "mmxadd")
- (set_attr "mode" "DI")])
-
-+(define_expand "smaxv4hi3"
-+ [(set (match_operand:V4HI 0 "register_operand" "")
-+ (smax:V4HI (match_operand:V4HI 1 "nonimmediate_operand" "")
-+ (match_operand:V4HI 2 "nonimmediate_operand" "")))]
-+ "(TARGET_SSE || TARGET_3DNOW_A)"
-+ "ix86_fixup_binary_operands_no_copy (SMAX, V4HImode, operands);")
-+
- (define_insn "mmx_smaxv4hi3"
- [(set (match_operand:V4HI 0 "register_operand" "=y")
- (smax:V4HI (match_operand:V4HI 1 "nonimmediate_operand" "%0")
-@@ -755,6 +790,13 @@
- [(set_attr "type" "mmxadd")
- (set_attr "mode" "DI")])
-
-+(define_expand "uminv8qi3"
-+ [(set (match_operand:V8QI 0 "register_operand" "")
-+ (umin:V8QI (match_operand:V8QI 1 "nonimmediate_operand" "")
-+ (match_operand:V8QI 2 "nonimmediate_operand" "")))]
-+ "(TARGET_SSE || TARGET_3DNOW_A)"
-+ "ix86_fixup_binary_operands_no_copy (UMAX, V8QImode, operands);")
-+
- (define_insn "mmx_uminv8qi3"
- [(set (match_operand:V8QI 0 "register_operand" "=y")
- (umin:V8QI (match_operand:V8QI 1 "nonimmediate_operand" "%0")
-@@ -765,6 +807,13 @@
- [(set_attr "type" "mmxadd")
- (set_attr "mode" "DI")])
-
-+(define_expand "sminv4hi3"
-+ [(set (match_operand:V4HI 0 "register_operand" "")
-+ (smin:V4HI (match_operand:V4HI 1 "nonimmediate_operand" "")
-+ (match_operand:V4HI 2 "nonimmediate_operand" "")))]
-+ "(TARGET_SSE || TARGET_3DNOW_A)"
-+ "ix86_fixup_binary_operands_no_copy (SMIN, V4HImode, operands);")
-+
- (define_insn "mmx_sminv4hi3"
- [(set (match_operand:V4HI 0 "register_operand" "=y")
- (smin:V4HI (match_operand:V4HI 1 "nonimmediate_operand" "%0")
-@@ -775,7 +824,7 @@
- [(set_attr "type" "mmxadd")
- (set_attr "mode" "DI")])
-
--(define_insn "mmx_ashr<mode>3"
-+(define_insn "ashr<mode>3"
- [(set (match_operand:MMXMODE24 0 "register_operand" "=y")
- (ashiftrt:MMXMODE24
- (match_operand:MMXMODE24 1 "register_operand" "0")
-@@ -785,7 +834,7 @@
- [(set_attr "type" "mmxshft")
- (set_attr "mode" "DI")])
-
--(define_insn "mmx_lshr<mode>3"
-+(define_insn "lshr<mode>3"
- [(set (match_operand:MMXMODE24 0 "register_operand" "=y")
- (lshiftrt:MMXMODE24
- (match_operand:MMXMODE24 1 "register_operand" "0")
-@@ -806,7 +855,7 @@
- [(set_attr "type" "mmxshft")
- (set_attr "mode" "DI")])
-
--(define_insn "mmx_ashl<mode>3"
-+(define_insn "ashl<mode>3"
- [(set (match_operand:MMXMODE24 0 "register_operand" "=y")
- (ashift:MMXMODE24
- (match_operand:MMXMODE24 1 "register_operand" "0")
-@@ -853,12 +902,66 @@
- [(set_attr "type" "mmxcmp")
- (set_attr "mode" "DI")])
-
-+(define_expand "vcond<mode>"
-+ [(set (match_operand:MMXMODE12 0 "register_operand" "")
-+ (if_then_else:MMXMODE12
-+ (match_operator 3 ""
-+ [(match_operand:MMXMODE12 4 "nonimmediate_operand" "")
-+ (match_operand:MMXMODE12 5 "nonimmediate_operand" "")])
-+ (match_operand:MMXMODE12 1 "general_operand" "")
-+ (match_operand:MMXMODE12 2 "general_operand" "")))]
-+ "TARGET_MMX"
-+{
-+ if (ix86_expand_int_vcond (operands))
-+ DONE;
-+ else
-+ FAIL;
-+})
-+
-+(define_expand "vconduv8qi"
-+ [(set (match_operand:V8QI 0 "register_operand" "")
-+ (if_then_else:V8QI
-+ (match_operator 3 ""
-+ [(match_operand:V8QI 4 "nonimmediate_operand" "")
-+ (match_operand:V8QI 5 "nonimmediate_operand" "")])
-+ (match_operand:V8QI 1 "general_operand" "")
-+ (match_operand:V8QI 2 "general_operand" "")))]
-+ "TARGET_MMX"
-+{
-+ if (ix86_expand_int_vcond (operands))
-+ DONE;
-+ else
-+ FAIL;
-+})
-+
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Parallel integral logical operations
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-+(define_expand "one_cmpl<mode>2"
-+ [(set (match_operand:MMXMODEI 0 "register_operand" "")
-+ (xor:MMXMODEI (match_operand:MMXMODEI 1 "nonimmediate_operand" "")
-+ (match_dup 2)))]
-+ "TARGET_MMX"
-+{
-+ int i, n = GET_MODE_NUNITS (<MODE>mode);
-+ rtvec v = rtvec_alloc (n);
-+
-+ for (i = 0; i < n; ++i)
-+ RTVEC_ELT (v, i) = constm1_rtx;
-+
-+ operands[2] = force_reg (<MODE>mode, gen_rtx_CONST_VECTOR (<MODE>mode, v));
-+})
-+
-+(define_expand "and<mode>3"
-+ [(set (match_operand:MMXMODEI 0 "register_operand" "")
-+ (and:MMXMODEI (match_operand:MMXMODEI 1 "nonimmediate_operand" "")
-+ (match_operand:MMXMODEI 2 "nonimmediate_operand" "")))]
-+ "TARGET_MMX"
-+ "ix86_fixup_binary_operands_no_copy (AND, <MODE>mode, operands);")
-+
- (define_insn "mmx_and<mode>3"
- [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
- (and:MMXMODEI
-@@ -879,6 +982,13 @@
- [(set_attr "type" "mmxadd")
- (set_attr "mode" "DI")])
-
-+(define_expand "ior<mode>3"
-+ [(set (match_operand:MMXMODEI 0 "register_operand" "")
-+ (ior:MMXMODEI (match_operand:MMXMODEI 1 "nonimmediate_operand" "")
-+ (match_operand:MMXMODEI 2 "nonimmediate_operand" "")))]
-+ "TARGET_MMX"
-+ "ix86_fixup_binary_operands_no_copy (IOR, <MODE>mode, operands);")
-+
- (define_insn "mmx_ior<mode>3"
- [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
- (ior:MMXMODEI
-@@ -889,6 +999,13 @@
- [(set_attr "type" "mmxadd")
- (set_attr "mode" "DI")])
-
-+(define_expand "xor<mode>3"
-+ [(set (match_operand:MMXMODEI 0 "register_operand" "")
-+ (xor:MMXMODEI (match_operand:MMXMODEI 1 "nonimmediate_operand" "")
-+ (match_operand:MMXMODEI 2 "nonimmediate_operand" "")))]
-+ "TARGET_MMX"
-+ "ix86_fixup_binary_operands_no_copy (XOR, <MODE>mode, operands);")
-+
- (define_insn "mmx_xor<mode>3"
- [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
- (xor:MMXMODEI
-@@ -1147,7 +1264,7 @@
- (match_operand 2 "const_int_operand" "")]
- "TARGET_MMX"
- {
-- ix86_expand_vector_set (false, operands[0], operands[1],
-+ ix86_expand_vector_set (true, operands[0], operands[1],
- INTVAL (operands[2]));
- DONE;
- })
-@@ -1205,7 +1322,7 @@
- (match_operand 2 "const_int_operand" "")]
- "TARGET_MMX"
- {
-- ix86_expand_vector_extract (false, operands[0], operands[1],
-+ ix86_expand_vector_extract (true, operands[0], operands[1],
- INTVAL (operands[2]));
- DONE;
- })
-@@ -1215,7 +1332,7 @@
- (match_operand 1 "" "")]
- "TARGET_SSE"
- {
-- ix86_expand_vector_init (false, operands[0], operands[1]);
-+ ix86_expand_vector_init (true, operands[0], operands[1]);
- DONE;
- })
-
-@@ -1225,7 +1342,7 @@
- (match_operand 2 "const_int_operand" "")]
- "TARGET_MMX"
- {
-- ix86_expand_vector_set (false, operands[0], operands[1],
-+ ix86_expand_vector_set (true, operands[0], operands[1],
- INTVAL (operands[2]));
- DONE;
- })
-@@ -1236,7 +1353,7 @@
- (match_operand 2 "const_int_operand" "")]
- "TARGET_MMX"
- {
-- ix86_expand_vector_extract (false, operands[0], operands[1],
-+ ix86_expand_vector_extract (true, operands[0], operands[1],
- INTVAL (operands[2]));
- DONE;
- })
-@@ -1246,7 +1363,7 @@
- (match_operand 1 "" "")]
- "TARGET_SSE"
- {
-- ix86_expand_vector_init (false, operands[0], operands[1]);
-+ ix86_expand_vector_init (true, operands[0], operands[1]);
- DONE;
- })
-
-@@ -1256,7 +1373,7 @@
- (match_operand 2 "const_int_operand" "")]
- "TARGET_MMX"
- {
-- ix86_expand_vector_set (false, operands[0], operands[1],
-+ ix86_expand_vector_set (true, operands[0], operands[1],
- INTVAL (operands[2]));
- DONE;
- })
-@@ -1267,7 +1384,7 @@
- (match_operand 2 "const_int_operand" "")]
- "TARGET_MMX"
- {
-- ix86_expand_vector_extract (false, operands[0], operands[1],
-+ ix86_expand_vector_extract (true, operands[0], operands[1],
- INTVAL (operands[2]));
- DONE;
- })
-@@ -1277,7 +1394,7 @@
- (match_operand 1 "" "")]
- "TARGET_SSE"
- {
-- ix86_expand_vector_init (false, operands[0], operands[1]);
-+ ix86_expand_vector_init (true, operands[0], operands[1]);
- DONE;
- })
-
-@@ -1386,48 +1503,20 @@
- [(set_attr "type" "mmxcvt")
- (set_attr "mode" "DI")])
-
--(define_insn "mmx_emms"
-- [(unspec_volatile [(const_int 0)] UNSPECV_EMMS)
-- (clobber (reg:XF 8))
-- (clobber (reg:XF 9))
-- (clobber (reg:XF 10))
-- (clobber (reg:XF 11))
-- (clobber (reg:XF 12))
-- (clobber (reg:XF 13))
-- (clobber (reg:XF 14))
-- (clobber (reg:XF 15))
-- (clobber (reg:DI 29))
-- (clobber (reg:DI 30))
-- (clobber (reg:DI 31))
-- (clobber (reg:DI 32))
-- (clobber (reg:DI 33))
-- (clobber (reg:DI 34))
-- (clobber (reg:DI 35))
-- (clobber (reg:DI 36))]
-- "TARGET_MMX"
-- "emms"
-- [(set_attr "type" "mmx")
-- (set_attr "memory" "unknown")])
-+(define_insn "efpu"
-+ [(set (reg:ALLREGS FIRSTFP_REG)
-+ (unspec_volatile:ALLREGS [(reg:ALLREGS FIRSTMMX_REG)]
-+ UNSPECV_EFPU))]
-+ "TARGET_80387 && TARGET_MMX"
-+ ""
-+ [(set_attr "length" "0")])
-+
-+(define_insn "emms"
-+ [(set (reg:ALLREGS FIRSTMMX_REG)
-+ (unspec_volatile:ALLREGS [(reg:ALLREGS FIRSTFP_REG)]
-+ UNSPECV_EMMS))]
-+ "TARGET_80387 && TARGET_MMX"
-+{
-+ return TARGET_3DNOW ? "femms" : "emms";
-+})
-
--(define_insn "mmx_femms"
-- [(unspec_volatile [(const_int 0)] UNSPECV_FEMMS)
-- (clobber (reg:XF 8))
-- (clobber (reg:XF 9))
-- (clobber (reg:XF 10))
-- (clobber (reg:XF 11))
-- (clobber (reg:XF 12))
-- (clobber (reg:XF 13))
-- (clobber (reg:XF 14))
-- (clobber (reg:XF 15))
-- (clobber (reg:DI 29))
-- (clobber (reg:DI 30))
-- (clobber (reg:DI 31))
-- (clobber (reg:DI 32))
-- (clobber (reg:DI 33))
-- (clobber (reg:DI 34))
-- (clobber (reg:DI 35))
-- (clobber (reg:DI 36))]
-- "TARGET_3DNOW"
-- "femms"
-- [(set_attr "type" "mmx")
-- (set_attr "memory" "none")])
-diff -uNr gcc-4.1-20050818T1605UTC/gcc.orig/config/i386/sse.md gcc-4.1-20050818T1605UTC/gcc/config/i386/sse.md
---- gcc-4.1-20050818T1605UTC/gcc.orig/config/i386/sse.md 2005-08-18 16:01:16.000000000 +0000
-+++ gcc-4.1-20050818T1605UTC/gcc/config/i386/sse.md 2005-08-18 16:25:02.000000000 +0000
-@@ -881,6 +881,7 @@
- "TARGET_SSE"
- "cvtpi2ps\t{%2, %0|%0, %2}"
- [(set_attr "type" "ssecvt")
-+ (set_attr "unit" "mmx")
- (set_attr "mode" "V4SF")])
-
- (define_insn "sse_cvtps2pi"
-@@ -3508,6 +3509,7 @@
- movhps\t{%2, %0|%0, %2}
- movlps\t{%1, %0|%0, %1}"
- [(set_attr "type" "ssemov,ssemov,sselog,ssemov,ssemov,ssemov")
-+ (set_attr "unit" "*,mmx,*,*,*,*")
- (set_attr "mode" "TI,TI,TI,V4SF,V2SF,V2SF")])
-
- (define_expand "vec_setv2di"
-diff -uNr gcc-4.1-20050818T1605UTC/gcc.orig/config/sh/sh.h gcc-4.1-20050818T1605UTC/gcc/config/sh/sh.h
---- gcc-4.1-20050818T1605UTC/gcc.orig/config/sh/sh.h 2005-08-18 16:01:22.000000000 +0000
-+++ gcc-4.1-20050818T1605UTC/gcc/config/sh/sh.h 2005-08-18 16:25:02.000000000 +0000
-@@ -3311,7 +3311,7 @@
- ? get_attr_fp_mode (INSN) \
- : FP_MODE_NONE)
-
--#define MODE_AFTER(MODE, INSN) \
-+#define MODE_AFTER(ENTITY, MODE, INSN) \
- (TARGET_HITACHI \
- && recog_memoized (INSN) >= 0 \
- && get_attr_fp_set (INSN) != FP_SET_NONE \
-diff -uNr gcc-4.1-20050818T1605UTC/gcc.orig/doc/tm.texi gcc-4.1-20050818T1605UTC/gcc/doc/tm.texi
---- gcc-4.1-20050818T1605UTC/gcc.orig/doc/tm.texi 2005-08-18 16:01:28.000000000 +0000
-+++ gcc-4.1-20050818T1605UTC/gcc/doc/tm.texi 2005-08-18 16:25:02.000000000 +0000
-@@ -4227,6 +4227,16 @@
- compiler knows this regardless of @code{EXIT_IGNORE_STACK}.
- @end defmac
-
-+@defmac CALL_INSN_SETS (@var{INSN})
-+Define this macro as a C expression that returns RTL expression of
-+additional hard register set by call_insn.
-+@end defmac
-+
-+@defmac CALL_INSN_USES (@var{INSN})
-+Define this macro as a C expression that returns RTL expression of
-+additional hard register used by call_insn.
-+@end defmac
-+
- @defmac EPILOGUE_USES (@var{regno})
- Define this macro as a C expression that is nonzero for registers that are
- used by the epilogue or the @samp{return} pattern. The stack and frame
-@@ -8376,6 +8386,13 @@
- switch is needed / supplied.
- @end defmac
-
-+@defmac LIFE_ANALYSIS_AFTER_MODE_SWITCHING
-+Define this macro if the port needs extra register life analysis after
-+mode switching. This macro should be defined if mode switching inserts
-+instructions that change global registers to maintain consistent global
-+register life information.
-+@end defmac
-+
- @defmac MODE_NEEDED (@var{entity}, @var{insn})
- @var{entity} is an integer specifying a mode-switched entity. If
- @code{OPTIMIZE_MODE_SWITCHING} is defined, you must define this macro to
-@@ -8384,9 +8401,9 @@
- be switched into prior to the execution of @var{insn}.
- @end defmac
-
--@defmac MODE_AFTER (@var{mode}, @var{insn})
--If this macro is defined, it is evaluated for every @var{insn} during
--mode switching. It determines the mode that an insn results in (if
-+@defmac MODE_AFTER (@var{entity}, @var{mode}, @var{insn})
-+If this macro is defined, it is evaluated for every @var{entity} that needs
-+mode switching. It determines the mode that an @var{insn} results in (if
- different from the incoming mode).
- @end defmac
-
-diff -uNr gcc-4.1-20050818T1605UTC/gcc.orig/flow.c gcc-4.1-20050818T1605UTC/gcc/flow.c
---- gcc-4.1-20050818T1605UTC/gcc.orig/flow.c 2005-08-18 16:00:40.000000000 +0000
-+++ gcc-4.1-20050818T1605UTC/gcc/flow.c 2005-08-18 16:25:02.000000000 +0000
-@@ -1830,10 +1830,11 @@
- {
- regset live_at_end;
- bool sibcall_p;
-- rtx note, cond;
-+ rtx note;
-+ rtx cond = NULL_RTX;
-+ rtx reg ATTRIBUTE_UNUSED;
- int i;
-
-- cond = NULL_RTX;
- if (GET_CODE (PATTERN (insn)) == COND_EXEC)
- cond = COND_EXEC_TEST (PATTERN (insn));
-
-@@ -1856,6 +1857,13 @@
- mark_set_1 (pbi, CLOBBER, XEXP (XEXP (note, 0), 0),
- cond, insn, pbi->flags);
-
-+#ifdef CALL_INSN_SETS
-+ reg = CALL_INSN_SETS (insn);
-+
-+ if (reg)
-+ mark_set_1 (pbi, SET, reg, cond, insn, pbi->flags);
-+#endif
-+
- /* Calls change all call-used and global registers; sibcalls do not
- clobber anything that must be preserved at end-of-function,
- except for return values. */
-@@ -1894,10 +1902,11 @@
-
- if (! insn_is_dead && CALL_P (insn))
- {
-+ rtx note;
-+ rtx cond = NULL_RTX;
-+ rtx reg ATTRIBUTE_UNUSED;
- int i;
-- rtx note, cond;
-
-- cond = NULL_RTX;
- if (GET_CODE (PATTERN (insn)) == COND_EXEC)
- cond = COND_EXEC_TEST (PATTERN (insn));
-
-@@ -1910,6 +1919,13 @@
- of which mark_used_regs knows how to handle. */
- mark_used_regs (pbi, XEXP (XEXP (note, 0), 0), cond, insn);
-
-+#ifdef CALL_INSN_USES
-+ reg = CALL_INSN_USES (insn);
-+
-+ if (reg)
-+ mark_used_reg (pbi, reg, cond, insn);
-+#endif
-+
- /* The stack ptr is used (honorarily) by a CALL insn. */
- if ((flags & PROP_REG_INFO)
- && !REGNO_REG_SET_P (pbi->reg_live, STACK_POINTER_REGNUM))
-diff -uNr gcc-4.1-20050818T1605UTC/gcc.orig/mode-switching.c gcc-4.1-20050818T1605UTC/gcc/mode-switching.c
---- gcc-4.1-20050818T1605UTC/gcc.orig/mode-switching.c 2005-08-18 16:00:42.000000000 +0000
-+++ gcc-4.1-20050818T1605UTC/gcc/mode-switching.c 2005-08-18 16:25:02.000000000 +0000
-@@ -473,7 +473,7 @@
- RESET_BIT (transp[bb->index], j);
- }
- #ifdef MODE_AFTER
-- last_mode = MODE_AFTER (last_mode, insn);
-+ last_mode = MODE_AFTER (e, last_mode, insn);
- #endif
- /* Update LIVE_NOW. */
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
-@@ -730,6 +730,14 @@
- no_new_pseudos = 0;
- optimize_mode_switching (NULL);
- no_new_pseudos = 1;
-+
-+ /* Mode switching can insert instructions that
-+ change global registers life data. */
-+#ifdef LIFE_ANALYSIS_AFTER_MODE_SWITCHING
-+ if (LIFE_ANALYSIS_AFTER_MODE_SWITCHING)
-+ life_analysis (NULL, PROP_REG_INFO);
-+#endif
-+
- #endif /* OPTIMIZE_MODE_SWITCHING */
- }
-
-diff -uNr gcc-4.1-20050818T1605UTC/gcc.orig/reg-stack.c gcc-4.1-20050818T1605UTC/gcc/reg-stack.c
---- gcc-4.1-20050818T1605UTC/gcc.orig/reg-stack.c 2005-08-18 16:00:43.000000000 +0000
-+++ gcc-4.1-20050818T1605UTC/gcc/reg-stack.c 2005-08-18 16:25:02.000000000 +0000
-@@ -1579,6 +1579,41 @@
- }
- break;
-
-+ case UNSPEC_VOLATILE:
-+ switch (XINT (pat_src, 1))
-+ {
-+ int i;
-+
-+ case UNSPECV_EFPU:
-+ /* There should be no stack registers live
-+ at this point. */
-+ gcc_assert (regstack->top == -1);
-+
-+ /* Mark all x87 registers as used. */
-+ for (i = LAST_STACK_REG; i >= FIRST_STACK_REG; i--)
-+ {
-+ regstack->reg[++regstack->top] = i;
-+ SET_HARD_REG_BIT (regstack->reg_set, i);
-+ }
-+ break;
-+
-+ case UNSPECV_EMMS:
-+ /* All stack registers should be alive
-+ at this point. */
-+ gcc_assert (regstack->top == REG_STACK_SIZE - 1);
-+
-+ /* Mark all x87 registers as empty. */
-+ for (i = LAST_STACK_REG; i >= FIRST_STACK_REG; i--)
-+ CLEAR_HARD_REG_BIT (regstack->reg_set, i);
-+
-+ regstack->top = -1;
-+ break;
-+
-+ default:
-+ gcc_unreachable ();
-+ }
-+ break;
-+
- case UNSPEC:
- switch (XINT (pat_src, 1))
- {
-@@ -2269,6 +2304,25 @@
- if (NOTE_P (insn) || INSN_DELETED_P (insn))
- return control_flow_insn_deleted;
-
-+#ifdef CALL_INSN_SETS
-+ if (CALL_P (insn))
-+ {
-+ rtx reg = CALL_INSN_SETS (insn);
-+
-+ if (reg && STACK_REG_P (reg))
-+ {
-+ int count;
-+
-+ for (count = hard_regno_nregs[REGNO (reg)][GET_MODE (reg)];
-+ --count >= 0;)
-+ {
-+ regstack->reg[++regstack->top] = REGNO (reg) + count;
-+ SET_HARD_REG_BIT (regstack->reg_set, REGNO (reg) + count);
-+ }
-+ }
-+ }
-+#endif
-+
- /* If there is a REG_UNUSED note on a stack register on this insn,
- the indicated reg must be popped. The REG_UNUSED note is removed,
- since the form of the newly emitted pop insn references the reg,
-@@ -2544,6 +2598,15 @@
- basic_block block = e->dest;
- block_info bi = BLOCK_INFO (block);
- int reg, top = -1;
-+ int numregs = 0;
-+
-+ /* Check if all stack registers are live at function entry.
-+ This is the case where stack registers are disabled and no
-+ register initialization is needed. */
-+
-+ for (reg = LAST_STACK_REG; reg >= FIRST_STACK_REG; --reg)
-+ if (TEST_HARD_REG_BIT (bi->stack_in.reg_set, reg))
-+ numregs++;
-
- for (reg = LAST_STACK_REG; reg >= FIRST_STACK_REG; --reg)
- if (TEST_HARD_REG_BIT (bi->stack_in.reg_set, reg))
-@@ -2552,11 +2615,14 @@
-
- bi->stack_in.reg[++top] = reg;
-
-- init = gen_rtx_SET (VOIDmode,
-- FP_MODE_REG (FIRST_STACK_REG, SFmode),
-- not_a_num);
-- insert_insn_on_edge (init, e);
-- inserted = 1;
-+ if (numregs != REG_STACK_SIZE)
-+ {
-+ init = gen_rtx_SET (VOIDmode,
-+ FP_MODE_REG (FIRST_STACK_REG, SFmode),
-+ not_a_num);
-+ insert_insn_on_edge (init, e);
-+ inserted = 1;
-+ }
- }
-
- bi->stack_in.top = top;
-@@ -2575,13 +2641,34 @@
- stack output_stack;
- rtx retvalue;
-
-- retvalue = stack_result (current_function_decl);
- value_reg_low = value_reg_high = -1;
-- if (retvalue)
-+
-+#ifdef EPILOGUE_USES
-+ {
-+ int numregs = 0;
-+ int i;
-+
-+ for (i = FIRST_STACK_REG; i < LAST_STACK_REG + 1; i++)
-+ if (EPILOGUE_USES (i))
-+ numregs++;
-+
-+ if (numregs)
-+ {
-+ value_reg_low = FIRST_STACK_REG;
-+ value_reg_high = value_reg_low + numregs - 1;
-+ }
-+ }
-+#endif
-+
-+ if (value_reg_low < 0)
- {
-- value_reg_low = REGNO (retvalue);
-- value_reg_high = value_reg_low
-- + hard_regno_nregs[value_reg_low][GET_MODE (retvalue)] - 1;
-+ retvalue = stack_result (current_function_decl);
-+ if (retvalue)
-+ {
-+ value_reg_low = REGNO (retvalue);
-+ value_reg_high = value_reg_low
-+ + hard_regno_nregs[value_reg_low][GET_MODE (retvalue)] - 1;
-+ }
- }
-
- output_stack = &BLOCK_INFO (EXIT_BLOCK_PTR)->stack_in;
+++ /dev/null
-#
-# TODO:
-# checking for XTestQueryExtension in -lXtst... no
-# configure: error: libXtst not found, required by java.awt.Robot
-# make[2]: *** [configure-target-libjava] Error 1
-#
-# Conditional build:
-%bcond_without ada # build without ADA support
-%bcond_without cxx # build without C++ support
-%bcond_without fortran # build without Fortran support
-%bcond_without java # build without Java support
-%bcond_without objc # build without Objective-C support
-%bcond_without objcxx # build without Objective-C++ support
-%bcond_with multilib # build with multilib support (it needs glibc[32&64]-devel)
-%bcond_with profiling # build with profiling
-%bcond_without bootstrap # omit 3-stage bootstrap
-%bcond_with tests # torture gcc
-
-%if %{with multilib}
-# the latest chrpath(64) can't handle 32-bit binaries :/
-%define _noautochrpath .*/lib/.*\\.so.*
-%endif
-
-%if %{without cxx}
-%undefine with_java
-%undefine with_objcxx
-%endif
-
-%if %{without objc}
-%undefine with_objcxx
-%endif
-
-%if %{without bootstrap}
-%undefine with_profiling
-%endif
-
-%ifnarch %{x8664} ppc64 s390x sparc64
-%undefine with_multilib
-%endif
-
-Summary: GNU Compiler Collection: the C compiler and shared files
-Summary(es): Colección de compiladores GNU: el compilador C y ficheros compartidos
-Summary(pl): Kolekcja kompilatorów GNU: kompilator C i pliki wspó³dzielone
-Summary(pt_BR): Coleção dos compiladores GNU: o compilador C e arquivos compartilhados
-Name: gcc
-Version: 4.1.0
-%define _snap 20051126r107546
-Release: 0.%{_snap}.2
-Epoch: 5
-License: GPL v2+
-Group: Development/Languages
-#Source0: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{version}/%{name}-%{version}.tar.bz2
-#Source0: ftp://gcc.gnu.org/pub/gcc/snapshots/4.1-%{_snap}/gcc-4.1-%{_snap}.tar.bz2
-Source0: gcc-4.1-%{_snap}.tar.bz2
-# Source0-md5: 75028aa85a2c604505a8706c6c813c94
-Source1: %{name}-optimize-la.pl
-Patch0: %{name}-info.patch
-Patch1: %{name}-nolocalefiles.patch
-Patch2: %{name}-nodebug.patch
-Patch3: %{name}-ada-link-new-libgnat.patch
-Patch4: %{name}-ada-link.patch
-Patch5: %{name}-alpha-ada_fix.patch
-# -fvisibility fixes...
-Patch6: %{name}-pr19664_gnu_internal.patch
-Patch7: %{name}-pr19664_libstdc++.patch
-
-#Patch9: %{name}-enable-java-awt-qt.patch NEEDS UPDATE
-# PRs
-Patch10: %{name}-pr7776.patch
-Patch11: %{name}-pr20297.patch
-Patch12: %{name}-pr22533.patch
-
-#Patch14: %{name}-x87-mmx-switch.patch NEEDS UPDATE
-#Patch15: %{name}-x87-mmx-eh.patch NEEDS UPDATE
-Patch16: %{name}-pr23948.patch
-Patch17: %{name}-pr19505.patch
-Patch18: %{name}-pr24419.patch
-Patch19: %{name}-pr24669.patch
-Patch20: %{name}-pr17390.patch
-URL: http://gcc.gnu.org/
-#{?with_java:BuildRequires: QtGui-devel >= 4.0.1}
-%{?with_java:BuildRequires: alsa-lib-devel}
-BuildRequires: autoconf
-%{?with_tests:BuildRequires: autogen}
-BuildRequires: automake
-BuildRequires: binutils >= 2:2.15.94.0.1
-BuildRequires: bison
-%{?with_java:BuildRequires: cairo-devel >= 0.5.0}
-%{?with_java:BuildRequires: dssi}
-%{?with_tests:BuildRequires: dejagnu}
-BuildRequires: fileutils >= 4.0.41
-BuildRequires: flex
-%if %{with ada}
-BuildRequires: gcc(ada)
-BuildRequires: gcc-ada
-%endif
-BuildRequires: gettext-devel
-%if %{with multilib}
-BuildRequires: glibc-devel >= 6:2.3.4-1.5
-%ifarch %{x8664}
-BuildRequires: glibc-devel(i686)
-%endif
-%ifarch ppc64
-BuildRequires: glibc-devel(ppc)
-%endif
-%ifarch s390x
-BuildRequires: glibc-devel(s390)
-%endif
-%ifarch sparc64
-BuildRequires: glibc-devel(sparc)
-%endif
-%else
-BuildRequires: glibc-devel >= 2.2.5-20
-%endif
-#{?with_java:BuildRequires: gtk+2-devel >= 2.4.0}
-%if %{with fortran}
-BuildRequires: gmp-devel
-BuildRequires: libmpfr-devel
-%endif
-%{?with_java:BuildRequires: libxslt-devel}
-%{?with_java:BuildRequires: pango-devel}
-BuildRequires: perl-devel
-%{?with_java:BuildRequires: pkgconfig}
-BuildRequires: rpmbuild(macros) >= 1.211
-BuildRequires: texinfo >= 4.1
-BuildRequires: zlib-devel
-# AS_NEEDED directive for dynamic linker
-# http://sources.redhat.com/ml/glibc-cvs/2005-q1/msg00614.html
-# http://sources.redhat.com/ml/binutils/2005-01/msg00288.html
-Requires: binutils >= 2:2.16.90.0.1-0.3
-Requires: libgcc = %{epoch}:%{version}-%{release}
-Provides: cpp = %{epoch}:%{version}-%{release}
-%{?with_ada:Provides: gcc(ada)}
-%{?with_multilib:Provides: gcc(multilib)}
-Obsoletes: cpp
-Obsoletes: egcs-cpp
-Obsoletes: gcc-chill
-Obsoletes: gcc-cpp
-Obsoletes: gcc-ksi
-Obsoletes: gont
-Conflicts: glibc-devel < 2.2.5-20
-BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-
-%define _slibdir /%{_lib}
-%if %{with multilib}
-# 32-bit environment on x86-64,ppc64,s390x,sparc64
-%define _slibdir32 /lib
-%define _libdir32 /usr/lib
-%endif
-
-%description
-A compiler aimed at integrating all the optimizations and features
-necessary for a high-performance and stable development environment.
-
-This package contains the C compiler and some files shared by various
-parts of the GNU Compiler Collection. In order to use another GCC
-compiler you will need to install the appropriate subpackage.
-
-%description -l es
-Un compilador que intenta integrar todas las optimalizaciones y
-caracterÃsticas necesarias para un entorno de desarrollo eficaz y
-estable.
-
-Este paquete contiene el compilador de C y unos ficheros compartidos
-por varias partes de la colección de compiladores GNU (GCC). Para usar
-otro compilador de GCC será necesario que instale el subpaquete
-adecuado.
-
-%description -l pl
-Kompilator, posiadaj±cy du¿e mo¿liwo¶ci optymalizacyjne niezbêdne do
-wyprodukowania szybkiego i stabilnego kodu wynikowego.
-
-Ten pakiet zawiera kompilator C i pliki wspó³dzielone przez ró¿ne
-czê¶ci kolekcji kompilatorów GNU (GCC). ¯eby u¿ywaæ innego kompilatora
-z GCC, trzeba zainstalowaæ odpowiedni podpakiet.
-
-%description -l pt_BR
-Este pacote adiciona infraestrutura básica e suporte a linguagem C ao
-GNU Compiler Collection.
-
-%package -n libgcc
-Summary: Shared gcc library
-Summary(es): Biblioteca compartida de gcc
-Summary(pl): Biblioteka gcc
-Summary(pt_BR): Biblioteca runtime para o GCC
-License: GPL with unlimited link permission
-Group: Libraries
-Obsoletes: libgcc1
-
-%description -n libgcc
-Shared gcc library.
-
-%description -n libgcc -l es
-Biblioteca compartida de gcc.
-
-%description -n libgcc -l pl
-Biblioteka dynamiczna gcc.
-
-%description -n libgcc -l pt_BR
-Biblioteca runtime para o GCC.
-
-%package -n libmudflap
-Summary: GCC mudflap shared support library
-Summary(pl): Wspó³dzielona biblioteka wspomagaj±ca GCC mudflap
-License: GPL v2+ with unlimited link permission
-Group: Libraries
-
-%description -n libmudflap
-The libmudflap libraries are used by GCC for instrumenting pointer and
-array dereferencing operations.
-
-%description -n libmudflap -l pl
-Biblioteki libmudflap s± u¿ywane przez GCC do obs³ugi operacji
-dereferencji wspa¼ników i tablic.
-
-%package -n libmudflap-devel
-Summary: Development files for GCC mudflap library
-Summary(pl): Pliki programistyczne biblioteki GCC mudflap
-License: GPL v2+ with unlimited link permission
-Group: Development/Libraries
-Requires: libmudflap = %{epoch}:%{version}-%{release}
-
-%description -n libmudflap-devel
-The libmudflap libraries are used by GCC for instrumenting pointer and
-array dereferencing operations. This package contains development
-files.
-
-%description -n libmudflap-devel -l pl
-Biblioteki libmudflap s± u¿ywane przez GCC do obs³ugi operacji
-dereferencji wspa¼ników i tablic. Ten pakiet zawiera pliki
-programistyczne.
-
-%package -n libmudflap-static
-Summary: Static GCC mudflap library
-Summary(pl): Statyczna biblioteka GCC mudflap
-License: GPL v2+ with unlimited link permission
-Group: Development/Libraries
-Requires: libmudflap-devel = %{epoch}:%{version}-%{release}
-
-%description -n libmudflap-static
-The libmudflap libraries are used by GCC for instrumenting pointer and
-array dereferencing operations. This package contains static
-libraries.
-
-%description -n libmudflap-static -l pl
-Biblioteki libmudflap s± u¿ywane przez GCC do obs³ugi operacji
-dereferencji wspa¼ników i tablic. Ten pakiet zawiera biblioteki
-statyczne.
-
-%package ada
-Summary: Ada support for gcc
-Summary(es): Soporte de Ada para gcc
-Summary(pl): Obs³uga Ady do gcc
-Group: Development/Languages
-Requires: %{name} = %{epoch}:%{version}-%{release}
-Requires: libgnat = %{epoch}:%{version}-%{release}
-Obsoletes: gcc-gnat
-Obsoletes: gnat-devel
-
-%description ada
-This package adds experimental support for compiling Ada programs.
-
-%description ada -l es
-Este paquete añade soporte experimental para compilar programas en
-Ada.
-
-%description ada -l pl
-Ten pakiet dodaje eksperymentalne wsparcie dla kompilacji programów w
-Adzie.
-
-%package -n libgnat
-Summary: Ada standard libraries
-Summary(es): Bibliotecas estándares de Ada
-Summary(pl): Biblioteki standardowe dla Ady
-License: GPL v2+ with linking exception
-Group: Libraries
-Obsoletes: gnat
-Obsoletes: libgnat1
-
-%description -n libgnat
-This package contains shared libraries needed to run programs written
-in Ada.
-
-%description -n libgnat -l es
-Este paquete contiene las bibliotecas compartidas necesarias para
-ejecutar programas escritos en Ada.
-
-%description -n libgnat -l pl
-Ten pakiet zawiera biblioteki potrzebne do uruchamiania programów
-napisanych w Adzie.
-
-%package -n libgnat-static
-Summary: Static Ada standard libraries
-Summary(pl): Statyczne biblioteki standardowe dla Ady
-License: GPL v2+ with linking exception
-Group: Development/Libraries
-Obsoletes: gnat-static
-
-%description -n libgnat-static
-This package contains static libraries for programs written in Ada.
-
-%description -n libgnat-static -l pl
-Ten pakiet zawiera biblioteki statyczne dla programów napisanych w
-Adzie.
-
-%package c++
-Summary: C++ support for gcc
-Summary(es): Soporte de C++ para gcc
-Summary(pl): Obs³uga C++ dla gcc
-Summary(pt_BR): Suporte C++ para o gcc
-Group: Development/Languages
-Requires: %{name} = %{epoch}:%{version}-%{release}
-Obsoletes: egcc-c++
-Obsoletes: egcs-c++
-
-%description c++
-This package adds C++ support to the GNU Compiler Collection. It
-includes support for most of the current C++ specification, including
-templates and exception handling. It does not include a standard C++
-library, which is available separately.
-
-%description c++ -l de
-Dieses Paket enthält die C++-Unterstützung für den
-GNU-Compiler-Collection. Es unterstützt die aktuelle
-C++-Spezifikation, inkl. Templates und Ausnahmeverarbeitung. Eine
-C++-Standard-Library ist nicht enthalten - sie ist getrennt
-erhältlich.
-
-%description c++ -l es
-Este paquete añade soporte de C++ al GCC (colección de compiladores
-GNU). Ello incluye el soporte para la mayorÃa de la especificación
-actual de C++, incluyendo plantillas y manejo de excepciones. No
-incluye la biblioteca estándar de C++, la que es disponible separada.
-
-%description c++ -l fr
-Ce package ajoute un support C++ a la collection de compilateurs GNU.
-Il comprend un support pour la plupart des spécifications actuelles de
-C++, dont les modéles et la gestion des exceptions. Il ne comprend pas
-une bibliothéque C++ standard, qui est disponible séparément.
-
-%description c++ -l pl
-Ten pakiet dodaje obs³ugê C++ do kompilatora gcc. Ma wsparcie dla
-du¿ej ilo¶ci obecnych specyfikacji C++, nie zawiera natomiast
-standardowych bibliotek C++, które s± w oddzielnym pakiecie.
-
-%description c++ -l pt_BR
-Este pacote adiciona suporte C++ para o gcc.
-
-%description c++ -l tr
-Bu paket, GNU C derleyicisine C++ desteði ekler. 'Template'ler ve
-aykýrý durum iþleme gibi çoðu güncel C++ tanýmlarýna uyar. Standart
-C++ kitaplýðý bu pakette yer almaz.
-
-%package -n libstdc++
-Summary: GNU C++ library
-Summary(es): Biblioteca C++ de GNU
-Summary(pl): Biblioteki GNU C++
-Summary(pt_BR): Biblioteca C++ GNU
-License: GPL v2+ with free software exception
-Group: Libraries
-Obsoletes: libg++
-Obsoletes: libstdc++3
-
-%description -n libstdc++
-This is the GNU implementation of the standard C++ libraries, along
-with additional GNU tools. This package includes the shared libraries
-necessary to run C++ applications.
-
-%description -n libstdc++ -l de
-Dies ist die GNU-Implementierung der Standard-C++-Libraries mit
-weiteren GNU-Tools. Dieses Paket enthält die zum Ausführen von
-C++-Anwendungen erforderlichen gemeinsam genutzten Libraries.
-
-%description -n libstdc++ -l es
-Este es el soporte de las bibliotecas padrón del C++, junto con
-herramientas GNU adicionales. El paquete incluye las bibliotecas
-compartidas necesarias para ejecutar aplicaciones C++.
-
-%description -n libstdc++ -l fr
-Ceci est l'implémentation GNU des librairies C++ standard, ainsi que
-des outils GNU supplémentaires. Ce package comprend les librairies
-partagées nécessaires à l'exécution d'application C++.
-
-%description -n libstdc++ -l pl
-Pakiet ten zawiera biblioteki bêd±ce implementacj± standardowych
-bibliotek C++. Znajduj± siê w nim biblioteki dynamiczne niezbêdne do
-uruchomienia aplikacji napisanych w C++.
-
-%description -n libstdc++ -l pt_BR
-Este pacote é uma implementação da biblioteca padrão C++ v3, um
-subconjunto do padrão ISO 14882.
-
-%description -n libstdc++ -l tr
-Bu paket, standart C++ kitaplýklarýnýn GNU gerçeklemesidir ve C++
-uygulamalarýnýn koþturulmasý için gerekli kitaplýklarý içerir.
-
-%package -n libstdc++-devel
-Summary: Header files and documentation for C++ development
-Summary(de): Header-Dateien zur Entwicklung mit C++
-Summary(es): Ficheros de cabecera y documentación para desarrollo C++
-Summary(fr): Fichiers d'en-tête et biblitothèques pour développer en C++
-Summary(pl): Pliki nag³ówkowe i dokumentacja do biblioteki standardowej C++
-Summary(pt_BR): Arquivos de inclusão e bibliotecas para o desenvolvimento em C++
-Summary(tr): C++ ile program geliþtirmek için gerekli dosyalar
-License: GPL v2+ with free software exception
-Group: Development/Libraries
-Requires: %{name}-c++ = %{epoch}:%{version}-%{release}
-Requires: libstdc++ = %{epoch}:%{version}-%{release}
-Requires: glibc-devel
-Obsoletes: libg++-devel
-Obsoletes: libstdc++3-devel
-
-%description -n libstdc++-devel
-This is the GNU implementation of the standard C++ libraries. This
-package includes the header files needed for C++ development and
-library documentation.
-
-%description -n libstdc++-devel -l es
-Este es el soporte de las bibliotecas padrón del lenguaje C++. Este
-paquete incluye los archivos de inclusión y bibliotecas necesarios
-para desarrollo de programas en lenguaje C++.
-
-%description -n libstdc++-devel -l pl
-Pakiet ten zawiera biblioteki bêd±ce implementacj± standardowych
-bibliotek C++. Znajduj± siê w nim pliki nag³ówkowe wykorzystywane przy
-programowaniu w jêzyku C++ oraz dokumentacja biblioteki standardowej.
-
-%description -n libstdc++-devel -l pt_BR
-Este pacote inclui os arquivos de inclusão e bibliotecas necessárias
-para desenvolvimento de programas C++.
-
-%package -n libstdc++-static
-Summary: Static C++ standard library
-Summary(es): Biblioteca estándar estática de C++
-Summary(pl): Statyczna biblioteka standardowa C++
-License: GPL v2+ with free software exception
-Group: Development/Libraries
-Requires: libstdc++-devel = %{epoch}:%{version}-%{release}
-
-%description -n libstdc++-static
-Static C++ standard library.
-
-%description -n libstdc++-static -l es
-Biblioteca estándar estática de C++.
-
-%description -n libstdc++-static -l pl
-Statyczna biblioteka standardowa C++.
-
-%package fortran
-Summary: Fortran 95 support for gcc
-Summary(es): Soporte de Fortran 95 para gcc
-Summary(pl): Obs³uga Fortranu 95 dla gcc
-Summary(pt_BR): Suporte Fortran 95 para o GCC
-Group: Development/Languages/Fortran
-Requires: libgfortran = %{epoch}:%{version}-%{release}
-Provides: gcc-g77 = %{epoch}:%{version}-%{release}
-Obsoletes: egcs-g77
-Obsoletes: gcc-g77
-
-%description fortran
-This package adds support for compiling Fortran 95 programs with the
-GNU compiler.
-
-%description fortran -l es
-Este paquete añade soporte para compilar programas escritos en Fortran
-95 con el compilador GNU.
-
-%description fortran -l pl
-Ten pakiet dodaje obs³ugê Fortranu 95 do kompilatora gcc. Jest
-potrzebny do kompilowania programów pisanych w jêzyku Fortran 95.
-
-%description fortran -l pt_BR
-Suporte Fortran 95 para o GCC.
-
-%package -n libgfortran
-Summary: Fortran 95 Libraries
-Summary(es): Bibliotecas de Fortran 95
-Summary(pl): Biblioteki Fortranu 95
-License: LGPL v2+
-Group: Libraries
-Obsoletes: libg2c
-
-%description -n libgfortran
-Fortran 95 Libraries.
-
-%description -n libgfortran -l es
-Bibliotecas de Fortran 95.
-
-%description -n libgfortran -l pl
-Biblioteki Fortranu 95.
-
-%package -n libgfortran-static
-Summary: Static Fortran 95 Libraries
-Summary(es): Bibliotecas estáticas de Fortran 95
-Summary(pl): Statyczne Biblioteki Fortranu 95
-License: LGPL v2+
-Group: Development/Libraries
-Requires: libgfortran = %{epoch}:%{version}-%{release}
-Obsoletes: libg2c-static
-
-%description -n libgfortran-static
-Static Fortran 95 Libraries.
-
-%description -n libgfortran-static -l es
-Bibliotecas estáticas de Fortran 95.
-
-%description -n libgfortran-static -l pl
-Statyczne biblioteki Fortranu 95.
-
-%package java
-Summary: Java support for gcc
-Summary(es): Soporte de Java para gcc
-Summary(pl): Obs³uga Javy dla gcc
-Group: Development/Languages/Java
-Requires: %{name} = %{epoch}:%{version}-%{release}
-Requires: libgcj-devel = %{epoch}:%{version}-%{release}
-Provides: gcj = %{epoch}:%{version}-%{release}
-Provides: gcc-java-tools
-Obsoletes: fastjar
-Obsoletes: gcc-java-tools
-
-%description java
-This package adds experimental support for compiling Java(TM) programs
-and bytecode into native code. To use this you will also need the
-libgcj package.
-
-%description java -l es
-Este paquete añade soporte experimental para compilar programas
-Java(tm) y su bytecode en código nativo. Para usarlo también va a
-necesitar el paquete libgcj.
-
-%description java -l pl
-Ten pakiet dodaje mo¿liwo¶æ kompilowania programów w jêzyku Java(TM)
-oraz bajtkodu do kodu natywnego. Do u¿ywania go wymagany jest
-dodatkowo pakiet libgcj.
-
-%package -n libgcj
-Summary: Java Class Libraries
-Summary(es): Bibliotecas de clases de Java
-Summary(pl): Biblioteki Klas Javy
-License: GPL with limited linking exception
-Group: Libraries
-Obsoletes: libgcj3
-
-%description -n libgcj
-Java Class Libraries.
-
-%description -n libgcj -l es
-Bibliotecas de clases de Java.
-
-%description -n libgcj -l pl
-Biblioteki Klas Javy.
-
-%package -n libgcj-devel
-Summary: Development files for Java Class Libraries
-Summary(es): Ficheros de desarrollo para las bibliotecas de clases de Java
-Summary(pl): Pliki nag³ówkowe dla Bibliotek Klas Javy
-License: GPL with limited linking exception
-Group: Development/Libraries
-Requires: libgcj = %{epoch}:%{version}-%{release}
-Requires: zlib-devel
-Obsoletes: libgcj3-devel
-
-%description -n libgcj-devel
-Development files for Java Class Libraries.
-
-%description -n libgcj-devel -l es
-Ficheros de desarrollo para las bibliotecas de clases de Java.
-
-%description -n libgcj-devel -l pl
-Pliki nag³ówkowe dla Bibliotek Klas Javy.
-
-%package -n libgcj-static
-Summary: Static Java Class Libraries
-Summary(es): Bibliotecas estáticas de clases de Java
-Summary(pl): Statyczne Biblioteki Klas Javy
-License: GPL with limited linking exception
-Group: Development/Libraries
-Requires: libgcj-devel = %{epoch}:%{version}-%{release}
-Requires: libstdc++-devel = %{epoch}:%{version}-%{release}
-
-%description -n libgcj-static
-Static Java Class Libraries.
-
-%description -n libgcj-static -l es
-Bibliotecas estáticas de clases de Java.
-
-%description -n libgcj-static -l pl
-Statyczne Biblioteki Klas Javy.
-
-%package -n libffi
-Summary: Foreign Function Interface library
-Summary(es): Biblioteca de interfaz de funciones ajenas
-Summary(pl): Biblioteka zewnêtrznych wywo³añ funkcji
-License: BSD-like
-Group: Libraries
-
-%description -n libffi
-The libffi library provides a portable, high level programming
-interface to various calling conventions. This allows a programmer to
-call any function specified by a call interface description at run
-time.
-
-%description -n libffi -l es
-La biblioteca libffi provee una interfaz portable de programación de
-alto nivel para varias convenciones de llamada. Ello permite que un
-programador llame una función cualquiera especificada por una
-descripción de interfaz de llamada en el tiempo de ejecución.
-
-%description -n libffi -l pl
-Biblioteka libffi dostarcza przeno¶nego, wysokopoziomowego
-miêdzymordzia do ró¿nych konwencji wywo³añ funkcji. Pozwala to
-programi¶cie wywo³ywaæ dowolne funkcje podaj±c konwencjê wywo³ania w
-czasie wykonania.
-
-%package -n libffi-devel
-Summary: Development files for Foreign Function Interface library
-Summary(es): Ficheros de desarrollo para libffi
-Summary(pl): Pliki nag³ówkowe dla libffi
-License: BSD-like
-Group: Development/Libraries
-Requires: libffi = %{epoch}:%{version}-%{release}
-
-%description -n libffi-devel
-Development files for Foreign Function Interface library.
-
-%description -n libffi-devel -l es
-Ficheros de desarrollo para libffi.
-
-%description -n libffi-devel -l pl
-Pliki nag³ówkowe dla libffi.
-
-%package -n libffi-static
-Summary: Static Foreign Function Interface library
-Summary(es): Biblioteca libffi estática
-Summary(pl): Statyczna biblioteka libffi
-License: BSD-like
-Group: Development/Libraries
-Requires: libffi-devel = %{epoch}:%{version}-%{release}
-
-%description -n libffi-static
-Static Foreign Function Interface library.
-
-%description -n libffi-static -l es
-Biblioteca libffi estática.
-
-%description -n libffi-static -l pl
-Statyczna biblioteka libffi.
-
-%package objc
-Summary: Objective C support for gcc
-Summary(de): Objektive C-Unterstützung für gcc
-Summary(es): Soporte de Objective C para gcc
-Summary(fr): Gestion d'Objective C pour gcc
-Summary(pl): Obs³uga obiektowego C dla kompilatora gcc
-Summary(tr): gcc için Objective C desteði
-Group: Development/Languages
-Requires: %{name} = %{epoch}:%{version}-%{release}
-Requires: libobjc = %{epoch}:%{version}-%{release}
-Obsoletes: egcc-objc
-Obsoletes: egcs-objc
-
-%description objc
-This package adds Objective C support to the GNU Compiler Collection.
-Objective C is a object oriented derivative of the C language, mainly
-used on systems running NeXTSTEP. This package does not include the
-standard objective C object library.
-
-%description objc -l de
-Dieses Paket ergänzt den GNU-Compiler-Collection durch
-Objective-C-Support. Objective C ist ein objektorientiertes Derivat
-von C, das zur Hauptsache auf Systemen mit NeXTSTEP zum Einsatz kommt.
-Die Standard-Objective-C-Objekt-Library ist nicht Teil des Pakets.
-
-%description objc -l es
-Este paquete añade soporte de Objective C al GCC (colección de
-compiladores GNU). Objective C es un lenguaje orientado a objetos
-derivado de C, principalmente usado en sistemas que funcionan bajo
-NeXTSTEP. El paquete no incluye la biblioteca de objetos estándar de
-Objective C.
-
-%description objc -l fr
-Ce package ajoute un support Objective C a la collection de
-compilateurs GNU. L'Objective C est un langage orienté objetdérivé du
-langage C, principalement utilisé sur les systèmes NeXTSTEP. Ce
-package n'inclue pas la bibliothéque Objective C standard.
-
-%description objc -l pl
-Ten pakiet dodaje obs³ugê obiektowego C do kompilatora gcc. Obiektowe
-C (objc) jest zorientowan± obiektowo pochodn± jêzyka C, u¿ywan±
-g³ównie w systemach u¿ywaj±cych NeXTSTEP. W pakiecie nie ma
-standardowej biblioteki objc (która znajduje siê w osobnym pakiecie).
-
-%description objc -l tr
-Bu paket, GNU C derleyicisine Objective C desteði ekler. Objective C,
-C dilinin nesne yönelik bir türevidir ve NeXTSTEP altýnda çalýþan
-sistemlerde yaygýn olarak kullanýlýr. Standart Objective C nesne
-kitaplýðý bu pakette yer almaz.
-
-%package objc++
-Summary: Objective C++ support for gcc
-Summary(pl): Obs³uga jêzyka Objective C++ dla gcc
-Group: Development/Languages
-Requires: %{name}-c++ = %{epoch}:%{version}-%{release}
-Requires: %{name}-objc = %{epoch}:%{version}-%{release}
-
-%description objc++
-This package adds Objective C++ support to the GNU Compiler
-Collection.
-
-%description objc++ -l pl
-Ten pakiet dodaje obs³ugê jêzyka Objective C++ do zestawu
-kompilatorów GNU Compiler Collection.
-
-%package -n libobjc
-Summary: Objective C Libraries
-Summary(es): Bibliotecas de Objective C
-Summary(pl): Biblioteki Obiektowego C
-License: GPL v2+ with linking exception
-Group: Libraries
-Obsoletes: libobjc1
-
-%description -n libobjc
-Objective C Libraries.
-
-%description -n libobjc -l es
-Bibliotecas de Objective C.
-
-%description -n libobjc -l pl
-Biblioteki Obiektowego C.
-
-%package -n libobjc-static
-Summary: Static Objective C Libraries
-Summary(es): Bibliotecas estáticas de Objective C
-Summary(pl): Statyczne Biblioteki Obiektowego C
-License: GPL v2+ with linking exception
-Group: Development/Libraries
-Requires: libobjc = %{epoch}:%{version}-%{release}
-
-%description -n libobjc-static
-Static Objective C Libraries.
-
-%description -n libobjc-static -l es
-Bibliotecas estáticas de Objective C.
-
-%description -n libobjc-static -l pl
-Statyczne biblioteki Obiektowego C.
-
-%prep
-#setup -q -n gcc-%{version}
-%setup -q -n gcc-4_1-branch
-
-%patch0 -p1
-%patch1 -p1
-%patch2 -p1
-%patch3 -p1
-%patch4 -p1
-%patch5 -p1
-
-# -fvisbility fixes...
-%patch6 -p1
-%patch7 -p1
-
-#patch9 -p1 NEEDS UPDATE
-# PRs
-%patch10 -p1
-%patch11 -p1
-%patch12 -p1
-
-%ifarch %{ix86} %{x8664}
-#patch14 -p1
-#patch15 -p1
-%endif
-%patch16 -p1
-%patch17 -p1
-%patch18 -p1
-%patch19 -p1
-%patch20 -p1
-
-# because we distribute modified version of gcc...
-perl -pi -e 's/(version.*)";/$1 (PLD Linux)";/' gcc/version.c
-perl -pi -e 's@(bug_report_url.*<URL:).*";@$1http://bugs.pld-linux.org/>";@' gcc/version.c
-
-mv ChangeLog ChangeLog.general
-
-%build
-cd gcc
-%{__autoconf}
-cd ..
-cd libjava/classpath
-%{__autoconf}
-cd ../..
-cp -f /usr/share/automake/config.sub .
-
-rm -rf obj-%{_target_platform}
-install -d obj-%{_target_platform}
-cd obj-%{_target_platform}
-
-CFLAGS="%{rpmcflags}" \
-CXXFLAGS="%{rpmcxxflags}" \
-TEXCONFIG=false \
-../configure \
- --prefix=%{_prefix} \
- --libdir=%{_libdir} \
- --libexecdir=%{_libdir} \
- --infodir=%{_infodir} \
- --mandir=%{_mandir} \
- --x-libraries=/usr/X11R6/%{_lib} \
- --enable-shared \
- --enable-threads=posix \
- --enable-__cxa_atexit \
- --enable-languages="c%{?with_cxx:,c++}%{?with_fortran:,f95}%{?with_objc:,objc}%{?with_objcxx:,obj-c++}%{?with_ada:,ada}%{?with_java:,java}" \
- --enable-c99 \
- --enable-long-long \
- --%{?with_multilib:en}%{!?with_multilib:dis}able-multilib \
- --enable-nls \
- --disable-werror \
- --with-gnu-as \
- --with-gnu-ld \
- --with-demangler-in-ld \
- --with-system-zlib \
- --with-slibdir=%{_slibdir} \
- --without-x \
- %{?with_fortran:--enable-cmath} \
-%if %{with java}
- --enable-libgcj \
- --enable-libgcj-multifile \
- --enable-libgcj-database \
- --enable-gtk-peer \
- --enable-gtk-cairo \
- --enable-jni \
- --enable-xmlj \
- --enable-alsa \
- --enable-dssi \
-%endif
- %{_target_platform}
-
-# not finished yet
-# --enable-java-awt=gtk \
-
-# horrible compile time hog with perfect tree checking
-# --enable-checking=all \
-
-cd ..
-
-%{__make} -C obj-%{_target_platform} \
- %{?with_bootstrap:%{?with_profiling:profiled}bootstrap} \
- GCJFLAGS="%{rpmcflags}" \
- BOOT_CFLAGS="%{rpmcflags}" \
- STAGE1_CFLAGS="%{rpmcflags} -O0" \
- GNATLIBCFLAGS="%{rpmcflags}" \
- LDFLAGS_FOR_TARGET="%{rpmldflags}" \
- mandir=%{_mandir} \
- infodir=%{_infodir}
-
-%{?with_tests:%{__make} -k -C obj-%{_target_platform} check 2>&1 ||:}
-
-%install
-rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{/lib,%{_aclocaldir},%{_datadir},%{_infodir}}
-
-cd obj-%{_target_platform}
-
-%{__make} -j1 install \
- mandir=%{_mandir} \
- infodir=%{_infodir} \
- DESTDIR=$RPM_BUILD_ROOT
-
-install gcc/specs $RPM_BUILD_ROOT%{_libdir}/gcc/%{_target_platform}/%{version}
-
-%ifarch sparc64
-ln -sf %{_bindir}/sparc64-pld-linux-gcc \
- $RPM_BUILD_ROOT%{_bindir}/sparc-pld-linux-gcc
-%endif
-
-ln -sf %{_bindir}/cpp $RPM_BUILD_ROOT/lib/cpp
-ln -sf gcc $RPM_BUILD_ROOT%{_bindir}/cc
-echo ".so gcc.1" > $RPM_BUILD_ROOT%{_mandir}/man1/cc.1
-
-libssp=$(cd $RPM_BUILD_ROOT%{_libdir}; echo libssp.so.*.*.*)
-mv $RPM_BUILD_ROOT{%{_libdir}/$libssp,%{_slibdir}}
-ln -sf %{_slibdir}/$libssp $RPM_BUILD_ROOT%{_libdir}/libssp.so
-%if %{with multilib}
-libssp=$($RPM_BUILD_ROOT%{_libdir32}; echo libssp.so.*.*.*`)
-mv $RPM_BUILD_ROOT{%{_libdir32}/$libssp,%{_slibdir32}}
-ln -sf %{_slibdir32}/$libssp $RPM_BUILD_ROOT%{_libdir32}/libssp.so
-%endif
-
-%if %{with fortran}
-ln -sf gfortran $RPM_BUILD_ROOT%{_bindir}/g95
-echo ".so gfortran.1" > $RPM_BUILD_ROOT%{_mandir}/man1/g95.1
-%endif
-
-%if %{with ada}
-# move ada shared libraries to proper place...
-mv -f $RPM_BUILD_ROOT%{_libdir}/gcc/*/*/adalib/*.so.1 \
- $RPM_BUILD_ROOT%{_libdir}
-# check if symlink to be made is valid
-test -f $RPM_BUILD_ROOT%{_libdir}/libgnat-4.1.so.1
-ln -sf libgnat-4.1.so.1 $RPM_BUILD_ROOT%{_libdir}/libgnat-4.1.so
-ln -sf libgnarl-4.1.so.1 $RPM_BUILD_ROOT%{_libdir}/libgnarl-4.1.so
-ln -sf libgnat-4.1.so $RPM_BUILD_ROOT%{_libdir}/libgnat.so
-ln -sf libgnarl-4.1.so $RPM_BUILD_ROOT%{_libdir}/libgnarl.so
-%endif
-
-cd ..
-
-%if %{with java}
-install -d java-doc
-cp -f libjava/READ* java-doc
-cp -f fastjar/README java-doc/README.fastjar
-cp -f libffi/README java-doc/README.libffi
-cp -f libffi/LICENSE java-doc/LICENSE.libffi
-ln -sf %{_javadir}/libgcj-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/libgcj.jar
-%endif
-%if %{with objc}
-cp -f libobjc/README gcc/objc/README.libobjc
-%endif
-
-# avoid -L poisoning in *.la - there should be only -L%{_libdir}/gcc/*/%{version}
-# normalize libdir, to avoid propagation of unnecessary RPATHs by libtool
-for f in libmudflap.la libmudflapth.la libssp.la \
- %{?with_cxx:libstdc++.la libsupc++.la} \
- %{?with_fortran:libgfortran.la libgfortranbegin.la} \
- %{?with_java:libgcj.la libffi.la} \
- %{?with_objc:libobjc.la};
-do
- %{SOURCE1} $RPM_BUILD_ROOT%{_libdir}/$f %{_libdir} > $RPM_BUILD_ROOT%{_libdir}/$f.fixed
- mv $RPM_BUILD_ROOT%{_libdir}/$f{.fixed,}
-%if %{with multilib}
- %{SOURCE1} $RPM_BUILD_ROOT%{_libdir32}/$f %{_libdir32} > $RPM_BUILD_ROOT%{_libdir32}/$f.fixed
- mv $RPM_BUILD_ROOT%{_libdir32}/$f{.fixed,}
-%endif
-done
-
-# include/ contains install-tools/include/* and headers that were fixed up
-# by fixincludes, we don't want former
-gccdir=$(echo $RPM_BUILD_ROOT%{_libdir}/gcc/*/*/)
-mkdir $gccdir/tmp
-
-# we have to save these however
-%{?with_java:mv $gccdir/include/{gcj,libffi/ffitarget.h,jawt.h,jawt_md.h,jni.h,jni_md.h,jvmpi.h} $gccdir/tmp}
-%{?with_objc:mv $gccdir/include/objc $gccdir/tmp}
-mv $gccdir/include/syslimits.h $gccdir/tmp
-rm -rf $gccdir/include
-mv $gccdir/tmp $gccdir/include
-cp $gccdir/install-tools/include/*.h $gccdir/include
-# but we don't want anything more from install-tools
-rm -rf $gccdir/install-tools
-
-%if %{with multilib}
-ln -sf %{_slibdir32}/libgcc_s.so.1 $gccdir/32/libgcc_s.so
-%endif
-ln -sf %{_slibdir}/libgcc_s.so.1 $gccdir/libgcc_s.so
-
-%find_lang gcc
-%{?with_cxx:%find_lang libstdc\+\+}
-
-# cvs snap doesn't contain (release does) below files,
-# so let's create dummy entries to satisfy %%files.
-[ ! -f NEWS ] && touch NEWS
-[ ! -f libgfortran/AUTHORS ] && touch libgfortran/AUTHORS
-[ ! -f libgfortran/README ] && touch libgfortran/README
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%post
-[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
-
-%postun
-[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
-
-%post ada
-[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
-
-%postun ada
-[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
-
-%post fortran
-[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
-
-%postun fortran
-[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
-
-%post java
-[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
-
-%postun java
-[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
-
-%post -p /sbin/ldconfig -n libgcc
-%postun -p /sbin/ldconfig -n libgcc
-%post -p /sbin/ldconfig -n libmudflap
-%postun -p /sbin/ldconfig -n libmudflap
-%post -p /sbin/ldconfig -n libgnat
-%postun -p /sbin/ldconfig -n libgnat
-%post -p /sbin/ldconfig -n libstdc++
-%postun -p /sbin/ldconfig -n libstdc++
-%post -p /sbin/ldconfig -n libgfortran
-%postun -p /sbin/ldconfig -n libgfortran
-%post -p /sbin/ldconfig -n libgcj
-%postun -p /sbin/ldconfig -n libgcj
-%post -p /sbin/ldconfig -n libffi
-%postun -p /sbin/ldconfig -n libffi
-%post -p /sbin/ldconfig -n libobjc
-%postun -p /sbin/ldconfig -n libobjc
-
-%files -f gcc.lang
-%defattr(644,root,root,755)
-%doc ChangeLog.general MAINTAINERS NEWS
-# bugs.html faq.html
-%doc gcc/{ChangeLog,ONEWS,README.Portability}
-%dir %{_libdir}/gcc
-%dir %{_libdir}/gcc/*
-%dir %{_libdir}/gcc/*/*
-%dir %{_libdir}/gcc/*/*/include
-
-%attr(755,root,root) %{_bindir}/*-gcc*
-%attr(755,root,root) %{_bindir}/gcc
-%attr(755,root,root) %{_bindir}/gccbug
-%attr(755,root,root) %{_bindir}/gcov
-%attr(755,root,root) %{_bindir}/cc
-%attr(755,root,root) %{_bindir}/cpp
-
-%{_includedir}/ssp
-
-%{_mandir}/man1/cc.1*
-%{_mandir}/man1/cpp.1*
-%{_mandir}/man1/gcc.1*
-%{_mandir}/man1/gcov.1*
-
-%{_infodir}/cpp*
-%{_infodir}/gcc*
-
-%attr(755,root,root) /lib/cpp
-
-%attr(755,root,root) %{_slibdir}/lib*.so
-%{_libdir}/libssp.la
-%attr(755,root,root) %{_libdir}/libssp.a
-%attr(755,root,root) %{_libdir}/libssp.so
-%{_libdir}/libssp_nonshared.a
-%{_libdir}/libssp_nonshared.la
-%if %{with multilib}
-%dir %{_libdir}/gcc/*/*/32
-%{_libdir}/gcc/*/*/32/libgcov.a
-%{_libdir}/gcc/*/*/32/libgcc.a
-%{_libdir}/gcc/*/*/32/libgcc_eh.a
-%{_libdir}/gcc/*/*/32/libgcc_s.so
-%{_libdir32}/libssp.la
-%attr(755,root,root) %{_libdir32}/libssp.a
-%attr(755,root,root) %{_libdir32}/libssp.so
-%{_libdir32}/libssp_nonshared.a
-%{_libdir32}/libssp_nonshared.la
-%endif
-%{_libdir}/gcc/*/*/libgcov.a
-%{_libdir}/gcc/*/*/libgcc.a
-%{_libdir}/gcc/*/*/libgcc_eh.a
-%{_libdir}/gcc/*/*/libgcc_s.so
-%{_libdir}/gcc/*/*/specs
-%if %{with multilib}
-%{_libdir}/gcc/*/*/32/crt*.o
-%endif
-%{_libdir}/gcc/*/*/crt*.o
-%attr(755,root,root) %{_libdir}/gcc/*/*/cc1
-%attr(755,root,root) %{_libdir}/gcc/*/*/collect2
-
-%{_libdir}/gcc/*/*/include/*.h
-
-%files -n libgcc
-%defattr(644,root,root,755)
-%if %{with multilib}
-%attr(755,root,root) %{_slibdir32}/lib*.so.*
-%endif
-%attr(755,root,root) %{_slibdir}/lib*.so.*
-
-%files -n libmudflap
-%defattr(644,root,root,755)
-%if %{with multilib}
-%attr(755,root,root) %{_libdir32}/libmudflap*.so.*.*.*
-%endif
-%attr(755,root,root) %{_libdir}/libmudflap*.so.*.*.*
-
-%files -n libmudflap-devel
-%defattr(644,root,root,755)
-%{_includedir}/mf-runtime.h
-%if %{with multilib}
-%{_libdir32}/libmudflap*.la
-%attr(755,root,root) %{_libdir32}/libmudflap*.so
-%endif
-%{_libdir}/libmudflap*.la
-%attr(755,root,root) %{_libdir}/libmudflap*.so
-
-%files -n libmudflap-static
-%defattr(644,root,root,755)
-%if %{with multilib}
-%{_libdir32}/libmudflap*.a
-%endif
-%{_libdir}/libmudflap*.a
-
-%if %{with ada}
-%files ada
-%defattr(644,root,root,755)
-%doc gcc/ada/ChangeLog
-%attr(755,root,root) %{_bindir}/gnat*
-%attr(755,root,root) %{_bindir}/gpr*
-%attr(755,root,root) %{_libdir}/libgnarl*.so
-%attr(755,root,root) %{_libdir}/libgnat*.so
-%attr(755,root,root) %{_libdir}/gcc/*/*/gnat1
-%{_libdir}/gcc/*/*/adainclude
-%dir %{_libdir}/gcc/*/*/adalib
-%{_libdir}/gcc/*/*/adalib/*.ali
-%{_libdir}/gcc/*/*/adalib/g-trasym.o
-%{_libdir}/gcc/*/*/adalib/libgccprefix.a
-%ifarch %{ix86}
-%{_libdir}/gcc/*/*/adalib/libgmem.a
-%endif
-%{_infodir}/gnat*
-
-%files -n libgnat
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libgnarl*.so.1
-%attr(755,root,root) %{_libdir}/libgnat*.so.1
-
-%files -n libgnat-static
-%defattr(644,root,root,755)
-%{_libdir}/gcc/*/*/adalib/libgnarl.a
-%{_libdir}/gcc/*/*/adalib/libgnat.a
-%endif
-
-%if %{with cxx}
-%files c++
-%defattr(644,root,root,755)
-%doc gcc/cp/{ChangeLog,NEWS}
-%attr(755,root,root) %{_bindir}/g++
-%attr(755,root,root) %{_bindir}/*-g++
-%attr(755,root,root) %{_bindir}/c++
-%attr(755,root,root) %{_bindir}/*-c++
-%attr(755,root,root) %{_libdir}/gcc/*/*/cc1plus
-%if %{with multilib}
-%{_libdir32}/libsupc++.a
-%{_libdir32}/libsupc++.la
-%endif
-%{_libdir}/libsupc++.a
-%{_libdir}/libsupc++.la
-%{_mandir}/man1/g++.1*
-
-%files -n libstdc++ -f libstdc++.lang
-%defattr(644,root,root,755)
-%doc libstdc++-v3/{ChangeLog,README}
-%if %{with multilib}
-%attr(755,root,root) %{_libdir32}/libstdc++.so.*.*.*
-%endif
-%attr(755,root,root) %{_libdir}/libstdc++.so.*.*.*
-
-%files -n libstdc++-devel
-%defattr(644,root,root,755)
-%doc libstdc++-v3/docs/html
-%dir %{_includedir}/c++
-%{_includedir}/c++/%{version}
-%if %{with java}
-%exclude %{_includedir}/c++/%{version}/java
-%exclude %{_includedir}/c++/%{version}/javax
-%exclude %{_includedir}/c++/%{version}/gcj
-%exclude %{_includedir}/c++/%{version}/gnu
-%endif
-%ifnarch sparc
-%exclude %{_includedir}/c++/%{version}/*/bits/stdc++.h.gch
-%endif
-%if %{with multilib}
-%{_libdir32}/libstdc++.la
-%attr(755,root,root) %{_libdir32}/libstdc++.so
-%endif
-%{_libdir}/libstdc++.la
-%attr(755,root,root) %{_libdir}/libstdc++.so
-
-%files -n libstdc++-static
-%defattr(644,root,root,755)
-%if %{with multilib}
-%{_libdir32}/libstdc++.a
-%endif
-%{_libdir}/libstdc++.a
-%endif
-
-%if %{with fortran}
-%files fortran
-%defattr(644,root,root,755)
-%doc gcc/fortran/ChangeLog
-%attr(755,root,root) %{_bindir}/g95
-%attr(755,root,root) %{_bindir}/gfortran
-%attr(755,root,root) %{_bindir}/*-gfortran
-%{_infodir}/gfortran*
-%attr(755,root,root) %{_libdir}/gcc/*/*/f951
-%if %{with multilib}
-%{_libdir32}/libgfortranbegin.a
-%{_libdir32}/libgfortranbegin.la
-%{_libdir32}/libgfortran.la
-%attr(755,root,root) %{_libdir32}/libgfortran.so
-%endif
-%{_libdir}/libgfortranbegin.a
-%{_libdir}/libgfortranbegin.la
-%{_libdir}/libgfortran.la
-%attr(755,root,root) %{_libdir}/libgfortran.so
-%{_mandir}/man1/g95.1*
-%{_mandir}/man1/gfortran.1*
-
-%files -n libgfortran
-%defattr(644,root,root,755)
-%doc libgfortran/{AUTHORS,README,ChangeLog}
-%if %{with multilib}
-%attr(755,root,root) %{_libdir32}/libgfortran.so.*.*.*
-%endif
-%attr(755,root,root) %{_libdir}/libgfortran.so.*.*.*
-
-%files -n libgfortran-static
-%defattr(644,root,root,755)
-%if %{with multilib}
-%{_libdir32}/libgfortran.a
-%endif
-%{_libdir}/libgfortran.a
-%endif
-
-%if %{with java}
-%files java
-%defattr(644,root,root,755)
-%doc gcc/java/ChangeLog java-doc/*
-%attr(755,root,root) %{_bindir}/fastjar
-%attr(755,root,root) %{_bindir}/gcj*
-%attr(755,root,root) %{_bindir}/gjnih
-%attr(755,root,root) %{_bindir}/grepjar
-%attr(755,root,root) %{_bindir}/grmi*
-%attr(755,root,root) %{_bindir}/jcf-dump
-%attr(755,root,root) %{_bindir}/jv-*
-%attr(755,root,root) %{_bindir}/*-gcj*
-%attr(755,root,root) %{_libdir}/gcc/*/*/jc1
-%attr(755,root,root) %{_libdir}/gcc/*/*/jvgenmain
-%{_infodir}/fastjar*
-%{_infodir}/gcj*
-%{_mandir}/man1/fastjar*
-%{_mandir}/man1/gcj*
-%{_mandir}/man1/gjnih*
-%{_mandir}/man1/grepjar*
-%{_mandir}/man1/grmi*
-%{_mandir}/man1/jcf-*
-%{_mandir}/man1/jv-*
-
-%files -n libgcj
-%defattr(644,root,root,755)
-%doc libjava/{ChangeLog,LIBGCJ_LICENSE,NEWS,README,THANKS}
-%attr(755,root,root) %{_bindir}/addr2name.awk
-%attr(755,root,root) %{_bindir}/gij
-%dir %{_libdir}/classpath
-%attr(755,root,root) %{_libdir}/classpath/libgjsmalsa.so.*.*.*
-%attr(755,root,root) %{_libdir}/classpath/libgjsmdssi.so.*.*.*
-%dir %{_libdir}/gcj-%{version}
-%{_libdir}/gcj-%{version}/classmap.db
-%attr(755,root,root) %{_libdir}/lib*cj*.so.*.*.*
-%attr(755,root,root) %{_libdir}/libgij.so.*.*.*
-%{_libdir}/logging.properties
-%{_javadir}/libgcj*.jar
-%{_mandir}/man1/gij*
-
-%files -n libgcj-devel
-%defattr(644,root,root,755)
-%{_includedir}/c++/%{version}/java
-%{_includedir}/c++/%{version}/javax
-%{_includedir}/c++/%{version}/gcj
-%{_includedir}/c++/%{version}/gnu
-%{_libdir}/classpath/libgjsmalsa.la
-%attr(755,root,root) %{_libdir}/classpath/libgjsmalsa.so
-%{_libdir}/classpath/libgjsmdssi.la
-%attr(755,root,root) %{_libdir}/classpath/libgjsmdssi.so
-%{_libdir}/gcc/*/*/include/gcj
-%{_libdir}/gcc/*/*/include/jawt.h
-%{_libdir}/gcc/*/*/include/jawt_md.h
-%{_libdir}/gcc/*/*/include/jni.h
-%{_libdir}/gcc/*/*/include/jvmpi.h
-%dir %{_libdir}/security
-%{_libdir}/security/*
-%{_libdir}/lib*cj.spec
-%{_libdir}/lib*cj*.la
-%attr(755,root,root) %{_libdir}/lib*cj*.so
-%{_libdir}/libgij.la
-%attr(755,root,root) %{_libdir}/libgij.so
-%{_pkgconfigdir}/libgcj.pc
-
-%files -n libgcj-static
-%defattr(644,root,root,755)
-%{_libdir}/lib*cj*.a
-%{_libdir}/libgij.a
-
-%files -n libffi
-%defattr(644,root,root,755)
-%doc libffi/{ChangeLog,ChangeLog.libgcj,LICENSE,README}
-%attr(755,root,root) %{_libdir}/libffi.so.*.*.*
-
-%files -n libffi-devel
-%defattr(644,root,root,755)
-%{_libdir}/gcc/*/*/include/ffitarget.h
-%attr(755,root,root) %{_libdir}/libffi.so
-%{_libdir}/libffi.la
-%{_includedir}/ffi.h
-
-%files -n libffi-static
-%defattr(644,root,root,755)
-%{_libdir}/libffi.a
-%endif
-
-%if %{with objc}
-%files objc
-%defattr(644,root,root,755)
-%doc gcc/objc/README
-%attr(755,root,root) %{_libdir}/gcc/*/*/cc1obj
-%if %{with multilib}
-%attr(755,root,root) %{_libdir32}/libobjc.so
-%{_libdir32}/libobjc.la
-%endif
-%attr(755,root,root) %{_libdir}/libobjc.so
-%{_libdir}/libobjc.la
-%{_libdir}/gcc/*/*/include/objc
-
-%files -n libobjc
-%defattr(644,root,root,755)
-%doc libobjc/{ChangeLog,README*}
-%if %{with multilib}
-%attr(755,root,root) %{_libdir32}/libobjc.so.*.*.*
-%endif
-%attr(755,root,root) %{_libdir}/libobjc.so.*.*.*
-
-%files -n libobjc-static
-%defattr(644,root,root,755)
-%if %{with multilib}
-%{_libdir32}/libobjc.a
-%endif
-%{_libdir}/libobjc.a
-%endif
-
-%if %{with objcxx}
-%files objc++
-%defattr(644,root,root,755)
-%doc gcc/objcp/ChangeLog
-%attr(755,root,root) %{_libdir}/gcc/*/*/cc1objplus
-%endif
+++ /dev/null
-diff -Nur gcc-3.2.2/gcc/ada/link.c gcc-3.2.2-20030218/gcc/ada/link.c
---- gcc-3.2.2/gcc/ada/link.c Sat May 4 05:28:18 2002
-+++ gcc-3.2.2-20030218/gcc/ada/link.c Tue Sep 24 15:07:49 2002
-@@ -158,11 +158,11 @@
-
- #elif defined (linux)
- const char *object_file_option = "";
--const char *run_path_option = "-Wl,-rpath,";
--char shared_libgnat_default = STATIC;
-+const char *run_path_option = "";
-+char shared_libgnat_default = SHARED;
- int link_max = 2147483647;
- unsigned char objlist_file_supported = 0;
--unsigned char using_gnu_linker = 0;
-+unsigned char using_gnu_linker = 1;
- const char *object_library_extension = ".a";
-
- #elif defined (__svr4__) && defined (i386)
-diff -Nur gcc-3.2.2/gcc/ada/Makefile.in gcc-3.2.2-20030218/gcc/ada/Makefile.in
---- gcc-3.2.2/gcc/ada/Makefile.in Wed Jan 29 18:34:08 2003
-+++ gcc-3.2.2-20030218/gcc/ada/Makefile.in Tue Feb 18 17:05:26 2003
-@@ -134,7 +134,7 @@
- objext = .o
- exeext =
- arext = .a
--soext = .so
-+soext = .so.1
- shext =
-
- HOST_CC=$(CC)
-@@ -1214,6 +1214,69 @@
- endif
- endif
-
-+ifeq ($(strip $(filter-out alpha% linux%,$(arch) $(osys))),)
-+ MLIB_TGT=5lml-tgt
-+ MISCLIB=
-+ THREADSLIB=-lpthread
-+ GNATLIB_SHARED=gnatlib-shared-dual
-+ GMEM_LIB=gmemlib
-+ LIBRARY_VERSION := $(strip $(shell grep Library_Version $(fsrcpfx)gnatvsn.ads | sed -e 's/.*GNAT Lib v\(.*\)[ "].*/\1/'))
-+endif
-+
-+ifeq ($(strip $(filter-out sparc% linux%,$(arch) $(osys))),)
-+ MLIB_TGT=5lml-tgt
-+ MISCLIB=
-+ THREADSLIB=-lpthread
-+ GNATLIB_SHARED=gnatlib-shared-dual
-+ GMEM_LIB=gmemlib
-+ LIBRARY_VERSION := $(strip $(shell grep Library_Version $(fsrcpfx)gnatvsn.ads | sed -e 's/.*GNAT Lib v\(.*\)[ "].*/\1/'))
-+endif
-+
-+ifeq ($(strip $(filter-out ia64 linux%,$(arch) $(osys))),)
-+ MLIB_TGT=5lml-tgt
-+ MISCLIB=
-+ THREADSLIB=-lpthread
-+ GNATLIB_SHARED=gnatlib-shared-dual
-+ GMEM_LIB=gmemlib
-+ LIBRARY_VERSION := $(strip $(shell grep Library_Version $(fsrcpfx)gnatvsn.ads | sed -e 's/.*GNAT Lib v\(.*\)[ "].*/\1/'))
-+endif
-+
-+ifeq ($(strip $(filter-out x86_64 linux%,$(arch) $(osys))),)
-+ MLIB_TGT=5lml-tgt
-+ MISCLIB=
-+ THREADSLIB=-lpthread
-+ GNATLIB_SHARED=gnatlib-shared-dual
-+ GMEM_LIB=gmemlib
-+ LIBRARY_VERSION := $(strip $(shell grep Library_Version $(fsrcpfx)gnatvsn.ads | sed -e 's/.*GNAT Lib v\(.*\)[ "].*/\1/'))
-+endif
-+
-+ifeq ($(strip $(filter-out powerpc linux%,$(arch) $(osys))),)
-+ MLIB_TGT=5lml-tgt
-+ MISCLIB=
-+ THREADSLIB=-lpthread
-+ GNATLIB_SHARED=gnatlib-shared-dual
-+ GMEM_LIB=gmemlib
-+ LIBRARY_VERSION := $(strip $(shell grep Library_Version $(fsrcpfx)gnatvsn.ads | sed -e 's/.*GNAT Lib v\(.*\)[ "].*/\1/'))
-+endif
-+
-+ifeq ($(strip $(filter-out s390 linux%,$(arch) $(osys))),)
-+ MLIB_TGT=5lml-tgt
-+ MISCLIB=
-+ THREADSLIB=-lpthread
-+ GNATLIB_SHARED=gnatlib-shared-dual
-+ GMEM_LIB=gmemlib
-+ LIBRARY_VERSION := $(strip $(shell grep Library_Version $(fsrcpfx)gnatvsn.ads | sed -e 's/.*GNAT Lib v\(.*\)[ "].*/\1/'))
-+endif
-+
-+ifeq ($(strip $(filter-out s390x linux%,$(arch) $(osys))),)
-+ MLIB_TGT=5lml-tgt
-+ MISCLIB=
-+ THREADSLIB=-lpthread
-+ GNATLIB_SHARED=gnatlib-shared-dual
-+ GMEM_LIB=gmemlib
-+ LIBRARY_VERSION := $(strip $(shell grep Library_Version $(fsrcpfx)gnatvsn.ads | sed -e 's/.*GNAT Lib v\(.*\)[ "].*/\1/'))
-+endif
-+
- ifeq ($(strip $(filter-out mips sgi irix%,$(targ))),)
- ifeq ($(strip $(filter-out mips sgi irix6%,$(targ))),)
- LIBGNAT_TARGET_PAIRS = \
-@@ -2179,6 +2242,9 @@
-
- gnatlib: ../stamp-gnatlib1 ../stamp-gnatlib2
- # ../xgcc -B../ -dD -E ../tconfig.h $(INCLUDES) > rts/tconfig.h
-+ $(RMDIR) save
-+ $(MKDIR) save
-+ $(MV) *.o save/
- $(MAKE) -C rts CC="../../xgcc -B../../" \
- INCLUDES="$(INCLUDES_FOR_SUBDIR) -I./../.." \
- CFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -DIN_RTS" \
-@@ -2192,6 +2258,8 @@
- srcdir=$(fsrcdir) \
- -f ../Makefile \
- $(GNATRTL_OBJS)
-+ $(MV) save/*.o .
-+ $(RMDIR) save
- $(RM) rts/libgnat$(arext) rts/libgnarl$(arext)
- $(AR) $(AR_FLAGS) rts/libgnat$(arext) \
- $(addprefix rts/,$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS))
-@@ -2041,6 +2041,7 @@
- cd rts; ../../xgcc -B../../ -shared $(TARGET_LIBGCC2_CFLAGS) \
- -o libgnarl-$(LIBRARY_VERSION)$(soext) \
- $(GNATRTL_TASKING_OBJS) \
-+ ./libgnat-$(LIBRARY_VERSION)$(soext) \
- $(SO_OPTS)libgnarl-$(LIBRARY_VERSION)$(soext) $(THREADSLIB)
- cd rts; $(LN_S) libgnat-$(LIBRARY_VERSION)$(soext) libgnat$(soext)
- cd rts; $(LN_S) libgnarl-$(LIBRARY_VERSION)$(soext) libgnarl$(soext)
+++ /dev/null
-2002-02-26 Jakub Jelinek <jakub@redhat.com>
-
- * attribs.c (c_common_attribute_table): Add visibility.
- (handle_visibility_attribute): New function.
- * varasm.c (assemble_visibility): New function.
- * output.h (assemble_visibility): Add prototype.
- * tree.h (MODULE_LOCAL_P): Define.
- * crtstuff.c (__dso_handle): Use visibility attribute.
- * config/i386/i386.h (ENCODE_SECTION_INFO): Set SYMBOL_REF_FLAG
- for MODULE_LOCAL_P symbols too.
- * config/ia64/ia64.c (ia64_encode_section_info): Handle
- MODULE_LOCAL_P symbols the same way as local symbols.
- Add SDATA_NAME_FLAG_CHAR even if decl was explicitely forced
- into .sdata/.sbss by the user.
- * doc/extend.texi (Function Attributes): Document visibility
- attribute.
-
- * gcc.dg/ia64-visibility-1.c: New test.
-
---- gcc/attribs.c 2002/02/25 22:38:52 1.14
-+++ gcc/attribs.c 2002/02/26 21:17:14 1.15
-@@ -75,6 +75,8 @@ static tree handle_weak_attribute PARAMS
- bool *));
- static tree handle_alias_attribute PARAMS ((tree *, tree, tree, int,
- bool *));
-+static tree handle_visibility_attribute PARAMS ((tree *, tree, tree, int,
-+ bool *));
- static tree handle_no_instrument_function_attribute PARAMS ((tree *, tree,
- tree, int,
- bool *));
-@@ -148,6 +150,8 @@ static const struct attribute_spec c_com
- handle_deprecated_attribute },
- { "vector_size", 1, 1, false, true, false,
- handle_vector_size_attribute },
-+ { "visibility", 1, 1, true, false, false,
-+ handle_visibility_attribute },
- { NULL, 0, 0, false, false, false, NULL }
- };
-
-@@ -1061,6 +1065,50 @@ handle_alias_attribute (node, name, args
- return NULL_TREE;
- }
-
-+/* Handle an "visibility" attribute; arguments as in
-+ struct attribute_spec.handler. */
-+
-+static tree
-+handle_visibility_attribute (node, name, args, flags, no_add_attrs)
-+ tree *node;
-+ tree name;
-+ tree args;
-+ int flags ATTRIBUTE_UNUSED;
-+ bool *no_add_attrs;
-+{
-+ tree decl = *node;
-+
-+ if (decl_function_context (decl) != 0 || ! TREE_PUBLIC (decl))
-+ {
-+ warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
-+ *no_add_attrs = true;
-+ }
-+ else
-+ {
-+ tree id;
-+
-+ id = TREE_VALUE (args);
-+ if (TREE_CODE (id) != STRING_CST)
-+ {
-+ error ("visibility arg not a string");
-+ *no_add_attrs = true;
-+ return NULL_TREE;
-+ }
-+ if (strcmp (TREE_STRING_POINTER (id), "hidden")
-+ && strcmp (TREE_STRING_POINTER (id), "protected")
-+ && strcmp (TREE_STRING_POINTER (id), "internal"))
-+ {
-+ error ("visibility arg must be one of \"hidden\", \"protected\" or \"internal\"");
-+ *no_add_attrs = true;
-+ return NULL_TREE;
-+ }
-+
-+ assemble_visibility (decl, TREE_STRING_POINTER (id));
-+ }
-+
-+ return NULL_TREE;
-+}
-+
- /* Handle a "no_instrument_function" attribute; arguments as in
- struct attribute_spec.handler. */
-
---- gcc/varasm.c 2002/02/20 23:19:19 1.250
-+++ gcc/varasm.c 2002/02/26 21:17:14 1.251
-@@ -5160,6 +5160,25 @@ assemble_alias (decl, target)
- #endif
- }
-
-+/* Emit an assembler directive to set symbol for DECL visibility to
-+ VISIBILITY_TYPE. */
-+
-+void
-+assemble_visibility (decl, visibility_type)
-+ tree decl;
-+ const char *visibility_type ATTRIBUTE_UNUSED;
-+{
-+ const char *name;
-+
-+ name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-+
-+#ifdef HAVE_GAS_HIDDEN
-+ fprintf (asm_out_file, "\t.%s\t%s\n", visibility_type, name);
-+#else
-+ warning ("visibility attribute not supported in this configuration; ignored");
-+#endif
-+}
-+
- /* Returns 1 if the target configuration supports defining public symbols
- so that one of them will be chosen at link time instead of generating a
- multiply-defined symbol error, whether through the use of weak symbols or
---- gcc/output.h 2002/02/17 14:23:50 1.94
-+++ gcc/output.h 2002/02/26 21:17:14 1.95
-@@ -255,6 +255,8 @@ extern void assemble_constant_align PARA
-
- extern void assemble_alias PARAMS ((tree, tree));
-
-+extern void assemble_visibility PARAMS ((tree, const char *));
-+
- /* Output a string of literal assembler code
- for an `asm' keyword used between functions. */
- extern void assemble_asm PARAMS ((tree));
---- gcc/tree.h 2002/02/20 00:19:33 1.308
-+++ gcc/tree.h 2002/02/26 21:17:14 1.309
-@@ -2283,6 +2283,11 @@ extern tree merge_attributes PARAMS ((t
- extern tree merge_dllimport_decl_attributes PARAMS ((tree, tree));
- #endif
-
-+/* Return true if DECL will be always resolved to a symbol defined in the
-+ same module (shared library or program). */
-+#define MODULE_LOCAL_P(DECL) \
-+ (lookup_attribute ("visibility", DECL_ATTRIBUTES (DECL)) != NULL)
-+
- /* Return a version of the TYPE, qualified as indicated by the
- TYPE_QUALS, if one exists. If no qualified version exists yet,
- return NULL_TREE. */
---- gcc/crtstuff.c 2002/02/05 10:31:01 1.54
-+++ gcc/crtstuff.c 2002/02/26 21:17:14 1.55
-@@ -213,13 +213,9 @@ STATIC void *__JCR_LIST__[]
- in one DSO or the main program is not used in another object. The
- dynamic linker takes care of this. */
-
--/* XXX Ideally the following should be implemented using
-- __attribute__ ((__visibility__ ("hidden")))
-- but the __attribute__ support is not yet there. */
- #ifdef HAVE_GAS_HIDDEN
--asm (".hidden\t__dso_handle");
-+extern void *__dso_handle __attribute__ ((__visibility__ ("hidden")));
- #endif
--
- #ifdef CRTSTUFFS_O
- void *__dso_handle = &__dso_handle;
- #else
---- gcc/config/i386/i386.h 2002/02/17 07:52:12 1.243
-+++ gcc/config/i386/i386.h 2002/02/26 21:17:18 1.244
-@@ -2266,7 +2266,9 @@ do { \
- \
- SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
- = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
-- || ! TREE_PUBLIC (DECL)); \
-+ || ! TREE_PUBLIC (DECL) \
-+ || (TREE_CODE (DECL) == VAR_DECL \
-+ && MODULE_LOCAL_P (DECL))); \
- } \
- } \
- } while (0)
---- gcc/config/ia64/ia64.c 2002/01/21 02:24:02 1.139
-+++ gcc/config/ia64/ia64.c 2002/02/26 22:41:48 1.141
-@@ -6897,13 +6904,14 @@ ia64_encode_section_info (decl)
- statically allocated, but the space is allocated somewhere else. Such
- decls can not be own data. */
- if (! TARGET_NO_SDATA
-- && TREE_STATIC (decl) && ! DECL_EXTERNAL (decl)
-- && ! (DECL_ONE_ONLY (decl) || DECL_WEAK (decl))
-- && ! (TREE_PUBLIC (decl)
-- && (flag_pic
-- || (DECL_COMMON (decl)
-- && (DECL_INITIAL (decl) == 0
-- || DECL_INITIAL (decl) == error_mark_node))))
-+ && ((TREE_STATIC (decl) && ! DECL_EXTERNAL (decl)
-+ && ! (DECL_ONE_ONLY (decl) || DECL_WEAK (decl))
-+ && ! (TREE_PUBLIC (decl)
-+ && (flag_pic
-+ || (DECL_COMMON (decl)
-+ && (DECL_INITIAL (decl) == 0
-+ || DECL_INITIAL (decl) == error_mark_node)))))
-+ || MODULE_LOCAL_P (decl))
- /* Either the variable must be declared without a section attribute,
- or the section must be sdata or sbss. */
- && (DECL_SECTION_NAME (decl) == 0
-@@ -6923,9 +6931,12 @@ ia64_encode_section_info (decl)
- ;
-
- /* If this is an incomplete type with size 0, then we can't put it in
-- sdata because it might be too big when completed. */
-- else if (size > 0
-- && size <= (HOST_WIDE_INT) ia64_section_threshold
-+ sdata because it might be too big when completed.
-+ Objects bigger than threshold should have SDATA_NAME_FLAG_CHAR
-+ added if they are in .sdata or .sbss explicitely. */
-+ else if (((size > 0
-+ && size <= (HOST_WIDE_INT) ia64_section_threshold)
-+ || DECL_SECTION_NAME (decl))
- && symbol_str[0] != SDATA_NAME_FLAG_CHAR)
- {
- size_t len = strlen (symbol_str);
---- gcc/doc/extend.texi 2002/02/23 12:59:07 1.64
-+++ gcc/doc/extend.texi 2002/02/26 21:17:17 1.65
-@@ -2198,7 +2198,7 @@ The @code{alias} attribute causes the de
- alias for another symbol, which must be specified. For instance,
-
- @smallexample
--void __f () @{ /* do something */; @}
-+void __f () @{ /* @r{Do something.} */; @}
- void f () __attribute__ ((weak, alias ("__f")));
- @end smallexample
-
-@@ -2206,6 +2206,19 @@ declares @samp{f} to be a weak alias for
- mangled name for the target must be used.
-
- Not all target machines support this attribute.
-+
-+@item visibility ("@var{visibility_type}")
-+@cindex @code{visibility} attribute
-+The @code{visibility} attribute on ELF targets causes the declaration
-+to be emitted with hidden, protected or internal visibility.
-+
-+@smallexample
-+void __attribute__ ((visibility ("protected")))
-+f () @{ /* @r{Do something.} */; @}
-+int i __attribute__ ((visibility ("hidden")));
-+@end smallexample
-+
-+Not all ELF targets support this attribute.
-
- @item regparm (@var{number})
- @cindex functions that are passed arguments in registers on the 386
---- gcc/testsuite/gcc.dg/ia64-visibility-1.c.jj Tue Feb 26 12:30:32 2002
-+++ gcc/testsuite/gcc.dg/ia64-visibility-1.c Tue Feb 26 12:33:26 2002
-@@ -0,0 +1,36 @@
-+/* Test visibility attribute. */
-+/* { dg-do compile { target ia64*-*-linux* } } */
-+/* { dg-options "-O2 -fpic" } */
-+/* { dg-final { scan-assembler "\\.hidden.*variable_j" } } */
-+/* { dg-final { scan-assembler "\\.hidden.*variable_m" } } */
-+/* { dg-final { scan-assembler "\\.protected.*baz" } } */
-+/* { dg-final { scan-assembler "gprel.*variable_i" } } */
-+/* { dg-final { scan-assembler "gprel.*variable_j" } } */
-+/* { dg-final { scan-assembler "ltoff.*variable_k" } } */
-+/* { dg-final { scan-assembler "gprel.*variable_l" } } */
-+/* { dg-final { scan-assembler "gprel.*variable_m" } } */
-+/* { dg-final { scan-assembler "ltoff.*variable_n" } } */
-+
-+static int variable_i;
-+int variable_j __attribute__((visibility ("hidden")));
-+int variable_k;
-+struct A { char a[64]; };
-+static struct A variable_l __attribute__((section (".sbss")));
-+struct A variable_m __attribute__((visibility ("hidden"), section(".sbss")));
-+struct A variable_n __attribute__((section (".sbss")));
-+
-+int foo (void)
-+{
-+ return variable_i + variable_j + variable_k;
-+}
-+
-+void bar (void)
-+{
-+ variable_l.a[10] = 0;
-+ variable_m.a[10] = 0;
-+ variable_n.a[10] = 0;
-+}
-+
-+void __attribute__((visibility ("protected"))) baz (void)
-+{
-+}
+++ /dev/null
-2002-03-06 Jakub Jelinek <jakub@redhat.com>
-
- * config/i386/i386.h (REDO_SECTION_INFO_P): Define.
-
-2002-03-02 Richard Henderson <rth@redhat.com>
-
- * config/i386/i386.h (ENCODE_SECTION_INFO): MODULE_LOCAL_P applies
- to functions as well.
-
-2002-03-02 Richard Henderson <rth@redhat.com>
-
- * attribs.c (handle_visibility_attribute): Don't call
- assemble_visibility.
- * varasm.c (maybe_assemble_visibility): New.
- (assemble_start_function, assemble_variable, assemble_alias): Use it.
-
---- gcc/config/i386/i386.h.jj Tue Jun 4 18:54:32 2002
-+++ gcc/config/i386/i386.h Tue Jun 4 18:54:42 2002
-@@ -2268,12 +2268,13 @@ do { \
- SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
- = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
- || ! TREE_PUBLIC (DECL) \
-- || (TREE_CODE (DECL) == VAR_DECL \
-- && MODULE_LOCAL_P (DECL))); \
-+ || MODULE_LOCAL_P (DECL)); \
- } \
- } \
- } while (0)
-
-+#define REDO_SECTION_INFO_P(DECL) 1
-+
- /* The `FINALIZE_PIC' macro serves as a hook to emit these special
- codes once the function is being compiled into assembly code, but
- not before. (It is not done before, because in the case of
---- gcc/varasm.c.jj Tue Jun 4 18:54:32 2002
-+++ gcc/varasm.c Tue Jun 4 18:54:42 2002
-@@ -167,6 +167,7 @@ static unsigned min_align PARAMS ((unsi
- static void output_constructor PARAMS ((tree, HOST_WIDE_INT,
- unsigned int));
- static void globalize_decl PARAMS ((tree));
-+static void maybe_assemble_visibility PARAMS ((tree));
- static int in_named_entry_eq PARAMS ((const PTR, const PTR));
- static hashval_t in_named_entry_hash PARAMS ((const PTR));
- #ifdef ASM_OUTPUT_BSS
-@@ -1238,6 +1239,8 @@ assemble_start_function (decl, fnname)
- }
-
- globalize_decl (decl);
-+
-+ maybe_assemble_visibility (decl);
- }
-
- /* Do any machine/system dependent processing of the function name */
-@@ -1591,6 +1594,9 @@ assemble_variable (decl, top_level, at_e
- DECL_ALIGN (decl) = align;
- set_mem_align (decl_rtl, align);
-
-+ if (TREE_PUBLIC (decl))
-+ maybe_assemble_visibility (decl);
-+
- /* Handle uninitialized definitions. */
-
- if ((DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node)
-@@ -5167,7 +5173,11 @@ assemble_alias (decl, target)
- #ifdef ASM_OUTPUT_DEF
- /* Make name accessible from other files, if appropriate. */
- if (TREE_PUBLIC (decl))
-- globalize_decl (decl);
-+ {
-+ globalize_decl (decl);
-+
-+ maybe_assemble_visibility (decl);
-+ }
-
- #ifdef ASM_OUTPUT_DEF_FROM_DECLS
- ASM_OUTPUT_DEF_FROM_DECLS (asm_out_file, decl, target);
-@@ -5213,6 +5223,21 @@ assemble_visibility (decl, visibility_ty
- #endif
- }
-
-+/* A helper function to call assemble_visibility when needed for a decl. */
-+
-+static void
-+maybe_assemble_visibility (decl)
-+ tree decl;
-+{
-+ tree visibility = lookup_attribute ("visibility", DECL_ATTRIBUTES (decl));
-+ if (visibility)
-+ {
-+ const char *type
-+ = TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (visibility)));
-+ assemble_visibility (decl, type);
-+ }
-+}
-+
- /* Returns 1 if the target configuration supports defining public symbols
- so that one of them will be chosen at link time instead of generating a
- multiply-defined symbol error, whether through the use of weak symbols or
---- gcc/attribs.c.jj Tue Jun 4 18:54:32 2002
-+++ gcc/attribs.c Tue Jun 4 18:54:42 2002
-@@ -1101,8 +1101,6 @@ handle_visibility_attribute (node, name,
- *no_add_attrs = true;
- return NULL_TREE;
- }
--
-- assemble_visibility (decl, TREE_STRING_POINTER (id));
- }
-
- return NULL_TREE;
+++ /dev/null
-2002-07-31 Jakub Jelinek <jakub@redhat.com>
-
- * varasm.c (assemble_visibility): Strip name encoding.
-
- * gcc.dg/ia64-visibility-2.c: New test.
-
---- gcc/testsuite/gcc.dg/ia64-visibility-2.c.jj 2002-07-31 16:31:50.000000000 +0200
-+++ gcc/testsuite/gcc.dg/ia64-visibility-2.c 2002-07-31 16:32:36.000000000 +0200
-@@ -0,0 +1,15 @@
-+/* Test visibility attribute. */
-+/* { dg-do link { target ia64*-*-linux* } } */
-+/* { dg-options "-O2 -fpic" } */
-+
-+int foo (int x);
-+int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
-+int bar (int x)
-+{
-+ return x;
-+}
-+
-+int main ()
-+{
-+ return 0;
-+}
---- gcc/varasm.c.jj 2002-07-30 12:49:45.000000000 +0200
-+++ gcc/varasm.c 2002-07-31 16:20:22.000000000 +0200
-@@ -5227,7 +5227,7 @@ assemble_visibility (decl, visibility_ty
- {
- const char *name;
-
-- name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-+ STRIP_NAME_ENCODING (name, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
-
- #ifdef HAVE_GAS_HIDDEN
- fprintf (asm_out_file, "\t.%s\t%s\n", visibility_type, name);
+++ /dev/null
-2002-08-23 Jakub Jelinek <jakub@redhat.com>
-
- * config/alpha/alpha.c (alpha_encode_section_info): Use
- MODULE_LOCAL_P.
-
---- gcc/config/alpha/alpha.c.jj 2002-05-30 11:12:20.000000000 +0200
-+++ gcc/config/alpha/alpha.c 2002-08-23 12:05:30.000000000 +0200
-@@ -1594,7 +1594,7 @@ alpha_encode_section_info (decl)
- /* Linkonce and weak data is never local. */
- else if (DECL_ONE_ONLY (decl) || DECL_WEAK (decl))
- is_local = false;
-- else if (! TREE_PUBLIC (decl))
-+ else if (! TREE_PUBLIC (decl) || MODULE_LOCAL_P (decl))
- is_local = true;
- /* If PIC, then assume that any global name can be overridden by
- symbols resolved from other modules. */
+++ /dev/null
-2002-08-28 Jakub Jelinek <jakub@redhat.com>
-
- * config/alpha/alpha.c (alpha_encode_section_info): Check static and
- visibility before DECL_EXTERNAL.
-
---- gcc/config/alpha/alpha.c.jj 2002-08-28 11:20:29.000000000 +0200
-+++ gcc/config/alpha/alpha.c 2002-08-28 21:50:55.000000000 +0200
-@@ -1589,13 +1589,13 @@ alpha_encode_section_info (decl)
-
- /* A variable is considered "local" if it is defined in this module. */
-
-- if (DECL_EXTERNAL (decl))
-+ if (! TREE_PUBLIC (decl) || MODULE_LOCAL_P (decl))
-+ is_local = true;
-+ else if (DECL_EXTERNAL (decl))
- is_local = false;
- /* Linkonce and weak data is never local. */
- else if (DECL_ONE_ONLY (decl) || DECL_WEAK (decl))
- is_local = false;
-- else if (! TREE_PUBLIC (decl) || MODULE_LOCAL_P (decl))
-- is_local = true;
- /* If PIC, then assume that any global name can be overridden by
- symbols resolved from other modules. */
- else if (flag_pic)
+++ /dev/null
-diff -urN boehm-gc.org/Makefile.am boehm-gc/Makefile.am
---- boehm-gc.org/Makefile.am Sat Oct 18 12:32:07 2003
-+++ boehm-gc/Makefile.am Sat Oct 18 12:32:55 2003
-@@ -39,7 +39,8 @@
- # linuxthread semaphore functions get linked:
- libgcjgc_la_LIBADD = @addobjs@ $(THREADLIBS)
- libgcjgc_la_DEPENDENCIES = @addobjs@
--libgcjgc_la_LDFLAGS = -version-info 1:1:0 -rpath $(toolexeclibdir)
-+libgcjgc_la_LDFLAGS = @LIBGCJGC_EXTRA_LDFLAGS@ -version-info 1:1:0 \
-+ -rpath $(toolexeclibdir)
-
- libgcjgc_convenience_la_LIBADD = @addobjs@
- libgcjgc_convenience_la_DEPENDENCIES = @addobjs@
-diff -urN boehm-gc.org/Makefile.in boehm-gc/Makefile.in
---- boehm-gc.org/Makefile.in Thu Oct 16 22:10:48 2003
-+++ boehm-gc/Makefile.in Sat Oct 18 12:32:55 2003
-@@ -133,7 +133,8 @@
- # linuxthread semaphore functions get linked:
- libgcjgc_la_LIBADD = @addobjs@ $(THREADLIBS)
- libgcjgc_la_DEPENDENCIES = @addobjs@
--libgcjgc_la_LDFLAGS = -version-info 1:1:0 -rpath $(toolexeclibdir)
-+libgcjgc_la_LDFLAGS = @LIBGCJGC_EXTRA_LDFLAGS@ -version-info 1:1:0 \
-+ -rpath $(toolexeclibdir)
-
- libgcjgc_convenience_la_LIBADD = @addobjs@
- libgcjgc_convenience_la_DEPENDENCIES = @addobjs@
-diff -urN boehm-gc.org/configure boehm-gc/configure
---- boehm-gc.org/configure Sat Oct 18 12:32:07 2003
-+++ boehm-gc/configure Sat Oct 18 12:33:48 2003
-@@ -2717,11 +2717,57 @@
- fi
-
-
-+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-+echo "configure:2635: checking for dlopen in -ldl" >&5
-+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
-+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-+ echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+ ac_save_LIBS="$LIBS"
-+LIBS="-ldl $LIBS"
-+cat > conftest.$ac_ext <<EOF
-+#line 2643 "configure"
-+#include "confdefs.h"
-+/* Override any gcc2 internal prototype to avoid an error. */
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char dlopen();
-+
-+int main() {
-+dlopen()
-+; return 0; }
-+EOF
-+if { (eval echo configure:2654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-+ rm -rf conftest*
-+ eval "ac_cv_lib_$ac_lib_var=yes"
-+else
-+ echo "configure: failed program was:" >&5
-+ cat conftest.$ac_ext >&5
-+ rm -rf conftest*
-+ eval "ac_cv_lib_$ac_lib_var=no"
-+fi
-+rm -f conftest*
-+LIBS="$ac_save_LIBS"
-+
-+fi
-+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-+ echo "$ac_t""yes" 1>&6
-+
-+EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl"
-+LIBGCJGC_EXTRA_LDFLAGS="-ldl"
-+
-+else
-+ echo "$ac_t""no" 1>&6
-+fi
-+
-+
-+
- INCLUDES=-I${srcdir}/include
- THREADLIBS=
- case "$THREADS" in
- no | none | single)
- THREADS=none
-+ LIBGCJGC_EXTRA_LDFLAGS=
- ;;
- posix | pthreads)
- THREADS=posix
-@@ -2806,6 +2852,7 @@
- ;;
- *-*-cygwin*)
- THREADLIBS=
-+ LIBGCJGC_EXTRA_LDFLAGS=
- ;;
- esac
- ;;
-@@ -2834,48 +2881,6 @@
- esac
-
-
--echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
--echo "configure:2839: checking for dlopen in -ldl" >&5
--ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
--if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- ac_save_LIBS="$LIBS"
--LIBS="-ldl $LIBS"
--cat > conftest.$ac_ext <<EOF
--#line 2847 "configure"
--#include "confdefs.h"
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char dlopen();
--
--int main() {
--dlopen()
--; return 0; }
--EOF
--if { (eval echo configure:2858: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=no"
--fi
--rm -f conftest*
--LIBS="$ac_save_LIBS"
--
--fi
--if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-- EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl"
--else
-- echo "$ac_t""no" 1>&6
--fi
--
--
--
- target_all=libgcjgc.la
-
-
-@@ -3295,8 +3300,9 @@
- s%@STRIP@%$STRIP%g
- s%@LIBTOOL@%$LIBTOOL%g
- s%@CXXCPP@%$CXXCPP%g
--s%@THREADLIBS@%$THREADLIBS%g
- s%@EXTRA_TEST_LIBS@%$EXTRA_TEST_LIBS%g
-+s%@THREADLIBS@%$THREADLIBS%g
-+s%@LIBGCJGC_EXTRA_LDFLAGS@%$LIBGCJGC_EXTRA_LDFLAGS%g
- s%@target_all@%$target_all%g
- s%@INCLUDES@%$INCLUDES%g
- s%@CXXINCLUDES@%$CXXINCLUDES%g
-diff -urN boehm-gc.org/configure.in boehm-gc/configure.in
---- boehm-gc.org/configure.in Sat Oct 18 12:32:07 2003
-+++ boehm-gc/configure.in Sat Oct 18 12:32:55 2003
-@@ -63,11 +63,18 @@
- esac]
- )
-
-+AC_CHECK_LIB(dl, dlopen, [
-+EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl"
-+LIBGCJGC_EXTRA_LDFLAGS="-ldl"
-+])
-+AC_SUBST(EXTRA_TEST_LIBS)
-+
- INCLUDES=-I${srcdir}/include
- THREADLIBS=
- case "$THREADS" in
- no | none | single)
- THREADS=none
-+ LIBGCJGC_EXTRA_LDFLAGS=
- ;;
- posix | pthreads)
- THREADS=posix
-@@ -110,6 +117,7 @@
- ;;
- *-*-cygwin*)
- THREADLIBS=
-+ LIBGCJGC_EXTRA_LDFLAGS=
- ;;
- esac
- ;;
-@@ -128,9 +136,7 @@
- ;;
- esac
- AC_SUBST(THREADLIBS)
--
--AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
--AC_SUBST(EXTRA_TEST_LIBS)
-+AC_SUBST(LIBGCJGC_EXTRA_LDFLAGS)
-
- target_all=libgcjgc.la
- AC_SUBST(target_all)
+++ /dev/null
-2001-10-12 Jakub Jelinek <jakub@redhat.com>
-
- * tree-inline.c (initialize_inlined_parameters): Fail if less
- arguments are passed than expected.
- (expand_call_inline): Cleanup if initialize_inlined_parameters
- fails.
-
- * g++.dg/other/inline1.C: New test.
-
---- gcc/tree-inline.c.jj Tue Oct 9 16:03:13 2001
-+++ gcc/tree-inline.c Fri Oct 12 17:08:23 2001
-@@ -474,20 +474,28 @@ initialize_inlined_parameters (id, args,
-
- /* Loop through the parameter declarations, replacing each with an
- equivalent VAR_DECL, appropriately initialized. */
-- for (p = parms, a = args; p;
-- a = a ? TREE_CHAIN (a) : a, p = TREE_CHAIN (p))
-+ for (p = parms, a = args; p; a = TREE_CHAIN (a), p = TREE_CHAIN (p))
- {
- #ifndef INLINER_FOR_JAVA
- tree init_stmt;
- tree cleanup;
- #endif /* not INLINER_FOR_JAVA */
- tree var;
- tree value;
- tree var_sub;
-
-+ if (a == NULL_TREE)
-+ {
-+ pop_srcloc ();
-+ /* If less arguments were passed than actually required,
-+ issue warning and avoid inlining. */
-+ warning ("too few arguments passed to inline function, suppressing inlining");
-+ return error_mark_node;
-+ }
-+
- /* Find the initializer. */
- value = (*lang_hooks.tree_inlining.convert_parm_for_inlining)
-- (p, a ? TREE_VALUE (a) : NULL_TREE, fn);
-+ (p, TREE_VALUE (a), fn);
-
- /* If the parameter is never assigned to, we may not need to
- create a new variable here at all. Instead, we may be able
-@@ -863,6 +871,14 @@ expand_call_inline (tp, walk_subtrees, d
-
- /* Initialize the parameters. */
- arg_inits = initialize_inlined_parameters (id, TREE_OPERAND (t, 1), fn);
-+ if (arg_inits == error_mark_node)
-+ {
-+ /* Clean up. */
-+ splay_tree_delete (id->decl_map);
-+ id->decl_map = st;
-+ return NULL_TREE;
-+ }
-+
- /* Expand any inlined calls in the initializers. Do this before we
- push FN on the stack of functions we are inlining; we want to
- inline calls to FN that appear in the initializers for the
---- gcc/testsuite/g++.dg/other/inline1.C.jj Fri Oct 12 16:54:05 2001
-+++ gcc/testsuite/g++.dg/other/inline1.C Fri Oct 12 17:14:35 2001
-@@ -0,0 +1,38 @@
-+// { dg-do compile { target i?86-*-* } }
-+// { dg-options -O }
-+
-+typedef unsigned int u4;
-+typedef unsigned long long u8;
-+typedef u8 (*u8tou8)(u8);
-+
-+struct C {
-+ static inline u8 a(u4 x, u4 y);
-+ static inline u8 b(unsigned char *p) { return c(*(u8 *)p); }
-+ static inline u8 c(u8 x) { // { dg-warning "too few arguments" "too few" }
-+ return ((u8tou8)a)(x);
-+ }
-+};
-+
-+inline u8 C::a(u4 x, u4 y) {
-+ return x + y;
-+}
-+
-+u8 n = 0x123456789abcdef;
-+
-+struct B {
-+ unsigned char *e;
-+ B() { e = (unsigned char *) &n; }
-+ u8 f() {
-+ return C::b(e);
-+ }
-+};
-+
-+struct A {
-+ B *g;
-+ void foo ();
-+};
-+
-+void A::foo ()
-+{
-+ g->f();
-+}
+++ /dev/null
-2002-07-11 Jakub Jelinek <jakub@redhat.com>
-
- * g++.dg/opt/nrv5.C: New test.
-
-2002-07-05 Jason Merrill <jason@redhat.com>
-
- * g++.dg/opt/nrv4.C: New test.
-
-2002-04-09 Jason Merrill <jason@redhat.com>
-
- * g++.dg/opt/nrv3.C: New test.
-
---- gcc/testsuite/g++.dg/opt/nrv3.C.jj Thu Apr 11 16:25:15 2002
-+++ gcc/testsuite/g++.dg/opt/nrv3.C Tue Apr 9 19:02:43 2002
-@@ -0,0 +1,24 @@
-+// PR optimization/6189
-+// Bug: we forgot about foo's nrv after writing it out.
-+// { dg-options -O3 }
-+// { dg-do run }
-+
-+struct A
-+{
-+ int i;
-+};
-+
-+
-+A foo ()
-+{
-+ A a;
-+ a.i = 42;
-+ return a;
-+}
-+
-+
-+int main()
-+{
-+ A b = foo();
-+ return b.i != 42;
-+}
---- gcc/testsuite/g++.dg/opt/nrv4.C.jj Thu Apr 11 16:25:15 2002
-+++ gcc/testsuite/g++.dg/opt/nrv4.C Fri Jul 5 17:16:56 2002
-@@ -0,0 +1,23 @@
-+// PR optimization/7145
-+// Bug: The NRV optimization caused us to lose the initializer for 'ret'.
-+// { dg-options -O }
-+// { dg-do run }
-+
-+struct GdkColor {
-+ long pixel;
-+ short red;
-+ short green;
-+ short blue;
-+};
-+
-+inline GdkColor mkcolor() {
-+ GdkColor ret={0,1,2,3};
-+ return ret;
-+}
-+
-+int
-+main()
-+{
-+ GdkColor col=mkcolor();
-+ return (col.pixel != 0 || col.red != 1 || col.green != 2 || col.blue != 3);
-+}
---- gcc/testsuite/g++.dg/opt/nrv5.C.jj Thu Apr 11 16:25:15 2002
-+++ gcc/testsuite/g++.dg/opt/nrv5.C Thu Jul 11 11:29:33 2002
-@@ -0,0 +1,52 @@
-+// Test for the named return value optimization with inlining.
-+// Contributed by Jakub Jelinek <jakub@redhat.com>.
-+// { dg-do run }
-+// { dg-options -O2 }
-+
-+enum E { E0, E1, E2, E3 };
-+
-+struct S
-+{
-+ E s0 : 2;
-+ bool s1 : 1, s2 : 1, s3 : 1, s4 : 1, s5 : 1, s6 : 1;
-+ S () : s1 (true), s2 (false), s0 (E1), s3 (true), s4 (false), s5 (true), s6 (false) {}
-+ void foo (E x) { this->s0 = x; }
-+};
-+
-+inline S foo ()
-+{
-+ S s;
-+ s.foo (E0);
-+ return s;
-+}
-+
-+inline S bar ()
-+{
-+ S s;
-+ s.foo (E2);
-+ return s;
-+}
-+
-+void check (S &s, bool isfoo);
-+
-+void test (bool isfoo)
-+{
-+ S a = isfoo ? foo () : bar ();
-+ check (a, isfoo);
-+}
-+
-+extern "C" void abort ();
-+
-+void check (S &s, bool isfoo)
-+{
-+ if (! s.s1 || s.s2 || ! s.s3 || s.s4 || ! s.s5 || s.s6)
-+ abort ();
-+ if (s.s0 != (isfoo ? E0 : E2))
-+ abort ();
-+}
-+
-+int main ()
-+{
-+ test (true);
-+ test (false);
-+}
+++ /dev/null
-2002-05-24 Jakub Jelinek <jakub@redhat.com>
-
- PR c++/6794
- * decl.c (cp_make_fname_decl): If outside of function, emit
- the variable immediately.
- * call.c (build_call): Avoid crashing when noreturn function
- is called outside of function context.
-
- * g++.dg/ext/pretty1.C: New test.
- * g++.dg/ext/pretty2.C: New test.
-
---- gcc/cp/decl.c.jj Tue May 21 20:27:10 2002
-+++ gcc/cp/decl.c Fri May 24 17:28:16 2002
-@@ -6772,7 +6772,10 @@ cp_make_fname_decl (id, type_dep)
- TREE_USED (decl) = 1;
-
- cp_finish_decl (decl, init, NULL_TREE, LOOKUP_ONLYCONVERTING);
--
-+
-+ if (!current_function_decl)
-+ rest_of_decl_compilation (decl, 0, 1, 0);
-+
- return decl;
- }
-
---- gcc/cp/call.c.jj Mon Apr 15 14:48:51 2002
-+++ gcc/cp/call.c Fri May 24 12:49:22 2002
-@@ -408,7 +408,7 @@ build_call (function, parms)
- nothrow = ((decl && TREE_NOTHROW (decl))
- || TYPE_NOTHROW_P (TREE_TYPE (TREE_TYPE (function))));
-
-- if (decl && TREE_THIS_VOLATILE (decl))
-+ if (decl && TREE_THIS_VOLATILE (decl) && current_function_decl)
- current_function_returns_abnormally = 1;
-
- if (decl && TREE_DEPRECATED (decl))
---- gcc/testsuite/g++.dg/ext/pretty1.C.jj Fri May 24 18:09:27 2002
-+++ gcc/testsuite/g++.dg/ext/pretty1.C Fri May 24 18:13:10 2002
-@@ -0,0 +1,67 @@
-+// PR c++/6794
-+// Test whether __PRETTY_FUNCTION__ works in templates, functions and
-+// in initializers at global scope
-+// { dg-do compile }
-+// { dg-options "" }
-+
-+extern "C" void __assert_fail (const char *, const char *,
-+ unsigned int, const char *)
-+ throw() __attribute__((noreturn));
-+extern "C" void abort (void);
-+extern "C" void exit (int);
-+
-+#define str(expr) #expr
-+#define assert(expr) \
-+ ((expr) ? 0 : (__assert_fail (str(expr), __FILE__, __LINE__, \
-+ __PRETTY_FUNCTION__), 0))
-+
-+int __attribute__((noinline))
-+foo (void)
-+{
-+ return 1;
-+}
-+
-+template<class T> int
-+bar (T)
-+{
-+ return (assert (foo ()), 1);
-+}
-+
-+template<> int
-+bar<int> (int)
-+{
-+ return (assert (foo ()), 2);
-+}
-+
-+int a = (assert (foo ()), 1);
-+int b = (assert (foo ()), 2);
-+
-+int
-+main ()
-+{
-+ double c = 1.0;
-+ unsigned char *d = 0;
-+ int e = (assert (foo ()), 3);
-+
-+ bar (c);
-+ bar (d);
-+ bar (e);
-+}
-+
-+namespace N
-+{
-+ int f = (assert (foo ()), 4);
-+}
-+
-+void __attribute__((noinline))
-+__assert_fail (const char *cond, const char *file, unsigned int line,
-+ const char *pretty) throw ()
-+{
-+ abort ();
-+}
-+
-+// { dg-final { scan-assembler "int bar\\(T\\).*with T = int" } }
-+// { dg-final { scan-assembler "top level" } }
-+// { dg-final { scan-assembler "int main\\(\\)" } }
-+// { dg-final { scan-assembler "int bar\\(T\\).*with T = double" } }
-+// { dg-final { scan-assembler "int bar\\(T\\).*with T = unsigned char\*" } }
---- gcc/testsuite/g++.dg/ext/pretty2.C.jj Fri May 24 18:09:27 2002
-+++ gcc/testsuite/g++.dg/ext/pretty2.C Fri May 24 18:13:42 2002
-@@ -0,0 +1,61 @@
-+// PR c++/6794
-+// Test whether __PRETTY_FUNCTION__ works in templates, functions and
-+// in initializers at global scope
-+// { dg-do run }
-+// { dg-options "" }
-+
-+extern "C" void __assert_fail (const char *, const char *,
-+ unsigned int, const char *)
-+ throw() __attribute__((noreturn));
-+extern "C" void abort (void);
-+extern "C" void exit (int);
-+
-+#define str(expr) #expr
-+#define assert(expr) \
-+ ((expr) ? 0 : (__assert_fail (str(expr), __FILE__, __LINE__, \
-+ __PRETTY_FUNCTION__), 0))
-+
-+int __attribute__((noinline))
-+foo (void)
-+{
-+ return 1;
-+}
-+
-+template<class T> int
-+bar (T)
-+{
-+ return (assert (foo ()), 1);
-+}
-+
-+template<> int
-+bar<int> (int)
-+{
-+ return (assert (foo ()), 2);
-+}
-+
-+int a = (assert (foo ()), 1);
-+int b = (assert (foo ()), 2);
-+
-+int
-+main ()
-+{
-+ double c = 1.0;
-+ unsigned char *d = 0;
-+ int e = (assert (foo ()), 3);
-+
-+ bar (c);
-+ bar (d);
-+ bar (e);
-+}
-+
-+namespace N
-+{
-+ int f = (assert (foo ()), 4);
-+}
-+
-+void __attribute__((noinline))
-+__assert_fail (const char *cond, const char *file, unsigned int line,
-+ const char *pretty) throw ()
-+{
-+ abort ();
-+}
+++ /dev/null
-2002-05-09 Jason Merrill <jason@redhat.com>
-
- * g++.dg/ext/asm2.C: New test.
-
---- gcc/testsuite/g++.dg/ext/asm2.C.jj Wed May 15 13:51:22 2002
-+++ gcc/testsuite/g++.dg/ext/asm2.C Sun May 12 11:25:45 2002
-@@ -0,0 +1,12 @@
-+// Bug: in a template, we forgot that this was a simple asm, and decided
-+// that %edi was a malformed operand specifier.
-+
-+template <class T> class I {
-+public:
-+ void f() { asm ("# mov %edi, %esi" ); }
-+};
-+
-+int main () {
-+ I<int> x;
-+ x.f();
-+}
+++ /dev/null
-2002-05-28 Richard Henderson <rth@redhat.com>
-
- * flow.c (calculate_global_regs_live): Rename call_used to
- invalidated_by_call. Initialize from regs_invalidated_by_call
- instead of call_used_regs.
-
-2002-07-20 Jakub Jelinek <jakub@redhat.com>
-
- * g++.dg/opt/life1.C: New test.
-
---- gcc/flow.c 28 May 2002 12:53:39 -0000 1.527
-+++ gcc/flow.c 28 May 2002 20:01:29 -0000 1.528
-@@ -1048,19 +1048,19 @@ calculate_global_regs_live (blocks_in, b
- int flags;
- {
- basic_block *queue, *qhead, *qtail, *qend;
-- regset tmp, new_live_at_end, call_used;
-- regset_head tmp_head, call_used_head;
-+ regset tmp, new_live_at_end, invalidated_by_call;
-+ regset_head tmp_head, invalidated_by_call_head;
- regset_head new_live_at_end_head;
- int i;
-
- tmp = INITIALIZE_REG_SET (tmp_head);
- new_live_at_end = INITIALIZE_REG_SET (new_live_at_end_head);
-- call_used = INITIALIZE_REG_SET (call_used_head);
-+ invalidated_by_call = INITIALIZE_REG_SET (invalidated_by_call_head);
-
- /* Inconveniently, this is only readily available in hard reg set form. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
-- if (call_used_regs[i])
-- SET_REGNO_REG_SET (call_used, i);
-+ if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i))
-+ SET_REGNO_REG_SET (invalidated_by_call, i);
-
- /* Create a worklist. Allocate an extra slot for ENTRY_BLOCK, and one
- because the `head == tail' style test for an empty queue doesn't
-@@ -1147,7 +1147,7 @@ calculate_global_regs_live (blocks_in, b
- if (e->flags & EDGE_EH)
- {
- bitmap_operation (tmp, sb->global_live_at_start,
-- call_used, BITMAP_AND_COMPL);
-+ invalidated_by_call, BITMAP_AND_COMPL);
- IOR_REG_SET (new_live_at_end, tmp);
- }
- else
-@@ -1315,7 +1315,7 @@ calculate_global_regs_live (blocks_in, b
-
- FREE_REG_SET (tmp);
- FREE_REG_SET (new_live_at_end);
-- FREE_REG_SET (call_used);
-+ FREE_REG_SET (invalidated_by_call);
-
- if (blocks_out)
- {
---- gcc/testsuite/g++.dg/opt/life1.C.jj Sat Jul 20 18:57:05 2002
-+++ gcc/testsuite/g++.dg/opt/life1.C Sat Jul 20 19:00:01 2002
-@@ -0,0 +1,16 @@
-+// This testcase did not set up the pic register on IA-32 due
-+// to bug in calculate_global_regs_live EH edge handling.
-+// { dg-do compile { target i?86-*-linux* } }
-+// { dg-options "-O2 -fPIC" }
-+
-+struct A { };
-+
-+void foo (A (*fn)())
-+{
-+ try {
-+ A a = fn ();
-+ } catch (...) {
-+ }
-+}
-+
-+// { dg-final { scan-assembler "GLOBAL_OFFSET_TABLE" } }
+++ /dev/null
-2002-07-11 Jakub Jelinek <jakub@redhat.com>
-
- PR debug/7241
- * dwarf2out.c (base_type_die): Use DW_ATE_*_char even if main
- variant is char_type_node and type name is char.
-
---- gcc/dwarf2out.c.jj Wed Jun 19 15:09:56 2002
-+++ gcc/dwarf2out.c Thu Jul 11 20:47:52 2002
-@@ -7335,9 +7335,11 @@ base_type_die (type)
- /* Carefully distinguish the C character types, without messing
- up if the language is not C. Note that we check only for the names
- that contain spaces; other names might occur by coincidence in other
-- languages. */
-+ languages, so we only check if main variant is char_type_node. */
- if (! (TYPE_PRECISION (type) == CHAR_TYPE_SIZE
- && (type == char_type_node
-+ || (TYPE_MAIN_VARIANT (type) == char_type_node
-+ && ! strcmp (type_name, "char"))
- || ! strcmp (type_name, "signed char")
- || ! strcmp (type_name, "unsigned char"))))
- {
+++ /dev/null
-2002-08-14 Nathan Sidwell <nathan@codesourcery.com>
-
- * doc/invoke.texi (-a): Remove documentation.
- (-fprofile-arcs): Remove reference to -a, -ax options.
- * doc/gcov.texi (Gcov Data Files): Data might be merged.
-
---- gcc/doc/gcov.texi.jj 2001-11-15 11:38:19.000000000 +0100
-+++ gcc/doc/gcov.texi 2002-08-22 11:48:48.000000000 +0200
-@@ -388,7 +388,7 @@ built with the GCC @option{-fprofile-arc
- separate @file{.da} file is created for each source file compiled with
- this option, and the name of the @file{.da} file is stored as an
- absolute pathname in the resulting object file. This path name is
--derived from the source file name by substituting a @file{.da} suffix.
-+derived from the object file name by substituting a @file{.da} suffix.
-
- The format of the @file{.da} file is fairly simple. The first 8-byte
- number is the number of counts in the file, followed by the counts
---- gcc/doc/invoke.texi.jj 2002-08-08 17:55:08.000000000 +0200
-+++ gcc/doc/invoke.texi 2002-08-22 11:46:49.000000000 +0200
-@@ -2831,20 +2831,6 @@ analysis program @code{gprof}. You must
- the source files you want data about, and you must also use it when
- linking.
-
--@cindex @code{tcov}
--@item -a
--@opindex a
--Generate extra code to write profile information for basic blocks, which will
--record the number of times each basic block is executed, the basic block start
--address, and the function name containing the basic block. If @option{-g} is
--used, the line number and filename of the start of the basic block will also be
--recorded. If not overridden by the machine description, the default action is
--to append to the text file @file{bb.out}.
--
--This data could be analyzed by a program like @code{tcov}. Note,
--however, that the format of the data is not what @code{tcov} expects.
--Eventually GNU @code{gprof} should be extended to process this data.
--
- @item -Q
- @opindex Q
- Makes the compiler print out each function name as it is compiled, and
-@@ -2877,18 +2863,7 @@ optimization and code generation options
- Control Optimization}).
-
- The other use of @option{-fprofile-arcs} is for use with @code{gcov},
--when it is used with the @option{-ftest-coverage} option. GCC
--supports two methods of determining code coverage: the options that
--support @code{gcov}, and options @option{-a} and @option{-ax}, which
--write information to text files. The options that support @code{gcov}
--do not need to instrument every arc in the program, so a program compiled
--with them runs faster than a program compiled with @option{-a}, which
--adds instrumentation code to every basic block in the program. The
--tradeoff: since @code{gcov} does not have execution counts for all
--branches, it must start with the execution counts for the instrumented
--branches, and then iterate over the program flow graph until the entire
--graph has been solved. Hence, @code{gcov} runs a little more slowly than
--a program which uses information from @option{-a} and @option{-ax}.
-+when it is used with the @option{-ftest-coverage} option.
-
- With @option{-fprofile-arcs}, for each function of your program GCC
- creates a program flow graph, then finds a spanning tree for the graph.
-@@ -2898,11 +2873,6 @@ executed. When an arc is the only exit
- instrumentation code can be added to the block; otherwise, a new basic
- block must be created to hold the instrumentation code.
-
--This option makes it possible to estimate branch probabilities and to
--calculate basic block execution counts. In general, basic block
--execution counts as provided by @option{-a} do not give enough
--information to estimate all branch probabilities.
--
- @need 2000
- @item -ftest-coverage
- @opindex ftest-coverage
+++ /dev/null
-2002-01-25 Jakub Jelinek <jakub@redhat.com>
-
- * g++.dg/other/redecl1.C: New test.
-
---- gcc/testsuite/g++.dg/other/redecl1.C.jj Fri Jan 25 00:19:22 2002
-+++ gcc/testsuite/g++.dg/other/redecl1.C Fri Jan 25 00:23:33 2002
-@@ -0,0 +1,10 @@
-+// PR c++/5857
-+// This testcase failed because during duplicate_decls the type was promoted
-+// to int.
-+
-+// { dg-do compile }
-+
-+typedef char baz;
-+extern const char foo[];
-+const baz foo[] = "xyz";
-+const char bar[] = "abc";
+++ /dev/null
-2002-05-08 Jason Merrill <jason@redhat.com>
-
- * g++.dg/debug/const1.C: New test.
-
---- gcc/testsuite/g++.dg/debug/const1.C.jj Thu Aug 30 22:30:55 2001
-+++ gcc/testsuite/g++.dg/debug/const1.C Wed May 8 17:33:04 2002
-@@ -0,0 +1,11 @@
-+// PR c++/6381
-+// Bug: we were emitting the initializer for bar, which referenced foo,
-+// which was not emitted.
-+
-+// { dg-options "-O" }
-+// { dg-do link }
-+
-+static const int foo[] = { 0 };
-+static const int * const bar[] = { foo };
-+
-+int main() {}
+++ /dev/null
-2002-04-30 Jakub Jelinek <jakub@redhat.com>
-
- * g++.dg/debug/typedef1.C: New test.
-
---- gcc/testsuite/g++.dg/debug/typedef1.C.jj Thu Aug 30 22:30:55 2001
-+++ gcc/testsuite/g++.dg/debug/typedef1.C Tue Apr 30 19:50:12 2002
-@@ -0,0 +1,17 @@
-+// PR debug/6436
-+// { dg-do compile }
-+
-+typedef struct
-+{
-+ unsigned int a0, a1;
-+} A __attribute__ ((aligned(8)));
-+
-+typedef struct
-+{
-+ A a;
-+} B;
-+
-+struct C
-+{
-+ B *bp;
-+};
+++ /dev/null
-2001-10-31 Jakub Jelinek <jakub@redhat.com>
-
- * frame.c (fde_merge): Choose just one from FDEs for the
- same function in erratic array.
-
---- gcc/unwind-dw2-fde.c.jj Fri Jan 11 14:01:21 2002
-+++ gcc/unwind-dw2-fde.c Tue Jan 15 15:58:27 2002
-@@ -535,7 +535,7 @@ fde_merge (struct object *ob, fde_compar
- struct fde_vector *v1, struct fde_vector *v2)
- {
- size_t i1, i2;
-- fde * fde2;
-+ fde * fde2 = NULL;
-
- i2 = v2->count;
- if (i2 > 0)
-@@ -544,6 +544,17 @@ fde_merge (struct object *ob, fde_compar
- do
- {
- i2--;
-+ if (fde2 != NULL && fde_compare (ob, v2->array[i2], fde2) == 0)
-+ {
-+ /* Some linkers (e.g. 2.10.91.0.2 or 2.11.92.0.8) resolve
-+ section relative relocations against removed linkonce
-+ section to corresponding location in the output linkonce
-+ section. Always use the earliest fde in that case. */
-+ fde2 = v2->array[i2];
-+ v1->array[i1+i2+1] = fde2;
-+ v1->array[i1+i2] = fde2;
-+ continue;
-+ }
- fde2 = v2->array[i2];
- while (i1 > 0 && fde_compare (ob, v1->array[i1-1], fde2) > 0)
- {
+++ /dev/null
-2002-06-20 Jakub Jelinek <jakub@redhat.com>
-
- * emit-rtl.c (init_emit_once): Register static_regno_reg_rtx
- with GC.
- * alias.c (init_alias_once): Register static_reg_base_value
- with GC.
-
-2002-06-13 Jeffrey Law <law@redhat.com>
-
- * rs6000.c (rs6000_frame_related): Avoid unwanted sharing
- of hard registers.
-
- * emit-rtl.c (static_regno_reg_rtx): Define.
- (init_emit_once): Initialize static_regno_reg_rtx.
- (init_emit): Copy static_regno_reg_rtx into regno_reg_rtx instead
- of building new hard reg objects once per function.
- (gen_rtx_REG): Try to share hard regs.
- * regclass.c (init_fake_stack_mems): New function broken out from
- init_regs.
- * rtl.h (init_fake_stack_mems): Declare.
- * toplev.c (lang_independent_init): Call init_regs before
- init_emit_once. Call init_fake_stack_mems after init_emit_once.
-
- * alias.c (argument_registers): Remove.
- (init_alias_once): Initialize static_reg_base_value here. Remove
- initialization of argument_registers.
- (init_alias_once_per_function): Remove.
- (init_alias_analysis): Copy all the entries from static_reg_base_value
- into new_reg_base_value all at once.
- * rtl.h (init_alias_once_per_function): Remove declaration.
- * function.c (prepare_function_start): Do not call
- init_alias_once_per_function.
-
- * caller-save.c (init_caller_save): Use gen_rtx_INSN instead of
- starting a sequence and emitting an INSN.
-
-2002-06-11 Jeffrey Law <law@redhat.com>
-
- * caller-save.c (init_caller_save): Move creation of SAVEINSN
- and RESTINSN into into the scope of the sequence.
-
- * loop.c (loop_regs_scan): Avoid useless generation of REG objects.
-
-2002-06-10 Jeffrey Law <law@redhat.com>
-
- * alias.c (static_reg_base_value): New to hold RTL for
- items allocated once per function for the aliasing code.
- (init_alias_once_per_function): Initialize static_reg_base_value.
- (init_alias_analysis): Avoid throw-away allocations of RTL by
- using pre-computed values in static_reg_base_value.
- * function.c (prepare_function_start): Call
- init_alias_once_per_function appropriately.
- * rtl.h (init_alias_once_per_function): Declare.
- * caller-save (init_caller_save): Restructure slightly to
- avoid lots of silly RTL generation.
- * expr.c (init_expr_once): Likewise.
- * reload1.c (reload_cse_regs_1): Allocate throw-away register
- RTL object here. Pass it into children.
- (reload_cse_simplify_operands): Use passed-in register RTL
- object.
- (reload_cse_simplify): Pass through throw-away register
- RTL object.
-
-2002-06-07 Jeff Law <law@redhat.com>
-
- * emit-rtl.c (init_emit): Add hard registers to regno_reg_rtx.
- * combine.c (move_deaths): Use regno_reg_rtx for hard regs rather
- than creating a new register.
- (distribute_notes): Likewise.
- * df.c (df_reg_use_gen): Likewise.
- (df_reg_clobber_gen): Likewise.
- (df_ref_record): Likewise.
- * expr.c (use_regs): Likewise.
- * flow.c (propagate_one_insn): Likewise.
- (mark_set_1): Likewise.
- (mark_used_reg): Likewise.
- * reload.c (emit_reload_insns): Likewise.
-
---- gcc/df.c.jj Tue Apr 2 21:23:50 2002
-+++ gcc/df.c Thu Jun 20 14:12:05 2002
-@@ -633,8 +633,7 @@ static rtx df_reg_use_gen (regno)
- rtx reg;
- rtx use;
-
-- reg = regno >= FIRST_PSEUDO_REGISTER
-- ? regno_reg_rtx[regno] : gen_rtx_REG (reg_raw_mode[regno], regno);
-+ reg = regno_reg_rtx[regno];
-
- use = gen_rtx_USE (GET_MODE (reg), reg);
- return use;
-@@ -648,8 +647,7 @@ static rtx df_reg_clobber_gen (regno)
- rtx reg;
- rtx use;
-
-- reg = regno >= FIRST_PSEUDO_REGISTER
-- ? regno_reg_rtx[regno] : gen_rtx_REG (reg_raw_mode[regno], regno);
-+ reg = regno_reg_rtx[regno];
-
- use = gen_rtx_CLOBBER (GET_MODE (reg), reg);
- return use;
-@@ -905,7 +903,7 @@ df_ref_record (df, reg, loc, insn, ref_t
- endregno = regno + HARD_REGNO_NREGS (regno, GET_MODE (reg));
-
- for (i = regno; i < endregno; i++)
-- df_ref_record_1 (df, gen_rtx_REG (reg_raw_mode[i], i),
-+ df_ref_record_1 (df, regno_reg_rtx[i],
- loc, insn, ref_type, ref_flags);
- }
- else
---- gcc/config/rs6000/rs6000.c.jj Sat May 25 00:01:52 2002
-+++ gcc/config/rs6000/rs6000.c Thu Jun 20 18:23:59 2002
-@@ -8531,6 +8531,14 @@ rs6000_frame_related (insn, reg, val, re
- {
- rtx real, temp;
-
-+ /* copy_rtx will not make unique copies of registers, so we need to
-+ ensure we don't have unwanted sharing here. */
-+ if (reg == reg2)
-+ reg = gen_raw_REG (GET_MODE (reg), REGNO (reg));
-+
-+ if (reg == rreg)
-+ reg = gen_raw_REG (GET_MODE (reg), REGNO (reg));
-+
- real = copy_rtx (PATTERN (insn));
-
- real = replace_rtx (real, reg,
---- gcc/combine.c.jj Tue Jun 4 15:02:15 2002
-+++ gcc/combine.c Thu Jun 20 14:12:38 2002
-@@ -11908,7 +11908,7 @@ move_deaths (x, maybe_kill_insn, from_cu
- if (i < regno || i >= ourend)
- REG_NOTES (where_dead)
- = gen_rtx_EXPR_LIST (REG_DEAD,
-- gen_rtx_REG (reg_raw_mode[i], i),
-+ regno_reg_rtx[i],
- REG_NOTES (where_dead));
- }
-
-@@ -11935,7 +11935,7 @@ move_deaths (x, maybe_kill_insn, from_cu
- offset = 1;
-
- for (i = regno + offset; i < ourend; i++)
-- move_deaths (gen_rtx_REG (reg_raw_mode[i], i),
-+ move_deaths (regno_reg_rtx[i],
- maybe_kill_insn, from_cuid, to_insn, &oldnotes);
- }
-
-@@ -12557,7 +12557,7 @@ distribute_notes (notes, from_insn, i3,
- for (i = regno; i < endregno;
- i += HARD_REGNO_NREGS (i, reg_raw_mode[i]))
- {
-- rtx piece = gen_rtx_REG (reg_raw_mode[i], i);
-+ rtx piece = regno_reg_rtx[i];
- basic_block bb = BASIC_BLOCK (this_basic_block);
-
- if (! dead_or_set_p (place, piece)
---- gcc/emit-rtl.c.jj Thu May 23 10:28:12 2002
-+++ gcc/emit-rtl.c Thu Jun 20 18:38:08 2002
-@@ -92,6 +92,12 @@ static int no_line_numbers;
-
- rtx global_rtl[GR_MAX];
-
-+/* Commonly used RTL for hard registers. These objects are not necessarily
-+ unique, so we allocate them separately from global_rtl. They are
-+ initialized once per compilation unit, then copied into regno_reg_rtx
-+ at the beginning of each function. */
-+static rtx static_regno_reg_rtx[FIRST_PSEUDO_REGISTER];
-+
- /* We record floating-point CONST_DOUBLEs in each floating-point mode for
- the values of 0, 1, and 2. For the integer entries and VOIDmode, we
- record a copy of const[012]_rtx. */
-@@ -427,6 +433,15 @@ gen_rtx_REG (mode, regno)
- return stack_pointer_rtx;
- }
-
-+ /* If the per-function register table has been set up, try to re-use
-+ an existing entry in that table to avoid useless generation of RTL. */
-+ if (0 && cfun
-+ && cfun->emit
-+ && regno_reg_rtx
-+ && regno >= 0 && regno < FIRST_PSEUDO_REGISTER
-+ && reg_raw_mode[regno] == mode)
-+ return regno_reg_rtx[regno];
-+
- return gen_raw_REG (mode, regno);
- }
-
-@@ -4841,6 +4856,11 @@ init_emit ()
- f->emit->regno_decl
- = (tree *) xcalloc (f->emit->regno_pointer_align_length, sizeof (tree));
-
-+ /* Put copies of all the hard registers into regno_reg_rtx. */
-+ memcpy (regno_reg_rtx,
-+ static_regno_reg_rtx,
-+ FIRST_PSEUDO_REGISTER * sizeof (rtx));
-+
- /* Put copies of all the virtual register rtx into regno_reg_rtx. */
- init_virtual_regs (f->emit);
-
-@@ -5015,8 +5035,14 @@ init_emit_once (line_numbers)
- gen_raw_REG (Pmode, VIRTUAL_OUTGOING_ARGS_REGNUM);
- virtual_cfa_rtx = gen_raw_REG (Pmode, VIRTUAL_CFA_REGNUM);
-
-+ /* Initialize RTL for commonly used hard registers. These are
-+ copied into regno_reg_rtx as we begin to compile each function. */
-+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-+ static_regno_reg_rtx[i] = gen_raw_REG (reg_raw_mode[i], i);
-+
- /* These rtx must be roots if GC is enabled. */
- ggc_add_rtx_root (global_rtl, GR_MAX);
-+ ggc_add_rtx_root (static_regno_reg_rtx, (int) FIRST_PSEUDO_REGISTER);
-
- #ifdef INIT_EXPANDERS
- /* This is to initialize {init|mark|free}_machine_status before the first
---- gcc/expr.c.jj Tue May 7 12:45:49 2002
-+++ gcc/expr.c Thu Jun 20 17:04:00 2002
-@@ -208,6 +208,7 @@ init_expr_once ()
- enum machine_mode mode;
- int num_clobbers;
- rtx mem, mem1;
-+ rtx reg;
-
- start_sequence ();
-
-@@ -217,6 +218,10 @@ init_expr_once ()
- mem = gen_rtx_MEM (VOIDmode, stack_pointer_rtx);
- mem1 = gen_rtx_MEM (VOIDmode, frame_pointer_rtx);
-
-+ /* A scratch register we can modify in-place below to avoid
-+ useless RTL allocations. */
-+ reg = gen_raw_REG (VOIDmode, -1);
-+
- insn = emit_insn (gen_rtx_SET (0, NULL_RTX, NULL_RTX));
- pat = PATTERN (insn);
-
-@@ -224,11 +229,11 @@ init_expr_once ()
- mode = (enum machine_mode) ((int) mode + 1))
- {
- int regno;
-- rtx reg;
-
- direct_load[(int) mode] = direct_store[(int) mode] = 0;
- PUT_MODE (mem, mode);
- PUT_MODE (mem1, mode);
-+ PUT_MODE (reg, mode);
-
- /* See if there is some register that can be used in this mode and
- directly loaded or stored from memory. */
-@@ -241,7 +246,7 @@ init_expr_once ()
- if (! HARD_REGNO_MODE_OK (regno, mode))
- continue;
-
-- reg = gen_rtx_REG (mode, regno);
-+ REGNO (reg) = regno;
-
- SET_SRC (pat) = mem;
- SET_DEST (pat) = reg;
-@@ -2280,7 +2285,7 @@ use_regs (call_fusage, regno, nregs)
- abort ();
-
- for (i = 0; i < nregs; i++)
-- use_reg (call_fusage, gen_rtx_REG (reg_raw_mode[regno + i], regno + i));
-+ use_reg (call_fusage, regno_reg_rtx[regno + i]);
- }
-
- /* Add USE expressions to *CALL_FUSAGE for each REG contained in the
---- gcc/flow.c.jj Tue Apr 23 20:26:35 2002
-+++ gcc/flow.c Thu Jun 20 14:12:05 2002
-@@ -1721,8 +1721,7 @@ propagate_one_insn (pbi, insn)
- if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i))
- {
- /* We do not want REG_UNUSED notes for these registers. */
-- mark_set_1 (pbi, CLOBBER, gen_rtx_REG (reg_raw_mode[i], i),
-- cond, insn,
-+ mark_set_1 (pbi, CLOBBER, regno_reg_rtx[i], cond, insn,
- pbi->flags & ~(PROP_DEATH_NOTES | PROP_REG_INFO));
- }
- }
-@@ -1770,8 +1769,7 @@ propagate_one_insn (pbi, insn)
- so they are made live. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (global_regs[i])
-- mark_used_reg (pbi, gen_rtx_REG (reg_raw_mode[i], i),
-- cond, insn);
-+ mark_used_reg (pbi, regno_reg_rtx[i], cond, insn);
- }
- }
-
-@@ -2769,7 +2767,7 @@ mark_set_1 (pbi, code, reg, cond, insn,
- if (! REGNO_REG_SET_P (pbi->reg_live, i))
- REG_NOTES (insn)
- = alloc_EXPR_LIST (REG_UNUSED,
-- gen_rtx_REG (reg_raw_mode[i], i),
-+ regno_reg_rtx[i],
- REG_NOTES (insn));
- }
- }
-@@ -3577,7 +3575,7 @@ mark_used_reg (pbi, reg, cond, insn)
- && ! dead_or_set_regno_p (insn, i))
- REG_NOTES (insn)
- = alloc_EXPR_LIST (REG_DEAD,
-- gen_rtx_REG (reg_raw_mode[i], i),
-+ regno_reg_rtx[i],
- REG_NOTES (insn));
- }
- }
---- gcc/reload1.c.jj Wed May 22 14:17:55 2002
-+++ gcc/reload1.c Thu Jun 20 17:05:46 2002
-@@ -444,7 +444,7 @@ static int constraint_accepts_reg_p PARA
- static void reload_cse_regs_1 PARAMS ((rtx));
- static int reload_cse_noop_set_p PARAMS ((rtx));
- static int reload_cse_simplify_set PARAMS ((rtx, rtx));
--static int reload_cse_simplify_operands PARAMS ((rtx));
-+static int reload_cse_simplify_operands PARAMS ((rtx, rtx));
- static void reload_combine PARAMS ((void));
- static void reload_combine_note_use PARAMS ((rtx *, rtx));
- static void reload_combine_note_store PARAMS ((rtx, rtx, void *));
-@@ -459,7 +459,7 @@ static HOST_WIDE_INT sext_for_mode PARAM
- static void failed_reload PARAMS ((rtx, int));
- static int set_reload_reg PARAMS ((int, int));
- static void reload_cse_delete_noop_set PARAMS ((rtx, rtx));
--static void reload_cse_simplify PARAMS ((rtx));
-+static void reload_cse_simplify PARAMS ((rtx, rtx));
- void fixup_abnormal_edges PARAMS ((void));
- extern void dump_needs PARAMS ((struct insn_chain *));
- \f
-@@ -7161,8 +7161,7 @@ emit_reload_insns (chain)
- for (k = 1; k < nnr; k++)
- reg_last_reload_reg[nregno + k]
- = (nr == nnr
-- ? gen_rtx_REG (reg_raw_mode[REGNO (rld[r].reg_rtx) + k],
-- REGNO (rld[r].reg_rtx) + k)
-+ ? regno_reg_rtx[REGNO (rld[r].reg_rtx) + k]
- : 0);
-
- /* Now do the inverse operation. */
-@@ -7211,8 +7210,7 @@ emit_reload_insns (chain)
- for (k = 1; k < nnr; k++)
- reg_last_reload_reg[nregno + k]
- = (nr == nnr
-- ? gen_rtx_REG (reg_raw_mode[REGNO (rld[r].reg_rtx) + k],
-- REGNO (rld[r].reg_rtx) + k)
-+ ? regno_reg_rtx[REGNO (rld[r].reg_rtx) + k]
- : 0);
-
- /* Unless we inherited this reload, show we haven't
-@@ -8061,8 +8059,9 @@ reload_cse_noop_set_p (set)
-
- /* Try to simplify INSN. */
- static void
--reload_cse_simplify (insn)
-+reload_cse_simplify (insn, testreg)
- rtx insn;
-+ rtx testreg;
- {
- rtx body = PATTERN (insn);
-
-@@ -8089,7 +8088,7 @@ reload_cse_simplify (insn)
- if (count > 0)
- apply_change_group ();
- else
-- reload_cse_simplify_operands (insn);
-+ reload_cse_simplify_operands (insn, testreg);
- }
- else if (GET_CODE (body) == PARALLEL)
- {
-@@ -8132,7 +8131,7 @@ reload_cse_simplify (insn)
- if (count > 0)
- apply_change_group ();
- else
-- reload_cse_simplify_operands (insn);
-+ reload_cse_simplify_operands (insn, testreg);
- }
- }
-
-@@ -8158,6 +8157,7 @@ reload_cse_regs_1 (first)
- rtx first;
- {
- rtx insn;
-+ rtx testreg = gen_raw_REG (VOIDmode, -1);
-
- cselib_init ();
- init_alias_analysis ();
-@@ -8165,7 +8165,7 @@ reload_cse_regs_1 (first)
- for (insn = first; insn; insn = NEXT_INSN (insn))
- {
- if (INSN_P (insn))
-- reload_cse_simplify (insn);
-+ reload_cse_simplify (insn, testreg);
-
- cselib_process_insn (insn);
- }
-@@ -8336,8 +8336,9 @@ reload_cse_simplify_set (set, insn)
- hard registers. */
-
- static int
--reload_cse_simplify_operands (insn)
-+reload_cse_simplify_operands (insn, testreg)
- rtx insn;
-+ rtx testreg;
- {
- int i, j;
-
-@@ -8357,7 +8358,6 @@ reload_cse_simplify_operands (insn)
- int *op_alt_regno[MAX_RECOG_OPERANDS];
- /* Array of alternatives, sorted in order of decreasing desirability. */
- int *alternative_order;
-- rtx reg = gen_rtx_REG (VOIDmode, -1);
-
- extract_insn (insn);
-
-@@ -8441,8 +8441,8 @@ reload_cse_simplify_operands (insn)
- if (! TEST_HARD_REG_BIT (equiv_regs[i], regno))
- continue;
-
-- REGNO (reg) = regno;
-- PUT_MODE (reg, mode);
-+ REGNO (testreg) = regno;
-+ PUT_MODE (testreg, mode);
-
- /* We found a register equal to this operand. Now look for all
- alternatives that can accept this register and have not been
-@@ -8484,10 +8484,10 @@ reload_cse_simplify_operands (insn)
- alternative yet and the operand being replaced is not
- a cheap CONST_INT. */
- if (op_alt_regno[i][j] == -1
-- && reg_fits_class_p (reg, class, 0, mode)
-+ && reg_fits_class_p (testreg, class, 0, mode)
- && (GET_CODE (recog_data.operand[i]) != CONST_INT
- || (rtx_cost (recog_data.operand[i], SET)
-- > rtx_cost (reg, SET))))
-+ > rtx_cost (testreg, SET))))
- {
- alternative_nregs[j]++;
- op_alt_regno[i][j] = regno;
---- gcc/alias.c.jj Thu Jun 20 12:43:03 2002
-+++ gcc/alias.c Thu Jun 20 18:36:24 2002
-@@ -149,6 +149,10 @@ static rtx *reg_base_value;
- static rtx *new_reg_base_value;
- static unsigned int reg_base_value_size; /* size of reg_base_value array */
-
-+/* Static hunks of RTL used by the aliasing code; these are initialized
-+ once per function to avoid unnecessary RTL allocations. */
-+static rtx static_reg_base_value[FIRST_PSEUDO_REGISTER];
-+
- #define REG_BASE_VALUE(X) \
- (REGNO (X) < reg_base_value_size \
- ? reg_base_value[REGNO (X)] : 0)
-@@ -2429,8 +2433,6 @@ mark_constant_function ()
- }
-
-
--static HARD_REG_SET argument_registers;
--
- void
- init_alias_once ()
- {
-@@ -2439,13 +2441,26 @@ init_alias_once ()
- #ifndef OUTGOING_REGNO
- #define OUTGOING_REGNO(N) N
- #endif
-+ ggc_add_rtx_root (static_reg_base_value, (int) FIRST_PSEUDO_REGISTER);
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- /* Check whether this register can hold an incoming pointer
- argument. FUNCTION_ARG_REGNO_P tests outgoing register
- numbers, so translate if necessary due to register windows. */
- if (FUNCTION_ARG_REGNO_P (OUTGOING_REGNO (i))
- && HARD_REGNO_MODE_OK (i, Pmode))
-- SET_HARD_REG_BIT (argument_registers, i);
-+ static_reg_base_value[i]
-+ = gen_rtx_ADDRESS (VOIDmode, gen_rtx_REG (Pmode, i));
-+
-+ static_reg_base_value[STACK_POINTER_REGNUM]
-+ = gen_rtx_ADDRESS (Pmode, stack_pointer_rtx);
-+ static_reg_base_value[ARG_POINTER_REGNUM]
-+ = gen_rtx_ADDRESS (Pmode, arg_pointer_rtx);
-+ static_reg_base_value[FRAME_POINTER_REGNUM]
-+ = gen_rtx_ADDRESS (Pmode, frame_pointer_rtx);
-+#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
-+ static_reg_base_value[HARD_FRAME_POINTER_REGNUM]
-+ = gen_rtx_ADDRESS (Pmode, hard_frame_pointer_rtx);
-+#endif
-
- alias_sets = splay_tree_new (splay_tree_compare_ints, 0, 0);
- }
-@@ -2535,21 +2550,8 @@ init_alias_analysis ()
- The address expression is VOIDmode for an argument and
- Pmode for other registers. */
-
-- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-- if (TEST_HARD_REG_BIT (argument_registers, i))
-- new_reg_base_value[i] = gen_rtx_ADDRESS (VOIDmode,
-- gen_rtx_REG (Pmode, i));
--
-- new_reg_base_value[STACK_POINTER_REGNUM]
-- = gen_rtx_ADDRESS (Pmode, stack_pointer_rtx);
-- new_reg_base_value[ARG_POINTER_REGNUM]
-- = gen_rtx_ADDRESS (Pmode, arg_pointer_rtx);
-- new_reg_base_value[FRAME_POINTER_REGNUM]
-- = gen_rtx_ADDRESS (Pmode, frame_pointer_rtx);
--#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
-- new_reg_base_value[HARD_FRAME_POINTER_REGNUM]
-- = gen_rtx_ADDRESS (Pmode, hard_frame_pointer_rtx);
--#endif
-+ memcpy (new_reg_base_value, static_reg_base_value,
-+ FIRST_PSEUDO_REGISTER * sizeof (rtx));
-
- /* Walk the insns adding values to the new_reg_base_value array. */
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
---- gcc/caller-save.c.jj Wed Jan 2 12:47:35 2002
-+++ gcc/caller-save.c Thu Jun 20 17:49:47 2002
-@@ -115,6 +115,9 @@ init_caller_save ()
- rtx address;
- int i, j;
- enum machine_mode mode;
-+ rtx savepat, restpat;
-+ rtx test_reg, test_mem;
-+ rtx saveinsn, restinsn;
-
- /* First find all the registers that we need to deal with and all
- the modes that they can have. If we can't find a mode to use,
-@@ -179,22 +182,30 @@ init_caller_save ()
- address = addr_reg;
-
- /* Next we try to form an insn to save and restore the register. We
-- see if such an insn is recognized and meets its constraints. */
-+ see if such an insn is recognized and meets its constraints.
-
-- start_sequence ();
-+ To avoid lots of unnecessary RTL allocation, we construct all the RTL
-+ once, then modify the memory and register operands in-place. */
-+
-+ test_reg = gen_rtx_REG (VOIDmode, 0);
-+ test_mem = gen_rtx_MEM (VOIDmode, address);
-+ savepat = gen_rtx_SET (VOIDmode, test_mem, test_reg);
-+ restpat = gen_rtx_SET (VOIDmode, test_reg, test_mem);
-+ saveinsn = gen_rtx_INSN (VOIDmode, 0, 0, 0, savepat, -1, 0, 0);
-+ restinsn = gen_rtx_INSN (VOIDmode, 0, 0, 0, restpat, -1, 0, 0);
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- for (mode = 0 ; mode < MAX_MACHINE_MODE; mode++)
- if (HARD_REGNO_MODE_OK (i, mode))
- {
-- rtx mem = gen_rtx_MEM (mode, address);
-- rtx reg = gen_rtx_REG (mode, i);
-- rtx savepat = gen_rtx_SET (VOIDmode, mem, reg);
-- rtx restpat = gen_rtx_SET (VOIDmode, reg, mem);
-- rtx saveinsn = emit_insn (savepat);
-- rtx restinsn = emit_insn (restpat);
- int ok;
-
-+ /* Update the register number and modes of the register
-+ and memory operand. */
-+ REGNO (test_reg) = i;
-+ PUT_MODE (test_reg, mode);
-+ PUT_MODE (test_mem, mode);
-+
- reg_save_code[i][mode] = recog_memoized (saveinsn);
- reg_restore_code[i][mode] = recog_memoized (restinsn);
-
-@@ -232,8 +243,6 @@ init_caller_save ()
- SET_HARD_REG_BIT (call_fixed_reg_set, i);
- }
- }
--
-- end_sequence ();
- }
- \f
- /* Initialize save areas by showing that we haven't allocated any yet. */
---- gcc/rtl.h.jj Tue May 21 20:19:51 2002
-+++ gcc/rtl.h Thu Jun 20 18:01:01 2002
-@@ -1964,6 +1964,7 @@ extern int reg_classes_intersect_p PARAM
- extern int reg_class_subset_p PARAMS ((enum reg_class, enum reg_class));
- extern void globalize_reg PARAMS ((int));
- extern void init_regs PARAMS ((void));
-+extern void init_fake_stack_mems PARAMS ((void));
- extern void init_reg_sets PARAMS ((void));
- extern void regset_release_memory PARAMS ((void));
- extern void regclass_init PARAMS ((void));
---- gcc/regclass.c.jj Wed Jun 19 15:11:11 2002
-+++ gcc/regclass.c Thu Jun 20 18:01:01 2002
-@@ -605,11 +605,16 @@ init_regs ()
- init_reg_sets_1 ();
-
- init_reg_modes ();
-+}
-
-+/* Initialize some fake stack-frame MEM references for use in
-+ memory_move_secondary_cost. */
-+
-+void
-+init_fake_stack_mems ()
-+{
- #ifdef HAVE_SECONDARY_RELOADS
- {
-- /* Make some fake stack-frame MEM references for use in
-- memory_move_secondary_cost. */
- int i;
-
- for (i = 0; i < MAX_MACHINE_MODE; i++)
---- gcc/toplev.c.jj Thu May 30 11:08:44 2002
-+++ gcc/toplev.c Thu Jun 20 18:01:01 2002
-@@ -5058,6 +5058,9 @@ lang_independent_init ()
- init_stringpool ();
- init_obstacks ();
-
-+ /* init_emit_once uses reg_raw_mode and therefore must be called
-+ after init_regs which initialized reg_raw_mode. */
-+ init_regs ();
- init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
- || debug_info_level == DINFO_LEVEL_VERBOSE
- #ifdef VMS_DEBUGGING_INFO
-@@ -5066,7 +5069,7 @@ lang_independent_init ()
- #endif
- || flag_test_coverage
- || warn_notreached);
-- init_regs ();
-+ init_fake_stack_mems ();
- init_alias_once ();
- init_stmt ();
- init_loop ();
---- gcc/loop.c.jj Wed Jun 19 15:10:51 2002
-+++ gcc/loop.c Thu Jun 20 18:22:01 2002
-@@ -9541,7 +9541,7 @@ loop_regs_scan (loop, extra_size)
- if (LOOP_INFO (loop)->has_call)
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i)
-- && rtx_varies_p (gen_rtx_REG (Pmode, i), /*for_alias=*/1))
-+ && rtx_varies_p (regno_reg_rtx[i], 1))
- {
- regs->array[i].may_not_optimize = 1;
- regs->array[i].set_in_loop = 1;
+++ /dev/null
-2002-06-11 Richard Henderson <rth@redhat.com>
-
- * caller-save.c (init_caller_save): Clear INSN_CODE each iteration.
-
---- gcc/caller-save.c.jj Fri Jun 21 01:16:13 2002
-+++ gcc/caller-save.c Thu Jul 11 10:27:57 2002
-@@ -206,6 +206,10 @@ init_caller_save ()
- PUT_MODE (test_reg, mode);
- PUT_MODE (test_mem, mode);
-
-+ /* Force re-recognition of the modified insns. */
-+ INSN_CODE (saveinsn) = -1;
-+ INSN_CODE (restinsn) = -1;
-+
- reg_save_code[i][mode] = recog_memoized (saveinsn);
- reg_restore_code[i][mode] = recog_memoized (restinsn);
-
+++ /dev/null
-2002-05-29 Richard Henderson <rth@redhat.com>
-
- * config/i386/biarch64.h (TARGET_64BIT_DEFAULT): Define with value.
- (TARGET_BI_ARCH): Likewise.
- * config/i386/i386.h: Test TARGET_64BIT_DEFAULT by value.
- (TARGET_SWITCHES): Combine target defaults here not in TARGET_DEFAULT.
- (TARGET_64BIT_DEFAULT): Default to 0.
- (TARGET_DEFAULT): Default to MASK_OMIT_LEAF_FRAME_POINTER.
-
---- gcc/config/i386/biarch64.h.jj Tue Oct 2 12:59:38 2001
-+++ gcc/config/i386/biarch64.h Tue Jun 4 15:11:52 2002
-@@ -21,5 +21,5 @@ along with GNU CC; see the file COPYING.
- the Free Software Foundation, 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
--#define TARGET_64BIT_DEFAULT
--#define TARGET_BI_ARCH
-+#define TARGET_64BIT_DEFAULT MASK_64BIT
-+#define TARGET_BI_ARCH 1
---- gcc/config/i386/i386.h.jj Thu Apr 18 19:02:03 2002
-+++ gcc/config/i386/i386.h Tue Jun 4 15:13:40 2002
-@@ -192,7 +192,7 @@ extern int target_flags;
- #ifdef TARGET_BI_ARCH
- #define TARGET_64BIT (target_flags & MASK_64BIT)
- #else
--#ifdef TARGET_64BIT_DEFAULT
-+#if TARGET_64BIT_DEFAULT
- #define TARGET_64BIT 1
- #else
- #define TARGET_64BIT 0
-@@ -381,14 +381,14 @@ extern int x86_prefetch_sse;
- { "no-red-zone", MASK_NO_RED_ZONE, \
- N_("Do not use red-zone in the x86-64 code") }, \
- SUBTARGET_SWITCHES \
-- { "", TARGET_DEFAULT, 0 }}
-+ { "", TARGET_DEFAULT | TARGET_64BIT_DEFAULT | TARGET_SUBTARGET_DEFAULT, 0 }}
-
--#ifdef TARGET_64BIT_DEFAULT
--#define TARGET_DEFAULT (MASK_64BIT | TARGET_SUBTARGET_DEFAULT)
--#else
--#define TARGET_DEFAULT TARGET_SUBTARGET_DEFAULT
-+#ifndef TARGET_64BIT_DEFAULT
-+#define TARGET_64BIT_DEFAULT 0
- #endif
-
-+#define TARGET_DEFAULT MASK_OMIT_LEAF_FRAME_POINTER
-+
- /* Which processor to schedule for. The cpu attribute defines a list that
- mirrors this list, so changes to i386.md must be made at the same time. */
-
-@@ -624,13 +624,13 @@ extern int ix86_arch;
-
- #ifndef CPP_CPU_SPEC
- #ifdef TARGET_BI_ARCH
--#ifdef TARGET_64BIT_DEFAULT
-+#if TARGET_64BIT_DEFAULT
- #define CPP_CPU_SPEC "%{m32:%(cpp_cpu32)}%{!m32:%(cpp_cpu64)} %(cpp_cpucommon)"
- #else
- #define CPP_CPU_SPEC "%{m64:%(cpp_cpu64)}%{!m64:%(cpp_cpu32)} %(cpp_cpucommon)"
- #endif
- #else
--#ifdef TARGET_64BIT_DEFAULT
-+#if TARGET_64BIT_DEFAULT
- #define CPP_CPU_SPEC "%(cpp_cpu64) %(cpp_cpucommon)"
- #else
- #define CPP_CPU_SPEC "%(cpp_cpu32) %(cpp_cpucommon)"
-@@ -695,7 +695,7 @@ extern int ix86_arch;
- #define DOUBLE_TYPE_SIZE 64
- #define LONG_LONG_TYPE_SIZE 64
-
--#if defined (TARGET_BI_ARCH) || defined (TARGET_64BIT_DEFAULT)
-+#if defined (TARGET_BI_ARCH) || TARGET_64BIT_DEFAULT
- #define MAX_BITS_PER_WORD 64
- #define MAX_LONG_TYPE_SIZE 64
- #else
+++ /dev/null
-2002-05-20 Jakub Jelinek <jakub@redhat.com>
-
- * gcc.dg/20020525-1.c: New test.
-
---- gcc/testsuite/gcc.dg/20020525-1.c.jj Thu Aug 30 22:30:55 2001
-+++ gcc/testsuite/gcc.dg/20020525-1.c Sat May 25 10:45:13 2002
-@@ -0,0 +1,24 @@
-+/* PR optimization/6703
-+ Origin: Glen Nakamura <glen@imodulo.com> */
-+/* { dg-do run } */
-+/* { dg-options "-O2" } */
-+
-+extern void abort (void);
-+extern void exit (int);
-+
-+void foo (int *x, int y)
-+{
-+ __builtin_memset (x, 0, y);
-+}
-+
-+int main ()
-+{
-+ int x[2] = { 0x5a5a5a5a, 0x5a5a5a5a };
-+
-+ if (x[1] != 0x5a5a5a5a)
-+ abort ();
-+ foo (x, sizeof (int) + 1);
-+ if (x[1] == 0x5a5a5a5a)
-+ abort ();
-+ exit (0);
-+}
+++ /dev/null
-Argh, GDB is not ready.
-
---- gcc/config/i386/i386.h.jj 2002-08-28 11:20:27.000000000 +0200
-+++ gcc/config/i386/i386.h 2002-08-28 22:01:26.000000000 +0200
-@@ -390,7 +390,7 @@ extern int x86_prefetch_sse;
- #define TARGET_64BIT_DEFAULT 0
- #endif
-
--#define TARGET_DEFAULT MASK_OMIT_LEAF_FRAME_POINTER
-+#define TARGET_DEFAULT 0
-
- /* Which processor to schedule for. The cpu attribute defines a list that
- mirrors this list, so changes to i386.md must be made at the same time. */
+++ /dev/null
-2002-06-04 Richard Henderson <rth@redhat.com>
- Jakub Jelinek <jakub@redhat.com>
-
- * config/i386/i386.c (USE_HIDDEN_LINKONCE): New.
- (ix86_asm_file_end): If USE_HIDDEN_LINKONCE, emit get_pc thunks
- into linkonce sections.
- (load_pic_register): Set up pic_label_name for it.
-
---- gcc/config/i386/i386.c.jj Mon Jun 3 17:24:13 2002
-+++ gcc/config/i386/i386.c Tue Jun 4 15:49:17 2002
-@@ -3786,6 +3786,12 @@ ix86_setup_frame_addresses ()
- cfun->machine->accesses_prev_frame = 1;
- }
- \f
-+#if defined(HAVE_GAS_HIDDEN) && defined(SUPPORTS_ONE_ONLY)
-+# define USE_HIDDEN_LINKONCE 1
-+#else
-+# define USE_HIDDEN_LINKONCE 0
-+#endif
-+
- static char pic_label_name[32];
-
- /* This function generates code for -fpic that loads %ebx with
-@@ -3800,10 +3806,6 @@ ix86_asm_file_end (file)
- if (! TARGET_DEEP_BRANCH_PREDICTION || pic_label_name[0] == 0)
- return;
-
-- /* ??? Binutils 2.10 and earlier has a linkonce elimination bug related
-- to updating relocations to a section being discarded such that this
-- doesn't work. Ought to detect this at configure time. */
--#if 0
- /* The trick here is to create a linkonce section containing the
- pic label thunk, but to refer to it with an internal label.
- Because the label is internal, we don't have inter-dso name
-@@ -3811,28 +3813,27 @@ ix86_asm_file_end (file)
-
- In order to use these macros, however, we must create a fake
- function decl. */
-- if (targetm.have_named_sections)
-+ if (USE_HIDDEN_LINKONCE && targetm.have_named_sections)
- {
- tree decl = build_decl (FUNCTION_DECL,
-- get_identifier ("i686.get_pc_thunk"),
-+ get_identifier (pic_label_name),
- error_mark_node);
-+ TREE_PUBLIC (decl) = 1;
-+ TREE_STATIC (decl) = 1;
- DECL_ONE_ONLY (decl) = 1;
- UNIQUE_SECTION (decl, 0);
-- named_section (decl, NULL);
-+ named_section (decl, NULL, 0);
-+ ASM_GLOBALIZE_LABEL (file, pic_label_name);
-+ fputs ("\t.hidden\t", file);
-+ assemble_name (file, pic_label_name);
-+ fputc ('\n', file);
-+ ASM_DECLARE_FUNCTION_NAME (file, pic_label_name, decl);
- }
- else
--#else
-- text_section ();
--#endif
--
-- /* This used to call ASM_DECLARE_FUNCTION_NAME() but since it's an
-- internal (non-global) label that's being emitted, it didn't make
-- sense to have .type information for local labels. This caused
-- the SCO OpenServer 5.0.4 ELF assembler grief (why are you giving
-- me debug info for a label that you're declaring non-global?) this
-- was changed to call ASM_OUTPUT_LABEL() instead. */
--
-- ASM_OUTPUT_LABEL (file, pic_label_name);
-+ {
-+ text_section ();
-+ ASM_OUTPUT_LABEL (file, pic_label_name);
-+ }
-
- xops[0] = pic_offset_table_rtx;
- xops[1] = gen_rtx_MEM (SImode, stack_pointer_rtx);
-@@ -3853,7 +3854,12 @@ load_pic_register ()
- if (TARGET_DEEP_BRANCH_PREDICTION)
- {
- if (! pic_label_name[0])
-- ASM_GENERATE_INTERNAL_LABEL (pic_label_name, "LPR", 0);
-+ {
-+ if (USE_HIDDEN_LINKONCE && targetm.have_named_sections)
-+ strcpy (pic_label_name, "__i686.get_pc_thunk.bx");
-+ else
-+ ASM_GENERATE_INTERNAL_LABEL (pic_label_name, "LPR", 0);
-+ }
- pclab = gen_rtx_MEM (QImode, gen_rtx_SYMBOL_REF (Pmode, pic_label_name));
- }
- else
+++ /dev/null
-2002-05-30 Richard Henderson <rth@redhat.com>
-
- * defaults.h (TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER): Kill.
- * toplev.c (process_options): Don't check it.
- * doc/tm.texi: Don't document it.
- * config/i386/linux.h (SUBTARGET_FRAME_POINTER_REQUIRED): New.
- (TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER): Kill.
- * config/i386/i386.c (ix86_frame_pointer_required): Suppress leaf
- frame pointer optimization if current_function_profile.
-
---- gcc/doc/tm.texi.jj Fri May 3 19:25:59 2002
-+++ gcc/doc/tm.texi Tue Jun 4 23:18:43 2002
-@@ -4077,22 +4077,6 @@ must not use the @var{labelno} argument
- @item PROFILE_BEFORE_PROLOGUE
- Define this macro if the code for function profiling should come before
- the function prologue. Normally, the profiling code comes after.
--
--
--@findex TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER
--@item TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER
--On some targets, it is impossible to use profiling when the frame
--pointer has been omitted. For example, on x86 GNU/Linux systems,
--the @code{mcount} routine provided by the GNU C Library finds the
--address of the routine that called the routine that called @code{mcount}
--by looking in the immediate caller's stack frame. If the immediate
--caller has no frame pointer, this lookup will fail.
--
--By default, GCC assumes that the target does allow profiling when the
--frame pointer is omitted. This macro should be defined to a C
--expression that evaluates to @code{false} if the target does not allow
--profiling when the frame pointer is omitted.
--
- @end table
-
- @node Tail Calls
---- gcc/config/i386/i386.c.jj Tue Jun 4 21:13:34 2002
-+++ gcc/config/i386/i386.c Tue Jun 4 23:18:43 2002
-@@ -3827,7 +3827,8 @@ ix86_frame_pointer_required ()
- /* In override_options, TARGET_OMIT_LEAF_FRAME_POINTER turns off
- the frame pointer by default. Turn it back on now if we've not
- got a leaf function. */
-- if (TARGET_OMIT_LEAF_FRAME_POINTER && ! leaf_function_p ())
-+ if (TARGET_OMIT_LEAF_FRAME_POINTER
-+ && (!current_function_is_leaf || current_function_profile))
- return 1;
-
- return 0;
---- gcc/config/i386/linux.h.jj Tue Apr 16 08:15:02 2002
-+++ gcc/config/i386/linux.h Tue Jun 4 23:18:43 2002
-@@ -63,14 +63,11 @@ Boston, MA 02111-1307, USA. */
- fprintf (FILE, "\tcall\tmcount\n"); \
- }
-
--/* True if it is possible to profile code that does not have a frame
-- pointer.
--
-- The GLIBC version of mcount for the x86 assumes that there is a
-+/* The GLIBC version of mcount for the x86 assumes that there is a
- frame, so we cannot allow profiling without a frame pointer. */
-
--#undef TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER
--#define TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER false
-+#undef SUBTARGET_FRAME_POINTER_REQUIRED
-+#define SUBTARGET_FRAME_POINTER_REQUIRED current_function_profile
-
- #undef SIZE_TYPE
- #define SIZE_TYPE "unsigned int"
---- gcc/defaults.h.jj Fri May 3 19:24:51 2002
-+++ gcc/defaults.h Tue Jun 4 23:18:43 2002
-@@ -398,13 +398,6 @@ do { \
- ? ptrmemfunc_vbit_in_pfn : ptrmemfunc_vbit_in_delta)
- #endif
-
--/* True if it is possible to profile code that does not have a frame
-- pointer. */
--
--#ifndef TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER
--#define TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER true
--#endif
--
- #ifndef DEFAULT_GDB_EXTENSIONS
- #define DEFAULT_GDB_EXTENSIONS 1
- #endif
---- gcc/toplev.c.jj Thu May 30 11:08:44 2002
-+++ gcc/toplev.c Tue Jun 4 23:19:11 2002
-@@ -4908,16 +4908,6 @@ process_options ()
- warning ("this target machine does not have delayed branches");
- #endif
-
-- /* Some operating systems do not allow profiling without a frame
-- pointer. */
-- if (!TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER
-- && profile_flag
-- && flag_omit_frame_pointer)
-- {
-- error ("profiling does not work without a frame pointer");
-- flag_omit_frame_pointer = 0;
-- }
--
- user_label_prefix = USER_LABEL_PREFIX;
- if (flag_leading_underscore != -1)
- {
+++ /dev/null
-2002-08-07 Jakub Jelinek <jakub@redhat.com>
-
- * tree-inline.c (remap_decl): Make sure DECL_TOO_LATE is clear for
- remapped labels.
-
- * gcc.c-torture/compile/20020807-1.c: New test.
-
---- gcc/tree-inline.c.jj 2002-04-17 15:35:57.000000000 +0200
-+++ gcc/tree-inline.c 2002-08-07 14:53:14.000000000 +0200
-@@ -145,6 +145,9 @@ remap_decl (decl, id)
- t = copy_decl_for_inlining (decl, fn,
- VARRAY_TREE (id->fns, 0));
-
-+ if (TREE_CODE (t) == LABEL_DECL)
-+ DECL_TOO_LATE (t) = 0;
-+
- /* The decl T could be a dynamic array or other variable size type,
- in which case some fields need to be remapped because they may
- contain SAVE_EXPRs. */
---- gcc/testsuite/gcc.c-torture/compile/20020807-1.c.jj 2002-08-07 14:55:26.000000000 +0200
-+++ gcc/testsuite/gcc.c-torture/compile/20020807-1.c 2002-08-07 14:22:07.000000000 +0200
-@@ -0,0 +1,33 @@
-+int x;
-+
-+static int
-+__attribute__ ((noinline))
-+foo (void)
-+{
-+ return 0;
-+}
-+
-+static void
-+__attribute__ ((noinline))
-+bar (void)
-+{
-+}
-+
-+static inline void
-+baz (void)
-+{
-+ char arr[x];
-+
-+lab:
-+ if (foo () == -1)
-+ {
-+ bar ();
-+ goto lab;
-+ }
-+}
-+
-+void
-+test (void)
-+{
-+ baz ();
-+}
+++ /dev/null
---- libjava/Makefile.am.jj Tue Jun 4 20:41:44 2002
-+++ libjava/Makefile.am Wed Jun 5 15:20:30 2002
-@@ -111,6 +111,8 @@ INCLUDES = -I$(top_srcdir) -Iinclude -I$
-
- ## ################################################################
-
-+rpath_def = $(shell if test "$(toolexeclibdir)" != /usr/lib; then echo -rpath $(toolexeclibdir); fi)
-+
- ##
- ## How to build libgcj.a and libgcj.jar
- ##
-@@ -410,7 +412,7 @@ EXTRA_jv_convert_SOURCES = $(convert_sou
- ## need this because we are explicitly using libtool to link using the
- ## `.la' file.
- jv_convert_LDFLAGS = --main=gnu.gcj.convert.Convert \
-- -rpath $(toolexeclibdir) -shared-libgcc $(THREADLDFLAGS)
-+ $(rpath_def) -shared-libgcc $(THREADLDFLAGS)
- jv_convert_LINK = $(GCJLINK)
- ## We don't explicitly link in the libraries we need; libgcj.la brings
- ## in all dependencies. We need the -L so that gcj can find libgcj
-@@ -429,7 +431,7 @@ gij_SOURCES = gij.cc
- ## We need -nodefaultlibs because we want to avoid gcj's `-lgcj'. We
- ## need this because we are explicitly using libtool to link using the
- ## `.la' file.
--gij_LDFLAGS = -rpath $(toolexeclibdir) -shared-libgcc $(THREADLDFLAGS)
-+gij_LDFLAGS = $(rpath_def) -shared-libgcc $(THREADLDFLAGS)
- gij_LINK = $(GCJLINK)
- ## See jv_convert_LDADD.
- gij_LDADD = -L$(here)/.libs libgcj.la
-@@ -441,7 +443,7 @@ rmic_SOURCES =
- ## This is a dummy definition.
- EXTRA_rmic_SOURCES = $(rmi_java_source_files)
- rmic_LDFLAGS = --main=gnu.java.rmi.rmic.RMIC \
-- -rpath $(toolexeclibdir) -shared-libgcc $(THREADLDFLAGS)
-+ $(rpath_def) -shared-libgcc $(THREADLDFLAGS)
- rmic_LINK = $(GCJLINK)
- ## See jv_convert_LDADD.
- rmic_LDADD = -L$(here)/.libs libgcj.la
-@@ -453,7 +455,7 @@ rmiregistry_SOURCES =
- ## This is a dummy definition.
- EXTRA_rmiregistry_SOURCES = $(rmi_java_source_files)
- rmiregistry_LDFLAGS = --main=gnu.java.rmi.registry.RegistryImpl \
-- -rpath $(toolexeclibdir) -shared-libgcc $(THREADLDFLAGS)
-+ $(rpath_def) -shared-libgcc $(THREADLDFLAGS)
- rmiregistry_LINK = $(GCJLINK)
- ## See jv_convert_LDADD.
- rmiregistry_LDADD = -L$(here)/.libs libgcj.la
---- libjava/Makefile.in.jj Tue Jun 4 23:25:56 2002
-+++ libjava/Makefile.in Wed Jun 5 15:21:59 2002
-@@ -184,6 +184,7 @@ INCLUDES = -I$(top_srcdir) -Iinclude -I$
- $(GCINCS) $(THREADINCS) $(INCLTDL) \
- $(GCC_UNWIND_INCLUDE) $(ZINCS) $(LIBFFIINCS)
-
-+rpath_def = $(shell if test "$(toolexeclibdir)" != /usr/lib; then echo -rpath $(toolexeclibdir); fi)
-
- nat_files = $(nat_source_files:.cc=.lo)
- x_nat_files = $(x_nat_source_files:.cc=.lo)
-@@ -263,7 +264,7 @@ CONVERT_DIR = gnu/gcj/convert
- jv_convert_SOURCES =
- EXTRA_jv_convert_SOURCES = $(convert_source_files)
- jv_convert_LDFLAGS = --main=gnu.gcj.convert.Convert \
-- -rpath $(toolexeclibdir) -shared-libgcc $(THREADLDFLAGS)
-+ $(rpath_def) -shared-libgcc $(THREADLDFLAGS)
-
- jv_convert_LINK = $(GCJLINK)
- jv_convert_LDADD = -L$(here)/.libs libgcj.la
-@@ -272,7 +273,7 @@ jv_convert_DEPENDENCIES = $(convert_sour
-
-
- gij_SOURCES = gij.cc
--gij_LDFLAGS = -rpath $(toolexeclibdir) -shared-libgcc $(THREADLDFLAGS)
-+gij_LDFLAGS = $(rpath_def) -shared-libgcc $(THREADLDFLAGS)
- gij_LINK = $(GCJLINK)
- gij_LDADD = -L$(here)/.libs libgcj.la
- gij_DEPENDENCIES = libgcj.la libgcj.spec
-@@ -280,7 +281,7 @@ gij_DEPENDENCIES = libgcj.la libgcj.spec
- rmic_SOURCES =
- EXTRA_rmic_SOURCES = $(rmi_java_source_files)
- rmic_LDFLAGS = --main=gnu.java.rmi.rmic.RMIC \
-- -rpath $(toolexeclibdir) -shared-libgcc $(THREADLDFLAGS)
-+ $(rpath_def) -shared-libgcc $(THREADLDFLAGS)
-
- rmic_LINK = $(GCJLINK)
- rmic_LDADD = -L$(here)/.libs libgcj.la
-@@ -289,7 +290,7 @@ rmic_DEPENDENCIES = libgcj.la libgcj.spe
- rmiregistry_SOURCES =
- EXTRA_rmiregistry_SOURCES = $(rmi_java_source_files)
- rmiregistry_LDFLAGS = --main=gnu.java.rmi.registry.RegistryImpl \
-- -rpath $(toolexeclibdir) -shared-libgcc $(THREADLDFLAGS)
-+ $(rpath_def) -shared-libgcc $(THREADLDFLAGS)
-
- rmiregistry_LINK = $(GCJLINK)
- rmiregistry_LDADD = -L$(here)/.libs libgcj.la
+++ /dev/null
-From gcc-patches-return-67062-listarch-gcc-patches=gcc dot gnu dot org at gcc dot gnu dot org Fri Aug 30 10:39:38 2002
-Return-Path: <gcc-patches-return-67062-listarch-gcc-patches=gcc dot gnu dot org at gcc dot gnu dot org>
-Delivered-To: listarch-gcc-patches at gcc dot gnu dot org
-Received: (qmail 32272 invoked by alias); 30 Aug 2002 10:39:36 -0000
-Mailing-List: contact gcc-patches-help at gcc dot gnu dot org; run by ezmlm
-Precedence: bulk
-List-Archive: <http://gcc.gnu.org/ml/gcc-patches/>
-List-Post: <mailto:gcc-patches at gcc dot gnu dot org>
-List-Help: <mailto:gcc-patches-help at gcc dot gnu dot org>
-Sender: gcc-patches-owner at gcc dot gnu dot org
-Delivered-To: mailing list gcc-patches at gcc dot gnu dot org
-Received: (qmail 32195 invoked from network); 30 Aug 2002 10:39:32 -0000
-Received: from unknown (HELO sunsite.mff.cuni.cz) (195.113.19.66)
- by sources dot redhat dot com with SMTP; 30 Aug 2002 10:39:32 -0000
-Received: (from jakub@localhost)
- by sunsite dot mff dot cuni dot cz (8 dot 11 dot 6/8 dot 11 dot 6) id g7UAcS700895;
- Fri, 30 Aug 2002 12:38:28 +0200
-Date: Fri, 30 Aug 2002 12:38:28 +0200
-From: Jakub Jelinek <jakub at redhat dot com>
-To: bkoz at redhat dot com, mark at codesourcery dot com
-Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org, drepper at redhat dot com,
- roland at redhat dot com
-Subject: [PATCH] Fix libstdc++-v3 on GLIBC 2.3+
-Message-ID: <20020830123828.Y1013@sunsite.ms.mff.cuni.cz>
-Reply-To: Jakub Jelinek <jakub at redhat dot com>
-Mime-Version: 1.0
-Content-Type: text/plain; charset=iso-8859-1
-Content-Disposition: inline
-Content-Transfer-Encoding: 8bit
-User-Agent: Mutt/1.2.5.1i
-
-Hi!
-
-The following patch fixes libstdc++-v3 compilation and use on GLIBC 2.2.9x+.
-It passed libstdc++-v3 make check with 24 XPASSes and 1 FAIL - the remaining
-2 missing XPASSes (ie. the only 2 XFAILs) are:
-XFAIL: 22_locale/messages_byname.cc execution test
-XFAIL: 22_locale/messages_members_char.cc execution test
-which fail because of a glibc bug Roland is working on.
-
-The only difference on libstdc++.so symbols this has is that
-_ZNKSt8messagesIwE6do_getEiiiRKSbIwSt11char_traitsIwESaIwEE
-symbol is no longer weak (ie. T instead of W in nm output),
-which doesn't change anything for binary compatibility IMHO.
-
-Ok to commit? 3.2 branch too?
-
-2002-08-30 Jakub Jelinek <jakub@redhat.com>
-
- * config/locale/generic/c++locale_internal.h: New header.
- * config/locale/gnu/c++locale_internal.h: New header.
- * config/locale/gnu/c_locale.cc: Include it.
- * config/locale/gnu/collate_members.cc: Include it.
- * config/locale/gnu/ctype_members.cc: Include it.
- * config/locale/gnu/messages_members.cc: Include it.
- * config/locale/gnu/monetary_members.cc: Include it.
- * config/locale/gnu/numeric_members.cc: Include it.
- * config/locale/gnu/time_members.cc: Include it.
- (_M_put): Reorder __strftime_l and __wcsftime_l arguments to match
- glibc.
- (_M_initialize_timepunct): Initialize _M_c_locale_timepunct for
- C locale.
- * acinclude.m4: Include string.h when testing strcoll_l.
- For glibc 2.3 provide __-prefixed prototypes.
- (CLOCALE_INTERNAL_H): Set, add AC_LINK_FILES line.
- * aclocal.m4, configure: Rebuilt.
-
-2002-08-29 Benjamin Kosnik <bkoz@redhat.com>
-
- * include/bits/locale_facets.h: Add declaration of specialization
- here.
- * config/locale/gnu/messages_members.cc: Add specialization for
- messages<wchar_t>.
- * config/locale/gnu/messages_members.h: Remove generic definition
- of do_get.
-
---- libstdc++-v3/config/locale/generic/c++locale_internal.h.jj 2002-08-29 14:57:21.000000000 +0200
-+++ libstdc++-v3/config/locale/generic/c++locale_internal.h 2002-08-30 12:05:10.000000000 +0200
-@@ -0,0 +1,30 @@
-+// Locale internal implementation header -*- C++ -*-
-+
-+// Copyright (C) 2002 Free Software Foundation, Inc.
-+//
-+// This file is part of the GNU ISO C++ Library. This library is free
-+// software; you can redistribute it and/or modify it under the
-+// terms of the GNU General Public License as published by the
-+// Free Software Foundation; either version 2, or (at your option)
-+// any later version.
-+
-+// This library is distributed in the hope that it will be useful,
-+// but WITHOUT ANY WARRANTY; without even the implied warranty of
-+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+// GNU General Public License for more details.
-+
-+// You should have received a copy of the GNU General Public License along
-+// with this library; see the file COPYING. If not, write to the Free
-+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+// USA.
-+
-+// As a special exception, you may use this file as part of a free software
-+// library without restriction. Specifically, if other files instantiate
-+// templates or use macros or inline functions from this file, or you compile
-+// this file and link it with other files to produce an executable, this
-+// file does not by itself cause the resulting executable to be covered by
-+// the GNU General Public License. This exception does not however
-+// invalidate any other reasons why the executable file might be covered by
-+// the GNU General Public License.
-+
-+// The generic locale code doesn't need to do anything here (yet)
---- libstdc++-v3/config/locale/gnu/c_locale.cc.jj 2002-04-23 20:30:31.000000000 +0200
-+++ libstdc++-v3/config/locale/gnu/c_locale.cc 2002-08-30 12:09:12.000000000 +0200
-@@ -36,6 +36,7 @@
- #include <locale>
- #include <stdexcept>
- #include <langinfo.h>
-+#include "c++locale_internal.h"
-
- namespace std
- {
---- libstdc++-v3/config/locale/gnu/collate_members.cc.jj 2002-04-23 20:30:31.000000000 +0200
-+++ libstdc++-v3/config/locale/gnu/collate_members.cc 2002-08-30 12:09:12.000000000 +0200
-@@ -1,6 +1,6 @@
- // std::collate implementation details, GNU version -*- C++ -*-
-
--// Copyright (C) 2001 Free Software Foundation, Inc.
-+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
- //
- // This file is part of the GNU ISO C++ Library. This library is free
- // software; you can redistribute it and/or modify it under the
-@@ -34,6 +34,7 @@
- // Written by Benjamin Kosnik <bkoz@redhat.com>
-
- #include <locale>
-+#include "c++locale_internal.h"
-
- namespace std
- {
---- libstdc++-v3/config/locale/gnu/ctype_members.cc.jj 2002-05-25 00:18:17.000000000 +0200
-+++ libstdc++-v3/config/locale/gnu/ctype_members.cc 2002-08-30 12:09:12.000000000 +0200
-@@ -34,6 +34,7 @@
- // Written by Benjamin Kosnik <bkoz@redhat.com>
-
- #include <locale>
-+#include "c++locale_internal.h"
-
- namespace std
- {
---- libstdc++-v3/config/locale/gnu/messages_members.cc.jj 2002-05-22 15:38:28.000000000 +0200
-+++ libstdc++-v3/config/locale/gnu/messages_members.cc 2002-08-30 12:09:12.000000000 +0200
-@@ -34,6 +34,7 @@
- // Written by Benjamin Kosnik <bkoz@redhat.com>
-
- #include <locale>
-+#include "c++locale_internal.h"
-
- namespace std
- {
-@@ -56,4 +57,25 @@ namespace std
- return string(__msg);
- #endif
- }
-+
-+#ifdef _GLIBCPP_USE_WCHAR_T
-+ template<>
-+ wstring
-+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
-+ {
-+# if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ __c_locale __old = __uselocale(_M_c_locale_messages);
-+ char* __msg = gettext(_M_convert_to_char(__dfault));
-+ __uselocale(__old);
-+ return _M_convert_from_char(__msg);
-+# else
-+ char* __old = strdup(setlocale(LC_ALL, NULL));
-+ setlocale(LC_ALL, _M_name_messages);
-+ char* __msg = gettext(_M_convert_to_char(__dfault));
-+ setlocale(LC_ALL, __old);
-+ free(__old);
-+ return _M_convert_from_char(__msg);
-+# endif
-+ }
-+#endif
- }
---- libstdc++-v3/config/locale/gnu/monetary_members.cc.jj 2002-07-27 01:31:05.000000000 +0200
-+++ libstdc++-v3/config/locale/gnu/monetary_members.cc 2002-08-30 12:09:12.000000000 +0200
-@@ -34,6 +34,7 @@
- // Written by Benjamin Kosnik <bkoz@redhat.com>
-
- #include <locale>
-+#include "c++locale_internal.h"
-
- namespace std
- {
---- libstdc++-v3/config/locale/gnu/numeric_members.cc.jj 2002-04-23 20:30:31.000000000 +0200
-+++ libstdc++-v3/config/locale/gnu/numeric_members.cc 2002-08-30 12:09:12.000000000 +0200
-@@ -34,6 +34,7 @@
- // Written by Benjamin Kosnik <bkoz@redhat.com>
-
- #include <locale>
-+#include "c++locale_internal.h"
-
- namespace std
- {
---- libstdc++-v3/config/locale/gnu/time_members.cc.jj 2002-05-22 15:38:30.000000000 +0200
-+++ libstdc++-v3/config/locale/gnu/time_members.cc 2002-08-30 12:09:12.000000000 +0200
-@@ -35,6 +35,7 @@
- // Written by Benjamin Kosnik <bkoz@redhat.com>
-
- #include <locale>
-+#include "c++locale_internal.h"
-
- namespace std
- {
-@@ -52,7 +53,7 @@ namespace std
- const tm* __tm) const
- {
- #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-- __strftime_l(__s, __maxlen, _M_c_locale_timepunct, __format, __tm);
-+ __strftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
- #else
- char* __old = strdup(setlocale(LC_ALL, NULL));
- setlocale(LC_ALL, _M_name_timepunct);
-@@ -69,6 +70,9 @@ namespace std
- if (__cloc == _S_c_locale)
- {
- // "C" locale
-+
-+ _M_c_locale_timepunct = _S_c_locale;
-+
- _M_date_format = "%m/%d/%y";
- _M_date_era_format = "%m/%d/%y";
- _M_time_format = "%H:%M:%S";
-@@ -202,7 +206,7 @@ namespace std
- const tm* __tm) const
- {
- #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-- __wcsftime_l(__s, __maxlen, _M_c_locale_timepunct, __format, __tm);
-+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
- #else
- char* __old = strdup(setlocale(LC_ALL, NULL));
- setlocale(LC_ALL, _M_name_timepunct);
-@@ -219,6 +223,9 @@ namespace std
- if (__cloc == _S_c_locale)
- {
- // "C" locale
-+
-+ _M_c_locale_timepunct = _S_c_locale;
-+
- _M_date_format = L"%m/%d/%y";
- _M_date_era_format = L"%m/%d/%y";
- _M_time_format = L"%H:%M:%S";
---- libstdc++-v3/config/locale/gnu/messages_members.h.jj 2002-05-22 15:38:28.000000000 +0200
-+++ libstdc++-v3/config/locale/gnu/messages_members.h 2002-08-29 17:50:14.000000000 +0200
-@@ -55,26 +55,6 @@
- }
-
- template<typename _CharT>
-- typename messages<_CharT>::string_type
-- messages<_CharT>::do_get(catalog, int, int,
-- const string_type& __dfault) const
-- {
--#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-- __c_locale __old = __uselocale(_M_c_locale_messages);
-- char* __msg = gettext(_M_convert_to_char(__dfault));
-- __uselocale(__old);
-- return _M_convert_from_char(__msg);
--#else
-- char* __old = strdup(setlocale(LC_ALL, NULL));
-- setlocale(LC_ALL, _M_name_messages);
-- char* __msg = gettext(_M_convert_to_char(__dfault));
-- setlocale(LC_ALL, __old);
-- free(__old);
-- return _M_convert_from_char(__msg);
--#endif
-- }
--
-- template<typename _CharT>
- void
- messages<_CharT>::do_close(catalog) const
- { }
---- libstdc++-v3/config/locale/gnu/c++locale_internal.h.jj 2002-08-29 14:57:21.000000000 +0200
-+++ libstdc++-v3/config/locale/gnu/c++locale_internal.h 2002-08-29 15:21:59.000000000 +0200
-@@ -0,0 +1,59 @@
-+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
-+
-+// Copyright (C) 2002 Free Software Foundation, Inc.
-+//
-+// This file is part of the GNU ISO C++ Library. This library is free
-+// software; you can redistribute it and/or modify it under the
-+// terms of the GNU General Public License as published by the
-+// Free Software Foundation; either version 2, or (at your option)
-+// any later version.
-+
-+// This library is distributed in the hope that it will be useful,
-+// but WITHOUT ANY WARRANTY; without even the implied warranty of
-+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+// GNU General Public License for more details.
-+
-+// You should have received a copy of the GNU General Public License along
-+// with this library; see the file COPYING. If not, write to the Free
-+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+// USA.
-+
-+// As a special exception, you may use this file as part of a free software
-+// library without restriction. Specifically, if other files instantiate
-+// templates or use macros or inline functions from this file, or you compile
-+// this file and link it with other files to produce an executable, this
-+// file does not by itself cause the resulting executable to be covered by
-+// the GNU General Public License. This exception does not however
-+// invalidate any other reasons why the executable file might be covered by
-+// the GNU General Public License.
-+
-+// Written by Jakub Jelinek <jakub@redhat.com>
-+
-+#include <clocale>
-+
-+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+
-+extern "C" __typeof(iswctype_l) __iswctype_l;
-+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
-+extern "C" __typeof(strcoll_l) __strcoll_l;
-+extern "C" __typeof(strftime_l) __strftime_l;
-+extern "C" __typeof(strtod_l) __strtod_l;
-+extern "C" __typeof(strtof_l) __strtof_l;
-+extern "C" __typeof(strtold_l) __strtold_l;
-+extern "C" __typeof(strtol_l) __strtol_l;
-+extern "C" __typeof(strtoll_l) __strtoll_l;
-+extern "C" __typeof(strtoul_l) __strtoul_l;
-+extern "C" __typeof(strtoull_l) __strtoull_l;
-+extern "C" __typeof(strxfrm_l) __strxfrm_l;
-+extern "C" __typeof(towlower_l) __towlower_l;
-+extern "C" __typeof(towupper_l) __towupper_l;
-+extern "C" __typeof(wcscoll_l) __wcscoll_l;
-+extern "C" __typeof(wcsftime_l) __wcsftime_l;
-+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
-+extern "C" __typeof(wctype_l) __wctype_l;
-+extern "C" __typeof(newlocale) __newlocale;
-+extern "C" __typeof(freelocale) __freelocale;
-+extern "C" __typeof(duplocale) __duplocale;
-+extern "C" __typeof(uselocale) __uselocale;
-+
-+#endif // GLIBC 2.3 and later
---- libstdc++-v3/include/bits/locale_facets.h.jj 2002-08-01 23:43:48.000000000 +0200
-+++ libstdc++-v3/include/bits/locale_facets.h 2002-08-29 17:49:53.000000000 +0200
-@@ -1739,6 +1739,12 @@ namespace std
- string
- messages<char>::do_get(catalog, int, int, const string&) const;
-
-+#ifdef _GLIBCPP_USE_WCHAR_T
-+ template<>
-+ wstring
-+ messages<wchar_t>::do_get(catalog, int, int, const wstring&) const;
-+#endif
-+
- // Include host and configuration specific messages virtual functions.
- #include <bits/messages_members.h>
-
---- libstdc++-v3/acinclude.m4.jj 2002-08-29 13:51:58.000000000 +0200
-+++ libstdc++-v3/acinclude.m4 2002-08-30 11:58:42.000000000 +0200
-@@ -1131,6 +1131,12 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
- AC_TRY_RUN([
- #define _GNU_SOURCE 1
- #include <locale.h>
-+ #include <string.h>
-+ #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ extern __typeof(newlocale) __newlocale;
-+ extern __typeof(duplocale) __duplocale;
-+ extern __typeof(strcoll_l) __strcoll_l;
-+ #endif
- int main()
- {
- const char __one[] = "Äuglein Augmen";
-@@ -1179,6 +1185,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
- CMONEY_CC=config/locale/generic/monetary_members.cc
- CNUMERIC_CC=config/locale/generic/numeric_members.cc
- CTIME_CC=config/locale/generic/time_members.cc
-+ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
- ;;
- xgnu)
- AC_MSG_RESULT(gnu)
-@@ -1211,6 +1218,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
- CMONEY_CC=config/locale/gnu/monetary_members.cc
- CNUMERIC_CC=config/locale/gnu/numeric_members.cc
- CTIME_CC=config/locale/gnu/time_members.cc
-+ CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h
- ;;
- xieee_1003.1-2001)
- AC_MSG_RESULT(generic)
-@@ -1225,6 +1233,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
- CMONEY_CC=config/locale/generic/monetary_members.cc
- CNUMERIC_CC=config/locale/generic/numeric_members.cc
- CTIME_CC=config/locale/generic/time_members.cc
-+ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
- ;;
- *)
- echo "$enable_clocale is an unknown locale package" 1>&2
-@@ -1248,6 +1257,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
- AC_LINK_FILES($CMONEY_CC, src/monetary.cc)
- AC_LINK_FILES($CNUMERIC_CC, src/numeric.cc)
- AC_LINK_FILES($CTIME_CC, src/time.cc)
-+ AC_LINK_FILES($CLOCALE_INTERNAL_H, src/c++locale_internal.h)
- ])
-
-
---- libstdc++-v3/aclocal.m4.jj 2002-08-29 13:51:58.000000000 +0200
-+++ libstdc++-v3/aclocal.m4 2002-08-30 11:58:46.000000000 +0200
-@@ -1143,6 +1143,12 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
- AC_TRY_RUN([
- #define _GNU_SOURCE 1
- #include <locale.h>
-+ #include <string.h>
-+ #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ extern __typeof(newlocale) __newlocale;
-+ extern __typeof(duplocale) __duplocale;
-+ extern __typeof(strcoll_l) __strcoll_l;
-+ #endif
- int main()
- {
- const char __one[] = "Äuglein Augmen";
-@@ -1191,6 +1197,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
- CMONEY_CC=config/locale/generic/monetary_members.cc
- CNUMERIC_CC=config/locale/generic/numeric_members.cc
- CTIME_CC=config/locale/generic/time_members.cc
-+ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
- ;;
- xgnu)
- AC_MSG_RESULT(gnu)
-@@ -1223,6 +1230,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
- CMONEY_CC=config/locale/gnu/monetary_members.cc
- CNUMERIC_CC=config/locale/gnu/numeric_members.cc
- CTIME_CC=config/locale/gnu/time_members.cc
-+ CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h
- ;;
- xieee_1003.1-2001)
- AC_MSG_RESULT(generic)
-@@ -1237,6 +1245,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
- CMONEY_CC=config/locale/generic/monetary_members.cc
- CNUMERIC_CC=config/locale/generic/numeric_members.cc
- CTIME_CC=config/locale/generic/time_members.cc
-+ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
- ;;
- *)
- echo "$enable_clocale is an unknown locale package" 1>&2
-@@ -1260,6 +1269,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
- AC_LINK_FILES($CMONEY_CC, src/monetary.cc)
- AC_LINK_FILES($CNUMERIC_CC, src/numeric.cc)
- AC_LINK_FILES($CTIME_CC, src/time.cc)
-+ AC_LINK_FILES($CLOCALE_INTERNAL_H, src/c++locale_internal.h)
- ])
-
-
---- libstdc++-v3/configure.jj 2002-08-29 13:52:46.000000000 +0200
-+++ libstdc++-v3/configure 2002-08-30 12:00:07.000000000 +0200
-@@ -2961,6 +2961,12 @@ else
-
- #define _GNU_SOURCE 1
- #include <locale.h>
-+ #include <string.h>
-+ #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ extern __typeof(newlocale) __newlocale;
-+ extern __typeof(duplocale) __duplocale;
-+ extern __typeof(strcoll_l) __strcoll_l;
-+ #endif
- int main()
- {
- const char __one[] = "Äuglein Augmen";
-@@ -3023,6 +3029,7 @@ fi
- CMONEY_CC=config/locale/generic/monetary_members.cc
- CNUMERIC_CC=config/locale/generic/numeric_members.cc
- CTIME_CC=config/locale/generic/time_members.cc
-+ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
- ;;
- xgnu)
- echo "$ac_t""gnu" 1>&6
-@@ -3084,6 +3091,7 @@ fi
- CMONEY_CC=config/locale/gnu/monetary_members.cc
- CNUMERIC_CC=config/locale/gnu/numeric_members.cc
- CTIME_CC=config/locale/gnu/time_members.cc
-+ CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h
- ;;
- xieee_1003.1-2001)
- echo "$ac_t""generic" 1>&6
-@@ -3098,6 +3106,7 @@ fi
- CMONEY_CC=config/locale/generic/monetary_members.cc
- CNUMERIC_CC=config/locale/generic/numeric_members.cc
- CTIME_CC=config/locale/generic/time_members.cc
-+ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
- ;;
- *)
- echo "$enable_clocale is an unknown locale package" 1>&2
-@@ -22689,8 +22698,8 @@ fi; done
- EOF
-
- cat >> $CONFIG_STATUS <<EOF
--ac_sources="$BASIC_FILE_CC $CLOCALE_CC $CCOLLATE_CC $CCTYPE_CC $CMESSAGES_CC $CMONEY_CC $CNUMERIC_CC $CTIME_CC $LINKER_MAP"
--ac_dests="src/basic_file.cc src/c++locale.cc src/collate.cc src/ctype.cc src/messages.cc src/monetary.cc src/numeric.cc src/time.cc src/linker.map"
-+ac_sources="$BASIC_FILE_CC $CLOCALE_CC $CCOLLATE_CC $CCTYPE_CC $CMESSAGES_CC $CMONEY_CC $CNUMERIC_CC $CTIME_CC $CLOCALE_INTERNAL_H $LINKER_MAP"
-+ac_dests="src/basic_file.cc src/c++locale.cc src/collate.cc src/ctype.cc src/messages.cc src/monetary.cc src/numeric.cc src/time.cc src/c++locale_internal.h src/linker.map"
- EOF
-
- cat >> $CONFIG_STATUS <<\EOF
-
- Jakub
-
+++ /dev/null
---- libstdc++-v3/config/locale/gnu/ctype_members.cc.jj 2002-08-30 12:09:12.000000000 +0200
-+++ libstdc++-v3/config/locale/gnu/ctype_members.cc 2002-09-02 15:25:15.000000000 +0200
-@@ -166,15 +166,30 @@ namespace std
- wchar_t
- ctype<wchar_t>::
- do_widen(char __c) const
-- { return btowc(__c); }
--
-+ {
-+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ __c_locale __old = __uselocale(_M_c_locale_ctype);
-+#endif
-+ wchar_t __ret = btowc(__c);
-+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ __uselocale(__old);
-+#endif
-+ return __ret;
-+ }
-+
- const char*
- ctype<wchar_t>::
- do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
- {
-+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ __c_locale __old = __uselocale(_M_c_locale_ctype);
-+#endif
- mbstate_t __state;
- memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t));
- mbsrtowcs(__dest, &__lo, __hi - __lo, &__state);
-+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ __uselocale(__old);
-+#endif
- return __hi;
- }
-
-@@ -182,7 +197,13 @@ namespace std
- ctype<wchar_t>::
- do_narrow(wchar_t __wc, char __dfault) const
- {
-+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ __c_locale __old = __uselocale(_M_c_locale_ctype);
-+#endif
- int __c = wctob(__wc);
-+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ __uselocale(__old);
-+#endif
- return (__c == EOF ? __dfault : static_cast<char>(__c));
- }
-
-@@ -191,6 +212,9 @@ namespace std
- do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
- char* __dest) const
- {
-+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ __c_locale __old = __uselocale(_M_c_locale_ctype);
-+#endif
- size_t __offset = 0;
- while (true)
- {
-@@ -208,6 +232,9 @@ namespace std
- else
- break;
- }
-+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ __uselocale(__old);
-+#endif
- return __hi;
- }
- #endif // _GLIBCPP_USE_WCHAR_T
+++ /dev/null
-From gcc-patches-return-67562-listarch-gcc-patches=gcc dot gnu dot org at gcc dot gnu dot org Fri Sep 06 14:44:59 2002
-Return-Path: <gcc-patches-return-67562-listarch-gcc-patches=gcc dot gnu dot org at gcc dot gnu dot org>
-Delivered-To: listarch-gcc-patches at gcc dot gnu dot org
-Received: (qmail 31503 invoked by alias); 6 Sep 2002 14:44:56 -0000
-Mailing-List: contact gcc-patches-help at gcc dot gnu dot org; run by ezmlm
-Precedence: bulk
-List-Archive: <http://gcc.gnu.org/ml/gcc-patches/>
-List-Post: <mailto:gcc-patches at gcc dot gnu dot org>
-List-Help: <mailto:gcc-patches-help at gcc dot gnu dot org>
-Sender: gcc-patches-owner at gcc dot gnu dot org
-Delivered-To: mailing list gcc-patches at gcc dot gnu dot org
-Received: (qmail 31479 invoked from network); 6 Sep 2002 14:44:52 -0000
-Received: from unknown (HELO devserv.devel.redhat.com) (66.187.233.200)
- by sources dot redhat dot com with SMTP; 6 Sep 2002 14:44:52 -0000
-Received: (from jakub@localhost)
- by devserv dot devel dot redhat dot com (8 dot 11 dot 6/8 dot 11 dot 0) id g86EioP06755;
- Fri, 6 Sep 2002 10:44:50 -0400
-Date: Fri, 6 Sep 2002 10:44:50 -0400
-From: Jakub Jelinek <jakub at redhat dot com>
-To: Benjamin Kosnik <bkoz at redhat dot com>
-Cc: bkoz at nabi dot net, libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
-Subject: [PATCH] Fix libstdc++ usage of __ctype_b/__ctype_to* (take 2)
-Message-ID: <20020906104449.C7920@devserv.devel.redhat.com>
-Reply-To: Jakub Jelinek <jakub at redhat dot com>
-References: <20020901040933.I7886@dhcp187.sf.frob.com> <20020901095711.C7920@devserv.devel.redhat.com> <20020901102055.A5791@devserv.devel.redhat.com> <3D724B9A.6050908@redhat.com> <20020901145657.E7920@devserv.devel.redhat.com> <3D726A72.2080106@redhat.com> <20020901165440.F7920@devserv.devel.redhat.com> <20020904160557.7dbc29f6.bkoz@nabi.net> <20020905041710.P7920@devserv.devel.redhat.com> <20020905103148.7c1381a2.bkoz@redhat.com>
-Mime-Version: 1.0
-Content-Type: text/plain; charset=us-ascii
-Content-Disposition: inline
-User-Agent: Mutt/1.2.5.1i
-In-Reply-To: <20020905103148 dot 7c1381a2 dot bkoz at redhat dot com>; from bkoz at redhat dot com on Thu, Sep 05, 2002 at 10:31:48AM -0500
-
-On Thu, Sep 05, 2002 at 10:31:48AM -0500, Benjamin Kosnik wrote:
-> > Most probably yes, but as it is a static method I wanted to be sure.
-> > Should I leave it in?
->
-> Sure.
-
-> > > Just remove all this _GLIBCPP_USE_SHADOW_HEADERS cruft.
-> >
-> > You mean the using lines too?
->
-> Yep.
-
-> > BTW: This will have the effect that --enable-clocale=generic will no longer
-> > work with glibc 2.3+. Although for everything but checking the generic
-> > clocale gnu it makes no sense to use anything but --enable-clocale=gnu
-> > with glibc 2.3+, we might as well consider using:
-> >
-> > #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-> > __ret = *__ctype_b_loc();
-> > #else
-> > __ret = __ctype_b;
-> > #endif
-> > here (and similarly with __ctype_tolower and __ctype_toupper).
->
-> Sounds good.
-
-Ok, here is an updated version of the patch.
-Ok to commit (head, branch)?
-
-2002-09-06 Jakub Jelinek <jakub@redhat.com>
-
- * config/os/gnu-linux/bits/ctype_noninline.h
- [_GLIBCPP_USE_SHADOW_HEADERS]: Remove using _C_legacy::__ctype_*.
- (ctype<char>::classic_table): If _GLIBCPP_C_LOCALE_GNU, return
- _S_c_locale->__ctype_b, otherwise temporarily switch to "C" locale
- and return __ctype_b.
- (ctype<char>::ctype(__c_locale, const mask*, bool, size_t)): If not
- _GLIBCPP_C_LOCALE_GNU, temporarily switch to "C" locale and
- initialize using __ctype_{b,tolower,toupper}.
- (ctype<char>::ctype(const mask*, bool, size_t)): If
- _GLIBCPP_C_LOCALE_GNU, initialize using
- _S_c_locale->__ctype_{b,tolower,toupper}, otherwise temporarily
- switch to "C" locale and initialize using __ctype_{b,tolower,toupper}.
-
---- libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h.jj 2002-09-03 11:54:25.000000000 +0200
-+++ libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h 2002-09-06 10:34:59.000000000 +0200
-@@ -34,16 +34,32 @@
-
- // Information as gleaned from /usr/include/ctype.h
-
--#if _GLIBCPP_USE_SHADOW_HEADERS
-- using _C_legacy::__ctype_toupper;
-- using _C_legacy::__ctype_tolower;
-- using _C_legacy::__ctype_b;
--#endif
--
-+#if _GLIBCPP_C_LOCALE_GNU
- const ctype_base::mask*
- ctype<char>::classic_table() throw()
-- { return __ctype_b; }
--
-+ {
-+ if (!_S_c_locale)
-+ _S_create_c_locale(_S_c_locale, "C");
-+ return _S_c_locale->__ctype_b;
-+ }
-+#else
-+ const ctype_base::mask*
-+ ctype<char>::classic_table() throw()
-+ {
-+ const ctype_base::mask* __ret;
-+ char* __old = strdup(setlocale(LC_CTYPE, NULL));
-+ setlocale(LC_CTYPE, "C");
-+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ __ret = *__ctype_b_loc();
-+#else
-+ __ret = __ctype_b;
-+#endif
-+ setlocale(LC_CTYPE, __old);
-+ free(__old);
-+ return __ret;
-+ }
-+#endif
-+
- #if _GLIBCPP_C_LOCALE_GNU
- ctype<char>::ctype(__c_locale __cloc, const mask* __table, bool __del,
- size_t __refs)
-@@ -57,17 +73,55 @@
- #else
- ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
- size_t __refs)
-- : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
-- _M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower),
-- _M_table(__table ? __table : classic_table())
-- { _M_c_locale_ctype = _S_c_locale; }
-+ : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del)
-+ {
-+ char* __old=strdup(setlocale(LC_CTYPE, NULL));
-+ setlocale(LC_CTYPE, "C");
-+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ _M_toupper = *__ctype_toupper_loc();
-+ _M_tolower = *__ctype_tolower_loc();
-+ _M_table = __table ? __table : *__ctype_b_loc();
-+#else
-+ _M_toupper = __ctype_toupper;
-+ _M_tolower = __ctype_tolower;
-+ _M_table = __table ? __table : __ctype_b;
-+#endif
-+ setlocale(LC_CTYPE, __old);
-+ free(__old);
-+ _M_c_locale_ctype = _S_c_locale;
-+ }
- #endif
-
-+#if _GLIBCPP_C_LOCALE_GNU
- ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) :
-- __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
-- _M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower),
-- _M_table(__table ? __table : classic_table())
-- { _M_c_locale_ctype = _S_c_locale; }
-+ __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del)
-+ {
-+ _M_c_locale_ctype = _S_c_locale;
-+ _M_toupper = _M_c_locale_ctype->__ctype_toupper;
-+ _M_tolower = _M_c_locale_ctype->__ctype_tolower;
-+ _M_table = __table ? __table : _M_c_locale_ctype->__ctype_b;
-+ }
-+#else
-+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
-+ size_t __refs)
-+ : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del)
-+ {
-+ char* __old=strdup(setlocale(LC_CTYPE, NULL));
-+ setlocale(LC_CTYPE, "C");
-+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ _M_toupper = *__ctype_toupper_loc();
-+ _M_tolower = *__ctype_tolower_loc();
-+ _M_table = __table ? __table : *__ctype_b_loc();
-+#else
-+ _M_toupper = __ctype_toupper;
-+ _M_tolower = __ctype_tolower;
-+ _M_table = __table ? __table : __ctype_b;
-+#endif
-+ setlocale(LC_CTYPE, __old);
-+ free(__old);
-+ _M_c_locale_ctype = _S_c_locale;
-+ }
-+#endif
-
- char
- ctype<char>::do_toupper(char __c) const
-
-
- Jakub
-
+++ /dev/null
---- libstdc++-v3/config/locale/gnu/monetary_members.cc.jj 2002-08-30 12:09:12.000000000 +0200
-+++ libstdc++-v3/config/locale/gnu/monetary_members.cc 2002-08-31 23:41:51.000000000 +0200
-@@ -335,9 +335,13 @@ namespace std
- else
- {
- // Named locale.
-- // XXX Fix me. Switch to named locale so that mbsrtowcs will work.
-+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ __c_locale __old = __uselocale(__cloc);
-+#else
-+ // Switch to named locale so that mbsrtowcs will work.
- char* __old = strdup(setlocale(LC_ALL, NULL));
- setlocale(LC_ALL, __name);
-+#endif
-
- _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w);
-
-@@ -400,9 +404,12 @@ namespace std
- char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
- _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn);
-
-- // XXX
-+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ __uselocale(__old);
-+#else
- setlocale(LC_ALL, __old);
- free(__old);
-+#endif
- }
- }
-
-@@ -427,9 +434,13 @@ namespace std
- else
- {
- // Named locale.
-- // XXX Fix me. Switch to named locale so that mbsrtowcs will work.
-+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ __c_locale __old = __uselocale(__cloc);
-+#else
-+ // Switch to named locale so that mbsrtowcs will work.
- char* __old = strdup(setlocale(LC_ALL, NULL));
- setlocale(LC_ALL, __name);
-+#endif
-
- _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w);
- _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w);
-@@ -491,9 +502,12 @@ namespace std
- char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
- _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn);
-
-- // XXX
-+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-+ __uselocale(__old);
-+#else
- setlocale(LC_ALL, __old);
- free(__old);
-+#endif
- }
- }
+++ /dev/null
-2002-05-31 Jakub Jelinek <jakub@redhat.com>
-
- PR optimization/6842
- * combine.c (combine_simplify_rtx) [SUBREG]: Don't ICE if VOIDmode
- operand subreg cannot be simplified.
-
- * gcc.dg/20020531-1.c: New test.
-
---- gcc/testsuite/gcc.dg/20020531-1.c.jj Fri May 31 17:15:15 2002
-+++ gcc/testsuite/gcc.dg/20020531-1.c Fri May 31 17:13:50 2002
-@@ -0,0 +1,21 @@
-+/* PR optimization/6842
-+ This testcase caused ICE when trying to optimize V8QI subreg of VOIDmode
-+ CONST_DOUBLE. */
-+/* { dg-do compile { target i?86-*-* } } */
-+/* { dg-options "-O2 -mmmx" } */
-+
-+typedef int __v8qi __attribute__ ((__mode__ (__V8QI__)));
-+extern void abort (void);
-+extern void exit (int);
-+
-+void foo (void)
-+{
-+ unsigned long long a = 0x0102030405060708LL;
-+ unsigned long long b = 0x1020304050607080LL;
-+ unsigned long long c;
-+
-+ c = (unsigned long long) __builtin_ia32_paddusb ((__v8qi) a, (__v8qi) b);
-+ __builtin_ia32_emms ();
-+ if (c != 0x1122334455667788)
-+ abort ();
-+}
---- gcc/combine.c.jj Thu May 23 10:22:59 2002
-+++ gcc/combine.c Fri May 31 17:05:09 2002
-@@ -3863,7 +3863,12 @@ combine_simplify_rtx (x, op0_mode, last,
-
- /* simplify_subreg can't use gen_lowpart_for_combine. */
- if (CONSTANT_P (SUBREG_REG (x))
-- && subreg_lowpart_offset (mode, op0_mode) == SUBREG_BYTE (x))
-+ && subreg_lowpart_offset (mode, op0_mode) == SUBREG_BYTE (x)
-+ /* Don't call gen_lowpart_for_combine if the inner mode
-+ is VOIDmode and we cannot simplify it, as SUBREG without
-+ inner mode is invalid. */
-+ && (GET_MODE (SUBREG_REG (x)) != VOIDmode
-+ || gen_lowpart_common (mode, SUBREG_REG (x))))
- return gen_lowpart_for_combine (mode, SUBREG_REG (x));
-
- if (GET_MODE_CLASS (GET_MODE (SUBREG_REG (x))) == MODE_CC)
+++ /dev/null
-2002-05-05 Jakub Jelinek <jakub@redhat.com>
-
- * config/sparc/sparc.md (ashlsi3): If shift count is const1_rtx,
- use add instead of shift.
- (ashldi3_sp64): Likewise.
- (ashlsi3_const1, ashldi3_const1): Remove.
- * config/sparc/sparc.h (PREDICATE_CODES): Add const1_operand.
- * config/sparc/sparc.c (const1_operand): New.
-
---- gcc/config/sparc/sparc.md.jj Sun May 5 21:56:45 2002
-+++ gcc/config/sparc/sparc.md Sun May 5 23:33:31 2002
-@@ -7559,18 +7559,13 @@
- && (unsigned HOST_WIDE_INT) INTVAL (operands[2]) > 31)
- operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
-
-+ if (operands[2] == const1_rtx)
-+ return \"add\\t%1, %1, %0\";
- return \"sll\\t%1, %2, %0\";
- }"
-- [(set_attr "type" "shift")])
--
--;; We special case multiplication by two, as add can be done
--;; in both ALUs, while shift only in IEU0 on UltraSPARC.
--(define_insn "*ashlsi3_const1"
-- [(set (match_operand:SI 0 "register_operand" "=r")
-- (ashift:SI (match_operand:SI 1 "register_operand" "r")
-- (const_int 1)))]
-- ""
-- "add\\t%1, %1, %0")
-+ [(set (attr "type")
-+ (if_then_else (match_operand 2 "const1_operand" "")
-+ (const_string "ialu") (const_string "shift")))])
-
- (define_expand "ashldi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
-@@ -7588,15 +7583,6 @@
- }
- }")
-
--;; We special case multiplication by two, as add can be done
--;; in both ALUs, while shift only in IEU0 on UltraSPARC.
--(define_insn "*ashldi3_const1"
-- [(set (match_operand:DI 0 "register_operand" "=r")
-- (ashift:DI (match_operand:DI 1 "register_operand" "r")
-- (const_int 1)))]
-- "TARGET_ARCH64"
-- "add\\t%1, %1, %0")
--
- (define_insn "*ashldi3_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ashift:DI (match_operand:DI 1 "register_operand" "r")
-@@ -7608,9 +7594,13 @@
- && (unsigned HOST_WIDE_INT) INTVAL (operands[2]) > 63)
- operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
-
-+ if (operands[2] == const1_rtx)
-+ return \"add\\t%1, %1, %0\";
- return \"sllx\\t%1, %2, %0\";
- }"
-- [(set_attr "type" "shift")])
-+ [(set (attr "type")
-+ (if_then_else (match_operand 2 "const1_operand" "")
-+ (const_string "ialu") (const_string "shift")))])
-
- ;; XXX UGH!
- (define_insn "ashldi3_v8plus"
---- gcc/config/sparc/sparc.h.jj Fri May 3 22:57:33 2002
-+++ gcc/config/sparc/sparc.h Sun May 5 23:20:48 2002
-@@ -3014,6 +3014,7 @@ do { \
-
- #define PREDICATE_CODES \
- {"reg_or_0_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE}}, \
-+{"const1_operand", {CONST_INT}}, \
- {"fp_zero_operand", {CONST_DOUBLE}}, \
- {"fp_register_operand", {SUBREG, REG}}, \
- {"intreg_operand", {SUBREG, REG}}, \
---- gcc/config/sparc/sparc.c.jj Fri May 3 22:57:33 2002
-+++ gcc/config/sparc/sparc.c Sun May 5 23:24:18 2002
-@@ -478,6 +478,16 @@ reg_or_0_operand (op, mode)
- return 0;
- }
-
-+/* Return non-zero only if OP is const1_rtx. */
-+
-+int
-+const1_operand (op, mode)
-+ rtx op;
-+ enum machine_mode mode ATTRIBUTE_UNUSED;
-+{
-+ return op == const1_rtx;
-+}
-+
- /* Nonzero if OP is a floating point value with value 0.0. */
-
- int
+++ /dev/null
-2002-06-04 Jakub Jelinek <jakub@redhat.com>
-
- * gcc.c-torture/compile/20020604-1.c: New test.
-
---- gcc/testsuite/gcc.c-torture/compile/20020604-1.c.jj Thu Apr 11 16:25:15 2002
-+++ gcc/testsuite/gcc.c-torture/compile/20020604-1.c Mon Jun 3 17:43:12 2002
-@@ -0,0 +1,86 @@
-+/* This testcase ICEd at -O2 on IA-32, because
-+ (insn 141 139 142 (set (subreg:SF (reg:QI 72) 0)
-+ (plus:SF (reg:SF 73)
-+ (reg:SF 76))) 525 {*fop_sf_comm_nosse} (insn_list 134 (nil))
-+ (expr_list:REG_DEAD (reg:SF 73) (nil)))
-+ couldn't be reloaded. */
-+
-+void
-+foo (unsigned int n, int x, int y, unsigned char *z)
-+{
-+ int a, b;
-+ float c[2048][4];
-+
-+ switch (x)
-+ {
-+ case 0x1906:
-+ a = b = -1;
-+ break;
-+ case 0x190A:
-+ a = b = -1;
-+ break;
-+ case 0x8049:
-+ a = b = -1;
-+ break;
-+ case 0x1907:
-+ a = 1;
-+ b = 2;
-+ break;
-+ default:
-+ return;
-+ }
-+
-+ if (a >= 0)
-+ {
-+ unsigned char *d = z;
-+ unsigned int i;
-+ for (i = 0; i < n; i++)
-+ {
-+ do
-+ {
-+ union
-+ {
-+ float r;
-+ unsigned int i;
-+ }
-+ e;
-+ e.r = c[i][1];
-+ d[a] =
-+ ((e.i >= 0x3f7f0000) ? ((int) e.i <
-+ 0) ? (unsigned char) 0
-+ : (unsigned char) 255 : (e.r =
-+ e.r * (255.0F / 256.0F) +
-+ 32768.0F, (unsigned char) e.i));
-+ }
-+ while (0);
-+ d += y;
-+ }
-+ }
-+
-+ if (b >= 0)
-+ {
-+ unsigned char *d = z;
-+ unsigned int i;
-+ for (i = 0; i < n; i++)
-+ {
-+ do
-+ {
-+ union
-+ {
-+ float r;
-+ unsigned int i;
-+ }
-+ e;
-+ e.r = c[i][2];
-+ d[b] =
-+ ((e.i >= 0x3f7f0000) ? ((int) e.i <
-+ 0) ? (unsigned char) 0
-+ : (unsigned char) 255 : (e.r =
-+ e.r * (255.0F / 256.0F) +
-+ 32768.0F, (unsigned char) e.i));
-+ }
-+ while (0);
-+ d += y;
-+ }
-+ }
-+}
+++ /dev/null
-2002-05-08 Tom Rix <trix@redhat.com>
-
- * gcc.c-torture/execute/20020508-1.c: New test.
- * gcc.c-torture/execute/20020508-2.c: New test.
- * gcc.c-torture/execute/20020508-3.c: New test.
-
---- gcc/testsuite/gcc.c-torture/execute/20020508-1.c.jj Wed May 15 14:22:47 2002
-+++ gcc/testsuite/gcc.c-torture/execute/20020508-1.c Wed May 15 14:22:47 2002
-@@ -0,0 +1,104 @@
-+/* This tests the rotate patterns that some machines support. */
-+
-+#include <limits.h>
-+
-+#ifndef CHAR_BIT
-+#define CHAR_BIT 8
-+#endif
-+
-+#define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * CHAR_BIT) - (b))))
-+#define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b))))
-+
-+#define CHAR_VALUE ((unsigned char)0xf234U)
-+#define SHORT_VALUE ((unsigned short)0xf234U)
-+#define INT_VALUE 0xf234U
-+#define LONG_VALUE 0xf2345678LU
-+#define LL_VALUE 0xf2345678abcdef0LLU
-+
-+#define SHIFT1 4
-+#define SHIFT2 ((sizeof (long long) * CHAR_BIT) - SHIFT1)
-+
-+unsigned char uc = CHAR_VALUE;
-+unsigned short us = SHORT_VALUE;
-+unsigned int ui = INT_VALUE;
-+unsigned long ul = LONG_VALUE;
-+unsigned long long ull = LL_VALUE;
-+int shift1 = SHIFT1;
-+int shift2 = SHIFT2;
-+
-+main ()
-+{
-+ if (ROR (uc, shift1) != ROR (CHAR_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (uc, SHIFT1) != ROR (CHAR_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (us, shift1) != ROR (SHORT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (us, SHIFT1) != ROR (SHORT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (ui, shift1) != ROR (INT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (ui, SHIFT1) != ROR (INT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (ul, shift1) != ROR (LONG_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (ul, SHIFT1) != ROR (LONG_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (ull, shift1) != ROR (LL_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (ull, SHIFT1) != ROR (LL_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (ull, shift2) != ROR (LL_VALUE, SHIFT2))
-+ abort ();
-+
-+ if (ROR (ull, SHIFT2) != ROR (LL_VALUE, SHIFT2))
-+ abort ();
-+
-+ if (ROL (uc, shift1) != ROL (CHAR_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (uc, SHIFT1) != ROL (CHAR_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (us, shift1) != ROL (SHORT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (us, SHIFT1) != ROL (SHORT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (ui, shift1) != ROL (INT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (ui, SHIFT1) != ROL (INT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (ul, shift1) != ROL (LONG_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (ul, SHIFT1) != ROL (LONG_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (ull, shift1) != ROL (LL_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (ull, SHIFT1) != ROL (LL_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (ull, shift2) != ROL (LL_VALUE, SHIFT2))
-+ abort ();
-+
-+ if (ROL (ull, SHIFT2) != ROL (LL_VALUE, SHIFT2))
-+ abort ();
-+
-+ exit (0);
-+}
---- gcc/testsuite/gcc.c-torture/execute/20020508-2.c.jj Wed May 15 14:22:47 2002
-+++ gcc/testsuite/gcc.c-torture/execute/20020508-2.c Wed May 15 14:22:47 2002
-@@ -0,0 +1,102 @@
-+#include <limits.h>
-+
-+#ifndef CHAR_BIT
-+#define CHAR_BIT 8
-+#endif
-+
-+#define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * CHAR_BIT) - (b))))
-+#define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b))))
-+
-+#define CHAR_VALUE ((char)0x1234)
-+#define SHORT_VALUE ((short)0x1234)
-+#define INT_VALUE ((int)0x1234)
-+#define LONG_VALUE ((long)0x12345678L)
-+#define LL_VALUE ((long long)0x12345678abcdef0LL)
-+
-+#define SHIFT1 4
-+#define SHIFT2 ((sizeof (long long) * CHAR_BIT) - SHIFT1)
-+
-+char c = CHAR_VALUE;
-+short s = SHORT_VALUE;
-+int i = INT_VALUE;
-+long l = LONG_VALUE;
-+long long ll = LL_VALUE;
-+int shift1 = SHIFT1;
-+int shift2 = SHIFT2;
-+
-+main ()
-+{
-+ if (ROR (c, shift1) != ROR (CHAR_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (c, SHIFT1) != ROR (CHAR_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (s, shift1) != ROR (SHORT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (s, SHIFT1) != ROR (SHORT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (i, shift1) != ROR (INT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (i, SHIFT1) != ROR (INT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (l, shift1) != ROR (LONG_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (l, SHIFT1) != ROR (LONG_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (ll, shift1) != ROR (LL_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (ll, SHIFT1) != ROR (LL_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (ll, shift2) != ROR (LL_VALUE, SHIFT2))
-+ abort ();
-+
-+ if (ROR (ll, SHIFT2) != ROR (LL_VALUE, SHIFT2))
-+ abort ();
-+
-+ if (ROL (c, shift1) != ROL (CHAR_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (c, SHIFT1) != ROL (CHAR_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (s, shift1) != ROL (SHORT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (s, SHIFT1) != ROL (SHORT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (i, shift1) != ROL (INT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (i, SHIFT1) != ROL (INT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (l, shift1) != ROL (LONG_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (l, SHIFT1) != ROL (LONG_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (ll, shift1) != ROL (LL_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (ll, SHIFT1) != ROL (LL_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (ll, shift2) != ROL (LL_VALUE, SHIFT2))
-+ abort ();
-+
-+ if (ROL (ll, SHIFT2) != ROL (LL_VALUE, SHIFT2))
-+ abort ();
-+
-+ exit (0);
-+}
---- gcc/testsuite/gcc.c-torture/execute/20020508-3.c.jj Wed May 15 14:22:47 2002
-+++ gcc/testsuite/gcc.c-torture/execute/20020508-3.c Wed May 15 14:22:47 2002
-@@ -0,0 +1,102 @@
-+#include <limits.h>
-+
-+#ifndef CHAR_BIT
-+#define CHAR_BIT 8
-+#endif
-+
-+#define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * CHAR_BIT) - (b))))
-+#define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b))))
-+
-+#define CHAR_VALUE ((char)0xf234)
-+#define SHORT_VALUE ((short)0xf234)
-+#define INT_VALUE ((int)0xf234)
-+#define LONG_VALUE ((long)0xf2345678L)
-+#define LL_VALUE ((long long)0xf2345678abcdef0LL)
-+
-+#define SHIFT1 4
-+#define SHIFT2 ((sizeof (long long) * CHAR_BIT) - SHIFT1)
-+
-+char c = CHAR_VALUE;
-+short s = SHORT_VALUE;
-+int i = INT_VALUE;
-+long l = LONG_VALUE;
-+long long ll = LL_VALUE;
-+int shift1 = SHIFT1;
-+int shift2 = SHIFT2;
-+
-+main ()
-+{
-+ if (ROR (c, shift1) != ROR (CHAR_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (c, SHIFT1) != ROR (CHAR_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (s, shift1) != ROR (SHORT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (s, SHIFT1) != ROR (SHORT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (i, shift1) != ROR (INT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (i, SHIFT1) != ROR (INT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (l, shift1) != ROR (LONG_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (l, SHIFT1) != ROR (LONG_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (ll, shift1) != ROR (LL_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (ll, SHIFT1) != ROR (LL_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROR (ll, shift2) != ROR (LL_VALUE, SHIFT2))
-+ abort ();
-+
-+ if (ROR (ll, SHIFT2) != ROR (LL_VALUE, SHIFT2))
-+ abort ();
-+
-+ if (ROL (c, shift1) != ROL (CHAR_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (c, SHIFT1) != ROL (CHAR_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (s, shift1) != ROL (SHORT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (s, SHIFT1) != ROL (SHORT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (i, shift1) != ROL (INT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (i, SHIFT1) != ROL (INT_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (l, shift1) != ROL (LONG_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (l, SHIFT1) != ROL (LONG_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (ll, shift1) != ROL (LL_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (ll, SHIFT1) != ROL (LL_VALUE, SHIFT1))
-+ abort ();
-+
-+ if (ROL (ll, shift2) != ROL (LL_VALUE, SHIFT2))
-+ abort ();
-+
-+ if (ROL (ll, SHIFT2) != ROL (LL_VALUE, SHIFT2))
-+ abort ();
-+
-+ exit (0);
-+}
+++ /dev/null
-2002-08-21 Richard Henderson <rth@redhat.com>
-
- * config/i386/i386-protos.h (i386_output_dwarf_dtprel): Add
- prototype.
- * config/i386/i386.c (i386_output_dwarf_dtprel): New.
- * config/i386/i386.h (ASM_OUTPUT_DWARF_DTPREL): Define.
- * dwarf2.h (DW_OP_GNU_push_tls_address): Add.
- (DW_OP_lo_user): Define to 0xe0.
- * dwarf2out.c (INTERNAL_DW_OP_tls_addr): Define.
- (dwarf_stack_op_name, sizeof_loc_descr): Handle a few more OPs.
- (output_loc_operands): Handle INTERNAL_DW_OP_tls_addr.
- (loc_descriptor_from_tree): Handle DECL_THREAD_LOCAL variables.
- (add_AT_location_description): Pass descr instead of rtl.
- (add_location_or_const_value_attribute, add_bound_info,
- gen_subprogram_die): Adjust its callers.
- (rtl_for_decl_location): Avoid constant pool references.
-
---- gcc/config/i386/i386-protos.h 20 Aug 2002 17:20:36 -0000 1.1.1.1
-+++ gcc/config/i386/i386-protos.h 20 Aug 2002 22:35:02 -0000
-@@ -113,6 +113,7 @@ extern const char *output_fix_trunc PARA
- extern const char *output_fp_compare PARAMS ((rtx, rtx*, int, int));
-
- extern void i386_dwarf_output_addr_const PARAMS ((FILE*, rtx));
-+extern void i386_output_dwarf_dtprel PARAMS ((FILE*, int, rtx));
- extern rtx i386_simplify_dwarf_addr PARAMS ((rtx));
-
- extern void ix86_expand_clear PARAMS ((rtx));
---- gcc/config/i386/i386.c 20 Aug 2002 17:20:36 -0000 1.1.1.1
-+++ gcc/config/i386/i386.c 20 Aug 2002 22:35:02 -0000
-@@ -5921,6 +5921,33 @@ i386_dwarf_output_addr_const (file, x)
- fputc ('\n', file);
- }
-
-+/* This is called from dwarf2out.c via ASM_OUTPUT_DWARF_DTPREL.
-+ We need to emit DTP-relative relocations. */
-+
-+void
-+i386_output_dwarf_dtprel (file, size, x)
-+ FILE *file;
-+ int size;
-+ rtx x;
-+{
-+ switch (size)
-+ {
-+ case 4:
-+ fputs (ASM_LONG, file);
-+ break;
-+ case 8:
-+#ifdef ASM_QUAD
-+ fputs (ASM_QUAD, file);
-+ break;
-+#endif
-+ default:
-+ abort ();
-+ }
-+
-+ output_addr_const (file, x);
-+ fputs ("@DTPOFF", file);
-+}
-+
- /* In the name of slightly smaller debug output, and to cater to
- general assembler losage, recognize PIC+GOTOFF and turn it back
- into a direct symbol reference. */
---- gcc/config/i386/i386.h 20 Aug 2002 17:20:36 -0000 1.1.1.1
-+++ gcc/config/i386/i386.h 20 Aug 2002 22:35:02 -0000
-@@ -2899,6 +2899,13 @@ extern int const svr4_dbx_register_map[F
- #define ASM_SIMPLIFY_DWARF_ADDR(X) \
- i386_simplify_dwarf_addr (X)
-
-+/* Emit a dtp-relative reference to a TLS variable. */
-+
-+#ifdef HAVE_AS_TLS
-+#define ASM_OUTPUT_DWARF_DTPREL(FILE, SIZE, X) \
-+ i386_output_dwarf_dtprel (FILE, SIZE, X)
-+#endif
-+
- /* Switch to init or fini section via SECTION_OP, emit a call to FUNC,
- and switch back. For x86 we do this only to save a few bytes that
- would otherwise be unused in the text section. */
---- gcc/dwarf2.h 20 Aug 2002 17:20:19 -0000 1.1.1.1
-+++ gcc/dwarf2.h 20 Aug 2002 22:35:02 -0000
-@@ -399,10 +399,12 @@ enum dwarf_location_atom
- DW_OP_push_object_address = 0x97,
- DW_OP_call2 = 0x98,
- DW_OP_call4 = 0x99,
-- DW_OP_calli = 0x9a
-+ DW_OP_call_ref = 0x9a,
-+ /* GNU extensions. */
-+ DW_OP_GNU_push_tls_address = 0xe0
- };
-
--#define DW_OP_lo_user 0x80 /* Implementation-defined range start. */
-+#define DW_OP_lo_user 0xe0 /* Implementation-defined range start. */
- #define DW_OP_hi_user 0xff /* Implementation-defined range end. */
-
- /* Type encodings. */
---- gcc/dwarf2out.c 20 Aug 2002 17:20:19 -0000 1.1.1.1
-+++ gcc/dwarf2out.c 20 Aug 2002 22:40:42 -0000
-@@ -2169,6 +2169,11 @@ dwarf2out_frame_finish ()
- /* And now, the subset of the debugging information support code necessary
- for emitting location expressions. */
-
-+/* We need some way to distinguish DW_OP_addr with a direct symbol
-+ relocation from DW_OP_addr with a dtp-relative symbol relocation. */
-+#define INTERNAL_DW_OP_tls_addr (0x100 + DW_OP_addr)
-+
-+
- typedef struct dw_val_struct *dw_val_ref;
- typedef struct die_struct *dw_die_ref;
- typedef struct dw_loc_descr_struct *dw_loc_descr_ref;
-@@ -2294,6 +2299,7 @@ dwarf_stack_op_name (op)
- switch (op)
- {
- case DW_OP_addr:
-+ case INTERNAL_DW_OP_tls_addr:
- return "DW_OP_addr";
- case DW_OP_deref:
- return "DW_OP_deref";
-@@ -2583,6 +2589,16 @@ dwarf_stack_op_name (op)
- return "DW_OP_xderef_size";
- case DW_OP_nop:
- return "DW_OP_nop";
-+ case DW_OP_push_object_address:
-+ return "DW_OP_push_object_address";
-+ case DW_OP_call2:
-+ return "DW_OP_call2";
-+ case DW_OP_call4:
-+ return "DW_OP_call4";
-+ case DW_OP_call_ref:
-+ return "DW_OP_call_ref";
-+ case DW_OP_GNU_push_tls_address:
-+ return "DW_OP_GNU_push_tls_address";
- default:
- return "OP_<unknown>";
- }
-@@ -2640,6 +2656,7 @@ size_of_loc_descr (loc)
- switch (loc->dw_loc_opc)
- {
- case DW_OP_addr:
-+ case INTERNAL_DW_OP_tls_addr:
- size += DWARF2_ADDR_SIZE;
- break;
- case DW_OP_const1u:
-@@ -2725,6 +2742,15 @@ size_of_loc_descr (loc)
- case DW_OP_xderef_size:
- size += 1;
- break;
-+ case DW_OP_call2:
-+ size += 2;
-+ break;
-+ case DW_OP_call4:
-+ size += 4;
-+ break;
-+ case DW_OP_call_ref:
-+ size += DWARF2_ADDR_SIZE;
-+ break;
- default:
- break;
- }
-@@ -2874,6 +2900,17 @@ output_loc_operands (loc)
- case DW_OP_xderef_size:
- dw2_asm_output_data (1, val1->v.val_int, NULL);
- break;
-+
-+ case INTERNAL_DW_OP_tls_addr:
-+#ifdef ASM_OUTPUT_DWARF_DTPREL
-+ ASM_OUTPUT_DWARF_DTPREL (asm_out_file, DWARF2_ADDR_SIZE,
-+ val1->v.val_addr);
-+ fputc ('\n', asm_out_file);
-+#else
-+ abort ();
-+#endif
-+ break;
-+
- default:
- /* Other codes have no operands. */
- break;
-@@ -3598,7 +3635,8 @@ static unsigned int simple_field_decl_al
- static unsigned HOST_WIDE_INT simple_type_size_in_bits PARAMS ((tree));
- static HOST_WIDE_INT field_byte_offset PARAMS ((tree));
- static void add_AT_location_description PARAMS ((dw_die_ref,
-- enum dwarf_attribute, rtx));
-+ enum dwarf_attribute,
-+ dw_loc_descr_ref));
- static void add_data_member_location_attribute PARAMS ((dw_die_ref, tree));
- static void add_const_value_attribute PARAMS ((dw_die_ref, rtx));
- static rtx rtl_for_decl_location PARAMS ((tree));
-@@ -8031,6 +8069,41 @@ loc_descriptor_from_tree (loc, addressp)
- : 0);
-
- case VAR_DECL:
-+ if (DECL_THREAD_LOCAL (loc))
-+ {
-+ rtx rtl;
-+
-+#ifndef ASM_OUTPUT_DWARF_DTPREL
-+ /* If this is not defined, we have no way to emit the data. */
-+ return 0;
-+#endif
-+ /* The way DW_OP_GNU_push_tls_address is specified, we can only
-+ look up addresses of objects in the current module. */
-+ if (DECL_P (loc) && TREE_PUBLIC (loc) && !MODULE_LOCAL_P (loc))
-+ return 0;
-+
-+ rtl = rtl_for_decl_location (loc);
-+ if (rtl == NULL_RTX)
-+ return 0;
-+
-+ if (GET_CODE (rtl) != MEM)
-+ return 0;
-+ rtl = XEXP (rtl, 0);
-+ if (! CONSTANT_P (rtl))
-+ return 0;
-+
-+ ret = new_loc_descr (INTERNAL_DW_OP_tls_addr, 0, 0);
-+ ret->dw_loc_oprnd1.val_class = dw_val_class_addr;
-+ ret->dw_loc_oprnd1.v.val_addr = rtl;
-+
-+ ret1 = new_loc_descr (DW_OP_GNU_push_tls_address, 0, 0);
-+ add_loc_descr (&ret, ret1);
-+
-+ indirect_p = 1;
-+ break;
-+ }
-+ /* FALLTHRU */
-+
- case PARM_DECL:
- {
- rtx rtl = rtl_for_decl_location (loc);
-@@ -8531,14 +8604,12 @@ field_byte_offset (decl)
- whole parameters. Note that the location attributes for struct fields are
- generated by the routine `data_member_location_attribute' below. */
-
--static void
--add_AT_location_description (die, attr_kind, rtl)
-+static inline void
-+add_AT_location_description (die, attr_kind, descr)
- dw_die_ref die;
- enum dwarf_attribute attr_kind;
-- rtx rtl;
-+ dw_loc_descr_ref descr;
- {
-- dw_loc_descr_ref descr = loc_descriptor (rtl);
--
- if (descr != 0)
- add_AT_loc (die, attr_kind, descr);
- }
-@@ -8963,6 +9034,13 @@ rtl_for_decl_location (decl)
- if (rtl)
- rtl = ASM_SIMPLIFY_DWARF_ADDR (rtl);
- #endif
-+
-+ /* If we don't look past the constant pool, we risk emitting a
-+ reference to a constant pool entry that isn't referenced from
-+ code, and thus is not emitted. */
-+ if (rtl)
-+ rtl = avoid_constant_pool_reference (rtl);
-+
- return rtl;
- }
-
-@@ -8983,6 +9061,7 @@ add_location_or_const_value_attribute (d
- tree decl;
- {
- rtx rtl;
-+ dw_loc_descr_ref descr;
-
- if (TREE_CODE (decl) == ERROR_MARK)
- return;
-@@ -8993,16 +9072,11 @@ add_location_or_const_value_attribute (d
- if (rtl == NULL_RTX)
- return;
-
-- /* If we don't look past the constant pool, we risk emitting a
-- reference to a constant pool entry that isn't referenced from
-- code, and thus is not emitted. */
-- rtl = avoid_constant_pool_reference (rtl);
--
- switch (GET_CODE (rtl))
- {
- case ADDRESSOF:
-- /* The address of a variable that was optimized away; don't emit
-- anything. */
-+ /* The address of a variable that was optimized away;
-+ don't emit anything. */
- break;
-
- case CONST_INT:
-@@ -9017,12 +9091,24 @@ add_location_or_const_value_attribute (d
- break;
-
- case MEM:
-- case REG:
-- case SUBREG:
-- case CONCAT:
-- add_AT_location_description (die, DW_AT_location, rtl);
-+ if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl))
-+ {
-+ /* Need loc_descriptor_from_tree since that's where we know
-+ how to handle TLS variables. Want the object's address
-+ since the top-level DW_AT_location assumes such. See
-+ the confusion in loc_descriptor for reference. */
-+ descr = loc_descriptor_from_tree (decl, 1);
-+ }
-+ else
-+ {
-+ case REG:
-+ case SUBREG:
-+ case CONCAT:
-+ descr = loc_descriptor (rtl);
-+ }
-+ add_AT_location_description (die, DW_AT_location, descr);
- break;
--
-+
- default:
- abort ();
- }
-@@ -9154,7 +9240,8 @@ add_bound_info (subrange_die, bound_attr
-
- add_AT_flag (decl_die, DW_AT_artificial, 1);
- add_type_attribute (decl_die, TREE_TYPE (bound), 1, 0, ctx);
-- add_AT_location_description (decl_die, DW_AT_location, loc);
-+ add_AT_location_description (decl_die, DW_AT_location,
-+ loc_descriptor (loc));
- add_AT_die_ref (subrange_die, bound_attr, decl_die);
- }
-
-@@ -10359,7 +10446,7 @@ gen_subprogram_die (decl, context_die)
- is not part of the state saved/restored for inline functions. */
- if (current_function_needs_context)
- add_AT_location_description (subr_die, DW_AT_static_link,
-- lookup_static_chain (decl));
-+ loc_descriptor (lookup_static_chain (decl)));
- #endif
- }
-
+++ /dev/null
---- gcc/cp/lex.c.jj Sat May 25 00:02:23 2002
-+++ gcc/cp/lex.c Wed Jun 19 19:33:51 2002
-@@ -396,6 +396,7 @@ static const struct resword reswords[] =
- { "__restrict__", RID_RESTRICT, 0 },
- { "__signed", RID_SIGNED, 0 },
- { "__signed__", RID_SIGNED, 0 },
-+ { "__thread", RID_THREAD, 0 },
- { "__typeof", RID_TYPEOF, 0 },
- { "__typeof__", RID_TYPEOF, 0 },
- { "__volatile", RID_VOLATILE, 0 },
-@@ -502,6 +503,7 @@ const short rid_to_yy[RID_MAX] =
- /* RID_BOUNDED */ 0,
- /* RID_UNBOUNDED */ 0,
- /* RID_COMPLEX */ TYPESPEC,
-+ /* RID_THREAD */ SCSPEC,
-
- /* C++ */
- /* RID_FRIEND */ SCSPEC,
---- gcc/cp/decl.c.jj Wed Jun 19 19:33:51 2002
-+++ gcc/cp/decl.c Wed Jun 19 19:33:51 2002
-@@ -7122,7 +7122,8 @@ check_tag_decl (declspecs)
- || value == ridpointers[(int) RID_VIRTUAL]
- || value == ridpointers[(int) RID_CONST]
- || value == ridpointers[(int) RID_VOLATILE]
-- || value == ridpointers[(int) RID_EXPLICIT])
-+ || value == ridpointers[(int) RID_EXPLICIT]
-+ || value == ridpointers[(int) RID_THREAD])
- ob_modifier = value;
- }
-
-@@ -7596,6 +7597,12 @@ static tree
- obscure_complex_init (decl, init)
- tree decl, init;
- {
-+ if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl))
-+ {
-+ error ("run-time initialization of thread-local storage");
-+ return NULL_TREE;
-+ }
-+
- if (! flag_no_inline && TREE_STATIC (decl))
- {
- if (extract_init (decl, init))
-@@ -9290,6 +9297,16 @@ grokvardecl (type, declarator, specbits_
- TREE_PUBLIC (decl) = DECL_EXTERNAL (decl);
- }
-
-+ if (RIDBIT_SETP (RID_THREAD, specbits))
-+ {
-+ if (targetm.have_tls)
-+ DECL_THREAD_LOCAL (decl) = 1;
-+ else
-+ /* A mere warning is sure to result in improper semantics
-+ at runtime. Don't bother to allow this to compile. */
-+ error ("thread-local storage not supported for this target");
-+ }
-+
- if (TREE_PUBLIC (decl))
- {
- /* [basic.link]: A name with no linkage (notably, the name of a class
-@@ -10192,10 +10209,22 @@ grokdeclarator (declarator, declspecs, d
- }
- else if (RIDBIT_SETP (i, specbits))
- pedwarn ("duplicate `%s'", IDENTIFIER_POINTER (id));
-+
-+ /* Diagnose "__thread extern". Recall that this list
-+ is in the reverse order seen in the text. */
-+ if (i == (int)RID_THREAD)
-+ {
-+ if (RIDBIT_SETP (RID_EXTERN, specbits))
-+ error ("`__thread' before `extern'");
-+ if (RIDBIT_SETP (RID_STATIC, specbits))
-+ error ("`__thread' before `static'");
-+ }
-+
- if (i == (int)RID_EXTERN
- && TREE_PURPOSE (spec) == error_mark_node)
- /* This extern was part of a language linkage. */
- extern_langp = 1;
-+
- RIDBIT_SET (i, specbits);
- goto found;
- }
-@@ -10492,6 +10521,7 @@ grokdeclarator (declarator, declspecs, d
- {
- if (RIDBIT_SETP (RID_STATIC, specbits)) nclasses++;
- if (RIDBIT_SETP (RID_EXTERN, specbits) && !extern_langp) nclasses++;
-+ if (RIDBIT_SETP (RID_THREAD, specbits)) nclasses++;
- if (decl_context == PARM && nclasses > 0)
- error ("storage class specifiers invalid in parameter declarations");
- if (RIDBIT_SETP (RID_TYPEDEF, specbits))
-@@ -10523,6 +10553,13 @@ grokdeclarator (declarator, declspecs, d
- /* Warn about storage classes that are invalid for certain
- kinds of declarations (parameters, typenames, etc.). */
-
-+ /* "static __thread" and "extern __thread" are allowed. */
-+ if (nclasses == 2
-+ && RIDBIT_SETP (RID_THREAD, specbits)
-+ && (RIDBIT_SETP (RID_EXTERN, specbits)
-+ || RIDBIT_SETP (RID_STATIC, specbits)))
-+ nclasses = 1;
-+
- if (nclasses > 1)
- error ("multiple storage classes in declaration of `%s'", name);
- else if (decl_context != NORMAL && nclasses > 0)
-@@ -10578,6 +10615,7 @@ grokdeclarator (declarator, declspecs, d
- RIDBIT_RESET (RID_REGISTER, specbits);
- RIDBIT_RESET (RID_AUTO, specbits);
- RIDBIT_RESET (RID_EXTERN, specbits);
-+ RIDBIT_RESET (RID_THREAD, specbits);
- }
- }
- else if (RIDBIT_SETP (RID_EXTERN, specbits) && initialized && !funcdef_flag)
-@@ -10600,6 +10638,14 @@ grokdeclarator (declarator, declspecs, d
- if (RIDBIT_SETP (RID_AUTO, specbits))
- error ("top-level declaration of `%s' specifies `auto'", name);
- }
-+ else if (RIDBIT_SETP (RID_THREAD, specbits)
-+ && !RIDBIT_SETP (RID_EXTERN, specbits)
-+ && !RIDBIT_SETP (RID_STATIC, specbits))
-+ {
-+ error ("function-scope `%s' implicitly auto and declared `__thread'",
-+ name);
-+ RIDBIT_RESET (RID_THREAD, specbits);
-+ }
-
- if (nclasses > 0 && friendp)
- error ("storage class specifiers invalid in friend function declarations");
-@@ -11800,6 +11846,8 @@ friend declaration requires class-key, i
- error ("storage class `auto' invalid for function `%s'", name);
- else if (RIDBIT_SETP (RID_REGISTER, specbits))
- error ("storage class `register' invalid for function `%s'", name);
-+ else if (RIDBIT_SETP (RID_THREAD, specbits))
-+ error ("storage class `__thread' invalid for function `%s'", name);
-
- /* Function declaration not at top level.
- Storage classes other than `extern' are not allowed
---- gcc/doc/extend.texi.jj Wed Jun 19 19:33:51 2002
-+++ gcc/doc/extend.texi Wed Jun 19 19:33:51 2002
-@@ -432,6 +432,7 @@ extensions, accepted by GCC in C89 mode
- * Target Builtins:: Built-in functions specific to particular targets.
- * Pragmas:: Pragmas accepted by GCC.
- * Unnamed Fields:: Unnamed struct/union fields within structs/unions.
-+* Thread-Local:: Per-thread variables.
- @end menu
-
- @node Statement Exprs
-@@ -6119,6 +6120,265 @@ It is ambiguous which @code{a} is being
- Such constructs are not supported and must be avoided. In the future,
- such constructs may be detected and treated as compilation errors.
-
-+@node Thread-Local
-+@section Thread-Local Storage
-+@cindex Thread-Local Storage
-+@cindex TLS
-+@cindex __thread
-+
-+Thread-local storage (@acronym{TLS}) is a mechanism by which variables
-+are allocated such that there is one instance of the variable per extant
-+thread. The run-time model GCC uses to implement this originates
-+in the IA-64 processor-specific ABI, but has since been migrated
-+to other processors as well. It requires significant support from
-+the linker (@command{ld}), dynamic linker (@command{ld.so}), and
-+system libraries (@file{libc.so} and @file{libpthread.so}), so it
-+is not available everywhere.
-+
-+At the user level, the extension is visible with a new storage
-+class keyword: @code{__thread}. For example:
-+
-+@example
-+__thread int i;
-+extern __thread struct state s;
-+static __thread char *p;
-+@end example
-+
-+The @code{__thread} specifier may be used alone, with the @code{extern}
-+or @code{static} specifiers, but with no other storage class specifier.
-+When used with @code{extern} or @code{static}, @code{__thread} must appear
-+immediately after the other storage class specifier.
-+
-+The @code{__thread} specifier may be applied to any global, file-scoped
-+static, function-scoped static, or static data member of a class. It may
-+not be applied to block-scoped automatic or non-static data member.
-+
-+When the address-of operator is applied to a thread-local variable, it is
-+evaluated at run-time and returns the address of the current thread's
-+instance of that variable. An address so obtained may be used by any
-+thread. When a thread terminates, any pointers to thread-local variables
-+in that thread become invalid.
-+
-+No static initialization may refer to the address of a thread-local variable.
-+
-+In C++, if an initializer is present for a thread-local variable, it must
-+be a @var{constant-expression}, as defined in 5.19.2 of the ANSI/ISO C++
-+standard.
-+
-+See @uref{http://people.redhat.com/drepper/tls.pdf,
-+ELF Handling For Thread-Local Storage} for a detailed explanation of
-+the four thread-local storage addressing models, and how the run-time
-+is expected to function.
-+
-+@menu
-+* C99 Thread-Local Edits::
-+* C++98 Thread-Local Edits::
-+@end menu
-+
-+@node C99 Thread-Local Edits
-+@subsection ISO/IEC 9899:1999 Edits for Thread-Local Storage
-+
-+The following are a set of changes to ISO/IEC 9899:1999 (aka C99)
-+that document the exact semantics of the language extension.
-+
-+@itemize @bullet
-+@item
-+@cite{5.1.2 Execution environments}
-+
-+Add new text after paragraph 1
-+
-+@quotation
-+Within either execution environment, a @dfn{thread} is a flow of
-+control within a program. It is implementation defined whether
-+or not there may be more than one thread associated with a program.
-+It is implementation defined how threads beyond the first are
-+created, the name and type of the function called at thread
-+startup, and how threads may be terminated. However, objects
-+with thread storage duration shall be initialized before thread
-+startup.
-+@end quotation
-+
-+@item
-+@cite{6.2.4 Storage durations of objects}
-+
-+Add new text before paragraph 3
-+
-+@quotation
-+An object whose identifier is declared with the storage-class
-+specifier @w{@code{__thread}} has @dfn{thread storage duration}.
-+Its lifetime is the entire execution of the thread, and its
-+stored value is initialized only once, prior to thread startup.
-+@end quotation
-+
-+@item
-+@cite{6.4.1 Keywords}
-+
-+Add @code{__thread}.
-+
-+@item
-+@cite{6.7.1 Storage-class specifiers}
-+
-+Add @code{__thread} to the list of storage class specifiers in
-+paragraph 1.
-+
-+Change paragraph 2 to
-+
-+@quotation
-+With the exception of @code{__thread}, at most one storage-class
-+specifier may be given [@dots{}]. The @code{__thread} specifier may
-+be used alone, or immediately following @code{extern} or
-+@code{static}.
-+@end quotation
-+
-+Add new text after paragraph 6
-+
-+@quotation
-+The declaration of an identifier for a variable that has
-+block scope that specifies @code{__thread} shall also
-+specify either @code{extern} or @code{static}.
-+
-+The @code{__thread} specifier shall be used only with
-+variables.
-+@end quotation
-+@end itemize
-+
-+@node C++98 Thread-Local Edits
-+@subsection ISO/IEC 14882:1998 Edits for Thread-Local Storage
-+
-+The following are a set of changes to ISO/IEC 14882:1998 (aka C++98)
-+that document the exact semantics of the language extension.
-+
-+@itemize @bullet
-+@b{[intro.execution]}
-+
-+New text after paragraph 4
-+
-+@quotation
-+A @dfn{thread} is a flow of control within the abstract machine.
-+It is implementation defined whether or not there may be more than
-+one thread.
-+@end quotation
-+
-+New text after paragraph 7
-+
-+@quotation
-+It is unspecified whether additional action must be taken to
-+ensure when and whether side effects are visible to other threads.
-+@end quotation
-+
-+@item
-+@b{[lex.key]}
-+
-+Add @code{__thread}.
-+
-+@item
-+@b{[basic.start.main]}
-+
-+Add after paragraph 5
-+
-+@quotation
-+The thread that begins execution at the @code{main} function is called
-+the @dfn{main thread}. It is implementation defined how functions
-+beginning threads other than the main thread are designated or typed.
-+A function so designated, as well as the @code{main} function, is called
-+a @dfn{thread startup function}. It is implementation defined what
-+happens if a thread startup function returns. It is implementation
-+defined what happens to other threads when any thread calls @code{exit}.
-+@end quotation
-+
-+@item
-+@b{[basic.start.init]}
-+
-+Add after paragraph 4
-+
-+@quotation
-+The storage for an object of thread storage duration shall be
-+staticly initialized before the first statement of the thread startup
-+function. An object of thread storage duration shall not require
-+dynamic initialization.
-+@end quotation
-+
-+@item
-+@b{[basic.start.term]}
-+
-+Add after paragraph 3
-+
-+@quotation
-+The type of an object with thread storage duration shall not have a
-+non-trivial destructor, nor shall it be an array type whose elements
-+(directly or indirectly) have non-trivial destructors.
-+@end quotation
-+
-+@item
-+@b{[basic.stc]}
-+
-+Add ``thread storage duration'' to the list in paragraph 1.
-+
-+Change paragraph 2
-+
-+@quotation
-+Thread, static, and automatic storage durations are associated with
-+objects introduced by declarations [@dots{}].
-+@end quotation
-+
-+Add @code{__thread} to the list of specifiers in paragraph 3.
-+
-+@item
-+@b{[basic.stc.thread]}
-+
-+New section before @b{[basic.stc.static]}
-+
-+@quotation
-+The keyword @code{__thread} applied to an non-local object gives the
-+object thread storage duration.
-+
-+A local variable or class data member declared both @code{static}
-+and @code{__thread} gives the variable or member thread storage
-+duration.
-+@end quotation
-+
-+@item
-+@b{[basic.stc.static]}
-+
-+Change paragraph 1
-+
-+@quotation
-+All objects which have neither thread storage duration, dynamic
-+storage duration nor are local [@dots{}].
-+@end quotation
-+
-+@item
-+@b{[dcl.stc]}
-+
-+Add @code{__thread} to the list in paragraph 1.
-+
-+Change paragraph 1
-+
-+@quotation
-+With the exception of @code{__thread}, at most one
-+@var{storage-class-specifier} shall appear in a given
-+@var{decl-specifier-seq}. The @code{__thread} specifier may
-+be used alone, or immediately following the @code{extern} or
-+@code{static} specifiers. [@dots{}]
-+@end quotation
-+
-+Add after paragraph 5
-+
-+@quotation
-+The @code{__thread} specifier can be applied only to the names of objects
-+and to anonymous unions.
-+@end quotation
-+
-+@item
-+@b{[class.mem]}
-+
-+Add after paragraph 6
-+
-+@quotation
-+Non-@code{static} members shall not be @code{__thread}.
-+@end quotation
-+@end itemize
-+
- @node C++ Extensions
- @chapter Extensions to the C++ Language
- @cindex extensions, C++ language
---- gcc/doc/invoke.texi.jj Tue May 21 20:27:44 2002
-+++ gcc/doc/invoke.texi Wed Jun 19 19:33:52 2002
-@@ -674,7 +674,7 @@ in the following sections.
- -fverbose-asm -fpack-struct -fstack-check @gol
- -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
- -fargument-alias -fargument-noalias @gol
---fargument-noalias-global -fleading-underscore}
-+-fargument-noalias-global -fleading-underscore -ftls-model=@var{model}}
- @end table
-
- @menu
-@@ -9988,6 +9988,14 @@
- generate code that is not binary compatible with code generated without that
- switch. Use it to conform to a non-default application binary interface.
- Not all targets provide complete support for this switch.
-+
-+@item -ftls-model=@var{model}
-+Alter the thread-local storage model to be used (@pxref{Thread-Local}).
-+The @var{model} argument should be one of @code{global-dynamic},
-+@code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
-+
-+The default without @option{-fpic} is @code{initial-exec}; with
-+@option{-fpic} the default is @code{global-dynamic}.
- @end table
-
- @c man end
---- gcc/config/i386/i386.c.jj Wed Jun 19 19:33:51 2002
-+++ gcc/config/i386/i386.c Wed Jun 19 23:18:18 2002
-@@ -536,6 +536,10 @@ int const svr4_dbx_register_map[FIRST_PS
- rtx ix86_compare_op0 = NULL_RTX;
- rtx ix86_compare_op1 = NULL_RTX;
-
-+/* The encoding characters for the four TLS models present in ELF. */
-+
-+static char const tls_model_chars[] = " GLil";
-+
- #define MAX_386_STACK_LOCALS 3
- /* Size of the register save area. */
- #define X86_64_VARARGS_SIZE (REGPARM_MAX * UNITS_PER_WORD + SSE_REGPARM_MAX * 16)
-@@ -544,6 +548,7 @@ rtx ix86_compare_op1 = NULL_RTX;
- struct machine_function
- {
- rtx stack_locals[(int) MAX_MACHINE_MODE][MAX_386_STACK_LOCALS];
-+ const char *some_ld_name;
- int save_varrargs_registers;
- int accesses_prev_frame;
- };
-@@ -596,6 +601,9 @@ enum cmodel ix86_cmodel;
- /* Asm dialect. */
- const char *ix86_asm_string;
- enum asm_dialect ix86_asm_dialect = ASM_ATT;
-+/* TLS dialext. */
-+const char *ix86_tls_dialect_string;
-+enum tls_dialect ix86_tls_dialect = TLS_DIALECT_GNU;
-
- /* which cpu are we scheduling for */
- enum processor_type ix86_cpu;
-@@ -646,12 +654,17 @@ static char internal_label_prefix[16];
- static int internal_label_prefix_len;
- \f
- static int local_symbolic_operand PARAMS ((rtx, enum machine_mode));
-+static int tls_symbolic_operand_1 PARAMS ((rtx, enum tls_model));
- static void output_pic_addr_const PARAMS ((FILE *, rtx, int));
- static void put_condition_code PARAMS ((enum rtx_code, enum machine_mode,
- int, int, FILE *));
-+static const char *get_some_local_dynamic_name PARAMS ((void));
-+static int get_some_local_dynamic_name_1 PARAMS ((rtx *, void *));
-+static rtx maybe_get_pool_constant PARAMS ((rtx));
- static rtx ix86_expand_int_compare PARAMS ((enum rtx_code, rtx, rtx));
- static enum rtx_code ix86_prepare_fp_compare_args PARAMS ((enum rtx_code,
- rtx *, rtx *));
-+static rtx get_thread_pointer PARAMS ((void));
- static rtx gen_push PARAMS ((rtx));
- static int memory_address_length PARAMS ((rtx addr));
- static int ix86_flags_dependant PARAMS ((rtx, rtx, enum attr_type));
-@@ -820,6 +833,11 @@ static enum x86_64_reg_class merge_class
- #undef TARGET_SCHED_REORDER
- #define TARGET_SCHED_REORDER ix86_sched_reorder
-
-+#ifdef HAVE_AS_TLS
-+#undef TARGET_HAVE_TLS
-+#define TARGET_HAVE_TLS true
-+#endif
-+
- struct gcc_target targetm = TARGET_INITIALIZER;
- \f
- /* Sometimes certain combinations of command options do not make
-@@ -1109,6 +1127,17 @@ override_options ()
- ix86_branch_cost = i;
- }
-
-+ if (ix86_tls_dialect_string)
-+ {
-+ if (strcmp (ix86_tls_dialect_string, "gnu") == 0)
-+ ix86_tls_dialect = TLS_DIALECT_GNU;
-+ else if (strcmp (ix86_tls_dialect_string, "sun") == 0)
-+ ix86_tls_dialect = TLS_DIALECT_SUN;
-+ else
-+ error ("bad value (%s) for -mtls-dialect= switch",
-+ ix86_tls_dialect_string);
-+ }
-+
- /* Keep nonleaf frame pointers. */
- if (TARGET_OMIT_LEAF_FRAME_POINTER)
- flag_omit_frame_pointer = 1;
-@@ -3007,6 +3036,70 @@ local_symbolic_operand (op, mode)
- return 0;
- }
-
-+/* Test for various thread-local symbols. See ix86_encode_section_info. */
-+
-+int
-+tls_symbolic_operand (op, mode)
-+ register rtx op;
-+ enum machine_mode mode ATTRIBUTE_UNUSED;
-+{
-+ const char *symbol_str;
-+
-+ if (GET_CODE (op) != SYMBOL_REF)
-+ return 0;
-+ symbol_str = XSTR (op, 0);
-+
-+ if (symbol_str[0] != '%')
-+ return 0;
-+ return strchr (tls_model_chars, symbol_str[1]) - tls_model_chars;
-+}
-+
-+static int
-+tls_symbolic_operand_1 (op, kind)
-+ rtx op;
-+ enum tls_model kind;
-+{
-+ const char *symbol_str;
-+
-+ if (GET_CODE (op) != SYMBOL_REF)
-+ return 0;
-+ symbol_str = XSTR (op, 0);
-+
-+ return symbol_str[0] == '%' && symbol_str[1] == tls_model_chars[kind];
-+}
-+
-+int
-+global_dynamic_symbolic_operand (op, mode)
-+ register rtx op;
-+ enum machine_mode mode ATTRIBUTE_UNUSED;
-+{
-+ return tls_symbolic_operand_1 (op, TLS_MODEL_GLOBAL_DYNAMIC);
-+}
-+
-+int
-+local_dynamic_symbolic_operand (op, mode)
-+ register rtx op;
-+ enum machine_mode mode ATTRIBUTE_UNUSED;
-+{
-+ return tls_symbolic_operand_1 (op, TLS_MODEL_LOCAL_DYNAMIC);
-+}
-+
-+int
-+initial_exec_symbolic_operand (op, mode)
-+ register rtx op;
-+ enum machine_mode mode ATTRIBUTE_UNUSED;
-+{
-+ return tls_symbolic_operand_1 (op, TLS_MODEL_INITIAL_EXEC);
-+}
-+
-+int
-+local_exec_symbolic_operand (op, mode)
-+ register rtx op;
-+ enum machine_mode mode ATTRIBUTE_UNUSED;
-+{
-+ return tls_symbolic_operand_1 (op, TLS_MODEL_LOCAL_EXEC);
-+}
-+
- /* Test for a valid operand for a call instruction. Don't allow the
- arg pointer register or virtual regs since they may decay into
- reg + const, which the patterns can't handle. */
-@@ -3858,7 +3951,7 @@ ix86_asm_file_end (file)
- {
- rtx xops[2];
-
-- if (! TARGET_DEEP_BRANCH_PREDICTION || pic_label_name[0] == 0)
-+ if (pic_label_name[0] == 0)
- return;
-
- /* The trick here is to create a linkonce section containing the
-@@ -3896,17 +3989,33 @@ ix86_asm_file_end (file)
- output_asm_insn ("ret", xops);
- }
-
--void
--load_pic_register ()
-+/* Emit code for the SET_GOT patterns. */
-+
-+const char *
-+output_set_got (dest)
-+ rtx dest;
- {
-- rtx gotsym, pclab;
-+ rtx xops[3];
-
-- if (TARGET_64BIT)
-- abort ();
-+ xops[0] = dest;
-+ xops[1] = gen_rtx_SYMBOL_REF (Pmode, "_GLOBAL_OFFSET_TABLE_");
-+
-+ if (! TARGET_DEEP_BRANCH_PREDICTION || !flag_pic)
-+ {
-+ xops[2] = gen_rtx_LABEL_REF (Pmode, gen_label_rtx ());
-+
-+ if (!flag_pic)
-+ output_asm_insn ("mov{l}\t{%2, %0|%0, %2}", xops);
-+ else
-+ output_asm_insn ("call\t%a2", xops);
-
-- gotsym = gen_rtx_SYMBOL_REF (Pmode, "_GLOBAL_OFFSET_TABLE_");
-+ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
-+ CODE_LABEL_NUMBER (XEXP (xops[2], 0)));
-
-- if (TARGET_DEEP_BRANCH_PREDICTION)
-+ if (flag_pic)
-+ output_asm_insn ("pop{l}\t%0", xops);
-+ }
-+ else
- {
- if (! pic_label_name[0])
- {
-@@ -3915,16 +4024,17 @@ load_pic_register ()
- else
- ASM_GENERATE_INTERNAL_LABEL (pic_label_name, "LPR", 0);
- }
-- pclab = gen_rtx_MEM (QImode, gen_rtx_SYMBOL_REF (Pmode, pic_label_name));
-- }
-+ xops[2] = gen_rtx_SYMBOL_REF (Pmode, pic_label_name);
-+ xops[2] = gen_rtx_MEM (QImode, xops[2]);
-+ output_asm_insn ("call\t%X2", xops);
-+ }
-+
-+ if (!flag_pic || TARGET_DEEP_BRANCH_PREDICTION)
-+ output_asm_insn ("add{l}\t{%1, %0|%0, %1}", xops);
- else
-- {
-- pclab = gen_rtx_LABEL_REF (VOIDmode, gen_label_rtx ());
-- }
--
-- emit_insn (gen_prologue_get_pc (pic_offset_table_rtx, pclab));
--
-- emit_insn (gen_prologue_set_got (pic_offset_table_rtx, gotsym, pclab));
-+ output_asm_insn ("add{l}\t{%1+[.-%a2], %0|%0, %a1+(.-%a2)}", xops);
-+
-+ return "";
- }
-
- /* Generate an "push" pattern for input ARG. */
-@@ -4253,7 +4363,15 @@ ix86_expand_prologue ()
- #endif
-
- if (pic_reg_used)
-- load_pic_register ();
-+ {
-+ insn = emit_insn (gen_set_got (pic_offset_table_rtx));
-+
-+ /* ??? The current_function_uses_pic_offset_table flag is woefully
-+ inaccurate, as it isn't updated as code gets deleted. Allow the
-+ thing to be removed. A better solution would be to actually get
-+ proper liveness for ebx, as then we won't save/restore it too. */
-+ REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD, const0_rtx, NULL);
-+ }
-
- /* If we are profiling, make sure no instructions are scheduled before
- the call to mcount. However, if -fpic, the above call will have
-@@ -4694,6 +4812,114 @@ ix86_find_base_term (x)
- return term;
- }
- \f
-+/* Determine if a given RTX is a valid constant. We already know this
-+ satisfies CONSTANT_P. */
-+
-+bool
-+legitimate_constant_p (x)
-+ rtx x;
-+{
-+ rtx inner;
-+
-+ switch (GET_CODE (x))
-+ {
-+ case SYMBOL_REF:
-+ /* TLS symbols are not constant. */
-+ if (tls_symbolic_operand (x, Pmode))
-+ return false;
-+ break;
-+
-+ case CONST:
-+ inner = XEXP (x, 0);
-+
-+ /* Offsets of TLS symbols are never valid.
-+ Discourage CSE from creating them. */
-+ if (GET_CODE (inner) == PLUS
-+ && tls_symbolic_operand (XEXP (inner, 0), Pmode))
-+ return false;
-+
-+ /* Only some unspecs are valid as "constants". */
-+ if (GET_CODE (inner) == UNSPEC)
-+ switch (XINT (inner, 1))
-+ {
-+ case UNSPEC_TPOFF:
-+ return local_exec_symbolic_operand (XVECEXP (inner, 0, 0), Pmode);
-+ case UNSPEC_TP:
-+ return true;
-+ default:
-+ return false;
-+ }
-+ break;
-+
-+ default:
-+ break;
-+ }
-+
-+ /* Otherwise we handle everything else in the move patterns. */
-+ return true;
-+}
-+
-+/* Determine if a given RTX is a valid constant address. */
-+
-+bool
-+constant_address_p (x)
-+ rtx x;
-+{
-+ switch (GET_CODE (x))
-+ {
-+ case LABEL_REF:
-+ case CONST_INT:
-+ return true;
-+
-+ case CONST_DOUBLE:
-+ return TARGET_64BIT;
-+
-+ case CONST:
-+ case SYMBOL_REF:
-+ return !flag_pic && legitimate_constant_p (x);
-+
-+ default:
-+ return false;
-+ }
-+}
-+
-+/* Nonzero if the constant value X is a legitimate general operand
-+ when generating PIC code. It is given that flag_pic is on and
-+ that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-+
-+bool
-+legitimate_pic_operand_p (x)
-+ rtx x;
-+{
-+ rtx inner;
-+
-+ switch (GET_CODE (x))
-+ {
-+ case CONST:
-+ inner = XEXP (x, 0);
-+
-+ /* Only some unspecs are valid as "constants". */
-+ if (GET_CODE (inner) == UNSPEC)
-+ switch (XINT (inner, 1))
-+ {
-+ case UNSPEC_TPOFF:
-+ return local_exec_symbolic_operand (XVECEXP (inner, 0, 0), Pmode);
-+ case UNSPEC_TP:
-+ return true;
-+ default:
-+ return false;
-+ }
-+ /* FALLTHRU */
-+
-+ case SYMBOL_REF:
-+ case LABEL_REF:
-+ return legitimate_pic_address_disp_p (x);
-+
-+ default:
-+ return true;
-+ }
-+}
-+
- /* Determine if a given CONST RTX is a valid memory displacement
- in PIC mode. */
-
-@@ -4701,6 +4927,8 @@ int
- legitimate_pic_address_disp_p (disp)
- register rtx disp;
- {
-+ bool saw_plus;
-+
- /* In 64bit mode we can allow direct addresses of symbols and labels
- when they are not dynamic symbols. */
- if (TARGET_64BIT)
-@@ -4737,25 +4965,39 @@ legitimate_pic_address_disp_p (disp)
- return 1;
- }
-
-+ saw_plus = false;
- if (GET_CODE (disp) == PLUS)
- {
- if (GET_CODE (XEXP (disp, 1)) != CONST_INT)
- return 0;
- disp = XEXP (disp, 0);
-+ saw_plus = true;
- }
-
- if (GET_CODE (disp) != UNSPEC
- || XVECLEN (disp, 0) != 1)
- return 0;
-
-- /* Must be @GOT or @GOTOFF. */
- switch (XINT (disp, 1))
- {
-- case 6: /* @GOT */
-+ case UNSPEC_GOT:
-+ if (saw_plus)
-+ return false;
- return GET_CODE (XVECEXP (disp, 0, 0)) == SYMBOL_REF;
--
-- case 7: /* @GOTOFF */
-+ case UNSPEC_GOTOFF:
- return local_symbolic_operand (XVECEXP (disp, 0, 0), Pmode);
-+ case UNSPEC_GOTTPOFF:
-+ if (saw_plus)
-+ return false;
-+ return initial_exec_symbolic_operand (XVECEXP (disp, 0, 0), Pmode);
-+ case UNSPEC_NTPOFF:
-+ if (saw_plus)
-+ return false;
-+ return local_exec_symbolic_operand (XVECEXP (disp, 0, 0), Pmode);
-+ case UNSPEC_DTPOFF:
-+ if (saw_plus)
-+ return false;
-+ return local_dynamic_symbolic_operand (XVECEXP (disp, 0, 0), Pmode);
- }
-
- return 0;
-@@ -4882,12 +5124,6 @@ legitimate_address_p (mode, addr, strict
- {
- reason_rtx = disp;
-
-- if (!CONSTANT_ADDRESS_P (disp))
-- {
-- reason = "displacement is not constant";
-- goto report_error;
-- }
--
- if (TARGET_64BIT)
- {
- if (!x86_64_sign_extended_value (disp))
-@@ -4905,8 +5141,30 @@ legitimate_address_p (mode, addr, strict
- }
- }
-
-- if (flag_pic && SYMBOLIC_CONST (disp))
-+ if (GET_CODE (disp) == CONST
-+ && GET_CODE (XEXP (disp, 0)) == UNSPEC)
-+ switch (XINT (XEXP (disp, 0), 1))
-+ {
-+ case UNSPEC_GOT:
-+ case UNSPEC_GOTOFF:
-+ case UNSPEC_GOTPCREL:
-+ if (!flag_pic)
-+ abort ();
-+ goto is_legitimate_pic;
-+
-+ case UNSPEC_GOTTPOFF:
-+ case UNSPEC_NTPOFF:
-+ case UNSPEC_DTPOFF:
-+ break;
-+
-+ default:
-+ reason = "invalid address unspec";
-+ goto report_error;
-+ }
-+
-+ else if (flag_pic && SYMBOLIC_CONST (disp))
- {
-+ is_legitimate_pic:
- if (TARGET_64BIT && (index || base))
- {
- reason = "non-constant pic memory reference";
-@@ -4949,6 +5207,11 @@ legitimate_address_p (mode, addr, strict
- goto report_error;
- }
- }
-+ else if (!CONSTANT_ADDRESS_P (disp))
-+ {
-+ reason = "displacement is not constant";
-+ goto report_error;
-+ }
- }
-
- /* Everything looks valid. */
-@@ -5129,7 +5392,102 @@ legitimize_pic_address (orig, reg)
- }
- return new;
- }
-+
-+void
-+ix86_encode_section_info (decl)
-+ tree decl;
-+{
-+ bool local_p;
-+ rtx rtl, symbol;
-+
-+ rtl = DECL_P (decl) ? DECL_RTL (decl) : TREE_CST_RTL (decl);
-+ if (GET_CODE (rtl) != MEM)
-+ return;
-+ symbol = XEXP (rtl, 0);
-+ if (GET_CODE (symbol) != SYMBOL_REF)
-+ return;
-+
-+ local_p = !DECL_P (decl) || !TREE_PUBLIC (decl) || MODULE_LOCAL_P (decl);
-+
-+ /* For basic x86, if using PIC, mark a SYMBOL_REF for a non-global
-+ symbol so that we may access it directly in the GOT. */
-+
-+ if (flag_pic)
-+ SYMBOL_REF_FLAG (symbol) = local_p;
-+
-+ /* For ELF, encode thread-local data with %[GLil] for "global dynamic",
-+ "local dynamic", "initial exec" or "local exec" TLS models
-+ respectively. */
-+
-+ if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl))
-+ {
-+ const char *symbol_str;
-+ char *newstr;
-+ size_t len;
-+ enum tls_model kind;
-+
-+ if (!flag_pic)
-+ {
-+ if (local_p)
-+ kind = TLS_MODEL_LOCAL_EXEC;
-+ else
-+ kind = TLS_MODEL_INITIAL_EXEC;
-+ }
-+ /* Local dynamic is inefficient when we're not combining the
-+ parts of the address. */
-+ else if (optimize && local_p)
-+ kind = TLS_MODEL_LOCAL_DYNAMIC;
-+ else
-+ kind = TLS_MODEL_GLOBAL_DYNAMIC;
-+ if (kind < flag_tls_default)
-+ kind = flag_tls_default;
-+
-+ symbol_str = XSTR (symbol, 0);
-+
-+ if (symbol_str[0] == '%')
-+ {
-+ if (symbol_str[1] == tls_model_chars[kind])
-+ return;
-+ symbol_str += 2;
-+ }
-+ len = strlen (symbol_str) + 1;
-+ newstr = alloca (len + 2);
-+
-+ newstr[0] = '%';
-+ newstr[1] = tls_model_chars[kind];
-+ memcpy (newstr + 2, symbol_str, len);
-+
-+ XSTR (symbol, 0) = ggc_alloc_string (newstr, len + 2 - 1);
-+ }
-+}
-+
-+/* Undo the above when printing symbol names. */
-+
-+const char *
-+ix86_strip_name_encoding (str)
-+ const char *str;
-+{
-+ if (str[0] == '%')
-+ str += 2;
-+ if (str [0] == '*')
-+ str += 1;
-+ return str;
-+}
- \f
-+/* Load the thread pointer into a register. */
-+
-+static rtx
-+get_thread_pointer ()
-+{
-+ rtx tp;
-+
-+ tp = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const0_rtx), UNSPEC_TP);
-+ tp = gen_rtx_CONST (Pmode, tp);
-+ tp = force_reg (Pmode, tp);
-+
-+ return tp;
-+}
-+
- /* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-@@ -5167,6 +5525,84 @@ legitimize_address (x, oldx, mode)
- debug_rtx (x);
- }
-
-+ log = tls_symbolic_operand (x, mode);
-+ if (log)
-+ {
-+ rtx dest, base, off, pic;
-+
-+ switch (log)
-+ {
-+ case TLS_MODEL_GLOBAL_DYNAMIC:
-+ dest = gen_reg_rtx (Pmode);
-+ emit_insn (gen_tls_global_dynamic (dest, x));
-+ break;
-+
-+ case TLS_MODEL_LOCAL_DYNAMIC:
-+ base = gen_reg_rtx (Pmode);
-+ emit_insn (gen_tls_local_dynamic_base (base));
-+
-+ off = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, x), UNSPEC_DTPOFF);
-+ off = gen_rtx_CONST (Pmode, off);
-+
-+ return gen_rtx_PLUS (Pmode, base, off);
-+
-+ case TLS_MODEL_INITIAL_EXEC:
-+ if (flag_pic)
-+ {
-+ current_function_uses_pic_offset_table = 1;
-+ pic = pic_offset_table_rtx;
-+ }
-+ else
-+ {
-+ pic = gen_reg_rtx (Pmode);
-+ emit_insn (gen_set_got (pic));
-+ }
-+
-+ base = get_thread_pointer ();
-+
-+ off = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, x), UNSPEC_GOTTPOFF);
-+ off = gen_rtx_CONST (Pmode, off);
-+ off = gen_rtx_PLUS (Pmode, pic, off);
-+ off = gen_rtx_MEM (Pmode, off);
-+ RTX_UNCHANGING_P (off) = 1;
-+ set_mem_alias_set (off, ix86_GOT_alias_set ());
-+
-+ /* Damn Sun for specifing a set of dynamic relocations without
-+ considering the two-operand nature of the architecture!
-+ We'd be much better off with a "GOTNTPOFF" relocation that
-+ already contained the negated constant. */
-+ /* ??? Using negl and reg+reg addressing appears to be a lose
-+ size-wise. The negl is two bytes, just like the extra movl
-+ incurred by the two-operand subl, but reg+reg addressing
-+ uses the two-byte modrm form, unlike plain reg. */
-+
-+ dest = gen_reg_rtx (Pmode);
-+ emit_insn (gen_subsi3 (dest, base, off));
-+ break;
-+
-+ case TLS_MODEL_LOCAL_EXEC:
-+ base = get_thread_pointer ();
-+
-+ off = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, x),
-+ TARGET_GNU_TLS ? UNSPEC_NTPOFF : UNSPEC_TPOFF);
-+ off = gen_rtx_CONST (Pmode, off);
-+
-+ if (TARGET_GNU_TLS)
-+ return gen_rtx_PLUS (Pmode, base, off);
-+ else
-+ {
-+ dest = gen_reg_rtx (Pmode);
-+ emit_insn (gen_subsi3 (dest, base, off));
-+ }
-+ break;
-+
-+ default:
-+ abort ();
-+ }
-+
-+ return dest;
-+ }
-+
- if (flag_pic && SYMBOLIC_CONST (x))
- return legitimize_pic_address (x, 0);
-
-@@ -5410,18 +5846,30 @@ output_pic_addr_const (file, x, code)
- output_pic_addr_const (file, XVECEXP (x, 0, 0), code);
- switch (XINT (x, 1))
- {
-- case 6:
-+ case UNSPEC_GOT:
- fputs ("@GOT", file);
- break;
-- case 7:
-+ case UNSPEC_GOTOFF:
- fputs ("@GOTOFF", file);
- break;
-- case 8:
-+ case UNSPEC_PLT:
- fputs ("@PLT", file);
- break;
-- case 15:
-+ case UNSPEC_GOTPCREL:
- fputs ("@GOTPCREL(%RIP)", file);
- break;
-+ case UNSPEC_GOTTPOFF:
-+ fputs ("@GOTTPOFF", file);
-+ break;
-+ case UNSPEC_TPOFF:
-+ fputs ("@TPOFF", file);
-+ break;
-+ case UNSPEC_NTPOFF:
-+ fputs ("@NTPOFF", file);
-+ break;
-+ case UNSPEC_DTPOFF:
-+ fputs ("@DTPOFF", file);
-+ break;
- default:
- output_operand_lossage ("invalid UNSPEC as operand");
- break;
-@@ -5710,6 +6158,43 @@ print_reg (x, code, file)
- }
- }
-
-+/* Locate some local-dynamic symbol still in use by this function
-+ so that we can print its name in some tls_local_dynamic_base
-+ pattern. */
-+
-+static const char *
-+get_some_local_dynamic_name ()
-+{
-+ rtx insn;
-+
-+ if (cfun->machine->some_ld_name)
-+ return cfun->machine->some_ld_name;
-+
-+ for (insn = get_insns (); insn ; insn = NEXT_INSN (insn))
-+ if (INSN_P (insn)
-+ && for_each_rtx (&PATTERN (insn), get_some_local_dynamic_name_1, 0))
-+ return cfun->machine->some_ld_name;
-+
-+ abort ();
-+}
-+
-+static int
-+get_some_local_dynamic_name_1 (px, data)
-+ rtx *px;
-+ void *data ATTRIBUTE_UNUSED;
-+{
-+ rtx x = *px;
-+
-+ if (GET_CODE (x) == SYMBOL_REF
-+ && local_dynamic_symbolic_operand (x, Pmode))
-+ {
-+ cfun->machine->some_ld_name = XSTR (x, 0);
-+ return 1;
-+ }
-+
-+ return 0;
-+}
-+
- /* Meaning of CODE:
- L,W,B,Q,S,T -- print the opcode suffix for specified size of operand.
- C -- print opcode suffix for set/cmov insn.
-@@ -5734,6 +6219,7 @@ print_reg (x, code, file)
- D -- print condition for SSE cmp instruction.
- P -- if PIC, print an @PLT suffix.
- X -- don't print any sort of PIC '@' suffix for a symbol.
-+ & -- print some in-use local-dynamic symbol name.
- */
-
- void
-@@ -5751,6 +6237,10 @@ print_operand (file, x, code)
- putc ('*', file);
- return;
-
-+ case '&':
-+ assemble_name (file, get_some_local_dynamic_name ());
-+ return;
-+
- case 'A':
- if (ASSEMBLER_DIALECT == ASM_ATT)
- putc ('*', file);
-@@ -6078,6 +6568,18 @@ print_operand (file, x, code)
- REAL_VALUE_TO_DECIMAL (r, "%.22e", dstr);
- fprintf (file, "%s", dstr);
- }
-+
-+ else if (GET_CODE (x) == CONST
-+ && GET_CODE (XEXP (x, 0)) == UNSPEC
-+ && XINT (XEXP (x, 0), 1) == UNSPEC_TP)
-+ {
-+ if (ASSEMBLER_DIALECT == ASM_INTEL)
-+ fputs ("DWORD PTR ", file);
-+ if (ASSEMBLER_DIALECT == ASM_ATT || USER_LABEL_PREFIX[0] == 0)
-+ putc ('%', file);
-+ fputs ("gs:0", file);
-+ }
-+
- else
- {
- if (code != 'P')
-@@ -6226,6 +6728,43 @@ print_operand_address (file, addr)
- }
- }
- }
-+
-+bool
-+output_addr_const_extra (file, x)
-+ FILE *file;
-+ rtx x;
-+{
-+ rtx op;
-+
-+ if (GET_CODE (x) != UNSPEC)
-+ return false;
-+
-+ op = XVECEXP (x, 0, 0);
-+ switch (XINT (x, 1))
-+ {
-+ case UNSPEC_GOTTPOFF:
-+ output_addr_const (file, op);
-+ fputs ("@GOTTPOFF", file);
-+ break;
-+ case UNSPEC_TPOFF:
-+ output_addr_const (file, op);
-+ fputs ("@TPOFF", file);
-+ break;
-+ case UNSPEC_NTPOFF:
-+ output_addr_const (file, op);
-+ fputs ("@NTPOFF", file);
-+ break;
-+ case UNSPEC_DTPOFF:
-+ output_addr_const (file, op);
-+ fputs ("@DTPOFF", file);
-+ break;
-+
-+ default:
-+ return false;
-+ }
-+
-+ return true;
-+}
- \f
- /* Split one or more DImode RTL references into pairs of SImode
- references. The RTL can be REG, offsettable MEM, integer constant, or
-@@ -6763,51 +7302,117 @@ ix86_expand_clear (dest)
- emit_insn (tmp);
- }
-
-+/* X is an unchanging MEM. If it is a constant pool reference, return
-+ the constant pool rtx, else NULL. */
-+
-+static rtx
-+maybe_get_pool_constant (x)
-+ rtx x;
-+{
-+ x = XEXP (x, 0);
-+
-+ if (flag_pic)
-+ {
-+ if (GET_CODE (x) != PLUS)
-+ return NULL_RTX;
-+ if (XEXP (x, 0) != pic_offset_table_rtx)
-+ return NULL_RTX;
-+ x = XEXP (x, 1);
-+ if (GET_CODE (x) != CONST)
-+ return NULL_RTX;
-+ x = XEXP (x, 0);
-+ if (GET_CODE (x) != UNSPEC)
-+ return NULL_RTX;
-+ if (XINT (x, 1) != UNSPEC_GOTOFF)
-+ return NULL_RTX;
-+ x = XVECEXP (x, 0, 0);
-+ }
-+
-+ if (GET_CODE (x) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (x))
-+ return get_pool_constant (x);
-+
-+ return NULL_RTX;
-+}
-+
- void
- ix86_expand_move (mode, operands)
- enum machine_mode mode;
- rtx operands[];
- {
- int strict = (reload_in_progress || reload_completed);
-- rtx insn;
-+ rtx insn, op0, op1, tmp;
-+
-+ op0 = operands[0];
-+ op1 = operands[1];
-
-- if (flag_pic && mode == Pmode && symbolic_operand (operands[1], Pmode))
-+ /* ??? We have a slight problem. We need to say that tls symbols are
-+ not legitimate constants so that reload does not helpfully reload
-+ these constants from a REG_EQUIV, which we cannot handle. (Recall
-+ that general- and local-dynamic address resolution requires a
-+ function call.)
-+
-+ However, if we say that tls symbols are not legitimate constants,
-+ then emit_move_insn helpfully drop them into the constant pool.
-+
-+ It is far easier to work around emit_move_insn than reload. Recognize
-+ the MEM that we would have created and extract the symbol_ref. */
-+
-+ if (mode == Pmode
-+ && GET_CODE (op1) == MEM
-+ && RTX_UNCHANGING_P (op1))
- {
-- /* Emit insns to move operands[1] into operands[0]. */
-+ tmp = maybe_get_pool_constant (op1);
-+ /* Note that we only care about symbolic constants here, which
-+ unlike CONST_INT will always have a proper mode. */
-+ if (tmp && GET_MODE (tmp) == Pmode)
-+ op1 = tmp;
-+ }
-
-- if (GET_CODE (operands[0]) == MEM)
-- operands[1] = force_reg (Pmode, operands[1]);
-+ if (tls_symbolic_operand (op1, Pmode))
-+ {
-+ op1 = legitimize_address (op1, op1, VOIDmode);
-+ if (GET_CODE (op0) == MEM)
-+ {
-+ tmp = gen_reg_rtx (mode);
-+ emit_insn (gen_rtx_SET (VOIDmode, tmp, op1));
-+ op1 = tmp;
-+ }
-+ }
-+ else if (flag_pic && mode == Pmode && symbolic_operand (op1, Pmode))
-+ {
-+ if (GET_CODE (op0) == MEM)
-+ op1 = force_reg (Pmode, op1);
- else
- {
-- rtx temp = operands[0];
-+ rtx temp = op0;
- if (GET_CODE (temp) != REG)
- temp = gen_reg_rtx (Pmode);
-- temp = legitimize_pic_address (operands[1], temp);
-- if (temp == operands[0])
-+ temp = legitimize_pic_address (op1, temp);
-+ if (temp == op0)
- return;
-- operands[1] = temp;
-+ op1 = temp;
- }
- }
- else
- {
-- if (GET_CODE (operands[0]) == MEM
-+ if (GET_CODE (op0) == MEM
- && (PUSH_ROUNDING (GET_MODE_SIZE (mode)) != GET_MODE_SIZE (mode)
-- || !push_operand (operands[0], mode))
-- && GET_CODE (operands[1]) == MEM)
-- operands[1] = force_reg (mode, operands[1]);
--
-- if (push_operand (operands[0], mode)
-- && ! general_no_elim_operand (operands[1], mode))
-- operands[1] = copy_to_mode_reg (mode, operands[1]);
-+ || !push_operand (op0, mode))
-+ && GET_CODE (op1) == MEM)
-+ op1 = force_reg (mode, op1);
-+
-+ if (push_operand (op0, mode)
-+ && ! general_no_elim_operand (op1, mode))
-+ op1 = copy_to_mode_reg (mode, op1);
-
- /* Force large constants in 64bit compilation into register
- to get them CSEed. */
- if (TARGET_64BIT && mode == DImode
-- && immediate_operand (operands[1], mode)
-- && !x86_64_zero_extended_value (operands[1])
-- && !register_operand (operands[0], mode)
-+ && immediate_operand (op1, mode)
-+ && !x86_64_zero_extended_value (op1)
-+ && !register_operand (op0, mode)
- && optimize && !reload_completed && !reload_in_progress)
-- operands[1] = copy_to_mode_reg (mode, operands[1]);
-+ op1 = copy_to_mode_reg (mode, op1);
-
- if (FLOAT_MODE_P (mode))
- {
-@@ -6817,13 +7422,13 @@ ix86_expand_move (mode, operands)
-
- if (strict)
- ;
-- else if (GET_CODE (operands[1]) == CONST_DOUBLE
-- && register_operand (operands[0], mode))
-- operands[1] = validize_mem (force_const_mem (mode, operands[1]));
-+ else if (GET_CODE (op1) == CONST_DOUBLE
-+ && register_operand (op0, mode))
-+ op1 = validize_mem (force_const_mem (mode, op1));
- }
- }
-
-- insn = gen_rtx_SET (VOIDmode, operands[0], operands[1]);
-+ insn = gen_rtx_SET (VOIDmode, op0, op1);
-
- emit_insn (insn);
- }
-@@ -8588,13 +9193,14 @@ ix86_split_to_parts (operand, parts, mod
- if (size < 2 || size > 3)
- abort ();
-
-- /* Optimize constant pool reference to immediates. This is used by fp moves,
-- that force all constants to memory to allow combining. */
--
-- if (GET_CODE (operand) == MEM
-- && GET_CODE (XEXP (operand, 0)) == SYMBOL_REF
-- && CONSTANT_POOL_ADDRESS_P (XEXP (operand, 0)))
-- operand = get_pool_constant (XEXP (operand, 0));
-+ /* Optimize constant pool reference to immediates. This is used by fp
-+ moves, that force all constants to memory to allow combining. */
-+ if (GET_CODE (operand) == MEM && RTX_UNCHANGING_P (operand))
-+ {
-+ rtx tmp = maybe_get_pool_constant (operand);
-+ if (tmp)
-+ operand = tmp;
-+ }
-
- if (GET_CODE (operand) == MEM && !offsettable_memref_p (operand))
- {
-@@ -9790,6 +10396,55 @@ ix86_expand_strlensi_unroll_1 (out, alig
-
- emit_label (end_0_label);
- }
-+
-+void
-+ix86_expand_call (retval, fnaddr, callarg1, callarg2, pop)
-+ rtx retval, fnaddr, callarg1, callarg2, pop;
-+{
-+ rtx use = NULL, call;
-+
-+ if (pop == const0_rtx)
-+ pop = NULL;
-+ if (TARGET_64BIT && pop)
-+ abort ();
-+
-+ /* Static functions and indirect calls don't need the pic register. */
-+ if (! TARGET_64BIT && flag_pic
-+ && GET_CODE (XEXP (fnaddr, 0)) == SYMBOL_REF
-+ && ! SYMBOL_REF_FLAG (XEXP (fnaddr, 0)))
-+ {
-+ current_function_uses_pic_offset_table = 1;
-+ use_reg (&use, pic_offset_table_rtx);
-+ }
-+
-+ if (TARGET_64BIT && INTVAL (callarg2) >= 0)
-+ {
-+ rtx al = gen_rtx_REG (QImode, 0);
-+ emit_move_insn (al, callarg2);
-+ use_reg (&use, al);
-+ }
-+
-+ if (! call_insn_operand (XEXP (fnaddr, 0), Pmode))
-+ {
-+ fnaddr = copy_to_mode_reg (Pmode, XEXP (fnaddr, 0));
-+ fnaddr = gen_rtx_MEM (QImode, fnaddr);
-+ }
-+
-+ call = gen_rtx_CALL (VOIDmode, fnaddr, callarg1);
-+ if (retval)
-+ call = gen_rtx_SET (VOIDmode, retval, call);
-+ if (pop)
-+ {
-+ pop = gen_rtx_PLUS (Pmode, stack_pointer_rtx, pop);
-+ pop = gen_rtx_SET (VOIDmode, stack_pointer_rtx, pop);
-+ call = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, call, pop));
-+ }
-+
-+ call = emit_call_insn (call);
-+ if (use)
-+ CALL_INSN_FUNCTION_USAGE (call) = use;
-+}
-+
- \f
- /* Clear stack slot assignments remembered from previous functions.
- This is called from INIT_EXPANDERS once before RTL is emitted for each
-@@ -9849,6 +10504,24 @@ assign_386_stack_local (mode, n)
-
- return ix86_stack_locals[(int) mode][n];
- }
-+
-+/* Construct the SYMBOL_REF for the tls_get_addr function. */
-+
-+rtx
-+ix86_tls_get_addr ()
-+{
-+ static rtx symbol;
-+
-+ if (!symbol)
-+ {
-+ symbol = gen_rtx_SYMBOL_REF (Pmode, (TARGET_GNU_TLS
-+ ? "___tls_get_addr"
-+ : "__tls_get_addr"));
-+ ggc_add_rtx_root (&symbol, 1);
-+ }
-+
-+ return symbol;
-+}
- \f
- /* Calculate the length of the memory address in the instruction
- encoding. Does not include the one-byte modrm, opcode, or prefix. */
---- gcc/config/i386/i386-protos.h.jj Wed Jun 19 15:18:02 2002
-+++ gcc/config/i386/i386-protos.h Wed Jun 19 19:33:52 2002
-@@ -28,7 +28,6 @@ extern int ix86_frame_pointer_required P
- extern void ix86_setup_frame_addresses PARAMS ((void));
-
- extern void ix86_asm_file_end PARAMS ((FILE *));
--extern void load_pic_register PARAMS ((void));
- extern HOST_WIDE_INT ix86_initial_elimination_offset PARAMS((int, int));
- extern void ix86_expand_prologue PARAMS ((void));
- extern void ix86_expand_epilogue PARAMS ((int));
-@@ -36,6 +35,9 @@ extern void ix86_expand_epilogue PARAMS
- extern void ix86_output_addr_vec_elt PARAMS ((FILE *, int));
- extern void ix86_output_addr_diff_elt PARAMS ((FILE *, int, int));
-
-+extern void ix86_encode_section_info PARAMS ((tree));
-+extern const char *ix86_strip_name_encoding PARAMS ((const char *));
-+
- #ifdef RTX_CODE
- extern int ix86_aligned_p PARAMS ((rtx));
-
-@@ -51,6 +53,11 @@ extern int x86_64_immediate_operand PARA
- extern int x86_64_zext_immediate_operand PARAMS ((rtx, enum machine_mode));
- extern int const_int_1_operand PARAMS ((rtx, enum machine_mode));
- extern int symbolic_operand PARAMS ((rtx, enum machine_mode));
-+extern int tls_symbolic_operand PARAMS ((rtx, enum machine_mode));
-+extern int global_dynamic_symbolic_operand PARAMS ((rtx, enum machine_mode));
-+extern int local_dynamic_symbolic_operand PARAMS ((rtx, enum machine_mode));
-+extern int initial_exec_symbolic_operand PARAMS ((rtx, enum machine_mode));
-+extern int local_exec_symbolic_operand PARAMS ((rtx, enum machine_mode));
- extern int pic_symbolic_operand PARAMS ((rtx, enum machine_mode));
- extern int call_insn_operand PARAMS ((rtx, enum machine_mode));
- extern int constant_call_address_operand PARAMS ((rtx, enum machine_mode));
-@@ -84,6 +91,9 @@ extern int ix86_expand_movstr PARAMS ((r
- extern int ix86_expand_clrstr PARAMS ((rtx, rtx, rtx));
- extern int ix86_expand_strlen PARAMS ((rtx, rtx, rtx, rtx));
-
-+extern bool legitimate_constant_p PARAMS ((rtx));
-+extern bool constant_address_p PARAMS ((rtx));
-+extern bool legitimate_pic_operand_p PARAMS ((rtx));
- extern int legitimate_pic_address_disp_p PARAMS ((rtx));
- extern int legitimate_address_p PARAMS ((enum machine_mode, rtx, int));
- extern rtx legitimize_pic_address PARAMS ((rtx, rtx));
-@@ -92,10 +102,12 @@ extern rtx legitimize_address PARAMS ((r
- extern void print_reg PARAMS ((rtx, int, FILE*));
- extern void print_operand PARAMS ((FILE*, rtx, int));
- extern void print_operand_address PARAMS ((FILE*, rtx));
-+extern bool output_addr_const_extra PARAMS ((FILE*, rtx));
-
- extern void split_di PARAMS ((rtx[], int, rtx[], rtx[]));
- extern void split_ti PARAMS ((rtx[], int, rtx[], rtx[]));
-
-+extern const char *output_set_got PARAMS ((rtx));
- extern const char *output_387_binary_op PARAMS ((rtx, rtx*));
- extern const char *output_fix_trunc PARAMS ((rtx, rtx*));
- extern const char *output_fp_compare PARAMS ((rtx, rtx*, int, int));
-@@ -121,6 +133,7 @@ extern void ix86_expand_branch PARAMS ((
- extern int ix86_expand_setcc PARAMS ((enum rtx_code, rtx));
- extern int ix86_expand_int_movcc PARAMS ((rtx[]));
- extern int ix86_expand_fp_movcc PARAMS ((rtx[]));
-+extern void ix86_expand_call PARAMS ((rtx, rtx, rtx, rtx, rtx));
- extern void x86_initialize_trampoline PARAMS ((rtx, rtx, rtx));
- extern rtx ix86_zero_extend_to_Pmode PARAMS ((rtx));
- extern void ix86_split_long_move PARAMS ((rtx[]));
-@@ -181,6 +194,8 @@ extern rtx ix86_expand_builtin PARAMS ((
-
- #endif
-
-+extern rtx ix86_tls_get_addr PARAMS ((void));
-+
- #ifdef TREE_CODE
- extern int ix86_return_pops_args PARAMS ((tree, tree, int));
- extern tree ix86_build_va_list PARAMS ((void));
---- gcc/config/i386/i386.h.jj Wed Jun 19 19:33:51 2002
-+++ gcc/config/i386/i386.h Wed Jun 19 20:20:56 2002
-@@ -282,6 +282,9 @@ extern int x86_prefetch_sse;
-
- #define TARGET_RED_ZONE (!(target_flags & MASK_NO_RED_ZONE))
-
-+#define TARGET_GNU_TLS (ix86_tls_dialect == TLS_DIALECT_GNU)
-+#define TARGET_SUN_TLS (ix86_tls_dialect == TLS_DIALECT_SUN)
-+
- /* WARNING: Do not mark empty strings for translation, as calling
- gettext on an empty string does NOT return an empty
- string. */
-@@ -451,6 +454,8 @@ extern int ix86_arch;
- "" /* Undocumented. */ }, \
- { "asm=", &ix86_asm_string, \
- N_("Use given assembler dialect") }, \
-+ { "tls-dialect=", &ix86_tls_dialect_string, \
-+ N_("Use given thread-local storage dialect") }, \
- SUBTARGET_OPTIONS \
- }
-
-@@ -1934,15 +1939,12 @@ do { \
-
- #define MAX_REGS_PER_ADDRESS 2
-
--#define CONSTANT_ADDRESS_P(X) \
-- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
-- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
-- || GET_CODE (X) == CONST_DOUBLE)
-+#define CONSTANT_ADDRESS_P(X) constant_address_p (X)
-
- /* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
--#define LEGITIMATE_CONSTANT_P(X) 1
-+#define LEGITIMATE_CONSTANT_P(X) legitimate_constant_p (X)
-
- #ifdef REG_OK_STRICT
- #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-@@ -2005,9 +2007,7 @@ do { \
- when generating PIC code. It is given that flag_pic is on and
- that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
--#define LEGITIMATE_PIC_OPERAND_P(X) \
-- (! SYMBOLIC_CONST (X) \
-- || legitimate_pic_address_disp_p (X))
-+#define LEGITIMATE_PIC_OPERAND_P(X) legitimate_pic_operand_p (X)
-
- #define SYMBOLIC_CONST(X) \
- (GET_CODE (X) == SYMBOL_REF \
-@@ -2251,33 +2251,23 @@ enum ix86_builtins
- On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol
- so that we may access it directly in the GOT. */
-
--#define ENCODE_SECTION_INFO(DECL) \
--do { \
-- if (flag_pic) \
-- { \
-- rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
-- ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
-- \
-- if (GET_CODE (rtl) == MEM) \
-- { \
-- if (TARGET_DEBUG_ADDR \
-- && TREE_CODE_CLASS (TREE_CODE (DECL)) == 'd') \
-- { \
-- fprintf (stderr, "Encode %s, public = %d\n", \
-- IDENTIFIER_POINTER (DECL_NAME (DECL)), \
-- TREE_PUBLIC (DECL)); \
-- } \
-- \
-- SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
-- = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
-- || ! TREE_PUBLIC (DECL) \
-- || MODULE_LOCAL_P (DECL)); \
-- } \
-- } \
--} while (0)
--
-+#define ENCODE_SECTION_INFO(DECL) ix86_encode_section_info(DECL)
- #define REDO_SECTION_INFO_P(DECL) 1
-
-+#define STRIP_NAME_ENCODING(VAR,STR) ((VAR) = ix86_strip_name_encoding (STR))
-+
-+#define ASM_OUTPUT_LABELREF(FILE,NAME) \
-+ do { \
-+ const char *xname = (NAME); \
-+ if (xname[0] == '%') \
-+ xname += 2; \
-+ if (xname[0] == '*') \
-+ xname += 1; \
-+ else \
-+ fputs (user_label_prefix, FILE); \
-+ fputs (xname, FILE); \
-+ } while (0)
-+
- /* The `FINALIZE_PIC' macro serves as a hook to emit these special
- codes once the function is being compiled into assembly code, but
- not before. (It is not done before, because in the case of
-@@ -2923,7 +2913,7 @@ extern int const svr4_dbx_register_map[F
- print_operand function. */
-
- #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
-- ((CODE) == '*' || (CODE) == '+')
-+ ((CODE) == '*' || (CODE) == '+' || (CODE) == '&')
-
- /* Print the name of a register based on its machine mode and number.
- If CODE is 'w', pretend the mode is HImode.
-@@ -2942,6 +2932,12 @@ extern int const svr4_dbx_register_map[F
- #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
- print_operand_address ((FILE), (ADDR))
-
-+#define OUTPUT_ADDR_CONST_EXTRA(FILE, X, FAIL) \
-+do { \
-+ if (! output_addr_const_extra (FILE, (X))) \
-+ goto FAIL; \
-+} while (0);
-+
- /* Print the name of a register for based on its machine mode and number.
- This macro is used to print debugging output.
- This macro is different from PRINT_REG in that it may be used in
-@@ -3071,7 +3067,12 @@ extern int const svr4_dbx_register_map[F
- {"memory_displacement_operand", {MEM}}, \
- {"cmpsi_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \
- LABEL_REF, SUBREG, REG, MEM, AND}}, \
-- {"long_memory_operand", {MEM}},
-+ {"long_memory_operand", {MEM}}, \
-+ {"tls_symbolic_operand", {SYMBOL_REF}}, \
-+ {"global_dynamic_symbolic_operand", {SYMBOL_REF}}, \
-+ {"local_dynamic_symbolic_operand", {SYMBOL_REF}}, \
-+ {"initial_exec_symbolic_operand", {SYMBOL_REF}}, \
-+ {"local_exec_symbolic_operand", {SYMBOL_REF}},
-
- /* A list of predicates that do special things with modes, and so
- should not elicit warnings for VOIDmode match_operand. */
-@@ -3112,6 +3113,16 @@ enum asm_dialect {
- };
- extern const char *ix86_asm_string;
- extern enum asm_dialect ix86_asm_dialect;
-+
-+enum tls_dialect
-+{
-+ TLS_DIALECT_GNU,
-+ TLS_DIALECT_SUN
-+};
-+
-+extern enum tls_dialect ix86_tls_dialect;
-+extern const char *ix86_tls_dialect_string;
-+
- /* Value of -mcmodel specified by user. */
- extern const char *ix86_cmodel_string;
- extern enum cmodel ix86_cmodel;
---- gcc/config/i386/i386.md.jj Tue Jun 4 20:28:36 2002
-+++ gcc/config/i386/i386.md Wed Jun 19 19:33:52 2002
-@@ -49,55 +49,59 @@
- ;; 'k' Likewise, print the SImode name of the register.
- ;; 'h' Print the QImode name for a "high" register, either ah, bh, ch or dh.
- ;; 'y' Print "st(0)" instead of "st" as a register.
--;;
-+
- ;; UNSPEC usage:
--;; 0 This is a `scas' operation. The mode of the UNSPEC is always SImode.
--;; operand 0 is the memory address to scan.
--;; operand 1 is a register containing the value to scan for. The mode
--;; of the scas opcode will be the same as the mode of this operand.
--;; operand 2 is the known alignment of operand 0.
--;; 1 This is a `sin' operation. The mode of the UNSPEC is MODE_FLOAT.
--;; operand 0 is the argument for `sin'.
--;; 2 This is a `cos' operation. The mode of the UNSPEC is MODE_FLOAT.
--;; operand 0 is the argument for `cos'.
--;; 3 This is part of a `stack probe' operation. The mode of the UNSPEC is
--;; always SImode. operand 0 is the size of the stack allocation.
--;; 4 This is the source of a fake SET of the frame pointer which is used to
--;; prevent insns referencing it being scheduled across the initial
--;; decrement of the stack pointer.
--;; 5 This is a `bsf' operation.
--;; 6 This is the @GOT offset of a PIC address.
--;; 7 This is the @GOTOFF offset of a PIC address.
--;; 8 This is a reference to a symbol's @PLT address.
--;; 9 This is an `fnstsw' operation.
--;; 10 This is a `sahf' operation.
--;; 11 This is a `fstcw' operation
--;; 12 This is behaviour of add when setting carry flag.
--;; 13 This is a `eh_return' placeholder.
--
--;; For SSE/MMX support:
--;; 30 This is `fix', guaranteed to be truncating.
--;; 31 This is a `emms' operation.
--;; 32 This is a `maskmov' operation.
--;; 33 This is a `movmsk' operation.
--;; 34 This is a `non-temporal' move.
--;; 36 This is used to distinguish COMISS from UCOMISS.
--;; 37 This is a `ldmxcsr' operation.
--;; 38 This is a forced `movaps' instruction (rather than whatever movti does)
--;; 39 This is a forced `movups' instruction (rather than whatever movti does)
--;; 40 This is a `stmxcsr' operation.
--;; 41 This is a `shuffle' operation.
--;; 42 This is a `rcp' operation.
--;; 43 This is a `rsqsrt' operation.
--;; 44 This is a `sfence' operation.
--;; 45 This is a noop to prevent excessive combiner cleverness.
--;; 46 This is a `femms' operation.
--;; 49 This is a 'pavgusb' operation.
--;; 50 This is a `pfrcp' operation.
--;; 51 This is a `pfrcpit1' operation.
--;; 52 This is a `pfrcpit2' operation.
--;; 53 This is a `pfrsqrt' operation.
--;; 54 This is a `pfrsqrit1' operation.
-+;; ??? Note that the 3.1 branch, unlike mainline, has not had all
-+;; of the uses of UNSPEC replaced with their symbolic constants.
-+;; Thus you cannot change these arbitrarily without pain.
-+
-+(define_constants
-+ [(UNSPEC_SCAS 0)
-+ (UNSPEC_SIN 1)
-+ (UNSPEC_COS 2)
-+ (UNSPEC_STACK_PROBE 3)
-+ (UNSPEC_STACK_ALLOC 4)
-+ (UNSPEC_BSF 5)
-+ (UNSPEC_GOT 6)
-+ (UNSPEC_GOTOFF 7)
-+ (UNSPEC_PLT 8)
-+ (UNSPEC_FNSTSW 9)
-+ (UNSPEC_SAHF 10)
-+ (UNSPEC_FSTCW 11)
-+ (UNSPEC_FLDCW 12)
-+ (UNSPEC_ADD_CARRY 12)
-+ (UNSPEC_EH_RETURN 13)
-+ (UNSPEC_GOTPCREL 15)
-+ (UNSPEC_SET_GOT 16)
-+
-+ ; For TLS support:
-+ (UNSPEC_GOTTPOFF 20)
-+ (UNSPEC_TPOFF 21)
-+ (UNSPEC_NTPOFF 22)
-+ (UNSPEC_DTPOFF 23)
-+ (UNSPEC_TP 24)
-+ (UNSPEC_TLS_GD 25)
-+ (UNSPEC_TLS_LD_BASE 26)
-+
-+ ; For SSE/MMX support:
-+ (UNSPEC_FIX 30)
-+ (UNSPEC_MASKMOV 32)
-+ (UNSPEC_MOVMSK 33)
-+ (UNSPEC_MOVNT 34)
-+ (UNSPEC_MOVA 38)
-+ (UNSPEC_MOVU 39)
-+ (UNSPEC_SHUFFLE 41)
-+ (UNSPEC_RCP 42)
-+ (UNSPEC_RSQRT 43)
-+ (UNSPEC_SFENCE 44)
-+ (UNSPEC_NOP 45) ; prevents combiner cleverness
-+ (UNSPEC_PAVGUSB 49)
-+ (UNSPEC_PFRCP 50)
-+ (UNSPEC_PFRCPIT1 51)
-+ (UNSPEC_PFRCPIT2 52)
-+ (UNSPEC_PFRSQRT 53)
-+ (UNSPEC_PFRSQIT1 54)
-+ ])
-
- ;; Insns whose names begin with "x86_" are emitted by gen_FOO calls
- ;; from i386.c.
-@@ -1759,7 +1763,7 @@
- return "lea{l}\t{%1, %0|%0, %1}";
-
- default:
-- if (flag_pic && SYMBOLIC_CONST (operands[1]))
-+ if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1]))
- abort();
- return "mov{l}\t{%1, %0|%0, %1}";
- }
-@@ -2525,7 +2529,7 @@
- case TYPE_LEA:
- return "lea{q}\t{%a1, %0|%0, %a1}";
- default:
-- if (flag_pic && SYMBOLIC_CONST (operands[1]))
-+ if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1]))
- abort ();
- if (get_attr_mode (insn) == MODE_SI)
- return "mov{l}\t{%k1, %k0|%k0, %k1}";
-@@ -13474,21 +13478,8 @@
- (match_operand:SI 3 "" "")))])]
- "!TARGET_64BIT"
- {
-- if (operands[3] == const0_rtx)
-- {
-- emit_insn (gen_call (operands[0], operands[1], constm1_rtx));
-- DONE;
-- }
-- /* Static functions and indirect calls don't need
-- current_function_uses_pic_offset_table. */
-- if (flag_pic
-- && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF
-- && ! SYMBOL_REF_FLAG (XEXP (operands[0], 0)))
-- current_function_uses_pic_offset_table = 1;
-- if (! call_insn_operand (XEXP (operands[0], 0), Pmode))
-- XEXP (operands[0], 0) = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
-- if (TARGET_64BIT)
-- abort();
-+ ix86_expand_call (NULL, operands[0], operands[1], operands[2], operands[3]);
-+ DONE;
- })
-
- (define_insn "*call_pop_0"
-@@ -13530,37 +13521,12 @@
- [(call (match_operand:QI 0 "" "")
- (match_operand 1 "" ""))
- (use (match_operand 2 "" ""))]
-- ;; Operand 1 not used on the i386.
- ""
- {
-- rtx insn;
-- /* Static functions and indirect calls don't need
-- current_function_uses_pic_offset_table. */
-- if (flag_pic
-- && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF
-- && ! SYMBOL_REF_FLAG (XEXP (operands[0], 0)))
-- current_function_uses_pic_offset_table = 1;
--
-- if (! call_insn_operand (XEXP (operands[0], 0), Pmode))
-- XEXP (operands[0], 0) = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
-- if (TARGET_64BIT && INTVAL (operands[2]) >= 0)
-- {
-- rtx reg = gen_rtx_REG (QImode, 0);
-- emit_move_insn (reg, operands[2]);
-- insn = emit_call_insn (gen_call_exp (operands[0], operands[1]));
-- use_reg (&CALL_INSN_FUNCTION_USAGE (insn), reg);
-- DONE;
-- }
-- insn = emit_call_insn (gen_call_exp (operands[0], operands[1]));
-- DONE;
-+ ix86_expand_call (NULL, operands[0], operands[1], operands[2], NULL);
-+ DONE;
- })
-
--(define_expand "call_exp"
-- [(call (match_operand:QI 0 "" "")
-- (match_operand 1 "" ""))]
-- ""
-- "")
--
- (define_insn "*call_0"
- [(call (mem:QI (match_operand 0 "constant_call_address_operand" ""))
- (match_operand 1 "" ""))]
-@@ -13612,7 +13578,6 @@
- [(set_attr "type" "call")])
-
- ;; Call subroutine, returning value in operand 0
--;; (which must be a hard register).
-
- (define_expand "call_value_pop"
- [(parallel [(set (match_operand 0 "" "")
-@@ -13623,20 +13588,9 @@
- (match_operand:SI 4 "" "")))])]
- "!TARGET_64BIT"
- {
-- if (operands[4] == const0_rtx)
-- {
-- emit_insn (gen_call_value (operands[0], operands[1], operands[2],
-- constm1_rtx));
-- DONE;
-- }
-- /* Static functions and indirect calls don't need
-- current_function_uses_pic_offset_table. */
-- if (flag_pic
-- && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
-- && ! SYMBOL_REF_FLAG (XEXP (operands[1], 0)))
-- current_function_uses_pic_offset_table = 1;
-- if (! call_insn_operand (XEXP (operands[1], 0), Pmode))
-- XEXP (operands[1], 0) = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
-+ ix86_expand_call (operands[0], operands[1], operands[2],
-+ operands[3], operands[4]);
-+ DONE;
- })
-
- (define_expand "call_value"
-@@ -13647,36 +13601,10 @@
- ;; Operand 2 not used on the i386.
- ""
- {
-- rtx insn;
-- /* Static functions and indirect calls don't need
-- current_function_uses_pic_offset_table. */
-- if (flag_pic
-- && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
-- && ! SYMBOL_REF_FLAG (XEXP (operands[1], 0)))
-- current_function_uses_pic_offset_table = 1;
-- if (! call_insn_operand (XEXP (operands[1], 0), Pmode))
-- XEXP (operands[1], 0) = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
-- if (TARGET_64BIT && INTVAL (operands[3]) >= 0)
-- {
-- rtx reg = gen_rtx_REG (QImode, 0);
-- emit_move_insn (reg, operands[3]);
-- insn = emit_call_insn (gen_call_value_exp (operands[0], operands[1],
-- operands[2]));
-- use_reg (&CALL_INSN_FUNCTION_USAGE (insn), reg);
-- DONE;
-- }
-- insn = emit_call_insn (gen_call_value_exp (operands[0], operands[1],
-- operands[2]));
-+ ix86_expand_call (operands[0], operands[1], operands[2], operands[3], NULL);
- DONE;
- })
-
--(define_expand "call_value_exp"
-- [(set (match_operand 0 "" "")
-- (call (match_operand:QI 1 "" "")
-- (match_operand:SI 2 "" "")))]
-- ""
-- "")
--
- ;; Call subroutine returning any type.
-
- (define_expand "untyped_call"
-@@ -13693,12 +13621,10 @@
- simply pretend the untyped call returns a complex long double
- value. */
-
-- emit_call_insn (TARGET_FLOAT_RETURNS_IN_80387
-- ? gen_call_value (gen_rtx_REG (XCmode, FIRST_FLOAT_REG),
-- operands[0], const0_rtx,
-- GEN_INT (SSE_REGPARM_MAX - 1))
-- : gen_call (operands[0], const0_rtx,
-- GEN_INT (SSE_REGPARM_MAX - 1)));
-+ ix86_expand_call ((TARGET_FLOAT_RETURNS_IN_80387
-+ ? gen_rtx_REG (XCmode, FIRST_FLOAT_REG) : NULL),
-+ operands[0], const0_rtx, GEN_INT (SSE_REGPARM_MAX - 1),
-+ NULL);
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
-@@ -13781,45 +13707,39 @@
- ""
- "ix86_expand_prologue (); DONE;")
-
--(define_insn "prologue_set_got"
-+(define_expand "set_got"
-+ [(parallel [(set (match_operand:SI 0 "register_operand" "")
-+ (unspec:SI [(const_int 0)] UNSPEC_SET_GOT))
-+ (clobber (reg:CC 17))])]
-+ "!TARGET_64BIT"
-+ "")
-+
-+(define_insn "*set_got_nopic"
- [(set (match_operand:SI 0 "register_operand" "=r")
-- (unspec_volatile:SI
-- [(plus:SI (match_dup 0)
-- (plus:SI (match_operand:SI 1 "symbolic_operand" "")
-- (minus:SI (pc) (match_operand 2 "" ""))))] 1))
-+ (unspec:SI [(const_int 0)] UNSPEC_SET_GOT))
- (clobber (reg:CC 17))]
-- "!TARGET_64BIT"
--{
-- if (GET_CODE (operands[2]) == LABEL_REF)
-- operands[2] = XEXP (operands[2], 0);
-- if (TARGET_DEEP_BRANCH_PREDICTION)
-- return "add{l}\t{%1, %0|%0, %1}";
-- else
-- return "add{l}\t{%1+[.-%X2], %0|%0, %a1+(.-%X2)}";
--}
-- [(set_attr "type" "alu")
-- ; Since this insn may have two constant operands, we must set the
-- ; length manually.
-- (set_attr "length_immediate" "4")
-- (set_attr "mode" "SI")])
-+ "!TARGET_64BIT && !flag_pic"
-+ { return output_set_got (operands[0]); }
-+ [(set_attr "type" "multi")
-+ (set_attr "length" "11")])
-+
-+(define_insn "*set_got_deep"
-+ [(set (match_operand:SI 0 "register_operand" "=b")
-+ (unspec:SI [(const_int 0)] UNSPEC_SET_GOT))
-+ (clobber (reg:CC 17))]
-+ "!TARGET_64BIT && TARGET_DEEP_BRANCH_PREDICTION"
-+ { return output_set_got (operands[0]); }
-+ [(set_attr "type" "multi")
-+ (set_attr "length" "11")])
-
--(define_insn "prologue_get_pc"
-+(define_insn "*set_got_nodeep"
- [(set (match_operand:SI 0 "register_operand" "=r")
-- (unspec_volatile:SI [(plus:SI (pc) (match_operand 1 "" ""))] 2))]
-+ (unspec:SI [(const_int 0)] UNSPEC_SET_GOT))
-+ (clobber (reg:CC 17))]
- "!TARGET_64BIT"
--{
-- if (GET_CODE (operands[1]) == LABEL_REF)
-- operands[1] = XEXP (operands[1], 0);
-- output_asm_insn ("call\t%X1", operands);
-- if (! TARGET_DEEP_BRANCH_PREDICTION)
-- {
-- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
-- CODE_LABEL_NUMBER (operands[1]));
-- return "pop{l}\t%0";
-- }
-- RET;
--}
-- [(set_attr "type" "multi")])
-+ { return output_set_got (operands[0]); }
-+ [(set_attr "type" "multi")
-+ (set_attr "length" "12")])
-
- (define_expand "epilogue"
- [(const_int 1)]
-@@ -13996,6 +13916,127 @@
- ;; ffshi2 is not useful -- 4 word prefix ops are needed, which is larger
- ;; and slower than the two-byte movzx insn needed to do the work in SImode.
- \f
-+;; Thread-local storage patterns for ELF.
-+;;
-+;; Note that these code sequences must appear exactly as shown
-+;; in order to allow linker relaxation.
-+
-+(define_insn "*tls_global_dynamic_gnu"
-+ [(set (match_operand:SI 0 "register_operand" "=a")
-+ (unspec:SI [(match_operand:SI 1 "register_operand" "b")
-+ (match_operand:SI 2 "tls_symbolic_operand" "")
-+ (match_operand:SI 3 "call_insn_operand" "")]
-+ UNSPEC_TLS_GD))
-+ (clobber (match_scratch:SI 4 "=d"))
-+ (clobber (match_scratch:SI 5 "=c"))
-+ (clobber (reg:CC 17))]
-+ "TARGET_GNU_TLS"
-+ "lea{l}\t{%a2@TLSGD(,%1,1), %0|%0, %a2@TLSGD[%1*1]}\;call\t%P3"
-+ [(set_attr "type" "multi")
-+ (set_attr "length" "12")])
-+
-+(define_insn "*tls_global_dynamic_sun"
-+ [(set (match_operand:SI 0 "register_operand" "=a")
-+ (unspec:SI [(match_operand:SI 1 "register_operand" "b")
-+ (match_operand:SI 2 "tls_symbolic_operand" "")
-+ (match_operand:SI 3 "call_insn_operand" "")]
-+ UNSPEC_TLS_GD))
-+ (clobber (match_scratch:SI 4 "=d"))
-+ (clobber (match_scratch:SI 5 "=c"))
-+ (clobber (reg:CC 17))]
-+ "TARGET_SUN_TLS"
-+ "lea{l}\t{%a2@DTLNDX(%1), %4|%4, %a2@DTLNDX[%1]}
-+ push{l}\t%4\;call\t%a2@TLSPLT\;pop{l}\t%4\;nop"
-+ [(set_attr "type" "multi")
-+ (set_attr "length" "14")])
-+
-+(define_expand "tls_global_dynamic"
-+ [(parallel [(set (match_operand:SI 0 "register_operand" "")
-+ (unspec:SI
-+ [(match_dup 2)
-+ (match_operand:SI 1 "tls_symbolic_operand" "")
-+ (match_dup 3)]
-+ UNSPEC_TLS_GD))
-+ (clobber (match_scratch:SI 4 ""))
-+ (clobber (match_scratch:SI 5 ""))
-+ (clobber (reg:CC 17))])]
-+ ""
-+{
-+ if (!flag_pic)
-+ abort ();
-+ current_function_uses_pic_offset_table = 1;
-+ operands[2] = pic_offset_table_rtx;
-+ operands[3] = ix86_tls_get_addr ();
-+})
-+
-+(define_insn "*tls_local_dynamic_base_gnu"
-+ [(set (match_operand:SI 0 "register_operand" "=a")
-+ (unspec:SI [(match_operand:SI 1 "register_operand" "b")
-+ (match_operand:SI 2 "call_insn_operand" "")]
-+ UNSPEC_TLS_LD_BASE))
-+ (clobber (match_scratch:SI 3 "=d"))
-+ (clobber (match_scratch:SI 4 "=c"))
-+ (clobber (reg:CC 17))]
-+ "TARGET_GNU_TLS"
-+ "lea{l}\t{%&@TLSLDM(%1), %0|%0, %&@TLSLDM[%1]}\;call\t%P2"
-+ [(set_attr "type" "multi")
-+ (set_attr "length" "11")])
-+
-+(define_insn "*tls_local_dynamic_base_sun"
-+ [(set (match_operand:SI 0 "register_operand" "=a")
-+ (unspec:SI [(match_operand:SI 1 "register_operand" "b")
-+ (match_operand:SI 2 "call_insn_operand" "")]
-+ UNSPEC_TLS_LD_BASE))
-+ (clobber (match_scratch:SI 3 "=d"))
-+ (clobber (match_scratch:SI 4 "=c"))
-+ (clobber (reg:CC 17))]
-+ "TARGET_SUN_TLS"
-+ "lea{l}\t{%&@TMDNX(%1), %3|%3, %&@TMDNX[%1]}
-+ push{l}\t%3\;call\t%&@TLSPLT\;pop{l}\t%3"
-+ [(set_attr "type" "multi")
-+ (set_attr "length" "13")])
-+
-+(define_expand "tls_local_dynamic_base"
-+ [(parallel [(set (match_operand:SI 0 "register_operand" "")
-+ (unspec:SI [(match_dup 1) (match_dup 2)]
-+ UNSPEC_TLS_LD_BASE))
-+ (clobber (match_scratch:SI 3 ""))
-+ (clobber (match_scratch:SI 4 ""))
-+ (clobber (reg:CC 17))])]
-+ ""
-+{
-+ if (!flag_pic)
-+ abort ();
-+ current_function_uses_pic_offset_table = 1;
-+ operands[1] = pic_offset_table_rtx;
-+ operands[2] = ix86_tls_get_addr ();
-+})
-+
-+;; Local dynamic of a single variable is a lose. Show combine how
-+;; to convert that back to global dynamic.
-+
-+(define_insn_and_split "*tls_local_dynamic_once"
-+ [(set (match_operand:SI 0 "register_operand" "=a")
-+ (plus:SI (unspec:SI [(match_operand:SI 1 "register_operand" "b")
-+ (match_operand:SI 2 "call_insn_operand" "")]
-+ UNSPEC_TLS_LD_BASE)
-+ (const:SI (unspec:SI
-+ [(match_operand:SI 3 "tls_symbolic_operand" "")]
-+ UNSPEC_DTPOFF))))
-+ (clobber (match_scratch:SI 4 "=d"))
-+ (clobber (match_scratch:SI 5 "=c"))
-+ (clobber (reg:CC 17))]
-+ ""
-+ "#"
-+ ""
-+ [(parallel [(set (match_dup 0)
-+ (unspec:SI [(match_dup 1) (match_dup 3) (match_dup 2)]
-+ UNSPEC_TLS_GD))
-+ (clobber (match_dup 4))
-+ (clobber (match_dup 5))
-+ (clobber (reg:CC 17))])]
-+ "")
-+\f
- ;; These patterns match the binary 387 instructions for addM3, subM3,
- ;; mulM3 and divM3. There are three patterns for each of DFmode and
- ;; SFmode. The first is the normal insn, the second the same insn but
-@@ -16835,7 +16876,7 @@
- [(label_ref (match_operand 0 "" ""))]
- "!TARGET_64BIT && flag_pic"
- {
-- load_pic_register ();
-+ emit_insn (gen_set_got (pic_offset_table_rtx));
- DONE;
- })
- \f
---- gcc/config/ia64/ia64-protos.h.jj Tue Apr 23 20:28:20 2002
-+++ gcc/config/ia64/ia64-protos.h Wed Jun 19 19:33:52 2002
-@@ -31,6 +31,7 @@ extern int call_operand PARAMS((rtx, enu
- extern int sdata_symbolic_operand PARAMS((rtx, enum machine_mode));
- extern int got_symbolic_operand PARAMS((rtx, enum machine_mode));
- extern int symbolic_operand PARAMS((rtx, enum machine_mode));
-+extern int tls_symbolic_operand PARAMS((rtx, enum machine_mode));
- extern int function_operand PARAMS((rtx, enum machine_mode));
- extern int setjmp_operand PARAMS((rtx, enum machine_mode));
- extern int move_operand PARAMS((rtx, enum machine_mode));
-@@ -67,6 +68,7 @@ extern int general_tfmode_operand PARAMS
- extern int destination_tfmode_operand PARAMS((rtx, enum machine_mode));
- extern int tfreg_or_fp01_operand PARAMS((rtx, enum machine_mode));
-
-+extern rtx ia64_expand_move PARAMS ((rtx, rtx));
- extern int ia64_move_ok PARAMS((rtx, rtx));
- extern int ia64_depz_field_mask PARAMS((rtx, rtx));
- extern rtx ia64_gp_save_reg PARAMS((int));
---- gcc/config/ia64/ia64.c.jj Wed Jun 19 22:36:54 2002
-+++ gcc/config/ia64/ia64.c Wed Jun 19 22:46:07 2002
-@@ -95,6 +95,13 @@ static const char * const ia64_output_re
- /* String used with the -mfixed-range= option. */
- const char *ia64_fixed_range_string;
-
-+/* Determines whether we use adds, addl, or movl to generate our
-+ TLS immediate offsets. */
-+int ia64_tls_size = 22;
-+
-+/* String used with the -mtls-size= option. */
-+const char *ia64_tls_size_string;
-+
- /* Determines whether we run our final scheduling pass or not. We always
- avoid the normal second scheduling pass. */
- static int ia64_flag_schedule_insns2;
-@@ -104,6 +111,8 @@ static int ia64_flag_schedule_insns2;
-
- unsigned int ia64_section_threshold;
- \f
-+static rtx gen_tls_get_addr PARAMS ((void));
-+static rtx gen_thread_pointer PARAMS ((void));
- static int find_gr_spill PARAMS ((int));
- static int next_scratch_gr_reg PARAMS ((void));
- static void mark_reg_gr_used_mask PARAMS ((rtx, void *));
-@@ -214,6 +223,11 @@ static const struct attribute_spec ia64_
- #undef TARGET_SCHED_CYCLE_DISPLAY
- #define TARGET_SCHED_CYCLE_DISPLAY ia64_cycle_display
-
-+#ifdef HAVE_AS_TLS
-+#undef TARGET_HAVE_TLS
-+#define TARGET_HAVE_TLS true
-+#endif
-+
- struct gcc_target targetm = TARGET_INITIALIZER;
- \f
- /* Return 1 if OP is a valid operand for the MEM of a CALL insn. */
-@@ -250,7 +264,10 @@ sdata_symbolic_operand (op, mode)
- if (CONSTANT_POOL_ADDRESS_P (op))
- return GET_MODE_SIZE (get_pool_mode (op)) <= ia64_section_threshold;
- else
-- return XSTR (op, 0)[0] == SDATA_NAME_FLAG_CHAR;
-+ {
-+ const char *str = XSTR (op, 0);
-+ return (str[0] == ENCODE_SECTION_INFO_CHAR && str[1] == 's');
-+ }
-
- default:
- break;
-@@ -324,6 +341,35 @@ symbolic_operand (op, mode)
- return 0;
- }
-
-+/* Return tls_model if OP refers to a TLS symbol. */
-+
-+int
-+tls_symbolic_operand (op, mode)
-+ rtx op;
-+ enum machine_mode mode ATTRIBUTE_UNUSED;
-+{
-+ const char *str;
-+
-+ if (GET_CODE (op) != SYMBOL_REF)
-+ return 0;
-+ str = XSTR (op, 0);
-+ if (str[0] != ENCODE_SECTION_INFO_CHAR)
-+ return 0;
-+ switch (str[1])
-+ {
-+ case 'G':
-+ return TLS_MODEL_GLOBAL_DYNAMIC;
-+ case 'L':
-+ return TLS_MODEL_LOCAL_DYNAMIC;
-+ case 'i':
-+ return TLS_MODEL_INITIAL_EXEC;
-+ case 'l':
-+ return TLS_MODEL_LOCAL_EXEC;
-+ }
-+ return 0;
-+}
-+
-+
- /* Return 1 if OP refers to a function. */
-
- int
-@@ -922,6 +968,9 @@ ia64_expand_load_address (dest, src, scr
- else
- temp = dest;
-
-+ if (tls_symbolic_operand (src, Pmode))
-+ abort ();
-+
- if (TARGET_AUTO_PIC)
- emit_insn (gen_load_gprel64 (temp, src));
- else if (GET_CODE (src) == SYMBOL_REF && SYMBOL_REF_FLAG (src))
-@@ -964,6 +1013,185 @@ ia64_expand_load_address (dest, src, scr
- emit_move_insn (dest, temp);
- }
-
-+static rtx
-+gen_tls_get_addr ()
-+{
-+ static rtx tga;
-+ if (!tga)
-+ {
-+ tga = init_one_libfunc ("__tls_get_addr");
-+ ggc_add_rtx_root (&tga, 1);
-+ }
-+ return tga;
-+}
-+
-+static rtx
-+gen_thread_pointer ()
-+{
-+ static rtx tp;
-+ if (!tp)
-+ {
-+ tp = gen_rtx_REG (Pmode, 13);
-+ RTX_UNCHANGING_P (tp) = 1;
-+ ggc_add_rtx_root (&tp, 1);
-+ }
-+ return tp;
-+}
-+
-+rtx
-+ia64_expand_move (op0, op1)
-+ rtx op0, op1;
-+{
-+ enum machine_mode mode = GET_MODE (op0);
-+
-+ if (!reload_in_progress && !reload_completed && !ia64_move_ok (op0, op1))
-+ op1 = force_reg (mode, op1);
-+
-+ if (mode == Pmode)
-+ {
-+ enum tls_model tls_kind;
-+ if ((tls_kind = tls_symbolic_operand (op1, Pmode)))
-+ {
-+ rtx tga_op1, tga_op2, tga_ret, tga_eqv, tmp, insns;
-+
-+ switch (tls_kind)
-+ {
-+ case TLS_MODEL_GLOBAL_DYNAMIC:
-+ start_sequence ();
-+
-+ tga_op1 = gen_reg_rtx (Pmode);
-+ emit_insn (gen_load_ltoff_dtpmod (tga_op1, op1));
-+ tga_op1 = gen_rtx_MEM (Pmode, tga_op1);
-+ RTX_UNCHANGING_P (tga_op1) = 1;
-+
-+ tga_op2 = gen_reg_rtx (Pmode);
-+ emit_insn (gen_load_ltoff_dtprel (tga_op2, op1));
-+ tga_op2 = gen_rtx_MEM (Pmode, tga_op2);
-+ RTX_UNCHANGING_P (tga_op2) = 1;
-+
-+ tga_ret = emit_library_call_value (gen_tls_get_addr (), NULL_RTX,
-+ LCT_CONST, Pmode, 2, tga_op1,
-+ Pmode, tga_op2, Pmode);
-+
-+ insns = get_insns ();
-+ end_sequence ();
-+
-+ emit_libcall_block (insns, op0, tga_ret, op1);
-+ return NULL_RTX;
-+
-+ case TLS_MODEL_LOCAL_DYNAMIC:
-+ /* ??? This isn't the completely proper way to do local-dynamic
-+ If the call to __tls_get_addr is used only by a single symbol,
-+ then we should (somehow) move the dtprel to the second arg
-+ to avoid the extra add. */
-+ start_sequence ();
-+
-+ tga_op1 = gen_reg_rtx (Pmode);
-+ emit_insn (gen_load_ltoff_dtpmod (tga_op1, op1));
-+ tga_op1 = gen_rtx_MEM (Pmode, tga_op1);
-+ RTX_UNCHANGING_P (tga_op1) = 1;
-+
-+ tga_op2 = const0_rtx;
-+
-+ tga_ret = emit_library_call_value (gen_tls_get_addr (), NULL_RTX,
-+ LCT_CONST, Pmode, 2, tga_op1,
-+ Pmode, tga_op2, Pmode);
-+
-+ insns = get_insns ();
-+ end_sequence ();
-+
-+ tga_eqv = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const0_rtx),
-+ UNSPEC_LD_BASE);
-+ tmp = gen_reg_rtx (Pmode);
-+ emit_libcall_block (insns, tmp, tga_ret, tga_eqv);
-+
-+ if (register_operand (op0, Pmode))
-+ tga_ret = op0;
-+ else
-+ tga_ret = gen_reg_rtx (Pmode);
-+ if (TARGET_TLS64)
-+ {
-+ emit_insn (gen_load_dtprel (tga_ret, op1));
-+ emit_insn (gen_adddi3 (tga_ret, tmp, tga_ret));
-+ }
-+ else
-+ emit_insn (gen_add_dtprel (tga_ret, tmp, op1));
-+ if (tga_ret == op0)
-+ return NULL_RTX;
-+ op1 = tga_ret;
-+ break;
-+
-+ case TLS_MODEL_INITIAL_EXEC:
-+ tmp = gen_reg_rtx (Pmode);
-+ emit_insn (gen_load_ltoff_tprel (tmp, op1));
-+ tmp = gen_rtx_MEM (Pmode, tmp);
-+ RTX_UNCHANGING_P (tmp) = 1;
-+ tmp = force_reg (Pmode, tmp);
-+
-+ if (register_operand (op0, Pmode))
-+ op1 = op0;
-+ else
-+ op1 = gen_reg_rtx (Pmode);
-+ emit_insn (gen_adddi3 (op1, tmp, gen_thread_pointer ()));
-+ if (op1 == op0)
-+ return NULL_RTX;
-+ break;
-+
-+ case TLS_MODEL_LOCAL_EXEC:
-+ if (register_operand (op0, Pmode))
-+ tmp = op0;
-+ else
-+ tmp = gen_reg_rtx (Pmode);
-+ if (TARGET_TLS64)
-+ {
-+ emit_insn (gen_load_tprel (tmp, op1));
-+ emit_insn (gen_adddi3 (tmp, gen_thread_pointer (), tmp));
-+ }
-+ else
-+ emit_insn (gen_add_tprel (tmp, gen_thread_pointer (), op1));
-+ if (tmp == op0)
-+ return NULL_RTX;
-+ op1 = tmp;
-+ break;
-+
-+ default:
-+ abort ();
-+ }
-+ }
-+ else if (!TARGET_NO_PIC && symbolic_operand (op1, DImode))
-+ {
-+ /* Before optimization starts, delay committing to any particular
-+ type of PIC address load. If this function gets deferred, we
-+ may acquire information that changes the value of the
-+ sdata_symbolic_operand predicate.
-+
-+ But don't delay for function pointers. Loading a function address
-+ actually loads the address of the descriptor not the function.
-+ If we represent these as SYMBOL_REFs, then they get cse'd with
-+ calls, and we end up with calls to the descriptor address instead
-+ of calls to the function address. Functions are not candidates
-+ for sdata anyways.
-+
-+ Don't delay for LABEL_REF because the splitter loses REG_LABEL
-+ notes. Don't delay for pool addresses on general principals;
-+ they'll never become non-local behind our back. */
-+
-+ if (rtx_equal_function_value_matters
-+ && GET_CODE (op1) != LABEL_REF
-+ && ! (GET_CODE (op1) == SYMBOL_REF
-+ && (SYMBOL_REF_FLAG (op1)
-+ || CONSTANT_POOL_ADDRESS_P (op1)
-+ || STRING_POOL_ADDRESS_P (op1))))
-+ emit_insn (gen_movdi_symbolic (op0, op1));
-+ else
-+ ia64_expand_load_address (op0, op1, NULL_RTX);
-+ return NULL_RTX;
-+ }
-+ }
-+
-+ return op1;
-+}
-+
- rtx
- ia64_gp_save_reg (setjmp_p)
- int setjmp_p;
-@@ -3944,6 +4172,16 @@ ia64_override_options ()
- if (ia64_fixed_range_string)
- fix_range (ia64_fixed_range_string);
-
-+ if (ia64_tls_size_string)
-+ {
-+ char *end;
-+ unsigned long tmp = strtoul (ia64_tls_size_string, &end, 10);
-+ if (*end || (tmp != 14 && tmp != 22 && tmp != 64))
-+ error ("bad value (%s) for -mtls-size= switch", ia64_tls_size_string);
-+ else
-+ ia64_tls_size = tmp;
-+ }
-+
- ia64_flag_schedule_insns2 = flag_schedule_insns_after_reload;
- flag_schedule_insns_after_reload = 0;
-
-@@ -4607,6 +4845,13 @@ rtx_needs_barrier (x, flags, pred)
- need_barrier |= rtx_needs_barrier (XVECEXP (x, 0, 2), flags, pred);
- break;
-
-+ case UNSPEC_LTOFF_DTPMOD:
-+ case UNSPEC_LTOFF_DTPREL:
-+ case UNSPEC_DTPREL:
-+ case UNSPEC_LTOFF_TPREL:
-+ case UNSPEC_TPREL:
-+ break;
-+
- default:
- abort ();
- }
-@@ -6872,6 +7117,9 @@ ia64_encode_section_info (decl)
- tree decl;
- {
- const char *symbol_str;
-+ bool is_local, is_small;
-+ rtx symbol;
-+ char encoding = 0;
-
- if (TREE_CODE (decl) == FUNCTION_DECL)
- {
-@@ -6885,75 +7133,111 @@ ia64_encode_section_info (decl)
- || GET_CODE (XEXP (DECL_RTL (decl), 0)) != SYMBOL_REF)
- return;
-
-- symbol_str = XSTR (XEXP (DECL_RTL (decl), 0), 0);
-+ symbol = XEXP (DECL_RTL (decl), 0);
-+ symbol_str = XSTR (symbol, 0);
-+
-+ /* A non-decl is an entry in the constant pool. */
-+ if (!DECL_P (decl))
-+ is_local = true;
-+ /* Static variables are always local. */
-+ else if (! TREE_PUBLIC (decl))
-+ is_local = true;
-+ /* A variable is local if the user tells us so. */
-+ else if (MODULE_LOCAL_P (decl))
-+ is_local = true;
-+ /* Otherwise, variables defined outside this object may not be local. */
-+ else if (DECL_EXTERNAL (decl))
-+ is_local = false;
-+ /* Linkonce and weak data are never local. */
-+ else if (DECL_ONE_ONLY (decl) || DECL_WEAK (decl))
-+ is_local = false;
-+ /* If PIC, then assume that any global name can be overridden by
-+ symbols resolved from other modules. */
-+ else if (flag_pic)
-+ is_local = false;
-+ /* Uninitialized COMMON variable may be unified with symbols
-+ resolved from other modules. */
-+ else if (DECL_COMMON (decl)
-+ && (DECL_INITIAL (decl) == NULL
-+ || DECL_INITIAL (decl) == error_mark_node))
-+ is_local = false;
-+ /* Otherwise we're left with initialized (or non-common) global data
-+ which is of necessity defined locally. */
-+ else
-+ is_local = true;
-
-- /* We assume that -fpic is used only to create a shared library (dso).
-- With -fpic, no global data can ever be sdata.
-- Without -fpic, global common uninitialized data can never be sdata, since
-- it can unify with a real definition in a dso. */
-- /* ??? Actually, we can put globals in sdata, as long as we don't use gprel
-- to access them. The linker may then be able to do linker relaxation to
-- optimize references to them. Currently sdata implies use of gprel. */
-- /* We need the DECL_EXTERNAL check for C++. static class data members get
-- both TREE_STATIC and DECL_EXTERNAL set, to indicate that they are
-- statically allocated, but the space is allocated somewhere else. Such
-- decls can not be own data. */
-- if (! TARGET_NO_SDATA
-- && ((TREE_STATIC (decl) && ! DECL_EXTERNAL (decl)
-- && ! (DECL_ONE_ONLY (decl) || DECL_WEAK (decl))
-- && ! (TREE_PUBLIC (decl)
-- && (flag_pic
-- || (DECL_COMMON (decl)
-- && (DECL_INITIAL (decl) == 0
-- || DECL_INITIAL (decl) == error_mark_node)))))
-- || MODULE_LOCAL_P (decl))
-- /* Either the variable must be declared without a section attribute,
-- or the section must be sdata or sbss. */
-- && (DECL_SECTION_NAME (decl) == 0
-- || ! strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)),
-- ".sdata")
-- || ! strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)),
-- ".sbss")))
-+ is_small = false;
-+ if (TARGET_NO_SDATA)
-+ ;
-+ else if (TREE_CODE (decl) == VAR_DECL && DECL_SECTION_NAME (decl))
-+ {
-+ const char *section = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
-+ if (strcmp (section, ".sdata") == 0
-+ || strcmp (section, ".sbss") == 0)
-+ is_small = true;
-+ }
-+ else
- {
- HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (decl));
-
-- /* If the variable has already been defined in the output file, then it
-- is too late to put it in sdata if it wasn't put there in the first
-- place. The test is here rather than above, because if it is already
-- in sdata, then it can stay there. */
--
-- if (TREE_ASM_WRITTEN (decl))
-- ;
--
-- /* If this is an incomplete type with size 0, then we can't put it in
-- sdata because it might be too big when completed.
-- Objects bigger than threshold should have SDATA_NAME_FLAG_CHAR
-- added if they are in .sdata or .sbss explicitely. */
-- else if (((size > 0
-- && size <= (HOST_WIDE_INT) ia64_section_threshold)
-- || DECL_SECTION_NAME (decl))
-- && symbol_str[0] != SDATA_NAME_FLAG_CHAR)
-- {
-- size_t len = strlen (symbol_str);
-- char *newstr = alloca (len + 1);
-- const char *string;
-+ /* If this is an incomplete type with size 0, then we can't put it
-+ in sdata because it might be too big when completed. */
-+ if (size > 0 && size <= ia64_section_threshold)
-+ is_small = true;
-+ }
-
-- *newstr = SDATA_NAME_FLAG_CHAR;
-- memcpy (newstr + 1, symbol_str, len + 1);
--
-- string = ggc_alloc_string (newstr, len + 1);
-- XSTR (XEXP (DECL_RTL (decl), 0), 0) = string;
-+ if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl))
-+ {
-+ enum tls_model kind;
-+ if (!flag_pic)
-+ {
-+ if (is_local)
-+ kind = TLS_MODEL_LOCAL_EXEC;
-+ else
-+ kind = TLS_MODEL_INITIAL_EXEC;
- }
-- }
-- /* This decl is marked as being in small data/bss but it shouldn't
-- be; one likely explanation for this is that the decl has been
-- moved into a different section from the one it was in when
-- ENCODE_SECTION_INFO was first called. Remove the '@'. */
-- else if (symbol_str[0] == SDATA_NAME_FLAG_CHAR)
-+ else if (is_local)
-+ kind = TLS_MODEL_LOCAL_DYNAMIC;
-+ else
-+ kind = TLS_MODEL_GLOBAL_DYNAMIC;
-+ if (kind < flag_tls_default)
-+ kind = flag_tls_default;
-+
-+ encoding = " GLil"[kind];
-+ }
-+ /* Determine if DECL will wind up in .sdata/.sbss. */
-+ else if (is_local && is_small)
-+ encoding = 's';
-+
-+ /* Finally, encode this into the symbol string. */
-+ if (encoding)
- {
-- XSTR (XEXP (DECL_RTL (decl), 0), 0)
-- = ggc_strdup (symbol_str + 1);
-+ char *newstr;
-+ size_t len;
-+
-+ if (symbol_str[0] == ENCODE_SECTION_INFO_CHAR)
-+ {
-+ if (encoding == symbol_str[1])
-+ return;
-+ /* ??? Sdata became thread or thread becaome not thread. Lose. */
-+ abort ();
-+ }
-+
-+ len = strlen (symbol_str);
-+ newstr = alloca (len + 3);
-+ newstr[0] = ENCODE_SECTION_INFO_CHAR;
-+ newstr[1] = encoding;
-+ memcpy (newstr + 2, symbol_str, len + 1);
-+
-+ XSTR (symbol, 0) = ggc_alloc_string (newstr, len + 2);
- }
-+
-+ /* This decl is marked as being in small data/bss but it shouldn't be;
-+ one likely explanation for this is that the decl has been moved into
-+ a different section from the one it was in when encode_section_info
-+ was first called. Remove the encoding. */
-+ else if (symbol_str[0] == ENCODE_SECTION_INFO_CHAR)
-+ XSTR (symbol, 0) = ggc_strdup (symbol_str + 2);
- }
- \f
- /* Output assembly directives for prologue regions. */
---- gcc/config/ia64/ia64.h.jj Tue Apr 23 20:28:21 2002
-+++ gcc/config/ia64/ia64.h Wed Jun 19 19:33:52 2002
-@@ -109,6 +109,11 @@ extern int target_flags;
-
- #define TARGET_DWARF2_ASM (target_flags & MASK_DWARF2_ASM)
-
-+extern int ia64_tls_size;
-+#define TARGET_TLS14 (ia64_tls_size == 14)
-+#define TARGET_TLS22 (ia64_tls_size == 22)
-+#define TARGET_TLS64 (ia64_tls_size == 64)
-+
- /* This macro defines names of command options to set and clear bits in
- `target_flags'. Its definition is an initializer with a subgrouping for
- each command option. */
-@@ -177,10 +182,13 @@ extern int target_flags;
- subgrouping for each command option. */
-
- extern const char *ia64_fixed_range_string;
-+extern const char *ia64_tls_size_string;
- #define TARGET_OPTIONS \
- { \
- { "fixed-range=", &ia64_fixed_range_string, \
- N_("Specify range of registers to make fixed")}, \
-+ { "tls-size=", &ia64_tls_size_string, \
-+ N_("Specify bit size of immediate TLS offsets")}, \
- }
-
- /* Sometimes certain combinations of command options do not make sense on a
-@@ -1801,7 +1809,7 @@ do { \
- && (DECL_ONE_ONLY (DECL) || DECL_WEAK (DECL) || DECL_COMMON (DECL) \
- || DECL_SECTION_NAME (DECL) != 0))
-
--#define SDATA_NAME_FLAG_CHAR '@'
-+#define ENCODE_SECTION_INFO_CHAR '@'
-
- #define IA64_DEFAULT_GVALUE 8
-
-@@ -1811,8 +1819,8 @@ do { \
- #define STRIP_NAME_ENCODING(VAR, SYMBOL_NAME) \
- do { \
- (VAR) = (SYMBOL_NAME); \
-- if ((VAR)[0] == SDATA_NAME_FLAG_CHAR) \
-- (VAR)++; \
-+ if ((VAR)[0] == ENCODE_SECTION_INFO_CHAR) \
-+ (VAR) += 2; \
- if ((VAR)[0] == '*') \
- (VAR)++; \
- } while (0)
---- gcc/config/ia64/ia64.md.jj Tue Apr 23 20:28:21 2002
-+++ gcc/config/ia64/ia64.md Wed Jun 19 19:33:52 2002
-@@ -68,7 +68,19 @@
- ;; 23 cycle display
- ;; 24 addp4
- ;; 25 prologue_use
--;;
-+
-+;; More unspec:
-+
-+(define_constants
-+ [; Relocations
-+ (UNSPEC_LTOFF_DTPMOD 14)
-+ (UNSPEC_LTOFF_DTPREL 15)
-+ (UNSPEC_DTPREL 16)
-+ (UNSPEC_LTOFF_TPREL 17)
-+ (UNSPEC_TPREL 18)
-+ (UNSPEC_LD_BASE 26)
-+ ])
-+
- ;; unspec_volatile:
- ;; 0 alloc
- ;; 1 blockage
-@@ -272,12 +284,12 @@
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
-- "
- {
-- if (! reload_in_progress && ! reload_completed
-- && ! ia64_move_ok (operands[0], operands[1]))
-- operands[1] = force_reg (QImode, operands[1]);
--}")
-+ rtx op1 = ia64_expand_move (operands[0], operands[1]);
-+ if (!op1)
-+ DONE;
-+ operands[1] = op1;
-+})
-
- (define_insn "*movqi_internal"
- [(set (match_operand:QI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
-@@ -297,12 +309,12 @@
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
-- "
- {
-- if (! reload_in_progress && ! reload_completed
-- && ! ia64_move_ok (operands[0], operands[1]))
-- operands[1] = force_reg (HImode, operands[1]);
--}")
-+ rtx op1 = ia64_expand_move (operands[0], operands[1]);
-+ if (!op1)
-+ DONE;
-+ operands[1] = op1;
-+})
-
- (define_insn "*movhi_internal"
- [(set (match_operand:HI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
-@@ -322,12 +334,12 @@
- [(set (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
-- "
- {
-- if (! reload_in_progress && ! reload_completed
-- && ! ia64_move_ok (operands[0], operands[1]))
-- operands[1] = force_reg (SImode, operands[1]);
--}")
-+ rtx op1 = ia64_expand_move (operands[0], operands[1]);
-+ if (!op1)
-+ DONE;
-+ operands[1] = op1;
-+})
-
- (define_insn "*movsi_internal"
- [(set (match_operand:SI 0 "destination_operand" "=r,r,r,r, m, r,*f,*f, r,*d")
-@@ -351,32 +363,12 @@
- [(set (match_operand:DI 0 "general_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- ""
-- "
- {
-- if (! reload_in_progress && ! reload_completed
-- && ! ia64_move_ok (operands[0], operands[1]))
-- operands[1] = force_reg (DImode, operands[1]);
-- if (! TARGET_NO_PIC && symbolic_operand (operands[1], DImode))
-- {
-- /* Before optimization starts, delay committing to any particular
-- type of PIC address load. If this function gets deferred, we
-- may acquire information that changes the value of the
-- sdata_symbolic_operand predicate. */
-- /* But don't delay for function pointers. Loading a function address
-- actually loads the address of the descriptor not the function.
-- If we represent these as SYMBOL_REFs, then they get cse'd with
-- calls, and we end up with calls to the descriptor address instead of
-- calls to the function address. Functions are not candidates for
-- sdata anyways. */
-- if (rtx_equal_function_value_matters
-- && ! (GET_CODE (operands[1]) == SYMBOL_REF
-- && SYMBOL_REF_FLAG (operands[1])))
-- emit_insn (gen_movdi_symbolic (operands[0], operands[1], gen_reg_rtx (DImode)));
-- else
-- ia64_expand_load_address (operands[0], operands[1], NULL_RTX);
-- DONE;
-- }
--}")
-+ rtx op1 = ia64_expand_move (operands[0], operands[1]);
-+ if (!op1)
-+ DONE;
-+ operands[1] = op1;
-+})
-
- ;; This is used during early compilation to delay the decision on
- ;; how to refer to a variable as long as possible. This is especially
-@@ -384,19 +376,22 @@
- ;; deferred functions, since we may acquire additional information
- ;; on the variables used in the meantime.
-
--;; ??? This causes us to lose REG_LABEL notes, because the insn splitter
--;; does not attempt to preserve any REG_NOTES on the input instruction.
--
- (define_insn_and_split "movdi_symbolic"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (match_operand:DI 1 "symbolic_operand" "s"))
-- (clobber (match_operand:DI 2 "register_operand" "+r"))
-+ (clobber (match_scratch:DI 2 "=r"))
- (use (reg:DI 1))]
- ""
- "* abort ();"
-- ""
-+ "!no_new_pseudos || reload_completed"
- [(const_int 0)]
-- "ia64_expand_load_address (operands[0], operands[1], operands[2]); DONE;")
-+{
-+ rtx scratch = operands[2];
-+ if (!reload_completed)
-+ gen_reg_rtx (Pmode);
-+ ia64_expand_load_address (operands[0], operands[1], scratch);
-+ DONE;
-+})
-
- (define_insn "*movdi_internal"
- [(set (match_operand:DI 0 "destination_operand"
-@@ -510,6 +505,131 @@
- "addl %0 = @ltoff(%1), gp"
- [(set_attr "itanium_class" "ialu")])
-
-+(define_insn "load_ltoff_dtpmod"
-+ [(set (match_operand:DI 0 "register_operand" "=r")
-+ (plus:DI (reg:DI 1)
-+ (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
-+ UNSPEC_LTOFF_DTPMOD)))]
-+ ""
-+ "addl %0 = @ltoff(@dtpmod(%1)), gp"
-+ [(set_attr "itanium_class" "ialu")])
-+
-+(define_insn "load_ltoff_dtprel"
-+ [(set (match_operand:DI 0 "register_operand" "=r")
-+ (plus:DI (reg:DI 1)
-+ (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
-+ UNSPEC_LTOFF_DTPREL)))]
-+ ""
-+ "addl %0 = @ltoff(@dtprel(%1)), gp"
-+ [(set_attr "itanium_class" "ialu")])
-+
-+(define_expand "load_dtprel"
-+ [(set (match_operand:DI 0 "register_operand" "")
-+ (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
-+ UNSPEC_DTPREL))]
-+ ""
-+ "")
-+
-+(define_insn "*load_dtprel64"
-+ [(set (match_operand:DI 0 "register_operand" "=r")
-+ (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
-+ UNSPEC_DTPREL))]
-+ "TARGET_TLS64"
-+ "movl %0 = @dtprel(%1)"
-+ [(set_attr "itanium_class" "long_i")])
-+
-+(define_insn "*load_dtprel22"
-+ [(set (match_operand:DI 0 "register_operand" "=r")
-+ (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
-+ UNSPEC_DTPREL))]
-+ ""
-+ "addl %0 = @dtprel(%1), r0"
-+ [(set_attr "itanium_class" "ialu")])
-+
-+(define_expand "add_dtprel"
-+ [(set (match_operand:DI 0 "register_operand" "")
-+ (plus:DI (match_operand:DI 1 "register_operand" "")
-+ (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
-+ UNSPEC_DTPREL)))]
-+ "!TARGET_TLS64"
-+ "")
-+
-+(define_insn "*add_dtprel14"
-+ [(set (match_operand:DI 0 "register_operand" "=r")
-+ (plus:DI (match_operand:DI 1 "register_operand" "r")
-+ (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
-+ UNSPEC_DTPREL)))]
-+ "TARGET_TLS14"
-+ "adds %0 = @dtprel(%2), %1"
-+ [(set_attr "itanium_class" "ialu")])
-+
-+(define_insn "*add_dtprel22"
-+ [(set (match_operand:DI 0 "register_operand" "=r")
-+ (plus:DI (match_operand:DI 1 "register_operand" "a")
-+ (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
-+ UNSPEC_DTPREL)))]
-+ "TARGET_TLS22"
-+ "addl %0 = @dtprel(%2), %1"
-+ [(set_attr "itanium_class" "ialu")])
-+
-+(define_insn "load_ltoff_tprel"
-+ [(set (match_operand:DI 0 "register_operand" "=r")
-+ (plus:DI (reg:DI 1)
-+ (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
-+ UNSPEC_LTOFF_TPREL)))]
-+ ""
-+ "addl %0 = @ltoff(@tprel(%1)), gp"
-+ [(set_attr "itanium_class" "ialu")])
-+
-+(define_expand "load_tprel"
-+ [(set (match_operand:DI 0 "register_operand" "")
-+ (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
-+ UNSPEC_TPREL))]
-+ ""
-+ "")
-+
-+(define_insn "*load_tprel64"
-+ [(set (match_operand:DI 0 "register_operand" "=r")
-+ (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
-+ UNSPEC_TPREL))]
-+ "TARGET_TLS64"
-+ "movl %0 = @tprel(%1)"
-+ [(set_attr "itanium_class" "long_i")])
-+
-+(define_insn "*load_tprel22"
-+ [(set (match_operand:DI 0 "register_operand" "=r")
-+ (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
-+ UNSPEC_TPREL))]
-+ ""
-+ "addl %0 = @tprel(%1), r0"
-+ [(set_attr "itanium_class" "ialu")])
-+
-+(define_expand "add_tprel"
-+ [(set (match_operand:DI 0 "register_operand" "")
-+ (plus:DI (match_operand:DI 1 "register_operand" "")
-+ (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
-+ UNSPEC_TPREL)))]
-+ "!TARGET_TLS64"
-+ "")
-+
-+(define_insn "*add_tprel14"
-+ [(set (match_operand:DI 0 "register_operand" "=r")
-+ (plus:DI (match_operand:DI 1 "register_operand" "r")
-+ (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
-+ UNSPEC_TPREL)))]
-+ "TARGET_TLS14"
-+ "adds %0 = @tprel(%2), %1"
-+ [(set_attr "itanium_class" "ialu")])
-+
-+(define_insn "*add_tprel22"
-+ [(set (match_operand:DI 0 "register_operand" "=r")
-+ (plus:DI (match_operand:DI 1 "register_operand" "a")
-+ (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
-+ UNSPEC_TPREL)))]
-+ "TARGET_TLS22"
-+ "addl %0 = @tprel(%2), %1"
-+ [(set_attr "itanium_class" "ialu")])
-+
- ;; With no offsettable memory references, we've got to have a scratch
- ;; around to play with the second word.
- (define_expand "movti"
-@@ -517,12 +637,12 @@
- (match_operand:TI 1 "general_operand" ""))
- (clobber (match_scratch:DI 2 ""))])]
- ""
-- "
- {
-- if (! reload_in_progress && ! reload_completed
-- && ! ia64_move_ok (operands[0], operands[1]))
-- operands[1] = force_reg (TImode, operands[1]);
--}")
-+ rtx op1 = ia64_expand_move (operands[0], operands[1]);
-+ if (!op1)
-+ DONE;
-+ operands[1] = op1;
-+})
-
- (define_insn_and_split "*movti_internal"
- [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
-@@ -639,12 +759,12 @@
- [(set (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "general_operand" ""))]
- ""
-- "
- {
-- if (! reload_in_progress && ! reload_completed
-- && ! ia64_move_ok (operands[0], operands[1]))
-- operands[1] = force_reg (SFmode, operands[1]);
--}")
-+ rtx op1 = ia64_expand_move (operands[0], operands[1]);
-+ if (!op1)
-+ DONE;
-+ operands[1] = op1;
-+})
-
- (define_insn "*movsf_internal"
- [(set (match_operand:SF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
-@@ -665,12 +785,12 @@
- [(set (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "general_operand" ""))]
- ""
-- "
- {
-- if (! reload_in_progress && ! reload_completed
-- && ! ia64_move_ok (operands[0], operands[1]))
-- operands[1] = force_reg (DFmode, operands[1]);
--}")
-+ rtx op1 = ia64_expand_move (operands[0], operands[1]);
-+ if (!op1)
-+ DONE;
-+ operands[1] = op1;
-+})
-
- (define_insn "*movdf_internal"
- [(set (match_operand:DF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
---- gcc/config/ia64/sysv4.h.jj Mon Jun 3 17:24:18 2002
-+++ gcc/config/ia64/sysv4.h Wed Jun 19 19:33:52 2002
-@@ -42,8 +42,7 @@ extern int size_directive_output;
- #undef ASM_OUTPUT_ALIGNED_LOCAL
- #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
- do { \
-- if ((DECL) \
-- && XSTR (XEXP (DECL_RTL (DECL), 0), 0)[0] == SDATA_NAME_FLAG_CHAR) \
-+ if ((DECL) && sdata_symbolic_operand (XEXP (DECL_RTL (DECL), 0), Pmode)) \
- sbss_section (); \
- else \
- bss_section (); \
-@@ -62,8 +61,8 @@ do { \
- #define ASM_OUTPUT_LABELREF(STREAM, NAME) \
- do { \
- const char *name_ = NAME; \
-- if (*name_ == SDATA_NAME_FLAG_CHAR) \
-- name_++; \
-+ if (*name_ == ENCODE_SECTION_INFO_CHAR) \
-+ name_ += 2; \
- if (*name_ == '*') \
- name_++; \
- else \
-@@ -149,9 +148,11 @@ do { \
- 0 .text
- 1 .rodata
- 2 .data
-- 3 .sdata
-- 4 .bss
-+ 3 .bss
-+ 4 .sdata
- 5 .sbss
-+ 6 .tdata
-+ 7 .tbss
- */
- #define DO_SELECT_SECTION(SECNUM, DECL, RELOC) \
- do \
-@@ -167,9 +168,10 @@ do { \
- } \
- else if (TREE_CODE (DECL) == VAR_DECL) \
- { \
-- if (XSTR (XEXP (DECL_RTL (DECL), 0), 0)[0] \
-- == SDATA_NAME_FLAG_CHAR) \
-- SECNUM = 3; \
-+ if (DECL_THREAD_LOCAL (DECL)) \
-+ SECNUM = 6; \
-+ else if (sdata_symbolic_operand (XEXP (DECL_RTL (DECL), 0), Pmode))\
-+ SECNUM = 4; \
- /* ??? We need the extra RELOC check, because the default \
- is to only check RELOC if flag_pic is set, and we don't \
- set flag_pic (yet?). */ \
-@@ -184,13 +186,18 @@ do { \
- SECNUM = 0x201; \
- else \
- SECNUM = 0x301; \
-+ \
-+ if (SECNUM >= 2 \
-+ && (!DECL_INITIAL (DECL) \
-+ || DECL_INITIAL (DECL) == error_mark_node)) \
-+ SECNUM++; \
- } \
- /* This could be a CONSTRUCTOR containing ADDR_EXPR of a VAR_DECL, \
- in which case we can't put it in a shared library rodata. */ \
- else if (flag_pic && (RELOC)) \
-- SECNUM = 3; \
-- else \
- SECNUM = 2; \
-+ else \
-+ SECNUM = 1; \
- } \
- while (0)
-
-@@ -206,8 +213,8 @@ do { \
- text_section, \
- const_section, \
- data_section, \
-- sdata_section, \
- bss_section, \
-+ sdata_section, \
- sbss_section \
- }; \
- \
-@@ -217,6 +224,12 @@ do { \
- \
- switch (sec) \
- { \
-+ case 6: \
-+ named_section (NULL_TREE, ".tdata", RELOC); \
-+ break; \
-+ case 7: \
-+ named_section (NULL_TREE, ".tbss", RELOC); \
-+ break; \
- case 0x101: \
- mergeable_string_section (DECL, ALIGN, 0); \
- break; \
-@@ -244,9 +257,11 @@ do { \
- { ".text.", ".gnu.linkonce.t." }, \
- { ".rodata.", ".gnu.linkonce.r." }, \
- { ".data.", ".gnu.linkonce.d." }, \
-- { ".sdata.", ".gnu.linkonce.s." }, \
- { ".bss.", ".gnu.linkonce.b." }, \
-- { ".sbss.", ".gnu.linkonce.sb." } \
-+ { ".sdata.", ".gnu.linkonce.s." }, \
-+ { ".sbss.", ".gnu.linkonce.sb." }, \
-+ { ".tdata.", ".gnu.linkonce.td." }, \
-+ { ".tbss.", ".gnu.linkonce.tb." } \
- }; \
- \
- int nlen, plen, sec; \
---- gcc/config/elfos.h.jj Tue Dec 18 01:30:48 2001
-+++ gcc/config/elfos.h Wed Jun 19 19:33:52 2002
-@@ -288,24 +288,28 @@ const_section () \
- const char *name; \
- char *string; \
- const char *prefix; \
-- static const char *const prefixes[4][2] = \
-+ static const char *const prefixes[][2] = \
- { \
- { ".text.", ".gnu.linkonce.t." }, \
- { ".rodata.", ".gnu.linkonce.r." }, \
- { ".data.", ".gnu.linkonce.d." }, \
-- { ".bss.", ".gnu.linkonce.b." } \
-+ { ".bss.", ".gnu.linkonce.b." }, \
-+ { ".tdata", ".gnu.linkonce.td." }, \
-+ { ".tbss", ".gnu.linkonce.tb." }, \
- }; \
- \
- if (TREE_CODE (DECL) == FUNCTION_DECL) \
- sec = 0; \
- else if (DECL_INITIAL (DECL) == 0 \
- || DECL_INITIAL (DECL) == error_mark_node) \
-- sec = 3; \
-+ sec = 3; \
- else if (DECL_READONLY_SECTION (DECL, RELOC)) \
- sec = 1; \
- else \
- sec = 2; \
-- \
-+ if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl)) \
-+ sec = (sec == 3 ? 5 : 4); \
-+ \
- name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
- /* Strip off any encoding in name. */ \
- STRIP_NAME_ENCODING (name, name); \
-@@ -367,10 +371,18 @@ const_section () \
- } \
- else if (TREE_CODE (DECL) == VAR_DECL) \
- { \
-- if (!TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
-- || !DECL_INITIAL (DECL) \
-- || (DECL_INITIAL (DECL) != error_mark_node \
-- && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
-+ if (DECL_THREAD_LOCAL (DECL)) \
-+ { \
-+ if (!DECL_INITIAL (DECL) \
-+ || DECL_INITIAL (DECL) == error_mark_node) \
-+ named_section (NULL_TREE, ".tbss", RELOC); \
-+ else \
-+ named_section (NULL_TREE, ".tdata", RELOC); \
-+ } \
-+ else if (!TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
-+ || !DECL_INITIAL (DECL) \
-+ || (DECL_INITIAL (DECL) != error_mark_node \
-+ && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
- { \
- if (flag_pic && ((RELOC) & 2)) \
- named_section (NULL_TREE, ".data.rel", RELOC); \
---- gcc/fixinc/fixincl.x.jj Thu May 2 12:15:15 2002
-+++ gcc/fixinc/fixincl.x Wed Jun 19 19:33:52 2002
-@@ -5,7 +5,7 @@
- * files which are fixed to work correctly with ANSI C and placed in a
- * directory that GNU C will search.
- *
-- * This file contains 151 fixup descriptions.
-+ * This file contains 152 fixup descriptions.
- *
- * See README for more information.
- *
-@@ -4568,6 +4568,41 @@ static const char* apzSysz_Stdlib_For_Su
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * *
- *
-+ * Description of Thread_Keyword fix
-+ */
-+tSCC zThread_KeywordName[] =
-+ "thread_keyword";
-+
-+/*
-+ * File name selection pattern
-+ */
-+tSCC zThread_KeywordList[] =
-+ "|pthread.h|bits/sigthread.h|";
-+/*
-+ * Machine/OS name selection pattern
-+ */
-+#define apzThread_KeywordMachs (const char**)NULL
-+
-+/*
-+ * content selection pattern - do fix if pattern found
-+ */
-+tSCC zThread_KeywordSelect0[] =
-+ " __thread([,)])";
-+
-+#define THREAD_KEYWORD_TEST_CT 1
-+static tTestDesc aThread_KeywordTests[] = {
-+ { TT_EGREP, zThread_KeywordSelect0, (regex_t*)NULL }, };
-+
-+/*
-+ * Fix Command Arguments for Thread_Keyword
-+ */
-+static const char* apzThread_KeywordPatch[] = {
-+ "format",
-+ " __thr%1",
-+ (char*)NULL };
-+
-+/* * * * * * * * * * * * * * * * * * * * * * * * * *
-+ *
- * Description of Tinfo_Cplusplus fix
- */
- tSCC zTinfo_CplusplusName[] =
-@@ -5581,9 +5616,9 @@ static const char* apzX11_SprintfPatch[]
- *
- * List of all fixes
- */
--#define REGEX_COUNT 163
-+#define REGEX_COUNT 164
- #define MACH_LIST_SIZE_LIMIT 279
--#define FIX_COUNT 151
-+#define FIX_COUNT 152
-
- /*
- * Enumerate the fixes
-@@ -5705,6 +5740,7 @@ typedef enum {
- SVR4_PROFIL_FIXIDX,
- SYSV68_STRING_FIXIDX,
- SYSZ_STDLIB_FOR_SUN_FIXIDX,
-+ THREAD_KEYWORD_FIXIDX,
- TINFO_CPLUSPLUS_FIXIDX,
- ULTRIX_ATEXIT_PARAM_FIXIDX,
- ULTRIX_ATOF_PARAM_FIXIDX,
-@@ -6314,6 +6350,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
- SYSZ_STDLIB_FOR_SUN_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
- aSysz_Stdlib_For_SunTests, apzSysz_Stdlib_For_SunPatch, 0 },
-
-+ { zThread_KeywordName, zThread_KeywordList,
-+ apzThread_KeywordMachs,
-+ THREAD_KEYWORD_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
-+ aThread_KeywordTests, apzThread_KeywordPatch, 0 },
-+
- { zTinfo_CplusplusName, zTinfo_CplusplusList,
- apzTinfo_CplusplusMachs,
- TINFO_CPLUSPLUS_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
---- gcc/fixinc/inclhack.def.jj Thu May 2 12:15:17 2002
-+++ gcc/fixinc/inclhack.def Wed Jun 19 19:33:52 2002
-@@ -1,4 +1,3 @@
--
- /* -*- Mode: C -*- */
-
- autogen definitions fixincl;
-@@ -2886,6 +2885,24 @@ fix = {
- };
-
-
-+/*
-+ * __thread is now a keyword.
-+ */
-+fix = {
-+ hackname = thread_keyword;
-+ files = "pthread.h";
-+ files = "bits/sigthread.h";
-+ select = " __thread([,)])";
-+ c_fix = format;
-+ c_fix_arg = " __thr%1";
-+
-+ test_text =
-+ "extern int pthread_create (pthread_t *__restrict __thread,\n"
-+ "extern int pthread_kill (pthread_t __thread, int __signo);\n"
-+ "extern int pthread_cancel (pthread_t __thread);";
-+};
-+
-+
- /*
- * if the #if says _cplusplus, not the double underscore __cplusplus
- * that it should be
---- gcc/testsuite/g++.dg/dg.exp.jj Thu Feb 14 13:26:12 2002
-+++ gcc/testsuite/g++.dg/dg.exp Wed Jun 19 19:33:52 2002
-@@ -28,10 +28,12 @@ if ![info exists DEFAULT_CXXFLAGS] then
- # Initialize `dg'.
- dg-init
-
--# Gather a list of all tests, excluding those in special/; those are handled
--# well, specially.
--set all [lsort [find $srcdir/$subdir *.C]]
--set tests [prune [prune $all $srcdir/$subdir/special/*] $srcdir/$subdir/debug/*]
-+# Gather a list of all tests, with the exception of those in directories
-+# that are handled specially.
-+set tests [lsort [find $srcdir/$subdir *.C]]
-+set tests [prune $tests $srcdir/$subdir/debug/*]
-+set tests [prune $tests $srcdir/$subdir/special/*]
-+set tests [prune $tests $srcdir/$subdir/tls/*]
-
- # Main loop.
- dg-runtest $tests "" $DEFAULT_CXXFLAGS
---- gcc/testsuite/g++.dg/tls/diag-1.C.jj Wed Jun 19 19:33:52 2002
-+++ gcc/testsuite/g++.dg/tls/diag-1.C Wed Jun 19 19:33:52 2002
-@@ -0,0 +1,30 @@
-+/* Valid __thread specifiers. */
-+
-+__thread int g1;
-+extern __thread int g2;
-+static __thread int g3;
-+
-+void foo()
-+{
-+ extern __thread int l1;
-+ static __thread int l2;
-+}
-+
-+struct A {
-+ static __thread int i;
-+};
-+
-+__thread int A::i = 42;
-+
-+template <typename T> struct B {
-+ static __thread T t;
-+};
-+
-+template <typename T>
-+__thread T B<T>::t = 42;
-+
-+void bar ()
-+{
-+ int j = B<int>::t;
-+ int k = B<const int>::t;
-+}
---- gcc/testsuite/g++.dg/tls/diag-2.C.jj Wed Jun 19 19:33:52 2002
-+++ gcc/testsuite/g++.dg/tls/diag-2.C Wed Jun 19 19:33:52 2002
-@@ -0,0 +1,25 @@
-+/* Invalid __thread specifiers. */
-+
-+__thread extern int g1; /* { dg-error "`__thread' before `extern'" } */
-+__thread static int g2; /* { dg-error "`__thread' before `static'" } */
-+__thread __thread int g3; /* { dg-error "duplicate `__thread'" } */
-+typedef __thread int g4; /* { dg-error "multiple storage classes" } */
-+
-+void foo()
-+{
-+ __thread int l1; /* { dg-error "implicitly auto and declared `__thread'" } */
-+ auto __thread int l2; /* { dg-error "multiple storage classes" } */
-+ __thread extern int l3; /* { dg-error "`__thread' before `extern'" } */
-+ register __thread int l4; /* { dg-error "multiple storage classes" } */
-+}
-+
-+__thread void f1 (); /* { dg-error "invalid for function" } */
-+extern __thread void f2 (); /* { dg-error "invalid for function" } */
-+static __thread void f3 (); /* { dg-error "invalid for function" } */
-+__thread void f4 () { } /* { dg-error "invalid for function" } */
-+
-+void bar(__thread int p1); /* { dg-error "(invalid in parameter)|(specified for parameter)" } */
-+
-+struct A {
-+ __thread int i; /* { dg-error "specified for field" } */
-+};
---- gcc/testsuite/g++.dg/tls/init-1.C.jj Wed Jun 19 19:33:52 2002
-+++ gcc/testsuite/g++.dg/tls/init-1.C Wed Jun 19 19:33:52 2002
-@@ -0,0 +1,13 @@
-+/* Valid initializations. */
-+
-+__thread int i = 42;
-+
-+static int j;
-+__thread int *p = &j;
-+
-+/* Note that this is valid in C++ (unlike C) as a run-time initialization. */
-+int *q = &i;
-+
-+/* Valid because "const int k" is an integral constant expression in C++. */
-+__thread const int k = 42;
-+__thread const int l = k;
---- gcc/testsuite/g++.dg/tls/init-2.C.jj Wed Jun 19 19:33:52 2002
-+++ gcc/testsuite/g++.dg/tls/init-2.C Wed Jun 19 19:33:52 2002
-@@ -0,0 +1,13 @@
-+/* Invalid initializations. */
-+
-+extern __thread int i;
-+__thread int *p = &i; /* { dg-error "run-time initialization" } */
-+
-+extern int f();
-+__thread int j = f(); /* { dg-error "run-time initialization" } */
-+
-+struct S
-+{
-+ S();
-+};
-+__thread S s; /* { dg-error "run-time initialization" } */
---- gcc/testsuite/g++.dg/tls/tls.exp.jj Wed Jun 19 19:33:52 2002
-+++ gcc/testsuite/g++.dg/tls/tls.exp Wed Jun 19 19:33:52 2002
-@@ -0,0 +1,44 @@
-+# Copyright (C) 2002 Free Software Foundation, Inc.
-+
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 2 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+
-+# GCC testsuite that uses the `dg.exp' driver.
-+
-+# Load support procs.
-+load_lib g++-dg.exp
-+
-+# Test for thread-local data supported by the platform. If it
-+# isn't, everything will fail with the "not supported" message.
-+
-+set comp_output [g++_target_compile \
-+ "$srcdir/$subdir/trivial.C" "trivial.S" assembly ""]
-+if { [string match "*not supported*" $comp_output] } {
-+ return 0
-+}
-+
-+# If a testcase doesn't have special options, use these.
-+global DEFAULT_CXXFLAGS
-+if ![info exists DEFAULT_CXXFLAGS] then {
-+ set DEFAULT_CXXFLAGS " -ansi -pedantic-errors -Wno-long-long"
-+}
-+
-+# Initialize `dg'.
-+dg-init
-+
-+# Main loop.
-+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] "" $DEFAULT_CXXFLAGS
-+
-+# All done.
-+dg-finish
---- gcc/testsuite/g++.dg/tls/trivial.C.jj Wed Jun 19 19:33:52 2002
-+++ gcc/testsuite/g++.dg/tls/trivial.C Wed Jun 19 19:33:52 2002
-@@ -0,0 +1 @@
-+__thread int i;
---- gcc/testsuite/gcc.dg/tls/diag-1.c.jj Wed Jun 19 19:33:52 2002
-+++ gcc/testsuite/gcc.dg/tls/diag-1.c Wed Jun 19 19:33:52 2002
-@@ -0,0 +1,11 @@
-+/* Valid __thread specifiers. */
-+
-+__thread int g1;
-+extern __thread int g2;
-+static __thread int g3;
-+
-+void foo()
-+{
-+ extern __thread int l1;
-+ static __thread int l2;
-+}
---- gcc/testsuite/gcc.dg/tls/diag-2.c.jj Wed Jun 19 19:33:52 2002
-+++ gcc/testsuite/gcc.dg/tls/diag-2.c Wed Jun 19 19:33:52 2002
-@@ -0,0 +1,21 @@
-+/* Invalid __thread specifiers. */
-+
-+__thread extern int g1; /* { dg-error "`__thread' before `extern'" } */
-+__thread static int g2; /* { dg-error "`__thread' before `static'" } */
-+__thread __thread int g3; /* { dg-error "duplicate `__thread'" } */
-+typedef __thread int g4; /* { dg-error "multiple storage classes" } */
-+
-+void foo()
-+{
-+ __thread int l1; /* { dg-error "implicitly auto and declared `__thread'" } */
-+ auto __thread int l2; /* { dg-error "multiple storage classes" } */
-+ __thread extern int l3; /* { dg-error "`__thread' before `extern'" } */
-+ register __thread int l4; /* { dg-error "multiple storage classes" } */
-+}
-+
-+__thread void f1 (); /* { dg-error "invalid storage class for function" } */
-+extern __thread void f2 (); /* { dg-error "invalid storage class for function" } */
-+static __thread void f3 (); /* { dg-error "invalid storage class for function" } */
-+__thread void f4 () { } /* { dg-error "function definition declared `__thread'" } */
-+
-+void bar(__thread int p1); /* { dg-error "storage class specified for parameter" } */
---- gcc/testsuite/gcc.dg/tls/init-1.c.jj Wed Jun 19 19:33:52 2002
-+++ gcc/testsuite/gcc.dg/tls/init-1.c Wed Jun 19 19:33:52 2002
-@@ -0,0 +1,4 @@
-+/* Invalid initializations. */
-+
-+extern __thread int i;
-+int *p = &i; /* { dg-error "initializer element is not constant" } */
---- gcc/testsuite/gcc.dg/tls/tls.exp.jj Wed Jun 19 19:33:52 2002
-+++ gcc/testsuite/gcc.dg/tls/tls.exp Wed Jun 19 19:33:52 2002
-@@ -0,0 +1,45 @@
-+# Copyright (C) 2002 Free Software Foundation, Inc.
-+
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 2 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+
-+# GCC testsuite that uses the `dg.exp' driver.
-+
-+# Load support procs.
-+load_lib gcc-dg.exp
-+
-+# Test for thread-local data supported by the platform. If it
-+# isn't, everything will fail with the "not supported" message.
-+
-+set comp_output [gcc_target_compile \
-+ "$srcdir/$subdir/trivial.c" "trivial.S" assembly ""]
-+if { [string match "*not supported*" $comp_output] } {
-+ return 0
-+}
-+
-+# If a testcase doesn't have special options, use these.
-+global DEFAULT_CFLAGS
-+if ![info exists DEFAULT_CFLAGS] then {
-+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
-+}
-+
-+# Initialize `dg'.
-+dg-init
-+
-+# Main loop.
-+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
-+ "" $DEFAULT_CFLAGS
-+
-+# All done.
-+dg-finish
---- gcc/testsuite/gcc.dg/tls/trivial.c.jj Wed Jun 19 19:33:52 2002
-+++ gcc/testsuite/gcc.dg/tls/trivial.c Wed Jun 19 19:33:52 2002
-@@ -0,0 +1 @@
-+__thread int i;
---- gcc/c-common.h.jj Wed Apr 17 15:34:36 2002
-+++ gcc/c-common.h Wed Jun 19 19:33:52 2002
-@@ -58,7 +58,7 @@ enum rid
- RID_VOLATILE, RID_SIGNED, RID_AUTO, RID_RESTRICT,
-
- /* C extensions */
-- RID_BOUNDED, RID_UNBOUNDED, RID_COMPLEX,
-+ RID_BOUNDED, RID_UNBOUNDED, RID_COMPLEX, RID_THREAD,
-
- /* C++ */
- RID_FRIEND, RID_VIRTUAL, RID_EXPLICIT, RID_EXPORT, RID_MUTABLE,
---- gcc/c-decl.c.jj Wed Jun 19 19:33:50 2002
-+++ gcc/c-decl.c Wed Jun 19 19:33:52 2002
-@@ -3571,9 +3571,19 @@ start_decl (declarator, declspecs, initi
- /* ANSI specifies that a tentative definition which is not merged with
- a non-tentative definition behaves exactly like a definition with an
- initializer equal to zero. (Section 3.7.2)
-- -fno-common gives strict ANSI behavior. Usually you don't want it.
-- This matters only for variables with external linkage. */
-- if (! flag_no_common || ! TREE_PUBLIC (decl))
-+
-+ -fno-common gives strict ANSI behavior, though this tends to break
-+ a large body of code that grew up without this rule.
-+
-+ Thread-local variables are never common, since there's no entrenched
-+ body of code to break, and it allows more efficient variable references
-+ in the presense of dynamic linking. */
-+
-+ if (TREE_CODE (decl) == VAR_DECL
-+ && !initialized
-+ && TREE_PUBLIC (decl)
-+ && !DECL_THREAD_LOCAL (decl)
-+ && !flag_no_common)
- DECL_COMMON (decl) = 1;
-
- /* Set attributes here so if duplicate decl, will have proper attributes. */
-@@ -4172,7 +4182,7 @@ grokdeclarator (declarator, declspecs, d
- enum rid i = C_RID_CODE (id);
- if ((int) i <= (int) RID_LAST_MODIFIER)
- {
-- if (i == RID_LONG && (specbits & (1 << (int) i)))
-+ if (i == RID_LONG && (specbits & (1 << (int) RID_LONG)))
- {
- if (longlong)
- error ("`long long long' is too long for GCC");
-@@ -4186,6 +4196,19 @@ grokdeclarator (declarator, declspecs, d
- }
- else if (specbits & (1 << (int) i))
- pedwarn ("duplicate `%s'", IDENTIFIER_POINTER (id));
-+
-+ /* Diagnose "__thread extern". Recall that this list
-+ is in the reverse order seen in the text. */
-+ if (i == RID_THREAD
-+ && (specbits & (1 << (int) RID_EXTERN
-+ | 1 << (int) RID_STATIC)))
-+ {
-+ if (specbits & 1 << (int) RID_EXTERN)
-+ error ("`__thread' before `extern'");
-+ else
-+ error ("`__thread' before `static'");
-+ }
-+
- specbits |= 1 << (int) i;
- goto found;
- }
-@@ -4438,6 +4461,12 @@ grokdeclarator (declarator, declspecs, d
- if (specbits & 1 << (int) RID_REGISTER) nclasses++;
- if (specbits & 1 << (int) RID_TYPEDEF) nclasses++;
-
-+ /* "static __thread" and "extern __thread" are allowed. */
-+ if ((specbits & (1 << (int) RID_THREAD
-+ | 1 << (int) RID_STATIC
-+ | 1 << (int) RID_EXTERN)) == (1 << (int) RID_THREAD))
-+ nclasses++;
-+
- /* Warn about storage classes that are invalid for certain
- kinds of declarations (parameters, typenames, etc.). */
-
-@@ -4447,7 +4476,8 @@ grokdeclarator (declarator, declspecs, d
- && (specbits
- & ((1 << (int) RID_REGISTER)
- | (1 << (int) RID_AUTO)
-- | (1 << (int) RID_TYPEDEF))))
-+ | (1 << (int) RID_TYPEDEF)
-+ | (1 << (int) RID_THREAD))))
- {
- if (specbits & 1 << (int) RID_AUTO
- && (pedantic || current_binding_level == global_binding_level))
-@@ -4456,8 +4486,10 @@ grokdeclarator (declarator, declspecs, d
- error ("function definition declared `register'");
- if (specbits & 1 << (int) RID_TYPEDEF)
- error ("function definition declared `typedef'");
-+ if (specbits & 1 << (int) RID_THREAD)
-+ error ("function definition declared `__thread'");
- specbits &= ~((1 << (int) RID_TYPEDEF) | (1 << (int) RID_REGISTER)
-- | (1 << (int) RID_AUTO));
-+ | (1 << (int) RID_AUTO) | (1 << (int) RID_THREAD));
- }
- else if (decl_context != NORMAL && nclasses > 0)
- {
-@@ -4480,7 +4512,7 @@ grokdeclarator (declarator, declspecs, d
- }
- specbits &= ~((1 << (int) RID_TYPEDEF) | (1 << (int) RID_REGISTER)
- | (1 << (int) RID_AUTO) | (1 << (int) RID_STATIC)
-- | (1 << (int) RID_EXTERN));
-+ | (1 << (int) RID_EXTERN) | (1 << (int) RID_THREAD));
- }
- }
- else if (specbits & 1 << (int) RID_EXTERN && initialized && ! funcdef_flag)
-@@ -4491,12 +4523,25 @@ grokdeclarator (declarator, declspecs, d
- else
- error ("`%s' has both `extern' and initializer", name);
- }
-- else if (specbits & 1 << (int) RID_EXTERN && funcdef_flag
-- && current_binding_level != global_binding_level)
-- error ("nested function `%s' declared `extern'", name);
-- else if (current_binding_level == global_binding_level
-- && specbits & (1 << (int) RID_AUTO))
-- error ("top-level declaration of `%s' specifies `auto'", name);
-+ else if (current_binding_level == global_binding_level)
-+ {
-+ if (specbits & 1 << (int) RID_AUTO)
-+ error ("top-level declaration of `%s' specifies `auto'", name);
-+ }
-+ else
-+ {
-+ if (specbits & 1 << (int) RID_EXTERN && funcdef_flag)
-+ error ("nested function `%s' declared `extern'", name);
-+ else if ((specbits & (1 << (int) RID_THREAD
-+ | 1 << (int) RID_EXTERN
-+ | 1 << (int) RID_STATIC))
-+ == (1 << (int) RID_THREAD))
-+ {
-+ error ("function-scope `%s' implicitly auto and declared `__thread'",
-+ name);
-+ specbits &= ~(1 << (int) RID_THREAD);
-+ }
-+ }
- }
-
- /* Now figure out the structure of the declarator proper.
-@@ -5095,6 +5140,8 @@ grokdeclarator (declarator, declspecs, d
- pedwarn ("invalid storage class for function `%s'", name);
- if (specbits & (1 << (int) RID_REGISTER))
- error ("invalid storage class for function `%s'", name);
-+ if (specbits & (1 << (int) RID_THREAD))
-+ error ("invalid storage class for function `%s'", name);
- /* Function declaration not at top level.
- Storage classes other than `extern' are not allowed
- and `extern' makes no difference. */
-@@ -5187,22 +5234,32 @@ grokdeclarator (declarator, declspecs, d
- pedwarn_with_decl (decl, "variable `%s' declared `inline'");
-
- DECL_EXTERNAL (decl) = extern_ref;
-+
- /* At top level, the presence of a `static' or `register' storage
- class specifier, or the absence of all storage class specifiers
- makes this declaration a definition (perhaps tentative). Also,
- the absence of both `static' and `register' makes it public. */
- if (current_binding_level == global_binding_level)
- {
-- TREE_PUBLIC (decl)
-- = !(specbits
-- & ((1 << (int) RID_STATIC) | (1 << (int) RID_REGISTER)));
-- TREE_STATIC (decl) = ! DECL_EXTERNAL (decl);
-+ TREE_PUBLIC (decl) = !(specbits & ((1 << (int) RID_STATIC)
-+ | (1 << (int) RID_REGISTER)));
-+ TREE_STATIC (decl) = !extern_ref;
- }
- /* Not at top level, only `static' makes a static definition. */
- else
- {
- TREE_STATIC (decl) = (specbits & (1 << (int) RID_STATIC)) != 0;
-- TREE_PUBLIC (decl) = DECL_EXTERNAL (decl);
-+ TREE_PUBLIC (decl) = extern_ref;
-+ }
-+
-+ if (specbits & 1 << (int) RID_THREAD)
-+ {
-+ if (targetm.have_tls)
-+ DECL_THREAD_LOCAL (decl) = 1;
-+ else
-+ /* A mere warning is sure to result in improper semantics
-+ at runtime. Don't bother to allow this to compile. */
-+ error ("thread-local storage not supported for this target");
- }
- }
-
---- gcc/c-parse.in.jj Wed Apr 17 15:34:46 2002
-+++ gcc/c-parse.in Wed Jun 19 19:33:52 2002
-@@ -3329,6 +3329,7 @@ static const struct resword reswords[] =
- { "__restrict__", RID_RESTRICT, 0 },
- { "__signed", RID_SIGNED, 0 },
- { "__signed__", RID_SIGNED, 0 },
-+ { "__thread", RID_THREAD, 0 },
- { "__typeof", RID_TYPEOF, 0 },
- { "__typeof__", RID_TYPEOF, 0 },
- { "__unbounded", RID_UNBOUNDED, 0 },
-@@ -3424,6 +3425,7 @@ static const short rid_to_yy[RID_MAX] =
- /* RID_BOUNDED */ TYPE_QUAL,
- /* RID_UNBOUNDED */ TYPE_QUAL,
- /* RID_COMPLEX */ TYPESPEC,
-+ /* RID_THREAD */ SCSPEC,
-
- /* C++ */
- /* RID_FRIEND */ 0,
---- gcc/config.in.jj Sat Jun 8 00:38:25 2002
-+++ gcc/config.in Wed Jun 19 19:33:52 2002
-@@ -523,6 +523,9 @@
- /* Define if your assembler supports marking sections with SHF_MERGE flag. */
- #undef HAVE_GAS_SHF_MERGE
-
-+/* Define if your assembler supports thread-local storage. */
-+#undef HAVE_AS_TLS
-+
- /* Define if your assembler supports explicit relocations. */
- #undef HAVE_AS_EXPLICIT_RELOCS
-
---- gcc/flags.h.jj Sat Mar 23 12:02:51 2002
-+++ gcc/flags.h Wed Jun 19 19:33:52 2002
-@@ -450,11 +450,22 @@ extern int flag_pretend_float;
-
- extern int flag_pedantic_errors;
-
--/* Nonzero means generate position-independent code.
-- This is not fully implemented yet. */
-+/* Nonzero means generate position-independent code. 1 vs 2 for a
-+ target-dependent "small" or "large" mode. */
-
- extern int flag_pic;
-
-+/* Set to the default thread-local storage (tls) model to use. */
-+
-+enum tls_model {
-+ TLS_MODEL_GLOBAL_DYNAMIC = 1,
-+ TLS_MODEL_LOCAL_DYNAMIC,
-+ TLS_MODEL_INITIAL_EXEC,
-+ TLS_MODEL_LOCAL_EXEC
-+};
-+
-+extern enum tls_model flag_tls_default;
-+
- /* Nonzero means generate extra code for exception handling and enable
- exception handling. */
-
---- gcc/configure.in.jj Sat Jun 8 00:38:27 2002
-+++ gcc/configure.in Wed Jun 19 19:33:52 2002
-@@ -1715,6 +1715,72 @@ if test x"$gcc_cv_as_shf_merge" = xyes;
- fi
- AC_MSG_RESULT($gcc_cv_as_shf_merge)
-
-+AC_MSG_CHECKING(assembler thread-local storage support)
-+gcc_cv_as_tls=no
-+conftest_s=
-+tls_first_major=
-+tls_first_minor=
-+case "$target" in
-+changequote(,)dnl
-+ i[34567]86-*-*)
-+changequote([,])dnl
-+ conftest_s='
-+ .section ".tdata","awT",@progbits
-+foo: .long 25
-+ .text
-+ movl %gs:0, %eax
-+ leal foo@TLSGD(,%ebx,1), %eax
-+ leal foo@TLSLDM(%ebx), %eax
-+ leal foo@DTPOFF(%eax), %edx
-+ movl foo@GOTTPOFF(%ebx), %eax
-+ subl foo@GOTTPOFF(%ebx), %eax
-+ movl $foo@TPOFF, %eax
-+ subl $foo@TPOFF, %eax
-+ leal foo@NTPOFF(%ecx), %eax'
-+ tls_first_major=2
-+ tls_first_minor=13
-+ ;;
-+ ia64-*-*)
-+ conftest_s='
-+ .section ".tdata","awT",@progbits
-+foo: data8 25
-+ .text
-+ addl r16 = @ltoff(@dtpmod(foo#)), gp
-+ addl r17 = @ltoff(@dtprel(foo#)), gp
-+ addl r18 = @ltoff(@tprel(foo#)), gp
-+ addl r19 = @dtprel(foo#), gp
-+ adds r21 = @dtprel(foo#), r13
-+ movl r23 = @dtprel(foo#)
-+ addl r20 = @tprel(foo#), gp
-+ adds r22 = @tprel(foo#), r13
-+ movl r24 = @tprel(foo#)'
-+ tls_first_major=2
-+ tls_first_minor=13
-+ ;;
-+esac
-+if test -z "$tls_first_major"; then
-+ :
-+elif test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x
-+then
-+ if test "$gcc_cv_gas_major_version" -eq "$tls_first_major" \
-+ -a "$gcc_cv_gas_minor_version" -ge "$tls_first_minor" \
-+ -o "$gcc_cv_gas_major_version" -gt "$tls_first_major"; then
-+ gcc_cv_as_tls=yes
-+ fi
-+elif test x$gcc_cv_as != x; then
-+ echo "$conftest_s" > conftest.s
-+ if $gcc_cv_as --fatal-warnings -o conftest.o conftest.s > /dev/null 2>&1
-+ then
-+ gcc_cv_as_tls=yes
-+ fi
-+ rm -f conftest.s conftest.o
-+fi
-+if test "$gcc_cv_as_tls" = yes; then
-+ AC_DEFINE(HAVE_AS_TLS, 1,
-+ [Define if your assembler supports thread-local storage.])
-+fi
-+AC_MSG_RESULT($gcc_cv_as_tls)
-+
- case "$target" in
- # All TARGET_ABI_OSF targets.
- alpha*-*-osf* | alpha*-*-linux* | alpha*-*-*bsd*)
---- gcc/configure.jj Sat Jun 8 00:38:27 2002
-+++ gcc/configure Wed Jun 19 22:28:09 2002
-@@ -7391,6 +7391,73 @@ EOF
- fi
- echo "$ac_t""$gcc_cv_as_shf_merge" 1>&6
-
-+echo $ac_n "checking assembler thread-local storage support""... $ac_c" 1>&6
-+echo "configure:7399: checking assembler thread-local storage support" >&5
-+gcc_cv_as_tls=no
-+conftest_s=
-+tls_first_major=
-+tls_first_minor=
-+case "$target" in
-+ i[34567]86-*-*)
-+ conftest_s='
-+ .section ".tdata","awT",@progbits
-+foo: .long 25
-+ .text
-+ movl %gs:0, %eax
-+ leal foo@TLSGD(,%ebx,1), %eax
-+ leal foo@TLSLDM(%ebx), %eax
-+ leal foo@DTPOFF(%eax), %edx
-+ movl foo@GOTTPOFF(%ebx), %eax
-+ subl foo@GOTTPOFF(%ebx), %eax
-+ movl $foo@TPOFF, %eax
-+ subl $foo@TPOFF, %eax
-+ leal foo@NTPOFF(%ecx), %eax'
-+ tls_first_major=2
-+ tls_first_minor=13
-+ ;;
-+ ia64-*-*)
-+ conftest_s='
-+ .section ".tdata","awT",@progbits
-+foo: data8 25
-+ .text
-+ addl r16 = @ltoff(@dtpmod(foo#)), gp
-+ addl r17 = @ltoff(@dtprel(foo#)), gp
-+ addl r18 = @ltoff(@tprel(foo#)), gp
-+ addl r19 = @dtprel(foo#), gp
-+ adds r21 = @dtprel(foo#), r13
-+ movl r23 = @dtprel(foo#)
-+ addl r20 = @tprel(foo#), gp
-+ adds r22 = @tprel(foo#), r13
-+ movl r24 = @tprel(foo#)'
-+ tls_first_major=2
-+ tls_first_minor=13
-+ ;;
-+esac
-+if test -z "$tls_first_major"; then
-+ :
-+elif test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x
-+then
-+ if test "$gcc_cv_gas_major_version" -eq "$tls_first_major" \
-+ -a "$gcc_cv_gas_minor_version" -ge "$tls_first_minor" \
-+ -o "$gcc_cv_gas_major_version" -gt "$tls_first_major"; then
-+ gcc_cv_as_tls=yes
-+ fi
-+elif test x$gcc_cv_as != x; then
-+ echo "$conftest_s" > conftest.s
-+ if $gcc_cv_as --fatal-warnings -o conftest.o conftest.s > /dev/null 2>&1
-+ then
-+ gcc_cv_as_tls=yes
-+ fi
-+ rm -f conftest.s conftest.o
-+fi
-+if test "$gcc_cv_as_tls" = yes; then
-+ cat >> confdefs.h <<\EOF
-+#define HAVE_AS_TLS 1
-+EOF
-+
-+fi
-+echo "$ac_t""$gcc_cv_as_tls" 1>&6
-+
- case "$target" in
- # All TARGET_ABI_OSF targets.
- alpha*-*-osf* | alpha*-*-linux* | alpha*-*-*bsd*)
---- gcc/output.h.jj Wed Jun 19 19:33:50 2002
-+++ gcc/output.h Wed Jun 19 19:33:52 2002
-@@ -514,7 +514,8 @@ extern void no_asm_to_stream PARAMS ((FI
- #define SECTION_STRINGS 0x10000 /* contains zero terminated strings without
- embedded zeros */
- #define SECTION_OVERRIDE 0x20000 /* allow override of default flags */
--#define SECTION_MACH_DEP 0x40000 /* subsequent bits reserved for target */
-+#define SECTION_TLS 0x40000 /* contains thread-local storage */
-+#define SECTION_MACH_DEP 0x80000 /* subsequent bits reserved for target */
-
- extern unsigned int get_named_section_flags PARAMS ((const char *));
- extern bool set_named_section_flags PARAMS ((const char *, unsigned int));
---- gcc/print-tree.c.jj Mon Mar 18 23:19:57 2002
-+++ gcc/print-tree.c Wed Jun 19 19:33:52 2002
-@@ -363,6 +363,8 @@ print_node (file, prefix, node, indent)
-
- if (TREE_CODE (node) == VAR_DECL && DECL_IN_TEXT_SECTION (node))
- fputs (" in-text-section", file);
-+ if (TREE_CODE (node) == VAR_DECL && DECL_THREAD_LOCAL (node))
-+ fputs (" thread-local", file);
-
- if (TREE_CODE (node) == PARM_DECL && DECL_TRANSPARENT_UNION (node))
- fputs (" transparent-union", file);
---- gcc/target-def.h.jj Tue Feb 12 16:19:14 2002
-+++ gcc/target-def.h Wed Jun 19 19:33:52 2002
-@@ -98,6 +98,10 @@ Foundation, 59 Temple Place - Suite 330,
- #define TARGET_HAVE_NAMED_SECTIONS false
- #endif
-
-+#ifndef TARGET_HAVE_TLS
-+#define TARGET_HAVE_TLS false
-+#endif
-+
- #ifndef TARGET_ASM_EXCEPTION_SECTION
- #define TARGET_ASM_EXCEPTION_SECTION default_exception_section
- #endif
-@@ -194,9 +198,10 @@ Foundation, 59 Temple Place - Suite 330,
- TARGET_INIT_BUILTINS, \
- TARGET_EXPAND_BUILTIN, \
- TARGET_SECTION_TYPE_FLAGS, \
-+ TARGET_CANNOT_MODIFY_JUMPS_P, \
- TARGET_HAVE_NAMED_SECTIONS, \
- TARGET_HAVE_CTORS_DTORS, \
-- TARGET_CANNOT_MODIFY_JUMPS_P \
-+ TARGET_HAVE_TLS \
- }
-
- #include "hooks.h"
---- gcc/target.h.jj Tue Feb 12 16:19:14 2002
-+++ gcc/target.h Wed Jun 19 19:33:52 2002
-@@ -178,6 +178,10 @@ struct gcc_target
- /* ??? Should be merged with SELECT_SECTION and UNIQUE_SECTION. */
- unsigned int (* section_type_flags) PARAMS ((tree, const char *, int));
-
-+ /* True if new jumps cannot be created, to replace existing ones or
-+ not, at the current point in the compilation. */
-+ bool (* cannot_modify_jumps_p) PARAMS ((void));
-+
- /* True if arbitrary sections are supported. */
- bool have_named_sections;
-
-@@ -185,9 +189,8 @@ struct gcc_target
- false if we're using collect2 for the job. */
- bool have_ctors_dtors;
-
-- /* True if new jumps cannot be created, to replace existing ones or
-- not, at the current point in the compilation. */
-- bool (* cannot_modify_jumps_p) PARAMS ((void));
-+ /* True if thread-local storage is supported. */
-+ bool have_tls;
- };
-
- extern struct gcc_target targetm;
---- gcc/toplev.c.jj Thu May 30 11:08:44 2002
-+++ gcc/toplev.c Wed Jun 19 19:33:52 2002
-@@ -682,12 +682,15 @@ int flag_shared_data;
- int flag_delayed_branch;
-
- /* Nonzero if we are compiling pure (sharable) code.
-- Value is 1 if we are doing reasonable (i.e. simple
-- offset into offset table) pic. Value is 2 if we can
-- only perform register offsets. */
-+ Value is 1 if we are doing "small" pic; value is 2 if we're doing
-+ "large" pic. */
-
- int flag_pic;
-
-+/* Set to the default thread-local storage (tls) model to use. */
-+
-+enum tls_model flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
-+
- /* Nonzero means generate extra code for exception handling and enable
- exception handling. */
-
-@@ -3609,6 +3612,7 @@ display_help ()
- printf (_(" -finline-limit=<number> Limits the size of inlined functions to <number>\n"));
- printf (_(" -fmessage-length=<number> Limits diagnostics messages lengths to <number> characters per line. 0 suppresses line-wrapping\n"));
- printf (_(" -fdiagnostics-show-location=[once | every-line] Indicates how often source location information should be emitted, as prefix, at the beginning of diagnostics when line-wrapping\n"));
-+ printf (_(" -ftls-model=[global-dynamic | local-dynamic | initial-exec | local-exec] Indicates the default thread-local storage code generation model\n"));
-
- for (i = ARRAY_SIZE (f_options); i--;)
- {
-@@ -3887,6 +3891,19 @@ decode_f_option (arg)
- MAX_INLINE_INSNS);
- set_param_value ("max-inline-insns", val);
- }
-+ else if ((option_value = skip_leading_substring (arg, "tls-model=")))
-+ {
-+ if (strcmp (option_value, "global-dynamic") == 0)
-+ flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
-+ else if (strcmp (option_value, "local-dynamic") == 0)
-+ flag_tls_default = TLS_MODEL_LOCAL_DYNAMIC;
-+ else if (strcmp (option_value, "initial-exec") == 0)
-+ flag_tls_default = TLS_MODEL_INITIAL_EXEC;
-+ else if (strcmp (option_value, "local-exec") == 0)
-+ flag_tls_default = TLS_MODEL_LOCAL_EXEC;
-+ else
-+ warning ("`%s': unknown tls-model option", arg - 2);
-+ }
- #ifdef INSN_SCHEDULING
- else if ((option_value = skip_leading_substring (arg, "sched-verbose=")))
- fix_sched_param ("verbose", option_value);
---- gcc/tree.c.jj Sun Apr 28 23:20:20 2002
-+++ gcc/tree.c Wed Jun 19 19:33:52 2002
-@@ -1510,12 +1510,13 @@ staticp (arg)
- case FUNCTION_DECL:
- /* Nested functions aren't static, since taking their address
- involves a trampoline. */
-- return (decl_function_context (arg) == 0 || DECL_NO_STATIC_CHAIN (arg))
-- && ! DECL_NON_ADDR_CONST_P (arg);
-+ return ((decl_function_context (arg) == 0 || DECL_NO_STATIC_CHAIN (arg))
-+ && ! DECL_NON_ADDR_CONST_P (arg));
-
- case VAR_DECL:
-- return (TREE_STATIC (arg) || DECL_EXTERNAL (arg))
-- && ! DECL_NON_ADDR_CONST_P (arg);
-+ return ((TREE_STATIC (arg) || DECL_EXTERNAL (arg))
-+ && ! DECL_THREAD_LOCAL (arg)
-+ && ! DECL_NON_ADDR_CONST_P (arg));
-
- case CONSTRUCTOR:
- return TREE_STATIC (arg);
---- gcc/tree.h.jj Wed Jun 19 19:33:50 2002
-+++ gcc/tree.h Wed Jun 19 19:33:52 2002
-@@ -1614,6 +1614,10 @@ struct tree_type
- /* In a FUNCTION_DECL, nonzero if the function cannot be inlined. */
- #define DECL_UNINLINABLE(NODE) (FUNCTION_DECL_CHECK (NODE)->decl.uninlinable)
-
-+/* In a VAR_DECL, nonzero if the data should be allocated from
-+ thread-local storage. */
-+#define DECL_THREAD_LOCAL(NODE) (VAR_DECL_CHECK (NODE)->decl.thread_local_flag)
-+
- /* In a FUNCTION_DECL, the saved representation of the body of the
- entire function. Usually a COMPOUND_STMT, but in C++ this may also
- be a RETURN_INIT, CTOR_INITIALIZER, or TRY_BLOCK. */
-@@ -1792,7 +1796,8 @@ struct tree_decl
- unsigned non_addressable : 1;
- unsigned user_align : 1;
- unsigned uninlinable : 1;
-- /* Three unused bits. */
-+ unsigned thread_local_flag : 1;
-+ /* Two unused bits. */
-
- unsigned lang_flag_0 : 1;
- unsigned lang_flag_1 : 1;
---- gcc/varasm.c.jj Wed Jun 19 19:33:51 2002
-+++ gcc/varasm.c Wed Jun 19 19:33:52 2002
-@@ -1599,14 +1599,24 @@ assemble_variable (decl, top_level, at_e
-
- /* Handle uninitialized definitions. */
-
-- if ((DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node)
-- /* If the target can't output uninitialized but not common global data
-- in .bss, then we have to use .data. */
--#if ! defined ASM_EMIT_BSS
-- && DECL_COMMON (decl)
-+ /* If the decl has been given an explicit section name, then it
-+ isn't common, and shouldn't be handled as such. */
-+ if (DECL_SECTION_NAME (decl) || dont_output_data)
-+ ;
-+ /* We don't implement common thread-local data at present. */
-+ else if (DECL_THREAD_LOCAL (decl))
-+ {
-+ if (DECL_COMMON (decl))
-+ sorry ("thread-local COMMON data not implemented");
-+ }
-+#ifndef ASM_EMIT_BSS
-+ /* If the target can't output uninitialized but not common global data
-+ in .bss, then we have to use .data. */
-+ else if (!DECL_COMMON (decl))
-+ ;
- #endif
-- && DECL_SECTION_NAME (decl) == NULL_TREE
-- && ! dont_output_data)
-+ else if (DECL_INITIAL (decl) == 0
-+ || DECL_INITIAL (decl) == error_mark_node)
- {
- unsigned HOST_WIDE_INT size = tree_low_cst (DECL_SIZE_UNIT (decl), 1);
- unsigned HOST_WIDE_INT rounded = size;
-@@ -5324,14 +5334,22 @@ default_section_type_flags (decl, name,
- if (decl && DECL_ONE_ONLY (decl))
- flags |= SECTION_LINKONCE;
-
-+ if (decl && TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl))
-+ flags |= SECTION_TLS | SECTION_WRITE;
-+
- if (strcmp (name, ".bss") == 0
- || strncmp (name, ".bss.", 5) == 0
- || strncmp (name, ".gnu.linkonce.b.", 16) == 0
- || strcmp (name, ".sbss") == 0
- || strncmp (name, ".sbss.", 6) == 0
-- || strncmp (name, ".gnu.linkonce.sb.", 17) == 0)
-+ || strncmp (name, ".gnu.linkonce.sb.", 17) == 0
-+ || strcmp (name, ".tbss") == 0)
- flags |= SECTION_BSS;
-
-+ if (strcmp (name, ".tdata") == 0
-+ || strcmp (name, ".tbss") == 0)
-+ flags |= SECTION_TLS;
-+
- return flags;
- }
-
-@@ -5374,6 +5392,8 @@ default_elf_asm_named_section (name, fla
- *f++ = 'M';
- if (flags & SECTION_STRINGS)
- *f++ = 'S';
-+ if (flags & SECTION_TLS)
-+ *f++ = 'T';
- *f = '\0';
-
- if (flags & SECTION_BSS)
+++ /dev/null
-2002-07-30 Jakub Jelinek <jakub@redhat.com>
-
- * expr.c (expand_expr) [ADDR_EXPR]: Force addresses of thread-local
- variables into pseudo.
-
- * gcc.dg/tls/opt-1.c: New test.
-
---- gcc/testsuite/gcc.dg/tls/opt-1.c.jj 2002-07-30 13:57:33.000000000 +0200
-+++ gcc/testsuite/gcc.dg/tls/opt-1.c 2002-07-30 13:56:40.000000000 +0200
-@@ -0,0 +1,28 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -fPIC" } */
-+/* { dg-options "-O2 -fPIC -mcpu=i686" { target i?86-*-* } } */
-+
-+extern __thread int thr;
-+
-+static int x;
-+
-+static void
-+bar (void)
-+{
-+ x = 1;
-+}
-+
-+static void
-+#ifdef __i386__
-+__attribute__ ((regparm (3)))
-+#endif
-+foo (const char *x, void *y, int *z)
-+{
-+ bar ();
-+}
-+
-+void
-+test (const char *x, void *y)
-+{
-+ foo (x, y, &thr);
-+}
---- gcc/expr.c.jj 2002-07-30 12:49:43.000000000 +0200
-+++ gcc/expr.c 2002-07-30 20:18:36.000000000 +0200
-@@ -8833,7 +8833,12 @@ expand_expr (exp, target, tmode, modifie
- op0 = force_operand (XEXP (op0, 0), target);
- }
-
-- if (flag_force_addr
-+ if ((flag_force_addr
-+ || (TREE_CODE (TREE_OPERAND (exp, 0)) == VAR_DECL
-+ && DECL_THREAD_LOCAL (TREE_OPERAND (exp, 0))
-+ && ! memory_address_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp,
-+ 0))),
-+ op0)))
- && GET_CODE (op0) != REG
- && modifier != EXPAND_CONST_ADDRESS
- && modifier != EXPAND_INITIALIZER
+++ /dev/null
-2002-08-06 Aldy Hernandez <aldyh@redhat.com>
-
- * c-decl.c (duplicate_decls): Error out for incompatible TLS
- declarations.
-
- * testsuite/gcc.dg/tls/diag-3.c: New.
-
-*** gcc/c-decl.c 1 Aug 2002 06:20:30 -0000 1.344
---- gcc/c-decl.c 7 Aug 2002 01:01:55 -0000
-*************** duplicate_decls (newdecl, olddecl, diffe
-*** 1673,1678 ****
---- 1673,1692 ----
- if (TREE_CODE (newdecl) == VAR_DECL)
- DECL_INITIAL (newdecl) = 0;
- }
-+ /* TLS cannot follow non-TLS declaration. */
-+ else if (TREE_CODE (olddecl) == VAR_DECL && TREE_CODE (newdecl) == VAR_DECL
-+ && !DECL_THREAD_LOCAL (olddecl) && DECL_THREAD_LOCAL (newdecl))
-+ {
-+ error_with_decl (newdecl, "thread-local declaration of `%s' follows non thread-local declaration");
-+ error_with_decl (olddecl, "previous declaration of `%s'");
-+ }
-+ /* non-TLS declaration cannot follow TLS declaration. */
-+ else if (TREE_CODE (olddecl) == VAR_DECL && TREE_CODE (newdecl) == VAR_DECL
-+ && DECL_THREAD_LOCAL (olddecl) && !DECL_THREAD_LOCAL (newdecl))
-+ {
-+ error_with_decl (newdecl, "non thread-local declaration of `%s' follows thread-local declaration");
-+ error_with_decl (olddecl, "previous declaration of `%s'");
-+ }
- else
- {
- errmsg = redeclaration_error_message (newdecl, olddecl);
-*** gcc/testsuite/gcc.dg/tls/diag-3.c 1 Jan 1970 00:00:00 -0000
---- gcc/testsuite/gcc.dg/tls/diag-3.c 7 Aug 2002 01:01:55 -0000
-***************
-*** 0 ****
---- 1,10 ----
-+ /* Report invalid extern and __thread combinations. */
-+
-+ extern int j; /* { dg-error "previous declaration" } */
-+ __thread int j; /* { dg-error "thread-local declaration" } */
-+
-+ extern __thread int i; /* { dg-error "previous declaration" } */
-+ int i; /* { dg-error "non thread-local" } */
-+
-+ extern __thread int k; /* This is fine. */
-+ __thread int k;
-
+++ /dev/null
-2002-05-22 Richard Henderson <rth@redhat.com>
-
- * varasm.c (default_section_type_flags): Handle tls data and
- default sections.
-
- * gcc.dg/tls/section-1.c: New test.
-
-2002-03-15 Jason Merrill <jason@redhat.com>
-
- * varasm.c (assemble_variable): Call resolve_unique_section before
- checking DECL_SECTION_NAME.
-
---- gcc/testsuite/gcc.dg/tls/section-1.c.jj 2002-08-08 16:11:55.000000000 +0200
-+++ gcc/testsuite/gcc.dg/tls/section-1.c 2002-08-08 16:19:08.000000000 +0200
-@@ -0,0 +1,11 @@
-+/* Verify that we get errors for trying to put TLS data in
-+ sections which can't work. */
-+
-+#define A(X) __attribute__((section(X)))
-+
-+__thread int i A("foo"); /* Ok */
-+
-+__thread int j A(".data"); /* { dg-error "causes a section type conflict" "conflict with .data section" { xfail *-*-* } } */
-+
-+int k A("bar");
-+__thread int l A("bar"); /* { dg-error "causes a section type conflict" "conflict with user-defined section" } */
---- gcc/varasm.c.jj 2002-08-01 20:58:53.000000000 +0200
-+++ gcc/varasm.c 2002-08-08 16:10:15.000000000 +0200
-@@ -1599,6 +1599,13 @@
- if (TREE_PUBLIC (decl))
- maybe_assemble_visibility (decl);
-
-+ /* Output any data that we will need to use the address of. */
-+ if (DECL_INITIAL (decl) == error_mark_node)
-+ reloc = contains_pointers_p (TREE_TYPE (decl)) ? 3 : 0;
-+ else if (DECL_INITIAL (decl))
-+ reloc = output_addressed_constants (DECL_INITIAL (decl));
-+ resolve_unique_section (decl, reloc, flag_data_sections);
-+
- /* Handle uninitialized definitions. */
-
- /* If the decl has been given an explicit section name, then it
-@@ -1654,14 +1661,7 @@
- if (TREE_PUBLIC (decl) && DECL_NAME (decl))
- globalize_decl (decl);
-
-- /* Output any data that we will need to use the address of. */
-- if (DECL_INITIAL (decl) == error_mark_node)
-- reloc = contains_pointers_p (TREE_TYPE (decl)) ? 3 : 0;
-- else if (DECL_INITIAL (decl))
-- reloc = output_addressed_constants (DECL_INITIAL (decl));
--
- /* Switch to the appropriate section. */
-- resolve_unique_section (decl, reloc, flag_data_sections);
- variable_section (decl, reloc);
-
- /* dbxout.c needs to know this. */
-@@ -5345,11 +5345,14 @@
- || strcmp (name, ".sbss") == 0
- || strncmp (name, ".sbss.", 6) == 0
- || strncmp (name, ".gnu.linkonce.sb.", 17) == 0
-- || strcmp (name, ".tbss") == 0)
-+ || strcmp (name, ".tbss") == 0
-+ || strncmp (name, ".gnu.linkonce.tb.", 17) == 0)
- flags |= SECTION_BSS;
-
- if (strcmp (name, ".tdata") == 0
-- || strcmp (name, ".tbss") == 0)
-+ || strcmp (name, ".tbss") == 0
-+ || strncmp (name, ".gnu.linkonce.td.", 17) == 0
-+ || strncmp (name, ".gnu.linkonce.tb.", 17) == 0)
- flags |= SECTION_TLS;
-
- return flags;
+++ /dev/null
-2002-08-08 Jakub Jelinek <jakub@redhat.com>
-
- * config/i386/i386.c (legitimate_constant_p): UNSPEC_TP is not
- legitimate constant.
- (legitimate_pic_operand_p): Neither pic operand.
- (legitimate_address_p): But legitimate address.
- (get_thread_pointer): Generate MEM/u instead of CONST around
- UNSPEC_TP.
- (print_operand): Remove printing of UNSPEC_TP.
- (print_operand_address): And print it here.
-
- * gcc.dg/tls/opt-2.c: New test.
-
---- gcc/config/i386/i386.c.jj 2002-08-07 22:18:39.000000000 +0200
-+++ gcc/config/i386/i386.c 2002-08-08 18:18:18.000000000 +0200
-@@ -4861,8 +4861,6 @@
- {
- case UNSPEC_TPOFF:
- return local_exec_symbolic_operand (XVECEXP (inner, 0, 0), Pmode);
-- case UNSPEC_TP:
-- return true;
- default:
- return false;
- }
-@@ -4921,8 +4919,6 @@
- {
- case UNSPEC_TPOFF:
- return local_exec_symbolic_operand (XVECEXP (inner, 0, 0), Pmode);
-- case UNSPEC_TP:
-- return true;
- default:
- return false;
- }
-@@ -5048,6 +5044,13 @@
- debug_rtx (addr);
- }
-
-+ if (GET_CODE (addr) == UNSPEC && XINT (addr, 1) == UNSPEC_TP)
-+ {
-+ if (TARGET_DEBUG_ADDR)
-+ fprintf (stderr, "Success.\n");
-+ return TRUE;
-+ }
-+
- if (ix86_decompose_address (addr, &parts) <= 0)
- {
- reason = "decomposition failed";
-@@ -5499,7 +5502,9 @@
- rtx tp;
-
- tp = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const0_rtx), UNSPEC_TP);
-- tp = gen_rtx_CONST (Pmode, tp);
-+ tp = gen_rtx_MEM (Pmode, tp);
-+ RTX_UNCHANGING_P (tp) = 1;
-+ set_mem_alias_set (tp, ix86_GOT_alias_set ());
- tp = force_reg (Pmode, tp);
-
- return tp;
-@@ -6613,17 +6618,6 @@
- fprintf (file, "%s", dstr);
- }
-
-- else if (GET_CODE (x) == CONST
-- && GET_CODE (XEXP (x, 0)) == UNSPEC
-- && XINT (XEXP (x, 0), 1) == UNSPEC_TP)
-- {
-- if (ASSEMBLER_DIALECT == ASM_INTEL)
-- fputs ("DWORD PTR ", file);
-- if (ASSEMBLER_DIALECT == ASM_ATT || USER_LABEL_PREFIX[0] == 0)
-- putc ('%', file);
-- fputs ("gs:0", file);
-- }
--
- else
- {
- if (code != 'P')
-@@ -6662,6 +6656,16 @@
- rtx base, index, disp;
- int scale;
-
-+ if (GET_CODE (addr) == UNSPEC && XINT (addr, 1) == UNSPEC_TP)
-+ {
-+ if (ASSEMBLER_DIALECT == ASM_INTEL)
-+ fputs ("DWORD PTR ", file);
-+ if (ASSEMBLER_DIALECT == ASM_ATT || USER_LABEL_PREFIX[0] == 0)
-+ putc ('%', file);
-+ fputs ("gs:0", file);
-+ return;
-+ }
-+
- if (! ix86_decompose_address (addr, &parts))
- {
- output_operand_lossage ("Wrong address expression or operand constraint");
---- gcc/testsuite/gcc.dg/tls/opt-2.c.jj 2002-08-08 18:36:32.000000000 +0200
-+++ gcc/testsuite/gcc.dg/tls/opt-2.c 2002-08-08 18:34:44.000000000 +0200
-@@ -0,0 +1,53 @@
-+/* This testcase generated invalid assembly on IA-32,
-+ since %gs:0 memory load was not exposed to the compiler
-+ as memory load and mem to mem moves are not possible
-+ on IA-32. */
-+/* { dg-do link } */
-+/* { dg-options "-O2 -ftls-model=initial-exec" } */
-+/* { dg-options "-O2 -ftls-model=initial-exec -march=i686" { target i?86-*-* } } */
-+
-+__thread int thr;
-+
-+struct A
-+{
-+ unsigned int a, b, c, d, e;
-+};
-+
-+int bar (int x, unsigned long y, void *z)
-+{
-+ return 0;
-+}
-+
-+int
-+foo (int x, int y, const struct A *z)
-+{
-+ struct A b;
-+ int d;
-+
-+ b = *z;
-+ d = bar (x, y, &b);
-+ if (d == 0 && y == 0x5402)
-+ {
-+ int e = thr;
-+ d = bar (x, 0x5401, &b);
-+ if (d)
-+ {
-+ thr = e;
-+ d = 0;
-+ }
-+ else if ((z->c & 0600) != (b.c & 0600)
-+ || ((z->c & 060) && ((z->c & 060) != (b.c & 060))))
-+ {
-+ thr = 22;
-+ d = -1;
-+ }
-+ }
-+
-+ return d;
-+}
-+
-+int main (void)
-+{
-+ foo (1, 2, 0);
-+ return 0;
-+}
+++ /dev/null
-This is an optimization hack which should only be present
-in a sparc 32bit driver of the compiler compiled with
-host/target/build sparc64-redhat-linux --with-cpu=v7.
-As long long HOST_WIDE_INT slows things down, we can have in
-addition to the sparc64-*/3.2/{cc1,cc1plus}
-sparc-*/3.2/{cc1,cc1plus} binaries which are suitable for compiling
--m32 code only, but use long HOST_WIDE_INT.
-
---- gcc/gcc.c.jj 2003-05-15 18:06:04.000000000 -0400
-+++ gcc/gcc.c 2003-05-20 10:31:15.000000000 -0400
-@@ -3003,6 +3003,8 @@ process_command (argc, argv)
- int have_c = 0;
- int have_o = 0;
- int lang_n_infiles = 0;
-+ int m64 = 0;
-+ int used_B = 0;
- #ifdef MODIFY_TARGET_NAME
- int is_modify_target_name;
- int j;
-@@ -3493,6 +3495,7 @@ warranty; not even for MERCHANTABILITY o
- PREFIX_PRIORITY_B_OPT, 0, &warn_B, 0);
- add_prefix (&include_prefixes, concat (value, "include", NULL),
- NULL, PREFIX_PRIORITY_B_OPT, 0, NULL, 0);
-+ used_B = 1;
- n_switches++;
- }
- break;
-@@ -3555,6 +3558,13 @@ warranty; not even for MERCHANTABILITY o
- #endif
- goto normal_switch;
-
-+ /* HACK START */
-+ case 'm':
-+ if (p[1] == '6' && p[2] == '4')
-+ m64 = 1;
-+ /* FALLTHROUGH */
-+ /* HACK END */
-+
- default:
- normal_switch:
-
-@@ -3621,6 +3631,26 @@ warranty; not even for MERCHANTABILITY o
- /* Use 2 as fourth arg meaning try just the machine as a suffix,
- as well as trying the machine and the version. */
- #ifndef OS2
-+ /* HACK START */
-+ if (!m64 && !used_B && !strncmp (spec_machine, "sparc64-", 8))
-+ {
-+ const char *sparc32_exec_prefix =
-+ concat (standard_exec_prefix, "sparc-", spec_machine + 8,
-+ dir_separator_str, spec_version, dir_separator_str, NULL);
-+ add_prefix (&exec_prefixes, sparc32_exec_prefix, "GCC",
-+ PREFIX_PRIORITY_LAST, 0, warn_std_ptr, 0);
-+ }
-+ /* HACK END */
-+ /* HACK START */
-+ if (!m64 && !used_B && !strncmp (spec_machine, "ppc64-", 6))
-+ {
-+ const char *ppc32_exec_prefix =
-+ concat (standard_exec_prefix, "ppc-", spec_machine + 6,
-+ dir_separator_str, spec_version, dir_separator_str, NULL);
-+ add_prefix (&exec_prefixes, ppc32_exec_prefix, "GCC",
-+ PREFIX_PRIORITY_LAST, 0, warn_std_ptr, 0);
-+ }
-+ /* HACK END */
- add_prefix (&exec_prefixes, standard_exec_prefix, "GCC",
- PREFIX_PRIORITY_LAST, 1, warn_std_ptr, 0);
- add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS",
--- /dev/null
+AC_DEFUN([HIDE_INLINES], [
+ visibility_inlines_hidden=yes
+ if test "X$CXX" != "X"; then
+ AC_MSG_CHECKING([whether ${CXX} accepts -fvisbility-inlines-hidden])
+ visbility_old_cxxflags="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
+ AC_TRY_COMPILE(, , , visibility_inlines_hidden=no)
+ echo $visibility_inlines_hidden
+ if test "X$visibility_inlines_hidden" = "Xno"; then
+ CXXFLAGS="$visibility_old_cxxflags"
+ fi
+ fi
+])
+
+AC_DEFUN([HIDDEN_ATTRIBUTE], [
+ if test "X$CC" != "X"; then
+ AC_MSG_CHECKING([GCC visibility attribute])
+ AC_TRY_COMPILE(
+ [int __attribute__((visibility("hidden"))) test();],
+ [],
+ AC_DEFINE(HAVE_HIDDEN_ATTRIBUTE, 1, [])
+ AC_MSG_RESULT(yes),
+ AC_MSG_RESULT(no)
+ )
+ fi
+])
+++ /dev/null
-.TH GCOV 1
-.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection
-.\" other parms are allowed: see man(7), man(1)
-.SH NAME
-gcov \- test coverage program for GNU CC
-.SH SYNOPSIS
-.B gcov
-.I "[-b] [-v] [-n] [-l] [-f] [-o directory] sourcefile"
-.br
-.SH "DESCRIPTION"
-This manual page documents briefly the
-.BR gcov
-command.
-This manual page was written for the Debian GNU/Linux distribution
-(but may be used by others), because the original program does not
-have a manual page.
-Instead, it has documentation in the GNU Info format; see below.
-.PP
-.B gcov
-is a test coverage program. Use it in concert with GNU
-CC to analyze your programs to help create more efficient, faster
-running code. You can use gcov as a profiling tool to help
-discover where your optimization efforts will best affect your code. You
-can also use gcov along with the other profiling tool,
-.B gprof
-, to assess which parts of your code use the greatest amount
-of computing time.
-.SH "SEE ALSO"
-The program is documented fully by
-.IR "gcc: The GNU C compiler.",
-available via the Info system. The documentation for genclass can be
-found in the subsection "Gcov", under "a GNU CC test coverage program".
-.SH AUTHOR
-This manual page was written by the egcs maintainers for the Debian
-GNU/Linux system.