This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

Re: [gold lto patch] Add plugin support for LDPR_PREVAILING_DEF_IRONLY_EXP


On 2011.09.27 at 20:48 +0200, Jan Hubicka wrote:
> > This patch adds LDPT_GET_SYMBOLS_V2 to the gold plugin API, which will
> > return the new LDPR_PREVAILING_DEF_IRONLY_EXP resolution code for
> > symbols that are referenced only from IR code, but are exported. For
> > more details, see GCC PR lto/47247:
> > 
> >    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47247
> > 
> > Tested on x86_64. OK to commit?
> > 
> > -cary
> > 
> > PS: Is this the right way to put GCC PR tags in a binutils ChangeLog?
> > 
> > PPS: Sorry, Honza, for taking so long. I had the implementation done
> > at the London conference, but never found the time to update the test
> > suite.
> 
> thanks and I am attaching what should be support on GCC side.  However I run into problem
> that when bulding i.e. tramp3d:
> /abuild/jh/trunk-install/bin/g++ -O2 -flto=24 tramp3d-v43.o -fpermissive -fdump-ipa-cgraph -fno-fat-lto-objects  --save-temps -fuse-linker-plugin
> I get no PREVAILING_DEF_INRONLY relocations.  Since I now output all comdats into
> symbol table there should be plenty of them.

Hmm, no problems here: 
% grep 'PREVAILING_DEF_IRONLY' lm.res | wc -l
10278
There are no PREVAILING_DEF_IRONLY_EXPs however: 
% grep 'PREVAILING_DEF_IRONLY_EXP' lm.res | wc -l
0

However libxul from Mozilla has plenty of them:
 % grep 'PREVAILING_DEF_IRONLY_EXP' ccN7qyao.res | wc -l
9291


