aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog164
-rw-r--r--ld/testsuite/ld-scripts/crossref.exp5
-rw-r--r--ld/testsuite/ld-selective/selective.exp7
-rw-r--r--ld/testsuite/ld-sh/sh.exp5
-rw-r--r--ld/testsuite/ld-sh/sh64/abi32.sd18
-rw-r--r--ld/testsuite/ld-sh/sh64/abi32.xd58
-rw-r--r--ld/testsuite/ld-sh/sh64/abi64.sd22
-rw-r--r--ld/testsuite/ld-sh/sh64/abi64.xd57
-rw-r--r--ld/testsuite/ld-sh/sh64/abixx-noexp.sd14
-rw-r--r--ld/testsuite/ld-sh/sh64/cmpct1.sd12
-rw-r--r--ld/testsuite/ld-sh/sh64/cmpct1.xd55
-rw-r--r--ld/testsuite/ld-sh/sh64/crange-1.s8
-rw-r--r--ld/testsuite/ld-sh/sh64/crange-2a.s22
-rw-r--r--ld/testsuite/ld-sh/sh64/crange-2b.s39
-rw-r--r--ld/testsuite/ld-sh/sh64/crange-2c.s16
-rw-r--r--ld/testsuite/ld-sh/sh64/crange-2d.s9
-rw-r--r--ld/testsuite/ld-sh/sh64/crange-2e.s12
-rw-r--r--ld/testsuite/ld-sh/sh64/crange-2f.s21
-rw-r--r--ld/testsuite/ld-sh/sh64/crange-2g.s26
-rw-r--r--ld/testsuite/ld-sh/sh64/crange-2h.s17
-rw-r--r--ld/testsuite/ld-sh/sh64/crange-2i.s7
-rw-r--r--ld/testsuite/ld-sh/sh64/crange1.rd61
-rw-r--r--ld/testsuite/ld-sh/sh64/crange2.rd69
-rw-r--r--ld/testsuite/ld-sh/sh64/crange3-cmpct.rd93
-rw-r--r--ld/testsuite/ld-sh/sh64/crange3-media.rd93
-rw-r--r--ld/testsuite/ld-sh/sh64/crange3.dd78
-rw-r--r--ld/testsuite/ld-sh/sh64/crange3.rd74
-rw-r--r--ld/testsuite/ld-sh/sh64/crangerel1.rd47
-rw-r--r--ld/testsuite/ld-sh/sh64/crangerel2.rd62
-rw-r--r--ld/testsuite/ld-sh/sh64/endian.dbd11
-rw-r--r--ld/testsuite/ld-sh/sh64/endian.dld11
-rw-r--r--ld/testsuite/ld-sh/sh64/endian.ld6
-rw-r--r--ld/testsuite/ld-sh/sh64/endian.s7
-rw-r--r--ld/testsuite/ld-sh/sh64/endian.sbd7
-rw-r--r--ld/testsuite/ld-sh/sh64/endian.sld7
-rw-r--r--ld/testsuite/ld-sh/sh64/mix1-noexp.sd16
-rw-r--r--ld/testsuite/ld-sh/sh64/mix1.sd18
-rw-r--r--ld/testsuite/ld-sh/sh64/mix1.xd56
-rw-r--r--ld/testsuite/ld-sh/sh64/mix2-noexp.sd18
-rw-r--r--ld/testsuite/ld-sh/sh64/mix2.sd19
-rw-r--r--ld/testsuite/ld-sh/sh64/mix2.xd65
-rw-r--r--ld/testsuite/ld-sh/sh64/rel-1.s48
-rw-r--r--ld/testsuite/ld-sh/sh64/rel-2.s46
-rw-r--r--ld/testsuite/ld-sh/sh64/rel32.xd92
-rw-r--r--ld/testsuite/ld-sh/sh64/rel64.xd92
-rw-r--r--ld/testsuite/ld-sh/sh64/relax.exp143
-rw-r--r--ld/testsuite/ld-sh/sh64/relax1.s12
-rw-r--r--ld/testsuite/ld-sh/sh64/relax2.s3
-rw-r--r--ld/testsuite/ld-sh/sh64/relax3.s8
-rw-r--r--ld/testsuite/ld-sh/sh64/relax4.s2
-rw-r--r--ld/testsuite/ld-sh/sh64/reldl-1.s171
-rw-r--r--ld/testsuite/ld-sh/sh64/reldl-2.s156
-rw-r--r--ld/testsuite/ld-sh/sh64/reldl32.rd360
-rw-r--r--ld/testsuite/ld-sh/sh64/reldl64.rd362
-rw-r--r--ld/testsuite/ld-sh/sh64/relfail.exp162
-rw-r--r--ld/testsuite/ld-sh/sh64/relfail.s36
-rw-r--r--ld/testsuite/ld-sh/sh64/sh64-1.s20
-rw-r--r--ld/testsuite/ld-sh/sh64/sh64-2.s27
-rw-r--r--ld/testsuite/ld-sh/sh64/sh64.exp346
-rw-r--r--ld/testsuite/ld-sh/sh64/shcmp-1.s15
-rw-r--r--ld/testsuite/ld-sh/sh64/shdl-1.s359
-rw-r--r--ld/testsuite/ld-sh/sh64/shdl-2.s286
-rw-r--r--ld/testsuite/ld-sh/sh64/shdl32.xd136
-rw-r--r--ld/testsuite/ld-sh/sh64/shdl64.sd89
-rw-r--r--ld/testsuite/ld-sh/sh64/shdl64.xd136
-rw-r--r--ld/testsuite/ld-sh/sh64/shmix-1.s32
-rw-r--r--ld/testsuite/ld-sh/sh64/shmix-2.s28
-rw-r--r--ld/testsuite/ld-sh/sh64/shmix-3.s31
-rw-r--r--ld/testsuite/ld-srec/srec.exp8
-rw-r--r--ld/testsuite/ld-undefined/undefined.exp1
70 files changed, 4619 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 6a17c0b..f4a4f7f 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,167 @@
+2002-02-08 Alexandre Oliva <aoliva@redhat.com>
+
+ Contribute sh64-elf.
+ 2002-02-02 Alexandre Oliva <aoliva@redhat.com>
+ * ld-sh/sh64/crange3-cmpct.rd: Adjust offsets.
+ * ld-sh/sh64/crange3-media.rd: Likewise.
+ * ld-sh/sh64/crange3.rd: Likewise.
+ * ld-sh/sh64/crangerel1.rd: Likewise.
+ * ld-sh/sh64/crangerel2.rd: Likewise.
+ * ld-sh/sh64/reldl32.rd: Likewise.
+ * ld-sh/sh64/reldl64.rd: Likewise.
+ 2002-01-28 Alexandre Oliva <aoliva@redhat.com>
+ * ld-sh/sh64/abi32.xd: Formatting changes to match the current
+ output of objdump.
+ * ld-sh/sh64/cmpct1.xd: Likewise.
+ * ld-sh/sh64/crange1.rd: Likewise.
+ * ld-sh/sh64/crange2.rd: Likewise.
+ * ld-sh/sh64/crange3-cmpct.rd: Likewise.
+ * ld-sh/sh64/crange3-media.rd: Likewise.
+ * ld-sh/sh64/crange3.rd: Likewise.
+ * ld-sh/sh64/crangerel1.rd: Likewise.
+ * ld-sh/sh64/crangerel2.rd: Likewise.
+ * ld-sh/sh64/mix1.xd: Likewise.
+ * ld-sh/sh64/mix2.xd: Likewise.
+ * ld-sh/sh64/rel32.xd: Likewise.
+ * ld-sh/sh64/reldl32.rd: Likewise.
+ * ld-sh/sh64/reldl64.rd: Likewise.
+ * ld-sh/sh64/sh64.exp: Likewise. Reordered cranges and stack
+ sessions, to match changes in the linker script.
+ 2001-06-14 Alexandre Oliva <aoliva@redhat.com>
+ * ld-sh/sh64/reldl32.rd, ld-sh/sh64/reldl64.rd: Adjust relocation
+ info to reflect renumbering of relocation types.
+ 2001-03-14 DJ Delorie <dj@redhat.com>
+ * ld-sh/sh64/endian.dbd: New file, endian tests.
+ * ld-sh/sh64/endian.dld: Ditto.
+ * ld-sh/sh64/endian.ld: Ditto.
+ * ld-sh/sh64/endian.s: Ditto.
+ * ld-sh/sh64/endian.sbd: Ditto.
+ * ld-sh/sh64/endian.sld: Ditto.
+ * ld-sh/sh64/sh64.exp: Add above tests. Add -L option to ld.
+ 2001-03-12 DJ Delorie <dj@redhat.com>
+ * ld-sh/sh64/relax.exp: New file, test disabling relaxing.
+ * ld-sh/sh64/relax1.s: Ditto.
+ * ld-sh/sh64/relax2.s: Ditto.
+ * ld-sh/sh64/relax3.s: Ditto.
+ * ld-sh/sh64/relax4.s: Ditto.
+ * ld-sh/sh64/relfail.exp: New file, test for bogus relocs.
+ * ld-sh/sh64/relfail.s: Ditto.
+ 2001-03-12 DJ Delorie <dj@redhat.com>
+ * ld-sh/sh.exp: This test isn't appropriate for SH64 since it
+ uses SH32 assembler files.
+ 2001-03-07 DJ Delorie <dj@redhat.com>
+ * ld-selective/selective.exp: Pass "-e _start" for sh64 to
+ accomodate expected start symbol in test.
+ 2001-03-06 DJ Delorie <dj@redhat.com>
+ * ld-scripts/crossref.exp: Pass -mshelf32 to the linker for sh64,
+ to match what gcc passes to the linker by default.
+ * ld-selective/selective.exp: Ditto.
+ * ld-srec/srec.exp: Ditto, plus XFAIL for sh64.
+ * ld-undefined/undefined.exp: Add XFAIL for sh64 (it's dwarf2).
+ 2001-03-06 DJ Delorie <dj@redhat.com>
+ * ld-sh/sh64/abi32.xd (stack): Adjust for new default stack layout.
+ * ld-sh/sh64/abi64.xd (stack): Ditto.
+ * ld-sh/sh64/cmpct1.xd (stack): Ditto.
+ * ld-sh/sh64/crange1.rd (stack): Ditto.
+ * ld-sh/sh64/crange2.rd (stack): Ditto.
+ * ld-sh/sh64/crange3-cmpct.rd (stack): Ditto.
+ * ld-sh/sh64/crange3-media.rd (stack): Ditto.
+ * ld-sh/sh64/crange3.rd (stack): Ditto.
+ * ld-sh/sh64/mix1.xd (stack): Ditto.
+ * ld-sh/sh64/mix2.xd (stack): Ditto.
+ * ld-sh/sh64/shdl32.xd (stack): Ditto.
+ * ld-sh/sh64/shdl64.xd (stack): Ditto.
+ 2001-01-14 Hans-Peter Nilsson <hpn@cygnus.com>
+ * ld-sh/sh64/mix1.xd: Add SORT_ENTRIES for .cranges section.
+ * ld-sh/sh64/mix2.xd: Ditto.
+ 2001-01-08 Hans-Peter Nilsson <hpn@cygnus.com>
+ * ld-sh/sh64/abi32.xd: Adjust for bit 0 set on an entry address
+ being SHmedia.
+ * ld-sh/sh64/shdl64.xd: Ditto.
+ * ld-sh/sh64/shdl32.xd: Ditto.
+ * ld-sh/sh64/mix2.xd: Ditto.
+ * ld-sh/sh64/crange3-media.rd: Ditto.
+ * ld-sh/sh64/abi64.xd: Ditto.
+ 2001-01-06 Hans-Peter Nilsson <hpn@cygnus.com>
+ * ld-sh/sh64/crange-2a.s (diversion2): New global symbol.
+ * ld-sh/sh64/crange1.rd: Adjust to presence of new symbol.
+ Adjust section type for .cranges; expect sorted contents.
+ * ld-sh/sh64/crange2.rd: Ditto.
+ * ld-sh/sh64/crange3.dd, ld-sh/sh64/crange3.rd: Ditto.
+ * ld-sh/sh64/crangerel1.rd: Adjust to presence of new symbol.
+ * ld-sh/sh64/crangerel2.rd: Ditto.
+ * ld-sh/sh64/mix1.xd: Adjust to DEBUGGING being set for .cranges.
+ * ld-sh/sh64/mix2.xd: Ditto.
+ * ld-sh/sh64/crange3-cmpct.rd, ld-sh/sh64/crange3-media.rd: New
+ tests.
+ * ld-sh/sh64/sh64.exp: Tweak test message. Run new tests.
+ 2001-01-05 Hans-Peter Nilsson <hpn@cygnus.com>
+ * ld-sh/sh64/shmix-1.s (start2): Add a NOP to provide a valid
+ target for (unexpanded) PTB. Add an .align 2 to SHmedia code to
+ keep properly aligned.
+ * ld-sh/sh64/mix1.sd, ld-sh/sh64/mix1.xd: Adjust accordingly.
+ * ld-sh/sh64/mix1-noexp.sd, ld-sh/sh64/mix2-noexp.sd,
+ ld-sh/sh64/abixx-noexp.sd: New tests for GAS -no-expand and
+ R_SH_PT_16 relocation.
+ * ld-sh/sh64/sh64.exp: Run new tests.
+ 2000-12-30 Hans-Peter Nilsson <hpn@cygnus.com>
+ * ld-sh/sh64/crange-2f.s, ld-sh/sh64/crange-2g.s,
+ ld-sh/sh64/crange-2h.s, ld-sh/sh64/crange-2i.s,
+ ld-sh/sh64/crange3.dd, ld-sh/sh64/crange3.rd: New tests.
+ * ld-sh/sh64/sh64.exp: Run new tests.
+ * ld-sh/sh64/crange1.rd: Correct section flags.
+ * ld-sh/sh64/crange2.rd: Ditto.
+ * ld-sh/sh64/crangerel1.rd: Ditto.
+ 2000-12-18 Hans-Peter Nilsson <hpn@cygnus.com>
+ * ld-sh/sh64/crange-1.s, ld-sh/sh64/crange-2a.s,
+ ld-sh/sh64/crange-2b.s, ld-sh/sh64/crange-2c.s,
+ ld-sh/sh64/crange-2d.s, ld-sh/sh64/crange-2e.s,
+ ld-sh/sh64/crange1.rd, ld-sh/sh64/crange2.rd,
+ ld-sh/sh64/crangerel1.rd, ld-sh/sh64/crangerel2.rd: New tests for
+ handling .cranges section.
+ * ld-sh/sh64/sh64.exp: Run new tests.
+ * ld-sh/sh64/mix1.sd, ld-sh/sh64/mix1.xd, ld-sh/sh64/mix2.sd,
+ ld-sh/sh64/mix2.xd: Adjust for .cranges section.
+ 2000-12-15 Hans-Peter Nilsson <hpn@cygnus.com>
+ * ld-sh/sh64/abi32.sd, ld-sh/sh64/abi32.xd, ld-sh/sh64/abi64.sd,
+ ld-sh/sh64/abi64.xd, ld-sh/sh64/cmpct1.xd, ld-sh/sh64/mix1.sd,
+ ld-sh/sh64/mix1.xd, ld-sh/sh64/mix2.sd, ld-sh/sh64/mix2.xd,
+ ld-sh/sh64/shdl32.xd, ld-sh/sh64/shdl64.xd: Adjust to .bss and
+ .data individually 8-byte aligned.
+ 2000-12-09 Hans-Peter Nilsson <hpn@cygnus.com>
+ * ld-sh/sh64/rel-1.s, ld-sh/sh64/rel-2.s, ld-sh/sh64/rel32.xd,
+ ld-sh/sh64/rel64.xd, ld-sh/sh64/reldl-1.s, ld-sh/sh64/reldl-2.s,
+ ld-sh/sh64/reldl32.rd, ld-sh/sh64/reldl64.rd: New tests.
+ * ld-sh/sh64/sh64.exp: Make it possible to use readelf as
+ inspection tool. Run new tests.
+ 2000-12-07 Hans-Peter Nilsson <hpn@cygnus.com>
+ * ld-sh/sh64/abi64.sd, ld-sh/sh64/abi32.sd, ld-sh/sh64/mix1.sd,
+ ld-sh/sh64/mix2.sd: Correct offsets in PT/PTA/PTB expansions.
+ * ld-sh/sh64/shdl-1.s, ld-sh/sh64/shdl-2.s, ld-sh/sh64/shdl64.sd,
+ ld-sh/sh64/shdl64.xd, ld-sh/sh64/shdl32.xd: New tests.
+ * ld-sh/sh64/sh64.exp: Run new tests.
+ 2000-12-01 Hans-Peter Nilsson <hpn@cygnus.com>
+ * ld-sh/sh64/cmpct1.sd, ld-sh/sh64/cmpct1.xd,
+ ld-sh/sh64/shcmp-1.s: New test.
+ * ld-sh/sh64/sh64.exp: Add new test to sh64tests. Reformat.
+ 2000-11-30 Hans-Peter Nilsson <hpn@cygnus.com>
+ * ld-sh/sh64/sh64.exp: Use linker option -mshelf64 for 64-bit ABI
+ test.
+ * ld-sh/sh64/abi64.xd: Tweak for 64-bit ELF.
+ 2000-11-29 Hans-Peter Nilsson <hpn@cygnus.com>
+ * ld-sh/sh64/sh64.exp (sh64tests): Use linker option -mshelf32 for
+ tests.
+ 2000-11-27 Hans-Peter Nilsson <hpn@cygnus.com>
+ * ld-sh/sh64/abi32.sd, ld-sh/sh64/abi64.sd: Correct MOVI
+ registers.
+ * ld-sh/sh64/mix1.sd, ld-sh/sh64/mix1.xd, ld-sh/sh64/shmix-1.s:
+ New test.
+ * ld-sh/sh64/mix2.sd, ld-sh/sh64/mix2.xd, ld-sh/sh64/shmix-2.s,
+ ld-sh/sh64/shmix-3.s: New test.
+ * ld-sh/sh64/sh64.exp: Add new tests to sh64tests.
+ 2000-11-26 Hans-Peter Nilsson <hpn@cygnus.com>
+ * ld-sh/sh64: New testsuite.
+
2002-02-07 Hans-Peter Nilsson <hp@axis.com>
* ld-selective/keepdot.s: Remove section specifier.
diff --git a/ld/testsuite/ld-scripts/crossref.exp b/ld/testsuite/ld-scripts/crossref.exp
index da5d7ba..fbc3151 100644
--- a/ld/testsuite/ld-scripts/crossref.exp
+++ b/ld/testsuite/ld-scripts/crossref.exp
@@ -42,6 +42,11 @@ if [istarget a29k*-*-*] {
set flags "$flags --defsym V_SPILL=0 --defsym V_FILL=0"
}
+if [istarget sh64*-*-elf] {
+ # This is what gcc passes to ld by default.
+ set flags "-mshelf32"
+}
+
verbose -log "$ld $flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o"
catch "exec $ld $flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o" exec_output
diff --git a/ld/testsuite/ld-selective/selective.exp b/ld/testsuite/ld-selective/selective.exp
index b4bc2ec..bdea212 100644
--- a/ld/testsuite/ld-selective/selective.exp
+++ b/ld/testsuite/ld-selective/selective.exp
@@ -56,6 +56,13 @@ set cflags "-w -O -ffunction-sections -fdata-sections"
set cxxflags "-fvtable-gc -fno-exceptions -fno-rtti"
set ldflags "--gc-sections -Bstatic"
+if [istarget sh64*-*-elf] {
+ # This is what gcc passes to ld by default, plus switch to the
+ # "usual" ELF _start (shelf32 normally uses just `start' for COFF
+ # compatibility)
+ set ldflags "-e _start -mshelf32 $ldflags"
+}
+
# If we don't have g++ for the target, mark all tests as untested.
if { [which $CXX] == 0 } {
foreach testitem $seltests {
diff --git a/ld/testsuite/ld-sh/sh.exp b/ld/testsuite/ld-sh/sh.exp
index e297860..38b6e73 100644
--- a/ld/testsuite/ld-sh/sh.exp
+++ b/ld/testsuite/ld-sh/sh.exp
@@ -25,6 +25,11 @@ if ![istarget sh*-*-*] {
return
}
+if [istarget sh64-*-elf] {
+ # relaxing not supported on sh64 yet.
+ return
+}
+
set testsimple "SH simple relaxing"
if ![ld_assemble $as "-relax $srcdir/$subdir/sh1.s" tmpdir/sh1.o] {
diff --git a/ld/testsuite/ld-sh/sh64/abi32.sd b/ld/testsuite/ld-sh/sh64/abi32.sd
new file mode 100644
index 0000000..7baeda6
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/abi32.sd
@@ -0,0 +1,18 @@
+
+.*: file format .*-sh64
+
+Contents of section \.text:
+ 1000 cc000190 c8015590 6bf56630 6ff0fff0 .*
+ 1010 cc000210 c8400610 cc000150 c8403550 .*
+ 1020 cffffd90 cbff9590 6bf56630 cc0002b0 .*
+ 1030 c843e2b0 cc000350 c843c350 cc000040 .*
+ 1040 c843f040 cc000190 c8004590 6bf56650 .*
+ 1050 cc000190 c8002590 6bf56410 6ff0fff0 .*
+ 1060 6ff0fff0 .*
+Contents of section \.data:
+ 10e8 000010f4 0000100d 0000105d 000010e8 .*
+ 10f8 000010e8 0000100d .*
+Contents of section \.ctors:
+Contents of section \.dtors:
+Contents of section \.sbss:
+Contents of section \.stack:
diff --git a/ld/testsuite/ld-sh/sh64/abi32.xd b/ld/testsuite/ld-sh/sh64/abi32.xd
new file mode 100644
index 0000000..bd918ff
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/abi32.xd
@@ -0,0 +1,58 @@
+
+.*: file format .*-sh64
+.*
+architecture: sh5, flags 0x00000112:
+EXEC_P, HAS_SYMS, D_PAGED
+start address 0x0+1011
+
+Program Header:
+ LOAD off 0x0+80 vaddr 0x0+1000 paddr 0x0+1000 align 2\*\*7
+ filesz 0x0+64 memsz 0x0+64 flags r-x
+ LOAD off 0x0+e8 vaddr 0x0+10e8 paddr 0x0+10e8 align 2\*\*7
+ filesz 0x0+18 memsz 0x0+18 flags rw-
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 00000064 0+1000 0+1000 00000080 2\*\*0
+ CONTENTS, ALLOC, LOAD, READONLY, CODE
+ 1 \.data 00000018 0+10e8 0+10e8 000000e8 2\*\*0
+ CONTENTS, ALLOC, LOAD, DATA
+ 2 \.ctors 00000000 0+1100 0+1100 00000100 2\*\*0
+ CONTENTS
+ 3 \.dtors 00000000 0+1100 0+1100 00000100 2\*\*0
+ CONTENTS
+ 4 \.sbss 00000000 0+1100 0+1100 00000100 2\*\*0
+ CONTENTS
+ 5 \.bss 00000000 0+1100 0+1100 00000100 2\*\*0
+ ALLOC
+ 6 \.stack 00000000 0+80000 0+80000 00000100 2\*\*0
+ CONTENTS
+SYMBOL TABLE:
+0+1000 l d \.text 0+
+0+10e8 l d \.data 0+
+0+1100 l d \.ctors 0+
+0+1100 l d \.dtors 0+
+0+1100 l d \.sbss 0+
+0+1100 l d \.bss 0+
+0+80000 l d \.stack 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+10f4 l \.data 0+ foobar
+0+10fc l \.data 0+ foobar2
+0+1060 l \.text 0+ 0x04 plugh
+0+10f8 g \.data 0+ foobar
+0+10e8 g \.data 0+ baz
+0+1100 g O \.dtors 0+ ___dtors
+0+105c g \.text 0+ 0x04 xyzzy
+0+1100 g O \*ABS\* 0+ __bss_start
+0+1100 g O \.ctors 0+ ___ctors_end
+0+10f0 g \.data 0+ baz2
+0+1100 g O \.ctors 0+ ___ctors
+0+1000 g \.text 0+ 0x04 foo
+0+1100 g O \*ABS\* 0+ _edata
+0+1100 g O \*ABS\* 0+ _end
+0+1010 g \.text 0+ 0x04 start
+0+100c g \.text 0+ 0x04 bar
+0+80000 g O \.stack 0+ _stack
+0+1100 g O \.dtors 0+ ___dtors_end
diff --git a/ld/testsuite/ld-sh/sh64/abi64.sd b/ld/testsuite/ld-sh/sh64/abi64.sd
new file mode 100644
index 0000000..fcbbf19
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/abi64.sd
@@ -0,0 +1,22 @@
+
+.*: file format .*-sh64
+
+Contents of section \.text:
+ 1000 cc000190 c8000190 c8000190 c8025590 .*
+ 1010 6bf56630 6ff0fff0 cc000210 c8000210 .*
+ 1020 c8000210 c8400610 cc000150 c8000150 .*
+ 1030 c8000150 c8405550 cffffd90 cbfffd90 .*
+ 1040 cbfffd90 cbff3590 6bf56630 cc0002b0 .*
+ 1050 c80002b0 c80002b0 c84502b0 cc000350 .*
+ 1060 c8000350 c8000350 c844e350 cc000040 .*
+ 1070 c8000040 c8000040 c8451040 cc000190 .*
+ 1080 c8000190 c8000190 c8006590 6bf56650 .*
+ 1090 cc000190 c8000190 c8000190 c8002590 .*
+ 10a0 6bf56410 6ff0fff0 6ff0fff0 .*
+Contents of section \.data:
+ 1130 0000113c 00001015 000010a5 00001130 .*
+ 1140 00001130 00001015 .*
+Contents of section \.ctors:
+Contents of section \.dtors:
+Contents of section \.sbss:
+Contents of section \.stack:
diff --git a/ld/testsuite/ld-sh/sh64/abi64.xd b/ld/testsuite/ld-sh/sh64/abi64.xd
new file mode 100644
index 0000000..1b9e904
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/abi64.xd
@@ -0,0 +1,57 @@
+.*: file format .*-sh64
+.*
+architecture: sh5, flags 0x00000112:
+EXEC_P, HAS_SYMS, D_PAGED
+start address 0x0000000000001019
+
+Program Header:
+ LOAD off 0x0000000000000100 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2\*\*7
+ filesz 0x00000000000000ac memsz 0x00000000000000ac flags r-x
+ LOAD off 0x00000000000001b0 vaddr 0x0000000000001130 paddr 0x0000000000001130 align 2\*\*7
+ filesz 0x0000000000000018 memsz 0x0000000000000018 flags rw-
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 000000ac 0000000000001000 0000000000001000 00000100 2\*\*0
+ CONTENTS, ALLOC, LOAD, READONLY, CODE
+ 1 \.data 00000018 0000000000001130 0000000000001130 000001b0 2\*\*0
+ CONTENTS, ALLOC, LOAD, DATA
+ 2 \.ctors 00000000 0000000000001148 0000000000001148 000001c8 2\*\*0
+ CONTENTS
+ 3 \.dtors 00000000 0000000000001148 0000000000001148 000001c8 2\*\*0
+ CONTENTS
+ 4 \.sbss 00000000 0000000000001148 0000000000001148 000001c8 2\*\*0
+ CONTENTS
+ 5 \.bss 00000000 0000000000001148 0000000000001148 000001c8 2\*\*0
+ ALLOC
+ 6 \.stack 00000000 0000000000080000 0000000000080000 000001c8 2\*\*0
+ CONTENTS
+SYMBOL TABLE:
+0000000000001000 l d \.text 0000000000000000
+0000000000001130 l d \.data 0000000000000000
+0000000000001148 l d \.ctors 0000000000000000
+0000000000001148 l d \.dtors 0000000000000000
+0000000000001148 l d \.sbss 0000000000000000
+0000000000001148 l d \.bss 0000000000000000
+0000000000080000 l d \.stack 0000000000000000
+0000000000000000 l d \*ABS\* 0000000000000000
+0000000000000000 l d \*ABS\* 0000000000000000
+0000000000000000 l d \*ABS\* 0000000000000000
+000000000000113c l \.data 0000000000000000 foobar
+0000000000001144 l \.data 0000000000000000 foobar2
+00000000000010a8 l \.text 0000000000000000 0x04 plugh
+0000000000001140 g \.data 0000000000000000 foobar
+0000000000001130 g \.data 0000000000000000 baz
+0000000000001148 g O \.dtors 0000000000000000 ___dtors
+00000000000010a4 g \.text 0000000000000000 0x04 xyzzy
+0000000000001148 g O \*ABS\* 0000000000000000 __bss_start
+0000000000001148 g O \.ctors 0000000000000000 ___ctors_end
+0000000000001138 g \.data 0000000000000000 baz2
+0000000000001148 g O \.ctors 0000000000000000 ___ctors
+0000000000001000 g \.text 0000000000000000 0x04 foo
+0000000000001148 g O \*ABS\* 0000000000000000 _edata
+0000000000001148 g O \*ABS\* 0000000000000000 _end
+0000000000001018 g \.text 0000000000000000 0x04 start
+0000000000001014 g \.text 0000000000000000 0x04 bar
+0000000000080000 g O \.stack 0000000000000000 _stack
+0000000000001148 g O \.dtors 0000000000000000 ___dtors_end
diff --git a/ld/testsuite/ld-sh/sh64/abixx-noexp.sd b/ld/testsuite/ld-sh/sh64/abixx-noexp.sd
new file mode 100644
index 0000000..b826471
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/abixx-noexp.sd
@@ -0,0 +1,14 @@
+
+.*: file format .*-sh64
+
+Contents of section \.text:
+ 1000 e8002a30 6ff0fff0 cc400610 cc401550 .*
+ 1010 ebfff630 cc4302b0 cc42e350 cc431040 .*
+ 1020 e8000a50 e8000810 6ff0fff0 6ff0fff0 .*
+Contents of section \.data:
+ 10b0 000010bc 00001005 00001029 000010b0 .*
+ 10c0 000010b0 00001005 .*
+Contents of section \.ctors:
+Contents of section \.dtors:
+Contents of section \.sbss:
+Contents of section \.stack:
diff --git a/ld/testsuite/ld-sh/sh64/cmpct1.sd b/ld/testsuite/ld-sh/sh64/cmpct1.sd
new file mode 100644
index 0000000..ab6dfb9
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/cmpct1.sd
@@ -0,0 +1,12 @@
+
+tmpdir/linked: file format elf32-sh64
+
+Contents of section \.text:
+ 1000 c7000009 0009ea2a .*
+Contents of section \.rodata:
+ 1008 00001000 0000100c 00001004 .*
+Contents of section \.data:
+Contents of section \.ctors:
+Contents of section \.dtors:
+Contents of section \.sbss:
+Contents of section \.stack:
diff --git a/ld/testsuite/ld-sh/sh64/cmpct1.xd b/ld/testsuite/ld-sh/sh64/cmpct1.xd
new file mode 100644
index 0000000..296aebd
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/cmpct1.xd
@@ -0,0 +1,55 @@
+
+.*: file format .*-sh64
+.*
+architecture: sh5, flags 0x00000112:
+EXEC_P, HAS_SYMS, D_PAGED
+start address 0x0+1000
+
+Program Header:
+ LOAD off 0x0+80 vaddr 0x0+1000 paddr 0x0+1000 align 2\*\*7
+ filesz 0x0+14 memsz 0x0+14 flags r-x
+ LOAD off 0x0+98 vaddr 0x0+1098 paddr 0x0+1098 align 2\*\*7
+ filesz 0x0+ memsz 0x0+ flags rw-
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 00000008 0+1000 0+1000 00000080 2\*\*0
+ CONTENTS, ALLOC, LOAD, READONLY, CODE
+ 1 \.rodata 0000000c 0+1008 0+1008 00000088 2\*\*0
+ CONTENTS, ALLOC, LOAD, READONLY, DATA
+ 2 \.data 00000000 0+1098 0+1098 00000098 2\*\*0
+ CONTENTS, ALLOC, LOAD, DATA
+ 3 \.ctors 00000000 0+1098 0+1098 00000098 2\*\*0
+ CONTENTS
+ 4 \.dtors 00000000 0+1098 0+1098 00000098 2\*\*0
+ CONTENTS
+ 5 \.sbss 00000000 0+1098 0+1098 00000098 2\*\*0
+ CONTENTS
+ 6 \.bss 00000000 0+1098 0+1098 00000098 2\*\*0
+ ALLOC
+ 7 \.stack 00000000 0+80000 0+80000 00000098 2\*\*0
+ CONTENTS
+SYMBOL TABLE:
+0+1000 l d \.text 0+
+0+1008 l d \.rodata 0+
+0+1098 l d \.data 0+
+0+1098 l d \.ctors 0+
+0+1098 l d \.dtors 0+
+0+1098 l d \.sbss 0+
+0+1098 l d \.bss 0+
+0+80000 l d \.stack 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+1004 l \.text 0+ next
+0+100c l \.rodata 0+ here
+0+ l \*ABS\* 0+ \*ABS\*
+0+1098 g O \.dtors 0+ ___dtors
+0+1098 g O \*ABS\* 0+ __bss_start
+0+1098 g O \.ctors 0+ ___ctors_end
+0+1098 g O \.ctors 0+ ___ctors
+0+1098 g O \*ABS\* 0+ _edata
+0+1098 g O \*ABS\* 0+ _end
+0+1000 g \.text 0+ start
+0+80000 g O \.stack 0+ _stack
+0+1098 g O \.dtors 0+ ___dtors_end
diff --git a/ld/testsuite/ld-sh/sh64/crange-1.s b/ld/testsuite/ld-sh/sh64/crange-1.s
new file mode 100644
index 0000000..5dfae88
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crange-1.s
@@ -0,0 +1,8 @@
+! Support file for .cranges tests to resolve all references for
+! non-partial-link tests.
+ .section .init,"ax"
+ .mode SHmedia
+ .global start
+ .align 2
+start:
+ nop
diff --git a/ld/testsuite/ld-sh/sh64/crange-2a.s b/ld/testsuite/ld-sh/sh64/crange-2a.s
new file mode 100644
index 0000000..9af6bbe
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crange-2a.s
@@ -0,0 +1,22 @@
+! Simple example with assembler-generated .cranges that do not need more
+! .cranges added by the linker: A single section with SHmedia, constants
+! and SHcompact.
+ .section .text.mixed,"ax"
+ .align 2
+! Make sure this symbol does not have the expected type.
+ .mode SHcompact
+ .global diversion2
+diversion2:
+
+ .mode SHmedia
+start2:
+ nop
+ nop
+ nop
+
+ .long 42
+ .long 43
+
+ .mode SHcompact
+ nop
+ nop
diff --git a/ld/testsuite/ld-sh/sh64/crange-2b.s b/ld/testsuite/ld-sh/sh64/crange-2b.s
new file mode 100644
index 0000000..670a448
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crange-2b.s
@@ -0,0 +1,39 @@
+! Initially three separate sections, one with SHmedia and constants, one with
+! SHcompact, and yet another with SHmedia. Two .cranges sections
+! generated by the assembler; two more needed at link time, as they will be
+! consolidated into the same section, and mixed with a file with
+! assembler-generated .cranges only and one without any .cranges.
+
+ .section .text.shmedia,"ax"
+ .mode SHmedia
+ .align 2
+sec1:
+ nop
+ nop
+ nop
+ nop
+sec2:
+ .long 41
+ .long 43
+ .long 42
+ .long 43
+ .long 42
+
+ .section .text.shcompact,"ax"
+ .align 1
+ .mode SHcompact
+sec3:
+ nop
+ nop
+ nop
+
+ .section .text.shmedia2,"ax"
+ .align 2
+sec4:
+ .mode SHmedia
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
diff --git a/ld/testsuite/ld-sh/sh64/crange-2c.s b/ld/testsuite/ld-sh/sh64/crange-2c.s
new file mode 100644
index 0000000..fcc350d
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crange-2c.s
@@ -0,0 +1,16 @@
+! First part of crange-2b.s, but in section .text.mixed.
+
+ .section .text.mixed,"ax"
+ .mode SHmedia
+ .align 2
+sec1:
+ nop
+ nop
+ nop
+ nop
+sec2:
+ .long 41
+ .long 43
+ .long 42
+ .long 43
+ .long 42
diff --git a/ld/testsuite/ld-sh/sh64/crange-2d.s b/ld/testsuite/ld-sh/sh64/crange-2d.s
new file mode 100644
index 0000000..11f3d5b
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crange-2d.s
@@ -0,0 +1,9 @@
+! Second part of crange-2b.s, but in section .text.mixed.
+
+ .section .text.mixed,"ax"
+ .align 1
+ .mode SHcompact
+sec3:
+ nop
+ nop
+ nop
diff --git a/ld/testsuite/ld-sh/sh64/crange-2e.s b/ld/testsuite/ld-sh/sh64/crange-2e.s
new file mode 100644
index 0000000..3d7c997
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crange-2e.s
@@ -0,0 +1,12 @@
+! Third part of crange-2b.s, but in section .text.mixed.
+
+ .section .text.mixed,"ax"
+ .align 2
+sec4:
+ .mode SHmedia
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
diff --git a/ld/testsuite/ld-sh/sh64/crange-2f.s b/ld/testsuite/ld-sh/sh64/crange-2f.s
new file mode 100644
index 0000000..a8479c9
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crange-2f.s
@@ -0,0 +1,21 @@
+! Section with SHmedia in unique section. Note the absence of a symbol to
+! key an ISA type.
+
+ .section .text.2f,"ax"
+ .align 2
+
+ .mode SHmedia
+ movi 0x2f,r20
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ movi 0x2f,r21
diff --git a/ld/testsuite/ld-sh/sh64/crange-2g.s b/ld/testsuite/ld-sh/sh64/crange-2g.s
new file mode 100644
index 0000000..ac7aacb
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crange-2g.s
@@ -0,0 +1,26 @@
+! Section with SHmedia in unique section, similar to crange-2f.s
+
+ .section .text.2g,"ax"
+ .align 2
+
+ .mode SHmedia
+ movi 0x21,r12
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ movi 0x21,r13
diff --git a/ld/testsuite/ld-sh/sh64/crange-2h.s b/ld/testsuite/ld-sh/sh64/crange-2h.s
new file mode 100644
index 0000000..99c6146
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crange-2h.s
@@ -0,0 +1,17 @@
+! SHcompact in .text, similar to crange-2f.s and crange-2g.s
+ .section .text,"ax"
+ .align 2
+
+ .mode SHcompact
+ mov #0xf,r1
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ mov #0xe,r1
diff --git a/ld/testsuite/ld-sh/sh64/crange-2i.s b/ld/testsuite/ld-sh/sh64/crange-2i.s
new file mode 100644
index 0000000..6bf9747
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crange-2i.s
@@ -0,0 +1,7 @@
+! If this file comes before a file with a SHcompact .text section but with
+! no symbols, we will have a symbol of the "wrong kind" before the
+! SHcompact insns.
+ .section .text,"ax"
+ .mode SHmedia
+ .global diversion
+diversion:
diff --git a/ld/testsuite/ld-sh/sh64/crange1.rd b/ld/testsuite/ld-sh/sh64/crange1.rd
new file mode 100644
index 0000000..3824a78
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crange1.rd
@@ -0,0 +1,61 @@
+There are 13 section headers, starting at offset 0x114:
+
+Section Headers:
+ \[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
+ \[ 0\] NULL 00000000 000000 000000 00 0 0 0
+ \[ 1\] \.init PROGBITS 00001000 000080 000004 00 AXp 0 0 4
+ \[ 2\] \.text PROGBITS 00001004 000084 000018 00 AXp 0 0 4
+ \[ 3\] \.data PROGBITS 000010a0 0000a0 000000 00 WA 0 0 1
+ \[ 4\] \.ctors PROGBITS 000010a0 0000a0 000000 00 W 0 0 1
+ \[ 5\] \.dtors PROGBITS 000010a0 0000a0 000000 00 W 0 0 1
+ \[ 6\] \.sbss PROGBITS 000010a0 0000a0 000000 00 W 0 0 1
+ \[ 7\] \.bss NOBITS 000010a0 0000a0 000000 00 WA 0 0 1
+ \[ 8\] \.stack PROGBITS 00080000 0000a0 000000 00 W 0 0 1
+ \[ 9\] \.cranges LOUSER\+1 00000000 0000a0 00001e 00 W 0 0 1
+ \[10\] \.shstrtab STRTAB 00000000 0000be 000056 00 0 0 1
+ \[11\] \.symtab SYMTAB 00000000 00031c 000180 10 12 e 4
+ \[12\] \.strtab STRTAB 00000000 00049c 000064 00 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+ I \(info\), L \(link order\), G \(group\), x \(unknown\)
+ O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)
+
+There are no relocations in this file\.
+
+Symbol table '\.symtab' contains 24 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 00001000 0 SECTION LOCAL DEFAULT 1
+ 2: 00001004 0 SECTION LOCAL DEFAULT 2
+ 3: 000010a0 0 SECTION LOCAL DEFAULT 3
+ 4: 000010a0 0 SECTION LOCAL DEFAULT 4
+ 5: 000010a0 0 SECTION LOCAL DEFAULT 5
+ 6: 000010a0 0 SECTION LOCAL DEFAULT 6
+ 7: 000010a0 0 SECTION LOCAL DEFAULT 7
+ 8: 00080000 0 SECTION LOCAL DEFAULT 8
+ 9: 00000000 0 SECTION LOCAL DEFAULT 9
+ 10: 00000000 0 SECTION LOCAL DEFAULT 10
+ 11: 00000000 0 SECTION LOCAL DEFAULT 11
+ 12: 00000000 0 SECTION LOCAL DEFAULT 12
+ 13: 00001004 0 NOTYPE LOCAL DEFAULT 2 start2
+ 14: 000010a0 0 OBJECT GLOBAL DEFAULT 5 ___dtors
+ 15: 000010a0 0 OBJECT GLOBAL DEFAULT ABS __bss_start
+ 16: 000010a0 0 OBJECT GLOBAL DEFAULT 4 ___ctors_end
+ 17: 00001004 0 NOTYPE GLOBAL DEFAULT 2 diversion2
+ 18: 000010a0 0 OBJECT GLOBAL DEFAULT 4 ___ctors
+ 19: 000010a0 0 OBJECT GLOBAL DEFAULT ABS _edata
+ 20: 000010a0 0 OBJECT GLOBAL DEFAULT ABS _end
+ 21: 00001000 0 NOTYPE GLOBAL DEFAULT 1 start
+ 22: 00080000 0 OBJECT GLOBAL DEFAULT 8 _stack
+ 23: 000010a0 0 OBJECT GLOBAL DEFAULT 5 ___dtors_end
+
+Hex dump of section '\.init':
+ 0x00001000 6ff0fff0 .*
+
+Hex dump of section '\.text':
+ 0x00001004 6ff0fff0 6ff0fff0 6ff0fff0 0000002a .*
+ 0x00001014 0000002b 00090009 .*
+
+Hex dump of section '\.cranges':
+ 0x00000000 00001004 0000000c 00030000 10100000 .*
+ 0x00000010 00080001 00001018 00000004 0002 .*
diff --git a/ld/testsuite/ld-sh/sh64/crange2.rd b/ld/testsuite/ld-sh/sh64/crange2.rd
new file mode 100644
index 0000000..4231780
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crange2.rd
@@ -0,0 +1,69 @@
+There are 13 section headers, starting at offset 0x17c:
+
+Section Headers:
+ \[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
+ \[ 0\] NULL 00000000 000000 000000 00 0 0 0
+ \[ 1\] \.init PROGBITS 00001000 000080 000004 00 AXp 0 0 4
+ \[ 2\] \.text PROGBITS 00001004 000084 00005c 00 AXp 0 0 4
+ \[ 3\] \.data PROGBITS 000010e0 0000e0 000000 00 WA 0 0 1
+ \[ 4\] \.ctors PROGBITS 000010e0 0000e0 000000 00 W 0 0 1
+ \[ 5\] \.dtors PROGBITS 000010e0 0000e0 000000 00 W 0 0 1
+ \[ 6\] \.sbss PROGBITS 000010e0 0000e0 000000 00 W 0 0 1
+ \[ 7\] \.bss NOBITS 000010e0 0000e0 000000 00 WA 0 0 1
+ \[ 8\] \.stack PROGBITS 00080000 0000e0 000000 00 W 0 0 1
+ \[ 9\] \.cranges LOUSER\+1 00000000 0000e0 000046 00 W 0 0 1
+ \[10\] \.shstrtab STRTAB 00000000 000126 000056 00 0 0 1
+ \[11\] \.symtab SYMTAB 00000000 000384 0001c0 10 12 12 4
+ \[12\] \.strtab STRTAB 00000000 000544 000078 00 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+ I \(info\), L \(link order\), G \(group\), x \(unknown\)
+ O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)
+
+There are no relocations in this file\.
+
+Symbol table '\.symtab' contains 28 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 00001000 0 SECTION LOCAL DEFAULT 1
+ 2: 00001004 0 SECTION LOCAL DEFAULT 2
+ 3: 000010e0 0 SECTION LOCAL DEFAULT 3
+ 4: 000010e0 0 SECTION LOCAL DEFAULT 4
+ 5: 000010e0 0 SECTION LOCAL DEFAULT 5
+ 6: 000010e0 0 SECTION LOCAL DEFAULT 6
+ 7: 000010e0 0 SECTION LOCAL DEFAULT 7
+ 8: 00080000 0 SECTION LOCAL DEFAULT 8
+ 9: 00000000 0 SECTION LOCAL DEFAULT 9
+ 10: 00000000 0 SECTION LOCAL DEFAULT 10
+ 11: 00000000 0 SECTION LOCAL DEFAULT 11
+ 12: 00000000 0 SECTION LOCAL DEFAULT 12
+ 13: 00001004 0 NOTYPE LOCAL DEFAULT 2 start2
+ 14: 0000101c 0 NOTYPE LOCAL DEFAULT 2 sec1
+ 15: 0000102c 0 NOTYPE LOCAL DEFAULT 2 sec2
+ 16: 00001040 0 NOTYPE LOCAL DEFAULT 2 sec3
+ 17: 00001048 0 NOTYPE LOCAL DEFAULT 2 sec4
+ 18: 000010e0 0 OBJECT GLOBAL DEFAULT 5 ___dtors
+ 19: 000010e0 0 OBJECT GLOBAL DEFAULT ABS __bss_start
+ 20: 000010e0 0 OBJECT GLOBAL DEFAULT 4 ___ctors_end
+ 21: 00001004 0 NOTYPE GLOBAL DEFAULT 2 diversion2
+ 22: 000010e0 0 OBJECT GLOBAL DEFAULT 4 ___ctors
+ 23: 000010e0 0 OBJECT GLOBAL DEFAULT ABS _edata
+ 24: 000010e0 0 OBJECT GLOBAL DEFAULT ABS _end
+ 25: 00001000 0 NOTYPE GLOBAL DEFAULT 1 start
+ 26: 00080000 0 OBJECT GLOBAL DEFAULT 8 _stack
+ 27: 000010e0 0 OBJECT GLOBAL DEFAULT 5 ___dtors_end
+
+Hex dump of section '\.text':
+ 0x00001004 6ff0fff0 6ff0fff0 6ff0fff0 0000002a .*
+ 0x00001014 0000002b 00090009 6ff0fff0 6ff0fff0 .*
+ 0x00001024 6ff0fff0 6ff0fff0 00000029 0000002b .*
+ 0x00001034 0000002a 0000002b 0000002a 00090009 .*
+ 0x00001044 00090000 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001054 6ff0fff0 6ff0fff0 6ff0fff0 .*
+
+Hex dump of section '\.cranges':
+ 0x00000000 00001004 0000000c 00030000 10100000 .*
+ 0x00000010 00080001 00001018 00000004 00020000 .*
+ 0x00000020 101c0000 00100003 0000102c 00000014 .*
+ 0x00000030 00010000 10400000 00060002 00001048 .*
+ 0x00000040 00000018 0003 .*
diff --git a/ld/testsuite/ld-sh/sh64/crange3-cmpct.rd b/ld/testsuite/ld-sh/sh64/crange3-cmpct.rd
new file mode 100644
index 0000000..623d577
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crange3-cmpct.rd
@@ -0,0 +1,93 @@
+ELF Header:
+ Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
+ Class: ELF32
+ Data: 2's complement, big endian
+ Version: 1 \(current\)
+ OS/ABI: UNIX - System V
+ ABI Version: 0
+ Type: EXEC \(Executable file\)
+ Machine: Hitachi SH
+ Version: 0x1
+ Entry point address: 0x10c2
+ Start of program headers: 52 \(bytes into file\)
+ Start of section headers: 500 \(bytes into file\)
+ Flags: 0xa
+ Size of this header: 52 \(bytes\)
+ Size of program headers: 32 \(bytes\)
+ Number of program headers: 2
+ Size of section headers: 40 \(bytes\)
+ Number of section headers: 13
+ Section header string table index: 10
+
+Section Headers:
+ \[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
+ \[ 0\] NULL 00000000 000000 000000 00 0 0 0
+ \[ 1\] \.init PROGBITS 00001000 000080 000004 00 AXp 0 0 4
+ \[ 2\] \.text PROGBITS 00001004 000084 0000d8 00 AXp 0 0 4
+ \[ 3\] \.data PROGBITS 00001160 000160 000000 00 WA 0 0 1
+ \[ 4\] \.ctors PROGBITS 00001160 000160 000000 00 W 0 0 1
+ \[ 5\] \.dtors PROGBITS 00001160 000160 000000 00 W 0 0 1
+ \[ 6\] \.sbss PROGBITS 00001160 000160 000000 00 W 0 0 1
+ \[ 7\] \.bss NOBITS 00001160 000160 000000 00 WA 0 0 1
+ \[ 8\] \.stack PROGBITS 00080000 000160 000000 00 W 0 0 1
+ \[ 9\] \.cranges LOUSER\+1 00000000 000160 00003c 00 W 0 0 1
+ \[10\] \.shstrtab STRTAB 00000000 00019c 000056 00 0 0 1
+ \[11\] \.symtab SYMTAB 00000000 0003fc 0001c0 10 12 11 4
+ \[12\] \.strtab STRTAB 00000000 0005bc 00007e 00 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+ I \(info\), L \(link order\), G \(group\), x \(unknown\)
+ O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)
+
+Symbol table '\.symtab' contains 28 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 00001000 0 SECTION LOCAL DEFAULT 1
+ 2: 00001004 0 SECTION LOCAL DEFAULT 2
+ 3: 00001160 0 SECTION LOCAL DEFAULT 3
+ 4: 00001160 0 SECTION LOCAL DEFAULT 4
+ 5: 00001160 0 SECTION LOCAL DEFAULT 5
+ 6: 00001160 0 SECTION LOCAL DEFAULT 6
+ 7: 00001160 0 SECTION LOCAL DEFAULT 7
+ 8: 00080000 0 SECTION LOCAL DEFAULT 8
+ 9: 00000000 0 SECTION LOCAL DEFAULT 9
+ 10: 00000000 0 SECTION LOCAL DEFAULT 10
+ 11: 00000000 0 SECTION LOCAL DEFAULT 11
+ 12: 00000000 0 SECTION LOCAL DEFAULT 12
+ 13: 00001004 0 NOTYPE LOCAL DEFAULT 2 sec4
+ 14: 000010a4 0 NOTYPE LOCAL DEFAULT 2 start2
+ 15: 000010bc 0 NOTYPE LOCAL DEFAULT 2 sec3
+ 16: 00000000 0 NOTYPE LOCAL DEFAULT ABS \*ABS\*
+ 17: 000010c2 0 NOTYPE GLOBAL DEFAULT 2 diversion
+ 18: 00001160 0 OBJECT GLOBAL DEFAULT 5 ___dtors
+ 19: 00001160 0 OBJECT GLOBAL DEFAULT ABS __bss_start
+ 20: 00001160 0 OBJECT GLOBAL DEFAULT 4 ___ctors_end
+ 21: 000010a4 0 NOTYPE GLOBAL DEFAULT 2 diversion2
+ 22: 00001160 0 OBJECT GLOBAL DEFAULT 4 ___ctors
+ 23: 00001160 0 OBJECT GLOBAL DEFAULT ABS _edata
+ 24: 00001160 0 OBJECT GLOBAL DEFAULT ABS _end
+ 25: 00001000 0 NOTYPE GLOBAL DEFAULT 1 start
+ 26: 00080000 0 OBJECT GLOBAL DEFAULT 8 _stack
+ 27: 00001160 0 OBJECT GLOBAL DEFAULT 5 ___dtors_end
+
+Hex dump of section '\.text':
+ 0x00001004 e10f0009 00090009 00090009 00090009 .*
+ 0x00001014 00090009 0009e10e 6ff0fff0 6ff0fff0 .*
+ 0x00001024 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001034 cc00bd40 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001044 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001054 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001064 6ff0fff0 cc00bd50 cc0084c0 6ff0fff0 .*
+ 0x00001074 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001084 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001094 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x000010a4 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x000010b4 6ff0fff0 cc0084d0 6ff0fff0 6ff0fff0 .*
+ 0x000010c4 6ff0fff0 0000002a 0000002b 00090009 .*
+ 0x000010d4 00090009 0009 .*
+
+Hex dump of section '\.cranges':
+ 0x00000000 00001004 00000018 00020000 101c0000 .*
+ 0x00000010 00a00003 000010bc 0000000c 00030000 .*
+ 0x00000020 10c80000 00080001 000010d0 00000004 .*
+ 0x00000030 00020000 10d40000 00060002 .*
diff --git a/ld/testsuite/ld-sh/sh64/crange3-media.rd b/ld/testsuite/ld-sh/sh64/crange3-media.rd
new file mode 100644
index 0000000..90b5288
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crange3-media.rd
@@ -0,0 +1,93 @@
+ELF Header:
+ Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
+ Class: ELF32
+ Data: 2's complement, big endian
+ Version: 1 \(current\)
+ OS/ABI: UNIX - System V
+ ABI Version: 0
+ Type: EXEC \(Executable file\)
+ Machine: Hitachi SH
+ Version: 0x1
+ Entry point address: 0x10a5
+ Start of program headers: 52 \(bytes into file\)
+ Start of section headers: 500 \(bytes into file\)
+ Flags: 0xa
+ Size of this header: 52 \(bytes\)
+ Size of program headers: 32 \(bytes\)
+ Number of program headers: 2
+ Size of section headers: 40 \(bytes\)
+ Number of section headers: 13
+ Section header string table index: 10
+
+Section Headers:
+ \[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
+ \[ 0\] NULL 00000000 000000 000000 00 0 0 0
+ \[ 1\] \.init PROGBITS 00001000 000080 000004 00 AXp 0 0 4
+ \[ 2\] \.text PROGBITS 00001004 000084 0000d8 00 AXp 0 0 4
+ \[ 3\] \.data PROGBITS 00001160 000160 000000 00 WA 0 0 1
+ \[ 4\] \.ctors PROGBITS 00001160 000160 000000 00 W 0 0 1
+ \[ 5\] \.dtors PROGBITS 00001160 000160 000000 00 W 0 0 1
+ \[ 6\] \.sbss PROGBITS 00001160 000160 000000 00 W 0 0 1
+ \[ 7\] \.bss NOBITS 00001160 000160 000000 00 WA 0 0 1
+ \[ 8\] \.stack PROGBITS 00080000 000160 000000 00 W 0 0 1
+ \[ 9\] \.cranges LOUSER\+1 00000000 000160 00003c 00 W 0 0 1
+ \[10\] \.shstrtab STRTAB 00000000 00019c 000056 00 0 0 1
+ \[11\] \.symtab SYMTAB 00000000 0003fc 0001c0 10 12 11 4
+ \[12\] \.strtab STRTAB 00000000 0005bc 00007e 00 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+ I \(info\), L \(link order\), G \(group\), x \(unknown\)
+ O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)
+
+Symbol table '\.symtab' contains 28 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 00001000 0 SECTION LOCAL DEFAULT 1
+ 2: 00001004 0 SECTION LOCAL DEFAULT 2
+ 3: 00001160 0 SECTION LOCAL DEFAULT 3
+ 4: 00001160 0 SECTION LOCAL DEFAULT 4
+ 5: 00001160 0 SECTION LOCAL DEFAULT 5
+ 6: 00001160 0 SECTION LOCAL DEFAULT 6
+ 7: 00001160 0 SECTION LOCAL DEFAULT 7
+ 8: 00080000 0 SECTION LOCAL DEFAULT 8
+ 9: 00000000 0 SECTION LOCAL DEFAULT 9
+ 10: 00000000 0 SECTION LOCAL DEFAULT 10
+ 11: 00000000 0 SECTION LOCAL DEFAULT 11
+ 12: 00000000 0 SECTION LOCAL DEFAULT 12
+ 13: 00001004 0 NOTYPE LOCAL DEFAULT 2 sec4
+ 14: 000010a4 0 NOTYPE LOCAL DEFAULT 2 start2
+ 15: 000010bc 0 NOTYPE LOCAL DEFAULT 2 sec3
+ 16: 00000000 0 NOTYPE LOCAL DEFAULT ABS \*ABS\*
+ 17: 000010c2 0 NOTYPE GLOBAL DEFAULT 2 diversion
+ 18: 00001160 0 OBJECT GLOBAL DEFAULT 5 ___dtors
+ 19: 00001160 0 OBJECT GLOBAL DEFAULT ABS __bss_start
+ 20: 00001160 0 OBJECT GLOBAL DEFAULT 4 ___ctors_end
+ 21: 000010a4 0 NOTYPE GLOBAL DEFAULT 2 diversion2
+ 22: 00001160 0 OBJECT GLOBAL DEFAULT 4 ___ctors
+ 23: 00001160 0 OBJECT GLOBAL DEFAULT ABS _edata
+ 24: 00001160 0 OBJECT GLOBAL DEFAULT ABS _end
+ 25: 00001000 0 NOTYPE GLOBAL DEFAULT 1 start
+ 26: 00080000 0 OBJECT GLOBAL DEFAULT 8 _stack
+ 27: 00001160 0 OBJECT GLOBAL DEFAULT 5 ___dtors_end
+
+Hex dump of section '\.text':
+ 0x00001004 e10f0009 00090009 00090009 00090009 .*
+ 0x00001014 00090009 0009e10e 6ff0fff0 6ff0fff0 .*
+ 0x00001024 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001034 cc00bd40 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001044 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001054 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001064 6ff0fff0 cc00bd50 cc0084c0 6ff0fff0 .*
+ 0x00001074 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001084 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001094 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x000010a4 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x000010b4 6ff0fff0 cc0084d0 6ff0fff0 6ff0fff0 .*
+ 0x000010c4 6ff0fff0 0000002a 0000002b 00090009 .*
+ 0x000010d4 00090009 0009 .*
+
+Hex dump of section '\.cranges':
+ 0x00000000 00001004 00000018 00020000 101c0000 .*
+ 0x00000010 00a00003 000010bc 0000000c 00030000 .*
+ 0x00000020 10c80000 00080001 000010d0 00000004 .*
+ 0x00000030 00020000 10d40000 00060002 .*
diff --git a/ld/testsuite/ld-sh/sh64/crange3.dd b/ld/testsuite/ld-sh/sh64/crange3.dd
new file mode 100644
index 0000000..a1f9d91
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crange3.dd
@@ -0,0 +1,78 @@
+
+tmpdir/linked: file format elf32-sh64
+
+Disassembly of section .init:
+
+0000000000001000 <start>:
+ 1000: 6ff0fff0 nop
+Disassembly of section .text:
+
+0000000000001004 <diversion>:
+ 1004: e1 0f mov #15,r1
+ 1006: 00 09 nop
+ 1008: 00 09 nop
+ 100a: 00 09 nop
+ 100c: 00 09 nop
+ 100e: 00 09 nop
+ 1010: 00 09 nop
+ 1012: 00 09 nop
+ 1014: 00 09 nop
+ 1016: 00 09 nop
+ 1018: 00 09 nop
+ 101a: e1 0e mov #14,r1
+
+000000000000101c <sec4>:
+ 101c: 6ff0fff0 nop
+ 1020: 6ff0fff0 nop
+ 1024: 6ff0fff0 nop
+ 1028: 6ff0fff0 nop
+ 102c: 6ff0fff0 nop
+ 1030: 6ff0fff0 nop
+ 1034: cc00bd40 movi 47,r20
+ 1038: 6ff0fff0 nop
+ 103c: 6ff0fff0 nop
+ 1040: 6ff0fff0 nop
+ 1044: 6ff0fff0 nop
+ 1048: 6ff0fff0 nop
+ 104c: 6ff0fff0 nop
+ 1050: 6ff0fff0 nop
+ 1054: 6ff0fff0 nop
+ 1058: 6ff0fff0 nop
+ 105c: 6ff0fff0 nop
+ 1060: 6ff0fff0 nop
+ 1064: 6ff0fff0 nop
+ 1068: cc00bd50 movi 47,r21
+ 106c: cc0084c0 movi 33,r12
+ 1070: 6ff0fff0 nop
+ 1074: 6ff0fff0 nop
+ 1078: 6ff0fff0 nop
+ 107c: 6ff0fff0 nop
+ 1080: 6ff0fff0 nop
+ 1084: 6ff0fff0 nop
+ 1088: 6ff0fff0 nop
+ 108c: 6ff0fff0 nop
+ 1090: 6ff0fff0 nop
+ 1094: 6ff0fff0 nop
+ 1098: 6ff0fff0 nop
+ 109c: 6ff0fff0 nop
+ 10a0: 6ff0fff0 nop
+ 10a4: 6ff0fff0 nop
+ 10a8: 6ff0fff0 nop
+ 10ac: 6ff0fff0 nop
+ 10b0: 6ff0fff0 nop
+ 10b4: 6ff0fff0 nop
+ 10b8: cc0084d0 movi 33,r13
+
+00000000000010bc <diversion2>:
+ 10bc: 6ff0fff0 nop
+ 10c0: 6ff0fff0 nop
+ 10c4: 6ff0fff0 nop
+ 10c8: 00 00 00 2a .long 0x0000002a
+ 10cc: 00 00 00 2b .long 0x0000002b
+ 10d0: 00 09 nop
+ 10d2: 00 09 nop
+
+00000000000010d4 <sec3>:
+ 10d4: 00 09 nop
+ 10d6: 00 09 nop
+ 10d8: 00 09 nop
diff --git a/ld/testsuite/ld-sh/sh64/crange3.rd b/ld/testsuite/ld-sh/sh64/crange3.rd
new file mode 100644
index 0000000..a70f4da
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crange3.rd
@@ -0,0 +1,74 @@
+There are 13 section headers, starting at offset 0x1f4:
+
+Section Headers:
+ \[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
+ \[ 0\] NULL 00000000 000000 000000 00 0 0 0
+ \[ 1\] \.init PROGBITS 00001000 000080 000004 00 AXp 0 0 4
+ \[ 2\] \.text PROGBITS 00001004 000084 0000d8 00 AXp 0 0 4
+ \[ 3\] \.data PROGBITS 00001160 000160 000000 00 WA 0 0 1
+ \[ 4\] \.ctors PROGBITS 00001160 000160 000000 00 W 0 0 1
+ \[ 5\] \.dtors PROGBITS 00001160 000160 000000 00 W 0 0 1
+ \[ 6\] \.sbss PROGBITS 00001160 000160 000000 00 W 0 0 1
+ \[ 7\] \.bss NOBITS 00001160 000160 000000 00 WA 0 0 1
+ \[ 8\] \.stack PROGBITS 00080000 000160 000000 00 W 0 0 1
+ \[ 9\] \.cranges LOUSER\+1 00000000 000160 00003c 00 W 0 0 1
+ \[10\] \.shstrtab STRTAB 00000000 00019c 000056 00 0 0 1
+ \[11\] \.symtab SYMTAB 00000000 0003fc 0001c0 10 12 11 4
+ \[12\] \.strtab STRTAB 00000000 0005bc 00007e 00 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+ I \(info\), L \(link order\), G \(group\), x \(unknown\)
+ O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)
+
+Symbol table '\.symtab' contains 28 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 00001000 0 SECTION LOCAL DEFAULT 1
+ 2: 00001004 0 SECTION LOCAL DEFAULT 2
+ 3: 00001160 0 SECTION LOCAL DEFAULT 3
+ 4: 00001160 0 SECTION LOCAL DEFAULT 4
+ 5: 00001160 0 SECTION LOCAL DEFAULT 5
+ 6: 00001160 0 SECTION LOCAL DEFAULT 6
+ 7: 00001160 0 SECTION LOCAL DEFAULT 7
+ 8: 00080000 0 SECTION LOCAL DEFAULT 8
+ 9: 00000000 0 SECTION LOCAL DEFAULT 9
+ 10: 00000000 0 SECTION LOCAL DEFAULT 10
+ 11: 00000000 0 SECTION LOCAL DEFAULT 11
+ 12: 00000000 0 SECTION LOCAL DEFAULT 12
+ 13: 00001004 0 NOTYPE LOCAL DEFAULT 2 sec4
+ 14: 000010a4 0 NOTYPE LOCAL DEFAULT 2 start2
+ 15: 000010bc 0 NOTYPE LOCAL DEFAULT 2 sec3
+ 16: 00000000 0 NOTYPE LOCAL DEFAULT ABS \*ABS\*
+ 17: 000010c2 0 NOTYPE GLOBAL DEFAULT 2 diversion
+ 18: 00001160 0 OBJECT GLOBAL DEFAULT 5 ___dtors
+ 19: 00001160 0 OBJECT GLOBAL DEFAULT ABS __bss_start
+ 20: 00001160 0 OBJECT GLOBAL DEFAULT 4 ___ctors_end
+ 21: 000010a4 0 NOTYPE GLOBAL DEFAULT 2 diversion2
+ 22: 00001160 0 OBJECT GLOBAL DEFAULT 4 ___ctors
+ 23: 00001160 0 OBJECT GLOBAL DEFAULT ABS _edata
+ 24: 00001160 0 OBJECT GLOBAL DEFAULT ABS _end
+ 25: 00001000 0 NOTYPE GLOBAL DEFAULT 1 start
+ 26: 00080000 0 OBJECT GLOBAL DEFAULT 8 _stack
+ 27: 00001160 0 OBJECT GLOBAL DEFAULT 5 ___dtors_end
+
+Hex dump of section '\.text':
+ 0x00001004 e10f0009 00090009 00090009 00090009 .*
+ 0x00001014 00090009 0009e10e 6ff0fff0 6ff0fff0 .*
+ 0x00001024 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001034 cc00bd40 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001044 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001054 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001064 6ff0fff0 cc00bd50 cc0084c0 6ff0fff0 .*
+ 0x00001074 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001084 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00001094 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x000010a4 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x000010b4 6ff0fff0 cc0084d0 6ff0fff0 6ff0fff0 .*
+ 0x000010c4 6ff0fff0 0000002a 0000002b 00090009 .*
+ 0x000010d4 00090009 0009 .*
+
+Hex dump of section '\.cranges':
+ 0x00000000 00001004 00000018 00020000 101c0000 .*
+ 0x00000010 00a00003 000010bc 0000000c 00030000 .*
+ 0x00000020 10c80000 00080001 000010d0 00000004 .*
+ 0x00000030 00020000 10d40000 00060002 .*
diff --git a/ld/testsuite/ld-sh/sh64/crangerel1.rd b/ld/testsuite/ld-sh/sh64/crangerel1.rd
new file mode 100644
index 0000000..bda0a67
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crangerel1.rd
@@ -0,0 +1,47 @@
+There are 10 section headers, starting at offset 0xb0:
+
+Section Headers:
+ \[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
+ \[ 0\] NULL 00000000 000000 000000 00 0 0 0
+ \[ 1\] \.text PROGBITS 00000000 000034 000000 00 AX 0 0 1
+ \[ 2\] \.text\.mixed PROGBITS 00000000 000034 000018 00 AXp 0 0 4
+ \[ 3\] \.data PROGBITS 00000000 00004c 000000 00 WA 0 0 1
+ \[ 4\] \.bss NOBITS 00000000 00004c 000000 00 WA 0 0 1
+ \[ 5\] \.cranges PROGBITS 00000000 00004c 00001e 00 W 0 0 1
+ \[ 6\] \.rela\.cranges RELA 00000000 000240 000024 0c 8 5 4
+ \[ 7\] \.shstrtab STRTAB 00000000 00006a 000046 00 0 0 1
+ \[ 8\] \.symtab SYMTAB 00000000 000264 0000c0 10 9 b 4
+ \[ 9\] \.strtab STRTAB 00000000 000324 000013 00 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+ I \(info\), L \(link order\), G \(group\), x \(unknown\)
+ O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)
+
+Relocation section '\.rela\.cranges' at offset 0x240 contains 3 entries:
+[ ]*Offset[ ]+Info[ ]+Type[ ]+Symbol's Value[ ]+Symbol's Name[ ]+Addend
+0*00000000 0+0201 R_SH_DIR32 00000000 \.text\.mixed \+ 0
+0*0000000a 0+0201 R_SH_DIR32 00000000 \.text\.mixed \+ 0
+0*00000014 0+0201 R_SH_DIR32 00000000 \.text\.mixed \+ 0
+
+Symbol table '\.symtab' contains 12 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 00000000 0 SECTION LOCAL DEFAULT 1
+ 2: 00000000 0 SECTION LOCAL DEFAULT 2
+ 3: 00000000 0 SECTION LOCAL DEFAULT 3
+ 4: 00000000 0 SECTION LOCAL DEFAULT 4
+ 5: 00000000 0 SECTION LOCAL DEFAULT 5
+ 6: 00000000 0 SECTION LOCAL DEFAULT 6
+ 7: 00000000 0 SECTION LOCAL DEFAULT 7
+ 8: 00000000 0 SECTION LOCAL DEFAULT 8
+ 9: 00000000 0 SECTION LOCAL DEFAULT 9
+ 10: 00000000 0 NOTYPE LOCAL DEFAULT 2 start2
+ 11: 00000000 0 NOTYPE GLOBAL DEFAULT 2 diversion2
+
+Hex dump of section '\.text\.mixed':
+ 0x00000000 6ff0fff0 6ff0fff0 6ff0fff0 0000002a .*
+ 0x00000010 0000002b 00090009 .*
+
+Hex dump of section '\.cranges':
+ 0x00000000 00000000 0000000c 00030000 000c0000 .*
+ 0x00000010 00080001 00000014 00000004 0002 .*
diff --git a/ld/testsuite/ld-sh/sh64/crangerel2.rd b/ld/testsuite/ld-sh/sh64/crangerel2.rd
new file mode 100644
index 0000000..69da394
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/crangerel2.rd
@@ -0,0 +1,62 @@
+There are 10 section headers, starting at offset 0x11c:
+
+Section Headers:
+ \[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
+ \[ 0\] NULL 00000000 000000 000000 00 0 0 0
+ \[ 1\] \.text PROGBITS 00000000 000034 000000 00 AX 0 0 1
+ \[ 2\] \.text\.mixed PROGBITS 00000000 000034 00005c 00 AXp 0 0 4
+ \[ 3\] \.data PROGBITS 00000000 000090 000000 00 WA 0 0 1
+ \[ 4\] \.bss NOBITS 00000000 000090 000000 00 WA 0 0 1
+ \[ 5\] \.cranges PROGBITS 00000000 000090 000046 00 W 0 0 1
+ \[ 6\] \.rela\.cranges RELA 00000000 0002ac 000054 0c 8 5 4
+ \[ 7\] \.shstrtab STRTAB 00000000 0000d6 000046 00 0 0 1
+ \[ 8\] \.symtab SYMTAB 00000000 000300 000100 10 9 f 4
+ \[ 9\] \.strtab STRTAB 00000000 000400 000027 00 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+ I \(info\), L \(link order\), G \(group\), x \(unknown\)
+ O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)
+
+Relocation section '\.rela\.cranges' at offset 0x2ac contains 7 entries:
+[ ]*Offset[ ]+Info[ ]+Type[ ]+Symbol's Value[ ]+Symbol's Name[ ]+Addend
+0*00000000 0+0201 R_SH_DIR32 00000000 \.text\.mixed \+ 0
+0*0000000a 0+0201 R_SH_DIR32 00000000 \.text\.mixed \+ 0
+0*00000014 0+0201 R_SH_DIR32 00000000 \.text\.mixed \+ 0
+0*0000001e 0+0201 R_SH_DIR32 00000000 \.text\.mixed \+ 0
+0*00000028 0+0201 R_SH_DIR32 00000000 \.text\.mixed \+ 0
+0*00000032 0+0201 R_SH_DIR32 00000000 \.text\.mixed \+ 0
+0*0000003c 0+0201 R_SH_DIR32 00000000 \.text\.mixed \+ 0
+
+Symbol table '\.symtab' contains 16 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 00000000 0 SECTION LOCAL DEFAULT 1
+ 2: 00000000 0 SECTION LOCAL DEFAULT 2
+ 3: 00000000 0 SECTION LOCAL DEFAULT 3
+ 4: 00000000 0 SECTION LOCAL DEFAULT 4
+ 5: 00000000 0 SECTION LOCAL DEFAULT 5
+ 6: 00000000 0 SECTION LOCAL DEFAULT 6
+ 7: 00000000 0 SECTION LOCAL DEFAULT 7
+ 8: 00000000 0 SECTION LOCAL DEFAULT 8
+ 9: 00000000 0 SECTION LOCAL DEFAULT 9
+ 10: 00000000 0 NOTYPE LOCAL DEFAULT 2 start2
+ 11: 00000018 0 NOTYPE LOCAL DEFAULT 2 sec1
+ 12: 00000028 0 NOTYPE LOCAL DEFAULT 2 sec2
+ 13: 0000003c 0 NOTYPE LOCAL DEFAULT 2 sec3
+ 14: 00000044 0 NOTYPE LOCAL DEFAULT 2 sec4
+ 15: 00000000 0 NOTYPE GLOBAL DEFAULT 2 diversion2
+
+Hex dump of section '\.text\.mixed':
+ 0x00000000 6ff0fff0 6ff0fff0 6ff0fff0 0000002a .*
+ 0x00000010 0000002b 00090009 6ff0fff0 6ff0fff0 .*
+ 0x00000020 6ff0fff0 6ff0fff0 00000029 0000002b .*
+ 0x00000030 0000002a 0000002b 0000002a 00090009 .*
+ 0x00000040 00090000 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00000050 6ff0fff0 6ff0fff0 6ff0fff0 .*
+
+Hex dump of section '\.cranges':
+ 0x00000000 00000000 0000000c 00030000 000c0000 .*
+ 0x00000010 00080001 00000014 00000004 00020000 .*
+ 0x00000020 00180000 00100003 00000028 00000014 .*
+ 0x00000030 00010000 003c0000 00060002 00000044 .*
+ 0x00000040 00000018 0003 .*
diff --git a/ld/testsuite/ld-sh/sh64/endian.dbd b/ld/testsuite/ld-sh/sh64/endian.dbd
new file mode 100644
index 0000000..0369cbc
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/endian.dbd
@@ -0,0 +1,11 @@
+
+.*:[ ]*file[ ]*format[ ]*elf64-sh64
+
+Disassembly[ ]*of[ ]*section[ ]*.text:
+
+0000000000000000[ ]*<start>:
+[ ]*0:[ ]*cc48d000[ ]*movi[ ]*4660,r0
+[ ]*4:[ ]*12345678[ ]*.long[ ]*0x12345678
+[ ]*8:[ ]*12340000[ ]*.long[ ]*0x12340000
+[ ]*c:[ ]*12345678[ ]*.long[ ]*0x12345678
+
diff --git a/ld/testsuite/ld-sh/sh64/endian.dld b/ld/testsuite/ld-sh/sh64/endian.dld
new file mode 100644
index 0000000..f3c5bd5
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/endian.dld
@@ -0,0 +1,11 @@
+
+.*:[ ]*file[ ]*format[ ]*elf64-sh64l
+
+Disassembly[ ]*of[ ]*section[ ]*.text:
+
+0000000000000000[ ]*<start>:
+[ ]*0:[ ]*cc48d000[ ]*movi[ ]*4660,r0
+[ ]*4:[ ]*12345678[ ]*.long[ ]*0x12345678
+[ ]*8:[ ]*00001234[ ]*.long[ ]*0x00001234
+[ ]*c:[ ]*12345678[ ]*.long[ ]*0x12345678
+
diff --git a/ld/testsuite/ld-sh/sh64/endian.ld b/ld/testsuite/ld-sh/sh64/endian.ld
new file mode 100644
index 0000000..e9635e1
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/endian.ld
@@ -0,0 +1,6 @@
+SECTIONS {
+ .text : {
+ *(.text)
+ LONG(0x12345678);
+ }
+}
diff --git a/ld/testsuite/ld-sh/sh64/endian.s b/ld/testsuite/ld-sh/sh64/endian.s
new file mode 100644
index 0000000..79bc9e4
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/endian.s
@@ -0,0 +1,7 @@
+ .text
+ .mode shmedia
+start:
+
+ movi 0x1234,r0
+ .long 0x12345678
+ .word 0x1234, 0
diff --git a/ld/testsuite/ld-sh/sh64/endian.sbd b/ld/testsuite/ld-sh/sh64/endian.sbd
new file mode 100644
index 0000000..650aeba
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/endian.sbd
@@ -0,0 +1,7 @@
+
+.*: file format elf64-sh64
+
+Contents of section .text:
+ 0000 cc48d000 12345678 12340000 12345678.*
+Contents of section .data:
+
diff --git a/ld/testsuite/ld-sh/sh64/endian.sld b/ld/testsuite/ld-sh/sh64/endian.sld
new file mode 100644
index 0000000..71ef38b
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/endian.sld
@@ -0,0 +1,7 @@
+
+.*: file format elf64-sh64l
+
+Contents of section .text:
+ 0000 00d048cc 78563412 34120000 78563412.*
+Contents of section .data:
+
diff --git a/ld/testsuite/ld-sh/sh64/mix1-noexp.sd b/ld/testsuite/ld-sh/sh64/mix1-noexp.sd
new file mode 100644
index 0000000..f70a7f1
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/mix1-noexp.sd
@@ -0,0 +1,16 @@
+
+.*: file format .*-sh64
+
+Contents of section \.text:
+ 1000 8902c700 00090009 00090000 100a0000 .*
+ 1010 10040000 10210000 effff240 efffea50 .*
+ 1020 cc401360 cc4086d0 ebfffa70 6ff0fff0 .*
+Contents of section \.data:
+ 10b0 000010b0 00001004 00001021 .*
+Contents of section \.ctors:
+Contents of section \.dtors:
+Contents of section \.sbss:
+Contents of section \.stack:
+Contents of section \.cranges:
+ 0000 00001000 00000016 00020000 10180000 .*
+ 0010 00180003 .*
diff --git a/ld/testsuite/ld-sh/sh64/mix1.sd b/ld/testsuite/ld-sh/sh64/mix1.sd
new file mode 100644
index 0000000..3b287d7
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/mix1.sd
@@ -0,0 +1,18 @@
+
+.*: file format .*-sh64
+
+Contents of section \.text:
+ 1000 8902c700 00090009 00090000 100a0000 .*
+ 1010 10040000 10310000 cffffd90 cbffa190 .*
+ 1020 6bf56640 cffffd90 cbff6190 6bf56650 .*
+ 1030 cc000360 c8401360 cc0002d0 c840c6d0 .*
+ 1040 ebfff270 6ff0fff0 .*
+Contents of section \.data:
+ 10c8 000010c8 00001004 00001031 .*
+Contents of section \.ctors:
+Contents of section \.dtors:
+Contents of section \.sbss:
+Contents of section \.stack:
+Contents of section \.cranges:
+ 0000 00001000 00000016 00020000 10180000 .*
+ 0010 00300003 .*
diff --git a/ld/testsuite/ld-sh/sh64/mix1.xd b/ld/testsuite/ld-sh/sh64/mix1.xd
new file mode 100644
index 0000000..053a1f6
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/mix1.xd
@@ -0,0 +1,56 @@
+
+.*: file format .*-sh64
+.*
+architecture: sh5, flags 0x00000112:
+EXEC_P, HAS_SYMS, D_PAGED
+start address 0x0+1000
+
+Program Header:
+ LOAD off 0x0+80 vaddr 0x0+1000 paddr 0x0+1000 align 2\*\*7
+ filesz 0x0+48 memsz 0x0+48 flags r-x
+ LOAD off 0x0+c8 vaddr 0x0+10c8 paddr 0x0+10c8 align 2\*\*7
+ filesz 0x0+c memsz 0x0+10 flags rw-
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 00000048 0+1000 0+1000 00000080 2\*\*2
+ CONTENTS, ALLOC, LOAD, READONLY, CODE
+ 1 \.data 0000000c 0+10c8 0+10c8 000000c8 2\*\*0
+ CONTENTS, ALLOC, LOAD, DATA
+ 2 \.ctors 00000000 0+10d4 0+10d4 000000d8 2\*\*0
+ CONTENTS
+ 3 \.dtors 00000000 0+10d4 0+10d4 000000d8 2\*\*0
+ CONTENTS
+ 4 \.sbss 00000000 0+10d8 0+10d8 000000d8 2\*\*0
+ CONTENTS
+ 5 \.bss 00000000 0+10d8 0+10d8 000000d8 2\*\*0
+ ALLOC
+ 6 \.stack 00000000 0+80000 0+80000 000000d8 2\*\*0
+ CONTENTS
+ 7 \.cranges 00000014 0+ 0+ 000000d8 2\*\*0
+ CONTENTS, DEBUGGING, SORT_ENTRIES
+SYMBOL TABLE:
+0+1000 l d \.text 0+
+0+10c8 l d \.data 0+
+0+10d4 l d \.ctors 0+
+0+10d4 l d \.dtors 0+
+0+10d8 l d \.sbss 0+
+0+10d8 l d \.bss 0+
+0+80000 l d \.stack 0+
+0+ l d \.cranges 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+1008 l \.text 0+ forw
+0+1004 l \.text 0+ start2
+0+1030 l \.text 0+ 0x04 mediacode2
+0+1018 l \.text 0+ 0x04 mediacode
+0+10d4 g O \.dtors 0+ ___dtors
+0+10d8 g O \*ABS\* 0+ __bss_start
+0+10d4 g O \.ctors 0+ ___ctors_end
+0+10d4 g O \.ctors 0+ ___ctors
+0+10d8 g O \*ABS\* 0+ _edata
+0+10d8 g O \*ABS\* 0+ _end
+0+1000 g \.text 0+ start
+0+80000 g O \.stack 0+ _stack
+0+10d4 g O \.dtors 0+ ___dtors_end
diff --git a/ld/testsuite/ld-sh/sh64/mix2-noexp.sd b/ld/testsuite/ld-sh/sh64/mix2-noexp.sd
new file mode 100644
index 0000000..1a8a907
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/mix2-noexp.sd
@@ -0,0 +1,18 @@
+
+.*: file format .*-sh64
+
+Contents of section \.text:
+ 1000 cc4048e0 cc40b8e0 ec000e60 6ff0fff0 .*
+ 1010 0009c700 c7000009 00090000 10090000 .*
+ 1020 10bc .*
+Contents of section \.rodata:
+ 1022 00001018 000010c4 0000100d 00001026 .*
+Contents of section \.data:
+ 10b8 00000000 00001014 00000000 000010bc .*
+Contents of section \.ctors:
+Contents of section \.dtors:
+Contents of section \.sbss:
+Contents of section \.stack:
+Contents of section \.cranges:
+ 0000 00001000 00000010 00030000 10100000 .*
+ 0010 00120002 .*
diff --git a/ld/testsuite/ld-sh/sh64/mix2.sd b/ld/testsuite/ld-sh/sh64/mix2.sd
new file mode 100644
index 0000000..f5b45cf
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/mix2.sd
@@ -0,0 +1,19 @@
+
+.*: file format .*-sh64
+
+Contents of section \.text:
+ 1000 cc0000e0 c84088e0 cc0000e0 c840f8e0 .*
+ 1010 cc000190 c8003190 6bf56660 6ff0fff0 .*
+ 1020 0009c700 c7000009 00090000 10110000 .*
+ 1030 10cc .*
+Contents of section \.rodata:
+ 1032 00001028 000010d4 0000101d 00001036 .*
+Contents of section \.data:
+ 10c8 00000000 00001024 00000000 000010cc .*
+Contents of section \.ctors:
+Contents of section \.dtors:
+Contents of section \.sbss:
+Contents of section \.stack:
+Contents of section \.cranges:
+ 0000 00001000 00000020 00030000 10200000 .*
+ 0010 00120002 .*
diff --git a/ld/testsuite/ld-sh/sh64/mix2.xd b/ld/testsuite/ld-sh/sh64/mix2.xd
new file mode 100644
index 0000000..bda2f8d
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/mix2.xd
@@ -0,0 +1,65 @@
+
+.*: file format .*-sh64
+.*
+architecture: sh5, flags 0x00000112:
+EXEC_P, HAS_SYMS, D_PAGED
+start address 0x0+1001
+
+Program Header:
+ LOAD off 0x0+80 vaddr 0x0+1000 paddr 0x0+1000 align 2\*\*7
+ filesz 0x0+42 memsz 0x0+42 flags r-x
+ LOAD off 0x0+c8 vaddr 0x0+10c8 paddr 0x0+10c8 align 2\*\*7
+ filesz 0x0+10 memsz 0x0+10 flags rw-
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 00000032 0+1000 0+1000 00000080 2\*\*0
+ CONTENTS, ALLOC, LOAD, READONLY, CODE
+ 1 \.rodata 00000010 0+1032 0+1032 000000b2 2\*\*0
+ CONTENTS, ALLOC, LOAD, READONLY, DATA
+ 2 \.data 00000010 0+10c8 0+10c8 000000c8 2\*\*0
+ CONTENTS, ALLOC, LOAD, DATA
+ 3 \.ctors 00000000 0+10d8 0+10d8 000000d8 2\*\*0
+ CONTENTS
+ 4 \.dtors 00000000 0+10d8 0+10d8 000000d8 2\*\*0
+ CONTENTS
+ 5 \.sbss 00000000 0+10d8 0+10d8 000000d8 2\*\*0
+ CONTENTS
+ 6 \.bss 00000000 0+10d8 0+10d8 000000d8 2\*\*0
+ ALLOC
+ 7 \.stack 00000000 0+80000 0+80000 000000d8 2\*\*0
+ CONTENTS
+ 8 \.cranges 00000014 0+ 0+ 000000d8 2\*\*0
+ CONTENTS, DEBUGGING, SORT_ENTRIES
+SYMBOL TABLE:
+0+1000 l d \.text 0+
+0+1032 l d \.rodata 0+
+0+10c8 l d \.data 0+
+0+10d8 l d \.ctors 0+
+0+10d8 l d \.dtors 0+
+0+10d8 l d \.sbss 0+
+0+10d8 l d \.bss 0+
+0+80000 l d \.stack 0+
+0+ l d \.cranges 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+1020 l \.text 0+ locallabel
+0+103e g \.rodata 0+ compactlabel4
+0+101c g \.text 0+ 0x04 medialabel2
+0+1036 g \.rodata 0+ medialabel3
+0+1022 g \.text 0+ compactlabel1
+0+1024 g \.text 0+ compactlabel2
+0+1028 g \.text 0+ compactlabel3
+0+1010 g \.text 0+ 0x04 medialabel1
+0+10d8 g O \.dtors 0+ ___dtors
+0+10cc g \.data 0+ medialabel4
+0+10d8 g O \*ABS\* 0+ __bss_start
+0+10d8 g O \.ctors 0+ ___ctors_end
+0+10d4 g \.data 0+ compactlabel5
+0+10d8 g O \.ctors 0+ ___ctors
+0+10d8 g O \*ABS\* 0+ _edata
+0+10d8 g O \*ABS\* 0+ _end
+0+1000 g \.text 0+ 0x04 start
+0+80000 g O \.stack 0+ _stack
+0+10d8 g O \.dtors 0+ ___dtors_end
diff --git a/ld/testsuite/ld-sh/sh64/rel-1.s b/ld/testsuite/ld-sh/sh64/rel-1.s
new file mode 100644
index 0000000..6cf18ca
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/rel-1.s
@@ -0,0 +1,48 @@
+! Relative linking, simple files with global symbols but nothing really
+! strange. Reference from same and other file to .text and .data in
+! different combinations.
+
+! fileFsectionN, with F in rel-F.s, and N in:
+! 1 - Same file and section.
+! 2 - Same file, different section.
+! 3 - Other file, same section.
+! 4 - Other file, other section.
+
+ .mode SHmedia
+ .text
+ .global start
+start:
+ nop
+ .global file1text1
+file1text1:
+ nop
+ movi file1text1 & 65535,r10
+ .global file1text2
+file1text2:
+ movi file1data2 & 65535,r20
+ .global file1text3
+file1text3:
+ movi file2text3 & 65535,r20
+ .global file1text4
+file1text4:
+ movi file2data4 & 65535,r20
+ movi unresolved1 & 65535,r40
+ movi unresolved6 & 65535,r30
+
+ .data
+ .long 0
+ .global file1data1
+file1data1:
+ .long 0
+ .long file1data1
+ .global file1data2
+file1data2:
+ .long file1text2
+ .global file1data3
+file1data3:
+ .long file2data3
+ .global file1data4
+file1data4:
+ .long file2text4
+ .long unresolved2
+ .long unresolved5
diff --git a/ld/testsuite/ld-sh/sh64/rel-2.s b/ld/testsuite/ld-sh/sh64/rel-2.s
new file mode 100644
index 0000000..b1931b5
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/rel-2.s
@@ -0,0 +1,46 @@
+! Relative linking, second file.
+
+! fileFsectionN, with F in rel-F.s, and N in:
+! 1 - Same file and section.
+! 2 - Same file, different section.
+! 3 - Other file, same section.
+! 4 - Other file, other section.
+
+ .mode SHmedia
+ .text
+ .global start2
+start2:
+ nop
+ .global file2text1
+file2text1:
+ nop
+ movi file2text1 & 65535,r10
+ .global file2text2
+file2text2:
+ movi file2data2 & 65535,r20
+ .global file2text3
+file2text3:
+ movi file1text3 & 65535,r20
+ .global file2text4
+file2text4:
+ movi file1data4 & 65535,r20
+ movi unresolved1 & 65535,r30
+ movi unresolved3 & 65535,r30
+
+ .data
+ .long 0
+ .global file2data1
+file2data1:
+ .long 0
+ .long file2data1
+ .global file2data2
+file2data2:
+ .long file2text2
+ .global file2data3
+file2data3:
+ .long file1data3
+ .global file2data4
+file2data4:
+ .long file1text4
+ .long unresolved2
+ .long unresolved4
diff --git a/ld/testsuite/ld-sh/sh64/rel32.xd b/ld/testsuite/ld-sh/sh64/rel32.xd
new file mode 100644
index 0000000..f706cb5
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/rel32.xd
@@ -0,0 +1,92 @@
+
+.*: file format .*-sh64
+.*
+architecture: sh5, flags 0x0+11:
+HAS_RELOC, HAS_SYMS
+start address 0x0+
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+40 0+ 0+ 0+34 2\*\*0
+ CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
+ 1 \.data 0+40 0+ 0+ 0+74 2\*\*0
+ CONTENTS, ALLOC, LOAD, RELOC, DATA
+ 2 \.bss 0+ 0+ 0+ 0+b4 2\*\*0
+ ALLOC
+SYMBOL TABLE:
+0+ l d \.text 0+
+0+ l d \*ABS\* 0+
+0+ l d \.data 0+
+0+ l d \*ABS\* 0+
+0+ l d \.bss 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ \*UND\* 0+ unresolved5
+0+c g \.text 0+ 0x04 file1text2
+0+24 g \.text 0+ 0x04 file2text1
+0+4 g \.data 0+ file1data1
+0+34 g \.data 0+ file2data4
+0+10 g \.text 0+ 0x04 file1text3
+0+2c g \.data 0+ file2data2
+0+c g \.data 0+ file1data2
+0+30 g \.text 0+ 0x04 file2text3
+0+20 g \.text 0+ 0x04 start2
+0+ \*UND\* 0+ unresolved1
+0+ \*UND\* 0+ unresolved6
+0+4 g \.text 0+ 0x04 file1text1
+0+2c g \.text 0+ 0x04 file2text2
+0+ \*UND\* 0+ unresolved3
+0+34 g \.text 0+ 0x04 file2text4
+0+ \*UND\* 0+ unresolved2
+0+ g \.text 0+ 0x04 start
+0+14 g \.text 0+ 0x04 file1text4
+0+30 g \.data 0+ file2data3
+0+ \*UND\* 0+ unresolved4
+0+24 g \.data 0+ file2data1
+0+10 g \.data 0+ file1data3
+0+14 g \.data 0+ file1data4
+
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET *TYPE *VALUE
+0+8 R_SH_IMM_LOW16 file1text1
+0+c R_SH_IMM_LOW16 file1data2
+0+10 R_SH_IMM_LOW16 file2text3
+0+14 R_SH_IMM_LOW16 file2data4
+0+18 R_SH_IMM_LOW16 unresolved1
+0+1c R_SH_IMM_LOW16 unresolved6
+0+28 R_SH_IMM_LOW16 file2text1
+0+2c R_SH_IMM_LOW16 file2data2
+0+30 R_SH_IMM_LOW16 file1text3
+0+34 R_SH_IMM_LOW16 file1data4
+0+38 R_SH_IMM_LOW16 unresolved1
+0+3c R_SH_IMM_LOW16 unresolved3
+
+
+RELOCATION RECORDS FOR \[\.data\]:
+OFFSET *TYPE *VALUE
+0+8 R_SH_DIR32 file1data1
+0+c R_SH_DIR32 file1text2
+0+10 R_SH_DIR32 file2data3
+0+14 R_SH_DIR32 file2text4
+0+18 R_SH_DIR32 unresolved2
+0+1c R_SH_DIR32 unresolved5
+0+28 R_SH_DIR32 file2data1
+0+2c R_SH_DIR32 file2text2
+0+30 R_SH_DIR32 file1data3
+0+34 R_SH_DIR32 file1text4
+0+38 R_SH_DIR32 unresolved2
+0+3c R_SH_DIR32 unresolved4
+
+
+Contents of section \.text:
+ 0000 6ff0fff0 6ff0fff0 cc0000a0 cc000140 .*
+ 0010 cc000140 cc000140 cc000280 cc0001e0 .*
+ 0020 6ff0fff0 6ff0fff0 cc0000a0 cc000140 .*
+ 0030 cc000140 cc000140 cc0001e0 cc0001e0 .*
+Contents of section \.data:
+ 0000 00000000 00000000 00000000 00000000 .*
+ 0010 00000000 00000000 00000000 00000000 .*
+ 0020 00000000 00000000 00000000 00000000 .*
+ 0030 00000000 00000000 00000000 00000000 .*
diff --git a/ld/testsuite/ld-sh/sh64/rel64.xd b/ld/testsuite/ld-sh/sh64/rel64.xd
new file mode 100644
index 0000000..ae76d78
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/rel64.xd
@@ -0,0 +1,92 @@
+
+.*: file format .*-sh64
+.*
+architecture: sh5, flags 0x0+11:
+HAS_RELOC, HAS_SYMS
+start address 0x0+
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+40 0+ 0+ 0+40 2\*\*0
+ CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
+ 1 \.data 0+40 0+ 0+ 0+80 2\*\*0
+ CONTENTS, ALLOC, LOAD, RELOC, DATA
+ 2 \.bss 0+ 0+ 0+ 0+c0 2\*\*0
+ ALLOC
+SYMBOL TABLE:
+0+ l d \.text 0+
+0+ l d \*ABS\* 0+
+0+ l d \.data 0+
+0+ l d \*ABS\* 0+
+0+ l d \.bss 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ \*UND\* 0+ unresolved5
+0+c g \.text 0+ 0x04 file1text2
+0+24 g \.text 0+ 0x04 file2text1
+0+4 g \.data 0+ file1data1
+0+34 g \.data 0+ file2data4
+0+10 g \.text 0+ 0x04 file1text3
+0+2c g \.data 0+ file2data2
+0+c g \.data 0+ file1data2
+0+30 g \.text 0+ 0x04 file2text3
+0+20 g \.text 0+ 0x04 start2
+0+ \*UND\* 0+ unresolved1
+0+ \*UND\* 0+ unresolved6
+0+4 g \.text 0+ 0x04 file1text1
+0+2c g \.text 0+ 0x04 file2text2
+0+ \*UND\* 0+ unresolved3
+0+34 g \.text 0+ 0x04 file2text4
+0+ \*UND\* 0+ unresolved2
+0+ g \.text 0+ 0x04 start
+0+14 g \.text 0+ 0x04 file1text4
+0+30 g \.data 0+ file2data3
+0+ \*UND\* 0+ unresolved4
+0+24 g \.data 0+ file2data1
+0+10 g \.data 0+ file1data3
+0+14 g \.data 0+ file1data4
+
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET TYPE VALUE
+0+8 R_SH_IMM_LOW16 file1text1
+0+c R_SH_IMM_LOW16 file1data2
+0+10 R_SH_IMM_LOW16 file2text3
+0+14 R_SH_IMM_LOW16 file2data4
+0+18 R_SH_IMM_LOW16 unresolved1
+0+1c R_SH_IMM_LOW16 unresolved6
+0+28 R_SH_IMM_LOW16 file2text1
+0+2c R_SH_IMM_LOW16 file2data2
+0+30 R_SH_IMM_LOW16 file1text3
+0+34 R_SH_IMM_LOW16 file1data4
+0+38 R_SH_IMM_LOW16 unresolved1
+0+3c R_SH_IMM_LOW16 unresolved3
+
+
+RELOCATION RECORDS FOR \[\.data\]:
+OFFSET TYPE VALUE
+0+8 R_SH_DIR32 file1data1
+0+c R_SH_DIR32 file1text2
+0+10 R_SH_DIR32 file2data3
+0+14 R_SH_DIR32 file2text4
+0+18 R_SH_DIR32 unresolved2
+0+1c R_SH_DIR32 unresolved5
+0+28 R_SH_DIR32 file2data1
+0+2c R_SH_DIR32 file2text2
+0+30 R_SH_DIR32 file1data3
+0+34 R_SH_DIR32 file1text4
+0+38 R_SH_DIR32 unresolved2
+0+3c R_SH_DIR32 unresolved4
+
+
+Contents of section \.text:
+ 0000 6ff0fff0 6ff0fff0 cc0000a0 cc000140 .*
+ 0010 cc000140 cc000140 cc000280 cc0001e0 .*
+ 0020 6ff0fff0 6ff0fff0 cc0000a0 cc000140 .*
+ 0030 cc000140 cc000140 cc0001e0 cc0001e0 .*
+Contents of section \.data:
+ 0000 00000000 00000000 00000000 00000000 .*
+ 0010 00000000 00000000 00000000 00000000 .*
+ 0020 00000000 00000000 00000000 00000000 .*
+ 0030 00000000 00000000 00000000 00000000 .*
diff --git a/ld/testsuite/ld-sh/sh64/relax.exp b/ld/testsuite/ld-sh/sh64/relax.exp
new file mode 100644
index 0000000..18cafea
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/relax.exp
@@ -0,0 +1,143 @@
+# Expect script for ld-sh tests
+# Copyright (C) 2001 Free Software Foundation
+#
+# 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.
+#
+
+# Test SH relaxing - that is, that it's disabled when SHmedia sections
+# are present.
+
+if ![istarget sh64-*-*] {
+ return
+}
+
+# There are four source files: the first is SHcompact only, the second
+# is SHmedia only, the third has both, and the fourth has only a
+# .cranges section. The table below has:
+# Title
+# as flags for first source (else "n/a" to skip)
+# ditto, other three files
+# ld flags
+# 1/0 whether relaxing should have been done or not, or -1 if we expect
+# the linker to not produce an output file.
+
+set sh64relaxtests {
+ {"SH64 not relaxing, shcompact"
+ {"-relax -isa shcompact" "n/a" "n/a" "n/a"} "-mshelf32" 0}
+ {"SH64 relaxing, shcompact"
+ {"-relax -isa shcompact" "n/a" "n/a" "n/a"} "-relax -mshelf32" 1}
+ {"SH64 relaxing, shcompacts"
+ {"-relax -isa shcompact" "-isa shcompact" "n/a" "n/a"} "-relax -mshelf32" 1}
+ {"SH64 relaxing disabled, shmedia"
+ {"-relax -isa shcompact" "-isa shmedia -no-mix" "n/a" "n/a"} "-relax -mshelf32" 0}
+ {"SH64 relaxing disabled, mixed"
+ {"-relax -isa shcompact" "n/a" "-isa shcompact" "n/a"} "-relax -mshelf32" 0}
+ {"SH64 relaxing disabled, cranges"
+ {"-relax -isa shcompact" "n/a" "n/a" ""} "-relax -mshelf32" 0}
+}
+
+proc run_sh64relaxtest {sh64relaxtests} {
+ global ld
+ global as
+ global nm
+ global objdump
+ global readelf
+ global srcdir
+ global subdir
+
+ set testindex 0
+
+ set sh64relaxfiles {
+ "relax1.s" "relax2.s" "relax3.s" "relax4.s"
+ }
+
+ foreach testentry $sh64relaxtests {
+ set testname [lindex $testentry 0]
+ set as_options [lindex $testentry 1]
+ set ld_options [lindex $testentry 2]
+ set expect_relaxed [lindex $testentry 3]
+
+ set is_unresolved 0
+ set objfiles {}
+
+ incr testindex
+
+ # Assemble each file in the test.
+ for {set i 0} {$i < 4} {incr i} {
+ set as_file [lindex $sh64relaxfiles $i]
+ set as_opt [lindex $as_options $i]
+ if { [string compare $as_opt "n/a"] != 0 } {
+ set objfile "tmpdir/[file rootname $as_file]-$testindex.o"
+ lappend objfiles $objfile
+
+ if ![ld_assemble $as "$as_opt $srcdir/$subdir/$as_file" $objfile] {
+ set is_unresolved 1
+ break
+ }
+ }
+ }
+
+ # Catch assembler errors.
+ if { $is_unresolved != 0 } {
+ unresolved $testname
+ continue
+ }
+
+ set binfile "tmpdir/relax-$testindex.x"
+
+ # We're not interested in the pass/fail of the linker as much
+ # as we're interested in whether or not relaxing got properly
+ # disabled. Hence the lax checking here.
+
+ file delete $binfile
+ set result [ld_simple_link $ld $binfile " --no-warn-mismatch $ld_options $objfiles"]
+ if ![file exists $binfile] {
+
+ if {$expect_relaxed == -1} {
+ pass $testname
+ continue;
+ }
+
+ verbose "$testname: file $binfile doesn't exist" 1
+ fail $testname
+ continue
+ }
+
+ catch "exec $objdump -d $binfile" objdump_output
+
+ regexp "\[ \t](jsr|bsr)\[ \t]" $objdump_output ignore calltype
+
+ if [string match $calltype "bsr"] {
+ set relaxed 1
+ } elseif [string match $calltype "jsr"] {
+ set relaxed 0
+ } else {
+ verbose "$testname: neither jsr nor bsr found" 1
+ verbose $objdump_output 2
+ fail $testname
+ continue
+ }
+
+ if {$relaxed != $expect_relaxed} {
+ verbose $objdump_output 2
+ fail $testname
+ exit
+ } else {
+ pass $testname
+ }
+ }
+}
+
+run_sh64relaxtest $sh64relaxtests
diff --git a/ld/testsuite/ld-sh/sh64/relax1.s b/ld/testsuite/ld-sh/sh64/relax1.s
new file mode 100644
index 0000000..873954b
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/relax1.s
@@ -0,0 +1,12 @@
+ .globl start
+start:
+.L3:
+ mov.l .L4,r1
+ .uses .L3
+ jsr @r1
+ nop
+ nop
+.L4:
+ .long .L5
+.L5:
+ nop
diff --git a/ld/testsuite/ld-sh/sh64/relax2.s b/ld/testsuite/ld-sh/sh64/relax2.s
new file mode 100644
index 0000000..9bf0802
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/relax2.s
@@ -0,0 +1,3 @@
+ .text
+foo1:
+ nop
diff --git a/ld/testsuite/ld-sh/sh64/relax3.s b/ld/testsuite/ld-sh/sh64/relax3.s
new file mode 100644
index 0000000..964bacd
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/relax3.s
@@ -0,0 +1,8 @@
+ .text
+ .mode shmedia
+foo1:
+ nop
+
+ .mode shcompact
+foo2:
+ nop
diff --git a/ld/testsuite/ld-sh/sh64/relax4.s b/ld/testsuite/ld-sh/sh64/relax4.s
new file mode 100644
index 0000000..904df7c
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/relax4.s
@@ -0,0 +1,2 @@
+ .section .cranges
+ .word 0
diff --git a/ld/testsuite/ld-sh/sh64/reldl-1.s b/ld/testsuite/ld-sh/sh64/reldl-1.s
new file mode 100644
index 0000000..0aeb332
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/reldl-1.s
@@ -0,0 +1,171 @@
+! Relative linking. Like the simple test, but mixing in use of
+! "datalabel" and offsets to the global symbols into the previous
+! combinations.
+!
+! More systematic testing datalabel references,
+! igoring section difference, symbol definition type and offset presence:
+! Datalabel reference plus:
+! (datalabel other file, other file, same file, none)
+! = (1, 2, 3, 4, 12, 13, 23, 123)
+!
+! Definition:
+! (none, same file, other file) = (a, b, c)
+!
+! Combined:
+! = (a1, a2, a3, a4, a12, a13, a23, a123, b1, b2, b3, b4, b12,
+! b13, b23, b123, c1, c2, c3, c4, c12, c13, c23, c123)
+
+ .mode SHmedia
+ .text
+ .global start
+start:
+ nop
+ .global file1text1
+file1text1:
+ nop
+ movi file1text1 & 65535,r10
+ .global file1text2
+file1text2:
+ movi (datalabel file1data2) & 65535,r20
+ .global file1text3
+file1text3:
+ movi file2text3 & 65535,r20
+ .global file1text4
+file1text4:
+ movi file2data4 & 65535,r20
+ .global file1text5
+file1text5:
+ movi unresolved1 & 65535,r40
+ .global b1
+b1:
+ movi unresolved6 & 65535,r30
+ .global b2
+b2:
+ movi (datalabel file1text1) & 65535,r10
+ .global b3
+b3:
+ movi (datalabel file1text1 + 24) & 65535,r10
+ .global b4
+b4:
+ movi (datalabel file1text5 + 8) & 65535, r40
+ .global b12
+b12:
+ movi (datalabel file1data2 + 48) & 65535,r20
+ .global b13
+b13:
+ movi file1data2 & 65535,r20
+ .global b23
+b23:
+ movi (datalabel file2data4 + 16),r50
+ .global b123
+b123:
+ movi (datalabel unresolved7) & 65535,r60
+ .global oc1
+oc1:
+ movi (datalabel unresolved1) & 65535,r60
+ .global oc2
+oc2:
+ nop
+ .global oc3
+oc3:
+ nop
+ .global oc4
+oc4:
+ nop
+ .global oc12
+oc12:
+ nop
+ .global oc13
+oc13:
+ nop
+ .global oc23
+oc23:
+ nop
+ .global oc123
+oc123:
+ nop
+
+ .data
+ .long 0
+ .global file1data1
+file1data1:
+ .long 0
+ .long datalabel file1data1 + 8
+ .global file1data2
+file1data2:
+ .long file1text2
+ .global file1data3
+file1data3:
+ .long file2data3
+ .global file1data4
+file1data4:
+ .long file2text4
+ .global file1data5
+file1data5:
+ .long unresolved2
+ .long unresolved5
+ .long datalabel unresolved6 + 40
+ .long unresolved9
+
+ .long datalabel a1
+ .long a23
+ .long b123
+ .long c3
+ .long c13
+ .long datalabel a2
+ .long datalabel a3
+ .long datalabel a4
+ .long datalabel a12
+ .long datalabel a13
+ .long datalabel a23
+ .long datalabel a123
+ .long datalabel b1
+ .long datalabel b2
+ .long a3
+ .long a13
+ .long datalabel b3
+ .long datalabel b4
+ .long datalabel b12
+ .long datalabel b13
+ .long a123
+ .long b3
+ .long b13
+ .long b23
+ .long datalabel b23
+ .long datalabel b123
+ .long datalabel c1
+ .long datalabel c2
+ .long datalabel c3
+ .long c23
+ .long c123
+ .long datalabel c4
+ .long datalabel c12
+ .long datalabel c13
+ .long datalabel c23
+ .long datalabel c123
+
+
+ .long datalabel oa1
+ .long datalabel ob1
+ .long ob123
+ .long datalabel oc1
+ .long oa2
+ .long ob2
+ .long oc2
+ .long oa12
+ .long datalabel oa12
+ .long datalabel ob12
+ .long ob12
+ .long datalabel oc12
+ .long oc12
+ .long oa23
+ .long datalabel oa13
+ .long oc123
+ .long datalabel ob13
+ .long datalabel oc13
+ .long ob23
+ .long oc23
+ .long oa123
+ .long datalabel oa123
+ .long datalabel ob123
+ .long datalabel oc123
diff --git a/ld/testsuite/ld-sh/sh64/reldl-2.s b/ld/testsuite/ld-sh/sh64/reldl-2.s
new file mode 100644
index 0000000..d632021
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/reldl-2.s
@@ -0,0 +1,156 @@
+! Relative linking with datalabel use, second file. Much like rel-2.s
+
+ .mode SHmedia
+ .text
+ .global start2
+start2:
+ nop
+ .global file2text1
+file2text1:
+ nop
+ movi file2text1 & 65535,r10
+ .global file2text2
+file2text2:
+ movi file2data2 & 65535,r20
+ .global file2text3
+file2text3:
+ movi file1text3 & 65535,r20
+ .global file2text4
+file2text4:
+ movi file1data4 & 65535,r20
+ movi unresolved1 & 65535,r30
+ movi unresolved3 & 65535,r30
+ movi datalabel unresolved8 & 65535,r50
+ movi datalabel unresolved9 & 65535,r50
+ movi datalabel file1text1 & 65535,r40
+ movi datalabel file1data2 & 65535,r40
+ movi datalabel file1data3 & 65535,r40
+ .global c1
+c1:
+ nop
+ .global c2
+c2:
+ nop
+ .global c3
+c3:
+ nop
+ .global c4
+c4:
+ nop
+ .global c12
+c12:
+ nop
+ .global c13
+c13:
+ nop
+ .global c23
+c23:
+ nop
+ .global c123
+c123:
+ nop
+
+ .global ob1
+ob1:
+ nop
+ .global ob2
+ob2:
+ nop
+ .global ob3
+ob3:
+ nop
+ .global ob4
+ob4:
+ nop
+ .global ob12
+ob12:
+ nop
+ .global ob13
+ob13:
+ nop
+ .global ob23
+ob23:
+ nop
+ .global ob123
+ob123:
+ nop
+
+ .data
+ .long 0
+ .global file2data1
+file2data1:
+ .long 0
+ .long file2data1
+ .global file2data2
+file2data2:
+ .long file2text2
+ .global file2data3
+file2data3:
+ .long file1data3
+ .global file2data4
+file2data4:
+ .long file1text4
+ .long unresolved2
+ .long unresolved4
+
+ .long datalabel oa1
+ .long datalabel oa2
+ .long datalabel oa3
+ .long oa13
+ .long oc13
+ .long datalabel oa4
+ .long datalabel oa12
+ .long datalabel oa13
+ .long datalabel oa23
+ .long oa23
+ .long oa123
+ .long oc3
+ .long datalabel oa123
+ .long datalabel ob1
+ .long datalabel ob2
+ .long datalabel ob3
+ .long datalabel ob4
+ .long oa3
+ .long oc23
+ .long oc123
+ .long datalabel ob12
+ .long datalabel ob13
+ .long ob13
+ .long ob23
+ .long datalabel ob23
+ .long datalabel ob123
+ .long datalabel oc1
+ .long ob3
+ .long ob123
+ .long datalabel oc2
+ .long datalabel oc3
+ .long datalabel oc4
+ .long datalabel oc12
+ .long datalabel oc13
+ .long datalabel oc23
+ .long datalabel oc123
+
+ .long datalabel a1
+ .long c2
+ .long b23
+ .long datalabel b1
+ .long datalabel c1
+ .long datalabel a12
+ .long a2
+ .long b2
+ .long datalabel b12
+ .long datalabel c12
+ .long b123
+ .long c123
+ .long datalabel a13
+ .long datalabel b13
+ .long c23
+ .long a123
+ .long datalabel c13
+ .long datalabel a123
+ .long c12
+ .long a23
+ .long datalabel b123
+ .long a12
+ .long b12
+ .long datalabel c123
diff --git a/ld/testsuite/ld-sh/sh64/reldl32.rd b/ld/testsuite/ld-sh/sh64/reldl32.rd
new file mode 100644
index 0000000..20ab9a5
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/reldl32.rd
@@ -0,0 +1,360 @@
+
+Relocation section '\.rela\.text' at offset 0x4d0 contains 26 entries:
+[ ]*Offset[ ]+Info[ ]+Type[ ]+Symbol's Value[ ]+Symbol's Name[ ]+Addend
+[ ]*00000008 0+5ff6 R_SH_IMM_LOW16[ ]+00000004 file1text1[ ]+\+ 0
+[ ]*0000000c 0+31f6 R_SH_IMM_LOW16[ ]+0000000c file1data2[ ]+\+ 0
+[ ]*00000010 0+34f6 R_SH_IMM_LOW16[ ]+00000070 file2text3[ ]+\+ 0
+[ ]*00000014 0+13f6 R_SH_IMM_LOW16[ ]+0000012c file2data4[ ]+\+ 0
+[ ]*00000018 0+50f6 R_SH_IMM_LOW16[ ]+00000000 unresolved1[ ]+\+ 0
+[ ]*0000001c 0+55f6 R_SH_IMM_LOW16[ ]+00000000 unresolved6[ ]+\+ 0
+[ ]*00000020 0+61f6 R_SH_IMM_LOW16[ ]+00000000 file1text1[ ]+\+ 0
+[ ]*00000024 0+61f6 R_SH_IMM_LOW16[ ]+00000000 file1text1[ ]+\+ 18
+[ ]*00000028 0+25f6 R_SH_IMM_LOW16[ ]+00000000 file1text5[ ]+\+ 8
+[ ]*0000002c 0+31f6 R_SH_IMM_LOW16[ ]+0000000c file1data2[ ]+\+ 30
+[ ]*00000030 0+31f6 R_SH_IMM_LOW16[ ]+0000000c file1data2[ ]+\+ 0
+[ ]*0000003c 0+46f6 R_SH_IMM_LOW16[ ]+00000000 unresolved7[ ]+\+ 0
+[ ]*00000040 0+2bf6 R_SH_IMM_LOW16[ ]+00000000 unresolved1[ ]+\+ 0
+[ ]*00000034 0+39f8 R_SH_IMM_MEDLOW16[ ]+00000000 file2data4[ ]+\+ 10
+[ ]*00000038 0+39f6 R_SH_IMM_LOW16[ ]+00000000 file2data4[ ]+\+ 10
+[ ]*00000068 0+0cf6 R_SH_IMM_LOW16[ ]+00000064 file2text1[ ]+\+ 0
+[ ]*0000006c 0+28f6 R_SH_IMM_LOW16[ ]+00000124 file2data2[ ]+\+ 0
+[ ]*00000070 0+27f6 R_SH_IMM_LOW16[ ]+00000010 file1text3[ ]+\+ 0
+[ ]*00000074 0+85f6 R_SH_IMM_LOW16[ ]+00000014 file1data4[ ]+\+ 0
+[ ]*00000078 0+50f6 R_SH_IMM_LOW16[ ]+00000000 unresolved1[ ]+\+ 0
+[ ]*0000007c 0+68f6 R_SH_IMM_LOW16[ ]+00000000 unresolved3[ ]+\+ 0
+[ ]*00000080 0+89f6 R_SH_IMM_LOW16[ ]+00000000 unresolved8[ ]+\+ 0
+[ ]*00000084 0+36f6 R_SH_IMM_LOW16[ ]+00000000 unresolved9[ ]+\+ 0
+[ ]*00000088 0+61f6 R_SH_IMM_LOW16[ ]+00000000 file1text1[ ]+\+ 0
+[ ]*0000008c 0+4ff6 R_SH_IMM_LOW16[ ]+00000000 file1data2[ ]+\+ 0
+[ ]*00000090 0+2cf6 R_SH_IMM_LOW16[ ]+00000000 file1data3[ ]+\+ 0
+
+Relocation section '\.rela\.data' at offset 0x608 contains 134 entries:
+[ ]*Offset[ ]+Info[ ]+Type[ ]+Symbol's Value[ ]+Symbol's Name[ ]+Addend
+[ ]*00000008 0+0f01 R_SH_DIR32[ ]+00000004 file1data1[ ]+\+ 0
+[ ]*0000000c 0+0b01 R_SH_DIR32[ ]+0000000c file1text2[ ]+\+ 0
+[ ]*00000010 0+7c01 R_SH_DIR32[ ]+00000128 file2data3[ ]+\+ 0
+[ ]*00000014 0+6b01 R_SH_DIR32[ ]+00000074 file2text4[ ]+\+ 0
+[ ]*00000018 0+7801 R_SH_DIR32[ ]+00000000 unresolved2[ ]+\+ 0
+[ ]*0000001c 0+0901 R_SH_DIR32[ ]+00000000 unresolved5[ ]+\+ 0
+[ ]*00000020 0+7001 R_SH_DIR32[ ]+00000000 unresolved6[ ]+\+ 0
+[ ]*00000024 0+0a01 R_SH_DIR32[ ]+00000000 unresolved9[ ]+\+ 0
+[ ]*00000028 0+7e01 R_SH_DIR32[ ]+00000000 a1[ ]+\+ 0
+[ ]*0000002c 0+7401 R_SH_DIR32[ ]+00000000 a23[ ]+\+ 0
+[ ]*00000030 0+5801 R_SH_DIR32[ ]+0000003c b123[ ]+\+ 0
+[ ]*00000034 0+6e01 R_SH_DIR32[ ]+0000009c c3[ ]+\+ 0
+[ ]*00000038 0+4001 R_SH_DIR32[ ]+000000a8 c13[ ]+\+ 0
+[ ]*0000003c 0+2a01 R_SH_DIR32[ ]+00000000 a2[ ]+\+ 0
+[ ]*00000040 0+5201 R_SH_DIR32[ ]+00000000 a3[ ]+\+ 0
+[ ]*00000044 0+2901 R_SH_DIR32[ ]+00000000 a4[ ]+\+ 0
+[ ]*00000048 0+6d01 R_SH_DIR32[ ]+00000000 a12[ ]+\+ 0
+[ ]*0000004c 0+1901 R_SH_DIR32[ ]+00000000 a13[ ]+\+ 0
+[ ]*00000050 0+7a01 R_SH_DIR32[ ]+00000000 a23[ ]+\+ 0
+[ ]*00000054 0+6601 R_SH_DIR32[ ]+00000000 a123[ ]+\+ 0
+[ ]*00000058 0+4101 R_SH_DIR32[ ]+00000000 b1[ ]+\+ 0
+[ ]*0000005c 0+7501 R_SH_DIR32[ ]+00000000 b2[ ]+\+ 0
+[ ]*00000060 0+3301 R_SH_DIR32[ ]+00000000 a3[ ]+\+ 0
+[ ]*00000064 0+8301 R_SH_DIR32[ ]+00000000 a13[ ]+\+ 0
+[ ]*00000068 0+3201 R_SH_DIR32[ ]+00000000 b3[ ]+\+ 0
+[ ]*0000006c 0+6c01 R_SH_DIR32[ ]+00000000 b4[ ]+\+ 0
+[ ]*00000070 0+5601 R_SH_DIR32[ ]+00000000 b12[ ]+\+ 0
+[ ]*00000074 0+2d01 R_SH_DIR32[ ]+00000000 b13[ ]+\+ 0
+[ ]*00000078 0+4201 R_SH_DIR32[ ]+00000000 a123[ ]+\+ 0
+[ ]*0000007c 0+6901 R_SH_DIR32[ ]+00000024 b3[ ]+\+ 0
+[ ]*00000080 0+3f01 R_SH_DIR32[ ]+00000030 b13[ ]+\+ 0
+[ ]*00000084 0+7301 R_SH_DIR32[ ]+00000034 b23[ ]+\+ 0
+[ ]*00000088 0+8101 R_SH_DIR32[ ]+00000000 b23[ ]+\+ 0
+[ ]*0000008c 0+1001 R_SH_DIR32[ ]+00000000 b123[ ]+\+ 0
+[ ]*00000090 0+8701 R_SH_DIR32[ ]+00000000 c1[ ]+\+ 0
+[ ]*00000094 0+3001 R_SH_DIR32[ ]+00000000 c2[ ]+\+ 0
+[ ]*00000098 0+6701 R_SH_DIR32[ ]+00000000 c3[ ]+\+ 0
+[ ]*0000009c 0+3d01 R_SH_DIR32[ ]+000000ac c23[ ]+\+ 0
+[ ]*000000a0 0+8201 R_SH_DIR32[ ]+000000b0 c123[ ]+\+ 0
+[ ]*000000a4 0+1201 R_SH_DIR32[ ]+00000000 c4[ ]+\+ 0
+[ ]*000000a8 0+2401 R_SH_DIR32[ ]+00000000 c12[ ]+\+ 0
+[ ]*000000ac 0+3501 R_SH_DIR32[ ]+00000000 c13[ ]+\+ 0
+[ ]*000000b0 0+3a01 R_SH_DIR32[ ]+00000000 c23[ ]+\+ 0
+[ ]*000000b4 0+3e01 R_SH_DIR32[ ]+00000000 c123[ ]+\+ 0
+[ ]*000000b8 0+4c01 R_SH_DIR32[ ]+00000000 oa1[ ]+\+ 0
+[ ]*000000bc 0+1801 R_SH_DIR32[ ]+00000000 ob1[ ]+\+ 0
+[ ]*000000c0 0+4801 R_SH_DIR32[ ]+000000d0 ob123[ ]+\+ 0
+[ ]*000000c4 0+5d01 R_SH_DIR32[ ]+00000000 oc1[ ]+\+ 0
+[ ]*000000c8 0+7d01 R_SH_DIR32[ ]+00000000 oa2[ ]+\+ 0
+[ ]*000000cc 0+6501 R_SH_DIR32[ ]+000000b8 ob2[ ]+\+ 0
+[ ]*000000d0 0+7601 R_SH_DIR32[ ]+00000044 oc2[ ]+\+ 0
+[ ]*000000d4 0+4d01 R_SH_DIR32[ ]+00000000 oa12[ ]+\+ 0
+[ ]*000000d8 0+1f01 R_SH_DIR32[ ]+00000000 oa12[ ]+\+ 0
+[ ]*000000dc 0+6401 R_SH_DIR32[ ]+00000000 ob12[ ]+\+ 0
+[ ]*000000e0 0+4e01 R_SH_DIR32[ ]+000000c4 ob12[ ]+\+ 0
+[ ]*000000e4 0+5e01 R_SH_DIR32[ ]+00000000 oc12[ ]+\+ 0
+[ ]*000000e8 0+1601 R_SH_DIR32[ ]+00000050 oc12[ ]+\+ 0
+[ ]*000000ec 0+4301 R_SH_DIR32[ ]+00000000 oa23[ ]+\+ 0
+[ ]*000000f0 0+4901 R_SH_DIR32[ ]+00000000 oa13[ ]+\+ 0
+[ ]*000000f4 0+0e01 R_SH_DIR32[ ]+0000005c oc123[ ]+\+ 0
+[ ]*000000f8 0+5901 R_SH_DIR32[ ]+00000000 ob13[ ]+\+ 0
+[ ]*000000fc 0+6001 R_SH_DIR32[ ]+00000000 oc13[ ]+\+ 0
+[ ]*00000100 0+8601 R_SH_DIR32[ ]+000000cc ob23[ ]+\+ 0
+[ ]*00000104 0+2f01 R_SH_DIR32[ ]+00000058 oc23[ ]+\+ 0
+[ ]*00000108 0+5b01 R_SH_DIR32[ ]+00000000 oa123[ ]+\+ 0
+[ ]*0000010c 0+5401 R_SH_DIR32[ ]+00000000 oa123[ ]+\+ 0
+[ ]*00000110 0+6a01 R_SH_DIR32[ ]+00000000 ob123[ ]+\+ 0
+[ ]*00000114 0+3701 R_SH_DIR32[ ]+00000000 oc123[ ]+\+ 0
+[ ]*00000120 0+8001 R_SH_DIR32[ ]+0000011c file2data1[ ]+\+ 0
+[ ]*00000124 0+6201 R_SH_DIR32[ ]+0000006c file2text2[ ]+\+ 0
+[ ]*00000128 0+8401 R_SH_DIR32[ ]+00000010 file1data3[ ]+\+ 0
+[ ]*0000012c 0+7b01 R_SH_DIR32[ ]+00000014 file1text4[ ]+\+ 0
+[ ]*00000130 0+7801 R_SH_DIR32[ ]+00000000 unresolved2[ ]+\+ 0
+[ ]*00000134 0+7f01 R_SH_DIR32[ ]+00000000 unresolved4[ ]+\+ 0
+[ ]*00000138 0+4c01 R_SH_DIR32[ ]+00000000 oa1[ ]+\+ 0
+[ ]*0000013c 0+1b01 R_SH_DIR32[ ]+00000000 oa2[ ]+\+ 0
+[ ]*00000140 0+7101 R_SH_DIR32[ ]+00000000 oa3[ ]+\+ 0
+[ ]*00000144 0+2001 R_SH_DIR32[ ]+00000000 oa13[ ]+\+ 0
+[ ]*00000148 0+1d01 R_SH_DIR32[ ]+00000054 oc13[ ]+\+ 0
+[ ]*0000014c 0+1401 R_SH_DIR32[ ]+00000000 oa4[ ]+\+ 0
+[ ]*00000150 0+1f01 R_SH_DIR32[ ]+00000000 oa12[ ]+\+ 0
+[ ]*00000154 0+4901 R_SH_DIR32[ ]+00000000 oa13[ ]+\+ 0
+[ ]*00000158 0+3c01 R_SH_DIR32[ ]+00000000 oa23[ ]+\+ 0
+[ ]*0000015c 0+4301 R_SH_DIR32[ ]+00000000 oa23[ ]+\+ 0
+[ ]*00000160 0+5b01 R_SH_DIR32[ ]+00000000 oa123[ ]+\+ 0
+[ ]*00000164 0+1a01 R_SH_DIR32[ ]+00000048 oc3[ ]+\+ 0
+[ ]*00000168 0+5401 R_SH_DIR32[ ]+00000000 oa123[ ]+\+ 0
+[ ]*0000016c 0+1801 R_SH_DIR32[ ]+00000000 ob1[ ]+\+ 0
+[ ]*00000170 0+2601 R_SH_DIR32[ ]+00000000 ob2[ ]+\+ 0
+[ ]*00000174 0+6301 R_SH_DIR32[ ]+00000000 ob3[ ]+\+ 0
+[ ]*00000178 0+1701 R_SH_DIR32[ ]+00000000 ob4[ ]+\+ 0
+[ ]*0000017c 0+8801 R_SH_DIR32[ ]+00000000 oa3[ ]+\+ 0
+[ ]*00000180 0+2f01 R_SH_DIR32[ ]+00000058 oc23[ ]+\+ 0
+[ ]*00000184 0+0e01 R_SH_DIR32[ ]+0000005c oc123[ ]+\+ 0
+[ ]*00000188 0+6401 R_SH_DIR32[ ]+00000000 ob12[ ]+\+ 0
+[ ]*0000018c 0+5901 R_SH_DIR32[ ]+00000000 ob13[ ]+\+ 0
+[ ]*00000190 0+5101 R_SH_DIR32[ ]+000000c8 ob13[ ]+\+ 0
+[ ]*00000194 0+8601 R_SH_DIR32[ ]+000000cc ob23[ ]+\+ 0
+[ ]*00000198 0+5c01 R_SH_DIR32[ ]+00000000 ob23[ ]+\+ 0
+[ ]*0000019c 0+6a01 R_SH_DIR32[ ]+00000000 ob123[ ]+\+ 0
+[ ]*000001a0 0+5d01 R_SH_DIR32[ ]+00000000 oc1[ ]+\+ 0
+[ ]*000001a4 0+1501 R_SH_DIR32[ ]+000000bc ob3[ ]+\+ 0
+[ ]*000001a8 0+4801 R_SH_DIR32[ ]+000000d0 ob123[ ]+\+ 0
+[ ]*000001ac 0+0d01 R_SH_DIR32[ ]+00000000 oc2[ ]+\+ 0
+[ ]*000001b0 0+3b01 R_SH_DIR32[ ]+00000000 oc3[ ]+\+ 0
+[ ]*000001b4 0+5701 R_SH_DIR32[ ]+00000000 oc4[ ]+\+ 0
+[ ]*000001b8 0+5e01 R_SH_DIR32[ ]+00000000 oc12[ ]+\+ 0
+[ ]*000001bc 0+6001 R_SH_DIR32[ ]+00000000 oc13[ ]+\+ 0
+[ ]*000001c0 0+2e01 R_SH_DIR32[ ]+00000000 oc23[ ]+\+ 0
+[ ]*000001c4 0+3701 R_SH_DIR32[ ]+00000000 oc123[ ]+\+ 0
+[ ]*000001c8 0+7e01 R_SH_DIR32[ ]+00000000 a1[ ]+\+ 0
+[ ]*000001cc 0+1e01 R_SH_DIR32[ ]+00000098 c2[ ]+\+ 0
+[ ]*000001d0 0+7301 R_SH_DIR32[ ]+00000034 b23[ ]+\+ 0
+[ ]*000001d4 0+4101 R_SH_DIR32[ ]+00000000 b1[ ]+\+ 0
+[ ]*000001d8 0+8701 R_SH_DIR32[ ]+00000000 c1[ ]+\+ 0
+[ ]*000001dc 0+6d01 R_SH_DIR32[ ]+00000000 a12[ ]+\+ 0
+[ ]*000001e0 0+5a01 R_SH_DIR32[ ]+00000000 a2[ ]+\+ 0
+[ ]*000001e4 0+1101 R_SH_DIR32[ ]+00000020 b2[ ]+\+ 0
+[ ]*000001e8 0+5601 R_SH_DIR32[ ]+00000000 b12[ ]+\+ 0
+[ ]*000001ec 0+2401 R_SH_DIR32[ ]+00000000 c12[ ]+\+ 0
+[ ]*000001f0 0+5801 R_SH_DIR32[ ]+0000003c b123[ ]+\+ 0
+[ ]*000001f4 0+8201 R_SH_DIR32[ ]+000000b0 c123[ ]+\+ 0
+[ ]*000001f8 0+1901 R_SH_DIR32[ ]+00000000 a13[ ]+\+ 0
+[ ]*000001fc 0+2d01 R_SH_DIR32[ ]+00000000 b13[ ]+\+ 0
+[ ]*00000200 0+3d01 R_SH_DIR32[ ]+000000ac c23[ ]+\+ 0
+[ ]*00000204 0+4201 R_SH_DIR32[ ]+00000000 a123[ ]+\+ 0
+[ ]*00000208 0+3501 R_SH_DIR32[ ]+00000000 c13[ ]+\+ 0
+[ ]*0000020c 0+6601 R_SH_DIR32[ ]+00000000 a123[ ]+\+ 0
+[ ]*00000210 0+7201 R_SH_DIR32[ ]+000000a4 c12[ ]+\+ 0
+[ ]*00000214 0+7401 R_SH_DIR32[ ]+00000000 a23[ ]+\+ 0
+[ ]*00000218 0+1001 R_SH_DIR32[ ]+00000000 b123[ ]+\+ 0
+[ ]*0000021c 0+4401 R_SH_DIR32[ ]+00000000 a12[ ]+\+ 0
+[ ]*00000220 0+7701 R_SH_DIR32[ ]+0000002c b12[ ]+\+ 0
+[ ]*00000224 0+3e01 R_SH_DIR32[ ]+00000000 c123[ ]+\+ 0
+
+Symbol table '\.symtab' contains 138 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 00000000 0 SECTION LOCAL DEFAULT 1
+ 2: 00000000 0 SECTION LOCAL DEFAULT 2
+ 3: 00000000 0 SECTION LOCAL DEFAULT 3
+ 4: 00000000 0 SECTION LOCAL DEFAULT 4
+ 5: 00000000 0 SECTION LOCAL DEFAULT 5
+ 6: 00000000 0 SECTION LOCAL DEFAULT 6
+ 7: 00000000 0 SECTION LOCAL DEFAULT 7
+ 8: 00000000 0 SECTION LOCAL DEFAULT 8
+ 9: 00000000 0 NOTYPE GLOBAL DEFAULT UND unresolved5
+ 10: 00000000 0 NOTYPE GLOBAL DEFAULT UND unresolved9
+ 11: 0000000c 0 NOTYPE GLOBAL DEFAULT 1 file1text2
+ 12: 00000064 0 NOTYPE GLOBAL DEFAULT 1 file2text1
+ 13: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND oc2
+ 14: 0000005c 0 NOTYPE GLOBAL DEFAULT 1 oc123
+ 15: 00000004 0 NOTYPE GLOBAL DEFAULT 3 file1data1
+ 16: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND b123
+ 17: 00000020 0 NOTYPE GLOBAL DEFAULT 1 b2
+ 18: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND c4
+ 19: 0000012c 0 NOTYPE GLOBAL DEFAULT 3 file2data4
+ 20: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND oa4
+ 21: 000000bc 0 NOTYPE GLOBAL DEFAULT 1 ob3
+ 22: 00000050 0 NOTYPE GLOBAL DEFAULT 1 oc12
+ 23: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND ob4
+ 24: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND ob1
+ 25: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND a13
+ 26: 00000048 0 NOTYPE GLOBAL DEFAULT 1 oc3
+ 27: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND oa2
+ 28: 000000a0 0 NOTYPE GLOBAL DEFAULT 1 c4
+ 29: 00000054 0 NOTYPE GLOBAL DEFAULT 1 oc13
+ 30: 00000098 0 NOTYPE GLOBAL DEFAULT 1 c2
+ 31: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND oa12
+ 32: 00000000 0 NOTYPE GLOBAL DEFAULT UND oa13
+ 33: 000000c0 0 NOTYPE GLOBAL DEFAULT 1 ob4
+ 34: 0000001c 0 NOTYPE GLOBAL DEFAULT 1 b1
+ 35: 00000018 0 NOTYPE GLOBAL DEFAULT 1 file1text5
+ 36: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND c12
+ 37: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND file1text5
+ 38: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND ob2
+ 39: 00000010 0 NOTYPE GLOBAL DEFAULT 1 file1text3
+ 40: 00000124 0 NOTYPE GLOBAL DEFAULT 3 file2data2
+ 41: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND a4
+ 42: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND a2
+ 43: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND unresolved1
+ 44: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND file1data3
+ 45: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND b13
+ 46: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND oc23
+ 47: 00000058 0 NOTYPE GLOBAL DEFAULT 1 oc23
+ 48: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND c2
+ 49: 0000000c 0 NOTYPE GLOBAL DEFAULT 3 file1data2
+ 50: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND b3
+ 51: 00000000 0 NOTYPE GLOBAL DEFAULT UND a3
+ 52: 00000070 0 NOTYPE GLOBAL DEFAULT 1 file2text3
+ 53: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND c13
+ 54: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND unresolved9
+ 55: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND oc123
+ 56: 00000028 0 NOTYPE GLOBAL DEFAULT 1 b4
+ 57: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND file2data4
+ 58: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND c23
+ 59: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND oc3
+ 60: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND oa23
+ 61: 000000ac 0 NOTYPE GLOBAL DEFAULT 1 c23
+ 62: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND c123
+ 63: 00000030 0 NOTYPE GLOBAL DEFAULT 1 b13
+ 64: 000000a8 0 NOTYPE GLOBAL DEFAULT 1 c13
+ 65: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND b1
+ 66: 00000000 0 NOTYPE GLOBAL DEFAULT UND a123
+ 67: 00000000 0 NOTYPE GLOBAL DEFAULT UND oa23
+ 68: 00000000 0 NOTYPE GLOBAL DEFAULT UND a12
+ 69: 000000b4 0 NOTYPE GLOBAL DEFAULT 1 ob1
+ 70: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND unresolved7
+ 71: 00000060 0 NOTYPE GLOBAL DEFAULT 1 start2
+ 72: 000000d0 0 NOTYPE GLOBAL DEFAULT 1 ob123
+ 73: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND oa13
+ 74: 00000094 0 NOTYPE GLOBAL DEFAULT 1 c1
+ 75: 0000004c 0 NOTYPE GLOBAL DEFAULT 1 oc4
+ 76: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND oa1
+ 77: 00000000 0 NOTYPE GLOBAL DEFAULT UND oa12
+ 78: 000000c4 0 NOTYPE GLOBAL DEFAULT 1 ob12
+ 79: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND file1data2
+ 80: 00000000 0 NOTYPE GLOBAL DEFAULT UND unresolved1
+ 81: 000000c8 0 NOTYPE GLOBAL DEFAULT 1 ob13
+ 82: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND a3
+ 83: 00000018 0 NOTYPE GLOBAL DEFAULT 3 file1data5
+ 84: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND oa123
+ 85: 00000000 0 NOTYPE GLOBAL DEFAULT UND unresolved6
+ 86: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND b12
+ 87: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND oc4
+ 88: 0000003c 0 NOTYPE GLOBAL DEFAULT 1 b123
+ 89: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND ob13
+ 90: 00000000 0 NOTYPE GLOBAL DEFAULT UND a2
+ 91: 00000000 0 NOTYPE GLOBAL DEFAULT UND oa123
+ 92: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND ob23
+ 93: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND oc1
+ 94: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND oc12
+ 95: 00000004 0 NOTYPE GLOBAL DEFAULT 1 file1text1
+ 96: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND oc13
+ 97: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND file1text1
+ 98: 0000006c 0 NOTYPE GLOBAL DEFAULT 1 file2text2
+ 99: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND ob3
+ 100: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND ob12
+ 101: 000000b8 0 NOTYPE GLOBAL DEFAULT 1 ob2
+ 102: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND a123
+ 103: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND c3
+ 104: 00000000 0 NOTYPE GLOBAL DEFAULT UND unresolved3
+ 105: 00000024 0 NOTYPE GLOBAL DEFAULT 1 b3
+ 106: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND ob123
+ 107: 00000074 0 NOTYPE GLOBAL DEFAULT 1 file2text4
+ 108: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND b4
+ 109: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND a12
+ 110: 0000009c 0 NOTYPE GLOBAL DEFAULT 1 c3
+ 111: 00000040 0 NOTYPE GLOBAL DEFAULT 1 oc1
+ 112: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND unresolved6
+ 113: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND oa3
+ 114: 000000a4 0 NOTYPE GLOBAL DEFAULT 1 c12
+ 115: 00000034 0 NOTYPE GLOBAL DEFAULT 1 b23
+ 116: 00000000 0 NOTYPE GLOBAL DEFAULT UND a23
+ 117: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND b2
+ 118: 00000044 0 NOTYPE GLOBAL DEFAULT 1 oc2
+ 119: 0000002c 0 NOTYPE GLOBAL DEFAULT 1 b12
+ 120: 00000000 0 NOTYPE GLOBAL DEFAULT UND unresolved2
+ 121: 00000000 0 NOTYPE GLOBAL DEFAULT 1 start
+ 122: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND a23
+ 123: 00000014 0 NOTYPE GLOBAL DEFAULT 1 file1text4
+ 124: 00000128 0 NOTYPE GLOBAL DEFAULT 3 file2data3
+ 125: 00000000 0 NOTYPE GLOBAL DEFAULT UND oa2
+ 126: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND a1
+ 127: 00000000 0 NOTYPE GLOBAL DEFAULT UND unresolved4
+ 128: 0000011c 0 NOTYPE GLOBAL DEFAULT 3 file2data1
+ 129: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND b23
+ 130: 000000b0 0 NOTYPE GLOBAL DEFAULT 1 c123
+ 131: 00000000 0 NOTYPE GLOBAL DEFAULT UND a13
+ 132: 00000010 0 NOTYPE GLOBAL DEFAULT 3 file1data3
+ 133: 00000014 0 NOTYPE GLOBAL DEFAULT 3 file1data4
+ 134: 000000cc 0 NOTYPE GLOBAL DEFAULT 1 ob23
+ 135: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND c1
+ 136: 00000000 0 NOTYPE GLOBAL DEFAULT UND oa3
+ 137: 00000000 0 <processor specific>: 13 GLOBAL DEFAULT UND unresolved8
+
+Hex dump of section '\.text':
+ 0x00000000 6ff0fff0 6ff0fff0 cc0000a0 cc000140 .*
+ 0x00000010 cc000140 cc000140 cc000280 cc0001e0 .*
+ 0x00000020 cc0000a0 cc0000a0 cc000280 cc000140 .*
+ 0x00000030 cc000140 cc000320 c8000320 cc0003c0 .*
+ 0x00000040 cc0003c0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00000050 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00000060 6ff0fff0 6ff0fff0 cc0000a0 cc000140 .*
+ 0x00000070 cc000140 cc000140 cc0001e0 cc0001e0 .*
+ 0x00000080 cc000320 cc000320 cc000280 cc000280 .*
+ 0x00000090 cc000280 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x000000a0 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x000000b0 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x000000c0 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x000000d0 6ff0fff0 .*
+
+Hex dump of section '\.data':
+ 0x00000000 00000000 00000000 00000008 00000000 .*
+ 0x00000010 00000000 00000000 00000000 00000000 .*
+ 0x00000020 00000028 00000000 00000000 00000000 .*
+ 0x00000030 00000000 00000000 00000000 00000000 .*
+ 0x00000040 00000000 00000000 00000000 00000000 .*
+ 0x00000050 00000000 00000000 00000000 00000000 .*
+ 0x00000060 00000000 00000000 00000000 00000000 .*
+ 0x00000070 00000000 00000000 00000000 00000000 .*
+ 0x00000080 00000000 00000000 00000000 00000000 .*
+ 0x00000090 00000000 00000000 00000000 00000000 .*
+ 0x000000a0 00000000 00000000 00000000 00000000 .*
+ 0x000000b0 00000000 00000000 00000000 00000000 .*
+ 0x000000c0 00000000 00000000 00000000 00000000 .*
+ 0x000000d0 00000000 00000000 00000000 00000000 .*
+ 0x000000e0 00000000 00000000 00000000 00000000 .*
+ 0x000000f0 00000000 00000000 00000000 00000000 .*
+ 0x00000100 00000000 00000000 00000000 00000000 .*
+ 0x00000110 00000000 00000000 00000000 00000000 .*
+ 0x00000120 00000000 00000000 00000000 00000000 .*
+ 0x00000130 00000000 00000000 00000000 00000000 .*
+ 0x00000140 00000000 00000000 00000000 00000000 .*
+ 0x00000150 00000000 00000000 00000000 00000000 .*
+ 0x00000160 00000000 00000000 00000000 00000000 .*
+ 0x00000170 00000000 00000000 00000000 00000000 .*
+ 0x00000180 00000000 00000000 00000000 00000000 .*
+ 0x00000190 00000000 00000000 00000000 00000000 .*
+ 0x000001a0 00000000 00000000 00000000 00000000 .*
+ 0x000001b0 00000000 00000000 00000000 00000000 .*
+ 0x000001c0 00000000 00000000 00000000 00000000 .*
+ 0x000001d0 00000000 00000000 00000000 00000000 .*
+ 0x000001e0 00000000 00000000 00000000 00000000 .*
+ 0x000001f0 00000000 00000000 00000000 00000000 .*
+ 0x00000200 00000000 00000000 00000000 00000000 .*
+ 0x00000210 00000000 00000000 00000000 00000000 .*
+ 0x00000220 00000000 00000000 .*
diff --git a/ld/testsuite/ld-sh/sh64/reldl64.rd b/ld/testsuite/ld-sh/sh64/reldl64.rd
new file mode 100644
index 0000000..2eabf78
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/reldl64.rd
@@ -0,0 +1,362 @@
+
+Relocation section '\.rela\.text' at offset 0x5c0 contains 28 entries:
+[ ]*Offset[ ]+Info[ ]+Type[ ]+Symbol's Value[ ]+Symbol's Name[ ]+Addend
+[ ]*0+8 000f6 R_SH_IMM_LOW16[ ]+0+4 file1text1[ ]+\+ 0
+[ ]*0+c 000f6 R_SH_IMM_LOW16[ ]+0+c file1data2[ ]+\+ 0
+[ ]*0+10 000f6 R_SH_IMM_LOW16[ ]+0+78 file2text3[ ]+\+ 0
+[ ]*0+14 000f6 R_SH_IMM_LOW16[ ]+0+12c file2data4[ ]+\+ 0
+[ ]*0+18 000f6 R_SH_IMM_LOW16[ ]+0+ unresolved1[ ]+\+ 0
+[ ]*0+1c 000f6 R_SH_IMM_LOW16[ ]+0+ unresolved6[ ]+\+ 0
+[ ]*0+20 000f6 R_SH_IMM_LOW16[ ]+0+ file1text1[ ]+\+ 0
+[ ]*0+24 000f6 R_SH_IMM_LOW16[ ]+0+ file1text1[ ]+\+ 18
+[ ]*0+28 000f6 R_SH_IMM_LOW16[ ]+0+ file1text5[ ]+\+ 8
+[ ]*0+2c 000f6 R_SH_IMM_LOW16[ ]+0+c file1data2[ ]+\+ 30
+[ ]*0+30 000f6 R_SH_IMM_LOW16[ ]+0+c file1data2[ ]+\+ 0
+[ ]*0+44 000f6 R_SH_IMM_LOW16[ ]+0+ unresolved7[ ]+\+ 0
+[ ]*0+48 000f6 R_SH_IMM_LOW16[ ]+0+ unresolved1[ ]+\+ 0
+[ ]*0+34 000fc R_SH_IMM_HI16[ ]+0+ file2data4[ ]+\+ 10
+[ ]*0+38 000fa R_SH_IMM_MEDHI16[ ]+0+ file2data4[ ]+\+ 10
+[ ]*0+3c 000f8 R_SH_IMM_MEDLOW16[ ]+0+ file2data4[ ]+\+ 10
+[ ]*0+40 000f6 R_SH_IMM_LOW16[ ]+0+ file2data4[ ]+\+ 10
+[ ]*0+70 000f6 R_SH_IMM_LOW16[ ]+0+6c file2text1[ ]+\+ 0
+[ ]*0+74 000f6 R_SH_IMM_LOW16[ ]+0+124 file2data2[ ]+\+ 0
+[ ]*0+78 000f6 R_SH_IMM_LOW16[ ]+0+10 file1text3[ ]+\+ 0
+[ ]*0+7c 000f6 R_SH_IMM_LOW16[ ]+0+14 file1data4[ ]+\+ 0
+[ ]*0+80 000f6 R_SH_IMM_LOW16[ ]+0+ unresolved1[ ]+\+ 0
+[ ]*0+84 000f6 R_SH_IMM_LOW16[ ]+0+ unresolved3[ ]+\+ 0
+[ ]*0+88 000f6 R_SH_IMM_LOW16[ ]+0+ unresolved8[ ]+\+ 0
+[ ]*0+8c 000f6 R_SH_IMM_LOW16[ ]+0+ unresolved9[ ]+\+ 0
+[ ]*0+90 000f6 R_SH_IMM_LOW16[ ]+0+ file1text1[ ]+\+ 0
+[ ]*0+94 000f6 R_SH_IMM_LOW16[ ]+0+ file1data2[ ]+\+ 0
+[ ]*0+98 000f6 R_SH_IMM_LOW16[ ]+0+ file1data3[ ]+\+ 0
+
+Relocation section '\.rela\.data' at offset 0x860 contains 134 entries:
+[ ]*Offset[ ]+Info[ ]+Type[ ]+Symbol's Value[ ]+Symbol's Name[ ]+Addend
+[ ]*0+8 00001 R_SH_DIR32[ ]+0+4 file1data1[ ]+\+ 0
+[ ]*0+c 00001 R_SH_DIR32[ ]+0+c file1text2[ ]+\+ 0
+[ ]*0+10 00001 R_SH_DIR32[ ]+0+128 file2data3[ ]+\+ 0
+[ ]*0+14 00001 R_SH_DIR32[ ]+0+7c file2text4[ ]+\+ 0
+[ ]*0+18 00001 R_SH_DIR32[ ]+0+ unresolved2[ ]+\+ 0
+[ ]*0+1c 00001 R_SH_DIR32[ ]+0+ unresolved5[ ]+\+ 0
+[ ]*0+20 00001 R_SH_DIR32[ ]+0+ unresolved6[ ]+\+ 0
+[ ]*0+24 00001 R_SH_DIR32[ ]+0+ unresolved9[ ]+\+ 0
+[ ]*0+28 00001 R_SH_DIR32[ ]+0+ a1[ ]+\+ 0
+[ ]*0+2c 00001 R_SH_DIR32[ ]+0+ a23[ ]+\+ 0
+[ ]*0+30 00001 R_SH_DIR32[ ]+0+44 b123[ ]+\+ 0
+[ ]*0+34 00001 R_SH_DIR32[ ]+0+a4 c3[ ]+\+ 0
+[ ]*0+38 00001 R_SH_DIR32[ ]+0+b0 c13[ ]+\+ 0
+[ ]*0+3c 00001 R_SH_DIR32[ ]+0+ a2[ ]+\+ 0
+[ ]*0+40 00001 R_SH_DIR32[ ]+0+ a3[ ]+\+ 0
+[ ]*0+44 00001 R_SH_DIR32[ ]+0+ a4[ ]+\+ 0
+[ ]*0+48 00001 R_SH_DIR32[ ]+0+ a12[ ]+\+ 0
+[ ]*0+4c 00001 R_SH_DIR32[ ]+0+ a13[ ]+\+ 0
+[ ]*0+50 00001 R_SH_DIR32[ ]+0+ a23[ ]+\+ 0
+[ ]*0+54 00001 R_SH_DIR32[ ]+0+ a123[ ]+\+ 0
+[ ]*0+58 00001 R_SH_DIR32[ ]+0+ b1[ ]+\+ 0
+[ ]*0+5c 00001 R_SH_DIR32[ ]+0+ b2[ ]+\+ 0
+[ ]*0+60 00001 R_SH_DIR32[ ]+0+ a3[ ]+\+ 0
+[ ]*0+64 00001 R_SH_DIR32[ ]+0+ a13[ ]+\+ 0
+[ ]*0+68 00001 R_SH_DIR32[ ]+0+ b3[ ]+\+ 0
+[ ]*0+6c 00001 R_SH_DIR32[ ]+0+ b4[ ]+\+ 0
+[ ]*0+70 00001 R_SH_DIR32[ ]+0+ b12[ ]+\+ 0
+[ ]*0+74 00001 R_SH_DIR32[ ]+0+ b13[ ]+\+ 0
+[ ]*0+78 00001 R_SH_DIR32[ ]+0+ a123[ ]+\+ 0
+[ ]*0+7c 00001 R_SH_DIR32[ ]+0+24 b3[ ]+\+ 0
+[ ]*0+80 00001 R_SH_DIR32[ ]+0+30 b13[ ]+\+ 0
+[ ]*0+84 00001 R_SH_DIR32[ ]+0+34 b23[ ]+\+ 0
+[ ]*0+88 00001 R_SH_DIR32[ ]+0+ b23[ ]+\+ 0
+[ ]*0+8c 00001 R_SH_DIR32[ ]+0+ b123[ ]+\+ 0
+[ ]*0+90 00001 R_SH_DIR32[ ]+0+ c1[ ]+\+ 0
+[ ]*0+94 00001 R_SH_DIR32[ ]+0+ c2[ ]+\+ 0
+[ ]*0+98 00001 R_SH_DIR32[ ]+0+ c3[ ]+\+ 0
+[ ]*0+9c 00001 R_SH_DIR32[ ]+0+b4 c23[ ]+\+ 0
+[ ]*0+a0 00001 R_SH_DIR32[ ]+0+b8 c123[ ]+\+ 0
+[ ]*0+a4 00001 R_SH_DIR32[ ]+0+ c4[ ]+\+ 0
+[ ]*0+a8 00001 R_SH_DIR32[ ]+0+ c12[ ]+\+ 0
+[ ]*0+ac 00001 R_SH_DIR32[ ]+0+ c13[ ]+\+ 0
+[ ]*0+b0 00001 R_SH_DIR32[ ]+0+ c23[ ]+\+ 0
+[ ]*0+b4 00001 R_SH_DIR32[ ]+0+ c123[ ]+\+ 0
+[ ]*0+b8 00001 R_SH_DIR32[ ]+0+ oa1[ ]+\+ 0
+[ ]*0+bc 00001 R_SH_DIR32[ ]+0+ ob1[ ]+\+ 0
+[ ]*0+c0 00001 R_SH_DIR32[ ]+0+d8 ob123[ ]+\+ 0
+[ ]*0+c4 00001 R_SH_DIR32[ ]+0+ oc1[ ]+\+ 0
+[ ]*0+c8 00001 R_SH_DIR32[ ]+0+ oa2[ ]+\+ 0
+[ ]*0+cc 00001 R_SH_DIR32[ ]+0+c0 ob2[ ]+\+ 0
+[ ]*0+d0 00001 R_SH_DIR32[ ]+0+4c oc2[ ]+\+ 0
+[ ]*0+d4 00001 R_SH_DIR32[ ]+0+ oa12[ ]+\+ 0
+[ ]*0+d8 00001 R_SH_DIR32[ ]+0+ oa12[ ]+\+ 0
+[ ]*0+dc 00001 R_SH_DIR32[ ]+0+ ob12[ ]+\+ 0
+[ ]*0+e0 00001 R_SH_DIR32[ ]+0+cc ob12[ ]+\+ 0
+[ ]*0+e4 00001 R_SH_DIR32[ ]+0+ oc12[ ]+\+ 0
+[ ]*0+e8 00001 R_SH_DIR32[ ]+0+58 oc12[ ]+\+ 0
+[ ]*0+ec 00001 R_SH_DIR32[ ]+0+ oa23[ ]+\+ 0
+[ ]*0+f0 00001 R_SH_DIR32[ ]+0+ oa13[ ]+\+ 0
+[ ]*0+f4 00001 R_SH_DIR32[ ]+0+64 oc123[ ]+\+ 0
+[ ]*0+f8 00001 R_SH_DIR32[ ]+0+ ob13[ ]+\+ 0
+[ ]*0+fc 00001 R_SH_DIR32[ ]+0+ oc13[ ]+\+ 0
+[ ]*0+100 00001 R_SH_DIR32[ ]+0+d4 ob23[ ]+\+ 0
+[ ]*0+104 00001 R_SH_DIR32[ ]+0+60 oc23[ ]+\+ 0
+[ ]*0+108 00001 R_SH_DIR32[ ]+0+ oa123[ ]+\+ 0
+[ ]*0+10c 00001 R_SH_DIR32[ ]+0+ oa123[ ]+\+ 0
+[ ]*0+110 00001 R_SH_DIR32[ ]+0+ ob123[ ]+\+ 0
+[ ]*0+114 00001 R_SH_DIR32[ ]+0+ oc123[ ]+\+ 0
+[ ]*0+120 00001 R_SH_DIR32[ ]+0+11c file2data1[ ]+\+ 0
+[ ]*0+124 00001 R_SH_DIR32[ ]+0+74 file2text2[ ]+\+ 0
+[ ]*0+128 00001 R_SH_DIR32[ ]+0+10 file1data3[ ]+\+ 0
+[ ]*0+12c 00001 R_SH_DIR32[ ]+0+14 file1text4[ ]+\+ 0
+[ ]*0+130 00001 R_SH_DIR32[ ]+0+ unresolved2[ ]+\+ 0
+[ ]*0+134 00001 R_SH_DIR32[ ]+0+ unresolved4[ ]+\+ 0
+[ ]*0+138 00001 R_SH_DIR32[ ]+0+ oa1[ ]+\+ 0
+[ ]*0+13c 00001 R_SH_DIR32[ ]+0+ oa2[ ]+\+ 0
+[ ]*0+140 00001 R_SH_DIR32[ ]+0+ oa3[ ]+\+ 0
+[ ]*0+144 00001 R_SH_DIR32[ ]+0+ oa13[ ]+\+ 0
+[ ]*0+148 00001 R_SH_DIR32[ ]+0+5c oc13[ ]+\+ 0
+[ ]*0+14c 00001 R_SH_DIR32[ ]+0+ oa4[ ]+\+ 0
+[ ]*0+150 00001 R_SH_DIR32[ ]+0+ oa12[ ]+\+ 0
+[ ]*0+154 00001 R_SH_DIR32[ ]+0+ oa13[ ]+\+ 0
+[ ]*0+158 00001 R_SH_DIR32[ ]+0+ oa23[ ]+\+ 0
+[ ]*0+15c 00001 R_SH_DIR32[ ]+0+ oa23[ ]+\+ 0
+[ ]*0+160 00001 R_SH_DIR32[ ]+0+ oa123[ ]+\+ 0
+[ ]*0+164 00001 R_SH_DIR32[ ]+0+50 oc3[ ]+\+ 0
+[ ]*0+168 00001 R_SH_DIR32[ ]+0+ oa123[ ]+\+ 0
+[ ]*0+16c 00001 R_SH_DIR32[ ]+0+ ob1[ ]+\+ 0
+[ ]*0+170 00001 R_SH_DIR32[ ]+0+ ob2[ ]+\+ 0
+[ ]*0+174 00001 R_SH_DIR32[ ]+0+ ob3[ ]+\+ 0
+[ ]*0+178 00001 R_SH_DIR32[ ]+0+ ob4[ ]+\+ 0
+[ ]*0+17c 00001 R_SH_DIR32[ ]+0+ oa3[ ]+\+ 0
+[ ]*0+180 00001 R_SH_DIR32[ ]+0+60 oc23[ ]+\+ 0
+[ ]*0+184 00001 R_SH_DIR32[ ]+0+64 oc123[ ]+\+ 0
+[ ]*0+188 00001 R_SH_DIR32[ ]+0+ ob12[ ]+\+ 0
+[ ]*0+18c 00001 R_SH_DIR32[ ]+0+ ob13[ ]+\+ 0
+[ ]*0+190 00001 R_SH_DIR32[ ]+0+d0 ob13[ ]+\+ 0
+[ ]*0+194 00001 R_SH_DIR32[ ]+0+d4 ob23[ ]+\+ 0
+[ ]*0+198 00001 R_SH_DIR32[ ]+0+ ob23[ ]+\+ 0
+[ ]*0+19c 00001 R_SH_DIR32[ ]+0+ ob123[ ]+\+ 0
+[ ]*0+1a0 00001 R_SH_DIR32[ ]+0+ oc1[ ]+\+ 0
+[ ]*0+1a4 00001 R_SH_DIR32[ ]+0+c4 ob3[ ]+\+ 0
+[ ]*0+1a8 00001 R_SH_DIR32[ ]+0+d8 ob123[ ]+\+ 0
+[ ]*0+1ac 00001 R_SH_DIR32[ ]+0+ oc2[ ]+\+ 0
+[ ]*0+1b0 00001 R_SH_DIR32[ ]+0+ oc3[ ]+\+ 0
+[ ]*0+1b4 00001 R_SH_DIR32[ ]+0+ oc4[ ]+\+ 0
+[ ]*0+1b8 00001 R_SH_DIR32[ ]+0+ oc12[ ]+\+ 0
+[ ]*0+1bc 00001 R_SH_DIR32[ ]+0+ oc13[ ]+\+ 0
+[ ]*0+1c0 00001 R_SH_DIR32[ ]+0+ oc23[ ]+\+ 0
+[ ]*0+1c4 00001 R_SH_DIR32[ ]+0+ oc123[ ]+\+ 0
+[ ]*0+1c8 00001 R_SH_DIR32[ ]+0+ a1[ ]+\+ 0
+[ ]*0+1cc 00001 R_SH_DIR32[ ]+0+a0 c2[ ]+\+ 0
+[ ]*0+1d0 00001 R_SH_DIR32[ ]+0+34 b23[ ]+\+ 0
+[ ]*0+1d4 00001 R_SH_DIR32[ ]+0+ b1[ ]+\+ 0
+[ ]*0+1d8 00001 R_SH_DIR32[ ]+0+ c1[ ]+\+ 0
+[ ]*0+1dc 00001 R_SH_DIR32[ ]+0+ a12[ ]+\+ 0
+[ ]*0+1e0 00001 R_SH_DIR32[ ]+0+ a2[ ]+\+ 0
+[ ]*0+1e4 00001 R_SH_DIR32[ ]+0+20 b2[ ]+\+ 0
+[ ]*0+1e8 00001 R_SH_DIR32[ ]+0+ b12[ ]+\+ 0
+[ ]*0+1ec 00001 R_SH_DIR32[ ]+0+ c12[ ]+\+ 0
+[ ]*0+1f0 00001 R_SH_DIR32[ ]+0+44 b123[ ]+\+ 0
+[ ]*0+1f4 00001 R_SH_DIR32[ ]+0+b8 c123[ ]+\+ 0
+[ ]*0+1f8 00001 R_SH_DIR32[ ]+0+ a13[ ]+\+ 0
+[ ]*0+1fc 00001 R_SH_DIR32[ ]+0+ b13[ ]+\+ 0
+[ ]*0+200 00001 R_SH_DIR32[ ]+0+b4 c23[ ]+\+ 0
+[ ]*0+204 00001 R_SH_DIR32[ ]+0+ a123[ ]+\+ 0
+[ ]*0+208 00001 R_SH_DIR32[ ]+0+ c13[ ]+\+ 0
+[ ]*0+20c 00001 R_SH_DIR32[ ]+0+ a123[ ]+\+ 0
+[ ]*0+210 00001 R_SH_DIR32[ ]+0+ac c12[ ]+\+ 0
+[ ]*0+214 00001 R_SH_DIR32[ ]+0+ a23[ ]+\+ 0
+[ ]*0+218 00001 R_SH_DIR32[ ]+0+ b123[ ]+\+ 0
+[ ]*0+21c 00001 R_SH_DIR32[ ]+0+ a12[ ]+\+ 0
+[ ]*0+220 00001 R_SH_DIR32[ ]+0+2c b12[ ]+\+ 0
+[ ]*0+224 00001 R_SH_DIR32[ ]+0+ c123[ ]+\+ 0
+
+Symbol table '\.symtab' contains 138 entries:
+ Num: Value[ ]+Size Type Bind Vis Ndx Name
+ 0: 0+ 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0+ 0 SECTION LOCAL DEFAULT 1
+ 2: 0+ 0 SECTION LOCAL DEFAULT 2
+ 3: 0+ 0 SECTION LOCAL DEFAULT 3
+ 4: 0+ 0 SECTION LOCAL DEFAULT 4
+ 5: 0+ 0 SECTION LOCAL DEFAULT 5
+ 6: 0+ 0 SECTION LOCAL DEFAULT 6
+ 7: 0+ 0 SECTION LOCAL DEFAULT 7
+ 8: 0+ 0 SECTION LOCAL DEFAULT 8
+ 9: 0+ 0 NOTYPE GLOBAL DEFAULT UND unresolved5
+ 10: 0+ 0 NOTYPE GLOBAL DEFAULT UND unresolved9
+ 11: 0+c 0 NOTYPE GLOBAL DEFAULT 1 file1text2
+ 12: 0+6c 0 NOTYPE GLOBAL DEFAULT 1 file2text1
+ 13: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND oc2
+ 14: 0+64 0 NOTYPE GLOBAL DEFAULT 1 oc123
+ 15: 0+4 0 NOTYPE GLOBAL DEFAULT 3 file1data1
+ 16: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND b123
+ 17: 0+20 0 NOTYPE GLOBAL DEFAULT 1 b2
+ 18: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND c4
+ 19: 0+12c 0 NOTYPE GLOBAL DEFAULT 3 file2data4
+ 20: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND oa4
+ 21: 0+c4 0 NOTYPE GLOBAL DEFAULT 1 ob3
+ 22: 0+58 0 NOTYPE GLOBAL DEFAULT 1 oc12
+ 23: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND ob4
+ 24: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND ob1
+ 25: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND a13
+ 26: 0+50 0 NOTYPE GLOBAL DEFAULT 1 oc3
+ 27: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND oa2
+ 28: 0+a8 0 NOTYPE GLOBAL DEFAULT 1 c4
+ 29: 0+5c 0 NOTYPE GLOBAL DEFAULT 1 oc13
+ 30: 0+a0 0 NOTYPE GLOBAL DEFAULT 1 c2
+ 31: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND oa12
+ 32: 0+ 0 NOTYPE GLOBAL DEFAULT UND oa13
+ 33: 0+c8 0 NOTYPE GLOBAL DEFAULT 1 ob4
+ 34: 0+1c 0 NOTYPE GLOBAL DEFAULT 1 b1
+ 35: 0+18 0 NOTYPE GLOBAL DEFAULT 1 file1text5
+ 36: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND c12
+ 37: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND file1text5
+ 38: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND ob2
+ 39: 0+10 0 NOTYPE GLOBAL DEFAULT 1 file1text3
+ 40: 0+124 0 NOTYPE GLOBAL DEFAULT 3 file2data2
+ 41: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND a4
+ 42: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND a2
+ 43: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND unresolved1
+ 44: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND file1data3
+ 45: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND b13
+ 46: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND oc23
+ 47: 0+60 0 NOTYPE GLOBAL DEFAULT 1 oc23
+ 48: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND c2
+ 49: 0+c 0 NOTYPE GLOBAL DEFAULT 3 file1data2
+ 50: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND b3
+ 51: 0+ 0 NOTYPE GLOBAL DEFAULT UND a3
+ 52: 0+78 0 NOTYPE GLOBAL DEFAULT 1 file2text3
+ 53: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND c13
+ 54: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND unresolved9
+ 55: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND oc123
+ 56: 0+28 0 NOTYPE GLOBAL DEFAULT 1 b4
+ 57: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND file2data4
+ 58: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND c23
+ 59: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND oc3
+ 60: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND oa23
+ 61: 0+b4 0 NOTYPE GLOBAL DEFAULT 1 c23
+ 62: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND c123
+ 63: 0+30 0 NOTYPE GLOBAL DEFAULT 1 b13
+ 64: 0+b0 0 NOTYPE GLOBAL DEFAULT 1 c13
+ 65: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND b1
+ 66: 0+ 0 NOTYPE GLOBAL DEFAULT UND a123
+ 67: 0+ 0 NOTYPE GLOBAL DEFAULT UND oa23
+ 68: 0+ 0 NOTYPE GLOBAL DEFAULT UND a12
+ 69: 0+bc 0 NOTYPE GLOBAL DEFAULT 1 ob1
+ 70: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND unresolved7
+ 71: 0+68 0 NOTYPE GLOBAL DEFAULT 1 start2
+ 72: 0+d8 0 NOTYPE GLOBAL DEFAULT 1 ob123
+ 73: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND oa13
+ 74: 0+9c 0 NOTYPE GLOBAL DEFAULT 1 c1
+ 75: 0+54 0 NOTYPE GLOBAL DEFAULT 1 oc4
+ 76: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND oa1
+ 77: 0+ 0 NOTYPE GLOBAL DEFAULT UND oa12
+ 78: 0+cc 0 NOTYPE GLOBAL DEFAULT 1 ob12
+ 79: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND file1data2
+ 80: 0+ 0 NOTYPE GLOBAL DEFAULT UND unresolved1
+ 81: 0+d0 0 NOTYPE GLOBAL DEFAULT 1 ob13
+ 82: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND a3
+ 83: 0+18 0 NOTYPE GLOBAL DEFAULT 3 file1data5
+ 84: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND oa123
+ 85: 0+ 0 NOTYPE GLOBAL DEFAULT UND unresolved6
+ 86: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND b12
+ 87: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND oc4
+ 88: 0+44 0 NOTYPE GLOBAL DEFAULT 1 b123
+ 89: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND ob13
+ 90: 0+ 0 NOTYPE GLOBAL DEFAULT UND a2
+ 91: 0+ 0 NOTYPE GLOBAL DEFAULT UND oa123
+ 92: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND ob23
+ 93: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND oc1
+ 94: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND oc12
+ 95: 0+4 0 NOTYPE GLOBAL DEFAULT 1 file1text1
+ 96: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND oc13
+ 97: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND file1text1
+ 98: 0+74 0 NOTYPE GLOBAL DEFAULT 1 file2text2
+ 99: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND ob3
+ 100: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND ob12
+ 101: 0+c0 0 NOTYPE GLOBAL DEFAULT 1 ob2
+ 102: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND a123
+ 103: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND c3
+ 104: 0+ 0 NOTYPE GLOBAL DEFAULT UND unresolved3
+ 105: 0+24 0 NOTYPE GLOBAL DEFAULT 1 b3
+ 106: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND ob123
+ 107: 0+7c 0 NOTYPE GLOBAL DEFAULT 1 file2text4
+ 108: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND b4
+ 109: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND a12
+ 110: 0+a4 0 NOTYPE GLOBAL DEFAULT 1 c3
+ 111: 0+48 0 NOTYPE GLOBAL DEFAULT 1 oc1
+ 112: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND unresolved6
+ 113: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND oa3
+ 114: 0+ac 0 NOTYPE GLOBAL DEFAULT 1 c12
+ 115: 0+34 0 NOTYPE GLOBAL DEFAULT 1 b23
+ 116: 0+ 0 NOTYPE GLOBAL DEFAULT UND a23
+ 117: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND b2
+ 118: 0+4c 0 NOTYPE GLOBAL DEFAULT 1 oc2
+ 119: 0+2c 0 NOTYPE GLOBAL DEFAULT 1 b12
+ 120: 0+ 0 NOTYPE GLOBAL DEFAULT UND unresolved2
+ 121: 0+ 0 NOTYPE GLOBAL DEFAULT 1 start
+ 122: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND a23
+ 123: 0+14 0 NOTYPE GLOBAL DEFAULT 1 file1text4
+ 124: 0+128 0 NOTYPE GLOBAL DEFAULT 3 file2data3
+ 125: 0+ 0 NOTYPE GLOBAL DEFAULT UND oa2
+ 126: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND a1
+ 127: 0+ 0 NOTYPE GLOBAL DEFAULT UND unresolved4
+ 128: 0+11c 0 NOTYPE GLOBAL DEFAULT 3 file2data1
+ 129: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND b23
+ 130: 0+b8 0 NOTYPE GLOBAL DEFAULT 1 c123
+ 131: 0+ 0 NOTYPE GLOBAL DEFAULT UND a13
+ 132: 0+10 0 NOTYPE GLOBAL DEFAULT 3 file1data3
+ 133: 0+14 0 NOTYPE GLOBAL DEFAULT 3 file1data4
+ 134: 0+d4 0 NOTYPE GLOBAL DEFAULT 1 ob23
+ 135: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND c1
+ 136: 0+ 0 NOTYPE GLOBAL DEFAULT UND oa3
+ 137: 0+ 0 <processor specific>: 13 GLOBAL DEFAULT UND unresolved8
+
+Hex dump of section '\.text':
+ 0x00000000 6ff0fff0 6ff0fff0 cc0000a0 cc000140 .*
+ 0x00000010 cc000140 cc000140 cc000280 cc0001e0 .*
+ 0x00000020 cc0000a0 cc0000a0 cc000280 cc000140 .*
+ 0x00000030 cc000140 cc000320 c8000320 c8000320 .*
+ 0x00000040 c8000320 cc0003c0 cc0003c0 6ff0fff0 .*
+ 0x00000050 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00000060 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x00000070 cc0000a0 cc000140 cc000140 cc000140 .*
+ 0x00000080 cc0001e0 cc0001e0 cc000320 cc000320 .*
+ 0x00000090 cc000280 cc000280 cc000280 6ff0fff0 .*
+ 0x000000a0 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x000000b0 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x000000c0 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0x000000d0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+
+Hex dump of section '\.data':
+ 0x00000000 00000000 00000000 00000008 00000000 .*
+ 0x00000010 00000000 00000000 00000000 00000000 .*
+ 0x00000020 00000028 00000000 00000000 00000000 .*
+ 0x00000030 00000000 00000000 00000000 00000000 .*
+ 0x00000040 00000000 00000000 00000000 00000000 .*
+ 0x00000050 00000000 00000000 00000000 00000000 .*
+ 0x00000060 00000000 00000000 00000000 00000000 .*
+ 0x00000070 00000000 00000000 00000000 00000000 .*
+ 0x00000080 00000000 00000000 00000000 00000000 .*
+ 0x00000090 00000000 00000000 00000000 00000000 .*
+ 0x000000a0 00000000 00000000 00000000 00000000 .*
+ 0x000000b0 00000000 00000000 00000000 00000000 .*
+ 0x000000c0 00000000 00000000 00000000 00000000 .*
+ 0x000000d0 00000000 00000000 00000000 00000000 .*
+ 0x000000e0 00000000 00000000 00000000 00000000 .*
+ 0x000000f0 00000000 00000000 00000000 00000000 .*
+ 0x00000100 00000000 00000000 00000000 00000000 .*
+ 0x00000110 00000000 00000000 00000000 00000000 .*
+ 0x00000120 00000000 00000000 00000000 00000000 .*
+ 0x00000130 00000000 00000000 00000000 00000000 .*
+ 0x00000140 00000000 00000000 00000000 00000000 .*
+ 0x00000150 00000000 00000000 00000000 00000000 .*
+ 0x00000160 00000000 00000000 00000000 00000000 .*
+ 0x00000170 00000000 00000000 00000000 00000000 .*
+ 0x00000180 00000000 00000000 00000000 00000000 .*
+ 0x00000190 00000000 00000000 00000000 00000000 .*
+ 0x000001a0 00000000 00000000 00000000 00000000 .*
+ 0x000001b0 00000000 00000000 00000000 00000000 .*
+ 0x000001c0 00000000 00000000 00000000 00000000 .*
+ 0x000001d0 00000000 00000000 00000000 00000000 .*
+ 0x000001e0 00000000 00000000 00000000 00000000 .*
+ 0x000001f0 00000000 00000000 00000000 00000000 .*
+ 0x00000200 00000000 00000000 00000000 00000000 .*
+ 0x00000210 00000000 00000000 00000000 00000000 .*
+ 0x00000220 00000000 00000000 .*
diff --git a/ld/testsuite/ld-sh/sh64/relfail.exp b/ld/testsuite/ld-sh/sh64/relfail.exp
new file mode 100644
index 0000000..6b3ef0b
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/relfail.exp
@@ -0,0 +1,162 @@
+# Expect script for ld-sh tests
+# Copyright (C) 2001 Free Software Foundation
+#
+# 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.
+#
+
+# Test SH reloc failures - that is, cases that ld must not allow.
+
+if ![istarget sh64-*-*] {
+ return
+}
+
+# opcode, asflags, ldflags, expected or "" for fail
+# opcode blank means rebuild relfail.o and set default as/ld options
+
+set sh64relfailtests {
+
+ { "" "-isa=shcompact -abi=32" "-m shelf32 --oformat elf32-sh" "" }
+ { "mov.l lab,r0;.align 3;lab:nop" "" "" "mov.l 1008" }
+ { "mov.l to0,r0" "" "" "mov.l 1010" }
+ { "mov.l to1,r0" "" "" "" }
+ { "mov.l to2,r0" "" "" "" }
+ { "mov.l to3,r0" "" "" "" }
+ { "mov.l to4,r0" "" "" "mov.l 1014" }
+
+ { "" "-isa=shmedia -abi=64 -no-expand" "-m shelf64 --oformat elf64-sh64" "" }
+ { "pta lab,tr0;.align 3;lab:nop" "" "" "pta.*1008" }
+ { "pta datalabel to0,tr0" "" "" "pta.*1010" }
+ { "pta datalabel to1,tr0" "" "" "pta.*1011" }
+ { "pta datalabel to2,tr0" "" "" "" }
+ { "pta datalabel to3,tr0" "" "" "" }
+ { "pta datalabel to4,tr0" "" "" "pta.*1014" }
+
+ { "ld.q r0,datalabel to0 - 0x1000,r0" "" "" "ld.q.*,16," }
+ { "ld.q r0,datalabel to1 - 0x1000,r0" "" "" "" }
+ { "ld.q r0,datalabel to2 - 0x1000,r0" "" "" "" }
+ { "ld.q r0,datalabel to3 - 0x1000,r0" "" "" "" }
+ { "ld.q r0,datalabel to4 - 0x1000,r0" "" "" "" }
+
+ { "ld.l r0,datalabel to0 - 0x1000,r0" "" "" "ld.l.*,16," }
+ { "ld.l r0,datalabel to1 - 0x1000,r0" "" "" "" }
+ { "ld.l r0,datalabel to2 - 0x1000,r0" "" "" "" }
+ { "ld.l r0,datalabel to3 - 0x1000,r0" "" "" "" }
+ { "ld.l r0,datalabel to4 - 0x1000,r0" "" "" "ld.l.*,20," }
+
+ { "ld.w r0,datalabel to0 - 0x1000,r0" "" "" "ld.w.*,16," }
+ { "ld.w r0,datalabel to1 - 0x1000,r0" "" "" "" }
+ { "ld.w r0,datalabel to2 - 0x1000,r0" "" "" "ld.w.*,18," }
+ { "ld.w r0,datalabel to3 - 0x1000,r0" "" "" "" }
+ { "ld.w r0,datalabel to4 - 0x1000,r0" "" "" "ld.w.*,20," }
+
+}
+
+proc run_sh64relfailtests {sh64relfailtests} {
+ global ld
+ global as
+ global nm
+ global objdump
+ global readelf
+ global srcdir
+ global subdir
+
+ set testindex 0
+ set is_unresolved 0
+
+ foreach testentry $sh64relfailtests {
+ set opcode [lindex $testentry 0]
+ set as_options [lindex $testentry 1]
+ set ld_options [lindex $testentry 2]
+ set expect_fail [lindex $testentry 3]
+
+ set testname "SH64 relfail $opcode $as_options $ld_options"
+
+ set objfiles {}
+
+ incr testindex
+
+ if {$opcode == ""} {
+ set def_as_options $as_options
+ set def_ld_options $ld_options
+ set is_unresolved 0
+ set baseobj "tmpdir/relfail-$testindex.o"
+ if ![ld_assemble $as "$as_options $srcdir/$subdir/relfail.s" $baseobj] {
+ set is_unresolved 1
+ }
+ continue
+ }
+
+ if {$as_options == ""} {
+ set as_options $def_as_options;
+ }
+ if {$ld_options == ""} {
+ set ld_options $def_ld_options;
+ }
+
+ if { $is_unresolved } {
+ unresolved $testname
+ continue
+ }
+
+ set asm [open "tmpdir/relfail-$testindex.s" "w"]
+ puts $asm " .text"
+ puts $asm " .global start"
+ puts $asm "start:"
+ puts $asm " $opcode";
+ close $asm
+
+ if ![ld_assemble $as "$as_options tmpdir/relfail-$testindex.s" "tmpdir/relfail-$testindex.o"] {
+ unresolved $testname
+ continue
+ }
+
+ set binfile "tmpdir/relfail-$testindex.x"
+
+ file delete $binfile
+ set objects "tmpdir/relfail-$testindex.o $baseobj"
+ set result [ld_simple_link $ld $binfile "--no-warn-mismatch $ld_options $objects"]
+
+ set exists [file exists $binfile]
+ if {$exists && $expect_fail == ""} {
+ verbose "$testname: file $binfile exists when it shouldn't" 1
+ catch "exec $objdump -d $binfile" objdump_output
+ verbose $objdump_output 1
+ fail "$testname (file exists)"
+ continue
+ }
+ if {!$exists && $expect_fail != ""} {
+ verbose "$testname: file $binfile doesn't exist when it should" 1
+ fail "$testname (file missing)"
+ continue
+ }
+
+ if {$exists} {
+ catch "exec $objdump -d $binfile" objdump_output
+ regsub -all {[ ][ ]*} $objdump_output " " objdump_short
+ if ![regexp $expect_fail $objdump_short junk] {
+ verbose $objdump_output 1
+ fail "$testname (incorrect reloc)"
+ continue
+ }
+ }
+
+ file delete "tmpdir/relfail-$testindex.s"
+ file delete "tmpdir/relfail-$testindex.o"
+ file delete $binfile
+ pass $testname
+ }
+}
+
+run_sh64relfailtests $sh64relfailtests
diff --git a/ld/testsuite/ld-sh/sh64/relfail.s b/ld/testsuite/ld-sh/sh64/relfail.s
new file mode 100644
index 0000000..5f5d171
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/relfail.s
@@ -0,0 +1,36 @@
+ .text
+ .align 4
+ .global to0
+to0:
+ .byte 0
+ .global to1
+to1:
+ .byte 0
+ .global to2
+to2:
+ .byte 0
+ .global to3
+to3:
+ .byte 0
+ .global to4
+to4:
+ .byte 0
+ .byte 0
+
+ .data
+ .align 4
+ .global do0
+do0:
+ .byte 0
+ .global do1
+do1:
+ .byte 0
+ .global do2
+do2:
+ .byte 0
+ .global do3
+do3:
+ .byte 0
+ .global do4
+do4:
+ .byte 0
diff --git a/ld/testsuite/ld-sh/sh64/sh64-1.s b/ld/testsuite/ld-sh/sh64/sh64-1.s
new file mode 100644
index 0000000..3e488db
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/sh64-1.s
@@ -0,0 +1,20 @@
+! Test that all common kinds of relocs get right for simple use.
+! Auxiliary part.
+ .text
+ .mode SHmedia
+ .global foo
+ .global bar
+foo:
+ pt/l xyzzy,tr3
+bar:
+ nop
+
+ .data
+ .global baz
+baz:
+ .long foobar
+ .long bar
+ .global baz2
+baz2:
+ .long xyzzy
+foobar: .long baz
diff --git a/ld/testsuite/ld-sh/sh64/sh64-2.s b/ld/testsuite/ld-sh/sh64/sh64-2.s
new file mode 100644
index 0000000..8ca24c0
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/sh64-2.s
@@ -0,0 +1,27 @@
+! Test that all common kinds of relocs get right for simple cases.
+! Main part.
+ .text
+ .global start
+ .mode SHmedia
+start:
+ movi foo,r33
+ movi bar,r21
+ pt/l bar,tr3
+ movi foobar,r43
+ movi baz2,r53
+ movi foobar2,r4
+ pta xyzzy,tr5
+ pt/u plugh,tr1
+
+ .data
+ .global foobar
+foobar: .long baz
+foobar2:
+ .long bar
+
+ .section .text.other,"ax"
+ .global xyzzy
+xyzzy:
+ nop
+plugh:
+ nop
diff --git a/ld/testsuite/ld-sh/sh64/sh64.exp b/ld/testsuite/ld-sh/sh64/sh64.exp
new file mode 100644
index 0000000..d412a2c
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/sh64.exp
@@ -0,0 +1,346 @@
+# Expect script for ld-sh tests
+# Copyright (C) 2000, 2001, 2002 Free Software Foundation
+#
+# 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.
+#
+
+# Test SH linking; all types of relocs. This tests the assembler and
+# tools like objdump as well as the linker.
+
+if ![istarget sh64-*-*] {
+ return
+}
+
+# FIXME: This isn't set by testsuite/config/default.exp; make it.
+if ![info exists readelf] then {
+ set readelf [findfile $base_dir/../binutils/readelf]
+}
+
+# List contains test-items with 3 items followed by 2 lists:
+# 0:name 1:ld options 2:assembler options
+# 3:filenames of assembler files 4: action and options.
+
+# Actions:
+# objdump: Apply objdump options on result. Compare with regex (last arg).
+# nm: Apply nm options on result. Compare with regex (last arg).
+
+# Note that the contents dump is the same for "inter-file datalabel
+# references, 64-bit ABI" as for 32-bit ABI and ELF so we re-use it.
+
+set sh64tests {
+ {"SH64 linking, 64-bit ABI" "-mshelf64"
+ "--abi=64" {sh64-1.s sh64-2.s}
+ {{objdump -sr abi64.sd} {objdump -x abi64.xd}}}
+ {"SH64 linking, 64-bit ABI, -no-expand" "-mshelf64"
+ "--abi=64 -no-expand" {sh64-1.s sh64-2.s}
+ {{objdump -sr abixx-noexp.sd}}}
+ {"SH64 linking, 32-bit ABI" "-mshelf32"
+ "--abi=32" {sh64-1.s sh64-2.s}
+ {{objdump -sr abi32.sd} {objdump -x abi32.xd}}}
+ {"SH64 linking, 32-bit ABI, -no-expand" "-mshelf32"
+ "--abi=32 -no-expand" {sh64-1.s sh64-2.s}
+ {{objdump -sr abixx-noexp.sd}}}
+ {"SH64 linking, single multi-ISA object" "-mshelf32"
+ "--abi=32" {shmix-1.s}
+ {{objdump -sr mix1.sd} {objdump -x mix1.xd}}}
+ {"SH64 linking, single multi-ISA object, -no-expand" "-mshelf32"
+ "--abi=32 -no-expand" {shmix-1.s}
+ {{objdump -sr mix1-noexp.sd}}}
+ {"SH64 linking, two different-ISA objects" "-mshelf32"
+ "--abi=32" {shmix-2.s shmix-3.s}
+ {{objdump -sr mix2.sd} {objdump -x mix2.xd}}}
+ {"SH64 linking, two different-ISA objects, -no-expand" "-mshelf32"
+ "--abi=32 -no-expand" {shmix-2.s shmix-3.s}
+ {{objdump -sr mix2-noexp.sd}}}
+ {"SH64 linking, single SHcompact" "-mshelf32"
+ "--isa=SHcompact" {shcmp-1.s}
+ {{objdump -sr cmpct1.sd} {objdump -x cmpct1.xd}}}
+ {"SH64 inter-file datalabel references, 64-bit ABI" "-mshelf64"
+ "--abi=64" {shdl-1.s shdl-2.s}
+ {{objdump -sr shdl64.sd} {objdump -x shdl64.xd}}}
+ {"SH64 inter-file datalabel references, 32-bit ABI" "-mshelf32"
+ "--abi=32" {shdl-1.s shdl-2.s}
+ {{objdump -sr shdl64.sd} {objdump -x shdl32.xd}}}
+ {"SH64 simple partial linking, 32-bit ABI" "-mshelf32 -r"
+ "--abi=32" {rel-1.s rel-2.s}
+ {{objdump -sx rel32.xd}}}
+ {"SH64 simple partial linking, 64-bit ABI" "-mshelf64 -r"
+ "--abi=64" {rel-1.s rel-2.s}
+ {{objdump -sx rel64.xd}}}
+ {"SH64 partial linking with datalabel references, 32-bit ABI" "-mshelf32 -r"
+ "--abi=32" {reldl-1.s reldl-2.s}
+ {{readelf {-s -r -x 1 -x 3} reldl32.rd}}}
+ {"SH64 partial linking with datalabel references, 64-bit ABI" "-mshelf64 -r"
+ "--abi=64" {reldl-1.s reldl-2.s}
+ {{readelf {-s -r -x 1 -x 3} reldl64.rd}}}
+ {"Handling SH64 assembler-generated .cranges" "-mshelf32"
+ "--abi=32" {crange-2a.s crange-1.s}
+ {{readelf {-S -s -r -x 1 -x 2 -x 9} crange1.rd}}}
+ {"Handling SH64 assembler-generated .cranges, partial linking" "-mshelf32 -r"
+ "--abi=32" {crange-2a.s}
+ {{readelf {-S -s -r -x 2 -x 5} crangerel1.rd}}}
+ {"Mixing SH64 assembler-generated with linker-generated .cranges" "-mshelf32"
+ "--abi=32" {crange-2a.s crange-2b.s crange-1.s}
+ {{readelf {-S -s -r -x 2 -x 9} crange2.rd}}}
+ {"Mixing SH64 assembler-generated with linker-generated .cranges, partial linking"
+ "-mshelf32 -r"
+ "--abi=32" {crange-2a.s crange-2c.s crange-2d.s crange-2e.s}
+ {{readelf {-S -s -r -x 2 -x 5} crangerel2.rd}}}
+ {"Merge and use of SH64 .cranges, some not originally in order" "-mshelf32"
+ "--abi=32"
+ {crange-2e.s crange-2f.s crange-2g.s crange-2a.s crange-2d.s crange-2i.s
+ crange-2h.s crange-1.s}
+ {{readelf {-S -s -x 2 -x 9} crange3.rd} {objdump -d crange3.dd}}}
+ {"Sorted SH64 .cranges, entry at SHcompact code" "-mshelf32 --entry diversion"
+ "--abi=32"
+ {crange-2e.s crange-2f.s crange-2g.s crange-2a.s crange-2d.s crange-2i.s
+ crange-2h.s crange-1.s}
+ {{readelf {-h -S -s -x 2 -x 9} crange3-cmpct.rd}}}
+ {"Sorted SH64 .cranges, entry at SHmedia code" "-mshelf32 --entry diversion2"
+ "--abi=32"
+ {crange-2e.s crange-2f.s crange-2g.s crange-2a.s crange-2d.s crange-2i.s
+ crange-2h.s crange-1.s}
+ {{readelf {-h -S -s -x 2 -x 9} crange3-media.rd}}}
+ {"SH64 Big Endianness" "-mshelf64 -Tendian.ld"
+ "--abi=64" {endian.s}
+ {{objdump -s endian.sbd} {objdump -d endian.dbd}}}
+ {"SH64 Little Endianness" "-mshlelf64 -Tendian.ld"
+ "--abi=64 --little" {endian.s}
+ {{objdump -s endian.sld} {objdump -d endian.dld}}}
+
+}
+
+# FIXME: Generalize and move this to ld-lib.exp
+
+proc run_ld_link_tests { ldtests } {
+ global ld
+ global as
+ global nm
+ global objdump
+ global readelf
+ global srcdir
+ global subdir
+
+ set binfile "tmpdir/linked"
+
+ foreach testitem $ldtests {
+ set testname [lindex $testitem 0]
+ set ld_options [lindex $testitem 1]
+ set as_options [lindex $testitem 2]
+ set as_files [lindex $testitem 3]
+ set actions [lindex $testitem 4]
+ set objfiles {}
+ set is_unresolved 0
+ set failed 0
+
+# verbose -log "Testname is $testname"
+# verbose -log "ld_options is $ld_options"
+# verbose -log "as_options is $as_options"
+# verbose -log "as_files is $as_files"
+# verbose -log "actions is $actions"
+
+ # Assemble each file in the test.
+ foreach as_file $as_files {
+ set objfile "tmpdir/[file rootname $as_file].o"
+ lappend objfiles $objfile
+
+ if ![ld_assemble $as "$as_options $srcdir/$subdir/$as_file" $objfile] {
+ set is_unresolved 1
+ break
+ }
+ }
+
+ # Catch assembler errors.
+ if { $is_unresolved != 0 } {
+ unresolved $testname
+ continue
+ }
+
+ if ![ld_simple_link $ld $binfile "-L$srcdir/$subdir $ld_options $objfiles"] {
+ fail $testname
+ } else {
+ set failed 0
+ foreach actionlist $actions {
+ set action [lindex $actionlist 0]
+ set progopts [lindex $actionlist 1]
+
+ # There are actions where we run regexp_diff on the
+ # output, and there are other actions (presumably).
+ # Handling of the former look the same.
+ set dump_prog ""
+ switch -- $action {
+ objdump
+ { set dump_prog $objdump }
+ nm
+ { set dump_prog $nm }
+ readelf
+ { set dump_prog $readelf }
+ default
+ {
+ perror "Unrecognized action $action"
+ set is_unresolved 1
+ break
+ }
+ }
+
+ if { $dump_prog != "" } {
+ set dumpfile [lindex $actionlist 2]
+ set binary $dump_prog
+
+ send_log "$binary $progopts $binfile > dump.out\n"
+ catch "exec $binary $progopts $binfile > dump.out" comp_output
+ set comp_output [prune_warnings $comp_output]
+
+ if ![string match "" $comp_output] then {
+ send_log "$comp_output\n"
+ set failed 1
+ break
+ }
+
+ if { [regexp_diff "dump.out" "$srcdir/$subdir/$dumpfile"] } then {
+ verbose "output is [file_contents "dump.out"]" 2
+ set failed 1
+ break
+ }
+ }
+ }
+
+ if { $failed != 0 } {
+ fail $testname
+ } else { if { $is_unresolved == 0 } {
+ pass $testname
+ } }
+ }
+
+ # Catch action errors.
+ if { $is_unresolved != 0 } {
+ unresolved $testname
+ continue
+ }
+ }
+}
+
+# FIXME: Move this to ld-lib.exp or higher up.
+
+# regexp_diff, based on simple_diff taken from ld test suite
+# compares two files line-by-line
+# file1 contains strings, file2 contains regexps and #-comments
+# blank lines are ignored in either file
+# returns non-zero if differences exist
+#
+proc regexp_diff { file_1 file_2 } {
+
+ set eof -1
+ set end_1 0
+ set end_2 0
+ set differences 0
+ set diff_pass 0
+
+ if [file exists $file_1] then {
+ set file_a [open $file_1 r]
+ } else {
+ warning "$file_1 doesn't exist"
+ return 1
+ }
+
+ if [file exists $file_2] then {
+ set file_b [open $file_2 r]
+ } else {
+ fail "$file_2 doesn't exist"
+ close $file_a
+ return 1
+ }
+
+ verbose " Regexp-diff'ing: $file_1 $file_2" 2
+
+ while { 1 } {
+ set line_a ""
+ set line_b ""
+ while { [string length $line_a] == 0 } {
+ if { [gets $file_a line_a] == $eof } {
+ set end_1 1
+ break
+ }
+ }
+ while { [string length $line_b] == 0 || [string match "#*" $line_b] } {
+ if [ string match "#pass" $line_b ] {
+ set end_2 1
+ set diff_pass 1
+ break
+ } elseif [ string match "#..." $line_b ] {
+ if { [gets $file_b line_b] == $eof } {
+ set end_2 1
+ break
+ }
+ verbose "looking for \"^$line_b$\"" 3
+ while { ![regexp "^$line_b$" "$line_a"] } {
+ verbose "skipping \"$line_a\"" 3
+ if { [gets $file_a line_a] == $eof } {
+ set end_1 1
+ break
+ }
+ }
+ break
+ }
+ if { [gets $file_b line_b] == $eof } {
+ set end_2 1
+ break
+ }
+ }
+
+ if { $diff_pass } {
+ break
+ } elseif { $end_1 && $end_2 } {
+ break
+ } elseif { $end_1 } {
+ send_log "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1\n"
+ verbose "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1" 3
+ set differences 1
+ break
+ } elseif { $end_2 } {
+ send_log "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n"
+ verbose "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n" 3
+ set differences 1
+ break
+ } else {
+ verbose "regexp \"^$line_b$\"\nline \"$line_a\"" 3
+ if ![regexp "^$line_b$" "$line_a"] {
+ send_log "regexp_diff match failure\n"
+ send_log "regexp \"^$line_b$\"\nline \"$line_a\"\n"
+ set differences 1
+ }
+ }
+ }
+
+ if { $differences == 0 && !$diff_pass && [eof $file_a] != [eof $file_b] } {
+ send_log "$file_1 and $file_2 are different lengths\n"
+ verbose "$file_1 and $file_2 are different lengths" 3
+ set differences 1
+ }
+
+ close $file_a
+ close $file_b
+
+ return $differences
+}
+
+proc file_contents { filename } {
+ set file [open $filename r]
+ set contents [read $file]
+ close $file
+ return $contents
+}
+
+run_ld_link_tests $sh64tests
diff --git a/ld/testsuite/ld-sh/sh64/shcmp-1.s b/ld/testsuite/ld-sh/sh64/shcmp-1.s
new file mode 100644
index 0000000..f915af4
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/shcmp-1.s
@@ -0,0 +1,15 @@
+! A single SHcompact file, that should link correctly.
+ .text
+ .global start
+start:
+ mova next,r0
+ nop
+next:
+ nop
+ mov #42,r10
+
+ .section .rodata
+ .long start
+here:
+ .long here
+ .long next
diff --git a/ld/testsuite/ld-sh/sh64/shdl-1.s b/ld/testsuite/ld-sh/sh64/shdl-1.s
new file mode 100644
index 0000000..0f2803c
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/shdl-1.s
@@ -0,0 +1,359 @@
+! Test inter-file DataLabel support.
+!
+! We need to test symbols that are:
+! * Global, defined in this file, with/without/both-with-without datalabel
+! references.
+! * The above in combinations where the reference is/is not from within
+! the same section. The implementation is currently indifferent to that
+! fact, but it seems likely to be something that can change.
+! * Extern with/without/both-with-without datalabel-qualified references.
+! * The above with reference from same *and* other file.
+! * The above in combinations for where the symbol is/is not a
+! STO_SH5_ISA32-marked symbol.
+
+! There will be omissions and overlap in combinations. Add spotted
+! omissions with complementary tests in other files.
+
+ .text
+ .mode SHmedia
+
+! For good measure, we start with a nop to get a non-zero offset within
+! the .text section.
+
+ .global start
+start:
+ nop
+
+! Referenced from the same file, same section, is ISA32, only referenced
+! with datalabel qualifier.
+ .global foo
+foo:
+ nop
+ movi (datalabel foo + 8) & 65535,r30
+
+! Referenced from same file, same section, both with and without
+! datalabel qualifier, is ISA32.
+ .global fooboth
+fooboth:
+ nop
+ movi (datalabel fooboth + 16) & 65535,r40
+ movi (fooboth + 12) & 65535,r40
+
+! Same as above, but in different order.
+ .global fooboth2
+fooboth2:
+ nop
+ movi (fooboth2 + 12) & 65535,r40
+ movi (datalabel fooboth2 + 16) & 65535,r40
+
+! Referenced from this file and another, same section, is ISA32.
+ .global foowithout
+foowithout:
+ nop
+ movi (foowithout + 24) & 65535,r30
+
+! Same as above, different section than definition.
+
+ .global foo_other
+foo_other:
+ nop
+ .global foo_otherboth
+foo_otherboth:
+ nop
+ .global foo_otherboth2
+foo_otherboth2:
+ nop
+ .global foo_otherwithout
+foo_otherwithout:
+ nop
+
+ .section .rodata
+ .long datalabel foo_other + 4
+ .long datalabel foo_otherboth + 40
+ .long foo_otherboth + 24
+ .long foo_otherboth2 + 24
+ .long datalabel foo_otherboth2 + 40
+ .long foo_otherwithout
+
+ .text
+
+! Same as above, mixing references from same and other section.
+ .global foo_mix
+foo_mix:
+ nop
+ movi (datalabel foo_mix + 8) & 65535,r30
+ .global foo_mix2
+foo_mix2:
+ nop
+ movi (foo_mix2 + 8) & 65535,r30
+ .global foo_mixboth
+foo_mixboth:
+ nop
+ movi (datalabel foo_mixboth + 80) & 65535,r30
+ movi (foo_mixboth + 80) & 65535,r30
+ .global foo_mixboth2
+foo_mixboth2:
+ nop
+ movi (foo_mixboth2 + 64) & 65535,r30
+ movi (datalabel foo_mixboth2 + 64) & 65535,r30
+ .global foo_mixwithout
+foo_mixwithout:
+ nop
+ movi (foo_mixwithout + 42) & 65535,r30
+ .global foo_mixwithout2
+foo_mixwithout2:
+ nop
+ movi (foo_mixwithout2 + 24) & 65535,r30
+
+ .section .rodata
+ .long foo_mix + 4
+ .long datalabel foo_mix2 + 48
+ .long datalabel foo_mixboth + 400
+ .long foo_mixboth + 420
+ .long foo_mixboth2 + 248
+ .long datalabel foo_mixboth2 + 240
+ .long foo_mixwithout
+
+! Same as above, referencing symbol in other file (reference only from
+! this to other file).
+
+ .text
+ nop
+ movi (datalabel bar + 8) & 65535,r30
+
+ movi (datalabel barboth + 16) & 65535,r40
+ movi (barboth + 12) & 65535,r40
+
+ movi (barboth2 + 12) & 65535,r40
+ movi (datalabel barboth2 + 16) & 65535,r40
+
+ movi (barwithout + 24) & 65535,r30
+
+ .section .rodata
+ .long datalabel bar_other + 4
+ .long datalabel bar_otherboth + 40
+ .long bar_otherboth + 24
+ .long bar_otherboth2 + 24
+ .long datalabel bar_otherboth2 + 40
+ .long bar_otherwithout
+
+ .text
+ movi (datalabel bar_mix + 8) & 65535,r30
+ movi (bar_mix2 + 8) & 65535,r30
+ movi (datalabel bar_mixboth + 80) & 65535,r30
+ movi (bar_mixboth + 80) & 65535,r30
+ movi (bar_mixboth2 + 64) & 65535,r30
+ movi (datalabel bar_mixboth2 + 64) & 65535,r30
+ movi (bar_mixwithout + 42) & 65535,r30
+ movi (bar_mixwithout2 + 24) & 65535,r30
+
+ .section .rodata
+ .long bar_mix + 4
+ .long datalabel bar_mix2 + 48
+ .long datalabel bar_mixboth + 400
+ .long bar_mixboth + 420
+ .long bar_mixboth2 + 248
+ .long datalabel bar_mixboth2 + 240
+ .long bar_mixwithout
+
+! Same as above, referencing symbol in other file *and* within that file.
+
+ .text
+ movi (datalabel baz + 8) & 65535,r30
+
+ movi (datalabel bazboth + 16) & 65535,r40
+ movi (bazboth + 12) & 65535,r40
+
+ movi (bazboth2 + 12) & 65535,r40
+ movi (datalabel bazboth2 + 16) & 65535,r40
+
+ movi (bazwithout + 24) & 65535,r30
+
+ .section .rodata
+ .long datalabel baz_other + 4
+ .long datalabel baz_otherboth + 40
+ .long baz_otherboth + 24
+ .long baz_otherboth2 + 24
+ .long datalabel baz_otherboth2 + 40
+ .long baz_otherwithout
+
+ .text
+ movi (datalabel baz_mix + 8) & 65535,r30
+ movi (baz_mix2 + 8) & 65535,r30
+ movi (datalabel baz_mixboth + 80) & 65535,r30
+ movi (baz_mixboth + 80) & 65535,r30
+ movi (baz_mixboth2 + 64) & 65535,r30
+ movi (datalabel baz_mixboth2 + 64) & 65535,r30
+ movi (baz_mixwithout + 42) & 65535,r30
+ movi (baz_mixwithout2 + 24) & 65535,r30
+
+ .section .rodata
+ .long baz_mix + 4
+ .long datalabel baz_mix2 + 48
+ .long datalabel baz_mixboth + 400
+ .long baz_mixboth + 420
+ .long baz_mixboth2 + 248
+ .long datalabel baz_mixboth2 + 240
+ .long baz_mixwithout
+
+! Same as all of the above, but where the symbol is not an ISA32 one.
+
+ .data
+ .global dfoo
+dfoo:
+ .long 0
+ .long (datalabel dfoo + 8)
+
+ .global dfooboth
+dfooboth:
+ .long 0
+ .long (datalabel dfooboth + 16)
+ .long (dfooboth + 12)
+
+ .global dfooboth2
+dfooboth2:
+ .long 0
+ .long (dfooboth2 + 12)
+ .long (datalabel dfooboth2 + 16)
+
+ .global dfoowithout
+dfoowithout:
+ .long 0
+ .long (dfoowithout + 24)
+
+ .global dfoo_other
+dfoo_other:
+ .long 0
+ .global dfoo_otherboth
+dfoo_otherboth:
+ .long 0
+ .global dfoo_otherboth2
+dfoo_otherboth2:
+ .long 0
+ .global dfoo_otherwithout
+dfoo_otherwithout:
+ .long 0
+
+ .section .rodata
+ .long datalabel dfoo_other + 4
+ .long datalabel dfoo_otherboth + 40
+ .long dfoo_otherboth + 24
+ .long dfoo_otherboth2 + 24
+ .long datalabel dfoo_otherboth2 + 40
+ .long dfoo_otherwithout
+
+ .data
+
+! Same as above, mixing references from same and other section.
+ .global dfoo_mix
+dfoo_mix:
+ .long 0
+ .long (datalabel dfoo_mix + 8)
+ .global dfoo_mix2
+dfoo_mix2:
+ .long 0
+ .long (dfoo_mix2 + 8)
+ .global dfoo_mixboth
+dfoo_mixboth:
+ .long 0
+ .long (datalabel dfoo_mixboth + 80)
+ .long (dfoo_mixboth + 80)
+ .global dfoo_mixboth2
+dfoo_mixboth2:
+ .long 0
+ .long (dfoo_mixboth2 + 64)
+ .long (datalabel dfoo_mixboth2 + 64)
+ .global dfoo_mixwithout
+dfoo_mixwithout:
+ .long 0
+ .long (dfoo_mixwithout + 42)
+ .global dfoo_mixwithout2
+dfoo_mixwithout2:
+ .long 0
+ .long (dfoo_mixwithout2 + 24)
+
+ .section .rodata
+ .long dfoo_mix + 4
+ .long datalabel dfoo_mix2 + 48
+ .long datalabel dfoo_mixboth + 400
+ .long dfoo_mixboth + 420
+ .long dfoo_mixboth2 + 248
+ .long datalabel dfoo_mixboth2 + 240
+ .long dfoo_mixwithout
+
+! Same as above, referencing symbol in other file (reference only from
+! this to other file).
+
+ .text
+ movi (datalabel dbarboth + 16) & 65535,r40
+ movi (dbarboth + 12) & 65535,r40
+ movi (dbarboth2 + 12) & 65535,r40
+ movi (datalabel dbarboth2 + 16) & 65535,r40
+ movi (dbarwithout + 24) & 65535,r30
+
+ .data
+ .long (datalabel dbar + 8)
+ .long datalabel dbar_other + 4
+ .long datalabel dbar_otherboth + 40
+ .long dbar_otherboth + 24
+ .long dbar_otherboth2 + 24
+ .long datalabel dbar_otherboth2 + 40
+ .long dbar_otherwithout
+
+ .text
+ movi (datalabel dbar_mix + 8) & 65535,r30
+ movi (dbar_mix2 + 8) & 65535,r30
+ movi (datalabel dbar_mixboth + 80) & 65535,r30
+ movi (dbar_mixboth + 80) & 65535,r30
+ movi (dbar_mixboth2 + 64) & 65535,r30
+ movi (datalabel dbar_mixboth2 + 64) & 65535,r30
+ movi (dbar_mixwithout + 42) & 65535,r30
+ movi (dbar_mixwithout2 + 24) & 65535,r30
+
+ .data
+ .long dbar_mix + 4
+ .long datalabel dbar_mix2 + 48
+ .long datalabel dbar_mixboth + 400
+ .long dbar_mixboth + 420
+ .long dbar_mixboth2 + 248
+ .long datalabel dbar_mixboth2 + 240
+ .long dbar_mixwithout
+
+! Same as above, referencing symbol in other file *and* within that file.
+
+ .text
+ movi (datalabel dbazboth + 16) & 65535,r40
+ movi (dbazboth + 12) & 65535,r40
+
+ movi (dbazboth2 + 12) & 65535,r40
+ movi (datalabel dbazboth2 + 16) & 65535,r40
+
+ movi (dbazwithout + 24) & 65535,r30
+
+ .data
+ .long (datalabel dbaz + 8)
+ .long datalabel dbaz_other + 4
+ .long datalabel dbaz_otherboth + 40
+ .long dbaz_otherboth + 24
+ .long dbaz_otherboth2 + 24
+ .long datalabel dbaz_otherboth2 + 40
+ .long dbaz_otherwithout
+
+ .text
+ movi (datalabel dbaz_mix + 8) & 65535,r30
+ movi (dbaz_mix2 + 8) & 65535,r30
+ movi (datalabel dbaz_mixboth + 80) & 65535,r30
+ movi (dbaz_mixboth + 80) & 65535,r30
+ movi (dbaz_mixboth2 + 64) & 65535,r30
+ movi (datalabel dbaz_mixboth2 + 64) & 65535,r30
+ movi (dbaz_mixwithout + 42) & 65535,r30
+ movi (dbaz_mixwithout2 + 24) & 65535,r30
+
+ .data
+ .long dbaz_mix + 4
+ .long datalabel dbaz_mix2 + 48
+ .long datalabel dbaz_mixboth + 400
+ .long dbaz_mixboth + 420
+ .long dbaz_mixboth2 + 248
+ .long datalabel dbaz_mixboth2 + 240
+ .long dbaz_mixwithout
diff --git a/ld/testsuite/ld-sh/sh64/shdl-2.s b/ld/testsuite/ld-sh/sh64/shdl-2.s
new file mode 100644
index 0000000..a41fd52
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/shdl-2.s
@@ -0,0 +1,286 @@
+! Part two of test for inter-file DataLabel support.
+
+ .mode SHmedia
+ .text
+part2:
+ movi (datalabel foowithout + 16) & 65535, r24
+
+ .section .rodata
+ .long datalabel foo_otherwithout + 32
+
+ .text
+ movi (datalabel foo_mixwithout + 1024) & 65535, r24
+ .section .rodata
+ .long datalabel foo_mixwithout + 32
+
+ .text
+ movi (datalabel foo_mixwithout2 + 1024) & 65535, r24
+ .section .rodata
+ .long foo_mixwithout2 + 32
+
+ .text
+ .global bar
+bar:
+ nop
+
+ .global barboth
+barboth:
+ nop
+
+ .global barboth2
+barboth2:
+ nop
+
+ .global barwithout
+barwithout:
+ nop
+
+ .global bar_other
+bar_other:
+ nop
+ .global bar_otherboth
+bar_otherboth:
+ nop
+ .global bar_otherboth2
+bar_otherboth2:
+ nop
+ .global bar_otherwithout
+bar_otherwithout:
+ nop
+
+ .text
+
+ .global bar_mix
+bar_mix:
+ nop
+ .global bar_mix2
+bar_mix2:
+ nop
+ .global bar_mixboth
+bar_mixboth:
+ nop
+ .global bar_mixboth2
+bar_mixboth2:
+ nop
+ .global bar_mixwithout
+bar_mixwithout:
+ nop
+ .global bar_mixwithout2
+bar_mixwithout2:
+ nop
+
+! Almost-copy of "foo" in primary file.
+
+ .global baz
+baz:
+ nop
+ movi (datalabel baz + 8) & 65535,r30
+
+ .global bazboth
+bazboth:
+ nop
+ movi (datalabel bazboth + 16) & 65535,r40
+ movi (bazboth + 12) & 65535,r40
+
+ .global bazboth2
+bazboth2:
+ nop
+ movi (bazboth2 + 12) & 65535,r40
+ movi (datalabel bazboth2 + 16) & 65535,r40
+
+ .global bazwithout
+bazwithout:
+ nop
+ movi (datalabel bazwithout + 24) & 65535,r30
+
+ .global baz_other
+baz_other:
+ nop
+ .global baz_otherboth
+baz_otherboth:
+ nop
+ .global baz_otherboth2
+baz_otherboth2:
+ nop
+ .global baz_otherwithout
+baz_otherwithout:
+ nop
+
+ .section .rodata
+ .long datalabel baz_other + 4
+ .long datalabel baz_otherboth + 40
+ .long baz_otherboth + 24
+ .long baz_otherboth2 + 24
+ .long datalabel baz_otherboth2 + 40
+ .long baz_otherwithout
+
+ .text
+
+ .global baz_mix
+baz_mix:
+ nop
+ movi (datalabel baz_mix + 8) & 65535,r30
+ .global baz_mix2
+baz_mix2:
+ nop
+ movi (baz_mix2 + 8) & 65535,r30
+ .global baz_mixboth
+baz_mixboth:
+ nop
+ movi (datalabel baz_mixboth + 80) & 65535,r30
+ movi (baz_mixboth + 80) & 65535,r30
+ .global baz_mixboth2
+baz_mixboth2:
+ nop
+ movi (baz_mixboth2 + 64) & 65535,r30
+ movi (datalabel baz_mixboth2 + 64) & 65535,r30
+ .global baz_mixwithout
+baz_mixwithout:
+ nop
+ movi (baz_mixwithout + 42) & 65535,r30
+ .global baz_mixwithout2
+baz_mixwithout2:
+ nop
+ movi (baz_mixwithout2 + 24) & 65535,r30
+
+ .section .rodata
+ .long baz_mix + 4
+ .long datalabel baz_mix2 + 48
+ .long datalabel baz_mixboth + 400
+ .long baz_mixboth + 420
+ .long baz_mixboth2 + 248
+ .long datalabel baz_mixboth2 + 240
+ .long baz_mixwithout
+
+ .data
+ .long datalabel dfoowithout + 44
+ .long datalabel dfoo_mixwithout + 48
+ .long datalabel dfoo_mixwithout2 + 84
+
+ .global dbar
+dbar:
+ .long 0
+ .global dbarboth
+dbarboth:
+ .long 0
+ .global dbarboth2
+dbarboth2:
+ .long 0
+ .global dbarwithout
+dbarwithout:
+ .long 0
+ .global dbar_other
+dbar_other:
+ .long 0
+ .global dbar_otherboth
+dbar_otherboth:
+ .long 0
+ .global dbar_otherboth2
+dbar_otherboth2:
+ .long 0
+ .global dbar_otherwithout
+dbar_otherwithout:
+ .long 0
+
+ .global dbar_mix
+dbar_mix:
+ .long 0
+ .global dbar_mix2
+dbar_mix2:
+ .long 0
+ .global dbar_mixboth
+dbar_mixboth:
+ .long 0
+ .global dbar_mixboth2
+dbar_mixboth2:
+ .long 0
+ .global dbar_mixwithout
+dbar_mixwithout:
+ .long 0
+ .global dbar_mixwithout2
+dbar_mixwithout2:
+ .long 0
+
+! Almost-copy of "dfoo" in primary file.
+
+ .data
+ .global dbaz
+dbaz:
+ .long 0
+ .long (datalabel dbaz + 8)
+
+ .global dbazboth
+dbazboth:
+ .long 0
+ .long (datalabel dbazboth + 16)
+ .long (dbazboth + 12)
+
+ .global dbazboth2
+dbazboth2:
+ .long 0
+ .long (dbazboth2 + 12)
+ .long (datalabel dbazboth2 + 16)
+
+ .global dbazwithout
+dbazwithout:
+ .long 0
+ .long (dbazwithout + 24)
+
+ .global dbaz_other
+dbaz_other:
+ .long 0
+ .global dbaz_otherboth
+dbaz_otherboth:
+ .long 0
+ .global dbaz_otherboth2
+dbaz_otherboth2:
+ .long 0
+ .global dbaz_otherwithout
+dbaz_otherwithout:
+ .long 0
+
+ .section .rodata
+ .long datalabel dbaz_other + 4
+ .long datalabel dbaz_otherboth + 40
+ .long dbaz_otherboth + 24
+ .long dbaz_otherboth2 + 24
+ .long datalabel dbaz_otherboth2 + 40
+ .long dbaz_otherwithout
+
+ .data
+
+ .global dbaz_mix
+dbaz_mix:
+ .long 0
+ .long (datalabel dbaz_mix + 8)
+ .global dbaz_mix2
+dbaz_mix2:
+ .long 0
+ .long (dbaz_mix2 + 8)
+ .global dbaz_mixboth
+dbaz_mixboth:
+ .long 0
+ .long (datalabel dbaz_mixboth + 80)
+ .long (dbaz_mixboth + 80)
+ .global dbaz_mixboth2
+dbaz_mixboth2:
+ .long 0
+ .long (dbaz_mixboth2 + 64)
+ .long (datalabel dbaz_mixboth2 + 64)
+ .global dbaz_mixwithout
+dbaz_mixwithout:
+ .long 0
+ .long (dbaz_mixwithout + 42)
+ .global dbaz_mixwithout2
+dbaz_mixwithout2:
+ .long 0
+ .long (dbaz_mixwithout2 + 24)
+
+ .section .rodata
+ .long dbaz_mix + 4
+ .long datalabel dbaz_mix2 + 48
+ .long datalabel dbaz_mixboth + 400
+ .long dbaz_mixboth + 420
+ .long dbaz_mixboth2 + 248
+ .long datalabel dbaz_mixboth2 + 240
+ .long dbaz_mixwithout
diff --git a/ld/testsuite/ld-sh/sh64/shdl32.xd b/ld/testsuite/ld-sh/sh64/shdl32.xd
new file mode 100644
index 0000000..6f25b20
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/shdl32.xd
@@ -0,0 +1,136 @@
+.*: file format .*-sh64
+.*
+architecture: sh5, flags 0x0+112:
+EXEC_P, HAS_SYMS, D_PAGED
+start address 0x0+1001
+
+Program Header:
+ LOAD off 0x0+80 vaddr 0x0+1000 paddr 0x0+1000 align 2\*\*7
+ filesz 0x0+348 memsz 0x0+348 flags r-x
+ LOAD off 0x0+3c8 vaddr 0x0+13c8 paddr 0x0+13c8 align 2\*\*7
+ filesz 0x0+194 memsz 0x0+198 flags rw-
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+204 0+1000 0+1000 0+80 2\*\*0
+ CONTENTS, ALLOC, LOAD, READONLY, CODE
+ 1 \.rodata 0+144 0+1204 0+1204 0+284 2\*\*0
+ CONTENTS, ALLOC, LOAD, READONLY, DATA
+ 2 \.data 0+194 0+13c8 0+13c8 0+3c8 2\*\*0
+ CONTENTS, ALLOC, LOAD, DATA
+ 3 \.ctors 0+ 0+155c 0+155c 0+560 2\*\*0
+ CONTENTS
+ 4 \.dtors 0+ 0+155c 0+155c 0+560 2\*\*0
+ CONTENTS
+ 5 \.sbss 0+ 0+1560 0+1560 0+560 2\*\*0
+ CONTENTS
+ 6 \.bss 0+ 0+1560 0+1560 0+560 2\*\*0
+ ALLOC
+ 7 \.stack 0+ 0+80000 0+80000 0+560 2\*\*0
+ CONTENTS
+SYMBOL TABLE:
+0+1000 l d \.text 0+
+0+1204 l d \.rodata 0+
+0+13c8 l d \.data 0+
+0+155c l d \.ctors 0+
+0+155c l d \.dtors 0+
+0+1560 l d \.sbss 0+
+0+1560 l d \.bss 0+
+0+80000 l d \.stack 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+1150 l \.text 0+ 0x04 part2
+0+13f8 g \.data 0+ dfoo_otherboth2
+0+1178 g \.text 0+ 0x04 bar_otherwithout
+0+11b4 g \.text 0+ 0x04 bazwithout
+0+1428 g \.data 0+ dfoo_mixwithout
+0+1554 g \.data 0+ dbaz_mixwithout2
+0+11bc g \.text 0+ 0x04 baz_other
+0+11cc g \.text 0+ 0x04 baz_mix
+0+11c0 g \.text 0+ 0x04 baz_otherboth
+0+13e8 g \.data 0+ dfoowithout
+0+14b4 g \.data 0+ dbar
+0+106c g \.text 0+ 0x04 foo_mixwithout2
+0+11a8 g \.text 0+ 0x04 bazboth2
+0+13fc g \.data 0+ dfoo_otherwithout
+0+11c4 g \.text 0+ 0x04 baz_otherboth2
+0+1174 g \.text 0+ 0x04 bar_otherboth2
+0+1194 g \.text 0+ 0x04 baz
+0+13c8 g \.data 0+ dfoo
+0+14e8 g \.data 0+ dbar_mixwithout2
+0+13dc g \.data 0+ dfooboth2
+0+1408 g \.data 0+ dfoo_mix2
+0+154c g \.data 0+ dbaz_mixwithout
+0+1044 g \.text 0+ 0x04 foo_mix2
+0+1018 g \.text 0+ 0x04 fooboth2
+0+14cc g \.data 0+ dbar_otherboth2
+0+117c g \.text 0+ 0x04 bar_mix
+0+14d0 g \.data 0+ dbar_otherwithout
+0+11dc g \.text 0+ 0x04 baz_mixboth
+0+14c8 g \.data 0+ dbar_otherboth
+0+150c g \.data 0+ dbazwithout
+0+152c g \.data 0+ dbaz_mix2
+0+1184 g \.text 0+ 0x04 bar_mixboth
+0+13f4 g \.data 0+ dfoo_otherboth
+0+14dc g \.data 0+ dbar_mixboth
+0+1024 g \.text 0+ 0x04 foowithout
+0+14e4 g \.data 0+ dbar_mixwithout
+0+11fc g \.text 0+ 0x04 baz_mixwithout2
+0+1030 g \.text 0+ 0x04 foo_otherboth
+0+1540 g \.data 0+ dbaz_mixboth2
+0+104c g \.text 0+ 0x04 foo_mixboth
+0+1534 g \.data 0+ dbaz_mixboth
+0+103c g \.text 0+ 0x04 foo_mix
+0+1518 g \.data 0+ dbaz_otherboth
+0+14e0 g \.data 0+ dbar_mixboth2
+0+14ec g \.data 0+ dbaz
+0+1524 g \.data 0+ dbaz_mix
+0+155c g O \.dtors 0+ ___dtors
+0+141c g \.data 0+ dfoo_mixboth2
+0+119c g \.text 0+ 0x04 bazboth
+0+13f0 g \.data 0+ dfoo_other
+0+11e8 g \.text 0+ 0x04 baz_mixboth2
+0+1514 g \.data 0+ dbaz_other
+0+1164 g \.text 0+ 0x04 barboth2
+0+1168 g \.text 0+ 0x04 barwithout
+0+14d8 g \.data 0+ dbar_mix2
+0+1560 g O \*ABS\* 0+ __bss_start
+0+1410 g \.data 0+ dfoo_mixboth
+0+14c4 g \.data 0+ dbar_other
+0+1180 g \.text 0+ 0x04 bar_mix2
+0+14f4 g \.data 0+ dbazboth
+0+1038 g \.text 0+ 0x04 foo_otherwithout
+0+1190 g \.text 0+ 0x04 bar_mixwithout2
+0+155c g O \.ctors 0+ ___ctors_end
+0+1064 g \.text 0+ 0x04 foo_mixwithout
+0+116c g \.text 0+ 0x04 bar_other
+0+13d0 g \.data 0+ dfooboth
+0+1034 g \.text 0+ 0x04 foo_otherboth2
+0+1400 g \.data 0+ dfoo_mix
+0+155c g O \.ctors 0+ ___ctors
+0+14d4 g \.data 0+ dbar_mix
+0+100c g \.text 0+ 0x04 fooboth
+0+1170 g \.text 0+ 0x04 bar_otherboth
+0+14c0 g \.data 0+ dbarwithout
+0+1004 g \.text 0+ 0x04 foo
+0+102c g \.text 0+ 0x04 foo_other
+0+1560 g O \*ABS\* 0+ _edata
+0+1560 g O \*ABS\* 0+ _end
+0+1430 g \.data 0+ dfoo_mixwithout2
+0+1058 g \.text 0+ 0x04 foo_mixboth2
+0+11d4 g \.text 0+ 0x04 baz_mix2
+0+11c8 g \.text 0+ 0x04 baz_otherwithout
+0+1000 g \.text 0+ 0x04 start
+0+14bc g \.data 0+ dbarboth2
+0+118c g \.text 0+ 0x04 bar_mixwithout
+0+115c g \.text 0+ 0x04 bar
+0+80000 g O \.stack 0+ _stack
+0+1520 g \.data 0+ dbaz_otherwithout
+0+11f4 g \.text 0+ 0x04 baz_mixwithout
+0+1160 g \.text 0+ 0x04 barboth
+0+14b8 g \.data 0+ dbarboth
+0+1188 g \.text 0+ 0x04 bar_mixboth2
+0+155c g O \.dtors 0+ ___dtors_end
+0+151c g \.data 0+ dbaz_otherboth2
+0+1500 g \.data 0+ dbazboth2
diff --git a/ld/testsuite/ld-sh/sh64/shdl64.sd b/ld/testsuite/ld-sh/sh64/shdl64.sd
new file mode 100644
index 0000000..1891c87
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/shdl64.sd
@@ -0,0 +1,89 @@
+.*: file format .*-sh64
+
+Contents of section \.text:
+ 1000 6ff0fff0 6ff0fff0 cc4031e0 6ff0fff0 .*
+ 1010 cc407280 cc406680 6ff0fff0 cc409680 .*
+ 1020 cc40a280 6ff0fff0 cc40f5e0 6ff0fff0 .*
+ 1030 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 1040 cc4111e0 6ff0fff0 cc4135e0 6ff0fff0 .*
+ 1050 cc4271e0 cc4275e0 6ff0fff0 cc4265e0 .*
+ 1060 cc4261e0 6ff0fff0 cc423de0 6ff0fff0 .*
+ 1070 cc4215e0 6ff0fff0 cc4591e0 cc45c280 .*
+ 1080 cc45b680 cc45c680 cc45d280 cc4605e0 .*
+ 1090 cc4611e0 cc4625e0 cc4751e0 cc4755e0 .*
+ 10a0 cc4725e0 cc4721e0 cc46dde0 cc46a5e0 .*
+ 10b0 cc4671e0 cc46b280 cc46a680 cc46d680 .*
+ 10c0 cc46e280 cc4735e0 cc4751e0 cc4775e0 .*
+ 10d0 cc48b1e0 cc48b5e0 cc48a5e0 cc48a1e0 .*
+ 10e0 cc487de0 cc4855e0 cc532280 cc531280 .*
+ 10f0 cc532280 cc533280 cc5361e0 cc5371e0 .*
+ 1100 cc5381e0 cc54b1e0 cc54b1e0 cc5481e0 .*
+ 1110 cc5481e0 cc5439e0 cc5401e0 cc541280 .*
+ 1120 cc540280 cc543280 cc544280 cc5491e0 .*
+ 1130 cc54b1e0 cc54d1e0 cc5611e0 cc5611e0 .*
+ 1140 cc5601e0 cc5601e0 cc55d9e0 cc55b1e0 .*
+ 1150 cc40d180 cc519180 cc51b180 6ff0fff0 .*
+ 1160 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 1170 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 1180 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 1190 6ff0fff0 6ff0fff0 cc4671e0 6ff0fff0 .*
+ 11a0 cc46b280 cc46a680 6ff0fff0 cc46d680 .*
+ 11b0 cc46e280 6ff0fff0 cc4731e0 6ff0fff0 .*
+ 11c0 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 11d0 cc4751e0 6ff0fff0 cc4775e0 6ff0fff0 .*
+ 11e0 cc48b1e0 cc48b5e0 6ff0fff0 cc48a5e0 .*
+ 11f0 cc48a1e0 6ff0fff0 cc487de0 6ff0fff0 .*
+ 1200 cc4855e0 .*
+Contents of section \.rodata:
+ 1204 00001030 00001058 00001049 0000104d .*
+ 1214 0000105c 00001039 00001041 00001074 .*
+ 1224 000011dc 000011f1 00001151 00001148 .*
+ 1234 00001065 00001170 00001198 00001189 .*
+ 1244 0000118d 0000119c 00001179 00001181 .*
+ 1254 000011b0 00001314 00001329 00001281 .*
+ 1264 00001278 0000118d 000011c0 000011e8 .*
+ 1274 000011d9 000011dd 000011ec 000011c9 .*
+ 1284 000011d1 00001204 0000136c 00001381 .*
+ 1294 000012e1 000012d8 000011f5 000013f4 .*
+ 12a4 0000141c 0000140c 00001410 00001420 .*
+ 12b4 000013fc 00001404 00001438 000015a0 .*
+ 12c4 000015b4 00001514 0000150c 00001428 .*
+ 12d4 00001058 00001084 0000108d 000011c0 .*
+ 12e4 000011e8 000011d9 000011dd 000011ec .*
+ 12f4 000011c9 000011d1 00001204 0000136c .*
+ 1304 00001381 000012e1 000012d8 000011f5 .*
+ 1314 00001518 00001540 00001530 00001534 .*
+ 1324 00001544 00001520 00001528 0000155c .*
+ 1334 000016c4 000016d8 00001638 00001630 .*
+ 1344 0000154c .*
+Contents of section \.data:
+ 13c8 00000000 000013d0 00000000 000013e0 .*
+ 13d8 000013dc 00000000 000013e8 000013ec .*
+ 13e8 00000000 00001400 00000000 00000000 .*
+ 13f8 00000000 00000000 00000000 00001408 .*
+ 1408 00000000 00001410 00000000 00001460 .*
+ 1418 00001460 00000000 0000145c 0000145c .*
+ 1428 00000000 00001452 00000000 00001448 .*
+ 1438 000014bc 000014c8 000014f0 000014e0 .*
+ 1448 000014e4 000014f4 000014d0 000014d8 .*
+ 1458 00001508 0000166c 00001680 000015d8 .*
+ 1468 000015d0 000014e4 000014f4 00001518 .*
+ 1478 00001540 00001530 00001534 00001544 .*
+ 1488 00001520 00001528 0000155c 000016c4 .*
+ 1498 000016d8 00001638 00001630 0000154c .*
+ 14a8 00001414 00001458 00001484 00000000 .*
+ 14b8 00000000 00000000 00000000 00000000 .*
+ 14c8 00000000 00000000 00000000 00000000 .*
+ 14d8 00000000 00000000 00000000 00000000 .*
+ 14e8 00000000 00000000 000014f4 00000000 .*
+ 14f8 00001504 00001500 00000000 0000150c .*
+ 1508 00001510 00000000 00001524 00000000 .*
+ 1518 00000000 00000000 00000000 00000000 .*
+ 1528 0000152c 00000000 00001534 00000000 .*
+ 1538 00001584 00001584 00000000 00001580 .*
+ 1548 00001580 00000000 00001576 00000000 .*
+ 1558 0000156c .*
+Contents of section \.ctors:
+Contents of section \.dtors:
+Contents of section \.sbss:
+Contents of section \.stack:
diff --git a/ld/testsuite/ld-sh/sh64/shdl64.xd b/ld/testsuite/ld-sh/sh64/shdl64.xd
new file mode 100644
index 0000000..0629b6d
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/shdl64.xd
@@ -0,0 +1,136 @@
+.*: file format .*-sh64
+.*
+architecture: sh5, flags 0x0+112:
+EXEC_P, HAS_SYMS, D_PAGED
+start address 0x0+1001
+
+Program Header:
+ LOAD off 0x0+100 vaddr 0x0+1000 paddr 0x0+1000 align 2\*\*7
+ filesz 0x0+348 memsz 0x0+348 flags r-x
+ LOAD off 0x0+448 vaddr 0x0+13c8 paddr 0x0+13c8 align 2\*\*7
+ filesz 0x0+194 memsz 0x0+198 flags rw-
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+204 0+1000 0+1000 0+100 2\*\*0
+ CONTENTS, ALLOC, LOAD, READONLY, CODE
+ 1 \.rodata 0+144 0+1204 0+1204 0+304 2\*\*0
+ CONTENTS, ALLOC, LOAD, READONLY, DATA
+ 2 \.data 0+194 0+13c8 0+13c8 0+448 2\*\*0
+ CONTENTS, ALLOC, LOAD, DATA
+ 3 \.ctors 0+ 0+155c 0+155c 0+5e0 2\*\*0
+ CONTENTS
+ 4 \.dtors 0+ 0+155c 0+155c 0+5e0 2\*\*0
+ CONTENTS
+ 5 \.sbss 0+ 0+1560 0+1560 0+5e0 2\*\*0
+ CONTENTS
+ 6 \.bss 0+ 0+1560 0+1560 0+5e0 2\*\*0
+ ALLOC
+ 7 \.stack 0+ 0+80000 0+80000 0+5e0 2\*\*0
+ CONTENTS
+SYMBOL TABLE:
+0+1000 l d \.text 0+
+0+1204 l d \.rodata 0+
+0+13c8 l d \.data 0+
+0+155c l d \.ctors 0+
+0+155c l d \.dtors 0+
+0+1560 l d \.sbss 0+
+0+1560 l d \.bss 0+
+0+80000 l d \.stack 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+1150 l \.text 0+ 0x04 part2
+0+13f8 g \.data 0+ dfoo_otherboth2
+0+1178 g \.text 0+ 0x04 bar_otherwithout
+0+11b4 g \.text 0+ 0x04 bazwithout
+0+1428 g \.data 0+ dfoo_mixwithout
+0+1554 g \.data 0+ dbaz_mixwithout2
+0+11bc g \.text 0+ 0x04 baz_other
+0+11cc g \.text 0+ 0x04 baz_mix
+0+11c0 g \.text 0+ 0x04 baz_otherboth
+0+13e8 g \.data 0+ dfoowithout
+0+14b4 g \.data 0+ dbar
+0+106c g \.text 0+ 0x04 foo_mixwithout2
+0+11a8 g \.text 0+ 0x04 bazboth2
+0+13fc g \.data 0+ dfoo_otherwithout
+0+11c4 g \.text 0+ 0x04 baz_otherboth2
+0+1174 g \.text 0+ 0x04 bar_otherboth2
+0+1194 g \.text 0+ 0x04 baz
+0+13c8 g \.data 0+ dfoo
+0+14e8 g \.data 0+ dbar_mixwithout2
+0+13dc g \.data 0+ dfooboth2
+0+1408 g \.data 0+ dfoo_mix2
+0+154c g \.data 0+ dbaz_mixwithout
+0+1044 g \.text 0+ 0x04 foo_mix2
+0+1018 g \.text 0+ 0x04 fooboth2
+0+14cc g \.data 0+ dbar_otherboth2
+0+117c g \.text 0+ 0x04 bar_mix
+0+14d0 g \.data 0+ dbar_otherwithout
+0+11dc g \.text 0+ 0x04 baz_mixboth
+0+14c8 g \.data 0+ dbar_otherboth
+0+150c g \.data 0+ dbazwithout
+0+152c g \.data 0+ dbaz_mix2
+0+1184 g \.text 0+ 0x04 bar_mixboth
+0+13f4 g \.data 0+ dfoo_otherboth
+0+14dc g \.data 0+ dbar_mixboth
+0+1024 g \.text 0+ 0x04 foowithout
+0+14e4 g \.data 0+ dbar_mixwithout
+0+11fc g \.text 0+ 0x04 baz_mixwithout2
+0+1030 g \.text 0+ 0x04 foo_otherboth
+0+1540 g \.data 0+ dbaz_mixboth2
+0+104c g \.text 0+ 0x04 foo_mixboth
+0+1534 g \.data 0+ dbaz_mixboth
+0+103c g \.text 0+ 0x04 foo_mix
+0+1518 g \.data 0+ dbaz_otherboth
+0+14e0 g \.data 0+ dbar_mixboth2
+0+14ec g \.data 0+ dbaz
+0+1524 g \.data 0+ dbaz_mix
+0+155c g O \.dtors 0+ ___dtors
+0+141c g \.data 0+ dfoo_mixboth2
+0+119c g \.text 0+ 0x04 bazboth
+0+13f0 g \.data 0+ dfoo_other
+0+11e8 g \.text 0+ 0x04 baz_mixboth2
+0+1514 g \.data 0+ dbaz_other
+0+1164 g \.text 0+ 0x04 barboth2
+0+1168 g \.text 0+ 0x04 barwithout
+0+14d8 g \.data 0+ dbar_mix2
+0+1560 g O \*ABS\* 0+ __bss_start
+0+1410 g \.data 0+ dfoo_mixboth
+0+14c4 g \.data 0+ dbar_other
+0+1180 g \.text 0+ 0x04 bar_mix2
+0+14f4 g \.data 0+ dbazboth
+0+1038 g \.text 0+ 0x04 foo_otherwithout
+0+1190 g \.text 0+ 0x04 bar_mixwithout2
+0+155c g O \.ctors 0+ ___ctors_end
+0+1064 g \.text 0+ 0x04 foo_mixwithout
+0+116c g \.text 0+ 0x04 bar_other
+0+13d0 g \.data 0+ dfooboth
+0+1034 g \.text 0+ 0x04 foo_otherboth2
+0+1400 g \.data 0+ dfoo_mix
+0+155c g O \.ctors 0+ ___ctors
+0+14d4 g \.data 0+ dbar_mix
+0+100c g \.text 0+ 0x04 fooboth
+0+1170 g \.text 0+ 0x04 bar_otherboth
+0+14c0 g \.data 0+ dbarwithout
+0+1004 g \.text 0+ 0x04 foo
+0+102c g \.text 0+ 0x04 foo_other
+0+1560 g O \*ABS\* 0+ _edata
+0+1560 g O \*ABS\* 0+ _end
+0+1430 g \.data 0+ dfoo_mixwithout2
+0+1058 g \.text 0+ 0x04 foo_mixboth2
+0+11d4 g \.text 0+ 0x04 baz_mix2
+0+11c8 g \.text 0+ 0x04 baz_otherwithout
+0+1000 g \.text 0+ 0x04 start
+0+14bc g \.data 0+ dbarboth2
+0+118c g \.text 0+ 0x04 bar_mixwithout
+0+115c g \.text 0+ 0x04 bar
+0+80000 g O \.stack 0+ _stack
+0+1520 g \.data 0+ dbaz_otherwithout
+0+11f4 g \.text 0+ 0x04 baz_mixwithout
+0+1160 g \.text 0+ 0x04 barboth
+0+14b8 g \.data 0+ dbarboth
+0+1188 g \.text 0+ 0x04 bar_mixboth2
+0+155c g O \.dtors 0+ ___dtors_end
+0+151c g \.data 0+ dbaz_otherboth2
+0+1500 g \.data 0+ dbazboth2
diff --git a/ld/testsuite/ld-sh/sh64/shmix-1.s b/ld/testsuite/ld-sh/sh64/shmix-1.s
new file mode 100644
index 0000000..0320b62
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/shmix-1.s
@@ -0,0 +1,32 @@
+! Check mixed-mode objects; different sections holding different ISA:s.
+ .mode SHcompact
+ .text
+ .global start
+start:
+ bt forw
+ mova start2,r0
+start2:
+ nop
+ nop
+forw:
+ nop
+ .long $
+ .long start2
+ .long mediacode2
+
+ .data
+ .long $
+ .long start2
+ .long mediacode2
+
+ .section .text.media,"ax"
+ .mode SHmedia
+ .align 2
+mediacode:
+ ptb forw,tr4
+ pt start2,tr5
+mediacode2:
+ movi start2,r54
+ movi mediacode2,r45
+ pta mediacode2,tr7
+ nop
diff --git a/ld/testsuite/ld-sh/sh64/shmix-2.s b/ld/testsuite/ld-sh/sh64/shmix-2.s
new file mode 100644
index 0000000..2ea7344
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/shmix-2.s
@@ -0,0 +1,28 @@
+! A SHmedia object, that we will link to a SHcompact object.
+! We will be using .text for the SHmedia code and .text.compact for the
+! SHcompact code, so we don't get two ISA in the same section.
+ .text
+ .mode SHmedia
+
+ .global start
+ .global medialabel1
+ .global medialabel2
+ .global medialabel3
+start:
+ movi compactlabel1,r14
+ movi compactlabel4,r14
+medialabel1:
+ pt compactlabel2,tr6
+medialabel2:
+ nop
+
+ .section .rodata
+ .long compactlabel3
+medialabel3:
+ .long compactlabel5
+
+ .data
+ .global medialabel4
+ .long 0
+medialabel4:
+ .long compactlabel2
diff --git a/ld/testsuite/ld-sh/sh64/shmix-3.s b/ld/testsuite/ld-sh/sh64/shmix-3.s
new file mode 100644
index 0000000..637a982
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/shmix-3.s
@@ -0,0 +1,31 @@
+! A SHcompact object, that we will link to a SHmedia object.
+! We will be using .text for the SHmedia code and .text.compact for the
+! SHcompact code, so we don't get two ISA in the same section.
+ .section .text.compact,"ax"
+ .mode SHcompact
+ .global compactlabel1
+ .global compactlabel2
+ .global compactlabel3
+ .global compactlabel4
+ .global compactlabel5
+locallabel:
+ nop
+compactlabel1:
+ mova compactlabel2,r0
+compactlabel2:
+ mova compactlabel3,r0
+ nop
+compactlabel3:
+ nop
+ .long medialabel1
+ .long medialabel4
+
+ .section .rodata
+ .long medialabel2
+compactlabel4:
+ .long medialabel3
+
+ .data
+ .long 0
+compactlabel5:
+ .long medialabel4
diff --git a/ld/testsuite/ld-srec/srec.exp b/ld/testsuite/ld-srec/srec.exp
index 7496dcd..d3fa764 100644
--- a/ld/testsuite/ld-srec/srec.exp
+++ b/ld/testsuite/ld-srec/srec.exp
@@ -243,6 +243,14 @@ proc run_srec_test { test objs } {
set flags "$flags --defsym V_SPILL=0 --defsym V_FILL=0"
}
+ if [istarget sh64*-*-elf] {
+ # This is what gcc passes to ld by default.
+ set flags "-mshelf32"
+ # SH64 targets cannot convert format in the linker
+ # using the -oformat command line switch.
+ setup_xfail "sh64*-*-*"
+ }
+
if {[istarget arm*-*-*] || \
[istarget strongarm*-*-*] || \
[istarget xscale*-*-*] || \
diff --git a/ld/testsuite/ld-undefined/undefined.exp b/ld/testsuite/ld-undefined/undefined.exp
index 0829b01..1910ac5 100644
--- a/ld/testsuite/ld-undefined/undefined.exp
+++ b/ld/testsuite/ld-undefined/undefined.exp
@@ -134,6 +134,7 @@ setup_xfail i?86-*-freebsd*
#setup_xfail thumb-*-elf
setup_xfail mcore-*-elf
setup_xfail mips-sgi-irix6*
+setup_xfail "sh64-*-*"
# The undefined test fails on 31 bit s/390 because the address of the
# function `this_function_is_not_defined' is stored in the literal pool of