{
if (exec)
{
- if (info->warn_execstack != 2)
+ if (info->warn_execstack != 0)
{
/* PR 29072: Because an executable stack is a serious
security risk, make sure that the user knows that it is
unsigned int noexecstack: 1;
/* Tri-state variable:
- 0 => warn if the linker is creating an executable stack, but
- execstack (above) is 0.
- 1 => warn if the linker is creating an executable stack; ignores
- the value of execstack.
- 2 => do not warn.
- 3 => not used. */
+ 0 => do not warn when creating an executable stack.
+ 1 => always warn when creating an executable stack.
+ >1 => warn when creating an executable stack if execstack is 0. */
unsigned int warn_execstack: 2;
/* TRUE if warnings should not be generated for TLS segments with eXecute
-ac_default_ld_warn_execstack=unset
+# By default warn when an executable stack is created due to object files
+# requesting such, not when the user specifies -z execstack.
+ac_default_ld_warn_execstack=2
# Check whether --enable-warn-execstack was given.
if test "${enable_warn_execstack+set}" = set; then :
enableval=$enable_warn_execstack; case "${enableval}" in
yes) ac_default_ld_warn_execstack=1 ;;
- no) ac_default_ld_warn_execstack=-1 ;;
+ no) ac_default_ld_warn_execstack=0 ;;
esac
fi
-if test "${ac_default_ld_warn_execstack}" = unset; then
- ac_default_ld_warn_execstack=0
-fi
cat >>confdefs.h <<_ACEOF
#define DEFAULT_LD_WARN_EXECSTACK $ac_default_ld_warn_execstack
esac])
-ac_default_ld_warn_execstack=unset
+# By default warn when an executable stack is created due to object files
+# requesting such, not when the user specifies -z execstack.
+ac_default_ld_warn_execstack=2
AC_ARG_ENABLE(warn-execstack,
AS_HELP_STRING([--enable-warn-execstack],
[enable warnings when creating an executable stack]),
[case "${enableval}" in
yes) ac_default_ld_warn_execstack=1 ;;
- no) ac_default_ld_warn_execstack=-1 ;;
+ no) ac_default_ld_warn_execstack=0 ;;
esac])
ac_default_ld_warn_rwx_segments=unset
[Define to 1 if you want to enable -z separate-code in ELF linker by default.])
-if test "${ac_default_ld_warn_execstack}" = unset; then
- ac_default_ld_warn_execstack=0
-fi
AC_DEFINE_UNQUOTED(DEFAULT_LD_WARN_EXECSTACK,
$ac_default_ld_warn_execstack,
[Define to 1 if you want to enable --warn-execstack in ELF linker by default.])
detect the use of global constructors.
@kindex --warn-execstack
-@cindex warnings, on exectuable stack
+@cindex warnings, on executable stack
@cindex executable stack, warnings on
@item --warn-execstack
@itemx --no-warn-execstack
On the other hand the linker will normally warn if the stack is made
executable because one or more of the input files need an execuable
stack and neither of the @command{-z execstack} or @command{-z
-noexecstack} comman line options have been specified. This warning
+noexecstack} command line options have been specified. This warning
can be disabled via the @command{--no-warn-execstack} option.
Note: ELF format input files specify that they need an executable
link_info.warn_execstack = 1;
break;
case OPTION_NO_WARN_EXECSTACK:
- link_info.warn_execstack = 2;
+ link_info.warn_execstack = 0;
break;
case OPTION_WARN_RWX_SEGMENTS:
link_info.no_warn_rwx_segments = 0;
-z execstack Mark executable as requiring executable stack\n"));
fprintf (file, _("\
-z noexecstack Mark executable as not requiring executable stack\n"));
-#if DEFAULT_LD_WARN_EXECSTACK > 0
+#if DEFAULT_LD_WARN_EXECSTACK == 1
fprintf (file, _("\
--warn-execstack Generate a warning if the stack is executable (default)\n"));
#else
fprintf (file, _("\
--warn-execstack Generate a warning if the stack is executable\n"));
#endif
-#if DEFAULT_LD_WARN_EXECSTACK < 0
+#if DEFAULT_LD_WARN_EXECSTACK == 0
fprintf (file, _("\
--no-warn-execstack Do not generate a warning if the stack is executable (default)\n"));
#else