<div dir="ltr">On Tue, Sep 3, 2013 at 12:59 PM, Nick Kledzik <span dir="ltr"><<a href="mailto:kledzik@apple.com" target="_blank">kledzik@apple.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On Sep 3, 2013, at 12:51 PM, Shankar Easwaran <<a href="mailto:shankare@codeaurora.org">shankare@codeaurora.org</a>> wrote:<br>
<br>
> On 9/3/2013 2:36 PM, Nick Kledzik wrote:<br>
>> On Sep 3, 2013, at 11:06 AM, Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br>
>>> Nick, does Mach-O need symbol aliasing to be handled in the linker?<br>
>> Yes.  The darwin linker has command line options for adding aliases.<br>
>><br>
>> Back when I first started working on the darwin linker, a big complaint from the compiler team was that mach-o did not support aliases like ELF did, so the compiler team kept having to special case lots of test cases and functionality that used __attribute__((alias(“xx”))) on darwin.<br>


>><br>
>><br>
> looks like ELF also needs the same functionality for implementing __wrap.<br>
><br>
> But in the case of the linker dealing with compiled .o's, the alias information is lost.<br>
</div>Really?  I thought ELF had a way to encode this.   I’ve received bug reports saying that mach-o should support it too.<br></blockquote><div><br></div><div>I took a look at an object file using __attribute__((alias())), and I found it's true. There's no information in the file that which symbol is alias. The compiler seemed emit all the symbols with normal attributes, except that alias symbols would have the same values (pointing the same section offsets) as the original symbols.</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
><br>
> Does Darwin keep the alias information when the __attribute__((alias(“xx”)) is used.<br>
</div>What the current darwin linker does is if parses a .o file and there are two symbols at the same address (and same section), it picks one to be the atom name (call it “foo”) and the other (call it “bar”) is turned into an alias atom (zero size and atom foo must layout after atom bar).<br>


<br>
-Nick<br>
<br>
<br>
</blockquote></div><br></div></div>