[gnu.gcc.help] gcc on Apollo

mike@vlsivie.tuwien.ac.at (Michael K. Gschwind) (02/15/91)

We just compiled sicstus Prolog for the Apollo with both /bin/cc and
gcc. While gcc offers some things which are A Good Thing for compiling 
Prolog interpreters (like allocating global variables to registers),
the size command exposed a problem:
% size //hal/usr/local/lib/sicstus0.7*/E*/sp*
gcc:                                         text(r) data(r/w) bss(r/w)
//hal/usr/local/lib/sicstus0.7-P3/Emulator/sp: 292 + 127736 + 1104 = 129882
cc:                                         text(r) data(r/w) bss(r/w)
//hal/usr/local/lib/sicstus0.7/Emulator/sp: 168752 + 8616 + 1080 = 251862

Sizes per se (the sum of all sizes) are absolutely uninteresting, 
but while cc allocates the program image to the read-only text section,
gas stores the stuff in in the r/w data section. Which - I think -
means that the image is not shareable (except if Apollo uses 
fancy copy-on-write strategies - does anybody know this ?). Also,
this can lead to inadvertant program corruption:

main()
{
	*((long *)main) - 0;
}

executes without protection violation - yuck !!

Has anybody found a workaround for this problem? Any hints will be
appreciated.

					bye,
						mike



Michael K. Gschwind, Institute for VLSI-Design, Vienna University of Technology
mike@vlsivie.tuwien.ac.at	1-2-3-4 kick the lawsuits out the door 
mike@vlsivie.uucp		5-6-7-8 innovate don't litigate         
e182202@awituw01.bitnet		9-A-B-C interfaces should be free
Voice: (++43).1.58801 8144	D-E-F-O look and feel has got to go!
Fax:   (++43).1.569697