Small tweaks to the i386 VxWorks tests

Richard Sandiford richard@codesourcery.com
Wed Mar 1 18:37:00 GMT 2006


In the VxWorks tests I added yesterday, the linker script used
alignments to protect against minor changes that weren't being
tested for, such as the number of sections and dynamic symbols.

(In the past, tests that required an exact file layout weren't
updated after patches like the ones to remove empty sections.
And that's understandable really.  It isn't easy to know which
changes are OK and which aren't for all targets.)

The alignment I used was 0x100 bytes, which was smaller than
the first block of sections.  In hindsight, I think it would
be better to use a bigger alignment such as 0x400, like the
powerpc tests I submitted earlier do.  This test updates the
linker script and expected output accordingly.

Also, I wanted the reloc tests to ignore the symbol indexes,
but I fluffed it.  The executable tests were OK but the shared
library tests weren't.

Finally, .bss was being placed as an orphan.

Tested on i586-vxworks.  OK to install?

(Sorry for the run-around here.)

Richard


ld/testsuite/
	* ld-i386/vxworks1.ld: Use bigger alignments.  Make sure .bss isn't
	placed as an orphan.
	* ld-i386/vxworks1-lib.dd, ld-i386/vxworks1.dd,
	* ld-i386/vxworks1.rd: Update accordingly.
	* ld-i386/vxworks1-lib.rd: Likewise.  Remove symbol indexes.

diff -uprN ../src.3/ld/testsuite/ld-i386/vxworks1.dd ./ld/testsuite/ld-i386/vxworks1.dd
--- ./ld/testsuite/ld-i386/vxworks1.dd	2006-02-28 07:16:22.000000000 +0000
+++ ./ld/testsuite/ld-i386/vxworks1.dd	2006-03-01 18:16:39.000000000 +0000
@@ -3,36 +3,36 @@
 
 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_>
+00080800 <_PROCEDURE_LINKAGE_TABLE_>:
+   80800:	ff 35 04 14 08 00    	pushl  0x81404
+			80802: R_386_32	_GLOBAL_OFFSET_TABLE_
+   80806:	ff 25 08 14 08 00    	jmp    \*0x81408
+			80808: R_386_32	_GLOBAL_OFFSET_TABLE_
+   8080c:	90                   	nop    
+   8080d:	90                   	nop    
+   8080e:	90                   	nop    
+   8080f:	90                   	nop    
+
+00080810 <sglobal@plt>:
+   80810:	ff 25 0c 14 08 00    	jmp    \*0x8140c
+			80812: R_386_32	_GLOBAL_OFFSET_TABLE_
+   80816:	68 00 00 00 00       	push   \$0x0
+   8081b:	e9 e0 ff ff ff       	jmp    80800 <_PROCEDURE_LINKAGE_TABLE_>
+
+00080820 <foo@plt>:
+   80820:	ff 25 10 14 08 00    	jmp    \*0x81410
+			80822: R_386_32	_GLOBAL_OFFSET_TABLE_
+   80826:	68 08 00 00 00       	push   \$0x8
+   8082b:	e9 d0 ff ff ff       	jmp    80800 <_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
+00080c00 <_start>:
+   80c00:	e8 1b fc ff ff       	call   80820 <foo@plt>
+			80c01: R_386_PLT32	\.plt
+   80c05:	e8 05 00 00 00       	call   80c0f <sexternal>
+			80c06: R_386_PLT32	sexternal
+   80c0a:	e9 01 fc ff ff       	jmp    80810 <sglobal@plt>
+			80c0b: R_386_PLT32	\.plt
 
-0008030f <sexternal>:
-   8030f:	c3                   	ret    
+00080c0f <sexternal>:
+   80c0f:	c3                   	ret    
diff -uprN ../src.3/ld/testsuite/ld-i386/vxworks1.ld ./ld/testsuite/ld-i386/vxworks1.ld
--- ./ld/testsuite/ld-i386/vxworks1.ld	2006-02-28 07:16:22.000000000 +0000
+++ ./ld/testsuite/ld-i386/vxworks1.ld	2006-03-01 18:30:31.000000000 +0000
@@ -6,19 +6,22 @@ SECTIONS
   .dynsym : { *(.dynsym) }
   .dynstr : { *(.dynstr) }
 
-  . = ALIGN (0x100);
+  . = ALIGN (0x400);
   .rel.dyn : { *(.rel.dyn) }
   .rel.plt : { *(.rel.plt) }
 
-  . = ALIGN (0x100);
+  . = ALIGN (0x400);
   .plt : { *(.plt) }
 
-  . = ALIGN (0x100);
+  . = ALIGN (0x400);
   .text : { *(.text) }
 
   . = ALIGN (0x1000);
   .dynamic : { *(.dynamic) }
 
-  . = ALIGN (0x100);
+  . = ALIGN (0x400);
   .got : { *(.got.plt) *(.got) }
+
+  . = ALIGN (0x400);
+  .bss : { *(.bss) *(.dynbss) }
 }
