[ARM] FDPIC: Implement Thumb-only PLT for FDPIC.
[deliverable/binutils-gdb.git] / ld / testsuite / ld-elf / tls_common.exp
1 # Expect script for .tls_common tests
2 # Copyright (C) 2006-2018 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 global as
33 global ld
34 global READELF
35 global srcdir
36 global subdir
37 global link_output
38
39 if { ![ld_assemble $as "--elf-stt-common=no $srcdir/$subdir/tls_common.s" tmpdir/tls_commona.o]
40 || ![ld_assemble $as "--elf-stt-common=yes $srcdir/$subdir/tls_common.s" tmpdir/tls_commonb.o] } {
41 unresolved "tls_common"
42 return
43 }
44
45 if { ![ld_link $ld tmpdir/tls_common1a.o "-r tmpdir/tls_commona.o"]
46 || ![ld_link $ld tmpdir/tls_common1b.o "-r tmpdir/tls_commona.o"] } {
47 fail "tls_common"
48 return
49 }
50
51 if { ![ld_link $ld tmpdir/tls_commona "tmpdir/tls_common1a.o"] } {
52 if { [string match "*not supported*" $link_output]
53 || [string match "*unrecognized option*" $link_output] } {
54 unsupported "$ld_options is not supported by this target"
55 } elseif { [string match "*warning*alignment*of common symbol*" $link_output] } {
56 fail "tls_common"
57 } else {
58 unresolved "tls_common"
59 }
60 return
61 }
62
63 if { ![ld_link $ld tmpdir/tls_commonb "tmpdir/tls_common1b.o"] } {
64 if { [string match "*not supported*" $link_output]
65 || [string match "*unrecognized option*" $link_output] } {
66 unsupported "$ld_options is not supported by this target"
67 } elseif { [string match "*warning*alignment*of common symbol*" $link_output] } {
68 fail "tls_common"
69 } else {
70 unresolved "tls_common"
71 }
72 return
73 }
74
75 set readelf_output [run_host_cmd "$READELF" "-l --wide tmpdir/tls_commona"]
76 if ![regexp ".*TLS.*0x0+ 0x0+4 R .*" $readelf_output] then {
77 send_log "$readelf_output\n"
78 fail "tls_common"
79 return
80 }
81
82 set readelf_output [run_host_cmd "$READELF" "-l --wide tmpdir/tls_commona"]
83 if ![regexp ".*TLS.*0x0+ 0x0+4 R .*" $readelf_output] then {
84 send_log "$readelf_output\n"
85 fail "tls_common"
86 return
87 }
88
89 pass "tls_common"
This page took 0.037882 seconds and 4 git commands to generate.