This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
various ld testsuite fixes
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Thu, 8 Apr 2004 02:32:52 +0930
- Subject: various ld testsuite fixes
Fixes lots of failures on non-ELF targets. These are all problems
with relatively new tests. I'll commit tomorrow with a suitable
changelog.
Some things to remember when writing generic tests:
o .section isn't always a valid pseudo op. In fact, no sections other
than .text, .data, and .bss may be available (and .bss may not be
a valid pseudo!)
o Some targets pad out section contents. Finish off a section with
.p2align 4 or something equivalent.
o Setting addresses in ld scripts won't always work. (aout targets).
Also, not setting an address won't necessarily mean you start at 0.
o '#' might not be the comment char.
o Some targets define extra symbols (and sections, and relocs..)
I'm writing this list for my own benefit as much as anyone else. :)
Index: ld/testsuite/ld-scripts/align.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/align.exp,v
retrieving revision 1.1
diff -u -p -r1.1 align.exp
--- ld/testsuite/ld-scripts/align.exp 20 Feb 2004 15:31:10 -0000 1.1
+++ ld/testsuite/ld-scripts/align.exp 7 Apr 2004 16:35:45 -0000
@@ -17,6 +17,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+if { [istarget "rs6000-*-aix*"] } {
+ # Target maps .text and .data to other sections.
+ return
+}
+
set testname "ALIGN"
if ![ld_assemble $as $srcdir/$subdir/align.s tmpdir/align.o] {
Index: ld/testsuite/ld-scripts/data.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/data.d,v
retrieving revision 1.2
diff -u -p -r1.2 data.d
--- ld/testsuite/ld-scripts/data.d 23 Feb 2004 09:24:46 -0000 1.2
+++ ld/testsuite/ld-scripts/data.d 7 Apr 2004 16:35:45 -0000
@@ -5,5 +5,5 @@
.*: file format .*
Contents of section .text:
- 1000 (0410)?0000(1004)? (0020)?0000(2000)? .*
+ [0-9a-f]* (04)?000000(04)? (0020)?0000(2000)? .*
#pass
Index: ld/testsuite/ld-scripts/data.s
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/data.s,v
retrieving revision 1.1
diff -u -p -r1.1 data.s
--- ld/testsuite/ld-scripts/data.s 19 Feb 2004 14:08:31 -0000 1.1
+++ ld/testsuite/ld-scripts/data.s 7 Apr 2004 16:35:45 -0000
@@ -1 +0,0 @@
-#nothing here
Index: ld/testsuite/ld-scripts/data.t
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/data.t,v
retrieving revision 1.2
diff -u -p -r1.2 data.t
--- ld/testsuite/ld-scripts/data.t 23 Feb 2004 09:24:46 -0000 1.2
+++ ld/testsuite/ld-scripts/data.t 7 Apr 2004 16:35:45 -0000
@@ -1,8 +1,9 @@
SECTIONS
{
- .text 0x1000 :
+ . = 0x1000 + SIZEOF_HEADERS;
+ .text ALIGN (0x20) :
{
- LONG (label)
+ LONG (label - .)
label = .;
LONG (ADDR (.other))
}
Index: ld/testsuite/ld-scripts/defined2.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/defined2.d,v
retrieving revision 1.1
diff -u -p -r1.1 defined2.d
--- ld/testsuite/ld-scripts/defined2.d 8 Oct 2003 12:35:18 -0000 1.1
+++ ld/testsuite/ld-scripts/defined2.d 7 Apr 2004 16:35:45 -0000
@@ -10,8 +10,11 @@
#...
0+1 [AT] defined1
+#...
0+11 A defined2
+#...
0+100 A defined3
+#...
0+1ff A defined4
#...
0+3 T sym1
Index: ld/testsuite/ld-scripts/defined3.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/defined3.d,v
retrieving revision 1.1
diff -u -p -r1.1 defined3.d
--- ld/testsuite/ld-scripts/defined3.d 11 Oct 2003 09:18:58 -0000 1.1
+++ ld/testsuite/ld-scripts/defined3.d 7 Apr 2004 16:35:45 -0000
@@ -11,15 +11,24 @@
#...
0+1 [AT] defined
+#...
0+200 A defined1
+#...
0+201 A defined2
+#...
0+100 A defined3
+#...
0+ [AT] defined4
+#...
0+2a A defined5
+#...
0+ [AT] defined6
+#...
0+1 [AT] defined7
+#...
0+1 [AT] defined8
#...
0+2a A sym1
+#...
[0-9a-f]+ T sym2
#pass
Index: ld/testsuite/ld-scripts/provide-1.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/provide-1.d,v
retrieving revision 1.1
diff -u -p -r1.1 provide-1.d
--- ld/testsuite/ld-scripts/provide-1.d 23 Feb 2004 10:10:02 -0000 1.1
+++ ld/testsuite/ld-scripts/provide-1.d 7 Apr 2004 16:35:45 -0000
@@ -5,4 +5,5 @@
.*: file format .*
Contents of section .data:
- 0000 (08)?000000(08)? (0c)?000000(0c)? 00000000 ............
+ [0-9a-f]* (1020)?0000(2010)? (2020)?0000(2020)? 00000000 .*
+#pass
Index: ld/testsuite/ld-scripts/provide-1.s
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/provide-1.s,v
retrieving revision 1.1
diff -u -p -r1.1 provide-1.s
--- ld/testsuite/ld-scripts/provide-1.s 23 Feb 2004 10:10:02 -0000 1.1
+++ ld/testsuite/ld-scripts/provide-1.s 7 Apr 2004 16:35:45 -0000
@@ -1,3 +1,4 @@
.data
.globl foo
foo: .long 0
+ .p2align 4
Index: ld/testsuite/ld-scripts/provide-1.t
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/provide-1.t,v
retrieving revision 1.1
diff -u -p -r1.1 provide-1.t
--- ld/testsuite/ld-scripts/provide-1.t 23 Feb 2004 10:10:02 -0000 1.1
+++ ld/testsuite/ld-scripts/provide-1.t 7 Apr 2004 16:35:45 -0000
@@ -1,9 +1,10 @@
SECTIONS
{
- .data :
+ .data 0x2000 :
{
LONG (foo)
LONG (bar)
+ . = ALIGN (0x10);
*(.data)
}
PROVIDE (foo = .);
Index: ld/testsuite/ld-scripts/provide-2.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/provide-2.d,v
retrieving revision 1.2
diff -u -p -r1.2 provide-2.d
--- ld/testsuite/ld-scripts/provide-2.d 19 Mar 2004 07:14:44 -0000 1.2
+++ ld/testsuite/ld-scripts/provide-2.d 7 Apr 2004 16:35:45 -0000
@@ -4,4 +4,4 @@
#...
0+3 A baz
0+0 D foo
-
+#pass
Index: ld/testsuite/ld-scripts/provide-2.s
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/provide-2.s,v
retrieving revision 1.1
diff -u -p -r1.1 provide-2.s
--- ld/testsuite/ld-scripts/provide-2.s 23 Feb 2004 10:10:02 -0000 1.1
+++ ld/testsuite/ld-scripts/provide-2.s 7 Apr 2004 16:35:45 -0000
@@ -4,3 +4,5 @@ foo: .long 0
.globl baz
.long baz
+
+ .p2align 4
Index: ld/testsuite/ld-scripts/provide-3.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/provide-3.d,v
retrieving revision 1.1
diff -u -p -r1.1 provide-3.d
--- ld/testsuite/ld-scripts/provide-3.d 23 Feb 2004 10:10:02 -0000 1.1
+++ ld/testsuite/ld-scripts/provide-3.d 7 Apr 2004 16:35:45 -0000
@@ -1,3 +1,3 @@
-#source: provide-2.s
-#ld: -T provide-2.t
+#source: provide-3.s
+#ld: -T provide-3.t
#error: symbol defined in linker script and object file
Index: ld/testsuite/ld-scripts/provide-3.s
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/provide-3.s,v
retrieving revision 1.1
diff -u -p -r1.1 provide-3.s
--- ld/testsuite/ld-scripts/provide-3.s 23 Feb 2004 10:10:02 -0000 1.1
+++ ld/testsuite/ld-scripts/provide-3.s 7 Apr 2004 16:35:45 -0000
@@ -1,3 +1,4 @@
.data
.globl foo
foo: .long 0
+ .p2align 4
Index: ld/testsuite/ld-scripts/provide.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/provide.exp,v
retrieving revision 1.1
diff -u -p -r1.1 provide.exp
--- ld/testsuite/ld-scripts/provide.exp 23 Feb 2004 10:10:02 -0000 1.1
+++ ld/testsuite/ld-scripts/provide.exp 7 Apr 2004 16:35:45 -0000
@@ -17,6 +17,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+if { [istarget "rs6000-*-aix*"] } {
+ # Target maps .text and .data to other sections.
+ return
+}
+
set testname "provide"
run_dump_test provide-1
Index: ld/testsuite/ld-scripts/size-1.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/size-1.d,v
retrieving revision 1.2
diff -u -p -r1.2 size-1.d
--- ld/testsuite/ld-scripts/size-1.d 5 Mar 2004 19:27:34 -0000 1.2
+++ ld/testsuite/ld-scripts/size-1.d 7 Apr 2004 16:35:45 -0000
@@ -6,16 +6,9 @@
#...
Contents of section \.text:
- 0+00 (01)?000000(01)? (02)?000000(02)? ........
+ [0-9a-f]* (01)?000000(01)? (02)?000000(02)? .*
#...
Contents of section \.data:
- 0+08 (03)?000000(03)? (04)?000000(04)? (05)?000000(05)? ............
-#...
-Contents of section \.tdata:
- 0+24 (06)?000000(06)? (07)?000000(07)? (08)?000000(08)? (09)?000000(09)? ................
- 0+34 (0a)?000000(0a)? ....
-#...
-Contents of section \.map:
- 0+38 (08)?000000(08)? (0c)?000000(0c)? (10)?000000(10)? (14)?000000(14)? ................
- 0+48 (18)?000000(18)? ....
-#...
+ [0-9a-f]* (03)?000000(03)? (04)?000000(04)? (05)?000000(05)? 00000000 .*
+ [0-9a-f]* (20)?000000(20)? (18)?000000(18)? .*
+#pass
Index: ld/testsuite/ld-scripts/size-1.s
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/size-1.s,v
retrieving revision 1.1
diff -u -p -r1.1 size-1.s
--- ld/testsuite/ld-scripts/size-1.s 5 Mar 2004 11:26:05 -0000 1.1
+++ ld/testsuite/ld-scripts/size-1.s 7 Apr 2004 16:35:45 -0000
@@ -1,15 +1,7 @@
- .section .text,"ax",@progbits
+ .text
.long 1,2
+ .p2align 5
- .section .data,"aw",@progbits
+ .data
.long 3,4,5
-
- .section .bss,"aw",@nobits
- .long 0,0,0,0
-
- # thread local storage sections
- .section .tdata,"awT",@progbits
- .long 6,7,8,9,10
-
- .section .tbss,"awT",@nobits
- .long 0,0,0,0,0,0
+ .p2align 4
Index: ld/testsuite/ld-scripts/size-1.t
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/size-1.t,v
retrieving revision 1.1
diff -u -p -r1.1 size-1.t
--- ld/testsuite/ld-scripts/size-1.t 5 Mar 2004 11:26:05 -0000 1.1
+++ ld/testsuite/ld-scripts/size-1.t 7 Apr 2004 16:35:45 -0000
@@ -1,15 +1,10 @@
SECTIONS
{
- .text : { *(.text) }
- .data : { *(.data) }
- .bss : { *(.bss) }
- .tdata : { *(.tdata) }
- .tbss : { *(.tbss) }
- .map : {
+ . = 0x1000 + SIZEOF_HEADERS;
+ .text ALIGN (0x20) : { *(.text) }
+ .data 0x2000 : {
+ *(.data)
LONG (SIZEOF (.text))
LONG (SIZEOF (.data))
- LONG (SIZEOF (.bss))
- LONG (SIZEOF (.tdata))
- LONG (SIZEOF (.tbss))
}
}
Index: ld/testsuite/ld-scripts/size-2.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/size-2.d,v
retrieving revision 1.2
diff -u -p -r1.2 size-2.d
--- ld/testsuite/ld-scripts/size-2.d 5 Mar 2004 19:27:34 -0000 1.2
+++ ld/testsuite/ld-scripts/size-2.d 7 Apr 2004 16:35:45 -0000
@@ -4,13 +4,13 @@
#...
Program Headers:
- Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
- PHDR 0x[0-9a-f]+ 0x0+0000 0x0+0000 0x[0-9a-f]+ 0x[0-9a-f]+ R 0x[0-9a-f]+
- LOAD 0x[0-9a-f]+ 0x0+0000 0x0+0000 0x0+0030 0x0+0030 R 0x[0-9a-f]+
- TLS 0x[0-9a-f]+ 0x0+0008 0x0+0008 0x0+0014 0x0+002c R 0x[0-9a-f]+
+ +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg +Align
+ +PHDR +0x[0-9a-f]+ 0x0+0000 0x0+0000 0x[0-9a-f]+ 0x[0-9a-f]+ R +0x[0-9a-f]+
+ +LOAD +0x[0-9a-f]+ 0x0+0000 0x0+0000 0x0+0030 0x0+0030 R +0x[0-9a-f]+
+ +TLS +0x[0-9a-f]+ 0x0+0008 0x0+0008 0x0+0014 0x0+002c R +0x[0-9a-f]+
Section to Segment mapping:
- Segment Sections...
- 00 \.text \.tdata \.tbss \.map
- 01 \.text \.tdata \.map
- 02 \.tdata \.tbss \.map
+ +Segment Sections...
+ +00 +\.text \.tdata \.tbss \.map
+ +01 +\.text \.tdata \.map
+ +02 +\.tdata \.tbss \.map
Index: ld/testsuite/ld-scripts/size.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/size.exp,v
retrieving revision 1.1
diff -u -p -r1.1 size.exp
--- ld/testsuite/ld-scripts/size.exp 5 Mar 2004 11:26:05 -0000 1.1
+++ ld/testsuite/ld-scripts/size.exp 7 Apr 2004 16:35:45 -0000
@@ -16,8 +16,15 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
+if { [istarget "rs6000-*-aix*"] } {
+ # Target maps .text and .data to other sections.
+ return
+}
+
run_dump_test size-1
-if { [istarget "*-*-elf*"] } {
- run_dump_test size-2
+if ![is_elf_format] {
+ return
}
+
+run_dump_test size-2
--
Alan Modra
IBM OzLabs - Linux Technology Centre