This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Don't use .gnu.linkonce with COMDAT


Hi,

This is a combination of various patches to make COMDAT groups work better. The first is from the csl-arm branch:

http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02497.html

This stops .gnu.linkonce from being used on targets which have COMDAT groups.

The next bit is new: rodata sections relating to text sections in COMDAT groups are now put into the same COMDAT group rather than being left stranded. i.e., a function put in a section:

.section .text._Z3fooi,"axG",@progbits,_Z3fooi,comdat

which generates a jump table for a switch statement, now has that table put into a section:

.section .rodata._Z3fooi,"aG",@progbits,_Z3fooi,comdat

rather than just .rodata. This fixes testcase g++.old-deja/g++.other/comdat4.C on x86_64 with the above bit applied.

Thirdly, COMDAT groups have proven buggy on various platforms with various (older) binutils versions. The third part of the patch stops COMDAT groups from being used altogether when the linker version is less than 2.16. This is perhaps slightly too pessimistic (i.e., earlier versions might work OK), but I'm reasonably confident my testing has shown it to be about right. This is based on a patch from H.J. Lu which never seems to have been applied:

http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02774.html

Though the required version has been bumped by several. This will have the effect of disabling COMDAT on some setups where it is currently enabled. I have also renamed the macro HAVE_GAS_COMDAT_GROUP to just HAVE_COMDAT_GROUP to better indicate that it's not just an assembler feature that's being relied on.

I have run tests on powerpc64-unknown-linux-gnu with c,c++ and x86_64-pc-linux-gnu with c,c++,java,objc, with binutils 2.16, with no regressions.

OK to apply?

ChangeLog:

  * gcc/configure.ac: Set ld_vers_major, ld_vers_minor and ld_vers_patch
  for GNU linker. Support linker version x.x.x.x.x. Require GNU linker
  20050308/2.16.0 or newer for comdat group.
  * gcc/configure: Regenerated.
  * gcc/config.in: Regenerated.
  * gcc/varasm.c (default_function_rodata_section): Put .rodata section
  in COMDAT group when necessary.
  (default_elf_asm_named_section): Rename HAVE_GAS_COMDAT_GROUP to
  HAVE_COMDAT_GROUP.
  (default_unique_section_1): Don't use .gnu.linkonce when COMDAT is
  available.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]