Short: Make MorphOS GCC output WarpOS binaries Author: dennisvdboon -> gmail (Dennis Boon) Uploader: dennisvdboon gmail com (Dennis Boon) Type: dev/gcc Version: 1.4 Replaces: dev/gcc/gcc-mos2wos* Architecture: ppc-morphos >= 3.13 Distribution: Aminet IT IS RECOMMENDED TO USE A CLEANLY INSTALLED MORPHOS SDK 3.14! The files in this archive will let you develop for WarpOS on a MorphOS machine. When looking at the warpup/powerup gcc compiler version 2.95.3 I noticed that it was actually a powerup compiler with the warpup extensions bolted on top of it using a custom gcc spec file. As powerup evolved into MorphOS, they actually use the same ABI. The only difference as I can tell is the __abox__ symbol being present in MorphOS binaries and not in powerup ELF binaries. So I adapted the spec files for various MorphOS gcc compilers firstly of SDK version 3.10 and later 3.14. I also recompiled warpcollect for MorphOS. Adaptations were also made to some of the powerup macros to let the newer gcc compiler accept them (clobbers and such). When invoking the gcc compiler for Morphos with the --specs=warpup option, instead of linking with the default linker (for example collect2) warpcollect is invoked which in its turn invokes Elf2Exe2 This will result in a WarpOS executable. For example: gcc --specs=warpup -O2 helloworld.c -o helloworld.exe Or for configure for example: CFLAGS="--specs=warpup -O2" CPPFLAGS=--specs=warpup LDFLAGS=--specs=warpup CXXFLAGS="--specs=warpup -O2" ./configure Options: At the moment the library looks for NOIXPATHS in ENVARC:. If set to 1 all paths are converted to Amiga format. /GG becomes GG: for example. Caveat: - Don't forget to use the #pragma pack(2) / pack() combo when using AmigaOS structures (that is, anything included from os-includeppc). - Even better would be #pragma pack(push,2) / pack(pop) combo. - This has only been tested with gcc 9 included with SDK 3.14. - This is a work in progress. Stuff might be broken. - COMPILED PROGRAMS WILL MAYBE NOT WORK (correctly) ON MOS. Make sure to also test on a Classic PPC machine with WarpOS. Default stack on real WarpOS and MOS systems is mostly insufficient (1-4KB). You may need to increase stack to make a program work. Benefits: - Now you can use the more up-to-date binutils of MorphOS. - Use of the newer gcc 9 compiler for C and C++ (compared to the old 2.95.3) KNOWN BUGS: - WarpOS uses a modified PowerOpen ABI while gcc uses SVR4 ABI. It can lead to stack troubles when switching between the two. It is a first thing to look at when stuff crash. That being said, I already compiled a lot with these compilers and the only problem showed in minigl/Warp3D where a lot of libraries are called in a row. A quick fix was put in place in powerpc/warpup_macros.h for this. - The internal errors of bsdsocket.library and newlib differ in some places. To this end, two errno.h files are added. The original with just EAGAIN adjusted and a modified AmiTCP (errno.h_bsdsocket). CURRENT INCLUDED LIBRARIES: - gcc(wos) 9.2.0 - stdc++ 9.2.0 - newlib 3.2.0 - bz2 1.0.8 - FLAC(++) 1.3.0 - freetype 2.9.1 - jpeg 9d - lua 5.4 / 5.0.3 - mad 0.15.1b - mgl 1.2 - mikmod 3.3.11.1 - ogg 1.3.4 - png 1.6.37 - pthreads 2.0 - SDL 1.2.15 - SDL_image 1.2.12 - SDL_mixer 1.2.12 - SDL_net 1.2.8 - SDL_ttf 2.0.11 - tiff 4.1.0 - vorbis 1.3.6 - zlib 1.2.11 - amigawos 0.1.0 Changes from version 1.3: - Added camd includes back. They were missing. - 15 bit screenmodes from SDL should now be correctly displayed. - Fixed warp3d.h resetting the pack alignment. - Added ftime() function. - Added rename() function. - Added truncate() function. - Upgraded to gcc 9 including libgcc and libstdc++. - Recompiled warpcollect to strip incompatible section type called .gnu.attributes. - Updated Newlib to 3.2.0. - Updated bz2 to 1.0.8. - Updated jpeg to 9d. - Updated lua to 5.4. - Updated ogg to 1.3.4. - Updated png to 1.6.37. - Updated tiff to 4.1.0. - Added new startupwos.o. If ppclibemu from Frank Wille is active, it now can load and start WOS ELF objects. Added original one for completeness. Changes from version 1.2: - Updated SDL 1.2.14 to 1.2.15. - malloc and friends now correctly return 0 when no memory available. - Added libamigawos containing ArgArrayInit, ArgString, ArgInt, ArgArrayDone, BeginIO, CreateExtIO, CreateStdIO, DeleteExtIO, DeleteStdIO, CreatePort, DeletePort, CreateTask, DeleteTask, FastRand, HotKey, RangeRand, TimeDelay, waitbeam. Also containing the constants ciaa, ciab, custom and AbsExecBase. - Added missing LP3FP macro (for SetFunction()). - Made more includes play nice with each other. Changes from version 1.1: - Corrected some includes regarding pthreads and networking. - Corrected various constructor/deconstructor priorities. - Printf Semaphore now freed upon exit. - libSDL now correctly detects all altivec enabled CPUs. - Added missing LP74A macro (for AddAppIcon()). - Updated inputevent.h with new mouse types. - Added cgxvideo includes. - Fixed loss of focus when playing games in a window with the mouse. - Added (missing) relative mouse mode. No more invisible mouse barriers. - Fixed some of the netinclude includes. - Warpcollect now points to correct path of ld. - Reinstated cybergraphx folder (copy from cybergraphics) for convenience. - Added fnmatch() function from Frank Wille's PosixLib. Changes from version 1.0: - Corrected the config files in /bin to reflect new paths. - libSDL_wos has been renamed to libSDL. - libSDL now shows correct colors again on MOS. - Function isatty now correctly detects redirected stdin/out. - Trying to close stdin/out now fails silently (no ENOENT). - Updated newlib from 3.0.0 to 3.1.0. - Updated FLAC from 1.2.1 to 1.3.0. - Added FLAC++. - Updated freetype from 2.8 to 2.9.1. - Updated jpeg from 9b to 9c. - Added lua from 5.3.5. Old lua now called lua50. - Updated mikmod from 3.1.12 to 3.3.11.1. - Updated ogg from 1.3.2 to 1.3.3. - Updated png from 1.6.34 to 1.6.36. - Updated tiff from 4.0.9 to 4.0.10. - Added libtiffxx. - Updated vorbis from 1.3.5 to 1.3.6. - Recompiled other libs with 6.4.0 and newlib 3.1.0 (they were from 5.3.0). - Added popen() and pclose() from Frank Wille's PosixLib to libglosswos. - Added pthreads from Szilard Biro, version 2.0 (see Aminet). Use -D_POSIX_THREADS while using -lpthread. Does not work 100% on MOS. - Child processes now correctly inherit stdin/stdout/stderr. - Printf is now protected by a semaphore. - Added creat() function. - Fixed minigl includes. Changes from version 0.9: - The malloc family uses AllocPooledPPC/FreePooledPPC. However, real WarpOS has an undocumented feature that saves the size of the memory request which gets loaded when FreePooledPPC gets a size of 0. However, the MOS emulation of WOS does not do this. This has been fixed. - The SDL library now should output correct colors on BVPPC and CVPPC. The library was adapted to Voodoo/Radeon but the Mediator has a built-in endian converter which of course is not the case with BVPPC/CVPPC. This was fixed by Wrangler. - Open files now use an internal buffer of 16k. Originally this was 512 bytes. Some recompiled programs/games will now load data (much) faster. Use the function setvbuf() to change this. Suggestion by Grelbfarik. - Correct sys/reent.h added. - Stripped all support for GCC version 4 and 5 and the libnix C library. Only newlib is now supported. - Cleaned up the various folders. Changes from version 0.8: - Wrangler fixed the SDL CD-ROM functions in libSDL_wos.a (newlib). - Added libSDL_net (untested - newlib). - Fixed ftruntace which used file pointer (fp) instead of file descriptor (fd) (newlib). - Added accept, bind, connect, gethostbyaddr, gethostbyname, gethostid, getnetbyaddr, getnetbyname, getpeername, getprotobyname, getprotobynumber, getservbyname, getservbyport, getsockname, getsockopt, inet_addr, inet_lnaof, inet_makeaddr, inet_netof, inet_network, inet_ntoa, listen, setprogname, getprogname, umask, recv, recvfrom, recvmsg, send, sendmsg, sendto, setsockopt, shutdown, socket, select, ioctl, getlogin, getpwnam, getpwuid, fsync, ffs, getdtablesize, dup, dup2, fcntl. -> Thanks to Frank Wille for PosixLib on which this was based! (newlib) - Updated close, read, write to handle sockets (newlib). - Updated dir functions readdir, opendir, rewinddir and closedir and updated associated includes (dirent.h - newlib). - Added various includes for sockets (newlib). - Opening, closing, reading and writing now done through fd (as intended) and not DOS filehandles (fh). Idea/source taken from Bebbo's newlib. - Updated pwd.h, grp.h to be bsdsocket.library compatible (newlib) - Updated errno.h with EAGAIN = 35 (newlib) - SEE KNOWN BUGS - All memory allocated with malloc now freed upon exiting program (newlib). - Fixed an error in the specs file of 4.4.5. Changes from version 0.7: - Fixed calloc. It was not clearing memory. WOS executables compiled with newlib now behave far better on MOS. - Added more libnix support for the newer compilers: - Added a new include dir /gg/include-std - Renamed /gg/ppc-amigaos/lib/2.95 to /gg/ppc-amigaos/lib/libnix - Old 2.95 dir can be deleted. - Updated warpnix specs file accordingly. - Fixed various bugs in libSDL_wos and updated it for both newlib and libnix. - Added sleep, getppid. Changes from version 0.6: - Improved the MOS hang workaround: Less 68K OS Calls. - Added dirname, chdir, execl, execle, execlp, execve, execvp. - Replaced gcc 5.3.0 files with 5.5.0. - Removed experimental gcc 2.95.4. - Added gcc 6.4.0 files. - Made several fixes (hopefully) to libSDL_wos. - Enabled Altivec code. - Added CD-ROM support. - Fixed joystick support. - Fixed endianness problem. - Renamed libnosys to libglosswos and adjusted specs files accordingly. - General clean-up. - THIS UPDATE NEEDS A CLEANLY INSTALLED MORPHOS SDK 3.12! Changes from version 0.5: - Added ftruncate, readlink, realpath, nanosleep, usleep, kprintf. - Added --specs=warpnix if you want to use libnix with 4.4.5/5.3.0. - Fixed various bugs including but not all: - Newlib now correctly uses 32 bit for time_t. - Closing stderr on MOS caused a hang on MOS. Implemented a work around. - Now unix paths are also correctly converted by mkdir in libnix. - Included correct/up-to-date Warp3D includes this time. Changes from version 0.4: - Separated 2.95 and 4.4.5/5.3.0 libs and updated specs files accordingly. - Added specs file, includes and compiled libs for 5.3.0. - Now you should use --specs=warpup option instead of the -warpup option. - Fixed an error in the 4.4.5 specs file. os-includeppc and -DWARPUP were not used. - Compiled newlib for WarpOS. It's the default c lib for 4.4.5 and 5.3.0. Default for 2.95.x is still libnix. - Compiled libgcc of the 4.4.5 package for WarpOS and added it for 4.4.5 and 5.3.0 (called libgccwos.a). - Compiled libstdc++ of the 5.3.0 package for WarpOS and added it for 4.4.5 and 5.3.0. - Newlib includes are in gg:/ppc-amigaos/newlib/include/ - Libs for 4.4.5/5 are in gg:/ppc-amigaos/newlib/lib/ - Fixed the semaphore functions in SDL Threads. They now put tasks in waiting states instead of performing busy-wait loops. - Added minigl library and updated includes (called libmgl.a). - Updated/corrected the Warp3D includes. - WarpOS macros now reserve a bit more stack to prevent callback issues. - Recompiled most of the libs with 5.3.0. - Removed libSDL_sound.a from 4.4.5/5.3.0. Obsolete and didn't work. - -WARPUP IS NO LONGER GUARANTEED TO WORK. USE --SPECS=WARPUP INSTEAD! Changes from version 0.3: - Both libnix 2 and 3 are missing __stdfiledes. DO NOT USE THIS IN YOUR CODE. I've added __get_handle and __set_handle to circumvent some of the issues with this. - Added CPUF_G3 and CPUF_G4 to powerpc.h. - Added RawDoFmtPPC to powerpc_protos.h (already in 0.3). - Added ftruncate to libnix. - Removed double truncate (in truncate.c and open.c) from libnix). - Added libiconv.a (already in 0.3). - Full screen from libSDL_wos was not working in 1.2.14. Reverted for video code back to 1.2.6. (already in 0.3) - Added Morgoth's experimental 2.95.4 compiler (version 4 with Altivec). Use gccselect 2.95.4 to use it. - Fixed stristr/strcasestr. It was pointing to a 68k utility.library function. Changes from version 0.2: - Compiled libnix for WarpOS and added it as libcwos.a. - Compiled the math functions from clib2 and added it to libcwos.a. - Added (obsolete?) libSDL_sound.a. - Removed obsolete libsmpeg.a; use libmad instead. - Recompiled/updated the other libs. - Added freetype-config and libpng-config to /bin. - Added -woslibs as option to link in all libs in the correct sequence. Changes from version 0.1: - Specfile for 4.4.5 was incorrect. A long line was wrapped. - Added various (updated) libs and headers. - Specfile for 2.95.3 was incorrect. Reversed libgccwos and libcwos link sequence (g++). Future: - If the Elf2Exe2 source can be supplied, any host with target ppc-morphos could compile also for WarpOS. Please let me know if you have it or know where to find it (It actually already can. but you would have to invoke Elf2Exe2 manually). Bug reporting: - Please report stuff that doesn't work to me. It would be even better if you could also supply the fix :-) I'll then re-upload a fixed version.