| 1 | # Copyright (C) 2012-2018 Free Software Foundation, Inc. |
| 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 | |
| 17 | # Relocation test. |
| 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 objdump_test { exec flags dest test } { |
| 25 | set objcopy [find_binutils_prog objdump] |
| 26 | verbose -log "$objcopy $flags $exec > $dest" |
| 27 | catch "exec $objcopy $flags $exec > $dest" objdump_output |
| 28 | if [string match "" $objdump_output] then { pass $test } else { fail $test } |
| 29 | } |
| 30 | |
| 31 | proc regexp_test { file1 file2 test } { |
| 32 | if [regexp_diff $file1 $file2] then { fail $test } else { pass $test } |
| 33 | } |
| 34 | |
| 35 | |
| 36 | global srcdir subdir |
| 37 | if [istarget microblaze*-*-*] { |
| 38 | gas_test "reloc_strongsym.s" {-o reloc_strongsym.o} {} {assembling reloc_strongsym} |
| 39 | gas_test "reloc_weaksym.s" {-o reloc_weaksym.o} {} {assembling reloc_weaksym} |
| 40 | ld_test {reloc_strongsym.o reloc_weaksym.o} {-e 0 -section-start .text=0x10000054 -section-start .testsection=0x4} {reloc_sym.x} {linking reloc_sym.x} |
| 41 | objdump_test {reloc_sym.x} {-d --section=.text --section=.testsection} {reloc_sym.dump} {disassembling reloc_sym.x} |
| 42 | regexp_test {reloc_sym.dump} "$srcdir/$subdir/reloc_sym.d" {matching disassembly} |
| 43 | } |