2018-01-03 13:17:27 +08:00
|
|
|
# Copyright (C) 1993-2018 Free Software Foundation, Inc.
|
2010-11-20 23:36:10 +08:00
|
|
|
#
|
|
|
|
# This file is part of the GNU Binutils.
|
|
|
|
#
|
|
|
|
# This file is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
# MA 02110-1301, USA.
|
|
|
|
|
|
|
|
# True if the object format is known to be ELF.
|
|
|
|
#
|
|
|
|
proc is_elf_format {} {
|
2016-01-17 09:43:43 +08:00
|
|
|
# config.sub for these targets curiously transforms a target doublet
|
|
|
|
# ending in -elf to -none. eg. m68hc12-elf to m68hc12-unknown-none
|
|
|
|
# They are always elf.
|
2018-05-18 22:26:18 +08:00
|
|
|
if { [istarget m68hc1*-*] || [istarget s12z*-*] || [istarget xgate-*] } {
|
2016-01-17 09:43:43 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2018-05-15 14:30:57 +08:00
|
|
|
# vxworks (and windiss) excluded due to number of ELF tests that need
|
|
|
|
# modifying to pass on those targets.
|
|
|
|
# && ![istarget *-*-vxworks*]
|
|
|
|
# && ![istarget *-*-windiss*]
|
2016-01-17 09:43:43 +08:00
|
|
|
|
2018-05-15 14:30:57 +08:00
|
|
|
if { ![istarget *-*-chorus*]
|
|
|
|
&& ![istarget *-*-cloudabi*]
|
|
|
|
&& ![istarget *-*-eabi*]
|
|
|
|
&& ![istarget *-*-*elf*]
|
|
|
|
&& ![istarget *-*-*freebsd*]
|
|
|
|
&& ![istarget *-*-fuchsia*]
|
2010-11-20 23:36:10 +08:00
|
|
|
&& ![istarget *-*-gnu*]
|
|
|
|
&& ![istarget *-*-irix5*]
|
|
|
|
&& ![istarget *-*-irix6*]
|
2018-05-15 14:30:57 +08:00
|
|
|
&& ![istarget *-*-kaos*]
|
|
|
|
&& ![istarget *-*-*linux*]
|
2018-03-29 04:59:01 +08:00
|
|
|
&& ![istarget *-*-lynxos*]
|
2016-05-04 20:03:52 +08:00
|
|
|
&& ![istarget *-*-nacl*]
|
2010-11-20 23:36:10 +08:00
|
|
|
&& ![istarget *-*-netbsd*]
|
2018-05-15 14:30:57 +08:00
|
|
|
&& ![istarget *-*-nto*]
|
2010-11-20 23:36:10 +08:00
|
|
|
&& ![istarget *-*-openbsd*]
|
2016-05-04 20:03:52 +08:00
|
|
|
&& ![istarget *-*-rtems*]
|
|
|
|
&& ![istarget *-*-solaris2*]
|
|
|
|
&& ![istarget *-*-sysv4*]
|
|
|
|
&& ![istarget *-*-unixware*]
|
2017-03-30 17:57:21 +08:00
|
|
|
&& ![istarget *-*-wasm32*]
|
2016-05-04 20:03:52 +08:00
|
|
|
&& ![istarget avr-*-*]
|
|
|
|
&& ![istarget hppa*64*-*-hpux*]
|
2018-05-15 14:30:57 +08:00
|
|
|
&& ![istarget ia64-*-hpux*] } {
|
2010-11-20 23:36:10 +08:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2018-04-16 20:44:01 +08:00
|
|
|
if { [istarget *-*-linux*ecoff*]
|
|
|
|
|| [istarget *-*-rtemscoff*] } {
|
2010-11-20 23:36:10 +08:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
if { ![istarget *-*-netbsdelf*]
|
2018-04-16 20:44:01 +08:00
|
|
|
&& ( [istarget vax-*-netbsd*]
|
2010-11-20 23:36:10 +08:00
|
|
|
|| [istarget ns32k-*-netbsd*]) } {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2016-05-04 20:03:52 +08:00
|
|
|
if { [istarget arm-*-openbsd*]
|
2010-11-20 23:36:10 +08:00
|
|
|
|| [istarget ns32k-*-openbsd*]
|
|
|
|
|| [istarget vax-*-openbsd*] } {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# True if the object format is known to be a.out.
|
|
|
|
#
|
|
|
|
proc is_aout_format {} {
|
2018-04-16 20:44:01 +08:00
|
|
|
if { [istarget *-*-*aout*]
|
2010-11-20 23:36:10 +08:00
|
|
|
|| [istarget *-*-bsd*]
|
|
|
|
|| [istarget *-*-msdos*]
|
|
|
|
|| [istarget ns32k-*-*]
|
|
|
|
|| [istarget pdp11-*-*]
|
|
|
|
|| [istarget vax-*-netbsd] } {
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
# True if the object format is known to be PE COFF.
|
|
|
|
#
|
|
|
|
proc is_pecoff_format {} {
|
|
|
|
if { ![istarget *-*-mingw*]
|
|
|
|
&& ![istarget *-*-cygwin*]
|
|
|
|
&& ![istarget *-*-cegcc*]
|
|
|
|
&& ![istarget *-*-pe*] } {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# True if the object format is known to be 64-bit ELF.
|
|
|
|
#
|
|
|
|
proc is_elf64 { binary_file } {
|
|
|
|
global READELF
|
|
|
|
global READELFFLAGS
|
|
|
|
|
|
|
|
set readelf_size ""
|
|
|
|
catch "exec $READELF $READELFFLAGS -h $binary_file > readelf.out" got
|
|
|
|
|
|
|
|
if ![string match "" $got] then {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
if { ![regexp "\n\[ \]*Class:\[ \]*ELF(\[0-9\]+)\n" \
|
|
|
|
[file_contents readelf.out] nil readelf_size] } {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
if { $readelf_size == "64" } {
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
2010-11-20 23:36:34 +08:00
|
|
|
|
testsuite: Support filtering targets by TCL procedure in `run_dump_test'
Implement a more complex way of selecting targets to include or exclude
with `run_dump_test' cases, by extending the syntax for the `target',
`not-target', `skip' and `not-skip' options (with the binutils and GAS
test suites) and the `target', `alltargets' and `notarget' options (with
the LD test suite) to also accept a name of a TCL procedure instead of a
target triplet glob matching expression. The result, 1 or 0, of the
procedure determines whether the test is to be run or not. This mimics
and expands `dg-require-effective-target' from the GCC test suite.
Names of TCL procedures are supplied in square brackets `[]' as with TCL
procedure calls, observing that target triplet glob matching expressions
do not normally start and end with matching square brackets both at a
time. Arguments for procedures are allowed if required.
Having a way to specify a complex condition for a `run_dump_test' case
to run has the advantage of keeping it local within the test case itself
where tool options related to the check might be also present, removing
the need to wrap `run_dump_test' calls into an `if' block whose only
reason is to do a feature check, and ultimately lets one have the test
reported as UNSUPPORTED automagically if required (not currently
supported by the `run_dump_test' options used for LD).
binutils/
* testsuite/lib/binutils-common.exp (match_target): New procedure.
* testsuite/lib/utils-lib.exp (run_dump_test): Use it in place
of `istarget' for matching with `target', `not-target', `skip'
and `not-skip' options.
gas/
* testsuite/lib/gas-defs.exp (run_dump_test): Use `match_target'
in place of `istarget' for matching with `target', `not-target',
`skip' and `not-skip' options.
ld/
* testsuite/lib/ld-lib.exp (run_dump_test): Use `match_target'
in place of `istarget' for matching with `target', `alltargets'
and `notarget' options.
2018-04-27 22:25:20 +08:00
|
|
|
# True if the target matches TARGET, specified as a TCL procedure if
|
|
|
|
# in square brackets or as machine triplet otherwise.
|
|
|
|
#
|
|
|
|
proc match_target { target } {
|
|
|
|
if [string match {\[*\]} $target] {
|
|
|
|
return $target
|
|
|
|
} else {
|
|
|
|
return [istarget $target]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-16 15:51:26 +08:00
|
|
|
# True if the ELF target supports STB_GNU_UNIQUE with the ELF header's
|
|
|
|
# OSABI field set to ELFOSABI_GNU.
|
|
|
|
#
|
|
|
|
# This generally depends on the target OS only, however there are a
|
|
|
|
# number of exceptions for bare metal targets as follows. The MSP430
|
|
|
|
# and Visium targets set OSABI to ELFOSABI_STANDALONE and cannot
|
|
|
|
# support STB_GNU_UNIQUE. Likewise non-EABI ARM targets set OSABI to
|
|
|
|
# ELFOSABI_ARM, and TI C6X targets to ELFOSABI_C6000_*. Finally
|
Remove i860, i960, bout and aout-adobe targets
Plus remove a few leftovers from the 29k support.
include/
* aout/adobe.h: Delete.
* aout/reloc.h: Delete.
* coff/i860.h: Delete.
* coff/i960.h: Delete.
* elf/i860.h: Delete.
* elf/i960.h: Delete.
* opcode/i860.h: Delete.
* opcode/i960.h: Delete.
* aout/aout64.h (enum reloc_type): Trim off 29k and other unused values.
* aout/ar.h (ARMAGB): Remove.
* coff/internal.h (struct internal_aouthdr, struct internal_scnhdr,
union internal_auxent): Remove i960 support.
bfd/
* aout-adobe.c: Delete.
* bout.c: Delete.
* coff-i860.c: Delete.
* coff-i960.c: Delete.
* cpu-i860.c: Delete.
* cpu-i960.c: Delete.
* elf32-i860.c: Delete.
* elf32-i960.c: Delete.
* hosts/i860mach3.h: Delete.
* Makefile.am: Remove i860, i960, bout, and adobe support.
* archures.c: Remove i860 and i960 support.
* coffcode.h: Likewise.
* reloc.c: Likewise.
* aoutx.h: Comment updates.
* archive.c: Remove BOUT and i960 support.
* bfd.c: Remove BOUT support.
* coffswap.h: Remove i960 support.
* config.bfd: Remove i860, i960 and adobe targets.
* configure.ac: Remove adode, bout, i860, i960, icoff targets.
* targets.c: Likewise.
* ieee.c: Remove i960 support.
* mach-o.c: Remove i860 support.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
* libbfd.h: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
opcodes/
* opcodes/i860-dis.c: Delete.
* opcodes/i960-dis.c: Delete.
* Makefile.am: Remove i860 and i960 support.
* configure.ac: Likewise.
* disassemble.c: Likewise.
* disassemble.h: Likewise.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/POTFILES.in: Regenerate.
binutils/
* ieee.c: Remove i960 support.
* od-macho.c: Remove i860 support.
* readelf.c: Remove i860 and i960 support.
* testsuite/binutils-all/objcopy.exp: Likewise.
* testsuite/binutils-all/objdump.exp: Likewise.
* testsuite/lib/binutils-common.exp: Likewise.
gas/
* config/aout_gnu.h: Delete.
* config/tc-i860.c: Delete.
* config/tc-i860.h: Delete.
* config/tc-i960.c: Delete.
* config/tc-i960.h: Delete.
* doc/c-i860.texi: Delete.
* doc/c-i960.texi: Delete.
* testsuite/gas/i860/README.i860: Delete.
* testsuite/gas/i860/bitwise.d: Delete.
* testsuite/gas/i860/bitwise.s: Delete.
* testsuite/gas/i860/branch.d: Delete.
* testsuite/gas/i860/branch.s: Delete.
* testsuite/gas/i860/bte.d: Delete.
* testsuite/gas/i860/bte.s: Delete.
* testsuite/gas/i860/dir-align01.d: Delete.
* testsuite/gas/i860/dir-align01.s: Delete.
* testsuite/gas/i860/dir-intel01.d: Delete.
* testsuite/gas/i860/dir-intel01.s: Delete.
* testsuite/gas/i860/dir-intel02.d: Delete.
* testsuite/gas/i860/dir-intel02.s: Delete.
* testsuite/gas/i860/dir-intel03-err.l: Delete.
* testsuite/gas/i860/dir-intel03-err.s: Delete.
* testsuite/gas/i860/dual01.d: Delete.
* testsuite/gas/i860/dual01.s: Delete.
* testsuite/gas/i860/dual02-err.l: Delete.
* testsuite/gas/i860/dual02-err.s: Delete.
* testsuite/gas/i860/dual03.d: Delete.
* testsuite/gas/i860/dual03.s: Delete.
* testsuite/gas/i860/fldst01.d: Delete.
* testsuite/gas/i860/fldst01.s: Delete.
* testsuite/gas/i860/fldst02.d: Delete.
* testsuite/gas/i860/fldst02.s: Delete.
* testsuite/gas/i860/fldst03.d: Delete.
* testsuite/gas/i860/fldst03.s: Delete.
* testsuite/gas/i860/fldst04.d: Delete.
* testsuite/gas/i860/fldst04.s: Delete.
* testsuite/gas/i860/fldst05.d: Delete.
* testsuite/gas/i860/fldst05.s: Delete.
* testsuite/gas/i860/fldst06.d: Delete.
* testsuite/gas/i860/fldst06.s: Delete.
* testsuite/gas/i860/fldst07.d: Delete.
* testsuite/gas/i860/fldst07.s: Delete.
* testsuite/gas/i860/fldst08.d: Delete.
* testsuite/gas/i860/fldst08.s: Delete.
* testsuite/gas/i860/float01.d: Delete.
* testsuite/gas/i860/float01.s: Delete.
* testsuite/gas/i860/float02.d: Delete.
* testsuite/gas/i860/float02.s: Delete.
* testsuite/gas/i860/float03.d: Delete.
* testsuite/gas/i860/float03.s: Delete.
* testsuite/gas/i860/float04.d: Delete.
* testsuite/gas/i860/float04.s: Delete.
* testsuite/gas/i860/form.d: Delete.
* testsuite/gas/i860/form.s: Delete.
* testsuite/gas/i860/i860.exp: Delete.
* testsuite/gas/i860/iarith.d: Delete.
* testsuite/gas/i860/iarith.s: Delete.
* testsuite/gas/i860/ldst01.d: Delete.
* testsuite/gas/i860/ldst01.s: Delete.
* testsuite/gas/i860/ldst02.d: Delete.
* testsuite/gas/i860/ldst02.s: Delete.
* testsuite/gas/i860/ldst03.d: Delete.
* testsuite/gas/i860/ldst03.s: Delete.
* testsuite/gas/i860/ldst04.d: Delete.
* testsuite/gas/i860/ldst04.s: Delete.
* testsuite/gas/i860/ldst05.d: Delete.
* testsuite/gas/i860/ldst05.s: Delete.
* testsuite/gas/i860/ldst06.d: Delete.
* testsuite/gas/i860/ldst06.s: Delete.
* testsuite/gas/i860/pfam.d: Delete.
* testsuite/gas/i860/pfam.s: Delete.
* testsuite/gas/i860/pfmam.d: Delete.
* testsuite/gas/i860/pfmam.s: Delete.
* testsuite/gas/i860/pfmsm.d: Delete.
* testsuite/gas/i860/pfmsm.s: Delete.
* testsuite/gas/i860/pfsm.d: Delete.
* testsuite/gas/i860/pfsm.s: Delete.
* testsuite/gas/i860/pseudo-ops01.d: Delete.
* testsuite/gas/i860/pseudo-ops01.s: Delete.
* testsuite/gas/i860/regress01.d: Delete.
* testsuite/gas/i860/regress01.s: Delete.
* testsuite/gas/i860/shift.d: Delete.
* testsuite/gas/i860/shift.s: Delete.
* testsuite/gas/i860/simd.d: Delete.
* testsuite/gas/i860/simd.s: Delete.
* testsuite/gas/i860/system.d: Delete.
* testsuite/gas/i860/system.s: Delete.
* testsuite/gas/i860/xp.d: Delete.
* testsuite/gas/i860/xp.s: Delete.
* Makefile.am: Remove i860 and i960 support.
* configure.tgt: Likewise.
* doc/Makefile.am: Likewise.
* doc/all.texi: Likewise.
* testsuite/gas/all/gas.exp
* config/obj-coff.h: Remove i960 support.
* doc/internals.texi: Likewise.
* expr.c: Likewise.
* read.c: Likewise.
* write.c: Likewise.
* write.h: Likewise.
* testsuite/gas/lns/lns.exp: Likewise.
* testsuite/gas/symver/symver.exp: Likewise.
* config/tc-m68k.c: Remove BOUT support.
* config/tc-score.c: Likewise.
* config/tc-score7.c: Likewise.
* config/tc-sparc.c: Likewise.
* symbols.c: Likewise.
* doc/h8.texi: Likewise.
* configure.ac: Remove BOUT and i860 support.
* doc/as.texinfo: Remove BOUT, i860 and i960 support
* Makefile.in: Regenerate.
* config.in: Regenerate.
* configure: Regenerate.
* doc/Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
ld/
* emulparams/coff_i860.sh: Delete.
* emulparams/elf32_i860.sh: Delete.
* emulparams/elf32_i960.sh: Delete.
* emulparams/gld960.sh: Delete.
* emulparams/gld960coff.sh: Delete.
* emulparams/lnk960.sh: Delete.
* emultempl/gld960.em: Delete.
* emultempl/gld960c.em: Delete.
* emultempl/lnk960.em: Delete.
* scripttempl/i860coff.sc: Delete.
* scripttempl/i960.sc: Delete.
* ld.texinfo: Remove i960 support.
* Makefile.am: Remove i860 and i960 support.
* configure.tgt: Likewise.
* testsuite/ld-discard/extern.d: Likewise.
* testsuite/ld-discard/start.d: Likewise.
* testsuite/ld-discard/static.d: Likewise.
* testsuite/ld-elf/compressed1d.d: Likewise.
* testsuite/ld-elf/group1.d: Likewise.
* testsuite/ld-elf/group3b.d: Likewise.
* testsuite/ld-elf/group8a.d: Likewise.
* testsuite/ld-elf/group8b.d: Likewise.
* testsuite/ld-elf/group9a.d: Likewise.
* testsuite/ld-elf/group9b.d: Likewise.
* testsuite/ld-elf/linkonce2.d: Likewise.
* testsuite/ld-elf/merge.d: Likewise.
* testsuite/ld-elf/merge2.d: Likewise.
* testsuite/ld-elf/merge3.d: Likewise.
* testsuite/ld-elf/orphan-10.d: Likewise.
* testsuite/ld-elf/orphan-11.d: Likewise.
* testsuite/ld-elf/orphan-12.d: Likewise.
* testsuite/ld-elf/orphan-9.d: Likewise.
* testsuite/ld-elf/orphan-region.d: Likewise.
* testsuite/ld-elf/orphan.d: Likewise.
* testsuite/ld-elf/orphan3.d: Likewise.
* testsuite/ld-elf/pr12851.d: Likewise.
* testsuite/ld-elf/pr12975.d: Likewise.
* testsuite/ld-elf/pr13177.d: Likewise.
* testsuite/ld-elf/pr13195.d: Likewise.
* testsuite/ld-elf/pr17550a.d: Likewise.
* testsuite/ld-elf/pr17550b.d: Likewise.
* testsuite/ld-elf/pr17550c.d: Likewise.
* testsuite/ld-elf/pr17550d.d: Likewise.
* testsuite/ld-elf/pr17615.d: Likewise.
* testsuite/ld-elf/pr20528a.d: Likewise.
* testsuite/ld-elf/pr20528b.d: Likewise.
* testsuite/ld-elf/pr21562a.d: Likewise.
* testsuite/ld-elf/pr21562b.d: Likewise.
* testsuite/ld-elf/pr21562c.d: Likewise.
* testsuite/ld-elf/pr21562d.d: Likewise.
* testsuite/ld-elf/pr21562i.d: Likewise.
* testsuite/ld-elf/pr21562j.d: Likewise.
* testsuite/ld-elf/pr21562k.d: Likewise.
* testsuite/ld-elf/pr21562l.d: Likewise.
* testsuite/ld-elf/pr21562m.d: Likewise.
* testsuite/ld-elf/pr21562n.d: Likewise.
* testsuite/ld-elf/pr22677.d: Likewise.
* testsuite/ld-elf/pr22836-1a.d: Likewise.
* testsuite/ld-elf/pr22836-1b.d: Likewise.
* testsuite/ld-elf/pr349.d: Likewise.
* testsuite/ld-elf/sec-to-seg.exp: Likewise.
* testsuite/ld-elf/sec64k.exp: Likewise.
* testsuite/ld-elf/warn1.d: Likewise.
* testsuite/ld-elf/warn2.d: Likewise.
* testsuite/ld-elf/warn3.d: Likewise.
* testsuite/lib/ld-lib.exp: Likewise.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.
2018-04-11 17:16:05 +08:00
|
|
|
# rather than `bfd_elf_final_link' AM33/2.0, D30V, DLX, and
|
2016-05-16 15:51:26 +08:00
|
|
|
# picoJava targets use `_bfd_generic_final_link', which does not
|
|
|
|
# support STB_GNU_UNIQUE symbol binding causing assertion failures.
|
|
|
|
#
|
|
|
|
proc supports_gnu_unique {} {
|
|
|
|
if { [istarget *-*-gnu*]
|
|
|
|
|| [istarget *-*-linux*]
|
|
|
|
|| [istarget *-*-nacl*] } {
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
if { [istarget "arm*-*-*eabi*"] } {
|
|
|
|
return 1
|
|
|
|
}
|
2017-03-30 17:57:21 +08:00
|
|
|
if { [istarget "wasm32*-*-*"] } {
|
|
|
|
return 1
|
|
|
|
}
|
2016-05-16 15:51:26 +08:00
|
|
|
if { ![istarget "*-*-elf*"] } {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
if { [istarget "arm*-*-*"]
|
|
|
|
|| [istarget "msp430-*-*"]
|
|
|
|
|| [istarget "tic6x-*-*"]
|
|
|
|
|| [istarget "visium-*-*"] } {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
if { [istarget "am33_2.0-*-*"]
|
|
|
|
|| [istarget "d30v-*-*"]
|
|
|
|
|| [istarget "dlx-*-*"]
|
|
|
|
|| [istarget "pj*-*-*"] } {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:41:57 +08:00
|
|
|
# True for targets that do not sort .symtab as per the ELF standard.
|
|
|
|
# ie. any that have mips_elf32_be_vec, mips_elf32_le_vec,
|
|
|
|
# mips_elf32_n_be_vec or mips_elf32_n_le_vec as the primary bfd target
|
|
|
|
# vector in config.bfd. When syncing with config.bfd, don't forget that
|
|
|
|
# earlier case-matches trump later ones.
|
|
|
|
proc is_bad_symtab {} {
|
|
|
|
if { ![istarget "mips*-*-*"] } {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if { [istarget "*-*-chorus*"]
|
|
|
|
|| [istarget "*-*-irix5*"]
|
|
|
|
|| [istarget "*-*-irix6*"]
|
|
|
|
|| [istarget "*-*-none"]
|
|
|
|
|| [istarget "*-*-rtems*"]
|
|
|
|
|| [istarget "*-*-windiss"] } {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if { [istarget "*-*-elf*"]
|
|
|
|
&& ![istarget "*-sde-*"]
|
|
|
|
&& ![istarget "*-mti-*"]
|
|
|
|
&& ![istarget "*-img-*"] } {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if { [istarget "*-*-openbsd*"]
|
|
|
|
&& ![istarget "mips64*-*-*"] } {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-11-20 23:36:34 +08:00
|
|
|
# Compare two files line-by-line. FILE_1 is the actual output and FILE_2
|
|
|
|
# is the expected output. Ignore blank lines in either file.
|
|
|
|
#
|
|
|
|
# FILE_2 is a series of regexps, comments and # directives. The directives
|
|
|
|
# are:
|
|
|
|
#
|
|
|
|
# #pass
|
|
|
|
# Treat the test as a PASS if everything up till this point has
|
|
|
|
# matched. Ignore any remaining lines in either FILE_1 or FILE_2.
|
|
|
|
#
|
|
|
|
# #failif
|
|
|
|
# Reverse the sense of the test: expect differences to exist.
|
|
|
|
#
|
|
|
|
# #...
|
|
|
|
# REGEXP
|
|
|
|
# Skip all lines in FILE_1 until the first that matches REGEXP.
|
|
|
|
#
|
2010-12-10 07:57:22 +08:00
|
|
|
# Other # lines are comments. Regexp lines starting with the `!' character
|
|
|
|
# specify inverse matching (use `\!' for literal matching against a leading
|
|
|
|
# `!'). Skip empty lines in both files.
|
2010-11-20 23:36:34 +08:00
|
|
|
#
|
|
|
|
# The first optional argument is a list of regexp substitutions of the form:
|
|
|
|
#
|
|
|
|
# EXP1 SUBSPEC1 EXP2 SUBSPEC2 ...
|
|
|
|
#
|
|
|
|
# This tells the function to apply each regexp substitution EXPi->SUBSPECi
|
|
|
|
# in order to every line of FILE_2.
|
|
|
|
#
|
|
|
|
# Return nonzero if differences exist.
|
|
|
|
proc regexp_diff { file_1 file_2 args } {
|
|
|
|
set eof -1
|
|
|
|
set end_1 0
|
|
|
|
set end_2 0
|
|
|
|
set differences 0
|
|
|
|
set diff_pass 0
|
|
|
|
set fail_if_match 0
|
|
|
|
set ref_subst ""
|
|
|
|
if { [llength $args] > 0 } {
|
|
|
|
set ref_subst [lindex $args 0]
|
|
|
|
}
|
|
|
|
if { [llength $args] > 1 } {
|
|
|
|
perror "Too many arguments to regexp_diff"
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
if [file exists $file_1] then {
|
|
|
|
set file_a [open $file_1 r]
|
|
|
|
} else {
|
|
|
|
perror "$file_1 doesn't exist"
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
if [file exists $file_2] then {
|
|
|
|
set file_b [open $file_2 r]
|
|
|
|
} else {
|
|
|
|
perror "$file_2 doesn't exist"
|
|
|
|
close $file_a
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
verbose " Regexp-diff'ing: $file_1 $file_2" 2
|
|
|
|
|
|
|
|
while { 1 } {
|
|
|
|
set line_a ""
|
|
|
|
set line_b ""
|
|
|
|
while { [string length $line_a] == 0 } {
|
|
|
|
# Ignore blank line in FILE_1.
|
|
|
|
if { [gets $file_a line_a] == $eof } {
|
|
|
|
set end_1 1
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while { [string length $line_b] == 0 || [string match "#*" $line_b] } {
|
|
|
|
if { [string match "#pass" $line_b] } {
|
|
|
|
set end_2 1
|
|
|
|
set diff_pass 1
|
|
|
|
break
|
|
|
|
} elseif { [string match "#failif" $line_b] } {
|
|
|
|
send_log "fail if no difference\n"
|
|
|
|
verbose "fail if no difference" 3
|
|
|
|
set fail_if_match 1
|
|
|
|
} elseif { [string match "#..." $line_b] } {
|
|
|
|
if { [gets $file_b line_b] == $eof } {
|
|
|
|
set end_2 1
|
|
|
|
set diff_pass 1
|
|
|
|
break
|
|
|
|
}
|
2011-01-04 00:53:28 +08:00
|
|
|
set negated [expr { [string index $line_b 0] == "!" }]
|
2010-12-10 07:57:22 +08:00
|
|
|
set line_bx [string range $line_b $negated end]
|
|
|
|
set n [expr { $negated ? "! " : "" }]
|
2010-11-20 23:36:34 +08:00
|
|
|
# Substitute on the reference.
|
|
|
|
foreach {name value} $ref_subst {
|
2010-12-10 07:57:22 +08:00
|
|
|
regsub -- $name $line_bx $value line_bx
|
2010-11-20 23:36:34 +08:00
|
|
|
}
|
2010-12-10 07:57:22 +08:00
|
|
|
verbose "looking for $n\"^$line_bx$\"" 3
|
|
|
|
while { [expr [regexp "^$line_bx$" "$line_a"] == $negated] } {
|
2010-11-20 23:36:34 +08:00
|
|
|
verbose "skipping \"$line_a\"" 3
|
|
|
|
if { [gets $file_a line_a] == $eof } {
|
|
|
|
set end_1 1
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break
|
|
|
|
}
|
|
|
|
if { [gets $file_b line_b] == $eof } {
|
|
|
|
set end_2 1
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if { $diff_pass } {
|
|
|
|
break
|
|
|
|
} elseif { $end_1 && $end_2 } {
|
|
|
|
break
|
|
|
|
} elseif { $end_1 } {
|
|
|
|
send_log "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1\n"
|
|
|
|
verbose "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1" 3
|
|
|
|
set differences 1
|
|
|
|
break
|
|
|
|
} elseif { $end_2 } {
|
|
|
|
send_log "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n"
|
|
|
|
verbose "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n" 3
|
|
|
|
set differences 1
|
|
|
|
break
|
|
|
|
} else {
|
2011-01-04 00:53:28 +08:00
|
|
|
set negated [expr { [string index $line_b 0] == "!" }]
|
2010-12-10 07:57:22 +08:00
|
|
|
set line_bx [string range $line_b $negated end]
|
|
|
|
set n [expr { $negated ? "! " : "" }]
|
|
|
|
set s [expr { $negated ? " " : "" }]
|
2010-11-20 23:36:34 +08:00
|
|
|
# Substitute on the reference.
|
|
|
|
foreach {name value} $ref_subst {
|
2010-12-10 07:57:22 +08:00
|
|
|
regsub -- $name $line_bx $value line_bx
|
2010-11-20 23:36:34 +08:00
|
|
|
}
|
2010-12-10 07:57:22 +08:00
|
|
|
verbose "regexp $n\"^$line_bx$\"\nline \"$line_a\"" 3
|
|
|
|
if { [expr [regexp "^$line_bx$" "$line_a"] == $negated] } {
|
2010-11-20 23:36:34 +08:00
|
|
|
send_log "regexp_diff match failure\n"
|
2010-12-10 07:57:22 +08:00
|
|
|
send_log "regexp $n\"^$line_bx$\"\nline $s\"$line_a\"\n"
|
2010-11-20 23:36:34 +08:00
|
|
|
verbose "regexp_diff match failure\n" 3
|
|
|
|
set differences 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if { $differences == 0 && !$diff_pass && [eof $file_a] != [eof $file_b] } {
|
|
|
|
send_log "$file_1 and $file_2 are different lengths\n"
|
|
|
|
verbose "$file_1 and $file_2 are different lengths" 3
|
|
|
|
set differences 1
|
|
|
|
}
|
|
|
|
|
|
|
|
if { $fail_if_match } {
|
|
|
|
if { $differences == 0 } {
|
|
|
|
set differences 1
|
|
|
|
} else {
|
|
|
|
set differences 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
close $file_a
|
|
|
|
close $file_b
|
|
|
|
|
|
|
|
return $differences
|
|
|
|
}
|