1 # Copyright (C) 2012-2016 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
18 # This test is special because it exercises the linker's
20 proc ld_test { objects ldflags dest test } {
21 set ld_output [target_link $objects $dest $ldflags]
22 if [string match "" $ld_output] then { pass $test } else { fail $test }
26 proc objdump_test { exec flags dest test } {
27 set objcopy [find_binutils_prog objdump]
28 verbose -log "$objcopy $flags $exec > $dest"
29 catch "exec $objcopy $flags $exec > $dest" objdump_output
30 if [string match "" $objdump_output] then { pass $test } else { fail $test }
33 proc regexp_test { file1 file2 test } {
34 if [regexp_diff $file1 $file2] then { fail $test } else { pass $test }
40 gas_test "relocs1.s" {-o relocs1.o} {} {assembling relocs1}
42 # gas_test "relocs2.s" {-o relocs2.o} {} {assembling relocs2}
43 # ld_test {relocs1.o relocs2.o} {} {relocs.x} {linking relocs.x}
44 # objdump_test {relocs.x} {-ds} {relocs.dump} {disassembling relocs.x}
45 # regexp_test {relocs.dump} "$srcdir/$subdir/relocs.d" {matching disassembly}
47 gas_test "relocs2.s" {-o relocs2.o} {} {assembling relocs2}
48 ld_test {relocs1.o relocs2.o} {} {relocs.x} {linking relocs.x}
49 objdump_test {relocs.x} {-ds} {relocs.dump} {disassembling relocs.x}
50 regexp_test {relocs.dump} "$srcdir/$subdir/relocs.d" {matching disassembly}