diff --git a/.cvsignore b/.cvsignore index 3cec4f2..3ffde1f 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,2 +1,3 @@ -gcc-core-4.3.2.tar.bz2 -gcc-g++-4.3.2.tar.bz2 +fastjar-0.97.tar.gz +gcc-4.4.0-20090216.tar.bz2 +cloog-ppl-0.15.tar.gz diff --git a/README.libgcjwebplugin.so b/README.libgcjwebplugin.so new file mode 100644 index 0000000..d0c9090 --- /dev/null +++ b/README.libgcjwebplugin.so @@ -0,0 +1,56 @@ +gcjwebplugin is a Firefox plugin for running Java applets. It is now +included in the libgcj sub-package, though it is not enabled by +default. + +GNU Classpath and libgcj's security implementation is under active +development, but it is not ready to be declared secure. Specifically, +it cannot run untrusted applets safely. + +When gcjwebplugin is enabled, it prompts you with a dialog before +loading an applet. The dialog tells you that a certain URL would like +to load an applet, and asks if you trust the applet. Be aware though +that this dialog is mostly informative and doesn't provide much +protection: + +- http and DNS can be spoofed meaning that the URL named in the + warning dialog cannot be trusted + +- someone could create a browser denial-of-service attack by creating a + page with hundreds of applet tags, causing gcjwebplugin to create + warning dialog after warning dialog. The browser would have to be + closed to eliminate the latest dialog + +- the whitelist is provided as a convenience, but it is unsafe because a + domain may change hands from a trusted owner to an untrusted owner. + If that domain is in the whitelist then the warning dialog will not + appear when loading the new malicious applet. + +CURRENTLY GCJWEBPLUGIN RUNS WITH NO SECURITY MANAGER. THIS MEANS THAT +APPLETS CAN DO ANYTHING A JAVA APPLICATION THAT YOU DOWNLOAD AND RUN +COULD DO. BE *VERY* CAREFUL WHICH APPLETS YOU RUN. DO NOT USE +GCJWEBPLUGIN ON YOUR SYSTEM IF YOUR SYSTEM STORES IMPORTANT DATA. +THIS DATA CAN BE DESTROYED OR STOLEN. + +The same warning applies to gappletviewer, which also runs with no +security manager (in fact, gcjwebplugin spawns gappletviewer to do the +applet loading). When run on the command line, gappletviewer issues a +warning on startup and asks you if you want to continue. + +Even considering the risks involved, you may still want to try +gcjwebplugin. GNU Classpath's AWT and Swing implementations are now +sufficiently mature that they're able to run many applets deployed on +the web. If you're interested in trying gcjwebplugin, you can do so +by creating a symbolic link in ~/.mozilla/plugins like so: + +ln -s /usr/lib/gcj-@VERSION@/libgcjwebplugin.so ~/.mozilla/plugins/ + +Type about:plugins in Firefox's URL bar to confirm that the plugin has +been loaded. To see gcjwebplugin debugging output, run: + +firefox -g + +then at the GDB prompt, type + +run + +Please report bugs in Red Hat Bugzilla: http://bugzilla.redhat.com diff --git a/fastjar-0.97-segfault.patch b/fastjar-0.97-segfault.patch new file mode 100644 index 0000000..ab62624 --- /dev/null +++ b/fastjar-0.97-segfault.patch @@ -0,0 +1,29 @@ +2009-01-14 Jakub Jelinek + + * jartool.c (make_manifest): Initialize current_time before + calling unix2dostime on it. + +--- fastjar-0.97/jartool.c.jj 2008-10-15 18:35:37.000000000 +0200 ++++ fastjar-0.97/jartool.c 2009-01-14 15:40:50.000000000 +0100 +@@ -820,6 +820,10 @@ int make_manifest(int jfd, const char *m + int mod_time; /* file modification time */ + struct zipentry *ze; + ++ current_time = time(NULL); ++ if(current_time == (time_t)-1) ++ exit_on_error("time"); ++ + mod_time = unix2dostime(¤t_time); + + /* If we are creating a new manifest, create a META-INF directory entry */ +@@ -828,10 +832,6 @@ int make_manifest(int jfd, const char *m + + memset((file_header + 12), '\0', 16); /*clear mod time, crc, size fields*/ + +- current_time = time(NULL); +- if(current_time == (time_t)-1) +- exit_on_error("time"); +- + PACK_UB2(file_header, LOC_EXTRA, 0); + PACK_UB2(file_header, LOC_COMP, 0); + PACK_UB2(file_header, LOC_FNLEN, nlen); diff --git a/gcc44-build-id.patch b/gcc44-build-id.patch new file mode 100644 index 0000000..f76f939 --- /dev/null +++ b/gcc44-build-id.patch @@ -0,0 +1,52 @@ +2007-07-22 Roland McGrath + + * config/rs6000/sysv4.h (LINK_EH_SPEC): Add --build-id for + non-relocatable link. + * config/linux.h (LINK_EH_SPEC): Likewise. + * config/alpha/elf.h (LINK_EH_SPEC): Likewise. + * config/ia64/linux.h (LINK_EH_SPEC): Likewise. + +--- gcc/config/rs6000/sysv4.h.~1~ ++++ gcc/config/rs6000/sysv4.h +@@ -906,7 +906,7 @@ extern int fixuplabelno; + %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}}}" + + #if defined(HAVE_LD_EH_FRAME_HDR) +-# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " ++# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} %{!r:--build-id} " + #endif + + #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \ +--- gcc/config/linux.h.~1~ ++++ gcc/config/linux.h +@@ -85,7 +85,7 @@ Boston, MA 02110-1301, USA. */ + } while (0) + + #if defined(HAVE_LD_EH_FRAME_HDR) +-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " ++#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} %{!r:--build-id} " + #endif + + /* Define this so we can compile MS code for use with WINE. */ +--- gcc/config/alpha/elf.h.~1~ ++++ gcc/config/alpha/elf.h +@@ -421,7 +421,7 @@ extern int alpha_this_gpdisp_sequence_nu + I imagine that other systems will catch up. In the meantime, it + doesn't harm to make sure that the data exists to be used later. */ + #if defined(HAVE_LD_EH_FRAME_HDR) +-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " ++#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} %{!r:--build-id} " + #endif + + /* A C statement (sans semicolon) to output to the stdio stream STREAM +--- gcc/config/ia64/linux.h.~1~ ++++ gcc/config/ia64/linux.h +@@ -56,7 +56,7 @@ do { \ + Signalize that because we have fde-glibc, we don't need all C shared libs + linked against -lgcc_s. */ + #undef LINK_EH_SPEC +-#define LINK_EH_SPEC "" ++#define LINK_EH_SPEC "%{!r:--build-id} " + + #define MD_UNWIND_SUPPORT "config/ia64/linux-unwind.h" + diff --git a/gcc44-c++-builtin-redecl.patch b/gcc44-c++-builtin-redecl.patch new file mode 100644 index 0000000..77655ad --- /dev/null +++ b/gcc44-c++-builtin-redecl.patch @@ -0,0 +1,102 @@ +2007-10-02 Jakub Jelinek + + * decl.c (duplicate_decls): When redeclaring a builtin function, + keep the merged decl builtin whenever types match, even if new + decl defines a function. + + * gcc.dg/builtins-65.c: New test. + * g++.dg/ext/builtin10.C: New test. + +--- gcc/cp/decl.c.jj 2007-10-01 22:11:09.000000000 +0200 ++++ gcc/cp/decl.c 2007-10-02 11:39:46.000000000 +0200 +@@ -1988,23 +1988,21 @@ duplicate_decls (tree newdecl, tree oldd + DECL_ARGUMENTS (olddecl) = DECL_ARGUMENTS (newdecl); + DECL_RESULT (olddecl) = DECL_RESULT (newdecl); + } ++ /* If redeclaring a builtin function, it stays built in. */ ++ if (types_match && DECL_BUILT_IN (olddecl)) ++ { ++ DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl); ++ DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl); ++ /* If we're keeping the built-in definition, keep the rtl, ++ regardless of declaration matches. */ ++ COPY_DECL_RTL (olddecl, newdecl); ++ } + if (new_defines_function) + /* If defining a function declared with other language + linkage, use the previously declared language linkage. */ + SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl)); + else if (types_match) + { +- /* If redeclaring a builtin function, and not a definition, +- it stays built in. */ +- if (DECL_BUILT_IN (olddecl)) +- { +- DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl); +- DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl); +- /* If we're keeping the built-in definition, keep the rtl, +- regardless of declaration matches. */ +- COPY_DECL_RTL (olddecl, newdecl); +- } +- + DECL_RESULT (newdecl) = DECL_RESULT (olddecl); + /* Don't clear out the arguments if we're redefining a function. */ + if (DECL_ARGUMENTS (olddecl)) +--- gcc/testsuite/gcc.dg/builtins-65.c.jj 2007-10-02 11:23:51.000000000 +0200 ++++ gcc/testsuite/gcc.dg/builtins-65.c 2007-10-02 11:24:12.000000000 +0200 +@@ -0,0 +1,25 @@ ++/* { dg-do compile } */ ++/* { dg-options "-O2" } */ ++ ++typedef __SIZE_TYPE__ size_t; ++extern void __chk_fail (void); ++extern int snprintf (char *, size_t, const char *, ...); ++extern inline __attribute__((gnu_inline, always_inline)) int snprintf (char *a, size_t b, const char *fmt, ...) ++{ ++ if (__builtin_object_size (a, 0) != -1UL && __builtin_object_size (a, 0) < b) ++ __chk_fail (); ++ return __builtin_snprintf (a, b, fmt, __builtin_va_arg_pack ()); ++} ++extern int snprintf (char *, size_t, const char *, ...) __asm ("mysnprintf"); ++ ++char buf[10]; ++ ++int ++main (void) ++{ ++ snprintf (buf, 10, "%d%d\n", 10, 10); ++ return 0; ++} ++ ++/* { dg-final { scan-assembler "mysnprintf" } } */ ++/* { dg-final { scan-assembler-not "__chk_fail" } } */ +--- gcc/testsuite/g++.dg/ext/builtin10.C.jj 2007-10-02 11:19:45.000000000 +0200 ++++ gcc/testsuite/g++.dg/ext/builtin10.C 2007-10-02 11:23:26.000000000 +0200 +@@ -0,0 +1,27 @@ ++// { dg-do compile } ++// { dg-options "-O2" } ++ ++typedef __SIZE_TYPE__ size_t; ++extern "C" { ++extern void __chk_fail (void); ++extern int snprintf (char *, size_t, const char *, ...); ++extern inline __attribute__((gnu_inline, always_inline)) int snprintf (char *a, size_t b, const char *fmt, ...) ++{ ++ if (__builtin_object_size (a, 0) != -1UL && __builtin_object_size (a, 0) < b) ++ __chk_fail (); ++ return __builtin_snprintf (a, b, fmt, __builtin_va_arg_pack ()); ++} ++extern int snprintf (char *, size_t, const char *, ...) __asm ("mysnprintf"); ++} ++ ++char buf[10]; ++ ++int ++main (void) ++{ ++ snprintf (buf, 10, "%d%d\n", 10, 10); ++ return 0; ++} ++ ++// { dg-final { scan-assembler "mysnprintf" } } ++// { dg-final { scan-assembler-not "__chk_fail" } } diff --git a/gcc44-cloog-dl.patch b/gcc44-cloog-dl.patch new file mode 100644 index 0000000..6599cf8 --- /dev/null +++ b/gcc44-cloog-dl.patch @@ -0,0 +1,211 @@ +2009-01-27 Jakub Jelinek + + * toplev.c (save_argv): No longer static. + * Makefile.in (BACKENDLIBS): Link against -ldl instead of -lcloog -lppl. + (graphite.o): Force -O, remove -fkeep-inline-functions. + * graphite.c: Include . Reference libcloog and libppl symbols + through pointers in cloog_pointers variable. + (init_cloog_pointers): New function. + (gcc_type_for_iv_of_clast_loop): Rename stmt_for argument to stmt_fora. + (graphite_transform_loops): Call init_cloog_pointers. + +--- gcc/toplev.c.jj 2008-12-09 23:59:10.000000000 +0100 ++++ gcc/toplev.c 2009-01-27 14:33:52.000000000 +0100 +@@ -128,7 +128,7 @@ static bool no_backend; + const char *progname; + + /* Copy of argument vector to toplev_main. */ +-static const char **save_argv; ++const char **save_argv; + + /* Name of top-level original source file (what was input to cpp). + This comes from the #-command at the beginning of the actual input. +--- gcc/Makefile.in.jj 2009-01-26 20:50:38.000000000 +0100 ++++ gcc/Makefile.in 2009-01-27 14:18:10.000000000 +0100 +@@ -915,7 +915,7 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY) + # How to link with both our special library facilities + # and the system's installed libraries. + LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) $(LIBDECNUMBER) +-BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(GMPLIBS) ++BACKENDLIBS = $(GMPLIBS) $(if $(CLOOGLIBS),-ldl) + # Any system libraries needed just for GNAT. + SYSLIBS = @GNAT_LIBEXC@ + +@@ -3076,6 +3076,9 @@ $(out_object_file): $(out_file) $(CONFIG + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ + $(out_file) $(OUTPUT_OPTION) + ++graphite.o : \ ++ ALL_CFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CFLAGS)) ++ + # Build auxiliary files that support ecoff format. + mips-tfile: mips-tfile.o version.o $(LIBDEPS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tfile.o version.o $(LIBS) +--- gcc/graphite.c.jj 2009-01-24 19:59:02.000000000 +0100 ++++ gcc/graphite.c 2009-01-27 14:52:08.000000000 +0100 +@@ -59,6 +59,138 @@ along with GCC; see the file COPYING3. + #include "cloog/cloog.h" + #include "graphite.h" + ++#include ++#define DYNSYMS \ ++ DYNSYM (cloog_block_alloc); \ ++ DYNSYM (cloog_block_list_free); \ ++ DYNSYM (cloog_block_list_malloc); \ ++ DYNSYM (cloog_clast_create); \ ++ DYNSYM (cloog_clast_free); \ ++ DYNSYM (cloog_domain_free); \ ++ DYNSYM (cloog_domain_matrix2domain); \ ++ DYNSYM (cloog_initialize); \ ++ DYNSYM (cloog_loop_malloc); \ ++ DYNSYM (cloog_matrix_alloc); \ ++ DYNSYM (cloog_matrix_copy); \ ++ DYNSYM (cloog_matrix_free); \ ++ DYNSYM (cloog_matrix_print); \ ++ DYNSYM (cloog_names_malloc); \ ++ DYNSYM (cloog_names_scalarize); \ ++ DYNSYM (cloog_options_free); \ ++ DYNSYM (cloog_options_malloc); \ ++ DYNSYM (cloog_program_dump_cloog); \ ++ DYNSYM (cloog_program_extract_scalars); \ ++ DYNSYM (cloog_program_free); \ ++ DYNSYM (cloog_program_generate); \ ++ DYNSYM (cloog_program_malloc); \ ++ DYNSYM (cloog_program_print); \ ++ DYNSYM (cloog_program_scatter); \ ++ DYNSYM (cloog_statement_alloc); \ ++ DYNSYM (ppl_finalize); \ ++ DYNSYM (pprint); \ ++ DYNSYM (stmt_block); \ ++ DYNSYM (stmt_for); \ ++ DYNSYM (stmt_guard); \ ++ DYNSYM (stmt_root); \ ++ DYNSYM (stmt_user); ++static struct ++{ ++ bool inited; ++ void *h; ++#define DYNSYM(x) __typeof (x) *p_##x ++ DYNSYMS ++#undef DYNSYM ++} cloog_pointers; ++ ++#define cloog_block_alloc (*cloog_pointers.p_cloog_block_alloc) ++#define cloog_block_list_free (*cloog_pointers.p_cloog_block_list_free) ++#define cloog_block_list_malloc (*cloog_pointers.p_cloog_block_list_malloc) ++#define cloog_clast_create (*cloog_pointers.p_cloog_clast_create) ++#define cloog_clast_free (*cloog_pointers.p_cloog_clast_free) ++#define cloog_domain_free (*cloog_pointers.p_cloog_domain_free) ++#define cloog_domain_matrix2domain (*cloog_pointers.p_cloog_domain_matrix2domain) ++#define cloog_initialize (*cloog_pointers.p_cloog_initialize) ++#define cloog_loop_malloc (*cloog_pointers.p_cloog_loop_malloc) ++#define cloog_matrix_alloc (*cloog_pointers.p_cloog_matrix_alloc) ++#define cloog_matrix_copy (*cloog_pointers.p_cloog_matrix_copy) ++#define cloog_matrix_free (*cloog_pointers.p_cloog_matrix_free) ++#define cloog_matrix_print (*cloog_pointers.p_cloog_matrix_print) ++#define cloog_names_malloc (*cloog_pointers.p_cloog_names_malloc) ++#define cloog_names_scalarize (*cloog_pointers.p_cloog_names_scalarize) ++#define cloog_options_free (*cloog_pointers.p_cloog_options_free) ++#define cloog_options_malloc (*cloog_pointers.p_cloog_options_malloc) ++#define cloog_program_dump_cloog (*cloog_pointers.p_cloog_program_dump_cloog) ++#define cloog_program_extract_scalars (*cloog_pointers.p_cloog_program_extract_scalars) ++#define cloog_program_free (*cloog_pointers.p_cloog_program_free) ++#define cloog_program_generate (*cloog_pointers.p_cloog_program_generate) ++#define cloog_program_malloc (*cloog_pointers.p_cloog_program_malloc) ++#define cloog_program_print (*cloog_pointers.p_cloog_program_print) ++#define cloog_program_scatter (*cloog_pointers.p_cloog_program_scatter) ++#define cloog_statement_alloc (*cloog_pointers.p_cloog_statement_alloc) ++#define ppl_finalize (*cloog_pointers.p_ppl_finalize) ++#define pprint (*cloog_pointers.p_pprint) ++#define stmt_block (*cloog_pointers.p_stmt_block) ++#define stmt_for (*cloog_pointers.p_stmt_for) ++#define stmt_guard (*cloog_pointers.p_stmt_guard) ++#define stmt_root (*cloog_pointers.p_stmt_root) ++#define stmt_user (*cloog_pointers.p_stmt_user) ++ ++#define cloog_finalize (*cloog_pointers.p_ppl_finalize) ++ ++static bool ++init_cloog_pointers (void) ++{ ++ void *h = NULL; ++ extern const char **save_argv; ++ char *buf, *p; ++ size_t len; ++ ++ if (cloog_pointers.inited) ++ return cloog_pointers.h != NULL; ++ len = progname - save_argv[0]; ++ buf = XALLOCAVAR (char, len + sizeof "libcloog.so.0"); ++ memcpy (buf, save_argv[0], len); ++ strcpy (buf + len, "libcloog.so.0"); ++ len += sizeof "libcloog.so.0"; ++ p = strstr (buf, "/libexec/"); ++ if (p != NULL) ++ { ++ while (1) ++ { ++ char *q = strstr (p + 8, "/libexec/"); ++ if (q == NULL) ++ break; ++ p = q; ++ } ++ memmove (p + 4, p + 8, len - (p + 8 - buf)); ++ h = dlopen (buf, RTLD_LAZY); ++ if (h == NULL) ++ { ++ len = progname - save_argv[0]; ++ memcpy (buf, save_argv[0], len); ++ strcpy (buf + len, "libcloog.so.0"); ++ } ++ } ++ if (h == NULL) ++ h = dlopen (buf, RTLD_LAZY); ++ cloog_pointers.h = h; ++ if (h == NULL) ++ return false; ++#define DYNSYM(x) \ ++ do \ ++ { \ ++ union { __typeof (cloog_pointers.p_##x) p; void *q; } u; \ ++ u.q = dlsym (h, #x); \ ++ if (u.q == NULL) \ ++ return false; \ ++ cloog_pointers.p_##x = u.p; \ ++ } \ ++ while (0) ++ DYNSYMS ++#undef DYNSYM ++ return true; ++} ++ + static VEC (scop_p, heap) *current_scops; + + /* Converts a GMP constant V to a tree and returns it. */ +@@ -4019,10 +4151,10 @@ clast_get_body_of_loop (struct clast_stm + STMT. */ + + static tree +-gcc_type_for_iv_of_clast_loop (struct clast_for *stmt_for) ++gcc_type_for_iv_of_clast_loop (struct clast_for *stmt_fora) + { +- struct clast_user_stmt *stmt = clast_get_body_of_loop ((struct clast_stmt *) stmt_for); +- const char *cloog_iv = stmt_for->iterator; ++ struct clast_user_stmt *stmt = clast_get_body_of_loop ((struct clast_stmt *) stmt_fora); ++ const char *cloog_iv = stmt_fora->iterator; + CloogStatement *cs = stmt->statement; + graphite_bb_p gbb = (graphite_bb_p) cloog_statement_usr (cs); + +@@ -6061,6 +6193,12 @@ graphite_transform_loops (void) + if (number_of_loops () <= 1) + return; + ++ if (!init_cloog_pointers ()) ++ { ++ sorry ("Graphite loop optimizations cannot be used"); ++ return; ++ } ++ + current_scops = VEC_alloc (scop_p, heap, 3); + recompute_all_dominators (); + diff --git a/gcc44-diff.patch b/gcc44-diff.patch new file mode 100644 index 0000000..b3cc285 --- /dev/null +++ b/gcc44-diff.patch @@ -0,0 +1,353 @@ +--- gcc/DATESTAMP (revision 144236) ++++ gcc/DATESTAMP (revision 144237) +@@ -1 +1 @@ +-20090216 ++20090217 +--- gcc/ChangeLog (revision 144236) ++++ gcc/ChangeLog (revision 144237) +@@ -1,3 +1,36 @@ ++2009-02-17 Richard Guenther ++ ++ PR tree-optimization/39202 ++ * tree-ssa-structalias.c (do_structure_copy): Before collapsing ++ a var make sure to follow existing collapses. ++ ++2009-02-17 Richard Guenther ++ ++ PR middle-end/39214 ++ * langhooks.c (lhd_print_error_function): Check for NULL block. ++ ++2009-02-17 Richard Guenther ++ ++ PR tree-optimization/39204 ++ * tree-ssa-pre.c (phi_translate_1): Lookup the value-number ++ of the PHI arg. ++ ++2009-02-17 Uros Bizjak ++ ++ * config/soft-fp/double.h: Update from glibc CVS. ++ ++2009-02-17 Richard Guenther ++ ++ PR tree-optimization/39207 ++ * tree-ssa-structalias.c (find_what_p_points_to): Do not emit ++ strict-aliasing warnings for pointers pointing to NULL. ++ ++2009-02-16 Joseph Myers ++ ++ PR c/35446 ++ * c-parser.c (c_parser_braced_init): Call pop_init_level when ++ skipping until next close brace. ++ + 2009-02-16 H.J. Lu + + PR target/37049 +--- gcc/testsuite/gcc.c-torture/compile/pr39202.c (revision 0) ++++ gcc/testsuite/gcc.c-torture/compile/pr39202.c (revision 144237) +@@ -0,0 +1,33 @@ ++typedef struct ++{ ++ union ++ { ++ int * aaa; ++ } u; ++} t_a; ++ ++typedef struct ++{ ++ unsigned bbb : 1; ++} t_b; ++ ++typedef struct ++{ ++ int ccc; ++ t_a ddd; ++ t_b eee; ++ int fff; ++} t_c; ++ ++typedef struct t_d ++{ ++ t_c f1; ++ t_c f2; ++} t_d; ++ ++void foo (void) ++{ ++ t_d ggg; ++ ggg.f1 = ggg.f2; ++} ++ +--- gcc/testsuite/gcc.dg/torture/pr39204.c (revision 0) ++++ gcc/testsuite/gcc.dg/torture/pr39204.c (revision 144237) +@@ -0,0 +1,131 @@ ++/* { dg-do compile } */ ++/* { dg-options "-w" } */ ++ ++typedef unsigned int size_t; ++typedef unsigned char __u_char; ++typedef unsigned short int __u_short; ++typedef unsigned int __u_int; ++typedef unsigned long int __u_long; ++typedef signed char __int8_t; ++typedef unsigned char __uint8_t; ++typedef signed short int __int16_t; ++typedef unsigned short int __uint16_t; ++typedef signed int __int32_t; ++typedef unsigned int __uint32_t; ++__extension__ typedef signed long long int __int64_t; ++__extension__ typedef unsigned long long int __uint64_t; ++__extension__ typedef long long int __quad_t; ++__extension__ typedef unsigned long long int __u_quad_t; ++__extension__ typedef __u_quad_t __dev_t; ++__extension__ typedef unsigned int __uid_t; ++__extension__ typedef unsigned int __gid_t; ++__extension__ typedef unsigned long int __ino_t; ++__extension__ typedef __u_quad_t __ino64_t; ++__extension__ typedef unsigned int __mode_t; ++__extension__ typedef unsigned int __nlink_t; ++__extension__ typedef long int __off_t; ++__extension__ typedef __quad_t __off64_t; ++__extension__ typedef int __pid_t; ++__extension__ typedef struct { ++ int __val[2]; ++} __fsid_t; ++__extension__ typedef long int __clock_t; ++__extension__ typedef unsigned int __id_t; ++typedef struct _IO_FILE FILE; ++typedef struct _IO_FILE __FILE; ++typedef struct { ++ int __count; ++ union { ++ unsigned int __wch; ++ char __wchb[4]; ++ } ++ __value; ++} __mbstate_t; ++typedef struct { ++ __off_t __pos; ++ __mbstate_t __state; ++} _G_fpos_t; ++typedef struct { ++ __off64_t __pos; ++ __mbstate_t __state; ++} _G_fpos64_t; ++typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__))); ++typedef struct _IO_FILE _IO_FILE; ++extern struct _IO_FILE_plus _IO_2_1_stderr_; ++extern int fputs (__const char *__restrict __s, FILE * __restrict __stream); ++extern char *strstr (__const char *__haystack, __const char *__needle) ++ __attribute__ ((__nonnull__ (1, 2))); ++ extern char *rindex (__const char *__s, int __c) __attribute__ ((__nonnull__ (1))); ++extern size_t strlen (__const char *__s) __attribute__ ((__nothrow__)) ++ __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); ++ char *mystrlwr (char *string); ++ char *m_replace_filename (const char *path, const char *filename); ++ typedef struct LINE { ++ char *text; ++ struct LINE *next; ++ int flags; ++ } LINE; ++typedef struct TOC { ++ char *text; ++ char *alt; ++ struct TOC *next; ++ int root; ++ int texinfoable; ++ int htmlable; ++ int otherfile; ++} TOC; ++static int _empty_count; ++extern char *_word_substitution[256]; ++static void _output_sorted_nested_toc (TOC ** list, unsigned int num_items); ++static char *_do_text_substitution (char *input); ++static int _toc_scmp (const void *e1, const void *e2) ++{ ++ TOC *t1 = *((TOC **) e1); ++ TOC *t2 = *((TOC **) e2); ++ return mystricmp (t1->text, t2->text); ++} ++static void _output_buffered_text (void) { if (_empty_count) ; } ++void _post_process_filename (char *filename) ++{ ++ int code_scanning = 0; ++ char *new_filename, *p; ++ char *line; ++ FILE *f1 = 0, *f2 = 0; ++ if (!new_filename || strlen (new_filename) < 2) ++ new_filename[strlen (filename) - 1] = 'x'; ++ if (!f1 || !f2) ++ while ((line = m_fgets (f1))) ++ { ++ line = _do_text_substitution (line); ++ fputs (line, f2); ++ } ++ if (remove (filename)) ++ cancel: ++ if (f1) ++ if (f2) ++ if (new_filename) ++ ; ++} ++static void _close_html_file (FILE * file) ++{ ++ int f; ++ for (f = 0; _word_substitution[f]; f++) ++ ; ++} ++static __attribute__((always_inline)) ++char * _do_text_substitution (char *input) ++{ ++ int start, end, middle, f; ++ char *temp, *found, *reader; ++ for (f = 0; _word_substitution[f]; f++) ++ { ++ reader = input; ++ while ((found = strstr (reader, _word_substitution[f]))) ++ { ++ start = found - input; ++ input = temp; ++ reader = temp + start + middle; ++ } ++ } ++ return input; ++} +--- gcc/testsuite/gcc.dg/noncompile/init-5.c (revision 0) ++++ gcc/testsuite/gcc.dg/noncompile/init-5.c (revision 144237) +@@ -0,0 +1,4 @@ ++/* Test for ICE after syntax error in initializer with range ++ designator: PR 35446. */ ++ ++int a[2][2] = { [0 ... 1] = { ; } }; /* { dg-error "expected expression" } */ +--- gcc/testsuite/gcc.dg/init-bad-4.c (revision 144236) ++++ gcc/testsuite/gcc.dg/init-bad-4.c (revision 144237) +@@ -2,4 +2,4 @@ + /* Origin: Richard Guenther */ + /* { dg-do compile } */ + +-struct A { } a = (struct A) {{ (X)0 }}; /* { dg-error "no members|extra brace|near|undeclared|constant|compound" } */ ++struct A { } a = (struct A) {{ (X)0 }}; /* { dg-error "no members|extra brace|near|undeclared|constant|compound|excess" } */ +--- gcc/testsuite/gcc.dg/vect/vect-outer-5.c (revision 144236) ++++ gcc/testsuite/gcc.dg/vect/vect-outer-5.c (revision 144237) +@@ -1,4 +1,4 @@ +-/* { dg-require-effective-target vect_int } */ ++/* { dg-require-effective-target vect_float } */ + + #include + #include +--- gcc/testsuite/gcc.dg/vect/vect-outer-6.c (revision 144236) ++++ gcc/testsuite/gcc.dg/vect/vect-outer-6.c (revision 144237) +@@ -1,4 +1,4 @@ +-/* { dg-require-effective-target vect_int } */ ++/* { dg-require-effective-target vect_float } */ + + #include + #include +--- gcc/testsuite/ChangeLog (revision 144236) ++++ gcc/testsuite/ChangeLog (revision 144237) +@@ -1,3 +1,24 @@ ++2009-02-17 Richard Guenther ++ ++ PR tree-optimization/39202 ++ * gcc.c-torture/compile/pr39202.c: New testcase. ++ ++2009-02-17 Richard Guenther ++ ++ PR tree-optimization/39204 ++ * gcc.dg/torture/pr39204.c: New testcase. ++ ++2009-02-17 Bingfeng Mei ++ ++ * gcc.dg/vect/vect-outer-5.c: Require vect_float support. ++ * gcc.dg/vect/vect-outer-6.c: Ditto. ++ ++2009-02-16 Joseph Myers ++ ++ PR c/35446 ++ * gcc.dg/noncompile/init-5.c: New test. ++ * gcc.dg/init-bad-4.c: Adjust expected errors. ++ + 2009-02-16 H.J. Lu + + PR target/37049 +--- gcc/langhooks.c (revision 144236) ++++ gcc/langhooks.c (revision 144237) +@@ -437,7 +437,7 @@ lhd_print_error_function (diagnostic_con + while (block && TREE_CODE (block) == BLOCK) + block = BLOCK_SUPERCONTEXT (block); + +- if (TREE_CODE (block) == FUNCTION_DECL) ++ if (block && TREE_CODE (block) == FUNCTION_DECL) + fndecl = block; + abstract_origin = NULL; + } +--- gcc/tree-ssa-pre.c (revision 144236) ++++ gcc/tree-ssa-pre.c (revision 144237) +@@ -1707,6 +1707,9 @@ phi_translate_1 (pre_expr expr, bitmap_s + tree def = PHI_ARG_DEF (phi, e->dest_idx); + pre_expr newexpr; + ++ if (TREE_CODE (def) == SSA_NAME) ++ def = VN_INFO (def)->valnum; ++ + /* Handle constant. */ + if (is_gimple_min_invariant (def)) + return get_or_alloc_expr_for_constant (def); +--- gcc/tree-ssa-structalias.c (revision 144236) ++++ gcc/tree-ssa-structalias.c (revision 144237) +@@ -3405,8 +3405,8 @@ do_structure_copy (tree lhsop, tree rhso + { + if (!do_simple_structure_copy (lhs, rhs, MIN (lhssize, rhssize))) + { +- lhs.var = collapse_rest_of_var (lhs.var); +- rhs.var = collapse_rest_of_var (rhs.var); ++ lhs.var = collapse_rest_of_var (get_varinfo_fc (lhs.var)->id); ++ rhs.var = collapse_rest_of_var (get_varinfo_fc (rhs.var)->id); + lhs.offset = 0; + rhs.offset = 0; + lhs.type = SCALAR; +@@ -4935,6 +4935,7 @@ find_what_p_points_to (tree p) + { + pi->pt_vars = NULL; + if (pruned > 0 ++ && !pi->pt_null + && pi->is_dereferenced + && warn_strict_aliasing > 0 + && !SSA_NAME_IS_DEFAULT_DEF (p)) +--- gcc/c-parser.c (revision 144236) ++++ gcc/c-parser.c (revision 144237) +@@ -3036,6 +3036,7 @@ c_parser_braced_init (c_parser *parser, + ret.value = error_mark_node; + ret.original_code = ERROR_MARK; + c_parser_skip_until_found (parser, CPP_CLOSE_BRACE, "expected %<}%>"); ++ pop_init_level (0); + return ret; + } + c_parser_consume_token (parser); +--- gcc/config/soft-fp/double.h (revision 144236) ++++ gcc/config/soft-fp/double.h (revision 144237) +@@ -1,6 +1,7 @@ + /* Software floating-point emulation. + Definitions for IEEE Double Precision +- Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc. ++ Copyright (C) 1997, 1998, 1999, 2006, 2007, 2008, 2009 ++ Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com), + Jakub Jelinek (jj@ultra.linux.cz), +@@ -203,13 +204,13 @@ union _FP_UNION_D + + #define FP_UNPACK_SEMIRAW_D(X,val) \ + do { \ +- _FP_UNPACK_RAW_2(1,X,val); \ ++ _FP_UNPACK_RAW_1(D,X,val); \ + _FP_UNPACK_SEMIRAW(D,1,X); \ + } while (0) + + #define FP_UNPACK_SEMIRAW_DP(X,val) \ + do { \ +- _FP_UNPACK_RAW_2_P(1,X,val); \ ++ _FP_UNPACK_RAW_1_P(D,X,val); \ + _FP_UNPACK_SEMIRAW(D,1,X); \ + } while (0) + diff --git a/gcc44-hack.patch b/gcc44-hack.patch new file mode 100644 index 0000000..da00568 --- /dev/null +++ b/gcc44-hack.patch @@ -0,0 +1,64 @@ +--- libada/Makefile.in.jj 2009-01-14 12:07:35.000000000 +0100 ++++ libada/Makefile.in 2009-01-15 14:25:33.000000000 +0100 +@@ -66,17 +66,39 @@ target_noncanonical:=@target_noncanonica + version := $(shell cat $(srcdir)/../gcc/BASE-VER) + libsubdir := $(libdir)/gcc/$(target_noncanonical)/$(version)$(MULTISUBDIR) + ++DEFAULTMULTIFLAGS := ++ifeq ($(MULTISUBDIR),) ++targ:=$(subst -, ,$(target)) ++arch:=$(word 1,$(targ)) ++ifeq ($(words $(targ)),2) ++osys:=$(word 2,$(targ)) ++else ++osys:=$(word 3,$(targ)) ++endif ++ifeq ($(strip $(filter-out i%86 x86_64 powerpc% ppc% s390% sparc% linux%, $(arch) $(osys))),) ++ifeq ($(shell $(CC) $(CFLAGS) -print-multi-os-directory),../lib64) ++DEFAULTMULTIFLAGS := -m64 ++else ++ifeq ($(strip $(filter-out s390%, $(arch))),) ++DEFAULTMULTIFLAGS := -m31 ++else ++DEFAULTMULTIFLAGS := -m32 ++endif ++endif ++endif ++endif ++ + # exeext should not be used because it's the *host* exeext. We're building + # a *target* library, aren't we?!? Likewise for CC. Still, provide bogus + # definitions just in case something slips through the safety net provided + # by recursive make invocations in gcc/ada/Makefile.in + LIBADA_FLAGS_TO_PASS = \ + "MAKEOVERRIDES=" \ +- "LDFLAGS=$(LDFLAGS)" \ ++ "LDFLAGS=$(strip $(LDFLAGS) $(DEFAULTMULTIFLAGS))" \ + "LN_S=$(LN_S)" \ + "SHELL=$(SHELL)" \ +- "GNATLIBFLAGS=$(GNATLIBFLAGS) $(MULTIFLAGS)" \ +- "GNATLIBCFLAGS=$(GNATLIBCFLAGS) $(MULTIFLAGS)" \ ++ "GNATLIBFLAGS=$(strip $(GNATLIBFLAGS) $(MULTIFLAGS) $(DEFAULTMULTIFLAGS))" \ ++ "GNATLIBCFLAGS=$(strip $(GNATLIBCFLAGS) $(MULTIFLAGS) $(DEFAULTMULTIFLAGS))" \ + "TARGET_LIBGCC2_CFLAGS=$(TARGET_LIBGCC2_CFLAGS)" \ + "THREAD_KIND=$(THREAD_KIND)" \ + "TRACE=$(TRACE)" \ +@@ -87,7 +109,7 @@ LIBADA_FLAGS_TO_PASS = \ + "exeext=.exeext.should.not.be.used " \ + 'CC=the.host.compiler.should.not.be.needed' \ + "GCC_FOR_TARGET=$(CC)" \ +- "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" ++ "CFLAGS=$(strip $(CFLAGS) $(DEFAULTMULTIFLAGS) $(WARN_CFLAGS))" + + # Rules to build gnatlib. + .PHONY: gnatlib gnatlib-plain gnatlib-sjlj gnatlib-zcx gnatlib-shared oscons +--- gcc/ada/make.adb 2008-11-07 23:00:32.000000000 +0100 ++++ gcc/ada/make.adb 2009-01-16 17:55:02.000000000 +0100 +@@ -8039,6 +8039,7 @@ package body Make is + or else Argv (2 .. Argv'Last) = "pg" + or else (Argv (2) = 'm' and then Argv'Last > 2) + or else (Argv (2) = 'f' and then Argv'Last > 2) ++ or else (Argv'Last >= 8 and then Argv (2 .. 8) = "-param=") + then + Add_Switch (Argv, Compiler, And_Save => And_Save); + Add_Switch (Argv, Linker, And_Save => And_Save); diff --git a/gcc44-i386-libgomp.patch b/gcc44-i386-libgomp.patch new file mode 100644 index 0000000..5d1eea8 --- /dev/null +++ b/gcc44-i386-libgomp.patch @@ -0,0 +1,61 @@ +Build i386.rpm libgomp and libsupc++.a(guard.o) as i486+, pre-i486 +hardware isn't supported because NPTL doesn't support it anyway. + +--- libgomp/configure.tgt.jj 2008-01-10 20:53:48.000000000 +0100 ++++ libgomp/configure.tgt 2008-03-27 12:44:51.000000000 +0100 +@@ -44,14 +44,14 @@ if test $enable_linux_futex = yes; then + ;; + + # Note that bare i386 is not included here. We need cmpxchg. +- i[456]86-*-linux*) ++ i[3456]86-*-linux*) + config_path="linux/x86 linux posix" + case " ${CC} ${CFLAGS} " in + *" -m64 "*) + ;; + *) + if test -z "$with_arch"; then +- XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" ++ XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic" + fi + esac + ;; +@@ -63,7 +63,7 @@ if test $enable_linux_futex = yes; then + config_path="linux/x86 linux posix" + case " ${CC} ${CFLAGS} " in + *" -m32 "*) +- XCFLAGS="${XCFLAGS} -march=i486 -mtune=i686" ++ XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic" + ;; + esac + ;; +--- libstdc++-v3/libsupc++/guard.cc.jj 2008-03-01 00:58:24.000000000 +0100 ++++ libstdc++-v3/libsupc++/guard.cc 2008-03-27 14:08:44.000000000 +0100 +@@ -35,6 +35,27 @@ + #include + #include + #include ++#if defined __i386__ && !defined _GLIBCXX_ATOMIC_BUILTINS_4 ++# define _GLIBCXX_ATOMIC_BUILTINS_4 1 ++# define __sync_val_compare_and_swap(a, b, c) \ ++ ({ \ ++ typedef char sltast[sizeof (*a) == sizeof (int) ? 1 : -1]; \ ++ int sltas; \ ++ __asm __volatile ("lock; cmpxchgl %3, (%1)" \ ++ : "=a" (sltas) \ ++ : "r" (a), "0" (b), "r" (c) : "memory"); \ ++ sltas; \ ++ }) ++# define __sync_lock_test_and_set(a, b) \ ++ ({ \ ++ typedef char sltast[sizeof (*a) == sizeof (int) ? 1 : -1]; \ ++ int sltas; \ ++ __asm __volatile ("xchgl (%1), %0" \ ++ : "=r" (sltas) \ ++ : "r" (a), "0" (b) : "memory"); \ ++ sltas; \ ++ }) ++#endif + #if defined(__GTHREADS) && defined(__GTHREAD_HAS_COND) \ + && defined(_GLIBCXX_ATOMIC_BUILTINS_4) && defined(_GLIBCXX_HAVE_LINUX_FUTEX) + # include diff --git a/gcc44-ia64-libunwind.patch b/gcc44-ia64-libunwind.patch new file mode 100644 index 0000000..8e10979 --- /dev/null +++ b/gcc44-ia64-libunwind.patch @@ -0,0 +1,538 @@ +2004-11-27 Jakub Jelinek + + * config.gcc (ia64*-*-linux*): If native and libelf is installed, + use ia64/t-glibc-no-libunwind instead of the other t-*unwind* + fragments. + * config/ia64/t-glibc-no-libunwind: New file. + * config/ia64/change-symver.c: New file. + * config/ia64/unwind-ia64.c: If USE_SYMVER_GLOBAL and SHARED, + define _Unwind_* to __symverglobal_Unwind_*. + (alias): Undefine. + (symverglobal): Define. Use it on _Unwind_*. + * config/ia64/mkmap-symver-multi.awk: New file. + * config/ia64/libgcc-ia64-no-libunwind.ver: New file. + +--- gcc/config.gcc.jj 2004-10-04 08:55:44.000000000 -0400 ++++ gcc/config.gcc 2004-11-13 05:23:50.000000000 -0500 +@@ -1185,9 +1185,16 @@ ia64*-*-freebsd*) + ;; + ia64*-*-linux*) + tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h ia64/sysv4.h ia64/linux.h" +- tmake_file="${tmake_file} ia64/t-ia64 t-libunwind ia64/t-glibc" +- if test x$with_system_libunwind != xyes ; then +- tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind" ++ tmake_file="${tmake_file} ia64/t-ia64" ++ if test x${target} = x${host} && test x${target} = x${build} \ ++ && grep gelf_getverdef /usr/include/gelf.h > /dev/null 2>&1 \ ++ && test -f /usr/lib/libelf.so; then ++ tmake_file="${tmake_file} ia64/t-glibc-no-libunwind" ++ else ++ tmake_file="${tmake_file} t-libunwind ia64/t-glibc" ++ if test x$with_system_libunwind != xyes ; then ++ tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind" ++ fi + fi + target_cpu_default="MASK_GNU_AS|MASK_GNU_LD" + extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o" +--- gcc/config/ia64/t-glibc-no-libunwind.jj 2004-02-18 10:27:36.000000000 -0500 ++++ gcc/config/ia64/t-glibc-no-libunwind 2004-11-15 09:56:33.000000000 -0500 +@@ -0,0 +1,30 @@ ++# Don't use system libunwind library on IA-64 GLIBC based system, ++# but make _Unwind_* symbols unversioned, so that created programs ++# are usable even when libgcc_s uses libunwind. ++LIB2ADDEH += $(srcdir)/config/ia64/fde-glibc.c ++SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-ia64-no-libunwind.ver ++SHLIB_MKMAP = $(srcdir)/config/ia64/mkmap-symver-multi.awk ++ ++SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ ++ -Wl,--soname=$(SHLIB_SONAME) \ ++ -Wl,--version-script=$(SHLIB_MAP) \ ++ -o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ $(SHLIB_OBJS) -lc && \ ++ rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \ ++ if [ -f $(SHLIB_DIR)/$(SHLIB_SONAME) ]; then \ ++ mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) \ ++ $(SHLIB_DIR)/$(SHLIB_SONAME).backup; \ ++ else true; fi && \ ++ gcc -O2 -o $(SHLIB_DIR)/$(SHLIB_SONAME).tweak \ ++ $$(gcc_srcdir)/config/ia64/change-symver.c -lelf && \ ++ $(SHLIB_DIR)/$(SHLIB_SONAME).tweak $(SHLIB_DIR)/$(SHLIB_SONAME).tmp \ ++ GCC_3.4.2 _GLOBAL_ \ ++ _Unwind_GetGR _Unwind_RaiseException _Unwind_GetRegionStart _Unwind_SetIP \ ++ _Unwind_GetIP _Unwind_GetLanguageSpecificData _Unwind_Resume \ ++ _Unwind_DeleteException _Unwind_SetGR _Unwind_ForcedUnwind \ ++ _Unwind_Backtrace _Unwind_FindEnclosingFunction _Unwind_GetCFA \ ++ _Unwind_Resume_or_Rethrow _Unwind_GetBSP && \ ++ rm -f $(SHLIB_DIR)/$(SHLIB_SONAME).tweak && \ ++ mv $(SHLIB_DIR)/$(SHLIB_SONAME).tmp $(SHLIB_DIR)/$(SHLIB_SONAME) && \ ++ $(LN_S) $(SHLIB_SONAME) $(SHLIB_DIR)/$(SHLIB_SOLINK) ++ ++TARGET_LIBGCC2_CFLAGS += -DUSE_SYMVER_GLOBAL +--- gcc/config/ia64/change-symver.c.jj 2004-02-18 10:27:36.000000000 -0500 ++++ gcc/config/ia64/change-symver.c 2004-11-13 05:23:50.000000000 -0500 +@@ -0,0 +1,211 @@ ++#define _GNU_SOURCE 1 ++#define _FILE_OFFSET_BITS 64 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++int ++compute_veridx (const char *name, Elf *elf, Elf_Data *verd, GElf_Shdr *verd_shdr) ++{ ++ if (strcmp (name, "_GLOBAL_") == 0) ++ return 1; ++ ++ int cnt; ++ size_t offset = 0; ++ for (cnt = verd_shdr->sh_info; --cnt >= 0; ) ++ { ++ GElf_Verdef defmem; ++ GElf_Verdef *def; ++ GElf_Verdaux auxmem; ++ GElf_Verdaux *aux; ++ unsigned int auxoffset; ++ ++ /* Get the data at the next offset. */ ++ def = gelf_getverdef (verd, offset, &defmem); ++ if (def == NULL) ++ break; ++ ++ auxoffset = offset + def->vd_aux; ++ aux = gelf_getverdaux (verd, auxoffset, &auxmem); ++ if (aux == NULL) ++ break; ++ ++ if (strcmp (name, elf_strptr (elf, verd_shdr->sh_link, ++ aux->vda_name)) == 0) ++ return def->vd_ndx; ++ ++ /* Find the next offset. */ ++ offset += def->vd_next; ++ } ++ ++ return -1; ++} ++ ++int ++main (int argc, char **argv) ++{ ++ if (argc < 4) ++ error (1, 0, "Usage: change_symver library from_symver to_symver symbol...\nExample: change_symver libfoo.so FOO_1.0 *global* bar baz"); ++ ++ const char *fname = argv[1]; ++ ++ /* Open the file. */ ++ int fd; ++ fd = open (fname, O_RDWR); ++ if (fd == -1) ++ error (1, errno, fname); ++ ++ elf_version (EV_CURRENT); ++ ++ /* Now get the ELF descriptor. */ ++ Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL); ++ if (elf == NULL || elf_kind (elf) != ELF_K_ELF) ++ error (1, 0, "Couldn't open %s: %s", fname, elf_errmsg (-1)); ++ ++ size_t shstrndx; ++ /* Get the section header string table index. */ ++ if (elf_getshstrndx (elf, &shstrndx) < 0) ++ error (1, 0, "cannot get shstrndx from %s", fname); ++ ++ GElf_Ehdr ehdr_mem; ++ GElf_Ehdr *ehdr; ++ ++ /* We need the ELF header in a few places. */ ++ ehdr = gelf_getehdr (elf, &ehdr_mem); ++ if (ehdr == NULL) ++ error (1, 0, "couldn't get ELF headers %s: %s", fname, elf_errmsg (-1)); ++ ++ Elf_Scn *scn = NULL; ++ GElf_Shdr shdr_mem, verd_shdr, ver_shdr, dynsym_shdr; ++ Elf_Data *ver = NULL, *verd = NULL, *dynsym = NULL; ++ ++ while ((scn = elf_nextscn (elf, scn)) != NULL) ++ { ++ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); ++ ++ if (shdr == NULL) ++ error (1, 0, "couldn't get shdr from %s", fname); ++ ++ if ((shdr->sh_flags & SHF_ALLOC) != 0) ++ { ++ const char *name = elf_strptr (elf, shstrndx, shdr->sh_name); ++ Elf_Data **p; ++ ++ if (strcmp (name, ".gnu.version") == 0) ++ { ++ p = &ver; ++ ver_shdr = *shdr; ++ } ++ else if (strcmp (name, ".gnu.version_d") == 0) ++ { ++ p = &verd; ++ verd_shdr = *shdr; ++ } ++ else if (strcmp (name, ".dynsym") == 0) ++ { ++ p = &dynsym; ++ dynsym_shdr = *shdr; ++ } ++ else ++ continue; ++ ++ if (*p != NULL) ++ error (1, 0, "Two %s sections in %s", name, fname); ++ *p = elf_getdata (scn, NULL); ++ if (*p == NULL || elf_getdata (scn, *p) != NULL) ++ error (1, 0, "No data or non-contiguous data in %s section in %s", ++ name, fname); ++ } ++ } ++ ++ if (ver == NULL || verd == NULL || dynsym == NULL) ++ error (1, 0, "Couldn't find one of the needed sections in %s", fname); ++ ++ int from_idx = compute_veridx (argv[2], elf, verd, &verd_shdr); ++ if (from_idx == -1) ++ error (1, 0, "Could not find symbol version %s in %s", argv[2], fname); ++ ++ int to_idx = compute_veridx (argv[3], elf, verd, &verd_shdr); ++ if (to_idx == -1) ++ error (1, 0, "Could not find symbol version %s in %s", argv[3], fname); ++ ++ if (dynsym_shdr.sh_entsize != gelf_fsize (elf, ELF_T_SYM, 1, ehdr->e_version) ++ || dynsym_shdr.sh_size % dynsym_shdr.sh_entsize ++ || ver_shdr.sh_entsize != 2 ++ || (ver_shdr.sh_size & 1) ++ || dynsym_shdr.sh_size / dynsym_shdr.sh_entsize != ver_shdr.sh_size / 2) ++ error (1, 0, "Unexpected sh_size or sh_entsize in %s", fname); ++ ++ size_t nentries = ver_shdr.sh_size / 2; ++ size_t cnt; ++ GElf_Versym array[nentries]; ++ for (cnt = 0; cnt < nentries; ++cnt) ++ { ++ GElf_Versym vsymmem; ++ GElf_Versym *vsym; ++ ++ vsym = gelf_getversym (ver, cnt, &vsymmem); ++ if (vsym == NULL) ++ error (1, 0, "gelt_getversym failed in %s: %s", fname, elf_errmsg (-1)); ++ ++ array[cnt] = *vsym; ++ if (*vsym != from_idx) ++ continue; ++ ++ GElf_Sym sym_mem; ++ GElf_Sym *sym; ++ sym = gelf_getsym (dynsym, cnt, &sym_mem); ++ if (sym == NULL) ++ error (1, 0, "gelt_getsym failed in %s: %s", fname, elf_errmsg (-1)); ++ ++ const char *name = elf_strptr (elf, dynsym_shdr.sh_link, sym->st_name); ++ ++ int argn; ++ for (argn = 4; argn < argc; ++argn) ++ if (fnmatch (argv[argn], name, 0) == 0) ++ { ++ array[cnt] = to_idx; ++ break; ++ } ++ } ++ ++ if (sizeof (array[0]) != 2) ++ abort (); ++ ++#if __BYTE_ORDER == __LITTLE_ENDIAN ++ if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) ++ ; ++ else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) ++#elif __BYTE_ORDER == __BIG_ENDIAN ++ if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) ++ ; ++ else if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) ++#else ++# error Unsupported endianity ++#endif ++ { ++ for (cnt = 0; cnt < nentries; ++cnt) ++ array[cnt] = ((array[cnt] & 0xff) << 8) | ((array[cnt] & 0xff00) >> 8); ++ } ++ else ++ error (1, 0, "Unknown EI_DATA %d in %s", ehdr->e_ident[EI_DATA], fname); ++ ++ if (elf_end (elf) != 0) ++ error (1, 0, "couldn't close %s: %s", fname, elf_errmsg (-1)); ++ ++ if (lseek (fd, ver_shdr.sh_offset, SEEK_SET) != (off_t) ver_shdr.sh_offset) ++ error (1, 0, "failed to seek to %zd in %s", (size_t) ver_shdr.sh_offset, ++ fname); ++ ++ if (write (fd, array, 2 * nentries) != (ssize_t) (2 * nentries)) ++ error (1, 0, "failed to write .gnu.version section into %s", fname); ++ ++ close (fd); ++ return 0; ++} +--- gcc/config/ia64/unwind-ia64.c.jj 2004-10-04 08:55:57.000000000 -0400 ++++ gcc/config/ia64/unwind-ia64.c 2004-11-15 09:07:45.000000000 -0500 +@@ -51,6 +51,51 @@ + #define UNW_FLAG_UHANDLER(x) ((x) & 0x0000000200000000L) + #define UNW_LENGTH(x) ((x) & 0x00000000ffffffffL) + ++#if defined (USE_SYMVER_GLOBAL) && defined (SHARED) ++extern _Unwind_Reason_Code __symverglobal_Unwind_Backtrace ++ (_Unwind_Trace_Fn, void *); ++extern void __symverglobal_Unwind_DeleteException ++ (struct _Unwind_Exception *); ++extern void * __symverglobal_Unwind_FindEnclosingFunction (void *); ++extern _Unwind_Reason_Code __symverglobal_Unwind_ForcedUnwind ++ (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *); ++extern _Unwind_Word __symverglobal_Unwind_GetCFA ++ (struct _Unwind_Context *); ++extern _Unwind_Word __symverglobal_Unwind_GetBSP ++ (struct _Unwind_Context *); ++extern _Unwind_Word __symverglobal_Unwind_GetGR ++ (struct _Unwind_Context *, int ); ++extern _Unwind_Ptr __symverglobal_Unwind_GetIP (struct _Unwind_Context *); ++extern void *__symverglobal_Unwind_GetLanguageSpecificData ++ (struct _Unwind_Context *); ++extern _Unwind_Ptr __symverglobal_Unwind_GetRegionStart ++ (struct _Unwind_Context *); ++extern _Unwind_Reason_Code __symverglobal_Unwind_RaiseException ++ (struct _Unwind_Exception *); ++extern void __symverglobal_Unwind_Resume (struct _Unwind_Exception *); ++extern _Unwind_Reason_Code __symverglobal_Unwind_Resume_or_Rethrow ++ (struct _Unwind_Exception *); ++extern void __symverglobal_Unwind_SetGR ++ (struct _Unwind_Context *, int, _Unwind_Word); ++extern void __symverglobal_Unwind_SetIP ++ (struct _Unwind_Context *, _Unwind_Ptr); ++#define _Unwind_Backtrace __symverglobal_Unwind_Backtrace ++#define _Unwind_DeleteException __symverglobal_Unwind_DeleteException ++#define _Unwind_FindEnclosingFunction __symverglobal_Unwind_FindEnclosingFunction ++#define _Unwind_ForcedUnwind __symverglobal_Unwind_ForcedUnwind ++#define _Unwind_GetBSP __symverglobal_Unwind_GetBSP ++#define _Unwind_GetCFA __symverglobal_Unwind_GetCFA ++#define _Unwind_GetGR __symverglobal_Unwind_GetGR ++#define _Unwind_GetIP __symverglobal_Unwind_GetIP ++#define _Unwind_GetLanguageSpecificData __symverglobal_Unwind_GetLanguageSpecificData ++#define _Unwind_GetRegionStart __symverglobal_Unwind_GetRegionStart ++#define _Unwind_RaiseException __symverglobal_Unwind_RaiseException ++#define _Unwind_Resume __symverglobal_Unwind_Resume ++#define _Unwind_Resume_or_Rethrow __symverglobal_Unwind_Resume_or_Rethrow ++#define _Unwind_SetGR __symverglobal_Unwind_SetGR ++#define _Unwind_SetIP __symverglobal_Unwind_SetIP ++#endif ++ + enum unw_application_register + { + UNW_AR_BSP, +@@ -2402,4 +2447,44 @@ alias (_Unwind_SetGR); + alias (_Unwind_SetIP); + #endif + ++#if defined (USE_SYMVER_GLOBAL) && defined (SHARED) ++#undef alias ++#define symverglobal(name, version) \ ++__typeof (__symverglobal##name) __symverlocal##name \ ++ __attribute__ ((alias ("__symverglobal" #name))); \ ++__asm__ (".symver __symverglobal" #name"," #name "@@GCC_3.4.2");\ ++__asm__ (".symver __symverlocal" #name"," #name "@" #version) ++ ++#undef _Unwind_Backtrace ++#undef _Unwind_DeleteException ++#undef _Unwind_FindEnclosingFunction ++#undef _Unwind_ForcedUnwind ++#undef _Unwind_GetBSP ++#undef _Unwind_GetCFA ++#undef _Unwind_GetGR ++#undef _Unwind_GetIP ++#undef _Unwind_GetLanguageSpecificData ++#undef _Unwind_GetRegionStart ++#undef _Unwind_RaiseException ++#undef _Unwind_Resume ++#undef _Unwind_Resume_or_Rethrow ++#undef _Unwind_SetGR ++#undef _Unwind_SetIP ++symverglobal (_Unwind_Backtrace, GCC_3.3); ++symverglobal (_Unwind_DeleteException, GCC_3.0); ++symverglobal (_Unwind_FindEnclosingFunction, GCC_3.3); ++symverglobal (_Unwind_ForcedUnwind, GCC_3.0); ++symverglobal (_Unwind_GetBSP, GCC_3.3.2); ++symverglobal (_Unwind_GetCFA, GCC_3.3); ++symverglobal (_Unwind_GetGR, GCC_3.0); ++symverglobal (_Unwind_GetIP, GCC_3.0); ++symverglobal (_Unwind_GetLanguageSpecificData, GCC_3.0); ++symverglobal (_Unwind_GetRegionStart, GCC_3.0); ++symverglobal (_Unwind_RaiseException, GCC_3.0); ++symverglobal (_Unwind_Resume, GCC_3.0); ++symverglobal (_Unwind_Resume_or_Rethrow, GCC_3.3); ++symverglobal (_Unwind_SetGR, GCC_3.0); ++symverglobal (_Unwind_SetIP, GCC_3.0); ++#endif ++ + #endif +--- gcc/config/ia64/mkmap-symver-multi.awk.jj 2004-02-18 10:27:36.000000000 -0500 ++++ gcc/config/ia64/mkmap-symver-multi.awk 2004-11-15 09:46:50.000000000 -0500 +@@ -0,0 +1,133 @@ ++# Generate an ELF symbol version map a-la Solaris and GNU ld. ++# Contributed by Richard Henderson ++# ++# 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, 51 Franklin Street, Fifth Floor, Boston, MA ++# 02110-1301, USA. ++ ++BEGIN { ++ state = "nm"; ++ sawsymbol = 0; ++} ++ ++# Remove comment and blank lines. ++/^ *#/ || /^ *$/ { ++ next; ++} ++ ++# We begin with nm input. Collect the set of symbols that are present ++# so that we can not emit them into the final version script -- Solaris ++# complains at us if we do. ++ ++state == "nm" && /^%%/ { ++ state = "ver"; ++ next; ++} ++ ++state == "nm" && ($1 == "U" || $2 == "U") { ++ next; ++} ++ ++state == "nm" && NF == 3 { ++ if ($3 ~ /^[^@]*@GCC_[0-9.]*$/) { ++ def[$3] = 1 ++ tl=$3 ++ sub(/^.*@/,"",tl) ++ ver[$3] = tl ++ } else { ++ sub(/@@?GCC_[0-9.]*$/,"",$3) ++ def[$3] = 1; ++ } ++ sawsymbol = 1; ++ next; ++} ++ ++state == "nm" { ++ next; ++} ++ ++# Now we process a simplified variant of the Solaris symbol version ++# script. We have one symbol per line, no semicolons, simple markers ++# for beginning and ending each section, and %inherit markers for ++# describing version inheritence. A symbol may appear in more than ++# one symbol version, and the last seen takes effect. ++ ++NF == 3 && $1 == "%inherit" { ++ inherit[$2] = $3; ++ next; ++} ++ ++NF == 2 && $2 == "{" { ++ libs[$1] = 1; ++ thislib = $1; ++ next; ++} ++ ++$1 == "}" { ++ thislib = ""; ++ next; ++} ++ ++{ ++ ver[$1] = thislib; ++ next; ++} ++ ++END { ++ if (!sawsymbol) ++ { ++ print "No symbols seen -- broken or mis-installed nm?" | "cat 1>&2"; ++ exit 1; ++ } ++ for (l in libs) ++ output(l); ++} ++ ++function output(lib) { ++ if (done[lib]) ++ return; ++ done[lib] = 1; ++ if (inherit[lib]) ++ output(inherit[lib]); ++ ++ empty=1 ++ for (sym in ver) ++ if ((ver[sym] == lib) && (sym in def)) ++ { ++ if (empty) ++ { ++ printf("%s {\n", lib); ++ printf(" global:\n"); ++ empty = 0; ++ } ++ symp = sym; ++ sub(/@GCC_[0-9.]*$/,"",symp); ++ printf("\t%s;\n", symp); ++ if (dotsyms) ++ printf("\t.%s;\n", symp); ++ } ++ ++ if (empty) ++ { ++ for (l in libs) ++ if (inherit[l] == lib) ++ inherit[l] = inherit[lib]; ++ } ++ else if (inherit[lib]) ++ printf("} %s;\n", inherit[lib]); ++ else ++ printf ("\n local:\n\t*;\n};\n"); ++} +--- gcc/config/ia64/libgcc-ia64-no-libunwind.ver.jj 2004-02-18 10:27:36.000000000 -0500 ++++ gcc/config/ia64/libgcc-ia64-no-libunwind.ver 2004-11-15 09:19:56.000000000 -0500 +@@ -0,0 +1,17 @@ ++GCC_3.4.2 { ++ _Unwind_GetGR ++ _Unwind_RaiseException ++ _Unwind_GetRegionStart ++ _Unwind_SetIP ++ _Unwind_GetIP ++ _Unwind_GetLanguageSpecificData ++ _Unwind_Resume ++ _Unwind_DeleteException ++ _Unwind_SetGR ++ _Unwind_ForcedUnwind ++ _Unwind_Backtrace ++ _Unwind_FindEnclosingFunction ++ _Unwind_GetCFA ++ _Unwind_Resume_or_Rethrow ++ _Unwind_GetBSP ++} diff --git a/gcc44-java-debug-iface-type.patch b/gcc44-java-debug-iface-type.patch new file mode 100644 index 0000000..63a1b50 --- /dev/null +++ b/gcc44-java-debug-iface-type.patch @@ -0,0 +1,17 @@ +2008-01-25 Jakub Jelinek + + * lang.c (java_classify_record): Revert 2007-12-20 change. + +--- gcc/java/lang.c 2007-12-27 09:09:49.000000000 +0100 ++++ gcc/java/lang.c 2008-01-25 17:43:57.000000000 +0100 +@@ -965,9 +965,7 @@ java_classify_record (tree type) + if (! CLASS_P (type)) + return RECORD_IS_STRUCT; + +- /* ??? GDB does not support DW_TAG_interface_type as of December, +- 2007. Re-enable this at a later time. */ +- if (0 && CLASS_INTERFACE (TYPE_NAME (type))) ++ if (CLASS_INTERFACE (TYPE_NAME (type))) + return RECORD_IS_INTERFACE; + + return RECORD_IS_CLASS; diff --git a/gcc44-java-nomulti.patch b/gcc44-java-nomulti.patch new file mode 100644 index 0000000..17334aa --- /dev/null +++ b/gcc44-java-nomulti.patch @@ -0,0 +1,44 @@ +--- libjava/configure.ac.jj 2007-12-07 17:55:50.000000000 +0100 ++++ libjava/configure.ac 2007-12-07 18:36:56.000000000 +0100 +@@ -82,6 +82,13 @@ AC_ARG_ENABLE(java-maintainer-mode, + [allow rebuilding of .class and .h files])) + AM_CONDITIONAL(JAVA_MAINTAINER_MODE, test "$enable_java_maintainer_mode" = yes) + ++AC_ARG_ENABLE(libjava-multilib, ++ AS_HELP_STRING([--enable-libjava-multilib], [build libjava as multilib])) ++if test "$enable_libjava_multilib" = no; then ++ multilib=no ++ ac_configure_args="$ac_configure_args --disable-multilib" ++fi ++ + # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX. + GCC_NO_EXECUTABLES + +--- libjava/configure.jj 2007-12-07 17:55:50.000000000 +0100 ++++ libjava/configure 2007-12-07 18:39:58.000000000 +0100 +@@ -1021,6 +1021,8 @@ Optional Features: + default=yes + --enable-java-maintainer-mode + allow rebuilding of .class and .h files ++ --enable-libjava-multilib ++ build libjava as multilib + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-maintainer-mode enable make rules and dependencies not useful +@@ -1973,6 +1975,16 @@ else + fi + + ++# Check whether --enable-libjava-multilib was given. ++if test "${enable_libjava_multilib+set}" = set; then ++ enableval=$enable_libjava_multilib; ++fi ++ ++if test "$enable_libjava_multilib" = no; then ++ multilib=no ++ ac_configure_args="$ac_configure_args --disable-multilib" ++fi ++ + # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX. + + diff --git a/gcc44-libgomp-omp_h-multilib.patch b/gcc44-libgomp-omp_h-multilib.patch new file mode 100644 index 0000000..d0e98d1 --- /dev/null +++ b/gcc44-libgomp-omp_h-multilib.patch @@ -0,0 +1,17 @@ +2008-06-09 Jakub Jelinek + + * omp.h.in (omp_nest_lock_t): Fix up for Linux multilibs. + +--- libgomp/omp.h.in.jj 2008-06-09 13:34:05.000000000 +0200 ++++ libgomp/omp.h.in 2008-06-09 13:34:48.000000000 +0200 +@@ -42,8 +42,8 @@ typedef struct + + typedef struct + { +- unsigned char _x[@OMP_NEST_LOCK_SIZE@] +- __attribute__((__aligned__(@OMP_NEST_LOCK_ALIGN@))); ++ unsigned char _x[8 + sizeof (void *)] ++ __attribute__((__aligned__(sizeof (void *)))); + } omp_nest_lock_t; + #endif + diff --git a/gcc44-libtool-no-rpath.patch b/gcc44-libtool-no-rpath.patch new file mode 100644 index 0000000..466c661 --- /dev/null +++ b/gcc44-libtool-no-rpath.patch @@ -0,0 +1,27 @@ +libtool sucks. +--- ltmain.sh.jj 2007-12-07 14:53:21.000000000 +0100 ++++ ltmain.sh 2008-09-05 21:51:48.000000000 +0200 +@@ -5394,6 +5394,7 @@ EOF + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do ++ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then +@@ -6071,6 +6072,7 @@ EOF + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do ++ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then +@@ -6120,6 +6122,7 @@ EOF + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do ++ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then diff --git a/gcc44-ppc32-retaddr.patch b/gcc44-ppc32-retaddr.patch new file mode 100644 index 0000000..e9ae1bc --- /dev/null +++ b/gcc44-ppc32-retaddr.patch @@ -0,0 +1,86 @@ +2005-11-28 Jakub Jelinek + + * config/rs6000/rs6000.c (rs6000_return_addr): If COUNT == 0, + read word RETURN_ADDRESS_OFFSET bytes above arg_pointer_rtx + instead of doing an extran indirection from frame_pointer_rtx. + + * gcc.dg/20051128-1.c: New test. + +--- gcc/config/rs6000/rs6000.c.jj 2005-11-26 14:38:01.000000000 +0100 ++++ gcc/config/rs6000/rs6000.c 2005-11-28 20:32:18.000000000 +0100 +@@ -13166,17 +13166,22 @@ rs6000_return_addr (int count, rtx frame + don't try to be too clever here. */ + if (count != 0 || (DEFAULT_ABI != ABI_AIX && flag_pic)) + { ++ rtx x; + cfun->machine->ra_needs_full_frame = 1; + +- return +- gen_rtx_MEM +- (Pmode, +- memory_address +- (Pmode, +- plus_constant (copy_to_reg +- (gen_rtx_MEM (Pmode, +- memory_address (Pmode, frame))), +- RETURN_ADDRESS_OFFSET))); ++ if (count == 0) ++ { ++ gcc_assert (frame == frame_pointer_rtx); ++ x = arg_pointer_rtx; ++ } ++ else ++ { ++ x = memory_address (Pmode, frame); ++ x = copy_to_reg (gen_rtx_MEM (Pmode, x)); ++ } ++ ++ x = plus_constant (x, RETURN_ADDRESS_OFFSET); ++ return gen_rtx_MEM (Pmode, memory_address (Pmode, x)); + } + + cfun->machine->ra_need_lr = 1; +--- gcc/testsuite/gcc.dg/20051128-1.c.jj 2005-10-10 11:21:41.096999000 +0200 ++++ gcc/testsuite/gcc.dg/20051128-1.c 2005-11-28 12:30:57.000000000 +0100 +@@ -0,0 +1,41 @@ ++/* { dg-do run } */ ++/* { dg-options "-O2 -fpic" } */ ++ ++extern void exit (int); ++extern void abort (void); ++ ++int b; ++ ++struct A ++{ ++ void *pad[147]; ++ void *ra, *h; ++ long o; ++}; ++ ++void ++__attribute__((noinline)) ++foo (struct A *a, void *x) ++{ ++ __builtin_memset (a, 0, sizeof (a)); ++ if (!b) ++ exit (0); ++} ++ ++void ++__attribute__((noinline)) ++bar (void) ++{ ++ struct A a; ++ ++ __builtin_unwind_init (); ++ foo (&a, __builtin_return_address (0)); ++} ++ ++int ++main (void) ++{ ++ bar (); ++ abort (); ++ return 0; ++} diff --git a/gcc44-pr27898.patch b/gcc44-pr27898.patch new file mode 100644 index 0000000..172bb81 --- /dev/null +++ b/gcc44-pr27898.patch @@ -0,0 +1,16 @@ +2006-08-18 Jakub Jelinek + + PR c/27898 + * gcc.dg/pr27898.c: New test. + +--- gcc/testsuite/gcc.dg/pr27898.c.jj 2006-08-18 09:19:33.000000000 +0200 ++++ gcc/testsuite/gcc.dg/pr27898.c 2006-08-18 09:19:27.000000000 +0200 +@@ -0,0 +1,8 @@ ++/* PR c/27898 */ ++/* { dg-do compile } */ ++/* { dg-options "--combine" } */ ++/* { dg-additional-sources "pr27898.c" } */ ++ ++union u { struct { int i; }; }; ++ ++extern int foo (union u *); diff --git a/gcc44-pr32139.patch b/gcc44-pr32139.patch new file mode 100644 index 0000000..f356967 --- /dev/null +++ b/gcc44-pr32139.patch @@ -0,0 +1,19 @@ +2007-06-01 Jakub Jelinek + + PR tree-optimization/32139 + * gcc.c-torture/compile/20070531-1.c: New test. + +--- gcc/testsuite/gcc.c-torture/compile/20070531-1.c.jj 2007-05-31 13:47:22.000000000 +0200 ++++ gcc/testsuite/gcc.c-torture/compile/20070531-1.c 2007-06-01 10:57:15.000000000 +0200 +@@ -0,0 +1,11 @@ ++/* PR tree-optimization/32139 */ ++int foo (void); ++int bar (void) __attribute__ ((const)); ++ ++int ++test (int x) ++{ ++ int a = (x == 10000 ? foo : bar) (); ++ int b = (x == 10000 ? foo : bar) (); ++ return a + b; ++} diff --git a/gcc44-pr33763.patch b/gcc44-pr33763.patch new file mode 100644 index 0000000..86c8ac7 --- /dev/null +++ b/gcc44-pr33763.patch @@ -0,0 +1,153 @@ +2007-11-06 Jakub Jelinek + + PR tree-optimization/33763 + * gcc.dg/pr33763.c: New test. + * g++.dg/opt/inline13.C: New test. + +2007-11-06 Jan Hubicka + + PR tree-optimization/33763 + * tree-inline.c (expand_call_inline): Silently ignore always_inline + attribute for redefined extern inline functions. + +--- gcc/tree-inline.c.jj 2007-11-06 09:29:04.000000000 +0100 ++++ gcc/tree-inline.c 2007-11-06 16:19:12.000000000 +0100 +@@ -3157,6 +3157,12 @@ expand_call_inline (basic_block bb, gimp + goto egress; + + if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) ++ /* For extern inline functions that get redefined we always ++ silently ignored alway_inline flag. Better behaviour would ++ be to be able to keep both bodies and use extern inline body ++ for inlining, but we can't do that because frontends overwrite ++ the body. */ ++ && !cg_edge->callee->local.redefined_extern_inline + /* Avoid warnings during early inline pass. */ + && cgraph_global_info_ready) + { +--- gcc/testsuite/gcc.dg/pr33763.c.jj 2007-11-06 16:19:12.000000000 +0100 ++++ gcc/testsuite/gcc.dg/pr33763.c 2007-11-06 16:19:12.000000000 +0100 +@@ -0,0 +1,60 @@ ++/* PR tree-optimization/33763 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2" } */ ++ ++typedef struct ++{ ++ void *a; ++ void *b; ++} T; ++extern void *foo (const char *, const char *); ++extern void *bar (void *, const char *, T); ++extern int baz (const char *, int); ++ ++extern inline __attribute__ ((always_inline, gnu_inline)) int ++baz (const char *x, int y) ++{ ++ return 2; ++} ++ ++int ++baz (const char *x, int y) ++{ ++ return 1; ++} ++ ++int xa, xb; ++ ++static void * ++inl (const char *x, const char *y) ++{ ++ T t = { &xa, &xb }; ++ int *f = (int *) __builtin_malloc (sizeof (int)); ++ const char *z; ++ int o = 0; ++ void *r = 0; ++ ++ for (z = y; *z; z++) ++ { ++ if (*z == 'r') ++ o |= 1; ++ if (*z == 'w') ++ o |= 2; ++ } ++ if (o == 1) ++ *f = baz (x, 0); ++ if (o == 2) ++ *f = baz (x, 1); ++ if (o == 3) ++ *f = baz (x, 2); ++ ++ if (o && *f > 0) ++ r = bar (f, "w", t); ++ return r; ++} ++ ++void * ++foo (const char *x, const char *y) ++{ ++ return inl (x, y); ++} +--- gcc/testsuite/g++.dg/opt/inline13.C.jj 2007-11-06 16:20:20.000000000 +0100 ++++ gcc/testsuite/g++.dg/opt/inline13.C 2007-11-06 16:21:30.000000000 +0100 +@@ -0,0 +1,60 @@ ++// PR tree-optimization/33763 ++// { dg-do compile } ++// { dg-options "-O2" } ++ ++typedef struct ++{ ++ void *a; ++ void *b; ++} T; ++extern void *foo (const char *, const char *); ++extern void *bar (void *, const char *, T); ++extern int baz (const char *, int); ++ ++extern inline __attribute__ ((always_inline, gnu_inline)) int ++baz (const char *x, int y) ++{ ++ return 2; ++} ++ ++int ++baz (const char *x, int y) ++{ ++ return 1; ++} ++ ++int xa, xb; ++ ++static void * ++inl (const char *x, const char *y) ++{ ++ T t = { &xa, &xb }; ++ int *f = (int *) __builtin_malloc (sizeof (int)); ++ const char *z; ++ int o = 0; ++ void *r = 0; ++ ++ for (z = y; *z; z++) ++ { ++ if (*z == 'r') ++ o |= 1; ++ if (*z == 'w') ++ o |= 2; ++ } ++ if (o == 1) ++ *f = baz (x, 0); ++ if (o == 2) ++ *f = baz (x, 1); ++ if (o == 3) ++ *f = baz (x, 2); ++ ++ if (o && *f > 0) ++ r = bar (f, "w", t); ++ return r; ++} ++ ++void * ++foo (const char *x, const char *y) ++{ ++ return inl (x, y); ++} diff --git a/gcc44-pr39175.patch b/gcc44-pr39175.patch new file mode 100644 index 0000000..db3e2dc --- /dev/null +++ b/gcc44-pr39175.patch @@ -0,0 +1,133 @@ +2009-02-13 Jakub Jelinek + + PR target/39175 + * c-common.c (c_determine_visibility): If visibility changed and + DECL_RTL has been already set, call make_decl_rtl to update symbol + flags. + + * decl2.c (determine_visibility): If visibility changed and + DECL_RTL has been already set, call make_decl_rtl to update symbol + flags. + + * gcc.dg/visibility-20.c: New test. + * g++.dg/ext/visibility/visibility-11.C: New test. + +--- gcc/c-common.c.jj 2009-02-09 23:07:06.000000000 +0100 ++++ gcc/c-common.c 2009-02-13 12:05:41.000000000 +0100 +@@ -1,6 +1,7 @@ + /* Subroutines shared by all languages that are variants of C. + Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. ++ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ Free Software Foundation, Inc. + + This file is part of GCC. + +@@ -6249,8 +6250,18 @@ c_determine_visibility (tree decl) + visibility_specified depending on #pragma GCC visibility. */ + if (!DECL_VISIBILITY_SPECIFIED (decl)) + { +- DECL_VISIBILITY (decl) = default_visibility; +- DECL_VISIBILITY_SPECIFIED (decl) = visibility_options.inpragma; ++ if (visibility_options.inpragma ++ || DECL_VISIBILITY (decl) != default_visibility) ++ { ++ DECL_VISIBILITY (decl) = default_visibility; ++ DECL_VISIBILITY_SPECIFIED (decl) = visibility_options.inpragma; ++ /* If visibility changed and DECL already has DECL_RTL, ensure ++ symbol flags are updated. */ ++ if (((TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)) ++ || TREE_CODE (decl) == FUNCTION_DECL) ++ && DECL_RTL_SET_P (decl)) ++ make_decl_rtl (decl); ++ } + } + return false; + } +--- gcc/cp/decl2.c.jj 2009-01-26 15:24:39.000000000 +0100 ++++ gcc/cp/decl2.c 2009-02-13 12:10:53.000000000 +0100 +@@ -1,6 +1,6 @@ + /* Process declarations and variables for C++ compiler. + Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, +- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 ++ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009 + Free Software Foundation, Inc. + Hacked by Michael Tiemann (tiemann@cygnus.com) + +@@ -1921,6 +1921,8 @@ determine_visibility (tree decl) + { + tree class_type = NULL_TREE; + bool use_template; ++ bool orig_visibility_specified; ++ enum symbol_visibility orig_visibility; + + /* Remember that all decls get VISIBILITY_DEFAULT when built. */ + +@@ -1933,6 +1935,9 @@ determine_visibility (tree decl) + maybe_clone_body. */ + gcc_assert (!DECL_CLONED_FUNCTION_P (decl)); + ++ orig_visibility_specified = DECL_VISIBILITY_SPECIFIED (decl); ++ orig_visibility = DECL_VISIBILITY (decl); ++ + if (TREE_CODE (decl) == TYPE_DECL) + { + if (CLASS_TYPE_P (TREE_TYPE (decl))) +@@ -2061,6 +2066,15 @@ determine_visibility (tree decl) + || ! DECL_VISIBILITY_SPECIFIED (decl)) + constrain_visibility (decl, tvis); + } ++ ++ /* If visibility changed and DECL already has DECL_RTL, ensure ++ symbol flags are updated. */ ++ if ((DECL_VISIBILITY (decl) != orig_visibility ++ || DECL_VISIBILITY_SPECIFIED (decl) != orig_visibility_specified) ++ && ((TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)) ++ || TREE_CODE (decl) == FUNCTION_DECL) ++ && DECL_RTL_SET_P (decl)) ++ make_decl_rtl (decl); + } + + /* By default, static data members and function members receive +--- gcc/testsuite/gcc.dg/visibility-20.c.jj 2009-02-13 12:24:42.000000000 +0100 ++++ gcc/testsuite/gcc.dg/visibility-20.c 2009-02-13 12:27:00.000000000 +0100 +@@ -0,0 +1,18 @@ ++/* PR target/39175 */ ++/* { dg-do compile } */ ++/* { dg-require-visibility "" } */ ++/* { dg-options "-O2 -fvisibility=hidden -fpic" { target fpic } } */ ++ ++__attribute__((noinline)) int ++foo (int x) ++{ ++ return x; ++} ++ ++int foo (int x); ++ ++int ++bar (int x) ++{ ++ return foo (x); ++} +--- gcc/testsuite/g++.dg/ext/visibility/visibility-11.C.jj 2009-02-13 12:25:19.000000000 +0100 ++++ gcc/testsuite/g++.dg/ext/visibility/visibility-11.C 2009-02-13 12:27:09.000000000 +0100 +@@ -0,0 +1,18 @@ ++// PR target/39175 ++// { dg-do compile } ++// { dg-require-visibility "" } ++// { dg-options "-O2 -fvisibility=hidden -fpic" { target fpic } } ++ ++__attribute__((noinline)) int ++foo (int x) ++{ ++ return x; ++} ++ ++int foo (int x); ++ ++int ++bar (int x) ++{ ++ return foo (x); ++} diff --git a/gcc44-raw-string.patch b/gcc44-raw-string.patch new file mode 100644 index 0000000..b1edad1 --- /dev/null +++ b/gcc44-raw-string.patch @@ -0,0 +1,1492 @@ +2008-09-12 Jakub Jelinek + + * charset.c (cpp_init_iconv): Initialize utf8_cset_desc. + (_cpp_destroy_iconv): Destroy utf8_cset_desc, char16_cset_desc + and char32_cset_desc. + (converter_for_type): Handle CPP_UTF8STRING. + (cpp_interpret_string): Handle CPP_UTF8STRING and raw-strings. + * directives.c (get__Pragma_string): Handle CPP_UTF8STRING. + * include/cpplib.h (CPP_UTF8STRING): New token type. + * internal.h (struct cpp_reader): Add utf8_cset_desc field. + * lex.c (lex_raw_string): New function. + (lex_string): Handle u8 string literals, call lex_raw_string + for raw string literals. + (_cpp_lex_direct): Call lex_string even for u8" and {,u,U,L,u8}R" + sequences. + * macro.c (stringify_arg): Handle CPP_UTF8STRING. + + * c-common.c (c_parse_error): Handle CPP_UTF8STRING. + * c-lex.c (c_lex_with_flags, lex_string): Likewise. + * c-parser.c (c_parser_postfix_expression): Likewise. + + * parser.c (cp_lexer_print_token, cp_parser_is_string_literal, + cp_parser_string_literal, cp_parser_primary_expression): Likewise. + + * gcc.dg/raw-string-1.c: New test. + * gcc.dg/raw-string-2.c: New test. + * gcc.dg/raw-string-3.c: New test. + * gcc.dg/raw-string-4.c: New test. + * gcc.dg/raw-string-5.c: New test. + * gcc.dg/raw-string-6.c: New test. + * gcc.dg/raw-string-7.c: New test. + * gcc.dg/utf8-1.c: New test. + * gcc.dg/utf8-2.c: New test. + * gcc.dg/utf-badconcat2.c: New test. + * gcc.dg/utf-dflt2.c: New test. + * g++.dg/ext/raw-string-1.C: New test. + * g++.dg/ext/raw-string-2.C: New test. + * g++.dg/ext/raw-string-3.C: New test. + * g++.dg/ext/raw-string-4.C: New test. + * g++.dg/ext/raw-string-5.C: New test. + * g++.dg/ext/raw-string-6.C: New test. + * g++.dg/ext/raw-string-7.C: New test. + * g++.dg/ext/utf8-1.C: New test. + * g++.dg/ext/utf8-2.C: New test. + * g++.dg/ext/utf-badconcat2.C: New test. + * g++.dg/ext/utf-dflt2.C: New test. + +--- libcpp/charset.c.jj 2008-09-05 12:59:49.000000000 +0200 ++++ libcpp/charset.c 2008-09-11 22:11:02.000000000 +0200 +@@ -721,6 +721,8 @@ cpp_init_iconv (cpp_reader *pfile) + + pfile->narrow_cset_desc = init_iconv_desc (pfile, ncset, SOURCE_CHARSET); + pfile->narrow_cset_desc.width = CPP_OPTION (pfile, char_precision); ++ pfile->utf8_cset_desc = init_iconv_desc (pfile, "UTF-8", SOURCE_CHARSET); ++ pfile->utf8_cset_desc.width = CPP_OPTION (pfile, char_precision); + pfile->char16_cset_desc = init_iconv_desc (pfile, + be ? "UTF-16BE" : "UTF-16LE", + SOURCE_CHARSET); +@@ -741,6 +743,12 @@ _cpp_destroy_iconv (cpp_reader *pfile) + { + if (pfile->narrow_cset_desc.func == convert_using_iconv) + iconv_close (pfile->narrow_cset_desc.cd); ++ if (pfile->utf8_cset_desc.func == convert_using_iconv) ++ iconv_close (pfile->utf8_cset_desc.cd); ++ if (pfile->char16_cset_desc.func == convert_using_iconv) ++ iconv_close (pfile->char16_cset_desc.cd); ++ if (pfile->char32_cset_desc.func == convert_using_iconv) ++ iconv_close (pfile->char32_cset_desc.cd); + if (pfile->wide_cset_desc.func == convert_using_iconv) + iconv_close (pfile->wide_cset_desc.cd); + } +@@ -1330,6 +1338,8 @@ converter_for_type (cpp_reader *pfile, e + { + default: + return pfile->narrow_cset_desc; ++ case CPP_UTF8STRING: ++ return pfile->utf8_cset_desc; + case CPP_CHAR16: + case CPP_STRING16: + return pfile->char16_cset_desc; +@@ -1364,7 +1374,47 @@ cpp_interpret_string (cpp_reader *pfile, + for (i = 0; i < count; i++) + { + p = from[i].text; +- if (*p == 'L' || *p == 'u' || *p == 'U') p++; ++ if (*p == 'u') ++ { ++ if (*++p == '8') ++ p++; ++ } ++ else if (*p == 'L' || *p == 'U') p++; ++ if (*p == 'R') ++ { ++ const uchar *prefix; ++ ++ /* Skip over 'R"'. */ ++ p += 2; ++ prefix = p; ++ while (*p != '[') ++ p++; ++ p++; ++ limit = from[i].text + from[i].len; ++ if (limit >= p + (p - prefix) + 1) ++ limit -= (p - prefix) + 1; ++ ++ for (;;) ++ { ++ base = p; ++ while (p < limit && (*p != '\\' || (p[1] != 'u' && p[1] != 'U'))) ++ p++; ++ if (p > base) ++ { ++ /* We have a run of normal characters; these can be fed ++ directly to convert_cset. */ ++ if (!APPLY_CONVERSION (cvt, base, p - base, &tbuf)) ++ goto fail; ++ } ++ if (p == limit) ++ break; ++ ++ p = convert_ucn (pfile, p + 1, limit, &tbuf, cvt); ++ } ++ ++ continue; ++ } ++ + p++; /* Skip leading quote. */ + limit = from[i].text + from[i].len - 1; /* Skip trailing quote. */ + +--- libcpp/directives.c.jj 2008-09-05 12:59:49.000000000 +0200 ++++ libcpp/directives.c 2008-09-11 20:27:32.000000000 +0200 +@@ -1519,7 +1519,8 @@ get__Pragma_string (cpp_reader *pfile) + if (string->type == CPP_EOF) + _cpp_backup_tokens (pfile, 1); + if (string->type != CPP_STRING && string->type != CPP_WSTRING +- && string->type != CPP_STRING32 && string->type != CPP_STRING16) ++ && string->type != CPP_STRING32 && string->type != CPP_STRING16 ++ && string->type != CPP_UTF8STRING) + return NULL; + + paren = get_token_no_padding (pfile); +--- libcpp/include/cpplib.h.jj 2008-09-05 12:59:47.000000000 +0200 ++++ libcpp/include/cpplib.h 2008-09-11 20:23:53.000000000 +0200 +@@ -131,6 +131,7 @@ struct _cpp_file; + TK(WSTRING, LITERAL) /* L"string" */ \ + TK(STRING16, LITERAL) /* u"string" */ \ + TK(STRING32, LITERAL) /* U"string" */ \ ++ TK(UTF8STRING, LITERAL) /* u8"string" */ \ + TK(OBJC_STRING, LITERAL) /* @"string" - Objective-C */ \ + TK(HEADER_NAME, LITERAL) /* in #include */ \ + \ +@@ -724,10 +725,10 @@ extern const unsigned char *cpp_macro_de + extern void _cpp_backup_tokens (cpp_reader *, unsigned int); + extern const cpp_token *cpp_peek_token (cpp_reader *, int); + +-/* Evaluate a CPP_CHAR or CPP_WCHAR token. */ ++/* Evaluate a CPP_*CHAR* token. */ + extern cppchar_t cpp_interpret_charconst (cpp_reader *, const cpp_token *, + unsigned int *, int *); +-/* Evaluate a vector of CPP_STRING or CPP_WSTRING tokens. */ ++/* Evaluate a vector of CPP_*STRING* tokens. */ + extern bool cpp_interpret_string (cpp_reader *, + const cpp_string *, size_t, + cpp_string *, enum cpp_ttype); +--- libcpp/internal.h.jj 2008-09-05 12:59:49.000000000 +0200 ++++ libcpp/internal.h 2008-09-11 18:23:02.000000000 +0200 +@@ -400,6 +400,10 @@ struct cpp_reader + struct cset_converter narrow_cset_desc; + + /* Descriptor for converting from the source character set to the ++ UTF-8 execution character set. */ ++ struct cset_converter utf8_cset_desc; ++ ++ /* Descriptor for converting from the source character set to the + UTF-16 execution character set. */ + struct cset_converter char16_cset_desc; + +--- libcpp/lex.c.jj 2008-09-05 12:59:49.000000000 +0200 ++++ libcpp/lex.c 2008-09-12 13:54:01.000000000 +0200 +@@ -609,10 +609,185 @@ create_literal (cpp_reader *pfile, cpp_t + token->val.str.text = dest; + } + ++/* Lexes raw a string. The stored string contains the spelling, including ++ double quotes, delimiter string, '[' and ']', any leading ++ 'L', 'u', 'U' or 'u8' and 'R' modifier. It returns the type of the ++ literal, or CPP_OTHER if it was not properly terminated. ++ ++ The spelling is NUL-terminated, but it is not guaranteed that this ++ is the first NUL since embedded NULs are preserved. */ ++ ++static void ++lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base, ++ const uchar *cur) ++{ ++ bool saw_NUL = false; ++ const uchar *raw_prefix; ++ unsigned int raw_prefix_len = 0; ++ enum cpp_ttype type; ++ size_t total_len = 0; ++ _cpp_buff *first_buff = NULL, *last_buff = NULL; ++ ++ type = (*base == 'L' ? CPP_WSTRING : ++ *base == 'U' ? CPP_STRING32 : ++ *base == 'u' ? (base[1] == '8' ? CPP_UTF8STRING : CPP_STRING16) ++ : CPP_STRING); ++ ++ raw_prefix = cur + 1; ++ while (raw_prefix_len < 16) ++ { ++ switch (raw_prefix[raw_prefix_len]) ++ { ++ case ' ': case '[': case ']': case '\t': ++ case '\v': case '\f': case '\n': default: ++ break; ++ /* Basic source charset except the above chars. */ ++ case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': ++ case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': ++ case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': ++ case 's': case 't': case 'u': case 'v': case 'w': case 'x': ++ case 'y': case 'z': ++ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': ++ case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': ++ case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': ++ case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': ++ case 'Y': case 'Z': ++ case '0': case '1': case '2': case '3': case '4': case '5': ++ case '6': case '7': case '8': case '9': ++ case '_': case '{': case '}': case '#': case '(': case ')': ++ case '<': case '>': case '%': case ':': case ';': case '.': ++ case '?': case '*': case '+': case '-': case '/': case '^': ++ case '&': case '|': case '~': case '!': case '=': case ',': ++ case '\\': case '"': case '\'': ++ raw_prefix_len++; ++ continue; ++ } ++ break; ++ } ++ ++ if (raw_prefix[raw_prefix_len] != '[') ++ { ++ if (raw_prefix_len == 16) ++ cpp_error (pfile, CPP_DL_ERROR, ++ "raw string delimiter longer than 16 characters"); ++ else ++ cpp_error (pfile, CPP_DL_ERROR, ++ "invalid character '%c' in raw string delimiter", ++ (int) raw_prefix[raw_prefix_len]); ++ pfile->buffer->cur = raw_prefix - 1; ++ create_literal (pfile, token, base, raw_prefix - 1 - base, CPP_OTHER); ++ return; ++ } ++ ++ cur = raw_prefix + raw_prefix_len + 1; ++ for (;;) ++ { ++ cppchar_t c = *cur++; ++ ++ if (c == ']' ++ && strncmp ((const char *) cur, (const char *) raw_prefix, ++ raw_prefix_len) == 0 ++ && cur[raw_prefix_len] == '"') ++ { ++ cur += raw_prefix_len + 1; ++ break; ++ } ++ else if (c == '\n') ++ { ++ if (pfile->state.in_directive ++ || pfile->state.parsing_args ++ || pfile->state.in_deferred_pragma) ++ { ++ cur--; ++ type = CPP_OTHER; ++ cpp_error (pfile, CPP_DL_ERROR, "unterminated raw string"); ++ break; ++ } ++ ++ /* raw strings allow embedded non-escaped newlines, which ++ complicates this routine a lot. */ ++ if (first_buff == NULL) ++ { ++ total_len = cur - base; ++ first_buff = last_buff = _cpp_get_buff (pfile, total_len); ++ memcpy (BUFF_FRONT (last_buff), base, total_len); ++ raw_prefix = BUFF_FRONT (last_buff) + (raw_prefix - base); ++ BUFF_FRONT (last_buff) += total_len; ++ } ++ else ++ { ++ size_t len = cur - base; ++ size_t cur_len = len > BUFF_ROOM (last_buff) ++ ? BUFF_ROOM (last_buff) : len; ++ ++ total_len += len; ++ memcpy (BUFF_FRONT (last_buff), base, cur_len); ++ BUFF_FRONT (last_buff) += cur_len; ++ if (len > cur_len) ++ { ++ last_buff = _cpp_append_extend_buff (pfile, last_buff, ++ len - cur_len); ++ memcpy (BUFF_FRONT (last_buff), base + cur_len, ++ len - cur_len); ++ BUFF_FRONT (last_buff) += len - cur_len; ++ } ++ } ++ ++ if (pfile->buffer->cur < pfile->buffer->rlimit) ++ CPP_INCREMENT_LINE (pfile, 0); ++ pfile->buffer->need_line = true; ++ ++ if (!_cpp_get_fresh_line (pfile)) ++ { ++ token->type = CPP_EOF; ++ /* Tell the compiler the line number of the EOF token. */ ++ token->src_loc = pfile->line_table->highest_line; ++ token->flags = BOL; ++ if (first_buff != NULL) ++ _cpp_release_buff (pfile, first_buff); ++ cpp_error (pfile, CPP_DL_ERROR, "unterminated raw string"); ++ return; ++ } ++ ++ cur = base = pfile->buffer->cur; ++ } ++ else if (c == '\0') ++ saw_NUL = true; ++ } ++ ++ if (saw_NUL && !pfile->state.skipping) ++ cpp_error (pfile, CPP_DL_WARNING, ++ "null character(s) preserved in literal"); ++ ++ pfile->buffer->cur = cur; ++ if (first_buff == NULL) ++ create_literal (pfile, token, base, cur - base, type); ++ else ++ { ++ uchar *dest = _cpp_unaligned_alloc (pfile, total_len + (cur - base) + 1); ++ ++ token->type = type; ++ token->val.str.len = total_len + (cur - base); ++ token->val.str.text = dest; ++ last_buff = first_buff; ++ while (last_buff != NULL) ++ { ++ memcpy (dest, last_buff->base, ++ BUFF_FRONT (last_buff) - last_buff->base); ++ dest += BUFF_FRONT (last_buff) - last_buff->base; ++ last_buff = last_buff->next; ++ } ++ _cpp_release_buff (pfile, first_buff); ++ memcpy (dest, base, cur - base); ++ dest[cur - base] = '\0'; ++ } ++} ++ + /* Lexes a string, character constant, or angle-bracketed header file + name. The stored string contains the spelling, including opening +- quote and leading any leading 'L', 'u' or 'U'. It returns the type +- of the literal, or CPP_OTHER if it was not properly terminated. ++ quote and any leading 'L', 'u', 'U' or 'u8' and optional ++ 'R' modifier. It returns the type of the literal, or CPP_OTHER ++ if it was not properly terminated. + + The spelling is NUL-terminated, but it is not guaranteed that this + is the first NUL since embedded NULs are preserved. */ +@@ -626,12 +801,24 @@ lex_string (cpp_reader *pfile, cpp_token + + cur = base; + terminator = *cur++; +- if (terminator == 'L' || terminator == 'u' || terminator == 'U') ++ if (terminator == 'L' || terminator == 'U') + terminator = *cur++; +- if (terminator == '\"') ++ else if (terminator == 'u') ++ { ++ terminator = *cur++; ++ if (terminator == '8') ++ terminator = *cur++; ++ } ++ if (terminator == 'R') ++ { ++ lex_raw_string (pfile, token, base, cur); ++ return; ++ } ++ if (terminator == '"') + type = (*base == 'L' ? CPP_WSTRING : + *base == 'U' ? CPP_STRING32 : +- *base == 'u' ? CPP_STRING16 : CPP_STRING); ++ *base == 'u' ? (base[1] == '8' ? CPP_UTF8STRING : CPP_STRING16) ++ : CPP_STRING); + else if (terminator == '\'') + type = (*base == 'L' ? CPP_WCHAR : + *base == 'U' ? CPP_CHAR32 : +@@ -1035,10 +1222,20 @@ _cpp_lex_direct (cpp_reader *pfile) + case 'L': + case 'u': + case 'U': ++ case 'R': + /* 'L', 'u' or 'U' may introduce wide characters or strings. */ + if (c == 'L' || CPP_OPTION (pfile, uliterals)) + { +- if (*buffer->cur == '\'' || *buffer->cur == '"') ++ if ((*buffer->cur == '\'' && c != 'R') ++ || *buffer->cur == '"' ++ || (*buffer->cur == 'R' ++ && c != 'R' ++ && buffer->cur[1] == '"' ++ && CPP_OPTION (pfile, uliterals)) ++ || (*buffer->cur == '8' ++ && c == 'u' ++ && (buffer->cur[1] == '"' ++ || (buffer->cur[1] == 'R' && buffer->cur[2] == '"')))) + { + lex_string (pfile, result, buffer->cur - 1); + break; +@@ -1054,7 +1251,7 @@ _cpp_lex_direct (cpp_reader *pfile) + case 'y': case 'z': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': +- case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': ++ case 'M': case 'N': case 'O': case 'P': case 'Q': + case 'S': case 'T': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + result->type = CPP_NAME; +--- libcpp/macro.c.jj 2008-09-05 12:59:49.000000000 +0200 ++++ libcpp/macro.c 2008-09-11 20:25:20.000000000 +0200 +@@ -377,7 +377,8 @@ stringify_arg (cpp_reader *pfile, macro_ + escape_it = (token->type == CPP_STRING || token->type == CPP_CHAR + || token->type == CPP_WSTRING || token->type == CPP_STRING + || token->type == CPP_STRING32 || token->type == CPP_CHAR32 +- || token->type == CPP_STRING16 || token->type == CPP_CHAR16); ++ || token->type == CPP_STRING16 || token->type == CPP_CHAR16 ++ || token->type == CPP_UTF8STRING); + + /* Room for each char being written in octal, initial space and + final quote and NUL. */ +--- gcc/c-common.c.jj 2008-09-09 16:08:04.000000000 +0200 ++++ gcc/c-common.c 2008-09-11 20:30:57.000000000 +0200 +@@ -7472,7 +7472,7 @@ c_parse_error (const char *gmsgid, enum + message = NULL; + } + else if (token == CPP_STRING || token == CPP_WSTRING || token == CPP_STRING16 +- || token == CPP_STRING32) ++ || token == CPP_STRING32 || token == CPP_UTF8STRING) + message = catenate_messages (gmsgid, " before string constant"); + else if (token == CPP_NUMBER) + message = catenate_messages (gmsgid, " before numeric constant"); +--- gcc/c-lex.c.jj 2008-09-05 12:56:31.000000000 +0200 ++++ gcc/c-lex.c 2008-09-11 20:34:06.000000000 +0200 +@@ -365,6 +365,7 @@ c_lex_with_flags (tree *value, location_ + case CPP_WSTRING: + case CPP_STRING16: + case CPP_STRING32: ++ case CPP_UTF8STRING: + type = lex_string (tok, value, true, true); + break; + +@@ -423,6 +424,7 @@ c_lex_with_flags (tree *value, location_ + case CPP_WSTRING: + case CPP_STRING16: + case CPP_STRING32: ++ case CPP_UTF8STRING: + if ((lex_flags & C_LEX_RAW_STRINGS) == 0) + { + type = lex_string (tok, value, false, +@@ -830,12 +832,13 @@ interpret_fixed (const cpp_token *token, + return value; + } + +-/* Convert a series of STRING, WSTRING, STRING16 and/or STRING32 tokens +- into a tree, performing string constant concatenation. TOK is the +- first of these. VALP is the location to write the string into. +- OBJC_STRING indicates whether an '@' token preceded the incoming token. ++/* Convert a series of STRING, WSTRING, STRING16, STRING32 and/or ++ UTF8STRING tokens into a tree, performing string constant ++ concatenation. TOK is the first of these. VALP is the location ++ to write the string into. OBJC_STRING indicates whether an '@' token ++ preceded the incoming token. + Returns the CPP token type of the result (CPP_STRING, CPP_WSTRING, +- CPP_STRING32, CPP_STRING16, or CPP_OBJC_STRING). ++ CPP_STRING32, CPP_STRING16, CPP_UTF8STRING, or CPP_OBJC_STRING). + + This is unfortunately more work than it should be. If any of the + strings in the series has an L prefix, the result is a wide string +@@ -880,6 +883,7 @@ lex_string (const cpp_token *tok, tree * + case CPP_WSTRING: + case CPP_STRING16: + case CPP_STRING32: ++ case CPP_UTF8STRING: + if (type != tok->type) + { + if (type == CPP_STRING) +@@ -925,6 +929,7 @@ lex_string (const cpp_token *tok, tree * + { + default: + case CPP_STRING: ++ case CPP_UTF8STRING: + value = build_string (1, ""); + break; + case CPP_STRING16: +@@ -950,6 +955,7 @@ lex_string (const cpp_token *tok, tree * + { + default: + case CPP_STRING: ++ case CPP_UTF8STRING: + TREE_TYPE (value) = char_array_type_node; + break; + case CPP_STRING16: +--- gcc/c-parser.c.jj 2008-09-09 16:08:04.000000000 +0200 ++++ gcc/c-parser.c 2008-09-11 20:34:34.000000000 +0200 +@@ -5085,6 +5085,7 @@ c_parser_postfix_expression (c_parser *p + case CPP_STRING16: + case CPP_STRING32: + case CPP_WSTRING: ++ case CPP_UTF8STRING: + expr.value = c_parser_peek_token (parser)->value; + expr.original_code = STRING_CST; + c_parser_consume_token (parser); +--- gcc/cp/parser.c.jj 2008-09-09 16:08:03.000000000 +0200 ++++ gcc/cp/parser.c 2008-09-11 20:36:10.000000000 +0200 +@@ -797,6 +797,7 @@ cp_lexer_print_token (FILE * stream, cp_ + case CPP_STRING16: + case CPP_STRING32: + case CPP_WSTRING: ++ case CPP_UTF8STRING: + fprintf (stream, " \"%s\"", TREE_STRING_POINTER (token->u.value)); + break; + +@@ -2049,7 +2050,8 @@ cp_parser_is_string_literal (cp_token* t + return (token->type == CPP_STRING || + token->type == CPP_STRING16 || + token->type == CPP_STRING32 || +- token->type == CPP_WSTRING); ++ token->type == CPP_WSTRING || ++ token->type == CPP_UTF8STRING); + } + + /* Returns nonzero if TOKEN is the indicated KEYWORD. */ +@@ -2972,6 +2974,7 @@ cp_parser_string_literal (cp_parser *par + { + default: + case CPP_STRING: ++ case CPP_UTF8STRING: + TREE_TYPE (value) = char_array_type_node; + break; + case CPP_STRING16: +@@ -3195,6 +3198,7 @@ cp_parser_primary_expression (cp_parser + case CPP_STRING16: + case CPP_STRING32: + case CPP_WSTRING: ++ case CPP_UTF8STRING: + /* ??? Should wide strings be allowed when parser->translate_strings_p + is false (i.e. in attributes)? If not, we can kill the third + argument to cp_parser_string_literal. */ +--- gcc/testsuite/gcc.dg/raw-string-1.c.jj 2008-09-12 11:48:36.000000000 +0200 ++++ gcc/testsuite/gcc.dg/raw-string-1.c 2008-09-12 14:01:27.000000000 +0200 +@@ -0,0 +1,101 @@ ++/* { dg-do run } */ ++/* { dg-options "-std=gnu99" } */ ++ ++#include ++ ++typedef __CHAR16_TYPE__ char16_t; ++typedef __CHAR32_TYPE__ char32_t; ++ ++const char s0[] = R"[a\ ++\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb ++c]"; ++const char s1[] = "a\U0000010d\u010d\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc"; ++const char s2[] = R"*|*[a\ ++b ++c]" ++c]*|" ++c]*|*"; ++const char s3[] = "ab\nc]\"\nc]*|\"\nc"; ++ ++const char t0[] = u8R"[a\ ++\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb ++c]"; ++const char t1[] = u8"a\U0000010d\u010d\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc"; ++const char t2[] = u8R"*|*[a\ ++b ++c]" ++c]*|" ++c]*|*"; ++const char t3[] = u8"ab\nc]\"\nc]*|\"\nc"; ++ ++const char16_t u0[] = uR"[a\ ++\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb ++c]"; ++const char16_t u1[] = u"a\U0000010d\u010d\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc"; ++const char16_t u2[] = uR"*|*[a\ ++b ++c]" ++c]*|" ++c]*|*"; ++const char16_t u3[] = u"ab\nc]\"\nc]*|\"\nc"; ++ ++const char32_t U0[] = UR"[a\ ++\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb ++c]"; ++const char32_t U1[] = U"a\U0000010d\u010d\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc"; ++const char32_t U2[] = UR"*|*[a\ ++b ++c]" ++c]*|" ++c]*|*"; ++const char32_t U3[] = U"ab\nc]\"\nc]*|\"\nc"; ++ ++const wchar_t L0[] = LR"[a\ ++\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb ++c]"; ++const wchar_t L1[] = L"a\U0000010d\u010d\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc"; ++const wchar_t L2[] = LR"*|*[a\ ++b ++c]" ++c]*|" ++c]*|*"; ++const wchar_t L3[] = L"ab\nc]\"\nc]*|\"\nc"; ++ ++int ++main (void) ++{ ++ if (sizeof (s0) != sizeof (s1) ++ || __builtin_memcmp (s0, s1, sizeof (s0)) != 0) ++ __builtin_abort (); ++ if (sizeof (s2) != sizeof (s3) ++ || __builtin_memcmp (s2, s3, sizeof (s2)) != 0) ++ __builtin_abort (); ++ if (sizeof (t0) != sizeof (t1) ++ || __builtin_memcmp (t0, t1, sizeof (t0)) != 0) ++ __builtin_abort (); ++ if (sizeof (t2) != sizeof (t3) ++ || __builtin_memcmp (t2, t3, sizeof (t2)) != 0) ++ __builtin_abort (); ++ if (sizeof (u0) != sizeof (u1) ++ || __builtin_memcmp (u0, u1, sizeof (u0)) != 0) ++ __builtin_abort (); ++ if (sizeof (u2) != sizeof (u3) ++ || __builtin_memcmp (u2, u3, sizeof (u2)) != 0) ++ __builtin_abort (); ++ if (sizeof (U0) != sizeof (U1) ++ || __builtin_memcmp (U0, U1, sizeof (U0)) != 0) ++ __builtin_abort (); ++ if (sizeof (U2) != sizeof (U3) ++ || __builtin_memcmp (U2, U3, sizeof (U2)) != 0) ++ __builtin_abort (); ++ if (sizeof (L0) != sizeof (L1) ++ || __builtin_memcmp (L0, L1, sizeof (L0)) != 0) ++ __builtin_abort (); ++ if (sizeof (L2) != sizeof (L3) ++ || __builtin_memcmp (L2, L3, sizeof (L2)) != 0) ++ __builtin_abort (); ++ if (sizeof (R"*[]*") != 1 ++ || __builtin_memcmp (R"*[]*", "", 1) != 0) ++ __builtin_abort (); ++ return 0; ++} +--- gcc/testsuite/gcc.dg/raw-string-2.c.jj 2008-09-12 12:14:42.000000000 +0200 ++++ gcc/testsuite/gcc.dg/raw-string-2.c 2008-09-12 13:37:10.000000000 +0200 +@@ -0,0 +1,109 @@ ++/* { dg-do run } */ ++/* { dg-options "-std=gnu99" } */ ++ ++#include ++ ++typedef __CHAR16_TYPE__ char16_t; ++typedef __CHAR32_TYPE__ char32_t; ++ ++#define R ++#define u ++#define uR ++#define U ++#define UR ++#define u8 ++#define u8R ++#define L ++#define LR ++ ++const char s00[] = R"[a]" "[b]"; ++const char s01[] = "[a]" R"*[b]*"; ++const char s02[] = R"[a]" R"[b]"; ++const char s03[] = R"-[a]-" u8"[b]"; ++const char s04[] = "[a]" u8R"MNOPQRSTUVWXYZ[b]MNOPQRSTUVWXYZ"; ++const char s05[] = R"[a]" u8R"wxyzABCDEFGHIJKL[b]wxyzABCDEFGHIJKL"; ++const char s06[] = u8R";([a];(" "[b]"; ++const char s07[] = u8"[a]" R"[b]"; ++const char s08[] = u8R"[a]" R"_{}#()<>%:;.?*+-[b]_{}#()<>%:;.?*+-"; ++const char s09[] = u8R"/^&|~!=,"'\[a]/^&|~!=,"'\" u8"[b]"; ++const char s10[] = u8"[a]" u8R"0123456789abcdef[b]0123456789abcdef"; ++const char s11[] = u8R"ghijklmnopqrstuv[a]ghijklmnopqrstuv" u8R"w[b]w"; ++ ++const char16_t u03[] = R"-[a]-" u"[b]"; ++const char16_t u04[] = "[a]" uR"MNOPQRSTUVWXYZ[b]MNOPQRSTUVWXYZ"; ++const char16_t u05[] = R"[a]" uR"wxyzABCDEFGHIJKL[b]wxyzABCDEFGHIJKL"; ++const char16_t u06[] = uR";([a];(" "[b]"; ++const char16_t u07[] = u"[a]" R"[b]"; ++const char16_t u08[] = uR"[a]" R"_{}#()<>%:;.?*+-[b]_{}#()<>%:;.?*+-"; ++const char16_t u09[] = uR"/^&|~!=,"'\[a]/^&|~!=,"'\" u"[b]"; ++const char16_t u10[] = u"[a]" uR"0123456789abcdef[b]0123456789abcdef"; ++const char16_t u11[] = uR"ghijklmnopqrstuv[a]ghijklmnopqrstuv" uR"w[b]w"; ++ ++const char32_t U03[] = R"-[a]-" U"[b]"; ++const char32_t U04[] = "[a]" UR"MNOPQRSTUVWXYZ[b]MNOPQRSTUVWXYZ"; ++const char32_t U05[] = R"[a]" UR"wxyzABCDEFGHIJKL[b]wxyzABCDEFGHIJKL"; ++const char32_t U06[] = UR";([a];(" "[b]"; ++const char32_t U07[] = U"[a]" R"[b]"; ++const char32_t U08[] = UR"[a]" R"_{}#()<>%:;.?*+-[b]_{}#()<>%:;.?*+-"; ++const char32_t U09[] = UR"/^&|~!=,"'\[a]/^&|~!=,"'\" U"[b]"; ++const char32_t U10[] = U"[a]" UR"0123456789abcdef[b]0123456789abcdef"; ++const char32_t U11[] = UR"ghijklmnopqrstuv[a]ghijklmnopqrstuv" UR"w[b]w"; ++ ++const wchar_t L03[] = R"-[a]-" L"[b]"; ++const wchar_t L04[] = "[a]" LR"MNOPQRSTUVWXYZ[b]MNOPQRSTUVWXYZ"; ++const wchar_t L05[] = R"[a]" LR"wxyzABCDEFGHIJKL[b]wxyzABCDEFGHIJKL"; ++const wchar_t L06[] = LR";([a];(" "[b]"; ++const wchar_t L07[] = L"[a]" R"[b]"; ++const wchar_t L08[] = LR"[a]" R"_{}#()<>%:;.?*+-[b]_{}#()<>%:;.?*+-"; ++const wchar_t L09[] = LR"/^&|~!=,"'\[a]/^&|~!=,"'\" L"[b]"; ++const wchar_t L10[] = L"[a]" LR"0123456789abcdef[b]0123456789abcdef"; ++const wchar_t L11[] = LR"ghijklmnopqrstuv[a]ghijklmnopqrstuv" LR"w[b]w"; ++ ++int ++main (void) ++{ ++#define TEST(str, val) \ ++ if (sizeof (str) != sizeof (val) \ ++ || __builtin_memcmp (str, val, sizeof (str)) != 0) \ ++ __builtin_abort () ++ TEST (s00, "a[b]"); ++ TEST (s01, "[a]b"); ++ TEST (s02, "ab"); ++ TEST (s03, "a[b]"); ++ TEST (s04, "[a]b"); ++ TEST (s05, "ab"); ++ TEST (s06, "a[b]"); ++ TEST (s07, "[a]b"); ++ TEST (s08, "ab"); ++ TEST (s09, "a[b]"); ++ TEST (s10, "[a]b"); ++ TEST (s11, "ab"); ++ TEST (u03, u"a[b]"); ++ TEST (u04, u"[a]b"); ++ TEST (u05, u"ab"); ++ TEST (u06, u"a[b]"); ++ TEST (u07, u"[a]b"); ++ TEST (u08, u"ab"); ++ TEST (u09, u"a[b]"); ++ TEST (u10, u"[a]b"); ++ TEST (u11, u"ab"); ++ TEST (U03, U"a[b]"); ++ TEST (U04, U"[a]b"); ++ TEST (U05, U"ab"); ++ TEST (U06, U"a[b]"); ++ TEST (U07, U"[a]b"); ++ TEST (U08, U"ab"); ++ TEST (U09, U"a[b]"); ++ TEST (U10, U"[a]b"); ++ TEST (U11, U"ab"); ++ TEST (L03, L"a[b]"); ++ TEST (L04, L"[a]b"); ++ TEST (L05, L"ab"); ++ TEST (L06, L"a[b]"); ++ TEST (L07, L"[a]b"); ++ TEST (L08, L"ab"); ++ TEST (L09, L"a[b]"); ++ TEST (L10, L"[a]b"); ++ TEST (L11, L"ab"); ++ return 0; ++} +--- gcc/testsuite/gcc.dg/raw-string-3.c.jj 2008-09-12 13:27:09.000000000 +0200 ++++ gcc/testsuite/gcc.dg/raw-string-3.c 2008-09-12 13:42:55.000000000 +0200 +@@ -0,0 +1,53 @@ ++/* If not gnu99, the {,u,u8,U,L}R prefix should be parsed as separate ++ token. */ ++/* { dg-do compile } */ ++/* { dg-options "" } */ ++ ++const void *s0 = R"[a]"; /* { dg-error "undeclared" } */ ++ /* { dg-error "expected ',' or ';'" "" { target *-*-* } 6 } */ ++const void *s1 = uR"[a]"; /* { dg-error "undeclared" } */ ++ /* { dg-error "expected ',' or ';'" "" { target *-*-* } 8 } */ ++const void *s2 = UR"[a]"; /* { dg-error "undeclared" } */ ++ /* { dg-error "expected ',' or ';'" "" { target *-*-* } 10 } */ ++const void *s3 = u8R"[a]"; /* { dg-error "undeclared" } */ ++ /* { dg-error "expected ',' or ';'" "" { target *-*-* } 12 } */ ++const void *s4 = LR"[a]"; /* { dg-error "undeclared" } */ ++ /* { dg-error "expected ',' or ';'" "" { target *-*-* } 14 } */ ++ ++const int i0 = R'a'; /* { dg-error "expected ',' or ';'" } */ ++const int i1 = uR'a'; /* { dg-error "expected ',' or ';'" } */ ++const int i2 = UR'a'; /* { dg-error "expected ',' or ';'" } */ ++const int i3 = u8R'a'; /* { dg-error "expected ',' or ';'" } */ ++const int i4 = LR'a'; /* { dg-error "expected ',' or ';'" } */ ++ ++#define R "a" ++#define uR "b" ++#define UR "c" ++#define u8R "d" ++#define LR "e" ++ ++const void *s5 = R"[a]"; ++const void *s6 = uR"[a]"; ++const void *s7 = UR"[a]"; ++const void *s8 = u8R"[a]"; ++const void *s9 = LR"[a]"; ++ ++#undef R ++#undef uR ++#undef UR ++#undef u8R ++#undef LR ++ ++#define R 1 + ++#define uR 2 + ++#define UR 3 + ++#define u8R 4 + ++#define LR 5 + ++ ++const int i5 = R'a'; ++const int i6 = uR'a'; ++const int i7 = UR'a'; ++const int i8 = u8R'a'; ++const int i9 = LR'a'; ++ ++int main () {} +--- gcc/testsuite/gcc.dg/raw-string-4.c.jj 2008-09-12 13:27:09.000000000 +0200 ++++ gcc/testsuite/gcc.dg/raw-string-4.c 2008-09-12 13:33:43.000000000 +0200 +@@ -0,0 +1,28 @@ ++/* R is not applicable for character literals. */ ++/* { dg-do compile } */ ++/* { dg-options "-std=gnu99" } */ ++ ++const int i0 = R'a'; /* { dg-error "undeclared" } */ ++ /* { dg-error "expected ',' or ';'" "" { target *-*-* } 5 } */ ++const int i1 = uR'a'; /* { dg-error "undeclared" } */ ++ /* { dg-error "expected ',' or ';'" "" { target *-*-* } 7 } */ ++const int i2 = UR'a'; /* { dg-error "undeclared" } */ ++ /* { dg-error "expected ',' or ';'" "" { target *-*-* } 9 } */ ++const int i3 = u8R'a'; /* { dg-error "undeclared" } */ ++ /* { dg-error "expected ',' or ';'" "" { target *-*-* } 11 } */ ++const int i4 = LR'a'; /* { dg-error "undeclared" } */ ++ /* { dg-error "expected ',' or ';'" "" { target *-*-* } 13 } */ ++ ++#define R 1 + ++#define uR 2 + ++#define UR 3 + ++#define u8R 4 + ++#define LR 5 + ++ ++const int i5 = R'a'; ++const int i6 = uR'a'; ++const int i7 = UR'a'; ++const int i8 = u8R'a'; ++const int i9 = LR'a'; ++ ++int main () {} +--- gcc/testsuite/gcc.dg/raw-string-5.c.jj 2008-09-12 13:49:58.000000000 +0200 ++++ gcc/testsuite/gcc.dg/raw-string-5.c 2008-09-12 13:59:14.000000000 +0200 +@@ -0,0 +1,23 @@ ++/* { dg-do compile } */ ++/* { dg-options "-std=gnu99" } */ ++ ++const void *s0 = R"0123456789abcdefg[]0123456789abcdefg"; ++ /* { dg-error "raw string delimiter longer" "" { target *-*-* } 4 } */ ++ /* { dg-error "stray" "" { target *-*-* } 4 } */ ++const void *s1 = R" [] "; ++ /* { dg-error "invalid character" "" { target *-*-* } 7 } */ ++ /* { dg-error "stray" "" { target *-*-* } 7 } */ ++const void *s2 = R" [] "; ++ /* { dg-error "invalid character" "" { target *-*-* } 10 } */ ++ /* { dg-error "stray" "" { target *-*-* } 10 } */ ++const void *s3 = R"][]]"; ++ /* { dg-error "invalid character" "" { target *-*-* } 13 } */ ++ /* { dg-error "stray" "" { target *-*-* } 13 } */ ++const void *s4 = R"@[]@"; ++ /* { dg-error "invalid character" "" { target *-*-* } 16 } */ ++ /* { dg-error "stray" "" { target *-*-* } 16 } */ ++const void *s5 = R"$[]$"; ++ /* { dg-error "invalid character" "" { target *-*-* } 19 } */ ++ /* { dg-error "stray" "" { target *-*-* } 19 } */ ++ ++int main () {} +--- gcc/testsuite/gcc.dg/raw-string-6.c.jj 2008-09-12 13:59:33.000000000 +0200 ++++ gcc/testsuite/gcc.dg/raw-string-6.c 2008-09-12 14:03:46.000000000 +0200 +@@ -0,0 +1,5 @@ ++/* { dg-do compile } */ ++/* { dg-options "-std=gnu99" } */ ++ ++const void *s0 = R"ouch[]ouCh"; /* { dg-error "expected expression at end of input" } */ ++ /* { dg-error "unterminated raw string" "" { target *-*-* } 6 } */ +--- gcc/testsuite/gcc.dg/raw-string-7.c.jj 2008-09-12 14:27:39.000000000 +0200 ++++ gcc/testsuite/gcc.dg/raw-string-7.c 2008-09-12 14:34:17.000000000 +0200 +@@ -0,0 +1,23 @@ ++/* The trailing whitespace after \ and before newline extension ++ breaks full compliance for raw strings. */ ++/* { dg-do run { xfail *-*-* } } */ ++/* { dg-options "-std=gnu99" } */ ++ ++/* Note, there is a single space after \ on the following line. */ ++const void *s0 = R"[\ ++]"; ++/* { dg-bogus "backslash and newline separated by space" "" { xfail *-*-* } 7 } */ ++ ++/* Note, there is a single tab after \ on the following line. */ ++const void *s1 = R"[\ ++]"; ++/* { dg-bogus "backslash and newline separated by space" "" { xfail *-*-* } 12 } */ ++ ++int ++main (void) ++{ ++ if (__builtin_strcmp (s0, "\\ \n") != 0 ++ || __builtin_strcmp (s1, "\\\t\n") != 0) ++ __builtin_abort (); ++ return 0; ++} +--- gcc/testsuite/gcc.dg/utf8-1.c.jj 2008-09-12 10:01:47.000000000 +0200 ++++ gcc/testsuite/gcc.dg/utf8-1.c 2008-09-12 11:45:48.000000000 +0200 +@@ -0,0 +1,45 @@ ++/* { dg-do run } */ ++/* { dg-require-iconv "ISO-8859-2" } */ ++/* { dg-options "-std=gnu99 -fexec-charset=ISO-8859-2" } */ ++ ++const char *str1 = "h\u00e1\U0000010Dky "; ++const char *str2 = "\u010d\u00E1rky\n"; ++const char *str3 = u8"h\u00e1\U0000010Dky "; ++const char *str4 = u8"\u010d\u00E1rky\n"; ++const char *str5 = "h\u00e1\U0000010Dky " "\u010d\u00E1rky\n"; ++const char *str6 = u8"h\u00e1\U0000010Dky " "\u010d\u00E1rky\n"; ++const char *str7 = "h\u00e1\U0000010Dky " u8"\u010d\u00E1rky\n"; ++#define u8 ++const char *str8 = u8"h\u00e1\U0000010Dky " u8"\u010d\u00E1rky\n"; ++ ++const char latin2_1[] = "\x68\xe1\xe8\x6b\x79\x20"; ++const char latin2_2[] = "\xe8\xe1\x72\x6b\x79\n"; ++const char utf8_1[] = "\x68\xc3\xa1\xc4\x8d\x6b\x79\x20"; ++const char utf8_2[] = "\xc4\x8d\xc3\xa1\x72\x6b\x79\n"; ++ ++int ++main (void) ++{ ++ if (__builtin_strcmp (str1, latin2_1) != 0 ++ || __builtin_strcmp (str2, latin2_2) != 0 ++ || __builtin_strcmp (str3, utf8_1) != 0 ++ || __builtin_strcmp (str4, utf8_2) != 0 ++ || __builtin_strncmp (str5, latin2_1, sizeof (latin2_1) - 1) != 0 ++ || __builtin_strcmp (str5 + sizeof (latin2_1) - 1, latin2_2) != 0 ++ || __builtin_strncmp (str6, utf8_1, sizeof (utf8_1) - 1) != 0 ++ || __builtin_strcmp (str6 + sizeof (utf8_1) - 1, utf8_2) != 0 ++ || __builtin_strncmp (str7, utf8_1, sizeof (utf8_1) - 1) != 0 ++ || __builtin_strcmp (str7 + sizeof (utf8_1) - 1, utf8_2) != 0 ++ || __builtin_strncmp (str8, utf8_1, sizeof (utf8_1) - 1) != 0 ++ || __builtin_strcmp (str8 + sizeof (utf8_1) - 1, utf8_2) != 0) ++ __builtin_abort (); ++ if (sizeof ("a" u8"b"[0]) != 1 ++ || sizeof (u8"a" "b"[0]) != 1 ++ || sizeof (u8"a" u8"b"[0]) != 1 ++ || sizeof ("a" "\u010d") != 3 ++ || sizeof ("a" u8"\u010d") != 4 ++ || sizeof (u8"a" "\u010d") != 4 ++ || sizeof (u8"a" "\u010d") != 4) ++ __builtin_abort (); ++ return 0; ++} +--- gcc/testsuite/gcc.dg/utf8-2.c.jj 2008-09-12 11:27:51.000000000 +0200 ++++ gcc/testsuite/gcc.dg/utf8-2.c 2008-09-12 11:36:48.000000000 +0200 +@@ -0,0 +1,26 @@ ++/* { dg-do compile } */ ++/* { dg-options "-std=gnu99" } */ ++ ++#include ++ ++typedef __CHAR16_TYPE__ char16_t; ++typedef __CHAR32_TYPE__ char32_t; ++ ++const char s0[] = u8"ab"; ++const char16_t s1[] = u8"ab"; /* { dg-error "from non-wide" } */ ++const char32_t s2[] = u8"ab"; /* { dg-error "from non-wide" } */ ++const wchar_t s3[] = u8"ab"; /* { dg-error "from non-wide" } */ ++ ++const char t0[0] = u8"ab"; /* { dg-warning "chars is too long" } */ ++const char t1[1] = u8"ab"; /* { dg-warning "chars is too long" } */ ++const char t2[2] = u8"ab"; ++const char t3[3] = u8"ab"; ++const char t4[4] = u8"ab"; ++ ++const char u0[0] = u8"\u2160."; /* { dg-warning "chars is too long" } */ ++const char u1[1] = u8"\u2160."; /* { dg-warning "chars is too long" } */ ++const char u2[2] = u8"\u2160."; /* { dg-warning "chars is too long" } */ ++const char u3[3] = u8"\u2160."; /* { dg-warning "chars is too long" } */ ++const char u4[4] = u8"\u2160."; ++const char u5[5] = u8"\u2160."; ++const char u6[6] = u8"\u2160."; +--- gcc/testsuite/gcc.dg/utf-badconcat2.c.jj 2008-09-12 11:28:26.000000000 +0200 ++++ gcc/testsuite/gcc.dg/utf-badconcat2.c 2008-09-12 11:30:53.000000000 +0200 +@@ -0,0 +1,15 @@ ++/* Test unsupported concatenation of UTF-8 string literals. */ ++/* { dg-do compile } */ ++/* { dg-options "-std=gnu99" } */ ++ ++void *s0 = u8"a" "b"; ++void *s1 = "a" u8"b"; ++void *s2 = u8"a" u8"b"; ++void *s3 = u8"a" u"b"; /* { dg-error "non-standard concatenation" } */ ++void *s4 = u"a" u8"b"; /* { dg-error "non-standard concatenation" } */ ++void *s5 = u8"a" U"b"; /* { dg-error "non-standard concatenation" } */ ++void *s6 = U"a" u8"b"; /* { dg-error "non-standard concatenation" } */ ++void *s7 = u8"a" L"b"; /* { dg-error "non-standard concatenation" } */ ++void *s8 = L"a" u8"b"; /* { dg-error "non-standard concatenation" } */ ++ ++int main () {} +--- gcc/testsuite/gcc.dg/utf-dflt2.c.jj 2008-09-12 11:32:03.000000000 +0200 ++++ gcc/testsuite/gcc.dg/utf-dflt2.c 2008-09-12 13:24:39.000000000 +0200 +@@ -0,0 +1,12 @@ ++/* If not gnu99, the u8 prefix should be parsed as separate tokens. */ ++/* { dg-do compile } */ ++/* { dg-options "" } */ ++ ++const void *s0 = u8"a"; /* { dg-error "undeclared" } */ ++ /* { dg-error "expected ',' or ';'" "" { target *-*-* } 5 } */ ++ ++#define u8 "a" ++ ++const void *s1 = u8"a"; ++ ++int main () {} +--- gcc/testsuite/g++.dg/ext/raw-string-1.C.jj 2008-09-12 11:48:36.000000000 +0200 ++++ gcc/testsuite/g++.dg/ext/raw-string-1.C 2008-09-12 14:18:07.000000000 +0200 +@@ -0,0 +1,96 @@ ++// { dg-do run } ++// { dg-options "-std=c++0x" } ++ ++const char s0[] = R"[a\ ++\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb ++c]"; ++const char s1[] = "a\U0000010d\u010d\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc"; ++const char s2[] = R"*|*[a\ ++b ++c]" ++c]*|" ++c]*|*"; ++const char s3[] = "ab\nc]\"\nc]*|\"\nc"; ++ ++const char t0[] = u8R"[a\ ++\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb ++c]"; ++const char t1[] = u8"a\U0000010d\u010d\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc"; ++const char t2[] = u8R"*|*[a\ ++b ++c]" ++c]*|" ++c]*|*"; ++const char t3[] = u8"ab\nc]\"\nc]*|\"\nc"; ++ ++const char16_t u0[] = uR"[a\ ++\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb ++c]"; ++const char16_t u1[] = u"a\U0000010d\u010d\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc"; ++const char16_t u2[] = uR"*|*[a\ ++b ++c]" ++c]*|" ++c]*|*"; ++const char16_t u3[] = u"ab\nc]\"\nc]*|\"\nc"; ++ ++const char32_t U0[] = UR"[a\ ++\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb ++c]"; ++const char32_t U1[] = U"a\U0000010d\u010d\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc"; ++const char32_t U2[] = UR"*|*[a\ ++b ++c]" ++c]*|" ++c]*|*"; ++const char32_t U3[] = U"ab\nc]\"\nc]*|\"\nc"; ++ ++const wchar_t L0[] = LR"[a\ ++\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb ++c]"; ++const wchar_t L1[] = L"a\U0000010d\u010d\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc"; ++const wchar_t L2[] = LR"*|*[a\ ++b ++c]" ++c]*|" ++c]*|*"; ++const wchar_t L3[] = L"ab\nc]\"\nc]*|\"\nc"; ++ ++int ++main (void) ++{ ++ if (sizeof (s0) != sizeof (s1) ++ || __builtin_memcmp (s0, s1, sizeof (s0)) != 0) ++ __builtin_abort (); ++ if (sizeof (s2) != sizeof (s3) ++ || __builtin_memcmp (s2, s3, sizeof (s2)) != 0) ++ __builtin_abort (); ++ if (sizeof (t0) != sizeof (t1) ++ || __builtin_memcmp (t0, t1, sizeof (t0)) != 0) ++ __builtin_abort (); ++ if (sizeof (t2) != sizeof (t3) ++ || __builtin_memcmp (t2, t3, sizeof (t2)) != 0) ++ __builtin_abort (); ++ if (sizeof (u0) != sizeof (u1) ++ || __builtin_memcmp (u0, u1, sizeof (u0)) != 0) ++ __builtin_abort (); ++ if (sizeof (u2) != sizeof (u3) ++ || __builtin_memcmp (u2, u3, sizeof (u2)) != 0) ++ __builtin_abort (); ++ if (sizeof (U0) != sizeof (U1) ++ || __builtin_memcmp (U0, U1, sizeof (U0)) != 0) ++ __builtin_abort (); ++ if (sizeof (U2) != sizeof (U3) ++ || __builtin_memcmp (U2, U3, sizeof (U2)) != 0) ++ __builtin_abort (); ++ if (sizeof (L0) != sizeof (L1) ++ || __builtin_memcmp (L0, L1, sizeof (L0)) != 0) ++ __builtin_abort (); ++ if (sizeof (L2) != sizeof (L3) ++ || __builtin_memcmp (L2, L3, sizeof (L2)) != 0) ++ __builtin_abort (); ++ if (sizeof (R"*[]*") != 1 ++ || __builtin_memcmp (R"*[]*", "", 1) != 0) ++ __builtin_abort (); ++ return 0; ++} +--- gcc/testsuite/g++.dg/ext/raw-string-2.C.jj 2008-09-12 12:14:42.000000000 +0200 ++++ gcc/testsuite/g++.dg/ext/raw-string-2.C 2008-09-12 14:18:14.000000000 +0200 +@@ -0,0 +1,104 @@ ++// { dg-do run } ++// { dg-options "-std=c++0x" } ++ ++#define R ++#define u ++#define uR ++#define U ++#define UR ++#define u8 ++#define u8R ++#define L ++#define LR ++ ++const char s00[] = R"[a]" "[b]"; ++const char s01[] = "[a]" R"*[b]*"; ++const char s02[] = R"[a]" R"[b]"; ++const char s03[] = R"-[a]-" u8"[b]"; ++const char s04[] = "[a]" u8R"MNOPQRSTUVWXYZ[b]MNOPQRSTUVWXYZ"; ++const char s05[] = R"[a]" u8R"wxyzABCDEFGHIJKL[b]wxyzABCDEFGHIJKL"; ++const char s06[] = u8R";([a];(" "[b]"; ++const char s07[] = u8"[a]" R"[b]"; ++const char s08[] = u8R"[a]" R"_{}#()<>%:;.?*+-[b]_{}#()<>%:;.?*+-"; ++const char s09[] = u8R"/^&|~!=,"'\[a]/^&|~!=,"'\" u8"[b]"; ++const char s10[] = u8"[a]" u8R"0123456789abcdef[b]0123456789abcdef"; ++const char s11[] = u8R"ghijklmnopqrstuv[a]ghijklmnopqrstuv" u8R"w[b]w"; ++ ++const char16_t u03[] = R"-[a]-" u"[b]"; ++const char16_t u04[] = "[a]" uR"MNOPQRSTUVWXYZ[b]MNOPQRSTUVWXYZ"; ++const char16_t u05[] = R"[a]" uR"wxyzABCDEFGHIJKL[b]wxyzABCDEFGHIJKL"; ++const char16_t u06[] = uR";([a];(" "[b]"; ++const char16_t u07[] = u"[a]" R"[b]"; ++const char16_t u08[] = uR"[a]" R"_{}#()<>%:;.?*+-[b]_{}#()<>%:;.?*+-"; ++const char16_t u09[] = uR"/^&|~!=,"'\[a]/^&|~!=,"'\" u"[b]"; ++const char16_t u10[] = u"[a]" uR"0123456789abcdef[b]0123456789abcdef"; ++const char16_t u11[] = uR"ghijklmnopqrstuv[a]ghijklmnopqrstuv" uR"w[b]w"; ++ ++const char32_t U03[] = R"-[a]-" U"[b]"; ++const char32_t U04[] = "[a]" UR"MNOPQRSTUVWXYZ[b]MNOPQRSTUVWXYZ"; ++const char32_t U05[] = R"[a]" UR"wxyzABCDEFGHIJKL[b]wxyzABCDEFGHIJKL"; ++const char32_t U06[] = UR";([a];(" "[b]"; ++const char32_t U07[] = U"[a]" R"[b]"; ++const char32_t U08[] = UR"[a]" R"_{}#()<>%:;.?*+-[b]_{}#()<>%:;.?*+-"; ++const char32_t U09[] = UR"/^&|~!=,"'\[a]/^&|~!=,"'\" U"[b]"; ++const char32_t U10[] = U"[a]" UR"0123456789abcdef[b]0123456789abcdef"; ++const char32_t U11[] = UR"ghijklmnopqrstuv[a]ghijklmnopqrstuv" UR"w[b]w"; ++ ++const wchar_t L03[] = R"-[a]-" L"[b]"; ++const wchar_t L04[] = "[a]" LR"MNOPQRSTUVWXYZ[b]MNOPQRSTUVWXYZ"; ++const wchar_t L05[] = R"[a]" LR"wxyzABCDEFGHIJKL[b]wxyzABCDEFGHIJKL"; ++const wchar_t L06[] = LR";([a];(" "[b]"; ++const wchar_t L07[] = L"[a]" R"[b]"; ++const wchar_t L08[] = LR"[a]" R"_{}#()<>%:;.?*+-[b]_{}#()<>%:;.?*+-"; ++const wchar_t L09[] = LR"/^&|~!=,"'\[a]/^&|~!=,"'\" L"[b]"; ++const wchar_t L10[] = L"[a]" LR"0123456789abcdef[b]0123456789abcdef"; ++const wchar_t L11[] = LR"ghijklmnopqrstuv[a]ghijklmnopqrstuv" LR"w[b]w"; ++ ++int ++main (void) ++{ ++#define TEST(str, val) \ ++ if (sizeof (str) != sizeof (val) \ ++ || __builtin_memcmp (str, val, sizeof (str)) != 0) \ ++ __builtin_abort () ++ TEST (s00, "a[b]"); ++ TEST (s01, "[a]b"); ++ TEST (s02, "ab"); ++ TEST (s03, "a[b]"); ++ TEST (s04, "[a]b"); ++ TEST (s05, "ab"); ++ TEST (s06, "a[b]"); ++ TEST (s07, "[a]b"); ++ TEST (s08, "ab"); ++ TEST (s09, "a[b]"); ++ TEST (s10, "[a]b"); ++ TEST (s11, "ab"); ++ TEST (u03, u"a[b]"); ++ TEST (u04, u"[a]b"); ++ TEST (u05, u"ab"); ++ TEST (u06, u"a[b]"); ++ TEST (u07, u"[a]b"); ++ TEST (u08, u"ab"); ++ TEST (u09, u"a[b]"); ++ TEST (u10, u"[a]b"); ++ TEST (u11, u"ab"); ++ TEST (U03, U"a[b]"); ++ TEST (U04, U"[a]b"); ++ TEST (U05, U"ab"); ++ TEST (U06, U"a[b]"); ++ TEST (U07, U"[a]b"); ++ TEST (U08, U"ab"); ++ TEST (U09, U"a[b]"); ++ TEST (U10, U"[a]b"); ++ TEST (U11, U"ab"); ++ TEST (L03, L"a[b]"); ++ TEST (L04, L"[a]b"); ++ TEST (L05, L"ab"); ++ TEST (L06, L"a[b]"); ++ TEST (L07, L"[a]b"); ++ TEST (L08, L"ab"); ++ TEST (L09, L"a[b]"); ++ TEST (L10, L"[a]b"); ++ TEST (L11, L"ab"); ++ return 0; ++} +--- gcc/testsuite/g++.dg/ext/raw-string-3.C.jj 2008-09-12 13:27:09.000000000 +0200 ++++ gcc/testsuite/g++.dg/ext/raw-string-3.C 2008-09-12 14:17:57.000000000 +0200 +@@ -0,0 +1,58 @@ ++// If c++98, the {,u,u8,U,L}R prefix should be parsed as separate ++// token. ++// { dg-do compile } ++// { dg-options "-std=c++98" } ++ ++const void *s0 = R"[a]"; // { dg-error "was not declared" } ++ // { dg-error "expected ',' or ';'" "" { target *-*-* } 6 } ++const void *s1 = uR"[a]"; // { dg-error "was not declared" } ++ // { dg-error "expected ',' or ';'" "" { target *-*-* } 8 } ++const void *s2 = UR"[a]"; // { dg-error "was not declared" } ++ // { dg-error "expected ',' or ';'" "" { target *-*-* } 10 } ++const void *s3 = u8R"[a]"; // { dg-error "was not declared" } ++ // { dg-error "expected ',' or ';'" "" { target *-*-* } 12 } ++const void *s4 = LR"[a]"; // { dg-error "was not declared" } ++ // { dg-error "expected ',' or ';'" "" { target *-*-* } 14 } ++ ++const int i0 = R'a'; // { dg-error "was not declared" } ++ // { dg-error "expected ',' or ';'" "" { target *-*-* } 17 } ++const int i1 = uR'a'; // { dg-error "was not declared" } ++ // { dg-error "expected ',' or ';'" "" { target *-*-* } 19 } ++const int i2 = UR'a'; // { dg-error "was not declared" } ++ // { dg-error "expected ',' or ';'" "" { target *-*-* } 21 } ++const int i3 = u8R'a'; // { dg-error "was not declared" } ++ // { dg-error "expected ',' or ';'" "" { target *-*-* } 23 } ++const int i4 = LR'a'; // { dg-error "was not declared" } ++ // { dg-error "expected ',' or ';'" "" { target *-*-* } 25 } ++ ++#define R "a" ++#define uR "b" ++#define UR "c" ++#define u8R "d" ++#define LR "e" ++ ++const void *s5 = R"[a]"; ++const void *s6 = uR"[a]"; ++const void *s7 = UR"[a]"; ++const void *s8 = u8R"[a]"; ++const void *s9 = LR"[a]"; ++ ++#undef R ++#undef uR ++#undef UR ++#undef u8R ++#undef LR ++ ++#define R 1 + ++#define uR 2 + ++#define UR 3 + ++#define u8R 4 + ++#define LR 5 + ++ ++const int i5 = R'a'; ++const int i6 = uR'a'; ++const int i7 = UR'a'; ++const int i8 = u8R'a'; ++const int i9 = LR'a'; ++ ++int main () {} +--- gcc/testsuite/g++.dg/ext/raw-string-4.C.jj 2008-09-12 13:27:09.000000000 +0200 ++++ gcc/testsuite/g++.dg/ext/raw-string-4.C 2008-09-12 14:18:23.000000000 +0200 +@@ -0,0 +1,28 @@ ++// R is not applicable for character literals. ++// { dg-do compile } ++// { dg-options "-std=c++0x" } ++ ++const int i0 = R'a'; // { dg-error "was not declared" } ++ // { dg-error "expected ',' or ';'" "" { target *-*-* } 5 } ++const int i1 = uR'a'; // { dg-error "was not declared" } ++ // { dg-error "expected ',' or ';'" "" { target *-*-* } 7 } ++const int i2 = UR'a'; // { dg-error "was not declared" } ++ // { dg-error "expected ',' or ';'" "" { target *-*-* } 9 } ++const int i3 = u8R'a'; // { dg-error "was not declared" } ++ // { dg-error "expected ',' or ';'" "" { target *-*-* } 11 } ++const int i4 = LR'a'; // { dg-error "was not declared" } ++ // { dg-error "expected ',' or ';'" "" { target *-*-* } 13 } ++ ++#define R 1 + ++#define uR 2 + ++#define UR 3 + ++#define u8R 4 + ++#define LR 5 + ++ ++const int i5 = R'a'; ++const int i6 = uR'a'; ++const int i7 = UR'a'; ++const int i8 = u8R'a'; ++const int i9 = LR'a'; ++ ++int main () {} +--- gcc/testsuite/g++.dg/ext/raw-string-5.C.jj 2008-09-12 13:49:58.000000000 +0200 ++++ gcc/testsuite/g++.dg/ext/raw-string-5.C 2008-09-12 14:18:32.000000000 +0200 +@@ -0,0 +1,23 @@ ++// { dg-do compile } ++// { dg-options "-std=c++0x" } ++ ++const void *s0 = R"0123456789abcdefg[]0123456789abcdefg"; ++ // { dg-error "raw string delimiter longer" "" { target *-*-* } 4 } ++ // { dg-error "stray" "" { target *-*-* } 4 } ++const void *s1 = R" [] "; ++ // { dg-error "invalid character" "" { target *-*-* } 7 } ++ // { dg-error "stray" "" { target *-*-* } 7 } ++const void *s2 = R" [] "; ++ // { dg-error "invalid character" "" { target *-*-* } 10 } ++ // { dg-error "stray" "" { target *-*-* } 10 } ++const void *s3 = R"][]]"; ++ // { dg-error "invalid character" "" { target *-*-* } 13 } ++ // { dg-error "stray" "" { target *-*-* } 13 } ++const void *s4 = R"@[]@"; ++ // { dg-error "invalid character" "" { target *-*-* } 16 } ++ // { dg-error "stray" "" { target *-*-* } 16 } ++const void *s5 = R"$[]$"; ++ // { dg-error "invalid character" "" { target *-*-* } 19 } ++ // { dg-error "stray" "" { target *-*-* } 19 } ++ ++int main () {} +--- gcc/testsuite/g++.dg/ext/raw-string-6.C.jj 2008-09-12 13:59:33.000000000 +0200 ++++ gcc/testsuite/g++.dg/ext/raw-string-6.C 2008-09-12 14:20:21.000000000 +0200 +@@ -0,0 +1,5 @@ ++// { dg-do compile } ++// { dg-options "-std=c++0x" } ++ ++const void *s0 = R"ouch[]ouCh"; // { dg-error "at end of input" } ++ // { dg-error "unterminated raw string" "" { target *-*-* } 6 } +--- gcc/testsuite/g++.dg/ext/raw-string-7.C.jj 2008-09-12 14:34:54.000000000 +0200 ++++ gcc/testsuite/g++.dg/ext/raw-string-7.C 2008-09-12 14:36:40.000000000 +0200 +@@ -0,0 +1,23 @@ ++// The trailing whitespace after \ and before newline extension ++// breaks full compliance for raw strings. ++// { dg-do run { xfail *-*-* } } ++// { dg-options "-std=c++0x" } ++ ++// Note, there is a single space after \ on the following line. ++const char *s0 = R"[\ ++]"; ++// { dg-bogus "backslash and newline separated by space" "" { xfail *-*-* } 7 } ++ ++// Note, there is a single tab after \ on the following line. ++const char *s1 = R"[\ ++]"; ++// { dg-bogus "backslash and newline separated by space" "" { xfail *-*-* } 12 } ++ ++int ++main (void) ++{ ++ if (__builtin_strcmp (s0, "\\ \n") != 0 ++ || __builtin_strcmp (s1, "\\\t\n") != 0) ++ __builtin_abort (); ++ return 0; ++} +--- gcc/testsuite/g++.dg/ext/utf8-1.C.jj 2008-09-12 10:01:47.000000000 +0200 ++++ gcc/testsuite/g++.dg/ext/utf8-1.C 2008-09-12 14:18:53.000000000 +0200 +@@ -0,0 +1,45 @@ ++// { dg-do run } ++// { dg-require-iconv "ISO-8859-2" } ++// { dg-options "-std=c++0x -fexec-charset=ISO-8859-2" } ++ ++const char *str1 = "h\u00e1\U0000010Dky "; ++const char *str2 = "\u010d\u00E1rky\n"; ++const char *str3 = u8"h\u00e1\U0000010Dky "; ++const char *str4 = u8"\u010d\u00E1rky\n"; ++const char *str5 = "h\u00e1\U0000010Dky " "\u010d\u00E1rky\n"; ++const char *str6 = u8"h\u00e1\U0000010Dky " "\u010d\u00E1rky\n"; ++const char *str7 = "h\u00e1\U0000010Dky " u8"\u010d\u00E1rky\n"; ++#define u8 ++const char *str8 = u8"h\u00e1\U0000010Dky " u8"\u010d\u00E1rky\n"; ++ ++const char latin2_1[] = "\x68\xe1\xe8\x6b\x79\x20"; ++const char latin2_2[] = "\xe8\xe1\x72\x6b\x79\n"; ++const char utf8_1[] = "\x68\xc3\xa1\xc4\x8d\x6b\x79\x20"; ++const char utf8_2[] = "\xc4\x8d\xc3\xa1\x72\x6b\x79\n"; ++ ++int ++main (void) ++{ ++ if (__builtin_strcmp (str1, latin2_1) != 0 ++ || __builtin_strcmp (str2, latin2_2) != 0 ++ || __builtin_strcmp (str3, utf8_1) != 0 ++ || __builtin_strcmp (str4, utf8_2) != 0 ++ || __builtin_strncmp (str5, latin2_1, sizeof (latin2_1) - 1) != 0 ++ || __builtin_strcmp (str5 + sizeof (latin2_1) - 1, latin2_2) != 0 ++ || __builtin_strncmp (str6, utf8_1, sizeof (utf8_1) - 1) != 0 ++ || __builtin_strcmp (str6 + sizeof (utf8_1) - 1, utf8_2) != 0 ++ || __builtin_strncmp (str7, utf8_1, sizeof (utf8_1) - 1) != 0 ++ || __builtin_strcmp (str7 + sizeof (utf8_1) - 1, utf8_2) != 0 ++ || __builtin_strncmp (str8, utf8_1, sizeof (utf8_1) - 1) != 0 ++ || __builtin_strcmp (str8 + sizeof (utf8_1) - 1, utf8_2) != 0) ++ __builtin_abort (); ++ if (sizeof ("a" u8"b"[0]) != 1 ++ || sizeof (u8"a" "b"[0]) != 1 ++ || sizeof (u8"a" u8"b"[0]) != 1 ++ || sizeof ("a" "\u010d") != 3 ++ || sizeof ("a" u8"\u010d") != 4 ++ || sizeof (u8"a" "\u010d") != 4 ++ || sizeof (u8"a" "\u010d") != 4) ++ __builtin_abort (); ++ return 0; ++} +--- gcc/testsuite/g++.dg/ext/utf8-2.C.jj 2008-09-12 11:27:51.000000000 +0200 ++++ gcc/testsuite/g++.dg/ext/utf8-2.C 2008-09-12 14:19:01.000000000 +0200 +@@ -0,0 +1,21 @@ ++// { dg-do compile } ++// { dg-options "-std=c++0x" } ++ ++const char s0[] = u8"ab"; ++const char16_t s1[] = u8"ab"; // { dg-error "from non-wide" } ++const char32_t s2[] = u8"ab"; // { dg-error "from non-wide" } ++const wchar_t s3[] = u8"ab"; // { dg-error "from non-wide" } ++ ++const char t0[0] = u8"ab"; // { dg-error "chars is too long" } ++const char t1[1] = u8"ab"; // { dg-error "chars is too long" } ++const char t2[2] = u8"ab"; // { dg-error "chars is too long" } ++const char t3[3] = u8"ab"; ++const char t4[4] = u8"ab"; ++ ++const char u0[0] = u8"\u2160."; // { dg-error "chars is too long" } ++const char u1[1] = u8"\u2160."; // { dg-error "chars is too long" } ++const char u2[2] = u8"\u2160."; // { dg-error "chars is too long" } ++const char u3[3] = u8"\u2160."; // { dg-error "chars is too long" } ++const char u4[4] = u8"\u2160."; // { dg-error "chars is too long" } ++const char u5[5] = u8"\u2160."; ++const char u6[6] = u8"\u2160."; +--- gcc/testsuite/g++.dg/ext/utf-badconcat2.C.jj 2008-09-12 11:28:26.000000000 +0200 ++++ gcc/testsuite/g++.dg/ext/utf-badconcat2.C 2008-09-12 14:19:17.000000000 +0200 +@@ -0,0 +1,15 @@ ++// Test unsupported concatenation of UTF-8 string literals. ++// { dg-do compile } ++// { dg-options "-std=c++0x" } ++ ++const void *s0 = u8"a" "b"; ++const void *s1 = "a" u8"b"; ++const void *s2 = u8"a" u8"b"; ++const void *s3 = u8"a" u"b"; // { dg-error "non-standard concatenation" } ++const void *s4 = u"a" u8"b"; // { dg-error "non-standard concatenation" } ++const void *s5 = u8"a" U"b"; // { dg-error "non-standard concatenation" } ++const void *s6 = U"a" u8"b"; // { dg-error "non-standard concatenation" } ++const void *s7 = u8"a" L"b"; // { dg-error "non-standard concatenation" } ++const void *s8 = L"a" u8"b"; // { dg-error "non-standard concatenation" } ++ ++int main () {} +--- gcc/testsuite/g++.dg/ext/utf-dflt2.C.jj 2008-09-12 11:32:03.000000000 +0200 ++++ gcc/testsuite/g++.dg/ext/utf-dflt2.C 2008-09-12 14:19:28.000000000 +0200 +@@ -0,0 +1,12 @@ ++// In C++0x, the u8 prefix should be parsed as separate tokens. ++// { dg-do compile } ++// { dg-options "-std=c++98" } ++ ++const void *s0 = u8"a"; // { dg-error "was not declared" } ++ // { dg-error "expected ',' or ';'" "" { target *-*-* } 5 } ++ ++#define u8 "a" ++ ++const void *s1 = u8"a"; ++ ++int main () {} diff --git a/gcc44-rh330771.patch b/gcc44-rh330771.patch new file mode 100644 index 0000000..f52b919 --- /dev/null +++ b/gcc44-rh330771.patch @@ -0,0 +1,34 @@ +2007-10-16 Jakub Jelinek + + * Makefile.am (libgcj_tools_la_LIBADD): Add. + * Makefile.in: Regenerated. + +--- libjava/Makefile.am.jj 2007-03-17 09:20:30.000000000 +0100 ++++ libjava/Makefile.am 2007-10-16 15:45:14.000000000 +0200 +@@ -277,6 +277,8 @@ EXTRA_libgcj_la_SOURCES = java/lang/Obje + + libgcj_tools_la_SOURCES = classpath/tools/tools.zip + libgcj_tools_la_GCJFLAGS = $(AM_GCJFLAGS) -findirect-dispatch -fno-indirect-classes -fsource-filename=$(here)/classpath/tools/all-classes.lst ++## See jv_convert_LDADD. ++libgcj_tools_la_LIBADD = -L$(here)/.libs libgcj.la + libgcj_tools_la_LDFLAGS = -rpath $(toolexeclibdir) \ + -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ + $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) +--- libjava/Makefile.in.jj 2007-07-04 21:11:11.000000000 +0200 ++++ libjava/Makefile.in 2007-10-16 15:56:07.000000000 +0200 +@@ -153,7 +153,6 @@ am__objects_1 = gnu/gcj/xlib/lib_gnu_awt + am_lib_gnu_awt_xlib_la_OBJECTS = $(am__objects_1) + lib_gnu_awt_xlib_la_OBJECTS = $(am_lib_gnu_awt_xlib_la_OBJECTS) + @XLIB_AWT_TRUE@am_lib_gnu_awt_xlib_la_rpath = -rpath $(toolexeclibdir) +-libgcj_tools_la_LIBADD = + am_libgcj_tools_la_OBJECTS = classpath/tools/libgcj_tools_la-tools.lo + libgcj_tools_la_OBJECTS = $(am_libgcj_tools_la_OBJECTS) + @INTERPRETER_TRUE@am__DEPENDENCIES_1 = gnu/classpath/jdwp.lo \ +@@ -941,6 +940,7 @@ libgcj_la_LINK = $(LIBLINK) + EXTRA_libgcj_la_SOURCES = java/lang/Object.java + libgcj_tools_la_SOURCES = classpath/tools/tools.zip + libgcj_tools_la_GCJFLAGS = $(AM_GCJFLAGS) -findirect-dispatch -fno-indirect-classes -fsource-filename=$(here)/classpath/tools/all-classes.lst ++libgcj_tools_la_LIBADD = -L$(here)/.libs libgcj.la + libgcj_tools_la_LDFLAGS = -rpath $(toolexeclibdir) \ + -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ + $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) diff --git a/gcc44-rh341221.patch b/gcc44-rh341221.patch new file mode 100644 index 0000000..1f5ff91 --- /dev/null +++ b/gcc44-rh341221.patch @@ -0,0 +1,28 @@ +2007-10-21 Jakub Jelinek + + * doc/Makefile.am (POD2MAN): Set date from cp-tools.texinfo + timestamp rather than from current date. + * doc/Makefile.in: Regenerated. + +--- libjava/classpath/doc/Makefile.am.jj 2007-12-07 17:55:00.000000000 +0100 ++++ libjava/classpath/doc/Makefile.am 2007-12-07 18:55:28.000000000 +0100 +@@ -31,7 +31,7 @@ TOOLS_MANFILES = \ + gtnameserv.1 \ + gjdoc.1 + +-POD2MAN = pod2man --center="GNU" --release="$(VERSION)" ++POD2MAN = pod2man --center="GNU" --release="$(VERSION)" --date="$(shell ls --time-style=+%F -l $(srcdir)/cp-tools.texinfo | awk '{print $$6}')" + TEXI2POD = perl $(srcdir)/texi2pod.pl + STAMP = echo timestamp > + +--- libjava/classpath/doc/Makefile.in.jj 2007-12-07 17:55:00.000000000 +0100 ++++ libjava/classpath/doc/Makefile.in 2007-12-07 18:55:43.000000000 +0100 +@@ -382,7 +382,7 @@ TOOLS_MANFILES = \ + gtnameserv.1 \ + gjdoc.1 + +-POD2MAN = pod2man --center="GNU" --release="$(VERSION)" ++POD2MAN = pod2man --center="GNU" --release="$(VERSION)" --date="$(shell ls --time-style=+%F -l $(srcdir)/cp-tools.texinfo | awk '{print $$6}')" + TEXI2POD = perl $(srcdir)/texi2pod.pl + STAMP = echo timestamp > + @GENINSRC_FALSE@STAMP_GENINSRC = diff --git a/gcc44-sparc-config-detection.patch b/gcc44-sparc-config-detection.patch new file mode 100644 index 0000000..cc3cb41 --- /dev/null +++ b/gcc44-sparc-config-detection.patch @@ -0,0 +1,40 @@ +--- gcc/config.gcc.jj 2008-04-24 15:42:46.000000000 -0500 ++++ gcc/config.gcc 2008-04-24 15:44:51.000000000 -0500 +@@ -2175,7 +2175,7 @@ sparc-*-elf*) + tmake_file="sparc/t-elf sparc/t-crtfm" + extra_parts="crti.o crtn.o crtbegin.o crtend.o" + ;; +-sparc-*-linux*) # SPARC's running GNU/Linux, libc6 ++sparc-*-linux* | sparcv9*-*-linux*) # SPARC's running GNU/Linux, libc6 + tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h linux.h" + extra_options="${extra_options} sparc/long-double-switch.opt" + tmake_file="${tmake_file} sparc/t-linux" +@@ -2287,7 +2287,7 @@ sparc64-*-freebsd*|ultrasparc-*-freebsd* + *) echo "$with_cpu not supported for freebsd target"; exit 1 ;; + esac + ;; +-sparc64-*-linux*) # 64-bit SPARC's running GNU/Linux ++sparc64*-*-linux*) # 64-bit SPARC's running GNU/Linux + tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h linux.h sparc/linux64.h" + extra_options="${extra_options} sparc/long-double-switch.opt" + tmake_file="${tmake_file} sparc/t-linux sparc/t-linux64 sparc/t-crtfm" +--- libgcc/config.host.jj 2008-04-24 15:46:19.000000000 -0500 ++++ libgcc/config.host 2008-04-24 15:46:49.000000000 -0500 +@@ -572,7 +572,7 @@ sparc64-*-openbsd*) + ;; + sparc-*-elf*) + ;; +-sparc-*-linux*) # SPARC's running GNU/Linux, libc6 ++sparc-*-linux* | sparcv9*-*-linux*) # SPARC's running GNU/Linux, libc6 + extra_parts="$extra_parts crtfastmath.o" + tmake_file="${tmake_file} sparc/t-crtfm" + ;; +@@ -590,7 +590,7 @@ sparc-wrs-vxworks) + ;; + sparc64-*-freebsd*|ultrasparc-*-freebsd*) + ;; +-sparc64-*-linux*) # 64-bit SPARC's running GNU/Linux ++sparc64*-*-linux*) # 64-bit SPARC's running GNU/Linux + extra_parts="$extra_parts crtfastmath.o" + tmake_file="${tmake_file} sparc/t-crtfm" + ;; diff --git a/libgcc_post_upgrade.c b/libgcc_post_upgrade.c new file mode 100644 index 0000000..9fcb138 --- /dev/null +++ b/libgcc_post_upgrade.c @@ -0,0 +1,483 @@ +#ifdef __sparc__ +register void *__thread_self __asm ("g7"); +#endif +#include +#include +#include + +#if defined __i386__ +# define INTERNAL_SYSCALL_DECL(err) do { } while (0) +# define INTERNAL_SYSCALL(name, err, nr, args...) \ + ({ \ + register unsigned int resultvar; \ + asm volatile ( \ + "movl %1, %%eax\n\t" \ + "int $0x80\n\t" \ + : "=a" (resultvar) \ + : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc"); \ + (int) resultvar; }) +# define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned int) (val) >= 0xfffff001u) +# define ASMFMT_0() +# define ASMFMT_1(arg1) \ + , "b" (arg1) +# define ASMFMT_2(arg1, arg2) \ + , "b" (arg1), "c" (arg2) +# define ASMFMT_3(arg1, arg2, arg3) \ + , "b" (arg1), "c" (arg2), "d" (arg3) +#elif defined __x86_64__ +# define INTERNAL_SYSCALL_DECL(err) do { } while (0) +# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ + ({ \ + unsigned long resultvar; \ + LOAD_ARGS_##nr (args) \ + LOAD_REGS_##nr \ + asm volatile ( \ + "syscall\n\t" \ + : "=a" (resultvar) \ + : "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx"); \ + (long) resultvar; }) +# define INTERNAL_SYSCALL(name, err, nr, args...) \ + INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) +# define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned long) (val) >= -4095L) +# define LOAD_ARGS_0() +# define LOAD_REGS_0 +# define ASM_ARGS_0 +# define LOAD_ARGS_1(a1) \ + long int __arg1 = (long) (a1); \ + LOAD_ARGS_0 () +# define LOAD_REGS_1 \ + register long int _a1 asm ("rdi") = __arg1; \ + LOAD_REGS_0 +# define ASM_ARGS_1 ASM_ARGS_0, "r" (_a1) +# define LOAD_ARGS_2(a1, a2) \ + long int __arg2 = (long) (a2); \ + LOAD_ARGS_1 (a1) +# define LOAD_REGS_2 \ + register long int _a2 asm ("rsi") = __arg2; \ + LOAD_REGS_1 +# define ASM_ARGS_2 ASM_ARGS_1, "r" (_a2) +# define LOAD_ARGS_3(a1, a2, a3) \ + long int __arg3 = (long) (a3); \ + LOAD_ARGS_2 (a1, a2) +# define LOAD_REGS_3 \ + register long int _a3 asm ("rdx") = __arg3; \ + LOAD_REGS_2 +# define ASM_ARGS_3 ASM_ARGS_2, "r" (_a3) +#elif defined __powerpc__ +# define INTERNAL_SYSCALL_DECL(err) long int err +# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ + ({ \ + register long int r0 __asm__ ("r0"); \ + register long int r3 __asm__ ("r3"); \ + register long int r4 __asm__ ("r4"); \ + register long int r5 __asm__ ("r5"); \ + register long int r6 __asm__ ("r6"); \ + register long int r7 __asm__ ("r7"); \ + register long int r8 __asm__ ("r8"); \ + LOADARGS_##nr(name, args); \ + __asm__ __volatile__ \ + ("sc\n\t" \ + "mfcr %0\n\t" \ + : "=&r" (r0), \ + "=&r" (r3), "=&r" (r4), "=&r" (r5), \ + "=&r" (r6), "=&r" (r7), "=&r" (r8) \ + : ASM_INPUT_##nr \ + : "r9", "r10", "r11", "r12", \ + "cr0", "ctr", "memory"); \ + err = r0; \ + (int) r3; \ + }) +# define INTERNAL_SYSCALL(name, err, nr, args...) \ + INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) +# define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((void) (val), __builtin_expect ((err) & (1 << 28), 0)) +# define LOADARGS_0(name, dummy) \ + r0 = name +# define LOADARGS_1(name, __arg1) \ + long int arg1 = (long int) (__arg1); \ + LOADARGS_0(name, 0); \ + r3 = arg1 +# define LOADARGS_2(name, __arg1, __arg2) \ + long int arg2 = (long int) (__arg2); \ + LOADARGS_1(name, __arg1); \ + r4 = arg2 +# define LOADARGS_3(name, __arg1, __arg2, __arg3) \ + long int arg3 = (long int) (__arg3); \ + LOADARGS_2(name, __arg1, __arg2); \ + r5 = arg3 +# define ASM_INPUT_0 "0" (r0) +# define ASM_INPUT_1 ASM_INPUT_0, "1" (r3) +# define ASM_INPUT_2 ASM_INPUT_1, "2" (r4) +# define ASM_INPUT_3 ASM_INPUT_2, "3" (r5) +#elif defined __ia64__ +# define DO_INLINE_SYSCALL_NCS(name, nr, args...) \ + LOAD_ARGS_##nr (args) \ + register long _r8 asm ("r8"); \ + register long _r10 asm ("r10"); \ + register long _r15 asm ("r15") = name; \ + long _retval; \ + LOAD_REGS_##nr \ + __asm __volatile ("break 0x100000;;" \ + : "=r" (_r8), "=r" (_r10), "=r" (_r15) \ + ASM_OUTARGS_##nr \ + : "2" (_r15) ASM_ARGS_##nr \ + : "memory" ASM_CLOBBERS_##nr); \ + _retval = _r8; +# define INTERNAL_SYSCALL_DECL(err) long int err +# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ + ({ \ + DO_INLINE_SYSCALL_NCS (name, nr, args) \ + err = _r10; \ + _retval; }) +# define INTERNAL_SYSCALL(name, err, nr, args...) \ + INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) +# define INTERNAL_SYSCALL_ERROR_P(val, err) (err == -1) +# define LOAD_ARGS_0() +# define LOAD_REGS_0 +# define LOAD_ARGS_1(a1) \ + long _arg1 = (long) (a1); \ + LOAD_ARGS_0 () +# define LOAD_REGS_1 \ + register long _out0 asm ("out0") = _arg1; \ + LOAD_REGS_0 +# define LOAD_ARGS_2(a1, a2) \ + long _arg2 = (long) (a2); \ + LOAD_ARGS_1 (a1) +# define LOAD_REGS_2 \ + register long _out1 asm ("out1") = _arg2; \ + LOAD_REGS_1 +# define LOAD_ARGS_3(a1, a2, a3) \ + long _arg3 = (long) (a3); \ + LOAD_ARGS_2 (a1, a2) +# define LOAD_REGS_3 \ + register long _out2 asm ("out2") = _arg3; \ + LOAD_REGS_2 +# define ASM_OUTARGS_0 +# define ASM_OUTARGS_1 ASM_OUTARGS_0, "=r" (_out0) +# define ASM_OUTARGS_2 ASM_OUTARGS_1, "=r" (_out1) +# define ASM_OUTARGS_3 ASM_OUTARGS_2, "=r" (_out2) +# define ASM_ARGS_0 +# define ASM_ARGS_1 ASM_ARGS_0, "3" (_out0) +# define ASM_ARGS_2 ASM_ARGS_1, "4" (_out1) +# define ASM_ARGS_3 ASM_ARGS_2, "5" (_out2) +# define ASM_CLOBBERS_0 ASM_CLOBBERS_1, "out0" +# define ASM_CLOBBERS_1 ASM_CLOBBERS_2, "out1" +# define ASM_CLOBBERS_2 ASM_CLOBBERS_3, "out2" +# define ASM_CLOBBERS_3 ASM_CLOBBERS_4, "out3" +# define ASM_CLOBBERS_4 ASM_CLOBBERS_5, "out4" +# define ASM_CLOBBERS_5 ASM_CLOBBERS_6, "out5" +# define ASM_CLOBBERS_6_COMMON , "out6", "out7", \ + /* Non-stacked integer registers, minus r8, r10, r15. */ \ + "r2", "r3", "r9", "r11", "r12", "r13", "r14", "r16", "r17", "r18", \ + "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", \ + "r28", "r29", "r30", "r31", \ + /* Predicate registers. */ \ + "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", \ + /* Non-rotating fp registers. */ \ + "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ + /* Branch registers. */ \ + "b6" +# define ASM_CLOBBERS_6 ASM_CLOBBERS_6_COMMON , "b7" +#elif defined __s390__ +# define INTERNAL_SYSCALL_DECL(err) do { } while (0) +# define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + register long _ret asm("2"); \ + asm volatile ( \ + "svc %b1\n\t" \ + : "=d" (_ret) \ + : "i" (__NR_##name) ASMFMT_##nr \ + : "memory" ); \ + _ret; }) +# define INTERNAL_SYSCALL_SVC0(name, err, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + register unsigned long _nr asm("1") = (unsigned long)(__NR_##name); \ + register long _ret asm("2"); \ + asm volatile ( \ + "svc 0\n\t" \ + : "=d" (_ret) \ + : "d" (_nr) ASMFMT_##nr \ + : "memory" ); \ + _ret; }) +# define INTERNAL_SYSCALL(name, err, nr, args...) \ + (((__NR_##name) < 256) ? \ + INTERNAL_SYSCALL_DIRECT(name, err, nr, args) : \ + INTERNAL_SYSCALL_SVC0(name, err,nr, args)) +# define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned long) (val) >= -4095UL) +# define DECLARGS_0() +# define DECLARGS_1(arg1) \ + register unsigned long gpr2 asm ("2") = (unsigned long)(arg1); +# define DECLARGS_2(arg1, arg2) \ + DECLARGS_1(arg1) \ + register unsigned long gpr3 asm ("3") = (unsigned long)(arg2); +# define DECLARGS_3(arg1, arg2, arg3) \ + DECLARGS_2(arg1, arg2) \ + register unsigned long gpr4 asm ("4") = (unsigned long)(arg3); +# define ASMFMT_0 +# define ASMFMT_1 , "0" (gpr2) +# define ASMFMT_2 , "0" (gpr2), "d" (gpr3) +# define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4) +#elif defined __sparc__ +# ifndef __arch64__ +# define __INTERNAL_SYSCALL_STRING \ + "ta 0x10;" \ + "bcs,a 1f;" \ + " sub %%g0, %%o0, %%o0;" \ + "1:" +# define __SYSCALL_CLOBBERS "g2", "g3", "g4", "g5", "g6", \ + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ + "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ + "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \ + "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \ + "cc", "memory" +# else +# define __INTERNAL_SYSCALL_STRING \ + "ta 0x6d;" \ + "bcs,a,pt %%xcc, 1f;" \ + " sub %%g0, %%o0, %%o0;" \ + "1:" +# define __SYSCALL_CLOBBERS "g2", "g3", "g4", "g5", "g6", \ + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ + "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ + "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \ + "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \ + "f32", "f34", "f36", "f38", "f40", "f42", "f44", "f46", \ + "f48", "f50", "f52", "f54", "f56", "f58", "f60", "f62", \ + "cc", "memory" +# endif +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) +#define INTERNAL_SYSCALL(name, err, nr, args...) \ + inline_syscall##nr(__INTERNAL_SYSCALL_STRING, __NR_##name, args) +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned long) (val) >= -515L) +# define inline_syscall0(string,name,dummy...) \ +({ \ + register long __o0 __asm__ ("o0"); \ + register long __g1 __asm__ ("g1") = name; \ + __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ + "0" (__g1) : \ + __SYSCALL_CLOBBERS); \ + __o0; \ +}) +# define inline_syscall1(string,name,arg1) \ +({ \ + register long __o0 __asm__ ("o0") = (long)(arg1); \ + register long __g1 __asm__ ("g1") = name; \ + __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ + "0" (__g1), "1" (__o0) : \ + __SYSCALL_CLOBBERS); \ + __o0; \ +}) +# define inline_syscall2(string,name,arg1,arg2) \ +({ \ + register long __o0 __asm__ ("o0") = (long)(arg1); \ + register long __o1 __asm__ ("o1") = (long)(arg2); \ + register long __g1 __asm__ ("g1") = name; \ + __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ + "0" (__g1), "1" (__o0), "r" (__o1) : \ + __SYSCALL_CLOBBERS); \ + __o0; \ +}) +# define inline_syscall3(string,name,arg1,arg2,arg3) \ +({ \ + register long __o0 __asm__ ("o0") = (long)(arg1); \ + register long __o1 __asm__ ("o1") = (long)(arg2); \ + register long __o2 __asm__ ("o2") = (long)(arg3); \ + register long __g1 __asm__ ("g1") = name; \ + __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ + "0" (__g1), "1" (__o0), "r" (__o1), \ + "r" (__o2) : \ + __SYSCALL_CLOBBERS); \ + __o0; \ +}) +#elif defined __alpha__ +# define INTERNAL_SYSCALL(name, err_out, nr, args...) \ + INTERNAL_SYSCALL1(name, err_out, nr, args) +# define INTERNAL_SYSCALL1(name, err_out, nr, args...) \ + INTERNAL_SYSCALL_NCS(__NR_##name, err_out, nr, args) +# define INTERNAL_SYSCALL_NCS(name, err_out, nr, args...) \ +({ \ + long _sc_ret, _sc_err; \ + inline_syscall##nr(name, args); \ + err_out = _sc_err; \ + _sc_ret; \ +}) +# define INTERNAL_SYSCALL_DECL(err) long int err +# define INTERNAL_SYSCALL_ERROR_P(val, err) err +# define inline_syscall_clobbers \ + "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \ + "$22", "$23", "$24", "$25", "$27", "$28", "memory" +# define inline_syscall_r0_asm +# define inline_syscall_r0_out_constraint "=v" +# define inline_syscall0(name, args...) \ +{ \ + register long _sc_0 inline_syscall_r0_asm; \ + register long _sc_19 __asm__("$19"); \ + \ + _sc_0 = name; \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2" \ + : inline_syscall_r0_out_constraint (_sc_0), \ + "=r"(_sc_19) \ + : "0"(_sc_0) \ + : inline_syscall_clobbers, \ + "$16", "$17", "$18", "$20", "$21"); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ +} +# define inline_syscall1(name,arg1) \ +{ \ + register long _sc_0 inline_syscall_r0_asm; \ + register long _sc_16 __asm__("$16"); \ + register long _sc_19 __asm__("$19"); \ + \ + _sc_0 = name; \ + _sc_16 = (long) (arg1); \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3" \ + : inline_syscall_r0_out_constraint (_sc_0), \ + "=r"(_sc_19), "=r"(_sc_16) \ + : "0"(_sc_0), "2"(_sc_16) \ + : inline_syscall_clobbers, \ + "$17", "$18", "$20", "$21"); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ +} +# define inline_syscall2(name,arg1,arg2) \ +{ \ + register long _sc_0 inline_syscall_r0_asm; \ + register long _sc_16 __asm__("$16"); \ + register long _sc_17 __asm__("$17"); \ + register long _sc_19 __asm__("$19"); \ + \ + _sc_0 = name; \ + _sc_16 = (long) (arg1); \ + _sc_17 = (long) (arg2); \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4" \ + : inline_syscall_r0_out_constraint (_sc_0), \ + "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17) \ + : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17) \ + : inline_syscall_clobbers, \ + "$18", "$20", "$21"); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ +} +# define inline_syscall3(name,arg1,arg2,arg3) \ +{ \ + register long _sc_0 inline_syscall_r0_asm; \ + register long _sc_16 __asm__("$16"); \ + register long _sc_17 __asm__("$17"); \ + register long _sc_18 __asm__("$18"); \ + register long _sc_19 __asm__("$19"); \ + \ + _sc_0 = name; \ + _sc_16 = (long) (arg1); \ + _sc_17 = (long) (arg2); \ + _sc_18 = (long) (arg3); \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4 %5" \ + : inline_syscall_r0_out_constraint (_sc_0), \ + "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17), \ + "=r"(_sc_18) \ + : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), \ + "4"(_sc_18) \ + : inline_syscall_clobbers, "$20", "$21"); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ +} +#elif defined __arm__ && defined __ARM_EABI__ +# define INTERNAL_SYSCALL_DECL(err) do { } while (0) +# define INTERNAL_SYSCALL(name, err, nr, args...) \ + ({ \ + register int _r0 __asm__("r0"); \ + register int _nr __asm__("r7"); \ + LOAD_ARGS_##nr(args) \ + _nr = __NR_##name; \ + asm volatile ("swi\t0\t@ syscall " #name "\n\t" \ + : "=r" (_r0) \ + : "r" (_nr) ASM_ARGS_##nr \ + : "memory"); \ + _r0; }) +# define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned int) (val) >= 0xfffff001u) +# define ASM_ARGS_0 +# define ASM_ARGS_1 , "r" (_r0) +# define ASM_ARGS_2 , "r" (_r0), "r" (_r1) +# define ASM_ARGS_3 , "r" (_r0), "r" (_r1), "r" (_r2) +# define LOAD_ARGS_0() +# define LOAD_ARGS_1(r0) \ + _r0 = (int)r0; +# define LOAD_ARGS_2(r0, r1) \ + _r0 = (int)r0; \ + register int _r1 __asm__("r1") = (int)r1; +# define LOAD_ARGS_3(r0, r1, r2) \ + _r0 = (int)r0; \ + register int _r1 __asm__("r1") = (int)r1; \ + register int _r2 __asm__("r2") = (int)r2; +#endif + +int main (int argc, char **argv) +{ + const char *arg[] = { "/sbin/ldconfig", 0 }; + long ret; + INTERNAL_SYSCALL_DECL (err); + ret = INTERNAL_SYSCALL (access, err, 2, arg[0], X_OK); + if (INTERNAL_SYSCALL_ERROR_P (ret, err)) + INTERNAL_SYSCALL (exit, err, 1, 0); + INTERNAL_SYSCALL (execve, err, 3, arg[0], arg, &argv[argc + 1]); + INTERNAL_SYSCALL (exit, err, 1, 110); + return 110; +} + +int __libc_multiple_threads __attribute__((nocommon)); +int __libc_enable_asynccancel (void) { return 0; } +void __libc_disable_asynccancel (int x) { } +void __libc_csu_init (void) { } +void __libc_csu_fini (void) { } +pid_t __fork (void) { return -1; } +char thr_buf[65536]; + +#ifndef __powerpc__ +int __libc_start_main (int (*main) (int argc, char **argv), + int argc, char **argv, + void (*init) (void), void (*fini) (void), + void (*rtld_fini) (void), void * stack_end) +#else +struct startup_info +{ + void *sda_base; + int (*main) (int, char **, char **, void *); + int (*init) (int, char **, char **, void *); + void (*fini) (void); +}; + +int __libc_start_main (int argc, char **argv, char **ev, + void *auxvec, void (*rtld_fini) (void), + struct startup_info *stinfo, + char **stack_on_entry) +#endif +{ +#if defined __ia64__ || defined __powerpc64__ + register void *r13 __asm ("r13") = thr_buf + 32768; + __asm ("" : : "r" (r13)); +#elif defined __sparc__ + register void *g6 __asm ("g6") = thr_buf + 32768; + __thread_self = thr_buf + 32768; + __asm ("" : : "r" (g6), "r" (__thread_self)); +#elif defined __s390__ && !defined __s390x__ + __asm ("sar %%a0,%0" : : "d" (thr_buf + 32768)); +#elif defined __s390x__ + __asm ("sar %%a1,%0; srlg 0,%0,32; sar %%a0,0" : : "d" (thr_buf + 32768) : "0"); +#elif defined __powerpc__ && !defined __powerpc64__ + register void *r2 __asm ("r2") = thr_buf + 32768; + __asm ("" : : "r" (r2)); +#endif +#ifdef __powerpc__ + argc = (long)*stack_on_entry; + argv = stack_on_entry + 1; +#endif + main (argc, argv); + return 110; +} diff --git a/mingw32-gcc-build.patch b/mingw32-gcc-build.patch deleted file mode 100644 index 5ef4de1..0000000 --- a/mingw32-gcc-build.patch +++ /dev/null @@ -1,54 +0,0 @@ -diff -rup mingw-gcc-4.3.2.orig/gcc-4.3.2/gcc/toplev.c mingw-gcc-4.3.2.new/gcc-4.3.2/gcc/toplev.c ---- mingw-gcc-4.3.2.orig/gcc-4.3.2/gcc/toplev.c 2008-04-24 13:59:01.000000000 -0400 -+++ mingw-gcc-4.3.2.new/gcc-4.3.2/gcc/toplev.c 2008-09-02 07:31:12.000000000 -0400 -@@ -536,7 +536,7 @@ read_integral_parameter (const char *p, - for floor_log2 and exact_log2; see toplev.h. That construct, however, - conflicts with the ISO C++ One Definition Rule. */ - --#if GCC_VERSION < 3004 || !defined (__cplusplus) -+#if GCC_VERSION < 3004 - - /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X. - If X is 0, return -1. */ -diff -rup mingw-gcc-4.3.2.orig/gcc-4.3.2/gcc/toplev.h mingw-gcc-4.3.2.new/gcc-4.3.2/gcc/toplev.h ---- mingw-gcc-4.3.2.orig/gcc-4.3.2/gcc/toplev.h 2007-09-23 15:18:27.000000000 -0400 -+++ mingw-gcc-4.3.2.new/gcc-4.3.2/gcc/toplev.h 2008-09-03 07:08:46.000000000 -0400 -@@ -154,12 +154,6 @@ extern void decode_d_option (const char - /* Return true iff flags are set as if -ffast-math. */ - extern bool fast_math_flags_set_p (void); - --/* Return log2, or -1 if not exact. */ --extern int exact_log2 (unsigned HOST_WIDE_INT); -- --/* Return floor of log2, with -1 for zero. */ --extern int floor_log2 (unsigned HOST_WIDE_INT); -- - /* Inline versions of the above for speed. */ - #if GCC_VERSION >= 3004 - # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG -@@ -173,17 +167,23 @@ extern int floor_log2 ( - # define CTZ_HWI __builtin_ctz - # endif - --extern inline int -+static inline int - floor_log2 (unsigned HOST_WIDE_INT x) - { - return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1; - } - --extern inline int -+static inline int - exact_log2 (unsigned HOST_WIDE_INT x) - { - return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1; - } -+#else -+/* Return log2, or -1 if not exact. */ -+extern int exact_log2 (unsigned HOST_WIDE_INT); -+ -+/* Return floor of log2, with -1 for zero. */ -+extern int floor_log2 (unsigned HOST_WIDE_INT); - #endif /* GCC_VERSION >= 3004 */ - - /* Functions used to get and set GCC's notion of in what directory diff --git a/mingw32-gcc.spec b/mingw32-gcc.spec index 2c77300..d13c504 100644 --- a/mingw32-gcc.spec +++ b/mingw32-gcc.spec @@ -1,43 +1,77 @@ %define __os_install_post /usr/lib/rpm/brp-compress %{nil} +%define DATE 20090216 +%define SVNREV 144214 + Name: mingw32-gcc -Version: 4.3.2 -Release: 12%{?dist} +Version: 4.4.0 +Release: 0.4%{?dist} Summary: MinGW Windows cross-compiler (GCC) for C -License: GPLv2+ +License: GPLv3+ and GPLv2+ with exceptions Group: Development/Languages -URL: http://www.mingw.org/ -Source0: ftp://ftp.gnu.org/gnu/gcc/gcc-%{version}/gcc-core-%{version}.tar.bz2 -Source1: ftp://ftp.gnu.org/gnu/gcc/gcc-%{version}/gcc-g++-%{version}.tar.bz2 -Patch1: %{name}-build.patch + +# We use the same source as Fedora's native gcc. +URL: http://gcc.gnu.org +Source0: gcc-%{version}-%{DATE}.tar.bz2 +Source1: libgcc_post_upgrade.c +Source2: README.libgcjwebplugin.so +Source3: protoize.1 +Source5: ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-ppl-0.15.tar.gz + +# Patches from Fedora's native gcc. +Patch0: gcc44-hack.patch +Patch1: gcc44-build-id.patch +Patch2: gcc44-c++-builtin-redecl.patch +Patch3: gcc44-ia64-libunwind.patch +Patch4: gcc44-java-nomulti.patch +Patch5: gcc44-ppc32-retaddr.patch +Patch7: gcc44-pr27898.patch +Patch8: gcc44-pr32139.patch +Patch9: gcc44-pr33763.patch +Patch10: gcc44-rh330771.patch +Patch11: gcc44-rh341221.patch +Patch12: gcc44-java-debug-iface-type.patch +Patch13: gcc44-i386-libgomp.patch +Patch15: gcc44-sparc-config-detection.patch +Patch16: gcc44-libgomp-omp_h-multilib.patch +Patch20: gcc44-libtool-no-rpath.patch +Patch21: gcc44-cloog-dl.patch +Patch22: gcc44-raw-string.patch +Patch23: gcc44-pr39175.patch +Patch24: gcc44-diff.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: texinfo -BuildRequires: mingw32-filesystem >= 39-3 +BuildRequires: mingw32-filesystem >= 49 BuildRequires: mingw32-binutils BuildRequires: mingw32-runtime BuildRequires: mingw32-w32api BuildRequires: gmp-devel -%if 0%{?fedora} >= 9 BuildRequires: mpfr-devel -%endif BuildRequires: libgomp +BuildRequires: flex # NB: Explicit mingw32-filesystem dependency is REQUIRED here. -Requires: mingw32-filesystem >= 39-3 +Requires: mingw32-filesystem >= 48 + Requires: mingw32-binutils Requires: mingw32-runtime Requires: mingw32-w32api Requires: mingw32-cpp +# We don't run the automatic dependency scripts which would +# normally detect and provide the following DLL: +Provides: mingw32(libgcc_s_sjlj-1.dll) + %description -MinGW Windows cross-compiler (GCC) for C +MinGW Windows cross-compiler (GCC) for C. %package -n mingw32-cpp -Summary: MinGW Windows cross-C Preprocessor. +Summary: MinGW Windows cross-C Preprocessor Group: Development/Languages %description -n mingw32-cpp @@ -47,24 +81,72 @@ MinGW Windows cross-C Preprocessor %package c++ Summary: MinGW Windows cross-compiler for C++ Group: Development/Languages +Requires: %{name} = %{version}-%{release} %description c++ -MinGW Windows cross-compiler for C++ +MinGW Windows cross-compiler for C++. + + +%package objc +Summary: MinGW Windows cross-compiler support for Objective C +Group: Development/Languages +Requires: %{name} = %{version}-%{release} +Requires: mingw32-libobjc = %{version}-%{release} + +%description objc +MinGW Windows cross-compiler support for Objective C. + + +%package objc++ +Summary: MinGW Windows cross-compiler support for Objective C++ +Group: Development/Languages +Requires: %{name}-g++ = %{version}-%{release} +Requires: %{name}-objc = %{version}-%{release} + +%description objc++ +MinGW Windows cross-compiler support for Objective C++. + + +%package gfortran +Summary: MinGW Windows cross-compiler for FORTRAN +Group: Development/Languages +Requires: %{name} = %{version}-%{release} + +%description gfortran +MinGW Windows cross-compiler for FORTRAN. %prep -%setup -q -c -%setup -q -D -T -a1 -%patch1 -p1 +%setup -q -n gcc-%{version}-%{DATE} +%patch0 -p0 -b .hack~ +%patch1 -p0 -b .build-id~ +%patch2 -p0 -b .c++-builtin-redecl~ +%patch3 -p0 -b .ia64-libunwind~ +%patch4 -p0 -b .java-nomulti~ +%patch5 -p0 -b .ppc32-retaddr~ +%patch7 -p0 -b .pr27898~ +%patch8 -p0 -b .pr32139~ +%patch9 -p0 -b .pr33763~ +%patch10 -p0 -b .rh330771~ +%patch11 -p0 -b .rh341221~ +%patch12 -p0 -b .java-debug-iface-type~ +%patch13 -p0 -b .i386-libgomp~ +%patch15 -p0 -b .sparc-config-detection~ +%patch16 -p0 -b .libgomp-omp_h-multilib~ +%patch20 -p0 -b .libtool-no-rpath~ +%patch21 -p0 -b .cloog-dl~ +%patch22 -p0 -b .raw-string~ +%patch23 -p0 -b .pr39175~ +%patch24 -p0 -b .diff~ %build -cd gcc-%{version} - mkdir -p build -cd build +pushd build -languages="c,c++" +# GNAT is required to build Ada. Don't build GCJ. +#languages="c,c++,objc,obj-c++,java,fortran,ada" +languages="c,c++,objc,obj-c++,fortran" CC="%{__cc} ${RPM_OPT_FLAGS}" \ ../configure \ @@ -85,16 +167,18 @@ CC="%{__cc} ${RPM_OPT_FLAGS}" \ --disable-win32-registry \ --enable-version-specific-runtime-libs \ --with-sysroot=%{_mingw32_sysroot} \ - --enable-languages="$languages" $optargs + --enable-languages="$languages" \ + --with-bugurl=http://bugzilla.redhat.com/bugzilla make all +popd + %install rm -rf $RPM_BUILD_ROOT -cd gcc-%{version} -cd build +pushd build make DESTDIR=$RPM_BUILD_ROOT install # These files conflict with existing installed files. @@ -106,6 +190,18 @@ mkdir -p $RPM_BUILD_ROOT/lib ln -sf ..%{_prefix}/bin/i686-pc-mingw32-cpp \ $RPM_BUILD_ROOT/lib/i686-pc-mingw32-cpp +# Not sure why gcc puts this DLL into _bindir, but surely better if +# it goes into _mingw32_bindir. +mkdir -p $RPM_BUILD_ROOT%{_mingw32_bindir} +mv $RPM_BUILD_ROOT%{_bindir}/libgcc_s_sjlj-1.dll \ + $RPM_BUILD_ROOT%{_mingw32_bindir} + +# Don't want the *.la files. +find $RPM_BUILD_ROOT -name '*.la' -delete + +popd + + %clean rm -rf $RPM_BUILD_ROOT @@ -123,11 +219,12 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/gcc/i686-pc-mingw32/%{version}/crtend.o %{_libdir}/gcc/i686-pc-mingw32/%{version}/crtfastmath.o %{_libdir}/gcc/i686-pc-mingw32/%{version}/libgcc.a +%{_libdir}/gcc/i686-pc-mingw32/%{version}/libgcc_eh.a +%{_libdir}/gcc/i686-pc-mingw32/%{version}/libgcc_s.a %{_libdir}/gcc/i686-pc-mingw32/%{version}/libgcov.a %{_libdir}/gcc/i686-pc-mingw32/%{version}/libssp.a -%{_libdir}/gcc/i686-pc-mingw32/%{version}/libssp.la %{_libdir}/gcc/i686-pc-mingw32/%{version}/libssp_nonshared.a -%{_libdir}/gcc/i686-pc-mingw32/%{version}/libssp_nonshared.la +%{_libdir}/gcc/i686-pc-mingw32/%{version}/libssp.dll.a %dir %{_libdir}/gcc/i686-pc-mingw32/%{version}/include %dir %{_libdir}/gcc/i686-pc-mingw32/%{version}/include-fixed %dir %{_libdir}/gcc/i686-pc-mingw32/%{version}/include/ssp @@ -137,8 +234,11 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/gcc/i686-pc-mingw32/%{version}/include/ssp/*.h %dir %{_libdir}/gcc/i686-pc-mingw32/%{version}/install-tools %{_libdir}/gcc/i686-pc-mingw32/%{version}/install-tools/* +%dir %{_libdir}/gcc/i686-pc-mingw32/bin/ +%{_libdir}/gcc/i686-pc-mingw32/bin/libssp-0.dll %dir %{_libexecdir}/gcc/i686-pc-mingw32/%{version}/install-tools %{_libexecdir}/gcc/i686-pc-mingw32/%{version}/install-tools/* +%{_mingw32_bindir}/libgcc_s_sjlj-1.dll %{_mandir}/man1/i686-pc-mingw32-gcc.1* %{_mandir}/man1/i686-pc-mingw32-gcov.1* @@ -160,14 +260,42 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man1/i686-pc-mingw32-g++.1* %{_libdir}/gcc/i686-pc-mingw32/%{version}/include/c++/ %{_libdir}/gcc/i686-pc-mingw32/%{version}/libstdc++.a -%{_libdir}/gcc/i686-pc-mingw32/%{version}/libstdc++.la %{_libdir}/gcc/i686-pc-mingw32/%{version}/libsupc++.a -%{_libdir}/gcc/i686-pc-mingw32/%{version}/libsupc++.la %{_libexecdir}/gcc/i686-pc-mingw32/%{version}/cc1plus %{_libexecdir}/gcc/i686-pc-mingw32/%{version}/collect2 +%files objc +%defattr(-,root,root) +%{_libdir}/gcc/i686-pc-mingw32/%{version}/include/objc/ +%{_libdir}/gcc/i686-pc-mingw32/%{version}/libobjc.a +%{_libexecdir}/gcc/i686-pc-mingw32/%{version}/cc1obj + + +%files objc++ +%defattr(-,root,root) +%{_libexecdir}/gcc/i686-pc-mingw32/%{version}/cc1objplus + + +%files gfortran +%defattr(-,root,root) +%{_bindir}/i686-pc-mingw32-gfortran +%{_mandir}/man1/i686-pc-mingw32-gfortran.1* +%{_libdir}/gcc/i686-pc-mingw32/%{version}/libgfortran.a +%{_libdir}/gcc/i686-pc-mingw32/%{version}/libgfortranbegin.a +%{_libexecdir}/gcc/i686-pc-mingw32/%{version}/f951 + + %changelog +* Fri Feb 20 2009 Richard W.M. Jones - 4.4.0-0.4 +- Rebuild for mingw32-gcc 4.4 + +* Thu Feb 19 2009 Richard W.M. Jones - 4.4.0-0.2 +- Move to upstream version 4.4.0-20090216 (same as Fedora native version). +- Added FORTRAN support. +- Added Objective C support. +- Added Objective C++ support. + * Mon Nov 24 2008 Richard W.M. Jones - 4.3.2-12 - Rebuild against latest filesystem package. diff --git a/protoize.1 b/protoize.1 new file mode 100644 index 0000000..5dde73d --- /dev/null +++ b/protoize.1 @@ -0,0 +1,291 @@ +.\" Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation +.\" See section COPYING for conditions for redistribution +.\" +.TH protoize 1 "8 December 2006" "GCC" "GNU" +.SH NAME +protoize, unprotoize \- automatically add or remove function prototypes +.SH SYNOPSIS +.HP 7 +\fBprotoize\fR [\-CfgklNnqv] [\-B \fIDIRECTORY\fR] [\-c \fICOMPILATION-OPTIONS\fR] [\-d \fIDIRECTORY\fR] [\-i \fISTRING\fR] [\-p \fIPROGRAM\fR] [\-x \fIFILE\fR] [\fIFILE\fR...] +.HP 7 +\fBunprotoize\fR [\-fkNnqv] [\-c \fICOMPILATION-OPTIONS\fR] [\-d \fIDIRECTORY\fR] [\-i \fISTRING\fR] [\-p \fIPROGRAM\fR] [\-x \fIFILE\fR] [\fIFILE\fR...] +.SH DESCRIPTION +.PP +\fBprotoize\fR is an optional part of GCC. +You can use it to add prototypes to a program, +thus converting the program to ANSI C in one respect. +The companion program +\fBunprotoize\fR does the reverse: it removes argument types from any prototypes that are found. +.PP +When you run these programs, you must specify a set of source files +as command line arguments. +The conversion programs start out by compiling these files +to see what functions they define. +The information gathered about a file +\fIFOO\fR is saved in a file named \fIFOO.X\fR. +.PP +After scanning comes the actual conversion. +The specified files are all eligible to be converted; +any files they include (whether sources or just headers) are eligible as well. +.PP +But not all the eligible files are converted. +By default, +\fBprotoize\fR and \fBunprotoize\fR +convert only source and header files in the current directory. +You can specify additional directories whose files +should be converted with the +\fB\-d\fR \fIDIRECTORY\fR option. +You can also specify particular files to exclude with the +\fB\-x\fR \fIFILE\fR option. +A file is converted if it is eligible, its directory name matches one of the +specified directory names, and its name within the directory has not +been excluded. +.PP +Basic conversion with +\fBprotoize\fR consists of rewriting most function definitions and function declarations +to specify the types of the arguments. +The only ones not rewritten are those for varargs functions. +.PP +\fBprotoize\fR optionally inserts prototype declarations at the beginning of the source file, +to make them available for any calls that precede the function's definition. +Or it can insert prototype declarations with block scope +in the blocks where undeclared functions are called. +.PP +Basic conversion with +\fBunprotoize\fR +consists of rewriting most function declarations to remove any argument types, +and rewriting function definitions to the old-style pre-ANSI form. +.PP +Both conversion programs print a warning for any function +declaration or definition that they can't convert. +You can suppress these warnings with the +\fB\-q\fR option. +.PP +The output from +\fBprotoize\fR or \fBunprotoize\fR +replaces the original source file. +The original file is renamed to a name ending with +\fI.save\fR. +If the \fI.save\fR file already exists, then the source file is simply discarded. +.PP +\fBprotoize\fR and \fBunprotoize\fR both depend on +\fBgcc\fR\|(1) to scan the program and collect information about the functions it uses. +.PP +The options are as follows: +.TP +\fB\-B\fR \fIDIRECTORY\fR +Look for the file +\fISYSCALLS.c.X\fR in \fIdirectory\fR, +instead of the usual directory (normally \fI/usr/local/lib\fR). +This file contains prototype information about standard system functions. +This option applies only to \fBprotoize\fR. +.TP +\fB\-C\fR +Rename files to end in +\fI.C\fR instead of \fI.c\fR. +This is convenient if you are converting a C program to C++. +This option applies only to +\fBprotoize\fR. +.TP +\fB\-c\fR \fICOMPILATION-OPTIONS\fR +Use \fICOMPILATION-OPTIONS\fR as the options when running \fBgcc\fR\|(1) to produce the +\fI.X\fR files. +The special option \fB\-aux-info\fR is always passed in addition, to tell gcc to write a +\fI.X\fR file. +Note that the compilation options must be given as a single argument to +\fBprotoize\fR or \fBunprotoize\fR. +If you want to specify several gcc options, you must quote the entire set of +compilation options to make them a single word in the shell. +There are certain gcc arguments that you cannot use, because they +would produce the wrong kind of output. +These include +\fB\-g\fR, \fB\-O\fR, \fB\-c\fR, \fB\-S\fR,\fB\-o\fR. +If you include these in the \fICOMPILATION-OPTIONS\fR, they are ignored. +.TP +\fB\-d\fR \fIDIRECTORY\fR +Specify additional directories whose files should be converted. +.TP +\fB\-g\fR +Add explicit global declarations. +This means inserting explicit declarations at the beginning of each +source file for each function that is called in the file and was not declared. +These declarations precede the first function definition that contains a +call to an undeclared function. +This option applies only to +.\fBprotoize\fR. +.TP +\fB\-i\fR \fISTRING\fR +Indent old-style parameter declarations with the string +\fISTRING\fR. +This option applies only to +\fBprotoize\fR. +\fBunprotoize\fR converts prototyped function definitions to old-style +function definitions, where the arguments are declared between the +argument list and the initial +\fB{\fR. +By default, +\fBunprotoize\fR uses five spaces as the indentation. +If you want to indent with just one space instead, use +\fB\-i " "\fR. +.TP +\fB\-k\fR +Keep the +\fI.X\fR files. +Normally, they are deleted after conversion is finished. +.TP +\fB\-l\fR +Add explicit local declarations. +\fBprotoize\fR with +\fB\-l\fR inserts a prototype declaration for each function in each block which calls +the function without any declaration. +This option applies only to +\fBprotoize\fR. +.TP +\fB\-N\fR +Make no \fI.save\fR files. +The original files are simply deleted. +Use this option with caution. +.TP +\fB\-n\fR +Make no real changes. +This mode just prints information about the conversions +that would have been done without +\fB\-n\fR. +.TP +\fB\-p\fR \fIPROGRAM\fR +Use the program +\fBPROGRAM\fR as the compiler. +Normally, the name +\fBgcc\fR is used. +.TP +\fB\-q\fR +Work quietly. +Most warnings are suppressed. +.TP +\fB\-v\fR +Print the version number, just like +\fB\-v\fR for gcc. +.TP +\fB\-x\fR \fBFILE\fR +List of files to exclude from the conversion process. +.PP +If you need special compiler options to compile one of your program's +source files, then you should generate that file's +\fI.X\fR file specially, by running gcc on that source file with +the appropriate options and the option +\fB\-aux-info\fR. +Then run +\fBprotoize\fR on the entire set of files. +\fBprotoize\fR will use the existing +\fI.X\fR file because it is newer than the source file. +For example: +.PP +.DL $ gcc -Dfoo=bar file1.c -aux-info +.DL $ protoize *.c +.PP +You need to include the special files along with the rest in the +\fBprotoize\fR command, even though their +\fI.X\fR files already exist, because otherwise they won't get converted. +.PP +.SH SEE ALSO +\fBgcc\fR\|(1), and the Info entry for \fBgcc\fR, particularly +\fBRunning protoize\fR section. +.SH HISTORY +Ron Guilmette implemented the +\fBprotoize\fR and \fBunprotoize\fR tools. +.SH AUTHORS +See the GCC manual for the contributors to GCC. +.SH CAVEATS +The conversion programs \fBprotoize\fR and \fBunprotoize\fR +can sometimes change a source file in a way that won't work +unless you rearrange it. +.PP +\fBprotoize\fR can insert references to a type name or type tag before +the definition, or in a file where they are not defined. +.PP +If this happens, compiler error messages should indicate where the +new references are, so fixing the file by hand is straightforward. +.PP +There are some C constructs which \fBprotoize\fR +cannot figure out. +For example, it can't determine argument types for declaring a +pointer-to-function variable; this must be done by hand. \fBprotoize\fR +inserts a comment containing \fB???\fR each time it finds such a variable; +all such variables can be found by searching for this string. +ANSI C does not require declaring the argument types of +pointer-to-function types. +.PP +Using \fBunprotoize\fR can easily introduce bugs. +If the program relied on prototypes to bring about conversion of arguments, +these conversions will not take place in the program without prototypes. +One case in which you can be sure \fBunprotoize\fR +is safe is when you are removing prototypes that were made with +\fBprotoize\fR; if the program worked before without any prototypes, +it will work again without them. +.PP +You can find all the places where this problem might occur by +compiling the program with the \fB\-Wconversion\fR option. +It prints a warning whenever an argument is converted. +.PP +Both conversion programs can be confused if there are macro calls +in and around the text to be converted. +In other words, the standard syntax for a declaration or definition +must not result from expanding a macro. +This problem is inherent in the design of C and cannot be fixed. +If only a few functions have confusing macro calls, +you can easily convert them manually. +.PP +\fBprotoize\fR cannot get the argument types for a function whose definition was not +actually compiled due to preprocessing conditionals. +When this happens, \fBprotoize\fR changes nothing in regard to such a function. +\fBprotoize\fR tries to detect such instances and warn about them. +.PP +You can generally work around this problem by using +\fBprotoize\fR step by step, each time specifying a different set of +\fB\-D\fR options for compilation, until all of the functions have been converted. +There is no automatic way to verify that you have got them all, however. +.PP +Confusion may result if there is an occasion to convert a function +declaration or definition in a region of source code where there +is more than one formal parameter list present. +Thus, attempts to convert code containing multiple (conditionally compiled) +versions of a single function header (in the same vicinity) +may not produce the desired (or expected) results. +.PP +If you plan on converting source files which contain such code, +it is recommended that you first make sure that each conditionally +compiled region of source code which contains an alternative +function header also contains at least one additional follower +token (past the final right parenthesis of the function header). +This should circumvent the problem. +.PP +\fBunprotoize\fR can become confused when trying to convert a function +definition or declaration which contains a declaration for a +pointer-to-function formal argument which has the same name as the +function being defined or declared. +We recommand you avoid such choices of formal parameter names. +.PP +It might be necessary to correct some of the indentation by hand and +break long lines. +(The conversion programs don't write lines longer than eighty characters +in any case.) +.SH BUGS +For instructions on reporting bugs, see the GCC manual. +.SH COPYING +Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +.PP +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. +.PP +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the +entire resulting derived work is distributed under the terms of a +permission notice identical to this one. +.PP +Permission is granted to copy and distribute translations of this +manual into another language, under the above conditions for modified +versions, except that this permission notice may be included in +translations approved by the Free Software Foundation instead of in +the original English. diff --git a/sources b/sources index f4fe19d..2568471 100644 --- a/sources +++ b/sources @@ -1,2 +1,3 @@ -dd8048b43d3d4e5595bcade47b9144c6 gcc-core-4.3.2.tar.bz2 -bfdf8d19e1b85f522f8b8d48d25e7aaa gcc-g++-4.3.2.tar.bz2 +2659f09c2e43ef8b7d4406321753f1b2 fastjar-0.97.tar.gz +0f5cb535b5450a8d61b14f690700a54c gcc-4.4.0-20090216.tar.bz2 +716b7a0823f96c9d02c1703a9c47d387 cloog-ppl-0.15.tar.gz