This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
The attached testcase does not compile for ppc64 using gcc confgured to generate ppc/ppc64 code. Attached is a reduced testcase from kernel. This error was not happening with gcc 4.2 snapshot from January. I think it is related to static inline and extern inline. compile the attached testcase gcc -m64 -c test.c test.c:51: error: __ksymtab_cpu_add_sysdev_attr_group causes a section type conflict
Created an attachment (id=13333) [edit] testcase testcase to reproduce the problem.
Reduced testcase: int cpu_ (void *attr) {} const unsigned long _1 __attribute__((section("__"))) = (unsigned long)&cpu_ ; const unsigned long _group __attribute__((section("__"))) = 0;
> This error was not happening with gcc 4.2 snapshot from January. My reduced testcase shows it happens even in 4.0.2. I don't have any thing older than that right off hand.
looks like regression is caused by PR26090 fix
I can reproduce this bug any architecture with -fpic option
workaround for the bug: --- gcc/varasm.c-orig 2007-05-02 19:15:04.000000000 +0400 +++ gcc/varasm.c 2007-05-02 19:16:17.000000000 +0400 @@ -5519,6 +5519,8 @@ decl_readonly_section (tree decl, int re case SECCAT_RODATA_MERGE_STR_INIT: case SECCAT_RODATA_MERGE_CONST: case SECCAT_SRODATA: + case SECCAT_DATA_REL_RO: + case SECCAT_DATA_REL_RO_LOCAL: return true; break; default:
> I can reproduce this bug any architecture with -fpic option Oh and this is why it fails without -fpic on powerpc64-linux-gnu as really it is always PIC with the toc based ABI. >workaround for the bug: Actually that looks like the correct fix from reading output.h's comment about these section categories.
Bisecting shows that the original bug (powerpc64 Linux build errors out) is caused by r122781. I didn't actually test on 4.2 but the same patch is applied there (as r122782). If the reduced testcase in comment #2 fails on older compilers, it is likely a different bug (or an invalid testcase); if a bug, please file a separate PR for it.
This patch fixes both testcases --- gcc/varasm.c.orig 2007-05-16 21:32:11.000000000 +0400 +++ gcc/varasm.c 2007-05-16 21:36:14.000000000 +0400 @@ -5762,12 +5762,14 @@ categorize_decl_for_section (tree decl, 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 (reloc & targetm.asm_out.reloc_rw_mask ()) + if (reloc & targetm.asm_out.reloc_rw_mask () + && !lookup_attribute ("section", DECL_ATTRIBUTES (decl))) ret = reloc == 1 ? SECCAT_DATA_REL_LOCAL : SECCAT_DATA_REL; else ret = SECCAT_DATA; } - else if (reloc & targetm.asm_out.reloc_rw_mask ()) + else if (reloc & targetm.asm_out.reloc_rw_mask () + && !lookup_attribute ("section", DECL_ATTRIBUTES (decl))) 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 , bootstraped and tested on i686-pc-linux-gnu with no new regressions, tested 4.2 version with gdb-sim on following architectures arm-elf, arm-none-eabi, mips-elf, mipsisa64-elf, powerpc-eabisim, sh-elf, powerpc-unknown-eabispe with no new regressions
Created an attachment (id=13578) [edit] proposed patch still need to run the testsuite on it
Also broken on ia64.
Trunk currently fails on powerpc64-linux building libstdc++-v3/src/system_error.cc. Hacking libtool a bit allows seeing the message "std::system_category causes a section type conflict". The file is compiled with -O2 and -fdata-sections; if either of those is removed then the bootstrap succeeds. This PR looked related (and Andrew Pinski confirmed that it is) so I tried the patch from comment #10; it needs more parens to avoid warnings, but with that patch the bootstrap succeeds.
reviewed patch posted here http://gcc.gnu.org/ml/gcc-patches/2007-05/msg01280.html
The patch that I tried is the one attached for comment #10, not the one in comment #9. With that patch a bootstrap of all languages but Ada succeeded. The test results look reasonable, although I don't have results from the last few days with which to compare them.
Has Segher's patch been sent to gcc-patches? I've just encountered the ppc64 bootstrap failure too.
I just tried compiling 2.6.23.9 ia64 and the compile failed citing drivers/char/ipmi/ipmi_si_intf.c:1095: error: __param_hotmod causes a section type conflict gcc (GCC) 4.2.3 20071123 (prerelease) (Debian 4.2.2-4)