diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2012-10-23 09:33:56 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@codesourcery.com> | 2012-10-23 09:33:56 +0000 |
commit | 04c3a75556c018feb1f609404c627414a7ef672e (patch) | |
tree | 16a4265a55a0a6827b7315dd44f2ac74c7b2bd93 /ld/testsuite/ld-elf | |
parent | f6fbab7d1b396b1ee576937b53bb0858c8f895d5 (diff) | |
download | gdb-04c3a75556c018feb1f609404c627414a7ef672e.zip gdb-04c3a75556c018feb1f609404c627414a7ef672e.tar.gz gdb-04c3a75556c018feb1f609404c627414a7ef672e.tar.bz2 |
bfd/
* bfd-in.h (bfd_elf_stack_segment_size): Declare.
* bfd-in2.h: Rebuilt.
* elfxx-target.h (elf_backend_stack_align): New.
(elfNN_bed): Add it.
* elf-bfd.h (struct elf_backend_data): Add stack_align field.
* elf.c (bfd_elf_map_sections_to_segments): Pay attention to
stack_align and stacksize for PT_GNU_STACK segment.
(assign_file_positions_for_non_load_sections): Set p_memsz for
PT_GNU_STACK segment.
(copy_elf_program_header): Copy PT_GNU_STACK size.
* elflink.c (bfd_elf_stack_segment_size): New function, taken from
uclinux backends.
(bfd_elf_size_dynamic_sections): Determine
PT_GNU_STACK requirements after calling backend. Pay attention to
stacksize.
* elf32-bfin.c (elf32_bfinfdpic_always_size_sections): Call
bfd_elf_stack_segment_size.
(elf32_bfinfdpic_modify_program_headers): Delete.
(elf32_bfingfdpic_copy_private_bfd_data): Don't copy PT_GNU_STACK
here.
(elf_backend_stack_align): Override.
(elf_backend_modify_program_headers): Don't override.
* elf32-frv.c (frvfdpic_always_size_sections): Call
bfd_elf_stack_segment_size.
(elf32_frvfdpic_modify_program_headers): Delete.
(elf32_frvfdpic_copy_private_bfd_data): Don't copy PT_GNU_STACK
here.
(elf_backend_stack_align): Override.
(elf_backend_modify_program_headers): Don't override.
* elf32-lm32.c (lm32_elf_always_size_sections): Leave
PT_GNU_STACK creation to underlying elf support. Check
__stacksize here for backwards compatibility, and set it if
needed.
(lm32_elf_modify_segment_map): Delete.
(lm32_elf_modify_program_headers): Delete.
(elf_backend_stack_align): Override.
(elf_backend_modify_segment_map): Don't override.
(elf_backend_modify_program_headers): Don't override.
* elf32-sh.c (sh_elf_always_size_sections): Call
bfd_elf_stack_segment_size.
(sh_elf_modify_program_headers): Delete.
(sh_elf_copy_private_data): Don't copy PT_GNU_STACK
here.
(elf_backend_stack_align): Override.
(elf_backend_modify_program_headers): Don't override.
* elf32-tic6x.c (elf32_tic6x_always_size_sections): Call
bfd_elf_stack_segment_size.
(elf32_tic6x_modify_program_headers): Delete.
(elf32_tic6x_copy_private_data): Delete.
(elf_backend_stack_align): Override.
(bfd_elf32_bfd_copy_private_bfd_data): Don't override.
(elf_backend_modify_program_headers): Don't override.
include/
* bfdlink.h (struct bfd_link_info): Add stacksize option.
ld/
* ld.texinfo (stack-size): New option.
* emultempl/elf32.em: Add stack-size option.
ld/testsuite/
* ld-elf/binutils.exp: Add -z stack-size=0.
* ld-elf/elf.exp: Add stack-exec and stack-size tests.
* ld-elf/orphan-region.d: Add stack-size option. Remove xfail.
* ld-elf/stack-exec.rd: New.
* ld-elf/stack-size.rd: New.
* ld-elf/stack.s: New.
* ld-scripts/empty-aligned.d: Add stack-size option.
* ld-sh/fdpic-stack-set.d: New.
* ld-tic6x/shlib-1.rd: Remove __stacksize symbol.
* ld-tic6x/shlib-1b.rd: Likewise.
* ld-tic6x/shlib-1r.rd: Likewise.
* ld-tic6x/shlib-1rb.rd: Likewise.
* ld-tic6x/shlib-app-1.rd: Likewise.
* ld-tic6x/shlib-app-1b.rd: Likewise.
* ld-tic6x/shlib-app-1r.rd: Likewise.
* ld-tic6x/shlib-app-1rb.rd: Likewise.
* ld-tic6x/shlib-noindex.rd: Likewise.
* ld-tic6x/static-app-1.rd: Likewise.
* ld-tic6x/static-app-1b.rd: Likewise.
* ld-tic6x/static-app-1r.rd: Likewise.
* ld-tic6x/static-app-1rb.rd: Likewise.
Diffstat (limited to 'ld/testsuite/ld-elf')
-rw-r--r-- | ld/testsuite/ld-elf/binutils.exp | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/elf.exp | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/orphan-region.d | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/stack-exec.rd | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/stack-size.rd | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/stack.s | 10 |
6 files changed, 29 insertions, 4 deletions
diff --git a/ld/testsuite/ld-elf/binutils.exp b/ld/testsuite/ld-elf/binutils.exp index 249fa2a..0101512 100644 --- a/ld/testsuite/ld-elf/binutils.exp +++ b/ld/testsuite/ld-elf/binutils.exp @@ -60,7 +60,7 @@ proc binutils_test { prog_name ld_options test {test_name ""}} { return } - if { ![ld_simple_link $ld tmpdir/$test "$ld_options tmpdir/$test.o"] } { + if { ![ld_simple_link $ld tmpdir/$test "$ld_options -z stack-size=0 tmpdir/$test.o"] } { if { [string match "*not supported*" $link_output] || [string match "*unrecognized option*" $link_output] || [string match "*-z relro ignored*" $link_output] } { diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp index a97e3df..a33e3b6 100644 --- a/ld/testsuite/ld-elf/elf.exp +++ b/ld/testsuite/ld-elf/elf.exp @@ -126,6 +126,15 @@ if { [check_gc_sections_available] && ![istarget "v850-*-*"] } { } } +if { [istarget *-*-*linux*] } { + run_ld_link_tests { + {"stack exec" "-z execstack" "" {stack.s} + {{readelf {-Wl} stack-exec.rd}} "stack-exec.exe"} + {"stack size" "-z stack-size=0x123400" "" {stack.s} + {{readelf {-Wl} stack-size.rd}} "stack-size.exe"} + } +} + set LDFLAGS $old_ldflags # The following tests require running the executable generated by ld. diff --git a/ld/testsuite/ld-elf/orphan-region.d b/ld/testsuite/ld-elf/orphan-region.d index 9d6c90c..d961a07 100644 --- a/ld/testsuite/ld-elf/orphan-region.d +++ b/ld/testsuite/ld-elf/orphan-region.d @@ -1,11 +1,11 @@ #source: orphan-region.s -#ld: -T orphan-region.ld -N +#ld: -T orphan-region.ld -N -z stack-size=0 #readelf: -S -l --wide #xfail: arc-*-* d30v-*-* dlx-*-* fr30-*-* frv-*-elf i860-*-* i960-*-* #xfail: iq*-*-* mn10200-*-* moxie-*-* msp*-*-* mt-*-* or32-*-* pj*-*-* -#xfail: spu-*-* hppa*64*-*-* frv-*-* +#xfail: spu-*-* hppa*64*-*-* # if not using elf32.em, you don't get fancy orphan handling -# spu twiddles LOAD range, hppa64 adds PHDR, frv-linux adds GNU_STACK +# spu twiddles LOAD range, hppa64 adds PHDR #... \[[ 0-9]+\] \.text[ \t]+PROGBITS[ \t]+0*40000000[ \t]+.* diff --git a/ld/testsuite/ld-elf/stack-exec.rd b/ld/testsuite/ld-elf/stack-exec.rd new file mode 100644 index 0000000..7f68a6c --- /dev/null +++ b/ld/testsuite/ld-elf/stack-exec.rd @@ -0,0 +1,3 @@ +#... + GNU_STACK 0x0+00000 0x0+000000 0x0+000000 0x0+000 0x.+0000 RWE 0x[0-9a-f]+ +#pass diff --git a/ld/testsuite/ld-elf/stack-size.rd b/ld/testsuite/ld-elf/stack-size.rd new file mode 100644 index 0000000..413db3a9 --- /dev/null +++ b/ld/testsuite/ld-elf/stack-size.rd @@ -0,0 +1,3 @@ +#... + GNU_STACK 0x0+00000 0x0+000000 0x0+000000 0x0+000 0x123400 RW. 0x[0-9a-f]+ +#pass diff --git a/ld/testsuite/ld-elf/stack.s b/ld/testsuite/ld-elf/stack.s new file mode 100644 index 0000000..b92617b --- /dev/null +++ b/ld/testsuite/ld-elf/stack.s @@ -0,0 +1,10 @@ + .text + .globl start + .globl _start +start: +_start: + nop + nop + nop + nop + |