tcl global directive outside proc body does nothing (ld)
[deliverable/binutils-gdb.git] / ld / testsuite / ld-elf / tls_common.exp
CommitLineData
6a4a0940 1# Expect script for .tls_common tests
b3adc24a 2# Copyright (C) 2006-2020 Free Software Foundation, Inc.
6a4a0940 3#
f96b4a7b
NC
4# This file is part of the GNU Binutils.
5#
6# This program is free software; you can redistribute it and/or modify
6a4a0940 7# it under the terms of the GNU General Public License as published by
f96b4a7b 8# the Free Software Foundation; either version 3 of the License, or
6a4a0940 9# (at your option) any later version.
f96b4a7b 10#
6a4a0940
JJ
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.
f96b4a7b 15#
6a4a0940
JJ
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
f96b4a7b
NC
18# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19# MA 02110-1301, USA.
6a4a0940
JJ
20#
21# Written by Jakub Jelinek (jakub@redhat.com)
22#
23
24# Make sure that binutils can correctly handle ld output in ELF.
25
5940a93c 26if { ![istarget *-*-linux*]
f1ac0afe 27 && ![istarget arm*-*-uclinuxfdpiceabi]
5a68afcf 28 && ![istarget *-*-nacl*]
5940a93c 29 && ![istarget *-*-gnu*] } {
6a4a0940
JJ
30 return
31}
32
b8871f35
L
33if { ![ld_assemble $as "--elf-stt-common=no $srcdir/$subdir/tls_common.s" tmpdir/tls_commona.o]
34 || ![ld_assemble $as "--elf-stt-common=yes $srcdir/$subdir/tls_common.s" tmpdir/tls_commonb.o] } {
6a4a0940
JJ
35 unresolved "tls_common"
36 return
37}
38
d9816402
AM
39if { ![ld_link $ld tmpdir/tls_common1a.o "-r tmpdir/tls_commona.o"]
40 || ![ld_link $ld tmpdir/tls_common1b.o "-r tmpdir/tls_commona.o"] } {
6a4a0940
JJ
41 fail "tls_common"
42 return
43}
44
d9816402 45if { ![ld_link $ld tmpdir/tls_commona "tmpdir/tls_common1a.o"] } {
6a4a0940
JJ
46 if { [string match "*not supported*" $link_output]
47 || [string match "*unrecognized option*" $link_output] } {
48 unsupported "$ld_options is not supported by this target"
9793eb77 49 } elseif { [string match "*warning*alignment*of common symbol*" $link_output] } {
6a4a0940
JJ
50 fail "tls_common"
51 } else {
52 unresolved "tls_common"
53 }
54 return
5a68afcf 55}
6a4a0940 56
d9816402 57if { ![ld_link $ld tmpdir/tls_commonb "tmpdir/tls_common1b.o"] } {
b8871f35
L
58 if { [string match "*not supported*" $link_output]
59 || [string match "*unrecognized option*" $link_output] } {
60 unsupported "$ld_options is not supported by this target"
9793eb77 61 } elseif { [string match "*warning*alignment*of common symbol*" $link_output] } {
b8871f35
L
62 fail "tls_common"
63 } else {
64 unresolved "tls_common"
65 }
66 return
67}
68
69set readelf_output [run_host_cmd "$READELF" "-l --wide tmpdir/tls_commona"]
70if ![regexp ".*TLS.*0x0+ 0x0+4 R .*" $readelf_output] then {
71 send_log "$readelf_output\n"
72 fail "tls_common"
73 return
74}
75
76set readelf_output [run_host_cmd "$READELF" "-l --wide tmpdir/tls_commona"]
c219a7a5 77if ![regexp ".*TLS.*0x0+ 0x0+4 R .*" $readelf_output] then {
6a4a0940
JJ
78 send_log "$readelf_output\n"
79 fail "tls_common"
80 return
81}
82
83pass "tls_common"
This page took 0.658445 seconds and 4 git commands to generate.