* elf32-spu.c (build_stub): Fix malloc under-allocation.
[binutils.git] / ld / testsuite / ld-mips-elf / comm-data.exp
blobbbd3c5589c728eea64dff2ec7701225e1c35fbd2
1 # Expect script for common symbol override, MIPS variation.
3 # Copyright 2011 Free Software Foundation, Inc.
5 # This file is part of the GNU Binutils.
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.
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.
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.
24 # Written by Maciej W. Rozycki <macro@codesourcery.com>
27 # Exclude non-Linux targets; feel free to include your favorite one
28 # if you like.
29 if ![istarget mips*-*-linux*] {
30 return
33 proc mips_comm_data_test { abi flag emul reloc } {
35 set testname "MIPS $abi/$reloc common symbol override test"
37 # There's no "-z copyreloc" option, deal with it.
38 set ZFLAG [string map [list copyreloc "" nocopyreloc "-z $reloc"] $reloc]
39 set AFLAGS "$flag -EB"
40 set LDFLAGS "-m$emul"
42 # Define a global symbol.
43 run_ld_link_tests [list \
44 [list \
45 "$testname (auxiliary shared object build)" \
46 "$LDFLAGS -shared" \
47 "$AFLAGS -call_shared" \
48 { ../ld-elf/comm-data1.s } \
49 { \
50 { readelf -s ../ld-elf/comm-data1.sd } \
51 } \
52 "libmips-$abi-$reloc-comm-data.so" \
53 ] \
56 # Set the pointer size according to the ABI.
57 if { $abi == "n64" } {
58 append AFLAGS " --defsym ELF64=1"
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 "$LDFLAGS $ZFLAG -Ltmpdir -lmips-$abi-$reloc-comm-data" \
68 "$AFLAGS -call_nonpic" \
69 { ../ld-elf/comm-data2.s } \
70 { \
71 { readelf -s ../ld-elf/comm-data2.sd } \
72 { readelf -r ../ld-elf/comm-data2.rd } \
73 { readelf "-x .debug_foo" ../ld-elf/comm-data2.xd } \
74 } \
75 "mips-$abi-$reloc-comm-data" \
76 ] \
80 set abis { o32 -32 elf32btsmip n32 -n32 elf32btsmipn32 n64 -64 elf64btsmip }
81 set relocs { copyreloc nocopyreloc }
82 foreach { abi flag emul } $abis {
83 foreach reloc $relocs {
84 mips_comm_data_test $abi $flag $emul $reloc