diff options
Diffstat (limited to 'gold/testsuite')
-rw-r--r-- | gold/testsuite/Makefile.am | 77 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 79 | ||||
-rwxr-xr-x | gold/testsuite/split_i386.sh | 54 | ||||
-rw-r--r-- | gold/testsuite/split_i386_1.s | 33 | ||||
-rw-r--r-- | gold/testsuite/split_i386_2.s | 33 | ||||
-rw-r--r-- | gold/testsuite/split_i386_3.s | 22 | ||||
-rw-r--r-- | gold/testsuite/split_i386_4.s | 23 | ||||
-rw-r--r-- | gold/testsuite/split_i386_n.s | 12 | ||||
-rwxr-xr-x | gold/testsuite/split_x86_64.sh | 54 | ||||
-rw-r--r-- | gold/testsuite/split_x86_64_1.s | 33 | ||||
-rw-r--r-- | gold/testsuite/split_x86_64_2.s | 33 | ||||
-rw-r--r-- | gold/testsuite/split_x86_64_3.s | 22 | ||||
-rw-r--r-- | gold/testsuite/split_x86_64_4.s | 23 | ||||
-rw-r--r-- | gold/testsuite/split_x86_64_n.s | 12 | ||||
-rw-r--r-- | gold/testsuite/testfile.cc | 2 |
15 files changed, 508 insertions, 4 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index 25740b8..6d40a5d 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -25,6 +25,7 @@ TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt TEST_STRIP = $(top_builddir)/../binutils/strip-new TEST_AR = $(top_builddir)/../binutils/ar TEST_NM = $(top_builddir)/../binutils/nm-new +TEST_AS = $(top_builddir)/../gas/as-new if PLUGINS LIBDL = -ldl @@ -1182,3 +1183,79 @@ permission_test: basic_test.o gcctestdir/ld endif GCC endif NATIVE_LINKER + +# These tests work with cross linkers. + +if DEFAULT_TARGET_I386 + +check_SCRIPTS += split_i386.sh +check_DATA += split_i386_1.stdout split_i386_2.stdout \ + split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout +SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200 +split_i386_1.o: split_i386_1.s + $(TEST_AS) -o $@ $< +split_i386_2.o: split_i386_2.s + $(TEST_AS) -o $@ $< +split_i386_3.o: split_i386_3.s + $(TEST_AS) -o $@ $< +split_i386_4.o: split_i386_4.s + $(TEST_AS) -o $@ $< +split_i386_n.o: split_i386_n.s + $(TEST_AS) -o $@ $< +split_i386_1: split_i386_1.o split_i386_n.o ../ld-new + ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o +split_i386_1.stdout: split_i386_1 + $(TEST_OBJDUMP) -d $< > $@ +split_i386_2: split_i386_2.o split_i386_n.o ../ld-new + ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o +split_i386_2.stdout: split_i386_2 + $(TEST_OBJDUMP) -d $< > $@ +split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new + ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0 +split_i386_4: split_i386_4.o split_i386_n.o ../ld-new + ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o +split_i386_4.stdout: split_i386_4 + $(TEST_OBJDUMP) -d $< > $@ +split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new + ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0 +MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \ + split_i386_4 split_i386_r + +endif DEFAULT_TARGET_I386 + +if DEFAULT_TARGET_X86_64 + +check_SCRIPTS += split_x86_64.sh +check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \ + split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout +SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200 +split_x86_64_1.o: split_x86_64_1.s + $(TEST_AS) -o $@ $< +split_x86_64_2.o: split_x86_64_2.s + $(TEST_AS) -o $@ $< +split_x86_64_3.o: split_x86_64_3.s + $(TEST_AS) -o $@ $< +split_x86_64_4.o: split_x86_64_4.s + $(TEST_AS) -o $@ $< +split_x86_64_n.o: split_x86_64_n.s + $(TEST_AS) -o $@ $< +split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new + ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o +split_x86_64_1.stdout: split_x86_64_1 + $(TEST_OBJDUMP) -d $< > $@ +split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new + ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o +split_x86_64_2.stdout: split_x86_64_2 + $(TEST_OBJDUMP) -d $< > $@ +split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new + ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0 +split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new + ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o +split_x86_64_4.stdout: split_x86_64_4 + $(TEST_OBJDUMP) -d $< > $@ +split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new + ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0 +MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \ + split_x86_64_4 split_x86_64_r + +endif DEFAULT_TARGET_X86_64 diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 36334ef..f047214 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -378,6 +378,22 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \ # Test that if the output file already exists and is empty, # it will get execute permission. @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_31 = permission_test + +# These tests work with cross linkers. +@DEFAULT_TARGET_I386_TRUE@am__append_32 = split_i386.sh +@DEFAULT_TARGET_I386_TRUE@am__append_33 = split_i386_1.stdout split_i386_2.stdout \ +@DEFAULT_TARGET_I386_TRUE@ split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout + +@DEFAULT_TARGET_I386_TRUE@am__append_34 = split_i386_1 split_i386_2 split_i386_3 \ +@DEFAULT_TARGET_I386_TRUE@ split_i386_4 split_i386_r + +@DEFAULT_TARGET_X86_64_TRUE@am__append_35 = split_x86_64.sh +@DEFAULT_TARGET_X86_64_TRUE@am__append_36 = split_x86_64_1.stdout split_x86_64_2.stdout \ +@DEFAULT_TARGET_X86_64_TRUE@ split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout + +@DEFAULT_TARGET_X86_64_TRUE@am__append_37 = split_x86_64_1 split_x86_64_2 split_x86_64_3 \ +@DEFAULT_TARGET_X86_64_TRUE@ split_x86_64_4 split_x86_64_r + subdir = testsuite DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -1389,6 +1405,7 @@ TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt TEST_STRIP = $(top_builddir)/../binutils/strip-new TEST_AR = $(top_builddir)/../binutils/ar TEST_NM = $(top_builddir)/../binutils/nm-new +TEST_AS = $(top_builddir)/../gas/as-new @PLUGINS_TRUE@LIBDL = -ldl @THREADS_TRUE@THREADSLIB = -lpthread @OMP_SUPPORT_TRUE@TLS_TEST_C_CFLAGS = -fopenmp @@ -1399,13 +1416,15 @@ TEST_NM = $(top_builddir)/../binutils/nm-new # the right choice for files 'make' builds that people rebuild. MOSTLYCLEANFILES = *.so *.syms *.stdout $(am__append_3) \ $(am__append_8) $(am__append_17) $(am__append_25) \ - $(am__append_29) + $(am__append_29) $(am__append_34) $(am__append_37) # We will add to these later, for each individual test. Note # that we add each test under check_SCRIPTS or check_PROGRAMS; # the TESTS variable is automatically populated from these. -check_SCRIPTS = $(am__append_1) $(am__append_23) $(am__append_27) -check_DATA = $(am__append_2) $(am__append_24) $(am__append_28) +check_SCRIPTS = $(am__append_1) $(am__append_23) $(am__append_27) \ + $(am__append_32) $(am__append_35) +check_DATA = $(am__append_2) $(am__append_24) $(am__append_28) \ + $(am__append_33) $(am__append_36) BUILT_SOURCES = $(am__append_16) TESTS = $(check_SCRIPTS) $(check_PROGRAMS) @@ -1749,6 +1768,8 @@ binary_unittest_SOURCES = binary_unittest.cc @GCC_TRUE@@MCMODEL_MEDIUM_TRUE@@NATIVE_LINKER_TRUE@large_CFLAGS = -mcmodel=medium @GCC_TRUE@@MCMODEL_MEDIUM_TRUE@@NATIVE_LINKER_TRUE@large_DEPENDENCIES = gcctestdir/ld @GCC_TRUE@@MCMODEL_MEDIUM_TRUE@@NATIVE_LINKER_TRUE@large_LDFLAGS = -Bgcctestdir/ +@DEFAULT_TARGET_I386_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200 +@DEFAULT_TARGET_X86_64_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200 all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am @@ -2979,6 +3000,58 @@ uninstall-am: @GCC_TRUE@@NATIVE_LINKER_TRUE@ touch $@; \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ chmod 600 $@; \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ basic_test.o +@DEFAULT_TARGET_I386_TRUE@split_i386_1.o: split_i386_1.s +@DEFAULT_TARGET_I386_TRUE@ $(TEST_AS) -o $@ $< +@DEFAULT_TARGET_I386_TRUE@split_i386_2.o: split_i386_2.s +@DEFAULT_TARGET_I386_TRUE@ $(TEST_AS) -o $@ $< +@DEFAULT_TARGET_I386_TRUE@split_i386_3.o: split_i386_3.s +@DEFAULT_TARGET_I386_TRUE@ $(TEST_AS) -o $@ $< +@DEFAULT_TARGET_I386_TRUE@split_i386_4.o: split_i386_4.s +@DEFAULT_TARGET_I386_TRUE@ $(TEST_AS) -o $@ $< +@DEFAULT_TARGET_I386_TRUE@split_i386_n.o: split_i386_n.s +@DEFAULT_TARGET_I386_TRUE@ $(TEST_AS) -o $@ $< +@DEFAULT_TARGET_I386_TRUE@split_i386_1: split_i386_1.o split_i386_n.o ../ld-new +@DEFAULT_TARGET_I386_TRUE@ ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o +@DEFAULT_TARGET_I386_TRUE@split_i386_1.stdout: split_i386_1 +@DEFAULT_TARGET_I386_TRUE@ $(TEST_OBJDUMP) -d $< > $@ +@DEFAULT_TARGET_I386_TRUE@split_i386_2: split_i386_2.o split_i386_n.o ../ld-new +@DEFAULT_TARGET_I386_TRUE@ ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o +@DEFAULT_TARGET_I386_TRUE@split_i386_2.stdout: split_i386_2 +@DEFAULT_TARGET_I386_TRUE@ $(TEST_OBJDUMP) -d $< > $@ +@DEFAULT_TARGET_I386_TRUE@split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new +@DEFAULT_TARGET_I386_TRUE@ ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0 +@DEFAULT_TARGET_I386_TRUE@split_i386_4: split_i386_4.o split_i386_n.o ../ld-new +@DEFAULT_TARGET_I386_TRUE@ ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o +@DEFAULT_TARGET_I386_TRUE@split_i386_4.stdout: split_i386_4 +@DEFAULT_TARGET_I386_TRUE@ $(TEST_OBJDUMP) -d $< > $@ +@DEFAULT_TARGET_I386_TRUE@split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new +@DEFAULT_TARGET_I386_TRUE@ ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0 +@DEFAULT_TARGET_X86_64_TRUE@split_x86_64_1.o: split_x86_64_1.s +@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_AS) -o $@ $< +@DEFAULT_TARGET_X86_64_TRUE@split_x86_64_2.o: split_x86_64_2.s +@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_AS) -o $@ $< +@DEFAULT_TARGET_X86_64_TRUE@split_x86_64_3.o: split_x86_64_3.s +@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_AS) -o $@ $< +@DEFAULT_TARGET_X86_64_TRUE@split_x86_64_4.o: split_x86_64_4.s +@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_AS) -o $@ $< +@DEFAULT_TARGET_X86_64_TRUE@split_x86_64_n.o: split_x86_64_n.s +@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_AS) -o $@ $< +@DEFAULT_TARGET_X86_64_TRUE@split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new +@DEFAULT_TARGET_X86_64_TRUE@ ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o +@DEFAULT_TARGET_X86_64_TRUE@split_x86_64_1.stdout: split_x86_64_1 +@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_OBJDUMP) -d $< > $@ +@DEFAULT_TARGET_X86_64_TRUE@split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new +@DEFAULT_TARGET_X86_64_TRUE@ ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o +@DEFAULT_TARGET_X86_64_TRUE@split_x86_64_2.stdout: split_x86_64_2 +@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_OBJDUMP) -d $< > $@ +@DEFAULT_TARGET_X86_64_TRUE@split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new +@DEFAULT_TARGET_X86_64_TRUE@ ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0 +@DEFAULT_TARGET_X86_64_TRUE@split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new +@DEFAULT_TARGET_X86_64_TRUE@ ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o +@DEFAULT_TARGET_X86_64_TRUE@split_x86_64_4.stdout: split_x86_64_4 +@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_OBJDUMP) -d $< > $@ +@DEFAULT_TARGET_X86_64_TRUE@split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new +@DEFAULT_TARGET_X86_64_TRUE@ ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/gold/testsuite/split_i386.sh b/gold/testsuite/split_i386.sh new file mode 100755 index 0000000..e94fea2 --- /dev/null +++ b/gold/testsuite/split_i386.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +# split_i386.sh -- test -fstack-split for i386 + +# Copyright 2009 Free Software Foundation, Inc. +# Written by Ian Lance Taylor <iant@google.com>. + +# This file is part of gold. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +match() +{ + if ! egrep "$1" "$2" >/dev/null 2>&1; then + echo 1>&2 "could not find '$1' in $2" + exit 1 + fi +} + +nomatch() +{ + if egrep "$1" "$2" >/dev/null 2>&1; then + echo 1>&2 "found unexpected '$1' in $2" + exit 1 + fi +} + +match 'cmp.*+%gs:[^,]*,%esp' split_i386_1.stdout +match 'call.*__morestack>?$' split_i386_1.stdout +match 'lea.*-0x200\(%esp\),' split_i386_1.stdout + +match 'stc' split_i386_2.stdout +match 'call.*__morestack_non_split>?$' split_i386_2.stdout +nomatch 'call.*__morestack>?$' split_i386_2.stdout +match 'lea.*-0x4200\(%esp\),' split_i386_2.stdout + +match 'failed to match' split_i386_3.stdout + +match 'call.*__morestack>?$' split_i386_4.stdout + +match 'cannot mix' split_i386_r.stdout diff --git a/gold/testsuite/split_i386_1.s b/gold/testsuite/split_i386_1.s new file mode 100644 index 0000000..9ac816e --- /dev/null +++ b/gold/testsuite/split_i386_1.s @@ -0,0 +1,33 @@ +# split_i386_1.s: i386 specific test case for -fsplit-stack. + + .text + + .global fn1 + .type fn1,@function +fn1: + cmp %gs:0x30,%esp + jae 1f + call __morestack + ret +1: + call fn2 + ret + + .size fn1,. - fn1 + + .global fn2 + .type fn2,@function +fn2: + lea -0x200(%esp),%ecx + cmp %gs:0x30,%ecx + jae 1f + call __morestack + ret +1: + call fn1 + ret + + .size fn2,. - fn2 + + .section .note.GNU-stack,"",@progbits + .section .note.GNU-split-stack,"",@progbits diff --git a/gold/testsuite/split_i386_2.s b/gold/testsuite/split_i386_2.s new file mode 100644 index 0000000..b4a2f14 --- /dev/null +++ b/gold/testsuite/split_i386_2.s @@ -0,0 +1,33 @@ +# split_i386_2.s: i386 specific, -fsplit-stack calling non-split + + .text + + .global fn1 + .type fn1,@function +fn1: + cmp %gs:0x30,%esp + jae 1f + call __morestack + ret +1: + call fn3 + ret + + .size fn1,. - fn1 + + .global fn2 + .type fn2,@function +fn2: + lea -0x200(%esp),%ecx + cmp %gs:0x30,%ecx + jae 1f + call __morestack + ret +1: + call fn3 + ret + + .size fn2,. - fn2 + + .section .note.GNU-stack,"",@progbits + .section .note.GNU-split-stack,"",@progbits diff --git a/gold/testsuite/split_i386_3.s b/gold/testsuite/split_i386_3.s new file mode 100644 index 0000000..fdde7a9 --- /dev/null +++ b/gold/testsuite/split_i386_3.s @@ -0,0 +1,22 @@ +# split_i386_3.s: i386 specific, adjustment failure + + .text + + .global fn1 + .type fn1,@function +fn1: + push %ebp + mov %esp,%ebp + cmp %gs:0x30,%esp + jae 1f + call __morestack + ret +1: + call fn3 + leave + ret + + .size fn1,. - fn1 + + .section .note.GNU-stack,"",@progbits + .section .note.GNU-split-stack,"",@progbits diff --git a/gold/testsuite/split_i386_4.s b/gold/testsuite/split_i386_4.s new file mode 100644 index 0000000..be774ae --- /dev/null +++ b/gold/testsuite/split_i386_4.s @@ -0,0 +1,23 @@ +# split_i386_4.s: i386 specific, permitted adjustment failure + + .text + + .global fn1 + .type fn1,@function +fn1: + push %ebp + mov %esp,%ebp + cmp %gs:0x30,%esp + jae 1f + call __morestack + ret +1: + call fn3 + leave + ret + + .size fn1,. - fn1 + + .section .note.GNU-stack,"",@progbits + .section .note.GNU-split-stack,"",@progbits + .section .note.GNU-no-split-stack,"",@progbits diff --git a/gold/testsuite/split_i386_n.s b/gold/testsuite/split_i386_n.s new file mode 100644 index 0000000..4d4e6e8 --- /dev/null +++ b/gold/testsuite/split_i386_n.s @@ -0,0 +1,12 @@ +# split_i386_n.s: i386 specific, -fsplit-stack calling non-split + + .text + + .global fn3 + .type fn3,@function +fn3: + ret + + .size fn3,. - fn3 + + .section .note.GNU-stack,"",@progbits diff --git a/gold/testsuite/split_x86_64.sh b/gold/testsuite/split_x86_64.sh new file mode 100755 index 0000000..61544b2 --- /dev/null +++ b/gold/testsuite/split_x86_64.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +# split_x86_64.sh -- test -fstack-split for x86_64 + +# Copyright 2009 Free Software Foundation, Inc. +# Written by Ian Lance Taylor <iant@google.com>. + +# This file is part of gold. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +match() +{ + if ! egrep "$1" "$2" >/dev/null 2>&1; then + echo 1>&2 "could not find '$1' in $2" + exit 1 + fi +} + +nomatch() +{ + if egrep "$1" "$2" >/dev/null 2>&1; then + echo 1>&2 "found unexpected '$1' in $2" + exit 1 + fi +} + +match 'cmp.*+%fs:[^,]*,%rsp' split_x86_64_1.stdout +match 'callq.*__morestack>?$' split_x86_64_1.stdout +match 'lea.*-0x200\(%rsp\),' split_x86_64_1.stdout + +match 'stc' split_x86_64_2.stdout +match 'callq.*__morestack_non_split>?$' split_x86_64_2.stdout +nomatch 'callq.*__morestack>?$' split_x86_64_2.stdout +match 'lea.*-0x4200\(%rsp\),' split_x86_64_2.stdout + +match 'failed to match' split_x86_64_3.stdout + +match 'callq.*__morestack>?$' split_x86_64_4.stdout + +match 'cannot mix' split_x86_64_r.stdout diff --git a/gold/testsuite/split_x86_64_1.s b/gold/testsuite/split_x86_64_1.s new file mode 100644 index 0000000..e23ea7f --- /dev/null +++ b/gold/testsuite/split_x86_64_1.s @@ -0,0 +1,33 @@ +# split_x86_64_1.s: x86_64 specific test case for -fsplit-stack. + + .text + + .global fn1 + .type fn1,@function +fn1: + cmp %fs:0x70,%rsp + jae 1f + callq __morestack + retq +1: + callq fn2 + retq + + .size fn1,. - fn1 + + .global fn2 + .type fn2,@function +fn2: + lea -0x200(%rsp),%r10 + cmp %fs:0x70,%r10 + jae 1f + callq __morestack + retq +1: + callq fn1 + retq + + .size fn2,. - fn2 + + .section .note.GNU-stack,"",@progbits + .section .note.GNU-split-stack,"",@progbits diff --git a/gold/testsuite/split_x86_64_2.s b/gold/testsuite/split_x86_64_2.s new file mode 100644 index 0000000..0559bbc --- /dev/null +++ b/gold/testsuite/split_x86_64_2.s @@ -0,0 +1,33 @@ +# split_x86_64_2.s: x86_64 specific, -fsplit-stack calling non-split + + .text + + .global fn1 + .type fn1,@function +fn1: + cmp %fs:0x70,%rsp + jae 1f + callq __morestack + retq +1: + callq fn3 + retq + + .size fn1,. - fn1 + + .global fn2 + .type fn2,@function +fn2: + lea -0x200(%rsp),%r10 + cmp %fs:0x70,%r10 + jae 1f + callq __morestack + retq +1: + callq fn3 + retq + + .size fn2,. - fn2 + + .section .note.GNU-stack,"",@progbits + .section .note.GNU-split-stack,"",@progbits diff --git a/gold/testsuite/split_x86_64_3.s b/gold/testsuite/split_x86_64_3.s new file mode 100644 index 0000000..68ae6e3 --- /dev/null +++ b/gold/testsuite/split_x86_64_3.s @@ -0,0 +1,22 @@ +# split_x86_64_3.s: x86_64 specific, adjustment failure + + .text + + .global fn1 + .type fn1,@function +fn1: + push %rbp + mov %rsp,%rbp + cmp %fs:0x70,%rsp + jae 1f + callq __morestack + retq +1: + callq fn3 + leaveq + retq + + .size fn1,. - fn1 + + .section .note.GNU-stack,"",@progbits + .section .note.GNU-split-stack,"",@progbits diff --git a/gold/testsuite/split_x86_64_4.s b/gold/testsuite/split_x86_64_4.s new file mode 100644 index 0000000..653b917 --- /dev/null +++ b/gold/testsuite/split_x86_64_4.s @@ -0,0 +1,23 @@ +# split_x86_64_4.s: x86_64 specific, permitted adjustment failure + + .text + + .global fn1 + .type fn1,@function +fn1: + push %rbp + mov %rsp,%rbp + cmp %fs:0x70,%rsp + jae 1f + callq __morestack + retq +1: + callq fn3 + leaveq + retq + + .size fn1,. - fn1 + + .section .note.GNU-stack,"",@progbits + .section .note.GNU-split-stack,"",@progbits + .section .note.GNU-no-split-stack,"",@progbits diff --git a/gold/testsuite/split_x86_64_n.s b/gold/testsuite/split_x86_64_n.s new file mode 100644 index 0000000..10436b1 --- /dev/null +++ b/gold/testsuite/split_x86_64_n.s @@ -0,0 +1,12 @@ +# split_x86_64_n.s: x86_64 specific, -fsplit-stack calling non-split + + .text + + .global fn3 + .type fn3,@function +fn3: + retq + + .size fn3,. - fn3 + + .section .note.GNU-stack,"",@progbits diff --git a/gold/testsuite/testfile.cc b/gold/testsuite/testfile.cc index 2532307..d66189a 100644 --- a/gold/testsuite/testfile.cc +++ b/gold/testsuite/testfile.cc @@ -61,7 +61,7 @@ class Target_test : public Sized_target<size, big_endian> relocate_section(const Relocate_info<size, big_endian>*, unsigned int, const unsigned char*, size_t, Output_section*, bool, unsigned char*, typename elfcpp::Elf_types<size>::Elf_Addr, - section_size_type) + section_size_type, const Reloc_symbol_changes*) { ERROR("call to Target_test::relocate_section"); } void |