[llvm-commits] [llvm] r76385 - in /llvm/trunk: docs/ include/llvm-c/ include/llvm/ include/llvm/Support/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/ lib/CodeGen/ lib/Linker/ lib/Target/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/AsmPrinter/ lib/Target/CellSPU/AsmPrinter/ lib/Target/CppBackend/ lib/Target/IA64/AsmPrinter/ lib/Target/MSP430/ lib/Target/Mips/AsmPrinter/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/AsmPrinter/ lib/Target/SystemZ/AsmPrinter/ lib/Target/X86/AsmPrinter/ lib/Target/XCore/ lib/Tr...

Chris Lattner clattner at apple.com
Mon Jul 20 08:29:24 PDT 2009


On Jul 20, 2009, at 1:19 AM, Duncan Sands wrote:

> Hi Chris,
>
>> Right.  Private linkage is discarded by the assembler, so they never
>> make it into the .o file.  linker_private is discarded by the linker,
>> so it never makes it into the .exe/.dylib.  I don't think there is a
>> corresponding idea on ELF, so on ELF they two linkage types should be
>> codegen'd the same way.
>
> I don't understand why you would want something to be discarded by
> the assembler/linker and not by the linker/assembler.  Don't you
> want them both to throw pointless things away?

This is needed for weird ObjC metadata stuff.  The basic issue with  
linkerprivate is that all labels that exist in the .o file end up  
defining boundaries between "atoms" that the linker works with.  The  
linker then dead code strips and reorders at the boundary of these  
labels.  Since Private labels are discarded before they make it to  
the .o file, the linker doesn't see them.  However, we don't want  
these labels to make it into the .exe file etc.  Some more information  
is here:
http://developer.apple.com/documentation/DeveloperTools/Reference/Assembler/040-Assembler_Directives/asm_directives.html#/ 
/apple_ref/doc/uid/TP30000823-DontLinkElementID_6

This is a similar deal with the llvm.compiler.used thing I just added:  
The basic idea is that the linker *knows* the layout of various objc  
metadata sections, so it can do various optimizations etc.  However,  
it doesn't do these if they are marked no-dead-strip, because it  
(reasonably) assumes that there is something weird going on.    
llvm.compiler.used prevents the compiler from molesting the metadata,  
but allows the linker to eliminate duplicate info, etc.

-Chris



More information about the llvm-commits mailing list