summaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog41
-rw-r--r--ld/emulparams/armelf.sh2
-rw-r--r--ld/emulparams/armelf_linux.sh3
-rw-r--r--ld/emulparams/elf32bmip.sh1
-rwxr-xr-xld/emulparams/elf32bmipn32.sh1
-rw-r--r--ld/emulparams/elf32btsmipn32.sh1
-rw-r--r--ld/emulparams/elf64_ia64.sh2
-rw-r--r--ld/emulparams/shlelf_linux.sh1
-rw-r--r--ld/emultempl/pe.em4
-rwxr-xr-xld/genscripts.sh18
-rw-r--r--ld/testsuite/ChangeLog15
-rw-r--r--ld/testsuite/ld-arm/arm-app-abs32.d29
-rw-r--r--ld/testsuite/ld-arm/arm-app-abs32.r8
-rw-r--r--ld/testsuite/ld-arm/arm-app-abs32.s16
-rw-r--r--ld/testsuite/ld-arm/arm-elf.exp3
-rw-r--r--ld/testsuite/ld-h8300/h8300.exp2
-rw-r--r--ld/testsuite/ld-h8300/relax-5-coff.d50
-rw-r--r--ld/testsuite/ld-h8300/relax-5.d50
-rw-r--r--ld/testsuite/ld-h8300/relax-5.s66
19 files changed, 300 insertions, 13 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 9d4edc90a05..373d7ac0e03 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,36 @@
+2004-02-09 Daniel Jacobowitz <drow@mvista.com>
+
+ * emulparams/armelf.sh, emulparams/armelf_linux.sh: Move
+ .note.gnu.arm.ident to after allocated sections. Mark its
+ address as 0.
+
+2004-02-09 Daniel Jacobowitz <drow@mvista.com>
+
+ * emulparams/armelf_linux.sh (COMMONPAGESIZE): Set to 4KB.
+ * emulparams/elf32bmip.sh (COMMONPAGESIZE): Likewise.
+ * emulparams/elf32bmipn32.sh (COMMONPAGESIZE): Likewise.
+ * emulparams/elf32btsmipn32.sh (COMMONPAGESIZE): Likewise.
+ * emulparams/shlelf_linux.sh (COMMONPAGESIZE): Likewise.
+
+2004-02-05 Nick Clifton <nickc@redhat.com>
+
+ * emultempl/pe.em (_after_open): Fix typo in previous delta.
+
+2004-02-04 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * emultempl/pe.em (_after_open): Fix thinko in 2003-12-18 patch.
+
+2004-01-28 Alan Modra <amodra@bigpond.net.au>
+
+ * genscripts.sh: Fix typo.
+
+ * genscripts.sh: Apply $LIBPATH_SUFFIX to $tool_lib and $libdir too.
+
+2004-01-24 Jakub Jelinek <jakub@redhat.com>
+
+ * emulparams/elf64_ia64.sh: Put .rela.opd into
+ OTHER_GOT_RELOC_SECTIONS instead of OTHER_PLT_RELOC_SECTIONS.
+
2004-01-20 Danny Smith <dannysmith@users.sourceforge.net>
* pe-dll.c (pe_create_import_fixup): Clear WP_TEXT flag.
@@ -14,13 +47,13 @@
* ldlang.c (lang_get_regions): Add extra parameter 'have_vma'
which if true will prevent the LMA region being used as a
replacement for a default VMA region.
- (lang_leave_output_section_statement): Pass extra parameter.
- (lang_leave_overlay): Likewise.
- * ld.texinfo (Output Section LMA): Document that the LMA
+ (lang_leave_output_section_statement): Pass extra parameter.
+ (lang_leave_overlay): Likewise.
+ * ld.texinfo (Output Section LMA): Document that the LMA
region can be set to the VMA region if no VMA has been set.
* ldlang.h (struct lang_output_section_phdr_list): Create a
typedef for this type. Minor formatting fixes.
-
+
2004-01-13 Nick Clifton <nickc@redhat.com>
* ldlang.c (lang_size_sections_1): If dot is advanced, then
diff --git a/ld/emulparams/armelf.sh b/ld/emulparams/armelf.sh
index 71e305909c9..35a6d232573 100644
--- a/ld/emulparams/armelf.sh
+++ b/ld/emulparams/armelf.sh
@@ -7,9 +7,9 @@ TEXT_START_ADDR=0x8000
TEMPLATE_NAME=elf32
EXTRA_EM_FILE=armelf
OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
-OTHER_READONLY_SECTIONS='.note.gnu.arm.ident : { KEEP (*(.note.gnu.arm.ident)) }'
OTHER_BSS_SYMBOLS='__bss_start__ = .;'
OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
+OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
DATA_START_SYMBOLS='__data_start = . ;';
diff --git a/ld/emulparams/armelf_linux.sh b/ld/emulparams/armelf_linux.sh
index 248b708a1b1..88a2d19151d 100644
--- a/ld/emulparams/armelf_linux.sh
+++ b/ld/emulparams/armelf_linux.sh
@@ -4,15 +4,16 @@ OUTPUT_FORMAT="elf32-littlearm"
BIG_OUTPUT_FORMAT="elf32-bigarm"
LITTLE_OUTPUT_FORMAT="elf32-littlearm"
MAXPAGESIZE=0x8000
+COMMONPAGESIZE=0x1000
TEMPLATE_NAME=elf32
EXTRA_EM_FILE=armelf
GENERATE_SHLIB_SCRIPT=yes
DATA_START_SYMBOLS='__data_start = . ;';
OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
-OTHER_READONLY_SECTIONS='.note.gnu.arm.ident : { KEEP (*(.note.gnu.arm.ident)) }'
OTHER_BSS_SYMBOLS='__bss_start__ = .;'
OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
+OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
TEXT_START_ADDR=0x00008000
diff --git a/ld/emulparams/elf32bmip.sh b/ld/emulparams/elf32bmip.sh
index fa7d671ffdf..94e1c9c9a24 100644
--- a/ld/emulparams/elf32bmip.sh
+++ b/ld/emulparams/elf32bmip.sh
@@ -8,6 +8,7 @@ LITTLE_OUTPUT_FORMAT="elf32-littlemips"
TEXT_START_ADDR=0x0400000
test -n "${EMBEDDED}" || DATA_ADDR=0x10000000
MAXPAGESIZE=0x40000
+COMMONPAGESIZE=0x1000
NONPAGED_TEXT_START_ADDR=0x0400000
SHLIB_TEXT_START_ADDR=0x5ffe0000
test -n "${EMBEDDED}" || TEXT_DYNAMIC=
diff --git a/ld/emulparams/elf32bmipn32.sh b/ld/emulparams/elf32bmipn32.sh
index 75338379ee1..3de791c23c8 100755
--- a/ld/emulparams/elf32bmipn32.sh
+++ b/ld/emulparams/elf32bmipn32.sh
@@ -3,6 +3,7 @@ OUTPUT_FORMAT="elf32-nbigmips"
BIG_OUTPUT_FORMAT="elf32-nbigmips"
LITTLE_OUTPUT_FORMAT="elf32-nlittlemips"
SHLIB_TEXT_START_ADDR=0x5ffe0000
+COMMONPAGESIZE=0x1000
# IRIX6 defines these symbols. 0x34 is the size of the ELF header.
EXECUTABLE_SYMBOLS="
diff --git a/ld/emulparams/elf32btsmipn32.sh b/ld/emulparams/elf32btsmipn32.sh
index 6cfa48abb76..5ca6797e52a 100644
--- a/ld/emulparams/elf32btsmipn32.sh
+++ b/ld/emulparams/elf32btsmipn32.sh
@@ -5,6 +5,7 @@
OUTPUT_FORMAT="elf32-ntradbigmips"
BIG_OUTPUT_FORMAT="elf32-ntradbigmips"
LITTLE_OUTPUT_FORMAT="elf32-ntradlittlemips"
+COMMONPAGESIZE=0x1000
# Magic sections.
OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
diff --git a/ld/emulparams/elf64_ia64.sh b/ld/emulparams/elf64_ia64.sh
index 100aca1ac02..60c8c4c9ebf 100644
--- a/ld/emulparams/elf64_ia64.sh
+++ b/ld/emulparams/elf64_ia64.sh
@@ -28,7 +28,7 @@ test -z "$CREATE_PIE" && OTHER_READONLY_SECTIONS="
.opd ${RELOCATING-0} : { *(.opd) }"
test -n "$CREATE_PIE" && OTHER_READWRITE_SECTIONS="
.opd ${RELOCATING-0} : { *(.opd) }"
-test -n "$CREATE_PIE" && OTHER_PLT_RELOC_SECTIONS="${OTHER_PLT_RELOC_SECTIONS}
+test -n "$CREATE_PIE" && OTHER_GOT_RELOC_SECTIONS="
.rela.opd ${RELOCATING-0} : { *(.rela.opd) }"
OTHER_READONLY_SECTIONS="${OTHER_READONLY_SECTIONS}
.IA_64.unwind_info ${RELOCATING-0} : { *(.IA_64.unwind_info${RELOCATING+* .gnu.linkonce.ia64unwi.*}) }
diff --git a/ld/emulparams/shlelf_linux.sh b/ld/emulparams/shlelf_linux.sh
index 7d90ab33cc0..528b7257f3b 100644
--- a/ld/emulparams/shlelf_linux.sh
+++ b/ld/emulparams/shlelf_linux.sh
@@ -5,6 +5,7 @@ SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-sh-linux"
TEXT_START_ADDR=0x400000
MAXPAGESIZE=0x10000
+COMMONPAGESIZE=0x1000
ARCH=sh
MACHINE=
TEMPLATE_NAME=elf32
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 4f12d7f5bf9..7d6c2e8a6d1 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -1139,8 +1139,8 @@ gld_${EMULATION_NAME}_after_open (void)
extension, and use that for the remainder of the
comparisons. */
pnt = strrchr (is3->the_bfd->filename, '.');
- if (pnt != NULL && strcmp (pnt, ".dll") != 0)
- continue;
+ if (pnt != NULL && strcmp (pnt, ".dll") == 0)
+ break;
}
if (is3 == NULL)
diff --git a/ld/genscripts.sh b/ld/genscripts.sh
index 4c7226ad6b0..01682036f33 100755
--- a/ld/genscripts.sh
+++ b/ld/genscripts.sh
@@ -128,10 +128,20 @@ fi
if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then
LIB_PATH2=
- if [ x"$use_sysroot" != xyes ] ; then
- LIB_PATH2=${libdir}
+
+ libs=${NATIVE_LIB_DIRS}
+ if [ "x${use_sysroot}" != "xyes" ] ; then
+ case " ${libs} " in
+ *" ${libdir} "*) ;;
+ *) libs="${libdir} ${libs}" ;;
+ esac
+ case " ${libs} " in
+ *" ${tool_lib} "*) ;;
+ *) libs="${tool_lib} ${libs}" ;;
+ esac
fi
- for lib in ${NATIVE_LIB_DIRS}; do
+
+ for lib in ${libs}; do
# The "=" is harmless if we aren't using a sysroot, but also needless.
if [ "x${use_sysroot}" = "xyes" ] ; then
lib="=${lib}"
@@ -161,13 +171,13 @@ if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then
esac
fi
done
+
case :${LIB_PATH}:${LIB_PATH2}: in
*:: | ::*) LIB_PATH=${LIB_PATH}${LIB_PATH2} ;;
*) LIB_PATH=${LIB_PATH}:${LIB_PATH2} ;;
esac
fi
-
# Always search $(tooldir)/lib, aka /usr/local/TARGET/lib, except for
# sysrooted configurations and when LIBPATH=":".
if [ "x${use_sysroot}" != "xyes" ] ; then
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 80c5d1eba76..f67c5ecf6bd 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,18 @@
+2004-02-09 Anil Paranjpe <anilp1@KPITCummins.com>
+
+ * ld-h8300/relax-5.s: New file: Source for relax-5 test.
+ * ld-h8300/relax-5.d: New file: Expected output and commands for
+ assembling and linking the relax-5 test.
+ * ld-h8300/relax-5-coff.d: New file: Variant for the COFF based
+ toolchain.
+ * ld-h8300/h8300-exp: Run the relax-5 test.
+
+2004-01-23 Daniel Jacobowitz <drow@mvista.com>
+
+ * ld-arm/arm-app-abs32.s, ld-arm/arm-app-abs32.r,
+ ld-arm/arm-app-abs32.d: New files.
+ * ld-arm/arm-elf.exp: Add arm-app-abs32 testcase.
+
2004-01-19 Alan Modra <amodra@bigpond.net.au>
* ld-i386/tlsbin.dd: Adjust for changed sib printing.
diff --git a/ld/testsuite/ld-arm/arm-app-abs32.d b/ld/testsuite/ld-arm/arm-app-abs32.d
new file mode 100644
index 00000000000..4ebff1e838a
--- /dev/null
+++ b/ld/testsuite/ld-arm/arm-app-abs32.d
@@ -0,0 +1,29 @@
+
+tmpdir/arm-app-abs32: file format elf32-littlearm
+architecture: arm, flags 0x00000112:
+EXEC_P, HAS_SYMS, D_PAGED
+start address .*
+
+Disassembly of section .plt:
+
+.* <.plt>:
+ .*: e52de004 str lr, \[sp, #-4\]!
+ .*: e59fe004 ldr lr, \[pc, #4\] ; .* <.plt\+0x10>
+ .*: e08fe00e add lr, pc, lr
+ .*: e5bef008 ldr pc, \[lr, #8\]!
+ .*: .* .*
+ .*: e28fc6.* add ip, pc, #.* ; .*
+ .*: e28cca.* add ip, ip, #.* ; .*
+ .*: e5bcf.* ldr pc, \[ip, #.*\]!
+Disassembly of section .text:
+
+.* <_start>:
+ .*: e1a0c00d mov ip, sp
+ .*: e92dd800 stmdb sp!, {fp, ip, lr, pc}
+ .*: e59f0004 ldr r0, \[pc, #4\] ; .* <.text\+0x14>
+ .*: e89d6800 ldmia sp, {fp, sp, lr}
+ .*: e12fff1e bx lr
+ .*: .* .*
+
+.* <app_func2>:
+ .*: e12fff1e bx lr
diff --git a/ld/testsuite/ld-arm/arm-app-abs32.r b/ld/testsuite/ld-arm/arm-app-abs32.r
new file mode 100644
index 00000000000..b9e99661ea0
--- /dev/null
+++ b/ld/testsuite/ld-arm/arm-app-abs32.r
@@ -0,0 +1,8 @@
+
+tmpdir/arm-app-abs32: file format elf32-littlearm
+
+DYNAMIC RELOCATION RECORDS
+OFFSET TYPE VALUE
+.* R_ARM_JUMP_SLOT lib_func1
+
+
diff --git a/ld/testsuite/ld-arm/arm-app-abs32.s b/ld/testsuite/ld-arm/arm-app-abs32.s
new file mode 100644
index 00000000000..a1cf52690a7
--- /dev/null
+++ b/ld/testsuite/ld-arm/arm-app-abs32.s
@@ -0,0 +1,16 @@
+ .text
+ .globl _start
+_start:
+ mov ip, sp
+ stmdb sp!, {r11, ip, lr, pc}
+ ldr a1, .Lval
+ ldmia sp, {r11, sp, lr}
+ bx lr
+
+.Lval:
+ .long lib_func1
+
+ .globl app_func2
+app_func2:
+ bx lr
+
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index 581ebb6292e..2f32a11de34 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -44,6 +44,9 @@ set armelftests {
{"Simple static application" "" "" {arm-static-app.s}
{{objdump -fdw arm-static-app.d} {objdump -rw arm-static-app.r}}
"arm-static-app"}
+ {"Non-pcrel function reference" "tmpdir/arm-lib.so" "" {arm-app-abs32.s}
+ {{objdump -fdw arm-app-abs32.d} {objdump -Rw arm-app-abs32.r}}
+ "arm-app-abs32"}
}
run_ld_link_tests $armelftests
diff --git a/ld/testsuite/ld-h8300/h8300.exp b/ld/testsuite/ld-h8300/h8300.exp
index a8e8ddaf60d..a063f4e1cdf 100644
--- a/ld/testsuite/ld-h8300/h8300.exp
+++ b/ld/testsuite/ld-h8300/h8300.exp
@@ -30,7 +30,9 @@ if {[istarget *-elf]} {
run_dump_test relax-2
run_dump_test relax-3
run_dump_test relax-4
+ run_dump_test relax-5
} else {
run_dump_test relax-3-coff
run_dump_test relax-4-coff
+ run_dump_test relax-5-coff
}
diff --git a/ld/testsuite/ld-h8300/relax-5-coff.d b/ld/testsuite/ld-h8300/relax-5-coff.d
new file mode 100644
index 00000000000..dae5d2344f4
--- /dev/null
+++ b/ld/testsuite/ld-h8300/relax-5-coff.d
@@ -0,0 +1,50 @@
+# name: H8300 Relaxation Test 5
+# source: relax-5.s
+# ld: --relax -m h8300s
+# objdump: -d --no-show-raw-insn
+
+.*: file format .*-h8300
+
+Disassembly of section .text:
+
+00000100 <_start>:
+ 100: 01 40 6b 00 00 00 ldc @0x0:16,ccr
+ 106: 01 40 6b 00 7f ff ldc @0x7fff:16,ccr
+ 10c: 01 40 6b 20 00 00 80 00 ldc @0x8000:32,ccr
+ 114: 01 40 6b 20 00 00 ff 00 ldc @0xff00:32,ccr
+ 11c: 01 40 6b 20 00 ff ff 00 ldc @0xffff00:32,ccr
+ 124: 01 40 6b 20 ff ff 7f ff ldc @0xffff7fff:32,ccr
+ 12c: 01 40 6b 00 80 00 ldc @0x8000:16,ccr
+ 132: 01 40 6b 00 fe ff ldc @0xfeff:16,ccr
+ 138: 01 40 6b 00 ff 00 ldc @0xff00:16,ccr
+ 13e: 01 40 6b 00 ff ff ldc @0xffff:16,ccr
+ 144: 01 40 6b 80 00 00 stc ccr,@0x0:16
+ 14a: 01 40 6b 80 7f ff stc ccr,@0x7fff:16
+ 150: 01 40 6b a0 00 00 80 00 stc ccr,@0x8000:32
+ 158: 01 40 6b a0 00 00 ff 00 stc ccr,@0xff00:32
+ 160: 01 40 6b a0 00 ff ff 00 stc ccr,@0xffff00:32
+ 168: 01 40 6b a0 ff ff 7f ff stc ccr,@0xffff7fff:32
+ 170: 01 40 6b 80 80 00 stc ccr,@0x8000:16
+ 176: 01 40 6b 80 fe ff stc ccr,@0xfeff:16
+ 17c: 01 40 6b 80 ff 00 stc ccr,@0xff00:16
+ 182: 01 40 6b 80 ff ff stc ccr,@0xffff:16
+ 188: 01 41 6b 00 00 00 ldc @0x0:16,exr
+ 18e: 01 41 6b 00 7f ff ldc @0x7fff:16,exr
+ 194: 01 41 6b 20 00 00 80 00 ldc @0x8000:32,exr
+ 19c: 01 41 6b 20 00 00 ff 00 ldc @0xff00:32,exr
+ 1a4: 01 41 6b 20 00 ff ff 00 ldc @0xffff00:32,exr
+ 1ac: 01 41 6b 20 ff ff 7f ff ldc @0xffff7fff:32,exr
+ 1b4: 01 41 6b 00 80 00 ldc @0x8000:16,exr
+ 1ba: 01 41 6b 00 fe ff ldc @0xfeff:16,exr
+ 1c0: 01 41 6b 00 ff 00 ldc @0xff00:16,exr
+ 1c6: 01 41 6b 00 ff ff ldc @0xffff:16,exr
+ 1cc: 01 41 6b 80 00 00 stc exr,@0x0:16
+ 1d2: 01 41 6b 80 7f ff stc exr,@0x7fff:16
+ 1d8: 01 41 6b a0 00 00 80 00 stc exr,@0x8000:32
+ 1e0: 01 41 6b a0 00 00 ff 00 stc exr,@0xff00:32
+ 1e8: 01 41 6b a0 00 ff ff 00 stc exr,@0xffff00:32
+ 1f0: 01 41 6b a0 ff ff 7f ff stc exr,@0xffff7fff:32
+ 1f8: 01 41 6b 80 80 00 stc exr,@0x8000:16
+ 1fe: 01 41 6b 80 fe ff stc exr,@0xfeff:16
+ 204: 01 41 6b 80 ff 00 stc exr,@0xff00:16
+ 20a: 01 41 6b 80 ff ff stc exr,@0xffff:16
diff --git a/ld/testsuite/ld-h8300/relax-5.d b/ld/testsuite/ld-h8300/relax-5.d
new file mode 100644
index 00000000000..d33eb0fa485
--- /dev/null
+++ b/ld/testsuite/ld-h8300/relax-5.d
@@ -0,0 +1,50 @@
+# name: H8300 Relaxation Test 5
+# source: relax-5.s
+# ld: --relax -m h8300self
+# objdump: -d --no-show-raw-insn
+
+.*: file format .*-h8300
+
+Disassembly of section .text:
+
+00000100 <_start>:
+ 100: 01 40 6b 00 00 00 ldc @0x0:16,ccr
+ 106: 01 40 6b 00 7f ff ldc @0x7fff:16,ccr
+ 10c: 01 40 6b 20 00 00 80 00 ldc @0x8000:32,ccr
+ 114: 01 40 6b 20 00 00 ff 00 ldc @0xff00:32,ccr
+ 11c: 01 40 6b 20 00 ff ff 00 ldc @0xffff00:32,ccr
+ 124: 01 40 6b 20 ff ff 7f ff ldc @0xffff7fff:32,ccr
+ 12c: 01 40 6b 00 80 00 ldc @0x8000:16,ccr
+ 132: 01 40 6b 00 fe ff ldc @0xfeff:16,ccr
+ 138: 01 40 6b 00 ff 00 ldc @0xff00:16,ccr
+ 13e: 01 40 6b 00 ff ff ldc @0xffff:16,ccr
+ 144: 01 40 6b 80 00 00 stc ccr,@0x0:16
+ 14a: 01 40 6b 80 7f ff stc ccr,@0x7fff:16
+ 150: 01 40 6b a0 00 00 80 00 stc ccr,@0x8000:32
+ 158: 01 40 6b a0 00 00 ff 00 stc ccr,@0xff00:32
+ 160: 01 40 6b a0 00 ff ff 00 stc ccr,@0xffff00:32
+ 168: 01 40 6b a0 ff ff 7f ff stc ccr,@0xffff7fff:32
+ 170: 01 40 6b 80 80 00 stc ccr,@0x8000:16
+ 176: 01 40 6b 80 fe ff stc ccr,@0xfeff:16
+ 17c: 01 40 6b 80 ff 00 stc ccr,@0xff00:16
+ 182: 01 40 6b 80 ff ff stc ccr,@0xffff:16
+ 188: 01 41 6b 00 00 00 ldc @0x0:16,exr
+ 18e: 01 41 6b 00 7f ff ldc @0x7fff:16,exr
+ 194: 01 41 6b 20 00 00 80 00 ldc @0x8000:32,exr
+ 19c: 01 41 6b 20 00 00 ff 00 ldc @0xff00:32,exr
+ 1a4: 01 41 6b 20 00 ff ff 00 ldc @0xffff00:32,exr
+ 1ac: 01 41 6b 20 ff ff 7f ff ldc @0xffff7fff:32,exr
+ 1b4: 01 41 6b 00 80 00 ldc @0x8000:16,exr
+ 1ba: 01 41 6b 00 fe ff ldc @0xfeff:16,exr
+ 1c0: 01 41 6b 00 ff 00 ldc @0xff00:16,exr
+ 1c6: 01 41 6b 00 ff ff ldc @0xffff:16,exr
+ 1cc: 01 41 6b 80 00 00 stc exr,@0x0:16
+ 1d2: 01 41 6b 80 7f ff stc exr,@0x7fff:16
+ 1d8: 01 41 6b a0 00 00 80 00 stc exr,@0x8000:32
+ 1e0: 01 41 6b a0 00 00 ff 00 stc exr,@0xff00:32
+ 1e8: 01 41 6b a0 00 ff ff 00 stc exr,@0xffff00:32
+ 1f0: 01 41 6b a0 ff ff 7f ff stc exr,@0xffff7fff:32
+ 1f8: 01 41 6b 80 80 00 stc exr,@0x8000:16
+ 1fe: 01 41 6b 80 fe ff stc exr,@0xfeff:16
+ 204: 01 41 6b 80 ff 00 stc exr,@0xff00:16
+ 20a: 01 41 6b 80 ff ff stc exr,@0xffff:16
diff --git a/ld/testsuite/ld-h8300/relax-5.s b/ld/testsuite/ld-h8300/relax-5.s
new file mode 100644
index 00000000000..b5afedbfcca
--- /dev/null
+++ b/ld/testsuite/ld-h8300/relax-5.s
@@ -0,0 +1,66 @@
+; Relaxation is possible from @aa:32 to @aa:16 for following instructions
+; ldc.w @@aa:32,ccr
+; stc.w ccr,@@aa:32
+; ldc.w @aa:32,exr
+; stc.w exr,@aa:32
+ .h8300s
+ .globl _start
+;
+; Relaxation of aa:32
+;
+ _start:
+ ldc @s1:32,ccr
+ ldc @s2:32,ccr
+ ldc @s3:32,ccr
+ ldc @s4:32,ccr
+ ldc @s5:32,ccr
+ ldc @s6:32,ccr
+ ldc @s7:32,ccr
+ ldc @s8:32,ccr
+ ldc @s9:32,ccr
+ ldc @s10:32,ccr
+
+ stc ccr,@s1:32
+ stc ccr,@s2:32
+ stc ccr,@s3:32
+ stc ccr,@s4:32
+ stc ccr,@s5:32
+ stc ccr,@s6:32
+ stc ccr,@s7:32
+ stc ccr,@s8:32
+ stc ccr,@s9:32
+ stc ccr,@s10:32
+
+ ldc @s1:32,exr
+ ldc @s2:32,exr
+ ldc @s3:32,exr
+ ldc @s4:32,exr
+ ldc @s5:32,exr
+ ldc @s6:32,exr
+ ldc @s7:32,exr
+ ldc @s8:32,exr
+ ldc @s9:32,exr
+ ldc @s10:32,exr
+
+ stc exr,@s1:32
+ stc exr,@s2:32
+ stc exr,@s3:32
+ stc exr,@s4:32
+ stc exr,@s5:32
+ stc exr,@s6:32
+ stc exr,@s7:32
+ stc exr,@s8:32
+ stc exr,@s9:32
+ stc exr,@s10:32
+
+ .equ s1,0
+ .equ s2,0x7fff
+ .equ s3,0x8000
+ .equ s4,0xff00
+ .equ s5,0xffff00
+ .equ s6,0xffff7fff
+ .equ s7,0xffff8000
+ .equ s8,0xfffffeff
+ .equ s9,0xffffff00
+ .equ s10,0xffffffff
+ .end