<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 26, 2014 at 7:05 PM, <a href="mailto:kledzik@apple.com">kledzik@apple.com</a> <span dir="ltr"><<a href="mailto:kledzik@apple.com" target="_blank">kledzik@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">>  should we add a special case to the reader to convert them to weak undefines?<br>
</span>That is what I was thinking.  But you should investigate how this works with the gnu linker.  Does the linker really hard code "__tls_get_addr" to be special?  Or does it always implicitly link with ld.so?<br>
<span class=""><br></span></blockquote><div>The gnu linker doesnot implicitly link with ld.so, the clang/gcc driver passes the path to the dynamic linker as part of the command line. <br><br></div><div>The linker processes the dynamic linker as a regular input file.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
>canBeNullAtBuildTime is associated with a weak symbol while __tls_get_addr is not a weak symbo in the writer, which changes the symbol semantics.<br>
</span>I'm not sure what you are saying here.  If "__tls_get_adder" was a weak *undefined* symbol in the .o file, everything would work correctly. Static linking ignores the canBeNullAtBuildTime aspect of UndefinedAtoms, so either it is defined in an archive, or you get a linker error.  For dynamic executables, if it "__tls_get_adder"  not defined anywhere, the linker notices the </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">canBeNullAtBuildTime and conjures up a SharedLibraryAtom for it.<br>
<br></blockquote><div>When the compiler generates position independent code, the PIC code always generates __tls_get_addr as a normal undefined symbol. <br><br></div><div>Until we dont start optimizing tls accesses (Global dynamic to Initial executable), there should not be a need in the linker to create this symbol and resolve the symbol against what the linker implicitly defined.<br><br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<a href="http://reviews.llvm.org/D5505" target="_blank">http://reviews.llvm.org/D5505</a><br>
<br>
<br>
</blockquote></div><br></div></div>