<br><div class="gmail_quote">On Thu, Oct 18, 2012 at 1:32 PM, NAKAMURA Takumi <span dir="ltr"><<a href="mailto:geek4civic@gmail.com" target="_blank">geek4civic@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
  > Besides, I still want the offsets to be meaningful for addr2line/atos.<br>
<br>
</div>    #0 0x804a7e6 (projects/compiler-rt/lib/asan/lit_tests/Output/use-after-free.cc.tmp+0x27e6)<br>
<br>
  Then should the address (0x804a7e6) be taken by them instead of the offset (0x27e6)?<br></blockquote><div><br></div><div>I probably miss something here. As I understand, your non-PIE binary code segment</div><div>is loaded at 0x8048000, right? What do you see when you run "objdump -d" on this binary?</div>
<div>Does the instruction addresses have the form 0x804.... as well? If they do, we want the</div><div>first line to have the form</div><div>#0 0x804a7e6 (projects/compiler-rt/lib/asan/lit_tests/Output/use-after-free.cc.tmp+0x804a7e6)</div>
<div>as well, for compatibility with addr2line, objdump etc.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
  Anyways, I don't know how to distinguish PIE in runtime, though.<br></blockquote><div><br></div><div>Yeah, neither do I (for now). Now to check if the module is main non-PIE binary we check if</div><div>the module is first in the list of mappings. We can instead invent more loose (but still hacky)</div>
<div>condition - the module address should be "small" (say, in the lower half of address space), and</div><div>its name shouldn't have a dynamic library suffix.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
================<br>
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h:56<br>
@@ -67,1 +55,3 @@<br>
<div class="im">+       // FIXME: file_offset doesn't make sense if it is not zero.<br>
+        *offset = (addr - start) + file_offset;<br>
         return true;<br>
</div>----------------<br>
I guess it is used on both darwin and linux (and possibly android?)<br>
<br>
Could we rewrite here conditioned out with; ?<br>
#if defined(__linux__)<br>
<div class="im">*offset = (addr - start) + file_offset;<br>
</div>#else<br>
<div class="im">*offset = (addr - (i ? start : 0)) + file_offset;<br>
</div>#endif<br>
<br>
As long as the emission would be handled by Addr2LineSymbolizer.</blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<br>
<a href="http://llvm-reviews.chandlerc.com/D66" target="_blank">http://llvm-reviews.chandlerc.com/D66</a><br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br>-- <br><div>Alexey Samsonov, MSK</div><br>