]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - ld/testsuite/ld-elf/comm-data.exp
* ld-elf/comm-data.exp: Run for *-*-gnu*.
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-elf / comm-data.exp
1 # Expect script for common symbol override.
2 #
3 # Copyright 2011, 2012 Free Software Foundation, Inc.
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.
28 if ![is_elf_format] {
29 return
30 }
31
32 # Exclude some more targets; feel free to include your favorite one
33 # if you like.
34 if { ![istarget *-*-linux*]
35 && ![istarget *-*-gnu*] } {
36 return
37 }
38
39 set testname "Common symbol override test"
40
41 # Define a global symbol.
42 run_ld_link_tests [list \
43 [list \
44 "$testname (auxiliary shared object build)" \
45 "-shared" \
46 "" \
47 { comm-data1.s } \
48 { \
49 { readelf -s comm-data1.sd } \
50 } \
51 "libcomm-data.so" \
52 ] \
53 ]
54
55 # Set the pointer size according to the ELF flavor.
56 set AFLAGS ""
57 if [is_elf64 "tmpdir/libcomm-data.so"] {
58 append AFLAGS " --defsym ELF64=1"
59 }
60
61 # Verify that a common symbol has been converted to an undefined
62 # reference to the global symbol of the same name defined above
63 # and that the debug reference has been dropped.
64 run_ld_link_tests [list \
65 [list \
66 "$testname" \
67 "-Ltmpdir -lcomm-data" \
68 "$AFLAGS" \
69 { comm-data2.s } \
70 { \
71 { readelf -s comm-data2.sd } \
72 { readelf -r comm-data2.rd } \
73 { readelf "-x .debug_foo" comm-data2.xd } \
74 } \
75 "comm-data" \
76 ] \
77 ]