Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - gcc 4.2.1 tests - fails to compile lib/kdutil/ppc/cpu_map.c: (3 Items)
   
gcc 4.2.1 tests - fails to compile lib/kdutil/ppc/cpu_map.c  
Hi.  I've been running tests to resolve some outstanding issues with gcc 4.2.1.

This one seems like it's a compiler bug, rather than something in our source, but I'm not sure.

$ /usr/qnx630/host/qnx6/x86//usr/bin/qcc -V4.2.1,gcc_ntoppc -c -O -Wc,-mno-fp-moves -Wc,-Wall -Wc,-Wno-parentheses   -Wc
,-msoft-float -DNDEBUG   -I. -I/build/tinder/full/coreos-gcc421/top/lib/kdutil/ppc/a.be -I/build/tinder/full/coreos-
gcc421/top/lib/kdutil/ppc -I/build/tinder/full/coreos-gcc421/top/lib/kdutil -I/build/tinder/full/coreos-gcc421/top/lib/
kdutil/public -I/build/tinder/full/coreos-gcc421/stage/usr/include -I/usr/qnx630/target/qnx6/usr/include      -EB     -
DVARIANT_a -DVARIANT_be  /build/tinder/full/coreos-gcc421/top/lib/kdutil/ppc/cpu_map.c  
{standard input}: Assembler messages:
{standard input}:169: Error: Unrecognized opcode: `slbmte'
{standard input}:196: Error: Unrecognized opcode: `ptesync'
{standard input}:367: Error: Unrecognized opcode: `ptesync'
{standard input}:374: Error: Unrecognized opcode: `slbmte'
cc: /usr/qnx630/host/qnx6/x86/usr/bin/ntoppc-as-2.17 error 1


So, the compiler generates opcodes that the assembler doesn't recognize?  Seems like it's confusing different ppc 
variants or something.

I'm just not sure who to post the PR to - OS team or Tools, or what terms to search to see if it is a known problem.


 - Sada
Re: gcc 4.2.1 tests - fails to compile lib/kdutil/ppc/cpu_map.c  
> So, the compiler generates opcodes that the assembler doesn't recognize?  
> Seems like it's confusing different ppc variants or something.

If you trace the code, the assembly comes from inline assembly in ppc/inline.h not the compiler.
 
> I'm just not sure who to post the PR to - OS team or Tools, or what terms to 
> search to see if it is a known problem.

The problem is with both the tools and the code. The inline.h assumes a non-standard builtin assembler macro which is 
qnx specific. The new versions of the binutils do not recognize it. I will re-add support for the macro for backwards 
compatibility , but it would be nice if we could migrate to the standard ppc gas .machine pseudo-op.

If you apply the following diff to your $QNX_TARGET/usr/include/ppc/inline.h, you should be able to compile lib/kdutil 
with the current gcc 4.2.1 toolchain.

ryan@ryan:~/svn/product/trunk/lib/c/public/ppc$ svn diff
Index: inline.h
===================================================================
--- inline.h    (revision 157495)
+++ inline.h    (working copy)
@@ -63,6 +63,8 @@
                __asm__ __volatile__(                           \
                        ".ifdef PPC_CPUOP_ENABLED;"             \
                        ".cpu 403;"                                            \
+                       ".else;"                                \
+                       ".machine \"403\";"                     \
                        ".endif;"                                              \
                        "mfdcr %0,%1"                                   \
                        : "=r" (__val) : "i" (dcr) );   \
@@ -71,6 +73,8 @@
                __asm__ __volatile__(                           \
                        ".ifdef PPC_CPUOP_ENABLED;"             \
                        ".cpu 403;"                                            \
+                       ".else;"                                \
+                       ".machine \"403\";"                     \
                        ".endif;"                                              \
                        "mtdcr %0,%1"                                   \
                        : : "i" (dcr), "r" (val) )
@@ -91,12 +95,16 @@
                __asm__ __volatile__(                           \
                        ".ifdef PPC_CPUOP_ENABLED;"             \
                        ".cpu ppc64;"                                   \
+                       ".else;"                                \
+                       ".machine \"ppc64\";"                   \
                        ".endif;"                                              \
                        "lwsync")
 #define ppc_ptesync()                                          \
                __asm__ __volatile__(                           \
                        ".ifdef PPC_CPUOP_ENABLED;"             \
                        ".cpu ppc64;"                                   \
+                       ".else;"                                \
+                       ".machine \"ppc64\";"                   \
                        ".endif;"                                              \
                        "ptesync")

@@ -116,6 +124,8 @@
                __asm__ __volatile__(                           \
                        ".ifdef PPC_CPUOP_ENABLED;"             \
                        ".cpu ppc64;"                                   \
+                       ".else;"                                \
+                       ".machine \"ppc64\";"                   \
                        ".endif;"                                              \
                        "mfmsr  %2;"                                    \
                        "rlwinm %3,%2,0,17,15;"                 \
@@ -133,6 +143,8 @@
                __asm__ __volatile__(                           \
                        ".ifdef PPC_CPUOP_ENABLED;" ...
View Full Message
Re: gcc 4.2.1 tests - fails to compile lib/kdutil/ppc/cpu_map.c  
It is probably easier if I attach the diff as a file. :)

Regards,

Ryan Mansfield
Attachment: Text machine.diff 3.03 KB