* ld-elf/header.d: Allow arbitrary lines between "Program Header"
[binutils.git] / ld / testsuite / ld-elf / tls_common.exp
blob512689f167be4c8da092a76bf09c2fe8e44d8738
1 # Expect script for .tls_common tests
2 # Copyright 2006 Free Software Foundation, Inc.
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.
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.
18 # Written by Jakub Jelinek (jakub@redhat.com)
21 # Make sure that binutils can correctly handle ld output in ELF.
23 # Run on Linux only.
24 if { ![istarget *-*-linux*] } {
25 return
28 if { [istarget *-*-linux*aout*]
29 || [istarget *-*-linux*oldld*] } {
30 return
33 global as
34 global ld
35 global READELF
36 global srcdir
37 global subdir
38 global link_output
40 if { ![ld_assemble $as $srcdir/$subdir/tls_common.s tmpdir/tls_common.o ] } {
41 unresolved "tls_common"
42 return
45 if { ![ld_simple_link $ld tmpdir/tls_common1.o "-r tmpdir/tls_common.o"] } {
46 fail "tls_common"
47 return
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"
59 return
62 send_log "$READELF -l --wide tmpdir/tls_common\n"
63 catch "exec $READELF -l --wide tmpdir/tls_common" readelf_output
64 if ![regexp ".*TLS.*0x0+ 0x0+4 R .*" $readelf_output] then {
65 send_log "$readelf_output\n"
66 fail "tls_common"
67 return
70 pass "tls_common"