aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/NEWS8
-rw-r--r--ld/emultempl/avrelf.em1
-rw-r--r--ld/ld.texi27
-rw-r--r--ld/ldlex.h2
-rw-r--r--ld/lexsup.c14
-rw-r--r--ld/testsuite/ld-elf/eh4.d2
-rw-r--r--ld/testsuite/ld-elf/elf.exp69
-rw-r--r--ld/testsuite/ld-elf/linux-x86.exp28
-rw-r--r--ld/testsuite/ld-elf/pr29072-a.s6
-rw-r--r--ld/testsuite/ld-elf/pr29072-b.s5
-rw-r--r--ld/testsuite/ld-elf/pr29072.a.warn1
-rw-r--r--ld/testsuite/ld-elf/pr29072.b.warn1
-rw-r--r--ld/testsuite/ld-elf/pr29072.c.warn1
-rw-r--r--ld/testsuite/ld-elf/shared.exp2
-rw-r--r--ld/testsuite/ld-frv/fdpic1.s1
-rw-r--r--ld/testsuite/ld-frv/fdpic2.s1
-rw-r--r--ld/testsuite/ld-frv/fdpic3.s1
-rw-r--r--ld/testsuite/ld-frv/fdpic4.s1
-rw-r--r--ld/testsuite/ld-frv/fdpic5.s1
-rw-r--r--ld/testsuite/ld-frv/fdpic6.s1
-rw-r--r--ld/testsuite/ld-frv/fdpic7.s1
-rw-r--r--ld/testsuite/ld-frv/fdpic8.s1
-rw-r--r--ld/testsuite/ld-frv/tls-1-dep.s1
-rw-r--r--ld/testsuite/ld-frv/tls-1.s2
-rw-r--r--ld/testsuite/ld-frv/tls-2.s2
-rw-r--r--ld/testsuite/ld-frv/tls-3.s2
-rw-r--r--ld/testsuite/ld-gc/dummy.s1
-rw-r--r--ld/testsuite/ld-i386/i386.exp4
-rw-r--r--ld/testsuite/ld-plugin/lto-3r.d2
-rw-r--r--ld/testsuite/ld-plugin/lto-5r.d2
-rw-r--r--ld/testsuite/ld-plugin/lto.exp4
-rw-r--r--ld/testsuite/ld-tic6x/got-reloc-global.s1
-rw-r--r--ld/testsuite/ld-tic6x/shlib-1.rd2
-rw-r--r--ld/testsuite/ld-tic6x/shlib-1.s1
-rw-r--r--ld/testsuite/ld-tic6x/shlib-1b.rd2
-rw-r--r--ld/testsuite/ld-tic6x/shlib-1r.rd2
-rw-r--r--ld/testsuite/ld-tic6x/shlib-1rb.rd2
-rw-r--r--ld/testsuite/ld-tic6x/shlib-2.s1
-rw-r--r--ld/testsuite/ld-tic6x/shlib-app-1.rd2
-rw-r--r--ld/testsuite/ld-tic6x/shlib-app-1.s1
-rw-r--r--ld/testsuite/ld-tic6x/shlib-app-1b.rd2
-rw-r--r--ld/testsuite/ld-tic6x/shlib-app-1r.rd2
-rw-r--r--ld/testsuite/ld-tic6x/shlib-app-1r.s1
-rw-r--r--ld/testsuite/ld-tic6x/shlib-app-1rb.rd2
-rw-r--r--ld/testsuite/ld-tic6x/shlib-noindex.rd2
-rw-r--r--ld/testsuite/ld-tic6x/static-app-1.rd2
-rw-r--r--ld/testsuite/ld-tic6x/static-app-1b.rd2
-rw-r--r--ld/testsuite/ld-tic6x/static-app-1r.rd2
-rw-r--r--ld/testsuite/ld-tic6x/static-app-1rb.rd2
-rw-r--r--ld/testsuite/ld-unique/unique.s3
-rw-r--r--ld/testsuite/ld-unique/unique_empty.s2
-rw-r--r--ld/testsuite/ld-unique/unique_shared.s1
-rw-r--r--ld/testsuite/ld-x86-64/dummy.s1
-rw-r--r--ld/testsuite/ld-x86-64/foo.s1
-rw-r--r--ld/testsuite/ld-x86-64/gotpcrel1a.S1
-rw-r--r--ld/testsuite/ld-x86-64/gotpcrel1d.S1
-rw-r--r--ld/testsuite/ld-x86-64/pr19031b.S1
-rw-r--r--ld/testsuite/ld-x86-64/pr19319a.S1
-rw-r--r--ld/testsuite/ld-x86-64/pr19319b.S1
-rw-r--r--ld/testsuite/ld-x86-64/pr19827a.S2
-rw-r--r--ld/testsuite/ld-x86-64/pr19827b.S1
-rw-r--r--ld/testsuite/ld-x86-64/pr19969a.S1
-rw-r--r--ld/testsuite/ld-x86-64/pr19969b.S1
-rw-r--r--ld/testsuite/ld-x86-64/pr20550a.s1
-rw-r--r--ld/testsuite/ld-x86-64/pr20800a.S1
-rw-r--r--ld/testsuite/ld-x86-64/pr22791-1b.s1
-rw-r--r--ld/testsuite/ld-x86-64/pr26711.s1
-rw-r--r--ld/testsuite/ld-x86-64/property-6c.S1
-rw-r--r--ld/testsuite/ld-x86-64/property-no-copy.S1
-rw-r--r--ld/testsuite/ld-x86-64/property-stack.S1
-rw-r--r--ld/testsuite/ld-x86-64/property-unsorted-1.S1
-rw-r--r--ld/testsuite/ld-x86-64/property-unsorted-2.S1
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-1.S1
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-2.S1
-rw-r--r--ld/testsuite/ld-x86-64/start.s1
75 files changed, 215 insertions, 41 deletions
diff --git a/ld/NEWS b/ld/NEWS
index 76de7f6..b845531 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=<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 555d259..617bfef 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 c8335a7..6ac5344 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 bc58fea..1d42dc8 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 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"));
diff --git a/ld/testsuite/ld-elf/eh4.d b/ld/testsuite/ld-elf/eh4.d
index f33431a..95abafb 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 119908c..ec61e65 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 2e0cbd3..e3f2018 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 0000000..12ba994
--- /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 0000000..99df332
--- /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 0000000..aecff23
--- /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 0000000..08f1188
--- /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 0000000..e058be4
--- /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 1381544..06c3202 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 29f7fff..fa8aa48 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 2987643..aa42c29 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 f867b93..5fa5b02 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 795ae45..c877407 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 f4d466a..d4fd893 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 cd8e1d0..f2befde 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 ceac5fc..60a3452 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 037250f..d881f88 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 75daab7..aa5004b 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 a13c91b..213acf0 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 f0712e3..28a2930 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 6dd7972..5992888 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 403f980..66d3b2a 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 fadbd16..471a1f7 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 fd1bfd2..ce95623 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 c35e2bc..dba30bf 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 f4ea1d4..33af6c4 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 054c297..e6fb809 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 9ad2396..cf1f346 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 cb065a2..058bcbc 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 9ad2396..cf1f346 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 9ad2396..cf1f346 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 9ad2396..cf1f346 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 3d786dd..e6eba01 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 607d270..fb3a080 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 fe254bb..3bb0007 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 68d2076..3a5d217 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 82502af..288400b 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 a6de900..4928804 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 8d13fb2..058261d 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 f087d15..52e4334 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 36c4810..6cb86cd 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 36c4810..6cb86cd 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 b04e327..8d9d119 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 b04e327..8d9d119 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 cd5e64e..2ad41c2 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 4896641..71d5b86 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 f1914f3..359b13e 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 403f980..66d3b2a 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 461bfa4..01618d3 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 58dfbb1..62050e6 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 4b01499..84a0c5d 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 ccc9125..7bc8b31 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 438d7a5..01eca1b 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 c9285c0..73b8e89 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 cdf1d4b..43241f5 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 bb46e1d..897c149 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 f318401..9038436 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 eabeba2..abe96fa 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 4430398..167255a 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 c4bcd80..95024e2 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 9751db4..4bd7557 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 8fa185d..9bbcdc5 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 41246d3..ab45318 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 88cc252..c95054c 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 7f45654..ede808a 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 de96e7a..482b85e 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 65d7fad..1be6703 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 b669e72..6d1d8fb 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 b108b17..613d5b2 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 80301c6..4262a33 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