4.6.0-0.5

This commit is contained in:
Jakub Jelinek 2011-01-28 11:21:01 +01:00
parent 2512207346
commit f7f5fb5d3e
7 changed files with 575 additions and 22 deletions

4
.gitignore vendored
View File

@ -1,4 +1,2 @@
fastjar-0.97.tar.gz
gcc-4.5.1-20101130.tar.bz2
/fastjar-0.97.tar.gz
/gcc-4.6.0-20110122.tar.bz2
/gcc-4.6.0-20110128.tar.bz2

View File

@ -1,9 +1,9 @@
%global DATE 20110122
%global SVNREV 169125
%global DATE 20110128
%global SVNREV 169352
%global gcc_version 4.6.0
# Note, gcc_release must be integer, if you want to add suffixes to
# %{release}, append them after %{gcc_release} on Release: line.
%global gcc_release 0.3
%global gcc_release 0.5
%global _unpackaged_files_terminate_build 0
%global multilib_64_archs sparc64 ppc64 s390x x86_64
%ifarch %{ix86} x86_64 ia64 ppc ppc64 alpha
@ -111,7 +111,7 @@ BuildRequires: libunwind >= 0.98
BuildRequires: ppl >= 0.10, ppl-devel >= 0.10, cloog-ppl >= 0.15, cloog-ppl-devel >= 0.15
%endif
%if %{build_libstdcxx_docs}
BuildRequires: doxygen
BuildRequires: doxygen >= 1.7.1
BuildRequires: graphviz
%endif
Requires: cpp = %{version}-%{release}
@ -166,6 +166,9 @@ Patch17: gcc46-no-add-needed.patch
Patch18: gcc46-unwind-debughook-sdt.patch
Patch19: gcc46-pr47106-revert.patch
Patch20: gcc46-pr46890.patch
Patch21: gcc46-ppl-0.10.patch
Patch22: gcc46-pr31490.patch
Patch23: gcc46-Woverlength-string.patch
Patch1000: fastjar-0.97-segfault.patch
Patch1001: fastjar-0.97-len1.patch
@ -598,6 +601,9 @@ not stable, so plugins must be rebuilt any time GCC is updated.
%patch18 -p0 -b .unwind-debughook-sdt~
%patch19 -p0 -b .pr47106-revert~
%patch20 -p0 -b .pr46890~
%patch21 -p0 -b .ppl-0.10~
%patch22 -p0 -b .pr31490~
%patch23 -p0 -b .Woverlength-string~
# This testcase doesn't compile.
rm libjava/testsuite/libjava.lang/PR35020*
@ -705,6 +711,7 @@ cd ..
CC=gcc
OPT_FLAGS=`echo %{optflags}|sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g'`
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-m64//g;s/-m32//g;s/-m31//g'`
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/ -pipe / /g`
%ifarch sparc
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-mcpu=ultrasparc/-mtune=ultrasparc/g;s/-mcpu=v[78]//g'`
%endif
@ -959,8 +966,8 @@ for f in `find %{buildroot}%{_prefix}/include/c++/%{gcc_version}/%{gcc_target_pl
done
done
# Nuke bits/stdc++.h.gch dirs
# 1) there is no bits/stdc++.h header installed, so when gch file can't be
# Nuke bits/*.h.gch dirs
# 1) there is no bits/*.h header installed, so when gch file can't be
# used, compilation fails
# 2) sometimes it is hard to match the exact options used for building
# libstdc++-v3 or they aren't desirable
@ -968,7 +975,7 @@ done
# 4) it is huge
# People can always precompile on their own whatever they want, but
# shipping this for everybody is unnecessary.
rm -rf %{buildroot}%{_prefix}/include/c++/%{gcc_version}/%{gcc_target_platform}/bits/stdc++.h.gch
rm -rf %{buildroot}%{_prefix}/include/c++/%{gcc_version}/%{gcc_target_platform}/bits/*.h.gch
%if %{build_libstdcxx_docs}
libstdcxx_doc_builddir=%{gcc_target_platform}/libstdc++-v3/doc/doxygen
@ -2332,8 +2339,40 @@ fi
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/plugin
%changelog
* Mon Jan 24 2011 Jakub Jelinek <jakub@redhat.com>
* Fri Jan 28 2011 Jakub Jelinek <jakub@redhat.com> 4.6.0-0.5
- update from trunk
- PRs bootstrap/47467, c++/43601, c++/47476, c/21659, c/43082, c/47473,
debug/45130, debug/45136, debug/45454, fortran/38536, fortran/47399,
fortran/47421, fortran/47448, fortran/47472, fortran/47474,
libfortran/47375, libfortran/47431, libfortran/47432,
libfortran/47491, libgfortran/47285, libstdc++/47387,
libstdc++/47433, libstdc++/47437, lto/44334, lto/47333,
lto/47423, middle-end/46949, middle-end/47401, middle-end/47411,
middle-end/47414, rtl-optimization/37273, rtl-optimization/44174,
rtl-optimization/44469, rtl-optimization/46856,
rtl-optimization/46878, rtl-optimization/47166,
rtl-optimization/47464, target/40125, target/45701,
target/46519, target/46997, target/47237, target/47246,
target/47385, target/47408, testsuite/45988,
tree-optimization/26854, tree-optimization/29832,
tree-optimization/43567, tree-optimization/43657,
tree-optimization/43884, tree-optimization/46168,
tree-optimization/46215, tree-optimization/46970,
tree-optimization/47190, tree-optimization/47228,
tree-optimization/47234, tree-optimization/47265,
tree-optimization/47271, tree-optimization/47382,
tree-optimization/47427, tree-optimization/47428,
tree-optimization/47443
- really fix the PCH issue on powerpc64 (PR pch/47430)
- handle truth_xor_expr in potential_constant_expression_1
(#672156, PR tree-optimization/47426)
- fix named section conflict handling (PR middle-end/31490)
- suppress -Woverlength-string warnings in __extension__ guarded
code
* Mon Jan 24 2011 Jakub Jelinek <jakub@redhat.com> 4.6.0-0.4
- build gcc-go and libgo* only on architectures that support it
- workaround PCH issue on powerpc64
* Sat Jan 22 2011 Jakub Jelinek <jakub@redhat.com> 4.6.0-0.3
- add gcc-go, libgo{,-devel,-static}, libquadmath{,-devel,-static},

View File

@ -0,0 +1,103 @@
2011-01-18 Tom Tromey <tromey@redhat.com>
* c-parser.c (disable_extension_diagnostics): Save
warn_overlength_strings.
(restore_extension_diagnostics): Restore warn_overlength_strings.
* gcc.dg/Woverlength-strings-pedantic-c89-ext.c: New file.
* gcc.dg/Woverlength-strings-pedantic-c90-ext.c: New file.
* gcc.dg/Woverlength-strings-pedantic-c99-ext.c: New file.
--- gcc/c-parser.c (revision 168933)
+++ gcc/c-parser.c (working copy)
@@ -1045,13 +1045,15 @@
| (warn_traditional << 2)
| (flag_iso << 3)
| (warn_long_long << 4)
- | (warn_cxx_compat << 5));
+ | (warn_cxx_compat << 5)
+ | (warn_overlength_strings << 6));
cpp_opts->cpp_pedantic = pedantic = 0;
warn_pointer_arith = 0;
cpp_opts->cpp_warn_traditional = warn_traditional = 0;
flag_iso = 0;
cpp_opts->cpp_warn_long_long = warn_long_long = 0;
warn_cxx_compat = 0;
+ warn_overlength_strings = 0;
return ret;
}
@@ -1067,6 +1069,7 @@
flag_iso = (flags >> 3) & 1;
cpp_opts->cpp_warn_long_long = warn_long_long = (flags >> 4) & 1;
warn_cxx_compat = (flags >> 5) & 1;
+ warn_overlength_strings = (flags >> 6) & 1;
}
/* Possibly kinds of declarator to parse. */
--- gcc/testsuite/gcc.dg/Woverlength-strings-pedantic-c89-ext.c (revision 0)
+++ gcc/testsuite/gcc.dg/Woverlength-strings-pedantic-c89-ext.c (revision 0)
@@ -0,0 +1,19 @@
+/* -Woverlength-strings complains about string constants which are too long
+ for the C standard's "minimum maximum" limits. It is off by default,
+ but implied by -pedantic. */
+
+/* { dg-options "-std=c89 -pedantic" } */
+
+#define TEN "xxxxxxxxxx"
+#define HUN TEN TEN TEN TEN TEN TEN TEN TEN TEN TEN
+#define THO HUN HUN HUN HUN HUN HUN HUN HUN HUN HUN
+
+/* C89's minimum-maximum is 509. */
+const char x510[] = __extension__ HUN HUN HUN HUN HUN TEN;
+
+/* C99's minimum-maximum is 4095. */
+const char x4096[] = __extension__
+ THO THO THO THO /* 4000 */
+ TEN TEN TEN TEN TEN /* 4050 */
+ TEN TEN TEN TEN /* 4090 */
+ "123456";
--- gcc/testsuite/gcc.dg/Woverlength-strings-pedantic-c90-ext.c (revision 0)
+++ gcc/testsuite/gcc.dg/Woverlength-strings-pedantic-c90-ext.c (revision 0)
@@ -0,0 +1,19 @@
+/* -Woverlength-strings complains about string constants which are too long
+ for the C standard's "minimum maximum" limits. It is off by default,
+ but implied by -pedantic. */
+
+/* { dg-options "-std=c90 -pedantic" } */
+
+#define TEN "xxxxxxxxxx"
+#define HUN TEN TEN TEN TEN TEN TEN TEN TEN TEN TEN
+#define THO HUN HUN HUN HUN HUN HUN HUN HUN HUN HUN
+
+/* C89's minimum-maximum is 509. */
+const char x510[] = __extension__ HUN HUN HUN HUN HUN TEN;
+
+/* C99's minimum-maximum is 4095. */
+const char x4096[] = __extension__
+ THO THO THO THO /* 4000 */
+ TEN TEN TEN TEN TEN /* 4050 */
+ TEN TEN TEN TEN /* 4090 */
+ "123456";
--- gcc/testsuite/gcc.dg/Woverlength-strings-pedantic-c99-ext.c (revision 0)
+++ gcc/testsuite/gcc.dg/Woverlength-strings-pedantic-c99-ext.c (revision 0)
@@ -0,0 +1,19 @@
+/* -Woverlength-strings complains about string constants which are too long
+ for the C standard's "minimum maximum" limits. It is off by default,
+ but implied by -pedantic. */
+
+/* { dg-options "-std=c99 -pedantic" } */
+
+#define TEN "xxxxxxxxxx"
+#define HUN TEN TEN TEN TEN TEN TEN TEN TEN TEN TEN
+#define THO HUN HUN HUN HUN HUN HUN HUN HUN HUN HUN
+
+/* C89's minimum-maximum is 509. */
+const char x510[] = HUN HUN HUN HUN HUN TEN;
+
+/* C99's minimum-maximum is 4095. */
+const char x4096[] = __extension__
+ THO THO THO THO /* 4000 */
+ TEN TEN TEN TEN TEN /* 4050 */
+ TEN TEN TEN TEN /* 4090 */
+ "123456";

View File

@ -15,7 +15,7 @@
--- gcc/Makefile.in.jj 2011-01-03 13:44:14.163900902 +0100
+++ gcc/Makefile.in 2011-01-04 17:48:53.588775911 +0100
@@ -985,6 +985,8 @@ GCC_PLUGIN_H = gcc-plugin.h highlev-plug
@@ -984,6 +984,8 @@ GCC_PLUGIN_H = gcc-plugin.h highlev-plug
PLUGIN_H = plugin.h $(GCC_PLUGIN_H)
PLUGIN_VERSION_H = plugin-version.h configargs.h
LIBFUNCS_H = libfuncs.h $(HASHTAB_H)
@ -24,7 +24,7 @@
#
# Now figure out from those variables how to compile and link.
@@ -1038,7 +1040,7 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY)
@@ -1037,7 +1039,7 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY)
# and the system's installed libraries.
LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) $(LIBDECNUMBER) \
$(HOST_LIBS)
@ -33,7 +33,7 @@
$(ZLIB)
# Any system libraries needed just for GNAT.
SYSLIBS = @GNAT_LIBEXC@
@@ -2671,39 +2673,39 @@ sese.o : sese.c sese.h $(CONFIG_H) $(SYS
@@ -2668,40 +2670,40 @@ sese.o : sese.c sese.h $(CONFIG_H) $(SYS
$(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) tree-pass.h value-prof.h
graphite.o : graphite.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DIAGNOSTIC_CORE_H) \
$(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h \
@ -48,17 +48,18 @@
$(SYSTEM_H) coretypes.h $(DIAGNOSTIC_CORE_H) $(TREE_FLOW_H) $(TREE_DUMP_H) \
- $(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h graphite-cloog-util.h \
- graphite-ppl.h graphite-poly.h graphite-clast-to-gimple.h \
- graphite-dependences.h graphite-cloog-compat.h
+ $(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h $(GRAPHITE_CLOOG_UTIL_H) \
+ graphite-ppl.h $(GRAPHITE_POLY_H) graphite-clast-to-gimple.h \
+ graphite-dependences.h
graphite-dependences.h graphite-cloog-compat.h
graphite-cloog-util.o : graphite-cloog-util.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h graphite-cloog-util.h graphite-cloog-compat.h
+ coretypes.h $(GRAPHITE_CLOOG_UTIL_H) graphite-cloog-compat.h
graphite-dependences.o : graphite-dependences.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
- sese.h graphite-ppl.h graphite-poly.h graphite-dependences.h
+ sese.h graphite-ppl.h $(GRAPHITE_POLY_H) graphite-dependences.h
- sese.h graphite-ppl.h graphite-poly.h graphite-dependences.h \
- graphite-cloog-util.h
+ sese.h graphite-ppl.h $(GRAPHITE_POLY_H) graphite-dependences.h \
+ $(GRAPHITE_CLOOG_UTIL_H)
graphite-flattening.o : graphite-flattening.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
- sese.h graphite-ppl.h graphite-poly.h
@ -87,7 +88,7 @@
graphite-sese-to-poly.h
tree-vect-loop.o: tree-vect-loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(GGC_H) $(TREE_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) \
@@ -3488,6 +3490,11 @@ $(out_object_file): $(out_file) $(CONFIG
@@ -3482,6 +3484,11 @@ $(out_object_file): $(out_file) $(CONFIG
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
$(out_file) $(OUTPUT_OPTION)
@ -101,7 +102,7 @@
$(LINKER) $(LINKERFLAGS) $(LDFLAGS) -o $@ \
--- gcc/graphite-cloog-compat.h.jj 2011-01-03 12:53:05.000000000 +0100
+++ gcc/graphite-cloog-compat.h 2011-01-04 17:34:09.857757544 +0100
@@ -272,4 +272,261 @@ static inline int cloog_matrix_nrows (Cl
@@ -272,4 +272,263 @@ static inline int cloog_matrix_nrows (Cl
return m->NbRows;
}
#endif /* CLOOG_ORG */
@ -215,7 +216,8 @@
+ DYNSYM (ppl_initialize); \
+ DYNSYM (ppl_new_Constraint_System_from_Constraint); \
+ DYNSYM (ppl_new_C_Polyhedron_from_Constraint_System); \
+ DYNSYM (ppl_Polyhedron_affine_image);
+ DYNSYM (ppl_Polyhedron_affine_image); \
+ DYNSYM (ppl_io_fprint_Pointset_Powerset_C_Polyhedron);
+extern struct
+{
+ bool inited;
@ -358,6 +360,7 @@
+#define ppl_new_Constraint_System_from_Constraint (*cloog_pointers__.p_ppl_new_Constraint_System_from_Constraint)
+#define ppl_new_C_Polyhedron_from_Constraint_System (*cloog_pointers__.p_ppl_new_C_Polyhedron_from_Constraint_System)
+#define ppl_Polyhedron_affine_image (*cloog_pointers__.p_ppl_Polyhedron_affine_image)
+#define ppl_io_fprint_Pointset_Powerset_C_Polyhedron (cloog_pointers__.p_ppl_io_fprint_Pointset_Powerset_C_Polyhedron)
+
+#define cloog_finalize (*cloog_pointers__.p_ppl_finalize)
+

121
gcc46-ppl-0.10.patch Normal file
View File

@ -0,0 +1,121 @@
2011-01-28 Jakub Jelinek <jakub@redhat.com>
Revert:
2011-01-25 Sebastian Pop <sebastian.pop@amd.com>
* configure: Regenerated.
* configure.ac: Check for version 0.11 (or later revision) of PPL.
gcc/
* doc/install.texi: Update the expected version number of PPL to 0.11.
* graphite-ppl.c (ppl_powerset_is_empty): Remove now dead code under
#if PPL_VERSION_MINOR < 11.
--- gcc/doc/install.texi (revision 169207)
+++ gcc/doc/install.texi (revision 169206)
@@ -332,7 +332,7 @@ and @option{--with-mpc-include}. Altern
distribution is found in a subdirectory of your GCC sources named
@file{mpc}, it will be built together with GCC@.
-@item Parma Polyhedra Library (PPL) version 0.11
+@item Parma Polyhedra Library (PPL) version 0.10
Necessary to build GCC with the Graphite loop optimizations.
It can be downloaded from @uref{http://www.cs.unipr.it/ppl/Download/}.
--- gcc/graphite-ppl.c (revision 169207)
+++ gcc/graphite-ppl.c (revision 169206)
@@ -521,6 +521,15 @@ debug_gmp_value (mpz_t val)
bool
ppl_powerset_is_empty (ppl_Pointset_Powerset_C_Polyhedron_t ps)
{
+#if PPL_VERSION_MAJOR == 0 && PPL_VERSION_MINOR < 11
+ /* On PPL 0.10,
+ ppl_Pointset_Powerset_C_Polyhedron_contains_integer_point (ps)
+ takes too long on some cases and so we call _is_empty instead. */
+ return ppl_Pointset_Powerset_C_Polyhedron_is_empty (ps);
+
+#else
+ /* On PPL 0.11 or later, we can check for integer feasibility using
+ the PIP solver. */
ppl_PIP_Problem_t pip;
ppl_dimension_type d;
ppl_const_Constraint_System_t pcs;
@@ -561,6 +570,7 @@ ppl_powerset_is_empty (ppl_Pointset_Powe
ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (end);
return !has_integer_solutions;
+#endif
}
#endif
--- configure.ac (revision 169207)
+++ configure.ac (revision 169206)
@@ -1668,9 +1668,9 @@ ENABLE_PPL_CHECK=yes)
if test "x$with_ppl" != "xno" -a "${ENABLE_PPL_CHECK}" = "yes"; then
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $pplinc $gmpinc"
- AC_MSG_CHECKING([for version 0.11 (or later revision) of PPL])
+ AC_MSG_CHECKING([for version 0.10 (or later revision) of PPL])
AC_TRY_COMPILE([#include "ppl_c.h"],[
- #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 11
+ #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 10
choke me
#endif
], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); ppllibs= ; pplinc= ; with_ppl=no ])
--- configure (revision 169207)
+++ configure (revision 169206)
@@ -5716,8 +5716,8 @@ fi
if test "x$with_ppl" != "xno" -a "${ENABLE_PPL_CHECK}" = "yes"; then
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $pplinc $gmpinc"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.11 (or later revision) of PPL" >&5
-$as_echo_n "checking for version 0.11 (or later revision) of PPL... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.10 (or later revision) of PPL" >&5
+$as_echo_n "checking for version 0.10 (or later revision) of PPL... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include "ppl_c.h"
@@ -5725,7 +5725,7 @@ int
main ()
{
- #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 11
+ #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 10
choke me
#endif
--- gcc/testsuite/gcc.dg/graphite/interchange-11.c.jj 2011-01-28 09:38:11.000000000 +0100
+++ gcc/testsuite/gcc.dg/graphite/interchange-11.c 2011-01-28 11:06:56.461429848 +0100
@@ -46,5 +46,5 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
--- gcc/testsuite/gcc.dg/graphite/interchange-13.c.jj 2011-01-28 09:38:12.000000000 +0100
+++ gcc/testsuite/gcc.dg/graphite/interchange-13.c 2011-01-28 11:07:08.182429223 +0100
@@ -50,5 +50,5 @@ main (void)
}
-/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
--- gcc/testsuite/gcc.dg/graphite/interchange-1.c.jj 2011-01-28 09:38:13.000000000 +0100
+++ gcc/testsuite/gcc.dg/graphite/interchange-1.c 2011-01-28 11:06:42.160429193 +0100
@@ -49,5 +49,5 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
--- gcc/testsuite/gfortran.dg/graphite/interchange-3.f90.jj 2011-01-28 09:38:05.000000000 +0100
+++ gcc/testsuite/gfortran.dg/graphite/interchange-3.f90 2011-01-28 11:07:46.313420441 +0100
@@ -24,5 +24,5 @@ Program FOO
end Program FOO
-! { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } }
+! { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } }
! { dg-final { cleanup-tree-dump "graphite" } }

289
gcc46-pr31490.patch Normal file
View File

@ -0,0 +1,289 @@
2011-01-27 Jakub Jelinek <jakub@redhat.com>
PR middle-end/31490
* output.h (SECTION_RELRO): Define.
(SECTION_MACH_DEP): Adjust.
(get_variable_section): New prototype.
* config/darwin.h (SECTION_NO_ANCHOR): Adjust.
* varpool.c (varpool_finalize_named_section_flags): New function.
(varpool_assemble_pending_decls): Call it.
* cgraph.h (varpool_finalize_named_section_flags): New prototype.
* cgraphunit.c (cgraph_output_in_order): Call
varpool_finalize_named_section_flags.
* varasm.c (get_section): Allow section flags conflicts between
relro and read-only sections if the section hasn't been declared yet.
Set SECTION_OVERRIDE after diagnosing section type conflict.
(get_variable_section): No longer static.
(default_section_type_flags): Use SECTION_WRITE | SECTION_RELRO for
readonly sections that need relocations.
(decl_readonly_section_1): New function.
(decl_readonly_section): Use it.
Revert:
2010-11-17 Dinar Temirbulatov <dtemirbulatov@gmail.com>
Steve Ellcey <sje@cup.hp.com>
PR middle-end/31490
* varasm.c (categorize_decl_for_section): Ignore reloc_rw_mask
if section attribute used.
* gcc.dg/pr31490-2.c: New test.
* gcc.dg/pr31490-3.c: New test.
* gcc.dg/pr31490-4.c: New test.
--- gcc/output.h.jj 2011-01-27 17:33:28.200496345 +0100
+++ gcc/output.h 2011-01-27 17:40:33.355649071 +0100
@@ -441,7 +441,8 @@ extern void no_asm_to_stream (FILE *);
#define SECTION_DECLARED 0x100000 /* section has been used */
#define SECTION_STYLE_MASK 0x600000 /* bits used for SECTION_STYLE */
#define SECTION_COMMON 0x800000 /* contains common data */
-#define SECTION_MACH_DEP 0x1000000 /* subsequent bits reserved for target */
+#define SECTION_RELRO 0x1000000 /* data is readonly after relocation processing */
+#define SECTION_MACH_DEP 0x2000000 /* subsequent bits reserved for target */
/* This SECTION_STYLE is used for unnamed sections that we can switch
to using a special assembler directive. */
@@ -585,6 +586,7 @@ extern section *get_unnamed_section (uns
const void *);
extern section *get_section (const char *, unsigned int, tree);
extern section *get_named_section (tree, const char *, int);
+extern section *get_variable_section (tree, bool);
extern void place_block_symbol (rtx);
extern rtx get_section_anchor (struct object_block *, HOST_WIDE_INT,
enum tls_model);
--- gcc/varpool.c.jj 2011-01-27 17:33:28.229830104 +0100
+++ gcc/varpool.c 2011-01-27 19:48:24.567639053 +0100
@@ -565,11 +565,29 @@ varpool_remove_unreferenced_decls (void)
varpool_analyze_pending_decls ();
}
+/* For variables in named sections make sure get_variable_section
+ is called before we switch to those sections. Then section
+ conflicts between read-only and read-only requiring relocations
+ sections can be resolved. */
+void
+varpool_finalize_named_section_flags (struct varpool_node *node)
+{
+ if (!TREE_ASM_WRITTEN (node->decl)
+ && !node->alias
+ && !node->in_other_partition
+ && !DECL_EXTERNAL (node->decl)
+ && TREE_CODE (node->decl) == VAR_DECL
+ && !DECL_HAS_VALUE_EXPR_P (node->decl)
+ && DECL_SECTION_NAME (node->decl))
+ get_variable_section (node->decl, false);
+}
+
/* Output all variables enqueued to be assembled. */
bool
varpool_assemble_pending_decls (void)
{
bool changed = false;
+ struct varpool_node *node;
if (seen_error ())
return false;
@@ -580,6 +598,9 @@ varpool_assemble_pending_decls (void)
elsewhere. */
varpool_analyze_pending_decls ();
+ for (node = varpool_nodes_queue; node; node = node->next_needed)
+ varpool_finalize_named_section_flags (node);
+
while (varpool_nodes_queue)
{
struct varpool_node *node = varpool_nodes_queue;
--- gcc/config/darwin.h.jj 2011-01-27 17:33:28.217391021 +0100
+++ gcc/config/darwin.h 2011-01-27 17:40:33.356655497 +0100
@@ -654,7 +654,7 @@ int darwin_label_is_anonymous_local_objc
/* Private flag applied to disable section-anchors in a particular section.
This needs to be kept in sync with the flags used by varasm.c (defined in
output.h). */
-#define SECTION_NO_ANCHOR 0x2000000
+#define SECTION_NO_ANCHOR 0x4000000
/* Declare the section variables. */
#ifndef USED_FOR_TARGET
--- gcc/cgraph.h.jj 2011-01-27 17:33:28.011433405 +0100
+++ gcc/cgraph.h 2011-01-27 17:33:28.011433405 +0100
@@ -720,6 +720,7 @@ bool cgraph_node_can_be_local_p (struct
struct varpool_node * varpool_get_node (const_tree decl);
void varpool_remove_node (struct varpool_node *node);
+void varpool_finalize_named_section_flags (struct varpool_node *node);
bool varpool_assemble_pending_decls (void);
bool varpool_assemble_decl (struct varpool_node *node);
bool varpool_analyze_pending_decls (void);
--- gcc/varasm.c.jj 2011-01-27 17:40:25.196565130 +0100
+++ gcc/varasm.c 2011-01-27 17:40:33.361429176 +0100
@@ -119,6 +119,7 @@ static void output_addressed_constants (
static unsigned HOST_WIDE_INT array_size_for_constructor (tree);
static unsigned min_align (unsigned, unsigned);
static void globalize_decl (tree);
+static bool decl_readonly_section_1 (enum section_category);
#ifdef BSS_SECTION_ASM_OP
#ifdef ASM_OUTPUT_BSS
static void asm_output_bss (FILE *, tree, const char *,
@@ -294,11 +295,31 @@ get_section (const char *name, unsigned
if ((sect->common.flags & ~SECTION_DECLARED) != flags
&& ((sect->common.flags | flags) & SECTION_OVERRIDE) == 0)
{
+ /* It is fine if one of the section flags is
+ SECTION_WRITE | SECTION_RELRO and the other has none of these
+ flags (i.e. read-only) in named sections and either the
+ section hasn't been declared yet or has been declared as writable.
+ In that case just make sure the resulting flags are
+ SECTION_WRITE | SECTION_RELRO, ie. writable only because of
+ relocations. */
+ if (((sect->common.flags ^ flags) & (SECTION_WRITE | SECTION_RELRO))
+ == (SECTION_WRITE | SECTION_RELRO)
+ && (sect->common.flags
+ & ~(SECTION_DECLARED | SECTION_WRITE | SECTION_RELRO))
+ == (flags & ~(SECTION_WRITE | SECTION_RELRO))
+ && ((sect->common.flags & SECTION_DECLARED) == 0
+ || (sect->common.flags & SECTION_WRITE)))
+ {
+ sect->common.flags |= (SECTION_WRITE | SECTION_RELRO);
+ return sect;
+ }
/* Sanity check user variables for flag changes. */
if (decl == 0)
decl = sect->named.decl;
gcc_assert (decl);
error ("%+D causes a section type conflict", decl);
+ /* Make sure we don't error about one section multiple times. */
+ sect->common.flags |= SECTION_OVERRIDE;
}
}
return sect;
@@ -985,7 +1006,7 @@ align_variable (tree decl, bool dont_out
should be placed. PREFER_NOSWITCH_P is true if a noswitch
section should be used wherever possible. */
-static section *
+section *
get_variable_section (tree decl, bool prefer_noswitch_p)
{
addr_space_t as = ADDR_SPACE_GENERIC;
@@ -6026,8 +6047,18 @@ default_section_type_flags (tree decl, c
if (decl && TREE_CODE (decl) == FUNCTION_DECL)
flags = SECTION_CODE;
- else if (decl && decl_readonly_section (decl, reloc))
- flags = 0;
+ else if (decl)
+ {
+ enum section_category category
+ = categorize_decl_for_section (decl, reloc);
+ if (decl_readonly_section_1 (category))
+ flags = 0;
+ else if (category == SECCAT_DATA_REL_RO
+ || category == SECCAT_DATA_REL_RO_LOCAL)
+ flags = SECTION_WRITE | SECTION_RELRO;
+ else
+ flags = SECTION_WRITE;
+ }
else
flags = SECTION_WRITE;
@@ -6250,17 +6281,13 @@ categorize_decl_for_section (const_tree
/* Here the reloc_rw_mask is not testing whether the section should
be read-only or not, but whether the dynamic link will have to
do something. If so, we wish to segregate the data in order to
- minimize cache misses inside the dynamic linker. If the data
- has a section attribute, ignore reloc_rw_mask() so that all data
- in a given named section is catagorized in the same way. */
- if (reloc & targetm.asm_out.reloc_rw_mask ()
- && !lookup_attribute ("section", DECL_ATTRIBUTES (decl)))
+ minimize cache misses inside the dynamic linker. */
+ if (reloc & targetm.asm_out.reloc_rw_mask ())
ret = reloc == 1 ? SECCAT_DATA_REL_LOCAL : SECCAT_DATA_REL;
else
ret = SECCAT_DATA;
}
- else if (reloc & targetm.asm_out.reloc_rw_mask ()
- && !lookup_attribute ("section", DECL_ATTRIBUTES (decl)))
+ else if (reloc & targetm.asm_out.reloc_rw_mask ())
ret = reloc == 1 ? SECCAT_DATA_REL_RO_LOCAL : SECCAT_DATA_REL_RO;
else if (reloc || flag_merge_constants < 2)
/* C and C++ don't allow different variables to share the same
@@ -6311,10 +6338,10 @@ categorize_decl_for_section (const_tree
return ret;
}
-bool
-decl_readonly_section (const_tree decl, int reloc)
+static bool
+decl_readonly_section_1 (enum section_category category)
{
- switch (categorize_decl_for_section (decl, reloc))
+ switch (category)
{
case SECCAT_RODATA:
case SECCAT_RODATA_MERGE_STR:
@@ -6322,13 +6349,17 @@ decl_readonly_section (const_tree decl,
case SECCAT_RODATA_MERGE_CONST:
case SECCAT_SRODATA:
return true;
- break;
default:
return false;
- break;
}
}
+bool
+decl_readonly_section (const_tree decl, int reloc)
+{
+ return decl_readonly_section_1 (categorize_decl_for_section (decl, reloc));
+}
+
/* Select a section based on the above categorization. */
section *
--- gcc/cgraphunit.c.jj 2011-01-27 17:33:29.416940770 +0100
+++ gcc/cgraphunit.c 2011-01-27 19:48:24.567639053 +0100
@@ -1708,6 +1708,10 @@ cgraph_output_in_order (void)
varpool_empty_needed_queue ();
for (i = 0; i < max; ++i)
+ if (nodes[i].kind == ORDER_VAR)
+ varpool_finalize_named_section_flags (nodes[i].u.v);
+
+ for (i = 0; i < max; ++i)
{
switch (nodes[i].kind)
{
--- gcc/testsuite/gcc.dg/pr31490-2.c.jj 2011-01-27 17:40:33.365546146 +0100
+++ gcc/testsuite/gcc.dg/pr31490-2.c 2011-01-27 17:40:33.365546146 +0100
@@ -0,0 +1,7 @@
+/* PR middle-end/31490 */
+/* { dg-do compile } */
+/* { dg-options "-fpic" { target fpic } } */
+/* { dg-require-named-sections "" } */
+
+const char *const x __attribute__((section("foo"))) = "";
+const char *const g __attribute__((section("foo"))) = (const char *) 0;
--- gcc/testsuite/gcc.dg/pr31490-3.c.jj 2011-01-27 17:40:33.365546146 +0100
+++ gcc/testsuite/gcc.dg/pr31490-3.c 2011-01-27 17:40:33.365546146 +0100
@@ -0,0 +1,7 @@
+/* PR middle-end/31490 */
+/* { dg-do compile } */
+/* { dg-options "-fpic" { target fpic } } */
+/* { dg-require-named-sections "" } */
+
+const char *const x __attribute__((section("foo"))) = (const char *) 0;
+const char *const g __attribute__((section("foo"))) = "bar";
--- gcc/testsuite/gcc.dg/pr31490-4.c.jj 2011-01-27 17:40:33.366545270 +0100
+++ gcc/testsuite/gcc.dg/pr31490-4.c 2011-01-27 17:40:33.366545270 +0100
@@ -0,0 +1,10 @@
+/* PR middle-end/31490 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-options "-O2 -fpic" { target fpic } } */
+/* { dg-require-named-sections "" } */
+
+const char *const x __attribute__((section("foo"))) = "";
+const char *const g __attribute__((section("foo"))) = (const char *) 0;
+const char *const y __attribute__((section("bar"))) = (const char *) 0;
+const char *const h __attribute__((section("bar"))) = "bar";

View File

@ -1,2 +1,2 @@
2659f09c2e43ef8b7d4406321753f1b2 fastjar-0.97.tar.gz
89ee1132792194e62424dee99a780c60 gcc-4.6.0-20110122.tar.bz2
6b870b2c1d67a5e2822ffc4fc48f15a1 gcc-4.6.0-20110128.tar.bz2