From: Michael Tremer Date: Sun, 31 Oct 2010 16:02:06 +0000 (+0100) Subject: gcc: Apply some bugfix patches to gcc. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0352604e9d1015cfd4662f948197f8f0e8590cde;p=ipfire-3.x.git gcc: Apply some bugfix patches to gcc. --- diff --git a/pkgs/core/gcc/gcc.nm b/pkgs/core/gcc/gcc.nm index cedc0a796..e16e6832a 100644 --- a/pkgs/core/gcc/gcc.nm +++ b/pkgs/core/gcc/gcc.nm @@ -26,7 +26,7 @@ include $(PKGROOT)/Include PKG_NAME = gcc PKG_VER = 4.5.1 -PKG_REL = 1 +PKG_REL = 3 PKG_MAINTAINER = Michael Tremer PKG_GROUP = Development/Compilers diff --git a/pkgs/core/gcc/patches/gcc45-libtool-no-rpath.patch b/pkgs/core/gcc/patches/gcc45-libtool-no-rpath.patch new file mode 100644 index 000000000..1382a1bdc --- /dev/null +++ b/pkgs/core/gcc/patches/gcc45-libtool-no-rpath.patch @@ -0,0 +1,27 @@ +libtool sucks. +--- a/ltmain.sh.jj 2007-12-07 14:53:21.000000000 +0100 ++++ b/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/pkgs/core/gcc/patches/gcc45-pr33763.patch b/pkgs/core/gcc/patches/gcc45-pr33763.patch new file mode 100644 index 000000000..dfc9d5995 --- /dev/null +++ b/pkgs/core/gcc/patches/gcc45-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. + +--- a/gcc/tree-inline.c.jj 2007-11-06 09:29:04.000000000 +0100 ++++ b/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) + { +--- a/gcc/testsuite/gcc.dg/pr33763.c.jj 2007-11-06 16:19:12.000000000 +0100 ++++ b/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); ++} +--- a/gcc/testsuite/g++.dg/opt/inline13.C.jj 2007-11-06 16:20:20.000000000 +0100 ++++ b/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/pkgs/core/gcc/patches/gcc45-pr38757.patch b/pkgs/core/gcc/patches/gcc45-pr38757.patch new file mode 100644 index 000000000..d3aec2de4 --- /dev/null +++ b/pkgs/core/gcc/patches/gcc45-pr38757.patch @@ -0,0 +1,118 @@ +2009-03-18 Jakub Jelinek + + PR debug/38757 + * langhooks.h (struct lang_hooks): Add source_language langhook. + * langhooks-def.h (LANG_HOOKS_SOURCE_LANGUAGE): Define to NULL. + (LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_SOURCE_LANGUAGE. + * c-lang.c (c_source_language): New function. + (LANG_HOOKS_SOURCE_LANGUAGE): Define. + * dwarf2out.c (add_prototyped_attribute): Add DW_AT_prototype + also for DW_LANG_{C,C99,ObjC}. + (gen_compile_unit_die): Use lang_hooks.source_language () to + determine if DW_LANG_C99 or DW_LANG_C89 should be returned. + +--- a/gcc/langhooks.h.jj 2010-06-30 09:48:30.000000000 +0200 ++++ b/gcc/langhooks.h 2010-07-01 16:15:22.432616871 +0200 +@@ -454,6 +454,10 @@ struct lang_hooks + is enabled. */ + bool eh_use_cxa_end_cleanup; + ++ /* Return year of the source language standard version if the FE supports ++ multiple versions of the standard. */ ++ int (*source_language) (void); ++ + /* Whenever you add entries here, make sure you adjust langhooks-def.h + and langhooks.c accordingly. */ + }; +--- a/gcc/langhooks-def.h.jj 2010-06-30 09:48:30.000000000 +0200 ++++ b/gcc/langhooks-def.h 2010-07-01 16:16:07.427460761 +0200 +@@ -1,5 +1,5 @@ + /* Default macros to initialize the lang_hooks data structure. +- Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 ++ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Free Software Foundation, Inc. + Contributed by Alexandre Oliva + +@@ -111,6 +111,7 @@ extern void lhd_omp_firstprivatize_type_ + #define LANG_HOOKS_EH_PERSONALITY lhd_gcc_personality + #define LANG_HOOKS_EH_RUNTIME_TYPE lhd_pass_through_t + #define LANG_HOOKS_EH_USE_CXA_END_CLEANUP false ++#define LANG_HOOKS_SOURCE_LANGUAGE NULL + + /* Attribute hooks. */ + #define LANG_HOOKS_ATTRIBUTE_TABLE NULL +@@ -301,6 +302,7 @@ extern void lhd_end_section (void); + LANG_HOOKS_EH_PERSONALITY, \ + LANG_HOOKS_EH_RUNTIME_TYPE, \ + LANG_HOOKS_EH_USE_CXA_END_CLEANUP, \ ++ LANG_HOOKS_SOURCE_LANGUAGE, \ + } + + #endif /* GCC_LANG_HOOKS_DEF_H */ +--- a/gcc/c-lang.c.jj 2010-06-30 09:48:30.000000000 +0200 ++++ b/gcc/c-lang.c 2010-07-01 16:14:25.396197804 +0200 +@@ -1,6 +1,6 @@ + /* Language-specific hook definitions for C front end. + Copyright (C) 1991, 1995, 1997, 1998, +- 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008 ++ 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008, 2009 + Free Software Foundation, Inc. + + This file is part of GCC. +@@ -37,6 +37,12 @@ along with GCC; see the file COPYING3. + + enum c_language_kind c_language = clk_c; + ++static int ++c_source_language (void) ++{ ++ return flag_isoc99 ? 1999 : 1989; ++} ++ + /* Lang hooks common to C and ObjC are declared in c-objc-common.h; + consequently, there should be very few hooks below. */ + +@@ -44,6 +50,8 @@ enum c_language_kind c_language = clk_c; + #define LANG_HOOKS_NAME "GNU C" + #undef LANG_HOOKS_INIT + #define LANG_HOOKS_INIT c_objc_common_init ++#undef LANG_HOOKS_SOURCE_LANGUAGE ++#define LANG_HOOKS_SOURCE_LANGUAGE c_source_language + + /* Each front end provides its own lang hook initializer. */ + struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; +--- a/gcc/dwarf2out.c.jj 2010-07-01 14:07:41.000000000 +0200 ++++ b/gcc/dwarf2out.c 2010-07-01 16:13:24.597354717 +0200 +@@ -17150,9 +17150,18 @@ add_bit_size_attribute (dw_die_ref die, + static inline void + add_prototyped_attribute (dw_die_ref die, tree func_type) + { +- if (get_AT_unsigned (comp_unit_die, DW_AT_language) == DW_LANG_C89 +- && TYPE_ARG_TYPES (func_type) != NULL) +- add_AT_flag (die, DW_AT_prototyped, 1); ++ switch (get_AT_unsigned (comp_unit_die, DW_AT_language)) ++ { ++ case DW_LANG_C: ++ case DW_LANG_C89: ++ case DW_LANG_C99: ++ case DW_LANG_ObjC: ++ if (TYPE_ARG_TYPES (func_type) != NULL) ++ add_AT_flag (die, DW_AT_prototyped, 1); ++ break; ++ default: ++ break; ++ } + } + + /* Add an 'abstract_origin' attribute below a given DIE. The DIE is found +@@ -19246,6 +19255,10 @@ gen_compile_unit_die (const char *filena + language = DW_LANG_ObjC; + else if (strcmp (language_string, "GNU Objective-C++") == 0) + language = DW_LANG_ObjC_plus_plus; ++ else if (strcmp (language_string, "GNU C") == 0 ++ && lang_hooks.source_language ++ && lang_hooks.source_language () >= 1999) ++ language = DW_LANG_C99; + } + + add_AT_unsigned (die, DW_AT_language, language);