]>
Commit | Line | Data |
---|---|---|
250d07de | 1 | # Copyright (C) 2012-2021 Free Software Foundation, Inc. |
5bf135a7 NC |
2 | |
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. | |
7 | # | |
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. | |
12 | # | |
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. | |
16 | ||
280d71bf DB |
17 | # complex relocations testsuite |
18 | ||
19 | proc ld_test { objects ldflags dest test } { | |
20 | set ld_output [target_link $objects $dest $ldflags] | |
21 | if [string match "" $ld_output] then { pass $test } else { fail $test } | |
22 | } | |
23 | ||
24 | proc ld_test_error { objects ldflags dest test } { | |
25 | set ld_output [target_link $objects $dest $ldflags] | |
26 | if [string match "" $ld_output] then { fail $test } else { pass $test } | |
27 | } | |
28 | ||
29 | proc objdump_test { exec flags dest test } { | |
30 | set objdump [find_binutils_prog objdump] | |
31 | verbose -log "$objdump $flags $exec > $dest" | |
32 | catch "exec $objdump $flags $exec > $dest" objdump_output | |
33 | if [string match "" $objdump_output] then { pass $test } else { fail $test } | |
34 | } | |
35 | ||
36 | proc regexp_test { file1 file2 test } { | |
eb22018c | 37 | if [regexp_diff $file1 $file2] then { fail $test } else { pass $test } |
280d71bf DB |
38 | } |
39 | ||
40 | ||
280d71bf DB |
41 | if [istarget mep*-*-*] { |
42 | ||
43 | # test that complex relocs between files work, generally | |
e1bfd1b9 DD |
44 | gas_test relocs-junk1.s {-mconfig=default -o relocs-junk1.o} {} {assembling relocs-junk1} |
45 | gas_test relocs-syms.s {-mconfig=default -o relocs-syms.o} {} {assembling relocs-syms} | |
46 | gas_test relocs-junk2.s {-mconfig=default -o relocs-junk2.o} {} {assembling relocs-junk2} | |
47 | gas_test relocs-refs.s {-mconfig=default -o relocs-refs.o} {} {assembling relocs-refs} | |
48 | ld_test {relocs-junk1.o relocs-syms.o relocs-junk2.o relocs-refs.o} {--defsym __stack=0x1ffff0 --defsym __sbss_end=0x1000 -e 1233 -EL} {relocs.x} {linking relocs.x} | |
280d71bf DB |
49 | objdump_test {relocs.x} {-dzs} {relocs.dump} {disassembling relocs.x} |
50 | regexp_test {relocs.dump} "$srcdir/$subdir/relocs.d" {matching disassembly for relocs.x} | |
51 | ||
52 | foreach test {3} { | |
53 | # perform specific negative boundary tests | |
e1bfd1b9 DD |
54 | gas_test "relocs-bad$test.s" [list -mconfig=default -o "relocs-bad$test.o"] {} [list assembling "relocs-bad$test"] |
55 | ld_test_error "relocs-bad$test.o" {-e 1233 -EL} "relocs-bad$test.x" [list linking "relocs-bad$test"] | |
280d71bf DB |
56 | } |
57 | } |