Move ld-scripts size tests

Alan Modra amodra@gmail.com
Tue Jul 23 08:29:00 GMT 2019


Also restore them somewhat closer to the original.  They originally
failed on many targets, and a month later I "simplified" them as part
of a larger patch fixing other failing tests.  That unfortunately lost
their main purpose, which was to test TLS layout.

	* testsuite/ld-elf/size-1.d,
	* testsuite/ld-elf/size-1.s,
	* testsuite/ld-elf/size-1.t: New test.
	* testsuite/ld-elf/size-2.d,
	* testsuite/ld-elf/size-2.s,
	* testsuite/ld-elf/size-2.t: New test.
	* testsuite/ld-scripts/size-1.d,
	* testsuite/ld-scripts/size-1.s,
	* testsuite/ld-scripts/size-1.t,
	* testsuite/ld-scripts/size-2.s,
	* testsuite/ld-scripts/size-2.d,
	* testsuite/ld-scripts/size-2.t,
	* testsuite/ld-scripts/size.exp: Delete.

diff --git a/ld/testsuite/ld-elf/size-1.d b/ld/testsuite/ld-elf/size-1.d
new file mode 100644
index 0000000000..a6f9f4f644
--- /dev/null
+++ b/ld/testsuite/ld-elf/size-1.d
@@ -0,0 +1,26 @@
+#source: size-1.s
+#ld: -T size-1.t
+#objdump: -s
+# v850 .tdata/.tbss are not TLS sections
+#xfail: v850*-*-*
+
+.*:     file format .*
+
+#...
+Contents of section \.text:
+ 0+00 (01)?000000(01)? (02)?000000(02)? (03)?000000(03)? (04)?000000(04)?  .*
+#...
+Contents of section \.data:
+ 0+10 (05)?000000(05)? (06)?000000(06)? (07)?000000(07)? (08)?000000(08)?  .*
+ 0+20 (09)?000000(09)? (0a)?000000(0a)? (0b)?000000(0b)? (0c)?000000(0c)?  .*
+#...
+Contents of section \.tdata:
+ 0+60 (0d)?000000(0d)? (0e)?000000(0e)? (0f)?000000(0f)? (10)?000000(10)?  .*
+ 0+70 (11)?000000(11)? (12)?000000(12)? (13)?000000(13)? (14)?000000(14)?  .*
+ 0+80 (15)?000000(15)? (16)?000000(16)? (17)?000000(17)? (18)?000000(18)?  .*
+ 0+90 (19)?000000(19)? (1a)?000000(1a)? (1b)?000000(1b)? (1c)?000000(1c)?  .*
+#...
+Contents of section \.map:
+ 0+a0 (10)?000000(10)? (20)?000000(20)? (30)?000000(30)? (40)?000000(40)?  .*
+ 0+b0 (50)?000000(50)?                             .*
+#...
diff --git a/ld/testsuite/ld-elf/size-1.s b/ld/testsuite/ld-elf/size-1.s
new file mode 100644
index 0000000000..d7bd77fc19
--- /dev/null
+++ b/ld/testsuite/ld-elf/size-1.s
@@ -0,0 +1,15 @@
+	.text
+	.long 1,2,3,4
+
+	.data
+	.long 5,6,7,8,9,10,11,12
+
+	.section .bss
+	.long 0,0,0,0,0,0,0,0,0,0,0,0
+
+	# thread local storage sections
+	.section .tdata
+	.long 13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
+
+	.section .tbss
+	.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
diff --git a/ld/testsuite/ld-elf/size-1.t b/ld/testsuite/ld-elf/size-1.t
new file mode 100644
index 0000000000..4f1ebf9597
--- /dev/null
+++ b/ld/testsuite/ld-elf/size-1.t
@@ -0,0 +1,16 @@
+SECTIONS
+{
+  .text : { *(.text) }
+  .data : { *(.data) }
+  .bss : { *(.bss) }
+  .tdata : { *(.tdata) }
+  .tbss : { *(.tbss) }
+  .map : {
+    LONG (SIZEOF (.text))
+    LONG (SIZEOF (.data))
+    LONG (SIZEOF (.bss))
+    LONG (SIZEOF (.tdata))
+    LONG (SIZEOF (.tbss))
+  }
+  /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-elf/size-2.d b/ld/testsuite/ld-elf/size-2.d
new file mode 100644
index 0000000000..14202245e6
--- /dev/null
+++ b/ld/testsuite/ld-elf/size-2.d
@@ -0,0 +1,21 @@
+#source: size-2.s
+#ld: -T size-2.t
+#readelf: -lS --wide
+# v850 .tdata/.tbss are not TLS sections
+#xfail: v850*-*-*
+# The three alternatives for PHDR and LOAD are: 64-bit, 32-bit, 32-bit
+# not demand paged.  32-bit LOAD has a variant for spu-elf, which rounds
+# load size up to multiples of 16 bytes.
+
+#...
+.* \.text +PROGBITS +0+100 [0-9a-f]+ 0+10 00  AX .*
+.* \.tdata +PROGBITS +0+110 [0-9a-f]+ 0+20 00 WAT .*
+.* \.tbss +NOBITS +0+130 [0-9a-f]+ 0+30 00 WAT .*
+.* \.map +PROGBITS +0+130 [0-9a-f]+ 0+c 00 +WA .*
+#...
+ +PHDR +(0x0+40 0x0+40 0x0+40 0x0+a8 0x0+a8|0x0+34 0x0+34 0x0+34 0x0+60 0x0+60|0x0+34 0x0+a0 0x0+a0 0x0+60 0x0+60) R .*
+ +LOAD +(0x0+40 0x0+40 0x0+40 0x0+fc 0x0+fc|0x0+34 0x0+34 0x0+34 0x0+1(08|10) 0x0+1(08|10)|0x0+34 0x0+a0 0x0+a0 0x0+9c 0x0+9c) R E .*
+ +TLS +0x0+(110|a4) 0x0+110 0x0+110 0x0+20 0x0+50 R .*
+#...
+.* \.text \.tdata \.map 
+.* \.tdata \.tbss 
diff --git a/ld/testsuite/ld-elf/size-2.s b/ld/testsuite/ld-elf/size-2.s
new file mode 100644
index 0000000000..310efde2b2
--- /dev/null
+++ b/ld/testsuite/ld-elf/size-2.s
@@ -0,0 +1,9 @@
+	.text
+	.long 1,2,3,4
+
+	# thread local storage sections
+	.section .tdata
+	.long 5,6,7,8,9,10,11,12
+
+	.section .tbss
+	.long 0,0,0,0,0,0,0,0,0,0,0,0
diff --git a/ld/testsuite/ld-scripts/size-2.t b/ld/testsuite/ld-elf/size-2.t
similarity index 77%
rename from ld/testsuite/ld-scripts/size-2.t
rename to ld/testsuite/ld-elf/size-2.t
index c3c4eddab4..f29c26cd25 100644
--- a/ld/testsuite/ld-scripts/size-2.t
+++ b/ld/testsuite/ld-elf/size-2.t
@@ -13,10 +13,8 @@ SECTIONS
   .tbss : { *(.tbss) } :image : tls
   .map : {
     LONG (SIZEOF (.text))
-    LONG (SIZEOF (.data))
-    LONG (SIZEOF (.bss))
     LONG (SIZEOF (.tdata))
     LONG (SIZEOF (.tbss))
   } :image
-  /DISCARD/ : { *(.note.gnu.property) }
+  /DISCARD/ : { *(*) }
 }
