I have built GPC 20041218 on GCC 3.3.4 on AIX 5.2, and thought it might be useful to document my experiences. I wanted to have the capacity to build 64 bit programs, however only 32 bit libraries are installed for GPC. Following my earlier post http://www.gnu- pascal.de/crystal/gpc/en/mail11115.html Waldek suggested trying build a 64 bit version of GCC including GPC. However having tried various strategies I was not successful in building a 64 bit only version of any version of GCC, even without GPC. So I tried to just build a 64 bit libgpc.a. I eventually achieved this
export OBJECT_MODE = 64 export CFLAGS=-maix64
then run ./configure in ...gcc3.3.4/gcc/p/rts directory
edit Makefile add -maix64 to CFLAGS (CFLAGS=-O2)
copy libgpc.a to ...lib/gcc-lib/power..../3.3.4/ppc64
This allowed me generate 64 bit programs. My program contained a reference to the memavail function in system.pas. I had earlier had some problems with this function in 32 bit mode when it gave an error http://www.gnu-pascal.de/crystal/gpc/en/mail11086.htm
In 64 bit mode the use of this function did not report an error but partly disabled the operating system, which should have been quite impossible for a normal user without root privileges! The operator had to reset the machine following this error. Programs without this function call seem to work fine.
Peter Keenan wrote:
This allowed me generate 64 bit programs. My program contained a reference to the memavail function in system.pas. I had earlier had some problems with this function in 32 bit mode when it gave an error http://www.gnu-pascal.de/crystal/gpc/en/mail11086.htm
In 64 bit mode the use of this function did not report an error but partly disabled the operating system, which should have been quite impossible for a normal user without root privileges!
That would indicate a system bug, because GPC compiled programs can't do anything the system doesn't allow them to do, of course. If such a program can partly disable the OS incidentally, a malicious program could do as least as much damage.
Now, I'm not sure what it actually disabled -- perhaps it just went trashing swap memory or occupying all virtual memory -- things that, indeed, any normal program can do. The usual cure would be to set ulimit reasonably. (Though a well-designed OS, in case of virtual memory shortage, should IMHO kill the most memory-intensive, non-system-critical processes first, which would be this program in this case, so things should go well. Apparently it didn't.)
BTW, you did read the comments about MemAvail in the System unit? The bottom line is that you probably don't want to use it. They're provided for compatibility with a 20 years old 16 bit compiler on a single-user system, and not very useful for modern programs for several reasons.
Frank