[PATCH] D18252: Drop comdats from the dst module if they are not selected
Rafael Ávila de Espíndola via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 17 13:25:29 PDT 2016
rafael created this revision.
rafael added reviewers: majnemer, joker.eph.
rafael added a subscriber: llvm-commits.
A really unfortunate design of llvm-link and related libraries is that they operate one module at a time.
This means they can copy a GV to the destination module that should not be there in the final result because a later bitcode file takes precedence.
We already handled cases like a strong GV replacing a weak for example.
One case that is not currently handled is a comdat replacing another. This doesn't happen in ELF, but with COFF largest selection kind it is possible.
In "llvm-link a.ll b.ll" if the selected comdat was from a.ll, everything will work and we will not copy the comdat from b.ll.
But if we run "llvm-link b.ll a.ll", we fail to delete the already copied comdat from b.ll. This patch fixes that.
http://reviews.llvm.org/D18252
Files:
llvm/lib/Linker/LinkModules.cpp
llvm/test/Linker/Inputs/comdat-rm-dst.ll
llvm/test/Linker/comdat-rm-dst.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18252.50972.patch
Type: text/x-patch
Size: 4235 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160317/b83c6cdb/attachment.bin>
More information about the llvm-commits
mailing list