aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog13
-rw-r--r--ld/configure.tgt2
-rw-r--r--ld/emulparams/shelf_fd.sh2
-rw-r--r--ld/emulparams/shlelf_fd.sh16
-rw-r--r--ld/emulparams/shlelf_linux.sh2
-rw-r--r--ld/testsuite/ChangeLog43
-rw-r--r--ld/testsuite/ld-sh/fdpic-funcdesc-shared.d32
-rw-r--r--ld/testsuite/ld-sh/fdpic-funcdesc-shared.s10
-rw-r--r--ld/testsuite/ld-sh/fdpic-funcdesc-static.d25
-rw-r--r--ld/testsuite/ld-sh/fdpic-funcdesc-static.s14
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotfuncdesc-shared.d25
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotfuncdesc-shared.s9
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotfuncdesc-static.d26
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotfuncdesc-static.s12
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotfuncdesci20-shared.d24
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotfuncdesci20-shared.s6
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotfuncdesci20-static.d24
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotfuncdesci20-static.s9
-rw-r--r--ld/testsuite/ld-sh/fdpic-goti20-shared.d24
-rw-r--r--ld/testsuite/ld-sh/fdpic-goti20-shared.s6
-rw-r--r--ld/testsuite/ld-sh/fdpic-goti20-static.d22
-rw-r--r--ld/testsuite/ld-sh/fdpic-goti20-static.s11
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotofffuncdesc-shared.d32
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotofffuncdesc-shared.s12
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotofffuncdesc-static.d27
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotofffuncdesc-static.s12
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotofffuncdesci20-shared.d29
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotofffuncdesci20-shared.s9
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotofffuncdesci20-static.d24
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotofffuncdesci20-static.s9
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotoffi20-shared.d30
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotoffi20-shared.s11
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotoffi20-static.d22
-rw-r--r--ld/testsuite/ld-sh/fdpic-gotoffi20-static.s11
-rw-r--r--ld/testsuite/ld-sh/fdpic-plt-be.d75
-rw-r--r--ld/testsuite/ld-sh/fdpic-plt-le.d74
-rw-r--r--ld/testsuite/ld-sh/fdpic-plt.s11
-rw-r--r--ld/testsuite/ld-sh/fdpic-plti20-be.d63
-rw-r--r--ld/testsuite/ld-sh/fdpic-plti20-le.d63
-rw-r--r--ld/testsuite/ld-sh/fdpic-stack-default.d19
-rw-r--r--ld/testsuite/ld-sh/fdpic-stack-size.d19
-rw-r--r--ld/testsuite/ld-sh/fdpic-stack.s5
-rw-r--r--ld/testsuite/ld-sh/sh.exp2
-rw-r--r--ld/testsuite/lib/ld-lib.exp1
44 files changed, 914 insertions, 3 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 973e817..9cd324a 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,16 @@
+2010-05-25 Daniel Jacobowitz <dan@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+ Andrew Stubbs <ams@codesourcery.com>
+
+ * Makefile.am (ALL_EMULATIONS): Add eshelf_fd.o and eshlelf_fd.o.
+ (eshelf_fd.c, eshlelf_fd.c): New rules.
+ * Makefile.in: Regenerate.
+ * configure.tgt (sh-*-uclinux*): Add shelf_fd and shlelf_fd
+ emulations.
+ * emulparams/shelf_fd.sh: New file.
+ * emulparams/shlelf_fd.sh: New file.
+ * emulparams/shlelf_linux.sh: Update comment.
+
2010-05-25 Jay Krell <jay.krell@cornell.edu>
PR ld/11621
diff --git a/ld/configure.tgt b/ld/configure.tgt
index def0287..f75c96a 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -550,7 +550,7 @@ sh-*-elf* | sh[1234]*-*-elf | sh-*-rtems* | sh-*-kaos*)
targ_extra_emuls="shlelf sh shl" ;;
sh-*-uclinux* | sh[12]-*-uclinux*)
targ_emul=shelf_uclinux
- targ_extra_emuls="shelf shlelf sh shl" ;;
+ targ_extra_emuls="shelf shlelf sh shl shelf_fd shlelf_fd" ;;
sh-*-vxworks) targ_emul=shelf_vxworks
targ_extra_emuls=shlelf_vxworks ;;
sh-*-nto*) targ_emul=shelf_nto
diff --git a/ld/emulparams/shelf_fd.sh b/ld/emulparams/shelf_fd.sh
new file mode 100644
index 0000000..7ec25ab
--- /dev/null
+++ b/ld/emulparams/shelf_fd.sh
@@ -0,0 +1,2 @@
+. ${srcdir}/emulparams/shlelf_fd.sh
+OUTPUT_FORMAT="elf32-shbig-fdpic"
diff --git a/ld/emulparams/shlelf_fd.sh b/ld/emulparams/shlelf_fd.sh
new file mode 100644
index 0000000..f1f4107
--- /dev/null
+++ b/ld/emulparams/shlelf_fd.sh
@@ -0,0 +1,16 @@
+# If you change this file, please also look at files which source this one:
+# shelf_fd.sh
+
+. ${srcdir}/emulparams/shlelf_linux.sh
+OUTPUT_FORMAT="elf32-sh-fdpic"
+GOT=".got ${RELOCATING-0} : { *(.got.funcdesc) *(.got.plt) *(.got) }"
+OTHER_GOT_RELOC_SECTIONS="
+ .rela.got.funcdesc ${RELOCATING-0} : { *(.rela.got.funcdesc) }
+"
+OTHER_READONLY_SECTIONS="
+ .rofixup : {
+ ${RELOCATING+__ROFIXUP_LIST__ = .;}
+ *(.rofixup)
+ ${RELOCATING+__ROFIXUP_END__ = .;}
+ }
+"
diff --git a/ld/emulparams/shlelf_linux.sh b/ld/emulparams/shlelf_linux.sh
index 95b6acc..c14aae2 100644
--- a/ld/emulparams/shlelf_linux.sh
+++ b/ld/emulparams/shlelf_linux.sh
@@ -1,5 +1,5 @@
# If you change this file, please also look at files which source this one:
-# shelf_linux.sh
+# shelf_linux.sh shelf_fd.sh shlelf_fd.sh
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-sh-linux"
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 61daf44..4a3989e 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,46 @@
+2010-05-25 Daniel Jacobowitz <dan@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+ Andrew Stubbs <ams@codesourcery.com>
+
+ * ld-sh/sh.exp: Handle uClinux like Linux.
+ * lib/ld-lib.exp (is_elf_format): Include sh*-*-uclinux*.
+ * ld-sh/fdpic-funcdesc-shared.d: New file.
+ * ld-sh/fdpic-funcdesc-shared.s: New file.
+ * ld-sh/fdpic-funcdesc-static.d: New file.
+ * ld-sh/fdpic-funcdesc-static.s: New file.
+ * ld-sh/fdpic-gotfuncdesc-shared.d: New file.
+ * ld-sh/fdpic-gotfuncdesc-shared.s: New file.
+ * ld-sh/fdpic-gotfuncdesc-static.d: New file.
+ * ld-sh/fdpic-gotfuncdesc-static.s: New file.
+ * ld-sh/fdpic-gotfuncdesci20-shared.d: New file.
+ * ld-sh/fdpic-gotfuncdesci20-shared.s: New file.
+ * ld-sh/fdpic-gotfuncdesci20-static.d: New file.
+ * ld-sh/fdpic-gotfuncdesci20-static.s: New file.
+ * ld-sh/fdpic-goti20-shared.d: New file.
+ * ld-sh/fdpic-goti20-shared.s: New file.
+ * ld-sh/fdpic-goti20-static.d: New file.
+ * ld-sh/fdpic-goti20-static.s: New file.
+ * ld-sh/fdpic-gotofffuncdesc-shared.d: New file.
+ * ld-sh/fdpic-gotofffuncdesc-shared.s: New file.
+ * ld-sh/fdpic-gotofffuncdesc-static.d: New file.
+ * ld-sh/fdpic-gotofffuncdesc-static.s: New file.
+ * ld-sh/fdpic-gotofffuncdesci20-shared.d: New file.
+ * ld-sh/fdpic-gotofffuncdesci20-shared.s: New file.
+ * ld-sh/fdpic-gotofffuncdesci20-static.d: New file.
+ * ld-sh/fdpic-gotofffuncdesci20-static.s: New file.
+ * ld-sh/fdpic-gotoffi20-shared.d: New file.
+ * ld-sh/fdpic-gotoffi20-shared.s: New file.
+ * ld-sh/fdpic-gotoffi20-static.d: New file.
+ * ld-sh/fdpic-gotoffi20-static.s: New file.
+ * ld-sh/fdpic-plt-be.d: New file.
+ * ld-sh/fdpic-plt-le.d: New file.
+ * ld-sh/fdpic-plt.s: New file.
+ * ld-sh/fdpic-plti20-be.d: New file.
+ * ld-sh/fdpic-plti20-le.d: New file.
+ * ld-sh/fdpic-stack-default.d: New file.
+ * ld-sh/fdpic-stack-size.d: New file.
+ * ld-sh/fdpic-stack.s: New file.
+
2010-05-18 H.J. Lu <hongjiu.lu@intel.com>
PR gas/11600
diff --git a/ld/testsuite/ld-sh/fdpic-funcdesc-shared.d b/ld/testsuite/ld-sh/fdpic-funcdesc-shared.d
new file mode 100644
index 0000000..899c5ae
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-funcdesc-shared.d
@@ -0,0 +1,32 @@
+#source: fdpic-funcdesc-shared.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd -shared
+#objdump: -dsR -j.text -j.data -j.got
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-shbig-fdpic
+
+Contents of section \.text:
+ [0-9a-f]+ 0009[ \t]+.*
+Contents of section \.data:
+ [0-9a-f]+ 00000000[ \t]+.*
+Contents of section \.got:
+ [0-9a-f]+ 00000000 00000000 00000000 00000000[ \t]+.*
+ [0-9a-f]+ 00000000[ \t]+.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <foo>:
+ [0-9a-f]+:[ \t]+00 09[ \t]+nop[ \t]+
+
+Disassembly of section \.data:
+
+[0-9a-f]+ <bar>:
+[ \t]+[0-9a-f]+:[ \t]+00 00 00 00[ \t]+\.\.\.\.
+[ \t]+[0-9a-f]+: R_SH_DIR32[ \t]+\.got
+
+Disassembly of section \.got:
+
+[0-9a-f]+ <\.got>:
+[ \t]+\.\.\.
+[ \t]+[0-9a-f]+: R_SH_FUNCDESC_VALUE[ \t]+\.text
diff --git a/ld/testsuite/ld-sh/fdpic-funcdesc-shared.s b/ld/testsuite/ld-sh/fdpic-funcdesc-shared.s
new file mode 100644
index 0000000..87d600d
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-funcdesc-shared.s
@@ -0,0 +1,10 @@
+ .data
+ .globl bar
+ .type bar,@object
+ .size bar,4
+bar:
+ .long foo@FUNCDESC
+ .text
+ .type foo,@function
+foo:
+ nop
diff --git a/ld/testsuite/ld-sh/fdpic-funcdesc-static.d b/ld/testsuite/ld-sh/fdpic-funcdesc-static.d
new file mode 100644
index 0000000..cb09b90
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-funcdesc-static.d
@@ -0,0 +1,25 @@
+#source: fdpic-funcdesc-static.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd
+#objdump: -ds
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-shbig-fdpic
+
+Contents of section \.text:
+ 400094 00090009[ \t]+.*
+Contents of section \.rofixup:
+ 400098 004100ac 004100b0 004100a8 004100b4[ \t]+.*
+Contents of section \.data:
+ 4100a8 004100ac[ \t]+.*
+Contents of section \.got:
+ 4100ac 00400094 004100b4 00000000 00000000[ \t]+.*
+ 4100bc 00000000[ \t]+.*
+
+Disassembly of section \.text:
+
+00400094 <foo>:
+[ \t]+400094:[ \t]+00 09[ \t]+nop[ \t]+
+
+00400096 <_start>:
+[ \t]+400096:[ \t]+00 09[ \t]+nop[ \t]+
diff --git a/ld/testsuite/ld-sh/fdpic-funcdesc-static.s b/ld/testsuite/ld-sh/fdpic-funcdesc-static.s
new file mode 100644
index 0000000..f59e0d9
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-funcdesc-static.s
@@ -0,0 +1,14 @@
+ .data
+ .globl bar
+ .type bar,@object
+ .size bar,4
+bar:
+ .long foo@FUNCDESC
+ .text
+ .type foo,@function
+foo:
+ nop
+ .globl _start
+ .type _start,@function
+_start:
+ nop
diff --git a/ld/testsuite/ld-sh/fdpic-gotfuncdesc-shared.d b/ld/testsuite/ld-sh/fdpic-gotfuncdesc-shared.d
new file mode 100644
index 0000000..c86b424
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotfuncdesc-shared.d
@@ -0,0 +1,25 @@
+#source: fdpic-gotfuncdesc-shared.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd -shared
+#objdump: -dsR -j.text -j.got
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-shbig-fdpic
+
+Contents of section \.text:
+ [0-9a-f]+ d00001ce 0000000c[ \t]+.*
+Contents of section \.got:
+ [0-9a-f]+ 00000000 00000000 00000000 00000000[ \t]+.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <f>:
+ [0-9a-f]+:[ \t]+d0 00[ \t]+mov\.l[ \t]+[0-9a-f]+ <f\+0x4>,r0[ \t]+! c
+ [0-9a-f]+:[ \t]+01 ce[ \t]+mov\.l[ \t]+@\(r0,r12\),r1
+ [0-9a-f]+:[ \t]+00 00 00 0c[ \t]+movi20[ \t]+#12,r0
+
+Disassembly of section \.got:
+
+[0-9a-f]+ <\.got>:
+[ \t]+\.\.\.
+[ \t]+[0-9a-f]+: R_SH_FUNCDESC[ \t]+foo
diff --git a/ld/testsuite/ld-sh/fdpic-gotfuncdesc-shared.s b/ld/testsuite/ld-sh/fdpic-gotfuncdesc-shared.s
new file mode 100644
index 0000000..d75a061
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotfuncdesc-shared.s
@@ -0,0 +1,9 @@
+ .text
+ .globl f
+ .type f,@function
+f:
+ mov.l .L1, r0
+ mov.l @(r0,r12), r1
+ .align 2
+.L1:
+ .long foo@GOTFUNCDESC
diff --git a/ld/testsuite/ld-sh/fdpic-gotfuncdesc-static.d b/ld/testsuite/ld-sh/fdpic-gotfuncdesc-static.d
new file mode 100644
index 0000000..3da8c40
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotfuncdesc-static.d
@@ -0,0 +1,26 @@
+#source: fdpic-gotfuncdesc-static.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd
+#objdump: -ds
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-shbig-fdpic
+
+Contents of section \.text:
+ 400094 d00001ce 0000000c 00090009[ \t]+.*
+Contents of section \.rofixup:
+ 4000a0 004100b0 004100b4 004100c4 004100b8[ \t]+.*
+Contents of section \.got:
+ 4100b0 0040009c 004100b8 00000000 00000000[ \t]+.*
+ 4100c0 00000000 004100b0[ \t]+.*
+
+Disassembly of section \.text:
+
+00400094 <_start>:
+[ \t]+400094:[ \t]+d0 00[ \t]+mov\.l[ \t]+400098 <_start\+0x4>,r0[ \t]+! c
+[ \t]+400096:[ \t]+01 ce[ \t]+mov\.l[ \t]+@\(r0,r12\),r1
+[ \t]+400098:[ \t]+00 00 00 0c[ \t]+movi20[ \t]+#12,r0
+
+0040009c <foo>:
+[ \t]+40009c:[ \t]+00 09[ \t]+nop[ \t]+
+[ \t]+40009e:[ \t]+00 09[ \t]+nop[ \t]+
diff --git a/ld/testsuite/ld-sh/fdpic-gotfuncdesc-static.s b/ld/testsuite/ld-sh/fdpic-gotfuncdesc-static.s
new file mode 100644
index 0000000..fc403b7
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotfuncdesc-static.s
@@ -0,0 +1,12 @@
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ mov.l .L1, r0
+ mov.l @(r0,r12), r1
+ .align 2
+.L1:
+ .long foo@GOTFUNCDESC
+ .type foo,@function
+foo:
+ nop
diff --git a/ld/testsuite/ld-sh/fdpic-gotfuncdesci20-shared.d b/ld/testsuite/ld-sh/fdpic-gotfuncdesci20-shared.d
new file mode 100644
index 0000000..39eb610
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotfuncdesci20-shared.d
@@ -0,0 +1,24 @@
+#source: fdpic-gotfuncdesci20-shared.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd -shared
+#objdump: -dsR -j.text -j.got
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-shbig-fdpic
+
+Contents of section \.text:
+ [0-9a-f]+ 0000000c 01ce[ \t]+.*
+Contents of section \.got:
+ [0-9a-f]+ 00000000 00000000 00000000 00000000[ \t]+.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <f>:
+ [0-9a-f]+:[ \t]+00 00 00 0c[ \t]+movi20[ \t]+#12,r0
+ [0-9a-f]+:[ \t]+01 ce[ \t]+mov\.l[ \t]+@\(r0,r12\),r1
+
+Disassembly of section \.got:
+
+[0-9a-f]+ <\.got>:
+[ \t]+\.\.\.
+[ \t]+[0-9a-f]+: R_SH_FUNCDESC[ \t]+foo
diff --git a/ld/testsuite/ld-sh/fdpic-gotfuncdesci20-shared.s b/ld/testsuite/ld-sh/fdpic-gotfuncdesci20-shared.s
new file mode 100644
index 0000000..736d30d
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotfuncdesci20-shared.s
@@ -0,0 +1,6 @@
+ .text
+ .globl f
+ .type f,@function
+f:
+ movi20 #foo@GOTFUNCDESC, r0
+ mov.l @(r0,r12), r1
diff --git a/ld/testsuite/ld-sh/fdpic-gotfuncdesci20-static.d b/ld/testsuite/ld-sh/fdpic-gotfuncdesci20-static.d
new file mode 100644
index 0000000..246e8f3
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotfuncdesci20-static.d
@@ -0,0 +1,24 @@
+#source: fdpic-gotfuncdesci20-static.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd
+#objdump: -ds
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-shbig-fdpic
+
+Contents of section \.text:
+ 400094 0000000c 01ce0009[ \t]+.*
+Contents of section \.rofixup:
+ 40009c 004100ac 004100b0 004100c0 004100b4[ \t]+.*
+Contents of section \.got:
+ 4100ac 0040009a 004100b4 00000000 00000000[ \t]+.*
+ 4100bc 00000000 004100ac[ \t]+.*
+
+Disassembly of section \.text:
+
+00400094 <_start>:
+[ \t]+400094:[ \t]+00 00 00 0c[ \t]+movi20[ \t]+#12,r0
+[ \t]+400098:[ \t]+01 ce[ \t]+mov\.l[ \t]+@\(r0,r12\),r1
+
+0040009a <foo>:
+[ \t]+40009a:[ \t]+00 09[ \t]+nop[ \t]+
diff --git a/ld/testsuite/ld-sh/fdpic-gotfuncdesci20-static.s b/ld/testsuite/ld-sh/fdpic-gotfuncdesci20-static.s
new file mode 100644
index 0000000..76930f5
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotfuncdesci20-static.s
@@ -0,0 +1,9 @@
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ movi20 #foo@GOTFUNCDESC, r0
+ mov.l @(r0,r12), r1
+ .type foo,@function
+foo:
+ nop
diff --git a/ld/testsuite/ld-sh/fdpic-goti20-shared.d b/ld/testsuite/ld-sh/fdpic-goti20-shared.d
new file mode 100644
index 0000000..0955770
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-goti20-shared.d
@@ -0,0 +1,24 @@
+#source: fdpic-goti20-shared.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd -shared
+#objdump: -dsR -j.text -j.got
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-shbig-fdpic
+
+Contents of section \.text:
+ [0-9a-f]+ 0000000c 01ce[ \t]+.*
+Contents of section \.got:
+ [0-9a-f]+ 00000000 00000000 00000000 00000000[ \t]+.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <f>:
+ [0-9a-f]+:[ \t]+00 00 00 0c[ \t]+movi20[ \t]+#12,r0
+ [0-9a-f]+:[ \t]+01 ce[ \t]+mov\.l[ \t]+@\(r0,r12\),r1
+
+Disassembly of section \.got:
+
+[0-9a-f]+ <\.got>:
+[ \t]+\.\.\.
+[ \t]+[0-9a-f]+: R_SH_GLOB_DAT[ \t]+foo
diff --git a/ld/testsuite/ld-sh/fdpic-goti20-shared.s b/ld/testsuite/ld-sh/fdpic-goti20-shared.s
new file mode 100644
index 0000000..08f5446
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-goti20-shared.s
@@ -0,0 +1,6 @@
+ .text
+ .globl f
+ .type f,@function
+f:
+ movi20 #foo@GOT, r0
+ mov.l @(r0,r12), r1
diff --git a/ld/testsuite/ld-sh/fdpic-goti20-static.d b/ld/testsuite/ld-sh/fdpic-goti20-static.d
new file mode 100644
index 0000000..91f5299
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-goti20-static.d
@@ -0,0 +1,22 @@
+#source: fdpic-goti20-static.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd
+#objdump: -ds
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-shbig-fdpic
+
+Contents of section \.text:
+ 400094 0000000c 01ce[ \t]+.*
+Contents of section \.rofixup:
+ 40009c 004100b4 004100a8[ \t]+.*
+Contents of section \.data:
+ 4100a4 00000001[ \t]+.*
+Contents of section \.got:
+ 4100a8 00000000 00000000 00000000 004100a4[ \t]+.*
+
+Disassembly of section \.text:
+
+00400094 <_start>:
+[ \t]+400094:[ \t]+00 00 00 0c[ \t]+movi20[ \t]+#12,r0
+[ \t]+400098:[ \t]+01 ce[ \t]+mov\.l[ \t]+@\(r0,r12\),r1
diff --git a/ld/testsuite/ld-sh/fdpic-goti20-static.s b/ld/testsuite/ld-sh/fdpic-goti20-static.s
new file mode 100644
index 0000000..172a680
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-goti20-static.s
@@ -0,0 +1,11 @@
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ movi20 #foo@GOT, r0
+ mov.l @(r0,r12), r1
+ .data
+ .type foo,@object
+ .size foo,4
+foo:
+ .long 1
diff --git a/ld/testsuite/ld-sh/fdpic-gotofffuncdesc-shared.d b/ld/testsuite/ld-sh/fdpic-gotofffuncdesc-shared.d
new file mode 100644
index 0000000..c43721d
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotofffuncdesc-shared.d
@@ -0,0 +1,32 @@
+#source: fdpic-gotofffuncdesc-shared.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd -shared
+#objdump: -dsR -j.text -j.got
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-shbig-fdpic
+
+Contents of section \.text:
+ [0-9a-f]+ d10031cc fffffff8 00090009[ \t]+.*
+Contents of section \.got:
+ [0-9a-f]+ 00000008 00000000 00000000 00000000[ \t]+.*
+ [0-9a-f]+ 00000000[ \t]+.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <f>:
+ [0-9a-f]+:[ \t]+d1 00[ \t]+mov\.l[ \t]+[0-9a-f]+ <f\+0x4>,r1[ \t]+! fffffff8
+ [0-9a-f]+:[ \t]+31 cc[ \t]+add[ \t]+r12,r1
+ [0-9a-f]+:[ \t]+ff ff[ \t]+\.word 0xffff
+ [0-9a-f]+:[ \t]+ff f8[ \t]+fmov[ \t]+@r15,fr15
+
+[0-9a-f]+ <foo>:
+ [0-9a-f]+:[ \t]+00 09[ \t]+nop[ \t]+
+ [0-9a-f]+:[ \t]+00 09[ \t]+nop[ \t]+
+
+Disassembly of section \.got:
+
+[0-9a-f]+ <\.got>:
+[ \t]+[0-9a-f]+:[ \t]+00 00 00 08[ \t]+movi20[ \t]+#8,r0
+[ \t]+[0-9a-f]+: R_SH_FUNCDESC_VALUE[ \t]+\.text
+[ \t]+\.\.\.
diff --git a/ld/testsuite/ld-sh/fdpic-gotofffuncdesc-shared.s b/ld/testsuite/ld-sh/fdpic-gotofffuncdesc-shared.s
new file mode 100644
index 0000000..daf1c84
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotofffuncdesc-shared.s
@@ -0,0 +1,12 @@
+ .text
+ .globl f
+ .type f,@function
+f:
+ mov.l .L1, r1
+ add r12, r1
+ .align 2
+.L1:
+ .long foo@GOTOFFFUNCDESC
+ .type foo,@function
+foo:
+ nop
diff --git a/ld/testsuite/ld-sh/fdpic-gotofffuncdesc-static.d b/ld/testsuite/ld-sh/fdpic-gotofffuncdesc-static.d
new file mode 100644
index 0000000..5ff417f
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotofffuncdesc-static.d
@@ -0,0 +1,27 @@
+#source: fdpic-gotofffuncdesc-static.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd
+#objdump: -ds
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-shbig-fdpic
+
+Contents of section \.text:
+ 400094 d10031cc fffffff8 00090009[ \t]+.*
+Contents of section \.rofixup:
+ 4000a0 004100ac 004100b0 004100b4[ \t]+.*
+Contents of section \.got:
+ 4100ac 0040009c 004100b4 00000000 00000000[ \t]+.*
+ 4100bc 00000000[ \t]+.*
+
+Disassembly of section \.text:
+
+00400094 <_start>:
+[ \t]+400094:[ \t]+d1 00[ \t]+mov\.l[ \t]+400098 <_start\+0x4>,r1[ \t]+! fffffff8
+[ \t]+400096:[ \t]+31 cc[ \t]+add[ \t]+r12,r1
+[ \t]+400098:[ \t]+ff ff[ \t]+\.word 0xffff
+[ \t]+40009a:[ \t]+ff f8[ \t]+fmov[ \t]+@r15,fr15
+
+0040009c <foo>:
+[ \t]+40009c:[ \t]+00 09[ \t]+nop[ \t]+
+[ \t]+40009e:[ \t]+00 09[ \t]+nop[ \t]+
diff --git a/ld/testsuite/ld-sh/fdpic-gotofffuncdesc-static.s b/ld/testsuite/ld-sh/fdpic-gotofffuncdesc-static.s
new file mode 100644
index 0000000..307ff1d0
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotofffuncdesc-static.s
@@ -0,0 +1,12 @@
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ mov.l .L1, r1
+ add r12, r1
+ .align 2
+.L1:
+ .long foo@GOTOFFFUNCDESC
+ .type foo,@function
+foo:
+ nop
diff --git a/ld/testsuite/ld-sh/fdpic-gotofffuncdesci20-shared.d b/ld/testsuite/ld-sh/fdpic-gotofffuncdesci20-shared.d
new file mode 100644
index 0000000..c19abe6
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotofffuncdesci20-shared.d
@@ -0,0 +1,29 @@
+#source: fdpic-gotofffuncdesci20-shared.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd -shared
+#objdump: -dsR -j.text -j.got
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-shbig-fdpic
+
+Contents of section \.text:
+ [0-9a-f]+ 01f0fff8 31cc0009[ \t]+.*
+Contents of section \.got:
+ [0-9a-f]+ 00000006 00000000 00000000 00000000[ \t]+.*
+ [0-9a-f]+ 00000000[ \t]+.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <f>:
+ [0-9a-f]+:[ \t]+01 f0 ff f8[ \t]+movi20[ \t]+#-8,r1
+ [0-9a-f]+:[ \t]+31 cc[ \t]+add[ \t]+r12,r1
+
+[0-9a-f]+ <foo>:
+ [0-9a-f]+:[ \t]+00 09[ \t]+nop[ \t]+
+
+Disassembly of section \.got:
+
+[0-9a-f]+ <\.got>:
+[ \t]+[0-9a-f]+:[ \t]+00 00 00 06[ \t]+movi20[ \t]+#6,r0
+[ \t]+[0-9a-f]+: R_SH_FUNCDESC_VALUE[ \t]+\.text
+[ \t]+\.\.\.
diff --git a/ld/testsuite/ld-sh/fdpic-gotofffuncdesci20-shared.s b/ld/testsuite/ld-sh/fdpic-gotofffuncdesci20-shared.s
new file mode 100644
index 0000000..bf16011
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotofffuncdesci20-shared.s
@@ -0,0 +1,9 @@
+ .text
+ .globl f
+ .type f,@function
+f:
+ movi20 #foo@GOTOFFFUNCDESC, r1
+ add r12, r1
+ .type foo,@function
+foo:
+ nop
diff --git a/ld/testsuite/ld-sh/fdpic-gotofffuncdesci20-static.d b/ld/testsuite/ld-sh/fdpic-gotofffuncdesci20-static.d
new file mode 100644
index 0000000..3b96f7e
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotofffuncdesci20-static.d
@@ -0,0 +1,24 @@
+#source: fdpic-gotofffuncdesci20-static.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd
+#objdump: -ds
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-shbig-fdpic
+
+Contents of section \.text:
+ 400094 01f0fff8 31cc0009[ \t]+.*
+Contents of section \.rofixup:
+ 40009c 004100a8 004100ac 004100b0[ \t]+.*
+Contents of section \.got:
+ 4100a8 0040009a 004100b0 00000000 00000000[ \t]+.*
+ 4100b8 00000000[ \t]+.*
+
+Disassembly of section \.text:
+
+00400094 <_start>:
+[ \t]+400094:[ \t]+01 f0 ff f8[ \t]+movi20[ \t]+#-8,r1
+[ \t]+400098:[ \t]+31 cc[ \t]+add[ \t]+r12,r1
+
+0040009a <foo>:
+[ \t]+40009a:[ \t]+00 09[ \t]+nop[ \t]+
diff --git a/ld/testsuite/ld-sh/fdpic-gotofffuncdesci20-static.s b/ld/testsuite/ld-sh/fdpic-gotofffuncdesci20-static.s
new file mode 100644
index 0000000..7017e0a
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotofffuncdesci20-static.s
@@ -0,0 +1,9 @@
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ movi20 #foo@GOTOFFFUNCDESC, r1
+ add r12, r1
+ .type foo,@function
+foo:
+ nop
diff --git a/ld/testsuite/ld-sh/fdpic-gotoffi20-shared.d b/ld/testsuite/ld-sh/fdpic-gotoffi20-shared.d
new file mode 100644
index 0000000..8b57e11
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotoffi20-shared.d
@@ -0,0 +1,30 @@
+#source: fdpic-gotoffi20-shared.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd -shared
+#objdump: -dsR -j.text -j.data -j.got
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-shbig-fdpic
+
+Contents of section \.text:
+ [0-9a-f]+ 00f0fffc 01ce[ \t]+.*
+Contents of section \.data:
+ [0-9a-f]+ 00000001[ \t]+.*
+Contents of section \.got:
+ [0-9a-f]+ 00000000 00000000 00000000[ \t]+.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <f>:
+ [0-9a-f]+:[ \t]+00 f0 ff fc[ \t]+movi20[ \t]+#-4,r0
+ [0-9a-f]+:[ \t]+01 ce[ \t]+mov\.l[ \t]+@\(r0,r12\),r1
+
+Disassembly of section \.data:
+
+[0-9a-f]+ <foo>:
+[ \t]+[0-9a-f]+:[ \t]+00 00 00 01[ \t]+\.\.\.\.
+
+Disassembly of section \.got:
+
+[0-9a-f]+ <\.got>:
+[ \t]+\.\.\.
diff --git a/ld/testsuite/ld-sh/fdpic-gotoffi20-shared.s b/ld/testsuite/ld-sh/fdpic-gotoffi20-shared.s
new file mode 100644
index 0000000..fc8213c
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotoffi20-shared.s
@@ -0,0 +1,11 @@
+ .text
+ .globl f
+ .type f,@function
+f:
+ movi20 #foo@GOTOFF, r0
+ mov.l @(r0,r12), r1
+ .data
+ .type foo,@object
+ .size foo,4
+foo:
+ .long 1
diff --git a/ld/testsuite/ld-sh/fdpic-gotoffi20-static.d b/ld/testsuite/ld-sh/fdpic-gotoffi20-static.d
new file mode 100644
index 0000000..9390720
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotoffi20-static.d
@@ -0,0 +1,22 @@
+#source: fdpic-gotoffi20-static.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd
+#objdump: -ds
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-shbig-fdpic
+
+Contents of section \.text:
+ 400094 00f0fffc 01ce[ \t]+.*
+Contents of section \.rofixup:
+ 40009c 004100a4[ \t]+.*
+Contents of section \.data:
+ 4100a0 00000001[ \t]+.*
+Contents of section \.got:
+ 4100a4 00000000 00000000 00000000[ \t]+.*
+
+Disassembly of section \.text:
+
+00400094 <_start>:
+[ \t]+400094:[ \t]+00 f0 ff fc[ \t]+movi20[ \t]+#-4,r0
+[ \t]+400098:[ \t]+01 ce[ \t]+mov\.l[ \t]+@\(r0,r12\),r1
diff --git a/ld/testsuite/ld-sh/fdpic-gotoffi20-static.s b/ld/testsuite/ld-sh/fdpic-gotoffi20-static.s
new file mode 100644
index 0000000..079255b
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-gotoffi20-static.s
@@ -0,0 +1,11 @@
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ movi20 #foo@GOTOFF, r0
+ mov.l @(r0,r12), r1
+ .data
+ .type foo,@object
+ .size foo,4
+foo:
+ .long 1
diff --git a/ld/testsuite/ld-sh/fdpic-plt-be.d b/ld/testsuite/ld-sh/fdpic-plt-be.d
new file mode 100644
index 0000000..375e088
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-plt-be.d
@@ -0,0 +1,75 @@
+#source: fdpic-plt.s
+#as: --isa=sh4a -big --fdpic
+#ld: -EB -mshelf_fd -shared
+#objdump: -dsR -j.plt -j.text -j.got
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-shbig-fdpic
+
+Contents of section \.plt:
+ [0-9a-f]+ d00201ce 7004412b 0cce0009 fffffff0[ \t]+.*
+ [0-9a-f]+ 00000000 60c2402b 53c10009 d00201ce[ \t]+.*
+ [0-9a-f]+ 7004412b 0cce0009 fffffff8 0000000c[ \t]+.*
+ [0-9a-f]+ 60c2402b 53c10009[ \t]+.*
+Contents of section \.text:
+ [0-9a-f]+ d000d101 ffffffc4 ffffffdc[ \t]+.*
+Contents of section \.got:
+ [0-9a-f]+ 0000023c 00000000 00000258 00000000[ \t]+.*
+ [0-9a-f]+ 00000000 00000000 00000000[ \t]+.*
+
+Disassembly of section \.plt:
+
+[0-9a-f]+ <foo@plt>:
+ [0-9a-f]+:[ \t]+d0 02[ \t]+mov\.l[ \t]+[0-9a-f]+ <foo@plt\+0xc>,r0[ \t]+! fffffff0
+ [0-9a-f]+:[ \t]+01 ce[ \t]+mov\.l[ \t]+@\(r0,r12\),r1
+ [0-9a-f]+:[ \t]+70 04[ \t]+add[ \t]+#4,r0
+ [0-9a-f]+:[ \t]+41 2b[ \t]+jmp[ \t]+@r1
+ [0-9a-f]+:[ \t]+0c ce[ \t]+mov\.l[ \t]+@\(r0,r12\),r12
+ [0-9a-f]+:[ \t]+00 09[ \t]+nop[ \t]+
+ [0-9a-f]+:[ \t]+ff ff[ \t]+\.word 0xffff
+ [0-9a-f]+:[ \t]+ff f0[ \t]+fadd[ \t]+fr15,fr15
+ [0-9a-f]+:[ \t]+00 00[ \t]+\.word 0x0000
+ [0-9a-f]+:[ \t]+00 00[ \t]+\.word 0x0000
+ [0-9a-f]+:[ \t]+60 c2[ \t]+mov\.l[ \t]+@r12,r0
+ [0-9a-f]+:[ \t]+40 2b[ \t]+jmp[ \t]+@r0
+ [0-9a-f]+:[ \t]+53 c1[ \t]+mov\.l[ \t]+@\(4,r12\),r3
+ [0-9a-f]+:[ \t]+00 09[ \t]+nop[ \t]+
+
+[0-9a-f]+ <bar@plt>:
+ [0-9a-f]+:[ \t]+d0 02[ \t]+mov\.l[ \t]+[0-9a-f]+ <bar@plt\+0xc>,r0[ \t]+! fffffff8
+ [0-9a-f]+:[ \t]+01 ce[ \t]+mov\.l[ \t]+@\(r0,r12\),r1
+ [0-9a-f]+:[ \t]+70 04[ \t]+add[ \t]+#4,r0
+ [0-9a-f]+:[ \t]+41 2b[ \t]+jmp[ \t]+@r1
+ [0-9a-f]+:[ \t]+0c ce[ \t]+mov\.l[ \t]+@\(r0,r12\),r12
+ [0-9a-f]+:[ \t]+00 09[ \t]+nop[ \t]+
+ [0-9a-f]+:[ \t]+ff ff[ \t]+\.word 0xffff
+ [0-9a-f]+:[ \t]+ff f8[ \t]+fmov[ \t]+@r15,fr15
+ [0-9a-f]+:[ \t]+00 00[ \t]+\.word 0x0000
+ [0-9a-f]+:[ \t]+00 0c[ \t]+mov\.b[ \t]+@\(r0,r0\),r0
+ [0-9a-f]+:[ \t]+60 c2[ \t]+mov\.l[ \t]+@r12,r0
+ [0-9a-f]+:[ \t]+40 2b[ \t]+jmp[ \t]+@r0
+ [0-9a-f]+:[ \t]+53 c1[ \t]+mov\.l[ \t]+@\(4,r12\),r3
+ [0-9a-f]+:[ \t]+00 09[ \t]+nop[ \t]+
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <f>:
+ [0-9a-f]+:[ \t]+d0 00[ \t]+mov\.l[ \t]+[0-9a-f]+ <f\+0x4>,r0[ \t]+! ffffffc4
+ [0-9a-f]+:[ \t]+d1 01[ \t]+mov\.l[ \t]+[0-9a-f]+ <f\+0x8>,r1[ \t]+! ffffffdc
+ [0-9a-f]+:[ \t]+ff ff[ \t]+\.word 0xffff
+ [0-9a-f]+:[ \t]+ff c4[ \t]+fcmp/eq[ \t]+fr12,fr15
+ [0-9a-f]+:[ \t]+ff ff[ \t]+\.word 0xffff
+ [0-9a-f]+:[ \t]+ff dc[ \t]+fmov[ \t]+fr13,fr15
+
+Disassembly of section \.got:
+
+[0-9a-f]+ <\.got>:
+[ \t]+[0-9a-f]+:[ \t]+00 00[ \t]+\.word 0x0000
+[ \t]+[0-9a-f]+: R_SH_FUNCDESC_VALUE[ \t]+foo
+[ \t]+[0-9a-f]+:[ \t]+02 3c[ \t]+mov.b[ \t]+@\(r0,r3\),r2
+[ \t]+[0-9a-f]+:[ \t]+00 00[ \t]+\.word 0x0000
+[ \t]+[0-9a-f]+:[ \t]+00 00[ \t]+\.word 0x0000
+[ \t]+[0-9a-f]+:[ \t]+00 00[ \t]+\.word 0x0000
+[ \t]+[0-9a-f]+: R_SH_FUNCDESC_VALUE[ \t]+bar
+[ \t]+[0-9a-f]+:[ \t]+02 58[ \t]+\.word 0x0258
+[ \t]+\.\.\.
diff --git a/ld/testsuite/ld-sh/fdpic-plt-le.d b/ld/testsuite/ld-sh/fdpic-plt-le.d
new file mode 100644
index 0000000..4a3e55b
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-plt-le.d
@@ -0,0 +1,74 @@
+#source: fdpic-plt.s
+#as: --isa=sh4a -little --fdpic
+#ld: -EL -mshlelf_fd -shared
+#objdump: -dsR -j.plt -j.text -j.got
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-sh-fdpic
+
+Contents of section \.plt:
+ [0-9a-f]+ 02d0ce01 04702b41 ce0c0900 f0ffffff[ \t]+.*
+ [0-9a-f]+ 00000000 c2602b40 c1530900 02d0ce01[ \t]+.*
+ [0-9a-f]+ 04702b41 ce0c0900 f8ffffff 0c000000[ \t]+.*
+ [0-9a-f]+ c2602b40 c1530900[ \t]+.*
+Contents of section \.text:
+ [0-9a-f]+ 00d001d1 c4ffffff dcffffff[ \t]+.*
+Contents of section \.got:
+ [0-9a-f]+ 3c020000 00000000 58020000 00000000[ \t]+.*
+ [0-9a-f]+ 00000000 00000000 00000000[ \t]+.*
+
+Disassembly of section \.plt:
+
+[0-9a-f]+ <foo@plt>:
+ [0-9a-f]+:[ \t]+02 d0[ \t]+mov\.l[ \t]+[0-9a-f]+ <foo@plt\+0xc>,r0[ \t]+! fffffff0
+ [0-9a-f]+:[ \t]+ce 01[ \t]+mov\.l[ \t]+@\(r0,r12\),r1
+ [0-9a-f]+:[ \t]+04 70[ \t]+add[ \t]+#4,r0
+ [0-9a-f]+:[ \t]+2b 41[ \t]+jmp[ \t]+@r1
+ [0-9a-f]+:[ \t]+ce 0c[ \t]+mov\.l[ \t]+@\(r0,r12\),r12
+ [0-9a-f]+:[ \t]+09 00[ \t]+nop[ \t]+
+ [0-9a-f]+:[ \t]+f0 ff[ \t]+fadd[ \t]+fr15,fr15
+ [0-9a-f]+:[ \t]+ff ff[ \t]+\.word 0xffff
+ [0-9a-f]+:[ \t]+00 00[ \t]+\.word 0x0000
+ [0-9a-f]+:[ \t]+00 00[ \t]+\.word 0x0000
+ [0-9a-f]+:[ \t]+c2 60[ \t]+mov\.l[ \t]+@r12,r0
+ [0-9a-f]+:[ \t]+2b 40[ \t]+jmp[ \t]+@r0
+ [0-9a-f]+:[ \t]+c1 53[ \t]+mov\.l[ \t]+@\(4,r12\),r3
+ [0-9a-f]+:[ \t]+09 00[ \t]+nop[ \t]+
+
+[0-9a-f]+ <bar@plt>:
+ [0-9a-f]+:[ \t]+02 d0[ \t]+mov\.l[ \t]+[0-9a-f]+ <bar@plt\+0xc>,r0[ \t]+! fffffff8
+ [0-9a-f]+:[ \t]+ce 01[ \t]+mov\.l[ \t]+@\(r0,r12\),r1
+ [0-9a-f]+:[ \t]+04 70[ \t]+add[ \t]+#4,r0
+ [0-9a-f]+:[ \t]+2b 41[ \t]+jmp[ \t]+@r1
+ [0-9a-f]+:[ \t]+ce 0c[ \t]+mov\.l[ \t]+@\(r0,r12\),r12
+ [0-9a-f]+:[ \t]+09 00[ \t]+nop[ \t]+
+ [0-9a-f]+:[ \t]+f8 ff[ \t]+fmov[ \t]+@r15,fr15
+ [0-9a-f]+:[ \t]+ff ff[ \t]+\.word 0xffff
+ [0-9a-f]+:[ \t]+0c 00[ \t]+mov\.b[ \t]+@\(r0,r0\),r0
+ [0-9a-f]+:[ \t]+00 00[ \t]+\.word 0x0000
+ [0-9a-f]+:[ \t]+c2 60[ \t]+mov\.l[ \t]+@r12,r0
+ [0-9a-f]+:[ \t]+2b 40[ \t]+jmp[ \t]+@r0
+ [0-9a-f]+:[ \t]+c1 53[ \t]+mov\.l[ \t]+@\(4,r12\),r3
+ [0-9a-f]+:[ \t]+09 00[ \t]+nop[ \t]+
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <f>:
+ [0-9a-f]+:[ \t]+00 d0[ \t]+mov\.l[ \t]+[0-9a-f]+ <f\+0x4>,r0[ \t]+! ffffffc4
+ [0-9a-f]+:[ \t]+01 d1[ \t]+mov\.l[ \t]+[0-9a-f]+ <f\+0x8>,r1[ \t]+! ffffffdc
+ [0-9a-f]+:[ \t]+c4 ff[ \t]+fcmp/eq[ \t]+fr12,fr15
+ [0-9a-f]+:[ \t]+ff ff[ \t]+\.word 0xffff
+ [0-9a-f]+:[ \t]+dc ff[ \t]+fmov[ \t]+fr13,fr15
+ [0-9a-f]+:[ \t]+ff ff[ \t]+\.word 0xffff
+
+Disassembly of section \.got:
+
+[0-9a-f]+ <\.got>:
+[ \t]+[0-9a-f]+:[ \t]+3c 02[ \t]+mov.b[ \t]+@\(r0,r3\),r2
+[ \t]+[0-9a-f]+: R_SH_FUNCDESC_VALUE[ \t]+foo
+[ \t]+[0-9a-f]+:[ \t]+00 00[ \t]+\.word 0x0000
+[ \t]+[0-9a-f]+:[ \t]+00 00[ \t]+\.word 0x0000
+[ \t]+[0-9a-f]+:[ \t]+00 00[ \t]+\.word 0x0000
+[ \t]+[0-9a-f]+:[ \t]+58 02[ \t]+\.word 0x0258
+[ \t]+[0-9a-f]+: R_SH_FUNCDESC_VALUE[ \t]+bar
+[ \t]+\.\.\.
diff --git a/ld/testsuite/ld-sh/fdpic-plt.s b/ld/testsuite/ld-sh/fdpic-plt.s
new file mode 100644
index 0000000..e873d3e
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-plt.s
@@ -0,0 +1,11 @@
+ .text
+ .globl f
+ .type f,@function
+f:
+ mov.l .L1, r0
+ mov.l .L2, r1
+ .align 2
+.L1:
+ .long foo@PLT
+.L2:
+ .long bar@PLT
diff --git a/ld/testsuite/ld-sh/fdpic-plti20-be.d b/ld/testsuite/ld-sh/fdpic-plti20-be.d
new file mode 100644
index 0000000..282b34b
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-plti20-be.d
@@ -0,0 +1,63 @@
+#source: fdpic-plt.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd -shared
+#objdump: -dsR -j.plt -j.text -j.got
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-shbig-fdpic
+
+Contents of section \.plt:
+ [0-9a-f]+ 00f0fff0 01ce7004 412b0cce 00000000[ \t]+.*
+ [0-9a-f]+ 60c2402b 53c10009 00f0fff8 01ce7004[ \t]+.*
+ [0-9a-f]+ 412b0cce 0000000c 60c2402b 53c10009[ \t]+.*
+Contents of section \.text:
+ [0-9a-f]+ d000d101 ffffffcc ffffffe0[ \t]+.*
+Contents of section \.got:
+ [0-9a-f]+ 00000238 00000000 00000250 00000000[ \t]+.*
+ [0-9a-f]+ 00000000 00000000 00000000[ \t]+.*
+
+Disassembly of section \.plt:
+
+[0-9a-f]+ <foo@plt>:
+ [0-9a-f]+:[ \t]+00 f0 ff f0[ \t]+movi20[ \t]+#-16,r0
+ [0-9a-f]+:[ \t]+01 ce[ \t]+mov\.l[ \t]+@\(r0,r12\),r1
+ [0-9a-f]+:[ \t]+70 04[ \t]+add[ \t]+#4,r0
+ [0-9a-f]+:[ \t]+41 2b[ \t]+jmp[ \t]+@r1
+ [0-9a-f]+:[ \t]+0c ce[ \t]+mov\.l[ \t]+@\(r0,r12\),r12
+ [0-9a-f]+:[ \t]+00 00 00 00[ \t]+movi20[ \t]+#0,r0
+ [0-9a-f]+:[ \t]+60 c2[ \t]+mov\.l[ \t]+@r12,r0
+ [0-9a-f]+:[ \t]+40 2b[ \t]+jmp[ \t]+@r0
+ [0-9a-f]+:[ \t]+53 c1[ \t]+mov\.l[ \t]+@\(4,r12\),r3
+ [0-9a-f]+:[ \t]+00 09[ \t]+nop[ \t]+
+
+[0-9a-f]+ <bar@plt>:
+ [0-9a-f]+:[ \t]+00 f0 ff f8[ \t]+movi20[ \t]+#-8,r0
+ [0-9a-f]+:[ \t]+01 ce[ \t]+mov\.l[ \t]+@\(r0,r12\),r1
+ [0-9a-f]+:[ \t]+70 04[ \t]+add[ \t]+#4,r0
+ [0-9a-f]+:[ \t]+41 2b[ \t]+jmp[ \t]+@r1
+ [0-9a-f]+:[ \t]+0c ce[ \t]+mov\.l[ \t]+@\(r0,r12\),r12
+ [0-9a-f]+:[ \t]+00 00 00 0c[ \t]+movi20[ \t]+#12,r0
+ [0-9a-f]+:[ \t]+60 c2[ \t]+mov\.l[ \t]+@r12,r0
+ [0-9a-f]+:[ \t]+40 2b[ \t]+jmp[ \t]+@r0
+ [0-9a-f]+:[ \t]+53 c1[ \t]+mov\.l[ \t]+@\(4,r12\),r3
+ [0-9a-f]+:[ \t]+00 09[ \t]+nop[ \t]+
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <f>:
+ [0-9a-f]+:[ \t]+d0 00[ \t]+mov\.l[ \t]+[0-9a-f]+ <f\+0x4>,r0[ \t]+! ffffffcc
+ [0-9a-f]+:[ \t]+d1 01[ \t]+mov\.l[ \t]+[0-9a-f]+ <f\+0x8>,r1[ \t]+! ffffffe0
+ [0-9a-f]+:[ \t]+ff ff[ \t]+\.word 0xffff
+ [0-9a-f]+:[ \t]+ff cc[ \t]+fmov[ \t]+fr12,fr15
+ [0-9a-f]+:[ \t]+ff ff[ \t]+\.word 0xffff
+ [0-9a-f]+:[ \t]+ff e0[ \t]+fadd[ \t]+fr14,fr15
+
+Disassembly of section \.got:
+
+[0-9a-f]+ <\.got>:
+[ \t]+[0-9a-f]+:[ \t]+00 00 02 38[ \t]+movi20[ \t]+#568,r0
+[ \t]+[0-9a-f]+: R_SH_FUNCDESC_VALUE[ \t]+foo
+[ \t]+[0-9a-f]+:[ \t]+00 00 00 00[ \t]+movi20[ \t]+#0,r0
+[ \t]+[0-9a-f]+:[ \t]+00 00 02 50[ \t]+movi20[ \t]+#592,r0
+[ \t]+[0-9a-f]+: R_SH_FUNCDESC_VALUE[ \t]+bar
+[ \t]+\.\.\.
diff --git a/ld/testsuite/ld-sh/fdpic-plti20-le.d b/ld/testsuite/ld-sh/fdpic-plti20-le.d
new file mode 100644
index 0000000..74e1e9b
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-plti20-le.d
@@ -0,0 +1,63 @@
+#source: fdpic-plt.s
+#as: --isa=sh2a -little --fdpic
+#ld: -EL -mshlelf_fd -shared
+#objdump: -dsR -j.plt -j.text -j.got
+#target: sh*-*-uclinux*
+
+.*:[ \t]+file format elf32-sh-fdpic
+
+Contents of section \.plt:
+ [0-9a-f]+ f000f0ff ce010470 2b41ce0c 00000000[ \t]+.*
+ [0-9a-f]+ c2602b40 c1530900 f000f8ff ce010470[ \t]+.*
+ [0-9a-f]+ 2b41ce0c 0c000000 c2602b40 c1530900[ \t]+.*
+Contents of section \.text:
+ [0-9a-f]+ 00d001d1 ccffffff e0ffffff[ \t]+.*
+Contents of section \.got:
+ [0-9a-f]+ 38020000 00000000 50020000 00000000[ \t]+.*
+ [0-9a-f]+ 00000000 00000000 00000000[ \t]+.*
+
+Disassembly of section \.plt:
+
+[0-9a-f]+ <foo@plt>:
+ [0-9a-f]+:[ \t]+f0 00 f0 ff[ \t]+movi20[ \t]+#-16,r0
+ [0-9a-f]+:[ \t]+ce 01[ \t]+mov\.l[ \t]+@\(r0,r12\),r1
+ [0-9a-f]+:[ \t]+04 70[ \t]+add[ \t]+#4,r0
+ [0-9a-f]+:[ \t]+2b 41[ \t]+jmp[ \t]+@r1
+ [0-9a-f]+:[ \t]+ce 0c[ \t]+mov\.l[ \t]+@\(r0,r12\),r12
+ [0-9a-f]+:[ \t]+00 00 00 00[ \t]+movi20[ \t]+#0,r0
+ [0-9a-f]+:[ \t]+c2 60[ \t]+mov\.l[ \t]+@r12,r0
+ [0-9a-f]+:[ \t]+2b 40[ \t]+jmp[ \t]+@r0
+ [0-9a-f]+:[ \t]+c1 53[ \t]+mov\.l[ \t]+@\(4,r12\),r3
+ [0-9a-f]+:[ \t]+09 00[ \t]+nop[ \t]+
+
+[0-9a-f]+ <bar@plt>:
+ [0-9a-f]+:[ \t]+f0 00 f8 ff[ \t]+movi20[ \t]+#-8,r0
+ [0-9a-f]+:[ \t]+ce 01[ \t]+mov\.l[ \t]+@\(r0,r12\),r1
+ [0-9a-f]+:[ \t]+04 70[ \t]+add[ \t]+#4,r0
+ [0-9a-f]+:[ \t]+2b 41[ \t]+jmp[ \t]+@r1
+ [0-9a-f]+:[ \t]+ce 0c[ \t]+mov\.l[ \t]+@\(r0,r12\),r12
+ [0-9a-f]+:[ \t]+0c 00[ \t]+mov\.b[ \t]+@\(r0,r0\),r0
+ [0-9a-f]+:[ \t]+00 00 c2 60[ \t]+movi20[ \t]+#24770,r0
+ [0-9a-f]+:[ \t]+2b 40[ \t]+jmp[ \t]+@r0
+ [0-9a-f]+:[ \t]+c1 53[ \t]+mov\.l[ \t]+@\(4,r12\),r3
+ [0-9a-f]+:[ \t]+09 00[ \t]+nop[ \t]+
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <f>:
+ [0-9a-f]+:[ \t]+00 d0[ \t]+mov\.l[ \t]+[0-9a-f]+ <f\+0x4>,r0[ \t]+! ffffffcc
+ [0-9a-f]+:[ \t]+01 d1[ \t]+mov\.l[ \t]+[0-9a-f]+ <f\+0x8>,r1[ \t]+! ffffffe0
+ [0-9a-f]+:[ \t]+cc ff[ \t]+fmov[ \t]+fr12,fr15
+ [0-9a-f]+:[ \t]+ff ff[ \t]+\.word 0xffff
+ [0-9a-f]+:[ \t]+e0 ff[ \t]+fadd[ \t]+fr14,fr15
+ [0-9a-f]+:[ \t]+ff ff[ \t]+\.word 0xffff
+
+Disassembly of section \.got:
+
+[0-9a-f]+ <\.got>:
+[ \t]+[0-9a-f]+:[ \t]+38 02[ \t]+\.word[ \t]+0x0238
+[ \t]+[0-9a-f]+: R_SH_FUNCDESC_VALUE[ \t]+foo
+[ \t]+[0-9a-f]+:[ \t]+00 00 00 00[ \t]+movi20[ \t]+#0,r0
+[ \t]+[0-9a-f]+:[ \t]+00 00 50 02[ \t]+movi20[ \t]+#592,r0
+[ \t]+[0-9a-f]+: R_SH_FUNCDESC_VALUE[ \t]+bar
+[ \t]+\.\.\.
diff --git a/ld/testsuite/ld-sh/fdpic-stack-default.d b/ld/testsuite/ld-sh/fdpic-stack-default.d
new file mode 100644
index 0000000..8f9fd92
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-stack-default.d
@@ -0,0 +1,19 @@
+#source: fdpic-stack.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd
+#readelf: -l
+#target: sh*-*-uclinux*
+
+Elf file type is EXEC \(Executable file\)
+Entry point 0x400074
+There are 2 program headers, starting at offset 52
+
+Program Headers:
+[ \t]+Type[ \t]+Offset[ \t]+VirtAddr[ \t]+PhysAddr[ \t]+FileSiz MemSiz[ \t]+Flg Align
+[ \t]+LOAD[ \t]+0x000000 0x00400000 0x00400000 0x00076 0x00076 R E 0x10000
+[ \t]+GNU_STACK[ \t]+0x000000 0x00000000 0x00000000 0x00000 0x20000 RWE 0x8
+
+ Section to Segment mapping:
+[ \t]+Segment Sections\.\.\.
+[ \t]+00[ \t]+\.text
+[ \t]+01[ \t]+
diff --git a/ld/testsuite/ld-sh/fdpic-stack-size.d b/ld/testsuite/ld-sh/fdpic-stack-size.d
new file mode 100644
index 0000000..f993a2a
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-stack-size.d
@@ -0,0 +1,19 @@
+#source: fdpic-stack.s
+#as: --isa=sh2a -big --fdpic
+#ld: -EB -mshelf_fd --defsym __stacksize=0x40000
+#readelf: -l
+#target: sh*-*-uclinux*
+
+Elf file type is EXEC \(Executable file\)
+Entry point 0x400074
+There are 2 program headers, starting at offset 52
+
+Program Headers:
+[ \t]+Type[ \t]+Offset[ \t]+VirtAddr[ \t]+PhysAddr[ \t]+FileSiz MemSiz[ \t]+Flg Align
+[ \t]+LOAD[ \t]+0x000000 0x00400000 0x00400000 0x00076 0x00076 R E 0x10000
+[ \t]+GNU_STACK[ \t]+0x000000 0x00000000 0x00000000 0x00000 0x40000 RWE 0x8
+
+ Section to Segment mapping:
+[ \t]+Segment Sections\.\.\.
+[ \t]+00[ \t]+\.text
+[ \t]+01[ \t]+
diff --git a/ld/testsuite/ld-sh/fdpic-stack.s b/ld/testsuite/ld-sh/fdpic-stack.s
new file mode 100644
index 0000000..b0421ea
--- /dev/null
+++ b/ld/testsuite/ld-sh/fdpic-stack.s
@@ -0,0 +1,5 @@
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ nop
diff --git a/ld/testsuite/ld-sh/sh.exp b/ld/testsuite/ld-sh/sh.exp
index 335946b..f42a79f 100644
--- a/ld/testsuite/ld-sh/sh.exp
+++ b/ld/testsuite/ld-sh/sh.exp
@@ -122,7 +122,7 @@ if { [which $CC] == 0 } {
return
}
-if [istarget sh*-linux-*] {
+if [istarget sh*-*linux*] {
exec sed -e s/_main/main/ -e s/_trap/trap/ -e s/_stack/stack/ \
< $srcdir/$subdir/start.s >tmpdir/start.s
} else {
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 5b2e62b..9e8b809 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -404,6 +404,7 @@ proc is_elf_format {} {
&& ![istarget *-*-linux*] \
&& ![istarget frv-*-uclinux*] \
&& ![istarget bfin-*-uclinux] \
+ && ![istarget sh*-*-uclinux*] \
&& ![istarget *-*-irix5*] \
&& ![istarget *-*-irix6*] \
&& ![istarget *-*-netbsd*] \