diff -uprN ../src.3/ld/testsuite/ld-i386/vxworks1-lib.dd ./ld/testsuite/ld-i386/vxworks1-lib.dd
--- ./ld/testsuite/ld-i386/vxworks1-lib.dd	2006-02-28 07:16:22.000000000 +0000
+++ ./ld/testsuite/ld-i386/vxworks1-lib.dd	2006-03-01 18:12:18.000000000 +0000
@@ -3,39 +3,39 @@
 
 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_>
+00080800 <_PROCEDURE_LINKAGE_TABLE_>:
+   80800:	ff b3 04 00 00 00    	pushl  0x4\(%ebx\)
+   80806:	ff a3 08 00 00 00    	jmp    \*0x8\(%ebx\)
+   8080c:	90                   	nop    
+   8080d:	90                   	nop    
+   8080e:	90                   	nop    
+   8080f:	90                   	nop    
+
+00080810 <sexternal@plt>:
+   80810:	ff a3 0c 00 00 00    	jmp    \*0xc\(%ebx\)
+   80816:	68 00 00 00 00       	push   \$0x0
+   8081b:	e9 e0 ff ff ff       	jmp    80800 <_PROCEDURE_LINKAGE_TABLE_>
+
+00080820 <sglobal@plt>:
+   80820:	ff a3 10 00 00 00    	jmp    \*0x10\(%ebx\)
+   80826:	68 08 00 00 00       	push   \$0x8
+   8082b:	e9 d0 ff ff ff       	jmp    80800 <_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    
+00080c00 <foo>:
+   80c00:	53                   	push   %ebx
+   80c01:	8b 1d 00 00 00 00    	mov    0x0,%ebx
+   80c07:	8b 99 00 00 00 00    	mov    0x0\(%ecx\),%ebx
+   80c0d:	8b 83 14 00 00 00    	mov    0x14\(%ebx\),%eax
+   80c13:	ff 00                	incl   \(%eax\)
+   80c15:	e8 0c 00 00 00       	call   80c26 <slocal>
+   80c1a:	e8 01 fc ff ff       	call   80820 <sglobal@plt>
+   80c1f:	e8 ec fb ff ff       	call   80810 <sexternal@plt>
+   80c24:	5b                   	pop    %ebx
+   80c25:	c3                   	ret    
 
-00080426 <slocal>:
-   80426:	c3                   	ret    
+00080c26 <slocal>:
+   80c26:	c3                   	ret    
 
-00080427 <sglobal>:
-   80427:	c3                   	ret    
+00080c27 <sglobal>:
+   80c27:	c3                   	ret    
diff -uprN ../src.3/ld/testsuite/ld-i386/vxworks1-lib.rd ./ld/testsuite/ld-i386/vxworks1-lib.rd
--- ./ld/testsuite/ld-i386/vxworks1-lib.rd	2006-02-28 07:16:22.000000000 +0000
+++ ./ld/testsuite/ld-i386/vxworks1-lib.rd	2006-03-01 18:31:38.000000000 +0000
@@ -1,11 +1,11 @@
 
-Relocation section '\.rel\.plt' at offset 0x1218 contains 2 entries:
+Relocation section '\.rel\.plt' at offset .* 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
+0008140c  .*07 R_386_JUMP_SLOT   00000000   sexternal
+00081410  .*07 R_386_JUMP_SLOT   00080c27   sglobal
 
-Relocation section '\.rel\.dyn' at offset 0x1200 contains 3 entries:
+Relocation section '\.rel\.dyn' at offset .* 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
+00080c03  .*01 R_386_32          00000000   __GOTT_BASE__
+00080c09  .*01 R_386_32          00000000   __GOTT_INDEX__
+00081414  .*06 R_386_GLOB_DAT    00081800   x
diff -uprN ../src.3/ld/testsuite/ld-i386/vxworks1.rd ./ld/testsuite/ld-i386/vxworks1.rd
--- ./ld/testsuite/ld-i386/vxworks1.rd	2006-02-28 07:16:22.000000000 +0000
+++ ./ld/testsuite/ld-i386/vxworks1.rd	2006-03-01 18:16:16.000000000 +0000
@@ -1,20 +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
+0008140c  .*07 R_386_JUMP_SLOT   00000000   sglobal
+00081410  .*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
+00080c01  .*04 R_386_PLT32       00080800   .plt
+00080c06  .*04 R_386_PLT32       00080c0f   sexternal
+00080c0b  .*04 R_386_PLT32       00080800   .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.*
+00080802  .*01 R_386_32          00081400   _GLOBAL_OFFSET_TABLE_
+00080808  .*01 R_386_32          00081400   _GLOBAL_OFFSET_TABLE_
+00080812  .*01 R_386_32          00081400   _GLOBAL_OFFSET_TABLE_
+0008140c  .*01 R_386_32          00080800   _PROCEDURE_LINKAGE_TAB.*
+00080822  .*01 R_386_32          00081400   _GLOBAL_OFFSET_TABLE_
+00081410  .*01 R_386_32          00080800   _PROCEDURE_LINKAGE_TAB.*



More information about the Binutils mailing list