From 0d38576a34ec64a1b4500c9277a8e9d0f07e6774 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 25 Apr 2022 12:51:31 +0100 Subject: [PATCH] Emit a note warning the user that creating an executable stack because of a missing .note.GNU-stack section is deprecated. PR 29072 bfd * elflink.c (bfd_elf_size_dynamic_sections): Display a note to the user that the current ehaviour of creating an executable stack because of a missing .note.GNU-stack section is deprecated and will be changed in a future release. binutils* testsuite/lib/binutils-common.exp (prune_warnings_extra): Filter out notes about the executable stacjk behaviour beign deprecated. ld * testsuite/ld-elf/pr29072.b.warn: Update to include the note about the linker's behaviour being depreccated. --- bfd/ChangeLog | 8 ++++++++ bfd/elflink.c | 8 ++++++-- binutils/ChangeLog | 6 ++++++ binutils/testsuite/lib/binutils-common.exp | 1 + ld/ChangeLog | 6 ++++++ ld/testsuite/ld-elf/pr29072.b.warn | 1 + 6 files changed, 28 insertions(+), 2 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 957d8fd556c..5444381ede0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2022-04-25 Nick Clifton + + PR 29072 + * elflink.c (bfd_elf_size_dynamic_sections): Display a note to the + user that the current ehaviour of creating an executable stack + because of a missing .note.GNU-stack section is deprecated and + will be changed in a future release. + 2022-04-20 Clément Chigot * coff-rs6000.c (xcoff_reloc_type_noop): Add info argument. diff --git a/bfd/elflink.c b/bfd/elflink.c index d6dd9c16a26..b54ee517c75 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -7190,9 +7190,13 @@ warning: enabling an executable stack because of -z execstack command line optio warning: %s: requires executable stack (because the .note.GNU-stack section is executable)"), bfd_get_filename (noteobj)); else if (emptyobj) - _bfd_error_handler (_("\ + { + _bfd_error_handler (_("\ warning: %s: missing .note.GNU-stack section implies executable stack"), - bfd_get_filename (emptyobj)); + bfd_get_filename (emptyobj)); + _bfd_error_handler (_("\ +NOTE: This behaviour is deprecated and will be removed in a future version of the linker")); + } } } elf_stack_flags (output_bfd) = PF_R | PF_W | exec; diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 26103a0279d..ab65d20aca1 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2022-04-25 Nick Clifton + + PR 29072 + * testsuite/lib/binutils-common.exp (prune_warnings_extra): Filter + out notes about the executable stacjk behaviour beign deprecated. + 2022-04-12 Nick Clifton PR 28992 diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp index 87b0d101c6c..a76a310c199 100644 --- a/binutils/testsuite/lib/binutils-common.exp +++ b/binutils/testsuite/lib/binutils-common.exp @@ -638,6 +638,7 @@ proc prune_warnings_extra { text } { # PR binutils/23898: It is OK to have gaps in build notes. regsub -all "(^|\n)(\[^\n\]*: Warning: Gap in build notes detected from\[^\n\]*\n?)+" $text "\\1" text regsub -all "(^|\n)(\[^\n\]*: warning:\[^\n\]*missing \\.note\\.GNU-stack section\[^\n\]*\n?)+" $text "\\1" text + regsub -all "(^|\n)(\[^\n\]*: NOTE: This behaviour is deprecated\[^\n\]*\n?)+" $text "\\1" text return $text } diff --git a/ld/ChangeLog b/ld/ChangeLog index 86ac875c4d1..456c11883ac 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2022-04-25 Nick Clifton + + PR 29072 + * testsuite/ld-elf/pr29072.b.warn: Update to include the note + about the linker's behaviour being depreccated. + 2022-04-20 Clément Chigot * emultempl/aix.em (params): New variable. diff --git a/ld/testsuite/ld-elf/pr29072.b.warn b/ld/testsuite/ld-elf/pr29072.b.warn index 08f11887921..9058cc0e68b 100644 --- a/ld/testsuite/ld-elf/pr29072.b.warn +++ b/ld/testsuite/ld-elf/pr29072.b.warn @@ -1 +1,2 @@ .*: warning: .*\.o: missing \.note\.GNU-stack section implies executable stack +.*: NOTE: This behaviour is deprecated and will be removed in a future version of the linker -- 2.30.2