I have @_rtti_a_a = linkonce_odr constant in two files that end up as coff object files. Shoudln't the linkonce_odr prevent duplicate symbol: __rtti_a_a \consoleapplication149.o and __rtti_a_a island.lib(island.o) from happening in LLD? If not what alternative can I use? THis is used for template like generics, so having duplicate functions and globals is going to happen a lot) (Side note: How do I see linkonce* when dumping object files?) -- Carlo Kok RemObjects Software
Use comdats. linkonce_odr no longer implicitly creates comdats on COFF: if (!Triple.isOSBinFormatMachO()) GV->setComdat(MyModule.getOrInsertComdat(GV->getName())); I think the same is true for ELF, but linkonce_odr gives things weak linkage in addition to making them comdat. On Wed, Jun 1, 2016 at 9:06 AM, Carlo Kok via llvm-dev < llvm-dev at lists.llvm.org> wrote:> I have @_rtti_a_a = linkonce_odr constant in two files that end up as coff > object files. Shoudln't the linkonce_odr prevent duplicate symbol: > __rtti_a_a \consoleapplication149.o and __rtti_a_a island.lib(island.o) > from happening in LLD? > > If not what alternative can I use? THis is used for template like > generics, so having duplicate functions and globals is going to happen a > lot) > > (Side note: How do I see linkonce* when dumping object files?) > -- > Carlo Kok > RemObjects Software > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160601/b8b8af3b/attachment.html>
On Wed, Jun 1, 2016 at 9:14 AM, Reid Kleckner via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Use comdats. linkonce_odr no longer implicitly creates comdats on COFF: > if (!Triple.isOSBinFormatMachO()) >David recently added Triple.supportsCOMDAT() which makes the intent a bit clearer. -- Sean Silva> GV->setComdat(MyModule.getOrInsertComdat(GV->getName())); > > I think the same is true for ELF, but linkonce_odr gives things weak > linkage in addition to making them comdat. > > On Wed, Jun 1, 2016 at 9:06 AM, Carlo Kok via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> I have @_rtti_a_a = linkonce_odr constant in two files that end up as >> coff object files. Shoudln't the linkonce_odr prevent duplicate symbol: >> __rtti_a_a \consoleapplication149.o and __rtti_a_a island.lib(island.o) >> from happening in LLD? >> >> If not what alternative can I use? THis is used for template like >> generics, so having duplicate functions and globals is going to happen a >> lot) >> >> (Side note: How do I see linkonce* when dumping object files?) >> -- >> Carlo Kok >> RemObjects Software >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160601/15b758c5/attachment.html>