<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Aug 31, 2018 at 9:55 PM Joerg Sonnenberger <<a href="mailto:joerg@bec.de">joerg@bec.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Aug 30, 2018 at 10:07:34AM +0900, Rui Ueyama via llvm-commits wrote:<br>
> On Thu, Aug 30, 2018 at 7:16 AM Joerg Sonnenberger <<a href="mailto:joerg@bec.de" target="_blank">joerg@bec.de</a>> wrote:<br>
> <br>
> > On Wed, Aug 29, 2018 at 07:27:09AM -0000, Rui Ueyama via llvm-commits<br>
> > wrote:<br>
> > > Author: ruiu<br>
> > > Date: Wed Aug 29 00:27:09 2018<br>
> > > New Revision: 340902<br>
> > ><br>
> > > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=340902&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=340902&view=rev</a><br>
> > > Log:<br>
> > > Always add a .note.GNU-stack section if -r.<br>
> > ><br>
> > > With this patch, lld creates a .note.GNU_stack and adds that to an<br>
> > > output file if it is creating a re-linkable object file (i.e. if -r<br>
> > > is given). If we don't do this, and if you use GNU linkers as a final<br>
> > > linker, they create an executable whose stack area is executable,<br>
> > > which is considered pretty bad these days.<br>
> ><br>
> > It should only be done if at least one of the input files had the note.<br>
> ><br>
> <br>
> I consider .note.GNU-stack a pointless feature at the moment; it could make<br>
> your program's stack area executable in an obscure way. You should pass `-z<br>
> execstack` to the final link command line if your program really need an<br>
> executable stack.<br>
<br>
I consider the whole note pointless. That's exactly why I am complaining<br>
about adding this junk when it is not necessary or desirable. Not every<br>
OS follows the stupid glibc model of making the stack executable unless<br>
told otherwise.</blockquote><div> </div><div>I wanted to completely ignore .note.GNU-stack and don't add the section when we create an object file. But unfortunately that causes practical issues that I was trying to fix with the patch. If you don't add the section, the linker does an insane thing. That's unfortunate, but in reality we need to add .note.GNU-stack to every object file at the moment. Once the logic to make the stack area executable is removed from the GNU linkers, we could remove this code too.</div></div></div>