<div dir="ltr"><div dir="ltr">On Thu, Jun 13, 2019 at 7:15 PM karnajit wangkhem <<a href="mailto:karnajitw@gmail.com" target="_blank">karnajitw@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><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 dir="ltr">Thanks for the info Rui.<div><br></div><div>Transitioning from llvm 5.0 to llvm 7.0 will take some time due to the nature/process of the production environment. Is it ok to use lld 7.0 with llvm 5.0?</div></div></div></blockquote><div><br></div><div>If you are not doing LTO, then yes, you can use any version of lld with any version of LLVM or Clang. lld takes the industry-standard file format as inputs, so you can use lld with any compiler including non-LLVM ones like GCC.</div><div><br></div><div>I'd recommend you do that if you can upgrade lld. The improvements from lld 4.0 to lld 7.0 are significant, since lld 4.0 was not very mature when it was released.</div><div> </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 class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 13, 2019 at 1:47 PM Rui Ueyama <<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</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">Looks like Ubuntu 12 was released in 2012, and the most recent version of LLVM is LLVM 8.0.0.<div><br></div><div>LLVM 5.0 is pretty old, and in particular, lld in LLVM 5.0 is extremely outdated. IIUC, the first release of LLVM that includes somewhat usable version of lld is LLVM 4.0, and I wouldn't be surprised that LLVM 5.0 has a lot of bugs.</div><div><br></div><div>Can't you simply use a newer version of lld?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 13, 2019 at 4:01 PM karnajit wangkhem via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">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">Hi All,<div><br></div><div>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.<div>.<br>├── build.sh<br>├── main.c<br>├── shared<br>│  └── sh.c<br>└── static<br>  └── st.c<br><br>[[ build.sh ]]<br><br>#!/bin/sh<br><br>CC="${TOOLCHAIN}/bin/clang"<br>AR="${TOOLCHAIN}/bin/llvm-ar"<br>CFLAGS="-g -O"<br>LDFLAGS="-fuse-ld=lld"<br><br>rm shared/sh.o static/st.o main.o<br>rm shared/libsh.so static/libst.a main<br><br>${CC} ${CFLAGS} -c shared/sh.c -o shared/sh.o<br>${CC} ${CFLAGS} ${LDFLAGS} -shared -o shared/libsh.so shared/sh.o<br><br>${CC} ${CFLAGS} -c static/st.c -o static/st.o<br>${AR} cq static/libst.a static/st.o<br><br>${CC} ${CFLAGS} -c main.c -o main.o<br><br>${CC} ${CFLAGS} ${LDFLAGS} -o main -Lshared -lsh -Lstatic -lst  main.o -Wl,-rpath=shared<br><br>[[ main.c ]]<br><br>void gn();<br><br>int main()<br>{<br>  gn();<br>  return 0;<br>}<br><br>[[ shared/sh.c ]]<br><br>#include <stdio.h><br><br>void gn(void);<br>void fn(void);<br><br>void gn()<br>{<br>  printf("Calling gn...\n");<br>  fn();<br>}<br><br>[[ static/st.c ]]<br><br>#include <stdio.h><br><br>void fn(void);<br><br>void fn()<br>{<br>  printf("Calling fn...\n");<br>}<br><br><br>Code flow:<br>main -> gn (shared library) -> fn (part of the static lib)<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>readelf -s main | grep fn</div><div><Nothing><br><br>With llvm 7.0<br><br>./main<br>Calling gn...<br>Calling fn...<br></div><div><br></div><div>readelf -s main | grep fn<br>   9: 0000000000001100   12 FUNC   GLOBAL DEFAULT  13 fn<br>  36: 0000000000001100   12 FUNC   GLOBAL DEFAULT  13 fn<br></div><div><br></div><div>Regards,</div><div>Karan</div></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>
</blockquote></div></div>
</blockquote></div></div>