Skip to contentSkip to conversation

fix compile error on ppc64 in RHEL5

PATCH In review Caspar Zhang 3 participants 5 messages Dec 10, 2009 – Dec 11, 2009 1 message not in the archive

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 fix compile error on ppc64 in RHEL5

In reply to a message not in the archive

Hi all,

When I compile ltp-full-20091130 on ppc64 machine which system is RHEL5(kernel 2.6.18), I met compile error as follows:

[...]
ptrace04.c: In function ‘compare_registers’:
ptrace04.c:59: error: ‘PTRACE_GETREGS’ undeclared (first use in this function) ptrace04.c:59: error: (Each undeclared identifier is reported only once ptrace04.c:59: error: for each function it appears in.)
make[5]: *** [ptrace04] Error 1
[...]

It seems like there's no PTRACE_GETREGS in /usr/include/asm/ptrace.h in old kernels, so I copy the definitions from new version of the head file and my ltp on ppc64, RHEL5 works.

Thanks,
Caspar

testcases/kernel/syscalls/ptrace/ptrace.h +23 -0
index a0d2708..e3fcbb2 100644
@@ -37,4 +37,27 @@ typedef struct user_regs_struct ptrace_regs;
 #undef HAVE_STRUCT_PTRACE_REGS
 #endif
 
+/* old kernel doesn't have PTRACE_GETREGS on ppc64 */
+/* (new) PTRACE requests using the same numbers as x86 and the same
+ * argument ordering. Additionally, they support more registers too
+ */
+#ifndef PTRACE_GETREGS
+# define PTRACE_GETREGS            12
+#endif
+#ifndef PTRACE_SETREGS
+# define PTRACE_SETREGS            13
+#endif
+#ifndef PTRACE_GETFPREGS
+# define PTRACE_GETFPREGS          14
+#endif
+#ifndef PTRACE_SETFPREGS
+# define PTRACE_SETFPREGS          15
+#endif
+#ifndef PTRACE_GETREGS64
+# define PTRACE_GETREGS64          22
+#endif
+#ifndef PTRACE_SETREGS64
+# define PTRACE_SETREGS64          23
+#endif
+
 #endif

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw

Hi Caspar,

I just have 1 question below:

Quoted 15 lines · Caspar Zhang

Hi all,

When I compile ltp-full-20091130 on ppc64 machine which system is RHEL5(kernel 2.6.18), I met compile error as follows:

[...]
ptrace04.c: In function ‘compare_registers’:
ptrace04.c:59: error: ‘PTRACE_GETREGS’ undeclared (first use in this function)
ptrace04.c:59: error: (Each undeclared identifier is reported only once
ptrace04.c:59: error: for each function it appears in.) make[5]: *** [ptrace04] Error 1
[...]

Quoted 3 lines

It seems like there's no PTRACE_GETREGS in /usr/include/asm/ptrace.h in old kernels, so I copy the definitions from new version of the head file and my ltp on ppc64, RHEL5 works.

Are these nos. similar across all archs ? If they are specific only to PPC, you can then add the following 2 more lines to your patch:

Quoted 20 lines

Thanks,
Caspar

differences
between files
attachment
(rhel5-ppc-PTRACE_GETREGS-compile-err.patch)

testcases/kernel/syscalls/ptrace/ptrace.h +0 -0
index a0d2708..e3fcbb2 100644

testcases/kernel/syscalls/ptrace/ptrace.h typedef struct user_regs_struct ptrace_regs; · line 43

Quoted 7 lines
testcases/kernel/syscalls/ptrace/ptrace.h +4 -0
@@ -37,4 +37,27 @@ typedef struct user_regs_struct ptrace_regs;
 #undef HAVE_STRUCT_PTRACE_REGS
 #endif
 
+/* old kernel doesn't have PTRACE_GETREGS on ppc64 */
+/* (new) PTRACE requests using the same numbers as x86 and the same
+ * argument ordering. Additionally, they support more registers too
+ */

#if defined(powerpc) || defined(__powerpc__) || defined(__ppc__) || defined (__PPC__)

Quoted 10 lines
testcases/kernel/syscalls/ptrace/ptrace.h +10 -0
+#ifndef PTRACE_GETREGS
+# define PTRACE_GETREGS            12
+#endif
+#ifndef PTRACE_SETREGS
+# define PTRACE_SETREGS            13
+#endif
+#ifndef PTRACE_GETFPREGS
+# define PTRACE_GETFPREGS          14
+#endif
+#ifndef PTRACE_SETFPREGS

testcases/kernel/syscalls/ptrace/ptrace.h typedef struct user_regs_struct ptrace_regs; · line 63

