[LLVMdev] lld deadstrip atoms

Nick Kledzik kledzik at apple.com
Mon Nov 12 15:32:09 PST 2012


On Nov 12, 2012, at 6:12 PM, Shankar Easwaran wrote:
> Hi Nick,
> 
>>> b) Further looking, there is a compiler attribute __attribute(used)__ which could be set for each symbol, but this is only a compiler hint. The information is not passed in the symbol table. If this is not passed in the symbol table to the linker, why is it in the DefinedAtom ?
>> In mach-o it *is* passed on to the linker by the compiler.  It is the N_NO_DEAD_STRIP bit in the n_desc field of the nlist struct.  Are you saying that that information is not recorded in ELF .o files?
> On ELF x86_64, I dont see the information being passed. Is clang planning to add this support ?


I don't know what ELF supports.  For mach-o, the information is passed via the .no_dead_strip directive:

[/tmp]> cat foo.c
__attribute__((used))
void foo() {}

[/tmp]> clang -Os -S foo.c

[/tmp]> grep foo foo.s
	.globl	_foo
_foo:                                   ## @foo
	.no_dead_strip	_foo
[/tmp]> 





More information about the llvm-dev mailing list