This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
RFA: ARM dynamic object tests
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: binutils at sources dot redhat dot com
- Date: Fri, 2 Jan 2004 12:57:49 -0500
- Subject: RFA: ARM dynamic object tests
I have some pending work related to ARM shared libraries. I figured it
would be nice to have tests in the testsuite describing the current
behavior, especially for cases where I'm planning to change it. These are
quite minimal - no visibility tests, et cetera - but they can grow with
time. They at least verify when PLT entries should and should not be
created.
OK?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2003-01-02 Daniel Jacobowitz <drow@mvista.com>
* ld-arm/arm-app.d, ld-arm/arm-app.r, ld-arm/arm-app.s,
ld-arm/arm-lib.d, ld-arm/arm-lib.r, ld-arm/arm-lib.s,
ld-arm/arm-lib-plt32.d, ld-arm/arm-lib-plt32.r,
ld-arm/arm-lib-plt32.s, ld-arm/arm-elf.exp: New files.
diff -Nur empty/arm-app.d ld/testsuite/ld-arm/arm-app.d
--- empty/arm-app.d 1969-12-31 19:00:00.000000000 -0500
+++ ld/testsuite/ld-arm/arm-app.d 2004-01-02 11:59:28.000000000 -0500
@@ -0,0 +1,35 @@
+
+tmpdir/arm-app: file format elf32-littlearm
+architecture: arm, flags 0x00000112:
+EXEC_P, HAS_SYMS, D_PAGED
+start address 0x000081fc
+
+Disassembly of section .plt:
+
+000081dc <.plt>:
+ 81dc: e52de004 str lr, \[sp, #-4\]!
+ 81e0: e59fe004 ldr lr, \[pc, #4\] ; 81ec <.plt\+0x10>
+ 81e4: e08fe00e add lr, pc, lr
+ 81e8: e5bef008 ldr pc, \[lr, #8\]!
+ 81ec: 000001c4 andeq r0, r0, r4, asr #3
+ 81f0: e28fc600 add ip, pc, #0 ; 0x0
+ 81f4: e28cca00 add ip, ip, #0 ; 0x0
+ 81f8: e5bcf1c4 ldr pc, \[ip, #452\]!
+Disassembly of section .text:
+
+000081fc <_start>:
+ 81fc: e1a0c00d mov ip, sp
+ 8200: e92dd800 stmdb sp!, {fp, ip, lr, pc}
+ 8204: eb000001 bl 8210 <app_func>
+ 8208: e89d6800 ldmia sp, {fp, sp, lr}
+ 820c: e12fff1e bx lr
+
+00008210 <app_func>:
+ 8210: e1a0c00d mov ip, sp
+ 8214: e92dd800 stmdb sp!, {fp, ip, lr, pc}
+ 8218: ebfffff4 bl 81f0 <.text-0xc>
+ 821c: e89d6800 ldmia sp, {fp, sp, lr}
+ 8220: e12fff1e bx lr
+
+00008224 <app_func2>:
+ 8224: e12fff1e bx lr
diff -Nur empty/arm-app.r ld/testsuite/ld-arm/arm-app.r
--- empty/arm-app.r 1969-12-31 19:00:00.000000000 -0500
+++ ld/testsuite/ld-arm/arm-app.r 2004-01-02 11:57:30.000000000 -0500
@@ -0,0 +1,8 @@
+
+tmpdir/arm-app: file format elf32-littlearm
+
+DYNAMIC RELOCATION RECORDS
+OFFSET TYPE VALUE
+000083bc R_ARM_JUMP_SLOT lib_func1
+
+
diff -Nur empty/arm-app.s ld/testsuite/ld-arm/arm-app.s
--- empty/arm-app.s 1969-12-31 19:00:00.000000000 -0500
+++ ld/testsuite/ld-arm/arm-app.s 2004-01-02 11:50:40.000000000 -0500
@@ -0,0 +1,20 @@
+ .text
+ .globl _start
+_start:
+ mov ip, sp
+ stmdb sp!, {r11, ip, lr, pc}
+ bl app_func
+ ldmia sp, {r11, sp, lr}
+ bx lr
+
+ .globl app_func
+app_func:
+ mov ip, sp
+ stmdb sp!, {r11, ip, lr, pc}
+ bl lib_func1
+ ldmia sp, {r11, sp, lr}
+ bx lr
+
+ .globl app_func2
+app_func2:
+ bx lr
diff -Nur empty/arm-elf.exp ld/testsuite/ld-arm/arm-elf.exp
--- empty/arm-elf.exp 1969-12-31 19:00:00.000000000 -0500
+++ ld/testsuite/ld-arm/arm-elf.exp 2004-01-02 12:53:06.000000000 -0500
@@ -0,0 +1,46 @@
+# Expect script for various ARM ELF tests.
+# Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
+#
+# 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.
+#
+
+# Exclude non-ARM-ELF targets.
+
+if { ![is_elf_format] || ![istarget "arm*-*-*"] } {
+ return
+}
+
+# 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. 5: name of output file
+
+# Actions:
+# objdump: Apply objdump options on result. Compare with regex (last arg).
+# nm: Apply nm options on result. Compare with regex (last arg).
+# readelf: Apply readelf options on result. Compare with regex (last arg).
+
+set armelftests {
+ {"Simple non-PIC shared library" "-shared" "" {arm-lib.s}
+ {{objdump -fdw arm-lib.d} {objdump -Rw arm-lib.r}}
+ "arm-lib.so"}
+ {"Simple PIC shared library" "-shared" "" {arm-lib-plt32.s}
+ {{objdump -fdw arm-lib-plt32.d} {objdump -Rw arm-lib-plt32.r}}
+ "arm-lib-plt32.so"}
+ {"Simple dynamic application" "tmpdir/arm-lib.so" "" {arm-app.s}
+ {{objdump -fdw arm-app.d} {objdump -Rw arm-app.r}}
+ "arm-app"}
+}
+
+run_ld_link_tests $armelftests
diff -Nur empty/arm-lib-plt32.d ld/testsuite/ld-arm/arm-lib-plt32.d
--- empty/arm-lib-plt32.d 1969-12-31 19:00:00.000000000 -0500
+++ ld/testsuite/ld-arm/arm-lib-plt32.d 2004-01-02 12:12:34.000000000 -0500
@@ -0,0 +1,28 @@
+
+tmpdir/arm-lib-plt32.so: file format elf32-littlearm
+architecture: arm, flags 0x00000150:
+HAS_SYMS, DYNAMIC, D_PAGED
+start address 0x0000039c
+
+Disassembly of section .plt:
+
+0000037c <.plt>:
+ 37c: e52de004 str lr, \[sp, #-4\]!
+ 380: e59fe004 ldr lr, \[pc, #4\] ; 38c <lib_func1-0x10>
+ 384: e08fe00e add lr, pc, lr
+ 388: e5bef008 ldr pc, \[lr, #8\]!
+ 38c: 000001a0 andeq r0, r0, r0, lsr #3
+ 390: e28fc600 add ip, pc, #0 ; 0x0
+ 394: e28cca00 add ip, ip, #0 ; 0x0
+ 398: e5bcf1a0 ldr pc, \[ip, #416\]!
+Disassembly of section .text:
+
+0000039c <lib_func1>:
+ 39c: e1a0c00d mov ip, sp
+ 3a0: e92dd800 stmdb sp!, {fp, ip, lr, pc}
+ 3a4: ebfffff9 bl 390 <lib_func1-0xc>
+ 3a8: e89d6800 ldmia sp, {fp, sp, lr}
+ 3ac: e12fff1e bx lr
+
+000003b0 <lib_func2>:
+ 3b0: e12fff1e bx lr
diff -Nur empty/arm-lib-plt32.r ld/testsuite/ld-arm/arm-lib-plt32.r
--- empty/arm-lib-plt32.r 1969-12-31 19:00:00.000000000 -0500
+++ ld/testsuite/ld-arm/arm-lib-plt32.r 2004-01-02 12:11:57.000000000 -0500
@@ -0,0 +1,8 @@
+
+tmpdir/arm-lib-plt32.so: file format elf32-littlearm
+
+DYNAMIC RELOCATION RECORDS
+OFFSET TYPE VALUE
+00000538 R_ARM_JUMP_SLOT app_func2
+
+
diff -Nur empty/arm-lib-plt32.s ld/testsuite/ld-arm/arm-lib-plt32.s
--- empty/arm-lib-plt32.s 1969-12-31 19:00:00.000000000 -0500
+++ ld/testsuite/ld-arm/arm-lib-plt32.s 2004-01-02 12:11:24.000000000 -0500
@@ -0,0 +1,17 @@
+ .text
+
+ .globl lib_func1
+ .type lib_func1, %function
+lib_func1:
+ mov ip, sp
+ stmdb sp!, {r11, ip, lr, pc}
+ bl app_func2(PLT)
+ ldmia sp, {r11, sp, lr}
+ bx lr
+ .size lib_func1, . - lib_func1
+
+ .globl lib_func2
+ .type lib_func2, %function
+lib_func2:
+ bx lr
+ .size lib_func2, . - lib_func2
diff -Nur empty/arm-lib.d ld/testsuite/ld-arm/arm-lib.d
--- empty/arm-lib.d 1969-12-31 19:00:00.000000000 -0500
+++ ld/testsuite/ld-arm/arm-lib.d 2004-01-02 11:58:46.000000000 -0500
@@ -0,0 +1,17 @@
+
+tmpdir/arm-lib.so: file format elf32-littlearm
+architecture: arm, flags 0x00000150:
+HAS_SYMS, DYNAMIC, D_PAGED
+start address 0x00000368
+
+Disassembly of section .text:
+
+00000368 <lib_func1>:
+ 368: e1a0c00d mov ip, sp
+ 36c: e92dd800 stmdb sp!, {fp, ip, lr, pc}
+ 370: ebfffffe bl 370 <lib_func1\+0x8>
+ 374: e89d6800 ldmia sp, {fp, sp, lr}
+ 378: e12fff1e bx lr
+
+0000037c <lib_func2>:
+ 37c: e12fff1e bx lr
diff -Nur empty/arm-lib.r ld/testsuite/ld-arm/arm-lib.r
--- empty/arm-lib.r 1969-12-31 19:00:00.000000000 -0500
+++ ld/testsuite/ld-arm/arm-lib.r 2004-01-02 11:58:53.000000000 -0500
@@ -0,0 +1,8 @@
+
+tmpdir/arm-lib.so: file format elf32-littlearm
+
+DYNAMIC RELOCATION RECORDS
+OFFSET TYPE VALUE
+00000370 R_ARM_PC24 app_func2
+
+
diff -Nur empty/arm-lib.s ld/testsuite/ld-arm/arm-lib.s
--- empty/arm-lib.s 1969-12-31 19:00:00.000000000 -0500
+++ ld/testsuite/ld-arm/arm-lib.s 2004-01-02 11:50:40.000000000 -0500
@@ -0,0 +1,17 @@
+ .text
+
+ .globl lib_func1
+ .type lib_func1, %function
+lib_func1:
+ mov ip, sp
+ stmdb sp!, {r11, ip, lr, pc}
+ bl app_func2
+ ldmia sp, {r11, sp, lr}
+ bx lr
+ .size lib_func1, . - lib_func1
+
+ .globl lib_func2
+ .type lib_func2, %function
+lib_func2:
+ bx lr
+ .size lib_func2, . - lib_func2