<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Nov 24, 2015 at 2:51 PM, Joerg Sonnenberger via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Tue, Nov 24, 2015 at 02:42:48PM -0800, Rui Ueyama wrote:<br>
> On Tue, Nov 24, 2015 at 2:37 PM, Joerg Sonnenberger via llvm-commits <<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
><br>
> > On Tue, Nov 24, 2015 at 02:23:34PM -0800, Rui Ueyama wrote:<br>
> > > Omitting PT_GNU_STACK when -z execstack is provided is easy, but it leads<br>
> > > to a counter-intuitive behavior on platforms that do not recognize<br>
> > > PT_GNU_STACK and stack is not executable by default. (You need to pass -z<br>
> > > execstack to make it run on such platforms, but it wouldn't make the<br>
> > stack<br>
> > > executable.)<br>
> ><br>
> > That argument makes no sense to me and I am not even sure I understand<br>
> > it correctly. A platform (like NetBSD) that doesn't recognize<br>
> > PT_GNU_STACK and provides a non-executable stack by default will not be<br>
> > affected at all. Yes, it won't do what is intended, but it is no worse<br>
> > than the current situation of creating a bogus program header either.<br>
> ><br>
><br>
> Let me rephrase. That you needs to pass "-z execstack" (although you don't<br>
> intend to make the stack executable) to make the output compatible with a<br>
> platform that rejects executables with PT_GNU_STACK is I think<br>
> counter-intuitive.<br>
<br>
</span>I agree that it is counter-intuive from the option name, but not if you<br>
consider the header entry as a way to only flag binaries with<br>
non-default non-execstack. A better name would be -z noexecstackheader,<br>
but the question really just is that *some* form should be supported.<br>
Not emiting the header if it doesn't do anything sounds perfectly<br>
reasonable to me, it wastes less space and allows producing binaries<br>
fully matching the original ELF specification.<br></blockquote><div><br></div></div>OK, I can omit PT_GNU_STACK segment if -z execstack is provided. It is simple enough and also provides a way to remove the segment. Does this sound good?</div></div>