<div dir="ltr">I'm /guessing/ this might be related to the COFF support specifically (perhaps COFF has no appending linkage support - in some cases LLVM IR supports the union of all semantics so that different formats can be fully expressed - but it means when targeting certain formats, some features are inherently unusable because they don't map to anything on that platform)<br><br>If I were you I'd go see if there are any examples of appending linkage being used when targeting the COFF platform (eg: go look at places where Clang generates IR with appending linkage, see if any of them apply to COFF, if they do see how they work through LTO - if there are no such examples, look for non-COFF Examples of appending linkage and see what the IR targeting COFF looks like in those examples, perhaps a different linkage mechanism is used that you can use too)<div><br>(added Reid for familiarity with the COFF format & Ray for familiarity with LLD) </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 18, 2020 at 12:29 AM Gleb Popov via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello.</div><div><br></div><div>I'm posting this question here, because there seem to be no LLD-specific mailing list. Sorry in advance if this is wrong one.</div><div><br></div><div>I compile two C source with following command:</div><div><br></div><div>clang -flto -o %name.bc %name.c</div><div><br></div><div>LLVM is augmented with my custom pass, which amongst other things create a global with appending linkage:</div><div><br></div><div>@myvar = appending constant [1 x [1 x i8]*] ...</div><div><br></div><div>I also have another pass plugged into LTO pipeline, which turns this global  into internal one in the final module. I was hoping that LLD would first link bitcodes like llvm-link, appending @myvar's from both modules into a single one, then run my pass, and only then perform linking at object level.<br></div><div><br></div><div>However, LLD complains about duplicated symbol "myvar" and doesn't even run any passes.</div><div><br></div><div>I've tracked the problem down to <span>BitcodeFile::parse</span>() function from <a href="https://github.com/llvm/llvm-project/blob/master/lld/COFF/InputFiles.cpp#L918" target="_blank">https://github.com/llvm/llvm-project/blob/master/lld/COFF/InputFiles.cpp#L918</a> - it doesn't take linkage type into account. <br></div><div><br></div><div>Can anything be done about this problem? Or was my approach broken from the beginning?<br></div><div><br></div><div>Thanks in advance.<br></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>