<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Oct 8, 2015 at 1:53 PM, <a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a> <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hfinkel added a comment.<br>
<span class=""><br>
In <a href="http://reviews.llvm.org/D13566#263240" rel="noreferrer" target="_blank">http://reviews.llvm.org/D13566#263240</a>, @ruiu wrote:<br>
<br>
> If my understanding is correct, the problem is that when we apply relocations, relocations in .opd may not have been applied yes, so you have to backfill relocations that refer function descriptors in .opd.<br>
><br>
> If so, it seems to me that you can solve the problem by applying all relocations in .opd first and then rest,. Doesn't this work?<br>
<br>
<br>
</span>Yes, if we always applied relocations in .opd first, then we'd be able to save and use that information later for the relocations in the text sections.<br></blockquote><div><br></div><div>By "save", what kind of information do you have to save? I thought that you "save" information into .opd section. Do you have to save any out-of-bound data besides that from .opd section relocation to .text (or similar) section relocation?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Should we add some kind of target hook that allows it to somehow adjust the order in which the relocations are applied? Does this require separating that process from the order in which the sections are written? In short, how would you like this to work?<br></blockquote><div><br></div><div>If you want to apply .opd's relocation first, just hard-code that logic in Writer<ELFT>::writeSections so that the section with name ".opd" is written first. We don't even need PPC check; always do that.</div></div></div></div>