From bd7d326debef642c0a98f859807d794d8d68afc7 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 20 May 2022 14:59:05 +0930 Subject: Tidy warn-execstack handling Make ld and bfd values consistent by swapping values 0 and 2 in link_info.warn_execstack. This has the benefit of making the value an "extended" boolean, with 0 meaning no warning, 1 meaning warn, other values a conditional warning. Yes, this patch introduces fails on arm/aarch64. Not a problem with this patch but an arm/aarch64 before_parse problem. bfd/ * elflink.c (bfd_elf_size_dynamic_sections): Adjust warn_execstack test. include/ * bfdlink.h (warn_execstack): Swap 0 and 2 meaning. ld/ * configure.ac (DEFAULT_LD_WARN_EXECSTACK): Use values of 0, 1, 2 consistent with link_info.warn_execstack. * ld.texi: Typo fixes. * lexsup.c (parse_args): Adjust setting of link_info.warn_execstack. (elf_static_list_options): Adjust help message conditions. * configure: Regenerate. --- ld/configure.ac | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'ld/configure.ac') diff --git a/ld/configure.ac b/ld/configure.ac index 0b29e810dde..01121480c6d 100644 --- a/ld/configure.ac +++ b/ld/configure.ac @@ -204,13 +204,15 @@ AC_ARG_ENABLE(separate-code, 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 @@ -531,9 +533,6 @@ AC_DEFINE_UNQUOTED(DEFAULT_LD_Z_SEPARATE_CODE, [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.]) -- cgit v1.2.1