Commit | Line | Data |
---|---|---|
6a4a0940 JJ |
1 | # Expect script for .tls_common tests |
2 | # Copyright 2006 Free Software Foundation, Inc. | |
3 | # | |
4 | # This file is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
6 | # the Free Software Foundation; either version 2 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. | |
17 | # | |
18 | # Written by Jakub Jelinek (jakub@redhat.com) | |
19 | # | |
20 | ||
21 | # Make sure that binutils can correctly handle ld output in ELF. | |
22 | ||
23 | # Run on Linux only. | |
24 | if { ![istarget *-*-linux*] } { | |
25 | return | |
26 | } | |
27 | ||
28 | if { [istarget *-*-linux*aout*] | |
29 | || [istarget *-*-linux*oldld*] } { | |
30 | return | |
31 | } | |
32 | ||
33 | global as | |
34 | global ld | |
35 | global READELF | |
36 | global srcdir | |
37 | global subdir | |
38 | global link_output | |
39 | ||
40 | if { ![ld_assemble $as $srcdir/$subdir/tls_common.s tmpdir/tls_common.o ] } { | |
41 | unresolved "tls_common" | |
42 | return | |
43 | } | |
44 | ||
45 | if { ![ld_simple_link $ld tmpdir/tls_common1.o "-r tmpdir/tls_common.o"] } { | |
46 | fail "tls_common" | |
47 | return | |
48 | } | |
49 | ||
50 | if { ![ld_simple_link $ld tmpdir/tls_common "tmpdir/tls_common1.o"] } { | |
51 | if { [string match "*not supported*" $link_output] | |
52 | || [string match "*unrecognized option*" $link_output] } { | |
53 | unsupported "$ld_options is not supported by this target" | |
54 | } elseif { [string match "*Warning*alignment*of common symbol*" $link_output] } { | |
55 | fail "tls_common" | |
56 | } else { | |
57 | unresolved "tls_common" | |
58 | } | |
59 | return | |
60 | } | |
61 | ||
62 | send_log "$READELF -l --wide tmpdir/tls_common\n" | |
63 | catch "exec $READELF -l --wide tmpdir/tls_common" readelf_output | |
c219a7a5 | 64 | if ![regexp ".*TLS.*0x0+ 0x0+4 R .*" $readelf_output] then { |
6a4a0940 JJ |
65 | send_log "$readelf_output\n" |
66 | fail "tls_common" | |
67 | return | |
68 | } | |
69 | ||
70 | pass "tls_common" |