]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make these behave correctly on ppc64 ELF.
authorJulian Seward <jseward@acm.org>
Wed, 18 Jan 2006 04:17:18 +0000 (04:17 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 18 Jan 2006 04:17:18 +0000 (04:17 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5546

memcheck/tests/badjump.c
memcheck/tests/badjump2.c

index 053663be48ef28c40db000e7e223e16b1e730500..fecb762405054be26e3f25dbca29f306280bac64 100644 (file)
@@ -1,6 +1,18 @@
 
 int main ( void )
 {
+#if defined(__powerpc64__)
+   /* on ppc64-linux, a function pointer points to a function
+      descriptor, not to the function's entry point.  Hence to get
+      uniform behaviour on all supported targets - a jump to 0xE000000
+      - the following is needed. */
+   unsigned long long int fake_fndescr[3];
+   fake_fndescr[0] = 0xE000000;
+   fake_fndescr[1] = 0;
+   fake_fndescr[2] = 0;
+   return ((int(*)(void)) fake_fndescr) ();
+#else
    char* p = (char*)0xE000000;
    return ((int(*)(void)) p) ();
+#endif
 }
index 361966b6c14b17870a87f2d2a00f5751d302ed41..a93c37c82edf5e0396cbf136c7a655c0851d986b 100644 (file)
@@ -33,8 +33,16 @@ int main(void)
 
    if (__builtin_setjmp(myjmpbuf) == 0) {
       // Jump to zero; will cause seg fault
+#if defined(__powerpc64__)
+      unsigned long long int fake_fndescr[3];
+      fake_fndescr[0] = 0;
+      fake_fndescr[1] = 0;
+      fake_fndescr[2] = 0;
+      ((void(*)(void)) fake_fndescr) ();
+#else
       void (*fn)(void) = 0;
       fn();
+#endif
       fprintf(stderr, "Got here??\n");
    } else  {
       fprintf(stderr, "Signal caught, as expected\n");