r203052 - Construct GlobalValues with the correct linkage instead of using setLinkage.
Rafael Espíndola
rafael.espindola at gmail.com
Thu Mar 6 13:47:18 PST 2014
>> Just one more question. When doing LTO, what will ld64 tell us about
>> these symbols? Will it say that they are required and that llvm should
>> not hide them?
> In general ld64 only uses lto_codegen_add_must_preserve_symbol() if:
> * the symbol is referenced by a mach-o file
> * some command line option required that symbol to be emitted
> * the symbol is a weak-def and there is a mach-o symbol with the same name
> * the symbol is global and all global symbols must be preserved
>
> So, if this is a hidden, weak-def and there is no mach-o file also defining that
> symbol, than ld64 will not ask to preserve it.
>
>> I ask because the other issue I would like to sort is
>> shouldEmitUsedDirectiveFor. If ld64 tells llvm to keep the symbols, we
>> only need to put the private symbols in llvm.compiler.used. If we are
>> not told to keep them, then they the weak symbols have to go to
>> llvm.compiler.used too.
>
> Is this to keep the symbol content or symbol name? That is, if you are talking
> about removing the label but passing the section content on to ld64. I’d much
> rather keep ‘l’ labels, because it makes the atom graph better match what
> was intended (you don’t get big anonymous blobs).
Content. Given the your description of when
lto_codegen_add_must_preserve_symbol is called, we must keep both weak
and private symbols in llvm.compiler.used (or special case them in
lib/LTO, which looks nastier).
Thanks,
Rafael
More information about the cfe-commits
mailing list