>      is indicated by a tag.  */
> Index: gcc/lto-streamer-out.c
> ===================================================================
> *** gcc/lto-streamer-out.c	(revision 179274)
> --- gcc/lto-streamer-out.c	(working copy)
> *************** produce_symtab (struct output_block *ob,
> *** 1340,1346 ****
>         node = lto_cgraph_encoder_deref (encoder, i);
>         if (DECL_EXTERNAL (node->decl))
>   	continue;
> !       if (DECL_COMDAT (node->decl)
>   	  && cgraph_comdat_can_be_unshared_p (node))
>   	continue;
>         if ((node->alias && !node->thunk.alias) || node->global.inlined_to)
> --- 1340,1346 ----
>         node = lto_cgraph_encoder_deref (encoder, i);
>         if (DECL_EXTERNAL (node->decl))
>   	continue;
> !       if (DECL_COMDAT (node->decl) && 0
>   	  && cgraph_comdat_can_be_unshared_p (node))
>   	continue;
>         if ((node->alias && !node->thunk.alias) || node->global.inlined_to)
> *************** produce_symtab (struct output_block *ob,
> *** 1352,1358 ****
>         node = lto_cgraph_encoder_deref (encoder, i);
>         if (!DECL_EXTERNAL (node->decl))
>   	continue;
> !       if (DECL_COMDAT (node->decl)
>   	  && cgraph_comdat_can_be_unshared_p (node))
>   	continue;
>         if ((node->alias && !node->thunk.alias) || node->global.inlined_to)
> --- 1352,1358 ----
>         node = lto_cgraph_encoder_deref (encoder, i);
>         if (!DECL_EXTERNAL (node->decl))
>   	continue;
> !       if (DECL_COMDAT (node->decl) && 0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This line causes a link error when I build gold with LTO:

g++ -W -Wall    -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -frandom-seed=ld-new -march=native -O2 -pipe -flto=4   -o ld-new main.o i386.o x86
_64.o sparc.o powerpc.o arm.o arm-reloc-property.o libgold.a ../libiberty/libiberty.a    -ldl -lz
/tmp/ccBa7wTC.ltrans0.ltrans.o:ccBa7wTC.ltrans0.o:function vtable for gold::Output_data_dynamic: error: undefined reference to 'gold::Output_data_dyn
amic::do_print_to_mapfile(gold::Mapfile*) const'
/tmp/ccBa7wTC.ltrans0.ltrans.o:ccBa7wTC.ltrans0.o:function vtable for gold::Output_file_header: error: undefined reference to 'gold::Output_file_head
er::do_addralign() const'
/tmp/ccBa7wTC.ltrans0.ltrans.o:ccBa7wTC.ltrans0.o:function vtable for gold::Output_file_header: error: undefined reference to 'gold::Output_file_header::set_final_data_size()'
/tmp/ccBa7wTC.ltrans0.ltrans.o:ccBa7wTC.ltrans0.o:function vtable for gold::Output_file_header: error: undefined reference to 'gold::Output_file_header::do_print_to_mapfile(gold::Mapfile*) const'
/tmp/ccBa7wTC.ltrans0.ltrans.o:ccBa7wTC.ltrans0.o:function vtable for gold::Output_segment_headers: error: undefined reference to 'gold::Output_segment_headers::do_addralign() const'
/tmp/ccBa7wTC.ltrans0.ltrans.o:ccBa7wTC.ltrans0.o:function vtable for gold::Output_segment_headers: error: undefined reference to 'gold::Output_segment_headers::set_final_data_size()'
/tmp/ccBa7wTC.ltrans0.ltrans.o:ccBa7wTC.ltrans0.o:function vtable for gold::Output_segment_headers: error: undefined reference to 'gold::Output_segment_headers::do_print_to_mapfile(gold::Mapfile*) const'
/tmp/ccBa7wTC.ltrans0.ltrans.o:ccBa7wTC.ltrans0.o:function vtable for gold::Output_section_headers: error: undefined reference to 'gold::Output_section_headers::do_addralign() const'
/tmp/ccBa7wTC.ltrans0.ltrans.o:ccBa7wTC.ltrans0.o:function vtable for gold::Output_section_headers: error: undefined reference to 'gold::Output_section_headers::update_data_size()'
/tmp/ccBa7wTC.ltrans0.ltrans.o:ccBa7wTC.ltrans0.o:function vtable for gold::Output_section_headers: error: undefined reference to 'gold::Output_section_headers::set_final_data_size()'
...

Just deleting this single "&& 0" fixes the issue.


>   	  && cgraph_comdat_can_be_unshared_p (node))
>   	continue;
>         if ((node->alias && !node->thunk.alias) || node->global.inlined_to)
> *************** produce_symtab (struct output_block *ob,
> *** 1369,1375 ****
>         /* COMDAT virtual tables can be unshared.  Do not declare them
>   	 in the LTO symbol table to prevent linker from forcing them
>   	 into the output. */
> !       if (DECL_COMDAT (vnode->decl)
>   	  && !vnode->force_output
>   	  && vnode->finalized 
>   	  && DECL_VIRTUAL_P (vnode->decl))
> --- 1369,1375 ----
>         /* COMDAT virtual tables can be unshared.  Do not declare them
>   	 in the LTO symbol table to prevent linker from forcing them
>   	 into the output. */
> !       if (DECL_COMDAT (vnode->decl) && 0
>   	  && !vnode->force_output
>   	  && vnode->finalized 
>   	  && DECL_VIRTUAL_P (vnode->decl))
> *************** produce_symtab (struct output_block *ob,
> *** 1383,1389 ****
>         vnode = lto_varpool_encoder_deref (varpool_encoder, i);
>         if (!DECL_EXTERNAL (vnode->decl))
>   	continue;
> !       if (DECL_COMDAT (vnode->decl)
>   	  && !vnode->force_output
>   	  && vnode->finalized 
>   	  && DECL_VIRTUAL_P (vnode->decl))
> --- 1383,1389 ----
>         vnode = lto_varpool_encoder_deref (varpool_encoder, i);
>         if (!DECL_EXTERNAL (vnode->decl))
>   	continue;
> !       if (DECL_COMDAT (vnode->decl) && 0
>   	  && !vnode->force_output
>   	  && vnode->finalized 
>   	  && DECL_VIRTUAL_P (vnode->decl))

-- 
Markus


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