This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: ARM dynamic object tests


On Fri, Jan 02, 2004 at 03:52:53PM -0500, Daniel Jacobowitz wrote:
> On Fri, Jan 02, 2004 at 07:36:55PM +0000, Nick Clifton wrote:
> > Hi Daniel,
> > 
> > > 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?
> > 
> > With these tests added I saw new failures for the "arm-linux" and
> > "arm-netbsdelf" toolchains, which appeared to be due to the start
> > addresses that you are expecting.  For example the ld.log file for the
> > arm-linux toolchain showed:
> > 
> >   regexp_diff match failure
> >   regexp "^start address 0x00000368$"
> >   line   "start address 0x0000033c"
> >   regexp_diff match failure
> >   regexp "^00000368 <lib_func1>:$"
> >   line   "0000033c <lib_func1>:"
> >   [etc...]
> > 
> > Could you adjust your tests to prevent these failures ?
> 
> Oops, that's right - it's caused by the addition of .stack on
> GNU/Linux, and probably something related on NetBSD.  Let's make the
> addresses wildcards, then.  This version tested on arm-linux and
> arm-elf.

Here's an update that adds a test for R_ARM_COPY.  No bug in CVS
binutils, but it's a test for a bug I introduced while working on
arm-linux this morning.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2003-01-06  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 15:50:45.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 0x.*
+
+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, #.*	; 0x.*
+ .*:	e28cca.* 	add	ip, ip, #.*	; 0x.*
+ .*:	e5bcf.* 	ldr	pc, \[ip, #.*\]!
+Disassembly of section .text:
+
+.* <_start>:
+ .*:	e1a0c00d 	mov	ip, sp
+ .*:	e92dd800 	stmdb	sp!, {fp, ip, lr, pc}
+ .*:	eb000001 	bl	.* <app_func>
+ .*:	e89d6800 	ldmia	sp, {fp, sp, lr}
+ .*:	e12fff1e 	bx	lr
+
+.* <app_func>:
+ .*:	e1a0c00d 	mov	ip, sp
+ .*:	e92dd800 	stmdb	sp!, {fp, ip, lr, pc}
+ .*:	ebfffff4 	bl	.* <.text-0xc>
+ .*:	e89d6800 	ldmia	sp, {fp, sp, lr}
+ .*:	e12fff1e 	bx	lr
+
+.* <app_func2>:
+ .*:	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-06 10:16:04.000000000 -0500
@@ -0,0 +1,9 @@
+
+tmpdir/arm-app:     file format elf32-littlearm
+
+DYNAMIC RELOCATION RECORDS
+OFFSET   TYPE              VALUE 
+.* R_ARM_COPY        data_obj
+.* 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-06 10:15:17.000000000 -0500
@@ -0,0 +1,23 @@
+	.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
+
+	.data
+	.long data_obj
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 15:50:24.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 0x.*
+
+Disassembly of section .plt:
+
+.* <.plt>:
+ .*:	e52de004 	str	lr, \[sp, #-4\]!
+ .*:	e59fe004 	ldr	lr, \[pc, #4\]	; .* <lib_func1-0x10>
+ .*:	e08fe00e 	add	lr, pc, lr
+ .*:	e5bef008 	ldr	pc, \[lr, #8\]!
+ .*:	.*
+ .*:	e28fc6.* 	add	ip, pc, #.*	; 0x.*
+ .*:	e28cca.* 	add	ip, ip, #.*	; 0x.*
+ .*:	e5bcf.* 	ldr	pc, \[ip, #.*\]!
+Disassembly of section .text:
+
+.* <lib_func1>:
+ .*:	e1a0c00d 	mov	ip, sp
+ .*:	e92dd800 	stmdb	sp!, {fp, ip, lr, pc}
+ .*:	ebfffff9 	bl	.* <lib_func1-0xc>
+ .*:	e89d6800 	ldmia	sp, {fp, sp, lr}
+ .*:	e12fff1e 	bx	lr
+
+.* <lib_func2>:
+ .*:	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 15:48:24.000000000 -0500
@@ -0,0 +1,8 @@
+
+tmpdir/arm-lib-plt32.so:     file format elf32-littlearm
+
+DYNAMIC RELOCATION RECORDS
+OFFSET   TYPE              VALUE 
+.* 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 15:47:35.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 0x.*
+
+Disassembly of section .text:
+
+.* <lib_func1>:
+ .*:	e1a0c00d 	mov	ip, sp
+ .*:	e92dd800 	stmdb	sp!, {fp, ip, lr, pc}
+ .*:	ebfffffe 	bl	.* <lib_func1\+0x8>
+ .*:	e89d6800 	ldmia	sp, {fp, sp, lr}
+ .*:	e12fff1e 	bx	lr
+
+.* <lib_func2>:
+ .*:	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 15:48:27.000000000 -0500
@@ -0,0 +1,8 @@
+
+tmpdir/arm-lib.so:     file format elf32-littlearm
+
+DYNAMIC RELOCATION RECORDS
+OFFSET   TYPE              VALUE 
+.* 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-06 10:13:41.000000000 -0500
@@ -0,0 +1,24 @@
+	.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
+
+	.data
+	.globl data_obj
+	.type data_obj, %object
+data_obj:
+	.long 0
+	.size data_obj, . - data_obj


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]