[PATCH] D14571: [ELF2] - Implemented PT_GNU_STACK support

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 00:38:35 PST 2015


grimar added a comment.

In http://reviews.llvm.org/D14571#287432, @ruiu wrote:

> Is the logic implemented in this patch correct?
>
> The stack is executable if and only if all object files contain .note.GNU-stack section. The logic implemented in this patch seems to make the stack executable at least one of input files contains .note.GNU-stack section.


It makes it executable only if this one .note.GNU-stack section marked as "x".
I think stack is executable always by default. When the linker performs linking, it marks the stack as executable based on the lowest common demoninator. For example, if everything is marked non-executable except one .o file, the entire library would get marked for an executable stack

Logic implemented makes PT_GNU_STACK header to be generated if at least one of input files contains .note.GNU-stack section. Will it be executable depends on flags of .note.GNU-stack section then. If at least one is executable then stack is marked as executable.

What is incorrect in this patch (just noticed) that if for example we have two .o files and one has ".section .note.GNU-stack,"", at progbits" (non executable) but second does not have .note.GNU-stack section at all then stack should be marked executable, but this patch does not makes it to be so. I`ll fix that in updated diff.


http://reviews.llvm.org/D14571





More information about the llvm-commits mailing list