ipa-visibility TLC 2/n
David Edelsohn
dje.gcc@gmail.com
Fri May 30 17:24:00 GMT 2014
Honza,
For example g++.dg/abi/vcall1.C fails at a call in a "localalias"
function, which jumps to a bad location:
(gdb) up
#1 0x100004c0 in B::B() [clone .localalias.2] ()
(gdb) x/16i $pc-32
0x100004a0 <_ZN1BC2Ev+156>: add r10,r10,r8
0x100004a4 <_ZN1BC2Ev+160>: mr r3,r10
0x100004a8 <_ZN1BC2Ev+164>: stw r2,20(r1)
0x100004ac <_ZN1BC2Ev+168>: lwz r10,0(r9)
0x100004b0 <_ZN1BC2Ev+172>: lwz r11,8(r9)
0x100004b4 <_ZN1BC2Ev+176>: mtctr r10
0x100004b8 <_ZN1BC2Ev.localalias.2+180>: lwz r2,4(r9)
0x100004bc <_ZN1BC2Ev.localalias.2+184>: bctrl
=> 0x100004c0 <_ZN1BC2Ev.localalias.2+188>: lwz r2,20(r1)
0x100004c4 <_ZN1BC2Ev.localalias.2+192>: addi r1,r31,64
0x100004c8 <_ZN1BC2Ev.localalias.2+196>: lwz r0,8(r1)
0x100004cc <_ZN1BC2Ev.localalias.2+200>: mtlr r0
0x100004d0 <_ZN1BC2Ev.localalias.2+204>: lwz r31,-4(r1)
0x100004d4 <_ZN1BC2Ev.localalias.2+208>: blr
On Fri, May 30, 2014 at 3:20 AM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
> Jan Hubicka <hubicka@ucw.cz> writes:
>>> Jan Hubicka <hubicka@ucw.cz> writes:
>>> >> Richard Sandiford wrote the original section anchors implementation,
>>> >> so he would be a good person to comment about the interaction between
>>> >> aliases and section anchors.
>>> >
>>> > Thanks! Richard, does this patch seem sane?
>>>
>>> Looks good to me in principle, but with:
>>>
>>> > + struct symtab_node *snode;
>>> > decl = SYMBOL_REF_DECL (symbol);
>>> > +
>>> > + snode = symtab_node (decl);
>>> > + if (snode->alias)
>>> > + {
>>> > + rtx target = DECL_RTL (symtab_alias_ultimate_target
>>> > (snode)->decl);
>>> > + SYMBOL_REF_BLOCK_OFFSET (symbol) = SYMBOL_REF_BLOCK_OFFSET
>>> > (target);
>>> > + return;
>>> > + }
>>>
>>> is SYMBOL_REF_BLOCK_OFFSET (target) guaranteed to be valid at this point?
>>> It looked at face value like you'd need a recursive call to place_block_symbol
>>> on the target before the copy.
>>
>> My reading was that SYMBOL_REF_BLOCK_OFFSET is computed at DECL_RTL
>> calculation time. But you are right - it is done by validize_mem that
>> is not done by DECL_RTL. Shall I just call it on target first?
>
> Yeah, sounds like calling place_block_symbol would be safer.
>
> IIRC, the reason I didn't do it at SET_DECL_RTL time is that some frontends
> tended to create placeholder decls that for whatever reason ended up with
> an initial DECL_RTL, then changed the properties of the decl later once
> more information was known. (This was all many years ago.)
>
> Thanks,
> Richard
More information about the Gcc-patches
mailing list