<div dir="auto">Thanks a lot for the pointer to this patch.<div dir="auto"><br></div><div dir="auto">Regards,</div><div dir="auto">Karan<br><div dir="auto"><br></div><div dir="auto"><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 13, 2019, 4:17 PM Dimitry Andric <<a href="mailto:dimitry@andric.com">dimitry@andric.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 13 Jun 2019, at 08:59, karnajit wangkhem via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" rel="noreferrer">llvm-dev@lists.llvm.org</a>> wrote:<br>
> <br>
> This test is on a ubuntu 12 box. Can anyone please point me what revision/commit-id of lld fixed this issue which was atleast in llvm 5.0.<br>
...<br>
> Result:<br>
> With llvm 5.0<br>
> <br>
> ./main<br>
> Calling gn...<br>
> ./main: symbol lookup error: shared/libsh.so: undefined symbol: fn   <== symbol fn was not found in binary "main"<br>
<br>
This was fixed in <a href="https://reviews.llvm.org/rLLD325849" rel="noreferrer noreferrer" target="_blank">https://reviews.llvm.org/rLLD325849</a>, after 6.0.0 was released:<br>
<br>
------------------------------------------------------------------------<br>
r325849 | ruiu | 2018-02-23 01:16:57 +0000 (Fri, 23 Feb 2018) | 16 lines<br>
<br>
Make undefined symbol in DSO to pull out object files from archive files.<br>
<br>
We have an internal program that does't link without this patch. I don't<br>
know of any open-source program that needs this, but there might be.<br>
Since this patch improves compatibility with GNU linkers with a few lines<br>
of code, I think it's worth to be committed.<br>
<br>
The problem is about undefined symbols in DSOs. Some programs depend on<br>
the GNU linkers' behavior that they pull out object files from archive<br>
files to resolve undefined symbols in DSOs. We already allow that kind of<br>
"reverse" dependency (from DSOs to the main executable) for regular<br>
symbols, in particular, for "__progname" symbol (which is usually in<br>
crt0.o), but that doesn't work if the symbol is in an archive file.<br>
This patch is to make it work.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D43658" rel="noreferrer noreferrer" target="_blank">https://reviews.llvm.org/D43658</a><br>
------------------------------------------------------------------------<br>
<br>
-Dimitry<br>
<br>
</blockquote></div>