[LLVMdev] RFC: New Linkage Type linker_private_weak

Bill Wendling wendling at apple.com
Wed Jun 30 13:36:44 PDT 2010

This patch introduces a the new "linker_private_weak" linkage type.

Why a new linkage type? The idea behind the "linker" linkage types is that they are used by the linker and then discarded. I.e., the symbols won't show up in the final linked image. In that regard, all "linker" linkage types are inherently "private". The "linker" linkages are currently used only by Objective-C metadata, and only Darwin's linker has the facility to handle them. However, they aren't restricted to Objective-C metadata or Darwin.

The "linker_private_weak" linkage has similar semantics to the "linker_private" linkage: it's private to the linkage unit and doesn't appear in the final linked image. Unlike the linker_private linkage, it has a "weak" definition. For example:

	.private_extern l_objc_msgSend_fixup_alloc
	.globl l_objc_msgSend_fixup_alloc
	.weak_definition l_objc_msgSend_fixup_alloc
	.section __DATA, __objc_msgrefs, coalesced
	.align 3
	.quad	_objc_msgSend_fixup

Whereas something with "linker_private" linkage has a strong definition, but unlike a normal strong definition is removed by the linker: 

	.align 3
	.long	3
	.long	40

I implemented the new linkage to have its own prefix from linker_private. As it currently stands, the symbol's prefix ("l") is the same for "linker_private" and "linker_private_weak". If this will always be the case, then I can remove the code in my patch that allows for a different prefix.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: linker_private_weak.patch
Type: application/octet-stream
Size: 19228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100630/817a834c/attachment.obj>
-------------- next part --------------

More information about the llvm-dev mailing list