This time __please__ follow standard procedures instead of doing it like PR33125/PR33126 where the earlier submission was made a duplicate of a later one . Which then was left unconfirmed for a lengthy period (6+ hours) and never formally closed as resolved leaving the parties hanging. Using built-in specs. Target: powerpc-unknown-linux-gnu Configured with: ../gcc-4.3.0/configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --host=powerpc-unknown-linux-gnu --build=powerpc-unknown-linux-gnu --enable-__cxa_atexit --enable-threads=posix --enable-shared --enable-clocale=gnu --enable-bootstrap --enable-languages=c,c++,fortran --enable-altivec --disable-libssp --disable-decimal-float --disable-libmudflap --disable-nls --disable-werror --disable-multilib --with-ibmlongdouble --with-cpu=G4 --enable-clocale=gnu --with-system-zlib Thread model: posix gcc version 4.3.0 20070823 (experimental) (GCC) /usr/libexec/gcc/powerpc-unknown-linux-gnu/4.3.0/cc1plus -E -quiet -nostdinc++ -v -I/var/tmp/43/build-140/powerpc-unknown-linux-gnu/libstdc++-v3/include/powerpc-unknown-linux-gnu -I/var/tmp/43/build-140/powerpc-unknown-linux-gnu/libstdc++-v3/include -I/var/tmp/43/gcc-4.3.0/libstdc++-v3/libsupc++ -iprefix /var/tmp/43/build-140/gcc/../lib/gcc/powerpc-unknown-linux-gnu/4.3.0/ -D_GNU_SOURCE -D__unix__ -D__gnu_linux__ -D__linux__ -Dunix -D__unix -Dlinux -D__linux -Asystem=linux -Asystem=unix -Asystem=posix -D_GNU_SOURCE -isystem /usr/powerpc-unknown-linux-gnu/include -isystem /usr/powerpc-unknown-linux-gnu/sys-include ../gcc-4.3.0/libstdc++-v3/src/system_error.cc -mcpu=G4 -std=gnu++0x -Wall -Wextra -Wwrite-strings -Wcast-qual -fno-implicit-templates -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -fworking-directory -O2 -fpch-preprocess -o system_error.ii ignoring nonexistent directory "/usr/powerpc-unknown-linux-gnu/include" ignoring nonexistent directory "/usr/powerpc-unknown-linux-gnu/sys-include" ignoring nonexistent directory "/var/tmp/43/build-140/gcc/../lib/gcc/powerpc-unknown-linux-gnu/4.3.0/include" ignoring nonexistent directory "/var/tmp/43/build-140/gcc/../lib/gcc/powerpc-unknown-linux-gnu/4.3.0/include-fixed" ignoring nonexistent directory "/var/tmp/43/build-140/gcc/../lib/gcc/powerpc-unknown-linux-gnu/4.3.0/../../../../powerpc-unknown-linux-gnu/include" ignoring nonexistent directory "/var/tmp/43/build-140/gcc/../lib/gcc/../../lib/gcc/powerpc-unknown-linux-gnu/4.3.0/include" ignoring nonexistent directory "/var/tmp/43/build-140/gcc/../lib/gcc/../../lib/gcc/powerpc-unknown-linux-gnu/4.3.0/include-fixed" ignoring nonexistent directory "/var/tmp/43/build-140/gcc/../lib/gcc/../../lib/gcc/powerpc-unknown-linux-gnu/4.3.0/../../../../powerpc-unknown-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /var/tmp/43/build-140/powerpc-unknown-linux-gnu/libstdc++-v3/include/powerpc-unknown-linux-gnu /var/tmp/43/build-140/powerpc-unknown-linux-gnu/libstdc++-v3/include /var/tmp/43/gcc-4.3.0/libstdc++-v3/libsupc++ /usr/include/libffi /usr/local/include /usr/include End of search list. /usr/libexec/gcc/powerpc-unknown-linux-gnu/4.3.0/cc1plus -fpreprocessed system_error.ii -quiet -dumpbase system_error.cc -mcpu=G4 -auxbase-strip system_error.o -g -O2 -Wall -Wextra -Wwrite-strings -Wcast-qual -std=gnu++0x -version -fno-implicit-templates -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -o system_error.s GNU C++ (GCC) version 4.3.0 20070823 (experimental) (powerpc-unknown-linux-gnu) compiled by GNU C version 4.3.0 20070823 (experimental), GMP version 4.2.1, MPFR version 2.2.1-p5. GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 91efee225a5243299b9fb0dada305fe7 ../gcc-4.3.0/libstdc++-v3/src/system_error.cc:67: error: std::system_category causes a section type conflict
Created attachment 14097 [details] preprocessed
I get this too: /home/apinski/src/local/gcc/libstdc++-v3/src/system_error.cc:67: error: std::system_category causes a section type conflict
http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01566.html Broke this.
Testcase: namespace std { struct gnu_error_category { virtual const int name() const {} }; const gnu_error_category gnu_category; } namespace std { const gnu_error_category& system_category = gnu_category; } ------- CUT ---- Compile with -O1 -fdata-section.
A patch was posted: http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01683.html
This is related to PR 31490
Subject: Bug 33168 Author: dje Date: Wed Aug 29 17:01:35 2007 New Revision: 127910 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127910 Log: 2007-08-29 Paolo Bonzini <bonzini@gnu.org> PR target/33168 * config/rs6000/rs6000.c (compare_section_name): New function. (rs6000_elf_in_small_data_p): Compare section prefixes instead of full name. Modified: trunk/gcc/ChangeLog trunk/gcc/config/rs6000/rs6000.c
Subject: Bug 33168 Author: jakub Date: Thu Aug 30 16:43:19 2007 New Revision: 127928 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127928 Log: PR target/33168 * config/rs6000/rs6000.c (rs6000_elf_in_small_data_p): Return true if any of the compare_section_name calls returned true, rather than if any returned false. Modified: trunk/gcc/ChangeLog trunk/gcc/config/rs6000/rs6000.c
Fixed.
This still fails in 64-bit mode bootstrap.
We first choose a section here, when decl readonly_flag is false: #0 get_section (name=0x40000cca824 ".data._ZSt15system_category", flags=512, decl=0x40000e44000) at /src/gcc-current/gcc/varasm.c:527 #1 0x000000001067bd70 in get_block_for_decl (decl=0x40000e44000) at /src/gcc-current/gcc/varasm.c:1196 #2 0x000000001067c588 in make_decl_rtl (decl=0x40000e44000) at /src/gcc-current/gcc/varasm.c:1395 #3 0x000000001067d3d8 in notice_global_symbol (decl=0x40000e44000) at /src/gcc-current/gcc/varasm.c:1558 #4 0x00000000106dd04c in varpool_mark_needed_node (node=0x40000f12500) at /src/gcc-current/gcc/varpool.c:192 #5 0x00000000106dda78 in varpool_finalize_decl (decl=0x40000e44000) at /src/gcc-current/gcc/varpool.c:297 #6 0x0000000010403fac in rest_of_decl_compilation (decl=0x40000e44000, top_level=1, at_end=0) at /src/gcc-current/gcc/passes.c:192 #7 0x000000001002c624 in make_rtl_for_nonlocal_decl (decl=0x40000e44000, init=0x0, asmspec=0x10b4f398 "") at /src/gcc-current/gcc/cp/decl.c:5136 #8 0x000000001003e1ec in cp_finish_decl (decl=0x40000e44000, init=0x0, init_const_expr_p=0 '\0', asmspec_tree=<value optimized out>, flags=8) at /src/gcc-current/gcc/cp/decl.c:5511 Note flags=512 is SECTION_WRITE in get_section call. We set readonly near the end of cp_finish_decl. This change in the readonly flag is the cause of later trouble when assemble_variable is called, as targetm.section_type_flags (called from get_named_section, from get_variable_section, from assemble_variable) now returns 0. get_section is then called with flags=0, triggering the error.
Segher has a patch for related PR 31490 that fixed the original 32-bit bootstrap problem. Yesterday I confirmed that it also fixes the 64-bit powerpc64-linux bootstrap for all languages but Ada. The only test differences between a 64-bit build with his patch and a 32-bit build without it are gcc.dg/20051207-3.c, which he earlier said is expected to behave differently with this patch, and cc1 segfaults with some of the gcc.c-torture/compile/limits-*.c tests, which also fail with a C-only 64-bit bootstrap without the patch. Here's the patch I tested: Index: gcc/varasm.c =================================================================== --- gcc/varasm.c (revision 129361) +++ gcc/varasm.c (working copy) @@ -536,10 +536,20 @@ else { sect = *slot; + + /* Sanity check user variables for flag changes. */ if ((sect->common.flags & ~SECTION_DECLARED) != flags && ((sect->common.flags | flags) & SECTION_OVERRIDE) == 0) { - /* Sanity check user variables for flag changes. */ + /* Allow mixed writable and read-only objects in named sections. */ + if ((sect->common.flags & SECTION_NAMED) != 0 + && ((sect->common.flags ^ flags) & ~SECTION_DECLARED) + == SECTION_WRITE) + { + sect->common.flags |= SECTION_WRITE; + return sect; + } + if (decl == 0) decl = sect->named.decl; gcc_assert (decl); When I first tested this patch a month ago (with a 32-bit bootstrap) there was a discussion between Segher and Dinar Temirbulatov about the best way to fix this; I've copied both of them.
I disagree with this patch (at least for this bug). The bug is on cp_finish_decl side. Working on it.
Smaller testcase: // PR target/33168 // { dg-do compile } // { dg-options "-O2 -fdata-sections" } extern const int& foo; namespace { const int bar = 16; } const int &foo = bar;
Subject: Bug 33168 Author: jakub Date: Tue Nov 6 08:33:25 2007 New Revision: 129922 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129922 Log: PR target/33168 * decl.c (cp_finish_decl): Call make_rtl_for_nonlocal_decl already with the final TREE_READONLY flag in place. processing_template_decl is known to be 0 in this part of function. * g++.dg/other/datasec1.C: New test. Added: trunk/gcc/testsuite/g++.dg/other/datasec1.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/testsuite/ChangeLog
Fixed, ppc64-linux bootstraps just fine now even without --with-cpu=default32.
Subject: Bug 33168 Author: aoliva Date: Thu Jan 3 05:15:42 2008 New Revision: 131276 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131276 Log: gcc/cp/ChangeLog: PR target/33168 * decl.c (cp_finish_decl): Call make_rtl_for_nonlocal_decl already with the final TREE_READONLY flag in place. processing_template_decl is known to be 0 in this part of function. gcc/testsuite/ChangeLog: PR target/33168 * g++.dg/other/datasec1.C: New test. Added: branches/var-tracking-assignments-branch/gcc/testsuite/g++.dg/other/datasec1.C Modified: branches/var-tracking-assignments-branch/gcc/cp/ChangeLog branches/var-tracking-assignments-branch/gcc/cp/decl.c branches/var-tracking-assignments-branch/gcc/testsuite/ChangeLog