1 # Expect script
for ld-s390 tests
2 # Copyright
(C
) 2003-2025 Free Software Foundation
, Inc.
4 # This file is part of the GNU Binutils.
6 # This
program is free software
; you can redistribute it and
/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation
; either version
3 of the License
, or
9 #
(at your option
) any later version.
11 # This
program is distributed in the hope that it will be useful
,
12 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License
for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this
program; if not
, write to the Free Software
18 # Foundation
, Inc.
, 51 Franklin Street
- Fifth Floor
, Boston
,
22 # Test s390 linking
; all types of relocs. This tests the assembler and
23 # tools like objdump as well as the linker.
25 if { !([istarget
"s390-*-*"] || [istarget "s390x-*-*"]) } {
29 # List contains test
-items with
3 items followed by
2 lists
:
30 #
0:name 1:ld early options
2:ld late options
3:assembler options
31 #
4:filenames of assembler files
5: action and options.
6: name of output file
34 # objdump
: Apply objdump options
on result. Compare with regex
(last
arg).
35 # nm
: Apply nm options
on result. Compare with regex
(last
arg).
36 # readelf
: Apply readelf options
on result. Compare with regex
(last
arg).
39 {"TLS -fpic -shared transitions" "-shared -melf_s390 --hash-style=sysv" ""
40 "-m31" {tlspic1.s tlspic2.s}
41 {{readelf
-Ssrl tlspic.rd
} {objdump
-dzrj.
text tlspic.dd
}
42 {objdump
-sj.got tlspic.sd
} {objdump
-sj.tdata tlspic.td
}}
44 {"Helper shared library" "-shared -melf_s390" ""
45 "-m31" {tlslib.s} {} "libtlslib.so"}
46 {"TLS -fpic and -fno-pic exec transitions"
47 "-melf_s390 tmpdir/libtlslib.so --hash-style=sysv" ""
48 "-m31" {tlsbinpic.s tlsbin.s}
49 {{readelf
-Ssrl tlsbin.rd
} {objdump
-dzrj.
text tlsbin.dd
}
50 {objdump
-sj.got tlsbin.sd
} {objdump
-sj.tdata tlsbin.td
}}
52 {"GOT: symbol address load from got to larl"
53 "-shared -melf_s390 --hash-style=sysv --version-script=gotreloc-1.ver" ""
55 {{objdump
-dzrj.
text gotreloc_31
-1.dd
}}
57 {"GOT: no-pie symbol address load from got to larl"
58 "-shared -melf_s390 --no-pie --hash-style=sysv --version-script=gotreloc-1.ver" ""
60 {{objdump
-dzrj.
text gotreloc_31
-no
-pie
-1.dd
}}
65 {"TLS -fpic -shared transitions" "-shared -melf64_s390 --hash-style=sysv" ""
66 "-m64 -Aesame" {tlspic1_64.s tlspic2_64.s}
67 {{readelf
-WSsrl tlspic_64.rd
} {objdump
-dzrj.
text tlspic_64.dd
}
68 {objdump
-sj.got tlspic_64.sd
} {objdump
-sj.tdata tlspic_64.td
}}
70 {"Helper shared library" "-shared -melf64_s390" ""
71 "-m64 -Aesame" {tlslib_64.s} {} "libtlslib_64.so"}
72 {"TLS -fpic and -fno-pic exec transitions"
73 "-melf64_s390 tmpdir/libtlslib_64.so --hash-style=sysv" ""
74 "-m64 -Aesame" {tlsbinpic_64.s tlsbin_64.s}
75 {{readelf
-WSsrl tlsbin_64.rd
} {objdump
-dzrj.
text tlsbin_64.dd
}
76 {objdump
-sj.got tlsbin_64.sd
} {objdump
-sj.tdata tlsbin_64.td
}}
78 {"GOT: norelro symbol address load from got to larl"
79 "-shared -melf64_s390 -z norelro --hash-style=sysv --version-script=gotreloc-1.ver" ""
81 {{objdump
-dzrj.
text gotreloc_64
-norelro
-1.dd
}}
83 {"GOT: relro symbol address load from got to larl"
84 "-shared -melf64_s390 -z relro --hash-style=sysv --version-script=gotreloc-1.ver" ""
86 {{objdump
-dzrj.
text gotreloc_64
-relro
-1.dd
}}
88 {"GOT: no-pie symbol address load from got to larl"
89 "-shared -melf64_s390 --no-pie --hash-style=sysv --version-script=gotreloc-1.ver" ""
91 {{objdump
-dzrj.
text gotreloc_64
-no
-pie
-1.dd
}}
94 "-shared -m elf64_s390 -dT pltoffset-1.ld --no-error-rwx-segments" ""
95 "-m64" {pltoffset-1.s}
96 {{objdump
"-dzrj.text --stop-address=16" pltoffset-1.dd}}
98 {"WEAKUNDEF1: overflow test (PC32DBL)"
99 "-m elf64_s390 -dT 8GB.ld --no-error-rwx-segments" "" "-m64" {weakundef-1.s}
100 {{objdump
"-dzrj.text" weakundef-1.dd}} "weakundef-1"}
101 {"WEAKUNDEF2: overflow test (PLT32DBL)"
102 "-m elf64_s390 -dT 8GB.ld --no-error-rwx-segments -no-pie" "" "-m64" {weakundef-2.s}
103 {{objdump
"-dzrj.text" weakundef-2.dd}} "weakundef-2"}
106 if [istarget
"s390-*-*"] {
107 run_ld_link_tests $s390tests
110 if [istarget
"s390x-*-*"] {
111 run_ld_link_tests $s390tests
112 run_ld_link_tests $s390xtests
115 set test_list
[lsort
[glob
-nocomplain $srcdir
/$subdir
/*.d
]]
116 foreach t $test_list
{
117 # We need to
strip the
".d", but can leave the dirname.
118 verbose
[file rootname $t
]
119 run_dump_test
[file rootname $t
]