From: Michael Tremer Date: Thu, 16 Aug 2012 16:48:19 +0000 (+0200) Subject: gcc: Import patches from RHEL6. X-Git-Tag: v2.13-beta1~242^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed635824a916238bddc7e060bd2273e063e7d339;p=people%2Fms%2Fipfire-2.x.git gcc: Import patches from RHEL6. --- diff --git a/lfs/gcc b/lfs/gcc index c8bcb08f27..400cf269d7 100644 --- a/lfs/gcc +++ b/lfs/gcc @@ -34,6 +34,9 @@ DL_FILE = $(THISAPP).tar.bz2 DL_FROM = $(URL_IPFIRE) DIR_APP = $(DIR_SRC)/$(THISAPP) +CFLAGS := $(patsubst -march=%,,$(CFLAGS)) +CFLAGS := $(patsubst -mtune=%,,$(CFLAGS)) + # Normal build or /tools build. # ifeq "$(ROOT)" "" @@ -52,7 +55,6 @@ ifeq "$(ROOT)" "" EXTRA_INSTALL = else ifeq "$(PASS)" "1" - CFLAGS := $(patsubst -march=%,,$(CFLAGS)) TARGET = $(DIR_INFO)/$(THISAPP)-tools1 EXTRA_CONFIG = \ --target=$(CROSSTARGET) \ @@ -102,6 +104,17 @@ ifeq "$(MACHINE_TYPE)" "arm" --disable-sjlj-exceptions endif +ifeq "$(MACHINE)" "i586" + EXTRA_CONFIG += \ + --with-arch=i586 \ + --with-tune=generic +endif + +EXTRA_CONFIG += \ + --with-bugurl=http://bugtracker.ipfire.org \ + --disable-libunwind-exceptions \ + --enable-gnu-unique-object + export XCFLAGS = $(CFLAGS) export TCFLAGS = $(CFLAGS) @@ -155,6 +168,18 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @rm -rf $(DIR_APP) $(DIR_SRC)/gcc-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE) @mkdir $(DIR_SRC)/gcc-build + # Apply patches. + cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-build-id.patch + cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-c++-builtin-redecl.patch + cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-i386-libgomp.patch + cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-libtool-no-rpath.patch + cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-no-add-needed.patch + cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-pr33763.patch + cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-rh330771.patch + cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-rh533181.patch + cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-rh610785.patch + cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-unwind-debug-hook.patch + ifneq "$(ROOT)" "" # Build gmp and mpfr internally in toolchain. cd $(DIR_APP) && tar xfa $(DIR_DL)/gmp-$(GMP_VER).tar.bz2 diff --git a/src/patches/gcc/gcc44-build-id.patch b/src/patches/gcc/gcc44-build-id.patch new file mode 100644 index 0000000000..f76f9396fd --- /dev/null +++ b/src/patches/gcc/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/src/patches/gcc/gcc44-c++-builtin-redecl.patch b/src/patches/gcc/gcc44-c++-builtin-redecl.patch new file mode 100644 index 0000000000..1f36f1fe04 --- /dev/null +++ b/src/patches/gcc/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 +@@ -2001,23 +2001,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 just redeclaring a + function. */ +--- 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/src/patches/gcc/gcc44-i386-libgomp.patch b/src/patches/gcc/gcc44-i386-libgomp.patch new file mode 100644 index 0000000000..5d1eea84c3 --- /dev/null +++ b/src/patches/gcc/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/src/patches/gcc/gcc44-libtool-no-rpath.patch b/src/patches/gcc/gcc44-libtool-no-rpath.patch new file mode 100644 index 0000000000..466c661e0c --- /dev/null +++ b/src/patches/gcc/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/src/patches/gcc/gcc44-no-add-needed.patch b/src/patches/gcc/gcc44-no-add-needed.patch new file mode 100644 index 0000000000..4570c0c054 --- /dev/null +++ b/src/patches/gcc/gcc44-no-add-needed.patch @@ -0,0 +1,52 @@ +2010-02-08 Roland McGrath + + * config/rs6000/sysv4.h (LINK_EH_SPEC): Pass --no-add-needed to the + linker. + * 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/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} %{!r:--build-id} " ++#define LINK_EH_SPEC "--no-add-needed %{!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 +@@ -58,7 +58,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 "%{!r:--build-id} " ++#define LINK_EH_SPEC "--no-add-needed %{!r:--build-id} " + + #define MD_UNWIND_SUPPORT "config/ia64/linux-unwind.h" + +--- gcc/config/linux.h.~1~ ++++ gcc/config/linux.h +@@ -89,7 +89,7 @@ see the files COPYING3 and COPYING.RUNTI + } while (0) + + #if defined(HAVE_LD_EH_FRAME_HDR) +-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} %{!r:--build-id} " ++#define LINK_EH_SPEC "--no-add-needed %{!static:--eh-frame-hdr} %{!r:--build-id} " + #endif + + /* Define this so we can compile MS code for use with WINE. */ +--- gcc/config/rs6000/sysv4.h.~1~ ++++ gcc/config/rs6000/sysv4.h +@@ -917,7 +917,7 @@ SVR4_ASM_SPEC \ + %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}}}" + + #if defined(HAVE_LD_EH_FRAME_HDR) +-# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} %{!r:--build-id} " ++# define LINK_EH_SPEC "--no-add-needed %{!static:--eh-frame-hdr} %{!r:--build-id} " + #endif + + #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \ diff --git a/src/patches/gcc/gcc44-pr33763.patch b/src/patches/gcc/gcc44-pr33763.patch new file mode 100644 index 0000000000..86c8ac7e13 --- /dev/null +++ b/src/patches/gcc/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/src/patches/gcc/gcc44-rh330771.patch b/src/patches/gcc/gcc44-rh330771.patch new file mode 100644 index 0000000000..f7c365dc8a --- /dev/null +++ b/src/patches/gcc/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 2009-05-06 08:14:50.000000000 +0200 ++++ libjava/Makefile.am 2009-05-06 10:26:43.000000000 +0200 +@@ -314,6 +314,8 @@ libgcj_tools_la_SOURCES = classpath/tool + libgcj_tools_la_GCJFLAGS = $(AM_GCJFLAGS) -findirect-dispatch \ + -fno-bootstrap-classes -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 2009-05-06 08:14:49.000000000 +0200 ++++ libjava/Makefile.in 2009-05-06 10:27:18.000000000 +0200 +@@ -160,7 +160,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 \ +@@ -1041,6 +1040,7 @@ libgcj_tools_la_GCJFLAGS = $(AM_GCJFLAGS + -fno-bootstrap-classes -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/src/patches/gcc/gcc44-rh533181.patch b/src/patches/gcc/gcc44-rh533181.patch new file mode 100644 index 0000000000..76326e2994 --- /dev/null +++ b/src/patches/gcc/gcc44-rh533181.patch @@ -0,0 +1,153 @@ +2010-07-22 Jakub Jelinek + + * gimplify.c (enum gimplify_omp_var_data): Add + GOVD_THREADPRIVATE_WARNED. + (gimplify_bind_expr): Add GOVD_LOCAL | GOVD_SEEN even for global vars. + (omp_notice_threadprivate_variable): Note used threadprivate vars + with current function's context in shared clauses. + (gimplify_adjust_omp_clauses_1): Allow globals with current function's + context in taskreg shared clause. + * omp-low.c (lower_rec_input_clauses): For function-local is_global_var + VAR_DECLs in shared clauses add a decl copy with DECL_VALUE_EXPR + pointing to the original. + + * trans-openmp.c (gfc_omp_private_debug_clause): Return false for + threadprivate decls. + + * gcc.dg/gomp/tls-3.c: New test. + +--- gcc/fortran/trans-openmp.c.jj 2010-06-24 21:47:09.908230044 +0200 ++++ gcc/fortran/trans-openmp.c 2010-07-26 10:45:15.830229443 +0200 +@@ -351,6 +351,18 @@ gfc_omp_disregard_value_expr (tree decl, + bool + gfc_omp_private_debug_clause (tree decl, bool shared) + { ++ if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)) ++ { ++ if (DECL_THREAD_LOCAL_P (decl)) ++ return false; ++ if (DECL_HAS_VALUE_EXPR_P (decl)) ++ { ++ tree value = get_base_address (DECL_VALUE_EXPR (decl)); ++ if (value && DECL_P (value) && DECL_THREAD_LOCAL_P (value)) ++ return false; ++ } ++ } ++ + if (GFC_DECL_CRAY_POINTEE (decl)) + return true; + +--- gcc/gimplify.c.jj 2010-07-09 09:01:37.049604412 +0200 ++++ gcc/gimplify.c 2010-07-26 10:50:05.646291216 +0200 +@@ -66,6 +66,7 @@ enum gimplify_omp_var_data + GOVD_LOCAL = 128, + GOVD_DEBUG_PRIVATE = 256, + GOVD_PRIVATE_OUTER_REF = 512, ++ GOVD_THREADPRIVATE_WARNED = 1024, + GOVD_DATA_SHARE_CLASS = (GOVD_SHARED | GOVD_PRIVATE | GOVD_FIRSTPRIVATE + | GOVD_LASTPRIVATE | GOVD_REDUCTION | GOVD_LOCAL) + }; +@@ -1234,7 +1235,7 @@ gimplify_bind_expr (tree *expr_p, gimple + struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp; + + /* Mark variable as local. */ +- if (ctx && !is_global_var (t) ++ if (ctx + && (! DECL_SEEN_IN_BIND_EXPR_P (t) + || splay_tree_lookup (ctx->variables, + (splay_tree_key) t) == NULL)) +@@ -5339,18 +5340,36 @@ omp_notice_threadprivate_variable (struc + { + splay_tree_node n; + +- if (ctx->region_type != ORT_UNTIED_TASK) ++ while (ctx && ctx->region_type == ORT_WORKSHARE) ++ { ++ n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl); ++ if (n != NULL) ++ { ++ gcc_assert (n->value & GOVD_LOCAL); ++ return false; ++ } ++ ctx = ctx->outer_context; ++ } ++ if (ctx == NULL) + return false; ++ + n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl); + if (n == NULL) ++ n = splay_tree_insert (ctx->variables, (splay_tree_key)decl, ++ DECL_CONTEXT (decl) == current_function_decl ++ ? GOVD_SHARED | GOVD_SEEN : 0); ++ if (ctx->region_type == ORT_UNTIED_TASK ++ && (n->value & GOVD_THREADPRIVATE_WARNED) == 0) + { + error ("threadprivate variable %qs used in untied task", + IDENTIFIER_POINTER (DECL_NAME (decl))); + error ("%Henclosing task", &ctx->location); +- splay_tree_insert (ctx->variables, (splay_tree_key)decl, 0); ++ n->value |= GOVD_THREADPRIVATE_WARNED; + } + if (decl2) +- splay_tree_insert (ctx->variables, (splay_tree_key)decl2, 0); ++ splay_tree_insert (ctx->variables, (splay_tree_key)decl2, ++ DECL_CONTEXT (decl2) == current_function_decl ++ ? GOVD_SHARED | GOVD_SEEN : 0); + return false; + } + +@@ -5779,7 +5798,9 @@ gimplify_adjust_omp_clauses_1 (splay_tre + break; + ctx = ctx->outer_context; + } +- if (ctx == NULL) ++ if (ctx == NULL ++ && (DECL_CONTEXT (decl) != current_function_decl ++ || gimplify_omp_ctxp->region_type == ORT_WORKSHARE)) + return 0; + } + code = OMP_CLAUSE_SHARED; +--- gcc/omp-low.c.jj 2010-06-11 11:06:00.913659301 +0200 ++++ gcc/omp-low.c 2010-07-26 10:45:15.866229447 +0200 +@@ -2222,6 +2222,17 @@ lower_rec_input_clauses (tree clauses, g + continue; + break; + case OMP_CLAUSE_SHARED: ++ if (pass == 0 ++ && is_global_var (OMP_CLAUSE_DECL (c)) ++ && (DECL_CONTEXT (OMP_CLAUSE_DECL (c)) ++ == current_function_decl) ++ && is_taskreg_ctx (ctx) ++ && !DECL_IGNORED_P (OMP_CLAUSE_DECL (c))) ++ { ++ new_var = omp_copy_decl_1 (OMP_CLAUSE_DECL (c), ctx); ++ SET_DECL_VALUE_EXPR (new_var, OMP_CLAUSE_DECL (c)); ++ DECL_HAS_VALUE_EXPR_P (new_var) = 1; ++ } + if (maybe_lookup_decl (OMP_CLAUSE_DECL (c), ctx) == NULL) + { + gcc_assert (is_global_var (OMP_CLAUSE_DECL (c))); +--- gcc/testsuite/gcc.dg/gomp/tls-3.c.jj 2010-07-26 10:45:15.868228753 +0200 ++++ gcc/testsuite/gcc.dg/gomp/tls-3.c 2010-07-26 10:45:15.868228753 +0200 +@@ -0,0 +1,21 @@ ++/* { dg-do compile } */ ++/* { dg-require-effective-target tls_native } */ ++ ++int thr; ++#pragma omp threadprivate(thr) ++ ++void ++foo (void) ++{ ++ #pragma omp task untied /* { dg-error "enclosing task" } */ ++ { ++ static int thr2; ++ #pragma omp threadprivate(thr2) ++ static int thr3; ++ #pragma omp threadprivate(thr3) ++ thr++; /* { dg-error "used in untied task" } */ ++ thr2++; /* { dg-error "used in untied task" } */ ++ thr++; ++ thr2++; ++ } ++} diff --git a/src/patches/gcc/gcc44-rh610785.patch b/src/patches/gcc/gcc44-rh610785.patch new file mode 100644 index 0000000000..91d093469a --- /dev/null +++ b/src/patches/gcc/gcc44-rh610785.patch @@ -0,0 +1,74 @@ +2010-07-07 Jakub Jelinek + + * tree-sra.c (sra_build_assignment): Don't add BIT_XOR_EXPR/MINUS_EXPR + of signbit if signbit is the most significant bit of utype already. + + * gcc.c-torture/execute/20100707-1.c: New test. + +--- gcc/tree-sra.c.jj 2010-05-13 13:08:52.000000000 +0200 ++++ gcc/tree-sra.c 2010-07-06 19:50:09.000000000 +0200 +@@ -2211,7 +2211,10 @@ sra_build_assignment (tree dst, tree src + + /* Perform sign extension, if required. + ??? This should never be necessary. */ +- if (!unsignedp) ++ if (!unsignedp ++ && (TREE_INT_CST_LOW (width) != TYPE_PRECISION (utype) ++ || (TREE_INT_CST_LOW (width) ++ != GET_MODE_BITSIZE (TYPE_MODE (utype))))) + { + tree signbit = int_const_binop (LSHIFT_EXPR, + build_int_cst_wide (utype, 1, 0), +--- gcc/testsuite/gcc.c-torture/execute/20100707-1.c 2010-05-27 15:41:40.446237053 +0200 ++++ gcc/testsuite/gcc.c-torture/execute/20100707-1.c 2010-07-06 13:55:35.000000000 +0200 +@@ -0,0 +1,50 @@ ++struct S { int s; }; ++struct T { int w; int h; }; ++int vr; ++ ++inline struct T ++bar (const struct S * x) ++{ ++ struct T t; ++ t.w = vr; ++ t.h = x->s; ++ return t; ++} ++ ++__attribute__ ((noinline)) ++void foo (struct S * w, unsigned char *x, int y, int *z[2]) ++{ ++ struct T t; ++ int i, j, k; ++ t = bar (w); ++ k = t.w + 2; ++ for (i = 0; i <= t.h; i++) ++ { ++ int *u = z[i > 0] + 1; ++ unsigned char *v; ++ int q = 0; ++ v = x + k * i + 1; ++ for (j = 0; j < t.w; j++) ++ { ++ int m = u[j]; ++ if (m > y && !q && v[j - k] != 2) ++ v[j] = 0; ++ } ++ } ++} ++ ++unsigned char b[64]; ++ ++int ++main (void) ++{ ++ int v[32], *z[2]; ++ struct S s; ++ __builtin_memset (v, 0, sizeof (v)); ++ vr = 16; ++ s.s = 16; ++ z[0] = v; ++ z[1] = v; ++ foo (&s, b + 32, -1, z); ++ return 0; ++} diff --git a/src/patches/gcc/gcc44-unwind-debug-hook.patch b/src/patches/gcc/gcc44-unwind-debug-hook.patch new file mode 100644 index 0000000000..9b7c59eb0f --- /dev/null +++ b/src/patches/gcc/gcc44-unwind-debug-hook.patch @@ -0,0 +1,51 @@ +2010-04-27 Jakub Jelinek + + * unwind-dw2.c (_Unwind_DebugHook): Add used attribute. + +2009-05-27 Tom Tromey + + * unwind-dw2.c (_Unwind_DebugHook): New function. + (uw_install_context): Call _Unwind_DebugHook. + +--- gcc/unwind-dw2.c (revision 147933) ++++ gcc/unwind-dw2.c (revision 147934) +@@ -1473,18 +1473,32 @@ uw_init_context_1 (struct _Unwind_Contex + context->ra = __builtin_extract_return_addr (outer_ra); + } + ++static void _Unwind_DebugHook (void *, void *) ++ __attribute__ ((__noinline__, __used__)); ++ ++/* This function is called during unwinding. It is intended as a hook ++ for a debugger to intercept exceptions. CFA is the CFA of the ++ target frame. HANDLER is the PC to which control will be ++ transferred. */ ++static void ++_Unwind_DebugHook (void *cfa __attribute__ ((__unused__)), ++ void *handler __attribute__ ((__unused__))) ++{ ++ asm (""); ++} + + /* Install TARGET into CURRENT so that we can return to it. This is a + macro because __builtin_eh_return must be invoked in the context of + our caller. */ + +-#define uw_install_context(CURRENT, TARGET) \ +- do \ +- { \ +- long offset = uw_install_context_1 ((CURRENT), (TARGET)); \ +- void *handler = __builtin_frob_return_addr ((TARGET)->ra); \ +- __builtin_eh_return (offset, handler); \ +- } \ ++#define uw_install_context(CURRENT, TARGET) \ ++ do \ ++ { \ ++ long offset = uw_install_context_1 ((CURRENT), (TARGET)); \ ++ void *handler = __builtin_frob_return_addr ((TARGET)->ra); \ ++ _Unwind_DebugHook ((TARGET)->cfa, handler); \ ++ __builtin_eh_return (offset, handler); \ ++ } \ + while (0) + + static long