mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-17 13:10:12 +08:00
Add linker warning for when it creates an executable stack.
PR 29072
This commit is contained in:
parent
72b580b8f4
commit
65daf5bed6
@ -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;
|
||||
|
@ -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;
|
||||
|
8
ld/NEWS
8
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.
|
||||
|
||||
|
@ -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. */
|
||||
|
||||
|
27
ld/ld.texi
27
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.
|
||||
|
@ -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. */
|
||||
|
14
ld/lexsup.c
14
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"));
|
||||
|
@ -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-*-*
|
||||
|
||||
|
@ -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" \
|
||||
|
@ -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" \
|
||||
|
6
ld/testsuite/ld-elf/pr29072-a.s
Normal file
6
ld/testsuite/ld-elf/pr29072-a.s
Normal file
@ -0,0 +1,6 @@
|
||||
.text
|
||||
.global main
|
||||
main:
|
||||
.nop
|
||||
|
||||
.section .note.GNU-stack,"x",%progbits
|
5
ld/testsuite/ld-elf/pr29072-b.s
Normal file
5
ld/testsuite/ld-elf/pr29072-b.s
Normal file
@ -0,0 +1,5 @@
|
||||
.text
|
||||
.globl foo
|
||||
foo:
|
||||
.nop
|
||||
|
1
ld/testsuite/ld-elf/pr29072.a.warn
Normal file
1
ld/testsuite/ld-elf/pr29072.a.warn
Normal file
@ -0,0 +1 @@
|
||||
.*: warning: .*\.o: requires executable stack \(because the \.note\.GNU-stack section is executable\)
|
1
ld/testsuite/ld-elf/pr29072.b.warn
Normal file
1
ld/testsuite/ld-elf/pr29072.b.warn
Normal file
@ -0,0 +1 @@
|
||||
.*: warning: .*\.o: missing \.note\.GNU-stack section implies executable stack
|
1
ld/testsuite/ld-elf/pr29072.c.warn
Normal file
1
ld/testsuite/ld-elf/pr29072.c.warn
Normal file
@ -0,0 +1 @@
|
||||
.*: warning: enabling an executable stack because of -z execstack command line option
|
@ -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"
|
||||
|
@ -62,3 +62,4 @@ D1:
|
||||
.D4:
|
||||
.picptr funcdesc(.Fb)
|
||||
.word .Fb
|
||||
.section .note.GNU-stack
|
||||
|
@ -79,3 +79,4 @@ GD3:
|
||||
GD4:
|
||||
.picptr funcdesc(GFb)
|
||||
.word GFb
|
||||
.section .note.GNU-stack
|
||||
|
@ -97,3 +97,4 @@ HD3:
|
||||
HD4:
|
||||
.picptr funcdesc(HFb)
|
||||
.word HFb
|
||||
.section .note.GNU-stack
|
||||
|
@ -97,3 +97,4 @@ PD3:
|
||||
PD4:
|
||||
.picptr funcdesc(PFb)
|
||||
.word PFb
|
||||
.section .note.GNU-stack
|
||||
|
@ -36,3 +36,4 @@ D5:
|
||||
|
||||
.picptr funcdesc(UFb)
|
||||
.word UFb
|
||||
.section .note.GNU-stack
|
||||
|
@ -53,3 +53,4 @@ D6:
|
||||
|
||||
.picptr funcdesc(WFb)
|
||||
.word WFb
|
||||
.section .note.GNU-stack
|
||||
|
@ -61,3 +61,4 @@ D7:
|
||||
.D4:
|
||||
.picptr funcdesc(.Fb+4)
|
||||
.word .Fb+4
|
||||
.section .note.GNU-stack
|
||||
|
@ -79,3 +79,4 @@ GD3:
|
||||
GD4:
|
||||
.picptr funcdesc(GFb+4)
|
||||
.word GFb+4
|
||||
.section .note.GNU-stack
|
||||
|
@ -5,3 +5,4 @@
|
||||
.size x, 4
|
||||
x:
|
||||
.zero 4
|
||||
.section .note.GNU-stack
|
||||
|
@ -83,3 +83,5 @@ _start:
|
||||
sethi.p #gottlsoffhi(0), gr14
|
||||
setlo #gottlsofflo(0), gr14
|
||||
ld #tlsoff(0)@(gr15, gr14), gr9
|
||||
|
||||
.section .note.GNU-stack
|
||||
|
@ -181,3 +181,5 @@ _start:
|
||||
setlo #gottlsofflo(i+1+4096), gr8
|
||||
ld #tlsoff(i+1+4096)@(gr15, gr8), gr9
|
||||
.endif
|
||||
|
||||
.section .note.GNU-stack
|
||||
|
@ -18,3 +18,5 @@ _start:
|
||||
sethi.p #gottlsoffhi(u), gr14
|
||||
setlo #gottlsofflo(u), gr14
|
||||
ld #tlsoff(u)@(gr15, gr14), gr9
|
||||
|
||||
.section .note.GNU-stack
|
||||
|
@ -1 +1,2 @@
|
||||
# Dummy
|
||||
.section ".note.GNU-stack"
|
||||
|
@ -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"}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ld: -r tmpdir/lto-3b.o
|
||||
#ld: -r tmpdir/lto-3b.o -z noexecstack
|
||||
#source: dummy.s
|
||||
#nm: -p
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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"] \
|
||||
]
|
||||
|
||||
|
@ -9,3 +9,4 @@
|
||||
.type a, @object
|
||||
.size a, 4
|
||||
a:
|
||||
.section .note.GNU-stack
|
||||
|
@ -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\.\.\.
|
||||
|
@ -42,3 +42,4 @@ g2:
|
||||
|
||||
.hidden c
|
||||
.scomm c,4,4
|
||||
.section .note.GNU-stack
|
||||
|
@ -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\.\.\.
|
||||
|
@ -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\.\.\.
|
||||
|
@ -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\.\.\.
|
||||
|
@ -21,3 +21,4 @@ sub:
|
||||
ldw .d2t2 *+B14(c), B9
|
||||
nop 1
|
||||
.size sub, .-sub
|
||||
.section .note.GNU-stack
|
||||
|
@ -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\.\.\.
|
||||
|
@ -29,3 +29,4 @@ b:
|
||||
w:
|
||||
.long g1
|
||||
.long g2
|
||||
.section .note.GNU-stack
|
||||
|
@ -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\.\.\.
|
||||
|
@ -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\.\.\.
|
||||
|
@ -17,3 +17,4 @@ fish:
|
||||
.size b, 4
|
||||
b:
|
||||
.long 0x12345678
|
||||
.section .note.GNU-stack
|
||||
|
@ -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\.\.\.
|
||||
|
@ -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\.\.\.
|
||||
|
@ -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\.\.\.
|
||||
|
@ -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\.\.\.
|
||||
|
@ -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\.\.\.
|
||||
|
@ -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\.\.\.
|
||||
|
@ -6,3 +6,6 @@ a_val: .long 0
|
||||
.global main
|
||||
main:
|
||||
.long 0
|
||||
|
||||
.section .note.GNU-stack,""
|
||||
|
||||
|
@ -2,3 +2,5 @@
|
||||
.global main
|
||||
main:
|
||||
.dc.a b_val
|
||||
|
||||
.section .note.GNU-stack
|
||||
|
@ -1,3 +1,4 @@
|
||||
.type b_val, %gnu_unique_object
|
||||
b_val: .long 0
|
||||
.size b_val, .-b_val
|
||||
.section .note.GNU-stack
|
||||
|
@ -1 +1,2 @@
|
||||
# Dummy
|
||||
.section ".note.GNU-stack"
|
||||
|
@ -1,3 +1,4 @@
|
||||
.globl foo
|
||||
foo:
|
||||
mov %eax, %ebx
|
||||
.section .note.GNU-stack
|
||||
|
@ -16,3 +16,4 @@ main:
|
||||
addq $8, %rsp
|
||||
jmp *myexit@GOTPCREL(%rip)
|
||||
.size main, .-main
|
||||
.section .note.GNU-stack
|
||||
|
@ -24,3 +24,4 @@ __FUNCTION__.2219:
|
||||
.size __FUNCTION__.2215, 4
|
||||
__FUNCTION__.2215:
|
||||
.string "bar"
|
||||
.section .note.GNU-stack
|
||||
|
@ -16,3 +16,4 @@ h:
|
||||
.data
|
||||
zed:
|
||||
.long f - .
|
||||
.section .note.GNU-stack
|
||||
|
@ -9,3 +9,4 @@ foo:
|
||||
.align 8
|
||||
.long 4660
|
||||
.long 22136
|
||||
.section .note.GNU-stack
|
||||
|
@ -9,3 +9,4 @@ _start:
|
||||
.align 8
|
||||
.long 4660
|
||||
.long 22136
|
||||
.section .note.GNU-stack
|
||||
|
@ -6,3 +6,5 @@ _start:
|
||||
.globl foo
|
||||
foo:
|
||||
.byte 0
|
||||
|
||||
.section .note.GNU-stack
|
||||
|
@ -1,2 +1,3 @@
|
||||
.data
|
||||
.dc.a foo
|
||||
.section .note.GNU-stack
|
||||
|
@ -5,3 +5,4 @@
|
||||
.size foo, 4
|
||||
foo:
|
||||
.long -1
|
||||
.section .note.GNU-stack
|
||||
|
@ -12,3 +12,4 @@ _start:
|
||||
.size foo_p, 4
|
||||
foo_p:
|
||||
.long foo
|
||||
.section .note.GNU-stack
|
||||
|
@ -4,3 +4,4 @@ _start:
|
||||
movabsq $strings@SIZE, %rdx
|
||||
.section .data.rel,"aw",@progbits
|
||||
.quad strings
|
||||
.section .note.GNU-stack
|
||||
|
@ -15,3 +15,4 @@ main:
|
||||
popq %r15
|
||||
ret
|
||||
.size main, .-main
|
||||
.section .note.GNU-stack
|
||||
|
@ -4,3 +4,4 @@
|
||||
main:
|
||||
movl foo(%rip), %eax
|
||||
.size main, .-main
|
||||
.section .note.GNU-stack
|
||||
|
@ -31,3 +31,4 @@
|
||||
.type foo, @function
|
||||
foo:
|
||||
ret
|
||||
.section .note.GNU-stack
|
||||
|
@ -21,3 +21,4 @@
|
||||
5:
|
||||
.p2align ALIGN
|
||||
3:
|
||||
.section .note.GNU-stack
|
||||
|
@ -18,3 +18,4 @@
|
||||
.long 0 /* pr_datasz. */
|
||||
.p2align ALIGN
|
||||
3:
|
||||
.section .note.GNU-stack
|
||||
|
@ -21,3 +21,4 @@
|
||||
5:
|
||||
.p2align ALIGN
|
||||
3:
|
||||
.section .note.GNU-stack
|
||||
|
@ -37,3 +37,4 @@
|
||||
5:
|
||||
.p2align ALIGN
|
||||
3:
|
||||
.section .note.GNU-stack
|
||||
|
@ -25,3 +25,4 @@
|
||||
5:
|
||||
.p2align ALIGN
|
||||
3:
|
||||
.section .note.GNU-stack
|
||||
|
@ -35,3 +35,4 @@
|
||||
5:
|
||||
.p2align ALIGN
|
||||
3:
|
||||
.section .note.GNU-stack
|
||||
|
@ -28,3 +28,4 @@
|
||||
5:
|
||||
.p2align ALIGN
|
||||
3:
|
||||
.section .note.GNU-stack
|
||||
|
@ -1,3 +1,4 @@
|
||||
.globl _start
|
||||
_start:
|
||||
jmp foo
|
||||
.section .note.GNU-stack
|
||||
|
Loading…
Reference in New Issue
Block a user