The archive contains a set of patches to create a PowerPC compiler and debugger from the SAS/C 6.5x Developement system. You must have SAS/C 6.5x installed on your machine to use this archive. Also, you must have the original 6.50 disks. To install this patch, type execute install To create PowerPC object modules, use the SCPPC driver instead of the SC driver. To link with the SAS/C standard library, you must use THREE modules (as opposed to TWO in the 68k version). An example link command would look like: ppc-amigaos-ld -r -o exename lib:c_ppc.o lib:scppc.a lib:end.o c_ppc.o is equivalent to c.o in the 68k version. Source code is also provided for this module (c_ppc.c) scppc.a is equivalent to sc.lib and scm.lib. end.o is a new addition, required to make autoinitializers work. In the 68k version SLINK performs this extra work. If you are linking an executable that contains C++ code, then add lib:scppccxx.a before lib:scppc.a on the link line, ie ppc-amigaos-ld -r -o exename lib:c_ppc.o lib:scppccxx.a lib:scppc.a lib:end.o Alignment issues: By default, the PPC compiler aligns items on natural boundaries. This differs from the 68k compiler (which aligns items on at most 2 byte boundaries). The PPC compiler supports the following #pragma to change the alignment: #pragma options align=mac68k #pragma options align=power #pragma options align=reset At the end of any header file, the alignemt is reset back to what it was before the header file was included. INCLUDE: vs PPCINCLUDE: The compiler will search PPCINCLUDE: first, followed by INCLUDE:. Any header file that is pulled from INCLUDE: will automatically set the alignment to 68k style. New Features: Added six routines to the library scppc.a to make it easier to read and write from 68k system structures. The getenv()/putenv() routines use these to set WindowPtr = -1 so a requester does not appear if ENV: is not assigned. These prototypes are in stdio.h (for a lack of a better place to put them). These routines use PPCCallM68k() and use the 68k to perform the read and write, so it is safe to read and write system structures with these routines. void Write68kLong(long value, void *ptr); void Write68kShort(long value, void *ptr); void Write68kChar(long value, void *ptr); long Read68kLong(void *ptr); long Read68kShort(void *ptr); long Read68kChar(void *ptr); CPRPPC is able to catch the next PPC task that is started. To do this, type: cprppc -catch CPRPPC will then wait for the next PPC task to start, and will use the debugging information for . This is also usefull for debugging PPC program that are started from Workbench. Limitations: Currently, only the compiler and debugger are provided. You will need to use the linker provided with GCC. This compiler is compatible with GCC with the exception of passing structures by value. GST's are not supported in the PPC compiler. Placing strings in the code section is not supported. The compiler will ignore options to place strings in the code section, however, it will merge common strings with the STRMERGE option. The concept of near, far, and chip data is not supported. All data is treated as far. C++ Limitations: This version of C++ is slightly newer than the last experimental C++ for the 68k, however, it does not have the driver support included for implicit templates or RTTI. You should also use the C++ header files that are included in the Experimental C++ patch, not the 6.50 C++ header files. C++ supports the INCLUDE: vs PPCINCLUDE: alignment differences, but it does not support #pragma options align=... Examples: There are two examples in the 'examples' directory. The first is a simple "Hello World" program that also prints out its arguments. The second is a simple RPN calculator, that I use as the first test case whenever I create a new compiler. Also, in that directory is a small utility to execute ELF programs, called "runelf". This program runs ELF programs in the same manor as CPRPPC, with respect to setting up stdio and command line arguments. Simply CD to the examples directory, and run smake. Then try runelf hello.elf 1 2 3 4 5 or cprppc hello.elf 1 2 3 4 5 To use the calculator, try something like runelf calc.elf 1 2 + You can type '?' to get the list of functions it has. Revision History: Beta 18 Fix realloc(). Beta 17 New cut of C++ with several improvements/fixes. Fix _tzset() so it doesn't lose memory. Beta 16 Added support for running PPC programs from WorkBench, with Ralph Schmidt's LoadSeg Patch. Beta 15 Changed alignemt of 68k aligned structures in arrays to be more 68k-like. This change may require a full rebuild of your projects. Fixed problem in C++, where pointers in structures from INCLUDE: were not getting 68k aligned. Fixed bad uninitialized variable warnings following and empty switch statement. Beta 14 Added Readargs() support to CPRPPC to match runelf. Fix varargs handling (recognition of __optype) that I broke in Beta 11 in the process of adding alignment processing for C++. Runelf will return the PPC program's return code to the shell. Beta 13 Had the wrong version of the library scppc.a in Beta 12, so the taglist stubs weren't in there after all. They're really in there this time, honest :) Runelf has been modified to allow the use of ReadArgs() in PPC programs. Beta 12 Use Volker Barthelmann's 'FD2LibPPC' to generate stubs for all the varargs TAGLIST functions. Beta 11 Fix bug in builtin memset. C++ improvements/fixes. 1) Handle long mangled names better. 2) Do inlining in translater 3) Support PPCINCLUDE: and 68k alignement of structures in INCLUDE: Ignore CPU=060 option. Ignore FAR in a few more places that I missed previously. Beta 10 Fix bug in peephole opt if PROFILE was on. R31 was not saved and restored properly if it was only used in the epilog of the function. Beta 9 (not publicly released) Fix bug calling a function that returns a structure. In the case where the return was not used, the returned structure was placed in the wrong place on the stack, ovewritting other temporaries. Beta 8 (not publicly released) Fixed bug in scheduler. When Passing floats, scheduler did not recognize which regs were used as parameters properly, and could move a load of a register after the call. Use new method for CTRL-C detection in __chkabort(). It now uses PPCSetSignal() instead of SetSignal(). This should be faster, but also requires the PPCTASKSTAG_BREAKSIGNAL to be used when the task is created. This tag is only available in V45.5 and above. Runelf and CPRPPC have been modified to use this tag. Beta 7 (not publicly released) CPRPPC will pass a stack of no smaller than 64k to the program being debugged. Previously is would pass the shell stack size through. This change makes it behave like runelf. Fixed calling varargs function with doubles with tail recursion. CR6 was not being set properly. Fixed passing floats to functions declared in the old K&R style functions that also had a new style prototype. Driver was running the 68k version of C++ instead of the PPC version, causing improper sizes of structures with sizeof(). Beta 6 (not publicly released) Added C++ support. Fixed bug in scheduler that caused it to loop until memory was exhausted, in rare cases. Beta 5 Fix CTRL-C checking. Implemented the PROFILE option in the compiler. You can now use the SPROF utility with PPC programs. (Sprof runtime requires V45.3 of ppc.library). Fixed message when CPRPPC detects a CTRL-C. Fixed bad error when initializing a char array to a constant string of the exact length of the array (null byte truncated). Fixed code generation problem recieveing float paramters in new style function declaration. Fixed problem in 'runelf' not setting the minimum stack size to a multiple of four if the shell stack size was less than 64k. Beta 4 First public beta release. Known Bugs. 1) If you declare a varargs function INLINE, the optimizer will inline it, but the resulting code is incorrect. The optimizer needs to be taught not to inline varargs functions. Plans for the future. This beta version is by no means finished, and does not contain all of the features that the final (if there ever is such a thing) will have. These are some of the things that I am considering as future enhancements in the rough order of priority. 1) Stack checking and/or stack extension support. 2) Create a native PPC version of the compiler. 3) Runelf improvements: a) Look for elf program in path. b) add ability to merge runelf with an elf program to create a single executable. c) Make runelf run from Workbench. 4) long long support. 5) Port SLINK to elf format. 6) Port ASM to elf format. Please report bugs to Steve Krueger, at this email address: sekruege@mindspring.com