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