diff --git a/ld/testsuite/ld-scripts/size-1.d b/ld/testsuite/ld-scripts/size-1.d
deleted file mode 100644
index 641fbcaefa..0000000000
--- a/ld/testsuite/ld-scripts/size-1.d
+++ /dev/null
@@ -1,14 +0,0 @@
-#source: size-1.s
-#ld: -T size-1.t
-#objdump: -s
-
-.*:     file format .*
-
-#...
-Contents of section \.text:
- [0-9a-f]* (01)?000000(01)? (02)?000000(02)? .*
-#...
-Contents of section \.data:
- [0-9a-f]* (03)?000000(03)? (04)?000000(04)? (05)?000000(05)? 00000000 .*
- [0-9a-f]* (20)?000000(20)? (18)?000000(18)? .*
-#pass
diff --git a/ld/testsuite/ld-scripts/size-1.s b/ld/testsuite/ld-scripts/size-1.s
deleted file mode 100644
index 7f5a5fd498..0000000000
--- a/ld/testsuite/ld-scripts/size-1.s
+++ /dev/null
@@ -1,7 +0,0 @@
-	.text
-	.long 1,2
-	.p2align 5
-
-	.data
-	.long 3,4,5
-	.p2align 4
diff --git a/ld/testsuite/ld-scripts/size-1.t b/ld/testsuite/ld-scripts/size-1.t
deleted file mode 100644
index bb486656c3..0000000000
--- a/ld/testsuite/ld-scripts/size-1.t
+++ /dev/null
@@ -1,10 +0,0 @@
-SECTIONS
-{
-  . = 0x1000 + SIZEOF_HEADERS;
-  .text ALIGN (0x20) : { *(.text) }
-  .data 0x2000 : {
-    *(.data)
-    LONG (SIZEOF (.text))
-    LONG (SIZEOF (.data))
-  }
-}
diff --git a/ld/testsuite/ld-scripts/size-2.d b/ld/testsuite/ld-scripts/size-2.d
deleted file mode 100644
index e89bd5aeda..0000000000
--- a/ld/testsuite/ld-scripts/size-2.d
+++ /dev/null
@@ -1,18 +0,0 @@
-#source: size-2.s
-#ld: -T size-2.t
-#readelf: -l --wide
-#xfail: "v850*-*-*"
-
-#...
-Program Headers:
- +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg +Align
- +PHDR +0x[0-9a-f]+ 0x0+00.. 0x0+00.. 0x[0-9a-f]+ 0x[0-9a-f]+ R +0x[0-9a-f]+
-#...
- +LOAD +0x[0-9a-f]+ 0x0+0... 0x0+0... 0x0+0... 0x0+0... R E +0x[0-9a-f]+
- +TLS +0x[0-9a-f]+ 0x0+0108 0x0+0108 0x0+0014 0x0+002c R +0x[0-9a-f]+
-
- Section to Segment mapping:
- +Segment Sections\.\.\.
- +00 .*
- +01.*\.text.*\.tdata.*
- +02.*\.tdata.*
diff --git a/ld/testsuite/ld-scripts/size-2.s b/ld/testsuite/ld-scripts/size-2.s
deleted file mode 100644
index 6b10250e88..0000000000
--- a/ld/testsuite/ld-scripts/size-2.s
+++ /dev/null
@@ -1,8 +0,0 @@
-	.text
-	.long 1,2
-
-	.section .tdata
-	.long 6,7,8,9,10
-	
-	.section .tbss
-	.long 0,0,0,0,0,0
diff --git a/ld/testsuite/ld-scripts/size.exp b/ld/testsuite/ld-scripts/size.exp
deleted file mode 100644
index 8da9dbdcf3..0000000000
--- a/ld/testsuite/ld-scripts/size.exp
+++ /dev/null
@@ -1,41 +0,0 @@
-# Expect script for SIZEOF tests
-#   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-#
-# This file is part of the GNU Binutils.
-#
-# This program 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
-# MA 02110-1301, USA.
-#
-
-# AIX maps .text and .data to other sections.
-# a.out objdump displays the file header inside the text segment,
-# confusing run_dump_test.
-
-if {[istarget "powerpc*-*-aix*"] || [istarget "rs6000-*-aix*"] || [is_aout_format]} {
-    unsupported size-1
-    unsupported size-2
-    return
-}
-
-run_dump_test size-1
-
-# size-2 only works on ELF targets.
-# MIPS inserts a REGINFO PHDR
-if {![is_elf_format] || [istarget "mips*-*-*"]} {
-    unsupported size-2
-    return
-}
-
-run_dump_test size-2

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list