Quoted 10 lines
testcases/kernel/syscalls/ptrace/ptrace.h +9 -0
+# define PTRACE_SETFPREGS          15
+#endif
+#ifndef PTRACE_GETREGS64
+# define PTRACE_GETREGS64          22
+#endif
+#ifndef PTRACE_SETREGS64
+# define PTRACE_SETREGS64          23
+#endif
+
 #endif

#endif

Regards--
Subrata

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw
Quoted 56 lines · ----- "Subrata Modak

Hi Caspar,

I just have 1 question below:

Quoted 8 lines · Caspar Zhang

Hi all,

When I compile ltp-full-20091130 on ppc64 machine which system is RHEL5(kernel 2.6.18), I met compile error as follows:

[...]
ptrace04.c: In function ‘compare_registers’:
ptrace04.c:59: error: ‘PTRACE_GETREGS’ undeclared (first use in

this

Quoted 8 lines

function)
ptrace04.c:59: error: (Each undeclared identifier is reported only once
ptrace04.c:59: error: for each function it appears in.) make[5]: *** [ptrace04] Error 1
[...]

It seems like there's no PTRACE_GETREGS in

/usr/include/asm/ptrace.h

Quoted 2 lines

in old kernels, so I copy the definitions from new version of the head file and my ltp on ppc64, RHEL5 works.

Are these nos. similar across all archs ? If they are specific only to
PPC, you can then add the following 2 more lines to your patch:

Quoted 20 lines

Thanks,
Caspar

differences
between files
attachment
(rhel5-ppc-PTRACE_GETREGS-compile-err.patch)

testcases/kernel/syscalls/ptrace/ptrace.h +0 -0
index a0d2708..e3fcbb2 100644

testcases/kernel/syscalls/ptrace/ptrace.h typedef struct user_regs_struct ptrace_regs; · line 41

Quoted 5 lines
testcases/kernel/syscalls/ptrace/ptrace.h +2 -0
@@ -37,4 +37,27 @@ typedef struct user_regs_struct ptrace_regs;
 #undef HAVE_STRUCT_PTRACE_REGS
 #endif
 
+/* old kernel doesn't have PTRACE_GETREGS on ppc64 */
+/* (new) PTRACE requests using the same numbers as x86 and the

same

Quoted 6 lines

testcases/kernel/syscalls/ptrace/ptrace.h typedef struct user_regs_struct ptrace_regs; · line 42

Quoted 1 line
testcases/kernel/syscalls/ptrace/ptrace.h +1 -0
+ * argument ordering. Additionally, they support more registers

too

testcases/kernel/syscalls/ptrace/ptrace.h typedef struct user_regs_struct ptrace_regs; · line 43

Quoted 1 line
testcases/kernel/syscalls/ptrace/ptrace.h +1 -0
+ */

#if defined(powerpc) || defined(__powerpc__) || defined(__ppc__) || defined (__PPC__)

Ah, yes. That sounds reasonable, thant you!

Caspar

Quoted 23 lines
Quoted 10 lines
testcases/kernel/syscalls/ptrace/ptrace.h +10 -0
+#ifndef PTRACE_GETREGS
+# define PTRACE_GETREGS            12
+#endif
+#ifndef PTRACE_SETREGS
+# define PTRACE_SETREGS            13
+#endif
+#ifndef PTRACE_GETFPREGS
+# define PTRACE_GETFPREGS          14
+#endif
+#ifndef PTRACE_SETFPREGS

testcases/kernel/syscalls/ptrace/ptrace.h typedef struct user_regs_struct ptrace_regs; · line 63

Quoted 10 lines
testcases/kernel/syscalls/ptrace/ptrace.h +9 -0
+# define PTRACE_SETFPREGS          15
+#endif
+#ifndef PTRACE_GETREGS64
+# define PTRACE_GETREGS64          22
+#endif
+#ifndef PTRACE_SETREGS64
+# define PTRACE_SETREGS64          23
+#endif
+
 #endif

#endif

Quoted 2 lines

Regards--
Subrata

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#4 lore raw
Quoted 59 lines · Caspar Zhang
Quoted 56 lines · ----- "Subrata Modak

Hi Caspar,

I just have 1 question below:

Quoted 8 lines · Caspar Zhang

Hi all,

When I compile ltp-full-20091130 on ppc64 machine which system is RHEL5(kernel 2.6.18), I met compile error as follows:

[...]
ptrace04.c: In function ‘compare_registers’:
ptrace04.c:59: error: ‘PTRACE_GETREGS’ undeclared (first use in

this

Quoted 8 lines

function)
ptrace04.c:59: error: (Each undeclared identifier is reported only once
ptrace04.c:59: error: for each function it appears in.) make[5]: *** [ptrace04] Error 1
[...]

