This is the mail archive of the binutils@sourceware.org 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]

i?86-vxworks linker test


While working on the -q patch, I realised that we had no x86 VxWorks
linker tests.  This patch adds one to cover the basic VxWorks-specific
functionality.

Tested on i586-vxworks.  Ok to install?

Richard


ld/testsuite/
	* ld-i386/vxworks1-lib.s, ld-i386/vxworks1-lib.dd,
	* ld-i386/vxworks1-lib.rd, ld-i386/vxworks1.s, ld-i386/vxworks1.dd,
	* ld-i386/vxworks1.rd, ld-i386/vxworks1.ld: New test.
	* ld-i386/i386.exp: Run it.

Index: ld/testsuite/ld-i386/i386.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-i386/i386.exp,v
retrieving revision 1.11
diff -u -p -r1.11 i386.exp
--- ld/testsuite/ld-i386/i386.exp	18 Jan 2006 21:07:49 -0000	1.11
+++ ld/testsuite/ld-i386/i386.exp	27 Feb 2006 19:37:16 -0000
@@ -19,6 +19,20 @@
 # Test i386 linking; all types of relocs.  This tests the assembler and
 # tools like objdump as well as the linker.
 
+if {[istarget "i?86-*-vxworks"]} {
+    set i386tests {
+	{"VxWorks shared library test 1" "-shared -Tvxworks1.ld"
+	 "" {vxworks1-lib.s}
+	 {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}}
+	 "libvxworks1.so"}
+	{"VxWorks dynamic executable test 1" \
+	 "tmpdir/libvxworks1.so -Tvxworks1.ld -q" "" {vxworks1.s}
+	 {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
+	 "vxworks1"}
+    }
+    run_ld_link_tests $i386tests
+}
+
 if { !([istarget "i?86-*-elf*"]		
        || ([istarget "i?86-*-linux*"]
 	   && ![istarget "*-*-*aout*"]
Index: ld/testsuite/ld-i386/vxworks1.dd
===================================================================
RCS file: ld/testsuite/ld-i386/vxworks1.dd
diff -N ld/testsuite/ld-i386/vxworks1.dd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-i386/vxworks1.dd	27 Feb 2006 19:37:16 -0000
@@ -0,0 +1,38 @@
+
+.*:     file format .*
+
+Disassembly of section \.plt:
+
+00080200 <_PROCEDURE_LINKAGE_TABLE_>:
+   80200:	ff 35 04 11 08 00    	pushl  0x81104
+			80202: R_386_32	_GLOBAL_OFFSET_TABLE_
+   80206:	ff 25 08 11 08 00    	jmp    \*0x81108
+			80208: R_386_32	_GLOBAL_OFFSET_TABLE_
+   8020c:	90                   	nop    
+   8020d:	90                   	nop    
+   8020e:	90                   	nop    
+   8020f:	90                   	nop    
+
+00080210 <sglobal@plt>:
+   80210:	ff 25 0c 11 08 00    	jmp    \*0x8110c
+			80212: R_386_32	_GLOBAL_OFFSET_TABLE_
+   80216:	68 00 00 00 00       	push   \$0x0
+   8021b:	e9 e0 ff ff ff       	jmp    80200 <_PROCEDURE_LINKAGE_TABLE_>
+
+00080220 <foo@plt>:
+   80220:	ff 25 10 11 08 00    	jmp    \*0x81110
+			80222: R_386_32	_GLOBAL_OFFSET_TABLE_
+   80226:	68 08 00 00 00       	push   \$0x8
+   8022b:	e9 d0 ff ff ff       	jmp    80200 <_PROCEDURE_LINKAGE_TABLE_>
+Disassembly of section \.text:
+
+00080300 <_start>:
+   80300:	e8 1b ff ff ff       	call   80220 <foo@plt>
+			80301: R_386_PLT32	\.plt
+   80305:	e8 05 00 00 00       	call   8030f <sexternal>
+			80306: R_386_PLT32	sexternal
+   8030a:	e9 01 ff ff ff       	jmp    80210 <sglobal@plt>
+			8030b: R_386_PLT32	\.plt
+
+0008030f <sexternal>:
+   8030f:	c3                   	ret    
Index: ld/testsuite/ld-i386/vxworks1.ld
===================================================================
RCS file: ld/testsuite/ld-i386/vxworks1.ld
diff -N ld/testsuite/ld-i386/vxworks1.ld
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-i386/vxworks1.ld	27 Feb 2006 19:37:16 -0000
@@ -0,0 +1,24 @@
+SECTIONS
+{
+  . = 0x80000;
+  .interp : { *(.interp) }
+  .hash : { *(.hash) }
+  .dynsym : { *(.dynsym) }
+  .dynstr : { *(.dynstr) }
+
+  . = ALIGN (0x100);
+  .rel.dyn : { *(.rel.dyn) }
+  .rel.plt : { *(.rel.plt) }
+
+  . = ALIGN (0x100);
+  .plt : { *(.plt) }
+
+  . = ALIGN (0x100);
+  .text : { *(.text) }
+
+  . = ALIGN (0x1000);
+  .dynamic : { *(.dynamic) }
+
+  . = ALIGN (0x100);
+  .got : { *(.got.plt) *(.got) }
+}
Index: ld/testsuite/ld-i386/vxworks1-lib.dd
===================================================================
RCS file: ld/testsuite/ld-i386/vxworks1-lib.dd
diff -N ld/testsuite/ld-i386/vxworks1-lib.dd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-i386/vxworks1-lib.dd	27 Feb 2006 19:37:16 -0000
@@ -0,0 +1,41 @@
+
+.*:     file format .*
+
+Disassembly of section \.plt:
+
+00080300 <_PROCEDURE_LINKAGE_TABLE_>:
+   80300:	ff b3 04 00 00 00    	pushl  0x4\(%ebx\)
+   80306:	ff a3 08 00 00 00    	jmp    \*0x8\(%ebx\)
+   8030c:	90                   	nop    
+   8030d:	90                   	nop    
+   8030e:	90                   	nop    
+   8030f:	90                   	nop    
+
+00080310 <sexternal@plt>:
+   80310:	ff a3 0c 00 00 00    	jmp    \*0xc\(%ebx\)
+   80316:	68 00 00 00 00       	push   \$0x0
+   8031b:	e9 e0 ff ff ff       	jmp    80300 <_PROCEDURE_LINKAGE_TABLE_>
+
+00080320 <sglobal@plt>:
+   80320:	ff a3 10 00 00 00    	jmp    \*0x10\(%ebx\)
+   80326:	68 08 00 00 00       	push   \$0x8
+   8032b:	e9 d0 ff ff ff       	jmp    80300 <_PROCEDURE_LINKAGE_TABLE_>
+Disassembly of section \.text:
+
+00080400 <foo>:
+   80400:	53                   	push   %ebx
+   80401:	8b 1d 00 00 00 00    	mov    0x0,%ebx
+   80407:	8b 99 00 00 00 00    	mov    0x0\(%ecx\),%ebx
+   8040d:	8b 83 14 00 00 00    	mov    0x14\(%ebx\),%eax
+   80413:	ff 00                	incl   \(%eax\)
+   80415:	e8 0c 00 00 00       	call   80426 <slocal>
+   8041a:	e8 01 ff ff ff       	call   80320 <sglobal@plt>
+   8041f:	e8 ec fe ff ff       	call   80310 <sexternal@plt>
+   80424:	5b                   	pop    %ebx
+   80425:	c3                   	ret    
+
+00080426 <slocal>:
+   80426:	c3                   	ret    
+
+00080427 <sglobal>:
+   80427:	c3                   	ret    
Index: ld/testsuite/ld-i386/vxworks1-lib.rd
===================================================================
RCS file: ld/testsuite/ld-i386/vxworks1-lib.rd
diff -N ld/testsuite/ld-i386/vxworks1-lib.rd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-i386/vxworks1-lib.rd	27 Feb 2006 19:37:16 -0000
@@ -0,0 +1,11 @@
+
+Relocation section '\.rel\.plt' at offset 0x1218 contains 2 entries:
+ Offset     Info    Type            Sym\.Value  Sym\. Name
+0008110c  00000507 R_386_JUMP_SLOT   00000000   sexternal
+00081110  00000807 R_386_JUMP_SLOT   00080427   sglobal
+
+Relocation section '\.rel\.dyn' at offset 0x1200 contains 3 entries:
+ Offset     Info    Type            Sym\.Value  Sym\. Name
+00080403  00000601 R_386_32          00000000   __GOTT_BASE__
+00080409  00000701 R_386_32          00000000   __GOTT_INDEX__
+00081114  00000406 R_386_GLOB_DAT    00080000   x
Index: ld/testsuite/ld-i386/vxworks1-lib.s
===================================================================
RCS file: ld/testsuite/ld-i386/vxworks1-lib.s
diff -N ld/testsuite/ld-i386/vxworks1-lib.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-i386/vxworks1-lib.s	27 Feb 2006 19:37:16 -0000
@@ -0,0 +1,28 @@
+	.text
+	.globl	foo
+	.type	foo, @function
+foo:
+	push	%ebx
+	movl	__GOTT_BASE__, %ebx
+	movl	__GOTT_INDEX__(%ecx), %ebx
+	movl	x@GOT(%ebx), %eax
+	incl	(%eax)
+	call	slocal@plt
+	call	sglobal@plt
+	call	sexternal@plt
+	pop	%ebx
+	ret
+	.size	foo, .-foo
+
+	.type	slocal, @function
+slocal:
+	ret
+	.size	slocal, .-slocal
+
+	.globl	sglobal
+	.type	sglobal, @function
+sglobal:
+	ret
+	.size	sglobal, .-sglobal
+
+	.comm	x,4,4
Index: ld/testsuite/ld-i386/vxworks1.rd
===================================================================
RCS file: ld/testsuite/ld-i386/vxworks1.rd
diff -N ld/testsuite/ld-i386/vxworks1.rd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-i386/vxworks1.rd	27 Feb 2006 19:37:16 -0000
@@ -0,0 +1,20 @@
+
+Relocation section '\.rel\.plt' at offset .* contains 2 entries:
+ Offset     Info    Type            Sym\.Value  Sym\. Name
+0008110c  .*07 R_386_JUMP_SLOT   00000000   sglobal
+00081110  .*07 R_386_JUMP_SLOT   00000000   foo
+
+Relocation section '\.rel\.text' at offset .* contains 3 entries:
+ Offset     Info    Type            Sym.Value  Sym. Name
+00080301  .*04 R_386_PLT32       00080200   .plt
+00080306  .*04 R_386_PLT32       0008030f   sexternal
+0008030b  .*04 R_386_PLT32       00080200   .plt
+
+Relocation section '\.rel\.plt\.unloaded' at offset .* contains 6 entries:
+ Offset     Info    Type            Sym\.Value  Sym\. Name
+00080202  .*01 R_386_32          00081100   _GLOBAL_OFFSET_TABLE_
+00080208  .*01 R_386_32          00081100   _GLOBAL_OFFSET_TABLE_
+00080212  .*01 R_386_32          00081100   _GLOBAL_OFFSET_TABLE_
+0008110c  .*01 R_386_32          00080200   _PROCEDURE_LINKAGE_TAB.*
+00080222  .*01 R_386_32          00081100   _GLOBAL_OFFSET_TABLE_
+00081110  .*01 R_386_32          00080200   _PROCEDURE_LINKAGE_TAB.*
Index: ld/testsuite/ld-i386/vxworks1.s
===================================================================
RCS file: ld/testsuite/ld-i386/vxworks1.s
diff -N ld/testsuite/ld-i386/vxworks1.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-i386/vxworks1.s	27 Feb 2006 19:37:16 -0000
@@ -0,0 +1,14 @@
+	.text
+	.globl	_start
+	.type	_start,@function
+_start:
+	call	foo@plt
+	call	sexternal@plt
+	jmp	sglobal@plt
+	.size	_start, .-_start
+
+	.globl	sexternal
+	.type	sexternal,@function
+sexternal:
+	ret
+	.size	sexternal, .-sexternal


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