From: Nick Clifton Date: Wed, 20 Apr 2022 12:37:51 +0000 (+0100) Subject: Add linker warning for when it creates an executable stack. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=65daf5bed6;p=binutils-gdb.git Add linker warning for when it creates an executable stack. PR 29072 --- diff --git a/bfd/elflink.c b/bfd/elflink.c index 5a070a26e35..d6dd9c16a26 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -7124,13 +7124,23 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, /* Determine any GNU_STACK segment requirements, after the backend has had a chance to set a default segment size. */ if (info->execstack) - elf_stack_flags (output_bfd) = PF_R | PF_W | PF_X; + { + /* If the user has explicitly requested warnings, then generate one even + though the choice is the result of another command line option. */ + if (info->warn_execstack == 1) + _bfd_error_handler + (_("\ +warning: enabling an executable stack because of -z execstack command line option")); + elf_stack_flags (output_bfd) = PF_R | PF_W | PF_X; + } else if (info->noexecstack) elf_stack_flags (output_bfd) = PF_R | PF_W; else { bfd *inputobj; asection *notesec = NULL; + bfd *noteobj = NULL; + bfd *emptyobj = NULL; int exec = 0; for (inputobj = info->input_bfds; @@ -7149,15 +7159,45 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, s = bfd_get_section_by_name (inputobj, ".note.GNU-stack"); if (s) { - if (s->flags & SEC_CODE) - exec = PF_X; notesec = s; + if (s->flags & SEC_CODE) + { + noteobj = inputobj; + exec = PF_X; + /* There is no point in scanning the remaining bfds. */ + break; + } } else if (bed->default_execstack) - exec = PF_X; + { + exec = PF_X; + emptyobj = inputobj; + } } + if (notesec || info->stacksize > 0) - elf_stack_flags (output_bfd) = PF_R | PF_W | exec; + { + if (exec) + { + if (info->warn_execstack != 2) + { + /* PR 29072: Because an executable stack is a serious + security risk, make sure that the user knows that it is + being enabled despite the fact that it was not requested + on the command line. */ + if (noteobj) + _bfd_error_handler (_("\ +warning: %s: requires executable stack (because the .note.GNU-stack section is executable)"), + bfd_get_filename (noteobj)); + else if (emptyobj) + _bfd_error_handler (_("\ +warning: %s: missing .note.GNU-stack section implies executable stack"), + bfd_get_filename (emptyobj)); + } + } + elf_stack_flags (output_bfd) = PF_R | PF_W | exec; + } + if (notesec && exec && bfd_link_relocatable (info) && notesec->output_section != bfd_abs_section_ptr) notesec->output_section->flags |= SEC_CODE; diff --git a/include/bfdlink.h b/include/bfdlink.h index 69fc9d33ff4..b16f3f44ca5 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -489,6 +489,10 @@ struct bfd_link_info flags. */ unsigned int noexecstack: 1; + /* Tri-state variable: 0 => not set by user; 1 => set, warnings + enabled; 2 => warnings disabled; 3 => unused. */ + unsigned int warn_execstack: 2; + /* TRUE if we want to produced optimized output files. This might need much more time and therefore must be explicitly selected. */ unsigned int optimize: 1; diff --git a/ld/NEWS b/ld/NEWS index 76de7f606c0..b84553109d2 100644 --- a/ld/NEWS +++ b/ld/NEWS @@ -1,5 +1,13 @@ -*- text -*- +* The linker will now generate a warning message if the stack is made + executable. By default this warning is not issued if the user has + specifically requested an executable stack via the "-z execstack" + command line option, but the warning can be forced via the new + "--warn-execstack" option. Alternatively all warnings about creating + an executable stack can be suppressed via the "--no-warn-execstack" + option. + * TYPE= is now supported in an output section description to set the section type value. diff --git a/ld/emultempl/avrelf.em b/ld/emultempl/avrelf.em index 555d259d7be..617bfef558b 100644 --- a/ld/emultempl/avrelf.em +++ b/ld/emultempl/avrelf.em @@ -134,6 +134,7 @@ avr_elf_create_output_section_statements (void) einfo (_("%X%P: can not create stub BFD: %E\n")); return; } + stub_file->the_bfd->flags |= BFD_LINKER_CREATED; /* Now we add the stub section. */ diff --git a/ld/ld.texi b/ld/ld.texi index c8335a7e41e..6ac5344ebf4 100644 --- a/ld/ld.texi +++ b/ld/ld.texi @@ -2653,6 +2653,33 @@ Warn if any global constructors are used. This is only useful for a few object file formats. For formats like COFF or ELF, the linker can not detect the use of global constructors. +@kindex --warn-execstack +@cindex warnings, on exectuable stack +@cindex executable stack, warnings on +@item --warn-execstack +@itemx --no-warn-execstack +On ELF platforms this option controls how the linker generates warning +messages when it creates an output file with an executable stack. By +default the linker will not warn if the @command{-z execstack} command +line option has been used, but this behaviour can be overridden by the +@option{--warn-execstack} option. + +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 +can be disabled via the @command{--no-warn-execstack} option. + +Note: ELF format input files specify that they need an executable +stack by having a @var{.note.GNU-stack} section with the executable +bit set in its section flags. They can specify that they do not need +an executable stack by having that section, but without the executable +flag bit set. If an input file does not have a @var{.note.GNU-stack} +section present then the default behaviour is target specific. For +some targets, then absence of such a section implies that an +executable stack @emph{is} required. This is often a problem for hand +crafted assembler files. + @kindex --warn-multiple-gp @item --warn-multiple-gp Warn if multiple global pointer values are required in the output file. diff --git a/ld/ldlex.h b/ld/ldlex.h index bc58fea73cc..1d42dc8672e 100644 --- a/ld/ldlex.h +++ b/ld/ldlex.h @@ -164,6 +164,8 @@ enum option_values OPTION_CTF_VARIABLES, OPTION_NO_CTF_VARIABLES, OPTION_CTF_SHARE_TYPES, + OPTION_WARN_EXECSTACK, + OPTION_NO_WARN_EXECSTACK, }; /* The initial parser states. */ diff --git a/ld/lexsup.c b/ld/lexsup.c index 5acc47ed5a0..2929fecb604 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")); diff --git a/ld/testsuite/ld-elf/eh4.d b/ld/testsuite/ld-elf/eh4.d index f33431a8b7f..95abafbf9ce 100644 --- a/ld/testsuite/ld-elf/eh4.d +++ b/ld/testsuite/ld-elf/eh4.d @@ -1,7 +1,7 @@ #source: eh4.s #source: eh4a.s #as: --64 -#ld: -melf_x86_64 -shared -Ttext 0x400 -z max-page-size=0x200000 -z noseparate-code +#ld: -melf_x86_64 -shared -Ttext 0x400 -z max-page-size=0x200000 -z noseparate-code -z noexecstack #readelf: -wf #target: x86_64-*-* diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp index 119908cda4e..ec61e659e06 100644 --- a/ld/testsuite/ld-elf/elf.exp +++ b/ld/testsuite/ld-elf/elf.exp @@ -180,9 +180,24 @@ if { [check_gc_sections_available] && ![istarget "v850-*-*"] } { } } -if { [istarget *-*-*linux*] - || [istarget *-*-nacl*] - || [istarget *-*-gnu*] } { +proc target_defaults_to_execstack {} { + if { [istarget "aarch64*-*-*"] + || [istarget "arc*-*-*"] + || [istarget "ia64*-*-*"] + || [istarget "loongarch*-*-*"] + || [istarget "nios2*-*-*"] + || [istarget "powerpc64*-*-*"] + || [istarget "riscv*-*-*"] + || [istarget "tilegx*-*-*"] + || [istarget "tilepro*-*-*"] } { + return 0 + } + return 1 +} + +if { [istarget *-*-*linux*] + || [istarget *-*-nacl*] + || [istarget *-*-gnu*] } { run_ld_link_tests [list \ [list "stack exec" \ "-z execstack" \ @@ -199,7 +214,7 @@ if { [istarget *-*-*linux*] {{readelf {-Wl} stack-noexec.rd}} \ "stack-noexec.exe"] \ [list "stack size" \ - "-z stack-size=0x123400" \ + "-z stack-size=0x123400 -z noexecstack" \ "" \ "" \ {stack.s} \ @@ -212,7 +227,49 @@ if { [istarget *-*-*linux*] {pr23900-1.s} \ [list [list "readelf" {-Wl} $pr23900_1_exp]] \ "pr23900-1.exe"] \ + [list "PR ld/29072 (warn about an executable .note-GNU-stack)" \ + "-e 0" \ + "" \ + "" \ + {pr29072-a.s} \ + {{ld pr29072.a.warn}} \ + "pr29072-a.exe"] \ + [list "PR 29072 (warn about -z execstack)" \ + "-z execstack --warn-execstack" \ + "" \ + "" \ + {stack.s} \ + {{ld pr29072.c.warn}} \ + "pr29072-c.exe"] \ + [list "PR ld/29072 (suppress warnings about executable stack)" \ + "-e 0 --no-warn-execstack" \ + "" \ + "" \ + {pr29072-a.s} \ + {} \ + "pr29072-d.exe"] \ + ] + if { [target_defaults_to_execstack] } { + run_ld_link_tests [list \ + [list "PR ld/29072 (warn about absent .note-GNU-stack)" \ + "-e 0 -z stack-size=0x123400" \ + "" \ + "" \ + {pr29072-b.s} \ + {{ld pr29072.b.warn}} \ + "pr29072-b.exe"] \ ] + } else { + run_ld_link_tests [list \ + [list "PR ld/29072 (ignore absent .note-GNU-stackk)" \ + "-e 0 -z stack-size=0x123400" \ + "" \ + "" \ + {pr29072-b.s} \ + {} \ + "pr29072-b.exe"] \ + ] + } } if [check_gc_sections_available] { @@ -365,7 +422,7 @@ if { [istarget *-*-linux*] run_ld_link_exec_tests [list \ [list \ "Run mbind2a" \ - "$NOPIE_LDFLAGS -Wl,-z,common-page-size=0x4000" \ + "$NOPIE_LDFLAGS -Wl,-z,common-page-size=0x4000 -Wl,-z,noexecstack" \ "" \ { mbind2a.s mbind2b.c } \ "mbind2a" \ @@ -374,7 +431,7 @@ if { [istarget *-*-linux*] ] \ [list \ "Run mbind2b" \ - "-static -Wl,-z,common-page-size=0x4000" \ + "-static -Wl,-z,common-page-size=0x4000 -Wl,-z,noexecstack" \ "" \ { mbind2a.s mbind2b.c } \ "mbind2b" \ diff --git a/ld/testsuite/ld-elf/linux-x86.exp b/ld/testsuite/ld-elf/linux-x86.exp index 2e0cbd37f17..e3f20189e4c 100644 --- a/ld/testsuite/ld-elf/linux-x86.exp +++ b/ld/testsuite/ld-elf/linux-x86.exp @@ -51,7 +51,7 @@ run_ld_link_tests [list \ run_ld_link_exec_tests [list \ [list \ "Run PR ld/23428 test" \ - "--no-dynamic-linker -z separate-code" \ + "--no-dynamic-linker -z separate-code -z noexecstack" \ "" \ { linux-x86.S pr23428.c dummy.s } \ "pr23428" \ @@ -76,7 +76,7 @@ run_ld_link_tests [list \ run_cc_link_tests [list \ [list \ "Build indirect-extern-access-1.so" \ - "-shared" \ + "-shared -z noexecstack" \ "-fPIC" \ { indirect-extern-access-1a.c } \ {} \ @@ -84,7 +84,7 @@ run_cc_link_tests [list \ ] \ [list \ "Build indirect-extern-access-1a without PIE" \ - "$NOPIE_LDFLAGS -Wl,--no-as-needed \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed -z noexecstack \ tmpdir/indirect-extern-access-1.so" \ "$NOPIE_CFLAGS" \ { indirect-extern-access.S indirect-extern-access-1b.c } \ @@ -101,7 +101,7 @@ run_cc_link_tests [list \ ] \ [list \ "Build indirect-extern-access-2a without PIE" \ - "$NOPIE_LDFLAGS -Wl,--no-as-needed \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed -z noexecstack \ tmpdir/indirect-extern-access-2.so" \ "$NOPIE_CFLAGS" \ { indirect-extern-access.S indirect-extern-access-1b.c } \ @@ -110,7 +110,7 @@ run_cc_link_tests [list \ ] \ [list \ "Build indirect-extern-access-2b with PIE" \ - "-pie -Wl,--no-as-needed \ + "-pie -Wl,--no-as-needed -z noexecstack \ tmpdir/indirect-extern-access-2.so" \ "-fpie" \ { indirect-extern-access.S indirect-extern-access-2b.c } \ @@ -139,7 +139,7 @@ run_cc_link_tests [list \ run_ld_link_exec_tests [list \ [list \ "Run indirect-extern-access-1a without PIE" \ - "$NOPIE_LDFLAGS" \ + "$NOPIE_LDFLAGS -z noexecstack" \ "" \ { indirect-extern-access.S indirect-extern-access-1b.c } \ "indirect-extern-access-1a" \ @@ -151,7 +151,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run indirect-extern-access-1b with PIE" \ - "-pie" \ + "-pie -z noexecstack" \ "" \ { indirect-extern-access.S indirect-extern-access-1b.c } \ "indirect-extern-access-1b" \ @@ -163,7 +163,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run indirect-extern-access-2a without PIE" \ - "$NOPIE_LDFLAGS" \ + "$NOPIE_LDFLAGS -z noexecstack" \ "" \ { indirect-extern-access.S indirect-extern-access-2b.c } \ "indirect-extern-access-2a" \ @@ -175,7 +175,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run indirect-extern-access-2b with PIE" \ - "-pie" \ + "-pie -z noexecstack" \ "" \ { indirect-extern-access.S indirect-extern-access-2b.c } \ "indirect-extern-access-2b" \ @@ -292,7 +292,7 @@ proc check_pr25749a {testname srcfilea srcfileb cflags ldflags lderror} { run_cc_link_tests [list \ [list \ "Build $testname ($ldflags $cflags)" \ - "$ldflags tmpdir/pr25749-bin.o" \ + "$ldflags tmpdir/pr25749-bin.o -z noexecstack" \ "$cflags -I../bfd" \ [list $srcfilea $srcfileb]\ {{readelf {-Wr} pr25749.rd}} \ @@ -302,7 +302,7 @@ proc check_pr25749a {testname srcfilea srcfileb cflags ldflags lderror} { run_ld_link_exec_tests [list \ [list \ "Run ${testname}a ($ldflags $cflags)" \ - "$ldflags tmpdir/pr25749-bin.o" \ + "$ldflags tmpdir/pr25749-bin.o -z noexecstack" \ "" \ [list $srcfilea $srcfileb]\ "${testname}a" \ @@ -314,7 +314,7 @@ proc check_pr25749a {testname srcfilea srcfileb cflags ldflags lderror} { run_cc_link_tests [list \ [list \ "Build $testname ($ldflags $cflags)" \ - "$ldflags tmpdir/pr25749-bin.o" \ + "$ldflags tmpdir/pr25749-bin.o -z noexecstack" \ "$cflags -I../bfd" \ [list $srcfilea $srcfileb]\ [list [list error_output $lderror]] \ @@ -395,7 +395,7 @@ proc check_pr25749b {testname srcfilea srcfileb cflags ldflags dsoldflags args} run_cc_link_tests [list \ [list \ "Build lib${testname}.so ($dsoldflags)" \ - "-shared $dsoldflags tmpdir/pr25749-bin.o" \ + "-shared $dsoldflags tmpdir/pr25749-bin.o -z noexecstack" \ "-fPIC -I../bfd" \ [list $srcfileb] \ {{readelf {-Wr} pr25749.rd}} \ @@ -411,7 +411,7 @@ proc check_pr25749b {testname srcfilea srcfileb cflags ldflags dsoldflags args} run_ld_link_exec_tests [list \ [list \ "Run ${testname}b ($ldflags $cflags)" \ - "$ldflags -Wl,--no-as-needed tmpdir/lib${testname}.so" \ + "$ldflags -Wl,--no-as-needed tmpdir/lib${testname}.so -z noexecstack" \ "" \ [list $srcfilea]\ "${testname}b" \ diff --git a/ld/testsuite/ld-elf/pr29072-a.s b/ld/testsuite/ld-elf/pr29072-a.s new file mode 100644 index 00000000000..12ba994e04f --- /dev/null +++ b/ld/testsuite/ld-elf/pr29072-a.s @@ -0,0 +1,6 @@ + .text + .global main +main: + .nop + + .section .note.GNU-stack,"x",%progbits diff --git a/ld/testsuite/ld-elf/pr29072-b.s b/ld/testsuite/ld-elf/pr29072-b.s new file mode 100644 index 00000000000..99df33210e5 --- /dev/null +++ b/ld/testsuite/ld-elf/pr29072-b.s @@ -0,0 +1,5 @@ + .text + .globl foo +foo: + .nop + diff --git a/ld/testsuite/ld-elf/pr29072.a.warn b/ld/testsuite/ld-elf/pr29072.a.warn new file mode 100644 index 00000000000..aecff233da9 --- /dev/null +++ b/ld/testsuite/ld-elf/pr29072.a.warn @@ -0,0 +1 @@ +.*: warning: .*\.o: requires executable stack \(because the \.note\.GNU-stack section is executable\) diff --git a/ld/testsuite/ld-elf/pr29072.b.warn b/ld/testsuite/ld-elf/pr29072.b.warn new file mode 100644 index 00000000000..08f11887921 --- /dev/null +++ b/ld/testsuite/ld-elf/pr29072.b.warn @@ -0,0 +1 @@ +.*: warning: .*\.o: missing \.note\.GNU-stack section implies executable stack diff --git a/ld/testsuite/ld-elf/pr29072.c.warn b/ld/testsuite/ld-elf/pr29072.c.warn new file mode 100644 index 00000000000..e058be43e72 --- /dev/null +++ b/ld/testsuite/ld-elf/pr29072.c.warn @@ -0,0 +1 @@ +.*: warning: enabling an executable stack because of -z execstack command line option diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 1381544e6f8..06c3202d5cc 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -914,7 +914,7 @@ run_cc_link_tests [list \ if { ![istarget alpha-*-*] } { append build_tests { {"Build pr19073a.o" - "-r -nostdlib" "" + "-r -nostdlib -z noexecstack" "" {pr19073.s} {} "pr19073a.o"} {"Build libpr19073.so" "-shared -Wl,--version-script=pr19073.map tmpdir/pr19073a.o" "-fPIC" diff --git a/ld/testsuite/ld-frv/fdpic1.s b/ld/testsuite/ld-frv/fdpic1.s index 29f7fff8703..fa8aa482428 100644 --- a/ld/testsuite/ld-frv/fdpic1.s +++ b/ld/testsuite/ld-frv/fdpic1.s @@ -62,3 +62,4 @@ D1: .D4: .picptr funcdesc(.Fb) .word .Fb + .section .note.GNU-stack diff --git a/ld/testsuite/ld-frv/fdpic2.s b/ld/testsuite/ld-frv/fdpic2.s index 29876436d34..aa42c2980d2 100644 --- a/ld/testsuite/ld-frv/fdpic2.s +++ b/ld/testsuite/ld-frv/fdpic2.s @@ -79,3 +79,4 @@ GD3: GD4: .picptr funcdesc(GFb) .word GFb + .section .note.GNU-stack diff --git a/ld/testsuite/ld-frv/fdpic3.s b/ld/testsuite/ld-frv/fdpic3.s index f867b93d9a7..5fa5b0200ae 100644 --- a/ld/testsuite/ld-frv/fdpic3.s +++ b/ld/testsuite/ld-frv/fdpic3.s @@ -97,3 +97,4 @@ HD3: HD4: .picptr funcdesc(HFb) .word HFb + .section .note.GNU-stack diff --git a/ld/testsuite/ld-frv/fdpic4.s b/ld/testsuite/ld-frv/fdpic4.s index 795ae45516e..c877407c157 100644 --- a/ld/testsuite/ld-frv/fdpic4.s +++ b/ld/testsuite/ld-frv/fdpic4.s @@ -97,3 +97,4 @@ PD3: PD4: .picptr funcdesc(PFb) .word PFb + .section .note.GNU-stack diff --git a/ld/testsuite/ld-frv/fdpic5.s b/ld/testsuite/ld-frv/fdpic5.s index f4d466a82e0..d4fd8930d8e 100644 --- a/ld/testsuite/ld-frv/fdpic5.s +++ b/ld/testsuite/ld-frv/fdpic5.s @@ -36,3 +36,4 @@ D5: .picptr funcdesc(UFb) .word UFb + .section .note.GNU-stack diff --git a/ld/testsuite/ld-frv/fdpic6.s b/ld/testsuite/ld-frv/fdpic6.s index cd8e1d0e358..f2befde5ffd 100644 --- a/ld/testsuite/ld-frv/fdpic6.s +++ b/ld/testsuite/ld-frv/fdpic6.s @@ -53,3 +53,4 @@ D6: .picptr funcdesc(WFb) .word WFb + .section .note.GNU-stack diff --git a/ld/testsuite/ld-frv/fdpic7.s b/ld/testsuite/ld-frv/fdpic7.s index ceac5fcd7bc..60a345299c7 100644 --- a/ld/testsuite/ld-frv/fdpic7.s +++ b/ld/testsuite/ld-frv/fdpic7.s @@ -61,3 +61,4 @@ D7: .D4: .picptr funcdesc(.Fb+4) .word .Fb+4 + .section .note.GNU-stack diff --git a/ld/testsuite/ld-frv/fdpic8.s b/ld/testsuite/ld-frv/fdpic8.s index 037250fae8c..d881f887dd8 100644 --- a/ld/testsuite/ld-frv/fdpic8.s +++ b/ld/testsuite/ld-frv/fdpic8.s @@ -79,3 +79,4 @@ GD3: GD4: .picptr funcdesc(GFb+4) .word GFb+4 + .section .note.GNU-stack diff --git a/ld/testsuite/ld-frv/tls-1-dep.s b/ld/testsuite/ld-frv/tls-1-dep.s index 75daab732b5..aa5004b22bd 100644 --- a/ld/testsuite/ld-frv/tls-1-dep.s +++ b/ld/testsuite/ld-frv/tls-1-dep.s @@ -5,3 +5,4 @@ .size x, 4 x: .zero 4 + .section .note.GNU-stack diff --git a/ld/testsuite/ld-frv/tls-1.s b/ld/testsuite/ld-frv/tls-1.s index a13c91bc2d6..213acf0ae3f 100644 --- a/ld/testsuite/ld-frv/tls-1.s +++ b/ld/testsuite/ld-frv/tls-1.s @@ -83,3 +83,5 @@ _start: sethi.p #gottlsoffhi(0), gr14 setlo #gottlsofflo(0), gr14 ld #tlsoff(0)@(gr15, gr14), gr9 + + .section .note.GNU-stack diff --git a/ld/testsuite/ld-frv/tls-2.s b/ld/testsuite/ld-frv/tls-2.s index f0712e32b95..28a2930c969 100644 --- a/ld/testsuite/ld-frv/tls-2.s +++ b/ld/testsuite/ld-frv/tls-2.s @@ -181,3 +181,5 @@ _start: setlo #gottlsofflo(i+1+4096), gr8 ld #tlsoff(i+1+4096)@(gr15, gr8), gr9 .endif + + .section .note.GNU-stack diff --git a/ld/testsuite/ld-frv/tls-3.s b/ld/testsuite/ld-frv/tls-3.s index 6dd7972837c..59928884e91 100644 --- a/ld/testsuite/ld-frv/tls-3.s +++ b/ld/testsuite/ld-frv/tls-3.s @@ -18,3 +18,5 @@ _start: sethi.p #gottlsoffhi(u), gr14 setlo #gottlsofflo(u), gr14 ld #tlsoff(u)@(gr15, gr14), gr9 + + .section .note.GNU-stack diff --git a/ld/testsuite/ld-gc/dummy.s b/ld/testsuite/ld-gc/dummy.s index 403f98000d9..66d3b2a8856 100644 --- a/ld/testsuite/ld-gc/dummy.s +++ b/ld/testsuite/ld-gc/dummy.s @@ -1 +1,2 @@ # Dummy + .section ".note.GNU-stack" diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index fadbd160420..471a1f79547 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -240,12 +240,12 @@ set i386tests { "--32 -mx86-used-note=yes" { pr19827a.S } {{readelf {-rW} pr19827.rd}} "pr19827.so"} {"Build pr27193a.so" - "-melf_i386 -shared" "" + "-melf_i386 -shared -z noexecstack" "" "--32" { pr27193a.o.bz2 pr27193b.s } {{objdump {-dw} pr27193.dd}} "pr27193a.so"} {"Build pr27193b.so" - "-melf_i386 -shared --reduce-memory-overheads" "" + "-melf_i386 -shared --reduce-memory-overheads -z noexecstack" "" "--32" { pr27193a.o.bz2 pr27193b.s } {{objdump {-dw} pr27193.dd}} "pr27193b.so"} diff --git a/ld/testsuite/ld-plugin/lto-3r.d b/ld/testsuite/ld-plugin/lto-3r.d index fd1bfd26867..ce9562393d2 100644 --- a/ld/testsuite/ld-plugin/lto-3r.d +++ b/ld/testsuite/ld-plugin/lto-3r.d @@ -1,4 +1,4 @@ -#ld: -r tmpdir/lto-3b.o +#ld: -r tmpdir/lto-3b.o -z noexecstack #source: dummy.s #nm: -p diff --git a/ld/testsuite/ld-plugin/lto-5r.d b/ld/testsuite/ld-plugin/lto-5r.d index c35e2bc338d..dba30bfd334 100644 --- a/ld/testsuite/ld-plugin/lto-5r.d +++ b/ld/testsuite/ld-plugin/lto-5r.d @@ -1,4 +1,4 @@ -#ld: -r tmpdir/lto-5a.o tmpdir/lto-5b.o +#ld: -r tmpdir/lto-5a.o tmpdir/lto-5b.o -z noexecstack #source: dummy.s #nm: -p diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index f4ea1d48533..33af6c45a41 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -127,7 +127,7 @@ set lto_link_tests [list \ "" "-flto -O2 $lto_fat $NOSANITIZE_CFLAGS" \ {pr12758b.c} {} "libpr12758.a"] \ [list "PR ld/12758" \ - "$NOPIE_LDFLAGS $NOSANITIZE_CFLAGS -O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12758a.o -Wl,--start-group tmpdir/libpr12758.a -Wl,--end-group" \ + "$NOPIE_LDFLAGS $NOSANITIZE_CFLAGS -O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12758a.o -Wl,--start-group tmpdir/libpr12758.a -Wl,--end-group -z noexecstack" \ "$NOSANITIZE_CFLAGS" \ {dummy.c} {} "pr12758.exe"] \ [list "Build libpr13183.a" \ @@ -901,7 +901,7 @@ run_cc_link_tests $lto_link_symbol_tests run_ld_link_tests [list \ [list "PR ld/19317 (2)" \ - "-r tmpdir/pr19317.o" "" "" \ + "-r tmpdir/pr19317.o -z noexecstack" "" "" \ {dummy.s} {} "pr19317-r.o"] \ ] diff --git a/ld/testsuite/ld-tic6x/got-reloc-global.s b/ld/testsuite/ld-tic6x/got-reloc-global.s index 054c2977904..e6fb809a0fe 100644 --- a/ld/testsuite/ld-tic6x/got-reloc-global.s +++ b/ld/testsuite/ld-tic6x/got-reloc-global.s @@ -9,3 +9,4 @@ .type a, @object .size a, 4 a: + .section .note.GNU-stack diff --git a/ld/testsuite/ld-tic6x/shlib-1.rd b/ld/testsuite/ld-tic6x/shlib-1.rd index 9ad2396170e..cf1f34689f1 100644 --- a/ld/testsuite/ld-tic6x/shlib-1.rd +++ b/ld/testsuite/ld-tic6x/shlib-1.rd @@ -31,7 +31,7 @@ Program Headers: LOAD 0x001000 0x00008000 0x00008000 0x001fc 0x001fc RW 0x1000 LOAD 0x002000 0x10000000 0x10000000 0x00130 0x00134 RWE 0x1000 DYNAMIC 0x001154 0x00008154 0x00008154 0x000a8 0x000a8 RW 0x4 - GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RWE 0x8 + GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RW 0x8 Section to Segment mapping: Segment Sections\.\.\. diff --git a/ld/testsuite/ld-tic6x/shlib-1.s b/ld/testsuite/ld-tic6x/shlib-1.s index cb065a2910f..058bcbc69ff 100644 --- a/ld/testsuite/ld-tic6x/shlib-1.s +++ b/ld/testsuite/ld-tic6x/shlib-1.s @@ -42,3 +42,4 @@ g2: .hidden c .scomm c,4,4 + .section .note.GNU-stack diff --git a/ld/testsuite/ld-tic6x/shlib-1b.rd b/ld/testsuite/ld-tic6x/shlib-1b.rd index 9ad2396170e..cf1f34689f1 100644 --- a/ld/testsuite/ld-tic6x/shlib-1b.rd +++ b/ld/testsuite/ld-tic6x/shlib-1b.rd @@ -31,7 +31,7 @@ Program Headers: LOAD 0x001000 0x00008000 0x00008000 0x001fc 0x001fc RW 0x1000 LOAD 0x002000 0x10000000 0x10000000 0x00130 0x00134 RWE 0x1000 DYNAMIC 0x001154 0x00008154 0x00008154 0x000a8 0x000a8 RW 0x4 - GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RWE 0x8 + GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RW 0x8 Section to Segment mapping: Segment Sections\.\.\. diff --git a/ld/testsuite/ld-tic6x/shlib-1r.rd b/ld/testsuite/ld-tic6x/shlib-1r.rd index 9ad2396170e..cf1f34689f1 100644 --- a/ld/testsuite/ld-tic6x/shlib-1r.rd +++ b/ld/testsuite/ld-tic6x/shlib-1r.rd @@ -31,7 +31,7 @@ Program Headers: LOAD 0x001000 0x00008000 0x00008000 0x001fc 0x001fc RW 0x1000 LOAD 0x002000 0x10000000 0x10000000 0x00130 0x00134 RWE 0x1000 DYNAMIC 0x001154 0x00008154 0x00008154 0x000a8 0x000a8 RW 0x4 - GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RWE 0x8 + GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RW 0x8 Section to Segment mapping: Segment Sections\.\.\. diff --git a/ld/testsuite/ld-tic6x/shlib-1rb.rd b/ld/testsuite/ld-tic6x/shlib-1rb.rd index 9ad2396170e..cf1f34689f1 100644 --- a/ld/testsuite/ld-tic6x/shlib-1rb.rd +++ b/ld/testsuite/ld-tic6x/shlib-1rb.rd @@ -31,7 +31,7 @@ Program Headers: LOAD 0x001000 0x00008000 0x00008000 0x001fc 0x001fc RW 0x1000 LOAD 0x002000 0x10000000 0x10000000 0x00130 0x00134 RWE 0x1000 DYNAMIC 0x001154 0x00008154 0x00008154 0x000a8 0x000a8 RW 0x4 - GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RWE 0x8 + GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RW 0x8 Section to Segment mapping: Segment Sections\.\.\. diff --git a/ld/testsuite/ld-tic6x/shlib-2.s b/ld/testsuite/ld-tic6x/shlib-2.s index 3d786dd298b..e6eba01c93a 100644 --- a/ld/testsuite/ld-tic6x/shlib-2.s +++ b/ld/testsuite/ld-tic6x/shlib-2.s @@ -21,3 +21,4 @@ sub: ldw .d2t2 *+B14(c), B9 nop 1 .size sub, .-sub + .section .note.GNU-stack diff --git a/ld/testsuite/ld-tic6x/shlib-app-1.rd b/ld/testsuite/ld-tic6x/shlib-app-1.rd index 607d2709b3f..fb3a080f2c3 100644 --- a/ld/testsuite/ld-tic6x/shlib-app-1.rd +++ b/ld/testsuite/ld-tic6x/shlib-app-1.rd @@ -32,7 +32,7 @@ Program Headers: LOAD 0x001000 0x00008000 0x00008000 0x00208 0x00208 RW 0x1000 LOAD 0x002000 0x10000000 0x10000000 0x000cc 0x000d0 RWE 0x1000 DYNAMIC 0x001150 0x00008150 0x00008150 0x000b8 0x000b8 RW 0x4 - GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RWE 0x8 + GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RW 0x8 Section to Segment mapping: Segment Sections\.\.\. diff --git a/ld/testsuite/ld-tic6x/shlib-app-1.s b/ld/testsuite/ld-tic6x/shlib-app-1.s index fe254bba3aa..3bb00079f83 100644 --- a/ld/testsuite/ld-tic6x/shlib-app-1.s +++ b/ld/testsuite/ld-tic6x/shlib-app-1.s @@ -29,3 +29,4 @@ b: w: .long g1 .long g2 + .section .note.GNU-stack diff --git a/ld/testsuite/ld-tic6x/shlib-app-1b.rd b/ld/testsuite/ld-tic6x/shlib-app-1b.rd index 68d2076857c..3a5d2178301 100644 --- a/ld/testsuite/ld-tic6x/shlib-app-1b.rd +++ b/ld/testsuite/ld-tic6x/shlib-app-1b.rd @@ -32,7 +32,7 @@ Program Headers: LOAD 0x001000 0x00008000 0x00008000 0x00208 0x00208 RW 0x1000 LOAD 0x002000 0x10000000 0x10000000 0x000cc 0x000d0 RWE 0x1000 DYNAMIC 0x001150 0x00008150 0x00008150 0x000b8 0x000b8 RW 0x4 - GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RWE 0x8 + GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RW 0x8 Section to Segment mapping: Segment Sections\.\.\. diff --git a/ld/testsuite/ld-tic6x/shlib-app-1r.rd b/ld/testsuite/ld-tic6x/shlib-app-1r.rd index 82502afb0d0..288400b1bbc 100644 --- a/ld/testsuite/ld-tic6x/shlib-app-1r.rd +++ b/ld/testsuite/ld-tic6x/shlib-app-1r.rd @@ -31,7 +31,7 @@ Program Headers: LOAD 0x001000 0x00008000 0x00008000 0x001c4 0x001c4 RW 0x1000 LOAD 0x002000 0x10000000 0x10000000 0x000c4 0x000c8 RWE 0x1000 DYNAMIC 0x00110c 0x0000810c 0x0000810c 0x000b8 0x000b8 RW 0x4 - GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RWE 0x8 + GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RW 0x8 Section to Segment mapping: Segment Sections\.\.\. diff --git a/ld/testsuite/ld-tic6x/shlib-app-1r.s b/ld/testsuite/ld-tic6x/shlib-app-1r.s index a6de9000e3a..4928804ed0f 100644 --- a/ld/testsuite/ld-tic6x/shlib-app-1r.s +++ b/ld/testsuite/ld-tic6x/shlib-app-1r.s @@ -17,3 +17,4 @@ fish: .size b, 4 b: .long 0x12345678 + .section .note.GNU-stack diff --git a/ld/testsuite/ld-tic6x/shlib-app-1rb.rd b/ld/testsuite/ld-tic6x/shlib-app-1rb.rd index 8d13fb2c2c4..058261db8ca 100644 --- a/ld/testsuite/ld-tic6x/shlib-app-1rb.rd +++ b/ld/testsuite/ld-tic6x/shlib-app-1rb.rd @@ -31,7 +31,7 @@ Program Headers: LOAD 0x001000 0x00008000 0x00008000 0x001c4 0x001c4 RW 0x1000 LOAD 0x002000 0x10000000 0x10000000 0x000c4 0x000c8 RWE 0x1000 DYNAMIC 0x00110c 0x0000810c 0x0000810c 0x000b8 0x000b8 RW 0x4 - GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RWE 0x8 + GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RW 0x8 Section to Segment mapping: Segment Sections\.\.\. diff --git a/ld/testsuite/ld-tic6x/shlib-noindex.rd b/ld/testsuite/ld-tic6x/shlib-noindex.rd index f087d15bffd..52e433424f1 100644 --- a/ld/testsuite/ld-tic6x/shlib-noindex.rd +++ b/ld/testsuite/ld-tic6x/shlib-noindex.rd @@ -32,7 +32,7 @@ Program Headers: LOAD 0x001000 0x00008000 0x00008000 0x00210 0x00210 RW 0x1000 LOAD 0x002000 0x10000000 0x10000000 0x00130 0x00134 RWE 0x1000 DYNAMIC 0x001160 0x00008160 0x00008160 0x000b0 0x000b0 RW 0x4 - GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RWE 0x8 + GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RW 0x8 Section to Segment mapping: Segment Sections\.\.\. diff --git a/ld/testsuite/ld-tic6x/static-app-1.rd b/ld/testsuite/ld-tic6x/static-app-1.rd index 36c48109912..6cb86cd4b75 100644 --- a/ld/testsuite/ld-tic6x/static-app-1.rd +++ b/ld/testsuite/ld-tic6x/static-app-1.rd @@ -29,7 +29,7 @@ Program Headers: LOAD 0x001000 0x00008000 0x00008000 0x001b8 0x001b8 RW 0x1000 LOAD 0x002000 0x10000000 0x10000000 0x000f4 0x000f8 RWE 0x1000 DYNAMIC 0x001128 0x00008128 0x00008128 0x00090 0x00090 RW 0x4 - GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RWE 0x8 + GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RW 0x8 Section to Segment mapping: Segment Sections\.\.\. diff --git a/ld/testsuite/ld-tic6x/static-app-1b.rd b/ld/testsuite/ld-tic6x/static-app-1b.rd index 36c48109912..6cb86cd4b75 100644 --- a/ld/testsuite/ld-tic6x/static-app-1b.rd +++ b/ld/testsuite/ld-tic6x/static-app-1b.rd @@ -29,7 +29,7 @@ Program Headers: LOAD 0x001000 0x00008000 0x00008000 0x001b8 0x001b8 RW 0x1000 LOAD 0x002000 0x10000000 0x10000000 0x000f4 0x000f8 RWE 0x1000 DYNAMIC 0x001128 0x00008128 0x00008128 0x00090 0x00090 RW 0x4 - GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RWE 0x8 + GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RW 0x8 Section to Segment mapping: Segment Sections\.\.\. diff --git a/ld/testsuite/ld-tic6x/static-app-1r.rd b/ld/testsuite/ld-tic6x/static-app-1r.rd index b04e327207d..8d9d11937b4 100644 --- a/ld/testsuite/ld-tic6x/static-app-1r.rd +++ b/ld/testsuite/ld-tic6x/static-app-1r.rd @@ -29,7 +29,7 @@ Program Headers: LOAD 0x001000 0x00008000 0x00008000 0x001a0 0x001a0 RW 0x1000 LOAD 0x002000 0x10000000 0x10000000 0x000ec 0x000f0 RWE 0x1000 DYNAMIC 0x001110 0x00008110 0x00008110 0x00090 0x00090 RW 0x4 - GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RWE 0x8 + GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RW 0x8 Section to Segment mapping: Segment Sections\.\.\. diff --git a/ld/testsuite/ld-tic6x/static-app-1rb.rd b/ld/testsuite/ld-tic6x/static-app-1rb.rd index b04e327207d..8d9d11937b4 100644 --- a/ld/testsuite/ld-tic6x/static-app-1rb.rd +++ b/ld/testsuite/ld-tic6x/static-app-1rb.rd @@ -29,7 +29,7 @@ Program Headers: LOAD 0x001000 0x00008000 0x00008000 0x001a0 0x001a0 RW 0x1000 LOAD 0x002000 0x10000000 0x10000000 0x000ec 0x000f0 RWE 0x1000 DYNAMIC 0x001110 0x00008110 0x00008110 0x00090 0x00090 RW 0x4 - GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RWE 0x8 + GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x20000 RW 0x8 Section to Segment mapping: Segment Sections\.\.\. diff --git a/ld/testsuite/ld-unique/unique.s b/ld/testsuite/ld-unique/unique.s index cd5e64e60d2..2ad41c25201 100644 --- a/ld/testsuite/ld-unique/unique.s +++ b/ld/testsuite/ld-unique/unique.s @@ -6,3 +6,6 @@ a_val: .long 0 .global main main: .long 0 + + .section .note.GNU-stack,"" + diff --git a/ld/testsuite/ld-unique/unique_empty.s b/ld/testsuite/ld-unique/unique_empty.s index 4896641b50b..71d5b862498 100644 --- a/ld/testsuite/ld-unique/unique_empty.s +++ b/ld/testsuite/ld-unique/unique_empty.s @@ -2,3 +2,5 @@ .global main main: .dc.a b_val + + .section .note.GNU-stack diff --git a/ld/testsuite/ld-unique/unique_shared.s b/ld/testsuite/ld-unique/unique_shared.s index f1914f3393f..359b13eb809 100644 --- a/ld/testsuite/ld-unique/unique_shared.s +++ b/ld/testsuite/ld-unique/unique_shared.s @@ -1,3 +1,4 @@ .type b_val, %gnu_unique_object b_val: .long 0 .size b_val, .-b_val + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/dummy.s b/ld/testsuite/ld-x86-64/dummy.s index 403f98000d9..66d3b2a8856 100644 --- a/ld/testsuite/ld-x86-64/dummy.s +++ b/ld/testsuite/ld-x86-64/dummy.s @@ -1 +1,2 @@ # Dummy + .section ".note.GNU-stack" diff --git a/ld/testsuite/ld-x86-64/foo.s b/ld/testsuite/ld-x86-64/foo.s index 461bfa43147..01618d36d5a 100644 --- a/ld/testsuite/ld-x86-64/foo.s +++ b/ld/testsuite/ld-x86-64/foo.s @@ -1,3 +1,4 @@ .globl foo foo: mov %eax, %ebx + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/gotpcrel1a.S b/ld/testsuite/ld-x86-64/gotpcrel1a.S index 58dfbb1dd82..62050e6a4cc 100644 --- a/ld/testsuite/ld-x86-64/gotpcrel1a.S +++ b/ld/testsuite/ld-x86-64/gotpcrel1a.S @@ -16,3 +16,4 @@ main: addq $8, %rsp jmp *myexit@GOTPCREL(%rip) .size main, .-main + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/gotpcrel1d.S b/ld/testsuite/ld-x86-64/gotpcrel1d.S index 4b014999269..84a0c5d4908 100644 --- a/ld/testsuite/ld-x86-64/gotpcrel1d.S +++ b/ld/testsuite/ld-x86-64/gotpcrel1d.S @@ -24,3 +24,4 @@ __FUNCTION__.2219: .size __FUNCTION__.2215, 4 __FUNCTION__.2215: .string "bar" + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/pr19031b.S b/ld/testsuite/ld-x86-64/pr19031b.S index ccc91258729..7bc8b31f77b 100644 --- a/ld/testsuite/ld-x86-64/pr19031b.S +++ b/ld/testsuite/ld-x86-64/pr19031b.S @@ -16,3 +16,4 @@ h: .data zed: .long f - . + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/pr19319a.S b/ld/testsuite/ld-x86-64/pr19319a.S index 438d7a5284a..01eca1b85ab 100644 --- a/ld/testsuite/ld-x86-64/pr19319a.S +++ b/ld/testsuite/ld-x86-64/pr19319a.S @@ -9,3 +9,4 @@ foo: .align 8 .long 4660 .long 22136 + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/pr19319b.S b/ld/testsuite/ld-x86-64/pr19319b.S index c9285c07c17..73b8e89de66 100644 --- a/ld/testsuite/ld-x86-64/pr19319b.S +++ b/ld/testsuite/ld-x86-64/pr19319b.S @@ -9,3 +9,4 @@ _start: .align 8 .long 4660 .long 22136 + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/pr19827a.S b/ld/testsuite/ld-x86-64/pr19827a.S index cdf1d4b8a30..43241f5224e 100644 --- a/ld/testsuite/ld-x86-64/pr19827a.S +++ b/ld/testsuite/ld-x86-64/pr19827a.S @@ -6,3 +6,5 @@ _start: .globl foo foo: .byte 0 + + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/pr19827b.S b/ld/testsuite/ld-x86-64/pr19827b.S index bb46e1d59f0..897c149ce2c 100644 --- a/ld/testsuite/ld-x86-64/pr19827b.S +++ b/ld/testsuite/ld-x86-64/pr19827b.S @@ -1,2 +1,3 @@ .data .dc.a foo + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/pr19969a.S b/ld/testsuite/ld-x86-64/pr19969a.S index f318401e699..9038436a624 100644 --- a/ld/testsuite/ld-x86-64/pr19969a.S +++ b/ld/testsuite/ld-x86-64/pr19969a.S @@ -5,3 +5,4 @@ .size foo, 4 foo: .long -1 + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/pr19969b.S b/ld/testsuite/ld-x86-64/pr19969b.S index eabeba2fb08..abe96facac3 100644 --- a/ld/testsuite/ld-x86-64/pr19969b.S +++ b/ld/testsuite/ld-x86-64/pr19969b.S @@ -12,3 +12,4 @@ _start: .size foo_p, 4 foo_p: .long foo + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/pr20550a.s b/ld/testsuite/ld-x86-64/pr20550a.s index 4430398817d..167255a797a 100644 --- a/ld/testsuite/ld-x86-64/pr20550a.s +++ b/ld/testsuite/ld-x86-64/pr20550a.s @@ -4,3 +4,4 @@ _start: movabsq $strings@SIZE, %rdx .section .data.rel,"aw",@progbits .quad strings + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/pr20800a.S b/ld/testsuite/ld-x86-64/pr20800a.S index c4bcd80a7a1..95024e280e5 100644 --- a/ld/testsuite/ld-x86-64/pr20800a.S +++ b/ld/testsuite/ld-x86-64/pr20800a.S @@ -15,3 +15,4 @@ main: popq %r15 ret .size main, .-main + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/pr22791-1b.s b/ld/testsuite/ld-x86-64/pr22791-1b.s index 9751db49aa5..4bd75570253 100644 --- a/ld/testsuite/ld-x86-64/pr22791-1b.s +++ b/ld/testsuite/ld-x86-64/pr22791-1b.s @@ -4,3 +4,4 @@ main: movl foo(%rip), %eax .size main, .-main + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/pr26711.s b/ld/testsuite/ld-x86-64/pr26711.s index 8fa185d42a7..9bbcdc5f867 100644 --- a/ld/testsuite/ld-x86-64/pr26711.s +++ b/ld/testsuite/ld-x86-64/pr26711.s @@ -31,3 +31,4 @@ .type foo, @function foo: ret + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/property-6c.S b/ld/testsuite/ld-x86-64/property-6c.S index 41246d305e2..ab453188686 100644 --- a/ld/testsuite/ld-x86-64/property-6c.S +++ b/ld/testsuite/ld-x86-64/property-6c.S @@ -21,3 +21,4 @@ 5: .p2align ALIGN 3: + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/property-no-copy.S b/ld/testsuite/ld-x86-64/property-no-copy.S index 88cc2520211..c95054c3f76 100644 --- a/ld/testsuite/ld-x86-64/property-no-copy.S +++ b/ld/testsuite/ld-x86-64/property-no-copy.S @@ -18,3 +18,4 @@ .long 0 /* pr_datasz. */ .p2align ALIGN 3: + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/property-stack.S b/ld/testsuite/ld-x86-64/property-stack.S index 7f45654dc25..ede808a7de0 100644 --- a/ld/testsuite/ld-x86-64/property-stack.S +++ b/ld/testsuite/ld-x86-64/property-stack.S @@ -21,3 +21,4 @@ 5: .p2align ALIGN 3: + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/property-unsorted-1.S b/ld/testsuite/ld-x86-64/property-unsorted-1.S index de96e7a4e80..482b85e7017 100644 --- a/ld/testsuite/ld-x86-64/property-unsorted-1.S +++ b/ld/testsuite/ld-x86-64/property-unsorted-1.S @@ -37,3 +37,4 @@ 5: .p2align ALIGN 3: + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/property-unsorted-2.S b/ld/testsuite/ld-x86-64/property-unsorted-2.S index 65d7fad3fe9..1be6703083f 100644 --- a/ld/testsuite/ld-x86-64/property-unsorted-2.S +++ b/ld/testsuite/ld-x86-64/property-unsorted-2.S @@ -25,3 +25,4 @@ 5: .p2align ALIGN 3: + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/property-x86-1.S b/ld/testsuite/ld-x86-64/property-x86-1.S index b669e728a51..6d1d8fbaef5 100644 --- a/ld/testsuite/ld-x86-64/property-x86-1.S +++ b/ld/testsuite/ld-x86-64/property-x86-1.S @@ -35,3 +35,4 @@ 5: .p2align ALIGN 3: + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/property-x86-2.S b/ld/testsuite/ld-x86-64/property-x86-2.S index b108b1704de..613d5b21ce7 100644 --- a/ld/testsuite/ld-x86-64/property-x86-2.S +++ b/ld/testsuite/ld-x86-64/property-x86-2.S @@ -28,3 +28,4 @@ 5: .p2align ALIGN 3: + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/start.s b/ld/testsuite/ld-x86-64/start.s index 80301c6a7e4..4262a3380fa 100644 --- a/ld/testsuite/ld-x86-64/start.s +++ b/ld/testsuite/ld-x86-64/start.s @@ -1,3 +1,4 @@ .globl _start _start: jmp foo + .section .note.GNU-stack