It seems like there's no PTRACE_GETREGS in

/usr/include/asm/ptrace.h

Quoted 2 lines

in old kernels, so I copy the definitions from new version of the head file and my ltp on ppc64, RHEL5 works.

Are these nos. similar across all archs ? If they are specific only to
PPC, you can then add the following 2 more lines to your patch:

Quoted 20 lines

Thanks,
Caspar

differences
between files
attachment
(rhel5-ppc-PTRACE_GETREGS-compile-err.patch)

testcases/kernel/syscalls/ptrace/ptrace.h +0 -0
index a0d2708..e3fcbb2 100644

testcases/kernel/syscalls/ptrace/ptrace.h typedef struct user_regs_struct ptrace_regs; · line 41

Quoted 5 lines
testcases/kernel/syscalls/ptrace/ptrace.h +2 -0
@@ -37,4 +37,27 @@ typedef struct user_regs_struct ptrace_regs;
 #undef HAVE_STRUCT_PTRACE_REGS
 #endif
 
+/* old kernel doesn't have PTRACE_GETREGS on ppc64 */
+/* (new) PTRACE requests using the same numbers as x86 and the

same

Quoted 8 lines
Quoted 6 lines

testcases/kernel/syscalls/ptrace/ptrace.h typedef struct user_regs_struct ptrace_regs; · line 42

Quoted 1 line
testcases/kernel/syscalls/ptrace/ptrace.h +1 -0
+ * argument ordering. Additionally, they support more registers

too

testcases/kernel/syscalls/ptrace/ptrace.h typedef struct user_regs_struct ptrace_regs; · line 43

Quoted 1 line
testcases/kernel/syscalls/ptrace/ptrace.h +1 -0
+ */

#if defined(powerpc) || defined(__powerpc__) || defined(__ppc__) || defined (__PPC__)

Ah, yes. That sounds reasonable, thant you!

For whatever reason someone decided to be special on ppc64.. not sure why (maybe because ppc and ppc64 diverged in older kernels and converged in later ones?):

[root@localhost /]# egrep 'PTRACE_[GS]ETREGS' /scratch/fc4/kernel/include/asm-ppc64/ptrace.h

#define PPC_PTRACE_GETREGS	      0x99  /* Get GPRs 0 - 31 */
#define PPC_PTRACE_SETREGS	      0x98  /* Set GPRs 0 - 31 */

[root@localhost /]# egrep 'PTRACE_[GS]ETREGS' /scratch/fc7/kernel/include/asm-powerpc/ptrace.h
#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */
#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */

A similar issue may exist for sparc64, but I doubt it:

[root@localhost /]# egrep 'PTRACE_[GS]ETREGS' /scratch/fc4/kernel/include/asm-sparc*/ptrace.h
/scratch/fc4/kernel/include/asm-sparc64/ptrace.h:#define PTRACE_GETREGS 12
/scratch/fc4/kernel/include/asm-sparc64/ptrace.h:#define PTRACE_SETREGS 13
/scratch/fc4/kernel/include/asm-sparc64/ptrace.h:#define PTRACE_GETREGS64 22
/scratch/fc4/kernel/include/asm-sparc64/ptrace.h:#define PTRACE_SETREGS64 23
/scratch/fc4/kernel/include/asm-sparc/ptrace.h:#define PTRACE_GETREGS 12
/scratch/fc4/kernel/include/asm-sparc/ptrace.h:#define PTRACE_SETREGS 13

What kernel version are you using again?

Thanks,
-Garrett
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#5 lore raw
Quoted 90 lines · Garrett Cooper
Quoted 59 lines · Caspar Zhang
Quoted 56 lines · ----- "Subrata Modak

Hi Caspar,

I just have 1 question below:

Quoted 8 lines · Caspar Zhang

Hi all,

When I compile ltp-full-20091130 on ppc64 machine which system is RHEL5(kernel 2.6.18), I met compile error as follows:

[...]
ptrace04.c: In function ‘compare_registers’:
ptrace04.c:59: error: ‘PTRACE_GETREGS’ undeclared (first use in

this

Quoted 8 lines

function)
ptrace04.c:59: error: (Each undeclared identifier is reported only once
ptrace04.c:59: error: for each function it appears in.) make[5]: *** [ptrace04] Error 1
[...]

It seems like there's no PTRACE_GETREGS in

/usr/include/asm/ptrace.h

Quoted 2 lines

in old kernels, so I copy the definitions from new version of the head file and my ltp on ppc64, RHEL5 works.

