[lld] r340902 - Always add a .note.GNU-stack section if -r.

Joerg Sonnenberger via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 31 05:55:19 PDT 2018


On Thu, Aug 30, 2018 at 10:07:34AM +0900, Rui Ueyama via llvm-commits wrote:
> On Thu, Aug 30, 2018 at 7:16 AM Joerg Sonnenberger <joerg at bec.de> wrote:
> 
> > On Wed, Aug 29, 2018 at 07:27:09AM -0000, Rui Ueyama via llvm-commits
> > wrote:
> > > Author: ruiu
> > > Date: Wed Aug 29 00:27:09 2018
> > > New Revision: 340902
> > >
> > > URL: http://llvm.org/viewvc/llvm-project?rev=340902&view=rev
> > > Log:
> > > Always add a .note.GNU-stack section if -r.
> > >
> > > With this patch, lld creates a .note.GNU_stack and adds that to an
> > > output file if it is creating a re-linkable object file (i.e. if -r
> > > is given). If we don't do this, and if you use GNU linkers as a final
> > > linker, they create an executable whose stack area is executable,
> > > which is considered pretty bad these days.
> >
> > It should only be done if at least one of the input files had the note.
> >
> 
> I consider .note.GNU-stack a pointless feature at the moment; it could make
> your program's stack area executable in an obscure way. You should pass `-z
> execstack` to the final link command line if your program really need an
> executable stack.

I consider the whole note pointless. That's exactly why I am complaining
about adding this junk when it is not necessary or desirable. Not every
OS follows the stupid glibc model of making the stack executable unless
told otherwise.

Joerg


More information about the llvm-commits mailing list