<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix"><br>
<br>
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>
<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>
<br>
If I alias the atom, and add a layoutBefore from <b>fna</b> to <b>fnb</b>,
fnb is going to have a seperate virtualaddress from fna.<br>
<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>
</body>
</html>