a2eaef
commit 547f44124e1a38b8c5c635f673d88054ce6ff0d3
a2eaef
Author: Asim YarKhan <yarkhan@icl.utk.edu>
a2eaef
Date:   Thu Oct 16 12:19:34 2014 -0400
a2eaef
a2eaef
    byte_profile.c: PPC64 add support for PPC64 Little Endian to byte_profile.c
a2eaef
    
a2eaef
    Thanks to Carl Love for this patch and the following description:
a2eaef
    The POWER 8 platform is Little Endian.  It uses ELF
a2eaef
    version 2 which does not use function descriptors.  This
a2eaef
    patch adds the needed #ifdef support to correctly compile
a2eaef
    the test case for Big Endian or Little Endian.
a2eaef
    
a2eaef
    This patch is untested by the PAPI developers (hardware not easily accessible).
a2eaef
a2eaef
diff --git a/src/ctests/byte_profile.c b/src/ctests/byte_profile.c
a2eaef
index 0f33c0d..f693e9f 100644
a2eaef
--- a/src/ctests/byte_profile.c
a2eaef
+++ b/src/ctests/byte_profile.c
a2eaef
@@ -213,9 +213,14 @@ main( int argc, char **argv )
a2eaef
 /* Itanium and PowerPC64 processors return function descriptors instead
a2eaef
  * of function addresses. You must dereference the descriptor to get the address.
a2eaef
 */
a2eaef
-#if defined(ITANIUM1) || defined(ITANIUM2) || defined(__powerpc64__)
a2eaef
+#if defined(ITANIUM1) || defined(ITANIUM2) \
a2eaef
+    || (defined(__powerpc64__) && (_CALL_ELF != 2))
a2eaef
 	start = ( caddr_t ) ( ( ( struct fdesc * ) start )->ip );
a2eaef
 	end = ( caddr_t ) ( ( ( struct fdesc * ) end )->ip );
a2eaef
+        /* PPC64 Big Endian is ELF version 1 which uses function descriptors.
a2eaef
+         *  PPC64 Little Endian is ELF version 2 which does not use
a2eaef
+         * function descriptors
a2eaef
+         */
a2eaef
 #endif
a2eaef
 
a2eaef
 	/* call dummy so it doesn't get optimized away */
a2eaef
commit 14f70ebc77deaad4a3fc3f808613772ef1165137
a2eaef
Author: Asim YarKhan <yarkhan@icl.utk.edu>
a2eaef
Date:   Wed Oct 15 14:48:05 2014 -0400
a2eaef
a2eaef
    PPC64 add support for PPC64 Little Endian to sprofile.c
a2eaef
    
a2eaef
    Thanks to Carl Love for this patch and the following description:
a2eaef
    The POWER 8 platform is Little Endian.  It uses ELF
a2eaef
    version 2 which does not use function descriptors.  This
a2eaef
    patch adds the needed #ifdef support to correctly compile
a2eaef
    the test case for Big Endian or Little Endian.
a2eaef
a2eaef
diff --git a/src/ctests/sprofile.c b/src/ctests/sprofile.c
a2eaef
index e7ee47a..4bd7cc7 100644
a2eaef
--- a/src/ctests/sprofile.c
a2eaef
+++ b/src/ctests/sprofile.c
a2eaef
@@ -1,4 +1,4 @@
a2eaef
-/* 
a2eaef
+/*
a2eaef
 * File:    sprofile.c
a2eaef
 * Author:  Philip Mucci
a2eaef
 *          mucci@cs.utk.edu
a2eaef
@@ -10,10 +10,15 @@
a2eaef
 
a2eaef
 /* These architectures use Function Descriptors as Function Pointers */
a2eaef
 
a2eaef
-#if (defined(linux) && defined(__ia64__)) || (defined(_AIX)) ||(defined(__powerpc64__))
a2eaef
+#if (defined(linux) && defined(__ia64__)) || (defined(_AIX)) \
a2eaef
+  || ((defined(__powerpc64__) && (_CALL_ELF != 2)))
a2eaef
+/* PPC64 Big Endian is ELF version 1 which uses function descriptors */
a2eaef
 #define DO_READS (unsigned long)(*(void **)do_reads)
a2eaef
 #define DO_FLOPS (unsigned long)(*(void **)do_flops)
a2eaef
 #else
a2eaef
+/* PPC64 Little Endian is ELF version 2 which does not use
a2eaef
+ * function descriptors
a2eaef
+ */
a2eaef
 #define DO_READS (unsigned long)(do_reads)
a2eaef
 #define DO_FLOPS (unsigned long)(do_flops)
a2eaef
 #endif