From 252b5132c753830d5fd56823373aed85f2a0db63 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 3 May 1999 07:29:11 +0000 Subject: 19990502 sourceware import --- binutils/testsuite/ChangeLog | 585 ++++++++++++++++++++++ binutils/testsuite/binutils-all/ar.exp | 219 +++++++++ binutils/testsuite/binutils-all/bintest.s | 12 + binutils/testsuite/binutils-all/hppa/addendbug.s | 23 + binutils/testsuite/binutils-all/hppa/objdump.exp | 59 +++ binutils/testsuite/binutils-all/nm.exp | 123 +++++ binutils/testsuite/binutils-all/objcopy.exp | 591 +++++++++++++++++++++++ binutils/testsuite/binutils-all/objdump.exp | 140 ++++++ binutils/testsuite/binutils-all/readelf.exp | 217 +++++++++ binutils/testsuite/binutils-all/readelf.h | 16 + binutils/testsuite/binutils-all/readelf.r | 4 + binutils/testsuite/binutils-all/readelf.s | 13 + binutils/testsuite/binutils-all/readelf.ss | 13 + binutils/testsuite/binutils-all/readelf.wi | 78 +++ binutils/testsuite/binutils-all/size.exp | 78 +++ binutils/testsuite/binutils-all/testprog.c | 28 ++ binutils/testsuite/config/default.exp | 88 ++++ binutils/testsuite/config/hppa.sed | 4 + binutils/testsuite/lib/utils-lib.exp | 161 ++++++ 19 files changed, 2452 insertions(+) create mode 100644 binutils/testsuite/ChangeLog create mode 100644 binutils/testsuite/binutils-all/ar.exp create mode 100644 binutils/testsuite/binutils-all/bintest.s create mode 100644 binutils/testsuite/binutils-all/hppa/addendbug.s create mode 100644 binutils/testsuite/binutils-all/hppa/objdump.exp create mode 100644 binutils/testsuite/binutils-all/nm.exp create mode 100644 binutils/testsuite/binutils-all/objcopy.exp create mode 100644 binutils/testsuite/binutils-all/objdump.exp create mode 100644 binutils/testsuite/binutils-all/readelf.exp create mode 100644 binutils/testsuite/binutils-all/readelf.h create mode 100644 binutils/testsuite/binutils-all/readelf.r create mode 100644 binutils/testsuite/binutils-all/readelf.s create mode 100644 binutils/testsuite/binutils-all/readelf.ss create mode 100644 binutils/testsuite/binutils-all/readelf.wi create mode 100644 binutils/testsuite/binutils-all/size.exp create mode 100644 binutils/testsuite/binutils-all/testprog.c create mode 100644 binutils/testsuite/config/default.exp create mode 100644 binutils/testsuite/config/hppa.sed create mode 100644 binutils/testsuite/lib/utils-lib.exp (limited to 'binutils/testsuite') diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog new file mode 100644 index 0000000..15a0577 --- /dev/null +++ b/binutils/testsuite/ChangeLog @@ -0,0 +1,585 @@ +1999-03-12 Nick Clifton + + * binutils-all/readelf.wi: Remove FR30 specific componnts. + * binutils-all/readelf.s: Remove RELA specific components. + +1999-02-16 Nick Clifton + + * binutils-all/readelf.s: Do not assume section alignment is 4. + * binutils-all/readelf.r: Do not assume rela's are being used. + * binutils-all/readelf.exp: disable tests for non ELF based + targets. + +1999-02-02 Nick Clifton + + * binutils-all/readelf.wi: Amend to match new readelf output. + * binutils-all/readelf.r: Do not assume that RELAs will be used. + +1999-01-29 Nick Clifton + + * config/default.exp: Add definitions of READELF and READELFFLAGS. + + * binutils-all/readelf.exp: New file: Readelf tests + * binutils-all/readelf.h: New file: Expected results for 'readelf -h' + * binutils-all/readelf.s: New file: Expected results for 'readelf -S' + * binutils-all/readelf.ss: New file: Expected results for 'readelf -s' + * binutils-all/readelf.r: New file: Expected results for 'readelf -r' + * binutils-all/readelf.wi: New file: Expected results for 'readelf -wi' + +Wed Dec 9 19:11:39 1998 Jeffrey A Law (law@cygnus.com) + + * binutils-all/objcopy.exp (copy_executable): Expect comparison + failure for mips*-*-elf. + +Fri Oct 16 22:57:12 1998 Felix Lee + + * binutils-all/objcopy.exp: fix "no symbols" message. + +Tue Jul 28 15:14:04 1998 Jeffrey A Law (law@cygnus.com) + + * binutils-all/objcopy.exp: Keep "main" and "_main" for strip with + saving symbol tests. Look for either "main" or "_main" in the output + file. Fix test for "no symbols" in the output file. + +1998-07-22 Vladimir N. Makarov + + * binutils-all/objcopy.exp: Polish output about fail for objcopy + (simple copy), strip with/without saving a symbol for object file + and executable. + +Wed Jul 1 16:27:40 1998 Nick Clifton + + * binutils-all/objcopy.exp: ARM simple objcopy now passes. + +Wed Jun 24 09:20:21 1998 Nick Clifton + + * binutils-all/objdump.exp: Look for '.data' rather than 'data' + when parsing output of objdump -h. + * binutils-all/size.exp: Look for '.data' rather than 'data' when + parsing output of size -A. + +1998-07-20 Vladimir N. Makarov + + * objcopy.exp: Two new tests - strip object file with saving a + symbol and strip executable file with saving a symbol. + +Fri May 29 14:50:24 1998 Ian Lance Taylor + + * binutils-all/objcopy.exp: Don't xfail the simple objcopy test + when cross compiling. + +Thu Nov 6 14:32:37 1997 Bob Manson + + * lib/utils-lib.exp: Temporary definition of target_assemble and + default_target_assemble so that testing can work with older + dejagnu versions. + +Wed Sep 24 12:09:15 1997 Bob Manson + + * binutils-all/objcopy.exp(strip_executable): Make a new copy of + the executable being tested. + +Mon Sep 15 21:25:20 1997 Bob Manson + + * binutils-all/objcopy.exp: Compile the executables to be tested + on the target with a status wrapper (as necessary). + + * binutils-all/ar.exp: If testing on a remote host, don't bother + looking on the local host for the program being tested. Use the + correct filenames on the remote host. + + * binutils-all/nm.exp: Ditto. + + * binutils-all/size.exp: Ditto. + + * binutils-all/objdump.exp: Ditto. + (cpus_expected): Add the target CPU to the regexp of CPUs to be + expected, if it's not already there. + +Thu Aug 28 09:57:27 1997 Doug Evans + + * binutils-all/objdump.exp (cpus_expected): Add arc. + +Tue Aug 5 00:03:20 1997 Ian Lance Taylor + + * config/default.exp: Look for nm-new and strip-new. + +Tue Jun 3 17:12:54 1997 Bob Manson + + * config/default.exp: Remove expect_before statement. + + * binutils-all/objcopy.exp: Don't use global exec_output variable; + the output is returned from remote_load instead. + +Mon May 12 22:14:20 1997 Bob Manson + + * binutils-all/objcopy.exp(strip_test): Tests that + fail to compile are untested, not unresolved. + (copy_setup): Ditto. + + * lib/utils-lib.exp(default_binutils_assemble): Call + target_assemble instead of target_compile. + +Wed Apr 30 20:37:51 1997 Bob Manson + + Changes to support multilib and remote hosted testing, along with + general cleanups and simplifications. + + * lib/utils-lib.exp(binutil_version): Use remote_exec. + (default_binutils_run): Ditto. + (default_binutils_assemble): Remove first argument; call + target_compile to actually do the assembly. + (default_binutils_compile,default_binutils_remove,prune_warnings): + Delete. + + * config/default.exp: Remove AS and ASFLAGS. + (binutils_compile,binutils_remove): Delete. + (binutils_assemble): Remove first argument. + + * binutils-all/ar.exp: See if we're running the tests on + a remote host, and download/upload files as appropriate. + Replace calls to binutils_remove with remote_file. Replace + calls to binutils_compile with target_compile. Remove initial + argument to binutils_assemble. Use remote_load to execute + programs on the target. + * binutils-all/nm.exp: Ditto. + * binutils-all/objcopy.exp: Ditto. + * binutils-all/objdump.exp: Ditto. + * binutils-all/size.exp: Ditto. + +Mon Apr 14 12:36:41 1997 Ian Lance Taylor + + * binutils-all/ar.exp (long_filenames): Check for a file system + with a 14 character file name length limit. + +Tue Apr 1 09:52:15 1997 Jeffrey A Law (law@cygnus.com) + + * binutils-all/objdump.exp: Handle d10v. + +Fri Feb 7 16:45:34 1997 Bob Manson + + * binutils-all/ar.exp: Use prune_warnings instead of + prune_system_crud. + * binutils-all/objcopy.exp: Ditto. + +Wed Jan 29 00:16:43 1997 Bob Manson + + * binutils-all/nm.exp: Use / between $srcdir and $subdir. + * binutils-all/objcopy.exp: Ditto. + * binutils-all/objdump.exp: Ditto. + * binutils-all/size.exp: Ditto. + * binutils-all/hppa/objdump.exp: Ditto. + + +Wed Oct 16 22:57:59 1996 Jeffrey A Law (law@cygnus.com) + + * binutils-all/objdump.exp: Add mn10200 and mn10300 to expected + cpus list. + +Tue Oct 1 15:06:55 1996 Ian Lance Taylor + + * lib/utils-lib.exp (binutil_version): Fix for current version + printing. + +Sun Aug 4 22:25:40 1996 Ian Lance Taylor + + * binutils-all/objcopy.exp: Fix end of line matching in srec tests + to work with TCL 7.5. + +Sat Jun 29 12:51:30 1996 Ian Lance Taylor + + * binutils-all/objcopy.exp: Simple copy test works for i960 b.out + targets. + +Mon Jun 24 14:33:04 1996 Ian Lance Taylor + + * binutils-all/objcopy.exp: On OSF/1, the simple copy test will + succeed with gas, and fail with /bin/as, so mark it as an expected + failure only if it fails. + +Tue Mar 26 16:55:08 1996 Jeffrey A Law (law@cygnus.com) + + * binutils-all/objcopy.exp: No longer expect adjust-section-vma + test to fail for hppa*-*-proelf*. + +Mon Mar 11 08:25:14 1996 Jeffrey A Law (law@cygnus.com) + + * binutils-all/objdump.exp: Look for "$CODE$", not just "CODE". + +Wed Jan 31 11:55:13 1996 Jeffrey A Law (law@cygnus.com) + + * binutils-all/objcopy.exp: Expect adjust-section-vma tests to + fail for hppa*-*-proelf* targets. + +Thu Jan 25 13:53:04 1996 Ian Lance Taylor + + * binutils-all/objdump.exp: Update for objdump -h format change. + * binutils-all/objcopy.exp: Likewise. + +Mon Jan 15 18:14:14 1996 Ian Lance Taylor + + * binutils-all/objcopy.exp: Use the lma, not the vma, when testing + address adjustments. + +Fri Dec 15 16:31:55 1995 Ian Lance Taylor + + * binutils-all/objdump.exp: Update objdump -i test for current + objdump output. + +Mon Nov 27 15:15:09 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Correct fail calls to always use the + same string as the pass call. + +Wed Nov 22 13:18:58 1995 Ian Lance Taylor + + * lib/utils-lib.exp (prune_system_crud): Discard -g -O warnings + from native compilers on OSF/1 and SunOS. + +Fri Nov 17 10:36:09 1995 Ian Lance Taylor + + * lib/utils-lib.exp (default_binutils_compiler: Change error + message to say compilation rather than assembly. + +Wed Nov 15 18:34:42 1995 Ken Raeburn + + * binutils-all/objcopy.exp: Simple copy test does appear to work + on i*86-svr4. + +Wed Nov 15 12:19:28 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: If assembly fails, call unresolved. + Test running objcopy and strip on a final executable. + * binutils-all/testprog.c: New file. + * config/default.exp (STRIP, STRIPFLAGS): Define. + (binutils_compile): New procedure. + * lib/utils-lib.exp (default_binutils_compile): New procedure. + +Fri Nov 3 13:22:33 1995 Ian Lance Taylor + + * lib/utils-lib.exp (default_binutils_run): Don't use verbose + -log, reverting part of Oct 2 change. + +Wed Nov 1 15:09:57 1995 Manfred Hollstein KS/EF4A 60/1F/110 #40283 + + * binutils-all/objcopy.exp: Add setup_xfails for + m68*-motorola-sysv* and m88*-motorola-sysv*. + +Wed Oct 4 14:38:31 1995 Ian Lance Taylor + + * binutils-all/nm.exp: Add setup_xfails for XCOFF. + +Mon Oct 2 12:41:48 1995 Ian Lance Taylor + + * binutils-all/ar.exp: New file. + * binutils-all/bintest.s: Make text_symbol and data_symbol global. + Add new static symbols static_text_symbol and static_data_symbol. + * binutils-all/nm.exp: Adjust accordingly. + * config/default.exp (AR): Set if not set. + (binutils_remove): New procedure. + * lib/utils-lib.exp (default_binutils_run): Call + prune_system_crud on program output. Use verbose -log instead of + both verbose and send_log. + (default_binutils_remove): New procedure. + + * lib/utils-lib.exp (default_binutils_assemble): Call + prune_system_crud on assembler output. + +Tue Sep 26 14:07:05 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Add setup_xfails for simple copy test + for i386 COFF targets. + +Wed Sep 13 13:20:21 1995 Ian Lance Taylor + + * lib/utils-lib.exp (prune_system_crud): Define if not defined. + * binutils-all/objcopy.exp: Call prune_system_crud on cmp output. + +Sat Aug 19 17:38:06 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Add xfail for i*86-*-aout* for simple + copy test. + +Wed Aug 16 16:52:53 1995 Ian Lance Taylor + + * binutils-all/nm.exp: Add setup_xfail for mips*-sony-bsd* for + tests which fail on ECOFF targets. + + * binutils-all/objcopy.exp: Change i*86-*-linux xfail for simple + copy test to check for i*86-*-linuxaout* instead. + +Tue Aug 8 17:48:37 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Add setup_xfail for a29k-*-vxworks* + for simple copy test. + +Tue Jul 25 11:57:12 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Change setup_xfail for simple copy + test from i960-*-vxworks5.1 to i960-*-vxworks*. + +Mon Jul 10 12:25:46 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Add setup_xfail for z8*-*-coff for + simple copy test. + * binutils-all/objdump.exp (cpus_expected): Add z8001 and z8002. + +Sun May 21 20:32:53 1995 Jeff Law (law@snake.cs.utah.edu) + + * binutils-all/hppa/objdump.exp (addendbug): Handle PA ELF targets + too. + * binutils-all/objcopy.exp (simple copy): Don't expect PA ELF + targets to fail. + +Tue Apr 4 14:52:08 1995 Jeff Law (law@snake.cs.utah.edu) + + * binutils-all/hppa: Renamed from binutils-hppa. + +Wed Mar 29 12:02:43 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Add setup_xfail for simple copy test + for h8500-*-hms and h8500-*-coff. + +Tue Mar 28 11:18:28 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Add setup_xfail for simple copy test + for m68*-ericsson-ose and m88*-*-coff. + +Mon Mar 27 11:27:31 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Add setup_xfail for simple copy test + for m68*-*-vxworks*. + +Fri Mar 24 11:44:25 1995 Ian Lance Taylor + + * binutils-hppa/objdump.exp: Correct hppa*-*-* check. + +Tue Mar 21 10:48:45 1995 Jeff Law (law@snake.cs.utah.edu) + + * binutils-hppa/addendbug.s: New testcase. + * binutils-hppa/objdump.exp: Run it. + +Mon Mar 20 11:31:05 1995 Ian Lance Taylor + + * lib/utils-lib.exp (default_binutils_run): Quote any dollar signs + in progargs before passing it to exec. + +Fri Mar 17 16:39:31 1995 Jeff Law (law@snake.cs.utah.edu) + + * config/hppa.sed: Sed script to transform bintest.s into proper + PA assembly code. + * binutils-all/nm.exp: Enable these tests on the PA. + * binutils-all/objcopy.exp: Enable these tests on the PA. Expect + simple copy to fail. + * binutils-all/objdump.exp: Enable these tests on the PA. Handle + "CODE" as a section name. + * binutils-all/size.exp: Enable these tests on the PA. + * lib/utils-lib.exp (default_binutils_assemble): For "hppa*-*-*", + run the assembly through a sed script before passing it to the + assembler. + +Wed Mar 15 16:47:13 1995 Ian Lance Taylor + + * binutils-all/objdump.exp: Force section sizes to be interpreted + in hex. Change objdump -h failure mode to always use the same + string. + +Thu Jan 5 13:01:43 1995 Ian Lance Taylor + + * binutils-all/nm.exp: Just check for irix4*, rather than + irix\[0-4\]*, to avoid DejaGnu bug. + +Thu Dec 15 19:35:31 1994 Ken Raeburn + + * binutils-all/objcopy.exp: Expect simple-objcopy test to fail + for various other targets for which gas doesn't use bfd: sh-hms, + m68k-hpux, m68k-sunos, m68k-coff, i386-linux, a29k-udi, a29k-coff, + i960-vxworks5.1, i960-coff, h8300-hms, h8300-coff. + +Wed Dec 14 15:54:46 1994 Ken Raeburn + + * binutils-all/size.exp: Skip tests requiring bintest.o on hppa, + since it (correctly) generates syntax errors on that platform. + * binutils-all/objdump.exp: Ditto. + * binutils-all/nm.exp: Ditto. + * binutils-all/objcopy.exp: Ditto. Also, move setup_xfail for + sh-coff to branch where objcopy execution produced no error + messages. Expect failure for hp300 also. + +Thu Dec 8 14:36:15 1994 Ken Raeburn + + * binutils-all/objdump.exp (cpus_expected): New variable, taken + from objdump -i test, added ns32k and powerpc, sorted. + (objdump -i, -f tests): Use $cpus_expected. + + * binutils-all/objcopy.exp: For simple-copy test, expect failure + for sh-coff. + +Tue Oct 25 16:00:14 1994 Ian Lance Taylor + + * binutils-all/objcopy.exp: Adjust --adjust-section-vma tests for + new S-record section handling. + +Tue Oct 18 11:18:21 1994 Ian Lance Taylor + + * binutils-all/nm.exp: nm with no arguments and nm -P do not work + as expected on ECOFF targets; add calls to setup_xfail. + + * binutils-all/objcopy.exp: New file. + * config/default.exp: Initialize OBJCOPY and OBJCOPYFLAGS. + +Fri Oct 14 14:46:22 1994 Ian Lance Taylor + + Rewrite testsuite. + * configure.in, Makefile.in: Remove. + * binutils-all/configure.in, binutils-all/Makefile.in: Remove. + * binutils-all/bintest.c: Remove. + * binutils-all/bintest.s: New file. + * binutils-all/nm.exp, binutils-all/objdump.exp: Rewrite. + * binutils-all/size.exp: Rewrite. + * config/default.exp: Load utils-lib.exp. Set AS and ASFLAGS. + Don't go up one directory from $base_dir. Create tmpdir. + (binutils_run, binutils-assemble): New procedures. + * config/unix.exp: Remove. + * config/mt-a29k-udi, config/mt-i386-aout: Remove. + * config/mt-i960-nindy, config/mt-lynx, config/mt-m68k: Remove. + * config/mt-mips-ecoff, config/mt-slite: Remove. + * config/mt-sparc-aout, config/mt-vxworks: Remove. + * lib/utils-lib.exp (binutil_version): Don't redirect standard + input when getting version. Don't unset errorInfo. + (default_binutils_run): New procedure. + (default_binutils_assemble): New procedure. + +Thu Sep 29 12:45:39 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + + * VMS does not permit `.' in directory names: renamed binutils.all + to binutils-all. + * configure.in (configdirs): Change binutils.all to binutils-all. + +Fri Sep 23 16:01:14 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + + * configure.in: Use mt-m68k for m68k*-*-aout* and m68k*-*-coff*, + not for m68k-*-*. + +Fri Sep 23 13:54:50 1994 Ken Raeburn + + * binutils.all/objdump.exp: Added ARM to list of CPU types. + +Thu Sep 22 11:04:50 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + + * binutils.all/objdump.exp: Update for new usage message. + * binutils.all/size.exp: Use a double backslash in the string to + get a single backslash to the regexp matcher. Accept $TEXT$, + $DATA$ and $BSS$ as well as .text, .data and .bss, for HP/UX. + +Fri Sep 2 12:53:10 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + + * config/unix.exp: If nm.new does not exist, use [transform nm]. + * config/default.exp: Likewise. + +Wed Aug 24 12:41:37 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + + * configure.in, binutils.all/configure.in: Change i386 to + i[345]86. + +Tue Jul 19 15:23:53 1994 Bill Cox (bill@rtl.cygnus.com) + + * config/mt-mips-ecoff: Add -Tidp.ld option. + +Thu Jun 30 12:41:55 1994 J.T. Conklin (jtc@phishhead.cygnus.com) + + * config/default.exp: Use nm.new, not nm, from newly built tree. + +Tue May 17 14:04:05 1994 Bill Cox (bill@rtl.cygnus.com) + + * config/default.exp, config/unix.exp: Replace error + proc calls with perror. + +Tue May 10 11:20:54 1994 Stan Shebs (shebs@andros.cygnus.com) + + * configure.in (sparclite): Match on sparclite*-*-*. + +Wed Apr 13 18:25:19 1994 Ken Raeburn (raeburn@cujo.cygnus.com) + + * config/unix.exp: Use nm.new, not nm, from newly built tree. + + * binutils.all/objdump.exp: Add more wildcards to list of + single-letter options in pattern for usage message. + + * binutils.all/nm.exp: Deleted debug-symbols test, since it only + works for a.out/stabs systems. Fixed regexps to make underscores + optional, since some C compilers don't prepend them. Deleted + check for foo.o symbol, since again some systems don't generate + it. + +Mon Apr 11 10:31:00 1994 Bill Cox (bill@rtl.cygnus.com) + + * Makefile.in (check): Set TCL_LIBRARY for runtest. + +Mon Feb 14 19:34:03 1994 Rob Savoye (rob@darkstar.cygnus.com) + + * Makefile.in: Use new config features of DejaGnu in site.exp + file. "Make check" should now work for all crosses. + +Fri Jan 28 18:00:29 1994 Ken Raeburn (raeburn@cujo.cygnus.com) + + * binutils.all/objdump.exp: In usage message, accept + "section-name" as well as "section_name". + +Mon Jan 17 16:57:02 1994 Ken Raeburn (raeburn@cujo.cygnus.com) + + * binutils.all/objdump.exp: Trim list of format names expected, + and accept any known CPU type. + +Thu Dec 2 20:50:24 1993 Rob Savoye (rob@darkstar.cygnus.com) + + * Makefile.in: Remove some stuff from the site.exp file. + * config/unix.exp: Add global before seeing if the variables for + nm, objdump, and size exist. + +Wed Nov 3 11:12:32 1993 Rob Savoye (rob@darkstar.cygnus.com) + + * config/udi.exp,unix.exp: Transform tool name. + * binutils.all/*.exp: Clear errorInfo after exec. + +Fri Jul 2 12:41:20 1993 Ian Lance Taylor (ian@cygnus.com) + + * binutils.all/*.exp: Use -- for long arguments rather than +. + +Fri Jun 4 10:52:29 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) + + * configure.in: change srctrigger to Makefile.in + +Wed May 26 17:27:46 1993 Ian Lance Taylor (ian@cygnus.com) + + * Makefile.in (FLAGS_TO_PASS): Pass down CC and CFLAGS. + +Fri May 7 13:58:44 1993 Ian Lance Taylor (ian@cygnus.com) + + * binutils.all/objdump.exp: Update for new usage message. + +Mon Apr 19 14:08:52 1993 Rob Savoye (rob@darkstar.cygnus.com) + + * binutils.all/*.exp: Use the new util_test proc. + * Makefile.in: Create a local site.exp file with config info. + +Thu Mar 25 05:38:47 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) + + * nm.all/configure.in (srcname): Delete extra quote. + +Mon Feb 22 07:54:03 1993 Mike Werner (mtw@poseidon.cygnus.com) + + * binutils/testsuite: made modifications to testcases, etc., to allow + them to work properly given the reorganization of deja-gnu and the + relocation of the testcases from deja-gnu to a "tool" subdirectory. + +Sun Feb 21 10:55:55 1993 Mike Werner (mtw@poseidon.cygnus.com) + + * binutils/testsuite: Initial creation of binutils/testsuite. + Migrated dejagnu testcases and support files for testing nm to + binutils/testsuite from deja-gnu. These files were moved "as is" + with no modifications. This migration is part of a major overhaul + of dejagnu. The modifications to these testcases, etc., which + will allow them to work with the new version of dejagnu will be + made in a future update. + diff --git a/binutils/testsuite/binutils-all/ar.exp b/binutils/testsuite/binutils-all/ar.exp new file mode 100644 index 0000000..4b38c6b --- /dev/null +++ b/binutils/testsuite/binutils-all/ar.exp @@ -0,0 +1,219 @@ +# Copyright (C) 1995, 1997 Free Software Foundation, Inc. + +# This program 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# Written by Ian Lance Taylor + +if ![is_remote host] { + if {[which $AR] == 0} then { + perror "$AR does not exist" + return + } +} + +# send_user "Version [binutil_version $AR]" + +# Test long file name support + +proc long_filenames { } { + global AR + global host_triplet + + set testname "ar long file names" + + set n1 "abcdefghijklmnopqrstuvwxyz1" + set n2 "abcdefghijklmnopqrstuvwxyz2" + set file1 tmpdir/$n1 + set file2 tmpdir/$n2 + + remote_file build delete $file1 + + # Some file systems truncate file names at 14 characters, which + # makes it impossible to run this test. Check for that now. + set status [catch "set f [open tmpdir/$n1 w]" errs] + if { $status != 0 } { + verbose -log "open tmpdir/$n1 returned $errs" + unsupported $testname + return + } + puts $f "first" + close $f + + + remote_file build delete $file2 + + set status [catch "set f [open tmpdir/$n2 w]" errs] + if { $status != 0 } { + verbose -log "open tmpdir/$n2 returned $errs" + unsupported $testname + return + } + puts $f "second" + close $f + + if [is_remote host] { + set file1 [remote_download host $file1]; + set file2 [remote_download host $file2]; + set dest artest.a + } else { + set dest tmpdir/artest.a + } + + remote_file host delete $dest; + + set got [binutils_run $AR "rc $dest $file1 $file2"] + if [is_remote host] { + remote_upload host $file1 tmpdir/$n1 + } + + set f [open tmpdir/$n1 r] + gets $f string + close $f + if ![string match "first" $string] { + verbose -log "reading tmpdir/$n1 returned $string" + unsupported $testname + return + } + + remote_file host delete $dest; + set got [binutils_run $AR "rc $dest $file1 $file2"] + + if ![string match "" $got] { + fail $testname + return + } + + remote_file build delete tmpdir/$n1 + remote_file build delete tmpdir/$n2 + + set got [binutils_run $AR "t $dest"] + regsub "\[\r\n \t\]*$" "$got" "" got; + if ![string match "$n1*$n2" $got] { + fail $testname + return + } + + if [is_remote host] { + remote_file host delete $file1; + remote_file host delete $file2; + } + + verbose -log "$AR x $dest" + set exec_output [binutils_run $AR "x $dest"] + set exec_output [prune_warnings $exec_output] + if ![string match "" $exec_output] { + verbose -log $exec_output + fail $testname + return + } + + if [is_remote host] { + remote_upload host $n1 tmpdir/$n1; + remote_upload host $n2 tmpdir/$n2; + set file1 tmpdir/$n1 + set file2 tmpdir/$n2 + } else { + set file1 $n1 + set file2 $n2 + } + + if ![file exists $file1] { + verbose -log "$file1 does not exist" + fail $testname + return + } + if ![file exists $file2] { + verbose -log "$file2 does not exist" + fail $testname + return + } + + set f [open $file1 r] + if { [gets $f line] == -1 || $line != "first" } { + verbose -log "$file1 contents:" + verbose -log "$line" + close $f + fail $testname + return + } + close $f + + set f [open $file2 r] + if { [gets $f line] == -1 || $line != "second" } { + verbose -log "$file2 contents:" + verbose -log "$line" + close $f + fail $testname + return + } + close $f + + pass $testname +} + +# Test building the symbol table. + +proc symbol_table { } { + global AR + global AS + global NM + global srcdir + global subdir + + set testname "ar symbol table" + + if ![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o] { + unresolved $testname + return + } + + if [is_remote host] { + set archive artest.a + set objfile [remote_download host tmpdir/bintest.o] + remote_file host delete $archive + } else { + set archive tmpdir/artest.a + set objfile tmpdir/bintest.o + } + + remote_file build delete tmpdir/artest.a + + set got [binutils_run $AR "rc $archive ${objfile}"] + if ![string match "" $got] { + fail $testname + return + } + + set got [binutils_run $NM "--print-armap $archive"] + if { ![string match "*text_symbol in bintest.o*" $got] \ + || ![string match "*data_symbol in bintest.o*" $got] \ + || ![string match "*common_symbol in bintest.o*" $got] \ + || [string match "*static_text_symbol in bintest.o*" $got] \ + || [string match "*static_data_symbol in bintest.o*" $got] \ + || [string match "*external_symbol in bintest.o*" $got] } { + fail $testname + return + } + + pass $testname +} + +# Run the tests. + +long_filenames +symbol_table diff --git a/binutils/testsuite/binutils-all/bintest.s b/binutils/testsuite/binutils-all/bintest.s new file mode 100644 index 0000000..9e00650 --- /dev/null +++ b/binutils/testsuite/binutils-all/bintest.s @@ -0,0 +1,12 @@ + .globl text_symbol + .text +text_symbol: +static_text_symbol: + .long 1 + .long external_symbol + .globl data_symbol + .data +data_symbol: +static_data_symbol: + .long 2 + .comm common_symbol,4 diff --git a/binutils/testsuite/binutils-all/hppa/addendbug.s b/binutils/testsuite/binutils-all/hppa/addendbug.s new file mode 100644 index 0000000..659306f --- /dev/null +++ b/binutils/testsuite/binutils-all/hppa/addendbug.s @@ -0,0 +1,23 @@ + .SPACE $PRIVATE$ + .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31 + .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82 + .SPACE $TEXT$ + .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44 + .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY + .IMPORT $global$,DATA + .IMPORT $$dyncall,MILLICODE +; gcc_compiled.: + .SPACE $TEXT$ + .SUBSPA $CODE$ + + .align 4 + .EXPORT initialize_char_syntax,CODE + .EXPORT initialize_char_syntax,ENTRY,PRIV_LEV=3,RTNVAL=GR +initialize_char_syntax + .PROC + .CALLINFO FRAME=64,NO_CALLS,SAVE_SP,ENTRY_GR=3 + .ENTRY + addil L'is_idchar-$global$-32,%r27 + .EXIT + .PROCEND +is_idchar .comm 256 diff --git a/binutils/testsuite/binutils-all/hppa/objdump.exp b/binutils/testsuite/binutils-all/hppa/objdump.exp new file mode 100644 index 0000000..a46b289 --- /dev/null +++ b/binutils/testsuite/binutils-all/hppa/objdump.exp @@ -0,0 +1,59 @@ +# Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc. + +# This program 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file was written by Rob Savoye +# and rewritten by Ian Lance Taylor + +if ![istarget hppa*-*-*] then { + return +} + +if {[which $OBJDUMP] == 0} then { + perror "$OBJDUMP does not exist" + return +} + +send_user "Version [binutil_version $OBJDUMP]" + +if {![binutils_assemble $srcdir/$subdir/addendbug.s tmpdir/addendbug.o]} then { + return +} + +if [is_remote host] { + set objfile [remote_download host tmpdir/addendbug.o] +} else { + set objfile tmpdir/addendbug.o +} + +# Make sure the SOM BFD code sign extends constants in R_DATA_OVERRIDE fixups. + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r $objfile"] + +if [istarget hppa*-*-*elf*] then { + set want "00000000 R_PARISC_DPREL21L\[ \]+is_idchar\\+0xffffffe0.*" +} else { + set want "00000000 R_DP_RELATIVE\[ \]+is_idchar\\+0xffffffe0.*" +} + + +if [regexp $want $got] then { + pass "addendbug test" +} else { + fail "addendbug test" +} diff --git a/binutils/testsuite/binutils-all/nm.exp b/binutils/testsuite/binutils-all/nm.exp new file mode 100644 index 0000000..76c7c5f --- /dev/null +++ b/binutils/testsuite/binutils-all/nm.exp @@ -0,0 +1,123 @@ +# Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc. + +# This program 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file was written by Rob Savoye +# and rewritten by Ian Lance Taylor + +if ![is_remote host] { + if {[which $NM] == 0} then { + perror "$NM does not exist" + return + } +} + +send_user "Version [binutil_version $NM]" + + +if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then { + return +} + +if [is_remote host] { + set tempfile [remote_download host tmpdir/bintest.o] +} else { + set tempfile tmpdir/bintest.o +} + +# Test nm with no arguments. + +# This test does not work correctly on ECOFF targets, because ECOFF +# stores most symbols twice, which messes up the nm output. +setup_xfail "alpha*-*-osf*" "alpha*-*-netware*" +setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*" +setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" "mips*-sony-bsd*" + +# This test does not work correctly on XCOFF targets, because XCOFF +# does not enter static symbols in the symbol table. +setup_xfail "*-*-aix*" + +set got [binutils_run $NM "$NMFLAGS $tempfile"] + +if [info exists vars] then { unset vars } +while {[regexp "(\[a-zA-Z\]) (\[a-z_\]*_symbol)(.*)" $got all type symbol rest]} { + set vars($symbol) $type + set got $rest +} + +if {![info exists vars(text_symbol)] \ + || $vars(text_symbol) != "T" \ + || ![info exists vars(data_symbol)] \ + || $vars(data_symbol) != "D" \ + || ![info exists vars(common_symbol)] \ + || $vars(common_symbol) != "C" \ + || ![info exists vars(external_symbol)] \ + || $vars(external_symbol) != "U" \ + || ![info exists vars(static_text_symbol)] \ + || $vars(static_text_symbol) != "t" \ + || ![info exists vars(static_data_symbol)] \ + || $vars(static_data_symbol) != "d"} { + fail "nm (no arguments)" +} else { + pass "nm (no arguments)" +} + +# Test nm -g + +set got [binutils_run $NM "$NMFLAGS -g $tempfile"] + +if [info exists vars] then { unset vars } +while {[regexp "(\[a-z_\]*_symbol)(.*)" $got all symbol rest]} { + set vars($symbol) 1 + set got $rest +} + +if {![info exists vars(text_symbol)] \ + || ![info exists vars(data_symbol)] \ + || ![info exists vars(common_symbol)] \ + || ![info exists vars(external_symbol)] \ + || [info exists vars(static_text_symbol)] \ + || [info exists vars(static_data_symbol)]} { + fail "nm -g" +} else { + pass "nm -g" +} + +# Test nm -P + +# This test does not work correctly on ECOFF targets, because ECOFF +# stores most symbols twice, which messes up the nm output. +setup_xfail "alpha*-*-osf*" "alpha*-*-netware*" +setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*" +setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" "mips*-sony-bsd*" + +# This test does not work correctly on XCOFF targets, because XCOFF +# does not enter static symbols in the symbol table. +setup_xfail "*-*-aix*" + +set got [binutils_run $NM "$NMFLAGS -P $tempfile"] + +set want "common_symbol C \[0\]*4.*data_symbol D \[0-9a-fA-F\]*.*external_symbol U.*static_data_symbol d \[0-9a-fA-F\]*.*static_text_symbol t \[0-9a-fA-F\]*.*text_symbol T \[0-9a-fA-F\]*" + +if [regexp $want $got] then { + pass "nm -P" +} else { + fail "nm -P" +} + +# There are certainly other tests that could be run. diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp new file mode 100644 index 0000000..78972f1 --- /dev/null +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -0,0 +1,591 @@ +# Copyright (C) 1994, 95, 96, 97, 1998 Free Software Foundation, Inc. + +# This program 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# Written by Ian Lance Taylor + +if ![is_remote host] { + if {[which $OBJCOPY] == 0} then { + perror "$OBJCOPY does not exist" + return + } +} + +send_user "Version [binutil_version $OBJCOPY]" + +if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then { + perror "unresolved 1" + unresolved "objcopy (simple copy)" + return +} + +if ![is_remote host] { + set tempfile tmpdir/bintest.o; + set copyfile tmpdir/copy; +} else { + set tempfile [remote_download host tmpdir/bintest.o] + set copyfile copy +} + +# Test that objcopy does not modify a file when copying it. + +set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS $tempfile ${copyfile}.o"] + +if ![string match "" $got] then { + fail "objcopy (simple copy)" +} else { + send_log "cmp $tempfile ${copyfile}.o\n" + verbose "cmp $tempfile ${copyfile}.o" + if [is_remote host] { + set src1 tmpdir/bintest.o + set src2 tmpdir/copy.o + remote_upload host $tempfile $src1; + remote_upload host ${copyfile}.o $src2; + } else { + set src1 ${tempfile} + set src2 ${copyfile}.o + } + set status [remote_exec build cmp "${src1} ${src2}"]; + set exec_output [lindex $status 1]; + set exec_output [prune_warnings $exec_output] + + # On some systems the result of objcopy will not be identical. + # Usually this is just because gas isn't using bfd to write the files + # in the first place, and may order things a little differently. + # Those systems should use setup_xfail here. + + setup_xfail "sh-*-coff" "sh-*-hms" + setup_xfail "m68*-*-hpux*" "m68*-*-sunos*" "m68*-*-coff" "m68*-*-vxworks*" + setup_xfail "m68*-ericsson-ose" "m68k*-motorola-sysv*" + setup_xfail "i*86-*-linuxaout*" "i*86-*-aout*" + setup_xfail "i*86-*-sysv3" "i*86-*-isc*" "i*86-*-sco*" "i*86-*-coff" + setup_xfail "i*86-*-aix*" "i*86-*-go32*" + setup_xfail "a29k-*-udi" "a29k-*-coff" "a29k-*-vxworks*" + setup_xfail "i960-*-coff" + setup_xfail "h8300-*-hms" "h8300-*-coff" + setup_xfail "h8500-*-hms" "h8500-*-coff" + setup_xfail "hppa*-*-*" + clear_xfail "hppa*-*-*elf*" + setup_xfail "m88*-*-coff" "m88*-motorola-sysv*" + setup_xfail "z8*-*-coff" + + if [string match "" $exec_output] then { + pass "objcopy (simple copy)" + } else { + send_log "$exec_output\n" + verbose "$exec_output" 1 + + # On OSF/1, this succeeds with gas and fails with /bin/as. + setup_xfail "alpha*-*-osf*" + + # This fails for COFF i960-vxworks targets. + setup_xfail "i960-*-vxworks*" + + fail "objcopy (simple copy)" + } +} + +# Test generating S records. + +# We make the srec filename 8.3 compatible. Note that the header string +# matched against depends on the name of the file. Ugh. + +if [is_remote host] { + set srecfile copy.sre + set header_string S00B0000636F70792E737265C1 +} else { + set srecfile ${copyfile}.srec + set header_string S0130000746D706469722F636F70792E7372656397 +} + +set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $tempfile ${srecfile}"] + +if ![string match "" $got] then { + fail "objcopy -O srec" +} else { + if [is_remote host] { + remote_upload host ${srecfile} tmpdir/copy.srec; + set srecfile tmpdir/copy.srec; + } + set file [open ${srecfile} r] + + # The first S record is fixed by the file name we are using. + gets $file line + send_log "$line\n" + verbose $line + if ![regexp "$header_string.*" $line] { + send_log "bad header\n" + fail "objcopy -O srec" + } else { + while {[gets $file line] != -1 \ + && [regexp "^S\[123\]\[0-9a-fA-F\]+\[\r\n\]*$" $line]} { + send_log "$line\n" + verbose $line + set line "**EOF**" + } + send_log "$line\n" + verbose $line + if ![regexp "^S\[789\]\[0-9a-fA-F\]+\[\r\n\]*$" $line] then { + send_log "bad trailer\n" + fail "objcopy -O srec" + } else { + if {[gets $file line] != -1} then { + send_log "garbage at end\n" + send_log "$line\n" + verbose $line + fail "objcopy -O srec" + } else { + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${copyfile}.srec"] + if ![regexp "file format srec" $got] then { + send_log "objdump failed\n" + fail "objcopy -O srec" + } else { + pass "objcopy -O srec" + } + } + } + } + + close $file +} + +# Test setting and adjusting the start address. We only test this +# while generating S records, because we may not be able to set the +# start address for other object file formats, and the S record case +# is the only useful one anyhow. + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f $tempfile"] +if ![regexp "start address (\[0-9a-fA-FxX\]+)" $got all origstart] then { + perror "objdump can not recognize bintest.o" + set origstart "" +} else { + set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $tempfile ${copyfile}.srec --set-start 0x7654"] + if ![string match "" $got] then { + fail "objcopy --set-start" + } else { + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${copyfile}.srec"] + if ![regexp "file format srec.*start address (\[0-9a-fA-FxX\]+)" $got all srecstart] then { + fail "objcopy --set-start" + } else { + if {$srecstart != 0x7654} then { + send_log "$srecstart != 0x7654\n" + fail "objcopy --set-start" + } else { + pass "objcopy --set-start" + } + } + } + + set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $tempfile ${copyfile}.srec --adjust-start 0x123"] + if ![string match "" $got] then { + fail "objcopy --adjust-start" + } else { + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${copyfile}.srec"] + if ![regexp "file format srec.*start address (\[0-9a-fA-FxX\]+)" $got all srecstart] then { + fail "objcopy --adjust-start" + } else { + if {$srecstart != $origstart + 0x123} then { + send_log "$srecstart != $origstart + 0x123\n" + fail "objcopy --adjust-start" + } else { + pass "objcopy --adjust-start" + } + } + } +} + +# Test adjusting the overall VMA, and adjusting the VMA of a +# particular section. We again only test this when generating S +# records. + +set low "" +set lowname "" + +set headers [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h $tempfile"] + +set headers_regexp "\[ 0-9\]+(\[^ \]+)\[ \]*(\[0-9a-fA-F\]+)\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)\[ \]+\[0-9a-fA-F\]+\[ \]+2\[*\]\[*\]\[0-9\]+(.*)" + +set got $headers +while {[regexp $headers_regexp $got all name size vma rest]} { + set vma 0x$vma + set size 0x$size + if {$size != 0} { + if {$low == "" || $vma < $low} { + set low $vma + set lowname $name + } + } + set got $rest +} + +if {$low == "" || $origstart == ""} then { + perror "objdump can not recognize bintest.o" +} else { + set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $tempfile ${copyfile}.srec --adjust-vma 0x123"] + if ![string match "" $got] then { + fail "objcopy --adjust-vma" + } else { + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -fh ${copyfile}.srec"] + set want "file format srec.*start address\[ \]*(\[0-9a-fA-FxX\]+).*sec1\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)" + if ![regexp $want $got all start vma] then { + fail "objcopy --adjust-vma" + } else { + set vma 0x$vma + if {$vma != $low + 0x123} then { + send_log "$vma != $low + 0x123\n" + fail "objcopy --adjust-vma" + } else { + if {$start != $origstart + 0x123} then { + send_log "$start != $origstart + 0x123\n" + fail "objcopy --adjust-vma" + } else { + pass "objcopy --adjust-vma" + } + } + } + } + + set arg "" + set got $headers + while {[regexp $headers_regexp $got all name size vma rest]} { + set vma 0x$vma + if {$vma == $low} then { + set arg "$arg --adjust-section-vma $name+4" + } + set got $rest + } + + set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $tempfile ${copyfile}.srec $arg"] + if ![string match "" $got] then { + fail "objcopy --adjust-section-vma +" + } else { + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h ${copyfile}.srec"] + set want "file format srec.*sec1\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)" + if ![regexp $want $got all vma] then { + fail "objcopy --adjust-section-vma +" + } else { + set vma 0x$vma + if {$vma != $low + 4} then { + send_log "$vma != $low + 4\n" + fail "objcopy --adjust-section-vma +" + } else { + pass "objcopy --adjust-section-vma +" + } + } + } + + regsub -all "\\+4" $arg "=[expr $low + 4]" argeq + set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $tempfile ${copyfile}.srec $argeq"] + if ![string match "" $got] then { + fail "objcopy --adjust-section-vma =" + } else { + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h ${copyfile}.srec"] + set want "file format srec.*sec1\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)" + if ![regexp $want $got all vma] then { + fail "objcopy --adjust-section-vma =" + } else { + set vma 0x$vma + if {$vma != $low + 4} then { + send_log "$vma != $low + 4\n" + fail "objcopy --adjust-section-vma =" + } else { + pass "objcopy --adjust-section-vma =" + } + } + } +} + +# Test stripping an object. + +proc strip_test { } { + global CC + global STRIP + global STRIPFLAGS + global NM + global NMFLAGS + global srcdir + global subdir + + set test "strip" + + if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } { + untested $test + return + } + + if [is_remote host] { + set objfile [remote_download host tmpdir/testprog.o]; + } else { + set objfile tmpdir/testprog.o + } + + set exec_output [binutils_run $STRIP "$STRIPFLAGS $objfile"] + if ![string match "" $exec_output] { + fail $test + return + } + + set exec_output [binutils_run $NM "-a $NMFLAGS $objfile"] + if ![string match "*: no symbols*" $exec_output] { + fail $test + return + } + + pass $test +} + +strip_test + +# Test stripping an object file with saving a symbol + +proc strip_test_with_saving_a_symbol { } { + global CC + global STRIP + global STRIPFLAGS + global NM + global NMFLAGS + global srcdir + global subdir + + set test "strip with saving a symbol" + + if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } { + untested $test + return + } + + if [is_remote host] { + set objfile [remote_download host tmpdir/testprog.o]; + } else { + set objfile tmpdir/testprog.o + } + + set exec_output [binutils_run $STRIP "$STRIPFLAGS -K main -K _main $objfile"] + if ![string match "" $exec_output] { + fail $test + return + } + + set exec_output [binutils_run $NM "$NMFLAGS $objfile"] + if {![regexp {^([0-9a-fA-F]+)?[ ]+T main} $exec_output] \ + && ![regexp {^([0-9a-fA-F]+)?[ ]+T _main} $exec_output]} { + fail $test + return + } + + pass $test +} + +strip_test_with_saving_a_symbol + +# Build a final executable. + +proc copy_setup { } { + global srcdir + global subdir + + set res [build_wrapper testglue.o]; + set flags { debug }; + + if { $res != "" } { + lappend flags "additional_flags=[lindex $res 1]"; + set add_libs "testglue.o"; + } else { + set add_libs ""; + } + + if { [target_compile "$srcdir/$subdir/testprog.c $add_libs" tmpdir/testprog executable $flags] != "" } { + return 2 + } + + set result [remote_load target tmpdir/testprog]; + set status [lindex $result 0]; + + if { $status != "pass" } { + perror "unresolved setup, status = $status" + return 3 + } + + return 0 +} + +# Test copying an executable. + +proc copy_executable { prog flags test1 test2 } { + + if [is_remote host] { + set testfile [remote_download host tmpdir/testprog]; + set testcopy copyprog + } else { + set testfile tmpdir/testprog + set testcopy tmpdir/copyprog + } + remote_file host delete $testcopy; + + set exec_output [binutils_run $prog "$flags $testfile $testcopy"] + + if ![string match "" $exec_output] { + fail $test1 + fail $test2 + return + } + + if [is_remote host] { + remote_upload host $testcopy tmpdir/copyprog + } + + set status [remote_exec build "cmp" "tmpdir/testprog tmpdir/copyprog"] + set exec_output [lindex $status 1]; + + if [string match "" $exec_output] then { + pass $test1 + } else { + send_log "$exec_output\n" + verbose "$exec_output" + + # This will fail for many reasons. For example, it will most + # likely fail if a non-GNU linker is used. Therefore, we do + # not insist that it pass. If you are using an assembler and + # linker based on the same BFD as objcopy, it is worth + # investigating to see why this failure occurs. If we are + # cross compiling, we assume that a GNU linker is being used, + # and expect it to succeed. + if {[isnative]} then { + setup_xfail "*-*-*" + } + + # This also fails for mips*-*-elf targets. See elf32-mips.c + # mips_elf_sym_is_global. + setup_xfail "mips*-*-elf" + + fail $test1 + } + + set output [remote_load target tmpdir/copyprog] + set status [lindex $output 0]; + if { $status != "pass" } { + fail $test2 + } else { + pass $test2 + } +} + +# Test stripping an executable + +proc strip_executable { prog flags test } { + global NM + global NMFLAGS + + remote_download build tmpdir/copyprog tmpdir/striprog + if [is_remote host] { + set copyfile [remote_download host tmpdir/striprog]; + } else { + set copyfile tmpdir/striprog + } + + set exec_output [binutils_run $prog "$flags ${copyfile}"] + if ![string match "" $exec_output] { + fail $test + return + } + + if [is_remote host] { + remote_upload host ${copyfile} tmpdir/striprog; + } + + set result [remote_load target tmpdir/striprog] + set status [lindex $result 0]; + if { $status != "pass" } { + fail $test + return + } + + set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"] + if ![string match "*: no symbols*" $exec_output] { + fail $test + return + } + pass $test +} + +# Test stripping an executable with saving a symbol + +proc strip_executable_with_saving_a_symbol { prog flags test } { + global NM + global NMFLAGS + + remote_download build tmpdir/copyprog tmpdir/striprog + if [is_remote host] { + set copyfile [remote_download host tmpdir/striprog]; + } else { + set copyfile tmpdir/striprog + } + + set exec_output [binutils_run $prog "$flags ${copyfile}"] + if ![string match "" $exec_output] { + fail $test + return + } + + if [is_remote host] { + remote_upload host ${copyfile} tmpdir/striprog; + } + + set result [remote_load target tmpdir/striprog] + set status [lindex $result 0]; + if { $status != "pass" } { + fail $test + return + } + + set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"] + if {![regexp {^[0-9a-fA-F]+ T main} $exec_output] \ + && ![regexp {^[0-9a-fA-F]+ T _main} $exec_output]} { + fail $test + return + } + pass $test +} + +set test1 "simple objcopy of executable" +set test2 "run objcopy of executable" +set test3 "run stripped executable" +set test4 "run stripped executable with saving a symbol" + +switch [copy_setup] { + "1" { + # do nothing + } + "2" { + untested $test1 + untested $test2 + untested $test3 + untested $test4 + } + "3" { + unresolved $test1 + unresolved $test2 + unresolved $test3 + unresolved $test4 + } + "0" { + copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" "$test2" + strip_executable "$STRIP" "$STRIPFLAGS" "$test3" + strip_executable_with_saving_a_symbol "$STRIP" "-K main -K _main $STRIPFLAGS" "$test4" + } +} diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp new file mode 100644 index 0000000..7c50f02 --- /dev/null +++ b/binutils/testsuite/binutils-all/objdump.exp @@ -0,0 +1,140 @@ +# Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + +# This program 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file was written by Rob Savoye +# and rewritten by Ian Lance Taylor + +if ![is_remote host] { + if {[which $OBJDUMP] == 0} then { + perror "$OBJDUMP does not exist" + return + } +} + +send_user "Version [binutil_version $OBJDUMP]" + +# Simple test of objdump -i + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -i"] + +set cpus_expected "(a29k|alliant|alpha|arc|arm|convex|d10v|d30v|h8|hppa|i386|i860|i960|m32r|m68k|m88k|mips|mn10200|mn10300|ns32k|powerpc|pyramid|romp|rs6000|sh|sparc|tahoe|v850|vax|we32k|z8k|z8001|z8002)" + +# Make sure the target CPU shows up in the list. +if ![regexp $cpus_expected $target_cpu] { + regsub "^\[(\]" "$cpus_expected" "(${target_cpu}|" cpus_expected; +} + +set want "BFD header file version.*srec.*header .* endian.*, data .* endian.*$cpus_expected" + +if [regexp $want $got] then { + pass "objdump -i" +} else { + fail "objdump -i" +} + +# The remaining tests require a test file. + + +if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then { + return +} +if [is_remote host] { + set testfile [remote_download host tmpdir/bintest.o] +} else { + set testfile tmpdir/bintest.o +} + +# Test objdump -f + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f $testfile"] + +set want "$testfile:\[ \]*file format.*architecture:\[ \]*${cpus_expected}.*HAS_RELOC.*HAS_SYMS" + +if ![regexp $want $got] then { + fail "objdump -f" +} else { + pass "objdump -f" +} + +# Test objdump -h + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h $testfile"] + +set want "$testfile:\[ \]*file format.*Sections.*\[0-9\]+\[ \]+\[^ \]*(text|TEXT|\\\$CODE\\\$)\[^ \]*\[ \]*(\[0-9a-fA-F\]+).*\[0-9\]+\[ \]+\[^ \]*(\\.data|DATA)\[^ \]*\[ \]*(\[0-9a-fA-F\]+)" + +if ![regexp $want $got all text_name text_size data_name data_size] then { + fail "objdump -h" +} else { + verbose "text name is $text_name size is $text_size" + verbose "data name is $data_name size is $data_size" + if {[expr "0x$text_size"] < 8 || [expr "0x$data_size"] < 4} then { + send_log "sizes too small\n" + fail "objdump -h" + } else { + pass "objdump -h" + } +} + +# Test objdump -t + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -t $testfile"] + +if [info exists vars] then { unset vars } +while {[regexp "(\[a-z\]*_symbol)(.*)" $got all symbol rest]} { + set vars($symbol) 1 + set got $rest +} + +if {![info exists vars(text_symbol)] \ + || ![info exists vars(data_symbol)] \ + || ![info exists vars(common_symbol)] \ + || ![info exists vars(external_symbol)]} then { + fail "objdump -t" +} else { + pass "objdump -t" +} + +# Test objdump -r + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r $testfile"] + +set want "$testfile:\[ \]*file format.*RELOCATION RECORDS FOR \\\[\[^\]\]*(text|TEXT|\\\$CODE\\\$)\[^\]\]*\\\].*external_symbol" + +if [regexp $want $got] then { + pass "objdump -r" +} else { + fail "objdump -r" +} + +# Test objdump -s + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s $testfile"] + +set want "$testfile:\[ \]*file format.*Contents.*(text|TEXT|\\\$CODE\\\$)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000001|01000000).*Contents.*(data|DATA)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000002|02000000)" + +if [regexp $want $got] then { + pass "objdump -s" +} else { + fail "objdump -s" +} + +# Options which are not tested: -a -d -D -R -T -x -l --stabs +# I don't see any generic way to test any of these other than -a. +# Tests could be written for specific targets, and that should be done +# if specific problems are found. diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp new file mode 100644 index 0000000..b2f744c --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.exp @@ -0,0 +1,217 @@ +# Copyright (C) 1999 Free Software Foundation, Inc. + +# This program 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# Written by Nick Clifto +# Based on scripts written by Ian Lance Taylor +# and Ken Raeburn . + +# First some helpful procedures, then the tests themselves + +# Return the contents of the filename given +proc file_contents { filename } { + set file [open $filename r] + set contents [read $file] + close $file + return $contents +} + +# regexp_diff, based on simple_diff taken from ld test suite +# compares two files line-by-line +# file1 contains strings, file2 contains regexps and #-comments +# blank lines are ignored in either file +# returns non-zero if differences exist +# +proc regexp_diff { file_1 file_2 } { + + set eof -1 + set end_1 0 + set end_2 0 + set differences 0 + set diff_pass 0 + + if [file exists $file_1] then { + set file_a [open $file_1 r] + } else { + warning "$file_1 doesn't exist" + return 1 + } + + if [file exists $file_2] then { + set file_b [open $file_2 r] + } else { + fail "$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 } { + 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 + } + 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 { + verbose "regexp \"^$line_b$\"\nline \"$line_a\"" 3 + if ![regexp "^$line_b$" "$line_a"] { + send_log "regexp_diff match failure\n" + send_log "regexp \"^$line_b$\"\nline \"$line_a\"\n" + set differences 1 + break + } + } + } + + 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 + } + + close $file_a + close $file_b + + return $differences +} + +# Run an individual readelf test. +# Basically readelf is run on the binary_file with the given options. +# Readelf's output is captured and then compared against the contents +# of the regexp_file. + +proc readelf_test { options binary_file regexp_file xfails } { + + global READELF + global READELFFLAGS + global srcdir + global subdir + + send_log "exec $READELF $READELFFLAGS $options $binary_file > readelf.out" + catch "exec $READELF $READELFFLAGS $options $binary_file > readelf.out" got + + if { [llength $xfails] != 0 } then { + setup_xfail $xfails + } + + if ![string match "" $got] then { + send_log $got + fail "readelf $options" + return + } + + if { [regexp_diff readelf.out $srcdir/$subdir/$regexp_file] } then { + fail "readelf $options" + verbose "output is \n[file_contents readelf.out]" 2 + return + } + + pass "readelf $options" +} + + + +# Only ELF based toolchains need readelf. +# For now be paranoid and assume that if ELF is not mentioned +# in the target string, then the target is not an ELF based port. + +if ![istarget "*-*elf"] then { + verbose "$READELF is only intenteded for ELF targets" 2 + return +} + +if ![is_remote host] { + if {[which $READELF] == 0} then { + perror "$READELF does not exist" + return + } +} + +send_user "Version [binutil_version $READELF]" + +# Assemle the test file. +if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then { + perror "unresolved 1" + unresolved "readelf - failed to assemble" + return +} + +if ![is_remote host] { + set tempfile tmpdir/bintest.o; +} else { + set tempfile [remote_download host tmpdir/bintest.o] +} + +# Run the tests +readelf_test -h $tempfile readelf.h {} + +# The v850 fails the next two tests because it creates two special +# sections of its own: .call_table_data and .call_table_text +# The regexp scripts are not expecting these sections... + +readelf_test -S $tempfile readelf.s {v850*-*-*} +readelf_test -s $tempfile readelf.ss {v850*-*-*} +readelf_test -r $tempfile readelf.r {} + + +# Compile the second test file. +if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } { + untested "readelf -w" + return +} + +if [is_remote host] { + set tempfile [remote_download host tmpdir/testprog.o]; +} else { + set tempfile tmpdir/testprog.o +} + +# The xfail targets here do not default to DWARF2 format debug information +# The symptom is that the output of 'readelf -wi' is empty. + +readelf_test -wi $tempfile readelf.wi {v850*-*-*} diff --git a/binutils/testsuite/binutils-all/readelf.h b/binutils/testsuite/binutils-all/readelf.h new file mode 100644 index 0000000..555afe9 --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.h @@ -0,0 +1,16 @@ +ELF Header: + Magic: 7f 45 4c 46 0[12] 0[12] 01 00 00 00 00 00 00 00 00 00 + Type: REL \(Relocatable file\) + Machine: .* + Version: 0x1 + Data: ELFDATA.* endian\) + Entry point address: 0x0 + Start of program headers: 0 \(bytes into file\) + Start of section headers: .* \(bytes into file\) + Flags: .* + Size of this header: .* \(bytes\) + Size of program headers: 0 \(bytes\) + Number of program headers: 0 + Size of section headers: .* \(bytes\) + Number of section headers: .* + Section header string table index: .* diff --git a/binutils/testsuite/binutils-all/readelf.r b/binutils/testsuite/binutils-all/readelf.r new file mode 100644 index 0000000..4bea721 --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.r @@ -0,0 +1,4 @@ + +Relocation section '.rel.*text' at offset 0x.* contains 1 entries: + Offset Info Type Symbol's Value Symbol's Name.* + 00000004 00.* R_.* 00000000 external_symbol.* diff --git a/binutils/testsuite/binutils-all/readelf.s b/binutils/testsuite/binutils-all/readelf.s new file mode 100644 index 0000000..58b1245 --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.s @@ -0,0 +1,13 @@ +There are .* section headers, starting at offset .*: + +Section Headers: + \[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al + \[ 0\] NULL 00000000 000000 000000 00 0 0 0 + \[ 1\] .text PROGBITS 00000000 000034 000008 00 AX 0 0 . + \[ 2\] .rel.+text +REL. +0+ 0+.* 00000. 0. . 1 4 + \[ 3\] .data PROGBITS 00000000 00003c 000004 00 WA 0 0 . + \[ 4\] .bss NOBITS 00000000 000040 000000 00 WA 0 0 . + \[ 5\] .shstrtab STRTAB 00000000 000040 0000.* 00 0 0 . + \[ 6\] .symtab SYMTAB 00000000 0+.* 0+.* 10 7 6 4 + \[ 7\] .strtab STRTAB 00000000 0+.* 0+.* 00 0 0 1 + diff --git a/binutils/testsuite/binutils-all/readelf.ss b/binutils/testsuite/binutils-all/readelf.ss new file mode 100644 index 0000000..3760b38 --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.ss @@ -0,0 +1,13 @@ + +Symbol table '.symtab' contains .* entries: + Num: Value Size Type Bind Ot Ndx Name + 0: 0 0 NOTYPE LOCAL 0 UND + 1: 0 0 SECTION LOCAL 0 1 + 2: 0 0 SECTION LOCAL 0 3 + 3: 0 0 SECTION LOCAL 0 4 + 4: 0 0 NOTYPE LOCAL 0 1 static_text_symbol + 5: 0 0 NOTYPE LOCAL 0 3 static_data_symbol + .: 0 0 NOTYPE GLOBAL 0 1 text_symbol + .: 0 0 NOTYPE GLOBAL 0 UND external_symbol + .*: 0 0 NOTYPE GLOBAL 0 3 data_symbol + .*: 4 4 OBJECT GLOBAL 0 COM common_symbol diff --git a/binutils/testsuite/binutils-all/readelf.wi b/binutils/testsuite/binutils-all/readelf.wi new file mode 100644 index 0000000..3cb2ecc --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.wi @@ -0,0 +1,78 @@ +The section .debug_info contains: + + Compilation Unit: + Length: .* + Version: 2 + Abbrev Offset: 0 + Pointer Size: 4 + Abbrev Number: 1 \(DW_TAG_compile_unit\) + DW_AT_name : .*/testprog.c + DW_AT_comp_dir : .*/binutils + DW_AT_producer : GNU C .* + DW_AT_language : 1 \(ANSI C\) + DW_AT_low_pc : 0 + DW_AT_high_pc : .* + DW_AT_stmt_list : 0 + Abbrev Number: 2 \(DW_TAG_subprogram\) + DW_AT_external : 1 + DW_AT_name : fn + DW_AT_decl_file : 1 + DW_AT_decl_line : a + DW_AT_type : .* + DW_AT_low_pc : 0 + DW_AT_high_pc : .* + DW_AT_frame_base : 1 byte block: .* + Abbrev Number: 3 \(DW_TAG_base_type\) + DW_AT_name : int + DW_AT_byte_size : 4 + DW_AT_encoding : 5 \(signed\) + Abbrev Number: 4 \(DW_TAG_subprogram\) + DW_AT_sibling : .* + DW_AT_external : 1 + DW_AT_name : main + DW_AT_decl_file : 1 + DW_AT_decl_line : 10 + DW_AT_type : .* + DW_AT_low_pc : .* + DW_AT_high_pc : .* + DW_AT_frame_base : 1 byte block: .* + Abbrev Number: 5 \(DW_TAG_lexical_block\) + DW_AT_low_pc : .* + DW_AT_high_pc : .* + + Extra data at end of comp unit: + .*: Abbrev Number: 6 \(DW_TAG_variable\) + DW_AT_name : common + DW_AT_decl_file : 1 + DW_AT_decl_line : 3 + DW_AT_type : .* + DW_AT_external : 1 + DW_AT_location : 5 byte block: 3 . 0 0 0 \(DW_OP_addr: 0\) + .*: Abbrev Number: 6 \(DW_TAG_variable\) + DW_AT_name : global + DW_AT_decl_file : 1 + DW_AT_decl_line : 4 + DW_AT_type : .* + DW_AT_external : 1 + DW_AT_location : 5 byte block: 3 . 0 0 0 \(DW_OP_addr: 0\) + .*: Abbrev Number: 7 \(DW_TAG_variable\) + DW_AT_name : local + DW_AT_decl_file : 1 + DW_AT_decl_line : 5 + DW_AT_type : .* + DW_AT_location : 5 byte block: 3 . 0 0 . \(DW_OP_addr: .\) + .*: Abbrev Number: 8 \(DW_TAG_array_type\) + DW_AT_sibling : .* + DW_AT_type : .* + .*: Abbrev Number: 9 \(DW_TAG_subrange_type\) + DW_AT_upper_bound : 6 + .*: Abbrev Number: 3 \(DW_TAG_base_type\) + DW_AT_name : char + DW_AT_byte_size : 1 + DW_AT_encoding : . \(.* char\) + .*: Abbrev Number: 7 \(DW_TAG_variable\) + DW_AT_name : string + DW_AT_decl_file : 1 + DW_AT_decl_line : 6 + DW_AT_type : .* + DW_AT_location : 5 byte block: 3 . 0 0 . \(DW_OP_addr: .\) diff --git a/binutils/testsuite/binutils-all/size.exp b/binutils/testsuite/binutils-all/size.exp new file mode 100644 index 0000000..b908c91 --- /dev/null +++ b/binutils/testsuite/binutils-all/size.exp @@ -0,0 +1,78 @@ +# Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc. + +# This program 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file was written by Rob Savoye +# and rewritten by Ian Lance Taylor + +if ![is_remote host] { + if {[which $SIZE] == 0} then { + perror "$SIZE does not exist" + return + } +} + +send_user "Version [binutil_version $SIZE]" + + +if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then { + return +} + +if [is_remote host] { + set testfile [remote_download host tmpdir/bintest.o] +} else { + set testfile tmpdir/bintest.o +} + +set dec "\[0-9\]+" +set hex "\[0-9a-fA-F\]+" + +# Test size with no arguments + +set got [binutils_run $SIZE "$SIZEFLAGS $testfile"] + +set want "($dec)\[ \]+($dec)\[ \]+($dec)\[ \]+($dec)\[ \]+($hex)\[ \]+${testfile}" + +if ![regexp $want $got all text data bss dtot hextot] then { + fail "size (no arguments)" +} else { + if {$text < 8 || $data < 4} then { + fail "size (no arguments)" + } else { + pass "size (no arguments)" + } +} + +# Test size -A + +set got [binutils_run $SIZE "$SIZEFLAGS -A ${testfile}"] + +set want "${testfile}.*(text|TEXT)\[^\n\r\]*\[ \]($dec)\[ \]+$dec.*(\\.data|DATA)\[^\n\r\]*\[ \]($dec)\[ \]+$dec" + +if ![regexp $want $got all textname textsize dataname datasize] then { + fail "size -A" +} else { + verbose "text size: $textsize" + verbose "data size: $datasize" + if {$textsize < 8 || $datasize < 4} then { + fail "size -A" + } else { + pass "size -A" + } +} diff --git a/binutils/testsuite/binutils-all/testprog.c b/binutils/testsuite/binutils-all/testprog.c new file mode 100644 index 0000000..210656b --- /dev/null +++ b/binutils/testsuite/binutils-all/testprog.c @@ -0,0 +1,28 @@ +/* This program is used to test objcopy and strip. */ + +int common; +int global = 1; +static int local = 2; +static char string[] = "string"; + +int +fn () +{ + return 3; +} + +int +main () +{ + if (common != 0 + || global != 1 + || local != 2 + || strcmp (string, "string") != 0) + { + printf ("failed\n"); + exit (1); + } + + printf ("ok\n"); + exit (0); +} diff --git a/binutils/testsuite/config/default.exp b/binutils/testsuite/config/default.exp new file mode 100644 index 0000000..2a2802e --- /dev/null +++ b/binutils/testsuite/config/default.exp @@ -0,0 +1,88 @@ +# Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc. + +# This program 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file was written by Rob Savoye. (rob@cygnus.com) + +load_lib util-defs.exp +load_lib utils-lib.exp + +if ![info exists NM] then { + set NM [findfile $base_dir/nm-new $base_dir/nm-new [transform nm]] +} +if ![info exists NMFLAGS] then { + set NMFLAGS "" +} + +if ![info exists SIZE] then { + set SIZE [findfile $base_dir/size] +} +if ![info exists SIZEFLAGS] then { + set SIZEFLAGS "" +} + +if ![info exists OBJDUMP] then { + set OBJDUMP [findfile $base_dir/objdump] +} +if ![info exists OBJDUMPFLAGS] then { + set OBJDUMPFLAGS "" +} + +if ![info exists OBJCOPY] then { + set OBJCOPY [findfile $base_dir/objcopy] +} +if ![info exists OBJCOPYFLAGS] then { + set OBJCOPYFLAGS "" +} + +if ![info exists AR] then { + set AR [findfile $base_dir/ar] +} + +if ![info exists STRIP] then { + set STRIP [findfile $base_dir/strip-new $base_dir/strip-new [transform strip]] +} +if ![info exists STRIPFLAGS] then { + set STRIPFLAGS "" +} + +if ![info exists READELF] then { + set READELF [findfile $base_dir/readelf] +} +if ![info exists READELFFLAGS] then { + set READELFFLAGS "" +} + +if ![file isdirectory tmpdir] {catch "exec mkdir tmpdir" status} + +# +# binutils_run +# run a program, returning the output +# sets binutils_run_failed if the program does not exist +# +proc binutils_run { prog progargs } { + default_binutils_run $prog $progargs +} + +# +# binutils_assemble +# assemble a file +# +proc binutils_assemble { source object } { + default_binutils_assemble $source $object +} diff --git a/binutils/testsuite/config/hppa.sed b/binutils/testsuite/config/hppa.sed new file mode 100644 index 0000000..d8607d8 --- /dev/null +++ b/binutils/testsuite/config/hppa.sed @@ -0,0 +1,4 @@ +s/# Old OSF sed blows up if you have a sed command starting with "#"// +s/# Avoid it by putting the comments within real sed commands.// +s/# Fix the definition of common_symbol to be correct for the PA assebmlers.// +s/ \.comm common_symbol,4/common_symbol .comm 4/ diff --git a/binutils/testsuite/lib/utils-lib.exp b/binutils/testsuite/lib/utils-lib.exp new file mode 100644 index 0000000..e27f217 --- /dev/null +++ b/binutils/testsuite/lib/utils-lib.exp @@ -0,0 +1,161 @@ +# Copyright (C) 1993, 1994, 1997 Free Software Foundation, Inc. + +# This program 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file was written by Rob Savoye +# and extended by Ian Lance Taylor + +proc binutil_version { prog } { + if ![is_remote host] { + set path [which $prog]; + if {$path == 0} then { + perror "$prog can't be run, file not found." + return "" + } + } else { + set path $prog + } + set state [remote_exec host $prog --version]; + set tmp "[lindex $state 1]\n"; + # Should find a way to discard constant parts, keep whatever's + # left, so the version string could be almost anything at all... + regexp "\[^\n\]* (cygnus-|)(\[-0-9.a-zA-Z-\]+)\[\r\n\].*" "$tmp" version cyg number + if ![info exists number] then { + return "$path (no version number)\n" + } + return "$path $number\n" +} + +# +# default_binutils_run +# run a program, returning the output +# sets binutils_run_failed if the program does not exist +# +proc default_binutils_run { prog progargs } { + global binutils_run_failed + global host_triplet + + set binutils_run_failed 0 + + if ![is_remote host] { + if {[which $prog] == 0} then { + perror "$prog does not exist" + set binutils_run_failed 1 + return "" + } + } + + send_log "$prog $progargs\n" + verbose "$prog $progargs" + + # Gotta quote dollar-signs because they get mangled by the + # shell otherwise. + regsub -all "\\$" "$progargs" "\\$" progargs + + set state [remote_exec host $prog $progargs] + set exec_output [prune_warnings [lindex $state 1]]; + if {![string match "" $exec_output]} then { + send_log "$exec_output\n" + verbose "$exec_output" + } + return $exec_output +} + +# +# default_binutils_assemble +# assemble a file +# +proc default_binutils_assemble { source object } { + global srcdir + global host_triplet + + # The HPPA assembler syntax is a little different than most, to make + # the test source file assemble we need to run it through sed. + # + # This is a hack in that it won't scale well if other targets need + # similar transformations to assemble. We'll generalize the hack + # if/when other targets need similar handling. + if [istarget "hppa*-*-*" ] then { + send_log "sed -f $srcdir/config/hppa.sed < $source > asm.s\n" + verbose "sed -f $srcdir/config/hppa.sed < $source > asm.s" + catch "exec sed -f $srcdir/config/hppa.sed < $source > asm.s"; + set source asm.s + } + + set exec_output [target_assemble $source $object ""]; + set exec_output [prune_warnings $exec_output] + + if [string match "" $exec_output] { + return 1 + } else { + send_log "$exec_output\n" + verbose "$exec_output" + perror "$source: assembly failed" + return 0 + } +} + +if ![info exists target_assemble] { +# +# Stolen from dejagnu/lib/target.exp--please remove after 1/1/98. +# +uplevel #0 { + proc target_assemble { source destfile flags } { + return [default_target_assemble $source $destfile $flags]; + } + + proc default_target_assemble { source destfile flags } { + global AS_FOR_TARGET; + global ASFLAGS_FOR_TARGET; + + if [info exists AS_FOR_TARGET] { + set AS "$AS_FOR_TARGET"; + } else { + if ![board_info target exists assembler] { + set AS [find_gas]; + } else { + set AS [board_info target assembler]; + } + } + + if [info exists ASFLAGS_FOR_TARGET] { + append flags " $ASFLAGS_FOR_TARGET"; + } + + if [is_remote host] { + set source [remote_download host $source]; + set dest "a.out" + } else { + set dest $destfile + } + set status [remote_exec host "$AS $source $flags -o $dest"] + if [is_remote host] { + remote_upload host $dest $destfile + } + + set comp_output [prune_warnings [lindex $status 1]]; + if { [lindex $status 0] != 0 } { + verbose -log "assembler exited with status [lindex $status 0]"; + } + if { [lindex $status 1] != "" } { + verbose -log "assembler output is:\n[lindex $status 1]" 2; + } + return ${comp_output}; +} +} +} -- cgit v1.1