summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2016-07-10 17:36:38 +0200
committerMark Wielaard <mjw@redhat.com>2016-07-11 10:22:18 +0200
commit56dce92a3612d2f354c3e292d36b04ebb21881dc (patch)
tree8bb7c105305db01139bc2cf7cd6c3bd7f832a98a
parent8c481b6fc53a1d1f50518896004dc5221862e126 (diff)
downloadelfutils-56dce92a3612d2f354c3e292d36b04ebb21881dc.tar.gz
Add m68k tests
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
-rw-r--r--backends/ChangeLog6
-rw-r--r--backends/linux-core-note.c6
-rw-r--r--backends/m68k_corenote.c1
-rw-r--r--tests/ChangeLog14
-rw-r--r--tests/Makefile.am10
-rw-r--r--tests/hello_m68k.ko.bz2bin0 -> 26549 bytes
-rwxr-xr-xtests/run-allregs.sh32
-rwxr-xr-xtests/run-readelf-mixed-corenote.sh64
-rwxr-xr-xtests/run-strip-reloc.sh3
-rwxr-xr-xtests/run-strip-test11.sh4
-rw-r--r--tests/testfile-m68k-core.bz2bin0 -> 22041 bytes
-rwxr-xr-xtests/testfile-m68k-s.bz2bin0 -> 1590 bytes
-rwxr-xr-xtests/testfile-m68k.bz2bin0 -> 3659 bytes
13 files changed, 134 insertions, 6 deletions
diff --git a/backends/ChangeLog b/backends/ChangeLog
index 7cd19065..af32d8f9 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,9 @@
+2016-07-10 Andreas Schwab <schwab@linux-m68k.org>
+
+ * m68k_corenote.c (ALIGN_PRSTATUS): Define.
+ * linux-core-note.c (struct EBLHOOK(prstatus)): Set alignment to
+ ALIGN_PRSTATUS if defined.
+
2016-06-28 Richard Henderson <rth@redhat.com>
* Makefile.am (modules): Add bpf.
diff --git a/backends/linux-core-note.c b/backends/linux-core-note.c
index c00c0b17..a4ec0be0 100644
--- a/backends/linux-core-note.c
+++ b/backends/linux-core-note.c
@@ -109,7 +109,11 @@ struct EBLHOOK(prstatus)
#endif
;
FIELD (INT, pr_fpvalid);
-};
+}
+#ifdef ALIGN_PRSTATUS
+ __attribute__ ((packed, aligned (ALIGN_PRSTATUS)))
+#endif
+;
#define FNAMESZ 16
#define PRARGSZ 80
diff --git a/backends/m68k_corenote.c b/backends/m68k_corenote.c
index e839edfd..3c1d019f 100644
--- a/backends/m68k_corenote.c
+++ b/backends/m68k_corenote.c
@@ -57,6 +57,7 @@ static const Ebl_Register_Location prstatus_regs[] =
#define ALIGN_PID_T 2
#define ALIGN_UID_T 2
#define ALIGN_GID_T 2
+#define ALIGN_PRSTATUS 2
#define TYPE_ULONG ELF_T_WORD
#define TYPE_PID_T ELF_T_SWORD
#define TYPE_UID_T ELF_T_HALF
diff --git a/tests/ChangeLog b/tests/ChangeLog
index cd0d2fee..8fe9ee86 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,17 @@
+2016-07-10 Andreas Schwab <schwab@linux-m68k.org>
+
+ * Makefile.am (TESTS): Add run-strip-test11.sh.
+ (EXTRA_DIST): Add run-strip-test11.sh, hello_m68k.ko.bz2,
+ testfile-m86k-core.bz2, testfile-m68k.bz2, testfile-m68k-s.bz2.
+ (run-strip-test11.sh): New file.
+ (hello_m68k.ko.bz2): New file.
+ (testfile-m68k-core.bz2): New file.
+ (testfile-m68k.bz2): New file.
+ (testfile-m68k-s.bz2): New file.
+ * run-allregs.sh: Add test for testfile-m68k-core.
+ * run-readelf-mixed-corenote.sh: Likewise.
+ * run-strip-reloc.sh: Add test for hello_m68k.ko.
+
2016-07-06 Mark Wielaard <mjw@redhat.com>
* Makefile.am (check_PROGRAMS): Add vendorelf.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f80436ab..a64adca3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -78,7 +78,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
newscn run-strip-test.sh run-strip-test2.sh \
run-strip-test3.sh run-strip-test4.sh run-strip-test5.sh \
run-strip-test6.sh run-strip-test7.sh run-strip-test8.sh \
- run-strip-test9.sh run-strip-test10.sh \
+ run-strip-test9.sh run-strip-test10.sh run-strip-test11.sh \
run-strip-groups.sh run-strip-reloc.sh run-strip-strmerge.sh \
run-strip-nobitsalign.sh \
run-unstrip-test.sh run-unstrip-test2.sh \
@@ -167,11 +167,12 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
run-line2addr.sh run-elflint-test.sh testfile14.bz2 \
run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \
run-strip-test7.sh run-strip-test8.sh run-strip-groups.sh \
- run-strip-test9.sh run-strip-test10.sh run-strip-strmerge.sh \
- run-strip-nobitsalign.sh \
+ run-strip-test9.sh run-strip-test10.sh run-strip-test11.sh \
+ run-strip-strmerge.sh run-strip-nobitsalign.sh \
testfile-nobitsalign.bz2 testfile-nobitsalign.strip.bz2 \
run-strip-reloc.sh hello_i386.ko.bz2 hello_x86_64.ko.bz2 \
hello_ppc64.ko.bz2 hello_s390.ko.bz2 hello_aarch64.ko.bz2 \
+ hello_m68k.ko.bz2 \
run-unstrip-test.sh run-unstrip-test2.sh \
testfile-info-link.bz2 testfile-info-link.debuginfo.bz2 \
testfile-info-link.stripped.bz2 run-unstrip-test3.sh \
@@ -328,7 +329,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
run-elfgetchdr.sh run-elfgetzdata.sh run-elfputzdata.sh \
run-zstrptr.sh run-compress-test.sh \
run-disasm-bpf.sh \
- testfile-bpf-dis1.expect.bz2 testfile-bpf-dis1.o.bz2
+ testfile-bpf-dis1.expect.bz2 testfile-bpf-dis1.o.bz2 \
+ testfile-m68k-core.bz2 testfile-m68k.bz2 testfile-m68k-s.bz2
if USE_VALGRIND
valgrind_cmd='valgrind -q --leak-check=full --error-exitcode=1'
diff --git a/tests/hello_m68k.ko.bz2 b/tests/hello_m68k.ko.bz2
new file mode 100644
index 00000000..2da3d17b
--- /dev/null
+++ b/tests/hello_m68k.ko.bz2
Binary files differ
diff --git a/tests/run-allregs.sh b/tests/run-allregs.sh
index 1f86429e..d82f37e6 100755
--- a/tests/run-allregs.sh
+++ b/tests/run-allregs.sh
@@ -2870,4 +2870,36 @@ x87 registers:
39: %st6 (st6), float 80 bits
40: %st7 (st7), float 80 bits
EOF
+
+# See run-readelf-mixed-corenote.sh for instructions to regenerate
+# this core file.
+regs_test testfile-m68k-core <<\EOF
+integer registers:
+ 0: %d0 (d0), signed 32 bits
+ 1: %d1 (d1), signed 32 bits
+ 2: %d2 (d2), signed 32 bits
+ 3: %d3 (d3), signed 32 bits
+ 4: %d4 (d4), signed 32 bits
+ 5: %d5 (d5), signed 32 bits
+ 6: %d6 (d6), signed 32 bits
+ 7: %d7 (d7), signed 32 bits
+ 8: %a0 (a0), address 32 bits
+ 9: %a1 (a1), address 32 bits
+ 10: %a2 (a2), address 32 bits
+ 11: %a3 (a3), address 32 bits
+ 12: %a4 (a4), address 32 bits
+ 13: %a5 (a5), address 32 bits
+ 14: %a6 (a6), address 32 bits
+ 15: %a7 (a7), address 32 bits
+ 24: %pc (pc), address 32 bits
+FPU registers:
+ 16: %fp0 (fp0), float 96 bits
+ 17: %fp1 (fp1), float 96 bits
+ 18: %fp2 (fp2), float 96 bits
+ 19: %fp3 (fp3), float 96 bits
+ 20: %fp4 (fp4), float 96 bits
+ 21: %fp5 (fp5), float 96 bits
+ 22: %fp6 (fp6), float 96 bits
+ 23: %fp7 (fp7), float 96 bits
+EOF
exit 0
diff --git a/tests/run-readelf-mixed-corenote.sh b/tests/run-readelf-mixed-corenote.sh
index 69d0c02e..86171c41 100755
--- a/tests/run-readelf-mixed-corenote.sh
+++ b/tests/run-readelf-mixed-corenote.sh
@@ -582,4 +582,68 @@ Note segment of 2548 bytes at offset 0x234:
LINUX 832 X86_XSTATE
EOF
+# To reproduce this core dump, do this on an m68k machine:
+# $ gcc -x c <(echo 'int main () { return *(int *)0x12345678; }')
+# $ ./a.out
+testfiles testfile-m68k-core
+testrun_compare ${abs_top_builddir}/src/readelf -n testfile-m68k-core <<\EOF
+
+Note segment of 1056 bytes at offset 0x1f4:
+ Owner Data size Type
+ CORE 154 PRSTATUS
+ info.si_signo: 11, info.si_code: 0, info.si_errno: 0, cursig: 11
+ sigpend: <>
+ sighold: <>
+ pid: 1963, ppid: 1084, pgrp: 1963, sid: 1084
+ utime: 0.000000, stime: 0.010000, cutime: 0.000000, cstime: 0.000000
+ fpvalid: 1
+ d1: 1 d2: 0 d3: -2146476616 d4: -2146476616
+ d5: 0 d6: -2147393212 d7: -2144827216 a0: 0x12345678
+ a1: 0xefe71460 a2: 0x00000000 a3: 0x80288df8 a4: 0x80000340
+ a5: 0xc017a000 a6: 0xefe71434 d0: -1073595312 a7: 0xefe71434
+ pc: 0x800003fe
+ CORE 124 PRPSINFO
+ state: 0, sname: R, zomb: 0, nice: 0, flag: 0x00400600
+ uid: 1000, gid: 501, pid: 1963, ppid: 1084, pgrp: 1963, sid: 1084
+ fname: a.out, psargs: ./a.out
+ CORE 128 SIGINFO
+ si_signo: 11, si_errno: 0, si_code: 1
+ fault address: 0x12345678
+ CORE 136 AUXV
+ HWCAP: 0
+ PAGESZ: 4096
+ CLKTCK: 100
+ PHDR: 0x80000034
+ PHENT: 32
+ PHNUM: 9
+ BASE: 0xc0000000
+ FLAGS: 0
+ ENTRY: 0x80000340
+ UID: 1000
+ EUID: 1000
+ GID: 501
+ EGID: 501
+ SECURE: 0
+ RANDOM: 0xefe716d9
+ EXECFN: 0xefe71ff4
+ NULL
+ CORE 281 FILE
+ 10 files:
+ 80000000-80001000 00000000 4096 /tmp/a.out
+ 80003000-80004000 00001000 4096 /tmp/a.out
+ 80004000-80005000 00002000 4096 /tmp/a.out
+ c0000000-c001c000 00000000 114688 /lib/ld-2.23.so
+ c001f000-c0020000 0001d000 4096 /lib/ld-2.23.so
+ c0020000-c0021000 0001e000 4096 /lib/ld-2.23.so
+ c0032000-c0177000 00000000 1331200 /lib/libc-2.23.so
+ c0177000-c0178000 00145000 4096 /lib/libc-2.23.so
+ c0178000-c017a000 00144000 8192 /lib/libc-2.23.so
+ c017a000-c017e000 00146000 16384 /lib/libc-2.23.so
+ CORE 108 FPREGSET
+ fp0: 0x7fff0000ffffffffffffffff fp1: 0x7fff0000ffffffffffffffff
+ fp2: 0x7fff0000ffffffffffffffff fp3: 0x7fff0000ffffffffffffffff
+ fp4: 0x7fff0000ffffffffffffffff fp5: 0x7fff0000ffffffffffffffff
+ fp6: 0x7fff0000ffffffffffffffff fp7: 0x7fff0000ffffffffffffffff
+EOF
+
exit 0
diff --git a/tests/run-strip-reloc.sh b/tests/run-strip-reloc.sh
index a3245fd8..9fbba29b 100755
--- a/tests/run-strip-reloc.sh
+++ b/tests/run-strip-reloc.sh
@@ -18,7 +18,7 @@
. $srcdir/test-subr.sh
testfiles hello_i386.ko hello_x86_64.ko hello_ppc64.ko hello_s390.ko \
- hello_aarch64.ko
+ hello_aarch64.ko hello_m68k.ko
tempfiles readelf.out readelf.out1 readelf.out2
tempfiles out.stripped1 out.debug1 out.stripped2 out.debug2
@@ -102,6 +102,7 @@ runtest hello_x86_64.ko 1
runtest hello_ppc64.ko 1
runtest hello_s390.ko 1
runtest hello_aarch64.ko 1
+runtest hello_m68k.ko 1
# self test, shouldn't impact non-ET_REL files at all.
runtest ${abs_top_builddir}/src/strip 0
diff --git a/tests/run-strip-test11.sh b/tests/run-strip-test11.sh
new file mode 100755
index 00000000..0b1b0ab9
--- /dev/null
+++ b/tests/run-strip-test11.sh
@@ -0,0 +1,4 @@
+original=testfile-m68k
+stripped=testfile-m68k-s
+
+. $srcdir/run-strip-test.sh
diff --git a/tests/testfile-m68k-core.bz2 b/tests/testfile-m68k-core.bz2
new file mode 100644
index 00000000..eda79d73
--- /dev/null
+++ b/tests/testfile-m68k-core.bz2
Binary files differ
diff --git a/tests/testfile-m68k-s.bz2 b/tests/testfile-m68k-s.bz2
new file mode 100755
index 00000000..44c37993
--- /dev/null
+++ b/tests/testfile-m68k-s.bz2
Binary files differ
diff --git a/tests/testfile-m68k.bz2 b/tests/testfile-m68k.bz2
new file mode 100755
index 00000000..97a1b289
--- /dev/null
+++ b/tests/testfile-m68k.bz2
Binary files differ