* ld-checks/asm.s: Use a symbol name for .lcomm.
[deliverable/binutils-gdb.git] / ld / testsuite / ld-checks / checks.exp
CommitLineData
252b5132
RH
1# Expect script for LD section checks tests
2# Copyright (C) 1999 Free Software Foundation
3#
4# This file is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17#
18# Written by Nick Clifton (nickc@cygnus.com)
19
20proc section_check {} {
21 global ld_flags
22 global as
23 global ld
24 global srcdir
25 global subdir
26
197a7bfd 27 set test "check sections 1"
252b5132
RH
28
29 set ldflags "--check-sections"
30
31 if { ![ld_assemble $as $srcdir/$subdir/asm.s tmpdir/asm.o]} {
32 unresolved $test
33 return
34 }
35
36 if ![ld_simple_link $ld tmpdir/asm.x "$ldflags tmpdir/asm.o"] {
197a7bfd 37 fail $test
252b5132
RH
38 } else {
39 pass $test
40 }
41
197a7bfd
ILT
42 set test "check sections 2"
43
252b5132
RH
44 # Change the linker flags so that our "buggy" linker
45 # script is used.
46 set ldflags "--check-sections -T $srcdir/$subdir/script -e foo"
47
48 # Perform the equivalent of invoking ld_simple_link
49 # except that we need to massage the output futher.
50
51 catch "exec $ld -o tmpdir/asm.x $ldflags tmpdir/asm.o" exec_output
52 set exec_output [prune_warnings $exec_output]
53
54 # Make sure that we got some output from the linker
55 if [string match "" $exec_output] then {
197a7bfd 56 fail $test
252b5132
RH
57 }
58
59 # Now remove our expected error message
60 regsub -all ".*: section .data .* overlaps section .text .*" $exec_output "" exec_output
61
62 # And check to see if anything else, (unexpected) was left
63 if [string match "" $exec_output] then {
64 pass $test
65 } else {
66 verbose -log "Unexpected linker message(s): $exec_output"
197a7bfd 67 fail $test
252b5132
RH
68 }
69}
70
71section_check
72
73
This page took 0.026768 seconds and 4 git commands to generate.