<div dir="ltr">Why does it work for other linkers? Do they just allow text relocations by default?</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 22, 2017 at 12:11 PM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Wed, Feb 22, 2017 at 11:08 AM, George Rimar via Phabricator <span dir="ltr"><<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">grimar added a comment.<br>
<span><br>
In <a href="https://reviews.llvm.org/D30256#683650" rel="noreferrer" target="_blank">https://reviews.llvm.org/D3025<wbr>6#683650</a>, @ruiu wrote:<br>
<br>
> The fact that the name does not correspond what it does is actually a bit alarming. It could be a sign that something is wrong. Did you know why it was named "noreloc-overflow"?<br>
<br>
<br>
</span>Yes. I am sorry, now I see that patch was very confusing. They use it for different thing:<br>
<a href="https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=bfd/elf64-x86-64.c;h=a058eca3abf03cc2f79601d170b2d6b9f9c459e5;hb=HEAD#l2594" rel="noreferrer" target="_blank">https://sourceware.org/git/git<wbr>web.cgi?p=binutils-gdb.git;a=<wbr>blob;f=bfd/elf64-x86-64.c;h=a0<wbr>58eca3abf03cc2f79601d170b2d6b9<wbr>f9c459e5;hb=HEAD#l2594</a><br>
They do not allow to use some relocations as dynamic because they can overflow in runtime<br>
 and report "recompile with fPIC" error instead. To avoid that error, they have this flag.<br>
There is a single relocation in kernel I see that is fixed by that option for them, but we resolve this relocation statically, so at least for my case it was never a problem.<br>
<br>
Issue I tried to solve in this patch is different. Issue is that we restrict creating the relocations against RO sections. Though self-relocatable binaries<br>
for kernel wants to have that. For that case I supposed it is fine to ignore all kinds of checks for dynamic relocations under this option. Now I am not sure<br>
that was good idea.<br>
<br>
May be we should just allow relocations against text segment when --no-dynamic-linker is given ? That also solves kernel problem and delegates a problem<br>
of handling of such relocation to users generally, what should not be a trouble in that case, because if user specifies no-dynamic-linker, it knows he will<br>
need to handle them anyways. What do you think ?<br></blockquote><div><br></div></span><div>Allowing relocations against text segments when -no-dynamic-linker is given sounds too hacky and not OK. You cannot describe why it makes sense, right? By making sense, I don't mean "because Linux kernel needs this" but something like "-no-dynamic-linker is an option to do blah blah and semantically it naturally implies it should allow text relocations".</div></div></div></div>
</blockquote></div><br></div>