]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/testsuite/ld-elf/comm-data.exp
*** empty log message ***
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-elf / comm-data.exp
CommitLineData
74d44110
MR
1# Expect script for common symbol override.
2#
fbe2ec18 3# Copyright 2011, 2012 Free Software Foundation, Inc.
74d44110
MR
4#
5# This file is part of the GNU Binutils.
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20# MA 02110-1301, USA.
21#
22
23#
24# Written by Maciej W. Rozycki <macro@codesourcery.com>
25#
26
27# Exclude non-ELF targets.
28if ![is_elf_format] {
29 return
30}
31
fbe2ec18 32# Exclude some more targets; feel free to include your favorite one
74d44110 33# if you like.
fbe2ec18 34if { ![istarget *-*-linux*]
5a68afcf 35 && ![istarget *-*-nacl*]
fbe2ec18 36 && ![istarget *-*-gnu*] } {
74d44110
MR
37 return
38}
39
40set testname "Common symbol override test"
41
42# Define a global symbol.
43run_ld_link_tests [list \
44 [list \
45 "$testname (auxiliary shared object build)" \
46 "-shared" \
47 "" \
48 { comm-data1.s } \
49 { \
50 { readelf -s comm-data1.sd } \
51 } \
52 "libcomm-data.so" \
53 ] \
54]
55
56# Set the pointer size according to the ELF flavor.
57set AFLAGS ""
58if [is_elf64 "tmpdir/libcomm-data.so"] {
59 append AFLAGS " --defsym ELF64=1"
60}
61
e0799d78
RM
62setup_xfail "arm*-*-*" "ld/13802"
63
74d44110
MR
64# Verify that a common symbol has been converted to an undefined
65# reference to the global symbol of the same name defined above
66# and that the debug reference has been dropped.
67run_ld_link_tests [list \
68 [list \
69 "$testname" \
70 "-Ltmpdir -lcomm-data" \
71 "$AFLAGS" \
72 { comm-data2.s } \
73 { \
74 { readelf -s comm-data2.sd } \
75 { readelf -r comm-data2.rd } \
76 { readelf "-x .debug_foo" comm-data2.xd } \
77 } \
78 "comm-data" \
79 ] \
37a9e49a
L
80 [list \
81 "$testname 3a" \
82 "-static" \
83 "" \
84 { comm-data3a.s comm-data3b.s } \
85 { \
86 { readelf -s comm-data3.sd } \
87 } \
88 "comm-data3a" \
89 ] \
90 [list \
91 "$testname 3b" \
92 "-static" \
93 "" \
94 { comm-data3b.s comm-data3a.s } \
95 { \
96 { readelf -s comm-data3.sd } \
97 } \
98 "comm-data3b" \
99 ] \
74d44110 100]