This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
--- gcc/testsuite/g++.old-deja/g++.other/comdat5.C.jj 2004-10-04 11:20:08.335577980 +0200 +++ gcc/testsuite/g++.old-deja/g++.other/comdat5.C 2004-10-04 11:19:49.362989353 +0200 @@ -0,0 +1,5 @@ +// { dg-do link } +// { dg-additional-sources " comdat5-aux.cc" } +// { dg-options "-O2 -fPIC" } + +#include "comdat4.C" --- gcc/testsuite/g++.old-deja/g++.other/comdat5-aux.cc.jj 2004-10-04 11:20:03.496448065 +0200 +++ gcc/testsuite/g++.old-deja/g++.other/comdat5-aux.cc 2004-10-04 11:19:59.249211735 +0200 @@ -0,0 +1,1 @@ +#include "comdat4-aux.cc" fails on powerpc-redhat-linux. The local label at the start of jump table is spilled into .got2 section.
GCC 3.3.x has the same problem. Not sure if we want to backport COMDAT patches to GCC 3.3 and 3.4. Other possible alternative would be to: a) change ppc32 linker script, so that .got2 section includes both .got2 and .gnu.linkonce.got2.* sections b) change rs6000 backend, so that it uses per-function .got2 sections for linkonce functions Or change ld to not error on this problem for another 3 years until all compilers use COMDAT.
Well, the COMDAT changes on HEAD don't solve this problem either. So I guess we need either per-function .got2 for comdat functions, or revert the binutils warnings (or at least turn them off by default).
If we turn off this ld warning, then we lose sight of the fact that gcc does have a bug here. gcc ought to be using linkonce for all sections emitted for a given function if any section is linkonce (waiver granted for debug and other sections that the linker edits).
Confirmed.
Is there a workaround (some --foo option for gcc/ld) for these link errors?
Created an attachment (id=9368) [edit] broken patch I'm actually not really sure if COMDAT .got2/.got1/.toc1 etc. (as implemented in this patch) is the way to go. The reason is that then suddenly we can't have one constant pool but need per-function constant pools (e.g. with this patch pool_allocator.cc -m32 -O2 -fPIC fails to assemble). Can't we instead do link editing of these ppc sections?
http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01757.html
Fixed by linker patch http://sources.redhat.com/ml/binutils-cvs/2005-07/msg00201.html
Do we want to check the comdat5* testcase in?
Subject: Bug 17828 Author: jakub Date: Mon Nov 21 09:52:20 2005 New Revision: 107297 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=107297 Log: PR target/17828 * g++.old-deja/g++.other/comdat5.C: New test. * g++.old-deja/g++.other/comdat5-aux.cc: New file. Added: branches/gcc-4_0-rhl-branch/gcc/testsuite/g++.old-deja/g++.other/comdat5-aux.cc branches/gcc-4_0-rhl-branch/gcc/testsuite/g++.old-deja/g++.other/comdat5.C Modified: branches/gcc-4_0-rhl-branch/gcc/testsuite/ChangeLog
Subject: Bug 17828 Author: jakub Date: Thu Dec 8 21:47:10 2005 New Revision: 108245 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108245 Log: PR target/17828 * g++.old-deja/g++.other/comdat5.C: New test. * g++.old-deja/g++.other/comdat5-aux.cc: New file. Added: trunk/gcc/testsuite/g++.old-deja/g++.other/comdat5-aux.cc trunk/gcc/testsuite/g++.old-deja/g++.other/comdat5.C Modified: trunk/gcc/testsuite/ChangeLog
Subject: Bug 17828 Author: jakub Date: Thu Dec 8 21:53:59 2005 New Revision: 108251 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108251 Log: PR target/17828 * g++.old-deja/g++.other/comdat5.C: New test. * g++.old-deja/g++.other/comdat5-aux.cc: New file. Added: branches/gcc-4_1-branch/gcc/testsuite/g++.old-deja/g++.other/comdat5-aux.cc branches/gcc-4_1-branch/gcc/testsuite/g++.old-deja/g++.other/comdat5.C Modified: branches/gcc-4_1-branch/gcc/testsuite/ChangeLog