':class:`bool`: Whether the current binary uses an executable stack.
This is based on the presence of a program header PT_GNU_STACK_
being present, and its setting.
``PT_GNU_STACK``
The p_flags member specifies the permissions on the segment
containing the stack and is used to indicate wether the stack
should be executable. The absense of this header indicates
that the stack will be executable.
In particular, if the header is missing the stack is executable.
If the header is present, it may **explicitly** mark that the stack is
executable.
This is only somewhat accurate.  When using the GNU Linker, it usees
DEFAULT_STACK_PERMS_ to decide whether a lack of ``PT_GNU_STACK``
should mark the stack as executable:
.. code-block:: c
/* On most platforms presume that PT_GNU_STACK is absent and the stack is
* executable.  Other platforms default to a nonexecutable stack and don\'t
* need PT_GNU_STACK to do so.  */
uint_fast16_t stack_flags = DEFAULT_STACK_PERMS;
By searching the source for ``DEFAULT_STACK_PERMS``, we can see which
architectures have which settings.
$ git grep \'#define DEFAULT_STACK_PERMS\' | grep -v PF_X
sysdeps/aarch64/stackinfo.h:31:#define DEFAULT_STACK_PERMS (PF_R|PF_W)
sysdeps/nios2/stackinfo.h:31:#define DEFAULT_STACK_PERMS (PF_R|PF_W)
sysdeps/tile/stackinfo.h:31:#define DEFAULT_STACK_PERMS (PF_R|PF_W)
.. _PT_GNU_STACK: https://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/progheader.html
.. _DEFAULT_STACK_PERMS: https://github.com/bminor/glibc/blob/glibc-2.25/elf/dl-load.c#L1036-L1038'

@property
def execstack(self):

    if (not self.executable):
        return False
    if (not self.nx):
        return True
    for _ in self.iter_segments_by_type('GNU_STACK'):
        break
    else:
        return (self.arch != 'aarch64')
    return False