Are these nos. similar across all archs ? If they are specific only to
PPC, you can then add the following 2 more lines to your patch:

Quoted 20 lines

Thanks,
Caspar

differences
between files
attachment
(rhel5-ppc-PTRACE_GETREGS-compile-err.patch)

testcases/kernel/syscalls/ptrace/ptrace.h +0 -0
index a0d2708..e3fcbb2 100644

testcases/kernel/syscalls/ptrace/ptrace.h typedef struct user_regs_struct ptrace_regs; · line 41

Quoted 5 lines
testcases/kernel/syscalls/ptrace/ptrace.h +2 -0
@@ -37,4 +37,27 @@ typedef struct user_regs_struct ptrace_regs;
 #undef HAVE_STRUCT_PTRACE_REGS
 #endif
 
+/* old kernel doesn't have PTRACE_GETREGS on ppc64 */
+/* (new) PTRACE requests using the same numbers as x86 and the

same

Quoted 8 lines
Quoted 6 lines

testcases/kernel/syscalls/ptrace/ptrace.h typedef struct user_regs_struct ptrace_regs; · line 42

Quoted 1 line
testcases/kernel/syscalls/ptrace/ptrace.h +1 -0
+ * argument ordering. Additionally, they support more registers

too

testcases/kernel/syscalls/ptrace/ptrace.h typedef struct user_regs_struct ptrace_regs; · line 43

Quoted 1 line
testcases/kernel/syscalls/ptrace/ptrace.h +1 -0
+ */

#if defined(powerpc) || defined(__powerpc__) || defined(__ppc__) || defined (__PPC__)

Ah, yes. That sounds reasonable, thant you!

For whatever reason someone decided to be special on ppc64.. not sure why (maybe because ppc and ppc64 diverged in older kernels and converged in later ones?):

[root@localhost /]# egrep 'PTRACE_[GS]ETREGS' /scratch/fc4/kernel/include/asm-ppc64/ptrace.h #define PPC_PTRACE_GETREGS            0x99  /* Get GPRs 0 - 31 */
#define PPC_PTRACE_SETREGS            0x98  /* Set GPRs 0 - 31 */

[root@localhost /]# egrep 'PTRACE_[GS]ETREGS' /scratch/fc7/kernel/include/asm-powerpc/ptrace.h #define PPC_PTRACE_GETREGS      0x99    /* Get GPRs 0 - 31 */
#define PPC_PTRACE_SETREGS      0x98    /* Set GPRs 0 - 31 */

A similar issue may exist for sparc64, but I doubt it:

[root@localhost /]# egrep 'PTRACE_[GS]ETREGS' /scratch/fc4/kernel/include/asm-sparc*/ptrace.h /scratch/fc4/kernel/include/asm-sparc64/ptrace.h:#define PTRACE_GETREGS            12 /scratch/fc4/kernel/include/asm-sparc64/ptrace.h:#define PTRACE_SETREGS            13 /scratch/fc4/kernel/include/asm-sparc64/ptrace.h:#define PTRACE_GETREGS64         22 /scratch/fc4/kernel/include/asm-sparc64/ptrace.h:#define PTRACE_SETREGS64         23 /scratch/fc4/kernel/include/asm-sparc/ptrace.h:#define PTRACE_GETREGS            12 /scratch/fc4/kernel/include/asm-sparc/ptrace.h:#define PTRACE_SETREGS            13

Quoted 1 line

What kernel version are you using again?

If the new version from CVS doesn't compile, your build tree or
compile options are most likely not properly setup:

[garrcoop@sjc-lds-265 /nobackup/garrcoop/main]$ file contrib/ltp/obj-ppc64/testcases/kernel/syscalls/ptrace/ptrace0* contrib/ltp/obj-ppc64/testcases/kernel/syscalls/ptrace/ptrace01: ELF 64-bit MSB executable, cisco 7500, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), not stripped contrib/ltp/obj-ppc64/testcases/kernel/syscalls/ptrace/ptrace02: ELF 64-bit MSB executable, cisco 7500, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), not stripped contrib/ltp/obj-ppc64/testcases/kernel/syscalls/ptrace/ptrace03: ELF 64-bit MSB executable, cisco 7500, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), not stripped contrib/ltp/obj-ppc64/testcases/kernel/syscalls/ptrace/ptrace04: ELF 64-bit MSB executable, cisco 7500, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), not stripped contrib/ltp/obj-ppc64/testcases/kernel/syscalls/ptrace/ptrace05: ELF 64-bit MSB executable, cisco 7500, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), not stripped

This is glibc 2.3.4 with kernel version 2.6.24. This was done with
a cross-compile toolchain from work.
Thanks,
-Garrett

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list