Commit | Line | Data |
---|---|---|
6a4a0940 | 1 | # Expect script for .tls_common tests |
5940a93c | 2 | # Copyright 2006, 2007, 2010 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 TS |
26 | if { ![istarget *-*-linux*] |
27 | && ![istarget *-*-gnu*] } { | |
6a4a0940 JJ |
28 | return |
29 | } | |
30 | ||
31 | if { [istarget *-*-linux*aout*] | |
32 | || [istarget *-*-linux*oldld*] } { | |
33 | return | |
34 | } | |
35 | ||
36 | global as | |
37 | global ld | |
38 | global READELF | |
39 | global srcdir | |
40 | global subdir | |
41 | global link_output | |
42 | ||
43 | if { ![ld_assemble $as $srcdir/$subdir/tls_common.s tmpdir/tls_common.o ] } { | |
44 | unresolved "tls_common" | |
45 | return | |
46 | } | |
47 | ||
48 | if { ![ld_simple_link $ld tmpdir/tls_common1.o "-r tmpdir/tls_common.o"] } { | |
49 | fail "tls_common" | |
50 | return | |
51 | } | |
52 | ||
53 | if { ![ld_simple_link $ld tmpdir/tls_common "tmpdir/tls_common1.o"] } { | |
54 | if { [string match "*not supported*" $link_output] | |
55 | || [string match "*unrecognized option*" $link_output] } { | |
56 | unsupported "$ld_options is not supported by this target" | |
57 | } elseif { [string match "*Warning*alignment*of common symbol*" $link_output] } { | |
58 | fail "tls_common" | |
59 | } else { | |
60 | unresolved "tls_common" | |
61 | } | |
62 | return | |
63 | } | |
64 | ||
7f6a71ff | 65 | set readelf_output [run_host_cmd "$READELF" "-l --wide tmpdir/tls_common"] |
c219a7a5 | 66 | if ![regexp ".*TLS.*0x0+ 0x0+4 R .*" $readelf_output] then { |
6a4a0940 JJ |
67 | send_log "$readelf_output\n" |
68 | fail "tls_common" | |
69 | return | |
70 | } | |
71 | ||
72 | pass "tls_common" |