aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@st.com>2018-03-20 10:56:17 +0100
committerChristophe Lyon <christophe.lyon@linaro.org>2018-04-25 21:01:53 +0000
commit59029f57eba1763bad67167c2805d8df3dfa2285 (patch)
treefc77b4b2ecf73641395bd005a55f111360682081 /ld/testsuite
parent4b86cbe91c130077f967fa84b0abdbb68e9ec742 (diff)
downloadfsf-binutils-gdb-59029f57eba1763bad67167c2805d8df3dfa2285.zip
fsf-binutils-gdb-59029f57eba1763bad67167c2805d8df3dfa2285.tar.gz
fsf-binutils-gdb-59029f57eba1763bad67167c2805d8df3dfa2285.tar.bz2
[ARM] FDPIC: Implement Thumb-only PLT for FDPIC.
2018-04-25 Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> bfd/ * elf32-arm.c (elf32_arm_fdpic_thumb_plt_entry): New. (elf32_arm_plt_needs_thumb_stub_p): Handle thumb-only case. (elf32_arm_populate_plt_entry): Likewise. (elf32_arm_output_plt_map_1): Likewise. (elf32_arm_output_arch_local_syms): Likewise. ld/testsuite/ * arm-elf.exp: Execute the new FDPIC Thumb-only tests. * fdpic-main-m.d: New test. * fdpic-main-m.s: New. * fdpic-main-m.sym: New. * fdpic-shared-m.d: New test. * fdpic-shared-m.s: New. * fdpic-shared-m.sym: New.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-arm/arm-elf.exp12
-rw-r--r--ld/testsuite/ld-arm/fdpic-main-m.d73
-rw-r--r--ld/testsuite/ld-arm/fdpic-main-m.s86
-rw-r--r--ld/testsuite/ld-arm/fdpic-main-m.sym14
-rw-r--r--ld/testsuite/ld-arm/fdpic-shared-m.d37
-rw-r--r--ld/testsuite/ld-arm/fdpic-shared-m.s52
-rw-r--r--ld/testsuite/ld-arm/fdpic-shared-m.sym15
7 files changed, 289 insertions, 0 deletions
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index 449077e..d582252 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -1043,6 +1043,18 @@ set armfdpiceabitests {
{{objdump -fdw fdpic-main.d} {objdump -Rw fdpic-main.r}
{readelf -Ds fdpic-main.sym}}
"fdpic-main"}
+ {"FDPIC ARM shared library little endian M profile"
+ "-shared -T fdpic-shared.ld --hash-style=sysv -EL -m armelf_linux_fdpiceabi" ""
+ "-EL -fdpic" {fdpic-shared-m.s}
+ {{objdump -fdw fdpic-shared-m.d} {objdump -Rw fdpic-shared.r}
+ {readelf -Ds fdpic-shared-m.sym}}
+ "fdpic-shared.so"}
+ {"FDPIC ARM dynamic executable little endian M profile"
+ "tmpdir/fdpic-shared.so -T fdpic-main.ld --hash-style=sysv -EL -m armelf_linux_fdpiceabi" ""
+ "-EL -fdpic" {fdpic-main-m.s}
+ {{objdump -fdw fdpic-main-m.d} {objdump -Rw fdpic-main.r}
+ {readelf -Ds fdpic-main-m.sym}}
+ "fdpic-main"}
}
# Massage the $armeabitests_common list into run_ld_link_tests standard form.
diff --git a/ld/testsuite/ld-arm/fdpic-main-m.d b/ld/testsuite/ld-arm/fdpic-main-m.d
new file mode 100644
index 0000000..ed0f41a
--- /dev/null
+++ b/ld/testsuite/ld-arm/fdpic-main-m.d
@@ -0,0 +1,73 @@
+
+tmpdir/fdpic-main: file format elf32-(little|big)arm
+architecture: arm.*, flags 0x00000112:
+EXEC_P, HAS_SYMS, D_PAGED
+start address 0x.*
+
+Disassembly of section .plt:
+
+.* <.plt>:
+ .*: f8df c00c ldr.w ip, \[pc, #12\] ; .* <.plt\+0x10>
+ .*: eb0c 0c09 add.w ip, ip, r9
+ .*: f8dc 9004 ldr.w r9, \[ip, #4\]
+ .*: f8dc f000 ldr.w pc, \[ip\]
+ .*: 0000000c .word 0x0000000c
+ .*: 00000000 .word 0x00000000
+ .*: f85f c008 ldr.w ip, \[pc, #-8\] ; .* <.plt\+0x14>
+ .*: f84d cd04 str.w ip, \[sp, #-4\]!
+ .*: f8d9 c004 ldr.w ip, \[r9, #4\]
+ .*: f8d9 f000 ldr.w pc, \[r9\]
+ .*: f8df c00c ldr.w ip, \[pc, #12\] ; .* <.plt\+0x38>
+ .*: eb0c 0c09 add.w ip, ip, r9
+ .*: f8dc 9004 ldr.w r9, \[ip, #4\]
+ .*: f8dc f000 ldr.w pc, \[ip]
+ .*: 00000014 .word 0x00000014
+ .*: 00000008 .word 0x00000008
+ .*: f85f c008 ldr.w ip, \[pc, #-8\] ; .* <.plt\+0x3c>
+ .*: f84d cd04 str.w ip, \[sp, #-4\]!
+ .*: f8d9 c004 ldr.w ip, \[r9, #4\]
+ .*: f8d9 f000 ldr.w pc, \[r9\]
+
+Disassembly of section .text:
+
+.* <_start>:
+ .*: f000 b800 b.w .* <main>
+
+.* <main>:
+ .*: 4a11 ldr r2, \[pc, #68\] ; .* <main\+0x48>.*
+ .*: 4b12 ldr r3, \[pc, #72\] ; .* <main\+0x4c>.*
+ .*: b570 push {r4, r5, r6, lr}
+ .*: f859 5002 ldr.w r5, \[r9, r2\]
+ .*: 464c mov r4, r9
+ .*: f859 3003 ldr.w r3, \[r9, r3\]
+ .*: 602b str r3, \[r5, #0\]
+ .*: f7ff ffcb bl .* <.plt>
+ .*: 4606 mov r6, r0
+ .*: 46a1 mov r9, r4
+ .*: 6828 ldr r0, \[r5, #0\]
+ .*: 46a1 mov r9, r4
+ .*: f7ff ffd9 bl .* <.plt\+0x28>
+ .*: 4b0b ldr r3, \[pc, #44\] ; .* <main\+0x50>.*
+ .*: 46a1 mov r9, r4
+ .*: 444b add r3, r9
+ .*: 4618 mov r0, r3
+ .*: 602b str r3, \[r5, #0\]
+ .*: 46a1 mov r9, r4
+ .*: f7ff ffd1 bl .* <.plt\+0x28>
+ .*: 4b08 ldr r3, \[pc, #32\] ; .* <main\+0x54>.*
+ .*: 46a1 mov r9, r4
+ .*: f859 3003 ldr.w r3, \[r9, r3\]
+ .*: 6818 ldr r0, \[r3, #0\]
+ .*: 46a1 mov r9, r4
+ .*: f7ff ffc9 bl .* <.plt\+0x28>
+ .*: 4630 mov r0, r6
+ .*: 46a1 mov r9, r4
+ .*: bd70 pop {r4, r5, r6, pc}
+ .*: 0000002c .word 0x0000002c
+ .*: 00000024 .word 0x00000024
+ .*: 0000001c .word 0x0000001c
+ .*: 00000028 .word 0x00000028
+
+.* <my_local_func>:
+ .*: 4770 bx lr
+ .*: bf00 nop
diff --git a/ld/testsuite/ld-arm/fdpic-main-m.s b/ld/testsuite/ld-arm/fdpic-main-m.s
new file mode 100644
index 0000000..4fb40ca
--- /dev/null
+++ b/ld/testsuite/ld-arm/fdpic-main-m.s
@@ -0,0 +1,86 @@
+ .arch armv7-m
+ .eabi_attribute 20, 1
+ .eabi_attribute 21, 1
+ .eabi_attribute 23, 3
+ .eabi_attribute 24, 1
+ .eabi_attribute 25, 1
+ .eabi_attribute 26, 2
+ .eabi_attribute 30, 2
+ .eabi_attribute 34, 1
+ .eabi_attribute 18, 4
+ .file "hello.c"
+ .text
+ .align 2
+ .syntax unified
+ .thumb
+ .fpu softvfp
+ .type my_local_func, %function
+my_local_func:
+ @ args = 0, pretend = 0, frame = 0
+ @ frame_needed = 0, uses_anonymous_args = 0
+ @ link register save eliminated.
+ bx lr
+ .size my_local_func, .-my_local_func
+ .section .text.startup,"ax",%progbits
+ .align 2
+ .global _start
+ .syntax unified
+ .thumb
+ .fpu softvfp
+ .type _start, %function
+_start:
+ b main
+
+ .global main
+ .syntax unified
+ .thumb
+ .fpu softvfp
+ .type main, %function
+main:
+ @ args = 0, pretend = 0, frame = 0
+ @ frame_needed = 0, uses_anonymous_args = 0
+ ldr r2, .L4
+ ldr r3, .L4+4
+ push {r4, r5, r6, lr}
+ ldr r5, [r9, r2]
+ mov r4, r9
+ ldr r3, [r9, r3]
+ str r3, [r5]
+ bl my_shared_func1(PLT)
+ mov r6, r0
+ mov r9, r4
+ ldr r0, [r5]
+ mov r9, r4
+ bl my_shared_func2(PLT)
+ ldr r3, .L4+8
+ mov r9, r4
+ add r3, r3, r9
+ mov r0, r3
+ str r3, [r5]
+ mov r9, r4
+ bl my_shared_func2(PLT)
+ ldr r3, .L4+12
+ mov r9, r4
+ ldr r3, [r9, r3]
+ ldr r0, [r3]
+ mov r9, r4
+ bl my_shared_func2(PLT)
+ mov r0, r6
+ mov r9, r4
+ pop {r4, r5, r6, pc}
+.L5:
+ .align 2
+.L4:
+ .word funcptr(GOT)
+ .word my_shared_func1(GOTFUNCDESC)
+ .word my_local_func(GOTOFFFUNCDESC)
+ .word funcptr2(GOT)
+ .size main, .-main
+ .global funcptr2
+ .comm funcptr,4,4
+ .section .data.rel,"aw",%progbits
+ .align 2
+ .type funcptr2, %object
+ .size funcptr2, 4
+funcptr2:
+ .word my_shared_func1(FUNCDESC)
diff --git a/ld/testsuite/ld-arm/fdpic-main-m.sym b/ld/testsuite/ld-arm/fdpic-main-m.sym
new file mode 100644
index 0000000..9eaf617
--- /dev/null
+++ b/ld/testsuite/ld-arm/fdpic-main-m.sym
@@ -0,0 +1,14 @@
+
+Symbol table for image:
+ +Num +Buc: +Value +Size +Type +Bind +Vis +Ndx +Name
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT +12 _edata
+ +.. +..: ........ +0 +FUNC +GLOBAL +DEFAULT +UND my_shared_func2
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT +12 __bss_start__
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT +13 _end
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT +13 __bss_end__
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT +13 __end__
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT + 9 __ROFIXUP_LIST__
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT +12 __bss_start
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT + 9 __ROFIXUP_END__
+ +.. +..: ........ +0 +FUNC +GLOBAL +DEFAULT +UND my_shared_func1
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT +13 _bss_end__
diff --git a/ld/testsuite/ld-arm/fdpic-shared-m.d b/ld/testsuite/ld-arm/fdpic-shared-m.d
new file mode 100644
index 0000000..49e4d2c
--- /dev/null
+++ b/ld/testsuite/ld-arm/fdpic-shared-m.d
@@ -0,0 +1,37 @@
+
+tmpdir/fdpic-shared.so: file format elf32-(little|big)arm
+architecture: arm.*, flags 0x00000150:
+HAS_SYMS, DYNAMIC, D_PAGED
+start address 0x.*
+
+Disassembly of section .plt:
+
+.* <.plt>:
+ .*: f8df c00c ldr.w ip, \[pc, #12\] ; .* <.plt\+0x10>
+ .*: eb0c 0c09 add.w ip, ip, r9
+ .*: f8dc 9004 ldr.w r9, \[ip, #4\]
+ .*: f8dc f000 ldr.w pc, \[ip\]
+ .*: 0000000c .word 0x0000000c
+ .*: 00000000 .word 0x00000000
+ .*: f85f c008 ldr.w ip, \[pc, #-8\] ; .* <.plt\+0x14>
+ .*: f84d cd04 str.w ip, \[sp, #-4\]!
+ .*: f8d9 c004 ldr.w ip, \[r9, #4\]
+ .*: f8d9 f000 ldr.w pc, \[r9\]
+
+Disassembly of section .text:
+
+.* <my_shared_func1>:
+ .*: 4770 bx lr
+ .*: bf00 nop
+
+.* <my_shared_func3>:
+ .*: f04f 0000 mov.w r0, #0
+ .*: 4770 bx lr
+ .*: bf00 nop
+
+.* <my_shared_func2>:
+ .*: b510 push {r4, lr}
+ .*: 464c mov r4, r9
+ .*: f7ff ffe2 bl .* <.plt>
+ .*: 46a1 mov r9, r4
+ .*: bd10 pop {r4, pc}
diff --git a/ld/testsuite/ld-arm/fdpic-shared-m.s b/ld/testsuite/ld-arm/fdpic-shared-m.s
new file mode 100644
index 0000000..ab01a08
--- /dev/null
+++ b/ld/testsuite/ld-arm/fdpic-shared-m.s
@@ -0,0 +1,52 @@
+ .arch armv7-m
+ .eabi_attribute 20, 1
+ .eabi_attribute 21, 1
+ .eabi_attribute 23, 3
+ .eabi_attribute 24, 1
+ .eabi_attribute 25, 1
+ .eabi_attribute 26, 2
+ .eabi_attribute 30, 2
+ .eabi_attribute 34, 1
+ .eabi_attribute 18, 4
+ .file "shared.c"
+ .text
+ .align 2
+ .global my_shared_func1
+ .syntax unified
+ .thumb
+ .fpu softvfp
+ .type my_shared_func1, %function
+my_shared_func1:
+ @ args = 0, pretend = 0, frame = 0
+ @ frame_needed = 0, uses_anonymous_args = 0
+ @ link register save eliminated.
+ bx lr
+ .size my_shared_func1, .-my_shared_func1
+ .align 2
+ .global my_shared_func3
+ .syntax unified
+ .thumb
+ .fpu softvfp
+ .type my_shared_func3, %function
+my_shared_func3:
+ @ args = 0, pretend = 0, frame = 0
+ @ frame_needed = 0, uses_anonymous_args = 0
+ @ link register save eliminated.
+ mov r0, #0
+ bx lr
+ .size my_shared_func3, .-my_shared_func3
+ .align 2
+ .global my_shared_func2
+ .syntax unified
+ .thumb
+ .fpu softvfp
+ .type my_shared_func2, %function
+my_shared_func2:
+ @ args = 0, pretend = 0, frame = 0
+ @ frame_needed = 0, uses_anonymous_args = 0
+ push {r4, lr}
+ mov r4, r9
+ bl my_shared_func3(PLT)
+ mov r9, r4
+ pop {r4, pc}
+ .size my_shared_func2, .-my_shared_func2
diff --git a/ld/testsuite/ld-arm/fdpic-shared-m.sym b/ld/testsuite/ld-arm/fdpic-shared-m.sym
new file mode 100644
index 0000000..1475370
--- /dev/null
+++ b/ld/testsuite/ld-arm/fdpic-shared-m.sym
@@ -0,0 +1,15 @@
+
+Symbol table for image:
+ +Num +Buc: +Value +Size +Type +Bind +Vis +Ndx +Name
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT +9 _edata
+ +.. +..: ........ +12 +FUNC +GLOBAL +DEFAULT +6 my_shared_func2
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT +9 __bss_start__
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT +9 _end
+ +.. +..: ........ +6 +FUNC +GLOBAL +DEFAULT +6 my_shared_func3
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT +9 __bss_end__
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT +9 __end__
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT +7 __ROFIXUP_LIST__
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT +9 __bss_start
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT +7 __ROFIXUP_END__
+ +.. +..: ........ +2 +FUNC +GLOBAL +DEFAULT +6 my_shared_func1
+ +.. +..: ........ +0 +NOTYPE +GLOBAL +DEFAULT +9 _bss_end__