Add more farcall tests
authorNick Clifton <nickc@redhat.com>
Fri, 23 May 2008 14:16:16 +0000 (14:16 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 23 May 2008 14:16:16 +0000 (14:16 +0000)
ld/testsuite/ld-arm/farcall-group-size2.d [new file with mode: 0644]
ld/testsuite/ld-arm/farcall-group.d [new file with mode: 0644]
ld/testsuite/ld-arm/farcall-group.s [new file with mode: 0644]
ld/testsuite/ld-arm/farcall-group2.s [new file with mode: 0644]
ld/testsuite/ld-arm/farcall-mix.d [new file with mode: 0644]
ld/testsuite/ld-arm/farcall-mix.s [new file with mode: 0644]
ld/testsuite/ld-arm/farcall-mix2.d [new file with mode: 0644]
ld/testsuite/ld-arm/farcall-mix2.s [new file with mode: 0644]
ld/testsuite/ld-arm/farcall-section.d [new file with mode: 0644]
ld/testsuite/ld-arm/farcall-section.s [new file with mode: 0644]

diff --git a/ld/testsuite/ld-arm/farcall-group-size2.d b/ld/testsuite/ld-arm/farcall-group-size2.d
new file mode 100644 (file)
index 0000000..7367151
--- /dev/null
@@ -0,0 +1,47 @@
+
+.*:     file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x18>:
+    1000:      e51ff004        ldr     pc, \[pc, #-4\] ; 1004 <_start-0x14>
+    1004:      02003024        .word   0x02003024
+    1008:      e59fc000        ldr     ip, \[pc, #0\]  ; 1010 <_start-0x8>
+    100c:      e12fff1c        bx      ip
+    1010:      02003021        .word   0x02003021
+    1014:      00000000        .word   0x00000000
+
+00001018 <_start>:
+    1018:      ebfffffa        bl      1008 <_start-0x10>
+    101c:      ebfffff7        bl      1000 <_start-0x18>
+    1020:      e51ff004        ldr     pc, \[pc, #-4\] ; 1024 <_start\+0xc>
+    1024:      02003028        .word   0x02003028
+    1028:      e59fc000        ldr     ip, \[pc, #0\]  ; 1030 <_start\+0x18>
+    102c:      e12fff1c        bx      ip
+    1030:      0200302f        .word   0x0200302f
+    1034:      e59fc000        ldr     ip, \[pc, #0\]  ; 103c <_start\+0x24>
+    1038:      e12fff1c        bx      ip
+    103c:      0200302d        .word   0x0200302d
+       ...
+
+00001048 <myfunc>:
+    1048:      ebfffff4        bl      1020 <_start\+0x8>
+    104c:      ebfffff8        bl      1034 <_start\+0x1c>
+    1050:      ebfffff4        bl      1028 <_start\+0x10>
+Disassembly of section .foo:
+
+02003020 <bar>:
+ 2003020:      4770            bx      lr
+       ...
+
+02003024 <bar2>:
+ 2003024:      e12fff1e        bx      lr
+
+02003028 <bar3>:
+ 2003028:      e12fff1e        bx      lr
+
+0200302c <bar4>:
+ 200302c:      4770            bx      lr
+
+0200302e <bar5>:
+ 200302e:      4770            bx      lr
diff --git a/ld/testsuite/ld-arm/farcall-group.d b/ld/testsuite/ld-arm/farcall-group.d
new file mode 100644 (file)
index 0000000..813344d
--- /dev/null
@@ -0,0 +1,46 @@
+
+.*:     file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x40>:
+    1000:      e51ff004        ldr     pc, \[pc, #-4\] ; 1004 <_start-0x3c>
+    1004:      02003024        .word   0x02003024
+    1008:      e59fc000        ldr     ip, \[pc, #0\]  ; 1010 <_start-0x30>
+    100c:      e12fff1c        bx      ip
+    1010:      02003021        .word   0x02003021
+    1014:      e51ff004        ldr     pc, \[pc, #-4\] ; 1018 <_start-0x28>
+    1018:      02003028        .word   0x02003028
+    101c:      e59fc000        ldr     ip, \[pc, #0\]  ; 1024 <_start-0x1c>
+    1020:      e12fff1c        bx      ip
+    1024:      0200302d        .word   0x0200302d
+    1028:      e59fc000        ldr     ip, \[pc, #0\]  ; 1030 <_start-0x10>
+    102c:      e12fff1c        bx      ip
+    1030:      0200302f        .word   0x0200302f
+       ...
+
+00001040 <_start>:
+    1040:      ebfffff0        bl      1008 <_start-0x38>
+    1044:      ebffffed        bl      1000 <_start-0x40>
+
+00001048 <myfunc>:
+    1048:      ebfffff1        bl      1014 <_start-0x2c>
+    104c:      ebfffff2        bl      101c <_start-0x24>
+    1050:      ebfffff4        bl      1028 <_start-0x18>
+Disassembly of section .foo:
+
+02003020 <bar>:
+ 2003020:      4770            bx      lr
+       ...
+
+02003024 <bar2>:
+ 2003024:      e12fff1e        bx      lr
+
+02003028 <bar3>:
+ 2003028:      e12fff1e        bx      lr
+
+0200302c <bar4>:
+ 200302c:      4770            bx      lr
+
+0200302e <bar5>:
+ 200302e:      4770            bx      lr
diff --git a/ld/testsuite/ld-arm/farcall-group.s b/ld/testsuite/ld-arm/farcall-group.s
new file mode 100644 (file)
index 0000000..0ede36d
--- /dev/null
@@ -0,0 +1,44 @@
+@ Test to ensure that ARM calls exceeding 32Mb generate stubs.
+
+       .global _start
+       .syntax unified
+
+@ We will place the section .text at 0x1000.
+
+       .text
+
+_start:
+       bl bar
+       bl bar2
+
+
+@ We will place the section .foo at 0x2003020.
+
+       .section .foo, "xa"
+
+       .global bar
+       .thumb_func
+bar:
+       bx lr
+
+       .arm
+       .global bar2
+       .type bar2, %function
+bar2:
+       bx lr
+
+       .global bar3
+       .type bar3, %function
+bar3:
+       bx lr
+
+       .global bar4
+       .thumb_func
+bar4:
+       bx lr
+
+       .global bar5
+       .type bar5, %function
+bar5:
+       bx lr
+
diff --git a/ld/testsuite/ld-arm/farcall-group2.s b/ld/testsuite/ld-arm/farcall-group2.s
new file mode 100644 (file)
index 0000000..4624804
--- /dev/null
@@ -0,0 +1,10 @@
+
+@ Test to ensure that ARM calls exceeding 32Mb generate stubs.
+
+@ We will place the section .foo at 0x2000.
+
+       .text
+myfunc:        
+       bl bar3
+       bl bar4
+       bl bar5
diff --git a/ld/testsuite/ld-arm/farcall-mix.d b/ld/testsuite/ld-arm/farcall-mix.d
new file mode 100644 (file)
index 0000000..8a00798
--- /dev/null
@@ -0,0 +1,44 @@
+
+.*:     file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x40>:
+    1000:      e51ff004        ldr     pc, \[pc, #-4\] ; 1004 <_start-0x3c>
+    1004:      02002024        .word   0x02002024
+    1008:      e59fc000        ldr     ip, \[pc, #0\]  ; 1010 <_start-0x30>
+    100c:      e12fff1c        bx      ip
+    1010:      02002021        .word   0x02002021
+    1014:      e51ff004        ldr     pc, \[pc, #-4\] ; 1018 <_start-0x28>
+    1018:      02002028        .word   0x02002028
+    101c:      e59fc000        ldr     ip, \[pc, #0\]  ; 1024 <_start-0x1c>
+    1020:      e12fff1c        bx      ip
+    1024:      0200202d        .word   0x0200202d
+    1028:      e59fc000        ldr     ip, \[pc, #0\]  ; 1030 <_start-0x10>
+    102c:      e12fff1c        bx      ip
+    1030:      0200202f        .word   0x0200202f
+       ...
+
+00001040 <_start>:
+    1040:      ebfffff0        bl      1008 <_start-0x38>
+    1044:      ebffffed        bl      1000 <_start-0x40>
+    1048:      ebfffff1        bl      1014 <_start-0x2c>
+    104c:      ebfffff2        bl      101c <_start-0x24>
+    1050:      ebfffff4        bl      1028 <_start-0x18>
+Disassembly of section .foo:
+
+02002020 <bar>:
+ 2002020:      4770            bx      lr
+       ...
+
+02002024 <bar2>:
+ 2002024:      e12fff1e        bx      lr
+
+02002028 <bar3>:
+ 2002028:      e12fff1e        bx      lr
+
+0200202c <bar4>:
+ 200202c:      4770            bx      lr
+
+0200202e <bar5>:
+ 200202e:      4770            bx      lr
diff --git a/ld/testsuite/ld-arm/farcall-mix.s b/ld/testsuite/ld-arm/farcall-mix.s
new file mode 100644 (file)
index 0000000..41b27f2
--- /dev/null
@@ -0,0 +1,46 @@
+@ Test to ensure that ARM calls exceeding 32Mb generate stubs.
+
+       .global _start
+       .syntax unified
+
+@ We will place the section .text at 0x1000.
+
+       .text
+
+_start:
+       bl bar
+       bl bar2
+       bl bar3
+       bl bar4
+       bl bar5
+
+@ We will place the section .foo at 0x2002020.
+
+       .section .foo, "xa"
+
+       .global bar
+       .thumb_func
+bar:
+       bx lr
+
+       .arm
+       .global bar2
+       .type bar2, %function
+bar2:
+       bx lr
+
+       .global bar3
+       .type bar3, %function
+bar3:
+       bx lr
+
+       .global bar4
+       .thumb_func
+bar4:
+       bx lr
+
+       .global bar5
+       .type bar5, %function
+bar5:
+       bx lr
+
diff --git a/ld/testsuite/ld-arm/farcall-mix2.d b/ld/testsuite/ld-arm/farcall-mix2.d
new file mode 100644 (file)
index 0000000..eb70843
--- /dev/null
@@ -0,0 +1,48 @@
+
+.*:     file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x18>:
+    1000:      e51ff004        ldr     pc, \[pc, #-4\] ; 1004 <_start-0x14>
+    1004:      02003024        .word   0x02003024
+    1008:      e59fc000        ldr     ip, \[pc, #0\]  ; 1010 <_start-0x8>
+    100c:      e12fff1c        bx      ip
+    1010:      02003021        .word   0x02003021
+    1014:      00000000        .word   0x00000000
+
+00001018 <_start>:
+    1018:      ebfffffa        bl      1008 <_start-0x10>
+    101c:      ebfffff7        bl      1000 <_start-0x18>
+Disassembly of section .mytext:
+
+00002000 <.mytext>:
+    2000:      e59fc000        ldr     ip, \[pc, #0\]  ; 2008 <__exidx_end\+0xfe8>
+    2004:      e12fff1c        bx      ip
+    2008:      0200302f        .word   0x0200302f
+    200c:      e51ff004        ldr     pc, \[pc, #-4\] ; 2010 <__exidx_end\+0xff0>
+    2010:      02003028        .word   0x02003028
+    2014:      e59fc000        ldr     ip, \[pc, #0\]  ; 201c <__exidx_end\+0xffc>
+    2018:      e12fff1c        bx      ip
+    201c:      0200302d        .word   0x0200302d
+       ...
+    2028:      ebfffff7        bl      200c <__exidx_end\+0xfec>
+    202c:      ebfffff8        bl      2014 <__exidx_end\+0xff4>
+    2030:      ebfffff2        bl      2000 <__exidx_end\+0xfe0>
+Disassembly of section .foo:
+
+02003020 <bar>:
+ 2003020:      4770            bx      lr
+       ...
+
+02003024 <bar2>:
+ 2003024:      e12fff1e        bx      lr
+
+02003028 <bar3>:
+ 2003028:      e12fff1e        bx      lr
+
+0200302c <bar4>:
+ 200302c:      4770            bx      lr
+
+0200302e <bar5>:
+ 200302e:      4770            bx      lr
diff --git a/ld/testsuite/ld-arm/farcall-mix2.s b/ld/testsuite/ld-arm/farcall-mix2.s
new file mode 100644 (file)
index 0000000..803e8d0
--- /dev/null
@@ -0,0 +1,51 @@
+@ Test to ensure that ARM calls exceeding 32Mb generate stubs.
+
+       .global _start
+       .syntax unified
+
+@ We will place the section .text at 0x1000.
+
+       .text
+
+_start:
+       bl bar
+       bl bar2
+
+
+@ We will place the section .mytext at 0x2000.
+
+       .section .mytext, "xa"
+       bl bar3
+       bl bar4
+       bl bar5
+
+@ We will place the section .foo at 0x2003020.
+
+       .section .foo, "xa"
+
+       .global bar
+       .thumb_func
+bar:
+       bx lr
+
+       .arm
+       .global bar2
+       .type bar2, %function
+bar2:
+       bx lr
+
+       .global bar3
+       .type bar3, %function
+bar3:
+       bx lr
+
+       .global bar4
+       .thumb_func
+bar4:
+       bx lr
+
+       .global bar5
+       .type bar5, %function
+bar5:
+       bx lr
+
diff --git a/ld/testsuite/ld-arm/farcall-section.d b/ld/testsuite/ld-arm/farcall-section.d
new file mode 100644 (file)
index 0000000..4e6d37d
--- /dev/null
@@ -0,0 +1,5 @@
+#name: ARM-ARM farcall to symbol of type STT_SECTION
+#source: farcall-section.s
+#as:
+#ld: -Ttext 0x1000 --section-start .foo=0x2001014
+#error: .*\(.text\+0x0\): relocation truncated to fit: R_ARM_CALL against `.foo'
diff --git a/ld/testsuite/ld-arm/farcall-section.s b/ld/testsuite/ld-arm/farcall-section.s
new file mode 100644 (file)
index 0000000..31c9038
--- /dev/null
@@ -0,0 +1,20 @@
+@ Test to ensure that a ARM to ARM call exceeding 32Mb generates an error
+@ if the destination is of type STT_SECTION (eg non-global symbol)
+
+       .global _start
+       .syntax unified
+
+@ We will place the section .text at 0x1000.
+
+       .text
+
+_start:
+       bl bar
+
+@ We will place the section .foo at 0x2001020.
+
+       .section .foo, "xa"
+
+bar:
+       bx lr
+