This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: ipa-visibility TLC 2/n
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Yufeng Zhang <Yufeng dot Zhang at arm dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, Ramana Radhakrishnan <Ramana dot Radhakrishnan at arm dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>, "rth at redhat dot com" <rth at redhat dot com>
- Date: Wed, 28 May 2014 21:52:16 +0200
- Subject: Re: ipa-visibility TLC 2/n
- Authentication-results: sourceware.org; auth=none
- References: <20140525055420 dot GA24940 at kam dot mff dot cuni dot cz> <CAJA7tRaBGkhNZjfEFpkrq8M5sSCOhNgt9dhLrTkXpYY9WZBunw at mail dot gmail dot com> <20140525222349 dot GA30013 at kam dot mff dot cuni dot cz> <20140526010404 dot GC9540 at kam dot mff dot cuni dot cz> <CAJA7tRZJ8HLjJ1y3XM7OT_ExkFr7k7=dz-p=5mcBiOuXR-zVfg at mail dot gmail dot com> <20140527200645 dot GA3384 at kam dot mff dot cuni dot cz> <20140527222049 dot GA31853 at kam dot mff dot cuni dot cz> <53861F33 dot 20605 at arm dot com>
> On 05/27/14 23:20, Jan Hubicka wrote:
> >>
> >>here we have decl and its local alias:
> >>(gdb) p debug_tree (sect->named.decl)
> >> <var_decl 70f7d060 _ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si
> >> type<array_type 70dd8840
> >> type<pointer_type 700f5840 __vtbl_ptr_type type<function_type 700f57e0>
> >> unsigned SI
> >> size<integer_cst 70006498 constant 32>
> >> unit size<integer_cst 700064b0 constant 4>
> >> align 32 symtab 45 alias set 3 canonical type 700f5840
> >> pointer_to_this<pointer_type 700f5900>>
> >> BLK
> >> size<integer_cst 708002d0 constant 320>
> >> unit size<integer_cst 708000d8 constant 40>
> >> align 32 symtab 0 alias set 3 canonical type 70dd8840
> >> domain<integer_type 701a78a0 type<integer_type 7001d000 sizetype>
> >> type_6 SI size<integer_cst 70006498 32> unit size<integer_cst 700064b0 4>
> >> align 32 symtab 0 alias set -1 canonical type 701a78a0 precision 32 min<integer_cst 700064c8 0> max<integer_cst 701a5b88 9>>
> >> pointer_to_this<pointer_type 71272d80>>
> >> readonly addressable used public static tree_1 tree_5 tree_6 ignored weak in_system_header virtual decl_5 SI file /home/jh/trunk/c/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/fstream line 444 col 11 size<integer_cst 708002d0 320> unit size<integer_cst 708000d8 40>
> >> user align 32 context<record_type 701eb000 basic_ifstream> initial<constructor 70f63680>
> >>
> >> (mem/u/c:SI (symbol_ref/i:SI ("_ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si") [flags 0x82]<var_decl 70f7d060 _ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si>) [3 _ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si+0 S40 A32])>
> >>$6 = 10
> >>(gdb) p debug_tree (decl)
> >> <var_decl 714174e0 _ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si.localalias.69
> >> type<array_type 70dd8840
> >> type<pointer_type 700f5840 __vtbl_ptr_type type<function_type 700f57e0>
> >> unsigned SI
> >> size<integer_cst 70006498 constant 32>
> >> unit size<integer_cst 700064b0 constant 4>
> >> align 32 symtab 45 alias set 3 canonical type 700f5840
> >> pointer_to_this<pointer_type 700f5900>>
> >> BLK
> >> size<integer_cst 708002d0 constant 320>
> >> unit size<integer_cst 708000d8 constant 40>
> >> align 32 symtab 0 alias set 3 canonical type 70dd8840
> >> domain<integer_type 701a78a0 type<integer_type 7001d000 sizetype>
> >> type_6 SI size<integer_cst 70006498 32> unit size<integer_cst 700064b0 4>
> >> align 32 symtab 0 alias set -1 canonical type 701a78a0 precision 32 min<integer_cst 700064c8 0> max<integer_cst 701a5b88 9>>
> >> pointer_to_this<pointer_type 71272d80>>
> >> readonly addressable used static tree_1 tree_5 tree_6 ignored in_system_header decl_5 SI file /home/jh/trunk/c/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/fstream line 444 col 11 size<integer_cst 708002d0 320> unit size<integer_cst 708000d8 40>
> >> user align 32 context<record_type 701eb000 basic_ifstream>
> >> >
> >>$7 = 10
> >>
> >>
> >>Perhaps get_vairable_section should look for alias target, since that is the
> >>decl really deciding on the section? Richard?
> >
> >This is patch that makes get_variable_section to look through the aliases
> >
> >Index: varasm.c
> >===================================================================
> >--- varasm.c (revision 210914)
> >+++ varasm.c (working copy)
> >@@ -1083,6 +1083,9 @@
> > {
> > addr_space_t as = ADDR_SPACE_GENERIC;
> > int reloc;
> >+ symtab_node *snode = symtab_get_node (decl);
> >+ if (snode)
> >+ decl = symtab_alias_ultimate_target (snode)->decl;
> >
> > if (TREE_TYPE (decl) != error_mark_node)
> > as = TYPE_ADDR_SPACE (TREE_TYPE (decl));
> >
> >For AIX it makes the bug go away and I eventually get:
> >
> >/tmp//ccyAATFr.s: line 30042: 1252-001 _ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si.localalias.69 is defined already.
> >/tmp//ccyAATFr.s: line 30125: 1252-001 _ZTCSt14basic_ofstreamIcSt11char_traitsIcEE0_So.localalias.71 is defined already.
> >/tmp//ccyAATFr.s: line 30164: 1252-001 _ZTCSt13basic_fstreamIcSt11char_traitsIcEE8_So.localalias.75 is defined already.
> >/tmp//ccyAATFr.s: line 30223: 1252-001 _ZTCSt13basic_fstreamIcSt11char_traitsIcEE0_Si.localalias.74 is defined already.
> >/tmp//ccyAATFr.s: line 30263: 1252-001 _ZTCSt14basic_ofstreamIwSt11char_traitsIwEE0_St13basic_ostreamIwS1_E.localalias.80 is defined already.
> >/tmp//ccyAATFr.s: line 30323: 1252-001 _ZTCSt13basic_fstreamIwSt11char_traitsIwEE8_St13basic_ostreamIwS1_E.localalias.84 is defined already.
> >/tmp//ccyAATFr.s: line 30388: 1252-001 _ZTCSt14basic_ifstreamIwSt11char_traitsIwEE0_St13basic_istreamIwS1_E.localalias.78 is defined already.
> >/tmp//ccyAATFr.s: line 30436: 1252-001 _ZTCSt13basic_fstreamIwSt11char_traitsIwEE0_St13basic_istreamIwS1_E.localalias.83 is defined already.
> >
> >David, this looks like a bug in the AIX target output macros. I get:
> > .set _ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si.localalias.69,_ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si
> >
> >(this is correct since localalias is really an alias)
> >
> >_ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si.localalias.69:
> > .space 40
> >_ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si:
> >...
> >
> >This is wrong, since we should not try to out the variable at least if I read AIX assembly correctly.
> >
> >varpool has explicit test to not output any aliases, so perhaps this is a bug in wrapup_globals
> >and AIX output macros. I will try to track more after my teaching tonight.
>
> Any update?
>
> I've managed to generate a simple test case from
> libstdc++-v3/src/c++98/strstream.cc which reproduces the issue on
> ARM that Ramana has reported previously:
Thanks, that is very useful! I will look into it today - I am teaching at evening, so first I need
to prepare my class and will do it next.
Honza