On Wed, Oct 18, 2017 at 10:17:49AM +0200, Richard Biener wrote:
> Works for me but as said, why's the linker even caring about
> .note.GNU-stack in objects that do not contain executable code?

The linker simply collects the notes from all *.o files.  One case is
when none of the objects have the notes, then it is considered to be
the legacy state, another when then there is at least one object with that
note, then any object without the note or with X note forces the result
to be RWE, otherwise if all objects have non-X note the result is RW.
The linker doesn't have information what all kinds of sections could contain
trampolines.

If I were to design that stuff now, I'd probably do it differently, but
it behaves this way for 14 years already...

> When we link an object with just .rodata and no proper note will
> the final executable also have an executable stack?

If any other object in the link contains the note, yes.

        Jakub

Reply via email to