* ld-sh/rd-sh.exp: New framework file.

* ld-sh/ld-r-1.d, ld-sh/ldr1.s, ld-sh/ldr2.s, ld-sh/shared-1.d,
	ld-sh/weak1.s, ld-sh/weak1.d, ld-sh/sub2l.s, ld-sh/sub2l-1.d: New
	test files.
This commit is contained in:
Hans-Peter Nilsson 2001-10-14 15:18:11 +00:00
parent c987d8c09d
commit 7739e068a7
10 changed files with 183 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2001-10-14 Hans-Peter Nilsson <hp@bitrange.com>
* ld-sh/rd-sh.exp: New framework file.
* ld-sh/ld-r-1.d, ld-sh/ldr1.s, ld-sh/ldr2.s, ld-sh/shared-1.d,
ld-sh/weak1.s, ld-sh/weak1.d, ld-sh/sub2l.s, ld-sh/sub2l-1.d: New
test files.
2001-09-29 Hans-Peter Nilsson <hp@axis.com>
* ld-linkonce/linkonce.exp: New file.

View File

@ -0,0 +1,22 @@
#source: ldr1.s
#source: ldr2.s
#as: -little
#ld: -r -EL
#readelf: -r -x1 -x2
#target: sh*-*-elf sh*-*-linux*
# Make sure relocations against global and local symbols with relative and
# absolute 32-bit relocs don't come out wrong after ld -r. Remember that
# SH uses partial_inplace (sort-of REL within RELA) with its confusion
# where and which addends to use and how. A file linked -r must have the
# same layout as a plain assembly file: the addend is in the data only.
Relocation section '\.rela\.text' at offset 0x1b8 contains 1 entries:
Offset Info Type Symbol's Value Symbol's Name Addend
00000008 00000101 R_SH_DIR32 00000000 \.text \+ 0
Hex dump of section '\.text':
0x00000000 0000000c 00090009 00090009 .*
Hex dump of section '\.rela\.text':
0x00000000 00000000 00000101 00000008 .*

View File

@ -0,0 +1,5 @@
.text
nop
nop
nop
nop

View File

@ -0,0 +1,3 @@
.text
.long bar
bar:

View File

@ -0,0 +1,36 @@
# Expect script for run_dump_test based ld-sh tests.
# Copyright 2001 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.
#
# Written by Hans-Peter Nilsson (hp@bitrange.com)
#
# This file is kept separate from sh.exp, because having it separate
# simplifies selective testing, like in "make check-ld
# RUNTESTFLAGS=rd-sh.exp=shared-1". It is assumed that sh.exp is a place
# for constructs where the name of the test is harder to extract and
# select than here.
if ![istarget sh*-*-*] {
return
}
set rd_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
foreach shtest $rd_test_list {
# We need to strip the ".d", but can leave the dirname.
verbose [file rootname $shtest]
run_dump_test [file rootname $shtest]
}

View File

@ -0,0 +1,22 @@
#source: ldr1.s
#source: ldr2.s
#as: -little
#ld: -shared -EL
#readelf: -r -x4 -x5
#target: sh*-*-elf sh*-*-linux*
# Make sure relocations against global and local symbols with relative and
# absolute 32-bit relocs don't come out wrong after ld -r. Remember that
# SH uses partial_inplace (sort-of REL within RELA) with related confusion
# about how, when, where and which addends to use. A DSO must have the
# same value in the addend as in the data, so either can be used.
Relocation section '\.rela\.text' at offset 0x32c contains 1 entries:
Offset Info Type Symbol's Value Symbol's Name Addend
00000340 000000a5 R_SH_RELATIVE 00000344
Hex dump of section '\.rela\.text':
0x0000032c 00000344 000000a5 00000340 .*
Hex dump of section '\.text':
0x00000338 00000344 00090009 00090009 .*

View File

@ -0,0 +1,23 @@
#source: sub2l.s
#as: -little
#ld: -EL -e 0x1000
#objdump: -st
.*/dump: file format elf32-shl
SYMBOL TABLE:
#...
0+1000 l .text 00000000 f
0+1002 l .text 00000000 f2
0+1028 l .text 00000000 L
0+1020 g .text 00000000 ff
#...
Contents of section \.text:
1000 0b000900 09000900 09000900 09000900 .*
1010 09000900 09000900 09000900 09000900 .*
1020 09000900 09000900 0b000900 d8ffffff .*
1030 daffffff 02100000 28100000 24100000 .*
Contents of section \.data:
#pass

View File

@ -0,0 +1,26 @@
! "The subtraction of two symbols".
.little
.text
.align 5
f:
rts
f2:
nop
.section .text.foo,"ax",@progbits
.align 5
.global ff
ff:
nop
nop
nop
nop
L:
rts
nop
.align 2
.long f-L
.long f2-L
.long f2
.long L
.long ff+4

View File

@ -0,0 +1,20 @@
#source: weak1.s
#as: -little
#ld: -e 0x1000 -EL
#objdump: -ts
.*: file format elf32-shl
SYMBOL TABLE:
#...
0+10a0 l .data 0+ d0
0+1000 l .text 0+ f
0+10a4 w .data 0+ w0
#...
Contents of section .text:
1000 01d11260 0b000900 a4100000 09000900 .*
1010 09000900 09000900 09000900 09000900 .*
Contents of section .data:
10a0 01000000 00000000 .*
#pass

View File

@ -0,0 +1,19 @@
.data
.align 2
d0:
.long 1
.global w0
w0:
.long 0
.weak w0
.text
.align 5
f:
mov.l .L3,r1
mov.l @r1,r0
rts
nop
.align 2
.L3:
.long w0