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

Meador Inge meadori at codesourcery.com
Mon Mar 4 11:34:55 PST 2013


On 03/03/2013 06:40 PM, Lang Hames wrote:

> 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.

Test case?  I see a few tests using llvm-extract under test/Other/.


-- 
Meador Inge
CodeSourcery / Mentor Embedded



More information about the llvm-commits mailing list