[PATCH] Add a fallback mechanism for undefined atom.

Rui Ueyama ruiu at google.com
Tue Sep 3 13:04:01 PDT 2013


On Tue, Sep 3, 2013 at 12:59 PM, Nick Kledzik <kledzik at apple.com> wrote:

>
> On Sep 3, 2013, at 12:51 PM, Shankar Easwaran <shankare at codeaurora.org>
> wrote:
>
> > On 9/3/2013 2:36 PM, Nick Kledzik wrote:
> >> On Sep 3, 2013, at 11:06 AM, Rui Ueyama <ruiu at google.com> wrote:
> >>> Nick, does Mach-O need symbol aliasing to be handled in the linker?
> >> Yes.  The darwin linker has command line options for adding aliases.
> >>
> >> 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.
> >>
> >>
> > looks like ELF also needs the same functionality for implementing __wrap.
> >
> > But in the case of the linker dealing with compiled .o's, the alias
> information is lost.
> Really?  I thought ELF had a way to encode this.   I’ve received bug
> reports saying that mach-o should support it too.
>

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.

>
> > Does Darwin keep the alias information when the
> __attribute__((alias(“xx”)) is used.
> 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).
>
> -Nick
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130903/942b6003/attachment.html>


More information about the llvm-commits mailing list