diff options
author | Nick Clifton <nickc@redhat.com> | 2003-04-01 15:50:31 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2003-04-01 15:50:31 +0000 |
commit | e0001a05d2e4967ee86f4468cdc4fafea66b92d1 (patch) | |
tree | 4676b72e452f4dfc81e8d6646fb43f63a108da1b /ld/testsuite | |
parent | ce0c72625ad0f6497718b4293572b2b6be711714 (diff) | |
download | gdb-e0001a05d2e4967ee86f4468cdc4fafea66b92d1.zip gdb-e0001a05d2e4967ee86f4468cdc4fafea66b92d1.tar.gz gdb-e0001a05d2e4967ee86f4468cdc4fafea66b92d1.tar.bz2 |
Add Xtensa port
Diffstat (limited to 'ld/testsuite')
-rw-r--r-- | ld/testsuite/ChangeLog | 15 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/merge.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/crossref.exp | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-srec/srec.exp | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-xtensa/coalesce.exp | 93 | ||||
-rw-r--r-- | ld/testsuite/ld-xtensa/coalesce.t | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-xtensa/coalesce1.s | 15 | ||||
-rw-r--r-- | ld/testsuite/ld-xtensa/coalesce2.s | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-xtensa/lcall.exp | 107 | ||||
-rw-r--r-- | ld/testsuite/ld-xtensa/lcall.t | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-xtensa/lcall1.s | 12 | ||||
-rw-r--r-- | ld/testsuite/ld-xtensa/lcall2.s | 5 |
12 files changed, 281 insertions, 1 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 145c3c0..d3cf2ca 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,18 @@ +2003-04-01 Bob Wilson <bob.wilson@acm.org> + + * ld-elf/merge.d: xfail xtensa-*-*. + * ld-scripts/crossref.exp: Add -mtext-section-literals to CFLAGS + for Xtensa targets. + * ld-srec/srec.exp: Add -no-relax flag for Xtensa targets. + * ld-xtensa/coalesce1.s: New file. + * ld-xtensa/coalesce2.s: Likewise. + * ld-xtensa/coalesce.exp: Likewise. + * ld-xtensa/coalesce.t: Likewise. + * ld-xtensa/lcall1.s: Likewise. + * ld-xtensa/lcall2.s: Likewise. + * ld-xtensa/lcall.exp: Likewise. + * ld-xtensa/lcall.t: Likewise. + 2003-03-25 Alexandre Oliva <aoliva@redhat.com> * ld-mips-elf/mips-elf.exp: Added... diff --git a/ld/testsuite/ld-elf/merge.d b/ld/testsuite/ld-elf/merge.d index cbefcaf..6331927 100644 --- a/ld/testsuite/ld-elf/merge.d +++ b/ld/testsuite/ld-elf/merge.d @@ -3,7 +3,7 @@ #objdump: -s #xfail: "arc-*-*" "avr-*-*" "cris-*-*" "dlx-*-*" "fr30-*-*" "frv-*-*" #xfail: "hppa*-*-*" "h8300-*-*" "i960-*-*" "ip2k-*-*" "m32r-*-*" "mcore-*-*" -#xfail: "mn10*-*-*" "openrisc-*-*" "pj-*-*" "sparc*-*-*" +#xfail: "mn10*-*-*" "openrisc-*-*" "pj-*-*" "sparc*-*-*" "xtensa-*-*" .*: file format .*elf.* diff --git a/ld/testsuite/ld-scripts/crossref.exp b/ld/testsuite/ld-scripts/crossref.exp index fbc3151..4fd81b3 100644 --- a/ld/testsuite/ld-scripts/crossref.exp +++ b/ld/testsuite/ld-scripts/crossref.exp @@ -26,6 +26,13 @@ if { [which $CC] == 0 } { return } +# Xtensa targets currently default to putting literal values in a separate +# section and that requires linker script support, so put literals in text. +global CFLAGS +if [istarget xtensa*-*-*] { + set CFLAGS "$CFLAGS -mtext-section-literals" +} + if { ![ld_compile $CC "$srcdir/$subdir/cross1.c" tmpdir/cross1.o] \ || ![ld_compile $CC "$srcdir/$subdir/cross2.c" tmpdir/cross2.o] } { unresolved $test1 diff --git a/ld/testsuite/ld-srec/srec.exp b/ld/testsuite/ld-srec/srec.exp index a965c22..979cfda 100644 --- a/ld/testsuite/ld-srec/srec.exp +++ b/ld/testsuite/ld-srec/srec.exp @@ -288,6 +288,11 @@ proc run_srec_test { test objs } { if [istarget v850*-*-elf] { set objs "$objs -L ../gcc -lgcc" } + + # Xtensa ELF targets relax by default; S-Record linker does not + if [istarget xtensa*-*-*] { + set flags "$flags -no-relax" + } if { ![ld_simple_link $ld tmpdir/sr1 "$flags $objs"] \ || ![ld_simple_link $ld tmpdir/sr2.sr "$flags --oformat srec $objs"] } { diff --git a/ld/testsuite/ld-xtensa/coalesce.exp b/ld/testsuite/ld-xtensa/coalesce.exp new file mode 100644 index 0000000..ef51d6f --- /dev/null +++ b/ld/testsuite/ld-xtensa/coalesce.exp @@ -0,0 +1,93 @@ +# Test literal coaslescing for Xtensa targets. +# By David Heine, Tensilica, Inc. +# Copyright 2002, 2003 +# Free Software Foundation, Inc. +# +# This file 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +set testname "COALESCE" + +set OBJDUMPFLAGS "-dr" + +# +# default_ld_objdump +# run objdump on a file +# +proc default_ld_objdump { objdump object outputfile } { + global OBJDUMPFLAGS + global objdump_output + global host_triplet + + if {[which $objdump] == 0} then { + perror "$objdump does not exist" + return 0 + } + + if ![info exists OBJDUMPFLAGS] { set OBJDUMPFLAGS "" } + + verbose -log "$objdump $OBJDUMPFLAGS $object >$outputfile" + + catch "exec $objdump $OBJDUMPFLAGS $object >$outputfile" exec_output + set exec_output [prune_warnings $exec_output] + if [string match "" $exec_output] then { + return 1 + } else { + verbose -log "$exec_output" + perror "$object: objdump failed" + return 0 + } +} + + +if ![ld_assemble $as $srcdir/$subdir/coalesce1.s tmpdir/coalesce1.o] { + unresolved $testname + return +} +if ![ld_assemble $as $srcdir/$subdir/coalesce2.s tmpdir/coalesce2.o] { + unresolved $testname + return +} + +set object "tmpdir/coalesce" +set outputfile "$object.txt" + +if ![ld_simple_link $ld $object "-T $srcdir/$subdir/coalesce.t tmpdir/coalesce1.o tmpdir/coalesce2.o"] { + verbose -log "failure in ld" + fail $testname + return +} + +if ![default_ld_objdump $objdump $object $outputfile ] { + verbose -log "failure in objdump" + fail $testname + return +} + +set file [open $outputfile r] +set found 0 + +while { [gets $file line] != -1 } { + # verbose "$line" 2 + if [regexp "^0000000c <main>:" $line] { + set found 1 + } +} +close $file +if $found { + pass $testname +} else { + fail $testname +} + diff --git a/ld/testsuite/ld-xtensa/coalesce.t b/ld/testsuite/ld-xtensa/coalesce.t new file mode 100644 index 0000000..7bff69f --- /dev/null +++ b/ld/testsuite/ld-xtensa/coalesce.t @@ -0,0 +1,6 @@ +SECTIONS +{ + .text 0x00000000 : { + *(.literal .text) + } +} diff --git a/ld/testsuite/ld-xtensa/coalesce1.s b/ld/testsuite/ld-xtensa/coalesce1.s new file mode 100644 index 0000000..4374463 --- /dev/null +++ b/ld/testsuite/ld-xtensa/coalesce1.s @@ -0,0 +1,15 @@ + .global foo + .data + .global g_name + .align 4 +g_name: + .word 0xffffffff + .text + .global main + .align 4 +main: + entry a5,16 + movi a5,20000 + movi a6,g_name + call8 foo + ret diff --git a/ld/testsuite/ld-xtensa/coalesce2.s b/ld/testsuite/ld-xtensa/coalesce2.s new file mode 100644 index 0000000..962915c --- /dev/null +++ b/ld/testsuite/ld-xtensa/coalesce2.s @@ -0,0 +1,9 @@ + .text + .global foo + .global g_name +foo: + entry a5,16 + movi a5,20000 + movi a6,g_name + movi a7,50000 + ret diff --git a/ld/testsuite/ld-xtensa/lcall.exp b/ld/testsuite/ld-xtensa/lcall.exp new file mode 100644 index 0000000..9879a55 --- /dev/null +++ b/ld/testsuite/ld-xtensa/lcall.exp @@ -0,0 +1,107 @@ +# Test Xtensa longcall optimization. +# By David Heine, Tensilica, Inc. +# Copyright 2002, 2003 +# Free Software Foundation, Inc. +# +# This file 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +set testname "LCALL" + +set OBJDUMPFLAGS "-dr" + +# +# default_ld_objdump +# run objdump on a file +# +proc default_ld_objdump { objdump object outputfile } { + global OBJDUMPFLAGS + global objdump_output + global host_triplet + + if {[which $objdump] == 0} then { + perror "$objdump does not exist" + return 0 + } + + if ![info exists OBJDUMPFLAGS] { set OBJDUMPFLAGS "" } + + verbose -log "$objdump $OBJDUMPFLAGS $object >$outputfile" + + catch "exec $objdump $OBJDUMPFLAGS $object >$outputfile" exec_output + set exec_output [prune_warnings $exec_output] + if [string match "" $exec_output] then { + return 1 + } else { + verbose -log "$exec_output" + perror "$object: objdump failed" + return 0 + } +} + + +if ![ld_assemble $as $srcdir/$subdir/lcall1.s tmpdir/lcall1.o] { + unresolved $testname + return +} +if ![ld_assemble $as $srcdir/$subdir/lcall2.s tmpdir/lcall2.o] { + unresolved $testname + return +} + +set object "tmpdir/lcall" +set outputfile "$object.txt" + +if ![ld_simple_link $ld $object "-T $srcdir/$subdir/lcall.t tmpdir/lcall1.o tmpdir/lcall2.o"] { + verbose -log "failure in ld" + fail $testname + return +} + +if ![default_ld_objdump $objdump $object $outputfile ] { + verbose -log "failure in objdump" + fail $testname + return +} + +set file [open $outputfile r] +while { [gets $file line] != -1 } { + # verbose "$line" 2 + if [regexp "l32r" $line] { + verbose -log "Found an l32r in the linked object" + verbose -log "$line" + fail $testname + } +} +close $file +pass $testname + + +set testname "LCALL2" +set file [open $outputfile r] +set found 0 + +while { [gets $file line] != -1 } { + # verbose "$line" 2 + if [regexp "^00000004 <label1>:" $line] { + set found 1 + } +} +close $file +if $found { + pass $testname +} else { + fail $testname +} + diff --git a/ld/testsuite/ld-xtensa/lcall.t b/ld/testsuite/ld-xtensa/lcall.t new file mode 100644 index 0000000..7bff69f --- /dev/null +++ b/ld/testsuite/ld-xtensa/lcall.t @@ -0,0 +1,6 @@ +SECTIONS +{ + .text 0x00000000 : { + *(.literal .text) + } +} diff --git a/ld/testsuite/ld-xtensa/lcall1.s b/ld/testsuite/ld-xtensa/lcall1.s new file mode 100644 index 0000000..1056c6a --- /dev/null +++ b/ld/testsuite/ld-xtensa/lcall1.s @@ -0,0 +1,12 @@ +.global foo +.text + .align 4 +label1: + .begin literal + .word 0xffffffff + .end literal + entry a5,16 +.begin longcalls + call4 foo +.end longcalls + nop diff --git a/ld/testsuite/ld-xtensa/lcall2.s b/ld/testsuite/ld-xtensa/lcall2.s new file mode 100644 index 0000000..f4784f0 --- /dev/null +++ b/ld/testsuite/ld-xtensa/lcall2.s @@ -0,0 +1,5 @@ +.global foo +foo: + entry a5,16 + nop + ret |