From ec49711a16785636a5b9eac3a92bd00382fcb1a9 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 23 Jul 2019 17:45:25 +0930 Subject: [PATCH] Move ld-scripts size tests 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. --- ld/ChangeLog | 16 +++++++++++ ld/testsuite/ld-elf/size-1.d | 26 ++++++++++++++++++ ld/testsuite/ld-elf/size-1.s | 15 ++++++++++ ld/testsuite/ld-elf/size-1.t | 16 +++++++++++ ld/testsuite/ld-elf/size-2.d | 21 ++++++++++++++ ld/testsuite/ld-elf/size-2.s | 9 ++++++ ld/testsuite/{ld-scripts => ld-elf}/size-2.t | 4 +-- ld/testsuite/ld-scripts/size-1.d | 14 ---------- ld/testsuite/ld-scripts/size-1.s | 7 ----- ld/testsuite/ld-scripts/size-1.t | 10 ------- ld/testsuite/ld-scripts/size-2.d | 18 ------------ ld/testsuite/ld-scripts/size-2.s | 8 ------ ld/testsuite/ld-scripts/size.exp | 41 ---------------------------- 13 files changed, 104 insertions(+), 101 deletions(-) create mode 100644 ld/testsuite/ld-elf/size-1.d create mode 100644 ld/testsuite/ld-elf/size-1.s create mode 100644 ld/testsuite/ld-elf/size-1.t create mode 100644 ld/testsuite/ld-elf/size-2.d create mode 100644 ld/testsuite/ld-elf/size-2.s rename ld/testsuite/{ld-scripts => ld-elf}/size-2.t (77%) delete mode 100644 ld/testsuite/ld-scripts/size-1.d delete mode 100644 ld/testsuite/ld-scripts/size-1.s delete mode 100644 ld/testsuite/ld-scripts/size-1.t delete mode 100644 ld/testsuite/ld-scripts/size-2.d delete mode 100644 ld/testsuite/ld-scripts/size-2.s delete mode 100644 ld/testsuite/ld-scripts/size.exp diff --git a/ld/ChangeLog b/ld/ChangeLog index 08a84ef..fd13791 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,19 @@ +2019-07-23 Alan Modra + + * 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. + 2019-07-22 Srinath Parvathaneni * ld/testsuite/ld-arm/cmse_main_sec_debug.d: Modify regexps to diff --git a/ld/testsuite/ld-elf/size-1.d b/ld/testsuite/ld-elf/size-1.d new file mode 100644 index 0000000..a6f9f4f --- /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 0000000..d7bd77f --- /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 0000000..4f1ebf9 --- /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 0000000..1420224 --- /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 0000000..310efde --- /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 c3c4edd..f29c26c 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 641fbca..0000000 --- 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 7f5a5fd..0000000 --- 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 bb48665..0000000 --- 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 e89bd5a..0000000 --- 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 6b10250..0000000 --- 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 8da9dbd..0000000 --- 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 -- 2.7.4