[PATCH] Make discardable symbols externally visible to prevent discarding in llvm-extract.

Lang Hames lhames at gmail.com
Sun Mar 3 16:40:57 PST 2013


Hi All,

llvm-extract has tricked me a couple of times by handing me back an empty
module when I asked it to extract a linkonce function. The problem is that
when DCE tidies up the module, it strips out the function that you wanted
to extract.

To avoid that problem, this patch sets the linkage on any function that was
requested on the command line, and that would be discarded by DCE, to
ExternalLinkage.

Given the use cases that I'm aware of for llvm-extract I think this should
be an improvement. It certainly seems better than handing back an empty
module. If anybody is concerned about this quietly changing the linkage
type then I can improve the patch to restore the original linkage types
after DCE is run.

Cheers,
Lang.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130303/02515f7c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: make-discardable-globals-externally-visible.patch
Type: application/octet-stream
Size: 457 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130303/02515f7c/attachment.obj>


More information about the llvm-commits mailing list