[Bug c++/50255] Linker stumbles over non-grouped text/rodata for a non-virtual thunk

2011-09-07 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50255

--- Comment #11 from Jakub Jelinek  2011-09-08 
06:03:11 UTC ---
Author: jakub
Date: Thu Sep  8 06:03:01 2011
New Revision: 178675

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=178675
Log:
PR c++/50255
* method.c (use_thunk): If emitting thunk into the same section
as function, use the same DECL_COMDAT_GROUP as well.

Modified:
branches/gcc-4_6-branch/gcc/cp/ChangeLog
branches/gcc-4_6-branch/gcc/cp/method.c


[Bug c++/50255] Linker stumbles over non-grouped text/rodata for a non-virtual thunk

2011-09-07 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50255

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 AssignedTo|unassigned at gcc dot   |jakub at gcc dot gnu.org
   |gnu.org |

--- Comment #10 from Jakub Jelinek  2011-09-07 
15:27:16 UTC ---
Created attachment 25223
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25223
gcc46-pr50255.patch

Untested fix.  If we decide to emit the thunk in the same section as the
function, it'd better use the right comdat group as well.


[Bug c++/50255] Linker stumbles over non-grouped text/rodata for a non-virtual thunk

2011-09-07 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50255

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2011-09-07
 CC||jakub at gcc dot gnu.org
 Ever Confirmed|0   |1

--- Comment #9 from Jakub Jelinek  2011-09-07 
14:33:52 UTC ---
This changed on the trunk with Honza's Cgraph thunk reorg (which isn't really
backportable):
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173517
in r173516 we have
.section   
.text._ZN1TI1WI1XEE1hEP1A,"axG",@progbits,_ZThn8_N1TI1WI1XEE1hEP1A,comdat
.section   
.rodata._ZN1TI1WI1XEE1hEP1A,"aG",@progbits,_ZN1TI1WI1XEE1hEP1A,comdat
.section   
.text._ZN1TI1WI1XEE1hEP1A,"axG",@progbits,_ZThn8_N1TI1WI1XEE1hEP1A,comdat
while in r173517
.section   
.text._ZN1TI1WI1XEE1hEP1A,"axG",@progbits,_ZN1TI1WI1XEE1hEP1A,comdat
.section   
.rodata._ZN1TI1WI1XEE1hEP1A,"aG",@progbits,_ZN1TI1WI1XEE1hEP1A,comdat
.section   
.text._ZN1TI1WI1XEE1hEP1A,"axG",@progbits,_ZN1TI1WI1XEE1hEP1A,comdat


[Bug c++/50255] Linker stumbles over non-grouped text/rodata for a non-virtual thunk

2011-09-07 Thread stephan.bergmann.secondary at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50255

--- Comment #8 from Stephan Bergmann  2011-09-07 12:14:56 UTC ---
Created attachment 25221
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25221
script compiling test case and showing broken result

I finally have a stripped down test case now that shows that compiling the
given code leads to mismatched group names for the .text and .rodata sections
of the non-virtual thunk (the first three .sections in the output).


[Bug c++/50255] Linker stumbles over non-grouped text/rodata for a non-virtual thunk

2011-09-07 Thread stephan.bergmann.secondary at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50255

--- Comment #7 from Stephan Bergmann  2011-09-07 12:12:04 UTC ---
Created attachment 25220
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25220
reduced test case


[Bug c++/50255] Linker stumbles over non-grouped text/rodata for a non-virtual thunk

2011-09-02 Thread stephan.bergmann.secondary at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50255

--- Comment #6 from Stephan Bergmann  2011-09-02 13:15:42 UTC ---
While I still don't have a stripped down test case, I at least know now what is
going wrong (on recent gcc-4_6-branch rev 178396, at least):

When compiling vbasheetobjects.cxx, the text section for the non-virtual thunk
(with section name ".text._ZN19..." and group name "_ZThn20_N19...") is first
obtained at

get_section()
hot_function_section()
function_section_1()
function_section_1()
assemble_start_function()
assemble_thunk()
cgraph_expand_function()
cgraph_expand_all_functions()
cgraph_optimize()
cgraph_finalize_compilation_unit()
cp_write_global_declarations()
compile_file()
do_compile()
toplev_main()
main()

There, get_section() is called with decl pointing to the thunk, as
assemble_thunk() sets global current_function_decl = thunk_fndecl;

Later on, the corresponding rodata section for the non-virtual thunk (with
section name ".rodata._ZN19..." and erroneous group name "_ZN19..." instead of
"_ZThn20_N19...") is first obtained at

get_section()
default_function_rodata_section()
final_scan_insn()
final()
rest_of_handle_final()
execute_one_pass()
execute_pass_list()
execute_pass_list()
execute_pass_list()
tree_rest_of_compilation()
cgraph_expand_function()
...

a few lines further down in the same invocation of cgraph_expand_function()
(and in final_scan_insn() we are at
switch_to_section(targetm.asm_out.function_rodata_section(current_function_decl));).
 But this time, current_function_decl points to the function itself, not the
non-virtual thunk, as tree_rest_of_compilation() sets current_function_decl =
fndecl;


[Bug c++/50255] Linker stumbles over non-grouped text/rodata for a non-virtual thunk

2011-09-01 Thread stephan.bergmann.secondary at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50255

--- Comment #5 from Stephan Bergmann  2011-09-01 12:10:54 UTC ---
By the way, the problem of the rodata section having a different GroupName than
the text section is also present when you compile vbasheetobjects.cxx with
plain (non-RedHat-modified) GCC 4.6.0 and GCC 4.6.1, respectively.


[Bug c++/50255] Linker stumbles over non-grouped text/rodata for a non-virtual thunk

2011-09-01 Thread stephan.bergmann.secondary at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50255

--- Comment #4 from Stephan Bergmann  2011-09-01 08:39:59 UTC ---
caolanm: will work on it, yes  (wanted to clarify first whether looking at
those group name mismatches is actually looking in the right direction)


[Bug c++/50255] Linker stumbles over non-grouped text/rodata for a non-virtual thunk

2011-09-01 Thread caolanm at redhat dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50255

Caolan McNamara  changed:

   What|Removed |Added

 CC||caolanm at redhat dot com,
   ||jakub at redhat dot com

--- Comment #3 from Caolan McNamara  2011-09-01 
08:29:54 UTC ---
caolanm->jakub: this is the one I mentioned as FOSDEM 11.

caolanm->sberg: able to attach something standalone that can reproduce this,
i.e. .ii


[Bug c++/50255] Linker stumbles over non-grouped text/rodata for a non-virtual thunk

2011-08-31 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50255

--- Comment #2 from Andrew Pinski  2011-08-31 
21:06:43 UTC ---
This sounds like http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49538 but without
a testcase it is hard to say if it was really on the 4.6 branch or only with
RedHat's compiler.


[Bug c++/50255] Linker stumbles over non-grouped text/rodata for a non-virtual thunk

2011-08-31 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50255

--- Comment #1 from Andrew Pinski  2011-08-31 
21:03:36 UTC ---
>GCC 4.6.0 20110603 (Red Hat 4.6.0-10)).

Does it happen with non RedHat version of the compiler meaning non modified
version of GCC?  Really you should have reported this first to redhat as they
have some modifications to their compiler that might have caused this issue.