bfd/
[deliverable/binutils-gdb.git] / ld / testsuite / ld-elf / tls_common.exp
1 # Expect script for .tls_common tests
2 # Copyright 2006, 2007, 2010, 2012 Free Software Foundation, Inc.
3 #
4 # This file is part of the GNU Binutils.
5 #
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.
10 #
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.
15 #
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,
19 # MA 02110-1301, USA.
20 #
21 # Written by Jakub Jelinek (jakub@redhat.com)
22 #
23
24 # Make sure that binutils can correctly handle ld output in ELF.
25
26 if { ![istarget *-*-linux*]
27 && ![istarget *-*-nacl*]
28 && ![istarget *-*-gnu*] } {
29 return
30 }
31
32 if { [istarget *-*-linux*aout*]
33 || [istarget *-*-linux*oldld*] } {
34 return
35 }
36
37 global as
38 global ld
39 global READELF
40 global srcdir
41 global subdir
42 global link_output
43
44 if { ![ld_assemble $as $srcdir/$subdir/tls_common.s tmpdir/tls_common.o ] } {
45 unresolved "tls_common"
46 return
47 }
48
49 if { ![ld_simple_link $ld tmpdir/tls_common1.o "-r tmpdir/tls_common.o"] } {
50 fail "tls_common"
51 return
52 }
53
54 if { ![ld_simple_link $ld tmpdir/tls_common "tmpdir/tls_common1.o"] } {
55 if { [string match "*not supported*" $link_output]
56 || [string match "*unrecognized option*" $link_output] } {
57 unsupported "$ld_options is not supported by this target"
58 } elseif { [string match "*Warning*alignment*of common symbol*" $link_output] } {
59 fail "tls_common"
60 } else {
61 unresolved "tls_common"
62 }
63 return
64 }
65
66 set readelf_output [run_host_cmd "$READELF" "-l --wide tmpdir/tls_common"]
67 if ![regexp ".*TLS.*0x0+ 0x0+4 R .*" $readelf_output] then {
68 send_log "$readelf_output\n"
69 fail "tls_common"
70 return
71 }
72
73 pass "tls_common"
This page took 0.032214 seconds and 4 git commands to generate.