aboutsummaryrefslogtreecommitdiff
path: root/ld/lexsup.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2022-04-20 13:37:51 +0100
committerNick Clifton <nickc@redhat.com>2022-04-20 13:39:05 +0100
commit65daf5bed68f3e792e80f7c9a12871fd71da32a2 (patch)
treea55da6b2014760d60106975406377517a8133874 /ld/lexsup.c
parent72b580b8f48927cf7bc4cf8bb951aaeff637d0ee (diff)
downloadgdb-65daf5bed68f3e792e80f7c9a12871fd71da32a2.zip
gdb-65daf5bed68f3e792e80f7c9a12871fd71da32a2.tar.gz
gdb-65daf5bed68f3e792e80f7c9a12871fd71da32a2.tar.bz2
Add linker warning for when it creates an executable stack.
PR 29072
Diffstat (limited to 'ld/lexsup.c')
-rw-r--r--ld/lexsup.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 5acc47e..2929fec 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -536,6 +536,10 @@ static const struct ld_option ld_options[] =
{ {"warn-constructors", no_argument, NULL, OPTION_WARN_CONSTRUCTORS},
'\0', NULL, N_("Warn if global constructors/destructors are seen"),
TWO_DASHES },
+ { {"warn-execstack", no_argument, NULL, OPTION_WARN_EXECSTACK},
+ '\0', NULL, N_("Warn when creating an executable stack"), TWO_DASHES },
+ { {"no-warn-execstack", no_argument, NULL, OPTION_NO_WARN_EXECSTACK},
+ '\0', NULL, N_("Do not warn when creating an executable stack"), TWO_DASHES },
{ {"warn-multiple-gp", no_argument, NULL, OPTION_WARN_MULTIPLE_GP},
'\0', NULL, N_("Warn if the multiple GP values are used"), TWO_DASHES },
{ {"warn-once", no_argument, NULL, OPTION_WARN_ONCE},
@@ -915,6 +919,12 @@ parse_args (unsigned argc, char **argv)
case OPTION_NON_CONTIGUOUS_REGIONS_WARNINGS:
link_info.non_contiguous_regions_warnings = true;
break;
+ case OPTION_WARN_EXECSTACK:
+ link_info.warn_execstack = 1;
+ break;
+ case OPTION_NO_WARN_EXECSTACK:
+ link_info.warn_execstack = 2;
+ break;
case 'e':
lang_add_entry (optarg, true);
break;
@@ -2150,6 +2160,10 @@ elf_static_list_options (FILE *file)
fprintf (file, _("\
-z noexecstack Mark executable as not requiring executable stack\n"));
fprintf (file, _("\
+ --warn-execstack Generate a warning if the stack is executable\n"));
+ fprintf (file, _("\
+ --no-warn-execstack Do not generate a warning if the stack is executable\n"));
+ fprintf (file, _("\
-z unique-symbol Avoid duplicated local symbol names\n"));
fprintf (file, _("\
-z nounique-symbol Keep duplicated local symbol names (default)\n"));