short : Make MorphOS GCC output WarpOS binaries author : dennisvdboon -> gmail (Dennis Boon) uploader : dennisvdboon gmail com (Dennis Boon) type : dev/gcc version : 1.0 architecture : ppc-morphos >= 3.10 distribution : Aminet Filetype : application/x-lzh-compressed Size : 7.69M Date : 3-Jan-19 Download : 💾 https://de3.aminet.net/dev/gcc/gcc-mos2wos-lite.lha
IT IS RECOMMENDED TO USE A CLEANLY INSTALLED MORPHOS SDK 3.12! 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.12. 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 6.4 included with SDK 3.12. - 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 6.4.0 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). Changes from mos2wos non-lite 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. For earlier changes see the gcc-mos2wos package on aminet. That package will no longer be supported. However, you can still copy the contents of this archive to the correct folders of the old mos2wos package to upgrade it. 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.