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.
This commit is contained in:
Alan Modra
2022-05-20 14:59:05 +09:30
parent ef5d515048
commit bd7d326deb
6 changed files with 17 additions and 22 deletions

View File

@@ -927,7 +927,7 @@ parse_args (unsigned argc, char **argv)
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;
@@ -2169,14 +2169,14 @@ elf_static_list_options (FILE *file)
-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