]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Add m68k tests
authorAndreas Schwab <schwab@linux-m68k.org>
Sun, 10 Jul 2016 15:36:38 +0000 (17:36 +0200)
committerMark Wielaard <mjw@redhat.com>
Mon, 11 Jul 2016 08:22:18 +0000 (10:22 +0200)
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
13 files changed:
backends/ChangeLog
backends/linux-core-note.c
backends/m68k_corenote.c
tests/ChangeLog
tests/Makefile.am
tests/hello_m68k.ko.bz2 [new file with mode: 0644]
tests/run-allregs.sh
tests/run-readelf-mixed-corenote.sh
tests/run-strip-reloc.sh
tests/run-strip-test11.sh [new file with mode: 0755]
tests/testfile-m68k-core.bz2 [new file with mode: 0644]
tests/testfile-m68k-s.bz2 [new file with mode: 0755]
tests/testfile-m68k.bz2 [new file with mode: 0755]

index 7cd1906584b36b6db453a7ad041a449637cbf53b..af32d8f9a4484badb557a353989b7cf6f1e2f723 100644 (file)
@@ -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.
index c00c0b171f6245886d32f469dd193caa9b3d6f90..a4ec0be07631676c304131df73b01d291a622e77 100644 (file)
@@ -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
index e839edfd5d5af5cce0edd27e862588c200e90699..3c1d019fdb839ed9732a06fe07c6ea49cbbc0a4e 100644 (file)
@@ -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
index cd0d2feefbabc5520d22ae0805f5b3fecfd31c3d..8fe9ee86d5ebab504d68e9f7974f2bdc0f6eb1cd 100644 (file)
@@ -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.
index f80436abba1fbcf4fe63fa712f015df163b53932..a64adca38314057bd8398fb7b68d93bcffe8fb7f 100644 (file)
@@ -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 (file)
index 0000000..2da3d17
Binary files /dev/null and b/tests/hello_m68k.ko.bz2 differ
index 1f86429ed3f90230a607cad52b06f212689e99a9..d82f37e6d55417ac72cf6d3d18fe7ff591f35f1c 100755 (executable)
@@ -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
index 69d0c02e37a5d150ae2feee96bac8aa81796df80..86171c41f414d1c38c767660eba761b846a12b2d 100755 (executable)
@@ -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
index a3245fd8823633040625d680e7801042f0ac4cb6..9fbba29b8f862cdfac679e9e42df5bac1478930b 100755 (executable)
@@ -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 (executable)
index 0000000..0b1b0ab
--- /dev/null
@@ -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 (file)
index 0000000..eda79d7
Binary files /dev/null and b/tests/testfile-m68k-core.bz2 differ
diff --git a/tests/testfile-m68k-s.bz2 b/tests/testfile-m68k-s.bz2
new file mode 100755 (executable)
index 0000000..44c3799
Binary files /dev/null and b/tests/testfile-m68k-s.bz2 differ
diff --git a/tests/testfile-m68k.bz2 b/tests/testfile-m68k.bz2
new file mode 100755 (executable)
index 0000000..97a1b28
Binary files /dev/null and b/tests/testfile-m68k.bz2 differ