<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On Sep 13, 2013, at 4:16 PM, Shankar Easwaran <<a href="mailto:shankare@codeaurora.org">shankare@codeaurora.org</a>> wrote:<br><div><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="moz-cite-prefix">On 9/13/2013 6:06 PM, Nick Kledzik wrote:<br></div><blockquote cite="mid:FEE2897F-144A-4F8A-981E-461AC9BE0738@apple.com" type="cite"><pre wrap="">On Sep 13, 2013, at 3:35 PM, Shankar Easwaran <a class="moz-txt-link-rfc2396E" href="mailto:shankare@codeaurora.org"><shankare@codeaurora.org></a> wrote:
</pre><blockquote type="cite"><pre wrap="">This would work only if an alias is another name for the same symbol(weak symbols).
</pre></blockquote><pre wrap="">I don’t know what that means. Can you clarify?
</pre></blockquote>Doesnt this imply that the alias atom is a zero sized atom ?<br></div></blockquote><div>Yes. That is what an alias is - another name for something. An alias has no content of its own. It is just an alternate name for something. What do you think alias means?</div><br><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote cite="mid:FEE2897F-144A-4F8A-981E-461AC9BE0738@apple.com" type="cite"><pre wrap=""></pre><blockquote type="cite"><pre wrap="">If what is being aliased is another function definition, which is a non zero sized atom, aliasing will not work.
</pre></blockquote><pre wrap="">That is the exact scenario I think it *will* work in. What do you think won’t work.</pre></blockquote>If its a non zero sized atom, like for example :-<br><br>definedatoms:<br> - name : fna<br> size : 4<br> ...<br> ...<br><br>definedatoms:<br> - name: fnb<br> size: 4<br> <span class="Apple-converted-space"> </span><br>If I alias the atom, and add a layoutBefore from<span class="Apple-converted-space"> </span><b>fna</b><span class="Apple-converted-space"> </span>to<span class="Apple-converted-space"> </span><b>fnb</b>, fnb is going to have a seperate virtualaddress from fna.<br></div></blockquote><div>This sounds like you mean “alias” to mean take one implementation and override another implementation (that has a different name). </div><div><br></div><div>-Nick</div><div><br></div><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>But you essentially wanted fna, fnb to have the same virtual address right ?<br><br>Am I misreading something that you said ?<br><blockquote cite="mid:FEE2897F-144A-4F8A-981E-461AC9BE0738@apple.com" type="cite"><pre wrap="">
</pre><blockquote type="cite"><pre wrap="">I was thinking to model this for ELF for the below functionalities :-
a) __wrap
For example : --wrap fn
What I plan to do here is,
create a undefined function fn atom
create a defined weak atom fn
create a alias reference to __wrap_fn which is a undefined atom.
</pre></blockquote><pre wrap="">I don’t see how those steps will achieve wrapping functionality. Say you are wrapping malloc. There will be a malloc seen at build time from libc, and all references to malloc will bind to it. Adding alternate names won’t stop that binding.</pre></blockquote>Yes, thats how ld is behaving, if I have the the function in my .o's, it doesnot override.<br><br>For example :-<br><br>#include <stdio.h><br><br>int myfn() {<br> return 0;<br>}<br><br>void __wrap_myfn()<br>{<br> printf("Hello World\n");<br>}<br><br>int main() {<br> myfn();<br> return 0;<br>}<br>$gcc wrap.c -Wl,--wrap,fn<br>$./a.out<br>$<br><br>Thanks<br><br>Shankar Easwaran<br><br><pre class="moz-signature" cols="72">--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation</pre></div></blockquote></div><br></body></html>