r203052 - Construct GlobalValues with the correct linkage instead of using setLinkage.

Nick Kledzik kledzik at apple.com
Thu Mar 6 13:38:21 PST 2014


On Mar 6, 2014, at 1:12 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:

>>> BTW, what is the interaction of N_NO_DEAD_STRIP and S_ATTR_NO_DEAD_STRIP?
>> 
>> N_NO_DEAD_STRIP applies to individual symbols.
>> S_ATTR_NO_DEAD_STRIP applies to everything in a section.
>> 
>> The linker ORs the two together to decided if an atom is must not be dead stripped.
> 
> OK, thanks.
> 
> 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). 

-Nick





More information about the cfe-commits mailing list